relay-ide 0.1.0
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/README.md +259 -0
- package/dist/bin/claude-remote-cli.js +390 -0
- package/dist/bin/relay-ide.js +390 -0
- package/dist/frontend/assets/abap-BdImnpbu.js +1 -0
- package/dist/frontend/assets/actionscript-3-CoDkCxhg.js +1 -0
- package/dist/frontend/assets/ada-bCR0ucgS.js +1 -0
- package/dist/frontend/assets/andromeeda-C4gqWexZ.js +1 -0
- package/dist/frontend/assets/angular-html-DA-rfuFy.js +1 -0
- package/dist/frontend/assets/angular-ts-BrjP3tb8.js +1 -0
- package/dist/frontend/assets/apache-Pmp26Uib.js +1 -0
- package/dist/frontend/assets/apex-D8_7TLub.js +1 -0
- package/dist/frontend/assets/apl-CORt7UWP.js +1 -0
- package/dist/frontend/assets/applescript-Co6uUVPk.js +1 -0
- package/dist/frontend/assets/ara-BRHolxvo.js +1 -0
- package/dist/frontend/assets/asciidoc-Ve4PFQV2.js +1 -0
- package/dist/frontend/assets/asm-D_Q5rh1f.js +1 -0
- package/dist/frontend/assets/astro-HNnZUWAn.js +1 -0
- package/dist/frontend/assets/aurora-x-D-2ljcwZ.js +1 -0
- package/dist/frontend/assets/awk-DMzUqQB5.js +1 -0
- package/dist/frontend/assets/ayu-dark-DYE7WIF3.js +1 -0
- package/dist/frontend/assets/ayu-light-BA47KaF1.js +1 -0
- package/dist/frontend/assets/ayu-mirage-32ctXXKs.js +1 -0
- package/dist/frontend/assets/ballerina-BFfxhgS-.js +1 -0
- package/dist/frontend/assets/bat-BkioyH1T.js +1 -0
- package/dist/frontend/assets/beancount-k_qm7-4y.js +1 -0
- package/dist/frontend/assets/berry-uYugtg8r.js +1 -0
- package/dist/frontend/assets/bibtex-CHM0blh-.js +1 -0
- package/dist/frontend/assets/bicep-Bmn6On1c.js +1 -0
- package/dist/frontend/assets/bird2-BIv1doCn.js +1 -0
- package/dist/frontend/assets/blade-BjGOyj-B.js +1 -0
- package/dist/frontend/assets/bsl-BO_Y6i37.js +1 -0
- package/dist/frontend/assets/c-BIGW1oBm.js +1 -0
- package/dist/frontend/assets/c3-eo99z4R2.js +1 -0
- package/dist/frontend/assets/cadence-Bv_4Rxtq.js +1 -0
- package/dist/frontend/assets/cairo-KRGpt6FW.js +1 -0
- package/dist/frontend/assets/catppuccin-frappe-DFWUc33u.js +1 -0
- package/dist/frontend/assets/catppuccin-latte-C9dUb6Cb.js +1 -0
- package/dist/frontend/assets/catppuccin-macchiato-DQyhUUbL.js +1 -0
- package/dist/frontend/assets/catppuccin-mocha-D87Tk5Gz.js +1 -0
- package/dist/frontend/assets/clarity-D53aC0YG.js +1 -0
- package/dist/frontend/assets/clojure-P80f7IUj.js +1 -0
- package/dist/frontend/assets/cmake-D1j8_8rp.js +1 -0
- package/dist/frontend/assets/cobol-nBiQ_Alo.js +1 -0
- package/dist/frontend/assets/codeowners-Bp6g37R7.js +1 -0
- package/dist/frontend/assets/codeql-DsOJ9woJ.js +1 -0
- package/dist/frontend/assets/coffee-Ch7k5sss.js +1 -0
- package/dist/frontend/assets/common-lisp-Cg-RD9OK.js +1 -0
- package/dist/frontend/assets/coq-DkFqJrB1.js +1 -0
- package/dist/frontend/assets/cpp-CofmeUqb.js +1 -0
- package/dist/frontend/assets/crystal-DNxU26gB.js +1 -0
- package/dist/frontend/assets/csharp-COcwbKMJ.js +1 -0
- package/dist/frontend/assets/css-CLj8gQPS.js +1 -0
- package/dist/frontend/assets/csv-fuZLfV_i.js +1 -0
- package/dist/frontend/assets/cue-D82EKSYY.js +1 -0
- package/dist/frontend/assets/cypher-COkxafJQ.js +1 -0
- package/dist/frontend/assets/d-85-TOEBH.js +1 -0
- package/dist/frontend/assets/dark-plus-C3mMm8J8.js +1 -0
- package/dist/frontend/assets/dart-bE4Kk8sk.js +1 -0
- package/dist/frontend/assets/dax-CEL-wOlO.js +1 -0
- package/dist/frontend/assets/desktop-BmXAJ9_W.js +1 -0
- package/dist/frontend/assets/diff-D97Zzqfu.js +1 -0
- package/dist/frontend/assets/docker-BcOcwvcX.js +1 -0
- package/dist/frontend/assets/dotenv-Da5cRb03.js +1 -0
- package/dist/frontend/assets/dracula-BzJJZx-M.js +1 -0
- package/dist/frontend/assets/dracula-soft-BXkSAIEj.js +1 -0
- package/dist/frontend/assets/dream-maker-BtqSS_iP.js +1 -0
- package/dist/frontend/assets/edge-FbVlp4U3.js +1 -0
- package/dist/frontend/assets/elixir-CkH2-t6x.js +1 -0
- package/dist/frontend/assets/elm-DbKCFpqz.js +1 -0
- package/dist/frontend/assets/emacs-lisp-CXvaQtF9.js +1 -0
- package/dist/frontend/assets/erb-BYCe7drp.js +1 -0
- package/dist/frontend/assets/erlang-DsQrWhSR.js +1 -0
- package/dist/frontend/assets/everforest-dark-BgDCqdQA.js +1 -0
- package/dist/frontend/assets/everforest-light-C8M2exoo.js +1 -0
- package/dist/frontend/assets/fennel-BYunw83y.js +1 -0
- package/dist/frontend/assets/fish-BvzEVeQv.js +1 -0
- package/dist/frontend/assets/fluent-C4IJs8-o.js +1 -0
- package/dist/frontend/assets/fortran-fixed-form-CkoXwp7k.js +1 -0
- package/dist/frontend/assets/fortran-free-form-BxgE0vQu.js +1 -0
- package/dist/frontend/assets/fsharp-CXgrBDvD.js +1 -0
- package/dist/frontend/assets/gdresource-BOOCDP_w.js +1 -0
- package/dist/frontend/assets/gdscript-C5YyOfLZ.js +1 -0
- package/dist/frontend/assets/gdshader-DkwncUOv.js +1 -0
- package/dist/frontend/assets/genie-D0YGMca9.js +1 -0
- package/dist/frontend/assets/gherkin-DyxjwDmM.js +1 -0
- package/dist/frontend/assets/git-commit-F4YmCXRG.js +1 -0
- package/dist/frontend/assets/git-rebase-r7XF79zn.js +1 -0
- package/dist/frontend/assets/github-dark-DHJKELXO.js +1 -0
- package/dist/frontend/assets/github-dark-default-Cuk6v7N8.js +1 -0
- package/dist/frontend/assets/github-dark-dimmed-DH5Ifo-i.js +1 -0
- package/dist/frontend/assets/github-dark-high-contrast-E3gJ1_iC.js +1 -0
- package/dist/frontend/assets/github-light-DAi9KRSo.js +1 -0
- package/dist/frontend/assets/github-light-default-D7oLnXFd.js +1 -0
- package/dist/frontend/assets/github-light-high-contrast-BfjtVDDH.js +1 -0
- package/dist/frontend/assets/gleam-BspZqrRM.js +1 -0
- package/dist/frontend/assets/glimmer-js-ByusRIyA.js +1 -0
- package/dist/frontend/assets/glimmer-ts-BfAWNZQY.js +1 -0
- package/dist/frontend/assets/glsl-DplSGwfg.js +1 -0
- package/dist/frontend/assets/gn-n2N0HUVH.js +1 -0
- package/dist/frontend/assets/gnuplot-DdkO51Og.js +1 -0
- package/dist/frontend/assets/go-C27-OAKa.js +1 -0
- package/dist/frontend/assets/graphql-ChdNCCLP.js +1 -0
- package/dist/frontend/assets/groovy-gcz8RCvz.js +1 -0
- package/dist/frontend/assets/gruvbox-dark-hard-CFHQjOhq.js +1 -0
- package/dist/frontend/assets/gruvbox-dark-medium-GsRaNv29.js +1 -0
- package/dist/frontend/assets/gruvbox-dark-soft-CVdnzihN.js +1 -0
- package/dist/frontend/assets/gruvbox-light-hard-CH1njM8p.js +1 -0
- package/dist/frontend/assets/gruvbox-light-medium-DRw_LuNl.js +1 -0
- package/dist/frontend/assets/gruvbox-light-soft-hJgmCMqR.js +1 -0
- package/dist/frontend/assets/hack-i7_Ulhet.js +1 -0
- package/dist/frontend/assets/haml-D5jkg6IW.js +1 -0
- package/dist/frontend/assets/handlebars-BpdQsYii.js +1 -0
- package/dist/frontend/assets/haskell-Df6bDoY_.js +1 -0
- package/dist/frontend/assets/haxe-CzTSHFRz.js +1 -0
- package/dist/frontend/assets/hcl-BWvSN4gD.js +1 -0
- package/dist/frontend/assets/hjson-D5-asLiD.js +1 -0
- package/dist/frontend/assets/hlsl-D3lLCCz7.js +1 -0
- package/dist/frontend/assets/horizon-BUw7H-hv.js +1 -0
- package/dist/frontend/assets/horizon-bright-CUuTKBJd.js +1 -0
- package/dist/frontend/assets/houston-DnULxvSX.js +1 -0
- package/dist/frontend/assets/html-derivative-DlHx6ybY.js +1 -0
- package/dist/frontend/assets/html-pp8916En.js +1 -0
- package/dist/frontend/assets/http-jrhK8wxY.js +1 -0
- package/dist/frontend/assets/hurl-irOxFIW8.js +1 -0
- package/dist/frontend/assets/hxml-Bvhsp5Yf.js +1 -0
- package/dist/frontend/assets/hy-DFXneXwc.js +1 -0
- package/dist/frontend/assets/imba-DGztddWO.js +1 -0
- package/dist/frontend/assets/ini-BEwlwnbL.js +1 -0
- package/dist/frontend/assets/java-CylS5w8V.js +1 -0
- package/dist/frontend/assets/javascript-wDzz0qaB.js +1 -0
- package/dist/frontend/assets/jinja-f2NsQr07.js +1 -0
- package/dist/frontend/assets/jison-wvAkD_A8.js +1 -0
- package/dist/frontend/assets/json-Cp-IABpG.js +1 -0
- package/dist/frontend/assets/json5-C9tS-k6U.js +1 -0
- package/dist/frontend/assets/jsonc-Des-eS-w.js +1 -0
- package/dist/frontend/assets/jsonl-DcaNXYhu.js +1 -0
- package/dist/frontend/assets/jsonnet-DFQXde-d.js +1 -0
- package/dist/frontend/assets/jssm-C2t-YnRu.js +1 -0
- package/dist/frontend/assets/jsx-g9-lgVsj.js +1 -0
- package/dist/frontend/assets/julia-CxzCAyBv.js +1 -0
- package/dist/frontend/assets/just-VxiPbLrw.js +1 -0
- package/dist/frontend/assets/kanagawa-dragon-CkXjmgJE.js +1 -0
- package/dist/frontend/assets/kanagawa-lotus-CfQXZHmo.js +1 -0
- package/dist/frontend/assets/kanagawa-wave-DWedfzmr.js +1 -0
- package/dist/frontend/assets/kdl-DV7GczEv.js +1 -0
- package/dist/frontend/assets/kotlin-BdnUsdx6.js +1 -0
- package/dist/frontend/assets/kusto-wEQ09or8.js +1 -0
- package/dist/frontend/assets/laserwave-DUszq2jm.js +1 -0
- package/dist/frontend/assets/latex-CWtU0Tv5.js +1 -0
- package/dist/frontend/assets/lean-BZvkOJ9d.js +1 -0
- package/dist/frontend/assets/less-B1dDrJ26.js +1 -0
- package/dist/frontend/assets/light-plus-B7mTdjB0.js +1 -0
- package/dist/frontend/assets/liquid-C0sCDyMI.js +1 -0
- package/dist/frontend/assets/llvm-DjAJT7YJ.js +1 -0
- package/dist/frontend/assets/log-2UxHyX5q.js +1 -0
- package/dist/frontend/assets/logo-BtOb2qkB.js +1 -0
- package/dist/frontend/assets/lua-BaeVxFsk.js +1 -0
- package/dist/frontend/assets/luau-C-HG3fhB.js +1 -0
- package/dist/frontend/assets/main-CL5_Wlhv.css +32 -0
- package/dist/frontend/assets/main-Czet4Z1x.js +371 -0
- package/dist/frontend/assets/make-CHLpvVh8.js +1 -0
- package/dist/frontend/assets/markdown-Cvjx9yec.js +1 -0
- package/dist/frontend/assets/marko-DjSrsDqO.js +1 -0
- package/dist/frontend/assets/material-theme-D5KoaKCx.js +1 -0
- package/dist/frontend/assets/material-theme-darker-BfHTSMKl.js +1 -0
- package/dist/frontend/assets/material-theme-lighter-B0m2ddpp.js +1 -0
- package/dist/frontend/assets/material-theme-ocean-CyktbL80.js +1 -0
- package/dist/frontend/assets/material-theme-palenight-Csfq5Kiy.js +1 -0
- package/dist/frontend/assets/matlab-D7o27uSR.js +1 -0
- package/dist/frontend/assets/mdc-DTYItulj.js +1 -0
- package/dist/frontend/assets/mdx-Cmh6b_Ma.js +1 -0
- package/dist/frontend/assets/mermaid-mWjccvbQ.js +1 -0
- package/dist/frontend/assets/min-dark-CafNBF8u.js +1 -0
- package/dist/frontend/assets/min-light-CTRr51gU.js +1 -0
- package/dist/frontend/assets/mipsasm-CKIfxQSi.js +1 -0
- package/dist/frontend/assets/mojo-rZm6bMo-.js +1 -0
- package/dist/frontend/assets/monokai-D4h5O-jR.js +1 -0
- package/dist/frontend/assets/moonbit-_H4v1dQx.js +1 -0
- package/dist/frontend/assets/move-IF9eRakj.js +1 -0
- package/dist/frontend/assets/narrat-DRg8JJMk.js +1 -0
- package/dist/frontend/assets/nextflow-C-mBbutL.js +1 -0
- package/dist/frontend/assets/nextflow-groovy-vE_lwT2v.js +1 -0
- package/dist/frontend/assets/nginx-BpAMiNFr.js +1 -0
- package/dist/frontend/assets/night-owl-C39BiMTA.js +1 -0
- package/dist/frontend/assets/night-owl-light-CMTm3GFP.js +1 -0
- package/dist/frontend/assets/nim-BIad80T-.js +1 -0
- package/dist/frontend/assets/nix-CwoSXNpI.js +1 -0
- package/dist/frontend/assets/nord-Ddv68eIx.js +1 -0
- package/dist/frontend/assets/nushell-Cz2AlsmD.js +1 -0
- package/dist/frontend/assets/objective-c-DXmwc3jG.js +1 -0
- package/dist/frontend/assets/objective-cpp-CLxacb5B.js +1 -0
- package/dist/frontend/assets/ocaml-C0hk2d4L.js +1 -0
- package/dist/frontend/assets/odin-BBf5iR-q.js +1 -0
- package/dist/frontend/assets/one-dark-pro-DVMEJ2y_.js +1 -0
- package/dist/frontend/assets/one-light-C3Wv6jpd.js +1 -0
- package/dist/frontend/assets/openscad-C4EeE6gA.js +1 -0
- package/dist/frontend/assets/pascal-D93ZcfNL.js +1 -0
- package/dist/frontend/assets/perl-NvoQZIq0.js +1 -0
- package/dist/frontend/assets/php-R6g_5hLQ.js +1 -0
- package/dist/frontend/assets/pkl-u5AG7uiY.js +1 -0
- package/dist/frontend/assets/plastic-3e1v2bzS.js +1 -0
- package/dist/frontend/assets/plsql-ChMvpjG-.js +1 -0
- package/dist/frontend/assets/po-BTJTHyun.js +1 -0
- package/dist/frontend/assets/poimandres-CS3Unz2-.js +1 -0
- package/dist/frontend/assets/polar-C0HS_06l.js +1 -0
- package/dist/frontend/assets/postcss-CXtECtnM.js +1 -0
- package/dist/frontend/assets/powerquery-CEu0bR-o.js +1 -0
- package/dist/frontend/assets/powershell-Dpen1YoG.js +1 -0
- package/dist/frontend/assets/prisma-Dd19v3D-.js +1 -0
- package/dist/frontend/assets/prolog-CbFg5uaA.js +1 -0
- package/dist/frontend/assets/proto-C7zT0LnQ.js +1 -0
- package/dist/frontend/assets/pug-DKIMFp6K.js +1 -0
- package/dist/frontend/assets/puppet-BMWR74SV.js +1 -0
- package/dist/frontend/assets/purescript-CklMAg4u.js +1 -0
- package/dist/frontend/assets/python-B6aJPvgy.js +1 -0
- package/dist/frontend/assets/qml-3beO22l8.js +1 -0
- package/dist/frontend/assets/qmldir-C8lEn-DE.js +1 -0
- package/dist/frontend/assets/qss-IeuSbFQv.js +1 -0
- package/dist/frontend/assets/r-Dspwwk_N.js +1 -0
- package/dist/frontend/assets/racket-BqYA7rlc.js +1 -0
- package/dist/frontend/assets/raku-DXvB9xmW.js +1 -0
- package/dist/frontend/assets/razor-BDqjjVU7.js +1 -0
- package/dist/frontend/assets/red-bN70gL4F.js +1 -0
- package/dist/frontend/assets/reg-C-SQnVFl.js +1 -0
- package/dist/frontend/assets/regexp-CDVJQ6XC.js +1 -0
- package/dist/frontend/assets/rel-C3B-1QV4.js +1 -0
- package/dist/frontend/assets/riscv-BM1_JUlF.js +1 -0
- package/dist/frontend/assets/ron-D8l8udqQ.js +1 -0
- package/dist/frontend/assets/rose-pine-dawn-DHQR4-dF.js +1 -0
- package/dist/frontend/assets/rose-pine-moon-D4_iv3hh.js +1 -0
- package/dist/frontend/assets/rose-pine-qdsjHGoJ.js +1 -0
- package/dist/frontend/assets/rosmsg-BJDFO7_C.js +1 -0
- package/dist/frontend/assets/rst-CRjBmOyv.js +1 -0
- package/dist/frontend/assets/ruby-Wjq7vjNf.js +1 -0
- package/dist/frontend/assets/rust-B1yitclQ.js +1 -0
- package/dist/frontend/assets/sas-cz2c8ADy.js +1 -0
- package/dist/frontend/assets/sass-Cj5Yp3dK.js +1 -0
- package/dist/frontend/assets/scala-C151Ov-r.js +1 -0
- package/dist/frontend/assets/scheme-C98Dy4si.js +1 -0
- package/dist/frontend/assets/scss-D5BDwBP9.js +1 -0
- package/dist/frontend/assets/sdbl-DVxCFoDh.js +1 -0
- package/dist/frontend/assets/shaderlab-Dg9Lc6iA.js +1 -0
- package/dist/frontend/assets/shellscript-Yzrsuije.js +1 -0
- package/dist/frontend/assets/shellsession-BADoaaVG.js +1 -0
- package/dist/frontend/assets/slack-dark-BthQWCQV.js +1 -0
- package/dist/frontend/assets/slack-ochin-DqwNpetd.js +1 -0
- package/dist/frontend/assets/smalltalk-BERRCDM3.js +1 -0
- package/dist/frontend/assets/snazzy-light-Bw305WKR.js +1 -0
- package/dist/frontend/assets/solarized-dark-DXbdFlpD.js +1 -0
- package/dist/frontend/assets/solarized-light-L9t79GZl.js +1 -0
- package/dist/frontend/assets/solidity-rGO070M0.js +1 -0
- package/dist/frontend/assets/soy-8wufbnw4.js +1 -0
- package/dist/frontend/assets/sparql-rVzFXLq3.js +1 -0
- package/dist/frontend/assets/splunk-BtCnVYZw.js +1 -0
- package/dist/frontend/assets/sql-BLtJtn59.js +1 -0
- package/dist/frontend/assets/ssh-config-_ykCGR6B.js +1 -0
- package/dist/frontend/assets/stata-BH5u7GGu.js +1 -0
- package/dist/frontend/assets/stylus-BEDo0Tqx.js +1 -0
- package/dist/frontend/assets/surrealql-Bq5Q-fJD.js +1 -0
- package/dist/frontend/assets/svelte-Cy7k_4gC.js +1 -0
- package/dist/frontend/assets/swift-D82vCrfD.js +1 -0
- package/dist/frontend/assets/synthwave-84-CbfX1IO0.js +1 -0
- package/dist/frontend/assets/system-verilog-CnnmHF94.js +1 -0
- package/dist/frontend/assets/systemd-4A_iFExJ.js +1 -0
- package/dist/frontend/assets/talonscript-CkByrt1z.js +1 -0
- package/dist/frontend/assets/tasl-QIJgUcNo.js +1 -0
- package/dist/frontend/assets/tcl-dwOrl1Do.js +1 -0
- package/dist/frontend/assets/templ-DhtptRzy.js +1 -0
- package/dist/frontend/assets/terraform-BETggiCN.js +1 -0
- package/dist/frontend/assets/tex-idrVyKtj.js +1 -0
- package/dist/frontend/assets/tokyo-night-hegEt444.js +1 -0
- package/dist/frontend/assets/toml-vGWfd6FD.js +1 -0
- package/dist/frontend/assets/ts-tags-DQrlYJgV.js +1 -0
- package/dist/frontend/assets/tsv-B_m7g4N7.js +1 -0
- package/dist/frontend/assets/tsx-COt5Ahok.js +1 -0
- package/dist/frontend/assets/turtle-BsS91CYL.js +1 -0
- package/dist/frontend/assets/twig-xg9kU7Mw.js +1 -0
- package/dist/frontend/assets/typescript-BPQ3VLAy.js +1 -0
- package/dist/frontend/assets/typespec-CAFt9gP4.js +1 -0
- package/dist/frontend/assets/typst-DHCkPAjA.js +1 -0
- package/dist/frontend/assets/v-BcVCzyr7.js +1 -0
- package/dist/frontend/assets/vala-CsfeWuGM.js +1 -0
- package/dist/frontend/assets/vb-D17OF-Vu.js +1 -0
- package/dist/frontend/assets/verilog-BQ8w6xss.js +1 -0
- package/dist/frontend/assets/vesper-DU1UobuO.js +1 -0
- package/dist/frontend/assets/vhdl-CeAyd5Ju.js +1 -0
- package/dist/frontend/assets/viml-CJc9bBzg.js +1 -0
- package/dist/frontend/assets/vitesse-black-Bkuqu6BP.js +1 -0
- package/dist/frontend/assets/vitesse-dark-D0r3Knsf.js +1 -0
- package/dist/frontend/assets/vitesse-light-CVO1_9PV.js +1 -0
- package/dist/frontend/assets/vue-D2xRrEX4.js +1 -0
- package/dist/frontend/assets/vue-html-AaS7Mt5G.js +1 -0
- package/dist/frontend/assets/vue-vine-BoDAl6tE.js +1 -0
- package/dist/frontend/assets/vyper-CDx5xZoG.js +1 -0
- package/dist/frontend/assets/wasm-CG6Dc4jp.js +1 -0
- package/dist/frontend/assets/wasm-MzD3tlZU.js +1 -0
- package/dist/frontend/assets/wenyan-BV7otONQ.js +1 -0
- package/dist/frontend/assets/wgsl-Dx-B1_4e.js +1 -0
- package/dist/frontend/assets/wikitext-BhOHFoWU.js +1 -0
- package/dist/frontend/assets/wit-5i3qLPDT.js +1 -0
- package/dist/frontend/assets/wolfram-lXgVvXCa.js +1 -0
- package/dist/frontend/assets/xml-sdJ4AIDG.js +1 -0
- package/dist/frontend/assets/xsl-CtQFsRM5.js +1 -0
- package/dist/frontend/assets/yaml-Buea-lGh.js +1 -0
- package/dist/frontend/assets/zenscript-DVFEvuxE.js +1 -0
- package/dist/frontend/assets/zig-VOosw3JB.js +1 -0
- package/dist/frontend/icon-192.png +0 -0
- package/dist/frontend/icon-512.png +0 -0
- package/dist/frontend/icon.svg +8 -0
- package/dist/frontend/index.html +30 -0
- package/dist/frontend/manifest.json +25 -0
- package/dist/frontend/sw.js +66 -0
- package/dist/server/agent-events.js +39 -0
- package/dist/server/analytics.js +885 -0
- package/dist/server/auth.js +65 -0
- package/dist/server/belayer/executor.js +200 -0
- package/dist/server/belayer/intake.js +27 -0
- package/dist/server/belayer/pipeline.js +97 -0
- package/dist/server/belayer/pr-lifecycle.js +69 -0
- package/dist/server/belayer/prompts.js +154 -0
- package/dist/server/belayer/types.js +23 -0
- package/dist/server/branch-linker.js +137 -0
- package/dist/server/browser-content.js +145 -0
- package/dist/server/clipboard.js +63 -0
- package/dist/server/codex-hooks-adapter.js +93 -0
- package/dist/server/config.js +325 -0
- package/dist/server/gh-routes.js +163 -0
- package/dist/server/gh.js +276 -0
- package/dist/server/git-routes.js +154 -0
- package/dist/server/git.js +694 -0
- package/dist/server/github-app.js +218 -0
- package/dist/server/github-graphql.js +178 -0
- package/dist/server/hooks.js +373 -0
- package/dist/server/index.js +1549 -0
- package/dist/server/integration-github.js +137 -0
- package/dist/server/integration-jira.js +210 -0
- package/dist/server/integration-linear.js +176 -0
- package/dist/server/logger.js +18 -0
- package/dist/server/mobile-input-pipeline.js +129 -0
- package/dist/server/opencode-relay.js +53 -0
- package/dist/server/org-dashboard.js +241 -0
- package/dist/server/output-parsers/claude-parser.js +56 -0
- package/dist/server/output-parsers/codex-parser.js +13 -0
- package/dist/server/output-parsers/index.js +14 -0
- package/dist/server/output-parsers/null-parser.js +12 -0
- package/dist/server/output-parsers/opencode-parser.js +77 -0
- package/dist/server/pty-handler.js +586 -0
- package/dist/server/push.js +84 -0
- package/dist/server/review-poller.js +237 -0
- package/dist/server/sdk-handler.js +539 -0
- package/dist/server/service.js +189 -0
- package/dist/server/sessions.js +638 -0
- package/dist/server/telemetry.js +236 -0
- package/dist/server/ticket-transitions.js +166 -0
- package/dist/server/types.js +146 -0
- package/dist/server/utils.js +23 -0
- package/dist/server/watcher.js +661 -0
- package/dist/server/webhook-manager.js +547 -0
- package/dist/server/webhooks.js +73 -0
- package/dist/server/workspace-groups.js +363 -0
- package/dist/server/workspaces.js +1207 -0
- package/dist/server/ws.js +192 -0
- package/dist/test/EmptyState.spec.js +51 -0
- package/dist/test/action-coverage.test.js +139 -0
- package/dist/test/actions/registry.test.js +59 -0
- package/dist/test/actions/shortcuts.test.js +79 -0
- package/dist/test/agent-events.test.js +151 -0
- package/dist/test/analytics.test.js +158 -0
- package/dist/test/attention.test.js +91 -0
- package/dist/test/auth.test.js +105 -0
- package/dist/test/backend-state.test.js +47 -0
- package/dist/test/belayer-executor.test.js +33 -0
- package/dist/test/belayer-intake.test.js +44 -0
- package/dist/test/belayer-pipeline.test.js +113 -0
- package/dist/test/belayer-pr-lifecycle.test.js +26 -0
- package/dist/test/belayer-prompts.test.js +60 -0
- package/dist/test/belayer-types.test.js +69 -0
- package/dist/test/bin/claude-remote-cli.js +214 -0
- package/dist/test/boot-state.test.js +133 -0
- package/dist/test/branch-lifecycle.test.js +75 -0
- package/dist/test/branch-linker.test.js +236 -0
- package/dist/test/branch-rename.test.js +45 -0
- package/dist/test/branch-watcher.test.js +115 -0
- package/dist/test/browser-cli.test.js +91 -0
- package/dist/test/browser-content.test.js +93 -0
- package/dist/test/browser-tabs-ui.test.js +39 -0
- package/dist/test/changed-files-api.test.js +140 -0
- package/dist/test/clipboard.test.js +12 -0
- package/dist/test/codex-hooks-adapter.test.js +237 -0
- package/dist/test/components/EmptyState.spec.js +51 -0
- package/dist/test/components/ErrorToast.spec.js +65 -0
- package/dist/test/components/TuiCheckbox.spec.js +120 -0
- package/dist/test/components/TuiInput.spec.js +186 -0
- package/dist/test/components/leaf-component-migration.spec.js +104 -0
- package/dist/test/config-freshness.test.js +63 -0
- package/dist/test/config.test.js +813 -0
- package/dist/test/diff-summary.test.js +98 -0
- package/dist/test/display-state.test.js +179 -0
- package/dist/test/event-message-types.test.js +32 -0
- package/dist/test/file-tree-utils.test.js +167 -0
- package/dist/test/framework-types.test.js +183 -0
- package/dist/test/frameworks-api.test.js +93 -0
- package/dist/test/frontend/src/lib/pr-state.js +114 -0
- package/dist/test/fs-browse.test.js +246 -0
- package/dist/test/fuzzy-scorer.test.js +145 -0
- package/dist/test/gh-routes.test.js +156 -0
- package/dist/test/git-changed-files.test.js +152 -0
- package/dist/test/git-routes.test.js +146 -0
- package/dist/test/git-utils.test.js +68 -0
- package/dist/test/git-watcher.test.js +110 -0
- package/dist/test/git.test.js +140 -0
- package/dist/test/github-app.test.js +455 -0
- package/dist/test/github-graphql.test.js +301 -0
- package/dist/test/greetings.test.js +83 -0
- package/dist/test/hooks-agent-event.test.js +412 -0
- package/dist/test/hooks.test.js +149 -0
- package/dist/test/integration-github.test.js +220 -0
- package/dist/test/integration-jira.test.js +238 -0
- package/dist/test/integration-linear.test.js +293 -0
- package/dist/test/mobile-input.test.js +235 -0
- package/dist/test/opencode-relay.test.js +107 -0
- package/dist/test/org-dashboard.test.js +349 -0
- package/dist/test/output-parser.test.js +217 -0
- package/dist/test/paths.test.js +32 -0
- package/dist/test/pr-state.test.js +407 -0
- package/dist/test/pr-status.test.js +82 -0
- package/dist/test/presets.test.js +242 -0
- package/dist/test/pty-handler-multi-agent.test.js +149 -0
- package/dist/test/pty-handler.test.js +146 -0
- package/dist/test/pull-requests.test.js +78 -0
- package/dist/test/review-poller.test.js +349 -0
- package/dist/test/server/analytics.js +121 -0
- package/dist/test/server/auth.js +63 -0
- package/dist/test/server/branch-linker.js +124 -0
- package/dist/test/server/clipboard.js +56 -0
- package/dist/test/server/config.js +137 -0
- package/dist/test/server/git.js +308 -0
- package/dist/test/server/hooks.js +196 -0
- package/dist/test/server/index.js +1124 -0
- package/dist/test/server/integration-github.js +117 -0
- package/dist/test/server/integration-jira.js +164 -0
- package/dist/test/server/integration-linear.js +176 -0
- package/dist/test/server/mobile-input-pipeline.js +123 -0
- package/dist/test/server/org-dashboard.js +184 -0
- package/dist/test/server/output-parsers/claude-parser.js +54 -0
- package/dist/test/server/output-parsers/codex-parser.js +13 -0
- package/dist/test/server/output-parsers/index.js +7 -0
- package/dist/test/server/pty-handler.js +310 -0
- package/dist/test/server/push.js +80 -0
- package/dist/test/server/review-poller.js +218 -0
- package/dist/test/server/service.js +169 -0
- package/dist/test/server/sessions.js +434 -0
- package/dist/test/server/ticket-transitions.js +216 -0
- package/dist/test/server/types.js +20 -0
- package/dist/test/server/utils.js +22 -0
- package/dist/test/server/watcher.js +139 -0
- package/dist/test/server/workspaces.js +657 -0
- package/dist/test/server/ws.js +152 -0
- package/dist/test/server-startup.test.js +62 -0
- package/dist/test/service.test.js +43 -0
- package/dist/test/session-analytics-api.test.js +123 -0
- package/dist/test/session-analytics.test.js +425 -0
- package/dist/test/session-intent.test.js +249 -0
- package/dist/test/sessions.test.js +1152 -0
- package/dist/test/sidebar-items.test.js +164 -0
- package/dist/test/stores/boot-state-store.test.js +165 -0
- package/dist/test/stores/sessions-logic.test.js +191 -0
- package/dist/test/stores/toasts-store.test.js +66 -0
- package/dist/test/stores/ui-store.test.js +203 -0
- package/dist/test/stores/unread-store.test.js +97 -0
- package/dist/test/telemetry-api.test.js +54 -0
- package/dist/test/telemetry-sync.test.js +68 -0
- package/dist/test/telemetry.test.js +295 -0
- package/dist/test/terminal-zoom.test.js +102 -0
- package/dist/test/test/analytics.test.js +152 -0
- package/dist/test/test/auth.test.js +95 -0
- package/dist/test/test/branch-linker.test.js +231 -0
- package/dist/test/test/branch-rename.test.js +45 -0
- package/dist/test/test/clipboard.test.js +12 -0
- package/dist/test/test/config.test.js +281 -0
- package/dist/test/test/fs-browse.test.js +202 -0
- package/dist/test/test/git.test.js +67 -0
- package/dist/test/test/hooks.test.js +139 -0
- package/dist/test/test/integration-github.test.js +203 -0
- package/dist/test/test/integration-jira.test.js +294 -0
- package/dist/test/test/integration-linear.test.js +293 -0
- package/dist/test/test/mobile-input.test.js +193 -0
- package/dist/test/test/org-dashboard.test.js +240 -0
- package/dist/test/test/output-parser.test.js +95 -0
- package/dist/test/test/paths.test.js +32 -0
- package/dist/test/test/pr-state.test.js +220 -0
- package/dist/test/test/pull-requests.test.js +67 -0
- package/dist/test/test/review-poller.test.js +235 -0
- package/dist/test/test/service.test.js +43 -0
- package/dist/test/test/sessions.test.js +750 -0
- package/dist/test/test/ticket-transitions.test.js +130 -0
- package/dist/test/test/version.test.js +34 -0
- package/dist/test/test/worktrees.test.js +256 -0
- package/dist/test/ticket-transitions.test.js +312 -0
- package/dist/test/unread.test.js +23 -0
- package/dist/test/version.test.js +34 -0
- package/dist/test/webhook-manager.test.js +484 -0
- package/dist/test/webhooks.test.js +208 -0
- package/dist/test/workspace-groups.test.js +377 -0
- package/dist/test/worktrees.test.js +531 -0
- package/package.json +88 -0
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-DA-rfuFy.js","assets/html-pp8916En.js","assets/javascript-wDzz0qaB.js","assets/css-CLj8gQPS.js","assets/angular-ts-BrjP3tb8.js","assets/scss-D5BDwBP9.js","assets/apl-CORt7UWP.js","assets/xml-sdJ4AIDG.js","assets/java-CylS5w8V.js","assets/json-Cp-IABpG.js","assets/astro-HNnZUWAn.js","assets/typescript-BPQ3VLAy.js","assets/postcss-CXtECtnM.js","assets/tsx-COt5Ahok.js","assets/blade-BjGOyj-B.js","assets/html-derivative-DlHx6ybY.js","assets/sql-BLtJtn59.js","assets/bsl-BO_Y6i37.js","assets/sdbl-DVxCFoDh.js","assets/cairo-KRGpt6FW.js","assets/python-B6aJPvgy.js","assets/cobol-nBiQ_Alo.js","assets/coffee-Ch7k5sss.js","assets/cpp-CofmeUqb.js","assets/regexp-CDVJQ6XC.js","assets/glsl-DplSGwfg.js","assets/c-BIGW1oBm.js","assets/crystal-DNxU26gB.js","assets/shellscript-Yzrsuije.js","assets/edge-FbVlp4U3.js","assets/elixir-CkH2-t6x.js","assets/elm-DbKCFpqz.js","assets/erb-BYCe7drp.js","assets/ruby-Wjq7vjNf.js","assets/haml-D5jkg6IW.js","assets/graphql-ChdNCCLP.js","assets/jsx-g9-lgVsj.js","assets/lua-BaeVxFsk.js","assets/yaml-Buea-lGh.js","assets/erlang-DsQrWhSR.js","assets/markdown-Cvjx9yec.js","assets/fortran-fixed-form-CkoXwp7k.js","assets/fortran-free-form-BxgE0vQu.js","assets/fsharp-CXgrBDvD.js","assets/gdresource-BOOCDP_w.js","assets/gdshader-DkwncUOv.js","assets/gdscript-C5YyOfLZ.js","assets/git-commit-F4YmCXRG.js","assets/diff-D97Zzqfu.js","assets/git-rebase-r7XF79zn.js","assets/glimmer-js-ByusRIyA.js","assets/glimmer-ts-BfAWNZQY.js","assets/hack-i7_Ulhet.js","assets/handlebars-BpdQsYii.js","assets/http-jrhK8wxY.js","assets/hurl-irOxFIW8.js","assets/csv-fuZLfV_i.js","assets/hxml-Bvhsp5Yf.js","assets/haxe-CzTSHFRz.js","assets/jinja-f2NsQr07.js","assets/jison-wvAkD_A8.js","assets/julia-CxzCAyBv.js","assets/r-Dspwwk_N.js","assets/just-VxiPbLrw.js","assets/perl-NvoQZIq0.js","assets/latex-CWtU0Tv5.js","assets/tex-idrVyKtj.js","assets/liquid-C0sCDyMI.js","assets/marko-DjSrsDqO.js","assets/less-B1dDrJ26.js","assets/mdc-DTYItulj.js","assets/nextflow-C-mBbutL.js","assets/nextflow-groovy-vE_lwT2v.js","assets/nginx-BpAMiNFr.js","assets/nim-BIad80T-.js","assets/php-R6g_5hLQ.js","assets/pug-DKIMFp6K.js","assets/qml-3beO22l8.js","assets/razor-BDqjjVU7.js","assets/csharp-COcwbKMJ.js","assets/rst-CRjBmOyv.js","assets/cmake-D1j8_8rp.js","assets/sas-cz2c8ADy.js","assets/shaderlab-Dg9Lc6iA.js","assets/hlsl-D3lLCCz7.js","assets/shellsession-BADoaaVG.js","assets/soy-8wufbnw4.js","assets/sparql-rVzFXLq3.js","assets/turtle-BsS91CYL.js","assets/stata-BH5u7GGu.js","assets/surrealql-Bq5Q-fJD.js","assets/svelte-Cy7k_4gC.js","assets/templ-DhtptRzy.js","assets/go-C27-OAKa.js","assets/ts-tags-DQrlYJgV.js","assets/twig-xg9kU7Mw.js","assets/vue-D2xRrEX4.js","assets/vue-html-AaS7Mt5G.js","assets/vue-vine-BoDAl6tE.js","assets/stylus-BEDo0Tqx.js","assets/xsl-CtQFsRM5.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var $A=Object.defineProperty;var VA=Object.getPrototypeOf;var WA=Reflect.get;var L0=e=>{throw TypeError(e)};var GA=(e,t,s)=>t in e?$A(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var ce=(e,t,s)=>GA(e,typeof t!="symbol"?t+"":t,s),sm=(e,t,s)=>t.has(e)||L0("Cannot "+s);var V=(e,t,s)=>(sm(e,t,"read from private field"),s?s.call(e):t.get(e)),ke=(e,t,s)=>t.has(e)?L0("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),ye=(e,t,s,i)=>(sm(e,t,"write to private field"),i?i.call(e,s):t.set(e,s),s),Fe=(e,t,s)=>(sm(e,t,"access private method"),s);var ah=(e,t,s,i)=>({set _(a){ye(e,t,a,s)},get _(){return V(e,t,i)}}),M0=(e,t,s)=>WA(VA(e),s,t);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))i(a);new MutationObserver(a=>{for(const o of a)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&i(c)}).observe(document,{childList:!0,subtree:!0});function s(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(a){if(a.ep)return;a.ep=!0;const o=s(a);fetch(a.href,o)}})();function XC(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var im={exports:{}},Ul={};/**
|
|
3
|
+
* @license React
|
|
4
|
+
* react-jsx-runtime.production.js
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
7
|
+
*
|
|
8
|
+
* This source code is licensed under the MIT license found in the
|
|
9
|
+
* LICENSE file in the root directory of this source tree.
|
|
10
|
+
*/var O0;function qA(){if(O0)return Ul;O0=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function s(i,a,o){var c=null;if(o!==void 0&&(c=""+o),a.key!==void 0&&(c=""+a.key),"key"in a){o={};for(var d in a)d!=="key"&&(o[d]=a[d])}else o=a;return a=o.ref,{$$typeof:e,type:i,key:c,ref:a!==void 0?a:null,props:o}}return Ul.Fragment=t,Ul.jsx=s,Ul.jsxs=s,Ul}var j0;function KA(){return j0||(j0=1,im.exports=qA()),im.exports}var p=KA(),nm={exports:{}},Oe={};/**
|
|
11
|
+
* @license React
|
|
12
|
+
* react.production.js
|
|
13
|
+
*
|
|
14
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
15
|
+
*
|
|
16
|
+
* This source code is licensed under the MIT license found in the
|
|
17
|
+
* LICENSE file in the root directory of this source tree.
|
|
18
|
+
*/var P0;function YA(){if(P0)return Oe;P0=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),_=Symbol.for("react.activity"),y=Symbol.iterator;function b(A){return A===null||typeof A!="object"?null:(A=y&&A[y]||A["@@iterator"],typeof A=="function"?A:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,k={};function T(A,I,q){this.props=A,this.context=I,this.refs=k,this.updater=q||S}T.prototype.isReactComponent={},T.prototype.setState=function(A,I){if(typeof A!="object"&&typeof A!="function"&&A!=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,A,I,"setState")},T.prototype.forceUpdate=function(A){this.updater.enqueueForceUpdate(this,A,"forceUpdate")};function D(){}D.prototype=T.prototype;function N(A,I,q){this.props=A,this.context=I,this.refs=k,this.updater=q||S}var E=N.prototype=new D;E.constructor=N,w(E,T.prototype),E.isPureReactComponent=!0;var M=Array.isArray;function U(){}var W={H:null,A:null,T:null,S:null},B=Object.prototype.hasOwnProperty;function $(A,I,q){var oe=q.ref;return{$$typeof:e,type:A,key:I,ref:oe!==void 0?oe:null,props:q}}function Y(A,I){return $(A.type,I,A.props)}function K(A){return typeof A=="object"&&A!==null&&A.$$typeof===e}function X(A){var I={"=":"=0",":":"=2"};return"$"+A.replace(/[=:]/g,function(q){return I[q]})}var P=/\/+/g;function j(A,I){return typeof A=="object"&&A!==null&&A.key!=null?X(""+A.key):I.toString(36)}function H(A){switch(A.status){case"fulfilled":return A.value;case"rejected":throw A.reason;default:switch(typeof A.status=="string"?A.then(U,U):(A.status="pending",A.then(function(I){A.status==="pending"&&(A.status="fulfilled",A.value=I)},function(I){A.status==="pending"&&(A.status="rejected",A.reason=I)})),A.status){case"fulfilled":return A.value;case"rejected":throw A.reason}}throw A}function O(A,I,q,oe,ve){var Se=typeof A;(Se==="undefined"||Se==="boolean")&&(A=null);var Ne=!1;if(A===null)Ne=!0;else switch(Se){case"bigint":case"string":case"number":Ne=!0;break;case"object":switch(A.$$typeof){case e:case t:Ne=!0;break;case g:return Ne=A._init,O(Ne(A._payload),I,q,oe,ve)}}if(Ne)return ve=ve(A),Ne=oe===""?"."+j(A,0):oe,M(ve)?(q="",Ne!=null&&(q=Ne.replace(P,"$&/")+"/"),O(ve,I,q,"",function(le){return le})):ve!=null&&(K(ve)&&(ve=Y(ve,q+(ve.key==null||A&&A.key===ve.key?"":(""+ve.key).replace(P,"$&/")+"/")+Ne)),I.push(ve)),1;Ne=0;var ze=oe===""?".":oe+":";if(M(A))for(var De=0;De<A.length;De++)oe=A[De],Se=ze+j(oe,De),Ne+=O(oe,I,q,Se,ve);else if(De=b(A),typeof De=="function")for(A=De.call(A),De=0;!(oe=A.next()).done;)oe=oe.value,Se=ze+j(oe,De++),Ne+=O(oe,I,q,Se,ve);else if(Se==="object"){if(typeof A.then=="function")return O(H(A),I,q,oe,ve);throw I=String(A),Error("Objects are not valid as a React child (found: "+(I==="[object Object]"?"object with keys {"+Object.keys(A).join(", ")+"}":I)+"). If you meant to render a collection of children, use an array instead.")}return Ne}function z(A,I,q){if(A==null)return A;var oe=[],ve=0;return O(A,oe,"","",function(Se){return I.call(q,Se,ve++)}),oe}function Q(A){if(A._status===-1){var I=A._result;I=I(),I.then(function(q){(A._status===0||A._status===-1)&&(A._status=1,A._result=q)},function(q){(A._status===0||A._status===-1)&&(A._status=2,A._result=q)}),A._status===-1&&(A._status=0,A._result=I)}if(A._status===1)return A._result.default;throw A._result}var re=typeof reportError=="function"?reportError:function(A){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var I=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof A=="object"&&A!==null&&typeof A.message=="string"?String(A.message):String(A),error:A});if(!window.dispatchEvent(I))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",A);return}console.error(A)},ne={map:z,forEach:function(A,I,q){z(A,function(){I.apply(this,arguments)},q)},count:function(A){var I=0;return z(A,function(){I++}),I},toArray:function(A){return z(A,function(I){return I})||[]},only:function(A){if(!K(A))throw Error("React.Children.only expected to receive a single React element child.");return A}};return Oe.Activity=_,Oe.Children=ne,Oe.Component=T,Oe.Fragment=s,Oe.Profiler=a,Oe.PureComponent=N,Oe.StrictMode=i,Oe.Suspense=f,Oe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=W,Oe.__COMPILER_RUNTIME={__proto__:null,c:function(A){return W.H.useMemoCache(A)}},Oe.cache=function(A){return function(){return A.apply(null,arguments)}},Oe.cacheSignal=function(){return null},Oe.cloneElement=function(A,I,q){if(A==null)throw Error("The argument must be a React element, but you passed "+A+".");var oe=w({},A.props),ve=A.key;if(I!=null)for(Se in I.key!==void 0&&(ve=""+I.key),I)!B.call(I,Se)||Se==="key"||Se==="__self"||Se==="__source"||Se==="ref"&&I.ref===void 0||(oe[Se]=I[Se]);var Se=arguments.length-2;if(Se===1)oe.children=q;else if(1<Se){for(var Ne=Array(Se),ze=0;ze<Se;ze++)Ne[ze]=arguments[ze+2];oe.children=Ne}return $(A.type,ve,oe)},Oe.createContext=function(A){return A={$$typeof:c,_currentValue:A,_currentValue2:A,_threadCount:0,Provider:null,Consumer:null},A.Provider=A,A.Consumer={$$typeof:o,_context:A},A},Oe.createElement=function(A,I,q){var oe,ve={},Se=null;if(I!=null)for(oe in I.key!==void 0&&(Se=""+I.key),I)B.call(I,oe)&&oe!=="key"&&oe!=="__self"&&oe!=="__source"&&(ve[oe]=I[oe]);var Ne=arguments.length-2;if(Ne===1)ve.children=q;else if(1<Ne){for(var ze=Array(Ne),De=0;De<Ne;De++)ze[De]=arguments[De+2];ve.children=ze}if(A&&A.defaultProps)for(oe in Ne=A.defaultProps,Ne)ve[oe]===void 0&&(ve[oe]=Ne[oe]);return $(A,Se,ve)},Oe.createRef=function(){return{current:null}},Oe.forwardRef=function(A){return{$$typeof:d,render:A}},Oe.isValidElement=K,Oe.lazy=function(A){return{$$typeof:g,_payload:{_status:-1,_result:A},_init:Q}},Oe.memo=function(A,I){return{$$typeof:h,type:A,compare:I===void 0?null:I}},Oe.startTransition=function(A){var I=W.T,q={};W.T=q;try{var oe=A(),ve=W.S;ve!==null&&ve(q,oe),typeof oe=="object"&&oe!==null&&typeof oe.then=="function"&&oe.then(U,re)}catch(Se){re(Se)}finally{I!==null&&q.types!==null&&(I.types=q.types),W.T=I}},Oe.unstable_useCacheRefresh=function(){return W.H.useCacheRefresh()},Oe.use=function(A){return W.H.use(A)},Oe.useActionState=function(A,I,q){return W.H.useActionState(A,I,q)},Oe.useCallback=function(A,I){return W.H.useCallback(A,I)},Oe.useContext=function(A){return W.H.useContext(A)},Oe.useDebugValue=function(){},Oe.useDeferredValue=function(A,I){return W.H.useDeferredValue(A,I)},Oe.useEffect=function(A,I){return W.H.useEffect(A,I)},Oe.useEffectEvent=function(A){return W.H.useEffectEvent(A)},Oe.useId=function(){return W.H.useId()},Oe.useImperativeHandle=function(A,I,q){return W.H.useImperativeHandle(A,I,q)},Oe.useInsertionEffect=function(A,I){return W.H.useInsertionEffect(A,I)},Oe.useLayoutEffect=function(A,I){return W.H.useLayoutEffect(A,I)},Oe.useMemo=function(A,I){return W.H.useMemo(A,I)},Oe.useOptimistic=function(A,I){return W.H.useOptimistic(A,I)},Oe.useReducer=function(A,I,q){return W.H.useReducer(A,I,q)},Oe.useRef=function(A){return W.H.useRef(A)},Oe.useState=function(A){return W.H.useState(A)},Oe.useSyncExternalStore=function(A,I,q){return W.H.useSyncExternalStore(A,I,q)},Oe.useTransition=function(){return W.H.useTransition()},Oe.version="19.2.4",Oe}var B0;function U_(){return B0||(B0=1,nm.exports=YA()),nm.exports}var C=U_();const qe=XC(C);var rm={exports:{}},Fl={},am={exports:{}},om={};/**
|
|
19
|
+
* @license React
|
|
20
|
+
* scheduler.production.js
|
|
21
|
+
*
|
|
22
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the MIT license found in the
|
|
25
|
+
* LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/var I0;function XA(){return I0||(I0=1,(function(e){function t(O,z){var Q=O.length;O.push(z);e:for(;0<Q;){var re=Q-1>>>1,ne=O[re];if(0<a(ne,z))O[re]=z,O[Q]=ne,Q=re;else break e}}function s(O){return O.length===0?null:O[0]}function i(O){if(O.length===0)return null;var z=O[0],Q=O.pop();if(Q!==z){O[0]=Q;e:for(var re=0,ne=O.length,A=ne>>>1;re<A;){var I=2*(re+1)-1,q=O[I],oe=I+1,ve=O[oe];if(0>a(q,Q))oe<ne&&0>a(ve,q)?(O[re]=ve,O[oe]=Q,re=oe):(O[re]=q,O[I]=Q,re=I);else if(oe<ne&&0>a(ve,Q))O[re]=ve,O[oe]=Q,re=oe;else break e}}return z}function a(O,z){var Q=O.sortIndex-z.sortIndex;return Q!==0?Q:O.id-z.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var c=Date,d=c.now();e.unstable_now=function(){return c.now()-d}}var f=[],h=[],g=1,_=null,y=3,b=!1,S=!1,w=!1,k=!1,T=typeof setTimeout=="function"?setTimeout:null,D=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function E(O){for(var z=s(h);z!==null;){if(z.callback===null)i(h);else if(z.startTime<=O)i(h),z.sortIndex=z.expirationTime,t(f,z);else break;z=s(h)}}function M(O){if(w=!1,E(O),!S)if(s(f)!==null)S=!0,U||(U=!0,X());else{var z=s(h);z!==null&&H(M,z.startTime-O)}}var U=!1,W=-1,B=5,$=-1;function Y(){return k?!0:!(e.unstable_now()-$<B)}function K(){if(k=!1,U){var O=e.unstable_now();$=O;var z=!0;try{e:{S=!1,w&&(w=!1,D(W),W=-1),b=!0;var Q=y;try{t:{for(E(O),_=s(f);_!==null&&!(_.expirationTime>O&&Y());){var re=_.callback;if(typeof re=="function"){_.callback=null,y=_.priorityLevel;var ne=re(_.expirationTime<=O);if(O=e.unstable_now(),typeof ne=="function"){_.callback=ne,E(O),z=!0;break t}_===s(f)&&i(f),E(O)}else i(f);_=s(f)}if(_!==null)z=!0;else{var A=s(h);A!==null&&H(M,A.startTime-O),z=!1}}break e}finally{_=null,y=Q,b=!1}z=void 0}}finally{z?X():U=!1}}}var X;if(typeof N=="function")X=function(){N(K)};else if(typeof MessageChannel<"u"){var P=new MessageChannel,j=P.port2;P.port1.onmessage=K,X=function(){j.postMessage(null)}}else X=function(){T(K,0)};function H(O,z){W=T(function(){O(e.unstable_now())},z)}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(O){O.callback=null},e.unstable_forceFrameRate=function(O){0>O||125<O?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):B=0<O?Math.floor(1e3/O):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_next=function(O){switch(y){case 1:case 2:case 3:var z=3;break;default:z=y}var Q=y;y=z;try{return O()}finally{y=Q}},e.unstable_requestPaint=function(){k=!0},e.unstable_runWithPriority=function(O,z){switch(O){case 1:case 2:case 3:case 4:case 5:break;default:O=3}var Q=y;y=O;try{return z()}finally{y=Q}},e.unstable_scheduleCallback=function(O,z,Q){var re=e.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?re+Q:re):Q=re,O){case 1:var ne=-1;break;case 2:ne=250;break;case 5:ne=1073741823;break;case 4:ne=1e4;break;default:ne=5e3}return ne=Q+ne,O={id:g++,callback:z,priorityLevel:O,startTime:Q,expirationTime:ne,sortIndex:-1},Q>re?(O.sortIndex=Q,t(h,O),s(f)===null&&O===s(h)&&(w?(D(W),W=-1):w=!0,H(M,Q-re))):(O.sortIndex=ne,t(f,O),S||b||(S=!0,U||(U=!0,X()))),O},e.unstable_shouldYield=Y,e.unstable_wrapCallback=function(O){var z=y;return function(){var Q=y;y=z;try{return O.apply(this,arguments)}finally{y=Q}}}})(om)),om}var z0;function QA(){return z0||(z0=1,am.exports=XA()),am.exports}var lm={exports:{}},hs={};/**
|
|
27
|
+
* @license React
|
|
28
|
+
* react-dom.production.js
|
|
29
|
+
*
|
|
30
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
31
|
+
*
|
|
32
|
+
* This source code is licensed under the MIT license found in the
|
|
33
|
+
* LICENSE file in the root directory of this source tree.
|
|
34
|
+
*/var H0;function ZA(){if(H0)return hs;H0=1;var e=U_();function t(f){var h="https://react.dev/errors/"+f;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)h+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+f+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(){}var i={d:{f:s,r:function(){throw Error(t(522))},D:s,C:s,L:s,m:s,X:s,S:s,M:s},p:0,findDOMNode:null},a=Symbol.for("react.portal");function o(f,h,g){var _=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:_==null?null:""+_,children:f,containerInfo:h,implementation:g}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(f,h){if(f==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return hs.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,hs.createPortal=function(f,h){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(t(299));return o(f,h,null,g)},hs.flushSync=function(f){var h=c.T,g=i.p;try{if(c.T=null,i.p=2,f)return f()}finally{c.T=h,i.p=g,i.d.f()}},hs.preconnect=function(f,h){typeof f=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,i.d.C(f,h))},hs.prefetchDNS=function(f){typeof f=="string"&&i.d.D(f)},hs.preinit=function(f,h){if(typeof f=="string"&&h&&typeof h.as=="string"){var g=h.as,_=d(g,h.crossOrigin),y=typeof h.integrity=="string"?h.integrity:void 0,b=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;g==="style"?i.d.S(f,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:_,integrity:y,fetchPriority:b}):g==="script"&&i.d.X(f,{crossOrigin:_,integrity:y,fetchPriority:b,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},hs.preinitModule=function(f,h){if(typeof f=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var g=d(h.as,h.crossOrigin);i.d.M(f,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&i.d.M(f)},hs.preload=function(f,h){if(typeof f=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var g=h.as,_=d(g,h.crossOrigin);i.d.L(f,g,{crossOrigin:_,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},hs.preloadModule=function(f,h){if(typeof f=="string")if(h){var g=d(h.as,h.crossOrigin);i.d.m(f,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else i.d.m(f)},hs.requestFormReset=function(f){i.d.r(f)},hs.unstable_batchedUpdates=function(f,h){return f(h)},hs.useFormState=function(f,h,g){return c.H.useFormState(f,h,g)},hs.useFormStatus=function(){return c.H.useHostTransitionStatus()},hs.version="19.2.4",hs}var U0;function JA(){if(U0)return lm.exports;U0=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),lm.exports=ZA(),lm.exports}/**
|
|
35
|
+
* @license React
|
|
36
|
+
* react-dom-client.production.js
|
|
37
|
+
*
|
|
38
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
39
|
+
*
|
|
40
|
+
* This source code is licensed under the MIT license found in the
|
|
41
|
+
* LICENSE file in the root directory of this source tree.
|
|
42
|
+
*/var F0;function eR(){if(F0)return Fl;F0=1;var e=QA(),t=U_(),s=JA();function i(n){var r="https://react.dev/errors/"+n;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)r+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+n+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function o(n){var r=n,l=n;if(n.alternate)for(;r.return;)r=r.return;else{n=r;do r=n,(r.flags&4098)!==0&&(l=r.return),n=r.return;while(n)}return r.tag===3?l:null}function c(n){if(n.tag===13){var r=n.memoizedState;if(r===null&&(n=n.alternate,n!==null&&(r=n.memoizedState)),r!==null)return r.dehydrated}return null}function d(n){if(n.tag===31){var r=n.memoizedState;if(r===null&&(n=n.alternate,n!==null&&(r=n.memoizedState)),r!==null)return r.dehydrated}return null}function f(n){if(o(n)!==n)throw Error(i(188))}function h(n){var r=n.alternate;if(!r){if(r=o(n),r===null)throw Error(i(188));return r!==n?null:n}for(var l=n,u=r;;){var m=l.return;if(m===null)break;var v=m.alternate;if(v===null){if(u=m.return,u!==null){l=u;continue}break}if(m.child===v.child){for(v=m.child;v;){if(v===l)return f(m),n;if(v===u)return f(m),r;v=v.sibling}throw Error(i(188))}if(l.return!==u.return)l=m,u=v;else{for(var x=!1,R=m.child;R;){if(R===l){x=!0,l=m,u=v;break}if(R===u){x=!0,u=m,l=v;break}R=R.sibling}if(!x){for(R=v.child;R;){if(R===l){x=!0,l=v,u=m;break}if(R===u){x=!0,u=v,l=m;break}R=R.sibling}if(!x)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?n:r}function g(n){var r=n.tag;if(r===5||r===26||r===27||r===6)return n;for(n=n.child;n!==null;){if(r=g(n),r!==null)return r;n=n.sibling}return null}var _=Object.assign,y=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),D=Symbol.for("react.consumer"),N=Symbol.for("react.context"),E=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),U=Symbol.for("react.suspense_list"),W=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),$=Symbol.for("react.activity"),Y=Symbol.for("react.memo_cache_sentinel"),K=Symbol.iterator;function X(n){return n===null||typeof n!="object"?null:(n=K&&n[K]||n["@@iterator"],typeof n=="function"?n:null)}var P=Symbol.for("react.client.reference");function j(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===P?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case w:return"Fragment";case T:return"Profiler";case k:return"StrictMode";case M:return"Suspense";case U:return"SuspenseList";case $:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case S:return"Portal";case N:return n.displayName||"Context";case D:return(n._context.displayName||"Context")+".Consumer";case E:var r=n.render;return n=n.displayName,n||(n=r.displayName||r.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case W:return r=n.displayName||null,r!==null?r:j(n.type)||"Memo";case B:r=n._payload,n=n._init;try{return j(n(r))}catch{}}return null}var H=Array.isArray,O=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,z=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q={pending:!1,data:null,method:null,action:null},re=[],ne=-1;function A(n){return{current:n}}function I(n){0>ne||(n.current=re[ne],re[ne]=null,ne--)}function q(n,r){ne++,re[ne]=n.current,n.current=r}var oe=A(null),ve=A(null),Se=A(null),Ne=A(null);function ze(n,r){switch(q(Se,r),q(ve,n),q(oe,null),r.nodeType){case 9:case 11:n=(n=r.documentElement)&&(n=n.namespaceURI)?t0(n):0;break;default:if(n=r.tagName,r=r.namespaceURI)r=t0(r),n=s0(r,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}I(oe),q(oe,n)}function De(){I(oe),I(ve),I(Se)}function le(n){n.memoizedState!==null&&q(Ne,n);var r=oe.current,l=s0(r,n.type);r!==l&&(q(ve,n),q(oe,l))}function Ee(n){ve.current===n&&(I(oe),I(ve)),Ne.current===n&&(I(Ne),Bl._currentValue=Q)}var we,Re;function pt(n){if(we===void 0)try{throw Error()}catch(l){var r=l.stack.trim().match(/\n( *(at )?)/);we=r&&r[1]||"",Re=-1<l.stack.indexOf(`
|
|
43
|
+
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
44
|
+
`+we+n+Re}var Ks=!1;function An(n,r){if(!n||Ks)return"";Ks=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(r){var he=function(){throw Error()};if(Object.defineProperty(he.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(he,[])}catch(ie){var te=ie}Reflect.construct(n,[],he)}else{try{he.call()}catch(ie){te=ie}n.call(he.prototype)}}else{try{throw Error()}catch(ie){te=ie}(he=n())&&typeof he.catch=="function"&&he.catch(function(){})}}catch(ie){if(ie&&te&&typeof ie.stack=="string")return[ie.stack,te.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var m=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");m&&m.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var v=u.DetermineComponentFrameRoot(),x=v[0],R=v[1];if(x&&R){var F=x.split(`
|
|
45
|
+
`),ee=R.split(`
|
|
46
|
+
`);for(m=u=0;u<F.length&&!F[u].includes("DetermineComponentFrameRoot");)u++;for(;m<ee.length&&!ee[m].includes("DetermineComponentFrameRoot");)m++;if(u===F.length||m===ee.length)for(u=F.length-1,m=ee.length-1;1<=u&&0<=m&&F[u]!==ee[m];)m--;for(;1<=u&&0<=m;u--,m--)if(F[u]!==ee[m]){if(u!==1||m!==1)do if(u--,m--,0>m||F[u]!==ee[m]){var ae=`
|
|
47
|
+
`+F[u].replace(" at new "," at ");return n.displayName&&ae.includes("<anonymous>")&&(ae=ae.replace("<anonymous>",n.displayName)),ae}while(1<=u&&0<=m);break}}}finally{Ks=!1,Error.prepareStackTrace=l}return(l=n?n.displayName||n.name:"")?pt(l):""}function ka(n,r){switch(n.tag){case 26:case 27:case 5:return pt(n.type);case 16:return pt("Lazy");case 13:return n.child!==r&&r!==null?pt("Suspense Fallback"):pt("Suspense");case 19:return pt("SuspenseList");case 0:case 15:return An(n.type,!1);case 11:return An(n.type.render,!1);case 1:return An(n.type,!0);case 31:return pt("Activity");default:return""}}function Ea(n){try{var r="",l=null;do r+=ka(n,l),l=n,n=n.return;while(n);return r}catch(u){return`
|
|
48
|
+
Error generating stack: `+u.message+`
|
|
49
|
+
`+u.stack}}var Rn=Object.prototype.hasOwnProperty,qi=e.unstable_scheduleCallback,_e=e.unstable_cancelCallback,ws=e.unstable_shouldYield,Cs=e.unstable_requestPaint,bt=e.unstable_now,Ei=e.unstable_getCurrentPriorityLevel,Ta=e.unstable_ImmediatePriority,$c=e.unstable_UserBlockingPriority,Na=e.unstable_NormalPriority,Ko=e.unstable_LowPriority,Vc=e.unstable_IdlePriority,Fd=e.log,Wc=e.unstable_setDisableYieldValue,Er=null,gs=null;function Ti(n){if(typeof Fd=="function"&&Wc(n),gs&&typeof gs.setStrictMode=="function")try{gs.setStrictMode(Er,n)}catch{}}var Gt=Math.clz32?Math.clz32:Gc,ge=Math.log,Ni=Math.LN2;function Gc(n){return n>>>=0,n===0?32:31-(ge(n)/Ni|0)|0}var _i=256,Ai=262144,Yo=4194304;function Ki(n){var r=n&42;if(r!==0)return r;switch(n&-n){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 n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function qc(n,r,l){var u=n.pendingLanes;if(u===0)return 0;var m=0,v=n.suspendedLanes,x=n.pingedLanes;n=n.warmLanes;var R=u&134217727;return R!==0?(u=R&~v,u!==0?m=Ki(u):(x&=R,x!==0?m=Ki(x):l||(l=R&~n,l!==0&&(m=Ki(l))))):(R=u&~v,R!==0?m=Ki(R):x!==0?m=Ki(x):l||(l=u&~n,l!==0&&(m=Ki(l)))),m===0?0:r!==0&&r!==m&&(r&v)===0&&(v=m&-m,l=r&-r,v>=l||v===32&&(l&4194048)!==0)?r:m}function Xo(n,r){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&r)===0}function RT(n,r){switch(n){case 1:case 2:case 4:case 8:case 64:return r+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 r+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 Pv(){var n=Yo;return Yo<<=1,(Yo&62914560)===0&&(Yo=4194304),n}function $d(n){for(var r=[],l=0;31>l;l++)r.push(n);return r}function Qo(n,r){n.pendingLanes|=r,r!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function DT(n,r,l,u,m,v){var x=n.pendingLanes;n.pendingLanes=l,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=l,n.entangledLanes&=l,n.errorRecoveryDisabledLanes&=l,n.shellSuspendCounter=0;var R=n.entanglements,F=n.expirationTimes,ee=n.hiddenUpdates;for(l=x&~l;0<l;){var ae=31-Gt(l),he=1<<ae;R[ae]=0,F[ae]=-1;var te=ee[ae];if(te!==null)for(ee[ae]=null,ae=0;ae<te.length;ae++){var ie=te[ae];ie!==null&&(ie.lane&=-536870913)}l&=~he}u!==0&&Bv(n,u,0),v!==0&&m===0&&n.tag!==0&&(n.suspendedLanes|=v&~(x&~r))}function Bv(n,r,l){n.pendingLanes|=r,n.suspendedLanes&=~r;var u=31-Gt(r);n.entangledLanes|=r,n.entanglements[u]=n.entanglements[u]|1073741824|l&261930}function Iv(n,r){var l=n.entangledLanes|=r;for(n=n.entanglements;l;){var u=31-Gt(l),m=1<<u;m&r|n[u]&r&&(n[u]|=r),l&=~m}}function zv(n,r){var l=r&-r;return l=(l&42)!==0?1:Vd(l),(l&(n.suspendedLanes|r))!==0?0:l}function Vd(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=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:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function Wd(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function Hv(){var n=z.p;return n!==0?n:(n=window.event,n===void 0?32:k0(n.type))}function Uv(n,r){var l=z.p;try{return z.p=n,r()}finally{z.p=l}}var Dn=Math.random().toString(36).slice(2),is="__reactFiber$"+Dn,xs="__reactProps$"+Dn,Aa="__reactContainer$"+Dn,Gd="__reactEvents$"+Dn,LT="__reactListeners$"+Dn,MT="__reactHandles$"+Dn,Fv="__reactResources$"+Dn,Zo="__reactMarker$"+Dn;function qd(n){delete n[is],delete n[xs],delete n[Gd],delete n[LT],delete n[MT]}function Ra(n){var r=n[is];if(r)return r;for(var l=n.parentNode;l;){if(r=l[Aa]||l[is]){if(l=r.alternate,r.child!==null||l!==null&&l.child!==null)for(n=c0(n);n!==null;){if(l=n[is])return l;n=c0(n)}return r}n=l,l=n.parentNode}return null}function Da(n){if(n=n[is]||n[Aa]){var r=n.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return n}return null}function Jo(n){var r=n.tag;if(r===5||r===26||r===27||r===6)return n.stateNode;throw Error(i(33))}function La(n){var r=n[Fv];return r||(r=n[Fv]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function qt(n){n[Zo]=!0}var $v=new Set,Vv={};function Tr(n,r){Ma(n,r),Ma(n+"Capture",r)}function Ma(n,r){for(Vv[n]=r,n=0;n<r.length;n++)$v.add(r[n])}var OT=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]*$"),Wv={},Gv={};function jT(n){return Rn.call(Gv,n)?!0:Rn.call(Wv,n)?!1:OT.test(n)?Gv[n]=!0:(Wv[n]=!0,!1)}function Kc(n,r,l){if(jT(r))if(l===null)n.removeAttribute(r);else{switch(typeof l){case"undefined":case"function":case"symbol":n.removeAttribute(r);return;case"boolean":var u=r.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){n.removeAttribute(r);return}}n.setAttribute(r,""+l)}}function Yc(n,r,l){if(l===null)n.removeAttribute(r);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(r);return}n.setAttribute(r,""+l)}}function Yi(n,r,l,u){if(u===null)n.removeAttribute(l);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(l);return}n.setAttributeNS(r,l,""+u)}}function Ys(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function qv(n){var r=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function PT(n,r,l){var u=Object.getOwnPropertyDescriptor(n.constructor.prototype,r);if(!n.hasOwnProperty(r)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var m=u.get,v=u.set;return Object.defineProperty(n,r,{configurable:!0,get:function(){return m.call(this)},set:function(x){l=""+x,v.call(this,x)}}),Object.defineProperty(n,r,{enumerable:u.enumerable}),{getValue:function(){return l},setValue:function(x){l=""+x},stopTracking:function(){n._valueTracker=null,delete n[r]}}}}function Kd(n){if(!n._valueTracker){var r=qv(n)?"checked":"value";n._valueTracker=PT(n,r,""+n[r])}}function Kv(n){if(!n)return!1;var r=n._valueTracker;if(!r)return!0;var l=r.getValue(),u="";return n&&(u=qv(n)?n.checked?"true":"false":n.value),n=u,n!==l?(r.setValue(n),!0):!1}function Xc(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var BT=/[\n"\\]/g;function Xs(n){return n.replace(BT,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Yd(n,r,l,u,m,v,x,R){n.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?n.type=x:n.removeAttribute("type"),r!=null?x==="number"?(r===0&&n.value===""||n.value!=r)&&(n.value=""+Ys(r)):n.value!==""+Ys(r)&&(n.value=""+Ys(r)):x!=="submit"&&x!=="reset"||n.removeAttribute("value"),r!=null?Xd(n,x,Ys(r)):l!=null?Xd(n,x,Ys(l)):u!=null&&n.removeAttribute("value"),m==null&&v!=null&&(n.defaultChecked=!!v),m!=null&&(n.checked=m&&typeof m!="function"&&typeof m!="symbol"),R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"?n.name=""+Ys(R):n.removeAttribute("name")}function Yv(n,r,l,u,m,v,x,R){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(n.type=v),r!=null||l!=null){if(!(v!=="submit"&&v!=="reset"||r!=null)){Kd(n);return}l=l!=null?""+Ys(l):"",r=r!=null?""+Ys(r):l,R||r===n.value||(n.value=r),n.defaultValue=r}u=u??m,u=typeof u!="function"&&typeof u!="symbol"&&!!u,n.checked=R?n.checked:!!u,n.defaultChecked=!!u,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(n.name=x),Kd(n)}function Xd(n,r,l){r==="number"&&Xc(n.ownerDocument)===n||n.defaultValue===""+l||(n.defaultValue=""+l)}function Oa(n,r,l,u){if(n=n.options,r){r={};for(var m=0;m<l.length;m++)r["$"+l[m]]=!0;for(l=0;l<n.length;l++)m=r.hasOwnProperty("$"+n[l].value),n[l].selected!==m&&(n[l].selected=m),m&&u&&(n[l].defaultSelected=!0)}else{for(l=""+Ys(l),r=null,m=0;m<n.length;m++){if(n[m].value===l){n[m].selected=!0,u&&(n[m].defaultSelected=!0);return}r!==null||n[m].disabled||(r=n[m])}r!==null&&(r.selected=!0)}}function Xv(n,r,l){if(r!=null&&(r=""+Ys(r),r!==n.value&&(n.value=r),l==null)){n.defaultValue!==r&&(n.defaultValue=r);return}n.defaultValue=l!=null?""+Ys(l):""}function Qv(n,r,l,u){if(r==null){if(u!=null){if(l!=null)throw Error(i(92));if(H(u)){if(1<u.length)throw Error(i(93));u=u[0]}l=u}l==null&&(l=""),r=l}l=Ys(r),n.defaultValue=l,u=n.textContent,u===l&&u!==""&&u!==null&&(n.value=u),Kd(n)}function ja(n,r){if(r){var l=n.firstChild;if(l&&l===n.lastChild&&l.nodeType===3){l.nodeValue=r;return}}n.textContent=r}var IT=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 Zv(n,r,l){var u=r.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?u?n.setProperty(r,""):r==="float"?n.cssFloat="":n[r]="":u?n.setProperty(r,l):typeof l!="number"||l===0||IT.has(r)?r==="float"?n.cssFloat=l:n[r]=(""+l).trim():n[r]=l+"px"}function Jv(n,r,l){if(r!=null&&typeof r!="object")throw Error(i(62));if(n=n.style,l!=null){for(var u in l)!l.hasOwnProperty(u)||r!=null&&r.hasOwnProperty(u)||(u.indexOf("--")===0?n.setProperty(u,""):u==="float"?n.cssFloat="":n[u]="");for(var m in r)u=r[m],r.hasOwnProperty(m)&&l[m]!==u&&Zv(n,m,u)}else for(var v in r)r.hasOwnProperty(v)&&Zv(n,v,r[v])}function Qd(n){if(n.indexOf("-")===-1)return!1;switch(n){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 zT=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"]]),HT=/^[\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 Qc(n){return HT.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function Xi(){}var Zd=null;function Jd(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Pa=null,Ba=null;function ey(n){var r=Da(n);if(r&&(n=r.stateNode)){var l=n[xs]||null;e:switch(n=r.stateNode,r.type){case"input":if(Yd(n,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),r=l.name,l.type==="radio"&&r!=null){for(l=n;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+Xs(""+r)+'"][type="radio"]'),r=0;r<l.length;r++){var u=l[r];if(u!==n&&u.form===n.form){var m=u[xs]||null;if(!m)throw Error(i(90));Yd(u,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name)}}for(r=0;r<l.length;r++)u=l[r],u.form===n.form&&Kv(u)}break e;case"textarea":Xv(n,l.value,l.defaultValue);break e;case"select":r=l.value,r!=null&&Oa(n,!!l.multiple,r,!1)}}}var ef=!1;function ty(n,r,l){if(ef)return n(r,l);ef=!0;try{var u=n(r);return u}finally{if(ef=!1,(Pa!==null||Ba!==null)&&(Iu(),Pa&&(r=Pa,n=Ba,Ba=Pa=null,ey(r),n)))for(r=0;r<n.length;r++)ey(n[r])}}function el(n,r){var l=n.stateNode;if(l===null)return null;var u=l[xs]||null;if(u===null)return null;l=u[r];e:switch(r){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)||(n=n.type,u=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!u;break e;default:n=!1}if(n)return null;if(l&&typeof l!="function")throw Error(i(231,r,typeof l));return l}var Qi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),tf=!1;if(Qi)try{var tl={};Object.defineProperty(tl,"passive",{get:function(){tf=!0}}),window.addEventListener("test",tl,tl),window.removeEventListener("test",tl,tl)}catch{tf=!1}var Ln=null,sf=null,Zc=null;function sy(){if(Zc)return Zc;var n,r=sf,l=r.length,u,m="value"in Ln?Ln.value:Ln.textContent,v=m.length;for(n=0;n<l&&r[n]===m[n];n++);var x=l-n;for(u=1;u<=x&&r[l-u]===m[v-u];u++);return Zc=m.slice(n,1<u?1-u:void 0)}function Jc(n){var r=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&r===13&&(n=13)):n=r,n===10&&(n=13),32<=n||n===13?n:0}function eu(){return!0}function iy(){return!1}function ks(n){function r(l,u,m,v,x){this._reactName=l,this._targetInst=m,this.type=u,this.nativeEvent=v,this.target=x,this.currentTarget=null;for(var R in n)n.hasOwnProperty(R)&&(l=n[R],this[R]=l?l(v):v[R]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?eu:iy,this.isPropagationStopped=iy,this}return _(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=eu)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=eu)},persist:function(){},isPersistent:eu}),r}var Nr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},tu=ks(Nr),sl=_({},Nr,{view:0,detail:0}),UT=ks(sl),nf,rf,il,su=_({},sl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:of,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==il&&(il&&n.type==="mousemove"?(nf=n.screenX-il.screenX,rf=n.screenY-il.screenY):rf=nf=0,il=n),nf)},movementY:function(n){return"movementY"in n?n.movementY:rf}}),ny=ks(su),FT=_({},su,{dataTransfer:0}),$T=ks(FT),VT=_({},sl,{relatedTarget:0}),af=ks(VT),WT=_({},Nr,{animationName:0,elapsedTime:0,pseudoElement:0}),GT=ks(WT),qT=_({},Nr,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),KT=ks(qT),YT=_({},Nr,{data:0}),ry=ks(YT),XT={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},QT={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"},ZT={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function JT(n){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(n):(n=ZT[n])?!!r[n]:!1}function of(){return JT}var eN=_({},sl,{key:function(n){if(n.key){var r=XT[n.key]||n.key;if(r!=="Unidentified")return r}return n.type==="keypress"?(n=Jc(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?QT[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:of,charCode:function(n){return n.type==="keypress"?Jc(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?Jc(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),tN=ks(eN),sN=_({},su,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ay=ks(sN),iN=_({},sl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:of}),nN=ks(iN),rN=_({},Nr,{propertyName:0,elapsedTime:0,pseudoElement:0}),aN=ks(rN),oN=_({},su,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),lN=ks(oN),cN=_({},Nr,{newState:0,oldState:0}),uN=ks(cN),hN=[9,13,27,32],lf=Qi&&"CompositionEvent"in window,nl=null;Qi&&"documentMode"in document&&(nl=document.documentMode);var dN=Qi&&"TextEvent"in window&&!nl,oy=Qi&&(!lf||nl&&8<nl&&11>=nl),ly=" ",cy=!1;function uy(n,r){switch(n){case"keyup":return hN.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function hy(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Ia=!1;function fN(n,r){switch(n){case"compositionend":return hy(r);case"keypress":return r.which!==32?null:(cy=!0,ly);case"textInput":return n=r.data,n===ly&&cy?null:n;default:return null}}function pN(n,r){if(Ia)return n==="compositionend"||!lf&&uy(n,r)?(n=sy(),Zc=sf=Ln=null,Ia=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return oy&&r.locale!=="ko"?null:r.data;default:return null}}var mN={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 dy(n){var r=n&&n.nodeName&&n.nodeName.toLowerCase();return r==="input"?!!mN[n.type]:r==="textarea"}function fy(n,r,l,u){Pa?Ba?Ba.push(u):Ba=[u]:Pa=u,r=Wu(r,"onChange"),0<r.length&&(l=new tu("onChange","change",null,l,u),n.push({event:l,listeners:r}))}var rl=null,al=null;function gN(n){YS(n,0)}function iu(n){var r=Jo(n);if(Kv(r))return n}function py(n,r){if(n==="change")return r}var my=!1;if(Qi){var cf;if(Qi){var uf="oninput"in document;if(!uf){var gy=document.createElement("div");gy.setAttribute("oninput","return;"),uf=typeof gy.oninput=="function"}cf=uf}else cf=!1;my=cf&&(!document.documentMode||9<document.documentMode)}function _y(){rl&&(rl.detachEvent("onpropertychange",vy),al=rl=null)}function vy(n){if(n.propertyName==="value"&&iu(al)){var r=[];fy(r,al,n,Jd(n)),ty(gN,r)}}function _N(n,r,l){n==="focusin"?(_y(),rl=r,al=l,rl.attachEvent("onpropertychange",vy)):n==="focusout"&&_y()}function vN(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return iu(al)}function yN(n,r){if(n==="click")return iu(r)}function bN(n,r){if(n==="input"||n==="change")return iu(r)}function SN(n,r){return n===r&&(n!==0||1/n===1/r)||n!==n&&r!==r}var js=typeof Object.is=="function"?Object.is:SN;function ol(n,r){if(js(n,r))return!0;if(typeof n!="object"||n===null||typeof r!="object"||r===null)return!1;var l=Object.keys(n),u=Object.keys(r);if(l.length!==u.length)return!1;for(u=0;u<l.length;u++){var m=l[u];if(!Rn.call(r,m)||!js(n[m],r[m]))return!1}return!0}function yy(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function by(n,r){var l=yy(n);n=0;for(var u;l;){if(l.nodeType===3){if(u=n+l.textContent.length,n<=r&&u>=r)return{node:l,offset:r-n};n=u}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=yy(l)}}function Sy(n,r){return n&&r?n===r?!0:n&&n.nodeType===3?!1:r&&r.nodeType===3?Sy(n,r.parentNode):"contains"in n?n.contains(r):n.compareDocumentPosition?!!(n.compareDocumentPosition(r)&16):!1:!1}function wy(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var r=Xc(n.document);r instanceof n.HTMLIFrameElement;){try{var l=typeof r.contentWindow.location.href=="string"}catch{l=!1}if(l)n=r.contentWindow;else break;r=Xc(n.document)}return r}function hf(n){var r=n&&n.nodeName&&n.nodeName.toLowerCase();return r&&(r==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||r==="textarea"||n.contentEditable==="true")}var wN=Qi&&"documentMode"in document&&11>=document.documentMode,za=null,df=null,ll=null,ff=!1;function Cy(n,r,l){var u=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;ff||za==null||za!==Xc(u)||(u=za,"selectionStart"in u&&hf(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}),ll&&ol(ll,u)||(ll=u,u=Wu(df,"onSelect"),0<u.length&&(r=new tu("onSelect","select",null,r,l),n.push({event:r,listeners:u}),r.target=za)))}function Ar(n,r){var l={};return l[n.toLowerCase()]=r.toLowerCase(),l["Webkit"+n]="webkit"+r,l["Moz"+n]="moz"+r,l}var Ha={animationend:Ar("Animation","AnimationEnd"),animationiteration:Ar("Animation","AnimationIteration"),animationstart:Ar("Animation","AnimationStart"),transitionrun:Ar("Transition","TransitionRun"),transitionstart:Ar("Transition","TransitionStart"),transitioncancel:Ar("Transition","TransitionCancel"),transitionend:Ar("Transition","TransitionEnd")},pf={},xy={};Qi&&(xy=document.createElement("div").style,"AnimationEvent"in window||(delete Ha.animationend.animation,delete Ha.animationiteration.animation,delete Ha.animationstart.animation),"TransitionEvent"in window||delete Ha.transitionend.transition);function Rr(n){if(pf[n])return pf[n];if(!Ha[n])return n;var r=Ha[n],l;for(l in r)if(r.hasOwnProperty(l)&&l in xy)return pf[n]=r[l];return n}var ky=Rr("animationend"),Ey=Rr("animationiteration"),Ty=Rr("animationstart"),CN=Rr("transitionrun"),xN=Rr("transitionstart"),kN=Rr("transitioncancel"),Ny=Rr("transitionend"),Ay=new Map,mf="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(" ");mf.push("scrollEnd");function vi(n,r){Ay.set(n,r),Tr(r,[n])}var nu=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},Qs=[],Ua=0,gf=0;function ru(){for(var n=Ua,r=gf=Ua=0;r<n;){var l=Qs[r];Qs[r++]=null;var u=Qs[r];Qs[r++]=null;var m=Qs[r];Qs[r++]=null;var v=Qs[r];if(Qs[r++]=null,u!==null&&m!==null){var x=u.pending;x===null?m.next=m:(m.next=x.next,x.next=m),u.pending=m}v!==0&&Ry(l,m,v)}}function au(n,r,l,u){Qs[Ua++]=n,Qs[Ua++]=r,Qs[Ua++]=l,Qs[Ua++]=u,gf|=u,n.lanes|=u,n=n.alternate,n!==null&&(n.lanes|=u)}function _f(n,r,l,u){return au(n,r,l,u),ou(n)}function Dr(n,r){return au(n,null,null,r),ou(n)}function Ry(n,r,l){n.lanes|=l;var u=n.alternate;u!==null&&(u.lanes|=l);for(var m=!1,v=n.return;v!==null;)v.childLanes|=l,u=v.alternate,u!==null&&(u.childLanes|=l),v.tag===22&&(n=v.stateNode,n===null||n._visibility&1||(m=!0)),n=v,v=v.return;return n.tag===3?(v=n.stateNode,m&&r!==null&&(m=31-Gt(l),n=v.hiddenUpdates,u=n[m],u===null?n[m]=[r]:u.push(r),r.lane=l|536870912),v):null}function ou(n){if(50<Rl)throw Rl=0,Ep=null,Error(i(185));for(var r=n.return;r!==null;)n=r,r=n.return;return n.tag===3?n.stateNode:null}var Fa={};function EN(n,r,l,u){this.tag=n,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=r,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 Ps(n,r,l,u){return new EN(n,r,l,u)}function vf(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Zi(n,r){var l=n.alternate;return l===null?(l=Ps(n.tag,r,n.key,n.mode),l.elementType=n.elementType,l.type=n.type,l.stateNode=n.stateNode,l.alternate=n,n.alternate=l):(l.pendingProps=r,l.type=n.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=n.flags&65011712,l.childLanes=n.childLanes,l.lanes=n.lanes,l.child=n.child,l.memoizedProps=n.memoizedProps,l.memoizedState=n.memoizedState,l.updateQueue=n.updateQueue,r=n.dependencies,l.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},l.sibling=n.sibling,l.index=n.index,l.ref=n.ref,l.refCleanup=n.refCleanup,l}function Dy(n,r){n.flags&=65011714;var l=n.alternate;return l===null?(n.childLanes=0,n.lanes=r,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=l.childLanes,n.lanes=l.lanes,n.child=l.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=l.memoizedProps,n.memoizedState=l.memoizedState,n.updateQueue=l.updateQueue,n.type=l.type,r=l.dependencies,n.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),n}function lu(n,r,l,u,m,v){var x=0;if(u=n,typeof n=="function")vf(n)&&(x=1);else if(typeof n=="string")x=DA(n,l,oe.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case $:return n=Ps(31,l,r,m),n.elementType=$,n.lanes=v,n;case w:return Lr(l.children,m,v,r);case k:x=8,m|=24;break;case T:return n=Ps(12,l,r,m|2),n.elementType=T,n.lanes=v,n;case M:return n=Ps(13,l,r,m),n.elementType=M,n.lanes=v,n;case U:return n=Ps(19,l,r,m),n.elementType=U,n.lanes=v,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case N:x=10;break e;case D:x=9;break e;case E:x=11;break e;case W:x=14;break e;case B:x=16,u=null;break e}x=29,l=Error(i(130,n===null?"null":typeof n,"")),u=null}return r=Ps(x,l,r,m),r.elementType=n,r.type=u,r.lanes=v,r}function Lr(n,r,l,u){return n=Ps(7,n,u,r),n.lanes=l,n}function yf(n,r,l){return n=Ps(6,n,null,r),n.lanes=l,n}function Ly(n){var r=Ps(18,null,null,0);return r.stateNode=n,r}function bf(n,r,l){return r=Ps(4,n.children!==null?n.children:[],n.key,r),r.lanes=l,r.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},r}var My=new WeakMap;function Zs(n,r){if(typeof n=="object"&&n!==null){var l=My.get(n);return l!==void 0?l:(r={value:n,source:r,stack:Ea(r)},My.set(n,r),r)}return{value:n,source:r,stack:Ea(r)}}var $a=[],Va=0,cu=null,cl=0,Js=[],ei=0,Mn=null,Ri=1,Di="";function Ji(n,r){$a[Va++]=cl,$a[Va++]=cu,cu=n,cl=r}function Oy(n,r,l){Js[ei++]=Ri,Js[ei++]=Di,Js[ei++]=Mn,Mn=n;var u=Ri;n=Di;var m=32-Gt(u)-1;u&=~(1<<m),l+=1;var v=32-Gt(r)+m;if(30<v){var x=m-m%5;v=(u&(1<<x)-1).toString(32),u>>=x,m-=x,Ri=1<<32-Gt(r)+m|l<<m|u,Di=v+n}else Ri=1<<v|l<<m|u,Di=n}function Sf(n){n.return!==null&&(Ji(n,1),Oy(n,1,0))}function wf(n){for(;n===cu;)cu=$a[--Va],$a[Va]=null,cl=$a[--Va],$a[Va]=null;for(;n===Mn;)Mn=Js[--ei],Js[ei]=null,Di=Js[--ei],Js[ei]=null,Ri=Js[--ei],Js[ei]=null}function jy(n,r){Js[ei++]=Ri,Js[ei++]=Di,Js[ei++]=Mn,Ri=r.id,Di=r.overflow,Mn=n}var ns=null,ht=null,Ye=!1,On=null,ti=!1,Cf=Error(i(519));function jn(n){var r=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ul(Zs(r,n)),Cf}function Py(n){var r=n.stateNode,l=n.type,u=n.memoizedProps;switch(r[is]=n,r[xs]=u,l){case"dialog":Ve("cancel",r),Ve("close",r);break;case"iframe":case"object":case"embed":Ve("load",r);break;case"video":case"audio":for(l=0;l<Ll.length;l++)Ve(Ll[l],r);break;case"source":Ve("error",r);break;case"img":case"image":case"link":Ve("error",r),Ve("load",r);break;case"details":Ve("toggle",r);break;case"input":Ve("invalid",r),Yv(r,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":Ve("invalid",r);break;case"textarea":Ve("invalid",r),Qv(r,u.value,u.defaultValue,u.children)}l=u.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||r.textContent===""+l||u.suppressHydrationWarning===!0||JS(r.textContent,l)?(u.popover!=null&&(Ve("beforetoggle",r),Ve("toggle",r)),u.onScroll!=null&&Ve("scroll",r),u.onScrollEnd!=null&&Ve("scrollend",r),u.onClick!=null&&(r.onclick=Xi),r=!0):r=!1,r||jn(n,!0)}function By(n){for(ns=n.return;ns;)switch(ns.tag){case 5:case 31:case 13:ti=!1;return;case 27:case 3:ti=!0;return;default:ns=ns.return}}function Wa(n){if(n!==ns)return!1;if(!Ye)return By(n),Ye=!0,!1;var r=n.tag,l;if((l=r!==3&&r!==27)&&((l=r===5)&&(l=n.type,l=!(l!=="form"&&l!=="button")||Up(n.type,n.memoizedProps)),l=!l),l&&ht&&jn(n),By(n),r===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(i(317));ht=l0(n)}else if(r===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(i(317));ht=l0(n)}else r===27?(r=ht,Yn(n.type)?(n=Gp,Gp=null,ht=n):ht=r):ht=ns?ii(n.stateNode.nextSibling):null;return!0}function Mr(){ht=ns=null,Ye=!1}function xf(){var n=On;return n!==null&&(As===null?As=n:As.push.apply(As,n),On=null),n}function ul(n){On===null?On=[n]:On.push(n)}var kf=A(null),Or=null,en=null;function Pn(n,r,l){q(kf,r._currentValue),r._currentValue=l}function tn(n){n._currentValue=kf.current,I(kf)}function Ef(n,r,l){for(;n!==null;){var u=n.alternate;if((n.childLanes&r)!==r?(n.childLanes|=r,u!==null&&(u.childLanes|=r)):u!==null&&(u.childLanes&r)!==r&&(u.childLanes|=r),n===l)break;n=n.return}}function Tf(n,r,l,u){var m=n.child;for(m!==null&&(m.return=n);m!==null;){var v=m.dependencies;if(v!==null){var x=m.child;v=v.firstContext;e:for(;v!==null;){var R=v;v=m;for(var F=0;F<r.length;F++)if(R.context===r[F]){v.lanes|=l,R=v.alternate,R!==null&&(R.lanes|=l),Ef(v.return,l,n),u||(x=null);break e}v=R.next}}else if(m.tag===18){if(x=m.return,x===null)throw Error(i(341));x.lanes|=l,v=x.alternate,v!==null&&(v.lanes|=l),Ef(x,l,n),x=null}else x=m.child;if(x!==null)x.return=m;else for(x=m;x!==null;){if(x===n){x=null;break}if(m=x.sibling,m!==null){m.return=x.return,x=m;break}x=x.return}m=x}}function Ga(n,r,l,u){n=null;for(var m=r,v=!1;m!==null;){if(!v){if((m.flags&524288)!==0)v=!0;else if((m.flags&262144)!==0)break}if(m.tag===10){var x=m.alternate;if(x===null)throw Error(i(387));if(x=x.memoizedProps,x!==null){var R=m.type;js(m.pendingProps.value,x.value)||(n!==null?n.push(R):n=[R])}}else if(m===Ne.current){if(x=m.alternate,x===null)throw Error(i(387));x.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(n!==null?n.push(Bl):n=[Bl])}m=m.return}n!==null&&Tf(r,n,l,u),r.flags|=262144}function uu(n){for(n=n.firstContext;n!==null;){if(!js(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function jr(n){Or=n,en=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function rs(n){return Iy(Or,n)}function hu(n,r){return Or===null&&jr(n),Iy(n,r)}function Iy(n,r){var l=r._currentValue;if(r={context:r,memoizedValue:l,next:null},en===null){if(n===null)throw Error(i(308));en=r,n.dependencies={lanes:0,firstContext:r},n.flags|=524288}else en=en.next=r;return l}var TN=typeof AbortController<"u"?AbortController:function(){var n=[],r=this.signal={aborted:!1,addEventListener:function(l,u){n.push(u)}};this.abort=function(){r.aborted=!0,n.forEach(function(l){return l()})}},NN=e.unstable_scheduleCallback,AN=e.unstable_NormalPriority,Rt={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Nf(){return{controller:new TN,data:new Map,refCount:0}}function hl(n){n.refCount--,n.refCount===0&&NN(AN,function(){n.controller.abort()})}var dl=null,Af=0,qa=0,Ka=null;function RN(n,r){if(dl===null){var l=dl=[];Af=0,qa=Lp(),Ka={status:"pending",value:void 0,then:function(u){l.push(u)}}}return Af++,r.then(zy,zy),r}function zy(){if(--Af===0&&dl!==null){Ka!==null&&(Ka.status="fulfilled");var n=dl;dl=null,qa=0,Ka=null;for(var r=0;r<n.length;r++)(0,n[r])()}}function DN(n,r){var l=[],u={status:"pending",value:null,reason:null,then:function(m){l.push(m)}};return n.then(function(){u.status="fulfilled",u.value=r;for(var m=0;m<l.length;m++)(0,l[m])(r)},function(m){for(u.status="rejected",u.reason=m,m=0;m<l.length;m++)(0,l[m])(void 0)}),u}var Hy=O.S;O.S=function(n,r){CS=bt(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&RN(n,r),Hy!==null&&Hy(n,r)};var Pr=A(null);function Rf(){var n=Pr.current;return n!==null?n:lt.pooledCache}function du(n,r){r===null?q(Pr,Pr.current):q(Pr,r.pool)}function Uy(){var n=Rf();return n===null?null:{parent:Rt._currentValue,pool:n}}var Ya=Error(i(460)),Df=Error(i(474)),fu=Error(i(542)),pu={then:function(){}};function Fy(n){return n=n.status,n==="fulfilled"||n==="rejected"}function $y(n,r,l){switch(l=n[l],l===void 0?n.push(r):l!==r&&(r.then(Xi,Xi),r=l),r.status){case"fulfilled":return r.value;case"rejected":throw n=r.reason,Wy(n),n;default:if(typeof r.status=="string")r.then(Xi,Xi);else{if(n=lt,n!==null&&100<n.shellSuspendCounter)throw Error(i(482));n=r,n.status="pending",n.then(function(u){if(r.status==="pending"){var m=r;m.status="fulfilled",m.value=u}},function(u){if(r.status==="pending"){var m=r;m.status="rejected",m.reason=u}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw n=r.reason,Wy(n),n}throw Ir=r,Ya}}function Br(n){try{var r=n._init;return r(n._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(Ir=l,Ya):l}}var Ir=null;function Vy(){if(Ir===null)throw Error(i(459));var n=Ir;return Ir=null,n}function Wy(n){if(n===Ya||n===fu)throw Error(i(483))}var Xa=null,fl=0;function mu(n){var r=fl;return fl+=1,Xa===null&&(Xa=[]),$y(Xa,n,r)}function pl(n,r){r=r.props.ref,n.ref=r!==void 0?r:null}function gu(n,r){throw r.$$typeof===y?Error(i(525)):(n=Object.prototype.toString.call(r),Error(i(31,n==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":n)))}function Gy(n){function r(Z,G){if(n){var J=Z.deletions;J===null?(Z.deletions=[G],Z.flags|=16):J.push(G)}}function l(Z,G){if(!n)return null;for(;G!==null;)r(Z,G),G=G.sibling;return null}function u(Z){for(var G=new Map;Z!==null;)Z.key!==null?G.set(Z.key,Z):G.set(Z.index,Z),Z=Z.sibling;return G}function m(Z,G){return Z=Zi(Z,G),Z.index=0,Z.sibling=null,Z}function v(Z,G,J){return Z.index=J,n?(J=Z.alternate,J!==null?(J=J.index,J<G?(Z.flags|=67108866,G):J):(Z.flags|=67108866,G)):(Z.flags|=1048576,G)}function x(Z){return n&&Z.alternate===null&&(Z.flags|=67108866),Z}function R(Z,G,J,ue){return G===null||G.tag!==6?(G=yf(J,Z.mode,ue),G.return=Z,G):(G=m(G,J),G.return=Z,G)}function F(Z,G,J,ue){var Te=J.type;return Te===w?ae(Z,G,J.props.children,ue,J.key):G!==null&&(G.elementType===Te||typeof Te=="object"&&Te!==null&&Te.$$typeof===B&&Br(Te)===G.type)?(G=m(G,J.props),pl(G,J),G.return=Z,G):(G=lu(J.type,J.key,J.props,null,Z.mode,ue),pl(G,J),G.return=Z,G)}function ee(Z,G,J,ue){return G===null||G.tag!==4||G.stateNode.containerInfo!==J.containerInfo||G.stateNode.implementation!==J.implementation?(G=bf(J,Z.mode,ue),G.return=Z,G):(G=m(G,J.children||[]),G.return=Z,G)}function ae(Z,G,J,ue,Te){return G===null||G.tag!==7?(G=Lr(J,Z.mode,ue,Te),G.return=Z,G):(G=m(G,J),G.return=Z,G)}function he(Z,G,J){if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return G=yf(""+G,Z.mode,J),G.return=Z,G;if(typeof G=="object"&&G!==null){switch(G.$$typeof){case b:return J=lu(G.type,G.key,G.props,null,Z.mode,J),pl(J,G),J.return=Z,J;case S:return G=bf(G,Z.mode,J),G.return=Z,G;case B:return G=Br(G),he(Z,G,J)}if(H(G)||X(G))return G=Lr(G,Z.mode,J,null),G.return=Z,G;if(typeof G.then=="function")return he(Z,mu(G),J);if(G.$$typeof===N)return he(Z,hu(Z,G),J);gu(Z,G)}return null}function te(Z,G,J,ue){var Te=G!==null?G.key:null;if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return Te!==null?null:R(Z,G,""+J,ue);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case b:return J.key===Te?F(Z,G,J,ue):null;case S:return J.key===Te?ee(Z,G,J,ue):null;case B:return J=Br(J),te(Z,G,J,ue)}if(H(J)||X(J))return Te!==null?null:ae(Z,G,J,ue,null);if(typeof J.then=="function")return te(Z,G,mu(J),ue);if(J.$$typeof===N)return te(Z,G,hu(Z,J),ue);gu(Z,J)}return null}function ie(Z,G,J,ue,Te){if(typeof ue=="string"&&ue!==""||typeof ue=="number"||typeof ue=="bigint")return Z=Z.get(J)||null,R(G,Z,""+ue,Te);if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case b:return Z=Z.get(ue.key===null?J:ue.key)||null,F(G,Z,ue,Te);case S:return Z=Z.get(ue.key===null?J:ue.key)||null,ee(G,Z,ue,Te);case B:return ue=Br(ue),ie(Z,G,J,ue,Te)}if(H(ue)||X(ue))return Z=Z.get(J)||null,ae(G,Z,ue,Te,null);if(typeof ue.then=="function")return ie(Z,G,J,mu(ue),Te);if(ue.$$typeof===N)return ie(Z,G,J,hu(G,ue),Te);gu(G,ue)}return null}function Ce(Z,G,J,ue){for(var Te=null,Ze=null,xe=G,Be=G=0,Ge=null;xe!==null&&Be<J.length;Be++){xe.index>Be?(Ge=xe,xe=null):Ge=xe.sibling;var Je=te(Z,xe,J[Be],ue);if(Je===null){xe===null&&(xe=Ge);break}n&&xe&&Je.alternate===null&&r(Z,xe),G=v(Je,G,Be),Ze===null?Te=Je:Ze.sibling=Je,Ze=Je,xe=Ge}if(Be===J.length)return l(Z,xe),Ye&&Ji(Z,Be),Te;if(xe===null){for(;Be<J.length;Be++)xe=he(Z,J[Be],ue),xe!==null&&(G=v(xe,G,Be),Ze===null?Te=xe:Ze.sibling=xe,Ze=xe);return Ye&&Ji(Z,Be),Te}for(xe=u(xe);Be<J.length;Be++)Ge=ie(xe,Z,Be,J[Be],ue),Ge!==null&&(n&&Ge.alternate!==null&&xe.delete(Ge.key===null?Be:Ge.key),G=v(Ge,G,Be),Ze===null?Te=Ge:Ze.sibling=Ge,Ze=Ge);return n&&xe.forEach(function(er){return r(Z,er)}),Ye&&Ji(Z,Be),Te}function Ae(Z,G,J,ue){if(J==null)throw Error(i(151));for(var Te=null,Ze=null,xe=G,Be=G=0,Ge=null,Je=J.next();xe!==null&&!Je.done;Be++,Je=J.next()){xe.index>Be?(Ge=xe,xe=null):Ge=xe.sibling;var er=te(Z,xe,Je.value,ue);if(er===null){xe===null&&(xe=Ge);break}n&&xe&&er.alternate===null&&r(Z,xe),G=v(er,G,Be),Ze===null?Te=er:Ze.sibling=er,Ze=er,xe=Ge}if(Je.done)return l(Z,xe),Ye&&Ji(Z,Be),Te;if(xe===null){for(;!Je.done;Be++,Je=J.next())Je=he(Z,Je.value,ue),Je!==null&&(G=v(Je,G,Be),Ze===null?Te=Je:Ze.sibling=Je,Ze=Je);return Ye&&Ji(Z,Be),Te}for(xe=u(xe);!Je.done;Be++,Je=J.next())Je=ie(xe,Z,Be,Je.value,ue),Je!==null&&(n&&Je.alternate!==null&&xe.delete(Je.key===null?Be:Je.key),G=v(Je,G,Be),Ze===null?Te=Je:Ze.sibling=Je,Ze=Je);return n&&xe.forEach(function(FA){return r(Z,FA)}),Ye&&Ji(Z,Be),Te}function at(Z,G,J,ue){if(typeof J=="object"&&J!==null&&J.type===w&&J.key===null&&(J=J.props.children),typeof J=="object"&&J!==null){switch(J.$$typeof){case b:e:{for(var Te=J.key;G!==null;){if(G.key===Te){if(Te=J.type,Te===w){if(G.tag===7){l(Z,G.sibling),ue=m(G,J.props.children),ue.return=Z,Z=ue;break e}}else if(G.elementType===Te||typeof Te=="object"&&Te!==null&&Te.$$typeof===B&&Br(Te)===G.type){l(Z,G.sibling),ue=m(G,J.props),pl(ue,J),ue.return=Z,Z=ue;break e}l(Z,G);break}else r(Z,G);G=G.sibling}J.type===w?(ue=Lr(J.props.children,Z.mode,ue,J.key),ue.return=Z,Z=ue):(ue=lu(J.type,J.key,J.props,null,Z.mode,ue),pl(ue,J),ue.return=Z,Z=ue)}return x(Z);case S:e:{for(Te=J.key;G!==null;){if(G.key===Te)if(G.tag===4&&G.stateNode.containerInfo===J.containerInfo&&G.stateNode.implementation===J.implementation){l(Z,G.sibling),ue=m(G,J.children||[]),ue.return=Z,Z=ue;break e}else{l(Z,G);break}else r(Z,G);G=G.sibling}ue=bf(J,Z.mode,ue),ue.return=Z,Z=ue}return x(Z);case B:return J=Br(J),at(Z,G,J,ue)}if(H(J))return Ce(Z,G,J,ue);if(X(J)){if(Te=X(J),typeof Te!="function")throw Error(i(150));return J=Te.call(J),Ae(Z,G,J,ue)}if(typeof J.then=="function")return at(Z,G,mu(J),ue);if(J.$$typeof===N)return at(Z,G,hu(Z,J),ue);gu(Z,J)}return typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint"?(J=""+J,G!==null&&G.tag===6?(l(Z,G.sibling),ue=m(G,J),ue.return=Z,Z=ue):(l(Z,G),ue=yf(J,Z.mode,ue),ue.return=Z,Z=ue),x(Z)):l(Z,G)}return function(Z,G,J,ue){try{fl=0;var Te=at(Z,G,J,ue);return Xa=null,Te}catch(xe){if(xe===Ya||xe===fu)throw xe;var Ze=Ps(29,xe,null,Z.mode);return Ze.lanes=ue,Ze.return=Z,Ze}finally{}}}var zr=Gy(!0),qy=Gy(!1),Bn=!1;function Lf(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Mf(n,r){n=n.updateQueue,r.updateQueue===n&&(r.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function In(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function zn(n,r,l){var u=n.updateQueue;if(u===null)return null;if(u=u.shared,(et&2)!==0){var m=u.pending;return m===null?r.next=r:(r.next=m.next,m.next=r),u.pending=r,r=ou(n),Ry(n,null,l),r}return au(n,u,r,l),ou(n)}function ml(n,r,l){if(r=r.updateQueue,r!==null&&(r=r.shared,(l&4194048)!==0)){var u=r.lanes;u&=n.pendingLanes,l|=u,r.lanes=l,Iv(n,l)}}function Of(n,r){var l=n.updateQueue,u=n.alternate;if(u!==null&&(u=u.updateQueue,l===u)){var m=null,v=null;if(l=l.firstBaseUpdate,l!==null){do{var x={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};v===null?m=v=x:v=v.next=x,l=l.next}while(l!==null);v===null?m=v=r:v=v.next=r}else m=v=r;l={baseState:u.baseState,firstBaseUpdate:m,lastBaseUpdate:v,shared:u.shared,callbacks:u.callbacks},n.updateQueue=l;return}n=l.lastBaseUpdate,n===null?l.firstBaseUpdate=r:n.next=r,l.lastBaseUpdate=r}var jf=!1;function gl(){if(jf){var n=Ka;if(n!==null)throw n}}function _l(n,r,l,u){jf=!1;var m=n.updateQueue;Bn=!1;var v=m.firstBaseUpdate,x=m.lastBaseUpdate,R=m.shared.pending;if(R!==null){m.shared.pending=null;var F=R,ee=F.next;F.next=null,x===null?v=ee:x.next=ee,x=F;var ae=n.alternate;ae!==null&&(ae=ae.updateQueue,R=ae.lastBaseUpdate,R!==x&&(R===null?ae.firstBaseUpdate=ee:R.next=ee,ae.lastBaseUpdate=F))}if(v!==null){var he=m.baseState;x=0,ae=ee=F=null,R=v;do{var te=R.lane&-536870913,ie=te!==R.lane;if(ie?(We&te)===te:(u&te)===te){te!==0&&te===qa&&(jf=!0),ae!==null&&(ae=ae.next={lane:0,tag:R.tag,payload:R.payload,callback:null,next:null});e:{var Ce=n,Ae=R;te=r;var at=l;switch(Ae.tag){case 1:if(Ce=Ae.payload,typeof Ce=="function"){he=Ce.call(at,he,te);break e}he=Ce;break e;case 3:Ce.flags=Ce.flags&-65537|128;case 0:if(Ce=Ae.payload,te=typeof Ce=="function"?Ce.call(at,he,te):Ce,te==null)break e;he=_({},he,te);break e;case 2:Bn=!0}}te=R.callback,te!==null&&(n.flags|=64,ie&&(n.flags|=8192),ie=m.callbacks,ie===null?m.callbacks=[te]:ie.push(te))}else ie={lane:te,tag:R.tag,payload:R.payload,callback:R.callback,next:null},ae===null?(ee=ae=ie,F=he):ae=ae.next=ie,x|=te;if(R=R.next,R===null){if(R=m.shared.pending,R===null)break;ie=R,R=ie.next,ie.next=null,m.lastBaseUpdate=ie,m.shared.pending=null}}while(!0);ae===null&&(F=he),m.baseState=F,m.firstBaseUpdate=ee,m.lastBaseUpdate=ae,v===null&&(m.shared.lanes=0),Vn|=x,n.lanes=x,n.memoizedState=he}}function Ky(n,r){if(typeof n!="function")throw Error(i(191,n));n.call(r)}function Yy(n,r){var l=n.callbacks;if(l!==null)for(n.callbacks=null,n=0;n<l.length;n++)Ky(l[n],r)}var Qa=A(null),_u=A(0);function Xy(n,r){n=hn,q(_u,n),q(Qa,r),hn=n|r.baseLanes}function Pf(){q(_u,hn),q(Qa,Qa.current)}function Bf(){hn=_u.current,I(Qa),I(_u)}var Bs=A(null),si=null;function Hn(n){var r=n.alternate;q(Et,Et.current&1),q(Bs,n),si===null&&(r===null||Qa.current!==null||r.memoizedState!==null)&&(si=n)}function If(n){q(Et,Et.current),q(Bs,n),si===null&&(si=n)}function Qy(n){n.tag===22?(q(Et,Et.current),q(Bs,n),si===null&&(si=n)):Un()}function Un(){q(Et,Et.current),q(Bs,Bs.current)}function Is(n){I(Bs),si===n&&(si=null),I(Et)}var Et=A(0);function vu(n){for(var r=n;r!==null;){if(r.tag===13){var l=r.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||Vp(l)||Wp(l)))return r}else if(r.tag===19&&(r.memoizedProps.revealOrder==="forwards"||r.memoizedProps.revealOrder==="backwards"||r.memoizedProps.revealOrder==="unstable_legacy-backwards"||r.memoizedProps.revealOrder==="together")){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===n)break;for(;r.sibling===null;){if(r.return===null||r.return===n)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var sn=0,Pe=null,nt=null,Dt=null,yu=!1,Za=!1,Hr=!1,bu=0,vl=0,Ja=null,LN=0;function St(){throw Error(i(321))}function zf(n,r){if(r===null)return!1;for(var l=0;l<r.length&&l<n.length;l++)if(!js(n[l],r[l]))return!1;return!0}function Hf(n,r,l,u,m,v){return sn=v,Pe=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,O.H=n===null||n.memoizedState===null?Ob:tp,Hr=!1,v=l(u,m),Hr=!1,Za&&(v=Jy(r,l,u,m)),Zy(n),v}function Zy(n){O.H=Sl;var r=nt!==null&&nt.next!==null;if(sn=0,Dt=nt=Pe=null,yu=!1,vl=0,Ja=null,r)throw Error(i(300));n===null||Lt||(n=n.dependencies,n!==null&&uu(n)&&(Lt=!0))}function Jy(n,r,l,u){Pe=n;var m=0;do{if(Za&&(Ja=null),vl=0,Za=!1,25<=m)throw Error(i(301));if(m+=1,Dt=nt=null,n.updateQueue!=null){var v=n.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}O.H=jb,v=r(l,u)}while(Za);return v}function MN(){var n=O.H,r=n.useState()[0];return r=typeof r.then=="function"?yl(r):r,n=n.useState()[0],(nt!==null?nt.memoizedState:null)!==n&&(Pe.flags|=1024),r}function Uf(){var n=bu!==0;return bu=0,n}function Ff(n,r,l){r.updateQueue=n.updateQueue,r.flags&=-2053,n.lanes&=~l}function $f(n){if(yu){for(n=n.memoizedState;n!==null;){var r=n.queue;r!==null&&(r.pending=null),n=n.next}yu=!1}sn=0,Dt=nt=Pe=null,Za=!1,vl=bu=0,Ja=null}function _s(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Dt===null?Pe.memoizedState=Dt=n:Dt=Dt.next=n,Dt}function Tt(){if(nt===null){var n=Pe.alternate;n=n!==null?n.memoizedState:null}else n=nt.next;var r=Dt===null?Pe.memoizedState:Dt.next;if(r!==null)Dt=r,nt=n;else{if(n===null)throw Pe.alternate===null?Error(i(467)):Error(i(310));nt=n,n={memoizedState:nt.memoizedState,baseState:nt.baseState,baseQueue:nt.baseQueue,queue:nt.queue,next:null},Dt===null?Pe.memoizedState=Dt=n:Dt=Dt.next=n}return Dt}function Su(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function yl(n){var r=vl;return vl+=1,Ja===null&&(Ja=[]),n=$y(Ja,n,r),r=Pe,(Dt===null?r.memoizedState:Dt.next)===null&&(r=r.alternate,O.H=r===null||r.memoizedState===null?Ob:tp),n}function wu(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return yl(n);if(n.$$typeof===N)return rs(n)}throw Error(i(438,String(n)))}function Vf(n){var r=null,l=Pe.updateQueue;if(l!==null&&(r=l.memoCache),r==null){var u=Pe.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(r={data:u.data.map(function(m){return m.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),l===null&&(l=Su(),Pe.updateQueue=l),l.memoCache=r,l=r.data[r.index],l===void 0)for(l=r.data[r.index]=Array(n),u=0;u<n;u++)l[u]=Y;return r.index++,l}function nn(n,r){return typeof r=="function"?r(n):r}function Cu(n){var r=Tt();return Wf(r,nt,n)}function Wf(n,r,l){var u=n.queue;if(u===null)throw Error(i(311));u.lastRenderedReducer=l;var m=n.baseQueue,v=u.pending;if(v!==null){if(m!==null){var x=m.next;m.next=v.next,v.next=x}r.baseQueue=m=v,u.pending=null}if(v=n.baseState,m===null)n.memoizedState=v;else{r=m.next;var R=x=null,F=null,ee=r,ae=!1;do{var he=ee.lane&-536870913;if(he!==ee.lane?(We&he)===he:(sn&he)===he){var te=ee.revertLane;if(te===0)F!==null&&(F=F.next={lane:0,revertLane:0,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null}),he===qa&&(ae=!0);else if((sn&te)===te){ee=ee.next,te===qa&&(ae=!0);continue}else he={lane:0,revertLane:ee.revertLane,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},F===null?(R=F=he,x=v):F=F.next=he,Pe.lanes|=te,Vn|=te;he=ee.action,Hr&&l(v,he),v=ee.hasEagerState?ee.eagerState:l(v,he)}else te={lane:he,revertLane:ee.revertLane,gesture:ee.gesture,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},F===null?(R=F=te,x=v):F=F.next=te,Pe.lanes|=he,Vn|=he;ee=ee.next}while(ee!==null&&ee!==r);if(F===null?x=v:F.next=R,!js(v,n.memoizedState)&&(Lt=!0,ae&&(l=Ka,l!==null)))throw l;n.memoizedState=v,n.baseState=x,n.baseQueue=F,u.lastRenderedState=v}return m===null&&(u.lanes=0),[n.memoizedState,u.dispatch]}function Gf(n){var r=Tt(),l=r.queue;if(l===null)throw Error(i(311));l.lastRenderedReducer=n;var u=l.dispatch,m=l.pending,v=r.memoizedState;if(m!==null){l.pending=null;var x=m=m.next;do v=n(v,x.action),x=x.next;while(x!==m);js(v,r.memoizedState)||(Lt=!0),r.memoizedState=v,r.baseQueue===null&&(r.baseState=v),l.lastRenderedState=v}return[v,u]}function eb(n,r,l){var u=Pe,m=Tt(),v=Ye;if(v){if(l===void 0)throw Error(i(407));l=l()}else l=r();var x=!js((nt||m).memoizedState,l);if(x&&(m.memoizedState=l,Lt=!0),m=m.queue,Yf(ib.bind(null,u,m,n),[n]),m.getSnapshot!==r||x||Dt!==null&&Dt.memoizedState.tag&1){if(u.flags|=2048,eo(9,{destroy:void 0},sb.bind(null,u,m,l,r),null),lt===null)throw Error(i(349));v||(sn&127)!==0||tb(u,r,l)}return l}function tb(n,r,l){n.flags|=16384,n={getSnapshot:r,value:l},r=Pe.updateQueue,r===null?(r=Su(),Pe.updateQueue=r,r.stores=[n]):(l=r.stores,l===null?r.stores=[n]:l.push(n))}function sb(n,r,l,u){r.value=l,r.getSnapshot=u,nb(r)&&rb(n)}function ib(n,r,l){return l(function(){nb(r)&&rb(n)})}function nb(n){var r=n.getSnapshot;n=n.value;try{var l=r();return!js(n,l)}catch{return!0}}function rb(n){var r=Dr(n,2);r!==null&&Rs(r,n,2)}function qf(n){var r=_s();if(typeof n=="function"){var l=n;if(n=l(),Hr){Ti(!0);try{l()}finally{Ti(!1)}}}return r.memoizedState=r.baseState=n,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:nn,lastRenderedState:n},r}function ab(n,r,l,u){return n.baseState=l,Wf(n,nt,typeof u=="function"?u:nn)}function ON(n,r,l,u,m){if(Eu(n))throw Error(i(485));if(n=r.action,n!==null){var v={payload:m,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(x){v.listeners.push(x)}};O.T!==null?l(!0):v.isTransition=!1,u(v),l=r.pending,l===null?(v.next=r.pending=v,ob(r,v)):(v.next=l.next,r.pending=l.next=v)}}function ob(n,r){var l=r.action,u=r.payload,m=n.state;if(r.isTransition){var v=O.T,x={};O.T=x;try{var R=l(m,u),F=O.S;F!==null&&F(x,R),lb(n,r,R)}catch(ee){Kf(n,r,ee)}finally{v!==null&&x.types!==null&&(v.types=x.types),O.T=v}}else try{v=l(m,u),lb(n,r,v)}catch(ee){Kf(n,r,ee)}}function lb(n,r,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(u){cb(n,r,u)},function(u){return Kf(n,r,u)}):cb(n,r,l)}function cb(n,r,l){r.status="fulfilled",r.value=l,ub(r),n.state=l,r=n.pending,r!==null&&(l=r.next,l===r?n.pending=null:(l=l.next,r.next=l,ob(n,l)))}function Kf(n,r,l){var u=n.pending;if(n.pending=null,u!==null){u=u.next;do r.status="rejected",r.reason=l,ub(r),r=r.next;while(r!==u)}n.action=null}function ub(n){n=n.listeners;for(var r=0;r<n.length;r++)(0,n[r])()}function hb(n,r){return r}function db(n,r){if(Ye){var l=lt.formState;if(l!==null){e:{var u=Pe;if(Ye){if(ht){t:{for(var m=ht,v=ti;m.nodeType!==8;){if(!v){m=null;break t}if(m=ii(m.nextSibling),m===null){m=null;break t}}v=m.data,m=v==="F!"||v==="F"?m:null}if(m){ht=ii(m.nextSibling),u=m.data==="F!";break e}}jn(u)}u=!1}u&&(r=l[0])}}return l=_s(),l.memoizedState=l.baseState=r,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:hb,lastRenderedState:r},l.queue=u,l=Db.bind(null,Pe,u),u.dispatch=l,u=qf(!1),v=ep.bind(null,Pe,!1,u.queue),u=_s(),m={state:r,dispatch:null,action:n,pending:null},u.queue=m,l=ON.bind(null,Pe,m,v,l),m.dispatch=l,u.memoizedState=n,[r,l,!1]}function fb(n){var r=Tt();return pb(r,nt,n)}function pb(n,r,l){if(r=Wf(n,r,hb)[0],n=Cu(nn)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var u=yl(r)}catch(x){throw x===Ya?fu:x}else u=r;r=Tt();var m=r.queue,v=m.dispatch;return l!==r.memoizedState&&(Pe.flags|=2048,eo(9,{destroy:void 0},jN.bind(null,m,l),null)),[u,v,n]}function jN(n,r){n.action=r}function mb(n){var r=Tt(),l=nt;if(l!==null)return pb(r,l,n);Tt(),r=r.memoizedState,l=Tt();var u=l.queue.dispatch;return l.memoizedState=n,[r,u,!1]}function eo(n,r,l,u){return n={tag:n,create:l,deps:u,inst:r,next:null},r=Pe.updateQueue,r===null&&(r=Su(),Pe.updateQueue=r),l=r.lastEffect,l===null?r.lastEffect=n.next=n:(u=l.next,l.next=n,n.next=u,r.lastEffect=n),n}function gb(){return Tt().memoizedState}function xu(n,r,l,u){var m=_s();Pe.flags|=n,m.memoizedState=eo(1|r,{destroy:void 0},l,u===void 0?null:u)}function ku(n,r,l,u){var m=Tt();u=u===void 0?null:u;var v=m.memoizedState.inst;nt!==null&&u!==null&&zf(u,nt.memoizedState.deps)?m.memoizedState=eo(r,v,l,u):(Pe.flags|=n,m.memoizedState=eo(1|r,v,l,u))}function _b(n,r){xu(8390656,8,n,r)}function Yf(n,r){ku(2048,8,n,r)}function PN(n){Pe.flags|=4;var r=Pe.updateQueue;if(r===null)r=Su(),Pe.updateQueue=r,r.events=[n];else{var l=r.events;l===null?r.events=[n]:l.push(n)}}function vb(n){var r=Tt().memoizedState;return PN({ref:r,nextImpl:n}),function(){if((et&2)!==0)throw Error(i(440));return r.impl.apply(void 0,arguments)}}function yb(n,r){return ku(4,2,n,r)}function bb(n,r){return ku(4,4,n,r)}function Sb(n,r){if(typeof r=="function"){n=n();var l=r(n);return function(){typeof l=="function"?l():r(null)}}if(r!=null)return n=n(),r.current=n,function(){r.current=null}}function wb(n,r,l){l=l!=null?l.concat([n]):null,ku(4,4,Sb.bind(null,r,n),l)}function Xf(){}function Cb(n,r){var l=Tt();r=r===void 0?null:r;var u=l.memoizedState;return r!==null&&zf(r,u[1])?u[0]:(l.memoizedState=[n,r],n)}function xb(n,r){var l=Tt();r=r===void 0?null:r;var u=l.memoizedState;if(r!==null&&zf(r,u[1]))return u[0];if(u=n(),Hr){Ti(!0);try{n()}finally{Ti(!1)}}return l.memoizedState=[u,r],u}function Qf(n,r,l){return l===void 0||(sn&1073741824)!==0&&(We&261930)===0?n.memoizedState=r:(n.memoizedState=l,n=kS(),Pe.lanes|=n,Vn|=n,l)}function kb(n,r,l,u){return js(l,r)?l:Qa.current!==null?(n=Qf(n,l,u),js(n,r)||(Lt=!0),n):(sn&42)===0||(sn&1073741824)!==0&&(We&261930)===0?(Lt=!0,n.memoizedState=l):(n=kS(),Pe.lanes|=n,Vn|=n,r)}function Eb(n,r,l,u,m){var v=z.p;z.p=v!==0&&8>v?v:8;var x=O.T,R={};O.T=R,ep(n,!1,r,l);try{var F=m(),ee=O.S;if(ee!==null&&ee(R,F),F!==null&&typeof F=="object"&&typeof F.then=="function"){var ae=DN(F,u);bl(n,r,ae,Us(n))}else bl(n,r,u,Us(n))}catch(he){bl(n,r,{then:function(){},status:"rejected",reason:he},Us())}finally{z.p=v,x!==null&&R.types!==null&&(x.types=R.types),O.T=x}}function BN(){}function Zf(n,r,l,u){if(n.tag!==5)throw Error(i(476));var m=Tb(n).queue;Eb(n,m,r,Q,l===null?BN:function(){return Nb(n),l(u)})}function Tb(n){var r=n.memoizedState;if(r!==null)return r;r={memoizedState:Q,baseState:Q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:nn,lastRenderedState:Q},next:null};var l={};return r.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:nn,lastRenderedState:l},next:null},n.memoizedState=r,n=n.alternate,n!==null&&(n.memoizedState=r),r}function Nb(n){var r=Tb(n);r.next===null&&(r=n.alternate.memoizedState),bl(n,r.next.queue,{},Us())}function Jf(){return rs(Bl)}function Ab(){return Tt().memoizedState}function Rb(){return Tt().memoizedState}function IN(n){for(var r=n.return;r!==null;){switch(r.tag){case 24:case 3:var l=Us();n=In(l);var u=zn(r,n,l);u!==null&&(Rs(u,r,l),ml(u,r,l)),r={cache:Nf()},n.payload=r;return}r=r.return}}function zN(n,r,l){var u=Us();l={lane:u,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Eu(n)?Lb(r,l):(l=_f(n,r,l,u),l!==null&&(Rs(l,n,u),Mb(l,r,u)))}function Db(n,r,l){var u=Us();bl(n,r,l,u)}function bl(n,r,l,u){var m={lane:u,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(Eu(n))Lb(r,m);else{var v=n.alternate;if(n.lanes===0&&(v===null||v.lanes===0)&&(v=r.lastRenderedReducer,v!==null))try{var x=r.lastRenderedState,R=v(x,l);if(m.hasEagerState=!0,m.eagerState=R,js(R,x))return au(n,r,m,0),lt===null&&ru(),!1}catch{}finally{}if(l=_f(n,r,m,u),l!==null)return Rs(l,n,u),Mb(l,r,u),!0}return!1}function ep(n,r,l,u){if(u={lane:2,revertLane:Lp(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Eu(n)){if(r)throw Error(i(479))}else r=_f(n,l,u,2),r!==null&&Rs(r,n,2)}function Eu(n){var r=n.alternate;return n===Pe||r!==null&&r===Pe}function Lb(n,r){Za=yu=!0;var l=n.pending;l===null?r.next=r:(r.next=l.next,l.next=r),n.pending=r}function Mb(n,r,l){if((l&4194048)!==0){var u=r.lanes;u&=n.pendingLanes,l|=u,r.lanes=l,Iv(n,l)}}var Sl={readContext:rs,use:wu,useCallback:St,useContext:St,useEffect:St,useImperativeHandle:St,useLayoutEffect:St,useInsertionEffect:St,useMemo:St,useReducer:St,useRef:St,useState:St,useDebugValue:St,useDeferredValue:St,useTransition:St,useSyncExternalStore:St,useId:St,useHostTransitionStatus:St,useFormState:St,useActionState:St,useOptimistic:St,useMemoCache:St,useCacheRefresh:St};Sl.useEffectEvent=St;var Ob={readContext:rs,use:wu,useCallback:function(n,r){return _s().memoizedState=[n,r===void 0?null:r],n},useContext:rs,useEffect:_b,useImperativeHandle:function(n,r,l){l=l!=null?l.concat([n]):null,xu(4194308,4,Sb.bind(null,r,n),l)},useLayoutEffect:function(n,r){return xu(4194308,4,n,r)},useInsertionEffect:function(n,r){xu(4,2,n,r)},useMemo:function(n,r){var l=_s();r=r===void 0?null:r;var u=n();if(Hr){Ti(!0);try{n()}finally{Ti(!1)}}return l.memoizedState=[u,r],u},useReducer:function(n,r,l){var u=_s();if(l!==void 0){var m=l(r);if(Hr){Ti(!0);try{l(r)}finally{Ti(!1)}}}else m=r;return u.memoizedState=u.baseState=m,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:m},u.queue=n,n=n.dispatch=zN.bind(null,Pe,n),[u.memoizedState,n]},useRef:function(n){var r=_s();return n={current:n},r.memoizedState=n},useState:function(n){n=qf(n);var r=n.queue,l=Db.bind(null,Pe,r);return r.dispatch=l,[n.memoizedState,l]},useDebugValue:Xf,useDeferredValue:function(n,r){var l=_s();return Qf(l,n,r)},useTransition:function(){var n=qf(!1);return n=Eb.bind(null,Pe,n.queue,!0,!1),_s().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,r,l){var u=Pe,m=_s();if(Ye){if(l===void 0)throw Error(i(407));l=l()}else{if(l=r(),lt===null)throw Error(i(349));(We&127)!==0||tb(u,r,l)}m.memoizedState=l;var v={value:l,getSnapshot:r};return m.queue=v,_b(ib.bind(null,u,v,n),[n]),u.flags|=2048,eo(9,{destroy:void 0},sb.bind(null,u,v,l,r),null),l},useId:function(){var n=_s(),r=lt.identifierPrefix;if(Ye){var l=Di,u=Ri;l=(u&~(1<<32-Gt(u)-1)).toString(32)+l,r="_"+r+"R_"+l,l=bu++,0<l&&(r+="H"+l.toString(32)),r+="_"}else l=LN++,r="_"+r+"r_"+l.toString(32)+"_";return n.memoizedState=r},useHostTransitionStatus:Jf,useFormState:db,useActionState:db,useOptimistic:function(n){var r=_s();r.memoizedState=r.baseState=n;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=l,r=ep.bind(null,Pe,!0,l),l.dispatch=r,[n,r]},useMemoCache:Vf,useCacheRefresh:function(){return _s().memoizedState=IN.bind(null,Pe)},useEffectEvent:function(n){var r=_s(),l={impl:n};return r.memoizedState=l,function(){if((et&2)!==0)throw Error(i(440));return l.impl.apply(void 0,arguments)}}},tp={readContext:rs,use:wu,useCallback:Cb,useContext:rs,useEffect:Yf,useImperativeHandle:wb,useInsertionEffect:yb,useLayoutEffect:bb,useMemo:xb,useReducer:Cu,useRef:gb,useState:function(){return Cu(nn)},useDebugValue:Xf,useDeferredValue:function(n,r){var l=Tt();return kb(l,nt.memoizedState,n,r)},useTransition:function(){var n=Cu(nn)[0],r=Tt().memoizedState;return[typeof n=="boolean"?n:yl(n),r]},useSyncExternalStore:eb,useId:Ab,useHostTransitionStatus:Jf,useFormState:fb,useActionState:fb,useOptimistic:function(n,r){var l=Tt();return ab(l,nt,n,r)},useMemoCache:Vf,useCacheRefresh:Rb};tp.useEffectEvent=vb;var jb={readContext:rs,use:wu,useCallback:Cb,useContext:rs,useEffect:Yf,useImperativeHandle:wb,useInsertionEffect:yb,useLayoutEffect:bb,useMemo:xb,useReducer:Gf,useRef:gb,useState:function(){return Gf(nn)},useDebugValue:Xf,useDeferredValue:function(n,r){var l=Tt();return nt===null?Qf(l,n,r):kb(l,nt.memoizedState,n,r)},useTransition:function(){var n=Gf(nn)[0],r=Tt().memoizedState;return[typeof n=="boolean"?n:yl(n),r]},useSyncExternalStore:eb,useId:Ab,useHostTransitionStatus:Jf,useFormState:mb,useActionState:mb,useOptimistic:function(n,r){var l=Tt();return nt!==null?ab(l,nt,n,r):(l.baseState=n,[n,l.queue.dispatch])},useMemoCache:Vf,useCacheRefresh:Rb};jb.useEffectEvent=vb;function sp(n,r,l,u){r=n.memoizedState,l=l(u,r),l=l==null?r:_({},r,l),n.memoizedState=l,n.lanes===0&&(n.updateQueue.baseState=l)}var ip={enqueueSetState:function(n,r,l){n=n._reactInternals;var u=Us(),m=In(u);m.payload=r,l!=null&&(m.callback=l),r=zn(n,m,u),r!==null&&(Rs(r,n,u),ml(r,n,u))},enqueueReplaceState:function(n,r,l){n=n._reactInternals;var u=Us(),m=In(u);m.tag=1,m.payload=r,l!=null&&(m.callback=l),r=zn(n,m,u),r!==null&&(Rs(r,n,u),ml(r,n,u))},enqueueForceUpdate:function(n,r){n=n._reactInternals;var l=Us(),u=In(l);u.tag=2,r!=null&&(u.callback=r),r=zn(n,u,l),r!==null&&(Rs(r,n,l),ml(r,n,l))}};function Pb(n,r,l,u,m,v,x){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(u,v,x):r.prototype&&r.prototype.isPureReactComponent?!ol(l,u)||!ol(m,v):!0}function Bb(n,r,l,u){n=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(l,u),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(l,u),r.state!==n&&ip.enqueueReplaceState(r,r.state,null)}function Ur(n,r){var l=r;if("ref"in r){l={};for(var u in r)u!=="ref"&&(l[u]=r[u])}if(n=n.defaultProps){l===r&&(l=_({},l));for(var m in n)l[m]===void 0&&(l[m]=n[m])}return l}function Ib(n){nu(n)}function zb(n){console.error(n)}function Hb(n){nu(n)}function Tu(n,r){try{var l=n.onUncaughtError;l(r.value,{componentStack:r.stack})}catch(u){setTimeout(function(){throw u})}}function Ub(n,r,l){try{var u=n.onCaughtError;u(l.value,{componentStack:l.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function np(n,r,l){return l=In(l),l.tag=3,l.payload={element:null},l.callback=function(){Tu(n,r)},l}function Fb(n){return n=In(n),n.tag=3,n}function $b(n,r,l,u){var m=l.type.getDerivedStateFromError;if(typeof m=="function"){var v=u.value;n.payload=function(){return m(v)},n.callback=function(){Ub(r,l,u)}}var x=l.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(n.callback=function(){Ub(r,l,u),typeof m!="function"&&(Wn===null?Wn=new Set([this]):Wn.add(this));var R=u.stack;this.componentDidCatch(u.value,{componentStack:R!==null?R:""})})}function HN(n,r,l,u,m){if(l.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(r=l.alternate,r!==null&&Ga(r,l,m,!0),l=Bs.current,l!==null){switch(l.tag){case 31:case 13:return si===null?zu():l.alternate===null&&wt===0&&(wt=3),l.flags&=-257,l.flags|=65536,l.lanes=m,u===pu?l.flags|=16384:(r=l.updateQueue,r===null?l.updateQueue=new Set([u]):r.add(u),Ap(n,u,m)),!1;case 22:return l.flags|=65536,u===pu?l.flags|=16384:(r=l.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([u])},l.updateQueue=r):(l=r.retryQueue,l===null?r.retryQueue=new Set([u]):l.add(u)),Ap(n,u,m)),!1}throw Error(i(435,l.tag))}return Ap(n,u,m),zu(),!1}if(Ye)return r=Bs.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=m,u!==Cf&&(n=Error(i(422),{cause:u}),ul(Zs(n,l)))):(u!==Cf&&(r=Error(i(423),{cause:u}),ul(Zs(r,l))),n=n.current.alternate,n.flags|=65536,m&=-m,n.lanes|=m,u=Zs(u,l),m=np(n.stateNode,u,m),Of(n,m),wt!==4&&(wt=2)),!1;var v=Error(i(520),{cause:u});if(v=Zs(v,l),Al===null?Al=[v]:Al.push(v),wt!==4&&(wt=2),r===null)return!0;u=Zs(u,l),l=r;do{switch(l.tag){case 3:return l.flags|=65536,n=m&-m,l.lanes|=n,n=np(l.stateNode,u,n),Of(l,n),!1;case 1:if(r=l.type,v=l.stateNode,(l.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(Wn===null||!Wn.has(v))))return l.flags|=65536,m&=-m,l.lanes|=m,m=Fb(m),$b(m,n,l,u),Of(l,m),!1}l=l.return}while(l!==null);return!1}var rp=Error(i(461)),Lt=!1;function as(n,r,l,u){r.child=n===null?qy(r,null,l,u):zr(r,n.child,l,u)}function Vb(n,r,l,u,m){l=l.render;var v=r.ref;if("ref"in u){var x={};for(var R in u)R!=="ref"&&(x[R]=u[R])}else x=u;return jr(r),u=Hf(n,r,l,x,v,m),R=Uf(),n!==null&&!Lt?(Ff(n,r,m),rn(n,r,m)):(Ye&&R&&Sf(r),r.flags|=1,as(n,r,u,m),r.child)}function Wb(n,r,l,u,m){if(n===null){var v=l.type;return typeof v=="function"&&!vf(v)&&v.defaultProps===void 0&&l.compare===null?(r.tag=15,r.type=v,Gb(n,r,v,u,m)):(n=lu(l.type,null,u,r,r.mode,m),n.ref=r.ref,n.return=r,r.child=n)}if(v=n.child,!fp(n,m)){var x=v.memoizedProps;if(l=l.compare,l=l!==null?l:ol,l(x,u)&&n.ref===r.ref)return rn(n,r,m)}return r.flags|=1,n=Zi(v,u),n.ref=r.ref,n.return=r,r.child=n}function Gb(n,r,l,u,m){if(n!==null){var v=n.memoizedProps;if(ol(v,u)&&n.ref===r.ref)if(Lt=!1,r.pendingProps=u=v,fp(n,m))(n.flags&131072)!==0&&(Lt=!0);else return r.lanes=n.lanes,rn(n,r,m)}return ap(n,r,l,u,m)}function qb(n,r,l,u){var m=u.children,v=n!==null?n.memoizedState:null;if(n===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((r.flags&128)!==0){if(v=v!==null?v.baseLanes|l:l,n!==null){for(u=r.child=n.child,m=0;u!==null;)m=m|u.lanes|u.childLanes,u=u.sibling;u=m&~v}else u=0,r.child=null;return Kb(n,r,v,l,u)}if((l&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},n!==null&&du(r,v!==null?v.cachePool:null),v!==null?Xy(r,v):Pf(),Qy(r);else return u=r.lanes=536870912,Kb(n,r,v!==null?v.baseLanes|l:l,l,u)}else v!==null?(du(r,v.cachePool),Xy(r,v),Un(),r.memoizedState=null):(n!==null&&du(r,null),Pf(),Un());return as(n,r,m,l),r.child}function wl(n,r){return n!==null&&n.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function Kb(n,r,l,u,m){var v=Rf();return v=v===null?null:{parent:Rt._currentValue,pool:v},r.memoizedState={baseLanes:l,cachePool:v},n!==null&&du(r,null),Pf(),Qy(r),n!==null&&Ga(n,r,u,!0),r.childLanes=m,null}function Nu(n,r){return r=Ru({mode:r.mode,children:r.children},n.mode),r.ref=n.ref,n.child=r,r.return=n,r}function Yb(n,r,l){return zr(r,n.child,null,l),n=Nu(r,r.pendingProps),n.flags|=2,Is(r),r.memoizedState=null,n}function UN(n,r,l){var u=r.pendingProps,m=(r.flags&128)!==0;if(r.flags&=-129,n===null){if(Ye){if(u.mode==="hidden")return n=Nu(r,u),r.lanes=536870912,wl(null,n);if(If(r),(n=ht)?(n=o0(n,ti),n=n!==null&&n.data==="&"?n:null,n!==null&&(r.memoizedState={dehydrated:n,treeContext:Mn!==null?{id:Ri,overflow:Di}:null,retryLane:536870912,hydrationErrors:null},l=Ly(n),l.return=r,r.child=l,ns=r,ht=null)):n=null,n===null)throw jn(r);return r.lanes=536870912,null}return Nu(r,u)}var v=n.memoizedState;if(v!==null){var x=v.dehydrated;if(If(r),m)if(r.flags&256)r.flags&=-257,r=Yb(n,r,l);else if(r.memoizedState!==null)r.child=n.child,r.flags|=128,r=null;else throw Error(i(558));else if(Lt||Ga(n,r,l,!1),m=(l&n.childLanes)!==0,Lt||m){if(u=lt,u!==null&&(x=zv(u,l),x!==0&&x!==v.retryLane))throw v.retryLane=x,Dr(n,x),Rs(u,n,x),rp;zu(),r=Yb(n,r,l)}else n=v.treeContext,ht=ii(x.nextSibling),ns=r,Ye=!0,On=null,ti=!1,n!==null&&jy(r,n),r=Nu(r,u),r.flags|=4096;return r}return n=Zi(n.child,{mode:u.mode,children:u.children}),n.ref=r.ref,r.child=n,n.return=r,n}function Au(n,r){var l=r.ref;if(l===null)n!==null&&n.ref!==null&&(r.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(i(284));(n===null||n.ref!==l)&&(r.flags|=4194816)}}function ap(n,r,l,u,m){return jr(r),l=Hf(n,r,l,u,void 0,m),u=Uf(),n!==null&&!Lt?(Ff(n,r,m),rn(n,r,m)):(Ye&&u&&Sf(r),r.flags|=1,as(n,r,l,m),r.child)}function Xb(n,r,l,u,m,v){return jr(r),r.updateQueue=null,l=Jy(r,u,l,m),Zy(n),u=Uf(),n!==null&&!Lt?(Ff(n,r,v),rn(n,r,v)):(Ye&&u&&Sf(r),r.flags|=1,as(n,r,l,v),r.child)}function Qb(n,r,l,u,m){if(jr(r),r.stateNode===null){var v=Fa,x=l.contextType;typeof x=="object"&&x!==null&&(v=rs(x)),v=new l(u,v),r.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=ip,r.stateNode=v,v._reactInternals=r,v=r.stateNode,v.props=u,v.state=r.memoizedState,v.refs={},Lf(r),x=l.contextType,v.context=typeof x=="object"&&x!==null?rs(x):Fa,v.state=r.memoizedState,x=l.getDerivedStateFromProps,typeof x=="function"&&(sp(r,l,x,u),v.state=r.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(x=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),x!==v.state&&ip.enqueueReplaceState(v,v.state,null),_l(r,u,v,m),gl(),v.state=r.memoizedState),typeof v.componentDidMount=="function"&&(r.flags|=4194308),u=!0}else if(n===null){v=r.stateNode;var R=r.memoizedProps,F=Ur(l,R);v.props=F;var ee=v.context,ae=l.contextType;x=Fa,typeof ae=="object"&&ae!==null&&(x=rs(ae));var he=l.getDerivedStateFromProps;ae=typeof he=="function"||typeof v.getSnapshotBeforeUpdate=="function",R=r.pendingProps!==R,ae||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(R||ee!==x)&&Bb(r,v,u,x),Bn=!1;var te=r.memoizedState;v.state=te,_l(r,u,v,m),gl(),ee=r.memoizedState,R||te!==ee||Bn?(typeof he=="function"&&(sp(r,l,he,u),ee=r.memoizedState),(F=Bn||Pb(r,l,F,u,te,ee,x))?(ae||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"&&(r.flags|=4194308)):(typeof v.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=u,r.memoizedState=ee),v.props=u,v.state=ee,v.context=x,u=F):(typeof v.componentDidMount=="function"&&(r.flags|=4194308),u=!1)}else{v=r.stateNode,Mf(n,r),x=r.memoizedProps,ae=Ur(l,x),v.props=ae,he=r.pendingProps,te=v.context,ee=l.contextType,F=Fa,typeof ee=="object"&&ee!==null&&(F=rs(ee)),R=l.getDerivedStateFromProps,(ee=typeof R=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(x!==he||te!==F)&&Bb(r,v,u,F),Bn=!1,te=r.memoizedState,v.state=te,_l(r,u,v,m),gl();var ie=r.memoizedState;x!==he||te!==ie||Bn||n!==null&&n.dependencies!==null&&uu(n.dependencies)?(typeof R=="function"&&(sp(r,l,R,u),ie=r.memoizedState),(ae=Bn||Pb(r,l,ae,u,te,ie,F)||n!==null&&n.dependencies!==null&&uu(n.dependencies))?(ee||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(u,ie,F),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(u,ie,F)),typeof v.componentDidUpdate=="function"&&(r.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof v.componentDidUpdate!="function"||x===n.memoizedProps&&te===n.memoizedState||(r.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||x===n.memoizedProps&&te===n.memoizedState||(r.flags|=1024),r.memoizedProps=u,r.memoizedState=ie),v.props=u,v.state=ie,v.context=F,u=ae):(typeof v.componentDidUpdate!="function"||x===n.memoizedProps&&te===n.memoizedState||(r.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||x===n.memoizedProps&&te===n.memoizedState||(r.flags|=1024),u=!1)}return v=u,Au(n,r),u=(r.flags&128)!==0,v||u?(v=r.stateNode,l=u&&typeof l.getDerivedStateFromError!="function"?null:v.render(),r.flags|=1,n!==null&&u?(r.child=zr(r,n.child,null,m),r.child=zr(r,null,l,m)):as(n,r,l,m),r.memoizedState=v.state,n=r.child):n=rn(n,r,m),n}function Zb(n,r,l,u){return Mr(),r.flags|=256,as(n,r,l,u),r.child}var op={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function lp(n){return{baseLanes:n,cachePool:Uy()}}function cp(n,r,l){return n=n!==null?n.childLanes&~l:0,r&&(n|=Hs),n}function Jb(n,r,l){var u=r.pendingProps,m=!1,v=(r.flags&128)!==0,x;if((x=v)||(x=n!==null&&n.memoizedState===null?!1:(Et.current&2)!==0),x&&(m=!0,r.flags&=-129),x=(r.flags&32)!==0,r.flags&=-33,n===null){if(Ye){if(m?Hn(r):Un(),(n=ht)?(n=o0(n,ti),n=n!==null&&n.data!=="&"?n:null,n!==null&&(r.memoizedState={dehydrated:n,treeContext:Mn!==null?{id:Ri,overflow:Di}:null,retryLane:536870912,hydrationErrors:null},l=Ly(n),l.return=r,r.child=l,ns=r,ht=null)):n=null,n===null)throw jn(r);return Wp(n)?r.lanes=32:r.lanes=536870912,null}var R=u.children;return u=u.fallback,m?(Un(),m=r.mode,R=Ru({mode:"hidden",children:R},m),u=Lr(u,m,l,null),R.return=r,u.return=r,R.sibling=u,r.child=R,u=r.child,u.memoizedState=lp(l),u.childLanes=cp(n,x,l),r.memoizedState=op,wl(null,u)):(Hn(r),up(r,R))}var F=n.memoizedState;if(F!==null&&(R=F.dehydrated,R!==null)){if(v)r.flags&256?(Hn(r),r.flags&=-257,r=hp(n,r,l)):r.memoizedState!==null?(Un(),r.child=n.child,r.flags|=128,r=null):(Un(),R=u.fallback,m=r.mode,u=Ru({mode:"visible",children:u.children},m),R=Lr(R,m,l,null),R.flags|=2,u.return=r,R.return=r,u.sibling=R,r.child=u,zr(r,n.child,null,l),u=r.child,u.memoizedState=lp(l),u.childLanes=cp(n,x,l),r.memoizedState=op,r=wl(null,u));else if(Hn(r),Wp(R)){if(x=R.nextSibling&&R.nextSibling.dataset,x)var ee=x.dgst;x=ee,u=Error(i(419)),u.stack="",u.digest=x,ul({value:u,source:null,stack:null}),r=hp(n,r,l)}else if(Lt||Ga(n,r,l,!1),x=(l&n.childLanes)!==0,Lt||x){if(x=lt,x!==null&&(u=zv(x,l),u!==0&&u!==F.retryLane))throw F.retryLane=u,Dr(n,u),Rs(x,n,u),rp;Vp(R)||zu(),r=hp(n,r,l)}else Vp(R)?(r.flags|=192,r.child=n.child,r=null):(n=F.treeContext,ht=ii(R.nextSibling),ns=r,Ye=!0,On=null,ti=!1,n!==null&&jy(r,n),r=up(r,u.children),r.flags|=4096);return r}return m?(Un(),R=u.fallback,m=r.mode,F=n.child,ee=F.sibling,u=Zi(F,{mode:"hidden",children:u.children}),u.subtreeFlags=F.subtreeFlags&65011712,ee!==null?R=Zi(ee,R):(R=Lr(R,m,l,null),R.flags|=2),R.return=r,u.return=r,u.sibling=R,r.child=u,wl(null,u),u=r.child,R=n.child.memoizedState,R===null?R=lp(l):(m=R.cachePool,m!==null?(F=Rt._currentValue,m=m.parent!==F?{parent:F,pool:F}:m):m=Uy(),R={baseLanes:R.baseLanes|l,cachePool:m}),u.memoizedState=R,u.childLanes=cp(n,x,l),r.memoizedState=op,wl(n.child,u)):(Hn(r),l=n.child,n=l.sibling,l=Zi(l,{mode:"visible",children:u.children}),l.return=r,l.sibling=null,n!==null&&(x=r.deletions,x===null?(r.deletions=[n],r.flags|=16):x.push(n)),r.child=l,r.memoizedState=null,l)}function up(n,r){return r=Ru({mode:"visible",children:r},n.mode),r.return=n,n.child=r}function Ru(n,r){return n=Ps(22,n,null,r),n.lanes=0,n}function hp(n,r,l){return zr(r,n.child,null,l),n=up(r,r.pendingProps.children),n.flags|=2,r.memoizedState=null,n}function eS(n,r,l){n.lanes|=r;var u=n.alternate;u!==null&&(u.lanes|=r),Ef(n.return,r,l)}function dp(n,r,l,u,m,v){var x=n.memoizedState;x===null?n.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:u,tail:l,tailMode:m,treeForkCount:v}:(x.isBackwards=r,x.rendering=null,x.renderingStartTime=0,x.last=u,x.tail=l,x.tailMode=m,x.treeForkCount=v)}function tS(n,r,l){var u=r.pendingProps,m=u.revealOrder,v=u.tail;u=u.children;var x=Et.current,R=(x&2)!==0;if(R?(x=x&1|2,r.flags|=128):x&=1,q(Et,x),as(n,r,u,l),u=Ye?cl:0,!R&&n!==null&&(n.flags&128)!==0)e:for(n=r.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&eS(n,l,r);else if(n.tag===19)eS(n,l,r);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===r)break e;for(;n.sibling===null;){if(n.return===null||n.return===r)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(m){case"forwards":for(l=r.child,m=null;l!==null;)n=l.alternate,n!==null&&vu(n)===null&&(m=l),l=l.sibling;l=m,l===null?(m=r.child,r.child=null):(m=l.sibling,l.sibling=null),dp(r,!1,m,l,v,u);break;case"backwards":case"unstable_legacy-backwards":for(l=null,m=r.child,r.child=null;m!==null;){if(n=m.alternate,n!==null&&vu(n)===null){r.child=m;break}n=m.sibling,m.sibling=l,l=m,m=n}dp(r,!0,l,null,v,u);break;case"together":dp(r,!1,null,null,void 0,u);break;default:r.memoizedState=null}return r.child}function rn(n,r,l){if(n!==null&&(r.dependencies=n.dependencies),Vn|=r.lanes,(l&r.childLanes)===0)if(n!==null){if(Ga(n,r,l,!1),(l&r.childLanes)===0)return null}else return null;if(n!==null&&r.child!==n.child)throw Error(i(153));if(r.child!==null){for(n=r.child,l=Zi(n,n.pendingProps),r.child=l,l.return=r;n.sibling!==null;)n=n.sibling,l=l.sibling=Zi(n,n.pendingProps),l.return=r;l.sibling=null}return r.child}function fp(n,r){return(n.lanes&r)!==0?!0:(n=n.dependencies,!!(n!==null&&uu(n)))}function FN(n,r,l){switch(r.tag){case 3:ze(r,r.stateNode.containerInfo),Pn(r,Rt,n.memoizedState.cache),Mr();break;case 27:case 5:le(r);break;case 4:ze(r,r.stateNode.containerInfo);break;case 10:Pn(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,If(r),null;break;case 13:var u=r.memoizedState;if(u!==null)return u.dehydrated!==null?(Hn(r),r.flags|=128,null):(l&r.child.childLanes)!==0?Jb(n,r,l):(Hn(r),n=rn(n,r,l),n!==null?n.sibling:null);Hn(r);break;case 19:var m=(n.flags&128)!==0;if(u=(l&r.childLanes)!==0,u||(Ga(n,r,l,!1),u=(l&r.childLanes)!==0),m){if(u)return tS(n,r,l);r.flags|=128}if(m=r.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),q(Et,Et.current),u)break;return null;case 22:return r.lanes=0,qb(n,r,l,r.pendingProps);case 24:Pn(r,Rt,n.memoizedState.cache)}return rn(n,r,l)}function sS(n,r,l){if(n!==null)if(n.memoizedProps!==r.pendingProps)Lt=!0;else{if(!fp(n,l)&&(r.flags&128)===0)return Lt=!1,FN(n,r,l);Lt=(n.flags&131072)!==0}else Lt=!1,Ye&&(r.flags&1048576)!==0&&Oy(r,cl,r.index);switch(r.lanes=0,r.tag){case 16:e:{var u=r.pendingProps;if(n=Br(r.elementType),r.type=n,typeof n=="function")vf(n)?(u=Ur(n,u),r.tag=1,r=Qb(null,r,n,u,l)):(r.tag=0,r=ap(null,r,n,u,l));else{if(n!=null){var m=n.$$typeof;if(m===E){r.tag=11,r=Vb(null,r,n,u,l);break e}else if(m===W){r.tag=14,r=Wb(null,r,n,u,l);break e}}throw r=j(n)||n,Error(i(306,r,""))}}return r;case 0:return ap(n,r,r.type,r.pendingProps,l);case 1:return u=r.type,m=Ur(u,r.pendingProps),Qb(n,r,u,m,l);case 3:e:{if(ze(r,r.stateNode.containerInfo),n===null)throw Error(i(387));u=r.pendingProps;var v=r.memoizedState;m=v.element,Mf(n,r),_l(r,u,null,l);var x=r.memoizedState;if(u=x.cache,Pn(r,Rt,u),u!==v.cache&&Tf(r,[Rt],l,!0),gl(),u=x.element,v.isDehydrated)if(v={element:u,isDehydrated:!1,cache:x.cache},r.updateQueue.baseState=v,r.memoizedState=v,r.flags&256){r=Zb(n,r,u,l);break e}else if(u!==m){m=Zs(Error(i(424)),r),ul(m),r=Zb(n,r,u,l);break e}else{switch(n=r.stateNode.containerInfo,n.nodeType){case 9:n=n.body;break;default:n=n.nodeName==="HTML"?n.ownerDocument.body:n}for(ht=ii(n.firstChild),ns=r,Ye=!0,On=null,ti=!0,l=qy(r,null,u,l),r.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(Mr(),u===m){r=rn(n,r,l);break e}as(n,r,u,l)}r=r.child}return r;case 26:return Au(n,r),n===null?(l=f0(r.type,null,r.pendingProps,null))?r.memoizedState=l:Ye||(l=r.type,n=r.pendingProps,u=Gu(Se.current).createElement(l),u[is]=r,u[xs]=n,os(u,l,n),qt(u),r.stateNode=u):r.memoizedState=f0(r.type,n.memoizedProps,r.pendingProps,n.memoizedState),null;case 27:return le(r),n===null&&Ye&&(u=r.stateNode=u0(r.type,r.pendingProps,Se.current),ns=r,ti=!0,m=ht,Yn(r.type)?(Gp=m,ht=ii(u.firstChild)):ht=m),as(n,r,r.pendingProps.children,l),Au(n,r),n===null&&(r.flags|=4194304),r.child;case 5:return n===null&&Ye&&((m=u=ht)&&(u=vA(u,r.type,r.pendingProps,ti),u!==null?(r.stateNode=u,ns=r,ht=ii(u.firstChild),ti=!1,m=!0):m=!1),m||jn(r)),le(r),m=r.type,v=r.pendingProps,x=n!==null?n.memoizedProps:null,u=v.children,Up(m,v)?u=null:x!==null&&Up(m,x)&&(r.flags|=32),r.memoizedState!==null&&(m=Hf(n,r,MN,null,null,l),Bl._currentValue=m),Au(n,r),as(n,r,u,l),r.child;case 6:return n===null&&Ye&&((n=l=ht)&&(l=yA(l,r.pendingProps,ti),l!==null?(r.stateNode=l,ns=r,ht=null,n=!0):n=!1),n||jn(r)),null;case 13:return Jb(n,r,l);case 4:return ze(r,r.stateNode.containerInfo),u=r.pendingProps,n===null?r.child=zr(r,null,u,l):as(n,r,u,l),r.child;case 11:return Vb(n,r,r.type,r.pendingProps,l);case 7:return as(n,r,r.pendingProps,l),r.child;case 8:return as(n,r,r.pendingProps.children,l),r.child;case 12:return as(n,r,r.pendingProps.children,l),r.child;case 10:return u=r.pendingProps,Pn(r,r.type,u.value),as(n,r,u.children,l),r.child;case 9:return m=r.type._context,u=r.pendingProps.children,jr(r),m=rs(m),u=u(m),r.flags|=1,as(n,r,u,l),r.child;case 14:return Wb(n,r,r.type,r.pendingProps,l);case 15:return Gb(n,r,r.type,r.pendingProps,l);case 19:return tS(n,r,l);case 31:return UN(n,r,l);case 22:return qb(n,r,l,r.pendingProps);case 24:return jr(r),u=rs(Rt),n===null?(m=Rf(),m===null&&(m=lt,v=Nf(),m.pooledCache=v,v.refCount++,v!==null&&(m.pooledCacheLanes|=l),m=v),r.memoizedState={parent:u,cache:m},Lf(r),Pn(r,Rt,m)):((n.lanes&l)!==0&&(Mf(n,r),_l(r,null,null,l),gl()),m=n.memoizedState,v=r.memoizedState,m.parent!==u?(m={parent:u,cache:u},r.memoizedState=m,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=m),Pn(r,Rt,u)):(u=v.cache,Pn(r,Rt,u),u!==m.cache&&Tf(r,[Rt],l,!0))),as(n,r,r.pendingProps.children,l),r.child;case 29:throw r.pendingProps}throw Error(i(156,r.tag))}function an(n){n.flags|=4}function pp(n,r,l,u,m){if((r=(n.mode&32)!==0)&&(r=!1),r){if(n.flags|=16777216,(m&335544128)===m)if(n.stateNode.complete)n.flags|=8192;else if(AS())n.flags|=8192;else throw Ir=pu,Df}else n.flags&=-16777217}function iS(n,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!v0(r))if(AS())n.flags|=8192;else throw Ir=pu,Df}function Du(n,r){r!==null&&(n.flags|=4),n.flags&16384&&(r=n.tag!==22?Pv():536870912,n.lanes|=r,no|=r)}function Cl(n,r){if(!Ye)switch(n.tailMode){case"hidden":r=n.tail;for(var l=null;r!==null;)r.alternate!==null&&(l=r),r=r.sibling;l===null?n.tail=null:l.sibling=null;break;case"collapsed":l=n.tail;for(var u=null;l!==null;)l.alternate!==null&&(u=l),l=l.sibling;u===null?r||n.tail===null?n.tail=null:n.tail.sibling=null:u.sibling=null}}function dt(n){var r=n.alternate!==null&&n.alternate.child===n.child,l=0,u=0;if(r)for(var m=n.child;m!==null;)l|=m.lanes|m.childLanes,u|=m.subtreeFlags&65011712,u|=m.flags&65011712,m.return=n,m=m.sibling;else for(m=n.child;m!==null;)l|=m.lanes|m.childLanes,u|=m.subtreeFlags,u|=m.flags,m.return=n,m=m.sibling;return n.subtreeFlags|=u,n.childLanes=l,r}function $N(n,r,l){var u=r.pendingProps;switch(wf(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return dt(r),null;case 1:return dt(r),null;case 3:return l=r.stateNode,u=null,n!==null&&(u=n.memoizedState.cache),r.memoizedState.cache!==u&&(r.flags|=2048),tn(Rt),De(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(n===null||n.child===null)&&(Wa(r)?an(r):n===null||n.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,xf())),dt(r),null;case 26:var m=r.type,v=r.memoizedState;return n===null?(an(r),v!==null?(dt(r),iS(r,v)):(dt(r),pp(r,m,null,u,l))):v?v!==n.memoizedState?(an(r),dt(r),iS(r,v)):(dt(r),r.flags&=-16777217):(n=n.memoizedProps,n!==u&&an(r),dt(r),pp(r,m,n,u,l)),null;case 27:if(Ee(r),l=Se.current,m=r.type,n!==null&&r.stateNode!=null)n.memoizedProps!==u&&an(r);else{if(!u){if(r.stateNode===null)throw Error(i(166));return dt(r),null}n=oe.current,Wa(r)?Py(r):(n=u0(m,u,l),r.stateNode=n,an(r))}return dt(r),null;case 5:if(Ee(r),m=r.type,n!==null&&r.stateNode!=null)n.memoizedProps!==u&&an(r);else{if(!u){if(r.stateNode===null)throw Error(i(166));return dt(r),null}if(v=oe.current,Wa(r))Py(r);else{var x=Gu(Se.current);switch(v){case 1:v=x.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:v=x.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":v=x.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":v=x.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;case"script":v=x.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof u.is=="string"?x.createElement("select",{is:u.is}):x.createElement("select"),u.multiple?v.multiple=!0:u.size&&(v.size=u.size);break;default:v=typeof u.is=="string"?x.createElement(m,{is:u.is}):x.createElement(m)}}v[is]=r,v[xs]=u;e:for(x=r.child;x!==null;){if(x.tag===5||x.tag===6)v.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===r)break e;for(;x.sibling===null;){if(x.return===null||x.return===r)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}r.stateNode=v;e:switch(os(v,m,u),m){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&an(r)}}return dt(r),pp(r,r.type,n===null?null:n.memoizedProps,r.pendingProps,l),null;case 6:if(n&&r.stateNode!=null)n.memoizedProps!==u&&an(r);else{if(typeof u!="string"&&r.stateNode===null)throw Error(i(166));if(n=Se.current,Wa(r)){if(n=r.stateNode,l=r.memoizedProps,u=null,m=ns,m!==null)switch(m.tag){case 27:case 5:u=m.memoizedProps}n[is]=r,n=!!(n.nodeValue===l||u!==null&&u.suppressHydrationWarning===!0||JS(n.nodeValue,l)),n||jn(r,!0)}else n=Gu(n).createTextNode(u),n[is]=r,r.stateNode=n}return dt(r),null;case 31:if(l=r.memoizedState,n===null||n.memoizedState!==null){if(u=Wa(r),l!==null){if(n===null){if(!u)throw Error(i(318));if(n=r.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(i(557));n[is]=r}else Mr(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;dt(r),n=!1}else l=xf(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=l),n=!0;if(!n)return r.flags&256?(Is(r),r):(Is(r),null);if((r.flags&128)!==0)throw Error(i(558))}return dt(r),null;case 13:if(u=r.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(m=Wa(r),u!==null&&u.dehydrated!==null){if(n===null){if(!m)throw Error(i(318));if(m=r.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(i(317));m[is]=r}else Mr(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;dt(r),m=!1}else m=xf(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=m),m=!0;if(!m)return r.flags&256?(Is(r),r):(Is(r),null)}return Is(r),(r.flags&128)!==0?(r.lanes=l,r):(l=u!==null,n=n!==null&&n.memoizedState!==null,l&&(u=r.child,m=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(m=u.alternate.memoizedState.cachePool.pool),v=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(v=u.memoizedState.cachePool.pool),v!==m&&(u.flags|=2048)),l!==n&&l&&(r.child.flags|=8192),Du(r,r.updateQueue),dt(r),null);case 4:return De(),n===null&&Pp(r.stateNode.containerInfo),dt(r),null;case 10:return tn(r.type),dt(r),null;case 19:if(I(Et),u=r.memoizedState,u===null)return dt(r),null;if(m=(r.flags&128)!==0,v=u.rendering,v===null)if(m)Cl(u,!1);else{if(wt!==0||n!==null&&(n.flags&128)!==0)for(n=r.child;n!==null;){if(v=vu(n),v!==null){for(r.flags|=128,Cl(u,!1),n=v.updateQueue,r.updateQueue=n,Du(r,n),r.subtreeFlags=0,n=l,l=r.child;l!==null;)Dy(l,n),l=l.sibling;return q(Et,Et.current&1|2),Ye&&Ji(r,u.treeForkCount),r.child}n=n.sibling}u.tail!==null&&bt()>Pu&&(r.flags|=128,m=!0,Cl(u,!1),r.lanes=4194304)}else{if(!m)if(n=vu(v),n!==null){if(r.flags|=128,m=!0,n=n.updateQueue,r.updateQueue=n,Du(r,n),Cl(u,!0),u.tail===null&&u.tailMode==="hidden"&&!v.alternate&&!Ye)return dt(r),null}else 2*bt()-u.renderingStartTime>Pu&&l!==536870912&&(r.flags|=128,m=!0,Cl(u,!1),r.lanes=4194304);u.isBackwards?(v.sibling=r.child,r.child=v):(n=u.last,n!==null?n.sibling=v:r.child=v,u.last=v)}return u.tail!==null?(n=u.tail,u.rendering=n,u.tail=n.sibling,u.renderingStartTime=bt(),n.sibling=null,l=Et.current,q(Et,m?l&1|2:l&1),Ye&&Ji(r,u.treeForkCount),n):(dt(r),null);case 22:case 23:return Is(r),Bf(),u=r.memoizedState!==null,n!==null?n.memoizedState!==null!==u&&(r.flags|=8192):u&&(r.flags|=8192),u?(l&536870912)!==0&&(r.flags&128)===0&&(dt(r),r.subtreeFlags&6&&(r.flags|=8192)):dt(r),l=r.updateQueue,l!==null&&Du(r,l.retryQueue),l=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(l=n.memoizedState.cachePool.pool),u=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(u=r.memoizedState.cachePool.pool),u!==l&&(r.flags|=2048),n!==null&&I(Pr),null;case 24:return l=null,n!==null&&(l=n.memoizedState.cache),r.memoizedState.cache!==l&&(r.flags|=2048),tn(Rt),dt(r),null;case 25:return null;case 30:return null}throw Error(i(156,r.tag))}function VN(n,r){switch(wf(r),r.tag){case 1:return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 3:return tn(Rt),De(),n=r.flags,(n&65536)!==0&&(n&128)===0?(r.flags=n&-65537|128,r):null;case 26:case 27:case 5:return Ee(r),null;case 31:if(r.memoizedState!==null){if(Is(r),r.alternate===null)throw Error(i(340));Mr()}return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 13:if(Is(r),n=r.memoizedState,n!==null&&n.dehydrated!==null){if(r.alternate===null)throw Error(i(340));Mr()}return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 19:return I(Et),null;case 4:return De(),null;case 10:return tn(r.type),null;case 22:case 23:return Is(r),Bf(),n!==null&&I(Pr),n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 24:return tn(Rt),null;case 25:return null;default:return null}}function nS(n,r){switch(wf(r),r.tag){case 3:tn(Rt),De();break;case 26:case 27:case 5:Ee(r);break;case 4:De();break;case 31:r.memoizedState!==null&&Is(r);break;case 13:Is(r);break;case 19:I(Et);break;case 10:tn(r.type);break;case 22:case 23:Is(r),Bf(),n!==null&&I(Pr);break;case 24:tn(Rt)}}function xl(n,r){try{var l=r.updateQueue,u=l!==null?l.lastEffect:null;if(u!==null){var m=u.next;l=m;do{if((l.tag&n)===n){u=void 0;var v=l.create,x=l.inst;u=v(),x.destroy=u}l=l.next}while(l!==m)}}catch(R){it(r,r.return,R)}}function Fn(n,r,l){try{var u=r.updateQueue,m=u!==null?u.lastEffect:null;if(m!==null){var v=m.next;u=v;do{if((u.tag&n)===n){var x=u.inst,R=x.destroy;if(R!==void 0){x.destroy=void 0,m=r;var F=l,ee=R;try{ee()}catch(ae){it(m,F,ae)}}}u=u.next}while(u!==v)}}catch(ae){it(r,r.return,ae)}}function rS(n){var r=n.updateQueue;if(r!==null){var l=n.stateNode;try{Yy(r,l)}catch(u){it(n,n.return,u)}}}function aS(n,r,l){l.props=Ur(n.type,n.memoizedProps),l.state=n.memoizedState;try{l.componentWillUnmount()}catch(u){it(n,r,u)}}function kl(n,r){try{var l=n.ref;if(l!==null){switch(n.tag){case 26:case 27:case 5:var u=n.stateNode;break;case 30:u=n.stateNode;break;default:u=n.stateNode}typeof l=="function"?n.refCleanup=l(u):l.current=u}}catch(m){it(n,r,m)}}function Li(n,r){var l=n.ref,u=n.refCleanup;if(l!==null)if(typeof u=="function")try{u()}catch(m){it(n,r,m)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(m){it(n,r,m)}else l.current=null}function oS(n){var r=n.type,l=n.memoizedProps,u=n.stateNode;try{e:switch(r){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(m){it(n,n.return,m)}}function mp(n,r,l){try{var u=n.stateNode;dA(u,n.type,l,r),u[xs]=r}catch(m){it(n,n.return,m)}}function lS(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Yn(n.type)||n.tag===4}function gp(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||lS(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&Yn(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function _p(n,r,l){var u=n.tag;if(u===5||u===6)n=n.stateNode,r?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(n,r):(r=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,r.appendChild(n),l=l._reactRootContainer,l!=null||r.onclick!==null||(r.onclick=Xi));else if(u!==4&&(u===27&&Yn(n.type)&&(l=n.stateNode,r=null),n=n.child,n!==null))for(_p(n,r,l),n=n.sibling;n!==null;)_p(n,r,l),n=n.sibling}function Lu(n,r,l){var u=n.tag;if(u===5||u===6)n=n.stateNode,r?l.insertBefore(n,r):l.appendChild(n);else if(u!==4&&(u===27&&Yn(n.type)&&(l=n.stateNode),n=n.child,n!==null))for(Lu(n,r,l),n=n.sibling;n!==null;)Lu(n,r,l),n=n.sibling}function cS(n){var r=n.stateNode,l=n.memoizedProps;try{for(var u=n.type,m=r.attributes;m.length;)r.removeAttributeNode(m[0]);os(r,u,l),r[is]=n,r[xs]=l}catch(v){it(n,n.return,v)}}var on=!1,Mt=!1,vp=!1,uS=typeof WeakSet=="function"?WeakSet:Set,Kt=null;function WN(n,r){if(n=n.containerInfo,zp=Ju,n=wy(n),hf(n)){if("selectionStart"in n)var l={start:n.selectionStart,end:n.selectionEnd};else e:{l=(l=n.ownerDocument)&&l.defaultView||window;var u=l.getSelection&&l.getSelection();if(u&&u.rangeCount!==0){l=u.anchorNode;var m=u.anchorOffset,v=u.focusNode;u=u.focusOffset;try{l.nodeType,v.nodeType}catch{l=null;break e}var x=0,R=-1,F=-1,ee=0,ae=0,he=n,te=null;t:for(;;){for(var ie;he!==l||m!==0&&he.nodeType!==3||(R=x+m),he!==v||u!==0&&he.nodeType!==3||(F=x+u),he.nodeType===3&&(x+=he.nodeValue.length),(ie=he.firstChild)!==null;)te=he,he=ie;for(;;){if(he===n)break t;if(te===l&&++ee===m&&(R=x),te===v&&++ae===u&&(F=x),(ie=he.nextSibling)!==null)break;he=te,te=he.parentNode}he=ie}l=R===-1||F===-1?null:{start:R,end:F}}else l=null}l=l||{start:0,end:0}}else l=null;for(Hp={focusedElem:n,selectionRange:l},Ju=!1,Kt=r;Kt!==null;)if(r=Kt,n=r.child,(r.subtreeFlags&1028)!==0&&n!==null)n.return=r,Kt=n;else for(;Kt!==null;){switch(r=Kt,v=r.alternate,n=r.flags,r.tag){case 0:if((n&4)!==0&&(n=r.updateQueue,n=n!==null?n.events:null,n!==null))for(l=0;l<n.length;l++)m=n[l],m.ref.impl=m.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&v!==null){n=void 0,l=r,m=v.memoizedProps,v=v.memoizedState,u=l.stateNode;try{var Ce=Ur(l.type,m);n=u.getSnapshotBeforeUpdate(Ce,v),u.__reactInternalSnapshotBeforeUpdate=n}catch(Ae){it(l,l.return,Ae)}}break;case 3:if((n&1024)!==0){if(n=r.stateNode.containerInfo,l=n.nodeType,l===9)$p(n);else if(l===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":$p(n);break;default:n.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((n&1024)!==0)throw Error(i(163))}if(n=r.sibling,n!==null){n.return=r.return,Kt=n;break}Kt=r.return}}function hS(n,r,l){var u=l.flags;switch(l.tag){case 0:case 11:case 15:cn(n,l),u&4&&xl(5,l);break;case 1:if(cn(n,l),u&4)if(n=l.stateNode,r===null)try{n.componentDidMount()}catch(x){it(l,l.return,x)}else{var m=Ur(l.type,r.memoizedProps);r=r.memoizedState;try{n.componentDidUpdate(m,r,n.__reactInternalSnapshotBeforeUpdate)}catch(x){it(l,l.return,x)}}u&64&&rS(l),u&512&&kl(l,l.return);break;case 3:if(cn(n,l),u&64&&(n=l.updateQueue,n!==null)){if(r=null,l.child!==null)switch(l.child.tag){case 27:case 5:r=l.child.stateNode;break;case 1:r=l.child.stateNode}try{Yy(n,r)}catch(x){it(l,l.return,x)}}break;case 27:r===null&&u&4&&cS(l);case 26:case 5:cn(n,l),r===null&&u&4&&oS(l),u&512&&kl(l,l.return);break;case 12:cn(n,l);break;case 31:cn(n,l),u&4&&pS(n,l);break;case 13:cn(n,l),u&4&&mS(n,l),u&64&&(n=l.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(l=eA.bind(null,l),bA(n,l))));break;case 22:if(u=l.memoizedState!==null||on,!u){r=r!==null&&r.memoizedState!==null||Mt,m=on;var v=Mt;on=u,(Mt=r)&&!v?un(n,l,(l.subtreeFlags&8772)!==0):cn(n,l),on=m,Mt=v}break;case 30:break;default:cn(n,l)}}function dS(n){var r=n.alternate;r!==null&&(n.alternate=null,dS(r)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(r=n.stateNode,r!==null&&qd(r)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var mt=null,Es=!1;function ln(n,r,l){for(l=l.child;l!==null;)fS(n,r,l),l=l.sibling}function fS(n,r,l){if(gs&&typeof gs.onCommitFiberUnmount=="function")try{gs.onCommitFiberUnmount(Er,l)}catch{}switch(l.tag){case 26:Mt||Li(l,r),ln(n,r,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:Mt||Li(l,r);var u=mt,m=Es;Yn(l.type)&&(mt=l.stateNode,Es=!1),ln(n,r,l),Ol(l.stateNode),mt=u,Es=m;break;case 5:Mt||Li(l,r);case 6:if(u=mt,m=Es,mt=null,ln(n,r,l),mt=u,Es=m,mt!==null)if(Es)try{(mt.nodeType===9?mt.body:mt.nodeName==="HTML"?mt.ownerDocument.body:mt).removeChild(l.stateNode)}catch(v){it(l,r,v)}else try{mt.removeChild(l.stateNode)}catch(v){it(l,r,v)}break;case 18:mt!==null&&(Es?(n=mt,r0(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,l.stateNode),fo(n)):r0(mt,l.stateNode));break;case 4:u=mt,m=Es,mt=l.stateNode.containerInfo,Es=!0,ln(n,r,l),mt=u,Es=m;break;case 0:case 11:case 14:case 15:Fn(2,l,r),Mt||Fn(4,l,r),ln(n,r,l);break;case 1:Mt||(Li(l,r),u=l.stateNode,typeof u.componentWillUnmount=="function"&&aS(l,r,u)),ln(n,r,l);break;case 21:ln(n,r,l);break;case 22:Mt=(u=Mt)||l.memoizedState!==null,ln(n,r,l),Mt=u;break;default:ln(n,r,l)}}function pS(n,r){if(r.memoizedState===null&&(n=r.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{fo(n)}catch(l){it(r,r.return,l)}}}function mS(n,r){if(r.memoizedState===null&&(n=r.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{fo(n)}catch(l){it(r,r.return,l)}}function GN(n){switch(n.tag){case 31:case 13:case 19:var r=n.stateNode;return r===null&&(r=n.stateNode=new uS),r;case 22:return n=n.stateNode,r=n._retryCache,r===null&&(r=n._retryCache=new uS),r;default:throw Error(i(435,n.tag))}}function Mu(n,r){var l=GN(n);r.forEach(function(u){if(!l.has(u)){l.add(u);var m=tA.bind(null,n,u);u.then(m,m)}})}function Ts(n,r){var l=r.deletions;if(l!==null)for(var u=0;u<l.length;u++){var m=l[u],v=n,x=r,R=x;e:for(;R!==null;){switch(R.tag){case 27:if(Yn(R.type)){mt=R.stateNode,Es=!1;break e}break;case 5:mt=R.stateNode,Es=!1;break e;case 3:case 4:mt=R.stateNode.containerInfo,Es=!0;break e}R=R.return}if(mt===null)throw Error(i(160));fS(v,x,m),mt=null,Es=!1,v=m.alternate,v!==null&&(v.return=null),m.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)gS(r,n),r=r.sibling}var yi=null;function gS(n,r){var l=n.alternate,u=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:Ts(r,n),Ns(n),u&4&&(Fn(3,n,n.return),xl(3,n),Fn(5,n,n.return));break;case 1:Ts(r,n),Ns(n),u&512&&(Mt||l===null||Li(l,l.return)),u&64&&on&&(n=n.updateQueue,n!==null&&(u=n.callbacks,u!==null&&(l=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=l===null?u:l.concat(u))));break;case 26:var m=yi;if(Ts(r,n),Ns(n),u&512&&(Mt||l===null||Li(l,l.return)),u&4){var v=l!==null?l.memoizedState:null;if(u=n.memoizedState,l===null)if(u===null)if(n.stateNode===null){e:{u=n.type,l=n.memoizedProps,m=m.ownerDocument||m;t:switch(u){case"title":v=m.getElementsByTagName("title")[0],(!v||v[Zo]||v[is]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=m.createElement(u),m.head.insertBefore(v,m.querySelector("head > title"))),os(v,u,l),v[is]=n,qt(v),u=v;break e;case"link":var x=g0("link","href",m).get(u+(l.href||""));if(x){for(var R=0;R<x.length;R++)if(v=x[R],v.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&v.getAttribute("rel")===(l.rel==null?null:l.rel)&&v.getAttribute("title")===(l.title==null?null:l.title)&&v.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){x.splice(R,1);break t}}v=m.createElement(u),os(v,u,l),m.head.appendChild(v);break;case"meta":if(x=g0("meta","content",m).get(u+(l.content||""))){for(R=0;R<x.length;R++)if(v=x[R],v.getAttribute("content")===(l.content==null?null:""+l.content)&&v.getAttribute("name")===(l.name==null?null:l.name)&&v.getAttribute("property")===(l.property==null?null:l.property)&&v.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&v.getAttribute("charset")===(l.charSet==null?null:l.charSet)){x.splice(R,1);break t}}v=m.createElement(u),os(v,u,l),m.head.appendChild(v);break;default:throw Error(i(468,u))}v[is]=n,qt(v),u=v}n.stateNode=u}else _0(m,n.type,n.stateNode);else n.stateNode=m0(m,u,n.memoizedProps);else v!==u?(v===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):v.count--,u===null?_0(m,n.type,n.stateNode):m0(m,u,n.memoizedProps)):u===null&&n.stateNode!==null&&mp(n,n.memoizedProps,l.memoizedProps)}break;case 27:Ts(r,n),Ns(n),u&512&&(Mt||l===null||Li(l,l.return)),l!==null&&u&4&&mp(n,n.memoizedProps,l.memoizedProps);break;case 5:if(Ts(r,n),Ns(n),u&512&&(Mt||l===null||Li(l,l.return)),n.flags&32){m=n.stateNode;try{ja(m,"")}catch(Ce){it(n,n.return,Ce)}}u&4&&n.stateNode!=null&&(m=n.memoizedProps,mp(n,m,l!==null?l.memoizedProps:m)),u&1024&&(vp=!0);break;case 6:if(Ts(r,n),Ns(n),u&4){if(n.stateNode===null)throw Error(i(162));u=n.memoizedProps,l=n.stateNode;try{l.nodeValue=u}catch(Ce){it(n,n.return,Ce)}}break;case 3:if(Yu=null,m=yi,yi=qu(r.containerInfo),Ts(r,n),yi=m,Ns(n),u&4&&l!==null&&l.memoizedState.isDehydrated)try{fo(r.containerInfo)}catch(Ce){it(n,n.return,Ce)}vp&&(vp=!1,_S(n));break;case 4:u=yi,yi=qu(n.stateNode.containerInfo),Ts(r,n),Ns(n),yi=u;break;case 12:Ts(r,n),Ns(n);break;case 31:Ts(r,n),Ns(n),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,Mu(n,u)));break;case 13:Ts(r,n),Ns(n),n.child.flags&8192&&n.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(ju=bt()),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,Mu(n,u)));break;case 22:m=n.memoizedState!==null;var F=l!==null&&l.memoizedState!==null,ee=on,ae=Mt;if(on=ee||m,Mt=ae||F,Ts(r,n),Mt=ae,on=ee,Ns(n),u&8192)e:for(r=n.stateNode,r._visibility=m?r._visibility&-2:r._visibility|1,m&&(l===null||F||on||Mt||Fr(n)),l=null,r=n;;){if(r.tag===5||r.tag===26){if(l===null){F=l=r;try{if(v=F.stateNode,m)x=v.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{R=F.stateNode;var he=F.memoizedProps.style,te=he!=null&&he.hasOwnProperty("display")?he.display:null;R.style.display=te==null||typeof te=="boolean"?"":(""+te).trim()}}catch(Ce){it(F,F.return,Ce)}}}else if(r.tag===6){if(l===null){F=r;try{F.stateNode.nodeValue=m?"":F.memoizedProps}catch(Ce){it(F,F.return,Ce)}}}else if(r.tag===18){if(l===null){F=r;try{var ie=F.stateNode;m?a0(ie,!0):a0(F.stateNode,!1)}catch(Ce){it(F,F.return,Ce)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===n)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===n)break e;for(;r.sibling===null;){if(r.return===null||r.return===n)break e;l===r&&(l=null),r=r.return}l===r&&(l=null),r.sibling.return=r.return,r=r.sibling}u&4&&(u=n.updateQueue,u!==null&&(l=u.retryQueue,l!==null&&(u.retryQueue=null,Mu(n,l))));break;case 19:Ts(r,n),Ns(n),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,Mu(n,u)));break;case 30:break;case 21:break;default:Ts(r,n),Ns(n)}}function Ns(n){var r=n.flags;if(r&2){try{for(var l,u=n.return;u!==null;){if(lS(u)){l=u;break}u=u.return}if(l==null)throw Error(i(160));switch(l.tag){case 27:var m=l.stateNode,v=gp(n);Lu(n,v,m);break;case 5:var x=l.stateNode;l.flags&32&&(ja(x,""),l.flags&=-33);var R=gp(n);Lu(n,R,x);break;case 3:case 4:var F=l.stateNode.containerInfo,ee=gp(n);_p(n,ee,F);break;default:throw Error(i(161))}}catch(ae){it(n,n.return,ae)}n.flags&=-3}r&4096&&(n.flags&=-4097)}function _S(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var r=n;_S(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),n=n.sibling}}function cn(n,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)hS(n,r.alternate,r),r=r.sibling}function Fr(n){for(n=n.child;n!==null;){var r=n;switch(r.tag){case 0:case 11:case 14:case 15:Fn(4,r,r.return),Fr(r);break;case 1:Li(r,r.return);var l=r.stateNode;typeof l.componentWillUnmount=="function"&&aS(r,r.return,l),Fr(r);break;case 27:Ol(r.stateNode);case 26:case 5:Li(r,r.return),Fr(r);break;case 22:r.memoizedState===null&&Fr(r);break;case 30:Fr(r);break;default:Fr(r)}n=n.sibling}}function un(n,r,l){for(l=l&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var u=r.alternate,m=n,v=r,x=v.flags;switch(v.tag){case 0:case 11:case 15:un(m,v,l),xl(4,v);break;case 1:if(un(m,v,l),u=v,m=u.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(ee){it(u,u.return,ee)}if(u=v,m=u.updateQueue,m!==null){var R=u.stateNode;try{var F=m.shared.hiddenCallbacks;if(F!==null)for(m.shared.hiddenCallbacks=null,m=0;m<F.length;m++)Ky(F[m],R)}catch(ee){it(u,u.return,ee)}}l&&x&64&&rS(v),kl(v,v.return);break;case 27:cS(v);case 26:case 5:un(m,v,l),l&&u===null&&x&4&&oS(v),kl(v,v.return);break;case 12:un(m,v,l);break;case 31:un(m,v,l),l&&x&4&&pS(m,v);break;case 13:un(m,v,l),l&&x&4&&mS(m,v);break;case 22:v.memoizedState===null&&un(m,v,l),kl(v,v.return);break;case 30:break;default:un(m,v,l)}r=r.sibling}}function yp(n,r){var l=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(l=n.memoizedState.cachePool.pool),n=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(n=r.memoizedState.cachePool.pool),n!==l&&(n!=null&&n.refCount++,l!=null&&hl(l))}function bp(n,r){n=null,r.alternate!==null&&(n=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==n&&(r.refCount++,n!=null&&hl(n))}function bi(n,r,l,u){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)vS(n,r,l,u),r=r.sibling}function vS(n,r,l,u){var m=r.flags;switch(r.tag){case 0:case 11:case 15:bi(n,r,l,u),m&2048&&xl(9,r);break;case 1:bi(n,r,l,u);break;case 3:bi(n,r,l,u),m&2048&&(n=null,r.alternate!==null&&(n=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==n&&(r.refCount++,n!=null&&hl(n)));break;case 12:if(m&2048){bi(n,r,l,u),n=r.stateNode;try{var v=r.memoizedProps,x=v.id,R=v.onPostCommit;typeof R=="function"&&R(x,r.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(F){it(r,r.return,F)}}else bi(n,r,l,u);break;case 31:bi(n,r,l,u);break;case 13:bi(n,r,l,u);break;case 23:break;case 22:v=r.stateNode,x=r.alternate,r.memoizedState!==null?v._visibility&2?bi(n,r,l,u):El(n,r):v._visibility&2?bi(n,r,l,u):(v._visibility|=2,to(n,r,l,u,(r.subtreeFlags&10256)!==0||!1)),m&2048&&yp(x,r);break;case 24:bi(n,r,l,u),m&2048&&bp(r.alternate,r);break;default:bi(n,r,l,u)}}function to(n,r,l,u,m){for(m=m&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var v=n,x=r,R=l,F=u,ee=x.flags;switch(x.tag){case 0:case 11:case 15:to(v,x,R,F,m),xl(8,x);break;case 23:break;case 22:var ae=x.stateNode;x.memoizedState!==null?ae._visibility&2?to(v,x,R,F,m):El(v,x):(ae._visibility|=2,to(v,x,R,F,m)),m&&ee&2048&&yp(x.alternate,x);break;case 24:to(v,x,R,F,m),m&&ee&2048&&bp(x.alternate,x);break;default:to(v,x,R,F,m)}r=r.sibling}}function El(n,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var l=n,u=r,m=u.flags;switch(u.tag){case 22:El(l,u),m&2048&&yp(u.alternate,u);break;case 24:El(l,u),m&2048&&bp(u.alternate,u);break;default:El(l,u)}r=r.sibling}}var Tl=8192;function so(n,r,l){if(n.subtreeFlags&Tl)for(n=n.child;n!==null;)yS(n,r,l),n=n.sibling}function yS(n,r,l){switch(n.tag){case 26:so(n,r,l),n.flags&Tl&&n.memoizedState!==null&&LA(l,yi,n.memoizedState,n.memoizedProps);break;case 5:so(n,r,l);break;case 3:case 4:var u=yi;yi=qu(n.stateNode.containerInfo),so(n,r,l),yi=u;break;case 22:n.memoizedState===null&&(u=n.alternate,u!==null&&u.memoizedState!==null?(u=Tl,Tl=16777216,so(n,r,l),Tl=u):so(n,r,l));break;default:so(n,r,l)}}function bS(n){var r=n.alternate;if(r!==null&&(n=r.child,n!==null)){r.child=null;do r=n.sibling,n.sibling=null,n=r;while(n!==null)}}function Nl(n){var r=n.deletions;if((n.flags&16)!==0){if(r!==null)for(var l=0;l<r.length;l++){var u=r[l];Kt=u,wS(u,n)}bS(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)SS(n),n=n.sibling}function SS(n){switch(n.tag){case 0:case 11:case 15:Nl(n),n.flags&2048&&Fn(9,n,n.return);break;case 3:Nl(n);break;case 12:Nl(n);break;case 22:var r=n.stateNode;n.memoizedState!==null&&r._visibility&2&&(n.return===null||n.return.tag!==13)?(r._visibility&=-3,Ou(n)):Nl(n);break;default:Nl(n)}}function Ou(n){var r=n.deletions;if((n.flags&16)!==0){if(r!==null)for(var l=0;l<r.length;l++){var u=r[l];Kt=u,wS(u,n)}bS(n)}for(n=n.child;n!==null;){switch(r=n,r.tag){case 0:case 11:case 15:Fn(8,r,r.return),Ou(r);break;case 22:l=r.stateNode,l._visibility&2&&(l._visibility&=-3,Ou(r));break;default:Ou(r)}n=n.sibling}}function wS(n,r){for(;Kt!==null;){var l=Kt;switch(l.tag){case 0:case 11:case 15:Fn(8,l,r);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:hl(l.memoizedState.cache)}if(u=l.child,u!==null)u.return=l,Kt=u;else e:for(l=n;Kt!==null;){u=Kt;var m=u.sibling,v=u.return;if(dS(u),u===l){Kt=null;break e}if(m!==null){m.return=v,Kt=m;break e}Kt=v}}}var qN={getCacheForType:function(n){var r=rs(Rt),l=r.data.get(n);return l===void 0&&(l=n(),r.data.set(n,l)),l},cacheSignal:function(){return rs(Rt).controller.signal}},KN=typeof WeakMap=="function"?WeakMap:Map,et=0,lt=null,$e=null,We=0,st=0,zs=null,$n=!1,io=!1,Sp=!1,hn=0,wt=0,Vn=0,$r=0,wp=0,Hs=0,no=0,Al=null,As=null,Cp=!1,ju=0,CS=0,Pu=1/0,Bu=null,Wn=null,Bt=0,Gn=null,ro=null,dn=0,xp=0,kp=null,xS=null,Rl=0,Ep=null;function Us(){return(et&2)!==0&&We!==0?We&-We:O.T!==null?Lp():Hv()}function kS(){if(Hs===0)if((We&536870912)===0||Ye){var n=Ai;Ai<<=1,(Ai&3932160)===0&&(Ai=262144),Hs=n}else Hs=536870912;return n=Bs.current,n!==null&&(n.flags|=32),Hs}function Rs(n,r,l){(n===lt&&(st===2||st===9)||n.cancelPendingCommit!==null)&&(ao(n,0),qn(n,We,Hs,!1)),Qo(n,l),((et&2)===0||n!==lt)&&(n===lt&&((et&2)===0&&($r|=l),wt===4&&qn(n,We,Hs,!1)),Mi(n))}function ES(n,r,l){if((et&6)!==0)throw Error(i(327));var u=!l&&(r&127)===0&&(r&n.expiredLanes)===0||Xo(n,r),m=u?QN(n,r):Np(n,r,!0),v=u;do{if(m===0){io&&!u&&qn(n,r,0,!1);break}else{if(l=n.current.alternate,v&&!YN(l)){m=Np(n,r,!1),v=!1;continue}if(m===2){if(v=r,n.errorRecoveryDisabledLanes&v)var x=0;else x=n.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){r=x;e:{var R=n;m=Al;var F=R.current.memoizedState.isDehydrated;if(F&&(ao(R,x).flags|=256),x=Np(R,x,!1),x!==2){if(Sp&&!F){R.errorRecoveryDisabledLanes|=v,$r|=v,m=4;break e}v=As,As=m,v!==null&&(As===null?As=v:As.push.apply(As,v))}m=x}if(v=!1,m!==2)continue}}if(m===1){ao(n,0),qn(n,r,0,!0);break}e:{switch(u=n,v=m,v){case 0:case 1:throw Error(i(345));case 4:if((r&4194048)!==r)break;case 6:qn(u,r,Hs,!$n);break e;case 2:As=null;break;case 3:case 5:break;default:throw Error(i(329))}if((r&62914560)===r&&(m=ju+300-bt(),10<m)){if(qn(u,r,Hs,!$n),qc(u,0,!0)!==0)break e;dn=r,u.timeoutHandle=i0(TS.bind(null,u,l,As,Bu,Cp,r,Hs,$r,no,$n,v,"Throttled",-0,0),m);break e}TS(u,l,As,Bu,Cp,r,Hs,$r,no,$n,v,null,-0,0)}}break}while(!0);Mi(n)}function TS(n,r,l,u,m,v,x,R,F,ee,ae,he,te,ie){if(n.timeoutHandle=-1,he=r.subtreeFlags,he&8192||(he&16785408)===16785408){he={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Xi},yS(r,v,he);var Ce=(v&62914560)===v?ju-bt():(v&4194048)===v?CS-bt():0;if(Ce=MA(he,Ce),Ce!==null){dn=v,n.cancelPendingCommit=Ce(jS.bind(null,n,r,v,l,u,m,x,R,F,ae,he,null,te,ie)),qn(n,v,x,!ee);return}}jS(n,r,v,l,u,m,x,R,F)}function YN(n){for(var r=n;;){var l=r.tag;if((l===0||l===11||l===15)&&r.flags&16384&&(l=r.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var u=0;u<l.length;u++){var m=l[u],v=m.getSnapshot;m=m.value;try{if(!js(v(),m))return!1}catch{return!1}}if(l=r.child,r.subtreeFlags&16384&&l!==null)l.return=r,r=l;else{if(r===n)break;for(;r.sibling===null;){if(r.return===null||r.return===n)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function qn(n,r,l,u){r&=~wp,r&=~$r,n.suspendedLanes|=r,n.pingedLanes&=~r,u&&(n.warmLanes|=r),u=n.expirationTimes;for(var m=r;0<m;){var v=31-Gt(m),x=1<<v;u[v]=-1,m&=~x}l!==0&&Bv(n,l,r)}function Iu(){return(et&6)===0?(Dl(0),!1):!0}function Tp(){if($e!==null){if(st===0)var n=$e.return;else n=$e,en=Or=null,$f(n),Xa=null,fl=0,n=$e;for(;n!==null;)nS(n.alternate,n),n=n.return;$e=null}}function ao(n,r){var l=n.timeoutHandle;l!==-1&&(n.timeoutHandle=-1,mA(l)),l=n.cancelPendingCommit,l!==null&&(n.cancelPendingCommit=null,l()),dn=0,Tp(),lt=n,$e=l=Zi(n.current,null),We=r,st=0,zs=null,$n=!1,io=Xo(n,r),Sp=!1,no=Hs=wp=$r=Vn=wt=0,As=Al=null,Cp=!1,(r&8)!==0&&(r|=r&32);var u=n.entangledLanes;if(u!==0)for(n=n.entanglements,u&=r;0<u;){var m=31-Gt(u),v=1<<m;r|=n[m],u&=~v}return hn=r,ru(),l}function NS(n,r){Pe=null,O.H=Sl,r===Ya||r===fu?(r=Vy(),st=3):r===Df?(r=Vy(),st=4):st=r===rp?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,zs=r,$e===null&&(wt=1,Tu(n,Zs(r,n.current)))}function AS(){var n=Bs.current;return n===null?!0:(We&4194048)===We?si===null:(We&62914560)===We||(We&536870912)!==0?n===si:!1}function RS(){var n=O.H;return O.H=Sl,n===null?Sl:n}function DS(){var n=O.A;return O.A=qN,n}function zu(){wt=4,$n||(We&4194048)!==We&&Bs.current!==null||(io=!0),(Vn&134217727)===0&&($r&134217727)===0||lt===null||qn(lt,We,Hs,!1)}function Np(n,r,l){var u=et;et|=2;var m=RS(),v=DS();(lt!==n||We!==r)&&(Bu=null,ao(n,r)),r=!1;var x=wt;e:do try{if(st!==0&&$e!==null){var R=$e,F=zs;switch(st){case 8:Tp(),x=6;break e;case 3:case 2:case 9:case 6:Bs.current===null&&(r=!0);var ee=st;if(st=0,zs=null,oo(n,R,F,ee),l&&io){x=0;break e}break;default:ee=st,st=0,zs=null,oo(n,R,F,ee)}}XN(),x=wt;break}catch(ae){NS(n,ae)}while(!0);return r&&n.shellSuspendCounter++,en=Or=null,et=u,O.H=m,O.A=v,$e===null&&(lt=null,We=0,ru()),x}function XN(){for(;$e!==null;)LS($e)}function QN(n,r){var l=et;et|=2;var u=RS(),m=DS();lt!==n||We!==r?(Bu=null,Pu=bt()+500,ao(n,r)):io=Xo(n,r);e:do try{if(st!==0&&$e!==null){r=$e;var v=zs;t:switch(st){case 1:st=0,zs=null,oo(n,r,v,1);break;case 2:case 9:if(Fy(v)){st=0,zs=null,MS(r);break}r=function(){st!==2&&st!==9||lt!==n||(st=7),Mi(n)},v.then(r,r);break e;case 3:st=7;break e;case 4:st=5;break e;case 7:Fy(v)?(st=0,zs=null,MS(r)):(st=0,zs=null,oo(n,r,v,7));break;case 5:var x=null;switch($e.tag){case 26:x=$e.memoizedState;case 5:case 27:var R=$e;if(x?v0(x):R.stateNode.complete){st=0,zs=null;var F=R.sibling;if(F!==null)$e=F;else{var ee=R.return;ee!==null?($e=ee,Hu(ee)):$e=null}break t}}st=0,zs=null,oo(n,r,v,5);break;case 6:st=0,zs=null,oo(n,r,v,6);break;case 8:Tp(),wt=6;break e;default:throw Error(i(462))}}ZN();break}catch(ae){NS(n,ae)}while(!0);return en=Or=null,O.H=u,O.A=m,et=l,$e!==null?0:(lt=null,We=0,ru(),wt)}function ZN(){for(;$e!==null&&!ws();)LS($e)}function LS(n){var r=sS(n.alternate,n,hn);n.memoizedProps=n.pendingProps,r===null?Hu(n):$e=r}function MS(n){var r=n,l=r.alternate;switch(r.tag){case 15:case 0:r=Xb(l,r,r.pendingProps,r.type,void 0,We);break;case 11:r=Xb(l,r,r.pendingProps,r.type.render,r.ref,We);break;case 5:$f(r);default:nS(l,r),r=$e=Dy(r,hn),r=sS(l,r,hn)}n.memoizedProps=n.pendingProps,r===null?Hu(n):$e=r}function oo(n,r,l,u){en=Or=null,$f(r),Xa=null,fl=0;var m=r.return;try{if(HN(n,m,r,l,We)){wt=1,Tu(n,Zs(l,n.current)),$e=null;return}}catch(v){if(m!==null)throw $e=m,v;wt=1,Tu(n,Zs(l,n.current)),$e=null;return}r.flags&32768?(Ye||u===1?n=!0:io||(We&536870912)!==0?n=!1:($n=n=!0,(u===2||u===9||u===3||u===6)&&(u=Bs.current,u!==null&&u.tag===13&&(u.flags|=16384))),OS(r,n)):Hu(r)}function Hu(n){var r=n;do{if((r.flags&32768)!==0){OS(r,$n);return}n=r.return;var l=$N(r.alternate,r,hn);if(l!==null){$e=l;return}if(r=r.sibling,r!==null){$e=r;return}$e=r=n}while(r!==null);wt===0&&(wt=5)}function OS(n,r){do{var l=VN(n.alternate,n);if(l!==null){l.flags&=32767,$e=l;return}if(l=n.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!r&&(n=n.sibling,n!==null)){$e=n;return}$e=n=l}while(n!==null);wt=6,$e=null}function jS(n,r,l,u,m,v,x,R,F){n.cancelPendingCommit=null;do Uu();while(Bt!==0);if((et&6)!==0)throw Error(i(327));if(r!==null){if(r===n.current)throw Error(i(177));if(v=r.lanes|r.childLanes,v|=gf,DT(n,l,v,x,R,F),n===lt&&($e=lt=null,We=0),ro=r,Gn=n,dn=l,xp=v,kp=m,xS=u,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,sA(Na,function(){return HS(),null})):(n.callbackNode=null,n.callbackPriority=0),u=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||u){u=O.T,O.T=null,m=z.p,z.p=2,x=et,et|=4;try{WN(n,r,l)}finally{et=x,z.p=m,O.T=u}}Bt=1,PS(),BS(),IS()}}function PS(){if(Bt===1){Bt=0;var n=Gn,r=ro,l=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||l){l=O.T,O.T=null;var u=z.p;z.p=2;var m=et;et|=4;try{gS(r,n);var v=Hp,x=wy(n.containerInfo),R=v.focusedElem,F=v.selectionRange;if(x!==R&&R&&R.ownerDocument&&Sy(R.ownerDocument.documentElement,R)){if(F!==null&&hf(R)){var ee=F.start,ae=F.end;if(ae===void 0&&(ae=ee),"selectionStart"in R)R.selectionStart=ee,R.selectionEnd=Math.min(ae,R.value.length);else{var he=R.ownerDocument||document,te=he&&he.defaultView||window;if(te.getSelection){var ie=te.getSelection(),Ce=R.textContent.length,Ae=Math.min(F.start,Ce),at=F.end===void 0?Ae:Math.min(F.end,Ce);!ie.extend&&Ae>at&&(x=at,at=Ae,Ae=x);var Z=by(R,Ae),G=by(R,at);if(Z&&G&&(ie.rangeCount!==1||ie.anchorNode!==Z.node||ie.anchorOffset!==Z.offset||ie.focusNode!==G.node||ie.focusOffset!==G.offset)){var J=he.createRange();J.setStart(Z.node,Z.offset),ie.removeAllRanges(),Ae>at?(ie.addRange(J),ie.extend(G.node,G.offset)):(J.setEnd(G.node,G.offset),ie.addRange(J))}}}}for(he=[],ie=R;ie=ie.parentNode;)ie.nodeType===1&&he.push({element:ie,left:ie.scrollLeft,top:ie.scrollTop});for(typeof R.focus=="function"&&R.focus(),R=0;R<he.length;R++){var ue=he[R];ue.element.scrollLeft=ue.left,ue.element.scrollTop=ue.top}}Ju=!!zp,Hp=zp=null}finally{et=m,z.p=u,O.T=l}}n.current=r,Bt=2}}function BS(){if(Bt===2){Bt=0;var n=Gn,r=ro,l=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||l){l=O.T,O.T=null;var u=z.p;z.p=2;var m=et;et|=4;try{hS(n,r.alternate,r)}finally{et=m,z.p=u,O.T=l}}Bt=3}}function IS(){if(Bt===4||Bt===3){Bt=0,Cs();var n=Gn,r=ro,l=dn,u=xS;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?Bt=5:(Bt=0,ro=Gn=null,zS(n,n.pendingLanes));var m=n.pendingLanes;if(m===0&&(Wn=null),Wd(l),r=r.stateNode,gs&&typeof gs.onCommitFiberRoot=="function")try{gs.onCommitFiberRoot(Er,r,void 0,(r.current.flags&128)===128)}catch{}if(u!==null){r=O.T,m=z.p,z.p=2,O.T=null;try{for(var v=n.onRecoverableError,x=0;x<u.length;x++){var R=u[x];v(R.value,{componentStack:R.stack})}}finally{O.T=r,z.p=m}}(dn&3)!==0&&Uu(),Mi(n),m=n.pendingLanes,(l&261930)!==0&&(m&42)!==0?n===Ep?Rl++:(Rl=0,Ep=n):Rl=0,Dl(0)}}function zS(n,r){(n.pooledCacheLanes&=r)===0&&(r=n.pooledCache,r!=null&&(n.pooledCache=null,hl(r)))}function Uu(){return PS(),BS(),IS(),HS()}function HS(){if(Bt!==5)return!1;var n=Gn,r=xp;xp=0;var l=Wd(dn),u=O.T,m=z.p;try{z.p=32>l?32:l,O.T=null,l=kp,kp=null;var v=Gn,x=dn;if(Bt=0,ro=Gn=null,dn=0,(et&6)!==0)throw Error(i(331));var R=et;if(et|=4,SS(v.current),vS(v,v.current,x,l),et=R,Dl(0,!1),gs&&typeof gs.onPostCommitFiberRoot=="function")try{gs.onPostCommitFiberRoot(Er,v)}catch{}return!0}finally{z.p=m,O.T=u,zS(n,r)}}function US(n,r,l){r=Zs(l,r),r=np(n.stateNode,r,2),n=zn(n,r,2),n!==null&&(Qo(n,2),Mi(n))}function it(n,r,l){if(n.tag===3)US(n,n,l);else for(;r!==null;){if(r.tag===3){US(r,n,l);break}else if(r.tag===1){var u=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(Wn===null||!Wn.has(u))){n=Zs(l,n),l=Fb(2),u=zn(r,l,2),u!==null&&($b(l,u,r,n),Qo(u,2),Mi(u));break}}r=r.return}}function Ap(n,r,l){var u=n.pingCache;if(u===null){u=n.pingCache=new KN;var m=new Set;u.set(r,m)}else m=u.get(r),m===void 0&&(m=new Set,u.set(r,m));m.has(l)||(Sp=!0,m.add(l),n=JN.bind(null,n,r,l),r.then(n,n))}function JN(n,r,l){var u=n.pingCache;u!==null&&u.delete(r),n.pingedLanes|=n.suspendedLanes&l,n.warmLanes&=~l,lt===n&&(We&l)===l&&(wt===4||wt===3&&(We&62914560)===We&&300>bt()-ju?(et&2)===0&&ao(n,0):wp|=l,no===We&&(no=0)),Mi(n)}function FS(n,r){r===0&&(r=Pv()),n=Dr(n,r),n!==null&&(Qo(n,r),Mi(n))}function eA(n){var r=n.memoizedState,l=0;r!==null&&(l=r.retryLane),FS(n,l)}function tA(n,r){var l=0;switch(n.tag){case 31:case 13:var u=n.stateNode,m=n.memoizedState;m!==null&&(l=m.retryLane);break;case 19:u=n.stateNode;break;case 22:u=n.stateNode._retryCache;break;default:throw Error(i(314))}u!==null&&u.delete(r),FS(n,l)}function sA(n,r){return qi(n,r)}var Fu=null,lo=null,Rp=!1,$u=!1,Dp=!1,Kn=0;function Mi(n){n!==lo&&n.next===null&&(lo===null?Fu=lo=n:lo=lo.next=n),$u=!0,Rp||(Rp=!0,nA())}function Dl(n,r){if(!Dp&&$u){Dp=!0;do for(var l=!1,u=Fu;u!==null;){if(n!==0){var m=u.pendingLanes;if(m===0)var v=0;else{var x=u.suspendedLanes,R=u.pingedLanes;v=(1<<31-Gt(42|n)+1)-1,v&=m&~(x&~R),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(l=!0,GS(u,v))}else v=We,v=qc(u,u===lt?v:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(v&3)===0||Xo(u,v)||(l=!0,GS(u,v));u=u.next}while(l);Dp=!1}}function iA(){$S()}function $S(){$u=Rp=!1;var n=0;Kn!==0&&pA()&&(n=Kn);for(var r=bt(),l=null,u=Fu;u!==null;){var m=u.next,v=VS(u,r);v===0?(u.next=null,l===null?Fu=m:l.next=m,m===null&&(lo=l)):(l=u,(n!==0||(v&3)!==0)&&($u=!0)),u=m}Bt!==0&&Bt!==5||Dl(n),Kn!==0&&(Kn=0)}function VS(n,r){for(var l=n.suspendedLanes,u=n.pingedLanes,m=n.expirationTimes,v=n.pendingLanes&-62914561;0<v;){var x=31-Gt(v),R=1<<x,F=m[x];F===-1?((R&l)===0||(R&u)!==0)&&(m[x]=RT(R,r)):F<=r&&(n.expiredLanes|=R),v&=~R}if(r=lt,l=We,l=qc(n,n===r?l:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),u=n.callbackNode,l===0||n===r&&(st===2||st===9)||n.cancelPendingCommit!==null)return u!==null&&u!==null&&_e(u),n.callbackNode=null,n.callbackPriority=0;if((l&3)===0||Xo(n,l)){if(r=l&-l,r===n.callbackPriority)return r;switch(u!==null&&_e(u),Wd(l)){case 2:case 8:l=$c;break;case 32:l=Na;break;case 268435456:l=Vc;break;default:l=Na}return u=WS.bind(null,n),l=qi(l,u),n.callbackPriority=r,n.callbackNode=l,r}return u!==null&&u!==null&&_e(u),n.callbackPriority=2,n.callbackNode=null,2}function WS(n,r){if(Bt!==0&&Bt!==5)return n.callbackNode=null,n.callbackPriority=0,null;var l=n.callbackNode;if(Uu()&&n.callbackNode!==l)return null;var u=We;return u=qc(n,n===lt?u:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),u===0?null:(ES(n,u,r),VS(n,bt()),n.callbackNode!=null&&n.callbackNode===l?WS.bind(null,n):null)}function GS(n,r){if(Uu())return null;ES(n,r,!0)}function nA(){gA(function(){(et&6)!==0?qi(Ta,iA):$S()})}function Lp(){if(Kn===0){var n=qa;n===0&&(n=_i,_i<<=1,(_i&261888)===0&&(_i=256)),Kn=n}return Kn}function qS(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:Qc(""+n)}function KS(n,r){var l=r.ownerDocument.createElement("input");return l.name=r.name,l.value=r.value,n.id&&l.setAttribute("form",n.id),r.parentNode.insertBefore(l,r),n=new FormData(n),l.parentNode.removeChild(l),n}function rA(n,r,l,u,m){if(r==="submit"&&l&&l.stateNode===m){var v=qS((m[xs]||null).action),x=u.submitter;x&&(r=(r=x[xs]||null)?qS(r.formAction):x.getAttribute("formAction"),r!==null&&(v=r,x=null));var R=new tu("action","action",null,u,m);n.push({event:R,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(Kn!==0){var F=x?KS(m,x):new FormData(m);Zf(l,{pending:!0,data:F,method:m.method,action:v},null,F)}}else typeof v=="function"&&(R.preventDefault(),F=x?KS(m,x):new FormData(m),Zf(l,{pending:!0,data:F,method:m.method,action:v},v,F))},currentTarget:m}]})}}for(var Mp=0;Mp<mf.length;Mp++){var Op=mf[Mp],aA=Op.toLowerCase(),oA=Op[0].toUpperCase()+Op.slice(1);vi(aA,"on"+oA)}vi(ky,"onAnimationEnd"),vi(Ey,"onAnimationIteration"),vi(Ty,"onAnimationStart"),vi("dblclick","onDoubleClick"),vi("focusin","onFocus"),vi("focusout","onBlur"),vi(CN,"onTransitionRun"),vi(xN,"onTransitionStart"),vi(kN,"onTransitionCancel"),vi(Ny,"onTransitionEnd"),Ma("onMouseEnter",["mouseout","mouseover"]),Ma("onMouseLeave",["mouseout","mouseover"]),Ma("onPointerEnter",["pointerout","pointerover"]),Ma("onPointerLeave",["pointerout","pointerover"]),Tr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Tr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Tr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Tr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Tr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Tr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ll="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(" "),lA=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ll));function YS(n,r){r=(r&4)!==0;for(var l=0;l<n.length;l++){var u=n[l],m=u.event;u=u.listeners;e:{var v=void 0;if(r)for(var x=u.length-1;0<=x;x--){var R=u[x],F=R.instance,ee=R.currentTarget;if(R=R.listener,F!==v&&m.isPropagationStopped())break e;v=R,m.currentTarget=ee;try{v(m)}catch(ae){nu(ae)}m.currentTarget=null,v=F}else for(x=0;x<u.length;x++){if(R=u[x],F=R.instance,ee=R.currentTarget,R=R.listener,F!==v&&m.isPropagationStopped())break e;v=R,m.currentTarget=ee;try{v(m)}catch(ae){nu(ae)}m.currentTarget=null,v=F}}}}function Ve(n,r){var l=r[Gd];l===void 0&&(l=r[Gd]=new Set);var u=n+"__bubble";l.has(u)||(XS(r,n,2,!1),l.add(u))}function jp(n,r,l){var u=0;r&&(u|=4),XS(l,n,u,r)}var Vu="_reactListening"+Math.random().toString(36).slice(2);function Pp(n){if(!n[Vu]){n[Vu]=!0,$v.forEach(function(l){l!=="selectionchange"&&(lA.has(l)||jp(l,!1,n),jp(l,!0,n))});var r=n.nodeType===9?n:n.ownerDocument;r===null||r[Vu]||(r[Vu]=!0,jp("selectionchange",!1,r))}}function XS(n,r,l,u){switch(k0(r)){case 2:var m=PA;break;case 8:m=BA;break;default:m=Qp}l=m.bind(null,r,l,n),m=void 0,!tf||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(m=!0),u?m!==void 0?n.addEventListener(r,l,{capture:!0,passive:m}):n.addEventListener(r,l,!0):m!==void 0?n.addEventListener(r,l,{passive:m}):n.addEventListener(r,l,!1)}function Bp(n,r,l,u,m){var v=u;if((r&1)===0&&(r&2)===0&&u!==null)e:for(;;){if(u===null)return;var x=u.tag;if(x===3||x===4){var R=u.stateNode.containerInfo;if(R===m)break;if(x===4)for(x=u.return;x!==null;){var F=x.tag;if((F===3||F===4)&&x.stateNode.containerInfo===m)return;x=x.return}for(;R!==null;){if(x=Ra(R),x===null)return;if(F=x.tag,F===5||F===6||F===26||F===27){u=v=x;continue e}R=R.parentNode}}u=u.return}ty(function(){var ee=v,ae=Jd(l),he=[];e:{var te=Ay.get(n);if(te!==void 0){var ie=tu,Ce=n;switch(n){case"keypress":if(Jc(l)===0)break e;case"keydown":case"keyup":ie=tN;break;case"focusin":Ce="focus",ie=af;break;case"focusout":Ce="blur",ie=af;break;case"beforeblur":case"afterblur":ie=af;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":ie=ny;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ie=$T;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ie=nN;break;case ky:case Ey:case Ty:ie=GT;break;case Ny:ie=aN;break;case"scroll":case"scrollend":ie=UT;break;case"wheel":ie=lN;break;case"copy":case"cut":case"paste":ie=KT;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ie=ay;break;case"toggle":case"beforetoggle":ie=uN}var Ae=(r&4)!==0,at=!Ae&&(n==="scroll"||n==="scrollend"),Z=Ae?te!==null?te+"Capture":null:te;Ae=[];for(var G=ee,J;G!==null;){var ue=G;if(J=ue.stateNode,ue=ue.tag,ue!==5&&ue!==26&&ue!==27||J===null||Z===null||(ue=el(G,Z),ue!=null&&Ae.push(Ml(G,ue,J))),at)break;G=G.return}0<Ae.length&&(te=new ie(te,Ce,null,l,ae),he.push({event:te,listeners:Ae}))}}if((r&7)===0){e:{if(te=n==="mouseover"||n==="pointerover",ie=n==="mouseout"||n==="pointerout",te&&l!==Zd&&(Ce=l.relatedTarget||l.fromElement)&&(Ra(Ce)||Ce[Aa]))break e;if((ie||te)&&(te=ae.window===ae?ae:(te=ae.ownerDocument)?te.defaultView||te.parentWindow:window,ie?(Ce=l.relatedTarget||l.toElement,ie=ee,Ce=Ce?Ra(Ce):null,Ce!==null&&(at=o(Ce),Ae=Ce.tag,Ce!==at||Ae!==5&&Ae!==27&&Ae!==6)&&(Ce=null)):(ie=null,Ce=ee),ie!==Ce)){if(Ae=ny,ue="onMouseLeave",Z="onMouseEnter",G="mouse",(n==="pointerout"||n==="pointerover")&&(Ae=ay,ue="onPointerLeave",Z="onPointerEnter",G="pointer"),at=ie==null?te:Jo(ie),J=Ce==null?te:Jo(Ce),te=new Ae(ue,G+"leave",ie,l,ae),te.target=at,te.relatedTarget=J,ue=null,Ra(ae)===ee&&(Ae=new Ae(Z,G+"enter",Ce,l,ae),Ae.target=J,Ae.relatedTarget=at,ue=Ae),at=ue,ie&&Ce)t:{for(Ae=cA,Z=ie,G=Ce,J=0,ue=Z;ue;ue=Ae(ue))J++;ue=0;for(var Te=G;Te;Te=Ae(Te))ue++;for(;0<J-ue;)Z=Ae(Z),J--;for(;0<ue-J;)G=Ae(G),ue--;for(;J--;){if(Z===G||G!==null&&Z===G.alternate){Ae=Z;break t}Z=Ae(Z),G=Ae(G)}Ae=null}else Ae=null;ie!==null&&QS(he,te,ie,Ae,!1),Ce!==null&&at!==null&&QS(he,at,Ce,Ae,!0)}}e:{if(te=ee?Jo(ee):window,ie=te.nodeName&&te.nodeName.toLowerCase(),ie==="select"||ie==="input"&&te.type==="file")var Ze=py;else if(dy(te))if(my)Ze=bN;else{Ze=vN;var xe=_N}else ie=te.nodeName,!ie||ie.toLowerCase()!=="input"||te.type!=="checkbox"&&te.type!=="radio"?ee&&Qd(ee.elementType)&&(Ze=py):Ze=yN;if(Ze&&(Ze=Ze(n,ee))){fy(he,Ze,l,ae);break e}xe&&xe(n,te,ee),n==="focusout"&&ee&&te.type==="number"&&ee.memoizedProps.value!=null&&Xd(te,"number",te.value)}switch(xe=ee?Jo(ee):window,n){case"focusin":(dy(xe)||xe.contentEditable==="true")&&(za=xe,df=ee,ll=null);break;case"focusout":ll=df=za=null;break;case"mousedown":ff=!0;break;case"contextmenu":case"mouseup":case"dragend":ff=!1,Cy(he,l,ae);break;case"selectionchange":if(wN)break;case"keydown":case"keyup":Cy(he,l,ae)}var Be;if(lf)e:{switch(n){case"compositionstart":var Ge="onCompositionStart";break e;case"compositionend":Ge="onCompositionEnd";break e;case"compositionupdate":Ge="onCompositionUpdate";break e}Ge=void 0}else Ia?uy(n,l)&&(Ge="onCompositionEnd"):n==="keydown"&&l.keyCode===229&&(Ge="onCompositionStart");Ge&&(oy&&l.locale!=="ko"&&(Ia||Ge!=="onCompositionStart"?Ge==="onCompositionEnd"&&Ia&&(Be=sy()):(Ln=ae,sf="value"in Ln?Ln.value:Ln.textContent,Ia=!0)),xe=Wu(ee,Ge),0<xe.length&&(Ge=new ry(Ge,n,null,l,ae),he.push({event:Ge,listeners:xe}),Be?Ge.data=Be:(Be=hy(l),Be!==null&&(Ge.data=Be)))),(Be=dN?fN(n,l):pN(n,l))&&(Ge=Wu(ee,"onBeforeInput"),0<Ge.length&&(xe=new ry("onBeforeInput","beforeinput",null,l,ae),he.push({event:xe,listeners:Ge}),xe.data=Be)),rA(he,n,ee,l,ae)}YS(he,r)})}function Ml(n,r,l){return{instance:n,listener:r,currentTarget:l}}function Wu(n,r){for(var l=r+"Capture",u=[];n!==null;){var m=n,v=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||v===null||(m=el(n,l),m!=null&&u.unshift(Ml(n,m,v)),m=el(n,r),m!=null&&u.push(Ml(n,m,v))),n.tag===3)return u;n=n.return}return[]}function cA(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function QS(n,r,l,u,m){for(var v=r._reactName,x=[];l!==null&&l!==u;){var R=l,F=R.alternate,ee=R.stateNode;if(R=R.tag,F!==null&&F===u)break;R!==5&&R!==26&&R!==27||ee===null||(F=ee,m?(ee=el(l,v),ee!=null&&x.unshift(Ml(l,ee,F))):m||(ee=el(l,v),ee!=null&&x.push(Ml(l,ee,F)))),l=l.return}x.length!==0&&n.push({event:r,listeners:x})}var uA=/\r\n?/g,hA=/\u0000|\uFFFD/g;function ZS(n){return(typeof n=="string"?n:""+n).replace(uA,`
|
|
50
|
+
`).replace(hA,"")}function JS(n,r){return r=ZS(r),ZS(n)===r}function rt(n,r,l,u,m,v){switch(l){case"children":typeof u=="string"?r==="body"||r==="textarea"&&u===""||ja(n,u):(typeof u=="number"||typeof u=="bigint")&&r!=="body"&&ja(n,""+u);break;case"className":Yc(n,"class",u);break;case"tabIndex":Yc(n,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":Yc(n,l,u);break;case"style":Jv(n,u,v);break;case"data":if(r!=="object"){Yc(n,"data",u);break}case"src":case"href":if(u===""&&(r!=="a"||l!=="href")){n.removeAttribute(l);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){n.removeAttribute(l);break}u=Qc(""+u),n.setAttribute(l,u);break;case"action":case"formAction":if(typeof u=="function"){n.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 v=="function"&&(l==="formAction"?(r!=="input"&&rt(n,r,"name",m.name,m,null),rt(n,r,"formEncType",m.formEncType,m,null),rt(n,r,"formMethod",m.formMethod,m,null),rt(n,r,"formTarget",m.formTarget,m,null)):(rt(n,r,"encType",m.encType,m,null),rt(n,r,"method",m.method,m,null),rt(n,r,"target",m.target,m,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){n.removeAttribute(l);break}u=Qc(""+u),n.setAttribute(l,u);break;case"onClick":u!=null&&(n.onclick=Xi);break;case"onScroll":u!=null&&Ve("scroll",n);break;case"onScrollEnd":u!=null&&Ve("scrollend",n);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(i(61));if(l=u.__html,l!=null){if(m.children!=null)throw Error(i(60));n.innerHTML=l}}break;case"multiple":n.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":n.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"){n.removeAttribute("xlink:href");break}l=Qc(""+u),n.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"?n.setAttribute(l,""+u):n.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"?n.setAttribute(l,""):n.removeAttribute(l);break;case"capture":case"download":u===!0?n.setAttribute(l,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?n.setAttribute(l,u):n.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?n.setAttribute(l,u):n.removeAttribute(l);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?n.removeAttribute(l):n.setAttribute(l,u);break;case"popover":Ve("beforetoggle",n),Ve("toggle",n),Kc(n,"popover",u);break;case"xlinkActuate":Yi(n,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":Yi(n,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":Yi(n,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":Yi(n,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":Yi(n,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":Yi(n,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":Yi(n,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":Yi(n,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":Yi(n,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":Kc(n,"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=zT.get(l)||l,Kc(n,l,u))}}function Ip(n,r,l,u,m,v){switch(l){case"style":Jv(n,u,v);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(i(61));if(l=u.__html,l!=null){if(m.children!=null)throw Error(i(60));n.innerHTML=l}}break;case"children":typeof u=="string"?ja(n,u):(typeof u=="number"||typeof u=="bigint")&&ja(n,""+u);break;case"onScroll":u!=null&&Ve("scroll",n);break;case"onScrollEnd":u!=null&&Ve("scrollend",n);break;case"onClick":u!=null&&(n.onclick=Xi);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Vv.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(m=l.endsWith("Capture"),r=l.slice(2,m?l.length-7:void 0),v=n[xs]||null,v=v!=null?v[l]:null,typeof v=="function"&&n.removeEventListener(r,v,m),typeof u=="function")){typeof v!="function"&&v!==null&&(l in n?n[l]=null:n.hasAttribute(l)&&n.removeAttribute(l)),n.addEventListener(r,u,m);break e}l in n?n[l]=u:u===!0?n.setAttribute(l,""):Kc(n,l,u)}}}function os(n,r,l){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ve("error",n),Ve("load",n);var u=!1,m=!1,v;for(v in l)if(l.hasOwnProperty(v)){var x=l[v];if(x!=null)switch(v){case"src":u=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:rt(n,r,v,x,l,null)}}m&&rt(n,r,"srcSet",l.srcSet,l,null),u&&rt(n,r,"src",l.src,l,null);return;case"input":Ve("invalid",n);var R=v=x=m=null,F=null,ee=null;for(u in l)if(l.hasOwnProperty(u)){var ae=l[u];if(ae!=null)switch(u){case"name":m=ae;break;case"type":x=ae;break;case"checked":F=ae;break;case"defaultChecked":ee=ae;break;case"value":v=ae;break;case"defaultValue":R=ae;break;case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(i(137,r));break;default:rt(n,r,u,ae,l,null)}}Yv(n,v,R,F,ee,x,m,!1);return;case"select":Ve("invalid",n),u=x=v=null;for(m in l)if(l.hasOwnProperty(m)&&(R=l[m],R!=null))switch(m){case"value":v=R;break;case"defaultValue":x=R;break;case"multiple":u=R;default:rt(n,r,m,R,l,null)}r=v,l=x,n.multiple=!!u,r!=null?Oa(n,!!u,r,!1):l!=null&&Oa(n,!!u,l,!0);return;case"textarea":Ve("invalid",n),v=m=u=null;for(x in l)if(l.hasOwnProperty(x)&&(R=l[x],R!=null))switch(x){case"value":u=R;break;case"defaultValue":m=R;break;case"children":v=R;break;case"dangerouslySetInnerHTML":if(R!=null)throw Error(i(91));break;default:rt(n,r,x,R,l,null)}Qv(n,u,m,v);return;case"option":for(F in l)if(l.hasOwnProperty(F)&&(u=l[F],u!=null))switch(F){case"selected":n.selected=u&&typeof u!="function"&&typeof u!="symbol";break;default:rt(n,r,F,u,l,null)}return;case"dialog":Ve("beforetoggle",n),Ve("toggle",n),Ve("cancel",n),Ve("close",n);break;case"iframe":case"object":Ve("load",n);break;case"video":case"audio":for(u=0;u<Ll.length;u++)Ve(Ll[u],n);break;case"image":Ve("error",n),Ve("load",n);break;case"details":Ve("toggle",n);break;case"embed":case"source":case"link":Ve("error",n),Ve("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ee in l)if(l.hasOwnProperty(ee)&&(u=l[ee],u!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:rt(n,r,ee,u,l,null)}return;default:if(Qd(r)){for(ae in l)l.hasOwnProperty(ae)&&(u=l[ae],u!==void 0&&Ip(n,r,ae,u,l,void 0));return}}for(R in l)l.hasOwnProperty(R)&&(u=l[R],u!=null&&rt(n,r,R,u,l,null))}function dA(n,r,l,u){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var m=null,v=null,x=null,R=null,F=null,ee=null,ae=null;for(ie in l){var he=l[ie];if(l.hasOwnProperty(ie)&&he!=null)switch(ie){case"checked":break;case"value":break;case"defaultValue":F=he;default:u.hasOwnProperty(ie)||rt(n,r,ie,null,u,he)}}for(var te in u){var ie=u[te];if(he=l[te],u.hasOwnProperty(te)&&(ie!=null||he!=null))switch(te){case"type":v=ie;break;case"name":m=ie;break;case"checked":ee=ie;break;case"defaultChecked":ae=ie;break;case"value":x=ie;break;case"defaultValue":R=ie;break;case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(i(137,r));break;default:ie!==he&&rt(n,r,te,ie,u,he)}}Yd(n,x,R,F,ee,ae,v,m);return;case"select":ie=x=R=te=null;for(v in l)if(F=l[v],l.hasOwnProperty(v)&&F!=null)switch(v){case"value":break;case"multiple":ie=F;default:u.hasOwnProperty(v)||rt(n,r,v,null,u,F)}for(m in u)if(v=u[m],F=l[m],u.hasOwnProperty(m)&&(v!=null||F!=null))switch(m){case"value":te=v;break;case"defaultValue":R=v;break;case"multiple":x=v;default:v!==F&&rt(n,r,m,v,u,F)}r=R,l=x,u=ie,te!=null?Oa(n,!!l,te,!1):!!u!=!!l&&(r!=null?Oa(n,!!l,r,!0):Oa(n,!!l,l?[]:"",!1));return;case"textarea":ie=te=null;for(R in l)if(m=l[R],l.hasOwnProperty(R)&&m!=null&&!u.hasOwnProperty(R))switch(R){case"value":break;case"children":break;default:rt(n,r,R,null,u,m)}for(x in u)if(m=u[x],v=l[x],u.hasOwnProperty(x)&&(m!=null||v!=null))switch(x){case"value":te=m;break;case"defaultValue":ie=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(i(91));break;default:m!==v&&rt(n,r,x,m,u,v)}Xv(n,te,ie);return;case"option":for(var Ce in l)if(te=l[Ce],l.hasOwnProperty(Ce)&&te!=null&&!u.hasOwnProperty(Ce))switch(Ce){case"selected":n.selected=!1;break;default:rt(n,r,Ce,null,u,te)}for(F in u)if(te=u[F],ie=l[F],u.hasOwnProperty(F)&&te!==ie&&(te!=null||ie!=null))switch(F){case"selected":n.selected=te&&typeof te!="function"&&typeof te!="symbol";break;default:rt(n,r,F,te,u,ie)}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 Ae in l)te=l[Ae],l.hasOwnProperty(Ae)&&te!=null&&!u.hasOwnProperty(Ae)&&rt(n,r,Ae,null,u,te);for(ee in u)if(te=u[ee],ie=l[ee],u.hasOwnProperty(ee)&&te!==ie&&(te!=null||ie!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(i(137,r));break;default:rt(n,r,ee,te,u,ie)}return;default:if(Qd(r)){for(var at in l)te=l[at],l.hasOwnProperty(at)&&te!==void 0&&!u.hasOwnProperty(at)&&Ip(n,r,at,void 0,u,te);for(ae in u)te=u[ae],ie=l[ae],!u.hasOwnProperty(ae)||te===ie||te===void 0&&ie===void 0||Ip(n,r,ae,te,u,ie);return}}for(var Z in l)te=l[Z],l.hasOwnProperty(Z)&&te!=null&&!u.hasOwnProperty(Z)&&rt(n,r,Z,null,u,te);for(he in u)te=u[he],ie=l[he],!u.hasOwnProperty(he)||te===ie||te==null&&ie==null||rt(n,r,he,te,u,ie)}function e0(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function fA(){if(typeof performance.getEntriesByType=="function"){for(var n=0,r=0,l=performance.getEntriesByType("resource"),u=0;u<l.length;u++){var m=l[u],v=m.transferSize,x=m.initiatorType,R=m.duration;if(v&&R&&e0(x)){for(x=0,R=m.responseEnd,u+=1;u<l.length;u++){var F=l[u],ee=F.startTime;if(ee>R)break;var ae=F.transferSize,he=F.initiatorType;ae&&e0(he)&&(F=F.responseEnd,x+=ae*(F<R?1:(R-ee)/(F-ee)))}if(--u,r+=8*(v+x)/(m.duration/1e3),n++,10<n)break}}if(0<n)return r/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var zp=null,Hp=null;function Gu(n){return n.nodeType===9?n:n.ownerDocument}function t0(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function s0(n,r){if(n===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&r==="foreignObject"?0:n}function Up(n,r){return n==="textarea"||n==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var Fp=null;function pA(){var n=window.event;return n&&n.type==="popstate"?n===Fp?!1:(Fp=n,!0):(Fp=null,!1)}var i0=typeof setTimeout=="function"?setTimeout:void 0,mA=typeof clearTimeout=="function"?clearTimeout:void 0,n0=typeof Promise=="function"?Promise:void 0,gA=typeof queueMicrotask=="function"?queueMicrotask:typeof n0<"u"?function(n){return n0.resolve(null).then(n).catch(_A)}:i0;function _A(n){setTimeout(function(){throw n})}function Yn(n){return n==="head"}function r0(n,r){var l=r,u=0;do{var m=l.nextSibling;if(n.removeChild(l),m&&m.nodeType===8)if(l=m.data,l==="/$"||l==="/&"){if(u===0){n.removeChild(m),fo(r);return}u--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")u++;else if(l==="html")Ol(n.ownerDocument.documentElement);else if(l==="head"){l=n.ownerDocument.head,Ol(l);for(var v=l.firstChild;v;){var x=v.nextSibling,R=v.nodeName;v[Zo]||R==="SCRIPT"||R==="STYLE"||R==="LINK"&&v.rel.toLowerCase()==="stylesheet"||l.removeChild(v),v=x}}else l==="body"&&Ol(n.ownerDocument.body);l=m}while(l);fo(r)}function a0(n,r){var l=n;n=0;do{var u=l.nextSibling;if(l.nodeType===1?r?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(r?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),u&&u.nodeType===8)if(l=u.data,l==="/$"){if(n===0)break;n--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||n++;l=u}while(l)}function $p(n){var r=n.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var l=r;switch(r=r.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":$p(l),qd(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}n.removeChild(l)}}function vA(n,r,l,u){for(;n.nodeType===1;){var m=l;if(n.nodeName.toLowerCase()!==r.toLowerCase()){if(!u&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(u){if(!n[Zo])switch(r){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(v=n.getAttribute("rel"),v==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(v!==m.rel||n.getAttribute("href")!==(m.href==null||m.href===""?null:m.href)||n.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin)||n.getAttribute("title")!==(m.title==null?null:m.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(v=n.getAttribute("src"),(v!==(m.src==null?null:m.src)||n.getAttribute("type")!==(m.type==null?null:m.type)||n.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin))&&v&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(r==="input"&&n.type==="hidden"){var v=m.name==null?null:""+m.name;if(m.type==="hidden"&&n.getAttribute("name")===v)return n}else return n;if(n=ii(n.nextSibling),n===null)break}return null}function yA(n,r,l){if(r==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!l||(n=ii(n.nextSibling),n===null))return null;return n}function o0(n,r){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!r||(n=ii(n.nextSibling),n===null))return null;return n}function Vp(n){return n.data==="$?"||n.data==="$~"}function Wp(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function bA(n,r){var l=n.ownerDocument;if(n.data==="$~")n._reactRetry=r;else if(n.data!=="$?"||l.readyState!=="loading")r();else{var u=function(){r(),l.removeEventListener("DOMContentLoaded",u)};l.addEventListener("DOMContentLoaded",u),n._reactRetry=u}}function ii(n){for(;n!=null;n=n.nextSibling){var r=n.nodeType;if(r===1||r===3)break;if(r===8){if(r=n.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return n}var Gp=null;function l0(n){n=n.nextSibling;for(var r=0;n;){if(n.nodeType===8){var l=n.data;if(l==="/$"||l==="/&"){if(r===0)return ii(n.nextSibling);r--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||r++}n=n.nextSibling}return null}function c0(n){n=n.previousSibling;for(var r=0;n;){if(n.nodeType===8){var l=n.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(r===0)return n;r--}else l!=="/$"&&l!=="/&"||r++}n=n.previousSibling}return null}function u0(n,r,l){switch(r=Gu(l),n){case"html":if(n=r.documentElement,!n)throw Error(i(452));return n;case"head":if(n=r.head,!n)throw Error(i(453));return n;case"body":if(n=r.body,!n)throw Error(i(454));return n;default:throw Error(i(451))}}function Ol(n){for(var r=n.attributes;r.length;)n.removeAttributeNode(r[0]);qd(n)}var ni=new Map,h0=new Set;function qu(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var fn=z.d;z.d={f:SA,r:wA,D:CA,C:xA,L:kA,m:EA,X:NA,S:TA,M:AA};function SA(){var n=fn.f(),r=Iu();return n||r}function wA(n){var r=Da(n);r!==null&&r.tag===5&&r.type==="form"?Nb(r):fn.r(n)}var co=typeof document>"u"?null:document;function d0(n,r,l){var u=co;if(u&&typeof r=="string"&&r){var m=Xs(r);m='link[rel="'+n+'"][href="'+m+'"]',typeof l=="string"&&(m+='[crossorigin="'+l+'"]'),h0.has(m)||(h0.add(m),n={rel:n,crossOrigin:l,href:r},u.querySelector(m)===null&&(r=u.createElement("link"),os(r,"link",n),qt(r),u.head.appendChild(r)))}}function CA(n){fn.D(n),d0("dns-prefetch",n,null)}function xA(n,r){fn.C(n,r),d0("preconnect",n,r)}function kA(n,r,l){fn.L(n,r,l);var u=co;if(u&&n&&r){var m='link[rel="preload"][as="'+Xs(r)+'"]';r==="image"&&l&&l.imageSrcSet?(m+='[imagesrcset="'+Xs(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(m+='[imagesizes="'+Xs(l.imageSizes)+'"]')):m+='[href="'+Xs(n)+'"]';var v=m;switch(r){case"style":v=uo(n);break;case"script":v=ho(n)}ni.has(v)||(n=_({rel:"preload",href:r==="image"&&l&&l.imageSrcSet?void 0:n,as:r},l),ni.set(v,n),u.querySelector(m)!==null||r==="style"&&u.querySelector(jl(v))||r==="script"&&u.querySelector(Pl(v))||(r=u.createElement("link"),os(r,"link",n),qt(r),u.head.appendChild(r)))}}function EA(n,r){fn.m(n,r);var l=co;if(l&&n){var u=r&&typeof r.as=="string"?r.as:"script",m='link[rel="modulepreload"][as="'+Xs(u)+'"][href="'+Xs(n)+'"]',v=m;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=ho(n)}if(!ni.has(v)&&(n=_({rel:"modulepreload",href:n},r),ni.set(v,n),l.querySelector(m)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Pl(v)))return}u=l.createElement("link"),os(u,"link",n),qt(u),l.head.appendChild(u)}}}function TA(n,r,l){fn.S(n,r,l);var u=co;if(u&&n){var m=La(u).hoistableStyles,v=uo(n);r=r||"default";var x=m.get(v);if(!x){var R={loading:0,preload:null};if(x=u.querySelector(jl(v)))R.loading=5;else{n=_({rel:"stylesheet",href:n,"data-precedence":r},l),(l=ni.get(v))&&qp(n,l);var F=x=u.createElement("link");qt(F),os(F,"link",n),F._p=new Promise(function(ee,ae){F.onload=ee,F.onerror=ae}),F.addEventListener("load",function(){R.loading|=1}),F.addEventListener("error",function(){R.loading|=2}),R.loading|=4,Ku(x,r,u)}x={type:"stylesheet",instance:x,count:1,state:R},m.set(v,x)}}}function NA(n,r){fn.X(n,r);var l=co;if(l&&n){var u=La(l).hoistableScripts,m=ho(n),v=u.get(m);v||(v=l.querySelector(Pl(m)),v||(n=_({src:n,async:!0},r),(r=ni.get(m))&&Kp(n,r),v=l.createElement("script"),qt(v),os(v,"link",n),l.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},u.set(m,v))}}function AA(n,r){fn.M(n,r);var l=co;if(l&&n){var u=La(l).hoistableScripts,m=ho(n),v=u.get(m);v||(v=l.querySelector(Pl(m)),v||(n=_({src:n,async:!0,type:"module"},r),(r=ni.get(m))&&Kp(n,r),v=l.createElement("script"),qt(v),os(v,"link",n),l.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},u.set(m,v))}}function f0(n,r,l,u){var m=(m=Se.current)?qu(m):null;if(!m)throw Error(i(446));switch(n){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(r=uo(l.href),l=La(m).hoistableStyles,u=l.get(r),u||(u={type:"style",instance:null,count:0,state:null},l.set(r,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){n=uo(l.href);var v=La(m).hoistableStyles,x=v.get(n);if(x||(m=m.ownerDocument||m,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(n,x),(v=m.querySelector(jl(n)))&&!v._p&&(x.instance=v,x.state.loading=5),ni.has(n)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},ni.set(n,l),v||RA(m,n,l,x.state))),r&&u===null)throw Error(i(528,""));return x}if(r&&u!==null)throw Error(i(529,""));return null;case"script":return r=l.async,l=l.src,typeof l=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=ho(l),l=La(m).hoistableScripts,u=l.get(r),u||(u={type:"script",instance:null,count:0,state:null},l.set(r,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,n))}}function uo(n){return'href="'+Xs(n)+'"'}function jl(n){return'link[rel="stylesheet"]['+n+"]"}function p0(n){return _({},n,{"data-precedence":n.precedence,precedence:null})}function RA(n,r,l,u){n.querySelector('link[rel="preload"][as="style"]['+r+"]")?u.loading=1:(r=n.createElement("link"),u.preload=r,r.addEventListener("load",function(){return u.loading|=1}),r.addEventListener("error",function(){return u.loading|=2}),os(r,"link",l),qt(r),n.head.appendChild(r))}function ho(n){return'[src="'+Xs(n)+'"]'}function Pl(n){return"script[async]"+n}function m0(n,r,l){if(r.count++,r.instance===null)switch(r.type){case"style":var u=n.querySelector('style[data-href~="'+Xs(l.href)+'"]');if(u)return r.instance=u,qt(u),u;var m=_({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return u=(n.ownerDocument||n).createElement("style"),qt(u),os(u,"style",m),Ku(u,l.precedence,n),r.instance=u;case"stylesheet":m=uo(l.href);var v=n.querySelector(jl(m));if(v)return r.state.loading|=4,r.instance=v,qt(v),v;u=p0(l),(m=ni.get(m))&&qp(u,m),v=(n.ownerDocument||n).createElement("link"),qt(v);var x=v;return x._p=new Promise(function(R,F){x.onload=R,x.onerror=F}),os(v,"link",u),r.state.loading|=4,Ku(v,l.precedence,n),r.instance=v;case"script":return v=ho(l.src),(m=n.querySelector(Pl(v)))?(r.instance=m,qt(m),m):(u=l,(m=ni.get(v))&&(u=_({},l),Kp(u,m)),n=n.ownerDocument||n,m=n.createElement("script"),qt(m),os(m,"link",u),n.head.appendChild(m),r.instance=m);case"void":return null;default:throw Error(i(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(u=r.instance,r.state.loading|=4,Ku(u,l.precedence,n));return r.instance}function Ku(n,r,l){for(var u=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=u.length?u[u.length-1]:null,v=m,x=0;x<u.length;x++){var R=u[x];if(R.dataset.precedence===r)v=R;else if(v!==m)break}v?v.parentNode.insertBefore(n,v.nextSibling):(r=l.nodeType===9?l.head:l,r.insertBefore(n,r.firstChild))}function qp(n,r){n.crossOrigin==null&&(n.crossOrigin=r.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=r.referrerPolicy),n.title==null&&(n.title=r.title)}function Kp(n,r){n.crossOrigin==null&&(n.crossOrigin=r.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=r.referrerPolicy),n.integrity==null&&(n.integrity=r.integrity)}var Yu=null;function g0(n,r,l){if(Yu===null){var u=new Map,m=Yu=new Map;m.set(l,u)}else m=Yu,u=m.get(l),u||(u=new Map,m.set(l,u));if(u.has(n))return u;for(u.set(n,null),l=l.getElementsByTagName(n),m=0;m<l.length;m++){var v=l[m];if(!(v[Zo]||v[is]||n==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var x=v.getAttribute(r)||"";x=n+x;var R=u.get(x);R?R.push(v):u.set(x,[v])}}return u}function _0(n,r,l){n=n.ownerDocument||n,n.head.insertBefore(l,r==="title"?n.querySelector("head > title"):null)}function DA(n,r,l){if(l===1||r.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;switch(r.rel){case"stylesheet":return n=r.disabled,typeof r.precedence=="string"&&n==null;default:return!0}case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function v0(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function LA(n,r,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 m=uo(u.href),v=r.querySelector(jl(m));if(v){r=v._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(n.count++,n=Xu.bind(n),r.then(n,n)),l.state.loading|=4,l.instance=v,qt(v);return}v=r.ownerDocument||r,u=p0(u),(m=ni.get(m))&&qp(u,m),v=v.createElement("link"),qt(v);var x=v;x._p=new Promise(function(R,F){x.onload=R,x.onerror=F}),os(v,"link",u),l.instance=v}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(l,r),(r=l.state.preload)&&(l.state.loading&3)===0&&(n.count++,l=Xu.bind(n),r.addEventListener("load",l),r.addEventListener("error",l))}}var Yp=0;function MA(n,r){return n.stylesheets&&n.count===0&&Zu(n,n.stylesheets),0<n.count||0<n.imgCount?function(l){var u=setTimeout(function(){if(n.stylesheets&&Zu(n,n.stylesheets),n.unsuspend){var v=n.unsuspend;n.unsuspend=null,v()}},6e4+r);0<n.imgBytes&&Yp===0&&(Yp=62500*fA());var m=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&Zu(n,n.stylesheets),n.unsuspend)){var v=n.unsuspend;n.unsuspend=null,v()}},(n.imgBytes>Yp?50:800)+r);return n.unsuspend=l,function(){n.unsuspend=null,clearTimeout(u),clearTimeout(m)}}:null}function Xu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Zu(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var Qu=null;function Zu(n,r){n.stylesheets=null,n.unsuspend!==null&&(n.count++,Qu=new Map,r.forEach(OA,n),Qu=null,Xu.call(n))}function OA(n,r){if(!(r.state.loading&4)){var l=Qu.get(n);if(l)var u=l.get(null);else{l=new Map,Qu.set(n,l);for(var m=n.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<m.length;v++){var x=m[v];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(l.set(x.dataset.precedence,x),u=x)}u&&l.set(null,u)}m=r.instance,x=m.getAttribute("data-precedence"),v=l.get(x)||u,v===u&&l.set(null,m),l.set(x,m),this.count++,u=Xu.bind(this),m.addEventListener("load",u),m.addEventListener("error",u),v?v.parentNode.insertBefore(m,v.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(m,n.firstChild)),r.state.loading|=4}}var Bl={$$typeof:N,Provider:null,Consumer:null,_currentValue:Q,_currentValue2:Q,_threadCount:0};function jA(n,r,l,u,m,v,x,R,F){this.tag=1,this.containerInfo=n,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=$d(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$d(0),this.hiddenUpdates=$d(null),this.identifierPrefix=u,this.onUncaughtError=m,this.onCaughtError=v,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=F,this.incompleteTransitions=new Map}function y0(n,r,l,u,m,v,x,R,F,ee,ae,he){return n=new jA(n,r,l,x,F,ee,ae,he,R),r=1,v===!0&&(r|=24),v=Ps(3,null,null,r),n.current=v,v.stateNode=n,r=Nf(),r.refCount++,n.pooledCache=r,r.refCount++,v.memoizedState={element:u,isDehydrated:l,cache:r},Lf(v),n}function b0(n){return n?(n=Fa,n):Fa}function S0(n,r,l,u,m,v){m=b0(m),u.context===null?u.context=m:u.pendingContext=m,u=In(r),u.payload={element:l},v=v===void 0?null:v,v!==null&&(u.callback=v),l=zn(n,u,r),l!==null&&(Rs(l,n,r),ml(l,n,r))}function w0(n,r){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var l=n.retryLane;n.retryLane=l!==0&&l<r?l:r}}function Xp(n,r){w0(n,r),(n=n.alternate)&&w0(n,r)}function C0(n){if(n.tag===13||n.tag===31){var r=Dr(n,67108864);r!==null&&Rs(r,n,67108864),Xp(n,67108864)}}function x0(n){if(n.tag===13||n.tag===31){var r=Us();r=Vd(r);var l=Dr(n,r);l!==null&&Rs(l,n,r),Xp(n,r)}}var Ju=!0;function PA(n,r,l,u){var m=O.T;O.T=null;var v=z.p;try{z.p=2,Qp(n,r,l,u)}finally{z.p=v,O.T=m}}function BA(n,r,l,u){var m=O.T;O.T=null;var v=z.p;try{z.p=8,Qp(n,r,l,u)}finally{z.p=v,O.T=m}}function Qp(n,r,l,u){if(Ju){var m=Zp(u);if(m===null)Bp(n,r,u,eh,l),E0(n,u);else if(zA(m,n,r,l,u))u.stopPropagation();else if(E0(n,u),r&4&&-1<IA.indexOf(n)){for(;m!==null;){var v=Da(m);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var x=Ki(v.pendingLanes);if(x!==0){var R=v;for(R.pendingLanes|=2,R.entangledLanes|=2;x;){var F=1<<31-Gt(x);R.entanglements[1]|=F,x&=~F}Mi(v),(et&6)===0&&(Pu=bt()+500,Dl(0))}}break;case 31:case 13:R=Dr(v,2),R!==null&&Rs(R,v,2),Iu(),Xp(v,2)}if(v=Zp(u),v===null&&Bp(n,r,u,eh,l),v===m)break;m=v}m!==null&&u.stopPropagation()}else Bp(n,r,u,null,l)}}function Zp(n){return n=Jd(n),Jp(n)}var eh=null;function Jp(n){if(eh=null,n=Ra(n),n!==null){var r=o(n);if(r===null)n=null;else{var l=r.tag;if(l===13){if(n=c(r),n!==null)return n;n=null}else if(l===31){if(n=d(r),n!==null)return n;n=null}else if(l===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;n=null}else r!==n&&(n=null)}}return eh=n,null}function k0(n){switch(n){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(Ei()){case Ta:return 2;case $c:return 8;case Na:case Ko:return 32;case Vc:return 268435456;default:return 32}default:return 32}}var em=!1,Xn=null,Qn=null,Zn=null,Il=new Map,zl=new Map,Jn=[],IA="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 E0(n,r){switch(n){case"focusin":case"focusout":Xn=null;break;case"dragenter":case"dragleave":Qn=null;break;case"mouseover":case"mouseout":Zn=null;break;case"pointerover":case"pointerout":Il.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":zl.delete(r.pointerId)}}function Hl(n,r,l,u,m,v){return n===null||n.nativeEvent!==v?(n={blockedOn:r,domEventName:l,eventSystemFlags:u,nativeEvent:v,targetContainers:[m]},r!==null&&(r=Da(r),r!==null&&C0(r)),n):(n.eventSystemFlags|=u,r=n.targetContainers,m!==null&&r.indexOf(m)===-1&&r.push(m),n)}function zA(n,r,l,u,m){switch(r){case"focusin":return Xn=Hl(Xn,n,r,l,u,m),!0;case"dragenter":return Qn=Hl(Qn,n,r,l,u,m),!0;case"mouseover":return Zn=Hl(Zn,n,r,l,u,m),!0;case"pointerover":var v=m.pointerId;return Il.set(v,Hl(Il.get(v)||null,n,r,l,u,m)),!0;case"gotpointercapture":return v=m.pointerId,zl.set(v,Hl(zl.get(v)||null,n,r,l,u,m)),!0}return!1}function T0(n){var r=Ra(n.target);if(r!==null){var l=o(r);if(l!==null){if(r=l.tag,r===13){if(r=c(l),r!==null){n.blockedOn=r,Uv(n.priority,function(){x0(l)});return}}else if(r===31){if(r=d(l),r!==null){n.blockedOn=r,Uv(n.priority,function(){x0(l)});return}}else if(r===3&&l.stateNode.current.memoizedState.isDehydrated){n.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}n.blockedOn=null}function th(n){if(n.blockedOn!==null)return!1;for(var r=n.targetContainers;0<r.length;){var l=Zp(n.nativeEvent);if(l===null){l=n.nativeEvent;var u=new l.constructor(l.type,l);Zd=u,l.target.dispatchEvent(u),Zd=null}else return r=Da(l),r!==null&&C0(r),n.blockedOn=l,!1;r.shift()}return!0}function N0(n,r,l){th(n)&&l.delete(r)}function HA(){em=!1,Xn!==null&&th(Xn)&&(Xn=null),Qn!==null&&th(Qn)&&(Qn=null),Zn!==null&&th(Zn)&&(Zn=null),Il.forEach(N0),zl.forEach(N0)}function sh(n,r){n.blockedOn===r&&(n.blockedOn=null,em||(em=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,HA)))}var ih=null;function A0(n){ih!==n&&(ih=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){ih===n&&(ih=null);for(var r=0;r<n.length;r+=3){var l=n[r],u=n[r+1],m=n[r+2];if(typeof u!="function"){if(Jp(u||l)===null)continue;break}var v=Da(l);v!==null&&(n.splice(r,3),r-=3,Zf(v,{pending:!0,data:m,method:l.method,action:u},u,m))}}))}function fo(n){function r(F){return sh(F,n)}Xn!==null&&sh(Xn,n),Qn!==null&&sh(Qn,n),Zn!==null&&sh(Zn,n),Il.forEach(r),zl.forEach(r);for(var l=0;l<Jn.length;l++){var u=Jn[l];u.blockedOn===n&&(u.blockedOn=null)}for(;0<Jn.length&&(l=Jn[0],l.blockedOn===null);)T0(l),l.blockedOn===null&&Jn.shift();if(l=(n.ownerDocument||n).$$reactFormReplay,l!=null)for(u=0;u<l.length;u+=3){var m=l[u],v=l[u+1],x=m[xs]||null;if(typeof v=="function")x||A0(l);else if(x){var R=null;if(v&&v.hasAttribute("formAction")){if(m=v,x=v[xs]||null)R=x.formAction;else if(Jp(m)!==null)continue}else R=x.action;typeof R=="function"?l[u+1]=R:(l.splice(u,3),u-=3),A0(l)}}}function R0(){function n(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(x){return m=x})},focusReset:"manual",scroll:"manual"})}function r(){m!==null&&(m(),m=null),u||setTimeout(l,20)}function l(){if(!u&&!navigation.transition){var v=navigation.currentEntry;v&&v.url!=null&&navigation.navigate(v.url,{state:v.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var u=!1,m=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(l,100),function(){u=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),m!==null&&(m(),m=null)}}}function tm(n){this._internalRoot=n}nh.prototype.render=tm.prototype.render=function(n){var r=this._internalRoot;if(r===null)throw Error(i(409));var l=r.current,u=Us();S0(l,u,n,r,null,null)},nh.prototype.unmount=tm.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var r=n.containerInfo;S0(n.current,2,null,n,null,null),Iu(),r[Aa]=null}};function nh(n){this._internalRoot=n}nh.prototype.unstable_scheduleHydration=function(n){if(n){var r=Hv();n={blockedOn:null,target:n,priority:r};for(var l=0;l<Jn.length&&r!==0&&r<Jn[l].priority;l++);Jn.splice(l,0,n),l===0&&T0(n)}};var D0=t.version;if(D0!=="19.2.4")throw Error(i(527,D0,"19.2.4"));z.findDOMNode=function(n){var r=n._reactInternals;if(r===void 0)throw typeof n.render=="function"?Error(i(188)):(n=Object.keys(n).join(","),Error(i(268,n)));return n=h(r),n=n!==null?g(n):null,n=n===null?null:n.stateNode,n};var UA={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:O,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var rh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!rh.isDisabled&&rh.supportsFiber)try{Er=rh.inject(UA),gs=rh}catch{}}return Fl.createRoot=function(n,r){if(!a(n))throw Error(i(299));var l=!1,u="",m=Ib,v=zb,x=Hb;return r!=null&&(r.unstable_strictMode===!0&&(l=!0),r.identifierPrefix!==void 0&&(u=r.identifierPrefix),r.onUncaughtError!==void 0&&(m=r.onUncaughtError),r.onCaughtError!==void 0&&(v=r.onCaughtError),r.onRecoverableError!==void 0&&(x=r.onRecoverableError)),r=y0(n,1,!1,null,null,l,u,null,m,v,x,R0),n[Aa]=r.current,Pp(n),new tm(r)},Fl.hydrateRoot=function(n,r,l){if(!a(n))throw Error(i(299));var u=!1,m="",v=Ib,x=zb,R=Hb,F=null;return l!=null&&(l.unstable_strictMode===!0&&(u=!0),l.identifierPrefix!==void 0&&(m=l.identifierPrefix),l.onUncaughtError!==void 0&&(v=l.onUncaughtError),l.onCaughtError!==void 0&&(x=l.onCaughtError),l.onRecoverableError!==void 0&&(R=l.onRecoverableError),l.formState!==void 0&&(F=l.formState)),r=y0(n,1,!0,r,l??null,u,m,F,v,x,R,R0),r.context=b0(null),l=r.current,u=Us(),u=Vd(u),m=In(u),m.callback=null,zn(l,m,u),l=u,r.current.lanes=l,Qo(r,l),Mi(r),n[Aa]=r.current,Pp(n),new nh(r)},Fl.version="19.2.4",Fl}var $0;function tR(){if($0)return rm.exports;$0=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),rm.exports=eR(),rm.exports}var sR=tR();const iR=XC(sR);var Oc=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ra,cr,ko,BC,nR=(BC=class extends Oc{constructor(){super();ke(this,ra);ke(this,cr);ke(this,ko);ye(this,ko,t=>{if(typeof window<"u"&&window.addEventListener){const s=()=>t();return window.addEventListener("visibilitychange",s,!1),()=>{window.removeEventListener("visibilitychange",s)}}})}onSubscribe(){V(this,cr)||this.setEventListener(V(this,ko))}onUnsubscribe(){var t;this.hasListeners()||((t=V(this,cr))==null||t.call(this),ye(this,cr,void 0))}setEventListener(t){var s;ye(this,ko,t),(s=V(this,cr))==null||s.call(this),ye(this,cr,t(i=>{typeof i=="boolean"?this.setFocused(i):this.onFocus()}))}setFocused(t){V(this,ra)!==t&&(ye(this,ra,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(s=>{s(t)})}isFocused(){var t;return typeof V(this,ra)=="boolean"?V(this,ra):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},ra=new WeakMap,cr=new WeakMap,ko=new WeakMap,BC),F_=new nR,rR={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},ur,H_,IC,aR=(IC=class{constructor(){ke(this,ur,rR);ke(this,H_,!1)}setTimeoutProvider(e){ye(this,ur,e)}setTimeout(e,t){return V(this,ur).setTimeout(e,t)}clearTimeout(e){V(this,ur).clearTimeout(e)}setInterval(e,t){return V(this,ur).setInterval(e,t)}clearInterval(e){V(this,ur).clearInterval(e)}},ur=new WeakMap,H_=new WeakMap,IC),Jr=new aR;function oR(e){setTimeout(e,0)}var lR=typeof window>"u"||"Deno"in globalThis;function Ms(){}function cR(e,t){return typeof e=="function"?e(t):e}function ig(e){return typeof e=="number"&&e>=0&&e!==1/0}function QC(e,t){return Math.max(e+(t||0)-Date.now(),0)}function br(e,t){return typeof e=="function"?e(t):e}function ui(e,t){return typeof e=="function"?e(t):e}function V0(e,t){const{type:s="all",exact:i,fetchStatus:a,predicate:o,queryKey:c,stale:d}=e;if(c){if(i){if(t.queryHash!==$_(c,t.options))return!1}else if(!vc(t.queryKey,c))return!1}if(s!=="all"){const f=t.isActive();if(s==="active"&&!f||s==="inactive"&&f)return!1}return!(typeof d=="boolean"&&t.isStale()!==d||a&&a!==t.state.fetchStatus||o&&!o(t))}function W0(e,t){const{exact:s,status:i,predicate:a,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(s){if(_c(t.options.mutationKey)!==_c(o))return!1}else if(!vc(t.options.mutationKey,o))return!1}return!(i&&t.state.status!==i||a&&!a(t))}function $_(e,t){return((t==null?void 0:t.queryKeyHashFn)||_c)(e)}function _c(e){return JSON.stringify(e,(t,s)=>rg(s)?Object.keys(s).sort().reduce((i,a)=>(i[a]=s[a],i),{}):s)}function vc(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(s=>vc(e[s],t[s])):!1}var uR=Object.prototype.hasOwnProperty;function ZC(e,t,s=0){if(e===t)return e;if(s>500)return t;const i=G0(e)&&G0(t);if(!i&&!(rg(e)&&rg(t)))return t;const o=(i?e:Object.keys(e)).length,c=i?t:Object.keys(t),d=c.length,f=i?new Array(d):{};let h=0;for(let g=0;g<d;g++){const _=i?g:c[g],y=e[_],b=t[_];if(y===b){f[_]=y,(i?g<o:uR.call(e,_))&&h++;continue}if(y===null||b===null||typeof y!="object"||typeof b!="object"){f[_]=b;continue}const S=ZC(y,b,s+1);f[_]=S,S===y&&h++}return o===d&&h===o?e:f}function ng(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const s in e)if(e[s]!==t[s])return!1;return!0}function G0(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function rg(e){if(!q0(e))return!1;const t=e.constructor;if(t===void 0)return!0;const s=t.prototype;return!(!q0(s)||!s.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function q0(e){return Object.prototype.toString.call(e)==="[object Object]"}function hR(e){return new Promise(t=>{Jr.setTimeout(t,e)})}function ag(e,t,s){return typeof s.structuralSharing=="function"?s.structuralSharing(e,t):s.structuralSharing!==!1?ZC(e,t):t}function dR(e,t,s=0){const i=[...e,t];return s&&i.length>s?i.slice(1):i}function fR(e,t,s=0){const i=[t,...e];return s&&i.length>s?i.slice(0,-1):i}var V_=Symbol();function JC(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===V_?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ex(e,t){return typeof e=="function"?e(...t):!!e}function pR(e,t,s){let i=!1,a;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(a??(a=t()),i||(i=!0,a.aborted?s():a.addEventListener("abort",s,{once:!0})),a)}),e}var yc=(()=>{let e=()=>lR;return{isServer(){return e()},setIsServer(t){e=t}}})();function og(){let e,t;const s=new Promise((a,o)=>{e=a,t=o});s.status="pending",s.catch(()=>{});function i(a){Object.assign(s,a),delete s.resolve,delete s.reject}return s.resolve=a=>{i({status:"fulfilled",value:a}),e(a)},s.reject=a=>{i({status:"rejected",reason:a}),t(a)},s}var mR=oR;function gR(){let e=[],t=0,s=d=>{d()},i=d=>{d()},a=mR;const o=d=>{t?e.push(d):a(()=>{s(d)})},c=()=>{const d=e;e=[],d.length&&a(()=>{i(()=>{d.forEach(f=>{s(f)})})})};return{batch:d=>{let f;t++;try{f=d()}finally{t--,t||c()}return f},batchCalls:d=>(...f)=>{o(()=>{d(...f)})},schedule:o,setNotifyFunction:d=>{s=d},setBatchNotifyFunction:d=>{i=d},setScheduler:d=>{a=d}}}var cs=gR(),Eo,hr,To,zC,_R=(zC=class extends Oc{constructor(){super();ke(this,Eo,!0);ke(this,hr);ke(this,To);ye(this,To,t=>{if(typeof window<"u"&&window.addEventListener){const s=()=>t(!0),i=()=>t(!1);return window.addEventListener("online",s,!1),window.addEventListener("offline",i,!1),()=>{window.removeEventListener("online",s),window.removeEventListener("offline",i)}}})}onSubscribe(){V(this,hr)||this.setEventListener(V(this,To))}onUnsubscribe(){var t;this.hasListeners()||((t=V(this,hr))==null||t.call(this),ye(this,hr,void 0))}setEventListener(t){var s;ye(this,To,t),(s=V(this,hr))==null||s.call(this),ye(this,hr,t(this.setOnline.bind(this)))}setOnline(t){V(this,Eo)!==t&&(ye(this,Eo,t),this.listeners.forEach(i=>{i(t)}))}isOnline(){return V(this,Eo)}},Eo=new WeakMap,hr=new WeakMap,To=new WeakMap,zC),Gh=new _R;function vR(e){return Math.min(1e3*2**e,3e4)}function tx(e){return(e??"online")==="online"?Gh.isOnline():!0}var lg=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function sx(e){let t=!1,s=0,i;const a=og(),o=()=>a.status!=="pending",c=w=>{var k;if(!o()){const T=new lg(w);y(T),(k=e.onCancel)==null||k.call(e,T)}},d=()=>{t=!0},f=()=>{t=!1},h=()=>F_.isFocused()&&(e.networkMode==="always"||Gh.isOnline())&&e.canRun(),g=()=>tx(e.networkMode)&&e.canRun(),_=w=>{o()||(i==null||i(),a.resolve(w))},y=w=>{o()||(i==null||i(),a.reject(w))},b=()=>new Promise(w=>{var k;i=T=>{(o()||h())&&w(T)},(k=e.onPause)==null||k.call(e)}).then(()=>{var w;i=void 0,o()||(w=e.onContinue)==null||w.call(e)}),S=()=>{if(o())return;let w;const k=s===0?e.initialPromise:void 0;try{w=k??e.fn()}catch(T){w=Promise.reject(T)}Promise.resolve(w).then(_).catch(T=>{var U;if(o())return;const D=e.retry??(yc.isServer()?0:3),N=e.retryDelay??vR,E=typeof N=="function"?N(s,T):N,M=D===!0||typeof D=="number"&&s<D||typeof D=="function"&&D(s,T);if(t||!M){y(T);return}s++,(U=e.onFail)==null||U.call(e,s,T),hR(E).then(()=>h()?void 0:b()).then(()=>{t?y(T):S()})})};return{promise:a,status:()=>a.status,cancel:c,continue:()=>(i==null||i(),a),cancelRetry:d,continueRetry:f,canStart:g,start:()=>(g()?S():b().then(S),a)}}var aa,HC,ix=(HC=class{constructor(){ke(this,aa)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ig(this.gcTime)&&ye(this,aa,Jr.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(yc.isServer()?1/0:300*1e3))}clearGcTimeout(){V(this,aa)&&(Jr.clearTimeout(V(this,aa)),ye(this,aa,void 0))}},aa=new WeakMap,HC),oa,No,ci,la,Yt,Nc,ca,Ws,nx,vn,UC,yR=(UC=class extends ix{constructor(t){super();ke(this,Ws);ke(this,oa);ke(this,No);ke(this,ci);ke(this,la);ke(this,Yt);ke(this,Nc);ke(this,ca);ye(this,ca,!1),ye(this,Nc,t.defaultOptions),this.setOptions(t.options),this.observers=[],ye(this,la,t.client),ye(this,ci,V(this,la).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,ye(this,oa,Y0(this.options)),this.state=t.state??V(this,oa),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=V(this,Yt))==null?void 0:t.promise}setOptions(t){if(this.options={...V(this,Nc),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const s=Y0(this.options);s.data!==void 0&&(this.setState(K0(s.data,s.dataUpdatedAt)),ye(this,oa,s))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&V(this,ci).remove(this)}setData(t,s){const i=ag(this.state.data,t,this.options);return Fe(this,Ws,vn).call(this,{data:i,type:"success",dataUpdatedAt:s==null?void 0:s.updatedAt,manual:s==null?void 0:s.manual}),i}setState(t,s){Fe(this,Ws,vn).call(this,{type:"setState",state:t,setStateOptions:s})}cancel(t){var i,a;const s=(i=V(this,Yt))==null?void 0:i.promise;return(a=V(this,Yt))==null||a.cancel(t),s?s.then(Ms).catch(Ms):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return V(this,oa)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>ui(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===V_||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>br(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!QC(this.state.dataUpdatedAt,t)}onFocus(){var s;const t=this.observers.find(i=>i.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(s=V(this,Yt))==null||s.continue()}onOnline(){var s;const t=this.observers.find(i=>i.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(s=V(this,Yt))==null||s.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),V(this,ci).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(s=>s!==t),this.observers.length||(V(this,Yt)&&(V(this,ca)||Fe(this,Ws,nx).call(this)?V(this,Yt).cancel({revert:!0}):V(this,Yt).cancelRetry()),this.scheduleGc()),V(this,ci).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Fe(this,Ws,vn).call(this,{type:"invalidate"})}async fetch(t,s){var f,h,g,_,y,b,S,w,k,T,D,N;if(this.state.fetchStatus!=="idle"&&((f=V(this,Yt))==null?void 0:f.status())!=="rejected"){if(this.state.data!==void 0&&(s!=null&&s.cancelRefetch))this.cancel({silent:!0});else if(V(this,Yt))return V(this,Yt).continueRetry(),V(this,Yt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const E=this.observers.find(M=>M.options.queryFn);E&&this.setOptions(E.options)}const i=new AbortController,a=E=>{Object.defineProperty(E,"signal",{enumerable:!0,get:()=>(ye(this,ca,!0),i.signal)})},o=()=>{const E=JC(this.options,s),U=(()=>{const W={client:V(this,la),queryKey:this.queryKey,meta:this.meta};return a(W),W})();return ye(this,ca,!1),this.options.persister?this.options.persister(E,U,this):E(U)},d=(()=>{const E={fetchOptions:s,options:this.options,queryKey:this.queryKey,client:V(this,la),state:this.state,fetchFn:o};return a(E),E})();(h=this.options.behavior)==null||h.onFetch(d,this),ye(this,No,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((g=d.fetchOptions)==null?void 0:g.meta))&&Fe(this,Ws,vn).call(this,{type:"fetch",meta:(_=d.fetchOptions)==null?void 0:_.meta}),ye(this,Yt,sx({initialPromise:s==null?void 0:s.initialPromise,fn:d.fetchFn,onCancel:E=>{E instanceof lg&&E.revert&&this.setState({...V(this,No),fetchStatus:"idle"}),i.abort()},onFail:(E,M)=>{Fe(this,Ws,vn).call(this,{type:"failed",failureCount:E,error:M})},onPause:()=>{Fe(this,Ws,vn).call(this,{type:"pause"})},onContinue:()=>{Fe(this,Ws,vn).call(this,{type:"continue"})},retry:d.options.retry,retryDelay:d.options.retryDelay,networkMode:d.options.networkMode,canRun:()=>!0}));try{const E=await V(this,Yt).start();if(E===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(E),(b=(y=V(this,ci).config).onSuccess)==null||b.call(y,E,this),(w=(S=V(this,ci).config).onSettled)==null||w.call(S,E,this.state.error,this),E}catch(E){if(E instanceof lg){if(E.silent)return V(this,Yt).promise;if(E.revert){if(this.state.data===void 0)throw E;return this.state.data}}throw Fe(this,Ws,vn).call(this,{type:"error",error:E}),(T=(k=V(this,ci).config).onError)==null||T.call(k,E,this),(N=(D=V(this,ci).config).onSettled)==null||N.call(D,this.state.data,E,this),E}finally{this.scheduleGc()}}},oa=new WeakMap,No=new WeakMap,ci=new WeakMap,la=new WeakMap,Yt=new WeakMap,Nc=new WeakMap,ca=new WeakMap,Ws=new WeakSet,nx=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},vn=function(t){const s=i=>{switch(t.type){case"failed":return{...i,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...i,fetchStatus:"paused"};case"continue":return{...i,fetchStatus:"fetching"};case"fetch":return{...i,...rx(i.data,this.options),fetchMeta:t.meta??null};case"success":const a={...i,...K0(t.data,t.dataUpdatedAt),dataUpdateCount:i.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ye(this,No,t.manual?a:void 0),a;case"error":const o=t.error;return{...i,error:o,errorUpdateCount:i.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:i.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...i,isInvalidated:!0};case"setState":return{...i,...t.state}}};this.state=s(this.state),cs.batch(()=>{this.observers.forEach(i=>{i.onQueryUpdate()}),V(this,ci).notify({query:this,type:"updated",action:t})})},UC);function rx(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:tx(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function K0(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Y0(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,s=t!==void 0,i=s?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:s?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}var Ls,Xe,Ac,ys,ua,Ao,yn,dr,Rc,Ro,Do,ha,da,fr,Lo,tt,Zl,cg,ug,hg,dg,fg,pg,mg,ax,FC,bR=(FC=class extends Oc{constructor(t,s){super();ke(this,tt);ke(this,Ls);ke(this,Xe);ke(this,Ac);ke(this,ys);ke(this,ua);ke(this,Ao);ke(this,yn);ke(this,dr);ke(this,Rc);ke(this,Ro);ke(this,Do);ke(this,ha);ke(this,da);ke(this,fr);ke(this,Lo,new Set);this.options=s,ye(this,Ls,t),ye(this,dr,null),ye(this,yn,og()),this.bindMethods(),this.setOptions(s)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(V(this,Xe).addObserver(this),X0(V(this,Xe),this.options)?Fe(this,tt,Zl).call(this):this.updateResult(),Fe(this,tt,dg).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return gg(V(this,Xe),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return gg(V(this,Xe),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Fe(this,tt,fg).call(this),Fe(this,tt,pg).call(this),V(this,Xe).removeObserver(this)}setOptions(t){const s=this.options,i=V(this,Xe);if(this.options=V(this,Ls).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ui(this.options.enabled,V(this,Xe))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Fe(this,tt,mg).call(this),V(this,Xe).setOptions(this.options),s._defaulted&&!ng(this.options,s)&&V(this,Ls).getQueryCache().notify({type:"observerOptionsUpdated",query:V(this,Xe),observer:this});const a=this.hasListeners();a&&Q0(V(this,Xe),i,this.options,s)&&Fe(this,tt,Zl).call(this),this.updateResult(),a&&(V(this,Xe)!==i||ui(this.options.enabled,V(this,Xe))!==ui(s.enabled,V(this,Xe))||br(this.options.staleTime,V(this,Xe))!==br(s.staleTime,V(this,Xe)))&&Fe(this,tt,cg).call(this);const o=Fe(this,tt,ug).call(this);a&&(V(this,Xe)!==i||ui(this.options.enabled,V(this,Xe))!==ui(s.enabled,V(this,Xe))||o!==V(this,fr))&&Fe(this,tt,hg).call(this,o)}getOptimisticResult(t){const s=V(this,Ls).getQueryCache().build(V(this,Ls),t),i=this.createResult(s,t);return wR(this,i)&&(ye(this,ys,i),ye(this,Ao,this.options),ye(this,ua,V(this,Xe).state)),i}getCurrentResult(){return V(this,ys)}trackResult(t,s){return new Proxy(t,{get:(i,a)=>(this.trackProp(a),s==null||s(a),a==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&V(this,yn).status==="pending"&&V(this,yn).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(i,a))})}trackProp(t){V(this,Lo).add(t)}getCurrentQuery(){return V(this,Xe)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const s=V(this,Ls).defaultQueryOptions(t),i=V(this,Ls).getQueryCache().build(V(this,Ls),s);return i.fetch().then(()=>this.createResult(i,s))}fetch(t){return Fe(this,tt,Zl).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),V(this,ys)))}createResult(t,s){var $;const i=V(this,Xe),a=this.options,o=V(this,ys),c=V(this,ua),d=V(this,Ao),h=t!==i?t.state:V(this,Ac),{state:g}=t;let _={...g},y=!1,b;if(s._optimisticResults){const Y=this.hasListeners(),K=!Y&&X0(t,s),X=Y&&Q0(t,i,s,a);(K||X)&&(_={..._,...rx(g.data,t.options)}),s._optimisticResults==="isRestoring"&&(_.fetchStatus="idle")}let{error:S,errorUpdatedAt:w,status:k}=_;b=_.data;let T=!1;if(s.placeholderData!==void 0&&b===void 0&&k==="pending"){let Y;o!=null&&o.isPlaceholderData&&s.placeholderData===(d==null?void 0:d.placeholderData)?(Y=o.data,T=!0):Y=typeof s.placeholderData=="function"?s.placeholderData(($=V(this,Do))==null?void 0:$.state.data,V(this,Do)):s.placeholderData,Y!==void 0&&(k="success",b=ag(o==null?void 0:o.data,Y,s),y=!0)}if(s.select&&b!==void 0&&!T)if(o&&b===(c==null?void 0:c.data)&&s.select===V(this,Rc))b=V(this,Ro);else try{ye(this,Rc,s.select),b=s.select(b),b=ag(o==null?void 0:o.data,b,s),ye(this,Ro,b),ye(this,dr,null)}catch(Y){ye(this,dr,Y)}V(this,dr)&&(S=V(this,dr),b=V(this,Ro),w=Date.now(),k="error");const D=_.fetchStatus==="fetching",N=k==="pending",E=k==="error",M=N&&D,U=b!==void 0,B={status:k,fetchStatus:_.fetchStatus,isPending:N,isSuccess:k==="success",isError:E,isInitialLoading:M,isLoading:M,data:b,dataUpdatedAt:_.dataUpdatedAt,error:S,errorUpdatedAt:w,failureCount:_.fetchFailureCount,failureReason:_.fetchFailureReason,errorUpdateCount:_.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:_.dataUpdateCount>h.dataUpdateCount||_.errorUpdateCount>h.errorUpdateCount,isFetching:D,isRefetching:D&&!N,isLoadingError:E&&!U,isPaused:_.fetchStatus==="paused",isPlaceholderData:y,isRefetchError:E&&U,isStale:W_(t,s),refetch:this.refetch,promise:V(this,yn),isEnabled:ui(s.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const Y=B.data!==void 0,K=B.status==="error"&&!Y,X=H=>{K?H.reject(B.error):Y&&H.resolve(B.data)},P=()=>{const H=ye(this,yn,B.promise=og());X(H)},j=V(this,yn);switch(j.status){case"pending":t.queryHash===i.queryHash&&X(j);break;case"fulfilled":(K||B.data!==j.value)&&P();break;case"rejected":(!K||B.error!==j.reason)&&P();break}}return B}updateResult(){const t=V(this,ys),s=this.createResult(V(this,Xe),this.options);if(ye(this,ua,V(this,Xe).state),ye(this,Ao,this.options),V(this,ua).data!==void 0&&ye(this,Do,V(this,Xe)),ng(s,t))return;ye(this,ys,s);const i=()=>{if(!t)return!0;const{notifyOnChangeProps:a}=this.options,o=typeof a=="function"?a():a;if(o==="all"||!o&&!V(this,Lo).size)return!0;const c=new Set(o??V(this,Lo));return this.options.throwOnError&&c.add("error"),Object.keys(V(this,ys)).some(d=>{const f=d;return V(this,ys)[f]!==t[f]&&c.has(f)})};Fe(this,tt,ax).call(this,{listeners:i()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Fe(this,tt,dg).call(this)}},Ls=new WeakMap,Xe=new WeakMap,Ac=new WeakMap,ys=new WeakMap,ua=new WeakMap,Ao=new WeakMap,yn=new WeakMap,dr=new WeakMap,Rc=new WeakMap,Ro=new WeakMap,Do=new WeakMap,ha=new WeakMap,da=new WeakMap,fr=new WeakMap,Lo=new WeakMap,tt=new WeakSet,Zl=function(t){Fe(this,tt,mg).call(this);let s=V(this,Xe).fetch(this.options,t);return t!=null&&t.throwOnError||(s=s.catch(Ms)),s},cg=function(){Fe(this,tt,fg).call(this);const t=br(this.options.staleTime,V(this,Xe));if(yc.isServer()||V(this,ys).isStale||!ig(t))return;const i=QC(V(this,ys).dataUpdatedAt,t)+1;ye(this,ha,Jr.setTimeout(()=>{V(this,ys).isStale||this.updateResult()},i))},ug=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(V(this,Xe)):this.options.refetchInterval)??!1},hg=function(t){Fe(this,tt,pg).call(this),ye(this,fr,t),!(yc.isServer()||ui(this.options.enabled,V(this,Xe))===!1||!ig(V(this,fr))||V(this,fr)===0)&&ye(this,da,Jr.setInterval(()=>{(this.options.refetchIntervalInBackground||F_.isFocused())&&Fe(this,tt,Zl).call(this)},V(this,fr)))},dg=function(){Fe(this,tt,cg).call(this),Fe(this,tt,hg).call(this,Fe(this,tt,ug).call(this))},fg=function(){V(this,ha)&&(Jr.clearTimeout(V(this,ha)),ye(this,ha,void 0))},pg=function(){V(this,da)&&(Jr.clearInterval(V(this,da)),ye(this,da,void 0))},mg=function(){const t=V(this,Ls).getQueryCache().build(V(this,Ls),this.options);if(t===V(this,Xe))return;const s=V(this,Xe);ye(this,Xe,t),ye(this,Ac,t.state),this.hasListeners()&&(s==null||s.removeObserver(this),t.addObserver(this))},ax=function(t){cs.batch(()=>{t.listeners&&this.listeners.forEach(s=>{s(V(this,ys))}),V(this,Ls).getQueryCache().notify({query:V(this,Xe),type:"observerResultsUpdated"})})},FC);function SR(e,t){return ui(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function X0(e,t){return SR(e,t)||e.state.data!==void 0&&gg(e,t,t.refetchOnMount)}function gg(e,t,s){if(ui(t.enabled,e)!==!1&&br(t.staleTime,e)!=="static"){const i=typeof s=="function"?s(e):s;return i==="always"||i!==!1&&W_(e,t)}return!1}function Q0(e,t,s,i){return(e!==t||ui(i.enabled,e)===!1)&&(!s.suspense||e.state.status!=="error")&&W_(e,s)}function W_(e,t){return ui(t.enabled,e)!==!1&&e.isStaleByTime(br(t.staleTime,e))}function wR(e,t){return!ng(e.getCurrentResult(),t)}function Z0(e){return{onFetch:(t,s)=>{var g,_,y,b,S;const i=t.options,a=(y=(_=(g=t.fetchOptions)==null?void 0:g.meta)==null?void 0:_.fetchMore)==null?void 0:y.direction,o=((b=t.state.data)==null?void 0:b.pages)||[],c=((S=t.state.data)==null?void 0:S.pageParams)||[];let d={pages:[],pageParams:[]},f=0;const h=async()=>{let w=!1;const k=N=>{pR(N,()=>t.signal,()=>w=!0)},T=JC(t.options,t.fetchOptions),D=async(N,E,M)=>{if(w)return Promise.reject();if(E==null&&N.pages.length)return Promise.resolve(N);const W=(()=>{const K={client:t.client,queryKey:t.queryKey,pageParam:E,direction:M?"backward":"forward",meta:t.options.meta};return k(K),K})(),B=await T(W),{maxPages:$}=t.options,Y=M?fR:dR;return{pages:Y(N.pages,B,$),pageParams:Y(N.pageParams,E,$)}};if(a&&o.length){const N=a==="backward",E=N?CR:J0,M={pages:o,pageParams:c},U=E(i,M);d=await D(M,U,N)}else{const N=e??o.length;do{const E=f===0?c[0]??i.initialPageParam:J0(i,d);if(f>0&&E==null)break;d=await D(d,E),f++}while(f<N)}return d};t.options.persister?t.fetchFn=()=>{var w,k;return(k=(w=t.options).persister)==null?void 0:k.call(w,h,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},s)}:t.fetchFn=h}}}function J0(e,{pages:t,pageParams:s}){const i=t.length-1;return t.length>0?e.getNextPageParam(t[i],t,s[i],s):void 0}function CR(e,{pages:t,pageParams:s}){var i;return t.length>0?(i=e.getPreviousPageParam)==null?void 0:i.call(e,t[0],t,s[0],s):void 0}var Dc,Hi,ps,fa,Ui,nr,$C,xR=($C=class extends ix{constructor(t){super();ke(this,Ui);ke(this,Dc);ke(this,Hi);ke(this,ps);ke(this,fa);ye(this,Dc,t.client),this.mutationId=t.mutationId,ye(this,ps,t.mutationCache),ye(this,Hi,[]),this.state=t.state||kR(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){V(this,Hi).includes(t)||(V(this,Hi).push(t),this.clearGcTimeout(),V(this,ps).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){ye(this,Hi,V(this,Hi).filter(s=>s!==t)),this.scheduleGc(),V(this,ps).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){V(this,Hi).length||(this.state.status==="pending"?this.scheduleGc():V(this,ps).remove(this))}continue(){var t;return((t=V(this,fa))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var c,d,f,h,g,_,y,b,S,w,k,T,D,N,E,M,U,W;const s=()=>{Fe(this,Ui,nr).call(this,{type:"continue"})},i={client:V(this,Dc),meta:this.options.meta,mutationKey:this.options.mutationKey};ye(this,fa,sx({fn:()=>this.options.mutationFn?this.options.mutationFn(t,i):Promise.reject(new Error("No mutationFn found")),onFail:(B,$)=>{Fe(this,Ui,nr).call(this,{type:"failed",failureCount:B,error:$})},onPause:()=>{Fe(this,Ui,nr).call(this,{type:"pause"})},onContinue:s,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>V(this,ps).canRun(this)}));const a=this.state.status==="pending",o=!V(this,fa).canStart();try{if(a)s();else{Fe(this,Ui,nr).call(this,{type:"pending",variables:t,isPaused:o}),V(this,ps).config.onMutate&&await V(this,ps).config.onMutate(t,this,i);const $=await((d=(c=this.options).onMutate)==null?void 0:d.call(c,t,i));$!==this.state.context&&Fe(this,Ui,nr).call(this,{type:"pending",context:$,variables:t,isPaused:o})}const B=await V(this,fa).start();return await((h=(f=V(this,ps).config).onSuccess)==null?void 0:h.call(f,B,t,this.state.context,this,i)),await((_=(g=this.options).onSuccess)==null?void 0:_.call(g,B,t,this.state.context,i)),await((b=(y=V(this,ps).config).onSettled)==null?void 0:b.call(y,B,null,this.state.variables,this.state.context,this,i)),await((w=(S=this.options).onSettled)==null?void 0:w.call(S,B,null,t,this.state.context,i)),Fe(this,Ui,nr).call(this,{type:"success",data:B}),B}catch(B){try{await((T=(k=V(this,ps).config).onError)==null?void 0:T.call(k,B,t,this.state.context,this,i))}catch($){Promise.reject($)}try{await((N=(D=this.options).onError)==null?void 0:N.call(D,B,t,this.state.context,i))}catch($){Promise.reject($)}try{await((M=(E=V(this,ps).config).onSettled)==null?void 0:M.call(E,void 0,B,this.state.variables,this.state.context,this,i))}catch($){Promise.reject($)}try{await((W=(U=this.options).onSettled)==null?void 0:W.call(U,void 0,B,t,this.state.context,i))}catch($){Promise.reject($)}throw Fe(this,Ui,nr).call(this,{type:"error",error:B}),B}finally{V(this,ps).runNext(this)}}},Dc=new WeakMap,Hi=new WeakMap,ps=new WeakMap,fa=new WeakMap,Ui=new WeakSet,nr=function(t){const s=i=>{switch(t.type){case"failed":return{...i,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...i,isPaused:!0};case"continue":return{...i,isPaused:!1};case"pending":return{...i,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...i,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...i,data:void 0,error:t.error,failureCount:i.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=s(this.state),cs.batch(()=>{V(this,Hi).forEach(i=>{i.onMutationUpdate(t)}),V(this,ps).notify({mutation:this,type:"updated",action:t})})},$C);function kR(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var bn,wi,Lc,VC,ER=(VC=class extends Oc{constructor(t={}){super();ke(this,bn);ke(this,wi);ke(this,Lc);this.config=t,ye(this,bn,new Set),ye(this,wi,new Map),ye(this,Lc,0)}build(t,s,i){const a=new xR({client:t,mutationCache:this,mutationId:++ah(this,Lc)._,options:t.defaultMutationOptions(s),state:i});return this.add(a),a}add(t){V(this,bn).add(t);const s=oh(t);if(typeof s=="string"){const i=V(this,wi).get(s);i?i.push(t):V(this,wi).set(s,[t])}this.notify({type:"added",mutation:t})}remove(t){if(V(this,bn).delete(t)){const s=oh(t);if(typeof s=="string"){const i=V(this,wi).get(s);if(i)if(i.length>1){const a=i.indexOf(t);a!==-1&&i.splice(a,1)}else i[0]===t&&V(this,wi).delete(s)}}this.notify({type:"removed",mutation:t})}canRun(t){const s=oh(t);if(typeof s=="string"){const i=V(this,wi).get(s),a=i==null?void 0:i.find(o=>o.state.status==="pending");return!a||a===t}else return!0}runNext(t){var i;const s=oh(t);if(typeof s=="string"){const a=(i=V(this,wi).get(s))==null?void 0:i.find(o=>o!==t&&o.state.isPaused);return(a==null?void 0:a.continue())??Promise.resolve()}else return Promise.resolve()}clear(){cs.batch(()=>{V(this,bn).forEach(t=>{this.notify({type:"removed",mutation:t})}),V(this,bn).clear(),V(this,wi).clear()})}getAll(){return Array.from(V(this,bn))}find(t){const s={exact:!0,...t};return this.getAll().find(i=>W0(s,i))}findAll(t={}){return this.getAll().filter(s=>W0(t,s))}notify(t){cs.batch(()=>{this.listeners.forEach(s=>{s(t)})})}resumePausedMutations(){const t=this.getAll().filter(s=>s.state.isPaused);return cs.batch(()=>Promise.all(t.map(s=>s.continue().catch(Ms))))}},bn=new WeakMap,wi=new WeakMap,Lc=new WeakMap,VC);function oh(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Fi,WC,TR=(WC=class extends Oc{constructor(t={}){super();ke(this,Fi);this.config=t,ye(this,Fi,new Map)}build(t,s,i){const a=s.queryKey,o=s.queryHash??$_(a,s);let c=this.get(o);return c||(c=new yR({client:t,queryKey:a,queryHash:o,options:t.defaultQueryOptions(s),state:i,defaultOptions:t.getQueryDefaults(a)}),this.add(c)),c}add(t){V(this,Fi).has(t.queryHash)||(V(this,Fi).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const s=V(this,Fi).get(t.queryHash);s&&(t.destroy(),s===t&&V(this,Fi).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){cs.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return V(this,Fi).get(t)}getAll(){return[...V(this,Fi).values()]}find(t){const s={exact:!0,...t};return this.getAll().find(i=>V0(s,i))}findAll(t={}){const s=this.getAll();return Object.keys(t).length>0?s.filter(i=>V0(t,i)):s}notify(t){cs.batch(()=>{this.listeners.forEach(s=>{s(t)})})}onFocus(){cs.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){cs.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Fi=new WeakMap,WC),Ct,pr,mr,Mo,Oo,gr,jo,Po,GC,NR=(GC=class{constructor(e={}){ke(this,Ct);ke(this,pr);ke(this,mr);ke(this,Mo);ke(this,Oo);ke(this,gr);ke(this,jo);ke(this,Po);ye(this,Ct,e.queryCache||new TR),ye(this,pr,e.mutationCache||new ER),ye(this,mr,e.defaultOptions||{}),ye(this,Mo,new Map),ye(this,Oo,new Map),ye(this,gr,0)}mount(){ah(this,gr)._++,V(this,gr)===1&&(ye(this,jo,F_.subscribe(async e=>{e&&(await this.resumePausedMutations(),V(this,Ct).onFocus())})),ye(this,Po,Gh.subscribe(async e=>{e&&(await this.resumePausedMutations(),V(this,Ct).onOnline())})))}unmount(){var e,t;ah(this,gr)._--,V(this,gr)===0&&((e=V(this,jo))==null||e.call(this),ye(this,jo,void 0),(t=V(this,Po))==null||t.call(this),ye(this,Po,void 0))}isFetching(e){return V(this,Ct).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return V(this,pr).findAll({...e,status:"pending"}).length}getQueryData(e){var s;const t=this.defaultQueryOptions({queryKey:e});return(s=V(this,Ct).get(t.queryHash))==null?void 0:s.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),s=V(this,Ct).build(this,t),i=s.state.data;return i===void 0?this.fetchQuery(e):(e.revalidateIfStale&&s.isStaleByTime(br(t.staleTime,s))&&this.prefetchQuery(t),Promise.resolve(i))}getQueriesData(e){return V(this,Ct).findAll(e).map(({queryKey:t,state:s})=>{const i=s.data;return[t,i]})}setQueryData(e,t,s){const i=this.defaultQueryOptions({queryKey:e}),a=V(this,Ct).get(i.queryHash),o=a==null?void 0:a.state.data,c=cR(t,o);if(c!==void 0)return V(this,Ct).build(this,i).setData(c,{...s,manual:!0})}setQueriesData(e,t,s){return cs.batch(()=>V(this,Ct).findAll(e).map(({queryKey:i})=>[i,this.setQueryData(i,t,s)]))}getQueryState(e){var s;const t=this.defaultQueryOptions({queryKey:e});return(s=V(this,Ct).get(t.queryHash))==null?void 0:s.state}removeQueries(e){const t=V(this,Ct);cs.batch(()=>{t.findAll(e).forEach(s=>{t.remove(s)})})}resetQueries(e,t){const s=V(this,Ct);return cs.batch(()=>(s.findAll(e).forEach(i=>{i.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const s={revert:!0,...t},i=cs.batch(()=>V(this,Ct).findAll(e).map(a=>a.cancel(s)));return Promise.all(i).then(Ms).catch(Ms)}invalidateQueries(e,t={}){return cs.batch(()=>(V(this,Ct).findAll(e).forEach(s=>{s.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const s={...t,cancelRefetch:t.cancelRefetch??!0},i=cs.batch(()=>V(this,Ct).findAll(e).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let o=a.fetch(void 0,s);return s.throwOnError||(o=o.catch(Ms)),a.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(i).then(Ms)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const s=V(this,Ct).build(this,t);return s.isStaleByTime(br(t.staleTime,s))?s.fetch(t):Promise.resolve(s.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ms).catch(Ms)}fetchInfiniteQuery(e){return e.behavior=Z0(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ms).catch(Ms)}ensureInfiniteQueryData(e){return e.behavior=Z0(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Gh.isOnline()?V(this,pr).resumePausedMutations():Promise.resolve()}getQueryCache(){return V(this,Ct)}getMutationCache(){return V(this,pr)}getDefaultOptions(){return V(this,mr)}setDefaultOptions(e){ye(this,mr,e)}setQueryDefaults(e,t){V(this,Mo).set(_c(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...V(this,Mo).values()],s={};return t.forEach(i=>{vc(e,i.queryKey)&&Object.assign(s,i.defaultOptions)}),s}setMutationDefaults(e,t){V(this,Oo).set(_c(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...V(this,Oo).values()],s={};return t.forEach(i=>{vc(e,i.mutationKey)&&Object.assign(s,i.defaultOptions)}),s}defaultQueryOptions(e){if(e._defaulted)return e;const t={...V(this,mr).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=$_(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===V_&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...V(this,mr).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){V(this,Ct).clear(),V(this,pr).clear()}},Ct=new WeakMap,pr=new WeakMap,mr=new WeakMap,Mo=new WeakMap,Oo=new WeakMap,gr=new WeakMap,jo=new WeakMap,Po=new WeakMap,GC),ox=C.createContext(void 0),G_=e=>{const t=C.useContext(ox);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},AR=({client:e,children:t})=>(C.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),p.jsx(ox.Provider,{value:e,children:t})),lx=C.createContext(!1),RR=()=>C.useContext(lx);lx.Provider;function DR(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var LR=C.createContext(DR()),MR=()=>C.useContext(LR),OR=(e,t,s)=>{const i=s!=null&&s.state.error&&typeof e.throwOnError=="function"?ex(e.throwOnError,[s.state.error,s]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||i)&&(t.isReset()||(e.retryOnMount=!1))},jR=e=>{C.useEffect(()=>{e.clearReset()},[e])},PR=({result:e,errorResetBoundary:t,throwOnError:s,query:i,suspense:a})=>e.isError&&!t.isReset()&&!e.isFetching&&i&&(a&&e.data===void 0||ex(s,[e.error,i])),BR=e=>{if(e.suspense){const s=a=>a==="static"?a:Math.max(a??1e3,1e3),i=e.staleTime;e.staleTime=typeof i=="function"?(...a)=>s(i(...a)):s(i),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},IR=(e,t)=>e.isLoading&&e.isFetching&&!t,zR=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,ew=(e,t,s)=>t.fetchOptimistic(e).catch(()=>{s.clearReset()});function HR(e,t,s){var y,b,S,w;const i=RR(),a=MR(),o=G_(),c=o.defaultQueryOptions(e);(b=(y=o.getDefaultOptions().queries)==null?void 0:y._experimental_beforeQuery)==null||b.call(y,c);const d=o.getQueryCache().get(c.queryHash);c._optimisticResults=i?"isRestoring":"optimistic",BR(c),OR(c,a,d),jR(a);const f=!o.getQueryCache().get(c.queryHash),[h]=C.useState(()=>new t(o,c)),g=h.getOptimisticResult(c),_=!i&&e.subscribed!==!1;if(C.useSyncExternalStore(C.useCallback(k=>{const T=_?h.subscribe(cs.batchCalls(k)):Ms;return h.updateResult(),T},[h,_]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),C.useEffect(()=>{h.setOptions(c)},[c,h]),zR(c,g))throw ew(c,h,a);if(PR({result:g,errorResetBoundary:a,throwOnError:c.throwOnError,query:d,suspense:c.suspense}))throw g.error;if((w=(S=o.getDefaultOptions().queries)==null?void 0:S._experimental_afterQuery)==null||w.call(S,c,g),c.experimental_prefetchInRender&&!yc.isServer()&&IR(g,i)){const k=f?ew(c,h,a):d==null?void 0:d.promise;k==null||k.catch(Ms).finally(()=>{h.updateResult()})}return c.notifyOnChangeProps?g:h.trackResult(g)}function ga(e,t){return HR(e,bR)}function Ho(e){const t=`[${e}]`,s=(i,a,...o)=>{console[i](`${t} ${a}`,...o)};return{debug:(i,...a)=>s("debug",i,...a),info:(i,...a)=>s("info",i,...a),warn:(i,...a)=>s("warn",i,...a),error:(i,...a)=>s("error",i,...a)}}const tw=e=>{let t;const s=new Set,i=(h,g)=>{const _=typeof h=="function"?h(t):h;if(!Object.is(_,t)){const y=t;t=g??(typeof _!="object"||_===null)?_:Object.assign({},t,_),s.forEach(b=>b(t,y))}},a=()=>t,d={setState:i,getState:a,getInitialState:()=>f,subscribe:h=>(s.add(h),()=>s.delete(h))},f=t=e(i,a,d);return d},UR=(e=>e?tw(e):tw),FR=e=>e;function $R(e,t=FR){const s=qe.useSyncExternalStore(e.subscribe,qe.useCallback(()=>t(e.getState()),[e,t]),qe.useCallback(()=>t(e.getInitialState()),[e,t]));return qe.useDebugValue(s),s}const sw=e=>{const t=UR(e),s=i=>$R(t,i);return Object.assign(s,t),s},En=(e=>e?sw(e):sw);class cm extends Error{constructor(s){super("conflict");ce(this,"sessionId");this.name="ConflictError",this.sessionId=s}}async function Ke(e){if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}async function q_(e){return e.ok?e.json():null}async function wa(e,t){try{return(await e.json()).error||t}catch{return t}}async function VR(e){const t=await fetch("/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pin:e})});if(!t.ok){const s=await wa(t,"Authentication failed");throw new Error(s)}}async function WR(){return(await fetch("/sessions")).ok}async function GR(){const e=await fetch("/auth/status");if(!e.ok)throw new Error(`HTTP ${e.status}`);return{hasPIN:(await e.json()).hasPIN===!0}}async function qR(e,t){const s=await fetch("/auth/setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pin:e,confirm:t})});if(!s.ok){const i=await wa(s,"Failed to set PIN");throw new Error(i)}}async function KR(){return Ke(await fetch("/sessions"))}function Rh(e){if(Array.isArray(e))return e.filter(t=>!!t&&typeof t=="object"&&"sessionId"in t);if(e&&typeof e=="object"){const t=e;return Array.isArray(t.sessions)?Rh(t.sessions):t.sessions&&typeof t.sessions=="object"?Object.entries(t.sessions).flatMap(([s,i])=>!i||typeof i!="object"?[]:[{sessionId:s,...i}]):Array.isArray(t.data)||t.data&&typeof t.data=="object"?Rh(t.data):Object.entries(t).flatMap(([s,i])=>!i||typeof i!="object"?[]:[{sessionId:s,...i}])}return[]}function YR(e){if(!e||typeof e!="object")return null;const t=e,s=t.data??t.account??e;if(!s||typeof s!="object")return null;const i=s;return typeof i.updatedAt!="string"?null:{fiveHourUsedPercent:typeof i.fiveHourUsedPercent=="number"?i.fiveHourUsedPercent:-1,fiveHourResetsAt:typeof i.fiveHourResetsAt=="string"?i.fiveHourResetsAt:null,sevenDayUsedPercent:typeof i.sevenDayUsedPercent=="number"?i.sevenDayUsedPercent:-1,sevenDayResetsAt:typeof i.sevenDayResetsAt=="string"?i.sevenDayResetsAt:null,updatedAt:i.updatedAt}}async function XR(){const e=await fetch("/telemetry/sessions"),t=await q_(e);return Rh(t)}async function QR(){const e=await fetch("/telemetry/account"),t=await q_(e);return YR(t)}async function ZR(){const e=await fetch("/telemetry/setup-status"),t=await q_(e);return!t||typeof t!="object"?{installed:!1}:{installed:t.installed===!0}}async function JR(){return Ke(await fetch("/git/worktrees"))}async function e2(){return(await Ke(await fetch("/workspaces"))).workspaces}async function t2(e){return(await Ke(await fetch("/workspaces/reorder",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:e})}))).workspaces}async function qh(e,t){const s=new URLSearchParams;return e&&s.set("path",e),t!=null&&t.prefix&&s.set("prefix",t.prefix),t!=null&&t.showHidden&&s.set("showHidden","true"),t!=null&&t.includeFiles&&s.set("includeFiles","true"),Ke(await fetch("/workspaces/browse?"+s.toString()))}async function s2(e){return Ke(await fetch("/workspaces/bulk",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:e})}))}async function i2(e){var s,i;const t=await Ke(await fetch("/workspaces/dashboard?path="+encodeURIComponent(e)));return{prs:((s=t.pullRequests)==null?void 0:s.prs)??[],activity:t.activity??[],isGitRepo:!0,defaultBranch:null,hasGhCli:!((i=t.pullRequests)!=null&&i.error)}}async function n2(e,t){const s=await fetch("/gh/ci-status?path="+encodeURIComponent(e)+"&branch="+encodeURIComponent(t));return s.ok?s.json():null}async function r2(e,t){const s=await fetch("/gh/pr?path="+encodeURIComponent(e)+"&branch="+encodeURIComponent(t));return s.ok?(await s.json()).pr:null}async function a2(e){return(await Ke(await fetch("/workspaces/current-branch?path="+encodeURIComponent(e)))).branch}async function lh(e,t){const s=await fetch("/workspaces/worktree?path="+encodeURIComponent(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({branch:t})});if(!s.ok)throw new Error(await wa(s,"Failed to create worktree"));return s.json()}async function o2(e,t){return(await fetch("/workspaces/branch?path="+encodeURIComponent(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({branch:t})})).json()}async function cx(e,t={}){const s=new URLSearchParams({repo:e});return t.refresh&&s.set("refresh","1"),Ke(await fetch("/git/branches?"+s.toString()))}async function l2(e){const t=await fetch("/gh/enrich-branches",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({branches:e})});return t.ok?t.json():{results:{}}}async function qr(e){const t=await fetch("/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(t.status===409)try{const s=await t.json();throw new cm(s.sessionId??"")}catch(s){throw s instanceof cm?s:new cm("")}return Ke(t)}async function ux(e){await fetch("/sessions/"+e,{method:"DELETE"})}async function c2(e,t){await fetch("/sessions/"+e,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({displayName:t})})}async function hx(e,t){const s=await fetch("/worktrees",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({worktreePath:e,repoPath:t})});if(!s.ok)throw new Error(await wa(s,"Failed to delete worktree"))}async function u2(e,t,s){return Ke(await fetch("/sessions/"+e+"/image",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:t,mimeType:s})}))}async function dx(){return Ke(await fetch("/version"))}async function fx(){return Ke(await fetch("/update",{method:"POST"}))}async function h2(){return(await Ke(await fetch("/update-channel"))).channel}async function d2(e){if(!(await fetch("/update-channel",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({channel:e})})).ok)throw new Error("Failed to update channel")}async function px(){return(await Ke(await fetch("/config/defaultAgent"))).defaultAgent}async function f2(e){if(!(await fetch("/config/defaultAgent",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({defaultAgent:e})})).ok)throw new Error("Failed to update default agent")}async function yd(e){return(await Ke(await fetch(`/config/${e}`)))[e]}async function bd(e,t){const s=await fetch(`/config/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[e]:t})});if(!s.ok)throw new Error(await wa(s,`Failed to update ${e}`))}const mx=()=>yd("defaultContinue"),p2=e=>bd("defaultContinue",e),gx=()=>yd("defaultYolo"),_x=e=>bd("defaultYolo",e),vx=()=>yd("launchInTmux"),m2=e=>bd("launchInTmux",e),yx=()=>yd("defaultNotifications"),g2=e=>bd("defaultNotifications",e);async function _2(){try{return(await Ke(await fetch("/push/vapid-key"))).vapidPublicKey}catch{return null}}async function bx(e,t){if(!(await fetch("/push/subscribe",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({subscription:e,sessionIds:t})})).ok)throw new Error("Push subscribe failed")}async function v2(e){return Ke(await fetch("/workspaces/settings?path="+encodeURIComponent(e)))}async function iw(e){return Ke(await fetch("/workspaces/settings/merged?path="+encodeURIComponent(e)))}async function nw(e,t){const s=await fetch("/workspaces/settings?path="+encodeURIComponent(e),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!s.ok)throw new Error(await wa(s,"Failed to update workspace settings"))}async function K_(){const e=await fetch("/org-dashboard/prs");return Ke(e)}async function y2(){const e=await fetch("/branch-linker/links");return Ke(e)}async function b2(){return Ke(await fetch("/analytics/size"))}async function S2(){if(!(await fetch("/analytics/events",{method:"DELETE"})).ok)throw new Error("Failed to clear analytics")}async function w2(){const e=await fetch("/presets",{credentials:"include"});return Ke(e)}async function C2(e){if(!(await fetch("/presets",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(e)})).ok)throw new Error("Failed to save preset")}async function x2(e){if(!(await fetch(`/presets/${encodeURIComponent(e)}`,{method:"DELETE",credentials:"include"})).ok)throw new Error("Failed to delete preset")}async function _g(){return Ke(await fetch("/auth/github/status",{credentials:"include"}))}async function k2(){return Ke(await fetch("/auth/github",{credentials:"include"}))}async function E2(){if(!(await fetch("/auth/github/disconnect",{method:"POST",credentials:"include"})).ok)throw new Error("Failed to disconnect GitHub")}async function Sx(){return Ke(await fetch("/webhooks/manage/status",{credentials:"include"}))}async function T2(){return Ke(await fetch("/webhooks/manage/setup",{method:"POST",credentials:"include"}))}async function N2(){return Ke(await fetch("/webhooks/manage/setup",{method:"DELETE",credentials:"include"}))}async function A2(){return Ke(await fetch("/webhooks/manage/ping",{method:"POST",credentials:"include"}))}async function R2(){return Ke(await fetch("/webhooks/manage/backfill",{method:"POST",credentials:"include"}))}async function D2(e){if(!(await fetch("/config/autoProvision",{method:"PATCH",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({autoProvision:e})})).ok)throw new Error("Failed to update auto-provision setting")}async function L2(){return Ke(await fetch("/workspace-groups"))}async function M2(e,t){const s=await fetch(`/workspace-groups/${e}/session`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(!s.ok)throw new Error(await wa(s,"Failed to launch workspace session"));return s.json()}async function wx(e,t){const s=new URLSearchParams({path:e});t&&s.set("base",t);const i=await fetch("/workspaces/changed-files?"+s.toString());return i.ok?i.json():{files:[],aggregate:{additions:0,deletions:0,fileCount:0},error:`HTTP ${i.status}`}}async function Cx(e,t,s){const i=new URLSearchParams({path:e,file:t});s&&i.set("base",s);const a=await fetch("/workspaces/file-diff?"+i.toString());return a.ok?a.json():{diff:"",error:`HTTP ${a.status}`}}async function xx(e){const t=new URLSearchParams({path:e});try{const s=await fetch("/workspaces/default-branch?"+t.toString());return s.ok&&(await s.json()).branch||"main"}catch{return"main"}}async function O2(e=7,t){const s=new URLSearchParams({days:String(e)});return Ke(await fetch(`/api/analytics/overview?${s}`))}async function j2(e){const t=new URLSearchParams;return e!=null&&e.offset&&t.set("offset",String(e.offset)),t.set("limit",String(e.limit)),e!=null&&e.repo&&t.set("repo",e.repo),e!=null&&e.agent&&t.set("agent",e.agent),e!=null&&e.sort&&t.set("sort",e.sort),Ke(await fetch(`/api/analytics/sessions?${t}`))}async function P2(e){return Ke(await fetch(`/api/analytics/sessions/${encodeURIComponent(e)}`))}async function B2(e=7,t,s){const i=new URLSearchParams({days:String(e)});return Ke(await fetch(`/api/analytics/tools?${i}`))}async function I2(e=24){return Ke(await fetch(`/api/analytics/rate-limits?hours=${e}`))}const Jl=En()(e=>({authenticated:!1,pinError:null,checking:!0,needsSetup:!1,checkExistingAuth:async()=>{e({checking:!0});try{if(!(await GR()).hasPIN){e({needsSetup:!0,checking:!1});return}const s=await WR();e({needsSetup:!1,authenticated:s})}catch{e({authenticated:!1})}finally{e({checking:!1})}},submitPin:async t=>{e({pinError:null});try{await VR(t),e({authenticated:!0})}catch(s){const i=s instanceof Error?s.message:"Authentication failed";e({pinError:i})}},setupNewPin:async(t,s)=>{e({pinError:null});try{await qR(t,s),e({needsSetup:!1,authenticated:!0})}catch(i){const a=i instanceof Error?i.message:"Failed to set PIN";e({pinError:a})}}})),kx="claude-remote-sidebar-width",rw="claude-remote-sidebar-collapsed",um="claude-remote-active-workspace",hm="claude-remote-active-workspace-group",Ex="claude-remote-terminal-font-size",Tx="claude-remote-right-sidebar-width",aw="claude-remote-right-sidebar-collapsed",Nx="claude-remote-file-viewer-width",Ax="claude-remote-diff-view-mode",ow="claude-remote-word-wrap",Rx="claude-remote-collapsed-workspaces",Dx=240,Lx=180,Mx=500,z2=44,Bo=14,Ox=8,jx=28,H2=220,U2=160,F2=400,$2=.35;function $i(e,t){return`${t??"code"}::${e}`}function Ci(e){try{return localStorage.getItem(e)}catch{return null}}function Oi(e,t){try{localStorage.setItem(e,t)}catch{}}function lw(e){try{localStorage.removeItem(e)}catch{}}function V2(){const e=Ci(kx);if(e){const t=parseInt(e,10);if(t>=Lx&&t<=Mx)return t}return Dx}function W2(){const e=Ci(Tx);if(e){const t=parseInt(e,10);if(t>=U2&&t<=F2)return t}return H2}function G2(){const e=Ci(Nx);if(e){const t=parseFloat(e);if(t>=.15&&t<=.75)return t}return $2}function q2(){const e=Ci(Ax);return e==="unified"||e==="side-by-side"?e:"unified"}function K2(){const e=Ci(Ex);if(e){const t=parseInt(e,10);if(!Number.isNaN(t)&&t>=Ox&&t<=jx)return t}return Bo}function Y2(){try{const e=Ci(Rx);if(e)return new Set(JSON.parse(e))}catch{}return new Set}const fe=En()((e,t)=>({sidebarOpen:!1,sidebarWidth:V2(),sidebarCollapsed:Ci(rw)==="true",searchQuery:"",activeRepoPath:Ci(um),activeWorkspaceId:Ci(hm),terminalFontSize:K2(),hasHardwareKeyboard:!1,keyboardOpen:!1,fullPageDiff:null,fileDiffSource:"working",fileDiffDefaultBranch:"main",fileDiffViewMode:q2(),fileWordWrap:Ci(ow)==="true",rightSidebarVisible:!0,rightSidebarCollapsed:Ci(aw)==="true",rightSidebarWidth:W2(),rightSidebarTab:"changes",openFileTabs:[],activeFileTabKey:null,fileViewerRatio:G2(),sendToTargetSessionId:null,lastChangedFiles:[],collapsedWorkspaces:Y2(),openSidebar:()=>e({sidebarOpen:!0}),closeSidebar:()=>e({sidebarOpen:!1}),saveSidebarWidth:()=>Oi(kx,String(t().sidebarWidth)),toggleSidebarCollapsed:()=>{const s=!t().sidebarCollapsed;Oi(rw,String(s)),e({sidebarCollapsed:s})},saveTerminalFontSize:()=>Oi(Ex,String(t().terminalFontSize)),setActiveRepoPath:s=>{s===null?lw(um):Oi(um,s),e({activeRepoPath:s})},setActiveWorkspaceId:s=>{s===null?lw(hm):Oi(hm,s),e({activeWorkspaceId:s})},setFileDiffViewMode:s=>{Oi(Ax,s),e({fileDiffViewMode:s})},setFileWordWrap:s=>{Oi(ow,String(s)),e({fileWordWrap:s})},toggleRightSidebarCollapsed:()=>{const s=!t().rightSidebarCollapsed;Oi(aw,String(s)),e({rightSidebarCollapsed:s})},setRightSidebarTab:s=>e({rightSidebarTab:s}),setFileDiffSource:s=>e({fileDiffSource:s}),setFileDiffDefaultBranch:s=>e({fileDiffDefaultBranch:s}),setLastChangedFiles:s=>e({lastChangedFiles:s}),saveRightSidebarWidth:()=>Oi(Tx,String(t().rightSidebarWidth)),saveFileViewerRatio:()=>Oi(Nx,String(t().fileViewerRatio)),openFileTab:(s,i,a,o)=>{const{openFileTabs:c}=t(),d=s.split("/").pop()??s,f=a??(i?"diff":"code"),h=c.find(g=>g.filePath===s&&(g.tabType??(g.isChanged?"diff":"code"))===f);if(h)h.isChanged!==i||h.token!==o?e({openFileTabs:c.map(g=>{if(g.filePath!==s||(g.tabType??(g.isChanged?"diff":"code"))!==f)return g;const _={...g,isChanged:i,tabType:f};return o!==void 0&&(_.token=o),_}),activeFileTabKey:$i(s,f)}):e({activeFileTabKey:$i(s,f)});else{const g={filePath:s,fileName:d,isChanged:i,tabType:f};o&&(g.token=o),e({openFileTabs:[...c,g],activeFileTabKey:$i(s,f)})}},closeFileTab:(s,i)=>{const{openFileTabs:a,activeFileTabKey:o}=t(),c=i?a.filter(g=>!(g.filePath===s&&g.tabType===i)):a.filter(g=>g.filePath!==s),d=i?$i(s,i):null,h=(d?o===d:o==null?void 0:o.endsWith("::"+s))?c.length>0?$i(c[c.length-1].filePath,c[c.length-1].tabType):null:o;e({openFileTabs:c,activeFileTabKey:h})},closeAllFileTabs:()=>e({openFileTabs:[],activeFileTabKey:null}),openHtmlTab:(s,i)=>t().openFileTab(s,!1,"html",i),refreshHtmlTab:s=>{const{openFileTabs:i}=t();i.find(o=>o.filePath===s&&o.tabType==="html")&&e({openFileTabs:i.map(o=>o.filePath===s&&o.tabType==="html"?{...o,refreshVersion:(o.refreshVersion??0)+1}:o),activeFileTabKey:$i(s,"html")})},toggleWorkspaceCollapse:s=>{const{collapsedWorkspaces:i}=t(),a=new Set(i);a.has(s)?a.delete(s):a.add(s);try{localStorage.setItem(Rx,JSON.stringify([...a]))}catch{}e({collapsedWorkspaces:a})},isWorkspaceCollapsed:s=>t().collapsedWorkspaces.has(s)}));let lc=null,ec=null;const Y_=Ho("notifications");function X2(e){lc=e,"serviceWorker"in navigator&&navigator.serviceWorker.addEventListener("message",t=>{const s=t.data;s.type==="notification-click"&&s.sessionId&&lc&&lc(s.sessionId,s.sessionType||"repo")})}function cw(){return typeof Notification>"u"?"unsupported":Notification.permission}async function Q2(){return typeof Notification>"u"?"unsupported":Notification.requestPermission()}function Z2(){return document.hidden||!document.hasFocus()}function J2(e){if(typeof Notification>"u"||Notification.permission!=="granted")return;const t=new Notification(e.displayName||"Relay IDE",{body:"Session needs your input",tag:"session-"+e.id,data:{sessionId:e.id,sessionType:e.type}});t.onclick=()=>{window.focus(),lc&&lc(e.id,e.type),t.close()}}function X_(){return"serviceWorker"in navigator&&"PushManager"in window}async function eD(){if(X_())try{ec=await navigator.serviceWorker.register("/sw.js")}catch(e){Y_.warn("Service worker registration failed",e);return}}async function tD(e){if(!ec){if(!X_())return;ec=await navigator.serviceWorker.ready}try{let t=await ec.pushManager.getSubscription();if(!t){const s=await _2();if(!s)return;const i=iD(s).buffer;t=await ec.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:i})}await bx(t.toJSON(),e)}catch(t){Y_.warn("Push subscription failed",t)}}async function sD(e){if(X_())try{const s=await(await navigator.serviceWorker.ready).pushManager.getSubscription();s&&await bx(s.toJSON(),e)}catch(t){Y_.warn("Push re-subscription failed",t)}}function iD(e){const t="=".repeat((4-e.length%4)%4),s=(e+t).replace(/-/g,"+").replace(/_/g,"/"),i=window.atob(s),a=new Uint8Array(i.length);for(let o=0;o<i.length;o++)a[o]=i.charCodeAt(o);return a}function vg(e,t){switch(t.type){case"backend-state-changed":switch(t.state){case"idle":return e==="running"||e==="initializing"||e==="permission"||e==="needs-answer"||e==="error"?"unseen-idle":e;case"running":return"running";case"permission":return t.permissionType==="question"?"needs-answer":"permission";case"error":return"error";case"initializing":return"initializing";default:return e}case"user-viewed":return e==="unseen-idle"?"seen-idle":e;case"session-ended":return"inactive"}}function Kh(e){return e==="unseen-idle"||e==="permission"||e==="needs-answer"||e==="error"}function nD(e,t){return e==="running"&&Kh(t)}const rD={permission:1e3,"needs-answer":900,error:800,"unseen-idle":500,running:100,initializing:50,"seen-idle":10,inactive:1};function aD(e){if(!e.lastActivity)return 1/0;const t=new Date(e.lastActivity).getTime();return Number.isNaN(t)?1/0:(Date.now()-t)/6e4}function uw(e){let t=rD[e.displayState];e.prStatus==="changes-requested"&&(t+=200),e.prStatus==="review-requested"&&(t+=150);const s=aD(e);return t+=Math.max(0,100-s),e.isUnread&&(t+=300),t}function oD(e){return[...e].sort((t,s)=>uw(s)-uw(t))}function lD(e){const{agentState:t,idle:s}=e;return t==="permission-prompt"?"permission":t==="error"?"error":t==="processing"?"running":t==="initializing"?"initializing":!t&&!s?"running":"idle"}function Yh(e){const t={permission:4,error:3,running:2,initializing:1,idle:0};let s="idle";for(const i of e){const a=lD(i);t[a]>t[s]&&(s=a)}return s}function cD(e){if(e.length===0)return"inactive";switch(Yh(e)){case"permission":return"permission";case"error":return"error";case"running":return"running";case"initializing":return"initializing";case"idle":default:return"seen-idle"}}function hw(e){return e.length===0?"":e.reduce((t,s)=>s.lastActivity>t?s.lastActivity:t,e[0].lastActivity)}function uD(e,t,s,i,a){var h,g,_,y;const o=new Map;for(const b of i)o.set(b.id,b);const c=new Map;for(const b of e){const S=b.worktreePath??b.repoPath,w=c.get(S);w?w.push(b):c.set(S,[b])}const d=new Set,f=[];for(const b of s){const S=[];for(const[k]of c)(k===b.path||k.startsWith(b.path+"/"))&&(S.push(k),d.add(k));const w=new Set;for(const k of S){const T=c.get(k)??[],D=T[0];if(!D)continue;const N=k===b.path?"repo":"worktree",E=Yh(T),M=ch(o.get(k),E,T);f.push({id:k,kind:N,path:k,repoPath:b.path,displayName:D.displayName,branchName:D.branchName,lastActivity:hw(T),displayState:M,lastKnownBackendState:E,sessions:T,isUnread:((h=o.get(k))==null?void 0:h.isUnread)??(a==null?void 0:a(k))??!1}),w.add(k)}for(const k of t)k.repoPath===b.path&&(w.has(k.path)||(f.push({id:k.path,kind:"worktree",path:k.path,repoPath:k.repoPath,displayName:k.displayName,branchName:k.branchName,lastActivity:k.lastActivity,displayState:ch(o.get(k.path),null,[]),lastKnownBackendState:null,sessions:[],isUnread:((g=o.get(k.path))==null?void 0:g.isUnread)??(a==null?void 0:a(k.path))??!1}),w.add(k.path)));w.has(b.path)||f.push({id:b.path,kind:"repo",path:b.path,repoPath:b.path,displayName:b.name,branchName:b.currentBranch??b.defaultBranch??"",lastActivity:"",displayState:ch(o.get(b.path),null,[]),lastKnownBackendState:null,sessions:[],isUnread:((_=o.get(b.path))==null?void 0:_.isUnread)??(a==null?void 0:a(b.path))??!1})}for(const[b,S]of c){if(d.has(b))continue;const w=S[0];if(!w)continue;const k=Yh(S);f.push({id:b,kind:"worktree",path:b,repoPath:w.repoPath,displayName:w.displayName,branchName:w.branchName,lastActivity:hw(S),displayState:ch(o.get(b),k,S),lastKnownBackendState:k,sessions:S,isUnread:((y=o.get(b))==null?void 0:y.isUnread)??(a==null?void 0:a(b))??!1})}return oD(f)}function ch(e,t,s){return s.length===0?"inactive":!e||e.displayState==="inactive"?cD(s):e.lastKnownBackendState===t?e.displayState:t?t==="permission"&&e.displayState==="needs-answer"?"needs-answer":vg(e.displayState,{type:"backend-state-changed",state:t}):e.displayState}function hD(e,t,s){return s||e===t?!1:Kh(t)}const Px="claude-remote-unread";function dD(){try{const e=localStorage.getItem(Px);if(!e)return new Set;const t=JSON.parse(e);return Array.isArray(t)?new Set(t.filter(s=>typeof s=="string")):new Set}catch{return new Set}}function dm(e){try{localStorage.setItem(Px,JSON.stringify([...e]))}catch{}}const uh=En()((e,t)=>({unreadItems:dD(),isUnread:s=>t().unreadItems.has(s),markUnread:s=>{const{unreadItems:i}=t();if(!i.has(s)){const a=new Set(i);a.add(s),dm(a),e({unreadItems:a})}},markRead:s=>{const{unreadItems:i}=t();if(i.has(s)){const a=new Set(i);a.delete(s),dm(a),e({unreadItems:a})}},pruneUnread:s=>{const{unreadItems:i}=t(),a=new Set;let o=!1;for(const c of i)s.has(c)?a.add(c):o=!0;o&&(dm(a),e({unreadItems:a}))}})),Bx="claude-remote-notifications",yg="claude-remote-active-session",Ix="claude-remote-workspace-sessions",po=Ho("sessions"),fD=1e4;function pD(){try{return localStorage.getItem(yg)}catch{return null}}function dw(e){try{e===null?localStorage.removeItem(yg):localStorage.setItem(yg,e)}catch{}}function mD(){try{const e=localStorage.getItem(Ix);if(e)return JSON.parse(e)}catch{}return{}}function fm(e){try{localStorage.setItem(Ix,JSON.stringify(e))}catch{}}function gD(){try{const e=localStorage.getItem(Bx);if(e)return JSON.parse(e)}catch{}return{}}function pm(e){try{localStorage.setItem(Bx,JSON.stringify(e))}catch{}}async function hh(e,t,s,i){i==null||i(e,"loading");const a=performance.now();let o;try{const c=await(i?Promise.race([t(),new Promise((d,f)=>{o=setTimeout(()=>f(new Error("timeout")),fD)})]):t());return clearTimeout(o),i==null||i(e,"ok",{summary:s(c),durationMs:Math.round(performance.now()-a)}),{status:"fulfilled",value:c}}catch(c){clearTimeout(o);const d=c instanceof Error?c.message:String(c);return i==null||i(e,"fail",{error:d,durationMs:Math.round(performance.now()-a)}),{status:"rejected",reason:c}}}const se=En()((e,t)=>({sessions:[],worktrees:[],repos:[],workspaceGroups:[],activeSessionId:pD(),workspaceLastSession:mD(),loadingItems:{},notificationSessions:gD(),sidebarItems:[],enrichmentResults:{},setActiveSessionId:s=>{dw(s),e({activeSessionId:s})},rememberSessionForWorkspace:(s,i)=>{const a={...t().workspaceLastSession,[s]:i};fm(a),e({workspaceLastSession:a})},recallSessionForWorkspace:s=>{const{workspaceLastSession:i,sessions:a}=t(),o=i[s];if(!o)return null;if(!a.some(c=>c.id===o)){const c={...i};return delete c[s],fm(c),e({workspaceLastSession:c}),null}return o},enrichSidebarBranches:async()=>{const{worktrees:s}=t(),i=s.map(a=>({repoPath:a.repoPath,branchName:a.branchName}));if(i.length!==0)try{const a=await l2(i);e({enrichmentResults:a.results})}catch(a){po.warn("enrichSidebarBranches failed",a)}},getEnrichment:(s,i)=>t().enrichmentResults[`${s}::${i}`],refreshAll:async s=>{const[i,a,o,c]=await Promise.all([hh("sessions",KR,E=>`${E.length} active`,s),hh("worktrees",()=>JR(),E=>`${E.length} ${E.length===1?"tree":"trees"}`,s),hh("workspaces",e2,E=>`${E.length} ${E.length===1?"repo":"repos"}`,s),hh("groups",L2,E=>`${E.length} ${E.length===1?"group":"groups"}`,s)]),d=t();let{sessions:f,worktrees:h,repos:g,workspaceGroups:_,activeSessionId:y,notificationSessions:b,workspaceLastSession:S,sidebarItems:w}=d;i.status==="fulfilled"?f=i.value:po.error("refreshAll failed to fetch sessions",i.reason),a.status==="fulfilled"?h=a.value:po.error("refreshAll failed to fetch worktrees",a.reason),o.status==="fulfilled"?g=o.value:po.error("refreshAll failed to fetch repos",o.reason),c.status==="fulfilled"?_=c.value:po.error("refreshAll failed to fetch workspace groups",c.reason);const k=new Set(f.map(E=>E.id));y!==null&&!k.has(y)&&(y=null,dw(null));let T=!1;b={...b};for(const E of Object.keys(b))k.has(E)||(delete b[E],T=!0);T&&pm(b);let D=!1;S={...S};for(const[E,M]of Object.entries(S))k.has(M)||(delete S[E],D=!0);D&&fm(S);const{isUnread:N}=uh.getState();w=uD(f,h,g,w,N),uh.getState().pruneUnread(new Set(w.map(E=>E.id))),e({sessions:f,worktrees:h,repos:g,workspaceGroups:_,activeSessionId:y,notificationSessions:b,workspaceLastSession:S,sidebarItems:w})},getSessionsForRepo:s=>t().sessions.filter(i=>i.repoPath===s),getSessionsForWorkspaceGroup:s=>{const{sessions:i,workspaceGroups:a}=t(),o=i.filter(h=>h.workspaceId===s),c=a.find(h=>h.id===s);if(!c)return o;const d=new Set(c.repos),f=i.filter(h=>!h.workspaceId&&d.has(h.repoPath));return[...o,...f]},renameSession:(s,i,a)=>{e(o=>({sessions:o.sessions.map(c=>c.id===s?{...c,branchName:i,displayName:a}:c)}))},handleBranchChanged:(s,i)=>{e(a=>({sessions:a.sessions.map(o=>o.id===s?{...o,branchName:i}:o),sidebarItems:a.sidebarItems.map(o=>o.sessions.some(c=>c.id===s)?{...o,branchName:i}:o)})),t().sessions.some(a=>a.id===s)||po.debug("handleBranchChanged: session not found",s)},handleActivityChanged:(s,i,a)=>{const o=i||new Date().toISOString();e(c=>({sessions:c.sessions.map(d=>{if(d.id!==s)return d;const f={...d,lastActivity:o};return a!==void 0&&(f.currentActivity=a??void 0),f}),sidebarItems:c.sidebarItems.map(d=>d.sessions.some(f=>f.id===s)?{...d,lastActivity:o}:d)}))},handleBackendStateChanged:(s,i,a)=>{e(o=>{const c={running:"processing",idle:"idle",permission:"permission-prompt",error:"error",initializing:"initializing"},d=o.sessions.map(_=>_.id!==s?_:{..._,idle:i==="idle",agentState:c[i]}),{activeSessionId:f,notificationSessions:h}=o,g=o.sidebarItems.map(_=>{if(!_.sessions.some(D=>D.id===s))return _;const y=d.filter(D=>_.sessions.some(N=>N.id===D.id)),b=Yh(y);if(b===_.lastKnownBackendState)return _;const S=_.displayState,w=b==="permission"?a:void 0,k=vg(_.displayState,w?{type:"backend-state-changed",state:b,permissionType:w}:{type:"backend-state-changed",state:b});let T=_.isUnread;if(k!==S){const D=_.sessions.some(N=>N.id===f);if(hD(S,k,D)&&(uh.getState().markUnread(_.id),T=!0),nD(S,k)){const N=_.sessions.find(E=>E.id===s)??_.sessions.find(E=>h[E.id]);N&&h[N.id]&&Z2()&&J2(N)}}return{..._,lastKnownBackendState:b,displayState:k,isUnread:T}});return{sessions:d,sidebarItems:g}})},handleUserViewed:s=>{e(i=>({sidebarItems:i.sidebarItems.map(a=>a.sessions.some(o=>o.id===s)?(uh.getState().markRead(a.id),{...a,displayState:vg(a.displayState,{type:"user-viewed"}),isUnread:!1}):a)}))},setNotificationEnabled:(s,i)=>{const a={...t().notificationSessions,[s]:i};pm(a),e({notificationSessions:a})},initSessionNotification:(s,i)=>{const{notificationSessions:a}=t();if(!(s in a)){const o={...a,[s]:i};pm(o),e({notificationSessions:o})}},getNotificationSessionIds:()=>Object.entries(t().notificationSessions).filter(([,s])=>s).map(([s])=>s),setLoading:s=>e(i=>({loadingItems:{...i.loadingItems,[s]:!0}})),clearLoading:s=>e(i=>{const a={...i.loadingItems};return delete a[s],{loadingItems:a}}),isItemLoading:s=>!!t().loadingItems[s],reorderWorkspaces:async s=>{const i=await t2(s);e({repos:i})}})),Gs=En()((e,t)=>({defaultContinue:!0,defaultYolo:!1,launchInTmux:!1,defaultAgent:"claude",defaultNotifications:!0,refreshConfig:async()=>{const s=t(),[i,a,o,c,d]=await Promise.all([mx().catch(()=>s.defaultContinue),gx().catch(()=>s.defaultYolo),vx().catch(()=>s.launchInTmux),px().catch(()=>s.defaultAgent),yx().catch(()=>s.defaultNotifications)]);e({defaultContinue:i,defaultYolo:a,launchInTmux:o,defaultAgent:c,defaultNotifications:d})}})),_D={morning:["good morning","rise and shine","early bird gets the worm","coffee first, code second"],afternoon:["good afternoon","it's high noon","afternoon shift","back at it"],evening:["good evening","evening shift","winding down... or ramping up?"],night:["good evening","burning the midnight oil","the witching hour","night owl mode","the city sleeps but the terminal glows"]};function vD(e){const t=new Date().getHours(),s=t>=5&&t<12?"morning":t>=12&&t<17?"afternoon":t>=17&&t<21?"evening":"night",i=_D[s];return i[Math.floor(Math.random()*i.length)]}const yD=["auth","workspaces","sessions","worktrees","groups"];function fw(){return yD.map(e=>({service:e,status:"pending"}))}const dh=En()((e,t)=>({phase:"idle",greeting:"",lines:[],bootComplete:!1,startBoot:()=>{t().phase==="idle"&&e({greeting:vD(),lines:fw(),phase:"greeting"})},reportFetch:(s,i,a)=>{const{lines:o,phase:c}=t(),d=o.findIndex(g=>g.service===s);if(d===-1)return;const f=[...o];f[d]={service:s,status:i,summary:a==null?void 0:a.summary,durationMs:a==null?void 0:a.durationMs,error:a==null?void 0:a.error},e({lines:f,phase:c==="greeting"&&s!=="auth"&&i==="loading"?"booting":c})},finishBoot:()=>{const{lines:s}=t(),o=s.filter(c=>c.service!=="auth").some(c=>c.status==="fail")?"degraded":"ready";e({phase:o,bootComplete:!0})},resetBoot:()=>{e({lines:fw(),phase:"greeting",bootComplete:!1})}}));function kr(e){if(!e)return 0;const t=Date.parse(e);return Number.isFinite(t)?t:0}function zx(e,t){return e?kr(t.updatedAt)>=kr(e.updatedAt)?t:e:t}function bg(e,t){return e?kr(t.updatedAt)>=kr(e.updatedAt)?t:e:t}function pw(e,t,s){const i=kr(s),a={},o=new Set;for(const c of t)o.add(c.sessionId),a[c.sessionId]=zx(e[c.sessionId],c);for(const[c,d]of Object.entries(e))o.has(c)||kr(d.updatedAt)>i&&(a[c]=d);return a}function bD(e,t,s){return t?bg(e,t):e&&kr(e.updatedAt)>kr(s)?e:null}function SD(e=0){return{trackedSessions:0,totalSessions:e,totalInputTokens:0,totalOutputTokens:0,totalCacheRead:0,totalCacheWrite:0,totalCostUsd:null,averageContextPercent:null,maxContextPercent:null}}function wD(e,t){return e===null?t:t===null?e:e+t}function mm(e,t){const s=SD(e.length);let i=0,a=0;for(const o of e){const c=t[o.id];c&&(s.trackedSessions+=1,s.totalInputTokens+=c.totalInputTokens||0,s.totalOutputTokens+=c.totalOutputTokens||0,s.totalCacheRead+=c.totalCacheRead||0,s.totalCacheWrite+=c.totalCacheWrite||0,s.totalCostUsd=wD(s.totalCostUsd,c.costUsd),c.contextPercent>=0&&(i+=c.contextPercent,a+=1,s.maxContextPercent=s.maxContextPercent===null?c.contextPercent:Math.max(s.maxContextPercent,c.contextPercent)))}return a>0&&(s.averageContextPercent=i/a),s}function fh(e,t){return{sessionId:e,model:typeof t.model=="string"||t.model===null?t.model??null:null,totalInputTokens:typeof t.totalInputTokens=="number"?t.totalInputTokens:0,totalOutputTokens:typeof t.totalOutputTokens=="number"?t.totalOutputTokens:0,totalCacheRead:typeof t.totalCacheRead=="number"?t.totalCacheRead:0,totalCacheWrite:typeof t.totalCacheWrite=="number"?t.totalCacheWrite:0,contextPercent:typeof t.contextPercent=="number"?t.contextPercent:-1,contextWindowSize:typeof t.contextWindowSize=="number"?t.contextWindowSize:0,costUsd:typeof t.costUsd=="number"?t.costUsd:null,turnCount:typeof t.turnCount=="number"?t.turnCount:0,subagentCount:typeof t.subagentCount=="number"?t.subagentCount:0,source:t.source==="jsonl"?"jsonl":"statusLine",updatedAt:typeof t.updatedAt=="string"?t.updatedAt:new Date().toISOString()}}function mw(e){return{fiveHourUsedPercent:typeof e.fiveHourUsedPercent=="number"?e.fiveHourUsedPercent:-1,fiveHourResetsAt:typeof e.fiveHourResetsAt=="string"?e.fiveHourResetsAt:null,sevenDayUsedPercent:typeof e.sevenDayUsedPercent=="number"?e.sevenDayUsedPercent:-1,sevenDayResetsAt:typeof e.sevenDayResetsAt=="string"?e.sevenDayResetsAt:null,updatedAt:typeof e.updatedAt=="string"?e.updatedAt:new Date().toISOString()}}const Sr=En()((e,t)=>({sessionTelemetryById:{},accountTelemetry:null,telemetrySetupInstalled:null,summarizeSessionSetTelemetry:s=>mm(s,t().sessionTelemetryById),summarizeReposTelemetry:(s,i)=>{const{sessionTelemetryById:a}=t(),o=new Map;for(const h of i){const g=o.get(h.repoPath)??[];g.push(h),o.set(h.repoPath,g)}const c=s.map(h=>({repoPath:h.path,repoName:h.name,aggregate:mm(o.get(h.path)??[],a)})),d=i.filter(h=>!a[h.id]),f=mm(d,a);return f.totalSessions=d.length,{repos:c,outsideRelay:f}},summarizeSessionTelemetry:s=>t().sessionTelemetryById[s]??null,setSessionTelemetry:s=>{const{sessionTelemetryById:i}=t(),a=fh(s.sessionId,s),o=zx(i[a.sessionId],a);i[a.sessionId]!==o&&e({sessionTelemetryById:{...i,[a.sessionId]:o}})},setSessionTelemetryBatch:(s,i=new Date().toISOString())=>{const{sessionTelemetryById:a}=t(),o=s.map(c=>fh(c.sessionId,c));e({sessionTelemetryById:pw(a,o,i)})},clearSessionTelemetry:s=>{const{sessionTelemetryById:i}=t();if(!(s in i))return;const a={...i};delete a[s],e({sessionTelemetryById:a})},pruneSessionTelemetry:s=>{const{sessionTelemetryById:i}=t(),a=new Set(s),o={};let c=!1;for(const[d,f]of Object.entries(i))a.has(d)?o[d]=f:c=!0;c&&e({sessionTelemetryById:o})},setAccountTelemetrySnapshot:s=>{if(!s){e({accountTelemetry:null});return}const{accountTelemetry:i}=t();e({accountTelemetry:bg(i,mw(s))})},setTelemetrySetupInstalled:s=>e({telemetrySetupInstalled:s}),handleSessionTelemetryEvent:(s,i)=>{!i||typeof i!="object"||t().setSessionTelemetry(fh(s,i))},handleAccountTelemetryEvent:s=>{if(!s||typeof s!="object"){e({accountTelemetry:null});return}const{accountTelemetry:i}=t();e({accountTelemetry:bg(i,mw(s))})},refreshTelemetry:async()=>{const s=new Date().toISOString(),[i,a,o]=await Promise.allSettled([XR(),QR(),ZR()]),{sessionTelemetryById:c,accountTelemetry:d}=t(),f={};if(i.status==="fulfilled"){const h=i.value.map(g=>fh(g.sessionId,g));f.sessionTelemetryById=pw(c,h,s)}a.status==="fulfilled"&&(f.accountTelemetry=bD(d,a.value,s)),o.status==="fulfilled"&&(f.telemetrySetupInstalled=o.value.installed),Object.keys(f).length>0&&e(f)}})),Hx=location.protocol==="https:"?"wss:":"ws:";let Ht=null,gt=null,ri=null;const gw=30;let cc=null,_a=0,Dh=null,Xh=!1,ea=null,Lh=null,Qh=!1,ta=null,Sg=null,Mh=null,wg=null,Cg=null,xg=null,Ux=null;const Fx=3e4,$x=5e3,Vx='{"type":"ping"}',Wx='{"type":"pong"}';function Q_(e,t){Ht&&(Ht.onclose=null,Ht.close(),Ht=null),xg=e,Ux=t??null,Ng();const s=Hx+"//"+location.host+"/ws/events";Ht=new WebSocket(s),Ht.onopen=()=>{xD(),t==null||t()},Ht.onmessage=i=>{const a=i.data;if(Qh&&Xx(),a!==Wx)try{e(JSON.parse(a))}catch{}},Ht.onclose=()=>{Ng(),setTimeout(()=>Q_(e,t),3e3)},Ht.onerror=()=>{}}function Gx(e,t,s,i){cc&&(clearTimeout(cc),cc=null),_a=0,kg(),Sg=e,Mh=t,wg=s,Cg=i,ri&&(ri.onopen=null,ri.onmessage=null,ri.onclose=null,ri.onerror=null,ri.close(),ri=null),gt&&(gt.onclose=null,gt.close(),gt=null);const a=Hx+"//"+location.host+"/ws/"+e,o=new WebSocket(a);ri=o,o.onopen=()=>{ri=null,gt=o,_a=0,s(),CD()},o.onmessage=c=>{const d=c.data;Xh&&Kx(),d!==Wx&&t.write(d)},o.onclose=c=>{if(kg(),ri===o&&(ri=null),!(ri!==o&>!==o)){if(c.code===1e3){t.write(`\r
|
|
51
|
+
[Session ended]\r
|
|
52
|
+
`),gt=null,i();return}gt=null,_a===0&&t.write(`\r
|
|
53
|
+
[Reconnecting...]\r
|
|
54
|
+
`),Z_(e,t,s,i)}},o.onerror=()=>{}}function Z_(e,t,s,i){if(_a>=gw){t.write(`\r
|
|
55
|
+
[Gave up reconnecting after `+gw+` attempts]\r
|
|
56
|
+
`);return}const a=Math.min(1e3*2**_a,1e4);_a++,cc=setTimeout(async()=>{cc=null;try{if(!(await(await fetch("/sessions")).json()).some(d=>d.id===e)){t.write(`\r
|
|
57
|
+
[Session ended]\r
|
|
58
|
+
`),i();return}t.clear(),Gx(e,t,s,i)}catch{Z_(e,t,s,i)}},a)}function qx(){if(!(!gt||gt.readyState!==WebSocket.OPEN)){Xh=!0;try{gt.send(Vx)}catch{Eg();return}ea&&(clearTimeout(ea),ea=null),ea=setTimeout(()=>{Xh=!1,Eg()},$x)}}function CD(){Dh=setInterval(qx,Fx)}function kg(){Dh&&(clearInterval(Dh),Dh=null),Kx()}function Kx(){Xh=!1,ea&&(clearTimeout(ea),ea=null)}function Eg(){kg(),gt&&(gt.onclose=null,gt.close(),gt=null),Sg&&Mh&&wg&&Cg&&(_a===0&&Mh.write(`\r
|
|
59
|
+
[Reconnecting...]\r
|
|
60
|
+
`),Z_(Sg,Mh,wg,Cg))}function Yx(){if(!(!Ht||Ht.readyState!==WebSocket.OPEN)){Qh=!0;try{Ht.send(Vx)}catch{Tg();return}ta&&(clearTimeout(ta),ta=null),ta=setTimeout(()=>{Qh=!1,Tg()},$x)}}function Tg(){Ng(),Ht&&(Ht.onclose=null,Ht.close(),Ht=null),xg&&Q_(xg,Ux??void 0)}function xD(){Lh=setInterval(Yx,Fx)}function Ng(){Lh&&(clearInterval(Lh),Lh=null),Xx()}function Xx(){Qh=!1,ta&&(clearTimeout(ta),ta=null)}document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&(gt&>.readyState!==WebSocket.OPEN?Eg():gt&&qx(),Ht&&Ht.readyState!==WebSocket.OPEN?Tg():Ht&&Yx())});function mi(e){gt&>.readyState===WebSocket.OPEN&>.send(e)}function gm(e,t){gt&>.readyState===WebSocket.OPEN&>.send(JSON.stringify({type:"resize",cols:e,rows:t}))}function kD(e){return Number.isFinite(e)?Math.max(Ox,Math.min(jx,Math.round(e))):Bo}function ED(e){return Math.round(e/Bo*100)}function TD(e,t,s){const i=s/Bo,a=8*i,o=17*i;return{cols:Math.max(80,Math.floor((e-60)/a)),rows:Math.max(24,Math.floor((t-120)/o))}}function ND(e){return e.split("/").filter(Boolean).pop()||e}function Zh(e){if(!e)return"";const t=Date.now(),s=new Date(e).getTime(),i=Math.floor((t-s)/1e3);if(i<60)return"just now";const a=Math.floor(i/60);if(a<60)return a+"m ago";const o=Math.floor(a/60);if(o<24)return o+"h ago";const c=Math.floor(o/24);if(c===1)return"yesterday";if(c<7)return c+"d ago";const d=new Date(e);return["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][d.getMonth()]+" "+d.getDate()}function _w(e){if(!e)return"";const t=Date.now(),s=new Date(e).getTime(),i=Math.floor((t-s)/1e3);if(i<60)return i+"s";const a=Math.floor(i/60);if(a<60)return a+"m";const o=Math.floor(a/60);if(o<24)return o+"h";const c=new Date(e),d=String(c.getDate()).padStart(2,"0"),f=String(c.getMonth()+1).padStart(2,"0"),h=String(c.getFullYear()).slice(-2);return`${d}-${f}-${h}`}const Qe=typeof window<"u"&&"ontouchstart"in window&&/Android|iPhone|iPad|iPod/i.test(navigator.userAgent),Ag=typeof navigator<"u"&&/Mac/.test(navigator.platform||"")&&!/iPhone|iPad|iPod/.test(navigator.platform||"");function Qx(){const e=Qe?12:fe.getState().terminalFontSize;return TD(window.innerWidth,window.innerHeight,e)}const AD=5e3,RD=20,DD=["terminal.","session-tab."];let uc=[],Oh=null,Zx="desktop",jh=null;function Sd(){if(uc.length===0)return;const e=uc;uc=[];const t=JSON.stringify({events:e});if(navigator.sendBeacon){const s=new Blob([t],{type:"application/json"});navigator.sendBeacon("/analytics/events",s)}else fetch("/analytics/events",{method:"POST",headers:{"Content-Type":"application/json"},body:t,keepalive:!0}).catch(()=>{})}function Rg(e,t,s,i,a){uc.push({category:e,action:t,target:s??null,properties:i??null,session_id:a??null,device:Zx}),uc.length>=RD&&Sd()}function LD(e){let t=e;for(;t;){const s=t.getAttribute("data-track");if(s)return s;t=t.parentElement}return null}function MD(e){const t=e.tagName.toLowerCase(),s=e.className&&typeof e.className=="string"?"."+e.className.trim().split(/\s+/).slice(0,2).join("."):"";return t+s}function Jx(e){const t=e.target;if(!t)return;const s=LD(t),i=s||MD(t),a=(t.textContent||"").trim().slice(0,50)||null,c=s!=null&&DD.some(d=>s.startsWith(d))?(jh==null?void 0:jh())??null:null;Rg("ui","click",i,a?{text:a}:void 0,c)}function OD(e){Zx=Qe?"mobile":"desktop",jh=e,document.addEventListener("click",Jx,{capture:!0,passive:!0}),Oh=setInterval(Sd,AD),document.addEventListener("visibilitychange",ek)}function ek(){document.visibilityState==="hidden"&&Sd()}function jD(){Sd(),Oh&&(clearInterval(Oh),Oh=null),document.removeEventListener("click",Jx,{capture:!0}),document.removeEventListener("visibilitychange",ek)}function PD({authAuthenticated:e,queryClient:t,throttledChangedFilesRefresh:s,setChangedFilesData:i}){C.useEffect(()=>{if(!e)return;const a=new Map;let o=null;function c(){t.invalidateQueries({queryKey:["pr"]}),t.invalidateQueries({queryKey:["ci-status"]}),se.getState().enrichSidebarBranches()}function d(){o||(o=setTimeout(()=>{o=null,c(),t.invalidateQueries({queryKey:["org-prs"]})},500))}const f={"worktrees-changed":()=>{se.getState().refreshAll()},"session-backend-state-changed":h=>{se.getState().handleBackendStateChanged(h.sessionId,h.state,h.permissionType)},"session-renamed":h=>{se.getState().renameSession(h.sessionId,h.branchName,h.displayName),c()},"session-branch-changed":h=>{se.getState().handleBranchChanged(h.sessionId,h.branch)},"session-ended":()=>{c(),se.getState().refreshAll()},"ref-changed":h=>{const g=h.cwdPath,_=a.get(g);_&&clearTimeout(_),a.set(g,setTimeout(()=>{a.delete(g),c()},5e3))},"pr-updated":()=>{d()},"ci-updated":()=>{d()},"files-changed":h=>{const g=se.getState().activeSessionId,_=g?se.getState().sessions.find(b=>b.id===g):void 0;((_==null?void 0:_.cwd)??(_==null?void 0:_.repoPath))===h.workspacePath&&(s(),t.invalidateQueries({queryKey:["files-list"]}),h.changedFiles&&i(h.changedFiles))},"session-activity-changed":h=>{se.getState().handleActivityChanged(h.sessionId,h.timestamp,h.currentActivity??void 0)},"session-telemetry":h=>{Sr.getState().handleSessionTelemetryEvent(h.sessionId,h.data)},"account-telemetry":h=>{Sr.getState().handleAccountTelemetryEvent(h.data)},"browser-tab-opened":h=>{fe.getState().openHtmlTab(h.filePath,h.token)},"browser-tab-refreshed":h=>{fe.getState().refreshHtmlTab(h.filePath)}};return Q_(h=>{const g=f[h.type];g&&g(h)},()=>{Sr.getState().refreshTelemetry()}),()=>{for(const h of a.values())clearTimeout(h);a.clear(),o&&(clearTimeout(o),o=null)}},[e])}const BD=Ho("shortcuts");function ID(e){const t=e.toLowerCase().split("+");return{mod:t.includes("mod"),shift:t.includes("shift"),key:t.filter(s=>s!=="mod"&&s!=="shift").join("+")||e}}const zD={"[":"{","]":"}","\\":"|",";":":","'":'"',",":"<",".":">","/":"?","`":"~",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(",0:")","-":"_","=":"+"};function HD(e,t,s){const i=s?e.metaKey:e.ctrlKey;if(t.mod&&!i||!t.mod&&i||t.shift!==e.shiftKey)return!1;if(e.key.toLowerCase()===t.key.toLowerCase())return!0;if(t.shift){const a=zD[t.key.toLowerCase()];if(a&&e.key===a)return!0}return!1}function UD(e,t){const i=e.split("+").map(a=>{switch(a.toLowerCase()){case"mod":return t?"⌘":"ctrl";case"shift":return t?"⇧":"shift";default:return a.length===1?a.toUpperCase():a}});return t?i.join(""):i.join("+")}function FD(e,t,s){const i=a=>{var h;if(!(s?a.metaKey:a.ctrlKey))return;const c=(h=document.activeElement)==null?void 0:h.tagName,d=c==="INPUT"||c==="TEXTAREA",f=e();for(const g of f){if(!g.shortcut)continue;const _=ID(g.shortcut.key);if(!HD(a,_,s)||d&&!g.shortcut.global)continue;const y=t();if(g.when&&!g.when(y))continue;a.preventDefault();const b=g.handler(y);b instanceof Promise&&b.catch(S=>BD.error(`Shortcut action "${g.id}" failed`,S));return}};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)}const tk=new Map,sk=new Map;function $D(e){for(const t of e){if(sk.has(t.id))throw new Error(`Action "${t.id}" is already registered as contextual`);tk.set(t.id,t)}}function ik(){return[...tk.values(),...sk.values()]}function VD(){var t,s;const e=(t=document.activeElement)==null?void 0:t.tagName;return e==="INPUT"||e==="TEXTAREA"||!!((s=document.activeElement)!=null&&s.isContentEditable)}function nk(){const{activeSessionId:e,sessions:t}=se.getState();return e?t.find(s=>s.id===e):void 0}function WD(e,t){if(e.shiftKey||e.key<"1"||e.key>"9")return!1;const s=fe.getState().activeRepoPath,i=nk(),a=s?se.getState().getSessionsForRepo(s):[],o=(i?a.filter(f=>f.cwd===i.cwd):a).toSorted((f,h)=>new Date(f.createdAt).getTime()-new Date(h.createdAt).getTime());if(o.length===0)return!1;e.preventDefault();const c=parseInt(e.key,10),d=c===9?o[o.length-1]:o[c-1];return d&&t(d.id),!0}const GD={p:(e,t)=>e.shiftKey?!1:(e.preventDefault(),t.setSpotlightOpen(s=>!s),!0),k:(e,t)=>(e.preventDefault(),t.setPickerOpen(s=>!s),!0),o:(e,t)=>{if(e.shiftKey)return!1;const s=nk(),i=(s==null?void 0:s.worktreePath)??(s==null?void 0:s.repoPath)??"";return!s||!i?!1:(e.preventDefault(),t.setFilePickerOpen(a=>!a),!0)},b:(e,t)=>(e.preventDefault(),fe.getState().toggleRightSidebarCollapsed(),!0)};function qD(e,t){const s=a=>{if(!(Ag?a.metaKey:a.ctrlKey))return;const c=GD[a.key];c&&c(a,e)||VD()||WD(a,e.handleSelectSession)};document.addEventListener("keydown",s);const i=FD(()=>ik(),()=>t.current,Ag);return()=>{document.removeEventListener("keydown",s),i()}}function KD(e,t){if(!Qe||!window.visualViewport)return;const s=window.visualViewport;let i=null;const a=()=>{const o=window.innerHeight-s.height;fe.setState({keyboardOpen:o>50});const c=e.current;c&&(c.style.height=o>50?s.height+"px":""),window.scrollTo(0,0),i&&clearTimeout(i),i=setTimeout(()=>{var d;return(d=t.current)==null?void 0:d.fitTerm()},100)};return s.addEventListener("resize",a),s.addEventListener("scroll",a),()=>{s.removeEventListener("resize",a),s.removeEventListener("scroll",a),i&&clearTimeout(i)}}function YD(){if(!Qe)return;const e=30,t=50;let s=0,i=0,a=!1;const o=f=>{const h=f.touches[0];h&&h.clientX<=e&&!fe.getState().sidebarOpen&&(s=h.clientX,i=h.clientY,a=!0)},c=f=>{if(!a)return;const h=f.touches[0];if(!h)return;const g=h.clientX-s,_=Math.abs(h.clientY-i);if(_>g&&(_>8||g>8)){a=!1;return}g>=t&&(a=!1,fe.getState().openSidebar())},d=()=>{a=!1};return document.addEventListener("touchstart",o,{passive:!0}),document.addEventListener("touchmove",c,{passive:!0}),document.addEventListener("touchend",d),()=>{document.removeEventListener("touchstart",o),document.removeEventListener("touchmove",c),document.removeEventListener("touchend",d)}}function XD(){if(!Qe)return;const e=()=>{fe.setState({hasHardwareKeyboard:!0}),document.removeEventListener("keydown",e)};document.addEventListener("keydown",e)}function QD(e){const{handleSelectSession:t,setSpotlightOpen:s,setPickerOpen:i,setFilePickerOpen:a,mainAppRef:o,terminalRef:c,actionContextRef:d}=e;C.useEffect(()=>{const h=qD({setSpotlightOpen:s,setPickerOpen:i,setFilePickerOpen:a,handleSelectSession:t},d),g=KD(o,c),_=YD();return XD(),()=>{h(),g==null||g(),_==null||_()}},[])}const ZD={id:"session.new-agent",label:"new agent session",description:"start claude or codex",category:"session",icon:"+",shortcut:{key:"mod+t",global:!0},when:e=>!!e.workspacePath},JD={id:"session.new-terminal",label:"new terminal session",description:"open a bare shell",category:"session",icon:"+",when:e=>!!e.workspacePath},eL={id:"session.close-active",label:"close active session",description:"close the current tab",category:"session",icon:"×",shortcut:{key:"mod+w"},when:e=>!!e.sessionId},tL={id:"session.kill",label:"kill session",description:"terminate the active session process",category:"session",icon:"■",when:e=>!!e.sessionId},sL={id:"session.start-on-repo",label:"start session on repo",description:"open agent on current workspace",category:"session",icon:"▸",when:e=>!!e.workspacePath},iL={id:"session.start-on-ticket",label:"start work on ticket",description:"pick a ticket and start coding",category:"session",icon:"◆",when:e=>!!e.workspacePath},nL={id:"session.customize",label:"customize session",description:"configure agent and flags for a new session",category:"session",icon:">",when:e=>!!e.workspacePath},rL={id:"session.switch-to-tab",label:"switch to session tab",description:"jump to a specific open session",category:"session",icon:"→",when:e=>!!e.sessionId},aL={id:"session.rename",label:"rename active session",description:"change the display name of the current session",category:"session",icon:"~",when:e=>!!e.sessionId},oL={id:"workspace.add",label:"add workspace",description:"connect a repo",category:"workspace",icon:"+"},lL={id:"workspace.new-worktree",label:"new worktree",description:"create a branch and start coding",category:"workspace",icon:"+",when:e=>!!e.workspacePath},cL={id:"pr.create",label:"create pull request",description:"open a PR for this branch",aliases:["pr","pull request","open pr"],category:"pr",icon:"⇗",when:e=>!!e.workspacePath},uL={id:"pr.push-branch",label:"push branch",description:"push to remote",aliases:["push","git push"],category:"pr",icon:"↑",when:e=>!!e.workspacePath},hL={id:"pr.switch-branch",label:"switch branch",description:"check out a different branch",aliases:["checkout","branch"],category:"pr",icon:"⇄",when:e=>!!e.workspacePath},dL={id:"pr.fix-conflicts",label:"fix conflicts",description:"resolve merge conflicts on current branch",category:"pr",icon:"!",when:e=>!!e.workspacePath},fL={id:"pr.archive-branch",label:"archive branch",description:"archive the current branch",category:"pr",icon:"—",when:e=>!!e.workspacePath},pL={id:"pr.rename-branch",label:"rename branch",description:"change the current branch name",category:"pr",icon:"~",when:e=>!!e.workspacePath},mL={id:"pr.copy-branch-name",label:"copy branch name",description:"copy current branch name to clipboard",category:"pr",icon:"⎘",when:e=>!!e.workspacePath},gL={id:"pr.open-external",label:"open pr externally",description:"view pull request in browser",aliases:["github","open pr"],category:"pr",icon:"⇗",when:e=>!!e.workspacePath},_L={id:"pr.refresh",label:"refresh pr data",description:"reload pr status and ci checks",category:"pr",icon:"↻",when:e=>!!e.workspacePath},vL={id:"pr.change-target",label:"change target branch",description:"set a different base branch for the pr",category:"pr",icon:"⇄",when:e=>!!e.workspacePath},yL={id:"pr.skip-checks",label:"skip checks",description:"bypass ci checks for this pr",category:"pr",icon:"»",when:e=>!!e.workspacePath},bL={id:"settings.open",label:"open settings",description:"app preferences and integrations",category:"settings",icon:">"},SL={id:"settings.connect-github",label:"connect github",description:"link your github account",category:"settings",icon:">"},wL={id:"settings.toggle-yolo",label:"toggle yolo mode",description:"skip permission checks",category:"settings",icon:"!"},CL={id:"settings.check-updates",label:"check for updates",description:"see if a new version is available",category:"settings",icon:"↻"},xL={id:"settings.disconnect-github",label:"disconnect github",description:"remove github account connection",category:"settings",icon:"×"},kL={id:"settings.setup-webhooks",label:"setup webhooks",description:"configure webhook integrations",category:"settings",icon:">"},EL={id:"settings.remove-webhook",label:"remove webhook",description:"delete a webhook configuration",category:"settings",icon:"×"},TL={id:"settings.test-webhook",label:"test webhook",description:"send a test webhook payload",category:"settings",icon:"▸"},NL={id:"settings.connect-jira",label:"connect jira",description:"link your jira account",category:"settings",icon:">"},AL={id:"settings.disconnect-jira",label:"disconnect jira",description:"remove jira account connection",category:"settings",icon:"×"},RL={id:"settings.toggle-devtools",label:"toggle developer tools",description:"show or hide debug panel",category:"settings",icon:">"},DL={id:"settings.clear-analytics",label:"clear analytics",description:"delete local usage data",category:"settings",icon:"×"},LL={id:"settings.toggle-continue",label:"toggle continue session",description:"resume last session when opening a repo",category:"settings",icon:"↻"},ML={id:"settings.toggle-tmux",label:"toggle tmux",description:"wrap sessions in tmux",category:"settings",icon:">"},OL={id:"settings.toggle-notifications",label:"toggle notifications",description:"enable or disable push notifications",category:"settings",icon:"●"},jL={id:"settings.change-default-agent",label:"change default agent",description:"set the default coding agent",category:"settings",icon:">"},PL={id:"sidebar.collapse",label:"toggle sidebar",description:"collapse or expand the sidebar",category:"sidebar",icon:"«"},BL={id:"sidebar.navigate-dashboard",label:"go to workspace dashboard",description:"open the workspace overview",category:"sidebar",icon:"■",when:e=>!!e.workspacePath},IL={id:"sidebar.workspace-settings",label:"workspace settings",description:"configure workspace preferences",category:"sidebar",icon:">",when:e=>!!e.workspacePath},zL={id:"sidebar.rename-session",label:"rename session",description:"change the display name of a session",category:"sidebar",icon:"~",when:e=>!!e.sessionId},HL={id:"sidebar.delete-worktree",label:"delete worktree",description:"remove a branch worktree",category:"sidebar",icon:"×",when:e=>!!e.workspacePath},UL={id:"sidebar.resume-session",label:"resume session on worktree",description:"continue a previous session",category:"sidebar",icon:"▸",when:e=>!!e.workspacePath},FL={id:"sidebar.resume-yolo",label:"resume session (yolo)",description:"continue with yolo mode enabled",category:"sidebar",icon:"!",when:e=>!!e.workspacePath},$L={id:"dashboard.open-pr-session",label:"open session on pr branch",description:"start a session on a pull request branch",category:"dashboard",icon:"+",when:e=>!!e.workspacePath},VL={id:"dashboard.sort-prs",label:"sort pr table",description:"change sort order for pull requests",category:"dashboard",icon:"↕",when:e=>!!e.workspacePath},WL={id:"dashboard.clear-filters",label:"clear filters",description:"reset all active filters",category:"dashboard",icon:"×"},GL={id:"org.switch-tab",label:"switch prs/tickets tab",description:"toggle between prs and tickets view",category:"org",icon:"⇄"},qL={id:"org.save-filter",label:"save filter preset",description:"save current filter configuration",category:"org",icon:"+"},KL={id:"org.delete-filter",label:"delete filter preset",description:"remove a saved filter",category:"org",icon:"×"},YL={id:"org.toggle-pr-status",label:"toggle pr status filter",description:"show or hide prs by status",category:"org",icon:"●"},XL={id:"org.navigate-to-workspace",label:"open workspace from pr",description:"navigate to the workspace for a pull request",category:"org",icon:"→"},QL={id:"ticket.switch-provider",label:"switch github/jira tab",description:"toggle between github and jira tickets",category:"ticket",icon:"⇄"},ZL={id:"ticket.open-external",label:"open ticket externally",description:"view ticket in browser",category:"ticket",icon:"⇗"},JL={id:"terminal.scroll-top",label:"scroll to top",description:"scroll terminal output to the top",category:"terminal",icon:"↑",when:e=>!!e.sessionId},eM={id:"terminal.scroll-bottom",label:"scroll to bottom",description:"scroll terminal output to the bottom",category:"terminal",icon:"↓",when:e=>!!e.sessionId},tM={id:"navigation.previous-tab",label:"previous tab",description:"switch to the previous session tab",category:"navigation",icon:"←",shortcut:{key:"mod+shift+["},when:e=>!!e.sessionId},sM={id:"navigation.next-tab",label:"next tab",description:"switch to the next session tab",category:"navigation",icon:"→",shortcut:{key:"mod+shift+]"},when:e=>!!e.sessionId},iM={id:"navigation.switch-to-tab",label:"switch to tab by number",description:"jump to a specific session tab (1-9)",aliases:["tab 1","tab 2","tab 3"],category:"navigation",icon:"#"},nM={id:"navigation.open-file",label:"open file...",description:"search and open a file in the current repo",category:"navigation",icon:"◇",shortcut:{key:"mod+o"},when:e=>!!e.sessionId},vw=Ho("ActionRegistry");function rM(e){const{handleQuickAgent:t,handleQuickTerminal:s,handleCloseSession:i,handleSelectSession:a,handleNewWorktree:o,handleOpenSettings:c,handleRenameActiveSession:d,navigateToDashboard:f,customizeDialogRef:h,settingsDialogRef:g,deleteWorktreeDialogRef:_,addWorkspaceDialogRef:y,workspaceSettingsDialogRef:b,terminalRef:S,setFilePickerOpen:w}=e;C.useEffect(()=>{const T=[[xL,"section-integrations"],[kL,"section-integrations"],[EL,"section-integrations"],[TL,"section-integrations"],[NL,"section-integrations"],[AL,"section-integrations"],[RL,"section-advanced"],[DL,"section-advanced"],[LL,"section-general"],[ML,"section-general"],[OL,"section-general"],[jL,"section-general"]].map(([E,M])=>({...E,handler:()=>{var U;return(U=g.current)==null?void 0:U.open(M)}})),N=[VL,WL,GL,qL,KL,YL,XL,QL,ZL,rL,iM].map(E=>({...E,handler:()=>{}}));$D([{...ZD,handler:()=>t()},{...JD,handler:()=>s()},{...eL,handler:()=>{const E=se.getState().activeSessionId;E&&i(E)}},{...tL,handler:async()=>{const E=se.getState().activeSessionId;if(E){try{await ux(E)}catch(M){vw.error("Failed to kill session",M)}await se.getState().refreshAll()}}},{...sL,handler:()=>t()},{...iL,handler:()=>f()},{...nL,handler:()=>{var U;const E=fe.getState().activeRepoPath,M=E?se.getState().repos.find(W=>W.path===E):void 0;M&&((U=h.current)==null||U.open({name:M.name,path:M.path}))}},{...aL,handler:()=>d()},{...oL,handler:()=>{var E;return(E=y.current)==null?void 0:E.open()}},{...lL,handler:()=>{const E=fe.getState().activeRepoPath,M=E?se.getState().repos.find(U=>U.path===E):void 0;M&&o(M)}},{...cL,handler:()=>f()},{...uL,handler:()=>f()},{...hL,handler:()=>f()},{...dL,handler:()=>f()},{...fL,handler:()=>f()},{...pL,handler:()=>f()},{...mL,handler:async()=>{var Y;const E=se.getState().activeSessionId,M=E?se.getState().sessions.find(K=>K.id===E):void 0,U=fe.getState().activeRepoPath,W=U?se.getState().getSessionsForRepo(U):[],$=(Y=(M?W.filter(K=>K.cwd===M.cwd):W).toSorted((K,X)=>new Date(K.createdAt).getTime()-new Date(X.createdAt).getTime())[0])==null?void 0:Y.branchName;$&&await navigator.clipboard.writeText($)}},{...gL,handler:()=>f()},{..._L,handler:async()=>{await se.getState().refreshAll()}},{...vL,handler:()=>f()},{...yL,handler:()=>f()},{...bL,handler:()=>c()},{...SL,handler:()=>{var E;return(E=g.current)==null?void 0:E.open("section-integrations")}},{...wL,handler:async()=>{const E=Gs.getState().defaultYolo;Gs.setState({defaultYolo:!E});try{await _x(!E)}catch(M){Gs.setState({defaultYolo:E}),vw.error("Failed to update default YOLO setting",M)}}},{...CL,handler:()=>{var E;return(E=g.current)==null?void 0:E.open("section-about")}},...T,{...PL,handler:()=>fe.getState().toggleSidebarCollapsed()},{...BL,handler:()=>f()},{...IL,handler:()=>{var U;const E=fe.getState().activeRepoPath,M=E?se.getState().repos.find(W=>W.path===E):void 0;M&&((U=b.current)==null||U.open(M.path,M.name))}},{...zL,handler:()=>d()},{...HL,handler:()=>{var W;const E=se.getState().activeSessionId,M=E?se.getState().sessions.find(B=>B.id===E):void 0,U=se.getState().worktrees.find(B=>B.path===(M==null?void 0:M.worktreePath));U&&((W=_.current)==null||W.open(U))}},{...UL,handler:()=>t()},{...FL,handler:()=>t()},{...$L,handler:()=>t()},{...JL,handler:()=>{var E,M;return(M=(E=S.current)==null?void 0:E.getTerm())==null?void 0:M.scrollToLine(0)}},{...eM,handler:()=>{var E,M;return(M=(E=S.current)==null?void 0:E.getTerm())==null?void 0:M.scrollToBottom()}},{...tM,handler:()=>{const E=se.getState().activeSessionId,M=fe.getState().activeRepoPath,U=E?se.getState().sessions.find(K=>K.id===E):void 0,W=M?se.getState().getSessionsForRepo(M):[],B=(U?W.filter(K=>K.cwd===U.cwd):W).toSorted((K,X)=>new Date(K.createdAt).getTime()-new Date(X.createdAt).getTime());if(B.length===0)return;const $=B.findIndex(K=>K.id===E),Y=$<=0?B[B.length-1]:B[$-1];Y&&a(Y.id)}},{...sM,handler:()=>{const E=se.getState().activeSessionId,M=fe.getState().activeRepoPath,U=E?se.getState().sessions.find(K=>K.id===E):void 0,W=M?se.getState().getSessionsForRepo(M):[],B=(U?W.filter(K=>K.cwd===U.cwd):W).toSorted((K,X)=>new Date(K.createdAt).getTime()-new Date(X.createdAt).getTime());if(B.length===0)return;const $=B.findIndex(K=>K.id===E),Y=$===-1||$===B.length-1?B[0]:B[$+1];Y&&a(Y.id)}},{...nM,handler:()=>{w(!0)}},{id:"workspace.open-diff-view",label:"open diff view",description:"open full-page diff viewer for changed files",category:"workspace",shortcut:{key:"d"},when:E=>E.view==="session",handler:()=>{const E=se.getState().activeSessionId,M=E?se.getState().sessions.find(W=>W.id===E):void 0,U=(M==null?void 0:M.cwd)??(M==null?void 0:M.repoPath)??"";U&&fe.setState({fullPageDiff:{workspacePath:U}})}},{id:"workspace.close-diff-view",label:"close diff view",description:"close full-page diff viewer",category:"workspace",shortcut:{key:"Escape"},when:()=>!!fe.getState().fullPageDiff,handler:()=>{fe.setState({fullPageDiff:null})}},...N])},[])}let aM=0;const $l=En()((e,t)=>({toasts:[],showToast:(s,i)=>{const a=(i==null?void 0:i.variant)??"error",o=(i==null?void 0:i.durationMs)??5e3,c=aM++;e(d=>({toasts:[...d.toasts,{id:c,message:s,variant:a}]})),setTimeout(()=>t().dismissToast(c),o)},dismissToast:s=>{e(i=>({toasts:i.toasts.filter(a=>a.id!==s)}))}}));function J_(e){return{commitsAhead:1,prState:e.isDraft?"DRAFT":e.state,ciPassing:e.ciStatus==="SUCCESS"?1:0,ciFailing:e.ciStatus==="FAILURE"||e.ciStatus==="ERROR"?1:0,ciPending:e.ciStatus==="PENDING"?1:0,ciTotal:e.ciStatus?1:0,mergeable:e.mergeable??null,unresolvedCommentCount:e.reviewDecision==="CHANGES_REQUESTED"?1:0,role:e.role}}function wd(e){const{commitsAhead:t,prState:s,ciFailing:i,ciPending:a,ciTotal:o,mergeable:c,unresolvedCommentCount:d}=e,f=e.role??"author";return t<=0&&s===null?{type:"none",color:"none",label:""}:s===null?{type:"create-pr",color:"accent",label:"Create PR"}:s==="DRAFT"?f==="reviewer"?{type:"none",color:"none",label:""}:{type:"ready-for-review",color:"muted",label:"Ready for Review"}:s==="MERGED"?{type:"archive-merged",color:"merged",label:"Archive"}:s==="CLOSED"?{type:"archive-closed",color:"muted",label:"Archive"}:s==="OPEN"?c==="CONFLICTING"?{type:"fix-conflicts",color:"error",label:"Fix Conflicts"}:i>0?f==="reviewer"?{type:"checks-running",color:"muted",label:"CI Failing"}:{type:"fix-errors",color:"error",label:`Fix Errors ${i}/${o}`}:a>0?{type:"checks-running",color:"warning",label:"Checks Running..."}:d>0?f==="reviewer"?{type:"review-pr",color:"info",label:"Review"}:{type:"resolve-comments",color:"accent",label:`Resolve Comments (${d})`}:f==="reviewer"?{type:"review-pr",color:"info",label:"Review"}:{type:"merge-pr",color:"success",label:"Merge"}:{type:"none",color:"none",label:""}}function oM(e,t){const s=t.role??"author";return e.type==="resolve-comments"?{type:"review-pr",color:"muted",label:"Review PR"}:e.type==="review-pr"&&s==="reviewer"&&t.unresolvedCommentCount>0?{type:"resolve-comments",color:"accent",label:`Resolve Comments (${t.unresolvedCommentCount})`}:null}function rk(e,t){switch(e.type){case"create-pr":return`Create a pull request for the branch "${t.branchName}". Write a clear title and description based on the changes.`;case"ready-for-review":return`Mark the draft PR for branch "${t.branchName}" as ready for review using: gh pr ready`;case"review-pr":return`Review the pull request #${t.prNumber} for branch "${t.branchName}". Read the diff, check for bugs and code quality.`;case"fix-conflicts":return`There are merge conflicts with the base branch "${t.baseBranch}". Run \`git merge ${t.baseBranch}\` and resolve all conflicts.`;case"resolve-comments":return`There are ${t.unresolvedCommentCount} unresolved review comments on PR #${t.prNumber}. Read each comment thread, triage them, and address the feedback.`;case"fix-errors":return`The CI checks are failing on branch "${t.branchName}". Investigate the failing checks and fix the errors.`;case"merge-pr":return null;case"archive-merged":case"archive-closed":return null;case"checks-running":case"none":return null}}function lM(e){const s=e.labels.map(a=>a.name.toLowerCase()).includes("bug")?"fix":"feat",i=e.title.toLowerCase().replace(/[^a-z0-9\s]/g,"").split(/\s+/).slice(0,5).join("-");return`${s}/issue-${e.number}-${i}`}const pn=Ho("useSessionHandlers");function cM({terminalRef:e,customizeDialogRef:t,settingsDialogRef:s,deleteWorktreeDialogRef:i,addWorkspaceDialogRef:a,workspaceSettingsDialogRef:o,setAnalyticsView:c}){const d=C.useCallback(()=>{se.getState().setActiveSessionId(null)},[]),f=C.useCallback((P,j)=>{se.getState().setActiveSessionId(P);const H=se.getState().sessions.find(O=>O.id===P);H&&fe.getState().setActiveRepoPath(H.repoPath),se.getState().handleUserViewed(P),fe.getState().closeSidebar()},[]),h=C.useCallback(async()=>{const P=prompt("rename session:"),j=se.getState().activeSessionId;P!=null&&P.trim()&&j&&await c2(j,P.trim())},[]),g=C.useCallback(P=>{var H;c(null),se.getState().setActiveSessionId(P);const j=se.getState().sessions.find(O=>O.id===P);j&&(se.getState().rememberSessionForWorkspace(j.repoPath,P),fe.getState().setActiveRepoPath(j.repoPath)),se.getState().handleUserViewed(P),fe.getState().closeSidebar(),(H=e.current)==null||H.focusTerm()},[c,e]),_=C.useCallback(P=>{if(c(null),fe.getState().activeRepoPath===P)if(se.getState().activeSessionId)se.getState().setActiveSessionId(null);else{const H=se.getState().recallSessionForWorkspace(P);H&&se.getState().setActiveSessionId(H)}else fe.getState().setActiveRepoPath(P),se.getState().setActiveSessionId(se.getState().recallSessionForWorkspace(P));fe.getState().closeSidebar()},[c]),y=C.useCallback(async()=>{const P=fe.getState().activeRepoPath,j=P?se.getState().repos.find(re=>re.path===P):void 0;if(!j)return;const H=se.getState().activeSessionId,O=H?se.getState().sessions.find(re=>re.id===H):void 0,{cols:z,rows:Q}=Qx();try{const re=await qr({repoPath:j.path,worktreePath:(O==null?void 0:O.worktreePath)??null,type:"agent",cols:z,rows:Q});await se.getState().refreshAll(),re!=null&&re.id&&(se.getState().setActiveSessionId(re.id),se.getState().initSessionNotification(re.id,Gs.getState().defaultNotifications))}catch(re){if(re instanceof Error&&"sessionId"in re){const ne=re;await se.getState().refreshAll(),ne.sessionId&&se.getState().setActiveSessionId(ne.sessionId)}else pn.error("Failed to create agent session:",re),$l.getState().showToast(re instanceof Error?re.message:"failed to create agent session")}},[]),b=C.useCallback(async()=>{const P=fe.getState().activeRepoPath,j=P?se.getState().repos.find(z=>z.path===P):void 0;if(!j)return;const H=se.getState().activeSessionId,O=H?se.getState().sessions.find(z=>z.id===H):void 0;try{const z=await qr({repoPath:j.path,worktreePath:(O==null?void 0:O.worktreePath)??null,type:"terminal"});await se.getState().refreshAll(),z!=null&&z.id&&(se.getState().setActiveSessionId(z.id),se.getState().initSessionNotification(z.id,Gs.getState().defaultNotifications))}catch(z){pn.error("Failed to create terminal session:",z),$l.getState().showToast(z instanceof Error?z.message:"failed to create terminal session")}},[]),S=C.useCallback(()=>{var H;const P=fe.getState().activeRepoPath,j=P?se.getState().repos.find(O=>O.path===P):void 0;j&&((H=t.current)==null||H.open({name:j.name,path:j.path}))},[t]),w=C.useCallback(P=>{var j,H;P?(j=o.current)==null||j.open(P.path,P.name):(H=s.current)==null||H.open()},[o,s]),k=C.useCallback(async P=>{var H,O;const j=`new-worktree:${P.path}`;if(!se.getState().isItemLoading(j)){se.getState().setLoading(j);try{const{branchName:z,worktreePath:Q}=await lh(P.path),re=await qr({repoPath:P.path,worktreePath:Q,type:"agent",branchName:z,needsBranchRename:!0});await se.getState().refreshAll(),se.getState().setActiveSessionId(re.id),fe.getState().setActiveRepoPath(P.path),se.getState().initSessionNotification(re.id,Gs.getState().defaultNotifications),fe.getState().closeSidebar(),(H=e.current)==null||H.focusTerm()}catch(z){pn.error("Failed to create worktree session:",z),$l.getState().showToast(z instanceof Error?z.message:"failed to create worktree"),(O=t.current)==null||O.open({name:P.name,path:P.path})}finally{se.getState().clearLoading(j)}}},[e,t]),T=C.useCallback(async P=>{var H;const j=`ws-launch:${P}`;if(!se.getState().isItemLoading(j)){se.getState().setLoading(j);try{const O=await M2(P);if(await se.getState().refreshAll(),se.getState().setActiveSessionId(O.id),fe.getState().setActiveRepoPath(O.repoPath),fe.getState().setActiveWorkspaceId(P),fe.getState().closeSidebar(),(H=O.warnings)!=null&&H.length){const z=O.warnings.map(Q=>` ${Q.repoPath}: ${Q.error}`).join(`
|
|
61
|
+
`);pn.warn("[workspace-session] partial failure:",O.warnings),alert(`workspace launched with warnings:
|
|
62
|
+
${z}`)}}catch(O){const z=O instanceof Error?O.message:"unknown error";pn.error("[workspace-session] launch failed:",O),alert(`workspace launch failed: ${z}`)}finally{se.getState().clearLoading(j)}}},[]),D=C.useCallback(async P=>{const j=fe.getState().activeRepoPath,H=j?se.getState().repos.find(I=>I.path===j):void 0;if(!H)return;const O=H.path,z=se.getState().sessions,Q=se.getState().worktrees,re=z.find(I=>I.branchName===P.headRefName&&I.repoPath===O),ne=Q.find(I=>I.branchName===P.headRefName&&I.repoPath===O);let A=`Merge the branch "${P.baseRefName}" into this branch and resolve all merge conflicts. Use \`git merge ${P.baseRefName}\` and fix any conflicts in the working tree. After resolving, verify the build passes.`;try{const I=await v2(O);I.promptFixConflicts&&(A=I.promptFixConflicts.replace(/\{baseRefName\}/g,P.baseRefName).replace(/\{headRefName\}/g,P.headRefName))}catch{}try{let I,q;if(re)I=re.worktreePath,q=re.branchName;else if(ne)I=ne.path,q=ne.branchName;else{const ve=await lh(O,P.headRefName);I=ve.worktreePath,q=ve.branchName}const oe=await qr({repoPath:O,worktreePath:I,type:"agent",branchName:q});await se.getState().refreshAll(),se.getState().setActiveSessionId(oe.id),fe.getState().setActiveRepoPath(O),se.getState().initSessionNotification(oe.id,Gs.getState().defaultNotifications),fe.getState().closeSidebar(),setTimeout(()=>{mi(A+"\r")},1500)}catch(I){pn.error("Failed to start conflict resolution:",I),$l.getState().showToast(I instanceof Error?I.message:"failed to start conflict resolution")}},[]),N=C.useCallback(async(P,j)=>{const H=fe.getState().activeRepoPath,O=H?se.getState().repos.find(I=>I.path===H):void 0;if(!O)return;const z=O.path,Q=se.getState().sessions,re=se.getState().worktrees,ne=Q.find(I=>I.branchName===P.headRefName&&I.repoPath===z),A=re.find(I=>I.branchName===P.headRefName&&I.repoPath===z);try{let I,q;if(ne)I=ne.worktreePath,q=ne.branchName;else if(A)I=A.path,q=A.branchName;else{const ve=await lh(z,P.headRefName);I=ve.worktreePath,q=ve.branchName}const oe=await qr({repoPath:z,worktreePath:I,type:"agent",branchName:q});await se.getState().refreshAll(),se.getState().setActiveSessionId(oe.id),fe.getState().setActiveRepoPath(z),se.getState().initSessionNotification(oe.id,Gs.getState().defaultNotifications),fe.getState().closeSidebar(),j&&setTimeout(()=>{mi(j+"\r")},1500)}catch(I){pn.error("Failed to open PR branch session:",I),$l.getState().showToast(I instanceof Error?I.message:"failed to open session on this branch")}},[]),E=C.useCallback(async(P,j,H)=>{try{const O=se.getState().sessions,z=se.getState().worktrees,Q=O.find(q=>q.branchName===P&&q.repoPath===j),re=z.find(q=>q.branchName===P&&q.repoPath===j);let ne,A;if(Q)ne=Q.worktreePath,A=Q.branchName;else if(re)ne=re.path,A=re.branchName;else{const q=await lh(j,P);ne=q.worktreePath,A=q.branchName}const I=await qr({repoPath:j,worktreePath:ne,type:"agent",branchName:A});await se.getState().refreshAll(),se.getState().setActiveSessionId(I.id),fe.getState().setActiveRepoPath(j),se.getState().initSessionNotification(I.id,Gs.getState().defaultNotifications),fe.getState().closeSidebar(),H&&setTimeout(()=>mi(H+"\r"),1500)}catch(O){pn.error("Failed to open branch session:",O)}},[]),M=C.useCallback(async()=>{const P=se.getState().activeSessionId;if(!P)return;const j=se.getState().sessions.find(H=>H.id===P);if(j){if(await ux(P),j.worktreePath!==null)try{await hx(j.worktreePath,j.repoPath)}catch{}se.getState().setActiveSessionId(null),await se.getState().refreshAll()}},[]),U={"resume-session":async P=>{P.existingSessionId?f(P.existingSessionId,"agent"):pn.warn("resume-session intent missing existingSessionId")},"fix-conflicts":async(P,j)=>{j.kind==="pr"&&await D(j.pr)},"review-pr":async(P,j)=>{j.kind==="pr"&&await N(j.pr,P.prompt??void 0)},"fix-errors":async(P,j)=>{j.kind==="pr"&&await N(j.pr,P.prompt??void 0)},"resolve-comments":async(P,j)=>{j.kind==="pr"&&await N(j.pr,P.prompt??void 0)},"create-pr":async(P,j)=>{j.kind==="pr"&&await N(j.pr,P.prompt??void 0)},"merge-pr":async(P,j)=>{j.kind==="pr"&&window.open(j.pr.url,"_blank")},"open-branch":async(P,j)=>{j.kind==="branch"&&await E(j.name,j.repoPath,P.prompt??void 0)},"start-from-issue":async(P,j)=>{if(j.kind==="issue"){const H=lM(j.issue);await E(H,j.issue.repoPath,P.prompt??void 0)}},archive:async P=>{P.existingSessionId&&(se.getState().setActiveSessionId(P.existingSessionId),await M())}},W=C.useCallback(async(P,j)=>{const H=U[P.type];H&&await H(P,j)},[f,D,N,E,M]),B=C.useCallback(P=>{const j=wd(J_(P)),H=rk(j,{branchName:P.headRefName,baseBranch:P.baseRefName,prNumber:P.number});H&&N(P,H)},[N]),$=C.useCallback(P=>{N(P)},[N]),Y=C.useCallback(P=>{var j;(j=i.current)==null||j.open(P)},[i]),K=C.useCallback(P=>{var j;se.getState().setActiveSessionId(P),se.getState().initSessionNotification(P,Gs.getState().defaultNotifications),fe.getState().closeSidebar(),(j=e.current)==null||j.focusTerm()},[e]),X=C.useCallback(P=>{var H;fetch(`/sessions/${P}`,{method:"DELETE"}).then(()=>se.getState().refreshAll());const j=se.getState().activeSessionId;if(j===P){const O=se.getState().sessions.find(A=>A.id===j),z=fe.getState().activeRepoPath,Q=z?se.getState().getSessionsForRepo(z):[],ne=(O?Q.filter(A=>A.cwd===O.cwd):Q).filter(A=>A.id!==P);se.getState().setActiveSessionId(((H=ne[0])==null?void 0:H.id)??null)}},[]);return{navigateToDashboard:d,navigateToSession:f,handleRenameActiveSession:h,handleSelectSession:g,handleSelectWorkspace:_,handleQuickAgent:y,handleQuickTerminal:b,handleCustomize:S,handleOpenSettings:w,handleNewWorktree:k,handleLaunchWorkspaceSession:T,handleFixConflicts:D,handleOpenPrBranch:N,handleOpenBranchSession:E,handleArchive:M,handlePickerIntent:W,handlePrAction:B,handleOpenPrSession:$,handleDeleteWorktree:Y,handleNewSessionCreated:K,handleCloseSession:X}}function uM({state:e="loading",statusText:t="Connecting...",errorMessage:s,appName:i="claude-remote"}){return p.jsxs("div",{className:"boot-screen",role:"status","aria-live":"polite",children:[p.jsx("div",{className:"boot-screen__logo",children:i}),e==="loading"?p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"boot-screen__status",children:t}),p.jsxs("div",{className:"boot-screen__progress","aria-hidden":"true",children:[p.jsx("span",{className:"boot-screen__dot"}),p.jsx("span",{className:"boot-screen__dot"}),p.jsx("span",{className:"boot-screen__dot"})]})]}):e==="error"?p.jsxs("div",{className:"boot-screen__error",children:[p.jsx("div",{children:s??"Connection failed."}),p.jsx("div",{className:"boot-screen__error-code",children:"Check server is running and refresh."})]}):null]})}const Me=({variant:e="primary",size:t="default",disabled:s=!1,type:i="button",href:a,onClick:o,onMouseEnter:c,onMouseLeave:d,className:f="",children:h,...g})=>{const _=["tui-btn",`tui-btn--${e}`,t==="sm"&&"tui-btn--sm",t==="icon"&&"tui-btn--icon",s&&"tui-btn--disabled",f].filter(Boolean).join(" ");return a?p.jsx("a",{className:_,href:a,"aria-disabled":s||void 0,tabIndex:s?-1:void 0,onClick:s?void 0:o,onMouseEnter:c,onMouseLeave:d,...g,children:h}):p.jsx("button",{className:_,type:i,disabled:s,onClick:o,onMouseEnter:c,onMouseLeave:d,...g,children:h})},Dg=({value:e="",placeholder:t,type:s="text",disabled:i=!1,id:a,onInput:o,onKeyDown:c,onChange:d,className:f="",autoFocus:h=!1,...g})=>{const _=C.useRef(null),y=C.useRef(null),[b,S]=C.useState(!1),[w,k]=C.useState(!0),[T,D]=C.useState(0),[N,E]=C.useState(16),[M,U]=C.useState(!1),W=C.useRef(void 0);C.useEffect(()=>{const H=window.matchMedia("(prefers-reduced-motion: reduce)");U(H.matches);const O=z=>{U(z.matches)};return H.addEventListener("change",O),()=>H.removeEventListener("change",O)},[]);const B=C.useCallback(()=>{if(!_.current||!y.current)return;const H=_.current.selectionStart??0,O=s==="password"?"•".repeat(H):(e??"").slice(0,H);y.current.textContent=O||"",D(y.current.offsetWidth),E(_.current.offsetHeight||16)},[s,e]);C.useEffect(()=>{B()},[e,B]),C.useEffect(()=>()=>{W.current!==void 0&&clearTimeout(W.current)},[]);const $=H=>{const O=H.target.value;d&&d(O),k(!1),W.current!==void 0&&clearTimeout(W.current),W.current=setTimeout(()=>{k(!0)},530),B(),o&&o(H)},Y=H=>{k(!1),W.current!==void 0&&clearTimeout(W.current),W.current=setTimeout(()=>{k(!0)},530),requestAnimationFrame(B),c&&c(H)},K=()=>{S(!0),B()},X=()=>{S(!1),W.current!==void 0&&(clearTimeout(W.current),W.current=void 0),k(!0)},P=()=>{requestAnimationFrame(B)},j=["tui-input-wrapper",f].filter(Boolean).join(" ");return p.jsxs("div",{className:j,children:[p.jsx("input",{ref:_,type:s,value:e,disabled:i,id:a,placeholder:t,className:"tui-input",onInput:$,onKeyDown:Y,onFocus:K,onBlur:X,onClick:P,autoFocus:h,...g}),p.jsx("span",{ref:y,className:"tui-measure","aria-hidden":"true"}),b&&!i&&p.jsx("span",{className:`tui-cursor${w&&!M?" blinking":""}`,style:{left:`${T}px`,height:`${N}px`},"aria-hidden":"true",children:"█"})]})},Lg={type:"password",inputMode:"numeric",maxLength:20};function hM({pinValue:e,confirmValue:t,onPinChange:s,onConfirmChange:i,onKeyDown:a,onSubmit:o}){return p.jsxs(p.Fragment,{children:[p.jsx("p",{children:"set up a PIN to secure this instance"}),p.jsx(Dg,{...Lg,value:e,onChange:s,onKeyDown:a,placeholder:"choose a PIN",autoFocus:!0}),p.jsx(Dg,{...Lg,value:t,onChange:i,onKeyDown:a,placeholder:"confirm PIN"}),p.jsx(Me,{variant:"primary",onClick:o,children:"set PIN"})]})}function dM({pinValue:e,onPinChange:t,onKeyDown:s,onSubmit:i}){return p.jsxs(p.Fragment,{children:[p.jsx("p",{children:"enter PIN to continue"}),p.jsx(Dg,{...Lg,value:e,onChange:t,onKeyDown:s,placeholder:"PIN",autoFocus:!0}),p.jsx(Me,{variant:"primary",onClick:i,children:"unlock"}),p.jsxs("p",{className:"hint",children:["forgot your PIN? run ",p.jsx("code",{children:"relay-ide pin reset"})," on the host machine"]})]})}function fM(e,t,s,i,a,o,c){return async()=>{s("");const d=e.trim(),f=t.trim();if(!d||!f){s("enter a PIN and confirm it");return}if(d.length<4){s("PIN must be at least 4 characters");return}if(d!==f){s("PINs do not match"),i("");return}await o(d,f),c&&(a(""),i(""))}}function pM(){const{needsSetup:e,pinError:t,submitPin:s,setupNewPin:i}=Jl(),[a,o]=C.useState(""),[c,d]=C.useState(""),[f,h]=C.useState(""),g=t||f,_=async()=>{h("");const S=a.trim();S&&(await s(S),t&&o(""))},y=fM(a,c,h,d,o,i,t),b=S=>{S.key==="Enter"&&(e?y():_())};return p.jsx("div",{className:"pin-gate",children:p.jsxs("div",{className:"pin-container",children:[p.jsx("h1",{children:"Relay"}),e?p.jsx(hM,{pinValue:a,confirmValue:c,onPinChange:o,onConfirmChange:d,onKeyDown:b,onSubmit:y}):p.jsx(dM,{pinValue:a,onPinChange:o,onKeyDown:b,onSubmit:_}),g&&p.jsx("p",{className:"error",children:g})]})})}const yw=["#d97757","#4ade80","#60a5fa","#a78bfa","#f472b6","#fb923c","#34d399","#f87171","#fbbf24","#38bdf8","#a3e635","#818cf8"];function ev(e){let t=0;for(let s=0;s<e.length;s++)t=(t<<5)-t+e.charCodeAt(s)|0;return yw[Math.abs(t)%yw.length]??"#d97757"}const bw="!@#$%^&*()_+-=[]{}|;:,.<>?/~`0123456789abcdef";function _m(){return bw[Math.floor(Math.random()*bw.length)]}function Uo({text:e,loading:t=!1,duration:s=400}){const[i,a]=C.useState(!1),[o,c]=C.useState([]),[d,f]=C.useState(!1),h=C.useRef(void 0),g=C.useRef([]);return C.useEffect(()=>{const _=window.matchMedia("(prefers-reduced-motion: reduce)");a(_.matches);const y=b=>{a(b.matches)};return _.addEventListener("change",y),()=>_.removeEventListener("change",y)},[]),C.useEffect(()=>{const _=()=>{h.current!==void 0&&(clearInterval(h.current),h.current=void 0);for(const y of g.current)clearTimeout(y);g.current=[]};if(i)return c(e.split("")),f(!1),_;if(t){const y=e.length;c(Array.from({length:y},()=>_m())),f(!0),h.current=setInterval(()=>{c(Array.from({length:y},()=>_m()))},40)}else{const y=e.split(""),b=y.length;c(w=>w.length!==b?Array.from({length:b},()=>_m()):w),f(!0);const S=Math.max(1,Math.round(s/Math.max(b,1)));for(let w=0;w<b;w++){const k=w,T=setTimeout(()=>{c(D=>{const N=[...D];return N[k]=y[k],N}),k===b-1&&f(!1)},k*S);g.current.push(T)}}return _},[e,t,s,i]),p.jsx("span",{"aria-live":"polite",className:"cipher-text",children:d||t?o.join(""):e})}const vm=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],ym=["|","/","-","\\"],ph=4;function tc({variant:e="braille",value:t=0,width:s=16,className:i="",...a}){const[o,c]=C.useState(!1),[d,f]=C.useState(0),[h,g]=C.useState(0),_=C.useRef(0),y=C.useRef(1);C.useEffect(()=>{const N=window.matchMedia("(prefers-reduced-motion: reduce)");c(N.matches);const E=M=>{c(M.matches)};return N.addEventListener("change",E),()=>N.removeEventListener("change",E)},[]),C.useEffect(()=>{if(e!=="braille"||o)return;const N=window.setInterval(()=>{f(E=>(E+1)%vm.length)},80);return()=>window.clearInterval(N)},[e,o]),C.useEffect(()=>{if(e!=="line"||o)return;const N=window.setInterval(()=>{f(E=>(E+1)%ym.length)},120);return()=>window.clearInterval(N)},[e,o]),C.useEffect(()=>{if(e!=="knight-rider"||o)return;_.current=0,y.current=1,g(0);const N=window.setInterval(()=>{let E=_.current+y.current;E>=s-ph?(E=Math.max(0,s-ph),y.current=-1):E<=0&&(E=0,y.current=1),_.current=E,g(E)},60);return()=>window.clearInterval(N)},[e,o,s]);const b=C.useMemo(()=>{if(e!=="bar")return"";const N=Math.max(0,Math.min(100,t)),E=Math.round(N/100*s),M=s-E;return`[${"█".repeat(E)}${"░".repeat(M)}] ${Math.round(N)}%`},[e,t,s]),S=C.useMemo(()=>{if(e!=="knight-rider")return"";const N=o?0:h,E="░".repeat(N),M="█".repeat(ph),U="░".repeat(Math.max(0,s-N-ph));return`[${E}${M}${U}]`},[e,o,h,s]),w=o?vm[0]:vm[d],k=o?ym[0]:ym[d],T=e==="bar"?b:e==="knight-rider"?S:e==="braille"?w:k,D=["tui-progress",i].filter(Boolean).join(" ");return p.jsx("span",{...a,className:D,role:"status","aria-label":"loading",children:T})}function jc(e){return e.state==="MERGED"?"merged":e.state==="CLOSED"?"closed":e.isDraft?"draft":e.reviewDecision==="CHANGES_REQUESTED"?"changes-requested":e.reviewDecision==="APPROVED"?"approved":e.role==="reviewer"?"review-requested":"open"}function Fo({status:e,size:t=7}){const s=e==="attention"||e==="permission-prompt";return p.jsx("span",{className:`status-dot status-dot--${e}${s?" pulse":""}`,style:{width:`${t}px`,height:`${t}px`},role:"img","aria-label":`${e} status`})}function Vr({speed:e=50,fadeWidth:t=24,overscroll:s=32,children:i}){const a=C.useRef(null),o=C.useRef(null),[c,d]=C.useState(0);C.useEffect(()=>{const _=a.current,y=o.current;if(!_||!y)return;const b=new ResizeObserver(()=>{if(_&&y){const S=Math.max(0,y.scrollWidth-_.clientWidth);d(S)}});return b.observe(_),b.observe(y),()=>b.disconnect()},[]);const f=C.useCallback(()=>{const _=o.current;if(!_||c<=0)return;const y=c+s,b=y/e;_.style.transition=`transform ${b}s ease-in-out`,_.style.transform=`translateX(-${y}px)`},[c,s,e]),h=C.useCallback(()=>{const _=o.current;if(!_||c<=0)return;const y=(c+s)/e;_.style.transition=`transform ${y}s ease-in-out`,_.style.transform="translateX(0)"},[c,s,e]),g=c>0;return p.jsx("div",{ref:a,className:"marquee-container",style:{"--fade-width":`${t}px`,"--has-overflow":g?"1":"0"},onMouseEnter:f,onMouseLeave:h,children:p.jsx("div",{ref:o,className:"marquee-inner",children:i})})}const mM=p.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"square",width:"14",height:"14",children:[p.jsx("circle",{cx:"12",cy:"12",r:"3"}),p.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1-1.51V15H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]});function gM(e,t,s){var c,d,f;if(e===t){const h=s.find(g=>g.worktreePath===null);return h&&h.displayName&&h.displayName!==h.repoName?h.displayName:"default"}const a=(c=s.find(h=>h.branchName))==null?void 0:c.branchName,o=(d=s[0])==null?void 0:d.cwd.split("/").pop();return a||o||((f=s[0])==null?void 0:f.repoName)||"unknown"}function _M({pr:e}){return p.jsxs("span",{className:"sidebar-pr-status",children:[p.jsx(Fo,{status:jc(e),size:5}),e.ciStatus==="SUCCESS"?p.jsx("span",{className:"ci-pass",children:p.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"square",width:"9",height:"9",children:p.jsx("polyline",{points:"20 6 9 17 4 12"})})}):e.ciStatus==="FAILURE"||e.ciStatus==="ERROR"?p.jsx("span",{className:"ci-fail",children:p.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"square",width:"9",height:"9",children:[p.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),p.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}):e.ciStatus==="PENDING"?p.jsx("span",{className:"ci-pending",style:{fontSize:"9px"},children:"●"}):null]})}function ak({workspace:e,sessionGroups:t,inactiveWorktrees:s=[],isActive:i,activeSessionId:a=null,onSelectWorkspace:o,onSelectSession:c,onNewWorktree:d,onOpenSettings:f,onDeleteSession:h,onDeleteWorktree:g,onResumeWorktree:_,orgPrs:y=[],sidebarItems:b=[],collapsed:S=!1,onToggleCollapse:w,loadingItems:k=new Set}){const T=C.useMemo(()=>ev(e.name),[e.name]),D=e.name.charAt(0).toUpperCase(),E=C.useMemo(()=>[...t.values()].flat(),[t]).length+s.length,M=C.useMemo(()=>new Map(b.map(K=>[K.id,K])),[b]),U=C.useMemo(()=>b.filter(K=>K.repoPath===e.path).some(K=>Kh(K.displayState)),[b,e.path]),W=k.has(`new-worktree:${e.path}`),B=C.useRef(null);function $(){B.current&&(clearTimeout(B.current),B.current=null)}function Y(K){return y==null?void 0:y.find(X=>X.headRefName===K&&X.state==="OPEN"&&X.repoPath===e.path)}return p.jsxs("div",{className:["workspace-item",i&&"active"].filter(Boolean).join(" "),children:[p.jsxs("div",{className:["workspace-header",U&&"attention"].filter(Boolean).join(" "),"data-track":"sidebar.workspace.click",onClick:()=>o(e.path),children:[p.jsxs("div",{className:"workspace-left",children:[p.jsx("span",{className:["collapse-chevron",S&&"collapsed"].filter(Boolean).join(" "),onClick:K=>{K.stopPropagation(),w==null||w()},children:S?"›":"⌄"}),p.jsx("span",{className:"initial-block",style:{background:T},children:D}),p.jsx("span",{className:"workspace-name",children:p.jsx(Vr,{children:e.name})}),S&&E>0?p.jsx("span",{className:"collapse-count",children:E}):null]}),p.jsx("div",{className:"workspace-actions",children:p.jsx("button",{className:"action-btn",title:"Settings",type:"button",onClick:K=>{K.stopPropagation(),f(e)},children:mM})})]}),S?null:p.jsxs("ul",{className:"session-list",children:[[...t.entries()].map(([K,X])=>{var O,z;const j=[...X].sort((Q,re)=>re.lastActivity.localeCompare(Q.lastActivity))[0],H=K===e.path;if(j){const Q=Y(((O=X[0])==null?void 0:O.branchName)??""),re=X.some(I=>a===I.id),ne=M.get(K)!==void 0&&Kh(M.get(K).displayState),A=((z=M.get(K))==null?void 0:z.displayState)??"inactive";return p.jsxs("li",{className:["session-row",re&&"selected",ne&&"attention"].filter(Boolean).join(" "),"data-track":"sidebar.session.click",onClick:()=>c(j.id),onTouchEnd:$,onTouchMove:$,children:[p.jsxs("div",{className:"session-row-primary",children:[p.jsx("span",{className:`status-dot status-dot--${A}`}),p.jsx("span",{className:["session-name",ne&&"bold"].filter(Boolean).join(" "),children:p.jsx(Vr,{children:gM(K,e.path,X)})}),X.length>1?p.jsx("span",{className:"session-count-badge",children:X.length}):null,Q?p.jsx(_M,{pr:Q}):null]}),p.jsxs("div",{className:"session-row-secondary",children:[p.jsx("span",{className:"secondary-time",children:_w(j.lastActivity)}),j.branchName?p.jsx("span",{className:"secondary-branch",children:p.jsx(Vr,{children:j.branchName})}):null]})]},K)}else if(H){const Q=`repo-session:${e.path}`,re=k.has(Q);return p.jsxs("li",{className:["session-row","inactive",re&&"loading"].filter(Boolean).join(" "),"data-track":"sidebar.repo.click",onClick:()=>{re||o(e.path)},children:[p.jsxs("div",{className:"session-row-primary",children:[p.jsx("span",{className:"dot dot-inactive"}),p.jsx("span",{className:"session-name",children:p.jsx(Vr,{children:re?"starting...":"default"})})]}),e.defaultBranch?p.jsx("div",{className:"session-row-secondary",children:p.jsx("span",{className:"secondary-branch",children:p.jsx(Vr,{children:e.defaultBranch})})}):null]},K)}return null}),s.map(K=>{const X=k.has(K.path);return p.jsxs("li",{className:["session-row","inactive",X&&"loading"].filter(Boolean).join(" "),"data-track":"sidebar.worktree.click",onClick:()=>{X||_==null||_(K)},onTouchEnd:$,onTouchMove:$,children:[p.jsxs("div",{className:"session-row-primary",children:[p.jsx("span",{className:"dot dot-inactive"}),p.jsx("span",{className:"session-name",children:p.jsx(Vr,{children:X?"resuming...":K.branchName||K.displayName||K.name})})]}),p.jsxs("div",{className:"session-row-secondary",children:[p.jsx("span",{className:"secondary-time",children:_w(K.lastActivity)}),K.branchName?p.jsx("span",{className:"secondary-branch",children:p.jsx(Vr,{children:K.branchName})}):null]})]},K.path)})]}),S?null:p.jsx("div",{className:["add-worktree-row",W&&"disabled"].filter(Boolean).join(" "),"data-track":"sidebar.new-worktree",onClick:()=>{W||d(e)},children:p.jsx("button",{className:"add-worktree-btn",type:"button",tabIndex:-1,children:W?"creating...":"+ new worktree"})}),p.jsx("div",{className:"workspace-divider"})]})}function vM(e,t){const s=new Map;s.set(e.path,[]);for(const i of t){if(i.repoPath!==e.path)continue;const a=i.worktreePath??e.path,o=s.get(a)??[];o.push(i),s.set(a,o)}return s}function yM(e,t,s){const i=new Set(t.filter(a=>a.repoPath===e.path&&a.worktreePath!==null).map(a=>a.worktreePath));return s.filter(a=>a.repoPath===e.path&&!i.has(a.path))}function bM({workspace:e,repos:t,sessions:s,worktrees:i,launching:a,activeRepoPath:o,activeSessionId:c,workspaceSessions:d,orgPrs:f,loadingItems:h,onLaunchSession:g,onSelectSession:_,onSelectWorkspace:y,onNewWorktree:b,onOpenSettings:S,onDeleteSession:w,onDeleteWorktree:k}){return p.jsxs("div",{className:"group-body",children:[d.length>0?p.jsx("ul",{className:"workspace-sessions",children:d.map(T=>p.jsxs("li",{className:"ws-session-row",onClick:()=>_(T.id),children:[p.jsx("span",{className:"ws-badge",children:"workspace"}),p.jsx("span",{className:"ws-session-name",children:T.displayName})]},T.id))}):null,p.jsx("div",{className:"launch-row",children:p.jsx(Me,{variant:"primary",disabled:a??!1,onClick:T=>{T.stopPropagation(),g(e.id)},children:a?p.jsxs(p.Fragment,{children:[p.jsx(tc,{variant:"braille"})," launching..."]}):"> launch workspace session"})}),t.length===0?p.jsx("div",{className:"empty-repos",children:"no repos"}):t.map(T=>p.jsx(ak,{workspace:T,sessionGroups:vM(T,s),inactiveWorktrees:yM(T,s,i),isActive:o===T.path&&!c,activeSessionId:c??null,onSelectWorkspace:y,onSelectSession:_,onNewWorktree:b,onOpenSettings:S,onDeleteSession:D=>w==null?void 0:w(D),onDeleteWorktree:D=>k==null?void 0:k(D),orgPrs:f??[],...h?{loadingItems:h}:{}},T.path))]})}function SM({workspace:e,repos:t,sessions:s=[],worktrees:i=[],loading:a=!1,collapsed:o=!1,launching:c=!1,activeRepoPath:d=null,activeSessionId:f=null,onToggleCollapse:h,onLaunchSession:g,onSelectSession:_,onSelectWorkspace:y,onNewWorktree:b,onOpenSettings:S,onDeleteSession:w,onDeleteWorktree:k,orgPrs:T,loadingItems:D=new Set}){const N=e.themeColor??ev(e.name),E=`color-mix(in srgb, ${N} 30%, transparent)`,M=C.useMemo(()=>s.filter(W=>W.workspaceId===e.id),[s,e.id]),U=s.length;return p.jsxs("div",{className:["workspace-group",o&&"collapsed"].filter(Boolean).join(" "),style:{"--theme-color":N,"--accent-border":E},children:[p.jsx("div",{className:"group-header",onClick:h,children:p.jsxs("div",{className:"header-left",children:[p.jsx("span",{className:"chevron",children:o?"›":"⌄"}),p.jsx("span",{className:"group-name",children:p.jsx(Uo,{text:e.name,loading:a})}),o&&U>0?p.jsx("span",{className:"session-count",children:U}):null]})}),o?null:p.jsx(bM,{workspace:e,repos:t,sessions:s,worktrees:i,launching:c,activeRepoPath:d,activeSessionId:f,workspaceSessions:M,...T?{orgPrs:T}:{},loadingItems:D,onLaunchSession:g,onSelectSession:_,onSelectWorkspace:y,onNewWorktree:b,onOpenSettings:S,...w?{onDeleteSession:w}:{},...k?{onDeleteWorktree:k}:{},onToggleCollapse:h,collapsed:o,loading:a})]})}function wM(){const e=C.useCallback(s=>{s.preventDefault();const i=s.clientX,a=fe.getState().sidebarWidth;function o(d){const f=Math.min(Mx,Math.max(Lx,a+(d.clientX-i)));fe.setState({sidebarWidth:f})}function c(){document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",c),document.body.style.cursor="",document.body.style.userSelect="",fe.getState().saveSidebarWidth()}document.addEventListener("mousemove",o),document.addEventListener("mouseup",c),document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[]),t=C.useCallback(s=>{s.preventDefault(),fe.setState({sidebarWidth:Dx}),fe.getState().saveSidebarWidth()},[]);return{startResize:e,resetWidth:t}}function CM({ungroupedRepos:e,activeRepoPath:t,activeSessionId:s,worktrees:i,orgPrs:a,onSelectWorkspace:o,onSelectSession:c,onNewWorktree:d,onOpenSettings:f,onDeleteSession:h,onDeleteWorktree:g}){const _=se(y=>y.getSessionsForRepo);return p.jsx("div",{className:"sidebar-ungrouped-list",children:e.map(y=>{const b=_(y.path),S=new Set(b.map(T=>T.worktreePath).filter(Boolean)),w=i.filter(T=>T.repoPath===y.path&&T.path.startsWith(y.path+"/")&&!S.has(T.path)),k=xM(y.path,b);return p.jsx("div",{children:p.jsx(ak,{workspace:y,sessionGroups:k,inactiveWorktrees:w,isActive:t===y.path&&!s,activeSessionId:s??null,onSelectWorkspace:o,onSelectSession:c,onNewWorktree:d,onOpenSettings:f,...h?{onDeleteSession:h}:{},...g?{onDeleteWorktree:g}:{},orgPrs:a})},y.path)})})}function xM(e,t){const s=new Map;s.set(e,[]);for(const c of t){const d=c.worktreePath??c.repoPath,f=s.get(d);f?f.push(c):s.set(d,[c])}const i=new Map,a=s.get(e);a&&i.set(e,a);const o=[...s.keys()].filter(c=>c!==e).sort();for(const c of o)i.set(c,s.get(c));return i}function kM({onSelectSession:e,onOpenSettings:t,onNewWorktree:s,onAddWorkspace:i,onDeleteSession:a,onDeleteWorktree:o,onLaunchWorkspaceSession:c,onOpenAnalytics:d}){const f=fe(z=>z.sidebarOpen),h=fe(z=>z.sidebarCollapsed),g=fe(z=>z.sidebarWidth),_=fe(z=>z.activeRepoPath),y=fe(z=>z.closeSidebar),b=fe(z=>z.toggleSidebarCollapsed),S=se(z=>z.repos),w=se(z=>z.worktrees),k=se(z=>z.workspaceGroups),T=se(z=>z.activeSessionId),D=se(z=>z.getSessionsForWorkspaceGroup),{startResize:N,resetWidth:E}=wM(),M=h?z2:g,{data:U}=ga({queryKey:["org-prs"],queryFn:K_,staleTime:6e4}),W=(U==null?void 0:U.prs)??[],B=C.useMemo(()=>new Set(k.flatMap(z=>z.repos)),[k]),$=C.useMemo(()=>S.filter(z=>!B.has(z.path)),[S,B]),Y=C.useMemo(()=>new Map(S.map(z=>[z.path,z])),[S]),K=C.useCallback(z=>{fe.setState({activeRepoPath:z}),se.getState().setActiveSessionId(null)},[]),X=C.useCallback(()=>{fe.setState({activeRepoPath:null}),se.getState().setActiveSessionId(null),y()},[y]),P=C.useMemo(()=>[...k].sort((z,Q)=>z.order-Q.order),[k]),[j,H]=C.useState({}),O=C.useCallback(z=>{H(Q=>({...Q,[z]:!Q[z]}))},[]);return p.jsxs("aside",{className:["sidebar",f?"open":"",h?"collapsed":""].filter(Boolean).join(" "),style:{width:M,minWidth:M},children:[p.jsxs("div",{className:"sidebar-header",children:[p.jsx("button",{className:"sidebar-collapse-btn","aria-label":h?"Expand sidebar":"Collapse sidebar",onClick:b,children:h?"»":"«"}),!h&&p.jsx("button",{className:"sidebar-brand",onClick:X,children:"Relay"}),p.jsx("button",{className:"sidebar-icon-btn","aria-label":"Close sidebar",onClick:y,children:p.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"square",width:"14",height:"14",children:[p.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),p.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),!h&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"sidebar-workspace-list",children:[P.map(z=>{const Q=z.repos.map(A=>Y.get(A)).filter(A=>A!==void 0),re=D(z.id),ne=w.filter(A=>z.repos.includes(A.repoPath));return p.jsx(SM,{workspace:z,repos:Q,sessions:re,worktrees:ne,activeRepoPath:_,activeSessionId:T??null,onToggleCollapse:()=>O(z.id),collapsed:j[z.id]??!1,onLaunchSession:A=>c==null?void 0:c(A),onSelectSession:e,onSelectWorkspace:K,onNewWorktree:s,onOpenSettings:t,onDeleteSession:A=>a==null?void 0:a(A),onDeleteWorktree:A=>o==null?void 0:o(A),orgPrs:W},z.id)}),$.length>0&&p.jsxs(p.Fragment,{children:[k.length>0&&p.jsx("div",{className:"sidebar-ungrouped-label",children:"ungrouped"}),p.jsx(CM,{ungroupedRepos:$,activeRepoPath:_,activeSessionId:T??null,worktrees:w,orgPrs:W,onSelectWorkspace:K,onSelectSession:e,onNewWorktree:s,onOpenSettings:t,...a?{onDeleteSession:a}:{},...o?{onDeleteWorktree:o}:{}})]}),S.length===0&&p.jsx("div",{className:"sidebar-empty-state",children:p.jsx("span",{children:"no workspaces"})}),k.length===0&&$.length===0&&S.length>0&&p.jsx("div",{className:"sidebar-empty-workspace-hint",children:p.jsx("span",{children:"no workspaces yet"})})]}),p.jsxs("div",{className:"sidebar-footer-row",children:[p.jsx(Me,{variant:"primary",onClick:i,style:{flex:1},children:"+ add workspace"}),p.jsx("button",{className:"sidebar-settings-icon-btn","data-track":"sidebar.analytics",onClick:d,"aria-label":"Analytics",children:p.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"square",width:"14",height:"14",children:[p.jsx("rect",{x:"3",y:"12",width:"4",height:"9"}),p.jsx("rect",{x:"10",y:"7",width:"4",height:"14"}),p.jsx("rect",{x:"17",y:"3",width:"4",height:"18"})]})}),p.jsx("button",{className:"sidebar-settings-icon-btn","data-track":"sidebar.settings",onClick:()=>t(),"aria-label":"Settings",children:p.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"square",width:"14",height:"14",children:[p.jsx("circle",{cx:"12",cy:"12",r:"3"}),p.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1-1.51V15H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]})})]}),p.jsx("div",{className:"sidebar-resize-handle",onMouseDown:N,onDoubleClick:E})]}),p.jsx("div",{className:"sidebar-scanline-overlay","aria-hidden":"true"})]})}/**
|
|
63
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
64
|
+
* @license MIT
|
|
65
|
+
*
|
|
66
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
67
|
+
* @license MIT
|
|
68
|
+
*
|
|
69
|
+
* Originally forked from (with the author's permission):
|
|
70
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
71
|
+
* http://bellard.org/jslinux/
|
|
72
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
73
|
+
*/var ok=Object.defineProperty,EM=Object.getOwnPropertyDescriptor,TM=(e,t)=>{for(var s in t)ok(e,s,{get:t[s],enumerable:!0})},kt=(e,t,s,i)=>{for(var a=i>1?void 0:i?EM(t,s):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(a=(i?c(t,s,a):c(a))||a);return i&&a&&ok(t,s,a),a},be=(e,t)=>(s,i)=>t(s,i,e),Sw="Terminal input",Mg={get:()=>Sw,set:e=>Sw=e},ww="Too much output to announce, navigate to rows manually to read",Og={get:()=>ww,set:e=>ww=e};function NM(e){return e.replace(/\r?\n/g,"\r")}function AM(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function RM(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function DM(e,t,s,i){if(e.stopPropagation(),e.clipboardData){let a=e.clipboardData.getData("text/plain");lk(a,t,s,i)}}function lk(e,t,s,i){e=NM(e),e=AM(e,s.decPrivateModes.bracketedPasteMode&&i.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(e,!0),t.value=""}function ck(e,t,s){let i=s.getBoundingClientRect(),a=e.clientX-i.left-10,o=e.clientY-i.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${a}px`,t.style.top=`${o}px`,t.style.zIndex="1000",t.focus()}function Cw(e,t,s,i,a){ck(e,t,s),a&&i.rightClickSelect(e),t.value=i.selectionText,t.select()}function or(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Cd(e,t=0,s=e.length){let i="";for(let a=t;a<s;++a){let o=e[a];o>65535?(o-=65536,i+=String.fromCharCode((o>>10)+55296)+String.fromCharCode(o%1024+56320)):i+=String.fromCharCode(o)}return i}var LM=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let s=e.length;if(!s)return 0;let i=0,a=0;if(this._interim){let o=e.charCodeAt(a++);56320<=o&&o<=57343?t[i++]=(this._interim-55296)*1024+o-56320+65536:(t[i++]=this._interim,t[i++]=o),this._interim=0}for(let o=a;o<s;++o){let c=e.charCodeAt(o);if(55296<=c&&c<=56319){if(++o>=s)return this._interim=c,i;let d=e.charCodeAt(o);56320<=d&&d<=57343?t[i++]=(c-55296)*1024+d-56320+65536:(t[i++]=c,t[i++]=d);continue}c!==65279&&(t[i++]=c)}return i}},MM=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(t,s){let i=t.length;if(!i)return 0;let a=0,o,c,d,f,h=0,g=0;if(this.interim[0]){let b=!1,S=this.interim[0];S&=(S&224)===192?31:(S&240)===224?15:7;let w=0,k;for(;(k=this.interim[++w]&63)&&w<4;)S<<=6,S|=k;let T=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,D=T-w;for(;g<D;){if(g>=i)return 0;if(k=t[g++],(k&192)!==128){g--,b=!0;break}else this.interim[w++]=k,S<<=6,S|=k&63}b||(T===2?S<128?g--:s[a++]=S:T===3?S<2048||S>=55296&&S<=57343||S===65279||(s[a++]=S):S<65536||S>1114111||(s[a++]=S)),this.interim.fill(0)}let _=i-4,y=g;for(;y<i;){for(;y<_&&!((o=t[y])&128)&&!((c=t[y+1])&128)&&!((d=t[y+2])&128)&&!((f=t[y+3])&128);)s[a++]=o,s[a++]=c,s[a++]=d,s[a++]=f,y+=4;if(o=t[y++],o<128)s[a++]=o;else if((o&224)===192){if(y>=i)return this.interim[0]=o,a;if(c=t[y++],(c&192)!==128){y--;continue}if(h=(o&31)<<6|c&63,h<128){y--;continue}s[a++]=h}else if((o&240)===224){if(y>=i)return this.interim[0]=o,a;if(c=t[y++],(c&192)!==128){y--;continue}if(y>=i)return this.interim[0]=o,this.interim[1]=c,a;if(d=t[y++],(d&192)!==128){y--;continue}if(h=(o&15)<<12|(c&63)<<6|d&63,h<2048||h>=55296&&h<=57343||h===65279)continue;s[a++]=h}else if((o&248)===240){if(y>=i)return this.interim[0]=o,a;if(c=t[y++],(c&192)!==128){y--;continue}if(y>=i)return this.interim[0]=o,this.interim[1]=c,a;if(d=t[y++],(d&192)!==128){y--;continue}if(y>=i)return this.interim[0]=o,this.interim[1]=c,this.interim[2]=d,a;if(f=t[y++],(f&192)!==128){y--;continue}if(h=(o&7)<<18|(c&63)<<12|(d&63)<<6|f&63,h<65536||h>1114111)continue;s[a++]=h}}return a}},uk="",yr=" ",Pc=class hk{constructor(){this.fg=0,this.bg=0,this.extended=new Jh}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new hk;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Jh=class dk{constructor(t=0,s=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=s}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new dk(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},gi=class fk extends Pc{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Jh,this.combinedData=""}static fromCharData(t){let s=new fk;return s.setFromCharData(t),s}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?or(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let s=!1;if(t[1].length>2)s=!0;else if(t[1].length===2){let i=t[1].charCodeAt(0);if(55296<=i&&i<=56319){let a=t[1].charCodeAt(1);56320<=a&&a<=57343?this.content=(i-55296)*1024+a-56320+65536|t[2]<<22:s=!0}else s=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;s&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},xw="di$target",jg="di$dependencies",bm=new Map;function OM(e){return e[jg]||[]}function ss(e){if(bm.has(e))return bm.get(e);let t=function(s,i,a){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");jM(t,s,a)};return t._id=e,bm.set(e,t),t}function jM(e,t,s){t[xw]===t?t[jg].push({id:e,index:s}):(t[jg]=[{id:e,index:s}],t[xw]=t)}var bs=ss("BufferService"),pk=ss("CoreMouseService"),Ca=ss("CoreService"),PM=ss("CharsetService"),tv=ss("InstantiationService"),mk=ss("LogService"),Ss=ss("OptionsService"),gk=ss("OscLinkService"),BM=ss("UnicodeService"),Bc=ss("DecorationService"),Pg=class{constructor(e,t,s){this._bufferService=e,this._optionsService=t,this._oscLinkService=s}provideLinks(e,t){var g;let s=this._bufferService.buffer.lines.get(e-1);if(!s){t(void 0);return}let i=[],a=this._optionsService.rawOptions.linkHandler,o=new gi,c=s.getTrimmedLength(),d=-1,f=-1,h=!1;for(let _=0;_<c;_++)if(!(f===-1&&!s.hasContent(_))){if(s.loadCell(_,o),o.hasExtendedAttrs()&&o.extended.urlId)if(f===-1){f=_,d=o.extended.urlId;continue}else h=o.extended.urlId!==d;else f!==-1&&(h=!0);if(h||f!==-1&&_===c-1){let y=(g=this._oscLinkService.getLinkData(d))==null?void 0:g.uri;if(y){let b={start:{x:f+1,y:e},end:{x:_+(!h&&_===c-1?1:0),y:e}},S=!1;if(!(a!=null&&a.allowNonHttpProtocols))try{let w=new URL(y);["http:","https:"].includes(w.protocol)||(S=!0)}catch{S=!0}S||i.push({text:y,range:b,activate:(w,k)=>a?a.activate(w,k,b):IM(w,k),hover:(w,k)=>{var T;return(T=a==null?void 0:a.hover)==null?void 0:T.call(a,w,k,b)},leave:(w,k)=>{var T;return(T=a==null?void 0:a.leave)==null?void 0:T.call(a,w,k,b)}})}h=!1,o.hasExtendedAttrs()&&o.extended.urlId?(f=_,d=o.extended.urlId):(f=-1,d=-1)}}t(i)}};Pg=kt([be(0,bs),be(1,Ss),be(2,gk)],Pg);function IM(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
74
|
+
|
|
75
|
+
WARNING: This link could potentially be dangerous`)){let s=window.open();if(s){try{s.opener=null}catch{}s.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var xd=ss("CharSizeService"),Tn=ss("CoreBrowserService"),sv=ss("MouseService"),Nn=ss("RenderService"),zM=ss("SelectionService"),_k=ss("CharacterJoinerService"),$o=ss("ThemeService"),vk=ss("LinkProviderService"),HM=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?kw.isErrorNoTelemetry(e)?new kw(e.message+`
|
|
76
|
+
|
|
77
|
+
`+e.stack):new Error(e.message+`
|
|
78
|
+
|
|
79
|
+
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},UM=new HM;function Ph(e){FM(e)||UM.onUnexpectedError(e)}var Bg="Canceled";function FM(e){return e instanceof $M?!0:e instanceof Error&&e.name===Bg&&e.message===Bg}var $M=class extends Error{constructor(){super(Bg),this.name=this.message}};function VM(e){return new Error(`Illegal argument: ${e}`)}var kw=class Ig extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Ig)return t;let s=new Ig;return s.message=t.message,s.stack=t.stack,s}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},zg=class yk extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,yk.prototype)}};function Fs(e,t=0){return e[e.length-(1+t)]}var WM;(e=>{function t(o){return o<0}e.isLessThan=t;function s(o){return o<=0}e.isLessThanOrEqual=s;function i(o){return o>0}e.isGreaterThan=i;function a(o){return o===0}e.isNeitherLessOrGreaterThan=a,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(WM||(WM={}));function GM(e,t){let s=this,i=!1,a;return function(){return i||(i=!0,t||(a=e.apply(s,arguments))),a}}var bk;(e=>{function t(E){return E&&typeof E=="object"&&typeof E[Symbol.iterator]=="function"}e.is=t;let s=Object.freeze([]);function i(){return s}e.empty=i;function*a(E){yield E}e.single=a;function o(E){return t(E)?E:a(E)}e.wrap=o;function c(E){return E||s}e.from=c;function*d(E){for(let M=E.length-1;M>=0;M--)yield E[M]}e.reverse=d;function f(E){return!E||E[Symbol.iterator]().next().done===!0}e.isEmpty=f;function h(E){return E[Symbol.iterator]().next().value}e.first=h;function g(E,M){let U=0;for(let W of E)if(M(W,U++))return!0;return!1}e.some=g;function _(E,M){for(let U of E)if(M(U))return U}e.find=_;function*y(E,M){for(let U of E)M(U)&&(yield U)}e.filter=y;function*b(E,M){let U=0;for(let W of E)yield M(W,U++)}e.map=b;function*S(E,M){let U=0;for(let W of E)yield*M(W,U++)}e.flatMap=S;function*w(...E){for(let M of E)yield*M}e.concat=w;function k(E,M,U){let W=U;for(let B of E)W=M(W,B);return W}e.reduce=k;function*T(E,M,U=E.length){for(M<0&&(M+=E.length),U<0?U+=E.length:U>E.length&&(U=E.length);M<U;M++)yield E[M]}e.slice=T;function D(E,M=Number.POSITIVE_INFINITY){let U=[];if(M===0)return[U,E];let W=E[Symbol.iterator]();for(let B=0;B<M;B++){let $=W.next();if($.done)return[U,e.empty()];U.push($.value)}return[U,{[Symbol.iterator](){return W}}]}e.consume=D;async function N(E){let M=[];for await(let U of E)M.push(U);return Promise.resolve(M)}e.asyncToArray=N})(bk||(bk={}));function ya(e){if(bk.is(e)){let t=[];for(let s of e)if(s)try{s.dispose()}catch(i){t.push(i)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function qM(...e){return _t(()=>ya(e))}function _t(e){return{dispose:GM(()=>{e()})}}var Sk=class wk{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{ya(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?wk.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};Sk.DISABLE_DISPOSED_WARNING=!1;var wr=Sk,Ue=class{constructor(){this._store=new wr,this._store}dispose(){this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}};Ue.None=Object.freeze({dispose(){}});var Io=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},xn=typeof window=="object"?window:globalThis,Hg=class Ug{constructor(t){this.element=t,this.next=Ug.Undefined,this.prev=Ug.Undefined}};Hg.Undefined=new Hg(void 0);var vt=Hg,Ew=class{constructor(){this._first=vt.Undefined,this._last=vt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===vt.Undefined}clear(){let e=this._first;for(;e!==vt.Undefined;){let t=e.next;e.prev=vt.Undefined,e.next=vt.Undefined,e=t}this._first=vt.Undefined,this._last=vt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let s=new vt(e);if(this._first===vt.Undefined)this._first=s,this._last=s;else if(t){let a=this._last;this._last=s,s.prev=a,a.next=s}else{let a=this._first;this._first=s,s.next=a,a.prev=s}this._size+=1;let i=!1;return()=>{i||(i=!0,this._remove(s))}}shift(){if(this._first!==vt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==vt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==vt.Undefined&&e.next!==vt.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===vt.Undefined&&e.next===vt.Undefined?(this._first=vt.Undefined,this._last=vt.Undefined):e.next===vt.Undefined?(this._last=this._last.prev,this._last.next=vt.Undefined):e.prev===vt.Undefined&&(this._first=this._first.next,this._first.prev=vt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==vt.Undefined;)yield e.element,e=e.next}},KM=globalThis.performance&&typeof globalThis.performance.now=="function",YM=class Ck{static create(t){return new Ck(t)}constructor(t){this._now=KM&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},us;(e=>{e.None=()=>Ue.None;function t(X,P){return _(X,()=>{},0,void 0,!0,void 0,P)}e.defer=t;function s(X){return(P,j=null,H)=>{let O=!1,z;return z=X(Q=>{if(!O)return z?z.dispose():O=!0,P.call(j,Q)},null,H),O&&z.dispose(),z}}e.once=s;function i(X,P,j){return h((H,O=null,z)=>X(Q=>H.call(O,P(Q)),null,z),j)}e.map=i;function a(X,P,j){return h((H,O=null,z)=>X(Q=>{P(Q),H.call(O,Q)},null,z),j)}e.forEach=a;function o(X,P,j){return h((H,O=null,z)=>X(Q=>P(Q)&&H.call(O,Q),null,z),j)}e.filter=o;function c(X){return X}e.signal=c;function d(...X){return(P,j=null,H)=>{let O=qM(...X.map(z=>z(Q=>P.call(j,Q))));return g(O,H)}}e.any=d;function f(X,P,j,H){let O=j;return i(X,z=>(O=P(O,z),O),H)}e.reduce=f;function h(X,P){let j,H={onWillAddFirstListener(){j=X(O.fire,O)},onDidRemoveLastListener(){j==null||j.dispose()}},O=new me(H);return P==null||P.add(O),O.event}function g(X,P){return P instanceof Array?P.push(X):P&&P.add(X),X}function _(X,P,j=100,H=!1,O=!1,z,Q){let re,ne,A,I=0,q,oe={leakWarningThreshold:z,onWillAddFirstListener(){re=X(Se=>{I++,ne=P(ne,Se),H&&!A&&(ve.fire(ne),ne=void 0),q=()=>{let Ne=ne;ne=void 0,A=void 0,(!H||I>1)&&ve.fire(Ne),I=0},typeof j=="number"?(clearTimeout(A),A=setTimeout(q,j)):A===void 0&&(A=0,queueMicrotask(q))})},onWillRemoveListener(){O&&I>0&&(q==null||q())},onDidRemoveLastListener(){q=void 0,re.dispose()}},ve=new me(oe);return Q==null||Q.add(ve),ve.event}e.debounce=_;function y(X,P=0,j){return e.debounce(X,(H,O)=>H?(H.push(O),H):[O],P,void 0,!0,void 0,j)}e.accumulate=y;function b(X,P=(H,O)=>H===O,j){let H=!0,O;return o(X,z=>{let Q=H||!P(z,O);return H=!1,O=z,Q},j)}e.latch=b;function S(X,P,j){return[e.filter(X,P,j),e.filter(X,H=>!P(H),j)]}e.split=S;function w(X,P=!1,j=[],H){let O=j.slice(),z=X(ne=>{O?O.push(ne):re.fire(ne)});H&&H.add(z);let Q=()=>{O==null||O.forEach(ne=>re.fire(ne)),O=null},re=new me({onWillAddFirstListener(){z||(z=X(ne=>re.fire(ne)),H&&H.add(z))},onDidAddFirstListener(){O&&(P?setTimeout(Q):Q())},onDidRemoveLastListener(){z&&z.dispose(),z=null}});return H&&H.add(re),re.event}e.buffer=w;function k(X,P){return(j,H,O)=>{let z=P(new D);return X(function(Q){let re=z.evaluate(Q);re!==T&&j.call(H,re)},void 0,O)}}e.chain=k;let T=Symbol("HaltChainable");class D{constructor(){this.steps=[]}map(P){return this.steps.push(P),this}forEach(P){return this.steps.push(j=>(P(j),j)),this}filter(P){return this.steps.push(j=>P(j)?j:T),this}reduce(P,j){let H=j;return this.steps.push(O=>(H=P(H,O),H)),this}latch(P=(j,H)=>j===H){let j=!0,H;return this.steps.push(O=>{let z=j||!P(O,H);return j=!1,H=O,z?O:T}),this}evaluate(P){for(let j of this.steps)if(P=j(P),P===T)break;return P}}function N(X,P,j=H=>H){let H=(...re)=>Q.fire(j(...re)),O=()=>X.on(P,H),z=()=>X.removeListener(P,H),Q=new me({onWillAddFirstListener:O,onDidRemoveLastListener:z});return Q.event}e.fromNodeEventEmitter=N;function E(X,P,j=H=>H){let H=(...re)=>Q.fire(j(...re)),O=()=>X.addEventListener(P,H),z=()=>X.removeEventListener(P,H),Q=new me({onWillAddFirstListener:O,onDidRemoveLastListener:z});return Q.event}e.fromDOMEventEmitter=E;function M(X){return new Promise(P=>s(X)(P))}e.toPromise=M;function U(X){let P=new me;return X.then(j=>{P.fire(j)},()=>{P.fire(void 0)}).finally(()=>{P.dispose()}),P.event}e.fromPromise=U;function W(X,P){return X(j=>P.fire(j))}e.forward=W;function B(X,P,j){return P(j),X(H=>P(H))}e.runAndSubscribe=B;class ${constructor(P,j){this._observable=P,this._counter=0,this._hasChanged=!1;let H={onWillAddFirstListener:()=>{P.addObserver(this)},onDidRemoveLastListener:()=>{P.removeObserver(this)}};this.emitter=new me(H),j&&j.add(this.emitter)}beginUpdate(P){this._counter++}handlePossibleChange(P){}handleChange(P,j){this._hasChanged=!0}endUpdate(P){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Y(X,P){return new $(X,P).emitter.event}e.fromObservable=Y;function K(X){return(P,j,H)=>{let O=0,z=!1,Q={beginUpdate(){O++},endUpdate(){O--,O===0&&(X.reportChanges(),z&&(z=!1,P.call(j)))},handlePossibleChange(){},handleChange(){z=!0}};X.addObserver(Q),X.reportChanges();let re={dispose(){X.removeObserver(Q)}};return H instanceof wr?H.add(re):Array.isArray(H)&&H.push(re),re}}e.fromObservableLight=K})(us||(us={}));var Fg=class $g{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${$g._idPool++}`,$g.all.add(this)}start(t){this._stopWatch=new YM,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};Fg.all=new Set,Fg._idPool=0;var XM=Fg,QM=-1,xk=class kk{constructor(t,s,i=(kk._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=s,this.name=i,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,s){let i=this.threshold;if(i<=0||s<i)return;this._stacks||(this._stacks=new Map);let a=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,a+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[o,c]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${s} listeners already. MOST frequent listener (${c}):`;console.warn(d),console.warn(o);let f=new eO(d,o);this._errorHandler(f)}return()=>{let o=this._stacks.get(t.value)||0;this._stacks.set(t.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,s=0;for(let[i,a]of this._stacks)(!t||s<a)&&(t=[i,a],s=a);return t}};xk._idPool=1;var ZM=xk,JM=class Ek{constructor(t){this.value=t}static create(){let t=new Error;return new Ek(t.stack??"")}print(){console.warn(this.value.split(`
|
|
80
|
+
`).slice(2).join(`
|
|
81
|
+
`))}},eO=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},tO=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},sO=0,Sm=class{constructor(e){this.value=e,this.id=sO++}},iO=2,nO,me=class{constructor(t){var s,i,a,o;this._size=0,this._options=t,this._leakageMon=(s=this._options)!=null&&s.leakWarningThreshold?new ZM((t==null?void 0:t.onListenerError)??Ph,((i=this._options)==null?void 0:i.leakWarningThreshold)??QM):void 0,this._perfMon=(a=this._options)!=null&&a._profName?new XM(this._options._profName):void 0,this._deliveryQueue=(o=this._options)==null?void 0:o.deliveryQueue}dispose(){var t,s,i,a;this._disposed||(this._disposed=!0,((t=this._deliveryQueue)==null?void 0:t.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(i=(s=this._options)==null?void 0:s.onDidRemoveLastListener)==null||i.call(s),(a=this._leakageMon)==null||a.dispose())}get event(){return this._event??(this._event=(t,s,i)=>{var d,f,h,g,_;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let y=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(y);let b=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],S=new tO(`${y}. HINT: Stack shows most frequent listener (${b[1]}-times)`,b[0]);return(((d=this._options)==null?void 0:d.onListenerError)||Ph)(S),Ue.None}if(this._disposed)return Ue.None;s&&(t=t.bind(s));let a=new Sm(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(a.stack=JM.create(),o=this._leakageMon.check(a.stack,this._size+1)),this._listeners?this._listeners instanceof Sm?(this._deliveryQueue??(this._deliveryQueue=new rO),this._listeners=[this._listeners,a]):this._listeners.push(a):((h=(f=this._options)==null?void 0:f.onWillAddFirstListener)==null||h.call(f,this),this._listeners=a,(_=(g=this._options)==null?void 0:g.onDidAddFirstListener)==null||_.call(g,this)),this._size++;let c=_t(()=>{o==null||o(),this._removeListener(a)});return i instanceof wr?i.add(c):Array.isArray(i)&&i.push(c),c}),this._event}_removeListener(t){var o,c,d,f;if((c=(o=this._options)==null?void 0:o.onWillRemoveListener)==null||c.call(o,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(f=(d=this._options)==null?void 0:d.onDidRemoveLastListener)==null||f.call(d,this),this._size=0;return}let s=this._listeners,i=s.indexOf(t);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,s[i]=void 0;let a=this._deliveryQueue.current===this;if(this._size*iO<=s.length){let h=0;for(let g=0;g<s.length;g++)s[g]?s[h++]=s[g]:a&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);s.length=h}}_deliver(t,s){var a;if(!t)return;let i=((a=this._options)==null?void 0:a.onListenerError)||Ph;if(!i){t.value(s);return}try{t.value(s)}catch(o){i(o)}}_deliverQueue(t){let s=t.current._listeners;for(;t.i<t.end;)this._deliver(s[t.i++],t.value);t.reset()}fire(t){var s,i,a,o;if((s=this._deliveryQueue)!=null&&s.current&&(this._deliverQueue(this._deliveryQueue),(i=this._perfMon)==null||i.stop()),(a=this._perfMon)==null||a.start(this._size),this._listeners)if(this._listeners instanceof Sm)this._deliver(this._listeners,t);else{let c=this._deliveryQueue;c.enqueue(this,t,this._listeners.length),this._deliverQueue(c)}(o=this._perfMon)==null||o.stop()}hasListeners(){return this._size>0}},rO=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,s){this.i=0,this.end=s,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Vg=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new me,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new me,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,s){if(this.getZoomLevel(s)===t)return;let i=this.getWindowId(s);this.mapWindowIdToZoomLevel.set(i,t),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,s){this.mapWindowIdToZoomFactor.set(this.getWindowId(s),t)}setFullscreen(t,s){if(this.isFullscreen(s)===t)return;let i=this.getWindowId(s);this.mapWindowIdToFullScreen.set(i,t),this._onDidChangeFullscreen.fire(i)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Vg.INSTANCE=new Vg;var iv=Vg;function aO(e,t,s){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",s)}iv.INSTANCE.onDidChangeZoomLevel;function oO(e){return iv.INSTANCE.getZoomFactor(e)}iv.INSTANCE.onDidChangeFullscreen;var Vo=typeof navigator=="object"?navigator.userAgent:"",Wg=Vo.indexOf("Firefox")>=0,lO=Vo.indexOf("AppleWebKit")>=0,nv=Vo.indexOf("Chrome")>=0,cO=!nv&&Vo.indexOf("Safari")>=0;Vo.indexOf("Electron/")>=0;Vo.indexOf("Android")>=0;var wm=!1;if(typeof xn.matchMedia=="function"){let e=xn.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=xn.matchMedia("(display-mode: fullscreen)");wm=e.matches,aO(xn,e,({matches:s})=>{wm&&t.matches||(wm=s)})}var wo="en",Gg=!1,qg=!1,Bh=!1,Tk=!1,mh,Ih=wo,Tw=wo,uO,Si,va=globalThis,ls,qC;typeof va.vscode<"u"&&typeof va.vscode.process<"u"?ls=va.vscode.process:typeof process<"u"&&typeof((qC=process==null?void 0:process.versions)==null?void 0:qC.node)=="string"&&(ls=process);var KC,hO=typeof((KC=ls==null?void 0:ls.versions)==null?void 0:KC.electron)=="string",dO=hO&&(ls==null?void 0:ls.type)==="renderer",YC;if(typeof ls=="object"){Gg=ls.platform==="win32",qg=ls.platform==="darwin",Bh=ls.platform==="linux",Bh&&ls.env.SNAP&&ls.env.SNAP_REVISION,ls.env.CI||ls.env.BUILD_ARTIFACTSTAGINGDIRECTORY,mh=wo,Ih=wo;let e=ls.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);mh=t.userLocale,Tw=t.osLocale,Ih=t.resolvedLanguage||wo,uO=(YC=t.languagePack)==null?void 0:YC.translationsConfigFile}catch{}Tk=!0}else typeof navigator=="object"&&!dO?(Si=navigator.userAgent,Gg=Si.indexOf("Windows")>=0,qg=Si.indexOf("Macintosh")>=0,(Si.indexOf("Macintosh")>=0||Si.indexOf("iPad")>=0||Si.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Bh=Si.indexOf("Linux")>=0,(Si==null?void 0:Si.indexOf("Mobi"))>=0,Ih=globalThis._VSCODE_NLS_LANGUAGE||wo,mh=navigator.language.toLowerCase(),Tw=mh):console.error("Unable to resolve platform.");var Nk=Gg,Wi=qg,fO=Bh,Nw=Tk,Gi=Si,tr=Ih,pO;(e=>{function t(){return tr}e.value=t;function s(){return tr.length===2?tr==="en":tr.length>=3?tr[0]==="e"&&tr[1]==="n"&&tr[2]==="-":!1}e.isDefaultVariant=s;function i(){return tr==="en"}e.isDefault=i})(pO||(pO={}));var mO=typeof va.postMessage=="function"&&!va.importScripts;(()=>{if(mO){let e=[];va.addEventListener("message",s=>{if(s.data&&s.data.vscodeScheduleAsyncWork)for(let i=0,a=e.length;i<a;i++){let o=e[i];if(o.id===s.data.vscodeScheduleAsyncWork){e.splice(i,1),o.callback();return}}});let t=0;return s=>{let i=++t;e.push({id:i,callback:s}),va.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})();var gO=!!(Gi&&Gi.indexOf("Chrome")>=0);Gi&&Gi.indexOf("Firefox")>=0;!gO&&Gi&&Gi.indexOf("Safari")>=0;Gi&&Gi.indexOf("Edg/")>=0;Gi&&Gi.indexOf("Android")>=0;var mo=typeof navigator=="object"?navigator:{};Nw||document.queryCommandSupported&&document.queryCommandSupported("copy")||mo&&mo.clipboard&&mo.clipboard.writeText,Nw||mo&&mo.clipboard&&mo.clipboard.readText;var rv=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Cm=new rv,Aw=new rv,Rw=new rv,_O=new Array(230),Ak;(e=>{function t(d){return Cm.keyCodeToStr(d)}e.toString=t;function s(d){return Cm.strToKeyCode(d)}e.fromString=s;function i(d){return Aw.keyCodeToStr(d)}e.toUserSettingsUS=i;function a(d){return Rw.keyCodeToStr(d)}e.toUserSettingsGeneral=a;function o(d){return Aw.strToKeyCode(d)||Rw.strToKeyCode(d)}e.fromUserSettings=o;function c(d){if(d>=98&&d<=113)return null;switch(d){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Cm.keyCodeToStr(d)}e.toElectronAccelerator=c})(Ak||(Ak={}));var vO=class Rk{constructor(t,s,i,a,o){this.ctrlKey=t,this.shiftKey=s,this.altKey=i,this.metaKey=a,this.keyCode=o}equals(t){return t instanceof Rk&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",s=this.shiftKey?"1":"0",i=this.altKey?"1":"0",a=this.metaKey?"1":"0";return`K${t}${s}${i}${a}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new yO([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},yO=class{constructor(e){if(e.length===0)throw VM("chords");this.chords=e}getHashCode(){let e="";for(let t=0,s=this.chords.length;t<s;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function bO(e){if(e.charCode){let s=String.fromCharCode(e.charCode).toUpperCase();return Ak.fromString(s)}let t=e.keyCode;if(t===3)return 7;if(Wg)switch(t){case 59:return 85;case 60:if(fO)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Wi)return 57;break}else if(lO&&(Wi&&t===93||!Wi&&t===92))return 57;return _O[t]||0}var SO=Wi?256:2048,wO=512,CO=1024,xO=Wi?2048:256,Dw=class{constructor(e){var s;this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=(s=t.getModifierState)==null?void 0:s.call(t,"AltGraph"),this.keyCode=bO(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=SO),this.altKey&&(t|=wO),this.shiftKey&&(t|=CO),this.metaKey&&(t|=xO),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new vO(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},Lw=new WeakMap;function kO(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,s=e.parent.location;if(t.origin!=="null"&&s.origin!=="null"&&t.origin!==s.origin)return null}catch{return null}return e.parent}var EO=class{static getSameOriginWindowChain(e){let t=Lw.get(e);if(!t){t=[],Lw.set(e,t);let s=e,i;do i=kO(s),i?t.push({window:new WeakRef(s),iframeElement:s.frameElement||null}):t.push({window:new WeakRef(s),iframeElement:null}),s=i;while(s)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let s=0,i=0,a=this.getSameOriginWindowChain(e);for(let o of a){let c=o.window.deref();if(s+=(c==null?void 0:c.scrollY)??0,i+=(c==null?void 0:c.scrollX)??0,c===t||!o.iframeElement)break;let d=o.iframeElement.getBoundingClientRect();s+=d.top,i+=d.left}return{top:s,left:i}}},gh=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let s=EO.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=s.left,this.posy-=s.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Mw=class{constructor(e,t=0,s=0){var a;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=s,this.deltaX=t;let i=!1;if(nv){let o=navigator.userAgent.match(/Chrome\/(\d+)/);i=(o?parseInt(o[1]):123)<=122}if(e){let o=e,c=e,d=((a=e.view)==null?void 0:a.devicePixelRatio)||1;if(typeof o.wheelDeltaY<"u")i?this.deltaY=o.wheelDeltaY/(120*d):this.deltaY=o.wheelDeltaY/120;else if(typeof c.VERTICAL_AXIS<"u"&&c.axis===c.VERTICAL_AXIS)this.deltaY=-c.detail/3;else if(e.type==="wheel"){let f=e;f.deltaMode===f.DOM_DELTA_LINE?Wg&&!Wi?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")cO&&Nk?this.deltaX=-(o.wheelDeltaX/120):i?this.deltaX=o.wheelDeltaX/(120*d):this.deltaX=o.wheelDeltaX/120;else if(typeof c.HORIZONTAL_AXIS<"u"&&c.axis===c.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let f=e;f.deltaMode===f.DOM_DELTA_LINE?Wg&&!Wi?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(i?this.deltaY=e.wheelDelta/(120*d):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},Dk=Object.freeze(function(e,t){let s=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(s)}}}),TO;(e=>{function t(s){return s===e.None||s===e.Cancelled||s instanceof NO?!0:!s||typeof s!="object"?!1:typeof s.isCancellationRequested=="boolean"&&typeof s.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:us.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Dk})})(TO||(TO={}));var NO=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?Dk:(this._emitter||(this._emitter=new me),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},av=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new zg("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new zg("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},AO=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,s=globalThis){if(this.isDisposed)throw new zg("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let i=s.setInterval(()=>{e()},t);this.disposable=_t(()=>{s.clearInterval(i),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},RO;(e=>{async function t(i){let a,o=await Promise.all(i.map(c=>c.then(d=>d,d=>{a||(a=d)})));if(typeof a<"u")throw a;return o}e.settled=t;function s(i){return new Promise(async(a,o)=>{try{await i(a,o)}catch(c){o(c)}})}e.withAsyncBody=s})(RO||(RO={}));var Ow=class oi{static fromArray(t){return new oi(s=>{s.emitMany(t)})}static fromPromise(t){return new oi(async s=>{s.emitMany(await t)})}static fromPromises(t){return new oi(async s=>{await Promise.all(t.map(async i=>s.emitOne(await i)))})}static merge(t){return new oi(async s=>{await Promise.all(t.map(async i=>{for await(let a of i)s.emitOne(a)}))})}constructor(t,s){this._state=0,this._results=[],this._error=null,this._onReturn=s,this._onStateChanged=new me,queueMicrotask(async()=>{let i={emitOne:a=>this.emitOne(a),emitMany:a=>this.emitMany(a),reject:a=>this.reject(a)};try{await Promise.resolve(t(i)),this.resolve()}catch(a){this.reject(a)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await us.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var s;return(s=this._onReturn)==null||s.call(this),{done:!0,value:void 0}}}}static map(t,s){return new oi(async i=>{for await(let a of t)i.emitOne(s(a))})}map(t){return oi.map(this,t)}static filter(t,s){return new oi(async i=>{for await(let a of t)s(a)&&i.emitOne(a)})}filter(t){return oi.filter(this,t)}static coalesce(t){return oi.filter(t,s=>!!s)}coalesce(){return oi.coalesce(this)}static async toPromise(t){let s=[];for await(let i of t)s.push(i);return s}toPromise(){return oi.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};Ow.EMPTY=Ow.fromArray([]);var{getWindow:Vi,getWindowId:DO,onDidRegisterWindow:LO}=(function(){let e=new Map,t={window:xn,disposables:new wr};e.set(xn.vscodeWindowId,t);let s=new me,i=new me,a=new me;function o(c,d){return(typeof c=="number"?e.get(c):void 0)??(d?t:void 0)}return{onDidRegisterWindow:s.event,onWillUnregisterWindow:a.event,onDidUnregisterWindow:i.event,registerWindow(c){if(e.has(c.vscodeWindowId))return Ue.None;let d=new wr,f={window:c,disposables:d.add(new wr)};return e.set(c.vscodeWindowId,f),d.add(_t(()=>{e.delete(c.vscodeWindowId),i.fire(c)})),d.add(Le(c,Qt.BEFORE_UNLOAD,()=>{a.fire(c)})),s.fire(f),d},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(c){return c.vscodeWindowId},hasWindow(c){return e.has(c)},getWindowById:o,getWindow(c){var h;let d=c;if((h=d==null?void 0:d.ownerDocument)!=null&&h.defaultView)return d.ownerDocument.defaultView.window;let f=c;return f!=null&&f.view?f.view.window:xn},getDocument(c){return Vi(c).document}}})(),MO=class{constructor(e,t,s,i){this._node=e,this._type=t,this._handler=s,this._options=i||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Le(e,t,s,i){return new MO(e,t,s,i)}var jw=function(e,t,s,i){return Le(e,t,s,i)},ov,OO=class extends AO{constructor(e){super(),this.defaultTarget=e&&Vi(e)}cancelAndSet(e,t,s){return super.cancelAndSet(e,t,s??this.defaultTarget)}},Pw=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Ph(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,s=new Map,i=new Map,a=o=>{s.set(o,!1);let c=e.get(o)??[];for(t.set(o,c),e.set(o,[]),i.set(o,!0);c.length>0;)c.sort(Pw.sort),c.shift().execute();i.set(o,!1)};ov=(o,c,d=0)=>{let f=DO(o),h=new Pw(c,d),g=e.get(f);return g||(g=[],e.set(f,g)),g.push(h),s.get(f)||(s.set(f,!0),o.requestAnimationFrame(()=>a(f))),h}})();function jO(e){let t=e.getBoundingClientRect(),s=Vi(e);return{left:t.left+s.scrollX,top:t.top+s.scrollY,width:t.width,height:t.height}}var Qt={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},PO=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=Ds(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Ds(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Ds(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Ds(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Ds(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Ds(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Ds(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Ds(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Ds(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Ds(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Ds(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=Ds(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=Ds(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Ds(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function Ds(e){return typeof e=="number"?`${e}px`:e}function hc(e){return new PO(e)}var Lk=class{constructor(){this._hooks=new wr,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let s=this._onStopCallback;this._onStopCallback=null,e&&s&&s(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,s,i,a){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=i,this._onStopCallback=a;let o=e;try{e.setPointerCapture(t),this._hooks.add(_t(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{o=Vi(e)}this._hooks.add(Le(o,Qt.POINTER_MOVE,c=>{if(c.buttons!==s){this.stopMonitoring(!0);return}c.preventDefault(),this._pointerMoveCallback(c)})),this._hooks.add(Le(o,Qt.POINTER_UP,c=>this.stopMonitoring(!0)))}};function BO(e,t,s){let i=null,a=null;if(typeof s.value=="function"?(i="value",a=s.value,a.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof s.get=="function"&&(i="get",a=s.get),!a)throw new Error("not supported");let o=`$memoize$${t}`;s[i]=function(...c){return this.hasOwnProperty(o)||Object.defineProperty(this,o,{configurable:!1,enumerable:!1,writable:!1,value:a.apply(this,c)}),this[o]}}var Bi;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Bi||(Bi={}));var sc=class ds extends Ue{constructor(){super(),this.dispatched=!1,this.targets=new Ew,this.ignoreTargets=new Ew,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(us.runAndSubscribe(LO,({window:t,disposables:s})=>{s.add(Le(t.document,"touchstart",i=>this.onTouchStart(i),{passive:!1})),s.add(Le(t.document,"touchend",i=>this.onTouchEnd(t,i))),s.add(Le(t.document,"touchmove",i=>this.onTouchMove(i),{passive:!1}))},{window:xn,disposables:this._store}))}static addTarget(t){if(!ds.isTouchDevice())return Ue.None;ds.INSTANCE||(ds.INSTANCE=new ds);let s=ds.INSTANCE.targets.push(t);return _t(s)}static ignoreTarget(t){if(!ds.isTouchDevice())return Ue.None;ds.INSTANCE||(ds.INSTANCE=new ds);let s=ds.INSTANCE.ignoreTargets.push(t);return _t(s)}static isTouchDevice(){return"ontouchstart"in xn||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let s=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let i=0,a=t.targetTouches.length;i<a;i++){let o=t.targetTouches.item(i);this.activeTouches[o.identifier]={id:o.identifier,initialTarget:o.target,initialTimeStamp:s,initialPageX:o.pageX,initialPageY:o.pageY,rollingTimestamps:[s],rollingPageX:[o.pageX],rollingPageY:[o.pageY]};let c=this.newGestureEvent(Bi.Start,o.target);c.pageX=o.pageX,c.pageY=o.pageY,this.dispatchEvent(c)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,s){let i=Date.now(),a=Object.keys(this.activeTouches).length;for(let o=0,c=s.changedTouches.length;o<c;o++){let d=s.changedTouches.item(o);if(!this.activeTouches.hasOwnProperty(String(d.identifier))){console.warn("move of an UNKNOWN touch",d);continue}let f=this.activeTouches[d.identifier],h=Date.now()-f.initialTimeStamp;if(h<ds.HOLD_DELAY&&Math.abs(f.initialPageX-Fs(f.rollingPageX))<30&&Math.abs(f.initialPageY-Fs(f.rollingPageY))<30){let g=this.newGestureEvent(Bi.Tap,f.initialTarget);g.pageX=Fs(f.rollingPageX),g.pageY=Fs(f.rollingPageY),this.dispatchEvent(g)}else if(h>=ds.HOLD_DELAY&&Math.abs(f.initialPageX-Fs(f.rollingPageX))<30&&Math.abs(f.initialPageY-Fs(f.rollingPageY))<30){let g=this.newGestureEvent(Bi.Contextmenu,f.initialTarget);g.pageX=Fs(f.rollingPageX),g.pageY=Fs(f.rollingPageY),this.dispatchEvent(g)}else if(a===1){let g=Fs(f.rollingPageX),_=Fs(f.rollingPageY),y=Fs(f.rollingTimestamps)-f.rollingTimestamps[0],b=g-f.rollingPageX[0],S=_-f.rollingPageY[0],w=[...this.targets].filter(k=>f.initialTarget instanceof Node&&k.contains(f.initialTarget));this.inertia(t,w,i,Math.abs(b)/y,b>0?1:-1,g,Math.abs(S)/y,S>0?1:-1,_)}this.dispatchEvent(this.newGestureEvent(Bi.End,f.initialTarget)),delete this.activeTouches[d.identifier]}this.dispatched&&(s.preventDefault(),s.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,s){let i=document.createEvent("CustomEvent");return i.initEvent(t,!1,!0),i.initialTarget=s,i.tapCount=0,i}dispatchEvent(t){if(t.type===Bi.Tap){let s=new Date().getTime(),i=0;s-this._lastSetTapCountTime>ds.CLEAR_TAP_COUNT_TIME?i=1:i=2,this._lastSetTapCountTime=s,t.tapCount=i}else(t.type===Bi.Change||t.type===Bi.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let i of this.ignoreTargets)if(i.contains(t.initialTarget))return;let s=[];for(let i of this.targets)if(i.contains(t.initialTarget)){let a=0,o=t.initialTarget;for(;o&&o!==i;)a++,o=o.parentElement;s.push([a,i])}s.sort((i,a)=>i[0]-a[0]);for(let[i,a]of s)a.dispatchEvent(t),this.dispatched=!0}}inertia(t,s,i,a,o,c,d,f,h){this.handle=ov(t,()=>{let g=Date.now(),_=g-i,y=0,b=0,S=!0;a+=ds.SCROLL_FRICTION*_,d+=ds.SCROLL_FRICTION*_,a>0&&(S=!1,y=o*a*_),d>0&&(S=!1,b=f*d*_);let w=this.newGestureEvent(Bi.Change);w.translationX=y,w.translationY=b,s.forEach(k=>k.dispatchEvent(w)),S||this.inertia(t,s,g,a,o,c+y,d,f,h+b)})}onTouchMove(t){let s=Date.now();for(let i=0,a=t.changedTouches.length;i<a;i++){let o=t.changedTouches.item(i);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn("end of an UNKNOWN touch",o);continue}let c=this.activeTouches[o.identifier],d=this.newGestureEvent(Bi.Change,c.initialTarget);d.translationX=o.pageX-Fs(c.rollingPageX),d.translationY=o.pageY-Fs(c.rollingPageY),d.pageX=o.pageX,d.pageY=o.pageY,this.dispatchEvent(d),c.rollingPageX.length>3&&(c.rollingPageX.shift(),c.rollingPageY.shift(),c.rollingTimestamps.shift()),c.rollingPageX.push(o.pageX),c.rollingPageY.push(o.pageY),c.rollingTimestamps.push(s)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};sc.SCROLL_FRICTION=-.005,sc.HOLD_DELAY=700,sc.CLEAR_TAP_COUNT_TIME=400,kt([BO],sc,"isTouchDevice",1);var IO=sc,lv=class extends Ue{onclick(e,t){this._register(Le(e,Qt.CLICK,s=>t(new gh(Vi(e),s))))}onmousedown(e,t){this._register(Le(e,Qt.MOUSE_DOWN,s=>t(new gh(Vi(e),s))))}onmouseover(e,t){this._register(Le(e,Qt.MOUSE_OVER,s=>t(new gh(Vi(e),s))))}onmouseleave(e,t){this._register(Le(e,Qt.MOUSE_LEAVE,s=>t(new gh(Vi(e),s))))}onkeydown(e,t){this._register(Le(e,Qt.KEY_DOWN,s=>t(new Dw(s))))}onkeyup(e,t){this._register(Le(e,Qt.KEY_UP,s=>t(new Dw(s))))}oninput(e,t){this._register(Le(e,Qt.INPUT,t))}onblur(e,t){this._register(Le(e,Qt.BLUR,t))}onfocus(e,t){this._register(Le(e,Qt.FOCUS,t))}onchange(e,t){this._register(Le(e,Qt.CHANGE,t))}ignoreGesture(e){return IO.ignoreTarget(e)}},Bw=11,zO=class extends lv{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=Bw+"px",this.domNode.style.height=Bw+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new Lk),this._register(jw(this.bgDomNode,Qt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(jw(this.domNode,Qt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new OO),this._pointerdownScheduleRepeatTimer=this._register(new av)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Vi(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,s=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},HO=class Kg{constructor(t,s,i,a,o,c,d){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(s=s|0,i=i|0,a=a|0,o=o|0,c=c|0,d=d|0),this.rawScrollLeft=a,this.rawScrollTop=d,s<0&&(s=0),a+s>i&&(a=i-s),a<0&&(a=0),o<0&&(o=0),d+o>c&&(d=c-o),d<0&&(d=0),this.width=s,this.scrollWidth=i,this.scrollLeft=a,this.height=o,this.scrollHeight=c,this.scrollTop=d}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,s){return new Kg(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,s?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,s?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new Kg(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,s){let i=this.width!==t.width,a=this.scrollWidth!==t.scrollWidth,o=this.scrollLeft!==t.scrollLeft,c=this.height!==t.height,d=this.scrollHeight!==t.scrollHeight,f=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:s,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:i,scrollWidthChanged:a,scrollLeftChanged:o,heightChanged:c,scrollHeightChanged:d,scrollTopChanged:f}}},UO=class extends Ue{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new me),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new HO(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var i;let s=this._state.withScrollDimensions(e,t);this._setState(s,!!this._smoothScrolling),(i=this._smoothScrolling)==null||i.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let s=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===s.scrollLeft&&this._smoothScrolling.to.scrollTop===s.scrollTop)return;let i;t?i=new zw(this._smoothScrolling.from,s,this._smoothScrolling.startTime,this._smoothScrolling.duration):i=this._smoothScrolling.combine(this._state,s,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=i}else{let s=this._state.withScrollPosition(e);this._smoothScrolling=zw.start(this._state,s,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let s=this._state;s.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(s,t)))}},Iw=class{constructor(e,t,s){this.scrollLeft=e,this.scrollTop=t,this.isDone=s}};function xm(e,t){let s=t-e;return function(i){return e+s*VO(i)}}function FO(e,t,s){return function(i){return i<s?e(i/s):t((i-s)/(1-s))}}var zw=class Yg{constructor(t,s,i,a){this.from=t,this.to=s,this.duration=a,this.startTime=i,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,s,i){if(Math.abs(t-s)>2.5*i){let a,o;return t<s?(a=t+.75*i,o=s-.75*i):(a=t-.75*i,o=s+.75*i),FO(xm(t,a),xm(o,s),.33)}return xm(t,s)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let s=(t-this.startTime)/this.duration;if(s<1){let i=this.scrollLeft(s),a=this.scrollTop(s);return new Iw(i,a,!1)}return new Iw(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,s,i){return Yg.start(t,s,i)}static start(t,s,i){i=i+10;let a=Date.now()-10;return new Yg(t,s,a,i)}};function $O(e){return Math.pow(e,3)}function VO(e){return 1-$O(1-e)}var WO=class extends Ue{constructor(e,t,s){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=s,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new av)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(t=this._domNode)==null||t.setClassName(this._invisibleClassName+(e?" fade":"")))}},GO=140,Mk=class extends lv{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new WO(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Lk),this._shouldRender=!0,this.domNode=hc(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(Le(this.domNode.domNode,Qt.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new zO(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,s,i){this.slider=hc(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof s=="number"&&this.slider.setWidth(s),typeof i=="number"&&this.slider.setHeight(i),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Le(this.slider.domNode,Qt.POINTER_DOWN,a=>{a.button===0&&(a.preventDefault(),this._sliderPointerDown(a))})),this.onclick(this.slider.domNode,a=>{a.leftButton&&a.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,s=t+this._scrollbarState.getSliderPosition(),i=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),a=this._sliderPointerPosition(e);s<=a&&a<=i?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,s;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,s=e.offsetY;else{let a=jO(this.domNode.domNode);t=e.pageX-a.left,s=e.pageY-a.top}let i=this._pointerDownRelativePosition(t,s);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(i):this._scrollbarState.getDesiredScrollPositionFromOffset(i)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),s=this._sliderOrthogonalPointerPosition(e),i=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,a=>{let o=this._sliderOrthogonalPointerPosition(a),c=Math.abs(o-s);if(Nk&&c>GO){this._setDesiredScrollPositionNow(i.getScrollPosition());return}let d=this._sliderPointerPosition(a)-t;this._setDesiredScrollPositionNow(i.getDesiredScrollPositionFromDelta(d))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},Ok=class Xg{constructor(t,s,i,a,o,c){this._scrollbarSize=Math.round(s),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(t),this._visibleSize=a,this._scrollSize=o,this._scrollPosition=c,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Xg(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let s=Math.round(t);return this._visibleSize!==s?(this._visibleSize=s,this._refreshComputedValues(),!0):!1}setScrollSize(t){let s=Math.round(t);return this._scrollSize!==s?(this._scrollSize=s,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let s=Math.round(t);return this._scrollPosition!==s?(this._scrollPosition=s,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,s,i,a,o){let c=Math.max(0,i-t),d=Math.max(0,c-2*s),f=a>0&&a>i;if(!f)return{computedAvailableSize:Math.round(c),computedIsNeeded:f,computedSliderSize:Math.round(d),computedSliderRatio:0,computedSliderPosition:0};let h=Math.round(Math.max(20,Math.floor(i*d/a))),g=(d-h)/(a-i),_=o*g;return{computedAvailableSize:Math.round(c),computedIsNeeded:f,computedSliderSize:Math.round(h),computedSliderRatio:g,computedSliderPosition:Math.round(_)}}_refreshComputedValues(){let t=Xg._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let s=t-this._arrowSize-this._computedSliderSize/2;return Math.round(s/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let s=t-this._arrowSize,i=this._scrollPosition;return s<this._computedSliderPosition?i-=this._visibleSize:i+=this._visibleSize,i}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let s=this._computedSliderPosition+t;return Math.round(s/this._computedSliderRatio)}},qO=class extends Mk{constructor(e,t,s){let i=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:s,scrollbarState:new Ok(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,i.width,i.scrollWidth,a.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},KO=class extends Mk{constructor(e,t,s){let i=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:s,scrollbarState:new Ok(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,i.height,i.scrollHeight,a.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},YO=500,Hw=50,XO=class{constructor(e,t,s){this.timestamp=e,this.deltaX=t,this.deltaY=s,this.score=0}},Qg=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,s=0,i=1,a=this._rear;do{let o=a===this._front?t:Math.pow(2,-i);if(t-=o,s+=this._memory[a].score*o,a===this._front)break;a=(this._capacity+a-1)%this._capacity,i++}while(!0);return s<=.5}acceptStandardWheelEvent(t){if(nv){let s=Vi(t.browserEvent),i=oO(s);this.accept(Date.now(),t.deltaX*i,t.deltaY*i)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,s,i){let a=null,o=new XO(t,s,i);this._front===-1&&this._rear===-1?(this._memory[0]=o,this._front=0,this._rear=0):(a=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=o),o.score=this._computeScore(o,a)}_computeScore(t,s){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let i=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(i+=.25),s){let a=Math.abs(t.deltaX),o=Math.abs(t.deltaY),c=Math.abs(s.deltaX),d=Math.abs(s.deltaY),f=Math.max(Math.min(a,c),1),h=Math.max(Math.min(o,d),1),g=Math.max(a,c),_=Math.max(o,d);g%f===0&&_%h===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Qg.INSTANCE=new Qg;var QO=Qg,ZO=class extends lv{constructor(e,t,s){super(),this._onScroll=this._register(new me),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new me),this.onWillScroll=this._onWillScroll.event,this._options=ej(t),this._scrollable=s,this._register(this._scrollable.onScroll(a=>{this._onWillScroll.fire(a),this._onDidScroll(a),this._onScroll.fire(a)}));let i={onMouseWheel:a=>this._onMouseWheel(a),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new KO(this._scrollable,this._options,i)),this._horizontalScrollbar=this._register(new qO(this._scrollable,this._options,i)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=hc(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=hc(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=hc(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,a=>this._onMouseOver(a)),this.onmouseleave(this._listenOnDomNode,a=>this._onMouseLeave(a)),this._hideTimeout=this._register(new av),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=ya(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,Wi&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new Mw(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=ya(this._mouseWheelToDispose),e)){let t=s=>{this._onMouseWheel(new Mw(s))};this._mouseWheelToDispose.push(Le(this._listenOnDomNode,Qt.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var a;if((a=e.browserEvent)!=null&&a.defaultPrevented)return;let t=QO.INSTANCE;t.acceptStandardWheelEvent(e);let s=!1;if(e.deltaY||e.deltaX){let o=e.deltaY*this._options.mouseWheelScrollSensitivity,c=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&c+o===0?c=o=0:Math.abs(o)>=Math.abs(c)?c=0:o=0),this._options.flipAxes&&([o,c]=[c,o]);let d=!Wi&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||d)&&!c&&(c=o,o=0),e.browserEvent&&e.browserEvent.altKey&&(c=c*this._options.fastScrollSensitivity,o=o*this._options.fastScrollSensitivity);let f=this._scrollable.getFutureScrollPosition(),h={};if(o){let g=Hw*o,_=f.scrollTop-(g<0?Math.floor(g):Math.ceil(g));this._verticalScrollbar.writeScrollPosition(h,_)}if(c){let g=Hw*c,_=f.scrollLeft-(g<0?Math.floor(g):Math.ceil(g));this._horizontalScrollbar.writeScrollPosition(h,_)}h=this._scrollable.validateScrollPosition(h),(f.scrollLeft!==h.scrollLeft||f.scrollTop!==h.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(h):this._scrollable.setScrollPositionNow(h),s=!0)}let i=s;!i&&this._options.alwaysConsumeMouseWheel&&(i=!0),!i&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(i=!0),i&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,s=e.scrollLeft>0,i=s?" left":"",a=t?" top":"",o=s||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${i}`),this._topShadowDomNode.setClassName(`shadow${a}`),this._topLeftShadowDomNode.setClassName(`shadow${o}${a}${i}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),YO)}},JO=class extends ZO{constructor(e,t,s){super(e,t,s)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function ej(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,Wi&&(t.className+=" mac"),t}var Zg=class extends Ue{constructor(e,t,s,i,a,o,c,d){super(),this._bufferService=s,this._optionsService=c,this._renderService=d,this._onRequestScrollLines=this._register(new me),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let f=this._register(new UO({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:h=>ov(i.window,h)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{f.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new JO(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},f)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(a.onProtocolChange(h=>{this._scrollableElement.updateOptions({handleMouseWheel:!(h&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(us.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(_t(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=i.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(_t(()=>this._styleElement.remove())),this._register(us.runAndSubscribe(o.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${o.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${o.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${o.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
82
|
+
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(h=>this._handleScroll(h)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),s=t-this._bufferService.buffer.ydisp;s!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(s)),this._isHandlingScroll=!1}};Zg=kt([be(2,bs),be(3,Tn),be(4,pk),be(5,$o),be(6,Ss),be(7,Nn)],Zg);var Jg=class extends Ue{constructor(e,t,s,i,a){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=s,this._decorationService=i,this._renderService=a,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(o=>this._removeDecoration(o))),this._register(_t(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var i;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((i=e==null?void 0:e.options)==null?void 0:i.layer)==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let s=e.options.x??0;return s&&s>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let s=this._decorationElements.get(e);s||(s=this._createElement(e),e.element=s,this._decorationElements.set(e,s),this._container.appendChild(s),e.onDispose(()=>{this._decorationElements.delete(e),s.remove()})),s.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(s.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,s.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,s.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,s.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(s)}}_refreshXPosition(e,t=e.element){if(!t)return;let s=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=s?`${s*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=s?`${s*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};Jg=kt([be(1,bs),be(2,Tn),be(3,Bc),be(4,Nn)],Jg);var tj=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,s){return t>=e.startBufferLine-this._linePadding[s||"full"]&&t<=e.endBufferLine+this._linePadding[s||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},ji={full:0,left:0,center:0,right:0},sr={full:0,left:0,center:0,right:0},Vl={full:0,left:0,center:0,right:0},ed=class extends Ue{constructor(e,t,s,i,a,o,c,d){var h;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=s,this._decorationService=i,this._renderService=a,this._optionsService=o,this._themeService=c,this._coreBrowserService=d,this._colorZoneStore=new tj,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(h=this._viewportElement.parentElement)==null||h.insertBefore(this._canvas,this._viewportElement),this._register(_t(()=>{var g;return(g=this._canvas)==null?void 0:g.remove()}));let f=this._canvas.getContext("2d");if(f)this._ctx=f;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);sr.full=this._canvas.width,sr.left=e,sr.center=t,sr.right=e,this._refreshDrawHeightConstants(),Vl.full=1,Vl.left=1,Vl.center=1+sr.left,Vl.right=1+sr.left+sr.center}_refreshDrawHeightConstants(){ji.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);ji.left=t,ji.center=t,ji.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ji.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ji.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ji.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ji.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(Vl[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-ji[e.position||"full"]/2),sr[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+ji[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};ed=kt([be(2,bs),be(3,Bc),be(4,Nn),be(5,Ss),be(6,$o),be(7,Tn)],ed);var de;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
|
|
83
|
+
`,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(de||(de={}));var zh;(e=>(e.PAD="",e.HOP="",e.BPH="",e.NBH="",e.IND="",e.NEL="
",e.SSA="",e.ESA="",e.HTS="",e.HTJ="",e.VTS="",e.PLD="",e.PLU="",e.RI="",e.SS2="",e.SS3="",e.DCS="",e.PU1="",e.PU2="",e.STS="",e.CCH="",e.MW="",e.SPA="",e.EPA="",e.SOS="",e.SGCI="",e.SCI="",e.CSI="",e.ST="",e.OSC="",e.PM="",e.APC=""))(zh||(zh={}));var jk;(e=>e.ST=`${de.ESC}\\`)(jk||(jk={}));var e_=class{constructor(e,t,s,i,a,o){this._textarea=e,this._compositionView=t,this._bufferService=s,this._optionsService=i,this._coreService=a,this._renderService=o,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let s;t.start+=this._dataAlreadySent.length,this._isComposing?s=this._textarea.value.substring(t.start,this._compositionPosition.start):s=this._textarea.value.substring(t.start),s.length>0&&this._coreService.triggerDataEvent(s,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,s=t.replace(e,"");this._dataAlreadySent=s,t.length>e.length?this._coreService.triggerDataEvent(s,!0):t.length<e.length?this._coreService.triggerDataEvent(`${de.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),s=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,a=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=a+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=s+"px",this._compositionView.style.lineHeight=s+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let o=this._compositionView.getBoundingClientRect();this._textarea.style.left=a+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(o.width,1)+"px",this._textarea.style.height=Math.max(o.height,1)+"px",this._textarea.style.lineHeight=o.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};e_=kt([be(2,bs),be(3,Ss),be(4,Ca),be(5,Nn)],e_);var Zt=0,Jt=0,es=0,xt=0,Uw={css:"#00000000",rgba:0},Pt;(e=>{function t(a,o,c,d){return d!==void 0?`#${Wr(a)}${Wr(o)}${Wr(c)}${Wr(d)}`:`#${Wr(a)}${Wr(o)}${Wr(c)}`}e.toCss=t;function s(a,o,c,d=255){return(a<<24|o<<16|c<<8|d)>>>0}e.toRgba=s;function i(a,o,c,d){return{css:e.toCss(a,o,c,d),rgba:e.toRgba(a,o,c,d)}}e.toColor=i})(Pt||(Pt={}));var ft;(e=>{function t(f,h){if(xt=(h.rgba&255)/255,xt===1)return{css:h.css,rgba:h.rgba};let g=h.rgba>>24&255,_=h.rgba>>16&255,y=h.rgba>>8&255,b=f.rgba>>24&255,S=f.rgba>>16&255,w=f.rgba>>8&255;Zt=b+Math.round((g-b)*xt),Jt=S+Math.round((_-S)*xt),es=w+Math.round((y-w)*xt);let k=Pt.toCss(Zt,Jt,es),T=Pt.toRgba(Zt,Jt,es);return{css:k,rgba:T}}e.blend=t;function s(f){return(f.rgba&255)===255}e.isOpaque=s;function i(f,h,g){let _=Hh.ensureContrastRatio(f.rgba,h.rgba,g);if(_)return Pt.toColor(_>>24&255,_>>16&255,_>>8&255)}e.ensureContrastRatio=i;function a(f){let h=(f.rgba|255)>>>0;return[Zt,Jt,es]=Hh.toChannels(h),{css:Pt.toCss(Zt,Jt,es),rgba:h}}e.opaque=a;function o(f,h){return xt=Math.round(h*255),[Zt,Jt,es]=Hh.toChannels(f.rgba),{css:Pt.toCss(Zt,Jt,es,xt),rgba:Pt.toRgba(Zt,Jt,es,xt)}}e.opacity=o;function c(f,h){return xt=f.rgba&255,o(f,xt*h/255)}e.multiplyOpacity=c;function d(f){return[f.rgba>>24&255,f.rgba>>16&255,f.rgba>>8&255]}e.toColorRGB=d})(ft||(ft={}));var yt;(e=>{let t,s;try{let a=document.createElement("canvas");a.width=1,a.height=1;let o=a.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",s=t.createLinearGradient(0,0,1,1))}catch{}function i(a){if(a.match(/#[\da-f]{3,8}/i))switch(a.length){case 4:return Zt=parseInt(a.slice(1,2).repeat(2),16),Jt=parseInt(a.slice(2,3).repeat(2),16),es=parseInt(a.slice(3,4).repeat(2),16),Pt.toColor(Zt,Jt,es);case 5:return Zt=parseInt(a.slice(1,2).repeat(2),16),Jt=parseInt(a.slice(2,3).repeat(2),16),es=parseInt(a.slice(3,4).repeat(2),16),xt=parseInt(a.slice(4,5).repeat(2),16),Pt.toColor(Zt,Jt,es,xt);case 7:return{css:a,rgba:(parseInt(a.slice(1),16)<<8|255)>>>0};case 9:return{css:a,rgba:parseInt(a.slice(1),16)>>>0}}let o=a.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(o)return Zt=parseInt(o[1]),Jt=parseInt(o[2]),es=parseInt(o[3]),xt=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),Pt.toColor(Zt,Jt,es,xt);if(!t||!s)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=s,t.fillStyle=a,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Zt,Jt,es,xt]=t.getImageData(0,0,1,1).data,xt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Pt.toRgba(Zt,Jt,es,xt),css:a}}e.toColor=i})(yt||(yt={}));var vs;(e=>{function t(i){return s(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=t;function s(i,a,o){let c=i/255,d=a/255,f=o/255,h=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),g=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),_=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4);return h*.2126+g*.7152+_*.0722}e.relativeLuminance2=s})(vs||(vs={}));var Hh;(e=>{function t(c,d){if(xt=(d&255)/255,xt===1)return d;let f=d>>24&255,h=d>>16&255,g=d>>8&255,_=c>>24&255,y=c>>16&255,b=c>>8&255;return Zt=_+Math.round((f-_)*xt),Jt=y+Math.round((h-y)*xt),es=b+Math.round((g-b)*xt),Pt.toRgba(Zt,Jt,es)}e.blend=t;function s(c,d,f){let h=vs.relativeLuminance(c>>8),g=vs.relativeLuminance(d>>8);if(mn(h,g)<f){if(g<h){let b=i(c,d,f),S=mn(h,vs.relativeLuminance(b>>8));if(S<f){let w=a(c,d,f),k=mn(h,vs.relativeLuminance(w>>8));return S>k?b:w}return b}let _=a(c,d,f),y=mn(h,vs.relativeLuminance(_>>8));if(y<f){let b=i(c,d,f),S=mn(h,vs.relativeLuminance(b>>8));return y>S?_:b}return _}}e.ensureContrastRatio=s;function i(c,d,f){let h=c>>24&255,g=c>>16&255,_=c>>8&255,y=d>>24&255,b=d>>16&255,S=d>>8&255,w=mn(vs.relativeLuminance2(y,b,S),vs.relativeLuminance2(h,g,_));for(;w<f&&(y>0||b>0||S>0);)y-=Math.max(0,Math.ceil(y*.1)),b-=Math.max(0,Math.ceil(b*.1)),S-=Math.max(0,Math.ceil(S*.1)),w=mn(vs.relativeLuminance2(y,b,S),vs.relativeLuminance2(h,g,_));return(y<<24|b<<16|S<<8|255)>>>0}e.reduceLuminance=i;function a(c,d,f){let h=c>>24&255,g=c>>16&255,_=c>>8&255,y=d>>24&255,b=d>>16&255,S=d>>8&255,w=mn(vs.relativeLuminance2(y,b,S),vs.relativeLuminance2(h,g,_));for(;w<f&&(y<255||b<255||S<255);)y=Math.min(255,y+Math.ceil((255-y)*.1)),b=Math.min(255,b+Math.ceil((255-b)*.1)),S=Math.min(255,S+Math.ceil((255-S)*.1)),w=mn(vs.relativeLuminance2(y,b,S),vs.relativeLuminance2(h,g,_));return(y<<24|b<<16|S<<8|255)>>>0}e.increaseLuminance=a;function o(c){return[c>>24&255,c>>16&255,c>>8&255,c&255]}e.toChannels=o})(Hh||(Hh={}));function Wr(e){let t=e.toString(16);return t.length<2?"0"+t:t}function mn(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var sj=class extends Pc{constructor(e,t,s){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=s}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},td=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new gi}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let s=[],i=t.translateToString(!0),a=0,o=0,c=0,d=t.getFg(0),f=t.getBg(0);for(let h=0;h<t.getTrimmedLength();h++)if(t.loadCell(h,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==d||this._workCell.bg!==f){if(h-a>1){let g=this._getJoinedRanges(i,c,o,t,a);for(let _=0;_<g.length;_++)s.push(g[_])}a=h,c=o,d=this._workCell.fg,f=this._workCell.bg}o+=this._workCell.getChars().length||yr.length}if(this._bufferService.cols-a>1){let h=this._getJoinedRanges(i,c,o,t,a);for(let g=0;g<h.length;g++)s.push(h[g])}return s}_getJoinedRanges(e,t,s,i,a){let o=e.substring(t,s),c=[];try{c=this._characterJoiners[0].handler(o)}catch(d){console.error(d)}for(let d=1;d<this._characterJoiners.length;d++)try{let f=this._characterJoiners[d].handler(o);for(let h=0;h<f.length;h++)td._mergeRanges(c,f[h])}catch(f){console.error(f)}return this._stringRangesToCellRanges(c,i,a),c}_stringRangesToCellRanges(e,t,s){let i=0,a=!1,o=0,c=e[i];if(c){for(let d=s;d<this._bufferService.cols;d++){let f=t.getWidth(d),h=t.getString(d).length||yr.length;if(f!==0){if(!a&&c[0]<=o&&(c[0]=d,a=!0),c[1]<=o){if(c[1]=d,c=e[++i],!c)break;c[0]<=o?(c[0]=d,a=!0):a=!1}o+=h}}c&&(c[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let s=!1;for(let i=0;i<e.length;i++){let a=e[i];if(s){if(t[1]<=a[0])return e[i-1][1]=t[1],e;if(t[1]<=a[1])return e[i-1][1]=Math.max(t[1],a[1]),e.splice(i,1),e;e.splice(i,1),i--}else{if(t[1]<=a[0])return e.splice(i,0,t),e;if(t[1]<=a[1])return a[0]=Math.min(t[0],a[0]),e;t[0]<a[1]&&(a[0]=Math.min(t[0],a[0]),s=!0);continue}}return s?e[e.length-1][1]=t[1]:e.push(t),e}};td=kt([be(0,bs)],td);function ij(e){return 57508<=e&&e<=57558}function nj(e){return 9472<=e&&e<=9631}function rj(e){return ij(e)||nj(e)}function aj(){return{css:{canvas:_h(),cell:_h()},device:{canvas:_h(),cell:_h(),char:{width:0,height:0,left:0,top:0}}}}function _h(){return{width:0,height:0}}var t_=class{constructor(e,t,s,i,a,o,c){this._document=e,this._characterJoinerService=t,this._optionsService=s,this._coreBrowserService=i,this._coreService=a,this._decorationService=o,this._themeService=c,this._workCell=new gi,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,s){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=s}createRow(e,t,s,i,a,o,c,d,f,h,g){let _=[],y=this._characterJoinerService.getJoinedCharacters(t),b=this._themeService.colors,S=e.getNoBgTrimmedLength();s&&S<o+1&&(S=o+1);let w,k=0,T="",D=0,N=0,E=0,M=0,U=!1,W=0,B=!1,$=0,Y=0,K=[],X=h!==-1&&g!==-1;for(let P=0;P<S;P++){e.loadCell(P,this._workCell);let j=this._workCell.getWidth();if(j===0)continue;let H=!1,O=P>=Y,z=P,Q=this._workCell;if(y.length>0&&P===y[0][0]&&O){let Re=y.shift(),pt=this._isCellInSelection(Re[0],t);for(D=Re[0]+1;D<Re[1];D++)O&&(O=pt===this._isCellInSelection(D,t));O&&(O=!s||o<Re[0]||o>=Re[1]),O?(H=!0,Q=new sj(this._workCell,e.translateToString(!0,Re[0],Re[1]),Re[1]-Re[0]),z=Re[1]-1,j=Q.getWidth()):Y=Re[1]}let re=this._isCellInSelection(P,t),ne=s&&P===o,A=X&&P>=h&&P<=g,I=!1;this._decorationService.forEachDecorationAtCell(P,t,void 0,Re=>{I=!0});let q=Q.getChars()||yr;if(q===" "&&(Q.isUnderline()||Q.isOverline())&&(q=" "),$=j*d-f.get(q,Q.isBold(),Q.isItalic()),!w)w=this._document.createElement("span");else if(k&&(re&&B||!re&&!B&&Q.bg===N)&&(re&&B&&b.selectionForeground||Q.fg===E)&&Q.extended.ext===M&&A===U&&$===W&&!ne&&!H&&!I&&O){Q.isInvisible()?T+=yr:T+=q,k++;continue}else k&&(w.textContent=T),w=this._document.createElement("span"),k=0,T="";if(N=Q.bg,E=Q.fg,M=Q.extended.ext,U=A,W=$,B=re,H&&o>=P&&o<=z&&(o=P),!this._coreService.isCursorHidden&&ne&&this._coreService.isCursorInitialized){if(K.push("xterm-cursor"),this._coreBrowserService.isFocused)c&&K.push("xterm-cursor-blink"),K.push(i==="bar"?"xterm-cursor-bar":i==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(a)switch(a){case"outline":K.push("xterm-cursor-outline");break;case"block":K.push("xterm-cursor-block");break;case"bar":K.push("xterm-cursor-bar");break;case"underline":K.push("xterm-cursor-underline");break}}if(Q.isBold()&&K.push("xterm-bold"),Q.isItalic()&&K.push("xterm-italic"),Q.isDim()&&K.push("xterm-dim"),Q.isInvisible()?T=yr:T=Q.getChars()||yr,Q.isUnderline()&&(K.push(`xterm-underline-${Q.extended.underlineStyle}`),T===" "&&(T=" "),!Q.isUnderlineColorDefault()))if(Q.isUnderlineColorRGB())w.style.textDecorationColor=`rgb(${Pc.toColorRGB(Q.getUnderlineColor()).join(",")})`;else{let Re=Q.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Q.isBold()&&Re<8&&(Re+=8),w.style.textDecorationColor=b.ansi[Re].css}Q.isOverline()&&(K.push("xterm-overline"),T===" "&&(T=" ")),Q.isStrikethrough()&&K.push("xterm-strikethrough"),A&&(w.style.textDecoration="underline");let oe=Q.getFgColor(),ve=Q.getFgColorMode(),Se=Q.getBgColor(),Ne=Q.getBgColorMode(),ze=!!Q.isInverse();if(ze){let Re=oe;oe=Se,Se=Re;let pt=ve;ve=Ne,Ne=pt}let De,le,Ee=!1;this._decorationService.forEachDecorationAtCell(P,t,void 0,Re=>{Re.options.layer!=="top"&&Ee||(Re.backgroundColorRGB&&(Ne=50331648,Se=Re.backgroundColorRGB.rgba>>8&16777215,De=Re.backgroundColorRGB),Re.foregroundColorRGB&&(ve=50331648,oe=Re.foregroundColorRGB.rgba>>8&16777215,le=Re.foregroundColorRGB),Ee=Re.options.layer==="top")}),!Ee&&re&&(De=this._coreBrowserService.isFocused?b.selectionBackgroundOpaque:b.selectionInactiveBackgroundOpaque,Se=De.rgba>>8&16777215,Ne=50331648,Ee=!0,b.selectionForeground&&(ve=50331648,oe=b.selectionForeground.rgba>>8&16777215,le=b.selectionForeground)),Ee&&K.push("xterm-decoration-top");let we;switch(Ne){case 16777216:case 33554432:we=b.ansi[Se],K.push(`xterm-bg-${Se}`);break;case 50331648:we=Pt.toColor(Se>>16,Se>>8&255,Se&255),this._addStyle(w,`background-color:#${Fw((Se>>>0).toString(16),"0",6)}`);break;case 0:default:ze?(we=b.foreground,K.push("xterm-bg-257")):we=b.background}switch(De||Q.isDim()&&(De=ft.multiplyOpacity(we,.5)),ve){case 16777216:case 33554432:Q.isBold()&&oe<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(oe+=8),this._applyMinimumContrast(w,we,b.ansi[oe],Q,De,void 0)||K.push(`xterm-fg-${oe}`);break;case 50331648:let Re=Pt.toColor(oe>>16&255,oe>>8&255,oe&255);this._applyMinimumContrast(w,we,Re,Q,De,le)||this._addStyle(w,`color:#${Fw(oe.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(w,we,b.foreground,Q,De,le)||ze&&K.push("xterm-fg-257")}K.length&&(w.className=K.join(" "),K.length=0),!ne&&!H&&!I&&O?k++:w.textContent=T,$!==this.defaultSpacing&&(w.style.letterSpacing=`${$}px`),_.push(w),P=z}return w&&k&&(w.textContent=T),_}_applyMinimumContrast(e,t,s,i,a,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||rj(i.getCode()))return!1;let c=this._getContrastCache(i),d;if(!a&&!o&&(d=c.getColor(t.rgba,s.rgba)),d===void 0){let f=this._optionsService.rawOptions.minimumContrastRatio/(i.isDim()?2:1);d=ft.ensureContrastRatio(a||t,o||s,f),c.setColor((a||t).rgba,(o||s).rgba,d??null)}return d?(this._addStyle(e,`color:${d.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let s=this._selectionStart,i=this._selectionEnd;return!s||!i?!1:this._columnSelectMode?s[0]<=i[0]?e>=s[0]&&t>=s[1]&&e<i[0]&&t<=i[1]:e<s[0]&&t>=s[1]&&e>=i[0]&&t<=i[1]:t>s[1]&&t<i[1]||s[1]===i[1]&&t===s[1]&&e>=s[0]&&e<i[0]||s[1]<i[1]&&t===i[1]&&e<i[0]||s[1]<i[1]&&t===s[1]&&e>=s[0]}};t_=kt([be(1,_k),be(2,Ss),be(3,Tn),be(4,Ca),be(5,Bc),be(6,$o)],t_);function Fw(e,t,s){for(;e.length<s;)e=t+e;return e}var oj=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let s=e.createElement("span");s.classList.add("xterm-char-measure-element");let i=e.createElement("span");i.classList.add("xterm-char-measure-element"),i.style.fontWeight="bold";let a=e.createElement("span");a.classList.add("xterm-char-measure-element"),a.style.fontStyle="italic";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold",o.style.fontStyle="italic",this._measureElements=[s,i,a,o],this._container.appendChild(s),this._container.appendChild(i),this._container.appendChild(a),this._container.appendChild(o),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,s,i){e===this._font&&t===this._fontSize&&s===this._weight&&i===this._weightBold||(this._font=e,this._fontSize=t,this._weight=s,this._weightBold=i,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${s}`,this._measureElements[1].style.fontWeight=`${i}`,this._measureElements[2].style.fontWeight=`${s}`,this._measureElements[3].style.fontWeight=`${i}`,this.clear())}get(e,t,s){let i=0;if(!t&&!s&&e.length===1&&(i=e.charCodeAt(0))<256){if(this._flat[i]!==-9999)return this._flat[i];let c=this._measure(e,0);return c>0&&(this._flat[i]=c),c}let a=e;t&&(a+="B"),s&&(a+="I");let o=this._holey.get(a);if(o===void 0){let c=0;t&&(c|=1),s&&(c|=2),o=this._measure(e,c),o>0&&this._holey.set(a,o)}return o}_measure(e,t){let s=this._measureElements[t];return s.textContent=e.repeat(32),s.offsetWidth/32}},lj=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,s,i=!1){if(this.selectionStart=t,this.selectionEnd=s,!t||!s||t[0]===s[0]&&t[1]===s[1]){this.clear();return}let a=e.buffers.active.ydisp,o=t[1]-a,c=s[1]-a,d=Math.max(o,0),f=Math.min(c,e.rows-1);if(d>=e.rows||f<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=i,this.viewportStartRow=o,this.viewportEndRow=c,this.viewportCappedStartRow=d,this.viewportCappedEndRow=f,this.startCol=t[0],this.endCol=s[0]}isCellSelected(e,t,s){return this.hasSelection?(s-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&s>=this.viewportCappedStartRow&&t<this.endCol&&s<=this.viewportCappedEndRow:t<this.startCol&&s>=this.viewportCappedStartRow&&t>=this.endCol&&s<=this.viewportCappedEndRow:s>this.viewportStartRow&&s<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&s===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportStartRow&&t>=this.startCol):!1}};function cj(){return new lj}var km="xterm-dom-renderer-owner-",ai="xterm-rows",vh="xterm-fg-",$w="xterm-bg-",Wl="xterm-focus",yh="xterm-selection",uj=1,s_=class extends Ue{constructor(e,t,s,i,a,o,c,d,f,h,g,_,y,b){super(),this._terminal=e,this._document=t,this._element=s,this._screenElement=i,this._viewportElement=a,this._helperContainer=o,this._linkifier2=c,this._charSizeService=f,this._optionsService=h,this._bufferService=g,this._coreService=_,this._coreBrowserService=y,this._themeService=b,this._terminalClass=uj++,this._rowElements=[],this._selectionRenderModel=cj(),this.onRequestRedraw=this._register(new me).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(ai),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(yh),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=aj(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(S=>this._injectCss(S))),this._injectCss(this._themeService.colors),this._rowFactory=d.createInstance(t_,document),this._element.classList.add(km+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(S=>this._handleLinkHover(S))),this._register(this._linkifier2.onHideLinkUnderline(S=>this._handleLinkLeave(S))),this._register(_t(()=>{this._element.classList.remove(km+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new oj(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let s of this._rowElements)s.style.width=`${this.dimensions.css.canvas.width}px`,s.style.height=`${this.dimensions.css.cell.height}px`,s.style.lineHeight=`${this.dimensions.css.cell.height}px`,s.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${ai} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${ai} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${ai} .xterm-dim { color: ${ft.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let s=`blink_underline_${this._terminalClass}`,i=`blink_bar_${this._terminalClass}`,a=`blink_block_${this._terminalClass}`;t+=`@keyframes ${s} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${i} { 50% { box-shadow: none; }}`,t+=`@keyframes ${a} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${ai}.${Wl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${ai}.${Wl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${ai}.${Wl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${a} 1s step-end infinite;}${this._terminalSelector} .${ai} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${ai} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${ai} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${ai} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${ai} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${yh} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${yh} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${yh} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,c]of e.ansi.entries())t+=`${this._terminalSelector} .${vh}${o} { color: ${c.css}; }${this._terminalSelector} .${vh}${o}.xterm-dim { color: ${ft.multiplyOpacity(c,.5).css}; }${this._terminalSelector} .${$w}${o} { background-color: ${c.css}; }`;t+=`${this._terminalSelector} .${vh}257 { color: ${ft.opaque(e.background).css}; }${this._terminalSelector} .${vh}257.xterm-dim { color: ${ft.multiplyOpacity(ft.opaque(e.background),.5).css}; }${this._terminalSelector} .${$w}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let s=this._rowElements.length;s<=t;s++){let i=this._document.createElement("div");this._rowContainer.appendChild(i),this._rowElements.push(i)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(Wl),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Wl),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,s){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,s),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,s),!this._selectionRenderModel.hasSelection))return;let i=this._selectionRenderModel.viewportStartRow,a=this._selectionRenderModel.viewportEndRow,o=this._selectionRenderModel.viewportCappedStartRow,c=this._selectionRenderModel.viewportCappedEndRow,d=this._document.createDocumentFragment();if(s){let f=e[0]>t[0];d.appendChild(this._createSelectionElement(o,f?t[0]:e[0],f?e[0]:t[0],c-o+1))}else{let f=i===o?e[0]:0,h=o===a?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(o,f,h));let g=c-o-1;if(d.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,g)),o!==c){let _=a===c?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(c,0,_))}}this._selectionContainer.appendChild(d)}_createSelectionElement(e,t,s,i=1){let a=this._document.createElement("div"),o=t*this.dimensions.css.cell.width,c=this.dimensions.css.cell.width*(s-t);return o+c>this.dimensions.css.canvas.width&&(c=this.dimensions.css.canvas.width-o),a.style.height=`${i*this.dimensions.css.cell.height}px`,a.style.top=`${e*this.dimensions.css.cell.height}px`,a.style.left=`${o}px`,a.style.width=`${c}px`,a}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let s=this._bufferService.buffer,i=s.ybase+s.y,a=Math.min(s.x,this._bufferService.cols-1),o=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,c=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,d=this._optionsService.rawOptions.cursorInactiveStyle;for(let f=e;f<=t;f++){let h=f+s.ydisp,g=this._rowElements[f],_=s.lines.get(h);if(!g||!_)break;g.replaceChildren(...this._rowFactory.createRow(_,h,h===i,c,d,a,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${km}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,s,i,a,o){s<0&&(e=0),i<0&&(t=0);let c=this._bufferService.rows-1;s=Math.max(Math.min(s,c),0),i=Math.max(Math.min(i,c),0),a=Math.min(a,this._bufferService.cols);let d=this._bufferService.buffer,f=d.ybase+d.y,h=Math.min(d.x,a-1),g=this._optionsService.rawOptions.cursorBlink,_=this._optionsService.rawOptions.cursorStyle,y=this._optionsService.rawOptions.cursorInactiveStyle;for(let b=s;b<=i;++b){let S=b+d.ydisp,w=this._rowElements[b],k=d.lines.get(S);if(!w||!k)break;w.replaceChildren(...this._rowFactory.createRow(k,S,S===f,_,y,h,g,this.dimensions.css.cell.width,this._widthCache,o?b===s?e:0:-1,o?(b===i?t:a)-1:-1))}}};s_=kt([be(7,tv),be(8,xd),be(9,Ss),be(10,bs),be(11,Ca),be(12,Tn),be(13,$o)],s_);var i_=class extends Ue{constructor(e,t,s){super(),this._optionsService=s,this.width=0,this.height=0,this._onCharSizeChange=this._register(new me),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new dj(this._optionsService))}catch{this._measureStrategy=this._register(new hj(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};i_=kt([be(2,Ss)],i_);var Pk=class extends Ue{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},hj=class extends Pk{constructor(e,t,s){super(),this._document=e,this._parentElement=t,this._optionsService=s,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},dj=class extends Pk{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},fj=class extends Ue{constructor(e,t,s){super(),this._textarea=e,this._window=t,this.mainDocument=s,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new pj(this._window)),this._onDprChange=this._register(new me),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new me),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(i=>this._screenDprMonitor.setWindow(i))),this._register(us.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Le(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Le(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},pj=class extends Ue{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Io),this._onDprChange=this._register(new me),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(_t(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Le(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},mj=class extends Ue{constructor(){super(),this.linkProviders=[],this._register(_t(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function cv(e,t,s){let i=s.getBoundingClientRect(),a=e.getComputedStyle(s),o=parseInt(a.getPropertyValue("padding-left")),c=parseInt(a.getPropertyValue("padding-top"));return[t.clientX-i.left-o,t.clientY-i.top-c]}function gj(e,t,s,i,a,o,c,d,f){if(!o)return;let h=cv(e,t,s);if(h)return h[0]=Math.ceil((h[0]+(f?c/2:0))/c),h[1]=Math.ceil(h[1]/d),h[0]=Math.min(Math.max(h[0],1),i+(f?1:0)),h[1]=Math.min(Math.max(h[1],1),a),h}var n_=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,s,i,a){return gj(window,e,t,s,i,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,a)}getMouseReportCoords(e,t){let s=cv(window,e,t);if(this._charSizeService.hasValidSize)return s[0]=Math.min(Math.max(s[0],0),this._renderService.dimensions.css.canvas.width-1),s[1]=Math.min(Math.max(s[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(s[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(s[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(s[0]),y:Math.floor(s[1])}}};n_=kt([be(0,Nn),be(1,xd)],n_);var _j=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,s){this._rowCount=s,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},Bk={};TM(Bk,{getSafariVersion:()=>yj,isChromeOS:()=>Uk,isFirefox:()=>Ik,isIpad:()=>bj,isIphone:()=>Sj,isLegacyEdge:()=>vj,isLinux:()=>uv,isMac:()=>sd,isNode:()=>kd,isSafari:()=>zk,isWindows:()=>Hk});var kd=typeof process<"u"&&"title"in process,Ic=kd?"node":navigator.userAgent,zc=kd?"node":navigator.platform,Ik=Ic.includes("Firefox"),vj=Ic.includes("Edge"),zk=/^((?!chrome|android).)*safari/i.test(Ic);function yj(){if(!zk)return 0;let e=Ic.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var sd=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(zc),bj=zc==="iPad",Sj=zc==="iPhone",Hk=["Windows","Win16","Win32","WinCE"].includes(zc),uv=zc.indexOf("Linux")>=0,Uk=/\bCrOS\b/.test(Ic),Fk=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,s=0,i=e.timeRemaining(),a=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),s=Math.max(t,s),a=e.timeRemaining(),s*1.5>a){i-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-t))}ms`),this._start();return}i=a}this.clear()}},wj=class extends Fk{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},Cj=class extends Fk{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},id=!kd&&"requestIdleCallback"in window?Cj:wj,xj=class{constructor(){this._queue=new id}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},r_=class extends Ue{constructor(e,t,s,i,a,o,c,d,f){super(),this._rowCount=e,this._optionsService=s,this._charSizeService=i,this._coreService=a,this._coreBrowserService=d,this._renderer=this._register(new Io),this._pausedResizeTask=new xj,this._observerDisposable=this._register(new Io),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new me),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new me),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new me),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new me),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new _j((h,g)=>this._renderRows(h,g),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new kj(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(_t(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(c.onResize(()=>this._fullRefresh())),this._register(c.buffers.onBufferActivate(()=>{var h;return(h=this._renderer.value)==null?void 0:h.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(c.cols,c.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(c.buffer.y,c.buffer.y,!0))),this._register(f.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(h=>this._registerIntersectionObserver(h,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let s=new e.IntersectionObserver(i=>this._handleIntersectionChange(i[i.length-1]),{threshold:0});s.observe(t),this._observerDisposable.value=_t(()=>s.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,s=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let i=this._syncOutputHandler.flush();i&&(e=Math.min(e,i.start),t=Math.max(t,i.end)),s||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var s;return(s=this._renderer.value)==null?void 0:s.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,s){var i;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=s,(i=this._renderer.value)==null||i.handleSelectionChanged(e,t,s)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};r_=kt([be(2,Ss),be(3,xd),be(4,Ca),be(5,Bc),be(6,bs),be(7,Tn),be(8,$o)],r_);var kj=class{constructor(e,t,s){this._coreBrowserService=e,this._coreService=t,this._onTimeout=s,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function Ej(e,t,s,i){let a=s.buffer.x,o=s.buffer.y;if(!s.buffer.hasScrollback)return Aj(a,o,e,t,s,i)+Ed(o,t,s,i)+Rj(a,o,e,t,s,i);let c;if(o===t)return c=a>e?"D":"C",Sc(Math.abs(a-e),bc(c,i));c=o>t?"D":"C";let d=Math.abs(o-t),f=Nj(o>t?e:a,s)+(d-1)*s.cols+1+Tj(o>t?a:e);return Sc(f,bc(c,i))}function Tj(e,t){return e-1}function Nj(e,t){return t.cols-e}function Aj(e,t,s,i,a,o){return Ed(t,i,a,o).length===0?"":Sc(Vk(e,t,e,t-ba(t,a),!1,a).length,bc("D",o))}function Ed(e,t,s,i){let a=e-ba(e,s),o=t-ba(t,s),c=Math.abs(a-o)-Dj(e,t,s);return Sc(c,bc($k(e,t),i))}function Rj(e,t,s,i,a,o){let c;Ed(t,i,a,o).length>0?c=i-ba(i,a):c=t;let d=i,f=Lj(e,t,s,i,a,o);return Sc(Vk(e,c,s,d,f==="C",a).length,bc(f,o))}function Dj(e,t,s){var c;let i=0,a=e-ba(e,s),o=t-ba(t,s);for(let d=0;d<Math.abs(a-o);d++){let f=$k(e,t)==="A"?-1:1;(c=s.buffer.lines.get(a+f*d))!=null&&c.isWrapped&&i++}return i}function ba(e,t){let s=0,i=t.buffer.lines.get(e),a=i==null?void 0:i.isWrapped;for(;a&&e>=0&&e<t.rows;)s++,i=t.buffer.lines.get(--e),a=i==null?void 0:i.isWrapped;return s}function Lj(e,t,s,i,a,o){let c;return Ed(s,i,a,o).length>0?c=i-ba(i,a):c=t,e<s&&c<=i||e>=s&&c<i?"C":"D"}function $k(e,t){return e>t?"A":"B"}function Vk(e,t,s,i,a,o){let c=e,d=t,f="";for(;(c!==s||d!==i)&&d>=0&&d<o.buffer.lines.length;)c+=a?1:-1,a&&c>o.cols-1?(f+=o.buffer.translateBufferLineToString(d,!1,e,c),c=0,e=0,d++):!a&&c<0&&(f+=o.buffer.translateBufferLineToString(d,!1,0,e+1),c=o.cols-1,e=c,d--);return f+o.buffer.translateBufferLineToString(d,!1,e,c)}function bc(e,t){let s=t?"O":"[";return de.ESC+s+e}function Sc(e,t){e=Math.floor(e);let s="";for(let i=0;i<e;i++)s+=t;return s}var Mj=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function Vw(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var Em=50,Oj=15,jj=50,Pj=500,Bj=" ",Ij=new RegExp(Bj,"g"),a_=class extends Ue{constructor(e,t,s,i,a,o,c,d,f){super(),this._element=e,this._screenElement=t,this._linkifier=s,this._bufferService=i,this._coreService=a,this._mouseService=o,this._optionsService=c,this._renderService=d,this._coreBrowserService=f,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new gi,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new me),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new me),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new me),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new me),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=h=>this._handleMouseMove(h),this._mouseUpListener=h=>this._handleMouseUp(h),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(h=>this._handleTrim(h)),this._register(this._bufferService.buffers.onBufferActivate(h=>this._handleBufferActivate(h))),this.enable(),this._model=new Mj(this._bufferService),this._activeSelectionMode=0,this._register(_t(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(h=>{h.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let s=this._bufferService.buffer,i=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let a=e[0]<t[0]?e[0]:t[0],o=e[0]<t[0]?t[0]:e[0];for(let c=e[1];c<=t[1];c++){let d=s.translateBufferLineToString(c,!0,a,o);i.push(d)}}else{let a=e[1]===t[1]?t[0]:void 0;i.push(s.translateBufferLineToString(e[1],!0,e[0],a));for(let o=e[1]+1;o<=t[1]-1;o++){let c=s.lines.get(o),d=s.translateBufferLineToString(o,!0);c!=null&&c.isWrapped?i[i.length-1]+=d:i.push(d)}if(e[1]!==t[1]){let o=s.lines.get(t[1]),c=s.translateBufferLineToString(t[1],!0,0,t[0]);o&&o.isWrapped?i[i.length-1]+=c:i.push(c)}}return i.map(a=>a.replace(Ij," ")).join(Hk?`\r
|
|
84
|
+
`:`
|
|
85
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),uv&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),s=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!s||!i||!t?!1:this._areCoordsInSelection(t,s,i)}isCellInSelection(e,t){let s=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!s||!i?!1:this._areCoordsInSelection([e,t],s,i)}_areCoordsInSelection(e,t,s){return e[1]>t[1]&&e[1]<s[1]||t[1]===s[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<s[0]||t[1]<s[1]&&e[1]===s[1]&&e[0]<s[0]||t[1]<s[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var a,o;let s=(o=(a=this._linkifier.currentLink)==null?void 0:a.link)==null?void 0:o.range;if(s)return this._model.selectionStart=[s.start.x-1,s.start.y-1],this._model.selectionStartLength=Vw(s,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let i=this._getMouseBufferCoords(e);return i?(this._selectWordAt(i,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=cv(this._coreBrowserService.window,e,this._screenElement)[1],s=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=s?0:(t>s&&(t-=s),t=Math.min(Math.max(t,-Em),Em),t/=Em,t/Math.abs(t)+Math.round(t*(Oj-1)))}shouldForceSelection(e){return sd?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),jj)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(sd&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let s=this._bufferService.buffer;if(this._model.selectionEnd[1]<s.lines.length){let i=s.lines.get(this._model.selectionEnd[1]);i&&i.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<Pj&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let s=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(s&&s[0]!==void 0&&s[1]!==void 0){let i=Ej(s[0]-1,s[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(i,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,s=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!s){this._oldHasSelection&&this._fireOnSelectionChange(e,t,s);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,s)}_fireOnSelectionChange(e,t,s){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=s,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let s=t;for(let i=0;t>=i;i++){let a=e.loadCell(i,this._workCell).getChars().length;this._workCell.getWidth()===0?s--:a>1&&t!==i&&(s+=a-1)}return s}setSelection(e,t,s){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=s,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,s=!0,i=!0){if(e[0]>=this._bufferService.cols)return;let a=this._bufferService.buffer,o=a.lines.get(e[1]);if(!o)return;let c=a.translateBufferLineToString(e[1],!1),d=this._convertViewportColToCharacterIndex(o,e[0]),f=d,h=e[0]-d,g=0,_=0,y=0,b=0;if(c.charAt(d)===" "){for(;d>0&&c.charAt(d-1)===" ";)d--;for(;f<c.length&&c.charAt(f+1)===" ";)f++}else{let k=e[0],T=e[0];o.getWidth(k)===0&&(g++,k--),o.getWidth(T)===2&&(_++,T++);let D=o.getString(T).length;for(D>1&&(b+=D-1,f+=D-1);k>0&&d>0&&!this._isCharWordSeparator(o.loadCell(k-1,this._workCell));){o.loadCell(k-1,this._workCell);let N=this._workCell.getChars().length;this._workCell.getWidth()===0?(g++,k--):N>1&&(y+=N-1,d-=N-1),d--,k--}for(;T<o.length&&f+1<c.length&&!this._isCharWordSeparator(o.loadCell(T+1,this._workCell));){o.loadCell(T+1,this._workCell);let N=this._workCell.getChars().length;this._workCell.getWidth()===2?(_++,T++):N>1&&(b+=N-1,f+=N-1),f++,T++}}f++;let S=d+h-g+y,w=Math.min(this._bufferService.cols,f-d+g+_-y-b);if(!(!t&&c.slice(d,f).trim()==="")){if(s&&S===0&&o.getCodePoint(0)!==32){let k=a.lines.get(e[1]-1);if(k&&o.isWrapped&&k.getCodePoint(this._bufferService.cols-1)!==32){let T=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(T){let D=this._bufferService.cols-T.start;S-=D,w+=D}}}if(i&&S+w===this._bufferService.cols&&o.getCodePoint(this._bufferService.cols-1)!==32){let k=a.lines.get(e[1]+1);if(k!=null&&k.isWrapped&&k.getCodePoint(0)!==32){let T=this._getWordAt([0,e[1]+1],!1,!1,!0);T&&(w+=T.length)}}return{start:S,length:w}}}_selectWordAt(e,t){let s=this._getWordAt(e,t);if(s){for(;s.start<0;)s.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[s.start,e[1]],this._model.selectionStartLength=s.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let s=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,s--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,s++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,s]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),s={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=Vw(s,this._bufferService.cols)}};a_=kt([be(3,bs),be(4,Ca),be(5,sv),be(6,Ss),be(7,Nn),be(8,Tn)],a_);var Ww=class{constructor(){this._data={}}set(e,t,s){this._data[e]||(this._data[e]={}),this._data[e][t]=s}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Gw=class{constructor(){this._color=new Ww,this._css=new Ww}setCss(e,t,s){this._css.set(e,t,s)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,s){this._color.set(e,t,s)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},It=Object.freeze((()=>{let e=[yt.toColor("#2e3436"),yt.toColor("#cc0000"),yt.toColor("#4e9a06"),yt.toColor("#c4a000"),yt.toColor("#3465a4"),yt.toColor("#75507b"),yt.toColor("#06989a"),yt.toColor("#d3d7cf"),yt.toColor("#555753"),yt.toColor("#ef2929"),yt.toColor("#8ae234"),yt.toColor("#fce94f"),yt.toColor("#729fcf"),yt.toColor("#ad7fa8"),yt.toColor("#34e2e2"),yt.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let s=0;s<216;s++){let i=t[s/36%6|0],a=t[s/6%6|0],o=t[s%6];e.push({css:Pt.toCss(i,a,o),rgba:Pt.toRgba(i,a,o)})}for(let s=0;s<24;s++){let i=8+s*10;e.push({css:Pt.toCss(i,i,i),rgba:Pt.toRgba(i,i,i)})}return e})()),Kr=yt.toColor("#ffffff"),ic=yt.toColor("#000000"),qw=yt.toColor("#ffffff"),Kw=ic,Gl={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},zj=Kr,o_=class extends Ue{constructor(e){super(),this._optionsService=e,this._contrastCache=new Gw,this._halfContrastCache=new Gw,this._onChangeColors=this._register(new me),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Kr,background:ic,cursor:qw,cursorAccent:Kw,selectionForeground:void 0,selectionBackgroundTransparent:Gl,selectionBackgroundOpaque:ft.blend(ic,Gl),selectionInactiveBackgroundTransparent:Gl,selectionInactiveBackgroundOpaque:ft.blend(ic,Gl),scrollbarSliderBackground:ft.opacity(Kr,.2),scrollbarSliderHoverBackground:ft.opacity(Kr,.4),scrollbarSliderActiveBackground:ft.opacity(Kr,.5),overviewRulerBorder:Kr,ansi:It.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=ot(e.foreground,Kr),t.background=ot(e.background,ic),t.cursor=ft.blend(t.background,ot(e.cursor,qw)),t.cursorAccent=ft.blend(t.background,ot(e.cursorAccent,Kw)),t.selectionBackgroundTransparent=ot(e.selectionBackground,Gl),t.selectionBackgroundOpaque=ft.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=ot(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=ft.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?ot(e.selectionForeground,Uw):void 0,t.selectionForeground===Uw&&(t.selectionForeground=void 0),ft.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=ft.opacity(t.selectionBackgroundTransparent,.3)),ft.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=ft.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=ot(e.scrollbarSliderBackground,ft.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=ot(e.scrollbarSliderHoverBackground,ft.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=ot(e.scrollbarSliderActiveBackground,ft.opacity(t.foreground,.5)),t.overviewRulerBorder=ot(e.overviewRulerBorder,zj),t.ansi=It.slice(),t.ansi[0]=ot(e.black,It[0]),t.ansi[1]=ot(e.red,It[1]),t.ansi[2]=ot(e.green,It[2]),t.ansi[3]=ot(e.yellow,It[3]),t.ansi[4]=ot(e.blue,It[4]),t.ansi[5]=ot(e.magenta,It[5]),t.ansi[6]=ot(e.cyan,It[6]),t.ansi[7]=ot(e.white,It[7]),t.ansi[8]=ot(e.brightBlack,It[8]),t.ansi[9]=ot(e.brightRed,It[9]),t.ansi[10]=ot(e.brightGreen,It[10]),t.ansi[11]=ot(e.brightYellow,It[11]),t.ansi[12]=ot(e.brightBlue,It[12]),t.ansi[13]=ot(e.brightMagenta,It[13]),t.ansi[14]=ot(e.brightCyan,It[14]),t.ansi[15]=ot(e.brightWhite,It[15]),e.extendedAnsi){let s=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let i=0;i<s;i++)t.ansi[i+16]=ot(e.extendedAnsi[i],It[i+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};o_=kt([be(0,Ss)],o_);function ot(e,t){if(e!==void 0)try{return yt.toColor(e)}catch{}return t}var Hj=class{constructor(...e){this._entries=new Map;for(let[t,s]of e)this.set(t,s)}set(e,t){let s=this._entries.get(e);return this._entries.set(e,t),s}forEach(e){for(let[t,s]of this._entries.entries())e(t,s)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},Uj=class{constructor(){this._services=new Hj,this._services.set(tv,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let s=OM(e).sort((o,c)=>o.index-c.index),i=[];for(let o of s){let c=this._services.get(o.id);if(!c)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${o.id._id}.`);i.push(c)}let a=s.length>0?s[0].index:t.length;if(t.length!==a)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${a+1} conflicts with ${t.length} static arguments`);return new e(...t,...i)}},Fj={trace:0,debug:1,info:2,warn:3,error:4,off:5},$j="xterm.js: ",l_=class extends Ue{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=Fj[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,s){this._evalLazyOptionalParams(s),e.call(console,(this._optionsService.options.logger?"":$j)+t,...s)}trace(e,...t){var s;this._logLevel<=0&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var s;this._logLevel<=1&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var s;this._logLevel<=2&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var s;this._logLevel<=3&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var s;this._logLevel<=4&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.error.bind(this._optionsService.options.logger))??console.error,e,t)}};l_=kt([be(0,Ss)],l_);var Yw=class extends Ue{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new me),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new me),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new me),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let s=0;s<Math.min(e,this.length);s++)t[s]=this._array[this._getCyclicIndex(s)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...s){if(t){for(let i=e;i<this._length-t;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let i=this._length-1;i>=e;i--)this._array[this._getCyclicIndex(i+s.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<s.length;i++)this._array[this._getCyclicIndex(e+i)]=s[i];if(s.length&&this.onInsertEmitter.fire({index:e,amount:s.length}),this._length+s.length>this._maxLength){let i=this._length+s.length-this._maxLength;this._startIndex+=i,this._length=this._maxLength,this.onTrimEmitter.fire(i)}else this._length+=s.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,s){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+s<0)throw new Error("Cannot shift elements in list beyond index 0");if(s>0){for(let a=t-1;a>=0;a--)this.set(e+a+s,this.get(e+a));let i=e+t+s-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<t;i++)this.set(e+i+s,this.get(e+i))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},He=3,jt=Object.freeze(new Pc),bh=0,Tm=2,nc=class Wk{constructor(t,s,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*He);let a=s||gi.fromCharData([0,uk,1,0]);for(let o=0;o<t;++o)this.setCell(o,a);this.length=t}get(t){let s=this._data[t*He+0],i=s&2097151;return[this._data[t*He+1],s&2097152?this._combined[t]:i?or(i):"",s>>22,s&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i]}set(t,s){this._data[t*He+1]=s[0],s[1].length>1?(this._combined[t]=s[1],this._data[t*He+0]=t|2097152|s[2]<<22):this._data[t*He+0]=s[1].charCodeAt(0)|s[2]<<22}getWidth(t){return this._data[t*He+0]>>22}hasWidth(t){return this._data[t*He+0]&12582912}getFg(t){return this._data[t*He+1]}getBg(t){return this._data[t*He+2]}hasContent(t){return this._data[t*He+0]&4194303}getCodePoint(t){let s=this._data[t*He+0];return s&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):s&2097151}isCombined(t){return this._data[t*He+0]&2097152}getString(t){let s=this._data[t*He+0];return s&2097152?this._combined[t]:s&2097151?or(s&2097151):""}isProtected(t){return this._data[t*He+2]&536870912}loadCell(t,s){return bh=t*He,s.content=this._data[bh+0],s.fg=this._data[bh+1],s.bg=this._data[bh+2],s.content&2097152&&(s.combinedData=this._combined[t]),s.bg&268435456&&(s.extended=this._extendedAttrs[t]),s}setCell(t,s){s.content&2097152&&(this._combined[t]=s.combinedData),s.bg&268435456&&(this._extendedAttrs[t]=s.extended),this._data[t*He+0]=s.content,this._data[t*He+1]=s.fg,this._data[t*He+2]=s.bg}setCellFromCodepoint(t,s,i,a){a.bg&268435456&&(this._extendedAttrs[t]=a.extended),this._data[t*He+0]=s|i<<22,this._data[t*He+1]=a.fg,this._data[t*He+2]=a.bg}addCodepointToCell(t,s,i){let a=this._data[t*He+0];a&2097152?this._combined[t]+=or(s):a&2097151?(this._combined[t]=or(a&2097151)+or(s),a&=-2097152,a|=2097152):a=s|1<<22,i&&(a&=-12582913,a|=i<<22),this._data[t*He+0]=a}insertCells(t,s,i){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),s<this.length-t){let a=new gi;for(let o=this.length-t-s-1;o>=0;--o)this.setCell(t+s+o,this.loadCell(t+o,a));for(let o=0;o<s;++o)this.setCell(t+o,i)}else for(let a=t;a<this.length;++a)this.setCell(a,i);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(t,s,i){if(t%=this.length,s<this.length-t){let a=new gi;for(let o=0;o<this.length-t-s;++o)this.setCell(t+o,this.loadCell(t+s+o,a));for(let o=this.length-s;o<this.length;++o)this.setCell(o,i)}else for(let a=t;a<this.length;++a)this.setCell(a,i);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,i)}replaceCells(t,s,i,a=!1){if(a){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,i),s<this.length&&this.getWidth(s-1)===2&&!this.isProtected(s)&&this.setCellFromCodepoint(s,0,1,i);t<s&&t<this.length;)this.isProtected(t)||this.setCell(t,i),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),s<this.length&&this.getWidth(s-1)===2&&this.setCellFromCodepoint(s,0,1,i);t<s&&t<this.length;)this.setCell(t++,i)}resize(t,s){if(t===this.length)return this._data.length*4*Tm<this._data.buffer.byteLength;let i=t*He;if(t>this.length){if(this._data.buffer.byteLength>=i*4)this._data=new Uint32Array(this._data.buffer,0,i);else{let a=new Uint32Array(i);a.set(this._data),this._data=a}for(let a=this.length;a<t;++a)this.setCell(a,s)}else{this._data=this._data.subarray(0,i);let a=Object.keys(this._combined);for(let c=0;c<a.length;c++){let d=parseInt(a[c],10);d>=t&&delete this._combined[d]}let o=Object.keys(this._extendedAttrs);for(let c=0;c<o.length;c++){let d=parseInt(o[c],10);d>=t&&delete this._extendedAttrs[d]}}return this.length=t,i*4*Tm<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Tm<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,s=!1){if(s){for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,t);return}this._combined={},this._extendedAttrs={};for(let i=0;i<this.length;++i)this.setCell(i,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let s in t._combined)this._combined[s]=t._combined[s];this._extendedAttrs={};for(let s in t._extendedAttrs)this._extendedAttrs[s]=t._extendedAttrs[s];this.isWrapped=t.isWrapped}clone(){let t=new Wk(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let s in this._combined)t._combined[s]=this._combined[s];for(let s in this._extendedAttrs)t._extendedAttrs[s]=this._extendedAttrs[s];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*He+0]&4194303)return t+(this._data[t*He+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*He+0]&4194303||this._data[t*He+2]&50331648)return t+(this._data[t*He+0]>>22);return 0}copyCellsFrom(t,s,i,a,o){let c=t._data;if(o)for(let f=a-1;f>=0;f--){for(let h=0;h<He;h++)this._data[(i+f)*He+h]=c[(s+f)*He+h];c[(s+f)*He+2]&268435456&&(this._extendedAttrs[i+f]=t._extendedAttrs[s+f])}else for(let f=0;f<a;f++){for(let h=0;h<He;h++)this._data[(i+f)*He+h]=c[(s+f)*He+h];c[(s+f)*He+2]&268435456&&(this._extendedAttrs[i+f]=t._extendedAttrs[s+f])}let d=Object.keys(t._combined);for(let f=0;f<d.length;f++){let h=parseInt(d[f],10);h>=s&&(this._combined[h-s+i]=t._combined[h])}}translateToString(t,s,i,a){s=s??0,i=i??this.length,t&&(i=Math.min(i,this.getTrimmedLength())),a&&(a.length=0);let o="";for(;s<i;){let c=this._data[s*He+0],d=c&2097151,f=c&2097152?this._combined[s]:d?or(d):yr;if(o+=f,a)for(let h=0;h<f.length;++h)a.push(s);s+=c>>22||1}return a&&a.push(s),o}};function Vj(e,t,s,i,a,o){let c=[];for(let d=0;d<e.length-1;d++){let f=d,h=e.get(++f);if(!h.isWrapped)continue;let g=[e.get(d)];for(;f<e.length&&h.isWrapped;)g.push(h),h=e.get(++f);if(!o&&i>=d&&i<f){d+=g.length-1;continue}let _=0,y=wc(g,_,t),b=1,S=0;for(;b<g.length;){let k=wc(g,b,t),T=k-S,D=s-y,N=Math.min(T,D);g[_].copyCellsFrom(g[b],S,y,N,!1),y+=N,y===s&&(_++,y=0),S+=N,S===k&&(b++,S=0),y===0&&_!==0&&g[_-1].getWidth(s-1)===2&&(g[_].copyCellsFrom(g[_-1],s-1,y++,1,!1),g[_-1].setCell(s-1,a))}g[_].replaceCells(y,s,a);let w=0;for(let k=g.length-1;k>0&&(k>_||g[k].getTrimmedLength()===0);k--)w++;w>0&&(c.push(d+g.length-w),c.push(w)),d+=g.length-1}return c}function Wj(e,t){let s=[],i=0,a=t[i],o=0;for(let c=0;c<e.length;c++)if(a===c){let d=t[++i];e.onDeleteEmitter.fire({index:c-o,amount:d}),c+=d-1,o+=d,a=t[++i]}else s.push(c);return{layout:s,countRemoved:o}}function Gj(e,t){let s=[];for(let i=0;i<t.length;i++)s.push(e.get(t[i]));for(let i=0;i<s.length;i++)e.set(i,s[i]);e.length=t.length}function qj(e,t,s){let i=[],a=e.map((f,h)=>wc(e,h,t)).reduce((f,h)=>f+h),o=0,c=0,d=0;for(;d<a;){if(a-d<s){i.push(a-d);break}o+=s;let f=wc(e,c,t);o>f&&(o-=f,c++);let h=e[c].getWidth(o-1)===2;h&&o--;let g=h?s-1:s;i.push(g),d+=g}return i}function wc(e,t,s){if(t===e.length-1)return e[t].getTrimmedLength();let i=!e[t].hasContent(s-1)&&e[t].getWidth(s-1)===1,a=e[t+1].getWidth(0)===2;return i&&a?s-1:s}var Gk=class qk{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=qk._nextId++,this._onDispose=this.register(new me),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),ya(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};Gk._nextId=1;var Kj=Gk,$t={},Yr=$t.B;$t[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"};$t.A={"#":"£"};$t.B=void 0;$t[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};$t.C=$t[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};$t.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};$t.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};$t.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};$t.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};$t.E=$t[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};$t.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};$t.H=$t[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};$t["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Xw=4294967295,Qw=class{constructor(e,t,s){this._hasScrollback=e,this._optionsService=t,this._bufferService=s,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=jt.clone(),this.savedCharset=Yr,this.markers=[],this._nullCell=gi.fromCharData([0,uk,1,0]),this._whitespaceCell=gi.fromCharData([0,yr,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new id,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Yw(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new Jh),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new Jh),this._whitespaceCell}getBlankLine(e,t){return new nc(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>Xw?Xw:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=jt);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new Yw(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let s=this.getNullCell(jt),i=0,a=this._getCorrectBufferLength(t);if(a>this.lines.maxLength&&(this.lines.maxLength=a),this.lines.length>0){if(this._cols<e)for(let c=0;c<this.lines.length;c++)i+=+this.lines.get(c).resize(e,s);let o=0;if(this._rows<t)for(let c=this._rows;c<t;c++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new nc(e,s)):this.ybase>0&&this.lines.length<=this.ybase+this.y+o+1?(this.ybase--,o++,this.ydisp>0&&this.ydisp--):this.lines.push(new nc(e,s)));else for(let c=this._rows;c>t;c--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(a<this.lines.maxLength){let c=this.lines.length-a;c>0&&(this.lines.trimStart(c),this.ybase=Math.max(this.ybase-c,0),this.ydisp=Math.max(this.ydisp-c,0),this.savedY=Math.max(this.savedY-c,0)),this.lines.maxLength=a}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),o&&(this.y+=o),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let o=0;o<this.lines.length;o++)i+=+this.lines.get(o).resize(e,s);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),i>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let s=this._optionsService.rawOptions.reflowCursorLine,i=Vj(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(jt),s);if(i.length>0){let a=Wj(this.lines,i);Gj(this.lines,a.layout),this._reflowLargerAdjustViewport(e,t,a.countRemoved)}}_reflowLargerAdjustViewport(e,t,s){let i=this.getNullCell(jt),a=s;for(;a-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new nc(e,i))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-s,0)}_reflowSmaller(e,t){let s=this._optionsService.rawOptions.reflowCursorLine,i=this.getNullCell(jt),a=[],o=0;for(let c=this.lines.length-1;c>=0;c--){let d=this.lines.get(c);if(!d||!d.isWrapped&&d.getTrimmedLength()<=e)continue;let f=[d];for(;d.isWrapped&&c>0;)d=this.lines.get(--c),f.unshift(d);if(!s){let N=this.ybase+this.y;if(N>=c&&N<c+f.length)continue}let h=f[f.length-1].getTrimmedLength(),g=qj(f,this._cols,e),_=g.length-f.length,y;this.ybase===0&&this.y!==this.lines.length-1?y=Math.max(0,this.y-this.lines.maxLength+_):y=Math.max(0,this.lines.length-this.lines.maxLength+_);let b=[];for(let N=0;N<_;N++){let E=this.getBlankLine(jt,!0);b.push(E)}b.length>0&&(a.push({start:c+f.length+o,newLines:b}),o+=b.length),f.push(...b);let S=g.length-1,w=g[S];w===0&&(S--,w=g[S]);let k=f.length-_-1,T=h;for(;k>=0;){let N=Math.min(T,w);if(f[S]===void 0)break;if(f[S].copyCellsFrom(f[k],T-N,w-N,N,!0),w-=N,w===0&&(S--,w=g[S]),T-=N,T===0){k--;let E=Math.max(k,0);T=wc(f,E,this._cols)}}for(let N=0;N<f.length;N++)g[N]<e&&f[N].setCell(g[N],i);let D=_-y;for(;D-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+o)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+_,this.ybase+t-1)}if(a.length>0){let c=[],d=[];for(let w=0;w<this.lines.length;w++)d.push(this.lines.get(w));let f=this.lines.length,h=f-1,g=0,_=a[g];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+o);let y=0;for(let w=Math.min(this.lines.maxLength-1,f+o-1);w>=0;w--)if(_&&_.start>h+y){for(let k=_.newLines.length-1;k>=0;k--)this.lines.set(w--,_.newLines[k]);w++,c.push({index:h+1,amount:_.newLines.length}),y+=_.newLines.length,_=a[++g]}else this.lines.set(w,d[h--]);let b=0;for(let w=c.length-1;w>=0;w--)c[w].index+=b,this.lines.onInsertEmitter.fire(c[w]),b+=c[w].amount;let S=Math.max(0,f+o-this.lines.maxLength);S>0&&this.lines.onTrimEmitter.fire(S)}}translateBufferLineToString(e,t,s=0,i){let a=this.lines.get(e);return a?a.translateToString(t,s,i):""}getWrappedRangeForLine(e){let t=e,s=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;s+1<this.lines.length&&this.lines.get(s+1).isWrapped;)s++;return{first:t,last:s}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new Kj(e);return this.markers.push(t),t.register(this.lines.onTrim(s=>{t.line-=s,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(s=>{t.line>=s.index&&(t.line+=s.amount)})),t.register(this.lines.onDelete(s=>{t.line>=s.index&&t.line<s.index+s.amount&&t.dispose(),t.line>s.index&&(t.line-=s.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},Yj=class extends Ue{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new me),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new Qw(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Qw(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},Kk=2,Yk=1,c_=class extends Ue{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new me),this.onResize=this._onResize.event,this._onScroll=this._register(new me),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,Kk),this.rows=Math.max(e.rawOptions.rows||0,Yk),this.buffers=this._register(new Yj(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let s=this.cols!==e,i=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:s,rowsChanged:i})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let s=this.buffer,i;i=this._cachedBlankLine,(!i||i.length!==this.cols||i.getFg(0)!==e.fg||i.getBg(0)!==e.bg)&&(i=s.getBlankLine(e,t),this._cachedBlankLine=i),i.isWrapped=t;let a=s.ybase+s.scrollTop,o=s.ybase+s.scrollBottom;if(s.scrollTop===0){let c=s.lines.isFull;o===s.lines.length-1?c?s.lines.recycle().copyFrom(i):s.lines.push(i.clone()):s.lines.splice(o+1,0,i.clone()),c?this.isUserScrolling&&(s.ydisp=Math.max(s.ydisp-1,0)):(s.ybase++,this.isUserScrolling||s.ydisp++)}else{let c=o-a+1;s.lines.shiftElements(a+1,c-1,-1),s.lines.set(o,i.clone())}this.isUserScrolling||(s.ydisp=s.ybase),this._onScroll.fire(s.ydisp)}scrollLines(e,t){let s=this.buffer;if(e<0){if(s.ydisp===0)return;this.isUserScrolling=!0}else e+s.ydisp>=s.ybase&&(this.isUserScrolling=!1);let i=s.ydisp;s.ydisp=Math.max(Math.min(s.ydisp+e,s.ybase),0),i!==s.ydisp&&(t||this._onScroll.fire(s.ydisp))}};c_=kt([be(0,Ss)],c_);var go={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:sd,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},Xj=["normal","bold","100","200","300","400","500","600","700","800","900"],Qj=class extends Ue{constructor(e){super(),this._onOptionChange=this._register(new me),this.onOptionChange=this._onOptionChange.event;let t={...go};for(let s in e)if(s in t)try{let i=e[s];t[s]=this._sanitizeAndValidateOption(s,i)}catch(i){console.error(i)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(_t(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(s=>{s===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(s=>{e.indexOf(s)!==-1&&t()})}_setupOptions(){let e=s=>{if(!(s in go))throw new Error(`No option with key "${s}"`);return this.rawOptions[s]},t=(s,i)=>{if(!(s in go))throw new Error(`No option with key "${s}"`);i=this._sanitizeAndValidateOption(s,i),this.rawOptions[s]!==i&&(this.rawOptions[s]=i,this._onOptionChange.fire(s))};for(let s in this.rawOptions){let i={get:e.bind(this,s),set:t.bind(this,s)};Object.defineProperty(this.options,s,i)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=go[e]),!Zj(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=go[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=Xj.includes(t)?t:go[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function Zj(e){return e==="block"||e==="underline"||e==="bar"}function rc(e,t=5){if(typeof e!="object")return e;let s=Array.isArray(e)?[]:{};for(let i in e)s[i]=t<=1?e[i]:e[i]&&rc(e[i],t-1);return s}var Zw=Object.freeze({insertMode:!1}),Jw=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),u_=class extends Ue{constructor(t,s,i){super(),this._bufferService=t,this._logService=s,this._optionsService=i,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new me),this.onData=this._onData.event,this._onUserInput=this._register(new me),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new me),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new me),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=rc(Zw),this.decPrivateModes=rc(Jw)}reset(){this.modes=rc(Zw),this.decPrivateModes=rc(Jw)}triggerDataEvent(t,s=!1){if(this._optionsService.rawOptions.disableStdin)return;let i=this._bufferService.buffer;s&&this._optionsService.rawOptions.scrollOnUserInput&&i.ybase!==i.ydisp&&this._onRequestScrollToBottom.fire(),s&&this._onUserInput.fire(),this._logService.debug(`sending data "${t}"`),this._logService.trace("sending data (codes)",()=>t.split("").map(a=>a.charCodeAt(0))),this._onData.fire(t)}triggerBinaryEvent(t){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${t}"`),this._logService.trace("sending binary (codes)",()=>t.split("").map(s=>s.charCodeAt(0))),this._onBinary.fire(t))}};u_=kt([be(0,bs),be(1,mk),be(2,Ss)],u_);var e1={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function Nm(e,t){let s=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(s|=64,s|=e.action):(s|=e.button&3,e.button&4&&(s|=64),e.button&8&&(s|=128),e.action===32?s|=32:e.action===0&&!t&&(s|=3)),s}var Am=String.fromCharCode,t1={DEFAULT:e=>{let t=[Nm(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Am(t[0])}${Am(t[1])}${Am(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Nm(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Nm(e,!0)};${e.x};${e.y}${t}`}},h_=class extends Ue{constructor(e,t,s){super(),this._bufferService=e,this._coreService=t,this._optionsService=s,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new me),this.onProtocolChange=this._onProtocolChange.event;for(let i of Object.keys(e1))this.addProtocol(i,e1[i]);for(let i of Object.keys(t1))this.addEncoding(i,t1[i]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,s){if(e.deltaY===0||e.shiftKey||t===void 0||s===void 0)return 0;let i=t/s,a=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(a/=i+0,Math.abs(e.deltaY)<50&&(a*=.3),this._wheelPartialScroll+=a,a=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(a*=this._bufferService.rows),a}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,s){if(s){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};h_=kt([be(0,bs),be(1,Ca),be(2,Ss)],h_);var Rm=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],Jj=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],zt;function eP(e,t){let s=0,i=t.length-1,a;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=s;)if(a=s+i>>1,e>t[a][1])s=a+1;else if(e<t[a][0])i=a-1;else return!0;return!1}var tP=class{constructor(){if(this.version="6",!zt){zt=new Uint8Array(65536),zt.fill(1),zt[0]=0,zt.fill(0,1,32),zt.fill(0,127,160),zt.fill(2,4352,4448),zt[9001]=2,zt[9002]=2,zt.fill(2,11904,42192),zt[12351]=1,zt.fill(2,44032,55204),zt.fill(2,63744,64256),zt.fill(2,65040,65050),zt.fill(2,65072,65136),zt.fill(2,65280,65377),zt.fill(2,65504,65511);for(let e=0;e<Rm.length;++e)zt.fill(0,Rm[e][0],Rm[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?zt[e]:eP(e,Jj)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let s=this.wcwidth(e),i=s===0&&t!==0;if(i){let a=sa.extractWidth(t);a===0?i=!1:a>s&&(s=a)}return sa.createPropertyValue(0,s,i)}},sa=class Uh{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new me,this.onChange=this._onChange.event;let t=new tP;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,s,i=!1){return(t&16777215)<<3|(s&3)<<1|(i?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let s=0,i=0,a=t.length;for(let o=0;o<a;++o){let c=t.charCodeAt(o);if(55296<=c&&c<=56319){if(++o>=a)return s+this.wcwidth(c);let h=t.charCodeAt(o);56320<=h&&h<=57343?c=(c-55296)*1024+h-56320+65536:s+=this.wcwidth(h)}let d=this.charProperties(c,i),f=Uh.extractWidth(d);Uh.extractShouldJoin(d)&&(f-=Uh.extractWidth(i)),s+=f,i=d}return s}charProperties(t,s){return this._activeProvider.charProperties(t,s)}},sP=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function s1(e){var i;let t=(i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:i.get(e.cols-1),s=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);s&&t&&(s.isWrapped=t[3]!==0&&t[3]!==32)}var ql=2147483647,iP=256,Xk=class d_{constructor(t=32,s=32){if(this.maxLength=t,this.maxSubParamsLength=s,s>iP)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(s),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let s=new d_;if(!t.length)return s;for(let i=Array.isArray(t[0])?1:0;i<t.length;++i){let a=t[i];if(Array.isArray(a))for(let o=0;o<a.length;++o)s.addSubParam(a[o]);else s.addParam(a)}return s}clone(){let t=new d_(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let s=0;s<this.length;++s){t.push(this.params[s]);let i=this._subParamsIdx[s]>>8,a=this._subParamsIdx[s]&255;a-i>0&&t.push(Array.prototype.slice.call(this._subParams,i,a))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>ql?ql:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>ql?ql:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let s=this._subParamsIdx[t]>>8,i=this._subParamsIdx[t]&255;return i-s>0?this._subParams.subarray(s,i):null}getSubParamsAll(){let t={};for(let s=0;s<this.length;++s){let i=this._subParamsIdx[s]>>8,a=this._subParamsIdx[s]&255;a-i>0&&(t[s]=this._subParams.slice(i,a))}return t}addDigit(t){let s;if(this._rejectDigits||!(s=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let i=this._digitIsSub?this._subParams:this.params,a=i[s-1];i[s-1]=~a?Math.min(a*10+t,ql):t}},Kl=[],nP=class{constructor(){this._state=0,this._active=Kl,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let s=this._handlers[e];return s.push(t),{dispose:()=>{let i=s.indexOf(t);i!==-1&&s.splice(i,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Kl}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=Kl,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Kl,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,s){if(!this._active.length)this._handlerFb(this._id,"PUT",Cd(e,t,s));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,s)}start(){this.reset(),this._state=1}put(e,t,s){if(this._state!==3){if(this._state===1)for(;t<s;){let i=e[t++];if(i===59){this._state=2,this._start();break}if(i<48||57<i){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+i-48}this._state===2&&s-t>0&&this._put(e,t,s)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let s=!1,i=this._active.length-1,a=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,s=t,a=this._stack.fallThrough,this._stack.paused=!1),!a&&s===!1){for(;i>=0&&(s=this._active[i].end(e),s!==!0);i--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,s;i--}for(;i>=0;i--)if(s=this._active[i].end(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,s}this._active=Kl,this._id=-1,this._state=0}}},$s=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,s){this._hitLimit||(this._data+=Cd(e,t,s),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(s=>(this._data="",this._hitLimit=!1,s));return this._data="",this._hitLimit=!1,t}},Yl=[],rP=class{constructor(){this._handlers=Object.create(null),this._active=Yl,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Yl}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let s=this._handlers[e];return s.push(t),{dispose:()=>{let i=s.indexOf(t);i!==-1&&s.splice(i,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=Yl,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Yl,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let s=this._active.length-1;s>=0;s--)this._active[s].hook(t)}put(e,t,s){if(!this._active.length)this._handlerFb(this._ident,"PUT",Cd(e,t,s));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,s)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let s=!1,i=this._active.length-1,a=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,s=t,a=this._stack.fallThrough,this._stack.paused=!1),!a&&s===!1){for(;i>=0&&(s=this._active[i].unhook(e),s!==!0);i--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,s;i--}for(;i>=0;i--)if(s=this._active[i].unhook(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,s}this._active=Yl,this._ident=0}},ac=new Xk;ac.addParam(0);var i1=class{constructor(e){this._handler=e,this._data="",this._params=ac,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():ac,this._data="",this._hitLimit=!1}put(e,t,s){this._hitLimit||(this._data+=Cd(e,t,s),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(s=>(this._params=ac,this._data="",this._hitLimit=!1,s));return this._params=ac,this._data="",this._hitLimit=!1,t}},aP=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,s,i){this.table[t<<8|e]=s<<4|i}addMany(e,t,s,i){for(let a=0;a<e.length;a++)this.table[t<<8|e[a]]=s<<4|i}},hi=160,oP=(function(){let e=new aP(4095),t=Array.apply(null,Array(256)).map((d,f)=>f),s=(d,f)=>t.slice(d,f),i=s(32,127),a=s(0,24);a.push(25),a.push.apply(a,s(28,32));let o=s(0,14),c;e.setDefault(1,0),e.addMany(i,0,2,0);for(c in o)e.addMany([24,26,153,154],c,3,0),e.addMany(s(128,144),c,3,0),e.addMany(s(144,152),c,3,0),e.add(156,c,0,0),e.add(27,c,11,1),e.add(157,c,4,8),e.addMany([152,158,159],c,0,7),e.add(155,c,11,3),e.add(144,c,11,9);return e.addMany(a,0,3,0),e.addMany(a,1,3,1),e.add(127,1,0,1),e.addMany(a,8,0,8),e.addMany(a,3,3,3),e.add(127,3,0,3),e.addMany(a,4,3,4),e.add(127,4,0,4),e.addMany(a,6,3,6),e.addMany(a,5,3,5),e.add(127,5,0,5),e.addMany(a,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(i,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(s(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(i,7,0,7),e.addMany(a,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(s(64,127),3,7,0),e.addMany(s(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(s(48,60),4,8,4),e.addMany(s(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(s(32,64),6,0,6),e.add(127,6,0,6),e.addMany(s(64,127),6,0,0),e.addMany(s(32,48),3,9,5),e.addMany(s(32,48),5,9,5),e.addMany(s(48,64),5,0,6),e.addMany(s(64,127),5,7,0),e.addMany(s(32,48),4,9,5),e.addMany(s(32,48),1,9,2),e.addMany(s(32,48),2,9,2),e.addMany(s(48,127),2,10,0),e.addMany(s(48,80),1,10,0),e.addMany(s(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(s(96,127),1,10,0),e.add(80,1,11,9),e.addMany(a,9,0,9),e.add(127,9,0,9),e.addMany(s(28,32),9,0,9),e.addMany(s(32,48),9,9,12),e.addMany(s(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(a,11,0,11),e.addMany(s(32,128),11,0,11),e.addMany(s(28,32),11,0,11),e.addMany(a,10,0,10),e.add(127,10,0,10),e.addMany(s(28,32),10,0,10),e.addMany(s(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(s(32,48),10,9,12),e.addMany(a,12,0,12),e.add(127,12,0,12),e.addMany(s(28,32),12,0,12),e.addMany(s(32,48),12,9,12),e.addMany(s(48,64),12,0,11),e.addMany(s(64,127),12,12,13),e.addMany(s(64,127),10,12,13),e.addMany(s(64,127),9,12,13),e.addMany(a,13,13,13),e.addMany(i,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(hi,0,2,0),e.add(hi,8,5,8),e.add(hi,6,0,6),e.add(hi,11,0,11),e.add(hi,13,13,13),e})(),lP=class extends Ue{constructor(e=oP){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new Xk,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,s,i)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,s)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(_t(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new nP),this._dcsParser=this._register(new rP),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let s=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(s=e.prefix.charCodeAt(0),s&&60>s||s>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let a=0;a<e.intermediates.length;++a){let o=e.intermediates.charCodeAt(a);if(32>o||o>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");s<<=8,s|=o}}if(e.final.length!==1)throw new Error("final must be a single byte");let i=e.final.charCodeAt(0);if(t[0]>i||i>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return s<<=8,s|=i,s}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let s=this._identifier(e,[48,126]);this._escHandlers[s]===void 0&&(this._escHandlers[s]=[]);let i=this._escHandlers[s];return i.push(t),{dispose:()=>{let a=i.indexOf(t);a!==-1&&i.splice(a,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let s=this._identifier(e);this._csiHandlers[s]===void 0&&(this._csiHandlers[s]=[]);let i=this._csiHandlers[s];return i.push(t),{dispose:()=>{let a=i.indexOf(t);a!==-1&&i.splice(a,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,s,i,a){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=s,this._parseStack.transition=i,this._parseStack.chunkPos=a}parse(e,t,s){let i=0,a=0,o=0,c;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(s===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let d=this._parseStack.handlers,f=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(s===!1&&f>-1){for(;f>=0&&(c=d[f](this._params),c!==!0);f--)if(c instanceof Promise)return this._parseStack.handlerPos=f,c}this._parseStack.handlers=[];break;case 4:if(s===!1&&f>-1){for(;f>=0&&(c=d[f](),c!==!0);f--)if(c instanceof Promise)return this._parseStack.handlerPos=f,c}this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],c=this._dcsParser.unhook(i!==24&&i!==26,s),c)return c;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(i=e[this._parseStack.chunkPos],c=this._oscParser.end(i!==24&&i!==26,s),c)return c;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let d=o;d<t;++d){switch(i=e[d],a=this._transitions.table[this.currentState<<8|(i<160?i:hi)],a>>4){case 2:for(let y=d+1;;++y){if(y>=t||(i=e[y])<32||i>126&&i<hi){this._printHandler(e,d,y),d=y-1;break}if(++y>=t||(i=e[y])<32||i>126&&i<hi){this._printHandler(e,d,y),d=y-1;break}if(++y>=t||(i=e[y])<32||i>126&&i<hi){this._printHandler(e,d,y),d=y-1;break}if(++y>=t||(i=e[y])<32||i>126&&i<hi){this._printHandler(e,d,y),d=y-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:d,code:i,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let f=this._csiHandlers[this._collect<<8|i],h=f?f.length-1:-1;for(;h>=0&&(c=f[h](this._params),c!==!0);h--)if(c instanceof Promise)return this._preserveStack(3,f,h,a,d),c;h<0&&this._csiHandlerFb(this._collect<<8|i,this._params),this.precedingJoinState=0;break;case 8:do switch(i){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(i-48)}while(++d<t&&(i=e[d])>47&&i<60);d--;break;case 9:this._collect<<=8,this._collect|=i;break;case 10:let g=this._escHandlers[this._collect<<8|i],_=g?g.length-1:-1;for(;_>=0&&(c=g[_](),c!==!0);_--)if(c instanceof Promise)return this._preserveStack(4,g,_,a,d),c;_<0&&this._escHandlerFb(this._collect<<8|i),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|i,this._params);break;case 13:for(let y=d+1;;++y)if(y>=t||(i=e[y])===24||i===26||i===27||i>127&&i<hi){this._dcsParser.put(e,d,y),d=y-1;break}break;case 14:if(c=this._dcsParser.unhook(i!==24&&i!==26),c)return this._preserveStack(6,[],0,a,d),c;i===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let y=d+1;;y++)if(y>=t||(i=e[y])<32||i>127&&i<hi){this._oscParser.put(e,d,y),d=y-1;break}break;case 6:if(c=this._oscParser.end(i!==24&&i!==26),c)return this._preserveStack(5,[],0,a,d),c;i===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=a&15}}},cP=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,uP=/^[\da-f]+$/;function n1(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let s=cP.exec(t);if(s){let i=s[1]?15:s[4]?255:s[7]?4095:65535;return[Math.round(parseInt(s[1]||s[4]||s[7]||s[10],16)/i*255),Math.round(parseInt(s[2]||s[5]||s[8]||s[11],16)/i*255),Math.round(parseInt(s[3]||s[6]||s[9]||s[12],16)/i*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),uP.exec(t)&&[3,6,9,12].includes(t.length))){let s=t.length/3,i=[0,0,0];for(let a=0;a<3;++a){let o=parseInt(t.slice(s*a,s*a+s),16);i[a]=s===1?o<<4:s===2?o:s===3?o>>4:o>>8}return i}}function Dm(e,t){let s=e.toString(16),i=s.length<2?"0"+s:s;switch(t){case 4:return s[0];case 8:return i;case 12:return(i+i).slice(0,3);default:return i+i}}function hP(e,t=16){let[s,i,a]=e;return`rgb:${Dm(s,t)}/${Dm(i,t)}/${Dm(a,t)}`}var dP={"(":0,")":1,"*":2,"+":3,"-":1,".":2},ir=131072,r1=10;function a1(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var o1=5e3,l1=0,fP=class extends Ue{constructor(e,t,s,i,a,o,c,d,f=new lP){super(),this._bufferService=e,this._charsetService=t,this._coreService=s,this._logService=i,this._optionsService=a,this._oscLinkService=o,this._coreMouseService=c,this._unicodeService=d,this._parser=f,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new LM,this._utf8Decoder=new MM,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=jt.clone(),this._eraseAttrDataInternal=jt.clone(),this._onRequestBell=this._register(new me),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new me),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new me),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new me),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new me),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new me),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new me),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new me),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new me),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new me),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new me),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new me),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new me),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new f_(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(h=>this._activeBuffer=h.activeBuffer)),this._parser.setCsiHandlerFallback((h,g)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(h),params:g.toArray()})}),this._parser.setEscHandlerFallback(h=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(h)})}),this._parser.setExecuteHandlerFallback(h=>{this._logService.debug("Unknown EXECUTE code: ",{code:h})}),this._parser.setOscHandlerFallback((h,g,_)=>{this._logService.debug("Unknown OSC code: ",{identifier:h,action:g,data:_})}),this._parser.setDcsHandlerFallback((h,g,_)=>{g==="HOOK"&&(_=_.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(h),action:g,payload:_})}),this._parser.setPrintHandler((h,g,_)=>this.print(h,g,_)),this._parser.registerCsiHandler({final:"@"},h=>this.insertChars(h)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},h=>this.scrollLeft(h)),this._parser.registerCsiHandler({final:"A"},h=>this.cursorUp(h)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},h=>this.scrollRight(h)),this._parser.registerCsiHandler({final:"B"},h=>this.cursorDown(h)),this._parser.registerCsiHandler({final:"C"},h=>this.cursorForward(h)),this._parser.registerCsiHandler({final:"D"},h=>this.cursorBackward(h)),this._parser.registerCsiHandler({final:"E"},h=>this.cursorNextLine(h)),this._parser.registerCsiHandler({final:"F"},h=>this.cursorPrecedingLine(h)),this._parser.registerCsiHandler({final:"G"},h=>this.cursorCharAbsolute(h)),this._parser.registerCsiHandler({final:"H"},h=>this.cursorPosition(h)),this._parser.registerCsiHandler({final:"I"},h=>this.cursorForwardTab(h)),this._parser.registerCsiHandler({final:"J"},h=>this.eraseInDisplay(h,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},h=>this.eraseInDisplay(h,!0)),this._parser.registerCsiHandler({final:"K"},h=>this.eraseInLine(h,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},h=>this.eraseInLine(h,!0)),this._parser.registerCsiHandler({final:"L"},h=>this.insertLines(h)),this._parser.registerCsiHandler({final:"M"},h=>this.deleteLines(h)),this._parser.registerCsiHandler({final:"P"},h=>this.deleteChars(h)),this._parser.registerCsiHandler({final:"S"},h=>this.scrollUp(h)),this._parser.registerCsiHandler({final:"T"},h=>this.scrollDown(h)),this._parser.registerCsiHandler({final:"X"},h=>this.eraseChars(h)),this._parser.registerCsiHandler({final:"Z"},h=>this.cursorBackwardTab(h)),this._parser.registerCsiHandler({final:"`"},h=>this.charPosAbsolute(h)),this._parser.registerCsiHandler({final:"a"},h=>this.hPositionRelative(h)),this._parser.registerCsiHandler({final:"b"},h=>this.repeatPrecedingCharacter(h)),this._parser.registerCsiHandler({final:"c"},h=>this.sendDeviceAttributesPrimary(h)),this._parser.registerCsiHandler({prefix:">",final:"c"},h=>this.sendDeviceAttributesSecondary(h)),this._parser.registerCsiHandler({final:"d"},h=>this.linePosAbsolute(h)),this._parser.registerCsiHandler({final:"e"},h=>this.vPositionRelative(h)),this._parser.registerCsiHandler({final:"f"},h=>this.hVPosition(h)),this._parser.registerCsiHandler({final:"g"},h=>this.tabClear(h)),this._parser.registerCsiHandler({final:"h"},h=>this.setMode(h)),this._parser.registerCsiHandler({prefix:"?",final:"h"},h=>this.setModePrivate(h)),this._parser.registerCsiHandler({final:"l"},h=>this.resetMode(h)),this._parser.registerCsiHandler({prefix:"?",final:"l"},h=>this.resetModePrivate(h)),this._parser.registerCsiHandler({final:"m"},h=>this.charAttributes(h)),this._parser.registerCsiHandler({final:"n"},h=>this.deviceStatus(h)),this._parser.registerCsiHandler({prefix:"?",final:"n"},h=>this.deviceStatusPrivate(h)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},h=>this.softReset(h)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},h=>this.setCursorStyle(h)),this._parser.registerCsiHandler({final:"r"},h=>this.setScrollRegion(h)),this._parser.registerCsiHandler({final:"s"},h=>this.saveCursor(h)),this._parser.registerCsiHandler({final:"t"},h=>this.windowOptions(h)),this._parser.registerCsiHandler({final:"u"},h=>this.restoreCursor(h)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},h=>this.insertColumns(h)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},h=>this.deleteColumns(h)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},h=>this.selectProtected(h)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},h=>this.requestMode(h,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},h=>this.requestMode(h,!1)),this._parser.setExecuteHandler(de.BEL,()=>this.bell()),this._parser.setExecuteHandler(de.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(de.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(de.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(de.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(de.BS,()=>this.backspace()),this._parser.setExecuteHandler(de.HT,()=>this.tab()),this._parser.setExecuteHandler(de.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(de.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(zh.IND,()=>this.index()),this._parser.setExecuteHandler(zh.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(zh.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new $s(h=>(this.setTitle(h),this.setIconName(h),!0))),this._parser.registerOscHandler(1,new $s(h=>this.setIconName(h))),this._parser.registerOscHandler(2,new $s(h=>this.setTitle(h))),this._parser.registerOscHandler(4,new $s(h=>this.setOrReportIndexedColor(h))),this._parser.registerOscHandler(8,new $s(h=>this.setHyperlink(h))),this._parser.registerOscHandler(10,new $s(h=>this.setOrReportFgColor(h))),this._parser.registerOscHandler(11,new $s(h=>this.setOrReportBgColor(h))),this._parser.registerOscHandler(12,new $s(h=>this.setOrReportCursorColor(h))),this._parser.registerOscHandler(104,new $s(h=>this.restoreIndexedColor(h))),this._parser.registerOscHandler(110,new $s(h=>this.restoreFgColor(h))),this._parser.registerOscHandler(111,new $s(h=>this.restoreBgColor(h))),this._parser.registerOscHandler(112,new $s(h=>this.restoreCursorColor(h))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let h in $t)this._parser.registerEscHandler({intermediates:"(",final:h},()=>this.selectCharset("("+h)),this._parser.registerEscHandler({intermediates:")",final:h},()=>this.selectCharset(")"+h)),this._parser.registerEscHandler({intermediates:"*",final:h},()=>this.selectCharset("*"+h)),this._parser.registerEscHandler({intermediates:"+",final:h},()=>this.selectCharset("+"+h)),this._parser.registerEscHandler({intermediates:"-",final:h},()=>this.selectCharset("-"+h)),this._parser.registerEscHandler({intermediates:".",final:h},()=>this.selectCharset("."+h)),this._parser.registerEscHandler({intermediates:"/",final:h},()=>this.selectCharset("/"+h));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(h=>(this._logService.error("Parsing error: ",h),h)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new i1((h,g)=>this.requestStatusString(h,g)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,s,i){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=s,this._parseStack.position=i}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,s)=>setTimeout(()=>s("#SLOW_TIMEOUT"),o1))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${o1} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let s,i=this._activeBuffer.x,a=this._activeBuffer.y,o=0,c=this._parseStack.paused;if(c){if(s=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(s),s;i=this._parseStack.cursorStartX,a=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>ir&&(o=this._parseStack.position+ir)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,h=>String.fromCharCode(h)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(h=>h.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<ir&&(this._parseBuffer=new Uint32Array(Math.min(e.length,ir))),c||this._dirtyRowTracker.clearRange(),e.length>ir)for(let h=o;h<e.length;h+=ir){let g=h+ir<e.length?h+ir:e.length,_=typeof e=="string"?this._stringDecoder.decode(e.substring(h,g),this._parseBuffer):this._utf8Decoder.decode(e.subarray(h,g),this._parseBuffer);if(s=this._parser.parse(this._parseBuffer,_))return this._preserveStack(i,a,_,h),this._logSlowResolvingAsync(s),s}else if(!c){let h=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(s=this._parser.parse(this._parseBuffer,h))return this._preserveStack(i,a,h,0),this._logSlowResolvingAsync(s),s}(this._activeBuffer.x!==i||this._activeBuffer.y!==a)&&this._onCursorMove.fire();let d=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),f=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);f<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(f,this._bufferService.rows-1),end:Math.min(d,this._bufferService.rows-1)})}print(e,t,s){let i,a,o=this._charsetService.charset,c=this._optionsService.rawOptions.screenReaderMode,d=this._bufferService.cols,f=this._coreService.decPrivateModes.wraparound,h=this._coreService.modes.insertMode,g=this._curAttrData,_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&s-t>0&&_.getWidth(this._activeBuffer.x-1)===2&&_.setCellFromCodepoint(this._activeBuffer.x-1,0,1,g);let y=this._parser.precedingJoinState;for(let b=t;b<s;++b){if(i=e[b],i<127&&o){let T=o[String.fromCharCode(i)];T&&(i=T.charCodeAt(0))}let S=this._unicodeService.charProperties(i,y);a=sa.extractWidth(S);let w=sa.extractShouldJoin(S),k=w?sa.extractWidth(y):0;if(y=S,c&&this._onA11yChar.fire(or(i)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+a-k>d){if(f){let T=_,D=this._activeBuffer.x-k;for(this._activeBuffer.x=k,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),k>0&&_ instanceof nc&&_.copyCellsFrom(T,D,0,k,!1);D<d;)T.setCellFromCodepoint(D++,0,1,g)}else if(this._activeBuffer.x=d-1,a===2)continue}if(w&&this._activeBuffer.x){let T=_.getWidth(this._activeBuffer.x-1)?1:2;_.addCodepointToCell(this._activeBuffer.x-T,i,a);for(let D=a-k;--D>=0;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,g);continue}if(h&&(_.insertCells(this._activeBuffer.x,a-k,this._activeBuffer.getNullCell(g)),_.getWidth(d-1)===2&&_.setCellFromCodepoint(d-1,0,1,g)),_.setCellFromCodepoint(this._activeBuffer.x++,i,a,g),a>0)for(;--a;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,g)}this._parser.precedingJoinState=y,this._activeBuffer.x<d&&s-t>0&&_.getWidth(this._activeBuffer.x)===0&&!_.hasContent(this._activeBuffer.x)&&_.setCellFromCodepoint(this._activeBuffer.x,0,1,g),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,s=>a1(s.params[0],this._optionsService.rawOptions.windowOptions)?t(s):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new i1(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new $s(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,s,i=!1,a=!1){let o=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);o.replaceCells(t,s,this._activeBuffer.getNullCell(this._eraseAttrData()),a),i&&(o.isWrapped=!1)}_resetBufferLine(e,t=!1){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s&&(s.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),s.isWrapped=!1)}eraseInDisplay(e,t=!1){var i;this._restrictCursor(this._bufferService.cols);let s;switch(e.params[0]){case 0:for(s=this._activeBuffer.y,this._dirtyRowTracker.markDirty(s),this._eraseInBufferLine(s++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);s<this._bufferService.rows;s++)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(s);break;case 1:for(s=this._activeBuffer.y,this._dirtyRowTracker.markDirty(s),this._eraseInBufferLine(s,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(s+1).isWrapped=!1);s--;)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(s=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,s-1);s--&&!((i=this._activeBuffer.lines.get(this._activeBuffer.ybase+s))!=null&&i.getTrimmedLength()););for(;s>=0;s--)this._bufferService.scroll(this._eraseAttrData())}else{for(s=this._bufferService.rows,this._dirtyRowTracker.markDirty(s-1);s--;)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let a=this._activeBuffer.lines.length-this._bufferService.rows;a>0&&(this._activeBuffer.lines.trimStart(a),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-a,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-a,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let s=this._activeBuffer.ybase+this._activeBuffer.y,i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,a=this._bufferService.rows-1+this._activeBuffer.ybase-i+1;for(;t--;)this._activeBuffer.lines.splice(a-1,1),this._activeBuffer.lines.splice(s,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let s=this._activeBuffer.ybase+this._activeBuffer.y,i;for(i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-i;t--;)this._activeBuffer.lines.splice(s,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(jt));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);i.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);i.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);i.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);i.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let s=e.params[0]||1,i=sa.extractWidth(t),a=this._activeBuffer.x-i,o=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(a),c=new Uint32Array(o.length*s),d=0;for(let h=0;h<o.length;){let g=o.codePointAt(h)||0;c[d++]=g,h+=g>65535?2:1}let f=d;for(let h=1;h<s;++h)c.copyWithin(f,0,d),f+=d;return this.print(c,0,f),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(de.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(de.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(de.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(de.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(de.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,Yr),this._charsetService.setgCharset(1,Yr),this._charsetService.setgCharset(2,Yr),this._charsetService.setgCharset(3,Yr);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){(w=>(w[w.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",w[w.SET=1]="SET",w[w.RESET=2]="RESET",w[w.PERMANENTLY_SET=3]="PERMANENTLY_SET",w[w.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(s={}));let i=this._coreService.decPrivateModes,{activeProtocol:a,activeEncoding:o}=this._coreMouseService,c=this._coreService,{buffers:d,cols:f}=this._bufferService,{active:h,alt:g}=d,_=this._optionsService.rawOptions,y=(w,k)=>(c.triggerDataEvent(`${de.ESC}[${t?"":"?"}${w};${k}$y`),!0),b=w=>w?1:2,S=e.params[0];return t?S===2?y(S,4):S===4?y(S,b(c.modes.insertMode)):S===12?y(S,3):S===20?y(S,b(_.convertEol)):y(S,0):S===1?y(S,b(i.applicationCursorKeys)):S===3?y(S,_.windowOptions.setWinLines?f===80?2:f===132?1:0:0):S===6?y(S,b(i.origin)):S===7?y(S,b(i.wraparound)):S===8?y(S,3):S===9?y(S,b(a==="X10")):S===12?y(S,b(_.cursorBlink)):S===25?y(S,b(!c.isCursorHidden)):S===45?y(S,b(i.reverseWraparound)):S===66?y(S,b(i.applicationKeypad)):S===67?y(S,4):S===1e3?y(S,b(a==="VT200")):S===1002?y(S,b(a==="DRAG")):S===1003?y(S,b(a==="ANY")):S===1004?y(S,b(i.sendFocus)):S===1005?y(S,4):S===1006?y(S,b(o==="SGR")):S===1015?y(S,4):S===1016?y(S,b(o==="SGR_PIXELS")):S===1048?y(S,1):S===47||S===1047||S===1049?y(S,b(h===g)):S===2004?y(S,b(i.bracketedPasteMode)):S===2026?y(S,b(i.synchronizedOutput)):y(S,0)}_updateAttrColor(e,t,s,i,a){return t===2?(e|=50331648,e&=-16777216,e|=Pc.fromColorRGB([s,i,a])):t===5&&(e&=-50331904,e|=33554432|s&255),e}_extractColor(e,t,s){let i=[0,0,-1,0,0,0],a=0,o=0;do{if(i[o+a]=e.params[t+o],e.hasSubParams(t+o)){let c=e.getSubParams(t+o),d=0;do i[1]===5&&(a=1),i[o+d+1+a]=c[d];while(++d<c.length&&d+o+1+a<i.length);break}if(i[1]===5&&o+a>=2||i[1]===2&&o+a>=5)break;i[1]&&(a=1)}while(++o+t<e.length&&o+a<i.length);for(let c=2;c<i.length;++c)i[c]===-1&&(i[c]=0);switch(i[0]){case 38:s.fg=this._updateAttrColor(s.fg,i[1],i[3],i[4],i[5]);break;case 48:s.bg=this._updateAttrColor(s.bg,i[1],i[3],i[4],i[5]);break;case 58:s.extended=s.extended.clone(),s.extended.underlineColor=this._updateAttrColor(s.extended.underlineColor,i[1],i[3],i[4],i[5])}return o}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=jt.fg,e.bg=jt.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,s,i=this._curAttrData;for(let a=0;a<t;a++)s=e.params[a],s>=30&&s<=37?(i.fg&=-50331904,i.fg|=16777216|s-30):s>=40&&s<=47?(i.bg&=-50331904,i.bg|=16777216|s-40):s>=90&&s<=97?(i.fg&=-50331904,i.fg|=16777216|s-90|8):s>=100&&s<=107?(i.bg&=-50331904,i.bg|=16777216|s-100|8):s===0?this._processSGR0(i):s===1?i.fg|=134217728:s===3?i.bg|=67108864:s===4?(i.fg|=268435456,this._processUnderline(e.hasSubParams(a)?e.getSubParams(a)[0]:1,i)):s===5?i.fg|=536870912:s===7?i.fg|=67108864:s===8?i.fg|=1073741824:s===9?i.fg|=2147483648:s===2?i.bg|=134217728:s===21?this._processUnderline(2,i):s===22?(i.fg&=-134217729,i.bg&=-134217729):s===23?i.bg&=-67108865:s===24?(i.fg&=-268435457,this._processUnderline(0,i)):s===25?i.fg&=-536870913:s===27?i.fg&=-67108865:s===28?i.fg&=-1073741825:s===29?i.fg&=2147483647:s===39?(i.fg&=-67108864,i.fg|=jt.fg&16777215):s===49?(i.bg&=-67108864,i.bg|=jt.bg&16777215):s===38||s===48||s===58?a+=this._extractColor(e,a,i):s===53?i.bg|=1073741824:s===55?i.bg&=-1073741825:s===59?(i.extended=i.extended.clone(),i.extended.underlineColor=-1,i.updateExtended()):s===100?(i.fg&=-67108864,i.fg|=jt.fg&16777215,i.bg&=-67108864,i.bg|=jt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",s);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${de.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,s=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${de.ESC}[${t};${s}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,s=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${de.ESC}[?${t};${s}R`);break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=jt.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let s=t%2===1;this._coreService.decPrivateModes.cursorBlink=s}return!0}setScrollRegion(e){let t=e.params[0]||1,s;return(e.length<2||(s=e.params[1])>this._bufferService.rows||s===0)&&(s=this._bufferService.rows),s>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=s-1,this._setCursor(0,0)),!0}windowOptions(e){if(!a1(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${de.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>r1&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>r1&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],s=e.split(";");for(;s.length>1;){let i=s.shift(),a=s.shift();if(/^\d+$/.exec(i)){let o=parseInt(i);if(c1(o))if(a==="?")t.push({type:0,index:o});else{let c=n1(a);c&&t.push({type:1,index:o,color:c})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let s=e.slice(0,t).trim(),i=e.slice(t+1);return i?this._createHyperlink(s,i):s.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let s=e.split(":"),i,a=s.findIndex(o=>o.startsWith("id="));return a!==-1&&(i=s[a].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:i,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let s=e.split(";");for(let i=0;i<s.length&&!(t>=this._specialColors.length);++i,++t)if(s[i]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let a=n1(s[i]);a&&this._onColor.fire([{type:1,index:this._specialColors[t],color:a}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],s=e.split(";");for(let i=0;i<s.length;++i)if(/^\d+$/.exec(s[i])){let a=parseInt(s[i]);c1(a)&&t.push({type:2,index:a})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,Yr),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(dP[e[0]],$t[e[1]]||Yr),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=jt.clone(),this._eraseAttrDataInternal=jt.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new gi;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let s=this._activeBuffer.ybase+this._activeBuffer.y+t,i=this._activeBuffer.lines.get(s);i&&(i.fill(e),i.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let s=c=>(this._coreService.triggerDataEvent(`${de.ESC}${c}${de.ESC}\\`),!0),i=this._bufferService.buffer,a=this._optionsService.rawOptions;return s(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${i.scrollTop+1};${i.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[a.cursorStyle]-(a.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},f_=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(l1=e,e=t,t=l1),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};f_=kt([be(0,bs)],f_);function c1(e){return 0<=e&&e<256}var pP=5e7,u1=12,mP=50,gP=class extends Ue{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new me),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let s;for(;s=this._writeBuffer.shift();){this._action(s);let i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>pP)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let s=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let i=this._writeBuffer[this._bufferOffset],a=this._action(i,t);if(a){let c=d=>performance.now()-s>=u1?setTimeout(()=>this._innerWrite(0,d)):this._innerWrite(s,d);a.catch(d=>(queueMicrotask(()=>{throw d}),Promise.resolve(!1))).then(c);return}let o=this._callbacks[this._bufferOffset];if(o&&o(),this._bufferOffset++,this._pendingData-=i.length,performance.now()-s>=u1)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>mP&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},p_=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let d=t.addMarker(t.ybase+t.y),f={data:e,id:this._nextId++,lines:[d]};return d.onDispose(()=>this._removeMarkerFromLink(f,d)),this._dataByLinkId.set(f.id,f),f.id}let s=e,i=this._getEntryIdKey(s),a=this._entriesWithId.get(i);if(a)return this.addLineToLink(a.id,t.ybase+t.y),a.id;let o=t.addMarker(t.ybase+t.y),c={id:this._nextId++,key:this._getEntryIdKey(s),data:s,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(c,o)),this._entriesWithId.set(c.key,c),this._dataByLinkId.set(c.id,c),c.id}addLineToLink(e,t){let s=this._dataByLinkId.get(e);if(s&&s.lines.every(i=>i.line!==t)){let i=this._bufferService.buffer.addMarker(t);s.lines.push(i),i.onDispose(()=>this._removeMarkerFromLink(s,i))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let s=e.lines.indexOf(t);s!==-1&&(e.lines.splice(s,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};p_=kt([be(0,bs)],p_);var h1=!1,_P=class extends Ue{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Io),this._onBinary=this._register(new me),this.onBinary=this._onBinary.event,this._onData=this._register(new me),this.onData=this._onData.event,this._onLineFeed=this._register(new me),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new me),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new me),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new me),this._instantiationService=new Uj,this.optionsService=this._register(new Qj(e)),this._instantiationService.setService(Ss,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(c_)),this._instantiationService.setService(bs,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(l_)),this._instantiationService.setService(mk,this._logService),this.coreService=this._register(this._instantiationService.createInstance(u_)),this._instantiationService.setService(Ca,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(h_)),this._instantiationService.setService(pk,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(sa)),this._instantiationService.setService(BM,this.unicodeService),this._charsetService=this._instantiationService.createInstance(sP),this._instantiationService.setService(PM,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(p_),this._instantiationService.setService(gk,this._oscLinkService),this._inputHandler=this._register(new fP(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(us.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(us.forward(this._bufferService.onResize,this._onResize)),this._register(us.forward(this.coreService.onData,this._onData)),this._register(us.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new gP((t,s)=>this._inputHandler.parse(t,s))),this._register(us.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new me),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!h1&&(this._logService.warn("writeSync is unreliable and will be removed soon."),h1=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,Kk),t=Math.max(t,Yk),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(s1.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(s1(this._bufferService),!1))),this._windowsWrappingHeuristics.value=_t(()=>{for(let t of e)t.dispose()})}}},vP={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function yP(e,t,s,i){var c;let a={type:0,cancel:!1,key:void 0},o=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?a.key=de.ESC+"OA":a.key=de.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?a.key=de.ESC+"OD":a.key=de.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?a.key=de.ESC+"OC":a.key=de.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?a.key=de.ESC+"OB":a.key=de.ESC+"[B");break;case 8:a.key=e.ctrlKey?"\b":de.DEL,e.altKey&&(a.key=de.ESC+a.key);break;case 9:if(e.shiftKey){a.key=de.ESC+"[Z";break}a.key=de.HT,a.cancel=!0;break;case 13:a.key=e.altKey?de.ESC+de.CR:de.CR,a.cancel=!0;break;case 27:a.key=de.ESC,e.altKey&&(a.key=de.ESC+de.ESC),a.cancel=!0;break;case 37:if(e.metaKey)break;o?a.key=de.ESC+"[1;"+(o+1)+"D":t?a.key=de.ESC+"OD":a.key=de.ESC+"[D";break;case 39:if(e.metaKey)break;o?a.key=de.ESC+"[1;"+(o+1)+"C":t?a.key=de.ESC+"OC":a.key=de.ESC+"[C";break;case 38:if(e.metaKey)break;o?a.key=de.ESC+"[1;"+(o+1)+"A":t?a.key=de.ESC+"OA":a.key=de.ESC+"[A";break;case 40:if(e.metaKey)break;o?a.key=de.ESC+"[1;"+(o+1)+"B":t?a.key=de.ESC+"OB":a.key=de.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(a.key=de.ESC+"[2~");break;case 46:o?a.key=de.ESC+"[3;"+(o+1)+"~":a.key=de.ESC+"[3~";break;case 36:o?a.key=de.ESC+"[1;"+(o+1)+"H":t?a.key=de.ESC+"OH":a.key=de.ESC+"[H";break;case 35:o?a.key=de.ESC+"[1;"+(o+1)+"F":t?a.key=de.ESC+"OF":a.key=de.ESC+"[F";break;case 33:e.shiftKey?a.type=2:e.ctrlKey?a.key=de.ESC+"[5;"+(o+1)+"~":a.key=de.ESC+"[5~";break;case 34:e.shiftKey?a.type=3:e.ctrlKey?a.key=de.ESC+"[6;"+(o+1)+"~":a.key=de.ESC+"[6~";break;case 112:o?a.key=de.ESC+"[1;"+(o+1)+"P":a.key=de.ESC+"OP";break;case 113:o?a.key=de.ESC+"[1;"+(o+1)+"Q":a.key=de.ESC+"OQ";break;case 114:o?a.key=de.ESC+"[1;"+(o+1)+"R":a.key=de.ESC+"OR";break;case 115:o?a.key=de.ESC+"[1;"+(o+1)+"S":a.key=de.ESC+"OS";break;case 116:o?a.key=de.ESC+"[15;"+(o+1)+"~":a.key=de.ESC+"[15~";break;case 117:o?a.key=de.ESC+"[17;"+(o+1)+"~":a.key=de.ESC+"[17~";break;case 118:o?a.key=de.ESC+"[18;"+(o+1)+"~":a.key=de.ESC+"[18~";break;case 119:o?a.key=de.ESC+"[19;"+(o+1)+"~":a.key=de.ESC+"[19~";break;case 120:o?a.key=de.ESC+"[20;"+(o+1)+"~":a.key=de.ESC+"[20~";break;case 121:o?a.key=de.ESC+"[21;"+(o+1)+"~":a.key=de.ESC+"[21~";break;case 122:o?a.key=de.ESC+"[23;"+(o+1)+"~":a.key=de.ESC+"[23~";break;case 123:o?a.key=de.ESC+"[24;"+(o+1)+"~":a.key=de.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?a.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?a.key=de.NUL:e.keyCode>=51&&e.keyCode<=55?a.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?a.key=de.DEL:e.keyCode===219?a.key=de.ESC:e.keyCode===220?a.key=de.FS:e.keyCode===221&&(a.key=de.GS);else if((!s||i)&&e.altKey&&!e.metaKey){let d=(c=vP[e.keyCode])==null?void 0:c[e.shiftKey?1:0];if(d)a.key=de.ESC+d;else if(e.keyCode>=65&&e.keyCode<=90){let f=e.ctrlKey?e.keyCode-64:e.keyCode+32,h=String.fromCharCode(f);e.shiftKey&&(h=h.toUpperCase()),a.key=de.ESC+h}else if(e.keyCode===32)a.key=de.ESC+(e.ctrlKey?de.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let f=e.code.slice(3,4);e.shiftKey||(f=f.toLowerCase()),a.key=de.ESC+f,a.cancel=!0}}else s&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(a.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?a.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(a.key=de.US),e.key==="@"&&(a.key=de.NUL));break}return a}var Nt=0,bP=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new id,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new id,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((a,o)=>this._getKey(a)-this._getKey(o)),t=0,s=0,i=new Array(this._array.length+this._insertedValues.length);for(let a=0;a<i.length;a++)s>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[s])?(i[a]=e[t],t++):i[a]=this._array[s++];this._array=i,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(Nt=this._search(t),Nt===-1)||this._getKey(this._array[Nt])!==t)return!1;do if(this._array[Nt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Nt),!0;while(++Nt<this._array.length&&this._getKey(this._array[Nt])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((a,o)=>a-o),t=0,s=new Array(this._array.length-e.length),i=0;for(let a=0;a<this._array.length;a++)e[t]===a?t++:s[i++]=this._array[a];this._array=s,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Nt=this._search(e),!(Nt<0||Nt>=this._array.length)&&this._getKey(this._array[Nt])===e))do yield this._array[Nt];while(++Nt<this._array.length&&this._getKey(this._array[Nt])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Nt=this._search(e),!(Nt<0||Nt>=this._array.length)&&this._getKey(this._array[Nt])===e))do t(this._array[Nt]);while(++Nt<this._array.length&&this._getKey(this._array[Nt])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,s=this._array.length-1;for(;s>=t;){let i=t+s>>1,a=this._getKey(this._array[i]);if(a>e)s=i-1;else if(a<e)t=i+1;else{for(;i>0&&this._getKey(this._array[i-1])===e;)i--;return i}}return t}},Lm=0,d1=0,SP=class extends Ue{constructor(){super(),this._decorations=new bP(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new me),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new me),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(_t(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new wP(e);if(t){let s=t.marker.onDispose(()=>t.dispose()),i=t.onDispose(()=>{i.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),s.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,s){let i=0,a=0;for(let o of this._decorations.getKeyIterator(t))i=o.options.x??0,a=i+(o.options.width??1),e>=i&&e<a&&(!s||(o.options.layer??"bottom")===s)&&(yield o)}forEachDecorationAtCell(e,t,s,i){this._decorations.forEachByKey(t,a=>{Lm=a.options.x??0,d1=Lm+(a.options.width??1),e>=Lm&&e<d1&&(!s||(a.options.layer??"bottom")===s)&&i(a)})}},wP=class extends wr{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new me),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new me),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=yt.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=yt.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},CP=1e3,xP=class{constructor(e,t=CP){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,s){this._rowCount=s,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let i=performance.now();if(i-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=i,this._innerRefresh();else if(!this._additionalRefreshRequested){let a=i-this._lastRefreshMs,o=this._debounceThresholdMS-a;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},o)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},f1=20,nd=class extends Ue{constructor(e,t,s,i){super(),this._terminal=e,this._coreBrowserService=s,this._renderService=i,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let a=this._coreBrowserService.mainDocument;this._accessibilityContainer=a.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=a.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let o=0;o<this._terminal.rows;o++)this._rowElements[o]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[o]);if(this._topBoundaryFocusListener=o=>this._handleBoundaryFocus(o,0),this._bottomBoundaryFocusListener=o=>this._handleBoundaryFocus(o,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=a.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new xP(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(o=>this._handleResize(o.rows))),this._register(this._terminal.onRender(o=>this._refreshRows(o.start,o.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(o=>this._handleChar(o))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
86
|
+
`))),this._register(this._terminal.onA11yTab(o=>this._handleTab(o))),this._register(this._terminal.onKey(o=>this._handleKey(o.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Le(a,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(_t(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<f1+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
87
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===f1+1&&(this._liveRegion.textContent+=Og.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let s=this._terminal.buffer,i=s.lines.length.toString();for(let a=e;a<=t;a++){let o=s.lines.get(s.ydisp+a),c=[],d=(o==null?void 0:o.translateToString(!0,void 0,void 0,c))||"",f=(s.ydisp+a+1).toString(),h=this._rowElements[a];h&&(d.length===0?(h.textContent=" ",this._rowColumns.set(h,[0,1])):(h.textContent=d,this._rowColumns.set(h,c)),h.setAttribute("aria-posinset",f),h.setAttribute("aria-setsize",i),this._alignRowWidth(h))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let s=e.target,i=this._rowElements[t===0?1:this._rowElements.length-2],a=s.getAttribute("aria-posinset"),o=t===0?"1":`${this._terminal.buffer.lines.length}`;if(a===o||e.relatedTarget!==i)return;let c,d;if(t===0?(c=s,d=this._rowElements.pop(),this._rowContainer.removeChild(d)):(c=this._rowElements.shift(),d=s,this._rowContainer.removeChild(c)),c.removeEventListener("focus",this._topBoundaryFocusListener),d.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let f=this._createAccessibilityTreeNode();this._rowElements.unshift(f),this._rowContainer.insertAdjacentElement("afterbegin",f)}else{let f=this._createAccessibilityTreeNode();this._rowElements.push(f),this._rowContainer.appendChild(f)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var d;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},s={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(s.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===s.node&&t.offset>s.offset)&&([t,s]=[s,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let i=this._rowElements.slice(-1)[0];if(s.node.compareDocumentPosition(i)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(s={node:i,offset:((d=i.textContent)==null?void 0:d.length)??0}),!this._rowContainer.contains(s.node))return;let a=({node:f,offset:h})=>{let g=f instanceof Text?f.parentNode:f,_=parseInt(g==null?void 0:g.getAttribute("aria-posinset"),10)-1;if(isNaN(_))return console.warn("row is invalid. Race condition?"),null;let y=this._rowColumns.get(g);if(!y)return console.warn("columns is null. Race condition?"),null;let b=h<y.length?y[h]:y.slice(-1)[0]+1;return b>=this._terminal.cols&&(++_,b=0),{row:_,column:b}},o=a(t),c=a(s);if(!(!o||!c)){if(o.row>c.row||o.row===c.row&&o.column>=c.column)throw new Error("invalid range");this._terminal.select(o.column,o.row,(c.row-o.row)*this._terminal.cols-o.column+c.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var a,o;e.style.transform="";let t=e.getBoundingClientRect().width,s=(o=(a=this._rowColumns.get(e))==null?void 0:a.slice(-1))==null?void 0:o[0];if(!s)return;let i=s*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${i/t})`}};nd=kt([be(1,tv),be(2,Tn),be(3,Nn)],nd);var m_=class extends Ue{constructor(e,t,s,i,a){super(),this._element=e,this._mouseService=t,this._renderService=s,this._bufferService=i,this._linkProviderService=a,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new me),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new me),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(_t(()=>{var o;ya(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(o=this._activeProviderReplies)==null||o.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Le(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Le(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Le(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Le(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let s=e.composedPath();for(let i=0;i<s.length;i++){let a=s[i];if(a.classList.contains("xterm"))break;if(a.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var i,a;(!this._activeProviderReplies||!t)&&((i=this._activeProviderReplies)==null||i.forEach(o=>{o==null||o.forEach(c=>{c.link.dispose&&c.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let s=!1;for(let[o,c]of this._linkProviderService.linkProviders.entries())t?(a=this._activeProviderReplies)!=null&&a.get(o)&&(s=this._checkLinkProviderResult(o,e,s)):c.provideLinks(e.y,d=>{var h,g;if(this._isMouseOut)return;let f=d==null?void 0:d.map(_=>({link:_}));(h=this._activeProviderReplies)==null||h.set(o,f),s=this._checkLinkProviderResult(o,e,s),((g=this._activeProviderReplies)==null?void 0:g.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let s=new Set;for(let i=0;i<t.size;i++){let a=t.get(i);if(a)for(let o=0;o<a.length;o++){let c=a[o],d=c.link.range.start.y<e?0:c.link.range.start.x,f=c.link.range.end.y>e?this._bufferService.cols:c.link.range.end.x;for(let h=d;h<=f;h++){if(s.has(h)){a.splice(o--,1);break}s.add(h)}}}}_checkLinkProviderResult(e,t,s){var o;if(!this._activeProviderReplies)return s;let i=this._activeProviderReplies.get(e),a=!1;for(let c=0;c<e;c++)(!this._activeProviderReplies.has(c)||this._activeProviderReplies.get(c))&&(a=!0);if(!a&&i){let c=i.find(d=>this._linkAtPosition(d.link,t));c&&(s=!0,this._handleNewLink(c))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!s)for(let c=0;c<this._activeProviderReplies.size;c++){let d=(o=this._activeProviderReplies.get(c))==null?void 0:o.find(f=>this._linkAtPosition(f.link,t));if(d){s=!0,this._handleNewLink(d);break}}return s}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&kP(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,ya(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var s,i;return(i=(s=this._currentLink)==null?void 0:s.state)==null?void 0:i.decorations.pointerCursor},set:s=>{var i;(i=this._currentLink)!=null&&i.state&&this._currentLink.state.decorations.pointerCursor!==s&&(this._currentLink.state.decorations.pointerCursor=s,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",s))}},underline:{get:()=>{var s,i;return(i=(s=this._currentLink)==null?void 0:s.state)==null?void 0:i.decorations.underline},set:s=>{var i,a,o;(i=this._currentLink)!=null&&i.state&&((o=(a=this._currentLink)==null?void 0:a.state)==null?void 0:o.decorations.underline)!==s&&(this._currentLink.state.decorations.underline=s,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,s))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(s=>{if(!this._currentLink)return;let i=s.start===0?0:s.start+1+this._bufferService.buffer.ydisp,a=this._bufferService.buffer.ydisp+1+s.end;if(this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=a&&(this._clearCurrentLink(i,a),this._lastMouseEvent)){let o=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);o&&this._askForLink(o,!1)}})))}_linkHover(e,t,s){var i;(i=this._currentLink)!=null&&i.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(s,t.text)}_fireUnderlineEvent(e,t){let s=e.range,i=this._bufferService.buffer.ydisp,a=this._createLinkUnderlineEvent(s.start.x-1,s.start.y-i-1,s.end.x,s.end.y-i-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(a)}_linkLeave(e,t,s){var i;(i=this._currentLink)!=null&&i.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(s,t.text)}_linkAtPosition(e,t){let s=e.range.start.y*this._bufferService.cols+e.range.start.x,i=e.range.end.y*this._bufferService.cols+e.range.end.x,a=t.y*this._bufferService.cols+t.x;return s<=a&&a<=i}_positionFromMouseEvent(e,t,s){let i=s.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(i)return{x:i[0],y:i[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,s,i,a){return{x1:e,y1:t,x2:s,y2:i,cols:this._bufferService.cols,fg:a}}};m_=kt([be(1,sv),be(2,Nn),be(3,bs),be(4,vk)],m_);function kP(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var EP=class extends _P{constructor(e={}){super(e),this._linkifier=this._register(new Io),this.browser=Bk,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Io),this._onCursorMove=this._register(new me),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new me),this.onKey=this._onKey.event,this._onRender=this._register(new me),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new me),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new me),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new me),this.onBell=this._onBell.event,this._onFocus=this._register(new me),this._onBlur=this._register(new me),this._onA11yCharEmitter=this._register(new me),this._onA11yTabEmitter=this._register(new me),this._onWillOpen=this._register(new me),this._setup(),this._decorationService=this._instantiationService.createInstance(SP),this._instantiationService.setService(Bc,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(mj),this._instantiationService.setService(vk,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Pg)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh((t==null?void 0:t.start)??0,(t==null?void 0:t.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(us.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(us.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(us.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(us.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(_t(()=>{var t,s;this._customKeyEventHandler=void 0,(s=(t=this.element)==null?void 0:t.parentNode)==null||s.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let s,i="";switch(t.index){case 256:s="foreground",i="10";break;case 257:s="background",i="11";break;case 258:s="cursor",i="12";break;default:s="ansi",i="4;"+t.index}switch(t.type){case 0:let a=ft.toColorRGB(s==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[s]);this.coreService.triggerDataEvent(`${de.ESC}]${i};${hP(a)}${jk.ST}`);break;case 1:if(s==="ansi")this._themeService.modifyColors(o=>o.ansi[t.index]=Pt.toColor(...t.color));else{let o=s;this._themeService.modifyColors(c=>c[o]=Pt.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(nd,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(de.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(de.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let s=Math.min(this.buffer.x,this.cols-1),i=this._renderService.dimensions.css.cell.height,a=t.getWidth(s),o=this._renderService.dimensions.css.cell.width*a,c=this.buffer.y*this._renderService.dimensions.css.cell.height,d=s*this._renderService.dimensions.css.cell.width;this.textarea.style.left=d+"px",this.textarea.style.top=c+"px",this.textarea.style.width=o+"px",this.textarea.style.height=i+"px",this.textarea.style.lineHeight=i+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Le(this.element,"copy",t=>{this.hasSelection()&&RM(t,this._selectionService)}));let e=t=>DM(t,this.textarea,this.coreService,this.optionsService);this._register(Le(this.textarea,"paste",e)),this._register(Le(this.element,"paste",e)),Ik?this._register(Le(this.element,"mousedown",t=>{t.button===2&&Cw(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Le(this.element,"contextmenu",t=>{Cw(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),uv&&this._register(Le(this.element,"auxclick",t=>{t.button===1&&ck(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Le(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Le(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Le(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Le(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Le(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Le(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Le(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var a;if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((a=this.element)==null?void 0:a.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(Le(this.screenElement,"mousemove",o=>this.updateCursorStyle(o))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let s=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Mg.get()),Uk||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>s.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(fj,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Tn,this._coreBrowserService),this._register(Le(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(Le(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(i_,this._document,this._helperContainer),this._instantiationService.setService(xd,this._charSizeService),this._themeService=this._instantiationService.createInstance(o_),this._instantiationService.setService($o,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(td),this._instantiationService.setService(_k,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(r_,this.rows,this.screenElement)),this._instantiationService.setService(Nn,this._renderService),this._register(this._renderService.onRenderedViewportChange(o=>this._onRender.fire(o))),this.onResize(o=>this._renderService.resize(o.cols,o.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(e_,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(n_),this._instantiationService.setService(sv,this._mouseService);let i=this._linkifier.value=this._register(this._instantiationService.createInstance(m_,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(Zg,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(o=>{super.scrollLines(o,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(a_,this.element,this.screenElement,i)),this._instantiationService.setService(zM,this._selectionService),this._register(this._selectionService.onRequestScrollLines(o=>this.scrollLines(o.amount,o.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(o=>this._renderService.handleSelectionChanged(o.start,o.end,o.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(o=>{this.textarea.value=o,this.textarea.focus(),this.textarea.select()})),this._register(us.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var o;this._selectionService.refresh(),(o=this._viewport)==null||o.queueSync()})),this._register(this._instantiationService.createInstance(Jg,this.screenElement)),this._register(Le(this.element,"mousedown",o=>this._selectionService.handleMouseDown(o))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(nd,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(ed,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(ed,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(s_,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function s(o){var h,g,_,y,b;let c=e._mouseService.getMouseReportCoords(o,e.screenElement);if(!c)return!1;let d,f;switch(o.overrideType||o.type){case"mousemove":f=32,o.buttons===void 0?(d=3,o.button!==void 0&&(d=o.button<3?o.button:3)):d=o.buttons&1?0:o.buttons&4?1:o.buttons&2?2:3;break;case"mouseup":f=0,d=o.button<3?o.button:3;break;case"mousedown":f=1,d=o.button<3?o.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(o)===!1)return!1;let S=o.deltaY;if(S===0||e.coreMouseService.consumeWheelEvent(o,(y=(_=(g=(h=e._renderService)==null?void 0:h.dimensions)==null?void 0:g.device)==null?void 0:_.cell)==null?void 0:y.height,(b=e._coreBrowserService)==null?void 0:b.dpr)===0)return!1;f=S<0?0:1,d=4;break;default:return!1}return f===void 0||d===void 0||d>4?!1:e.coreMouseService.triggerMouseEvent({col:c.col,row:c.row,x:c.x,y:c.y,button:d,action:f,ctrl:o.ctrlKey,alt:o.altKey,shift:o.shiftKey})}let i={mouseup:null,wheel:null,mousedrag:null,mousemove:null},a={mouseup:o=>(s(o),o.buttons||(this._document.removeEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.removeEventListener("mousemove",i.mousedrag)),this.cancel(o)),wheel:o=>(s(o),this.cancel(o,!0)),mousedrag:o=>{o.buttons&&s(o)},mousemove:o=>{o.buttons||s(o)}};this._register(this.coreMouseService.onProtocolChange(o=>{o?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(o)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),o&8?i.mousemove||(t.addEventListener("mousemove",a.mousemove),i.mousemove=a.mousemove):(t.removeEventListener("mousemove",i.mousemove),i.mousemove=null),o&16?i.wheel||(t.addEventListener("wheel",a.wheel,{passive:!1}),i.wheel=a.wheel):(t.removeEventListener("wheel",i.wheel),i.wheel=null),o&2?i.mouseup||(i.mouseup=a.mouseup):(this._document.removeEventListener("mouseup",i.mouseup),i.mouseup=null),o&4?i.mousedrag||(i.mousedrag=a.mousedrag):(this._document.removeEventListener("mousemove",i.mousedrag),i.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Le(t,"mousedown",o=>{if(o.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(o)))return s(o),i.mouseup&&this._document.addEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.addEventListener("mousemove",i.mousedrag),this.cancel(o)})),this._register(Le(t,"wheel",o=>{var c,d,f,h,g;if(!i.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(o)===!1)return!1;if(!this.buffer.hasScrollback){if(o.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(o,(h=(f=(d=(c=e._renderService)==null?void 0:c.dimensions)==null?void 0:d.device)==null?void 0:f.cell)==null?void 0:h.height,(g=e._coreBrowserService)==null?void 0:g.dpr)===0)return this.cancel(o,!0);let _=de.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(o.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(_,!0),this.cancel(o,!0)}}},{passive:!1}))}refresh(e,t){var s;(s=this._renderService)==null||s.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){lk(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,s){this._selectionService.setSelection(e,t,s)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var s;(s=this._selectionService)==null||s.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let s=yP(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),s.type===3||s.type===2){let i=this.rows-1;return this.scrollLines(s.type===2?-i:i),this.cancel(e,!0)}if(s.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(s.cancel&&this.cancel(e,!0),!s.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((s.key===de.ETX||s.key===de.CR)&&(this.textarea.value=""),this._onKey.fire({key:s.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(s.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let s=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?s:s&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(TP(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){var s;(s=this._charSizeService)==null||s.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(jt));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var t;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(t=this._selectionService)==null||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(de.ESC+"[I"):this.coreService.triggerDataEvent(de.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),s=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${de.ESC}[4;${s};${t}t`);break;case 1:let i=this._renderService.dimensions.css.cell.width.toFixed(0),a=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${de.ESC}[6;${a};${i}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function TP(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var NP=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let s={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(s),t.dispose=()=>this._wrappedAddonDispose(s),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let s=0;s<this._addons.length;s++)if(this._addons[s]===e){t=s;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},AP=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new gi)}translateToString(e,t,s){return this._line.translateToString(e,t,s)}},p1=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new AP(t)}getNullCell(){return new gi}},RP=class extends Ue{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new me),this.onBufferChange=this._onBufferChange.event,this._normal=new p1(this._core.buffers.normal,"normal"),this._alternate=new p1(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},DP=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,s=>t(s.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(s,i)=>t(s,i.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},LP=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},MP=["cols","rows"],Pi=0,OP=class extends Ue{constructor(e){super(),this._core=this._register(new EP(e)),this._addonManager=this._register(new NP),this._publicOptions={...this._core.options};let t=i=>this._core.options[i],s=(i,a)=>{this._checkReadonlyOptions(i),this._core.options[i]=a};for(let i in this._core.options){let a={get:t.bind(this,i),set:s.bind(this,i)};Object.defineProperty(this._publicOptions,i,a)}}_checkReadonlyOptions(e){if(MP.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new DP(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new LP(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this._register(new RP(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,s){this._verifyIntegers(e,t,s),this._core.select(e,t,s)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
|
|
88
|
+
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return Mg.get()},set promptLabel(e){Mg.set(e)},get tooMuchOutput(){return Og.get()},set tooMuchOutput(e){Og.set(e)}}}_verifyIntegers(...e){for(Pi of e)if(Pi===1/0||isNaN(Pi)||Pi%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Pi of e)if(Pi&&(Pi===1/0||isNaN(Pi)||Pi%1!==0||Pi<0))throw new Error("This API only accepts positive integers")}};/**
|
|
89
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
90
|
+
* @license MIT
|
|
91
|
+
*
|
|
92
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
93
|
+
* @license MIT
|
|
94
|
+
*
|
|
95
|
+
* Originally forked from (with the author's permission):
|
|
96
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
97
|
+
* http://bellard.org/jslinux/
|
|
98
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
99
|
+
*/var jP=2,PP=1,BP=class{activate(t){this._terminal=t}dispose(){}fit(){let t=this.proposeDimensions();if(!t||!this._terminal||isNaN(t.cols)||isNaN(t.rows))return;let s=this._terminal._core;(this._terminal.rows!==t.rows||this._terminal.cols!==t.cols)&&(s._renderService.clear(),this._terminal.resize(t.cols,t.rows))}proposeDimensions(){var y;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let t=this._terminal._core._renderService.dimensions;if(t.css.cell.width===0||t.css.cell.height===0)return;let s=this._terminal.options.scrollback===0?0:((y=this._terminal.options.overviewRuler)==null?void 0:y.width)||14,i=window.getComputedStyle(this._terminal.element.parentElement),a=parseInt(i.getPropertyValue("height")),o=Math.max(0,parseInt(i.getPropertyValue("width"))),c=window.getComputedStyle(this._terminal.element),d={top:parseInt(c.getPropertyValue("padding-top")),bottom:parseInt(c.getPropertyValue("padding-bottom")),right:parseInt(c.getPropertyValue("padding-right")),left:parseInt(c.getPropertyValue("padding-left"))},f=d.top+d.bottom,h=d.right+d.left,g=a-f,_=o-h-s;return{cols:Math.max(jP,Math.floor(_/t.css.cell.width)),rows:Math.max(PP,Math.floor(g/t.css.cell.height))}}};/**
|
|
100
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
101
|
+
* @license MIT
|
|
102
|
+
*
|
|
103
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
104
|
+
* @license MIT
|
|
105
|
+
*
|
|
106
|
+
* Originally forked from (with the author's permission):
|
|
107
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
108
|
+
* http://bellard.org/jslinux/
|
|
109
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
110
|
+
*/var IP=class{constructor(t,s,i,a={}){this._terminal=t,this._regex=s,this._handler=i,this._options=a}provideLinks(t,s){let i=HP.computeLink(t,this._regex,this._terminal,this._handler);s(this._addCallbacks(i))}_addCallbacks(t){return t.map(s=>(s.leave=this._options.leave,s.hover=(i,a)=>{if(this._options.hover){let{range:o}=s;this._options.hover(i,a,o)}},s))}};function zP(e){try{let t=new URL(e),s=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(s.toLocaleLowerCase())}catch{return!1}}var HP=class Fh{static computeLink(t,s,i,a){let o=new RegExp(s.source,(s.flags||"")+"g"),[c,d]=Fh._getWindowedLineStrings(t-1,i),f=c.join(""),h,g=[];for(;h=o.exec(f);){let _=h[0];if(!zP(_))continue;let[y,b]=Fh._mapStrIdx(i,d,0,h.index),[S,w]=Fh._mapStrIdx(i,y,b,_.length);if(y===-1||b===-1||S===-1||w===-1)continue;let k={start:{x:b+1,y:y+1},end:{x:w,y:S+1}};g.push({range:k,text:_,activate:a})}return g}static _getWindowedLineStrings(t,s){let i,a=t,o=t,c=0,d="",f=[];if(i=s.buffer.active.getLine(t)){let h=i.translateToString(!0);if(i.isWrapped&&h[0]!==" "){for(c=0;(i=s.buffer.active.getLine(--a))&&c<2048&&(d=i.translateToString(!0),c+=d.length,f.push(d),!(!i.isWrapped||d.indexOf(" ")!==-1)););f.reverse()}for(f.push(h),c=0;(i=s.buffer.active.getLine(++o))&&i.isWrapped&&c<2048&&(d=i.translateToString(!0),c+=d.length,f.push(d),d.indexOf(" ")===-1););}return[f,a]}static _mapStrIdx(t,s,i,a){let o=t.buffer.active,c=o.getNullCell(),d=i;for(;a;){let f=o.getLine(s);if(!f)return[-1,-1];for(let h=d;h<f.length;++h){f.getCell(h,c);let g=c.getChars();if(c.getWidth()&&(a-=g.length||1,h===f.length-1&&g==="")){let _=o.getLine(s+1);_&&_.isWrapped&&(_.getCell(0,c),c.getWidth()===2&&(a+=1))}if(a<0)return[s,h]}s++,d=0}return[s,d]}},UP=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function FP(e,t){let s=window.open();if(s){try{s.opener=null}catch{}s.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var $P=class{constructor(t=FP,s={}){this._handler=t,this._options=s}activate(t){this._terminal=t;let s=this._options,i=s.urlRegex||UP;this._linkProvider=this._terminal.registerLinkProvider(new IP(this._terminal,i,this._handler,s))}dispose(){var t;(t=this._linkProvider)==null||t.dispose()}};const VP=/([\s'"(`[{])?(\/?\/?(?:\.\/)?(?:[\w.@~-]+\/)*(?:[\w.@~-]+\.(?:ts|tsx|js|jsx|svelte|html|htm|css|scss|json|yaml|yml|toml|md|txt|py|rs|go|rb|java|c|cpp|h|sh|sql|graphql|xml|csv|env|log|cfg|conf|ini)|(?:Makefile|Dockerfile|Vagrantfile|Rakefile|Gemfile|Procfile|Brewfile|Justfile|Taskfile|Containerfile)(?:\.\w+)?))(?::(\d+)(?::(\d+))?)?/g;function WP(e){const[t,s]=C.useState({thumbHeight:0,thumbTop:0,thumbVisible:!1}),i=C.useRef(!1),a=C.useCallback(()=>{i.current||(i.current=!0,requestAnimationFrame(()=>{var y;i.current=!1;const o=e.current;if(!o)return;const c=o.buffer.active,d=c.baseY+o.rows;if(d<=o.rows){s(b=>({...b,thumbVisible:!1}));return}const f=((y=document.querySelector(".terminal-scrollbar"))==null?void 0:y.clientHeight)??0,g=Math.max(Qe?44:20,o.rows/d*f),_=c.viewportY/(d-o.rows)*(f-g);s({thumbHeight:g,thumbTop:_,thumbVisible:!0})}))},[e]);return{scrollbarState:t,updateScrollbar:a}}function GP(e,t){const[s,i]=C.useState(!1),[a,o]=C.useState("100%"),c=C.useRef(null),d=fe(h=>h.saveTerminalFontSize),f=C.useCallback(h=>{const g=e.current;if(!g)return;const _=kD(h);_!==g.options.fontSize&&(g.options.fontSize=_,fe.setState({terminalFontSize:_}),d(),t(),o(ED(_)+"%"),i(!0),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>i(!1),1500))},[e,t,d]);return C.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]),{zoomVisible:s,zoomText:a,applyZoom:f}}const qP=500,m1=10;function KP(e,t,s,i,a){e.preventDefault();const o=t.clientY-s.scrollbarDragStartY,d=i.buffer.active.baseY+i.rows;if(d<=i.rows)return;const f=a.clientHeight,h=Math.max(44,i.rows/d*f),g=f-h,y=Math.max(0,Math.min(g,s.scrollbarDragStartTop+o))/g;i.scrollToLine(Math.round(y*(d-i.rows)))}function YP(e,t,s,i,a){const o=s.contentLastTouchY-t.clientY;s.contentLastTouchY=t.clientY,s.contentScrollAccumulator+=o/a;const c=Math.trunc(s.contentScrollAccumulator);if(c===0)return;s.contentScrollAccumulator-=c;const d=c>0?65:64,f=Math.max(1,Math.round(i.cols/2)),h=Math.max(1,Math.round(i.rows/2)),g=`\x1B[<${d};${f};${h}M`,_=Math.min(Math.abs(c),5);for(let y=0;y<_;y++)mi(g)}function XP(e,t){var i;if(t(!1),!e)return;const s=e.querySelector(".xterm-screen");s&&(s.style.userSelect="",s.style.webkitUserSelect=""),e.querySelectorAll("canvas").forEach(a=>{a.style.pointerEvents=""}),(i=window.getSelection())==null||i.removeAllRanges()}function QP(e,t){if(t(!0),!e)return;const s=e.querySelector(".xterm-screen");s&&(s.style.userSelect="text",s.style.webkitUserSelect="text"),e.querySelectorAll("canvas").forEach(c=>{c.style.pointerEvents="none"});const i=e.querySelector(".xterm-rows");if(!i)return;const a=document.createRange();a.selectNodeContents(i);const o=window.getSelection();o==null||o.removeAllRanges(),o==null||o.addRange(a)}function ZP(e,t,s,i,a,o){const[c,d]=C.useState(!1),[f,h]=C.useState(!1),g=C.useRef({contentScrolling:!1,contentTouchStartY:0,contentScrollStartLine:0,contentTouchMoved:!1,contentScrollAccumulator:0,contentLastTouchY:0,scrollbarDragging:!1,scrollbarDragStartY:0,scrollbarDragStartTop:0,longPressTimer:null,longPressStartX:0,longPressStartY:0}),_=C.useCallback(()=>{XP(t.current,d)},[t]),y=C.useCallback(()=>{const T=g.current;if(T.longPressTimer&&(clearTimeout(T.longPressTimer),T.longPressTimer=null),T.contentScrolling=!1,navigator.vibrate&&navigator.vibrate(50),a){h(!0),o==null||o(!0),mi("[");return}QP(t.current,d)},[t,a,o]),b=C.useCallback(()=>{f&&(h(!1),o==null||o(!1))},[f,o]),S=C.useCallback(T=>{var U;const D=g.current,N=e.current;if(c){const W=((U=window.getSelection())==null?void 0:U.toString())??"";W.trim().length>0&&(navigator.clipboard.writeText(W).catch(()=>{}),navigator.vibrate&&navigator.vibrate(30)),_();return}if(f)return;const E=T.target;if(E.closest(".terminal-scrollbar")||E.closest(".scroll-fabs")||!N)return;const M=T.touches[0];M&&(D.contentTouchStartY=M.clientY,D.contentLastTouchY=M.clientY,D.contentScrollStartLine=N.buffer.active.viewportY,D.contentTouchMoved=!1,D.contentScrollAccumulator=0,D.contentScrolling=!0,D.longPressStartX=M.clientX,D.longPressStartY=M.clientY,D.longPressTimer&&clearTimeout(D.longPressTimer),D.longPressTimer=setTimeout(y,qP))},[e,c,f,_,y]),w=C.useCallback(T=>{var E;const D=g.current;if(D.scrollbarDragging||D.contentTouchMoved)return;const N=T.target;N.closest(".terminal-scrollbar")||N.closest(".scroll-fabs")||c||((E=e.current)==null||E.focus(),T.preventDefault())},[e,c]),k=C.useCallback(T=>{const D=T.touches[0];if(!D)return;const N=g.current;N.scrollbarDragging=!0,N.scrollbarDragStartY=D.clientY,N.scrollbarDragStartTop=i},[i]);return JP(e,t,s,g,c),{selectionMode:c,inCopyMode:f,exitCopyMode:b,onTerminalTouchStart:S,onTerminalTouchEnd:w,onThumbTouchStart:k}}function JP(e,t,s,i,a){C.useEffect(()=>{if(!Qe)return;const o=d=>{const f=d.touches[0];if(!f)return;const h=i.current,g=e.current,_=s.current;if(h.scrollbarDragging&&g&&_){KP(d,f,h,g,_);return}const y=t.current;if(!h.contentScrolling||!g||a||!y)return;if(h.longPressTimer){const w=Math.abs(f.clientX-h.longPressStartX),k=Math.abs(f.clientY-h.longPressStartY);(w>m1||k>m1)&&(clearTimeout(h.longPressTimer),h.longPressTimer=null)}if(g.rows===0||y.clientHeight===0)return;const b=h.contentTouchStartY-f.clientY;if(Math.abs(b)<=5)return;h.contentTouchMoved=!0,d.preventDefault();const S=y.clientHeight/g.rows;if(g.buffer.active.type==="alternate")YP(d,f,h,g,S);else{const w=b/S,k=g.buffer.active.baseY;g.scrollToLine(Math.max(0,Math.min(k,Math.round(h.contentScrollStartLine+w))))}},c=()=>{const d=i.current;d.longPressTimer&&(clearTimeout(d.longPressTimer),d.longPressTimer=null),d.scrollbarDragging=!1,d.contentScrolling=!1,d.contentTouchMoved=!1,d.contentScrollAccumulator=0};return document.addEventListener("touchmove",o,{passive:!1}),document.addEventListener("touchend",c),document.addEventListener("touchcancel",c),()=>{document.removeEventListener("touchmove",o),document.removeEventListener("touchend",c),document.removeEventListener("touchcancel",c)}},[e,t,s,i,a])}function eB(e,t,s,i){const a=C.useCallback(d=>{const f=e.current,h=t.current;if(!f||!h)return;const g=h.getBoundingClientRect(),y=f.buffer.active.baseY+f.rows;if(y<=f.rows)return;const b=h.clientHeight,S=Math.max(Qe?44:20,f.rows/y*b),w=b-S,k=d-g.top-S/2,T=Math.max(0,Math.min(1,k/w));f.scrollToLine(Math.round(T*(y-f.rows)))},[e,t]),o=C.useCallback(d=>{d.target!==s.current&&a(d.clientY)},[s,a]),c=C.useCallback(d=>{d.preventDefault();const f=d.target.closest("button");if(!f)return;const h=e.current;if(!h)return;const g=f.dataset.dir;if(h.buffer.active.type==="alternate"){const _=Math.max(1,Math.round(h.cols/2)),y=Math.max(1,Math.round(h.rows/2));if(g==="up"||g==="down"){const S=`\x1B[<${g==="down"?65:64};${_};${y}M`,w=Math.max(1,Math.round(h.rows/2));for(let k=0;k<w;k++)mi(S)}else if(g==="bottom"){const b=`\x1B[<65;${_};${y}M`;for(let S=0;S<h.rows;S++)mi(b)}}else g==="up"?h.scrollPages(-1):g==="down"?h.scrollPages(1):g==="bottom"&&h.scrollToBottom()},[e]);return{onScrollbarClick:o,onScrollFabMouseDown:c}}function tB(e){var t;(t=navigator.clipboard)!=null&&t.read&&navigator.clipboard.read().then(s=>{let i=null,a=null;for(const o of s){for(const c of o.types)if(c.startsWith("image/")){a=c,i=o;break}if(i)break}i&&a?i.getType(a):navigator.clipboard.readText().then(o=>{o&&e.paste(o)})}).catch(()=>{navigator.clipboard.readText&&navigator.clipboard.readText().then(s=>{s&&e.paste(s)}).catch(()=>{})})}function sB(e,t){return Qe||e.type!=="keydown"?!1:(t?e.metaKey&&!e.ctrlKey&&!e.altKey:e.ctrlKey&&!e.metaKey&&!e.altKey)&&(e.key==="="||e.key==="+"||e.key==="-"||e.key==="0")}function iB(e,t){return!t&&e.type==="keydown"&&e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey&&(e.key==="v"||e.key==="V")}function nB(e,t){e.attachCustomKeyEventHandler(s=>{var i;return sB(s,t)?(s.preventDefault(),!1):iB(s,t)&&typeof((i=navigator.clipboard)==null?void 0:i.read)=="function"?(tB(e),!1):!0})}function rB(e,t){e.registerLinkProvider({provideLinks(s,i){const a=e.buffer.active.getLine(s-1);if(!a){i(void 0);return}const o=a.translateToString(!0),c=[];for(const d of o.matchAll(VP)){if(d.index===void 0)continue;const f=d[1]||"";if(d.index>0&&!f)continue;const h=d.index+f.length,g=d[0].slice(f.length),_=h+g.length;c.push({range:{start:{x:h+1,y:s},end:{x:_+1,y:s}},text:g,activate(y,b){t==null||t(b.replace(/:\d+(?::\d+)?$/,""))}})}i(c.length>0?c:void 0)}})}function aB(e,t){const s=e.querySelector(".xterm-viewport");s&&(s.style.touchAction="none",s.style.overflowY="hidden");const i=e.querySelector(".xterm-screen");if(!i)return;i.addEventListener("wheel",o=>{o.stopImmediatePropagation(),o.preventDefault()},{capture:!0,passive:!1});const a=o=>{t.modes.mouseTrackingMode!=="none"&&o.stopImmediatePropagation()};for(const o of["mousedown","mouseup","mousemove"])i.addEventListener(o,a,{capture:!0})}function oB(e,t,s,i,a){const o=C.useRef(null),c=C.useRef(null),d=fe(h=>h.terminalFontSize),f=C.useCallback(()=>{const h=o.current,g=c.current;if(!h||!g)return;const _=h.buffer.active,y=_.viewportY>=_.baseY,b=_.viewportY;g.fit(),y?h.scrollToBottom():h.scrollToLine(b),gm(h.cols,h.rows),a()},[a]);return C.useEffect(()=>{const h=e.current;if(!h)return;const g=/Mac|iPhone|iPad|iPod/.test(navigator.platform||""),_=new OP({cursorBlink:!0,fontSize:Qe?12:d,fontFamily:"Menlo, monospace",scrollback:1e4,theme:{background:"#000000",foreground:"#d4d4d4",cursor:"#d4d4d4"}}),y=new BP;c.current=y,_.loadAddon(y),_.loadAddon(new $P),rB(_,i),_.open(h),Qe&&aB(h,_),y.fit(),_.onData(w=>mi(w)),nB(_,g),_.parser.registerOscHandler(52,w=>{var D;const k=w.indexOf(";");if(k===-1)return!0;const T=w.slice(k+1);if(!T||T==="?")return!0;try{const N=Uint8Array.from(atob(T),E=>E.charCodeAt(0));(D=navigator.clipboard)==null||D.writeText(new TextDecoder("utf-8").decode(N)).catch(()=>{})}catch{}return!0}),_.onScroll(a),_.onWriteParsed(a);let b=null;const S=new ResizeObserver(()=>{b&&clearTimeout(b),b=setTimeout(()=>{const w=_.buffer.active,k=w.viewportY>=w.baseY,T=w.viewportY;y.fit(),k?_.scrollToBottom():_.scrollToLine(T),gm(_.cols,_.rows),a()},Qe?150:0)});return S.observe(h),o.current=_,()=>{b&&clearTimeout(b),S.disconnect(),_.dispose(),o.current=null,c.current=null}},[]),C.useEffect(()=>{const h=o.current;t&&h&&!s&&(h.write("\x1B[?1049l"),h.clear(),Gx(t,h,()=>{o.current&&gm(o.current.cols,o.current.rows)},()=>{}))},[t,s]),{termRef:o,fitAddonRef:c,fit:f}}function lB(e,t){const s=C.useRef(!1);return{handleImageUpload:C.useCallback(async(a,o)=>{if(s.current||!e)return;s.current=!0,t==null||t("Pasting image…",!1);const c=new FileReader;c.onload=async()=>{const d=c.result.split(",")[1];try{const f=await u2(e,d,o);f.clipboardSet?t==null||t("Image pasted",!1):t==null||t(f.path,!0,f.path)}catch(f){const h=f instanceof Error?f.message:"Image upload failed";t==null||t(h,!1)}finally{s.current=!1}},c.readAsDataURL(a)},[e,t])}}function cB(e,t,s){const[i,a]=C.useState(!1);C.useEffect(()=>{const h=/Mac|iPhone|iPad|iPod/.test(navigator.platform||""),g=_=>{if(Qe||_.type!=="keydown"||!(h?_.metaKey&&!_.ctrlKey&&!_.altKey:_.ctrlKey&&!_.metaKey&&!_.altKey))return;const b=e.current;if(!b)return;const S=b.options.fontSize??Bo;_.key==="="||_.key==="+"?t(S+1):_.key==="-"?t(S-1):_.key==="0"&&t(Bo)};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[e,t]);const o=C.useCallback(h=>{var g;if((g=h.clipboardData)!=null&&g.items){for(const _ of h.clipboardData.items)if(_.type.startsWith("image/")){h.preventDefault(),h.stopPropagation();const y=_.getAsFile();y&&s(y,_.type);return}}},[s]),c=C.useCallback(h=>{var g;(g=h.dataTransfer)!=null&&g.types.includes("Files")&&(h.preventDefault(),a(!0))},[]),d=C.useCallback(()=>a(!1),[]),f=C.useCallback(h=>{var _;h.preventDefault(),a(!1);const g=(_=h.dataTransfer)==null?void 0:_.files[0];g!=null&&g.type.startsWith("image/")&&s(g,g.type)},[s]);return{dragOver:i,handlePaste:o,handleDragOver:c,handleDragLeave:d,handleDrop:f}}const uB=C.forwardRef(function({sessionId:t,onImageUpload:s,useTmux:i=!1,onCopyModeChange:a,onFilePathClick:o,companionMode:c=!1},d){const f=C.useRef(null),h=C.useRef(null),g=C.useRef(null),{termRef:_,fit:y}=oB(f,t,c,o,()=>S()),{scrollbarState:b,updateScrollbar:S}=WP(_),{zoomVisible:w,zoomText:k,applyZoom:T}=GP(_,y),{handleImageUpload:D}=lB(t,s),{selectionMode:N,exitCopyMode:E,onTerminalTouchStart:M,onTerminalTouchEnd:U,onThumbTouchStart:W}=ZP(_,f,h,b.thumbTop,i,a),{onScrollbarClick:B,onScrollFabMouseDown:$}=eB(_,h,g,b.thumbTop),{dragOver:Y,handlePaste:K,handleDragOver:X,handleDragLeave:P,handleDrop:j}=cB(_,T,D);C.useImperativeHandle(d,()=>({getTerm:()=>_.current,focusTerm:()=>{var O;return(O=_.current)==null?void 0:O.focus()},fitTerm:y,exitCopyMode:E,handleImageUpload:D}),[_,y,E,D]);const H=["terminal-wrapper",Y?"drag-over":"",N?"selection-mode":""].filter(Boolean).join(" ");return p.jsxs("div",{className:H,"data-track":"terminal.focus",onTouchStart:Qe?M:void 0,onTouchEnd:Qe?U:void 0,children:[p.jsx("div",{className:"terminal-container",ref:f,onPaste:K,onDragOver:X,onDragLeave:P,onDrop:j,role:"presentation"}),p.jsx("div",{className:"terminal-scrollbar",ref:h,onClick:B,role:"scrollbar","aria-valuenow":0,"aria-orientation":"vertical",children:p.jsx("div",{className:"terminal-scrollbar-thumb",ref:g,style:{display:b.thumbVisible?"block":"none",height:b.thumbHeight,top:b.thumbTop},onTouchStart:W,role:"presentation"})}),Qe&&b.thumbVisible&&p.jsxs("div",{className:"scroll-fabs",onMouseDown:$,children:[p.jsx("button",{className:"scroll-fab","data-dir":"up","data-track":"terminal.scroll-up","aria-label":"Page up",children:"▲"}),p.jsx("button",{className:"scroll-fab","data-dir":"down","data-track":"terminal.scroll-down","aria-label":"Page down",children:"▼"}),p.jsx("button",{className:"scroll-fab scroll-fab-bottom","data-dir":"bottom","data-track":"terminal.scroll-bottom","aria-label":"Skip to bottom",children:"↧"})]}),!Qe&&p.jsx("div",{className:["zoom-overlay",w?"visible":""].filter(Boolean).join(" "),children:k})]})});function Qk({danger:e=!1,disabled:t=!1,onMouseDown:s,onClick:i,onmousedown:a,onclick:o,role:c="menuitem",ariaSelected:d,icon:f,children:h,className:g="",..._}){const y=s??a,b=i??o,S=["tui-menu-item",e&&"tui-menu-item--danger",t&&"tui-menu-item--disabled",g].filter(Boolean).join(" "),w=k=>{t||(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),y==null||y(k))};return p.jsxs("div",{className:S,role:c,"aria-selected":d,tabIndex:t?-1:0,onMouseDown:t?void 0:y,onClick:t?void 0:b,onKeyDown:w,..._,children:[p.jsx("span",{className:"fzf-cursor","aria-hidden":"true",children:">"}),f?p.jsx("span",{className:"tui-menu-item__icon",children:f}):null,p.jsx("span",{className:"tui-menu-item__content",children:h})]})}function Zk({children:e}){return p.jsx("div",{className:"tui-menu-panel",children:e})}function hB({repoPath:e,currentBranch:t,onSwitch:s,disabled:i=!1,currentWorktreePath:a,onJumpToSession:o,onStartSession:c,onCreateBranch:d}){const[f,h]=C.useState(!1),[g,_]=C.useState(""),[y,b]=C.useState([]),[S,w]=C.useState(!1),[k,T]=C.useState(null),[D,N]=C.useState(null),E=C.useRef(null),M=C.useRef(null);C.useEffect(()=>{if(!f)return;let j=!1;return w(!0),cx(e).then(H=>{j||b(H)}).catch(()=>{j||b([])}).finally(()=>{j||w(!1)}),()=>{j=!0}},[f,e]),C.useEffect(()=>{if(!f)return;const j=window.requestAnimationFrame(()=>{var H;(H=M.current)==null||H.focus()});return()=>window.cancelAnimationFrame(j)},[f]),C.useEffect(()=>{if(!f)return;const j=H=>{const O=H.target;O&&E.current&&!E.current.contains(O)&&(h(!1),_(""))};return window.addEventListener("click",j),()=>window.removeEventListener("click",j)},[f]);const U=C.useMemo(()=>{if(!g.trim())return y;const j=g.toLowerCase();return y.filter(H=>H.name.toLowerCase().includes(j))},[y,g]),W=C.useMemo(()=>{const j=g.trim();return j?!y.some(H=>H.name===j):!1},[y,g]),B=()=>{h(!1),_("")},$=()=>{i||(h(!0),_(""),N(null))},Y=async j=>{if(j===t){B();return}T(j),N(null);try{const H=await o2(e,j);H.success?(B(),s(j)):N(H.error??"Failed to switch branch")}catch{N("Failed to switch branch")}finally{T(null)}},K=j=>!a||!j.checkedOutIn?!1:j.checkedOutIn.worktreePath!==a,X=(j,H)=>{H.stopPropagation(),H.preventDefault(),j.checkedOutIn&&(j.checkedOutIn.sessionId&&o?o(j.checkedOutIn.sessionId):c&&c(j.checkedOutIn.worktreePath))},P=j=>{j.key==="Escape"&&f&&(B(),j.stopPropagation())};return p.jsxs("div",{className:"branch-switcher",ref:E,children:[p.jsxs("button",{className:`branch-trigger${i?" branch-disabled":""}`,onClick:$,title:i?"Unavailable while agent is running":void 0,"aria-label":"Switch branch","aria-expanded":f,"aria-haspopup":"listbox",type:"button",children:[p.jsx("span",{className:"branch-icon",children:"⑂"}),p.jsx("span",{className:"branch-name",children:t}),p.jsx("svg",{className:"branch-caret",width:"10",height:"6",viewBox:"0 0 10 6","aria-hidden":"true",children:p.jsx("path",{d:"M1 1l4 4 4-4",stroke:"currentColor",fill:"none",strokeWidth:"1.5",strokeLinecap:"round"})})]}),f?p.jsx("div",{className:"branch-dropdown",role:"listbox",tabIndex:-1,"aria-label":"Branches",onKeyDown:P,children:p.jsxs(Zk,{children:[p.jsx("div",{className:"branch-filter-wrap",children:p.jsx("input",{ref:M,type:"text",className:"branch-filter",placeholder:"Filter branches...",value:g,onChange:j=>_(j.currentTarget.value),onKeyDown:P,"aria-label":"Filter branches"})}),D?p.jsx("div",{className:"branch-error",children:D}):null,W&&d?p.jsxs("div",{className:"branch-create",role:"option","aria-selected":!1,tabIndex:-1,onMouseDown:()=>d==null?void 0:d(g.trim()),children:[p.jsx("span",{className:"branch-create-icon",children:"+"}),p.jsxs("span",{children:['Create "',p.jsx("strong",{children:g.trim()}),'"']})]}):null,S?p.jsx("div",{className:"branch-loading",children:p.jsx(Uo,{loading:!0,text:"Fetching branches..."})}):U.length===0&&!W?p.jsx("div",{className:"branch-empty",children:"No branches match"}):p.jsx("div",{className:"branch-list",children:U.map(j=>{const H=K(j);return p.jsx(Qk,{role:"option",ariaSelected:j.name===t,disabled:H||k===j.name,onMouseDown:()=>void Y(j.name),children:p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"branch-check",children:j.name===t?"✓":p.jsx("span",{className:"branch-check--empty"})}),p.jsx("span",{className:`branch-option-name${j.name===t?" branch-current":""}${H?" branch-checked-out":""}`,children:j.name}),H&&j.checkedOutIn&&(o||c)?p.jsxs(p.Fragment,{children:[p.jsxs("span",{className:"branch-worktree-name",children:["(",j.checkedOutIn.worktreeName,")"]}),p.jsx("button",{className:"branch-jump-btn",title:"Jump to worktree",type:"button",onMouseDown:O=>X(j,O),children:p.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:[p.jsx("path",{d:"M4.5 2H2.5C2.22 2 2 2.22 2 2.5V9.5C2 9.78 2.22 10 2.5 10H9.5C9.78 10 10 9.78 10 9.5V7.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"}),p.jsx("path",{d:"M7 2H10V5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"}),p.jsx("path",{d:"M10 2L5.5 6.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})})]}):null,k===j.name?p.jsx("span",{className:"branch-spinner",children:"…"}):null]})},j.name)})})]})}):null]})}function dB(e,t){const s=e.filter(c=>c.isRemote).map(c=>({...c,name:c.name.replace(/^origin\//,"")})),i=new Set,a=s.filter(c=>i.has(c.name)?!1:(i.add(c.name),!0));if(!t.trim())return a;const o=t.toLowerCase();return a.filter(c=>c.name.toLowerCase().includes(o))}function fB({filteredBranches:e,currentBase:t,switching:s,isLoading:i,switchError:a,filterText:o,filterInputRef:c,onFilterChange:d,onKeyDown:f,onSelect:h}){return p.jsx("div",{className:"target-dropdown",role:"listbox",tabIndex:-1,"aria-label":"Target branches",onKeyDown:f,children:p.jsxs(Zk,{children:[p.jsx("div",{className:"target-filter-wrap",children:p.jsx("input",{ref:c,type:"text",className:"target-filter",placeholder:"Filter branches...",value:o,onChange:g=>d(g.currentTarget.value),onKeyDown:f,"aria-label":"Filter target branches"})}),a?p.jsx("div",{className:"target-error",children:a}):null,i?p.jsx("div",{className:"target-loading",children:"Loading..."}):e.length===0?p.jsx("div",{className:"target-empty",children:"No branches match"}):p.jsx("div",{className:"target-list",children:e.map(g=>p.jsxs(Qk,{role:"option",ariaSelected:g.name===t,disabled:s===g.name,icon:g.name===t?p.jsx("span",{className:"target-check",children:"✓"}):p.jsx("span",{className:"target-check target-check--empty"}),onMouseDown:()=>h(g.name),children:[p.jsx("span",{className:["target-option-name",g.name===t&&"target-current"].filter(Boolean).join(" "),children:g.name}),s===g.name?p.jsx("span",{className:"target-spinner",children:"…"}):null]},g.name))})]})})}function pB({workspacePath:e,currentBase:t,prNumber:s,disabled:i=!1,onBaseChanged:a}){const[o,c]=C.useState(!1),[d,f]=C.useState(""),[h,g]=C.useState([]),[_,y]=C.useState(!1),[b,S]=C.useState(null),[w,k]=C.useState(null),T=C.useRef(null),D=C.useRef(null);C.useEffect(()=>{if(!o)return;let W=!1;return y(!0),fetch("/branches?path="+encodeURIComponent(e)).then(B=>B.json()).then(B=>{W||g(B)}).catch(()=>{W||g([])}).finally(()=>{W||y(!1)}),()=>{W=!0}},[o,e]),C.useEffect(()=>{if(!o)return;const W=window.requestAnimationFrame(()=>{var B;return(B=D.current)==null?void 0:B.focus()});return()=>window.cancelAnimationFrame(W)},[o]),C.useEffect(()=>{if(!o)return;const W=B=>{T.current&&!T.current.contains(B.target)&&E()};return window.addEventListener("click",W),()=>window.removeEventListener("click",W)},[o]);const N=C.useMemo(()=>dB(h,d),[h,d]);function E(){c(!1),f("")}async function M(W){if(W===t){E();return}S(W),k(null);try{const $=await(await fetch("/workspaces/pr-base?path="+encodeURIComponent(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prNumber:s,baseBranch:W})})).json();$.success?(E(),a==null||a(W)):k($.error??"Failed to change base branch")}catch{k("Failed to change base branch")}finally{S(null)}}const U=W=>{W.key==="Escape"&&o&&(E(),W.stopPropagation())};return p.jsxs("div",{className:"target-switcher",ref:T,children:[p.jsxs("button",{className:["target-trigger",i&&"target-disabled"].filter(Boolean).join(" "),onClick:()=>{i||(c(!0),f(""),k(null))},"aria-label":"Change target branch","aria-expanded":o,"aria-haspopup":"listbox",title:i?"Unavailable while agent is running":"Change target branch",type:"button",children:[p.jsx("span",{className:"target-name",children:t}),p.jsx("svg",{className:"target-caret",width:"8",height:"5",viewBox:"0 0 8 5","aria-hidden":"true",children:p.jsx("path",{d:"M1 1l3 3 3-3",stroke:"currentColor",fill:"none",strokeWidth:"1.2",strokeLinecap:"round"})})]}),o?p.jsx(fB,{filteredBranches:N,currentBase:t,switching:b,isLoading:_,switchError:w,filterText:d,filterInputRef:D,onFilterChange:f,onKeyDown:U,onSelect:W=>void M(W)}):null]})}function mB(e){return e==="success"?"success":e==="error"?"danger":e==="accent"?"primary":"ghost"}function gB(e,t,s){const[i,a]=C.useState(null),[o,c]=C.useState(null),[d,f]=C.useState(!1),[h,g]=C.useState(!1),_=C.useCallback(async()=>{if(t){f(!0),g(!0);try{const y=await r2(e,t);if(a(y),(y==null?void 0:y.state)==="OPEN"){const b=await n2(e,t);c(b)}else c(null)}finally{f(!1),g(!1)}}},[e,t]);return C.useEffect(()=>{_()},[_,s]),{pr:i,ci:o,isRefreshing:d,prLoading:h,refresh:()=>{_()}}}function _B(e,t,s,i,a){const[o,c]=C.useState(!1),[d,f]=C.useState(""),[h,g]=C.useState(!1),[_,y]=C.useState(null),b=C.useRef(null);function S(){s||(c(!0),f(t),requestAnimationFrame(()=>{var D;return(D=b.current)==null?void 0:D.focus()}))}function w(){h||(c(!1),f(""))}async function k(){const D=d.trim();if(!D||D===t){w();return}g(!0);try{const E=await(await fetch("/workspaces/rename-branch?path="+encodeURIComponent(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({newName:D})})).json();c(!1),f(""),E.success&&E.oldName&&E.newName&&(a(E.newName),i&&y({oldName:E.oldName,newName:E.newName}))}catch{c(!1),f("")}finally{g(!1)}}function T(D){D.key==="Enter"?(D.preventDefault(),k()):D.key==="Escape"&&w()}return{renaming:o,renameValue:d,renameSubmitting:h,renameWarning:_,renameInputRef:b,startRename:S,cancelRename:w,confirmRename:k,handleRenameKeydown:T,setRenameValue:f,clearWarning:()=>y(null)}}const vB=p.jsx("svg",{width:"12",height:"12",viewBox:"0 0 16 16","aria-hidden":"true",children:p.jsx("path",{d:"M3 8l3 3 7-7",stroke:"currentColor",fill:"none",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),yB=p.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 16 16","aria-hidden":"true",children:[p.jsx("rect",{x:"5",y:"5",width:"9",height:"9",rx:"1.5",stroke:"currentColor",fill:"none",strokeWidth:"1.5"}),p.jsx("path",{d:"M3 11V3a1.5 1.5 0 011.5-1.5H11",stroke:"currentColor",fill:"none",strokeWidth:"1.5",strokeLinecap:"round"})]}),bB=p.jsx("svg",{width:"12",height:"12",viewBox:"0 0 16 16","aria-hidden":"true",children:p.jsx("path",{d:"M11.5 1.5l3 3L5 14H2v-3L11.5 1.5z",stroke:"currentColor",fill:"none",strokeWidth:"1.5",strokeLinejoin:"round"})});function SB({workspacePath:e,currentBranch:t,agentRunning:s,pr:i,rename:a,copyFeedback:o,onBranchSwitch:c,onCopy:d,onBaseChanged:f}){return p.jsxs("div",{className:"bar-left",children:[a.renaming?p.jsxs("div",{className:"rename-input-wrap",children:[p.jsx("span",{className:"branch-icon",children:"⑂"}),p.jsx("input",{ref:a.renameInputRef,type:"text",className:"rename-input",value:a.renameValue,onChange:h=>a.setRenameValue(h.currentTarget.value),onKeyDown:a.handleRenameKeydown,onBlur:a.cancelRename})]}):p.jsxs("div",{className:"branch-with-actions",children:[p.jsx(hB,{repoPath:e,currentWorktreePath:e,currentBranch:t,disabled:s,onSwitch:c}),p.jsxs("div",{className:"hover-icons",children:[p.jsx("button",{className:"hover-icon",onClick:d,title:o?"Copied!":"Copy branch name","aria-label":"Copy branch name",type:"button",children:o?vB:yB}),p.jsx("button",{className:"hover-icon",onClick:a.startRename,disabled:s,title:s?"Unavailable while agent is running":"Rename branch","aria-label":"Rename branch",type:"button",children:bB})]})]}),i!=null&&i.baseRefName?p.jsxs("span",{className:"target-section",children:[p.jsx("span",{className:"target-arrow","aria-hidden":"true",children:p.jsx("svg",{width:"14",height:"10",viewBox:"0 0 14 10","aria-hidden":"true",children:p.jsx("path",{d:"M1 5h10M8 2l3 3-3 3",stroke:"currentColor",fill:"none",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),p.jsx(pB,{workspacePath:e,currentBase:i.baseRefName,prNumber:i.number,disabled:s,onBaseChanged:f})]}):null]})}function wB({isRefreshing:e,prLoading:t,prAction:s,secondaryAction:i,onRefresh:a,onAction:o}){const c=fe(f=>f.rightSidebarCollapsed),d=fe(f=>f.toggleRightSidebarCollapsed);return p.jsxs("div",{className:"bar-right",children:[p.jsx("button",{className:["refresh-btn",e&&"refreshing"].filter(Boolean).join(" "),onClick:a,disabled:e,"aria-label":"Refresh PR data",title:"Refresh PR data",type:"button",children:p.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[p.jsx("path",{d:"M14 8A6 6 0 1 1 8 2",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"}),p.jsx("path",{d:"M8 0L14 2L12 4",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}),t?p.jsx(Uo,{text:"loading",loading:!0}):p.jsxs(p.Fragment,{children:[i?p.jsx(Me,{variant:"ghost",size:"sm","data-track":"pr-top-bar.secondary-action",onClick:()=>o(i),"aria-label":i.label,children:i.label}):null,s.type!=="none"?p.jsx(Me,{variant:mB(s.color),size:"sm","data-track":"pr-top-bar.primary-action",onClick:()=>o(),disabled:s.type==="checks-running","aria-label":s.label,children:s.label}):null]}),p.jsx("button",{className:"sidebar-toggle-btn",onClick:d,"aria-label":c?"Show file sidebar":"Hide file sidebar",title:c?"Show file sidebar":"Hide file sidebar",type:"button",children:p.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[p.jsx("rect",{x:"1",y:"2",width:"14",height:"12",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"square"}),p.jsx("line",{x1:"10",y1:"2",x2:"10",y2:"14",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"square"})]})})]})}function CB(e,t){const s=e?e.isDraft?"DRAFT":e.state:null;return{commitsAhead:e?1:0,prState:s,ciPassing:(t==null?void 0:t.passing)??0,ciFailing:(t==null?void 0:t.failing)??0,ciPending:(t==null?void 0:t.pending)??0,ciTotal:(t==null?void 0:t.total)??0,mergeable:(e==null?void 0:e.mergeable)??null,unresolvedCommentCount:(e==null?void 0:e.unresolvedCommentCount)??0}}function xB(e){return["pr-top-bar",(e==null?void 0:e.state)==="MERGED"&&"bar-merged",(e==null?void 0:e.mergeable)==="CONFLICTING"&&"bar-conflicts"].filter(Boolean).join(" ")}function kB({workspacePath:e,branchName:t,sessionId:s,agentRunning:i=!1,onArchive:a}){const[o,c]=C.useState(t),[d,f]=C.useState(!1);C.useEffect(()=>{c(t)},[t]),C.useEffect(()=>{!t&&e&&a2(e).then(M=>{M&&c(M)})},[t,e]);const{pr:h,ci:g,isRefreshing:_,prLoading:y,refresh:b}=gB(e,o,s),S=_B(e,o,i,h!==null,c),w=CB(h,g),k=wd(w),T=oM(k,w);function D(M=k){const U={branchName:o,baseBranch:(h==null?void 0:h.baseRefName)??"",prNumber:(h==null?void 0:h.number)??0,unresolvedCommentCount:(h==null?void 0:h.unresolvedCommentCount)??0},W=rk(M,U);if(W===null){a==null||a();return}s&&mi(W+"\r")}async function N(){try{await navigator.clipboard.writeText(o),f(!0),setTimeout(()=>f(!1),1500)}catch{}}const E=xB(h);return p.jsxs("div",{className:E,children:[p.jsx(SB,{workspacePath:e,currentBranch:o,agentRunning:i,pr:h,rename:S,copyFeedback:d,onBranchSwitch:c,onCopy:()=>void N(),onBaseChanged:b}),h?p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"bar-middle","aria-label":"pull request",children:p.jsxs("a",{className:"pr-link",href:h.url,target:"_blank",rel:"noopener noreferrer","data-track":"pr-top-bar.open-pr","aria-label":`PR #${h.number}: ${h.title}`,children:["PR #",h.number,p.jsx("svg",{className:"pr-ext-icon",width:"10",height:"10",viewBox:"0 0 10 10","aria-hidden":"true",children:p.jsx("path",{d:"M1 9L9 1M9 1H4M9 1V6",stroke:"currentColor",fill:"none",strokeWidth:"1.5",strokeLinecap:"round"})})]})}),p.jsxs("span",{className:"diff-stats",children:[p.jsxs("span",{className:"diff-add",children:["+",h.additions]}),p.jsxs("span",{className:"diff-del",children:["-",h.deletions]})]})]}):null,p.jsx(wB,{isRefreshing:_,prLoading:y,prAction:k,secondaryAction:T,onRefresh:b,onAction:D}),S.renameWarning?p.jsx(EB,{oldName:S.renameWarning.oldName,newName:S.renameWarning.newName,workspacePath:e,onClose:()=>{S.clearWarning(),b()}}):null]})}function EB({oldName:e,newName:t,workspacePath:s,onClose:i}){const[a,o]=C.useState(null),[c,d]=C.useState(null),f=encodeURIComponent(s),h={background:"var(--surface-hover)",padding:"2px 4px",fontFamily:"var(--font-mono)",fontSize:"var(--font-size-xs)"};async function g(){o("push"),d(null);try{const b=await(await fetch("/workspaces/push-branch?path="+f,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({branch:t,deleteOldBranch:e})})).json();b.success?i():d(b.error??"Push failed")}catch{d("Push failed")}finally{o(null)}}async function _(){o("cancel"),d(null);try{const b=await(await fetch("/workspaces/rename-branch?path="+f,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({newName:e})})).json();b.success?i():d(b.error??"Failed to undo rename")}catch{d("Failed to undo rename")}finally{o(null)}}return p.jsx("div",{className:"rename-modal-overlay",style:{position:"fixed",inset:0,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.6)",zIndex:1e3},onClick:y=>{y.target===y.currentTarget&&i()},children:p.jsxs("div",{style:{background:"var(--surface)",border:"1px solid var(--border)",padding:"24px",maxWidth:"420px",width:"100%",fontFamily:"var(--font-mono)"},children:[p.jsx("h2",{style:{margin:"0 0 16px",fontSize:"var(--font-size-sm)",color:"var(--text)"},children:"Branch Renamed"}),p.jsxs("p",{style:{margin:"0 0 8px",fontSize:"var(--font-size-sm)",color:"var(--text)",lineHeight:1.5},children:["Branch renamed: ",p.jsx("code",{style:h,children:e})," → ",p.jsx("code",{style:h,children:t})]}),p.jsx("p",{style:{margin:"0 0 16px",fontSize:"var(--font-size-xs)",color:"var(--text-muted)",lineHeight:1.5},children:"This PR's head branch no longer matches. Push the renamed branch to update GitHub?"}),c?p.jsx("p",{style:{margin:"0 0 12px",fontSize:"var(--font-size-xs)",color:"var(--status-error)"},children:c}):null,p.jsxs("div",{style:{display:"flex",gap:"8px",flexWrap:"wrap"},children:[p.jsx(Me,{variant:"primary",onClick:()=>void g(),disabled:a!==null,children:a==="push"?"Pushing...":"Push"}),p.jsx(Me,{variant:"ghost",onClick:i,disabled:a!==null,children:"Ignore"}),p.jsx(Me,{variant:"ghost",onClick:()=>void _(),disabled:a!==null,children:a==="cancel"?"Undoing...":"Cancel (undo rename)"})]})]})})}const Jk=p.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"square",width:"14",height:"14",children:[p.jsx("path",{d:"M4 17l6-6-6-6"}),p.jsx("path",{d:"M12 19h8"})]}),eE=p.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"square",width:"14",height:"14",children:[p.jsx("rect",{x:"3",y:"3",width:"18",height:"18"}),p.jsx("path",{d:"M3 9h18"}),p.jsx("path",{d:"M9 21V9"})]}),TB=p.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"square",width:"14",height:"14",children:[p.jsx("circle",{cx:"12",cy:"12",r:"3"}),p.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1-1.51V15H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]});function NB({onNewAgent:e,onNewTerminal:t,onCustomize:s,onKeyDown:i}){return p.jsxs("div",{className:"new-menu",role:"menu",tabIndex:-1,onKeyDown:i,children:[p.jsxs("button",{className:"new-menu-item",role:"menuitem","data-track":"session-tab.new-agent",onClick:e,type:"button",children:[p.jsx("span",{className:"new-menu-icon",children:eE}),"New Agent"]}),p.jsxs("button",{className:"new-menu-item",role:"menuitem","data-track":"session-tab.new-terminal",onClick:t,type:"button",children:[p.jsx("span",{className:"new-menu-icon",children:Jk}),"New Terminal"]}),p.jsx("div",{className:"new-menu-divider"}),p.jsxs("button",{className:"new-menu-item",role:"menuitem","data-track":"session-tab.customize",onClick:s,type:"button",children:[p.jsx("span",{className:"new-menu-icon",children:TB}),"Customize..."]})]})}function AB({session:e,tabName:t,isActive:s,onSelect:i,onClose:a,onCloseKeyDown:o}){const c=e.type==="terminal"?Jk:eE;return p.jsxs("button",{className:["tab",s&&"tab--active"].filter(Boolean).join(" "),role:"tab","aria-selected":s,"aria-label":t,tabIndex:s?0:-1,"data-track":"session-tab.select",onClick:i,type:"button",children:[p.jsx("span",{className:"tab-icon","aria-hidden":"true",children:c}),p.jsx("span",{className:"tab-name",children:t}),p.jsx("span",{className:"tab-close",role:"button","aria-label":`Close ${t}`,"data-track":"session-tab.close",onClick:a,onKeyDown:o,children:"×"})]})}function RB({sessions:e,activeSessionId:t,onSelectSession:s,onCloseSession:i,onNewAgent:a,onNewTerminal:o,onCustomize:c}){const[d,f]=C.useState(!1),[h,g]=C.useState(new Map),_=C.useRef(0),y=C.useRef(0),b=C.useRef(null);C.useEffect(()=>{g(w=>{const k=new Map(w);let T=!1;for(const D of e)k.has(D.id)||(D.type==="terminal"?(y.current+=1,k.set(D.id,`Terminal ${y.current}`)):(_.current+=1,k.set(D.id,`Agent ${_.current}`)),T=!0);return T?k:w})},[e]),C.useEffect(()=>{if(!d)return;const w=k=>{var D;const T=(D=b.current)==null?void 0:D.closest(".new-btn-wrap");k.target&&T&&!T.contains(k.target)&&f(!1)};return window.addEventListener("click",w),()=>window.removeEventListener("click",w)},[d]);const S=w=>{var k;w.key==="Escape"&&d&&(f(!1),(k=b.current)==null||k.focus())};return p.jsxs("div",{className:"session-tab-bar",role:"tablist","aria-label":"Sessions",children:[p.jsx("div",{className:"tabs-scroll",children:e.map(w=>p.jsx(AB,{session:w,tabName:h.get(w.id)??w.id,isActive:w.id===t,onSelect:()=>s(w.id),onClose:k=>{k.stopPropagation(),i(w.id)},onCloseKeyDown:k=>{(k.key==="Enter"||k.key===" ")&&(k.stopPropagation(),i(w.id))}},w.id))}),p.jsxs("div",{className:"new-btn-wrap",children:[p.jsx("button",{ref:b,className:"tab-new","aria-label":"New session","aria-haspopup":"menu","aria-expanded":d,"data-track":"session-tab.new-menu",onClick:()=>f(w=>!w),onKeyDown:S,type:"button",children:"+"}),d?p.jsx(NB,{onNewAgent:()=>{f(!1),a()},onNewTerminal:()=>{f(!1),o()},onCustomize:()=>{f(!1),c()},onKeyDown:S}):null]})]})}function Mm(e){return e<1e3?String(Math.round(e)):e<1e6?`${(e/1e3).toFixed(e>=1e4?0:1)}k`:`${(e/1e6).toFixed(e>=1e7?0:1)}M`}function g1(e){if(!e)return"—";const t=new Date(e);if(Number.isNaN(t.getTime()))return"—";const s=new Date;return t.getFullYear()===s.getFullYear()&&t.getMonth()===s.getMonth()&&t.getDate()===s.getDate()?t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}):t.toLocaleDateString([],{month:"short",day:"numeric"})}function DB(e){return e.role==="author"?"by you":"review requested"}function LB(e){return!e.branches||e.branches.length===0?"":"("+e.branches.join(", ")+")"}function MB(e,t,s){return[...e].sort((i,a)=>a.updatedAt.localeCompare(i.updatedAt))}function OB({repoSessions:e}){const t=Sr(c=>c.summarizeSessionSetTelemetry),s=Sr(c=>c.accountTelemetry),i=C.useMemo(()=>t(e),[t,e]),a=i.totalSessions>0?Math.round(i.trackedSessions/i.totalSessions*100):0,o=i.averageContextPercent!==null?Math.max(0,Math.min(100,Math.round(i.averageContextPercent))):-1;return p.jsxs("section",{className:"dashboard-section",children:[p.jsx("div",{className:"section-heading",children:"usage this window"}),p.jsxs("div",{className:"usage-panel",children:[p.jsxs("div",{className:"usage-row",children:[p.jsx("span",{className:"usage-label",children:"sessions tracked"}),p.jsx("span",{className:"usage-bar",children:p.jsx(tc,{variant:"bar",value:a,width:10})}),p.jsxs("span",{className:"usage-value",children:[i.trackedSessions," of ",i.totalSessions,i.totalSessions>i.trackedSessions&&p.jsxs(p.Fragment,{children:[" (",i.totalSessions-i.trackedSessions," outside relay)"]})]})]}),p.jsxs("div",{className:"usage-row",children:[p.jsx("span",{className:"usage-label",children:"relay tokens"}),p.jsxs("span",{className:"usage-value",children:["↓",Mm(i.totalInputTokens)," ↑",Mm(i.totalOutputTokens)]}),p.jsxs("span",{className:"usage-meta",children:["cache: ",Mm(i.totalCacheRead)," read"]})]}),p.jsxs("div",{className:"usage-row",children:[p.jsx("span",{className:"usage-label",children:"context pressure"}),p.jsx("span",{className:"usage-bar",children:p.jsx(tc,{variant:"bar",value:o>=0?o:0,width:10})}),p.jsxs("span",{className:"usage-value",children:[i.averageContextPercent!==null?`${Math.round(i.averageContextPercent)}% avg`:"—",i.maxContextPercent!==null&&p.jsxs("span",{className:"usage-meta",children:[" peak ",Math.round(i.maxContextPercent),"%"]})]})]}),s&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"usage-divider"}),p.jsxs("div",{className:"usage-row",children:[p.jsx("span",{className:"usage-label",children:"5h limit"}),p.jsx("span",{className:"usage-bar",children:p.jsx(tc,{variant:"bar",value:Math.max(0,Math.min(100,s.fiveHourUsedPercent>=0?s.fiveHourUsedPercent:0)),width:10})}),p.jsx("span",{className:"usage-value",children:s.fiveHourUsedPercent>=0?`${Math.round(s.fiveHourUsedPercent)}% used`:"—"}),p.jsxs("span",{className:"usage-meta",children:["resets ",g1(s.fiveHourResetsAt)]})]}),p.jsxs("div",{className:"usage-row",children:[p.jsx("span",{className:"usage-label",children:"7d limit"}),p.jsx("span",{className:"usage-bar",children:p.jsx(tc,{variant:"bar",value:Math.max(0,Math.min(100,s.sevenDayUsedPercent>=0?s.sevenDayUsedPercent:0)),width:10})}),p.jsx("span",{className:"usage-value",children:s.sevenDayUsedPercent>=0?`${Math.round(s.sevenDayUsedPercent)}% used`:"—"}),p.jsxs("span",{className:"usage-meta",children:["resets ",g1(s.sevenDayResetsAt)]})]})]})]})]})}function jB({data:e,isLoading:t}){return p.jsxs("section",{className:"dashboard-section dashboard-section--scroll",children:[p.jsx("div",{className:"section-heading",children:"recent activity"}),t?p.jsx("div",{className:"scroll-container",children:p.jsx("div",{className:"activity-list",children:[1,2,3].map(s=>p.jsx("div",{className:"activity-row skeleton",children:p.jsx("div",{className:"skeleton-line skeleton-activity"})},s))})}):e&&e.activity.length===0?p.jsx("div",{className:"section-message",children:"No recent commits (24h)"}):e?p.jsx("div",{className:"scroll-container",children:p.jsx("div",{className:"activity-list",children:e.activity.map(s=>p.jsxs("div",{className:"activity-row",children:[p.jsx("span",{className:"commit-hash",children:s.shortHash}),p.jsx("span",{className:"commit-msg",children:s.message}),s.branches.length>0&&p.jsx("span",{className:"commit-branch",children:LB(s)}),p.jsx("span",{className:"commit-time",children:s.timeAgo})]},s.hash))})}):null]})}function PB({pr:e,onOpenPrSession:t,onPrAction:s}){const i=wd(J_(e));return p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"pr-cell pr-cell--status",style:{width:36,flex:"none"},children:p.jsx(Fo,{status:jc(e)})}),p.jsxs("div",{className:"pr-cell pr-cell--title",style:{flex:1},children:[p.jsx("a",{className:"pr-title-link",href:e.url,target:"_blank",rel:"noopener noreferrer",children:e.title}),p.jsxs("div",{className:"pr-row-meta",children:[p.jsxs("span",{className:"pr-num",children:["#",e.number]}),p.jsx("span",{className:"pr-sep",children:"·"}),p.jsx("span",{className:"pr-role",children:DB(e)}),p.jsx("span",{className:"pr-sep",children:"·"}),p.jsx("span",{className:"pr-time",children:Zh(e.updatedAt)})]})]}),p.jsx("div",{className:"pr-cell pr-cell--role",style:{width:60,flex:"none"},children:p.jsx("span",{className:"pr-role-text",children:e.role==="author"?"Author":"Review"})}),p.jsx("div",{className:"pr-cell pr-cell--age",style:{width:50,flex:"none"},children:p.jsx("span",{className:"pr-age-text",children:Zh(e.updatedAt)})}),p.jsx("div",{className:"pr-cell pr-cell--action",style:{width:160,flex:"none"},children:p.jsxs("div",{className:"pr-row-actions",children:[p.jsx(Me,{variant:"ghost",size:"icon",onClick:()=>t(e),title:"Open session on this branch",children:"+"}),i.type!=="none"&&i.label&&p.jsx(Me,{variant:"ghost",size:"sm",onClick:()=>s(e),title:i.label,disabled:i.type==="checks-running",children:i.label})]})})]})}function BB({data:e,isLoading:t,isError:s,workspaceName:i,searchQuery:a,processedPrs:o,onSearchChange:c,onOpenPrSession:d,onPrAction:f}){return e&&!e.hasGhCli?p.jsxs("div",{className:"section-message info",children:["Install GitHub CLI for PR tracking —"," ",p.jsx("a",{href:"https://cli.github.com",target:"_blank",rel:"noopener noreferrer",children:"cli.github.com"})]}):t?p.jsx("div",{className:"section-message",children:"Loading..."}):s?p.jsx("div",{className:"section-message",children:"Could not load pull requests."}):o.length===0&&!a?p.jsxs("div",{className:"section-message",children:["No open PRs for ",i,"."]}):p.jsxs(p.Fragment,{children:[p.jsx("input",{type:"search",placeholder:"filter PRs...",value:a,onChange:h=>c(h.target.value),style:{marginBottom:8,fontFamily:"var(--font-mono)",fontSize:"var(--font-size-xs)",background:"transparent",border:"1px solid var(--border)",color:"var(--text)",padding:"2px 8px"}}),o.length===0?p.jsxs("div",{className:"section-message",children:["No results for '",a,"'."]}):p.jsx("div",{children:o.map(h=>p.jsx("div",{style:{display:"flex",alignItems:"center",borderBottom:"1px solid var(--border)"},children:p.jsx(PB,{pr:h,onOpenPrSession:d,onPrAction:f})},h.number))})]})}function IB({repoPath:e,workspaceName:t,creatingWorktree:s=!1,onNewSession:i,onNewWorktree:a,onFixConflicts:o,onPrAction:c,onOpenPrSession:d}){const f=se(D=>D.sessions),h=C.useMemo(()=>f.filter(D=>D.repoPath===e),[f,e]),[g,_]=C.useState(""),y="age",b="desc",{data:S,isLoading:w,isError:k}=ga({queryKey:["dashboard",e],queryFn:()=>i2(e),staleTime:6e4,refetchOnWindowFocus:!0}),T=C.useMemo(()=>{if(!S)return[];let D=S.prs;const N=g.toLowerCase().trim();return N&&(D=D.filter(E=>E.title.toLowerCase().includes(N)||String(E.number).includes(N)||E.headRefName.toLowerCase().includes(N))),MB(D)},[S,g,y,b]);return p.jsxs("div",{className:"repo-dashboard",children:[S&&!S.isGitRepo?p.jsx("div",{className:"non-git-notice",children:p.jsx("span",{className:"non-git-msg",children:"Not a git repository"})}):p.jsxs(p.Fragment,{children:[p.jsx(OB,{repoSessions:h,repoPath:e}),p.jsxs("section",{className:"dashboard-section dashboard-section--scroll",children:[p.jsx("div",{className:"section-heading",children:"open pull requests"}),p.jsx(BB,{data:S,isLoading:w,isError:k,workspaceName:t,searchQuery:g,processedPrs:T,onSearchChange:_,onOpenPrSession:d,onPrAction:c})]}),p.jsx(jB,{data:S,isLoading:w})]}),p.jsxs("div",{className:"cta-row",children:[p.jsx(Me,{variant:"primary",onClick:i,children:"+ start session"}),(!S||S.isGitRepo)&&p.jsx(Me,{variant:"ghost",onClick:a,disabled:s,children:s?"creating...":"+ new worktree"})]})]})}function zB(e){return e.role==="author"?"by you":"review requested"}function HB(e){return e.ciStatus?e.ciStatus==="SUCCESS"?{icon:"✓",cls:"ci-pass"}:e.ciStatus==="FAILURE"||e.ciStatus==="ERROR"?{icon:"✗",cls:"ci-fail"}:e.ciStatus==="PENDING"?{icon:"○",cls:"ci-pending"}:null:null}function _1(e){return e.reviewDecision==="CHANGES_REQUESTED"&&e.role==="author"?0:e.role==="reviewer"?1:e.role==="author"&&!e.reviewDecision?2:e.reviewDecision==="APPROVED"&&e.ciStatus==="SUCCESS"?3:4}function UB(e,t,s){return t==="role"?[...e].sort((i,a)=>{const o=_1(i)-_1(a);return o!==0?s==="asc"?o:-o:a.updatedAt.localeCompare(i.updatedAt)}):t==="title"?[...e].sort((i,a)=>s==="asc"?i.title.localeCompare(a.title):a.title.localeCompare(i.title)):t==="repo"?[...e].sort((i,a)=>s==="asc"?(i.repoName??"").localeCompare(a.repoName??""):(a.repoName??"").localeCompare(i.repoName??"")):[...e].sort((i,a)=>s==="asc"?i.updatedAt.localeCompare(a.updatedAt):a.updatedAt.localeCompare(i.updatedAt))}function FB(e,t){for(const[s,i]of Object.entries(t))for(const a of i)if(a.branchName===e)return s;return null}function $B({pr:e,branchLinksData:t,onOpenWorkspace:s}){const i=e.repoName??"",a=ev(i),o=FB(e.headRefName,t),c=C.useMemo(()=>{const f=wd(J_(e));return f.type==="merge-pr"||f.type==="archive-merged"||f.type==="archive-closed"?{...f,label:"Open"}:f},[e]),d=HB(e);return p.jsxs("div",{className:"pr-table-row",children:[p.jsx("div",{className:"cell cell--status",style:{width:36,flex:"none"},children:p.jsx(Fo,{status:jc(e)})}),p.jsxs("div",{className:"cell cell--title",style:{flex:1},children:[p.jsx("div",{className:"pr-row-title-line",children:p.jsx("a",{className:"pr-title-link",href:e.url,target:"_blank",rel:"noopener noreferrer",children:e.title})}),p.jsxs("div",{className:"pr-row-meta",children:[p.jsxs("span",{className:"pr-meta-text",children:["#",e.number]}),o&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"pr-sep",children:"·"}),p.jsx("span",{className:"ticket-chip",children:o})]}),p.jsx("span",{className:"pr-sep",children:"·"}),p.jsx("span",{className:"pr-meta-text",children:zB(e)}),p.jsx("span",{className:"pr-sep",children:"·"}),p.jsx("span",{className:"pr-meta-text",children:Zh(e.updatedAt)})]})]}),p.jsx("div",{className:"cell cell--repo",style:{width:100,flex:"none"},children:i&&p.jsx("span",{className:"repo-chip",style:{background:a},title:e.repoPath??i,children:i})}),p.jsx("div",{className:"cell cell--role",style:{width:60,flex:"none"},children:p.jsx("span",{className:"pr-meta-text",children:e.role})}),p.jsx("div",{className:"cell cell--ci",style:{width:32,flex:"none"},children:d&&p.jsx("span",{className:`ci-icon ${d.cls}`,children:d.icon})}),p.jsx("div",{className:"cell cell--age",style:{width:50,flex:"none"},children:p.jsx("span",{className:"pr-meta-text",children:Zh(e.updatedAt)})}),p.jsx("div",{className:"cell cell--action",style:{width:140,flex:"none"},children:c.type!=="none"&&c.label&&p.jsx("button",{onClick:()=>s(e.repoPath??""),title:c.label,children:c.label})})]})}function VB({presets:e,onApply:t,onSave:s,onDelete:i}){const a=C.useCallback(o=>{const c=o.currentTarget.value;if(c==="__save__")o.currentTarget.value="",s();else if(c){const d=e.find(f=>f.name===c);d&&t(d),o.currentTarget.value=""}},[e,t,s]);return p.jsxs("div",{className:"presets-row",children:[p.jsxs("select",{className:"preset-select",defaultValue:"",onChange:a,children:[p.jsx("option",{value:"",disabled:!0,children:"Presets..."}),e.map(o=>p.jsx("option",{value:o.name,children:o.name},o.name)),p.jsx("option",{value:"__save__",children:"Save current view..."})]}),e.filter(o=>!o.builtIn).map(o=>p.jsxs("button",{className:"preset-delete-btn",title:`Delete preset: ${o.name}`,onClick:()=>i(o),children:["× ",o.name]},o.name))]})}function WB(){const e=G_(),{data:t,isLoading:s,isError:i}=ga({queryKey:["org-prs"],queryFn:K_,staleTime:6e4,refetchOnWindowFocus:!0}),{data:a={}}=ga({queryKey:["branch-links"],queryFn:y2,staleTime:6e4,refetchOnWindowFocus:!0}),{data:o=[]}=ga({queryKey:["presets"],queryFn:w2,staleTime:3e4}),[c,d]=C.useState([]),[f,h]=C.useState(""),[g,_]=C.useState("role"),[y,b]=C.useState("asc"),S=(t==null?void 0:t.prs)??[],w=C.useMemo(()=>{let N=S;c.length>0&&(N=N.filter(M=>c.includes(jc(M))));const E=f.toLowerCase().trim();return E&&(N=N.filter(M=>M.title.toLowerCase().includes(E)||String(M.number).includes(E)||(M.headRefName??"").toLowerCase().includes(E))),UB(N,g,y)},[S,c,f,g,y]),k=C.useCallback(N=>{d(N.filters.status??[]),_(N.sort.column),b(N.sort.direction)},[]),T=C.useCallback(async()=>{const N=window.prompt("Save current view as:");if(!N||!N.trim())return;const E={};c.length>0&&(E.status=[...c]),await C2({name:N.trim(),filters:E,sort:{column:g,direction:y}}),await e.invalidateQueries({queryKey:["presets"]})},[c,g,y,e]),D=C.useCallback(async N=>{await x2(N.name),await e.invalidateQueries({queryKey:["presets"]})},[e]);return{data:t,isLoading:s,isError:i,branchLinksData:a,presets:o,allPrs:S,searchQuery:f,setSearchQuery:h,activeStatusChips:c,processedPrs:w,handleApplyPreset:k,handleSaveCurrentView:T,handleDeletePreset:D}}function GB({errorCode:e,onRetry:t}){return e==="gh_not_in_path"?p.jsxs("div",{className:"state-message state-message--info",children:["Install GitHub CLI for PR tracking —"," ",p.jsx("a",{href:"https://cli.github.com",target:"_blank",rel:"noopener noreferrer",children:"cli.github.com"})]}):e==="gh_not_authenticated"?p.jsxs("div",{className:"state-message state-message--info",children:["Run ",p.jsx("code",{children:"gh auth login"})," to connect GitHub."]}):e==="gh_timeout"?p.jsxs("div",{className:"state-message state-message--error",children:[p.jsx("span",{children:"GitHub is taking too long. Try again."}),p.jsx("button",{className:"retry-btn",onClick:t,children:"Retry"})]}):null}function qB({isLoading:e,isError:t,dataError:s,allPrs:i,processedPrs:a,branchLinksData:o,presets:c,searchQuery:d,activeStatusChips:f,setSearchQuery:h,onOpenWorkspace:g,onApplyPreset:_,onSaveView:y,onDeletePreset:b}){const S=i.filter(T=>T.state==="OPEN").length,w=i.filter(T=>T.state==="OPEN"&&(T.reviewDecision==="CHANGES_REQUESTED"||T.role==="reviewer")).length,k=d||f.length>0?"No PRs match filters.":"No open PRs across workspaces.";return p.jsxs(p.Fragment,{children:[p.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:12},children:[!e&&!t&&!s&&p.jsx("span",{className:"org-subtitle",children:S===1?"1 open PR":`${S} open PRs`}),w>0&&p.jsxs("span",{className:"tab-badge",children:[w," need attention"]})]}),!e&&!t&&i.length>0&&p.jsx(VB,{presets:c,onApply:_,onSave:y,onDelete:b}),p.jsxs("div",{children:[p.jsx("input",{type:"search",placeholder:"filter PRs...",value:d,onChange:T=>h(T.target.value),style:{marginBottom:8,fontFamily:"var(--font-mono)",fontSize:"var(--font-size-xs)",background:"transparent",border:"1px solid var(--border)",color:"var(--text)",padding:"2px 8px"}}),e&&p.jsx("div",{className:"state-message",children:"Loading..."}),t&&p.jsx("div",{className:"state-message state-message--error",children:"Could not load pull requests."}),!e&&!t&&a.length===0&&p.jsx("div",{className:"state-message",children:k}),a.map(T=>p.jsx($B,{pr:T,branchLinksData:o,onOpenWorkspace:g},T.number))]})]})}function KB({onOpenWorkspace:e,onRetry:t}){const{data:s,isLoading:i,isError:a,branchLinksData:o,presets:c,allPrs:d,searchQuery:f,setSearchQuery:h,activeStatusChips:g,processedPrs:_,handleApplyPreset:y,handleSaveCurrentView:b,handleDeletePreset:S}=WB();return s!=null&&s.error&&s.error!=="no_workspaces"?p.jsx(GB,{errorCode:s.error,onRetry:t}):(s==null?void 0:s.error)==="no_workspaces"?null:p.jsx(qB,{isLoading:i,isError:a,...s!=null&&s.error?{dataError:s.error}:{},allPrs:d,processedPrs:_,branchLinksData:o,presets:c,searchQuery:f,activeStatusChips:g,setSearchQuery:h,onOpenWorkspace:e,onApplyPreset:y,onSaveView:()=>void b(),onDeletePreset:w=>void S(w)})}function YB({onOpenWorkspace:e,onOpenSession:t}){const[s,i]=C.useState("prs"),[a,o]=C.useState(null),{refetch:c}=ga({queryKey:["org-prs"],queryFn:K_,staleTime:6e4,refetchOnWindowFocus:!0}),d=C.useCallback(()=>{c()},[c]);return C.useCallback(()=>o(null),[]),C.useCallback(f=>{o(null),t==null||t(f)},[t]),p.jsxs("div",{className:"org-dashboard",children:[p.jsx("div",{className:"org-header",children:p.jsx("span",{className:"org-title",children:"All Workspaces"})}),p.jsxs("div",{className:"tab-strip",children:[p.jsx("button",{className:["tab-btn",s==="prs"?"tab-btn--active":""].filter(Boolean).join(" "),onClick:()=>i("prs"),children:"PRs"}),p.jsx("button",{className:["tab-btn",s==="tickets"?"tab-btn--active":""].filter(Boolean).join(" "),onClick:()=>i("tickets"),children:"Tickets"})]}),s==="prs"&&p.jsx(KB,{onOpenWorkspace:e,onRetry:d}),s==="tickets"&&p.jsx("div",{className:"state-message",children:"Tickets panel — Svelte component (TicketsPanel) not yet migrated."})]})}function XB({icon:e,heading:t,description:s,actionLabel:i,onAction:a}){return p.jsxs("div",{className:"empty-state",children:[e&&p.jsx("div",{className:"empty-icon","aria-hidden":"true",children:e}),p.jsx("div",{className:"empty-heading",children:t}),s&&p.jsx("p",{className:"empty-description",children:s}),i&&a&&p.jsx(Me,{variant:"primary",onClick:a,children:i})]})}const v1=[{html:"Tab",key:" ",label:"Tab"},{html:"⇧Tab",key:"\x1B[Z",label:"Shift+Tab"},{html:"↑",key:"\x1B[A",label:"Up arrow",extraClass:"tb-arrow"},{html:"Esc",key:"\x1B",label:"Escape"},{html:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="square" width="14" height="14"><rect x="3" y="5" width="18" height="14"/><circle cx="12" cy="13" r="3"/><path d="M9 5l1-2h4l1 2"/></svg>',id:"upload-image-btn",label:"Upload image"},{html:"^V",id:"paste-btn",label:"Paste from clipboard"},{html:"^C",key:"",label:"Ctrl+C"},{html:"←",key:"\x1B[D",label:"Left arrow",extraClass:"tb-arrow"},{html:"↓",key:"\x1B[B",label:"Down arrow",extraClass:"tb-arrow"},{html:"→",key:"\x1B[C",label:"Right arrow",extraClass:"tb-arrow"},{html:"⇧⏎",key:"\x1B[13;2u",label:"Shift+Enter (newline)",extraClass:"tb-newline"},{html:"⏎",key:"\r",label:"Enter",extraClass:"tb-enter"}],y1=[{html:"Sel",key:" ",label:"Start selection"},{html:"w",key:"w",label:"Word forward"},{html:"b",key:"b",label:"Word backward"},{html:"←",key:"h",label:"Left",extraClass:"tb-arrow"},{html:"↓",key:"j",label:"Down",extraClass:"tb-arrow"},{html:"↑",key:"k",label:"Up",extraClass:"tb-arrow"},{html:"→",key:"l",label:"Right",extraClass:"tb-arrow"},{html:"$",key:"$",label:"End of line"},{html:"0",key:"0",label:"Start of line"},{html:"PgUp",key:"\x1B[5~",label:"Page up"},{html:"Copy",key:"\r",label:"Copy and exit",extraClass:"tb-enter",exitsCopyMode:!0},{html:"Exit",key:"q",label:"Cancel",exitsCopyMode:!0}];function QB({onSendKey:e,onFlushComposedText:t,onClearInput:s,onUploadImage:i,onRefocusMobileInput:a,inCopyMode:o=!1,onExitCopyMode:c,isMobileDevice:d=!1}){function f(y){var b;if(y.id==="upload-image-btn"){i(),d&&a();return}if(y.id==="paste-btn"){(b=navigator.clipboard)!=null&&b.readText?navigator.clipboard.readText().then(S=>{S&&e(S)}).catch(()=>i()):i(),d&&a();return}y.key&&((y.key==="\r"||y.key==="\x1B[13;2u")&&t(),e(y.key),(y.key==="\r"||y.key==="\x1B[13;2u")&&s(),d&&a())}function h(y){e(y.key),y.exitsCopyMode&&(c==null||c()),d&&a()}function g(y){y.preventDefault();const b=y.target.closest("button");if(!b)return;if(o){const w=y1.find(k=>b.dataset.key===k.key);w&&h(w);return}const S=v1.find(w=>w.id===b.id||w.key&&b.dataset.key===w.key);S&&f(S)}if(!d)return null;const _=o?y1:v1;return p.jsx("div",{className:"toolbar",role:"toolbar",onMouseDown:g,children:p.jsx("div",{className:"toolbar-grid",children:_.map(y=>p.jsx("button",{className:["tb-btn",y.extraClass??""].filter(Boolean).join(" "),id:"id"in y?y.id:void 0,"data-key":y.key,"data-track":`toolbar.${y.label.toLowerCase().replace(/[^a-z0-9]/g,"-")}`,"aria-label":y.label,dangerouslySetInnerHTML:{__html:y.html}},y.label))})})}function ZB({title:e,onMenuClick:t,onCommandClick:s,hidden:i=!1}){return p.jsxs("div",{className:`mobile-header${i?" hidden":""}`,children:[p.jsx("button",{className:"icon-btn","aria-label":"Open sessions menu",onClick:t,children:"☰"}),p.jsx("span",{className:"mobile-title",children:e}),p.jsx("button",{className:"command-trigger","aria-label":"Open command palette",onClick:s,children:"> command"})]})}const g_=10;function b1(e){if(e==null||Number.isNaN(e))return"—";const t=Math.abs(e);return t<1e3?String(Math.round(e)):t<1e6?`${(e/1e3).toFixed(t>=1e4?0:1)}k`:t<1e9?`${(e/1e6).toFixed(t>=1e7?0:1)}M`:`${(e/1e9).toFixed(1)}B`}function JB(e){return e==null||Number.isNaN(e)?"~$—":`~$${e.toFixed(2)}`}function S1(e){if(!e)return"—";const t=new Date(e);if(Number.isNaN(t.getTime()))return"—";const s=new Date;if(t.getFullYear()===s.getFullYear()&&t.getMonth()===s.getMonth()&&t.getDate()===s.getDate())return t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1});const a=t.getFullYear()===s.getFullYear();return t.toLocaleDateString([],a?{month:"short",day:"numeric"}:{month:"short",day:"numeric",year:"2-digit"})}function e5(e){const t=Math.max(0,Math.min(100,e)),s=Math.round(t/100*g_);return`${"█".repeat(s)}${"░".repeat(g_-s)}`}function t5(e){return!e||e.contextPercent<0?"muted":e.contextPercent>=85?"danger":e.contextPercent>=60?"warning":"ok"}function s5(e){return e&&e.contextPercent>=0?`${e5(e.contextPercent)} ${Math.round(e.contextPercent)}%`:`${"░".repeat(g_)} —%`}function i5(e){if(!e)return"—";const t=[];return e.fiveHourUsedPercent>=0&&t.push(`5h: ${Math.round(e.fiveHourUsedPercent)}%`),e.sevenDayUsedPercent>=0&&t.push(`7d: ${Math.round(e.sevenDayUsedPercent)}%`),t.length>0?t.join(" | "):"—"}function n5({sessionId:e,currentActivity:t=null}){const s=fe(y=>y.keyboardOpen),i=Sr(y=>y.sessionTelemetryById),a=Sr(y=>y.accountTelemetry),o=e?i[e]??null:null,c=t5(o),d=s5(o),f=c==="ok"?"status-context status-segment":`status-context status-segment status-context--${c}`,h=t?`${t.tool}${t.detail?`: ${t.detail}`:""}`:"idle",g=i5(a),_=o?`turns ${o.turnCount} · subagents ${o.subagentCount} · context ${o.contextWindowSize||"unknown"}`:"telemetry unavailable";return p.jsxs("div",{className:"session-status-bar",hidden:s,children:[p.jsxs("div",{className:"status-left",children:[p.jsx("span",{className:"status-model status-segment",title:_,children:(o==null?void 0:o.model)??"—"}),p.jsx("span",{className:f,title:_,children:d}),p.jsxs("span",{className:"status-tokens status-segment",title:_,children:["↓",o?b1(o.totalInputTokens):"—"," ↑",o?b1(o.totalOutputTokens):"—"]}),p.jsx("span",{className:"status-cost status-segment",title:_,children:o?JB(o.costUsd):"~$—"}),p.jsxs("span",{className:"status-activity status-segment",title:h,children:["[",h,"]"]})]}),p.jsx("div",{className:"status-right",children:p.jsx("span",{className:"status-rate-limits status-segment",title:`${S1(a==null?void 0:a.fiveHourResetsAt)} · ${S1(a==null?void 0:a.sevenDayResetsAt)}`,children:g})})]})}const r5=()=>{const[e,t]=qe.useState(!1),[s,i]=qe.useState(""),[a,o]=qe.useState("Update Now"),[c,d]=qe.useState(!1),[f,h]=qe.useState(!0),g=qe.useRef(!1),_=qe.useRef(null);qe.useEffect(()=>{if(!g.current)return g.current=!0,(async()=>{try{const S=await dx();S.updateAvailable&&(i(`Update available: v${S.current} → v${S.latest}`),o("Update Now"),d(!1),h(!0),t(!0))}catch{}})(),()=>{_.current!==null&&window.clearTimeout(_.current)}},[]);const y=qe.useCallback(async()=>{d(!0),o("Updating…");try{(await fx()).restarting?(i("Updated! Restarting server…"),h(!1),_.current=window.setTimeout(()=>{window.location.reload()},5e3)):(i("Updated! Please restart the server manually."),h(!1))}catch{i("Update failed. Please try again."),d(!1),o("Retry"),h(!0)}},[]),b=qe.useCallback(()=>{t(!1)},[]);return e?p.jsx("div",{className:"update-toast",children:p.jsxs("div",{className:"update-toast-content",children:[p.jsx("span",{className:"update-toast-text",children:s}),f?p.jsxs("div",{className:"update-toast-actions",children:[p.jsx(Me,{variant:"primary",size:"sm",onClick:y,disabled:c,children:a}),p.jsx("button",{className:"update-toast-dismiss",onClick:b,"aria-label":"Dismiss",children:"×"})]}):null]})}):null},a5=qe.forwardRef(function(t,s){const[i,a]=qe.useState(!1),[o,c]=qe.useState(""),[d,f]=qe.useState(!1),h=qe.useRef(null),g=qe.useRef(null),_=qe.useCallback(()=>{g.current!==null&&(window.clearTimeout(g.current),g.current=null)},[]),y=qe.useCallback(()=>{a(!1),h.current=null,_()},[_]),b=qe.useCallback((k,T,D)=>{_(),c(k),f(T),h.current=D??null,a(!0)},[_]),S=qe.useCallback(k=>{_(),g.current=window.setTimeout(()=>{h.current||y()},k)},[_,y]);qe.useImperativeHandle(s,()=>({show:b,hide:y,autoDismiss:S}),[S,y,b]),qe.useEffect(()=>()=>_(),[_]);const w=qe.useCallback(()=>{h.current&&mi(h.current),y()},[y]);return i?p.jsx("div",{className:"image-toast",children:p.jsxs("div",{className:"image-toast-content",children:[p.jsx("span",{className:"image-toast-text",children:o}),p.jsxs("div",{className:"image-toast-actions",children:[d?p.jsx(Me,{variant:"primary",size:"sm",onClick:w,children:"Insert"}):null,p.jsx("button",{className:"image-toast-dismiss",onClick:y,"aria-label":"Dismiss",children:"×"})]})]})}):null});let o5=0;const w1=En(e=>({toasts:[],showToast:(t,s="error",i=5e3)=>{const a=o5++;e(o=>({toasts:[...o.toasts,{id:a,message:t,variant:s}]})),setTimeout(()=>{e(o=>({toasts:o.toasts.filter(c=>c.id!==a)}))},i)},dismissToast:t=>{e(s=>({toasts:s.toasts.filter(i=>i.id!==t)}))}})),l5=()=>{const e=w1(s=>s.toasts),t=w1(s=>s.dismissToast);return e.length===0?null:p.jsx("div",{className:"error-toast-container",children:e.map(s=>p.jsx("div",{className:`error-toast ${s.variant==="error"?"error-toast--error":"error-toast--info"}`,children:p.jsxs("div",{className:"error-toast-content",children:[p.jsx("span",{className:"error-toast-text",children:s.message}),p.jsx("button",{className:"error-toast-dismiss",onClick:()=>t(s.id),"aria-label":"Dismiss",children:"×"})]})},s.id))})},Xr=["all","sessions","workspaces","prs","settings"],Xl="section-general",Om="section-integrations",C1="section-advanced",c5="section-about",u5=[{id:"setting-agent",label:"Default Coding Agent",description:"Which AI agent to use",section:Xl},{id:"setting-continue",label:"Continue Session",description:"Resume last session when opening a repo",section:Xl},{id:"setting-yolo",label:"YOLO Mode",description:"Skip permission checks",section:Xl},{id:"setting-tmux",label:"Launch in tmux",description:"Wrap sessions in tmux",section:Xl},{id:"setting-notifications",label:"Notifications",description:"Push notifications for sessions",section:Xl},{id:"setting-github",label:"GitHub Connection",description:"Connect GitHub account for PRs and CI",section:Om},{id:"setting-webhooks",label:"Webhooks",description:"Real-time CI and PR updates",section:Om},{id:"setting-jira",label:"Jira",description:"See Jira tickets in the sidebar",section:Om},{id:"setting-devtools",label:"Developer Tools",description:"Mobile debug panel",section:C1},{id:"setting-analytics",label:"Analytics",description:"Local usage data",section:C1},{id:"setting-version",label:"Version",description:"Check for updates",section:c5}];function h5(e){switch(e){case"workspace":return"■";case"session":return"▸";case"pr":case"attention":return"●";case"ticket":return"#";case"command":return">";case"setting":return"*";default:return""}}function x1(e,t){return t==="all"?!0:t==="sessions"?e==="session"||e==="command":t==="workspaces"?e==="workspace":t==="prs"?e==="pr"||e==="attention":t==="settings"?e==="setting"||e==="command":!0}function d5(e){const t=G_(),s=C.useMemo(()=>{var o;return((o=t.getQueryData(["org-prs"]))==null?void 0:o.prs)??[]},[t,e]),i=C.useMemo(()=>{var o;return((o=t.getQueryData(["github-issues"]))==null?void 0:o.issues)??[]},[t,e]),a=C.useMemo(()=>{var o;return((o=t.getQueryData(["jira-issues"]))==null?void 0:o.issues)??[]},[t,e]);return{cachedPrs:s,cachedGithubIssues:i,cachedJiraIssues:a}}function f5(e,t,s,i,a,o,c,d,f){const h=[];if(!e){for(const g of d)h.push({type:"attention",id:`attn-${g.number}`,label:`#${g.number} ${g.title}`,sublabel:g.repoName??"",data:g});for(const g of t.slice(0,5))h.push({type:"workspace",id:`ws-${g.path}`,label:g.name,sublabel:g.path,data:g});for(const g of c)h.push({type:"command",id:`cmd-${g.id}`,label:g.label,sublabel:g.description??"",data:g});return h.filter(g=>x1(g.type,f))}for(const g of t.filter(_=>_.name.toLowerCase().includes(e)).slice(0,5))h.push({type:"workspace",id:`ws-${g.path}`,label:g.name,sublabel:g.path,data:g});for(const g of s.filter(_=>_.displayName.toLowerCase().includes(e)||_.branchName.toLowerCase().includes(e)||_.repoName.toLowerCase().includes(e)).slice(0,5))h.push({type:"session",id:`sess-${g.id}`,label:g.displayName||g.branchName||g.repoName,sublabel:g.repoName,data:g});for(const g of i.filter(_=>_.title.toLowerCase().includes(e)||String(_.number).includes(e)||_.headRefName.toLowerCase().includes(e)).slice(0,5))h.push({type:"pr",id:`pr-${g.number}`,label:`#${g.number} ${g.title}`,sublabel:g.repoName??g.headRefName,data:g});for(const g of a.filter(_=>_.title.toLowerCase().includes(e)||String(_.number).includes(e)).slice(0,3))h.push({type:"ticket",id:`gh-${g.number}`,label:`#${g.number} ${g.title}`,sublabel:g.repoName,data:g});for(const g of o.filter(_=>_.title.toLowerCase().includes(e)||_.key.toLowerCase().includes(e)).slice(0,3))h.push({type:"ticket",id:`jira-${g.key}`,label:`${g.key} ${g.title}`,sublabel:g.status,data:g});for(const g of c.filter(_=>{var y,b;return _.label.toLowerCase().includes(e)||((y=_.description)==null?void 0:y.toLowerCase().includes(e))||((b=_.aliases)==null?void 0:b.some(S=>S.toLowerCase().includes(e)))}))h.push({type:"command",id:`cmd-${g.id}`,label:g.label,sublabel:g.description??"",data:g});for(const g of u5.filter(_=>_.label.toLowerCase().includes(e)||_.description.toLowerCase().includes(e)))h.push({type:"setting",id:g.id,label:g.label,sublabel:g.description,data:g});return h.filter(g=>x1(g.type,f))}function p5(e,t,s,i,a,o,c,d,f){return C.useMemo(()=>{const h=e.toLowerCase().trim();return f5(h,t,s,i,a,o,c,d,f)},[e,t,s,i,a,o,c,d,f])}function m5(e,t){return C.useMemo(()=>(t.toLowerCase().trim()?[{type:"workspace",label:"workspaces"},{type:"session",label:"sessions"},{type:"pr",label:"pull requests"},{type:"ticket",label:"tickets"},{type:"command",label:"commands"},{type:"setting",label:"settings"}]:[{type:"attention",label:"needs attention"},{type:"workspace",label:"workspaces"},{type:"command",label:"commands"}]).flatMap(({type:a,label:o})=>{const c=e.filter(d=>d.type===a);return c.length>0?[{label:o,items:c}]:[]}),[e,t])}function g5(e,t){const[s,i]=C.useState(""),[a,o]=C.useState(""),[c,d]=C.useState(0),[f,h]=C.useState("all"),[g,_]=C.useState(0),[y,b]=C.useState(!1),S=C.useRef(0);return C.useEffect(()=>{e&&(i(""),o(""),d(0),h("all"),_(0),b(!1),requestAnimationFrame(()=>{var w;return(w=t.current)==null?void 0:w.focus()}))},[e,t]),C.useEffect(()=>{const w=setTimeout(()=>o(s),150);return()=>clearTimeout(w)},[s]),{query:s,setQuery:i,debouncedQuery:a,focusedIndex:c,setFocusedIndex:d,activeTab:f,setActiveTab:h,dragOffset:g,setDragOffset:_,dragging:y,setDragging:b,dragStartYRef:S}}function _5(e,t,s,i,a,o,c,d,f,h,g,_,y,b,S,w,k){const T=C.useCallback(()=>{requestAnimationFrame(()=>{var B;(B=document.querySelector(".palette-item.focused"))==null||B.scrollIntoView({block:"nearest"})})},[]),D=C.useCallback(async B=>{if(B.type==="command"){try{await B.data.handler(_)}finally{y()}return}y(),B.type==="workspace"?b(B.data.path):B.type==="session"?S(B.data.id):B.type==="attention"||B.type==="pr"?w(B.data):B.type==="setting"&&(k==null||k(B.data.section))},[_,y,b,S,w,k]),N=C.useCallback(B=>{if(B.key==="Escape"){B.preventDefault(),y();return}if(B.key==="ArrowDown"){B.preventDefault(),i($=>Math.min($+1,e.length-1)),T();return}if(B.key==="ArrowUp"){B.preventDefault(),i($=>Math.max($-1,0)),T();return}if(B.key==="Enter"){B.preventDefault();const $=e[t];$&&D($);return}if(B.key==="Tab"){B.preventDefault();const $=Xr.indexOf(s);a(B.shiftKey?Xr[($-1+Xr.length)%Xr.length]:Xr[($+1)%Xr.length]),i(0)}},[y,e,t,T,D,s,a,i]),E=C.useCallback(B=>{B.target.classList.contains("palette-overlay")&&y()},[y]),M=C.useCallback(B=>{if(!Qe)return;const $=B.target;!($.classList.contains("drag-handle")||$.classList.contains("drag-bar"))&&g.current&&g.current.scrollTop>0||(h.current=B.touches[0].clientY,d(!0))},[h,g,d]),U=C.useCallback(B=>{if(!o)return;const $=B.touches[0].clientY-h.current;$>0&&f($)},[o,h,f]),W=C.useCallback(()=>{o&&(d(!1),c>100&&y(),f(0))},[o,c,y,d,f]);return{handleKeydown:N,handleBackdropClick:E,handleDragStart:M,handleDragMove:U,handleDragEnd:W,selectItem:D}}function v5({open:e,workspaces:t,sessions:s,actionContext:i,onClose:a,onSelectWorkspace:o,onSelectSession:c,onSelectPr:d,onOpenSettings:f}){const h=C.useRef(null),g=C.useRef(null),{query:_,setQuery:y,debouncedQuery:b,focusedIndex:S,setFocusedIndex:w,activeTab:k,setActiveTab:T,dragOffset:D,setDragOffset:N,dragging:E,setDragging:M,dragStartYRef:U}=g5(e,h),{cachedPrs:W,cachedGithubIssues:B,cachedJiraIssues:$}=d5(e),Y=C.useMemo(()=>ik().filter(I=>!I.when||I.when(i)),[i]),K=C.useMemo(()=>W.filter(I=>I.state==="OPEN"&&(I.reviewDecision==="CHANGES_REQUESTED"||I.role==="reviewer")).slice(0,5),[W]),X=p5(b,t,s,W,B,$,Y,K,k),P=m5(X,b),j=C.useMemo(()=>P.flatMap(I=>I.items),[P]);C.useEffect(()=>{S>=j.length&&w(Math.max(0,j.length-1))},[j.length,S,w]);const{handleKeydown:H,handleBackdropClick:O,handleDragStart:z,handleDragMove:Q,handleDragEnd:re,selectItem:ne}=_5(j,S,k,w,T,E,D,M,N,U,g,i,a,o,c,d,f);if(!e)return null;const A=Qe&&D>0?{transform:`translateY(${D}px)`}:void 0;return p.jsx("div",{className:["palette-overlay",Qe?"mobile":""].filter(Boolean).join(" "),onClick:O,children:p.jsxs("div",{className:["palette",Qe?"mobile":""].filter(Boolean).join(" "),role:"dialog",tabIndex:-1,"aria-modal":"true","aria-label":"Command palette",style:A,onTouchStart:Qe?z:void 0,onTouchMove:Qe?Q:void 0,onTouchEnd:Qe?re:void 0,onTouchCancel:Qe?re:void 0,children:[Qe&&p.jsx("div",{className:"drag-handle",children:p.jsx("span",{className:"drag-bar"})}),p.jsxs("div",{className:"palette-input-row",children:[p.jsx("span",{className:"palette-prompt",children:">"}),p.jsx("input",{ref:h,className:"palette-search-input",value:_,onChange:I=>y(I.target.value),onKeyDown:H,placeholder:"search commands, workspaces, sessions...",autoComplete:"off",spellCheck:!1,role:"combobox","aria-expanded":j.length>0,"aria-controls":"palette-results","aria-activedescendant":j[S]?`palette-item-${j[S].id}`:void 0})]}),p.jsx("div",{className:"palette-tabs",role:"tablist",children:Xr.map(I=>p.jsx("button",{className:["palette-tab",k===I?"active":""].filter(Boolean).join(" "),role:"tab","aria-selected":k===I,onClick:()=>{T(I),w(0)},children:I},I))}),(()=>{const I=new Map(j.map((q,oe)=>[q.id,oe]));return j.length===0&&b.trim()?p.jsx("div",{className:"palette-results",ref:g,role:"listbox",children:p.jsxs("div",{className:"palette-empty",children:['no results for "',b,'"']})}):p.jsx("div",{className:"palette-results",id:"palette-results",role:"listbox",ref:g,children:P.map(q=>p.jsxs("div",{role:"presentation",children:[p.jsxs("div",{className:"palette-category",role:"presentation",children:[q.label,q.label==="needs attention"&&p.jsxs("span",{className:"category-count",children:["(",q.items.length,")"]})]}),q.items.map(oe=>{const ve=I.get(oe.id)??-1,Se=ve===S;return p.jsxs("div",{id:`palette-item-${oe.id}`,className:["palette-item",Se?"focused":""].filter(Boolean).join(" "),role:"option",tabIndex:-1,"aria-selected":Se,onClick:()=>void ne(oe),onMouseEnter:()=>w(ve),children:[p.jsx("span",{className:["item-cursor",Se?"visible":""].filter(Boolean).join(" "),children:">"}),oe.type==="attention"||oe.type==="pr"?p.jsx(Fo,{status:jc(oe.data),size:7}):oe.type==="command"&&oe.data.icon?p.jsx("span",{className:"item-icon",children:oe.data.icon}):p.jsx("span",{className:"item-icon",children:h5(oe.type)}),p.jsx("span",{className:"item-label",children:oe.label}),oe.sublabel&&p.jsx("span",{className:"item-sublabel",children:oe.sublabel}),!Qe&&oe.type==="command"&&oe.data.shortcut&&p.jsx("kbd",{className:"item-shortcut",children:UD(oe.data.shortcut.key,Ag)})]},oe.id)})]},q.label))})})(),!Qe&&p.jsxs("div",{className:"palette-footer",children:[p.jsx("span",{className:"hint",children:"↑↓ navigate"}),p.jsx("span",{className:"hint",children:"tab category"}),p.jsx("span",{className:"hint",children:"↵ select"}),p.jsx("span",{className:"hint",children:"esc close"})]})]})})}function y5(e,t){if(!t.trim())return e;const s=t.toLowerCase();return e.filter(i=>i.label.toLowerCase().includes(s))}function b5({items:e,placeholder:t="Search...",onSelect:s,onClose:i}){const[a,o]=C.useState(""),[c,d]=C.useState(0),f=C.useRef(null),h=C.useRef(null),g=C.useMemo(()=>y5(e,a),[e,a]);C.useEffect(()=>{d(0)},[a]),C.useEffect(()=>{const S=window.requestAnimationFrame(()=>{var w;return(w=f.current)==null?void 0:w.focus()});return()=>window.cancelAnimationFrame(S)},[]),C.useEffect(()=>{const S=w=>{w.key==="Escape"&&(w.preventDefault(),i())};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[i]);function _(S){queueMicrotask(()=>{var k;const w=(k=h.current)==null?void 0:k.querySelector(`[data-picker-index="${S}"]`);w&&w.scrollIntoView({block:"nearest"})})}function y(S){if(S.key==="ArrowDown"){S.preventDefault();const w=Math.min(c+1,g.length-1);d(w),_(w)}else if(S.key==="ArrowUp"){S.preventDefault();const w=Math.max(c-1,0);d(w),_(w)}else if(S.key==="Enter"){S.preventDefault();const w=g[c];w&&s(w)}}function b(S){S.target===S.currentTarget&&i()}return p.jsx("div",{className:"open-picker",onClick:b,role:"dialog","aria-modal":"true","aria-label":"Item picker",children:p.jsxs("div",{className:"open-picker__panel",children:[p.jsxs("div",{className:"open-picker__input-row",children:[p.jsx("span",{className:"open-picker__prompt",children:">"}),p.jsx("input",{ref:f,type:"text",className:"open-picker__input",placeholder:t,value:a,onChange:S=>o(S.currentTarget.value),onKeyDown:y,"aria-label":t,role:"combobox","aria-expanded":"true","aria-haspopup":"listbox","aria-autocomplete":"list"})]}),p.jsx("div",{className:"open-picker__list",ref:h,role:"listbox",children:g.length===0?p.jsx("div",{className:"open-picker__empty",children:"No results"}):g.map((S,w)=>p.jsxs("div",{className:["open-picker__item",c===w&&"open-picker__item--focused"].filter(Boolean).join(" "),role:"option","aria-selected":c===w,"data-picker-index":w,onClick:()=>s(S),onMouseEnter:()=>d(w),tabIndex:-1,children:[p.jsx("span",{className:"open-picker__cursor","aria-hidden":"true",children:">"}),p.jsx("span",{className:"open-picker__label",children:S.label}),S.hint?p.jsx("span",{className:"open-picker__hint",children:S.hint}):null]},S.id))})]})})}function S5(e,t){let s=0;for(let i=0;i<t.length&&s<e.length;i++)t[i]===e[s]&&s++;return s===e.length}const w5=6,C5=3,x5=3,k1=8,k5=5,E5=2,T5=1,E1=-3,T1=-1;function N1(e){return e==="/"||e==="\\"||e==="-"||e==="_"||e==="."||e===" "}function A1(e){return e>="A"&&e<="Z"}function N5(e,t,s,i,a){let o=1;if(a>0&&(o+=a<x5?w5:C5),i===0)o+=k1;else if(N1(s[i-1])){const c=s[i-1];o+=c==="/"||c==="\\"?k5:k1}return i>0&&A1(s[i])&&!A1(s[i-1])&&!N1(s[i-1])&&(o+=E5),e[t]===s[i]&&(o+=T5),o}function R1(e,t){const s=e.length,i=t.length;if(s===0||i===0||s>i)return null;const a=e.toLowerCase(),o=t.toLowerCase();if(!S5(a,o))return null;const c=s*i,d=new Float64Array(c),f=new Uint16Array(c),h=new Uint8Array(c);for(let k=0;k<s;k++){let T=!1;for(let D=0;D<i;D++){const N=k*i+D;if(a[k]===o[D]){const E=k>0&&D>0?f[(k-1)*i+(D-1)]??0:0,M=N5(e,k,t,D,E);let U;k===0&&D===0||k===0?U=M:D===0?U=-1/0:U=(d[(k-1)*i+(D-1)]??0)+M;const W=D>0?(d[N-1]??0)+(h[N-1]?E1:T1):-1/0;U>=W?(d[N]=U,f[N]=E+1,h[N]=1):(d[N]=W,f[N]=0,h[N]=0),T=!0}else{if(D>0){const E=h[N-1]?E1:T1;d[N]=(d[N-1]??0)+E}else d[N]=-1/0;f[N]=0,h[N]=0}}if(!T)return null}let g=-1/0,_=-1;const y=(s-1)*i;for(let k=0;k<i;k++){const T=d[y+k]??0;T>g&&(g=T,_=k)}if(g<=0||_<0)return null;const b=[];let S=s-1,w=_;for(;S>=0&&w>=0;){const k=S*i+w;h[k]&&(b.push(w),S--),w--}return b.reverse(),{score:g,positions:b}}const A5=1e4,R5=5e3;function D1(e){if(e.length===0)return[];const t=[];let s=e[0],i=s+1;for(let a=1;a<e.length;a++)e[a]===i?i++:(t.push([s,i]),s=e[a],i=s+1);return t.push([s,i]),t}function D5(e,t){if(!e||!t)return null;const s=t.lastIndexOf("/"),i=s>=0?t.slice(s+1):t,a=s>=0?s+1:0,o=R1(e,i);if(o&&o.score>0){const d=o.positions.map(y=>y+a),h=i.toLowerCase().startsWith(e.toLowerCase())?A5:R5,g=Math.floor(e.length/i.length*100),_=Math.floor(t.length*.5);return{score:o.score+h+g-_,matches:D1(d)}}const c=R1(e,t);if(c&&c.score>0){const d=Math.floor(t.length*.5);return{score:c.score-d,matches:D1(c.positions)}}return null}function L5(e){if(e.length===0)return[];const t={isDirectory:!0,children:[],additions:0,deletions:0,fileCount:0};for(const o of e){const c=o.path.split("/");let d=t;for(let f=0;f<c.length;f++){const h=c[f],g=f===c.length-1,_=c.slice(0,f+1).join("/");if(g)d.children.push({name:h,path:o.path,isDirectory:!1,children:[],expanded:!1,status:o.status,additions:o.additions,deletions:o.deletions,fileCount:1,depth:f});else{let y=d.children.find(b=>b.isDirectory&&b.name===h);y||(y={name:h,path:_,isDirectory:!0,children:[],expanded:!0,additions:0,deletions:0,fileCount:0,depth:f},d.children.push(y)),d=y}}}function s(o){if(!o.isDirectory)return;let c=0,d=0,f=0;for(const h of o.children)s(h),c+=h.additions,d+=h.deletions,f+=h.fileCount;o.additions=c,o.deletions=d,o.fileCount=f}s(t);function i(o){return o.map(c=>{if(!c.isDirectory)return c;if(c.children=i(c.children),c.children.length===1&&c.children[0].isDirectory){const d=c.children[0];return{...d,name:`${c.name}/${d.name}`,depth:c.depth,children:d.children}}return c})}function a(o){o.sort((c,d)=>c.isDirectory!==d.isDirectory?c.isDirectory?-1:1:c.name.localeCompare(d.name));for(const c of o)c.isDirectory&&a(c.children);return o}return a(i(t.children))}function tE(e,t=0){const s=[];for(let i=0;i<e.length;i++){const a=e[i];s.push({node:a,depth:t}),a.isDirectory&&a.expanded&&s.push(...tE(a.children,t+1))}return s}function M5(e,t){return`\`${e}:${t}\``}function sE(e){switch(e){case"added":return"A";case"modified":return"M";case"deleted":return"D";case"renamed":return"R";case"untracked":return"?"}}function iE(e){switch(e){case"added":return"var(--status-success)";case"modified":return"var(--status-warning)";case"deleted":return"var(--status-error)";case"renamed":return"var(--status-info)";case"untracked":return"var(--text-muted)"}}async function O5(e){const t=new URLSearchParams({path:e}),s=await fetch("/workspaces/files-list?"+t.toString());if(!s.ok)throw new Error(`files-list failed: ${s.status}`);return s.json()}const jm=64;function Pm(e,t,s,i){for(const a of s)if(!t.has(a)&&(t.add(a),e.push(a),e.length>=i))return}function j5(e,t,s,i){const a=new Set,o=[];return Pm(o,a,s.filter(c=>e.has(c.filePath)).map(c=>c.filePath),jm),Pm(o,a,i.filter(c=>e.has(c)),jm),Pm(o,a,t,jm),o.map(c=>({path:c,result:{score:0,matches:[]}}))}function P5(e,t,s,i){const a=new Set(t),o=e.trim();let c;return o?(c=t.flatMap(d=>{const f=D5(o,d);return f?[{path:d,result:f}]:[]}),c.sort((d,f)=>f.result.score-d.result.score)):c=j5(a,t,s,i),c.map(d=>{const f=d.path.lastIndexOf("/");return{path:d.path,filename:f>=0?d.path.slice(f+1):d.path,directory:f>=0?d.path.slice(0,f+1):"",result:d.result}})}function B5(e,t,s){const i=new Set(t.map(_=>_.filePath)),a=new Set(s),o=e.filter(_=>i.has(_.path)).slice(0,5),c=new Set(o.map(_=>_.path)),d=e.filter(_=>a.has(_.path)&&!c.has(_.path)).slice(0,10),f=new Set(d.map(_=>_.path)),h=e.filter(_=>!c.has(_.path)&&!f.has(_.path)).slice(0,20),g=[];return o.length>0&&g.push({label:"recent",items:o}),d.length>0&&g.push({label:"changed",items:d}),h.length>0&&g.push({label:"files",items:h}),g}function L1(e,t,s){if(t.length===0)return[{text:e,highlight:!1}];const i=[];let a=0;for(const[o,c]of t){const d=o-s,f=c-s;if(f<=0||d>=e.length)continue;const h=Math.max(0,d),g=Math.min(e.length,f);h>a&&i.push({text:e.slice(a,h),highlight:!1}),i.push({text:e.slice(h,g),highlight:!0}),a=g}return a<e.length&&i.push({text:e.slice(a),highlight:!1}),i.length>0?i:[{text:e,highlight:!1}]}function I5({item:e,globalIndex:t,focusedIndex:s,changedSet:i,onSelect:a,onHover:o}){const c=t===s,d=0,f=e.path.length-e.filename.length;return p.jsxs("div",{className:["file-picker-item",c?"focused":""].filter(Boolean).join(" "),role:"option",tabIndex:-1,"aria-selected":c,onClick:()=>a(e.path,i.has(e.path)),onMouseEnter:()=>o(t),children:[p.jsx("span",{className:["fp-item-cursor",c?"visible":""].filter(Boolean).join(" "),children:">"}),p.jsx("span",{className:"fp-item-filename",children:L1(e.filename,e.result.matches,f).map((h,g)=>h.highlight?p.jsx("span",{className:"fp-match",children:h.text},g):h.text)}),p.jsx("span",{className:"fp-item-directory",children:L1(e.directory,e.result.matches,d).map((h,g)=>h.highlight?p.jsx("span",{className:"fp-match",children:h.text},g):h.text)}),e.status&&p.jsx("span",{className:"fp-item-badge",style:{color:iE(e.status)},children:sE(e.status)})]})}function z5(e){const[t,s]=C.useState(0),i=C.useRef(0),a=C.useRef(!1),o=C.useCallback((f,h)=>{if(!Qe)return;const g=f.target;!(g.classList.contains("fp-drag-handle")||g.classList.contains("fp-drag-bar"))&&h>0||(i.current=f.touches[0].clientY,a.current=!0)},[]),c=C.useCallback(f=>{if(!a.current)return;const h=f.touches[0].clientY-i.current;h>0&&s(h)},[]),d=C.useCallback(()=>{a.current&&(a.current=!1,t>100&&e(),s(0))},[t,e]);return{dragOffset:t,handleDragStart:o,handleDragMove:c,handleDragEnd:d}}function H5({isError:e,fetchError:t,isLoading:s,flatItems:i,debouncedQuery:a,sections:o,focusedIndex:c,changedSet:d,onSelect:f,setFocusedIndex:h}){return e?p.jsx("div",{className:"file-picker-empty",children:"failed to load files"}):t?p.jsxs("div",{className:"file-picker-empty",children:["no files found — ",t]}):s?p.jsx("div",{className:"file-picker-empty",children:"loading..."}):i.length===0&&a.trim()?p.jsxs("div",{className:"file-picker-empty",children:['no results for "',a,'"']}):i.length===0?p.jsx("div",{className:"file-picker-empty",children:"no files"}):p.jsx(p.Fragment,{children:o.map((g,_)=>{const y=o.slice(0,_).reduce((b,S)=>b+S.items.length,0);return p.jsxs(qe.Fragment,{children:[p.jsx("div",{className:"file-picker-section",role:"presentation",children:g.label}),g.items.map((b,S)=>p.jsx(I5,{item:b,globalIndex:y+S,focusedIndex:c,changedSet:d,onSelect:f,onHover:h},b.path))]},g.label)})})}function U5({truncated:e,allFilesCount:t,total:s}){return e?p.jsx("div",{className:"file-picker-footer",children:p.jsxs("span",{className:"fp-hint truncated",children:["showing ",t," of ",s," files — type to filter"]})}):Qe?p.jsx("div",{className:"file-picker-footer"}):p.jsxs("div",{className:"file-picker-footer",children:[p.jsx("span",{className:"fp-hint",children:"↑↓ navigate"}),p.jsx("span",{className:"fp-hint",children:"tab section"}),p.jsx("span",{className:"fp-hint",children:"↵ open"}),p.jsx("span",{className:"fp-hint",children:"esc close"})]})}function F5({open:e,workspacePath:t,changedFiles:s=[],recentFiles:i=[],onClose:a,onSelect:o}){const[c,d]=C.useState(""),[f,h]=C.useState(""),[g,_]=C.useState(0),y=C.useRef(null),b=C.useRef(null),{dragOffset:S,handleDragStart:w,handleDragMove:k,handleDragEnd:T}=z5(a),{data:D,isError:N,isLoading:E}=ga({queryKey:["files-list",t],queryFn:()=>O5(t),staleTime:3e4,enabled:e&&!!t}),M=(D==null?void 0:D.files)??[],U=(D==null?void 0:D.truncated)??!1,W=(D==null?void 0:D.total)??0,B=D==null?void 0:D.error,$=C.useMemo(()=>new Set(s),[s]),Y=C.useMemo(()=>P5(f,M,i,s),[f,M,i,s]),K=C.useMemo(()=>B5(Y,i,s),[Y,i,s]),X=C.useMemo(()=>K.flatMap(ne=>ne.items),[K]),P=C.useMemo(()=>{const ne=[];let A=0;for(const I of K)ne.push(A),A+=I.items.length;return ne},[K]);C.useEffect(()=>(e&&(d(""),h(""),_(0)),()=>{b.current&&clearTimeout(b.current)}),[e]);const j=C.useCallback(ne=>{const A=ne.target.value;d(A),b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{h(A),_(0)},100)},[]),H=C.useCallback(()=>{requestAnimationFrame(()=>{const ne=document.querySelector(".file-picker-item.focused");ne==null||ne.scrollIntoView({block:"nearest"})})},[]),O=C.useCallback(ne=>{if(X.length===0||P.length===0)return;ne.preventDefault();let A=0;for(let q=P.length-1;q>=0;q--)if(g>=(P[q]??0)){A=q;break}const I=ne.shiftKey?(A-1+P.length)%P.length:(A+1)%P.length;_(P[I]??0),H()},[X.length,g,P,H]),z=C.useCallback(ne=>{if(ne.key==="Escape"){ne.preventDefault(),a();return}if(ne.key==="Tab"){O(ne);return}if(ne.preventDefault(),X.length>0){if(ne.key==="ArrowDown")_(I=>(H(),Math.min(I+1,X.length-1)));else if(ne.key==="ArrowUp")_(I=>(H(),Math.max(I-1,0)));else if(ne.key==="Enter"){const I=X[g];I&&o(I.path,$.has(I.path))}}},[X,g,$,a,o,H,O]),Q=C.useCallback(ne=>{ne.target.classList.contains("file-picker-overlay")&&a()},[a]);if(!e)return null;const re=Qe&&S>0?`translateY(${S}px)`:void 0;return p.jsx("div",{className:["file-picker-overlay",Qe?"mobile":""].filter(Boolean).join(" "),onClick:Q,children:p.jsxs("div",{className:["file-picker",Qe?"mobile":""].filter(Boolean).join(" "),role:"dialog",tabIndex:-1,"aria-modal":"true","aria-label":"open file",style:re?{transform:re}:void 0,onTouchStart:ne=>{var A;return w(ne,((A=y.current)==null?void 0:A.scrollTop)??0)},onTouchMove:k,onTouchEnd:T,onTouchCancel:T,children:[Qe&&p.jsx("div",{className:"fp-drag-handle",children:p.jsx("span",{className:"fp-drag-bar"})}),p.jsxs("div",{className:"file-picker-input-row",children:[p.jsx("span",{className:"file-picker-prompt",children:">"}),p.jsx("input",{className:"tui-input",value:c,placeholder:"search files...",onChange:j,onKeyDown:z,autoComplete:"off",spellCheck:!1,role:"combobox","aria-expanded":X.length>0,"aria-controls":"file-picker-results"})]}),p.jsx("div",{className:"file-picker-results",id:"file-picker-results",role:"listbox",ref:y,children:p.jsx(H5,{isError:N,fetchError:B,isLoading:E,flatItems:X,debouncedQuery:f,sections:K,focusedIndex:g,changedSet:$,onSelect:o,setFocusedIndex:_})}),p.jsx(U5,{truncated:U,allFilesCount:M.length,total:W})]})})}const $5='button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';function V5(){return p.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"square",width:"14",height:"14",children:[p.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),p.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function W5(e,t){const s=C.useCallback(()=>{e.current&&(e.current.showModal(),requestAnimationFrame(()=>{var o;if(!e.current)return;(o=e.current.querySelector($5))==null||o.focus();const a=e.current.querySelector(".dialog-shell__body");a&&t(a.scrollHeight<=a.clientHeight)}))},[e,t]),i=C.useCallback(()=>{var a;(a=e.current)==null||a.close()},[e]);return{open:s,close:i}}const Td=C.forwardRef(function({variant:t="compact",width:s="460px",title:i,children:a,headerExtra:o,footer:c},d){const f=C.useRef(null),[h,g]=C.useState(!1),{open:_,close:y}=W5(f,g);C.useImperativeHandle(d,()=>({open:_,close:y}),[_,y]);const b=D=>{const N=D.currentTarget;g(N.scrollHeight-N.scrollTop-N.clientHeight<8||N.scrollHeight<=N.clientHeight)},S=D=>{var N;D.target===f.current&&((N=f.current)==null||N.close())},w=["dialog-shell",t==="fullscreen"&&"dialog-shell--fullscreen",t==="compact"&&"dialog-shell--compact"].filter(Boolean).join(" "),k=["dialog-shell__body",h&&"scrolled-bottom"].filter(Boolean).join(" "),T=t==="compact"?{"--dialog-width":s}:void 0;return p.jsx("dialog",{ref:f,className:w,style:T,onClick:S,"aria-modal":"true","aria-label":i,children:p.jsxs("div",{className:"dialog-shell__content",children:[p.jsxs("header",{className:"dialog-shell__header",children:[p.jsx("h2",{className:"dialog-shell__title",children:i}),o&&p.jsx("div",{className:"dialog-shell__header-extra",children:o}),p.jsx("button",{className:"dialog-shell__close",onClick:y,"aria-label":"Close",type:"button",children:p.jsx(V5,{})})]}),p.jsx("div",{className:k,onScroll:b,children:a}),c&&p.jsx("footer",{className:"dialog-shell__footer",children:c})]})})}),qs=({checked:e=!1,disabled:t=!1,onChange:s,children:i,className:a="",...o})=>{const c=f=>{!t&&s&&s(f.target.checked)},d=["tui-checkbox",t&&"disabled",a].filter(Boolean).join(" ");return p.jsxs("label",{className:d,children:[p.jsx("input",{type:"checkbox",checked:e,disabled:t,onChange:c,...o}),p.jsx("span",{className:"tui-check",children:e?"[x]":"[ ]"}),i]})};function M1(){return{claudeArgsInput:"",selectedAgent:"claude",yoloMode:!1,continueExisting:!1,useTmux:!1}}async function G5(e,t){const s=t.claudeArgsInput.trim().split(/\s+/).filter(Boolean),{cols:i,rows:a}=Qx();return qr({repoPath:e,worktreePath:null,type:"agent",continue:t.continueExisting,yolo:t.yoloMode,claudeArgs:s.length>0?s:void 0,agent:t.selectedAgent,useTmux:t.useTmux,cols:i,rows:a})}function q5({workspaceName:e,form:t,onFormChange:s}){return p.jsxs("div",{className:"customize-session-body-fields",children:[e&&p.jsxs("p",{className:"customize-session-workspace-name",children:["— ",e]}),p.jsxs("div",{className:"customize-session-dialog-field",children:[p.jsx("label",{className:"customize-session-dialog-label",htmlFor:"cs-agent",children:"Coding agent"}),p.jsxs("select",{id:"cs-agent",className:"customize-session-dialog-select","data-track":"dialog.customize-session.agent",value:t.selectedAgent,onChange:i=>s({selectedAgent:i.currentTarget.value}),children:[p.jsx("option",{value:"claude",children:"Claude"}),p.jsx("option",{value:"codex",children:"Codex"}),p.jsx("option",{value:"opencode",children:"OpenCode"})]})]}),p.jsx(qs,{checked:t.continueExisting,onChange:i=>s({continueExisting:i}),children:"Continue existing session"}),p.jsx(qs,{checked:t.yoloMode,onChange:i=>s({yoloMode:i}),children:"Yolo mode (skip permission checks)"}),p.jsx(qs,{checked:t.useTmux,onChange:i=>s({useTmux:i}),children:"Launch in tmux"}),p.jsxs("div",{className:"customize-session-dialog-field",children:[p.jsx("label",{className:"customize-session-dialog-label",htmlFor:"cs-args",children:"Extra args (optional)"}),p.jsx("input",{id:"cs-args",type:"text",className:"customize-session-dialog-input",placeholder:"e.g. --verbose",value:t.claudeArgsInput,onChange:i=>s({claudeArgsInput:i.currentTarget.value}),autoComplete:"off"})]})]})}const K5=C.forwardRef(function({onSessionCreated:t},s){const i=C.useRef(null),[a,o]=C.useState(""),[c,d]=C.useState(""),[f,h]=C.useState(M1()),[g,_]=C.useState(!1);C.useImperativeHandle(s,()=>({async open(S){var k;h(M1()),o(S.path),d(S.name),await Gs.getState().refreshConfig();const w=Gs.getState();h({claudeArgsInput:"",selectedAgent:w.defaultAgent,yoloMode:w.defaultYolo,continueExisting:w.defaultContinue,useTmux:w.launchInTmux}),(k=i.current)==null||k.open()},close(){var S;(S=i.current)==null||S.close()}}));async function y(){var S,w;if(!(!a||g)){_(!0);try{const k=await G5(a,f);(S=i.current)==null||S.close(),await se.getState().refreshAll(),k!=null&&k.id&&(t==null||t(k.id))}catch(k){if(k instanceof Error&&"sessionId"in k){const T=k;(w=i.current)==null||w.close(),await se.getState().refreshAll(),T.sessionId&&(t==null||t(T.sessionId))}}finally{_(!1)}}}const b=p.jsxs("div",{className:"customize-session-footer-row",children:[p.jsx(Me,{variant:"ghost",onClick:()=>{var S;return(S=i.current)==null?void 0:S.close()},disabled:g,children:"Cancel"}),p.jsx(Me,{variant:"primary","data-track":"dialog.customize-session.create",onClick:y,disabled:!a||g,children:g?"Creating...":"Start Session"})]});return p.jsx(Td,{ref:i,width:"480px",title:"Customize Session",footer:b,children:p.jsx(q5,{workspaceName:c,form:f,onFormChange:S=>h(w=>({...w,...S}))})})});function wn({name:e,description:t,children:s}){return p.jsxs("div",{className:"setting-row",children:[p.jsxs("div",{className:"setting-label",children:[p.jsx("p",{className:"setting-name",children:e}),t&&p.jsx("p",{className:"setting-description",children:t})]}),p.jsx("div",{className:"setting-action",children:s})]})}function Y5({sections:e,contentEl:t,open:s,onclose:i}){function a(o){const c=t==null?void 0:t.querySelector(`#${o}`);c&&c.scrollIntoView({behavior:"smooth"}),i()}return p.jsxs(p.Fragment,{children:[s&&p.jsx("div",{className:"toc-backdrop",onClick:i}),p.jsx("nav",{className:["toc-drawer",s?"open":""].filter(Boolean).join(" "),"aria-label":"Settings navigation",children:p.jsx("div",{className:"toc-items",children:e.map(o=>{var c;return p.jsxs(qe.Fragment,{children:[p.jsx("button",{className:"toc-item",onClick:()=>a(o.id),children:o.label}),(c=o.children)==null?void 0:c.map(d=>p.jsx("button",{className:"toc-item toc-child",onClick:()=>a(d.id),children:d.label},d.id))]},o.id)})})})]})}function hv({name:e,statusText:t,connected:s,loading:i=!1,expanded:a,onExpandedChange:o,onToggle:c,headerActions:d,children:f}){const[h,g]=C.useState(!1),_=a!==void 0?a:h;function y(){const S=!_;o?o(S):g(S),c==null||c()}function b(S){(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),y())}return p.jsxs("div",{className:"integration-row",children:[p.jsxs("div",{className:"integration-header",role:"button",tabIndex:0,"aria-expanded":_,onClick:y,onKeyDown:b,children:[p.jsx("span",{className:"icon-slot",children:p.jsx(Fo,{status:s?"connected":"disconnected",size:8})}),p.jsxs("div",{className:"integration-label",children:[p.jsx("span",{className:"integration-name",children:e}),p.jsx("span",{className:["integration-status",i?"integration-status--loading":""].filter(Boolean).join(" "),children:i?p.jsx("span",{className:"loading-text",children:"loading..."}):t})]}),p.jsx("div",{className:"chevron","aria-hidden":"true",children:_?"▴":"▾"}),d&&p.jsx("div",{className:"header-actions",onClick:S=>S.stopPropagation(),onKeyDown:S=>S.stopPropagation(),role:"presentation",children:d})]}),p.jsx("div",{className:["integration-body",_?"integration-body--open":""].filter(Boolean).join(" "),"aria-hidden":!_,children:p.jsx("div",{className:"integration-body-inner",children:f})})]})}function X5({username:e,webhookCount:t,disconnecting:s,showConfirm:i,onConfirm:a,onCancel:o,onDisconnect:c}){return p.jsxs(p.Fragment,{children:[p.jsxs("p",{className:"github-integration-body-text",children:["Connected as ",p.jsxs("strong",{children:["@",e??"GitHub"]})]}),i?p.jsxs(p.Fragment,{children:[p.jsx("p",{className:"github-integration-body-text github-integration-body-text--warning",children:t>0?`This will delete ${t} webhook${t===1?"":"s"} on GitHub. Continue?`:"Disconnect your GitHub account. Continue?"}),p.jsxs("div",{className:"github-integration-action-row",children:[p.jsx(Me,{variant:"ghost",size:"sm",onClick:o,children:"Cancel"}),p.jsx(Me,{variant:"danger",size:"sm",onClick:c,disabled:s,children:s?"Disconnecting...":"Disconnect"})]})]}):p.jsx(Me,{variant:"danger",size:"sm",onClick:a,children:"Disconnect"})]})}function Q5({deviceCode:e,onCopy:t}){return p.jsxs("div",{className:"github-integration-device-flow",children:[p.jsxs("div",{className:"github-integration-code-row",children:[p.jsxs("span",{className:"github-integration-body-text",children:["Enter code:"," ",p.jsx("strong",{className:"github-integration-user-code",children:e.userCode})]}),p.jsx(Me,{variant:"ghost",size:"sm",onClick:t,children:"Copy"})]}),p.jsxs("p",{className:"github-integration-body-text",children:["at"," ",p.jsx("a",{href:e.verificationUri,target:"_blank",rel:"noopener noreferrer",children:e.verificationUri})]}),p.jsx("p",{className:"github-integration-body-text github-integration-body-text--muted",children:"Waiting for authorization..."})]})}function Z5(e,t){const[s,i]=C.useState(null),[a,o]=C.useState(""),[c,d]=C.useState(!1),f=C.useRef(null),h=C.useRef(null);function g(){f.current&&(clearInterval(f.current),f.current=null),h.current&&(clearTimeout(h.current),h.current=null)}C.useEffect(()=>{async function b(){try{const S=await _g();e({connected:S.connected,...S.username?{username:S.username}:{},...S.deviceFlowStatus?{deviceFlowStatus:S.deviceFlowStatus}:{}})}catch{e({connected:!1})}finally{t(!1)}}return b(),g},[]);async function _(){o("");try{const b=await k2();i(b),g(),f.current=setInterval(async()=>{try{const S=await _g();S.connected?(e({connected:!0,...S.username?{username:S.username}:{}}),i(null),g()):(S.deviceFlowStatus==="denied"||S.deviceFlowStatus==="expired")&&(i(null),o(S.deviceFlowStatus==="denied"?"Authorization denied. Please try again.":"Code expired. Please try again."),g())}catch{}},2e3),h.current=setTimeout(()=>{g(),i(null),o("Code expired. Please try again.")},b.expiresIn*1e3)}catch{o("Failed to initiate GitHub authorization. Please try again.")}}async function y(b){d(!0);try{await E2(),e({connected:!1}),i(null),o(""),b()}catch{}finally{d(!1)}}return{deviceCode:s,deviceFlowError:a,disconnecting:c,connect:_,disconnect:y}}function J5({onDisconnect:e,needsReauth:t=!1,webhookCount:s=0}){const[i,a]=C.useState(!1),[o,c]=C.useState(null),[d,f]=C.useState(!0),[h,g]=C.useState(!1),{deviceCode:_,deviceFlowError:y,disconnecting:b,connect:S,disconnect:w}=Z5(c,f);let k;d?k="Checking connection...":o!=null&&o.connected?k=`Connected as @${o.username??"GitHub"}`:k="Not connected";function T(){return d?p.jsx(Uo,{loading:!0,text:"Checking connection..."}):t?p.jsxs(p.Fragment,{children:[p.jsx("p",{className:"github-integration-reauth-warning",children:"Re-connect to enable webhook management"}),p.jsx(Me,{variant:"primary",size:"sm",onClick:()=>void S(),children:"Re-connect GitHub"})]}):o!=null&&o.connected?p.jsx(X5,{username:o.username,webhookCount:s,disconnecting:b,showConfirm:h,onConfirm:()=>g(!0),onCancel:()=>g(!1),onDisconnect:()=>void w(()=>{g(!1),e==null||e()})}):_?p.jsx(Q5,{deviceCode:_,onCopy:()=>void navigator.clipboard.writeText(_.userCode)}):y?p.jsxs(p.Fragment,{children:[p.jsx("p",{className:"github-integration-error-text",children:y}),p.jsx(Me,{variant:"primary",size:"sm",onClick:()=>void S(),children:"Try Again"})]}):p.jsxs(p.Fragment,{children:[p.jsx("p",{className:"github-integration-body-text github-integration-body-text--muted",children:"Connect your GitHub account to enable PRs, CI status, and webhook management."}),p.jsx(Me,{variant:"primary",size:"sm",onClick:()=>void S(),children:"Connect GitHub"})]})}const D=p.jsx(p.Fragment,{children:o!=null&&o.connected?p.jsxs(Me,{variant:"ghost",size:"sm",onClick:()=>a(N=>!N),children:["Manage ",i?"▴":"▾"]}):d?null:p.jsx(Me,{variant:"primary",size:"sm",onClick:N=>{N.stopPropagation(),a(!0),S()},children:"Connect"})});return p.jsx("div",{className:"github-integration",children:p.jsx(hv,{name:"GitHub",statusText:k,connected:(o==null?void 0:o.connected)??!1,loading:d,expanded:i,onExpandedChange:a,headerActions:D,children:T()})})}function e3(e){if(!e)return"never";const t=Date.now()-new Date(e).getTime(),s=Math.floor(t/6e4);if(s<1)return"just now";if(s<60)return`${s} min ago`;const i=Math.floor(s/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function t3({backfilling:e,onBackfill:t,onSkip:s}){return p.jsxs("div",{className:"webhook-integration-backfill-banner",children:[p.jsx("p",{className:"webhook-integration-body-text",children:"Create webhooks for all your existing repos?"}),p.jsxs("div",{className:"webhook-integration-action-row",children:[p.jsx(Me,{variant:"primary",size:"sm",onClick:t,disabled:e,children:e?"Setting up repos...":"Setup All Repos"}),p.jsx(Me,{variant:"ghost",size:"sm",onClick:s,children:"Skip"})]})]})}function s3({results:e}){return p.jsxs("div",{className:"webhook-integration-backfill-results",children:[p.jsxs("p",{className:"webhook-integration-body-text",children:["Created webhooks for ",e.success,"/",e.total," repos.",e.failed>0&&` ${e.failed} failed:`]}),e.failed>0&&p.jsx("ul",{className:"webhook-integration-results-list",children:e.results.filter(t=>!t.ok).map(t=>p.jsxs("li",{className:"webhook-integration-result-item webhook-integration-result-item--fail",children:[p.jsx("span",{className:"webhook-integration-result-icon",children:p.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"square",width:"12",height:"12",children:[p.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),p.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),p.jsx("span",{className:"webhook-integration-result-label",children:t.ownerRepo}),t.error&&p.jsxs("span",{className:"webhook-integration-result-error",children:["(",t.error,")"]})]},t.path))})]})}function i3({testResult:e}){const t=["webhook-integration-test-result",e==="success"?"webhook-integration-test-result--success":"webhook-integration-test-result--error"].join(" ");return p.jsx("p",{className:t,children:e==="success"?p.jsxs(p.Fragment,{children:[p.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"square",width:"12",height:"12",children:p.jsx("polyline",{points:"20 6 9 17 4 12"})})," ","Event received"]}):e==="no_webhook"?"No webhook to ping":"Timed out"})}function n3(){const[e,t]=C.useState(null),[s,i]=C.useState(!0),[a,o]=C.useState(!1),[c,d]=C.useState(!1),[f,h]=C.useState(!1),[g,_]=C.useState(!1),[y,b]=C.useState(null),[S,w]=C.useState(!1),[k,T]=C.useState(!1),[D,N]=C.useState(null),[E,M]=C.useState(""),U=C.useRef(null);async function W(){i(!0),M("");try{t(await Sx())}catch{M("Failed to load webhook status.")}finally{i(!1)}}C.useEffect(()=>(W(),()=>{U.current&&clearTimeout(U.current)}),[]);function B(){(async()=>{o(!0),M("");try{const P=await T2();P.ok?(await W(),w(!0)):M(P.error??"Setup failed.")}catch{M("Setup failed. Could not reach smee.io.")}finally{o(!1)}})()}function $(){(async()=>{d(!0),M("");try{await N2(),t(null),T(!1),w(!1),b(null)}catch{M("Removal failed.")}finally{d(!1)}})()}function Y(){(async()=>{h(!0),N(null),U.current&&clearTimeout(U.current);try{const P=await A2();N(P.ok?"success":P.error==="no_webhook"?"no_webhook":"error")}catch{N("error")}finally{h(!1),U.current=setTimeout(()=>N(null),5e3)}})()}function K(){(async()=>{_(!0),M("");try{b(await R2()),w(!1)}catch{M("Backfill failed.")}finally{_(!1)}})()}function X(){if(!e)return;const P=!e.autoProvision;t({...e,autoProvision:P}),D2(P).catch(()=>{t({...e,autoProvision:!P}),M("Failed to update auto-provision setting.")})}return{status:e,loading:s,settingUp:a,removing:c,testing:f,backfilling:g,backfillResults:y,showBackfillBanner:S,showRemoveConfirm:k,testResult:D,error:E,setup:B,remove:$,test:Y,backfill:K,toggleAutoProvision:X,setShowBackfillBanner:w,setShowRemoveConfirm:T}}function r3({githubConnected:e}){var f,h,g;const[t,s]=C.useState(!1),i=n3();let a;i.loading?a="Loading...":(f=i.status)!=null&&f.configured?a=i.status.smeeConnected?"Connected via smee.io":"Reconnecting...":a="Not configured";const o=(h=i.status)!=null&&h.configured?i.status.smeeConnected:!1,c=p.jsx(p.Fragment,{children:e?!i.loading&&((g=i.status)!=null&&g.configured)?p.jsxs(Me,{variant:"ghost",size:"sm",onClick:()=>s(_=>!_),children:["Manage ",t?"▴":"▾"]}):i.loading?null:p.jsx(Me,{variant:"primary",size:"sm",onClick:_=>{_.stopPropagation(),s(!0)},disabled:i.settingUp,children:"Setup"}):p.jsx("span",{className:"webhook-integration-status-hint",children:"Connect GitHub first"})});function d(){var y;if(!e)return p.jsx("p",{className:"webhook-integration-body-text webhook-integration-body-text--muted",children:"Connect your GitHub account above to enable webhook setup."});if(i.loading)return p.jsx(Uo,{loading:!0,text:"Loading..."});if(!((y=i.status)!=null&&y.configured))return p.jsxs(p.Fragment,{children:[p.jsx("p",{className:"webhook-integration-body-text webhook-integration-body-text--muted",children:"Get real-time CI and PR updates instead of polling every 30s."}),i.error&&p.jsx("p",{className:"webhook-integration-error-text",children:i.error}),p.jsx(Me,{variant:"primary",size:"sm",onClick:i.setup,disabled:i.settingUp,children:i.settingUp?"Setting up...":"Setup Webhooks"})]});const _=i.status.smeeConnected?"connected":"warning";return p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"webhook-integration-health-row",children:[p.jsx(Fo,{status:_,size:8}),p.jsx("span",{className:"webhook-integration-body-text",children:i.status.smeeConnected?"Connected via smee.io":"Reconnecting... (using polling fallback)"})]}),p.jsxs("p",{className:"webhook-integration-body-text webhook-integration-body-text--muted",children:["Last event: ",e3(i.status.lastEventAt)]}),p.jsx(qs,{checked:i.status.autoProvision,onChange:i.toggleAutoProvision,children:"Auto-add webhooks for new repos"}),i.error&&p.jsx("p",{className:"webhook-integration-error-text",children:i.error}),i.showBackfillBanner&&!i.backfillResults&&p.jsx(t3,{backfilling:i.backfilling,onBackfill:i.backfill,onSkip:()=>i.setShowBackfillBanner(!1)}),i.backfillResults&&p.jsx(s3,{results:i.backfillResults}),p.jsx("div",{className:"webhook-integration-action-row",children:i.showRemoveConfirm&&p.jsx("p",{className:"webhook-integration-body-text webhook-integration-body-text--warning",children:"This will delete webhooks from GitHub repos and disable real-time updates."})}),p.jsx("div",{className:"webhook-integration-action-row",children:i.showRemoveConfirm?p.jsxs(p.Fragment,{children:[p.jsx(Me,{variant:"ghost",size:"sm",onClick:()=>i.setShowRemoveConfirm(!1),children:"Cancel"}),p.jsx(Me,{variant:"danger",size:"sm",onClick:i.remove,disabled:i.removing,children:i.removing?"Removing...":"Remove"})]}):p.jsxs(p.Fragment,{children:[p.jsx(Me,{variant:"ghost",size:"sm",onClick:i.test,disabled:i.testing,children:i.testing?"Testing...":"Test Connection"}),p.jsx(Me,{variant:"danger",size:"sm",onClick:()=>i.setShowRemoveConfirm(!0),children:"Remove Setup"})]})}),i.testResult&&p.jsx(i3,{testResult:i.testResult})]})}return p.jsx(hv,{name:"Webhooks",statusText:a,connected:o,loading:i.loading,expanded:t,onExpandedChange:s,headerActions:c,children:d()})}function a3(){const[e,t]=C.useState(!1),[s,i]=C.useState(null),[a,o]=C.useState(!0);C.useEffect(()=>{async function d(){try{const f=await fetch("/integration-jira/configured");if(f.status===404){i(null),o(!1);return}const h=await f.json();i(h.configured??!1)}catch{i(!1)}finally{o(!1)}}d()},[]);let c;return a?c="Checking...":s===null?c="Not available":s?c="Connected":c="CLI not installed",p.jsx(hv,{name:"Jira",statusText:c,connected:s===!0,loading:a,expanded:e,onExpandedChange:t,children:a?p.jsx(Uo,{loading:!0,text:"Loading tickets..."}):s===null?p.jsx("p",{className:"jira-integration-body-text jira-integration-body-text--muted",children:"Jira integration is not available on this server."}):s?p.jsxs(p.Fragment,{children:[p.jsx("p",{className:"jira-integration-body-text jira-integration-body-text--success",children:"Connected via Atlassian CLI"}),p.jsx("p",{className:"jira-integration-body-text jira-integration-body-text--muted",children:"Jira tickets appear automatically in the sidebar."})]}):p.jsxs(p.Fragment,{children:[p.jsx("p",{className:"jira-integration-body-text jira-integration-body-text--muted",children:"Install the Atlassian CLI to see your Jira tickets."}),p.jsxs("ol",{className:"jira-integration-steps",children:[p.jsxs("li",{className:"jira-integration-step",children:[p.jsx("span",{className:"jira-integration-step-number",children:"1."}),p.jsx("code",{className:"jira-integration-code-block",children:"brew tap atlassian/tap && brew install acli"})]}),p.jsxs("li",{className:"jira-integration-step",children:[p.jsx("span",{className:"jira-integration-step-number",children:"2."}),p.jsx("code",{className:"jira-integration-code-block",children:"acli jira auth login --web"})]}),p.jsxs("li",{className:"jira-integration-step",children:[p.jsx("span",{className:"jira-integration-step-number",children:"3."}),p.jsx("code",{className:"jira-integration-code-block",children:"Refresh this page"})]})]}),p.jsx("p",{className:"jira-integration-body-text jira-integration-body-text--muted",children:"The CLI handles authentication — no API tokens needed."})]})})}const yo={defaultAgent:"claude",defaultContinue:!0,defaultYolo:!1,launchInTmux:!1,defaultNotifications:!0},o3=[{id:"section-general",label:"general"},{id:"section-integrations",label:"integrations",children:[{id:"integration-github",label:"GitHub"},{id:"integration-webhooks",label:"Webhooks"},{id:"integration-jira",label:"Jira"}]},{id:"section-advanced",label:"advanced"},{id:"section-about",label:"about"}],l3={general:["default coding agent","continue","yolo","tmux","notifications"],integrations:["github","webhooks","jira","real-time","ci","pr","tickets"],advanced:["developer tools","analytics","debug panel"],about:["version","update","channel","nightly","stable"]};async function c3(){const[e,t,s,i,a]=await Promise.all([px().catch(()=>yo.defaultAgent),mx().catch(()=>yo.defaultContinue),gx().catch(()=>yo.defaultYolo),vx().catch(()=>yo.launchInTmux),yx().catch(()=>yo.defaultNotifications)]);return{defaultAgent:e,defaultContinue:t,defaultYolo:s,launchInTmux:i,defaultNotifications:a}}function Nd(e,t){var o;if(!t.trim())return"settings-dialog-section";const s=t.toLowerCase(),i=e.replace("section-","");return["settings-dialog-section",i.includes(s)||(((o=l3[i])==null?void 0:o.some(c=>c.includes(s)))??!1)?"":"dimmed"].filter(Boolean).join(" ")}function u3(e,t,s,i,a){async function o(g){const _=e.defaultAgent;t(y=>({...y,defaultAgent:g})),s("");try{await f2(g)}catch{t(y=>({...y,defaultAgent:_})),s("Failed to update default agent.")}}async function c(g){const _=e.defaultContinue;t(y=>({...y,defaultContinue:g})),s("");try{await p2(g)}catch{t(y=>({...y,defaultContinue:_})),s("Failed to update continue default.")}}async function d(g){const _=e.defaultYolo;t(y=>({...y,defaultYolo:g})),s("");try{await _x(g)}catch{t(y=>({...y,defaultYolo:_})),s("Failed to update yolo default.")}}async function f(g){const _=e.launchInTmux;t(y=>({...y,launchInTmux:g})),s("");try{await m2(g)}catch(y){t(b=>({...b,launchInTmux:_})),s(y instanceof Error?y.message:"Failed to update tmux setting.")}}async function h(g){const _=e.defaultNotifications;if(t(y=>({...y,defaultNotifications:g})),s(""),g&&i!=="granted"){const y=await Q2();if(a(y),y!=="granted"){t(b=>({...b,defaultNotifications:_})),s(y==="unsupported"?"Notifications are not supported in this browser.":y==="default"?"Notification permission is required.":"Notifications blocked by browser.");return}}try{await g2(g),i==="granted"&&await tD(se.getState().getNotificationSessionIds())}catch{t(y=>({...y,defaultNotifications:_})),s("Failed to update notifications default.")}}return{handleAgentChange:o,handleContinueChange:c,handleYoloChange:d,handleTmuxChange:f,handleNotifChange:h}}const h3=C.forwardRef(function(t,s){const i=C.useRef(null),a=C.useRef(null),[o,c]=C.useState(void 0),[d,f]=C.useState(yo),[h,g]=C.useState(""),[_,y]=C.useState({current:"",latest:null,available:!1,checked:!1,updating:!1,status:""}),[b,S]=C.useState(null),[w,k]=C.useState(!1),[T,D]=C.useState(!1),[N,E]=C.useState(0),[M,U]=C.useState(cw()),[W,B]=C.useState(!1),[$,Y]=C.useState(""),[K,X]=C.useState(!1),P=C.useCallback(ne=>{a.current=ne,c(ne??void 0)},[]),j=u3(d,f,g,M,U);async function H(){const[ne]=await Promise.all([c3(),dx().then(A=>y(I=>({...I,current:A.current,latest:A.latest,available:A.updateAvailable,checked:!0}))).catch(()=>y(A=>({...A,status:"Failed to check for updates."}))),b2().then(A=>S(A.bytes)).catch(()=>{}),_g().then(async A=>{if(D(A.connected),A.connected){const I=await Sx().catch(()=>null);I!=null&&I.configured&&E(1)}}).catch(()=>{})]);f(ne)}C.useImperativeHandle(s,()=>({open(ne){var A;g(""),y(I=>({...I,status:"",checked:!1,updating:!1})),B(localStorage.getItem("devtools-enabled")==="true"),U(cw()),H(),(A=i.current)==null||A.open(),ne&&requestAnimationFrame(()=>{var I,q;return(q=(I=a.current)==null?void 0:I.querySelector(`#${ne}`))==null?void 0:q.scrollIntoView({behavior:"smooth"})})},close(){var ne;(ne=i.current)==null||ne.close(),se.getState().refreshAll()}}));async function O(){if(confirm("Clear all analytics data? This cannot be undone.")){k(!0);try{await S2(),S(0)}catch{g("Failed to clear analytics.")}finally{k(!1)}}}async function z(){y(ne=>({...ne,updating:!0,status:""}));try{(await fx()).restarting?(y(A=>({...A,status:"Updated! Restarting…",available:!1})),setTimeout(()=>location.reload(),5e3)):y(A=>({...A,status:"Updated! Please restart the server manually.",available:!1}))}catch{y(ne=>({...ne,status:"Update failed. Please try again.",updating:!1}))}}const Q=M==="denied"?"Blocked by browser — check site settings":M==="unsupported"?"Not supported in this browser":"Notify when sessions need attention",re=p.jsxs("div",{className:"settings-dialog-header-extra",children:[p.jsx("button",{className:"settings-dialog-hamburger-btn",onClick:()=>X(ne=>!ne),"aria-label":"Navigation",children:"☰"}),p.jsx("input",{className:"settings-dialog-search-input",type:"text",placeholder:"Search...",value:$,onChange:ne=>Y(ne.currentTarget.value),"aria-label":"Search settings"})]});return p.jsx(Td,{ref:i,title:"settings",variant:"fullscreen",headerExtra:re,children:p.jsxs("div",{className:"settings-dialog-content",ref:P,children:[h&&p.jsx("p",{className:"error-msg",children:h}),p.jsx(Y5,{open:K,onclose:()=>X(!1),...o?{contentEl:o}:{},sections:o3}),p.jsxs("div",{className:"settings-dialog-sections",children:[p.jsx(d3,{config:d,notifDescription:Q,notifPerm:M,searchQuery:$,handlers:j}),p.jsx(f3,{searchQuery:$,githubConnected:T,webhookCount:N,onGitHubDisconnect:()=>D(!1)}),p.jsx(p3,{searchQuery:$,analyticsSize:b,clearing:w,devtoolsEnabled:W,onDevtoolsChange:ne=>{B(ne),localStorage.setItem("devtools-enabled",ne?"true":"false"),window.dispatchEvent(new Event("devtools-changed"))},onClearAnalytics:()=>void O()}),p.jsx(m3,{searchQuery:$,versionInfo:_,onUpdate:()=>void z()})]})]})})});function d3({config:e,notifDescription:t,notifPerm:s,searchQuery:i,handlers:a}){const o=(s==="denied"||s==="unsupported")&&!e.defaultNotifications;return p.jsxs("section",{id:"section-general",className:Nd("section-general",i),children:[p.jsx("h3",{className:"settings-dialog-section-heading",children:"general"}),p.jsx(wn,{name:"Default Coding Agent",description:"Which AI agent to use for new sessions",children:p.jsxs("select",{className:"settings-dialog-select",value:e.defaultAgent,onChange:c=>void a.handleAgentChange(c.currentTarget.value),children:[p.jsx("option",{value:"claude",children:"Claude"}),p.jsx("option",{value:"codex",children:"Codex"}),p.jsx("option",{value:"opencode",children:"OpenCode"})]})}),p.jsx(wn,{name:"Continue existing session",description:"Resume the last session when opening a repo",children:p.jsx(qs,{checked:e.defaultContinue,onChange:c=>void a.handleContinueChange(c)})}),p.jsx(wn,{name:"YOLO mode",description:"Skip permission checks for all sessions",children:p.jsx(qs,{checked:e.defaultYolo,onChange:c=>void a.handleYoloChange(c)})}),p.jsx(wn,{name:"Launch in tmux",description:"Wrap sessions in tmux for scroll and copy",children:p.jsx(qs,{checked:e.launchInTmux,onChange:c=>void a.handleTmuxChange(c)})}),p.jsx(wn,{name:"Notifications",description:t,children:p.jsx(qs,{checked:e.defaultNotifications,onChange:c=>void a.handleNotifChange(c),disabled:o})})]})}function f3({searchQuery:e,githubConnected:t,webhookCount:s,onGitHubDisconnect:i}){return p.jsxs("section",{id:"section-integrations",className:Nd("section-integrations",e),children:[p.jsx("h3",{className:"settings-dialog-section-heading",children:"integrations"}),p.jsx("div",{id:"integration-github",children:p.jsx(J5,{onDisconnect:i,webhookCount:s})}),p.jsx("div",{id:"integration-webhooks",children:p.jsx(r3,{githubConnected:t})}),p.jsx("div",{id:"integration-jira",children:p.jsx(a3,{})})]})}function p3({searchQuery:e,analyticsSize:t,clearing:s,devtoolsEnabled:i,onDevtoolsChange:a,onClearAnalytics:o}){return p.jsxs("section",{id:"section-advanced",className:Nd("section-advanced",e),children:[p.jsx("h3",{className:"settings-dialog-section-heading",children:"advanced"}),p.jsx(wn,{name:"Developer Tools",description:"Mobile debug panel",children:p.jsx(qs,{checked:i,onChange:c=>a(c)})}),p.jsx(wn,{name:"Analytics",description:"Local usage data",children:p.jsxs("div",{className:"settings-dialog-analytics-action",children:[t!==null&&p.jsxs("span",{className:"settings-dialog-analytics-size",children:[(t/1024/1024).toFixed(1)," MB"]}),p.jsx(Me,{variant:"ghost",size:"sm",onClick:o,disabled:s,children:s?"Clearing…":"Clear"})]})})]})}function m3({searchQuery:e,versionInfo:t,onUpdate:s}){const[i,a]=C.useState("stable"),[o,c]=C.useState(!1);C.useEffect(()=>{h2().then(f=>a(f),()=>a("stable"))},[]);const d=C.useCallback(async f=>{if(!(o||f===i)){c(!0);try{await d2(f),a(f)}catch{}finally{c(!1)}}},[o,i]);return p.jsxs("section",{id:"section-about",className:Nd("section-about",e),children:[p.jsx("h3",{className:"settings-dialog-section-heading",children:"about"}),p.jsx(wn,{name:"Version",description:t.current?`v${t.current}`:"",children:t.available?p.jsx(Me,{variant:"primary",size:"sm",onClick:s,disabled:t.updating,children:t.updating?"Updating…":`Update to v${t.latest}`}):t.checked?p.jsx("span",{className:"settings-dialog-version-ok",children:"Up to date"}):null}),p.jsx(wn,{name:"Update Channel",description:i==="nightly"?"Nightly builds":"Stable releases",children:p.jsxs("div",{className:"settings-dialog-channel-selector",children:[p.jsx("button",{className:`settings-dialog-channel-btn${i==="stable"?" active":""}`,disabled:o,onClick:()=>d("stable"),children:"stable"}),p.jsx("button",{className:`settings-dialog-channel-btn${i==="nightly"?" active":""}`,disabled:o,onClick:()=>d("nightly"),children:"nightly"})]})}),t.status&&p.jsx("p",{className:"settings-dialog-update-status",children:t.status})]})}const g3=C.forwardRef(function(t,s){const i=C.useRef(null),[a,o]=C.useState(null),[c,d]=C.useState(""),[f,h]=C.useState(!1);C.useImperativeHandle(s,()=>({open(b){var S;o(b),d(""),h(!1),(S=i.current)==null||S.open()},close(){var b;(b=i.current)==null||b.close()}}));async function g(){var b;if(!(!a||f)){h(!0),d(""),se.getState().setLoading(a.path);try{await hx(a.path,a.repoPath),(b=i.current)==null||b.close(),await se.getState().refreshAll()}catch(S){d(S instanceof Error?S.message:"Failed to delete worktree."),h(!1)}finally{a&&se.getState().clearLoading(a.path)}}}function _(){var b;(b=i.current)==null||b.close()}const y=p.jsxs("div",{className:"delete-worktree-footer-row",children:[p.jsx(Me,{variant:"ghost",onClick:_,disabled:f,children:"Cancel"}),p.jsx(Me,{variant:"danger",onClick:g,disabled:f,children:f?"Deleting...":"Delete"})]});return p.jsx(Td,{ref:i,width:"400px",title:"Delete Worktree",footer:y,children:p.jsxs("div",{className:"delete-worktree-body",children:[a&&p.jsxs(p.Fragment,{children:[p.jsxs("p",{className:"delete-worktree-confirm-msg",children:["Are you sure you want to delete the worktree"," ",p.jsx("strong",{className:"delete-worktree-wt-name",children:a.displayName||a.name}),"?"]}),p.jsx("p",{className:"delete-worktree-wt-path",children:a.path}),p.jsx("p",{className:"delete-worktree-warning-msg",children:"This action cannot be undone."})]}),c&&p.jsx("p",{className:"delete-worktree-error-msg",children:c})]})})});function O1(e,t){return{name:e.name,path:e.path,isGitRepo:e.isGitRepo,hasChildren:e.hasChildren,children:null,expanded:!1,selected:!1,loading:!1,depth:t,truncatedInfo:null}}function nE(e){const t=[];for(const s of e)s.selected&&t.push(s.path),s.children&&t.push(...nE(s.children));return t}function rE(e,t){const s=[];for(const i of e)t&&!i.expanded&&!i.name.toLowerCase().includes(t.toLowerCase())||(s.push(i),i.expanded&&i.children&&s.push(...rE(i.children,t)));return s}function _3({node:e,focused:t,onToggleExpand:s,onToggleSelect:i}){const a=["tree-row",t?"focused":"",e.selected?"selected":""].filter(Boolean).join(" ");return p.jsxs("div",{className:a,style:{paddingLeft:`${12+e.depth*20}px`},role:"treeitem","aria-expanded":e.hasChildren?e.expanded:void 0,"aria-selected":e.selected,"aria-level":e.depth+1,onClick:o=>{const c=o.target;c.closest(".expand-btn")||c.closest(".tui-checkbox")||(e.hasChildren&&!e.expanded?s():i())},children:[e.hasChildren?p.jsx("button",{className:"expand-btn","data-track":"file-browser.expand","aria-label":e.expanded?"Collapse":"Expand",onClick:s,children:e.loading?p.jsx("span",{className:"spinner",children:"..."}):p.jsx("span",{className:["arrow",e.expanded?"expanded":""].filter(Boolean).join(" "),children:"▶"})}):p.jsx("span",{className:"expand-spacer"}),p.jsx(qs,{checked:e.selected,onChange:i}),p.jsx("span",{className:"node-name",children:e.name}),e.isGitRepo&&p.jsx("span",{className:"git-badge","aria-label":"Git repository",children:"git"})]})}function v3({visibleNodes:e,focusIndex:t,rootTruncated:s,onToggleExpand:i,onToggleSelect:a,onKeyDown:o,filterText:c,initialLoading:d}){return p.jsx("div",{className:"tree-container",role:"tree","aria-label":"File browser",onKeyDown:o,tabIndex:0,children:d?p.jsx("div",{className:"loading-placeholder",children:"Loading..."}):e.length===0?p.jsx("div",{className:"empty-placeholder",children:c?`No matches for "${c}"`:"No directories found"}):p.jsxs(p.Fragment,{children:[e.map((f,h)=>p.jsx(_3,{node:f,focused:h===t,onToggleExpand:()=>i(f),onToggleSelect:()=>a(f)},f.path)),s&&p.jsxs("div",{className:"truncated-notice",children:["Showing ",s.shown," of ",s.total," directories. Use the filter to narrow results."]})]})})}const y3=C.forwardRef(function({onSelectedPathsChange:t},s){const[i,a]=C.useState([]),[o,c]=C.useState(""),[d,f]=C.useState(-1),[h,g]=C.useState(!0),[_,y]=C.useState(null),b=C.useRef([]);function S(E){b.current=E,a([...E]),t(nE(E))}const w=C.useCallback(async()=>{g(!0),y(null);try{const E=await qh(),M=E.entries.map(U=>O1(U,0));b.current=M,a(M),E.truncated&&y({shown:E.entries.length,total:E.total})}catch{b.current=[],a([])}finally{g(!1)}},[]);C.useEffect(()=>{w()},[w]),C.useImperativeHandle(s,()=>({reset(){c(""),f(-1);function E(M){for(const U of M)U.selected=!1,U.expanded=!1,U.children&&E(U.children)}E(b.current),a([...b.current]),t([])}}));async function k(E){if(E.expanded){E.expanded=!1,a([...b.current]);return}if(E.children===null){E.loading=!0,a([...b.current]);try{const M=await qh(E.path);E.children=M.entries.map(U=>O1(U,E.depth+1)),E.truncatedInfo=M.truncated?{shown:M.entries.length,total:M.total}:null}catch{E.children=[]}finally{E.loading=!1}}E.expanded=!0,a([...b.current])}function T(E){E.selected=!E.selected,S(b.current)}const D=C.useMemo(()=>rE(i,o),[i,o]);function N(E){if(E.key==="ArrowDown"){E.preventDefault(),f(U=>Math.min(U+1,D.length-1));return}if(E.key==="ArrowUp"){E.preventDefault(),f(U=>Math.max(U-1,0));return}const M=d>=0?D[d]:void 0;if(M){if(E.key==="ArrowRight"){E.preventDefault(),M.hasChildren&&!M.expanded&&k(M);return}if(E.key==="ArrowLeft"){E.preventDefault(),M.expanded&&(M.expanded=!1,a([...b.current]));return}E.key===" "&&(E.preventDefault(),T(M))}}return p.jsxs("div",{className:"file-browser",children:[p.jsx("div",{className:"filter-row",children:p.jsx("input",{type:"text",className:"filter-input",placeholder:"Filter...",value:o,onChange:E=>c(E.currentTarget.value),"aria-label":"Filter directories",autoComplete:"off",spellCheck:!1})}),p.jsx(v3,{visibleNodes:D,focusIndex:d,rootTruncated:_,onToggleExpand:E=>void k(E),onToggleSelect:T,onKeyDown:N,filterText:o,initialLoading:h})]})}),b3=C.forwardRef(function({onWorkspacesAdded:t},s){const i=C.useRef(null),a=C.useRef(null),[o,c]=C.useState([]),[d,f]=C.useState(""),[h,g]=C.useState(!1);C.useImperativeHandle(s,()=>({open(){var b,S;c([]),f(""),g(!1),(b=a.current)==null||b.reset(),(S=i.current)==null||S.open()},close(){var b;(b=i.current)==null||b.close()}}));async function _(){var b;if(o.length!==0){g(!0),f("");try{const S=await s2(o);if(S.errors.length>0&&S.added.length===0){f(S.errors.map(w=>`${w.path}: ${w.error}`).join("; ")),g(!1);return}S.added.length>0&&t(S.added.map(w=>w.path)),S.errors.length>0,(b=i.current)==null||b.close()}catch{f("Failed to add workspaces.")}finally{g(!1)}}}const y=p.jsxs("div",{className:"add-workspace-footer-row",children:[p.jsx("span",{className:"add-workspace-selected-count",children:o.length>0?`${o.length} selected`:""}),p.jsxs("div",{className:"add-workspace-footer-actions",children:[p.jsx(Me,{variant:"ghost",onClick:()=>{var b;return(b=i.current)==null?void 0:b.close()},children:"Cancel"}),p.jsx(Me,{variant:"primary",onClick:_,disabled:o.length===0||h,children:h?"Adding...":`Add Workspace${o.length>1?"s":""}`})]})]});return p.jsx(Td,{ref:i,width:"520px",title:"Add Workspace",footer:y,children:p.jsxs("div",{className:"add-workspace-body-content",children:[p.jsx("p",{className:"add-workspace-dialog-desc",children:"Browse for folders on your machine. Git repos get PR tracking and branch management."}),p.jsx(y3,{ref:a,selectedPaths:o,onSelectedPathsChange:c}),d&&p.jsx("p",{className:"add-workspace-error-msg",children:d})]})})});function Sh({label:e,value:t,placeholder:s,onChange:i}){const[a,o]=C.useState(!1);return p.jsxs("div",{className:"workspace-editor__prompt-group",children:[p.jsxs("button",{className:"workspace-editor__prompt-toggle",onClick:()=>o(c=>!c),"aria-expanded":a,children:[p.jsx("span",{className:"workspace-editor__prompt-arrow",children:a?"▾":"▸"}),e]}),a&&p.jsx("textarea",{className:"workspace-editor__prompt-textarea",rows:3,placeholder:s,value:t,onChange:c=>i(c.currentTarget.value)})]})}function S3({values:e,branches:t,onChange:s}){return p.jsxs("section",{className:"workspace-editor__section",children:[p.jsx("h3",{className:"workspace-editor__section-label",children:"git settings"}),p.jsxs("div",{className:"workspace-editor__field",children:[p.jsx("label",{className:"workspace-editor__field-label",htmlFor:"ws-default-branch",children:"Branch new worktrees from"}),p.jsxs("select",{id:"ws-default-branch",className:"workspace-editor__field-select",value:e.defaultBranch,onChange:i=>s("defaultBranch",i.currentTarget.value),children:[p.jsx("option",{value:"",children:"-- auto --"}),t.map(i=>p.jsx("option",{value:i.name,children:i.name},i.name)),e.defaultBranch&&!t.some(i=>i.name===e.defaultBranch)&&p.jsx("option",{value:e.defaultBranch,children:e.defaultBranch})]})]}),p.jsxs("div",{className:"workspace-editor__field",children:[p.jsx("label",{className:"workspace-editor__field-label",htmlFor:"ws-remote",children:"Remote origin"}),p.jsx("input",{id:"ws-remote",type:"text",className:"workspace-editor__field-input",placeholder:"origin",value:e.remote,onChange:i=>s("remote",i.currentTarget.value)})]}),p.jsxs("div",{className:"workspace-editor__field",children:[p.jsx("label",{className:"workspace-editor__field-label",htmlFor:"ws-branch-prefix",children:"Branch prefix"}),p.jsx("input",{id:"ws-branch-prefix",type:"text",className:"workspace-editor__field-input",placeholder:"e.g. dy/",value:e.branchPrefix,onChange:i=>s("branchPrefix",i.currentTarget.value)})]})]})}const w3=["defaultAgent","defaultContinue","defaultYolo","launchInTmux"];function C3({values:e,overriddenKeys:t,onChange:s}){const i=t.some(a=>w3.includes(a));return p.jsxs("section",{className:"workspace-editor__section",children:[p.jsxs("h3",{className:"workspace-editor__section-label",children:["session defaults",i&&p.jsx("span",{className:"workspace-editor__override-badge",children:"overridden"})]}),p.jsxs("div",{className:"workspace-editor__inline-row",children:[p.jsx("label",{className:"workspace-editor__field-label",htmlFor:"ws-agent",children:"Default agent"}),p.jsxs("select",{id:"ws-agent",className:["workspace-editor__field-select","workspace-editor__field-select-inline"].join(" "),value:e.defaultAgent,onChange:a=>s("defaultAgent",a.currentTarget.value),children:[p.jsx("option",{value:"claude",children:"Claude"}),p.jsx("option",{value:"codex",children:"Codex"}),p.jsx("option",{value:"opencode",children:"OpenCode"})]})]}),p.jsxs("div",{className:"workspace-editor__checkbox-row",children:[p.jsx(qs,{checked:e.defaultContinue,onChange:a=>s("defaultContinue",a),children:"Continue"}),p.jsx(qs,{checked:e.defaultYolo,onChange:a=>s("defaultYolo",a),children:"YOLO"}),p.jsx(qs,{checked:e.launchInTmux,onChange:a=>s("launchInTmux",a),children:"Tmux"})]})]})}function x3({values:e,onChange:t}){return p.jsxs("section",{className:"workspace-editor__section",children:[p.jsx("h3",{className:"workspace-editor__section-label",children:"prompts"}),p.jsx(Sh,{label:"Code review preferences",value:e.promptCodeReview,placeholder:"e.g. focus on security, error handling",onChange:s=>t("promptCodeReview",s)}),p.jsx(Sh,{label:"Create PR preferences",value:e.promptCreatePr,placeholder:"e.g. include test plan section",onChange:s=>t("promptCreatePr",s)}),p.jsx(Sh,{label:"Branch rename preferences",value:e.promptBranchRename,placeholder:"e.g. prefix with dy/, use conventional commits style",onChange:s=>t("promptBranchRename",s)}),p.jsx(Sh,{label:"General preferences",value:e.promptGeneral,placeholder:"e.g. use TypeScript, follow CLAUDE.md",onChange:s=>t("promptGeneral",s)})]})}function k3({values:e,onChange:t,branches:s,overriddenKeys:i,error:a}){return p.jsxs("div",{className:"workspace-editor",children:[a&&p.jsx("p",{className:"workspace-editor__error-msg",children:a}),p.jsx(S3,{values:e,branches:s,onChange:t}),p.jsx("div",{className:"workspace-editor__divider"}),p.jsx(C3,{values:e,overriddenKeys:i,onChange:t}),p.jsx("div",{className:"workspace-editor__divider"}),p.jsx(x3,{values:e,onChange:t})]})}const j1={defaultBranch:"",remote:"",branchPrefix:"",defaultAgent:"claude",defaultContinue:!1,defaultYolo:!1,launchInTmux:!1,promptCodeReview:"",promptCreatePr:"",promptBranchRename:"",promptGeneral:""},E3=["defaultAgent","defaultContinue","defaultYolo","launchInTmux"];function P1(e){return{defaultBranch:e.defaultBranch??"",remote:e.remote??"",branchPrefix:e.branchPrefix??"",defaultAgent:e.defaultAgent==="codex"?"codex":"claude",defaultContinue:e.defaultContinue??!1,defaultYolo:e.defaultYolo??!1,launchInTmux:e.launchInTmux??!1,promptCodeReview:e.promptCodeReview??"",promptCreatePr:e.promptCreatePr??"",promptBranchRename:e.promptBranchRename??"",promptGeneral:e.promptGeneral??""}}function T3(e,t){const s={};return e.defaultAgent!==t.defaultAgent&&(s.defaultAgent=e.defaultAgent),e.defaultContinue!==t.defaultContinue&&(s.defaultContinue=e.defaultContinue),e.defaultYolo!==t.defaultYolo&&(s.defaultYolo=e.defaultYolo),e.launchInTmux!==t.launchInTmux&&(s.launchInTmux=e.launchInTmux),e.defaultBranch&&(s.defaultBranch=e.defaultBranch),e.remote&&(s.remote=e.remote),e.branchPrefix&&(s.branchPrefix=e.branchPrefix),e.promptCodeReview&&(s.promptCodeReview=e.promptCodeReview),e.promptCreatePr&&(s.promptCreatePr=e.promptCreatePr),e.promptBranchRename&&(s.promptBranchRename=e.promptBranchRename),e.promptGeneral&&(s.promptGeneral=e.promptGeneral),s}function N3({workspaceName:e,onClose:t}){return p.jsxs("div",{className:"workspace-settings-dialog-header",children:[p.jsxs("h2",{className:"workspace-settings-dialog-title",children:[p.jsx("span",{className:"workspace-settings-gear-icon",children:p.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"square",width:"14",height:"14",children:[p.jsx("circle",{cx:"12",cy:"12",r:"3"}),p.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1-1.51H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]})}),e]}),p.jsx("button",{className:"workspace-settings-close-btn","aria-label":"Close settings",onClick:t,children:p.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"square",width:"14",height:"14",children:[p.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),p.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})}const A3=C.forwardRef(function({onRemoveWorkspace:t},s){const i=C.useRef(null),[a,o]=C.useState(""),[c,d]=C.useState(""),[f,h]=C.useState(!1),[g,_]=C.useState(""),[y,b]=C.useState(!1),[S,w]=C.useState([]),[k,T]=C.useState([]),[D,N]=C.useState({}),[E,M]=C.useState(j1);C.useImperativeHandle(s,()=>({async open(Y,K){var X;o(Y),d(K),_(""),b(!1),h(!1),M(j1),(X=i.current)==null||X.showModal();try{const[P,j]=await Promise.all([iw(Y),cx(Y).catch(()=>[])]);w(j),M(P1(P.settings)),N({defaultAgent:P.settings.defaultAgent,defaultContinue:P.settings.defaultContinue,defaultYolo:P.settings.defaultYolo,launchInTmux:P.settings.launchInTmux}),T(P.overridden)}catch{_("Failed to load workspace settings.")}},close(){var Y;(Y=i.current)==null||Y.close()}}));function U(Y,K){M(X=>({...X,[Y]:K}))}async function W(){h(!0),_(""),b(!1);try{const Y=T3(E,D);Object.keys(Y).length>0&&await nw(a,Y),b(!0),setTimeout(()=>b(!1),2e3)}catch(Y){_(Y instanceof Error?Y.message:"Failed to save settings.")}finally{h(!1)}}async function B(){h(!0),_("");try{await nw(a,{defaultAgent:null,defaultContinue:null,defaultYolo:null,launchInTmux:null});const Y=await iw(a);M(P1(Y.settings)),N({defaultAgent:Y.settings.defaultAgent,defaultContinue:Y.settings.defaultContinue,defaultYolo:Y.settings.defaultYolo,launchInTmux:Y.settings.launchInTmux}),T(Y.overridden),b(!0),setTimeout(()=>b(!1),2e3)}catch(Y){_(Y instanceof Error?Y.message:"Failed to reset settings.")}finally{h(!1)}}const $=k.some(Y=>E3.includes(Y));return p.jsx("dialog",{ref:i,className:"workspace-settings-dialog",onClick:Y=>{var K;Y.target===i.current&&((K=i.current)==null||K.close())},children:p.jsxs("div",{className:"workspace-settings-dialog-content",children:[p.jsx(N3,{workspaceName:c,onClose:()=>{var Y;return(Y=i.current)==null?void 0:Y.close()}}),p.jsx("div",{className:"workspace-settings-dialog-body",children:p.jsx(k3,{values:E,onChange:U,branches:S,overriddenKeys:k,error:g})}),p.jsxs("div",{className:"workspace-settings-dialog-footer",children:[p.jsx(Me,{variant:"danger",onClick:()=>{var Y;(Y=i.current)==null||Y.close(),t(a)},children:"Remove Workspace"}),p.jsxs("div",{className:"workspace-settings-footer-right",children:[$&&p.jsx(Me,{variant:"ghost",onClick:()=>void B(),disabled:f,children:"Reset to Global"}),y&&p.jsx("span",{className:"workspace-settings-save-success",children:"Saved"}),p.jsx(Me,{variant:"primary",onClick:()=>void W(),disabled:f,children:f?"Saving…":"Save"})]})]})]})})});function dc(e){if(e==null||Number.isNaN(e))return"---";const t=Math.abs(e);return t<1e3?String(Math.round(e)):t<1e6?`${(e/1e3).toFixed(t>=1e4?0:1)}k`:t<1e9?`${(e/1e6).toFixed(t>=1e7?0:1)}M`:`${(e/1e9).toFixed(1)}B`}function dv(e){if(e==null||Number.isNaN(e))return"---";const t=Math.round(e);if(t<60)return`${t}s`;const s=Math.floor(t/60),i=t%60;if(s<60)return i>0?`${s}m ${i}s`:`${s}m`;const a=Math.floor(s/60),o=s%60;return o>0?`${a}h ${o}m`:`${a}h`}function R3(e){return e==null||Number.isNaN(e)?"---":dv(e/1e3)}function B1(e,t){const s=Math.max(0,Math.min(100,e)),i=Math.round(s/100*t);return"█".repeat(i)+"░".repeat(t-i)}function D3(e){try{const t=new Date(e);return`${t.toLocaleString(void 0,{month:"short"}).toLowerCase()} ${t.getDate()}`}catch{return"---"}}function L3(e){try{return new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})}catch{return"---"}}function M3({overview:e}){return p.jsxs("section",{className:"analytics-section",children:[p.jsx("h2",{className:"analytics-section-title",children:"overview (last 7 days)"}),p.jsx("div",{className:"analytics-section-divider"}),e?p.jsxs("div",{className:"analytics-kv-list",children:[p.jsxs("div",{className:"analytics-kv-row",children:[p.jsx("span",{className:"analytics-kv-label",children:"sessions:"}),p.jsx("span",{className:"analytics-kv-value",children:e.totalSessions})]}),p.jsxs("div",{className:"analytics-kv-row",children:[p.jsx("span",{className:"analytics-kv-label",children:"tokens:"}),p.jsxs("span",{className:"analytics-kv-value",children:[p.jsxs("span",{className:"analytics-token-down",children:["↓",dc(e.totalTokensIn)]})," ",p.jsxs("span",{className:"analytics-token-up",children:["↑",dc(e.totalTokensOut)]})]})]}),p.jsxs("div",{className:"analytics-kv-row",children:[p.jsx("span",{className:"analytics-kv-label",children:"cache:"}),p.jsxs("span",{className:"analytics-kv-value",children:[dc(e.totalCacheRead)," read"]})]}),p.jsxs("div",{className:"analytics-kv-row",children:[p.jsx("span",{className:"analytics-kv-label",children:"avg duration:"}),p.jsx("span",{className:"analytics-kv-value",children:dv(e.avgSessionDuration)})]}),p.jsxs("div",{className:"analytics-kv-row",children:[p.jsx("span",{className:"analytics-kv-label",children:"avg human latency:"}),p.jsx("span",{className:"analytics-kv-value",children:R3(e.avgHumanResponseLatency)})]}),p.jsxs("div",{className:"analytics-kv-row",children:[p.jsx("span",{className:"analytics-kv-label",children:"agent idle:"}),p.jsx("span",{className:"analytics-kv-value",children:e.avgAgentIdlePercent!=null?e.avgAgentIdlePercent.toFixed(1)+"%":"---"})]}),p.jsxs("div",{className:"analytics-kv-row",children:[p.jsx("span",{className:"analytics-kv-label",children:"rate limits:"}),p.jsxs("span",{className:"analytics-kv-value",children:[e.totalRateLimitEncounters," encounters"]})]})]}):p.jsx("div",{className:"analytics-empty-text",children:"no data"})]})}function O3({rateLimits:e}){const t=C.useMemo(()=>{var s;return(s=e==null?void 0:e.snapshots)!=null&&s.length?e.snapshots[e.snapshots.length-1]:null},[e]);return p.jsxs("section",{className:"analytics-section",children:[p.jsx("h2",{className:"analytics-section-title",children:"rate limits"}),p.jsx("div",{className:"analytics-section-divider"}),t?p.jsxs("div",{className:"analytics-kv-list",children:[p.jsxs("div",{className:"analytics-kv-row",children:[p.jsx("span",{className:"analytics-kv-label",children:"5-hour:"}),p.jsxs("span",{className:"analytics-kv-value analytics-bar-row",children:[p.jsx("span",{className:"analytics-bar",children:B1(t.fiveHourPercent,20)}),p.jsxs("span",{className:"analytics-bar-pct",children:[Math.round(t.fiveHourPercent),"%"]})]})]}),p.jsxs("div",{className:"analytics-kv-row",children:[p.jsx("span",{className:"analytics-kv-label",children:"7-day:"}),p.jsxs("span",{className:"analytics-kv-value analytics-bar-row",children:[p.jsx("span",{className:"analytics-bar",children:B1(t.sevenDayPercent,20)}),p.jsxs("span",{className:"analytics-bar-pct",children:[Math.round(t.sevenDayPercent),"%"]})]})]})]}):p.jsx("div",{className:"analytics-empty-text",children:"no rate limit data"})]})}function j3({tools:e}){var i;const t=C.useMemo(()=>{var a;return(a=e==null?void 0:e.tools)!=null&&a.length?Math.max(...e.tools.map(o=>o.totalUses)):1},[e]),s=16;return p.jsxs("section",{className:"analytics-section",children:[p.jsx("h2",{className:"analytics-section-title",children:"tool usage (by count)"}),p.jsx("div",{className:"analytics-section-divider"}),(i=e==null?void 0:e.tools)!=null&&i.length?p.jsx("div",{className:"analytics-tool-list",children:e.tools.slice(0,10).map(a=>{const o=t>0?Math.round(a.totalUses/t*s):0;return p.jsxs("div",{className:"analytics-tool-row",children:[p.jsx("span",{className:"analytics-tool-name",children:a.name}),p.jsxs("span",{className:"analytics-tool-bar",children:["█".repeat(o),"░".repeat(s-o)]}),p.jsx("span",{className:"analytics-tool-count",children:a.totalUses})]},a.name)})}):p.jsx("div",{className:"analytics-empty-text",children:"no tool data"})]})}function P3({sessions:e,onSelectSession:t}){var s;return p.jsxs("section",{className:"analytics-section",children:[p.jsx("h2",{className:"analytics-section-title",children:"sessions (most recent)"}),p.jsx("div",{className:"analytics-section-divider"}),(s=e==null?void 0:e.sessions)!=null&&s.length?p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"analytics-sessions-table-wrap",children:p.jsxs("table",{className:"analytics-sessions-table",children:[p.jsx("thead",{children:p.jsxs("tr",{children:[p.jsx("th",{children:"time"}),p.jsx("th",{children:"repo"}),p.jsx("th",{children:"duration"}),p.jsx("th",{children:"tokens"}),p.jsx("th",{children:"turns"}),p.jsx("th",{children:"tools"})]})}),p.jsx("tbody",{children:e.sessions.map(i=>p.jsxs("tr",{className:"analytics-session-row",onClick:()=>t(i.sessionId),role:"button",tabIndex:0,onKeyDown:a=>{a.key==="Enter"&&t(i.sessionId)},children:[p.jsxs("td",{className:"analytics-cell-time",children:[p.jsx("span",{className:"analytics-date-part",children:D3(i.startedAt)}),p.jsx("span",{className:"analytics-time-part",children:L3(i.startedAt)})]}),p.jsx("td",{className:"analytics-cell-repo",children:i.repoName??"---"}),p.jsx("td",{className:"analytics-cell-duration",children:dv(i.durationSeconds)}),p.jsxs("td",{children:[p.jsxs("span",{className:"analytics-token-down",children:["↓",dc(i.totalInputTokens)]})," ",p.jsxs("span",{className:"analytics-token-up",children:["↑",dc(i.totalOutputTokens)]})]}),p.jsx("td",{className:"analytics-cell-turns",children:i.turnCount}),p.jsx("td",{className:"analytics-cell-tools",children:i.topTools.slice(0,3).join(", ")||"---"})]},i.sessionId))})]})}),e.total>e.sessions.length&&p.jsxs("div",{className:"analytics-sessions-count",children:["showing ",e.sessions.length," of ",e.total]})]}):p.jsx("div",{className:"analytics-empty-text",children:"no sessions recorded"})]})}function B3({onSelectSession:e,onClose:t}){const[s,i]=C.useState(null),[a,o]=C.useState(null),[c,d]=C.useState(null),[f,h]=C.useState(null),[g,_]=C.useState(!0),[y,b]=C.useState(null);return C.useEffect(()=>{let S=!1;return _(!0),b(null),Promise.all([O2(7),j2({limit:20}),B2(7),I2(24)]).then(([w,k,T,D])=>{S||(i(w),o(k),d(T),h(D))}).catch(w=>{S||b(w instanceof Error?w.message:"failed to load analytics")}).finally(()=>{S||_(!1)}),()=>{S=!0}},[]),g?p.jsxs("div",{className:"analytics-dashboard",children:[p.jsxs("div",{className:"analytics-header-row",children:[p.jsx("h1",{className:"analytics-page-title",children:"analytics"}),t&&p.jsx("button",{className:"analytics-close-btn",onClick:t,title:"close analytics",children:"✕"})]}),p.jsx("div",{className:"analytics-divider"}),p.jsx("div",{className:"analytics-loading-state",children:"loading analytics data..."})]}):y?p.jsxs("div",{className:"analytics-dashboard",children:[p.jsxs("div",{className:"analytics-header-row",children:[p.jsx("h1",{className:"analytics-page-title",children:"analytics"}),t&&p.jsx("button",{className:"analytics-close-btn",onClick:t,title:"close analytics",children:"✕"})]}),p.jsx("div",{className:"analytics-divider"}),p.jsxs("div",{className:"analytics-error-state",children:["error: ",y]})]}):p.jsxs("div",{className:"analytics-dashboard",children:[p.jsx("h1",{className:"analytics-page-title",children:"analytics"}),p.jsx("div",{className:"analytics-divider"}),p.jsxs("div",{className:"analytics-top-grid",children:[p.jsx(M3,{overview:s}),p.jsx(O3,{rateLimits:f})]}),p.jsx(j3,{tools:c}),p.jsx(P3,{sessions:a,onSelectSession:e})]})}function Bm(e){if(e==null||Number.isNaN(e))return"---";const t=Math.abs(e);return t<1e3?String(Math.round(e)):t<1e6?`${(e/1e3).toFixed(t>=1e4?0:1)}k`:t<1e9?`${(e/1e6).toFixed(t>=1e7?0:1)}M`:`${(e/1e9).toFixed(1)}B`}function fv(e){if(e==null||Number.isNaN(e))return"---";const t=Math.round(e);if(t<60)return`${t}s`;const s=Math.floor(t/60),i=t%60;if(s<60)return i>0?`${s}m ${i}s`:`${s}m`;const a=Math.floor(s/60),o=s%60;return o>0?`${a}h ${o}m`:`${a}h`}function Im(e){return e==null||Number.isNaN(e)?"---":fv(e/1e3)}function I3(e){try{return new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{return"---"}}function z3(e){return e.length>12?e.slice(0,12):e}function H3(e){switch(e){case"session_start":case"session_end":return"●";case"user_prompt":return"◆";case"tool_use":return"▸";case"agent_stop":return"■";case"notification":return"⚡";default:return"○"}}function U3(e){switch(e.type){case"session_start":return"session start";case"session_end":return"session end";case"user_prompt":return"user prompt";case"tool_use":{const t=e.data.tool??e.data.name??"unknown",s=e.data.target??e.data.path??"";return s?`${t} ${s}`:String(t)}case"agent_stop":return"agent stop";case"notification":return String(e.data.notificationType??e.data.message??"notification");case"rate_limit":return"rate limit hit";default:return e.type.replace(/_/g," ")}}function F3({sess:e}){return p.jsxs("section",{className:"sd-section",children:[p.jsx("h2",{className:"sd-section-title",children:"metrics"}),p.jsx("div",{className:"sd-section-divider"}),p.jsxs("div",{className:"sd-kv-list",children:[p.jsxs("div",{className:"sd-kv-row",children:[p.jsx("span",{className:"sd-kv-label",children:"duration:"}),p.jsx("span",{className:"sd-kv-value",children:fv(e.durationSeconds)})]}),p.jsxs("div",{className:"sd-kv-row",children:[p.jsx("span",{className:"sd-kv-label",children:"tokens:"}),p.jsxs("span",{className:"sd-kv-value",children:[p.jsxs("span",{className:"sd-token-down",children:["↓",Bm(e.totalInputTokens)]})," ",p.jsxs("span",{className:"sd-token-up",children:["↑",Bm(e.totalOutputTokens)]}),e.totalCacheRead>0&&p.jsxs(p.Fragment,{children:[" ",p.jsxs("span",{className:"sd-cache-info",children:["(cache: ",Bm(e.totalCacheRead)," read)"]})]})]})]}),p.jsxs("div",{className:"sd-kv-row",children:[p.jsx("span",{className:"sd-kv-label",children:"turns:"}),p.jsx("span",{className:"sd-kv-value",children:e.turnCount})]}),p.jsxs("div",{className:"sd-kv-row",children:[p.jsx("span",{className:"sd-kv-label",children:"subagents:"}),p.jsx("span",{className:"sd-kv-value",children:e.subagentCount})]}),p.jsxs("div",{className:"sd-kv-row",children:[p.jsx("span",{className:"sd-kv-label",children:"human latency:"}),p.jsxs("span",{className:"sd-kv-value",children:["avg ",Im(e.humanResponseLatencyAvgMs)," ","p50 ",Im(e.humanResponseLatencyP50Ms)," ","p95 ",Im(e.humanResponseLatencyP95Ms)]})]}),p.jsxs("div",{className:"sd-kv-row",children:[p.jsx("span",{className:"sd-kv-label",children:"agent idle:"}),p.jsx("span",{className:"sd-kv-value",children:e.agentIdlePercent!=null?e.agentIdlePercent.toFixed(1)+"%":"---"})]}),p.jsxs("div",{className:"sd-kv-row",children:[p.jsx("span",{className:"sd-kv-label",children:"rate limits:"}),p.jsx("span",{className:"sd-kv-value",children:e.rateLimitEncounters})]})]})]})}function $3({toolBreakdown:e}){const t=C.useMemo(()=>{const a=Object.entries(e).map(([o,c])=>({name:o,count:c.count}));return a.sort((o,c)=>c.count-o.count),a},[e]),s=C.useMemo(()=>t.length>0?Math.max(...t.map(a=>a.count)):1,[t]),i=16;return p.jsxs("section",{className:"sd-section",children:[p.jsx("h2",{className:"sd-section-title",children:"tool breakdown"}),p.jsx("div",{className:"sd-section-divider"}),t.length>0?p.jsx("div",{className:"sd-tool-list",children:t.map(a=>{const o=s>0?Math.round(a.count/s*i):0;return p.jsxs("div",{className:"sd-tool-row",children:[p.jsx("span",{className:"sd-tool-name",children:a.name}),p.jsxs("span",{className:"sd-tool-bar",children:["█".repeat(o),"░".repeat(i-o)]}),p.jsxs("span",{className:"sd-tool-count",children:[a.count," uses"]})]},a.name)})}):p.jsx("div",{className:"sd-empty-text",children:"no tool data"})]})}function V3({events:e}){const t=C.useMemo(()=>{const s=[];for(let i=0;i<e.length;i++){const a=e[i];if(s.push({kind:"event",timestamp:a.timestamp,symbol:H3(a.type),label:U3(a)}),a.type==="agent_stop"&&i+1<e.length){const o=e[i+1];if(o.type==="user_prompt"){const c=(new Date(o.timestamp).getTime()-new Date(a.timestamp).getTime())/1e3;c>1&&s.push({kind:"idle",idleSeconds:c})}}}return s},[e]);return p.jsxs("section",{className:"sd-section",children:[p.jsx("h2",{className:"sd-section-title",children:"event timeline"}),p.jsx("div",{className:"sd-section-divider"}),t.length>0?p.jsx("div",{className:"sd-timeline",children:t.map((s,i)=>s.kind==="event"?p.jsxs("div",{className:"sd-timeline-event",children:[p.jsx("span",{className:"sd-tl-time",children:I3(s.timestamp)}),p.jsx("span",{className:"sd-tl-symbol",children:s.symbol}),p.jsx("span",{className:"sd-tl-label",children:s.label})]},i):p.jsx("div",{className:"sd-timeline-idle",children:p.jsxs("span",{className:"sd-idle-line",children:["─".repeat(3)," human idle: ",fv(s.idleSeconds)," ","─".repeat(3)]})},i))}):p.jsx("div",{className:"sd-empty-text",children:"no events recorded"})]})}function W3({sessionId:e,onBack:t}){const[s,i]=C.useState(null),[a,o]=C.useState(!0),[c,d]=C.useState(null);C.useEffect(()=>{let _=!1;return o(!0),d(null),P2(e).then(y=>{_||i(y)}).catch(y=>{_||d(y instanceof Error?y.message:"failed to load session")}).finally(()=>{_||o(!1)}),()=>{_=!0}},[e]);const f=(s==null?void 0:s.session)??null,h=(s==null?void 0:s.toolBreakdown)??{},g=(s==null?void 0:s.events)??[];return p.jsxs("div",{className:"session-detail",children:[p.jsx("button",{className:"sd-back-btn",onClick:t,tabIndex:0,children:"← back"}),a?p.jsx("div",{className:"sd-loading-state",children:"loading session detail..."}):c?p.jsxs("div",{className:"sd-error-state",children:["error: ",c]}):f?p.jsxs(p.Fragment,{children:[p.jsxs("h1",{className:"sd-page-title",children:["session ",z3(f.sessionId),f.repoName&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"sd-title-sep",children:"—"}),p.jsx("span",{className:"sd-title-meta",children:f.repoName})]}),f.model&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"sd-title-sep",children:"—"}),p.jsx("span",{className:"sd-title-meta",children:f.model})]})]}),p.jsx("div",{className:"sd-divider"}),p.jsx(F3,{sess:f}),p.jsx($3,{toolBreakdown:h}),p.jsx(V3,{events:g})]}):p.jsx("div",{className:"sd-error-state",children:"session not found"})]})}const G3="modulepreload",q3=function(e){return"/"+e},I1={},L=function(t,s,i){let a=Promise.resolve();if(s&&s.length>0){let c=function(h){return Promise.all(h.map(g=>Promise.resolve(g).then(_=>({status:"fulfilled",value:_}),_=>({status:"rejected",reason:_}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),f=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));a=c(s.map(h=>{if(h=q3(h),h in I1)return;I1[h]=!0;const g=h.endsWith(".css"),_=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${_}`))return;const y=document.createElement("link");if(y.rel=g?"stylesheet":G3,g||(y.as="script"),y.crossOrigin="",y.href=h,f&&y.setAttribute("nonce",f),document.head.appendChild(y),g)return new Promise((b,S)=>{y.addEventListener("load",b),y.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${h}`)))})}))}function o(c){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=c,window.dispatchEvent(d),!d.defaultPrevented)throw c}return a.then(c=>{for(const d of c||[])d.status==="rejected"&&o(d.reason);return t().catch(o)})},K3={added:"+",modified:"~",deleted:"-",renamed:"→",untracked:"?"},Y3={added:"var(--status-success)",modified:"var(--status-warning)",deleted:"var(--status-error)",renamed:"var(--status-info)",untracked:"var(--text-muted)"};function pv(e,t){return e==="staged"?"cached":e==="branch"?t:void 0}function z1(e){const t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}const X3=C.forwardRef(function({files:t,activeFile:s,onSelectFile:i},a){const[o,c]=C.useState(0),d=C.useRef(o);return d.current=o,C.useImperativeHandle(a,()=>({moveFocus(f){const h=Math.max(0,Math.min(t.length-1,d.current+f));c(h);const g=t[h];g&&i(g)},getFocusedIndex(){return d.current}})),C.useEffect(()=>{if(s){const f=t.findIndex(h=>h.path===s);f>=0&&c(f)}},[s,t]),p.jsx("div",{className:"diff-sidebar",role:"listbox","aria-label":"changed files",children:t.map((f,h)=>p.jsxs("button",{className:["sidebar-file",s===f.path&&"active",o===h&&"focused"].filter(Boolean).join(" "),role:"option","aria-selected":s===f.path,"data-file-index":h,onClick:()=>{c(h),i(f)},children:[p.jsx("span",{className:"status",style:{color:Y3[f.status]??"var(--text-muted)"},children:K3[f.status]??"?"}),p.jsxs("span",{className:"name",title:f.path,children:[ND(f.path),z1(f.path)?p.jsxs("span",{className:"dir",children:[z1(f.path),"/"]}):null]}),p.jsxs("span",{className:"stats",children:[p.jsxs("span",{className:"stat-add",children:["+",f.additions]}),p.jsxs("span",{className:"stat-del",children:["-",f.deletions]})]})]},f.path))})});function Q3(e,t,s){if(s==="deleted")return"deleted file";if(s==="untracked"){const d=J3(e);return d?`new file: ${d}`:"new file"}const i=e.split(`
|
|
111
|
+
`).filter(d=>d.startsWith("+")&&!d.startsWith("+++")),a=e.split(`
|
|
112
|
+
`).filter(d=>d.startsWith("-")&&!d.startsWith("---")),o=i.map(d=>d.slice(1)).map(d=>Z3(d)).filter(Boolean);if(o.length===1)return`added ${o[0]}()`;if(o.length>1)return`added ${o.length} functions`;const c=eI(e);return c.length===1?`modified ${i.length} lines in ${c[0]}()`:c.length>1?`modified ${c.length} functions`:`+${i.length} -${a.length} lines`}function Z3(e){const t=e.match(/(?:export\s+)?(?:async\s+)?function\s+(\w+)|(?:const|let|var)\s+(\w+)\s*=\s*(?:async\s*)?\(/);return t?t[1]??t[2]??null:null}function J3(e){var s;return((s=e.split(`
|
|
113
|
+
`).filter(i=>i.startsWith("+")&&!i.startsWith("+++")).map(i=>i.slice(1).trim()).filter(i=>i&&!i.startsWith("import ")&&!i.startsWith("//")&&!i.startsWith("/*"))[0])==null?void 0:s.slice(0,60))??null}function eI(e){return(e.match(/@@ .+? @@\s*(.+)/g)||[]).map(s=>{const i=s.match(/@@ .+? @@\s*(?:export\s+)?(?:async\s+)?(?:function\s+)?(\w+)/);return(i==null?void 0:i[1])??null}).filter(s=>s!==null&&s!=="function")}const tI=qe.lazy(()=>L(()=>Promise.resolve().then(()=>MH),void 0).catch(()=>({default:()=>p.jsx("div",{className:"fpd-empty",children:"diff viewer not available"})}))),sI=qe.lazy(()=>L(()=>Promise.resolve().then(()=>YH),void 0).catch(()=>({default:()=>p.jsx(p.Fragment,{})})));function iI(e){return e==="cached"?"staged":e?"branch":"working"}function nI(e,t){const[s,i]=C.useState([]),[a,o]=C.useState(!0),[c,d]=C.useState(""),[f,h]=C.useState(!1),[g,_]=C.useState(""),y=C.useCallback(async(S,w)=>{o(!0);try{const k=await wx(e,t);i(k.files),w(k.files)}catch{i([]),w([])}finally{o(!1)}},[e,t]),b=C.useCallback(async(S,w)=>{h(!0),_("");try{const k=await Cx(e,S,t);d(k.diff);const T=w.find(D=>D.path===S);T&&k.diff&&_(Q3(k.diff,S,T.status))}catch{d("")}finally{h(!1)}},[e,t]);return{files:s,loading:a,fileDiff:c,diffLoading:f,summary:g,loadFiles:y,loadDiff:b}}function rI({workspacePath:e,initialFile:t,initialBase:s,onClose:i}){const[a,o]=C.useState(iI(s)),[c,d]=C.useState(s&&s!=="cached"?s:"main"),[f,h]=C.useState("unified"),[g,_]=C.useState(t??null),[y,b]=C.useState(0),[S,w]=C.useState(-1),k=C.useRef(null),T=C.useRef([]),D=C.useMemo(()=>pv(a,c)??"",[a,c]),{files:N,loading:E,fileDiff:M,diffLoading:U,summary:W,loadFiles:B,loadDiff:$}=nI(e,D);T.current=N,C.useEffect(()=>{B(g,j=>{_(H=>!H||!j.some(O=>O.path===H)?j.length>0?j[0].path:null:H)})},[D,B]),C.useEffect(()=>{g&&$(g,T.current)},[g,D,$]),C.useEffect(()=>{e&&c==="main"&&xx(e).then(j=>d(j)).catch(()=>{})},[e,c]);const Y=C.useCallback(j=>{const H=document.querySelectorAll(".fpd-main .hunk-header"),O=H.length;if(O===0)return;const z=S+j;z<0||z>=O||(w(z),H[z].scrollIntoView({block:"center",behavior:"smooth"}))},[S]);C.useEffect(()=>{function j(H){var z,Q,re;const O=(z=H.target)==null?void 0:z.tagName;if(!(O==="INPUT"||O==="TEXTAREA"||O==="SELECT")){if(H.key==="Escape"){H.preventDefault(),i();return}H.key==="j"?(H.preventDefault(),(Q=k.current)==null||Q.moveFocus(1)):H.key==="k"?(H.preventDefault(),(re=k.current)==null||re.moveFocus(-1)):H.key==="n"?(H.preventDefault(),Y(1)):H.key==="p"&&(H.preventDefault(),Y(-1))}}return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[i,Y]);const K=C.useCallback(j=>_(j.path),[]),X=C.useCallback(j=>{b(j),w(-1)},[]),P=C.useCallback(()=>h(j=>j==="unified"?"side-by-side":"unified"),[]);return p.jsxs("div",{className:"full-page-diff",children:[p.jsxs("div",{className:"fpd-header",children:[p.jsx("button",{className:"fpd-close-btn",onClick:i,"aria-label":"close diff view",children:"[x] close"}),p.jsx("span",{className:"fpd-title",children:g?p.jsxs(p.Fragment,{children:[g,W&&p.jsxs("span",{className:"fpd-summary",children:[" — ",W]})]}):"diff view"}),p.jsxs("div",{className:"fpd-controls",children:[p.jsx(qe.Suspense,{fallback:null,children:p.jsx(sI,{value:a,onchange:j=>o(j),defaultBranch:c})}),p.jsx("button",{className:"fpd-mode-toggle",onClick:P,title:"toggle unified/side-by-side",children:f==="unified"?"[split]":"[unified]"})]})]}),p.jsxs("div",{className:"fpd-body",children:[p.jsx(X3,{ref:k,files:N,activeFile:g,onSelectFile:K}),p.jsx("div",{className:"fpd-main",children:g?p.jsx(qe.Suspense,{fallback:p.jsx("div",{className:"fpd-empty",children:"loading..."}),children:p.jsx(tI,{diff:M,filePath:g,loading:U,mode:f,onHunkCount:X})}):E?p.jsx("div",{className:"fpd-empty",children:"loading files..."}):p.jsx("div",{className:"fpd-empty",children:"no files changed"})})]}),p.jsxs("div",{className:"fpd-footer",children:[p.jsx("span",{className:"fpd-hint",children:"j/k navigate files"}),p.jsx("span",{className:"fpd-hint",children:"n/p jump hunks"}),p.jsx("span",{className:"fpd-hint",children:"esc close"}),p.jsx("span",{style:{display:"none"},children:y})]})]})}var fc;(function(e){e.INSERT="insert",e.DELETE="delete",e.CONTEXT="context"})(fc||(fc={}));const aI={LINE_BY_LINE:"line-by-line"},oI={NONE:"none"},lI={WORD:"word"};var __;(function(e){e.AUTO="auto",e.DARK="dark",e.LIGHT="light"})(__||(__={}));const cI=["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"],uI=RegExp("["+cI.join("\\")+"]","g");function hI(e){return e.replace(uI,"\\$&")}function H1(e,t){const s=e.split(".");return s.length>1?s[s.length-1]:t}function U1(e,t){return t.reduce((s,i)=>s||e.startsWith(i),!1)}const F1=["a/","b/","i/","w/","c/","o/"];function lr(e,t,s){const i=s!==void 0?[...F1,s]:F1,a=t?new RegExp(`^${hI(t)} "?(.+?)"?$`):new RegExp('^"?(.+?)"?$'),[,o=""]=a.exec(e)||[],c=i.find(f=>o.indexOf(f)===0);return(c?o.slice(c.length):o).replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [+-]\d{4}.*$/,"")}function dI(e,t){return lr(e,"---",t)}function fI(e,t){return lr(e,"+++",t)}function pI(e,t={}){const s=[];let i=null,a=null,o=null,c=null,d=null,f=null,h=null;const g="--- ",_="+++ ",y="@@",b=/^old mode (\d{6})/,S=/^new mode (\d{6})/,w=/^deleted file mode (\d{6})/,k=/^new file mode (\d{6})/,T=/^copy from "?(.+)"?/,D=/^copy to "?(.+)"?/,N=/^rename from "?(.+)"?/,E=/^rename to "?(.+)"?/,M=/^similarity index (\d+)%/,U=/^dissimilarity index (\d+)%/,W=/^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/,B=/^Binary files (.*) and (.*) differ/,$=/^GIT binary patch/,Y=/^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/,K=/^mode (\d{6}),(\d{6})\.\.(\d{6})/,X=/^new file mode (\d{6})/,P=/^deleted file mode (\d{6}),(\d{6})/,j=e.replace(/\/g,"").replace(/\r\n?/g,`
|
|
114
|
+
`).split(`
|
|
115
|
+
`);function H(){a!==null&&i!==null&&(i.blocks.push(a),a=null)}function O(){i!==null&&(!i.oldName&&f!==null&&(i.oldName=f),!i.newName&&h!==null&&(i.newName=h),i.newName&&(s.push(i),i=null)),f=null,h=null}function z(){H(),O(),i={blocks:[],deletedLines:0,addedLines:0}}function Q(A){H();let I;i!==null&&((I=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(A))?(i.isCombined=!1,o=parseInt(I[1],10),d=parseInt(I[2],10)):(I=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(A))?(i.isCombined=!0,o=parseInt(I[1],10),c=parseInt(I[2],10),d=parseInt(I[3],10)):(A.startsWith(y)&&console.error("Failed to parse lines, starting in 0!"),o=0,d=0,i.isCombined=!1)),a={lines:[],oldStartLine:o,oldStartLine2:c,newStartLine:d,header:A}}function re(A){if(i===null||a===null||o===null||d===null)return;const I={content:A},q=i.isCombined?["+ "," +","++"]:["+"],oe=i.isCombined?["- "," -","--"]:["-"];U1(A,q)?(i.addedLines++,I.type=fc.INSERT,I.oldNumber=void 0,I.newNumber=d++):U1(A,oe)?(i.deletedLines++,I.type=fc.DELETE,I.oldNumber=o++,I.newNumber=void 0):(I.type=fc.CONTEXT,I.oldNumber=o++,I.newNumber=d++),a.lines.push(I)}function ne(A,I){let q=I;for(;q<j.length-3;){if(A.startsWith("diff"))return!1;if(j[q].startsWith(g)&&j[q+1].startsWith(_)&&j[q+2].startsWith(y))return!0;q++}return!1}return j.forEach((A,I)=>{if(!A||A.startsWith("*"))return;let q;const oe=j[I-1],ve=j[I+1],Se=j[I+2];if(A.startsWith("diff --git")||A.startsWith("diff --combined")){if(z(),(q=/^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/.exec(A))&&(f=lr(q[1],void 0,t.dstPrefix),h=lr(q[2],void 0,t.srcPrefix)),i===null)throw new Error("Where is my file !!!");i.isGitDiff=!0;return}if(A.startsWith("Binary files")&&!(i!=null&&i.isGitDiff)){if(z(),(q=/^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/.exec(A))&&(f=lr(q[1],void 0,t.dstPrefix),h=lr(q[2],void 0,t.srcPrefix)),i===null)throw new Error("Where is my file !!!");i.isBinary=!0;return}if((!i||!i.isGitDiff&&i&&A.startsWith(g)&&ve.startsWith(_)&&Se.startsWith(y))&&z(),i!=null&&i.isTooBig)return;if(i&&(typeof t.diffMaxChanges=="number"&&i.addedLines+i.deletedLines>t.diffMaxChanges||typeof t.diffMaxLineLength=="number"&&A.length>t.diffMaxLineLength)){i.isTooBig=!0,i.addedLines=0,i.deletedLines=0,i.blocks=[],a=null;const ze=typeof t.diffTooBigMessage=="function"?t.diffTooBigMessage(s.length):"Diff too big to be displayed";Q(ze);return}if(A.startsWith(g)&&ve.startsWith(_)||A.startsWith(_)&&oe.startsWith(g)){if(i&&!i.oldName&&A.startsWith("--- ")&&(q=dI(A,t.srcPrefix))){i.oldName=q,i.language=H1(i.oldName,i.language);return}if(i&&!i.newName&&A.startsWith("+++ ")&&(q=fI(A,t.dstPrefix))){i.newName=q,i.language=H1(i.newName,i.language);return}}if(i&&(A.startsWith(y)||i.isGitDiff&&i.oldName&&i.newName&&!a)){Q(A);return}if(a&&(A.startsWith("+")||A.startsWith("-")||A.startsWith(" "))){re(A);return}const Ne=!ne(A,I);if(i===null)throw new Error("Where is my file !!!");(q=b.exec(A))?i.oldMode=q[1]:(q=S.exec(A))?i.newMode=q[1]:(q=w.exec(A))?(i.deletedFileMode=q[1],i.isDeleted=!0):(q=k.exec(A))?(i.newFileMode=q[1],i.isNew=!0):(q=T.exec(A))?(Ne&&(i.oldName=q[1]),i.isCopy=!0):(q=D.exec(A))?(Ne&&(i.newName=q[1]),i.isCopy=!0):(q=N.exec(A))?(Ne&&(i.oldName=q[1]),i.isRename=!0):(q=E.exec(A))?(Ne&&(i.newName=q[1]),i.isRename=!0):(q=B.exec(A))?(i.isBinary=!0,i.oldName=lr(q[1],void 0,t.srcPrefix),i.newName=lr(q[2],void 0,t.dstPrefix),Q("Binary file")):$.test(A)?(i.isBinary=!0,Q(A)):(q=M.exec(A))?i.unchangedPercentage=parseInt(q[1],10):(q=U.exec(A))?i.changedPercentage=parseInt(q[1],10):(q=W.exec(A))?(i.checksumBefore=q[1],i.checksumAfter=q[2],q[3]&&(i.mode=q[3])):(q=Y.exec(A))?(i.checksumBefore=[q[2],q[3]],i.checksumAfter=q[1]):(q=K.exec(A))?(i.oldMode=[q[2],q[3]],i.newMode=q[1]):(q=X.exec(A))?(i.newFileMode=q[1],i.isNew=!0):(q=P.exec(A))&&(i.deletedFileMode=q[1],i.isDeleted=!0)}),H(),O(),s}const mv={matching:oI.NONE,matchWordsThreshold:.25,maxLineLengthHighlight:1e4,diffStyle:lI.WORD,colorScheme:__.LIGHT};mv.colorScheme;const mI=Object.assign(Object.assign({},mv),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),gI=Object.assign(Object.assign({},mv),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200});var zm={},$1;function _I(){return $1||($1=1,(function(e){(function(t){var s=/\S/,i=/\"/g,a=/\n/g,o=/\r/g,c=/\\/g,d=/\u2028/,f=/\u2029/;t.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},t.scan=function($,Y){var K=$.length,X=0,P=1,j=2,H=X,O=null,z=null,Q="",re=[],ne=!1,A=0,I=0,q="{{",oe="}}";function ve(){Q.length>0&&(re.push({tag:"_t",text:new String(Q)}),Q="")}function Se(){for(var De=!0,le=I;le<re.length;le++)if(De=t.tags[re[le].tag]<t.tags._v||re[le].tag=="_t"&&re[le].text.match(s)===null,!De)return!1;return De}function Ne(De,le){if(ve(),De&&Se())for(var Ee=I,we;Ee<re.length;Ee++)re[Ee].text&&((we=re[Ee+1])&&we.tag==">"&&(we.indent=re[Ee].text.toString()),re.splice(Ee,1));else le||re.push({tag:`
|
|
116
|
+
`});ne=!1,I=re.length}function ze(De,le){var Ee="="+oe,we=De.indexOf(Ee,le),Re=g(De.substring(De.indexOf("=",le)+1,we)).split(" ");return q=Re[0],oe=Re[Re.length-1],we+Ee.length-1}for(Y&&(Y=Y.split(" "),q=Y[0],oe=Y[1]),A=0;A<K;A++)H==X?_(q,$,A)?(--A,ve(),H=P):$.charAt(A)==`
|
|
117
|
+
`?Ne(ne):Q+=$.charAt(A):H==P?(A+=q.length-1,z=t.tags[$.charAt(A+1)],O=z?$.charAt(A+1):"_v",O=="="?(A=ze($,A),H=X):(z&&A++,H=j),ne=A):_(oe,$,A)?(re.push({tag:O,n:g(Q),otag:q,ctag:oe,i:O=="/"?ne-q.length:A+oe.length}),Q="",A+=oe.length-1,H=X,O=="{"&&(oe=="}}"?A++:h(re[re.length-1]))):Q+=$.charAt(A);return Ne(ne,!0),re};function h(B){B.n.substr(B.n.length-1)==="}"&&(B.n=B.n.substring(0,B.n.length-1))}function g(B){return B.trim?B.trim():B.replace(/^\s*|\s*$/g,"")}function _(B,$,Y){if($.charAt(Y)!=B.charAt(0))return!1;for(var K=1,X=B.length;K<X;K++)if($.charAt(Y+K)!=B.charAt(K))return!1;return!0}var y={_t:!0,"\n":!0,$:!0,"/":!0};function b(B,$,Y,K){var X=[],P=null,j=null,H=null;for(j=Y[Y.length-1];B.length>0;){if(H=B.shift(),j&&j.tag=="<"&&!(H.tag in y))throw new Error("Illegal content in < super tag.");if(t.tags[H.tag]<=t.tags.$||S(H,K))Y.push(H),H.nodes=b(B,H.tag,Y,K);else if(H.tag=="/"){if(Y.length===0)throw new Error("Closing tag without opener: /"+H.n);if(P=Y.pop(),H.n!=P.n&&!w(H.n,P.n,K))throw new Error("Nesting error: "+P.n+" vs. "+H.n);return P.end=H.i,X}else H.tag==`
|
|
118
|
+
`&&(H.last=B.length==0||B[0].tag==`
|
|
119
|
+
`);X.push(H)}if(Y.length>0)throw new Error("missing closing tag: "+Y.pop().n);return X}function S(B,$){for(var Y=0,K=$.length;Y<K;Y++)if($[Y].o==B.n)return B.tag="#",!0}function w(B,$,Y){for(var K=0,X=Y.length;K<X;K++)if(Y[K].c==B&&Y[K].o==$)return!0}function k(B){var $=[];for(var Y in B)$.push('"'+N(Y)+'": function(c,p,t,i) {'+B[Y]+"}");return"{ "+$.join(",")+" }"}function T(B){var $=[];for(var Y in B.partials)$.push('"'+N(Y)+'":{name:"'+N(B.partials[Y].name)+'", '+T(B.partials[Y])+"}");return"partials: {"+$.join(",")+"}, subs: "+k(B.subs)}t.stringify=function(B,$,Y){return"{code: function (c,p,i) { "+t.wrapMain(B.code)+" },"+T(B)+"}"};var D=0;t.generate=function(B,$,Y){D=0;var K={code:"",subs:{},partials:{}};return t.walk(B,K),Y.asString?this.stringify(K,$,Y):this.makeTemplate(K,$,Y)},t.wrapMain=function(B){return'var t=this;t.b(i=i||"");'+B+"return t.fl();"},t.template=t.Template,t.makeTemplate=function(B,$,Y){var K=this.makePartials(B);return K.code=new Function("c","p","i",this.wrapMain(B.code)),new this.template(K,$,this,Y)},t.makePartials=function(B){var $,Y={subs:{},partials:B.partials,name:B.name};for($ in Y.partials)Y.partials[$]=this.makePartials(Y.partials[$]);for($ in B.subs)Y.subs[$]=new Function("c","p","t","i",B.subs[$]);return Y};function N(B){return B.replace(c,"\\\\").replace(i,'\\"').replace(a,"\\n").replace(o,"\\r").replace(d,"\\u2028").replace(f,"\\u2029")}function E(B){return~B.indexOf(".")?"d":"f"}function M(B,$){var Y="<"+($.prefix||""),K=Y+B.n+D++;return $.partials[K]={name:B.n,partials:{}},$.code+='t.b(t.rp("'+N(K)+'",c,p,"'+(B.indent||"")+'"));',K}t.codegen={"#":function(B,$){$.code+="if(t.s(t."+E(B.n)+'("'+N(B.n)+'",c,p,1),c,p,0,'+B.i+","+B.end+',"'+B.otag+" "+B.ctag+'")){t.rs(c,p,function(c,p,t){',t.walk(B.nodes,$),$.code+="});c.pop();}"},"^":function(B,$){$.code+="if(!t.s(t."+E(B.n)+'("'+N(B.n)+'",c,p,1),c,p,1,0,0,"")){',t.walk(B.nodes,$),$.code+="};"},">":M,"<":function(B,$){var Y={partials:{},code:"",subs:{},inPartial:!0};t.walk(B.nodes,Y);var K=$.partials[M(B,$)];K.subs=Y.subs,K.partials=Y.partials},$:function(B,$){var Y={subs:{},code:"",partials:$.partials,prefix:B.n};t.walk(B.nodes,Y),$.subs[B.n]=Y.code,$.inPartial||($.code+='t.sub("'+N(B.n)+'",c,p,i);')},"\n":function(B,$){$.code+=W('"\\n"'+(B.last?"":" + i"))},_v:function(B,$){$.code+="t.b(t.v(t."+E(B.n)+'("'+N(B.n)+'",c,p,0)));'},_t:function(B,$){$.code+=W('"'+N(B.text)+'"')},"{":U,"&":U};function U(B,$){$.code+="t.b(t.t(t."+E(B.n)+'("'+N(B.n)+'",c,p,0)));'}function W(B){return"t.b("+B+");"}t.walk=function(B,$){for(var Y,K=0,X=B.length;K<X;K++)Y=t.codegen[B[K].tag],Y&&Y(B[K],$);return $},t.parse=function(B,$,Y){return Y=Y||{},b(B,"",[],Y.sectionTags||[])},t.cache={},t.cacheKey=function(B,$){return[B,!!$.asString,!!$.disableLambda,$.delimiters,!!$.modelGet].join("||")},t.compile=function(B,$){$=$||{};var Y=t.cacheKey(B,$),K=this.cache[Y];if(K){var X=K.partials;for(var P in X)delete X[P].instance;return K}return K=this.generate(this.parse(this.scan(B,$.delimiters),B,$),B,$),this.cache[Y]=K}})(e)})(zm)),zm}var Hm={},V1;function vI(){return V1||(V1=1,(function(e){(function(t){t.Template=function(b,S,w,k){b=b||{},this.r=b.code||this.r,this.c=w,this.options=k||{},this.text=S||"",this.partials=b.partials||{},this.subs=b.subs||{},this.buf=""},t.Template.prototype={r:function(b,S,w){return""},v:_,t:g,render:function(S,w,k){return this.ri([S],w||{},k)},ri:function(b,S,w){return this.r(b,S,w)},ep:function(b,S){var w=this.partials[b],k=S[w.name];if(w.instance&&w.base==k)return w.instance;if(typeof k=="string"){if(!this.c)throw new Error("No compiler available.");k=this.c.compile(k,this.options)}if(!k)return null;if(this.partials[b].base=k,w.subs){S.stackText||(S.stackText={});for(key in w.subs)S.stackText[key]||(S.stackText[key]=this.activeSub!==void 0&&S.stackText[this.activeSub]?S.stackText[this.activeSub]:this.text);k=i(k,w.subs,w.partials,this.stackSubs,this.stackPartials,S.stackText)}return this.partials[b].instance=k,k},rp:function(b,S,w,k){var T=this.ep(b,w);return T?T.ri(S,w,k):""},rs:function(b,S,w){var k=b[b.length-1];if(!y(k)){w(b,S,this);return}for(var T=0;T<k.length;T++)b.push(k[T]),w(b,S,this),b.pop()},s:function(b,S,w,k,T,D,N){var E;return y(b)&&b.length===0?!1:(typeof b=="function"&&(b=this.ms(b,S,w,k,T,D,N)),E=!!b,!k&&E&&S&&S.push(typeof b=="object"?b:S[S.length-1]),E)},d:function(b,S,w,k){var T,D=b.split("."),N=this.f(D[0],S,w,k),E=this.options.modelGet,M=null;if(b==="."&&y(S[S.length-2]))N=S[S.length-1];else for(var U=1;U<D.length;U++)T=s(D[U],N,E),T!==void 0?(M=N,N=T):N="";return k&&!N?!1:(!k&&typeof N=="function"&&(S.push(M),N=this.mv(N,S,w),S.pop()),N)},f:function(b,S,w,k){for(var T=!1,D=null,N=!1,E=this.options.modelGet,M=S.length-1;M>=0;M--)if(D=S[M],T=s(b,D,E),T!==void 0){N=!0;break}return N?(!k&&typeof T=="function"&&(T=this.mv(T,S,w)),T):k?!1:""},ls:function(b,S,w,k,T,D){var N=this.options.delimiters;return this.options.delimiters=D,this.b(this.ct(g(b.call(S,T,w)),S,k)),this.options.delimiters=N,!1},ct:function(b,S,w){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(b,this.options).render(S,w)},b:function(b){this.buf+=b},fl:function(){var b=this.buf;return this.buf="",b},ms:function(b,S,w,k,T,D,N){var E,M=S[S.length-1],U=b.call(M);return typeof U=="function"?k?!0:(E=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(U,M,S,w,E.substring(T,D),N)):U},mv:function(b,S,w){var k=S[S.length-1],T=b.call(k);return typeof T=="function"?this.ct(g(T.call(k)),k,w):T},sub:function(b,S,w,k){var T=this.subs[b];T&&(this.activeSub=b,T(S,w,this,k),this.activeSub=!1)}};function s(b,S,w){var k;return S&&typeof S=="object"&&(S[b]!==void 0?k=S[b]:w&&S.get&&typeof S.get=="function"&&(k=S.get(b))),k}function i(b,S,w,k,T,D){function N(){}N.prototype=b;function E(){}E.prototype=b.subs;var M,U=new N;U.subs=new E,U.subsText={},U.buf="",k=k||{},U.stackSubs=k,U.subsText=D;for(M in S)k[M]||(k[M]=S[M]);for(M in k)U.subs[M]=k[M];T=T||{},U.stackPartials=T;for(M in w)T[M]||(T[M]=w[M]);for(M in T)U.partials[M]=T[M];return U}var a=/&/g,o=/</g,c=/>/g,d=/\'/g,f=/\"/g,h=/[&<>\"\']/;function g(b){return String(b??"")}function _(b){return b=g(b),h.test(b)?b.replace(a,"&").replace(o,"<").replace(c,">").replace(d,"'").replace(f,"""):b}var y=Array.isArray||function(b){return Object.prototype.toString.call(b)==="[object Array]"}})(e)})(Hm)),Hm}var Um,W1;function yI(){if(W1)return Um;W1=1;var e=_I();return e.Template=vI().Template,e.template=e.Template,Um=e,Um}var Vt=yI();new Vt.Template({code:function(e,t,s){var i=this;return i.b(s=s||""),i.b('<li class="d2h-file-list-line">'),i.b(`
|
|
120
|
+
`+s),i.b(' <span class="d2h-file-name-wrapper">'),i.b(`
|
|
121
|
+
`+s),i.b(i.rp("<fileIcon0",e,t," ")),i.b(' <a href="#'),i.b(i.v(i.f("fileHtmlId",e,t,0))),i.b('" class="d2h-file-name">'),i.b(i.v(i.f("fileName",e,t,0))),i.b("</a>"),i.b(`
|
|
122
|
+
`+s),i.b(' <span class="d2h-file-stats">'),i.b(`
|
|
123
|
+
`+s),i.b(' <span class="d2h-lines-added">'),i.b(i.v(i.f("addedLines",e,t,0))),i.b("</span>"),i.b(`
|
|
124
|
+
`+s),i.b(' <span class="d2h-lines-deleted">'),i.b(i.v(i.f("deletedLines",e,t,0))),i.b("</span>"),i.b(`
|
|
125
|
+
`+s),i.b(" </span>"),i.b(`
|
|
126
|
+
`+s),i.b(" </span>"),i.b(`
|
|
127
|
+
`+s),i.b("</li>"),i.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}}},subs:{}});new Vt.Template({code:function(e,t,s){var i=this;return i.b(s=s||""),i.b('<div class="d2h-file-list-wrapper '),i.b(i.v(i.f("colorScheme",e,t,0))),i.b('">'),i.b(`
|
|
128
|
+
`+s),i.b(' <div class="d2h-file-list-header">'),i.b(`
|
|
129
|
+
`+s),i.b(' <span class="d2h-file-list-title">Files changed ('),i.b(i.v(i.f("filesNumber",e,t,0))),i.b(")</span>"),i.b(`
|
|
130
|
+
`+s),i.b(' <a class="d2h-file-switch d2h-hide">hide</a>'),i.b(`
|
|
131
|
+
`+s),i.b(' <a class="d2h-file-switch d2h-show">show</a>'),i.b(`
|
|
132
|
+
`+s),i.b(" </div>"),i.b(`
|
|
133
|
+
`+s),i.b(' <ol class="d2h-file-list">'),i.b(`
|
|
134
|
+
`+s),i.b(" "),i.b(i.t(i.f("files",e,t,0))),i.b(`
|
|
135
|
+
`+s),i.b(" </ol>"),i.b(`
|
|
136
|
+
`+s),i.b("</div>"),i.fl()},partials:{},subs:{}});new Vt.Template({code:function(e,t,s){var i=this;return i.b(s=s||""),i.b("<tr>"),i.b(`
|
|
137
|
+
`+s),i.b(' <td class="'),i.b(i.v(i.f("lineClass",e,t,0))),i.b(" "),i.b(i.v(i.d("CSSLineClass.INFO",e,t,0))),i.b('"></td>'),i.b(`
|
|
138
|
+
`+s),i.b(' <td class="'),i.b(i.v(i.d("CSSLineClass.INFO",e,t,0))),i.b('">'),i.b(`
|
|
139
|
+
`+s),i.b(' <div class="'),i.b(i.v(i.f("contentClass",e,t,0))),i.b('">'),i.s(i.f("blockHeader",e,t,1),e,t,0,156,173,"{{ }}")&&(i.rs(e,t,function(a,o,c){c.b(c.t(c.f("blockHeader",a,o,0)))}),e.pop()),i.s(i.f("blockHeader",e,t,1),e,t,1,0,0,"")||i.b(" "),i.b("</div>"),i.b(`
|
|
140
|
+
`+s),i.b(" </td>"),i.b(`
|
|
141
|
+
`+s),i.b("</tr>"),i.fl()},partials:{},subs:{}});new Vt.Template({code:function(e,t,s){var i=this;return i.b(s=s||""),i.b("<tr>"),i.b(`
|
|
142
|
+
`+s),i.b(' <td class="'),i.b(i.v(i.d("CSSLineClass.INFO",e,t,0))),i.b('">'),i.b(`
|
|
143
|
+
`+s),i.b(' <div class="'),i.b(i.v(i.f("contentClass",e,t,0))),i.b('">'),i.b(`
|
|
144
|
+
`+s),i.b(" File without changes"),i.b(`
|
|
145
|
+
`+s),i.b(" </div>"),i.b(`
|
|
146
|
+
`+s),i.b(" </td>"),i.b(`
|
|
147
|
+
`+s),i.b("</tr>"),i.fl()},partials:{},subs:{}});new Vt.Template({code:function(e,t,s){var i=this;return i.b(s=s||""),i.b('<span class="d2h-file-name-wrapper">'),i.b(`
|
|
148
|
+
`+s),i.b(i.rp("<fileIcon0",e,t," ")),i.b(' <span class="d2h-file-name">'),i.b(i.v(i.f("fileDiffName",e,t,0))),i.b("</span>"),i.b(`
|
|
149
|
+
`+s),i.b(i.rp("<fileTag1",e,t," ")),i.b("</span>"),i.b(`
|
|
150
|
+
`+s),i.b('<label class="d2h-file-collapse">'),i.b(`
|
|
151
|
+
`+s),i.b(' <input class="d2h-file-collapse-input" type="checkbox" name="viewed" value="viewed">'),i.b(`
|
|
152
|
+
`+s),i.b(" Viewed"),i.b(`
|
|
153
|
+
`+s),i.b("</label>"),i.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}},"<fileTag1":{name:"fileTag",partials:{},subs:{}}},subs:{}});new Vt.Template({code:function(e,t,s){var i=this;return i.b(s=s||""),i.b("<tr>"),i.b(`
|
|
154
|
+
`+s),i.b(' <td class="'),i.b(i.v(i.f("lineClass",e,t,0))),i.b(" "),i.b(i.v(i.f("type",e,t,0))),i.b('">'),i.b(`
|
|
155
|
+
`+s),i.b(" "),i.b(i.t(i.f("lineNumber",e,t,0))),i.b(`
|
|
156
|
+
`+s),i.b(" </td>"),i.b(`
|
|
157
|
+
`+s),i.b(' <td class="'),i.b(i.v(i.f("type",e,t,0))),i.b('">'),i.b(`
|
|
158
|
+
`+s),i.b(' <div class="'),i.b(i.v(i.f("contentClass",e,t,0))),i.b('">'),i.b(`
|
|
159
|
+
`+s),i.s(i.f("prefix",e,t,1),e,t,0,162,238,"{{ }}")&&(i.rs(e,t,function(a,o,c){c.b(' <span class="d2h-code-line-prefix">'),c.b(c.t(c.f("prefix",a,o,0))),c.b("</span>"),c.b(`
|
|
160
|
+
`+s)}),e.pop()),i.s(i.f("prefix",e,t,1),e,t,1,0,0,"")||(i.b(' <span class="d2h-code-line-prefix"> </span>'),i.b(`
|
|
161
|
+
`+s)),i.s(i.f("content",e,t,1),e,t,0,371,445,"{{ }}")&&(i.rs(e,t,function(a,o,c){c.b(' <span class="d2h-code-line-ctn">'),c.b(c.t(c.f("content",a,o,0))),c.b("</span>"),c.b(`
|
|
162
|
+
`+s)}),e.pop()),i.s(i.f("content",e,t,1),e,t,1,0,0,"")||(i.b(' <span class="d2h-code-line-ctn"><br></span>'),i.b(`
|
|
163
|
+
`+s)),i.b(" </div>"),i.b(`
|
|
164
|
+
`+s),i.b(" </td>"),i.b(`
|
|
165
|
+
`+s),i.b("</tr>"),i.fl()},partials:{},subs:{}});new Vt.Template({code:function(e,t,s){var i=this;return i.b(s=s||""),i.b('<div class="d2h-wrapper '),i.b(i.v(i.f("colorScheme",e,t,0))),i.b('">'),i.b(`
|
|
166
|
+
`+s),i.b(" "),i.b(i.t(i.f("content",e,t,0))),i.b(`
|
|
167
|
+
`+s),i.b("</div>"),i.fl()},partials:{},subs:{}});new Vt.Template({code:function(e,t,s){var i=this;return i.b(s=s||""),i.b('<svg aria-hidden="true" class="d2h-icon d2h-added" height="16" title="added" version="1.1" viewBox="0 0 14 16"'),i.b(`
|
|
168
|
+
`+s),i.b(' width="14">'),i.b(`
|
|
169
|
+
`+s),i.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM6 9H3V7h3V4h2v3h3v2H8v3H6V9z"></path>'),i.b(`
|
|
170
|
+
`+s),i.b("</svg>"),i.fl()},partials:{},subs:{}});new Vt.Template({code:function(e,t,s){var i=this;return i.b(s=s||""),i.b('<svg aria-hidden="true" class="d2h-icon d2h-changed" height="16" title="modified" version="1.1"'),i.b(`
|
|
171
|
+
`+s),i.b(' viewBox="0 0 14 16" width="14">'),i.b(`
|
|
172
|
+
`+s),i.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM4 8c0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3-3-1.34-3-3z"></path>'),i.b(`
|
|
173
|
+
`+s),i.b("</svg>"),i.fl()},partials:{},subs:{}});new Vt.Template({code:function(e,t,s){var i=this;return i.b(s=s||""),i.b('<svg aria-hidden="true" class="d2h-icon d2h-deleted" height="16" title="removed" version="1.1"'),i.b(`
|
|
174
|
+
`+s),i.b(' viewBox="0 0 14 16" width="14">'),i.b(`
|
|
175
|
+
`+s),i.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM11 9H3V7h8v2z"></path>'),i.b(`
|
|
176
|
+
`+s),i.b("</svg>"),i.fl()},partials:{},subs:{}});new Vt.Template({code:function(e,t,s){var i=this;return i.b(s=s||""),i.b('<svg aria-hidden="true" class="d2h-icon d2h-moved" height="16" title="renamed" version="1.1"'),i.b(`
|
|
177
|
+
`+s),i.b(' viewBox="0 0 14 16" width="14">'),i.b(`
|
|
178
|
+
`+s),i.b(' <path d="M6 9H3V7h3V4l5 4-5 4V9z m8-7v12c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h12c0.55 0 1 0.45 1 1z m-1 0H1v12h12V2z"></path>'),i.b(`
|
|
179
|
+
`+s),i.b("</svg>"),i.fl()},partials:{},subs:{}});new Vt.Template({code:function(e,t,s){var i=this;return i.b(s=s||""),i.b('<svg aria-hidden="true" class="d2h-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12">'),i.b(`
|
|
180
|
+
`+s),i.b(' <path d="M6 5H2v-1h4v1zM2 8h7v-1H2v1z m0 2h7v-1H2v1z m0 2h7v-1H2v1z m10-7.5v9.5c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h7.5l3.5 3.5z m-1 0.5L8 2H1v12h10V5z"></path>'),i.b(`
|
|
181
|
+
`+s),i.b("</svg>"),i.fl()},partials:{},subs:{}});new Vt.Template({code:function(e,t,s){var i=this;return i.b(s=s||""),i.b('<div id="'),i.b(i.v(i.f("fileHtmlId",e,t,0))),i.b('" class="d2h-file-wrapper" data-lang="'),i.b(i.v(i.d("file.language",e,t,0))),i.b('">'),i.b(`
|
|
182
|
+
`+s),i.b(' <div class="d2h-file-header">'),i.b(`
|
|
183
|
+
`+s),i.b(" "),i.b(i.t(i.f("filePath",e,t,0))),i.b(`
|
|
184
|
+
`+s),i.b(" </div>"),i.b(`
|
|
185
|
+
`+s),i.b(' <div class="d2h-file-diff">'),i.b(`
|
|
186
|
+
`+s),i.b(' <div class="d2h-code-wrapper">'),i.b(`
|
|
187
|
+
`+s),i.b(' <table class="d2h-diff-table">'),i.b(`
|
|
188
|
+
`+s),i.b(' <tbody class="d2h-diff-tbody">'),i.b(`
|
|
189
|
+
`+s),i.b(" "),i.b(i.t(i.f("diffs",e,t,0))),i.b(`
|
|
190
|
+
`+s),i.b(" </tbody>"),i.b(`
|
|
191
|
+
`+s),i.b(" </table>"),i.b(`
|
|
192
|
+
`+s),i.b(" </div>"),i.b(`
|
|
193
|
+
`+s),i.b(" </div>"),i.b(`
|
|
194
|
+
`+s),i.b("</div>"),i.fl()},partials:{},subs:{}});new Vt.Template({code:function(e,t,s){var i=this;return i.b(s=s||""),i.b('<div class="line-num1">'),i.b(i.v(i.f("oldNumber",e,t,0))),i.b("</div>"),i.b(`
|
|
195
|
+
`+s),i.b('<div class="line-num2">'),i.b(i.v(i.f("newNumber",e,t,0))),i.b("</div>"),i.fl()},partials:{},subs:{}});new Vt.Template({code:function(e,t,s){var i=this;return i.b(s=s||""),i.b('<div id="'),i.b(i.v(i.f("fileHtmlId",e,t,0))),i.b('" class="d2h-file-wrapper" data-lang="'),i.b(i.v(i.d("file.language",e,t,0))),i.b('">'),i.b(`
|
|
196
|
+
`+s),i.b(' <div class="d2h-file-header">'),i.b(`
|
|
197
|
+
`+s),i.b(" "),i.b(i.t(i.f("filePath",e,t,0))),i.b(`
|
|
198
|
+
`+s),i.b(" </div>"),i.b(`
|
|
199
|
+
`+s),i.b(' <div class="d2h-files-diff">'),i.b(`
|
|
200
|
+
`+s),i.b(' <div class="d2h-file-side-diff">'),i.b(`
|
|
201
|
+
`+s),i.b(' <div class="d2h-code-wrapper">'),i.b(`
|
|
202
|
+
`+s),i.b(' <table class="d2h-diff-table">'),i.b(`
|
|
203
|
+
`+s),i.b(' <tbody class="d2h-diff-tbody">'),i.b(`
|
|
204
|
+
`+s),i.b(" "),i.b(i.t(i.d("diffs.left",e,t,0))),i.b(`
|
|
205
|
+
`+s),i.b(" </tbody>"),i.b(`
|
|
206
|
+
`+s),i.b(" </table>"),i.b(`
|
|
207
|
+
`+s),i.b(" </div>"),i.b(`
|
|
208
|
+
`+s),i.b(" </div>"),i.b(`
|
|
209
|
+
`+s),i.b(' <div class="d2h-file-side-diff">'),i.b(`
|
|
210
|
+
`+s),i.b(' <div class="d2h-code-wrapper">'),i.b(`
|
|
211
|
+
`+s),i.b(' <table class="d2h-diff-table">'),i.b(`
|
|
212
|
+
`+s),i.b(' <tbody class="d2h-diff-tbody">'),i.b(`
|
|
213
|
+
`+s),i.b(" "),i.b(i.t(i.d("diffs.right",e,t,0))),i.b(`
|
|
214
|
+
`+s),i.b(" </tbody>"),i.b(`
|
|
215
|
+
`+s),i.b(" </table>"),i.b(`
|
|
216
|
+
`+s),i.b(" </div>"),i.b(`
|
|
217
|
+
`+s),i.b(" </div>"),i.b(`
|
|
218
|
+
`+s),i.b(" </div>"),i.b(`
|
|
219
|
+
`+s),i.b("</div>"),i.fl()},partials:{},subs:{}});new Vt.Template({code:function(e,t,s){var i=this;return i.b(s=s||""),i.b('<span class="d2h-tag d2h-added d2h-added-tag">ADDED</span>'),i.fl()},partials:{},subs:{}});new Vt.Template({code:function(e,t,s){var i=this;return i.b(s=s||""),i.b('<span class="d2h-tag d2h-changed d2h-changed-tag">CHANGED</span>'),i.fl()},partials:{},subs:{}});new Vt.Template({code:function(e,t,s){var i=this;return i.b(s=s||""),i.b('<span class="d2h-tag d2h-deleted d2h-deleted-tag">DELETED</span>'),i.fl()},partials:{},subs:{}});new Vt.Template({code:function(e,t,s){var i=this;return i.b(s=s||""),i.b('<span class="d2h-tag d2h-moved d2h-moved-tag">RENAMED</span>'),i.fl()},partials:{},subs:{}});const bI=Object.assign(Object.assign(Object.assign({},mI),gI),{outputFormat:aI.LINE_BY_LINE,drawFileList:!0});function SI(e,t={}){return pI(e,Object.assign(Object.assign({},bI),t))}var v_=Object.defineProperty,wI=Object.getOwnPropertyDescriptor,CI=Object.getOwnPropertyNames,xI=Object.prototype.hasOwnProperty,gv=(e,t)=>{let s={};for(var i in e)v_(s,i,{get:e[i],enumerable:!0});return v_(s,Symbol.toStringTag,{value:"Module"}),s},kI=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(var a=CI(t),o=0,c=a.length,d;o<c;o++)d=a[o],!xI.call(e,d)&&d!==s&&v_(e,d,{get:(f=>t[f]).bind(null,d),enumerable:!(i=wI(t,d))||i.enumerable});return e},aE=(e,t,s)=>(kI(e,t,"default"),s);const Ad=[{id:"abap",name:"ABAP",import:(()=>L(()=>import("./abap-BdImnpbu.js"),[]))},{id:"actionscript-3",name:"ActionScript",import:(()=>L(()=>import("./actionscript-3-CoDkCxhg.js"),[]))},{id:"ada",name:"Ada",import:(()=>L(()=>import("./ada-bCR0ucgS.js"),[]))},{id:"angular-html",name:"Angular HTML",import:(()=>L(()=>import("./angular-html-DA-rfuFy.js").then(e=>e.f),__vite__mapDeps([0,1,2,3])))},{id:"angular-ts",name:"Angular TypeScript",import:(()=>L(()=>import("./angular-ts-BrjP3tb8.js"),__vite__mapDeps([4,0,1,2,3,5])))},{id:"apache",name:"Apache Conf",import:(()=>L(()=>import("./apache-Pmp26Uib.js"),[]))},{id:"apex",name:"Apex",import:(()=>L(()=>import("./apex-D8_7TLub.js"),[]))},{id:"apl",name:"APL",import:(()=>L(()=>import("./apl-CORt7UWP.js"),__vite__mapDeps([6,1,2,3,7,8,9])))},{id:"applescript",name:"AppleScript",import:(()=>L(()=>import("./applescript-Co6uUVPk.js"),[]))},{id:"ara",name:"Ara",import:(()=>L(()=>import("./ara-BRHolxvo.js"),[]))},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:(()=>L(()=>import("./asciidoc-Ve4PFQV2.js"),[]))},{id:"asm",name:"Assembly",import:(()=>L(()=>import("./asm-D_Q5rh1f.js"),[]))},{id:"astro",name:"Astro",import:(()=>L(()=>import("./astro-HNnZUWAn.js"),__vite__mapDeps([10,9,2,11,3,12,13])))},{id:"awk",name:"AWK",import:(()=>L(()=>import("./awk-DMzUqQB5.js"),[]))},{id:"ballerina",name:"Ballerina",import:(()=>L(()=>import("./ballerina-BFfxhgS-.js"),[]))},{id:"bat",name:"Batch File",aliases:["batch"],import:(()=>L(()=>import("./bat-BkioyH1T.js"),[]))},{id:"beancount",name:"Beancount",import:(()=>L(()=>import("./beancount-k_qm7-4y.js"),[]))},{id:"berry",name:"Berry",aliases:["be"],import:(()=>L(()=>import("./berry-uYugtg8r.js"),[]))},{id:"bibtex",name:"BibTeX",import:(()=>L(()=>import("./bibtex-CHM0blh-.js"),[]))},{id:"bicep",name:"Bicep",import:(()=>L(()=>import("./bicep-Bmn6On1c.js"),[]))},{id:"bird2",name:"BIRD2 Configuration",aliases:["bird"],import:(()=>L(()=>import("./bird2-BIv1doCn.js"),[]))},{id:"blade",name:"Blade",import:(()=>L(()=>import("./blade-BjGOyj-B.js"),__vite__mapDeps([14,15,1,2,3,7,8,16,9])))},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:(()=>L(()=>import("./bsl-BO_Y6i37.js"),__vite__mapDeps([17,18])))},{id:"c",name:"C",import:(()=>L(()=>import("./c-BIGW1oBm.js"),[]))},{id:"c3",name:"C3",import:(()=>L(()=>import("./c3-eo99z4R2.js"),[]))},{id:"cadence",name:"Cadence",aliases:["cdc"],import:(()=>L(()=>import("./cadence-Bv_4Rxtq.js"),[]))},{id:"cairo",name:"Cairo",import:(()=>L(()=>import("./cairo-KRGpt6FW.js"),__vite__mapDeps([19,20])))},{id:"clarity",name:"Clarity",import:(()=>L(()=>import("./clarity-D53aC0YG.js"),[]))},{id:"clojure",name:"Clojure",aliases:["clj"],import:(()=>L(()=>import("./clojure-P80f7IUj.js"),[]))},{id:"cmake",name:"CMake",import:(()=>L(()=>import("./cmake-D1j8_8rp.js"),[]))},{id:"cobol",name:"COBOL",import:(()=>L(()=>import("./cobol-nBiQ_Alo.js"),__vite__mapDeps([21,1,2,3,8])))},{id:"codeowners",name:"CODEOWNERS",import:(()=>L(()=>import("./codeowners-Bp6g37R7.js"),[]))},{id:"codeql",name:"CodeQL",aliases:["ql"],import:(()=>L(()=>import("./codeql-DsOJ9woJ.js"),[]))},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:(()=>L(()=>import("./coffee-Ch7k5sss.js"),__vite__mapDeps([22,2])))},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:(()=>L(()=>import("./common-lisp-Cg-RD9OK.js"),[]))},{id:"coq",name:"Coq",import:(()=>L(()=>import("./coq-DkFqJrB1.js"),[]))},{id:"cpp",name:"C++",aliases:["c++"],import:(()=>L(()=>import("./cpp-CofmeUqb.js"),__vite__mapDeps([23,24,25,26,16])))},{id:"crystal",name:"Crystal",import:(()=>L(()=>import("./crystal-DNxU26gB.js"),__vite__mapDeps([27,1,2,3,16,26,28])))},{id:"csharp",name:"C#",aliases:["c#","cs"],import:(()=>L(()=>import("./csharp-COcwbKMJ.js"),[]))},{id:"css",name:"CSS",import:(()=>L(()=>import("./css-CLj8gQPS.js"),[]))},{id:"csv",name:"CSV",import:(()=>L(()=>import("./csv-fuZLfV_i.js"),[]))},{id:"cue",name:"CUE",import:(()=>L(()=>import("./cue-D82EKSYY.js"),[]))},{id:"cypher",name:"Cypher",aliases:["cql"],import:(()=>L(()=>import("./cypher-COkxafJQ.js"),[]))},{id:"d",name:"D",import:(()=>L(()=>import("./d-85-TOEBH.js"),[]))},{id:"dart",name:"Dart",import:(()=>L(()=>import("./dart-bE4Kk8sk.js"),[]))},{id:"dax",name:"DAX",import:(()=>L(()=>import("./dax-CEL-wOlO.js"),[]))},{id:"desktop",name:"Desktop",import:(()=>L(()=>import("./desktop-BmXAJ9_W.js"),[]))},{id:"diff",name:"Diff",import:(()=>L(()=>import("./diff-D97Zzqfu.js"),[]))},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:(()=>L(()=>import("./docker-BcOcwvcX.js"),[]))},{id:"dotenv",name:"dotEnv",import:(()=>L(()=>import("./dotenv-Da5cRb03.js"),[]))},{id:"dream-maker",name:"Dream Maker",import:(()=>L(()=>import("./dream-maker-BtqSS_iP.js"),[]))},{id:"edge",name:"Edge",import:(()=>L(()=>import("./edge-FbVlp4U3.js"),__vite__mapDeps([29,11,1,2,3,15])))},{id:"elixir",name:"Elixir",import:(()=>L(()=>import("./elixir-CkH2-t6x.js"),__vite__mapDeps([30,1,2,3])))},{id:"elm",name:"Elm",import:(()=>L(()=>import("./elm-DbKCFpqz.js"),__vite__mapDeps([31,25,26])))},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:(()=>L(()=>import("./emacs-lisp-CXvaQtF9.js"),[]))},{id:"erb",name:"ERB",import:(()=>L(()=>import("./erb-BYCe7drp.js"),__vite__mapDeps([32,1,2,3,33,34,7,8,16,35,11,36,13,23,24,25,26,28,37,38])))},{id:"erlang",name:"Erlang",aliases:["erl"],import:(()=>L(()=>import("./erlang-DsQrWhSR.js"),__vite__mapDeps([39,40])))},{id:"fennel",name:"Fennel",import:(()=>L(()=>import("./fennel-BYunw83y.js"),[]))},{id:"fish",name:"Fish",import:(()=>L(()=>import("./fish-BvzEVeQv.js"),[]))},{id:"fluent",name:"Fluent",aliases:["ftl"],import:(()=>L(()=>import("./fluent-C4IJs8-o.js"),[]))},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:(()=>L(()=>import("./fortran-fixed-form-CkoXwp7k.js"),__vite__mapDeps([41,42])))},{id:"fortran-free-form",name:"Fortran (Free Form)",aliases:["f90","f95","f03","f08","f18"],import:(()=>L(()=>import("./fortran-free-form-BxgE0vQu.js"),[]))},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:(()=>L(()=>import("./fsharp-CXgrBDvD.js"),__vite__mapDeps([43,40])))},{id:"gdresource",name:"GDResource",aliases:["tscn","tres"],import:(()=>L(()=>import("./gdresource-BOOCDP_w.js"),__vite__mapDeps([44,45,46])))},{id:"gdscript",name:"GDScript",aliases:["gd"],import:(()=>L(()=>import("./gdscript-C5YyOfLZ.js"),[]))},{id:"gdshader",name:"GDShader",import:(()=>L(()=>import("./gdshader-DkwncUOv.js"),[]))},{id:"genie",name:"Genie",import:(()=>L(()=>import("./genie-D0YGMca9.js"),[]))},{id:"gherkin",name:"Gherkin",import:(()=>L(()=>import("./gherkin-DyxjwDmM.js"),[]))},{id:"git-commit",name:"Git Commit Message",import:(()=>L(()=>import("./git-commit-F4YmCXRG.js"),__vite__mapDeps([47,48])))},{id:"git-rebase",name:"Git Rebase Message",import:(()=>L(()=>import("./git-rebase-r7XF79zn.js"),__vite__mapDeps([49,28])))},{id:"gleam",name:"Gleam",import:(()=>L(()=>import("./gleam-BspZqrRM.js"),[]))},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:(()=>L(()=>import("./glimmer-js-ByusRIyA.js"),__vite__mapDeps([50,2,11,3,1])))},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:(()=>L(()=>import("./glimmer-ts-BfAWNZQY.js"),__vite__mapDeps([51,11,3,2,1])))},{id:"glsl",name:"GLSL",import:(()=>L(()=>import("./glsl-DplSGwfg.js"),__vite__mapDeps([25,26])))},{id:"gn",name:"GN",import:(()=>L(()=>import("./gn-n2N0HUVH.js"),[]))},{id:"gnuplot",name:"Gnuplot",import:(()=>L(()=>import("./gnuplot-DdkO51Og.js"),[]))},{id:"go",name:"Go",import:(()=>L(()=>import("./go-C27-OAKa.js"),[]))},{id:"graphql",name:"GraphQL",aliases:["gql"],import:(()=>L(()=>import("./graphql-ChdNCCLP.js"),__vite__mapDeps([35,2,11,36,13])))},{id:"groovy",name:"Groovy",import:(()=>L(()=>import("./groovy-gcz8RCvz.js"),[]))},{id:"hack",name:"Hack",import:(()=>L(()=>import("./hack-i7_Ulhet.js"),__vite__mapDeps([52,1,2,3,16])))},{id:"haml",name:"Ruby Haml",import:(()=>L(()=>import("./haml-D5jkg6IW.js"),__vite__mapDeps([34,2,3])))},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:(()=>L(()=>import("./handlebars-BpdQsYii.js"),__vite__mapDeps([53,1,2,3,38])))},{id:"haskell",name:"Haskell",aliases:["hs"],import:(()=>L(()=>import("./haskell-Df6bDoY_.js"),[]))},{id:"haxe",name:"Haxe",import:(()=>L(()=>import("./haxe-CzTSHFRz.js"),[]))},{id:"hcl",name:"HashiCorp HCL",import:(()=>L(()=>import("./hcl-BWvSN4gD.js"),[]))},{id:"hjson",name:"Hjson",import:(()=>L(()=>import("./hjson-D5-asLiD.js"),[]))},{id:"hlsl",name:"HLSL",import:(()=>L(()=>import("./hlsl-D3lLCCz7.js"),[]))},{id:"html",name:"HTML",import:(()=>L(()=>import("./html-pp8916En.js"),__vite__mapDeps([1,2,3])))},{id:"html-derivative",name:"HTML (Derivative)",import:(()=>L(()=>import("./html-derivative-DlHx6ybY.js"),__vite__mapDeps([15,1,2,3])))},{id:"http",name:"HTTP",import:(()=>L(()=>import("./http-jrhK8wxY.js"),__vite__mapDeps([54,28,9,7,8,35,2,11,36,13])))},{id:"hurl",name:"Hurl",import:(()=>L(()=>import("./hurl-irOxFIW8.js"),__vite__mapDeps([55,35,2,11,36,13,7,8,56])))},{id:"hxml",name:"HXML",import:(()=>L(()=>import("./hxml-Bvhsp5Yf.js"),__vite__mapDeps([57,58])))},{id:"hy",name:"Hy",import:(()=>L(()=>import("./hy-DFXneXwc.js"),[]))},{id:"imba",name:"Imba",import:(()=>L(()=>import("./imba-DGztddWO.js"),[]))},{id:"ini",name:"INI",aliases:["properties"],import:(()=>L(()=>import("./ini-BEwlwnbL.js"),[]))},{id:"java",name:"Java",import:(()=>L(()=>import("./java-CylS5w8V.js"),[]))},{id:"javascript",name:"JavaScript",aliases:["js","cjs","mjs"],import:(()=>L(()=>import("./javascript-wDzz0qaB.js"),[]))},{id:"jinja",name:"Jinja",import:(()=>L(()=>import("./jinja-f2NsQr07.js"),__vite__mapDeps([59,1,2,3])))},{id:"jison",name:"Jison",import:(()=>L(()=>import("./jison-wvAkD_A8.js"),__vite__mapDeps([60,2])))},{id:"json",name:"JSON",import:(()=>L(()=>import("./json-Cp-IABpG.js"),[]))},{id:"json5",name:"JSON5",import:(()=>L(()=>import("./json5-C9tS-k6U.js"),[]))},{id:"jsonc",name:"JSON with Comments",import:(()=>L(()=>import("./jsonc-Des-eS-w.js"),[]))},{id:"jsonl",name:"JSON Lines",import:(()=>L(()=>import("./jsonl-DcaNXYhu.js"),[]))},{id:"jsonnet",name:"Jsonnet",import:(()=>L(()=>import("./jsonnet-DFQXde-d.js"),[]))},{id:"jssm",name:"JSSM",aliases:["fsl"],import:(()=>L(()=>import("./jssm-C2t-YnRu.js"),[]))},{id:"jsx",name:"JSX",import:(()=>L(()=>import("./jsx-g9-lgVsj.js"),[]))},{id:"julia",name:"Julia",aliases:["jl"],import:(()=>L(()=>import("./julia-CxzCAyBv.js"),__vite__mapDeps([61,23,24,25,26,16,20,2,62])))},{id:"just",name:"Just",import:(()=>L(()=>import("./just-VxiPbLrw.js"),__vite__mapDeps([63,28,2,11,64,1,3,7,8,16,20,33,34,35,36,13,23,24,25,26,37,38])))},{id:"kdl",name:"KDL",import:(()=>L(()=>import("./kdl-DV7GczEv.js"),[]))},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:(()=>L(()=>import("./kotlin-BdnUsdx6.js"),[]))},{id:"kusto",name:"Kusto",aliases:["kql"],import:(()=>L(()=>import("./kusto-wEQ09or8.js"),[]))},{id:"latex",name:"LaTeX",import:(()=>L(()=>import("./latex-CWtU0Tv5.js"),__vite__mapDeps([65,66,62])))},{id:"lean",name:"Lean 4",aliases:["lean4"],import:(()=>L(()=>import("./lean-BZvkOJ9d.js"),[]))},{id:"less",name:"Less",import:(()=>L(()=>import("./less-B1dDrJ26.js"),[]))},{id:"liquid",name:"Liquid",import:(()=>L(()=>import("./liquid-C0sCDyMI.js"),__vite__mapDeps([67,1,2,3,9])))},{id:"llvm",name:"LLVM IR",import:(()=>L(()=>import("./llvm-DjAJT7YJ.js"),[]))},{id:"log",name:"Log file",import:(()=>L(()=>import("./log-2UxHyX5q.js"),[]))},{id:"logo",name:"Logo",import:(()=>L(()=>import("./logo-BtOb2qkB.js"),[]))},{id:"lua",name:"Lua",import:(()=>L(()=>import("./lua-BaeVxFsk.js"),__vite__mapDeps([37,26])))},{id:"luau",name:"Luau",import:(()=>L(()=>import("./luau-C-HG3fhB.js"),[]))},{id:"make",name:"Makefile",aliases:["makefile"],import:(()=>L(()=>import("./make-CHLpvVh8.js"),[]))},{id:"markdown",name:"Markdown",aliases:["md"],import:(()=>L(()=>import("./markdown-Cvjx9yec.js"),[]))},{id:"marko",name:"Marko",import:(()=>L(()=>import("./marko-DjSrsDqO.js"),__vite__mapDeps([68,3,69,5,11])))},{id:"matlab",name:"MATLAB",import:(()=>L(()=>import("./matlab-D7o27uSR.js"),[]))},{id:"mdc",name:"MDC",import:(()=>L(()=>import("./mdc-DTYItulj.js"),__vite__mapDeps([70,40,38,15,1,2,3])))},{id:"mdx",name:"MDX",import:(()=>L(()=>import("./mdx-Cmh6b_Ma.js"),[]))},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:(()=>L(()=>import("./mermaid-mWjccvbQ.js"),[]))},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:(()=>L(()=>import("./mipsasm-CKIfxQSi.js"),[]))},{id:"mojo",name:"Mojo",import:(()=>L(()=>import("./mojo-rZm6bMo-.js"),[]))},{id:"moonbit",name:"MoonBit",aliases:["mbt","mbti"],import:(()=>L(()=>import("./moonbit-_H4v1dQx.js"),[]))},{id:"move",name:"Move",import:(()=>L(()=>import("./move-IF9eRakj.js"),[]))},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:(()=>L(()=>import("./narrat-DRg8JJMk.js"),[]))},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:(()=>L(()=>import("./nextflow-C-mBbutL.js"),__vite__mapDeps([71,72])))},{id:"nextflow-groovy",name:"Nextflow Groovy",import:(()=>L(()=>import("./nextflow-groovy-vE_lwT2v.js"),[]))},{id:"nginx",name:"Nginx",import:(()=>L(()=>import("./nginx-BpAMiNFr.js"),__vite__mapDeps([73,37,26])))},{id:"nim",name:"Nim",import:(()=>L(()=>import("./nim-BIad80T-.js"),__vite__mapDeps([74,26,1,2,3,7,8,25,40])))},{id:"nix",name:"Nix",import:(()=>L(()=>import("./nix-CwoSXNpI.js"),[]))},{id:"nushell",name:"nushell",aliases:["nu"],import:(()=>L(()=>import("./nushell-Cz2AlsmD.js"),[]))},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:(()=>L(()=>import("./objective-c-DXmwc3jG.js"),[]))},{id:"objective-cpp",name:"Objective-C++",import:(()=>L(()=>import("./objective-cpp-CLxacb5B.js"),[]))},{id:"ocaml",name:"OCaml",import:(()=>L(()=>import("./ocaml-C0hk2d4L.js"),[]))},{id:"odin",name:"Odin",import:(()=>L(()=>import("./odin-BBf5iR-q.js"),[]))},{id:"openscad",name:"OpenSCAD",aliases:["scad"],import:(()=>L(()=>import("./openscad-C4EeE6gA.js"),[]))},{id:"pascal",name:"Pascal",import:(()=>L(()=>import("./pascal-D93ZcfNL.js"),[]))},{id:"perl",name:"Perl",import:(()=>L(()=>import("./perl-NvoQZIq0.js"),__vite__mapDeps([64,1,2,3,7,8,16])))},{id:"php",name:"PHP",import:(()=>L(()=>import("./php-R6g_5hLQ.js"),__vite__mapDeps([75,1,2,3,7,8,16,9])))},{id:"pkl",name:"Pkl",import:(()=>L(()=>import("./pkl-u5AG7uiY.js"),[]))},{id:"plsql",name:"PL/SQL",import:(()=>L(()=>import("./plsql-ChMvpjG-.js"),[]))},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:(()=>L(()=>import("./po-BTJTHyun.js"),[]))},{id:"polar",name:"Polar",import:(()=>L(()=>import("./polar-C0HS_06l.js"),[]))},{id:"postcss",name:"PostCSS",import:(()=>L(()=>import("./postcss-CXtECtnM.js"),[]))},{id:"powerquery",name:"PowerQuery",import:(()=>L(()=>import("./powerquery-CEu0bR-o.js"),[]))},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:(()=>L(()=>import("./powershell-Dpen1YoG.js"),[]))},{id:"prisma",name:"Prisma",import:(()=>L(()=>import("./prisma-Dd19v3D-.js"),[]))},{id:"prolog",name:"Prolog",import:(()=>L(()=>import("./prolog-CbFg5uaA.js"),[]))},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:(()=>L(()=>import("./proto-C7zT0LnQ.js"),[]))},{id:"pug",name:"Pug",aliases:["jade"],import:(()=>L(()=>import("./pug-DKIMFp6K.js"),__vite__mapDeps([76,2,3,1])))},{id:"puppet",name:"Puppet",import:(()=>L(()=>import("./puppet-BMWR74SV.js"),[]))},{id:"purescript",name:"PureScript",import:(()=>L(()=>import("./purescript-CklMAg4u.js"),[]))},{id:"python",name:"Python",aliases:["py"],import:(()=>L(()=>import("./python-B6aJPvgy.js"),[]))},{id:"qml",name:"QML",import:(()=>L(()=>import("./qml-3beO22l8.js"),__vite__mapDeps([77,2])))},{id:"qmldir",name:"QML Directory",import:(()=>L(()=>import("./qmldir-C8lEn-DE.js"),[]))},{id:"qss",name:"Qt Style Sheets",import:(()=>L(()=>import("./qss-IeuSbFQv.js"),[]))},{id:"r",name:"R",import:(()=>L(()=>import("./r-Dspwwk_N.js"),[]))},{id:"racket",name:"Racket",import:(()=>L(()=>import("./racket-BqYA7rlc.js"),[]))},{id:"raku",name:"Raku",aliases:["perl6"],import:(()=>L(()=>import("./raku-DXvB9xmW.js"),[]))},{id:"razor",name:"ASP.NET Razor",import:(()=>L(()=>import("./razor-BDqjjVU7.js"),__vite__mapDeps([78,1,2,3,79])))},{id:"reg",name:"Windows Registry Script",import:(()=>L(()=>import("./reg-C-SQnVFl.js"),[]))},{id:"regexp",name:"RegExp",aliases:["regex"],import:(()=>L(()=>import("./regexp-CDVJQ6XC.js"),[]))},{id:"rel",name:"Rel",import:(()=>L(()=>import("./rel-C3B-1QV4.js"),[]))},{id:"riscv",name:"RISC-V",import:(()=>L(()=>import("./riscv-BM1_JUlF.js"),[]))},{id:"ron",name:"RON",import:(()=>L(()=>import("./ron-D8l8udqQ.js"),[]))},{id:"rosmsg",name:"ROS Interface",import:(()=>L(()=>import("./rosmsg-BJDFO7_C.js"),[]))},{id:"rst",name:"reStructuredText",import:(()=>L(()=>import("./rst-CRjBmOyv.js"),__vite__mapDeps([80,15,1,2,3,23,24,25,26,16,20,28,38,81,33,34,7,8,35,11,36,13,37])))},{id:"ruby",name:"Ruby",aliases:["rb"],import:(()=>L(()=>import("./ruby-Wjq7vjNf.js"),__vite__mapDeps([33,1,2,3,34,7,8,16,35,11,36,13,23,24,25,26,28,37,38])))},{id:"rust",name:"Rust",aliases:["rs"],import:(()=>L(()=>import("./rust-B1yitclQ.js"),[]))},{id:"sas",name:"SAS",import:(()=>L(()=>import("./sas-cz2c8ADy.js"),__vite__mapDeps([82,16])))},{id:"sass",name:"Sass",import:(()=>L(()=>import("./sass-Cj5Yp3dK.js"),[]))},{id:"scala",name:"Scala",import:(()=>L(()=>import("./scala-C151Ov-r.js"),[]))},{id:"scheme",name:"Scheme",import:(()=>L(()=>import("./scheme-C98Dy4si.js"),[]))},{id:"scss",name:"SCSS",import:(()=>L(()=>import("./scss-D5BDwBP9.js"),__vite__mapDeps([5,3])))},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:(()=>L(()=>import("./sdbl-DVxCFoDh.js"),[]))},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:(()=>L(()=>import("./shaderlab-Dg9Lc6iA.js"),__vite__mapDeps([83,84])))},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:(()=>L(()=>import("./shellscript-Yzrsuije.js"),[]))},{id:"shellsession",name:"Shell Session",aliases:["console"],import:(()=>L(()=>import("./shellsession-BADoaaVG.js"),__vite__mapDeps([85,28])))},{id:"smalltalk",name:"Smalltalk",import:(()=>L(()=>import("./smalltalk-BERRCDM3.js"),[]))},{id:"solidity",name:"Solidity",import:(()=>L(()=>import("./solidity-rGO070M0.js"),[]))},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:(()=>L(()=>import("./soy-8wufbnw4.js"),__vite__mapDeps([86,1,2,3])))},{id:"sparql",name:"SPARQL",import:(()=>L(()=>import("./sparql-rVzFXLq3.js"),__vite__mapDeps([87,88])))},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:(()=>L(()=>import("./splunk-BtCnVYZw.js"),[]))},{id:"sql",name:"SQL",import:(()=>L(()=>import("./sql-BLtJtn59.js"),[]))},{id:"ssh-config",name:"SSH Config",import:(()=>L(()=>import("./ssh-config-_ykCGR6B.js"),[]))},{id:"stata",name:"Stata",import:(()=>L(()=>import("./stata-BH5u7GGu.js"),__vite__mapDeps([89,16])))},{id:"stylus",name:"Stylus",aliases:["styl"],import:(()=>L(()=>import("./stylus-BEDo0Tqx.js"),[]))},{id:"surrealql",name:"SurrealQL",aliases:["surql"],import:(()=>L(()=>import("./surrealql-Bq5Q-fJD.js"),__vite__mapDeps([90,2])))},{id:"svelte",name:"Svelte",import:(()=>L(()=>import("./svelte-Cy7k_4gC.js"),__vite__mapDeps([91,2,11,3,12])))},{id:"swift",name:"Swift",import:(()=>L(()=>import("./swift-D82vCrfD.js"),[]))},{id:"system-verilog",name:"SystemVerilog",import:(()=>L(()=>import("./system-verilog-CnnmHF94.js"),[]))},{id:"systemd",name:"Systemd Units",import:(()=>L(()=>import("./systemd-4A_iFExJ.js"),[]))},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:(()=>L(()=>import("./talonscript-CkByrt1z.js"),[]))},{id:"tasl",name:"Tasl",import:(()=>L(()=>import("./tasl-QIJgUcNo.js"),[]))},{id:"tcl",name:"Tcl",import:(()=>L(()=>import("./tcl-dwOrl1Do.js"),[]))},{id:"templ",name:"Templ",import:(()=>L(()=>import("./templ-DhtptRzy.js"),__vite__mapDeps([92,93,2,3])))},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:(()=>L(()=>import("./terraform-BETggiCN.js"),[]))},{id:"tex",name:"TeX",import:(()=>L(()=>import("./tex-idrVyKtj.js"),__vite__mapDeps([66,62])))},{id:"toml",name:"TOML",import:(()=>L(()=>import("./toml-vGWfd6FD.js"),[]))},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:(()=>L(()=>import("./ts-tags-DQrlYJgV.js"),__vite__mapDeps([94,11,3,2,25,26,1,16,7,8])))},{id:"tsv",name:"TSV",import:(()=>L(()=>import("./tsv-B_m7g4N7.js"),[]))},{id:"tsx",name:"TSX",import:(()=>L(()=>import("./tsx-COt5Ahok.js"),[]))},{id:"turtle",name:"Turtle",import:(()=>L(()=>import("./turtle-BsS91CYL.js"),[]))},{id:"twig",name:"Twig",import:(()=>L(()=>import("./twig-xg9kU7Mw.js"),__vite__mapDeps([95,3,2,5,75,1,7,8,16,9,20,33,34,35,11,36,13,23,24,25,26,28,37,38])))},{id:"typescript",name:"TypeScript",aliases:["ts","cts","mts"],import:(()=>L(()=>import("./typescript-BPQ3VLAy.js"),[]))},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:(()=>L(()=>import("./typespec-CAFt9gP4.js"),[]))},{id:"typst",name:"Typst",aliases:["typ"],import:(()=>L(()=>import("./typst-DHCkPAjA.js"),[]))},{id:"v",name:"V",import:(()=>L(()=>import("./v-BcVCzyr7.js"),[]))},{id:"vala",name:"Vala",import:(()=>L(()=>import("./vala-CsfeWuGM.js"),[]))},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:(()=>L(()=>import("./vb-D17OF-Vu.js"),[]))},{id:"verilog",name:"Verilog",import:(()=>L(()=>import("./verilog-BQ8w6xss.js"),[]))},{id:"vhdl",name:"VHDL",import:(()=>L(()=>import("./vhdl-CeAyd5Ju.js"),[]))},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:(()=>L(()=>import("./viml-CJc9bBzg.js"),[]))},{id:"vue",name:"Vue",import:(()=>L(()=>import("./vue-D2xRrEX4.js"),__vite__mapDeps([96,3,2,11,9,1,15])))},{id:"vue-html",name:"Vue HTML",import:(()=>L(()=>import("./vue-html-AaS7Mt5G.js"),__vite__mapDeps([97,2])))},{id:"vue-vine",name:"Vue Vine",import:(()=>L(()=>import("./vue-vine-BoDAl6tE.js"),__vite__mapDeps([98,3,5,69,99,12,2])))},{id:"vyper",name:"Vyper",aliases:["vy"],import:(()=>L(()=>import("./vyper-CDx5xZoG.js"),[]))},{id:"wasm",name:"WebAssembly",import:(()=>L(()=>import("./wasm-MzD3tlZU.js"),[]))},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:(()=>L(()=>import("./wenyan-BV7otONQ.js"),[]))},{id:"wgsl",name:"WGSL",import:(()=>L(()=>import("./wgsl-Dx-B1_4e.js"),[]))},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:(()=>L(()=>import("./wikitext-BhOHFoWU.js"),[]))},{id:"wit",name:"WebAssembly Interface Types",import:(()=>L(()=>import("./wit-5i3qLPDT.js"),[]))},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:(()=>L(()=>import("./wolfram-lXgVvXCa.js"),[]))},{id:"xml",name:"XML",import:(()=>L(()=>import("./xml-sdJ4AIDG.js"),__vite__mapDeps([7,8])))},{id:"xsl",name:"XSL",import:(()=>L(()=>import("./xsl-CtQFsRM5.js"),__vite__mapDeps([100,7,8])))},{id:"yaml",name:"YAML",aliases:["yml"],import:(()=>L(()=>import("./yaml-Buea-lGh.js"),[]))},{id:"zenscript",name:"ZenScript",import:(()=>L(()=>import("./zenscript-DVFEvuxE.js"),[]))},{id:"zig",name:"Zig",import:(()=>L(()=>import("./zig-VOosw3JB.js"),[]))}],_v=Object.fromEntries(Ad.map(e=>[e.id,e.import])),vv=Object.fromEntries(Ad.flatMap(e=>{var t;return((t=e.aliases)==null?void 0:t.map(s=>[s,e.import]))||[]})),yv={..._v,...vv},bv=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:(()=>L(()=>import("./andromeeda-C4gqWexZ.js"),[]))},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:(()=>L(()=>import("./aurora-x-D-2ljcwZ.js"),[]))},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:(()=>L(()=>import("./ayu-dark-DYE7WIF3.js"),[]))},{id:"ayu-light",displayName:"Ayu Light",type:"light",import:(()=>L(()=>import("./ayu-light-BA47KaF1.js"),[]))},{id:"ayu-mirage",displayName:"Ayu Mirage",type:"dark",import:(()=>L(()=>import("./ayu-mirage-32ctXXKs.js"),[]))},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:(()=>L(()=>import("./catppuccin-frappe-DFWUc33u.js"),[]))},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:(()=>L(()=>import("./catppuccin-latte-C9dUb6Cb.js"),[]))},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:(()=>L(()=>import("./catppuccin-macchiato-DQyhUUbL.js"),[]))},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:(()=>L(()=>import("./catppuccin-mocha-D87Tk5Gz.js"),[]))},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:(()=>L(()=>import("./dark-plus-C3mMm8J8.js"),[]))},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:(()=>L(()=>import("./dracula-BzJJZx-M.js"),[]))},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:(()=>L(()=>import("./dracula-soft-BXkSAIEj.js"),[]))},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:(()=>L(()=>import("./everforest-dark-BgDCqdQA.js"),[]))},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:(()=>L(()=>import("./everforest-light-C8M2exoo.js"),[]))},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:(()=>L(()=>import("./github-dark-DHJKELXO.js"),[]))},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:(()=>L(()=>import("./github-dark-default-Cuk6v7N8.js"),[]))},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:(()=>L(()=>import("./github-dark-dimmed-DH5Ifo-i.js"),[]))},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:(()=>L(()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),[]))},{id:"github-light",displayName:"GitHub Light",type:"light",import:(()=>L(()=>import("./github-light-DAi9KRSo.js"),[]))},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:(()=>L(()=>import("./github-light-default-D7oLnXFd.js"),[]))},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:(()=>L(()=>import("./github-light-high-contrast-BfjtVDDH.js"),[]))},{id:"gruvbox-dark-hard",displayName:"Gruvbox Dark Hard",type:"dark",import:(()=>L(()=>import("./gruvbox-dark-hard-CFHQjOhq.js"),[]))},{id:"gruvbox-dark-medium",displayName:"Gruvbox Dark Medium",type:"dark",import:(()=>L(()=>import("./gruvbox-dark-medium-GsRaNv29.js"),[]))},{id:"gruvbox-dark-soft",displayName:"Gruvbox Dark Soft",type:"dark",import:(()=>L(()=>import("./gruvbox-dark-soft-CVdnzihN.js"),[]))},{id:"gruvbox-light-hard",displayName:"Gruvbox Light Hard",type:"light",import:(()=>L(()=>import("./gruvbox-light-hard-CH1njM8p.js"),[]))},{id:"gruvbox-light-medium",displayName:"Gruvbox Light Medium",type:"light",import:(()=>L(()=>import("./gruvbox-light-medium-DRw_LuNl.js"),[]))},{id:"gruvbox-light-soft",displayName:"Gruvbox Light Soft",type:"light",import:(()=>L(()=>import("./gruvbox-light-soft-hJgmCMqR.js"),[]))},{id:"horizon",displayName:"Horizon",type:"dark",import:(()=>L(()=>import("./horizon-BUw7H-hv.js"),[]))},{id:"horizon-bright",displayName:"Horizon Bright",type:"light",import:(()=>L(()=>import("./horizon-bright-CUuTKBJd.js"),[]))},{id:"houston",displayName:"Houston",type:"dark",import:(()=>L(()=>import("./houston-DnULxvSX.js"),[]))},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:(()=>L(()=>import("./kanagawa-dragon-CkXjmgJE.js"),[]))},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:(()=>L(()=>import("./kanagawa-lotus-CfQXZHmo.js"),[]))},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:(()=>L(()=>import("./kanagawa-wave-DWedfzmr.js"),[]))},{id:"laserwave",displayName:"LaserWave",type:"dark",import:(()=>L(()=>import("./laserwave-DUszq2jm.js"),[]))},{id:"light-plus",displayName:"Light Plus",type:"light",import:(()=>L(()=>import("./light-plus-B7mTdjB0.js"),[]))},{id:"material-theme",displayName:"Material Theme",type:"dark",import:(()=>L(()=>import("./material-theme-D5KoaKCx.js"),[]))},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:(()=>L(()=>import("./material-theme-darker-BfHTSMKl.js"),[]))},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:(()=>L(()=>import("./material-theme-lighter-B0m2ddpp.js"),[]))},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:(()=>L(()=>import("./material-theme-ocean-CyktbL80.js"),[]))},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:(()=>L(()=>import("./material-theme-palenight-Csfq5Kiy.js"),[]))},{id:"min-dark",displayName:"Min Dark",type:"dark",import:(()=>L(()=>import("./min-dark-CafNBF8u.js"),[]))},{id:"min-light",displayName:"Min Light",type:"light",import:(()=>L(()=>import("./min-light-CTRr51gU.js"),[]))},{id:"monokai",displayName:"Monokai",type:"dark",import:(()=>L(()=>import("./monokai-D4h5O-jR.js"),[]))},{id:"night-owl",displayName:"Night Owl",type:"dark",import:(()=>L(()=>import("./night-owl-C39BiMTA.js"),[]))},{id:"night-owl-light",displayName:"Night Owl Light",type:"light",import:(()=>L(()=>import("./night-owl-light-CMTm3GFP.js"),[]))},{id:"nord",displayName:"Nord",type:"dark",import:(()=>L(()=>import("./nord-Ddv68eIx.js"),[]))},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:(()=>L(()=>import("./one-dark-pro-DVMEJ2y_.js"),[]))},{id:"one-light",displayName:"One Light",type:"light",import:(()=>L(()=>import("./one-light-C3Wv6jpd.js"),[]))},{id:"plastic",displayName:"Plastic",type:"dark",import:(()=>L(()=>import("./plastic-3e1v2bzS.js"),[]))},{id:"poimandres",displayName:"Poimandres",type:"dark",import:(()=>L(()=>import("./poimandres-CS3Unz2-.js"),[]))},{id:"red",displayName:"Red",type:"dark",import:(()=>L(()=>import("./red-bN70gL4F.js"),[]))},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:(()=>L(()=>import("./rose-pine-qdsjHGoJ.js"),[]))},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:(()=>L(()=>import("./rose-pine-dawn-DHQR4-dF.js"),[]))},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:(()=>L(()=>import("./rose-pine-moon-D4_iv3hh.js"),[]))},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:(()=>L(()=>import("./slack-dark-BthQWCQV.js"),[]))},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:(()=>L(()=>import("./slack-ochin-DqwNpetd.js"),[]))},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:(()=>L(()=>import("./snazzy-light-Bw305WKR.js"),[]))},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:(()=>L(()=>import("./solarized-dark-DXbdFlpD.js"),[]))},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:(()=>L(()=>import("./solarized-light-L9t79GZl.js"),[]))},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:(()=>L(()=>import("./synthwave-84-CbfX1IO0.js"),[]))},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:(()=>L(()=>import("./tokyo-night-hegEt444.js"),[]))},{id:"vesper",displayName:"Vesper",type:"dark",import:(()=>L(()=>import("./vesper-DU1UobuO.js"),[]))},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:(()=>L(()=>import("./vitesse-black-Bkuqu6BP.js"),[]))},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:(()=>L(()=>import("./vitesse-dark-D0r3Knsf.js"),[]))},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:(()=>L(()=>import("./vitesse-light-CVO1_9PV.js"),[]))}],Sv=Object.fromEntries(bv.map(e=>[e.id,e.import]));var wv=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function EI(){return 2147483648}function TI(){return typeof performance<"u"?performance.now():Date.now()}const NI=(e,t)=>e+(t-e%t)%t;async function AI(e){let t,s;const i={};function a(b){s=b,i.HEAPU8=new Uint8Array(b),i.HEAPU32=new Uint32Array(b)}function o(b,S,w){i.HEAPU8.copyWithin(b,S,S+w)}function c(b){try{return t.grow(b-s.byteLength+65535>>>16),a(t.buffer),1}catch{}}function d(b){const S=i.HEAPU8.length;b=b>>>0;const w=EI();if(b>w)return!1;for(let k=1;k<=4;k*=2){let T=S*(1+.2/k);T=Math.min(T,b+100663296);const D=Math.min(w,NI(Math.max(b,T),65536));if(c(D))return!0}return!1}const f=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function h(b,S,w=1024){const k=S+w;let T=S;for(;b[T]&&!(T>=k);)++T;if(T-S>16&&b.buffer&&f)return f.decode(b.subarray(S,T));let D="";for(;S<T;){let N=b[S++];if(!(N&128)){D+=String.fromCharCode(N);continue}const E=b[S++]&63;if((N&224)===192){D+=String.fromCharCode((N&31)<<6|E);continue}const M=b[S++]&63;if((N&240)===224?N=(N&15)<<12|E<<6|M:N=(N&7)<<18|E<<12|M<<6|b[S++]&63,N<65536)D+=String.fromCharCode(N);else{const U=N-65536;D+=String.fromCharCode(55296|U>>10,56320|U&1023)}}return D}function g(b,S){return b?h(i.HEAPU8,b,S):""}const _={emscripten_get_now:TI,emscripten_memcpy_big:o,emscripten_resize_heap:d,fd_write:()=>0};async function y(){const S=await e({env:_,wasi_snapshot_preview1:_});t=S.memory,a(t.buffer),Object.assign(i,S),i.UTF8ToString=g}return await y(),i}var RI=Object.defineProperty,DI=(e,t,s)=>t in e?RI(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ut=(e,t,s)=>DI(e,typeof t!="symbol"?t+"":t,s);let Xt=null;function LI(e){throw new wv(e.UTF8ToString(e.getLastOnigError()))}class Rd{constructor(t){Ut(this,"utf16Length"),Ut(this,"utf8Length"),Ut(this,"utf16Value"),Ut(this,"utf8Value"),Ut(this,"utf16OffsetToUtf8"),Ut(this,"utf8OffsetToUtf16");const s=t.length,i=Rd._utf8ByteLength(t),a=i!==s,o=a?new Uint32Array(s+1):null;a&&(o[s]=i);const c=a?new Uint32Array(i+1):null;a&&(c[i]=s);const d=new Uint8Array(i);let f=0;for(let h=0;h<s;h++){const g=t.charCodeAt(h);let _=g,y=!1;if(g>=55296&&g<=56319&&h+1<s){const b=t.charCodeAt(h+1);b>=56320&&b<=57343&&(_=(g-55296<<10)+65536|b-56320,y=!0)}a&&(o[h]=f,y&&(o[h+1]=f),_<=127?c[f+0]=h:_<=2047?(c[f+0]=h,c[f+1]=h):_<=65535?(c[f+0]=h,c[f+1]=h,c[f+2]=h):(c[f+0]=h,c[f+1]=h,c[f+2]=h,c[f+3]=h)),_<=127?d[f++]=_:_<=2047?(d[f++]=192|(_&1984)>>>6,d[f++]=128|(_&63)>>>0):_<=65535?(d[f++]=224|(_&61440)>>>12,d[f++]=128|(_&4032)>>>6,d[f++]=128|(_&63)>>>0):(d[f++]=240|(_&1835008)>>>18,d[f++]=128|(_&258048)>>>12,d[f++]=128|(_&4032)>>>6,d[f++]=128|(_&63)>>>0),y&&h++}this.utf16Length=s,this.utf8Length=i,this.utf16Value=t,this.utf8Value=d,this.utf16OffsetToUtf8=o,this.utf8OffsetToUtf16=c}static _utf8ByteLength(t){let s=0;for(let i=0,a=t.length;i<a;i++){const o=t.charCodeAt(i);let c=o,d=!1;if(o>=55296&&o<=56319&&i+1<a){const f=t.charCodeAt(i+1);f>=56320&&f<=57343&&(c=(o-55296<<10)+65536|f-56320,d=!0)}c<=127?s+=1:c<=2047?s+=2:c<=65535?s+=3:s+=4,d&&i++}return s}createString(t){const s=t.omalloc(this.utf8Length);return t.HEAPU8.set(this.utf8Value,s),s}}const Dd=class Ii{constructor(t){if(Ut(this,"id",++Ii.LAST_ID),Ut(this,"_onigBinding"),Ut(this,"content"),Ut(this,"utf16Length"),Ut(this,"utf8Length"),Ut(this,"utf16OffsetToUtf8"),Ut(this,"utf8OffsetToUtf16"),Ut(this,"ptr"),!Xt)throw new wv("Must invoke loadWasm first.");this._onigBinding=Xt,this.content=t;const s=new Rd(t);this.utf16Length=s.utf16Length,this.utf8Length=s.utf8Length,this.utf16OffsetToUtf8=s.utf16OffsetToUtf8,this.utf8OffsetToUtf16=s.utf8OffsetToUtf16,this.utf8Length<1e4&&!Ii._sharedPtrInUse?(Ii._sharedPtr||(Ii._sharedPtr=Xt.omalloc(1e4)),Ii._sharedPtrInUse=!0,Xt.HEAPU8.set(s.utf8Value,Ii._sharedPtr),this.ptr=Ii._sharedPtr):this.ptr=s.createString(Xt)}convertUtf8OffsetToUtf16(t){return this.utf8OffsetToUtf16?t<0?0:t>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[t]:t}convertUtf16OffsetToUtf8(t){return this.utf16OffsetToUtf8?t<0?0:t>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[t]:t}dispose(){this.ptr===Ii._sharedPtr?Ii._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};Ut(Dd,"LAST_ID",0);Ut(Dd,"_sharedPtr",0);Ut(Dd,"_sharedPtrInUse",!1);let oE=Dd;class MI{constructor(t){if(Ut(this,"_onigBinding"),Ut(this,"_ptr"),!Xt)throw new wv("Must invoke loadWasm first.");const s=[],i=[];for(let d=0,f=t.length;d<f;d++){const h=new Rd(t[d]);s[d]=h.createString(Xt),i[d]=h.utf8Length}const a=Xt.omalloc(4*t.length);Xt.HEAPU32.set(s,a/4);const o=Xt.omalloc(4*t.length);Xt.HEAPU32.set(i,o/4);const c=Xt.createOnigScanner(a,o,t.length);for(let d=0,f=t.length;d<f;d++)Xt.ofree(s[d]);Xt.ofree(o),Xt.ofree(a),c===0&&LI(Xt),this._onigBinding=Xt,this._ptr=c}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(t,s,i){let a=0;if(typeof i=="number"&&(a=i),typeof t=="string"){t=new oE(t);const o=this._findNextMatchSync(t,s,!1,a);return t.dispose(),o}return this._findNextMatchSync(t,s,!1,a)}_findNextMatchSync(t,s,i,a){const o=this._onigBinding,c=o.findNextOnigScannerMatch(this._ptr,t.id,t.ptr,t.utf8Length,t.convertUtf16OffsetToUtf8(s),a);if(c===0)return null;const d=o.HEAPU32;let f=c/4;const h=d[f++],g=d[f++],_=[];for(let y=0;y<g;y++){const b=t.convertUtf8OffsetToUtf16(d[f++]),S=t.convertUtf8OffsetToUtf16(d[f++]);_[y]={start:b,end:S,length:S-b}}return{index:h,captureIndices:_}}}function OI(e){return typeof e.instantiator=="function"}function jI(e){return typeof e.default=="function"}function PI(e){return typeof e.data<"u"}function BI(e){return typeof Response<"u"&&e instanceof Response}function II(e){var t;return typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e))||typeof Buffer<"u"&&((t=Buffer.isBuffer)==null?void 0:t.call(Buffer,e))||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer||typeof Uint32Array<"u"&&e instanceof Uint32Array}let wh;function Cv(e){if(wh)return wh;async function t(){Xt=await AI(async s=>{let i=e;return i=await i,typeof i=="function"&&(i=await i(s)),typeof i=="function"&&(i=await i(s)),OI(i)?i=await i.instantiator(s):jI(i)?i=await i.default(s):(PI(i)&&(i=i.data),BI(i)?typeof WebAssembly.instantiateStreaming=="function"?i=await zI(i)(s):i=await HI(i)(s):II(i)?i=await Fm(i)(s):i instanceof WebAssembly.Module?i=await Fm(i)(s):"default"in i&&i.default instanceof WebAssembly.Module&&(i=await Fm(i.default)(s))),"instance"in i&&(i=i.instance),"exports"in i&&(i=i.exports),i})}return wh=t(),wh}function Fm(e){return t=>WebAssembly.instantiate(e,t)}function zI(e){return t=>WebAssembly.instantiateStreaming(e,t)}function HI(e){return async t=>{const s=await e.arrayBuffer();return WebAssembly.instantiate(s,t)}}let lE;function UI(e){lE=e}function FI(){return lE}async function cE(e){return e&&await Cv(e),{createScanner(t){return new MI(t.map(s=>typeof s=="string"?s:s.source))},createString(t){return new oE(t)}}}const $I=Object.freeze(Object.defineProperty({__proto__:null,createOnigurumaEngine:cE,getDefaultWasmLoader:FI,loadWasm:Cv,setDefaultWasmLoader:UI},Symbol.toStringTag,{value:"Module"}));var uE=gv({});aE(uE,$I);var ut=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function VI(e){return xv(e)}function xv(e){return Array.isArray(e)?WI(e):e instanceof RegExp?e:typeof e=="object"?GI(e):e}function WI(e){let t=[];for(let s=0,i=e.length;s<i;s++)t[s]=xv(e[s]);return t}function GI(e){let t={};for(let s in e)t[s]=xv(e[s]);return t}function hE(e,...t){return t.forEach(s=>{for(let i in s)e[i]=s[i]}),e}function dE(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?dE(e.substring(0,e.length-1)):e.substr(~t+1)}var $m=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Ch=class{static hasCaptures(e){return e===null?!1:($m.lastIndex=0,$m.test(e))}static replaceCaptures(e,t,s){return e.replace($m,(i,a,o,c)=>{let d=s[parseInt(a||o,10)];if(d){let f=t.substring(d.start,d.end);for(;f[0]===".";)f=f.substring(1);switch(c){case"downcase":return f.toLowerCase();case"upcase":return f.toUpperCase();default:return f}}else return i})}};function fE(e,t){return e<t?-1:e>t?1:0}function pE(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let s=e.length,i=t.length;if(s===i){for(let a=0;a<s;a++){let o=fE(e[a],t[a]);if(o!==0)return o}return 0}return s-i}function G1(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function mE(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var gE=class{constructor(e){ce(this,"cache",new Map);this.fn=e}get(e){if(this.cache.has(e))return this.cache.get(e);const t=this.fn(e);return this.cache.set(e,t),t}},rd=class{constructor(e,t,s){ce(this,"_cachedMatchRoot",new gE(e=>this._root.match(e)));this._colorMap=e,this._defaults=t,this._root=s}static createFromRawTheme(e,t){return this.createFromParsedTheme(YI(e),t)}static createFromParsedTheme(e,t){return QI(e,t)}getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;const t=e.scopeName,i=this._cachedMatchRoot.get(t).find(a=>qI(e.parent,a.parentScopes));return i?new _E(i.fontStyle,i.foreground,i.background):null}},Vm=class $h{constructor(t,s){this.parent=t,this.scopeName=s}static push(t,s){for(const i of s)t=new $h(t,i);return t}static from(...t){let s=null;for(let i=0;i<t.length;i++)s=new $h(s,t[i]);return s}push(t){return new $h(this,t)}getSegments(){let t=this;const s=[];for(;t;)s.push(t.scopeName),t=t.parent;return s.reverse(),s}toString(){return this.getSegments().join(" ")}extends(t){return this===t?!0:this.parent===null?!1:this.parent.extends(t)}getExtensionIfDefined(t){const s=[];let i=this;for(;i&&i!==t;)s.push(i.scopeName),i=i.parent;return i===t?s.reverse():void 0}};function qI(e,t){if(t.length===0)return!0;for(let s=0;s<t.length;s++){let i=t[s],a=!1;if(i===">"){if(s===t.length-1)return!1;i=t[++s],a=!0}for(;e&&!KI(e.scopeName,i);){if(a)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function KI(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var _E=class{constructor(e,t,s){this.fontStyle=e,this.foregroundId=t,this.backgroundId=s}};function YI(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,s=[],i=0;for(let a=0,o=t.length;a<o;a++){let c=t[a];if(!c.settings)continue;let d;if(typeof c.scope=="string"){let _=c.scope;_=_.replace(/^[,]+/,""),_=_.replace(/[,]+$/,""),d=_.split(",")}else Array.isArray(c.scope)?d=c.scope:d=[""];let f=-1;if(typeof c.settings.fontStyle=="string"){f=0;let _=c.settings.fontStyle.split(" ");for(let y=0,b=_.length;y<b;y++)switch(_[y]){case"italic":f=f|1;break;case"bold":f=f|2;break;case"underline":f=f|4;break;case"strikethrough":f=f|8;break}}let h=null;typeof c.settings.foreground=="string"&&G1(c.settings.foreground)&&(h=c.settings.foreground);let g=null;typeof c.settings.background=="string"&&G1(c.settings.background)&&(g=c.settings.background);for(let _=0,y=d.length;_<y;_++){let S=d[_].trim().split(" "),w=S[S.length-1],k=null;S.length>1&&(k=S.slice(0,S.length-1),k.reverse()),s[i++]=new XI(w,k,a,f,h,g)}}return s}var XI=class{constructor(e,t,s,i,a,o){this.scope=e,this.parentScopes=t,this.index=s,this.fontStyle=i,this.foreground=a,this.background=o}},ms=(e=>(e[e.NotSet=-1]="NotSet",e[e.None=0]="None",e[e.Italic=1]="Italic",e[e.Bold=2]="Bold",e[e.Underline=4]="Underline",e[e.Strikethrough=8]="Strikethrough",e))(ms||{});function QI(e,t){e.sort((f,h)=>{let g=fE(f.scope,h.scope);return g!==0||(g=pE(f.parentScopes,h.parentScopes),g!==0)?g:f.index-h.index});let s=0,i="#000000",a="#ffffff";for(;e.length>=1&&e[0].scope==="";){let f=e.shift();f.fontStyle!==-1&&(s=f.fontStyle),f.foreground!==null&&(i=f.foreground),f.background!==null&&(a=f.background)}let o=new ZI(t),c=new _E(s,o.getId(i),o.getId(a)),d=new e6(new y_(0,null,-1,0,0),[]);for(let f=0,h=e.length;f<h;f++){let g=e[f];d.insert(0,g.scope,g.parentScopes,g.fontStyle,o.getId(g.foreground),o.getId(g.background))}return new rd(o,c,d)}var ZI=class{constructor(e){ce(this,"_isFrozen");ce(this,"_lastColorId");ce(this,"_id2color");ce(this,"_color2id");if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,s=e.length;t<s;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw new Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},JI=Object.freeze([]),y_=class vE{constructor(t,s,i,a,o){ce(this,"scopeDepth");ce(this,"parentScopes");ce(this,"fontStyle");ce(this,"foreground");ce(this,"background");this.scopeDepth=t,this.parentScopes=s||JI,this.fontStyle=i,this.foreground=a,this.background=o}clone(){return new vE(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(t){let s=[];for(let i=0,a=t.length;i<a;i++)s[i]=t[i].clone();return s}acceptOverwrite(t,s,i,a){this.scopeDepth>t?console.log("how did this happen?"):this.scopeDepth=t,s!==-1&&(this.fontStyle=s),i!==0&&(this.foreground=i),a!==0&&(this.background=a)}},e6=class b_{constructor(t,s=[],i={}){ce(this,"_rulesWithParentScopes");this._mainRule=t,this._children=i,this._rulesWithParentScopes=s}static _cmpBySpecificity(t,s){if(t.scopeDepth!==s.scopeDepth)return s.scopeDepth-t.scopeDepth;let i=0,a=0;for(;t.parentScopes[i]===">"&&i++,s.parentScopes[a]===">"&&a++,!(i>=t.parentScopes.length||a>=s.parentScopes.length);){const o=s.parentScopes[a].length-t.parentScopes[i].length;if(o!==0)return o;i++,a++}return s.parentScopes.length-t.parentScopes.length}match(t){if(t!==""){let i=t.indexOf("."),a,o;if(i===-1?(a=t,o=""):(a=t.substring(0,i),o=t.substring(i+1)),this._children.hasOwnProperty(a))return this._children[a].match(o)}const s=this._rulesWithParentScopes.concat(this._mainRule);return s.sort(b_._cmpBySpecificity),s}insert(t,s,i,a,o,c){if(s===""){this._doInsertHere(t,i,a,o,c);return}let d=s.indexOf("."),f,h;d===-1?(f=s,h=""):(f=s.substring(0,d),h=s.substring(d+1));let g;this._children.hasOwnProperty(f)?g=this._children[f]:(g=new b_(this._mainRule.clone(),y_.cloneArr(this._rulesWithParentScopes)),this._children[f]=g),g.insert(t+1,h,i,a,o,c)}_doInsertHere(t,s,i,a,o){if(s===null){this._mainRule.acceptOverwrite(t,i,a,o);return}for(let c=0,d=this._rulesWithParentScopes.length;c<d;c++){let f=this._rulesWithParentScopes[c];if(pE(f.parentScopes,s)===0){f.acceptOverwrite(t,i,a,o);return}}i===-1&&(i=this._mainRule.fontStyle),a===0&&(a=this._mainRule.foreground),o===0&&(o=this._mainRule.background),this._rulesWithParentScopes.push(new y_(t,s,i,a,o))}},zo=class li{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){const s=li.getLanguageId(t),i=li.getTokenType(t),a=li.getFontStyle(t),o=li.getForeground(t),c=li.getBackground(t);console.log({languageId:s,tokenType:i,fontStyle:a,foreground:o,background:c})}static getLanguageId(t){return(t&255)>>>0}static getTokenType(t){return(t&768)>>>8}static containsBalancedBrackets(t){return(t&1024)!==0}static getFontStyle(t){return(t&30720)>>>11}static getForeground(t){return(t&16744448)>>>15}static getBackground(t){return(t&4278190080)>>>24}static set(t,s,i,a,o,c,d){let f=li.getLanguageId(t),h=li.getTokenType(t),g=li.containsBalancedBrackets(t)?1:0,_=li.getFontStyle(t),y=li.getForeground(t),b=li.getBackground(t);return s!==0&&(f=s),i!==8&&(h=i),a!==null&&(g=a?1:0),o!==-1&&(_=o),c!==0&&(y=c),d!==0&&(b=d),(f<<0|h<<8|g<<10|_<<11|y<<15|b<<24)>>>0}};function ad(e,t){const s=[],i=t6(e);let a=i.next();for(;a!==null;){let f=0;if(a.length===2&&a.charAt(1)===":"){switch(a.charAt(0)){case"R":f=1;break;case"L":f=-1;break;default:console.log(`Unknown priority ${a} in scope selector`)}a=i.next()}let h=c();if(s.push({matcher:h,priority:f}),a!==",")break;a=i.next()}return s;function o(){if(a==="-"){a=i.next();const f=o();return h=>!!f&&!f(h)}if(a==="("){a=i.next();const f=d();return a===")"&&(a=i.next()),f}if(q1(a)){const f=[];do f.push(a),a=i.next();while(q1(a));return h=>t(f,h)}return null}function c(){const f=[];let h=o();for(;h;)f.push(h),h=o();return g=>f.every(_=>_(g))}function d(){const f=[];let h=c();for(;h&&(f.push(h),a==="|"||a===",");){do a=i.next();while(a==="|"||a===",");h=c()}return g=>f.some(_=>_(g))}}function q1(e){return!!e&&!!e.match(/[\w\.:]+/)}function t6(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,s=t.exec(e);return{next:()=>{if(!s)return null;const i=s[0];return s=t.exec(e),i}}}function yE(e){typeof e.dispose=="function"&&e.dispose()}var Cc=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},s6=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},i6=class{constructor(){ce(this,"_references",[]);ce(this,"_seenReferenceKeys",new Set);ce(this,"visitedRule",new Set)}get references(){return this._references}add(e){const t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},n6=class{constructor(e,t){ce(this,"seenFullScopeRequests",new Set);ce(this,"seenPartialScopeRequests",new Set);ce(this,"Q");this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Cc(this.initialScopeName)]}processQueue(){const e=this.Q;this.Q=[];const t=new i6;for(const s of e)r6(s,this.initialScopeName,this.repo,t);for(const s of t.references)if(s instanceof Cc){if(this.seenFullScopeRequests.has(s.scopeName))continue;this.seenFullScopeRequests.add(s.scopeName),this.Q.push(s)}else{if(this.seenFullScopeRequests.has(s.scopeName)||this.seenPartialScopeRequests.has(s.toKey()))continue;this.seenPartialScopeRequests.add(s.toKey()),this.Q.push(s)}}};function r6(e,t,s,i){const a=s.lookup(e.scopeName);if(!a){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const o=s.lookup(t);e instanceof Cc?Vh({baseGrammar:o,selfGrammar:a},i):S_(e.ruleName,{baseGrammar:o,selfGrammar:a,repository:a.repository},i);const c=s.injections(e.scopeName);if(c)for(const d of c)i.add(new Cc(d))}function S_(e,t,s){if(t.repository&&t.repository[e]){const i=t.repository[e];od([i],t,s)}}function Vh(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&od(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&od(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function od(e,t,s){for(const i of e){if(s.visitedRule.has(i))continue;s.visitedRule.add(i);const a=i.repository?hE({},t.repository,i.repository):t.repository;Array.isArray(i.patterns)&&od(i.patterns,{...t,repository:a},s);const o=i.include;if(!o)continue;const c=bE(o);switch(c.kind){case 0:Vh({...t,selfGrammar:t.baseGrammar},s);break;case 1:Vh(t,s);break;case 2:S_(c.ruleName,{...t,repository:a},s);break;case 3:case 4:const d=c.scopeName===t.selfGrammar.scopeName?t.selfGrammar:c.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(d){const f={baseGrammar:t.baseGrammar,selfGrammar:d,repository:a};c.kind===4?S_(c.ruleName,f,s):Vh(f,s)}else c.kind===4?s.add(new s6(c.scopeName,c.ruleName)):s.add(new Cc(c.scopeName));break}}}var a6=class{constructor(){ce(this,"kind",0)}},o6=class{constructor(){ce(this,"kind",1)}},l6=class{constructor(e){ce(this,"kind",2);this.ruleName=e}},c6=class{constructor(e){ce(this,"kind",3);this.scopeName=e}},u6=class{constructor(e,t){ce(this,"kind",4);this.scopeName=e,this.ruleName=t}};function bE(e){if(e==="$base")return new a6;if(e==="$self")return new o6;const t=e.indexOf("#");if(t===-1)return new c6(e);if(t===0)return new l6(e.substring(1));{const s=e.substring(0,t),i=e.substring(t+1);return new u6(s,i)}}var h6=/\\(\d+)/,K1=/\\(\d+)/g,d6=-1,SE=-2;var Hc=class{constructor(e,t,s,i){ce(this,"$location");ce(this,"id");ce(this,"_nameIsCapturing");ce(this,"_name");ce(this,"_contentNameIsCapturing");ce(this,"_contentName");this.$location=e,this.id=t,this._name=s||null,this._nameIsCapturing=Ch.hasCaptures(this._name),this._contentName=i||null,this._contentNameIsCapturing=Ch.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${dE(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:Ch.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:Ch.replaceCaptures(this._contentName,e,t)}},f6=class extends Hc{constructor(t,s,i,a,o){super(t,s,i,a);ce(this,"retokenizeCapturedWithRuleId");this.retokenizeCapturedWithRuleId=o}dispose(){}collectPatterns(t,s){throw new Error("Not supported!")}compile(t,s){throw new Error("Not supported!")}compileAG(t,s,i,a){throw new Error("Not supported!")}},p6=class extends Hc{constructor(t,s,i,a,o){super(t,s,i,null);ce(this,"_match");ce(this,"captures");ce(this,"_cachedCompiledPatterns");this._match=new xc(a,this.id),this.captures=o,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,s){s.push(this._match)}compile(t,s){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,s,i,a){return this._getCachedCompiledPatterns(t).compileAG(t,i,a)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new kc,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Y1=class extends Hc{constructor(t,s,i,a,o){super(t,s,i,a);ce(this,"hasMissingPatterns");ce(this,"patterns");ce(this,"_cachedCompiledPatterns");this.patterns=o.patterns,this.hasMissingPatterns=o.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(t,s){for(const i of this.patterns)t.getRule(i).collectPatterns(t,s)}compile(t,s){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,s,i,a){return this._getCachedCompiledPatterns(t).compileAG(t,i,a)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new kc,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},w_=class extends Hc{constructor(t,s,i,a,o,c,d,f,h,g){super(t,s,i,a);ce(this,"_begin");ce(this,"beginCaptures");ce(this,"_end");ce(this,"endHasBackReferences");ce(this,"endCaptures");ce(this,"applyEndPatternLast");ce(this,"hasMissingPatterns");ce(this,"patterns");ce(this,"_cachedCompiledPatterns");this._begin=new xc(o,this.id),this.beginCaptures=c,this._end=new xc(d||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=f,this.applyEndPatternLast=h||!1,this.patterns=g.patterns,this.hasMissingPatterns=g.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(t,s){return this._end.resolveBackReferences(t,s)}collectPatterns(t,s){s.push(this._begin)}compile(t,s){return this._getCachedCompiledPatterns(t,s).compile(t)}compileAG(t,s,i,a){return this._getCachedCompiledPatterns(t,s).compileAG(t,i,a)}_getCachedCompiledPatterns(t,s){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new kc;for(const i of this.patterns)t.getRule(i).collectPatterns(t,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,s):this._cachedCompiledPatterns.setSource(0,s)),this._cachedCompiledPatterns}},ld=class extends Hc{constructor(t,s,i,a,o,c,d,f,h){super(t,s,i,a);ce(this,"_begin");ce(this,"beginCaptures");ce(this,"whileCaptures");ce(this,"_while");ce(this,"whileHasBackReferences");ce(this,"hasMissingPatterns");ce(this,"patterns");ce(this,"_cachedCompiledPatterns");ce(this,"_cachedCompiledWhilePatterns");this._begin=new xc(o,this.id),this.beginCaptures=c,this.whileCaptures=f,this._while=new xc(d,SE),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=h.patterns,this.hasMissingPatterns=h.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(t,s){return this._while.resolveBackReferences(t,s)}collectPatterns(t,s){s.push(this._begin)}compile(t,s){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,s,i,a){return this._getCachedCompiledPatterns(t).compileAG(t,i,a)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new kc;for(const s of this.patterns)t.getRule(s).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,s){return this._getCachedCompiledWhilePatterns(t,s).compile(t)}compileWhileAG(t,s,i,a){return this._getCachedCompiledWhilePatterns(t,s).compileAG(t,i,a)}_getCachedCompiledWhilePatterns(t,s){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new kc,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,s||""),this._cachedCompiledWhilePatterns}},wE=class fs{static createCaptureRule(t,s,i,a,o){return t.registerRule(c=>new f6(s,c,i,a,o))}static getCompiledRuleId(t,s,i){return t.id||s.registerRule(a=>{if(t.id=a,t.match)return new p6(t.$vscodeTextmateLocation,t.id,t.name,t.match,fs._compileCaptures(t.captures,s,i));if(typeof t.begin>"u"){t.repository&&(i=hE({},i,t.repository));let o=t.patterns;return typeof o>"u"&&t.include&&(o=[{include:t.include}]),new Y1(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,fs._compilePatterns(o,s,i))}return t.while?new ld(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,fs._compileCaptures(t.beginCaptures||t.captures,s,i),t.while,fs._compileCaptures(t.whileCaptures||t.captures,s,i),fs._compilePatterns(t.patterns,s,i)):new w_(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,fs._compileCaptures(t.beginCaptures||t.captures,s,i),t.end,fs._compileCaptures(t.endCaptures||t.captures,s,i),t.applyEndPatternLast,fs._compilePatterns(t.patterns,s,i))}),t.id}static _compileCaptures(t,s,i){let a=[];if(t){let o=0;for(const c in t){if(c==="$vscodeTextmateLocation")continue;const d=parseInt(c,10);d>o&&(o=d)}for(let c=0;c<=o;c++)a[c]=null;for(const c in t){if(c==="$vscodeTextmateLocation")continue;const d=parseInt(c,10);let f=0;t[c].patterns&&(f=fs.getCompiledRuleId(t[c],s,i)),a[d]=fs.createCaptureRule(s,t[c].$vscodeTextmateLocation,t[c].name,t[c].contentName,f)}}return a}static _compilePatterns(t,s,i){let a=[];if(t)for(let o=0,c=t.length;o<c;o++){const d=t[o];let f=-1;if(d.include){const h=bE(d.include);switch(h.kind){case 0:case 1:f=fs.getCompiledRuleId(i[d.include],s,i);break;case 2:let g=i[h.ruleName];g&&(f=fs.getCompiledRuleId(g,s,i));break;case 3:case 4:const _=h.scopeName,y=h.kind===4?h.ruleName:null,b=s.getExternalGrammar(_,i);if(b)if(y){let S=b.repository[y];S&&(f=fs.getCompiledRuleId(S,s,b.repository))}else f=fs.getCompiledRuleId(b.repository.$self,s,b.repository);break}}else f=fs.getCompiledRuleId(d,s,i);if(f!==-1){const h=s.getRule(f);let g=!1;if((h instanceof Y1||h instanceof w_||h instanceof ld)&&h.hasMissingPatterns&&h.patterns.length===0&&(g=!0),g)continue;a.push(f)}}return{patterns:a,hasMissingPatterns:(t?t.length:0)!==a.length}}},xc=class CE{constructor(t,s){ce(this,"source");ce(this,"ruleId");ce(this,"hasAnchor");ce(this,"hasBackReferences");ce(this,"_anchorCache");if(t&&typeof t=="string"){const i=t.length;let a=0,o=[],c=!1;for(let d=0;d<i;d++)if(t.charAt(d)==="\\"&&d+1<i){const h=t.charAt(d+1);h==="z"?(o.push(t.substring(a,d)),o.push("$(?!\\n)(?<!\\n)"),a=d+2):(h==="A"||h==="G")&&(c=!0),d++}this.hasAnchor=c,a===0?this.source=t:(o.push(t.substring(a,i)),this.source=o.join(""))}else this.hasAnchor=!1,this.source=t;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=s,typeof this.source=="string"?this.hasBackReferences=h6.test(this.source):this.hasBackReferences=!1}clone(){return new CE(this.source,this.ruleId)}setSource(t){this.source!==t&&(this.source=t,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(t,s){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let i=s.map(a=>t.substring(a.start,a.end));return K1.lastIndex=0,this.source.replace(K1,(a,o)=>mE(i[parseInt(o,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let t=[],s=[],i=[],a=[],o,c,d,f;for(o=0,c=this.source.length;o<c;o++)d=this.source.charAt(o),t[o]=d,s[o]=d,i[o]=d,a[o]=d,d==="\\"&&o+1<c&&(f=this.source.charAt(o+1),f==="A"?(t[o+1]="",s[o+1]="",i[o+1]="A",a[o+1]="A"):f==="G"?(t[o+1]="",s[o+1]="G",i[o+1]="",a[o+1]="G"):(t[o+1]=f,s[o+1]=f,i[o+1]=f,a[o+1]=f),o++);return{A0_G0:t.join(""),A0_G1:s.join(""),A1_G0:i.join(""),A1_G1:a.join("")}}resolveAnchors(t,s){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:t?s?this._anchorCache.A1_G1:this._anchorCache.A1_G0:s?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},kc=class{constructor(){ce(this,"_items");ce(this,"_hasAnchors");ce(this,"_cached");ce(this,"_anchorCache");this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(s=>s.source);this._cached=new X1(e,t,this._items.map(s=>s.ruleId))}return this._cached}compileAG(e,t,s){return this._hasAnchors?t?s?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,s)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,s)),this._anchorCache.A1_G0):s?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,s)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,s)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,s){let i=this._items.map(a=>a.resolveAnchors(t,s));return new X1(e,i,this._items.map(a=>a.ruleId))}},X1=class{constructor(e,t,s){ce(this,"scanner");this.regExps=t,this.rules=s,this.scanner=e.createOnigScanner(t)}dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const e=[];for(let t=0,s=this.rules.length;t<s;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join(`
|
|
220
|
+
`)}findNextMatchSync(e,t,s){const i=this.scanner.findNextMatchSync(e,t,s);return i?{ruleId:this.rules[i.index],captureIndices:i.captureIndices}:null}},Wm=class{constructor(e,t){this.languageId=e,this.tokenType=t}},Cn,m6=(Cn=class{constructor(t,s){ce(this,"_defaultAttributes");ce(this,"_embeddedLanguagesMatcher");ce(this,"_getBasicScopeAttributes",new gE(t=>{const s=this._scopeToLanguage(t),i=this._toStandardTokenType(t);return new Wm(s,i)}));this._defaultAttributes=new Wm(t,8),this._embeddedLanguagesMatcher=new g6(Object.entries(s||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?Cn._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){const s=t.match(Cn.STANDARD_TOKEN_TYPE_REGEXP);if(!s)return 8;switch(s[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}},ce(Cn,"_NULL_SCOPE_METADATA",new Wm(0,0)),ce(Cn,"STANDARD_TOKEN_TYPE_REGEXP",/\b(comment|string|regex|meta\.embedded)\b/),Cn),g6=class{constructor(e){ce(this,"values");ce(this,"scopesRegExp");if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([s,i])=>mE(s));t.sort(),t.reverse(),this.scopesRegExp=new RegExp(`^((${t.join(")|(")}))($|\\.)`,"")}}match(e){if(!this.scopesRegExp)return;const t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}},Q1=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function xE(e,t,s,i,a,o,c,d){const f=t.content.length;let h=!1,g=-1;if(c){const b=_6(e,t,s,i,a,o);a=b.stack,i=b.linePos,s=b.isFirstLine,g=b.anchorPosition}const _=Date.now();for(;!h;){if(d!==0&&Date.now()-_>d)return new Q1(a,!0);y()}return new Q1(a,!1);function y(){const b=v6(e,t,s,i,a,g);if(!b){o.produce(a,f),h=!0;return}const S=b.captureIndices,w=b.matchedRuleId,k=S&&S.length>0?S[0].end>i:!1;if(w===d6){const T=a.getRule(e);o.produce(a,S[0].start),a=a.withContentNameScopesList(a.nameScopesList),oc(e,t,s,a,o,T.endCaptures,S),o.produce(a,S[0].end);const D=a;if(a=a.parent,g=D.getAnchorPos(),!k&&D.getEnterPos()===i){a=D,o.produce(a,f),h=!0;return}}else{const T=e.getRule(w);o.produce(a,S[0].start);const D=a,N=T.getName(t.content,S),E=a.contentNameScopesList.pushAttributed(N,e);if(a=a.push(w,i,g,S[0].end===f,null,E,E),T instanceof w_){const M=T;oc(e,t,s,a,o,M.beginCaptures,S),o.produce(a,S[0].end),g=S[0].end;const U=M.getContentName(t.content,S),W=E.pushAttributed(U,e);if(a=a.withContentNameScopesList(W),M.endHasBackReferences&&(a=a.withEndRule(M.getEndWithResolvedBackReferences(t.content,S))),!k&&D.hasSameRuleAs(a)){a=a.pop(),o.produce(a,f),h=!0;return}}else if(T instanceof ld){const M=T;oc(e,t,s,a,o,M.beginCaptures,S),o.produce(a,S[0].end),g=S[0].end;const U=M.getContentName(t.content,S),W=E.pushAttributed(U,e);if(a=a.withContentNameScopesList(W),M.whileHasBackReferences&&(a=a.withEndRule(M.getWhileWithResolvedBackReferences(t.content,S))),!k&&D.hasSameRuleAs(a)){a=a.pop(),o.produce(a,f),h=!0;return}}else if(oc(e,t,s,a,o,T.captures,S),o.produce(a,S[0].end),a=a.pop(),!k){a=a.safePop(),o.produce(a,f),h=!0;return}}S[0].end>i&&(i=S[0].end,s=!1)}}function _6(e,t,s,i,a,o){let c=a.beginRuleCapturedEOL?0:-1;const d=[];for(let f=a;f;f=f.pop()){const h=f.getRule(e);h instanceof ld&&d.push({rule:h,stack:f})}for(let f=d.pop();f;f=d.pop()){const{ruleScanner:h,findOptions:g}=S6(f.rule,e,f.stack.endRule,s,i===c),_=h.findNextMatchSync(t,i,g);if(_){if(_.ruleId!==SE){a=f.stack.pop();break}_.captureIndices&&_.captureIndices.length&&(o.produce(f.stack,_.captureIndices[0].start),oc(e,t,s,f.stack,o,f.rule.whileCaptures,_.captureIndices),o.produce(f.stack,_.captureIndices[0].end),c=_.captureIndices[0].end,_.captureIndices[0].end>i&&(i=_.captureIndices[0].end,s=!1))}else{a=f.stack.pop();break}}return{stack:a,linePos:i,anchorPosition:c,isFirstLine:s}}function v6(e,t,s,i,a,o){const c=y6(e,t,s,i,a,o),d=e.getInjections();if(d.length===0)return c;const f=b6(d,e,t,s,i,a,o);if(!f)return c;if(!c)return f;const h=c.captureIndices[0].start,g=f.captureIndices[0].start;return g<h||f.priorityMatch&&g===h?f:c}function y6(e,t,s,i,a,o){const c=a.getRule(e),{ruleScanner:d,findOptions:f}=kE(c,e,a.endRule,s,i===o),h=d.findNextMatchSync(t,i,f);return h?{captureIndices:h.captureIndices,matchedRuleId:h.ruleId}:null}function b6(e,t,s,i,a,o,c){let d=Number.MAX_VALUE,f=null,h,g=0;const _=o.contentNameScopesList.getScopeNames();for(let y=0,b=e.length;y<b;y++){const S=e[y];if(!S.matcher(_))continue;const w=t.getRule(S.ruleId),{ruleScanner:k,findOptions:T}=kE(w,t,null,i,a===c),D=k.findNextMatchSync(s,a,T);if(!D)continue;const N=D.captureIndices[0].start;if(!(N>=d)&&(d=N,f=D.captureIndices,h=D.ruleId,g=S.priority,d===a))break}return f?{priorityMatch:g===-1,captureIndices:f,matchedRuleId:h}:null}function kE(e,t,s,i,a){return{ruleScanner:e.compileAG(t,s,i,a),findOptions:0}}function S6(e,t,s,i,a){return{ruleScanner:e.compileWhileAG(t,s,i,a),findOptions:0}}function oc(e,t,s,i,a,o,c){if(o.length===0)return;const d=t.content,f=Math.min(o.length,c.length),h=[],g=c[0].end;for(let _=0;_<f;_++){const y=o[_];if(y===null)continue;const b=c[_];if(b.length===0)continue;if(b.start>g)break;for(;h.length>0&&h[h.length-1].endPos<=b.start;)a.produceFromScopes(h[h.length-1].scopes,h[h.length-1].endPos),h.pop();if(h.length>0?a.produceFromScopes(h[h.length-1].scopes,b.start):a.produce(i,b.start),y.retokenizeCapturedWithRuleId){const w=y.getName(d,c),k=i.contentNameScopesList.pushAttributed(w,e),T=y.getContentName(d,c),D=k.pushAttributed(T,e),N=i.push(y.retokenizeCapturedWithRuleId,b.start,-1,!1,null,k,D),E=e.createOnigString(d.substring(0,b.end));xE(e,E,s&&b.start===0,b.start,N,a,!1,0),yE(E);continue}const S=y.getName(d,c);if(S!==null){const k=(h.length>0?h[h.length-1].scopes:i.contentNameScopesList).pushAttributed(S,e);h.push(new w6(k,b.end))}}for(;h.length>0;)a.produceFromScopes(h[h.length-1].scopes,h[h.length-1].endPos),h.pop()}var w6=class{constructor(e,t){ce(this,"scopes");ce(this,"endPos");this.scopes=e,this.endPos=t}};function C6(e,t,s,i,a,o,c,d){return new k6(e,t,s,i,a,o,c,d)}function Z1(e,t,s,i,a){const o=ad(t,cd),c=wE.getCompiledRuleId(s,i,a.repository);for(const d of o)e.push({debugSelector:t,matcher:d.matcher,ruleId:c,grammar:a,priority:d.priority})}function cd(e,t){if(t.length<e.length)return!1;let s=0;return e.every(i=>{for(let a=s;a<t.length;a++)if(x6(t[a],i))return s=a+1,!0;return!1})}function x6(e,t){if(!e)return!1;if(e===t)return!0;const s=t.length;return e.length>s&&e.substr(0,s)===t&&e[s]==="."}var k6=class{constructor(e,t,s,i,a,o,c,d){ce(this,"_rootId");ce(this,"_lastRuleId");ce(this,"_ruleId2desc");ce(this,"_includedGrammars");ce(this,"_grammarRepository");ce(this,"_grammar");ce(this,"_injections");ce(this,"_basicScopeAttributesProvider");ce(this,"_tokenTypeMatchers");if(this._rootScopeName=e,this.balancedBracketSelectors=o,this._onigLib=d,this._basicScopeAttributesProvider=new m6(s,i),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=c,this._grammar=J1(t,null),this._injections=null,this._tokenTypeMatchers=[],a)for(const f of Object.keys(a)){const h=ad(f,cd);for(const g of h)this._tokenTypeMatchers.push({matcher:g.matcher,type:a[f]})}}get themeProvider(){return this._grammarRepository}dispose(){for(const e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){const e={lookup:a=>a===this._rootScopeName?this._grammar:this.getExternalGrammar(a),injections:a=>this._grammarRepository.injections(a)},t=[],s=this._rootScopeName,i=e.lookup(s);if(i){const a=i.injections;if(a)for(let c in a)Z1(t,c,a[c],this,i);const o=this._grammarRepository.injections(s);o&&o.forEach(c=>{const d=this.getExternalGrammar(c);if(d){const f=d.injectionSelector;f&&Z1(t,f,d,this,d)}})}return t.sort((a,o)=>a.priority-o.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){const t=++this._lastRuleId,s=e(t);return this._ruleId2desc[t]=s,s}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){const s=this._grammarRepository.lookup(e);if(s)return this._includedGrammars[e]=J1(s,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,s=0){const i=this._tokenize(e,t,!1,s);return{tokens:i.lineTokens.getResult(i.ruleStack,i.lineLength),ruleStack:i.ruleStack,stoppedEarly:i.stoppedEarly}}tokenizeLine2(e,t,s=0){const i=this._tokenize(e,t,!0,s);return{tokens:i.lineTokens.getBinaryResult(i.ruleStack,i.lineLength),ruleStack:i.ruleStack,stoppedEarly:i.stoppedEarly}}_tokenize(e,t,s,i){this._rootId===-1&&(this._rootId=wE.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let a;if(!t||t===C_.NULL){a=!0;const h=this._basicScopeAttributesProvider.getDefaultAttributes(),g=this.themeProvider.getDefaults(),_=zo.set(0,h.languageId,h.tokenType,null,g.fontStyle,g.foregroundId,g.backgroundId),y=this.getRule(this._rootId).getName(null,null);let b;y?b=pc.createRootAndLookUpScopeName(y,_,this):b=pc.createRoot("unknown",_),t=new C_(null,this._rootId,-1,-1,!1,null,b,b)}else a=!1,t.reset();e=e+`
|
|
221
|
+
`;const o=this.createOnigString(e),c=o.content.length,d=new T6(s,e,this._tokenTypeMatchers,this.balancedBracketSelectors),f=xE(this,o,a,0,t,d,!0,i);return yE(o),{lineLength:c,lineTokens:d,ruleStack:f.stack,stoppedEarly:f.stoppedEarly}}};function J1(e,t){return e=VI(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var pc=class zi{constructor(t,s,i){this.parent=t,this.scopePath=s,this.tokenAttributes=i}static fromExtension(t,s){let i=t,a=(t==null?void 0:t.scopePath)??null;for(const o of s)a=Vm.push(a,o.scopeNames),i=new zi(i,a,o.encodedTokenAttributes);return i}static createRoot(t,s){return new zi(null,new Vm(null,t),s)}static createRootAndLookUpScopeName(t,s,i){const a=i.getMetadataForScope(t),o=new Vm(null,t),c=i.themeProvider.themeMatch(o),d=zi.mergeAttributes(s,a,c);return new zi(null,o,d)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return zi.equals(this,t)}static equals(t,s){do{if(t===s||!t&&!s)return!0;if(!t||!s||t.scopeName!==s.scopeName||t.tokenAttributes!==s.tokenAttributes)return!1;t=t.parent,s=s.parent}while(!0)}static mergeAttributes(t,s,i){let a=-1,o=0,c=0;return i!==null&&(a=i.fontStyle,o=i.foregroundId,c=i.backgroundId),zo.set(t,s.languageId,s.tokenType,null,a,o,c)}pushAttributed(t,s){if(t===null)return this;if(t.indexOf(" ")===-1)return zi._pushAttributed(this,t,s);const i=t.split(/ /g);let a=this;for(const o of i)a=zi._pushAttributed(a,o,s);return a}static _pushAttributed(t,s,i){const a=i.getMetadataForScope(s),o=t.scopePath.push(s),c=i.themeProvider.themeMatch(o),d=zi.mergeAttributes(t.tokenAttributes,a,c);return new zi(t,o,d)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(t){var a;const s=[];let i=this;for(;i&&i!==t;)s.push({encodedTokenAttributes:i.tokenAttributes,scopeNames:i.scopePath.getExtensionIfDefined(((a=i.parent)==null?void 0:a.scopePath)??null)}),i=i.parent;return i===t?s.reverse():void 0}},di,C_=(di=class{constructor(t,s,i,a,o,c,d,f){ce(this,"_stackElementBrand");ce(this,"_enterPos");ce(this,"_anchorPos");ce(this,"depth");this.parent=t,this.ruleId=s,this.beginRuleCapturedEOL=o,this.endRule=c,this.nameScopesList=d,this.contentNameScopesList=f,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=i,this._anchorPos=a}equals(t){return t===null?!1:di._equals(this,t)}static _equals(t,s){return t===s?!0:this._structuralEquals(t,s)?pc.equals(t.contentNameScopesList,s.contentNameScopesList):!1}static _structuralEquals(t,s){do{if(t===s||!t&&!s)return!0;if(!t||!s||t.depth!==s.depth||t.ruleId!==s.ruleId||t.endRule!==s.endRule)return!1;t=t.parent,s=s.parent}while(!0)}clone(){return this}static _reset(t){for(;t;)t._enterPos=-1,t._anchorPos=-1,t=t.parent}reset(){di._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,s,i,a,o,c,d){return new di(this,t,s,i,a,o,c,d)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(t){return t.getRule(this.ruleId)}toString(){const t=[];return this._writeString(t,0),"["+t.join(",")+"]"}_writeString(t,s){var i,a;return this.parent&&(s=this.parent._writeString(t,s)),t[s++]=`(${this.ruleId}, ${(i=this.nameScopesList)==null?void 0:i.toString()}, ${(a=this.contentNameScopesList)==null?void 0:a.toString()})`,s}withContentNameScopesList(t){return this.contentNameScopesList===t?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,t)}withEndRule(t){return this.endRule===t?this:new di(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(t){let s=this;for(;s&&s._enterPos===t._enterPos;){if(s.ruleId===t.ruleId)return!0;s=s.parent}return!1}toStateStackFrame(){var t,s,i;return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:((s=this.nameScopesList)==null?void 0:s.getExtensionIfDefined(((t=this.parent)==null?void 0:t.nameScopesList)??null))??[],contentNameScopesList:((i=this.contentNameScopesList)==null?void 0:i.getExtensionIfDefined(this.nameScopesList))??[]}}static pushFrame(t,s){const i=pc.fromExtension((t==null?void 0:t.nameScopesList)??null,s.nameScopesList);return new di(t,s.ruleId,s.enterPos??-1,s.anchorPos??-1,s.beginRuleCapturedEOL,s.endRule,i,pc.fromExtension(i,s.contentNameScopesList))}},ce(di,"NULL",new di(null,0,0,0,!1,null,null,null)),di),E6=class{constructor(e,t){ce(this,"balancedBracketScopes");ce(this,"unbalancedBracketScopes");ce(this,"allowAny",!1);this.balancedBracketScopes=e.flatMap(s=>s==="*"?(this.allowAny=!0,[]):ad(s,cd).map(i=>i.matcher)),this.unbalancedBracketScopes=t.flatMap(s=>ad(s,cd).map(i=>i.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(const t of this.unbalancedBracketScopes)if(t(e))return!1;for(const t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},T6=class{constructor(e,t,s,i){ce(this,"_emitBinaryTokens");ce(this,"_lineText");ce(this,"_tokens");ce(this,"_binaryTokens");ce(this,"_lastTokenEndIndex");ce(this,"_tokenTypeOverrides");this.balancedBracketSelectors=i,this._emitBinaryTokens=e,this._tokenTypeOverrides=s,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){var i;if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let a=(e==null?void 0:e.tokenAttributes)??0,o=!1;if((i=this.balancedBracketSelectors)!=null&&i.matchesAlways&&(o=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const c=(e==null?void 0:e.getScopeNames())??[];for(const d of this._tokenTypeOverrides)d.matcher(c)&&(a=zo.set(a,0,d.type,null,-1,0,0));this.balancedBracketSelectors&&(o=this.balancedBracketSelectors.match(c))}if(o&&(a=zo.set(a,0,8,o,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===a){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(a),this._lastTokenEndIndex=t;return}const s=(e==null?void 0:e.getScopeNames())??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:s}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);const s=new Uint32Array(this._binaryTokens.length);for(let i=0,a=this._binaryTokens.length;i<a;i++)s[i]=this._binaryTokens[i];return s}},N6=class{constructor(e,t){ce(this,"_grammars",new Map);ce(this,"_rawGrammars",new Map);ce(this,"_injectionGrammars",new Map);ce(this,"_theme");this._onigLib=t,this._theme=e}dispose(){for(const e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,s,i,a){if(!this._grammars.has(e)){let o=this._rawGrammars.get(e);if(!o)return null;this._grammars.set(e,C6(e,o,t,s,i,a,this,this._onigLib))}return this._grammars.get(e)}},A6=class{constructor(t){ce(this,"_options");ce(this,"_syncRegistry");ce(this,"_ensureGrammarCache");this._options=t,this._syncRegistry=new N6(rd.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,s){this._syncRegistry.setTheme(rd.createFromRawTheme(t,s))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(t,s,i){return this.loadGrammarWithConfiguration(t,s,{embeddedLanguages:i})}loadGrammarWithConfiguration(t,s,i){return this._loadGrammar(t,s,i.embeddedLanguages,i.tokenTypes,new E6(i.balancedBracketSelectors||[],i.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,s,i,a,o){const c=new n6(this._syncRegistry,t);for(;c.Q.length>0;)c.Q.map(d=>this._loadSingleGrammar(d.scopeName)),c.processQueue();return this._grammarForScopeName(t,s,i,a,o)}_loadSingleGrammar(t){this._ensureGrammarCache.has(t)||(this._doLoadSingleGrammar(t),this._ensureGrammarCache.set(t,!0))}_doLoadSingleGrammar(t){const s=this._options.loadGrammar(t);if(s){const i=typeof this._options.getInjections=="function"?this._options.getInjections(t):void 0;this._syncRegistry.addGrammar(s,i)}}addGrammar(t,s=[],i=0,a=null){return this._syncRegistry.addGrammar(t,s),this._grammarForScopeName(t.scopeName,i,a)}_grammarForScopeName(t,s=0,i=null,a=null,o=null){return this._syncRegistry.grammarForScopeName(t,s,i,a,o)}},x_=C_.NULL;function ud(e,t){const s=typeof e=="string"?{}:{...e.colorReplacements},i=typeof e=="string"?e:e.name;for(const[a,o]of Object.entries((t==null?void 0:t.colorReplacements)||{}))typeof o=="string"?s[a]=o:a===i&&Object.assign(s,o);return s}function Cr(e,t){return e&&((t==null?void 0:t[e==null?void 0:e.toLowerCase()])||e)}function R6(e){return Array.isArray(e)?e:[e]}async function EE(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function Ld(e){return!e||["plaintext","txt","text","plain"].includes(e)}function TE(e){return e==="ansi"||Ld(e)}function Md(e){return e==="none"}function NE(e){return Md(e)}function Od(e,t=!1){var o;if(e.length===0)return[["",0]];const s=e.split(/(\r?\n)/g);let i=0;const a=[];for(let c=0;c<s.length;c+=2){const d=t?s[c]+(s[c+1]||""):s[c];a.push([d,i]),i+=s[c].length,i+=((o=s[c+1])==null?void 0:o.length)||0}return a}const eC={light:"#333333",dark:"#bbbbbb"},tC={light:"#fffffe",dark:"#1e1e1e"},sC="__shiki_resolved";function kv(e){var d,f,h,g,_;if(e!=null&&e[sC])return e;const t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||(t.type="dark"),t.colorReplacements={...t.colorReplacements},t.settings||(t.settings=[]);let{bg:s,fg:i}=t;if(!s||!i){const y=t.settings?t.settings.find(b=>!b.name&&!b.scope):void 0;(d=y==null?void 0:y.settings)!=null&&d.foreground&&(i=y.settings.foreground),(f=y==null?void 0:y.settings)!=null&&f.background&&(s=y.settings.background),!i&&((h=t==null?void 0:t.colors)!=null&&h["editor.foreground"])&&(i=t.colors["editor.foreground"]),!s&&((g=t==null?void 0:t.colors)!=null&&g["editor.background"])&&(s=t.colors["editor.background"]),i||(i=t.type==="light"?eC.light:eC.dark),s||(s=t.type==="light"?tC.light:tC.dark),t.fg=i,t.bg=s}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let a=0;const o=new Map;function c(y){var S;if(o.has(y))return o.get(y);a+=1;const b=`#${a.toString(16).padStart(8,"0").toLowerCase()}`;return(S=t.colorReplacements)!=null&&S[`#${b}`]?c(y):(o.set(y,b),b)}t.settings=t.settings.map(y=>{var k,T;const b=((k=y.settings)==null?void 0:k.foreground)&&!y.settings.foreground.startsWith("#"),S=((T=y.settings)==null?void 0:T.background)&&!y.settings.background.startsWith("#");if(!b&&!S)return y;const w={...y,settings:{...y.settings}};if(b){const D=c(y.settings.foreground);t.colorReplacements[D]=y.settings.foreground,w.settings.foreground=D}if(S){const D=c(y.settings.background);t.colorReplacements[D]=y.settings.background,w.settings.background=D}return w});for(const y of Object.keys(t.colors||{}))if((y==="editor.foreground"||y==="editor.background"||y.startsWith("terminal.ansi"))&&!((_=t.colors[y])!=null&&_.startsWith("#"))){const b=c(t.colors[y]);t.colorReplacements[b]=t.colors[y],t.colors[y]=b}return Object.defineProperty(t,sC,{enumerable:!1,writable:!1,value:!0}),t}async function AE(e){return Array.from(new Set((await Promise.all(e.filter(t=>!TE(t)).map(async t=>await EE(t).then(s=>Array.isArray(s)?s:[s])))).flat()))}async function RE(e){return(await Promise.all(e.map(async t=>NE(t)?null:kv(await EE(t))))).filter(t=>!!t)}function DE(e,t){if(!t)return e;if(t[e]){const s=new Set([e]);for(;t[e];){if(e=t[e],s.has(e))throw new ut(`Circular alias \`${Array.from(s).join(" -> ")} -> ${e}\``);s.add(e)}}return e}var D6=class extends A6{constructor(t,s,i,a={}){super(t);ce(this,"_resolvedThemes",new Map);ce(this,"_resolvedGrammars",new Map);ce(this,"_langMap",new Map);ce(this,"_langGraph",new Map);ce(this,"_textmateThemeCache",new WeakMap);ce(this,"_loadedThemesCache",null);ce(this,"_loadedLanguagesCache",null);this._resolver=t,this._themes=s,this._langs=i,this._alias=a,this._themes.map(o=>this.loadTheme(o)),this.loadLanguages(this._langs)}getTheme(t){return typeof t=="string"?this._resolvedThemes.get(t):this.loadTheme(t)}loadTheme(t){const s=kv(t);return s.name&&(this._resolvedThemes.set(s.name,s),this._loadedThemesCache=null),s}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(t){let s=this._textmateThemeCache.get(t);s||(s=rd.createFromRawTheme(t),this._textmateThemeCache.set(t,s)),this._syncRegistry.setTheme(s)}getGrammar(t){return t=DE(t,this._alias),this._resolvedGrammars.get(t)}loadLanguage(t){var o,c,d,f;if(this.getGrammar(t.name))return;const s=new Set([...this._langMap.values()].filter(h=>{var g;return(g=h.embeddedLangsLazy)==null?void 0:g.includes(t.name)}));this._resolver.addLanguage(t);const i={balancedBracketSelectors:t.balancedBracketSelectors||["*"],unbalancedBracketSelectors:t.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(t.scopeName,t);const a=this.loadGrammarWithConfiguration(t.scopeName,1,i);if(a.name=t.name,this._resolvedGrammars.set(t.name,a),t.aliases&&t.aliases.forEach(h=>{this._alias[h]=t.name}),this._loadedLanguagesCache=null,s.size)for(const h of s)this._resolvedGrammars.delete(h.name),this._loadedLanguagesCache=null,(c=(o=this._syncRegistry)==null?void 0:o._injectionGrammars)==null||c.delete(h.scopeName),(f=(d=this._syncRegistry)==null?void 0:d._grammars)==null||f.delete(h.scopeName),this.loadLanguage(this._langMap.get(h.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(t){for(const a of t)this.resolveEmbeddedLanguages(a);const s=Array.from(this._langGraph.entries()),i=s.filter(([a,o])=>!o);if(i.length){const a=s.filter(([o,c])=>{var d;return c?(d=c.embeddedLanguages||c.embeddedLangs)==null?void 0:d.some(f=>i.map(([h])=>h).includes(f)):!1}).filter(o=>!i.includes(o));throw new ut(`Missing languages ${i.map(([o])=>`\`${o}\``).join(", ")}, required by ${a.map(([o])=>`\`${o}\``).join(", ")}`)}for(const[a,o]of s)this._resolver.addLanguage(o);for(const[a,o]of s)this.loadLanguage(o)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(t){this._langMap.set(t.name,t),this._langGraph.set(t.name,t);const s=t.embeddedLanguages??t.embeddedLangs;if(s)for(const i of s)this._langGraph.set(i,this._langMap.get(i))}},L6=class{constructor(e,t){ce(this,"_langs",new Map);ce(this,"_scopeToLang",new Map);ce(this,"_injections",new Map);ce(this,"_onigLib");this._onigLib={createOnigScanner:s=>e.createScanner(s),createOnigString:s=>e.createString(s)},t.forEach(s=>this.addLanguage(s))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){const t=e.split(".");let s=[];for(let i=1;i<=t.length;i++){const a=t.slice(0,i).join(".");s=[...s,...this._injections.get(a)||[]]}return s}};let Ql=0;function M6(e){Ql+=1,e.warnings!==!1&&Ql>=10&&Ql%10===0&&console.warn(`[Shiki] ${Ql} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new ut("`engine` option is required for synchronous mode");const s=(e.langs||[]).flat(1),i=(e.themes||[]).flat(1).map(kv),a=new D6(new L6(e.engine,s),i,s,e.langAlias);let o;function c(D){return DE(D,e.langAlias)}function d(D){k();const N=a.getGrammar(typeof D=="string"?D:D.name);if(!N)throw new ut(`Language \`${D}\` not found, you may need to load it first`);return N}function f(D){if(D==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};k();const N=a.getTheme(D);if(!N)throw new ut(`Theme \`${D}\` not found, you may need to load it first`);return N}function h(D){k();const N=f(D);return o!==D&&(a.setTheme(N),o=D),{theme:N,colorMap:a.getColorMap()}}function g(){return k(),a.getLoadedThemes()}function _(){return k(),a.getLoadedLanguages()}function y(...D){k(),a.loadLanguages(D.flat(1))}async function b(...D){return y(await AE(D))}function S(...D){k();for(const N of D.flat(1))a.loadTheme(N)}async function w(...D){return k(),S(await RE(D))}function k(){if(t)throw new ut("Shiki instance has been disposed")}function T(){t||(t=!0,a.dispose(),Ql-=1)}return{setTheme:h,getTheme:f,getLanguage:d,getLoadedThemes:g,getLoadedLanguages:_,resolveLangAlias:c,loadLanguage:b,loadLanguageSync:y,loadTheme:w,loadThemeSync:S,dispose:T,[Symbol.dispose]:T}}async function O6(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[t,s,i]=await Promise.all([RE(e.themes||[]),AE(e.langs||[]),e.engine]);return M6({...e,themes:t,langs:s,engine:i})}const LE=new WeakMap;function jd(e,t){LE.set(e,t)}function Ec(e){return LE.get(e)}var Pd=class ME{constructor(...t){ce(this,"_stacks",{});ce(this,"lang");if(t.length===2){const[s,i]=t;this.lang=i,this._stacks=s}else{const[s,i,a]=t;this.lang=i,this._stacks={[a]:s}}}get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,s){return new ME(Object.fromEntries(R6(s).map(i=>[i,x_])),t)}getInternalStack(t=this.theme){return this._stacks[t]}getScopes(t=this.theme){return j6(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function j6(e){const t=[],s=new Set;function i(a){var c;if(s.has(a))return;s.add(a);const o=(c=a==null?void 0:a.nameScopesList)==null?void 0:c.scopeName;o&&t.push(o),a.parent&&i(a.parent)}return i(e),t}function P6(e,t){if(!(e instanceof Pd))throw new ut("Invalid grammar state");return e.getInternalStack(t)}function OE(e,t,s={}){const{theme:i=e.getLoadedThemes()[0]}=s;if(Ld(e.resolveLangAlias(s.lang||"text"))||Md(i))return Od(t).map(d=>[{content:d[0],offset:d[1]}]);const{theme:a,colorMap:o}=e.setTheme(i),c=e.getLanguage(s.lang||"text");if(s.grammarState){if(s.grammarState.lang!==c.name)throw new ut(`Grammar state language "${s.grammarState.lang}" does not match highlight language "${c.name}"`);if(!s.grammarState.themes.includes(a.name))throw new ut(`Grammar state themes "${s.grammarState.themes}" do not contain highlight theme "${a.name}"`)}return I6(t,c,a,o,s)}function B6(...e){if(e.length===2)return Ec(e[1]);const[t,s,i={}]=e,{lang:a="text",theme:o=t.getLoadedThemes()[0]}=i;if(Ld(a)||Md(o))throw new ut("Plain language does not have grammar state");if(a==="ansi")throw new ut("ANSI language does not have grammar state");const{theme:c,colorMap:d}=t.setTheme(o),f=t.getLanguage(a);return new Pd(Ev(s,f,c,d,i).stateStack,f.name,c.name)}function I6(e,t,s,i,a){const o=Ev(e,t,s,i,a),c=new Pd(o.stateStack,t.name,s.name);return jd(o.tokens,c),o.tokens}function Ev(e,t,s,i,a){const o=ud(s,a),{tokenizeMaxLineLength:c=0,tokenizeTimeLimit:d=500}=a,f=Od(e);let h=a.grammarState?P6(a.grammarState,s.name)??x_:a.grammarContextCode!=null?Ev(a.grammarContextCode,t,s,i,{...a,grammarState:void 0,grammarContextCode:void 0}).stateStack:x_,g=[];const _=[];for(let y=0,b=f.length;y<b;y++){const[S,w]=f[y];if(S===""){g=[],_.push([]);continue}if(c>0&&S.length>=c){g=[],_.push([{content:S,offset:w,color:"",fontStyle:0}]);continue}let k,T,D;a.includeExplanation&&(k=t.tokenizeLine(S,h,d),T=k.tokens,D=0);const N=t.tokenizeLine2(S,h,d),E=N.tokens.length/2;for(let M=0;M<E;M++){const U=N.tokens[2*M],W=M+1<E?N.tokens[2*M+2]:S.length;if(U===W)continue;const B=N.tokens[2*M+1],$=Cr(i[zo.getForeground(B)],o),Y=zo.getFontStyle(B),K={content:S.substring(U,W),offset:w+U,color:$,fontStyle:Y};if(a.includeExplanation){const X=[];if(a.includeExplanation!=="scopeName")for(const j of s.settings){let H;switch(typeof j.scope){case"string":H=j.scope.split(/,/).map(O=>O.trim());break;case"object":H=j.scope;break;default:continue}X.push({settings:j,selectors:H.map(O=>O.split(/ /))})}K.explanation=[];let P=0;for(;U+P<W;){const j=T[D],H=S.substring(j.startIndex,j.endIndex);P+=H.length,K.explanation.push({content:H,scopes:a.includeExplanation==="scopeName"?z6(j.scopes):H6(X,j.scopes)}),D+=1}}g.push(K)}_.push(g),g=[],h=N.ruleStack}return{tokens:_,stateStack:h}}function z6(e){return e.map(t=>({scopeName:t}))}function H6(e,t){const s=[];for(let i=0,a=t.length;i<a;i++){const o=t[i];s[i]={scopeName:o,themeMatches:F6(e,o,t.slice(0,i))}}return s}function iC(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function U6(e,t,s){if(!iC(e[e.length-1],t))return!1;let i=e.length-2,a=s.length-1;for(;i>=0&&a>=0;)iC(e[i],s[a])&&(i-=1),a-=1;return i===-1}function F6(e,t,s){const i=[];for(const{selectors:a,settings:o}of e)for(const c of a)if(U6(c,t,s)){i.push(o);break}return i}function jE(e,t,s,i=OE){const a=Object.entries(s.themes).filter(h=>h[1]).map(h=>({color:h[0],theme:h[1]})),o=a.map(h=>{const g=i(e,t,{...s,theme:h.theme});return{tokens:g,state:Ec(g),theme:typeof h.theme=="string"?h.theme:h.theme.name}}),c=$6(...o.map(h=>h.tokens)),d=c[0].map((h,g)=>h.map((_,y)=>{const b={content:_.content,variants:{},offset:_.offset};return"includeExplanation"in s&&s.includeExplanation&&(b.explanation=_.explanation),c.forEach((S,w)=>{const{content:k,explanation:T,offset:D,...N}=S[g][y];b.variants[a[w].color]=N}),b})),f=o[0].state?new Pd(Object.fromEntries(o.map(h=>{var g;return[h.theme,(g=h.state)==null?void 0:g.getInternalStack(h.theme)]})),o[0].state.lang):void 0;return f&&jd(d,f),d}function $6(...e){const t=e.map(()=>[]),s=e.length;for(let i=0;i<e[0].length;i++){const a=e.map(f=>f[i]),o=t.map(()=>[]);t.forEach((f,h)=>f.push(o[h]));const c=a.map(()=>0),d=a.map(f=>f[0]);for(;d.every(f=>f);){const f=Math.min(...d.map(h=>h.content.length));for(let h=0;h<s;h++){const g=d[h];g.content.length===f?(o[h].push(g),c[h]+=1,d[h]=a[h][c[h]]):(o[h].push({...g,content:g.content.slice(0,f)}),d[h]={...g,content:g.content.slice(f),offset:g.offset+f})}}}return t}const V6=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class Uc{constructor(t,s,i){this.normal=s,this.property=t,i&&(this.space=i)}}Uc.prototype.normal={};Uc.prototype.property={};Uc.prototype.space=void 0;function PE(e,t){const s={},i={};for(const a of e)Object.assign(s,a.property),Object.assign(i,a.normal);return new Uc(s,i,t)}function k_(e){return e.toLowerCase()}class Os{constructor(t,s){this.attribute=s,this.property=t}}Os.prototype.attribute="";Os.prototype.booleanish=!1;Os.prototype.boolean=!1;Os.prototype.commaOrSpaceSeparated=!1;Os.prototype.commaSeparated=!1;Os.prototype.defined=!1;Os.prototype.mustUseProperty=!1;Os.prototype.number=!1;Os.prototype.overloadedBoolean=!1;Os.prototype.property="";Os.prototype.spaceSeparated=!1;Os.prototype.space=void 0;let W6=0;const Ie=xa(),Ot=xa(),E_=xa(),pe=xa(),ct=xa(),Co=xa(),Vs=xa();function xa(){return 2**++W6}const T_=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ie,booleanish:Ot,commaOrSpaceSeparated:Vs,commaSeparated:Co,number:pe,overloadedBoolean:E_,spaceSeparated:ct},Symbol.toStringTag,{value:"Module"})),Gm=Object.keys(T_);class Tv extends Os{constructor(t,s,i,a){let o=-1;if(super(t,s),nC(this,"space",a),typeof i=="number")for(;++o<Gm.length;){const c=Gm[o];nC(this,Gm[o],(i&T_[c])===T_[c])}}}Tv.prototype.defined=!0;function nC(e,t,s){s&&(e[t]=s)}function Wo(e){const t={},s={};for(const[i,a]of Object.entries(e.properties)){const o=new Tv(i,e.transform(e.attributes||{},i),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(o.mustUseProperty=!0),t[i]=o,s[k_(i)]=i,s[k_(o.attribute)]=i}return new Uc(t,s,e.space)}const BE=Wo({properties:{ariaActiveDescendant:null,ariaAtomic:Ot,ariaAutoComplete:null,ariaBusy:Ot,ariaChecked:Ot,ariaColCount:pe,ariaColIndex:pe,ariaColSpan:pe,ariaControls:ct,ariaCurrent:null,ariaDescribedBy:ct,ariaDetails:null,ariaDisabled:Ot,ariaDropEffect:ct,ariaErrorMessage:null,ariaExpanded:Ot,ariaFlowTo:ct,ariaGrabbed:Ot,ariaHasPopup:null,ariaHidden:Ot,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ct,ariaLevel:pe,ariaLive:null,ariaModal:Ot,ariaMultiLine:Ot,ariaMultiSelectable:Ot,ariaOrientation:null,ariaOwns:ct,ariaPlaceholder:null,ariaPosInSet:pe,ariaPressed:Ot,ariaReadOnly:Ot,ariaRelevant:null,ariaRequired:Ot,ariaRoleDescription:ct,ariaRowCount:pe,ariaRowIndex:pe,ariaRowSpan:pe,ariaSelected:Ot,ariaSetSize:pe,ariaSort:null,ariaValueMax:pe,ariaValueMin:pe,ariaValueNow:pe,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function IE(e,t){return t in e?e[t]:t}function zE(e,t){return IE(e,t.toLowerCase())}const G6=Wo({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Co,acceptCharset:ct,accessKey:ct,action:null,allow:null,allowFullScreen:Ie,allowPaymentRequest:Ie,allowUserMedia:Ie,alt:null,as:null,async:Ie,autoCapitalize:null,autoComplete:ct,autoFocus:Ie,autoPlay:Ie,blocking:ct,capture:null,charSet:null,checked:Ie,cite:null,className:ct,cols:pe,colSpan:null,content:null,contentEditable:Ot,controls:Ie,controlsList:ct,coords:pe|Co,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ie,defer:Ie,dir:null,dirName:null,disabled:Ie,download:E_,draggable:Ot,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ie,formTarget:null,headers:ct,height:pe,hidden:E_,high:pe,href:null,hrefLang:null,htmlFor:ct,httpEquiv:ct,id:null,imageSizes:null,imageSrcSet:null,inert:Ie,inputMode:null,integrity:null,is:null,isMap:Ie,itemId:null,itemProp:ct,itemRef:ct,itemScope:Ie,itemType:ct,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ie,low:pe,manifest:null,max:null,maxLength:pe,media:null,method:null,min:null,minLength:pe,multiple:Ie,muted:Ie,name:null,nonce:null,noModule:Ie,noValidate:Ie,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:Ie,optimum:pe,pattern:null,ping:ct,placeholder:null,playsInline:Ie,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ie,referrerPolicy:null,rel:ct,required:Ie,reversed:Ie,rows:pe,rowSpan:pe,sandbox:ct,scope:null,scoped:Ie,seamless:Ie,selected:Ie,shadowRootClonable:Ie,shadowRootDelegatesFocus:Ie,shadowRootMode:null,shape:null,size:pe,sizes:null,slot:null,span:pe,spellCheck:Ot,src:null,srcDoc:null,srcLang:null,srcSet:null,start:pe,step:null,style:null,tabIndex:pe,target:null,title:null,translate:null,type:null,typeMustMatch:Ie,useMap:null,value:Ot,width:pe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ct,axis:null,background:null,bgColor:null,border:pe,borderColor:null,bottomMargin:pe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ie,declare:Ie,event:null,face:null,frame:null,frameBorder:null,hSpace:pe,leftMargin:pe,link:null,longDesc:null,lowSrc:null,marginHeight:pe,marginWidth:pe,noResize:Ie,noHref:Ie,noShade:Ie,noWrap:Ie,object:null,profile:null,prompt:null,rev:null,rightMargin:pe,rules:null,scheme:null,scrolling:Ot,standby:null,summary:null,text:null,topMargin:pe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:pe,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ie,disableRemotePlayback:Ie,prefix:null,property:null,results:pe,security:null,unselectable:null},space:"html",transform:zE}),q6=Wo({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Vs,accentHeight:pe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:pe,amplitude:pe,arabicForm:null,ascent:pe,attributeName:null,attributeType:null,azimuth:pe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:pe,by:null,calcMode:null,capHeight:pe,className:ct,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:pe,diffuseConstant:pe,direction:null,display:null,dur:null,divisor:pe,dominantBaseline:null,download:Ie,dx:null,dy:null,edgeMode:null,editable:null,elevation:pe,enableBackground:null,end:null,event:null,exponent:pe,externalResourcesRequired:null,fill:null,fillOpacity:pe,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:Co,g2:Co,glyphName:Co,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:pe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:pe,horizOriginX:pe,horizOriginY:pe,id:null,ideographic:pe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:pe,k:pe,k1:pe,k2:pe,k3:pe,k4:pe,kernelMatrix:Vs,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:pe,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:pe,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:pe,overlineThickness:pe,paintOrder:null,panose1:null,path:null,pathLength:pe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ct,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:pe,pointsAtY:pe,pointsAtZ:pe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Vs,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Vs,rev:Vs,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Vs,requiredFeatures:Vs,requiredFonts:Vs,requiredFormats:Vs,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:pe,specularExponent:pe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:pe,strikethroughThickness:pe,string:null,stroke:null,strokeDashArray:Vs,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:pe,strokeOpacity:pe,strokeWidth:null,style:null,surfaceScale:pe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Vs,tabIndex:pe,tableValues:null,target:null,targetX:pe,targetY:pe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Vs,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:pe,underlineThickness:pe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:pe,values:null,vAlphabetic:pe,vMathematical:pe,vectorEffect:null,vHanging:pe,vIdeographic:pe,version:null,vertAdvY:pe,vertOriginX:pe,vertOriginY:pe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:pe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:IE}),HE=Wo({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),UE=Wo({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:zE}),FE=Wo({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),K6=/[A-Z]/g,rC=/-[a-z]/g,Y6=/^data[-\w.:]+$/i;function X6(e,t){const s=k_(t);let i=t,a=Os;if(s in e.normal)return e.property[e.normal[s]];if(s.length>4&&s.slice(0,4)==="data"&&Y6.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(rC,Z6);i="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!rC.test(o)){let c=o.replace(K6,Q6);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}a=Tv}return new a(i,t)}function Q6(e){return"-"+e.toLowerCase()}function Z6(e){return e.charAt(1).toUpperCase()}const J6=PE([BE,G6,HE,UE,FE],"html"),$E=PE([BE,q6,HE,UE,FE],"svg"),aC={}.hasOwnProperty;function e4(e,t){const s=t||{};function i(a,...o){let c=i.invalid;const d=i.handlers;if(a&&aC.call(a,e)){const f=String(a[e]);c=aC.call(d,f)?d[f]:i.unknown}if(c)return c.call(this,a,...o)}return i.handlers=s.handlers||{},i.invalid=s.invalid,i.unknown=s.unknown,i}const t4=/["&'<>`]/g,s4=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,i4=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,n4=/[|\\{}()[\]^$+*?.]/g,oC=new WeakMap;function r4(e,t){if(e=e.replace(t.subset?a4(t.subset):t4,i),t.subset||t.escapeOnly)return e;return e.replace(s4,s).replace(i4,i);function s(a,o,c){return t.format((a.charCodeAt(0)-55296)*1024+a.charCodeAt(1)-56320+65536,c.charCodeAt(o+2),t)}function i(a,o,c){return t.format(a.charCodeAt(0),c.charCodeAt(o+1),t)}}function a4(e){let t=oC.get(e);return t||(t=o4(e),oC.set(e,t)),t}function o4(e){const t=[];let s=-1;for(;++s<e.length;)t.push(e[s].replace(n4,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}const l4=/[\dA-Fa-f]/;function c4(e,t,s){const i="&#x"+e.toString(16).toUpperCase();return s&&t&&!l4.test(String.fromCharCode(t))?i:i+";"}const u4=/\d/;function h4(e,t,s){const i="&#"+String(e);return s&&t&&!u4.test(String.fromCharCode(t))?i:i+";"}const d4=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],qm={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},f4=["cent","copy","divide","gt","lt","not","para","times"],VE={}.hasOwnProperty,N_={};let xh;for(xh in qm)VE.call(qm,xh)&&(N_[qm[xh]]=xh);const p4=/[^\dA-Za-z]/;function m4(e,t,s,i){const a=String.fromCharCode(e);if(VE.call(N_,a)){const o=N_[a],c="&"+o;return s&&d4.includes(o)&&!f4.includes(o)&&(!i||t&&t!==61&&p4.test(String.fromCharCode(t)))?c:c+";"}return""}function g4(e,t,s){let i=c4(e,t,s.omitOptionalSemicolons),a;if((s.useNamedReferences||s.useShortestReferences)&&(a=m4(e,t,s.omitOptionalSemicolons,s.attribute)),(s.useShortestReferences||!a)&&s.useShortestReferences){const o=h4(e,t,s.omitOptionalSemicolons);o.length<i.length&&(i=o)}return a&&(!s.useShortestReferences||a.length<i.length)?a:i}function xo(e,t){return r4(e,Object.assign({format:g4},t))}const _4=/^>|^->|<!--|-->|--!>|<!-$/g,v4=[">"],y4=["<",">"];function b4(e,t,s,i){return i.settings.bogusComments?"<?"+xo(e.value,Object.assign({},i.settings.characterReferences,{subset:v4}))+">":"<!--"+e.value.replace(_4,a)+"-->";function a(o){return xo(o,Object.assign({},i.settings.characterReferences,{subset:y4}))}}function S4(e,t,s,i){return"<!"+(i.settings.upperDoctype?"DOCTYPE":"doctype")+(i.settings.tightDoctype?"":" ")+"html>"}function lC(e,t){const s=String(e);if(typeof t!="string")throw new TypeError("Expected character");let i=0,a=s.indexOf(t);for(;a!==-1;)i++,a=s.indexOf(t,a+t.length);return i}function w4(e,t){const s=t||{};return(e[e.length-1]===""?[...e,""]:e).join((s.padRight?" ":"")+","+(s.padLeft===!1?"":" ")).trim()}function C4(e){return e.join(" ").trim()}const x4=/[ \t\n\f\r]/g;function Nv(e){return typeof e=="object"?e.type==="text"?cC(e.value):!1:cC(e)}function cC(e){return e.replace(x4,"")===""}const Wt=GE(1),WE=GE(-1),k4=[];function GE(e){return t;function t(s,i,a){const o=s?s.children:k4;let c=(i||0)+e,d=o[c];if(!a)for(;d&&Nv(d);)c+=e,d=o[c];return d}}const E4={}.hasOwnProperty;function qE(e){return t;function t(s,i,a){return E4.call(e,s.tagName)&&e[s.tagName](s,i,a)}}const Av=qE({body:N4,caption:Km,colgroup:Km,dd:L4,dt:D4,head:Km,html:T4,li:R4,optgroup:M4,option:O4,p:A4,rp:uC,rt:uC,tbody:P4,td:hC,tfoot:B4,th:hC,thead:j4,tr:I4});function Km(e,t,s){const i=Wt(s,t,!0);return!i||i.type!=="comment"&&!(i.type==="text"&&Nv(i.value.charAt(0)))}function T4(e,t,s){const i=Wt(s,t);return!i||i.type!=="comment"}function N4(e,t,s){const i=Wt(s,t);return!i||i.type!=="comment"}function A4(e,t,s){const i=Wt(s,t);return i?i.type==="element"&&(i.tagName==="address"||i.tagName==="article"||i.tagName==="aside"||i.tagName==="blockquote"||i.tagName==="details"||i.tagName==="div"||i.tagName==="dl"||i.tagName==="fieldset"||i.tagName==="figcaption"||i.tagName==="figure"||i.tagName==="footer"||i.tagName==="form"||i.tagName==="h1"||i.tagName==="h2"||i.tagName==="h3"||i.tagName==="h4"||i.tagName==="h5"||i.tagName==="h6"||i.tagName==="header"||i.tagName==="hgroup"||i.tagName==="hr"||i.tagName==="main"||i.tagName==="menu"||i.tagName==="nav"||i.tagName==="ol"||i.tagName==="p"||i.tagName==="pre"||i.tagName==="section"||i.tagName==="table"||i.tagName==="ul"):!s||!(s.type==="element"&&(s.tagName==="a"||s.tagName==="audio"||s.tagName==="del"||s.tagName==="ins"||s.tagName==="map"||s.tagName==="noscript"||s.tagName==="video"))}function R4(e,t,s){const i=Wt(s,t);return!i||i.type==="element"&&i.tagName==="li"}function D4(e,t,s){const i=Wt(s,t);return!!(i&&i.type==="element"&&(i.tagName==="dt"||i.tagName==="dd"))}function L4(e,t,s){const i=Wt(s,t);return!i||i.type==="element"&&(i.tagName==="dt"||i.tagName==="dd")}function uC(e,t,s){const i=Wt(s,t);return!i||i.type==="element"&&(i.tagName==="rp"||i.tagName==="rt")}function M4(e,t,s){const i=Wt(s,t);return!i||i.type==="element"&&i.tagName==="optgroup"}function O4(e,t,s){const i=Wt(s,t);return!i||i.type==="element"&&(i.tagName==="option"||i.tagName==="optgroup")}function j4(e,t,s){const i=Wt(s,t);return!!(i&&i.type==="element"&&(i.tagName==="tbody"||i.tagName==="tfoot"))}function P4(e,t,s){const i=Wt(s,t);return!i||i.type==="element"&&(i.tagName==="tbody"||i.tagName==="tfoot")}function B4(e,t,s){return!Wt(s,t)}function I4(e,t,s){const i=Wt(s,t);return!i||i.type==="element"&&i.tagName==="tr"}function hC(e,t,s){const i=Wt(s,t);return!i||i.type==="element"&&(i.tagName==="td"||i.tagName==="th")}const z4=qE({body:F4,colgroup:$4,head:U4,html:H4,tbody:V4});function H4(e){const t=Wt(e,-1);return!t||t.type!=="comment"}function U4(e){const t=new Set;for(const i of e.children)if(i.type==="element"&&(i.tagName==="base"||i.tagName==="title")){if(t.has(i.tagName))return!1;t.add(i.tagName)}const s=e.children[0];return!s||s.type==="element"}function F4(e){const t=Wt(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&Nv(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function $4(e,t,s){const i=WE(s,t),a=Wt(e,-1,!0);return s&&i&&i.type==="element"&&i.tagName==="colgroup"&&Av(i,s.children.indexOf(i),s)?!1:!!(a&&a.type==="element"&&a.tagName==="col")}function V4(e,t,s){const i=WE(s,t),a=Wt(e,-1);return s&&i&&i.type==="element"&&(i.tagName==="thead"||i.tagName==="tbody")&&Av(i,s.children.indexOf(i),s)?!1:!!(a&&a.type==="element"&&a.tagName==="tr")}const kh={name:[[`
|
|
222
|
+
\f\r &/=>`.split(""),`
|
|
223
|
+
\f\r "&'/=>\``.split("")],[`\0
|
|
224
|
+
\f\r "&'/<=>`.split(""),`\0
|
|
225
|
+
\f\r "&'/<=>\``.split("")]],unquoted:[[`
|
|
226
|
+
\f\r &>`.split(""),`\0
|
|
227
|
+
\f\r "&'<=>\``.split("")],[`\0
|
|
228
|
+
\f\r "&'<=>\``.split(""),`\0
|
|
229
|
+
\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function W4(e,t,s,i){const a=i.schema,o=a.space==="svg"?!1:i.settings.omitOptionalTags;let c=a.space==="svg"?i.settings.closeEmptyElements:i.settings.voids.includes(e.tagName.toLowerCase());const d=[];let f;a.space==="html"&&e.tagName==="svg"&&(i.schema=$E);const h=G4(i,e.properties),g=i.all(a.space==="html"&&e.tagName==="template"?e.content:e);return i.schema=a,g&&(c=!1),(h||!o||!z4(e,t,s))&&(d.push("<",e.tagName,h?" "+h:""),c&&(a.space==="svg"||i.settings.closeSelfClosing)&&(f=h.charAt(h.length-1),(!i.settings.tightSelfClosing||f==="/"||f&&f!=='"'&&f!=="'")&&d.push(" "),d.push("/")),d.push(">")),d.push(g),!c&&(!o||!Av(e,t,s))&&d.push("</"+e.tagName+">"),d.join("")}function G4(e,t){const s=[];let i=-1,a;if(t){for(a in t)if(t[a]!==null&&t[a]!==void 0){const o=q4(e,a,t[a]);o&&s.push(o)}}for(;++i<s.length;){const o=e.settings.tightAttributes?s[i].charAt(s[i].length-1):void 0;i!==s.length-1&&o!=='"'&&o!=="'"&&(s[i]+=" ")}return s.join("")}function q4(e,t,s){const i=X6(e.schema,t),a=e.settings.allowParseErrors&&e.schema.space==="html"?0:1,o=e.settings.allowDangerousCharacters?0:1;let c=e.quote,d;if(i.overloadedBoolean&&(s===i.attribute||s==="")?s=!0:(i.boolean||i.overloadedBoolean)&&(typeof s!="string"||s===i.attribute||s==="")&&(s=!!s),s==null||s===!1||typeof s=="number"&&Number.isNaN(s))return"";const f=xo(i.attribute,Object.assign({},e.settings.characterReferences,{subset:kh.name[a][o]}));return s===!0||(s=Array.isArray(s)?(i.commaSeparated?w4:C4)(s,{padLeft:!e.settings.tightCommaSeparatedLists}):String(s),e.settings.collapseEmptyAttributes&&!s)?f:(e.settings.preferUnquoted&&(d=xo(s,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:kh.unquoted[a][o]}))),d!==s&&(e.settings.quoteSmart&&lC(s,c)>lC(s,e.alternative)&&(c=e.alternative),d=c+xo(s,Object.assign({},e.settings.characterReferences,{subset:(c==="'"?kh.single:kh.double)[a][o],attribute:!0}))+c),f+(d&&"="+d))}const K4=["<","&"];function KE(e,t,s,i){return s&&s.type==="element"&&(s.tagName==="script"||s.tagName==="style")?e.value:xo(e.value,Object.assign({},i.settings.characterReferences,{subset:K4}))}function Y4(e,t,s,i){return i.settings.allowDangerousHtml?e.value:KE(e,t,s,i)}function X4(e,t,s,i){return i.all(e)}const Q4=e4("type",{invalid:Z4,unknown:J4,handlers:{comment:b4,doctype:S4,element:W4,raw:Y4,root:X4,text:KE}});function Z4(e){throw new Error("Expected node, not `"+e+"`")}function J4(e){const t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}const ez={},tz={},sz=[];function iz(e,t){const s=t||ez,i=s.quote||'"',a=i==='"'?"'":'"';if(i!=='"'&&i!=="'")throw new Error("Invalid quote `"+i+"`, expected `'` or `\"`");return{one:nz,all:rz,settings:{omitOptionalTags:s.omitOptionalTags||!1,allowParseErrors:s.allowParseErrors||!1,allowDangerousCharacters:s.allowDangerousCharacters||!1,quoteSmart:s.quoteSmart||!1,preferUnquoted:s.preferUnquoted||!1,tightAttributes:s.tightAttributes||!1,upperDoctype:s.upperDoctype||!1,tightDoctype:s.tightDoctype||!1,bogusComments:s.bogusComments||!1,tightCommaSeparatedLists:s.tightCommaSeparatedLists||!1,tightSelfClosing:s.tightSelfClosing||!1,collapseEmptyAttributes:s.collapseEmptyAttributes||!1,allowDangerousHtml:s.allowDangerousHtml||!1,voids:s.voids||V6,characterReferences:s.characterReferences||tz,closeSelfClosing:s.closeSelfClosing||!1,closeEmptyElements:s.closeEmptyElements||!1},schema:s.space==="svg"?$E:J6,quote:i,alternative:a}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function nz(e,t,s){return Q4(e,t,s,this)}function rz(e){const t=[],s=e&&e.children||sz;let i=-1;for(;++i<s.length;)t[i]=this.one(s[i],i,e);return t.join("")}function YE(e,t){var i;if(!t)return e;e.properties||(e.properties={}),(i=e.properties).class||(i.class=[]),typeof e.properties.class=="string"&&(e.properties.class=e.properties.class.split(/\s+/g)),Array.isArray(e.properties.class)||(e.properties.class=[]);const s=Array.isArray(t)?t:t.split(/\s+/g);for(const a of s)a&&!e.properties.class.includes(a)&&e.properties.class.push(a);return e}function az(e){const t=Od(e,!0).map(([a])=>a);function s(a){if(a===e.length)return{line:t.length-1,character:t[t.length-1].length};let o=a,c=0;for(const d of t){if(o<d.length)break;o-=d.length,c++}return{line:c,character:o}}function i(a,o){let c=0;for(let d=0;d<a;d++)c+=t[d].length;return c+=o,c}return{lines:t,indexToPos:s,posToIndex:i}}function oz(e,t,s){const i=new Set;for(const o of e.matchAll(/:?lang=["']([^"']+)["']/g)){const c=o[1].toLowerCase().trim();c&&i.add(c)}for(const o of e.matchAll(/(?:```|~~~)([\w-]+)/g)){const c=o[1].toLowerCase().trim();c&&i.add(c)}for(const o of e.matchAll(/\\begin\{([\w-]+)\}/g)){const c=o[1].toLowerCase().trim();c&&i.add(c)}for(const o of e.matchAll(/<script\s+(?:type|lang)=["']([^"']+)["']/gi)){const c=o[1].toLowerCase().trim(),d=c.includes("/")?c.split("/").pop():c;d&&i.add(d)}if(!s)return Array.from(i);const a=s.getBundledLanguages();return Array.from(i).filter(o=>o&&a[o])}const Rv="light-dark()",lz=["color","background-color"];function cz(e,t){let s=0;const i=[];for(const a of t)a>s&&i.push({...e,content:e.content.slice(s,a),offset:e.offset+s}),s=a;return s<e.content.length&&i.push({...e,content:e.content.slice(s),offset:e.offset+s}),i}function uz(e,t){const s=Array.from(t instanceof Set?t:new Set(t)).sort((i,a)=>i-a);return s.length?e.map(i=>i.flatMap(a=>{const o=s.filter(c=>a.offset<c&&c<a.offset+a.content.length).map(c=>c-a.offset).sort((c,d)=>c-d);return o.length?cz(a,o):a})):e}function hz(e,t,s,i,a="css-vars"){const o={content:e.content,explanation:e.explanation,offset:e.offset},c=t.map(g=>hd(e.variants[g])),d=new Set(c.flatMap(g=>Object.keys(g))),f={},h=(g,_)=>{const y=_==="color"?"":_==="background-color"?"-bg":`-${_}`;return s+t[g]+(_==="color"?"":y)};return c.forEach((g,_)=>{for(const y of d){const b=g[y]||"inherit";if(_===0&&i&&lz.includes(y))if(i===Rv&&c.length>1){const S=t.findIndex(k=>k==="light"),w=t.findIndex(k=>k==="dark");if(S===-1||w===-1)throw new ut('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');f[y]=`light-dark(${c[S][y]||"inherit"}, ${c[w][y]||"inherit"})`,a==="css-vars"&&(f[h(_,y)]=b)}else f[y]=b;else a==="css-vars"&&(f[h(_,y)]=b)}}),o.htmlStyle=f,o}function hd(e){const t={};if(e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle){e.fontStyle&ms.Italic&&(t["font-style"]="italic"),e.fontStyle&ms.Bold&&(t["font-weight"]="bold");const s=[];e.fontStyle&ms.Underline&&s.push("underline"),e.fontStyle&ms.Strikethrough&&s.push("line-through"),s.length&&(t["text-decoration"]=s.join(" "))}return t}function A_(e){return typeof e=="string"?e:Object.entries(e).map(([t,s])=>`${t}:${s}`).join(";")}function dz(){const e=new WeakMap;function t(s){if(!e.has(s.meta)){let o=function(d){if(typeof d=="number"){if(d<0||d>s.source.length)throw new ut(`Invalid decoration offset: ${d}. Code length: ${s.source.length}`);return{...a.indexToPos(d),offset:d}}else{const f=a.lines[d.line];if(f===void 0)throw new ut(`Invalid decoration position ${JSON.stringify(d)}. Lines length: ${a.lines.length}`);let h=d.character;if(h<0&&(h=f.length+h),h<0||h>f.length)throw new ut(`Invalid decoration position ${JSON.stringify(d)}. Line ${d.line} length: ${f.length}`);return{...d,character:h,offset:a.posToIndex(d.line,h)}}};var i=o;const a=az(s.source),c=(s.options.decorations||[]).map(d=>({...d,start:o(d.start),end:o(d.end)}));fz(c),e.set(s.meta,{decorations:c,converter:a,source:s.source})}return e.get(s.meta)}return{name:"shiki:decorations",tokens(s){var i;if((i=this.options.decorations)!=null&&i.length)return uz(s,t(this).decorations.flatMap(a=>[a.start.offset,a.end.offset]))},code(s){var g;if(!((g=this.options.decorations)!=null&&g.length))return;const i=t(this),a=Array.from(s.children).filter(_=>_.type==="element"&&_.tagName==="span");if(a.length!==i.converter.lines.length)throw new ut(`Number of lines in code element (${a.length}) does not match the number of lines in the source (${i.converter.lines.length}). Failed to apply decorations.`);function o(_,y,b,S){const w=a[_];let k="",T=-1,D=-1;if(y===0&&(T=0),b===0&&(D=0),b===Number.POSITIVE_INFINITY&&(D=w.children.length),T===-1||D===-1)for(let E=0;E<w.children.length;E++)k+=XE(w.children[E]),T===-1&&k.length===y&&(T=E+1),D===-1&&k.length===b&&(D=E+1);if(T===-1)throw new ut(`Failed to find start index for decoration ${JSON.stringify(S.start)}`);if(D===-1)throw new ut(`Failed to find end index for decoration ${JSON.stringify(S.end)}`);const N=w.children.slice(T,D);if(!S.alwaysWrap&&N.length===w.children.length)d(w,S,"line");else if(!S.alwaysWrap&&N.length===1&&N[0].type==="element")d(N[0],S,"token");else{const E={type:"element",tagName:"span",properties:{},children:N};d(E,S,"wrapper"),w.children.splice(T,N.length,E)}}function c(_,y){a[_]=d(a[_],y,"line")}function d(_,y,b){var k;const S=y.properties||{},w=y.transform||(T=>T);return _.tagName=y.tagName||"span",_.properties={..._.properties,...S,class:_.properties.class},(k=y.properties)!=null&&k.class&&YE(_,y.properties.class),_=w(_,b)||_,_}const f=[],h=i.decorations.sort((_,y)=>y.start.offset-_.start.offset||_.end.offset-y.end.offset);for(const _ of h){const{start:y,end:b}=_;if(y.line===b.line)o(y.line,y.character,b.character,_);else if(y.line<b.line){o(y.line,y.character,Number.POSITIVE_INFINITY,_);for(let S=y.line+1;S<b.line;S++)f.unshift(()=>c(S,_));o(b.line,0,b.character,_)}}f.forEach(_=>_())}}}function fz(e){for(let t=0;t<e.length;t++){const s=e[t];if(s.start.offset>s.end.offset)throw new ut(`Invalid decoration range: ${JSON.stringify(s.start)} - ${JSON.stringify(s.end)}`);for(let i=t+1;i<e.length;i++){const a=e[i],o=s.start.offset<=a.start.offset&&a.start.offset<s.end.offset,c=s.start.offset<a.end.offset&&a.end.offset<=s.end.offset,d=a.start.offset<=s.start.offset&&s.start.offset<a.end.offset,f=a.start.offset<s.end.offset&&s.end.offset<=a.end.offset;if(o||c||d||f){if(o&&c||d&&f||d&&s.start.offset===s.end.offset||c&&a.start.offset===a.end.offset)continue;throw new ut(`Decorations ${JSON.stringify(s.start)} and ${JSON.stringify(a.start)} intersect.`)}}}}function XE(e){return e.type==="text"?e.value:e.type==="element"?e.children.map(XE).join(""):""}const pz=[dz()];function dd(e){const t=mz(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...pz]}function mz(e){const t=[],s=[],i=[];for(const a of e)switch(a.enforce){case"pre":t.push(a);break;case"post":s.push(a);break;default:i.push(a)}return{pre:t,post:s,normal:i}}var ia=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],Ym={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function gz(e,t){const s=e.indexOf("\x1B",t);if(s!==-1&&e[s+1]==="["){const i=e.indexOf("m",s);if(i!==-1)return{sequence:e.substring(s+2,i).split(";"),startPosition:s,position:i+1}}return{position:e.length}}function dC(e){const t=e.shift();if(t==="2"){const s=e.splice(0,3).map(i=>Number.parseInt(i));return s.length!==3||s.some(i=>Number.isNaN(i))?void 0:{type:"rgb",rgb:s}}else if(t==="5"){const s=e.shift();if(s)return{type:"table",index:Number(s)}}}function _z(e){const t=[];for(;e.length>0;){const s=e.shift();if(!s)continue;const i=Number.parseInt(s);if(!Number.isNaN(i))if(i===0)t.push({type:"resetAll"});else if(i<=9)Ym[i]&&t.push({type:"setDecoration",value:Ym[i]});else if(i<=29){const a=Ym[i-20];a&&(t.push({type:"resetDecoration",value:a}),a==="dim"&&t.push({type:"resetDecoration",value:"bold"}))}else if(i<=37)t.push({type:"setForegroundColor",value:{type:"named",name:ia[i-30]}});else if(i===38){const a=dC(e);a&&t.push({type:"setForegroundColor",value:a})}else if(i===39)t.push({type:"resetForegroundColor"});else if(i<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:ia[i-40]}});else if(i===48){const a=dC(e);a&&t.push({type:"setBackgroundColor",value:a})}else i===49?t.push({type:"resetBackgroundColor"}):i===53?t.push({type:"setDecoration",value:"overline"}):i===55?t.push({type:"resetDecoration",value:"overline"}):i>=90&&i<=97?t.push({type:"setForegroundColor",value:{type:"named",name:ia[i-90+8]}}):i>=100&&i<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:ia[i-100+8]}})}return t}function vz(){let e=null,t=null,s=new Set;return{parse(i){const a=[];let o=0;do{const c=gz(i,o),d=c.sequence?i.substring(o,c.startPosition):i.substring(o);if(d.length>0&&a.push({value:d,foreground:e,background:t,decorations:new Set(s)}),c.sequence){const f=_z(c.sequence);for(const h of f)h.type==="resetAll"?(e=null,t=null,s.clear()):h.type==="resetForegroundColor"?e=null:h.type==="resetBackgroundColor"?t=null:h.type==="resetDecoration"&&s.delete(h.value);for(const h of f)h.type==="setForegroundColor"?e=h.value:h.type==="setBackgroundColor"?t=h.value:h.type==="setDecoration"&&s.add(h.value)}o=c.position}while(o<i.length);return a}}}var yz={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};function bz(e=yz){function t(d){return e[d]}function s(d){return`#${d.map(f=>Math.max(0,Math.min(f,255)).toString(16).padStart(2,"0")).join("")}`}let i;function a(){if(i)return i;i=[];for(let h=0;h<ia.length;h++)i.push(t(ia[h]));let d=[0,95,135,175,215,255];for(let h=0;h<6;h++)for(let g=0;g<6;g++)for(let _=0;_<6;_++)i.push(s([d[h],d[g],d[_]]));let f=8;for(let h=0;h<24;h++,f+=10)i.push(s([f,f,f]));return i}function o(d){return a()[d]}function c(d){switch(d.type){case"named":return t(d.name);case"rgb":return s(d.rgb);case"table":return o(d.index)}}return{value:c}}const Sz={black:"#000000",red:"#cd3131",green:"#0DBC79",yellow:"#E5E510",blue:"#2472C8",magenta:"#BC3FBC",cyan:"#11A8CD",white:"#E5E5E5",brightBlack:"#666666",brightRed:"#F14C4C",brightGreen:"#23D18B",brightYellow:"#F5F543",brightBlue:"#3B8EEA",brightMagenta:"#D670D6",brightCyan:"#29B8DB",brightWhite:"#FFFFFF"};function wz(e,t,s){const i=ud(e,s),a=Od(t),o=bz(Object.fromEntries(ia.map(d=>{var h;const f=`terminal.ansi${d[0].toUpperCase()}${d.substring(1)}`;return[d,((h=e.colors)==null?void 0:h[f])||Sz[d]]}))),c=vz();return a.map(d=>c.parse(d[0]).map(f=>{let h,g;f.decorations.has("reverse")?(h=f.background?o.value(f.background):e.bg,g=f.foreground?o.value(f.foreground):e.fg):(h=f.foreground?o.value(f.foreground):e.fg,g=f.background?o.value(f.background):void 0),h=Cr(h,i),g=Cr(g,i),f.decorations.has("dim")&&(h=Cz(h));let _=ms.None;return f.decorations.has("bold")&&(_|=ms.Bold),f.decorations.has("italic")&&(_|=ms.Italic),f.decorations.has("underline")&&(_|=ms.Underline),f.decorations.has("strikethrough")&&(_|=ms.Strikethrough),{content:f.value,offset:d[1],color:h,bgColor:g,fontStyle:_}}))}function Cz(e){const t=e.match(/#([0-9a-f]{3,8})/i);if(t){const i=t[1];if(i.length===8){const a=Math.round(Number.parseInt(i.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${i.slice(0,6)}${a}`}else{if(i.length===6)return`#${i}80`;if(i.length===4){const a=i[0],o=i[1],c=i[2],d=i[3];return`#${a}${a}${o}${o}${c}${c}${Math.round(Number.parseInt(`${d}${d}`,16)/2).toString(16).padStart(2,"0")}`}else if(i.length===3){const a=i[0],o=i[1],c=i[2];return`#${a}${a}${o}${o}${c}${c}80`}}}const s=e.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return s?`var(${s[1]}-dim)`:e}function R_(e,t,s={}){const i=e.resolveLangAlias(s.lang||"text"),{theme:a=e.getLoadedThemes()[0]}=s;if(!Ld(i)&&!Md(a)&&i==="ansi"){const{theme:o}=e.setTheme(a);return wz(o,t,s)}return OE(e,t,s)}function fd(e,t,s){let i,a,o,c,d,f;if("themes"in s){const{defaultColor:h="light",cssVariablePrefix:g="--shiki-",colorsRendering:_="css-vars"}=s,y=Object.entries(s.themes).filter(T=>T[1]).map(T=>({color:T[0],theme:T[1]})).sort((T,D)=>T.color===h?-1:D.color===h?1:0);if(y.length===0)throw new ut("`themes` option must not be empty");const b=jE(e,t,s,R_);if(f=Ec(b),h&&Rv!==h&&!y.find(T=>T.color===h))throw new ut(`\`themes\` option must contain the defaultColor key \`${h}\``);const S=y.map(T=>e.getTheme(T.theme)),w=y.map(T=>T.color);o=b.map(T=>T.map(D=>hz(D,w,g,h,_))),f&&jd(o,f);const k=y.map(T=>ud(T.theme,s));a=fC(y,S,k,g,h,"fg",_),i=fC(y,S,k,g,h,"bg",_),c=`shiki-themes ${S.map(T=>T.name).join(" ")}`,d=h?void 0:[a,i].join(";")}else if("theme"in s){const h=ud(s.theme,s);o=R_(e,t,s);const g=e.getTheme(s.theme);i=Cr(g.bg,h),a=Cr(g.fg,h),c=g.name,f=Ec(o)}else throw new ut("Invalid options, either `theme` or `themes` must be provided");return{tokens:o,fg:a,bg:i,themeName:c,rootStyle:d,grammarState:f}}function fC(e,t,s,i,a,o,c){return e.map((d,f)=>{const h=Cr(t[f][o],s[f])||"inherit",g=`${i+d.color}${o==="bg"?"-bg":""}:${h}`;if(f===0&&a){if(a===Rv&&e.length>1){const _=e.findIndex(b=>b.color==="light"),y=e.findIndex(b=>b.color==="dark");if(_===-1||y===-1)throw new ut('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${Cr(t[_][o],s[_])||"inherit"}, ${Cr(t[y][o],s[y])||"inherit"});${g}`}return h}return c==="css-vars"?g:null}).filter(d=>!!d).join(";")}function pd(e,t,s,i={meta:{},options:s,codeToHast:(a,o)=>pd(e,a,o),codeToTokens:(a,o)=>fd(e,a,o)}){var S,w;let a=t;for(const k of dd(s))a=((S=k.preprocess)==null?void 0:S.call(i,a,s))||a;let{tokens:o,fg:c,bg:d,themeName:f,rootStyle:h,grammarState:g}=fd(e,a,s);const{mergeWhitespaces:_=!0,mergeSameStyleTokens:y=!1}=s;_===!0?o=kz(o):_==="never"&&(o=Ez(o)),y&&(o=Tz(o));const b={...i,get source(){return a}};for(const k of dd(s))o=((w=k.tokens)==null?void 0:w.call(b,o))||o;return xz(o,{...s,fg:c,bg:d,themeName:f,rootStyle:s.rootStyle===!1?!1:s.rootStyle??h},b,g)}function xz(e,t,s,i=Ec(e)){var w,k,T,D;const a=dd(t),o=[],c={type:"root",children:[]},{structure:d="classic",tabindex:f="0"}=t,h={class:`shiki ${t.themeName||""}`};t.rootStyle!==!1&&(t.rootStyle!=null?h.style=t.rootStyle:h.style=`background-color:${t.bg};color:${t.fg}`),f!==!1&&f!=null&&(h.tabindex=f.toString());for(const[N,E]of Object.entries(t.meta||{}))N.startsWith("_")||(h[N]=E);let g={type:"element",tagName:"pre",properties:h,children:[],data:t.data},_={type:"element",tagName:"code",properties:{},children:o};const y=[],b={...s,structure:d,addClassToHast:YE,get source(){return s.source},get tokens(){return e},get options(){return t},get root(){return c},get pre(){return g},get code(){return _},get lines(){return y}};if(e.forEach((N,E)=>{var W,B;E&&(d==="inline"?c.children.push({type:"element",tagName:"br",properties:{},children:[]}):d==="classic"&&o.push({type:"text",value:`
|
|
230
|
+
`}));let M={type:"element",tagName:"span",properties:{class:"line"},children:[]},U=0;for(const $ of N){let Y={type:"element",tagName:"span",properties:{...$.htmlAttrs},children:[{type:"text",value:$.content}]};const K=A_($.htmlStyle||hd($));K&&(Y.properties.style=K);for(const X of a)Y=((W=X==null?void 0:X.span)==null?void 0:W.call(b,Y,E+1,U,M,$))||Y;d==="inline"?c.children.push(Y):d==="classic"&&M.children.push(Y),U+=$.content.length}if(d==="classic"){for(const $ of a)M=((B=$==null?void 0:$.line)==null?void 0:B.call(b,M,E+1))||M;y.push(M),o.push(M)}else d==="inline"&&y.push(M)}),d==="classic"){for(const N of a)_=((w=N==null?void 0:N.code)==null?void 0:w.call(b,_))||_;g.children.push(_);for(const N of a)g=((k=N==null?void 0:N.pre)==null?void 0:k.call(b,g))||g;c.children.push(g)}else if(d==="inline"){const N=[];let E={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(const U of c.children)U.type==="element"&&U.tagName==="br"?(N.push(E),E={type:"element",tagName:"span",properties:{class:"line"},children:[]}):(U.type==="element"||U.type==="text")&&E.children.push(U);N.push(E);let M={type:"element",tagName:"code",properties:{},children:N};for(const U of a)M=((T=U==null?void 0:U.code)==null?void 0:T.call(b,M))||M;c.children=[];for(let U=0;U<M.children.length;U++){U>0&&c.children.push({type:"element",tagName:"br",properties:{},children:[]});const W=M.children[U];W.type==="element"&&c.children.push(...W.children)}}let S=c;for(const N of a)S=((D=N==null?void 0:N.root)==null?void 0:D.call(b,S))||S;return i&&jd(S,i),S}function kz(e){return e.map(t=>{const s=[];let i="",a;return t.forEach((o,c)=>{const d=!(o.fontStyle&&(o.fontStyle&ms.Underline||o.fontStyle&ms.Strikethrough));d&&o.content.match(/^\s+$/)&&t[c+1]?(a===void 0&&(a=o.offset),i+=o.content):i?(d?s.push({...o,offset:a,content:i+o.content}):s.push({content:i,offset:a},o),a=void 0,i=""):s.push(o)}),s})}function Ez(e){return e.map(t=>t.flatMap(s=>{if(s.content.match(/^\s+$/))return s;const i=s.content.match(/^(\s*)(.*?)(\s*)$/);if(!i)return s;const[,a,o,c]=i;if(!a&&!c)return s;const d=[{...s,offset:s.offset+a.length,content:o}];return a&&d.unshift({content:a,offset:s.offset}),c&&d.push({content:c,offset:s.offset+a.length+o.length}),d}))}function Tz(e){return e.map(t=>{const s=[];for(const i of t){if(s.length===0){s.push({...i});continue}const a=s[s.length-1],o=A_(a.htmlStyle||hd(a)),c=A_(i.htmlStyle||hd(i)),d=a.fontStyle&&(a.fontStyle&ms.Underline||a.fontStyle&ms.Strikethrough),f=i.fontStyle&&(i.fontStyle&ms.Underline||i.fontStyle&ms.Strikethrough);!d&&!f&&o===c?a.content+=i.content:s.push({...i})}return s})}const Nz=iz;function Az(e,t,s){var o;const i={meta:{},options:s,codeToHast:(c,d)=>pd(e,c,d),codeToTokens:(c,d)=>fd(e,c,d)};let a=Nz(pd(e,t,s,i));for(const c of dd(s))a=((o=c.postprocess)==null?void 0:o.call(i,a,s))||a;return a}async function Rz(e){const t=await O6(e);return{getLastGrammarState:(...s)=>B6(t,...s),codeToTokensBase:(s,i)=>R_(t,s,i),codeToTokensWithThemes:(s,i)=>jE(t,s,i),codeToTokens:(s,i)=>fd(t,s,i),codeToHast:(s,i)=>pd(t,s,i),codeToHtml:(s,i)=>Az(t,s,i),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}function Dz(e){const t=e.langs,s=e.themes,i=e.engine;async function a(o){function c(_){var y;if(typeof _=="string"){if(_=((y=o.langAlias)==null?void 0:y[_])||_,TE(_))return[];const b=t[_];if(!b)throw new ut(`Language \`${_}\` is not included in this bundle. You may want to load it from external source.`);return b}return _}function d(_){if(NE(_))return"none";if(typeof _=="string"){const y=s[_];if(!y)throw new ut(`Theme \`${_}\` is not included in this bundle. You may want to load it from external source.`);return y}return _}const f=(o.themes??[]).map(_=>d(_)),h=(o.langs??[]).map(_=>c(_)),g=await Rz({engine:o.engine??i(),...o,themes:f,langs:h});return{...g,loadLanguage(..._){return g.loadLanguage(..._.map(c))},loadTheme(..._){return g.loadTheme(..._.map(d))},getBundledLanguages(){return t},getBundledThemes(){return s}}}return a}function Lz(e){let t;async function s(i={}){if(t){const a=await t;return await Promise.all([a.loadTheme(...i.themes||[]),a.loadLanguage(...i.langs||[])]),a}else{t=e({...i,themes:[],langs:[]});const a=await t;return await Promise.all([a.loadTheme(...i.themes||[]),a.loadLanguage(...i.langs||[])]),a}}return s}function Mz(e,t){const s=Lz(e);async function i(a,o){var f;const c=await s({langs:[o.lang],themes:"theme"in o?[o.theme]:Object.values(o.themes)}),d=await((f=t==null?void 0:t.guessEmbeddedLanguages)==null?void 0:f.call(t,a,o.lang,c));return d&&await c.loadLanguage(...d),c}return{getSingletonHighlighter(a){return s(a)},async codeToHtml(a,o){return(await i(a,o)).codeToHtml(a,o)},async codeToHast(a,o){return(await i(a,o)).codeToHast(a,o)},async codeToTokens(a,o){return(await i(a,o)).codeToTokens(a,o)},async codeToTokensBase(a,o){return(await i(a,o)).codeToTokensBase(a,o)},async codeToTokensWithThemes(a,o){return(await i(a,o)).codeToTokensWithThemes(a,o)},async getLastGrammarState(a,o){return(await s({langs:[o.lang],themes:[o.theme]})).getLastGrammarState(a,o)}}}var Oz=gv({bundledLanguages:()=>yv,bundledLanguagesAlias:()=>vv,bundledLanguagesBase:()=>_v,bundledLanguagesInfo:()=>Ad,bundledThemes:()=>Sv,bundledThemesInfo:()=>bv,codeToHast:()=>ZE,codeToHtml:()=>QE,codeToTokens:()=>JE,codeToTokensBase:()=>eT,codeToTokensWithThemes:()=>tT,createHighlighter:()=>Bd,getLastGrammarState:()=>iT,getSingletonHighlighter:()=>sT});const Bd=Dz({langs:yv,themes:Sv,engine:()=>(0,uE.createOnigurumaEngine)(L(()=>import("./wasm-CG6Dc4jp.js"),[]))}),{codeToHtml:QE,codeToHast:ZE,codeToTokens:JE,codeToTokensBase:eT,codeToTokensWithThemes:tT,getSingletonHighlighter:sT,getLastGrammarState:iT}=Mz(Bd,{guessEmbeddedLanguages:oz}),pC=4294967295;var jz=class{constructor(e,t={}){ce(this,"regexps");this.patterns=e,this.options=t;const{forgiving:s=!1,cache:i,regexConstructor:a}=t;if(!a)throw new Error("Option `regexConstructor` is not provided");this.regexps=e.map(o=>{if(typeof o!="string")return o;const c=i==null?void 0:i.get(o);if(c){if(c instanceof RegExp)return c;if(s)return null;throw c}try{const d=a(o);return i==null||i.set(o,d),d}catch(d){if(i==null||i.set(o,d),s)return null;throw d}})}findNextMatchSync(e,t,s){const i=typeof e=="string"?e:e.content,a=[];function o(c,d,f=0){return{index:c,captureIndices:d.indices.map(h=>h==null?{start:pC,end:pC,length:0}:{start:h[0]+f,end:h[1]+f,length:h[1]-h[0]})}}for(let c=0;c<this.regexps.length;c++){const d=this.regexps[c];if(d)try{d.lastIndex=t;const f=d.exec(i);if(!f)continue;if(f.index===t)return o(c,f,0);a.push([c,f,0])}catch(f){if(this.options.forgiving)continue;throw f}}if(a.length){const c=Math.min(...a.map(d=>d[1].index));for(const[d,f,h]of a)if(f.index===c)return o(d,f,h)}return null}};function Go(e){if([...e].length!==1)throw new Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}function Pz(e,t,s){return e.has(t)||e.set(t,s),e.get(t)}const Dv=new Set(["alnum","alpha","ascii","blank","cntrl","digit","graph","lower","print","punct","space","upper","word","xdigit"]),ts=String.raw;function qo(e,t){if(e==null)throw new Error(t??"Value expected");return e}const nT=ts`\[\^?`,rT=`c.? | C(?:-.?)?|${ts`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${ts`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${ts`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${ts`o\{[^\}]*\}?`}|${ts`\d{1,3}`}`,Lv=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,Eh=new RegExp(ts`
|
|
231
|
+
\\ (?:
|
|
232
|
+
${rT}
|
|
233
|
+
| [gk]<[^>]*>?
|
|
234
|
+
| [gk]'[^']*'?
|
|
235
|
+
| .
|
|
236
|
+
)
|
|
237
|
+
| \( (?:
|
|
238
|
+
\? (?:
|
|
239
|
+
[:=!>({]
|
|
240
|
+
| <[=!]
|
|
241
|
+
| <[^>]*>
|
|
242
|
+
| '[^']*'
|
|
243
|
+
| ~\|?
|
|
244
|
+
| #(?:[^)\\]|\\.?)*
|
|
245
|
+
| [^:)]*[:)]
|
|
246
|
+
)?
|
|
247
|
+
| \*[^\)]*\)?
|
|
248
|
+
)?
|
|
249
|
+
| (?:${Lv.source})+
|
|
250
|
+
| ${nT}
|
|
251
|
+
| .
|
|
252
|
+
`.replace(/\s+/g,""),"gsu"),Xm=new RegExp(ts`
|
|
253
|
+
\\ (?:
|
|
254
|
+
${rT}
|
|
255
|
+
| .
|
|
256
|
+
)
|
|
257
|
+
| \[:(?:\^?\p{Alpha}+|\^):\]
|
|
258
|
+
| ${nT}
|
|
259
|
+
| &&
|
|
260
|
+
| .
|
|
261
|
+
`.replace(/\s+/g,""),"gsu");function Bz(e,t={}){const s={flags:"",...t,rules:{captureGroup:!1,singleline:!1,...t.rules}};if(typeof e!="string")throw new Error("String expected as pattern");const i=s8(s.flags),a=[i.extended],o={captureGroup:s.rules.captureGroup,getCurrentModX(){return a.at(-1)},numOpenGroups:0,popModX(){a.pop()},pushModX(_){a.push(_)},replaceCurrentModX(_){a[a.length-1]=_},singleline:s.rules.singleline};let c=[],d;for(Eh.lastIndex=0;d=Eh.exec(e);){const _=Iz(o,e,d[0],Eh.lastIndex);_.tokens?c.push(..._.tokens):_.token&&c.push(_.token),_.lastIndex!==void 0&&(Eh.lastIndex=_.lastIndex)}const f=[];let h=0;c.filter(_=>_.type==="GroupOpen").forEach(_=>{_.kind==="capturing"?_.number=++h:_.raw==="("&&f.push(_)}),h||f.forEach((_,y)=>{_.kind="capturing",_.number=y+1});const g=h||f.length;return{tokens:c.map(_=>_.type==="EscapedNumber"?n8(_,g):_).flat(),flags:i}}function Iz(e,t,s,i){const[a,o]=s;if(s==="["||s==="[^"){const c=zz(t,s,i);return{tokens:c.tokens,lastIndex:c.lastIndex}}if(a==="\\"){if("AbBGyYzZ".includes(o))return{token:mC(s,s)};if(/^\\g[<']/.test(s)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(s))throw new Error(`Invalid group name "${s}"`);return{token:Yz(s)}}if(/^\\k[<']/.test(s)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(s))throw new Error(`Invalid group name "${s}"`);return{token:oT(s)}}if(o==="K")return{token:lT("keep",s)};if(o==="N"||o==="R")return{token:na("newline",s,{negate:o==="N"})};if(o==="O")return{token:na("any",s)};if(o==="X")return{token:na("text_segment",s)};const c=aT(s,{inCharClass:!1});return Array.isArray(c)?{tokens:c}:{token:c}}if(a==="("){if(o==="*")return{token:Jz(s)};if(s==="(?{")throw new Error(`Unsupported callout "${s}"`);if(s.startsWith("(?#")){if(t[i]!==")")throw new Error('Unclosed comment group "(?#"');return{lastIndex:i+1}}if(/^\(\?[-imx]+[:)]$/.test(s))return{token:Zz(s,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,s==="("&&!e.captureGroup||s==="(?:")return{token:bo("group",s)};if(s==="(?>")return{token:bo("atomic",s)};if(s==="(?="||s==="(?!"||s==="(?<="||s==="(?<!")return{token:bo(s[2]==="<"?"lookbehind":"lookahead",s,{negate:s.endsWith("!")})};if(s==="("&&e.captureGroup||s.startsWith("(?<")&&s.endsWith(">")||s.startsWith("(?'")&&s.endsWith("'"))return{token:bo("capturing",s,{...s!=="("&&{name:s.slice(3,-1)}})};if(s.startsWith("(?~")){if(s==="(?~|")throw new Error(`Unsupported absence function kind "${s}"`);return{token:bo("absence_repeater",s)}}throw s==="(?("?new Error(`Unsupported conditional "${s}"`):new Error(`Invalid or unsupported group option "${s}"`)}if(s===")"){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw new Error('Unmatched ")"');return{token:Gz(s)}}if(e.getCurrentModX()){if(s==="#"){const c=t.indexOf(`
|
|
262
|
+
`,i);return{lastIndex:c===-1?t.length:c}}if(/^\s$/.test(s)){const c=/\s+/y;return c.lastIndex=i,{lastIndex:c.exec(t)?c.lastIndex:i}}}if(s===".")return{token:na("dot",s)};if(s==="^"||s==="$"){const c=e.singleline?{"^":ts`\A`,$:ts`\Z`}[s]:s;return{token:mC(c,s)}}return s==="|"?{token:Uz(s)}:Lv.test(s)?{tokens:r8(s)}:{token:kn(Go(s),s)}}function zz(e,t,s){const i=[gC(t[1]==="^",t)];let a=1,o;for(Xm.lastIndex=s;o=Xm.exec(e);){const c=o[0];if(c[0]==="["&&c[1]!==":")a++,i.push(gC(c[1]==="^",c));else if(c==="]"){if(i.at(-1).type==="CharacterClassOpen")i.push(kn(93,c));else if(a--,i.push(Fz(c)),!a)break}else{const d=Hz(c);Array.isArray(d)?i.push(...d):i.push(d)}}return{tokens:i,lastIndex:Xm.lastIndex||e.length}}function Hz(e){if(e[0]==="\\")return aT(e,{inCharClass:!0});if(e[0]==="["){const t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!Dv.has(t.groups.name))throw new Error(`Invalid POSIX class "${e}"`);return na("posix",e,{value:t.groups.name,negate:!!t.groups.negate})}return e==="-"?$z(e):e==="&&"?Vz(e):kn(Go(e),e)}function aT(e,{inCharClass:t}){const s=e[1];if(s==="c"||s==="C")return Qz(e);if("dDhHsSwW".includes(s))return e8(e);if(e.startsWith(ts`\o{`))throw new Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(e.length===3)throw new Error(`Incomplete or invalid Unicode property "${e}"`);return t8(e)}if(new RegExp("^\\\\x[89A-Fa-f]\\p{AHex}","u").test(e))try{const i=e.split(/\\x/).slice(1).map(c=>parseInt(c,16)),a=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(i)),o=new TextEncoder;return[...a].map(c=>{const d=[...o.encode(c)].map(f=>`\\x${f.toString(16)}`).join("");return kn(Go(c),d)})}catch{throw new Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(s==="u"||s==="x")return kn(i8(e),e);if(_C.has(s))return kn(_C.get(s),e);if(/\d/.test(s))return Wz(t,e);if(e==="\\")throw new Error(ts`Incomplete escape "\"`);if(s==="M")throw new Error(`Unsupported meta "${e}"`);if([...e].length===2)return kn(e.codePointAt(1),e);throw new Error(`Unexpected escape "${e}"`)}function Uz(e){return{type:"Alternator",raw:e}}function mC(e,t){return{type:"Assertion",kind:e,raw:t}}function oT(e){return{type:"Backreference",raw:e}}function kn(e,t){return{type:"Character",value:e,raw:t}}function Fz(e){return{type:"CharacterClassClose",raw:e}}function $z(e){return{type:"CharacterClassHyphen",raw:e}}function Vz(e){return{type:"CharacterClassIntersector",raw:e}}function gC(e,t){return{type:"CharacterClassOpen",negate:e,raw:t}}function na(e,t,s={}){return{type:"CharacterSet",kind:e,...s,raw:t}}function lT(e,t,s={}){return e==="keep"?{type:"Directive",kind:e,raw:t}:{type:"Directive",kind:e,flags:qo(s.flags),raw:t}}function Wz(e,t){return{type:"EscapedNumber",inCharClass:e,raw:t}}function Gz(e){return{type:"GroupClose",raw:e}}function bo(e,t,s={}){return{type:"GroupOpen",kind:e,...s,raw:t}}function qz(e,t,s,i){return{type:"NamedCallout",kind:e,tag:t,arguments:s,raw:i}}function Kz(e,t,s,i){return{type:"Quantifier",kind:e,min:t,max:s,raw:i}}function Yz(e){return{type:"Subroutine",raw:e}}const Xz=new Set(["COUNT","CMP","ERROR","FAIL","MAX","MISMATCH","SKIP","TOTAL_COUNT"]),_C=new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]);function Qz(e){const t=e[1]==="c"?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw new Error(`Unsupported control character "${e}"`);return kn(Go(t.toUpperCase())-64,e)}function Zz(e,t){let{on:s,off:i}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;i??(i="");const a=(t.getCurrentModX()||s.includes("x"))&&!i.includes("x"),o=yC(s),c=yC(i),d={};if(o&&(d.enable=o),c&&(d.disable=c),e.endsWith(")"))return t.replaceCurrentModX(a),lT("flags",e,{flags:d});if(e.endsWith(":"))return t.pushModX(a),t.numOpenGroups++,bo("group",e,{...(o||c)&&{flags:d}});throw new Error(`Unexpected flag modifier "${e}"`)}function Jz(e){const t=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);if(!t)throw new Error(`Incomplete or invalid named callout "${e}"`);const{name:s,tag:i,args:a}=t.groups;if(!s)throw new Error(`Invalid named callout "${e}"`);if(i==="")throw new Error(`Named callout tag with empty value not allowed "${e}"`);const o=a?a.split(",").filter(g=>g!=="").map(g=>/^[+-]?\d+$/.test(g)?+g:g):[],[c,d,f]=o,h=Xz.has(s)?s.toLowerCase():"custom";switch(h){case"fail":case"mismatch":case"skip":if(o.length>0)throw new Error(`Named callout arguments not allowed "${o}"`);break;case"error":if(o.length>1)throw new Error(`Named callout allows only one argument "${o}"`);if(typeof c=="string")throw new Error(`Named callout argument must be a number "${c}"`);break;case"max":if(!o.length||o.length>2)throw new Error(`Named callout must have one or two arguments "${o}"`);if(typeof c=="string"&&!/^[A-Za-z_]\w*$/.test(c))throw new Error(`Named callout argument one must be a tag or number "${c}"`);if(o.length===2&&(typeof d=="number"||!/^[<>X]$/.test(d)))throw new Error(`Named callout optional argument two must be '<', '>', or 'X' "${d}"`);break;case"count":case"total_count":if(o.length>1)throw new Error(`Named callout allows only one argument "${o}"`);if(o.length===1&&(typeof c=="number"||!/^[<>X]$/.test(c)))throw new Error(`Named callout optional argument must be '<', '>', or 'X' "${c}"`);break;case"cmp":if(o.length!==3)throw new Error(`Named callout must have three arguments "${o}"`);if(typeof c=="string"&&!/^[A-Za-z_]\w*$/.test(c))throw new Error(`Named callout argument one must be a tag or number "${c}"`);if(typeof d=="number"||!/^(?:[<>!=]=|[<>])$/.test(d))throw new Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${d}"`);if(typeof f=="string"&&!/^[A-Za-z_]\w*$/.test(f))throw new Error(`Named callout argument three must be a tag or number "${f}"`);break;case"custom":throw new Error(`Undefined callout name "${s}"`);default:throw new Error(`Unexpected named callout kind "${h}"`)}return qz(h,i??null,(a==null?void 0:a.split(","))??null,e)}function vC(e){let t=null,s,i;if(e[0]==="{"){const{minStr:a,maxStr:o}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(e).groups,c=1e5;if(+a>c||o&&+o>c)throw new Error("Quantifier value unsupported in Oniguruma");if(s=+a,i=o===void 0?+a:o===""?1/0:+o,s>i&&(t="possessive",[s,i]=[i,s]),e.endsWith("?")){if(t==="possessive")throw new Error('Unsupported possessive interval quantifier chain with "?"');t="lazy"}else t||(t="greedy")}else s=e[0]==="+"?1:0,i=e[0]==="?"?1:1/0,t=e[1]==="+"?"possessive":e[1]==="?"?"lazy":"greedy";return Kz(t,s,i,e)}function e8(e){const t=e[1].toLowerCase();return na({d:"digit",h:"hex",s:"space",w:"word"}[t],e,{negate:e[1]!==t})}function t8(e){const{p:t,neg:s,value:i}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(e).groups;return na("property",e,{value:i,negate:t==="P"&&!s||t==="p"&&!!s})}function yC(e){const t={};return e.includes("i")&&(t.ignoreCase=!0),e.includes("m")&&(t.dotAll=!0),e.includes("x")&&(t.extended=!0),Object.keys(t).length?t:null}function s8(e){const t={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let s=0;s<e.length;s++){const i=e[s];if(!"imxDPSWy".includes(i))throw new Error(`Invalid flag "${i}"`);if(i==="y"){if(!/^y{[gw]}/.test(e.slice(s)))throw new Error('Invalid or unspecified flag "y" mode');t.textSegmentMode=e[s+2]==="g"?"grapheme":"word",s+=3;continue}t[{i:"ignoreCase",m:"dotAll",x:"extended",D:"digitIsAscii",P:"posixIsAscii",S:"spaceIsAscii",W:"wordIsAscii"}[i]]=!0}return t}function i8(e){if(new RegExp("^(?:\\\\u(?!\\p{AHex}{4})|\\\\x(?!\\p{AHex}{1,2}|\\{\\p{AHex}{1,8}\\}))","u").test(e))throw new Error(`Incomplete or invalid escape "${e}"`);const t=e[2]==="{"?new RegExp("^\\\\x\\{\\s*(?<hex>\\p{AHex}+)","u").exec(e).groups.hex:e.slice(2);return parseInt(t,16)}function n8(e,t){const{raw:s,inCharClass:i}=e,a=s.slice(1);if(!i&&(a!=="0"&&a.length===1||a[0]!=="0"&&+a<=t))return[oT(s)];const o=[],c=a.match(/^[0-7]+|\d/g);for(let d=0;d<c.length;d++){const f=c[d];let h;if(d===0&&f!=="8"&&f!=="9"){if(h=parseInt(f,8),h>127)throw new Error(ts`Octal encoded byte above 177 unsupported "${s}"`)}else h=Go(f);o.push(kn(h,(d===0?"\\":"")+f))}return o}function r8(e){const t=[],s=new RegExp(Lv,"gy");let i;for(;i=s.exec(e);){const a=i[0];if(a[0]==="{"){const o=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(a);if(o){const{min:c,max:d}=o.groups;if(+c>+d&&a.endsWith("?")){s.lastIndex--,t.push(vC(a.slice(0,-1)));continue}}}t.push(vC(a))}return t}function cT(e,t){if(!Array.isArray(e.body))throw new Error("Expected node with body array");if(e.body.length!==1)return!1;const s=e.body[0];return!t||Object.keys(t).every(i=>t[i]===s[i])}function a8(e){return o8.has(e.type)}const o8=new Set(["AbsenceFunction","Backreference","CapturingGroup","Character","CharacterClass","CharacterSet","Group","Quantifier","Subroutine"]);function uT(e,t={}){const s={flags:"",normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},i=Bz(e,{flags:s.flags,rules:{captureGroup:s.rules.captureGroup,singleline:s.rules.singleline}}),a=(y,b)=>{const S=i.tokens[o.nextIndex];switch(o.parent=y,o.nextIndex++,S.type){case"Alternator":return Sa();case"Assertion":return l8(S);case"Backreference":return c8(S,o);case"Character":return Id(S.value,{useLastValid:!!b.isCheckingRangeEnd});case"CharacterClassHyphen":return u8(S,o,b);case"CharacterClassOpen":return h8(S,o,b);case"CharacterSet":return d8(S,o);case"Directive":return v8(S.kind,{flags:S.flags});case"GroupOpen":return f8(S,o,b);case"NamedCallout":return b8(S.kind,S.tag,S.arguments);case"Quantifier":return p8(S,o);case"Subroutine":return m8(S,o);default:throw new Error(`Unexpected token type "${S.type}"`)}},o={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:new Map,nextIndex:0,normalizeUnknownPropertyNames:s.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:s.skipBackrefValidation,skipLookbehindValidation:s.skipLookbehindValidation,skipPropertyNameValidation:s.skipPropertyNameValidation,subroutines:[],tokens:i.tokens,unicodePropertyMap:s.unicodePropertyMap,walk:a},c=w8(y8(i.flags));let d=c.body[0];for(;o.nextIndex<i.tokens.length;){const y=a(d,{});y.type==="Alternative"?(c.body.push(y),d=y):d.body.push(y)}const{capturingGroups:f,hasNumberedRef:h,namedGroupsByName:g,subroutines:_}=o;if(h&&g.size&&!s.rules.captureGroup)throw new Error("Numbered backref/subroutine not allowed when using named capture");for(const{ref:y}of _)if(typeof y=="number"){if(y>f.length)throw new Error("Subroutine uses a group number that's not defined");y&&(f[y-1].isSubroutined=!0)}else if(g.has(y)){if(g.get(y).length>1)throw new Error(ts`Subroutine uses a duplicate group name "\g<${y}>"`);g.get(y)[0].isSubroutined=!0}else throw new Error(ts`Subroutine uses a group name that's not defined "\g<${y}>"`);return c}function l8({kind:e}){return D_(qo({"^":"line_start",$:"line_end","\\A":"string_start","\\b":"word_boundary","\\B":"word_boundary","\\G":"search_start","\\y":"text_segment_boundary","\\Y":"text_segment_boundary","\\z":"string_end","\\Z":"string_end_newline"}[e],`Unexpected assertion kind "${e}"`),{negate:e===ts`\B`||e===ts`\Y`})}function c8({raw:e},t){const s=/^\\k[<']/.test(e),i=s?e.slice(3,-1):e.slice(1),a=(o,c=!1)=>{const d=t.capturingGroups.length;let f=!1;if(o>d)if(t.skipBackrefValidation)f=!0;else throw new Error(`Not enough capturing groups defined to the left "${e}"`);return t.hasNumberedRef=!0,L_(c?d+1-o:o,{orphan:f})};if(s){const o=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(i);if(o)return a(+o.groups.num,!!o.groups.sign);if(/[-+]/.test(i))throw new Error(`Invalid backref name "${e}"`);if(!t.namedGroupsByName.has(i))throw new Error(`Group name not defined to the left "${e}"`);return L_(i)}return a(+i)}function u8(e,t,s){const{tokens:i,walk:a}=t,o=t.parent,c=o.body.at(-1),d=i[t.nextIndex];if(!s.isCheckingRangeEnd&&c&&c.type!=="CharacterClass"&&c.type!=="CharacterClassRange"&&d&&d.type!=="CharacterClassOpen"&&d.type!=="CharacterClassClose"&&d.type!=="CharacterClassIntersector"){const f=a(o,{...s,isCheckingRangeEnd:!0});if(c.type==="Character"&&f.type==="Character")return o.body.pop(),_8(c,f);throw new Error("Invalid character class range")}return Id(Go("-"))}function h8({negate:e},t,s){const{tokens:i,walk:a}=t,o=i[t.nextIndex],c=[Wh()];let d=wC(o);for(;d.type!=="CharacterClassClose";){if(d.type==="CharacterClassIntersector")c.push(Wh()),t.nextIndex++;else{const h=c.at(-1);h.body.push(a(h,s))}d=wC(i[t.nextIndex],o)}const f=Wh({negate:e});return c.length===1?f.body=c[0].body:(f.kind="intersection",f.body=c.map(h=>h.body.length===1?h.body[0]:h)),t.nextIndex++,f}function d8({kind:e,negate:t,value:s},i){const{normalizeUnknownPropertyNames:a,skipPropertyNameValidation:o,unicodePropertyMap:c}=i;if(e==="property"){const d=zd(s);if(Dv.has(d)&&!(c!=null&&c.has(d)))e="posix",s=d;else return So(s,{negate:t,normalizeUnknownPropertyNames:a,skipPropertyNameValidation:o,unicodePropertyMap:c})}return e==="posix"?S8(s,{negate:t}):M_(e,{negate:t})}function f8(e,t,s){const{tokens:i,capturingGroups:a,namedGroupsByName:o,skipLookbehindValidation:c,walk:d}=t,f=C8(e),h=f.type==="AbsenceFunction",g=SC(f),_=g&&f.negate;if(f.type==="CapturingGroup"&&(a.push(f),f.name&&Pz(o,f.name,[]).push(f)),h&&s.isInAbsenceFunction)throw new Error("Nested absence function not supported by Oniguruma");let y=CC(i[t.nextIndex]);for(;y.type!=="GroupClose";){if(y.type==="Alternator")f.body.push(Sa()),t.nextIndex++;else{const b=f.body.at(-1),S=d(b,{...s,isInAbsenceFunction:s.isInAbsenceFunction||h,isInLookbehind:s.isInLookbehind||g,isInNegLookbehind:s.isInNegLookbehind||_});if(b.body.push(S),(g||s.isInLookbehind)&&!c){const w="Lookbehind includes a pattern not allowed by Oniguruma";if(_||s.isInNegLookbehind){if(bC(S)||S.type==="CapturingGroup")throw new Error(w)}else if(bC(S)||SC(S)&&S.negate)throw new Error(w)}}y=CC(i[t.nextIndex])}return t.nextIndex++,f}function p8({kind:e,min:t,max:s},i){const a=i.parent,o=a.body.at(-1);if(!o||!a8(o))throw new Error("Quantifier requires a repeatable token");const c=dT(e,t,s,o);return a.body.pop(),c}function m8({raw:e},t){const{capturingGroups:s,subroutines:i}=t;let a=e.slice(3,-1);const o=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(a);if(o){const d=+o.groups.num,f=s.length;if(t.hasNumberedRef=!0,a={"":d,"+":f+d,"-":f+1-d}[o.groups.sign],a<1)throw new Error("Invalid subroutine number")}else a==="0"&&(a=0);const c=fT(a);return i.push(c),c}function g8(e,t){return{type:"AbsenceFunction",kind:e,body:Fc(t==null?void 0:t.body)}}function Sa(e){return{type:"Alternative",body:pT(e==null?void 0:e.body)}}function D_(e,t){const s={type:"Assertion",kind:e};return(e==="word_boundary"||e==="text_segment_boundary")&&(s.negate=!!(t!=null&&t.negate)),s}function L_(e,t){const s=!!(t!=null&&t.orphan);return{type:"Backreference",ref:e,...s&&{orphan:s}}}function hT(e,t){const s={name:void 0,isSubroutined:!1,...t};if(s.name!==void 0&&!x8(s.name))throw new Error(`Group name "${s.name}" invalid in Oniguruma`);return{type:"CapturingGroup",number:e,...s.name&&{name:s.name},...s.isSubroutined&&{isSubroutined:s.isSubroutined},body:Fc(t==null?void 0:t.body)}}function Id(e,t){const s={useLastValid:!1,...t};if(e>1114111){const i=e.toString(16);if(s.useLastValid)e=1114111;else throw e>1310719?new Error(`Invalid code point out of range "\\x{${i}}"`):new Error(`Invalid code point out of range in JS "\\x{${i}}"`)}return{type:"Character",value:e}}function Wh(e){const t={kind:"union",negate:!1,...e};return{type:"CharacterClass",kind:t.kind,negate:t.negate,body:pT(e==null?void 0:e.body)}}function _8(e,t){if(t.value<e.value)throw new Error("Character class range out of order");return{type:"CharacterClassRange",min:e,max:t}}function M_(e,t){const s=!!(t!=null&&t.negate),i={type:"CharacterSet",kind:e};return(e==="digit"||e==="hex"||e==="newline"||e==="space"||e==="word")&&(i.negate=s),(e==="text_segment"||e==="newline"&&!s)&&(i.variableLength=!0),i}function v8(e,t={}){if(e==="keep")return{type:"Directive",kind:e};if(e==="flags")return{type:"Directive",kind:e,flags:qo(t.flags)};throw new Error(`Unexpected directive kind "${e}"`)}function y8(e){return{type:"Flags",...e}}function xi(e){const t=e==null?void 0:e.atomic,s=e==null?void 0:e.flags;if(t&&s)throw new Error("Atomic group cannot have flags");return{type:"Group",...t&&{atomic:t},...s&&{flags:s},body:Fc(e==null?void 0:e.body)}}function Qr(e){const t={behind:!1,negate:!1,...e};return{type:"LookaroundAssertion",kind:t.behind?"lookbehind":"lookahead",negate:t.negate,body:Fc(e==null?void 0:e.body)}}function b8(e,t,s){return{type:"NamedCallout",kind:e,tag:t,arguments:s}}function S8(e,t){const s=!!(t!=null&&t.negate);if(!Dv.has(e))throw new Error(`Invalid POSIX class "${e}"`);return{type:"CharacterSet",kind:"posix",value:e,negate:s}}function dT(e,t,s,i){if(t>s)throw new Error("Invalid reversed quantifier range");return{type:"Quantifier",kind:e,min:t,max:s,body:i}}function w8(e,t){return{type:"Regex",body:Fc(t==null?void 0:t.body),flags:e}}function fT(e){return{type:"Subroutine",ref:e}}function So(e,t){var a;const s={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t};let i=(a=s.unicodePropertyMap)==null?void 0:a.get(zd(e));if(!i){if(s.normalizeUnknownPropertyNames)i=k8(e);else if(s.unicodePropertyMap&&!s.skipPropertyNameValidation)throw new Error(ts`Invalid Unicode property "\p{${e}}"`)}return{type:"CharacterSet",kind:"property",value:i??e,negate:s.negate}}function C8({flags:e,kind:t,name:s,negate:i,number:a}){switch(t){case"absence_repeater":return g8("repeater");case"atomic":return xi({atomic:!0});case"capturing":return hT(a,{name:s});case"group":return xi({flags:e});case"lookahead":case"lookbehind":return Qr({behind:t==="lookbehind",negate:i});default:throw new Error(`Unexpected group kind "${t}"`)}}function Fc(e){if(e===void 0)e=[Sa()];else if(!Array.isArray(e)||!e.length||!e.every(t=>t.type==="Alternative"))throw new Error("Invalid body; expected array of one or more Alternative nodes");return e}function pT(e){if(e===void 0)e=[];else if(!Array.isArray(e)||!e.every(t=>!!t.type))throw new Error("Invalid body; expected array of nodes");return e}function bC(e){return e.type==="LookaroundAssertion"&&e.kind==="lookahead"}function SC(e){return e.type==="LookaroundAssertion"&&e.kind==="lookbehind"}function x8(e){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(e)}function k8(e){return e.trim().replace(/[- _]+/g,"_").replace(/[A-Z][a-z]+(?=[A-Z])/g,"$&_").replace(/[A-Za-z]+/g,t=>t[0].toUpperCase()+t.slice(1).toLowerCase())}function zd(e){return e.replace(/[- _]+/g,"").toLowerCase()}function wC(e,t){return qo(e,`${(t==null?void 0:t.type)==="Character"&&t.value===93?"Empty":"Unclosed"} character class`)}function CC(e){return qo(e,"Unclosed group")}function mc(e,t,s=null){function i(o,c){for(let d=0;d<o.length;d++){const f=a(o[d],c,d,o);d=Math.max(-1,d+f)}}function a(o,c=null,d=null,f=null){var T,D;let h=0,g=!1;const _={node:o,parent:c,key:d,container:f,root:e,remove(){Th(f).splice(Math.max(0,_o(d)+h),1),h--,g=!0},removeAllNextSiblings(){return Th(f).splice(_o(d)+1)},removeAllPrevSiblings(){const N=_o(d)+h;return h-=N,Th(f).splice(0,Math.max(0,N))},replaceWith(N,E={}){const M=!!E.traverse;f?f[Math.max(0,_o(d)+h)]=N:qo(c,"Can't replace root node")[d]=N,M&&a(N,c,d,f),g=!0},replaceWithMultiple(N,E={}){const M=!!E.traverse;if(Th(f).splice(Math.max(0,_o(d)+h),1,...N),h+=N.length-1,M){let U=0;for(let W=0;W<N.length;W++)U+=a(N[W],c,_o(d)+W+U,f)}g=!0},skip(){g=!0}},{type:y}=o,b=t["*"],S=t[y],w=typeof b=="function"?b:b==null?void 0:b.enter,k=typeof S=="function"?S:S==null?void 0:S.enter;if(w==null||w(_,s),k==null||k(_,s),!g)switch(y){case"AbsenceFunction":case"CapturingGroup":case"Group":i(o.body,o);break;case"Alternative":case"CharacterClass":i(o.body,o);break;case"Assertion":case"Backreference":case"Character":case"CharacterSet":case"Directive":case"Flags":case"NamedCallout":case"Subroutine":break;case"CharacterClassRange":a(o.min,o,"min"),a(o.max,o,"max");break;case"LookaroundAssertion":i(o.body,o);break;case"Quantifier":a(o.body,o,"body");break;case"Regex":i(o.body,o),a(o.flags,o,"flags");break;default:throw new Error(`Unexpected node type "${y}"`)}return(T=S==null?void 0:S.exit)==null||T.call(S,_,s),(D=b==null?void 0:b.exit)==null||D.call(b,_,s),h}return a(e),e}function Th(e){if(!Array.isArray(e))throw new Error("Container expected");return e}function _o(e){if(typeof e!="number")throw new Error("Numeric key expected");return e}const E8=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function T8(e,t){for(let s=0;s<e.length;s++)e[s]>=t&&e[s]++}function N8(e,t,s,i){return e.slice(0,t)+i+e.slice(t+s.length)}const pi=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function Mv(e,t,s,i){const a=new RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,"gsu"),o=[!1];let c=0,d="";for(const f of e.matchAll(a)){const{0:h,groups:{$skip:g}}=f;if(!g&&(!i||i===pi.DEFAULT==!c)){s instanceof Function?d+=s(f,{context:c?pi.CHAR_CLASS:pi.DEFAULT,negated:o[o.length-1]}):d+=s;continue}h[0]==="["?(c++,o.push(h[1]==="^")):h==="]"&&c&&(c--,o.pop()),d+=h}return d}function mT(e,t,s,i){Mv(e,t,s,i)}function A8(e,t,s=0,i){if(!new RegExp(t,"su").test(e))return null;const a=new RegExp(`${t}|(?<$skip>\\\\?.)`,"gsu");a.lastIndex=s;let o=0,c;for(;c=a.exec(e);){const{0:d,groups:{$skip:f}}=c;if(!f&&(!i||i===pi.DEFAULT==!o))return c;d==="["?o++:d==="]"&&o&&o--,a.lastIndex==c.index&&a.lastIndex++}return null}function Nh(e,t,s){return!!A8(e,t,0,s)}function R8(e,t){const s=/\\?./gsu;s.lastIndex=t;let i=e.length,a=0,o=1,c;for(;c=s.exec(e);){const[d]=c;if(d==="[")a++;else if(a)d==="]"&&a--;else if(d==="(")o++;else if(d===")"&&(o--,!o)){i=c.index;break}}return e.slice(t,i)}const xC=new RegExp(String.raw`(?<noncapturingStart>${E8})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu");function D8(e,t){const s=(t==null?void 0:t.hiddenCaptures)??[];let i=(t==null?void 0:t.captureTransfers)??new Map;if(!/\(\?>/.test(e))return{pattern:e,captureTransfers:i,hiddenCaptures:s};const a="(?>",o="(?:(?=(",c=[0],d=[];let f=0,h=0,g=NaN,_;do{_=!1;let y=0,b=0,S=!1,w;for(xC.lastIndex=Number.isNaN(g)?0:g+o.length;w=xC.exec(e);){const{0:k,index:T,groups:{capturingStart:D,noncapturingStart:N}}=w;if(k==="[")y++;else if(y)k==="]"&&y--;else if(k===a&&!S)g=T,S=!0;else if(S&&N)b++;else if(D)S?b++:(f++,c.push(f+h));else if(k===")"&&S){if(!b){h++;const E=f+h;if(e=`${e.slice(0,g)}${o}${e.slice(g+a.length,T)}))<$$${E}>)${e.slice(T+1)}`,_=!0,d.push(E),T8(s,E),i.size){const M=new Map;i.forEach((U,W)=>{M.set(W>=E?W+1:W,U.map(B=>B>=E?B+1:B))}),i=M}break}b--}}}while(_);return s.push(...d),e=Mv(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:y,groups:{backrefNum:b,wrappedBackrefNum:S}})=>{if(b){const w=+b;if(w>c.length-1)throw new Error(`Backref "${y}" greater than number of captures`);return`\\${c[w]}`}return`\\${S}`},pi.DEFAULT),{pattern:e,captureTransfers:i,hiddenCaptures:s}}const gT=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,Qm=new RegExp(String.raw`
|
|
263
|
+
\\(?: \d+
|
|
264
|
+
| c[A-Za-z]
|
|
265
|
+
| [gk]<[^>]+>
|
|
266
|
+
| [pPu]\{[^\}]+\}
|
|
267
|
+
| u[A-Fa-f\d]{4}
|
|
268
|
+
| x[A-Fa-f\d]{2}
|
|
269
|
+
)
|
|
270
|
+
| \((?: \? (?: [:=!>]
|
|
271
|
+
| <(?:[=!]|[^>]+>)
|
|
272
|
+
| [A-Za-z\-]+:
|
|
273
|
+
| \(DEFINE\)
|
|
274
|
+
))?
|
|
275
|
+
| (?<qBase>${gT})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
|
|
276
|
+
| \\?.
|
|
277
|
+
`.replace(/\s+/g,""),"gsu");function L8(e){if(!new RegExp(`${gT}\\+`).test(e))return{pattern:e};const t=[];let s=null,i=null,a="",o=0,c;for(Qm.lastIndex=0;c=Qm.exec(e);){const{0:d,index:f,groups:{qBase:h,qMod:g,invalidQ:_}}=c;if(d==="[")o||(i=f),o++;else if(d==="]")o?o--:i=null;else if(!o)if(g==="+"&&a&&!a.startsWith("(")){if(_)throw new Error(`Invalid quantifier "${d}"`);let y=-1;if(/^\{\d+\}$/.test(h))e=N8(e,f+h.length,g,"");else{if(a===")"||a==="]"){const b=a===")"?s:i;if(b===null)throw new Error(`Invalid unmatched "${a}"`);e=`${e.slice(0,b)}(?>${e.slice(b,f)}${h})${e.slice(f+d.length)}`}else e=`${e.slice(0,f-a.length)}(?>${a}${h})${e.slice(f+d.length)}`;y+=4}Qm.lastIndex+=y}else d[0]==="("?t.push(f):d===")"&&(s=t.length?t.pop():null);a=d}return{pattern:e}}const fi=String.raw,M8=fi`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,O_=fi`\(\?R=(?<rDepth>[^\)]+)\)|${M8}`,Hd=fi`\(\?<(?![=!])(?<captureName>[^>]+)>`,_T=fi`${Hd}|(?<unnamed>\()(?!\?)`,Gr=new RegExp(fi`${Hd}|${O_}|\(\?|\\?.`,"gsu"),Zm="Cannot use multiple overlapping recursions";function O8(e,t){const{hiddenCaptures:s,mode:i}={hiddenCaptures:[],mode:"plugin",...t};let a=(t==null?void 0:t.captureTransfers)??new Map;if(!new RegExp(O_,"su").test(e))return{pattern:e,captureTransfers:a,hiddenCaptures:s};if(i==="plugin"&&Nh(e,fi`\(\?\(DEFINE\)`,pi.DEFAULT))throw new Error("DEFINE groups cannot be used with recursion");const o=[],c=Nh(e,fi`\\[1-9]`,pi.DEFAULT),d=new Map,f=[];let h=!1,g=0,_=0,y;for(Gr.lastIndex=0;y=Gr.exec(e);){const{0:b,groups:{captureName:S,rDepth:w,gRNameOrNum:k,gRDepth:T}}=y;if(b==="[")g++;else if(g)b==="]"&&g--;else if(w){if(kC(w),h)throw new Error(Zm);if(c)throw new Error(`${i==="external"?"Backrefs":"Numbered backrefs"} cannot be used with global recursion`);const D=e.slice(0,y.index),N=e.slice(Gr.lastIndex);if(Nh(N,O_,pi.DEFAULT))throw new Error(Zm);const E=+w-1;e=EC(D,N,E,!1,s,o,_),a=NC(a,D,E,o.length,0,_);break}else if(k){kC(T);let D=!1;for(const X of f)if(X.name===k||X.num===+k){if(D=!0,X.hasRecursedWithin)throw new Error(Zm);break}if(!D)throw new Error(fi`Recursive \g cannot be used outside the referenced group "${i==="external"?k:fi`\g<${k}&R=${T}>`}"`);const N=d.get(k),E=R8(e,N);if(c&&Nh(E,fi`${Hd}|\((?!\?)`,pi.DEFAULT))throw new Error(`${i==="external"?"Backrefs":"Numbered backrefs"} cannot be used with recursion of capturing groups`);const M=e.slice(N,y.index),U=E.slice(M.length+b.length),W=o.length,B=+T-1,$=EC(M,U,B,!0,s,o,_);a=NC(a,M,B,o.length-W,W,_);const Y=e.slice(0,N),K=e.slice(N+E.length);e=`${Y}${$}${K}`,Gr.lastIndex+=$.length-b.length-M.length-U.length,f.forEach(X=>X.hasRecursedWithin=!0),h=!0}else if(S)_++,d.set(String(_),Gr.lastIndex),d.set(S,Gr.lastIndex),f.push({num:_,name:S});else if(b[0]==="("){const D=b==="(";D&&(_++,d.set(String(_),Gr.lastIndex)),f.push(D?{num:_}:{})}else b===")"&&f.pop()}return s.push(...o),{pattern:e,captureTransfers:a,hiddenCaptures:s}}function kC(e){const t=`Max depth must be integer between 2 and 100; used ${e}`;if(!/^[1-9]\d*$/.test(e))throw new Error(t);if(e=+e,e<2||e>100)throw new Error(t)}function EC(e,t,s,i,a,o,c){const d=new Set;i&&mT(e+t,Hd,({groups:{captureName:h}})=>{d.add(h)},pi.DEFAULT);const f=[s,i?d:null,a,o,c];return`${e}${TC(`(?:${e}`,"forward",...f)}(?:)${TC(`${t})`,"backward",...f)}${t}`}function TC(e,t,s,i,a,o,c){const f=g=>t==="forward"?g+2:s-g+2-1;let h="";for(let g=0;g<s;g++){const _=f(g);h+=Mv(e,fi`${_T}|\\k<(?<backref>[^>]+)>`,({0:y,groups:{captureName:b,unnamed:S,backref:w}})=>{if(w&&i&&!i.has(w))return y;const k=`_$${_}`;if(S||b){const T=c+o.length+1;return o.push(T),j8(a,T),S?y:`(?<${b}${k}>`}return fi`\k<${w}${k}>`},pi.DEFAULT)}return h}function j8(e,t){for(let s=0;s<e.length;s++)e[s]>=t&&e[s]++}function NC(e,t,s,i,a,o){if(e.size&&i){let c=0;mT(t,_T,()=>c++,pi.DEFAULT);const d=o-c+a,f=new Map;return e.forEach((h,g)=>{const _=(i-c*s)/s,y=c*s,b=g>d+c?g+i:g,S=[];for(const w of h)if(w<=d)S.push(w);else if(w>d+c+_)S.push(w+i);else if(w<=d+c)for(let k=0;k<=s;k++)S.push(w+c*k);else for(let k=0;k<=s;k++)S.push(w+y+_*k);f.set(b,S)}),f}return e}var Ft=String.fromCodePoint,je=String.raw,ki={},Ud=globalThis.RegExp;ki.flagGroups=(()=>{try{new Ud("(?i:)")}catch{return!1}return!0})();ki.unicodeSets=(()=>{try{new Ud("[[]]","v")}catch{return!1}return!0})();ki.bugFlagVLiteralHyphenIsRange=ki.unicodeSets?(()=>{try{new Ud(je`[\d\-a]`,"v")}catch{return!0}return!1})():!1;ki.bugNestedClassIgnoresNegation=ki.unicodeSets&&new Ud("[[^a]]","v").test("a");function md(e,{enable:t,disable:s}){return{dotAll:!(s!=null&&s.dotAll)&&!!(t!=null&&t.dotAll||e.dotAll),ignoreCase:!(s!=null&&s.ignoreCase)&&!!(t!=null&&t.ignoreCase||e.ignoreCase)}}function Tc(e,t,s){return e.has(t)||e.set(t,s),e.get(t)}function j_(e,t){return AC[e]>=AC[t]}function P8(e,t){if(e==null)throw new Error(t??"Value expected");return e}var AC={ES2025:2025,ES2024:2024,ES2018:2018},B8={auto:"auto",ES2025:"ES2025",ES2024:"ES2024",ES2018:"ES2018"};function vT(e={}){if({}.toString.call(e)!=="[object Object]")throw new Error("Unexpected options");if(e.target!==void 0&&!B8[e.target])throw new Error(`Unexpected target "${e.target}"`);const t={accuracy:"default",avoidSubclass:!1,flags:"",global:!1,hasIndices:!1,lazyCompileLength:1/0,target:"auto",verbose:!1,...e,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...e.rules}};return t.target==="auto"&&(t.target=ki.flagGroups?"ES2025":ki.unicodeSets?"ES2024":"ES2018"),t}var I8="[ -\r ]",z8=new Set([Ft(304),Ft(305)]),gn=je`[\p{L}\p{M}\p{N}\p{Pc}]`;function yT(e){if(z8.has(e))return[e];const t=new Set,s=e.toLowerCase(),i=s.toUpperCase(),a=F8.get(s),o=H8.get(s),c=U8.get(s);return[...i].length===1&&t.add(i),c&&t.add(c),a&&t.add(a),t.add(s),o&&t.add(o),[...t]}var Ov=new Map(`C Other
|
|
278
|
+
Cc Control cntrl
|
|
279
|
+
Cf Format
|
|
280
|
+
Cn Unassigned
|
|
281
|
+
Co Private_Use
|
|
282
|
+
Cs Surrogate
|
|
283
|
+
L Letter
|
|
284
|
+
LC Cased_Letter
|
|
285
|
+
Ll Lowercase_Letter
|
|
286
|
+
Lm Modifier_Letter
|
|
287
|
+
Lo Other_Letter
|
|
288
|
+
Lt Titlecase_Letter
|
|
289
|
+
Lu Uppercase_Letter
|
|
290
|
+
M Mark Combining_Mark
|
|
291
|
+
Mc Spacing_Mark
|
|
292
|
+
Me Enclosing_Mark
|
|
293
|
+
Mn Nonspacing_Mark
|
|
294
|
+
N Number
|
|
295
|
+
Nd Decimal_Number digit
|
|
296
|
+
Nl Letter_Number
|
|
297
|
+
No Other_Number
|
|
298
|
+
P Punctuation punct
|
|
299
|
+
Pc Connector_Punctuation
|
|
300
|
+
Pd Dash_Punctuation
|
|
301
|
+
Pe Close_Punctuation
|
|
302
|
+
Pf Final_Punctuation
|
|
303
|
+
Pi Initial_Punctuation
|
|
304
|
+
Po Other_Punctuation
|
|
305
|
+
Ps Open_Punctuation
|
|
306
|
+
S Symbol
|
|
307
|
+
Sc Currency_Symbol
|
|
308
|
+
Sk Modifier_Symbol
|
|
309
|
+
Sm Math_Symbol
|
|
310
|
+
So Other_Symbol
|
|
311
|
+
Z Separator
|
|
312
|
+
Zl Line_Separator
|
|
313
|
+
Zp Paragraph_Separator
|
|
314
|
+
Zs Space_Separator
|
|
315
|
+
ASCII
|
|
316
|
+
ASCII_Hex_Digit AHex
|
|
317
|
+
Alphabetic Alpha
|
|
318
|
+
Any
|
|
319
|
+
Assigned
|
|
320
|
+
Bidi_Control Bidi_C
|
|
321
|
+
Bidi_Mirrored Bidi_M
|
|
322
|
+
Case_Ignorable CI
|
|
323
|
+
Cased
|
|
324
|
+
Changes_When_Casefolded CWCF
|
|
325
|
+
Changes_When_Casemapped CWCM
|
|
326
|
+
Changes_When_Lowercased CWL
|
|
327
|
+
Changes_When_NFKC_Casefolded CWKCF
|
|
328
|
+
Changes_When_Titlecased CWT
|
|
329
|
+
Changes_When_Uppercased CWU
|
|
330
|
+
Dash
|
|
331
|
+
Default_Ignorable_Code_Point DI
|
|
332
|
+
Deprecated Dep
|
|
333
|
+
Diacritic Dia
|
|
334
|
+
Emoji
|
|
335
|
+
Emoji_Component EComp
|
|
336
|
+
Emoji_Modifier EMod
|
|
337
|
+
Emoji_Modifier_Base EBase
|
|
338
|
+
Emoji_Presentation EPres
|
|
339
|
+
Extended_Pictographic ExtPict
|
|
340
|
+
Extender Ext
|
|
341
|
+
Grapheme_Base Gr_Base
|
|
342
|
+
Grapheme_Extend Gr_Ext
|
|
343
|
+
Hex_Digit Hex
|
|
344
|
+
IDS_Binary_Operator IDSB
|
|
345
|
+
IDS_Trinary_Operator IDST
|
|
346
|
+
ID_Continue IDC
|
|
347
|
+
ID_Start IDS
|
|
348
|
+
Ideographic Ideo
|
|
349
|
+
Join_Control Join_C
|
|
350
|
+
Logical_Order_Exception LOE
|
|
351
|
+
Lowercase Lower
|
|
352
|
+
Math
|
|
353
|
+
Noncharacter_Code_Point NChar
|
|
354
|
+
Pattern_Syntax Pat_Syn
|
|
355
|
+
Pattern_White_Space Pat_WS
|
|
356
|
+
Quotation_Mark QMark
|
|
357
|
+
Radical
|
|
358
|
+
Regional_Indicator RI
|
|
359
|
+
Sentence_Terminal STerm
|
|
360
|
+
Soft_Dotted SD
|
|
361
|
+
Terminal_Punctuation Term
|
|
362
|
+
Unified_Ideograph UIdeo
|
|
363
|
+
Uppercase Upper
|
|
364
|
+
Variation_Selector VS
|
|
365
|
+
White_Space space
|
|
366
|
+
XID_Continue XIDC
|
|
367
|
+
XID_Start XIDS`.split(/\s/).map(e=>[zd(e),e])),H8=new Map([["s",Ft(383)],[Ft(383),"s"]]),U8=new Map([[Ft(223),Ft(7838)],[Ft(107),Ft(8490)],[Ft(229),Ft(8491)],[Ft(969),Ft(8486)]]),F8=new Map([rr(453),rr(456),rr(459),rr(498),...Jm(8072,8079),...Jm(8088,8095),...Jm(8104,8111),rr(8124),rr(8140),rr(8188)]),$8=new Map([["alnum",je`[\p{Alpha}\p{Nd}]`],["alpha",je`\p{Alpha}`],["ascii",je`\p{ASCII}`],["blank",je`[\p{Zs}\t]`],["cntrl",je`\p{Cc}`],["digit",je`\p{Nd}`],["graph",je`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],["lower",je`\p{Lower}`],["print",je`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",je`[\p{P}\p{S}]`],["space",je`\p{space}`],["upper",je`\p{Upper}`],["word",je`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",je`\p{AHex}`]]);function V8(e,t){const s=[];for(let i=e;i<=t;i++)s.push(i);return s}function rr(e){const t=Ft(e);return[t.toLowerCase(),t]}function Jm(e,t){return V8(e,t).map(s=>rr(s))}var bT=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]);function W8(e,t){const s={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...t};ST(e);const i={accuracy:s.accuracy,asciiWordBoundaries:s.asciiWordBoundaries,avoidSubclass:s.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:j_(s.bestEffortTarget,"ES2024"),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};mc(e,G8,i);const a={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},o={currentFlags:a,prevFlags:null,globalFlags:a,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:i.subroutineRefMap};mc(e,q8,o);const c={groupsByName:o.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:o.reffedNodesByReferencer};return mc(e,K8,c),e._originMap=o.groupOriginByCopy,e._strategy=i.strategy,e}var G8={AbsenceFunction({node:e,parent:t,replaceWith:s}){const{body:i,kind:a}=e;if(a==="repeater"){const o=xi();o.body[0].body.push(Qr({negate:!0,body:i}),So("Any"));const c=xi();c.body[0].body.push(dT("greedy",0,1/0,o)),s(At(c,t),{traverse:!0})}else throw new Error('Unsupported absence function "(?~|"')},Alternative:{enter({node:e,parent:t,key:s},{flagDirectivesByAlt:i}){const a=e.body.filter(o=>o.kind==="flags");for(let o=s+1;o<t.body.length;o++){const c=t.body[o];Tc(i,c,[]).push(...a)}},exit({node:e},{flagDirectivesByAlt:t}){var s;if((s=t.get(e))!=null&&s.length){const i=CT(t.get(e));if(i){const a=xi({flags:i});a.body[0].body=e.body,e.body=[At(a,e)]}}}},Assertion({node:e,parent:t,key:s,container:i,root:a,remove:o,replaceWith:c},d){const{kind:f,negate:h}=e,{asciiWordBoundaries:g,avoidSubclass:_,supportedGNodes:y,wordIsAscii:b}=d;if(f==="text_segment_boundary")throw new Error(`Unsupported text segment boundary "\\${h?"Y":"y"}"`);if(f==="line_end")c(At(Qr({body:[Sa({body:[D_("string_end")]}),Sa({body:[Id(10)]})]}),t));else if(f==="line_start")c(At(_n(je`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if(f==="search_start")if(y.has(e))a.flags.sticky=!0,o();else{const S=i[s-1];if(S&&eH(S))c(At(Qr({negate:!0}),t));else{if(_)throw new Error(je`Uses "\G" in a way that requires a subclass`);c(ar(D_("string_start"),t)),d.strategy="clip_search"}}else if(!(f==="string_end"||f==="string_start"))if(f==="string_end_newline")c(At(_n(je`(?=\n?\z)`),t));else if(f==="word_boundary"){if(!b&&!g){const S=`(?:(?<=${gn})(?!${gn})|(?<!${gn})(?=${gn}))`,w=`(?:(?<=${gn})(?=${gn})|(?<!${gn})(?!${gn}))`;c(At(_n(h?w:S),t))}}else throw new Error(`Unexpected assertion kind "${f}"`)},Backreference({node:e},{jsGroupNameMap:t}){let{ref:s}=e;typeof s=="string"&&!tg(s)&&(s=eg(s,t),e.ref=s)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:s}){let{name:i}=e;i&&!tg(i)&&(i=eg(i,t),e.name=i),s.set(e.number,e),i&&s.set(i,e)},CharacterClassRange({node:e,parent:t,replaceWith:s}){if(t.kind==="intersection"){const i=Wh({body:[e]});s(At(i,t),{traverse:!0})}},CharacterSet({node:e,parent:t,replaceWith:s},{accuracy:i,minTargetEs2024:a,digitIsAscii:o,spaceIsAscii:c,wordIsAscii:d}){const{kind:f,negate:h,value:g}=e;if(o&&(f==="digit"||g==="digit")){s(ar(M_("digit",{negate:h}),t));return}if(c&&(f==="space"||g==="space")){s(At(sg(_n(I8),h),t));return}if(d&&(f==="word"||g==="word")){s(ar(M_("word",{negate:h}),t));return}if(f==="any")s(ar(So("Any"),t));else if(f==="digit")s(ar(So("Nd",{negate:h}),t));else if(f!=="dot")if(f==="text_segment"){if(i==="strict")throw new Error(je`Use of "\X" requires non-strict accuracy`);const _="\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?",y=je`\p{RI}{2}|${_}(?:\u200D${_})*`;s(At(_n(je`(?>\r\n|${a?je`\p{RGI_Emoji}`:y}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if(f==="hex")s(ar(So("AHex",{negate:h}),t));else if(f==="newline")s(At(_n(h?`[^
|
|
368
|
+
]`:`(?>\r
|
|
369
|
+
?|[
|
|
370
|
+
\v\f
\u2028\u2029])`),t));else if(f==="posix")if(!a&&(g==="graph"||g==="print")){if(i==="strict")throw new Error(`POSIX class "${g}" requires min target ES2024 or non-strict accuracy`);let _={graph:"!-~",print:" -~"}[g];h&&(_=`\0-${Ft(_.codePointAt(0)-1)}${Ft(_.codePointAt(2)+1)}-`),s(At(_n(`[${_}]`),t))}else s(At(sg(_n($8.get(g)),h),t));else if(f==="property")Ov.has(zd(g))||(e.key="sc");else if(f==="space")s(ar(So("space",{negate:h}),t));else if(f==="word")s(At(sg(_n(gn),h),t));else throw new Error(`Unexpected character set kind "${f}"`)},Directive({node:e,parent:t,root:s,remove:i,replaceWith:a,removeAllPrevSiblings:o,removeAllNextSiblings:c}){const{kind:d,flags:f}=e;if(d==="flags")if(!f.enable&&!f.disable)i();else{const h=xi({flags:f});h.body[0].body=c(),a(At(h,t),{traverse:!0})}else if(d==="keep"){const h=s.body[0],_=s.body.length===1&&cT(h,{type:"Group"})&&h.body[0].body.length===1?h.body[0]:s;if(t.parent!==_||_.body.length>1)throw new Error(je`Uses "\K" in a way that's unsupported`);const y=Qr({behind:!0});y.body[0].body=o(),a(At(y,t))}else throw new Error(`Unexpected directive kind "${d}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw new Error('Unsupported flag "P"');if(e.textSegmentMode==="word")throw new Error('Unsupported flag "y{w}"');["digitIsAscii","extended","posixIsAscii","spaceIsAscii","wordIsAscii","textSegmentMode"].forEach(s=>delete e[s]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;const{enable:t,disable:s}=e.flags;t!=null&&t.extended&&delete t.extended,s!=null&&s.extended&&delete s.extended,t!=null&&t.dotAll&&(s!=null&&s.dotAll)&&delete t.dotAll,t!=null&&t.ignoreCase&&(s!=null&&s.ignoreCase)&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,s&&!Object.keys(s).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){const{kind:s}=e;s==="lookbehind"&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:s}){const{kind:i}=e;if(i==="fail")s(At(Qr({negate:!0}),t));else throw new Error(`Unsupported named callout "(*${i.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type==="Quantifier"){const t=xi();t.body[0].body.push(e.body),e.body=At(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){const s=[];let i=!1,a=!1;for(const o of e.body)if(o.body.length===1&&o.body[0].kind==="search_start")o.body.pop();else{const c=kT(o.body);c?(i=!0,Array.isArray(c)?s.push(...c):s.push(c)):a=!0}i&&!a&&s.forEach(o=>t.add(o))},exit(e,{accuracy:t,passedLookbehind:s,strategy:i}){if(t==="strict"&&s&&i)throw new Error(je`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:s}=e;typeof s=="string"&&!tg(s)&&(s=eg(s,t),e.ref=s)}},q8={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:s}){const{orphan:i,ref:a}=e;i||s.set(e,[...t.get(a).map(({node:o})=>o)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:s,skip:i},{groupOriginByCopy:a,groupsByName:o,multiplexCapturesToLeftByRef:c,openRefs:d,reffedNodesByReferencer:f}){const h=a.get(e);if(h&&d.has(e.number)){const _=ar(RC(e.number),t);f.set(_,d.get(e.number)),s(_);return}d.set(e.number,e),c.set(e.number,[]),e.name&&Tc(c,e.name,[]);const g=c.get(e.name??e.number);for(let _=0;_<g.length;_++){const y=g[_];if(h===y.node||h&&h===y.origin||e===y.origin){g.splice(_,1);break}}if(c.get(e.number).push({node:e,origin:h}),e.name&&c.get(e.name).push({node:e,origin:h}),e.name){const _=Tc(o,e.name,new Map);let y=!1;if(h)y=!0;else for(const b of _.values())if(!b.hasDuplicateNameToRemove){y=!0;break}o.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:y})}},exit({node:e},{openRefs:t}){t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=md(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:s},i){const{isRecursive:a,ref:o}=e;if(a){let g=t;for(;(g=g.parent)&&!(g.type==="CapturingGroup"&&(g.name===o||g.number===o)););i.reffedNodesByReferencer.set(e,g);return}const c=i.subroutineRefMap.get(o),d=o===0,f=d?RC(0):wT(c,i.groupOriginByCopy,null);let h=f;if(!d){const g=CT(Q8(c,y=>y.type==="Group"&&!!y.flags)),_=g?md(i.globalFlags,g):i.globalFlags;Y8(_,i.currentFlags)||(h=xi({flags:Z8(_)}),h.body[0].body.push(f))}s(At(h,t),{traverse:!d})}},K8={Backreference({node:e,parent:t,replaceWith:s},i){if(e.orphan){i.highestOrphanBackref=Math.max(i.highestOrphanBackref,e.ref);return}const o=i.reffedNodesByReferencer.get(e).filter(c=>X8(c,e));if(!o.length)s(At(Qr({negate:!0}),t));else if(o.length>1){const c=xi({atomic:!0,body:o.reverse().map(d=>Sa({body:[L_(d.number)]}))});s(At(c,t))}else e.ref=o[0].number},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){const s=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let i=0;i<s;i++){const a=hT();e.body.at(-1).body.push(a)}}},Subroutine({node:e},t){!e.isRecursive||e.ref===0||(e.ref=t.reffedNodesByReferencer.get(e).number)}};function ST(e){mc(e,{"*"({node:t,parent:s}){t.parent=s}})}function Y8(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function X8(e,t){let s=t;do{if(s.type==="Regex")return!1;if(s.type==="Alternative")continue;if(s===e)return!1;const i=xT(s.parent);for(const a of i){if(a===s)break;if(a===e||ET(a,e))return!0}}while(s=s.parent);throw new Error("Unexpected path")}function wT(e,t,s,i){const a=Array.isArray(e)?[]:{};for(const[o,c]of Object.entries(e))o==="parent"?a.parent=Array.isArray(s)?i:s:c&&typeof c=="object"?a[o]=wT(c,t,a,s):(o==="type"&&c==="CapturingGroup"&&t.set(a,t.get(e)??e),a[o]=c);return a}function RC(e){const t=fT(e);return t.isRecursive=!0,t}function Q8(e,t){const s=[];for(;e=e.parent;)(!t||t(e))&&s.push(e);return s}function eg(e,t){if(t.has(e))return t.get(e);const s=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/ug,"_")}`;return t.set(e,s),s}function CT(e){const t=["dotAll","ignoreCase"],s={enable:{},disable:{}};return e.forEach(({flags:i})=>{t.forEach(a=>{var o,c;(o=i.enable)!=null&&o[a]&&(delete s.disable[a],s.enable[a]=!0),(c=i.disable)!=null&&c[a]&&(s.disable[a]=!0)})}),Object.keys(s.enable).length||delete s.enable,Object.keys(s.disable).length||delete s.disable,s.enable||s.disable?s:null}function Z8({dotAll:e,ignoreCase:t}){const s={};return(e||t)&&(s.enable={},e&&(s.enable.dotAll=!0),t&&(s.enable.ignoreCase=!0)),(!e||!t)&&(s.disable={},!e&&(s.disable.dotAll=!0),!t&&(s.disable.ignoreCase=!0)),s}function xT(e){if(!e)throw new Error("Node expected");const{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function kT(e){const t=e.find(s=>s.kind==="search_start"||tH(s,{negate:!1})||!J8(s));if(!t)return null;if(t.kind==="search_start")return t;if(t.type==="LookaroundAssertion")return t.body[0].body[0];if(t.type==="CapturingGroup"||t.type==="Group"){const s=[];for(const i of t.body){const a=kT(i.body);if(!a)return null;Array.isArray(a)?s.push(...a):s.push(a)}return s}return null}function ET(e,t){const s=xT(e)??[];for(const i of s)if(i===t||ET(i,t))return!0;return!1}function J8({type:e}){return e==="Assertion"||e==="Directive"||e==="LookaroundAssertion"}function eH(e){const t=["Character","CharacterClass","CharacterSet"];return t.includes(e.type)||e.type==="Quantifier"&&e.min&&t.includes(e.body.type)}function tH(e,t){const s={negate:null,...t};return e.type==="LookaroundAssertion"&&(s.negate===null||e.negate===s.negate)&&e.body.length===1&&cT(e.body[0],{type:"Assertion",kind:"search_start"})}function tg(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function _n(e,t){const i=uT(e,{...t,unicodePropertyMap:Ov}).body;return i.length>1||i[0].body.length>1?xi({body:i}):i[0].body[0]}function sg(e,t){return e.negate=t,e}function ar(e,t){return e.parent=t,e}function At(e,t){return ST(e),e.parent=t,e}function sH(e,t){const s=vT(t),i=j_(s.target,"ES2024"),a=j_(s.target,"ES2025"),o=s.rules.recursionLimit;if(!Number.isInteger(o)||o<2||o>20)throw new Error("Invalid recursionLimit; use 2-20");let c=null,d=null;if(!a){const b=[e.flags.ignoreCase];mc(e,iH,{getCurrentModI:()=>b.at(-1),popModI(){b.pop()},pushModI(S){b.push(S)},setHasCasedChar(){b.at(-1)?c=!0:d=!0}})}const f={dotAll:e.flags.dotAll,ignoreCase:!!((e.flags.ignoreCase||c)&&!d)};let h=e;const g={accuracy:s.accuracy,appliedGlobalFlags:f,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:h,originMap:e._originMap,recursionLimit:o,useAppliedIgnoreCase:!!(!a&&c&&d),useFlagMods:a,useFlagV:i,verbose:s.verbose};function _(b){return g.lastNode=h,h=b,P8(nH[b.type],`Unexpected node type "${b.type}"`)(b,g,_)}const y={pattern:e.body.map(_).join("|"),flags:_(e.flags),options:{...e.options}};return i||(delete y.options.force.v,y.options.disable.v=!0,y.options.unicodeSetsPlugin=null),y._captureTransfers=new Map,y._hiddenCaptures=[],g.captureMap.forEach((b,S)=>{b.hidden&&y._hiddenCaptures.push(S),b.transferTo&&Tc(y._captureTransfers,b.transferTo,[]).push(S)}),y}var iH={"*":{enter({node:e},t){if(LC(e)){const s=t.getCurrentModI();t.pushModI(e.flags?md({ignoreCase:s},e.flags).ignoreCase:s)}},exit({node:e},t){LC(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){jv(Ft(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},s){t(),TT(e,{firstOnly:!0}).length&&s.setHasCasedChar()},CharacterSet({node:e},t){e.kind==="property"&&bT.has(e.value)&&t.setHasCasedChar()}},nH={Alternative({body:e},t,s){return e.map(s).join("")},Assertion({kind:e,negate:t}){if(e==="string_end")return"$";if(e==="string_start")return"^";if(e==="word_boundary")return t?je`\B`:je`\b`;throw new Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if(typeof e!="number")throw new Error("Unexpected named backref in transformed AST");if(!t.useFlagMods&&t.accuracy==="strict"&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw new Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");return"\\"+e},CapturingGroup(e,t,s){const{body:i,name:a,number:o}=e,c={ignoreCase:t.currentFlags.ignoreCase},d=t.originMap.get(e);return d&&(c.hidden=!0,o>d.number&&(c.transferTo=d.number)),t.captureMap.set(o,c),`(${a?`?<${a}>`:""}${i.map(s).join("|")})`},Character({value:e},t){const s=Ft(e),i=vo(e,{escDigit:t.lastNode.type==="Backreference",inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(i!==s)return i;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&jv(s)){const a=yT(s);return t.inCharClass?a.join(""):a.length>1?`[${a.join("")}]`:a[0]}return s},CharacterClass(e,t,s){const{kind:i,negate:a,parent:o}=e;let{body:c}=e;if(i==="intersection"&&!t.useFlagV)throw new Error("Use of character class intersection requires min target ES2024");ki.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&c.some(MC)&&(c=[Id(45),...c.filter(h=>!MC(h))]);const d=()=>`[${a?"^":""}${c.map(s).join(i==="intersection"?"&&":"")}]`;if(!t.inCharClass){if((!t.useFlagV||ki.bugNestedClassIgnoresNegation)&&!a){const g=c.filter(_=>_.type==="CharacterClass"&&_.kind==="union"&&_.negate);if(g.length){const _=xi(),y=_.body[0];return _.parent=o,y.parent=_,c=c.filter(b=>!g.includes(b)),e.body=c,c.length?(e.parent=y,y.body.push(e)):_.body.pop(),g.forEach(b=>{const S=Sa({body:[b]});b.parent=S,S.parent=_,_.body.push(S)}),s(_)}}t.inCharClass=!0;const h=d();return t.inCharClass=!1,h}const f=c[0];if(i==="union"&&!a&&f&&((!t.useFlagV||!t.verbose)&&o.kind==="union"&&!(ki.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&o.kind==="intersection"&&c.length===1&&f.type!=="CharacterClassRange"))return c.map(s).join("");if(!t.useFlagV&&o.type==="CharacterClass")throw new Error("Uses nested character class in a way that requires min target ES2024");return d()},CharacterClassRange(e,t){const s=e.min.value,i=e.max.value,a={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},o=vo(s,a),c=vo(i,a),d=new Set;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase){const f=TT(e);cH(f).forEach(g=>{d.add(Array.isArray(g)?`${vo(g[0],a)}-${vo(g[1],a)}`:vo(g,a))})}return`${o}-${c}${[...d].join("")}`},CharacterSet({kind:e,negate:t,value:s,key:i},a){if(e==="dot")return a.currentFlags.dotAll?a.appliedGlobalFlags.dotAll||a.useFlagMods?".":"[^]":je`[^\n]`;if(e==="digit")return t?je`\D`:je`\d`;if(e==="property"){if(a.useAppliedIgnoreCase&&a.currentFlags.ignoreCase&&bT.has(s))throw new Error(`Unicode property "${s}" can't be case-insensitive when other chars have specific case`);return`${t?je`\P`:je`\p`}{${i?`${i}=`:""}${s}}`}if(e==="word")return t?je`\W`:je`\w`;throw new Error(`Unexpected character set kind "${e}"`)},Flags(e,t){return(t.appliedGlobalFlags.ignoreCase?"i":"")+(e.dotAll?"s":"")+(e.sticky?"y":"")},Group({atomic:e,body:t,flags:s,parent:i},a,o){const c=a.currentFlags;s&&(a.currentFlags=md(c,s));const d=t.map(o).join("|"),f=!a.verbose&&t.length===1&&i.type!=="Quantifier"&&!e&&(!a.useFlagMods||!s)?d:`(?${uH(e,s,a.useFlagMods)}${d})`;return a.currentFlags=c,f},LookaroundAssertion({body:e,kind:t,negate:s},i,a){return`(?${`${t==="lookahead"?"":"<"}${s?"!":"="}`}${e.map(a).join("|")})`},Quantifier(e,t,s){return s(e.body)+hH(e)},Subroutine({isRecursive:e,ref:t},s){if(!e)throw new Error("Unexpected non-recursive subroutine in transformed AST");const i=s.recursionLimit;return t===0?`(?R=${i})`:je`\g<${t}&R=${i}>`}},rH=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),aH=new Set(["-","\\","]","^","["]),oH=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),DC=new Map([[9,je`\t`],[10,je`\n`],[11,je`\v`],[12,je`\f`],[13,je`\r`],[8232,je`\u2028`],[8233,je`\u2029`],[65279,je`\uFEFF`]]),lH=new RegExp("^\\p{Cased}$","u");function jv(e){return lH.test(e)}function TT(e,t){const s=!!(t!=null&&t.firstOnly),i=e.min.value,a=e.max.value,o=[];if(i<65&&(a===65535||a>=131071)||i===65536&&a>=131071)return o;for(let c=i;c<=a;c++){const d=Ft(c);if(!jv(d))continue;const f=yT(d).filter(h=>{const g=h.codePointAt(0);return g<i||g>a});if(f.length&&(o.push(...f),s))break}return o}function vo(e,{escDigit:t,inCharClass:s,useFlagV:i}){if(DC.has(e))return DC.get(e);if(e<32||e>126&&e<160||e>262143||t&&dH(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,"0")}`;const a=s?i?oH:aH:rH,o=Ft(e);return(a.has(o)?"\\":"")+o}function cH(e){const t=e.map(a=>a.codePointAt(0)).sort((a,o)=>a-o),s=[];let i=null;for(let a=0;a<t.length;a++)t[a+1]===t[a]+1?i??(i=t[a]):i===null?s.push(t[a]):(s.push([i,t[a]]),i=null);return s}function uH(e,t,s){if(e)return">";let i="";if(t&&s){const{enable:a,disable:o}=t;i=(a!=null&&a.ignoreCase?"i":"")+(a!=null&&a.dotAll?"s":"")+(o?"-":"")+(o!=null&&o.ignoreCase?"i":"")+(o!=null&&o.dotAll?"s":"")}return`${i}:`}function hH({kind:e,max:t,min:s}){let i;return!s&&t===1?i="?":!s&&t===1/0?i="*":s===1&&t===1/0?i="+":s===t?i=`{${s}}`:i=`{${s},${t===1/0?"":t}}`,i+{greedy:"",lazy:"?",possessive:"+"}[e]}function LC({type:e}){return e==="CapturingGroup"||e==="Group"||e==="LookaroundAssertion"}function dH(e){return e>47&&e<58}function MC({type:e,value:t}){return e==="Character"&&t===45}var _r,Sn,pa,vr,ma,Mc,P_,xr,fH=(xr=class extends RegExp{constructor(s,i,a){var t=(...Z7)=>(super(...Z7),ke(this,Mc),ke(this,_r,new Map),ke(this,Sn,null),ke(this,pa),ke(this,vr,null),ke(this,ma,null),ce(this,"rawOptions",{}),this);const o=!!(a!=null&&a.lazyCompile);if(s instanceof RegExp){if(a)throw new Error("Cannot provide options when copying a regexp");const c=s;t(c,i),ye(this,pa,c.source),c instanceof xr&&(ye(this,_r,V(c,_r)),ye(this,vr,V(c,vr)),ye(this,ma,V(c,ma)),this.rawOptions=c.rawOptions)}else{const c={hiddenCaptures:[],strategy:null,transfers:[],...a};t(o?"":s,i),ye(this,pa,s),ye(this,_r,mH(c.hiddenCaptures,c.transfers)),ye(this,ma,c.strategy),this.rawOptions=a??{}}o||ye(this,Sn,this)}get source(){return V(this,pa)||"(?:)"}exec(s){if(!V(this,Sn)){const{lazyCompile:o,...c}=this.rawOptions;ye(this,Sn,new xr(V(this,pa),this.flags,c))}const i=this.global||this.sticky,a=this.lastIndex;if(V(this,ma)==="clip_search"&&i&&a){this.lastIndex=0;const o=Fe(this,Mc,P_).call(this,s.slice(a));return o&&(pH(o,a,s,this.hasIndices),this.lastIndex+=a),o}return Fe(this,Mc,P_).call(this,s)}},_r=new WeakMap,Sn=new WeakMap,pa=new WeakMap,vr=new WeakMap,ma=new WeakMap,Mc=new WeakSet,P_=function(s){V(this,Sn).lastIndex=this.lastIndex;const i=M0(xr.prototype,this,"exec").call(V(this,Sn),s);if(this.lastIndex=V(this,Sn).lastIndex,!i||!V(this,_r).size)return i;const a=[...i];i.length=1;let o;this.hasIndices&&(o=[...i.indices],i.indices.length=1);const c=[0];for(let d=1;d<a.length;d++){const{hidden:f,transferTo:h}=V(this,_r).get(d)??{};if(f?c.push(null):(c.push(i.length),i.push(a[d]),this.hasIndices&&i.indices.push(o[d])),h&&a[d]!==void 0){const g=c[h];if(!g)throw new Error(`Invalid capture transfer to "${g}"`);if(i[g]=a[d],this.hasIndices&&(i.indices[g]=o[d]),i.groups){V(this,vr)||ye(this,vr,gH(this.source));const _=V(this,vr).get(h);_&&(i.groups[_]=a[d],this.hasIndices&&(i.indices.groups[_]=o[d]))}}}return i},xr);function pH(e,t,s,i){if(e.index+=t,e.input=s,i){const a=e.indices;for(let c=0;c<a.length;c++){const d=a[c];d&&(a[c]=[d[0]+t,d[1]+t])}const o=a.groups;o&&Object.keys(o).forEach(c=>{const d=o[c];d&&(o[c]=[d[0]+t,d[1]+t])})}}function mH(e,t){const s=new Map;for(const i of e)s.set(i,{hidden:!0});for(const[i,a]of t)for(const o of a)Tc(s,o,{}).transferTo=i;return s}function gH(e){const t=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,s=new Map;let i=0,a=0,o;for(;o=t.exec(e);){const{0:c,groups:{capture:d,name:f}}=o;c==="["?i++:i?c==="]"&&i--:d&&(a++,f&&s.set(a,f))}return s}function _H(e,t){const s=vH(e,t);return s.options?new fH(s.pattern,s.flags,s.options):new RegExp(s.pattern,s.flags)}function vH(e,t){const s=vT(t),i=uT(e,{flags:s.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:s.rules.captureGroup,singleline:s.rules.singleline},skipBackrefValidation:s.rules.allowOrphanBackrefs,unicodePropertyMap:Ov}),a=W8(i,{accuracy:s.accuracy,asciiWordBoundaries:s.rules.asciiWordBoundaries,avoidSubclass:s.avoidSubclass,bestEffortTarget:s.target}),o=sH(a,s),c=O8(o.pattern,{captureTransfers:o._captureTransfers,hiddenCaptures:o._hiddenCaptures,mode:"external"}),d=L8(c.pattern),f=D8(d.pattern,{captureTransfers:c.captureTransfers,hiddenCaptures:c.hiddenCaptures}),h={pattern:f.pattern,flags:`${s.hasIndices?"d":""}${s.global?"g":""}${o.flags}${o.options.disable.v?"u":"v"}`};if(s.avoidSubclass){if(s.lazyCompileLength!==1/0)throw new Error("Lazy compilation requires subclass")}else{const g=f.hiddenCaptures.sort((S,w)=>S-w),_=Array.from(f.captureTransfers),y=a._strategy,b=h.pattern.length>=s.lazyCompileLength;(g.length||_.length||y||b)&&(h.options={...g.length&&{hiddenCaptures:g},..._.length&&{transfers:_},...y&&{strategy:y},...b&&{lazyCompile:b}})}return h}function NT(e,t){return _H(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}function yH(e={}){const t=Object.assign({target:"auto",cache:new Map},e);return t.regexConstructor||(t.regexConstructor=s=>NT(s,{target:t.target})),{createScanner(s){return new jz(s,t)},createString(s){return{content:s}}}}var bH=gv({bundledLanguages:()=>yv,bundledLanguagesAlias:()=>vv,bundledLanguagesBase:()=>_v,bundledLanguagesInfo:()=>Ad,bundledThemes:()=>Sv,bundledThemesInfo:()=>bv,codeToHast:()=>ZE,codeToHtml:()=>QE,codeToTokens:()=>JE,codeToTokensBase:()=>eT,codeToTokensWithThemes:()=>tT,createHighlighter:()=>Bd,createJavaScriptRegexEngine:()=>yH,createOnigurumaEngine:()=>cE,defaultJavaScriptRegexConstructor:()=>NT,getLastGrammarState:()=>iT,getSingletonHighlighter:()=>sT,loadWasm:()=>Cv});aE(bH,Oz);const SH=Ho("shiki"),wH={name:"tui",type:"dark",colors:{"editor.background":"#00000000","editor.foreground":"#e0e0e0"},tokenColors:[{scope:["keyword","storage.type","storage.modifier"],settings:{foreground:"#c792ea"}},{scope:["entity.name.function","support.function"],settings:{foreground:"#82aaff"}},{scope:["string","string.quoted"],settings:{foreground:"#c3e88d"}},{scope:["entity.name.type","support.type"],settings:{foreground:"#ffcb6b"}},{scope:["comment","punctuation.definition.comment"],settings:{foreground:"#888888"}},{scope:["constant.numeric"],settings:{foreground:"#f78c6c"}},{scope:["variable","variable.other"],settings:{foreground:"#e0e0e0"}},{scope:["punctuation"],settings:{foreground:"#888888"}}]},CH=["typescript","javascript","json","css","svelte"];let Ah=null;function xH(){return Ah||(Ah=Bd({themes:[wH],langs:CH}).catch(e=>{throw Ah=null,e})),Ah}function kH(e){var i;const t=((i=e.split(".").pop())==null?void 0:i.toLowerCase())??"";return{ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",json:"json",css:"css",svelte:"svelte",html:"html",md:"markdown",py:"python",rs:"rust",go:"go",yaml:"yaml",yml:"yaml",sh:"bash",bash:"bash",zsh:"bash"}[t]??"javascript"}async function AT(e,t){const s=await xH(),i=s.getLoadedLanguages();let a=t;if(!i.includes(a))try{await s.loadLanguage(a)}catch(c){SH.warn(`Failed to load "${a}", falling back to javascript`,c),a="javascript"}const{tokens:o}=s.codeToTokens(e,{lang:a,theme:"tui"});return o}const Zr=5e3,gd={content:"",type:"empty",tokens:null};function EH(e,t){if(!e)return{rawLines:[],hunkHeaderMap:new Map,lang:"javascript"};const s=SI(e);if(s.length===0)return{rawLines:[],hunkHeaderMap:new Map,lang:"javascript"};const i=s[0],a=kH(t),o=[],c=new Map;for(const d of i.blocks){c.set(o.length,d.header);for(const f of d.lines){const g={type:f.type==="insert"?"add":f.type==="delete"?"delete":"context",content:f.content.slice(1)};f.oldNumber!==void 0&&(g.oldNumber=f.oldNumber),f.newNumber!==void 0&&(g.newNumber=f.newNumber),o.push(g)}}return{rawLines:o,hunkHeaderMap:c,lang:a}}function _d(e,t){const s=t==="left"?e.oldNumber:e.newNumber;return{...s!==void 0?{number:s}:{},content:e.content,type:e.type,tokens:e.tokens}}function TH(e,t){const s=[];let i=t;const a=[],o=[];for(;i<e.length&&e[i].type==="delete";)a.push(e[i]),i++;for(;i<e.length&&e[i].type==="add";)o.push(e[i]),i++;const c=Math.max(a.length,o.length);for(let d=0;d<c;d++){const f=a[d],h=o[d];s.push({left:f?_d(f,"left"):gd,right:h?_d(h,"right"):gd})}return{pairs:s,end:i}}function OC(e,t){const s=[];let i=0;for(;i<e.length;){const a=t==null?void 0:t.get(i);a&&s.push({left:gd,right:gd,hunkHeader:a});const o=e[i];if(o.type==="context")s.push({left:_d(o,"left"),right:_d(o,"right")}),i++;else{const{pairs:c,end:d}=TH(e,i);s.push(...c),i=d}}return s}function B_(e,t){return e?e.map((s,i)=>p.jsx("span",{style:{color:s.color??"#e0e0e0"},children:s.content},i)):t}function NH({line:e,index:t,hunkHeaderMap:s}){return p.jsxs(qe.Fragment,{children:[s.has(t)&&p.jsx("div",{className:"hunk-header",id:`hunk-${t}`,children:s.get(t)??""}),p.jsxs("div",{className:`diff-line ${e.type}`,"data-old":e.oldNumber??"","data-new":e.newNumber??"",children:[p.jsx("span",{className:"line-number old",children:e.oldNumber??""}),p.jsx("span",{className:"line-number new",children:e.newNumber??""}),p.jsx("span",{className:"line-prefix",children:e.type==="add"?"+":e.type==="delete"?"-":" "}),p.jsx("span",{className:"line-content",children:B_(e.tokens,e.content)})]})]})}function AH({pair:e,index:t}){if(e.hunkHeader)return p.jsx("div",{className:"hunk-header sbs-hunk",id:`sbs-hunk-${t}`,children:e.hunkHeader});const s=e.left.type==="delete"?"-":e.left.type==="context"?" ":"",i=e.right.type==="add"?"+":e.right.type==="context"?" ":"";return p.jsxs("div",{className:"sbs-row",children:[p.jsxs("div",{className:`sbs-half ${e.left.type}`,children:[p.jsx("span",{className:"line-number",children:e.left.number??""}),p.jsx("span",{className:"line-prefix",children:s}),p.jsx("span",{className:"line-content",children:B_(e.left.tokens,e.left.content)})]}),p.jsxs("div",{className:`sbs-half ${e.right.type}`,children:[p.jsx("span",{className:"line-number",children:e.right.number??""}),p.jsx("span",{className:"line-prefix",children:i}),p.jsx("span",{className:"line-content",children:B_(e.right.tokens,e.right.content)})]})]})}function RH({shown:e,total:t,onShowAll:s}){return p.jsxs("div",{className:"truncation-notice",children:[p.jsxs("span",{children:["showing ",e," of ",t," lines"]}),p.jsx("button",{className:"show-more-btn",onClick:s,children:"[show all]"})]})}function DH({mode:e,lines:t,pairedLines:s,hunkHeaderMap:i,showAll:a,onShowAll:o}){const c=e==="side-by-side",d=!a&&t.length>Zr?t.slice(0,Zr):t,f=!a&&s.length>Zr?s.slice(0,Zr):s,h=c?s.length:t.length,g=c?f.length:d.length,_=!a&&h>Zr;return p.jsxs(p.Fragment,{children:[c?p.jsx("div",{className:"diff-content-sbs",children:f.map((y,b)=>p.jsx(AH,{pair:y,index:b},b))}):p.jsx("div",{className:"diff-content",children:d.map((y,b)=>p.jsx(NH,{line:y,index:b,hunkHeaderMap:i},b))}),_&&p.jsx(RH,{shown:g,total:h,onShowAll:o})]})}function LH(e,t){const[s,i]=C.useState([]),[a,o]=C.useState([]),[c,d]=C.useState(!1),f=C.useRef(0);return C.useEffect(()=>{const{rawLines:h,hunkHeaderMap:g,lang:_}=e,y=++f.current;d(!1);const b=h.map(w=>({...w,tokens:null}));if(i(b),o(OC(b,g)),t&&t(g.size),h.length===0)return;const S=h.length>Zr?h.slice(0,Zr):h;AT(S.map(w=>w.content).join(`
|
|
371
|
+
`),_).then(w=>{if(y!==f.current)return;const k=h.map((T,D)=>({...T,tokens:w[D]??null}));i(k),o(OC(k,g))}).catch(()=>{})},[e,t]),{lines:s,pairedLines:a,showAll:c,setShowAll:d}}function I_({diff:e,filePath:t,loading:s=!1,mode:i="unified",wordWrap:a=!1,onHunkCount:o}){const c=C.useMemo(()=>EH(e,t),[e,t]),{lines:d,pairedLines:f,showAll:h,setShowAll:g}=LH(c,o);return p.jsxs("div",{className:["diff-viewer",a&&"word-wrap"].filter(Boolean).join(" "),role:"region","aria-label":"File diff",children:[s&&p.jsx("div",{className:"diff-loading",children:"loading diff..."}),!s&&d.length===0&&p.jsx("div",{className:"diff-empty",children:"no changes"}),!s&&d.length>0&&p.jsx(DH,{mode:i,lines:d,pairedLines:f,hunkHeaderMap:c.hunkHeaderMap,showAll:h,onShowAll:()=>g(!0)})]})}const MH=Object.freeze(Object.defineProperty({__proto__:null,DiffViewer:I_,default:I_},Symbol.toStringTag,{value:"Module"}));function OH({code:e,language:t="text",showLineNumbers:s=!0,startLine:i=1}){const[a,o]=C.useState(null),[c,d]=C.useState(!1);return C.useEffect(()=>{let f=!1;return d(!1),o(null),AT(e,t).then(h=>{f||o(h)}).catch(()=>{f||d(!0)}),()=>{f=!0}},[e,t]),a?p.jsx("div",{className:"code-block",children:p.jsx("pre",{children:p.jsx("code",{children:a.map((f,h)=>p.jsxs("span",{className:"line",children:[s&&p.jsx("span",{className:"line-number",children:i+h}),f.map((g,_)=>p.jsx("span",{style:{color:g.color??"#e0e0e0"},children:g.content},_))]},h))})})}):c?p.jsx("div",{className:"code-block",children:p.jsx("pre",{className:"fallback",children:p.jsx("code",{children:e})})}):p.jsx("div",{className:"code-block",children:p.jsx("pre",{className:"loading",children:p.jsx("code",{children:e})})})}const jH=p.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"square","aria-hidden":"true",children:[p.jsx("circle",{cx:"7",cy:"7",r:"5.5"}),p.jsx("path",{d:"M1.5 7h11M7 1.5c-1.5 2-2 3.5-2 5.5s.5 3.5 2 5.5M7 1.5c1.5 2 2 3.5 2 5.5s-.5 3.5-2 5.5"})]});function jC(e){var i;const t=((i=e.split(".").pop())==null?void 0:i.toLowerCase())??"";return{ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",py:"python",rs:"rust",go:"go",rb:"ruby",css:"css",scss:"scss",html:"html",svelte:"svelte",json:"json",yaml:"yaml",yml:"yaml",md:"markdown",sh:"bash",bash:"bash",sql:"sql",graphql:"graphql"}[t]??"text"}function vd(e,t){return`${e}::${t??"working"}`}function PH(e){const[t,s]=C.useState(new Map),[i,a]=C.useState(new Set),[o,c]=C.useState(new Map),d=C.useCallback((h,g)=>{const _=vd(h,g);t.has(_)||i.has(_)||(a(y=>new Set([...y,_])),Cx(e,h,g??void 0).then(y=>{y.error?c(b=>new Map([...b,[_,y.error]])):s(b=>new Map([...b,[_,y.diff]]))},y=>{const b=y instanceof Error?y.message:"failed to load diff";c(S=>new Map([...S,[_,b]]))}).finally(()=>{a(y=>{const b=new Set(y);return b.delete(_),b})}))},[e,t,i]),f=C.useCallback(h=>{s(g=>{const _=new Map(g);return _.delete(h),_}),c(g=>{const _=new Map(g);return _.delete(h),_})},[]);return{diffCache:t,loadingPaths:i,errorPaths:o,fetchDiff:d,clearEntry:f}}function BH(){const e=se(o=>o.sessions),t=se(o=>o.activeSessionId),i=fe(o=>o.sendToTargetSessionId)??t,a=C.useMemo(()=>{if(!i)return"no sessions";const o=e.find(c=>c.id===i);return(o==null?void 0:o.displayName)??(o==null?void 0:o.branchName)??"session"},[i,e]);return{hasActiveSession:i!==null,activeSessionName:a}}function IH({tab:e,isActive:t,onTabClick:s,onCloseTab:i}){return p.jsxs("div",{className:["file-tab",t?"active":""].filter(Boolean).join(" "),role:"tab",tabIndex:0,"aria-selected":t,onClick:()=>s(e),onKeyDown:a=>{a.key==="Enter"&&s(e)},title:e.filePath,children:[e.tabType==="html"&&p.jsx("span",{className:"tab-icon",children:jH}),p.jsx("span",{className:"tab-name",children:e.fileName}),e.isChanged&&p.jsx("span",{className:"tab-badge",children:"M"}),p.jsx("button",{className:"tab-close",onClick:a=>i(e,a),"aria-label":`close ${e.fileName}`,children:"×"})]})}function zH({tab:e}){const[t,s]=C.useState(!1),[i,a]=C.useState("");C.useEffect(()=>{e.filePath!==i&&(a(e.filePath),s(!1))},[e.filePath,i]),C.useEffect(()=>{if(!t){const c=setTimeout(()=>s(!0),4e3);return()=>clearTimeout(c)}},[t]);const o=`/browser-content/${e.token}/${e.fileName}${e.refreshVersion?`?v=${e.refreshVersion}`:""}`;return p.jsxs("div",{className:"html-viewer",children:[!t&&p.jsxs("div",{className:"sandbox-notice",children:[p.jsx("span",{className:"notice-text",children:"rendered in sandbox · some web features may not work"}),p.jsx("button",{className:"notice-dismiss",onClick:()=>s(!0),"aria-label":"dismiss notice",children:"×"})]}),p.jsx("iframe",{src:o,sandbox:"allow-scripts",title:`HTML preview: ${e.fileName}`,className:"html-iframe"})]})}function HH({activeTab:e,activeLoading:t,activeError:s,activeDiff:i,diffViewMode:a,wordWrap:o,onRetry:c,onCloseActiveTab:d,onDiffClick:f,renderDiff:h,renderCode:g}){return e?t?p.jsxs("div",{className:"loading-viewer",children:[p.jsx("span",{className:"spinner",children:"⠋"})," loading ",e.fileName,"..."]}):s?p.jsxs("div",{className:"error-viewer",children:[p.jsxs("div",{className:"error-text",children:["failed to load diff: ",s]}),p.jsxs("div",{className:"error-actions",children:[p.jsx("button",{className:"retry-btn",onClick:c,children:"retry"}),p.jsx("button",{className:"close-btn",onClick:d,children:"close tab"})]})]}):e.tabType==="html"&&e.token?p.jsx(zH,{tab:e}):e.isChanged&&i?p.jsx("div",{className:"diff-wrapper",onClick:f,children:h?h({diff:i,filePath:e.filePath,mode:a,wordWrap:o}):p.jsx(I_,{diff:i,filePath:e.filePath,mode:a,wordWrap:o})}):e.isChanged?p.jsx("div",{className:"empty-viewer",children:"no diff available"}):p.jsx("div",{className:["raw-file",o?"word-wrap":""].filter(Boolean).join(" "),children:g?g({code:i||"(empty file)",language:jC(e.filePath)}):p.jsx(OH,{code:i||"(empty file)",language:jC(e.filePath)})}):p.jsx("div",{className:"empty-viewer",children:"select a file from the sidebar"})}function UH(e,t,s,i,a){const o=fe(E=>E.closeFileTab),c=fe(E=>E.closeAllFileTabs),d=fe(E=>E.refreshHtmlTab),f=fe(E=>E.setFileDiffViewMode),h=fe(E=>E.setFileWordWrap),g=fe(E=>E.fileDiffViewMode),_=fe(E=>E.fileWordWrap),y=C.useCallback((E,M)=>{M.stopPropagation(),o(E.filePath,E.tabType),a(vd(E.filePath,t))},[o,a,t]),b=C.useCallback(E=>{fe.setState({activeFileTabKey:$i(E.filePath,E.tabType)})},[]),S=C.useCallback(E=>{var B;const U=E.target.closest(".line-number, .d2h-code-linenumber");if(!U||!e||!s)return;const W=parseInt(((B=U.textContent)==null?void 0:B.trim())??"",10);!Number.isNaN(W)&&W>0&&(i==null||i(M5(e.filePath,W)))},[e,s,i]),w=C.useCallback(()=>{e&&a(vd(e.filePath,t))},[e,t,a]),k=C.useCallback(()=>{(e==null?void 0:e.tabType)==="html"&&e.filePath&&d(e.filePath)},[e,d]),T=C.useCallback(()=>{e&&o(e.filePath,e.tabType)},[e,o]),D=C.useCallback(()=>{f(g==="unified"?"side-by-side":"unified")},[g,f]),N=C.useCallback(()=>{h(!_)},[_,h]);return{handleCloseTab:y,handleTabClick:b,handleDiffClick:S,handleRetry:w,handleRefresh:k,handleCloseActiveTab:T,handleToggleDiffViewMode:D,handleToggleWordWrap:N,closeAllFileTabs:c,fileDiffViewMode:g,fileWordWrap:_}}function FH({workspacePath:e,onInjectReference:t,renderDiff:s,renderCode:i}){const a=fe(z=>z.openFileTabs),o=fe(z=>z.activeFileTabKey),c=fe(z=>z.fileDiffSource),d=fe(z=>z.fileDiffDefaultBranch),f=C.useMemo(()=>pv(c,d)??null,[c,d]),h=C.useMemo(()=>a.find(z=>$i(z.filePath,z.tabType)===o),[a,o]),{diffCache:g,loadingPaths:_,errorPaths:y,fetchDiff:b,clearEntry:S}=PH(e),{hasActiveSession:w,activeSessionName:k}=BH(),T=UH(h,f,w,t,S),{handleCloseTab:D,handleTabClick:N,handleDiffClick:E,handleRetry:M,handleRefresh:U,handleCloseActiveTab:W,handleToggleDiffViewMode:B,handleToggleWordWrap:$,closeAllFileTabs:Y,fileDiffViewMode:K,fileWordWrap:X}=T,P=h?vd(h.filePath,f):null,j=P?g.get(P)??"":"",H=P?_.has(P):!1,O=P?y.get(P)??null:null;return C.useEffect(()=>{!h||h.tabType==="html"||b(h.filePath,f)},[h==null?void 0:h.filePath,h==null?void 0:h.tabType,f,b]),p.jsxs("div",{className:"file-viewer",children:[p.jsxs("div",{className:"file-tab-bar",children:[p.jsx("div",{className:"tabs-scroll",children:a.map(z=>p.jsx(IH,{tab:z,isActive:o===$i(z.filePath,z.tabType),onTabClick:N,onCloseTab:D},$i(z.filePath,z.tabType)))}),p.jsxs("div",{className:"tab-bar-actions",children:[p.jsx("button",{className:"diff-mode-btn",onClick:$,children:X?"[nowrap]":"[wrap]"}),(h==null?void 0:h.isChanged)&&p.jsx("button",{className:"diff-mode-btn",onClick:B,children:K==="unified"?"[split]":"[unified]"}),(h==null?void 0:h.tabType)==="html"&&p.jsx("button",{className:"refresh-btn",onClick:U,children:"[refresh]"}),a.length>1&&p.jsx("button",{className:"close-all-btn",onClick:Y,children:"close all"}),p.jsxs("div",{className:["send-to-pill",w?"":"disabled"].filter(Boolean).join(" "),children:[p.jsx("span",{className:"send-to-label",children:"send to:"}),p.jsx("span",{className:"send-to-target",children:k})]})]})]}),p.jsx("div",{className:"file-content",role:"tabpanel",children:p.jsx(HH,{activeTab:h,activeLoading:H,activeError:O,activeDiff:j,diffViewMode:K,wordWrap:X,onRetry:M,onCloseActiveTab:W,onDiffClick:E,renderDiff:s,renderCode:i})})]})}const $H=200,VH=600,WH=300,GH=300;function qH({terminal:e,fileViewer:t,rightSidebar:s,fileViewerOpen:i=!1,rightSidebarCollapsed:a=!1,rightSidebarWidth:o,fileViewerRatio:c,onRightSidebarWidthChange:d,onFileViewerRatioChange:f}){const[h,g]=C.useState(320),[_,y]=C.useState(.4),[b,S]=C.useState(null),w=o??h,k=c??_,T=C.useRef(null),D=a?0:w,N=C.useRef(b);N.current=b;const E=C.useRef(D);E.current=D;const M=C.useCallback((U,W)=>{W.preventDefault(),S(U)},[]);return C.useEffect(()=>{if(!b)return;function U(B){const $=T.current;if(!$)return;const Y=$.getBoundingClientRect(),K=N.current;if(K==="right-sidebar"){const X=Y.right-B.clientX,P=Math.max($H,Math.min(VH,X));g(P),d==null||d(P)}else if(K==="file-viewer"){const X=E.current,P=Y.width-X,j=Y.right-X-B.clientX;if(B.clientX-Y.left<WH||j<GH)return;const O=j/P;y(O),f==null||f(O)}}function W(){S(null)}return document.addEventListener("pointermove",U),document.addEventListener("pointerup",W),()=>{document.removeEventListener("pointermove",U),document.removeEventListener("pointerup",W)}},[b,d,f]),p.jsxs("div",{className:"split-pane-layout",ref:T,children:[p.jsx("div",{className:"pane-terminal",style:{flex:i?String(1-k):"1"},children:e}),i?p.jsxs(p.Fragment,{children:[p.jsx("div",{className:["resize-handle",b==="file-viewer"&&"active"].filter(Boolean).join(" "),role:"separator","aria-label":"resize terminal and file viewer",onPointerDown:U=>M("file-viewer",U)}),p.jsx("div",{className:"pane-file-viewer",style:{flex:String(k)},children:t})]}):null,a?null:p.jsxs(p.Fragment,{children:[p.jsx("div",{className:["resize-handle",b==="right-sidebar"&&"active"].filter(Boolean).join(" "),role:"separator","aria-label":"resize right sidebar",onPointerDown:U=>M("right-sidebar",U)}),p.jsx("div",{className:"pane-right-sidebar",style:{width:w},children:s})]})]})}const KH=[{value:"working",label:"working tree"},{value:"staged",label:"staged"},{value:"branch",label:"branch"}];function z_({value:e="working",onchange:t,defaultBranch:s="main"}){return p.jsx("div",{className:"diff-source-toggle",role:"radiogroup","aria-label":"diff source",children:KH.map(i=>p.jsx("button",{className:`toggle-option${e===i.value?" active":""}`,role:"radio","aria-checked":e===i.value,type:"button",onClick:()=>t(i.value),children:i.value==="branch"?`vs ${s}`:i.label},i.value))})}const YH=Object.freeze(Object.defineProperty({__proto__:null,DiffSourceToggle:z_,default:z_},Symbol.toStringTag,{value:"Module"})),XH=C.forwardRef(function({workspacePath:t,changedFilesData:s=[],onFileSelect:i},a){const o=fe(le=>le.rightSidebarTab),c=fe(le=>le.setRightSidebarTab),d=fe(le=>le.fileDiffSource),f=fe(le=>le.fileDiffDefaultBranch),h=fe(le=>le.openFileTab),[g,_]=C.useState([]),[y,b]=C.useState({additions:0,deletions:0,fileCount:0}),[S,w]=C.useState(!1),[k,T]=C.useState(null),[D,N]=C.useState([]),[E,M]=C.useState([]),[U,W]=C.useState(new Set),[B,$]=C.useState(new Map),[Y,K]=C.useState(!1),[X,P]=C.useState(null),[j,H]=C.useState(new Set),[O,z]=C.useState(-1),Q=C.useMemo(()=>pv(d,f),[d,f]),re=C.useMemo(()=>tE(D),[D]),ne=C.useRef(g);ne.current=g;const A=C.useCallback(async()=>{if(t){w(!0),T(null);try{const le=await wx(t,Q);le.error?T(le.error):(_(le.files),b(le.aggregate),N(L5(le.files)))}catch(le){T(le instanceof Error?le.message:"failed to load")}finally{w(!1)}}},[t,Q]);C.useImperativeHandle(a,()=>({refresh:A}),[A]);const I=C.useRef("");C.useEffect(()=>{if(!t)return;const le=t!==I.current;I.current=t,le?xx(t).then(Ee=>{fe.getState().setFileDiffDefaultBranch(Ee),A()}):A()},[t,Q,A]),C.useEffect(()=>{if(s.length>0){const le=new Set(fe.getState().lastChangedFiles),Ee=s.filter(we=>!le.has(we));Ee.length>0&&(H(we=>new Set([...we,...Ee])),setTimeout(()=>{H(we=>new Set([...we].filter(Re=>!Ee.includes(Re))))},500)),fe.getState().setLastChangedFiles([...s])}},[s]);const q=C.useCallback(async()=>{if(t){K(!0),P(null);try{const le=await qh(t,{includeFiles:!0,showHidden:!1});M(le.entries)}catch(le){P(le instanceof Error?le.message:"failed to load")}finally{K(!1)}}},[t]),oe=C.useCallback(async le=>{if(U.has(le))W(Ee=>{const we=new Set(Ee);return we.delete(le),we});else if(W(Ee=>new Set([...Ee,le])),!B.has(le))try{const Ee=await qh(le,{includeFiles:!0,showHidden:!1});$(we=>new Map([...we,[le,Ee.entries]]))}catch{}},[U,B]);C.useEffect(()=>{o==="all-files"&&E.length===0&&!Y&&q()},[o,E.length,Y,q]);const ve=C.useCallback(le=>{if(le.isDirectory)N(Ee=>{function we(Re){return Re.map(pt=>pt.path===le.path?{...pt,expanded:!pt.expanded,children:we(pt.children)}:{...pt,children:we(pt.children)})}return we(Ee)});else{const Ee=ne.current.some(we=>we.path===le.path);h(le.path,Ee),i==null||i(le.path,Ee)}},[h,i]),Se=C.useCallback(le=>{if(le.isDirectory!==!1)oe(le.path);else{const Ee=t+"/",we=le.path.startsWith(Ee)?le.path.slice(Ee.length):le.path,Re=ne.current.some(pt=>pt.path===we);h(we,Re),i==null||i(we,Re)}},[t,oe,h,i]),Ne=C.useCallback(le=>{const Ee=re;Ee.length!==0&&(le.key==="ArrowDown"?(le.preventDefault(),z(we=>Math.min(we+1,Ee.length-1))):le.key==="ArrowUp"?(le.preventDefault(),z(we=>Math.max(we-1,0))):le.key==="Enter"&&O>=0&&O<Ee.length&&(le.preventDefault(),ve(Ee[O].node)))},[re,O,ve]);function ze(le){return s.length>0&&s.includes(le)}function De(le,Ee){return le.map(we=>p.jsxs(qe.Fragment,{children:[p.jsxs("button",{className:`tree-item ${we.isDirectory!==!1?"directory":"file"}`,role:"treeitem","aria-expanded":we.isDirectory!==!1?U.has(we.path):void 0,"aria-selected":!1,style:{paddingLeft:`${8+Ee*16}px`},onClick:()=>Se(we),children:[p.jsx("span",{className:"icon-slot",children:we.isDirectory!==!1?p.jsx("span",{className:"expand-arrow",children:U.has(we.path)?"v":">"}):p.jsx("span",{className:"file-icon",children:"-"})}),p.jsx("span",{className:"node-name",children:we.name}),we.isDirectory!==!1&&we.hasChildren&&p.jsx("span",{className:"action-slot",children:p.jsx("span",{className:"has-children-dot"})})]}),U.has(we.path)&&B.has(we.path)&&De(B.get(we.path)??[],Ee+1)]},we.path))}return p.jsxs("div",{className:"fts-sidebar",role:"complementary","aria-label":"file tree",children:[p.jsx("div",{className:"fts-tab-bar",role:"tablist",children:[{id:"changes",label:"changes"},{id:"all-files",label:"all files"},{id:"checks",label:"checks"}].map(le=>p.jsxs("button",{className:`fts-tab${o===le.id?" active":""}`,role:"tab","aria-selected":o===le.id,onClick:()=>c(le.id),children:[le.label,le.id==="changes"&&y.fileCount>0&&p.jsx("span",{className:"fts-tab-count",children:y.fileCount})]},le.id))}),p.jsxs("div",{className:"fts-tab-content",children:[o==="changes"&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"fts-controls-row",children:p.jsx(z_,{value:d,onchange:le=>fe.getState().setFileDiffSource(le),defaultBranch:f})}),S&&g.length===0?p.jsxs("div",{className:"fts-loading-state",children:[p.jsx("span",{className:"fts-spinner",children:"⠋"})," loading changes..."]}):k?p.jsxs("div",{className:"fts-error-state",children:[p.jsx("span",{className:"fts-error-text",children:k}),p.jsx("button",{className:"fts-retry-btn",onClick:()=>A(),children:"retry"})]}):re.length===0?p.jsx("div",{className:"fts-empty-state",children:"no changes yet — when an agent writes code, changed files appear here. click any line to send it as context."}):p.jsx("div",{className:"fts-tree",role:"tree",tabIndex:0,onKeyDown:Ne,children:re.map(({node:le,depth:Ee},we)=>p.jsxs("button",{className:["tree-item",O===we&&"focused",j.has(le.path)&&"animating",le.isDirectory?"directory":"file"].filter(Boolean).join(" "),role:"treeitem","aria-selected":O===we,"aria-expanded":le.isDirectory?le.expanded:void 0,"aria-label":`${le.name}${le.status?`, ${le.status}`:""}${le.additions?`, ${le.additions} additions`:""}${le.deletions?`, ${le.deletions} deletions`:""}${ze(le.path)?", recently changed":""}`,style:{paddingLeft:`${8+Ee*16}px`},onClick:()=>ve(le),children:[p.jsx("span",{className:"icon-slot",children:ze(le.path)&&!le.isDirectory?p.jsx("span",{className:"blue-dot","aria-label":"recently changed"}):le.isDirectory?p.jsx("span",{className:"expand-arrow",children:le.expanded?"v":">"}):p.jsx("span",{className:"file-icon",children:"-"})}),p.jsx("span",{className:"node-name",children:le.name}),p.jsx("span",{className:"action-slot",children:le.isDirectory?p.jsx("span",{className:"file-count",children:le.fileCount}):le.status?p.jsx("span",{className:"badge",style:{color:iE(le.status)},children:sE(le.status)}):null})]},le.path))}),y.fileCount>0&&p.jsxs("div",{className:"fts-stats-bar",children:[y.fileCount," changed"," ",p.jsxs("span",{className:"fts-stat-add",children:["+",y.additions]})," ",p.jsxs("span",{className:"fts-stat-del",children:["-",y.deletions]})]})]}),o==="all-files"&&p.jsx(p.Fragment,{children:Y&&E.length===0?p.jsxs("div",{className:"fts-loading-state",children:[p.jsx("span",{className:"fts-spinner",children:"⠋"})," loading files..."]}):X?p.jsxs("div",{className:"fts-error-state",children:[p.jsx("span",{className:"fts-error-text",children:X}),p.jsx("button",{className:"fts-retry-btn",onClick:()=>q(),children:"retry"})]}):E.length===0?p.jsx("div",{className:"fts-empty-state",children:"empty repository"}):p.jsx("div",{className:"fts-tree",role:"tree",children:De(E,0)})}),o==="checks"&&p.jsx("div",{className:"fts-empty-state",children:"checks — coming soon"})]})]})}),PC=new NR({defaultOptions:{queries:{staleTime:60*1e3,gcTime:600*1e3,refetchOnWindowFocus:!0}}});let gc=null;X2((e,t)=>{gc==null||gc(e,t)});function QH({analyticsView:e,setAnalyticsView:t,setSpotlightOpen:s,changedFilesData:i,terminalRef:a,fileTreeSidebarRef:o,onAddWorkspace:c,onImageUpload:d,onQuickAgent:f,onQuickTerminal:h,onCustomize:g,onNewWorktree:_,onFixConflicts:y,onPrAction:b,onOpenPrSession:S,onArchive:w,onSelectSession:k,onCloseSession:T}){const D=fe(_e=>_e.openSidebar),N=fe(_e=>_e.keyboardOpen),E=fe(_e=>_e.activeRepoPath),M=fe(_e=>_e.rightSidebarCollapsed),U=fe(_e=>_e.rightSidebarWidth),W=fe(_e=>_e.saveRightSidebarWidth),B=fe(_e=>_e.fileViewerRatio),$=fe(_e=>_e.saveFileViewerRatio),Y=fe(_e=>_e.openFileTabs),K=fe(_e=>_e.openFileTab),X=fe(_e=>_e.setActiveRepoPath),P=se(_e=>_e.setActiveSessionId),j=se(_e=>_e.recallSessionForWorkspace),H=se(_e=>_e.sessions),O=se(_e=>_e.repos),z=se(_e=>_e.activeSessionId),Q=se(_e=>_e.isItemLoading),[re,ne]=C.useState(!1),A=C.useMemo(()=>E?O.find(_e=>_e.path===E):void 0,[E,O]),I=C.useMemo(()=>z?H.find(_e=>_e.id===z):void 0,[z,H]),q=C.useMemo(()=>E?se.getState().getSessionsForRepo(E):[],[E,H]),oe=C.useMemo(()=>(I?q.filter(_e=>_e.cwd===I.cwd):q).toSorted((_e,ws)=>new Date(_e.createdAt).getTime()-new Date(ws.createdAt).getTime()),[I,q]),ve=C.useMemo(()=>!!I&&!!E&&I.repoPath===E,[I,E]),Se=C.useMemo(()=>(I==null?void 0:I.displayName)||(A==null?void 0:A.name)||"Relay",[I,A]),Ne=C.useMemo(()=>(I==null?void 0:I.useTmux)??!1,[I]),ze=C.useMemo(()=>(I==null?void 0:I.worktreePath)??(I==null?void 0:I.repoPath)??"",[I]),De=C.useMemo(()=>Y.length>0,[Y]),le=C.useMemo(()=>e!==null?"analytics":O.length?E?ve?"session":"dashboard":"org":"empty",[e,O.length,E,ve]),Ee=C.useCallback(_e=>{mi(_e)},[]),we=C.useCallback(()=>{},[]),Re=C.useCallback(()=>{},[]),pt=C.useCallback(_e=>{mi(_e+" ")},[]),Ks=C.useCallback(_e=>{ne(_e)},[]),An=C.useCallback(()=>{var _e;(_e=a.current)==null||_e.exitCopyMode()},[a]),ka=C.useCallback(()=>{var _e;(_e=a.current)==null||_e.focusTerm()},[a]),Ea=C.useCallback(()=>{const _e=document.createElement("input");_e.type="file",_e.accept="image/*",_e.onchange=()=>{var Cs,bt;const ws=(Cs=_e.files)==null?void 0:Cs[0];ws&&((bt=a.current)==null||bt.handleImageUpload(ws,ws.type))},_e.click()},[a]),Rn=C.useCallback((_e,ws)=>{K(_e,ws)},[K]),qi=C.useCallback(_e=>{const ws=se.getState().activeSessionId,Cs=ws?se.getState().sessions.find(Ta=>Ta.id===ws):void 0,bt=(Cs==null?void 0:Cs.worktreePath)??(Cs==null?void 0:Cs.repoPath)??"";if(!bt)return;let Ei=_e;if(_e.startsWith(bt+"/"))Ei=_e.slice(bt.length+1);else{if(_e.startsWith("/"))return;_e.startsWith("./")&&(Ei=_e.slice(2))}for(;Ei.startsWith("./");)Ei=Ei.slice(2);K(Ei,!1)},[K]);return p.jsxs("div",{className:"terminal-area",children:[p.jsx(ZB,{title:Se,onMenuClick:D,onCommandClick:()=>s(!0),hidden:N}),le==="empty"&&p.jsx(XB,{heading:"Add a workspace to get started",description:"Point to any folder on your machine. Git repos get PR tracking and branch management.",actionLabel:"+ Add Workspace",onAction:c}),le==="org"&&p.jsx(YB,{onOpenWorkspace:_e=>{t(null),X(_e),P(j(_e))},onOpenSession:_e=>{t(null),P(_e)}}),le==="analytics"&&p.jsx(p.Fragment,{children:typeof e=="object"&&e!==null&&"sessionId"in e?p.jsx(W3,{sessionId:e.sessionId,onBack:()=>t("dashboard")}):p.jsx(B3,{onSelectSession:_e=>t({sessionId:_e}),onClose:()=>t(null)})}),le==="dashboard"&&p.jsx(IB,{repoPath:E??"",workspaceName:(A==null?void 0:A.name)??"",creatingWorktree:Q(`new-worktree:${E??""}`),onNewSession:()=>f(),onNewWorktree:()=>{A&&_(A)},onFixConflicts:y,onPrAction:b,onOpenPrSession:S}),le==="session"&&p.jsxs(p.Fragment,{children:[p.jsx(kB,{workspacePath:E??"",branchName:(I==null?void 0:I.branchName)??"",sessionId:z,agentRunning:(I==null?void 0:I.agentState)==="processing",onArchive:w}),p.jsx(qH,{fileViewerOpen:De,rightSidebarCollapsed:M,rightSidebarWidth:U,fileViewerRatio:B,onRightSidebarWidthChange:W,onFileViewerRatioChange:$,terminal:p.jsxs(p.Fragment,{children:[p.jsx(RB,{sessions:oe,activeSessionId:z,onSelectSession:k,onCloseSession:T,onNewAgent:()=>f(),onNewTerminal:()=>h(),onCustomize:()=>g()}),p.jsx(uB,{ref:a,sessionId:z,onImageUpload:d,useTmux:Ne,onCopyModeChange:Ks,onFilePathClick:qi}),z&&p.jsx(n5,{sessionId:z,currentActivity:(I==null?void 0:I.currentActivity)??null}),p.jsx(QB,{onSendKey:Ee,onFlushComposedText:we,onClearInput:Re,onUploadImage:Ea,onRefocusMobileInput:ka,useTmux:Ne,inCopyMode:re,onExitCopyMode:An})]}),fileViewer:p.jsx(FH,{workspacePath:ze,onInjectReference:pt}),rightSidebar:p.jsx(XH,{ref:o,workspacePath:ze,changedFilesData:i,onFileSelect:Rn})})]})]})}function ZH(){const e=Jl(ge=>ge.checking),t=Jl(ge=>ge.authenticated),s=Jl(ge=>ge.needsSetup),i=Jl(ge=>ge.checkExistingAuth),a=fe(ge=>ge.sidebarOpen);fe(ge=>ge.openSidebar);const o=fe(ge=>ge.closeSidebar),c=fe(ge=>ge.activeRepoPath),d=fe(ge=>ge.setActiveRepoPath),f=fe(ge=>ge.fullPageDiff),h=fe(ge=>ge.lastChangedFiles),g=fe(ge=>ge.openFileTabs),_=fe(ge=>ge.openFileTab),y=se(ge=>ge.sessions),b=se(ge=>ge.repos),S=se(ge=>ge.activeSessionId),w=se(ge=>ge.setActiveSessionId),k=se(ge=>ge.recallSessionForWorkspace),T=dh(ge=>ge.bootComplete),D=dh(ge=>ge.startBoot),N=dh(ge=>ge.reportFetch),E=dh(ge=>ge.finishBoot),[M,U]=C.useState(!0),[W,B]=C.useState(!1),[$,Y]=C.useState(!1),[K,X]=C.useState(!1),[P,j]=C.useState([]),[H,O]=C.useState(null),z=C.useRef(null),Q=C.useRef(null),re=C.useRef(null),ne=C.useRef(null),A=C.useRef(null),I=C.useRef(null),q=C.useRef(null),oe=C.useRef(null),ve=C.useRef(null),Se=C.useRef(null),Ne=C.useRef(!1),ze=C.useMemo(()=>S?y.find(ge=>ge.id===S):void 0,[S,y]),De=C.useMemo(()=>(ze==null?void 0:ze.worktreePath)??(ze==null?void 0:ze.repoPath)??"",[ze]),le=C.useMemo(()=>{if(S){const ge={view:"session",sessionId:S};return c&&(ge.workspacePath=c),ge}return c?{view:"workspace",workspacePath:c}:{view:"dashboard"}},[S,c]),Ee=C.useRef(le);C.useEffect(()=>{Ee.current=le},[le]);const{navigateToDashboard:we,navigateToSession:Re,handleRenameActiveSession:pt,handleSelectSession:Ks,handleQuickAgent:An,handleQuickTerminal:ka,handleCustomize:Ea,handleOpenSettings:Rn,handleNewWorktree:qi,handleLaunchWorkspaceSession:_e,handleFixConflicts:ws,handleOpenPrBranch:Cs,handleArchive:bt,handlePrAction:Ei,handleOpenPrSession:Ta,handleDeleteWorktree:$c,handleNewSessionCreated:Na,handleCloseSession:Ko}=cM({terminalRef:z,customizeDialogRef:re,settingsDialogRef:ne,deleteWorktreeDialogRef:A,addWorkspaceDialogRef:I,workspaceSettingsDialogRef:q,setAnalyticsView:O});C.useEffect(()=>(gc=Re,()=>{gc=null}),[Re]);const Vc=C.useCallback((ge,Ni,Gc)=>{var _i,Ai;(_i=Q.current)==null||_i.show(ge,Ni,Gc),Ni||(Ai=Q.current)==null||Ai.autoDismiss(3e3)},[]),Fd=C.useCallback(ge=>{ge.repoPath&&(fe.getState().setActiveRepoPath(ge.repoPath),se.getState().setActiveSessionId(null)),Cs(ge)},[Cs]),Wc=C.useCallback(()=>{var ge;(ge=I.current)==null||ge.open()},[]),Er=C.useCallback(async ge=>{await se.getState().refreshAll(),ge.length>0&&fe.getState().setActiveRepoPath(ge[0])},[]),gs=C.useCallback(()=>{Se.current||(Se.current=setTimeout(()=>{var ge;Se.current=null,(ge=ve.current)==null||ge.refresh()},2e3))},[]),Ti=C.useCallback(()=>{O("dashboard")},[]);C.useEffect(()=>{if(T){const ge=setTimeout(()=>U(!1),300);return()=>clearTimeout(ge)}},[T]),C.useEffect(()=>()=>{Se.current&&clearTimeout(Se.current)},[]);const Gt=C.useRef(void 0);return C.useEffect(()=>{if(Gt.current===void 0){Gt.current=S;return}S!==Gt.current&&(Gt.current=S,S?Rg("navigation","page.view","/terminal",void 0,S):Rg("navigation","page.view","/dashboard",{workspace:fe.getState().activeRepoPath}))},[S]),C.useEffect(()=>{if(!t)return;const ge=!Ne.current;ge&&(Ne.current=!0,N("auth","ok")),(async()=>{await se.getState().refreshAll(ge?N:void 0),await Sr.getState().refreshTelemetry(),ge&&(E(),se.getState().enrichSidebarBranches());const _i=new URLSearchParams(window.location.search).get("session");_i&&(window.history.replaceState({},"","/"),Re(_i,"repo"));const Ai=se.getState().sessions;!se.getState().activeSessionId&&!_i&&Ai.length===1&&Ks(Ai[0].id);for(const Ki of se.getState().sessions)se.getState().initSessionNotification(Ki.id,Gs.getState().defaultNotifications);eD().then(()=>{sD(se.getState().getNotificationSessionIds())})})()},[t]),PD({authAuthenticated:t,queryClient:PC,throttledChangedFilesRefresh:gs,setChangedFilesData:j}),rM({handleQuickAgent:An,handleQuickTerminal:ka,handleCloseSession:Ko,handleSelectSession:Ks,handleNewWorktree:qi,handleOpenSettings:Rn,handleRenameActiveSession:pt,navigateToDashboard:we,customizeDialogRef:re,settingsDialogRef:ne,deleteWorktreeDialogRef:A,addWorkspaceDialogRef:I,workspaceSettingsDialogRef:q,terminalRef:z,setFilePickerOpen:X}),QD({handleSelectSession:Ks,setSpotlightOpen:B,setPickerOpen:Y,setFilePickerOpen:X,mainAppRef:oe,terminalRef:z,actionContextRef:Ee}),C.useEffect(()=>(OD(()=>se.getState().activeSessionId),D(),i(),()=>{jD()}),[]),e||t&&M?p.jsx(uM,{}):!t||s?p.jsx(pM,{}):p.jsxs(AR,{client:PC,children:[p.jsxs("div",{className:"main-app",ref:oe,children:[a&&p.jsx("div",{className:"sidebar-overlay",onClick:o}),p.jsx(kM,{onSelectSession:Ks,onOpenSettings:Rn,onNewWorktree:qi,onAddWorkspace:Wc,onDeleteSession:Ko,onDeleteWorktree:$c,onLaunchWorkspaceSession:_e,onOpenAnalytics:Ti}),p.jsx(QH,{analyticsView:H,setAnalyticsView:O,setSpotlightOpen:B,changedFilesData:P,terminalRef:z,fileTreeSidebarRef:ve,onAddWorkspace:Wc,onImageUpload:Vc,onQuickAgent:An,onQuickTerminal:ka,onCustomize:Ea,onNewWorktree:qi,onFixConflicts:ws,onPrAction:Ei,onOpenPrSession:Ta,onArchive:bt,onSelectSession:Ks,onCloseSession:Ko})]}),p.jsx(K5,{ref:re,onSessionCreated:Na}),p.jsx(h3,{ref:ne}),p.jsx(g3,{ref:A}),p.jsx(b3,{ref:I,onWorkspacesAdded:Er}),p.jsx(A3,{ref:q,onRemoveWorkspace:async ge=>{await fetch("/workspaces",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:ge})}),await se.getState().refreshAll(),fe.getState().activeRepoPath===ge&&fe.getState().setActiveRepoPath(null)}}),f&&p.jsx("div",{className:"full-page-diff-overlay",children:p.jsx(rI,{workspacePath:f.workspacePath,...f.file!==void 0?{initialFile:f.file}:{},...f.base!==void 0?{initialBase:f.base}:{},onClose:()=>fe.setState({fullPageDiff:null})})}),p.jsx(v5,{open:W,workspaces:b,sessions:y,actionContext:le,onClose:()=>B(!1),onSelectWorkspace:ge=>{d(ge),w(k(ge)),o()},onSelectSession:ge=>Ks(ge),onSelectPr:Fd,onOpenSettings:ge=>{var Ni;B(!1),(Ni=ne.current)==null||Ni.open(ge)}}),$&&p.jsx(b5,{items:[],onSelect:()=>Y(!1),onClose:()=>Y(!1)}),p.jsx(F5,{open:K,workspacePath:De,changedFiles:h,recentFiles:g,onClose:()=>X(!1),onSelect:(ge,Ni)=>{_(ge,Ni),X(!1)}}),p.jsx(r5,{}),p.jsx(a5,{ref:Q}),p.jsx(l5,{})]})}iR.createRoot(document.getElementById("app")).render(p.jsx(qe.StrictMode,{children:p.jsx(ZH,{})}));
|