@rynx-ai/server 0.1.11-beta.24 → 0.1.11-beta.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/control-api.js +492 -69
- package/dist/control-web/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/dist/control-web/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/dist/control-web/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/dist/control-web/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/dist/control-web/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/dist/control-web/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/dist/control-web/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/dist/control-web/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/dist/control-web/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/dist/control-web/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/dist/control-web/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/dist/control-web/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/dist/control-web/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/dist/control-web/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/dist/control-web/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/dist/control-web/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/dist/control-web/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/dist/control-web/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/dist/control-web/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/dist/control-web/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/dist/control-web/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/dist/control-web/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/dist/control-web/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/dist/control-web/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/dist/control-web/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/dist/control-web/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/dist/control-web/assets/abap-BdImnpbu.js +1 -0
- package/dist/control-web/assets/abnfDiagram-VRR7QNED-COu02MlJ.js +1 -0
- package/dist/control-web/assets/actionscript-3-CoDkCxhg.js +1 -0
- package/dist/control-web/assets/ada-bCR0ucgS.js +1 -0
- package/dist/control-web/assets/andromeeda-C4gqWexZ.js +1 -0
- package/dist/control-web/assets/angular-html-CU67Zn6k.js +1 -0
- package/dist/control-web/assets/angular-ts-BwZT4LLn.js +1 -0
- package/dist/control-web/assets/apache-Pmp26Uib.js +1 -0
- package/dist/control-web/assets/apex-D8_7TLub.js +1 -0
- package/dist/control-web/assets/apl-dKokRX4l.js +1 -0
- package/dist/control-web/assets/applescript-Co6uUVPk.js +1 -0
- package/dist/control-web/assets/ara-BRHolxvo.js +1 -0
- package/dist/control-web/assets/arc-DqiFeYAM.js +1 -0
- package/dist/control-web/assets/architectureDiagram-ZJ3FMSHR-BWFGgUV4.js +36 -0
- package/dist/control-web/assets/asciidoc-Ve4PFQV2.js +1 -0
- package/dist/control-web/assets/asm-D_Q5rh1f.js +1 -0
- package/dist/control-web/assets/astro-CbQHKStN.js +1 -0
- package/dist/control-web/assets/aurora-x-D-2ljcwZ.js +1 -0
- package/dist/control-web/assets/awk-DMzUqQB5.js +1 -0
- package/dist/control-web/assets/ayu-dark-DYE7WIF3.js +1 -0
- package/dist/control-web/assets/ayu-light-BA47KaF1.js +1 -0
- package/dist/control-web/assets/ayu-mirage-32ctXXKs.js +1 -0
- package/dist/control-web/assets/ballerina-BFfxhgS-.js +1 -0
- package/dist/control-web/assets/bat-BkioyH1T.js +1 -0
- package/dist/control-web/assets/beancount-k_qm7-4y.js +1 -0
- package/dist/control-web/assets/berry-uYugtg8r.js +1 -0
- package/dist/control-web/assets/bibtex-CHM0blh-.js +1 -0
- package/dist/control-web/assets/bicep-Bmn6On1c.js +1 -0
- package/dist/control-web/assets/bird2-DPOp833l.js +1 -0
- package/dist/control-web/assets/blade-D4QpJJKB.js +1 -0
- package/dist/control-web/assets/blockDiagram-677ZJIJ3-ZC0bXDzB.js +132 -0
- package/dist/control-web/assets/bsl-BO_Y6i37.js +1 -0
- package/dist/control-web/assets/c-BIGW1oBm.js +1 -0
- package/dist/control-web/assets/c3-eo99z4R2.js +1 -0
- package/dist/control-web/assets/c4Diagram-LMCZKHZV-Uupq5I-s.js +10 -0
- package/dist/control-web/assets/cadence-Bv_4Rxtq.js +1 -0
- package/dist/control-web/assets/cairo-KRGpt6FW.js +1 -0
- package/dist/control-web/assets/catppuccin-frappe-DFWUc33u.js +1 -0
- package/dist/control-web/assets/catppuccin-latte-C9dUb6Cb.js +1 -0
- package/dist/control-web/assets/catppuccin-macchiato-DQyhUUbL.js +1 -0
- package/dist/control-web/assets/catppuccin-mocha-D87Tk5Gz.js +1 -0
- package/dist/control-web/assets/channel-3HG15wfa.js +1 -0
- package/dist/control-web/assets/chunk-2Q5K7J3B-C77vwuDM.js +1 -0
- package/dist/control-web/assets/chunk-32BRIVSS-BkfLE_TX.js +1 -0
- package/dist/control-web/assets/chunk-5VM5RSS4-By6zfDWW.js +15 -0
- package/dist/control-web/assets/chunk-EX3LRPZG-CO439p_3.js +231 -0
- package/dist/control-web/assets/chunk-JWPE2WC7-B9BPEwug.js +1 -0
- package/dist/control-web/assets/chunk-MOJQB5TN-CYKygWZz.js +88 -0
- package/dist/control-web/assets/chunk-RYQCIY6F-ug-An4HG.js +1 -0
- package/dist/control-web/assets/chunk-V7JOEXUC-3UFQGnKX.js +206 -0
- package/dist/control-web/assets/chunk-VR4S4FIN-DjspjYUb.js +1 -0
- package/dist/control-web/assets/chunk-XXDRQBXY-3znnutie.js +1 -0
- package/dist/control-web/assets/clarity-D53aC0YG.js +1 -0
- package/dist/control-web/assets/classDiagram-OUVF2IWQ-WmU4L9YT.js +1 -0
- package/dist/control-web/assets/classDiagram-v2-EOCWNBFH-WmU4L9YT.js +1 -0
- package/dist/control-web/assets/clojure-P80f7IUj.js +1 -0
- package/dist/control-web/assets/cmake-D1j8_8rp.js +1 -0
- package/dist/control-web/assets/cobol-nwyudZeR.js +1 -0
- package/dist/control-web/assets/codeowners-Bp6g37R7.js +1 -0
- package/dist/control-web/assets/codeql-DsOJ9woJ.js +1 -0
- package/dist/control-web/assets/coffee-Ch7k5sss.js +1 -0
- package/dist/control-web/assets/common-lisp-Cg-RD9OK.js +1 -0
- package/dist/control-web/assets/coq-DkFqJrB1.js +1 -0
- package/dist/control-web/assets/cose-bilkent-JH36ORCC-Dr28goCd.js +1 -0
- package/dist/control-web/assets/cpp-CofmeUqb.js +1 -0
- package/dist/control-web/assets/crystal-tKQVLTB8.js +1 -0
- package/dist/control-web/assets/csharp-COcwbKMJ.js +1 -0
- package/dist/control-web/assets/css-DPfMkruS.js +1 -0
- package/dist/control-web/assets/csv-fuZLfV_i.js +1 -0
- package/dist/control-web/assets/cue-D82EKSYY.js +1 -0
- package/dist/control-web/assets/cynefin-VYW2F7L2-Be5uJhnw.js +178 -0
- package/dist/control-web/assets/cynefinDiagram-TSTJHNR4-BLxtSvL6.js +62 -0
- package/dist/control-web/assets/cypher-COkxafJQ.js +1 -0
- package/dist/control-web/assets/cytoscape.esm-DTSO7Bv0.js +331 -0
- package/dist/control-web/assets/d-85-TOEBH.js +1 -0
- package/dist/control-web/assets/dagre-VKFMJZFB-DPRuDV5p.js +4 -0
- package/dist/control-web/assets/dark-plus-C3mMm8J8.js +1 -0
- package/dist/control-web/assets/dart-CF10PKvl.js +1 -0
- package/dist/control-web/assets/dax-CEL-wOlO.js +1 -0
- package/dist/control-web/assets/defaultLocale-DX6XiGOO.js +1 -0
- package/dist/control-web/assets/desktop-BmXAJ9_W.js +1 -0
- package/dist/control-web/assets/diagram-FQU43EPY-Cybg22U0.js +3 -0
- package/dist/control-web/assets/diagram-G47NLZAW-CGeIKUfW.js +24 -0
- package/dist/control-web/assets/diagram-NH7WQ7WH-BJq5MBRm.js +24 -0
- package/dist/control-web/assets/diagram-OA4YK3LP-DquOQGwg.js +30 -0
- package/dist/control-web/assets/diagram-WEI45ONY-Cblb4xP2.js +41 -0
- package/dist/control-web/assets/diff-D97Zzqfu.js +1 -0
- package/dist/control-web/assets/docker-BcOcwvcX.js +1 -0
- package/dist/control-web/assets/dotenv-Da5cRb03.js +1 -0
- package/dist/control-web/assets/dracula-BzJJZx-M.js +1 -0
- package/dist/control-web/assets/dracula-soft-BXkSAIEj.js +1 -0
- package/dist/control-web/assets/dream-maker-BtqSS_iP.js +1 -0
- package/dist/control-web/assets/ebnfDiagram-CCIWWBDH-CQjHiOqj.js +1 -0
- package/dist/control-web/assets/edge-BkV0erSs.js +1 -0
- package/dist/control-web/assets/elixir-CDX3lj18.js +1 -0
- package/dist/control-web/assets/elm-DbKCFpqz.js +1 -0
- package/dist/control-web/assets/emacs-lisp-C9XAeP06.js +1 -0
- package/dist/control-web/assets/erDiagram-Q63AITRT-Bspr3uKJ.js +85 -0
- package/dist/control-web/assets/erb-B12qg9BL.js +1 -0
- package/dist/control-web/assets/erlang-DsQrWhSR.js +1 -0
- package/dist/control-web/assets/everforest-dark-BgDCqdQA.js +1 -0
- package/dist/control-web/assets/everforest-light-C8M2exoo.js +1 -0
- package/dist/control-web/assets/fennel-BYunw83y.js +1 -0
- package/dist/control-web/assets/fish-BvzEVeQv.js +1 -0
- package/dist/control-web/assets/flowDiagram-23GEKE2U-CxcZyBA-.js +156 -0
- package/dist/control-web/assets/fluent-C4IJs8-o.js +1 -0
- package/dist/control-web/assets/fortran-fixed-form-CkoXwp7k.js +1 -0
- package/dist/control-web/assets/fortran-free-form-BxgE0vQu.js +1 -0
- package/dist/control-web/assets/fsharp-CXgrBDvD.js +1 -0
- package/dist/control-web/assets/ganttDiagram-NO4QXBWP-qBdh7A-P.js +292 -0
- package/dist/control-web/assets/gdresource-BOOCDP_w.js +1 -0
- package/dist/control-web/assets/gdscript-C5YyOfLZ.js +1 -0
- package/dist/control-web/assets/gdshader-DkwncUOv.js +1 -0
- package/dist/control-web/assets/genie-D0YGMca9.js +1 -0
- package/dist/control-web/assets/gherkin-DyxjwDmM.js +1 -0
- package/dist/control-web/assets/git-commit-F4YmCXRG.js +1 -0
- package/dist/control-web/assets/git-rebase-r7XF79zn.js +1 -0
- package/dist/control-web/assets/gitGraphDiagram-IHSO6WYX-BTYub2KT.js +106 -0
- package/dist/control-web/assets/github-dark-DHJKELXO.js +1 -0
- package/dist/control-web/assets/github-dark-default-Cuk6v7N8.js +1 -0
- package/dist/control-web/assets/github-dark-dimmed-DH5Ifo-i.js +1 -0
- package/dist/control-web/assets/github-dark-high-contrast-E3gJ1_iC.js +1 -0
- package/dist/control-web/assets/github-light-DAi9KRSo.js +1 -0
- package/dist/control-web/assets/github-light-default-D7oLnXFd.js +1 -0
- package/dist/control-web/assets/github-light-high-contrast-BfjtVDDH.js +1 -0
- package/dist/control-web/assets/gleam-BspZqrRM.js +1 -0
- package/dist/control-web/assets/glimmer-js-Rg0-pVw9.js +1 -0
- package/dist/control-web/assets/glimmer-ts-U6CK756n.js +1 -0
- package/dist/control-web/assets/glsl-DplSGwfg.js +1 -0
- package/dist/control-web/assets/gn-n2N0HUVH.js +1 -0
- package/dist/control-web/assets/gnuplot-DdkO51Og.js +1 -0
- package/dist/control-web/assets/go-CxLEBnE3.js +1 -0
- package/dist/control-web/assets/graph-C9eacEi8.js +1 -0
- package/dist/control-web/assets/graphql-ChdNCCLP.js +1 -0
- package/dist/control-web/assets/groovy-gcz8RCvz.js +1 -0
- package/dist/control-web/assets/gruvbox-dark-hard-CFHQjOhq.js +1 -0
- package/dist/control-web/assets/gruvbox-dark-medium-GsRaNv29.js +1 -0
- package/dist/control-web/assets/gruvbox-dark-soft-CVdnzihN.js +1 -0
- package/dist/control-web/assets/gruvbox-light-hard-CH1njM8p.js +1 -0
- package/dist/control-web/assets/gruvbox-light-medium-DRw_LuNl.js +1 -0
- package/dist/control-web/assets/gruvbox-light-soft-hJgmCMqR.js +1 -0
- package/dist/control-web/assets/hack-CaT9iCJl.js +1 -0
- package/dist/control-web/assets/haml-B8DHNrY2.js +1 -0
- package/dist/control-web/assets/handlebars-BL8al0AC.js +1 -0
- package/dist/control-web/assets/haskell-Df6bDoY_.js +1 -0
- package/dist/control-web/assets/haxe-CzTSHFRz.js +1 -0
- package/dist/control-web/assets/hcl-BWvSN4gD.js +1 -0
- package/dist/control-web/assets/{highlighted-body-OFNGDK62-DV5jYwcf.js → highlighted-body-OFNGDK62-DyksUrwu.js} +1 -1
- package/dist/control-web/assets/hjson-D5-asLiD.js +1 -0
- package/dist/control-web/assets/hlsl-D3lLCCz7.js +1 -0
- package/dist/control-web/assets/horizon-BUw7H-hv.js +1 -0
- package/dist/control-web/assets/horizon-bright-Cn-bp-IR.js +1 -0
- package/dist/control-web/assets/houston-DnULxvSX.js +1 -0
- package/dist/control-web/assets/html-GMplVEZG.js +1 -0
- package/dist/control-web/assets/html-derivative-BFtXZ54Q.js +1 -0
- package/dist/control-web/assets/http-jrhK8wxY.js +1 -0
- package/dist/control-web/assets/hurl-irOxFIW8.js +1 -0
- package/dist/control-web/assets/hxml-Bvhsp5Yf.js +1 -0
- package/dist/control-web/assets/hy-DFXneXwc.js +1 -0
- package/dist/control-web/assets/imba-DGztddWO.js +1 -0
- package/dist/control-web/assets/index-B9SAq_63.js +718 -0
- package/dist/control-web/assets/index-BDaSctIT.js +153 -0
- package/dist/control-web/assets/index-CtaYRNgJ.css +32 -0
- package/dist/control-web/assets/infoDiagram-FWYZ7A6U-ChbQR3Zo.js +2 -0
- package/dist/control-web/assets/ini-BEwlwnbL.js +1 -0
- package/dist/control-web/assets/init-Gi6I4Gst.js +1 -0
- package/dist/control-web/assets/ishikawaDiagram-FXEZZL3T-C-4_qGzn.js +70 -0
- package/dist/control-web/assets/java-CylS5w8V.js +1 -0
- package/dist/control-web/assets/javascript-wDzz0qaB.js +1 -0
- package/dist/control-web/assets/jinja-4LBKfQ-Z.js +1 -0
- package/dist/control-web/assets/jison-wvAkD_A8.js +1 -0
- package/dist/control-web/assets/journeyDiagram-5HDEW3XC-B090zN18.js +139 -0
- package/dist/control-web/assets/json-Cp-IABpG.js +1 -0
- package/dist/control-web/assets/json5-C9tS-k6U.js +1 -0
- package/dist/control-web/assets/jsonc-Des-eS-w.js +1 -0
- package/dist/control-web/assets/jsonl-DcaNXYhu.js +1 -0
- package/dist/control-web/assets/jsonnet-DFQXde-d.js +1 -0
- package/dist/control-web/assets/jssm-C2t-YnRu.js +1 -0
- package/dist/control-web/assets/jsx-g9-lgVsj.js +1 -0
- package/dist/control-web/assets/julia-CxzCAyBv.js +1 -0
- package/dist/control-web/assets/just-Cw27pwNe.js +1 -0
- package/dist/control-web/assets/kanagawa-dragon-CkXjmgJE.js +1 -0
- package/dist/control-web/assets/kanagawa-lotus-CfQXZHmo.js +1 -0
- package/dist/control-web/assets/kanagawa-wave-DWedfzmr.js +1 -0
- package/dist/control-web/assets/kanban-definition-HUTT4EX6-RlTcRbPs.js +89 -0
- package/dist/control-web/assets/kdl-DV7GczEv.js +1 -0
- package/dist/control-web/assets/kotlin-BdnUsdx6.js +1 -0
- package/dist/control-web/assets/kusto-DZf3V79B.js +1 -0
- package/dist/control-web/assets/laserwave-DUszq2jm.js +1 -0
- package/dist/control-web/assets/latex-CWtU0Tv5.js +1 -0
- package/dist/control-web/assets/layout-DEXfKzaS.js +1 -0
- package/dist/control-web/assets/lean-BZvkOJ9d.js +1 -0
- package/dist/control-web/assets/less-B1dDrJ26.js +1 -0
- package/dist/control-web/assets/light-plus-B7mTdjB0.js +1 -0
- package/dist/control-web/assets/linear-DTuNxDqu.js +1 -0
- package/dist/control-web/assets/liquid-DYVedYrR.js +1 -0
- package/dist/control-web/assets/llvm-DjAJT7YJ.js +1 -0
- package/dist/control-web/assets/log-2UxHyX5q.js +1 -0
- package/dist/control-web/assets/logo-BtOb2qkB.js +1 -0
- package/dist/control-web/assets/lua-BaeVxFsk.js +1 -0
- package/dist/control-web/assets/luau-C-HG3fhB.js +1 -0
- package/dist/control-web/assets/make-CHLpvVh8.js +1 -0
- package/dist/control-web/assets/map-Czzmt4hB.js +1 -0
- package/dist/control-web/assets/markdown-Cvjx9yec.js +1 -0
- package/dist/control-web/assets/marko-CnJfTvn9.js +1 -0
- package/dist/control-web/assets/material-theme-D5KoaKCx.js +1 -0
- package/dist/control-web/assets/material-theme-darker-BfHTSMKl.js +1 -0
- package/dist/control-web/assets/material-theme-lighter-B0m2ddpp.js +1 -0
- package/dist/control-web/assets/material-theme-ocean-CyktbL80.js +1 -0
- package/dist/control-web/assets/material-theme-palenight-Csfq5Kiy.js +1 -0
- package/dist/control-web/assets/matlab-D7o27uSR.js +1 -0
- package/dist/control-web/assets/mdc-BMNejdWA.js +1 -0
- package/dist/control-web/assets/mdx-Cmh6b_Ma.js +1 -0
- package/dist/control-web/assets/mermaid-GHXKKRXX-BYZTj3zW.css +1 -0
- package/dist/control-web/assets/mermaid-GHXKKRXX-BkcV3dgg.js +710 -0
- package/dist/control-web/assets/mermaid-mWjccvbQ.js +1 -0
- package/dist/control-web/assets/min-dark-CafNBF8u.js +1 -0
- package/dist/control-web/assets/min-light-CTRr51gU.js +1 -0
- package/dist/control-web/assets/mindmap-definition-LN4V7U3C-DYby41E9.js +96 -0
- package/dist/control-web/assets/mipsasm-CKIfxQSi.js +1 -0
- package/dist/control-web/assets/mojo-rZm6bMo-.js +1 -0
- package/dist/control-web/assets/monokai-D4h5O-jR.js +1 -0
- package/dist/control-web/assets/moonbit-_H4v1dQx.js +1 -0
- package/dist/control-web/assets/move-IF9eRakj.js +1 -0
- package/dist/control-web/assets/narrat-DRg8JJMk.js +1 -0
- package/dist/control-web/assets/nextflow-Zz6hmt5N.js +1 -0
- package/dist/control-web/assets/nextflow-groovy-BeH2EWoN.js +1 -0
- package/dist/control-web/assets/nginx-BpAMiNFr.js +1 -0
- package/dist/control-web/assets/night-owl-C39BiMTA.js +1 -0
- package/dist/control-web/assets/night-owl-light-CMTm3GFP.js +1 -0
- package/dist/control-web/assets/nim-CVrawwO9.js +1 -0
- package/dist/control-web/assets/nix-CwoSXNpI.js +1 -0
- package/dist/control-web/assets/nord-Ddv68eIx.js +1 -0
- package/dist/control-web/assets/nushell-Cz2AlsmD.js +1 -0
- package/dist/control-web/assets/objective-c-DXmwc3jG.js +1 -0
- package/dist/control-web/assets/objective-cpp-CLxacb5B.js +1 -0
- package/dist/control-web/assets/ocaml-C0hk2d4L.js +1 -0
- package/dist/control-web/assets/odin-BBf5iR-q.js +1 -0
- package/dist/control-web/assets/one-dark-pro-DVMEJ2y_.js +1 -0
- package/dist/control-web/assets/one-light-C3Wv6jpd.js +1 -0
- package/dist/control-web/assets/openscad-C4EeE6gA.js +1 -0
- package/dist/control-web/assets/ordinal-Cboi1Yqb.js +1 -0
- package/dist/control-web/assets/pascal-D93ZcfNL.js +1 -0
- package/dist/control-web/assets/pegDiagram-2B236MQR-CPK6GaEv.js +1 -0
- package/dist/control-web/assets/perl-C0TMdlhV.js +1 -0
- package/dist/control-web/assets/php-Dhbhpdrm.js +1 -0
- package/dist/control-web/assets/pieDiagram-ENE6RG2P-DLCmXuji.js +39 -0
- package/dist/control-web/assets/pkl-u5AG7uiY.js +1 -0
- package/dist/control-web/assets/plastic-3e1v2bzS.js +1 -0
- package/dist/control-web/assets/plsql-ChMvpjG-.js +1 -0
- package/dist/control-web/assets/po-BTJTHyun.js +1 -0
- package/dist/control-web/assets/poimandres-CS3Unz2-.js +1 -0
- package/dist/control-web/assets/polar-C0HS_06l.js +1 -0
- package/dist/control-web/assets/postcss-CXtECtnM.js +1 -0
- package/dist/control-web/assets/powerquery-CEu0bR-o.js +1 -0
- package/dist/control-web/assets/powershell-Dpen1YoG.js +1 -0
- package/dist/control-web/assets/prisma-Dd19v3D-.js +1 -0
- package/dist/control-web/assets/prolog-CbFg5uaA.js +1 -0
- package/dist/control-web/assets/proto-C7zT0LnQ.js +1 -0
- package/dist/control-web/assets/pug-CGlum2m_.js +1 -0
- package/dist/control-web/assets/puppet-BMWR74SV.js +1 -0
- package/dist/control-web/assets/purescript-CklMAg4u.js +1 -0
- package/dist/control-web/assets/python-B6aJPvgy.js +1 -0
- package/dist/control-web/assets/qml-3beO22l8.js +1 -0
- package/dist/control-web/assets/qmldir-C8lEn-DE.js +1 -0
- package/dist/control-web/assets/qss-IeuSbFQv.js +1 -0
- package/dist/control-web/assets/quadrantDiagram-ABIIQ3AL-RIS8r7CA.js +7 -0
- package/dist/control-web/assets/r-Dspwwk_N.js +1 -0
- package/dist/control-web/assets/racket-BqYA7rlc.js +1 -0
- package/dist/control-web/assets/railroadDiagram-RFXS5EU6-B1HB7xsg.js +1 -0
- package/dist/control-web/assets/raku-DXvB9xmW.js +1 -0
- package/dist/control-web/assets/razor-Uh8Bk_45.js +1 -0
- package/dist/control-web/assets/red-bN70gL4F.js +1 -0
- package/dist/control-web/assets/reg-C-SQnVFl.js +1 -0
- package/dist/control-web/assets/regexp-CDVJQ6XC.js +1 -0
- package/dist/control-web/assets/rel-C3B-1QV4.js +1 -0
- package/dist/control-web/assets/requirementDiagram-TGXJPOKE-Inh_4hU0.js +84 -0
- package/dist/control-web/assets/riscv-BM1_JUlF.js +1 -0
- package/dist/control-web/assets/ron-D8l8udqQ.js +1 -0
- package/dist/control-web/assets/rose-pine-dawn-DHQR4-dF.js +1 -0
- package/dist/control-web/assets/rose-pine-moon-D4_iv3hh.js +1 -0
- package/dist/control-web/assets/rose-pine-qdsjHGoJ.js +1 -0
- package/dist/control-web/assets/rosmsg-BJDFO7_C.js +1 -0
- package/dist/control-web/assets/rst-BrH8l1NY.js +1 -0
- package/dist/control-web/assets/ruby-Dw2BHqvy.js +1 -0
- package/dist/control-web/assets/rust-B1yitclQ.js +1 -0
- package/dist/control-web/assets/sankeyDiagram-HTMAVEWB-DPF33kPB.js +40 -0
- package/dist/control-web/assets/sas-cz2c8ADy.js +1 -0
- package/dist/control-web/assets/sass-Cj5Yp3dK.js +1 -0
- package/dist/control-web/assets/scala-C151Ov-r.js +1 -0
- package/dist/control-web/assets/scheme-C98Dy4si.js +1 -0
- package/dist/control-web/assets/scss-OYdSNvt2.js +1 -0
- package/dist/control-web/assets/sdbl-DVxCFoDh.js +1 -0
- package/dist/control-web/assets/sequenceDiagram-DBY2YBRQ-iywKWoYc.js +162 -0
- package/dist/control-web/assets/shaderlab-Dg9Lc6iA.js +1 -0
- package/dist/control-web/assets/shellscript-Yzrsuije.js +1 -0
- package/dist/control-web/assets/shellsession-BADoaaVG.js +1 -0
- package/dist/control-web/assets/sizeCapture-X5ZJPWSS-DlnHubz9.js +1 -0
- package/dist/control-web/assets/slack-dark-BthQWCQV.js +1 -0
- package/dist/control-web/assets/slack-ochin-DqwNpetd.js +1 -0
- package/dist/control-web/assets/smalltalk-BERRCDM3.js +1 -0
- package/dist/control-web/assets/snazzy-light-Bw305WKR.js +1 -0
- package/dist/control-web/assets/solarized-dark-DXbdFlpD.js +1 -0
- package/dist/control-web/assets/solarized-light-L9t79GZl.js +1 -0
- package/dist/control-web/assets/solidity-rGO070M0.js +1 -0
- package/dist/control-web/assets/soy-Brmx7dQM.js +1 -0
- package/dist/control-web/assets/sparql-rVzFXLq3.js +1 -0
- package/dist/control-web/assets/splunk-BtCnVYZw.js +1 -0
- package/dist/control-web/assets/sql-BLtJtn59.js +1 -0
- package/dist/control-web/assets/ssh-config-_ykCGR6B.js +1 -0
- package/dist/control-web/assets/stata-BH5u7GGu.js +1 -0
- package/dist/control-web/assets/stateDiagram-2N3HPSRC-CShzll2N.js +1 -0
- package/dist/control-web/assets/stateDiagram-v2-6OUMAXLB-Cdx0fWna.js +1 -0
- package/dist/control-web/assets/stylus-BEDo0Tqx.js +1 -0
- package/dist/control-web/assets/surrealql-Bq5Q-fJD.js +1 -0
- package/dist/control-web/assets/svelte-C_ipcX3V.js +1 -0
- package/dist/control-web/assets/swift-D82vCrfD.js +1 -0
- package/dist/control-web/assets/swimlanes-5IMT3BWC-CxlQpFBv.js +2 -0
- package/dist/control-web/assets/swimlanesDiagram-G3AALYLV-CoX0jnUu.js +8 -0
- package/dist/control-web/assets/synthwave-84-CbfX1IO0.js +1 -0
- package/dist/control-web/assets/system-verilog-CnnmHF94.js +1 -0
- package/dist/control-web/assets/systemd-4A_iFExJ.js +1 -0
- package/dist/control-web/assets/talonscript-CkByrt1z.js +1 -0
- package/dist/control-web/assets/tasl-QIJgUcNo.js +1 -0
- package/dist/control-web/assets/tcl-dwOrl1Do.js +1 -0
- package/dist/control-web/assets/templ-P3uqSqPl.js +1 -0
- package/dist/control-web/assets/terraform-BETggiCN.js +1 -0
- package/dist/control-web/assets/tex-idrVyKtj.js +1 -0
- package/dist/control-web/assets/timeline-definition-FHXFAJF6-Dlx59Xc3.js +120 -0
- package/dist/control-web/assets/tokyo-night-hegEt444.js +1 -0
- package/dist/control-web/assets/toml-vGWfd6FD.js +1 -0
- package/dist/control-web/assets/ts-tags-zn1MmPIZ.js +1 -0
- package/dist/control-web/assets/tsv-B_m7g4N7.js +1 -0
- package/dist/control-web/assets/tsx-COt5Ahok.js +1 -0
- package/dist/control-web/assets/turtle-BsS91CYL.js +1 -0
- package/dist/control-web/assets/twig-DNn4PbVi.js +1 -0
- package/dist/control-web/assets/typescript-BPQ3VLAy.js +1 -0
- package/dist/control-web/assets/typespec-BGHnOYBU.js +1 -0
- package/dist/control-web/assets/typst-DHCkPAjA.js +1 -0
- package/dist/control-web/assets/v-BcVCzyr7.js +1 -0
- package/dist/control-web/assets/vala-CsfeWuGM.js +1 -0
- package/dist/control-web/assets/vb-D17OF-Vu.js +1 -0
- package/dist/control-web/assets/vennDiagram-L72KCM5P-DLsv4i_t.js +34 -0
- package/dist/control-web/assets/verilog-BQ8w6xss.js +1 -0
- package/dist/control-web/assets/vesper-DU1UobuO.js +1 -0
- package/dist/control-web/assets/vhdl-CeAyd5Ju.js +1 -0
- package/dist/control-web/assets/viml-CJc9bBzg.js +1 -0
- package/dist/control-web/assets/vitesse-black-Bkuqu6BP.js +1 -0
- package/dist/control-web/assets/vitesse-dark-D0r3Knsf.js +1 -0
- package/dist/control-web/assets/vitesse-light-CVO1_9PV.js +1 -0
- package/dist/control-web/assets/vue-DN_0RTcg.js +1 -0
- package/dist/control-web/assets/vue-html-AaS7Mt5G.js +1 -0
- package/dist/control-web/assets/vue-vine-CQOfvN7w.js +1 -0
- package/dist/control-web/assets/vyper-CDx5xZoG.js +1 -0
- package/dist/control-web/assets/wardleyDiagram-EHGQE667-BazV8fpH.js +78 -0
- package/dist/control-web/assets/wasm-CG6Dc4jp.js +1 -0
- package/dist/control-web/assets/wasm-MzD3tlZU.js +1 -0
- package/dist/control-web/assets/wenyan-BV7otONQ.js +1 -0
- package/dist/control-web/assets/wgsl-Dx-B1_4e.js +1 -0
- package/dist/control-web/assets/wikitext-BhOHFoWU.js +1 -0
- package/dist/control-web/assets/wit-5i3qLPDT.js +1 -0
- package/dist/control-web/assets/wolfram-lXgVvXCa.js +1 -0
- package/dist/control-web/assets/xml-sdJ4AIDG.js +1 -0
- package/dist/control-web/assets/xsl-CtQFsRM5.js +1 -0
- package/dist/control-web/assets/xychartDiagram-FW5EYKEG-Bx9uDlYu.js +7 -0
- package/dist/control-web/assets/yaml-Buea-lGh.js +1 -0
- package/dist/control-web/assets/zenscript-DVFEvuxE.js +1 -0
- package/dist/control-web/assets/zig-VOosw3JB.js +1 -0
- package/dist/control-web/index.html +2 -2
- package/dist/machine-session-service.d.ts +62 -7
- package/dist/machine-session-service.js +559 -18
- package/dist/remote-runtime-dispatcher.d.ts +1 -1
- package/dist/remote-runtime-dispatcher.js +8 -0
- package/dist/remote-runtime-session-projection.js +4 -0
- package/dist/server.d.ts +9 -3
- package/dist/server.js +86 -4
- package/dist/session-runtime-index.js +14 -1
- package/package.json +7 -7
- package/dist/control-web/assets/index-0noHpRXD.css +0 -32
- package/dist/control-web/assets/index-D-5t2eCT.js +0 -709
- package/dist/control-web/assets/mermaid-GHXKKRXX-DPZO2Q9W.js +0 -131
|
@@ -1,709 +0,0 @@
|
|
|
1
|
-
var PD=Object.defineProperty;var ID=(e,t,r)=>t in e?PD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var hs=(e,t,r)=>ID(e,typeof t!="symbol"?t+"":t,r);function zD(e,t){for(var r=0;r<t.length;r++){const s=t[r];if(typeof s!="string"&&!Array.isArray(s)){for(const n in s)if(n!=="default"&&!(n in e)){const l=Object.getOwnPropertyDescriptor(s,n);l&&Object.defineProperty(e,n,l.get?l:{enumerable:!0,get:()=>s[n]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))s(n);new MutationObserver(n=>{for(const l of n)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&s(u)}).observe(document,{childList:!0,subtree:!0});function r(n){const l={};return n.integrity&&(l.integrity=n.integrity),n.referrerPolicy&&(l.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?l.credentials="include":n.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function s(n){if(n.ep)return;n.ep=!0;const l=r(n);fetch(n.href,l)}})();function Tk(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var _v={exports:{}},pu={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react-jsx-runtime.production.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var BS;function $D(){if(BS)return pu;BS=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(s,n,l){var u=null;if(l!==void 0&&(u=""+l),n.key!==void 0&&(u=""+n.key),"key"in n){l={};for(var d in n)d!=="key"&&(l[d]=n[d])}else l=n;return n=l.ref,{$$typeof:e,type:s,key:u,ref:n!==void 0?n:null,props:l}}return pu.Fragment=t,pu.jsx=r,pu.jsxs=r,pu}var PS;function UD(){return PS||(PS=1,_v.exports=$D()),_v.exports}var o=UD(),xv={exports:{}},Qe={};/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react.production.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var IS;function HD(){if(IS)return Qe;IS=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),n=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),x=Symbol.iterator;function b(T){return T===null||typeof T!="object"?null:(T=x&&T[x]||T["@@iterator"],typeof T=="function"?T:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,k={};function S(T,G,X){this.props=T,this.context=G,this.refs=k,this.updater=X||w}S.prototype.isReactComponent={},S.prototype.setState=function(T,G){if(typeof T!="object"&&typeof T!="function"&&T!=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,T,G,"setState")},S.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function E(){}E.prototype=S.prototype;function N(T,G,X){this.props=T,this.context=G,this.refs=k,this.updater=X||w}var R=N.prototype=new E;R.constructor=N,C(R,S.prototype),R.isPureReactComponent=!0;var A=Array.isArray;function D(){}var B={H:null,A:null,T:null,S:null},$=Object.prototype.hasOwnProperty;function q(T,G,X){var ee=X.ref;return{$$typeof:e,type:T,key:G,ref:ee!==void 0?ee:null,props:X}}function Y(T,G){return q(T.type,G,T.props)}function V(T){return typeof T=="object"&&T!==null&&T.$$typeof===e}function U(T){var G={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(X){return G[X]})}var L=/\/+/g;function I(T,G){return typeof T=="object"&&T!==null&&T.key!=null?U(""+T.key):G.toString(36)}function F(T){switch(T.status){case"fulfilled":return T.value;case"rejected":throw T.reason;default:switch(typeof T.status=="string"?T.then(D,D):(T.status="pending",T.then(function(G){T.status==="pending"&&(T.status="fulfilled",T.value=G)},function(G){T.status==="pending"&&(T.status="rejected",T.reason=G)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function M(T,G,X,ee,oe){var de=typeof T;(de==="undefined"||de==="boolean")&&(T=null);var Z=!1;if(T===null)Z=!0;else switch(de){case"bigint":case"string":case"number":Z=!0;break;case"object":switch(T.$$typeof){case e:case t:Z=!0;break;case v:return Z=T._init,M(Z(T._payload),G,X,ee,oe)}}if(Z)return oe=oe(T),Z=ee===""?"."+I(T,0):ee,A(oe)?(X="",Z!=null&&(X=Z.replace(L,"$&/")+"/"),M(oe,G,X,"",function(be){return be})):oe!=null&&(V(oe)&&(oe=Y(oe,X+(oe.key==null||T&&T.key===oe.key?"":(""+oe.key).replace(L,"$&/")+"/")+Z)),G.push(oe)),1;Z=0;var ce=ee===""?".":ee+":";if(A(T))for(var le=0;le<T.length;le++)ee=T[le],de=ce+I(ee,le),Z+=M(ee,G,X,de,oe);else if(le=b(T),typeof le=="function")for(T=le.call(T),le=0;!(ee=T.next()).done;)ee=ee.value,de=ce+I(ee,le++),Z+=M(ee,G,X,de,oe);else if(de==="object"){if(typeof T.then=="function")return M(F(T),G,X,ee,oe);throw G=String(T),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(T).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.")}return Z}function P(T,G,X){if(T==null)return T;var ee=[],oe=0;return M(T,ee,"","",function(de){return G.call(X,de,oe++)}),ee}function O(T){if(T._status===-1){var G=T._result;G=G(),G.then(function(X){(T._status===0||T._status===-1)&&(T._status=1,T._result=X)},function(X){(T._status===0||T._status===-1)&&(T._status=2,T._result=X)}),T._status===-1&&(T._status=0,T._result=G)}if(T._status===1)return T._result.default;throw T._result}var W=typeof reportError=="function"?reportError:function(T){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var G=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof T=="object"&&T!==null&&typeof T.message=="string"?String(T.message):String(T),error:T});if(!window.dispatchEvent(G))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",T);return}console.error(T)},H={map:P,forEach:function(T,G,X){P(T,function(){G.apply(this,arguments)},X)},count:function(T){var G=0;return P(T,function(){G++}),G},toArray:function(T){return P(T,function(G){return G})||[]},only:function(T){if(!V(T))throw Error("React.Children.only expected to receive a single React element child.");return T}};return Qe.Activity=p,Qe.Children=H,Qe.Component=S,Qe.Fragment=r,Qe.Profiler=n,Qe.PureComponent=N,Qe.StrictMode=s,Qe.Suspense=m,Qe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=B,Qe.__COMPILER_RUNTIME={__proto__:null,c:function(T){return B.H.useMemoCache(T)}},Qe.cache=function(T){return function(){return T.apply(null,arguments)}},Qe.cacheSignal=function(){return null},Qe.cloneElement=function(T,G,X){if(T==null)throw Error("The argument must be a React element, but you passed "+T+".");var ee=C({},T.props),oe=T.key;if(G!=null)for(de in G.key!==void 0&&(oe=""+G.key),G)!$.call(G,de)||de==="key"||de==="__self"||de==="__source"||de==="ref"&&G.ref===void 0||(ee[de]=G[de]);var de=arguments.length-2;if(de===1)ee.children=X;else if(1<de){for(var Z=Array(de),ce=0;ce<de;ce++)Z[ce]=arguments[ce+2];ee.children=Z}return q(T.type,oe,ee)},Qe.createContext=function(T){return T={$$typeof:u,_currentValue:T,_currentValue2:T,_threadCount:0,Provider:null,Consumer:null},T.Provider=T,T.Consumer={$$typeof:l,_context:T},T},Qe.createElement=function(T,G,X){var ee,oe={},de=null;if(G!=null)for(ee in G.key!==void 0&&(de=""+G.key),G)$.call(G,ee)&&ee!=="key"&&ee!=="__self"&&ee!=="__source"&&(oe[ee]=G[ee]);var Z=arguments.length-2;if(Z===1)oe.children=X;else if(1<Z){for(var ce=Array(Z),le=0;le<Z;le++)ce[le]=arguments[le+2];oe.children=ce}if(T&&T.defaultProps)for(ee in Z=T.defaultProps,Z)oe[ee]===void 0&&(oe[ee]=Z[ee]);return q(T,de,oe)},Qe.createRef=function(){return{current:null}},Qe.forwardRef=function(T){return{$$typeof:d,render:T}},Qe.isValidElement=V,Qe.lazy=function(T){return{$$typeof:v,_payload:{_status:-1,_result:T},_init:O}},Qe.memo=function(T,G){return{$$typeof:f,type:T,compare:G===void 0?null:G}},Qe.startTransition=function(T){var G=B.T,X={};B.T=X;try{var ee=T(),oe=B.S;oe!==null&&oe(X,ee),typeof ee=="object"&&ee!==null&&typeof ee.then=="function"&&ee.then(D,W)}catch(de){W(de)}finally{G!==null&&X.types!==null&&(G.types=X.types),B.T=G}},Qe.unstable_useCacheRefresh=function(){return B.H.useCacheRefresh()},Qe.use=function(T){return B.H.use(T)},Qe.useActionState=function(T,G,X){return B.H.useActionState(T,G,X)},Qe.useCallback=function(T,G){return B.H.useCallback(T,G)},Qe.useContext=function(T){return B.H.useContext(T)},Qe.useDebugValue=function(){},Qe.useDeferredValue=function(T,G){return B.H.useDeferredValue(T,G)},Qe.useEffect=function(T,G){return B.H.useEffect(T,G)},Qe.useEffectEvent=function(T){return B.H.useEffectEvent(T)},Qe.useId=function(){return B.H.useId()},Qe.useImperativeHandle=function(T,G,X){return B.H.useImperativeHandle(T,G,X)},Qe.useInsertionEffect=function(T,G){return B.H.useInsertionEffect(T,G)},Qe.useLayoutEffect=function(T,G){return B.H.useLayoutEffect(T,G)},Qe.useMemo=function(T,G){return B.H.useMemo(T,G)},Qe.useOptimistic=function(T,G){return B.H.useOptimistic(T,G)},Qe.useReducer=function(T,G,X){return B.H.useReducer(T,G,X)},Qe.useRef=function(T){return B.H.useRef(T)},Qe.useState=function(T){return B.H.useState(T)},Qe.useSyncExternalStore=function(T,G,X){return B.H.useSyncExternalStore(T,G,X)},Qe.useTransition=function(){return B.H.useTransition()},Qe.version="19.2.7",Qe}var zS;function f0(){return zS||(zS=1,xv.exports=HD()),xv.exports}var g=f0();const Se=Tk(g),no=zD({__proto__:null,default:Se},[g]);var yv={exports:{}},gu={},bv={exports:{}},wv={};/**
|
|
18
|
-
* @license React
|
|
19
|
-
* scheduler.production.js
|
|
20
|
-
*
|
|
21
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
22
|
-
*
|
|
23
|
-
* This source code is licensed under the MIT license found in the
|
|
24
|
-
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/var $S;function FD(){return $S||($S=1,(function(e){function t(M,P){var O=M.length;M.push(P);e:for(;0<O;){var W=O-1>>>1,H=M[W];if(0<n(H,P))M[W]=P,M[O]=H,O=W;else break e}}function r(M){return M.length===0?null:M[0]}function s(M){if(M.length===0)return null;var P=M[0],O=M.pop();if(O!==P){M[0]=O;e:for(var W=0,H=M.length,T=H>>>1;W<T;){var G=2*(W+1)-1,X=M[G],ee=G+1,oe=M[ee];if(0>n(X,O))ee<H&&0>n(oe,X)?(M[W]=oe,M[ee]=O,W=ee):(M[W]=X,M[G]=O,W=G);else if(ee<H&&0>n(oe,O))M[W]=oe,M[ee]=O,W=ee;else break e}}return P}function n(M,P){var O=M.sortIndex-P.sortIndex;return O!==0?O:M.id-P.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var u=Date,d=u.now();e.unstable_now=function(){return u.now()-d}}var m=[],f=[],v=1,p=null,x=3,b=!1,w=!1,C=!1,k=!1,S=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function R(M){for(var P=r(f);P!==null;){if(P.callback===null)s(f);else if(P.startTime<=M)s(f),P.sortIndex=P.expirationTime,t(m,P);else break;P=r(f)}}function A(M){if(C=!1,R(M),!w)if(r(m)!==null)w=!0,D||(D=!0,U());else{var P=r(f);P!==null&&F(A,P.startTime-M)}}var D=!1,B=-1,$=5,q=-1;function Y(){return k?!0:!(e.unstable_now()-q<$)}function V(){if(k=!1,D){var M=e.unstable_now();q=M;var P=!0;try{e:{w=!1,C&&(C=!1,E(B),B=-1),b=!0;var O=x;try{t:{for(R(M),p=r(m);p!==null&&!(p.expirationTime>M&&Y());){var W=p.callback;if(typeof W=="function"){p.callback=null,x=p.priorityLevel;var H=W(p.expirationTime<=M);if(M=e.unstable_now(),typeof H=="function"){p.callback=H,R(M),P=!0;break t}p===r(m)&&s(m),R(M)}else s(m);p=r(m)}if(p!==null)P=!0;else{var T=r(f);T!==null&&F(A,T.startTime-M),P=!1}}break e}finally{p=null,x=O,b=!1}P=void 0}}finally{P?U():D=!1}}}var U;if(typeof N=="function")U=function(){N(V)};else if(typeof MessageChannel<"u"){var L=new MessageChannel,I=L.port2;L.port1.onmessage=V,U=function(){I.postMessage(null)}}else U=function(){S(V,0)};function F(M,P){B=S(function(){M(e.unstable_now())},P)}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(M){M.callback=null},e.unstable_forceFrameRate=function(M){0>M||125<M?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):$=0<M?Math.floor(1e3/M):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function(M){switch(x){case 1:case 2:case 3:var P=3;break;default:P=x}var O=x;x=P;try{return M()}finally{x=O}},e.unstable_requestPaint=function(){k=!0},e.unstable_runWithPriority=function(M,P){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var O=x;x=M;try{return P()}finally{x=O}},e.unstable_scheduleCallback=function(M,P,O){var W=e.unstable_now();switch(typeof O=="object"&&O!==null?(O=O.delay,O=typeof O=="number"&&0<O?W+O:W):O=W,M){case 1:var H=-1;break;case 2:H=250;break;case 5:H=1073741823;break;case 4:H=1e4;break;default:H=5e3}return H=O+H,M={id:v++,callback:P,priorityLevel:M,startTime:O,expirationTime:H,sortIndex:-1},O>W?(M.sortIndex=O,t(f,M),r(m)===null&&M===r(f)&&(C?(E(B),B=-1):C=!0,F(A,O-W))):(M.sortIndex=H,t(m,M),w||b||(w=!0,D||(D=!0,U()))),M},e.unstable_shouldYield=Y,e.unstable_wrapCallback=function(M){var P=x;return function(){var O=x;x=P;try{return M.apply(this,arguments)}finally{x=O}}}})(wv)),wv}var US;function WD(){return US||(US=1,bv.exports=FD()),bv.exports}var Sv={exports:{}},fs={};/**
|
|
26
|
-
* @license React
|
|
27
|
-
* react-dom.production.js
|
|
28
|
-
*
|
|
29
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
30
|
-
*
|
|
31
|
-
* This source code is licensed under the MIT license found in the
|
|
32
|
-
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var HS;function qD(){if(HS)return fs;HS=1;var e=f0();function t(m){var f="https://react.dev/errors/"+m;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)f+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+m+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var s={d:{f:r,r:function(){throw Error(t(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},n=Symbol.for("react.portal");function l(m,f,v){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:n,key:p==null?null:""+p,children:m,containerInfo:f,implementation:v}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(m,f){if(m==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return fs.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,fs.createPortal=function(m,f){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(t(299));return l(m,f,null,v)},fs.flushSync=function(m){var f=u.T,v=s.p;try{if(u.T=null,s.p=2,m)return m()}finally{u.T=f,s.p=v,s.d.f()}},fs.preconnect=function(m,f){typeof m=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,s.d.C(m,f))},fs.prefetchDNS=function(m){typeof m=="string"&&s.d.D(m)},fs.preinit=function(m,f){if(typeof m=="string"&&f&&typeof f.as=="string"){var v=f.as,p=d(v,f.crossOrigin),x=typeof f.integrity=="string"?f.integrity:void 0,b=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;v==="style"?s.d.S(m,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:p,integrity:x,fetchPriority:b}):v==="script"&&s.d.X(m,{crossOrigin:p,integrity:x,fetchPriority:b,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},fs.preinitModule=function(m,f){if(typeof m=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var v=d(f.as,f.crossOrigin);s.d.M(m,{crossOrigin:v,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&s.d.M(m)},fs.preload=function(m,f){if(typeof m=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var v=f.as,p=d(v,f.crossOrigin);s.d.L(m,v,{crossOrigin:p,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},fs.preloadModule=function(m,f){if(typeof m=="string")if(f){var v=d(f.as,f.crossOrigin);s.d.m(m,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:v,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else s.d.m(m)},fs.requestFormReset=function(m){s.d.r(m)},fs.unstable_batchedUpdates=function(m,f){return m(f)},fs.useFormState=function(m,f,v){return u.H.useFormState(m,f,v)},fs.useFormStatus=function(){return u.H.useHostTransitionStatus()},fs.version="19.2.7",fs}var FS;function Dk(){if(FS)return Sv.exports;FS=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(),Sv.exports=qD(),Sv.exports}/**
|
|
34
|
-
* @license React
|
|
35
|
-
* react-dom-client.production.js
|
|
36
|
-
*
|
|
37
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
38
|
-
*
|
|
39
|
-
* This source code is licensed under the MIT license found in the
|
|
40
|
-
* LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/var WS;function VD(){if(WS)return gu;WS=1;var e=WD(),t=f0(),r=Dk();function s(i){var a="https://react.dev/errors/"+i;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)a+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+i+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function l(i){var a=i,c=i;if(i.alternate)for(;a.return;)a=a.return;else{i=a;do a=i,(a.flags&4098)!==0&&(c=a.return),i=a.return;while(i)}return a.tag===3?c:null}function u(i){if(i.tag===13){var a=i.memoizedState;if(a===null&&(i=i.alternate,i!==null&&(a=i.memoizedState)),a!==null)return a.dehydrated}return null}function d(i){if(i.tag===31){var a=i.memoizedState;if(a===null&&(i=i.alternate,i!==null&&(a=i.memoizedState)),a!==null)return a.dehydrated}return null}function m(i){if(l(i)!==i)throw Error(s(188))}function f(i){var a=i.alternate;if(!a){if(a=l(i),a===null)throw Error(s(188));return a!==i?null:i}for(var c=i,h=a;;){var _=c.return;if(_===null)break;var y=_.alternate;if(y===null){if(h=_.return,h!==null){c=h;continue}break}if(_.child===y.child){for(y=_.child;y;){if(y===c)return m(_),i;if(y===h)return m(_),a;y=y.sibling}throw Error(s(188))}if(c.return!==h.return)c=_,h=y;else{for(var j=!1,z=_.child;z;){if(z===c){j=!0,c=_,h=y;break}if(z===h){j=!0,h=_,c=y;break}z=z.sibling}if(!j){for(z=y.child;z;){if(z===c){j=!0,c=y,h=_;break}if(z===h){j=!0,h=y,c=_;break}z=z.sibling}if(!j)throw Error(s(189))}}if(c.alternate!==h)throw Error(s(190))}if(c.tag!==3)throw Error(s(188));return c.stateNode.current===c?i:a}function v(i){var a=i.tag;if(a===5||a===26||a===27||a===6)return i;for(i=i.child;i!==null;){if(a=v(i),a!==null)return a;i=i.sibling}return null}var p=Object.assign,x=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),N=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),$=Symbol.for("react.lazy"),q=Symbol.for("react.activity"),Y=Symbol.for("react.memo_cache_sentinel"),V=Symbol.iterator;function U(i){return i===null||typeof i!="object"?null:(i=V&&i[V]||i["@@iterator"],typeof i=="function"?i:null)}var L=Symbol.for("react.client.reference");function I(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===L?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case C:return"Fragment";case S:return"Profiler";case k:return"StrictMode";case A:return"Suspense";case D:return"SuspenseList";case q:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case w:return"Portal";case N:return i.displayName||"Context";case E:return(i._context.displayName||"Context")+".Consumer";case R:var a=i.render;return i=i.displayName,i||(i=a.displayName||a.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case B:return a=i.displayName||null,a!==null?a:I(i.type)||"Memo";case $:a=i._payload,i=i._init;try{return I(i(a))}catch{}}return null}var F=Array.isArray,M=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,O={pending:!1,data:null,method:null,action:null},W=[],H=-1;function T(i){return{current:i}}function G(i){0>H||(i.current=W[H],W[H]=null,H--)}function X(i,a){H++,W[H]=i.current,i.current=a}var ee=T(null),oe=T(null),de=T(null),Z=T(null);function ce(i,a){switch(X(de,a),X(oe,i),X(ee,null),a.nodeType){case 9:case 11:i=(i=a.documentElement)&&(i=i.namespaceURI)?nS(i):0;break;default:if(i=a.tagName,a=a.namespaceURI)a=nS(a),i=aS(a,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}G(ee),X(ee,i)}function le(){G(ee),G(oe),G(de)}function be(i){i.memoizedState!==null&&X(Z,i);var a=ee.current,c=aS(a,i.type);a!==c&&(X(oe,i),X(ee,c))}function ke(i){oe.current===i&&(G(ee),G(oe)),Z.current===i&&(G(Z),du._currentValue=O)}var Ee,te;function re(i){if(Ee===void 0)try{throw Error()}catch(c){var a=c.stack.trim().match(/\n( *(at )?)/);Ee=a&&a[1]||"",te=-1<c.stack.indexOf(`
|
|
42
|
-
at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
-
`+Ee+i+te}var Ce=!1;function De(i,a){if(!i||Ce)return"";Ce=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var h={DetermineComponentFrameRoot:function(){try{if(a){var ge=function(){throw Error()};if(Object.defineProperty(ge.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ge,[])}catch(ue){var ae=ue}Reflect.construct(i,[],ge)}else{try{ge.call()}catch(ue){ae=ue}i.call(ge.prototype)}}else{try{throw Error()}catch(ue){ae=ue}(ge=i())&&typeof ge.catch=="function"&&ge.catch(function(){})}}catch(ue){if(ue&&ae&&typeof ue.stack=="string")return[ue.stack,ae.stack]}return[null,null]}};h.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var _=Object.getOwnPropertyDescriptor(h.DetermineComponentFrameRoot,"name");_&&_.configurable&&Object.defineProperty(h.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var y=h.DetermineComponentFrameRoot(),j=y[0],z=y[1];if(j&&z){var K=j.split(`
|
|
44
|
-
`),ie=z.split(`
|
|
45
|
-
`);for(_=h=0;h<K.length&&!K[h].includes("DetermineComponentFrameRoot");)h++;for(;_<ie.length&&!ie[_].includes("DetermineComponentFrameRoot");)_++;if(h===K.length||_===ie.length)for(h=K.length-1,_=ie.length-1;1<=h&&0<=_&&K[h]!==ie[_];)_--;for(;1<=h&&0<=_;h--,_--)if(K[h]!==ie[_]){if(h!==1||_!==1)do if(h--,_--,0>_||K[h]!==ie[_]){var fe=`
|
|
46
|
-
`+K[h].replace(" at new "," at ");return i.displayName&&fe.includes("<anonymous>")&&(fe=fe.replace("<anonymous>",i.displayName)),fe}while(1<=h&&0<=_);break}}}finally{Ce=!1,Error.prepareStackTrace=c}return(c=i?i.displayName||i.name:"")?re(c):""}function _e(i,a){switch(i.tag){case 26:case 27:case 5:return re(i.type);case 16:return re("Lazy");case 13:return i.child!==a&&a!==null?re("Suspense Fallback"):re("Suspense");case 19:return re("SuspenseList");case 0:case 15:return De(i.type,!1);case 11:return De(i.type.render,!1);case 1:return De(i.type,!0);case 31:return re("Activity");default:return""}}function Re(i){try{var a="",c=null;do a+=_e(i,c),c=i,i=i.return;while(i);return a}catch(h){return`
|
|
47
|
-
Error generating stack: `+h.message+`
|
|
48
|
-
`+h.stack}}var Pe=Object.prototype.hasOwnProperty,Ue=e.unstable_scheduleCallback,qe=e.unstable_cancelCallback,Ie=e.unstable_shouldYield,Ve=e.unstable_requestPaint,ct=e.unstable_now,Qr=e.unstable_getCurrentPriorityLevel,Ct=e.unstable_ImmediatePriority,Nr=e.unstable_UserBlockingPriority,cs=e.unstable_NormalPriority,tr=e.unstable_LowPriority,kt=e.unstable_IdlePriority,Ge=e.log,Et=e.unstable_setDisableYieldValue,us=null,zt=null;function ds(i){if(typeof Ge=="function"&&Et(i),zt&&typeof zt.setStrictMode=="function")try{zt.setStrictMode(us,i)}catch{}}var Vt=Math.clz32?Math.clz32:He,Le=Math.log,Ze=Math.LN2;function He(i){return i>>>=0,i===0?32:31-(Le(i)/Ze|0)|0}var jr=256,Jr=262144,$t=4194304;function rr(i){var a=i&42;if(a!==0)return a;switch(i&-i){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 i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function Fe(i,a,c){var h=i.pendingLanes;if(h===0)return 0;var _=0,y=i.suspendedLanes,j=i.pingedLanes;i=i.warmLanes;var z=h&134217727;return z!==0?(h=z&~y,h!==0?_=rr(h):(j&=z,j!==0?_=rr(j):c||(c=z&~i,c!==0&&(_=rr(c))))):(z=h&~y,z!==0?_=rr(z):j!==0?_=rr(j):c||(c=h&~i,c!==0&&(_=rr(c)))),_===0?0:a!==0&&a!==_&&(a&y)===0&&(y=_&-_,c=a&-a,y>=c||y===32&&(c&4194048)!==0)?a:_}function wt(i,a){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&a)===0}function Gt(i,a){switch(i){case 1:case 2:case 4:case 8:case 64:return a+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 a+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 sr(){var i=$t;return $t<<=1,($t&62914560)===0&&($t=4194304),i}function Ls(i){for(var a=[],c=0;31>c;c++)a.push(i);return a}function rt(i,a){i.pendingLanes|=a,a!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function hr(i,a,c,h,_,y){var j=i.pendingLanes;i.pendingLanes=c,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=c,i.entangledLanes&=c,i.errorRecoveryDisabledLanes&=c,i.shellSuspendCounter=0;var z=i.entanglements,K=i.expirationTimes,ie=i.hiddenUpdates;for(c=j&~c;0<c;){var fe=31-Vt(c),ge=1<<fe;z[fe]=0,K[fe]=-1;var ae=ie[fe];if(ae!==null)for(ie[fe]=null,fe=0;fe<ae.length;fe++){var ue=ae[fe];ue!==null&&(ue.lane&=-536870913)}c&=~ge}h!==0&&Bt(i,h,0),y!==0&&_===0&&i.tag!==0&&(i.suspendedLanes|=y&~(j&~a))}function Bt(i,a,c){i.pendingLanes|=a,i.suspendedLanes&=~a;var h=31-Vt(a);i.entangledLanes|=a,i.entanglements[h]=i.entanglements[h]|1073741824|c&261930}function Rt(i,a){var c=i.entangledLanes|=a;for(i=i.entanglements;c;){var h=31-Vt(c),_=1<<h;_&a|i[h]&a&&(i[h]|=a),c&=~_}}function Xt(i,a){var c=a&-a;return c=(c&42)!==0?1:ei(c),(c&(i.suspendedLanes|a))!==0?0:c}function ei(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=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:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function fr(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function Rn(){var i=P.p;return i!==0?i:(i=window.event,i===void 0?32:jS(i.type))}function mo(i,a){var c=P.p;try{return P.p=i,a()}finally{P.p=c}}var mr=Math.random().toString(36).slice(2),Pt="__reactFiber$"+mr,he="__reactProps$"+mr,je="__reactContainer$"+mr,nt="__reactEvents$"+mr,Zt="__reactListeners$"+mr,Ar="__reactHandles$"+mr,Xi="__reactResources$"+mr,ti="__reactMarker$"+mr;function Mi(i){delete i[Pt],delete i[he],delete i[nt],delete i[Zt],delete i[Ar]}function cl(i){var a=i[Pt];if(a)return a;for(var c=i.parentNode;c;){if(a=c[je]||c[Pt]){if(c=a.alternate,a.child!==null||c!==null&&c.child!==null)for(i=fS(i);i!==null;){if(c=i[Pt])return c;i=fS(i)}return a}i=c,c=i.parentNode}return null}function ul(i){if(i=i[Pt]||i[je]){var a=i.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return i}return null}function Rc(i){var a=i.tag;if(a===5||a===26||a===27||a===6)return i.stateNode;throw Error(s(33))}function dl(i){var a=i[Xi];return a||(a=i[Xi]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function zr(i){i[ti]=!0}var Gy=new Set,Yy={};function po(i,a){hl(i,a),hl(i+"Capture",a)}function hl(i,a){for(Yy[i]=a,i=0;i<a.length;i++)Gy.add(a[i])}var NT=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]*$"),Ky={},Xy={};function jT(i){return Pe.call(Xy,i)?!0:Pe.call(Ky,i)?!1:NT.test(i)?Xy[i]=!0:(Ky[i]=!0,!1)}function Md(i,a,c){if(jT(a))if(c===null)i.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":i.removeAttribute(a);return;case"boolean":var h=a.toLowerCase().slice(0,5);if(h!=="data-"&&h!=="aria-"){i.removeAttribute(a);return}}i.setAttribute(a,""+c)}}function Td(i,a,c){if(c===null)i.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(a);return}i.setAttribute(a,""+c)}}function Nn(i,a,c,h){if(h===null)i.removeAttribute(c);else{switch(typeof h){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(c);return}i.setAttributeNS(a,c,""+h)}}function ri(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function Zy(i){var a=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function AT(i,a,c){var h=Object.getOwnPropertyDescriptor(i.constructor.prototype,a);if(!i.hasOwnProperty(a)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var _=h.get,y=h.set;return Object.defineProperty(i,a,{configurable:!0,get:function(){return _.call(this)},set:function(j){c=""+j,y.call(this,j)}}),Object.defineProperty(i,a,{enumerable:h.enumerable}),{getValue:function(){return c},setValue:function(j){c=""+j},stopTracking:function(){i._valueTracker=null,delete i[a]}}}}function dp(i){if(!i._valueTracker){var a=Zy(i)?"checked":"value";i._valueTracker=AT(i,a,""+i[a])}}function Qy(i){if(!i)return!1;var a=i._valueTracker;if(!a)return!0;var c=a.getValue(),h="";return i&&(h=Zy(i)?i.checked?"true":"false":i.value),i=h,i!==c?(a.setValue(i),!0):!1}function Dd(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var MT=/[\n"\\]/g;function si(i){return i.replace(MT,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function hp(i,a,c,h,_,y,j,z){i.name="",j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?i.type=j:i.removeAttribute("type"),a!=null?j==="number"?(a===0&&i.value===""||i.value!=a)&&(i.value=""+ri(a)):i.value!==""+ri(a)&&(i.value=""+ri(a)):j!=="submit"&&j!=="reset"||i.removeAttribute("value"),a!=null?fp(i,j,ri(a)):c!=null?fp(i,j,ri(c)):h!=null&&i.removeAttribute("value"),_==null&&y!=null&&(i.defaultChecked=!!y),_!=null&&(i.checked=_&&typeof _!="function"&&typeof _!="symbol"),z!=null&&typeof z!="function"&&typeof z!="symbol"&&typeof z!="boolean"?i.name=""+ri(z):i.removeAttribute("name")}function Jy(i,a,c,h,_,y,j,z){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(i.type=y),a!=null||c!=null){if(!(y!=="submit"&&y!=="reset"||a!=null)){dp(i);return}c=c!=null?""+ri(c):"",a=a!=null?""+ri(a):c,z||a===i.value||(i.value=a),i.defaultValue=a}h=h??_,h=typeof h!="function"&&typeof h!="symbol"&&!!h,i.checked=z?i.checked:!!h,i.defaultChecked=!!h,j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(i.name=j),dp(i)}function fp(i,a,c){a==="number"&&Dd(i.ownerDocument)===i||i.defaultValue===""+c||(i.defaultValue=""+c)}function fl(i,a,c,h){if(i=i.options,a){a={};for(var _=0;_<c.length;_++)a["$"+c[_]]=!0;for(c=0;c<i.length;c++)_=a.hasOwnProperty("$"+i[c].value),i[c].selected!==_&&(i[c].selected=_),_&&h&&(i[c].defaultSelected=!0)}else{for(c=""+ri(c),a=null,_=0;_<i.length;_++){if(i[_].value===c){i[_].selected=!0,h&&(i[_].defaultSelected=!0);return}a!==null||i[_].disabled||(a=i[_])}a!==null&&(a.selected=!0)}}function eb(i,a,c){if(a!=null&&(a=""+ri(a),a!==i.value&&(i.value=a),c==null)){i.defaultValue!==a&&(i.defaultValue=a);return}i.defaultValue=c!=null?""+ri(c):""}function tb(i,a,c,h){if(a==null){if(h!=null){if(c!=null)throw Error(s(92));if(F(h)){if(1<h.length)throw Error(s(93));h=h[0]}c=h}c==null&&(c=""),a=c}c=ri(a),i.defaultValue=c,h=i.textContent,h===c&&h!==""&&h!==null&&(i.value=h),dp(i)}function ml(i,a){if(a){var c=i.firstChild;if(c&&c===i.lastChild&&c.nodeType===3){c.nodeValue=a;return}}i.textContent=a}var TT=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 rb(i,a,c){var h=a.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?h?i.setProperty(a,""):a==="float"?i.cssFloat="":i[a]="":h?i.setProperty(a,c):typeof c!="number"||c===0||TT.has(a)?a==="float"?i.cssFloat=c:i[a]=(""+c).trim():i[a]=c+"px"}function sb(i,a,c){if(a!=null&&typeof a!="object")throw Error(s(62));if(i=i.style,c!=null){for(var h in c)!c.hasOwnProperty(h)||a!=null&&a.hasOwnProperty(h)||(h.indexOf("--")===0?i.setProperty(h,""):h==="float"?i.cssFloat="":i[h]="");for(var _ in a)h=a[_],a.hasOwnProperty(_)&&c[_]!==h&&rb(i,_,h)}else for(var y in a)a.hasOwnProperty(y)&&rb(i,y,a[y])}function mp(i){if(i.indexOf("-")===-1)return!1;switch(i){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 DT=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"]]),LT=/^[\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 Ld(i){return LT.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function jn(){}var pp=null;function gp(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var pl=null,gl=null;function ib(i){var a=ul(i);if(a&&(i=a.stateNode)){var c=i[he]||null;e:switch(i=a.stateNode,a.type){case"input":if(hp(i,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),a=c.name,c.type==="radio"&&a!=null){for(c=i;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+si(""+a)+'"][type="radio"]'),a=0;a<c.length;a++){var h=c[a];if(h!==i&&h.form===i.form){var _=h[he]||null;if(!_)throw Error(s(90));hp(h,_.value,_.defaultValue,_.defaultValue,_.checked,_.defaultChecked,_.type,_.name)}}for(a=0;a<c.length;a++)h=c[a],h.form===i.form&&Qy(h)}break e;case"textarea":eb(i,c.value,c.defaultValue);break e;case"select":a=c.value,a!=null&&fl(i,!!c.multiple,a,!1)}}}var vp=!1;function nb(i,a,c){if(vp)return i(a,c);vp=!0;try{var h=i(a);return h}finally{if(vp=!1,(pl!==null||gl!==null)&&(bh(),pl&&(a=pl,i=gl,gl=pl=null,ib(a),i)))for(a=0;a<i.length;a++)ib(i[a])}}function Nc(i,a){var c=i.stateNode;if(c===null)return null;var h=c[he]||null;if(h===null)return null;c=h[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(h=!h.disabled)||(i=i.type,h=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!h;break e;default:i=!1}if(i)return null;if(c&&typeof c!="function")throw Error(s(231,a,typeof c));return c}var An=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),_p=!1;if(An)try{var jc={};Object.defineProperty(jc,"passive",{get:function(){_p=!0}}),window.addEventListener("test",jc,jc),window.removeEventListener("test",jc,jc)}catch{_p=!1}var ma=null,xp=null,Od=null;function ab(){if(Od)return Od;var i,a=xp,c=a.length,h,_="value"in ma?ma.value:ma.textContent,y=_.length;for(i=0;i<c&&a[i]===_[i];i++);var j=c-i;for(h=1;h<=j&&a[c-h]===_[y-h];h++);return Od=_.slice(i,1<h?1-h:void 0)}function Bd(i){var a=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&a===13&&(i=13)):i=a,i===10&&(i=13),32<=i||i===13?i:0}function Pd(){return!0}function ob(){return!1}function Ss(i){function a(c,h,_,y,j){this._reactName=c,this._targetInst=_,this.type=h,this.nativeEvent=y,this.target=j,this.currentTarget=null;for(var z in i)i.hasOwnProperty(z)&&(c=i[z],this[z]=c?c(y):y[z]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?Pd:ob,this.isPropagationStopped=ob,this}return p(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=Pd)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Pd)},persist:function(){},isPersistent:Pd}),a}var go={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Id=Ss(go),Ac=p({},go,{view:0,detail:0}),OT=Ss(Ac),yp,bp,Mc,zd=p({},Ac,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Sp,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==Mc&&(Mc&&i.type==="mousemove"?(yp=i.screenX-Mc.screenX,bp=i.screenY-Mc.screenY):bp=yp=0,Mc=i),yp)},movementY:function(i){return"movementY"in i?i.movementY:bp}}),lb=Ss(zd),BT=p({},zd,{dataTransfer:0}),PT=Ss(BT),IT=p({},Ac,{relatedTarget:0}),wp=Ss(IT),zT=p({},go,{animationName:0,elapsedTime:0,pseudoElement:0}),$T=Ss(zT),UT=p({},go,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),HT=Ss(UT),FT=p({},go,{data:0}),cb=Ss(FT),WT={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"},VT={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function GT(i){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(i):(i=VT[i])?!!a[i]:!1}function Sp(){return GT}var YT=p({},Ac,{key:function(i){if(i.key){var a=WT[i.key]||i.key;if(a!=="Unidentified")return a}return i.type==="keypress"?(i=Bd(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?qT[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Sp,charCode:function(i){return i.type==="keypress"?Bd(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Bd(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),KT=Ss(YT),XT=p({},zd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ub=Ss(XT),ZT=p({},Ac,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Sp}),QT=Ss(ZT),JT=p({},go,{propertyName:0,elapsedTime:0,pseudoElement:0}),e3=Ss(JT),t3=p({},zd,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),r3=Ss(t3),s3=p({},go,{newState:0,oldState:0}),i3=Ss(s3),n3=[9,13,27,32],Cp=An&&"CompositionEvent"in window,Tc=null;An&&"documentMode"in document&&(Tc=document.documentMode);var a3=An&&"TextEvent"in window&&!Tc,db=An&&(!Cp||Tc&&8<Tc&&11>=Tc),hb=" ",fb=!1;function mb(i,a){switch(i){case"keyup":return n3.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function pb(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var vl=!1;function o3(i,a){switch(i){case"compositionend":return pb(a);case"keypress":return a.which!==32?null:(fb=!0,hb);case"textInput":return i=a.data,i===hb&&fb?null:i;default:return null}}function l3(i,a){if(vl)return i==="compositionend"||!Cp&&mb(i,a)?(i=ab(),Od=xp=ma=null,vl=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return db&&a.locale!=="ko"?null:a.data;default:return null}}var c3={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 gb(i){var a=i&&i.nodeName&&i.nodeName.toLowerCase();return a==="input"?!!c3[i.type]:a==="textarea"}function vb(i,a,c,h){pl?gl?gl.push(h):gl=[h]:pl=h,a=Nh(a,"onChange"),0<a.length&&(c=new Id("onChange","change",null,c,h),i.push({event:c,listeners:a}))}var Dc=null,Lc=null;function u3(i){Jw(i,0)}function $d(i){var a=Rc(i);if(Qy(a))return i}function _b(i,a){if(i==="change")return a}var xb=!1;if(An){var kp;if(An){var Ep="oninput"in document;if(!Ep){var yb=document.createElement("div");yb.setAttribute("oninput","return;"),Ep=typeof yb.oninput=="function"}kp=Ep}else kp=!1;xb=kp&&(!document.documentMode||9<document.documentMode)}function bb(){Dc&&(Dc.detachEvent("onpropertychange",wb),Lc=Dc=null)}function wb(i){if(i.propertyName==="value"&&$d(Lc)){var a=[];vb(a,Lc,i,gp(i)),nb(u3,a)}}function d3(i,a,c){i==="focusin"?(bb(),Dc=a,Lc=c,Dc.attachEvent("onpropertychange",wb)):i==="focusout"&&bb()}function h3(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return $d(Lc)}function f3(i,a){if(i==="click")return $d(a)}function m3(i,a){if(i==="input"||i==="change")return $d(a)}function p3(i,a){return i===a&&(i!==0||1/i===1/a)||i!==i&&a!==a}var Os=typeof Object.is=="function"?Object.is:p3;function Oc(i,a){if(Os(i,a))return!0;if(typeof i!="object"||i===null||typeof a!="object"||a===null)return!1;var c=Object.keys(i),h=Object.keys(a);if(c.length!==h.length)return!1;for(h=0;h<c.length;h++){var _=c[h];if(!Pe.call(a,_)||!Os(i[_],a[_]))return!1}return!0}function Sb(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function Cb(i,a){var c=Sb(i);i=0;for(var h;c;){if(c.nodeType===3){if(h=i+c.textContent.length,i<=a&&h>=a)return{node:c,offset:a-i};i=h}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=Sb(c)}}function kb(i,a){return i&&a?i===a?!0:i&&i.nodeType===3?!1:a&&a.nodeType===3?kb(i,a.parentNode):"contains"in i?i.contains(a):i.compareDocumentPosition?!!(i.compareDocumentPosition(a)&16):!1:!1}function Eb(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var a=Dd(i.document);a instanceof i.HTMLIFrameElement;){try{var c=typeof a.contentWindow.location.href=="string"}catch{c=!1}if(c)i=a.contentWindow;else break;a=Dd(i.document)}return a}function Rp(i){var a=i&&i.nodeName&&i.nodeName.toLowerCase();return a&&(a==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||a==="textarea"||i.contentEditable==="true")}var g3=An&&"documentMode"in document&&11>=document.documentMode,_l=null,Np=null,Bc=null,jp=!1;function Rb(i,a,c){var h=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;jp||_l==null||_l!==Dd(h)||(h=_l,"selectionStart"in h&&Rp(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),Bc&&Oc(Bc,h)||(Bc=h,h=Nh(Np,"onSelect"),0<h.length&&(a=new Id("onSelect","select",null,a,c),i.push({event:a,listeners:h}),a.target=_l)))}function vo(i,a){var c={};return c[i.toLowerCase()]=a.toLowerCase(),c["Webkit"+i]="webkit"+a,c["Moz"+i]="moz"+a,c}var xl={animationend:vo("Animation","AnimationEnd"),animationiteration:vo("Animation","AnimationIteration"),animationstart:vo("Animation","AnimationStart"),transitionrun:vo("Transition","TransitionRun"),transitionstart:vo("Transition","TransitionStart"),transitioncancel:vo("Transition","TransitionCancel"),transitionend:vo("Transition","TransitionEnd")},Ap={},Nb={};An&&(Nb=document.createElement("div").style,"AnimationEvent"in window||(delete xl.animationend.animation,delete xl.animationiteration.animation,delete xl.animationstart.animation),"TransitionEvent"in window||delete xl.transitionend.transition);function _o(i){if(Ap[i])return Ap[i];if(!xl[i])return i;var a=xl[i],c;for(c in a)if(a.hasOwnProperty(c)&&c in Nb)return Ap[i]=a[c];return i}var jb=_o("animationend"),Ab=_o("animationiteration"),Mb=_o("animationstart"),v3=_o("transitionrun"),_3=_o("transitionstart"),x3=_o("transitioncancel"),Tb=_o("transitionend"),Db=new Map,Mp="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(" ");Mp.push("scrollEnd");function Ti(i,a){Db.set(i,a),po(a,[i])}var Ud=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},ii=[],yl=0,Tp=0;function Hd(){for(var i=yl,a=Tp=yl=0;a<i;){var c=ii[a];ii[a++]=null;var h=ii[a];ii[a++]=null;var _=ii[a];ii[a++]=null;var y=ii[a];if(ii[a++]=null,h!==null&&_!==null){var j=h.pending;j===null?_.next=_:(_.next=j.next,j.next=_),h.pending=_}y!==0&&Lb(c,_,y)}}function Fd(i,a,c,h){ii[yl++]=i,ii[yl++]=a,ii[yl++]=c,ii[yl++]=h,Tp|=h,i.lanes|=h,i=i.alternate,i!==null&&(i.lanes|=h)}function Dp(i,a,c,h){return Fd(i,a,c,h),Wd(i)}function xo(i,a){return Fd(i,null,null,a),Wd(i)}function Lb(i,a,c){i.lanes|=c;var h=i.alternate;h!==null&&(h.lanes|=c);for(var _=!1,y=i.return;y!==null;)y.childLanes|=c,h=y.alternate,h!==null&&(h.childLanes|=c),y.tag===22&&(i=y.stateNode,i===null||i._visibility&1||(_=!0)),i=y,y=y.return;return i.tag===3?(y=i.stateNode,_&&a!==null&&(_=31-Vt(c),i=y.hiddenUpdates,h=i[_],h===null?i[_]=[a]:h.push(a),a.lane=c|536870912),y):null}function Wd(i){if(50<iu)throw iu=0,Hg=null,Error(s(185));for(var a=i.return;a!==null;)i=a,a=i.return;return i.tag===3?i.stateNode:null}var bl={};function y3(i,a,c,h){this.tag=i,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=h,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Bs(i,a,c,h){return new y3(i,a,c,h)}function Lp(i){return i=i.prototype,!(!i||!i.isReactComponent)}function Mn(i,a){var c=i.alternate;return c===null?(c=Bs(i.tag,a,i.key,i.mode),c.elementType=i.elementType,c.type=i.type,c.stateNode=i.stateNode,c.alternate=i,i.alternate=c):(c.pendingProps=a,c.type=i.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=i.flags&65011712,c.childLanes=i.childLanes,c.lanes=i.lanes,c.child=i.child,c.memoizedProps=i.memoizedProps,c.memoizedState=i.memoizedState,c.updateQueue=i.updateQueue,a=i.dependencies,c.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},c.sibling=i.sibling,c.index=i.index,c.ref=i.ref,c.refCleanup=i.refCleanup,c}function Ob(i,a){i.flags&=65011714;var c=i.alternate;return c===null?(i.childLanes=0,i.lanes=a,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=c.childLanes,i.lanes=c.lanes,i.child=c.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=c.memoizedProps,i.memoizedState=c.memoizedState,i.updateQueue=c.updateQueue,i.type=c.type,a=c.dependencies,i.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),i}function qd(i,a,c,h,_,y){var j=0;if(h=i,typeof i=="function")Lp(i)&&(j=1);else if(typeof i=="string")j=kD(i,c,ee.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case q:return i=Bs(31,c,a,_),i.elementType=q,i.lanes=y,i;case C:return yo(c.children,_,y,a);case k:j=8,_|=24;break;case S:return i=Bs(12,c,a,_|2),i.elementType=S,i.lanes=y,i;case A:return i=Bs(13,c,a,_),i.elementType=A,i.lanes=y,i;case D:return i=Bs(19,c,a,_),i.elementType=D,i.lanes=y,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case N:j=10;break e;case E:j=9;break e;case R:j=11;break e;case B:j=14;break e;case $:j=16,h=null;break e}j=29,c=Error(s(130,i===null?"null":typeof i,"")),h=null}return a=Bs(j,c,a,_),a.elementType=i,a.type=h,a.lanes=y,a}function yo(i,a,c,h){return i=Bs(7,i,h,a),i.lanes=c,i}function Op(i,a,c){return i=Bs(6,i,null,a),i.lanes=c,i}function Bb(i){var a=Bs(18,null,null,0);return a.stateNode=i,a}function Bp(i,a,c){return a=Bs(4,i.children!==null?i.children:[],i.key,a),a.lanes=c,a.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},a}var Pb=new WeakMap;function ni(i,a){if(typeof i=="object"&&i!==null){var c=Pb.get(i);return c!==void 0?c:(a={value:i,source:a,stack:Re(a)},Pb.set(i,a),a)}return{value:i,source:a,stack:Re(a)}}var wl=[],Sl=0,Vd=null,Pc=0,ai=[],oi=0,pa=null,Zi=1,Qi="";function Tn(i,a){wl[Sl++]=Pc,wl[Sl++]=Vd,Vd=i,Pc=a}function Ib(i,a,c){ai[oi++]=Zi,ai[oi++]=Qi,ai[oi++]=pa,pa=i;var h=Zi;i=Qi;var _=32-Vt(h)-1;h&=~(1<<_),c+=1;var y=32-Vt(a)+_;if(30<y){var j=_-_%5;y=(h&(1<<j)-1).toString(32),h>>=j,_-=j,Zi=1<<32-Vt(a)+_|c<<_|h,Qi=y+i}else Zi=1<<y|c<<_|h,Qi=i}function Pp(i){i.return!==null&&(Tn(i,1),Ib(i,1,0))}function Ip(i){for(;i===Vd;)Vd=wl[--Sl],wl[Sl]=null,Pc=wl[--Sl],wl[Sl]=null;for(;i===pa;)pa=ai[--oi],ai[oi]=null,Qi=ai[--oi],ai[oi]=null,Zi=ai[--oi],ai[oi]=null}function zb(i,a){ai[oi++]=Zi,ai[oi++]=Qi,ai[oi++]=pa,Zi=a.id,Qi=a.overflow,pa=i}var es=null,Ut=null,gt=!1,ga=null,li=!1,zp=Error(s(519));function va(i){var a=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ic(ni(a,i)),zp}function $b(i){var a=i.stateNode,c=i.type,h=i.memoizedProps;switch(a[Pt]=i,a[he]=h,c){case"dialog":ht("cancel",a),ht("close",a);break;case"iframe":case"object":case"embed":ht("load",a);break;case"video":case"audio":for(c=0;c<au.length;c++)ht(au[c],a);break;case"source":ht("error",a);break;case"img":case"image":case"link":ht("error",a),ht("load",a);break;case"details":ht("toggle",a);break;case"input":ht("invalid",a),Jy(a,h.value,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name,!0);break;case"select":ht("invalid",a);break;case"textarea":ht("invalid",a),tb(a,h.value,h.defaultValue,h.children)}c=h.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||a.textContent===""+c||h.suppressHydrationWarning===!0||sS(a.textContent,c)?(h.popover!=null&&(ht("beforetoggle",a),ht("toggle",a)),h.onScroll!=null&&ht("scroll",a),h.onScrollEnd!=null&&ht("scrollend",a),h.onClick!=null&&(a.onclick=jn),a=!0):a=!1,a||va(i,!0)}function Ub(i){for(es=i.return;es;)switch(es.tag){case 5:case 31:case 13:li=!1;return;case 27:case 3:li=!0;return;default:es=es.return}}function Cl(i){if(i!==es)return!1;if(!gt)return Ub(i),gt=!0,!1;var a=i.tag,c;if((c=a!==3&&a!==27)&&((c=a===5)&&(c=i.type,c=!(c!=="form"&&c!=="button")||sv(i.type,i.memoizedProps)),c=!c),c&&Ut&&va(i),Ub(i),a===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(s(317));Ut=hS(i)}else if(a===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(s(317));Ut=hS(i)}else a===27?(a=Ut,Ma(i.type)?(i=lv,lv=null,Ut=i):Ut=a):Ut=es?ui(i.stateNode.nextSibling):null;return!0}function bo(){Ut=es=null,gt=!1}function $p(){var i=ga;return i!==null&&(Rs===null?Rs=i:Rs.push.apply(Rs,i),ga=null),i}function Ic(i){ga===null?ga=[i]:ga.push(i)}var Up=T(null),wo=null,Dn=null;function _a(i,a,c){X(Up,a._currentValue),a._currentValue=c}function Ln(i){i._currentValue=Up.current,G(Up)}function Hp(i,a,c){for(;i!==null;){var h=i.alternate;if((i.childLanes&a)!==a?(i.childLanes|=a,h!==null&&(h.childLanes|=a)):h!==null&&(h.childLanes&a)!==a&&(h.childLanes|=a),i===c)break;i=i.return}}function Fp(i,a,c,h){var _=i.child;for(_!==null&&(_.return=i);_!==null;){var y=_.dependencies;if(y!==null){var j=_.child;y=y.firstContext;e:for(;y!==null;){var z=y;y=_;for(var K=0;K<a.length;K++)if(z.context===a[K]){y.lanes|=c,z=y.alternate,z!==null&&(z.lanes|=c),Hp(y.return,c,i),h||(j=null);break e}y=z.next}}else if(_.tag===18){if(j=_.return,j===null)throw Error(s(341));j.lanes|=c,y=j.alternate,y!==null&&(y.lanes|=c),Hp(j,c,i),j=null}else j=_.child;if(j!==null)j.return=_;else for(j=_;j!==null;){if(j===i){j=null;break}if(_=j.sibling,_!==null){_.return=j.return,j=_;break}j=j.return}_=j}}function kl(i,a,c,h){i=null;for(var _=a,y=!1;_!==null;){if(!y){if((_.flags&524288)!==0)y=!0;else if((_.flags&262144)!==0)break}if(_.tag===10){var j=_.alternate;if(j===null)throw Error(s(387));if(j=j.memoizedProps,j!==null){var z=_.type;Os(_.pendingProps.value,j.value)||(i!==null?i.push(z):i=[z])}}else if(_===Z.current){if(j=_.alternate,j===null)throw Error(s(387));j.memoizedState.memoizedState!==_.memoizedState.memoizedState&&(i!==null?i.push(du):i=[du])}_=_.return}i!==null&&Fp(a,i,c,h),a.flags|=262144}function Gd(i){for(i=i.firstContext;i!==null;){if(!Os(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function So(i){wo=i,Dn=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function ts(i){return Hb(wo,i)}function Yd(i,a){return wo===null&&So(i),Hb(i,a)}function Hb(i,a){var c=a._currentValue;if(a={context:a,memoizedValue:c,next:null},Dn===null){if(i===null)throw Error(s(308));Dn=a,i.dependencies={lanes:0,firstContext:a},i.flags|=524288}else Dn=Dn.next=a;return c}var b3=typeof AbortController<"u"?AbortController:function(){var i=[],a=this.signal={aborted:!1,addEventListener:function(c,h){i.push(h)}};this.abort=function(){a.aborted=!0,i.forEach(function(c){return c()})}},w3=e.unstable_scheduleCallback,S3=e.unstable_NormalPriority,_r={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Wp(){return{controller:new b3,data:new Map,refCount:0}}function zc(i){i.refCount--,i.refCount===0&&w3(S3,function(){i.controller.abort()})}var $c=null,qp=0,El=0,Rl=null;function C3(i,a){if($c===null){var c=$c=[];qp=0,El=Yg(),Rl={status:"pending",value:void 0,then:function(h){c.push(h)}}}return qp++,a.then(Fb,Fb),a}function Fb(){if(--qp===0&&$c!==null){Rl!==null&&(Rl.status="fulfilled");var i=$c;$c=null,El=0,Rl=null;for(var a=0;a<i.length;a++)(0,i[a])()}}function k3(i,a){var c=[],h={status:"pending",value:null,reason:null,then:function(_){c.push(_)}};return i.then(function(){h.status="fulfilled",h.value=a;for(var _=0;_<c.length;_++)(0,c[_])(a)},function(_){for(h.status="rejected",h.reason=_,_=0;_<c.length;_++)(0,c[_])(void 0)}),h}var Wb=M.S;M.S=function(i,a){Rw=ct(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&C3(i,a),Wb!==null&&Wb(i,a)};var Co=T(null);function Vp(){var i=Co.current;return i!==null?i:It.pooledCache}function Kd(i,a){a===null?X(Co,Co.current):X(Co,a.pool)}function qb(){var i=Vp();return i===null?null:{parent:_r._currentValue,pool:i}}var Nl=Error(s(460)),Gp=Error(s(474)),Xd=Error(s(542)),Zd={then:function(){}};function Vb(i){return i=i.status,i==="fulfilled"||i==="rejected"}function Gb(i,a,c){switch(c=i[c],c===void 0?i.push(a):c!==a&&(a.then(jn,jn),a=c),a.status){case"fulfilled":return a.value;case"rejected":throw i=a.reason,Kb(i),i;default:if(typeof a.status=="string")a.then(jn,jn);else{if(i=It,i!==null&&100<i.shellSuspendCounter)throw Error(s(482));i=a,i.status="pending",i.then(function(h){if(a.status==="pending"){var _=a;_.status="fulfilled",_.value=h}},function(h){if(a.status==="pending"){var _=a;_.status="rejected",_.reason=h}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw i=a.reason,Kb(i),i}throw Eo=a,Nl}}function ko(i){try{var a=i._init;return a(i._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(Eo=c,Nl):c}}var Eo=null;function Yb(){if(Eo===null)throw Error(s(459));var i=Eo;return Eo=null,i}function Kb(i){if(i===Nl||i===Xd)throw Error(s(483))}var jl=null,Uc=0;function Qd(i){var a=Uc;return Uc+=1,jl===null&&(jl=[]),Gb(jl,i,a)}function Hc(i,a){a=a.props.ref,i.ref=a!==void 0?a:null}function Jd(i,a){throw a.$$typeof===x?Error(s(525)):(i=Object.prototype.toString.call(a),Error(s(31,i==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":i)))}function Xb(i){function a(J,Q){if(i){var se=J.deletions;se===null?(J.deletions=[Q],J.flags|=16):se.push(Q)}}function c(J,Q){if(!i)return null;for(;Q!==null;)a(J,Q),Q=Q.sibling;return null}function h(J){for(var Q=new Map;J!==null;)J.key!==null?Q.set(J.key,J):Q.set(J.index,J),J=J.sibling;return Q}function _(J,Q){return J=Mn(J,Q),J.index=0,J.sibling=null,J}function y(J,Q,se){return J.index=se,i?(se=J.alternate,se!==null?(se=se.index,se<Q?(J.flags|=67108866,Q):se):(J.flags|=67108866,Q)):(J.flags|=1048576,Q)}function j(J){return i&&J.alternate===null&&(J.flags|=67108866),J}function z(J,Q,se,me){return Q===null||Q.tag!==6?(Q=Op(se,J.mode,me),Q.return=J,Q):(Q=_(Q,se),Q.return=J,Q)}function K(J,Q,se,me){var $e=se.type;return $e===C?fe(J,Q,se.props.children,me,se.key):Q!==null&&(Q.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===$&&ko($e)===Q.type)?(Q=_(Q,se.props),Hc(Q,se),Q.return=J,Q):(Q=qd(se.type,se.key,se.props,null,J.mode,me),Hc(Q,se),Q.return=J,Q)}function ie(J,Q,se,me){return Q===null||Q.tag!==4||Q.stateNode.containerInfo!==se.containerInfo||Q.stateNode.implementation!==se.implementation?(Q=Bp(se,J.mode,me),Q.return=J,Q):(Q=_(Q,se.children||[]),Q.return=J,Q)}function fe(J,Q,se,me,$e){return Q===null||Q.tag!==7?(Q=yo(se,J.mode,me,$e),Q.return=J,Q):(Q=_(Q,se),Q.return=J,Q)}function ge(J,Q,se){if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return Q=Op(""+Q,J.mode,se),Q.return=J,Q;if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case b:return se=qd(Q.type,Q.key,Q.props,null,J.mode,se),Hc(se,Q),se.return=J,se;case w:return Q=Bp(Q,J.mode,se),Q.return=J,Q;case $:return Q=ko(Q),ge(J,Q,se)}if(F(Q)||U(Q))return Q=yo(Q,J.mode,se,null),Q.return=J,Q;if(typeof Q.then=="function")return ge(J,Qd(Q),se);if(Q.$$typeof===N)return ge(J,Yd(J,Q),se);Jd(J,Q)}return null}function ae(J,Q,se,me){var $e=Q!==null?Q.key:null;if(typeof se=="string"&&se!==""||typeof se=="number"||typeof se=="bigint")return $e!==null?null:z(J,Q,""+se,me);if(typeof se=="object"&&se!==null){switch(se.$$typeof){case b:return se.key===$e?K(J,Q,se,me):null;case w:return se.key===$e?ie(J,Q,se,me):null;case $:return se=ko(se),ae(J,Q,se,me)}if(F(se)||U(se))return $e!==null?null:fe(J,Q,se,me,null);if(typeof se.then=="function")return ae(J,Q,Qd(se),me);if(se.$$typeof===N)return ae(J,Q,Yd(J,se),me);Jd(J,se)}return null}function ue(J,Q,se,me,$e){if(typeof me=="string"&&me!==""||typeof me=="number"||typeof me=="bigint")return J=J.get(se)||null,z(Q,J,""+me,$e);if(typeof me=="object"&&me!==null){switch(me.$$typeof){case b:return J=J.get(me.key===null?se:me.key)||null,K(Q,J,me,$e);case w:return J=J.get(me.key===null?se:me.key)||null,ie(Q,J,me,$e);case $:return me=ko(me),ue(J,Q,se,me,$e)}if(F(me)||U(me))return J=J.get(se)||null,fe(Q,J,me,$e,null);if(typeof me.then=="function")return ue(J,Q,se,Qd(me),$e);if(me.$$typeof===N)return ue(J,Q,se,Yd(Q,me),$e);Jd(Q,me)}return null}function Te(J,Q,se,me){for(var $e=null,xt=null,Oe=Q,st=Q=0,pt=null;Oe!==null&&st<se.length;st++){Oe.index>st?(pt=Oe,Oe=null):pt=Oe.sibling;var yt=ae(J,Oe,se[st],me);if(yt===null){Oe===null&&(Oe=pt);break}i&&Oe&&yt.alternate===null&&a(J,Oe),Q=y(yt,Q,st),xt===null?$e=yt:xt.sibling=yt,xt=yt,Oe=pt}if(st===se.length)return c(J,Oe),gt&&Tn(J,st),$e;if(Oe===null){for(;st<se.length;st++)Oe=ge(J,se[st],me),Oe!==null&&(Q=y(Oe,Q,st),xt===null?$e=Oe:xt.sibling=Oe,xt=Oe);return gt&&Tn(J,st),$e}for(Oe=h(Oe);st<se.length;st++)pt=ue(Oe,J,st,se[st],me),pt!==null&&(i&&pt.alternate!==null&&Oe.delete(pt.key===null?st:pt.key),Q=y(pt,Q,st),xt===null?$e=pt:xt.sibling=pt,xt=pt);return i&&Oe.forEach(function(Ba){return a(J,Ba)}),gt&&Tn(J,st),$e}function Ye(J,Q,se,me){if(se==null)throw Error(s(151));for(var $e=null,xt=null,Oe=Q,st=Q=0,pt=null,yt=se.next();Oe!==null&&!yt.done;st++,yt=se.next()){Oe.index>st?(pt=Oe,Oe=null):pt=Oe.sibling;var Ba=ae(J,Oe,yt.value,me);if(Ba===null){Oe===null&&(Oe=pt);break}i&&Oe&&Ba.alternate===null&&a(J,Oe),Q=y(Ba,Q,st),xt===null?$e=Ba:xt.sibling=Ba,xt=Ba,Oe=pt}if(yt.done)return c(J,Oe),gt&&Tn(J,st),$e;if(Oe===null){for(;!yt.done;st++,yt=se.next())yt=ge(J,yt.value,me),yt!==null&&(Q=y(yt,Q,st),xt===null?$e=yt:xt.sibling=yt,xt=yt);return gt&&Tn(J,st),$e}for(Oe=h(Oe);!yt.done;st++,yt=se.next())yt=ue(Oe,J,st,yt.value,me),yt!==null&&(i&&yt.alternate!==null&&Oe.delete(yt.key===null?st:yt.key),Q=y(yt,Q,st),xt===null?$e=yt:xt.sibling=yt,xt=yt);return i&&Oe.forEach(function(BD){return a(J,BD)}),gt&&Tn(J,st),$e}function Dt(J,Q,se,me){if(typeof se=="object"&&se!==null&&se.type===C&&se.key===null&&(se=se.props.children),typeof se=="object"&&se!==null){switch(se.$$typeof){case b:e:{for(var $e=se.key;Q!==null;){if(Q.key===$e){if($e=se.type,$e===C){if(Q.tag===7){c(J,Q.sibling),me=_(Q,se.props.children),me.return=J,J=me;break e}}else if(Q.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===$&&ko($e)===Q.type){c(J,Q.sibling),me=_(Q,se.props),Hc(me,se),me.return=J,J=me;break e}c(J,Q);break}else a(J,Q);Q=Q.sibling}se.type===C?(me=yo(se.props.children,J.mode,me,se.key),me.return=J,J=me):(me=qd(se.type,se.key,se.props,null,J.mode,me),Hc(me,se),me.return=J,J=me)}return j(J);case w:e:{for($e=se.key;Q!==null;){if(Q.key===$e)if(Q.tag===4&&Q.stateNode.containerInfo===se.containerInfo&&Q.stateNode.implementation===se.implementation){c(J,Q.sibling),me=_(Q,se.children||[]),me.return=J,J=me;break e}else{c(J,Q);break}else a(J,Q);Q=Q.sibling}me=Bp(se,J.mode,me),me.return=J,J=me}return j(J);case $:return se=ko(se),Dt(J,Q,se,me)}if(F(se))return Te(J,Q,se,me);if(U(se)){if($e=U(se),typeof $e!="function")throw Error(s(150));return se=$e.call(se),Ye(J,Q,se,me)}if(typeof se.then=="function")return Dt(J,Q,Qd(se),me);if(se.$$typeof===N)return Dt(J,Q,Yd(J,se),me);Jd(J,se)}return typeof se=="string"&&se!==""||typeof se=="number"||typeof se=="bigint"?(se=""+se,Q!==null&&Q.tag===6?(c(J,Q.sibling),me=_(Q,se),me.return=J,J=me):(c(J,Q),me=Op(se,J.mode,me),me.return=J,J=me),j(J)):c(J,Q)}return function(J,Q,se,me){try{Uc=0;var $e=Dt(J,Q,se,me);return jl=null,$e}catch(Oe){if(Oe===Nl||Oe===Xd)throw Oe;var xt=Bs(29,Oe,null,J.mode);return xt.lanes=me,xt.return=J,xt}finally{}}}var Ro=Xb(!0),Zb=Xb(!1),xa=!1;function Yp(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Kp(i,a){i=i.updateQueue,a.updateQueue===i&&(a.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function ya(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function ba(i,a,c){var h=i.updateQueue;if(h===null)return null;if(h=h.shared,(St&2)!==0){var _=h.pending;return _===null?a.next=a:(a.next=_.next,_.next=a),h.pending=a,a=Wd(i),Lb(i,null,c),a}return Fd(i,h,a,c),Wd(i)}function Fc(i,a,c){if(a=a.updateQueue,a!==null&&(a=a.shared,(c&4194048)!==0)){var h=a.lanes;h&=i.pendingLanes,c|=h,a.lanes=c,Rt(i,c)}}function Xp(i,a){var c=i.updateQueue,h=i.alternate;if(h!==null&&(h=h.updateQueue,c===h)){var _=null,y=null;if(c=c.firstBaseUpdate,c!==null){do{var j={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};y===null?_=y=j:y=y.next=j,c=c.next}while(c!==null);y===null?_=y=a:y=y.next=a}else _=y=a;c={baseState:h.baseState,firstBaseUpdate:_,lastBaseUpdate:y,shared:h.shared,callbacks:h.callbacks},i.updateQueue=c;return}i=c.lastBaseUpdate,i===null?c.firstBaseUpdate=a:i.next=a,c.lastBaseUpdate=a}var Zp=!1;function Wc(){if(Zp){var i=Rl;if(i!==null)throw i}}function qc(i,a,c,h){Zp=!1;var _=i.updateQueue;xa=!1;var y=_.firstBaseUpdate,j=_.lastBaseUpdate,z=_.shared.pending;if(z!==null){_.shared.pending=null;var K=z,ie=K.next;K.next=null,j===null?y=ie:j.next=ie,j=K;var fe=i.alternate;fe!==null&&(fe=fe.updateQueue,z=fe.lastBaseUpdate,z!==j&&(z===null?fe.firstBaseUpdate=ie:z.next=ie,fe.lastBaseUpdate=K))}if(y!==null){var ge=_.baseState;j=0,fe=ie=K=null,z=y;do{var ae=z.lane&-536870913,ue=ae!==z.lane;if(ue?(mt&ae)===ae:(h&ae)===ae){ae!==0&&ae===El&&(Zp=!0),fe!==null&&(fe=fe.next={lane:0,tag:z.tag,payload:z.payload,callback:null,next:null});e:{var Te=i,Ye=z;ae=a;var Dt=c;switch(Ye.tag){case 1:if(Te=Ye.payload,typeof Te=="function"){ge=Te.call(Dt,ge,ae);break e}ge=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=Ye.payload,ae=typeof Te=="function"?Te.call(Dt,ge,ae):Te,ae==null)break e;ge=p({},ge,ae);break e;case 2:xa=!0}}ae=z.callback,ae!==null&&(i.flags|=64,ue&&(i.flags|=8192),ue=_.callbacks,ue===null?_.callbacks=[ae]:ue.push(ae))}else ue={lane:ae,tag:z.tag,payload:z.payload,callback:z.callback,next:null},fe===null?(ie=fe=ue,K=ge):fe=fe.next=ue,j|=ae;if(z=z.next,z===null){if(z=_.shared.pending,z===null)break;ue=z,z=ue.next,ue.next=null,_.lastBaseUpdate=ue,_.shared.pending=null}}while(!0);fe===null&&(K=ge),_.baseState=K,_.firstBaseUpdate=ie,_.lastBaseUpdate=fe,y===null&&(_.shared.lanes=0),Ea|=j,i.lanes=j,i.memoizedState=ge}}function Qb(i,a){if(typeof i!="function")throw Error(s(191,i));i.call(a)}function Jb(i,a){var c=i.callbacks;if(c!==null)for(i.callbacks=null,i=0;i<c.length;i++)Qb(c[i],a)}var Al=T(null),eh=T(0);function e1(i,a){i=Fn,X(eh,i),X(Al,a),Fn=i|a.baseLanes}function Qp(){X(eh,Fn),X(Al,Al.current)}function Jp(){Fn=eh.current,G(Al),G(eh)}var Ps=T(null),ci=null;function wa(i){var a=i.alternate;X(pr,pr.current&1),X(Ps,i),ci===null&&(a===null||Al.current!==null||a.memoizedState!==null)&&(ci=i)}function eg(i){X(pr,pr.current),X(Ps,i),ci===null&&(ci=i)}function t1(i){i.tag===22?(X(pr,pr.current),X(Ps,i),ci===null&&(ci=i)):Sa()}function Sa(){X(pr,pr.current),X(Ps,Ps.current)}function Is(i){G(Ps),ci===i&&(ci=null),G(pr)}var pr=T(0);function th(i){for(var a=i;a!==null;){if(a.tag===13){var c=a.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||av(c)||ov(c)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===i)break;for(;a.sibling===null;){if(a.return===null||a.return===i)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var On=0,tt=null,Mt=null,xr=null,rh=!1,Ml=!1,No=!1,sh=0,Vc=0,Tl=null,E3=0;function ir(){throw Error(s(321))}function tg(i,a){if(a===null)return!1;for(var c=0;c<a.length&&c<i.length;c++)if(!Os(i[c],a[c]))return!1;return!0}function rg(i,a,c,h,_,y){return On=y,tt=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,M.H=i===null||i.memoizedState===null?I1:vg,No=!1,y=c(h,_),No=!1,Ml&&(y=s1(a,c,h,_)),r1(i),y}function r1(i){M.H=Kc;var a=Mt!==null&&Mt.next!==null;if(On=0,xr=Mt=tt=null,rh=!1,Vc=0,Tl=null,a)throw Error(s(300));i===null||yr||(i=i.dependencies,i!==null&&Gd(i)&&(yr=!0))}function s1(i,a,c,h){tt=i;var _=0;do{if(Ml&&(Tl=null),Vc=0,Ml=!1,25<=_)throw Error(s(301));if(_+=1,xr=Mt=null,i.updateQueue!=null){var y=i.updateQueue;y.lastEffect=null,y.events=null,y.stores=null,y.memoCache!=null&&(y.memoCache.index=0)}M.H=z1,y=a(c,h)}while(Ml);return y}function R3(){var i=M.H,a=i.useState()[0];return a=typeof a.then=="function"?Gc(a):a,i=i.useState()[0],(Mt!==null?Mt.memoizedState:null)!==i&&(tt.flags|=1024),a}function sg(){var i=sh!==0;return sh=0,i}function ig(i,a,c){a.updateQueue=i.updateQueue,a.flags&=-2053,i.lanes&=~c}function ng(i){if(rh){for(i=i.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}rh=!1}On=0,xr=Mt=tt=null,Ml=!1,Vc=sh=0,Tl=null}function vs(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return xr===null?tt.memoizedState=xr=i:xr=xr.next=i,xr}function gr(){if(Mt===null){var i=tt.alternate;i=i!==null?i.memoizedState:null}else i=Mt.next;var a=xr===null?tt.memoizedState:xr.next;if(a!==null)xr=a,Mt=i;else{if(i===null)throw tt.alternate===null?Error(s(467)):Error(s(310));Mt=i,i={memoizedState:Mt.memoizedState,baseState:Mt.baseState,baseQueue:Mt.baseQueue,queue:Mt.queue,next:null},xr===null?tt.memoizedState=xr=i:xr=xr.next=i}return xr}function ih(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Gc(i){var a=Vc;return Vc+=1,Tl===null&&(Tl=[]),i=Gb(Tl,i,a),a=tt,(xr===null?a.memoizedState:xr.next)===null&&(a=a.alternate,M.H=a===null||a.memoizedState===null?I1:vg),i}function nh(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return Gc(i);if(i.$$typeof===N)return ts(i)}throw Error(s(438,String(i)))}function ag(i){var a=null,c=tt.updateQueue;if(c!==null&&(a=c.memoCache),a==null){var h=tt.alternate;h!==null&&(h=h.updateQueue,h!==null&&(h=h.memoCache,h!=null&&(a={data:h.data.map(function(_){return _.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),c===null&&(c=ih(),tt.updateQueue=c),c.memoCache=a,c=a.data[a.index],c===void 0)for(c=a.data[a.index]=Array(i),h=0;h<i;h++)c[h]=Y;return a.index++,c}function Bn(i,a){return typeof a=="function"?a(i):a}function ah(i){var a=gr();return og(a,Mt,i)}function og(i,a,c){var h=i.queue;if(h===null)throw Error(s(311));h.lastRenderedReducer=c;var _=i.baseQueue,y=h.pending;if(y!==null){if(_!==null){var j=_.next;_.next=y.next,y.next=j}a.baseQueue=_=y,h.pending=null}if(y=i.baseState,_===null)i.memoizedState=y;else{a=_.next;var z=j=null,K=null,ie=a,fe=!1;do{var ge=ie.lane&-536870913;if(ge!==ie.lane?(mt&ge)===ge:(On&ge)===ge){var ae=ie.revertLane;if(ae===0)K!==null&&(K=K.next={lane:0,revertLane:0,gesture:null,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null}),ge===El&&(fe=!0);else if((On&ae)===ae){ie=ie.next,ae===El&&(fe=!0);continue}else ge={lane:0,revertLane:ie.revertLane,gesture:null,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null},K===null?(z=K=ge,j=y):K=K.next=ge,tt.lanes|=ae,Ea|=ae;ge=ie.action,No&&c(y,ge),y=ie.hasEagerState?ie.eagerState:c(y,ge)}else ae={lane:ge,revertLane:ie.revertLane,gesture:ie.gesture,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null},K===null?(z=K=ae,j=y):K=K.next=ae,tt.lanes|=ge,Ea|=ge;ie=ie.next}while(ie!==null&&ie!==a);if(K===null?j=y:K.next=z,!Os(y,i.memoizedState)&&(yr=!0,fe&&(c=Rl,c!==null)))throw c;i.memoizedState=y,i.baseState=j,i.baseQueue=K,h.lastRenderedState=y}return _===null&&(h.lanes=0),[i.memoizedState,h.dispatch]}function lg(i){var a=gr(),c=a.queue;if(c===null)throw Error(s(311));c.lastRenderedReducer=i;var h=c.dispatch,_=c.pending,y=a.memoizedState;if(_!==null){c.pending=null;var j=_=_.next;do y=i(y,j.action),j=j.next;while(j!==_);Os(y,a.memoizedState)||(yr=!0),a.memoizedState=y,a.baseQueue===null&&(a.baseState=y),c.lastRenderedState=y}return[y,h]}function i1(i,a,c){var h=tt,_=gr(),y=gt;if(y){if(c===void 0)throw Error(s(407));c=c()}else c=a();var j=!Os((Mt||_).memoizedState,c);if(j&&(_.memoizedState=c,yr=!0),_=_.queue,dg(o1.bind(null,h,_,i),[i]),_.getSnapshot!==a||j||xr!==null&&xr.memoizedState.tag&1){if(h.flags|=2048,Dl(9,{destroy:void 0},a1.bind(null,h,_,c,a),null),It===null)throw Error(s(349));y||(On&127)!==0||n1(h,a,c)}return c}function n1(i,a,c){i.flags|=16384,i={getSnapshot:a,value:c},a=tt.updateQueue,a===null?(a=ih(),tt.updateQueue=a,a.stores=[i]):(c=a.stores,c===null?a.stores=[i]:c.push(i))}function a1(i,a,c,h){a.value=c,a.getSnapshot=h,l1(a)&&c1(i)}function o1(i,a,c){return c(function(){l1(a)&&c1(i)})}function l1(i){var a=i.getSnapshot;i=i.value;try{var c=a();return!Os(i,c)}catch{return!0}}function c1(i){var a=xo(i,2);a!==null&&Ns(a,i,2)}function cg(i){var a=vs();if(typeof i=="function"){var c=i;if(i=c(),No){ds(!0);try{c()}finally{ds(!1)}}}return a.memoizedState=a.baseState=i,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bn,lastRenderedState:i},a}function u1(i,a,c,h){return i.baseState=c,og(i,Mt,typeof h=="function"?h:Bn)}function N3(i,a,c,h,_){if(ch(i))throw Error(s(485));if(i=a.action,i!==null){var y={payload:_,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(j){y.listeners.push(j)}};M.T!==null?c(!0):y.isTransition=!1,h(y),c=a.pending,c===null?(y.next=a.pending=y,d1(a,y)):(y.next=c.next,a.pending=c.next=y)}}function d1(i,a){var c=a.action,h=a.payload,_=i.state;if(a.isTransition){var y=M.T,j={};M.T=j;try{var z=c(_,h),K=M.S;K!==null&&K(j,z),h1(i,a,z)}catch(ie){ug(i,a,ie)}finally{y!==null&&j.types!==null&&(y.types=j.types),M.T=y}}else try{y=c(_,h),h1(i,a,y)}catch(ie){ug(i,a,ie)}}function h1(i,a,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(h){f1(i,a,h)},function(h){return ug(i,a,h)}):f1(i,a,c)}function f1(i,a,c){a.status="fulfilled",a.value=c,m1(a),i.state=c,a=i.pending,a!==null&&(c=a.next,c===a?i.pending=null:(c=c.next,a.next=c,d1(i,c)))}function ug(i,a,c){var h=i.pending;if(i.pending=null,h!==null){h=h.next;do a.status="rejected",a.reason=c,m1(a),a=a.next;while(a!==h)}i.action=null}function m1(i){i=i.listeners;for(var a=0;a<i.length;a++)(0,i[a])()}function p1(i,a){return a}function g1(i,a){if(gt){var c=It.formState;if(c!==null){e:{var h=tt;if(gt){if(Ut){t:{for(var _=Ut,y=li;_.nodeType!==8;){if(!y){_=null;break t}if(_=ui(_.nextSibling),_===null){_=null;break t}}y=_.data,_=y==="F!"||y==="F"?_:null}if(_){Ut=ui(_.nextSibling),h=_.data==="F!";break e}}va(h)}h=!1}h&&(a=c[0])}}return c=vs(),c.memoizedState=c.baseState=a,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:p1,lastRenderedState:a},c.queue=h,c=O1.bind(null,tt,h),h.dispatch=c,h=cg(!1),y=gg.bind(null,tt,!1,h.queue),h=vs(),_={state:a,dispatch:null,action:i,pending:null},h.queue=_,c=N3.bind(null,tt,_,y,c),_.dispatch=c,h.memoizedState=i,[a,c,!1]}function v1(i){var a=gr();return _1(a,Mt,i)}function _1(i,a,c){if(a=og(i,a,p1)[0],i=ah(Bn)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var h=Gc(a)}catch(j){throw j===Nl?Xd:j}else h=a;a=gr();var _=a.queue,y=_.dispatch;return c!==a.memoizedState&&(tt.flags|=2048,Dl(9,{destroy:void 0},j3.bind(null,_,c),null)),[h,y,i]}function j3(i,a){i.action=a}function x1(i){var a=gr(),c=Mt;if(c!==null)return _1(a,c,i);gr(),a=a.memoizedState,c=gr();var h=c.queue.dispatch;return c.memoizedState=i,[a,h,!1]}function Dl(i,a,c,h){return i={tag:i,create:c,deps:h,inst:a,next:null},a=tt.updateQueue,a===null&&(a=ih(),tt.updateQueue=a),c=a.lastEffect,c===null?a.lastEffect=i.next=i:(h=c.next,c.next=i,i.next=h,a.lastEffect=i),i}function y1(){return gr().memoizedState}function oh(i,a,c,h){var _=vs();tt.flags|=i,_.memoizedState=Dl(1|a,{destroy:void 0},c,h===void 0?null:h)}function lh(i,a,c,h){var _=gr();h=h===void 0?null:h;var y=_.memoizedState.inst;Mt!==null&&h!==null&&tg(h,Mt.memoizedState.deps)?_.memoizedState=Dl(a,y,c,h):(tt.flags|=i,_.memoizedState=Dl(1|a,y,c,h))}function b1(i,a){oh(8390656,8,i,a)}function dg(i,a){lh(2048,8,i,a)}function A3(i){tt.flags|=4;var a=tt.updateQueue;if(a===null)a=ih(),tt.updateQueue=a,a.events=[i];else{var c=a.events;c===null?a.events=[i]:c.push(i)}}function w1(i){var a=gr().memoizedState;return A3({ref:a,nextImpl:i}),function(){if((St&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}function S1(i,a){return lh(4,2,i,a)}function C1(i,a){return lh(4,4,i,a)}function k1(i,a){if(typeof a=="function"){i=i();var c=a(i);return function(){typeof c=="function"?c():a(null)}}if(a!=null)return i=i(),a.current=i,function(){a.current=null}}function E1(i,a,c){c=c!=null?c.concat([i]):null,lh(4,4,k1.bind(null,a,i),c)}function hg(){}function R1(i,a){var c=gr();a=a===void 0?null:a;var h=c.memoizedState;return a!==null&&tg(a,h[1])?h[0]:(c.memoizedState=[i,a],i)}function N1(i,a){var c=gr();a=a===void 0?null:a;var h=c.memoizedState;if(a!==null&&tg(a,h[1]))return h[0];if(h=i(),No){ds(!0);try{i()}finally{ds(!1)}}return c.memoizedState=[h,a],h}function fg(i,a,c){return c===void 0||(On&1073741824)!==0&&(mt&261930)===0?i.memoizedState=a:(i.memoizedState=c,i=jw(),tt.lanes|=i,Ea|=i,c)}function j1(i,a,c,h){return Os(c,a)?c:Al.current!==null?(i=fg(i,c,h),Os(i,a)||(yr=!0),i):(On&42)===0||(On&1073741824)!==0&&(mt&261930)===0?(yr=!0,i.memoizedState=c):(i=jw(),tt.lanes|=i,Ea|=i,a)}function A1(i,a,c,h,_){var y=P.p;P.p=y!==0&&8>y?y:8;var j=M.T,z={};M.T=z,gg(i,!1,a,c);try{var K=_(),ie=M.S;if(ie!==null&&ie(z,K),K!==null&&typeof K=="object"&&typeof K.then=="function"){var fe=k3(K,h);Yc(i,a,fe,Us(i))}else Yc(i,a,h,Us(i))}catch(ge){Yc(i,a,{then:function(){},status:"rejected",reason:ge},Us())}finally{P.p=y,j!==null&&z.types!==null&&(j.types=z.types),M.T=j}}function M3(){}function mg(i,a,c,h){if(i.tag!==5)throw Error(s(476));var _=M1(i).queue;A1(i,_,a,O,c===null?M3:function(){return T1(i),c(h)})}function M1(i){var a=i.memoizedState;if(a!==null)return a;a={memoizedState:O,baseState:O,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bn,lastRenderedState:O},next:null};var c={};return a.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bn,lastRenderedState:c},next:null},i.memoizedState=a,i=i.alternate,i!==null&&(i.memoizedState=a),a}function T1(i){var a=M1(i);a.next===null&&(a=i.alternate.memoizedState),Yc(i,a.next.queue,{},Us())}function pg(){return ts(du)}function D1(){return gr().memoizedState}function L1(){return gr().memoizedState}function T3(i){for(var a=i.return;a!==null;){switch(a.tag){case 24:case 3:var c=Us();i=ya(c);var h=ba(a,i,c);h!==null&&(Ns(h,a,c),Fc(h,a,c)),a={cache:Wp()},i.payload=a;return}a=a.return}}function D3(i,a,c){var h=Us();c={lane:h,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},ch(i)?B1(a,c):(c=Dp(i,a,c,h),c!==null&&(Ns(c,i,h),P1(c,a,h)))}function O1(i,a,c){var h=Us();Yc(i,a,c,h)}function Yc(i,a,c,h){var _={lane:h,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(ch(i))B1(a,_);else{var y=i.alternate;if(i.lanes===0&&(y===null||y.lanes===0)&&(y=a.lastRenderedReducer,y!==null))try{var j=a.lastRenderedState,z=y(j,c);if(_.hasEagerState=!0,_.eagerState=z,Os(z,j))return Fd(i,a,_,0),It===null&&Hd(),!1}catch{}finally{}if(c=Dp(i,a,_,h),c!==null)return Ns(c,i,h),P1(c,a,h),!0}return!1}function gg(i,a,c,h){if(h={lane:2,revertLane:Yg(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},ch(i)){if(a)throw Error(s(479))}else a=Dp(i,c,h,2),a!==null&&Ns(a,i,2)}function ch(i){var a=i.alternate;return i===tt||a!==null&&a===tt}function B1(i,a){Ml=rh=!0;var c=i.pending;c===null?a.next=a:(a.next=c.next,c.next=a),i.pending=a}function P1(i,a,c){if((c&4194048)!==0){var h=a.lanes;h&=i.pendingLanes,c|=h,a.lanes=c,Rt(i,c)}}var Kc={readContext:ts,use:nh,useCallback:ir,useContext:ir,useEffect:ir,useImperativeHandle:ir,useLayoutEffect:ir,useInsertionEffect:ir,useMemo:ir,useReducer:ir,useRef:ir,useState:ir,useDebugValue:ir,useDeferredValue:ir,useTransition:ir,useSyncExternalStore:ir,useId:ir,useHostTransitionStatus:ir,useFormState:ir,useActionState:ir,useOptimistic:ir,useMemoCache:ir,useCacheRefresh:ir};Kc.useEffectEvent=ir;var I1={readContext:ts,use:nh,useCallback:function(i,a){return vs().memoizedState=[i,a===void 0?null:a],i},useContext:ts,useEffect:b1,useImperativeHandle:function(i,a,c){c=c!=null?c.concat([i]):null,oh(4194308,4,k1.bind(null,a,i),c)},useLayoutEffect:function(i,a){return oh(4194308,4,i,a)},useInsertionEffect:function(i,a){oh(4,2,i,a)},useMemo:function(i,a){var c=vs();a=a===void 0?null:a;var h=i();if(No){ds(!0);try{i()}finally{ds(!1)}}return c.memoizedState=[h,a],h},useReducer:function(i,a,c){var h=vs();if(c!==void 0){var _=c(a);if(No){ds(!0);try{c(a)}finally{ds(!1)}}}else _=a;return h.memoizedState=h.baseState=_,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:_},h.queue=i,i=i.dispatch=D3.bind(null,tt,i),[h.memoizedState,i]},useRef:function(i){var a=vs();return i={current:i},a.memoizedState=i},useState:function(i){i=cg(i);var a=i.queue,c=O1.bind(null,tt,a);return a.dispatch=c,[i.memoizedState,c]},useDebugValue:hg,useDeferredValue:function(i,a){var c=vs();return fg(c,i,a)},useTransition:function(){var i=cg(!1);return i=A1.bind(null,tt,i.queue,!0,!1),vs().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,a,c){var h=tt,_=vs();if(gt){if(c===void 0)throw Error(s(407));c=c()}else{if(c=a(),It===null)throw Error(s(349));(mt&127)!==0||n1(h,a,c)}_.memoizedState=c;var y={value:c,getSnapshot:a};return _.queue=y,b1(o1.bind(null,h,y,i),[i]),h.flags|=2048,Dl(9,{destroy:void 0},a1.bind(null,h,y,c,a),null),c},useId:function(){var i=vs(),a=It.identifierPrefix;if(gt){var c=Qi,h=Zi;c=(h&~(1<<32-Vt(h)-1)).toString(32)+c,a="_"+a+"R_"+c,c=sh++,0<c&&(a+="H"+c.toString(32)),a+="_"}else c=E3++,a="_"+a+"r_"+c.toString(32)+"_";return i.memoizedState=a},useHostTransitionStatus:pg,useFormState:g1,useActionState:g1,useOptimistic:function(i){var a=vs();a.memoizedState=a.baseState=i;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=c,a=gg.bind(null,tt,!0,c),c.dispatch=a,[i,a]},useMemoCache:ag,useCacheRefresh:function(){return vs().memoizedState=T3.bind(null,tt)},useEffectEvent:function(i){var a=vs(),c={impl:i};return a.memoizedState=c,function(){if((St&2)!==0)throw Error(s(440));return c.impl.apply(void 0,arguments)}}},vg={readContext:ts,use:nh,useCallback:R1,useContext:ts,useEffect:dg,useImperativeHandle:E1,useInsertionEffect:S1,useLayoutEffect:C1,useMemo:N1,useReducer:ah,useRef:y1,useState:function(){return ah(Bn)},useDebugValue:hg,useDeferredValue:function(i,a){var c=gr();return j1(c,Mt.memoizedState,i,a)},useTransition:function(){var i=ah(Bn)[0],a=gr().memoizedState;return[typeof i=="boolean"?i:Gc(i),a]},useSyncExternalStore:i1,useId:D1,useHostTransitionStatus:pg,useFormState:v1,useActionState:v1,useOptimistic:function(i,a){var c=gr();return u1(c,Mt,i,a)},useMemoCache:ag,useCacheRefresh:L1};vg.useEffectEvent=w1;var z1={readContext:ts,use:nh,useCallback:R1,useContext:ts,useEffect:dg,useImperativeHandle:E1,useInsertionEffect:S1,useLayoutEffect:C1,useMemo:N1,useReducer:lg,useRef:y1,useState:function(){return lg(Bn)},useDebugValue:hg,useDeferredValue:function(i,a){var c=gr();return Mt===null?fg(c,i,a):j1(c,Mt.memoizedState,i,a)},useTransition:function(){var i=lg(Bn)[0],a=gr().memoizedState;return[typeof i=="boolean"?i:Gc(i),a]},useSyncExternalStore:i1,useId:D1,useHostTransitionStatus:pg,useFormState:x1,useActionState:x1,useOptimistic:function(i,a){var c=gr();return Mt!==null?u1(c,Mt,i,a):(c.baseState=i,[i,c.queue.dispatch])},useMemoCache:ag,useCacheRefresh:L1};z1.useEffectEvent=w1;function _g(i,a,c,h){a=i.memoizedState,c=c(h,a),c=c==null?a:p({},a,c),i.memoizedState=c,i.lanes===0&&(i.updateQueue.baseState=c)}var xg={enqueueSetState:function(i,a,c){i=i._reactInternals;var h=Us(),_=ya(h);_.payload=a,c!=null&&(_.callback=c),a=ba(i,_,h),a!==null&&(Ns(a,i,h),Fc(a,i,h))},enqueueReplaceState:function(i,a,c){i=i._reactInternals;var h=Us(),_=ya(h);_.tag=1,_.payload=a,c!=null&&(_.callback=c),a=ba(i,_,h),a!==null&&(Ns(a,i,h),Fc(a,i,h))},enqueueForceUpdate:function(i,a){i=i._reactInternals;var c=Us(),h=ya(c);h.tag=2,a!=null&&(h.callback=a),a=ba(i,h,c),a!==null&&(Ns(a,i,c),Fc(a,i,c))}};function $1(i,a,c,h,_,y,j){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(h,y,j):a.prototype&&a.prototype.isPureReactComponent?!Oc(c,h)||!Oc(_,y):!0}function U1(i,a,c,h){i=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(c,h),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(c,h),a.state!==i&&xg.enqueueReplaceState(a,a.state,null)}function jo(i,a){var c=a;if("ref"in a){c={};for(var h in a)h!=="ref"&&(c[h]=a[h])}if(i=i.defaultProps){c===a&&(c=p({},c));for(var _ in i)c[_]===void 0&&(c[_]=i[_])}return c}function H1(i){Ud(i)}function F1(i){console.error(i)}function W1(i){Ud(i)}function uh(i,a){try{var c=i.onUncaughtError;c(a.value,{componentStack:a.stack})}catch(h){setTimeout(function(){throw h})}}function q1(i,a,c){try{var h=i.onCaughtError;h(c.value,{componentStack:c.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(_){setTimeout(function(){throw _})}}function yg(i,a,c){return c=ya(c),c.tag=3,c.payload={element:null},c.callback=function(){uh(i,a)},c}function V1(i){return i=ya(i),i.tag=3,i}function G1(i,a,c,h){var _=c.type.getDerivedStateFromError;if(typeof _=="function"){var y=h.value;i.payload=function(){return _(y)},i.callback=function(){q1(a,c,h)}}var j=c.stateNode;j!==null&&typeof j.componentDidCatch=="function"&&(i.callback=function(){q1(a,c,h),typeof _!="function"&&(Ra===null?Ra=new Set([this]):Ra.add(this));var z=h.stack;this.componentDidCatch(h.value,{componentStack:z!==null?z:""})})}function L3(i,a,c,h,_){if(c.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){if(a=c.alternate,a!==null&&kl(a,c,_,!0),c=Ps.current,c!==null){switch(c.tag){case 31:case 13:return ci===null?wh():c.alternate===null&&nr===0&&(nr=3),c.flags&=-257,c.flags|=65536,c.lanes=_,h===Zd?c.flags|=16384:(a=c.updateQueue,a===null?c.updateQueue=new Set([h]):a.add(h),qg(i,h,_)),!1;case 22:return c.flags|=65536,h===Zd?c.flags|=16384:(a=c.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([h])},c.updateQueue=a):(c=a.retryQueue,c===null?a.retryQueue=new Set([h]):c.add(h)),qg(i,h,_)),!1}throw Error(s(435,c.tag))}return qg(i,h,_),wh(),!1}if(gt)return a=Ps.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=_,h!==zp&&(i=Error(s(422),{cause:h}),Ic(ni(i,c)))):(h!==zp&&(a=Error(s(423),{cause:h}),Ic(ni(a,c))),i=i.current.alternate,i.flags|=65536,_&=-_,i.lanes|=_,h=ni(h,c),_=yg(i.stateNode,h,_),Xp(i,_),nr!==4&&(nr=2)),!1;var y=Error(s(520),{cause:h});if(y=ni(y,c),su===null?su=[y]:su.push(y),nr!==4&&(nr=2),a===null)return!0;h=ni(h,c),c=a;do{switch(c.tag){case 3:return c.flags|=65536,i=_&-_,c.lanes|=i,i=yg(c.stateNode,h,i),Xp(c,i),!1;case 1:if(a=c.type,y=c.stateNode,(c.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(Ra===null||!Ra.has(y))))return c.flags|=65536,_&=-_,c.lanes|=_,_=V1(_),G1(_,i,c,h),Xp(c,_),!1}c=c.return}while(c!==null);return!1}var bg=Error(s(461)),yr=!1;function rs(i,a,c,h){a.child=i===null?Zb(a,null,c,h):Ro(a,i.child,c,h)}function Y1(i,a,c,h,_){c=c.render;var y=a.ref;if("ref"in h){var j={};for(var z in h)z!=="ref"&&(j[z]=h[z])}else j=h;return So(a),h=rg(i,a,c,j,y,_),z=sg(),i!==null&&!yr?(ig(i,a,_),Pn(i,a,_)):(gt&&z&&Pp(a),a.flags|=1,rs(i,a,h,_),a.child)}function K1(i,a,c,h,_){if(i===null){var y=c.type;return typeof y=="function"&&!Lp(y)&&y.defaultProps===void 0&&c.compare===null?(a.tag=15,a.type=y,X1(i,a,y,h,_)):(i=qd(c.type,null,h,a,a.mode,_),i.ref=a.ref,i.return=a,a.child=i)}if(y=i.child,!jg(i,_)){var j=y.memoizedProps;if(c=c.compare,c=c!==null?c:Oc,c(j,h)&&i.ref===a.ref)return Pn(i,a,_)}return a.flags|=1,i=Mn(y,h),i.ref=a.ref,i.return=a,a.child=i}function X1(i,a,c,h,_){if(i!==null){var y=i.memoizedProps;if(Oc(y,h)&&i.ref===a.ref)if(yr=!1,a.pendingProps=h=y,jg(i,_))(i.flags&131072)!==0&&(yr=!0);else return a.lanes=i.lanes,Pn(i,a,_)}return wg(i,a,c,h,_)}function Z1(i,a,c,h){var _=h.children,y=i!==null?i.memoizedState:null;if(i===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),h.mode==="hidden"){if((a.flags&128)!==0){if(y=y!==null?y.baseLanes|c:c,i!==null){for(h=a.child=i.child,_=0;h!==null;)_=_|h.lanes|h.childLanes,h=h.sibling;h=_&~y}else h=0,a.child=null;return Q1(i,a,y,c,h)}if((c&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},i!==null&&Kd(a,y!==null?y.cachePool:null),y!==null?e1(a,y):Qp(),t1(a);else return h=a.lanes=536870912,Q1(i,a,y!==null?y.baseLanes|c:c,c,h)}else y!==null?(Kd(a,y.cachePool),e1(a,y),Sa(),a.memoizedState=null):(i!==null&&Kd(a,null),Qp(),Sa());return rs(i,a,_,c),a.child}function Xc(i,a){return i!==null&&i.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function Q1(i,a,c,h,_){var y=Vp();return y=y===null?null:{parent:_r._currentValue,pool:y},a.memoizedState={baseLanes:c,cachePool:y},i!==null&&Kd(a,null),Qp(),t1(a),i!==null&&kl(i,a,h,!0),a.childLanes=_,null}function dh(i,a){return a=fh({mode:a.mode,children:a.children},i.mode),a.ref=i.ref,i.child=a,a.return=i,a}function J1(i,a,c){return Ro(a,i.child,null,c),i=dh(a,a.pendingProps),i.flags|=2,Is(a),a.memoizedState=null,i}function O3(i,a,c){var h=a.pendingProps,_=(a.flags&128)!==0;if(a.flags&=-129,i===null){if(gt){if(h.mode==="hidden")return i=dh(a,h),a.lanes=536870912,Xc(null,i);if(eg(a),(i=Ut)?(i=dS(i,li),i=i!==null&&i.data==="&"?i:null,i!==null&&(a.memoizedState={dehydrated:i,treeContext:pa!==null?{id:Zi,overflow:Qi}:null,retryLane:536870912,hydrationErrors:null},c=Bb(i),c.return=a,a.child=c,es=a,Ut=null)):i=null,i===null)throw va(a);return a.lanes=536870912,null}return dh(a,h)}var y=i.memoizedState;if(y!==null){var j=y.dehydrated;if(eg(a),_)if(a.flags&256)a.flags&=-257,a=J1(i,a,c);else if(a.memoizedState!==null)a.child=i.child,a.flags|=128,a=null;else throw Error(s(558));else if(yr||kl(i,a,c,!1),_=(c&i.childLanes)!==0,yr||_){if(h=It,h!==null&&(j=Xt(h,c),j!==0&&j!==y.retryLane))throw y.retryLane=j,xo(i,j),Ns(h,i,j),bg;wh(),a=J1(i,a,c)}else i=y.treeContext,Ut=ui(j.nextSibling),es=a,gt=!0,ga=null,li=!1,i!==null&&zb(a,i),a=dh(a,h),a.flags|=4096;return a}return i=Mn(i.child,{mode:h.mode,children:h.children}),i.ref=a.ref,a.child=i,i.return=a,i}function hh(i,a){var c=a.ref;if(c===null)i!==null&&i.ref!==null&&(a.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(s(284));(i===null||i.ref!==c)&&(a.flags|=4194816)}}function wg(i,a,c,h,_){return So(a),c=rg(i,a,c,h,void 0,_),h=sg(),i!==null&&!yr?(ig(i,a,_),Pn(i,a,_)):(gt&&h&&Pp(a),a.flags|=1,rs(i,a,c,_),a.child)}function ew(i,a,c,h,_,y){return So(a),a.updateQueue=null,c=s1(a,h,c,_),r1(i),h=sg(),i!==null&&!yr?(ig(i,a,y),Pn(i,a,y)):(gt&&h&&Pp(a),a.flags|=1,rs(i,a,c,y),a.child)}function tw(i,a,c,h,_){if(So(a),a.stateNode===null){var y=bl,j=c.contextType;typeof j=="object"&&j!==null&&(y=ts(j)),y=new c(h,y),a.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=xg,a.stateNode=y,y._reactInternals=a,y=a.stateNode,y.props=h,y.state=a.memoizedState,y.refs={},Yp(a),j=c.contextType,y.context=typeof j=="object"&&j!==null?ts(j):bl,y.state=a.memoizedState,j=c.getDerivedStateFromProps,typeof j=="function"&&(_g(a,c,j,h),y.state=a.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(j=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),j!==y.state&&xg.enqueueReplaceState(y,y.state,null),qc(a,h,y,_),Wc(),y.state=a.memoizedState),typeof y.componentDidMount=="function"&&(a.flags|=4194308),h=!0}else if(i===null){y=a.stateNode;var z=a.memoizedProps,K=jo(c,z);y.props=K;var ie=y.context,fe=c.contextType;j=bl,typeof fe=="object"&&fe!==null&&(j=ts(fe));var ge=c.getDerivedStateFromProps;fe=typeof ge=="function"||typeof y.getSnapshotBeforeUpdate=="function",z=a.pendingProps!==z,fe||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(z||ie!==j)&&U1(a,y,h,j),xa=!1;var ae=a.memoizedState;y.state=ae,qc(a,h,y,_),Wc(),ie=a.memoizedState,z||ae!==ie||xa?(typeof ge=="function"&&(_g(a,c,ge,h),ie=a.memoizedState),(K=xa||$1(a,c,K,h,ae,ie,j))?(fe||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(a.flags|=4194308)):(typeof y.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=h,a.memoizedState=ie),y.props=h,y.state=ie,y.context=j,h=K):(typeof y.componentDidMount=="function"&&(a.flags|=4194308),h=!1)}else{y=a.stateNode,Kp(i,a),j=a.memoizedProps,fe=jo(c,j),y.props=fe,ge=a.pendingProps,ae=y.context,ie=c.contextType,K=bl,typeof ie=="object"&&ie!==null&&(K=ts(ie)),z=c.getDerivedStateFromProps,(ie=typeof z=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(j!==ge||ae!==K)&&U1(a,y,h,K),xa=!1,ae=a.memoizedState,y.state=ae,qc(a,h,y,_),Wc();var ue=a.memoizedState;j!==ge||ae!==ue||xa||i!==null&&i.dependencies!==null&&Gd(i.dependencies)?(typeof z=="function"&&(_g(a,c,z,h),ue=a.memoizedState),(fe=xa||$1(a,c,fe,h,ae,ue,K)||i!==null&&i.dependencies!==null&&Gd(i.dependencies))?(ie||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(h,ue,K),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(h,ue,K)),typeof y.componentDidUpdate=="function"&&(a.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof y.componentDidUpdate!="function"||j===i.memoizedProps&&ae===i.memoizedState||(a.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||j===i.memoizedProps&&ae===i.memoizedState||(a.flags|=1024),a.memoizedProps=h,a.memoizedState=ue),y.props=h,y.state=ue,y.context=K,h=fe):(typeof y.componentDidUpdate!="function"||j===i.memoizedProps&&ae===i.memoizedState||(a.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||j===i.memoizedProps&&ae===i.memoizedState||(a.flags|=1024),h=!1)}return y=h,hh(i,a),h=(a.flags&128)!==0,y||h?(y=a.stateNode,c=h&&typeof c.getDerivedStateFromError!="function"?null:y.render(),a.flags|=1,i!==null&&h?(a.child=Ro(a,i.child,null,_),a.child=Ro(a,null,c,_)):rs(i,a,c,_),a.memoizedState=y.state,i=a.child):i=Pn(i,a,_),i}function rw(i,a,c,h){return bo(),a.flags|=256,rs(i,a,c,h),a.child}var Sg={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Cg(i){return{baseLanes:i,cachePool:qb()}}function kg(i,a,c){return i=i!==null?i.childLanes&~c:0,a&&(i|=$s),i}function sw(i,a,c){var h=a.pendingProps,_=!1,y=(a.flags&128)!==0,j;if((j=y)||(j=i!==null&&i.memoizedState===null?!1:(pr.current&2)!==0),j&&(_=!0,a.flags&=-129),j=(a.flags&32)!==0,a.flags&=-33,i===null){if(gt){if(_?wa(a):Sa(),(i=Ut)?(i=dS(i,li),i=i!==null&&i.data!=="&"?i:null,i!==null&&(a.memoizedState={dehydrated:i,treeContext:pa!==null?{id:Zi,overflow:Qi}:null,retryLane:536870912,hydrationErrors:null},c=Bb(i),c.return=a,a.child=c,es=a,Ut=null)):i=null,i===null)throw va(a);return ov(i)?a.lanes=32:a.lanes=536870912,null}var z=h.children;return h=h.fallback,_?(Sa(),_=a.mode,z=fh({mode:"hidden",children:z},_),h=yo(h,_,c,null),z.return=a,h.return=a,z.sibling=h,a.child=z,h=a.child,h.memoizedState=Cg(c),h.childLanes=kg(i,j,c),a.memoizedState=Sg,Xc(null,h)):(wa(a),Eg(a,z))}var K=i.memoizedState;if(K!==null&&(z=K.dehydrated,z!==null)){if(y)a.flags&256?(wa(a),a.flags&=-257,a=Rg(i,a,c)):a.memoizedState!==null?(Sa(),a.child=i.child,a.flags|=128,a=null):(Sa(),z=h.fallback,_=a.mode,h=fh({mode:"visible",children:h.children},_),z=yo(z,_,c,null),z.flags|=2,h.return=a,z.return=a,h.sibling=z,a.child=h,Ro(a,i.child,null,c),h=a.child,h.memoizedState=Cg(c),h.childLanes=kg(i,j,c),a.memoizedState=Sg,a=Xc(null,h));else if(wa(a),ov(z)){if(j=z.nextSibling&&z.nextSibling.dataset,j)var ie=j.dgst;j=ie,h=Error(s(419)),h.stack="",h.digest=j,Ic({value:h,source:null,stack:null}),a=Rg(i,a,c)}else if(yr||kl(i,a,c,!1),j=(c&i.childLanes)!==0,yr||j){if(j=It,j!==null&&(h=Xt(j,c),h!==0&&h!==K.retryLane))throw K.retryLane=h,xo(i,h),Ns(j,i,h),bg;av(z)||wh(),a=Rg(i,a,c)}else av(z)?(a.flags|=192,a.child=i.child,a=null):(i=K.treeContext,Ut=ui(z.nextSibling),es=a,gt=!0,ga=null,li=!1,i!==null&&zb(a,i),a=Eg(a,h.children),a.flags|=4096);return a}return _?(Sa(),z=h.fallback,_=a.mode,K=i.child,ie=K.sibling,h=Mn(K,{mode:"hidden",children:h.children}),h.subtreeFlags=K.subtreeFlags&65011712,ie!==null?z=Mn(ie,z):(z=yo(z,_,c,null),z.flags|=2),z.return=a,h.return=a,h.sibling=z,a.child=h,Xc(null,h),h=a.child,z=i.child.memoizedState,z===null?z=Cg(c):(_=z.cachePool,_!==null?(K=_r._currentValue,_=_.parent!==K?{parent:K,pool:K}:_):_=qb(),z={baseLanes:z.baseLanes|c,cachePool:_}),h.memoizedState=z,h.childLanes=kg(i,j,c),a.memoizedState=Sg,Xc(i.child,h)):(wa(a),c=i.child,i=c.sibling,c=Mn(c,{mode:"visible",children:h.children}),c.return=a,c.sibling=null,i!==null&&(j=a.deletions,j===null?(a.deletions=[i],a.flags|=16):j.push(i)),a.child=c,a.memoizedState=null,c)}function Eg(i,a){return a=fh({mode:"visible",children:a},i.mode),a.return=i,i.child=a}function fh(i,a){return i=Bs(22,i,null,a),i.lanes=0,i}function Rg(i,a,c){return Ro(a,i.child,null,c),i=Eg(a,a.pendingProps.children),i.flags|=2,a.memoizedState=null,i}function iw(i,a,c){i.lanes|=a;var h=i.alternate;h!==null&&(h.lanes|=a),Hp(i.return,a,c)}function Ng(i,a,c,h,_,y){var j=i.memoizedState;j===null?i.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:h,tail:c,tailMode:_,treeForkCount:y}:(j.isBackwards=a,j.rendering=null,j.renderingStartTime=0,j.last=h,j.tail=c,j.tailMode=_,j.treeForkCount=y)}function nw(i,a,c){var h=a.pendingProps,_=h.revealOrder,y=h.tail;h=h.children;var j=pr.current,z=(j&2)!==0;if(z?(j=j&1|2,a.flags|=128):j&=1,X(pr,j),rs(i,a,h,c),h=gt?Pc:0,!z&&i!==null&&(i.flags&128)!==0)e:for(i=a.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&iw(i,c,a);else if(i.tag===19)iw(i,c,a);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===a)break e;for(;i.sibling===null;){if(i.return===null||i.return===a)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(_){case"forwards":for(c=a.child,_=null;c!==null;)i=c.alternate,i!==null&&th(i)===null&&(_=c),c=c.sibling;c=_,c===null?(_=a.child,a.child=null):(_=c.sibling,c.sibling=null),Ng(a,!1,_,c,y,h);break;case"backwards":case"unstable_legacy-backwards":for(c=null,_=a.child,a.child=null;_!==null;){if(i=_.alternate,i!==null&&th(i)===null){a.child=_;break}i=_.sibling,_.sibling=c,c=_,_=i}Ng(a,!0,c,null,y,h);break;case"together":Ng(a,!1,null,null,void 0,h);break;default:a.memoizedState=null}return a.child}function Pn(i,a,c){if(i!==null&&(a.dependencies=i.dependencies),Ea|=a.lanes,(c&a.childLanes)===0)if(i!==null){if(kl(i,a,c,!1),(c&a.childLanes)===0)return null}else return null;if(i!==null&&a.child!==i.child)throw Error(s(153));if(a.child!==null){for(i=a.child,c=Mn(i,i.pendingProps),a.child=c,c.return=a;i.sibling!==null;)i=i.sibling,c=c.sibling=Mn(i,i.pendingProps),c.return=a;c.sibling=null}return a.child}function jg(i,a){return(i.lanes&a)!==0?!0:(i=i.dependencies,!!(i!==null&&Gd(i)))}function B3(i,a,c){switch(a.tag){case 3:ce(a,a.stateNode.containerInfo),_a(a,_r,i.memoizedState.cache),bo();break;case 27:case 5:be(a);break;case 4:ce(a,a.stateNode.containerInfo);break;case 10:_a(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,eg(a),null;break;case 13:var h=a.memoizedState;if(h!==null)return h.dehydrated!==null?(wa(a),a.flags|=128,null):(c&a.child.childLanes)!==0?sw(i,a,c):(wa(a),i=Pn(i,a,c),i!==null?i.sibling:null);wa(a);break;case 19:var _=(i.flags&128)!==0;if(h=(c&a.childLanes)!==0,h||(kl(i,a,c,!1),h=(c&a.childLanes)!==0),_){if(h)return nw(i,a,c);a.flags|=128}if(_=a.memoizedState,_!==null&&(_.rendering=null,_.tail=null,_.lastEffect=null),X(pr,pr.current),h)break;return null;case 22:return a.lanes=0,Z1(i,a,c,a.pendingProps);case 24:_a(a,_r,i.memoizedState.cache)}return Pn(i,a,c)}function aw(i,a,c){if(i!==null)if(i.memoizedProps!==a.pendingProps)yr=!0;else{if(!jg(i,c)&&(a.flags&128)===0)return yr=!1,B3(i,a,c);yr=(i.flags&131072)!==0}else yr=!1,gt&&(a.flags&1048576)!==0&&Ib(a,Pc,a.index);switch(a.lanes=0,a.tag){case 16:e:{var h=a.pendingProps;if(i=ko(a.elementType),a.type=i,typeof i=="function")Lp(i)?(h=jo(i,h),a.tag=1,a=tw(null,a,i,h,c)):(a.tag=0,a=wg(null,a,i,h,c));else{if(i!=null){var _=i.$$typeof;if(_===R){a.tag=11,a=Y1(null,a,i,h,c);break e}else if(_===B){a.tag=14,a=K1(null,a,i,h,c);break e}}throw a=I(i)||i,Error(s(306,a,""))}}return a;case 0:return wg(i,a,a.type,a.pendingProps,c);case 1:return h=a.type,_=jo(h,a.pendingProps),tw(i,a,h,_,c);case 3:e:{if(ce(a,a.stateNode.containerInfo),i===null)throw Error(s(387));h=a.pendingProps;var y=a.memoizedState;_=y.element,Kp(i,a),qc(a,h,null,c);var j=a.memoizedState;if(h=j.cache,_a(a,_r,h),h!==y.cache&&Fp(a,[_r],c,!0),Wc(),h=j.element,y.isDehydrated)if(y={element:h,isDehydrated:!1,cache:j.cache},a.updateQueue.baseState=y,a.memoizedState=y,a.flags&256){a=rw(i,a,h,c);break e}else if(h!==_){_=ni(Error(s(424)),a),Ic(_),a=rw(i,a,h,c);break e}else{switch(i=a.stateNode.containerInfo,i.nodeType){case 9:i=i.body;break;default:i=i.nodeName==="HTML"?i.ownerDocument.body:i}for(Ut=ui(i.firstChild),es=a,gt=!0,ga=null,li=!0,c=Zb(a,null,h,c),a.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(bo(),h===_){a=Pn(i,a,c);break e}rs(i,a,h,c)}a=a.child}return a;case 26:return hh(i,a),i===null?(c=vS(a.type,null,a.pendingProps,null))?a.memoizedState=c:gt||(c=a.type,i=a.pendingProps,h=jh(de.current).createElement(c),h[Pt]=a,h[he]=i,ss(h,c,i),zr(h),a.stateNode=h):a.memoizedState=vS(a.type,i.memoizedProps,a.pendingProps,i.memoizedState),null;case 27:return be(a),i===null&>&&(h=a.stateNode=mS(a.type,a.pendingProps,de.current),es=a,li=!0,_=Ut,Ma(a.type)?(lv=_,Ut=ui(h.firstChild)):Ut=_),rs(i,a,a.pendingProps.children,c),hh(i,a),i===null&&(a.flags|=4194304),a.child;case 5:return i===null&>&&((_=h=Ut)&&(h=hD(h,a.type,a.pendingProps,li),h!==null?(a.stateNode=h,es=a,Ut=ui(h.firstChild),li=!1,_=!0):_=!1),_||va(a)),be(a),_=a.type,y=a.pendingProps,j=i!==null?i.memoizedProps:null,h=y.children,sv(_,y)?h=null:j!==null&&sv(_,j)&&(a.flags|=32),a.memoizedState!==null&&(_=rg(i,a,R3,null,null,c),du._currentValue=_),hh(i,a),rs(i,a,h,c),a.child;case 6:return i===null&>&&((i=c=Ut)&&(c=fD(c,a.pendingProps,li),c!==null?(a.stateNode=c,es=a,Ut=null,i=!0):i=!1),i||va(a)),null;case 13:return sw(i,a,c);case 4:return ce(a,a.stateNode.containerInfo),h=a.pendingProps,i===null?a.child=Ro(a,null,h,c):rs(i,a,h,c),a.child;case 11:return Y1(i,a,a.type,a.pendingProps,c);case 7:return rs(i,a,a.pendingProps,c),a.child;case 8:return rs(i,a,a.pendingProps.children,c),a.child;case 12:return rs(i,a,a.pendingProps.children,c),a.child;case 10:return h=a.pendingProps,_a(a,a.type,h.value),rs(i,a,h.children,c),a.child;case 9:return _=a.type._context,h=a.pendingProps.children,So(a),_=ts(_),h=h(_),a.flags|=1,rs(i,a,h,c),a.child;case 14:return K1(i,a,a.type,a.pendingProps,c);case 15:return X1(i,a,a.type,a.pendingProps,c);case 19:return nw(i,a,c);case 31:return O3(i,a,c);case 22:return Z1(i,a,c,a.pendingProps);case 24:return So(a),h=ts(_r),i===null?(_=Vp(),_===null&&(_=It,y=Wp(),_.pooledCache=y,y.refCount++,y!==null&&(_.pooledCacheLanes|=c),_=y),a.memoizedState={parent:h,cache:_},Yp(a),_a(a,_r,_)):((i.lanes&c)!==0&&(Kp(i,a),qc(a,null,null,c),Wc()),_=i.memoizedState,y=a.memoizedState,_.parent!==h?(_={parent:h,cache:h},a.memoizedState=_,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=_),_a(a,_r,h)):(h=y.cache,_a(a,_r,h),h!==_.cache&&Fp(a,[_r],c,!0))),rs(i,a,a.pendingProps.children,c),a.child;case 29:throw a.pendingProps}throw Error(s(156,a.tag))}function In(i){i.flags|=4}function Ag(i,a,c,h,_){if((a=(i.mode&32)!==0)&&(a=!1),a){if(i.flags|=16777216,(_&335544128)===_)if(i.stateNode.complete)i.flags|=8192;else if(Dw())i.flags|=8192;else throw Eo=Zd,Gp}else i.flags&=-16777217}function ow(i,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!wS(a))if(Dw())i.flags|=8192;else throw Eo=Zd,Gp}function mh(i,a){a!==null&&(i.flags|=4),i.flags&16384&&(a=i.tag!==22?sr():536870912,i.lanes|=a,Pl|=a)}function Zc(i,a){if(!gt)switch(i.tailMode){case"hidden":a=i.tail;for(var c=null;a!==null;)a.alternate!==null&&(c=a),a=a.sibling;c===null?i.tail=null:c.sibling=null;break;case"collapsed":c=i.tail;for(var h=null;c!==null;)c.alternate!==null&&(h=c),c=c.sibling;h===null?a||i.tail===null?i.tail=null:i.tail.sibling=null:h.sibling=null}}function Ht(i){var a=i.alternate!==null&&i.alternate.child===i.child,c=0,h=0;if(a)for(var _=i.child;_!==null;)c|=_.lanes|_.childLanes,h|=_.subtreeFlags&65011712,h|=_.flags&65011712,_.return=i,_=_.sibling;else for(_=i.child;_!==null;)c|=_.lanes|_.childLanes,h|=_.subtreeFlags,h|=_.flags,_.return=i,_=_.sibling;return i.subtreeFlags|=h,i.childLanes=c,a}function P3(i,a,c){var h=a.pendingProps;switch(Ip(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ht(a),null;case 1:return Ht(a),null;case 3:return c=a.stateNode,h=null,i!==null&&(h=i.memoizedState.cache),a.memoizedState.cache!==h&&(a.flags|=2048),Ln(_r),le(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(i===null||i.child===null)&&(Cl(a)?In(a):i===null||i.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,$p())),Ht(a),null;case 26:var _=a.type,y=a.memoizedState;return i===null?(In(a),y!==null?(Ht(a),ow(a,y)):(Ht(a),Ag(a,_,null,h,c))):y?y!==i.memoizedState?(In(a),Ht(a),ow(a,y)):(Ht(a),a.flags&=-16777217):(i=i.memoizedProps,i!==h&&In(a),Ht(a),Ag(a,_,i,h,c)),null;case 27:if(ke(a),c=de.current,_=a.type,i!==null&&a.stateNode!=null)i.memoizedProps!==h&&In(a);else{if(!h){if(a.stateNode===null)throw Error(s(166));return Ht(a),null}i=ee.current,Cl(a)?$b(a):(i=mS(_,h,c),a.stateNode=i,In(a))}return Ht(a),null;case 5:if(ke(a),_=a.type,i!==null&&a.stateNode!=null)i.memoizedProps!==h&&In(a);else{if(!h){if(a.stateNode===null)throw Error(s(166));return Ht(a),null}if(y=ee.current,Cl(a))$b(a);else{var j=jh(de.current);switch(y){case 1:y=j.createElementNS("http://www.w3.org/2000/svg",_);break;case 2:y=j.createElementNS("http://www.w3.org/1998/Math/MathML",_);break;default:switch(_){case"svg":y=j.createElementNS("http://www.w3.org/2000/svg",_);break;case"math":y=j.createElementNS("http://www.w3.org/1998/Math/MathML",_);break;case"script":y=j.createElement("div"),y.innerHTML="<script><\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof h.is=="string"?j.createElement("select",{is:h.is}):j.createElement("select"),h.multiple?y.multiple=!0:h.size&&(y.size=h.size);break;default:y=typeof h.is=="string"?j.createElement(_,{is:h.is}):j.createElement(_)}}y[Pt]=a,y[he]=h;e:for(j=a.child;j!==null;){if(j.tag===5||j.tag===6)y.appendChild(j.stateNode);else if(j.tag!==4&&j.tag!==27&&j.child!==null){j.child.return=j,j=j.child;continue}if(j===a)break e;for(;j.sibling===null;){if(j.return===null||j.return===a)break e;j=j.return}j.sibling.return=j.return,j=j.sibling}a.stateNode=y;e:switch(ss(y,_,h),_){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}h&&In(a)}}return Ht(a),Ag(a,a.type,i===null?null:i.memoizedProps,a.pendingProps,c),null;case 6:if(i&&a.stateNode!=null)i.memoizedProps!==h&&In(a);else{if(typeof h!="string"&&a.stateNode===null)throw Error(s(166));if(i=de.current,Cl(a)){if(i=a.stateNode,c=a.memoizedProps,h=null,_=es,_!==null)switch(_.tag){case 27:case 5:h=_.memoizedProps}i[Pt]=a,i=!!(i.nodeValue===c||h!==null&&h.suppressHydrationWarning===!0||sS(i.nodeValue,c)),i||va(a,!0)}else i=jh(i).createTextNode(h),i[Pt]=a,a.stateNode=i}return Ht(a),null;case 31:if(c=a.memoizedState,i===null||i.memoizedState!==null){if(h=Cl(a),c!==null){if(i===null){if(!h)throw Error(s(318));if(i=a.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(s(557));i[Pt]=a}else bo(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Ht(a),i=!1}else c=$p(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=c),i=!0;if(!i)return a.flags&256?(Is(a),a):(Is(a),null);if((a.flags&128)!==0)throw Error(s(558))}return Ht(a),null;case 13:if(h=a.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(_=Cl(a),h!==null&&h.dehydrated!==null){if(i===null){if(!_)throw Error(s(318));if(_=a.memoizedState,_=_!==null?_.dehydrated:null,!_)throw Error(s(317));_[Pt]=a}else bo(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Ht(a),_=!1}else _=$p(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=_),_=!0;if(!_)return a.flags&256?(Is(a),a):(Is(a),null)}return Is(a),(a.flags&128)!==0?(a.lanes=c,a):(c=h!==null,i=i!==null&&i.memoizedState!==null,c&&(h=a.child,_=null,h.alternate!==null&&h.alternate.memoizedState!==null&&h.alternate.memoizedState.cachePool!==null&&(_=h.alternate.memoizedState.cachePool.pool),y=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(y=h.memoizedState.cachePool.pool),y!==_&&(h.flags|=2048)),c!==i&&c&&(a.child.flags|=8192),mh(a,a.updateQueue),Ht(a),null);case 4:return le(),i===null&&Qg(a.stateNode.containerInfo),Ht(a),null;case 10:return Ln(a.type),Ht(a),null;case 19:if(G(pr),h=a.memoizedState,h===null)return Ht(a),null;if(_=(a.flags&128)!==0,y=h.rendering,y===null)if(_)Zc(h,!1);else{if(nr!==0||i!==null&&(i.flags&128)!==0)for(i=a.child;i!==null;){if(y=th(i),y!==null){for(a.flags|=128,Zc(h,!1),i=y.updateQueue,a.updateQueue=i,mh(a,i),a.subtreeFlags=0,i=c,c=a.child;c!==null;)Ob(c,i),c=c.sibling;return X(pr,pr.current&1|2),gt&&Tn(a,h.treeForkCount),a.child}i=i.sibling}h.tail!==null&&ct()>xh&&(a.flags|=128,_=!0,Zc(h,!1),a.lanes=4194304)}else{if(!_)if(i=th(y),i!==null){if(a.flags|=128,_=!0,i=i.updateQueue,a.updateQueue=i,mh(a,i),Zc(h,!0),h.tail===null&&h.tailMode==="hidden"&&!y.alternate&&!gt)return Ht(a),null}else 2*ct()-h.renderingStartTime>xh&&c!==536870912&&(a.flags|=128,_=!0,Zc(h,!1),a.lanes=4194304);h.isBackwards?(y.sibling=a.child,a.child=y):(i=h.last,i!==null?i.sibling=y:a.child=y,h.last=y)}return h.tail!==null?(i=h.tail,h.rendering=i,h.tail=i.sibling,h.renderingStartTime=ct(),i.sibling=null,c=pr.current,X(pr,_?c&1|2:c&1),gt&&Tn(a,h.treeForkCount),i):(Ht(a),null);case 22:case 23:return Is(a),Jp(),h=a.memoizedState!==null,i!==null?i.memoizedState!==null!==h&&(a.flags|=8192):h&&(a.flags|=8192),h?(c&536870912)!==0&&(a.flags&128)===0&&(Ht(a),a.subtreeFlags&6&&(a.flags|=8192)):Ht(a),c=a.updateQueue,c!==null&&mh(a,c.retryQueue),c=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(c=i.memoizedState.cachePool.pool),h=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(h=a.memoizedState.cachePool.pool),h!==c&&(a.flags|=2048),i!==null&&G(Co),null;case 24:return c=null,i!==null&&(c=i.memoizedState.cache),a.memoizedState.cache!==c&&(a.flags|=2048),Ln(_r),Ht(a),null;case 25:return null;case 30:return null}throw Error(s(156,a.tag))}function I3(i,a){switch(Ip(a),a.tag){case 1:return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 3:return Ln(_r),le(),i=a.flags,(i&65536)!==0&&(i&128)===0?(a.flags=i&-65537|128,a):null;case 26:case 27:case 5:return ke(a),null;case 31:if(a.memoizedState!==null){if(Is(a),a.alternate===null)throw Error(s(340));bo()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 13:if(Is(a),i=a.memoizedState,i!==null&&i.dehydrated!==null){if(a.alternate===null)throw Error(s(340));bo()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 19:return G(pr),null;case 4:return le(),null;case 10:return Ln(a.type),null;case 22:case 23:return Is(a),Jp(),i!==null&&G(Co),i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 24:return Ln(_r),null;case 25:return null;default:return null}}function lw(i,a){switch(Ip(a),a.tag){case 3:Ln(_r),le();break;case 26:case 27:case 5:ke(a);break;case 4:le();break;case 31:a.memoizedState!==null&&Is(a);break;case 13:Is(a);break;case 19:G(pr);break;case 10:Ln(a.type);break;case 22:case 23:Is(a),Jp(),i!==null&&G(Co);break;case 24:Ln(_r)}}function Qc(i,a){try{var c=a.updateQueue,h=c!==null?c.lastEffect:null;if(h!==null){var _=h.next;c=_;do{if((c.tag&i)===i){h=void 0;var y=c.create,j=c.inst;h=y(),j.destroy=h}c=c.next}while(c!==_)}}catch(z){jt(a,a.return,z)}}function Ca(i,a,c){try{var h=a.updateQueue,_=h!==null?h.lastEffect:null;if(_!==null){var y=_.next;h=y;do{if((h.tag&i)===i){var j=h.inst,z=j.destroy;if(z!==void 0){j.destroy=void 0,_=a;var K=c,ie=z;try{ie()}catch(fe){jt(_,K,fe)}}}h=h.next}while(h!==y)}}catch(fe){jt(a,a.return,fe)}}function cw(i){var a=i.updateQueue;if(a!==null){var c=i.stateNode;try{Jb(a,c)}catch(h){jt(i,i.return,h)}}}function uw(i,a,c){c.props=jo(i.type,i.memoizedProps),c.state=i.memoizedState;try{c.componentWillUnmount()}catch(h){jt(i,a,h)}}function Jc(i,a){try{var c=i.ref;if(c!==null){switch(i.tag){case 26:case 27:case 5:var h=i.stateNode;break;case 30:h=i.stateNode;break;default:h=i.stateNode}typeof c=="function"?i.refCleanup=c(h):c.current=h}}catch(_){jt(i,a,_)}}function Ji(i,a){var c=i.ref,h=i.refCleanup;if(c!==null)if(typeof h=="function")try{h()}catch(_){jt(i,a,_)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(_){jt(i,a,_)}else c.current=null}function dw(i){var a=i.type,c=i.memoizedProps,h=i.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":c.autoFocus&&h.focus();break e;case"img":c.src?h.src=c.src:c.srcSet&&(h.srcset=c.srcSet)}}catch(_){jt(i,i.return,_)}}function Mg(i,a,c){try{var h=i.stateNode;aD(h,i.type,c,a),h[he]=a}catch(_){jt(i,i.return,_)}}function hw(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&Ma(i.type)||i.tag===4}function Tg(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||hw(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&Ma(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function Dg(i,a,c){var h=i.tag;if(h===5||h===6)i=i.stateNode,a?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(i,a):(a=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,a.appendChild(i),c=c._reactRootContainer,c!=null||a.onclick!==null||(a.onclick=jn));else if(h!==4&&(h===27&&Ma(i.type)&&(c=i.stateNode,a=null),i=i.child,i!==null))for(Dg(i,a,c),i=i.sibling;i!==null;)Dg(i,a,c),i=i.sibling}function ph(i,a,c){var h=i.tag;if(h===5||h===6)i=i.stateNode,a?c.insertBefore(i,a):c.appendChild(i);else if(h!==4&&(h===27&&Ma(i.type)&&(c=i.stateNode),i=i.child,i!==null))for(ph(i,a,c),i=i.sibling;i!==null;)ph(i,a,c),i=i.sibling}function fw(i){var a=i.stateNode,c=i.memoizedProps;try{for(var h=i.type,_=a.attributes;_.length;)a.removeAttributeNode(_[0]);ss(a,h,c),a[Pt]=i,a[he]=c}catch(y){jt(i,i.return,y)}}var zn=!1,br=!1,Lg=!1,mw=typeof WeakSet=="function"?WeakSet:Set,$r=null;function z3(i,a){if(i=i.containerInfo,tv=Bh,i=Eb(i),Rp(i)){if("selectionStart"in i)var c={start:i.selectionStart,end:i.selectionEnd};else e:{c=(c=i.ownerDocument)&&c.defaultView||window;var h=c.getSelection&&c.getSelection();if(h&&h.rangeCount!==0){c=h.anchorNode;var _=h.anchorOffset,y=h.focusNode;h=h.focusOffset;try{c.nodeType,y.nodeType}catch{c=null;break e}var j=0,z=-1,K=-1,ie=0,fe=0,ge=i,ae=null;t:for(;;){for(var ue;ge!==c||_!==0&&ge.nodeType!==3||(z=j+_),ge!==y||h!==0&&ge.nodeType!==3||(K=j+h),ge.nodeType===3&&(j+=ge.nodeValue.length),(ue=ge.firstChild)!==null;)ae=ge,ge=ue;for(;;){if(ge===i)break t;if(ae===c&&++ie===_&&(z=j),ae===y&&++fe===h&&(K=j),(ue=ge.nextSibling)!==null)break;ge=ae,ae=ge.parentNode}ge=ue}c=z===-1||K===-1?null:{start:z,end:K}}else c=null}c=c||{start:0,end:0}}else c=null;for(rv={focusedElem:i,selectionRange:c},Bh=!1,$r=a;$r!==null;)if(a=$r,i=a.child,(a.subtreeFlags&1028)!==0&&i!==null)i.return=a,$r=i;else for(;$r!==null;){switch(a=$r,y=a.alternate,i=a.flags,a.tag){case 0:if((i&4)!==0&&(i=a.updateQueue,i=i!==null?i.events:null,i!==null))for(c=0;c<i.length;c++)_=i[c],_.ref.impl=_.nextImpl;break;case 11:case 15:break;case 1:if((i&1024)!==0&&y!==null){i=void 0,c=a,_=y.memoizedProps,y=y.memoizedState,h=c.stateNode;try{var Te=jo(c.type,_);i=h.getSnapshotBeforeUpdate(Te,y),h.__reactInternalSnapshotBeforeUpdate=i}catch(Ye){jt(c,c.return,Ye)}}break;case 3:if((i&1024)!==0){if(i=a.stateNode.containerInfo,c=i.nodeType,c===9)nv(i);else if(c===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":nv(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(s(163))}if(i=a.sibling,i!==null){i.return=a.return,$r=i;break}$r=a.return}}function pw(i,a,c){var h=c.flags;switch(c.tag){case 0:case 11:case 15:Un(i,c),h&4&&Qc(5,c);break;case 1:if(Un(i,c),h&4)if(i=c.stateNode,a===null)try{i.componentDidMount()}catch(j){jt(c,c.return,j)}else{var _=jo(c.type,a.memoizedProps);a=a.memoizedState;try{i.componentDidUpdate(_,a,i.__reactInternalSnapshotBeforeUpdate)}catch(j){jt(c,c.return,j)}}h&64&&cw(c),h&512&&Jc(c,c.return);break;case 3:if(Un(i,c),h&64&&(i=c.updateQueue,i!==null)){if(a=null,c.child!==null)switch(c.child.tag){case 27:case 5:a=c.child.stateNode;break;case 1:a=c.child.stateNode}try{Jb(i,a)}catch(j){jt(c,c.return,j)}}break;case 27:a===null&&h&4&&fw(c);case 26:case 5:Un(i,c),a===null&&h&4&&dw(c),h&512&&Jc(c,c.return);break;case 12:Un(i,c);break;case 31:Un(i,c),h&4&&_w(i,c);break;case 13:Un(i,c),h&4&&xw(i,c),h&64&&(i=c.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(c=Y3.bind(null,c),mD(i,c))));break;case 22:if(h=c.memoizedState!==null||zn,!h){a=a!==null&&a.memoizedState!==null||br,_=zn;var y=br;zn=h,(br=a)&&!y?Hn(i,c,(c.subtreeFlags&8772)!==0):Un(i,c),zn=_,br=y}break;case 30:break;default:Un(i,c)}}function gw(i){var a=i.alternate;a!==null&&(i.alternate=null,gw(a)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(a=i.stateNode,a!==null&&Mi(a)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var Yt=null,Cs=!1;function $n(i,a,c){for(c=c.child;c!==null;)vw(i,a,c),c=c.sibling}function vw(i,a,c){if(zt&&typeof zt.onCommitFiberUnmount=="function")try{zt.onCommitFiberUnmount(us,c)}catch{}switch(c.tag){case 26:br||Ji(c,a),$n(i,a,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:br||Ji(c,a);var h=Yt,_=Cs;Ma(c.type)&&(Yt=c.stateNode,Cs=!1),$n(i,a,c),lu(c.stateNode),Yt=h,Cs=_;break;case 5:br||Ji(c,a);case 6:if(h=Yt,_=Cs,Yt=null,$n(i,a,c),Yt=h,Cs=_,Yt!==null)if(Cs)try{(Yt.nodeType===9?Yt.body:Yt.nodeName==="HTML"?Yt.ownerDocument.body:Yt).removeChild(c.stateNode)}catch(y){jt(c,a,y)}else try{Yt.removeChild(c.stateNode)}catch(y){jt(c,a,y)}break;case 18:Yt!==null&&(Cs?(i=Yt,cS(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,c.stateNode),ql(i)):cS(Yt,c.stateNode));break;case 4:h=Yt,_=Cs,Yt=c.stateNode.containerInfo,Cs=!0,$n(i,a,c),Yt=h,Cs=_;break;case 0:case 11:case 14:case 15:Ca(2,c,a),br||Ca(4,c,a),$n(i,a,c);break;case 1:br||(Ji(c,a),h=c.stateNode,typeof h.componentWillUnmount=="function"&&uw(c,a,h)),$n(i,a,c);break;case 21:$n(i,a,c);break;case 22:br=(h=br)||c.memoizedState!==null,$n(i,a,c),br=h;break;default:$n(i,a,c)}}function _w(i,a){if(a.memoizedState===null&&(i=a.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{ql(i)}catch(c){jt(a,a.return,c)}}}function xw(i,a){if(a.memoizedState===null&&(i=a.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{ql(i)}catch(c){jt(a,a.return,c)}}function $3(i){switch(i.tag){case 31:case 13:case 19:var a=i.stateNode;return a===null&&(a=i.stateNode=new mw),a;case 22:return i=i.stateNode,a=i._retryCache,a===null&&(a=i._retryCache=new mw),a;default:throw Error(s(435,i.tag))}}function gh(i,a){var c=$3(i);a.forEach(function(h){if(!c.has(h)){c.add(h);var _=K3.bind(null,i,h);h.then(_,_)}})}function ks(i,a){var c=a.deletions;if(c!==null)for(var h=0;h<c.length;h++){var _=c[h],y=i,j=a,z=j;e:for(;z!==null;){switch(z.tag){case 27:if(Ma(z.type)){Yt=z.stateNode,Cs=!1;break e}break;case 5:Yt=z.stateNode,Cs=!1;break e;case 3:case 4:Yt=z.stateNode.containerInfo,Cs=!0;break e}z=z.return}if(Yt===null)throw Error(s(160));vw(y,j,_),Yt=null,Cs=!1,y=_.alternate,y!==null&&(y.return=null),_.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)yw(a,i),a=a.sibling}var Di=null;function yw(i,a){var c=i.alternate,h=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:ks(a,i),Es(i),h&4&&(Ca(3,i,i.return),Qc(3,i),Ca(5,i,i.return));break;case 1:ks(a,i),Es(i),h&512&&(br||c===null||Ji(c,c.return)),h&64&&zn&&(i=i.updateQueue,i!==null&&(h=i.callbacks,h!==null&&(c=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=c===null?h:c.concat(h))));break;case 26:var _=Di;if(ks(a,i),Es(i),h&512&&(br||c===null||Ji(c,c.return)),h&4){var y=c!==null?c.memoizedState:null;if(h=i.memoizedState,c===null)if(h===null)if(i.stateNode===null){e:{h=i.type,c=i.memoizedProps,_=_.ownerDocument||_;t:switch(h){case"title":y=_.getElementsByTagName("title")[0],(!y||y[ti]||y[Pt]||y.namespaceURI==="http://www.w3.org/2000/svg"||y.hasAttribute("itemprop"))&&(y=_.createElement(h),_.head.insertBefore(y,_.querySelector("head > title"))),ss(y,h,c),y[Pt]=i,zr(y),h=y;break e;case"link":var j=yS("link","href",_).get(h+(c.href||""));if(j){for(var z=0;z<j.length;z++)if(y=j[z],y.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&y.getAttribute("rel")===(c.rel==null?null:c.rel)&&y.getAttribute("title")===(c.title==null?null:c.title)&&y.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){j.splice(z,1);break t}}y=_.createElement(h),ss(y,h,c),_.head.appendChild(y);break;case"meta":if(j=yS("meta","content",_).get(h+(c.content||""))){for(z=0;z<j.length;z++)if(y=j[z],y.getAttribute("content")===(c.content==null?null:""+c.content)&&y.getAttribute("name")===(c.name==null?null:c.name)&&y.getAttribute("property")===(c.property==null?null:c.property)&&y.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&y.getAttribute("charset")===(c.charSet==null?null:c.charSet)){j.splice(z,1);break t}}y=_.createElement(h),ss(y,h,c),_.head.appendChild(y);break;default:throw Error(s(468,h))}y[Pt]=i,zr(y),h=y}i.stateNode=h}else bS(_,i.type,i.stateNode);else i.stateNode=xS(_,h,i.memoizedProps);else y!==h?(y===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):y.count--,h===null?bS(_,i.type,i.stateNode):xS(_,h,i.memoizedProps)):h===null&&i.stateNode!==null&&Mg(i,i.memoizedProps,c.memoizedProps)}break;case 27:ks(a,i),Es(i),h&512&&(br||c===null||Ji(c,c.return)),c!==null&&h&4&&Mg(i,i.memoizedProps,c.memoizedProps);break;case 5:if(ks(a,i),Es(i),h&512&&(br||c===null||Ji(c,c.return)),i.flags&32){_=i.stateNode;try{ml(_,"")}catch(Te){jt(i,i.return,Te)}}h&4&&i.stateNode!=null&&(_=i.memoizedProps,Mg(i,_,c!==null?c.memoizedProps:_)),h&1024&&(Lg=!0);break;case 6:if(ks(a,i),Es(i),h&4){if(i.stateNode===null)throw Error(s(162));h=i.memoizedProps,c=i.stateNode;try{c.nodeValue=h}catch(Te){jt(i,i.return,Te)}}break;case 3:if(Th=null,_=Di,Di=Ah(a.containerInfo),ks(a,i),Di=_,Es(i),h&4&&c!==null&&c.memoizedState.isDehydrated)try{ql(a.containerInfo)}catch(Te){jt(i,i.return,Te)}Lg&&(Lg=!1,bw(i));break;case 4:h=Di,Di=Ah(i.stateNode.containerInfo),ks(a,i),Es(i),Di=h;break;case 12:ks(a,i),Es(i);break;case 31:ks(a,i),Es(i),h&4&&(h=i.updateQueue,h!==null&&(i.updateQueue=null,gh(i,h)));break;case 13:ks(a,i),Es(i),i.child.flags&8192&&i.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(_h=ct()),h&4&&(h=i.updateQueue,h!==null&&(i.updateQueue=null,gh(i,h)));break;case 22:_=i.memoizedState!==null;var K=c!==null&&c.memoizedState!==null,ie=zn,fe=br;if(zn=ie||_,br=fe||K,ks(a,i),br=fe,zn=ie,Es(i),h&8192)e:for(a=i.stateNode,a._visibility=_?a._visibility&-2:a._visibility|1,_&&(c===null||K||zn||br||Ao(i)),c=null,a=i;;){if(a.tag===5||a.tag===26){if(c===null){K=c=a;try{if(y=K.stateNode,_)j=y.style,typeof j.setProperty=="function"?j.setProperty("display","none","important"):j.display="none";else{z=K.stateNode;var ge=K.memoizedProps.style,ae=ge!=null&&ge.hasOwnProperty("display")?ge.display:null;z.style.display=ae==null||typeof ae=="boolean"?"":(""+ae).trim()}}catch(Te){jt(K,K.return,Te)}}}else if(a.tag===6){if(c===null){K=a;try{K.stateNode.nodeValue=_?"":K.memoizedProps}catch(Te){jt(K,K.return,Te)}}}else if(a.tag===18){if(c===null){K=a;try{var ue=K.stateNode;_?uS(ue,!0):uS(K.stateNode,!1)}catch(Te){jt(K,K.return,Te)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===i)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===i)break e;for(;a.sibling===null;){if(a.return===null||a.return===i)break e;c===a&&(c=null),a=a.return}c===a&&(c=null),a.sibling.return=a.return,a=a.sibling}h&4&&(h=i.updateQueue,h!==null&&(c=h.retryQueue,c!==null&&(h.retryQueue=null,gh(i,c))));break;case 19:ks(a,i),Es(i),h&4&&(h=i.updateQueue,h!==null&&(i.updateQueue=null,gh(i,h)));break;case 30:break;case 21:break;default:ks(a,i),Es(i)}}function Es(i){var a=i.flags;if(a&2){try{for(var c,h=i.return;h!==null;){if(hw(h)){c=h;break}h=h.return}if(c==null)throw Error(s(160));switch(c.tag){case 27:var _=c.stateNode,y=Tg(i);ph(i,y,_);break;case 5:var j=c.stateNode;c.flags&32&&(ml(j,""),c.flags&=-33);var z=Tg(i);ph(i,z,j);break;case 3:case 4:var K=c.stateNode.containerInfo,ie=Tg(i);Dg(i,ie,K);break;default:throw Error(s(161))}}catch(fe){jt(i,i.return,fe)}i.flags&=-3}a&4096&&(i.flags&=-4097)}function bw(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var a=i;bw(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),i=i.sibling}}function Un(i,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)pw(i,a.alternate,a),a=a.sibling}function Ao(i){for(i=i.child;i!==null;){var a=i;switch(a.tag){case 0:case 11:case 14:case 15:Ca(4,a,a.return),Ao(a);break;case 1:Ji(a,a.return);var c=a.stateNode;typeof c.componentWillUnmount=="function"&&uw(a,a.return,c),Ao(a);break;case 27:lu(a.stateNode);case 26:case 5:Ji(a,a.return),Ao(a);break;case 22:a.memoizedState===null&&Ao(a);break;case 30:Ao(a);break;default:Ao(a)}i=i.sibling}}function Hn(i,a,c){for(c=c&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var h=a.alternate,_=i,y=a,j=y.flags;switch(y.tag){case 0:case 11:case 15:Hn(_,y,c),Qc(4,y);break;case 1:if(Hn(_,y,c),h=y,_=h.stateNode,typeof _.componentDidMount=="function")try{_.componentDidMount()}catch(ie){jt(h,h.return,ie)}if(h=y,_=h.updateQueue,_!==null){var z=h.stateNode;try{var K=_.shared.hiddenCallbacks;if(K!==null)for(_.shared.hiddenCallbacks=null,_=0;_<K.length;_++)Qb(K[_],z)}catch(ie){jt(h,h.return,ie)}}c&&j&64&&cw(y),Jc(y,y.return);break;case 27:fw(y);case 26:case 5:Hn(_,y,c),c&&h===null&&j&4&&dw(y),Jc(y,y.return);break;case 12:Hn(_,y,c);break;case 31:Hn(_,y,c),c&&j&4&&_w(_,y);break;case 13:Hn(_,y,c),c&&j&4&&xw(_,y);break;case 22:y.memoizedState===null&&Hn(_,y,c),Jc(y,y.return);break;case 30:break;default:Hn(_,y,c)}a=a.sibling}}function Og(i,a){var c=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(c=i.memoizedState.cachePool.pool),i=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(i=a.memoizedState.cachePool.pool),i!==c&&(i!=null&&i.refCount++,c!=null&&zc(c))}function Bg(i,a){i=null,a.alternate!==null&&(i=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==i&&(a.refCount++,i!=null&&zc(i))}function Li(i,a,c,h){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)ww(i,a,c,h),a=a.sibling}function ww(i,a,c,h){var _=a.flags;switch(a.tag){case 0:case 11:case 15:Li(i,a,c,h),_&2048&&Qc(9,a);break;case 1:Li(i,a,c,h);break;case 3:Li(i,a,c,h),_&2048&&(i=null,a.alternate!==null&&(i=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==i&&(a.refCount++,i!=null&&zc(i)));break;case 12:if(_&2048){Li(i,a,c,h),i=a.stateNode;try{var y=a.memoizedProps,j=y.id,z=y.onPostCommit;typeof z=="function"&&z(j,a.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(K){jt(a,a.return,K)}}else Li(i,a,c,h);break;case 31:Li(i,a,c,h);break;case 13:Li(i,a,c,h);break;case 23:break;case 22:y=a.stateNode,j=a.alternate,a.memoizedState!==null?y._visibility&2?Li(i,a,c,h):eu(i,a):y._visibility&2?Li(i,a,c,h):(y._visibility|=2,Ll(i,a,c,h,(a.subtreeFlags&10256)!==0||!1)),_&2048&&Og(j,a);break;case 24:Li(i,a,c,h),_&2048&&Bg(a.alternate,a);break;default:Li(i,a,c,h)}}function Ll(i,a,c,h,_){for(_=_&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var y=i,j=a,z=c,K=h,ie=j.flags;switch(j.tag){case 0:case 11:case 15:Ll(y,j,z,K,_),Qc(8,j);break;case 23:break;case 22:var fe=j.stateNode;j.memoizedState!==null?fe._visibility&2?Ll(y,j,z,K,_):eu(y,j):(fe._visibility|=2,Ll(y,j,z,K,_)),_&&ie&2048&&Og(j.alternate,j);break;case 24:Ll(y,j,z,K,_),_&&ie&2048&&Bg(j.alternate,j);break;default:Ll(y,j,z,K,_)}a=a.sibling}}function eu(i,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var c=i,h=a,_=h.flags;switch(h.tag){case 22:eu(c,h),_&2048&&Og(h.alternate,h);break;case 24:eu(c,h),_&2048&&Bg(h.alternate,h);break;default:eu(c,h)}a=a.sibling}}var tu=8192;function Ol(i,a,c){if(i.subtreeFlags&tu)for(i=i.child;i!==null;)Sw(i,a,c),i=i.sibling}function Sw(i,a,c){switch(i.tag){case 26:Ol(i,a,c),i.flags&tu&&i.memoizedState!==null&&ED(c,Di,i.memoizedState,i.memoizedProps);break;case 5:Ol(i,a,c);break;case 3:case 4:var h=Di;Di=Ah(i.stateNode.containerInfo),Ol(i,a,c),Di=h;break;case 22:i.memoizedState===null&&(h=i.alternate,h!==null&&h.memoizedState!==null?(h=tu,tu=16777216,Ol(i,a,c),tu=h):Ol(i,a,c));break;default:Ol(i,a,c)}}function Cw(i){var a=i.alternate;if(a!==null&&(i=a.child,i!==null)){a.child=null;do a=i.sibling,i.sibling=null,i=a;while(i!==null)}}function ru(i){var a=i.deletions;if((i.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var h=a[c];$r=h,Ew(h,i)}Cw(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)kw(i),i=i.sibling}function kw(i){switch(i.tag){case 0:case 11:case 15:ru(i),i.flags&2048&&Ca(9,i,i.return);break;case 3:ru(i);break;case 12:ru(i);break;case 22:var a=i.stateNode;i.memoizedState!==null&&a._visibility&2&&(i.return===null||i.return.tag!==13)?(a._visibility&=-3,vh(i)):ru(i);break;default:ru(i)}}function vh(i){var a=i.deletions;if((i.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var h=a[c];$r=h,Ew(h,i)}Cw(i)}for(i=i.child;i!==null;){switch(a=i,a.tag){case 0:case 11:case 15:Ca(8,a,a.return),vh(a);break;case 22:c=a.stateNode,c._visibility&2&&(c._visibility&=-3,vh(a));break;default:vh(a)}i=i.sibling}}function Ew(i,a){for(;$r!==null;){var c=$r;switch(c.tag){case 0:case 11:case 15:Ca(8,c,a);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var h=c.memoizedState.cachePool.pool;h!=null&&h.refCount++}break;case 24:zc(c.memoizedState.cache)}if(h=c.child,h!==null)h.return=c,$r=h;else e:for(c=i;$r!==null;){h=$r;var _=h.sibling,y=h.return;if(gw(h),h===c){$r=null;break e}if(_!==null){_.return=y,$r=_;break e}$r=y}}}var U3={getCacheForType:function(i){var a=ts(_r),c=a.data.get(i);return c===void 0&&(c=i(),a.data.set(i,c)),c},cacheSignal:function(){return ts(_r).controller.signal}},H3=typeof WeakMap=="function"?WeakMap:Map,St=0,It=null,dt=null,mt=0,Nt=0,zs=null,ka=!1,Bl=!1,Pg=!1,Fn=0,nr=0,Ea=0,Mo=0,Ig=0,$s=0,Pl=0,su=null,Rs=null,zg=!1,_h=0,Rw=0,xh=1/0,yh=null,Ra=null,Mr=0,Na=null,Il=null,Wn=0,$g=0,Ug=null,Nw=null,iu=0,Hg=null;function Us(){return(St&2)!==0&&mt!==0?mt&-mt:M.T!==null?Yg():Rn()}function jw(){if($s===0)if((mt&536870912)===0||gt){var i=Jr;Jr<<=1,(Jr&3932160)===0&&(Jr=262144),$s=i}else $s=536870912;return i=Ps.current,i!==null&&(i.flags|=32),$s}function Ns(i,a,c){(i===It&&(Nt===2||Nt===9)||i.cancelPendingCommit!==null)&&(zl(i,0),ja(i,mt,$s,!1)),rt(i,c),((St&2)===0||i!==It)&&(i===It&&((St&2)===0&&(Mo|=c),nr===4&&ja(i,mt,$s,!1)),en(i))}function Aw(i,a,c){if((St&6)!==0)throw Error(s(327));var h=!c&&(a&127)===0&&(a&i.expiredLanes)===0||wt(i,a),_=h?q3(i,a):Wg(i,a,!0),y=h;do{if(_===0){Bl&&!h&&ja(i,a,0,!1);break}else{if(c=i.current.alternate,y&&!F3(c)){_=Wg(i,a,!1),y=!1;continue}if(_===2){if(y=a,i.errorRecoveryDisabledLanes&y)var j=0;else j=i.pendingLanes&-536870913,j=j!==0?j:j&536870912?536870912:0;if(j!==0){a=j;e:{var z=i;_=su;var K=z.current.memoizedState.isDehydrated;if(K&&(zl(z,j).flags|=256),j=Wg(z,j,!1),j!==2){if(Pg&&!K){z.errorRecoveryDisabledLanes|=y,Mo|=y,_=4;break e}y=Rs,Rs=_,y!==null&&(Rs===null?Rs=y:Rs.push.apply(Rs,y))}_=j}if(y=!1,_!==2)continue}}if(_===1){zl(i,0),ja(i,a,0,!0);break}e:{switch(h=i,y=_,y){case 0:case 1:throw Error(s(345));case 4:if((a&4194048)!==a)break;case 6:ja(h,a,$s,!ka);break e;case 2:Rs=null;break;case 3:case 5:break;default:throw Error(s(329))}if((a&62914560)===a&&(_=_h+300-ct(),10<_)){if(ja(h,a,$s,!ka),Fe(h,0,!0)!==0)break e;Wn=a,h.timeoutHandle=oS(Mw.bind(null,h,c,Rs,yh,zg,a,$s,Mo,Pl,ka,y,"Throttled",-0,0),_);break e}Mw(h,c,Rs,yh,zg,a,$s,Mo,Pl,ka,y,null,-0,0)}}break}while(!0);en(i)}function Mw(i,a,c,h,_,y,j,z,K,ie,fe,ge,ae,ue){if(i.timeoutHandle=-1,ge=a.subtreeFlags,ge&8192||(ge&16785408)===16785408){ge={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:jn},Sw(a,y,ge);var Te=(y&62914560)===y?_h-ct():(y&4194048)===y?Rw-ct():0;if(Te=RD(ge,Te),Te!==null){Wn=y,i.cancelPendingCommit=Te(zw.bind(null,i,a,y,c,h,_,j,z,K,fe,ge,null,ae,ue)),ja(i,y,j,!ie);return}}zw(i,a,y,c,h,_,j,z,K)}function F3(i){for(var a=i;;){var c=a.tag;if((c===0||c===11||c===15)&&a.flags&16384&&(c=a.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var h=0;h<c.length;h++){var _=c[h],y=_.getSnapshot;_=_.value;try{if(!Os(y(),_))return!1}catch{return!1}}if(c=a.child,a.subtreeFlags&16384&&c!==null)c.return=a,a=c;else{if(a===i)break;for(;a.sibling===null;){if(a.return===null||a.return===i)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function ja(i,a,c,h){a&=~Ig,a&=~Mo,i.suspendedLanes|=a,i.pingedLanes&=~a,h&&(i.warmLanes|=a),h=i.expirationTimes;for(var _=a;0<_;){var y=31-Vt(_),j=1<<y;h[y]=-1,_&=~j}c!==0&&Bt(i,c,a)}function bh(){return(St&6)===0?(nu(0),!1):!0}function Fg(){if(dt!==null){if(Nt===0)var i=dt.return;else i=dt,Dn=wo=null,ng(i),jl=null,Uc=0,i=dt;for(;i!==null;)lw(i.alternate,i),i=i.return;dt=null}}function zl(i,a){var c=i.timeoutHandle;c!==-1&&(i.timeoutHandle=-1,cD(c)),c=i.cancelPendingCommit,c!==null&&(i.cancelPendingCommit=null,c()),Wn=0,Fg(),It=i,dt=c=Mn(i.current,null),mt=a,Nt=0,zs=null,ka=!1,Bl=wt(i,a),Pg=!1,Pl=$s=Ig=Mo=Ea=nr=0,Rs=su=null,zg=!1,(a&8)!==0&&(a|=a&32);var h=i.entangledLanes;if(h!==0)for(i=i.entanglements,h&=a;0<h;){var _=31-Vt(h),y=1<<_;a|=i[_],h&=~y}return Fn=a,Hd(),c}function Tw(i,a){tt=null,M.H=Kc,a===Nl||a===Xd?(a=Yb(),Nt=3):a===Gp?(a=Yb(),Nt=4):Nt=a===bg?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,zs=a,dt===null&&(nr=1,uh(i,ni(a,i.current)))}function Dw(){var i=Ps.current;return i===null?!0:(mt&4194048)===mt?ci===null:(mt&62914560)===mt||(mt&536870912)!==0?i===ci:!1}function Lw(){var i=M.H;return M.H=Kc,i===null?Kc:i}function Ow(){var i=M.A;return M.A=U3,i}function wh(){nr=4,ka||(mt&4194048)!==mt&&Ps.current!==null||(Bl=!0),(Ea&134217727)===0&&(Mo&134217727)===0||It===null||ja(It,mt,$s,!1)}function Wg(i,a,c){var h=St;St|=2;var _=Lw(),y=Ow();(It!==i||mt!==a)&&(yh=null,zl(i,a)),a=!1;var j=nr;e:do try{if(Nt!==0&&dt!==null){var z=dt,K=zs;switch(Nt){case 8:Fg(),j=6;break e;case 3:case 2:case 9:case 6:Ps.current===null&&(a=!0);var ie=Nt;if(Nt=0,zs=null,$l(i,z,K,ie),c&&Bl){j=0;break e}break;default:ie=Nt,Nt=0,zs=null,$l(i,z,K,ie)}}W3(),j=nr;break}catch(fe){Tw(i,fe)}while(!0);return a&&i.shellSuspendCounter++,Dn=wo=null,St=h,M.H=_,M.A=y,dt===null&&(It=null,mt=0,Hd()),j}function W3(){for(;dt!==null;)Bw(dt)}function q3(i,a){var c=St;St|=2;var h=Lw(),_=Ow();It!==i||mt!==a?(yh=null,xh=ct()+500,zl(i,a)):Bl=wt(i,a);e:do try{if(Nt!==0&&dt!==null){a=dt;var y=zs;t:switch(Nt){case 1:Nt=0,zs=null,$l(i,a,y,1);break;case 2:case 9:if(Vb(y)){Nt=0,zs=null,Pw(a);break}a=function(){Nt!==2&&Nt!==9||It!==i||(Nt=7),en(i)},y.then(a,a);break e;case 3:Nt=7;break e;case 4:Nt=5;break e;case 7:Vb(y)?(Nt=0,zs=null,Pw(a)):(Nt=0,zs=null,$l(i,a,y,7));break;case 5:var j=null;switch(dt.tag){case 26:j=dt.memoizedState;case 5:case 27:var z=dt;if(j?wS(j):z.stateNode.complete){Nt=0,zs=null;var K=z.sibling;if(K!==null)dt=K;else{var ie=z.return;ie!==null?(dt=ie,Sh(ie)):dt=null}break t}}Nt=0,zs=null,$l(i,a,y,5);break;case 6:Nt=0,zs=null,$l(i,a,y,6);break;case 8:Fg(),nr=6;break e;default:throw Error(s(462))}}V3();break}catch(fe){Tw(i,fe)}while(!0);return Dn=wo=null,M.H=h,M.A=_,St=c,dt!==null?0:(It=null,mt=0,Hd(),nr)}function V3(){for(;dt!==null&&!Ie();)Bw(dt)}function Bw(i){var a=aw(i.alternate,i,Fn);i.memoizedProps=i.pendingProps,a===null?Sh(i):dt=a}function Pw(i){var a=i,c=a.alternate;switch(a.tag){case 15:case 0:a=ew(c,a,a.pendingProps,a.type,void 0,mt);break;case 11:a=ew(c,a,a.pendingProps,a.type.render,a.ref,mt);break;case 5:ng(a);default:lw(c,a),a=dt=Ob(a,Fn),a=aw(c,a,Fn)}i.memoizedProps=i.pendingProps,a===null?Sh(i):dt=a}function $l(i,a,c,h){Dn=wo=null,ng(a),jl=null,Uc=0;var _=a.return;try{if(L3(i,_,a,c,mt)){nr=1,uh(i,ni(c,i.current)),dt=null;return}}catch(y){if(_!==null)throw dt=_,y;nr=1,uh(i,ni(c,i.current)),dt=null;return}a.flags&32768?(gt||h===1?i=!0:Bl||(mt&536870912)!==0?i=!1:(ka=i=!0,(h===2||h===9||h===3||h===6)&&(h=Ps.current,h!==null&&h.tag===13&&(h.flags|=16384))),Iw(a,i)):Sh(a)}function Sh(i){var a=i;do{if((a.flags&32768)!==0){Iw(a,ka);return}i=a.return;var c=P3(a.alternate,a,Fn);if(c!==null){dt=c;return}if(a=a.sibling,a!==null){dt=a;return}dt=a=i}while(a!==null);nr===0&&(nr=5)}function Iw(i,a){do{var c=I3(i.alternate,i);if(c!==null){c.flags&=32767,dt=c;return}if(c=i.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!a&&(i=i.sibling,i!==null)){dt=i;return}dt=i=c}while(i!==null);nr=6,dt=null}function zw(i,a,c,h,_,y,j,z,K){i.cancelPendingCommit=null;do Ch();while(Mr!==0);if((St&6)!==0)throw Error(s(327));if(a!==null){if(a===i.current)throw Error(s(177));if(y=a.lanes|a.childLanes,y|=Tp,hr(i,c,y,j,z,K),i===It&&(dt=It=null,mt=0),Il=a,Na=i,Wn=c,$g=y,Ug=_,Nw=h,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,X3(cs,function(){return Ww(),null})):(i.callbackNode=null,i.callbackPriority=0),h=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||h){h=M.T,M.T=null,_=P.p,P.p=2,j=St,St|=4;try{z3(i,a,c)}finally{St=j,P.p=_,M.T=h}}Mr=1,$w(),Uw(),Hw()}}function $w(){if(Mr===1){Mr=0;var i=Na,a=Il,c=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||c){c=M.T,M.T=null;var h=P.p;P.p=2;var _=St;St|=4;try{yw(a,i);var y=rv,j=Eb(i.containerInfo),z=y.focusedElem,K=y.selectionRange;if(j!==z&&z&&z.ownerDocument&&kb(z.ownerDocument.documentElement,z)){if(K!==null&&Rp(z)){var ie=K.start,fe=K.end;if(fe===void 0&&(fe=ie),"selectionStart"in z)z.selectionStart=ie,z.selectionEnd=Math.min(fe,z.value.length);else{var ge=z.ownerDocument||document,ae=ge&&ge.defaultView||window;if(ae.getSelection){var ue=ae.getSelection(),Te=z.textContent.length,Ye=Math.min(K.start,Te),Dt=K.end===void 0?Ye:Math.min(K.end,Te);!ue.extend&&Ye>Dt&&(j=Dt,Dt=Ye,Ye=j);var J=Cb(z,Ye),Q=Cb(z,Dt);if(J&&Q&&(ue.rangeCount!==1||ue.anchorNode!==J.node||ue.anchorOffset!==J.offset||ue.focusNode!==Q.node||ue.focusOffset!==Q.offset)){var se=ge.createRange();se.setStart(J.node,J.offset),ue.removeAllRanges(),Ye>Dt?(ue.addRange(se),ue.extend(Q.node,Q.offset)):(se.setEnd(Q.node,Q.offset),ue.addRange(se))}}}}for(ge=[],ue=z;ue=ue.parentNode;)ue.nodeType===1&&ge.push({element:ue,left:ue.scrollLeft,top:ue.scrollTop});for(typeof z.focus=="function"&&z.focus(),z=0;z<ge.length;z++){var me=ge[z];me.element.scrollLeft=me.left,me.element.scrollTop=me.top}}Bh=!!tv,rv=tv=null}finally{St=_,P.p=h,M.T=c}}i.current=a,Mr=2}}function Uw(){if(Mr===2){Mr=0;var i=Na,a=Il,c=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||c){c=M.T,M.T=null;var h=P.p;P.p=2;var _=St;St|=4;try{pw(i,a.alternate,a)}finally{St=_,P.p=h,M.T=c}}Mr=3}}function Hw(){if(Mr===4||Mr===3){Mr=0,Ve();var i=Na,a=Il,c=Wn,h=Nw;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?Mr=5:(Mr=0,Il=Na=null,Fw(i,i.pendingLanes));var _=i.pendingLanes;if(_===0&&(Ra=null),fr(c),a=a.stateNode,zt&&typeof zt.onCommitFiberRoot=="function")try{zt.onCommitFiberRoot(us,a,void 0,(a.current.flags&128)===128)}catch{}if(h!==null){a=M.T,_=P.p,P.p=2,M.T=null;try{for(var y=i.onRecoverableError,j=0;j<h.length;j++){var z=h[j];y(z.value,{componentStack:z.stack})}}finally{M.T=a,P.p=_}}(Wn&3)!==0&&Ch(),en(i),_=i.pendingLanes,(c&261930)!==0&&(_&42)!==0?i===Hg?iu++:(iu=0,Hg=i):iu=0,nu(0)}}function Fw(i,a){(i.pooledCacheLanes&=a)===0&&(a=i.pooledCache,a!=null&&(i.pooledCache=null,zc(a)))}function Ch(){return $w(),Uw(),Hw(),Ww()}function Ww(){if(Mr!==5)return!1;var i=Na,a=$g;$g=0;var c=fr(Wn),h=M.T,_=P.p;try{P.p=32>c?32:c,M.T=null,c=Ug,Ug=null;var y=Na,j=Wn;if(Mr=0,Il=Na=null,Wn=0,(St&6)!==0)throw Error(s(331));var z=St;if(St|=4,kw(y.current),ww(y,y.current,j,c),St=z,nu(0,!1),zt&&typeof zt.onPostCommitFiberRoot=="function")try{zt.onPostCommitFiberRoot(us,y)}catch{}return!0}finally{P.p=_,M.T=h,Fw(i,a)}}function qw(i,a,c){a=ni(c,a),a=yg(i.stateNode,a,2),i=ba(i,a,2),i!==null&&(rt(i,2),en(i))}function jt(i,a,c){if(i.tag===3)qw(i,i,c);else for(;a!==null;){if(a.tag===3){qw(a,i,c);break}else if(a.tag===1){var h=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(Ra===null||!Ra.has(h))){i=ni(c,i),c=V1(2),h=ba(a,c,2),h!==null&&(G1(c,h,a,i),rt(h,2),en(h));break}}a=a.return}}function qg(i,a,c){var h=i.pingCache;if(h===null){h=i.pingCache=new H3;var _=new Set;h.set(a,_)}else _=h.get(a),_===void 0&&(_=new Set,h.set(a,_));_.has(c)||(Pg=!0,_.add(c),i=G3.bind(null,i,a,c),a.then(i,i))}function G3(i,a,c){var h=i.pingCache;h!==null&&h.delete(a),i.pingedLanes|=i.suspendedLanes&c,i.warmLanes&=~c,It===i&&(mt&c)===c&&(nr===4||nr===3&&(mt&62914560)===mt&&300>ct()-_h?(St&2)===0&&zl(i,0):Ig|=c,Pl===mt&&(Pl=0)),en(i)}function Vw(i,a){a===0&&(a=sr()),i=xo(i,a),i!==null&&(rt(i,a),en(i))}function Y3(i){var a=i.memoizedState,c=0;a!==null&&(c=a.retryLane),Vw(i,c)}function K3(i,a){var c=0;switch(i.tag){case 31:case 13:var h=i.stateNode,_=i.memoizedState;_!==null&&(c=_.retryLane);break;case 19:h=i.stateNode;break;case 22:h=i.stateNode._retryCache;break;default:throw Error(s(314))}h!==null&&h.delete(a),Vw(i,c)}function X3(i,a){return Ue(i,a)}var kh=null,Ul=null,Vg=!1,Eh=!1,Gg=!1,Aa=0;function en(i){i!==Ul&&i.next===null&&(Ul===null?kh=Ul=i:Ul=Ul.next=i),Eh=!0,Vg||(Vg=!0,Q3())}function nu(i,a){if(!Gg&&Eh){Gg=!0;do for(var c=!1,h=kh;h!==null;){if(i!==0){var _=h.pendingLanes;if(_===0)var y=0;else{var j=h.suspendedLanes,z=h.pingedLanes;y=(1<<31-Vt(42|i)+1)-1,y&=_&~(j&~z),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(c=!0,Xw(h,y))}else y=mt,y=Fe(h,h===It?y:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(y&3)===0||wt(h,y)||(c=!0,Xw(h,y));h=h.next}while(c);Gg=!1}}function Z3(){Gw()}function Gw(){Eh=Vg=!1;var i=0;Aa!==0&&lD()&&(i=Aa);for(var a=ct(),c=null,h=kh;h!==null;){var _=h.next,y=Yw(h,a);y===0?(h.next=null,c===null?kh=_:c.next=_,_===null&&(Ul=c)):(c=h,(i!==0||(y&3)!==0)&&(Eh=!0)),h=_}Mr!==0&&Mr!==5||nu(i),Aa!==0&&(Aa=0)}function Yw(i,a){for(var c=i.suspendedLanes,h=i.pingedLanes,_=i.expirationTimes,y=i.pendingLanes&-62914561;0<y;){var j=31-Vt(y),z=1<<j,K=_[j];K===-1?((z&c)===0||(z&h)!==0)&&(_[j]=Gt(z,a)):K<=a&&(i.expiredLanes|=z),y&=~z}if(a=It,c=mt,c=Fe(i,i===a?c:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),h=i.callbackNode,c===0||i===a&&(Nt===2||Nt===9)||i.cancelPendingCommit!==null)return h!==null&&h!==null&&qe(h),i.callbackNode=null,i.callbackPriority=0;if((c&3)===0||wt(i,c)){if(a=c&-c,a===i.callbackPriority)return a;switch(h!==null&&qe(h),fr(c)){case 2:case 8:c=Nr;break;case 32:c=cs;break;case 268435456:c=kt;break;default:c=cs}return h=Kw.bind(null,i),c=Ue(c,h),i.callbackPriority=a,i.callbackNode=c,a}return h!==null&&h!==null&&qe(h),i.callbackPriority=2,i.callbackNode=null,2}function Kw(i,a){if(Mr!==0&&Mr!==5)return i.callbackNode=null,i.callbackPriority=0,null;var c=i.callbackNode;if(Ch()&&i.callbackNode!==c)return null;var h=mt;return h=Fe(i,i===It?h:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),h===0?null:(Aw(i,h,a),Yw(i,ct()),i.callbackNode!=null&&i.callbackNode===c?Kw.bind(null,i):null)}function Xw(i,a){if(Ch())return null;Aw(i,a,!0)}function Q3(){uD(function(){(St&6)!==0?Ue(Ct,Z3):Gw()})}function Yg(){if(Aa===0){var i=El;i===0&&(i=jr,jr<<=1,(jr&261888)===0&&(jr=256)),Aa=i}return Aa}function Zw(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:Ld(""+i)}function Qw(i,a){var c=a.ownerDocument.createElement("input");return c.name=a.name,c.value=a.value,i.id&&c.setAttribute("form",i.id),a.parentNode.insertBefore(c,a),i=new FormData(i),c.parentNode.removeChild(c),i}function J3(i,a,c,h,_){if(a==="submit"&&c&&c.stateNode===_){var y=Zw((_[he]||null).action),j=h.submitter;j&&(a=(a=j[he]||null)?Zw(a.formAction):j.getAttribute("formAction"),a!==null&&(y=a,j=null));var z=new Id("action","action",null,h,_);i.push({event:z,listeners:[{instance:null,listener:function(){if(h.defaultPrevented){if(Aa!==0){var K=j?Qw(_,j):new FormData(_);mg(c,{pending:!0,data:K,method:_.method,action:y},null,K)}}else typeof y=="function"&&(z.preventDefault(),K=j?Qw(_,j):new FormData(_),mg(c,{pending:!0,data:K,method:_.method,action:y},y,K))},currentTarget:_}]})}}for(var Kg=0;Kg<Mp.length;Kg++){var Xg=Mp[Kg],eD=Xg.toLowerCase(),tD=Xg[0].toUpperCase()+Xg.slice(1);Ti(eD,"on"+tD)}Ti(jb,"onAnimationEnd"),Ti(Ab,"onAnimationIteration"),Ti(Mb,"onAnimationStart"),Ti("dblclick","onDoubleClick"),Ti("focusin","onFocus"),Ti("focusout","onBlur"),Ti(v3,"onTransitionRun"),Ti(_3,"onTransitionStart"),Ti(x3,"onTransitionCancel"),Ti(Tb,"onTransitionEnd"),hl("onMouseEnter",["mouseout","mouseover"]),hl("onMouseLeave",["mouseout","mouseover"]),hl("onPointerEnter",["pointerout","pointerover"]),hl("onPointerLeave",["pointerout","pointerover"]),po("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),po("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),po("onBeforeInput",["compositionend","keypress","textInput","paste"]),po("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),po("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),po("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var au="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(" "),rD=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(au));function Jw(i,a){a=(a&4)!==0;for(var c=0;c<i.length;c++){var h=i[c],_=h.event;h=h.listeners;e:{var y=void 0;if(a)for(var j=h.length-1;0<=j;j--){var z=h[j],K=z.instance,ie=z.currentTarget;if(z=z.listener,K!==y&&_.isPropagationStopped())break e;y=z,_.currentTarget=ie;try{y(_)}catch(fe){Ud(fe)}_.currentTarget=null,y=K}else for(j=0;j<h.length;j++){if(z=h[j],K=z.instance,ie=z.currentTarget,z=z.listener,K!==y&&_.isPropagationStopped())break e;y=z,_.currentTarget=ie;try{y(_)}catch(fe){Ud(fe)}_.currentTarget=null,y=K}}}}function ht(i,a){var c=a[nt];c===void 0&&(c=a[nt]=new Set);var h=i+"__bubble";c.has(h)||(eS(a,i,2,!1),c.add(h))}function Zg(i,a,c){var h=0;a&&(h|=4),eS(c,i,h,a)}var Rh="_reactListening"+Math.random().toString(36).slice(2);function Qg(i){if(!i[Rh]){i[Rh]=!0,Gy.forEach(function(c){c!=="selectionchange"&&(rD.has(c)||Zg(c,!1,i),Zg(c,!0,i))});var a=i.nodeType===9?i:i.ownerDocument;a===null||a[Rh]||(a[Rh]=!0,Zg("selectionchange",!1,a))}}function eS(i,a,c,h){switch(jS(a)){case 2:var _=AD;break;case 8:_=MD;break;default:_=fv}c=_.bind(null,a,c,i),_=void 0,!_p||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(_=!0),h?_!==void 0?i.addEventListener(a,c,{capture:!0,passive:_}):i.addEventListener(a,c,!0):_!==void 0?i.addEventListener(a,c,{passive:_}):i.addEventListener(a,c,!1)}function Jg(i,a,c,h,_){var y=h;if((a&1)===0&&(a&2)===0&&h!==null)e:for(;;){if(h===null)return;var j=h.tag;if(j===3||j===4){var z=h.stateNode.containerInfo;if(z===_)break;if(j===4)for(j=h.return;j!==null;){var K=j.tag;if((K===3||K===4)&&j.stateNode.containerInfo===_)return;j=j.return}for(;z!==null;){if(j=cl(z),j===null)return;if(K=j.tag,K===5||K===6||K===26||K===27){h=y=j;continue e}z=z.parentNode}}h=h.return}nb(function(){var ie=y,fe=gp(c),ge=[];e:{var ae=Db.get(i);if(ae!==void 0){var ue=Id,Te=i;switch(i){case"keypress":if(Bd(c)===0)break e;case"keydown":case"keyup":ue=KT;break;case"focusin":Te="focus",ue=wp;break;case"focusout":Te="blur",ue=wp;break;case"beforeblur":case"afterblur":ue=wp;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ue=lb;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ue=PT;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ue=QT;break;case jb:case Ab:case Mb:ue=$T;break;case Tb:ue=e3;break;case"scroll":case"scrollend":ue=OT;break;case"wheel":ue=r3;break;case"copy":case"cut":case"paste":ue=HT;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ue=ub;break;case"toggle":case"beforetoggle":ue=i3}var Ye=(a&4)!==0,Dt=!Ye&&(i==="scroll"||i==="scrollend"),J=Ye?ae!==null?ae+"Capture":null:ae;Ye=[];for(var Q=ie,se;Q!==null;){var me=Q;if(se=me.stateNode,me=me.tag,me!==5&&me!==26&&me!==27||se===null||J===null||(me=Nc(Q,J),me!=null&&Ye.push(ou(Q,me,se))),Dt)break;Q=Q.return}0<Ye.length&&(ae=new ue(ae,Te,null,c,fe),ge.push({event:ae,listeners:Ye}))}}if((a&7)===0){e:{if(ae=i==="mouseover"||i==="pointerover",ue=i==="mouseout"||i==="pointerout",ae&&c!==pp&&(Te=c.relatedTarget||c.fromElement)&&(cl(Te)||Te[je]))break e;if((ue||ae)&&(ae=fe.window===fe?fe:(ae=fe.ownerDocument)?ae.defaultView||ae.parentWindow:window,ue?(Te=c.relatedTarget||c.toElement,ue=ie,Te=Te?cl(Te):null,Te!==null&&(Dt=l(Te),Ye=Te.tag,Te!==Dt||Ye!==5&&Ye!==27&&Ye!==6)&&(Te=null)):(ue=null,Te=ie),ue!==Te)){if(Ye=lb,me="onMouseLeave",J="onMouseEnter",Q="mouse",(i==="pointerout"||i==="pointerover")&&(Ye=ub,me="onPointerLeave",J="onPointerEnter",Q="pointer"),Dt=ue==null?ae:Rc(ue),se=Te==null?ae:Rc(Te),ae=new Ye(me,Q+"leave",ue,c,fe),ae.target=Dt,ae.relatedTarget=se,me=null,cl(fe)===ie&&(Ye=new Ye(J,Q+"enter",Te,c,fe),Ye.target=se,Ye.relatedTarget=Dt,me=Ye),Dt=me,ue&&Te)t:{for(Ye=sD,J=ue,Q=Te,se=0,me=J;me;me=Ye(me))se++;me=0;for(var $e=Q;$e;$e=Ye($e))me++;for(;0<se-me;)J=Ye(J),se--;for(;0<me-se;)Q=Ye(Q),me--;for(;se--;){if(J===Q||Q!==null&&J===Q.alternate){Ye=J;break t}J=Ye(J),Q=Ye(Q)}Ye=null}else Ye=null;ue!==null&&tS(ge,ae,ue,Ye,!1),Te!==null&&Dt!==null&&tS(ge,Dt,Te,Ye,!0)}}e:{if(ae=ie?Rc(ie):window,ue=ae.nodeName&&ae.nodeName.toLowerCase(),ue==="select"||ue==="input"&&ae.type==="file")var xt=_b;else if(gb(ae))if(xb)xt=m3;else{xt=h3;var Oe=d3}else ue=ae.nodeName,!ue||ue.toLowerCase()!=="input"||ae.type!=="checkbox"&&ae.type!=="radio"?ie&&mp(ie.elementType)&&(xt=_b):xt=f3;if(xt&&(xt=xt(i,ie))){vb(ge,xt,c,fe);break e}Oe&&Oe(i,ae,ie),i==="focusout"&&ie&&ae.type==="number"&&ie.memoizedProps.value!=null&&fp(ae,"number",ae.value)}switch(Oe=ie?Rc(ie):window,i){case"focusin":(gb(Oe)||Oe.contentEditable==="true")&&(_l=Oe,Np=ie,Bc=null);break;case"focusout":Bc=Np=_l=null;break;case"mousedown":jp=!0;break;case"contextmenu":case"mouseup":case"dragend":jp=!1,Rb(ge,c,fe);break;case"selectionchange":if(g3)break;case"keydown":case"keyup":Rb(ge,c,fe)}var st;if(Cp)e:{switch(i){case"compositionstart":var pt="onCompositionStart";break e;case"compositionend":pt="onCompositionEnd";break e;case"compositionupdate":pt="onCompositionUpdate";break e}pt=void 0}else vl?mb(i,c)&&(pt="onCompositionEnd"):i==="keydown"&&c.keyCode===229&&(pt="onCompositionStart");pt&&(db&&c.locale!=="ko"&&(vl||pt!=="onCompositionStart"?pt==="onCompositionEnd"&&vl&&(st=ab()):(ma=fe,xp="value"in ma?ma.value:ma.textContent,vl=!0)),Oe=Nh(ie,pt),0<Oe.length&&(pt=new cb(pt,i,null,c,fe),ge.push({event:pt,listeners:Oe}),st?pt.data=st:(st=pb(c),st!==null&&(pt.data=st)))),(st=a3?o3(i,c):l3(i,c))&&(pt=Nh(ie,"onBeforeInput"),0<pt.length&&(Oe=new cb("onBeforeInput","beforeinput",null,c,fe),ge.push({event:Oe,listeners:pt}),Oe.data=st)),J3(ge,i,ie,c,fe)}Jw(ge,a)})}function ou(i,a,c){return{instance:i,listener:a,currentTarget:c}}function Nh(i,a){for(var c=a+"Capture",h=[];i!==null;){var _=i,y=_.stateNode;if(_=_.tag,_!==5&&_!==26&&_!==27||y===null||(_=Nc(i,c),_!=null&&h.unshift(ou(i,_,y)),_=Nc(i,a),_!=null&&h.push(ou(i,_,y))),i.tag===3)return h;i=i.return}return[]}function sD(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function tS(i,a,c,h,_){for(var y=a._reactName,j=[];c!==null&&c!==h;){var z=c,K=z.alternate,ie=z.stateNode;if(z=z.tag,K!==null&&K===h)break;z!==5&&z!==26&&z!==27||ie===null||(K=ie,_?(ie=Nc(c,y),ie!=null&&j.unshift(ou(c,ie,K))):_||(ie=Nc(c,y),ie!=null&&j.push(ou(c,ie,K)))),c=c.return}j.length!==0&&i.push({event:a,listeners:j})}var iD=/\r\n?/g,nD=/\u0000|\uFFFD/g;function rS(i){return(typeof i=="string"?i:""+i).replace(iD,`
|
|
49
|
-
`).replace(nD,"")}function sS(i,a){return a=rS(a),rS(i)===a}function Tt(i,a,c,h,_,y){switch(c){case"children":typeof h=="string"?a==="body"||a==="textarea"&&h===""||ml(i,h):(typeof h=="number"||typeof h=="bigint")&&a!=="body"&&ml(i,""+h);break;case"className":Td(i,"class",h);break;case"tabIndex":Td(i,"tabindex",h);break;case"dir":case"role":case"viewBox":case"width":case"height":Td(i,c,h);break;case"style":sb(i,h,y);break;case"data":if(a!=="object"){Td(i,"data",h);break}case"src":case"href":if(h===""&&(a!=="a"||c!=="href")){i.removeAttribute(c);break}if(h==null||typeof h=="function"||typeof h=="symbol"||typeof h=="boolean"){i.removeAttribute(c);break}h=Ld(""+h),i.setAttribute(c,h);break;case"action":case"formAction":if(typeof h=="function"){i.setAttribute(c,"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 y=="function"&&(c==="formAction"?(a!=="input"&&Tt(i,a,"name",_.name,_,null),Tt(i,a,"formEncType",_.formEncType,_,null),Tt(i,a,"formMethod",_.formMethod,_,null),Tt(i,a,"formTarget",_.formTarget,_,null)):(Tt(i,a,"encType",_.encType,_,null),Tt(i,a,"method",_.method,_,null),Tt(i,a,"target",_.target,_,null)));if(h==null||typeof h=="symbol"||typeof h=="boolean"){i.removeAttribute(c);break}h=Ld(""+h),i.setAttribute(c,h);break;case"onClick":h!=null&&(i.onclick=jn);break;case"onScroll":h!=null&&ht("scroll",i);break;case"onScrollEnd":h!=null&&ht("scrollend",i);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(s(61));if(c=h.__html,c!=null){if(_.children!=null)throw Error(s(60));i.innerHTML=c}}break;case"multiple":i.multiple=h&&typeof h!="function"&&typeof h!="symbol";break;case"muted":i.muted=h&&typeof h!="function"&&typeof h!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(h==null||typeof h=="function"||typeof h=="boolean"||typeof h=="symbol"){i.removeAttribute("xlink:href");break}c=Ld(""+h),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":h!=null&&typeof h!="function"&&typeof h!="symbol"?i.setAttribute(c,""+h):i.removeAttribute(c);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":h&&typeof h!="function"&&typeof h!="symbol"?i.setAttribute(c,""):i.removeAttribute(c);break;case"capture":case"download":h===!0?i.setAttribute(c,""):h!==!1&&h!=null&&typeof h!="function"&&typeof h!="symbol"?i.setAttribute(c,h):i.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":h!=null&&typeof h!="function"&&typeof h!="symbol"&&!isNaN(h)&&1<=h?i.setAttribute(c,h):i.removeAttribute(c);break;case"rowSpan":case"start":h==null||typeof h=="function"||typeof h=="symbol"||isNaN(h)?i.removeAttribute(c):i.setAttribute(c,h);break;case"popover":ht("beforetoggle",i),ht("toggle",i),Md(i,"popover",h);break;case"xlinkActuate":Nn(i,"http://www.w3.org/1999/xlink","xlink:actuate",h);break;case"xlinkArcrole":Nn(i,"http://www.w3.org/1999/xlink","xlink:arcrole",h);break;case"xlinkRole":Nn(i,"http://www.w3.org/1999/xlink","xlink:role",h);break;case"xlinkShow":Nn(i,"http://www.w3.org/1999/xlink","xlink:show",h);break;case"xlinkTitle":Nn(i,"http://www.w3.org/1999/xlink","xlink:title",h);break;case"xlinkType":Nn(i,"http://www.w3.org/1999/xlink","xlink:type",h);break;case"xmlBase":Nn(i,"http://www.w3.org/XML/1998/namespace","xml:base",h);break;case"xmlLang":Nn(i,"http://www.w3.org/XML/1998/namespace","xml:lang",h);break;case"xmlSpace":Nn(i,"http://www.w3.org/XML/1998/namespace","xml:space",h);break;case"is":Md(i,"is",h);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=DT.get(c)||c,Md(i,c,h))}}function ev(i,a,c,h,_,y){switch(c){case"style":sb(i,h,y);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(s(61));if(c=h.__html,c!=null){if(_.children!=null)throw Error(s(60));i.innerHTML=c}}break;case"children":typeof h=="string"?ml(i,h):(typeof h=="number"||typeof h=="bigint")&&ml(i,""+h);break;case"onScroll":h!=null&&ht("scroll",i);break;case"onScrollEnd":h!=null&&ht("scrollend",i);break;case"onClick":h!=null&&(i.onclick=jn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Yy.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(_=c.endsWith("Capture"),a=c.slice(2,_?c.length-7:void 0),y=i[he]||null,y=y!=null?y[c]:null,typeof y=="function"&&i.removeEventListener(a,y,_),typeof h=="function")){typeof y!="function"&&y!==null&&(c in i?i[c]=null:i.hasAttribute(c)&&i.removeAttribute(c)),i.addEventListener(a,h,_);break e}c in i?i[c]=h:h===!0?i.setAttribute(c,""):Md(i,c,h)}}}function ss(i,a,c){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ht("error",i),ht("load",i);var h=!1,_=!1,y;for(y in c)if(c.hasOwnProperty(y)){var j=c[y];if(j!=null)switch(y){case"src":h=!0;break;case"srcSet":_=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,a));default:Tt(i,a,y,j,c,null)}}_&&Tt(i,a,"srcSet",c.srcSet,c,null),h&&Tt(i,a,"src",c.src,c,null);return;case"input":ht("invalid",i);var z=y=j=_=null,K=null,ie=null;for(h in c)if(c.hasOwnProperty(h)){var fe=c[h];if(fe!=null)switch(h){case"name":_=fe;break;case"type":j=fe;break;case"checked":K=fe;break;case"defaultChecked":ie=fe;break;case"value":y=fe;break;case"defaultValue":z=fe;break;case"children":case"dangerouslySetInnerHTML":if(fe!=null)throw Error(s(137,a));break;default:Tt(i,a,h,fe,c,null)}}Jy(i,y,z,K,ie,j,_,!1);return;case"select":ht("invalid",i),h=j=y=null;for(_ in c)if(c.hasOwnProperty(_)&&(z=c[_],z!=null))switch(_){case"value":y=z;break;case"defaultValue":j=z;break;case"multiple":h=z;default:Tt(i,a,_,z,c,null)}a=y,c=j,i.multiple=!!h,a!=null?fl(i,!!h,a,!1):c!=null&&fl(i,!!h,c,!0);return;case"textarea":ht("invalid",i),y=_=h=null;for(j in c)if(c.hasOwnProperty(j)&&(z=c[j],z!=null))switch(j){case"value":h=z;break;case"defaultValue":_=z;break;case"children":y=z;break;case"dangerouslySetInnerHTML":if(z!=null)throw Error(s(91));break;default:Tt(i,a,j,z,c,null)}tb(i,h,_,y);return;case"option":for(K in c)if(c.hasOwnProperty(K)&&(h=c[K],h!=null))switch(K){case"selected":i.selected=h&&typeof h!="function"&&typeof h!="symbol";break;default:Tt(i,a,K,h,c,null)}return;case"dialog":ht("beforetoggle",i),ht("toggle",i),ht("cancel",i),ht("close",i);break;case"iframe":case"object":ht("load",i);break;case"video":case"audio":for(h=0;h<au.length;h++)ht(au[h],i);break;case"image":ht("error",i),ht("load",i);break;case"details":ht("toggle",i);break;case"embed":case"source":case"link":ht("error",i),ht("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ie in c)if(c.hasOwnProperty(ie)&&(h=c[ie],h!=null))switch(ie){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,a));default:Tt(i,a,ie,h,c,null)}return;default:if(mp(a)){for(fe in c)c.hasOwnProperty(fe)&&(h=c[fe],h!==void 0&&ev(i,a,fe,h,c,void 0));return}}for(z in c)c.hasOwnProperty(z)&&(h=c[z],h!=null&&Tt(i,a,z,h,c,null))}function aD(i,a,c,h){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var _=null,y=null,j=null,z=null,K=null,ie=null,fe=null;for(ue in c){var ge=c[ue];if(c.hasOwnProperty(ue)&&ge!=null)switch(ue){case"checked":break;case"value":break;case"defaultValue":K=ge;default:h.hasOwnProperty(ue)||Tt(i,a,ue,null,h,ge)}}for(var ae in h){var ue=h[ae];if(ge=c[ae],h.hasOwnProperty(ae)&&(ue!=null||ge!=null))switch(ae){case"type":y=ue;break;case"name":_=ue;break;case"checked":ie=ue;break;case"defaultChecked":fe=ue;break;case"value":j=ue;break;case"defaultValue":z=ue;break;case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(s(137,a));break;default:ue!==ge&&Tt(i,a,ae,ue,h,ge)}}hp(i,j,z,K,ie,fe,y,_);return;case"select":ue=j=z=ae=null;for(y in c)if(K=c[y],c.hasOwnProperty(y)&&K!=null)switch(y){case"value":break;case"multiple":ue=K;default:h.hasOwnProperty(y)||Tt(i,a,y,null,h,K)}for(_ in h)if(y=h[_],K=c[_],h.hasOwnProperty(_)&&(y!=null||K!=null))switch(_){case"value":ae=y;break;case"defaultValue":z=y;break;case"multiple":j=y;default:y!==K&&Tt(i,a,_,y,h,K)}a=z,c=j,h=ue,ae!=null?fl(i,!!c,ae,!1):!!h!=!!c&&(a!=null?fl(i,!!c,a,!0):fl(i,!!c,c?[]:"",!1));return;case"textarea":ue=ae=null;for(z in c)if(_=c[z],c.hasOwnProperty(z)&&_!=null&&!h.hasOwnProperty(z))switch(z){case"value":break;case"children":break;default:Tt(i,a,z,null,h,_)}for(j in h)if(_=h[j],y=c[j],h.hasOwnProperty(j)&&(_!=null||y!=null))switch(j){case"value":ae=_;break;case"defaultValue":ue=_;break;case"children":break;case"dangerouslySetInnerHTML":if(_!=null)throw Error(s(91));break;default:_!==y&&Tt(i,a,j,_,h,y)}eb(i,ae,ue);return;case"option":for(var Te in c)if(ae=c[Te],c.hasOwnProperty(Te)&&ae!=null&&!h.hasOwnProperty(Te))switch(Te){case"selected":i.selected=!1;break;default:Tt(i,a,Te,null,h,ae)}for(K in h)if(ae=h[K],ue=c[K],h.hasOwnProperty(K)&&ae!==ue&&(ae!=null||ue!=null))switch(K){case"selected":i.selected=ae&&typeof ae!="function"&&typeof ae!="symbol";break;default:Tt(i,a,K,ae,h,ue)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ye in c)ae=c[Ye],c.hasOwnProperty(Ye)&&ae!=null&&!h.hasOwnProperty(Ye)&&Tt(i,a,Ye,null,h,ae);for(ie in h)if(ae=h[ie],ue=c[ie],h.hasOwnProperty(ie)&&ae!==ue&&(ae!=null||ue!=null))switch(ie){case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(s(137,a));break;default:Tt(i,a,ie,ae,h,ue)}return;default:if(mp(a)){for(var Dt in c)ae=c[Dt],c.hasOwnProperty(Dt)&&ae!==void 0&&!h.hasOwnProperty(Dt)&&ev(i,a,Dt,void 0,h,ae);for(fe in h)ae=h[fe],ue=c[fe],!h.hasOwnProperty(fe)||ae===ue||ae===void 0&&ue===void 0||ev(i,a,fe,ae,h,ue);return}}for(var J in c)ae=c[J],c.hasOwnProperty(J)&&ae!=null&&!h.hasOwnProperty(J)&&Tt(i,a,J,null,h,ae);for(ge in h)ae=h[ge],ue=c[ge],!h.hasOwnProperty(ge)||ae===ue||ae==null&&ue==null||Tt(i,a,ge,ae,h,ue)}function iS(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function oD(){if(typeof performance.getEntriesByType=="function"){for(var i=0,a=0,c=performance.getEntriesByType("resource"),h=0;h<c.length;h++){var _=c[h],y=_.transferSize,j=_.initiatorType,z=_.duration;if(y&&z&&iS(j)){for(j=0,z=_.responseEnd,h+=1;h<c.length;h++){var K=c[h],ie=K.startTime;if(ie>z)break;var fe=K.transferSize,ge=K.initiatorType;fe&&iS(ge)&&(K=K.responseEnd,j+=fe*(K<z?1:(z-ie)/(K-ie)))}if(--h,a+=8*(y+j)/(_.duration/1e3),i++,10<i)break}}if(0<i)return a/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var tv=null,rv=null;function jh(i){return i.nodeType===9?i:i.ownerDocument}function nS(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function aS(i,a){if(i===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&a==="foreignObject"?0:i}function sv(i,a){return i==="textarea"||i==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var iv=null;function lD(){var i=window.event;return i&&i.type==="popstate"?i===iv?!1:(iv=i,!0):(iv=null,!1)}var oS=typeof setTimeout=="function"?setTimeout:void 0,cD=typeof clearTimeout=="function"?clearTimeout:void 0,lS=typeof Promise=="function"?Promise:void 0,uD=typeof queueMicrotask=="function"?queueMicrotask:typeof lS<"u"?function(i){return lS.resolve(null).then(i).catch(dD)}:oS;function dD(i){setTimeout(function(){throw i})}function Ma(i){return i==="head"}function cS(i,a){var c=a,h=0;do{var _=c.nextSibling;if(i.removeChild(c),_&&_.nodeType===8)if(c=_.data,c==="/$"||c==="/&"){if(h===0){i.removeChild(_),ql(a);return}h--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")h++;else if(c==="html")lu(i.ownerDocument.documentElement);else if(c==="head"){c=i.ownerDocument.head,lu(c);for(var y=c.firstChild;y;){var j=y.nextSibling,z=y.nodeName;y[ti]||z==="SCRIPT"||z==="STYLE"||z==="LINK"&&y.rel.toLowerCase()==="stylesheet"||c.removeChild(y),y=j}}else c==="body"&&lu(i.ownerDocument.body);c=_}while(c);ql(a)}function uS(i,a){var c=i;i=0;do{var h=c.nextSibling;if(c.nodeType===1?a?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(a?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),h&&h.nodeType===8)if(c=h.data,c==="/$"){if(i===0)break;i--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||i++;c=h}while(c)}function nv(i){var a=i.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var c=a;switch(a=a.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":nv(c),Mi(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}i.removeChild(c)}}function hD(i,a,c,h){for(;i.nodeType===1;){var _=c;if(i.nodeName.toLowerCase()!==a.toLowerCase()){if(!h&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(h){if(!i[ti])switch(a){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(y=i.getAttribute("rel"),y==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(y!==_.rel||i.getAttribute("href")!==(_.href==null||_.href===""?null:_.href)||i.getAttribute("crossorigin")!==(_.crossOrigin==null?null:_.crossOrigin)||i.getAttribute("title")!==(_.title==null?null:_.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(y=i.getAttribute("src"),(y!==(_.src==null?null:_.src)||i.getAttribute("type")!==(_.type==null?null:_.type)||i.getAttribute("crossorigin")!==(_.crossOrigin==null?null:_.crossOrigin))&&y&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(a==="input"&&i.type==="hidden"){var y=_.name==null?null:""+_.name;if(_.type==="hidden"&&i.getAttribute("name")===y)return i}else return i;if(i=ui(i.nextSibling),i===null)break}return null}function fD(i,a,c){if(a==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!c||(i=ui(i.nextSibling),i===null))return null;return i}function dS(i,a){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!a||(i=ui(i.nextSibling),i===null))return null;return i}function av(i){return i.data==="$?"||i.data==="$~"}function ov(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function mD(i,a){var c=i.ownerDocument;if(i.data==="$~")i._reactRetry=a;else if(i.data!=="$?"||c.readyState!=="loading")a();else{var h=function(){a(),c.removeEventListener("DOMContentLoaded",h)};c.addEventListener("DOMContentLoaded",h),i._reactRetry=h}}function ui(i){for(;i!=null;i=i.nextSibling){var a=i.nodeType;if(a===1||a===3)break;if(a===8){if(a=i.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return i}var lv=null;function hS(i){i=i.nextSibling;for(var a=0;i;){if(i.nodeType===8){var c=i.data;if(c==="/$"||c==="/&"){if(a===0)return ui(i.nextSibling);a--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||a++}i=i.nextSibling}return null}function fS(i){i=i.previousSibling;for(var a=0;i;){if(i.nodeType===8){var c=i.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(a===0)return i;a--}else c!=="/$"&&c!=="/&"||a++}i=i.previousSibling}return null}function mS(i,a,c){switch(a=jh(c),i){case"html":if(i=a.documentElement,!i)throw Error(s(452));return i;case"head":if(i=a.head,!i)throw Error(s(453));return i;case"body":if(i=a.body,!i)throw Error(s(454));return i;default:throw Error(s(451))}}function lu(i){for(var a=i.attributes;a.length;)i.removeAttributeNode(a[0]);Mi(i)}var di=new Map,pS=new Set;function Ah(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var qn=P.d;P.d={f:pD,r:gD,D:vD,C:_D,L:xD,m:yD,X:wD,S:bD,M:SD};function pD(){var i=qn.f(),a=bh();return i||a}function gD(i){var a=ul(i);a!==null&&a.tag===5&&a.type==="form"?T1(a):qn.r(i)}var Hl=typeof document>"u"?null:document;function gS(i,a,c){var h=Hl;if(h&&typeof a=="string"&&a){var _=si(a);_='link[rel="'+i+'"][href="'+_+'"]',typeof c=="string"&&(_+='[crossorigin="'+c+'"]'),pS.has(_)||(pS.add(_),i={rel:i,crossOrigin:c,href:a},h.querySelector(_)===null&&(a=h.createElement("link"),ss(a,"link",i),zr(a),h.head.appendChild(a)))}}function vD(i){qn.D(i),gS("dns-prefetch",i,null)}function _D(i,a){qn.C(i,a),gS("preconnect",i,a)}function xD(i,a,c){qn.L(i,a,c);var h=Hl;if(h&&i&&a){var _='link[rel="preload"][as="'+si(a)+'"]';a==="image"&&c&&c.imageSrcSet?(_+='[imagesrcset="'+si(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(_+='[imagesizes="'+si(c.imageSizes)+'"]')):_+='[href="'+si(i)+'"]';var y=_;switch(a){case"style":y=Fl(i);break;case"script":y=Wl(i)}di.has(y)||(i=p({rel:"preload",href:a==="image"&&c&&c.imageSrcSet?void 0:i,as:a},c),di.set(y,i),h.querySelector(_)!==null||a==="style"&&h.querySelector(cu(y))||a==="script"&&h.querySelector(uu(y))||(a=h.createElement("link"),ss(a,"link",i),zr(a),h.head.appendChild(a)))}}function yD(i,a){qn.m(i,a);var c=Hl;if(c&&i){var h=a&&typeof a.as=="string"?a.as:"script",_='link[rel="modulepreload"][as="'+si(h)+'"][href="'+si(i)+'"]',y=_;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=Wl(i)}if(!di.has(y)&&(i=p({rel:"modulepreload",href:i},a),di.set(y,i),c.querySelector(_)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(uu(y)))return}h=c.createElement("link"),ss(h,"link",i),zr(h),c.head.appendChild(h)}}}function bD(i,a,c){qn.S(i,a,c);var h=Hl;if(h&&i){var _=dl(h).hoistableStyles,y=Fl(i);a=a||"default";var j=_.get(y);if(!j){var z={loading:0,preload:null};if(j=h.querySelector(cu(y)))z.loading=5;else{i=p({rel:"stylesheet",href:i,"data-precedence":a},c),(c=di.get(y))&&cv(i,c);var K=j=h.createElement("link");zr(K),ss(K,"link",i),K._p=new Promise(function(ie,fe){K.onload=ie,K.onerror=fe}),K.addEventListener("load",function(){z.loading|=1}),K.addEventListener("error",function(){z.loading|=2}),z.loading|=4,Mh(j,a,h)}j={type:"stylesheet",instance:j,count:1,state:z},_.set(y,j)}}}function wD(i,a){qn.X(i,a);var c=Hl;if(c&&i){var h=dl(c).hoistableScripts,_=Wl(i),y=h.get(_);y||(y=c.querySelector(uu(_)),y||(i=p({src:i,async:!0},a),(a=di.get(_))&&uv(i,a),y=c.createElement("script"),zr(y),ss(y,"link",i),c.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},h.set(_,y))}}function SD(i,a){qn.M(i,a);var c=Hl;if(c&&i){var h=dl(c).hoistableScripts,_=Wl(i),y=h.get(_);y||(y=c.querySelector(uu(_)),y||(i=p({src:i,async:!0,type:"module"},a),(a=di.get(_))&&uv(i,a),y=c.createElement("script"),zr(y),ss(y,"link",i),c.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},h.set(_,y))}}function vS(i,a,c,h){var _=(_=de.current)?Ah(_):null;if(!_)throw Error(s(446));switch(i){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(a=Fl(c.href),c=dl(_).hoistableStyles,h=c.get(a),h||(h={type:"style",instance:null,count:0,state:null},c.set(a,h)),h):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){i=Fl(c.href);var y=dl(_).hoistableStyles,j=y.get(i);if(j||(_=_.ownerDocument||_,j={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(i,j),(y=_.querySelector(cu(i)))&&!y._p&&(j.instance=y,j.state.loading=5),di.has(i)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},di.set(i,c),y||CD(_,i,c,j.state))),a&&h===null)throw Error(s(528,""));return j}if(a&&h!==null)throw Error(s(529,""));return null;case"script":return a=c.async,c=c.src,typeof c=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=Wl(c),c=dl(_).hoistableScripts,h=c.get(a),h||(h={type:"script",instance:null,count:0,state:null},c.set(a,h)),h):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,i))}}function Fl(i){return'href="'+si(i)+'"'}function cu(i){return'link[rel="stylesheet"]['+i+"]"}function _S(i){return p({},i,{"data-precedence":i.precedence,precedence:null})}function CD(i,a,c,h){i.querySelector('link[rel="preload"][as="style"]['+a+"]")?h.loading=1:(a=i.createElement("link"),h.preload=a,a.addEventListener("load",function(){return h.loading|=1}),a.addEventListener("error",function(){return h.loading|=2}),ss(a,"link",c),zr(a),i.head.appendChild(a))}function Wl(i){return'[src="'+si(i)+'"]'}function uu(i){return"script[async]"+i}function xS(i,a,c){if(a.count++,a.instance===null)switch(a.type){case"style":var h=i.querySelector('style[data-href~="'+si(c.href)+'"]');if(h)return a.instance=h,zr(h),h;var _=p({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return h=(i.ownerDocument||i).createElement("style"),zr(h),ss(h,"style",_),Mh(h,c.precedence,i),a.instance=h;case"stylesheet":_=Fl(c.href);var y=i.querySelector(cu(_));if(y)return a.state.loading|=4,a.instance=y,zr(y),y;h=_S(c),(_=di.get(_))&&cv(h,_),y=(i.ownerDocument||i).createElement("link"),zr(y);var j=y;return j._p=new Promise(function(z,K){j.onload=z,j.onerror=K}),ss(y,"link",h),a.state.loading|=4,Mh(y,c.precedence,i),a.instance=y;case"script":return y=Wl(c.src),(_=i.querySelector(uu(y)))?(a.instance=_,zr(_),_):(h=c,(_=di.get(y))&&(h=p({},c),uv(h,_)),i=i.ownerDocument||i,_=i.createElement("script"),zr(_),ss(_,"link",h),i.head.appendChild(_),a.instance=_);case"void":return null;default:throw Error(s(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(h=a.instance,a.state.loading|=4,Mh(h,c.precedence,i));return a.instance}function Mh(i,a,c){for(var h=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),_=h.length?h[h.length-1]:null,y=_,j=0;j<h.length;j++){var z=h[j];if(z.dataset.precedence===a)y=z;else if(y!==_)break}y?y.parentNode.insertBefore(i,y.nextSibling):(a=c.nodeType===9?c.head:c,a.insertBefore(i,a.firstChild))}function cv(i,a){i.crossOrigin==null&&(i.crossOrigin=a.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=a.referrerPolicy),i.title==null&&(i.title=a.title)}function uv(i,a){i.crossOrigin==null&&(i.crossOrigin=a.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=a.referrerPolicy),i.integrity==null&&(i.integrity=a.integrity)}var Th=null;function yS(i,a,c){if(Th===null){var h=new Map,_=Th=new Map;_.set(c,h)}else _=Th,h=_.get(c),h||(h=new Map,_.set(c,h));if(h.has(i))return h;for(h.set(i,null),c=c.getElementsByTagName(i),_=0;_<c.length;_++){var y=c[_];if(!(y[ti]||y[Pt]||i==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var j=y.getAttribute(a)||"";j=i+j;var z=h.get(j);z?z.push(y):h.set(j,[y])}}return h}function bS(i,a,c){i=i.ownerDocument||i,i.head.insertBefore(c,a==="title"?i.querySelector("head > title"):null)}function kD(i,a,c){if(c===1||a.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;switch(a.rel){case"stylesheet":return i=a.disabled,typeof a.precedence=="string"&&i==null;default:return!0}case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function wS(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function ED(i,a,c,h){if(c.type==="stylesheet"&&(typeof h.media!="string"||matchMedia(h.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var _=Fl(h.href),y=a.querySelector(cu(_));if(y){a=y._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(i.count++,i=Dh.bind(i),a.then(i,i)),c.state.loading|=4,c.instance=y,zr(y);return}y=a.ownerDocument||a,h=_S(h),(_=di.get(_))&&cv(h,_),y=y.createElement("link"),zr(y);var j=y;j._p=new Promise(function(z,K){j.onload=z,j.onerror=K}),ss(y,"link",h),c.instance=y}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(c,a),(a=c.state.preload)&&(c.state.loading&3)===0&&(i.count++,c=Dh.bind(i),a.addEventListener("load",c),a.addEventListener("error",c))}}var dv=0;function RD(i,a){return i.stylesheets&&i.count===0&&Oh(i,i.stylesheets),0<i.count||0<i.imgCount?function(c){var h=setTimeout(function(){if(i.stylesheets&&Oh(i,i.stylesheets),i.unsuspend){var y=i.unsuspend;i.unsuspend=null,y()}},6e4+a);0<i.imgBytes&&dv===0&&(dv=62500*oD());var _=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&Oh(i,i.stylesheets),i.unsuspend)){var y=i.unsuspend;i.unsuspend=null,y()}},(i.imgBytes>dv?50:800)+a);return i.unsuspend=c,function(){i.unsuspend=null,clearTimeout(h),clearTimeout(_)}}:null}function Dh(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Oh(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var Lh=null;function Oh(i,a){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Lh=new Map,a.forEach(ND,i),Lh=null,Dh.call(i))}function ND(i,a){if(!(a.state.loading&4)){var c=Lh.get(i);if(c)var h=c.get(null);else{c=new Map,Lh.set(i,c);for(var _=i.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y<_.length;y++){var j=_[y];(j.nodeName==="LINK"||j.getAttribute("media")!=="not all")&&(c.set(j.dataset.precedence,j),h=j)}h&&c.set(null,h)}_=a.instance,j=_.getAttribute("data-precedence"),y=c.get(j)||h,y===h&&c.set(null,_),c.set(j,_),this.count++,h=Dh.bind(this),_.addEventListener("load",h),_.addEventListener("error",h),y?y.parentNode.insertBefore(_,y.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(_,i.firstChild)),a.state.loading|=4}}var du={$$typeof:N,Provider:null,Consumer:null,_currentValue:O,_currentValue2:O,_threadCount:0};function jD(i,a,c,h,_,y,j,z,K){this.tag=1,this.containerInfo=i,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=Ls(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ls(0),this.hiddenUpdates=Ls(null),this.identifierPrefix=h,this.onUncaughtError=_,this.onCaughtError=y,this.onRecoverableError=j,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=K,this.incompleteTransitions=new Map}function SS(i,a,c,h,_,y,j,z,K,ie,fe,ge){return i=new jD(i,a,c,j,K,ie,fe,ge,z),a=1,y===!0&&(a|=24),y=Bs(3,null,null,a),i.current=y,y.stateNode=i,a=Wp(),a.refCount++,i.pooledCache=a,a.refCount++,y.memoizedState={element:h,isDehydrated:c,cache:a},Yp(y),i}function CS(i){return i?(i=bl,i):bl}function kS(i,a,c,h,_,y){_=CS(_),h.context===null?h.context=_:h.pendingContext=_,h=ya(a),h.payload={element:c},y=y===void 0?null:y,y!==null&&(h.callback=y),c=ba(i,h,a),c!==null&&(Ns(c,i,a),Fc(c,i,a))}function ES(i,a){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var c=i.retryLane;i.retryLane=c!==0&&c<a?c:a}}function hv(i,a){ES(i,a),(i=i.alternate)&&ES(i,a)}function RS(i){if(i.tag===13||i.tag===31){var a=xo(i,67108864);a!==null&&Ns(a,i,67108864),hv(i,67108864)}}function NS(i){if(i.tag===13||i.tag===31){var a=Us();a=ei(a);var c=xo(i,a);c!==null&&Ns(c,i,a),hv(i,a)}}var Bh=!0;function AD(i,a,c,h){var _=M.T;M.T=null;var y=P.p;try{P.p=2,fv(i,a,c,h)}finally{P.p=y,M.T=_}}function MD(i,a,c,h){var _=M.T;M.T=null;var y=P.p;try{P.p=8,fv(i,a,c,h)}finally{P.p=y,M.T=_}}function fv(i,a,c,h){if(Bh){var _=mv(h);if(_===null)Jg(i,a,h,Ph,c),AS(i,h);else if(DD(_,i,a,c,h))h.stopPropagation();else if(AS(i,h),a&4&&-1<TD.indexOf(i)){for(;_!==null;){var y=ul(_);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var j=rr(y.pendingLanes);if(j!==0){var z=y;for(z.pendingLanes|=2,z.entangledLanes|=2;j;){var K=1<<31-Vt(j);z.entanglements[1]|=K,j&=~K}en(y),(St&6)===0&&(xh=ct()+500,nu(0))}}break;case 31:case 13:z=xo(y,2),z!==null&&Ns(z,y,2),bh(),hv(y,2)}if(y=mv(h),y===null&&Jg(i,a,h,Ph,c),y===_)break;_=y}_!==null&&h.stopPropagation()}else Jg(i,a,h,null,c)}}function mv(i){return i=gp(i),pv(i)}var Ph=null;function pv(i){if(Ph=null,i=cl(i),i!==null){var a=l(i);if(a===null)i=null;else{var c=a.tag;if(c===13){if(i=u(a),i!==null)return i;i=null}else if(c===31){if(i=d(a),i!==null)return i;i=null}else if(c===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;i=null}else a!==i&&(i=null)}}return Ph=i,null}function jS(i){switch(i){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(Qr()){case Ct:return 2;case Nr:return 8;case cs:case tr:return 32;case kt:return 268435456;default:return 32}default:return 32}}var gv=!1,Ta=null,Da=null,La=null,hu=new Map,fu=new Map,Oa=[],TD="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 AS(i,a){switch(i){case"focusin":case"focusout":Ta=null;break;case"dragenter":case"dragleave":Da=null;break;case"mouseover":case"mouseout":La=null;break;case"pointerover":case"pointerout":hu.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":fu.delete(a.pointerId)}}function mu(i,a,c,h,_,y){return i===null||i.nativeEvent!==y?(i={blockedOn:a,domEventName:c,eventSystemFlags:h,nativeEvent:y,targetContainers:[_]},a!==null&&(a=ul(a),a!==null&&RS(a)),i):(i.eventSystemFlags|=h,a=i.targetContainers,_!==null&&a.indexOf(_)===-1&&a.push(_),i)}function DD(i,a,c,h,_){switch(a){case"focusin":return Ta=mu(Ta,i,a,c,h,_),!0;case"dragenter":return Da=mu(Da,i,a,c,h,_),!0;case"mouseover":return La=mu(La,i,a,c,h,_),!0;case"pointerover":var y=_.pointerId;return hu.set(y,mu(hu.get(y)||null,i,a,c,h,_)),!0;case"gotpointercapture":return y=_.pointerId,fu.set(y,mu(fu.get(y)||null,i,a,c,h,_)),!0}return!1}function MS(i){var a=cl(i.target);if(a!==null){var c=l(a);if(c!==null){if(a=c.tag,a===13){if(a=u(c),a!==null){i.blockedOn=a,mo(i.priority,function(){NS(c)});return}}else if(a===31){if(a=d(c),a!==null){i.blockedOn=a,mo(i.priority,function(){NS(c)});return}}else if(a===3&&c.stateNode.current.memoizedState.isDehydrated){i.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}i.blockedOn=null}function Ih(i){if(i.blockedOn!==null)return!1;for(var a=i.targetContainers;0<a.length;){var c=mv(i.nativeEvent);if(c===null){c=i.nativeEvent;var h=new c.constructor(c.type,c);pp=h,c.target.dispatchEvent(h),pp=null}else return a=ul(c),a!==null&&RS(a),i.blockedOn=c,!1;a.shift()}return!0}function TS(i,a,c){Ih(i)&&c.delete(a)}function LD(){gv=!1,Ta!==null&&Ih(Ta)&&(Ta=null),Da!==null&&Ih(Da)&&(Da=null),La!==null&&Ih(La)&&(La=null),hu.forEach(TS),fu.forEach(TS)}function zh(i,a){i.blockedOn===a&&(i.blockedOn=null,gv||(gv=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,LD)))}var $h=null;function DS(i){$h!==i&&($h=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){$h===i&&($h=null);for(var a=0;a<i.length;a+=3){var c=i[a],h=i[a+1],_=i[a+2];if(typeof h!="function"){if(pv(h||c)===null)continue;break}var y=ul(c);y!==null&&(i.splice(a,3),a-=3,mg(y,{pending:!0,data:_,method:c.method,action:h},h,_))}}))}function ql(i){function a(K){return zh(K,i)}Ta!==null&&zh(Ta,i),Da!==null&&zh(Da,i),La!==null&&zh(La,i),hu.forEach(a),fu.forEach(a);for(var c=0;c<Oa.length;c++){var h=Oa[c];h.blockedOn===i&&(h.blockedOn=null)}for(;0<Oa.length&&(c=Oa[0],c.blockedOn===null);)MS(c),c.blockedOn===null&&Oa.shift();if(c=(i.ownerDocument||i).$$reactFormReplay,c!=null)for(h=0;h<c.length;h+=3){var _=c[h],y=c[h+1],j=_[he]||null;if(typeof y=="function")j||DS(c);else if(j){var z=null;if(y&&y.hasAttribute("formAction")){if(_=y,j=y[he]||null)z=j.formAction;else if(pv(_)!==null)continue}else z=j.action;typeof z=="function"?c[h+1]=z:(c.splice(h,3),h-=3),DS(c)}}}function LS(){function i(y){y.canIntercept&&y.info==="react-transition"&&y.intercept({handler:function(){return new Promise(function(j){return _=j})},focusReset:"manual",scroll:"manual"})}function a(){_!==null&&(_(),_=null),h||setTimeout(c,20)}function c(){if(!h&&!navigation.transition){var y=navigation.currentEntry;y&&y.url!=null&&navigation.navigate(y.url,{state:y.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var h=!1,_=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(c,100),function(){h=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),_!==null&&(_(),_=null)}}}function vv(i){this._internalRoot=i}Uh.prototype.render=vv.prototype.render=function(i){var a=this._internalRoot;if(a===null)throw Error(s(409));var c=a.current,h=Us();kS(c,h,i,a,null,null)},Uh.prototype.unmount=vv.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var a=i.containerInfo;kS(i.current,2,null,i,null,null),bh(),a[je]=null}};function Uh(i){this._internalRoot=i}Uh.prototype.unstable_scheduleHydration=function(i){if(i){var a=Rn();i={blockedOn:null,target:i,priority:a};for(var c=0;c<Oa.length&&a!==0&&a<Oa[c].priority;c++);Oa.splice(c,0,i),c===0&&MS(i)}};var OS=t.version;if(OS!=="19.2.7")throw Error(s(527,OS,"19.2.7"));P.findDOMNode=function(i){var a=i._reactInternals;if(a===void 0)throw typeof i.render=="function"?Error(s(188)):(i=Object.keys(i).join(","),Error(s(268,i)));return i=f(a),i=i!==null?v(i):null,i=i===null?null:i.stateNode,i};var OD={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:M,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Hh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Hh.isDisabled&&Hh.supportsFiber)try{us=Hh.inject(OD),zt=Hh}catch{}}return gu.createRoot=function(i,a){if(!n(i))throw Error(s(299));var c=!1,h="",_=H1,y=F1,j=W1;return a!=null&&(a.unstable_strictMode===!0&&(c=!0),a.identifierPrefix!==void 0&&(h=a.identifierPrefix),a.onUncaughtError!==void 0&&(_=a.onUncaughtError),a.onCaughtError!==void 0&&(y=a.onCaughtError),a.onRecoverableError!==void 0&&(j=a.onRecoverableError)),a=SS(i,1,!1,null,null,c,h,null,_,y,j,LS),i[je]=a.current,Qg(i),new vv(a)},gu.hydrateRoot=function(i,a,c){if(!n(i))throw Error(s(299));var h=!1,_="",y=H1,j=F1,z=W1,K=null;return c!=null&&(c.unstable_strictMode===!0&&(h=!0),c.identifierPrefix!==void 0&&(_=c.identifierPrefix),c.onUncaughtError!==void 0&&(y=c.onUncaughtError),c.onCaughtError!==void 0&&(j=c.onCaughtError),c.onRecoverableError!==void 0&&(z=c.onRecoverableError),c.formState!==void 0&&(K=c.formState)),a=SS(i,1,!0,a,c??null,h,_,K,y,j,z,LS),a.context=CS(null),c=a.current,h=Us(),h=ei(h),_=ya(h),_.callback=null,ba(c,_,h),c=h,a.current.lanes=c,rt(a,c),en(a),i[je]=a.current,Qg(i),new Uh(a)},gu.version="19.2.7",gu}var qS;function GD(){if(qS)return yv.exports;qS=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(),yv.exports=VD(),yv.exports}var YD=GD();/**
|
|
50
|
-
* react-router v7.18.1
|
|
51
|
-
*
|
|
52
|
-
* Copyright (c) Remix Software Inc.
|
|
53
|
-
*
|
|
54
|
-
* This source code is licensed under the MIT license found in the
|
|
55
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
56
|
-
*
|
|
57
|
-
* @license MIT
|
|
58
|
-
*/var m0=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Lk=/^[\\/]{2}/;function KD(e,t){return t+e.replace(/\\/g,"/")}var VS="popstate";function GS(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function XD(e={}){function t(s,n){var f;let l=(f=n.state)==null?void 0:f.masked,{pathname:u,search:d,hash:m}=l||s.location;return L_("",{pathname:u,search:d,hash:m},n.state&&n.state.usr||null,n.state&&n.state.key||"default",l?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function r(s,n){return typeof n=="string"?n:Ku(n)}return QD(t,r,null,e)}function Rr(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Ci(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function ZD(){return Math.random().toString(36).substring(2,10)}function YS(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function L_(e,t,r=null,s,n){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?hd(t):t,state:r,key:t&&t.key||s||ZD(),mask:n}}function Ku({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function hd(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let s=e.indexOf("?");s>=0&&(t.search=e.substring(s),e=e.substring(0,s)),e&&(t.pathname=e)}return t}function QD(e,t,r,s={}){let{window:n=document.defaultView,v5Compat:l=!1}=s,u=n.history,d="POP",m=null,f=v();f==null&&(f=0,u.replaceState({...u.state,idx:f},""));function v(){return(u.state||{idx:null}).idx}function p(){d="POP";let k=v(),S=k==null?null:k-f;f=k,m&&m({action:d,location:C.location,delta:S})}function x(k,S){d="PUSH";let E=GS(k)?k:L_(C.location,k,S);f=v()+1;let N=YS(E,f),R=C.createHref(E.mask||E);try{u.pushState(N,"",R)}catch(A){if(A instanceof DOMException&&A.name==="DataCloneError")throw A;n.location.assign(R)}l&&m&&m({action:d,location:C.location,delta:1})}function b(k,S){d="REPLACE";let E=GS(k)?k:L_(C.location,k,S);f=v();let N=YS(E,f),R=C.createHref(E.mask||E);u.replaceState(N,"",R),l&&m&&m({action:d,location:C.location,delta:0})}function w(k){return JD(n,k)}let C={get action(){return d},get location(){return e(n,u)},listen(k){if(m)throw new Error("A history only accepts one active listener");return n.addEventListener(VS,p),m=k,()=>{n.removeEventListener(VS,p),m=null}},createHref(k){return t(n,k)},createURL:w,encodeLocation(k){let S=w(k);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:x,replace:b,go(k){return u.go(k)}};return C}function JD(e,t,r=!1){let s="http://localhost";e&&(s=e.location.origin!=="null"?e.location.origin:e.location.href),Rr(s,"No window.location.(origin|href) available to create URL");let n=typeof t=="string"?t:Ku(t);return n=n.replace(/ $/,"%20"),!r&&Lk.test(n)&&(n=s+n),new URL(n,s)}function Ok(e,t,r="/"){return eL(e,t,r,!1)}function eL(e,t,r,s,n){let l=typeof t=="string"?hd(t):t,u=ta(l.pathname||"/",r);if(u==null)return null;let d=tL(e),m=null,f=hL(u);for(let v=0;m==null&&v<d.length;++v)m=dL(d[v],f,s);return m}function tL(e){let t=Bk(e);return rL(t),t}function Bk(e,t=[],r=[],s="",n=!1){let l=(u,d,m=n,f)=>{let v={relativePath:f===void 0?u.path||"":f,caseSensitive:u.caseSensitive===!0,childrenIndex:d,route:u};if(v.relativePath.startsWith("/")){if(!v.relativePath.startsWith(s)&&m)return;Rr(v.relativePath.startsWith(s),`Absolute route path "${v.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),v.relativePath=v.relativePath.slice(s.length)}let p=zi([s,v.relativePath]),x=r.concat(v);u.children&&u.children.length>0&&(Rr(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${p}".`),Bk(u.children,t,x,p,m)),!(u.path==null&&!u.index)&&t.push({path:p,score:cL(p,u.index),routesMeta:x.map((b,w)=>{let[C,k]=zk(b.relativePath,b.caseSensitive,w===x.length-1);return{...b,matcher:C,compiledParams:k}})})};return e.forEach((u,d)=>{var m;if(u.path===""||!((m=u.path)!=null&&m.includes("?")))l(u,d);else for(let f of Pk(u.path))l(u,d,!0,f)}),t}function Pk(e){let t=e.split("/");if(t.length===0)return[];let[r,...s]=t,n=r.endsWith("?"),l=r.replace(/\?$/,"");if(s.length===0)return n?[l,""]:[l];let u=Pk(s.join("/")),d=[];return d.push(...u.map(m=>m===""?l:[l,m].join("/"))),n&&d.push(...u),d.map(m=>e.startsWith("/")&&m===""?"/":m)}function rL(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:uL(t.routesMeta.map(s=>s.childrenIndex),r.routesMeta.map(s=>s.childrenIndex)))}var sL=/^:[\w-]+$/,iL=3,nL=2,aL=1,oL=10,lL=-2,KS=e=>e==="*";function cL(e,t){let r=e.split("/"),s=r.length;return r.some(KS)&&(s+=lL),t&&(s+=nL),r.filter(n=>!KS(n)).reduce((n,l)=>n+(sL.test(l)?iL:l===""?aL:oL),s)}function uL(e,t){return e.length===t.length&&e.slice(0,-1).every((s,n)=>s===t[n])?e[e.length-1]-t[t.length-1]:0}function dL(e,t,r=!1){let{routesMeta:s}=e,n={},l="/",u=[];for(let d=0;d<s.length;++d){let m=s[d],f=d===s.length-1,v=l==="/"?t:t.slice(l.length)||"/",p={path:m.relativePath,caseSensitive:m.caseSensitive,end:f},x=m.matcher&&m.compiledParams?Ik(p,v,m.matcher,m.compiledParams):Ff(p,v),b=m.route;if(!x&&f&&r&&!s[s.length-1].route.index&&(x=Ff({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},v)),!x)return null;Object.assign(n,x.params),u.push({params:n,pathname:zi([l,x.pathname]),pathnameBase:pL(zi([l,x.pathnameBase])),route:b}),x.pathnameBase!=="/"&&(l=zi([l,x.pathnameBase]))}return u}function Ff(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,s]=zk(e.path,e.caseSensitive,e.end);return Ik(e,t,r,s)}function Ik(e,t,r,s){let n=t.match(r);if(!n)return null;let l=n[0],u=l.replace(/(.)\/+$/,"$1"),d=n.slice(1);return{params:s.reduce((f,{paramName:v,isOptional:p},x)=>{if(v==="*"){let w=d[x]||"";u=l.slice(0,l.length-w.length).replace(/(.)\/+$/,"$1")}const b=d[x];return p&&!b?f[v]=void 0:f[v]=(b||"").replace(/%2F/g,"/"),f},{}),pathname:l,pathnameBase:u,pattern:e}}function zk(e,t=!1,r=!0){Ci(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let s=[],n="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,d,m,f,v)=>{if(s.push({paramName:d,isOptional:m!=null}),m){let p=v.charAt(f+u.length);return p&&p!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(s.push({paramName:"*"}),n+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?n+="\\/*$":e!==""&&e!=="/"&&(n+="(?:(?=\\/|$))"),[new RegExp(n,t?void 0:"i"),s]}function hL(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Ci(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function ta(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,s=e.charAt(r);return s&&s!=="/"?null:e.slice(r)||"/"}function fL(e,t="/"){let{pathname:r,search:s="",hash:n=""}=typeof e=="string"?hd(e):e,l;return r?(r=$k(r),r.startsWith("/")?l=XS(r.substring(1),"/"):l=XS(r,t)):l=t,{pathname:l,search:gL(s),hash:vL(n)}}function XS(e,t){let r=Wf(t).split("/");return e.split("/").forEach(n=>{n===".."?r.length>1&&r.pop():n!=="."&&r.push(n)}),r.length>1?r.join("/"):"/"}function Cv(e,t,r,s){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(s)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function mL(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function p0(e){let t=mL(e);return t.map((r,s)=>s===t.length-1?r.pathname:r.pathnameBase)}function _m(e,t,r,s=!1){let n;typeof e=="string"?n=hd(e):(n={...e},Rr(!n.pathname||!n.pathname.includes("?"),Cv("?","pathname","search",n)),Rr(!n.pathname||!n.pathname.includes("#"),Cv("#","pathname","hash",n)),Rr(!n.search||!n.search.includes("#"),Cv("#","search","hash",n)));let l=e===""||n.pathname==="",u=l?"/":n.pathname,d;if(u==null)d=r;else{let p=t.length-1;if(!s&&u.startsWith("..")){let x=u.split("/");for(;x[0]==="..";)x.shift(),p-=1;n.pathname=x.join("/")}d=p>=0?t[p]:"/"}let m=fL(n,d),f=u&&u!=="/"&&u.endsWith("/"),v=(l||u===".")&&r.endsWith("/");return!m.pathname.endsWith("/")&&(f||v)&&(m.pathname+="/"),m}var $k=e=>e.replace(/[\\/]{2,}/g,"/"),zi=e=>$k(e.join("/")),Wf=e=>e.replace(/\/+$/,""),pL=e=>Wf(e).replace(/^\/*/,"/"),gL=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,vL=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,_L=class{constructor(e,t,r,s=!1){this.status=e,this.statusText=t||"",this.internal=s,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function xL(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function yL(e){let t=e.map(r=>r.route.path).filter(Boolean);return zi(t)||"/"}var Uk=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Hk(e,t){let r=e;if(typeof r!="string"||!m0.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let s=r,n=!1;if(Uk)try{let l=new URL(window.location.href),u=Lk.test(r)?new URL(KD(r,l.protocol)):new URL(r),d=ta(u.pathname,t);u.origin===l.origin&&d!=null?r=d+u.search+u.hash:n=!0}catch{Ci(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:s,isExternal:n,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Fk=["POST","PUT","PATCH","DELETE"];new Set(Fk);var bL=["GET",...Fk];new Set(bL);var wL=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function SL(e){try{return wL.includes(new URL(e).protocol)}catch{return!1}}var gc=g.createContext(null);gc.displayName="DataRouter";var xm=g.createContext(null);xm.displayName="DataRouterState";var Wk=g.createContext(!1);function CL(){return g.useContext(Wk)}var qk=g.createContext({isTransitioning:!1});qk.displayName="ViewTransition";var kL=g.createContext(new Map);kL.displayName="Fetchers";var EL=g.createContext(null);EL.displayName="Await";var Ks=g.createContext(null);Ks.displayName="Navigation";var ym=g.createContext(null);ym.displayName="Location";var Vi=g.createContext({outlet:null,matches:[],isDataRoute:!1});Vi.displayName="Route";var g0=g.createContext(null);g0.displayName="RouteError";var Vk="REACT_ROUTER_ERROR",RL="REDIRECT",NL="ROUTE_ERROR_RESPONSE";function jL(e){if(e.startsWith(`${Vk}:${RL}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function AL(e){if(e.startsWith(`${Vk}:${NL}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new _L(t.status,t.statusText,t.data)}catch{}}function ML(e,{relative:t}={}){Rr(vc(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:s}=g.useContext(Ks),{hash:n,pathname:l,search:u}=fd(e,{relative:t}),d=l;return r!=="/"&&(d=l==="/"?r:zi([r,l])),s.createHref({pathname:d,search:u,hash:n})}function vc(){return g.useContext(ym)!=null}function Xr(){return Rr(vc(),"useLocation() may be used only in the context of a <Router> component."),g.useContext(ym).location}var Gk="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Yk(e){g.useContext(Ks).static||g.useLayoutEffect(e)}function ao(){let{isDataRoute:e}=g.useContext(Vi);return e?WL():TL()}function TL(){Rr(vc(),"useNavigate() may be used only in the context of a <Router> component.");let e=g.useContext(gc),{basename:t,navigator:r}=g.useContext(Ks),{matches:s}=g.useContext(Vi),{pathname:n}=Xr(),l=JSON.stringify(p0(s)),u=g.useRef(!1);return Yk(()=>{u.current=!0}),g.useCallback((m,f={})=>{if(Ci(u.current,Gk),!u.current)return;if(typeof m=="number"){r.go(m);return}let v=_m(m,JSON.parse(l),n,f.relative==="path");e==null&&t!=="/"&&(v.pathname=v.pathname==="/"?t:zi([t,v.pathname])),(f.replace?r.replace:r.push)(v,f.state,f)},[t,r,l,n,e])}g.createContext(null);function Kk(){let{matches:e}=g.useContext(Vi),t=e[e.length-1];return(t==null?void 0:t.params)??{}}function fd(e,{relative:t}={}){let{matches:r}=g.useContext(Vi),{pathname:s}=Xr(),n=JSON.stringify(p0(r));return g.useMemo(()=>_m(e,JSON.parse(n),s,t==="path"),[e,n,s,t])}function DL(e,t){return Xk(e)}function Xk(e,t,r){Rr(vc(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=g.useContext(Ks),{matches:n}=g.useContext(Vi),l=n[n.length-1],u=l?l.params:{},d=l?l.pathname:"/",m=l?l.pathnameBase:"/",f=l&&l.route;{let k=f&&f.path||"";Qk(d,!f||k.endsWith("*")||k.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (under <Route path="${k}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
59
|
-
|
|
60
|
-
Please change the parent <Route path="${k}"> to <Route path="${k==="/"?"*":`${k}/*`}">.`)}let v=Xr(),p;p=v;let x=p.pathname||"/",b=x;if(m!=="/"){let k=m.replace(/^\//,"").split("/");b="/"+x.replace(/^\//,"").split("/").slice(k.length).join("/")}let w=r&&r.state.matches.length?r.state.matches.map(k=>Object.assign(k,{route:r.manifest[k.route.id]||k.route})):Ok(e,{pathname:b});return Ci(f||w!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),Ci(w==null||w[w.length-1].route.element!==void 0||w[w.length-1].route.Component!==void 0||w[w.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),IL(w&&w.map(k=>Object.assign({},k,{params:Object.assign({},u,k.params),pathname:zi([m,s.encodeLocation?s.encodeLocation(k.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?m:zi([m,s.encodeLocation?s.encodeLocation(k.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),n,r)}function LL(){let e=FL(),t=xL(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,s="rgba(200,200,200, 0.5)",n={padding:"0.5rem",backgroundColor:s},l={padding:"2px 4px",backgroundColor:s},u=null;return console.error("Error handled by React Router default ErrorBoundary:",e),u=g.createElement(g.Fragment,null,g.createElement("p",null,"💿 Hey developer 👋"),g.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",g.createElement("code",{style:l},"ErrorBoundary")," or"," ",g.createElement("code",{style:l},"errorElement")," prop on your route.")),g.createElement(g.Fragment,null,g.createElement("h2",null,"Unexpected Application Error!"),g.createElement("h3",{style:{fontStyle:"italic"}},t),r?g.createElement("pre",{style:n},r):null,u)}var OL=g.createElement(LL,null),Zk=class extends g.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=AL(e.digest);r&&(e=r)}let t=e!==void 0?g.createElement(Vi.Provider,{value:this.props.routeContext},g.createElement(g0.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?g.createElement(BL,{error:e},t):t}};Zk.contextType=Wk;var kv=new WeakMap;function BL({children:e,error:t}){let{basename:r}=g.useContext(Ks);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let s=jL(t.digest);if(s){let n=kv.get(t);if(n)throw n;let l=Hk(s.location,r),u=l.absoluteURL||l.to;if(SL(u))throw new Error("Invalid redirect location");if(Uk&&!kv.get(t))if(l.isExternal||s.reloadDocument)window.location.href=u;else{const d=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(l.to,{replace:s.replace}));throw kv.set(t,d),d}return g.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u}`})}}return e}function PL({routeContext:e,match:t,children:r}){let s=g.useContext(gc);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),g.createElement(Vi.Provider,{value:e},r)}function IL(e,t=[],r){let s=r==null?void 0:r.state;if(e==null){if(!s)return null;if(s.errors)e=s.matches;else if(t.length===0&&!s.initialized&&s.matches.length>0)e=s.matches;else return null}let n=e,l=s==null?void 0:s.errors;if(l!=null){let v=n.findIndex(p=>p.route.id&&(l==null?void 0:l[p.route.id])!==void 0);Rr(v>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(l).join(",")}`),n=n.slice(0,Math.min(n.length,v+1))}let u=!1,d=-1;if(r&&s){u=s.renderFallback;for(let v=0;v<n.length;v++){let p=n[v];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(d=v),p.route.id){let{loaderData:x,errors:b}=s,w=p.route.loader&&!x.hasOwnProperty(p.route.id)&&(!b||b[p.route.id]===void 0);if(p.route.lazy||w){r.isStatic&&(u=!0),d>=0?n=n.slice(0,d+1):n=[n[0]];break}}}}let m=r==null?void 0:r.onError,f=s&&m?(v,p)=>{var x,b;m(v,{location:s.location,params:((b=(x=s.matches)==null?void 0:x[0])==null?void 0:b.params)??{},pattern:yL(s.matches),errorInfo:p})}:void 0;return n.reduceRight((v,p,x)=>{let b,w=!1,C=null,k=null;s&&(b=l&&p.route.id?l[p.route.id]:void 0,C=p.route.errorElement||OL,u&&(d<0&&x===0?(Qk("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,k=null):d===x&&(w=!0,k=p.route.hydrateFallbackElement||null)));let S=t.concat(n.slice(0,x+1)),E=()=>{let N;return b?N=C:w?N=k:p.route.Component?N=g.createElement(p.route.Component,null):p.route.element?N=p.route.element:N=v,g.createElement(PL,{match:p,routeContext:{outlet:v,matches:S,isDataRoute:s!=null},children:N})};return s&&(p.route.ErrorBoundary||p.route.errorElement||x===0)?g.createElement(Zk,{location:s.location,revalidation:s.revalidation,component:C,error:b,children:E(),routeContext:{outlet:null,matches:S,isDataRoute:!0},onError:f}):E()},null)}function v0(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function zL(e){let t=g.useContext(gc);return Rr(t,v0(e)),t}function $L(e){let t=g.useContext(xm);return Rr(t,v0(e)),t}function UL(e){let t=g.useContext(Vi);return Rr(t,v0(e)),t}function _0(e){let t=UL(e),r=t.matches[t.matches.length-1];return Rr(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function HL(){return _0("useRouteId")}function FL(){var s;let e=g.useContext(g0),t=$L("useRouteError"),r=_0("useRouteError");return e!==void 0?e:(s=t.errors)==null?void 0:s[r]}function WL(){let{router:e}=zL("useNavigate"),t=_0("useNavigate"),r=g.useRef(!1);return Yk(()=>{r.current=!0}),g.useCallback(async(n,l={})=>{Ci(r.current,Gk),r.current&&(typeof n=="number"?await e.navigate(n):await e.navigate(n,{fromRouteId:t,...l}))},[e,t])}var ZS={};function Qk(e,t,r){!t&&!ZS[e]&&(ZS[e]=!0,Ci(!1,r))}g.memo(qL);function qL({routes:e,manifest:t,future:r,state:s,isStatic:n,onError:l}){return Xk(e,void 0,{manifest:t,state:s,isStatic:n,onError:l})}function Va({to:e,replace:t,state:r,relative:s}){Rr(vc(),"<Navigate> may be used only in the context of a <Router> component.");let{static:n}=g.useContext(Ks);Ci(!n,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:l}=g.useContext(Vi),{pathname:u}=Xr(),d=ao(),m=_m(e,p0(l),u,s==="path"),f=JSON.stringify(m);return g.useEffect(()=>{d(JSON.parse(f),{replace:t,state:r,relative:s})},[d,f,s,t,r]),null}function VL({basename:e="/",children:t=null,location:r,navigationType:s="POP",navigator:n,static:l=!1,useTransitions:u}){Rr(!vc(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let d=e.replace(/^\/*/,"/"),m=g.useMemo(()=>({basename:d,navigator:n,static:l,useTransitions:u,future:{}}),[d,n,l,u]);typeof r=="string"&&(r=hd(r));let{pathname:f="/",search:v="",hash:p="",state:x=null,key:b="default",mask:w}=r,C=g.useMemo(()=>{let k=ta(f,d);return k==null?null:{location:{pathname:k,search:v,hash:p,state:x,key:b,mask:w},navigationType:s}},[d,f,v,p,x,b,s,w]);return Ci(C!=null,`<Router basename="${d}"> is not able to match the URL "${f}${v}${p}" because it does not start with the basename, so the <Router> won't render anything.`),C==null?null:g.createElement(Ks.Provider,{value:m},g.createElement(ym.Provider,{children:t,value:C}))}var wf="get",Sf="application/x-www-form-urlencoded";function bm(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function GL(e){return bm(e)&&e.tagName.toLowerCase()==="button"}function YL(e){return bm(e)&&e.tagName.toLowerCase()==="form"}function KL(e){return bm(e)&&e.tagName.toLowerCase()==="input"}function XL(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function ZL(e,t){return e.button===0&&(!t||t==="_self")&&!XL(e)}function O_(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let s=e[r];return t.concat(Array.isArray(s)?s.map(n=>[r,n]):[[r,s]])},[]))}function QL(e,t){let r=O_(e);return t&&t.forEach((s,n)=>{r.has(n)||t.getAll(n).forEach(l=>{r.append(n,l)})}),r}var Fh=null;function JL(){if(Fh===null)try{new FormData(document.createElement("form"),0),Fh=!1}catch{Fh=!0}return Fh}var e4=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Ev(e){return e!=null&&!e4.has(e)?(Ci(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Sf}"`),null):e}function t4(e,t){let r,s,n,l,u;if(YL(e)){let d=e.getAttribute("action");s=d?ta(d,t):null,r=e.getAttribute("method")||wf,n=Ev(e.getAttribute("enctype"))||Sf,l=new FormData(e)}else if(GL(e)||KL(e)&&(e.type==="submit"||e.type==="image")){let d=e.form;if(d==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=e.getAttribute("formaction")||d.getAttribute("action");if(s=m?ta(m,t):null,r=e.getAttribute("formmethod")||d.getAttribute("method")||wf,n=Ev(e.getAttribute("formenctype"))||Ev(d.getAttribute("enctype"))||Sf,l=new FormData(d,e),!JL()){let{name:f,type:v,value:p}=e;if(v==="image"){let x=f?`${f}.`:"";l.append(`${x}x`,"0"),l.append(`${x}y`,"0")}else f&&l.append(f,p)}}else{if(bm(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=wf,s=null,n=Sf,u=e}return l&&n==="text/plain"&&(u=l,l=void 0),{action:s,method:r.toLowerCase(),encType:n,formData:l,body:u}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function x0(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Jk(e,t,r,s){let n=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?n.pathname.endsWith("/")?n.pathname=`${n.pathname}_.${s}`:n.pathname=`${n.pathname}.${s}`:n.pathname==="/"?n.pathname=`_root.${s}`:t&&ta(n.pathname,t)==="/"?n.pathname=`${Wf(t)}/_root.${s}`:n.pathname=`${Wf(n.pathname)}.${s}`,n}async function r4(e,t){if(e.id in t)return t[e.id];try{let r=await import(e.module);return t[e.id]=r,r}catch(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function s4(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function i4(e,t,r){let s=await Promise.all(e.map(async n=>{let l=t.routes[n.route.id];if(l){let u=await r4(l,r);return u.links?u.links():[]}return[]}));return l4(s.flat(1).filter(s4).filter(n=>n.rel==="stylesheet"||n.rel==="preload").map(n=>n.rel==="stylesheet"?{...n,rel:"prefetch",as:"style"}:{...n,rel:"prefetch"}))}function QS(e,t,r,s,n,l){let u=(m,f)=>r[f]?m.route.id!==r[f].route.id:!0,d=(m,f)=>{var v;return r[f].pathname!==m.pathname||((v=r[f].route.path)==null?void 0:v.endsWith("*"))&&r[f].params["*"]!==m.params["*"]};return l==="assets"?t.filter((m,f)=>u(m,f)||d(m,f)):l==="data"?t.filter((m,f)=>{var p;let v=s.routes[m.route.id];if(!v||!v.hasLoader)return!1;if(u(m,f)||d(m,f))return!0;if(m.route.shouldRevalidate){let x=m.route.shouldRevalidate({currentUrl:new URL(n.pathname+n.search+n.hash,window.origin),currentParams:((p=r[0])==null?void 0:p.params)||{},nextUrl:new URL(e,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof x=="boolean")return x}return!0}):[]}function n4(e,t,{includeHydrateFallback:r}={}){return a4(e.map(s=>{let n=t.routes[s.route.id];if(!n)return[];let l=[n.module];return n.clientActionModule&&(l=l.concat(n.clientActionModule)),n.clientLoaderModule&&(l=l.concat(n.clientLoaderModule)),r&&n.hydrateFallbackModule&&(l=l.concat(n.hydrateFallbackModule)),n.imports&&(l=l.concat(n.imports)),l}).flat(1))}function a4(e){return[...new Set(e)]}function o4(e){let t={},r=Object.keys(e).sort();for(let s of r)t[s]=e[s];return t}function l4(e,t){let r=new Set;return new Set(t),e.reduce((s,n)=>{let l=JSON.stringify(o4(n));return r.has(l)||(r.add(l),s.push({key:l,link:n})),s},[])}function y0(){let e=g.useContext(gc);return x0(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function c4(){let e=g.useContext(xm);return x0(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var b0=g.createContext(void 0);b0.displayName="FrameworkContext";function wm(){let e=g.useContext(b0);return x0(e,"You must render this element inside a <HydratedRouter> element"),e}function u4(e,t){let r=g.useContext(b0),[s,n]=g.useState(!1),[l,u]=g.useState(!1),{onFocus:d,onBlur:m,onMouseEnter:f,onMouseLeave:v,onTouchStart:p}=t,x=g.useRef(null);g.useEffect(()=>{if(e==="render"&&u(!0),e==="viewport"){let C=S=>{S.forEach(E=>{u(E.isIntersecting)})},k=new IntersectionObserver(C,{threshold:.5});return x.current&&k.observe(x.current),()=>{k.disconnect()}}},[e]),g.useEffect(()=>{if(s){let C=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(C)}}},[s]);let b=()=>{n(!0)},w=()=>{n(!1),u(!1)};return r?e!=="intent"?[l,x,{}]:[l,x,{onFocus:vu(d,b),onBlur:vu(m,w),onMouseEnter:vu(f,b),onMouseLeave:vu(v,w),onTouchStart:vu(p,b)}]:[!1,x,{}]}function vu(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function d4({page:e,...t}){let r=CL(),{nonce:s}=wm(),{router:n}=y0(),l=g.useMemo(()=>Ok(n.routes,e,n.basename),[n.routes,e,n.basename]);return l?(t.nonce==null&&s&&(t={...t,nonce:s}),r?g.createElement(f4,{page:e,matches:l,...t}):g.createElement(m4,{page:e,matches:l,...t})):null}function h4(e){let{manifest:t,routeModules:r}=wm(),[s,n]=g.useState([]);return g.useEffect(()=>{let l=!1;return i4(e,t,r).then(u=>{l||n(u)}),()=>{l=!0}},[e,t,r]),s}function f4({page:e,matches:t,...r}){let s=Xr(),{future:n}=wm(),{basename:l}=y0(),u=g.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let d=Jk(e,l,n.v8_trailingSlashAwareDataRequests,"rsc"),m=!1,f=[];for(let v of t)typeof v.route.shouldRevalidate=="function"?m=!0:f.push(v.route.id);return m&&f.length>0&&d.searchParams.set("_routes",f.join(",")),[d.pathname+d.search]},[l,n.v8_trailingSlashAwareDataRequests,e,s,t]);return g.createElement(g.Fragment,null,u.map(d=>g.createElement("link",{key:d,rel:"prefetch",as:"fetch",href:d,...r})))}function m4({page:e,matches:t,...r}){let s=Xr(),{future:n,manifest:l,routeModules:u}=wm(),{basename:d}=y0(),{loaderData:m,matches:f}=c4(),v=g.useMemo(()=>QS(e,t,f,l,s,"data"),[e,t,f,l,s]),p=g.useMemo(()=>QS(e,t,f,l,s,"assets"),[e,t,f,l,s]),x=g.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let C=new Set,k=!1;if(t.forEach(E=>{var R;let N=l.routes[E.route.id];!N||!N.hasLoader||(!v.some(A=>A.route.id===E.route.id)&&E.route.id in m&&((R=u[E.route.id])!=null&&R.shouldRevalidate)||N.hasClientLoader?k=!0:C.add(E.route.id))}),C.size===0)return[];let S=Jk(e,d,n.v8_trailingSlashAwareDataRequests,"data");return k&&C.size>0&&S.searchParams.set("_routes",t.filter(E=>C.has(E.route.id)).map(E=>E.route.id).join(",")),[S.pathname+S.search]},[d,n.v8_trailingSlashAwareDataRequests,m,s,l,v,t,e,u]),b=g.useMemo(()=>n4(p,l),[p,l]),w=h4(p);return g.createElement(g.Fragment,null,x.map(C=>g.createElement("link",{key:C,rel:"prefetch",as:"fetch",href:C,...r})),b.map(C=>g.createElement("link",{key:C,rel:"modulepreload",href:C,...r})),w.map(({key:C,link:k})=>g.createElement("link",{key:C,nonce:r.nonce,...k,crossOrigin:k.crossOrigin??r.crossOrigin})))}function p4(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var g4=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{g4&&(window.__reactRouterVersion="7.18.1")}catch{}function v4({basename:e,children:t,useTransitions:r,window:s}){let n=g.useRef();n.current==null&&(n.current=XD({window:s,v5Compat:!0}));let l=n.current,[u,d]=g.useState({action:l.action,location:l.location}),m=g.useCallback(f=>{r===!1?d(f):g.startTransition(()=>d(f))},[r]);return g.useLayoutEffect(()=>l.listen(m),[l,m]),g.createElement(VL,{basename:e,children:t,location:u.location,navigationType:u.action,navigator:l,useTransitions:r})}var eE=g.forwardRef(function({onClick:t,discover:r="render",prefetch:s="none",relative:n,reloadDocument:l,replace:u,mask:d,state:m,target:f,to:v,preventScrollReset:p,viewTransition:x,defaultShouldRevalidate:b,...w},C){let{basename:k,navigator:S,useTransitions:E}=g.useContext(Ks),N=typeof v=="string"&&m0.test(v),R=Hk(v,k);v=R.to;let A=ML(v,{relative:n}),D=Xr(),B=null;if(d){let F=_m(d,[],D.mask?D.mask.pathname:"/",!0);k!=="/"&&(F.pathname=F.pathname==="/"?k:zi([k,F.pathname])),B=S.createHref(F)}let[$,q,Y]=u4(s,w),V=y4(v,{replace:u,mask:d,state:m,target:f,preventScrollReset:p,relative:n,viewTransition:x,defaultShouldRevalidate:b,useTransitions:E});function U(F){t&&t(F),F.defaultPrevented||V(F)}let L=!(R.isExternal||l),I=g.createElement("a",{...w,...Y,href:(L?B:void 0)||R.absoluteURL||A,onClick:L?U:t,ref:p4(C,q),target:f,"data-discover":!N&&r==="render"?"true":void 0});return $&&!N?g.createElement(g.Fragment,null,I,g.createElement(d4,{page:A})):I});eE.displayName="Link";var Ya=g.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:s="",end:n=!1,style:l,to:u,viewTransition:d,children:m,...f},v){let p=fd(u,{relative:f.relative}),x=Xr(),b=g.useContext(xm),{navigator:w,basename:C}=g.useContext(Ks),k=b!=null&&E4(p)&&d===!0,S=w.encodeLocation?w.encodeLocation(p).pathname:p.pathname,E=x.pathname,N=b&&b.navigation&&b.navigation.location?b.navigation.location.pathname:null;r||(E=E.toLowerCase(),N=N?N.toLowerCase():null,S=S.toLowerCase()),N&&C&&(N=ta(N,C)||N);const R=S!=="/"&&S.endsWith("/")?S.length-1:S.length;let A=E===S||!n&&E.startsWith(S)&&E.charAt(R)==="/",D=N!=null&&(N===S||!n&&N.startsWith(S)&&N.charAt(S.length)==="/"),B={isActive:A,isPending:D,isTransitioning:k},$=A?t:void 0,q;typeof s=="function"?q=s(B):q=[s,A?"active":null,D?"pending":null,k?"transitioning":null].filter(Boolean).join(" ");let Y=typeof l=="function"?l(B):l;return g.createElement(eE,{...f,"aria-current":$,className:q,ref:v,style:Y,to:u,viewTransition:d},typeof m=="function"?m(B):m)});Ya.displayName="NavLink";var _4=g.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:s,replace:n,state:l,method:u=wf,action:d,onSubmit:m,relative:f,preventScrollReset:v,viewTransition:p,defaultShouldRevalidate:x,...b},w)=>{let{useTransitions:C}=g.useContext(Ks),k=C4(),S=k4(d,{relative:f}),E=u.toLowerCase()==="get"?"get":"post",N=typeof d=="string"&&m0.test(d),R=A=>{if(m&&m(A),A.defaultPrevented)return;A.preventDefault();let D=A.nativeEvent.submitter,B=(D==null?void 0:D.getAttribute("formmethod"))||u,$=()=>k(D||A.currentTarget,{fetcherKey:t,method:B,navigate:r,replace:n,state:l,relative:f,preventScrollReset:v,viewTransition:p,defaultShouldRevalidate:x});C&&r!==!1?g.startTransition(()=>$()):$()};return g.createElement("form",{ref:w,method:E,action:S,onSubmit:s?m:R,...b,"data-discover":!N&&e==="render"?"true":void 0})});_4.displayName="Form";function x4(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function tE(e){let t=g.useContext(gc);return Rr(t,x4(e)),t}function y4(e,{target:t,replace:r,mask:s,state:n,preventScrollReset:l,relative:u,viewTransition:d,defaultShouldRevalidate:m,useTransitions:f}={}){let v=ao(),p=Xr(),x=fd(e,{relative:u});return g.useCallback(b=>{if(ZL(b,t)){b.preventDefault();let w=r!==void 0?r:Ku(p)===Ku(x),C=()=>v(e,{replace:w,mask:s,state:n,preventScrollReset:l,relative:u,viewTransition:d,defaultShouldRevalidate:m});f?g.startTransition(()=>C()):C()}},[p,v,x,r,s,n,t,e,l,u,d,m,f])}function b4(e){Ci(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=g.useRef(O_(e)),r=g.useRef(!1),s=Xr(),n=g.useMemo(()=>QL(s.search,r.current?null:t.current),[s.search]),l=ao(),u=g.useCallback((d,m)=>{const f=O_(typeof d=="function"?d(new URLSearchParams(n)):d);r.current=!0,l("?"+f,m)},[l,n]);return[n,u]}var w4=0,S4=()=>`__${String(++w4)}__`;function C4(){let{router:e}=tE("useSubmit"),{basename:t}=g.useContext(Ks),r=HL(),s=e.fetch,n=e.navigate;return g.useCallback(async(l,u={})=>{let{action:d,method:m,encType:f,formData:v,body:p}=t4(l,t);if(u.navigate===!1){let x=u.fetcherKey||S4();await s(x,r,u.action||d,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:v,body:p,formMethod:u.method||m,formEncType:u.encType||f,flushSync:u.flushSync})}else await n(u.action||d,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:v,body:p,formMethod:u.method||m,formEncType:u.encType||f,replace:u.replace,state:u.state,fromRouteId:r,flushSync:u.flushSync,viewTransition:u.viewTransition})},[s,n,t,r])}function k4(e,{relative:t}={}){let{basename:r}=g.useContext(Ks),s=g.useContext(Vi);Rr(s,"useFormAction must be used inside a RouteContext");let[n]=s.matches.slice(-1),l={...fd(e||".",{relative:t})},u=Xr();if(e==null){l.search=u.search;let d=new URLSearchParams(l.search),m=d.getAll("index");if(m.some(v=>v==="")){d.delete("index"),m.filter(p=>p).forEach(p=>d.append("index",p));let v=d.toString();l.search=v?`?${v}`:""}}return(!e||e===".")&&n.route.index&&(l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(l.pathname=l.pathname==="/"?r:zi([r,l.pathname])),Ku(l)}function E4(e,{relative:t}={}){let r=g.useContext(qk);Rr(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=tE("useViewTransitionState"),n=fd(e,{relative:t});if(!r.isTransitioning)return!1;let l=ta(r.currentLocation.pathname,s)||r.currentLocation.pathname,u=ta(r.nextLocation.pathname,s)||r.nextLocation.pathname;return Ff(n.pathname,u)!=null||Ff(n.pathname,l)!=null}/**
|
|
61
|
-
* @license lucide-react v0.475.0 - ISC
|
|
62
|
-
*
|
|
63
|
-
* This source code is licensed under the ISC license.
|
|
64
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
65
|
-
*/const R4=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),rE=(...e)=>e.filter((t,r,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===r).join(" ").trim();/**
|
|
66
|
-
* @license lucide-react v0.475.0 - ISC
|
|
67
|
-
*
|
|
68
|
-
* This source code is licensed under the ISC license.
|
|
69
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
70
|
-
*/var N4={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
71
|
-
* @license lucide-react v0.475.0 - ISC
|
|
72
|
-
*
|
|
73
|
-
* This source code is licensed under the ISC license.
|
|
74
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
75
|
-
*/const j4=g.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:s,className:n="",children:l,iconNode:u,...d},m)=>g.createElement("svg",{ref:m,...N4,width:t,height:t,stroke:e,strokeWidth:s?Number(r)*24/Number(t):r,className:rE("lucide",n),...d},[...u.map(([f,v])=>g.createElement(f,v)),...Array.isArray(l)?l:[l]]));/**
|
|
76
|
-
* @license lucide-react v0.475.0 - ISC
|
|
77
|
-
*
|
|
78
|
-
* This source code is licensed under the ISC license.
|
|
79
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
80
|
-
*/const ye=(e,t)=>{const r=g.forwardRef(({className:s,...n},l)=>g.createElement(j4,{ref:l,iconNode:t,className:rE(`lucide-${R4(e)}`,s),...n}));return r.displayName=`${e}`,r};/**
|
|
81
|
-
* @license lucide-react v0.475.0 - ISC
|
|
82
|
-
*
|
|
83
|
-
* This source code is licensed under the ISC license.
|
|
84
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
85
|
-
*/const A4=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Yo=ye("ArrowLeft",A4);/**
|
|
86
|
-
* @license lucide-react v0.475.0 - ISC
|
|
87
|
-
*
|
|
88
|
-
* This source code is licensed under the ISC license.
|
|
89
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
90
|
-
*/const M4=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],sE=ye("ArrowRight",M4);/**
|
|
91
|
-
* @license lucide-react v0.475.0 - ISC
|
|
92
|
-
*
|
|
93
|
-
* This source code is licensed under the ISC license.
|
|
94
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
95
|
-
*/const T4=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],Sm=ye("Bot",T4);/**
|
|
96
|
-
* @license lucide-react v0.475.0 - ISC
|
|
97
|
-
*
|
|
98
|
-
* This source code is licensed under the ISC license.
|
|
99
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
100
|
-
*/const D4=[["path",{d:"M17 21v-2a1 1 0 0 1-1-1v-1a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1",key:"10bnsj"}],["path",{d:"M19 15V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V9",key:"1eqmu1"}],["path",{d:"M21 21v-2h-4",key:"14zm7j"}],["path",{d:"M3 5h4V3",key:"z442eg"}],["path",{d:"M7 5a1 1 0 0 1 1 1v1a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1V3",key:"ebdjd7"}]],L4=ye("Cable",D4);/**
|
|
101
|
-
* @license lucide-react v0.475.0 - ISC
|
|
102
|
-
*
|
|
103
|
-
* This source code is licensed under the ISC license.
|
|
104
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
105
|
-
*/const O4=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Br=ye("Check",O4);/**
|
|
106
|
-
* @license lucide-react v0.475.0 - ISC
|
|
107
|
-
*
|
|
108
|
-
* This source code is licensed under the ISC license.
|
|
109
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
110
|
-
*/const B4=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],md=ye("ChevronDown",B4);/**
|
|
111
|
-
* @license lucide-react v0.475.0 - ISC
|
|
112
|
-
*
|
|
113
|
-
* This source code is licensed under the ISC license.
|
|
114
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
115
|
-
*/const P4=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],iE=ye("ChevronLeft",P4);/**
|
|
116
|
-
* @license lucide-react v0.475.0 - ISC
|
|
117
|
-
*
|
|
118
|
-
* This source code is licensed under the ISC license.
|
|
119
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
120
|
-
*/const I4=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],oo=ye("ChevronRight",I4);/**
|
|
121
|
-
* @license lucide-react v0.475.0 - ISC
|
|
122
|
-
*
|
|
123
|
-
* This source code is licensed under the ISC license.
|
|
124
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
125
|
-
*/const z4=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],$4=ye("ChevronUp",z4);/**
|
|
126
|
-
* @license lucide-react v0.475.0 - ISC
|
|
127
|
-
*
|
|
128
|
-
* This source code is licensed under the ISC license.
|
|
129
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
130
|
-
*/const U4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],_c=ye("CircleAlert",U4);/**
|
|
131
|
-
* @license lucide-react v0.475.0 - ISC
|
|
132
|
-
*
|
|
133
|
-
* This source code is licensed under the ISC license.
|
|
134
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
135
|
-
*/const H4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]],qu=ye("CircleArrowUp",H4);/**
|
|
136
|
-
* @license lucide-react v0.475.0 - ISC
|
|
137
|
-
*
|
|
138
|
-
* This source code is licensed under the ISC license.
|
|
139
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
140
|
-
*/const F4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],w0=ye("CircleCheck",F4);/**
|
|
141
|
-
* @license lucide-react v0.475.0 - ISC
|
|
142
|
-
*
|
|
143
|
-
* This source code is licensed under the ISC license.
|
|
144
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
145
|
-
*/const W4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],q4=ye("CircleHelp",W4);/**
|
|
146
|
-
* @license lucide-react v0.475.0 - ISC
|
|
147
|
-
*
|
|
148
|
-
* This source code is licensed under the ISC license.
|
|
149
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
150
|
-
*/const V4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]],G4=ye("CircleSlash",V4);/**
|
|
151
|
-
* @license lucide-react v0.475.0 - ISC
|
|
152
|
-
*
|
|
153
|
-
* This source code is licensed under the ISC license.
|
|
154
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
155
|
-
*/const Y4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],nE=ye("CircleStop",Y4);/**
|
|
156
|
-
* @license lucide-react v0.475.0 - ISC
|
|
157
|
-
*
|
|
158
|
-
* This source code is licensed under the ISC license.
|
|
159
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
160
|
-
*/const K4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],X4=ye("CircleX",K4);/**
|
|
161
|
-
* @license lucide-react v0.475.0 - ISC
|
|
162
|
-
*
|
|
163
|
-
* This source code is licensed under the ISC license.
|
|
164
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
165
|
-
*/const Z4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Q4=ye("Circle",Z4);/**
|
|
166
|
-
* @license lucide-react v0.475.0 - ISC
|
|
167
|
-
*
|
|
168
|
-
* This source code is licensed under the ISC license.
|
|
169
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
170
|
-
*/const J4=[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]],S0=ye("Command",J4);/**
|
|
171
|
-
* @license lucide-react v0.475.0 - ISC
|
|
172
|
-
*
|
|
173
|
-
* This source code is licensed under the ISC license.
|
|
174
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
175
|
-
*/const eO=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],C0=ye("Copy",eO);/**
|
|
176
|
-
* @license lucide-react v0.475.0 - ISC
|
|
177
|
-
*
|
|
178
|
-
* This source code is licensed under the ISC license.
|
|
179
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
180
|
-
*/const tO=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]],pd=ye("Download",tO);/**
|
|
181
|
-
* @license lucide-react v0.475.0 - ISC
|
|
182
|
-
*
|
|
183
|
-
* This source code is licensed under the ISC license.
|
|
184
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
185
|
-
*/const rO=[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Xu=ye("Earth",rO);/**
|
|
186
|
-
* @license lucide-react v0.475.0 - ISC
|
|
187
|
-
*
|
|
188
|
-
* This source code is licensed under the ISC license.
|
|
189
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
190
|
-
*/const sO=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],iO=ye("Ellipsis",sO);/**
|
|
191
|
-
* @license lucide-react v0.475.0 - ISC
|
|
192
|
-
*
|
|
193
|
-
* This source code is licensed under the ISC license.
|
|
194
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
195
|
-
*/const nO=[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]],aO=ye("Eraser",nO);/**
|
|
196
|
-
* @license lucide-react v0.475.0 - ISC
|
|
197
|
-
*
|
|
198
|
-
* This source code is licensed under the ISC license.
|
|
199
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
200
|
-
*/const oO=[["path",{d:"m15 15 6 6",key:"1s409w"}],["path",{d:"m15 9 6-6",key:"ko1vev"}],["path",{d:"M21 16.2V21h-4.8",key:"1hrera"}],["path",{d:"M21 7.8V3h-4.8",key:"ul1q53"}],["path",{d:"M3 16.2V21h4.8",key:"1x04uo"}],["path",{d:"m3 21 6-6",key:"wwnumi"}],["path",{d:"M3 7.8V3h4.8",key:"1ijppm"}],["path",{d:"M9 9 3 3",key:"v551iv"}]],lO=ye("Expand",oO);/**
|
|
201
|
-
* @license lucide-react v0.475.0 - ISC
|
|
202
|
-
*
|
|
203
|
-
* This source code is licensed under the ISC license.
|
|
204
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
205
|
-
*/const cO=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],B_=ye("ExternalLink",cO);/**
|
|
206
|
-
* @license lucide-react v0.475.0 - ISC
|
|
207
|
-
*
|
|
208
|
-
* This source code is licensed under the ISC license.
|
|
209
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
210
|
-
*/const uO=[["path",{d:"M10 12v-1",key:"v7bkov"}],["path",{d:"M10 18v-2",key:"1cjy8d"}],["path",{d:"M10 7V6",key:"dljcrl"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 .274 1.01",key:"gkbcor"}],["circle",{cx:"10",cy:"20",r:"2",key:"1xzdoj"}]],aE=ye("FileArchive",uO);/**
|
|
211
|
-
* @license lucide-react v0.475.0 - ISC
|
|
212
|
-
*
|
|
213
|
-
* This source code is licensed under the ISC license.
|
|
214
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
215
|
-
*/const dO=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],oE=ye("FileText",dO);/**
|
|
216
|
-
* @license lucide-react v0.475.0 - ISC
|
|
217
|
-
*
|
|
218
|
-
* This source code is licensed under the ISC license.
|
|
219
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
220
|
-
*/const hO=[["path",{d:"M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4",key:"1nerag"}],["path",{d:"M14 13.12c0 2.38 0 6.38-1 8.88",key:"o46ks0"}],["path",{d:"M17.29 21.02c.12-.6.43-2.3.5-3.02",key:"ptglia"}],["path",{d:"M2 12a10 10 0 0 1 18-6",key:"ydlgp0"}],["path",{d:"M2 16h.01",key:"1gqxmh"}],["path",{d:"M21.8 16c.2-2 .131-5.354 0-6",key:"drycrb"}],["path",{d:"M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2",key:"1tidbn"}],["path",{d:"M8.65 22c.21-.66.45-1.32.57-2",key:"13wd9y"}],["path",{d:"M9 6.8a6 6 0 0 1 9 5.2v2",key:"1fr1j5"}]],fO=ye("Fingerprint",hO);/**
|
|
221
|
-
* @license lucide-react v0.475.0 - ISC
|
|
222
|
-
*
|
|
223
|
-
* This source code is licensed under the ISC license.
|
|
224
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
225
|
-
*/const mO=[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]],pO=ye("FolderKanban",mO);/**
|
|
226
|
-
* @license lucide-react v0.475.0 - ISC
|
|
227
|
-
*
|
|
228
|
-
* This source code is licensed under the ISC license.
|
|
229
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
230
|
-
*/const gO=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],P_=ye("FolderOpen",gO);/**
|
|
231
|
-
* @license lucide-react v0.475.0 - ISC
|
|
232
|
-
*
|
|
233
|
-
* This source code is licensed under the ISC license.
|
|
234
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
235
|
-
*/const vO=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],JS=ye("FolderPlus",vO);/**
|
|
236
|
-
* @license lucide-react v0.475.0 - ISC
|
|
237
|
-
*
|
|
238
|
-
* This source code is licensed under the ISC license.
|
|
239
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
240
|
-
*/const _O=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],qf=ye("Folder",_O);/**
|
|
241
|
-
* @license lucide-react v0.475.0 - ISC
|
|
242
|
-
*
|
|
243
|
-
* This source code is licensed under the ISC license.
|
|
244
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
245
|
-
*/const xO=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],yO=ye("GitBranch",xO);/**
|
|
246
|
-
* @license lucide-react v0.475.0 - ISC
|
|
247
|
-
*
|
|
248
|
-
* This source code is licensed under the ISC license.
|
|
249
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
250
|
-
*/const bO=[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]],wO=ye("GitFork",bO);/**
|
|
251
|
-
* @license lucide-react v0.475.0 - ISC
|
|
252
|
-
*
|
|
253
|
-
* This source code is licensed under the ISC license.
|
|
254
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
255
|
-
*/const SO=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],CO=ye("HardDrive",SO);/**
|
|
256
|
-
* @license lucide-react v0.475.0 - ISC
|
|
257
|
-
*
|
|
258
|
-
* This source code is licensed under the ISC license.
|
|
259
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
260
|
-
*/const kO=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]],lE=ye("House",kO);/**
|
|
261
|
-
* @license lucide-react v0.475.0 - ISC
|
|
262
|
-
*
|
|
263
|
-
* This source code is licensed under the ISC license.
|
|
264
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
265
|
-
*/const EO=[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M10.41 10.41a2 2 0 1 1-2.83-2.83",key:"1bzlo9"}],["line",{x1:"13.5",x2:"6",y1:"13.5",y2:"21",key:"1q0aeu"}],["line",{x1:"18",x2:"21",y1:"12",y2:"15",key:"5mozeu"}],["path",{d:"M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59",key:"mmje98"}],["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}]],RO=ye("ImageOff",EO);/**
|
|
266
|
-
* @license lucide-react v0.475.0 - ISC
|
|
267
|
-
*
|
|
268
|
-
* This source code is licensed under the ISC license.
|
|
269
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
270
|
-
*/const NO=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],jO=ye("Image",NO);/**
|
|
271
|
-
* @license lucide-react v0.475.0 - ISC
|
|
272
|
-
*
|
|
273
|
-
* This source code is licensed under the ISC license.
|
|
274
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
275
|
-
*/const AO=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],MO=ye("KeyRound",AO);/**
|
|
276
|
-
* @license lucide-react v0.475.0 - ISC
|
|
277
|
-
*
|
|
278
|
-
* This source code is licensed under the ISC license.
|
|
279
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
280
|
-
*/const TO=[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]],cE=ye("Laptop",TO);/**
|
|
281
|
-
* @license lucide-react v0.475.0 - ISC
|
|
282
|
-
*
|
|
283
|
-
* This source code is licensed under the ISC license.
|
|
284
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
285
|
-
*/const DO=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],LO=ye("LayoutDashboard",DO);/**
|
|
286
|
-
* @license lucide-react v0.475.0 - ISC
|
|
287
|
-
*
|
|
288
|
-
* This source code is licensed under the ISC license.
|
|
289
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
290
|
-
*/const OO=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],BO=ye("Link2",OO);/**
|
|
291
|
-
* @license lucide-react v0.475.0 - ISC
|
|
292
|
-
*
|
|
293
|
-
* This source code is licensed under the ISC license.
|
|
294
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
295
|
-
*/const PO=[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]],IO=ye("ListChecks",PO);/**
|
|
296
|
-
* @license lucide-react v0.475.0 - ISC
|
|
297
|
-
*
|
|
298
|
-
* This source code is licensed under the ISC license.
|
|
299
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
300
|
-
*/const zO=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],ze=ye("LoaderCircle",zO);/**
|
|
301
|
-
* @license lucide-react v0.475.0 - ISC
|
|
302
|
-
*
|
|
303
|
-
* This source code is licensed under the ISC license.
|
|
304
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
305
|
-
*/const $O=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],UO=ye("MapPin",$O);/**
|
|
306
|
-
* @license lucide-react v0.475.0 - ISC
|
|
307
|
-
*
|
|
308
|
-
* This source code is licensed under the ISC license.
|
|
309
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
310
|
-
*/const HO=[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]],FO=ye("MessageSquare",HO);/**
|
|
311
|
-
* @license lucide-react v0.475.0 - ISC
|
|
312
|
-
*
|
|
313
|
-
* This source code is licensed under the ISC license.
|
|
314
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
315
|
-
*/const WO=[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8",key:"10dyio"}],["path",{d:"M10 19v-3.96 3.15",key:"1irgej"}],["path",{d:"M7 19h5",key:"qswx4l"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2",key:"1egngj"}]],Vf=ye("MonitorSmartphone",WO);/**
|
|
316
|
-
* @license lucide-react v0.475.0 - ISC
|
|
317
|
-
*
|
|
318
|
-
* This source code is licensed under the ISC license.
|
|
319
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
320
|
-
*/const qO=[["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}],["path",{d:"M12 13V7",key:"h0r20n"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]],VO=ye("MonitorUp",qO);/**
|
|
321
|
-
* @license lucide-react v0.475.0 - ISC
|
|
322
|
-
*
|
|
323
|
-
* This source code is licensed under the ISC license.
|
|
324
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
325
|
-
*/const GO=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],uE=ye("Monitor",GO);/**
|
|
326
|
-
* @license lucide-react v0.475.0 - ISC
|
|
327
|
-
*
|
|
328
|
-
* This source code is licensed under the ISC license.
|
|
329
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
330
|
-
*/const YO=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],KO=ye("Moon",YO);/**
|
|
331
|
-
* @license lucide-react v0.475.0 - ISC
|
|
332
|
-
*
|
|
333
|
-
* This source code is licensed under the ISC license.
|
|
334
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
335
|
-
*/const XO=[["path",{d:"M2.034 2.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.944L8.204 7.545a1 1 0 0 0-.66.66l-1.066 3.443a.5.5 0 0 1-.944.033z",key:"11pp1i"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}],["path",{d:"m11.8 11.8 8.4 8.4",key:"oogvdj"}]],eC=ye("MousePointerBan",XO);/**
|
|
336
|
-
* @license lucide-react v0.475.0 - ISC
|
|
337
|
-
*
|
|
338
|
-
* This source code is licensed under the ISC license.
|
|
339
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
340
|
-
*/const ZO=[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]],QO=ye("MousePointerClick",ZO);/**
|
|
341
|
-
* @license lucide-react v0.475.0 - ISC
|
|
342
|
-
*
|
|
343
|
-
* This source code is licensed under the ISC license.
|
|
344
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
345
|
-
*/const JO=[["path",{d:"M16 16h6",key:"100bgy"}],["path",{d:"M19 13v6",key:"85cyf1"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]],e6=ye("PackagePlus",JO);/**
|
|
346
|
-
* @license lucide-react v0.475.0 - ISC
|
|
347
|
-
*
|
|
348
|
-
* This source code is licensed under the ISC license.
|
|
349
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
350
|
-
*/const t6=[["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["circle",{cx:"18.5",cy:"15.5",r:"2.5",key:"b5zd12"}],["path",{d:"M20.27 17.27 22 19",key:"1l4muz"}]],tC=ye("PackageSearch",t6);/**
|
|
351
|
-
* @license lucide-react v0.475.0 - ISC
|
|
352
|
-
*
|
|
353
|
-
* This source code is licensed under the ISC license.
|
|
354
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
355
|
-
*/const r6=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],s6=ye("PanelLeftClose",r6);/**
|
|
356
|
-
* @license lucide-react v0.475.0 - ISC
|
|
357
|
-
*
|
|
358
|
-
* This source code is licensed under the ISC license.
|
|
359
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
360
|
-
*/const i6=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],dE=ye("PanelLeftOpen",i6);/**
|
|
361
|
-
* @license lucide-react v0.475.0 - ISC
|
|
362
|
-
*
|
|
363
|
-
* This source code is licensed under the ISC license.
|
|
364
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
365
|
-
*/const n6=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],a6=ye("PanelRightClose",n6);/**
|
|
366
|
-
* @license lucide-react v0.475.0 - ISC
|
|
367
|
-
*
|
|
368
|
-
* This source code is licensed under the ISC license.
|
|
369
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
370
|
-
*/const o6=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],l6=ye("PanelRightOpen",o6);/**
|
|
371
|
-
* @license lucide-react v0.475.0 - ISC
|
|
372
|
-
*
|
|
373
|
-
* This source code is licensed under the ISC license.
|
|
374
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
375
|
-
*/const c6=[["path",{d:"M13.234 20.252 21 12.3",key:"1cbrk9"}],["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486",key:"1pkts6"}]],u6=ye("Paperclip",c6);/**
|
|
376
|
-
* @license lucide-react v0.475.0 - ISC
|
|
377
|
-
*
|
|
378
|
-
* This source code is licensed under the ISC license.
|
|
379
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
380
|
-
*/const d6=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],hE=ye("Pencil",d6);/**
|
|
381
|
-
* @license lucide-react v0.475.0 - ISC
|
|
382
|
-
*
|
|
383
|
-
* This source code is licensed under the ISC license.
|
|
384
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
385
|
-
*/const h6=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],f6=ye("Play",h6);/**
|
|
386
|
-
* @license lucide-react v0.475.0 - ISC
|
|
387
|
-
*
|
|
388
|
-
* This source code is licensed under the ISC license.
|
|
389
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
390
|
-
*/const m6=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ls=ye("Plus",m6);/**
|
|
391
|
-
* @license lucide-react v0.475.0 - ISC
|
|
392
|
-
*
|
|
393
|
-
* This source code is licensed under the ISC license.
|
|
394
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
395
|
-
*/const p6=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],I_=ye("Power",p6);/**
|
|
396
|
-
* @license lucide-react v0.475.0 - ISC
|
|
397
|
-
*
|
|
398
|
-
* This source code is licensed under the ISC license.
|
|
399
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
400
|
-
*/const g6=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],Cm=ye("Puzzle",g6);/**
|
|
401
|
-
* @license lucide-react v0.475.0 - ISC
|
|
402
|
-
*
|
|
403
|
-
* This source code is licensed under the ISC license.
|
|
404
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
405
|
-
*/const v6=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],_t=ye("RefreshCw",v6);/**
|
|
406
|
-
* @license lucide-react v0.475.0 - ISC
|
|
407
|
-
*
|
|
408
|
-
* This source code is licensed under the ISC license.
|
|
409
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
410
|
-
*/const _6=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],x6=ye("RotateCw",_6);/**
|
|
411
|
-
* @license lucide-react v0.475.0 - ISC
|
|
412
|
-
*
|
|
413
|
-
* This source code is licensed under the ISC license.
|
|
414
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
415
|
-
*/const y6=[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]],b6=ye("ScanEye",y6);/**
|
|
416
|
-
* @license lucide-react v0.475.0 - ISC
|
|
417
|
-
*
|
|
418
|
-
* This source code is licensed under the ISC license.
|
|
419
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
420
|
-
*/const w6=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],fE=ye("Search",w6);/**
|
|
421
|
-
* @license lucide-react v0.475.0 - ISC
|
|
422
|
-
*
|
|
423
|
-
* This source code is licensed under the ISC license.
|
|
424
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
425
|
-
*/const S6=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],mE=ye("Send",S6);/**
|
|
426
|
-
* @license lucide-react v0.475.0 - ISC
|
|
427
|
-
*
|
|
428
|
-
* This source code is licensed under the ISC license.
|
|
429
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
430
|
-
*/const C6=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],km=ye("Server",C6);/**
|
|
431
|
-
* @license lucide-react v0.475.0 - ISC
|
|
432
|
-
*
|
|
433
|
-
* This source code is licensed under the ISC license.
|
|
434
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
435
|
-
*/const k6=[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],E6=ye("Settings2",k6);/**
|
|
436
|
-
* @license lucide-react v0.475.0 - ISC
|
|
437
|
-
*
|
|
438
|
-
* This source code is licensed under the ISC license.
|
|
439
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
440
|
-
*/const R6=[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],N6=ye("Settings",R6);/**
|
|
441
|
-
* @license lucide-react v0.475.0 - ISC
|
|
442
|
-
*
|
|
443
|
-
* This source code is licensed under the ISC license.
|
|
444
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
445
|
-
*/const j6=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],A6=ye("Share2",j6);/**
|
|
446
|
-
* @license lucide-react v0.475.0 - ISC
|
|
447
|
-
*
|
|
448
|
-
* This source code is licensed under the ISC license.
|
|
449
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
450
|
-
*/const M6=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],T6=ye("ShieldAlert",M6);/**
|
|
451
|
-
* @license lucide-react v0.475.0 - ISC
|
|
452
|
-
*
|
|
453
|
-
* This source code is licensed under the ISC license.
|
|
454
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
455
|
-
*/const D6=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Gf=ye("ShieldCheck",D6);/**
|
|
456
|
-
* @license lucide-react v0.475.0 - ISC
|
|
457
|
-
*
|
|
458
|
-
* This source code is licensed under the ISC license.
|
|
459
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
460
|
-
*/const L6=[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]],k0=ye("ShieldOff",L6);/**
|
|
461
|
-
* @license lucide-react v0.475.0 - ISC
|
|
462
|
-
*
|
|
463
|
-
* This source code is licensed under the ISC license.
|
|
464
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
465
|
-
*/const O6=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],B6=ye("Shield",O6);/**
|
|
466
|
-
* @license lucide-react v0.475.0 - ISC
|
|
467
|
-
*
|
|
468
|
-
* This source code is licensed under the ISC license.
|
|
469
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
470
|
-
*/const P6=[["path",{d:"m15 15 6 6m-6-6v4.8m0-4.8h4.8",key:"17vawe"}],["path",{d:"M9 19.8V15m0 0H4.2M9 15l-6 6",key:"chjx8e"}],["path",{d:"M15 4.2V9m0 0h4.8M15 9l6-6",key:"lav6yq"}],["path",{d:"M9 4.2V9m0 0H4.2M9 9 3 3",key:"1pxi2q"}]],I6=ye("Shrink",P6);/**
|
|
471
|
-
* @license lucide-react v0.475.0 - ISC
|
|
472
|
-
*
|
|
473
|
-
* This source code is licensed under the ISC license.
|
|
474
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
475
|
-
*/const z6=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],uc=ye("Smartphone",z6);/**
|
|
476
|
-
* @license lucide-react v0.475.0 - ISC
|
|
477
|
-
*
|
|
478
|
-
* This source code is licensed under the ISC license.
|
|
479
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
480
|
-
*/const $6=[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]],pE=ye("Sparkles",$6);/**
|
|
481
|
-
* @license lucide-react v0.475.0 - ISC
|
|
482
|
-
*
|
|
483
|
-
* This source code is licensed under the ISC license.
|
|
484
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
485
|
-
*/const U6=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],gE=ye("SquareTerminal",U6);/**
|
|
486
|
-
* @license lucide-react v0.475.0 - ISC
|
|
487
|
-
*
|
|
488
|
-
* This source code is licensed under the ISC license.
|
|
489
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
490
|
-
*/const H6=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],F6=ye("Square",H6);/**
|
|
491
|
-
* @license lucide-react v0.475.0 - ISC
|
|
492
|
-
*
|
|
493
|
-
* This source code is licensed under the ISC license.
|
|
494
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
495
|
-
*/const W6=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],vE=ye("Star",W6);/**
|
|
496
|
-
* @license lucide-react v0.475.0 - ISC
|
|
497
|
-
*
|
|
498
|
-
* This source code is licensed under the ISC license.
|
|
499
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
500
|
-
*/const q6=[["path",{d:"m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7",key:"ztvudi"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["path",{d:"M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4",key:"2ebpfo"}],["path",{d:"M2 7h20",key:"1fcdvo"}],["path",{d:"M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7",key:"6c3vgh"}]],Yf=ye("Store",q6);/**
|
|
501
|
-
* @license lucide-react v0.475.0 - ISC
|
|
502
|
-
*
|
|
503
|
-
* This source code is licensed under the ISC license.
|
|
504
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
505
|
-
*/const V6=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],G6=ye("Sun",V6);/**
|
|
506
|
-
* @license lucide-react v0.475.0 - ISC
|
|
507
|
-
*
|
|
508
|
-
* This source code is licensed under the ISC license.
|
|
509
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
510
|
-
*/const Y6=[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]],K6=ye("Terminal",Y6);/**
|
|
511
|
-
* @license lucide-react v0.475.0 - ISC
|
|
512
|
-
*
|
|
513
|
-
* This source code is licensed under the ISC license.
|
|
514
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
515
|
-
*/const X6=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]],lo=ye("Trash2",X6);/**
|
|
516
|
-
* @license lucide-react v0.475.0 - ISC
|
|
517
|
-
*
|
|
518
|
-
* This source code is licensed under the ISC license.
|
|
519
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
520
|
-
*/const Z6=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],bi=ye("TriangleAlert",Z6);/**
|
|
521
|
-
* @license lucide-react v0.475.0 - ISC
|
|
522
|
-
*
|
|
523
|
-
* This source code is licensed under the ISC license.
|
|
524
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
525
|
-
*/const Q6=[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]],J6=ye("Unlink",Q6);/**
|
|
526
|
-
* @license lucide-react v0.475.0 - ISC
|
|
527
|
-
*
|
|
528
|
-
* This source code is licensed under the ISC license.
|
|
529
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
530
|
-
*/const eB=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],tB=ye("Workflow",eB);/**
|
|
531
|
-
* @license lucide-react v0.475.0 - ISC
|
|
532
|
-
*
|
|
533
|
-
* This source code is licensed under the ISC license.
|
|
534
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
535
|
-
*/const rB=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],_n=ye("X",rB);var na=Dk();const sB=Tk(na);function iB(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}const nB=e=>{switch(e){case"success":return lB;case"info":return uB;case"warning":return cB;case"error":return dB;default:return null}},aB=Array(12).fill(0),oB=({visible:e,className:t})=>Se.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},Se.createElement("div",{className:"sonner-spinner"},aB.map((r,s)=>Se.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),lB=Se.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Se.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),cB=Se.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},Se.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),uB=Se.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Se.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),dB=Se.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Se.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),hB=Se.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},Se.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Se.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),fB=()=>{const[e,t]=Se.useState(document.hidden);return Se.useEffect(()=>{const r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e};let z_=1;class mB{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const r=this.subscribers.indexOf(t);this.subscribers.splice(r,1)}),this.publish=t=>{this.subscribers.forEach(r=>r(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var r;const{message:s,...n}=t,l=typeof(t==null?void 0:t.id)=="number"||((r=t.id)==null?void 0:r.length)>0?t.id:z_++,u=this.toasts.find(m=>m.id===l),d=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(l)&&this.dismissedToasts.delete(l),u?this.toasts=this.toasts.map(m=>m.id===l?(this.publish({...m,...t,id:l,title:s}),{...m,...t,id:l,dismissible:d,title:s}):m):this.addToast({title:s,...n,dismissible:d,id:l}),l},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:t,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(s=>s({id:r.id,dismiss:!0}))}),t),this.message=(t,r)=>this.create({...r,message:t}),this.error=(t,r)=>this.create({...r,message:t,type:"error"}),this.success=(t,r)=>this.create({...r,type:"success",message:t}),this.info=(t,r)=>this.create({...r,type:"info",message:t}),this.warning=(t,r)=>this.create({...r,type:"warning",message:t}),this.loading=(t,r)=>this.create({...r,type:"loading",message:t}),this.promise=(t,r)=>{if(!r)return;let s;r.loading!==void 0&&(s=this.create({...r,promise:t,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const n=Promise.resolve(t instanceof Function?t():t);let l=s!==void 0,u;const d=n.then(async f=>{if(u=["resolve",f],Se.isValidElement(f))l=!1,this.create({id:s,type:"default",message:f});else if(gB(f)&&!f.ok){l=!1;const p=typeof r.error=="function"?await r.error(`HTTP error! status: ${f.status}`):r.error,x=typeof r.description=="function"?await r.description(`HTTP error! status: ${f.status}`):r.description,w=typeof p=="object"&&!Se.isValidElement(p)?p:{message:p};this.create({id:s,type:"error",description:x,...w})}else if(f instanceof Error){l=!1;const p=typeof r.error=="function"?await r.error(f):r.error,x=typeof r.description=="function"?await r.description(f):r.description,w=typeof p=="object"&&!Se.isValidElement(p)?p:{message:p};this.create({id:s,type:"error",description:x,...w})}else if(r.success!==void 0){l=!1;const p=typeof r.success=="function"?await r.success(f):r.success,x=typeof r.description=="function"?await r.description(f):r.description,w=typeof p=="object"&&!Se.isValidElement(p)?p:{message:p};this.create({id:s,type:"success",description:x,...w})}}).catch(async f=>{if(u=["reject",f],r.error!==void 0){l=!1;const v=typeof r.error=="function"?await r.error(f):r.error,p=typeof r.description=="function"?await r.description(f):r.description,b=typeof v=="object"&&!Se.isValidElement(v)?v:{message:v};this.create({id:s,type:"error",description:p,...b})}}).finally(()=>{l&&(this.dismiss(s),s=void 0),r.finally==null||r.finally.call(r)}),m=()=>new Promise((f,v)=>d.then(()=>u[0]==="reject"?v(u[1]):f(u[1])).catch(v));return typeof s!="string"&&typeof s!="number"?{unwrap:m}:Object.assign(s,{unwrap:m})},this.custom=(t,r)=>{const s=(r==null?void 0:r.id)||z_++;return this.create({jsx:t(s),id:s,...r}),s},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Ms=new mB,pB=(e,t)=>{const r=(t==null?void 0:t.id)||z_++;return Ms.addToast({title:e,...t,id:r}),r},gB=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",vB=pB,_B=()=>Ms.toasts,xB=()=>Ms.getActiveToasts(),pe=Object.assign(vB,{success:Ms.success,info:Ms.info,warning:Ms.warning,error:Ms.error,custom:Ms.custom,message:Ms.message,promise:Ms.promise,dismiss:Ms.dismiss,loading:Ms.loading},{getHistory:_B,getToasts:xB});iB("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Wh(e){return e.label!==void 0}const yB=3,bB="24px",wB="16px",rC=4e3,SB=356,CB=14,kB=45,EB=200;function tn(...e){return e.filter(Boolean).join(" ")}function RB(e){const[t,r]=e.split("-"),s=[];return t&&s.push(t),r&&s.push(r),s}const NB=e=>{var t,r,s,n,l,u,d,m,f;const{invert:v,toast:p,unstyled:x,interacting:b,setHeights:w,visibleToasts:C,heights:k,index:S,toasts:E,expanded:N,removeToast:R,defaultRichColors:A,closeButton:D,style:B,cancelButtonStyle:$,actionButtonStyle:q,className:Y="",descriptionClassName:V="",duration:U,position:L,gap:I,expandByDefault:F,classNames:M,icons:P,closeButtonAriaLabel:O="Close toast"}=e,[W,H]=Se.useState(null),[T,G]=Se.useState(null),[X,ee]=Se.useState(!1),[oe,de]=Se.useState(!1),[Z,ce]=Se.useState(!1),[le,be]=Se.useState(!1),[ke,Ee]=Se.useState(!1),[te,re]=Se.useState(0),[Ce,De]=Se.useState(0),_e=Se.useRef(p.duration||U||rC),Re=Se.useRef(null),Pe=Se.useRef(null),Ue=S===0,qe=S+1<=C,Ie=p.type,Ve=p.dismissible!==!1,ct=p.className||"",Qr=p.descriptionClassName||"",Ct=Se.useMemo(()=>k.findIndex(Fe=>Fe.toastId===p.id)||0,[k,p.id]),Nr=Se.useMemo(()=>{var Fe;return(Fe=p.closeButton)!=null?Fe:D},[p.closeButton,D]),cs=Se.useMemo(()=>p.duration||U||rC,[p.duration,U]),tr=Se.useRef(0),kt=Se.useRef(0),Ge=Se.useRef(0),Et=Se.useRef(null),[us,zt]=L.split("-"),ds=Se.useMemo(()=>k.reduce((Fe,wt,Gt)=>Gt>=Ct?Fe:Fe+wt.height,0),[k,Ct]),Vt=fB(),Le=p.invert||v,Ze=Ie==="loading";kt.current=Se.useMemo(()=>Ct*I+ds,[Ct,ds]),Se.useEffect(()=>{_e.current=cs},[cs]),Se.useEffect(()=>{ee(!0)},[]),Se.useEffect(()=>{const Fe=Pe.current;if(Fe){const wt=Fe.getBoundingClientRect().height;return De(wt),w(Gt=>[{toastId:p.id,height:wt,position:p.position},...Gt]),()=>w(Gt=>Gt.filter(sr=>sr.toastId!==p.id))}},[w,p.id]),Se.useLayoutEffect(()=>{if(!X)return;const Fe=Pe.current,wt=Fe.style.height;Fe.style.height="auto";const Gt=Fe.getBoundingClientRect().height;Fe.style.height=wt,De(Gt),w(sr=>sr.find(rt=>rt.toastId===p.id)?sr.map(rt=>rt.toastId===p.id?{...rt,height:Gt}:rt):[{toastId:p.id,height:Gt,position:p.position},...sr])},[X,p.title,p.description,w,p.id,p.jsx,p.action,p.cancel]);const He=Se.useCallback(()=>{de(!0),re(kt.current),w(Fe=>Fe.filter(wt=>wt.toastId!==p.id)),setTimeout(()=>{R(p)},EB)},[p,R,w,kt]);Se.useEffect(()=>{if(p.promise&&Ie==="loading"||p.duration===1/0||p.type==="loading")return;let Fe;return N||b||Vt?(()=>{if(Ge.current<tr.current){const sr=new Date().getTime()-tr.current;_e.current=_e.current-sr}Ge.current=new Date().getTime()})():(()=>{_e.current!==1/0&&(tr.current=new Date().getTime(),Fe=setTimeout(()=>{p.onAutoClose==null||p.onAutoClose.call(p,p),He()},_e.current))})(),()=>clearTimeout(Fe)},[N,b,p,Ie,Vt,He]),Se.useEffect(()=>{p.delete&&(He(),p.onDismiss==null||p.onDismiss.call(p,p))},[He,p.delete]);function jr(){var Fe;if(P!=null&&P.loading){var wt;return Se.createElement("div",{className:tn(M==null?void 0:M.loader,p==null||(wt=p.classNames)==null?void 0:wt.loader,"sonner-loader"),"data-visible":Ie==="loading"},P.loading)}return Se.createElement(oB,{className:tn(M==null?void 0:M.loader,p==null||(Fe=p.classNames)==null?void 0:Fe.loader),visible:Ie==="loading"})}const Jr=p.icon||(P==null?void 0:P[Ie])||nB(Ie);var $t,rr;return Se.createElement("li",{tabIndex:0,ref:Pe,className:tn(Y,ct,M==null?void 0:M.toast,p==null||(t=p.classNames)==null?void 0:t.toast,M==null?void 0:M.default,M==null?void 0:M[Ie],p==null||(r=p.classNames)==null?void 0:r[Ie]),"data-sonner-toast":"","data-rich-colors":($t=p.richColors)!=null?$t:A,"data-styled":!(p.jsx||p.unstyled||x),"data-mounted":X,"data-promise":!!p.promise,"data-swiped":ke,"data-removed":oe,"data-visible":qe,"data-y-position":us,"data-x-position":zt,"data-index":S,"data-front":Ue,"data-swiping":Z,"data-dismissible":Ve,"data-type":Ie,"data-invert":Le,"data-swipe-out":le,"data-swipe-direction":T,"data-expanded":!!(N||F&&X),"data-testid":p.testId,style:{"--index":S,"--toasts-before":S,"--z-index":E.length-S,"--offset":`${oe?te:kt.current}px`,"--initial-height":F?"auto":`${Ce}px`,...B,...p.style},onDragEnd:()=>{ce(!1),H(null),Et.current=null},onPointerDown:Fe=>{Fe.button!==2&&(Ze||!Ve||(Re.current=new Date,re(kt.current),Fe.target.setPointerCapture(Fe.pointerId),Fe.target.tagName!=="BUTTON"&&(ce(!0),Et.current={x:Fe.clientX,y:Fe.clientY})))},onPointerUp:()=>{var Fe,wt,Gt;if(le||!Ve)return;Et.current=null;const sr=Number(((Fe=Pe.current)==null?void 0:Fe.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Ls=Number(((wt=Pe.current)==null?void 0:wt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),rt=new Date().getTime()-((Gt=Re.current)==null?void 0:Gt.getTime()),hr=W==="x"?sr:Ls,Bt=Math.abs(hr)/rt;if(Math.abs(hr)>=kB||Bt>.11){re(kt.current),p.onDismiss==null||p.onDismiss.call(p,p),G(W==="x"?sr>0?"right":"left":Ls>0?"down":"up"),He(),be(!0);return}else{var Rt,Xt;(Rt=Pe.current)==null||Rt.style.setProperty("--swipe-amount-x","0px"),(Xt=Pe.current)==null||Xt.style.setProperty("--swipe-amount-y","0px")}Ee(!1),ce(!1),H(null)},onPointerMove:Fe=>{var wt,Gt,sr;if(!Et.current||!Ve||((wt=window.getSelection())==null?void 0:wt.toString().length)>0)return;const rt=Fe.clientY-Et.current.y,hr=Fe.clientX-Et.current.x;var Bt;const Rt=(Bt=e.swipeDirections)!=null?Bt:RB(L);!W&&(Math.abs(hr)>1||Math.abs(rt)>1)&&H(Math.abs(hr)>Math.abs(rt)?"x":"y");let Xt={x:0,y:0};const ei=fr=>1/(1.5+Math.abs(fr)/20);if(W==="y"){if(Rt.includes("top")||Rt.includes("bottom"))if(Rt.includes("top")&&rt<0||Rt.includes("bottom")&&rt>0)Xt.y=rt;else{const fr=rt*ei(rt);Xt.y=Math.abs(fr)<Math.abs(rt)?fr:rt}}else if(W==="x"&&(Rt.includes("left")||Rt.includes("right")))if(Rt.includes("left")&&hr<0||Rt.includes("right")&&hr>0)Xt.x=hr;else{const fr=hr*ei(hr);Xt.x=Math.abs(fr)<Math.abs(hr)?fr:hr}(Math.abs(Xt.x)>0||Math.abs(Xt.y)>0)&&Ee(!0),(Gt=Pe.current)==null||Gt.style.setProperty("--swipe-amount-x",`${Xt.x}px`),(sr=Pe.current)==null||sr.style.setProperty("--swipe-amount-y",`${Xt.y}px`)}},Nr&&!p.jsx&&Ie!=="loading"?Se.createElement("button",{"aria-label":O,"data-disabled":Ze,"data-close-button":!0,onClick:Ze||!Ve?()=>{}:()=>{He(),p.onDismiss==null||p.onDismiss.call(p,p)},className:tn(M==null?void 0:M.closeButton,p==null||(s=p.classNames)==null?void 0:s.closeButton)},(rr=P==null?void 0:P.close)!=null?rr:hB):null,(Ie||p.icon||p.promise)&&p.icon!==null&&((P==null?void 0:P[Ie])!==null||p.icon)?Se.createElement("div",{"data-icon":"",className:tn(M==null?void 0:M.icon,p==null||(n=p.classNames)==null?void 0:n.icon)},p.promise||p.type==="loading"&&!p.icon?p.icon||jr():null,p.type!=="loading"?Jr:null):null,Se.createElement("div",{"data-content":"",className:tn(M==null?void 0:M.content,p==null||(l=p.classNames)==null?void 0:l.content)},Se.createElement("div",{"data-title":"",className:tn(M==null?void 0:M.title,p==null||(u=p.classNames)==null?void 0:u.title)},p.jsx?p.jsx:typeof p.title=="function"?p.title():p.title),p.description?Se.createElement("div",{"data-description":"",className:tn(V,Qr,M==null?void 0:M.description,p==null||(d=p.classNames)==null?void 0:d.description)},typeof p.description=="function"?p.description():p.description):null),Se.isValidElement(p.cancel)?p.cancel:p.cancel&&Wh(p.cancel)?Se.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||$,onClick:Fe=>{Wh(p.cancel)&&Ve&&(p.cancel.onClick==null||p.cancel.onClick.call(p.cancel,Fe),He())},className:tn(M==null?void 0:M.cancelButton,p==null||(m=p.classNames)==null?void 0:m.cancelButton)},p.cancel.label):null,Se.isValidElement(p.action)?p.action:p.action&&Wh(p.action)?Se.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||q,onClick:Fe=>{Wh(p.action)&&(p.action.onClick==null||p.action.onClick.call(p.action,Fe),!Fe.defaultPrevented&&He())},className:tn(M==null?void 0:M.actionButton,p==null||(f=p.classNames)==null?void 0:f.actionButton)},p.action.label):null)};function sC(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function jB(e,t){const r={};return[e,t].forEach((s,n)=>{const l=n===1,u=l?"--mobile-offset":"--offset",d=l?wB:bB;function m(f){["top","right","bottom","left"].forEach(v=>{r[`${u}-${v}`]=typeof f=="number"?`${f}px`:f})}typeof s=="number"||typeof s=="string"?m(s):typeof s=="object"?["top","right","bottom","left"].forEach(f=>{s[f]===void 0?r[`${u}-${f}`]=d:r[`${u}-${f}`]=typeof s[f]=="number"?`${s[f]}px`:s[f]}):m(d)}),r}const AB=Se.forwardRef(function(t,r){const{id:s,invert:n,position:l="bottom-right",hotkey:u=["altKey","KeyT"],expand:d,closeButton:m,className:f,offset:v,mobileOffset:p,theme:x="light",richColors:b,duration:w,style:C,visibleToasts:k=yB,toastOptions:S,dir:E=sC(),gap:N=CB,icons:R,containerAriaLabel:A="Notifications"}=t,[D,B]=Se.useState([]),$=Se.useMemo(()=>s?D.filter(X=>X.toasterId===s):D.filter(X=>!X.toasterId),[D,s]),q=Se.useMemo(()=>Array.from(new Set([l].concat($.filter(X=>X.position).map(X=>X.position)))),[$,l]),[Y,V]=Se.useState([]),[U,L]=Se.useState(!1),[I,F]=Se.useState(!1),[M,P]=Se.useState(x!=="system"?x:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),O=Se.useRef(null),W=u.join("+").replace(/Key/g,"").replace(/Digit/g,""),H=Se.useRef(null),T=Se.useRef(!1),G=Se.useCallback(X=>{B(ee=>{var oe;return(oe=ee.find(de=>de.id===X.id))!=null&&oe.delete||Ms.dismiss(X.id),ee.filter(({id:de})=>de!==X.id)})},[]);return Se.useEffect(()=>Ms.subscribe(X=>{if(X.dismiss){requestAnimationFrame(()=>{B(ee=>ee.map(oe=>oe.id===X.id?{...oe,delete:!0}:oe))});return}setTimeout(()=>{sB.flushSync(()=>{B(ee=>{const oe=ee.findIndex(de=>de.id===X.id);return oe!==-1?[...ee.slice(0,oe),{...ee[oe],...X},...ee.slice(oe+1)]:[X,...ee]})})})}),[D]),Se.useEffect(()=>{if(x!=="system"){P(x);return}if(x==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?P("dark"):P("light")),typeof window>"u")return;const X=window.matchMedia("(prefers-color-scheme: dark)");try{X.addEventListener("change",({matches:ee})=>{P(ee?"dark":"light")})}catch{X.addListener(({matches:oe})=>{try{P(oe?"dark":"light")}catch(de){console.error(de)}})}},[x]),Se.useEffect(()=>{D.length<=1&&L(!1)},[D]),Se.useEffect(()=>{const X=ee=>{var oe;if(u.every(ce=>ee[ce]||ee.code===ce)){var Z;L(!0),(Z=O.current)==null||Z.focus()}ee.code==="Escape"&&(document.activeElement===O.current||(oe=O.current)!=null&&oe.contains(document.activeElement))&&L(!1)};return document.addEventListener("keydown",X),()=>document.removeEventListener("keydown",X)},[u]),Se.useEffect(()=>{if(O.current)return()=>{H.current&&(H.current.focus({preventScroll:!0}),H.current=null,T.current=!1)}},[O.current]),Se.createElement("section",{ref:r,"aria-label":`${A} ${W}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},q.map((X,ee)=>{var oe;const[de,Z]=X.split("-");return $.length?Se.createElement("ol",{key:X,dir:E==="auto"?sC():E,tabIndex:-1,ref:O,className:f,"data-sonner-toaster":!0,"data-sonner-theme":M,"data-y-position":de,"data-x-position":Z,style:{"--front-toast-height":`${((oe=Y[0])==null?void 0:oe.height)||0}px`,"--width":`${SB}px`,"--gap":`${N}px`,...C,...jB(v,p)},onBlur:ce=>{T.current&&!ce.currentTarget.contains(ce.relatedTarget)&&(T.current=!1,H.current&&(H.current.focus({preventScroll:!0}),H.current=null))},onFocus:ce=>{ce.target instanceof HTMLElement&&ce.target.dataset.dismissible==="false"||T.current||(T.current=!0,H.current=ce.relatedTarget)},onMouseEnter:()=>L(!0),onMouseMove:()=>L(!0),onMouseLeave:()=>{I||L(!1)},onDragEnd:()=>L(!1),onPointerDown:ce=>{ce.target instanceof HTMLElement&&ce.target.dataset.dismissible==="false"||F(!0)},onPointerUp:()=>F(!1)},$.filter(ce=>!ce.position&&ee===0||ce.position===X).map((ce,le)=>{var be,ke;return Se.createElement(NB,{key:ce.id,icons:R,index:le,toast:ce,defaultRichColors:b,duration:(be=S==null?void 0:S.duration)!=null?be:w,className:S==null?void 0:S.className,descriptionClassName:S==null?void 0:S.descriptionClassName,invert:n,visibleToasts:k,closeButton:(ke=S==null?void 0:S.closeButton)!=null?ke:m,interacting:I,position:X,style:S==null?void 0:S.style,unstyled:S==null?void 0:S.unstyled,classNames:S==null?void 0:S.classNames,cancelButtonStyle:S==null?void 0:S.cancelButtonStyle,actionButtonStyle:S==null?void 0:S.actionButtonStyle,closeButtonAriaLabel:S==null?void 0:S.closeButtonAriaLabel,removeToast:G,toasts:$.filter(Ee=>Ee.position==ce.position),heights:Y.filter(Ee=>Ee.position==ce.position),setHeights:V,expandByDefault:d,gap:N,expanded:U,swipeDirections:t.swipeDirections})})):null}))});function Gi(e,t=[]){let r=[];function s(l,u){const d=g.createContext(u);d.displayName=l+"Context";const m=r.length;r=[...r,u];const f=p=>{var S;const{scope:x,children:b,...w}=p,C=((S=x==null?void 0:x[e])==null?void 0:S[m])||d,k=g.useMemo(()=>w,Object.values(w));return o.jsx(C.Provider,{value:k,children:b})};f.displayName=l+"Provider";function v(p,x,b={}){var S;const{optional:w=!1}=b,C=((S=x==null?void 0:x[e])==null?void 0:S[m])||d,k=g.useContext(C);if(k)return k;if(u!==void 0)return u;if(!w)throw new Error(`\`${p}\` must be used within \`${l}\``)}return[f,v]}const n=()=>{const l=r.map(u=>g.createContext(u));return function(d){const m=(d==null?void 0:d[e])||l;return g.useMemo(()=>({[`__scope${e}`]:{...d,[e]:m}}),[d,m])}};return n.scopeName=e,[s,MB(n,...t)]}function MB(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const s=e.map(n=>({useScope:n(),scopeName:n.scopeName}));return function(l){const u=s.reduce((d,{useScope:m,scopeName:f})=>{const p=m(l)[`__scope${f}`];return{...d,...p}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return r.scopeName=t.scopeName,r}function iC(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function TB(...e){return t=>{let r=!1;const s=e.map(n=>{const l=iC(n,t);return!r&&typeof l=="function"&&(r=!0),l});if(r)return()=>{for(let n=0;n<s.length;n++){const l=s[n];typeof l=="function"?l():iC(e[n],null)}}}}function ut(...e){return g.useCallback(TB(...e),e)}function Be(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e==null||e(n),r===!1||!n||!n.defaultPrevented)return t==null?void 0:t(n)}}var ur=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},DB=no[" useId ".trim().toString()]||(()=>{}),LB=0;function Vs(e){const[t,r]=g.useState(DB());return ur(()=>{r(s=>s??String(LB++))},[e]),t?`radix-${t}`:""}var OB=no[" useInsertionEffect ".trim().toString()]||ur;function eo({prop:e,defaultProp:t,onChange:r=()=>{},caller:s}){const[n,l,u]=BB({defaultProp:t,onChange:r}),d=e!==void 0,m=d?e:n;{const v=g.useRef(e!==void 0);g.useEffect(()=>{const p=v.current;p!==d&&console.warn(`${s} is changing from ${p?"controlled":"uncontrolled"} to ${d?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),v.current=d},[d,s])}const f=g.useCallback(v=>{var p;if(d){const x=PB(v)?v(e):v;x!==e&&((p=u.current)==null||p.call(u,x))}else l(v)},[d,e,l,u]);return[m,f]}function BB({defaultProp:e,onChange:t}){const[r,s]=g.useState(e),n=g.useRef(r),l=g.useRef(t);return OB(()=>{l.current=t},[t]),g.useEffect(()=>{var u;n.current!==r&&((u=l.current)==null||u.call(l,r),n.current=r)},[r,n]),[r,s,l]}function PB(e){return typeof e=="function"}function Ko(e){const t=g.forwardRef((r,s)=>{let{children:n,...l}=r,u=null,d=!1;const m=[];nC(n)&&typeof qh=="function"&&(n=qh(n._payload)),g.Children.forEach(n,x=>{var b;if(FB(x)){d=!0;const w=x;let C="child"in w.props?w.props.child:w.props.children;nC(C)&&typeof qh=="function"&&(C=qh(C._payload)),u=$B(w,C),m.push((b=u==null?void 0:u.props)==null?void 0:b.children)}else m.push(x)}),u?u=g.cloneElement(u,void 0,m):!d&&g.Children.count(n)===1&&g.isValidElement(n)&&(u=n);const f=u?HB(u):void 0,v=ut(s,f);if(!u){if(n||n===0)throw new Error(d?GB(e):VB(e));return n}const p=UB(l,u.props??{});return u.type!==g.Fragment&&(p.ref=s?v:f),g.cloneElement(u,p)});return t.displayName=`${e}.Slot`,t}var IB=Ko("Slot"),zB=Symbol.for("radix.slottable"),$B=(e,t)=>{if("child"in e.props){const r=e.props.child;return g.isValidElement(r)?g.cloneElement(r,void 0,e.props.children(r.props.children)):null}return g.isValidElement(t)?t:null};function UB(e,t){const r={...t};for(const s in t){const n=e[s],l=t[s];/^on[A-Z]/.test(s)?n&&l?r[s]=(...d)=>{const m=l(...d);return n(...d),m}:n&&(r[s]=n):s==="style"?r[s]={...n,...l}:s==="className"&&(r[s]=[n,l].filter(Boolean).join(" "))}return{...e,...r}}function HB(e){var s,n;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(n=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function FB(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===zB}var WB=Symbol.for("react.lazy");function nC(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===WB&&"_payload"in e&&qB(e._payload)}function qB(e){return typeof e=="object"&&e!==null&&"then"in e}var VB=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,GB=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,qh=no[" use ".trim().toString()],YB=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Xe=YB.reduce((e,t)=>{const r=Ko(`Primitive.${t}`),s=g.forwardRef((n,l)=>{const{asChild:u,...d}=n,m=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(m,{...d,ref:l})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function _E(e,t){e&&na.flushSync(()=>e.dispatchEvent(t))}function Er(e){const t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>((...r)=>{var s;return(s=t.current)==null?void 0:s.call(t,...r)}),[])}var KB="DismissableLayer",$_="dismissableLayer.update",XB="dismissableLayer.pointerDownOutside",ZB="dismissableLayer.focusOutside",aC,E0=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Em=g.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:s=!1,onEscapeKeyDown:n,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:d,onDismiss:m,...f}=e,v=g.useContext(E0),[p,x]=g.useState(null),b=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,w]=g.useState({}),C=ut(t,x),k=Array.from(v.layers),[S]=[...v.layersWithOutsidePointerEventsDisabled].slice(-1),E=S?k.indexOf(S):-1,N=p?k.indexOf(p):-1,R=v.layersWithOutsidePointerEventsDisabled.size>0,A=N>=E,D=g.useRef(!1),B=rP(V=>{l==null||l(V),d==null||d(V),V.defaultPrevented||m==null||m()},{ownerDocument:b,deferPointerDownOutside:s,isDeferredPointerDownOutsideRef:D,dismissableSurfaces:v.dismissableSurfaces,shouldHandlePointerDownOutside:g.useCallback(V=>{if(!(V instanceof Node))return!1;const U=[...v.branches].some(L=>L.contains(V));return A&&!U},[v.branches,A])}),$=sP(V=>{if(s&&D.current)return;const U=V.target;[...v.branches].some(I=>I.contains(U))||(u==null||u(V),d==null||d(V),V.defaultPrevented||m==null||m())},b),q=p?N===k.length-1:!1,Y=Er(V=>{V.key==="Escape"&&(n==null||n(V),!V.defaultPrevented&&m&&(V.preventDefault(),m()))});return g.useEffect(()=>{if(q)return b.addEventListener("keydown",Y,{capture:!0}),()=>b.removeEventListener("keydown",Y,{capture:!0})},[b,q,Y]),g.useEffect(()=>{if(p)return r&&(v.layersWithOutsidePointerEventsDisabled.size===0&&(aC=b.body.style.pointerEvents,b.body.style.pointerEvents="none"),v.layersWithOutsidePointerEventsDisabled.add(p)),v.layers.add(p),oC(),()=>{r&&(v.layersWithOutsidePointerEventsDisabled.delete(p),v.layersWithOutsidePointerEventsDisabled.size===0&&(b.body.style.pointerEvents=aC))}},[p,b,r,v]),g.useEffect(()=>()=>{p&&(v.layers.delete(p),v.layersWithOutsidePointerEventsDisabled.delete(p),oC())},[p,v]),g.useEffect(()=>{const V=()=>w({});return document.addEventListener($_,V),()=>document.removeEventListener($_,V)},[]),o.jsx(Xe.div,{...f,ref:C,style:{pointerEvents:R?A?"auto":"none":void 0,...e.style},onFocusCapture:Be(e.onFocusCapture,$.onFocusCapture),onBlurCapture:Be(e.onBlurCapture,$.onBlurCapture),onPointerDownCapture:Be(e.onPointerDownCapture,B.onPointerDownCapture)})});Em.displayName=KB;var QB="DismissableLayerBranch",JB=g.forwardRef((e,t)=>{const r=g.useContext(E0),s=g.useRef(null),n=ut(t,s);return g.useEffect(()=>{const l=s.current;if(l)return r.branches.add(l),()=>{r.branches.delete(l)}},[r.branches]),o.jsx(Xe.div,{...e,ref:n})});JB.displayName=QB;function eP(){const e=g.useContext(E0),[t,r]=g.useState(null);return g.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),r}var tP=()=>!0;function rP(e,t){const{ownerDocument:r=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:s=!1,isDeferredPointerDownOutsideRef:n,dismissableSurfaces:l,shouldHandlePointerDownOutside:u=tP}=t,d=Er(e),m=g.useRef(!1),f=g.useRef(!1),v=g.useRef(new Map),p=g.useRef(()=>{});return g.useEffect(()=>{function x(){f.current=!1,n.current=!1,v.current.clear()}function b(){return Array.from(v.current.values()).some(Boolean)}function w(N){if(!f.current)return;const R=N.target;R instanceof Node&&[...l].some(D=>D.contains(R))||v.current.set(N.type,!0),N.type==="click"&&window.setTimeout(()=>{f.current&&p.current()},0)}function C(N){f.current&&v.current.set(N.type,!1)}const k=N=>{if(N.target&&!m.current){let R=function(){r.removeEventListener("click",p.current);const D=b();x(),D||xE(XB,d,A,{discrete:!0})};if(!u(N.target)){r.removeEventListener("click",p.current),x(),m.current=!1;return}const A={originalEvent:N};f.current=!0,n.current=s&&N.button===0,v.current.clear(),!s||N.button!==0?R():(r.removeEventListener("click",p.current),p.current=R,r.addEventListener("click",p.current,{once:!0}))}else r.removeEventListener("click",p.current),x();m.current=!1},S=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const N of S)r.addEventListener(N,w,!0),r.addEventListener(N,C);const E=window.setTimeout(()=>{r.addEventListener("pointerdown",k)},0);return()=>{window.clearTimeout(E),r.removeEventListener("pointerdown",k),r.removeEventListener("click",p.current);for(const N of S)r.removeEventListener(N,w,!0),r.removeEventListener(N,C)}},[r,d,s,n,l,u]),{onPointerDownCapture:()=>m.current=!0}}function sP(e,t=globalThis==null?void 0:globalThis.document){const r=Er(e),s=g.useRef(!1);return g.useEffect(()=>{const n=l=>{l.target&&!s.current&&xE(ZB,r,{originalEvent:l},{discrete:!1})};return t.addEventListener("focusin",n),()=>t.removeEventListener("focusin",n)},[t,r]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function oC(){const e=new CustomEvent($_);document.dispatchEvent(e)}function xE(e,t,r,{discrete:s}){const n=r.originalEvent.target,l=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&n.addEventListener(e,t,{once:!0}),s?_E(n,l):n.dispatchEvent(l)}var Rv="focusScope.autoFocusOnMount",Nv="focusScope.autoFocusOnUnmount",lC={bubbles:!1,cancelable:!0},iP="FocusScope",Rm=g.forwardRef((e,t)=>{const{loop:r=!1,trapped:s=!1,onMountAutoFocus:n,onUnmountAutoFocus:l,...u}=e,[d,m]=g.useState(null),f=Er(n),v=Er(l),p=g.useRef(null),x=ut(t,m),b=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(s){let C=function(N){if(b.paused||!d)return;const R=N.target;d.contains(R)?p.current=R:Fa(p.current,{select:!0})},k=function(N){if(b.paused||!d)return;const R=N.relatedTarget;R!==null&&(d.contains(R)||Fa(p.current,{select:!0}))},S=function(N){if(document.activeElement===document.body)for(const A of N)A.removedNodes.length>0&&Fa(d)};document.addEventListener("focusin",C),document.addEventListener("focusout",k);const E=new MutationObserver(S);return d&&E.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",C),document.removeEventListener("focusout",k),E.disconnect()}}},[s,d,b.paused]),g.useEffect(()=>{if(d){uC.add(b);const C=document.activeElement;if(!d.contains(C)){const S=new CustomEvent(Rv,lC);d.addEventListener(Rv,f),d.dispatchEvent(S),S.defaultPrevented||(nP(uP(yE(d)),{select:!0}),document.activeElement===C&&Fa(d))}return()=>{d.removeEventListener(Rv,f),setTimeout(()=>{const S=new CustomEvent(Nv,lC);d.addEventListener(Nv,v),d.dispatchEvent(S),S.defaultPrevented||Fa(C??document.body,{select:!0}),d.removeEventListener(Nv,v),uC.remove(b)},0)}}},[d,f,v,b]);const w=g.useCallback(C=>{if(!r&&!s||b.paused)return;const k=C.key==="Tab"&&!C.altKey&&!C.ctrlKey&&!C.metaKey,S=document.activeElement;if(k&&S){const E=C.currentTarget,[N,R]=aP(E);N&&R?!C.shiftKey&&S===R?(C.preventDefault(),r&&Fa(N,{select:!0})):C.shiftKey&&S===N&&(C.preventDefault(),r&&Fa(R,{select:!0})):S===E&&C.preventDefault()}},[r,s,b.paused]);return o.jsx(Xe.div,{tabIndex:-1,...u,ref:x,onKeyDown:w})});Rm.displayName=iP;function nP(e,{select:t=!1}={}){const r=document.activeElement;for(const s of e)if(Fa(s,{select:t}),document.activeElement!==r)return}function aP(e){const t=yE(e),r=cC(t,e),s=cC(t.reverse(),e);return[r,s]}function yE(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const n=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||n?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function cC(e,t){const r=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const s of e)if(!(r?!s.checkVisibility({checkVisibilityCSS:!0}):oP(s,{upTo:t})))return s}function oP(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function lP(e){return e instanceof HTMLInputElement&&"select"in e}function Fa(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&lP(e)&&t&&e.select()}}var uC=cP();function cP(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=dC(e,t),e.unshift(t)},remove(t){var r;e=dC(e,t),(r=e[0])==null||r.resume()}}}function dC(e,t){const r=[...e],s=r.indexOf(t);return s!==-1&&r.splice(s,1),r}function uP(e){return e.filter(t=>t.tagName!=="A")}var dP="Portal",Nm=g.forwardRef((e,t)=>{var d;const{container:r,...s}=e,[n,l]=g.useState(!1);ur(()=>l(!0),[]);const u=r||n&&((d=globalThis==null?void 0:globalThis.document)==null?void 0:d.body);return u?na.createPortal(o.jsx(Xe.div,{...s,ref:t}),u):null});Nm.displayName=dP;function hP(e,t){return g.useReducer((r,s)=>t[r][s]??r,e)}var Yi=e=>{const{present:t,children:r}=e,s=fP(t),n=typeof r=="function"?r({present:s.isPresent}):g.Children.only(r),l=mP(s.ref,pP(n));return typeof r=="function"||s.isPresent?g.cloneElement(n,{ref:l}):null};Yi.displayName="Presence";function fP(e){const[t,r]=g.useState(),s=g.useRef(null),n=g.useRef(e),l=g.useRef("none"),u=g.useRef(void 0),d=e?"mounted":"unmounted",[m,f]=hP(d,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{m==="mounted"?(l.current=u.current??_u(s.current),u.current=void 0):l.current="none"},[m]),ur(()=>{const v=s.current,p=n.current;if(p!==e){const b=l.current,w=_u(v);e?(u.current=w,f("MOUNT")):w==="none"||(v==null?void 0:v.display)==="none"?f("UNMOUNT"):f(p&&b!==w?"ANIMATION_OUT":"UNMOUNT"),n.current=e}},[e,f]),ur(()=>{if(t){let v;const p=t.ownerDocument.defaultView??window,x=w=>{const k=_u(s.current).includes(CSS.escape(w.animationName));if(w.target===t&&k&&(f("ANIMATION_END"),!n.current)){const S=t.style.animationFillMode;t.style.animationFillMode="forwards",v=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=S)})}},b=w=>{w.target===t&&(l.current=_u(s.current))};return t.addEventListener("animationstart",b),t.addEventListener("animationcancel",x),t.addEventListener("animationend",x),()=>{p.clearTimeout(v),t.removeEventListener("animationstart",b),t.removeEventListener("animationcancel",x),t.removeEventListener("animationend",x)}}else f("ANIMATION_END")},[t,f]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:g.useCallback(v=>{if(v){const p=getComputedStyle(v);s.current=p,u.current=_u(p)}else s.current=null;r(v)},[])}}function hC(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function mP(...e){const t=g.useRef(e);return t.current=e,g.useCallback(r=>{const s=t.current;let n=!1;const l=s.map(u=>{const d=hC(u,r);return!n&&typeof d=="function"&&(n=!0),d});if(n)return()=>{for(let u=0;u<l.length;u++){const d=l[u];typeof d=="function"?d():hC(s[u],null)}}},[])}function _u(e){return(e==null?void 0:e.animationName)||"none"}function pP(e){var s,n;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(n=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Vh=0,rn=null;function R0(){g.useEffect(()=>{rn||(rn={start:fC(),end:fC()});const{start:e,end:t}=rn;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Vh++,()=>{Vh===1&&(rn==null||rn.start.remove(),rn==null||rn.end.remove(),rn=null),Vh=Math.max(0,Vh-1)}},[])}function fC(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var hn=function(){return hn=Object.assign||function(t){for(var r,s=1,n=arguments.length;s<n;s++){r=arguments[s];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(t[l]=r[l])}return t},hn.apply(this,arguments)};function bE(e,t){var r={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(r[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,s=Object.getOwnPropertySymbols(e);n<s.length;n++)t.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(e,s[n])&&(r[s[n]]=e[s[n]]);return r}function gP(e,t,r){if(r||arguments.length===2)for(var s=0,n=t.length,l;s<n;s++)(l||!(s in t))&&(l||(l=Array.prototype.slice.call(t,0,s)),l[s]=t[s]);return e.concat(l||Array.prototype.slice.call(t))}var Cf="right-scroll-bar-position",kf="width-before-scroll-bar",vP="with-scroll-bars-hidden",_P="--removed-body-scroll-bar-size";function jv(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function xP(e,t){var r=g.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(s){var n=r.value;n!==s&&(r.value=s,r.callback(s,n))}}}})[0];return r.callback=t,r.facade}var yP=typeof window<"u"?g.useLayoutEffect:g.useEffect,mC=new WeakMap;function bP(e,t){var r=xP(null,function(s){return e.forEach(function(n){return jv(n,s)})});return yP(function(){var s=mC.get(r);if(s){var n=new Set(s),l=new Set(e),u=r.current;n.forEach(function(d){l.has(d)||jv(d,null)}),l.forEach(function(d){n.has(d)||jv(d,u)})}mC.set(r,e)},[e]),r}function wP(e){return e}function SP(e,t){t===void 0&&(t=wP);var r=[],s=!1,n={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(l){var u=t(l,s);return r.push(u),function(){r=r.filter(function(d){return d!==u})}},assignSyncMedium:function(l){for(s=!0;r.length;){var u=r;r=[],u.forEach(l)}r={push:function(d){return l(d)},filter:function(){return r}}},assignMedium:function(l){s=!0;var u=[];if(r.length){var d=r;r=[],d.forEach(l),u=r}var m=function(){var v=u;u=[],v.forEach(l)},f=function(){return Promise.resolve().then(m)};f(),r={push:function(v){u.push(v),f()},filter:function(v){return u=u.filter(v),r}}}};return n}function CP(e){e===void 0&&(e={});var t=SP(null);return t.options=hn({async:!0,ssr:!1},e),t}var wE=function(e){var t=e.sideCar,r=bE(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw new Error("Sidecar medium not found");return g.createElement(s,hn({},r))};wE.isSideCarExport=!0;function kP(e,t){return e.useMedium(t),wE}var SE=CP(),Av=function(){},jm=g.forwardRef(function(e,t){var r=g.useRef(null),s=g.useState({onScrollCapture:Av,onWheelCapture:Av,onTouchMoveCapture:Av}),n=s[0],l=s[1],u=e.forwardProps,d=e.children,m=e.className,f=e.removeScrollBar,v=e.enabled,p=e.shards,x=e.sideCar,b=e.noRelative,w=e.noIsolation,C=e.inert,k=e.allowPinchZoom,S=e.as,E=S===void 0?"div":S,N=e.gapMode,R=bE(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),A=x,D=bP([r,t]),B=hn(hn({},R),n);return g.createElement(g.Fragment,null,v&&g.createElement(A,{sideCar:SE,removeScrollBar:f,shards:p,noRelative:b,noIsolation:w,inert:C,setCallbacks:l,allowPinchZoom:!!k,lockRef:r,gapMode:N}),u?g.cloneElement(g.Children.only(d),hn(hn({},B),{ref:D})):g.createElement(E,hn({},B,{className:m,ref:D}),d))});jm.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};jm.classNames={fullWidth:kf,zeroRight:Cf};var EP=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function RP(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=EP();return t&&e.setAttribute("nonce",t),e}function NP(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function jP(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var AP=function(){var e=0,t=null;return{add:function(r){e==0&&(t=RP())&&(NP(t,r),jP(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},MP=function(){var e=AP();return function(t,r){g.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},CE=function(){var e=MP(),t=function(r){var s=r.styles,n=r.dynamic;return e(s,n),null};return t},TP={left:0,top:0,right:0,gap:0},Mv=function(e){return parseInt(e||"",10)||0},DP=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],n=t[e==="padding"?"paddingRight":"marginRight"];return[Mv(r),Mv(s),Mv(n)]},LP=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return TP;var t=DP(e),r=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-r+t[2]-t[0])}},OP=CE(),oc="data-scroll-locked",BP=function(e,t,r,s){var n=e.left,l=e.top,u=e.right,d=e.gap;return r===void 0&&(r="margin"),`
|
|
536
|
-
.`.concat(vP,` {
|
|
537
|
-
overflow: hidden `).concat(s,`;
|
|
538
|
-
padding-right: `).concat(d,"px ").concat(s,`;
|
|
539
|
-
}
|
|
540
|
-
body[`).concat(oc,`] {
|
|
541
|
-
overflow: hidden `).concat(s,`;
|
|
542
|
-
overscroll-behavior: contain;
|
|
543
|
-
`).concat([t&&"position: relative ".concat(s,";"),r==="margin"&&`
|
|
544
|
-
padding-left: `.concat(n,`px;
|
|
545
|
-
padding-top: `).concat(l,`px;
|
|
546
|
-
padding-right: `).concat(u,`px;
|
|
547
|
-
margin-left:0;
|
|
548
|
-
margin-top:0;
|
|
549
|
-
margin-right: `).concat(d,"px ").concat(s,`;
|
|
550
|
-
`),r==="padding"&&"padding-right: ".concat(d,"px ").concat(s,";")].filter(Boolean).join(""),`
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
.`).concat(Cf,` {
|
|
554
|
-
right: `).concat(d,"px ").concat(s,`;
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
.`).concat(kf,` {
|
|
558
|
-
margin-right: `).concat(d,"px ").concat(s,`;
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
.`).concat(Cf," .").concat(Cf,` {
|
|
562
|
-
right: 0 `).concat(s,`;
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
.`).concat(kf," .").concat(kf,` {
|
|
566
|
-
margin-right: 0 `).concat(s,`;
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
body[`).concat(oc,`] {
|
|
570
|
-
`).concat(_P,": ").concat(d,`px;
|
|
571
|
-
}
|
|
572
|
-
`)},pC=function(){var e=parseInt(document.body.getAttribute(oc)||"0",10);return isFinite(e)?e:0},PP=function(){g.useEffect(function(){return document.body.setAttribute(oc,(pC()+1).toString()),function(){var e=pC()-1;e<=0?document.body.removeAttribute(oc):document.body.setAttribute(oc,e.toString())}},[])},IP=function(e){var t=e.noRelative,r=e.noImportant,s=e.gapMode,n=s===void 0?"margin":s;PP();var l=g.useMemo(function(){return LP(n)},[n]);return g.createElement(OP,{styles:BP(l,!t,n,r?"":"!important")})},U_=!1;if(typeof window<"u")try{var Gh=Object.defineProperty({},"passive",{get:function(){return U_=!0,!0}});window.addEventListener("test",Gh,Gh),window.removeEventListener("test",Gh,Gh)}catch{U_=!1}var Vl=U_?{passive:!1}:!1,zP=function(e){return e.tagName==="TEXTAREA"},kE=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!zP(e)&&r[t]==="visible")},$P=function(e){return kE(e,"overflowY")},UP=function(e){return kE(e,"overflowX")},gC=function(e,t){var r=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var n=EE(e,s);if(n){var l=RE(e,s),u=l[1],d=l[2];if(u>d)return!0}s=s.parentNode}while(s&&s!==r.body);return!1},HP=function(e){var t=e.scrollTop,r=e.scrollHeight,s=e.clientHeight;return[t,r,s]},FP=function(e){var t=e.scrollLeft,r=e.scrollWidth,s=e.clientWidth;return[t,r,s]},EE=function(e,t){return e==="v"?$P(t):UP(t)},RE=function(e,t){return e==="v"?HP(t):FP(t)},WP=function(e,t){return e==="h"&&t==="rtl"?-1:1},qP=function(e,t,r,s,n){var l=WP(e,window.getComputedStyle(t).direction),u=l*s,d=r.target,m=t.contains(d),f=!1,v=u>0,p=0,x=0;do{if(!d)break;var b=RE(e,d),w=b[0],C=b[1],k=b[2],S=C-k-l*w;(w||S)&&EE(e,d)&&(p+=S,x+=w);var E=d.parentNode;d=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}while(!m&&d!==document.body||m&&(t.contains(d)||t===d));return(v&&Math.abs(p)<1||!v&&Math.abs(x)<1)&&(f=!0),f},Yh=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},vC=function(e){return[e.deltaX,e.deltaY]},_C=function(e){return e&&"current"in e?e.current:e},VP=function(e,t){return e[0]===t[0]&&e[1]===t[1]},GP=function(e){return`
|
|
573
|
-
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
574
|
-
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
575
|
-
`)},YP=0,Gl=[];function KP(e){var t=g.useRef([]),r=g.useRef([0,0]),s=g.useRef(),n=g.useState(YP++)[0],l=g.useState(CE)[0],u=g.useRef(e);g.useEffect(function(){u.current=e},[e]),g.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(n));var C=gP([e.lockRef.current],(e.shards||[]).map(_C),!0).filter(Boolean);return C.forEach(function(k){return k.classList.add("allow-interactivity-".concat(n))}),function(){document.body.classList.remove("block-interactivity-".concat(n)),C.forEach(function(k){return k.classList.remove("allow-interactivity-".concat(n))})}}},[e.inert,e.lockRef.current,e.shards]);var d=g.useCallback(function(C,k){if("touches"in C&&C.touches.length===2||C.type==="wheel"&&C.ctrlKey)return!u.current.allowPinchZoom;var S=Yh(C),E=r.current,N="deltaX"in C?C.deltaX:E[0]-S[0],R="deltaY"in C?C.deltaY:E[1]-S[1],A,D=C.target,B=Math.abs(N)>Math.abs(R)?"h":"v";if("touches"in C&&B==="h"&&D.type==="range")return!1;var $=window.getSelection(),q=$&&$.anchorNode,Y=q?q===D||q.contains(D):!1;if(Y)return!1;var V=gC(B,D);if(!V)return!0;if(V?A=B:(A=B==="v"?"h":"v",V=gC(B,D)),!V)return!1;if(!s.current&&"changedTouches"in C&&(N||R)&&(s.current=A),!A)return!0;var U=s.current||A;return qP(U,k,C,U==="h"?N:R)},[]),m=g.useCallback(function(C){var k=C;if(!(!Gl.length||Gl[Gl.length-1]!==l)){var S="deltaY"in k?vC(k):Yh(k),E=t.current.filter(function(A){return A.name===k.type&&(A.target===k.target||k.target===A.shadowParent)&&VP(A.delta,S)})[0];if(E&&E.should){k.cancelable&&k.preventDefault();return}if(!E){var N=(u.current.shards||[]).map(_C).filter(Boolean).filter(function(A){return A.contains(k.target)}),R=N.length>0?d(k,N[0]):!u.current.noIsolation;R&&k.cancelable&&k.preventDefault()}}},[]),f=g.useCallback(function(C,k,S,E){var N={name:C,delta:k,target:S,should:E,shadowParent:XP(S)};t.current.push(N),setTimeout(function(){t.current=t.current.filter(function(R){return R!==N})},1)},[]),v=g.useCallback(function(C){r.current=Yh(C),s.current=void 0},[]),p=g.useCallback(function(C){f(C.type,vC(C),C.target,d(C,e.lockRef.current))},[]),x=g.useCallback(function(C){f(C.type,Yh(C),C.target,d(C,e.lockRef.current))},[]);g.useEffect(function(){return Gl.push(l),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:x}),document.addEventListener("wheel",m,Vl),document.addEventListener("touchmove",m,Vl),document.addEventListener("touchstart",v,Vl),function(){Gl=Gl.filter(function(C){return C!==l}),document.removeEventListener("wheel",m,Vl),document.removeEventListener("touchmove",m,Vl),document.removeEventListener("touchstart",v,Vl)}},[]);var b=e.removeScrollBar,w=e.inert;return g.createElement(g.Fragment,null,w?g.createElement(l,{styles:GP(n)}):null,b?g.createElement(IP,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function XP(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const ZP=kP(SE,KP);var Am=g.forwardRef(function(e,t){return g.createElement(jm,hn({},e,{ref:t,sideCar:ZP}))});Am.classNames=jm.classNames;var QP=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Yl=new WeakMap,Kh=new WeakMap,Xh={},Tv=0,NE=function(e){return e&&(e.host||NE(e.parentNode))},JP=function(e,t){return t.map(function(r){if(e.contains(r))return r;var s=NE(r);return s&&e.contains(s)?s:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},eI=function(e,t,r,s){var n=JP(t,Array.isArray(e)?e:[e]);Xh[r]||(Xh[r]=new WeakMap);var l=Xh[r],u=[],d=new Set,m=new Set(n),f=function(p){!p||d.has(p)||(d.add(p),f(p.parentNode))};n.forEach(f);var v=function(p){!p||m.has(p)||Array.prototype.forEach.call(p.children,function(x){if(d.has(x))v(x);else try{var b=x.getAttribute(s),w=b!==null&&b!=="false",C=(Yl.get(x)||0)+1,k=(l.get(x)||0)+1;Yl.set(x,C),l.set(x,k),u.push(x),C===1&&w&&Kh.set(x,!0),k===1&&x.setAttribute(r,"true"),w||x.setAttribute(s,"true")}catch(S){console.error("aria-hidden: cannot operate on ",x,S)}})};return v(t),d.clear(),Tv++,function(){u.forEach(function(p){var x=Yl.get(p)-1,b=l.get(p)-1;Yl.set(p,x),l.set(p,b),x||(Kh.has(p)||p.removeAttribute(s),Kh.delete(p)),b||p.removeAttribute(r)}),Tv--,Tv||(Yl=new WeakMap,Yl=new WeakMap,Kh=new WeakMap,Xh={})}},N0=function(e,t,r){r===void 0&&(r="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),n=QP(e);return n?(s.push.apply(s,Array.from(n.querySelectorAll("[aria-live], script"))),eI(s,n,r,"aria-hidden")):function(){return null}},Mm="Dialog",[jE,AE]=Gi(Mm),[tI,Ki]=jE(Mm),j0=e=>{const{__scopeDialog:t,children:r,open:s,defaultOpen:n,onOpenChange:l,modal:u=!0}=e,d=g.useRef(null),m=g.useRef(null),[f,v]=eo({prop:s,defaultProp:n??!1,onChange:l,caller:Mm});return o.jsx(tI,{scope:t,triggerRef:d,contentRef:m,contentId:Vs(),titleId:Vs(),descriptionId:Vs(),open:f,onOpenChange:v,onOpenToggle:g.useCallback(()=>v(p=>!p),[v]),modal:u,children:r})};j0.displayName=Mm;var ME="DialogTrigger",Tm=g.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,n=Ki(ME,r),l=ut(t,n.triggerRef);return o.jsx(Xe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.open?n.contentId:void 0,"data-state":T0(n.open),...s,ref:l,onClick:Be(e.onClick,n.onOpenToggle)})});Tm.displayName=ME;var A0="DialogPortal",[rI,TE]=jE(A0,{forceMount:void 0}),M0=e=>{const{__scopeDialog:t,forceMount:r,children:s,container:n}=e,l=Ki(A0,t);return o.jsx(rI,{scope:t,forceMount:r,children:g.Children.map(s,u=>o.jsx(Yi,{present:r||l.open,children:o.jsx(Nm,{asChild:!0,container:n,children:u})}))})};M0.displayName=A0;var Kf="DialogOverlay",Dm=g.forwardRef((e,t)=>{const r=TE(Kf,e.__scopeDialog),{forceMount:s=r.forceMount,...n}=e,l=Ki(Kf,e.__scopeDialog);return l.modal?o.jsx(Yi,{present:s||l.open,children:o.jsx(iI,{...n,ref:t})}):null});Dm.displayName=Kf;var sI=Ko("DialogOverlay.RemoveScroll"),iI=g.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,n=Ki(Kf,r),l=eP(),u=ut(t,l);return o.jsx(Am,{as:sI,allowPinchZoom:!0,shards:[n.contentRef],children:o.jsx(Xe.div,{"data-state":T0(n.open),...s,ref:u,style:{pointerEvents:"auto",...s.style}})})}),dc="DialogContent",Lm=g.forwardRef((e,t)=>{const r=TE(dc,e.__scopeDialog),{forceMount:s=r.forceMount,...n}=e,l=Ki(dc,e.__scopeDialog);return o.jsx(Yi,{present:s||l.open,children:l.modal?o.jsx(nI,{...n,ref:t}):o.jsx(aI,{...n,ref:t})})});Lm.displayName=dc;var nI=g.forwardRef((e,t)=>{const r=Ki(dc,e.__scopeDialog),s=g.useRef(null),n=ut(t,r.contentRef,s);return g.useEffect(()=>{const l=s.current;if(l)return N0(l)},[]),o.jsx(DE,{...e,ref:n,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:Be(e.onCloseAutoFocus,l=>{var u;l.preventDefault(),(u=r.triggerRef.current)==null||u.focus()}),onPointerDownOutside:Be(e.onPointerDownOutside,l=>{const u=l.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0;(u.button===2||d)&&l.preventDefault()}),onFocusOutside:Be(e.onFocusOutside,l=>l.preventDefault())})}),aI=g.forwardRef((e,t)=>{const r=Ki(dc,e.__scopeDialog),s=g.useRef(!1),n=g.useRef(!1);return o.jsx(DE,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{var u,d;(u=e.onCloseAutoFocus)==null||u.call(e,l),l.defaultPrevented||(s.current||(d=r.triggerRef.current)==null||d.focus(),l.preventDefault()),s.current=!1,n.current=!1},onInteractOutside:l=>{var m,f;(m=e.onInteractOutside)==null||m.call(e,l),l.defaultPrevented||(s.current=!0,l.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const u=l.target;((f=r.triggerRef.current)==null?void 0:f.contains(u))&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&n.current&&l.preventDefault()}})}),DE=g.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:s,onOpenAutoFocus:n,onCloseAutoFocus:l,...u}=e,d=Ki(dc,r);return R0(),o.jsx(o.Fragment,{children:o.jsx(Rm,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:n,onUnmountAutoFocus:l,children:o.jsx(Em,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":T0(d.open),...u,ref:t,deferPointerDownOutside:!0,onDismiss:()=>d.onOpenChange(!1)})})})}),LE="DialogTitle",Om=g.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,n=Ki(LE,r);return o.jsx(Xe.h2,{id:n.titleId,...s,ref:t})});Om.displayName=LE;var OE="DialogDescription",Bm=g.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,n=Ki(OE,r);return o.jsx(Xe.p,{id:n.descriptionId,...s,ref:t})});Bm.displayName=OE;var BE="DialogClose",tl=g.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,n=Ki(BE,r);return o.jsx(Xe.button,{type:"button",...s,ref:t,onClick:Be(e.onClick,()=>n.onOpenChange(!1))})});tl.displayName=BE;function T0(e){return e?"open":"closed"}var PE="AlertDialog",[oI]=Gi(PE,[AE]),aa=AE(),IE=e=>{const{__scopeAlertDialog:t,...r}=e,s=aa(t);return o.jsx(j0,{...s,...r,modal:!0})};IE.displayName=PE;var lI="AlertDialogTrigger",zE=g.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...s}=e,n=aa(r);return o.jsx(Tm,{...n,...s,ref:t})});zE.displayName=lI;var cI="AlertDialogPortal",$E=e=>{const{__scopeAlertDialog:t,...r}=e,s=aa(t);return o.jsx(M0,{...s,...r})};$E.displayName=cI;var uI="AlertDialogOverlay",UE=g.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...s}=e,n=aa(r);return o.jsx(Dm,{...n,...s,ref:t})});UE.displayName=uI;var HE="AlertDialogContent",[dI,hI]=oI(HE),FE=g.forwardRef((e,t)=>{const{__scopeAlertDialog:r,children:s,...n}=e,l=aa(r),u=g.useRef(null),d=ut(t,u),m=g.useRef(null);return o.jsx(dI,{scope:r,cancelRef:m,children:o.jsx(Lm,{role:"alertdialog",...l,...n,ref:d,onOpenAutoFocus:Be(n.onOpenAutoFocus,f=>{var v;f.preventDefault(),(v=m.current)==null||v.focus({preventScroll:!0})}),onPointerDownOutside:f=>f.preventDefault(),onInteractOutside:f=>f.preventDefault(),children:s})})});FE.displayName=HE;var fI="AlertDialogTitle",WE=g.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...s}=e,n=aa(r);return o.jsx(Om,{...n,...s,ref:t})});WE.displayName=fI;var mI="AlertDialogDescription",qE=g.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...s}=e,n=aa(r);return o.jsx(Bm,{...n,...s,ref:t})});qE.displayName=mI;var pI="AlertDialogAction",VE=g.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...s}=e,n=aa(r);return o.jsx(tl,{...n,...s,ref:t})});VE.displayName=pI;var GE="AlertDialogCancel",YE=g.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...s}=e,{cancelRef:n}=hI(GE,r),l=aa(r),u=ut(t,n);return o.jsx(tl,{...l,...s,ref:u})});YE.displayName=GE;var gI=IE,KE=zE,vI=$E,XE=UE,ZE=FE,QE=VE,JE=YE,eR=WE,tR=qE;function rR(e){var t,r,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var n=e.length;for(t=0;t<n;t++)e[t]&&(r=rR(e[t]))&&(s&&(s+=" "),s+=r)}else for(r in e)e[r]&&(s&&(s+=" "),s+=r);return s}function D0(){for(var e,t,r=0,s="",n=arguments.length;r<n;r++)(e=arguments[r])&&(t=rR(e))&&(s&&(s+=" "),s+=t);return s}const _I=(e,t)=>{const r=new Array(e.length+t.length);for(let s=0;s<e.length;s++)r[s]=e[s];for(let s=0;s<t.length;s++)r[e.length+s]=t[s];return r},xI=(e,t)=>({classGroupId:e,validator:t}),sR=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Xf="-",xC=[],yI="arbitrary..",bI=e=>{const t=SI(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return wI(u);const d=u.split(Xf),m=d[0]===""&&d.length>1?1:0;return iR(d,m,t)},getConflictingClassGroupIds:(u,d)=>{if(d){const m=s[u],f=r[u];return m?f?_I(f,m):m:f||xC}return r[u]||xC}}},iR=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const n=e[t],l=r.nextPart.get(n);if(l){const f=iR(e,t+1,l);if(f)return f}const u=r.validators;if(u===null)return;const d=t===0?e.join(Xf):e.slice(t).join(Xf),m=u.length;for(let f=0;f<m;f++){const v=u[f];if(v.validator(d))return v.classGroupId}},wI=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),s=t.slice(0,r);return s?yI+s:void 0})(),SI=e=>{const{theme:t,classGroups:r}=e;return CI(r,t)},CI=(e,t)=>{const r=sR();for(const s in e){const n=e[s];L0(n,r,s,t)}return r},L0=(e,t,r,s)=>{const n=e.length;for(let l=0;l<n;l++){const u=e[l];kI(u,t,r,s)}},kI=(e,t,r,s)=>{if(typeof e=="string"){EI(e,t,r);return}if(typeof e=="function"){RI(e,t,r,s);return}NI(e,t,r,s)},EI=(e,t,r)=>{const s=e===""?t:nR(t,e);s.classGroupId=r},RI=(e,t,r,s)=>{if(jI(e)){L0(e(s),t,r,s);return}t.validators===null&&(t.validators=[]),t.validators.push(xI(r,e))},NI=(e,t,r,s)=>{const n=Object.entries(e),l=n.length;for(let u=0;u<l;u++){const[d,m]=n[u];L0(m,nR(t,d),r,s)}},nR=(e,t)=>{let r=e;const s=t.split(Xf),n=s.length;for(let l=0;l<n;l++){const u=s[l];let d=r.nextPart.get(u);d||(d=sR(),r.nextPart.set(u,d)),r=d}return r},jI=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,AI=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),s=Object.create(null);const n=(l,u)=>{r[l]=u,t++,t>e&&(t=0,s=r,r=Object.create(null))};return{get(l){let u=r[l];if(u!==void 0)return u;if((u=s[l])!==void 0)return n(l,u),u},set(l,u){l in r?r[l]=u:n(l,u)}}},H_="!",yC=":",MI=[],bC=(e,t,r,s,n)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:s,isExternal:n}),TI=e=>{const{prefix:t,experimentalParseClassName:r}=e;let s=n=>{const l=[];let u=0,d=0,m=0,f;const v=n.length;for(let C=0;C<v;C++){const k=n[C];if(u===0&&d===0){if(k===yC){l.push(n.slice(m,C)),m=C+1;continue}if(k==="/"){f=C;continue}}k==="["?u++:k==="]"?u--:k==="("?d++:k===")"&&d--}const p=l.length===0?n:n.slice(m);let x=p,b=!1;p.endsWith(H_)?(x=p.slice(0,-1),b=!0):p.startsWith(H_)&&(x=p.slice(1),b=!0);const w=f&&f>m?f-m:void 0;return bC(l,b,x,w)};if(t){const n=t+yC,l=s;s=u=>u.startsWith(n)?l(u.slice(n.length)):bC(MI,!1,u,void 0,!0)}if(r){const n=s;s=l=>r({className:l,parseClassName:n})}return s},DI=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,s)=>{t.set(r,1e6+s)}),r=>{const s=[];let n=[];for(let l=0;l<r.length;l++){const u=r[l],d=u[0]==="[",m=t.has(u);d||m?(n.length>0&&(n.sort(),s.push(...n),n=[]),s.push(u)):n.push(u)}return n.length>0&&(n.sort(),s.push(...n)),s}},LI=e=>({cache:AI(e.cacheSize),parseClassName:TI(e),sortModifiers:DI(e),postfixLookupClassGroupIds:OI(e),...bI(e)}),OI=e=>{const t=Object.create(null),r=e.postfixLookupClassGroups;if(r)for(let s=0;s<r.length;s++)t[r[s]]=!0;return t},BI=/\s+/,PI=(e,t)=>{const{parseClassName:r,getClassGroupId:s,getConflictingClassGroupIds:n,sortModifiers:l,postfixLookupClassGroupIds:u}=t,d=[],m=e.trim().split(BI);let f="";for(let v=m.length-1;v>=0;v-=1){const p=m[v],{isExternal:x,modifiers:b,hasImportantModifier:w,baseClassName:C,maybePostfixModifierPosition:k}=r(p);if(x){f=p+(f.length>0?" "+f:f);continue}let S=!!k,E;if(S){const B=C.substring(0,k);E=s(B);const $=E&&u[E]?s(C):void 0;$&&$!==E&&(E=$,S=!1)}else E=s(C);if(!E){if(!S){f=p+(f.length>0?" "+f:f);continue}if(E=s(C),!E){f=p+(f.length>0?" "+f:f);continue}S=!1}const N=b.length===0?"":b.length===1?b[0]:l(b).join(":"),R=w?N+H_:N,A=R+E;if(d.indexOf(A)>-1)continue;d.push(A);const D=n(E,S);for(let B=0;B<D.length;++B){const $=D[B];d.push(R+$)}f=p+(f.length>0?" "+f:f)}return f},II=(...e)=>{let t=0,r,s,n="";for(;t<e.length;)(r=e[t++])&&(s=aR(r))&&(n&&(n+=" "),n+=s);return n},aR=e=>{if(typeof e=="string")return e;let t,r="";for(let s=0;s<e.length;s++)e[s]&&(t=aR(e[s]))&&(r&&(r+=" "),r+=t);return r},zI=(e,...t)=>{let r,s,n,l;const u=m=>{const f=t.reduce((v,p)=>p(v),e());return r=LI(f),s=r.cache.get,n=r.cache.set,l=d,d(m)},d=m=>{const f=s(m);if(f)return f;const v=PI(m,r);return n(m,v),v};return l=u,(...m)=>l(II(...m))},$I=[],Tr=e=>{const t=r=>r[e]||$I;return t.isThemeGetter=!0,t},oR=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,lR=/^\((?:(\w[\w-]*):)?(.+)\)$/i,UI=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,HI=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,FI=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,WI=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,qI=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,VI=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Pa=e=>UI.test(e),ot=e=>!!e&&!Number.isNaN(Number(e)),sn=e=>!!e&&Number.isInteger(Number(e)),Dv=e=>e.endsWith("%")&&ot(e.slice(0,-1)),Vn=e=>HI.test(e),cR=()=>!0,GI=e=>FI.test(e)&&!WI.test(e),O0=()=>!1,YI=e=>qI.test(e),KI=e=>VI.test(e),XI=e=>!Ae(e)&&!Me(e),ZI=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),QI=e=>co(e,hR,O0),Ae=e=>oR.test(e),To=e=>co(e,fR,GI),wC=e=>co(e,az,ot),JI=e=>co(e,pR,cR),ez=e=>co(e,mR,O0),SC=e=>co(e,uR,O0),tz=e=>co(e,dR,KI),Zh=e=>co(e,gR,YI),Me=e=>lR.test(e),xu=e=>rl(e,fR),rz=e=>rl(e,mR),CC=e=>rl(e,uR),sz=e=>rl(e,hR),iz=e=>rl(e,dR),Qh=e=>rl(e,gR,!0),nz=e=>rl(e,pR,!0),co=(e,t,r)=>{const s=oR.exec(e);return s?s[1]?t(s[1]):r(s[2]):!1},rl=(e,t,r=!1)=>{const s=lR.exec(e);return s?s[1]?t(s[1]):r:!1},uR=e=>e==="position"||e==="percentage",dR=e=>e==="image"||e==="url",hR=e=>e==="length"||e==="size"||e==="bg-size",fR=e=>e==="length",az=e=>e==="number",mR=e=>e==="family-name",pR=e=>e==="number"||e==="weight",gR=e=>e==="shadow",oz=()=>{const e=Tr("color"),t=Tr("font"),r=Tr("text"),s=Tr("font-weight"),n=Tr("tracking"),l=Tr("leading"),u=Tr("breakpoint"),d=Tr("container"),m=Tr("spacing"),f=Tr("radius"),v=Tr("shadow"),p=Tr("inset-shadow"),x=Tr("text-shadow"),b=Tr("drop-shadow"),w=Tr("blur"),C=Tr("perspective"),k=Tr("aspect"),S=Tr("ease"),E=Tr("animate"),N=()=>["auto","avoid","all","avoid-page","page","left","right","column"],R=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],A=()=>[...R(),Me,Ae],D=()=>["auto","hidden","clip","visible","scroll"],B=()=>["auto","contain","none"],$=()=>[Me,Ae,m],q=()=>[Pa,"full","auto",...$()],Y=()=>[sn,"none","subgrid",Me,Ae],V=()=>["auto",{span:["full",sn,Me,Ae]},sn,Me,Ae],U=()=>[sn,"auto",Me,Ae],L=()=>["auto","min","max","fr",Me,Ae],I=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],F=()=>["start","end","center","stretch","center-safe","end-safe"],M=()=>["auto",...$()],P=()=>[Pa,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...$()],O=()=>[Pa,"screen","full","dvw","lvw","svw","min","max","fit",...$()],W=()=>[Pa,"screen","full","lh","dvh","lvh","svh","min","max","fit",...$()],H=()=>[e,Me,Ae],T=()=>[...R(),CC,SC,{position:[Me,Ae]}],G=()=>["no-repeat",{repeat:["","x","y","space","round"]}],X=()=>["auto","cover","contain",sz,QI,{size:[Me,Ae]}],ee=()=>[Dv,xu,To],oe=()=>["","none","full",f,Me,Ae],de=()=>["",ot,xu,To],Z=()=>["solid","dashed","dotted","double"],ce=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],le=()=>[ot,Dv,CC,SC],be=()=>["","none",w,Me,Ae],ke=()=>["none",ot,Me,Ae],Ee=()=>["none",ot,Me,Ae],te=()=>[ot,Me,Ae],re=()=>[Pa,"full",...$()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Vn],breakpoint:[Vn],color:[cR],container:[Vn],"drop-shadow":[Vn],ease:["in","out","in-out"],font:[XI],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Vn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Vn],shadow:[Vn],spacing:["px",ot],text:[Vn],"text-shadow":[Vn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Pa,Ae,Me,k]}],container:["container"],"container-type":[{"@container":["","normal","size",Me,Ae]}],"container-named":[ZI],columns:[{columns:[ot,Ae,Me,d]}],"break-after":[{"break-after":N()}],"break-before":[{"break-before":N()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:A()}],overflow:[{overflow:D()}],"overflow-x":[{"overflow-x":D()}],"overflow-y":[{"overflow-y":D()}],overscroll:[{overscroll:B()}],"overscroll-x":[{"overscroll-x":B()}],"overscroll-y":[{"overscroll-y":B()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:q()}],"inset-x":[{"inset-x":q()}],"inset-y":[{"inset-y":q()}],start:[{"inset-s":q(),start:q()}],end:[{"inset-e":q(),end:q()}],"inset-bs":[{"inset-bs":q()}],"inset-be":[{"inset-be":q()}],top:[{top:q()}],right:[{right:q()}],bottom:[{bottom:q()}],left:[{left:q()}],visibility:["visible","invisible","collapse"],z:[{z:[sn,"auto",Me,Ae]}],basis:[{basis:[Pa,"full","auto",d,...$()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ot,Pa,"auto","initial","none",Ae]}],grow:[{grow:["",ot,Me,Ae]}],shrink:[{shrink:["",ot,Me,Ae]}],order:[{order:[sn,"first","last","none",Me,Ae]}],"grid-cols":[{"grid-cols":Y()}],"col-start-end":[{col:V()}],"col-start":[{"col-start":U()}],"col-end":[{"col-end":U()}],"grid-rows":[{"grid-rows":Y()}],"row-start-end":[{row:V()}],"row-start":[{"row-start":U()}],"row-end":[{"row-end":U()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":L()}],"auto-rows":[{"auto-rows":L()}],gap:[{gap:$()}],"gap-x":[{"gap-x":$()}],"gap-y":[{"gap-y":$()}],"justify-content":[{justify:[...I(),"normal"]}],"justify-items":[{"justify-items":[...F(),"normal"]}],"justify-self":[{"justify-self":["auto",...F()]}],"align-content":[{content:["normal",...I()]}],"align-items":[{items:[...F(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...F(),{baseline:["","last"]}]}],"place-content":[{"place-content":I()}],"place-items":[{"place-items":[...F(),"baseline"]}],"place-self":[{"place-self":["auto",...F()]}],p:[{p:$()}],px:[{px:$()}],py:[{py:$()}],ps:[{ps:$()}],pe:[{pe:$()}],pbs:[{pbs:$()}],pbe:[{pbe:$()}],pt:[{pt:$()}],pr:[{pr:$()}],pb:[{pb:$()}],pl:[{pl:$()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":$()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":$()}],"space-y-reverse":["space-y-reverse"],size:[{size:P()}],"inline-size":[{inline:["auto",...O()]}],"min-inline-size":[{"min-inline":["auto",...O()]}],"max-inline-size":[{"max-inline":["none",...O()]}],"block-size":[{block:["auto",...W()]}],"min-block-size":[{"min-block":["auto",...W()]}],"max-block-size":[{"max-block":["none",...W()]}],w:[{w:[d,"screen",...P()]}],"min-w":[{"min-w":[d,"screen","none",...P()]}],"max-w":[{"max-w":[d,"screen","none","prose",{screen:[u]},...P()]}],h:[{h:["screen","lh",...P()]}],"min-h":[{"min-h":["screen","lh","none",...P()]}],"max-h":[{"max-h":["screen","lh",...P()]}],"font-size":[{text:["base",r,xu,To]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,nz,JI]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Dv,Ae]}],"font-family":[{font:[rz,ez,t]}],"font-features":[{"font-features":[Ae]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[n,Me,Ae]}],"line-clamp":[{"line-clamp":[ot,"none",Me,wC]}],leading:[{leading:[l,...$()]}],"list-image":[{"list-image":["none",Me,Ae]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Me,Ae]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:H()}],"text-color":[{text:H()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Z(),"wavy"]}],"text-decoration-thickness":[{decoration:[ot,"from-font","auto",Me,To]}],"text-decoration-color":[{decoration:H()}],"underline-offset":[{"underline-offset":[ot,"auto",Me,Ae]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:$()}],"tab-size":[{tab:[sn,Me,Ae]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Me,Ae]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Me,Ae]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:T()}],"bg-repeat":[{bg:G()}],"bg-size":[{bg:X()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},sn,Me,Ae],radial:["",Me,Ae],conic:[sn,Me,Ae]},iz,tz]}],"bg-color":[{bg:H()}],"gradient-from-pos":[{from:ee()}],"gradient-via-pos":[{via:ee()}],"gradient-to-pos":[{to:ee()}],"gradient-from":[{from:H()}],"gradient-via":[{via:H()}],"gradient-to":[{to:H()}],rounded:[{rounded:oe()}],"rounded-s":[{"rounded-s":oe()}],"rounded-e":[{"rounded-e":oe()}],"rounded-t":[{"rounded-t":oe()}],"rounded-r":[{"rounded-r":oe()}],"rounded-b":[{"rounded-b":oe()}],"rounded-l":[{"rounded-l":oe()}],"rounded-ss":[{"rounded-ss":oe()}],"rounded-se":[{"rounded-se":oe()}],"rounded-ee":[{"rounded-ee":oe()}],"rounded-es":[{"rounded-es":oe()}],"rounded-tl":[{"rounded-tl":oe()}],"rounded-tr":[{"rounded-tr":oe()}],"rounded-br":[{"rounded-br":oe()}],"rounded-bl":[{"rounded-bl":oe()}],"border-w":[{border:de()}],"border-w-x":[{"border-x":de()}],"border-w-y":[{"border-y":de()}],"border-w-s":[{"border-s":de()}],"border-w-e":[{"border-e":de()}],"border-w-bs":[{"border-bs":de()}],"border-w-be":[{"border-be":de()}],"border-w-t":[{"border-t":de()}],"border-w-r":[{"border-r":de()}],"border-w-b":[{"border-b":de()}],"border-w-l":[{"border-l":de()}],"divide-x":[{"divide-x":de()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":de()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Z(),"hidden","none"]}],"divide-style":[{divide:[...Z(),"hidden","none"]}],"border-color":[{border:H()}],"border-color-x":[{"border-x":H()}],"border-color-y":[{"border-y":H()}],"border-color-s":[{"border-s":H()}],"border-color-e":[{"border-e":H()}],"border-color-bs":[{"border-bs":H()}],"border-color-be":[{"border-be":H()}],"border-color-t":[{"border-t":H()}],"border-color-r":[{"border-r":H()}],"border-color-b":[{"border-b":H()}],"border-color-l":[{"border-l":H()}],"divide-color":[{divide:H()}],"outline-style":[{outline:[...Z(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ot,Me,Ae]}],"outline-w":[{outline:["",ot,xu,To]}],"outline-color":[{outline:H()}],shadow:[{shadow:["","none",v,Qh,Zh]}],"shadow-color":[{shadow:H()}],"inset-shadow":[{"inset-shadow":["none",p,Qh,Zh]}],"inset-shadow-color":[{"inset-shadow":H()}],"ring-w":[{ring:de()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:H()}],"ring-offset-w":[{"ring-offset":[ot,To]}],"ring-offset-color":[{"ring-offset":H()}],"inset-ring-w":[{"inset-ring":de()}],"inset-ring-color":[{"inset-ring":H()}],"text-shadow":[{"text-shadow":["none",x,Qh,Zh]}],"text-shadow-color":[{"text-shadow":H()}],opacity:[{opacity:[ot,Me,Ae]}],"mix-blend":[{"mix-blend":[...ce(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ce()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ot]}],"mask-image-linear-from-pos":[{"mask-linear-from":le()}],"mask-image-linear-to-pos":[{"mask-linear-to":le()}],"mask-image-linear-from-color":[{"mask-linear-from":H()}],"mask-image-linear-to-color":[{"mask-linear-to":H()}],"mask-image-t-from-pos":[{"mask-t-from":le()}],"mask-image-t-to-pos":[{"mask-t-to":le()}],"mask-image-t-from-color":[{"mask-t-from":H()}],"mask-image-t-to-color":[{"mask-t-to":H()}],"mask-image-r-from-pos":[{"mask-r-from":le()}],"mask-image-r-to-pos":[{"mask-r-to":le()}],"mask-image-r-from-color":[{"mask-r-from":H()}],"mask-image-r-to-color":[{"mask-r-to":H()}],"mask-image-b-from-pos":[{"mask-b-from":le()}],"mask-image-b-to-pos":[{"mask-b-to":le()}],"mask-image-b-from-color":[{"mask-b-from":H()}],"mask-image-b-to-color":[{"mask-b-to":H()}],"mask-image-l-from-pos":[{"mask-l-from":le()}],"mask-image-l-to-pos":[{"mask-l-to":le()}],"mask-image-l-from-color":[{"mask-l-from":H()}],"mask-image-l-to-color":[{"mask-l-to":H()}],"mask-image-x-from-pos":[{"mask-x-from":le()}],"mask-image-x-to-pos":[{"mask-x-to":le()}],"mask-image-x-from-color":[{"mask-x-from":H()}],"mask-image-x-to-color":[{"mask-x-to":H()}],"mask-image-y-from-pos":[{"mask-y-from":le()}],"mask-image-y-to-pos":[{"mask-y-to":le()}],"mask-image-y-from-color":[{"mask-y-from":H()}],"mask-image-y-to-color":[{"mask-y-to":H()}],"mask-image-radial":[{"mask-radial":[Me,Ae]}],"mask-image-radial-from-pos":[{"mask-radial-from":le()}],"mask-image-radial-to-pos":[{"mask-radial-to":le()}],"mask-image-radial-from-color":[{"mask-radial-from":H()}],"mask-image-radial-to-color":[{"mask-radial-to":H()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":R()}],"mask-image-conic-pos":[{"mask-conic":[ot]}],"mask-image-conic-from-pos":[{"mask-conic-from":le()}],"mask-image-conic-to-pos":[{"mask-conic-to":le()}],"mask-image-conic-from-color":[{"mask-conic-from":H()}],"mask-image-conic-to-color":[{"mask-conic-to":H()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:T()}],"mask-repeat":[{mask:G()}],"mask-size":[{mask:X()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Me,Ae]}],filter:[{filter:["","none",Me,Ae]}],blur:[{blur:be()}],brightness:[{brightness:[ot,Me,Ae]}],contrast:[{contrast:[ot,Me,Ae]}],"drop-shadow":[{"drop-shadow":["","none",b,Qh,Zh]}],"drop-shadow-color":[{"drop-shadow":H()}],grayscale:[{grayscale:["",ot,Me,Ae]}],"hue-rotate":[{"hue-rotate":[ot,Me,Ae]}],invert:[{invert:["",ot,Me,Ae]}],saturate:[{saturate:[ot,Me,Ae]}],sepia:[{sepia:["",ot,Me,Ae]}],"backdrop-filter":[{"backdrop-filter":["","none",Me,Ae]}],"backdrop-blur":[{"backdrop-blur":be()}],"backdrop-brightness":[{"backdrop-brightness":[ot,Me,Ae]}],"backdrop-contrast":[{"backdrop-contrast":[ot,Me,Ae]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ot,Me,Ae]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ot,Me,Ae]}],"backdrop-invert":[{"backdrop-invert":["",ot,Me,Ae]}],"backdrop-opacity":[{"backdrop-opacity":[ot,Me,Ae]}],"backdrop-saturate":[{"backdrop-saturate":[ot,Me,Ae]}],"backdrop-sepia":[{"backdrop-sepia":["",ot,Me,Ae]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":$()}],"border-spacing-x":[{"border-spacing-x":$()}],"border-spacing-y":[{"border-spacing-y":$()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Me,Ae]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ot,"initial",Me,Ae]}],ease:[{ease:["linear","initial",S,Me,Ae]}],delay:[{delay:[ot,Me,Ae]}],animate:[{animate:["none",E,Me,Ae]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[C,Me,Ae]}],"perspective-origin":[{"perspective-origin":A()}],rotate:[{rotate:ke()}],"rotate-x":[{"rotate-x":ke()}],"rotate-y":[{"rotate-y":ke()}],"rotate-z":[{"rotate-z":ke()}],scale:[{scale:Ee()}],"scale-x":[{"scale-x":Ee()}],"scale-y":[{"scale-y":Ee()}],"scale-z":[{"scale-z":Ee()}],"scale-3d":["scale-3d"],skew:[{skew:te()}],"skew-x":[{"skew-x":te()}],"skew-y":[{"skew-y":te()}],transform:[{transform:[Me,Ae,"","none","gpu","cpu"]}],"transform-origin":[{origin:A()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:re()}],"translate-x":[{"translate-x":re()}],"translate-y":[{"translate-y":re()}],"translate-z":[{"translate-z":re()}],"translate-none":["translate-none"],zoom:[{zoom:[sn,Me,Ae]}],accent:[{accent:H()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:H()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Me,Ae]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":H()}],"scrollbar-track-color":[{"scrollbar-track":H()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":$()}],"scroll-mx":[{"scroll-mx":$()}],"scroll-my":[{"scroll-my":$()}],"scroll-ms":[{"scroll-ms":$()}],"scroll-me":[{"scroll-me":$()}],"scroll-mbs":[{"scroll-mbs":$()}],"scroll-mbe":[{"scroll-mbe":$()}],"scroll-mt":[{"scroll-mt":$()}],"scroll-mr":[{"scroll-mr":$()}],"scroll-mb":[{"scroll-mb":$()}],"scroll-ml":[{"scroll-ml":$()}],"scroll-p":[{"scroll-p":$()}],"scroll-px":[{"scroll-px":$()}],"scroll-py":[{"scroll-py":$()}],"scroll-ps":[{"scroll-ps":$()}],"scroll-pe":[{"scroll-pe":$()}],"scroll-pbs":[{"scroll-pbs":$()}],"scroll-pbe":[{"scroll-pbe":$()}],"scroll-pt":[{"scroll-pt":$()}],"scroll-pr":[{"scroll-pr":$()}],"scroll-pb":[{"scroll-pb":$()}],"scroll-pl":[{"scroll-pl":$()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Me,Ae]}],fill:[{fill:["none",...H()]}],"stroke-w":[{stroke:[ot,xu,To,wC]}],stroke:[{stroke:["none",...H()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},vR=zI(oz);function et(...e){return vR(D0(e))}const kC=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,EC=D0,_R=(e,t)=>r=>{var s;if((t==null?void 0:t.variants)==null)return EC(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:n,defaultVariants:l}=t,u=Object.keys(n).map(f=>{const v=r==null?void 0:r[f],p=l==null?void 0:l[f];if(v===null)return null;const x=kC(v)||kC(p);return n[f][x]}),d=r&&Object.entries(r).reduce((f,v)=>{let[p,x]=v;return x===void 0||(f[p]=x),f},{}),m=t==null||(s=t.compoundVariants)===null||s===void 0?void 0:s.reduce((f,v)=>{let{class:p,className:x,...b}=v;return Object.entries(b).every(w=>{let[C,k]=w;return Array.isArray(k)?k.includes({...l,...d}[C]):{...l,...d}[C]===k})?[...f,p,x]:f},[]);return EC(e,u,m,r==null?void 0:r.class,r==null?void 0:r.className)},lz=_R("group/button inline-flex shrink-0 items-center justify-center whitespace-nowrap rounded-lg border border-transparent bg-clip-padding text-sm font-medium transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)]","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}}),ne=g.forwardRef(({className:e,variant:t,size:r,asChild:s=!1,...n},l)=>{const u=s?IB:"button";return o.jsx(u,{ref:l,"data-slot":"button","data-variant":t??"default","data-size":r??"default",className:et(lz({variant:t,size:r,className:e})),...n})});ne.displayName="Button";function ki(e){return o.jsx(gI,{"data-slot":"alert-dialog",...e})}const wn=g.forwardRef((e,t)=>o.jsx(KE,{ref:t,"data-slot":"alert-dialog-trigger",...e}));wn.displayName=KE.displayName;function cz(e){return o.jsx(vI,{"data-slot":"alert-dialog-portal",...e})}const xR=g.forwardRef(({className:e,...t},r)=>o.jsx(XE,{ref:r,"data-slot":"alert-dialog-overlay",className:et("fixed inset-0 z-50 bg-black/10 duration-100 supports-[backdrop-filter]:backdrop-blur-xs data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0",e),...t}));xR.displayName=XE.displayName;const Xs=g.forwardRef(({className:e,size:t="default",...r},s)=>o.jsxs(cz,{children:[o.jsx(xR,{}),o.jsx(ZE,{ref:s,"data-slot":"alert-dialog-content","data-size":t,className:et("group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-[calc(100%-2rem)] min-w-0 -translate-x-1/2 -translate-y-1/2 grid-cols-1 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 [&>*]:min-w-0",e),...r})]}));Xs.displayName=ZE.displayName;function Ei({className:e,...t}){return o.jsx("div",{"data-slot":"alert-dialog-header",className:et("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",e),...t})}function Ri({className:e,...t}){return o.jsx("div",{"data-slot":"alert-dialog-footer",className:et("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",e),...t})}function yR({className:e,...t}){return o.jsx("div",{"data-slot":"alert-dialog-media",className:et("mb-2 inline-flex size-10 items-center justify-center rounded-md bg-muted sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-6",e),...t})}const Zs=g.forwardRef(({className:e,...t},r)=>o.jsx(eR,{ref:r,"data-slot":"alert-dialog-title",className:et("text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",e),...t}));Zs.displayName=eR.displayName;const Qs=g.forwardRef(({className:e,...t},r)=>o.jsx(tR,{ref:r,"data-slot":"alert-dialog-description",className:et("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t}));Qs.displayName=tR.displayName;const Ni=g.forwardRef(({className:e,variant:t="default",size:r="default",...s},n)=>o.jsx(ne,{variant:t,size:r,asChild:!0,children:o.jsx(QE,{ref:n,"data-slot":"alert-dialog-action",className:et(e),...s})}));Ni.displayName=QE.displayName;const Js=g.forwardRef(({className:e,variant:t="outline",size:r="default",...s},n)=>o.jsx(ne,{variant:t,size:r,asChild:!0,children:o.jsx(JE,{ref:n,"data-slot":"alert-dialog-cancel",className:et(e),...s})}));Js.displayName=JE.displayName;function oa(e){return o.jsx(j0,{"data-slot":"dialog",...e})}const bR=g.forwardRef((e,t)=>o.jsx(Tm,{ref:t,"data-slot":"dialog-trigger",...e}));bR.displayName=Tm.displayName;function uz(e){return o.jsx(M0,{"data-slot":"dialog-portal",...e})}const B0=g.forwardRef((e,t)=>o.jsx(tl,{ref:t,"data-slot":"dialog-close",...e}));B0.displayName=tl.displayName;const wR=g.forwardRef(({className:e,...t},r)=>o.jsx(Dm,{ref:r,"data-slot":"dialog-overlay",className:et("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-[backdrop-filter]:backdrop-blur-xs data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0",e),...t}));wR.displayName=Dm.displayName;const Sn=g.forwardRef(({className:e,children:t,showCloseButton:r=!0,...s},n)=>o.jsxs(uz,{children:[o.jsx(wR,{}),o.jsxs(Lm,{ref:n,"data-slot":"dialog-content",className:et("fixed top-1/2 left-1/2 z-50 grid w-full min-w-0 max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 grid-cols-1 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 [&>*]:min-w-0",e),...s,children:[t,r&&o.jsx(tl,{"data-slot":"dialog-close",asChild:!0,children:o.jsxs(ne,{variant:"ghost",size:"icon-sm",className:"absolute top-2 right-2",children:[o.jsx(_n,{"aria-hidden":"true"}),o.jsx("span",{className:"sr-only",children:"Close"})]})})]})]}));Sn.displayName=Lm.displayName;function la({className:e,...t}){return o.jsx("div",{"data-slot":"dialog-header",className:et("flex flex-col gap-2",e),...t})}function ca({className:e,showCloseButton:t=!1,children:r,...s}){return o.jsxs("div",{"data-slot":"dialog-footer",className:et("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",e),...s,children:[r,t&&o.jsx(tl,{asChild:!0,children:o.jsx(ne,{variant:"outline",children:"Close"})})]})}const Cn=g.forwardRef(({className:e,...t},r)=>o.jsx(Om,{ref:r,"data-slot":"dialog-title",className:et("text-base leading-none font-medium",e),...t}));Cn.displayName=Om.displayName;const sl=g.forwardRef(({className:e,...t},r)=>o.jsx(Bm,{ref:r,"data-slot":"dialog-description",className:et("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t}));sl.displayName=Bm.displayName;function P0(e){const t=e+"CollectionProvider",[r,s]=Gi(t),[n,l]=r(t,{collectionRef:{current:null},itemMap:new Map}),u=C=>{const{scope:k,children:S}=C,E=g.useRef(null),N=g.useRef(new Map).current;return o.jsx(n,{scope:k,itemMap:N,collectionRef:E,children:S})};u.displayName=t;const d=e+"CollectionSlot",m=Ko(d),f=g.forwardRef((C,k)=>{const{scope:S,children:E}=C,N=l(d,S),R=ut(k,N.collectionRef);return o.jsx(m,{ref:R,children:E})});f.displayName=d;const v=e+"CollectionItemSlot",p="data-radix-collection-item",x=Ko(v),b=g.forwardRef((C,k)=>{const{scope:S,children:E,...N}=C,R=g.useRef(null),A=ut(k,R),D=l(v,S);return g.useEffect(()=>(D.itemMap.set(R,{ref:R,...N}),()=>void D.itemMap.delete(R))),o.jsx(x,{[p]:"",ref:A,children:E})});b.displayName=v;function w(C){const k=l(e+"CollectionConsumer",C);return g.useCallback(()=>{const E=k.collectionRef.current;if(!E)return[];const N=Array.from(E.querySelectorAll(`[${p}]`));return Array.from(k.itemMap.values()).sort((D,B)=>N.indexOf(D.ref.current)-N.indexOf(B.ref.current))},[k.collectionRef,k.itemMap])}return[{Provider:u,Slot:f,ItemSlot:b},w,s]}var dz=g.createContext(void 0);function gd(e){const t=g.useContext(dz);return e||t||"ltr"}const hz=["top","right","bottom","left"],to=Math.min,Ws=Math.max,Zf=Math.round,Jh=Math.floor,pn=e=>({x:e,y:e}),fz={left:"right",right:"left",bottom:"top",top:"bottom"};function F_(e,t,r){return Ws(e,to(t,r))}function ra(e,t){return typeof e=="function"?e(t):e}function sa(e){return e.split("-")[0]}function xc(e){return e.split("-")[1]}function I0(e){return e==="x"?"y":"x"}function z0(e){return e==="y"?"height":"width"}function fn(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function $0(e){return I0(fn(e))}function mz(e,t,r){r===void 0&&(r=!1);const s=xc(e),n=$0(e),l=z0(n);let u=n==="x"?s===(r?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(u=Qf(u)),[u,Qf(u)]}function pz(e){const t=Qf(e);return[W_(e),t,W_(t)]}function W_(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const RC=["left","right"],NC=["right","left"],gz=["top","bottom"],vz=["bottom","top"];function _z(e,t,r){switch(e){case"top":case"bottom":return r?t?NC:RC:t?RC:NC;case"left":case"right":return t?gz:vz;default:return[]}}function xz(e,t,r,s){const n=xc(e);let l=_z(sa(e),r==="start",s);return n&&(l=l.map(u=>u+"-"+n),t&&(l=l.concat(l.map(W_)))),l}function Qf(e){const t=sa(e);return fz[t]+e.slice(t.length)}function yz(e){return{top:0,right:0,bottom:0,left:0,...e}}function SR(e){return typeof e!="number"?yz(e):{top:e,right:e,bottom:e,left:e}}function Jf(e){const{x:t,y:r,width:s,height:n}=e;return{width:s,height:n,top:r,left:t,right:t+s,bottom:r+n,x:t,y:r}}function jC(e,t,r){let{reference:s,floating:n}=e;const l=fn(t),u=$0(t),d=z0(u),m=sa(t),f=l==="y",v=s.x+s.width/2-n.width/2,p=s.y+s.height/2-n.height/2,x=s[d]/2-n[d]/2;let b;switch(m){case"top":b={x:v,y:s.y-n.height};break;case"bottom":b={x:v,y:s.y+s.height};break;case"right":b={x:s.x+s.width,y:p};break;case"left":b={x:s.x-n.width,y:p};break;default:b={x:s.x,y:s.y}}switch(xc(t)){case"start":b[u]-=x*(r&&f?-1:1);break;case"end":b[u]+=x*(r&&f?-1:1);break}return b}async function bz(e,t){var r;t===void 0&&(t={});const{x:s,y:n,platform:l,rects:u,elements:d,strategy:m}=e,{boundary:f="clippingAncestors",rootBoundary:v="viewport",elementContext:p="floating",altBoundary:x=!1,padding:b=0}=ra(t,e),w=SR(b),k=d[x?p==="floating"?"reference":"floating":p],S=Jf(await l.getClippingRect({element:(r=await(l.isElement==null?void 0:l.isElement(k)))==null||r?k:k.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(d.floating)),boundary:f,rootBoundary:v,strategy:m})),E=p==="floating"?{x:s,y:n,width:u.floating.width,height:u.floating.height}:u.reference,N=await(l.getOffsetParent==null?void 0:l.getOffsetParent(d.floating)),R=await(l.isElement==null?void 0:l.isElement(N))?await(l.getScale==null?void 0:l.getScale(N))||{x:1,y:1}:{x:1,y:1},A=Jf(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:E,offsetParent:N,strategy:m}):E);return{top:(S.top-A.top+w.top)/R.y,bottom:(A.bottom-S.bottom+w.bottom)/R.y,left:(S.left-A.left+w.left)/R.x,right:(A.right-S.right+w.right)/R.x}}const wz=50,Sz=async(e,t,r)=>{const{placement:s="bottom",strategy:n="absolute",middleware:l=[],platform:u}=r,d=u.detectOverflow?u:{...u,detectOverflow:bz},m=await(u.isRTL==null?void 0:u.isRTL(t));let f=await u.getElementRects({reference:e,floating:t,strategy:n}),{x:v,y:p}=jC(f,s,m),x=s,b=0;const w={};for(let C=0;C<l.length;C++){const k=l[C];if(!k)continue;const{name:S,fn:E}=k,{x:N,y:R,data:A,reset:D}=await E({x:v,y:p,initialPlacement:s,placement:x,strategy:n,middlewareData:w,rects:f,platform:d,elements:{reference:e,floating:t}});v=N??v,p=R??p,w[S]={...w[S],...A},D&&b<wz&&(b++,typeof D=="object"&&(D.placement&&(x=D.placement),D.rects&&(f=D.rects===!0?await u.getElementRects({reference:e,floating:t,strategy:n}):D.rects),{x:v,y:p}=jC(f,x,m)),C=-1)}return{x:v,y:p,placement:x,strategy:n,middlewareData:w}},Cz=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:s,placement:n,rects:l,platform:u,elements:d,middlewareData:m}=t,{element:f,padding:v=0}=ra(e,t)||{};if(f==null)return{};const p=SR(v),x={x:r,y:s},b=$0(n),w=z0(b),C=await u.getDimensions(f),k=b==="y",S=k?"top":"left",E=k?"bottom":"right",N=k?"clientHeight":"clientWidth",R=l.reference[w]+l.reference[b]-x[b]-l.floating[w],A=x[b]-l.reference[b],D=await(u.getOffsetParent==null?void 0:u.getOffsetParent(f));let B=D?D[N]:0;(!B||!await(u.isElement==null?void 0:u.isElement(D)))&&(B=d.floating[N]||l.floating[w]);const $=R/2-A/2,q=B/2-C[w]/2-1,Y=to(p[S],q),V=to(p[E],q),U=Y,L=B-C[w]-V,I=B/2-C[w]/2+$,F=F_(U,I,L),M=!m.arrow&&xc(n)!=null&&I!==F&&l.reference[w]/2-(I<U?Y:V)-C[w]/2<0,P=M?I<U?I-U:I-L:0;return{[b]:x[b]+P,data:{[b]:F,centerOffset:I-F-P,...M&&{alignmentOffset:P}},reset:M}}}),kz=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,s;const{placement:n,middlewareData:l,rects:u,initialPlacement:d,platform:m,elements:f}=t,{mainAxis:v=!0,crossAxis:p=!0,fallbackPlacements:x,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:C=!0,...k}=ra(e,t);if((r=l.arrow)!=null&&r.alignmentOffset)return{};const S=sa(n),E=fn(d),N=sa(d)===d,R=await(m.isRTL==null?void 0:m.isRTL(f.floating)),A=x||(N||!C?[Qf(d)]:pz(d)),D=w!=="none";!x&&D&&A.push(...xz(d,C,w,R));const B=[d,...A],$=await m.detectOverflow(t,k),q=[];let Y=((s=l.flip)==null?void 0:s.overflows)||[];if(v&&q.push($[S]),p){const I=mz(n,u,R);q.push($[I[0]],$[I[1]])}if(Y=[...Y,{placement:n,overflows:q}],!q.every(I=>I<=0)){var V,U;const I=(((V=l.flip)==null?void 0:V.index)||0)+1,F=B[I];if(F&&(!(p==="alignment"?E!==fn(F):!1)||Y.every(O=>fn(O.placement)===E?O.overflows[0]>0:!0)))return{data:{index:I,overflows:Y},reset:{placement:F}};let M=(U=Y.filter(P=>P.overflows[0]<=0).sort((P,O)=>P.overflows[1]-O.overflows[1])[0])==null?void 0:U.placement;if(!M)switch(b){case"bestFit":{var L;const P=(L=Y.filter(O=>{if(D){const W=fn(O.placement);return W===E||W==="y"}return!0}).map(O=>[O.placement,O.overflows.filter(W=>W>0).reduce((W,H)=>W+H,0)]).sort((O,W)=>O[1]-W[1])[0])==null?void 0:L[0];P&&(M=P);break}case"initialPlacement":M=d;break}if(n!==M)return{reset:{placement:M}}}return{}}}};function AC(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function MC(e){return hz.some(t=>e[t]>=0)}const Ez=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:s}=t,{strategy:n="referenceHidden",...l}=ra(e,t);switch(n){case"referenceHidden":{const u=await s.detectOverflow(t,{...l,elementContext:"reference"}),d=AC(u,r.reference);return{data:{referenceHiddenOffsets:d,referenceHidden:MC(d)}}}case"escaped":{const u=await s.detectOverflow(t,{...l,altBoundary:!0}),d=AC(u,r.floating);return{data:{escapedOffsets:d,escaped:MC(d)}}}default:return{}}}}},CR=new Set(["left","top"]);async function Rz(e,t){const{placement:r,platform:s,elements:n}=e,l=await(s.isRTL==null?void 0:s.isRTL(n.floating)),u=sa(r),d=xc(r),m=fn(r)==="y",f=CR.has(u)?-1:1,v=l&&m?-1:1,p=ra(t,e);let{mainAxis:x,crossAxis:b,alignmentAxis:w}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return d&&typeof w=="number"&&(b=d==="end"?w*-1:w),m?{x:b*v,y:x*f}:{x:x*f,y:b*v}}const Nz=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,s;const{x:n,y:l,placement:u,middlewareData:d}=t,m=await Rz(t,e);return u===((r=d.offset)==null?void 0:r.placement)&&(s=d.arrow)!=null&&s.alignmentOffset?{}:{x:n+m.x,y:l+m.y,data:{...m,placement:u}}}}},jz=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:s,placement:n,platform:l}=t,{mainAxis:u=!0,crossAxis:d=!1,limiter:m={fn:S=>{let{x:E,y:N}=S;return{x:E,y:N}}},...f}=ra(e,t),v={x:r,y:s},p=await l.detectOverflow(t,f),x=fn(sa(n)),b=I0(x);let w=v[b],C=v[x];if(u){const S=b==="y"?"top":"left",E=b==="y"?"bottom":"right",N=w+p[S],R=w-p[E];w=F_(N,w,R)}if(d){const S=x==="y"?"top":"left",E=x==="y"?"bottom":"right",N=C+p[S],R=C-p[E];C=F_(N,C,R)}const k=m.fn({...t,[b]:w,[x]:C});return{...k,data:{x:k.x-r,y:k.y-s,enabled:{[b]:u,[x]:d}}}}}},Az=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:s,placement:n,rects:l,middlewareData:u}=t,{offset:d=0,mainAxis:m=!0,crossAxis:f=!0}=ra(e,t),v={x:r,y:s},p=fn(n),x=I0(p);let b=v[x],w=v[p];const C=ra(d,t),k=typeof C=="number"?{mainAxis:C,crossAxis:0}:{mainAxis:0,crossAxis:0,...C};if(m){const N=x==="y"?"height":"width",R=l.reference[x]-l.floating[N]+k.mainAxis,A=l.reference[x]+l.reference[N]-k.mainAxis;b<R?b=R:b>A&&(b=A)}if(f){var S,E;const N=x==="y"?"width":"height",R=CR.has(sa(n)),A=l.reference[p]-l.floating[N]+(R&&((S=u.offset)==null?void 0:S[p])||0)+(R?0:k.crossAxis),D=l.reference[p]+l.reference[N]+(R?0:((E=u.offset)==null?void 0:E[p])||0)-(R?k.crossAxis:0);w<A?w=A:w>D&&(w=D)}return{[x]:b,[p]:w}}}},Mz=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,s;const{placement:n,rects:l,platform:u,elements:d}=t,{apply:m=()=>{},...f}=ra(e,t),v=await u.detectOverflow(t,f),p=sa(n),x=xc(n),b=fn(n)==="y",{width:w,height:C}=l.floating;let k,S;p==="top"||p==="bottom"?(k=p,S=x===(await(u.isRTL==null?void 0:u.isRTL(d.floating))?"start":"end")?"left":"right"):(S=p,k=x==="end"?"top":"bottom");const E=C-v.top-v.bottom,N=w-v.left-v.right,R=to(C-v[k],E),A=to(w-v[S],N),D=!t.middlewareData.shift;let B=R,$=A;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&($=N),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(B=E),D&&!x){const Y=Ws(v.left,0),V=Ws(v.right,0),U=Ws(v.top,0),L=Ws(v.bottom,0);b?$=w-2*(Y!==0||V!==0?Y+V:Ws(v.left,v.right)):B=C-2*(U!==0||L!==0?U+L:Ws(v.top,v.bottom))}await m({...t,availableWidth:$,availableHeight:B});const q=await u.getDimensions(d.floating);return w!==q.width||C!==q.height?{reset:{rects:!0}}:{}}}};function Pm(){return typeof window<"u"}function yc(e){return kR(e)?(e.nodeName||"").toLowerCase():"#document"}function Gs(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function kn(e){var t;return(t=(kR(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function kR(e){return Pm()?e instanceof Node||e instanceof Gs(e).Node:!1}function Fi(e){return Pm()?e instanceof Element||e instanceof Gs(e).Element:!1}function ua(e){return Pm()?e instanceof HTMLElement||e instanceof Gs(e).HTMLElement:!1}function TC(e){return!Pm()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Gs(e).ShadowRoot}function vd(e){const{overflow:t,overflowX:r,overflowY:s,display:n}=Wi(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+r)&&n!=="inline"&&n!=="contents"}function Tz(e){return/^(table|td|th)$/.test(yc(e))}function Im(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Dz=/transform|translate|scale|rotate|perspective|filter/,Lz=/paint|layout|strict|content/,Do=e=>!!e&&e!=="none";let Lv;function U0(e){const t=Fi(e)?Wi(e):e;return Do(t.transform)||Do(t.translate)||Do(t.scale)||Do(t.rotate)||Do(t.perspective)||!H0()&&(Do(t.backdropFilter)||Do(t.filter))||Dz.test(t.willChange||"")||Lz.test(t.contain||"")}function Oz(e){let t=ro(e);for(;ua(t)&&!hc(t);){if(U0(t))return t;if(Im(t))return null;t=ro(t)}return null}function H0(){return Lv==null&&(Lv=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Lv}function hc(e){return/^(html|body|#document)$/.test(yc(e))}function Wi(e){return Gs(e).getComputedStyle(e)}function zm(e){return Fi(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ro(e){if(yc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||TC(e)&&e.host||kn(e);return TC(t)?t.host:t}function ER(e){const t=ro(e);return hc(t)?e.ownerDocument?e.ownerDocument.body:e.body:ua(t)&&vd(t)?t:ER(t)}function Zu(e,t,r){var s;t===void 0&&(t=[]),r===void 0&&(r=!0);const n=ER(e),l=n===((s=e.ownerDocument)==null?void 0:s.body),u=Gs(n);if(l){const d=q_(u);return t.concat(u,u.visualViewport||[],vd(n)?n:[],d&&r?Zu(d):[])}else return t.concat(n,Zu(n,[],r))}function q_(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function RR(e){const t=Wi(e);let r=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const n=ua(e),l=n?e.offsetWidth:r,u=n?e.offsetHeight:s,d=Zf(r)!==l||Zf(s)!==u;return d&&(r=l,s=u),{width:r,height:s,$:d}}function F0(e){return Fi(e)?e:e.contextElement}function lc(e){const t=F0(e);if(!ua(t))return pn(1);const r=t.getBoundingClientRect(),{width:s,height:n,$:l}=RR(t);let u=(l?Zf(r.width):r.width)/s,d=(l?Zf(r.height):r.height)/n;return(!u||!Number.isFinite(u))&&(u=1),(!d||!Number.isFinite(d))&&(d=1),{x:u,y:d}}const Bz=pn(0);function NR(e){const t=Gs(e);return!H0()||!t.visualViewport?Bz:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Pz(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Gs(e)?!1:t}function Xo(e,t,r,s){t===void 0&&(t=!1),r===void 0&&(r=!1);const n=e.getBoundingClientRect(),l=F0(e);let u=pn(1);t&&(s?Fi(s)&&(u=lc(s)):u=lc(e));const d=Pz(l,r,s)?NR(l):pn(0);let m=(n.left+d.x)/u.x,f=(n.top+d.y)/u.y,v=n.width/u.x,p=n.height/u.y;if(l){const x=Gs(l),b=s&&Fi(s)?Gs(s):s;let w=x,C=q_(w);for(;C&&s&&b!==w;){const k=lc(C),S=C.getBoundingClientRect(),E=Wi(C),N=S.left+(C.clientLeft+parseFloat(E.paddingLeft))*k.x,R=S.top+(C.clientTop+parseFloat(E.paddingTop))*k.y;m*=k.x,f*=k.y,v*=k.x,p*=k.y,m+=N,f+=R,w=Gs(C),C=q_(w)}}return Jf({width:v,height:p,x:m,y:f})}function $m(e,t){const r=zm(e).scrollLeft;return t?t.left+r:Xo(kn(e)).left+r}function jR(e,t){const r=e.getBoundingClientRect(),s=r.left+t.scrollLeft-$m(e,r),n=r.top+t.scrollTop;return{x:s,y:n}}function Iz(e){let{elements:t,rect:r,offsetParent:s,strategy:n}=e;const l=n==="fixed",u=kn(s),d=t?Im(t.floating):!1;if(s===u||d&&l)return r;let m={scrollLeft:0,scrollTop:0},f=pn(1);const v=pn(0),p=ua(s);if((p||!p&&!l)&&((yc(s)!=="body"||vd(u))&&(m=zm(s)),p)){const b=Xo(s);f=lc(s),v.x=b.x+s.clientLeft,v.y=b.y+s.clientTop}const x=u&&!p&&!l?jR(u,m):pn(0);return{width:r.width*f.x,height:r.height*f.y,x:r.x*f.x-m.scrollLeft*f.x+v.x+x.x,y:r.y*f.y-m.scrollTop*f.y+v.y+x.y}}function zz(e){return Array.from(e.getClientRects())}function $z(e){const t=kn(e),r=zm(e),s=e.ownerDocument.body,n=Ws(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),l=Ws(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let u=-r.scrollLeft+$m(e);const d=-r.scrollTop;return Wi(s).direction==="rtl"&&(u+=Ws(t.clientWidth,s.clientWidth)-n),{width:n,height:l,x:u,y:d}}const DC=25;function Uz(e,t){const r=Gs(e),s=kn(e),n=r.visualViewport;let l=s.clientWidth,u=s.clientHeight,d=0,m=0;if(n){l=n.width,u=n.height;const v=H0();(!v||v&&t==="fixed")&&(d=n.offsetLeft,m=n.offsetTop)}const f=$m(s);if(f<=0){const v=s.ownerDocument,p=v.body,x=getComputedStyle(p),b=v.compatMode==="CSS1Compat"&&parseFloat(x.marginLeft)+parseFloat(x.marginRight)||0,w=Math.abs(s.clientWidth-p.clientWidth-b);w<=DC&&(l-=w)}else f<=DC&&(l+=f);return{width:l,height:u,x:d,y:m}}function Hz(e,t){const r=Xo(e,!0,t==="fixed"),s=r.top+e.clientTop,n=r.left+e.clientLeft,l=ua(e)?lc(e):pn(1),u=e.clientWidth*l.x,d=e.clientHeight*l.y,m=n*l.x,f=s*l.y;return{width:u,height:d,x:m,y:f}}function LC(e,t,r){let s;if(t==="viewport")s=Uz(e,r);else if(t==="document")s=$z(kn(e));else if(Fi(t))s=Hz(t,r);else{const n=NR(e);s={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Jf(s)}function AR(e,t){const r=ro(e);return r===t||!Fi(r)||hc(r)?!1:Wi(r).position==="fixed"||AR(r,t)}function Fz(e,t){const r=t.get(e);if(r)return r;let s=Zu(e,[],!1).filter(d=>Fi(d)&&yc(d)!=="body"),n=null;const l=Wi(e).position==="fixed";let u=l?ro(e):e;for(;Fi(u)&&!hc(u);){const d=Wi(u),m=U0(u);!m&&d.position==="fixed"&&(n=null),(l?!m&&!n:!m&&d.position==="static"&&!!n&&(n.position==="absolute"||n.position==="fixed")||vd(u)&&!m&&AR(e,u))?s=s.filter(v=>v!==u):n=d,u=ro(u)}return t.set(e,s),s}function Wz(e){let{element:t,boundary:r,rootBoundary:s,strategy:n}=e;const u=[...r==="clippingAncestors"?Im(t)?[]:Fz(t,this._c):[].concat(r),s],d=LC(t,u[0],n);let m=d.top,f=d.right,v=d.bottom,p=d.left;for(let x=1;x<u.length;x++){const b=LC(t,u[x],n);m=Ws(b.top,m),f=to(b.right,f),v=to(b.bottom,v),p=Ws(b.left,p)}return{width:f-p,height:v-m,x:p,y:m}}function qz(e){const{width:t,height:r}=RR(e);return{width:t,height:r}}function Vz(e,t,r){const s=ua(t),n=kn(t),l=r==="fixed",u=Xo(e,!0,l,t);let d={scrollLeft:0,scrollTop:0};const m=pn(0);function f(){m.x=$m(n)}if(s||!s&&!l)if((yc(t)!=="body"||vd(n))&&(d=zm(t)),s){const b=Xo(t,!0,l,t);m.x=b.x+t.clientLeft,m.y=b.y+t.clientTop}else n&&f();l&&!s&&n&&f();const v=n&&!s&&!l?jR(n,d):pn(0),p=u.left+d.scrollLeft-m.x-v.x,x=u.top+d.scrollTop-m.y-v.y;return{x:p,y:x,width:u.width,height:u.height}}function Ov(e){return Wi(e).position==="static"}function OC(e,t){if(!ua(e)||Wi(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return kn(e)===r&&(r=r.ownerDocument.body),r}function MR(e,t){const r=Gs(e);if(Im(e))return r;if(!ua(e)){let n=ro(e);for(;n&&!hc(n);){if(Fi(n)&&!Ov(n))return n;n=ro(n)}return r}let s=OC(e,t);for(;s&&Tz(s)&&Ov(s);)s=OC(s,t);return s&&hc(s)&&Ov(s)&&!U0(s)?r:s||Oz(e)||r}const Gz=async function(e){const t=this.getOffsetParent||MR,r=this.getDimensions,s=await r(e.floating);return{reference:Vz(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function Yz(e){return Wi(e).direction==="rtl"}const Kz={convertOffsetParentRelativeRectToViewportRelativeRect:Iz,getDocumentElement:kn,getClippingRect:Wz,getOffsetParent:MR,getElementRects:Gz,getClientRects:zz,getDimensions:qz,getScale:lc,isElement:Fi,isRTL:Yz};function TR(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Xz(e,t){let r=null,s;const n=kn(e);function l(){var d;clearTimeout(s),(d=r)==null||d.disconnect(),r=null}function u(d,m){d===void 0&&(d=!1),m===void 0&&(m=1),l();const f=e.getBoundingClientRect(),{left:v,top:p,width:x,height:b}=f;if(d||t(),!x||!b)return;const w=Jh(p),C=Jh(n.clientWidth-(v+x)),k=Jh(n.clientHeight-(p+b)),S=Jh(v),N={rootMargin:-w+"px "+-C+"px "+-k+"px "+-S+"px",threshold:Ws(0,to(1,m))||1};let R=!0;function A(D){const B=D[0].intersectionRatio;if(B!==m){if(!R)return u();B?u(!1,B):s=setTimeout(()=>{u(!1,1e-7)},1e3)}B===1&&!TR(f,e.getBoundingClientRect())&&u(),R=!1}try{r=new IntersectionObserver(A,{...N,root:n.ownerDocument})}catch{r=new IntersectionObserver(A,N)}r.observe(e)}return u(!0),l}function Zz(e,t,r,s){s===void 0&&(s={});const{ancestorScroll:n=!0,ancestorResize:l=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:m=!1}=s,f=F0(e),v=n||l?[...f?Zu(f):[],...t?Zu(t):[]]:[];v.forEach(S=>{n&&S.addEventListener("scroll",r,{passive:!0}),l&&S.addEventListener("resize",r)});const p=f&&d?Xz(f,r):null;let x=-1,b=null;u&&(b=new ResizeObserver(S=>{let[E]=S;E&&E.target===f&&b&&t&&(b.unobserve(t),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{var N;(N=b)==null||N.observe(t)})),r()}),f&&!m&&b.observe(f),t&&b.observe(t));let w,C=m?Xo(e):null;m&&k();function k(){const S=Xo(e);C&&!TR(C,S)&&r(),C=S,w=requestAnimationFrame(k)}return r(),()=>{var S;v.forEach(E=>{n&&E.removeEventListener("scroll",r),l&&E.removeEventListener("resize",r)}),p==null||p(),(S=b)==null||S.disconnect(),b=null,m&&cancelAnimationFrame(w)}}const Qz=Nz,Jz=jz,e8=kz,t8=Mz,r8=Ez,BC=Cz,s8=Az,i8=(e,t,r)=>{const s=new Map,n={platform:Kz,...r},l={...n.platform,_c:s};return Sz(e,t,{...n,platform:l})};var n8=typeof document<"u",a8=function(){},Ef=n8?g.useLayoutEffect:a8;function em(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,s,n;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(s=r;s--!==0;)if(!em(e[s],t[s]))return!1;return!0}if(n=Object.keys(e),r=n.length,r!==Object.keys(t).length)return!1;for(s=r;s--!==0;)if(!{}.hasOwnProperty.call(t,n[s]))return!1;for(s=r;s--!==0;){const l=n[s];if(!(l==="_owner"&&e.$$typeof)&&!em(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function DR(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function PC(e,t){const r=DR(e);return Math.round(t*r)/r}function Bv(e){const t=g.useRef(e);return Ef(()=>{t.current=e}),t}function o8(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:s=[],platform:n,elements:{reference:l,floating:u}={},transform:d=!0,whileElementsMounted:m,open:f}=e,[v,p]=g.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[x,b]=g.useState(s);em(x,s)||b(s);const[w,C]=g.useState(null),[k,S]=g.useState(null),E=g.useCallback(O=>{O!==D.current&&(D.current=O,C(O))},[]),N=g.useCallback(O=>{O!==B.current&&(B.current=O,S(O))},[]),R=l||w,A=u||k,D=g.useRef(null),B=g.useRef(null),$=g.useRef(v),q=m!=null,Y=Bv(m),V=Bv(n),U=Bv(f),L=g.useCallback(()=>{if(!D.current||!B.current)return;const O={placement:t,strategy:r,middleware:x};V.current&&(O.platform=V.current),i8(D.current,B.current,O).then(W=>{const H={...W,isPositioned:U.current!==!1};I.current&&!em($.current,H)&&($.current=H,na.flushSync(()=>{p(H)}))})},[x,t,r,V,U]);Ef(()=>{f===!1&&$.current.isPositioned&&($.current.isPositioned=!1,p(O=>({...O,isPositioned:!1})))},[f]);const I=g.useRef(!1);Ef(()=>(I.current=!0,()=>{I.current=!1}),[]),Ef(()=>{if(R&&(D.current=R),A&&(B.current=A),R&&A){if(Y.current)return Y.current(R,A,L);L()}},[R,A,L,Y,q]);const F=g.useMemo(()=>({reference:D,floating:B,setReference:E,setFloating:N}),[E,N]),M=g.useMemo(()=>({reference:R,floating:A}),[R,A]),P=g.useMemo(()=>{const O={position:r,left:0,top:0};if(!M.floating)return O;const W=PC(M.floating,v.x),H=PC(M.floating,v.y);return d?{...O,transform:"translate("+W+"px, "+H+"px)",...DR(M.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:W,top:H}},[r,d,M.floating,v.x,v.y]);return g.useMemo(()=>({...v,update:L,refs:F,elements:M,floatingStyles:P}),[v,L,F,M,P])}const l8=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:s,padding:n}=typeof e=="function"?e(r):e;return s&&t(s)?s.current!=null?BC({element:s.current,padding:n}).fn(r):{}:s?BC({element:s,padding:n}).fn(r):{}}}},c8=(e,t)=>{const r=Qz(e);return{name:r.name,fn:r.fn,options:[e,t]}},u8=(e,t)=>{const r=Jz(e);return{name:r.name,fn:r.fn,options:[e,t]}},d8=(e,t)=>({fn:s8(e).fn,options:[e,t]}),h8=(e,t)=>{const r=e8(e);return{name:r.name,fn:r.fn,options:[e,t]}},f8=(e,t)=>{const r=t8(e);return{name:r.name,fn:r.fn,options:[e,t]}},m8=(e,t)=>{const r=r8(e);return{name:r.name,fn:r.fn,options:[e,t]}},p8=(e,t)=>{const r=l8(e);return{name:r.name,fn:r.fn,options:[e,t]}};var g8="Arrow",LR=g.forwardRef((e,t)=>{const{children:r,width:s=10,height:n=5,...l}=e;return o.jsx(Xe.svg,{...l,ref:t,width:s,height:n,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:o.jsx("polygon",{points:"0,0 30,0 15,10"})})});LR.displayName=g8;var v8=LR;function _8(e){const[t,r]=g.useState(void 0);return ur(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(n=>{if(!Array.isArray(n)||!n.length)return;const l=n[0];let u,d;if("borderBoxSize"in l){const m=l.borderBoxSize,f=Array.isArray(m)?m[0]:m;u=f.inlineSize,d=f.blockSize}else u=e.offsetWidth,d=e.offsetHeight;r({width:u,height:d})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else r(void 0)},[e]),t}var W0="Popper",[OR,Um]=Gi(W0),[x8,BR]=OR(W0),PR=e=>{const{__scopePopper:t,children:r}=e,[s,n]=g.useState(null),[l,u]=g.useState(void 0);return o.jsx(x8,{scope:t,anchor:s,onAnchorChange:n,placementState:l,setPlacementState:u,children:r})};PR.displayName=W0;var IR="PopperAnchor",zR=g.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:s,...n}=e,l=BR(IR,r),u=g.useRef(null),d=l.onAnchorChange,m=g.useCallback(w=>{u.current=w,w&&d(w)},[d]),f=ut(t,m),v=g.useRef(null);g.useEffect(()=>{if(!s)return;const w=v.current;v.current=s.current,w!==v.current&&d(v.current)});const p=l.placementState&&V0(l.placementState),x=p==null?void 0:p[0],b=p==null?void 0:p[1];return s?null:o.jsx(Xe.div,{"data-radix-popper-side":x,"data-radix-popper-align":b,...n,ref:f})});zR.displayName=IR;var q0="PopperContent",[y8,b8]=OR(q0),$R=g.forwardRef((e,t)=>{var ce,le,be,ke,Ee,te;const{__scopePopper:r,side:s="bottom",sideOffset:n=0,align:l="center",alignOffset:u=0,arrowPadding:d=0,avoidCollisions:m=!0,collisionBoundary:f=[],collisionPadding:v=0,sticky:p="partial",hideWhenDetached:x=!1,updatePositionStrategy:b="optimized",onPlaced:w,...C}=e,k=BR(q0,r),[S,E]=g.useState(null),N=ut(t,E),[R,A]=g.useState(null),D=_8(R),B=(D==null?void 0:D.width)??0,$=(D==null?void 0:D.height)??0,q=s+(l!=="center"?"-"+l:""),Y=typeof v=="number"?v:{top:0,right:0,bottom:0,left:0,...v},V=Array.isArray(f)?f:[f],U=V.length>0,L={padding:Y,boundary:V.filter(S8),altBoundary:U},{refs:I,floatingStyles:F,placement:M,isPositioned:P,middlewareData:O}=o8({strategy:"fixed",placement:q,whileElementsMounted:(...re)=>Zz(...re,{animationFrame:b==="always"}),elements:{reference:k.anchor},middleware:[c8({mainAxis:n+$,alignmentAxis:u}),m&&u8({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?d8():void 0,...L}),m&&h8({...L}),f8({...L,apply:({elements:re,rects:Ce,availableWidth:De,availableHeight:_e})=>{const{width:Re,height:Pe}=Ce.reference,Ue=re.floating.style;Ue.setProperty("--radix-popper-available-width",`${De}px`),Ue.setProperty("--radix-popper-available-height",`${_e}px`),Ue.setProperty("--radix-popper-anchor-width",`${Re}px`),Ue.setProperty("--radix-popper-anchor-height",`${Pe}px`)}}),R&&p8({element:R,padding:d}),C8({arrowWidth:B,arrowHeight:$}),x&&m8({strategy:"referenceHidden",...L,boundary:U?L.boundary:void 0})]}),W=k.setPlacementState;ur(()=>(W(M),()=>{W(void 0)}),[M,W]);const[H,T]=V0(M),G=Er(w);ur(()=>{P&&(G==null||G())},[P,G]);const X=(ce=O.arrow)==null?void 0:ce.x,ee=(le=O.arrow)==null?void 0:le.y,oe=((be=O.arrow)==null?void 0:be.centerOffset)!==0,[de,Z]=g.useState();return ur(()=>{S&&Z(window.getComputedStyle(S).zIndex)},[S]),o.jsx("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{...F,transform:P?F.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:de,"--radix-popper-transform-origin":[(ke=O.transformOrigin)==null?void 0:ke.x,(Ee=O.transformOrigin)==null?void 0:Ee.y].join(" "),...((te=O.hide)==null?void 0:te.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:o.jsx(y8,{scope:r,placedSide:H,placedAlign:T,onArrowChange:A,arrowX:X,arrowY:ee,shouldHideArrow:oe,children:o.jsx(Xe.div,{"data-side":H,"data-align":T,...C,ref:N,style:{...C.style,animation:P?void 0:"none"}})})})});$R.displayName=q0;var UR="PopperArrow",w8={top:"bottom",right:"left",bottom:"top",left:"right"},HR=g.forwardRef(function(t,r){const{__scopePopper:s,...n}=t,l=b8(UR,s),u=w8[l.placedSide];return o.jsx("span",{ref:l.onArrowChange,style:{position:"absolute",left:l.arrowX,top:l.arrowY,[u]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[l.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[l.placedSide],visibility:l.shouldHideArrow?"hidden":void 0},children:o.jsx(v8,{...n,ref:r,style:{...n.style,display:"block"}})})});HR.displayName=UR;function S8(e){return e!==null}var C8=e=>({name:"transformOrigin",options:e,fn(t){var k,S,E;const{placement:r,rects:s,middlewareData:n}=t,u=((k=n.arrow)==null?void 0:k.centerOffset)!==0,d=u?0:e.arrowWidth,m=u?0:e.arrowHeight,[f,v]=V0(r),p={start:"0%",center:"50%",end:"100%"}[v],x=(((S=n.arrow)==null?void 0:S.x)??0)+d/2,b=(((E=n.arrow)==null?void 0:E.y)??0)+m/2;let w="",C="";return f==="bottom"?(w=u?p:`${x}px`,C=`${-m}px`):f==="top"?(w=u?p:`${x}px`,C=`${s.floating.height+m}px`):f==="right"?(w=`${-m}px`,C=u?p:`${b}px`):f==="left"&&(w=`${s.floating.width+m}px`,C=u?p:`${b}px`),{data:{x:w,y:C}}}});function V0(e){const[t,r="center"]=e.split("-");return[t,r]}var G0=PR,FR=zR,WR=$R,qR=HR,Pv=!1;function k8(){const[e,t]=g.useState(Pv);return g.useEffect(()=>{Pv||(Pv=!0,t(!0))},[]),e}var VR=no[" useSyncExternalStore ".trim().toString()];function E8(){return()=>{}}function R8(){return VR(E8,()=>!0,()=>!1)}var N8=typeof VR=="function"?R8:k8,Iv="rovingFocusGroup.onEntryFocus",j8={bubbles:!1,cancelable:!0},_d="RovingFocusGroup",[V_,GR,A8]=P0(_d),[M8,Hm]=Gi(_d,[A8]),[T8,D8]=M8(_d),YR=g.forwardRef((e,t)=>o.jsx(V_.Provider,{scope:e.__scopeRovingFocusGroup,children:o.jsx(V_.Slot,{scope:e.__scopeRovingFocusGroup,children:o.jsx(L8,{...e,ref:t})})}));YR.displayName=_d;var L8=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:s,loop:n=!1,dir:l,currentTabStopId:u,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:m,onEntryFocus:f,preventScrollOnEntryFocus:v=!1,...p}=e,x=g.useRef(null),b=ut(t,x),w=gd(l),[C,k]=eo({prop:u,defaultProp:d??null,onChange:m,caller:_d}),[S,E]=g.useState(!1),N=Er(f),R=GR(r),A=g.useRef(!1),[D,B]=g.useState(0);return g.useEffect(()=>{const $=x.current;if($)return $.addEventListener(Iv,N),()=>$.removeEventListener(Iv,N)},[N]),o.jsx(T8,{scope:r,orientation:s,dir:w,loop:n,currentTabStopId:C,onItemFocus:g.useCallback($=>k($),[k]),onItemShiftTab:g.useCallback(()=>E(!0),[]),onFocusableItemAdd:g.useCallback(()=>B($=>$+1),[]),onFocusableItemRemove:g.useCallback(()=>B($=>$-1),[]),children:o.jsx(Xe.div,{tabIndex:S||D===0?-1:0,"data-orientation":s,...p,ref:b,style:{outline:"none",...e.style},onMouseDown:Be(e.onMouseDown,()=>{A.current=!0}),onFocus:Be(e.onFocus,$=>{const q=!A.current;if($.target===$.currentTarget&&q&&!S){const Y=new CustomEvent(Iv,j8);if($.currentTarget.dispatchEvent(Y),!Y.defaultPrevented){const V=R().filter(M=>M.focusable),U=V.find(M=>M.active),L=V.find(M=>M.id===C),F=[U,L,...V].filter(Boolean).map(M=>M.ref.current);ZR(F,v)}}A.current=!1}),onBlur:Be(e.onBlur,()=>E(!1))})})}),KR="RovingFocusGroupItem",XR=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:s=!0,active:n=!1,tabStopId:l,children:u,...d}=e,m=Vs(),f=l||m,v=D8(KR,r),p=v.currentTabStopId===f,x=GR(r),{onFocusableItemAdd:b,onFocusableItemRemove:w,currentTabStopId:C}=v,k=N8();return ur(()=>{if(!(!k||!s))return b(),()=>w()},[k,s,b,w]),g.useEffect(()=>{if(!(k||!s))return b(),()=>w()},[k,s,b,w]),o.jsx(V_.ItemSlot,{scope:r,id:f,focusable:s,active:n,children:o.jsx(Xe.span,{tabIndex:p?0:-1,"data-orientation":v.orientation,...d,ref:t,onMouseDown:Be(e.onMouseDown,S=>{s?v.onItemFocus(f):S.preventDefault()}),onFocus:Be(e.onFocus,()=>v.onItemFocus(f)),onKeyDown:Be(e.onKeyDown,S=>{if(S.key==="Tab"&&S.shiftKey){v.onItemShiftTab();return}if(S.target!==S.currentTarget)return;const E=P8(S,v.orientation,v.dir);if(E!==void 0){if(S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;S.preventDefault();let R=x().filter(A=>A.focusable).map(A=>A.ref.current);if(E==="last")R.reverse();else if(E==="prev"||E==="next"){E==="prev"&&R.reverse();const A=R.indexOf(S.currentTarget);R=v.loop?I8(R,A+1):R.slice(A+1)}setTimeout(()=>ZR(R))}}),children:typeof u=="function"?u({isCurrentTabStop:p,hasTabStop:C!=null}):u})})});XR.displayName=KR;var O8={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function B8(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function P8(e,t,r){const s=B8(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return O8[s]}function ZR(e,t=!1){const r=document.activeElement;for(const s of e)if(s===r||(s.focus({preventScroll:t}),document.activeElement!==r))return}function I8(e,t){return e.map((r,s)=>e[(t+s)%e.length])}var QR=YR,JR=XR,G_=["Enter"," "],z8=["ArrowDown","PageUp","Home"],eN=["ArrowUp","PageDown","End"],$8=[...z8,...eN],U8={ltr:[...G_,"ArrowRight"],rtl:[...G_,"ArrowLeft"]},H8={ltr:["ArrowLeft"],rtl:["ArrowRight"]},xd="Menu",[Qu,F8,W8]=P0(xd),[il,tN]=Gi(xd,[W8,Um,Hm]),yd=Um(),rN=Hm(),[sN,uo]=il(xd),[q8,bd]=il(xd),iN=e=>{const{__scopeMenu:t,open:r=!1,children:s,dir:n,onOpenChange:l,modal:u=!0}=e,d=yd(t),[m,f]=g.useState(null),v=g.useRef(!1),p=Er(l),x=gd(n);return g.useEffect(()=>{const b=()=>{v.current=!0,document.addEventListener("pointerdown",w,{capture:!0,once:!0}),document.addEventListener("pointermove",w,{capture:!0,once:!0})},w=()=>v.current=!1;return document.addEventListener("keydown",b,{capture:!0}),()=>{document.removeEventListener("keydown",b,{capture:!0}),document.removeEventListener("pointerdown",w,{capture:!0}),document.removeEventListener("pointermove",w,{capture:!0})}},[]),g.useEffect(()=>{if(!r)return;const b=()=>p(!1);return window.addEventListener("blur",b),()=>window.removeEventListener("blur",b)},[r,p]),o.jsx(G0,{...d,children:o.jsx(sN,{scope:t,open:r,onOpenChange:p,content:m,onContentChange:f,children:o.jsx(q8,{scope:t,onClose:g.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:v,dir:x,modal:u,children:s})})})};iN.displayName=xd;var V8="MenuAnchor",Y0=g.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e,n=yd(r);return o.jsx(FR,{...n,...s,ref:t})});Y0.displayName=V8;var K0="MenuPortal",[G8,nN]=il(K0,{forceMount:void 0}),aN=e=>{const{__scopeMenu:t,forceMount:r,children:s,container:n}=e,l=uo(K0,t);return o.jsx(G8,{scope:t,forceMount:r,children:o.jsx(Yi,{present:r||l.open,children:o.jsx(Nm,{asChild:!0,container:n,children:s})})})};aN.displayName=K0;var wi="MenuContent",[Y8,X0]=il(wi),oN=g.forwardRef((e,t)=>{const r=nN(wi,e.__scopeMenu),{forceMount:s=r.forceMount,...n}=e,l=uo(wi,e.__scopeMenu),u=bd(wi,e.__scopeMenu);return o.jsx(Qu.Provider,{scope:e.__scopeMenu,children:o.jsx(Yi,{present:s||l.open,children:o.jsx(Qu.Slot,{scope:e.__scopeMenu,children:u.modal?o.jsx(K8,{...n,ref:t}):o.jsx(X8,{...n,ref:t})})})})}),K8=g.forwardRef((e,t)=>{const r=uo(wi,e.__scopeMenu),s=g.useRef(null),n=ut(t,s);return g.useEffect(()=>{const l=s.current;if(l)return N0(l)},[]),o.jsx(Z0,{...e,ref:n,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:Be(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),X8=g.forwardRef((e,t)=>{const r=uo(wi,e.__scopeMenu);return o.jsx(Z0,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),Z8=Ko("MenuContent.ScrollLock"),Z0=g.forwardRef((e,t)=>{const{__scopeMenu:r,loop:s=!1,trapFocus:n,onOpenAutoFocus:l,onCloseAutoFocus:u,disableOutsidePointerEvents:d,onEntryFocus:m,onEscapeKeyDown:f,onPointerDownOutside:v,onFocusOutside:p,onInteractOutside:x,onDismiss:b,disableOutsideScroll:w,...C}=e,k=uo(wi,r),S=bd(wi,r),E=yd(r),N=rN(r),R=F8(r),[A,D]=g.useState(null),B=g.useRef(null),$=ut(t,B,k.onContentChange),q=g.useRef(0),Y=g.useRef(""),V=g.useRef(0),U=g.useRef(null),L=g.useRef("right"),I=g.useRef(0),F=w?Am:g.Fragment,M=w?{as:Z8,allowPinchZoom:!0}:void 0,P=W=>{var Z,ce;const H=Y.current+W,T=R().filter(le=>!le.disabled),G=document.activeElement,X=(Z=T.find(le=>le.ref.current===G))==null?void 0:Z.textValue,ee=T.map(le=>le.textValue),oe=c7(ee,H,X),de=(ce=T.find(le=>le.textValue===oe))==null?void 0:ce.ref.current;(function le(be){Y.current=be,window.clearTimeout(q.current),be!==""&&(q.current=window.setTimeout(()=>le(""),1e3))})(H),de&&setTimeout(()=>de.focus())};g.useEffect(()=>()=>window.clearTimeout(q.current),[]),R0();const O=g.useCallback(W=>{var T,G;return L.current===((T=U.current)==null?void 0:T.side)&&d7(W,(G=U.current)==null?void 0:G.area)},[]);return o.jsx(Y8,{scope:r,searchRef:Y,onItemEnter:g.useCallback(W=>{O(W)&&W.preventDefault()},[O]),onItemLeave:g.useCallback(W=>{var H;O(W)||((H=B.current)==null||H.focus(),D(null))},[O]),onTriggerLeave:g.useCallback(W=>{O(W)&&W.preventDefault()},[O]),pointerGraceTimerRef:V,onPointerGraceIntentChange:g.useCallback(W=>{U.current=W},[]),children:o.jsx(F,{...M,children:o.jsx(Rm,{asChild:!0,trapped:n,onMountAutoFocus:Be(l,W=>{var H;W.preventDefault(),(H=B.current)==null||H.focus({preventScroll:!0})}),onUnmountAutoFocus:u,children:o.jsx(Em,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:f,onPointerDownOutside:v,onFocusOutside:p,onInteractOutside:x,onDismiss:b,children:o.jsx(QR,{asChild:!0,...N,dir:S.dir,orientation:"vertical",loop:s,currentTabStopId:A,onCurrentTabStopIdChange:D,onEntryFocus:Be(m,W=>{S.isUsingKeyboardRef.current||W.preventDefault()}),preventScrollOnEntryFocus:!0,children:o.jsx(WR,{role:"menu","aria-orientation":"vertical","data-state":CN(k.open),"data-radix-menu-content":"",dir:S.dir,...E,...C,ref:$,style:{outline:"none",...C.style},onKeyDown:Be(C.onKeyDown,W=>{const T=W.target.closest("[data-radix-menu-content]")===W.currentTarget,G=W.ctrlKey||W.altKey||W.metaKey,X=W.key.length===1;T&&(W.key==="Tab"&&W.preventDefault(),!G&&X&&P(W.key));const ee=B.current;if(W.target!==ee||!$8.includes(W.key))return;W.preventDefault();const de=R().filter(Z=>!Z.disabled).map(Z=>Z.ref.current);eN.includes(W.key)&&de.reverse(),o7(de)}),onBlur:Be(e.onBlur,W=>{W.currentTarget.contains(W.target)||(window.clearTimeout(q.current),Y.current="")}),onPointerMove:Be(e.onPointerMove,Ju(W=>{const H=W.target,T=I.current!==W.clientX;if(W.currentTarget.contains(H)&&T){const G=W.clientX>I.current?"right":"left";L.current=G,I.current=W.clientX}}))})})})})})})});oN.displayName=wi;var Q8="MenuGroup",Q0=g.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e;return o.jsx(Xe.div,{role:"group",...s,ref:t})});Q0.displayName=Q8;var J8="MenuLabel",lN=g.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e;return o.jsx(Xe.div,{...s,ref:t})});lN.displayName=J8;var tm="MenuItem",IC="menu.itemSelect",Fm=g.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:s,...n}=e,l=g.useRef(null),u=bd(tm,e.__scopeMenu),d=X0(tm,e.__scopeMenu),m=ut(t,l),f=g.useRef(!1),v=()=>{const p=l.current;if(!r&&p){const x=new CustomEvent(IC,{bubbles:!0,cancelable:!0});p.addEventListener(IC,b=>s==null?void 0:s(b),{once:!0}),_E(p,x),x.defaultPrevented?f.current=!1:u.onClose()}};return o.jsx(cN,{...n,ref:m,disabled:r,onClick:Be(e.onClick,v),onPointerDown:p=>{var x;(x=e.onPointerDown)==null||x.call(e,p),f.current=!0},onPointerUp:Be(e.onPointerUp,p=>{var x;f.current||(x=p.currentTarget)==null||x.click()}),onKeyDown:Be(e.onKeyDown,p=>{r||p.target!==p.currentTarget||d.searchRef.current!==""&&p.key===" "||G_.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})});Fm.displayName=tm;var cN=g.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:s=!1,textValue:n,...l}=e,u=X0(tm,r),d=rN(r),m=g.useRef(null),f=ut(t,m),[v,p]=g.useState(!1),[x,b]=g.useState("");return g.useEffect(()=>{const w=m.current;w&&b((w.textContent??"").trim())},[l.children]),o.jsx(Qu.ItemSlot,{scope:r,disabled:s,textValue:n??x,children:o.jsx(JR,{asChild:!0,...d,focusable:!s,children:o.jsx(Xe.div,{role:"menuitem","data-highlighted":v?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...l,ref:f,onPointerMove:Be(e.onPointerMove,Ju(w=>{s?u.onItemLeave(w):(u.onItemEnter(w),w.defaultPrevented||w.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Be(e.onPointerLeave,Ju(w=>u.onItemLeave(w))),onFocus:Be(e.onFocus,()=>p(!0)),onBlur:Be(e.onBlur,()=>p(!1))})})})}),e7="MenuCheckboxItem",uN=g.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:s,...n}=e;return o.jsx(pN,{scope:e.__scopeMenu,checked:r,children:o.jsx(Fm,{role:"menuitemcheckbox","aria-checked":rm(r)?"mixed":r,...n,ref:t,"data-state":ty(r),onSelect:Be(n.onSelect,()=>s==null?void 0:s(rm(r)?!0:!r),{checkForDefaultPrevented:!1})})})});uN.displayName=e7;var dN="MenuRadioGroup",[t7,r7]=il(dN,{value:void 0,onValueChange:()=>{}}),hN=g.forwardRef((e,t)=>{const{value:r,onValueChange:s,...n}=e,l=Er(s);return o.jsx(t7,{scope:e.__scopeMenu,value:r,onValueChange:l,children:o.jsx(Q0,{...n,ref:t})})});hN.displayName=dN;var fN="MenuRadioItem",mN=g.forwardRef((e,t)=>{const{value:r,...s}=e,n=r7(fN,e.__scopeMenu),l=r===n.value;return o.jsx(pN,{scope:e.__scopeMenu,checked:l,children:o.jsx(Fm,{role:"menuitemradio","aria-checked":l,...s,ref:t,"data-state":ty(l),onSelect:Be(s.onSelect,()=>{var u;return(u=n.onValueChange)==null?void 0:u.call(n,r)},{checkForDefaultPrevented:!1})})})});mN.displayName=fN;var J0="MenuItemIndicator",[pN,s7]=il(J0,{checked:!1}),gN=g.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:s,...n}=e,l=s7(J0,r);return o.jsx(Yi,{present:s||rm(l.checked)||l.checked===!0,children:o.jsx(Xe.span,{...n,ref:t,"data-state":ty(l.checked)})})});gN.displayName=J0;var i7="MenuSeparator",vN=g.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e;return o.jsx(Xe.div,{role:"separator","aria-orientation":"horizontal",...s,ref:t})});vN.displayName=i7;var n7="MenuArrow",_N=g.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e,n=yd(r);return o.jsx(qR,{...n,...s,ref:t})});_N.displayName=n7;var ey="MenuSub",[a7,xN]=il(ey),yN=e=>{const{__scopeMenu:t,children:r,open:s=!1,onOpenChange:n}=e,l=uo(ey,t),u=yd(t),[d,m]=g.useState(null),[f,v]=g.useState(null),p=Er(n);return g.useEffect(()=>(l.open===!1&&p(!1),()=>p(!1)),[l.open,p]),o.jsx(G0,{...u,children:o.jsx(sN,{scope:t,open:s,onOpenChange:p,content:f,onContentChange:v,children:o.jsx(a7,{scope:t,contentId:Vs(),triggerId:Vs(),trigger:d,onTriggerChange:m,children:r})})})};yN.displayName=ey;var Ou="MenuSubTrigger",bN=g.forwardRef((e,t)=>{const r=uo(Ou,e.__scopeMenu),s=bd(Ou,e.__scopeMenu),n=xN(Ou,e.__scopeMenu),l=X0(Ou,e.__scopeMenu),u=g.useRef(null),{pointerGraceTimerRef:d,onPointerGraceIntentChange:m}=l,f={__scopeMenu:e.__scopeMenu},v=g.useCallback(()=>{u.current&&window.clearTimeout(u.current),u.current=null},[]);g.useEffect(()=>v,[v]),g.useEffect(()=>{const x=d.current;return()=>{window.clearTimeout(x),m(null)}},[d,m]);const p=ut(t,n.onTriggerChange);return o.jsx(Y0,{asChild:!0,...f,children:o.jsx(cN,{id:n.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":r.open?n.contentId:void 0,"data-state":CN(r.open),...e,ref:p,onClick:x=>{var b;(b=e.onClick)==null||b.call(e,x),!(e.disabled||x.defaultPrevented)&&(x.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:Be(e.onPointerMove,Ju(x=>{l.onItemEnter(x),!x.defaultPrevented&&!e.disabled&&!r.open&&!u.current&&(l.onPointerGraceIntentChange(null),u.current=window.setTimeout(()=>{r.onOpenChange(!0),v()},100))})),onPointerLeave:Be(e.onPointerLeave,Ju(x=>{var w,C;v();const b=(w=r.content)==null?void 0:w.getBoundingClientRect();if(b){const k=(C=r.content)==null?void 0:C.dataset.side,S=k==="right",E=S?-5:5,N=b[S?"left":"right"],R=b[S?"right":"left"];l.onPointerGraceIntentChange({area:[{x:x.clientX+E,y:x.clientY},{x:N,y:b.top},{x:R,y:b.top},{x:R,y:b.bottom},{x:N,y:b.bottom}],side:k}),window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.onPointerGraceIntentChange(null),300)}else{if(l.onTriggerLeave(x),x.defaultPrevented)return;l.onPointerGraceIntentChange(null)}})),onKeyDown:Be(e.onKeyDown,x=>{var w;e.disabled||x.target!==x.currentTarget||l.searchRef.current!==""&&x.key===" "||U8[s.dir].includes(x.key)&&(r.onOpenChange(!0),(w=r.content)==null||w.focus(),x.preventDefault())})})})});bN.displayName=Ou;var wN="MenuSubContent",SN=g.forwardRef((e,t)=>{const r=nN(wi,e.__scopeMenu),{forceMount:s=r.forceMount,align:n="start",...l}=e,u=uo(wi,e.__scopeMenu),d=bd(wi,e.__scopeMenu),m=xN(wN,e.__scopeMenu),f=g.useRef(null),v=ut(t,f);return o.jsx(Qu.Provider,{scope:e.__scopeMenu,children:o.jsx(Yi,{present:s||u.open,children:o.jsx(Qu.Slot,{scope:e.__scopeMenu,children:o.jsx(Z0,{id:m.contentId,"aria-labelledby":m.triggerId,...l,ref:v,align:n,side:d.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:p=>{var x;d.isUsingKeyboardRef.current&&((x=f.current)==null||x.focus()),p.preventDefault()},onCloseAutoFocus:p=>p.preventDefault(),onFocusOutside:Be(e.onFocusOutside,p=>{p.target!==m.trigger&&u.onOpenChange(!1)}),onEscapeKeyDown:Be(e.onEscapeKeyDown,p=>{d.onClose(),p.preventDefault()}),onKeyDown:Be(e.onKeyDown,p=>{var w;const x=p.currentTarget.contains(p.target),b=H8[d.dir].includes(p.key);x&&b&&(u.onOpenChange(!1),(w=m.trigger)==null||w.focus(),p.preventDefault())})})})})})});SN.displayName=wN;function CN(e){return e?"open":"closed"}function rm(e){return e==="indeterminate"}function ty(e){return rm(e)?"indeterminate":e?"checked":"unchecked"}function o7(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function l7(e,t){return e.map((r,s)=>e[(t+s)%e.length])}function c7(e,t,r){const n=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,l=r?e.indexOf(r):-1;let u=l7(e,Math.max(l,0));n.length===1&&(u=u.filter(f=>f!==r));const m=u.find(f=>f.toLowerCase().startsWith(n.toLowerCase()));return m!==r?m:void 0}function u7(e,t){const{x:r,y:s}=e;let n=!1;for(let l=0,u=t.length-1;l<t.length;u=l++){const d=t[l],m=t[u],f=d.x,v=d.y,p=m.x,x=m.y;v>s!=x>s&&r<(p-f)*(s-v)/(x-v)+f&&(n=!n)}return n}function d7(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return u7(r,t)}function Ju(e){return t=>t.pointerType==="mouse"?e(t):void 0}var h7=iN,f7=Y0,m7=aN,p7=oN,g7=Q0,v7=lN,_7=Fm,x7=uN,y7=hN,b7=mN,w7=gN,S7=vN,C7=_N,k7=yN,E7=bN,R7=SN,Wm="DropdownMenu",[N7]=Gi(Wm,[tN]),gs=tN(),[j7,kN]=N7(Wm),EN=e=>{const{__scopeDropdownMenu:t,children:r,dir:s,open:n,defaultOpen:l,onOpenChange:u,modal:d=!0}=e,m=gs(t),f=g.useRef(null),[v,p]=eo({prop:n,defaultProp:l??!1,onChange:u,caller:Wm});return o.jsx(j7,{scope:t,triggerId:Vs(),triggerRef:f,contentId:Vs(),open:v,onOpenChange:p,onOpenToggle:g.useCallback(()=>p(x=>!x),[p]),modal:d,children:o.jsx(h7,{...m,open:v,onOpenChange:p,dir:s,modal:d,children:r})})};EN.displayName=Wm;var RN="DropdownMenuTrigger",NN=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:s=!1,...n}=e,l=kN(RN,r),u=gs(r),d=ut(t,l.triggerRef);return o.jsx(f7,{asChild:!0,...u,children:o.jsx(Xe.button,{type:"button",id:l.triggerId,"aria-haspopup":"menu","aria-expanded":l.open,"aria-controls":l.open?l.contentId:void 0,"data-state":l.open?"open":"closed","data-disabled":s?"":void 0,disabled:s,...n,ref:d,onPointerDown:Be(e.onPointerDown,m=>{!s&&m.button===0&&m.ctrlKey===!1&&(l.onOpenToggle(),l.open||m.preventDefault())}),onKeyDown:Be(e.onKeyDown,m=>{s||(["Enter"," "].includes(m.key)&&l.onOpenToggle(),m.key==="ArrowDown"&&l.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(m.key)&&m.preventDefault())})})})});NN.displayName=RN;var A7="DropdownMenuPortal",jN=e=>{const{__scopeDropdownMenu:t,...r}=e,s=gs(t);return o.jsx(m7,{...s,...r})};jN.displayName=A7;var AN="DropdownMenuContent",MN=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,n=kN(AN,r),l=gs(r),u=g.useRef(!1);return o.jsx(p7,{id:n.contentId,"aria-labelledby":n.triggerId,...l,...s,ref:t,onCloseAutoFocus:Be(e.onCloseAutoFocus,d=>{var m;u.current||(m=n.triggerRef.current)==null||m.focus(),u.current=!1,d.preventDefault()}),onInteractOutside:Be(e.onInteractOutside,d=>{const m=d.detail.originalEvent,f=m.button===0&&m.ctrlKey===!0,v=m.button===2||f;(!n.modal||v)&&(u.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});MN.displayName=AN;var M7="DropdownMenuGroup",T7=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,n=gs(r);return o.jsx(g7,{...n,...s,ref:t})});T7.displayName=M7;var D7="DropdownMenuLabel",TN=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,n=gs(r);return o.jsx(v7,{...n,...s,ref:t})});TN.displayName=D7;var L7="DropdownMenuItem",DN=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,n=gs(r);return o.jsx(_7,{...n,...s,ref:t})});DN.displayName=L7;var O7="DropdownMenuCheckboxItem",B7=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,n=gs(r);return o.jsx(x7,{...n,...s,ref:t})});B7.displayName=O7;var P7="DropdownMenuRadioGroup",I7=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,n=gs(r);return o.jsx(y7,{...n,...s,ref:t})});I7.displayName=P7;var z7="DropdownMenuRadioItem",$7=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,n=gs(r);return o.jsx(b7,{...n,...s,ref:t})});$7.displayName=z7;var U7="DropdownMenuItemIndicator",H7=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,n=gs(r);return o.jsx(w7,{...n,...s,ref:t})});H7.displayName=U7;var F7="DropdownMenuSeparator",LN=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,n=gs(r);return o.jsx(S7,{...n,...s,ref:t})});LN.displayName=F7;var W7="DropdownMenuArrow",q7=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,n=gs(r);return o.jsx(C7,{...n,...s,ref:t})});q7.displayName=W7;var V7=e=>{const{__scopeDropdownMenu:t,children:r,open:s,onOpenChange:n,defaultOpen:l}=e,u=gs(t),[d,m]=eo({prop:s,defaultProp:l??!1,onChange:n,caller:"DropdownMenuSub"});return o.jsx(k7,{...u,open:d,onOpenChange:m,children:r})},G7="DropdownMenuSubTrigger",ON=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,n=gs(r);return o.jsx(E7,{...n,...s,ref:t})});ON.displayName=G7;var Y7="DropdownMenuSubContent",BN=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,n=gs(r);return o.jsx(R7,{...n,...s,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});BN.displayName=Y7;var K7=EN,PN=NN,IN=jN,zN=MN,$N=TN,UN=DN,HN=LN,X7=V7,FN=ON,WN=BN;function ed(e){return o.jsx(K7,{"data-slot":"dropdown-menu",...e})}const fc=g.forwardRef((e,t)=>o.jsx(PN,{ref:t,"data-slot":"dropdown-menu-trigger",...e}));fc.displayName=PN.displayName;const mc=g.forwardRef(({className:e,sideOffset:t=4,collisionPadding:r=8,...s},n)=>o.jsx(IN,{children:o.jsx(zN,{ref:n,"data-slot":"dropdown-menu-content",sideOffset:t,collisionPadding:r,className:et("cn-menu-translucent z-50 min-w-36 origin-[var(--radix-dropdown-menu-content-transform-origin)] overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...s})}));mc.displayName=zN.displayName;const Ii=g.forwardRef(({className:e,variant:t="default",...r},s)=>o.jsx(UN,{ref:s,"data-slot":"dropdown-menu-item","data-variant":t,className:et("relative flex cursor-default items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t==="destructive"&&"text-destructive focus:bg-destructive/10 focus:text-destructive dark:focus:bg-destructive/20",e),...r}));Ii.displayName=UN.displayName;const Uo=g.forwardRef(({className:e,...t},r)=>o.jsx($N,{ref:r,"data-slot":"dropdown-menu-label",className:et("px-2 py-1.5 text-xs font-medium text-muted-foreground",e),...t}));Uo.displayName=$N.displayName;const qN=g.forwardRef(({className:e,...t},r)=>o.jsx(HN,{ref:r,"data-slot":"dropdown-menu-separator",className:et("-mx-1 my-1 h-px bg-border",e),...t}));qN.displayName=HN.displayName;function Y_(e){return o.jsx(X7,{"data-slot":"dropdown-menu-sub",...e})}const sm=g.forwardRef(({className:e,children:t,...r},s)=>o.jsxs(FN,{ref:s,"data-slot":"dropdown-menu-sub-trigger",className:et("flex cursor-default select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-hidden focus:bg-accent data-[state=open]:bg-accent data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[t,o.jsx("span",{className:"ml-auto text-muted-foreground","aria-hidden":"true",children:"›"})]}));sm.displayName=FN.displayName;const im=g.forwardRef(({className:e,sideOffset:t=6,collisionPadding:r=8,...s},n)=>o.jsx(IN,{children:o.jsx(WN,{ref:n,"data-slot":"dropdown-menu-sub-content",sideOffset:t,collisionPadding:r,className:et("cn-menu-translucent z-50 min-w-48 overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",e),...s})}));im.displayName=WN.displayName;const bt=g.forwardRef(({className:e,type:t,...r},s)=>o.jsx("input",{ref:s,type:t,"data-slot":"input",className:et("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...r}));bt.displayName="Input";function wd({className:e,...t}){return o.jsx("textarea",{"data-slot":"textarea",className:et("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...t})}function Z7({idPrefix:e,fields:t,activeFieldId:r,answers:s,otherValues:n,otherSelections:l,errors:u={},disabled:d=!1,onNavigate:m,onAnswerChange:f,onOtherValueChange:v,onOtherSelectionChange:p}){const x=g.useRef(null),b=g.useRef(void 0),w=g.useRef(void 0),C=t.findIndex($=>$.id===r),k=C>=0?C:0,S=t[k],E=S?u[S.id]:void 0,N=S?s[S.id]:void 0;if(g.useEffect(()=>{if(!S)return;const $=b.current!==void 0&&b.current!==S.id,q=!!E&&w.current!==E;if(b.current=S.id,w.current=E,!$&&!q)return;const Y=x.current,V=(Y==null?void 0:Y.querySelector('input[aria-invalid="true"]:not([disabled]), textarea[aria-invalid="true"]:not([disabled])'))??(Y==null?void 0:Y.querySelector("input:checked:not([disabled])"))??(Y==null?void 0:Y.querySelector("input:not([disabled]), textarea:not([disabled])"));V==null||V.focus()},[E,S]),!S)return null;const R=`${e}-field-${k}`,A=S.description?`${R}-description`:void 0,D=E?`${R}-error`:void 0,B=[A,D].filter(Boolean).join(" ")||void 0;return o.jsxs("div",{className:"grid gap-3",children:[t.length>1&&o.jsxs("div",{className:"grid gap-1.5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsxs("div",{"aria-live":"polite",className:"font-mono text-[10px] uppercase tracking-[0.14em] text-muted-foreground",children:["Question ",k+1," of ",t.length]}),o.jsx("div",{className:"text-[11px] text-muted-foreground",children:S.required?"Required":"Optional"})]}),o.jsx("div",{role:"progressbar","aria-label":"Question progress","aria-valuemin":1,"aria-valuemax":t.length,"aria-valuenow":k+1,className:"h-1 overflow-hidden rounded-full bg-muted",children:o.jsx("div",{className:"h-full rounded-full bg-primary transition-[width]",style:{width:`${(k+1)/t.length*100}%`}})})]}),o.jsx("div",{ref:x,children:S.type==="text"?o.jsxs("div",{className:"grid gap-1.5",children:[o.jsxs("label",{htmlFor:R,className:"text-xs font-medium text-foreground",children:[S.label,S.required&&o.jsx(UC,{})]}),S.description&&o.jsx("p",{id:A,className:"text-[11px] leading-relaxed text-muted-foreground",children:S.description}),S.multiline&&!S.secret?o.jsx(wd,{id:R,value:typeof N=="string"?N:"",disabled:d,placeholder:S.placeholder,"aria-invalid":E?!0:void 0,"aria-describedby":B,required:S.required,onChange:$=>f(S.id,$.target.value)}):o.jsx(bt,{id:R,type:S.secret?"password":"text",autoComplete:"off",value:typeof N=="string"?N:"",disabled:d,placeholder:S.placeholder,"aria-invalid":E?!0:void 0,"aria-describedby":B,required:S.required,onChange:$=>f(S.id,$.target.value)}),o.jsx($C,{id:D,error:E})]}):o.jsxs("fieldset",{disabled:d,role:S.multiple?void 0:"radiogroup","aria-required":!S.multiple&&S.required?!0:void 0,"aria-invalid":E?!0:void 0,"aria-describedby":B,className:"grid gap-1.5",children:[o.jsxs("legend",{className:"text-xs font-medium text-foreground",children:[S.label,S.required&&o.jsx(UC,{})]}),S.description&&o.jsx("p",{id:A,className:"text-[11px] leading-relaxed text-muted-foreground",children:S.description}),o.jsxs("div",{className:"grid gap-1.5",children:[S.options.map(($,q)=>{const Y=`${R}-option-${q}`,V=S.multiple?Array.isArray(N)&&N.includes($.value):l[S.id]!==!0&&N===$.value;return o.jsx(zC,{id:Y,name:S.multiple?void 0:R,type:S.multiple?"checkbox":"radio",checked:V,label:$.label,description:$.description,onChange:U=>{if(S.multiple){const L=Array.isArray(N)?N:[];f(S.id,U?[...L.filter(I=>I!==$.value),$.value]:L.filter(I=>I!==$.value))}else f(S.id,$.value),p(S.id,!1)}},$.value)}),S.allowOther&&o.jsxs("div",{className:"grid gap-1.5 rounded-lg border border-border bg-background/60 px-2.5 py-2 has-[:checked]:border-primary/50 has-[:checked]:bg-primary/5",children:[o.jsx(zC,{id:`${R}-other`,name:S.multiple?void 0:R,type:S.multiple?"checkbox":"radio",checked:l[S.id]===!0,label:"Other",embedded:!0,onChange:$=>{p(S.id,$),$&&!S.multiple&&f(S.id,"")}}),o.jsx(bt,{value:n[S.id]??"",disabled:d||l[S.id]!==!0,"aria-label":`Other answer for ${S.label}`,"aria-invalid":E?!0:void 0,"aria-describedby":B,placeholder:"Enter another answer",onChange:$=>v(S.id,$.target.value)})]}),!S.required&&!S.multiple&&(l[S.id]===!0||typeof N=="string"&&N.length>0)&&o.jsx(ne,{type:"button",size:"xs",variant:"ghost",className:"justify-self-start text-muted-foreground",onClick:()=>{f(S.id,""),p(S.id,!1)},children:"Clear selection"})]}),o.jsx($C,{id:D,error:E})]})}),t.length>1&&o.jsxs("div",{className:"flex items-center justify-between gap-2 border-t border-border/70 pt-2",children:[o.jsxs(ne,{type:"button",size:"xs",variant:"ghost",disabled:d||k===0,onClick:()=>m(t[k-1].id),children:[o.jsx(iE,{}),"Previous"]}),o.jsxs(ne,{type:"button",size:"xs",variant:"outline",disabled:d||k===t.length-1,onClick:()=>m(t[k+1].id),children:["Next",o.jsx(oo,{})]})]})]})}function zC({id:e,name:t,type:r,checked:s,label:n,description:l,embedded:u=!1,onChange:d}){return o.jsxs("label",{htmlFor:e,className:et("flex cursor-pointer items-start gap-2 text-xs text-foreground",!u&&"rounded-lg border border-border bg-background/60 px-2.5 py-2 transition-colors hover:bg-muted/60 has-[:checked]:border-primary/50 has-[:checked]:bg-primary/5"),children:[o.jsxs("span",{className:"relative mt-0.5 size-4 shrink-0",children:[o.jsx("input",{id:e,type:r,name:t,checked:s,className:"peer size-4 appearance-none rounded-sm border border-input bg-background outline-none transition-colors checked:border-primary checked:bg-primary focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-60",onChange:m=>d(m.target.checked)}),o.jsx(Br,{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 size-4 stroke-[3] text-primary-foreground opacity-0 peer-checked:opacity-100"})]}),o.jsxs("span",{className:"min-w-0",children:[o.jsx("span",{className:"block",children:n}),l&&o.jsx("span",{className:"mt-0.5 block text-[11px] leading-relaxed text-muted-foreground",children:l})]})]})}function $C({id:e,error:t}){return t?o.jsx("p",{id:e,role:"alert",className:"text-[11px] text-destructive",children:t}):null}function UC(){return o.jsxs(o.Fragment,{children:[o.jsx("span",{"aria-hidden":"true",className:"ml-0.5 text-destructive",children:"*"}),o.jsx("span",{className:"sr-only",children:" (required)"})]})}function VN({className:e,size:t="default",...r}){return o.jsxs("div",{"data-slot":"native-select-wrapper","data-size":t,className:et("group/native-select relative w-fit has-[select:disabled]:opacity-50",e),children:[o.jsx("select",{"data-slot":"native-select","data-size":t,className:"h-8 w-full min-w-0 appearance-none rounded-lg border border-input bg-transparent py-1 pr-8 pl-2.5 text-sm transition-colors outline-none select-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-[size=sm]:py-0.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",...r}),o.jsx(md,{"aria-hidden":"true","data-slot":"native-select-icon",className:"pointer-events-none absolute top-1/2 right-2.5 size-4 -translate-y-1/2 text-muted-foreground select-none"})]})}var Q7=Object.defineProperty,ia=(e,t)=>Q7(e,"name",{value:t,configurable:!0});function GN(e,t){return g.useReducer((r,s)=>t[r][s]??r,e)}ia(GN,"useStateMachine");var qm=ia(e=>{const{present:t,children:r}=e,s=YN(t),n=typeof r=="function"?r({present:s.isPresent}):g.Children.only(r),l=KN(s.ref,XN(n));return typeof r=="function"||s.isPresent?g.cloneElement(n,{ref:l}):null},"Presence");function YN(e){const[t,r]=g.useState(),s=g.useRef(null),n=g.useRef(e),l=g.useRef("none"),u=g.useRef(void 0),d=e?"mounted":"unmounted",[m,f]=GN(d,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{m==="mounted"?(l.current=u.current??ec(s.current),u.current=void 0):l.current="none"},[m]),ur(()=>{const v=s.current,p=n.current;if(p!==e){const b=l.current,w=ec(v);e?(u.current=w,f("MOUNT")):w==="none"||(v==null?void 0:v.display)==="none"?f("UNMOUNT"):f(p&&b!==w?"ANIMATION_OUT":"UNMOUNT"),n.current=e}},[e,f]),ur(()=>{if(t){let v;const p=t.ownerDocument.defaultView??window,x=ia(w=>{const k=ec(s.current).includes(CSS.escape(w.animationName));if(w.target===t&&k&&(f("ANIMATION_END"),!n.current)){const S=t.style.animationFillMode;t.style.animationFillMode="forwards",v=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=S)})}},"handleAnimationEnd"),b=ia(w=>{w.target===t&&(l.current=ec(s.current))},"handleAnimationStart");return t.addEventListener("animationstart",b),t.addEventListener("animationcancel",x),t.addEventListener("animationend",x),()=>{p.clearTimeout(v),t.removeEventListener("animationstart",b),t.removeEventListener("animationcancel",x),t.removeEventListener("animationend",x)}}else f("ANIMATION_END")},[t,f]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:g.useCallback(v=>{if(v){const p=getComputedStyle(v);s.current=p,u.current=ec(p)}else s.current=null;r(v)},[])}}ia(YN,"usePresence");function K_(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}ia(K_,"setRef");function KN(...e){const t=g.useRef(e);return t.current=e,g.useCallback(r=>{const s=t.current;let n=!1;const l=s.map(u=>{const d=K_(u,r);return!n&&typeof d=="function"&&(n=!0),d});if(n)return()=>{for(let u=0;u<l.length;u++){const d=l[u];typeof d=="function"?d():K_(s[u],null)}}},[])}ia(KN,"useStableComposedRefs");function ec(e){return(e==null?void 0:e.animationName)||"none"}ia(ec,"getAnimationName");function XN(e){var s,n;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(n=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}ia(XN,"getElementRef");function X_(e,[t,r]){return Math.min(r,Math.max(t,e))}var J7=Object.defineProperty,bc=(e,t)=>J7(e,"name",{value:t,configurable:!0}),ZN=!!(typeof window<"u"&&window.document&&window.document.createElement);function Za(e,t,{checkForDefaultPrevented:r=!0}={}){return bc(function(n){if(e==null||e(n),r===!1||!n||!n.defaultPrevented)return t==null?void 0:t(n)},"handleEvent")}bc(Za,"composeEventHandlers");function e$(e){var t;if(!ZN)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}bc(e$,"getOwnerWindow");function Z_(e){if(!ZN)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}bc(Z_,"getOwnerDocument");function QN(e,t=!1){const{activeElement:r}=Z_(e);if(!(r!=null&&r.nodeName))return null;if(JN(r)&&r.contentDocument)return QN(r.contentDocument.body,t);if(t){const s=r.getAttribute("aria-activedescendant");if(s){const n=Z_(r).getElementById(s);if(n)return n}}return r}bc(QN,"getActiveElement");function JN(e){return e.tagName==="IFRAME"}bc(JN,"isFrame");var t$=Object.defineProperty,ft=(e,t)=>t$(e,"name",{value:t,configurable:!0});function ej(e,t){return g.useReducer((r,s)=>t[r][s]??r,e)}ft(ej,"useStateMachine");var tj="ScrollArea",[rj]=Gi(tj),[r$,ji]=rj(tj),s$=g.forwardRef(ft(function(t,r){const{__scopeScrollArea:s,type:n="hover",dir:l,scrollHideDelay:u=600,...d}=t,[m,f]=g.useState(null),[v,p]=g.useState(null),[x,b]=g.useState(null),[w,C]=g.useState(null),[k,S]=g.useState(null),[E,N]=g.useState(0),[R,A]=g.useState(0),[D,B]=g.useState(!1),[$,q]=g.useState(!1),Y=ut(r,f),V=gd(l);return o.jsx(r$,{scope:s,type:n,dir:V,scrollHideDelay:u,scrollArea:m,viewport:v,onViewportChange:p,content:x,onContentChange:b,scrollbarX:w,onScrollbarXChange:C,scrollbarXEnabled:D,onScrollbarXEnabledChange:B,scrollbarY:k,onScrollbarYChange:S,scrollbarYEnabled:$,onScrollbarYEnabledChange:q,onCornerWidthChange:N,onCornerHeightChange:A,children:o.jsx(Xe.div,{dir:V,...d,ref:Y,style:{position:"relative","--radix-scroll-area-corner-width":E+"px","--radix-scroll-area-corner-height":R+"px",...t.style}})})},"ScrollArea")),i$="ScrollAreaViewport",n$=g.forwardRef(ft(function(t,r){const{__scopeScrollArea:s,children:n,nonce:l,...u}=t,d=ji(i$,s),m=g.useRef(null),f=ut(r,m,d.onViewportChange);return o.jsxs(o.Fragment,{children:[o.jsx(a$,{nonce:l}),o.jsx(Xe.div,{"data-radix-scroll-area-viewport":"",...u,ref:f,style:{overflowX:d.scrollbarXEnabled?"scroll":"hidden",overflowY:d.scrollbarYEnabled?"scroll":"hidden",...t.style},children:o.jsx("div",{ref:d.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})},"ScrollAreaViewport")),a$=g.memo(ft(function({nonce:t}){return o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:t})},"ScrollAreaViewportStyle"),(e,t)=>e.nonce===t.nonce),da="ScrollAreaScrollbar",sj=g.forwardRef(ft(function(t,r){const{forceMount:s,...n}=t,l=ji(da,t.__scopeScrollArea),{onScrollbarXEnabledChange:u,onScrollbarYEnabledChange:d}=l,m=t.orientation==="horizontal";return g.useEffect(()=>(m?u(!0):d(!0),()=>{m?u(!1):d(!1)}),[m,u,d]),l.type==="hover"?o.jsx(o$,{...n,ref:r,forceMount:s}):l.type==="scroll"?o.jsx(l$,{...n,ref:r,forceMount:s}):l.type==="auto"?o.jsx(ij,{...n,ref:r,forceMount:s}):l.type==="always"?o.jsx(ry,{...n,ref:r,"data-state":"visible"}):null},"ScrollAreaScrollbar")),o$=g.forwardRef(ft(function(t,r){const{forceMount:s,...n}=t,l=ji(da,t.__scopeScrollArea),[u,d]=g.useState(!1);return g.useEffect(()=>{const m=l.scrollArea;let f=0;if(m){const v=ft(()=>{window.clearTimeout(f),d(!0)},"handlePointerEnter"),p=ft(()=>{f=window.setTimeout(()=>d(!1),l.scrollHideDelay)},"handlePointerLeave");return m.addEventListener("pointerenter",v),m.addEventListener("pointerleave",p),()=>{window.clearTimeout(f),m.removeEventListener("pointerenter",v),m.removeEventListener("pointerleave",p)}}},[l.scrollArea,l.scrollHideDelay]),o.jsx(qm,{present:s||u,children:o.jsx(ij,{"data-state":u?"visible":"hidden",...n,ref:r})})},"ScrollAreaScrollbarHover")),l$=g.forwardRef(ft(function(t,r){const{forceMount:s,...n}=t,l=ji(da,t.__scopeScrollArea),u=t.orientation==="horizontal",d=Cd(()=>f("SCROLL_END"),100),[m,f]=ej("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return g.useEffect(()=>{if(m==="idle"){const v=window.setTimeout(()=>f("HIDE"),l.scrollHideDelay);return()=>window.clearTimeout(v)}},[m,l.scrollHideDelay,f]),g.useEffect(()=>{const v=l.viewport,p=u?"scrollLeft":"scrollTop";if(v){let x=v[p];const b=ft(()=>{const w=v[p];x!==w&&(f("SCROLL"),d()),x=w},"handleScroll");return v.addEventListener("scroll",b),()=>v.removeEventListener("scroll",b)}},[l.viewport,u,f,d]),o.jsx(qm,{present:s||m!=="hidden",children:o.jsx(ry,{"data-state":m==="hidden"?"hidden":"visible",...n,ref:r,onPointerEnter:Za(t.onPointerEnter,()=>f("POINTER_ENTER")),onPointerLeave:Za(t.onPointerLeave,()=>f("POINTER_LEAVE"))})})},"ScrollAreaScrollbarScroll")),ij=g.forwardRef(ft(function(t,r){const s=ji(da,t.__scopeScrollArea),{forceMount:n,...l}=t,[u,d]=g.useState(!1),m=t.orientation==="horizontal",f=Cd(()=>{if(s.viewport){const v=s.viewport.offsetWidth<s.viewport.scrollWidth,p=s.viewport.offsetHeight<s.viewport.scrollHeight;d(m?v:p)}},10);return Zo(s.viewport,f),Zo(s.content,f),o.jsx(qm,{present:n||u,children:o.jsx(ry,{"data-state":u?"visible":"hidden",...l,ref:r})})},"ScrollAreaScrollbarAuto")),ry=g.forwardRef(ft(function(t,r){const{orientation:s="vertical",...n}=t,l=ji(da,t.__scopeScrollArea),u=g.useRef(null),d=g.useRef(0),[m,f]=g.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),v=sy(m.viewport,m.content),p={...n,sizes:m,onSizesChange:f,hasThumb:v>0&&v<1,onThumbChange:ft(b=>u.current=b,"onThumbChange"),onThumbPointerUp:ft(()=>d.current=0,"onThumbPointerUp"),onThumbPointerDown:ft(b=>d.current=b,"onThumbPointerDown")};function x(b,w){return lj(b,d.current,m,w)}return ft(x,"getScrollPosition"),s==="horizontal"?o.jsx(c$,{...p,ref:r,onThumbPositionChange:()=>{if(l.viewport&&u.current){const b=l.viewport.scrollLeft,w=J_(b,m,l.dir);u.current.style.transform=`translate3d(${w}px, 0, 0)`}},onWheelScroll:b=>{l.viewport&&(l.viewport.scrollLeft=b)},onDragScroll:b=>{l.viewport&&(l.viewport.scrollLeft=x(b,l.dir))}}):s==="vertical"?o.jsx(u$,{...p,ref:r,onThumbPositionChange:()=>{if(l.viewport&&u.current){const b=l.viewport.scrollTop,w=J_(b,m);u.current.style.transform=`translate3d(0, ${w}px, 0)`}},onWheelScroll:b=>{l.viewport&&(l.viewport.scrollTop=b)},onDragScroll:b=>{l.viewport&&(l.viewport.scrollTop=x(b))}}):null},"ScrollAreaScrollbarVisible")),c$=g.forwardRef(ft(function(t,r){const{sizes:s,onSizesChange:n,...l}=t,u=ji(da,t.__scopeScrollArea),[d,m]=g.useState(),f=g.useRef(null),v=ut(r,f,u.onScrollbarXChange);return g.useEffect(()=>{f.current&&m(getComputedStyle(f.current))},[f]),o.jsx(aj,{"data-orientation":"horizontal",...l,ref:v,sizes:s,style:{bottom:0,left:u.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:u.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Sd(s)+"px",...t.style},onThumbPointerDown:p=>t.onThumbPointerDown(p.x),onDragScroll:p=>t.onDragScroll(p.x),onWheelScroll:(p,x)=>{if(u.viewport){const b=u.viewport.scrollLeft+p.deltaX;t.onWheelScroll(b),ny(b,x)&&p.preventDefault()}},onResize:()=>{f.current&&u.viewport&&d&&n({content:u.viewport.scrollWidth,viewport:u.viewport.offsetWidth,scrollbar:{size:f.current.clientWidth,paddingStart:td(d.paddingLeft),paddingEnd:td(d.paddingRight)}})}})},"ScrollAreaScrollbarX")),u$=g.forwardRef(ft(function(t,r){const{sizes:s,onSizesChange:n,...l}=t,u=ji(da,t.__scopeScrollArea),[d,m]=g.useState(),f=g.useRef(null),v=ut(r,f,u.onScrollbarYChange);return g.useEffect(()=>{f.current&&m(getComputedStyle(f.current))},[f]),o.jsx(aj,{"data-orientation":"vertical",...l,ref:v,sizes:s,style:{top:0,right:u.dir==="ltr"?0:void 0,left:u.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Sd(s)+"px",...t.style},onThumbPointerDown:p=>t.onThumbPointerDown(p.y),onDragScroll:p=>t.onDragScroll(p.y),onWheelScroll:(p,x)=>{if(u.viewport){const b=u.viewport.scrollTop+p.deltaY;t.onWheelScroll(b),ny(b,x)&&p.preventDefault()}},onResize:()=>{f.current&&u.viewport&&d&&n({content:u.viewport.scrollHeight,viewport:u.viewport.offsetHeight,scrollbar:{size:f.current.clientHeight,paddingStart:td(d.paddingTop),paddingEnd:td(d.paddingBottom)}})}})},"ScrollAreaScrollbarY")),[d$,nj]=rj(da),aj=g.forwardRef(ft(function(t,r){const{__scopeScrollArea:s,sizes:n,hasThumb:l,onThumbChange:u,onThumbPointerUp:d,onThumbPointerDown:m,onThumbPositionChange:f,onDragScroll:v,onWheelScroll:p,onResize:x,...b}=t,w=ji(da,s),[C,k]=g.useState(null),S=ut(r,k),E=g.useRef(null),N=g.useRef(""),R=w.viewport,A=n.content-n.viewport,D=Er(p),B=Er(f),$=Cd(x,10);function q(Y){if(E.current){const V=Y.clientX-E.current.left,U=Y.clientY-E.current.top;v({x:V,y:U})}}return ft(q,"handleDragScroll"),g.useEffect(()=>{const Y=ft(V=>{const U=V.target;(C==null?void 0:C.contains(U))&&D(V,A)},"handleWheel");return document.addEventListener("wheel",Y,{passive:!1}),()=>document.removeEventListener("wheel",Y,{passive:!1})},[R,C,A,D]),g.useEffect(B,[n,B]),Zo(C,$),Zo(w.content,$),o.jsx(d$,{scope:s,scrollbar:C,hasThumb:l,onThumbChange:Er(u),onThumbPointerUp:Er(d),onThumbPositionChange:B,onThumbPointerDown:Er(m),children:o.jsx(Xe.div,{...b,ref:S,style:{position:"absolute",...b.style},onPointerDown:Za(t.onPointerDown,Y=>{Y.button===0&&(Y.target.setPointerCapture(Y.pointerId),E.current=C.getBoundingClientRect(),N.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",w.viewport&&(w.viewport.style.scrollBehavior="auto"),q(Y))}),onPointerMove:Za(t.onPointerMove,q),onPointerUp:Za(t.onPointerUp,Y=>{const V=Y.target;V.hasPointerCapture(Y.pointerId)&&V.releasePointerCapture(Y.pointerId),document.body.style.webkitUserSelect=N.current,w.viewport&&(w.viewport.style.scrollBehavior=""),E.current=null})})})},"ScrollAreaScrollbarImpl")),Q_="ScrollAreaThumb",h$=g.forwardRef(ft(function(t,r){const{forceMount:s,...n}=t,l=nj(Q_,t.__scopeScrollArea);return o.jsx(qm,{present:s||l.hasThumb,children:o.jsx(f$,{ref:r,...n})})},"ScrollAreaThumb")),f$=g.forwardRef(ft(function(t,r){const{__scopeScrollArea:s,style:n,...l}=t,u=ji(Q_,s),d=nj(Q_,s),{onThumbPositionChange:m}=d,f=ut(r,d.onThumbChange),v=g.useRef(void 0),p=Cd(()=>{v.current&&(v.current(),v.current=void 0)},100);return g.useEffect(()=>{const x=u.viewport;if(x){const b=ft(()=>{if(p(),!v.current){const w=g$(x,m);v.current=w,m()}},"handleScroll");return m(),x.addEventListener("scroll",b),()=>x.removeEventListener("scroll",b)}},[u.viewport,p,m]),o.jsx(Xe.div,{"data-state":d.hasThumb?"visible":"hidden",...l,ref:f,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:Za(t.onPointerDownCapture,x=>{const w=x.target.getBoundingClientRect(),C=x.clientX-w.left,k=x.clientY-w.top;d.onThumbPointerDown({x:C,y:k})}),onPointerUp:Za(t.onPointerUp,d.onThumbPointerUp)})},"ScrollAreaThumbImpl")),oj="ScrollAreaCorner",m$=g.forwardRef(ft(function(t,r){const s=ji(oj,t.__scopeScrollArea),n=!!(s.scrollbarX&&s.scrollbarY);return s.type!=="scroll"&&n?o.jsx(p$,{...t,ref:r}):null},"ScrollAreaCorner")),p$=g.forwardRef(ft(function(t,r){const{__scopeScrollArea:s,...n}=t,l=ji(oj,s),[u,d]=g.useState(0),[m,f]=g.useState(0),v=!!(u&&m),{onCornerWidthChange:p,onCornerHeightChange:x}=l;return Zo(l.scrollbarX,()=>{var w;const b=((w=l.scrollbarX)==null?void 0:w.offsetHeight)||0;l.onCornerHeightChange(b),f(b)}),Zo(l.scrollbarY,()=>{var w;const b=((w=l.scrollbarY)==null?void 0:w.offsetWidth)||0;l.onCornerWidthChange(b),d(b)}),g.useEffect(()=>()=>{p(0),x(0)},[p,x]),v?o.jsx(Xe.div,{...n,ref:r,style:{width:u,height:m,position:"absolute",right:l.dir==="ltr"?0:void 0,left:l.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null},"ScrollAreaCornerImpl"));function td(e){return e?parseInt(e,10):0}ft(td,"toInt");function sy(e,t){const r=e/t;return isNaN(r)?0:r}ft(sy,"getThumbRatio");function Sd(e){const t=sy(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=(e.scrollbar.size-r)*t;return Math.max(s,18)}ft(Sd,"getThumbSize");function lj(e,t,r,s="ltr"){const n=Sd(r),l=n/2,u=t||l,d=n-u,m=r.scrollbar.paddingStart+u,f=r.scrollbar.size-r.scrollbar.paddingEnd-d,v=r.content-r.viewport,p=s==="ltr"?[0,v]:[v*-1,0];return iy([m,f],p)(e)}ft(lj,"getScrollPositionFromPointer");function J_(e,t,r="ltr"){const s=Sd(t),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,l=t.scrollbar.size-n,u=t.content-t.viewport,d=l-s,m=r==="ltr"?[0,u]:[u*-1,0],f=X_(e,m);return iy([0,u],[0,d])(f)}ft(J_,"getThumbOffsetFromScroll");function iy(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const s=(t[1]-t[0])/(e[1]-e[0]);return t[0]+s*(r-e[0])}}ft(iy,"linearScale");function ny(e,t){return e>0&&e<t}ft(ny,"isScrollingWithinScrollbarBounds");var g$=ft((e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},s=0;return ft((function n(){const l={left:e.scrollLeft,top:e.scrollTop},u=r.left!==l.left,d=r.top!==l.top;(u||d)&&t(),r=l,s=window.requestAnimationFrame(n)}),"loop")(),()=>window.cancelAnimationFrame(s)},"addUnlinkedScrollListener");function Cd(e,t){const r=Er(e),s=g.useRef(0);return g.useEffect(()=>()=>window.clearTimeout(s.current),[]),g.useCallback(()=>{window.clearTimeout(s.current),s.current=window.setTimeout(r,t)},[r,t])}ft(Cd,"useDebounceCallback");function Zo(e,t){const r=Er(t);ur(()=>{let s=0;if(e){const n=new ResizeObserver(()=>{cancelAnimationFrame(s),s=window.requestAnimationFrame(r)});return n.observe(e),()=>{window.cancelAnimationFrame(s),n.unobserve(e)}}},[e,r])}ft(Zo,"useResizeObserver");var cj=s$,v$=n$,_$=m$;const xn=g.forwardRef(({className:e,children:t,viewportClassName:r,viewportRef:s,viewportProps:n,scrollbars:l="vertical",type:u="auto",...d},m)=>o.jsxs(cj,{ref:m,"data-slot":"scroll-area",type:u,className:et("relative overflow-hidden",e),...d,children:[o.jsx(v$,{ref:s,"data-slot":"scroll-area-viewport",className:et("size-full rounded-[inherit] outline-none transition-[color,box-shadow] focus-visible:ring-2 focus-visible:ring-[var(--ring)]/45",l==="vertical"&&"[&>div]:!block [&>div]:min-w-0 [&>div]:w-full",r),...n,children:t}),l!=="horizontal"&&o.jsx(ex,{orientation:"vertical"}),l!=="vertical"&&o.jsx(ex,{orientation:"horizontal"}),o.jsx(_$,{"data-slot":"scroll-area-corner"})]}));xn.displayName=cj.displayName;const ex=g.forwardRef(({className:e,orientation:t="vertical",style:r,...s},n)=>o.jsx(sj,{ref:n,"data-slot":"scroll-area-scrollbar",orientation:t,className:et("group flex touch-none select-none p-px transition-colors",t==="vertical"&&"h-full w-2",t==="horizontal"&&"h-2 flex-col",e),style:{...t==="vertical"?{right:2}:{bottom:2},...r},...s,children:o.jsx(h$,{"data-slot":"scroll-area-thumb",className:et("relative flex-1 rounded-full bg-[var(--scrollbar-thumb)] transition-colors group-hover:bg-[var(--scrollbar-thumb-hover)] active:bg-[var(--scrollbar-thumb-active)]",t==="vertical"?"min-h-8 w-full":"h-full min-w-8")})}));ex.displayName=sj.displayName;function x$(e){const t=g.useRef({value:e,previous:e});return g.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var uj=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),y$="VisuallyHidden",b$=g.forwardRef((e,t)=>o.jsx(Xe.span,{...e,ref:t,style:{...uj,...e.style}}));b$.displayName=y$;var w$=[" ","Enter","ArrowUp","ArrowDown"],S$=[" ","Enter"],Qo="Select",[Vm,Gm,C$]=P0(Qo),[nl]=Gi(Qo,[C$,Um]),Ym=Um(),[k$,ho]=nl(Qo),[E$,R$]=nl(Qo),N$="SelectProvider";function dj(e){const{__scopeSelect:t,children:r,open:s,defaultOpen:n,onOpenChange:l,value:u,defaultValue:d,onValueChange:m,dir:f,name:v,autoComplete:p,disabled:x,required:b,form:w,internal_do_not_use_render:C}=e,k=Ym(t),[S,E]=g.useState(null),[N,R]=g.useState(null),[A,D]=g.useState(!1),B=gd(f),[$,q]=eo({prop:s,defaultProp:n??!1,onChange:l,caller:Qo}),[Y,V]=eo({prop:u,defaultProp:d,onChange:m,caller:Qo}),U=g.useRef(null),L=g.useRef(Y);g.useEffect(()=>{const G=w?S==null?void 0:S.ownerDocument.getElementById(w):S==null?void 0:S.form;if(G instanceof HTMLFormElement){const X=()=>V(L.current);return G.addEventListener("reset",X),()=>G.removeEventListener("reset",X)}},[w,S,V]);const I=S?!!w||!!S.closest("form"):!0,[F,M]=g.useState(new Set),P=Vs(),O=Array.from(F).map(G=>G.props.value).join(";"),W=g.useCallback(G=>{M(X=>new Set(X).add(G))},[]),H=g.useCallback(G=>{M(X=>{const ee=new Set(X);return ee.delete(G),ee})},[]),T={required:b,trigger:S,onTriggerChange:E,valueNode:N,onValueNodeChange:R,valueNodeHasChildren:A,onValueNodeHasChildrenChange:D,contentId:P,value:Y,onValueChange:V,open:$,onOpenChange:q,dir:B,triggerPointerDownPosRef:U,disabled:x,name:v,autoComplete:p,form:w,nativeOptions:F,nativeSelectKey:O,isFormControl:I};return o.jsx(G0,{...k,children:o.jsx(k$,{scope:t,...T,children:o.jsx(Vm.Provider,{scope:t,children:o.jsx(E$,{scope:t,onNativeOptionAdd:W,onNativeOptionRemove:H,children:H$(C)?C(T):r})})})})}dj.displayName=N$;var hj=e=>{const{__scopeSelect:t,children:r,...s}=e;return o.jsx(dj,{__scopeSelect:t,...s,internal_do_not_use_render:({isFormControl:n})=>o.jsxs(o.Fragment,{children:[r,n?o.jsx(Tj,{__scopeSelect:t}):null]})})};hj.displayName=Qo;var fj="SelectTrigger",ay=g.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:s=!1,...n}=e,l=Ym(r),u=ho(fj,r),d=u.disabled||s,m=ut(t,u.onTriggerChange),f=Gm(r),v=g.useRef("touch"),[p,x,b]=Dj(C=>{const k=f().filter(N=>!N.disabled),S=k.find(N=>N.value===u.value),E=Lj(k,C,S);E!==void 0&&u.onValueChange(E.value)}),w=C=>{d||(u.onOpenChange(!0),b()),C&&(u.triggerPointerDownPosRef.current={x:Math.round(C.pageX),y:Math.round(C.pageY)})};return o.jsx(FR,{asChild:!0,...l,children:o.jsx(Xe.button,{type:"button",role:"combobox","aria-controls":u.open?u.contentId:void 0,"aria-expanded":u.open,"aria-required":u.required,"aria-autocomplete":"none",dir:u.dir,"data-state":u.open?"open":"closed",disabled:d,"data-disabled":d?"":void 0,"data-placeholder":Km(u.value)?"":void 0,...n,ref:m,onClick:Be(n.onClick,C=>{C.currentTarget.focus(),v.current!=="mouse"&&w(C)}),onPointerDown:Be(n.onPointerDown,C=>{v.current=C.pointerType;const k=C.target;k.hasPointerCapture(C.pointerId)&&k.releasePointerCapture(C.pointerId),C.button===0&&C.ctrlKey===!1&&C.pointerType==="mouse"&&(w(C),C.preventDefault())}),onKeyDown:Be(n.onKeyDown,C=>{const k=p.current!=="";!(C.ctrlKey||C.altKey||C.metaKey)&&C.key.length===1&&x(C.key),!(k&&C.key===" ")&&w$.includes(C.key)&&(w(),C.preventDefault())})})})});ay.displayName=fj;var mj="SelectValue",oy=g.forwardRef((e,t)=>{const{__scopeSelect:r,className:s,style:n,children:l,placeholder:u="",...d}=e,m=ho(mj,r),{onValueNodeHasChildrenChange:f}=m,v=l!==void 0,p=ut(t,m.onValueNodeChange);ur(()=>{f(v)},[f,v]);const x=Km(m.value);return o.jsx(Xe.span,{...d,asChild:x?!1:d.asChild,ref:p,style:{pointerEvents:"none"},children:o.jsx(g.Fragment,{children:x?u:l},x?"placeholder":"value")})});oy.displayName=mj;var j$="SelectIcon",pj=g.forwardRef((e,t)=>{const{__scopeSelect:r,children:s,...n}=e;return o.jsx(Xe.span,{"aria-hidden":!0,...n,ref:t,children:s||"▼"})});pj.displayName=j$;var gj="SelectPortal",[A$,M$]=nl(gj,{forceMount:void 0}),vj=e=>{const{__scopeSelect:t,forceMount:r,...s}=e;return o.jsx(A$,{scope:e.__scopeSelect,forceMount:r,children:o.jsx(Nm,{asChild:!0,...s})})};vj.displayName=gj;var so="SelectContent",ly=g.forwardRef((e,t)=>{const r=M$(so,e.__scopeSelect),{forceMount:s=r.forceMount,...n}=e,l=ho(so,e.__scopeSelect),[u,d]=g.useState();return ur(()=>{d(new DocumentFragment)},[]),o.jsx(Yi,{present:s||l.open,children:({present:m})=>m?o.jsx(yj,{...n,ref:t}):o.jsx(_j,{...n,fragment:u})})});ly.displayName=so;var _j=g.forwardRef((e,t)=>{const{__scopeSelect:r,children:s,fragment:n}=e;return n?na.createPortal(o.jsx(xj,{scope:r,children:o.jsx(Vm.Slot,{scope:r,children:o.jsx("div",{ref:t,children:s})})}),n):null});_j.displayName="SelectContentFragment";var Pi=10,[xj,fo]=nl(so),T$="SelectContentImpl",D$=Ko("SelectContent.RemoveScroll"),yj=g.forwardRef((e,t)=>{const{__scopeSelect:r}=e,{position:s="item-aligned",onCloseAutoFocus:n,onEscapeKeyDown:l,onPointerDownOutside:u,side:d,sideOffset:m,align:f,alignOffset:v,arrowPadding:p,collisionBoundary:x,collisionPadding:b,sticky:w,hideWhenDetached:C,avoidCollisions:k,...S}=e,E=ho(so,r),[N,R]=g.useState(null),[A,D]=g.useState(null),B=ut(t,R),[$,q]=g.useState(null),[Y,V]=g.useState(null),U=Gm(r),[L,I]=g.useState(!1),F=g.useRef(!1);g.useEffect(()=>{if(N)return N0(N)},[N]),R0();const M=g.useCallback(Z=>{const[ce,...le]=U().map(Ee=>Ee.ref.current),[be]=le.slice(-1),ke=document.activeElement;for(const Ee of Z)if(Ee===ke||(Ee==null||Ee.scrollIntoView({block:"nearest"}),Ee===ce&&A&&(A.scrollTop=0),Ee===be&&A&&(A.scrollTop=A.scrollHeight),Ee==null||Ee.focus(),document.activeElement!==ke))return},[U,A]),P=g.useCallback(()=>M([$,N]),[M,$,N]);g.useEffect(()=>{L&&P()},[L,P]);const{onOpenChange:O,triggerPointerDownPosRef:W}=E;g.useEffect(()=>{if(N){let Z={x:0,y:0};const ce=be=>{var ke,Ee;Z={x:Math.abs(Math.round(be.pageX)-(((ke=W.current)==null?void 0:ke.x)??0)),y:Math.abs(Math.round(be.pageY)-(((Ee=W.current)==null?void 0:Ee.y)??0))}},le=be=>{Z.x<=10&&Z.y<=10?be.preventDefault():be.composedPath().includes(N)||O(!1),document.removeEventListener("pointermove",ce),W.current=null};return W.current!==null&&(document.addEventListener("pointermove",ce),document.addEventListener("pointerup",le,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ce),document.removeEventListener("pointerup",le,{capture:!0})}}},[N,O,W]),g.useEffect(()=>{const Z=()=>O(!1);return window.addEventListener("blur",Z),window.addEventListener("resize",Z),()=>{window.removeEventListener("blur",Z),window.removeEventListener("resize",Z)}},[O]);const[H,T]=Dj(Z=>{const ce=U().filter(ke=>!ke.disabled),le=ce.find(ke=>ke.ref.current===document.activeElement),be=Lj(ce,Z,le);be&&setTimeout(()=>{var ke;return(ke=be.ref.current)==null?void 0:ke.focus()})}),G=g.useCallback((Z,ce,le)=>{const be=!F.current&&!le;(E.value!==void 0&&E.value===ce||be)&&(q(Z),be&&(F.current=!0))},[E.value]),X=g.useCallback(()=>N==null?void 0:N.focus(),[N]),ee=g.useCallback((Z,ce,le)=>{const be=!F.current&&!le;(E.value!==void 0&&E.value===ce||be)&&V(Z)},[E.value]),oe=s==="popper"?tx:bj,de=oe===tx?{side:d,sideOffset:m,align:f,alignOffset:v,arrowPadding:p,collisionBoundary:x,collisionPadding:b,sticky:w,hideWhenDetached:C,avoidCollisions:k}:{};return o.jsx(xj,{scope:r,content:N,viewport:A,onViewportChange:D,itemRefCallback:G,selectedItem:$,onItemLeave:X,itemTextRefCallback:ee,focusSelectedItem:P,selectedItemText:Y,position:s,isPositioned:L,searchRef:H,children:o.jsx(Am,{as:D$,allowPinchZoom:!0,children:o.jsx(Rm,{asChild:!0,trapped:E.open,onMountAutoFocus:Z=>{Z.preventDefault()},onUnmountAutoFocus:Be(n,Z=>{var ce;(ce=E.trigger)==null||ce.focus({preventScroll:!0}),Z.preventDefault()}),children:o.jsx(Em,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:Z=>Z.preventDefault(),onDismiss:()=>E.onOpenChange(!1),children:o.jsx(oe,{role:"listbox",id:E.contentId,"data-state":E.open?"open":"closed",dir:E.dir,onContextMenu:Z=>Z.preventDefault(),...S,...de,onPlaced:()=>I(!0),ref:B,style:{display:"flex",flexDirection:"column",outline:"none",...S.style},onKeyDown:Be(S.onKeyDown,Z=>{const ce=Z.ctrlKey||Z.altKey||Z.metaKey;if(Z.key==="Tab"&&Z.preventDefault(),!ce&&Z.key.length===1&&T(Z.key),["ArrowUp","ArrowDown","Home","End"].includes(Z.key)){let be=U().filter(ke=>!ke.disabled).map(ke=>ke.ref.current);if(["ArrowUp","End"].includes(Z.key)&&(be=be.slice().reverse()),["ArrowUp","ArrowDown"].includes(Z.key)){const ke=Z.target,Ee=be.indexOf(ke);be=be.slice(Ee+1)}setTimeout(()=>M(be)),Z.preventDefault()}})})})})})})});yj.displayName=T$;var L$="SelectItemAlignedPosition",bj=g.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:s,...n}=e,l=ho(so,r),u=fo(so,r),[d,m]=g.useState(null),[f,v]=g.useState(null),p=ut(t,v),x=Gm(r),b=g.useRef(!1),w=g.useRef(!0),{viewport:C,selectedItem:k,selectedItemText:S,focusSelectedItem:E}=u,N=g.useCallback(()=>{if(l.trigger&&l.valueNode&&d&&f&&C&&k&&S){const B=l.trigger.getBoundingClientRect(),$=f.getBoundingClientRect(),q=l.valueNode.getBoundingClientRect(),Y=S.getBoundingClientRect();if(l.dir!=="rtl"){const ke=Y.left-$.left,Ee=q.left-ke,te=B.left-Ee,re=B.width+te,Ce=Math.max(re,$.width),De=window.innerWidth-Pi,_e=X_(Ee,[Pi,Math.max(Pi,De-Ce)]);d.style.minWidth=re+"px",d.style.left=_e+"px"}else{const ke=$.right-Y.right,Ee=window.innerWidth-q.right-ke,te=window.innerWidth-B.right-Ee,re=B.width+te,Ce=Math.max(re,$.width),De=window.innerWidth-Pi,_e=X_(Ee,[Pi,Math.max(Pi,De-Ce)]);d.style.minWidth=re+"px",d.style.right=_e+"px"}const V=x(),U=window.innerHeight-Pi*2,L=C.scrollHeight,I=window.getComputedStyle(f),F=parseInt(I.borderTopWidth,10),M=parseInt(I.paddingTop,10),P=parseInt(I.borderBottomWidth,10),O=parseInt(I.paddingBottom,10),W=F+M+L+O+P,H=Math.min(k.offsetHeight*5,W),T=window.getComputedStyle(C),G=parseInt(T.paddingTop,10),X=parseInt(T.paddingBottom,10),ee=B.top+B.height/2-Pi,oe=U-ee,de=k.offsetHeight/2,Z=k.offsetTop+de,ce=F+M+Z,le=W-ce;if(ce<=ee){const ke=V.length>0&&k===V[V.length-1].ref.current;d.style.bottom="0px";const Ee=f.clientHeight-C.offsetTop-C.offsetHeight,te=Math.max(oe,de+(ke?X:0)+Ee+P),re=ce+te;d.style.height=re+"px"}else{const ke=V.length>0&&k===V[0].ref.current;d.style.top="0px";const te=Math.max(ee,F+C.offsetTop+(ke?G:0)+de)+le;d.style.height=te+"px",C.scrollTop=ce-ee+C.offsetTop}d.style.margin=`${Pi}px 0`,d.style.minHeight=H+"px",d.style.maxHeight=U+"px",s==null||s(),requestAnimationFrame(()=>b.current=!0)}},[x,l.trigger,l.valueNode,d,f,C,k,S,l.dir,s]);ur(()=>N(),[N]);const[R,A]=g.useState();ur(()=>{f&&A(window.getComputedStyle(f).zIndex)},[f]);const D=g.useCallback(B=>{B&&w.current===!0&&(N(),E==null||E(),w.current=!1)},[N,E]);return o.jsx(B$,{scope:r,contentWrapper:d,shouldExpandOnScrollRef:b,onScrollButtonChange:D,children:o.jsx("div",{ref:m,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:R},children:o.jsx(Xe.div,{...n,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...n.style}})})})});bj.displayName=L$;var O$="SelectPopperPosition",tx=g.forwardRef((e,t)=>{const{__scopeSelect:r,align:s="start",collisionPadding:n=Pi,...l}=e,u=Ym(r);return o.jsx(WR,{...u,...l,ref:t,align:s,collisionPadding:n,style:{boxSizing:"border-box",...l.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});tx.displayName=O$;var[B$,cy]=nl(so,{}),rx="SelectViewport",wj=g.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:s,...n}=e,l=fo(rx,r),u=cy(rx,r),d=ut(t,l.onViewportChange),m=g.useRef(0);return o.jsxs(o.Fragment,{children:[o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),o.jsx(Vm.Slot,{scope:r,children:o.jsx(Xe.div,{"data-radix-select-viewport":"",role:"presentation",...n,ref:d,style:{position:"relative",flex:1,overflow:"hidden auto",...n.style},onScroll:Be(n.onScroll,f=>{const v=f.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:x}=u;if(x!=null&&x.current&&p){const b=Math.abs(m.current-v.scrollTop);if(b>0){const w=window.innerHeight-Pi*2,C=parseFloat(p.style.minHeight),k=parseFloat(p.style.height),S=Math.max(C,k);if(S<w){const E=S+b,N=Math.min(w,E),R=E-N;p.style.height=N+"px",p.style.bottom==="0px"&&(v.scrollTop=R>0?R:0,p.style.justifyContent="flex-end")}}}m.current=v.scrollTop})})})]})});wj.displayName=rx;var Sj="SelectGroup",[P$,I$]=nl(Sj),uy=g.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e,n=Vs();return o.jsx(P$,{scope:r,id:n,children:o.jsx(Xe.div,{role:"group","aria-labelledby":n,...s,ref:t})})});uy.displayName=Sj;var Cj="SelectLabel",dy=g.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e,n=I$(Cj,r);return o.jsx(Xe.div,{id:n.id,...s,ref:t})});dy.displayName=Cj;var nm="SelectItem",[z$,kj]=nl(nm),hy=g.forwardRef((e,t)=>{const{__scopeSelect:r,value:s,disabled:n=!1,textValue:l,...u}=e,d=ho(nm,r),m=fo(nm,r),f=d.value===s,[v,p]=g.useState(l??""),[x,b]=g.useState(!1),w=Er(N=>{var R;return(R=m.itemRefCallback)==null?void 0:R.call(m,N,s,n)}),C=ut(t,w),k=Vs(),S=g.useRef("touch"),E=()=>{n||(d.onValueChange(s),d.onOpenChange(!1))};return o.jsx(z$,{scope:r,value:s,disabled:n,textId:k,isSelected:f,onItemTextChange:g.useCallback(N=>{p(R=>R||((N==null?void 0:N.textContent)??"").trim())},[]),children:o.jsx(Vm.ItemSlot,{scope:r,value:s,disabled:n,textValue:v,children:o.jsx(Xe.div,{role:"option","aria-labelledby":k,"data-highlighted":x?"":void 0,"aria-selected":f&&x,"data-state":f?"checked":"unchecked","aria-disabled":n||void 0,"data-disabled":n?"":void 0,tabIndex:n?void 0:-1,...u,ref:C,onFocus:Be(u.onFocus,()=>b(!0)),onBlur:Be(u.onBlur,()=>b(!1)),onClick:Be(u.onClick,()=>{S.current!=="mouse"&&E()}),onPointerUp:Be(u.onPointerUp,()=>{S.current==="mouse"&&E()}),onPointerDown:Be(u.onPointerDown,N=>{S.current=N.pointerType}),onPointerMove:Be(u.onPointerMove,N=>{var R;S.current=N.pointerType,n?(R=m.onItemLeave)==null||R.call(m):S.current==="mouse"&&N.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Be(u.onPointerLeave,N=>{var R;N.currentTarget===document.activeElement&&((R=m.onItemLeave)==null||R.call(m))}),onKeyDown:Be(u.onKeyDown,N=>{var A;n||N.target!==N.currentTarget||((A=m.searchRef)==null?void 0:A.current)!==""&&N.key===" "||(S$.includes(N.key)&&E(),N.key===" "&&N.preventDefault())})})})})});hy.displayName=nm;var Bu="SelectItemText",Ej=g.forwardRef((e,t)=>{const{__scopeSelect:r,className:s,style:n,...l}=e,u=ho(Bu,r),d=fo(Bu,r),m=kj(Bu,r),f=R$(Bu,r),[v,p]=g.useState(null),x=Er(E=>{var N;return(N=d.itemTextRefCallback)==null?void 0:N.call(d,E,m.value,m.disabled)}),b=ut(t,p,m.onItemTextChange,x),w=v==null?void 0:v.textContent,C=g.useMemo(()=>o.jsx("option",{value:m.value,disabled:m.disabled,children:w},m.value),[m.disabled,m.value,w]),{onNativeOptionAdd:k,onNativeOptionRemove:S}=f;return ur(()=>(k(C),()=>S(C)),[k,S,C]),o.jsxs(o.Fragment,{children:[o.jsx(Xe.span,{id:m.textId,...l,ref:b}),m.isSelected&&u.valueNode&&!u.valueNodeHasChildren&&!Km(u.value)?na.createPortal(l.children,u.valueNode):null]})});Ej.displayName=Bu;var Rj="SelectItemIndicator",Nj=g.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e;return kj(Rj,r).isSelected?o.jsx(Xe.span,{"aria-hidden":!0,...s,ref:t}):null});Nj.displayName=Rj;var sx="SelectScrollUpButton",fy=g.forwardRef((e,t)=>{const r=fo(sx,e.__scopeSelect),s=cy(sx,e.__scopeSelect),[n,l]=g.useState(!1),u=ut(t,s.onScrollButtonChange);return ur(()=>{if(r.viewport&&r.isPositioned){let d=function(){const f=m.scrollTop>0;l(f)};const m=r.viewport;return d(),m.addEventListener("scroll",d),()=>m.removeEventListener("scroll",d)}},[r.viewport,r.isPositioned]),n?o.jsx(jj,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:m}=r;d&&m&&(d.scrollTop=d.scrollTop-m.offsetHeight)}}):null});fy.displayName=sx;var ix="SelectScrollDownButton",my=g.forwardRef((e,t)=>{const r=fo(ix,e.__scopeSelect),s=cy(ix,e.__scopeSelect),[n,l]=g.useState(!1),u=ut(t,s.onScrollButtonChange);return ur(()=>{if(r.viewport&&r.isPositioned){let d=function(){const f=m.scrollHeight-m.clientHeight,v=Math.ceil(m.scrollTop)<f;l(v)};const m=r.viewport;return d(),m.addEventListener("scroll",d),()=>m.removeEventListener("scroll",d)}},[r.viewport,r.isPositioned]),n?o.jsx(jj,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:m}=r;d&&m&&(d.scrollTop=d.scrollTop+m.offsetHeight)}}):null});my.displayName=ix;var jj=g.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:s,...n}=e,l=fo("SelectScrollButton",r),u=g.useRef(null),d=Gm(r),m=g.useCallback(()=>{u.current!==null&&(window.clearInterval(u.current),u.current=null)},[]);return g.useEffect(()=>()=>m(),[m]),ur(()=>{var v;const f=d().find(p=>p.ref.current===document.activeElement);(v=f==null?void 0:f.ref.current)==null||v.scrollIntoView({block:"nearest"})},[d]),o.jsx(Xe.div,{"aria-hidden":!0,...n,ref:t,style:{flexShrink:0,...n.style},onPointerDown:Be(n.onPointerDown,()=>{u.current===null&&(u.current=window.setInterval(s,50))}),onPointerMove:Be(n.onPointerMove,()=>{var f;(f=l.onItemLeave)==null||f.call(l),u.current===null&&(u.current=window.setInterval(s,50))}),onPointerLeave:Be(n.onPointerLeave,()=>{m()})})}),$$="SelectSeparator",py=g.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e;return o.jsx(Xe.div,{"aria-hidden":!0,...s,ref:t})});py.displayName=$$;var Aj="SelectArrow",U$=g.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e,n=Ym(r);return fo(Aj,r).position==="popper"?o.jsx(qR,{...n,...s,ref:t}):null});U$.displayName=Aj;var Mj="SelectBubbleInput",Tj=g.forwardRef(({__scopeSelect:e,...t},r)=>{const s=ho(Mj,e),{value:n,onValueChange:l,required:u,disabled:d,name:m,autoComplete:f,form:v}=s,{nativeOptions:p,nativeSelectKey:x}=s,b=g.useRef(null),w=ut(r,b),C=n??"",k=x$(C),S=Array.from(p).some(E=>(E.props.value??"")==="");return g.useEffect(()=>{const E=b.current;if(!E)return;const N=window.HTMLSelectElement.prototype,A=Object.getOwnPropertyDescriptor(N,"value").set;if(k!==C&&A){const D=new Event("change",{bubbles:!0});A.call(E,C),E.dispatchEvent(D)}},[k,C]),o.jsxs(Xe.select,{"aria-hidden":!0,required:u,tabIndex:-1,name:m,autoComplete:f,disabled:d,form:v,onChange:E=>l(E.target.value),...t,style:{...uj,...t.style},ref:w,defaultValue:C,children:[Km(n)&&!S?o.jsx("option",{value:""}):null,Array.from(p)]},x)});Tj.displayName=Mj;function H$(e){return typeof e=="function"}function Km(e){return e===""||e===void 0}function Dj(e){const t=Er(e),r=g.useRef(""),s=g.useRef(0),n=g.useCallback(u=>{const d=r.current+u;t(d),(function m(f){r.current=f,window.clearTimeout(s.current),f!==""&&(s.current=window.setTimeout(()=>m(""),1e3))})(d)},[t]),l=g.useCallback(()=>{r.current="",window.clearTimeout(s.current)},[]);return g.useEffect(()=>()=>window.clearTimeout(s.current),[]),[r,n,l]}function Lj(e,t,r){const n=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,l=r?e.indexOf(r):-1;let u=F$(e,Math.max(l,0));n.length===1&&(u=u.filter(f=>f!==r));const m=u.find(f=>f.textValue.toLowerCase().startsWith(n.toLowerCase()));return m!==r?m:void 0}function F$(e,t){return e.map((r,s)=>e[(t+s)%e.length])}function gn(e){return o.jsx(hj,{"data-slot":"select",...e})}const Oj=g.forwardRef(({className:e,...t},r)=>o.jsx(uy,{ref:r,"data-slot":"select-group",className:et("scroll-my-1 p-1",e),...t}));Oj.displayName=uy.displayName;const $i=g.forwardRef((e,t)=>o.jsx(oy,{ref:t,"data-slot":"select-value",...e}));$i.displayName=oy.displayName;const Ui=g.forwardRef(({className:e,size:t="default",children:r,...s},n)=>o.jsxs(ay,{ref:n,"data-slot":"select-trigger","data-size":t,className:et("flex w-full min-w-0 items-center justify-between gap-1.5 whitespace-nowrap rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&>span]:min-w-0 [&>span]:truncate [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...s,children:[r,o.jsx(pj,{asChild:!0,children:o.jsx(md,{"aria-hidden":"true",className:"pointer-events-none size-4 shrink-0 text-muted-foreground"})})]}));Ui.displayName=ay.displayName;const Bj=g.forwardRef(({className:e,...t},r)=>o.jsx(fy,{ref:r,"data-slot":"select-scroll-up-button",className:et("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:o.jsx($4,{"aria-hidden":"true"})}));Bj.displayName=fy.displayName;const Pj=g.forwardRef(({className:e,...t},r)=>o.jsx(my,{ref:r,"data-slot":"select-scroll-down-button",className:et("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:o.jsx(md,{"aria-hidden":"true"})}));Pj.displayName=my.displayName;const Hi=g.forwardRef(({className:e,children:t,position:r="popper",align:s="center",sideOffset:n=4,collisionPadding:l=8,...u},d)=>o.jsx(vj,{children:o.jsxs(ly,{ref:d,"data-slot":"select-content","data-align-trigger":r==="item-aligned",position:r,align:s,sideOffset:n,collisionPadding:l,className:et("cn-menu-translucent relative z-50 max-h-[var(--radix-select-content-available-height)] min-w-36 origin-[var(--radix-select-content-transform-origin)] overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r==="popper"&&"w-[var(--radix-select-trigger-width)] data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),...u,children:[o.jsx(Bj,{}),o.jsx(wj,{"data-position":r,className:et("p-1",r==="popper"&&"min-w-[var(--radix-select-trigger-width)]"),children:t}),o.jsx(Pj,{})]})}));Hi.displayName=ly.displayName;const Ij=g.forwardRef(({className:e,...t},r)=>o.jsx(dy,{ref:r,"data-slot":"select-label",className:et("px-1.5 py-1 text-xs text-muted-foreground",e),...t}));Ij.displayName=dy.displayName;const cr=g.forwardRef(({className:e,children:t,...r},s)=>o.jsxs(hy,{ref:s,"data-slot":"select-item",className:et("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[o.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center",children:o.jsx(Nj,{children:o.jsx(Br,{"aria-hidden":"true",className:"pointer-events-none"})})}),o.jsx(Ej,{children:t})]}));cr.displayName=hy.displayName;const Xm=g.forwardRef(({className:e,...t},r)=>o.jsx(py,{ref:r,"data-slot":"select-separator",className:et("pointer-events-none -mx-1 my-1 h-px bg-border",e),...t}));Xm.displayName=py.displayName;var W$=Object.defineProperty,wc=(e,t)=>W$(e,"name",{value:t,configurable:!0}),zj=!!(typeof window<"u"&&window.document&&window.document.createElement);function gy(e,t,{checkForDefaultPrevented:r=!0}={}){return wc(function(n){if(e==null||e(n),r===!1||!n||!n.defaultPrevented)return t==null?void 0:t(n)},"handleEvent")}wc(gy,"composeEventHandlers");function q$(e){var t;if(!zj)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}wc(q$,"getOwnerWindow");function nx(e){if(!zj)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}wc(nx,"getOwnerDocument");function $j(e,t=!1){const{activeElement:r}=nx(e);if(!(r!=null&&r.nodeName))return null;if(Uj(r)&&r.contentDocument)return $j(r.contentDocument.body,t);if(t){const s=r.getAttribute("aria-activedescendant");if(s){const n=nx(r).getElementById(s);if(n)return n}}return r}wc($j,"getActiveElement");function Uj(e){return e.tagName==="IFRAME"}wc(Uj,"isFrame");var V$=Object.defineProperty,vy=(e,t)=>V$(e,"name",{value:t,configurable:!0});function ax(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}vy(ax,"setRef");function Hj(...e){return t=>{let r=!1;const s=e.map(n=>{const l=ax(n,t);return!r&&typeof l=="function"&&(r=!0),l});if(r)return()=>{for(let n=0;n<s.length;n++){const l=s[n];typeof l=="function"?l():ax(e[n],null)}}}}vy(Hj,"composeRefs");function Zm(...e){return g.useCallback(Hj(...e),e)}vy(Zm,"useComposedRefs");var G$=Object.defineProperty,yi=(e,t)=>G$(e,"name",{value:t,configurable:!0});function Y$(e,t){const r=g.createContext(t);r.displayName=e+"Context";const s=yi(l=>{const{children:u,...d}=l,m=g.useMemo(()=>d,Object.values(d));return o.jsx(r.Provider,{value:m,children:u})},"Provider");s.displayName=e+"Provider";function n(l,u={}){const{optional:d=!1}=u,m=g.useContext(r);if(m)return m;if(t!==void 0)return t;if(!d)throw new Error(`\`${l}\` must be used within \`${e}\``)}return yi(n,"useContext"),[s,n]}yi(Y$,"createContext");function Fj(e,t=[]){let r=[];function s(l,u){const d=g.createContext(u);d.displayName=l+"Context";const m=r.length;r=[...r,u];const f=yi(p=>{var S;const{scope:x,children:b,...w}=p,C=((S=x==null?void 0:x[e])==null?void 0:S[m])||d,k=g.useMemo(()=>w,Object.values(w));return o.jsx(C.Provider,{value:k,children:b})},"Provider");f.displayName=l+"Provider";function v(p,x,b={}){var S;const{optional:w=!1}=b,C=((S=x==null?void 0:x[e])==null?void 0:S[m])||d,k=g.useContext(C);if(k)return k;if(u!==void 0)return u;if(!w)throw new Error(`\`${p}\` must be used within \`${l}\``)}return yi(v,"useContext"),[f,v]}yi(s,"createContext");const n=yi(()=>{const l=r.map(u=>g.createContext(u));return yi(function(d){const m=(d==null?void 0:d[e])||l;return g.useMemo(()=>({[`__scope${e}`]:{...d,[e]:m}}),[d,m])},"useScope")},"createScope");return n.scopeName=e,[s,Wj(n,...t)]}yi(Fj,"createContextScope");function Wj(...e){const t=e[0];if(e.length===1)return t;const r=yi(()=>{const s=e.map(n=>({useScope:n(),scopeName:n.scopeName}));return yi(function(l){const u=s.reduce((d,{useScope:m,scopeName:f})=>{const p=m(l)[`__scope${f}`];return{...d,...p}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])},"useComposedScopes")},"createScope");return r.scopeName=t.scopeName,r}yi(Wj,"composeContextScopes");var _y=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},K$=Object.defineProperty,X$=(e,t)=>K$(e,"name",{value:t,configurable:!0}),HC=no[" useEffectEvent ".trim().toString()],FC=no[" useInsertionEffect ".trim().toString()];function qj(e){if(typeof HC=="function")return HC(e);const t=g.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof FC=="function"?FC(()=>{t.current=e}):_y(()=>{t.current=e}),g.useMemo(()=>((...r)=>{var s;return(s=t.current)==null?void 0:s.call(t,...r)}),[])}X$(qj,"useEffectEvent");var Z$=Object.defineProperty,kd=(e,t)=>Z$(e,"name",{value:t,configurable:!0}),Q$=no[" useInsertionEffect ".trim().toString()]||_y;function Vj({prop:e,defaultProp:t,onChange:r=kd(()=>{},"onChange"),caller:s}){const[n,l,u]=Gj({defaultProp:t,onChange:r}),d=e!==void 0,m=d?e:n,f=g.useCallback(v=>{var p;if(d){const x=Yj(v)?v(e):v;x!==e&&((p=u.current)==null||p.call(u,x))}else l(v)},[d,e,l,u]);return[m,f]}kd(Vj,"useControllableState");function Gj({defaultProp:e,onChange:t}){const[r,s]=g.useState(e),n=g.useRef(r),l=g.useRef(t);return Q$(()=>{l.current=t},[t]),g.useEffect(()=>{var u;n.current!==r&&((u=l.current)==null||u.call(l,r),n.current=r)},[r,n]),[r,s,l]}kd(Gj,"useUncontrolledState");function Yj(e){return typeof e=="function"}kd(Yj,"isFunction");var WC=Symbol("RADIX:SYNC_STATE");function J$(e,t,r,s){const{prop:n,defaultProp:l,onChange:u,caller:d}=t,m=n!==void 0,f=qj(u),v=[{...r,state:l}];s&&v.push(s);const[p,x]=g.useReducer((k,S)=>{if(S.type===WC)return{...k,state:S.state};const E=e(k,S);return m&&!Object.is(E.state,k.state)&&f(E.state),E},...v),b=p.state,w=g.useRef(b);g.useEffect(()=>{w.current!==b&&(w.current=b,m||f(b))},[b,w,m]);const C=g.useMemo(()=>n!==void 0?{...p,state:n}:p,[p,n]);return g.useEffect(()=>{m&&!Object.is(n,p.state)&&x({type:WC,state:n})},[n,p.state,m]),[C,x]}kd(J$,"useControllableStateReducer");var e9=Object.defineProperty,t9=(e,t)=>e9(e,"name",{value:t,configurable:!0});function Kj(e){const[t,r]=g.useState(void 0);return _y(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(n=>{if(!Array.isArray(n)||!n.length)return;const l=n[0];let u,d;if("borderBoxSize"in l){const m=l.borderBoxSize,f=Array.isArray(m)?m[0]:m;u=f.inlineSize,d=f.blockSize}else u=e.offsetWidth,d=e.offsetHeight;r({width:u,height:d})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else r(void 0)},[e]),t}t9(Kj,"useSize");var r9=Object.defineProperty,Ai=(e,t)=>r9(e,"name",{value:t,configurable:!0}),s9=Ai(((e,t)=>{const r={...t};for(const s in t){const n=e[s],l=t[s];if(/^on[A-Z]/.test(s))if(n&&l){const d=typeof n=="function",m=typeof l=="function";r[s]=(...f)=>{const v=m?l(...f):void 0;return d&&n(...f),v}}else n&&(r[s]=n);else s==="style"?r[s]={...typeof n=="object"?n:null,...typeof l=="object"?l:null}:s==="className"?r[s]=[n,l].filter(Boolean).join(" "):s==="aria-describedby"&&(r[s]=Xj(l,n))}return{...e,...r}}),"mergeProps");function Xj(...e){const t=new Set;for(const r of e)if(typeof r=="string")for(const s of String(r).trim().split(/\s+/))s&&t.add(s);return t.size>0?Array.from(t).join(" "):void 0}Ai(Xj,"concatAriaDescribedby");var Zj=g.createContext(s9);Zj.displayName="SlotContext";function Qj(e){const t=g.forwardRef((r,s)=>{const n=g.useContext(Zj);let{children:l,mergeProps:u=n,...d}=r,m=null,f=!1;const v=[];ox(l)&&typeof ef=="function"&&(l=ef(l._payload)),g.Children.forEach(l,w=>{var C;if(tA(w)){f=!0;const k=w;let S="child"in k.props?k.props.child:k.props.children;ox(S)&&typeof ef=="function"&&(S=ef(S._payload)),m=n9(k,S),v.push((C=m==null?void 0:m.props)==null?void 0:C.children)}else v.push(w)}),m?m=g.cloneElement(m,void 0,v):!f&&g.Children.count(l)===1&&g.isValidElement(l)&&(m=l);const p=m?eA(m):void 0,x=Zm(s,p);if(!m){if(l||l===0)throw new Error(f?l9(e):o9(e));return l}const b=u(d,m.props??{});return m.type!==g.Fragment&&(b.ref=s?x:p),g.cloneElement(m,b)});return t.displayName=`${e}.Slot`,t}Ai(Qj,"createSlot");var Jj=Symbol.for("radix.slottable");function i9(e){const t=Ai(r=>"child"in r?r.children(r.child):r.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=Jj,t}Ai(i9,"createSlottable");var n9=Ai((e,t)=>{if("child"in e.props){const r=e.props.child;return g.isValidElement(r)?g.cloneElement(r,void 0,e.props.children(r.props.children)):null}return g.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function eA(e){var s,n;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(n=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}Ai(eA,"getElementRef");function tA(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Jj}Ai(tA,"isSlottable");var a9=Symbol.for("react.lazy");function ox(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===a9&&"_payload"in e&&rA(e._payload)}Ai(ox,"isLazyComponent");function rA(e){return typeof e=="object"&&e!==null&&"then"in e}Ai(rA,"isPromiseLike");var o9=Ai(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),l9=Ai(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),ef=no[" use ".trim().toString()],c9=Object.defineProperty,u9=(e,t)=>c9(e,"name",{value:t,configurable:!0}),d9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],xy=d9.reduce((e,t)=>{const r=Qj(`Primitive.${t}`),s=g.forwardRef((n,l)=>{const{asChild:u,...d}=n,m=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(m,{...d,ref:l})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function h9(e,t){e&&na.flushSync(()=>e.dispatchEvent(t))}u9(h9,"dispatchDiscreteCustomEvent");var f9=Object.defineProperty,io=(e,t)=>f9(e,"name",{value:t,configurable:!0}),yy="Switch",[m9,IZ]=Fj(yy),[p9,by]=m9(yy);function sA(e){const{__scopeSwitch:t,checked:r,children:s,defaultChecked:n,disabled:l,form:u,name:d,onCheckedChange:m,required:f,value:v="on",internal_do_not_use_render:p}=e,[x,b]=Vj({prop:r,defaultProp:n??!1,onChange:m,caller:yy}),[w,C]=g.useState(null),[k,S]=g.useState(null),E=g.useRef(!1),[N,R]=g.useReducer(B=>B+1,0),A=w?!!u||!!w.closest("form"):!0,D={checked:x,setChecked:b,disabled:l,control:w,setControl:C,name:d,form:u,value:v,hasConsumerStoppedPropagationRef:E,userInteractionCount:N,onUserInteraction:R,required:f,defaultChecked:n,isFormControl:A,bubbleInput:k,setBubbleInput:S};return o.jsx(p9,{scope:t,...D,children:nA(p)?p(D):s})}io(sA,"SwitchProvider");var g9="SwitchTrigger",v9=g.forwardRef(io(function({__scopeSwitch:t,onClick:r,...s},n){const{control:l,form:u,value:d,disabled:m,checked:f,required:v,setControl:p,setChecked:x,hasConsumerStoppedPropagationRef:b,onUserInteraction:w,isFormControl:C,bubbleInput:k}=by(g9,t),S=Zm(n,p),E=g.useRef(f);return g.useEffect(()=>{const N=u?l==null?void 0:l.ownerDocument.getElementById(u):l==null?void 0:l.form;if(N instanceof HTMLFormElement){const R=io(()=>x(E.current),"reset");return N.addEventListener("reset",R),()=>N.removeEventListener("reset",R)}},[l,u,x]),o.jsx(xy.button,{type:"button",role:"switch","aria-checked":f,"aria-required":v,"data-state":wy(f),"data-disabled":m?"":void 0,disabled:m,value:d,...s,ref:S,onClick:gy(r,N=>{w(),x(R=>!R),k&&C&&(b.current=N.isPropagationStopped(),b.current||N.stopPropagation())})})},"SwitchTrigger")),iA=g.forwardRef(io(function(t,r){const{__scopeSwitch:s,name:n,checked:l,defaultChecked:u,required:d,disabled:m,value:f,onCheckedChange:v,form:p,...x}=t;return o.jsx(sA,{__scopeSwitch:s,checked:l,defaultChecked:u,disabled:m,required:d,onCheckedChange:v,name:n,form:p,value:f,internal_do_not_use_render:({isFormControl:b})=>o.jsxs(o.Fragment,{children:[o.jsx(v9,{...x,ref:r,__scopeSwitch:s}),b&&o.jsx(b9,{__scopeSwitch:s})]})})},"Switch")),_9="SwitchThumb",x9=g.forwardRef(io(function(t,r){const{__scopeSwitch:s,...n}=t,l=by(_9,s);return o.jsx(xy.span,{"data-state":wy(l.checked),"data-disabled":l.disabled?"":void 0,...n,ref:r})},"SwitchThumb")),y9="SwitchBubbleInput",b9=g.forwardRef(io(function({__scopeSwitch:t,onClick:r,...s},n){const{control:l,hasConsumerStoppedPropagationRef:u,userInteractionCount:d,checked:m,defaultChecked:f,required:v,disabled:p,name:x,value:b,form:w,bubbleInput:C,setBubbleInput:k}=by(y9,t),S=Zm(n,k),E=Kj(l),N=g.useRef(!1),R=g.useRef(m),A=g.useRef(d);g.useEffect(()=>{const B=C;if(!B)return;const $=window.HTMLInputElement.prototype,Y=Object.getOwnPropertyDescriptor($,"checked").set,V=d!==A.current;A.current=d;const U=R.current!==m;R.current=m;const L=!(V&&u.current);if(U&&Y){N.current=!V;const I=new Event("click",{bubbles:L});Y.call(B,m),B.dispatchEvent(I),N.current=!1}},[C,m,u,d]);const D=g.useRef(m);return o.jsx(xy.input,{type:"checkbox","aria-hidden":!0,defaultChecked:f??D.current,required:v,disabled:p,name:x,value:b,form:w,...s,tabIndex:-1,ref:S,onClick:gy(r,B=>{N.current&&B.stopPropagation()}),style:{...s.style,...E,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"SwitchBubbleInput"));function nA(e){return typeof e=="function"}io(nA,"isFunction");function wy(e){return e?"checked":"unchecked"}io(wy,"getState");const Sy=g.forwardRef(({className:e,size:t="default",...r},s)=>o.jsx(iA,{ref:s,"data-slot":"switch","data-size":t,className:et("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent outline-none transition-all after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 dark:data-[state=unchecked]:bg-input/80",e),...r,children:o.jsx(x9,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-[state=checked]:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-[state=checked]:translate-x-[calc(100%-2px)] group-data-[size=default]/switch:data-[state=unchecked]:translate-x-0 group-data-[size=sm]/switch:data-[state=unchecked]:translate-x-0 dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground"})}));Sy.displayName=iA.displayName;var Qm="Tabs",[w9]=Gi(Qm,[Hm]),aA=Hm(),[S9,Cy]=w9(Qm),oA=g.forwardRef((e,t)=>{const{__scopeTabs:r,value:s,onValueChange:n,defaultValue:l,orientation:u="horizontal",dir:d,activationMode:m="automatic",...f}=e,v=gd(d),[p,x]=eo({prop:s,onChange:n,defaultProp:l??"",caller:Qm});return o.jsx(S9,{scope:r,baseId:Vs(),value:p,onValueChange:x,orientation:u,dir:v,activationMode:m,children:o.jsx(Xe.div,{dir:v,"data-orientation":u,...f,ref:t})})});oA.displayName=Qm;var lA="TabsList",cA=g.forwardRef((e,t)=>{const{__scopeTabs:r,loop:s=!0,...n}=e,l=Cy(lA,r),u=aA(r);return o.jsx(QR,{asChild:!0,...u,orientation:l.orientation,dir:l.dir,loop:s,children:o.jsx(Xe.div,{role:"tablist","aria-orientation":l.orientation,...n,ref:t})})});cA.displayName=lA;var uA="TabsTrigger",dA=g.forwardRef((e,t)=>{const{__scopeTabs:r,value:s,disabled:n=!1,...l}=e,u=Cy(uA,r),d=aA(r),m=mA(u.baseId,s),f=pA(u.baseId,s),v=s===u.value;return o.jsx(JR,{asChild:!0,...d,focusable:!n,active:v,children:o.jsx(Xe.button,{type:"button",role:"tab","aria-selected":v,"aria-controls":f,"data-state":v?"active":"inactive","data-disabled":n?"":void 0,disabled:n,id:m,...l,ref:t,onMouseDown:Be(e.onMouseDown,p=>{!n&&p.button===0&&p.ctrlKey===!1?u.onValueChange(s):p.preventDefault()}),onKeyDown:Be(e.onKeyDown,p=>{n||p.target!==p.currentTarget||[" ","Enter"].includes(p.key)&&u.onValueChange(s)}),onFocus:Be(e.onFocus,()=>{const p=u.activationMode!=="manual";!v&&!n&&p&&u.onValueChange(s)})})})});dA.displayName=uA;var hA="TabsContent",fA=g.forwardRef((e,t)=>{const{__scopeTabs:r,value:s,forceMount:n,children:l,...u}=e,d=Cy(hA,r),m=mA(d.baseId,s),f=pA(d.baseId,s),v=s===d.value,p=g.useRef(v);return g.useEffect(()=>{const x=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(x)},[]),o.jsx(Yi,{present:n||v,children:({present:x})=>o.jsx(Xe.div,{"data-state":v?"active":"inactive","data-orientation":d.orientation,role:"tabpanel","aria-labelledby":m,hidden:!x,id:f,tabIndex:0,...u,ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0},children:x&&l})})});fA.displayName=hA;function mA(e,t){return`${e}-trigger-${t}`}function pA(e,t){return`${e}-content-${t}`}var gA=oA,vA=cA,_A=dA,xA=fA;function C9(e){return o.jsx(gA,{"data-slot":"tabs",...e})}const yA=g.forwardRef(({className:e,...t},r)=>o.jsx(vA,{ref:r,"data-slot":"tabs-list",className:et("inline-flex h-9 items-center gap-1 rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));yA.displayName="TabsList";const Rf=g.forwardRef(({className:e,...t},r)=>o.jsx(_A,{ref:r,"data-slot":"tabs-trigger",className:et("inline-flex h-7 items-center justify-center whitespace-nowrap rounded-md border border-transparent px-3 text-sm font-medium transition-all outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:border-border data-[state=active]:bg-background data-[state=active]:text-foreground",e),...t}));Rf.displayName="TabsTrigger";const Nf=g.forwardRef(({className:e,...t},r)=>o.jsx(xA,{ref:r,"data-slot":"tabs-content",className:et("mt-4 outline-none",e),...t}));Nf.displayName="TabsContent";const vt={sessions:"/sessions",emulator:"/settings/emulator",overview:"/settings/overview",runtimes:"/settings/runtimes",providers:"/settings/providers",projects:"/settings/projects",agents:"/settings/agents",skills:"/settings/skills",plugins:"/settings/plugins",localRuntime:"/settings/local-runtime",computerUse:"/settings/computer-use"},rd="/settings",lx=vt.overview,k9="/runtimes/:runtimeSelector/sessions",E9="/runtimes/:runtimeSelector/sessions/:sessionId",sd="!invalid-runtime-owner",R9=/^[A-Za-z0-9][A-Za-z0-9._~-]{0,255}$/,N9={emulator:"/emulator",overview:"/overview",runtimes:"/runtimes",providers:"/providers",projects:"/projects",agents:"/agents",skills:"/skills",plugins:"/plugins"},j9={"/settings/updates":`${vt.overview}#software-update`,"/settings/daemon":`${vt.localRuntime}#runtime`,"/settings/command":`${vt.localRuntime}#terminal-command`,"/settings/computer":`${vt.computerUse}#permissions`,"/settings/inspection":`${vt.computerUse}#chrome-inspection`},bA=["localRuntime","computerUse"];function A9(e){return bA.includes(e)}function wA(e,t){return!A9(e)||t}function SA(e){const t=e.length>1?e.replace(/\/+$/,""):e;if(cx(t)||t===vt.sessions||t.startsWith(`${vt.sessions}/`))return"sessions";const r=Object.entries(vt).find(([,s])=>s===t);return(r==null?void 0:r[0])??"sessions"}function M9(e,t=!0){const r=SA(e);return r==="sessions"||!wA(r,t)?null:r}function cx(e){const t=/^\/runtimes\/([^/]+)\/sessions(?:\/[^/]+)?\/?$/.exec(e);if(!t)return null;try{return kA(decodeURIComponent(t[1]))}catch{return sd}}function CA(e){const t=new URLSearchParams(e).getAll("runtime");return t.length===0?null:t.length!==1?sd:kA(t[0])}function kA(e){return R9.test(e)?e:sd}function Io(e,t){return`/runtimes/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}`}function Ka(e){return`/runtimes/${encodeURIComponent(e)}/sessions`}function EA(e,t){const r=e==null?void 0:e.returnTo;return typeof r=="string"&&r.startsWith("/")&&!r.startsWith("//")&&r!==rd&&!r.startsWith(`${rd}/`)?r:t}const RA="/api/plugins/install-preparations",tf="/api/plugin-marketplaces",T9=/^[A-Za-z0-9_-]{32,128}$/;function NA(e){if(!T9.test(e))throw new Error("invalid plugin preparation token");return`${RA}/${encodeURIComponent(e)}`}function D9(e){return`${NA(e)}/commit`}function al(){return typeof window>"u"?void 0:window.rynxSessionPortal}function vi(e){var s;const t=(s=al())==null?void 0:s.portalId;if(!t)return e;const r=new URL(e,"http://session-portal.local");return r.searchParams.set("portal",t),`${r.pathname}${r.search}${r.hash}`}function Ed(e){var s;const t=new Headers(e),r=(s=al())==null?void 0:s.portalId;return r&&t.set("x-rynx-session-portal",r),t}function ky(e){var r;const t=(r=al())==null?void 0:r.portalId;t&&e.set("portal",t)}class Qa extends Error{constructor(r,s,n,l){super(r);hs(this,"status");hs(this,"code");hs(this,"outcome");this.name="ApiRequestError",this.status=s,this.code=n,this.outcome=l}}function Jm(e){return e instanceof Qa&&(e.outcome==="not_started"||[400,403,404,409,413].includes(e.status))}const L9="/api/runtimes/capability",O9="x-rynx-runtime-capability";let tc;async function B9(e,t,r){const s=location.protocol==="https:"?"wss":"ws",n=await id(r.refreshCapability),l=new URLSearchParams({capability:n,role:r.role??"owner",cols:String(r.cols),rows:String(r.rows)});return ky(l),`${s}://${location.host}/api/runtimes/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}/terminal?${l.toString()}`}function P9(e){const t=location.protocol==="https:"?"wss":"ws",r=new URLSearchParams;e&&r.set("device",e);const s=r.toString();return`${t}://${location.host}/api/emulator/touch${s?`?${s}`:""}`}async function I9(e,t,r,s){const n=s?`${wr(s,e)}/interactions/${encodeURIComponent(t)}/resolve`:`/api/sessions/${encodeURIComponent(e)}/interactions/${encodeURIComponent(t)}/resolve`,l={method:"POST",body:JSON.stringify({resolution:r})};return(s?await it(n,l):await Je(n,l)).disposition}async function Je(e,t={}){return jA(e,{},t)}async function jA(e,t,r={}){const s=Ed(r.headers);r.body&&!s.has("content-type")&&s.set("content-type","application/json");const n=await fetch(e,{...r,headers:s});if(!n.ok){let u=`${n.status}`,d,m;try{const f=await n.json();typeof f.error=="string"&&(d=f.error,u=f.error),typeof f.code=="string"&&(d=f.code),(f.outcome==="not_started"||f.outcome==="unknown")&&(m=f.outcome)}catch{}throw new Qa(u,n.status,d,m)}const l=await n.text();return l?JSON.parse(l):t}async function id(e=!1){return e&&(tc=void 0),tc||(tc=Je(L9,{cache:"no-store"}).then(({capability:t})=>{if(typeof t!="string"||!/^[A-Za-z0-9_-]{43}$/.test(t))throw new Error("invalid Runtime Web capability");return t}).catch(t=>{throw tc=void 0,t})),tc}async function it(e,t){const r=async n=>{const l=Ed(t.headers);return l.set(O9,n),Je(e,{...t,headers:l})},s=await id();try{return await r(s)}catch(n){if(!(n instanceof Error)||n.message!=="invalid_runtime_capability")throw n;return tc=void 0,r(await id())}}async function zv(e,t={}){const r=Ed(t.headers),s=await fetch(e,{...t,headers:r});if(!s.ok){let n=`${s.status}`;try{const l=await s.json();l.error&&(n=l.error)}catch{}throw new Error(n)}return s.blob()}async function z9(e,t,r,s){const n=Ed({"content-type":"application/json"}),l=await fetch(e,{method:"POST",headers:n,body:t===void 0?void 0:JSON.stringify(t),signal:s});await AA(l,r)}async function $9(e,t,r){const s=await fetch(e,{signal:r,headers:Ed()});await AA(s,t)}async function AA(e,t){if(!e.ok||!e.body){let l=`${e.status}`,u,d;try{const m=await e.json();m.error&&(u=m.error,l=m.error),m.code&&(u=m.code),(m.outcome==="not_started"||m.outcome==="unknown")&&(d=m.outcome)}catch{}throw new Qa(l,e.status,u,d)}const r=e.body.getReader(),s=new TextDecoder;let n="";for(;;){const{done:l,value:u}=await r.read();if(l)break;n+=s.decode(u,{stream:!0});let d;for(;(d=n.indexOf(`
|
|
576
|
-
|
|
577
|
-
`))!==-1;){const m=n.slice(0,d);n=n.slice(d+2);const f=U9(m);f&&t(f)}}}function U9(e){let t="message",r="";for(const n of e.split(`
|
|
578
|
-
`))n.startsWith("event:")?t=n.slice(6).trim():n.startsWith("data:")&&(r+=n.slice(5).trim());if(!t&&!r)return null;let s={};try{r&&(s=JSON.parse(r))}catch{}return{event:t,data:s}}function ux(e,t){return e?`/api/runtimes/${encodeURIComponent(e)}/emulator/${t}`:`/api/emulator/${t}`}function yu(e,t,r){const s=ux(e,t);return e?it(s,r):Je(s,r)}function wr(e,t,r){const s=`/api/runtimes/${encodeURIComponent(e)}/sessions`;if(t===void 0)return s;const n=`${s}/${encodeURIComponent(t)}`;return r?`${n}/${r}`:n}function rf(e,t){const r=`/api/runtimes/${encodeURIComponent(e)}/projects`;return t===void 0?r:`${r}/${encodeURIComponent(t)}`}function rc(e,t,...r){const s=`${wr(e,t)}/browser`;return r.length===0?s:`${s}/${r.map(n=>encodeURIComponent(n)).join("/")}`}function Lo(e,t,r){const s=`${wr(e,t)}/emulator`;return r?`${s}/${r}`:s}function H9(e,t,r){const s=new URLSearchParams({bindingId:r});return vi(`${wr(e,t)}/emulator/frame?${s.toString()}`)}function bu(e,t,r,s,n){return it(rc(e,t,"pages",s,n),{method:"POST",body:JSON.stringify({browserGeneration:r})})}function sf(e,t,r){return e?wr(e,t,r):`/api/sessions/${encodeURIComponent(t)}/${r}`}const xe={meta:()=>Je("/api/meta"),listRuntimeShareAddresses:()=>Je("/api/runtime-server/share-addresses",{cache:"no-store"}).then(e=>e.addresses),shareRuntime:e=>it("/api/runtime-server/share",{method:"POST",body:JSON.stringify(e)}),listRuntimeAccess:()=>Je("/api/runtime-server/access").then(e=>e.clients),revokeRuntimeAccess:e=>it(`/api/runtime-server/access/${encodeURIComponent(e)}`,{method:"DELETE"}),deleteRevokedRuntimeAccess:e=>it(`/api/runtime-server/access/${encodeURIComponent(e)}/record`,{method:"DELETE"}),listRuntimes:()=>Je("/api/runtimes").then(e=>e.runtimes),listProviderClis:e=>Je(`/api/runtimes/${encodeURIComponent(e)}/provider-clis`,{cache:"no-store"}),startProviderCliOperation:(e,t,r)=>it(`/api/runtimes/${encodeURIComponent(e)}/provider-clis/${encodeURIComponent(t)}/${r}`,{method:"POST",body:JSON.stringify({})}),getProviderCliJob:(e,t)=>Je(`/api/runtimes/${encodeURIComponent(e)}/provider-clis/jobs/${encodeURIComponent(t)}`,{cache:"no-store"}).then(r=>r.job),pairRuntime:e=>it("/api/runtimes/pair",{method:"POST",body:JSON.stringify(e)}),testRuntime:e=>it(`/api/runtimes/${encodeURIComponent(e)}/test`,{method:"POST",body:JSON.stringify({})}),forgetRuntime:e=>it(`/api/runtimes/${encodeURIComponent(e)}`,{method:"DELETE"}),getRuntimeBrowserState:(e,t)=>jA(rc(e,t),null),openRuntimeBrowser:(e,t,r)=>it(rc(e,t,"open"),{method:"POST",body:JSON.stringify(r===void 0?{}:{url:r})}),closeRuntimeBrowser:(e,t,r)=>it(rc(e,t,"close"),{method:"POST",body:JSON.stringify({browserGeneration:r})}),createRuntimeBrowserPage:(e,t,r,s)=>it(rc(e,t,"pages"),{method:"POST",body:JSON.stringify({browserGeneration:r,...s===void 0?{}:{url:s}})}),closeRuntimeBrowserPage:(e,t,r,s)=>bu(e,t,r,s,"close"),activateRuntimeBrowserPage:(e,t,r,s)=>bu(e,t,r,s,"activate"),navigateRuntimeBrowserPage:(e,t,r,s,n)=>it(rc(e,t,"pages",s,"navigate"),{method:"POST",body:JSON.stringify({browserGeneration:r,url:n})}),backRuntimeBrowserPage:(e,t,r,s)=>bu(e,t,r,s,"back"),forwardRuntimeBrowserPage:(e,t,r,s)=>bu(e,t,r,s,"forward"),reloadRuntimeBrowserPage:(e,t,r,s)=>bu(e,t,r,s,"reload"),getSessionEmulator:(e,t)=>Je(Lo(e,t)).then(r=>r.binding),listSessionEmulatorDevices:(e,t)=>Je(Lo(e,t,"devices")).then(r=>r.devices),attachSessionEmulator:(e,t,r)=>it(Lo(e,t,"attach"),{method:"POST",body:JSON.stringify({device:r})}),detachSessionEmulator:(e,t,r)=>it(Lo(e,t,"detach"),{method:"POST",body:JSON.stringify({bindingId:r})}),tapSessionEmulator:(e,t,r,s,n)=>it(Lo(e,t,"tap"),{method:"POST",body:JSON.stringify({bindingId:r,x:s,y:n})}),gestureSessionEmulator:(e,t,r,s)=>it(Lo(e,t,"gesture"),{method:"POST",body:JSON.stringify({bindingId:r,points:s})}),buttonSessionEmulator:(e,t,r,s)=>it(Lo(e,t,"button"),{method:"POST",body:JSON.stringify({bindingId:r,name:s})}),sessionEmulatorFrameBlob:(e,t,r,s)=>zv(H9(e,t,r),{signal:s,cache:"no-store"}),listPlugins:()=>Je("/api/plugins").then(e=>e.plugins),listPluginMarketplaces:()=>Je(tf,{cache:"no-store"}).then(e=>e.marketplaces),addPluginMarketplace:e=>it(tf,{method:"POST",headers:{"x-rynx-console":"1"},body:JSON.stringify(e)}),refreshPluginMarketplace:e=>it(`${tf}/${encodeURIComponent(e)}/refresh`,{method:"POST",headers:{"x-rynx-console":"1"},body:"{}"}),removePluginMarketplace:e=>it(`${tf}/${encodeURIComponent(e)}`,{method:"DELETE",headers:{"x-rynx-console":"1"}}),preparePluginInstallation:(e,t)=>it(RA,{method:"POST",headers:{"x-rynx-console":"1"},body:JSON.stringify(e),signal:t}),commitPluginInstallation:(e,t,r)=>it(D9(e),{method:"POST",headers:{"x-rynx-console":"1"},body:JSON.stringify(t),signal:r}),cancelPluginInstallation:e=>it(NA(e),{method:"DELETE",headers:{"x-rynx-console":"1"}}),setPluginEnabled:(e,t)=>it(`/api/plugins/${encodeURIComponent(e)}/${t?"enable":"disable"}`,{method:"POST",headers:{"x-rynx-console":"1"},body:"{}"}).then(r=>r.plugin),pluginSettingsUi:(e,t)=>Je(`/api/plugins/${encodeURIComponent(e)}/settings-ui`,{cache:"no-store",signal:t}),pluginSettingsCall:(e,t,r,s,n)=>it(`/api/plugins/${encodeURIComponent(e)}/settings`,{method:"POST",headers:{"x-rynx-console":"1"},body:JSON.stringify({generation:t,method:r,params:s}),signal:n}).then(l=>l.result),emulatorDevices:e=>Je(ux(e,"devices")).then(t=>t.devices),activeEmulator:e=>Je(ux(e,"active")).then(t=>t.active),attachEmulator:(e,t)=>yu(t,"attach",{method:"POST",body:JSON.stringify({device:e})}),tapEmulator:(e,t,r,s)=>yu(s,"tap",{method:"POST",body:JSON.stringify({x:e,y:t,device:r})}),gestureEmulator:(e,t,r)=>yu(r,"gesture",{method:"POST",body:JSON.stringify({points:e,device:t})}),buttonEmulator:(e,t,r)=>yu(r,"button",{method:"POST",body:JSON.stringify({name:e,device:t})}),shutdownEmulator:(e,t)=>yu(t,"shutdown",{method:"POST",body:JSON.stringify({device:e})}),emulatorVideoStreamUrl:e=>`/api/emulator/video${e?`?device=${encodeURIComponent(e)}`:""}`,emulatorFrameBlob:e=>zv(`/api/emulator/frame${e?`?device=${encodeURIComponent(e)}`:""}`),screenshotEmulator:(e,t)=>Je("/api/emulator/screenshot",{method:"POST",body:JSON.stringify({device:e,out:t})}),emulatorScreenshotBlob:e=>zv(`/api/emulator/screenshot-file?file=${encodeURIComponent(e)}`),listAgents:()=>Je("/api/agents").then(e=>e.agents),getAgent:e=>Je(`/api/agents/${encodeURIComponent(e)}`),listAgentRuntimeOptions:(e=!1)=>Je(`/api/agents/runtime-options${e?"?refresh=1":""}`,{cache:"no-store"}).then(t=>t.runtimes),createAgent:e=>Je("/api/agents",{method:"POST",body:JSON.stringify(e)}),updateAgent:(e,t)=>Je(`/api/agents/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)}),deleteAgent:e=>Je(`/api/agents/${encodeURIComponent(e)}`,{method:"DELETE"}),listProjects:e=>Je(rf(e),{cache:"no-store"}).then(t=>t.projects),createProject:(e,t)=>it(rf(e),{method:"POST",body:JSON.stringify(t)}).then(r=>r.project),updateProject:(e,t,r)=>it(rf(e,t),{method:"PUT",body:JSON.stringify(r)}).then(s=>s.project),deleteProject:(e,t)=>it(rf(e,t),{method:"DELETE"}),listSkills:()=>Je("/api/skills").then(e=>e.skills),getSkill:e=>Je(`/api/skills/${encodeURIComponent(e)}`),readSkillFile:(e,t)=>Je(`/api/skills/${encodeURIComponent(e)}/file?path=${encodeURIComponent(t)}`),installSkill:e=>Je("/api/skills",{method:"POST",body:JSON.stringify(e)}).then(t=>t.skills),scanLocalSkills:e=>Je("/api/skills/local-scan",{method:"POST",body:JSON.stringify({runtime:e})}).then(t=>t.candidates),importLocalSkills:(e,t)=>Je("/api/skills/local-import",{method:"POST",body:JSON.stringify({runtime:e,keys:t})}).then(r=>r.results),importSkillArchive:(e,t)=>Je("/api/skills/import-archive",{method:"POST",body:JSON.stringify({filename:e,contentBase64:t})}).then(r=>r.results),deleteSkill:e=>Je(`/api/skills/${encodeURIComponent(e)}`,{method:"DELETE"}),listSessions:e=>Je(e?wr(e):"/api/sessions").then(t=>t.sessions),listSessionAgentOptions:e=>Je(`${wr(e)}/agent-options`).then(t=>t.agents),listSessionLaunchOptions:e=>Je(`${wr(e)}/launch-options`),getSessionExecutionSettings:(e,t)=>Je(wr(e,t,"execution"),{cache:"no-store"}),updateSessionExecutionSettings:(e,t,r)=>it(wr(e,t,"execution"),{method:"PUT",body:JSON.stringify(r)}),createSession:(e,t)=>{const r=t?wr(t):"/api/sessions",s={method:"POST",body:JSON.stringify(e)};return t?it(r,s):Je(r,s)},forkSession:(e,t,r)=>it(wr(e,t,"fork"),{method:"POST",body:JSON.stringify(r)}),sendSessionMessage:(e,t,r,s,n)=>n?it(wr(n,e,"messages"),{method:"POST",body:JSON.stringify(typeof t=="string"?{message:t}:t),signal:s}).then(()=>{}):z9(`/api/sessions/${encodeURIComponent(e)}/messages`,typeof t=="string"?{message:t}:t,r,s),getSessionResourcePolicy:(e,t)=>Je(`${wr(e,t,"resources")}/policy`,{cache:"no-store"}),uploadSessionResource:(e,t,r,s,n)=>it(wr(e,t,"resources"),{method:"POST",body:r,signal:n,headers:{"content-type":r.type,"x-rynx-upload-id":s,"x-rynx-filename":encodeURIComponent(r.name)}}).then(l=>l.resource),deleteSessionResource:(e,t,r)=>it(`${wr(e,t,"resources")}/${encodeURIComponent(r)}`,{method:"DELETE"}),sessionResourceContentUrl:(e,t,r)=>vi(`${wr(e,t,"resources")}/${encodeURIComponent(r.resourceId)}/content`),enqueueSessionMessage:(e,t,r)=>it(wr(e,t,"messages/queue"),{method:"POST",body:JSON.stringify({message:r})}),startSessionTerminal:(e,t)=>it(wr(e,t,"terminal/start"),{method:"POST",body:"{}"}),streamSession:(e,t,r,s)=>$9(sf(s,e,"stream"),t,r),getSessionHistory:e=>Je(`/api/sessions/${encodeURIComponent(e)}/history`).then(t=>t.items),getSessionSnapshot:(e,t,r)=>Je(sf(r,e,"snapshot"),{signal:t}),getSessionSnapshotPage:(e,t,r,s)=>{const n=new URLSearchParams;t!==void 0&&n.set("afterId",t);const l=n.size>0?`?${n.toString()}`:"";return Je(`${sf(s,e,"snapshot-page")}${l}`,{signal:r})},closeSession:(e,t)=>{const r=t?wr(t,e):`/api/sessions/${encodeURIComponent(e)}`,s={method:"DELETE"};return t?it(r,s):Je(r,s)},interruptSession:(e,t)=>{const r=sf(t,e,"interrupt"),s={method:"POST"};return t?it(r,s):Je(r,s)}},MA="rynx.control.runtime-target.v1",dx={selector:"local",daemonId:"local",displayName:"This device",binding:"local"};function F9(e){var t;if(!e)return"local";try{return((t=e.getItem(MA))==null?void 0:t.trim())||"local"}catch{return"local"}}function qC(e,t){if(e)try{e.setItem(MA,t)}catch{}}function W9(e){const t=new Map;for(const r of e)!r.selector||t.has(r.selector)||t.set(r.selector,r);return t.has("local")||t.set("local",dx),[...t.values()].sort((r,s)=>r.selector==="local"?-1:s.selector==="local"?1:r.displayName.localeCompare(s.displayName))}const TA=g.createContext(null);function q9({children:e}){const t=al(),r=Xr(),s=ao(),n=cx(r.pathname)??(r.pathname===vt.sessions?CA(r.search):null),[l,u]=g.useState(()=>F9(typeof window>"u"?void 0:window.localStorage)),d=n??l,[m,f]=g.useState([dx]),v=g.useCallback(w=>{f(W9(w))},[]),p=g.useCallback(async()=>{if(t){v([dx]);return}try{v(await xe.listRuntimes())}catch(w){pe.error(`Failed to load Runtimes: ${w.message}`)}},[t,v]);g.useEffect(()=>{p()},[p]),g.useEffect(()=>{!n||n===sd||(u(n),qC(typeof window>"u"?void 0:window.localStorage,n))},[n]);const x=g.useCallback(w=>{const C=w.trim();if(!C)return;u(C),qC(typeof window>"u"?void 0:window.localStorage,C),(r.pathname===vt.sessions||r.pathname.startsWith(`${vt.sessions}/`)||cx(r.pathname)!==null)&&n!==C&&s(vi(Ka(C)))},[r.pathname,s,n]),b=g.useMemo(()=>{const w=m.find(k=>k.selector===d)??(d===sd?{selector:d,daemonId:d,displayName:"Invalid Runtime URL",binding:"direct"}:{selector:d,daemonId:d,displayName:`${d} (unavailable)`,binding:d==="local"?"local":"direct"}),C=d!=="local";return{runtimes:m,runtimeSelector:d,runtimeRoute:C?d:void 0,selectedRuntime:w,isRemoteRuntime:C,selectRuntime:x,refreshRuntimes:p,updateRuntimes:v}},[p,d,m,x,v]);return o.jsx(TA.Provider,{value:b,children:e})}function Sc(){const e=g.useContext(TA);if(!e)throw new Error("useRuntimeTarget must be used inside RuntimeTargetProvider");return e}const VC="!add-runtime";function V9(){const e=Xr(),t=ao(),{runtimes:r,runtimeSelector:s,selectedRuntime:n,selectRuntime:l}=Sc(),u=r.some(m=>m.selector===s)?r:[...r,n],d=m=>{if(m===VC){t(vt.runtimes,{state:{returnTo:`${e.pathname}${e.search}${e.hash}`}});return}l(m)};return o.jsx("div",{className:"ml-auto w-44 max-w-full sm:w-60",children:o.jsxs(gn,{value:s,onValueChange:d,children:[o.jsxs(Ui,{className:"h-10 w-full min-w-0 gap-1.5 border-0 bg-transparent px-2 font-mono text-[10px] shadow-none hover:bg-[var(--accent)] focus-visible:ring-2 sm:h-7","aria-label":"Active Runtime",children:[o.jsx("span",{className:"hidden shrink-0 uppercase tracking-[0.12em] text-[var(--muted-foreground)] sm:inline",children:"Runtime ·"}),o.jsx($i,{placeholder:"Select Runtime"})]}),o.jsxs(Hi,{align:"end",children:[u.map(m=>{const f=m.binding==="local"?cE:km;return o.jsx(cr,{value:m.selector,children:o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[o.jsx(f,{className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),o.jsx("span",{className:"truncate",children:m.displayName})]})},m.selector)}),o.jsx(Xm,{}),o.jsx(cr,{value:VC,children:o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[o.jsx(ls,{className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),o.jsx("span",{children:"Add Runtime…"})]})})]})]})})}function ol(){return typeof window>"u"?null:window.rynxDesktopIntegration??null}function DA(e){return e.globalCli.state==="foreign"||e.globalCli.state==="unwritable"}function jf(e,t){return!e.runtime.ready||!e.builtinSkill.ready?!1:e.globalCli.state==="installed"&&!e.globalCli.canInstall||e.globalCli.state==="development"||DA(e)&&t}const LA=g.createContext({status:null,operation:null,error:null,checkForUpdates:async()=>null,installUpdate:async()=>null});function G9({children:e}){const t=ol(),[r,s]=g.useState(null),[n,l]=g.useState(null),[u,d]=g.useState(null);g.useEffect(()=>{if(!t)return;let p=!0;const x=t.onAppUpdateStatus(b=>{p&&(s(b),b.error||d(null))});return t.getAppUpdateStatus().then(b=>{p&&s(b)}).catch(b=>{p&&d($v(b))}),()=>{p=!1,x()}},[t]);const m=g.useCallback(async()=>{if(!t)return null;l("check"),d(null);try{const p=await t.checkForAppUpdates();return s(p),p}catch(p){return d($v(p)),null}finally{l(null)}},[t]),f=g.useCallback(async()=>{if(!t)return null;l("install"),d(null);try{const p=await t.installAppUpdate();return s(p),p}catch(p){return d($v(p)),null}finally{l(null)}},[t]),v=g.useMemo(()=>({status:r,operation:n,error:u,checkForUpdates:m,installUpdate:f}),[m,u,f,n,r]);return o.jsx(LA.Provider,{value:v,children:e})}function Ey(){return g.useContext(LA)}function $v(e){return e instanceof Error?e.message:String(e)}function Y9(){const{status:e,operation:t,error:r,installUpdate:s}=Ey();if(!(e!=null&&e.availableVersion)||e.phase!=="downloading"&&e.phase!=="ready"&&e.phase!=="installing")return null;const n=t==="install"||e.phase==="installing",l=e.phase==="ready"&&!n,u=r??e.error;return o.jsxs("div",{className:"group/update relative flex shrink-0 items-center",children:[o.jsxs(ne,{variant:"ghost",size:"icon-xs",className:"relative text-[var(--primary)] hover:text-[var(--primary)]","aria-label":`Rynx ${e.availableVersion} update available`,"aria-haspopup":"dialog",children:[e.phase==="downloading"||n?o.jsx(ze,{className:"animate-spin"}):o.jsx(qu,{}),o.jsx("span",{className:"absolute right-0.5 top-0.5 size-1.5 rounded-full bg-[var(--primary)] ring-2 ring-[var(--background)]","aria-hidden":"true"})]}),o.jsx("div",{role:"dialog","aria-label":"Rynx update",className:"invisible absolute bottom-full right-0 z-50 w-72 translate-y-1 pb-2 opacity-0 transition-[opacity,transform,visibility] duration-150 group-hover/update:visible group-hover/update:translate-y-0 group-hover/update:opacity-100 group-focus-within/update:visible group-focus-within/update:translate-y-0 group-focus-within/update:opacity-100",children:o.jsxs("div",{className:"rounded-xl border border-[var(--border)] bg-[var(--popover)] p-3 font-sans text-[var(--popover-foreground)] shadow-xl",children:[o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx("span",{className:"grid size-9 shrink-0 place-items-center rounded-lg bg-[var(--primary)]/12 text-[var(--primary)]",children:l?o.jsx(qu,{className:"size-4"}):e.phase==="downloading"?o.jsx(pd,{className:"size-4"}):o.jsx(ze,{className:"size-4 animate-spin"})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("div",{className:"text-xs font-semibold text-[var(--foreground)]",children:l?"Update ready":n?"Preparing update":"Downloading update"}),o.jsx("p",{className:"mt-0.5 text-[11px] leading-4 text-[var(--muted-foreground)]",children:l?`${e.appName} ${e.availableVersion} is ready to install.`:n?"Rynx will restart when the local Runtime is safe to stop.":`${e.appName} ${e.availableVersion} is downloading in the background.`})]})]}),l&&o.jsxs(ne,{size:"sm",className:"mt-3 w-full",onClick:()=>void s(),children:[o.jsx(qu,{}),"Restart to update"]}),u&&o.jsx("p",{className:"mt-2 text-[10px] leading-4 text-[var(--destructive)]",children:u})]})})]})}function We(...e){return vR(D0(e))}function K9({children:e,theme:t,onToggleTheme:r}){const s=Xr(),n=al(),{runtimeSelector:l}=Sc(),u=SA(s.pathname),d=s.pathname===rd||s.pathname.startsWith(`${rd}/`),m=EA(s.state,Ka(l)),f=d?m:lx,v=d?void 0:{returnTo:`${s.pathname}${s.search}${s.hash}`};return o.jsxs("div",{className:"grid h-dvh min-h-0 grid-rows-[minmax(0,1fr)_2.5rem] overflow-hidden bg-[var(--background)] sm:grid-rows-[minmax(0,1fr)_2rem]",children:[o.jsx("main",{className:"min-h-0 overflow-hidden focus:outline-none",children:e}),o.jsxs("footer",{className:"app-no-drag flex min-w-0 items-center gap-3 border-t border-[var(--border)] bg-[var(--muted)]/24 px-2 font-mono text-[10px] text-[var(--muted-foreground)] sm:px-3",children:[o.jsx("span",{className:"hidden truncate uppercase tracking-[0.12em] min-[480px]:block",children:d?u==="emulator"?"Emulator · local device":"Settings · local configuration":"Session workbench"}),o.jsxs("div",{className:"ml-auto flex min-w-0 items-center gap-1.5",children:[n?o.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 px-1",children:[o.jsx("span",{className:"text-[var(--foreground)]",children:"Rynx Sessions"}),n.access==="read_only"&&o.jsx("span",{"aria-hidden":"true",children:"· read only"})]}):d?o.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 px-1",children:[o.jsx("span",{className:"text-[var(--foreground)]",children:"Control Plane"}),o.jsx("span",{"aria-hidden":"true",children:"·"}),o.jsx("span",{children:"This device"})]}):o.jsx(V9,{}),o.jsx("span",{className:"h-3.5 w-px bg-[var(--border)]","aria-hidden":"true"}),o.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[!n&&o.jsx(Y9,{}),o.jsx(ne,{variant:"ghost",size:"icon-xs",className:"shrink-0",onClick:r,"aria-label":t==="dark"?"Use light mode":"Use dark mode",title:t==="dark"?"Light mode":"Dark mode",children:t==="dark"?o.jsx(G6,{}):o.jsx(KO,{})}),!n&&o.jsx(ne,{asChild:!0,variant:"ghost",size:"icon-xs",className:We("shrink-0",d&&"text-[var(--primary)]"),children:o.jsx(Ya,{to:f,state:v,"aria-label":d?"Back to app":"Settings",title:d?"Back to app":"Settings",children:o.jsx(N6,{})})})]})]})]})]})}const am="/assets/rynx-wordmark-LL1QRYHD.png";function X9({bridge:e,children:t}){const[r,s]=g.useState(null),[n,l]=g.useState(null),[u,d]=g.useState("refresh"),[m,f]=g.useState(!1),v=g.useCallback(async(k=!1)=>{d("refresh"),l(null);try{const S=await e.getStatus(k);jf(S,!1)?s(await e.completeOnboarding()):s(S)}catch(S){l(S.message)}finally{d(null)}},[e]);g.useEffect(()=>{e.initialOnboardingCompleted||v()},[e.initialOnboardingCompleted,v]);const p=r?jf(r,m):!1;async function x(){const k=r==null?void 0:r.globalCli.path;if(k){d("install"),l(null);try{const S=await e.installCli(k);f(!1),jf(S,!1)?s(await e.completeOnboarding()):s(S)}catch(S){l(S.message);try{s(await e.getStatus(!0))}catch{}}finally{d(null)}}}async function b(){d("runtime"),l(null);try{s(await e.restartDaemon())}catch(k){l(k.message)}finally{d(null)}}async function w(){if(!(!r||!p)){d("complete"),l(null);try{s(await e.completeOnboarding())}catch(k){l(k.message)}finally{d(null)}}}if(e.initialOnboardingCompleted||r!=null&&r.onboardingCompleted)return t;const C=!!(r!=null&&r.runtime.ready&&(r!=null&&r.builtinSkill.ready));return o.jsxs("div",{className:"grid h-dvh min-h-0 overflow-hidden bg-[var(--background)] md:grid-cols-[15rem_minmax(0,1fr)]",children:[o.jsxs("aside",{className:"app-drag-region desktop-macos-titlebar-inset shrink-0 border-b border-[var(--border)] bg-[var(--muted)]/18 p-4 md:border-r md:border-b-0 md:p-5",children:[o.jsx("img",{src:am,alt:"rynx",className:"h-5 w-auto dark:brightness-0 dark:invert"}),o.jsxs("div",{className:"app-no-drag mt-6",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsx("p",{className:"label-caps text-[10px] text-[var(--primary)]",children:"Setup"}),o.jsx("span",{className:"font-mono text-[10px] text-[var(--muted-foreground)]",children:"1/1"})]}),o.jsx("ol",{className:"mt-3","aria-label":"Setup steps",children:o.jsxs("li",{"aria-current":"step",className:"flex items-center gap-2 rounded-lg bg-[var(--muted)] px-3 py-2.5 text-sm font-medium text-[var(--foreground)] ring-1 ring-inset ring-[var(--border)]",children:[o.jsx("span",{className:"grid size-5 shrink-0 place-items-center rounded-full bg-[var(--primary)] text-[10px] font-semibold text-[var(--primary-foreground)]",children:"1"}),o.jsx("span",{className:"truncate",children:"Terminal command"})]})})]})]}),o.jsxs("main",{className:"app-no-drag relative min-h-0 overflow-auto",children:[o.jsx("div",{className:"desktop-macos-home-titlebar","aria-hidden":"true"}),o.jsx("div",{className:"grid min-h-full place-items-center px-5 py-12 sm:px-8 md:px-12",children:o.jsxs("section",{className:"w-full max-w-xl","aria-labelledby":"onboarding-command-title",children:[o.jsx(Z9,{titleId:"onboarding-command-title",title:"Set up the Terminal command",description:"Install one small command so Rynx is available from any Terminal."}),o.jsx("div",{className:"mt-7 rounded-lg border border-[var(--border)] bg-[var(--card)] p-5 shadow-sm","aria-busy":u!==null,children:r?C?o.jsx(Q9,{status:r,pending:u,acknowledged:m,onAcknowledgedChange:f,onInstall:()=>void x(),onRefresh:()=>void v(!0),onContinue:()=>void w()}):o.jsx(J9,{status:r,pending:u,onRetry:()=>void b()}):o.jsxs("div",{className:"flex min-h-40 items-center justify-center gap-2 text-sm text-[var(--muted-foreground)]",children:[u==="refresh"&&o.jsx(ze,{className:"size-4 animate-spin"}),u==="refresh"?"Getting Rynx ready…":"Setup status is unavailable."]})}),n&&o.jsxs("div",{role:"alert",className:"mt-5 flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_35%,var(--border))] bg-[color-mix(in_srgb,var(--destructive)_7%,var(--background))] p-3 text-xs text-[var(--destructive)]",children:[o.jsx(_c,{className:"mt-0.5 size-4 shrink-0"}),o.jsx("span",{children:n})]})]})})]})]})}function Z9({titleId:e,title:t,description:r}){return o.jsxs("div",{children:[o.jsx("h1",{id:e,className:"text-2xl font-semibold tracking-tight",children:t}),o.jsx("p",{className:"mt-2 max-w-lg text-sm leading-6 text-[var(--muted-foreground)]",children:r})]})}function Q9({status:e,pending:t,acknowledged:r,onAcknowledgedChange:s,onInstall:n,onRefresh:l,onContinue:u}){const d=e.globalCli.state==="installed",m=e.globalCli.state==="development",f=d&&!e.globalCli.canInstall,v=DA(e),p=jf(e,r);return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx("span",{className:f?"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--success)]/12 text-[var(--success)]":"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:f?o.jsx(Br,{className:"size-4"}):o.jsx(S0,{className:"size-4"})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h2",{className:"text-sm font-medium",children:"Terminal command"}),o.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:eU(e)})]})]}),v&&o.jsxs("label",{className:"mt-5 flex cursor-pointer items-start gap-3 rounded-lg border border-[color-mix(in_srgb,var(--warning)_35%,var(--border))] bg-[color-mix(in_srgb,var(--warning)_7%,var(--background))] p-3 text-xs",children:[o.jsx("input",{type:"checkbox",checked:r,onChange:x=>s(x.target.checked),className:"mt-0.5 size-4 shrink-0 accent-[var(--primary)]"}),o.jsxs("span",{children:["Continue without Terminal access. I'll resolve the"," ",o.jsx("code",{className:"font-mono",children:"rynx"})," command later."]})]}),o.jsxs("div",{className:"mt-6 flex flex-wrap gap-2",children:[e.globalCli.canInstall&&o.jsxs(ne,{disabled:t!==null,onClick:n,children:[t==="install"&&o.jsx(ze,{className:"animate-spin"}),"Install command"]}),(f||m||v)&&o.jsxs(ne,{disabled:t!==null||!p,onClick:u,children:["Continue",o.jsx(sE,{})]}),o.jsxs(ne,{variant:"outline",disabled:t!==null,onClick:l,children:[o.jsx(_t,{className:t==="refresh"?"animate-spin":""}),"Check again"]})]})]})}function J9({status:e,pending:t,onRetry:r}){return o.jsxs("div",{role:"alert",className:"flex items-start gap-3",children:[o.jsx("span",{className:"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--warning)]/12 text-[var(--warning)]",children:o.jsx(_c,{className:"size-4"})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("h2",{className:"text-sm font-medium",children:e.builtinSkill.ready?"Rynx couldn’t finish starting":"Rynx needs to be reinstalled"}),o.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:e.builtinSkill.ready?"Try again to continue.":"A required app component is unavailable. Reinstall Rynx, then open it again."}),e.builtinSkill.ready&&o.jsxs(ne,{className:"mt-4",variant:"outline",disabled:t!==null,onClick:r,children:[t==="runtime"&&o.jsx(ze,{className:"animate-spin"}),"Try again"]})]})]})}function eU(e){switch(e.globalCli.state){case"installed":return e.globalCli.canInstall?"Install the rynx command to use Rynx from Terminal.":"Rynx is ready to use from Terminal.";case"missing":return"Install the rynx command to use Rynx from Terminal.";case"stale":return"An older rynx command was found. Repair it to continue.";case"foreign":return"Another command named rynx already exists. Resolve it later in Settings.";case"development":return"Terminal command registration is disabled in development builds.";case"unwritable":return"Rynx could not install the command automatically. Resolve it later in Settings.";case"error":return"Rynx could not check the command. Check again before continuing."}}function tU({bridge:e}){const[t,r]=g.useState(null),[s,n]=g.useState(!1),[l,u]=g.useState(null),d=g.useRef(!1),m=g.useRef(0),f=g.useCallback(b=>{b.requestId<=m.current||(m.current=b.requestId,r(b),n(!1),u(null),d.current=!1)},[]);g.useEffect(()=>{let b=!0;const w=e.onQuitPrompt(C=>{b&&f(C)});return e.getPendingQuitPrompt().then(C=>{b&&C&&f(C)}).catch(()=>{}),()=>{b=!1,w()}},[f,e]);const v=g.useCallback(async()=>{if(!(!t||s||d.current)){d.current=!0;try{const b=await e.respondToQuit(t.requestId,"cancel");if(b.outcome==="failed"){u(b.message);return}if(b.outcome==="quitting"){n(!0);return}b.outcome==="cancelled"&&(r(null),u(null))}catch{u("Rynx couldn’t dismiss the quit request. Try again.")}finally{d.current=!1}}},[e,t,s]),p=g.useCallback(async()=>{if(!(!t||t.kind!=="active-work"||d.current)){d.current=!0,n(!0),u(null);try{const b=await e.respondToQuit(t.requestId,"force");b.outcome==="failed"?(u(b.message),n(!1)):b.outcome==="cancelled"&&(r(null),n(!1))}catch{u("Rynx couldn’t stop the running work. Try again."),n(!1)}finally{d.current=!1}}},[e,t]),x=(t==null?void 0:t.kind)==="active-work";return o.jsx(ki,{open:t!==null,onOpenChange:b=>{b||v()},children:o.jsxs(Xs,{children:[o.jsxs(Ei,{children:[o.jsx(yR,{className:"bg-destructive/10 text-destructive",children:o.jsx(bi,{"aria-hidden":"true"})}),o.jsx(Zs,{children:x?"Quit Rynx?":"Rynx couldn’t quit"}),o.jsx(Qs,{children:x?"Work is still running. Quitting now will stop it and close the open workspace.":"Rynx couldn’t stop its local service safely. Keep the app open and try again."})]}),l&&o.jsx("p",{role:"alert",className:"text-sm text-destructive",children:l}),o.jsxs(Ri,{children:[o.jsx(Js,{disabled:s,children:x?"Keep working":"Close"}),x&&o.jsx(ne,{type:"button",variant:"destructive",disabled:s,onClick:()=>void p(),children:s?o.jsxs(o.Fragment,{children:[o.jsx(ze,{className:"animate-spin motion-reduce:animate-none"}),"Quitting…"]}):"Quit anyway"})]})]})})}const rU=[{label:"General",items:[{id:"overview",label:"Overview",icon:LO},{id:"projects",label:"Projects",icon:pO}]},{label:"Connections",items:[{id:"localRuntime",label:"Local Runtime",icon:S0},{id:"runtimes",label:"Runtimes",icon:km}]},{label:"AI Capabilities",items:[{id:"providers",label:"Providers",icon:gE},{id:"agents",label:"Agents",icon:Sm},{id:"skills",label:"Skills",icon:pE}]},{label:"Integrations",items:[{id:"computerUse",label:"Computer Use",icon:uE},{id:"emulator",label:"Emulator",icon:uc},{id:"plugins",label:"Plugins",icon:Cm}]}];function sU({activeView:e,desktopIntegrationAvailable:t,children:r}){const s=ao(),n=Xr(),{runtimeSelector:l}=Sc(),u=EA(n.state,Ka(l)),d={returnTo:u},m=rU.map(v=>({...v,items:v.items.filter(({id:p})=>wA(p,t))})).filter(v=>v.items.length>0),f=m.flatMap(v=>v.items);return o.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-[var(--background)] md:grid md:grid-cols-[14rem_minmax(0,1fr)]",children:[o.jsxs("aside",{className:"hidden min-h-0 flex-col border-r border-[var(--border)] bg-[var(--muted)]/18 md:flex",children:[o.jsxs("div",{className:"app-drag-region desktop-macos-titlebar-inset border-b border-[var(--border)] p-2.5",children:[o.jsx("div",{className:"mb-2 flex h-7 items-center px-0.5",children:o.jsxs(Ya,{to:u,className:"app-no-drag flex w-fit items-center gap-2","aria-label":"Rynx",children:[o.jsx("img",{src:am,alt:"rynx",className:"h-5 w-auto dark:brightness-0 dark:invert"}),o.jsx("span",{className:"label-caps text-[8px] text-[var(--muted-foreground)]",children:"control"})]})}),o.jsx(ne,{asChild:!0,variant:"ghost",size:"sm",className:"app-no-drag w-full justify-start gap-2 px-2",children:o.jsxs(Ya,{to:u,children:[o.jsx(Yo,{className:"size-3.5"}),"Back to app"]})})]}),o.jsx(xn,{className:"min-h-0 flex-1",children:o.jsx("nav",{className:"space-y-4 p-3","aria-label":"Settings",children:m.map(v=>o.jsxs("div",{children:[o.jsx("div",{className:"label-caps mb-1 px-2 text-[9px] text-[var(--muted-foreground)]",children:v.label}),o.jsx("div",{className:"grid gap-0.5",children:v.items.map(({id:p,label:x,icon:b})=>o.jsxs(Ya,{to:vt[p],state:d,"aria-current":e===p?"page":void 0,className:We("flex items-center gap-2 rounded-md px-2.5 py-1.5 text-xs font-medium transition-colors",e===p?"bg-[var(--primary)]/10 text-[var(--primary)]":"text-[var(--muted-foreground)] hover:bg-[var(--accent)] hover:text-[var(--accent-foreground)]"),children:[o.jsx(b,{className:"size-3.5 shrink-0"}),x]},p))})]},v.label))})})]}),o.jsxs("div",{className:"app-drag-region flex h-14 shrink-0 items-center gap-2 border-b border-[var(--border)] bg-[var(--muted)]/18 px-3 md:hidden",children:[o.jsx(Ya,{to:u,className:"app-no-drag shrink-0","aria-label":"Rynx",children:o.jsx("img",{src:am,alt:"rynx",className:"h-5 w-auto dark:brightness-0 dark:invert"})}),o.jsx(ne,{asChild:!0,variant:"ghost",size:"sm",className:"app-no-drag shrink-0 gap-1.5 px-2",children:o.jsxs(Ya,{to:u,children:[o.jsx(Yo,{className:"size-3.5"}),"Back"]})}),o.jsx(VN,{"aria-label":"Settings page",value:e,className:"ml-auto min-w-0 flex-1",onChange:v=>s(vt[v.target.value],{state:d}),children:f.map(({id:v,label:p})=>o.jsx("option",{value:v,children:p},v))})]}),e==="emulator"?o.jsx("section",{className:"min-h-0 flex-1 overflow-hidden",children:r}):o.jsx(xn,{className:"min-h-0 flex-1",children:o.jsx("section",{className:"p-4 sm:p-6",children:r})})]})}var iU="Label",OA=g.forwardRef((e,t)=>o.jsx(Xe.label,{...e,ref:t,onMouseDown:r=>{var n;r.target.closest("button, input, select, textarea")||((n=e.onMouseDown)==null||n.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));OA.displayName=iU;var nU=OA;const Kr=g.forwardRef(({className:e,...t},r)=>o.jsx(nU,{ref:r,className:We("text-xs font-medium text-[var(--muted-foreground)]",e),...t}));Kr.displayName="Label";function BA({onInstalled:e,triggerLabel:t="Install skill",triggerVariant:r="default"}){const[s,n]=g.useState(!1),[l,u]=g.useState(""),[d,m]=g.useState(""),[f,v]=g.useState(""),[p,x]=g.useState(!1);function b(){u(""),m(""),v("")}const w=(()=>{const E=l.trim();return!E||!d.trim()?E:`${E}#${d.trim()}`})(),C=!!d.trim()&&l.includes("#");async function k(){const E=w;if(E){if(C){pe.error("Source already pins a ref with '#' — clear one of the two.");return}x(!0);try{const N=await xe.installSkill({tool:"skills-cli",source:E,...f.trim()?{skill:f.trim()}:{}});pe.success(`Installed ${f.trim()||E}`),e(N),b(),n(!1)}catch(N){pe.error(`Install failed: ${N.message}`)}finally{x(!1)}}}const S=["npx skills add",w||"<source>",f.trim()&&`--skill ${f.trim()}`].filter(Boolean).join(" ");return o.jsxs(oa,{open:s,onOpenChange:E=>{n(E),E||b()},children:[o.jsx(bR,{asChild:!0,children:o.jsxs(ne,{size:"sm",variant:r,children:[o.jsx(ls,{})," ",t]})}),o.jsxs(Sn,{children:[o.jsxs(la,{children:[o.jsx(Cn,{children:"Install a skill"}),o.jsxs(sl,{children:["From the open skills ecosystem (skills.sh). Runs ",o.jsx("code",{children:"npx skills add"})," into the global catalog (",o.jsx("code",{children:"~/.rynx/skills"}),")."]})]}),o.jsxs("div",{className:"grid gap-3",children:[o.jsxs("div",{className:"grid gap-1.5",children:[o.jsxs(Kr,{children:["Source ",o.jsx("span",{className:"text-[var(--destructive)]",children:"*"})]}),o.jsx(bt,{value:l,autoFocus:!0,placeholder:"vercel-labs/skills or https://github.com/owner/repo",onChange:E=>u(E.target.value)}),o.jsxs("p",{className:"text-xs text-[var(--muted-foreground)]",children:["A repo (",o.jsx("code",{children:"owner/repo"}),"), a git URL, or a namespace."]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsxs("div",{className:"grid gap-1.5",children:[o.jsx(Kr,{children:"Skill"}),o.jsx(bt,{value:f,placeholder:"find-skills",onChange:E=>v(E.target.value)}),o.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Optional — when a repo ships several."})]}),o.jsxs("div",{className:"grid gap-1.5",children:[o.jsx(Kr,{children:"Branch"}),o.jsx(bt,{value:d,placeholder:"main",onChange:E=>m(E.target.value)}),o.jsxs("p",{className:"text-xs text-[var(--muted-foreground)]",children:["Optional — a git ref, sent as ",o.jsx("code",{children:"#<branch>"}),"."]})]})]}),o.jsx("pre",{className:"overflow-x-auto rounded-md border border-[var(--border)] bg-[var(--muted)]/40 p-2.5 font-mono text-xs text-[var(--muted-foreground)]",children:S})]}),o.jsxs(ca,{children:[o.jsx(ne,{variant:"outline",onClick:()=>n(!1),children:"Cancel"}),o.jsx(ne,{onClick:k,disabled:p||!l.trim(),children:p?"Installing…":"Install"})]})]})]})}const aU=["codex","traex","claude"],GC=["none","minimal","low","medium","high","xhigh","max","ultra"],oU=["read-only","workspace-write","danger-full-access"],lU=["never","on-failure","on-request","untrusted"],cU=["acceptEdits","auto","bypassPermissions","manual","dontAsk","plan"];function uU({value:e,onChange:t}){return o.jsxs("div",{className:"grid gap-4",children:[o.jsx(Or,{label:"Display name",help:"Shown in the UI; the id (left) is the directory name.",children:o.jsx(bt,{value:e.name??"",placeholder:"My agent",onChange:r=>t({...e,name:r.target.value})})}),o.jsx(Or,{label:"Description",children:o.jsx(bt,{value:e.description??"",placeholder:"What this agent does",onChange:r=>t({...e,description:r.target.value})})}),o.jsx(Or,{label:"Instructions",help:"Inline system prompt, or a path to a .md under the agent dir.",children:o.jsx(wd,{value:e.instructions??"",className:"min-h-[14rem]",placeholder:"You are a helpful agent.",onChange:r=>t({...e,instructions:r.target.value})})})]})}function dU({value:e,onChange:t}){const r=e.executor??{},s=r.retry??{},[n,l]=g.useState(null);g.useEffect(()=>{let b=!1;return xe.listAgentRuntimeOptions().then(w=>!b&&l(w)).catch(w=>{b||(l([]),pe.error(`Load runtime options failed: ${w.message}`))}),()=>{b=!0}},[]);const u=b=>t({...e,executor:{...r,...b}}),d=b=>t({...e,executor:{...r,retry:{...s,...b}}}),m=n==null?void 0:n.find(b=>b.id===(r.runtime??"codex")),f=(m==null?void 0:m.models)??[],v=f.find(b=>b.id===r.model),p=(v==null?void 0:v.reasoningOptions.map(b=>b.value))??GC,x=b=>{if(!b)return;const w=n==null?void 0:n.find(k=>k.id===b),C=(w==null?void 0:w.models.find(k=>k.isDefault))??(w==null?void 0:w.models[0]);u({runtime:b,model:C==null?void 0:C.id,reasoningEffort:C==null?void 0:C.defaultReasoningEffort})};return o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsxs(Or,{label:"Runtime",children:[o.jsx(Vu,{value:r.runtime,options:n!=null&&n.length?n.map(b=>b.id):aU,required:!0,onChange:x}),m&&!m.available&&o.jsxs("p",{className:"text-xs text-[var(--warning)]",children:[m.name," is not installed on this machine."]})]}),o.jsx(Or,{label:"Reasoning effort",children:o.jsx(Vu,{value:r.reasoningEffort,options:p.length>0?p:GC,onChange:b=>u({reasoningEffort:b})})})]}),o.jsx(Or,{label:"Model",help:"Blank inherits the runtime default.",children:f.length>0?o.jsxs(gn,{value:r.model??"",onValueChange:b=>u({model:b,reasoningEffort:void 0}),children:[o.jsx(Ui,{children:o.jsx($i,{placeholder:"runtime default"})}),o.jsxs(Hi,{children:[r.model&&!f.some(b=>b.id===r.model)&&o.jsxs(cr,{value:r.model,children:[r.model," · custom"]}),f.map(b=>o.jsxs(cr,{value:b.id,children:[b.label,b.isDefault?" · default":""]},b.id))]})]}):o.jsx(bt,{value:r.model??"",placeholder:"runtime default",onChange:b=>u({model:b.target.value||void 0})})}),o.jsx("div",{className:"label-caps pt-1 text-xs text-[var(--muted-foreground)]",children:"Execution budget"}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Or,{label:"Timeout (s)",help:"End-to-end wall-clock cap.",children:o.jsx(wu,{value:r.timeout,onChange:b=>u({timeout:b})})}),o.jsx(Or,{label:"Max iterations",help:"claude only (→ --max-turns).",children:o.jsx(wu,{value:r.maxIterations,onChange:b=>u({maxIterations:b})})}),o.jsx(Or,{label:"Context window",help:"codex/traex token budget.",children:o.jsx(wu,{value:r.contextWindow,onChange:b=>u({contextWindow:b})})}),o.jsx(Or,{label:"Retry: max retries",children:o.jsx(wu,{value:s.maxRetries,onChange:b=>d({maxRetries:b})})}),o.jsx(Or,{label:"Retry: timeout/req (s)",children:o.jsx(wu,{value:s.timeoutPerRequestSeconds,onChange:b=>d({timeoutPerRequestSeconds:b})})})]})]})}function hU({value:e,onChange:t}){var l;const r=e.osEnv??{},s=u=>t({...e,osEnv:{...r,...u}}),n=((l=e.executor)==null?void 0:l.runtime)??"codex";return o.jsx("div",{className:"grid gap-4",children:o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n==="claude"?o.jsx(Or,{label:"Permission mode",help:"Claude's approval axis (--permission-mode).",children:o.jsx(Vu,{value:r.permissionMode,options:cU,onChange:u=>s({permissionMode:u})})}):o.jsxs(o.Fragment,{children:[o.jsx(Or,{label:"Sandbox",children:o.jsx(Vu,{value:r.sandbox,options:oU,onChange:u=>s({sandbox:u})})}),o.jsx(Or,{label:"Approval policy",help:"Codex's approval axis.",children:o.jsx(Vu,{value:r.approvalPolicy,options:lU,onChange:u=>s({approvalPolicy:u})})})]}),o.jsx(Or,{label:"Full auto",children:o.jsxs("label",{className:"flex h-8 items-center gap-2 text-sm",children:[o.jsx("input",{type:"checkbox",className:"size-4",checked:!!r.fullAuto,onChange:u=>s({fullAuto:u.target.checked||void 0})}),o.jsx("span",{className:"text-[var(--muted-foreground)]",children:"enable"})]})})]})})}function fU({value:e,onChange:t}){const r=e.tools??{},s=n=>t({...e,tools:{...r,...n}});return o.jsxs("div",{className:"grid gap-4",children:[o.jsx(Or,{label:"Allowed tools",help:"claude only; codex/traex ignore.",children:o.jsx(YC,{items:r.allowed??[],placeholder:"ToolName",onChange:n=>s({allowed:n})})}),o.jsx(Or,{label:"Disallowed tools",children:o.jsx(YC,{items:r.disallowed??[],placeholder:"ToolName",onChange:n=>s({disallowed:n})})}),o.jsx(Or,{label:"MCP servers",help:"HTTP transport only.",children:o.jsx(pU,{rows:r.mcp??[],onChange:n=>s({mcp:n})})})]})}function mU({value:e,onChange:t}){const r=e.skills??[],[s,n]=g.useState(null);g.useEffect(()=>{xe.listSkills().then(n).catch(v=>{n([]),pe.error(`Load skills failed: ${v.message}`)})},[]);const l=new Set(r.map(v=>v.name)),u=v=>{v.ref&&t({...e,skills:[...r,{...v.ref}]})},d=v=>t({...e,skills:r.filter(p=>p.name!==v)}),m=new Set((s??[]).map(v=>v.name)),f=r.map(v=>v.name).filter(v=>!m.has(v));return o.jsxs("div",{className:"grid gap-4",children:[o.jsx(Or,{label:"Skills",help:"Empty = no skills (hermetic). Each selection copies the skill's install recipe into the spec, so the agent installs its own skills wherever it runs.",children:s===null?o.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Loading…"}):s.length===0&&f.length===0?o.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"No skills installed yet — install one below."}):o.jsxs("div",{className:"grid gap-0.5 rounded-md border border-[var(--border)] p-1.5",children:[s.map(v=>o.jsxs("label",{className:"flex items-start gap-2 rounded-sm p-1.5 "+(v.ref?"cursor-pointer hover:bg-[var(--muted)]/50":"opacity-60"),children:[o.jsx("input",{type:"checkbox",className:"mt-0.5 size-4 shrink-0",disabled:!v.ref,checked:l.has(v.name),onChange:p=>p.target.checked?u(v):d(v.name)}),o.jsxs("span",{className:"grid",children:[o.jsxs("span",{className:"font-mono text-sm",children:[v.name,!v.ref&&o.jsx("span",{className:"ml-1 text-xs text-[var(--warning)]",children:"(no install recipe — reinstall to make selectable)"})]}),o.jsx("span",{className:"line-clamp-2 text-xs text-[var(--muted-foreground)]",children:v.description})]})]},v.name)),f.map(v=>o.jsxs("label",{className:"flex items-center gap-2 rounded-sm p-1.5",children:[o.jsx("input",{type:"checkbox",className:"size-4 shrink-0",checked:!0,onChange:()=>d(v)}),o.jsxs("span",{className:"font-mono text-sm",children:[v," ",o.jsx("span",{className:"text-xs text-[var(--muted-foreground)]",children:"(declared in the spec; installs at run time)"})]})]},v))]})}),o.jsx("div",{children:o.jsx(BA,{onInstalled:n,triggerVariant:"outline"})})]})}function hx(e){const{skills:t,...r}=e,s=fx(r)??{};return Array.isArray(t)&&t.length>0&&(s.skills=t),s}function fx(e){if(Array.isArray(e)){const t=e.map(fx).filter(r=>r!==void 0);return t.length>0?t:void 0}if(e&&typeof e=="object"){const t={};for(const[r,s]of Object.entries(e)){const n=fx(s);n!==void 0&&(t[r]=n)}return Object.keys(t).length>0?t:void 0}if(typeof e=="string"){const t=e.trim();return t===""?void 0:t}return e}function Or({label:e,help:t,children:r}){return o.jsxs("div",{className:"grid content-start gap-1.5",children:[o.jsx(Kr,{children:e}),r,t&&o.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:t})]})}const Uv="__default__";function Vu({value:e,options:t,onChange:r,disabled:s,required:n}){return o.jsxs(gn,{value:e??(n?t[0]:Uv),disabled:s,onValueChange:l=>r(l===Uv?void 0:l),children:[o.jsx(Ui,{children:o.jsx($i,{})}),o.jsxs(Hi,{children:[!n&&o.jsx(cr,{value:Uv,children:o.jsx("span",{className:"text-[var(--muted-foreground)]",children:"Unset"})}),t.map(l=>o.jsx(cr,{value:l,children:l},l))]})]})}function wu({value:e,onChange:t}){return o.jsx(bt,{type:"number",value:e??"",onChange:r=>{const s=r.target.value;t(s===""?void 0:Number(s))}})}function YC({items:e,placeholder:t,onChange:r}){const s=(l,u)=>r(e.map((d,m)=>m===l?u:d)),n=l=>r(e.filter((u,d)=>d!==l));return o.jsxs("div",{className:"grid gap-1.5",children:[e.map((l,u)=>o.jsxs("div",{className:"flex gap-1.5",children:[o.jsx(bt,{value:l,placeholder:t,onChange:d=>s(u,d.target.value)}),o.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>n(u),children:o.jsx(_n,{})})]},u)),o.jsxs(ne,{variant:"outline",size:"sm",className:"justify-self-start",onClick:()=>r([...e,""]),children:[o.jsx(ls,{})," Add"]})]})}function pU({rows:e,onChange:t}){const r=g.useRef(0),[s,n]=g.useState(()=>e.map(()=>r.current++)),l=(m,f)=>t(e.map((v,p)=>p===m?{...v,...f}:v)),u=m=>{t(e.filter((f,v)=>v!==m)),n(s.filter((f,v)=>v!==m))},d=()=>{t([...e,{name:"",url:""}]),n([...s,r.current++])};return o.jsxs("div",{className:"grid gap-2",children:[e.map((m,f)=>o.jsxs("div",{className:"grid gap-2 rounded-md border border-[var(--border)] p-3",children:[o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(bt,{className:"w-1/3",value:m.name??"",placeholder:"name",onChange:v=>l(f,{name:v.target.value})}),o.jsx("span",{className:"label-caps rounded bg-[var(--muted)] px-1.5 py-1 text-[10px] text-[var(--muted-foreground)]",children:"HTTP"}),o.jsx(bt,{value:m.url??"",placeholder:"https://server/mcp",onChange:v=>l(f,{url:v.target.value})}),o.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>u(f),children:o.jsx(_n,{})})]}),o.jsx(gU,{headers:m.headers??{},onChange:v=>l(f,{headers:v})})]},s[f]??f)),o.jsxs(ne,{variant:"outline",size:"sm",className:"justify-self-start",onClick:d,children:[o.jsx(ls,{})," Add MCP server"]})]})}function gU({headers:e,onChange:t}){const[r,s]=g.useState(()=>Object.entries(e).map(([d,m])=>({k:d,v:m})));function n(d){s(d);const m={};for(const{k:f,v}of d){const p=f.trim();p&&(m[p]=v)}t(Object.keys(m).length>0?m:void 0)}const l=(d,m)=>n(r.map((f,v)=>v===d?{...f,...m}:f)),u=d=>n(r.filter((m,f)=>f!==d));return o.jsxs("div",{className:"grid gap-1.5",children:[r.map((d,m)=>o.jsxs("div",{className:"flex gap-1.5",children:[o.jsx(bt,{className:"w-1/3 font-mono text-xs",value:d.k,placeholder:"Header",onChange:f=>l(m,{k:f.target.value})}),o.jsx(bt,{className:"font-mono text-xs",value:d.v,placeholder:"value",onChange:f=>l(m,{v:f.target.value})}),o.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>u(m),children:o.jsx(_n,{})})]},m)),o.jsxs(ne,{variant:"ghost",size:"sm",className:"justify-self-start text-[var(--muted-foreground)]",onClick:()=>n([...r,{k:"",v:""}]),children:[o.jsx(ls,{})," Add header"]})]})}function At({className:e,...t}){return o.jsx("div",{className:We("glass rounded-xl border border-[var(--border)] text-[var(--card-foreground)]",e),...t})}function Ys({className:e,...t}){return o.jsx("div",{className:We("flex items-center justify-between gap-3 px-5 py-4 border-b border-[var(--border)]",e),...t})}function Ds({className:e,...t}){return o.jsx("h3",{className:We("text-sm font-semibold tracking-tight",e),...t})}function Pr({className:e,...t}){return o.jsx("div",{className:We("p-5",e),...t})}const Hv=/^[a-z0-9][a-z0-9-]{0,63}$/,mx=[{id:"identity",label:"Identity",blurb:"Name, description, and system instructions."},{id:"model",label:"Model & Budget",blurb:"Runtime, model, reasoning effort, and execution limits."},{id:"environment",label:"Environment",blurb:"Sandbox and per-runtime approval behavior."},{id:"tools",label:"Tools & MCP",blurb:"Allowed/disallowed tools and MCP servers."},{id:"skills",label:"Skills",blurb:"Which skills this agent can use."},{id:"review",label:"Review",blurb:"Confirm and save."}];function vU({initial:e,onClose:t,onSaved:r}){const s=e.id==="",[n,l]=g.useState(e.id),[u,d]=g.useState(e.spec),[m,f]=g.useState("identity"),[v,p]=g.useState("form"),[x,b]=g.useState(()=>JSON.stringify(e.spec,null,2)),[w,C]=g.useState(!1);function k(E){if(E!==v)if(E==="json")b(JSON.stringify(u,null,2)),p("json");else try{d(JSON.parse(x)),p("form")}catch(N){pe.error(`Invalid JSON: ${N.message}`)}}async function S(){const E=n.trim();if(s&&!Hv.test(E))return f("identity"),pe.error(E?"Invalid agent id — use lowercase letters, digits, or hyphens":"Agent id is required");let N;if(v==="json")try{N=JSON.parse(x)}catch(R){return pe.error(`Invalid JSON: ${R.message}`)}else N=u;C(!0);try{s?await xe.createAgent({...hx(N),id:n.trim()}):await xe.updateAgent(e.id,hx(N)),pe.success(`Agent "${n}" saved`),await r()}catch(R){pe.error(`Save failed: ${R.message}`)}finally{C(!1)}}return o.jsxs("div",{className:"grid gap-5",children:[o.jsxs("div",{className:"flex items-start justify-between gap-4",children:[o.jsxs("div",{className:"grid gap-1",children:[o.jsxs("button",{type:"button",onClick:t,className:"inline-flex w-fit items-center gap-1 text-xs text-[var(--muted-foreground)] hover:text-[var(--foreground)]",children:[o.jsx(Yo,{className:"size-3.5"})," Agents"]}),o.jsx("h1",{className:"text-xl font-semibold",children:s?"New agent":`Edit "${e.id}"`})]}),o.jsx("div",{className:"inline-flex rounded-md border border-[var(--border)] p-0.5",children:["form","json"].map(E=>o.jsx("button",{type:"button",onClick:()=>k(E),className:We("rounded-sm px-3 py-1 text-sm capitalize transition-colors",v===E?"bg-[var(--primary)] text-[var(--primary-foreground)]":"text-[var(--muted-foreground)] hover:text-[var(--foreground)]"),children:E},E))})]}),v==="json"?o.jsx(wd,{value:x,onChange:E=>b(E.target.value),className:"min-h-[28rem] font-mono text-xs"}):o.jsxs("div",{className:"grid grid-cols-[12rem_1fr] gap-6",children:[o.jsx("nav",{className:"sticky top-6 grid h-fit gap-0.5",children:mx.map(E=>o.jsx("button",{type:"button",onClick:()=>f(E.id),className:We("rounded-md px-3 py-2 text-left text-sm transition-colors",m===E.id?"bg-[var(--muted)] font-medium text-[var(--foreground)]":"text-[var(--muted-foreground)] hover:bg-[var(--muted)]/50"),children:E.label},E.id))}),o.jsxs("div",{className:"min-w-0",children:[o.jsxs("div",{className:"mb-4",children:[o.jsx("h2",{className:"text-base font-semibold",children:KC(m).label}),o.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:KC(m).blurb})]}),o.jsxs("div",{className:"rounded-lg border border-[var(--border)] p-5",children:[m==="identity"&&o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-1.5",children:[o.jsxs(Kr,{children:["Agent ID ",o.jsx("span",{className:"text-[var(--destructive)]",children:"*"})]}),o.jsx(bt,{value:n,disabled:!s,onChange:E=>l(E.target.value),placeholder:"polly","aria-invalid":s&&n.trim()!==""&&!Hv.test(n.trim())}),s&&n.trim()!==""&&!Hv.test(n.trim())?o.jsx("p",{className:"text-xs text-[var(--destructive)]",children:"Use 1–64 lowercase letters, digits, or hyphens, starting with a letter or digit."}):o.jsxs("p",{className:"text-xs text-[var(--muted-foreground)]",children:["The config directory name. References (",o.jsx("code",{children:"/agent <id>"}),", bindings) use it; it can't change after creation."]})]}),o.jsx(uU,{value:u,onChange:d})]}),m==="model"&&o.jsx(dU,{value:u,onChange:d}),m==="environment"&&o.jsx(hU,{value:u,onChange:d}),m==="tools"&&o.jsx(fU,{value:u,onChange:d}),m==="skills"&&o.jsx(mU,{value:u,onChange:d}),m==="review"&&o.jsx(_U,{id:n,spec:u})]})]})]}),o.jsxs("div",{className:"flex justify-end gap-2 border-t border-[var(--border)] pt-4",children:[o.jsx(ne,{variant:"outline",onClick:t,children:"Cancel"}),o.jsx(ne,{onClick:S,disabled:w,children:w?"Saving…":"Save"})]})]})}function KC(e){return mx.find(t=>t.id===e)??mx[0]}function _U({id:e,spec:t}){var n,l,u,d,m,f;const r=hx(t),s=[["Agent ID",e||"—"],["Display name",((n=t.name)==null?void 0:n.trim())||"—"],["Runtime",((l=t.executor)==null?void 0:l.runtime)??"default"],["Model",((d=(u=t.executor)==null?void 0:u.model)==null?void 0:d.trim())||"runtime default"],["Skills",xU(t.skills)],["MCP servers",String(((f=(m=t.tools)==null?void 0:m.mcp)==null?void 0:f.filter(v=>{var p;return(p=v.url)==null?void 0:p.trim()}).length)??0)]];return o.jsxs("div",{className:"grid gap-4",children:[o.jsx("dl",{className:"grid grid-cols-[10rem_1fr] gap-x-4 gap-y-2 text-sm",children:s.map(([v,p])=>o.jsxs("div",{className:"contents",children:[o.jsx("dt",{className:"text-[var(--muted-foreground)]",children:v}),o.jsx("dd",{className:"font-medium",children:p})]},v))}),o.jsxs("div",{className:"grid gap-1.5",children:[o.jsx(Kr,{children:"Resulting spec"}),o.jsx("pre",{className:"max-h-72 overflow-auto rounded-md border border-[var(--border)] bg-[var(--muted)]/40 p-3 font-mono text-xs",children:JSON.stringify({id:e||void 0,...r},null,2)})]})]})}function xU(e){return e!=null&&e.length?`${e.length} declared`:"None"}const Fv=/^[a-z0-9][a-z0-9-]{0,63}$/;function yU({agents:e,onChange:t}){var D;const[r,s]=g.useState(((D=e[0])==null?void 0:D.id)??""),[n,l]=g.useState(null),[u,d]=g.useState(!1),[m,f]=g.useState(null),[v,p]=g.useState(!1),[x,b]=g.useState([]),[w,C]=g.useState([]),[k,S]=g.useState(!1);g.useEffect(()=>{var B;r&&e.some($=>$.id===r)||s(((B=e[0])==null?void 0:B.id)??"")},[e,r]),g.useEffect(()=>{if(!r){l(null);return}let B=!1;return d(!0),xe.getAgent(r).then($=>{B||l($)}).catch($=>!B&&pe.error(`Load agent failed: ${$.message}`)).finally(()=>!B&&d(!1)),()=>{B=!0}},[r]);async function E(B=!1){S(!0);try{const[$,q]=await Promise.all([xe.listAgentRuntimeOptions(B),xe.listSkills()]);b($),C(q)}catch($){pe.error(`Load local options failed: ${$.message}`)}finally{S(!1)}}async function N(B){try{const $=await xe.getAgent(B);delete $.id,f({id:B,spec:$})}catch($){pe.error(`Load failed: ${$.message}`)}}if(m)return o.jsx(vU,{initial:m,onClose:()=>f(null),onSaved:async()=>{const B=m.id;f(null),await t(),s(B),l(await xe.getAgent(B))}});const R=new Set(e.map(B=>B.runtime).filter(Boolean)),A=e.reduce((B,$)=>B+($.skillCount??0),0);return o.jsxs("div",{className:"grid gap-5",children:[o.jsxs("div",{className:"flex items-start justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-xl font-semibold",children:"Agents"}),o.jsxs("p",{className:"mt-1 text-sm text-[var(--muted-foreground)]",children:["Local Agent profiles discovered from ",o.jsx("code",{children:"~/.rynx/agents"}),"."]})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(ne,{variant:"outline",onClick:()=>void t(),children:[o.jsx(_t,{})," Refresh"]}),o.jsxs(ne,{onClick:()=>{p(!0),E()},children:[o.jsx(ls,{})," New agent"]})]})]}),o.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[o.jsx(Wv,{label:"agents",value:e.length,detail:"Local registered profiles"}),o.jsx(Wv,{label:"runtimes",value:R.size,detail:"Runtimes currently used"}),o.jsx(Wv,{label:"skill bindings",value:A,detail:"Explicit Skill references"})]}),o.jsxs("div",{className:"grid min-h-[620px] gap-4 lg:grid-cols-[320px_minmax(0,1fr)]",children:[o.jsxs(At,{className:"overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-4 py-3",children:[o.jsx("h2",{className:"text-sm font-semibold",children:"Agent list"}),o.jsx("span",{className:"text-xs text-[var(--muted-foreground)]",children:e.length})]}),o.jsxs("div",{className:"grid gap-2 p-2",children:[e.length===0&&o.jsx("div",{className:"rounded-lg border border-dashed border-[var(--border)] px-4 py-6 text-sm text-[var(--muted-foreground)]",children:"No local Agents registered yet."}),e.map(B=>o.jsxs("button",{type:"button",onClick:()=>s(B.id),className:We("flex w-full items-start gap-3 rounded-lg border px-3 py-3 text-left transition-colors",r===B.id?"border-[var(--primary)] bg-[var(--primary)]/10":"border-[var(--border)] hover:bg-[var(--muted)]/45"),children:[o.jsx("span",{className:"mt-0.5 grid size-9 shrink-0 place-items-center rounded-md bg-violet-500/10 text-violet-600",children:o.jsx(Sm,{className:"size-4"})}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"truncate text-sm font-semibold",children:B.name??B.id}),r===B.id&&o.jsx(oo,{className:"size-4 shrink-0 text-[var(--primary)]"})]}),B.description&&o.jsx("span",{className:"mt-1 block line-clamp-2 text-xs text-[var(--muted-foreground)]",children:B.description}),o.jsxs("span",{className:"mt-2 flex flex-wrap gap-1.5 text-[10px] text-[var(--muted-foreground)]",children:[o.jsx("span",{className:"rounded bg-[var(--muted)] px-1.5 py-1",children:B.runtime??"default runtime"}),o.jsxs("span",{className:"rounded bg-[var(--muted)] px-1.5 py-1",children:[B.skillCount??0," skills"]})]})]})]},B.id))]})]}),o.jsx(bU,{id:r,detail:n,loading:u,onEdit:()=>void N(r),onDeleted:t})]}),o.jsx(wU,{open:v,onOpenChange:p,runtimes:x,skills:w,loading:k,onRefresh:()=>E(!0),onCreated:async B=>{p(!1),await t(),s(B)}})]})}function bU({id:e,detail:t,loading:r,onEdit:s,onDeleted:n}){var u,d,m;if(!e)return o.jsx(At,{className:"p-6 text-sm text-[var(--muted-foreground)]",children:"Select an Agent to inspect its configuration."});if(r||!t)return o.jsx(At,{className:"p-6 text-sm text-[var(--muted-foreground)]",children:"Loading Agent configuration…"});const l=t.skills??[];return o.jsxs(At,{className:"overflow-hidden",children:[o.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-[var(--border)] px-5 py-4",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("h2",{className:"text-lg font-semibold",children:t.name??e}),o.jsx("code",{className:"text-[10px] text-[var(--muted-foreground)]",children:e})]}),t.description&&o.jsx("p",{className:"mt-1 text-sm text-[var(--muted-foreground)]",children:t.description})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(ne,{variant:"outline",size:"sm",onClick:s,children:[o.jsx(hE,{})," Edit configuration"]}),o.jsx(SU,{id:e,onChange:n})]})]}),o.jsxs("div",{className:"grid gap-6 p-5",children:[o.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[o.jsx(qv,{label:"Runtime",value:((u=t.executor)==null?void 0:u.runtime)??"default"}),o.jsx(qv,{label:"Model",value:((d=t.executor)==null?void 0:d.model)??"runtime default"}),o.jsx(qv,{label:"Reasoning",value:((m=t.executor)==null?void 0:m.reasoningEffort)??"runtime default"})]}),o.jsxs("section",{children:[o.jsx("div",{className:"label-caps text-[10px] text-[var(--muted-foreground)]",children:"instructions"}),o.jsx("div",{className:"mt-2 whitespace-pre-wrap rounded-lg border border-[var(--border)] bg-[var(--muted)]/25 p-4 text-sm leading-6",children:t.instructions||"No inline instructions."})]}),o.jsxs("section",{children:[o.jsx("div",{className:"label-caps text-[10px] text-[var(--muted-foreground)]",children:"skills"}),o.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:l.length===0?o.jsx("span",{className:"text-sm text-[var(--muted-foreground)]",children:"No Skills bound."}):l.map(f=>o.jsx("span",{className:"rounded-md bg-[var(--muted)] px-2 py-1 font-mono text-xs",children:f.name},f.name))})]})]})]})}function wU({open:e,onOpenChange:t,runtimes:r,skills:s,loading:n,onRefresh:l,onCreated:u}){const[d,m]=g.useState(""),[f,v]=g.useState(""),[p,x]=g.useState(!1),[b,w]=g.useState(""),[C,k]=g.useState("You are a helpful agent."),[S,E]=g.useState(""),[N,R]=g.useState(""),[A,D]=g.useState(""),[B,$]=g.useState(new Set),[q,Y]=g.useState(!1),V=r.filter(O=>O.available),U=r.find(O=>O.id===S),L=U==null?void 0:U.models.find(O=>O.id===N);g.useEffect(()=>{if(!e||S)return;const O=V[0];if(!O)return;const W=O.models.find(H=>H.isDefault)??O.models[0];E(O.id),R((W==null?void 0:W.id)??""),D((W==null?void 0:W.defaultReasoningEffort)??"")},[V,e,S,r]);function I(){m(""),v(""),x(!1),w(""),k("You are a helpful agent."),E(""),R(""),D(""),$(new Set)}function F(O){const W=r.find(T=>T.id===O),H=(W==null?void 0:W.models.find(T=>T.isDefault))??(W==null?void 0:W.models[0]);E(O),R((H==null?void 0:H.id)??""),D((H==null?void 0:H.defaultReasoningEffort)??"")}async function M(){const O=f.trim();if(!Fv.test(O)||!d.trim()||!C.trim()||!S)return;const W=s.filter(H=>B.has(H.name)&&H.ref).map(H=>({...H.ref}));Y(!0);try{await xe.createAgent({id:O,name:d.trim(),...b.trim()?{description:b.trim()}:{},instructions:C.trim(),executor:{runtime:S,...N?{model:N}:{},...A?{reasoningEffort:A}:{},timeout:1800,retry:{maxRetries:2}},osEnv:{sandbox:"danger-full-access",approvalPolicy:"never"},...W.length?{skills:W}:{}}),pe.success(`Agent "${d.trim()}" created`),I(),await u(O)}catch(H){pe.error(`Create Agent failed: ${H.message}`)}finally{Y(!1)}}const P=!!(Fv.test(f.trim())&&d.trim()&&C.trim()&&S);return o.jsx(oa,{open:e,onOpenChange:O=>{t(O),O||I()},children:o.jsxs(Sn,{className:"max-h-[85vh] overflow-y-auto sm:max-w-2xl",children:[o.jsx(la,{children:o.jsx(Cn,{children:"Create local Agent"})}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[o.jsx(Oo,{label:"Name",children:o.jsx(bt,{value:d,autoFocus:!0,onChange:O=>{const W=O.target.value;m(W),p||v(CU(W))}})}),o.jsx(Oo,{label:"Agent ID",children:o.jsx(bt,{value:f,onChange:O=>{x(!0),v(O.target.value)},"aria-invalid":!!f&&!Fv.test(f)})})]}),o.jsx(Oo,{label:"Description",children:o.jsx(bt,{value:b,onChange:O=>w(O.target.value)})}),o.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[o.jsx(Oo,{label:"Runtime",children:o.jsxs(gn,{value:S,onValueChange:F,disabled:n||r.length===0,children:[o.jsx(Ui,{children:o.jsx($i,{placeholder:"No runtime found"})}),o.jsx(Hi,{children:r.map(O=>o.jsxs(cr,{value:O.id,disabled:!O.available,children:[O.name,O.available?"":" · missing"]},O.id))})]})}),o.jsx(Oo,{label:"Model",children:o.jsxs(gn,{value:N,onValueChange:O=>{var W;R(O),D(((W=U==null?void 0:U.models.find(H=>H.id===O))==null?void 0:W.defaultReasoningEffort)??"")},disabled:!U||U.models.length===0,children:[o.jsx(Ui,{children:o.jsx($i,{placeholder:"Runtime default"})}),o.jsx(Hi,{children:U==null?void 0:U.models.map(O=>o.jsxs(cr,{value:O.id,children:[O.label,O.isDefault?" · default":""]},O.id))})]})}),o.jsx(Oo,{label:"Reasoning",children:o.jsxs(gn,{value:A||"__default__",onValueChange:O=>D(O==="__default__"?"":O),children:[o.jsx(Ui,{children:o.jsx($i,{})}),o.jsxs(Hi,{children:[o.jsx(cr,{value:"__default__",children:"Runtime default"}),L==null?void 0:L.reasoningOptions.map(O=>o.jsx(cr,{value:O.value,children:O.label},O.value))]})]})})]}),V.length===0&&!n&&o.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-dashed border-[var(--border)] px-3 py-2 text-xs text-[var(--muted-foreground)]",children:["No local coding runtime was discovered.",o.jsxs(ne,{size:"sm",variant:"outline",onClick:()=>void l(),children:[o.jsx(_t,{})," Scan"]})]}),o.jsx(Oo,{label:"Instructions",children:o.jsx(wd,{className:"min-h-32",value:C,onChange:O=>k(O.target.value)})}),o.jsxs("fieldset",{className:"rounded-lg border border-[var(--border)] p-3",children:[o.jsx("legend",{className:"label-caps px-1 text-[10px] text-[var(--muted-foreground)]",children:"skills · optional"}),o.jsxs("div",{className:"grid max-h-40 gap-1 overflow-y-auto",children:[s.filter(O=>O.ref).length===0&&o.jsx("div",{className:"py-2 text-xs text-[var(--muted-foreground)]",children:"No selectable local Skills."}),s.filter(O=>O.ref).map(O=>o.jsxs("label",{className:"flex cursor-pointer items-start gap-2 rounded-md px-2 py-2 hover:bg-[var(--muted)]/50",children:[o.jsx("input",{type:"checkbox",className:"mt-0.5 size-4",checked:B.has(O.name),onChange:()=>$(W=>{const H=new Set(W);return H.has(O.name)?H.delete(O.name):H.add(O.name),H})}),o.jsxs("span",{children:[o.jsx("span",{className:"block font-mono text-sm",children:O.name}),o.jsx("span",{className:"line-clamp-1 text-xs text-[var(--muted-foreground)]",children:O.description})]})]},O.name))]})]})]}),o.jsxs(ca,{children:[o.jsx(ne,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),o.jsx(ne,{disabled:!P||q,onClick:()=>void M(),children:q?"Creating…":"Create"})]})]})})}function SU({id:e,onChange:t}){return o.jsxs(ki,{children:[o.jsx(wn,{asChild:!0,children:o.jsx(ne,{variant:"ghost",size:"sm",className:"text-[var(--destructive)]",children:o.jsx(lo,{})})}),o.jsxs(Xs,{children:[o.jsxs(Ei,{children:[o.jsxs(Zs,{children:['Delete Agent "',e,'"?']}),o.jsx(Qs,{children:"Removes its local config directory. Existing Session snapshots are unaffected."})]}),o.jsxs(Ri,{children:[o.jsx(Js,{children:"Cancel"}),o.jsx(Ni,{variant:"destructive",onClick:async()=>{try{await xe.deleteAgent(e),pe.success(`Agent "${e}" deleted`),await t()}catch(r){pe.error(`Delete failed: ${r.message}`)}},children:"Delete"})]})]})]})}function Wv({label:e,value:t,detail:r}){return o.jsxs(At,{className:"p-4",children:[o.jsx("div",{className:"label-caps text-[10px] text-[var(--muted-foreground)]",children:e}),o.jsx("div",{className:"mt-2 text-2xl font-semibold",children:t}),o.jsx("div",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:r})]})}function qv({label:e,value:t}){return o.jsxs("div",{className:"rounded-lg border border-[var(--border)] bg-[var(--muted)]/20 px-3 py-2",children:[o.jsx("div",{className:"label-caps text-[10px] text-[var(--muted-foreground)]",children:e}),o.jsx("div",{className:"mt-1 truncate text-sm",children:t})]})}function Oo({label:e,children:t}){return o.jsxs("div",{className:"grid gap-1.5",children:[o.jsx(Kr,{children:e}),t]})}function CU(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,64)}const kU=_R("inline-flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 text-xs font-medium",{variants:{variant:{default:"border-transparent bg-[var(--secondary)] text-[var(--secondary-foreground)]",success:"border-transparent bg-[var(--success)]/15 text-[var(--success)]",warning:"border-transparent bg-[var(--warning)]/15 text-[var(--warning)]",destructive:"border-transparent bg-[var(--destructive)]/15 text-[var(--destructive)]",outline:"text-[var(--muted-foreground)]"}},defaultVariants:{variant:"default"}});function Ot({className:e,variant:t,...r}){return o.jsx("span",{className:We(kU({variant:t}),e),...r})}async function PA(e,t){var r;if(typeof navigator<"u"&&((r=navigator.clipboard)!=null&&r.writeText))try{return await navigator.clipboard.writeText(e),"clipboard"}catch{}if(!t||typeof document>"u")return"unavailable";t.focus({preventScroll:!0}),t.select(),t.setSelectionRange(0,e.length);try{if(typeof document.execCommand=="function"&&document.execCommand("copy"))return"selection"}catch{}return"selected"}const XC="127.0.0.1:9333";function EU({embedded:e=!1}={}){const t=ol(),r=g.useRef(null),[s,n]=g.useState(null),[l,u]=g.useState(null),[d,m]=g.useState("load"),f=g.useCallback(async()=>{if(!t){m(null),u("Chrome inspection is available only in the Rynx app.");return}m("load"),u(null);try{n(await t.getChromeInspectionStatus())}catch(w){u(w.message)}finally{m(null)}},[t]);g.useEffect(()=>{f()},[f]);async function v(w){if(t){m("save"),u(null);try{n(await t.configureChromeInspection(w))}catch(C){const k=C.message;u(k),pe.error(`Could not update Chrome inspection: ${k}`)}finally{m(null)}}}async function p(){const w=await PA(XC,r.current);w==="clipboard"||w==="selection"?pe.success("Address copied"):w==="selected"?pe.info("Address selected — copy it manually"):pe.error("Copy is unavailable")}const x=s==null?void 0:s.settings,b=d!==null;return o.jsxs("div",{id:e?"chrome-inspection":void 0,className:e?"grid scroll-mt-6 gap-5":"grid max-w-3xl gap-5",children:[!e&&o.jsxs("div",{children:[o.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Chrome inspection"}),o.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"Inspect Rynx-managed browser pages with Chrome DevTools."})]}),o.jsxs(At,{"aria-busy":d!==null,children:[o.jsxs(Ys,{children:[o.jsxs("div",{className:"grid gap-1",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx(Ds,{children:"DevTools discovery"}),s&&o.jsx(RU,{status:s})]}),o.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Chrome connects to one local address and discovers the browsers you choose."})]}),o.jsxs(ne,{variant:"outline",size:"sm",disabled:b,onClick:()=>void f(),children:[o.jsx(_t,{className:d==="load"?"animate-spin":""}),"Check"]})]}),o.jsxs(Pr,{className:"grid gap-5",children:[s&&x?o.jsxs(o.Fragment,{children:[o.jsx(NU,{title:"Enable Chrome inspection",description:"Make the selected browser pages available to Chrome DevTools.",children:o.jsx(Sy,{"aria-label":"Enable Chrome inspection",checked:x.enabled,disabled:b,onCheckedChange:w=>void v({...x,enabled:w})})}),o.jsx("div",{className:"h-px bg-[var(--border)]"}),o.jsxs("div",{className:"grid gap-3",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium",children:"Browsers to include"}),o.jsx("p",{className:"mt-0.5 text-xs text-[var(--muted-foreground)]",children:"Only selected browser pages appear in Chrome."})]}),o.jsx(ZC,{title:"This device",detail:"Browser pages managed by Rynx on this device",checked:x.includeLocal,disabled:b||!x.enabled,onChange:w=>void v({...x,includeLocal:w})}),s.remotes.map(w=>o.jsx(ZC,{title:w.displayName,detail:AU(w.status),badge:w.status,checked:x.remoteDaemonIds.includes(w.daemonId),disabled:b||!x.enabled||w.status==="incompatible",onChange:C=>void v({...x,remoteDaemonIds:C?[...x.remoteDaemonIds,w.daemonId]:x.remoteDaemonIds.filter(k=>k!==w.daemonId)})},w.daemonId))]}),o.jsx("div",{className:"h-px bg-[var(--border)]"}),o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium",children:"Connect Chrome once"}),o.jsxs("p",{className:"mt-0.5 text-xs leading-5 text-[var(--muted-foreground)]",children:["Open ",o.jsx("span",{className:"font-mono",children:"chrome://inspect"}),", choose"," ",o.jsx("strong",{children:"Configure…"}),", then add this address."]})]}),o.jsxs("div",{className:"flex max-w-sm gap-2",children:[o.jsx(bt,{ref:r,value:XC,readOnly:!0,"aria-label":"Chrome inspection address",className:"font-mono"}),o.jsxs(ne,{variant:"outline",onClick:()=>void p(),"aria-label":"Copy Chrome inspection address",children:[o.jsx(C0,{}),"Copy"]})]})]}),s.runtime.state==="error"&&o.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--warning)_35%,var(--border))] bg-[color-mix(in_srgb,var(--warning)_8%,var(--background))] p-3 text-xs text-[var(--warning)]",children:[o.jsx(bi,{className:"mt-0.5 size-4 shrink-0"}),o.jsxs("div",{children:[o.jsx("div",{className:"font-medium",children:"Chrome inspection could not start"}),o.jsx("div",{className:"mt-0.5 text-[var(--foreground)]",children:s.runtime.error})]})]}),o.jsxs("div",{role:"note",className:"flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_30%,var(--border))] bg-[color-mix(in_srgb,var(--destructive)_6%,var(--background))] p-3 text-xs leading-5",children:[o.jsx(bi,{className:"mt-0.5 size-4 shrink-0 text-[var(--destructive)]"}),o.jsx("span",{children:"Any process on this device can use this address to fully control every browser exposed here. Enable it only while you need DevTools."})]})]}):o.jsxs("div",{className:"flex min-h-40 items-center justify-center gap-2 text-sm text-[var(--muted-foreground)]",children:[d==="load"&&o.jsx(ze,{className:"size-4 animate-spin"}),d==="load"?"Loading Chrome inspection…":"Chrome inspection settings are unavailable."]}),l&&o.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_35%,var(--border))] bg-[color-mix(in_srgb,var(--destructive)_7%,var(--background))] p-3 text-xs text-[var(--destructive)]",children:[o.jsx(bi,{className:"mt-0.5 size-4 shrink-0"}),o.jsx("span",{children:l})]})]})]})]})}function RU({status:e}){return e.runtime.state==="listening"?o.jsxs(Ot,{variant:"success",children:[o.jsx(Br,{className:"size-3"}),"Listening"]}):e.runtime.state==="error"?o.jsx(Ot,{variant:"warning",children:"Needs attention"}):o.jsx(Ot,{variant:"outline",children:"Off"})}function NU({title:e,description:t,children:r}){return o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium",children:e}),o.jsx("p",{className:"mt-0.5 text-xs text-[var(--muted-foreground)]",children:t})]}),r]})}function ZC({title:e,detail:t,badge:r,checked:s,disabled:n,onChange:l}){return o.jsxs("label",{className:We("flex items-center gap-3 rounded-lg border border-[var(--border)] px-3 py-2.5",n&&"opacity-55"),children:[o.jsx("input",{type:"checkbox",checked:s,disabled:n,onChange:u=>l(u.target.checked),className:"size-4 accent-[var(--primary)]"}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsxs("span",{className:"flex flex-wrap items-center gap-2 text-sm font-medium",children:[e,r&&o.jsx(Ot,{variant:r==="ready"?"success":r==="offline"?"warning":"outline",children:jU(r)})]}),o.jsx("span",{className:"block text-xs text-[var(--muted-foreground)]",children:t})]})]})}function jU(e){return e==="ready"?"Ready":e==="offline"?"Offline":"Incompatible"}function AU(e){return e==="ready"?"Available now":e==="offline"?"Currently unavailable":"Update this Runtime before selecting it"}function MU({embedded:e=!1}={}){const t=ol(),[r,s]=g.useState(null),[n,l]=g.useState(null),[u,d]=g.useState("refresh"),m=g.useCallback(async()=>{if(t){d("refresh"),l(null);try{s(await t.getStatus())}catch(v){l(v.message)}finally{d(null)}}},[t]);g.useEffect(()=>{m()},[m]);async function f(v){if(t){d("permission"),l(null);try{await t.openSystemSettings(v),pe.message("After granting access, return to Rynx and click Check again.")}catch(p){const x=p.message;l(x),pe.error(`Could not open System Settings: ${x}`)}finally{d(null)}}}return o.jsxs("div",{id:e?"permissions":void 0,className:e?"grid scroll-mt-6 gap-5":"grid max-w-3xl gap-5",children:[!e&&o.jsxs("div",{children:[o.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Computer integration"}),o.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"Review the macOS permissions for the separate Computer Use integration. Browser and Emulator automation stay in the bundled rynx-cli Skill."})]}),o.jsxs(At,{"aria-busy":u!==null,children:[o.jsxs(Ys,{children:[o.jsxs("div",{className:"grid gap-1",children:[o.jsx(Ds,{children:"macOS permissions"}),o.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"This page checks readiness only. Permissions remain under your control in System Settings."})]}),o.jsxs(ne,{variant:"outline",size:"sm",disabled:u!==null,onClick:()=>void m(),children:[o.jsx(_t,{className:u==="refresh"?"animate-spin":""}),"Check"]})]}),o.jsxs(Pr,{className:"grid gap-3",children:[r?o.jsxs(o.Fragment,{children:[o.jsx(QC,{icon:o.jsx(b6,{className:"size-4"}),ready:r.permissions.accessibility==="granted",title:"Accessibility",description:JC(r.permissions.accessibility,"Granted and ready for a Computer Use provider."),action:r.permissions.accessibility!=="granted"?o.jsxs(ne,{variant:"outline",size:"sm",disabled:u!==null,onClick:()=>void f("accessibility"),children:[o.jsx(B_,{}),"Open Settings"]}):void 0}),o.jsx(QC,{icon:o.jsx(VO,{className:"size-4"}),ready:r.permissions.screenRecording==="granted",title:"Screen Recording",description:JC(r.permissions.screenRecording,"Granted and ready for a Computer Use provider."),action:r.permissions.screenRecording!=="granted"?o.jsxs(ne,{variant:"outline",size:"sm",disabled:u!==null,onClick:()=>void f("screen-recording"),children:[o.jsx(B_,{}),"Open Settings"]}):void 0})]}):o.jsxs("div",{className:"flex min-h-40 items-center justify-center gap-2 text-sm text-[var(--muted-foreground)]",children:[u==="refresh"&&o.jsx(ze,{className:"size-4 animate-spin"}),u==="refresh"?"Checking integrations…":"Integration status is unavailable."]}),n&&o.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_35%,var(--border))] bg-[color-mix(in_srgb,var(--destructive)_7%,var(--background))] p-3 text-xs text-[var(--destructive)]",children:[o.jsx(_c,{className:"mt-0.5 size-4 shrink-0"}),o.jsx("span",{children:n})]})]})]})]})}function QC({icon:e,ready:t,title:r,description:s,action:n}){return o.jsxs("div",{className:"grid gap-3 rounded-lg border border-[var(--border)] p-4 sm:grid-cols-[auto_minmax(0,1fr)_auto] sm:items-center",children:[o.jsx("span",{className:t?"grid size-9 place-items-center rounded-lg bg-[var(--success)]/12 text-[var(--success)]":"grid size-9 place-items-center rounded-lg bg-[var(--warning)]/12 text-[var(--warning)]",children:t?o.jsx(Br,{className:"size-4"}):e}),o.jsxs("div",{className:"min-w-0",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("h2",{className:"text-sm font-medium",children:r}),o.jsx(Ot,{variant:t?"success":"warning",children:t?"Ready":"Needs access"})]}),o.jsx("p",{className:"mt-1 break-words text-xs leading-5 text-[var(--muted-foreground)]",children:s})]}),n&&o.jsx("div",{className:"sm:justify-self-end",children:n})]})}function JC(e,t){switch(e){case"granted":return t;case"not-granted":return"Not granted. Open System Settings to allow access.";case"unknown":return"Rynx could not determine this permission. Open System Settings to verify it."}}function TU(){return o.jsxs("div",{className:"grid max-w-3xl gap-6",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Computer Use"}),o.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"Configure macOS permissions and Chrome DevTools access for computer automation."})]}),o.jsx(MU,{embedded:!0}),o.jsx(EU,{embedded:!0})]})}const DU=700,LU=250,e2=33333,Af=new Uint8Array([0,0,0,1]);function OU(e,t){const r=new Uint8Array(e.length+t.length);return r.set(e,0),r.set(t,e.length),r}function Vv(e,t){for(let r=t;r<=e.length-3;r+=1)if(!(e[r]!==0||e[r+1]!==0)){if(e[r+2]===1)return{index:r,length:3};if(r<=e.length-4&&e[r+2]===0&&e[r+3]===1)return{index:r,length:4}}return null}function t2(e,t){const r=OU(e,t),s=Vv(r,0);if(!s)return{nals:[],pending:r.slice(Math.max(0,r.length-4))};const n=[];let l=s.index,u=s.index+s.length,d=Vv(r,u);for(;d;)d.index>u&&n.push(r.slice(u,d.index)),l=d.index,u=d.index+d.length,d=Vv(r,u);return{nals:n,pending:r.slice(l)}}function ep(e){return e[0]&31}function BU(e){if(ep(e)!==7||e.length<4)return null;const t=r=>r.toString(16).padStart(2,"0").toUpperCase();return`avc1.${t(e[1])}${t(e[2])}${t(e[3])}`}function PU(e){const t=e.reduce((n,l)=>n+Af.length+l.length,0),r=new Uint8Array(t);let s=0;for(const n of e)r.set(Af,s),s+=Af.length,r.set(n,s),s+=n.length;return r}function r2(e){const t=ep(e);return t===1||t===5}function IU(e){return e.some(t=>ep(t)===5)}function Gv(e,t,r,s){(e.width!==r||e.height!==s)&&(e.width=r,e.height=s);const n=e.getContext("2d");n&&n.drawImage(t,0,0,r,s)}function zU(e,t){return new Promise((r,s)=>{if(t.aborted){s(t.reason);return}const n=window.setTimeout(r,e);t.addEventListener("abort",()=>{window.clearTimeout(n),s(t.reason)},{once:!0})})}function s2(e){return e instanceof Error?e.message:String(e)}function $U(e){return e instanceof DOMException&&e.name==="AbortError"}function UU({device:e,alt:t,mediaRef:r,onFrameSize:s}){const n=g.useRef(null),l=g.useRef(!1),u=g.useRef(!1),d=g.useRef(null),[m,f]=g.useState("video"),[v,p]=g.useState(!1),[x,b]=g.useState("Loading preview..."),w=g.useCallback(S=>{n.current=S,r==null||r(S)},[r]),C=g.useCallback(()=>{l.current||(l.current=!0,p(!0),b(""))},[]),k=g.useCallback((S,E)=>{const N=d.current;(N==null?void 0:N.width)===S&&N.height===E||(d.current={width:S,height:E},s==null||s(S,E))},[s]);return g.useEffect(()=>{l.current=!1,u.current=!1,d.current=null,p(!1),b("Loading preview..."),f("video")},[e]),g.useEffect(()=>{if(m!=="video"||l.current)return;let S=!1;return(async()=>{try{const N=await xe.emulatorFrameBlob(e);if(S||l.current)return;const R=await createImageBitmap(N);try{const A=n.current;A&&!l.current&&(Gv(A,R,R.width,R.height),k(R.width,R.height),C())}finally{R.close()}}catch{}})(),()=>{S=!0}},[e,C,m,k]),g.useEffect(()=>{if(m!=="video")return;if(!("VideoDecoder"in window)||!("EncodedVideoChunk"in window)){b("Video decoder unavailable"),f("fallback");return}const S=new AbortController,E=R=>{const A=n.current;try{if(A){const D=R.displayWidth||R.codedWidth,B=R.displayHeight||R.codedHeight;Gv(A,R,D,B),k(D,B),u.current=!0,C()}}finally{R.close()}};return(async()=>{for(;!S.signal.aborted;){let R=null,A=null,D=new Uint8Array,B=[],$=!1,q=0,Y="avc1.42E01F";const V=async()=>{if(R)return R;const I={codec:Y,optimizeForLatency:!0,avc:{format:"annexb"}};if(!(await VideoDecoder.isConfigSupported(I)).supported)throw new Error(`Unsupported Android video codec: ${Y}`);return R=new VideoDecoder({output:E,error:M=>{b(M.message)}}),R.configure(I),R},U=async()=>{if(!$){B=[];return}const I=await V(),F=IU(B),M=PU(B),P=q;q+=e2,B=[],$=!1,!(I.decodeQueueSize>2&&!F)&&I.decode(new EncodedVideoChunk({type:F?"key":"delta",timestamp:P,duration:e2,data:M}))},L=async I=>{const F=BU(I);F&&(Y=F),(ep(I)===9||r2(I))&&$&&await U(),B.push(I),r2(I)&&($=!0)};try{const I=await fetch(xe.emulatorVideoStreamUrl(e),{cache:"no-store",signal:S.signal});if(!I.ok||!I.body)throw new Error(`Android video stream failed: ${I.status}`);for(A=I.body.getReader();;){const{done:M,value:P}=await A.read();if(M)break;const O=t2(D,P);D=O.pending;for(const W of O.nals)await L(W)}const F=t2(D,Af);for(const M of F.nals)await L(M);await U(),(R==null?void 0:R.state)==="configured"&&await R.flush()}catch(I){if(S.signal.aborted||$U(I))break;if(b(s2(I)),!u.current){f("fallback");break}}finally{try{A==null||A.releaseLock()}catch{}(R==null?void 0:R.state)!=="closed"&&(R==null||R.close())}S.signal.aborted||await zU(LU,S.signal).catch(()=>{})}})(),()=>{S.abort()}},[e,C,m,k]),g.useEffect(()=>{if(m!=="fallback")return;let S=!1,E;const N=async()=>{try{const R=await xe.emulatorFrameBlob(e);if(S)return;const A=await createImageBitmap(R);try{const D=n.current;D&&(Gv(D,A,A.width,A.height),k(A.width,A.height),C())}finally{A.close()}}catch(R){S||b(s2(R))}finally{S||(E=window.setTimeout(N,DU))}};return N(),()=>{S=!0,E&&window.clearTimeout(E)}},[e,C,m,k]),o.jsxs("div",{className:"relative h-full w-full",children:[o.jsx("canvas",{ref:w,"aria-label":t,width:720,height:1520,className:"pointer-events-none h-full w-full select-none object-contain"}),!v&&o.jsx("div",{className:"pointer-events-none absolute inset-0 grid place-items-center px-5 text-center text-sm text-zinc-400",children:x})]})}const i2=8,HU=.012,FU=1500,WU=35,qU=260,VU=40,GU=3,YU=5e3,KU=750;function n2(e){return[e.backend,e.isDefault?"default":void 0,e.detail].filter(Boolean).join(" · ")}function a2(e,t,r){return Math.max(t,Math.min(r,e))}function o2(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function XU(e){const t=e.getBoundingClientRect();if(t.width<=0||t.height<=0)return null;const r="naturalWidth"in e?e.naturalWidth||t.width:e.width||t.width,s="naturalHeight"in e?e.naturalHeight||t.height:e.height||t.height;if(r<=0||s<=0)return t;const n=r/s;if(t.width/t.height>n){const d=t.height*n;return new DOMRect(t.left+(t.width-d)/2,t.top,d,t.height)}const u=t.width/n;return new DOMRect(t.left,t.top+(t.height-u)/2,t.width,u)}function Yv(e,t,r){if(!e)return null;const s=XU(e);if(!s)return null;const n=(t.clientX-s.left)/s.width,l=(t.clientY-s.top)/s.height;return!r&&(n<0||n>1||l<0||l>1)?null:{x:a2(n,0,1),y:a2(l,0,1)}}function ZU(e){return new Promise(t=>setTimeout(t,e))}function QU(e){const t=new TextEncoder().encode(JSON.stringify(e)),r=new Uint8Array(1+t.length);return r[0]=GU,r.set(t,1),r.buffer}function JU(){const[e,t]=g.useState([]),[r,s]=g.useState(null),[n,l]=g.useState(!0),[u,d]=g.useState(null),[m,f]=g.useState(null),[v,p]=g.useState(!1),[x,b]=g.useState(null),[w,C]=g.useState(null),[k,S]=g.useState(!1),[E,N]=g.useState(0),R=g.useRef(null),A=g.useRef(null),D=g.useRef(null),B=g.useRef(null),$=g.useRef(null),q=g.useRef(null),Y=g.useCallback(async()=>{l(!0);try{const[te,re]=await Promise.all([xe.emulatorDevices(),xe.activeEmulator()]);t(te),s(re)}catch(te){pe.error(`Failed to load emulator: ${te.message}`)}finally{l(!1)}},[]);g.useEffect(()=>{Y()},[Y]),g.useEffect(()=>()=>{D.current!==null&&window.clearTimeout(D.current),A.current!==null&&window.clearTimeout(A.current)},[]),g.useEffect(()=>()=>{var re;const te=(re=B.current)==null?void 0:re.socket;B.current=null,te&&te.readyState!==WebSocket.CLOSED&&te.close()},[r==null?void 0:r.wsUrl]),g.useEffect(()=>{var te;if((r==null?void 0:r.backend)!=="android"){const re=(te=$.current)==null?void 0:te.socket;$.current=null,re&&re.readyState!==WebSocket.CLOSED&&re.close();return}return oe(r.deviceUdid).catch(()=>{}),()=>{var Ce;const re=(Ce=$.current)==null?void 0:Ce.socket;$.current=null,re&&re.readyState!==WebSocket.CLOSED&&re.close()}},[r==null?void 0:r.backend,r==null?void 0:r.deviceUdid]);const V=(r==null?void 0:r.streamUrl)??null,U=V&&E>0?`${V}${V.includes("?")?"&":"?"}rynx_preview_retry=${E}`:V,L=(r==null?void 0:r.backend)==="android"&&!r.streamUrl,I=!!(V||L),F=w===null?void 0:{aspectRatio:w,width:`min(100%, calc(100cqh * ${w}))`},M=g.useCallback((te,re)=>{if(!Number.isFinite(te)||!Number.isFinite(re)||te<=0||re<=0)return;const Ce=te/re;C(De=>De!==null&&Math.abs(De-Ce)<1e-4?De:Ce)},[]),P=g.useCallback(()=>{A.current!==null&&(window.clearTimeout(A.current),A.current=null)},[]),O=g.useCallback((te,re)=>{P(),M(te,re),S(!0)},[P,M]),W=g.useCallback(()=>{S(!1),A.current===null&&(A.current=window.setTimeout(()=>{A.current=null,N(te=>te+1)},KU))},[]);g.useEffect(()=>{if(P(),C(null),S(!1),N(0),!V)return;const te=()=>{const Ce=R.current;Ce instanceof HTMLImageElement&&Ce.naturalWidth>0&&Ce.naturalHeight>0&&O(Ce.naturalWidth,Ce.naturalHeight)};te();const re=window.setInterval(te,500);return()=>window.clearInterval(re)},[P,r==null?void 0:r.attachedAt,r==null?void 0:r.deviceUdid,O,V]),g.useEffect(()=>{if(!V||k)return;const te=window.setTimeout(W,YU);return()=>window.clearTimeout(te)},[E,k,V,W]);async function H(te){if(r){b("home");try{await xe.buttonEmulator(te,r.deviceUdid)}catch(re){pe.error(`${te==="appswitch"?"App switcher":"Home"} failed: ${re.message}`)}finally{b(null)}}}function T(){if(!(!r||x)){if(D.current!==null){window.clearTimeout(D.current),D.current=null,H("appswitch");return}D.current=window.setTimeout(()=>{D.current=null,H("home")},qU)}}async function G(te,re){const Ce=(r==null?void 0:r.deviceUdid)===te;D.current!==null&&(window.clearTimeout(D.current),D.current=null),f(te),Ce&&b("shutdown");try{await xe.shutdownEmulator(te),Ce&&s(null),pe.success(`Shutdown ${re}`),Y()}catch(De){pe.error(`Shutdown failed: ${De.message}`)}finally{f(null),Ce&&b(null)}}async function X(te){d(te.id);try{const re=await xe.attachEmulator(te.id);s(re),pe.success(`Attached ${re.deviceName??re.deviceUdid}`),Y()}catch(re){pe.error(`Attach failed: ${re.message}`)}finally{d(null)}}function ee(te){var _e;const re=B.current;if((re==null?void 0:re.url)===te){if(((_e=re.socket)==null?void 0:_e.readyState)===WebSocket.OPEN)return Promise.resolve(re.socket);if(re.connecting)return re.connecting}else re!=null&&re.socket&&re.socket.readyState!==WebSocket.CLOSED&&re.socket.close();const Ce={url:te,socket:null,connecting:null},De=new Promise((Re,Pe)=>{const Ue=new WebSocket(te),qe=window.setTimeout(()=>{Ue.close(),Pe(new Error("Timed out connecting to emulator gesture stream."))},1500),Ie=()=>window.clearTimeout(qe);Ue.binaryType="arraybuffer",Ue.addEventListener("open",()=>{Ie(),Ce.socket=Ue,Ce.connecting=null,Re(Ue)},{once:!0}),Ue.addEventListener("error",()=>{Ie(),Ce.connecting=null,Pe(new Error("Failed to connect to emulator gesture stream."))},{once:!0}),Ue.addEventListener("close",()=>{var Ve;((Ve=B.current)==null?void 0:Ve.socket)===Ue&&(B.current=null)})});return Ce.connecting=De,B.current=Ce,De}function oe(te){var _e;const re=$.current;if((re==null?void 0:re.device)===te){if(((_e=re.socket)==null?void 0:_e.readyState)===WebSocket.OPEN)return Promise.resolve(re.socket);if(re.connecting)return re.connecting}else re!=null&&re.socket&&re.socket.readyState!==WebSocket.CLOSED&&re.socket.close();const Ce={device:te,socket:null,connecting:null},De=new Promise((Re,Pe)=>{const Ue=new WebSocket(P9(te));let qe=!1;const Ie=window.setTimeout(()=>{qe||(qe=!0,Ue.close(),Pe(new Error("Timed out connecting to Android touch stream.")))},FU),Ve=()=>window.clearTimeout(Ie);Ue.addEventListener("message",ct=>{if(!qe&&typeof ct.data=="string")try{const Qr=JSON.parse(ct.data);Qr.t==="opened"?(qe=!0,Ve(),Ce.socket=Ue,Ce.connecting=null,Re(Ue)):Qr.t==="error"&&(qe=!0,Ve(),Ce.connecting=null,Pe(new Error(Qr.message??"Android touch stream failed.")))}catch{}}),Ue.addEventListener("error",()=>{qe||(qe=!0,Ve(),Ce.connecting=null,Pe(new Error("Failed to connect to Android touch stream.")))},{once:!0}),Ue.addEventListener("close",()=>{var ct;Ve(),Ce.connecting=null,qe||(qe=!0,Pe(new Error("Android touch stream closed before it was ready."))),((ct=$.current)==null?void 0:ct.socket)===Ue&&($.current=null)})});return Ce.connecting=De,$.current=Ce,De}async function de(te,re){if(te.backend==="android"){if(te.liveFailed)return!1;try{return(await oe(te.device)).send(JSON.stringify(re)),te.sentLiveFrames+=1,!0}catch(Ce){return te.liveFailed=!0,te.sentLiveFrames>0&&pe.error(`Android touch stream failed: ${Ce.message}`),!1}}if(!te.wsUrl||te.liveFailed)return!1;try{return(await ee(te.wsUrl)).send(QU(re)),te.sentLiveFrames+=1,!0}catch(Ce){return te.liveFailed=!0,te.sentLiveFrames>0&&pe.error(`Gesture stream failed: ${Ce.message}`),!1}}function Z(te,re){xe.gestureEmulator([{type:"begin",x:te.x,y:te.y}],re).catch(Ce=>{pe.error(`Tap failed: ${Ce.message}`)})}function ce(te,re){xe.gestureEmulator(te,re).catch(Ce=>{pe.error(`Gesture failed: ${Ce.message}`)})}function le(te){if(!r||!I||!te.isPrimary||te.pointerType==="mouse"&&te.button!==0)return;const re=Yv(R.current,te,!1);re&&(te.preventDefault(),te.currentTarget.setPointerCapture(te.pointerId),q.current={backend:r.backend,pointerId:te.pointerId,device:r.deviceUdid,wsUrl:r.backend==="ios"?r.wsUrl:void 0,startClientX:te.clientX,startClientY:te.clientY,lastPoint:re,moved:!1,liveFailed:!1,sentLiveFrames:0,points:[{type:"begin",x:re.x,y:re.y}]},de(q.current,{type:"begin",x:re.x,y:re.y}),p(!0))}function be(te){const re=q.current;if(!re||re.pointerId!==te.pointerId)return;const Ce=Yv(R.current,te,!0);if(!Ce)return;te.preventDefault();const De=Math.hypot(te.clientX-re.startClientX,te.clientY-re.startClientY)>i2,_e=o2(Ce,re.lastPoint)>HU;if(re.lastPoint=Ce,De&&(_e||!re.moved)){re.moved=!0;const Re={type:"move",x:Ce.x,y:Ce.y};re.points.push(Re),de(re,Re)}}async function ke(te){const re=q.current;if(!re||re.pointerId!==te.pointerId)return;te.preventDefault();const Ce=Yv(R.current,te,!0)??re.lastPoint,De=Math.hypot(te.clientX-re.startClientX,te.clientY-re.startClientY)>i2;q.current=null,p(!1);try{te.currentTarget.releasePointerCapture(te.pointerId)}catch{}const _e={type:"end",x:Ce.x,y:Ce.y};if((re.backend==="android"||re.wsUrl)&&!re.liveFailed&&(!re.moved&&!De&&await ZU(re.backend==="android"?WU:VU),await de(re,_e)||re.sentLiveFrames>0))return;if(!re.moved&&!De){Z(Ce,re.device);return}const Re=[...re.points],Pe=Re[Re.length-1];Pe&&o2(Pe,Ce)<=.001?Re[Re.length-1]=_e:Re.push(_e),ce(Re,re.device)}function Ee(te){const re=q.current;!re||re.pointerId!==te.pointerId||(q.current=null,p(!1),(re.backend==="android"||re.wsUrl)&&!re.liveFailed&&de(re,{type:"end",x:re.lastPoint.x,y:re.lastPoint.y}))}return o.jsxs("div",{className:"grid h-full min-h-0 gap-3 p-3 sm:p-4 lg:grid-cols-[minmax(0,360px)_minmax(360px,1fr)]",children:[o.jsxs(At,{className:"flex h-full min-h-0 flex-col overflow-hidden p-0",children:[o.jsxs(Ys,{className:"px-4 py-3",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsxs(Ds,{className:"flex items-center gap-2",children:[o.jsx(uE,{className:"size-4"}),"Preview"]}),o.jsx("div",{className:"label-caps mt-1 truncate text-[10px] text-[var(--muted-foreground)]",children:r?`This device · ${r.backend} · ${r.deviceName??r.deviceUdid}`:"This device · not attached"})]}),o.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[o.jsx(ne,{variant:"outline",size:"icon",className:"size-8",onClick:T,disabled:!r||x!==null,"aria-label":"Home or app switcher",title:"Home · double-click for app switcher",children:o.jsx(lE,{className:We(x==="home"&&"animate-pulse")})}),o.jsx(ne,{variant:"outline",size:"icon",className:"size-8",onClick:()=>{r&&G(r.deviceUdid,r.deviceName??r.deviceUdid)},disabled:!r||x!==null||m!==null,"aria-label":"Shutdown emulator",title:"Shutdown",children:o.jsx(I_,{className:We(x==="shutdown"&&"animate-pulse")})}),o.jsx(ne,{variant:"outline",size:"icon",className:"size-8",onClick:()=>void Y(),disabled:n,"aria-label":"Refresh emulator",title:"Refresh",children:o.jsx(_t,{className:We(n&&"animate-spin")})})]})]}),o.jsxs(Pr,{className:"relative grid min-h-0 flex-1 place-items-center p-2 sm:p-3",style:{containerType:"size"},"aria-busy":I&&!k,children:[I?o.jsx("div",{className:We("relative grid touch-none select-none place-items-center overflow-hidden bg-black",k?"max-h-full max-w-full rounded-md border border-[var(--border)] shadow-sm":"pointer-events-none absolute inset-0",k&&(v?"cursor-grabbing":"cursor-crosshair")),style:k?F:void 0,onPointerDown:le,onPointerMove:be,onPointerUp:ke,onPointerCancel:Ee,children:V?o.jsx("img",{ref:te=>{R.current=te},src:U??void 0,alt:(r==null?void 0:r.deviceName)??(r==null?void 0:r.deviceUdid),className:"pointer-events-none absolute inset-0 h-full w-full select-none object-contain",onLoad:te=>{O(te.currentTarget.naturalWidth,te.currentTarget.naturalHeight)},onError:W,draggable:!1},`${r==null?void 0:r.deviceUdid}:${r==null?void 0:r.attachedAt}:${E}`):r&&L?o.jsx(UU,{device:r.deviceUdid,alt:r.deviceName??r.deviceUdid,mediaRef:te=>{R.current=te},onFrameSize:O},r.deviceUdid):null}):o.jsx("div",{className:"grid h-full w-full place-items-center px-6 text-center text-sm text-[var(--muted-foreground)]",children:r?`${r.backend} preview unavailable`:"No active emulator"}),I&&!k&&o.jsx("div",{className:"pointer-events-none absolute inset-0 z-10 grid place-items-center bg-[var(--background)] text-[var(--muted-foreground)]",role:"status","aria-live":"polite",children:o.jsxs("div",{className:"grid place-items-center gap-2 text-xs",children:[o.jsx(_t,{className:"size-4 animate-spin text-[var(--primary)]"}),o.jsx("span",{children:"Loading preview…"})]})})]})]}),o.jsxs(At,{className:"flex h-full min-h-0 flex-col overflow-hidden p-0",children:[o.jsxs(Ys,{children:[o.jsxs(Ds,{className:"flex items-center gap-2",children:[o.jsx(uc,{className:"size-4"}),"Devices"]}),o.jsx("div",{className:"label-caps text-[10px] text-[var(--muted-foreground)]",children:e.length})]}),o.jsx(Pr,{className:"min-h-0 flex-1 p-0",children:e.length===0?o.jsx("div",{className:"px-5 py-8 text-sm text-[var(--muted-foreground)]",children:n?"Loading...":"No devices"}):o.jsx(xn,{className:"h-full min-h-0",children:o.jsx("ul",{className:"grid grid-cols-1 content-start gap-2 p-3 sm:grid-cols-2 2xl:grid-cols-3",children:e.map(te=>{const re=(r==null?void 0:r.deviceUdid)===te.id,Ce=u===te.id,De=m===te.id;return o.jsxs("li",{className:"flex min-w-0 items-center gap-2 rounded-md border border-[var(--border)] bg-[var(--background)] px-3 py-2.5",children:[o.jsx(uc,{className:"size-4 shrink-0 text-[var(--muted-foreground)]"}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[o.jsx("div",{className:"truncate text-sm font-medium",children:te.name}),o.jsxs(Ot,{variant:te.state==="booted"?"success":te.state==="shutdown"?"outline":"warning",className:"h-5 shrink-0 gap-1 px-2 py-0 font-mono text-[9px] uppercase",children:[o.jsx("span",{className:"size-1.5 rounded-full bg-current","aria-hidden":"true"}),te.state]})]}),o.jsx("div",{className:"mt-1 truncate font-mono text-[10px] uppercase text-[var(--muted-foreground)]",title:n2(te),children:n2(te)})]}),o.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[o.jsx(ne,{size:"xs",variant:re?"outline":"default",onClick:()=>void X(te),disabled:Ce||m!==null,children:Ce?"Attaching…":re?"Reattach":"Attach"}),te.state==="booted"&&o.jsx(ne,{size:"icon-xs",variant:"destructive",onClick:()=>void G(te.id,te.name),disabled:u!==null||m!==null,"aria-label":`Shutdown ${te.name}`,title:`Shutdown ${te.name}`,children:o.jsx(I_,{className:We(De&&"animate-pulse")})})]})]},`${te.backend}:${te.id}`)})})})})]})]})}function eH({embedded:e=!1}={}){const t=ol(),[r,s]=g.useState(null),[n,l]=g.useState(null),[u,d]=g.useState(!1),m=g.useCallback(async()=>{if(t){d(!0),l(null);try{s(await t.getStatus())}catch(p){l(p.message)}finally{d(!1)}}},[t]);g.useEffect(()=>{m()},[m]);async function f(p){if(!(!t||p===(r==null?void 0:r.runtime.lifecycleMode))){d(!0),l(null);try{s(await t.setDaemonLifecycleMode(p)),pe.success(p==="resident"?"Runtime will stay available after Rynx quits":"Runtime will now follow the Rynx app lifecycle")}catch(x){const b=x.message;l(b),pe.error(`Could not change Runtime mode: ${b}`)}finally{d(!1)}}}async function v(){if(t){d(!0),l(null);try{s(await t.restartDaemon()),pe.success("Local Runtime restarted")}catch(p){const x=p.message;l(x),pe.error(`Could not restart Runtime: ${x}`)}finally{d(!1)}}}return o.jsxs("div",{id:e?"runtime":void 0,className:e?"grid scroll-mt-6 gap-5":"grid max-w-3xl gap-5",children:[!e&&o.jsxs("div",{children:[o.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Daemon"}),o.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"Choose whether the local Runtime follows the Desktop app or stays available in the background."})]}),o.jsxs(At,{"aria-busy":u,children:[o.jsxs(Ys,{children:[o.jsxs("div",{className:"grid gap-1",children:[o.jsx(Ds,{children:"Runtime lifecycle"}),o.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"This setting applies to the Runtime bundled with Rynx."})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(ne,{variant:"outline",size:"sm",disabled:u,onClick:()=>void m(),children:[o.jsx(_t,{className:u?"animate-spin":""}),"Check"]}),o.jsxs(ne,{variant:"outline",size:"sm",disabled:u,onClick:()=>void v(),children:[o.jsx(_t,{}),"Restart"]})]})]}),o.jsxs(Pr,{className:"grid gap-5",children:[r?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-[var(--border)] p-4",children:[o.jsx("span",{className:r.runtime.ready?"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--success)]/12 text-[var(--success)]":"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--warning)]/12 text-[var(--warning)]",children:o.jsx(km,{className:"size-5"})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("div",{className:"text-sm font-medium",children:"Runtime status"}),o.jsx(Ot,{variant:r.runtime.ready?"success":"warning",children:tH(r.runtime.state)}),o.jsx(Ot,{variant:"outline",children:r.runtime.managedBy==="app"?"Managed by app":r.runtime.managedBy==="external"?"External":"Not managed"})]}),o.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:r.runtime.detail??rH(r)})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(Kr,{htmlFor:"daemon-lifecycle-mode",children:"Lifecycle"}),o.jsxs(VN,{id:"daemon-lifecycle-mode",value:r.runtime.lifecycleMode,disabled:u,className:"max-w-sm",onChange:p=>void f(p.target.value),children:[o.jsx("option",{value:"follow-app",children:"Follow Rynx app"}),o.jsx("option",{value:"resident",children:"Stay available in background"})]}),o.jsx("p",{className:"max-w-2xl text-xs leading-5 text-[var(--muted-foreground)]",children:r.runtime.lifecycleMode==="follow-app"?"The Runtime and its embedded Browser Host start with Rynx and stop when the app fully quits. Closing a window does not quit the app.":"The Runtime and its embedded Browser Host keep running when the app quits, so Terminals, agents, and Session browsers remain available."})]})]}):o.jsxs("div",{className:"flex min-h-32 items-center justify-center gap-2 text-sm text-[var(--muted-foreground)]",children:[u&&o.jsx(ze,{className:"size-4 animate-spin"}),u?"Checking Runtime…":"Runtime status is unavailable."]}),n&&o.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_35%,var(--border))] bg-[color-mix(in_srgb,var(--destructive)_7%,var(--background))] p-3 text-xs text-[var(--destructive)]",children:[o.jsx(_c,{className:"mt-0.5 size-4 shrink-0"}),o.jsx("span",{children:n})]})]})]})]})}function tH(e){switch(e){case"starting":return"Starting";case"running":return"Running";case"stopped":return"Stopped";case"busy":return"Busy";case"error":return"Error"}}function rH(e){const t=[e.runtime.version?`Version ${e.runtime.version}`:null,e.runtime.pid?`PID ${e.runtime.pid}`:null].filter(Boolean);return t.length>0?t.join(" · "):"No additional Runtime details."}function sH({embedded:e=!1}={}){const t=ol(),[r,s]=g.useState(null),[n,l]=g.useState(null),[u,d]=g.useState("refresh"),m=g.useCallback(async(C=!1)=>{if(t){d("refresh"),l(null);try{s(await t.getStatus(C))}catch(k){l(k.message)}finally{d(null)}}},[t]);g.useEffect(()=>{m()},[m]);async function f(C){if(t){d("install"),l(null);try{s(await t.installCli(C)),pe.success("Terminal command installed")}catch(k){const S=k.message;l(S),pe.error(`Could not install the Terminal command: ${S}`);try{s(await t.getStatus(!0))}catch{}}finally{d(null)}}}async function v(C){if(t){d("remove"),l(null);try{s(await t.removeCli(C)),pe.success("Terminal command removed")}catch(k){const S=k.message;l(S),pe.error(`Could not remove the Terminal command: ${S}`);try{s(await t.getStatus(!0))}catch{}}finally{d(null)}}}const p=r==null?void 0:r.globalCli,x=(p==null?void 0:p.state)==="installed",b=(p==null?void 0:p.state)==="development",w=(p==null?void 0:p.state)==="installed"&&p.canInstall&&!!(p.path&&p.target&&p.path!==p.target);return o.jsxs("div",{id:e?"terminal-command":void 0,className:e?"grid scroll-mt-6 gap-5":"grid max-w-3xl gap-5",children:[!e&&o.jsxs("div",{children:[o.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Terminal command"}),o.jsxs("p",{className:"text-sm text-[var(--muted-foreground)]",children:["Install or remove the ",o.jsx("code",{className:"font-mono",children:"rynx"})," command used in Terminal."]})]}),o.jsxs(At,{"aria-busy":u!==null,children:[o.jsxs(Ys,{children:[o.jsxs("div",{className:"grid gap-1",children:[o.jsx(Ds,{children:"Shell access"}),o.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Removing the command does not uninstall Rynx or delete its data."})]}),o.jsxs(ne,{variant:"outline",size:"sm",disabled:u!==null,onClick:()=>void m(!0),children:[o.jsx(_t,{className:u==="refresh"?"animate-spin":""}),"Check"]})]}),o.jsxs(Pr,{className:"grid gap-3",children:[p?o.jsxs("div",{className:"grid gap-4 rounded-lg border border-[var(--border)] p-4 sm:grid-cols-[auto_minmax(0,1fr)_auto] sm:items-center",children:[o.jsx("span",{className:x?"grid size-10 place-items-center rounded-lg bg-[var(--success)]/12 text-[var(--success)]":b?"grid size-10 place-items-center rounded-lg bg-[var(--muted)] text-[var(--muted-foreground)]":"grid size-10 place-items-center rounded-lg bg-[var(--warning)]/12 text-[var(--warning)]",children:x?o.jsx(Br,{className:"size-5"}):o.jsx(S0,{className:"size-5"})}),o.jsxs("div",{className:"min-w-0",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("h2",{className:"font-mono text-sm font-medium",children:"rynx"}),o.jsx(Ot,{variant:x?"success":b?"outline":"warning",children:iH(p.state)})]}),o.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:nH(p)}),p.path&&o.jsx("code",{className:"mt-1 block break-all font-mono text-[11px] text-[var(--muted-foreground)]",children:p.path}),w&&p.target&&o.jsxs("p",{className:"mt-1 break-all text-[11px] text-[var(--muted-foreground)]",children:["Recommended: ",o.jsx("code",{className:"font-mono",children:p.target})]})]}),o.jsxs("div",{className:"flex flex-wrap gap-2 sm:justify-self-end",children:[p.canInstall&&o.jsxs(ne,{variant:"outline",size:"sm",disabled:u!==null,onClick:()=>p.path&&void f(p.path),children:[u==="install"&&o.jsx(ze,{className:"animate-spin"}),w?"Move command":p.state==="stale"?"Repair command":"Install command"]}),p.canRemove&&o.jsxs(ki,{children:[o.jsx(wn,{asChild:!0,children:o.jsxs(ne,{variant:"outline",size:"sm",disabled:u!==null,children:[o.jsx(lo,{}),"Remove command"]})}),o.jsxs(Xs,{children:[o.jsxs(Ei,{children:[o.jsx(Zs,{children:"Remove the Terminal command?"}),o.jsx(Qs,{children:"This removes only the shell command link that points to this Rynx app. The app, Runtime, settings, and workspace data remain installed."})]}),o.jsxs(Ri,{children:[o.jsx(Js,{children:"Cancel"}),o.jsx(Ni,{variant:"destructive",onClick:()=>p.path&&void v(p.path),children:"Remove command"})]})]})]})]})]}):o.jsxs("div",{className:"flex min-h-32 items-center justify-center gap-2 text-sm text-[var(--muted-foreground)]",children:[u==="refresh"&&o.jsx(ze,{className:"size-4 animate-spin"}),u==="refresh"?"Checking command…":"Command status is unavailable."]}),n&&o.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_35%,var(--border))] bg-[color-mix(in_srgb,var(--destructive)_7%,var(--background))] p-3 text-xs text-[var(--destructive)]",children:[o.jsx(_c,{className:"mt-0.5 size-4 shrink-0"}),o.jsx("span",{children:n})]})]})]})]})}function iH(e){switch(e){case"installed":return"Installed";case"missing":return"Not installed";case"stale":return"Needs repair";case"foreign":return"Managed externally";case"development":return"Development build";case"unwritable":case"error":return"Unavailable"}}function nH(e){switch(e.state){case"installed":return e.canInstall?"The command is ready. You can move it to the recommended location.":"The command is ready to use from Terminal.";case"missing":return"Install the command to use Rynx from Terminal.";case"stale":return"Update the command registration to use this Rynx app.";case"foreign":return"Another program owns the active command. Rynx will not replace or remove it.";case"development":return"Global Terminal command registration is disabled in development builds. Install a packaged Rynx app to manage the rynx command.";case"unwritable":return"Rynx could not find a supported location for the command.";case"error":return"Rynx could not check the command."}}function aH(){return o.jsxs("div",{className:"grid max-w-3xl gap-6",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Local Runtime"}),o.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"Manage the Runtime bundled with Rynx and its Terminal command."})]}),o.jsx(eH,{embedded:!0}),o.jsx(sH,{embedded:!0})]})}function oH(){const{status:e,operation:t,error:r,checkForUpdates:s,installUpdate:n}=Ey(),l=t!==null||(e==null?void 0:e.phase)==="checking"||(e==null?void 0:e.phase)==="downloading"||(e==null?void 0:e.phase)==="installing",u=r??(e==null?void 0:e.error);async function d(){const m=await s();m&&(m.error?pe.error(`Could not check for updates: ${m.error}`):m.phase==="idle"?pe.success(`${m.appName} is up to date`):m.availableVersion&&pe.message(`Rynx ${m.availableVersion} is available`))}return o.jsxs(At,{id:"software-update",className:"scroll-mt-6","aria-busy":l,children:[o.jsxs(Ys,{children:[o.jsxs("div",{className:"grid gap-1",children:[o.jsx(Ds,{children:"Software update"}),o.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Review the installed Desktop version and check GitHub Releases for updates."})]}),o.jsxs(ne,{variant:"outline",size:"sm",disabled:l||!(e!=null&&e.supported),onClick:()=>void d(),children:[o.jsx(_t,{className:t==="check"||(e==null?void 0:e.phase)==="checking"?"animate-spin":""}),"Check for updates"]})]}),o.jsxs(Pr,{className:"grid gap-4",children:[e?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-[var(--border)] p-4",children:[o.jsx("span",{className:cH(e),children:o.jsx(lH,{status:e})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("div",{className:"text-sm font-medium",children:e.appName}),o.jsxs(Ot,{variant:"outline",children:["Version ",e.currentVersion]}),o.jsx(Ot,{variant:e.channel==="preview"?"warning":"default",children:dH(e.channel)})]}),o.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:uH(e)}),e.lastCheckedAt&&o.jsxs("p",{className:"mt-1 text-[10px] text-[var(--muted-foreground)]",children:["Last checked ",hH(e.lastCheckedAt)]})]}),e.phase==="ready"&&o.jsxs(ne,{size:"sm",disabled:t==="install",onClick:()=>void n(),children:[t==="install"?o.jsx(ze,{className:"animate-spin"}):o.jsx(qu,{}),"Restart to update"]})]}),!e.supported&&o.jsx("div",{className:"rounded-lg border border-[var(--border)] bg-[var(--muted)]/30 p-3 text-xs leading-5 text-[var(--muted-foreground)]",children:"Automatic updates are available in signed release builds. Local development builds display their version here but do not contact the release feed."})]}):o.jsxs("div",{className:"flex min-h-32 items-center justify-center gap-2 text-sm text-[var(--muted-foreground)]",children:[o.jsx(ze,{className:"size-4 animate-spin"}),"Loading version information…"]}),u&&o.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_35%,var(--border))] bg-[color-mix(in_srgb,var(--destructive)_7%,var(--background))] p-3 text-xs text-[var(--destructive)]",children:[o.jsx(_c,{className:"mt-0.5 size-4 shrink-0"}),o.jsx("span",{children:u})]})]})]})}function lH({status:e}){return e.phase==="checking"||e.phase==="installing"?o.jsx(ze,{className:"size-5 animate-spin"}):e.phase==="downloading"?o.jsx(pd,{className:"size-5"}):e.phase==="ready"?o.jsx(qu,{className:"size-5"}):o.jsx(w0,{className:"size-5"})}function cH(e){return e.phase==="downloading"||e.phase==="ready"||e.phase==="installing"?"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--primary)]/12 text-[var(--primary)]":"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--success)]/12 text-[var(--success)]"}function uH(e){if(!e.supported)return"This local build does not check for automatic updates.";switch(e.phase){case"disabled":return"Automatic updates are disabled for this build.";case"idle":return e.error?"The last update check did not complete.":e.lastCheckedAt?"This version is up to date.":"Ready to check for updates.";case"checking":return"Checking GitHub Releases for a newer version…";case"downloading":return`Rynx ${e.availableVersion??""} is downloading in the background.`;case"ready":return`Rynx ${e.availableVersion??""} is ready. Restart to finish the update.`;case"installing":return"Preparing the Runtime and restarting Rynx safely…"}}function dH(e){switch(e){case"local":return"Local build";case"preview":return"Preview channel";case"stable":return"Stable channel"}}function hH(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(t)}function fH({plugins:e,agents:t,desktopIntegrationAvailable:r}){const s=ao(),n=d=>s(vt[d]),l=e.filter(d=>d.enabled).length,u=e.filter(d=>d.runtimeState==="running").length;return o.jsxs("div",{className:"grid gap-5",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Overview"}),o.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"Plugins own integrations and their settings; agents define task behavior."})]}),o.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[o.jsx(l2,{icon:Cm,label:"Plugins",value:e.length,sub:`${l} enabled · ${u} healthy`,onClick:()=>n("plugins")}),o.jsx(l2,{icon:Sm,label:"Agents",value:t.length,sub:t.length===1?"1 defined":`${t.length} defined`,onClick:()=>n("agents")})]}),o.jsxs(At,{children:[o.jsxs(Ys,{children:[o.jsx(Ds,{children:"Plugins"}),o.jsx(ne,{variant:"outline",size:"sm",onClick:()=>n("plugins"),children:"Manage"})]}),o.jsx(Pr,{className:"p-0",children:e.length===0?o.jsxs("div",{className:"px-5 py-10 text-center text-sm text-[var(--muted-foreground)]",children:["No plugins installed. Add one from a Market or a Git repository with the Rynx CLI.",o.jsx("div",{className:"mt-3",children:o.jsx(ne,{size:"sm",onClick:()=>n("plugins"),children:"View plugins"})})]}):o.jsx("ul",{className:"divide-y divide-[var(--border)]",children:e.map(d=>o.jsxs("li",{className:"flex items-center justify-between gap-3 px-5 py-3",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("div",{className:"truncate text-sm font-medium",children:d.pluginId}),o.jsxs("div",{className:"label-caps text-[10px] text-[var(--muted-foreground)]",children:[d.id," · v",d.version]})]}),o.jsx("span",{className:"rounded-full border border-[var(--border)] px-2 py-0.5 font-mono text-[10px] text-[var(--muted-foreground)]",children:d.enabled?d.runtimeState:"disabled"})]},d.id))})})]}),r&&o.jsx(oH,{})]})}function l2({icon:e,label:t,value:r,sub:s,onClick:n}){return o.jsx(At,{children:o.jsxs("button",{onClick:n,className:"flex w-full items-start gap-4 rounded-xl p-5 text-left transition-colors hover:bg-[var(--muted)]/40",children:[o.jsx("span",{className:"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:o.jsx(e,{className:"size-5"})}),o.jsxs("div",{children:[o.jsx("div",{className:"text-3xl font-semibold leading-none tabular-nums",children:r}),o.jsx("div",{className:"label-caps mt-1.5 text-[11px] text-[var(--muted-foreground)]",children:t}),o.jsx("div",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:s})]})]})})}function IA({description:e="You're about to visit an external website. Review the complete destination before continuing.",onConfirm:t,onOpenChange:r,open:s,url:n}){const[l,u]=g.useState(!1);g.useEffect(()=>{s||u(!1)},[s]);const d=async()=>{try{await navigator.clipboard.writeText(n),u(!0)}catch{}};return o.jsx(ki,{open:s,onOpenChange:r,children:o.jsxs(Xs,{className:"sm:max-w-xl",children:[o.jsxs(Ei,{children:[o.jsx(yR,{children:o.jsx(B_,{})}),o.jsx(Zs,{children:"Open external link?"}),o.jsx(Qs,{children:e})]}),o.jsxs("div",{className:"relative",children:[o.jsx("code",{className:"block max-h-48 overflow-auto whitespace-pre-wrap break-all rounded-lg border border-[var(--border)] bg-[var(--muted)]/40 py-3 pr-11 pl-3 font-mono text-xs leading-relaxed text-[var(--foreground)]",children:n}),o.jsx(ne,{type:"button",variant:"ghost",size:"icon-sm",className:"absolute top-2 right-2","aria-label":l?"Link copied":"Copy link",title:l?"Link copied":"Copy link",onClick:()=>void d(),children:l?o.jsx(Br,{}):o.jsx(C0,{})})]}),o.jsxs(Ri,{children:[o.jsx(Js,{children:"Cancel"}),o.jsx(Ni,{onClick:t,children:"Open link"})]})]})})}function mH(e){const t=pH(e)?e.url:void 0;if(typeof t!="string"||!t.trim())throw new Error("external URL is required");let r;try{r=new URL(t)}catch{throw new Error("external URL is invalid")}if(r.protocol!=="https:")throw new Error("only HTTPS links may be opened");if(r.username||r.password)throw new Error("external URLs must not contain credentials");return r.href}function pH(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const zA=1024*1024,gH=16,vH=3e4,_H=2e3,xH=/^[A-Za-z][A-Za-z0-9._:-]{0,127}$/;function yH({plugins:e,theme:t,onChange:r}){const[s,n]=g.useState(),[l,u]=g.useState(),[d,m]=g.useState("discover"),[f,v]=g.useState(null),[p,x]=g.useState(),[b,w]=g.useState(!0),[C,k]=g.useState(!1),[S,E]=g.useState(),[N,R]=g.useState(),[A,D]=g.useState(),[B,$]=g.useState(!1),q=g.useRef(0),Y=g.useRef(!1),V=g.useRef(!1),U=e.find(T=>T.id===s),L=g.useCallback(async()=>{const T=++q.current;w(!0);try{const G=await xe.listPluginMarketplaces();if(T!==q.current)return!0;const X=Y.current;return Y.current=!1,v(G),x(void 0),X&&r(),!0}catch(G){return T!==q.current?!0:(Y.current=!0,x(G.message),!1)}finally{T===q.current&&w(!1)}},[r]);g.useEffect(()=>{let T=!1,G;const X=async()=>{!await L()&&!T&&(G=window.setTimeout(()=>void X(),_H))};return X(),()=>{T=!0,G!==void 0&&window.clearTimeout(G),q.current+=1}},[L]),g.useEffect(()=>{s&&!U&&n(void 0)},[U,s]);const I=async T=>{u(T.id);try{await xe.setPluginEnabled(T.id,!T.enabled),await r()}catch(G){pe.error(`Failed to ${T.enabled?"disable":"enable"} plugin: ${G.message}`)}finally{u(void 0)}},F=async T=>{R(T);try{D(await xe.preparePluginInstallation({operation:"install",marketplacePlugin:T}))}catch(G){pe.error(`Could not prepare ${T}: ${G.message}`)}finally{R(void 0)}},M=async T=>{R(T);try{const G=await xe.preparePluginInstallation({operation:"update",pluginId:T});if(G.unchanged){await xe.cancelPluginInstallation(G.token).catch(()=>!1),pe.info(`${T} is already up to date.`);return}D(G)}catch(G){pe.error(`Could not prepare update for ${T}: ${G.message}`)}finally{R(void 0)}},P=()=>{const T=A;D(void 0),T&&xe.cancelPluginInstallation(T.token).catch(()=>!1)},O=async()=>{if(!A)return;const T=!!A.existing;$(!0);try{const G=await xe.commitPluginInstallation(A.token,{overwrite:!!A.existing,expectedDigest:A.artifact.digest});D(void 0),pe.success(`${T?"Updated":"Installed"} ${G.plugin.id} v${G.plugin.version}.`+(T?" No Rynx restart required.":"")),await r(),m("installed")}catch(G){D(void 0),pe.error(`${T?"Update":"Installation"} failed: ${G.message}`)}finally{$(!1)}},W=async T=>{if(!V.current){V.current=!0,E(T.id);try{await xe.refreshPluginMarketplace(T.id),await Promise.all([L(),r()]),pe.success(`Refreshed ${T.id}`)}catch(G){pe.error(`Market refresh failed: ${G.message}`)}finally{V.current=!1,E(void 0)}}},H=async T=>{if(!V.current){V.current=!0,E(T.id);try{await xe.removePluginMarketplace(T.id),await L(),pe.success(`Removed ${T.id}`)}catch(G){pe.error(`Market removal failed: ${G.message}`)}finally{V.current=!1,E(void 0)}}};return U!=null&&U.hasSettingsUi?o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[o.jsxs(ne,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>n(void 0),children:[o.jsx(Yo,{}),"Plugins"]}),o.jsxs("div",{className:"min-w-0",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsxs("h1",{className:"text-xl font-semibold tracking-tight",children:[U.pluginId," settings"]}),o.jsx(UA,{plugin:U})]}),o.jsxs("div",{className:"truncate font-mono text-[10px] text-[var(--muted-foreground)]",children:["Sandboxed plugin UI · ",U.id," · v",U.version]})]})]}),o.jsx(At,{className:"overflow-hidden",children:o.jsx(Pr,{className:"p-0",children:o.jsx(RH,{plugin:U,theme:t,onChange:r})})})]}):o.jsxs("div",{className:"grid gap-5",children:[o.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Plugins"}),o.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"Discover plugins from trusted Markets, then review their source and executable entries before installation."})]}),o.jsxs(ne,{size:"sm",className:"shrink-0",onClick:()=>k(!0),children:[o.jsx(ls,{}),"Add Market"]})]}),o.jsxs(C9,{value:d,onValueChange:m,children:[o.jsxs(yA,{"aria-label":"Plugin management views",children:[o.jsxs(Rf,{value:"discover",className:"gap-1.5 leading-none",children:["Discover",o.jsx("span",{className:"text-xs font-normal leading-none tabular-nums",children:(f==null?void 0:f.reduce((T,G)=>T+G.plugins.length,0))??0})]}),o.jsxs(Rf,{value:"installed",className:"gap-1.5 leading-none",children:["Installed",o.jsx("span",{className:"text-xs font-normal leading-none tabular-nums",children:e.length})]}),o.jsxs(Rf,{value:"markets",className:"gap-1.5 leading-none",children:["Markets",o.jsx("span",{className:"text-xs font-normal leading-none tabular-nums",children:(f==null?void 0:f.length)??0})]})]}),o.jsx(Nf,{value:"discover",children:f===null&&p?o.jsx(c2,{error:p,retrying:b,onRetry:()=>void L()}):o.jsx(bH,{markets:f,installed:e,preparingId:N,onAddMarket:()=>k(!0),onInstall:T=>void F(T)})}),o.jsx(Nf,{value:"installed",children:o.jsx(wH,{plugins:e,mutatingId:l,preparingId:N,onBrowse:()=>m("discover"),onConfigure:n,onUpdate:T=>void M(T),onChangeEnabled:T=>void I(T)})}),o.jsx(Nf,{value:"markets",children:f===null&&p?o.jsx(c2,{error:p,retrying:b,onRetry:()=>void L()}):o.jsx(SH,{markets:f,mutatingId:S,onAdd:()=>k(!0),onRefresh:T=>void W(T),onRemove:T=>void H(T)})})]}),o.jsx(CH,{open:C,onOpenChange:k,onAdded:async T=>{await L(),m("discover"),pe.success(`Added ${T.id}`)}}),o.jsx(kH,{preparation:A,committing:B,onCancel:P,onCommit:()=>void O()})]})}function bH({markets:e,installed:t,preparingId:r,onAddMarket:s,onInstall:n}){const[l,u]=g.useState(""),d=new Set(t.map(p=>p.id)),m=(e??[]).flatMap(p=>p.plugins.map(x=>({id:`${x.id}@${p.id}`,pluginId:x.id,market:p}))),f=l.trim().toLowerCase(),v=f?m.filter(({id:p})=>p.includes(f)):m;return e===null?o.jsx($A,{label:"Loading plugin catalogs…"}):e.length===0?o.jsx(Ry,{icon:Yf,title:"Add a Market to discover plugins",description:"A Market is a Git or local catalog. Adding it downloads metadata only and never installs plugin code.",action:o.jsxs(ne,{size:"sm",onClick:s,children:[o.jsx(ls,{})," Add Market"]})}):o.jsxs(At,{children:[o.jsxs(Ys,{className:"flex-col items-stretch gap-3 sm:flex-row sm:items-center",children:[o.jsxs("div",{className:"grid gap-1",children:[o.jsx(Ds,{children:"Available plugins"}),o.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Catalog entries stay inert until you review and install one."})]}),o.jsxs("div",{className:"relative w-full sm:w-64",children:[o.jsx(fE,{className:"pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-[var(--muted-foreground)]"}),o.jsx(bt,{"aria-label":"Search available plugins",className:"pl-8",value:l,placeholder:"Search plugins or Markets",onChange:p=>u(p.target.value)})]})]}),o.jsx(Pr,{className:"p-0",children:v.length===0?o.jsxs("div",{className:"px-5 py-10 text-center text-sm text-[var(--muted-foreground)]",children:["No catalog entries match “",l.trim(),"”."]}):o.jsx("div",{className:"divide-y divide-[var(--border)]",children:v.map(({id:p,pluginId:x,market:b})=>{const w=d.has(p),C=r===p;return o.jsxs("article",{className:"flex flex-col gap-3 px-5 py-4 transition-colors hover:bg-[var(--muted)]/35 sm:flex-row sm:items-center",children:[o.jsx("span",{className:"grid size-9 shrink-0 place-items-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:o.jsx(Cm,{className:"size-4"})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("strong",{className:"text-sm",children:x}),o.jsx(Ot,{variant:"outline",className:"font-mono",children:b.id})]}),o.jsx("div",{className:"mt-1 truncate font-mono text-[10px] text-[var(--muted-foreground)]",children:p})]}),o.jsx(ne,{size:"sm",variant:w?"outline":"default",disabled:w||!!r,onClick:()=>n(p),children:w?o.jsxs(o.Fragment,{children:[o.jsx(Br,{})," Installed"]}):C?o.jsxs(o.Fragment,{children:[o.jsx(ze,{className:"animate-spin"})," Preparing…"]}):o.jsxs(o.Fragment,{children:[o.jsx(pd,{})," Install"]})})]},p)})})})]})}function wH({plugins:e,mutatingId:t,preparingId:r,onBrowse:s,onConfigure:n,onUpdate:l,onChangeEnabled:u}){return e.length===0?o.jsx(Ry,{icon:tC,title:"No plugins installed",description:"Browse your registered Markets and review a plugin before installing it.",action:o.jsxs(ne,{size:"sm",onClick:s,children:[o.jsx(tC,{})," Browse plugins"]})}):o.jsx("div",{className:"grid gap-3",children:e.map(d=>o.jsx(At,{children:o.jsxs(Pr,{className:"flex flex-col gap-4 sm:flex-row sm:items-center",children:[o.jsx("span",{className:"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:o.jsx(Cm,{className:"size-5"})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("strong",{className:"text-sm",children:d.pluginId}),o.jsx(UA,{plugin:d}),o.jsx(Ot,{variant:"outline",children:d.marketplaceId})]}),o.jsxs("div",{className:"mt-1 truncate font-mono text-[10px] text-[var(--muted-foreground)]",children:["v",d.version]}),d.runtimeError&&o.jsxs("div",{className:"mt-2 flex items-start gap-1.5 text-xs text-[var(--danger)]",children:[o.jsx(bi,{className:"mt-0.5 size-3.5 shrink-0"}),d.runtimeError]})]}),o.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[d.hasSettingsUi&&o.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>n(d.id),children:[o.jsx(E6,{}),"Configure"]}),d.updateState!=="current"&&o.jsxs(ne,{variant:"outline",size:"sm",disabled:!!r||t!==void 0,onClick:()=>l(d.id),children:[o.jsx(_t,{className:r===d.id?"animate-spin":""}),r===d.id?"Checking…":d.updateState==="available"?"Update":"Check for updates"]}),o.jsx(Sy,{"aria-label":`${d.enabled?"Disable":"Enable"} ${d.pluginId}`,checked:d.enabled,disabled:t===d.id,onCheckedChange:()=>u(d)})]})]})},d.id))})}function SH({markets:e,mutatingId:t,onAdd:r,onRefresh:s,onRemove:n}){return e===null?o.jsx($A,{label:"Loading Markets…"}):e.length===0?o.jsx(Ry,{icon:Yf,title:"No Markets registered",description:"Add a trusted Git repository or local catalog to make its plugins discoverable.",action:o.jsxs(ne,{size:"sm",onClick:r,children:[o.jsx(ls,{})," Add Market"]})}):o.jsxs(At,{children:[o.jsxs(Ys,{children:[o.jsxs("div",{className:"grid gap-1",children:[o.jsx(Ds,{children:"Registered Markets"}),o.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Built-in Markets update with Rynx. User-added Markets can be refreshed independently."})]}),o.jsxs(ne,{size:"sm",variant:"outline",onClick:r,children:[o.jsx(ls,{})," Add Market"]})]}),o.jsx(Pr,{className:"p-0",children:o.jsx("div",{className:"divide-y divide-[var(--border)]",children:e.map(l=>o.jsxs("article",{className:"flex flex-col gap-3 px-5 py-4 sm:flex-row sm:items-center",children:[o.jsx("span",{className:"grid size-9 shrink-0 place-items-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:o.jsx(Yf,{className:"size-4"})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("strong",{className:"font-mono text-sm",children:l.id}),o.jsx(Ot,{variant:"outline",children:l.builtIn?"Built-in":l.source}),o.jsxs(Ot,{variant:"default",children:[l.plugins.length," plugins"]})]}),o.jsx("div",{className:"mt-1 truncate font-mono text-[10px] text-[var(--muted-foreground)]",children:l.builtIn?`Managed by Rynx · updated ${new Date(l.refreshedAt).toLocaleString()}`:`${l.id} · ${EH(l.resolvedRevision)} · refreshed ${new Date(l.refreshedAt).toLocaleString()}`})]}),!l.builtIn&&o.jsxs("div",{className:"flex shrink-0 gap-2",children:[o.jsxs(ne,{size:"sm",variant:"outline",disabled:t!==void 0,onClick:()=>s(l),children:[o.jsx(_t,{className:t===l.id?"animate-spin":""}),"Refresh"]}),o.jsxs(ki,{children:[o.jsx(wn,{asChild:!0,children:o.jsx(ne,{size:"icon-sm",variant:"ghost",disabled:t!==void 0,"aria-label":`Remove ${l.id}`,children:o.jsx(lo,{})})}),o.jsxs(Xs,{children:[o.jsxs(Ei,{children:[o.jsx(Zs,{children:"Remove this Market?"}),o.jsxs(Qs,{children:[l.id," will disappear from Discover. A Market with installed plugins cannot be removed until those plugins are uninstalled."]})]}),o.jsxs(Ri,{children:[o.jsx(Js,{children:"Cancel"}),o.jsx(Ni,{variant:"destructive",onClick:()=>n(l),children:"Remove Market"})]})]})]})]})]},l.id))})})]})}function CH({open:e,onOpenChange:t,onAdded:r}){const[s,n]=g.useState(""),[l,u]=g.useState(!1),d=()=>{n(""),t(!1)},m=async()=>{if(s.trim()){u(!0);try{const f=await xe.addPluginMarketplace({source:s.trim()});d(),await r(f)}catch(f){pe.error(`Could not add Market: ${f.message}`)}finally{u(!1)}}};return o.jsx(oa,{open:e,onOpenChange:f=>{l||(f?t(!0):d())},children:o.jsxs(Sn,{className:"sm:max-w-lg",showCloseButton:!l,children:[o.jsxs(la,{children:[o.jsx(Cn,{children:"Add a Market"}),o.jsxs(sl,{children:["Register a Git repository or local directory containing"," ",o.jsx("code",{children:".rynx-plugin/marketplace.json"}),". This reads the catalog only."]})]}),o.jsx("div",{className:"grid gap-4",children:o.jsxs("div",{className:"grid gap-1.5",children:[o.jsx(Kr,{htmlFor:"market-source",children:"Source"}),o.jsx(bt,{id:"market-source",autoFocus:!0,value:s,placeholder:"owner/repo or https://github.com/owner/repo",onChange:f=>n(f.target.value)}),o.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"GitHub shorthand, a credential-free Git URL, or an absolute local path."})]})}),o.jsxs(ca,{children:[o.jsx(ne,{variant:"outline",disabled:l,onClick:d,children:"Cancel"}),o.jsxs(ne,{disabled:l||!s.trim(),onClick:()=>void m(),children:[l?o.jsx(ze,{className:"animate-spin"}):o.jsx(Yf,{}),l?"Adding…":"Add Market"]})]})]})})}function kH({preparation:e,committing:t,onCancel:r,onCommit:s}){const n=e==null?void 0:e.artifact;return o.jsx(oa,{open:!!e,onOpenChange:l=>{!l&&!t&&r()},children:o.jsx(Sn,{className:"max-h-[calc(100dvh-2rem)] grid-rows-[auto_minmax(0,1fr)_auto] gap-0 overflow-hidden p-0 sm:max-w-2xl",children:e&&n&&o.jsxs(o.Fragment,{children:[o.jsxs(la,{className:"px-5 pb-4 pr-12 pt-5",children:[o.jsxs(Cn,{children:["Review ",e.existing?"plugin update":"plugin installation"]}),o.jsx(sl,{children:"Rynx inspected an immutable package snapshot. Confirm its source and executable entries before the active installation changes."})]}),o.jsx(xn,{className:"min-h-0",children:o.jsxs("div",{className:"grid gap-3 px-5 pb-5",children:[o.jsxs("div",{className:"grid gap-3 rounded-lg border border-[var(--border)] bg-[var(--muted)]/25 p-4",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("strong",{children:n.pluginId}),o.jsx(Ot,{variant:"outline",children:n.marketplaceId}),o.jsxs(Ot,{variant:"default",children:["v",n.version]})]}),o.jsx("div",{className:"font-mono text-[10px] text-[var(--muted-foreground)]",children:n.id}),o.jsx("div",{className:"break-all font-mono text-[10px] leading-relaxed text-[var(--muted-foreground)]",children:n.digest}),o.jsxs("dl",{className:"grid gap-2 border-t border-[var(--border)] pt-3 text-xs",children:[o.jsx(Ia,{label:"Source",children:n.resolvedSource.type==="git"?n.resolvedSource.repository:"Local directory (path hidden)"}),o.jsx(Ia,{label:"Subdirectory",children:n.resolvedSource.subdirectory}),n.resolvedSource.type==="git"&&o.jsx(Ia,{label:"Commit",children:n.resolvedSource.commit})]}),(n.runtimeEntry||n.settingsBackgroundEntry||n.commandsEntry||n.settingsUiEntry||n.skillDirectory)&&o.jsxs("div",{className:"grid gap-2 border-t border-[var(--border)] pt-3",children:[o.jsx("div",{className:"text-xs font-medium",children:"Included components"}),o.jsxs("dl",{className:"grid gap-2 text-xs",children:[n.runtimeEntry&&o.jsx(Ia,{label:n.runtimeEntry.type==="module"?"Runtime module":"Runtime process",children:n.runtimeEntry.type==="module"?n.runtimeEntry.entry:[n.runtimeEntry.command,...n.runtimeEntry.args].join(" ")}),n.commandsEntry&&o.jsx(Ia,{label:"Commands",children:n.commandsEntry}),n.settingsUiEntry&&o.jsx(Ia,{label:"Settings UI",children:n.settingsUiEntry}),n.settingsBackgroundEntry&&o.jsx(Ia,{label:n.settingsBackgroundEntry.type==="module"?"Settings background":"Settings process",children:n.settingsBackgroundEntry.type==="module"?n.settingsBackgroundEntry.entry:[n.settingsBackgroundEntry.command,...n.settingsBackgroundEntry.args].join(" ")}),n.skillDirectory&&o.jsx(Ia,{label:"Skills",children:n.skillDirectory})]})]})]}),e.existing&&o.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-[var(--warning)]/35 bg-[var(--warning)]/10 p-3 text-xs",children:[o.jsx(bi,{className:"mt-0.5 size-4 shrink-0 text-[var(--warning)]"}),"This replaces ",e.existing.id," v",e.existing.version,". Its enabled state and plugin-owned data are retained."]})]})}),o.jsxs(ca,{className:"mx-0 mb-0 rounded-none rounded-b-xl px-5 py-3",children:[o.jsx(ne,{variant:"outline",disabled:t,onClick:r,children:"Cancel"}),o.jsxs(ne,{disabled:t,onClick:s,children:[t?o.jsx(ze,{className:"animate-spin"}):e.existing?o.jsx(_t,{}):o.jsx(pd,{}),t?e.existing?"Updating…":"Installing…":e.existing?"Update plugin":"Install plugin"]})]})]})})})}function Ia({label:e,children:t}){return o.jsxs("div",{className:"grid gap-0.5 sm:grid-cols-[7rem_minmax(0,1fr)] sm:gap-3",children:[o.jsx("dt",{className:"text-[var(--muted-foreground)]",children:e}),o.jsx("dd",{className:"min-w-0",children:o.jsx("code",{className:"break-all text-[11px]",children:t})})]})}function Ry({icon:e,title:t,description:r,action:s}){return o.jsx(At,{children:o.jsxs(Pr,{className:"grid justify-items-center gap-3 py-12 text-center",children:[o.jsx("span",{className:"grid size-11 place-items-center rounded-xl bg-[var(--primary)]/10 text-[var(--primary)]",children:o.jsx(e,{className:"size-5"})}),o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium",children:t}),o.jsx("p",{className:"mt-1 max-w-md text-xs text-[var(--muted-foreground)]",children:r})]}),s]})})}function $A({label:e}){return o.jsx(At,{children:o.jsxs(Pr,{className:"flex items-center justify-center gap-2 py-12 text-sm text-[var(--muted-foreground)]",children:[o.jsx(ze,{className:"size-4 animate-spin"}),e]})})}function c2({error:e,retrying:t,onRetry:r}){return o.jsx(At,{role:"alert",children:o.jsxs(Pr,{className:"grid justify-items-center gap-3 py-12 text-center",children:[o.jsx("span",{className:"grid size-11 place-items-center rounded-xl bg-[var(--danger)]/10 text-[var(--danger)]",children:o.jsx(bi,{className:"size-5"})}),o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium",children:"Rynx Runtime is unavailable"}),o.jsx("p",{className:"mt-1 max-w-md text-xs text-[var(--muted-foreground)]",children:"Plugin catalogs could not be loaded. Rynx will retry automatically."}),o.jsx("p",{className:"mt-2 max-w-md break-all font-mono text-[10px] text-[var(--danger)]",children:e})]}),o.jsxs(ne,{size:"sm",variant:"outline",disabled:t,onClick:r,children:[o.jsx(_t,{className:t?"animate-spin":""}),t?"Retrying…":"Retry now"]})]})})}function EH(e){return e==="local"||e.length<=12?e:e.slice(0,12)}function UA({plugin:e}){if(!e.enabled)return null;const t=e.runtimeState,r=t==="absent"?"Unavailable":t.charAt(0).toUpperCase()+t.slice(1);return o.jsx("span",{className:We("rounded-full border border-[var(--border)] px-2 py-0.5 font-mono text-[10px]",t==="running"&&"text-[var(--success)]",(t==="failed"||t==="degraded")&&"text-[var(--danger)]",(t==="stopped"||t==="absent")&&"text-[var(--muted-foreground)]"),children:r})}function RH({plugin:e,theme:t,onChange:r}){const s=g.useRef(null),n=g.useRef(()=>{}),l=g.useRef(null),u=g.useRef(void 0),d=g.useRef(void 0),[m,f]=g.useState(),[v,p]=g.useState(),[x,b]=g.useState(),w=g.useCallback((S,E)=>{const N=mH(S);return d.current?Promise.reject(new Error("another external link confirmation is already open")):new Promise((R,A)=>{let D=!1,B;const $=()=>{E.removeEventListener("abort",q),d.current===B&&(d.current=void 0,b(void 0))},q=()=>{D||(D=!0,$(),A(new Error("external link request was cancelled")))};B={url:N,settle(Y){D||(D=!0,$(),Y&&window.open(N,"_blank","noopener,noreferrer"),R({opened:Y}))}},d.current=B,b(B),E.aborted?q():E.addEventListener("abort",q,{once:!0})})},[]);g.useEffect(()=>{const S=new AbortController;return n.current(),u.current=void 0,f(void 0),p(void 0),xe.pluginSettingsUi(e.id,S.signal).then(f).catch(E=>{S.signal.aborted||p(E.message)}),()=>{S.abort(),n.current()}},[e.id,e.updatedAt]),g.useEffect(()=>{var S;(S=l.current)==null||S.postMessage(NH(t))},[t]);const C=g.useCallback(()=>{var B;if(n.current(),!m||!((B=s.current)!=null&&B.contentWindow))return;const S=new MessageChannel,E=new Set,N=new Set;let R=!0,A=0;const D=$=>{if(!R)return;const q=MH($);S.port1.postMessage(q)};S.port1.onmessage=$=>{const q=AH($.data);if(!q.ok){D({id:q.id,error:q.error});return}if(N.has(q.id)){D({id:q.id,error:"duplicate request id"});return}if(A>=gH){D({id:q.id,error:"too many requests in flight"});return}N.add(q.id),A+=1;const Y=new AbortController;E.add(Y);const V=window.setTimeout(()=>Y.abort(),vH);jH(e.id,m.generation,w,q.method,q.params,Y.signal).then(U=>{D({id:q.id,result:U}),q.method!=="host.openExternal"&&r()}).catch(U=>{D({id:q.id,error:Y.signal.aborted?"request timed out":U.message})}).finally(()=>{window.clearTimeout(V),E.delete(Y),N.delete(q.id),A-=1})},S.port1.onmessageerror=()=>{D({id:null,error:"invalid plugin UI message"})},S.port1.start(),l.current=S.port1,s.current.contentWindow.postMessage({type:"rynx-plugin-connect",pluginId:e.id,appearance:{colorScheme:t}},"*",[S.port2]),n.current=()=>{if(R){R=!1;for(const $ of E)$.abort();E.clear(),N.clear(),l.current===S.port1&&(l.current=null),S.port1.close(),S.port2.close()}}},[m,r,e.id,w,t]),k=g.useCallback(()=>{if(m){if(u.current===m.generation){n.current();return}u.current=m.generation,C()}},[C,m]);return v?o.jsx("div",{className:"p-5 text-sm text-[var(--danger)]",children:v}):m?o.jsxs(o.Fragment,{children:[o.jsx("iframe",{ref:s,title:`${e.pluginId} settings`,className:"h-[calc(100dvh-10rem)] min-h-[28rem] max-h-[64rem] w-full border-0 bg-[var(--background)]",sandbox:"allow-scripts",referrerPolicy:"no-referrer",srcDoc:m.html,onLoad:k}),o.jsx(IA,{open:!!x,url:(x==null?void 0:x.url)??"",onOpenChange:S=>{S||x==null||x.settle(!1)},description:o.jsxs(o.Fragment,{children:["The ",e.pluginId," plugin wants to open this address in a new browser tab. Review the complete destination before continuing."]}),onConfirm:()=>x==null?void 0:x.settle(!0)})]}):o.jsx("div",{className:"p-5 text-sm text-[var(--muted-foreground)]",children:"Loading plugin UI…"})}function NH(e){return{type:"rynx-host-appearance",appearance:{colorScheme:e}}}async function jH(e,t,r,s,n,l){if(s==="host.openExternal")return r(n,l);if(s.startsWith("host."))throw new Error(`unknown Rynx host settings method "${s}"`);return xe.pluginSettingsCall(e,t,s,n,l)}function AH(e){let t;try{t=HA(e)}catch{return{ok:!1,id:null,error:"request is not serializable"}}if(t>zA)return{ok:!1,id:null,error:"request exceeds 1 MiB"};if(typeof e!="object"||e===null||Array.isArray(e))return{ok:!1,id:null,error:"request must be an object"};const r=e,s=typeof r.id=="string"||typeof r.id=="number"&&Number.isSafeInteger(r.id)?r.id:null;return s===null||typeof r.method!="string"||!xH.test(r.method)?{ok:!1,id:s,error:"request id or method is invalid"}:{ok:!0,id:s,method:r.method,params:r.params}}function MH(e){try{return HA(e)<=zA?e:{id:u2(e),error:"response exceeds 1 MiB"}}catch{return{id:u2(e),error:"response is not serializable"}}}function HA(e){return new TextEncoder().encode(JSON.stringify(e)).byteLength}function u2(e){if(typeof e!="object"||e===null)return null;const t=e.id;return typeof t=="string"||typeof t=="number"?t:null}function FA(e){const t=[...new Set(e.directories.map(s=>s.trim()).filter(Boolean))],r=e.primary.trim();return{name:e.name.trim()||TH(r),directories:t,primary:r}}function TH(e){const t=e.trim().replace(/[\\/]+$/,"");if(!t||/^[A-Za-z]:$/.test(t))return"";const r=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return t.slice(r+1)}const DH={name:"",directories:[],primary:""},om="local";function LH(){const e=Xr(),[t,r]=g.useState([]),[s,n]=g.useState(!0),[l,u]=g.useState(),[d,m]=g.useState(()=>{var p;return((p=e.state)==null?void 0:p.createProject)===!0?"new":null}),f=g.useRef(0);async function v(p=!1){const x=++f.current;p&&n(!0);try{const b=await xe.listProjects(om);if(x!==f.current)return;r(b),u(void 0)}catch(b){if(x!==f.current)return;r([]),u(`Could not load projects: ${b.message}`)}finally{x===f.current&&n(!1)}}return g.useEffect(()=>(r([]),u(void 0),n(!0),v(),()=>{f.current+=1}),[]),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs(At,{children:[o.jsxs(Ys,{className:"flex-wrap",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsxs(Ds,{children:["Projects"," ",o.jsx("span",{className:"ml-1 text-[var(--muted-foreground)]",children:t.length})]}),o.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:"Reusable source directories stored on This device."})]}),o.jsx("div",{className:"flex min-w-0 flex-1 items-center justify-end gap-2 sm:flex-none",children:o.jsxs(ne,{size:"sm",onClick:()=>m("new"),children:[o.jsx(ls,{})," New project"]})})]}),o.jsx(Pr,{className:"p-0",children:s?o.jsxs("div",{className:"flex min-h-36 items-center justify-center gap-2 text-sm text-[var(--muted-foreground)]",role:"status",children:[o.jsx(ze,{className:"size-4 animate-spin"})," Loading projects…"]}):l?o.jsxs("div",{className:"grid min-h-36 place-items-center gap-3 px-5 py-8 text-center",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"Projects are unavailable"}),o.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:l})]}),o.jsx(ne,{variant:"outline",size:"sm",onClick:()=>void v(!0),children:"Retry"})]}):t.length===0?o.jsx("div",{className:"grid min-h-44 place-items-center px-5 py-8 text-center",children:o.jsxs("div",{className:"max-w-sm",children:[o.jsx("span",{className:"mx-auto flex size-10 items-center justify-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:o.jsx(P_,{className:"size-5"})}),o.jsx("p",{className:"mt-3 text-sm font-medium",children:"No projects on this device"}),o.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:"Save one or more directories so a new Session can start in the same workspace."}),o.jsxs(ne,{className:"mt-4",size:"sm",onClick:()=>m("new"),children:[o.jsx(ls,{})," New project"]})]})}):o.jsx("ul",{className:"divide-y divide-[var(--border)]",children:t.map(p=>o.jsx(OH,{project:p,onEdit:()=>m(p),onDeleted:()=>void v()},p.id))})})]}),o.jsx(BH,{open:d!==null,project:d==="new"?void 0:d??void 0,onOpenChange:p=>{p||m(null)},onSaved:async()=>{m(null),await v()}},d==="new"?"new":(d==null?void 0:d.id)??"closed")]})}function OH({project:e,onEdit:t,onDeleted:r}){const[s,n]=g.useState(!1);async function l(){n(!0);try{await xe.deleteProject(om,e.id),pe.success(`Project "${e.name}" removed`),r()}catch(u){pe.error(`Delete failed: ${u.message}`)}finally{n(!1)}}return o.jsxs("li",{className:"grid gap-3 px-5 py-4 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-center",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(qf,{className:"size-4 shrink-0 text-[var(--primary)]","aria-hidden":"true"}),o.jsx("span",{className:"truncate text-sm font-medium",children:e.name}),o.jsxs("span",{className:"rounded-md bg-[var(--muted)] px-1.5 py-0.5 font-mono text-[9px] text-[var(--muted-foreground)]",children:[e.directories.length," ",e.directories.length===1?"folder":"folders"]})]}),o.jsxs("div",{className:"mt-1.5 flex min-w-0 items-center gap-1.5 pl-6 font-mono text-[10px] text-[var(--muted-foreground)]",children:[o.jsx(vE,{className:"size-3 shrink-0","aria-hidden":"true"}),o.jsx("span",{className:"truncate",title:e.primary,children:e.primary})]})]}),o.jsxs("div",{className:"flex justify-end gap-1.5",children:[o.jsxs(ne,{variant:"ghost",size:"sm",onClick:t,children:[o.jsx(hE,{})," Edit"]}),o.jsxs(ki,{children:[o.jsx(wn,{asChild:!0,children:o.jsx(ne,{variant:"ghost",size:"icon-sm",className:"text-[var(--destructive)]","aria-label":`Delete ${e.name}`,disabled:s,children:s?o.jsx(ze,{className:"animate-spin"}):o.jsx(lo,{})})}),o.jsxs(Xs,{children:[o.jsxs(Ei,{children:[o.jsxs(Zs,{children:["Remove project “",e.name,"”?"]}),o.jsx(Qs,{children:"This removes only the saved project. It does not delete any directories or affect existing Sessions."})]}),o.jsxs(Ri,{children:[o.jsx(Js,{children:"Cancel"}),o.jsx(Ni,{variant:"destructive",onClick:()=>void l(),children:"Remove project"})]})]})]})]})]})}function BH({open:e,project:t,onOpenChange:r,onSaved:s}){const n=ol(),l=!!(n!=null&&n.chooseDirectory),[u,d]=g.useState(()=>t?{name:t.name,directories:[...t.directories],primary:t.primary}:{...DH}),[m,f]=g.useState(!1),[v,p]=g.useState(!1),x=g.useMemo(()=>PH(u),[u]);function b(){d(E=>({...E,directories:[...E.directories,""]}))}async function w(){var N;const E=await((N=n==null?void 0:n.chooseDirectory)==null?void 0:N.call(n));E&&d(R=>R.directories.includes(E)?R:{...R,directories:[...R.directories,E],primary:R.primary||E})}function C(E,N){d(R=>{const A=R.directories[E]??"",D=R.directories.map(($,q)=>q===E?N:$);let B=R.primary;return B===A&&(B=N),!B&&N&&(B=N),{...R,directories:D,primary:B}})}function k(E){d(N=>{const R=N.directories[E],A=N.directories.filter((D,B)=>B!==E);return{...N,directories:A,primary:N.primary===R?A.find(Boolean)??"":N.primary}})}async function S(){if(p(!0),x)return;const E=FA(u);f(!0);try{t?(await xe.updateProject(om,t.id,E),pe.success(`Project "${E.name}" updated`)):(await xe.createProject(om,E),pe.success(`Project "${E.name}" created`)),await s()}catch(N){pe.error(`Save failed: ${N.message}`)}finally{f(!1)}}return o.jsx(oa,{open:e,onOpenChange:r,children:o.jsxs(Sn,{className:"sm:max-w-2xl",children:[o.jsxs(la,{children:[o.jsx(Cn,{children:t?"Edit project":"Create project"}),o.jsx(sl,{children:"These paths belong to This device. The Primary directory becomes the Session working directory; every listed directory is available to the Session."})]}),o.jsxs("form",{className:"grid gap-4",onSubmit:E=>{E.preventDefault(),S()},children:[o.jsxs("div",{className:"grid gap-1.5",children:[o.jsx(Kr,{htmlFor:"project-name",children:"Name"}),o.jsx(bt,{id:"project-name",value:u.name,onChange:E=>d(N=>({...N,name:E.target.value})),placeholder:"Defaults to Primary folder name",maxLength:128,autoFocus:!0})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-2",children:[o.jsxs("div",{children:[o.jsx(Kr,{children:"Source directories"}),o.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:"Choose local folders or enter absolute paths."})]}),o.jsxs("div",{className:"flex gap-1.5",children:[l&&o.jsxs(ne,{type:"button",variant:"outline",size:"sm",onClick:()=>void w(),children:[o.jsx(P_,{})," Choose folder"]}),o.jsxs(ne,{type:"button",variant:"outline",size:"sm",onClick:b,children:[o.jsx(ls,{})," ",l?"Enter path":"Add path"]})]})]}),o.jsx("div",{className:"overflow-hidden rounded-lg border border-[var(--border)]",children:u.directories.length===0?o.jsxs("button",{type:"button",className:"flex min-h-24 w-full items-center justify-center gap-2 text-sm text-[var(--muted-foreground)] transition-colors hover:bg-[var(--muted)]/40 hover:text-[var(--foreground)]",onClick:l?()=>void w():b,children:[o.jsx(P_,{className:"size-4"}),l?"Choose a source folder":"Add an absolute directory path"]}):o.jsx("div",{className:"divide-y divide-[var(--border)]",children:u.directories.map((E,N)=>{const R=E!==""&&E===u.primary;return o.jsxs("div",{className:"grid gap-2 p-2.5 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-center",children:[o.jsxs("div",{className:"relative min-w-0",children:[o.jsx(qf,{className:"pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-[var(--muted-foreground)]"}),o.jsx(bt,{value:E,onChange:A=>C(N,A.target.value),placeholder:"/Users/name/Workspace/project",className:"pl-8 font-mono text-xs","aria-label":`Source directory ${N+1}`,autoCapitalize:"none",autoCorrect:"off",spellCheck:!1})]}),o.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[o.jsxs(ne,{type:"button",variant:R?"secondary":"ghost",size:"sm",className:We(R&&"text-[var(--primary)]"),disabled:!E.trim(),onClick:()=>d(A=>({...A,primary:E})),children:[R?o.jsx(Br,{}):o.jsx(vE,{}),R?"Primary":"Make primary"]}),o.jsx(ne,{type:"button",variant:"ghost",size:"icon-sm","aria-label":`Remove source directory ${N+1}`,onClick:()=>k(N),children:o.jsx(_n,{})})]})]},N)})})}),v&&x&&o.jsx("p",{className:"text-xs text-[var(--destructive)]",role:"alert",children:x})]}),o.jsxs(ca,{children:[o.jsx(ne,{type:"button",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsxs(ne,{type:"submit",disabled:m,children:[m?o.jsx(ze,{className:"animate-spin"}):null,t?"Save changes":"Create project"]})]})]})]})})}function PH(e){const t=FA(e);if(!t.name)return"Enter a project name.";if(t.directories.length===0)return"Add at least one source directory.";if(t.directories.some(r=>!IH(r)))return"Every source directory must be an absolute path.";if(!t.primary||!t.directories.includes(t.primary))return"Choose one listed directory as Primary."}function IH(e){return e.startsWith("/")||/^[A-Za-z]:[\\/]/.test(e)}const d2={codex:{src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAGcklEQVR42s2YbayXZR3HP9efc3g4wEEcgiKSIuQENCnEkUo5ZeUxS4eVtnzR1gpdTzO1CNfDirlc9aJMrfmi1Zo2K2wtQsk0TM6gLWxATUklFQNFoIOcwznA+fSi7023twcQa617++9/77qvh9/j9/f9XfB/9pTXM0ktQCmlDKonAvOBWUAnsBv4C7CmlLI9c1uAzW1KKf7HEucA1AnqEnW9+pK6V92v9qkvZvwW9fgj7NVSh1V7HpOFqkWlFNXZwNeBLqAfWAlsBF4BjgPmARcAB4FfAo/EeqcB+4CtwHpgdSmlX21l78E3YqEp6kr/9SxXL81Yh9oejTvVT6l7PPzznHqPellt72HN89oOI0RbYmAUcD3wLuBe4HOllGcbcztiobnAGGAb8DiwGdgOjIyl5gBXA+eqk4CfAL1q64iWip/b8j5bfVn9q3p6XSt1hHq+ert6IFb4nfrxBP6r3K/OU7+j7lN3qNdUMXXUAM77OPUmdVBdFgFa+Z+mfjZuUN2cgJ5cWz9cHTHEGV9OIqxT5xzOdTQ2eqv6LXWb2pO4aY+mXeqaCLJd/Z46q+5udZK6SH2/Or4K4ig0Sr0v62/Nnm2Hc1W7ekMEqZ5d6twsHKmuyvgKdUHNJdXvktqcgbwvbEDItfn2sHpC0zvUNFim9kage9Q/JXPelu+jY+rd6hV1U6tnqz/IN9Un1A15f1n9fuADdYb6uPqUOu81AmXgg1m4O+Y+TX1QfaUmUIfaHWC8MGOnqF9UN6r9EeJG9Uz1DPXz6gsR7KnE5cxYeJfaNZSFxqu/zaIlMf3ECLSnIdC6WPCqxEh3A2/uUMfU9h6rzle/28jGreom9YKES6nj0PnA2cA64L6g84QhkHxYkHoscAMwExgHLAf6gEuBK4EO9X7gwVLKHqBb3Qw8DFwLvDf7PQ8MpEb+u/6ptwUflsYKJS5bFQudm3mdsZrRtlu9Tj0p6P0JdW2+P5MUn1vPInWq+pmai7+R2GzVXXZvNvlIbezUHN6jnhUhO5MZAwG5aUNk6zT1rhxmYmpxFKzjXJf6fDDpw9V4q/Ffh/BWXNoC2kId9qUU9AA/K6U8HVxpVRhTSnka+CnwJNALvAm4E7gDWBilhpdSVgBLs/9i9bi6IM+lUp+stteYQD/QASxKTB2I0AUYGY33l1IGU4/2Z6wdmAg8ASwGHgUWhgl8NDFWgDXAauDNwCV1gbqBncBFwKmZ/BKwKoIuSeBenYJ74Cjkzli3L0X5CuCrGXsPMDEW/1uoyvEhfYcEeijVeQHw9pp77gYuB34TvnMXcAbwYiwj0F65DGivrbXm7p1x49643PChgWTaMGDqIYFKKbvi50FgmdpVShkopfQAD8Ts10ejDmAGcJU6rZTSV7mslNKXQF8UgrYPGBWLH4wgBxr09rXxGw1HJwX7k5KfVqc2iuZc9SvqlmTQ2qT6lKT+dYGCCgAfUDuz/pxk7OqUjhKIWRrIuW2oWnZeDUdU7w8aT6gTMvXK1K2/qzvVH6s/z5qd6mPh3KvVsbVa16M+Wqtp03PejjqTrKp1S70wcL5V/X0OOJhyML/aPGvGZLz+rEkdXJTysk4d3RBotTo5Zy7JuoeqtG92Fl3R8NfqLPXmFERTIJekYJ6ZIrkh5t4QgjYl+yxIAe5uCLQnAk2PlXenoH/gcK3OeYH89TXKOivIuyOCbQy1qLjS3epZdeJeO2xtVWgj0D/UP4favBCq87V62DQFOkF9JHB+TePbRaEM/XHjr9R31glazTorIvAqdWTG3xJrVM+2kMH2VwnTyKISWmm0GNGgn+PU96mXp3GsE7RZobPba/HUVVFU9eJYaLv6TXWOOvxIXLrqJuaof4g5bxliXnujek9O/Gyu9V83qqc3GoMvpWG4SR03VGMxpFD5fSgx06d+Oy1Macw9Sf1YyFZFR25PazSioeQ09cm4bHbNI62jNYrm94tA/BeATwIXA+vVZ4K+JwLTgXPy/iPgh7lw6D3Up5dyUD0ldWwGcCuwJYL6ulrpRlxcllh6dojWeDD/e4LqndG6PeA5Je3T8sxbWcHCMV/H1C8DYv4FaYVPBkYAW8KJ3pHi2wY8Fgq8Ky31bODdmb8CuLmUsql+iXHM1zCJp9YR5oxPLfpjsqc3VzR7A4zr03VMOGoAv5ELqyHWDqYhmBQ+MzPXMz3AJqC7lLKtIvD/lQur//XzT+4u16KSSLsQAAAAAElFTkSuQmCC",monochrome:!0},claude:{src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAEYElEQVR4nMVXW4hVVRjedrMii+6FRRRFUQ9iVNAFKipoKAeC1vrXGTUkSn0xGpyz/nVmHjpRYJQvZQ+R0EOXhyQksQsVKFo9WBORdc6sf59RiWlUyCmly5SWJ/69195n7T3nOo31w2Lm/Ovyf+v7b2sHQQcZXbnyVCoVrpsYFGcE/4eQgdcJoU6oDo2PqMubrakOL7uUNGwkLW6ZU+PVtQNXxMbjYTU83x4kfDenALaX7zqFEI54IH6ulMVZMwAgTLr5z+cUAAtp+ZTPQqjVE4En9XL5JEI4FjGE8FqQkxDVUIhqNERYFcxGamv65ocIoQdib12Ik5N5Wlu4IAVnoOjvJVTDqfsQfuO1bY2NG3E1aVkaQ3VbBgTKJZlYQLksnSuJ6xsA5L2pcQOP+XsIYcoH3lRIw2du8V+Mvh4E85I5i/BRaggh5PiI9FrenejHSg+dH4EqijsJ4WjGdaiGOtIdImzKoDawdbcZONe76bGUBSMfjUGr5Y7i76N1eullhHAwaxw2+ZdpKVXOZ4RtOer2WK1uciy84un3VcritMTPoZFbOF4I1a7c/mqzzGkpdY5qLUv+bQnhTzJq0AH8xbvZKkJ4yf1+mlC+nDP+aw0LNwSzETJwc6jh2+yB8j1r5Iue7muL8JZz186c8Xpo1Irg30htTd98i+qZXED97f1/nBB+yBt2pfvtZmfuK684vWbU4lp56dndAzFqMSHsbm5o5uCc52Dcg+KcUBfuCzWMuACnOMOidYfTBlcZFOftLy85sxMbhLDOO6DlCBF+4uDLseUPPuPd6GAaEQsJ4Q83Mc11PfK9gZ0c2YTqDfa7Raldyq3rlglvHOCUJqPKhNBndf+CzO0oimD4wlE06W7Qq5FM6kXtGeGR0Axc1bWvm9HOhYhrOB9ULQ5cw/7sYJzpHSOEHYRyM/ueBzcqi/IFaxSSUdCxLOeFHyOhgTdd5LcDMMW1gTtgh3j5JCnnbYX9ZQ08Swi/JxFOBjZEf1seLjdzlYz3Fu6P9sd1Ytpbd5gzpaVhpohQPh4FUCO6t9eKcCMhVBJDbUB8nA+2OJPEHXxu0mOaitXi2lxNP2KNXM1l2iK843Tb0pZrYEOSctyULMJXMWA1une4cHHQi1gjV2fo1fB+8hi1Gp50+h85fUMtn4vXqHsI1avZHpGyM26HxJVdGa8HwbxGE1KHOO9TYCV5uyvJx0NUD7COiwmv5YZTK4kLXQDGgTgiFvIj1v2e7LopWa0eZmp96uIuKPc7RtYnekI5EencU4vzvtGI5JZIF7tpOr7QLJ7to/xhgupTx8oujm7WV4riEmfsqP/YIC0/zD/dCGGRK3IHegZgG+33oO/LsAgPumifmFEvGpV0anxo+UUxs/0LmN2ejFMUXGlzWZSZi+s6G/lyBmiUMmVBq/6eb50IFxEuq7WSuDXICSF84FJwa34umtewngx8w608OBFCydeQho0nxEDQCQDfkGu9l6r/PYhOXzpdyD/VGsqNWs3dHgAAAABJRU5ErkJggg==",monochrome:!1},traex:{src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAF9SURBVHgB7Zm9SsNQFMf/EYWiVB2KKGLBScHFN9BJurmoa0dn9QGqD1CdHbtWFzd10jfQQdBJqIgKGYw4VCR+nGD0ptqmsSectD0/CKXpbXJ+3HvOyYfVP5B+RxvTgzZHBaRRAWlUQBoVkEYFpOkNGzC0MgtJnPJZw99DBcZ2FiFJmIDmgDSdn8S1PB9d4aFwiDgY2cwhnZuK9J/IAq5TxevNI+Lg7amKqGgO/DrgYIplTNPnAyN9E8OYPF5FZmOu7hgKPrufZ+svkXOgHhR8di/vfWbW5719dvE0MMYPPjUz6m3E3doBWoFlBszgfUjCnAkzeB+6TGl1JuJNYuOJk/W1ccMiQGW1slwKlFe7eAJ7+2cJuZ8lsrJUwsvF/fc+us5JxBIiTIna4H1MCY7gCbYkJij464Xdhg3Jl3D/0bT+gj0HmummXMET2omlCc2By/GtwHeq3dO3BSQFXULSdN8dGdV6p3yOpGDpOzJhVEAaFZBGBaRRAWlUQJoPEeV5RYlN/QYAAAAASUVORK5CYII=",monochrome:!1}},Kv="local",zH={starting:"Starting…",installing:"Installing…",updating:"Updating…",verifying:"Verifying installation…",complete:"Complete"};function $H(){const[e,t]=g.useState(null),[r,s]=g.useState(null),[n,l]=g.useState(!1),[u,d]=g.useState({}),m=g.useRef(0),f=g.useCallback(async(p=!1)=>{const x=++m.current;p&&l(!0),s(null);try{const b=await xe.listProviderClis(Kv);x===m.current&&t(b)}catch(b){x===m.current&&(t(null),s(b instanceof Error?b.message:String(b)))}finally{x===m.current&&l(!1)}},[]);g.useEffect(()=>{f()},[f]);const v=async(p,x)=>{try{let b=(await xe.startProviderCliOperation(Kv,p,x)).job;for(d(w=>({...w,[p]:b}));b.state==="running";)await GH(750),b=await xe.getProviderCliJob(Kv,b.id),d(w=>({...w,[p]:b}));b.state==="succeeded"?(pe.success(`${h2(p)} ${x} completed`),await f(),d(w=>{const C={...w};return delete C[p],C})):pe.error(b.error??`${h2(p)} ${x} failed`)}catch(b){pe.error(b.message),d(w=>{const C={...w};return delete C[p],C})}};return o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Providers"}),o.jsx("p",{className:"mt-1 max-w-2xl text-xs text-[var(--muted-foreground)]",children:"Inspect and manage the coding-agent providers installed on this device."})]}),o.jsx("div",{className:"flex items-center gap-2",children:o.jsxs(ne,{variant:"outline",size:"sm",disabled:n,onClick:()=>void f(!0),children:[o.jsx(_t,{className:n?"animate-spin":""}),"Refresh"]})})]}),r&&o.jsxs("div",{className:"rounded-lg border border-[var(--destructive)]/35 bg-[var(--destructive)]/8 px-4 py-3 text-sm",children:[o.jsxs("div",{className:"flex items-center gap-2 font-medium text-[var(--destructive)]",children:[o.jsx(bi,{className:"size-4"})," Could not inspect Providers"]}),o.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:r}),o.jsxs(ne,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>void f(!0),children:[o.jsx(_t,{})," Retry"]})]}),e===null&&!r?o.jsx("div",{className:"grid gap-3","aria-label":"Loading Providers",children:[0,1,2].map(p=>o.jsx(HH,{},p))}):o.jsx("div",{className:"grid gap-3",children:e==null?void 0:e.providerClis.map(p=>o.jsx(UH,{provider:p,job:u[p.id],readOnly:e.management==="read_only",onOperation:v},p.id))})]})}function UH({provider:e,job:t,readOnly:r,onOperation:s}){const n=e.availability!=="installed"?e.canInstall?"install":void 0:e.updateState==="available"&&e.canUpdate?"update":void 0,l=(t==null?void 0:t.state)==="running";return o.jsx(At,{className:"min-w-0",children:o.jsxs(Pr,{className:"grid gap-3 p-4 text-xs",children:[o.jsxs("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-[12rem_minmax(14rem,1.5fr)_minmax(8rem,0.65fr)_minmax(13rem,0.9fr)_11rem] xl:items-center",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-3 md:col-span-2 xl:col-span-1",children:[o.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-[var(--border)] bg-[var(--background)]",children:o.jsx("img",{src:d2[e.id].src,alt:"","aria-hidden":"true",className:We("size-full object-cover",d2[e.id].monochrome&&"brightness-0 dark:invert")})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx(Ds,{children:e.name}),o.jsx("div",{className:"mt-0.5 font-mono text-[10px] text-[var(--muted-foreground)]",children:e.binary})]})]}),o.jsx(Xv,{icon:UO,label:"Executable",value:e.executablePath??"Not found on Runtime PATH",mono:!0}),o.jsx(Xv,{icon:_t,label:"Version",value:qH(e),mono:!0,noWrap:!0}),o.jsx(Xv,{icon:MO,label:"Authentication",value:VH(e)}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2 md:col-span-2 xl:col-span-1 xl:justify-end",children:[o.jsx(FH,{provider:e}),!r&&n&&o.jsx(WH,{provider:e,operation:n,disabled:l,onConfirm:()=>s(e.id,n)})]})]}),e.error&&o.jsx("p",{className:"rounded-md bg-[var(--destructive)]/8 px-2.5 py-2 text-[11px] text-[var(--destructive)]",children:e.error}),t&&o.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-[var(--muted)]/45 px-2.5 py-2 text-[11px]",children:[l?o.jsx(_t,{className:"size-3.5 animate-spin text-[var(--primary)]"}):t.state==="succeeded"?o.jsx(w0,{className:"size-3.5 text-[var(--success)]"}):o.jsx(bi,{className:"size-3.5 text-[var(--destructive)]"}),o.jsx("span",{children:t.error??zH[t.stage]})]})]})})}function HH(){return o.jsxs("div",{"aria-hidden":"true",className:"grid animate-pulse gap-4 rounded-xl border border-[var(--border)] p-4 md:grid-cols-2 xl:grid-cols-[12rem_minmax(14rem,1.5fr)_minmax(8rem,0.65fr)_minmax(13rem,0.9fr)_11rem] xl:items-center",children:[o.jsxs("div",{className:"flex items-center gap-3 md:col-span-2 xl:col-span-1",children:[o.jsx("div",{className:"size-9 rounded-lg bg-[var(--muted)]"}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx("div",{className:"h-3.5 w-20 rounded bg-[var(--muted)]"}),o.jsx("div",{className:"h-2.5 w-12 rounded bg-[var(--muted)]"})]})]}),["w-full","w-24","w-32"].map((e,t)=>o.jsxs("div",{className:"grid gap-2",children:[o.jsx("div",{className:"h-2.5 w-16 rounded bg-[var(--muted)]"}),o.jsx("div",{className:`h-3 rounded bg-[var(--muted)] ${e}`})]},t)),o.jsxs("div",{className:"flex items-center gap-2 md:col-span-2 xl:col-span-1 xl:justify-end",children:[o.jsx("div",{className:"h-5 w-24 rounded-full bg-[var(--muted)]"}),o.jsx("div",{className:"h-8 w-24 rounded-md bg-[var(--muted)]"})]})]})}function FH({provider:e}){return e.availability==="missing"?o.jsx(Ot,{variant:"warning",children:"Not installed"}):e.availability==="broken"?o.jsx(Ot,{variant:"destructive",children:"Unavailable"}):e.updateState==="available"?o.jsx(Ot,{variant:"warning",children:"New version"}):o.jsx(Ot,{variant:"success",children:"Installed"})}function Xv({icon:e,label:t,value:r,mono:s=!1,noWrap:n=!1}){return o.jsxs("div",{className:"grid min-w-0 grid-cols-[1rem_minmax(0,1fr)] gap-x-2",children:[o.jsx(e,{className:"mt-0.5 size-3.5 text-[var(--muted-foreground)]"}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-[var(--muted-foreground)]",children:t}),o.jsx("div",{className:We("mt-0.5",s&&"font-mono text-[11px]",s&&!n&&"break-all",n&&"whitespace-nowrap"),children:r})]})]})}function WH({provider:e,operation:t,disabled:r,onConfirm:s}){const n=t==="install"?"Install":"Update";return o.jsxs(ki,{children:[o.jsx(wn,{asChild:!0,children:o.jsxs(ne,{size:"sm",className:"w-full sm:w-auto",disabled:r,children:[r?o.jsx(_t,{className:"animate-spin"}):o.jsx(pd,{}),r?"Working…":n]})}),o.jsxs(Xs,{children:[o.jsxs(Ei,{children:[o.jsxs(Zs,{children:[n," ",e.name,"?"]}),o.jsxs(Qs,{children:["Rynx will run ",e.name,"'s official ",t," mechanism on this Runtime. The daemon will verify the executable and version when it finishes."]})]}),o.jsxs(Ri,{children:[o.jsx(Js,{children:"Cancel"}),o.jsx(Ni,{onClick:()=>void s(),children:n})]})]})]})}function qH(e){return e.currentVersion?e.latestVersion?e.updateState==="available"?`${e.currentVersion} → ${e.latestVersion}`:`${e.currentVersion} · latest`:`${e.currentVersion} · latest unknown`:e.availability==="missing"?"—":"Unknown"}function VH(e){const t=e.authMode?` · ${e.authMode}`:"";return e.authState==="ready"?`Authenticated${t}`:e.authState==="required"?`Sign-in required${t}`:`Unknown${t}`}function h2(e){return e==="codex"?"Codex":e==="claude"?"Claude Code":"Traex"}function GH(e){return new Promise(t=>window.setTimeout(t,e))}function YH(e,t){if(e instanceof Qa)switch(e.code){case"offer_expired":return"This Share Link has expired. Generate a new link on the remote Host and try again.";case"offer_rejected":return"The remote Host rejected this Share Link. It may already have been used, expired, or revoked. Generate a new link and use it once.";case"invalid_offer":return"This is not a valid Rynx Share Link. Copy and paste the complete link from the remote Host."}return`${t} failed: ${e instanceof Error?e.message:String(e)}`}function KH(){const{runtimeSelector:e,selectRuntime:t,updateRuntimes:r}=Sc(),[s,n]=g.useState(null),[l,u]=g.useState(!1),[d,m]=g.useState(null),[f,v]=g.useState(null),[p,x]=g.useState({}),[b,w]=g.useState({});async function C(){try{const E=await xe.listRuntimes();n(E),r(E)}catch(E){n([]),pe.error(`Failed to load Runtimes: ${E.message}`)}}g.useEffect(()=>{C()},[]);async function k(E){v(E.selector);try{const N=await xe.testRuntime(E.selector);x(R=>({...R,[E.selector]:N})),w(R=>{const A={...R};return delete A[E.selector],A}),pe.success(`${E.displayName} is reachable`)}catch(N){x(A=>{const D={...A};return delete D[E.selector],D});const R={code:N instanceof Qa?N.code:void 0,message:N.message};w(A=>({...A,[E.selector]:R})),pe.error(R.code==="authentication_failed"?"Authorization is no longer valid. Generate a new Share Link on the remote host, then reauthorize this Runtime.":`Connection test failed: ${R.message}`)}finally{v(null)}}async function S(E){try{await xe.forgetRuntime(E.daemonId),x(N=>{const R={...N};return delete R[E.selector],R}),w(N=>{const R={...N};return delete R[E.selector],R}),pe.success(`Forgot ${E.displayName}`),e===E.selector&&t("local"),await C()}catch(N){pe.error(`Forget failed: ${N.message}`)}}return o.jsxs("div",{className:"grid gap-4",children:[o.jsx(XH,{}),o.jsxs(At,{children:[o.jsxs(Ys,{className:"items-start",children:[o.jsxs("div",{className:"grid gap-1",children:[o.jsxs(Ds,{children:["Runtimes"," ",o.jsx("span",{className:"ml-1 text-[var(--muted-foreground)]",children:(s==null?void 0:s.length)??0})]}),o.jsx("p",{className:"max-w-2xl text-xs text-[var(--muted-foreground)]",children:"Pair this Control Plane with remote Rynx daemons. Client keys stay in the local backend and never enter the browser."})]}),o.jsxs(ne,{size:"sm",onClick:()=>u(!0),children:[o.jsx(ls,{})," Add Runtime"]})]}),o.jsx(Pr,{className:"p-0",children:o.jsxs("div",{className:"divide-y divide-[var(--border)]",children:[s===null&&o.jsx("div",{className:"px-5 py-10 text-center text-sm text-[var(--muted-foreground)]",children:"Loading Runtimes…"}),s==null?void 0:s.map(E=>{const N=p[E.selector],R=b[E.selector],A=(R==null?void 0:R.code)==="authentication_failed";return o.jsxs("article",{className:"grid gap-3 px-5 py-4 transition-colors hover:bg-[var(--muted)]/35 md:grid-cols-[minmax(0,1fr)_auto] md:items-center",children:[o.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[o.jsx("div",{className:"mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:E.binding==="local"?o.jsx(cE,{className:"size-4"}):o.jsx(km,{className:"size-4"})}),o.jsxs("div",{className:"min-w-0",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("h2",{className:"font-medium",children:E.displayName}),o.jsx(Ot,{variant:E.binding==="local"?"default":"outline",children:E.binding}),N&&o.jsxs(Ot,{variant:"success",children:[o.jsx(w0,{className:"mr-1 size-3"})," reachable"]}),A&&o.jsxs(Ot,{variant:"warning",children:[o.jsx(k0,{className:"size-3"})," authorization required"]})]}),o.jsx("div",{className:"mt-1 truncate font-mono text-[11px] text-[var(--muted-foreground)]",children:E.daemonId}),E.endpoint&&o.jsx("div",{className:"mt-1 truncate text-xs text-[var(--muted-foreground)]",children:E.endpoint}),E.identityKeyFingerprint&&o.jsxs("div",{className:"mt-1 flex items-center gap-1.5 truncate font-mono text-[10px] text-[var(--muted-foreground)]",children:[o.jsx(Gf,{className:"size-3 shrink-0"}),E.identityKeyFingerprint]}),N&&o.jsxs("div",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:["Instance ",N.status.daemonInstanceId]})]})]}),o.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[E.binding==="direct"&&o.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>m(E),children:[o.jsx(Gf,{}),"Reauthorize"]}),o.jsxs(ne,{variant:"outline",size:"sm",disabled:f===E.selector,onClick:()=>void k(E),children:[o.jsx(_t,{className:f===E.selector?"animate-spin":""}),"Test"]}),E.binding==="direct"&&o.jsx(tF,{target:E,onForget:()=>S(E)})]})]},E.selector)})]})})]}),o.jsx("div",{className:"rounded-lg border border-[var(--border)] bg-[var(--muted)]/30 px-4 py-3 text-xs text-[var(--muted-foreground)]",children:"Sessions, terminals, and Session-scoped resources follow the selected Runtime. The standalone Emulator manager in Settings controls This device only. A remote failure never falls back to this device."}),o.jsx(p2,{open:l,onOpenChange:u,onAdded:async E=>{x(N=>({...N,[E.target.selector]:E})),await C()}}),o.jsx(p2,{open:d!==null,target:d,onOpenChange:E=>{E||m(null)},onAdded:async E=>{x(N=>({...N,[E.target.selector]:E})),w(N=>{const R={...N};return delete R[E.target.selector],R}),await C()}})]})}const f2="__rynx_custom_share_address__";function XH(){const[e,t]=g.useState(null),[r,s]=g.useState(null),[n,l]=g.useState(null),[u,d]=g.useState(!1),[m,f]=g.useState(!1),[v,p]=g.useState(""),[x,b]=g.useState(!1),[w,C]=g.useState(""),[k,S]=g.useState(!1),[E,N]=g.useState(null),R=g.useRef(null),[A,D]=g.useState(null),[B,$]=g.useState(null),[q,Y]=g.useState(!1),[V,U]=g.useState(null),[L,I]=g.useState(null),F=g.useCallback(async(Z=!1)=>{Y(!0);try{D(await xe.listRuntimeAccess()),$(null),Z&&pe.success("Shared access refreshed")}catch(ce){const le=ce.message;$(le),Z&&pe.error(`Failed to refresh shared access: ${le}`)}finally{Y(!1)}},[]),M=g.useCallback(async(Z=!1)=>{d(!0);try{const ce=await xe.listRuntimeShareAddresses();t(ce),l(null),s(le=>(le==null?void 0:le.kind)==="custom"||le&&ce.some(be=>be.address===le.address)?le:ce[0]?{kind:"detected",address:ce[0].address}:null),Z&&pe.success("Network addresses refreshed")}catch(ce){const le=ce.message;t(be=>be??[]),l(le),Z&&pe.error(`Failed to refresh network addresses: ${le}`)}finally{d(!1)}},[]);g.useEffect(()=>{F(),M()},[F,M]);const P=(r==null?void 0:r.address)??"",O=w.trim(),W=E&&E.address===P.trim()&&E.clientLabel===O?E.code:"";function H(Z){if(Z===f2){p((r==null?void 0:r.kind)==="custom"?r.address:""),b(!1),f(!0);return}Z!==Zv(r)&&e!=null&&e.some(ce=>ce.address===Z)&&s({kind:"detected",address:Z})}function T(){const Z=v.trim();if(!QH(Z)){b(!0);return}s({kind:"custom",address:Z}),f(!1),b(!1)}async function G(){const Z=P.trim();if(!Z){pe.error("Choose an address that the other device can reach");return}S(!0);try{const ce=await xe.shareRuntime({address:Z,...O?{clientLabel:O}:{}});N({code:ce.pairingCode,address:Z,clientLabel:O}),pe.success("Pairing link generated"),await F()}catch(ce){pe.error(`Failed to generate pairing link: ${ce.message}`)}finally{S(!1)}}async function X(){if(!W)return;const Z=await PA(W,R.current);Z==="clipboard"||Z==="selection"?pe.success("Pairing link copied"):Z==="selected"?pe.info("Pairing link selected — press Ctrl+C or ⌘C to copy"):pe.error("Copy is unavailable — select the pairing link and copy it manually")}async function ee(Z){U(Z.grantId);try{const ce=await xe.revokeRuntimeAccess(Z.grantId);pe.success(`Revoked ${Gu(Z)}${ce.closedConnections>0?` and closed ${ce.closedConnections} active connection${ce.closedConnections===1?"":"s"}`:""}`),await F()}catch(ce){pe.error(`Revoke failed: ${ce.message}`)}finally{U(null)}}async function oe(Z){I(Z.grantId);try{await xe.deleteRevokedRuntimeAccess(Z.grantId),pe.success(`Removed revoked access record for ${Gu(Z)}`),await F()}catch(ce){pe.error(`Remove failed: ${ce.message}`)}finally{I(null)}}const de=(A==null?void 0:A.filter(Z=>Z.revokedAt===null).length)??0;return o.jsxs(At,{children:[o.jsx(Ys,{className:"items-start",children:o.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[o.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:o.jsx(A6,{className:"size-4"})}),o.jsxs("div",{className:"grid gap-1",children:[o.jsx(Ds,{children:"Share this device"}),o.jsx("p",{className:"max-w-2xl text-xs text-[var(--muted-foreground)]",children:"Generate a revocable pairing link so another Rynx Control Plane can connect to this Runtime. Use a LAN, Tailscale, or tunnel address reachable from that device."})]})]})}),o.jsxs(Pr,{className:"grid gap-6",children:[o.jsxs("form",{className:"grid gap-3",onSubmit:Z=>{Z.preventDefault(),G()},children:[o.jsxs("div",{className:"grid gap-3 md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto] md:items-end",children:[o.jsxs("div",{className:"grid gap-1.5",children:[o.jsx(Kr,{htmlFor:"runtime-share-address",children:"Connection address"}),o.jsxs("div",{className:"flex min-w-0 gap-1.5",children:[o.jsxs(gn,{value:(r==null?void 0:r.kind)==="custom"?Zv(r):r==null?void 0:r.address,onValueChange:H,disabled:e===null,children:[o.jsx(Ui,{id:"runtime-share-address",className:"min-w-0 flex-1","aria-describedby":"runtime-share-address-help",children:o.jsx($i,{placeholder:e===null?"Detecting addresses…":"No address detected",children:(r==null?void 0:r.kind)==="custom"?r.address:r?ZH(e??[],r.address):void 0})}),o.jsxs(Hi,{align:"start",children:[(r==null?void 0:r.kind)==="custom"&&o.jsxs(cr,{value:Zv(r),children:["Custom (",r.address,")"]}),e==null?void 0:e.map(Z=>o.jsx(cr,{value:Z.address,children:WA(Z)},Z.address)),((r==null?void 0:r.kind)==="custom"||!!(e!=null&&e.length))&&o.jsx(Xm,{}),o.jsx(cr,{value:f2,children:"Enter custom address…"})]})]}),o.jsx(ne,{type:"button",variant:"outline",size:"icon",disabled:u,"aria-label":"Refresh network addresses",title:"Refresh network addresses",onClick:()=>void M(!0),children:o.jsx(_t,{className:u?"animate-spin":""})})]})]}),o.jsxs("div",{className:"grid gap-1.5",children:[o.jsx(Kr,{htmlFor:"runtime-share-label",children:"Client label"}),o.jsx(bt,{id:"runtime-share-label",value:w,onChange:Z=>C(Z.target.value),placeholder:"Alice’s laptop (optional)",maxLength:128})]}),o.jsxs(ne,{type:"submit",disabled:k||!r,children:[k?o.jsx(_t,{className:"animate-spin"}):o.jsx(BO,{}),"Generate Link"]})]}),o.jsx("p",{id:"runtime-share-address-help",className:n?"text-xs text-[var(--destructive)]":"text-xs text-[var(--muted-foreground)]",role:n?"alert":void 0,children:n?`Could not refresh network addresses: ${n}`:(r==null?void 0:r.kind)==="custom"?"Using a custom host or ws(s) endpoint. Make sure the other device can reach it.":e!=null&&e.length?"Detected from this device. Tailnet addresses are listed first.":e===null?"Looking for reachable IPv4 interfaces on this device…":"No reachable IPv4 interface was found. Check the Runtime listener or enter a custom address."}),W&&o.jsxs("div",{className:"grid gap-1.5 rounded-lg border border-[var(--border)] bg-[var(--muted)]/30 p-3",children:[o.jsx(Kr,{htmlFor:"runtime-pairing-code",children:"Pairing link"}),o.jsxs("div",{className:"flex min-w-0 gap-2",children:[o.jsx(bt,{id:"runtime-pairing-code",ref:R,value:W,readOnly:!0,className:"font-mono text-xs",spellCheck:!1}),o.jsxs(ne,{type:"button",variant:"outline",onClick:()=>void X(),children:[o.jsx(C0,{})," Copy"]})]}),o.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Treat this link as a credential. After it is used, the client appears below and can be revoked."})]})]}),o.jsxs("section",{className:"grid gap-3 border-t border-[var(--border)] pt-4","aria-labelledby":"runtime-access-title",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsxs("div",{children:[o.jsxs("h2",{id:"runtime-access-title",className:"text-sm font-medium",children:["Shared access ",o.jsx("span",{className:"text-[var(--muted-foreground)]",children:de})]}),o.jsx("p",{className:"mt-0.5 text-xs text-[var(--muted-foreground)]",children:"Active clients can reconnect until their grant is revoked."})]}),o.jsx(ne,{type:"button",variant:"ghost",size:"icon-sm",disabled:q,"aria-label":"Refresh shared access",onClick:()=>void F(!0),children:o.jsx(_t,{className:q?"animate-spin":""})})]}),A===null&&!B&&o.jsx("div",{className:"py-4 text-center text-xs text-[var(--muted-foreground)]",role:"status",children:"Loading shared access…"}),B&&o.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-[var(--destructive)]/30 bg-[var(--destructive)]/5 px-3 py-2",children:[o.jsxs("p",{className:"text-xs text-[var(--destructive)]",role:"alert",children:["Could not load shared access: ",B]}),o.jsx(ne,{type:"button",variant:"outline",size:"sm",onClick:()=>void F(),children:"Retry"})]}),(A==null?void 0:A.length)===0&&!B&&o.jsx("div",{className:"rounded-lg border border-dashed border-[var(--border)] px-4 py-6 text-center text-xs text-[var(--muted-foreground)]",children:"No shared Runtime access yet."}),A&&A.length>0&&o.jsx("ul",{className:"divide-y divide-[var(--border)] overflow-hidden rounded-lg border border-[var(--border)]",children:A.map(Z=>o.jsxs("li",{className:"grid gap-3 px-3 py-3 md:grid-cols-[minmax(0,1fr)_auto] md:items-center",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("span",{className:"text-sm font-medium",children:Gu(Z)}),o.jsxs(Ot,{variant:Z.revokedAt?"destructive":"success",children:[Z.revokedAt?o.jsx(k0,{className:"size-3"}):o.jsx(Gf,{className:"size-3"}),Z.revokedAt?"revoked":"active"]})]}),o.jsx("div",{className:"mt-1 truncate font-mono text-[10px] text-[var(--muted-foreground)]",children:Z.grantId}),o.jsx("div",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:Z.lastUsedAt?`Last used ${m2(Z.lastUsedAt)}`:`Created ${m2(Z.createdAt)} · never connected`})]}),Z.revokedAt?o.jsx(eF,{client:Z,disabled:L===Z.grantId,onRemove:()=>oe(Z)}):o.jsx(JH,{client:Z,disabled:V===Z.grantId,onRevoke:()=>ee(Z)})]},Z.grantId))})]})]}),o.jsx(oa,{open:m,onOpenChange:Z=>{f(Z),Z||b(!1)},children:o.jsxs(Sn,{className:"sm:max-w-md",children:[o.jsxs(la,{children:[o.jsx(Cn,{children:"Enter custom address"}),o.jsx(sl,{children:"Use a DNS name, custom port, reverse proxy, or tunnel when the detected interfaces are not the route the other device should dial."})]}),o.jsxs("form",{className:"grid gap-4",onSubmit:Z=>{Z.preventDefault(),T()},children:[o.jsxs("div",{className:"grid gap-1.5",children:[o.jsx(Kr,{htmlFor:"runtime-custom-share-address",children:"Host or WebSocket URL"}),o.jsx(bt,{id:"runtime-custom-share-address",value:v,onChange:Z=>{p(Z.target.value),Z.target.value.trim()&&b(!1)},placeholder:"runtime.example.com or wss://runtime.example.com",maxLength:2048,"aria-invalid":x,"aria-describedby":"runtime-custom-share-address-help",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,autoFocus:!0}),o.jsx("p",{id:"runtime-custom-share-address-help",className:x?"text-xs text-[var(--destructive)]":"text-xs text-[var(--muted-foreground)]",children:x?"Enter a host or a complete ws:// or wss:// URL without spaces.":"Rynx adds the listener port for a host and supplies the Runtime path."})]}),o.jsxs(ca,{children:[o.jsx(B0,{asChild:!0,children:o.jsx(ne,{type:"button",variant:"outline",children:"Cancel"})}),o.jsx(ne,{type:"submit",disabled:!v.trim(),children:"Use Address"})]})]})]})})]})}function WA(e){return`${e.interfaceName} (${e.address})`}function ZH(e,t){const r=e.find(s=>s.address===t);return r?WA(r):t}function Zv(e){return(e==null?void 0:e.kind)==="custom"?`__rynx_custom_share_address_current__:${e.address}`:void 0}function QH(e){return e.length>0&&e.length<=2048&&!/[\s\u0000-\u001f\u007f]/.test(e)}function JH({client:e,disabled:t,onRevoke:r}){return o.jsxs(ki,{children:[o.jsx(wn,{asChild:!0,children:o.jsxs(ne,{type:"button",variant:"destructive",size:"sm",disabled:t,children:[t?o.jsx(_t,{className:"animate-spin"}):o.jsx(k0,{}),"Revoke"]})}),o.jsxs(Xs,{children:[o.jsxs(Ei,{children:[o.jsxs(Zs,{children:["Revoke access for “",Gu(e),"”?"]}),o.jsx(Qs,{children:"This client will no longer be able to reconnect. Any active Runtime connections using this grant are closed immediately."})]}),o.jsxs(Ri,{children:[o.jsx(Js,{children:"Cancel"}),o.jsx(Ni,{variant:"destructive",onClick:()=>void r(),children:"Revoke Access"})]})]})]})}function eF({client:e,disabled:t,onRemove:r}){return o.jsxs(ki,{children:[o.jsx(wn,{asChild:!0,children:o.jsxs(ne,{type:"button",variant:"outline",size:"sm",disabled:t,children:[t?o.jsx(_t,{className:"animate-spin"}):o.jsx(lo,{}),"Remove Record"]})}),o.jsxs(Xs,{children:[o.jsxs(Ei,{children:[o.jsxs(Zs,{children:["Remove revoked record for “",Gu(e),"”?"]}),o.jsx(Qs,{children:"This removes the revoked authorization record from this Host. It does not restore access or delete the credential stored on the client device."})]}),o.jsxs(Ri,{children:[o.jsx(Js,{children:"Cancel"}),o.jsx(Ni,{variant:"destructive",onClick:()=>void r(),children:"Remove Record"})]})]})]})}function Gu(e){return e.clientLabel??e.clientId}function m2(e){const t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleString():e}function p2({open:e,target:t=null,onOpenChange:r,onAdded:s}){const[n,l]=g.useState(""),[u,d]=g.useState(""),[m,f]=g.useState(!1),v=t!==null;g.useEffect(()=>{e&&(l((t==null?void 0:t.displayName)??""),d(""))},[e,t]);async function p(){const x=u.trim();if(x){f(!0);try{const b=await xe.pairRuntime({offer:x,...n.trim()?{displayName:n.trim()}:{},...t?{replaceExisting:!0,expectedDaemonId:t.daemonId}:{}});pe.success(v?`Reauthorized ${b.target.displayName}`:`Paired ${b.target.displayName}`),await s(b),l(""),d(""),r(!1)}catch(b){pe.error(YH(b,v?"Reauthorization":"Pairing"))}finally{f(!1)}}}return o.jsx(oa,{open:e,onOpenChange:r,children:o.jsxs(Sn,{className:"sm:max-w-lg",children:[o.jsxs(la,{children:[o.jsx(Cn,{children:v?"Reauthorize Runtime":"Add Runtime"}),o.jsx(sl,{children:v?"Generate a fresh Share Link on the remote Host and paste it here. The old local credential is replaced only after the new connection is authenticated.":"On the remote host, share the Runtime and paste its pairing link here. The local backend keeps the resulting client credential out of the browser."})]}),o.jsxs("form",{className:"grid gap-4",onSubmit:x=>{x.preventDefault(),p()},children:[o.jsxs("div",{className:"grid gap-3",children:[o.jsxs("div",{className:"grid gap-1.5",children:[o.jsx(Kr,{htmlFor:"runtime-name",children:"Display name"}),o.jsx(bt,{id:"runtime-name",value:n,onChange:x=>l(x.target.value),placeholder:"Remote lab",maxLength:128})]}),o.jsxs("div",{className:"grid gap-1.5",children:[o.jsx(Kr,{htmlFor:"runtime-offer",children:"Pairing link"}),o.jsx(bt,{id:"runtime-offer",value:u,onChange:x=>d(x.target.value),placeholder:"rynx://pair?code=...",className:"font-mono text-xs",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1}),o.jsxs("p",{className:"text-xs text-[var(--muted-foreground)]",children:["Generate one from"," ",o.jsx("span",{className:"font-medium text-[var(--foreground)]",children:"Share this device"})," on the remote Control Plane."]})]})]}),o.jsxs(ca,{children:[o.jsx(B0,{asChild:!0,children:o.jsx(ne,{type:"button",variant:"outline",children:"Cancel"})}),o.jsxs(ne,{type:"submit",disabled:m||!u.trim(),children:[m?o.jsx(_t,{className:"animate-spin"}):o.jsx(Gf,{}),v?"Reauthorize":"Add Runtime"]})]})]})]})})}function tF({target:e,onForget:t}){return o.jsxs(ki,{children:[o.jsx(wn,{asChild:!0,children:o.jsxs(ne,{variant:"ghost",size:"sm",className:"text-[var(--destructive)]",children:[o.jsx(lo,{}),o.jsxs("span",{className:"sr-only",children:["Forget ",e.displayName]})]})}),o.jsxs(Xs,{children:[o.jsxs(Ei,{children:[o.jsxs(Zs,{children:["Forget “",e.displayName,"”?"]}),o.jsxs(Qs,{children:["Removes this route and its protected client credential from the local Control Plane. The remote grant remains until an operator runs ",o.jsx("code",{children:"rynx runtime clients revoke"}),"on that daemon."]})]}),o.jsxs(Ri,{children:[o.jsx(Js,{children:"Cancel"}),o.jsx(Ni,{variant:"destructive",onClick:()=>void t(),children:"Forget Runtime"})]})]})]})}function rF(e,t){return t==="install"||(e==null?void 0:e.phase)==="installing"}const sF="rynx.control.session-launch-selection.v2",qA="default";function iF(e){return`${e.kind}:${e.id}`}function nF(e){return e==="provider:claude"?{kind:"provider",id:"claude"}:e==="provider:codex"?{kind:"provider",id:"codex"}:e==="provider:traex"?{kind:"provider",id:"traex"}:e.startsWith("agent:")&&e.length>6?{kind:"agent",id:e.slice(6)}:null}function aF(e,t){return e.kind==="provider"?t.providers.some(r=>r.id===e.id):t.agents.some(r=>r.id===e.id)}function oF(e,t){const r=t?nF(t):null;if(r&&aF(r,e)&&(r.kind==="agent"&&e.agents.some(l=>l.id===r.id&&l.ready)||r.kind==="provider"&&e.providers.some(l=>l.id===r.id&&l.ready)))return r;for(const l of["claude","codex","traex"])if(e.providers.some(u=>u.id===l&&u.ready))return{kind:"provider",id:l};const s=e.providers.find(l=>l.ready);if(s)return{kind:"provider",id:s.id};const n=e.agents.find(l=>l.ready);return n?{kind:"agent",id:n.id}:e.providers[0]?{kind:"provider",id:e.providers[0].id}:e.agents[0]?{kind:"agent",id:e.agents[0].id}:null}function lF(e,t){if(!t)return null;try{return t.getItem(VA(e))}catch{return null}}function cF(e,t,r){if(t)try{t.setItem(VA(e),iF(r))}catch{}}function VA(e){return`${sF}:${encodeURIComponent(e)}`}function uF(e,t,r,s){const n=r?{projectId:r}:{},l=s!=null&&s.permissionPreset&&s.permissionPreset!==qA?{permissionPreset:s.permissionPreset}:{};return e.kind==="provider"?{provider:e.id,title:t,...n,...s!=null&&s.model?{model:s.model}:{},...s!=null&&s.reasoningEffort?{reasoningEffort:s.reasoningEffort}:{},...l}:{agent:e.id,title:t,...n,...l}}function g2(e,t,r=qA){var u,d,m,f;if(!e||e.kind!=="provider")return{permissionPreset:r};const s=t.providers.find(v=>v.id===e.id),n=((u=s==null?void 0:s.models)==null?void 0:u.find(v=>v.isDefault))??((d=s==null?void 0:s.models)==null?void 0:d[0]),l=n!=null&&n.defaultReasoningEffort&&n.reasoningOptions.some(v=>v.value===n.defaultReasoningEffort)?n.defaultReasoningEffort:((m=n==null?void 0:n.reasoningOptions.find(v=>v.value==="medium"))==null?void 0:m.value)??((f=n==null?void 0:n.reasoningOptions[0])==null?void 0:f.value);return{permissionPreset:r,...n?{model:n.id}:{},...l?{reasoningEffort:l}:{}}}function dF(e){const t=e.replace(/\s+/g," ").trim(),r=Array.from(t);return r.length<=64?t:`${r.slice(0,61).join("").trimEnd()}…`}function hF(e){return{providers:[],agents:e.map(t=>({...t,ready:!0,readiness:"unverified"}))}}function nf(e){return e.readiness==="unverified"?"unverified":e.ready?"ready":"needs_setup"}function nd(e){return e==="claude"?"Claude Code":e==="traex"?"Traex":"Codex"}function px(e,t){if(!e)return null;if(e.kind==="provider")return t.providers.find(s=>s.id===e.id)??null;const r=t.agents.find(s=>s.id===e.id);return r?{name:r.name??r.id,ready:r.ready,...r.reason?{reason:r.reason}:{},...r.readiness?{readiness:r.readiness}:{}}:null}const fF=gA,mF=g.forwardRef(({className:e,...t},r)=>o.jsx(vA,{ref:r,className:We("inline-flex h-9 items-center gap-1 rounded-lg bg-[var(--muted)] p-1 text-[var(--muted-foreground)]",e),...t}));mF.displayName="TabsList";const pF=g.forwardRef(({className:e,...t},r)=>o.jsx(_A,{ref:r,className:We("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium transition-all focus-visible:outline-none data-[state=active]:bg-[var(--background)] data-[state=active]:text-[var(--foreground)] data-[state=active]:shadow-sm",e),...t}));pF.displayName="TabsTrigger";const gx=g.forwardRef(({className:e,...t},r)=>o.jsx(xA,{ref:r,className:We("mt-4 focus-visible:outline-none",e),...t}));gx.displayName="TabsContent";function tp(){return{items:[],byId:{},callIndex:{},interactionIndex:{},pendingOutputs:{},pendingInteractionResolutions:{},childStates:{},turns:{},runStatus:"idle",waitingForInteraction:!1,todos:[],historyLoaded:!1}}function gF(e,t){return e==="startup"&&t!==void 0&&(/^Starting MCP servers?:/i.test(t)||/^MCP startup /i.test(t))}function vF(e){return e.filter(t=>"text"in t).map(t=>t.text).join("")}function _F(e){var s;const t=e.data.content.flatMap((n,l)=>"text"in n?[l]:[]);return t.length!==1?!1:((s=e.truncations)==null?void 0:s.some(({field:n})=>n===`data.content[${t[0]}].text`))===!0}function xF(e){return e.filter(t=>t.type==="input_image")}function yF(e,t){return e.length===t.length&&e.every((r,s)=>{var n;return r.resourceId===((n=t[s])==null?void 0:n.resourceId)})}function af(e){const t=e.slice();for(let r=1;r<t.length;r+=1){const s=t[r],n=t[r-1];s.type!=="reasoning"||s.data.model!=="traex"||n.type!=="message"||n.data.role!=="assistant"||n.data.model!=="traex"||n.responseId!==s.responseId||s.createdAt<n.createdAt||s.createdAt-n.createdAt>500||(t[r]=n,t[r-1]=s)}return t}function dn(e){return{...e,items:e.items.slice(),byId:{...e.byId},callIndex:{...e.callIndex},interactionIndex:{...e.interactionIndex},pendingOutputs:{...e.pendingOutputs},pendingInteractionResolutions:{...e.pendingInteractionResolutions},childStates:{...e.childStates},turns:{...e.turns}}}function Ts(e,t,r){e.items[t]=r}function qs(e,t){const r=e.items.length;return e.items.push(t),r}function v2(e){const t=tp();for(const r of e.items){if(r.kind!=="message"||r.role!=="user"||!r.optimistic)continue;const s={...r,images:r.images.slice()};t.byId[s.id]=qs(t,s)}return t}function _2(e,t,r){if(!r)return;const s=e.turns[t];e.turns[t]=s?{...s,model:s.model??r}:{status:"completed",model:r}}function GA(e){let t=0;for(const r of e)r.kind==="interaction"&&r.status==="pending"&&(t+=1),r.kind==="tool"&&r.children&&(t+=GA(r.children));return t}function Wo(e){e.waitingForInteraction=GA(e.items)>0||Object.values(e.childStates).some(t=>t.waitingForInteraction)}function YA(e){const t={...e,status:"pending"};return delete t.resolution,delete t.reason,delete t.resolvedAt,t}function vx(e,t){return e.map(r=>r.kind==="interaction"?t.has(r.id)?YA(r):r.status==="pending"?{...r,status:"inactive"}:r:r.kind==="tool"&&r.children?{...r,children:vx(r.children,t)}:r)}function _x(e,t=new Set){for(const r of e)r.kind==="interaction"&&t.add(r.id),r.kind==="tool"&&r.children&&_x(r.children,t);return t}function x2(e,t){const r=new Set(t.pendingInteractions.map(({interaction:l})=>l.interactionId));for(const[l,u]of Object.entries(e.childStates)){const d=dn(u);d.items=vx(d.items,r),Wo(d),e.childStates[l]=d;const m=e.callIndex[l];if(m!==void 0){const f=e.items[m];Ts(e,m,{...f,children:d.items})}}e.items=vx(e.items,r);const s=_x(e.items);for(const l of Object.values(e.childStates))_x(l.items,s);for(const{responseId:l,interaction:u}of t.pendingInteractions){if(s.has(u.interactionId))continue;const d={kind:"interaction",id:u.interactionId,responseId:l,request:u,status:"pending"};e.interactionIndex[u.interactionId]=qs(e,d),s.add(u.interactionId)}const n=new Set(t.activeResponseIds);for(const[l,u]of Object.entries(e.turns))n.has(l)||u.status==="running"&&(e.turns[l]={...u,status:"completed"},Mf(e,l));wF(e,n);for(const l of n)e.turns[l]={...e.turns[l],status:"running"};e.runStatus=t.status,e.statusKind=t.statusKind,e.waitingForInteraction=r.size>0}function y2(e,t){return{...e,status:t.status,...t.resolution?{resolution:t.resolution}:{},...t.reason?{reason:t.reason}:{},resolvedAt:t.resolvedAt}}function b2(e,t,r,s){const n=e.byId[t];if(n!==void 0)return n;const l=qs(e,s());return e.byId[t]=l,l}function ad(e,t){e.items.splice(t,1);for(const r of[e.byId,e.callIndex,e.interactionIndex])for(const[s,n]of Object.entries(r))n===t?delete r[s]:n>t&&(r[s]=n-1)}function bF(e,t,r){const s=dn(e.childStates[t]??tp());Qn(s,{...r,parentToolCallId:void 0}),Wo(s),e.childStates[t]=s;const n=e.callIndex[t];if(n!==void 0){const l=e.items[n];Ts(e,n,{...l,children:s.items})}}function Qn(e,t){var r;if(t.parentToolCallId){bF(e,t.parentToolCallId,t);return}switch(t.type){case"message":{_2(e,t.responseId,t.data.model);const s={kind:"message",id:t.id,responseId:t.responseId,role:t.data.role,text:vF(t.data.content),images:xF(t.data.content),model:t.data.model,isMeta:t.data.isMeta,interrupted:t.data.interrupted,streaming:!1,..._F(t)?{textPrefixTruncated:!0}:{}},n=e.byId[t.id];if(n!==void 0){Ts(e,n,s);return}if(t.data.role==="user"){const l=e.items.findIndex(u=>u.kind==="message"&&u.optimistic&&u.role==="user"&&u.text===s.text&&yF(u.images,s.images));if(l!==-1){const u=e.items[l];delete e.byId[u.id],Ts(e,l,s),e.byId[t.id]=l;return}}e.byId[t.id]=qs(e,s);return}case"reasoning":{_2(e,t.responseId,t.data.model);const s={kind:"reasoning",id:t.id,responseId:t.responseId,summary:t.data.summary.map(l=>l.text),model:t.data.model,streaming:!1},n=e.byId[t.id];n!==void 0?Ts(e,n,s):e.byId[t.id]=qs(e,s);return}case"function_call":{const s=t.data.callId,n=e.pendingOutputs[s],l=(r=e.childStates[s])==null?void 0:r.items,u={kind:"tool",id:s,responseId:t.responseId,name:t.data.name,arguments:t.data.arguments,status:n?n.status??"completed":t.status,output:n==null?void 0:n.output,exitCode:n==null?void 0:n.exitCode,...l&&l.length?{children:l}:{}};n&&delete e.pendingOutputs[s];const d=e.callIndex[s];d!==void 0?Ts(e,d,u):e.callIndex[s]=qs(e,u);return}case"function_call_output":{const s=t.data.callId,n=e.callIndex[s];if(n===void 0){e.pendingOutputs[s]={output:t.data.output,status:t.data.status,exitCode:t.data.exitCode};return}const l=e.items[n];Ts(e,n,{...l,output:t.data.output,status:t.data.status??"completed",exitCode:t.data.exitCode});return}case"terminal_command":{const s={kind:"terminal_command",id:t.id,responseId:t.responseId,command:t.data.command,...t.data.stdout?{stdout:t.data.stdout}:{},...t.data.stderr?{stderr:t.data.stderr}:{}},n=e.byId[t.id];n!==void 0?Ts(e,n,s):e.byId[t.id]=qs(e,s);return}case"interaction_request":{const s=t.data.interaction,n=s.interactionId,l=e.interactionIndex[n],u=e.pendingInteractionResolutions[n],d=l===void 0?void 0:e.items[l];let m={kind:"interaction",id:n,responseId:t.responseId,request:s,status:(d==null?void 0:d.status)??"pending",...d!=null&&d.resolution?{resolution:d.resolution}:{},...d!=null&&d.reason?{reason:d.reason}:{},...(d==null?void 0:d.resolvedAt)!==void 0?{resolvedAt:d.resolvedAt}:{}};u&&(m=y2(m,u),delete e.pendingInteractionResolutions[n]),l===void 0?e.interactionIndex[n]=qs(e,m):Ts(e,l,m),e.byId[t.id]=e.interactionIndex[n];return}case"interaction_resolution":{const s=t.data,n=e.interactionIndex[s.interactionId];if(n===void 0){e.pendingInteractionResolutions[s.interactionId]={...s,responseId:t.responseId,itemId:t.id};return}const l=e.items[n];Ts(e,n,y2(l,s)),e.byId[t.id]=n;return}case"error":{const s={kind:"error",id:t.id,responseId:t.responseId,source:t.data.source,code:t.data.code,message:t.data.message},n=e.byId[t.id];n!==void 0?Ts(e,n,s):e.byId[t.id]=qs(e,s);return}}}function Mf(e,t){const r=s=>s===t;lm(e,r),e.items=xx(e.items,t);for(const[s,n]of Object.entries(e.childStates)){const l=dn(n);lm(l,r),l.items=xx(l.items,t),Wo(l),e.childStates[s]=l;const u=e.callIndex[s];if(u!==void 0){const d=e.items[u];Ts(e,u,{...d,children:l.items})}}}function wF(e,t){const r=s=>!t.has(s);lm(e,r);for(const[s,n]of Object.entries(e.childStates)){const l=dn(n);lm(l,r),Wo(l),e.childStates[s]=l;const u=e.callIndex[s];if(u!==void 0){const d=e.items[u];Ts(e,u,{...d,children:l.items})}}}function lm(e,t){for(let r=e.items.length-1;r>=0;r-=1){const s=e.items[r];(s==null?void 0:s.kind)==="message"&&t(s.responseId)&&s.role==="assistant"&&s.liveDraft===!0&&ad(e,r)}}function SF(e,t){const r=e.items.filter(s=>s.kind==="message"&&s.responseId===t&&s.role==="assistant"&&s.liveDraft!==!0);if(r.length!==0)for(let s=e.items.length-1;s>=0;s-=1){const n=e.items[s];(n==null?void 0:n.kind)==="message"&&n.responseId===t&&n.role==="assistant"&&n.liveDraft===!0&&r.some(l=>l.text===n.text||l.textPrefixTruncated===!0&&l.text.length>0&&n.text.startsWith(l.text))&&ad(e,s)}}function xx(e,t){return e.map(r=>{const s=r.kind==="tool"&&r.children?{...r,children:xx(r.children,t)}:r;return s.responseId!==t?s:s.kind==="tool"&&s.status==="in_progress"?{...s,status:"incomplete"}:(s.kind==="message"||s.kind==="reasoning")&&s.streaming?{...s,streaming:!1}:s.kind==="interaction"&&s.status==="pending"?{...s,status:"inactive",reason:"Turn ended before this interaction was resolved"}:s})}function Qv(e){return Object.values(e.turns).some(t=>t.status==="running")}function hi(e){e.note=void 0,e.statusKind=void 0}function CF(e,t){var r,s;switch(t.type){case"session.status":{e.runStatus=t.status,t.runtimeSessionId&&(e.runtimeSessionId=t.runtimeSessionId),e.note=t.note,e.statusKind=t.statusKind;return}case"response.created":{e.turns[t.responseId]={status:"running",model:t.model},e.runStatus="running",hi(e);return}case"response.output_text.delta":{hi(e);const n=e.byId[t.itemId],l=n===void 0?void 0:e.items[n];if(t.discard===!0){n!==void 0&&(l==null?void 0:l.kind)==="message"&&l.role==="assistant"&&l.responseId===t.responseId&&l.liveDraft===!0&&ad(e,n);return}const u=(r=e.turns[t.responseId])==null?void 0:r.status;if(u==="completed"||u==="failed"||u==="cancelled"||(l==null?void 0:l.kind)==="message"&&l.role==="assistant"&&l.liveDraft!==!0)return;const d=b2(e,t.itemId,t.responseId,()=>({kind:"message",id:t.itemId,responseId:t.responseId,role:"assistant",text:"",images:[],streaming:!0,liveDraft:!0})),m=e.items[d];e.items[d]={...m,text:m.text+t.delta,streaming:!0},t.final&&SF(e,t.responseId);return}case"response.reasoning_summary_text.delta":{hi(e);const n=b2(e,t.itemId,t.responseId,()=>({kind:"reasoning",id:t.itemId,responseId:t.responseId,summary:[],streaming:!0})),l=e.items[n],u=l.summary.slice();u[t.summaryIndex]=(u[t.summaryIndex]??"")+t.delta,e.items[n]={...l,summary:u,streaming:!0};return}case"response.function_call_output.delta":{hi(e);const n=e.callIndex[t.callId];if(n===void 0){const u=e.pendingOutputs[t.callId]??{output:""};e.pendingOutputs[t.callId]={...u,output:(u.output??"")+t.delta};return}const l=e.items[n];e.items[n]={...l,output:(l.output??"")+t.delta};return}case"session.interaction.requested":{hi(e),Qn(e,t.item);const n=e.interactionIndex[t.interaction.interactionId];if(n!==void 0){const l=e.items[n];(l.status==="pending"||l.status==="inactive")&&Ts(e,n,YA(l))}return}case"session.interaction.resolved":case"session.interaction.cancelled":{hi(e),Qn(e,t.item);return}case"session.interrupted":{hi(e);const n=e.turns[t.responseId];e.turns[t.responseId]={...n,status:"cancelled"};let l=!1;for(let u=e.items.length-1;u>=0;u-=1){const d=e.items[u];if((d==null?void 0:d.kind)==="message"&&d.role==="assistant"&&d.responseId===t.responseId){e.items[u]={...d,interrupted:!0,streaming:!1,liveDraft:!1},l=!0;break}}if(!l){const u=`interrupted_${t.responseId}`;e.byId[u]===void 0&&(e.byId[u]=qs(e,{kind:"error",id:u,responseId:t.responseId,source:"execution",code:"response_stopped",message:"Response stopped"}))}Mf(e,t.responseId),e.runStatus=Qv(e)?"running":"idle";return}case"response.output_item.done":{hi(e);let n=t.item;if(n.type==="message"&&n.data.role==="assistant"&&((s=e.turns[t.responseId])==null?void 0:s.status)==="cancelled"){const l=e.byId[`interrupted_${t.responseId}`];l!==void 0&&ad(e,l),n={...n,data:{...n.data,interrupted:!0}}}Qn(e,n);return}case"response.completed":{hi(e);const n=e.turns[t.responseId];e.turns[t.responseId]={...n,status:(n==null?void 0:n.status)==="cancelled"?"cancelled":"completed",usage:t.usage},Mf(e,t.responseId),!Qv(e)&&e.runStatus!=="failed"&&(e.runStatus="idle");return}case"response.failed":{hi(e);const n=e.turns[t.responseId];e.turns[t.responseId]={...n,status:"failed"},e.items.some(u=>u.kind==="error"&&u.responseId===t.responseId&&u.code===t.error.code)||qs(e,{kind:"error",id:`failed_${t.responseId}_${t.error.code}`,responseId:t.responseId,source:t.error.source,code:t.error.code,message:t.error.message}),Mf(e,t.responseId),e.runStatus=Qv(e)?"running":"idle";return}case"session.input.consumed":{hi(e),Qn(e,t.item);return}case"session.todos":{e.todos=t.todos;return}case"session.rotated":{qs(e,{kind:"divider",id:`rotate_${t.newSessionId}`,responseId:`rotate_${t.newSessionId}`,label:t.kind==="fork"?"forked to a new session":"context cleared — new session",newSessionId:t.newSessionId,rotateKind:t.kind}),e.runStatus="idle",hi(e);return}}}function kF(e,t){var r;switch(t.kind){case"reset":return tp();case"snapshot":{const s=v2(e);for(const n of af(t.items))Qn(s,n);return x2(s,t.runtime),s.historyLoaded=!0,s}case"reconcile_snapshot":{const s=dn(e);for(const n of af(t.items))Qn(s,n);return x2(s,t.runtime),s.historyLoaded=!0,s.error=void 0,s}case"history":{const s=v2(e);for(const n of af(t.items))Qn(s,n);return Wo(s),s.historyLoaded=!0,s}case"reconcile_history":{const s=dn(e);for(const n of af(t.items))Qn(s,n);return Wo(s),s.historyLoaded=!0,s.error=void 0,s}case"event":{const s=dn(e);return CF(s,t.event),Wo(s),s}case"optimistic_user":{const s=dn(e),n={kind:"message",id:t.id,responseId:t.id,role:"user",text:t.text,images:t.images??[],streaming:!1,optimistic:!0};return s.byId[t.id]=qs(s,n),s}case"discard_optimistic_user":{const s=e.byId[t.id];if(s===void 0||((r=e.items[s])==null?void 0:r.kind)!=="message"||!e.items[s].optimistic)return e;const n=dn(e);return ad(n,s),n}case"stream_error":{const s=dn(e);return s.error=t.message,s}case"stream_done":return e}}function EF(e){let t;for(const r of e.items){const s=e.turns[r.responseId];s&&(t=s)}return t}function RF(e){let t=!1;const r=e.map(s=>s.kind!=="error"?s:s.code==="codex_error"&&s.message==="Codex turn was interrupted"||s.code==="traex_error"&&s.message==="Traex turn was interrupted"?(t=!0,{...s,code:"response_stopped",message:"Response stopped"}):s.code==="codex_error"&&s.message==="Codex turn failed"||s.code==="traex_error"&&s.message==="Traex turn failed"||s.code==="claude_error"&&s.message==="claude turn failed"?(t=!0,{...s,code:"agent_error",message:"Agent turn failed"}):s);return t?r:e}const yx="browser:",bx="emulator:",w2=.44,Pu=360,NF=420;function jF(e){return e?e==="browser"?{type:"browser",pageId:null}:e.startsWith(yx)?{type:"browser",pageId:e.slice(yx.length).trim()||null}:e==="emulator"?{type:"emulator",bindingId:null}:e.startsWith(bx)?{type:"emulator",bindingId:e.slice(bx.length).trim()||null}:null:null}function ln(e){return e?`${yx}${e}`:"browser"}function cn(e){return e?`${bx}${e}`:"emulator"}function S2(e,t){const r=new Set(t),s=new Set,n=[];for(const l of e)!r.has(l)||s.has(l)||(s.add(l),n.push(l));for(const l of t)s.has(l)||(s.add(l),n.push(l));return n}function of(e,t){const r=Math.max(0,e),s=Math.max(0,r-NF),n=Math.min(Pu,s);return Math.min(s,Math.max(n,t))}function AF(e,t,r){var s;return!e||e.pages.length===0?null:t&&e.pages.some(n=>n.pageId===t)?t:r&&e.pages.some(n=>n.pageId===r)?r:e.activePageId&&e.pages.some(n=>n.pageId===e.activePageId)?e.activePageId:((s=e.pages[0])==null?void 0:s.pageId)??null}function MF(e,t){return!e||!(t!=null&&t.activePageId)||e.includes(t.activePageId)?null:t.pages.some(r=>r.pageId===t.activePageId)?t.activePageId:null}const Ny="desktop-direct-view",TF=4,DF=5*1024*1024,LF=20*1024*1024,OF=8192,BF=4e7,PF=["image/png","image/jpeg","image/webp"];function IF(){return{enabled:!0,mediaTypes:[...PF],maxImagesPerMessage:TF,maxImageBytes:DF,maxMessageBytes:LF,maxImageSide:OF,maxImagePixels:BF}}new TextEncoder;new TextEncoder;function zF(e,t){const r=new Map;for(const s of t)s.type==="interaction_request"&&r.set(s.data.interaction.interactionId,s);return{status:e.status,...e.statusKind===void 0?{}:{statusKind:e.statusKind},activeResponseIds:[...e.activeResponseIds],pendingInteractions:e.pendingInteractions.flatMap(s=>{const n=r.get(s.interactionId);return!n||n.responseId!==s.responseId?[]:[{responseId:s.responseId,interaction:n.data.interaction}]})}}const $F={"status.get":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:null},"provider.cli.status.list":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.provider-cli.status.v1"},"project.list":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.project.manage.v1"},"project.get":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.project.manage.v1"},"project.create":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.project.manage.v1"},"project.update":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.project.manage.v1"},"project.delete":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.project.manage.v1"},"emulator.devices.list":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.emulator.unary.v1"},"emulator.active.get":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.emulator.unary.v1"},"emulator.attach":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.emulator.unary.v1"},"emulator.tap":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.emulator.unary.v1"},"emulator.type":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.emulator.unary.v1"},"emulator.button":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.emulator.unary.v1"},"emulator.rotate":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.emulator.unary.v1"},"emulator.launch":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.emulator.unary.v1"},"emulator.gesture":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.emulator.unary.v1"},"emulator.kill":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.emulator.unary.v1"},"emulator.shutdown":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.emulator.unary.v1"},"session.emulator.state.get":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.emulator.v1"},"session.emulator.devices.list":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.emulator.v1"},"session.emulator.attach":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.emulator.v1"},"session.emulator.detach":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.emulator.v1"},"session.emulator.tap":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.emulator.v1"},"session.emulator.type":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.emulator.v1"},"session.emulator.button":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.emulator.v1"},"session.emulator.rotate":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.emulator.v1"},"session.emulator.launch":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.emulator.v1"},"session.emulator.gesture":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.emulator.v1"},"session.list":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.list.v1"},"session.agentOptions.list":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.agent-options.v1"},"session.launchOptions.list":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.launch-options.v2"},"session.execution.get":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.execution-settings.v1"},"session.execution.update":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.execution-settings.v1"},"session.create":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.create.v1"},"session.fork":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.fork.v1"},"session.message.send":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.message.v1"},"session.resource.policy.get":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.resources.v1"},"session.resource.upload.begin":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.resources.v1"},"session.resource.upload.chunk":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.resources.v1"},"session.resource.upload.commit":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.resources.v1"},"session.resource.get":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.resources.v1"},"session.resource.read":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.resources.v1"},"session.resource.delete":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.resources.v1"},"session.message.enqueue":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.message-queue.v1"},"session.terminal.start":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.terminal-start.v1"},"session.delete":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.delete.v1"},"session.snapshot.get":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.snapshot.v1"},"session.interrupt":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.interrupt.v1"},"session.interaction.resolve":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.interaction.v1"},"browser.state.get":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.browser.v1"},"browser.open":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.browser.v1"},"browser.close":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.browser.v1"},"browser.page.create":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.browser.v1"},"browser.page.close":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.browser.v1"},"browser.page.activate":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.browser.v1"},"browser.page.navigate":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.browser.v1"},"browser.page.back":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.browser.v1"},"browser.page.forward":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.browser.v1"},"browser.page.reload":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.browser.v1"}};new Set(Object.keys($F));new TextEncoder;let Jv=0;function od(e){const t=globalThis.crypto;if(typeof(t==null?void 0:t.randomUUID)=="function")return`${e}_${t.randomUUID()}`;if(typeof(t==null?void 0:t.getRandomValues)=="function"){const r=t.getRandomValues(new Uint8Array(16));return`${e}_${Array.from(r,s=>s.toString(16).padStart(2,"0")).join("")}`}return Jv=Jv+1>>>0,`${e}_${Date.now().toString(36)}_${Jv.toString(36)}`}const UF=256,HF=4*1024*1024;function FF(e,t,r,s){return e||(r?t:s)}function WF(e){return e.type==="response.created"||e.type==="session.input.consumed"}function C2(e,t,r){return r&&e!==null&&t===e}function qF(e,t){return e&&t}function VF(e){const t=Object.entries(e);for(let r=t.length-1;r>=0;r-=1){const s=t[r];if((s==null?void 0:s[1].status)==="running")return s[0]}}function GF(e,{runtimeSelector:t,allowSend:r=!0}={}){const[s,n]=g.useReducer(kF,void 0,tp),[l,u]=g.useState(!1),[d,m]=g.useState(!1),f=g.useRef(null),v=g.useRef(0),p=g.useRef(null),x=g.useRef(null),b=g.useRef(0);g.useEffect(()=>{if(n({kind:"reset"}),p.current=null,x.current=null,u(!1),m(!1),!e)return;const k=new AbortController;let S=!1,E=!0,N;return(async()=>{let A=500;for(;!k.signal.aborted;){const D=new AbortController,B=()=>D.abort();k.signal.addEventListener("abort",B,{once:!0});let $=!1,q=!1,Y=!1;const V={events:[],utf8Bytes:0};let U,L;const I=new Promise((P,O)=>{U=P,L=O}),F=xe.streamSession(e,P=>{if(!(S||D.signal.aborted))if(P.event==="ready"){const O=KF(N,P.data);N=O.daemonInstanceId,O.changed&&(E=!0,n({kind:"reset"}),m(!1)),U()}else if(P.event==="event"){const O=P.data,W=p.current;W!==null&&WF(O)&&(x.current=W,C2(p.current,x.current,$)&&(p.current=null,x.current=null,u(!1))),$?n({kind:"event",event:O}):YF(V,O)||(Y=!0,D.abort())}else P.event==="error"&&n({kind:"stream_error",message:String(P.data.message??"stream error")})},D.signal,t).then(()=>(L(new Error("session stream closed before ready")),{error:void 0})).catch(P=>(L(P),{error:P}));try{await I,A=500;let P=500,O,W=0;const H=[];for(;;){const T=new AbortController,G=()=>T.abort();D.signal.addEventListener("abort",G,{once:!0}),D.signal.aborted&&T.abort();const X=t?xe.getSessionSnapshotPage(e,O,T.signal,t).then(Z=>({kind:"snapshot_page",page:Z})).catch(Z=>({kind:"snapshot_error",error:Z})):xe.getSessionSnapshot(e,T.signal).then(Z=>({kind:"snapshot",snapshot:Z})).catch(Z=>({kind:"snapshot_error",error:Z})),ee=await Promise.race([X,F.then(()=>({kind:"stream_ended"}))]);if(D.signal.removeEventListener("abort",G),ee.kind==="stream_ended"){T.abort();break}if(S||k.signal.aborted)return;if(Y)break;if(ee.kind==="snapshot_page"){const{page:Z}=ee;if(Z.sessionId!==e||Z.hasMore&&(!Z.nextAfterId||Z.nextAfterId===O)){n({kind:"stream_error",message:"Session snapshot page did not advance"}),D.abort();break}if(H.push(...Z.items),n({kind:E&&W===0?"history":"reconcile_history",items:Z.items}),W+=1,P=500,Z.hasMore){O=Z.nextAfterId;continue}n({kind:"reconcile_snapshot",items:[],runtime:zF(Z.runtime,H)}),q=!0,E=!1;break}if(ee.kind==="snapshot"){const{snapshot:Z}=ee;n({kind:E?"snapshot":"reconcile_snapshot",items:Z.items,runtime:Z.runtime}),q=!0,E=!1;break}const{error:oe}=ee;n({kind:"stream_error",message:oe instanceof Error?oe.message:String(oe)});const de=await Promise.race([F.then(()=>"stream_ended"),k2(P,k.signal).then(()=>"retry")]);if(k.signal.aborted)return;if(de==="stream_ended")break;P=Math.min(P*2,8e3)}}catch(P){!S&&!k.signal.aborted&&!Y&&n({kind:"stream_error",message:P instanceof Error?P.message:String(P)})}finally{if(Y||($=!0),!S&&!k.signal.aborted&&!Y){for(const P of V.events.splice(0))n({kind:"event",event:P});V.utf8Bytes=0,q&&(m(!0),C2(p.current,x.current,!0)&&(p.current=null,x.current=null,u(!1)))}}const M=await F;if(S||m(!1),k.signal.removeEventListener("abort",B),D.abort(),k.signal.aborted)return;M.error,await k2(A,k.signal),A=Math.min(A*2,8e3)}})(),()=>{S=!0,k.abort()}},[t,e]);const w=g.useCallback(async k=>{if(!e||!r)return;const S=typeof k=="string"?k:k.text,E=typeof k=="string"?[]:k.images,N=typeof k=="string"?void 0:k.clientMessageId??od("msg"),R=new AbortController,A=++v.current;f.current=R,p.current=A,x.current=null,u(!0);const D=`optimistic_${b.current++}`;n({kind:"optimistic_user",id:D,text:S,images:E});try{await xe.sendSessionMessage(e,E.length===0?S:{content:[...E.map(B=>({type:"input_image",resourceId:B.resourceId,mediaType:B.mediaType,...B.filename?{filename:B.filename}:{},...B.byteLength?{byteLength:B.byteLength}:{},...B.width?{width:B.width}:{},...B.height?{height:B.height}:{}})),...S?[{type:"input_text",text:S}]:[]],clientMessageId:N},()=>{},R.signal,t)}catch(B){throw R.signal.aborted||(Jm(B)&&n({kind:"discard_optimistic_user",id:D}),n({kind:"stream_error",message:B.message})),p.current===A&&(p.current=null,x.current=null,u(!1)),B}finally{f.current===R&&(f.current=null)}},[r,t,e]),C=g.useCallback(async()=>{var S;if((S=f.current)==null||S.abort(),p.current=null,x.current=null,u(!1),!e)return;const k=VF(s.turns);k&&n({kind:"event",event:{type:"session.interrupted",sessionId:e,responseId:k}});try{await xe.interruptSession(e,t)}catch{}},[t,e,s.turns]);return g.useEffect(()=>{if(!l)return;if(qF(d,s.runStatus==="running"||s.waitingForInteraction)){p.current=null,x.current=null,u(!1);return}const k=p.current,S=window.setTimeout(()=>{p.current===k&&(p.current=null,x.current=null,u(!1))},15e3);return()=>window.clearTimeout(S)},[d,l,s.runStatus,s.waitingForInteraction]),{state:s,pendingSend:l,current:d,send:w,stop:C}}function YF(e,t,r={}){const s=r.events??UF,n=r.utf8Bytes??HF;let l;try{l=new TextEncoder().encode(JSON.stringify(t)).byteLength}catch{return!1}return e.events.length>=s||l>n||e.utf8Bytes+l>n?!1:(e.events.push(t),e.utf8Bytes+=l,!0)}function KF(e,t){const r=t&&typeof t=="object"&&!Array.isArray(t)?t.daemonInstanceId:void 0;return typeof r!="string"||r.length===0?{daemonInstanceId:e,changed:!1}:{daemonInstanceId:r,changed:e!==void 0&&e!==r}}function k2(e,t){return t.aborted?Promise.resolve():new Promise(r=>{const s=window.setTimeout(n,e);t.addEventListener("abort",n,{once:!0});function n(){window.clearTimeout(s),t.removeEventListener("abort",n),r()}})}const XF=1,E2=32*1024,R2=4*1024*1024,ZF=4096,QF=4096,JF=8847360,eW=4*1024,wx=512,tW=1024,N2=new Uint8Array([82,66,83,70]),Kl=38,rW=1,sW=2,cm=new TextEncoder,iW=new TextDecoder("utf-8",{fatal:!0});function nW(e){const t=oW(e);switch(t.type){case"browser.surface.ready":{e_(t,["type","subscriptionId","browserGeneration","viewportRevision","sourceWidth","sourceHeight","deviceScaleFactor","format","grantedRole"],"Browser Surface ready frame");const r=um(t.sourceWidth,"sourceWidth"),s=um(t.sourceHeight,"sourceHeight");return KA(r,s),{type:"browser.surface.ready",subscriptionId:Iu(t.subscriptionId,"subscriptionId"),browserGeneration:j2(t.browserGeneration,"browserGeneration"),viewportRevision:uW(t.viewportRevision,"viewportRevision"),sourceWidth:r,sourceHeight:s,deviceScaleFactor:hW(t.deviceScaleFactor,.25,8,"deviceScaleFactor"),format:fW(t.format),grantedRole:Tf(t.grantedRole,["view","control"],"grantedRole")}}case"browser.surface.driver.changed":{e_(t,["type","subscriptionId","browserGeneration","driver","driverSubscriptionId"],"driver changed frame",!0);const r=Tf(t.driver,["none","desktop","stream"],"driver"),s=t.driverSubscriptionId===void 0?void 0:Iu(t.driverSubscriptionId,"driverSubscriptionId");if(r==="stream"!=(s!==void 0))throw er("driverSubscriptionId is required only when driver is stream");return{type:"browser.surface.driver.changed",subscriptionId:Iu(t.subscriptionId,"subscriptionId"),browserGeneration:j2(t.browserGeneration,"browserGeneration"),driver:r,...s===void 0?{}:{driverSubscriptionId:s}}}case"browser.surface.closed":{e_(t,["type","subscriptionId","reason","message"],"Browser Surface closed frame",!0);const r=t.message===void 0?void 0:cW(t.message,"message",tW);return{type:"browser.surface.closed",subscriptionId:Iu(t.subscriptionId,"subscriptionId"),reason:Tf(t.reason,["browser_closed","page_closed","generation_changed","replaced","cancelled","unauthorized","unsupported","capacity","idle_timeout","protocol_error","internal_error"],"reason"),...r===void 0?{}:{message:r}}}default:throw er("unknown Browser Surface server frame type")}}function aW(e){if(!(e instanceof Uint8Array)||e.byteLength<Kl+1||e.byteLength>Kl+wx+R2)throw er("Browser Surface image frame has an invalid byte length");for(let x=0;x<N2.length;x+=1)if(e[x]!==N2[x])throw er("Browser Surface image frame has invalid magic");const t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.getUint8(4)!==XF||t.getUint16(6,!1)!==0)throw er("Browser Surface image frame header is unsupported");const r=t.getUint8(5),s=r===rW?"jpeg":r===sW?"png":void 0;if(s===void 0)throw er("Browser Surface image frame format is unsupported");const n=t.getUint16(32,!1),l=t.getUint32(34,!1);if(n===0||n>wx||l===0||l>R2||Kl+n+l!==e.byteLength)throw er("Browser Surface image frame lengths are invalid");let u;try{u=iW.decode(e.subarray(Kl,Kl+n))}catch{throw er("subscriptionId must be valid UTF-8")}u=Iu(u,"subscriptionId");const d=A2(t.getBigUint64(8,!1),"frameSequence"),m=t.getUint32(16,!1),f=A2(t.getBigUint64(20,!1),"timestampMilliseconds"),v=um(t.getUint16(28,!1),"width"),p=um(t.getUint16(30,!1),"height");return KA(v,p),{subscriptionId:u,frameSequence:d,viewportRevision:m,timestampMilliseconds:f,width:v,height:p,format:s,encodedBytes:new Uint8Array(e.subarray(Kl+n))}}function oW(e){let t=e;if(typeof e=="string"){if(cm.encode(e).byteLength>E2)throw er("Browser Surface control frame exceeds its byte limit");try{t=JSON.parse(e)}catch{throw er("Browser Surface control frame must be valid JSON")}}const r=lW(t,"Browser Surface control frame");let s;try{s=JSON.stringify(r)}catch{throw er("Browser Surface control frame must be serializable")}if(cm.encode(s).byteLength>E2)throw er("Browser Surface control frame exceeds its byte limit");return r}function lW(e,t){if(typeof e!="object"||e===null||Array.isArray(e))throw er(`${t} must be an object`);return e}function e_(e,t,r,s=!1){const n=Object.keys(e),l=s?t.length-1:t.length;if(n.length<l||n.length>t.length||n.some(u=>!t.includes(u))||t.slice(0,l).some(u=>!Object.hasOwn(e,u)))throw er(`${r} contains unknown or missing fields`)}function Iu(e,t){if(typeof e!="string"||e.length===0||cm.encode(e).byteLength>wx||!/^[\x21-\x7e]+$/.test(e))throw er(`${t} must be a bounded opaque identifier`);return e}function cW(e,t,r){if(typeof e!="string"||e.includes("\0")||cm.encode(e).byteLength>r)throw er(`${t} exceeds its text byte limit`);return e}function j2(e,t){if(!Number.isSafeInteger(e)||e<1)throw er(`${t} must be a positive safe integer`);return e}function uW(e,t){if(!Number.isSafeInteger(e)||e<0)throw er(`${t} must be a nonnegative safe integer`);return e}function dW(e,t,r,s){if(!Number.isInteger(e)||e<t||e>r)throw er(`${s} must be an integer from ${t} to ${r}`);return e}function hW(e,t,r,s){if(typeof e!="number"||!Number.isFinite(e)||e<t||e>r)throw er(`${s} must be a finite number from ${t} to ${r}`);return e}function um(e,t){const r=t.toLowerCase().includes("height")?QF:ZF;return dW(e,1,r,t)}function KA(e,t){if(e*t>JF)throw er("Browser Surface viewport exceeds its maximum pixels")}function fW(e){return Tf(e,["jpeg","png"],"format")}function Tf(e,t,r){if(typeof e!="string"||!t.includes(e))throw er(`${r} is unsupported`);return e}function A2(e,t){if(e>BigInt(Number.MAX_SAFE_INTEGER))throw er(`${t} exceeds a safe integer`);return Number(e)}function er(e){return new TypeError(`Invalid Runtime Browser Surface: ${e}`)}const M2=1e4,mW=16,t_=1,T2=[500,1e3,2e3,4e3,8e3,15e3];function pW(e){const t=Math.max(0,Math.min(Math.trunc(e),T2.length-1));return T2[t]}function gW(e){return e===1e3||e===1001||e===1006||e===1012||e===4408}function vW(e){return e==="browser_closed"||e==="generation_changed"||e==="cancelled"||e==="capacity"||e==="idle_timeout"||e==="internal_error"}function XA(e){const t=e.trim();if(t)return/^[A-Za-z][A-Za-z\d+.-]*:/.test(t)?t:`https://${t}`}function lf(e){return!(e instanceof Error)||!e.message?"Browser operation failed":e.message==="failed_precondition"?"Browser Host is unavailable. On a headless Runtime, run `rynx browser install` on that host.":e.message.replaceAll("_"," ")}function _W(e,t,r){return r&&e==="local"&&t.executionBackend==="embedded-electron"&&t.capabilities.includes(Ny)}function xW(e,t,r){return!r||e!=="local"?!1:t.status==="unavailable"?!0:t.status==="ready"&&t.executionBackend==="headless-chromium"}function yW(e,t,r){return r&&e==="local"&&t.status==="ready"&&t.executionBackend==="embedded-electron"&&!t.capabilities.includes(Ny)}async function bW(e,t){var l,u,d,m;const r=e.pages.findIndex(f=>f.pageId===e.activePageId);await t.close(e.browserGeneration);let s=await t.open((l=e.pages[0])==null?void 0:l.url);(u=t.onProgress)==null||u.call(t,s);for(const f of e.pages.slice(1))s=await t.createPage(s.browserGeneration,f.url),(d=t.onProgress)==null||d.call(t,s);const n=r>=0?s.pages[r]:void 0;return n&&s.activePageId!==n.pageId&&(s=await t.activatePage(s.browserGeneration,n.pageId),(m=t.onProgress)==null||m.call(t,s)),s}function wW({scrollLeft:e,viewportWidth:t,contentWidth:r,availableWidth:s=t}){const n=Math.max(0,r-t),l=r-s>t_;return{hasOverflow:l,canScrollLeft:l&&e>t_,canScrollRight:l&&e<n-t_}}function SW(e){return Math.max(120,e*.75)}function CW({scrollLeft:e,viewportWidth:t,tabLeft:r,tabWidth:s,inset:n=4}){const l=e,u=e+t,d=Math.max(0,r-n),m=r+s+n;return d<l?d-l:m>u?m-u:0}function kW(e,t,r,s){return{deltaX:D2(e+r),deltaY:D2(t+s)}}function D2(e){return Number.isFinite(e)?Math.max(-M2,Math.min(M2,e)):0}function EW(e){if(!e)return[];const t=new TextEncoder,r=[];let s="",n=0;for(const l of e){const u=t.encode(l).byteLength;if(n+u>eW){if(r.push(s),r.length>=mW)throw new RangeError("Browser text input is too large");s="",n=0}s+=l,n+=u}return s&&r.push(s),r}function RW(e,t){if(t.type==="pointerdown"){const s=L2(t.button);return s&&e.set(t.pointerId,s),s}const r=e.get(t.pointerId);return e.delete(t.pointerId),r??L2(t.button)}function L2(e){if(e===0)return"left";if(e===1)return"middle";if(e===2)return"right";if(e===3)return"back";if(e===4)return"forward"}const NW=1,jW=2;function AW({runtimeSelector:e,sessionId:t,browserGeneration:r,pageId:s,toolbarHost:n,readOnly:l=!1}){const u=g.useRef(null),d=g.useRef(null),m=g.useRef(void 0),f=g.useRef(void 0),v=g.useRef(0),p=g.useRef(0),x=g.useRef(0),b=g.useRef(0),w=g.useRef(void 0),C=g.useRef(!1),k=g.useRef(!1),S=g.useRef(!1),E=g.useRef(void 0),N=g.useRef(void 0),R=g.useRef(void 0),A=g.useRef(new Map),[D,B]=g.useState("connecting"),[$,q]=g.useState(),[Y,V]=g.useState(),[U,L]=g.useState("none"),[I,F]=g.useState(),[M,P]=g.useState(!1),[O,W]=g.useState(!1),H=U==="stream"&&I===(Y==null?void 0:Y.subscriptionId),T=g.useCallback(()=>{R.current!==void 0&&(window.cancelAnimationFrame(R.current),R.current=void 0),E.current=void 0,N.current=void 0,A.current.clear()},[]),G=g.useCallback(()=>{w.current!==void 0&&(window.clearTimeout(w.current),w.current=void 0)},[]),X=g.useCallback(async({refreshCapability:_e=!1,preserveFrame:Re=!1}={})=>{var qe;G();const Pe=++x.current;(qe=m.current)==null||qe.close(1e3,"Browser Surface reconnecting"),m.current=void 0,f.current=void 0,v.current=0,p.current=0,S.current=!1,k.current=!1,T(),B("connecting"),q(void 0),V(void 0),L("none"),F(void 0),W(!1),Re||(C.current=!1,P(!1));const Ue=Ie=>{if(x.current!==Pe)return;q(Ie),B("connecting");const Ve=pW(b.current++);w.current=window.setTimeout(()=>{w.current=void 0,X({preserveFrame:!0})},Ve)};try{const Ie=await id(_e);if(x.current!==Pe)return;const Ve=new WebSocket(DW({runtimeSelector:e,sessionId:t,pageId:s,browserGeneration:r,capability:Ie,readOnly:l}));Ve.binaryType="arraybuffer",m.current=Ve;let ct=_e,Qr=!1;Ve.onmessage=Ct=>{var cs;if(x.current!==Pe||m.current!==Ve)return;if(typeof Ct.data=="string"){try{const tr=JSON.parse(Ct.data);if(tr&&typeof tr=="object"&&"type"in tr&&tr.type==="error"){const Et="message"in tr&&typeof tr.message=="string"?tr.message:"Browser Surface failed";q(Et);return}const kt=nW(tr);if(kt.type==="browser.surface.ready"){f.current=kt,v.current=kt.viewportRevision,G(),V(kt),B("ready");return}if(kt.type==="browser.surface.driver.changed"){const Et=kt.driver==="stream"&&kt.driverSubscriptionId===((cs=f.current)==null?void 0:cs.subscriptionId);S.current=Et,Et||T(),L(kt.driver),F(kt.driverSubscriptionId);return}S.current=!1,T();const Ge=kt.message??LW(kt.reason);Qr=!0,vW(kt.reason)?(Ue(Ge),Ve.close(1e3,"recovering Browser Surface")):(q(Ge),B("closed"))}catch{Qr=!0,q("Browser Surface sent an invalid control frame"),B("closed"),Ve.close(4400,"invalid Browser Surface control")}return}if(!(Ct.data instanceof ArrayBuffer)){q("Browser Surface sent an invalid image frame"),Ve.close(4400,"invalid Browser Surface image");return}const Nr=()=>x.current===Pe&&m.current===Ve;MW(Ct.data,Ve,u.current,f.current,Nr).then(tr=>{tr===void 0||!Nr()||(v.current=tr,C.current=!0,k.current=!0,b.current=0,P(!0),W(!0))}).catch(()=>{Nr()&&(Qr=!0,q("Browser preview could not be decoded"),B("closed"),Ve.close(4400,"Browser Surface image decode failed"))})},Ve.onclose=Ct=>{if(!(x.current!==Pe||m.current!==Ve)&&(m.current=void 0,S.current=!1,T(),!Qr)){if((Ct.code===4403||Ct.code===1006)&&!ct){ct=!0,X({refreshCapability:!0,preserveFrame:!0});return}if(gW(Ct.code)){Ue(P2(Ct.code));return}B("closed"),q(Nr=>Nr??P2(Ct.code))}},Ve.onerror=()=>{m.current===Ve&&q("Browser preview transport failed")}}catch(Ie){if(x.current!==Pe)return;Ue(Ie instanceof Error?Ie.message:"Browser preview could not connect")}},[e,t,s,r,l,T,G]);g.useEffect(()=>(X(),()=>{var _e;x.current+=1,G(),T(),(_e=m.current)==null||_e.close(1e3,"Browser Surface view unmounted"),m.current=void 0}),[X,T,G]);const ee=g.useCallback(()=>{b.current=0,X({preserveFrame:!0})},[X]),oe=g.useCallback(_e=>{const Re=m.current;return!Re||Re.readyState!==WebSocket.OPEN?!1:(Re.send(JSON.stringify(_e)),!0)},[]),de=g.useCallback(()=>{var Re;const _e=f.current;!_e||!k.current||(oe({type:"browser.surface.driver.take",subscriptionId:_e.subscriptionId,browserGeneration:_e.browserGeneration,viewportRevision:v.current}),(Re=d.current)==null||Re.focus())},[oe]),Z=g.useCallback(()=>{const _e=f.current;_e&&(T(),d.current&&(d.current.value=""),oe({type:"browser.surface.driver.release",subscriptionId:_e.subscriptionId,browserGeneration:_e.browserGeneration}))},[oe,T]),ce=g.useCallback(_e=>{const Re=f.current;return!Re||!k.current||!S.current?!1:oe({type:"browser.surface.input",subscriptionId:Re.subscriptionId,browserGeneration:Re.browserGeneration,viewportRevision:v.current,inputSequence:p.current++,event:_e})},[oe]),le=g.useCallback(_e=>{let Re;try{Re=EW(_e)}catch{return q("Text input is limited to 64 KiB at a time."),!1}let Pe=!1;for(const Ue of Re){if(!ce({type:"text.insert",text:Ue}))return Pe;Pe=!0}return Pe},[ce]),be=g.useCallback(()=>{R.current!==void 0&&(window.cancelAnimationFrame(R.current),R.current=void 0);const _e=E.current,Re=N.current;E.current=void 0,N.current=void 0,S.current&&(_e&&ce({..._e}),Re&&ce({...Re}))},[ce]),ke=g.useCallback(()=>{R.current===void 0&&(R.current=window.requestAnimationFrame(be))},[be]);g.useEffect(()=>{S.current=H,H||(T(),d.current&&(d.current.value="",d.current.blur()))},[H,T]);const Ee=g.useCallback(_e=>{var Ie;if(!H)return;const Re=O2(_e.currentTarget,_e.clientX,_e.clientY);if(!Re)return;if(_e.type==="pointermove"){E.current={type:"pointer.move",...Re,modifiers:cf(_e)},ke(),_e.preventDefault();return}be(),_e.type==="pointerdown"&&((Ie=d.current)==null||Ie.focus(),_e.currentTarget.setPointerCapture(_e.pointerId));const Pe=_e.type==="pointerdown"?"pointer.down":"pointer.up",Ue=RW(A.current,_e);if(!Ue)return;const qe={type:Pe,...Re,button:Ue,modifiers:cf(_e)};ce(qe)&&_e.preventDefault()},[H,ce,be,ke]),te=g.useCallback(_e=>{if(!H)return;const Re=O2(_e.currentTarget,_e.clientX,_e.clientY);if(!Re)return;const Pe=_e.deltaMode===NW?16:_e.deltaMode===jW?Math.max(1,_e.currentTarget.clientHeight):1,Ue=N.current,qe=kW((Ue==null?void 0:Ue.deltaX)??0,(Ue==null?void 0:Ue.deltaY)??0,_e.deltaX*Pe,_e.deltaY*Pe);N.current={type:"wheel",...Re,...qe,modifiers:cf(_e)},ke(),_e.preventDefault()},[H,ke]),re=g.useCallback(_e=>{if(_e.nativeEvent.isComposing||_e.key==="Process"||_e.key==="Dead")return;be();const Re=ce({type:_e.type==="keydown"?"key.down":"key.up",key:_e.key,code:_e.code,repeat:_e.repeat,modifiers:cf(_e)}),Pe=TW({type:_e.type,key:_e.key,altKey:_e.altKey,ctrlKey:_e.ctrlKey,metaKey:_e.metaKey,isComposing:_e.nativeEvent.isComposing}),Ue=Pe===void 0?!1:le(Pe);(Re||Ue)&&_e.preventDefault()},[ce,le,be]),Ce=g.useCallback(_e=>{be();const Re=_e.clipboardData.getData("text/plain");Re&&le(Re)&&_e.preventDefault()},[le,be]),De=g.useCallback(_e=>{const Re=_e.data||_e.currentTarget.value;_e.currentTarget.value="",Re&&le(Re)},[le]);return o.jsxs("div",{className:"relative flex min-h-0 flex-1 items-center justify-center overflow-hidden bg-[#111318]",children:[o.jsx("canvas",{ref:u,className:"max-h-full max-w-full outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--ring)]","aria-label":H?"Interactive browser preview":"Browser preview",tabIndex:-1,onPointerMove:Ee,onPointerDown:Ee,onPointerUp:Ee,onPointerCancel:Ee,onWheel:te}),o.jsx("textarea",{ref:d,"aria-label":"Browser keyboard input",className:"pointer-events-none absolute left-0 top-0 size-px resize-none opacity-0",tabIndex:H?0:-1,autoComplete:"off",spellCheck:!1,onKeyDown:re,onKeyUp:re,onPaste:Ce,onCompositionEnd:De}),D==="connecting"&&o.jsx(B2,{preserveFrame:M,icon:o.jsx(ze,{className:"size-5 animate-spin"}),label:M?"Reconnecting preview…":"Connecting preview…"}),D==="ready"&&!O&&o.jsx(B2,{icon:o.jsx(ze,{className:"size-5 animate-spin"}),label:"Waiting for first frame…"}),D==="closed"&&o.jsx("div",{className:"absolute inset-0 grid place-items-center bg-[#111318]/90 px-6 text-center",children:o.jsxs("div",{className:"max-w-sm",children:[o.jsx("p",{className:"text-sm font-medium text-white",children:"Preview disconnected"}),o.jsx("p",{role:"alert",className:"mt-1 text-xs leading-5 text-white/60",children:$??"The Browser Surface ended."})]})}),n&&na.createPortal(o.jsx("div",{className:"flex items-center",children:D==="closed"?o.jsx(ne,{size:"icon-sm",variant:"outline",className:"size-8","aria-label":"Reconnect browser preview",title:"Reconnect browser preview",onClick:ee,children:o.jsx(_t,{className:"size-4"})}):D!=="ready"||!O?o.jsx(ne,{size:"icon-sm",variant:"outline",className:"size-8","aria-label":C.current?"Reconnecting browser preview":"Connecting browser preview",title:C.current?"Reconnecting browser preview":"Connecting browser preview",disabled:!0,children:o.jsx(ze,{className:"size-4 animate-spin"})}):l?o.jsx(ne,{size:"icon-sm",variant:"outline",className:"size-8","aria-label":"Browser preview is read only",title:"Browser preview is read only",disabled:!0,children:o.jsx(eC,{className:"size-4"})}):H?o.jsx(ne,{size:"icon-sm",variant:"outline",className:"size-8","aria-label":"Release browser control",title:"Release browser control",onClick:Z,children:o.jsx(eC,{className:"size-4"})}):o.jsx(ne,{size:"icon-sm",className:"size-8","aria-label":"Take browser control",title:"Take browser control",onClick:de,children:o.jsx(QO,{className:"size-4"})})}),n),o.jsx("p",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:$??(H?"Browser control active":`Browser preview ${D}`)})]})}async function MW(e,t,r,s,n){const l=aW(new Uint8Array(e));if(!s||l.subscriptionId!==s.subscriptionId||l.format!==s.format)throw new Error("Browser Surface image does not match the active subscription");const u=await createImageBitmap(new Blob([l.encodedBytes],{type:l.format==="jpeg"?"image/jpeg":"image/png"}));try{if(!n()||!r||t.readyState!==WebSocket.OPEN)return;r.width=l.width,r.height=l.height;const d=r.getContext("2d",{alpha:!1});if(!d)throw new Error("Browser preview canvas is unavailable");return d.drawImage(u,0,0,l.width,l.height),t.send(JSON.stringify({type:"browser.surface.frame.ack",subscriptionId:s.subscriptionId,frameSequence:l.frameSequence})),l.viewportRevision}finally{u.close()}}function TW(e){if(!(e.type!=="keydown"||e.isComposing||e.key==="Process"||e.key==="Dead"||e.altKey||e.ctrlKey||e.metaKey||Array.from(e.key).length!==1))return e.key}function DW(e){const t=location.protocol==="https:"?"wss":"ws",r=new URLSearchParams({generation:String(e.browserGeneration),role:e.readOnly?"view":"control",format:"jpeg",quality:"75",maximumFrameRate:"15",capability:e.capability});return ky(r),`${t}://${location.host}/api/runtimes/${encodeURIComponent(e.runtimeSelector)}/sessions/${encodeURIComponent(e.sessionId)}/browser/pages/${encodeURIComponent(e.pageId)}/surface?${r.toString()}`}function O2(e,t,r){const s=e.getBoundingClientRect();if(!(s.width<=0||s.height<=0||e.width<=0||e.height<=0))return{x:Math.max(0,Math.min(e.width,(t-s.left)*e.width/s.width)),y:Math.max(0,Math.min(e.height,(r-s.top)*e.height/s.height))}}function cf(e){const t=[];return e.altKey&&t.push("alt"),e.ctrlKey&&t.push("control"),e.metaKey&&t.push("meta"),e.shiftKey&&t.push("shift"),t}function B2({icon:e,label:t,preserveFrame:r=!1}){return o.jsx("div",{className:r?"absolute inset-0 grid place-items-center bg-[#111318]/55 text-white":"absolute inset-0 grid place-items-center bg-[#111318] text-white/70",children:o.jsxs("div",{role:"status",className:"flex flex-col items-center gap-3 text-sm",children:[e,t]})})}function LW(e){return e==="replaced"?"This preview was opened somewhere else.":e==="generation_changed"?"The Browser was restarted.":e==="page_closed"?"This Browser page was closed.":e==="idle_timeout"?"The Browser preview timed out.":e==="unauthorized"?"Browser preview authorization expired.":"The Browser preview ended."}function P2(e){return e===4403?"Browser preview authorization failed.":e===4406?"The selected Runtime cannot provide this Browser preview.":e===4408?"The Browser preview client was too slow.":e===1012?"The selected Runtime disconnected.":"The Browser preview connection closed."}const OW=400;function BW({runtimeSelector:e,sessionId:t,browserGeneration:r,pageId:s}){const n=g.useRef(null),[l,u]=g.useState(0),[d,m]=g.useState("mounting"),[f,v]=g.useState("unavailable"),[p,x]=g.useState(!1),[b,w]=g.useState(),C=g.useMemo(()=>({runtimeSelector:e,sessionId:t,browserGeneration:r,pageId:s}),[e,t,r,s]);g.useEffect(()=>{const S=window.rynxDesktopBrowser,E=n.current;if(!S||!E){m("unavailable");return}let N=!1,R=0,A;const D=r_(C),B=async()=>{if(N)return;const U=PW(E.getBoundingClientRect());if(!U){S.park(C);return}try{const L=await S.mount(C,U);if(N)return;if(L==="mounted"){m("mounted"),A!==void 0&&window.clearTimeout(A),A=void 0;return}}catch{}N||(m("mounting"),A=window.setTimeout(()=>void B(),OW))},$=()=>{window.cancelAnimationFrame(R),R=window.requestAnimationFrame(()=>void B())},q=new ResizeObserver($);q.observe(E),window.addEventListener("resize",$),window.addEventListener("scroll",$,!0);const Y=S.onState(U=>{if(r_(U.resource)===D){if(U.state==="closed"){m("unavailable");return}$()}}),V=S.onDriver(U=>{r_(U.resource)===D&&(v(U.driver),U.driver==="desktop"&&(x(!1),w(void 0)))});return v(S.getDriver(C)),m("mounting"),$(),()=>{N=!0,q.disconnect(),Y(),V(),window.removeEventListener("resize",$),window.removeEventListener("scroll",$,!0),window.cancelAnimationFrame(R),A!==void 0&&window.clearTimeout(A),S.park(C)}},[C,l]);const k=async()=>{const S=window.rynxDesktopBrowser;if(!(!S||p)){x(!0),w(void 0);try{if(await S.takeBack(C)!=="taken")throw new Error("The remote controller is no longer available.")}catch(E){x(!1),w(E instanceof Error?E.message:"Could not take back browser control.")}}};return o.jsxs("div",{ref:n,className:"relative flex min-h-0 flex-1 overflow-hidden bg-white","aria-label":"Embedded session browser page",children:[d!=="mounted"&&o.jsx("div",{className:"absolute inset-0 z-0 grid place-items-center bg-[var(--muted)]/20 p-4 text-center",children:d==="mounting"?o.jsxs("div",{className:"flex items-center gap-2 text-sm text-[var(--muted-foreground)]",children:[o.jsx(ze,{className:"size-4 animate-spin"}),"Attaching the local browser…"]}):o.jsxs("div",{className:"space-y-3",children:[o.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"The local desktop browser is unavailable."}),o.jsxs(ne,{size:"sm",variant:"outline",onClick:()=>u(S=>S+1),children:[o.jsx(_t,{}),"Retry"]})]})}),d==="mounted"&&f==="stream"&&o.jsx("div",{className:"absolute inset-0 z-20 grid place-items-center bg-black/45 p-4 text-center backdrop-blur-[1px]",children:o.jsxs("div",{className:"max-w-sm rounded-lg border border-white/20 bg-[var(--card)] p-4 shadow-lg",children:[o.jsx("p",{className:"text-sm font-medium text-[var(--foreground)]",children:"Controlled from a remote viewer"}),o.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:"Local mouse and keyboard input are paused to prevent two controllers from acting at once."}),o.jsxs(ne,{className:"mt-3",size:"sm",disabled:p,onClick:()=>void k(),children:[p?o.jsx(ze,{className:"animate-spin"}):null,"Take back control"]}),b?o.jsx("p",{role:"alert",className:"mt-2 text-xs text-[var(--destructive)]",children:b}):null]})})]})}function PW(e){const t=Math.max(0,Math.ceil(e.left)),r=Math.max(0,Math.ceil(e.top)),s=Math.min(window.innerWidth,Math.floor(e.right)),n=Math.min(window.innerHeight,Math.floor(e.bottom));return s<=t||n<=r?null:{x:t,y:r,width:s-t,height:n-r}}function r_(e){return JSON.stringify([e.runtimeSelector,e.sessionId,e.browserGeneration,e.pageId])}const IW="size-11 sm:size-8";function zW({sessionId:e,runtimeSelector:t,pageId:r,browserResource:s,readOnly:n=!1}){const{browser:l,loading:u,pendingAction:d,error:m,disabled:f,load:v,openBrowser:p,closeBrowser:x,recreateForDesktop:b,navigatePage:w,backPage:C,forwardPage:k,reloadPage:S}=s,E=g.useMemo(()=>l==null?void 0:l.pages.find(q=>q.pageId===r),[l,r]),N=l!==null&&_W(t,l,typeof window.rynxDesktopBrowser<"u"),R=l!==null&&l.sessionId===e&&xW(t,l,typeof window.rynxDesktopBrowser<"u"),A=l!==null&&l.sessionId===e&&yW(t,l,typeof window.rynxDesktopBrowser<"u"),D=g.useRef(null),[B,$]=g.useState(null);return g.useEffect(()=>{const q=`${t}
|
|
579
|
-
${e}`;n||!R||D.current===q||(D.current=q,b())},[R,n,b,t,e]),u&&l===null?o.jsx(s_,{label:"Loading browser…"}):l===null?n?o.jsx(I2,{label:"Browser is not running for this Session."}):o.jsx($W,{error:m,pending:d!==null,onOpen:q=>void p(q),onRetry:()=>void v(!0)}):o.jsxs("section",{className:"flex min-h-0 flex-1 flex-col overflow-hidden bg-[var(--card)]","aria-label":"Session browser page",children:[o.jsxs("div",{className:"flex shrink-0 flex-wrap items-center gap-1.5 border-b border-[var(--border)] px-2 py-2 sm:flex-nowrap sm:px-3",children:[o.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[o.jsx(uf,{label:"Go back",disabled:f||!(E!=null&&E.canGoBack),onClick:()=>E&&void C(E.pageId),children:o.jsx(Yo,{})}),o.jsx(uf,{label:"Go forward",disabled:f||!(E!=null&&E.canGoForward),onClick:()=>E&&void k(E.pageId),children:o.jsx(sE,{})}),o.jsx(uf,{label:"Reload page",disabled:f||!E,onClick:()=>E&&void S(E.pageId),children:o.jsx(x6,{className:E!=null&&E.loading?"animate-spin":void 0})})]}),E?o.jsx(UW,{page:E,disabled:f,onNavigate:q=>void w(E.pageId,q)},`${E.pageId}
|
|
580
|
-
${E.url}`):o.jsx("div",{className:"h-11 min-w-0 flex-1 rounded-lg border border-[var(--border)] bg-[var(--muted)]/30 sm:h-8"}),!N&&o.jsx("div",{ref:$,className:"flex shrink-0 items-center"}),!n&&A&&o.jsx(ne,{type:"button",variant:"outline",size:"sm",disabled:d!==null,onClick:()=>void b(),children:"Open in app"}),!n&&o.jsx(uf,{label:"Stop browser",disabled:d!==null,onClick:()=>void x(),children:o.jsx(I_,{})})]}),o.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[R?o.jsx(s_,{label:"Opening in Desktop…"}):l.status==="ready"&&E?N?o.jsx(BW,{runtimeSelector:t,sessionId:e,browserGeneration:l.browserGeneration,pageId:E.pageId}):o.jsx(AW,{runtimeSelector:t,sessionId:e,browserGeneration:l.browserGeneration,pageId:E.pageId,readOnly:n,toolbarHost:B}):l.status==="ready"?o.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center text-sm text-[var(--muted-foreground)]",children:"No browser page is open."}):l.status==="unavailable"&&n?o.jsx(I2,{label:"Browser is unavailable."}):l.status==="unavailable"?o.jsx(HW,{error:m,pending:d!==null,onRestart:()=>void p()}):o.jsx(s_,{label:l.status==="closing"?"Closing browser…":"Starting browser…"}),m&&l.status!=="unavailable"&&o.jsx("div",{role:"alert",className:"absolute bottom-3 left-1/2 max-w-[calc(100%-1.5rem)] -translate-x-1/2 rounded-md border border-[var(--destructive)]/30 bg-[var(--card)] px-3 py-2 text-xs text-[var(--destructive)] shadow-sm",children:m})]}),o.jsx("p",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:d??m??(l.status==="ready"?"Browser ready":`Browser ${l.status}`)})]})}function $W({error:e,pending:t,onOpen:r,onRetry:s}){const[n,l]=g.useState(""),u=d=>{d.preventDefault(),r(XA(n))};return o.jsx(xn,{className:"min-h-0 flex-1 bg-[var(--muted)]/20",children:o.jsx("main",{className:"flex min-h-full items-center justify-center p-4 sm:p-6",children:o.jsxs("form",{onSubmit:u,className:"w-full max-w-xl rounded-lg border border-[var(--border)] bg-[var(--card)] p-4 shadow-sm sm:p-6",children:[o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx("span",{className:"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:o.jsx(Xu,{className:"size-5"})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h3",{className:"text-base font-semibold",children:"Open a browser for this session"}),o.jsx("p",{className:"mt-1 text-sm leading-5 text-[var(--muted-foreground)]",children:"The browser runs on the selected Runtime, beside the agent using it."})]})]}),o.jsxs("div",{className:"mt-4 flex flex-col gap-2 sm:flex-row",children:[o.jsx(bt,{value:n,onChange:d=>l(d.target.value),"aria-label":"Initial browser address",placeholder:"https://example.com (optional)",className:"h-11 flex-1 sm:h-9",disabled:t,autoFocus:!0}),o.jsxs(ne,{type:"submit",className:"h-11 sm:h-9",disabled:t,children:[t?o.jsx(ze,{className:"animate-spin"}):o.jsx(Xu,{}),t?"Opening…":"Open browser"]})]}),e&&o.jsxs("div",{role:"alert",className:"mt-3 flex items-center justify-between gap-3 rounded-md bg-[var(--destructive)]/10 px-3 py-2 text-xs text-[var(--destructive)]",children:[o.jsx("span",{children:e}),o.jsx(ne,{type:"button",variant:"ghost",size:"sm",onClick:s,children:"Retry"})]}),o.jsx("p",{className:"sr-only","aria-live":"polite",children:t?"Starting browser":""})]})})})}function UW({page:e,disabled:t,onNavigate:r}){const[s,n]=g.useState(e.url),l=u=>{u.preventDefault();const d=XA(s);d&&r(d)};return o.jsx("form",{onSubmit:l,className:"order-last flex min-w-full flex-1 sm:order-none sm:min-w-0",children:o.jsx(bt,{value:s,onChange:u=>n(u.target.value),"aria-label":"Browser address",className:"h-11 rounded-lg bg-[var(--muted)]/35 font-mono text-xs sm:h-8",disabled:t,spellCheck:!1})})}function uf({label:e,disabled:t,onClick:r,children:s}){return o.jsx(ne,{type:"button",variant:"ghost",size:"icon",className:IW,"aria-label":e,title:e,disabled:t,onClick:r,children:s})}function s_({label:e}){return o.jsxs("div",{className:"flex min-h-0 flex-1 items-center justify-center gap-2 bg-[var(--muted)]/20 text-sm text-[var(--muted-foreground)]","aria-live":"polite",children:[o.jsx(ze,{className:"size-4 animate-spin"}),e]})}function I2({label:e}){return o.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center bg-[var(--muted)]/20 text-sm text-[var(--muted-foreground)]","aria-live":"polite",children:e})}function HW({error:e,pending:t,onRestart:r}){return o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col items-center justify-center gap-3 p-4 text-center",role:"status",children:[o.jsx(_t,{className:"size-5 text-[var(--muted-foreground)]"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"Browser is unavailable"}),o.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:e??"The selected Runtime cannot provide this browser right now."})]}),o.jsxs(ne,{type:"button",variant:"outline",size:"sm",disabled:t,onClick:r,children:[t&&o.jsx(ze,{className:"animate-spin"}),t?"Restarting…":"Restart browser"]})]})}function FW(e,t,r,s){return r===s?t:e}function WW(e){return e?e.tool==="skills-cli"?{source:e.source}:{source:e.command}:{}}const Sx=IF(),z2={...Sx,enabled:!1};function ZA({policy:e,upload:t,deleteResource:r,onChange:s}){const[n,l]=g.useState([]),u=g.useRef([]),d=g.useRef(new Map),m=g.useCallback(b=>{l(w=>{const C=b(w);return u.current=C,C})},[]);g.useEffect(()=>()=>{for(const b of d.current.values())b.abort();for(const b of u.current)URL.revokeObjectURL(b.previewUrl)},[]);const f=g.useCallback(b=>{if(!e.enabled)return;const w=Math.max(0,e.maxImagesPerMessage-u.current.length),C=b.slice(0,w);if(C.length!==0){s==null||s();for(const k of C){const S=od("attachment"),E=od("upl"),N=URL.createObjectURL(k),R=k.type;if(!e.mediaTypes.includes(R)){m(B=>[...B,{id:S,file:k,clientUploadId:E,previewUrl:N,state:"failed",error:"Unsupported image type"}]);continue}if(k.size<=0||k.size>e.maxImageBytes){m(B=>[...B,{id:S,file:k,clientUploadId:E,previewUrl:N,state:"failed",error:`Image must be smaller than ${qW(e.maxImageBytes)}`}]);continue}const A={id:S,file:k,clientUploadId:E,previewUrl:N,state:t?"uploading":"ready"};if(m(B=>[...B,A]),!t)continue;const D=new AbortController;d.current.set(S,D),t(k,E,D.signal).then(B=>{if(d.current.delete(S),!u.current.some($=>$.id===S)){r==null||r(B).catch(()=>{});return}m($=>$.map(q=>q.id===S?{...q,state:"ready",resource:B}:q))}).catch(B=>{d.current.delete(S),!D.signal.aborted&&m($=>$.map(q=>q.id===S?{...q,state:"failed",error:B instanceof Error?B.message:"Upload failed"}:q))})}}},[r,s,e,m,t]),v=g.useCallback(b=>{const w=Array.from(b.clipboardData.files).filter(C=>C.type.startsWith("image/"));w.length!==0&&(b.preventDefault(),f(w))},[f]),p=g.useCallback(b=>{var w;s==null||s(),(w=d.current.get(b.id))==null||w.abort(),d.current.delete(b.id),m(C=>C.filter(k=>k.id!==b.id)),URL.revokeObjectURL(b.previewUrl),b.resource&&(r==null||r(b.resource).catch(()=>{}))},[r,s,m]),x=g.useCallback(()=>{for(const b of d.current.values())b.abort();d.current.clear();for(const b of u.current)URL.revokeObjectURL(b.previewUrl);u.current=[],l([])},[]);return{images:n,addFiles:f,onPaste:v,remove:p,clear:x,hasPending:n.some(b=>b.state==="uploading"),hasFailed:n.some(b=>b.state==="failed"),readyResources:n.flatMap(b=>b.state==="ready"&&b.resource?[b.resource]:[]),readyUploads:n.flatMap(b=>b.state==="ready"?[{file:b.file,clientUploadId:b.clientUploadId}]:[])}}function QA({images:e,disabled:t,onRemove:r,className:s}){return e.length===0?null:o.jsx("div",{className:We("flex gap-2 overflow-x-auto px-2 pb-2",s),"aria-label":"Attached images",children:e.map(n=>o.jsxs("div",{className:"group relative size-20 shrink-0 overflow-hidden rounded-md border border-[var(--border)] bg-[var(--muted)]",title:n.error??n.file.name,children:[o.jsx("img",{src:n.previewUrl,alt:n.file.name,className:"size-full object-cover"}),n.state==="uploading"&&o.jsx("div",{className:"absolute inset-0 grid place-items-center bg-black/45 text-white",children:o.jsx(ze,{className:"size-5 animate-spin"})}),n.state==="failed"&&o.jsx("div",{className:"absolute inset-x-0 bottom-0 bg-[var(--destructive)] px-1 py-0.5 text-center text-[9px] text-white",children:"Upload failed"}),o.jsx("button",{type:"button",className:"absolute right-1 top-1 grid size-5 place-items-center rounded-full bg-black/65 text-white opacity-90 transition-opacity hover:opacity-100 disabled:cursor-not-allowed disabled:opacity-45","aria-label":`Remove ${n.file.name}`,disabled:t,onClick:()=>r(n),children:o.jsx(_n,{className:"size-3"})})]},n.id))})}function JA({policy:e,imageCount:t,disabled:r,onFiles:s,className:n}){const l=g.useRef(null);function u(d){s(Array.from(d.target.files??[])),d.target.value=""}return o.jsxs(o.Fragment,{children:[o.jsx("input",{ref:l,type:"file",accept:e.mediaTypes.join(","),multiple:!0,className:"hidden",onChange:u}),o.jsx(ne,{type:"button",variant:"ghost",size:"icon",className:We("size-8 shrink-0",n),disabled:r||!e.enabled||t>=e.maxImagesPerMessage,"aria-label":"Attach images",title:`Attach up to ${e.maxImagesPerMessage} images`,onClick:()=>{var d;return(d=l.current)==null?void 0:d.click()},children:t>0?o.jsx(jO,{}):o.jsx(u6,{})})]})}function qW(e){return`${Math.round(e/(1024*1024))} MB`}const i_=200;function VW({initialDraft:e,model:t,running:r,disabled:s,sessionId:n,runtimeSelector:l,onSend:u,onStop:d}){const[m,f]=g.useState(e??""),[v,p]=g.useState(z2),[x,b]=g.useState(!1),w=g.useRef(null),C=g.useRef(!1),k=g.useRef(void 0),S=g.useRef(0),E=g.useRef(!1),N=ZA({policy:v,upload:(D,B,$)=>xe.uploadSessionResource(l,n,D,B,$),deleteResource:D=>xe.deleteSessionResource(l,n,D.resourceId),onChange:()=>{k.current=void 0}});g.useEffect(()=>{let D=!1;return xe.getSessionResourcePolicy(l,n).then(B=>{D||p(B)}).catch(()=>{D||p(z2)}),()=>{D=!0}},[l,n]),g.useEffect(()=>{e!==void 0&&f(D=>D||e)},[e]),g.useLayoutEffect(()=>{const D=w.current;if(!D)return;D.style.height="auto";const B=D.scrollHeight;D.style.height=`${Math.min(B,i_)}px`,D.style.overflowY=B>i_?"auto":"hidden"},[m]);async function R(){if(E.current)return;const D=m,B=S.current,$=m.trim(),q=N.readyResources;if(!$&&q.length===0||N.hasPending||N.hasFailed)return;const Y=q.length>0?k.current??od("msg"):void 0;Y&&(k.current=Y),E.current=!0,b(!0),f("");try{await u({text:$,images:q,clientMessageId:Y}),N.clear(),k.current=void 0}catch(V){pe.error(`Could not send message: ${V instanceof Error?V.message:"unknown error"}`),Jm(V)?f(U=>FW(U,D,S.current,B)):(N.clear(),k.current=void 0)}finally{E.current=!1,b(!1)}}const A=!s&&!x&&!N.hasPending&&!N.hasFailed&&(!!m.trim()||N.images.length>0);return o.jsx("div",{className:"px-4 pb-3 pt-1",children:o.jsxs("div",{className:"mx-auto w-full max-w-3xl rounded-xl border border-[var(--border)] bg-[var(--card)] p-2 shadow-[var(--shadow-sm)] transition-[border-color,box-shadow] focus-within:border-[color-mix(in_srgb,var(--primary)_55%,var(--border))] focus-within:shadow-[0_0_0_3px_color-mix(in_srgb,var(--primary)_9%,transparent),var(--shadow-sm)]",children:[o.jsx(QA,{images:N.images,disabled:x,onRemove:N.remove}),o.jsx("textarea",{ref:w,value:m,rows:1,placeholder:"Message… (Enter to send · Shift+Enter for newline)",disabled:s,onChange:D=>{S.current+=1,k.current=void 0,f(D.target.value)},onPaste:D=>{x||N.onPaste(D)},onCompositionStart:()=>{C.current=!0},onCompositionEnd:()=>{C.current=!1},onKeyDown:D=>{D.key==="Enter"&&!D.shiftKey&&!C.current&&!D.nativeEvent.isComposing&&D.keyCode!==229&&(D.preventDefault(),A&&R())},className:We("block min-h-[52px] w-full resize-none overflow-hidden border-0 bg-transparent px-2 py-1.5","text-sm leading-relaxed placeholder:text-[var(--muted-foreground)]","focus-visible:outline-none","disabled:cursor-not-allowed disabled:opacity-50"),style:{maxHeight:i_}}),o.jsxs("div",{className:"flex min-h-8 items-center gap-2 pt-1",children:[o.jsx(JA,{policy:v,imageCount:N.images.length,disabled:s||x,onFiles:N.addFiles}),o.jsx(GW,{fallbackModel:t,running:r,sessionId:n,runtimeSelector:l}),r?o.jsxs(ne,{variant:"outline",className:"ml-auto h-8 shrink-0",onClick:d,title:"Stop the running turn",children:[o.jsx(F6,{})," Stop"]}):o.jsxs(ne,{className:"ml-auto h-8 shrink-0",onClick:R,disabled:!A,children:[o.jsx(mE,{})," Send"]})]})]})})}function GW({fallbackModel:e,running:t,sessionId:r,runtimeSelector:s}){const[n,l]=g.useState(null),[u,d]=g.useState([]),[m,f]=g.useState(!0),[v,p]=g.useState(!1);g.useEffect(()=>{let S=!1;return f(!0),l(null),d([]),Promise.all([xe.getSessionExecutionSettings(s,r),xe.listSessionLaunchOptions(s)]).then(([E,N])=>{var R;S||(l(E),d(((R=N.providers.find(A=>A.id===E.provider))==null?void 0:R.models)??[]))}).catch(()=>{}).finally(()=>{S||f(!1)}),()=>{S=!0}},[s,r]);const x=u.find(S=>S.id===(n==null?void 0:n.model)),b=x==null?void 0:x.reasoningOptions.find(S=>S.value===(n==null?void 0:n.reasoningEffort)),w=x?`${x.label}${b?` / ${b.label}`:""}`:(n==null?void 0:n.model)??e,C=t||v||m||!n||u.length===0;async function k(S,E){if(!(v||t)){p(!0);try{const N=await xe.updateSessionExecutionSettings(s,r,{model:S,reasoningEffort:E});l(N)}catch(N){pe.error(`Could not change model: ${N instanceof Error?N.message:"unknown error"}`)}finally{p(!1)}}}return w?u.length===0||!n?o.jsx("span",{className:"min-w-0 max-w-52 truncate px-2 font-mono text-[10px] text-[var(--muted-foreground)]",children:w}):o.jsxs(ed,{children:[o.jsx(fc,{asChild:!0,children:o.jsxs(ne,{type:"button",variant:"ghost",size:"sm",disabled:C,className:"h-7 min-w-0 max-w-52 justify-start gap-1.5 px-2 font-normal text-[11px] text-[var(--muted-foreground)]","aria-label":"Model and thinking effort",title:t?"Model settings can be changed after the current turn finishes":"Change model and thinking effort for the next turn",children:[v?o.jsx(ze,{className:"size-3 animate-spin"}):null,o.jsx("span",{className:"min-w-0 truncate",children:w}),o.jsx(md,{className:"size-3 shrink-0 opacity-55"})]})}),o.jsxs(mc,{align:"start",className:"min-w-56",children:[o.jsx(Uo,{className:"font-mono text-[9px] uppercase tracking-[0.12em]",children:"Model → Thinking effort"}),u.map(S=>{const E=n.model===S.id;return S.reasoningOptions.length===0?o.jsxs(Ii,{onSelect:()=>void k(S.id,null),children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:S.label}),E&&o.jsx(Br,{className:"size-3.5 text-[var(--primary)]"})]},S.id):o.jsxs(Y_,{children:[o.jsxs(sm,{children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:S.label}),E&&o.jsx(Br,{className:"size-3.5 text-[var(--primary)]"})]}),o.jsxs(im,{children:[o.jsx(Uo,{className:"font-mono text-[9px] uppercase tracking-[0.12em]",children:"Thinking effort"}),S.reasoningOptions.map(N=>{const R=E&&n.reasoningEffort===N.value;return o.jsxs(Ii,{onSelect:()=>void k(S.id,N.value),children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:N.label}),R&&o.jsx(Br,{className:"size-3.5 text-[var(--primary)]"})]},N.value)})]})]},S.id)})]})]}):null}const eM=24,YW={hasOverflow:!1,canScrollLeft:!1,canScrollRight:!1};function KW({pages:e,order:t,selectedPageId:r,selectionDisabled:s,mutationDisabled:n,createDisabled:l,createPending:u,emulatorAttached:d,emulator:m,onSelectPage:f,onClosePage:v,onCreatePage:p,onSelectEmulator:x,onCloseEmulator:b,onAddEmulator:w,headerLeadingAction:C,leadingAction:k,trailingAction:S}){const E=g.useRef(null),N=g.useRef(null),R=g.useRef(null),A=g.useRef(null),D=g.useRef(null),B=g.useRef(null),[$,q]=g.useState(YW),Y=t.flatMap(W=>{if(W===cn())return m?[{type:"emulator",key:W,emulator:m}]:[];const H=e.find(T=>ln(T.pageId)===W);return H?[{type:"browser",key:W,page:H}]:[]}),V=Y.map(W=>W.key).join(`
|
|
581
|
-
`),U=Y.length,L=g.useCallback(()=>{const W=E.current,H=N.current,T=R.current;if(!(!W||!H||!T))return wW({scrollLeft:H.scrollLeft,viewportWidth:H.clientWidth,contentWidth:T.scrollWidth,availableWidth:W.clientWidth})},[]),I=g.useCallback(()=>{const W=L();W&&q(H=>XW(H,W)?H:W)},[L]),F=g.useCallback(()=>{D.current===null&&(D.current=window.requestAnimationFrame(()=>{D.current=null,I()}))},[I]),M=g.useCallback(W=>{const H=N.current,T=A.current;if(!H||!T)return;const G=H.getBoundingClientRect(),X=T.getBoundingClientRect(),ee=CW({scrollLeft:H.scrollLeft,viewportWidth:H.clientWidth,tabLeft:H.scrollLeft+X.left-G.left,tabWidth:X.width,inset:eM});ee!==0&&H.scrollBy({left:ee,behavior:W})},[]),P=g.useCallback(W=>{const H=N.current;if(!H)return;const T=SW(H.clientWidth);H.scrollBy({left:W==="left"?-T:T,behavior:U2()})},[]);g.useEffect(()=>()=>{D.current!==null&&window.cancelAnimationFrame(D.current)},[]),g.useLayoutEffect(()=>{const W=E.current,H=N.current,T=R.current;if(!W||!H||!T)return;const G=()=>{const ee=H.clientWidth,oe=B.current===null||Math.abs(ee-B.current)>1;B.current=ee,F(),oe&&M("auto")},X=typeof ResizeObserver>"u"?void 0:new ResizeObserver(G);return X==null||X.observe(W),X==null||X.observe(H),X==null||X.observe(T),window.addEventListener("resize",G),I(),()=>{X==null||X.disconnect(),window.removeEventListener("resize",G)}},[M,F,I]),g.useEffect(()=>{const W=N.current;if(!W)return;const H=T=>{if(T.ctrlKey||T.deltaY===0||Math.abs(T.deltaY)<=Math.abs(T.deltaX))return;const G=L();(T.deltaY<0?G!=null&&G.canScrollLeft:G!=null&&G.canScrollRight)&&(T.preventDefault(),W.scrollLeft+=T.deltaY,F())};return W.addEventListener("wheel",H,{passive:!1}),()=>W.removeEventListener("wheel",H)},[L,F]),g.useLayoutEffect(()=>{M(U2()),F()},[V,M,F,$.hasOverflow,r]);function O(W,H){var X;let T;if(W.key==="ArrowLeft"?T=(H-1+U)%U:W.key==="ArrowRight"?T=(H+1)%U:W.key==="Home"?T=0:W.key==="End"&&(T=U-1),T===void 0||T===H)return;W.preventDefault();const G=(X=R.current)==null?void 0:X.querySelectorAll('[role="tab"]').item(T);G==null||G.focus(),G==null||G.click()}return o.jsxs("div",{className:"desktop-macos-titlebar-header app-drag-region flex h-12 shrink-0 items-end gap-1 border-b border-[var(--border)] bg-[var(--muted)]/30 pl-2 pr-3 pt-1 sm:pr-4",children:[C&&o.jsx("div",{className:"mb-1 flex h-8 shrink-0 items-center",children:C}),o.jsxs("div",{ref:E,className:"flex min-w-0 flex-1 items-end gap-1",children:[$.hasOverflow&&o.jsx($2,{direction:"left",disabled:!$.canScrollLeft,onClick:()=>P("left")}),o.jsx("div",{ref:N,className:"min-w-0 flex-1 overflow-x-auto overflow-y-hidden [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",style:ZW($),onScroll:F,children:o.jsx("div",{ref:R,className:"flex w-max items-end gap-1",role:"tablist","aria-label":"Session resources",children:Y.map((W,H)=>{if(W.type==="emulator"){const ee=W.emulator;return o.jsxs("div",{ref:ee.selected?A:void 0,role:"presentation",className:ee.selected?"group flex h-8 w-44 shrink-0 items-center rounded-t-md border border-b-[var(--card)] border-[var(--border)] bg-[var(--card)] px-2":"group flex h-8 w-44 shrink-0 items-center rounded-t-md border border-transparent px-2 text-[var(--muted-foreground)] transition-colors hover:bg-[var(--muted)]",children:[o.jsxs("button",{type:"button",role:"tab","aria-selected":ee.selected,"aria-label":ee.label,title:ee.label,tabIndex:ee.selected?0:-1,onClick:x,onKeyDown:oe=>O(oe,H),className:"flex min-w-0 flex-1 items-center gap-2 text-left text-xs outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]",children:[ee.busy?o.jsx(ze,{className:"size-3 shrink-0 animate-spin"}):o.jsx(uc,{className:"size-3 shrink-0"}),o.jsx("span",{className:"truncate",children:ee.label})]}),o.jsx(ne,{type:"button",variant:"ghost",size:"icon-xs","aria-label":"Close emulator tab",title:"Close emulator tab",onClick:b,className:"ml-1",children:o.jsx(_n,{className:"size-3"})})]},W.key)}const T=W.page,G=T.pageId===r,X=T.title||T.url||"New page";return o.jsxs("div",{ref:G?A:void 0,role:"presentation",className:G?"group flex h-8 w-44 shrink-0 items-center rounded-t-md border border-b-[var(--card)] border-[var(--border)] bg-[var(--card)] px-2":"group flex h-8 w-44 shrink-0 items-center rounded-t-md border border-transparent px-2 text-[var(--muted-foreground)] transition-colors hover:bg-[var(--muted)]",children:[o.jsxs("button",{type:"button",role:"tab","aria-selected":G,"aria-label":X,title:X,tabIndex:G?0:-1,disabled:s,onClick:()=>f(T.pageId),onKeyDown:ee=>O(ee,H),className:"flex min-w-0 flex-1 items-center gap-2 text-left text-xs outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]",children:[T.loading?o.jsx(ze,{className:"size-3 shrink-0 animate-spin"}):o.jsx(Xu,{className:"size-3 shrink-0"}),o.jsx("span",{className:"truncate",children:X})]}),o.jsx(ne,{type:"button",variant:"ghost",size:"icon-xs","aria-label":`Close ${X}`,title:`Close ${X}`,disabled:n,onClick:()=>v(T.pageId),className:"ml-1",children:o.jsx(_n,{className:"size-3"})})]},W.key)})})}),$.hasOverflow&&o.jsx($2,{direction:"right",disabled:!$.canScrollRight,onClick:()=>P("right")})]}),k&&o.jsx("div",{className:"mb-1 shrink-0",children:k}),o.jsxs(ed,{children:[o.jsx(fc,{asChild:!0,children:o.jsx(ne,{type:"button",variant:"ghost",size:"icon-sm",className:"mb-1 size-8","aria-label":"Add Session resource",title:"Add Session resource",children:o.jsx(ls,{})})}),o.jsxs(mc,{align:"end",children:[o.jsxs(Ii,{disabled:l,"aria-busy":u,onSelect:p,children:[u?o.jsx(ze,{className:"animate-spin"}):o.jsx(Xu,{}),u?"Creating browser tab…":"New browser tab"]}),o.jsxs(Ii,{onSelect:w,children:[o.jsx(uc,{}),m||d?"Show emulator":"Attach emulator"]})]})]}),S&&o.jsx("div",{className:"mb-1 ml-0.5 shrink-0",children:S})]})}function $2({direction:e,disabled:t,onClick:r}){const s=e==="left"?iE:oo;return o.jsx(ne,{type:"button",variant:"ghost",size:"icon-sm",className:"mb-1 size-7","aria-label":`Scroll resource tabs ${e}`,title:`Scroll resource tabs ${e}`,disabled:t,onClick:r,children:o.jsx(s,{})})}function U2(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"}function XW(e,t){return e.hasOverflow===t.hasOverflow&&e.canScrollLeft===t.canScrollLeft&&e.canScrollRight===t.canScrollRight}function ZW(e){const t=`${eM}px`;let r;return e.canScrollLeft&&e.canScrollRight?r=`linear-gradient(to right, transparent, #000 ${t}, #000 calc(100% - ${t}), transparent)`:e.canScrollLeft?r=`linear-gradient(to right, transparent, #000 ${t}, #000 100%)`:e.canScrollRight&&(r=`linear-gradient(to right, #000 0, #000 calc(100% - ${t}), transparent)`),r?{WebkitMaskImage:r,maskImage:r}:void 0}const QW=8,JW=256,eq=4e3;function tq({sessionId:e,runtimeSelector:t,controller:r,readOnly:s=!1}){return r.binding?o.jsx(sq,{sessionId:e,runtimeSelector:t,binding:r.binding,controller:r,readOnly:s}):s?o.jsx(jy,{icon:o.jsx(Vf,{className:"size-5"}),label:"No Emulator is attached."}):o.jsx(rq,{controller:r})}function rq({controller:e}){const[t,r]=g.useState(null),s=async n=>{r(n);try{await e.attach(n)}catch(l){pe.error(`Could not attach Emulator: ${l.message}`)}finally{r(null)}};return o.jsx(xn,{className:"min-h-0 flex-1",children:o.jsx("div",{className:"p-4 sm:p-5",children:o.jsxs("div",{className:"mx-auto max-w-2xl",children:[o.jsxs("div",{className:"mb-4 flex items-start justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-sm font-semibold",children:"Attach an Emulator"}),o.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:"Only devices available to this Session are shown. Attaching does not affect another Session."})]}),o.jsx(ne,{variant:"ghost",size:"icon-sm",onClick:()=>void e.reloadDevices(),title:"Refresh devices","aria-label":"Refresh devices",children:o.jsx(_t,{className:We("size-4",e.devicesLoading&&"animate-spin")})})]}),e.error&&o.jsx("div",{className:"mb-3 rounded-md border border-[var(--destructive)]/30 bg-[var(--destructive)]/5 px-3 py-2 text-xs text-[var(--destructive)]",children:e.error.message}),e.devicesLoading&&e.devices.length===0?o.jsx("div",{className:"grid min-h-40 place-items-center","aria-live":"polite",children:o.jsx(jy,{icon:o.jsx(ze,{className:"size-5 animate-spin"}),label:"Loading devices…"})}):e.devices.length===0?o.jsxs("div",{className:"rounded-md border border-dashed border-[var(--border)] px-5 py-10 text-center",children:[o.jsx(Vf,{className:"mx-auto mb-3 size-6 text-[var(--muted-foreground)]"}),o.jsx("p",{className:"text-sm font-medium",children:"No Emulator is available"}),o.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:"Boot a simulator on this Runtime, or release one from another Session."})]}):o.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:e.devices.map(n=>o.jsxs("button",{type:"button",disabled:e.mutating,onClick:()=>void s(n.id),className:"group flex min-h-20 items-center gap-3 rounded-md border border-[var(--border)] bg-[var(--card)] p-3 text-left transition-colors hover:border-[var(--primary)]/50 hover:bg-[var(--primary)]/[0.03] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)] disabled:opacity-60",children:[o.jsx("span",{className:"grid size-9 shrink-0 place-items-center rounded-md bg-[var(--primary)]/10 text-[var(--primary)]",children:t===n.id?o.jsx(ze,{className:"size-4 animate-spin"}):o.jsx(Vf,{className:"size-4"})}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate text-sm font-medium",children:n.name}),o.jsxs("span",{className:"mt-1 flex items-center gap-2",children:[o.jsx(tM,{state:n.state}),o.jsx("span",{className:"font-mono text-[9px] uppercase text-[var(--muted-foreground)]",children:n.backend})]})]})]},`${n.backend}:${n.id}`))})]})})})}function sq({sessionId:e,runtimeSelector:t,binding:r,controller:s,readOnly:n}){const[l,u]=g.useState(null),[d,m]=g.useState(!1),[f,v]=g.useState(null),[p,x]=g.useState(null),b=g.useRef(null),w=g.useRef(null),C=g.useRef(null),k=g.useRef(null),S=g.useRef(null);g.useEffect(()=>{u(null),m(!1),x(null),v(null);let q=!1,Y,V,U=0,L=0,I=!1,F=null,M,P="png";const O=()=>{V!==void 0&&window.clearTimeout(V),V=void 0,v(null)},W=(X,ee=!1)=>{if(V!==void 0&&window.clearTimeout(V),ee||F===null){v(X);return}V=window.setTimeout(()=>{V=void 0,q||v(X)},eq)},H=X=>{if(q)return;const ee=URL.createObjectURL(X),oe=F;F=ee,u(ee),O(),U=0,I=!1,oe&&window.setTimeout(()=>URL.revokeObjectURL(oe),1e3)},T=(X,ee=!1)=>{if(q)return;Y!==void 0&&window.clearTimeout(Y);const oe=ee?0:Math.min(8e3,500*2**U++);Y=window.setTimeout(()=>void X(ee),oe)},G=async(X=!1)=>{const ee=++L;try{const oe=await id(X);if(q||ee!==L)return;const de=new WebSocket(iq({runtimeSelector:t,sessionId:e,bindingId:r.bindingId,maximumFrameRate:r.backend==="ios"?30:5,capability:oe}));M=de,de.binaryType="arraybuffer",de.onmessage=Z=>{if(q||ee!==L||M!==de)return;if(typeof Z.data=="string"){try{const be=JSON.parse(Z.data);if(be.type!=="emulator.surface.ready"||typeof be.surfaceId!="string"||be.format!=="png"&&be.format!=="jpeg")throw new Error("invalid Emulator Surface ready frame");P=be.format,w.current={socket:de,surfaceId:be.surfaceId,inputSequence:0}}catch{de.close(4400,"invalid Emulator Surface ready frame")}return}const ce=Z.data instanceof ArrayBuffer||Z.data instanceof Blob?Z.data:null,le=P==="jpeg"?"image/jpeg":"image/png";ce instanceof Blob?H(new Blob([ce],{type:le})):ce&&H(new Blob([ce],{type:le}))},de.onclose=Z=>{var le;if(q||ee!==L||M!==de)return;((le=w.current)==null?void 0:le.socket)===de&&(w.current=null);const ce=new Error(Z.code===4406?"emulator_surface_upgrade_required":Z.reason||"Remote Emulator Surface disconnected");W(ce,Z.code===4406),Z.code!==4406&&((Z.code===4403||Z.code===1006)&&!I?(I=!0,T(G,!0)):T(G))},de.onerror=()=>{}}catch(oe){if(q||ee!==L)return;W(oe instanceof Error?oe:new Error(String(oe))),T(G)}};return G(),()=>{q=!0,L+=1,w.current=null,M==null||M.close(1e3,"Session Emulator pane closed"),Y!==void 0&&window.clearTimeout(Y),V!==void 0&&window.clearTimeout(V),F&&URL.revokeObjectURL(F)}},[r.backend,r.bindingId,t,e]);const E=g.useCallback((q,Y,V)=>{const U=w.current;if(!U||U.socket.readyState!==WebSocket.OPEN||V!==void 0&&U.surfaceId!==V)return!1;try{return U.socket.send(JSON.stringify({type:"emulator.surface.touch",surfaceId:U.surfaceId,inputSequence:U.inputSequence++,phase:q,...Y})),!0}catch{return!1}},[]),N=g.useCallback(()=>{k.current!==null&&window.cancelAnimationFrame(k.current),k.current=null;const q=C.current;C.current=null,q&&E("move",q,q.surfaceId)},[E]),R=g.useCallback(q=>{const Y=b.current;if(!Y)return null;const V=Y.getBoundingClientRect();return V.width<=0||V.height<=0?null:{x:Math.max(0,Math.min(1,(q.clientX-V.left)/V.width)),y:Math.max(0,Math.min(1,(q.clientY-V.top)/V.height))}},[]),A=q=>{var L;if(s.mutating)return;const Y=R(q.nativeEvent);if(!Y)return;q.currentTarget.setPointerCapture(q.pointerId);const V=((L=w.current)==null?void 0:L.surfaceId)??null,U=V!==null&&E("begin",Y,V);S.current={pointerId:q.pointerId,startX:q.clientX,startY:q.clientY,lastPoint:Y,points:[{type:"begin",...Y}],live:U,surfaceId:U?V:null}},D=q=>{const Y=S.current;if(!Y||Y.pointerId!==q.pointerId)return;const V=R(q.nativeEvent);V&&Y.live?(Y.lastPoint=V,C.current=Y.surfaceId?{...V,surfaceId:Y.surfaceId}:null,k.current===null&&(k.current=window.requestAnimationFrame(()=>N()))):V&&Y.points.length<JW-1&&(Y.lastPoint=V,Y.points.push({type:"move",...V}))},B=q=>{const Y=S.current;if(S.current=null,!Y||Y.pointerId!==q.pointerId)return;const V=R(q.nativeEvent);if(!V)return;if(Y.live){N(),Y.surfaceId&&E("end",V,Y.surfaceId);return}(Math.hypot(q.clientX-Y.startX,q.clientY-Y.startY)>QW?s.gesture([...Y.points,{type:"end",...V}]):s.tap(V.x,V.y)).catch(I=>pe.error(`Emulator input failed: ${I.message}`))},$=async()=>{try{await s.detach()}catch(q){pe.error(`Could not detach Emulator: ${q.message}`)}};return o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col bg-[var(--background)]",children:[o.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between gap-3 border-b border-[var(--border)] px-3",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[o.jsx("span",{className:"truncate text-xs font-medium",children:r.deviceName??r.deviceId}),o.jsx(tM,{state:r.deviceState}),!r.available&&o.jsx(Ot,{variant:"outline",children:"Unavailable"}),f&&l&&o.jsxs(Ot,{variant:"outline",className:"gap-1 border-[var(--warning)]/30 font-mono text-[8px] uppercase text-[var(--warning)]",children:[o.jsx(ze,{className:"size-2.5 animate-spin"}),"Reconnecting"]})]}),o.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[o.jsx(ne,{variant:"ghost",size:"icon-sm",disabled:!r.available||s.mutating,title:"Home","aria-label":"Home",onClick:()=>void s.button("home").catch(q=>pe.error(`Home failed: ${q.message}`)),children:o.jsx(lE,{})}),o.jsxs(ne,{variant:"ghost",size:"sm",disabled:s.mutating,title:"Detach from this session",onClick:()=>void $(),children:[s.mutating?o.jsx(ze,{className:"animate-spin"}):o.jsx(J6,{}),"Detach"]})]})]}),o.jsxs("div",{className:"relative flex min-h-0 flex-1 items-center justify-center overflow-hidden p-3",children:[!d&&!f&&o.jsx("div",{className:"absolute inset-0 z-10 grid place-items-center bg-[var(--background)]",children:o.jsx(jy,{icon:o.jsx(ze,{className:"size-5 animate-spin"}),label:"Connecting to Emulator…"})}),f&&!l&&o.jsxs("div",{className:"max-w-sm text-center",children:[o.jsx(Vf,{className:"mx-auto mb-3 size-7 text-[var(--muted-foreground)]"}),o.jsx("p",{className:"text-sm font-medium",children:t==="local"?"Preview is unavailable":"Remote Emulator Surface is unavailable"}),o.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:f.message==="emulator_surface_upgrade_required"?"Upgrade the selected Runtime daemon to a version with Emulator Surface support.":f.message})]}),l&&o.jsx("img",{ref:b,src:l,alt:r.deviceName??r.deviceId,draggable:!1,onLoad:q=>{x({width:q.currentTarget.naturalWidth,height:q.currentTarget.naturalHeight}),m(!0)},onPointerDown:n?void 0:A,onPointerMove:n?void 0:D,onPointerUp:n?void 0:B,onPointerCancel:n?void 0:()=>{const q=S.current;S.current=null,q!=null&&q.live&&(N(),q.surfaceId&&E("end",q.lastPoint,q.surfaceId))},className:"max-h-full max-w-full touch-none select-none rounded-md bg-black object-contain shadow-[var(--shadow-md)]",style:p?{aspectRatio:`${p.width} / ${p.height}`}:void 0})]})]})}function iq(e){const t=location.protocol==="https:"?"wss":"ws",r=new URLSearchParams({bindingId:e.bindingId,maximumFrameRate:String(e.maximumFrameRate),capability:e.capability});return ky(r),`${t}://${location.host}/api/runtimes/${encodeURIComponent(e.runtimeSelector)}/sessions/${encodeURIComponent(e.sessionId)}/emulator/surface?${r.toString()}`}function tM({state:e}){return o.jsxs(Ot,{variant:"outline",className:We("gap-1 px-1.5 py-0 font-mono text-[8px] uppercase",e==="booted"&&"border-[var(--success)]/30 text-[var(--success)]",e==="shutdown"&&"text-[var(--muted-foreground)]"),children:[o.jsx("span",{className:We("size-1 rounded-full bg-current",e==="booted"&&"animate-pulse")}),e]})}function jy({icon:e,label:t}){return o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col items-center justify-center gap-2 text-[var(--muted-foreground)]",children:[e,o.jsx("span",{className:"text-xs",children:t})]})}var rp="Collapsible",[nq]=Gi(rp),[aq,Ay]=nq(rp),rM=g.forwardRef((e,t)=>{const{__scopeCollapsible:r,open:s,defaultOpen:n,disabled:l,onOpenChange:u,...d}=e,[m,f]=eo({prop:s,defaultProp:n??!1,onChange:u,caller:rp});return o.jsx(aq,{scope:r,disabled:l,contentId:Vs(),open:m,onOpenToggle:g.useCallback(()=>f(v=>!v),[f]),children:o.jsx(Xe.div,{"data-state":Ty(m),"data-disabled":l?"":void 0,...d,ref:t})})});rM.displayName=rp;var sM="CollapsibleTrigger",iM=g.forwardRef((e,t)=>{const{__scopeCollapsible:r,...s}=e,n=Ay(sM,r);return o.jsx(Xe.button,{type:"button","aria-controls":n.open?n.contentId:void 0,"aria-expanded":n.open||!1,"data-state":Ty(n.open),"data-disabled":n.disabled?"":void 0,disabled:n.disabled,...s,ref:t,onClick:Be(e.onClick,n.onOpenToggle)})});iM.displayName=sM;var My="CollapsibleContent",nM=g.forwardRef((e,t)=>{const{forceMount:r,...s}=e,n=Ay(My,e.__scopeCollapsible);return o.jsx(Yi,{present:r||n.open,children:({present:l})=>o.jsx(oq,{...s,ref:t,present:l})})});nM.displayName=My;var oq=g.forwardRef((e,t)=>{const{__scopeCollapsible:r,present:s,children:n,...l}=e,u=Ay(My,r),[d,m]=g.useState(s),f=g.useRef(null),v=ut(t,f),p=g.useRef(0),x=p.current,b=g.useRef(0),w=b.current,C=u.open||d,k=g.useRef(C),S=g.useRef(void 0);return g.useEffect(()=>{const E=requestAnimationFrame(()=>k.current=!1);return()=>cancelAnimationFrame(E)},[]),ur(()=>{const E=f.current;if(E){S.current=S.current||{transitionDuration:E.style.transitionDuration,animationName:E.style.animationName},E.style.transitionDuration="0s",E.style.animationName="none";const N=E.getBoundingClientRect();p.current=N.height,b.current=N.width,k.current||(E.style.transitionDuration=S.current.transitionDuration,E.style.animationName=S.current.animationName),m(s)}},[u.open,s]),o.jsx(Xe.div,{"data-state":Ty(u.open),"data-disabled":u.disabled?"":void 0,id:u.contentId,hidden:!C,...l,ref:v,style:{"--radix-collapsible-content-height":x?`${x}px`:void 0,"--radix-collapsible-content-width":w?`${w}px`:void 0,...e.style},children:C&&n})});function Ty(e){return e?"open":"closed"}var lq=rM,cq=iM,uq=nM;const sp=lq,ip=cq,np=uq;function dq({status:e}){return e==="completed"?o.jsx(Br,{className:"size-3 shrink-0 text-[var(--success)]"}):e==="in_progress"?o.jsx(ze,{className:"size-3 shrink-0 animate-spin text-[var(--primary)]"}):o.jsx(Q4,{className:"size-3 shrink-0 text-[var(--muted-foreground)]"})}function hq({todos:e}){const[t,r]=g.useState(!0);if(e.length===0)return null;const s=e.filter(n=>n.status==="completed").length;return o.jsxs(sp,{open:t,onOpenChange:r,className:"mx-auto mt-2 w-[calc(100%-2rem)] max-w-3xl rounded-md border border-[var(--border)] bg-[var(--muted)]/30",children:[o.jsxs(ip,{className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs",children:[o.jsx(oo,{className:We("size-3 shrink-0 text-[var(--muted-foreground)] transition-transform",t&&"rotate-90")}),o.jsx("span",{className:"label-caps text-[var(--muted-foreground)]",children:"Tasks"}),o.jsxs("span",{className:"font-mono text-[var(--muted-foreground)]",children:[s,"/",e.length]})]}),o.jsx(np,{className:"overflow-hidden px-3 pb-2",children:o.jsx("ul",{className:"space-y-1",children:e.map(n=>o.jsxs("li",{className:"flex items-center gap-2 text-xs",children:[o.jsx(dq,{status:n.status}),o.jsx("span",{className:We("truncate",n.status==="completed"&&"text-[var(--muted-foreground)] line-through"),children:n.subject})]},n.id))})})]})}function H2(e,t,r={},s={},n=!0){const l={},u={};for(const d of e){if(d.type==="text"){const b=typeof t[d.id]=="string"?t[d.id]:"";n&&d.required&&!b.trim()?u[d.id]=`${d.label} is required`:b.length>0&&(l[d.id]=b);continue}const m=new Set(d.options.map(b=>b.value)),f=d.allowOther===!0&&s[d.id]===!0,v=f?(r[d.id]??"").trim():"";if(d.multiple){const b=Array.isArray(t[d.id])?t[d.id]:[],w=d.options.map(C=>C.value).filter(C=>b.includes(C));v&&!w.includes(v)&&w.push(v),n&&f&&!v?u[d.id]=`${d.label}: enter a value for Other`:n&&d.required&&w.length===0?u[d.id]=`${d.label} is required`:w.length>0&&(l[d.id]=w);continue}const p=typeof t[d.id]=="string"?t[d.id]:"",x=f?v:m.has(p)?p:"";n&&f&&!v?u[d.id]=`${d.label}: enter a value for Other`:n&&d.required&&!x?u[d.id]=`${d.label} is required`:x&&(l[d.id]=x)}return Object.keys(u).length>0?{ok:!1,errors:u}:{ok:!0,answers:l}}function fq({sessionId:e,item:t,canResolve:r=!0}){var L;const{runtimeSelector:s}=Sc(),n=g.useId().replaceAll(":",""),[l,u]=g.useState({}),[d,m]=g.useState({}),[f,v]=g.useState({}),[p,x]=g.useState({}),[b,w]=g.useState(()=>{var I;return(I=t.request.fields[0])==null?void 0:I.id}),[C,k]=g.useState(),[S,E]=g.useState(),N=t.status==="pending";function R(I){x(F=>{if(!F[I])return F;const M={...F};return delete M[I],M})}function A(I,F){u(M=>({...M,[I]:F})),R(I)}function D(I,F){v(M=>({...M,[I]:F})),R(I)}function B(I){const F=t.request.fields,M=Math.max(F.findIndex(O=>O.id===b),0),P=F.findIndex(O=>O.id===I);if(!(P<0)){if(P>M){const O=F[M];if(O){const W=H2([O],l,d,f);if(!W.ok){x(H=>({...H,...W.errors}));return}R(O.id)}}w(I)}}async function $(I){if(!r)return;const F=H2(t.request.fields,l,d,f,I.requiresAnswers);if(!F.ok){x(F.errors);const M=t.request.fields.find(P=>F.errors[P.id]);M&&w(M.id);return}x({}),k(void 0),E(I.id);try{await I9(e,t.id,{actionId:I.id,...Object.keys(F.answers).length>0?{answers:F.answers}:{}},s)}catch(M){E(void 0),k(M instanceof Error?M.message:String(M))}}const q=t.request.kind==="permission"?T6:t.request.kind==="form"?IO:q4,Y=Math.max(t.request.fields.findIndex(I=>I.id===b),0),V=t.request.fields.length===0||Y===t.request.fields.length-1,U=t.request.actions.filter(I=>!I.requiresAnswers||V);return o.jsxs("section",{"aria-labelledby":`${n}-title`,"aria-busy":S!==void 0,className:We("min-w-0 max-w-full overflow-hidden rounded-lg border p-3 text-xs shadow-sm",t.request.kind==="permission"?"border-[var(--warning)]/40 bg-[var(--warning)]/5":"border-[var(--primary)]/30 bg-[var(--primary)]/5"),children:[o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(q,{"aria-hidden":"true",className:We("mt-0.5 size-4 shrink-0",t.request.kind==="permission"?"text-[var(--warning)]":"text-[var(--primary)]")}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("div",{id:`${n}-title`,className:"font-medium text-[var(--foreground)]",children:t.request.title}),t.request.description&&o.jsx("p",{className:"mt-1 leading-relaxed text-[var(--muted-foreground)]",children:t.request.description})]})]}),o.jsx(mq,{item:t}),N&&!r?o.jsx("div",{role:"status",className:"mt-3 text-[var(--muted-foreground)]",children:"Pending interaction · resolve it on the owning Runtime."}):N?o.jsxs("div",{className:"mt-3 grid min-w-0 gap-3",children:[o.jsx(Z7,{idPrefix:n,fields:t.request.fields,activeFieldId:b,answers:l,otherValues:d,otherSelections:f,errors:p,disabled:S!==void 0,onNavigate:B,onAnswerChange:A,onOtherSelectionChange:D,onOtherValueChange:(I,F)=>{m(M=>({...M,[I]:F})),R(I)}}),C&&o.jsxs("p",{role:"alert",className:"text-[var(--destructive)]",children:["Could not submit: ",C]}),o.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[U.map(I=>o.jsxs(ne,{type:"button",size:"sm",variant:gq(I),className:"h-auto max-w-full whitespace-normal break-words py-1.5 text-left",disabled:S!==void 0,title:I.description,"aria-label":I.description?`${I.label}. ${I.description}`:void 0,onClick:()=>void $(I),children:[S===I.id&&o.jsx(ze,{"aria-hidden":"true",className:"animate-spin"}),I.label]},I.id)),S&&o.jsxs("span",{role:"status",className:"text-[var(--muted-foreground)]",children:["Submitting ",(L=t.request.actions.find(I=>I.id===S))==null?void 0:L.label,"…"]})]})]}):o.jsx(pq,{item:t})]})}function mq({item:e}){const t=e.request.context;return t?o.jsxs("div",{className:"mt-3 grid min-w-0 gap-1.5",children:[t.summary&&o.jsx("p",{className:"break-words leading-relaxed text-[var(--muted-foreground)]",children:t.summary}),t.toolName&&o.jsxs("div",{className:"font-mono text-[10px] text-[var(--muted-foreground)]",children:["tool · ",t.toolName]}),t.command&&o.jsx(F2,{value:t.command}),t.cwd&&o.jsx("div",{className:"min-w-0 whitespace-pre-wrap break-all font-mono text-[10px] text-[var(--muted-foreground)]",children:t.cwd}),t.diff&&o.jsx(F2,{value:t.diff,tall:!0})]}):null}function F2({value:e,tall:t=!1}){return o.jsx("pre",{className:We("min-w-0 max-w-full overflow-auto whitespace-pre-wrap [overflow-wrap:anywhere] rounded-md bg-[var(--muted)] p-2 font-mono text-[11px] leading-relaxed",t?"max-h-56":"max-h-32"),children:o.jsx("code",{className:"block min-w-0",children:e})})}function pq({item:e}){var s;if(e.status!=="resolved"){const n=e.status==="expired"?"Expired":e.status==="inactive"?"No longer active":"Cancelled";return o.jsxs("div",{role:"status",className:"mt-3 text-[var(--muted-foreground)]",children:[n,e.reason?` · ${e.reason}`:""]})}const t=e.request.actions.find(n=>{var l;return n.id===((l=e.resolution)==null?void 0:l.actionId)}),r=e.request.fields.flatMap(n=>{var d,m;const l=(m=(d=e.resolution)==null?void 0:d.answers)==null?void 0:m[n.id];if(l===void 0)return[];const u=n.type==="text"&&n.secret?"••••••••":Array.isArray(l)?l.join(", "):l;return[{id:n.id,label:n.label,value:u}]});return o.jsxs("div",{"aria-live":"polite",className:"mt-3 grid gap-1.5 text-[var(--muted-foreground)]",children:[o.jsxs("div",{children:["Resolved · ",(t==null?void 0:t.label)??((s=e.resolution)==null?void 0:s.actionId)??"answered"]}),r.map(n=>o.jsxs("div",{className:"grid grid-cols-[minmax(0,auto)_minmax(0,1fr)] gap-2 text-[11px]",children:[o.jsx("span",{children:n.label}),o.jsx("span",{className:"break-words text-[var(--foreground)]",children:n.value})]},n.id))]})}function gq(e){return e.style==="primary"?"default":e.style==="danger"?"destructive":"outline"}function vq({item:e}){const t=e.rotateKind==="fork"?yO:aO;return o.jsxs("div",{className:"my-2 flex items-center gap-2 text-[10px] text-[var(--muted-foreground)]",children:[o.jsx("div",{className:"h-px flex-1 bg-[var(--border)]"}),o.jsx(t,{className:"size-3 shrink-0 text-[var(--primary)]"}),o.jsx("span",{className:"label-caps",children:e.label}),o.jsx("span",{className:"font-mono opacity-70",children:e.newSessionId.slice(0,12)}),o.jsx("div",{className:"h-px flex-1 bg-[var(--border)]"})]})}function _q({item:e}){return e.code==="response_stopped"?o.jsxs("div",{className:"my-1 flex items-center gap-2 px-1 py-1 text-xs text-[var(--muted-foreground)]",children:[o.jsx(nE,{className:"size-3.5 shrink-0"}),o.jsx("span",{children:"Response stopped"})]}):o.jsxs("div",{className:"my-1 flex gap-2 rounded-md border border-[var(--destructive)]/40 bg-[var(--destructive)]/5 px-3 py-2 text-sm",children:[o.jsx(bi,{className:"size-4 shrink-0 text-[var(--destructive)]"}),o.jsxs("div",{className:"min-w-0",children:[o.jsxs("div",{className:"label-caps text-[10px] text-[var(--destructive)]",children:[e.source," error · ",e.code]}),o.jsx("div",{className:"mt-0.5 whitespace-pre-wrap break-words text-[var(--foreground)]/80",children:e.message})]})]})}const xq="modulepreload",yq=function(e){return"/"+e},W2={},bq=function(t,r,s){let n=Promise.resolve();if(r&&r.length>0){let u=function(f){return Promise.all(f.map(v=>Promise.resolve(v).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),m=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));n=u(r.map(f=>{if(f=yq(f),f in W2)return;W2[f]=!0;const v=f.endsWith(".css"),p=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${p}`))return;const x=document.createElement("link");if(x.rel=v?"stylesheet":xq,v||(x.as="script"),x.crossOrigin="",x.href=f,m&&x.setAttribute("nonce",m),document.head.appendChild(x),v)return new Promise((b,w)=>{x.addEventListener("load",b),x.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${f}`)))})}))}function l(u){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=u,window.dispatchEvent(d),!d.defaultPrevented)throw u}return n.then(u=>{for(const d of u||[])d.status==="rejected"&&l(d.reason);return t().catch(l)})},wq=g.lazy(()=>bq(()=>import("./mermaid-GHXKKRXX-DPZO2Q9W.js").then(e=>e.i),[]).then(e=>({default:e.Streamdown}))),Sq=We("min-w-0 text-sm leading-relaxed break-words","[&_p]:my-1.5 [&_ul]:my-1.5 [&_ol]:my-1.5 [&_li]:my-0.5","[&_pre]:my-2 [&_pre]:rounded-md [&_pre]:text-xs","[&_code]:font-mono [&_h1]:mt-3 [&_h2]:mt-3 [&_h3]:mt-2","[&_a]:text-[var(--primary)] [&_a]:underline [&_a]:underline-offset-2");function Cq({isOpen:e,onClose:t,onConfirm:r,url:s}){return o.jsx(IA,{open:e,url:s,onOpenChange:n=>{n||t()},onConfirm:r})}function aM({children:e,className:t}){return o.jsx(g.Suspense,{fallback:o.jsx("div",{className:We("whitespace-pre-wrap break-words text-sm",t),children:e}),children:o.jsx(wq,{shikiTheme:["github-light","github-dark"],linkSafety:{enabled:!0,renderModal:Cq},className:We(Sq,t),children:e})})}function kq({item:e,sessionId:t,runtimeSelector:r}){const[s,n]=g.useState(null),[l,u]=g.useState(()=>new Set),d=e.images??[],m=d.find(f=>f.resourceId===s);return g.useEffect(()=>{if(!s)return;const f=v=>{v.key==="Escape"&&n(null)};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[s]),e.role==="user"?o.jsx("div",{className:"flex justify-end",children:o.jsxs("div",{className:"max-w-[85%] rounded-md rounded-br-sm bg-[var(--primary)]/10 p-2 text-sm dark:bg-[var(--primary)]/25 dark:ring-1 dark:ring-inset dark:ring-[var(--primary)]/35",children:[d.length>0&&o.jsx("div",{className:`grid gap-1.5 ${d.length===1?"grid-cols-1":"grid-cols-2"}`,children:d.map(f=>{const v=xe.sessionResourceContentUrl(r,t,f),p=l.has(f.resourceId);return o.jsx("button",{type:"button",className:"group relative size-28 overflow-hidden rounded-md border border-black/10 bg-[var(--muted)] text-[var(--muted-foreground)] sm:size-36",onClick:()=>{p||n(f.resourceId)},"aria-label":`Open ${f.filename??"attached image"}`,children:p?o.jsxs("span",{className:"flex size-full items-center justify-center gap-2 px-3 text-xs",children:[o.jsx(RO,{className:"size-4"}),"Image unavailable"]}):o.jsx("img",{src:v,alt:f.filename??"Attached image",loading:"lazy",className:"size-full object-cover transition-transform group-hover:scale-[1.02]",onError:()=>u(x=>new Set(x).add(f.resourceId))})},f.resourceId)})}),e.text&&o.jsx("div",{className:`whitespace-pre-wrap break-words px-1 ${d.length?"pt-2":""}`,children:e.text}),m&&o.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":m.filename??"Image preview",className:"fixed inset-0 z-50 grid min-h-0 min-w-0 place-items-center overflow-hidden bg-black/80 p-4",onClick:()=>n(null),children:[o.jsx("button",{type:"button",className:"absolute right-4 top-4 grid size-9 place-items-center rounded-full bg-black/60 text-white","aria-label":"Close image preview",onClick:()=>n(null),children:o.jsx(_n,{className:"size-5"})}),o.jsx("img",{src:xe.sessionResourceContentUrl(r,t,m),alt:m.filename??"Attached image",className:"block h-auto max-h-[calc(100dvh-2rem)] min-h-0 w-auto max-w-[calc(100vw-2rem)] min-w-0 rounded-md object-contain shadow-2xl",onClick:f=>f.stopPropagation()})]})]})}):o.jsx("div",{className:"flex justify-start",children:o.jsxs("div",{className:"flex min-w-0 max-w-[90%] flex-col items-start",children:[o.jsxs("div",{className:"rounded-md rounded-bl-sm bg-[var(--muted)] px-3.5 py-2.5",children:[e.text&&o.jsx(aM,{className:"[&>:first-child]:mt-0 [&>:last-child]:mb-0",children:e.text}),e.streaming&&o.jsx("span",{className:"ml-0.5 inline-block h-4 w-[3px] translate-y-0.5 animate-pulse rounded-full bg-[var(--primary)] align-middle"})]}),e.interrupted&&o.jsxs("div",{className:"mt-1 flex items-center gap-1 px-1 text-xs text-[var(--muted-foreground)]","data-testid":"assistant-interrupted-indicator",children:[o.jsx(nE,{className:"size-3.5 shrink-0","aria-hidden":"true"}),o.jsx("span",{children:"Response stopped"})]})]})})}function Eq({item:e}){const t=e.summary.filter(Boolean).join(`
|
|
582
|
-
|
|
583
|
-
`).trim(),[r,s]=g.useState(e.streaming??!1);return g.useEffect(()=>{s(e.streaming??!1)},[e.streaming]),!t&&!e.streaming?null:o.jsxs(sp,{open:r,onOpenChange:s,className:"my-0.5",children:[o.jsxs(ip,{className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-xs text-[var(--muted-foreground)] hover:bg-[var(--muted)]/50",children:[o.jsx(oo,{className:We("size-3 shrink-0 transition-transform",r&&"rotate-90")}),o.jsx(pE,{className:"size-3.5 shrink-0"}),o.jsx("span",{className:We("label-caps text-[10px]",e.streaming&&"animate-pulse"),children:e.streaming?"Thinking…":"Thought"})]}),o.jsx(np,{className:"overflow-hidden pl-7",children:o.jsx("div",{className:"mt-1 border-l-2 border-[var(--border)] pl-3 text-[var(--muted-foreground)]",children:t?o.jsx(aM,{children:t}):o.jsx("span",{className:"animate-pulse text-xs",children:"…"})})})]})}const q2=12e3;function V2(e){return e.length<=q2?{text:e,truncated:!1}:{text:e.slice(0,q2),truncated:!0}}function Rq({item:e}){const[t,r]=g.useState(!1),s=e.stdout?V2(e.stdout):null,n=e.stderr?V2(e.stderr):null,l=!!(s||n);return o.jsxs(sp,{open:t,onOpenChange:r,className:"my-0.5",children:[o.jsxs(ip,{className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-xs hover:bg-[var(--muted)]/50",children:[o.jsx(oo,{className:We("size-3 shrink-0 text-[var(--muted-foreground)] transition-transform",t&&"rotate-90")}),o.jsx(gE,{className:"size-3.5 shrink-0 text-[var(--primary)]"}),o.jsxs("span",{className:"truncate font-mono",children:[o.jsx("span",{className:"text-[var(--muted-foreground)]",children:"$ "}),e.command]})]}),o.jsxs(np,{className:"overflow-hidden pl-7",children:[s&&o.jsxs("pre",{className:"mt-1 overflow-auto rounded-md border border-[var(--border)] p-2 text-[11px] leading-relaxed",children:[o.jsx("code",{children:s.text}),s.truncated&&o.jsx("div",{className:"mt-1 text-[var(--muted-foreground)]",children:"… output truncated"})]}),n&&o.jsxs("pre",{className:"mt-1 overflow-auto rounded-md border border-[var(--destructive)]/40 p-2 text-[11px] leading-relaxed text-[var(--destructive)]",children:[o.jsx("code",{children:n.text}),n.truncated&&o.jsx("div",{className:"mt-1 text-[var(--muted-foreground)]",children:"… output truncated"})]}),!l&&o.jsx("div",{className:"mt-1 text-[11px] text-[var(--muted-foreground)]",children:"(no output)"})]})]})}const G2=80,Y2=12e3;function Nq(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function jq(e){try{const t=JSON.parse(e);for(const s of["command","cmd","path","file","file_path","query","url","pattern","description"]){const n=t[s];if(typeof n=="string"&&n)return n}const r=JSON.stringify(t);return r==="{}"?"":r}catch{return e}}function Aq(e){let t=e,r=!1;const s=t.split(`
|
|
584
|
-
`);return s.length>G2&&(t=s.slice(0,G2).join(`
|
|
585
|
-
`),r=!0),t.length>Y2&&(t=t.slice(0,Y2),r=!0),{text:t,truncated:r}}function Mq({status:e}){return e==="in_progress"?o.jsx(ze,{className:"size-3.5 shrink-0 animate-spin text-[var(--primary)]"}):e==="failed"?o.jsx(X4,{className:"size-3.5 shrink-0 text-[var(--destructive)]"}):e==="incomplete"?o.jsx(G4,{className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}):o.jsx(Br,{className:"size-3.5 shrink-0 text-[var(--success)]"})}function Tq({item:e,sessionId:t,runtimeSelector:r,canResolveInteractions:s=!0}){const[n,l]=g.useState(!1),u=jq(e.arguments),d=e.output?Aq(e.output):null,m=!!e.arguments&&e.arguments!=="{}",f=e.children??[];return o.jsxs(sp,{open:n,onOpenChange:l,className:"my-0.5",children:[o.jsxs(ip,{className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-xs hover:bg-[var(--muted)]/50",children:[o.jsx(oo,{className:We("size-3 shrink-0 text-[var(--muted-foreground)] transition-transform",n&&"rotate-90")}),o.jsx(Mq,{status:e.status}),o.jsx("span",{className:"shrink-0 font-mono font-medium",children:e.name}),u&&o.jsx("span",{className:"truncate text-[var(--muted-foreground)]",children:u})]}),o.jsxs(np,{className:"overflow-hidden pl-7",children:[m&&o.jsx("pre",{className:"mt-1 overflow-auto rounded-md bg-[var(--muted)] p-2 text-[11px] leading-relaxed",children:o.jsx("code",{children:Nq(e.arguments)})}),d&&o.jsxs("pre",{className:"mt-1 overflow-auto rounded-md border border-[var(--border)] p-2 text-[11px] leading-relaxed",children:[o.jsx("code",{children:d.text}),d.truncated&&o.jsx("div",{className:"mt-1 text-[var(--muted-foreground)]",children:"… output truncated"})]}),e.exitCode!=null&&e.exitCode!==0&&o.jsxs("div",{className:"mt-1 text-[11px] text-[var(--destructive)]",children:["exit code ",e.exitCode]}),f.length>0&&o.jsxs("div",{className:"mt-1 border-l border-[var(--primary)]/30 pl-2",children:[o.jsxs("div",{className:"mb-0.5 flex items-center gap-1.5 text-[11px] text-[var(--muted-foreground)]",children:[o.jsx(tB,{className:"size-3 shrink-0 text-[var(--primary)]"}),o.jsxs("span",{className:"font-mono",children:[f.length," sub-agent step",f.length===1?"":"s"]})]}),f.map(v=>o.jsx(oM,{item:v,sessionId:t,runtimeSelector:r,canResolveInteractions:s},v.id))]})]})]})}function oM({item:e,sessionId:t,runtimeSelector:r,canResolveInteractions:s=!0}){switch(e.kind){case"message":return e.isMeta?null:o.jsx(kq,{item:e,sessionId:t,runtimeSelector:r});case"tool":return o.jsx(Tq,{item:e,sessionId:t,runtimeSelector:r,canResolveInteractions:s});case"reasoning":return o.jsx(Eq,{item:e});case"terminal_command":return o.jsx(Rq,{item:e});case"divider":return o.jsx(vq,{item:e});case"error":return o.jsx(_q,{item:e});case"interaction":return o.jsx(fq,{sessionId:t,item:e,canResolve:s})}}function Dq(){return o.jsx("div",{className:"flex items-center gap-1.5 py-2 pl-1",children:[0,1,2].map(e=>o.jsx("span",{className:"size-1.5 rounded-full bg-[var(--primary)]",style:{animation:"typing-dot 1.3s ease-in-out infinite",animationDelay:`${e*.18}s`}},e))})}function Lq({message:e}){return o.jsxs("div",{"data-testid":"runner-starting-indicator",role:"status","aria-live":"polite",className:"flex items-center gap-2 py-2 text-sm text-[var(--muted-foreground)]",children:[o.jsx(ze,{className:"size-4 shrink-0 animate-spin text-[var(--muted-foreground)]","aria-hidden":"true"}),o.jsx("span",{children:e??"Starting up… getting your terminal ready."})]})}function Oq({message:e}){const t=/^MCP startup (?:failed|cancelled|incomplete)/i.test(e),r=t?bi:ze;return o.jsxs("div",{"data-testid":"mcp-startup-indicator",role:"status","aria-live":"polite",className:"flex items-center gap-2 py-2 text-sm text-[var(--muted-foreground)]",children:[o.jsx(r,{className:`size-4 shrink-0 ${t?"":"animate-spin"}`,"aria-hidden":"true"}),o.jsx("span",{children:e})]})}function Bq(e){if(e<60)return`${e}s`;const t=Math.floor(e/60),r=e%60;return`${t}m ${r}s`}function Pq({message:e}){const t=g.useRef(Date.now()),[r,s]=g.useState(0);return g.useEffect(()=>{const n=()=>s(Math.floor((Date.now()-t.current)/1e3));n();const l=window.setInterval(n,1e3);return()=>window.clearInterval(l)},[]),o.jsxs("div",{role:"status","aria-live":"polite",className:"flex gap-3 rounded-lg border border-[color-mix(in_srgb,var(--warning)_35%,var(--border))] bg-[color-mix(in_srgb,var(--warning)_8%,var(--card))] px-3 py-2.5",children:[o.jsx(ze,{className:"mt-0.5 size-4 shrink-0 animate-spin text-[var(--warning)]","aria-hidden":"true"}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1",children:[o.jsx("span",{className:"text-sm font-medium text-[var(--foreground)]",children:"Queued for capacity"}),o.jsxs("span",{className:"font-mono text-[10px] text-[var(--muted-foreground)]",children:["Waiting ",Bq(r)]})]}),o.jsx("p",{className:"mt-0.5 text-xs leading-relaxed text-[var(--muted-foreground)]",children:e}),o.jsx("p",{className:"mt-1 font-mono text-[10px] text-[var(--muted-foreground)]",children:"Use Stop below to interrupt."})]})]})}function Iq({items:e,historyLoaded:t,running:r,startingUp:s=!1,startupStatus:n,mcpStatus:l,waitingForInteraction:u,queueStatus:d,sessionId:m,runtimeSelector:f,canResolveInteractions:v=!0}){const p=g.useRef(null),[x,b]=g.useState(!0),w=e[e.length-1],C=(w==null?void 0:w.kind)==="message"&&w.role==="assistant"&&!!w.streaming,k=(s||!!n)&&!d,S=r&&!k&&!C&&!u&&!d;return g.useEffect(()=>{x&&p.current&&(p.current.scrollTop=p.current.scrollHeight)},[e,r,s,n,l,d,x]),o.jsx(xn,{className:"min-w-0 flex-1",viewportRef:p,viewportProps:{onScroll:E=>{const N=E.currentTarget;b(N.scrollHeight-N.scrollTop-N.clientHeight<40)},"aria-busy":!t},children:o.jsx("div",{className:"mx-auto w-full max-w-3xl space-y-3 px-4 py-3",children:!t&&e.length===0&&!d&&!k?o.jsxs("div",{role:"status","aria-live":"polite",className:"flex items-center justify-center gap-2 py-10 text-sm text-[var(--muted-foreground)]",children:[o.jsx(ze,{className:"size-4 animate-spin text-[var(--primary)]","aria-hidden":"true"}),o.jsx("span",{children:"Loading conversation…"})]}):e.length===0&&!r&&!d&&!k?o.jsx("p",{className:"py-10 text-center text-sm text-[var(--muted-foreground)]",children:"Send a message to start a turn."}):o.jsxs(o.Fragment,{children:[e.map(E=>o.jsx(oM,{item:E,sessionId:m,runtimeSelector:f,canResolveInteractions:v},E.id)),k&&o.jsx(Lq,{message:n}),l&&o.jsx(Oq,{message:l}),d&&o.jsx(Pq,{message:d}),S&&o.jsx(Dq,{})]})})})}const zq=2500,Su=new Map;function $q({sessionId:e,runtimeSelector:t,active:r,polling:s=r,readOnly:n=!1}){const l=`${t}
|
|
586
|
-
${e}`,u=g.useRef(l);u.current=l;const d=g.useRef(r);d.current=r;const m=g.useRef(0),f=g.useRef(0),v=g.useRef(!1),p=g.useRef(null),x=g.useRef(null),[b,w]=g.useState(()=>Su.get(l)??null),[C,k]=g.useState(()=>!Su.has(l)),[S,E]=g.useState(null),[N,R]=g.useState(null),A=g.useCallback(L=>{x.current=L,R(L)},[]),D=g.useCallback(L=>{p.current=L,Su.set(l,L),w(L)},[l]),B=g.useCallback(async L=>{if(!d.current||v.current)return;const I=l,F=m.current,M=f.current;L&&k(!0);try{const P=await xe.getRuntimeBrowserState(t,e);return!d.current||m.current!==F||f.current!==M||u.current!==I||v.current?void 0:(D(P),L&&A(null),P)}catch(P){if(!d.current||m.current!==F||f.current!==M||u.current!==I)return;L&&A(lf(P));return}finally{d.current&&m.current===F&&f.current===M&&u.current===I&&L&&k(!1)}},[l,t,e,D,A]);g.useEffect(()=>{const L=++m.current,I=Su.has(l);return D(Su.get(l)??null),A(null),k(!I),E(null),v.current=!1,B(!I),()=>{m.current===L&&(m.current+=1)}},[l,r,B,D,A]),g.useEffect(()=>{if(!s)return;const L=window.setInterval(()=>void B(!1),zq);return()=>window.clearInterval(L)},[r,B,s]);const $=g.useCallback(async(L,I)=>{if(n||!d.current||v.current)return;const F=l,M=m.current;f.current+=1,v.current=!0,E(L),A(null);try{const P=await I();return d.current&&m.current===M&&u.current===F?(D(P),P):void 0}catch(P){d.current&&m.current===M&&u.current===F&&A(lf(P));return}finally{d.current&&m.current===M&&u.current===F&&(v.current=!1,E(null),k(!1))}},[n,l,D,A]),q=g.useCallback((L,I)=>{const F=p.current;return F?$(L,()=>I(F.browserGeneration)):Promise.resolve(void 0)},[$]),Y=g.useCallback(L=>$("Starting browser",()=>xe.openRuntimeBrowser(t,e,L)),[t,e,$]),V=g.useCallback(async()=>{if(n)return;const L=p.current;if(!d.current||!L||v.current)return;const I=l,F=m.current;f.current+=1,v.current=!0,E("Closing browser"),A(null);try{await xe.closeRuntimeBrowser(t,e,L.browserGeneration),d.current&&m.current===F&&u.current===I&&D(null)}catch(M){d.current&&m.current===F&&u.current===I&&A(lf(M))}finally{d.current&&m.current===F&&u.current===I&&(v.current=!1,E(null))}},[n,l,t,e,D,A]),U=g.useCallback(async()=>{if(n)return;const L=p.current;if(!d.current||!L||v.current)return;const I=l,F=m.current;f.current+=1,v.current=!0,E("Opening in Desktop"),A(null);try{const M=await bW(L,{close:P=>xe.closeRuntimeBrowser(t,e,P).then(()=>{}),open:P=>xe.openRuntimeBrowser(t,e,P),createPage:(P,O)=>xe.createRuntimeBrowserPage(t,e,P,O),activatePage:(P,O)=>xe.activateRuntimeBrowserPage(t,e,P,O),onProgress:P=>{d.current&&m.current===F&&u.current===I&&(D(P),E("Restoring browser tabs"))}});return d.current&&m.current===F&&u.current===I?(D(M),(M.executionBackend!=="embedded-electron"||!M.capabilities.includes(Ny))&&A("Desktop Browser Host is unavailable; using streamed browser"),M):void 0}catch(M){const P=await xe.getRuntimeBrowserState(t,e).catch(()=>{});d.current&&m.current===F&&u.current===I&&(P!==void 0&&D(P),A(lf(M)));return}finally{d.current&&m.current===F&&u.current===I&&(v.current=!1,E(null),k(!1))}},[n,l,t,e,D,A]);return{browser:b,loading:C,pendingAction:S,error:N,currentError:()=>x.current,disabled:n||S!==null||(b==null?void 0:b.status)!=="ready",createDisabled:n||S!==null,load:B,openBrowser:Y,closeBrowser:V,recreateForDesktop:U,createPage:()=>q("Creating page",L=>xe.createRuntimeBrowserPage(t,e,L)),closePage:L=>q("Closing page",I=>xe.closeRuntimeBrowserPage(t,e,I,L)),activatePage:L=>q("Switching page",I=>xe.activateRuntimeBrowserPage(t,e,I,L)),navigatePage:(L,I)=>q("Navigating",F=>xe.navigateRuntimeBrowserPage(t,e,F,L,I)),backPage:L=>q("Going back",I=>xe.backRuntimeBrowserPage(t,e,I,L)),forwardPage:L=>q("Going forward",I=>xe.forwardRuntimeBrowserPage(t,e,I,L)),reloadPage:L=>q("Reloading page",I=>xe.reloadRuntimeBrowserPage(t,e,I,L))}}const Uq=2500,Cu=new Map;function Hq({sessionId:e,runtimeSelector:t,active:r,polling:s=r,devicesActive:n=!1,readOnly:l=!1}){const u=`${t}
|
|
587
|
-
${e}`,[d,m]=g.useState(()=>Cu.get(u)??null),[f,v]=g.useState([]),[p,x]=g.useState(()=>!Cu.has(u)),[b,w]=g.useState(!1),[C,k]=g.useState(!1),[S,E]=g.useState(null),N=g.useRef(0),R=g.useRef(0),A=g.useRef(!1),D=g.useRef(!1),B=g.useRef(!1),$=g.useRef(null);$.current=d;const q=g.useCallback(M=>{$.current=M,Cu.set(u,M),m(M)},[u]),Y=g.useCallback(async()=>{if(A.current)return;const M=N.current,P=R.current;D.current||x(!0);try{const O=await xe.getSessionEmulator(t,e);if(N.current!==M||R.current!==P||A.current)return;q(O),E(null)}catch(O){if(N.current!==M||R.current!==P||A.current)return;E(n_(O))}finally{N.current===M&&R.current===P&&!A.current&&(D.current=!0,x(!1))}},[t,e,q]),V=g.useCallback(async()=>{if(A.current)return;const M=N.current,P=R.current;w(!0);try{const O=await xe.listSessionEmulatorDevices(t,e);if(N.current!==M||R.current!==P||A.current)return;v(O),E(null)}catch(O){if(N.current!==M||R.current!==P||A.current)return;E(n_(O))}finally{N.current===M&&R.current===P&&!A.current&&(B.current=!0,w(!1))}},[t,e]);g.useEffect(()=>{N.current+=1;const M=Cu.has(u);q(Cu.get(u)??null),v([]),E(null),x(!M),w(!1),k(!1),A.current=!1,D.current=M,B.current=!1,Y()},[r,Y,u,q]),g.useEffect(()=>{if(!s)return;const M=window.setInterval(()=>void Y(),Uq);return()=>window.clearInterval(M)},[r,s,Y]),g.useEffect(()=>{!n||p||C||d||B.current||V()},[r,d,n,p,C,V]);const U=g.useCallback(async(M,P)=>{if(l)throw new Error("Session Portal is read only");const O=N.current,W=++R.current;A.current=!0,k(!0),E(null);try{const H=await M();return N.current!==O||R.current!==W?null:(P==null||P(H),H)}catch(H){throw N.current===O&&R.current===W&&E(n_(H)),H}finally{N.current===O&&R.current===W&&(A.current=!1,k(!1))}},[l]),L=g.useCallback(M=>U(()=>xe.attachSessionEmulator(t,e,M),P=>q(P)),[U,t,e]),I=g.useCallback(async()=>{const M=$.current;return M?await U(()=>xe.detachSessionEmulator(t,e,M.bindingId),()=>q(null))!==null:!1},[U,t,e]),F=g.useCallback(async M=>{const P=$.current;if(!P)throw new Error("This Session has no Emulator attached");await U(()=>M(P))},[U]);return{binding:d,devices:f,loading:p,devicesLoading:b,mutating:l||C,error:S,reload:Y,reloadDevices:V,attach:L,detach:I,tap:(M,P)=>F(O=>xe.tapSessionEmulator(t,e,O.bindingId,M,P)),gesture:M=>F(P=>xe.gestureSessionEmulator(t,e,P.bindingId,M)),button:M=>F(P=>xe.buttonSessionEmulator(t,e,P.bindingId,M))}}function n_(e){return e instanceof Error?e:new Error(String(e))}const lM="rynx.session-resource-dock-width";function Fq({session:e,runtimeSelector:t,leadingControls:r,initialDraft:s,initialMessage:n,sendInitialMessage:l=!1,onInitialMessageStarted:u,onInitialMessageConsumed:d,onInitialMessageFailed:m,terminalSlotRef:f,onTerminalActiveChange:v,readOnly:p=!1}){var ei,fr,Rn,mo,mr,Pt;const[x,b]=b4(),w=x.get("view"),C=w==="terminal"?"terminal":"chat";g.useEffect(()=>(v==null||v(e.id,C==="terminal"),()=>v==null?void 0:v(e.id,!1)),[v,e.id,C]);const k=jF(x.get("surface")),S=x.get("panel")==="resources",E=w==="browser"||k!==null||S,N=(k==null?void 0:k.type)==="browser"?k.pageId:null,R=g.useRef(null),A=g.useRef(null),D=g.useRef("browser"),B=g.useRef(null),$=g.useRef(0),q=g.useRef(null),[Y]=g.useState(Wq),V=g.useRef(Y),U=g.useRef(null),L=g.useRef(null),I=g.useRef(null),F=g.useRef(null),M=g.useRef(null),P=g.useRef(null),O=g.useRef(!1),[W,H]=g.useState(!1),[T,G]=g.useState(!1),[X,ee]=g.useState(null),[oe,de]=g.useState(Pu),[Z,ce]=g.useState(!1),[le,be]=g.useState(!1),[ke,Ee]=g.useState([]),[te,re]=g.useState(!!n),Ce=g.useRef(null),{state:De,pendingSend:_e,current:Re,send:Pe,stop:Ue}=GF(e.id,{runtimeSelector:t,allowSend:!p}),qe=$q({sessionId:e.id,runtimeSelector:t,active:!0,polling:E,readOnly:p}),Ie=Hq({sessionId:e.id,runtimeSelector:t,active:!0,polling:E,devicesActive:(k==null?void 0:k.type)==="emulator",readOnly:p}),Ve=g.useMemo(()=>AF(qe.browser,N,R.current),[qe.browser,N]),ct=FF(_e,De.runStatus==="running"||De.waitingForInteraction,Re,e.status==="running"),Qr=e.agent??(e.provider?nd(e.provider):void 0),Ct=(ei=EF(De))==null?void 0:ei.model,Nr=g.useMemo(()=>RF(De.items),[De.items]),cs=g.useMemo(()=>!n||Nr.length>0?Nr:[{kind:"message",id:"optimistic_initial",responseId:"optimistic_initial",role:"user",text:n,images:[],streaming:!1,optimistic:!0}],[n,Nr]),tr=gF(De.statusKind,De.note)?De.note:void 0,kt=De.statusKind==="startup"&&tr===void 0,Ge=De.waitingForInteraction||De.runStatus==="running"&&!kt,Et=kt||!Ge&&(_e||te),us=((fr=qe.browser)==null?void 0:fr.pages)??[],zt=(k==null?void 0:k.type)==="emulator"||W,ds=qe.loading||Ie.loading,Vt=us.length>0||zt,Le=g.useMemo(()=>[...us.map(he=>ln(he.pageId)),...zt?[cn()]:[]],[us,zt]),Ze=g.useMemo(()=>S2(ke,Le),[Le,ke]);g.useEffect(()=>{Ee(he=>{const je=S2(he,Le);return qq(he,je)?he:je})},[Le]),g.useEffect(()=>{const he=q.current;if(!he)return;const je=()=>{const Zt=he.getBoundingClientRect().width,Ar=of(Zt,Number.POSITIVE_INFINITY);de(Ar);const Xi=V.current,ti=of(Zt,Xi??Zt*w2);Xi!==null&&he.style.setProperty("--session-resource-dock-width",`${ti}px`),U.current=ti,ee(ti)};je();const nt=new ResizeObserver(je);return nt.observe(he),()=>nt.disconnect()},[]),g.useEffect(()=>()=>{var he;I.current!==null&&window.cancelAnimationFrame(I.current),(he=M.current)==null||he.call(M),K2(P)},[]),g.useEffect(()=>{R.current=null,A.current=null,D.current="browser",B.current=null,H(!1),be(!1),Ee([]),$.current+=1},[t,e.id]),g.useEffect(()=>{if(!n||!l||Ce.current===n)return;Ce.current=n,re(!0),u==null||u(),Pe(n).catch(je=>{re(!1),Jm(je)&&(m==null||m(n))})},[n,m,u,Pe,l]),g.useEffect(()=>{!n||!Nr.some(je=>je.kind==="message"&&je.role==="user"&&je.optimistic!==!0&&je.text===n)||(re(!1),d==null||d())},[n,d,Nr]);const He=(he,je=!0)=>{je&&($.current+=1);const nt=new URLSearchParams(x);he?(nt.set("surface",he),nt.delete("panel")):(nt.delete("surface"),nt.set("panel","resources")),nt.get("view")==="browser"&&nt.set("view","chat"),b(nt,{replace:!0})},jr=()=>{$.current+=1,be(!1);const he=new URLSearchParams(x);he.delete("surface"),he.delete("panel"),he.get("view")==="browser"&&he.set("view","chat"),b(he,{replace:!0})},Jr=()=>{if(D.current==="emulator"&&W){He(cn(B.current));return}if(R.current){He(ln(R.current));return}if(W){He(cn(B.current));return}He(null)};g.useEffect(()=>{k&&(D.current=k.type,k.type==="emulator"&&H(!0))},[k==null?void 0:k.type]),g.useEffect(()=>{var je;const he=((je=Ie.binding)==null?void 0:je.bindingId)??null;he&&(B.current&&he!==B.current?H(!0):B.current||H(!0),B.current=he)},[(Rn=Ie.binding)==null?void 0:Rn.bindingId]),g.useEffect(()=>{if(w!=="browser")return;const he=new URLSearchParams(x);he.set("view","chat"),he.set("surface",ln(Ve)),he.delete("panel"),b(he,{replace:!0})},[w,x,Ve,b]),g.useEffect(()=>{if((k==null?void 0:k.type)!=="browser")return;Ve&&(R.current=Ve);const he=ln(Ve);if(x.get("surface")===he)return;const je=new URLSearchParams(x);je.set("surface",he),b(je,{replace:!0})},[k==null?void 0:k.type,x,Ve,b]),g.useEffect(()=>{const he=us.map(nt=>nt.pageId),je=MF(A.current,qe.browser);A.current=he,!(!je||(k==null?void 0:k.type)!=="browser")&&(R.current=je,He(ln(je),!1))},[us,qe.browser,k==null?void 0:k.type]),g.useEffect(()=>{var nt;if((k==null?void 0:k.type)!=="emulator")return;const he=cn((nt=Ie.binding)==null?void 0:nt.bindingId);if(x.get("surface")===he)return;const je=new URLSearchParams(x);je.set("surface",he),b(je,{replace:!0})},[(mo=Ie.binding)==null?void 0:mo.bindingId,k==null?void 0:k.type,x,b]),g.useEffect(()=>{var he,je;if(!(!E||ds)){if(!Vt){k&&He(null,!1);return}(k==null?void 0:k.type)==="browser"&&Ve||(k==null?void 0:k.type)==="emulator"&&zt||(D.current==="emulator"&&zt?He(cn((he=Ie.binding)==null?void 0:he.bindingId),!1):Ve?He(ln(Ve),!1):zt&&He(cn((je=Ie.binding)==null?void 0:je.bindingId),!1))}},[(mr=Ie.binding)==null?void 0:mr.bindingId,zt,Vt,k==null?void 0:k.type,E,ds,Ve]);const $t=async()=>{var je,nt;if(O.current)return;O.current=!0,G(!0);const he=$.current;try{const Zt=((je=qe.browser)==null?void 0:je.status)==="ready"?await qe.createPage():await qe.openBrowser(),Ar=(Zt==null?void 0:Zt.activePageId)??((nt=Zt==null?void 0:Zt.pages.at(-1))==null?void 0:nt.pageId);if(!Zt){pe.error(`Could not create Browser tab: ${qe.currentError()??"Browser is unavailable"}`);return}Ar&&$.current===he&&He(ln(Ar),!1)}finally{O.current=!1,G(!1)}},rr=he=>{const je=q.current;if(!je)return null;const nt=of(je.getBoundingClientRect().width,he);return je.style.setProperty("--session-resource-dock-width",`${nt}px`),U.current=nt,nt},Fe=he=>{const je=q.current;return je?rr(je.getBoundingClientRect().right-he):null},wt=he=>{if(he!==null){V.current=he,ee(he);try{window.localStorage.setItem(lM,String(Math.round(he)))}catch{}}},Gt=he=>{F.current=he,I.current===null&&(I.current=window.requestAnimationFrame(()=>{I.current=null;const je=F.current;F.current=null,je!==null&&Fe(je)}))},sr=(he,je,nt)=>{var Ar;if(L.current!==je)return;I.current!==null&&(window.cancelAnimationFrame(I.current),I.current=null),F.current=null;const Zt=nt===void 0?U.current:Fe(nt);wt(Zt),L.current=null,(Ar=M.current)==null||Ar.call(M),M.current=null,he.hasPointerCapture(je)&&he.releasePointerCapture(je),K2(P),ce(!1)},Ls=he=>{var ti;if(he.button!==0)return;he.preventDefault(),(ti=M.current)==null||ti.call(M),L.current=he.pointerId;const je=he.currentTarget;je.setPointerCapture(he.pointerId);const nt=Mi=>{L.current===Mi.pointerId&&Gt(Mi.clientX)},Zt=Mi=>{sr(je,Mi.pointerId,Mi.clientX)},Ar=Mi=>{sr(je,Mi.pointerId)};window.addEventListener("pointermove",nt,!0),window.addEventListener("pointerup",Zt,!0),window.addEventListener("pointercancel",Ar,!0),M.current=()=>{window.removeEventListener("pointermove",nt,!0),window.removeEventListener("pointerup",Zt,!0),window.removeEventListener("pointercancel",Ar,!0)};const Xi=document.documentElement.style;P.current={cursor:Xi.cursor,userSelect:Xi.userSelect},Xi.cursor="col-resize",Xi.userSelect="none",ce(!0),Fe(he.clientX)},rt=he=>{const je=q.current;if(!je)return;const nt=U.current??of(je.getBoundingClientRect().width,je.getBoundingClientRect().width*w2),Zt=he.shiftKey?32:16;let Ar=null;he.key==="ArrowLeft"&&(Ar=nt+Zt),he.key==="ArrowRight"&&(Ar=nt-Zt),he.key==="Home"&&(Ar=0),he.key==="End"&&(Ar=Number.POSITIVE_INFINITY),Ar!==null&&(he.preventDefault(),wt(rr(Ar)))},hr=he=>{$.current+=1;const je=new URLSearchParams(x);je.set("view",he),b(je,{replace:!0})},Bt=o.jsx(ne,{type:"button",variant:"ghost",size:"icon",className:"size-9 shrink-0","aria-label":C==="chat"?"Open terminal":"Open chat",title:C==="chat"?"Open terminal":"Open chat",onClick:()=>hr(C==="chat"?"terminal":"chat"),children:C==="chat"?o.jsx(K6,{}):o.jsx(FO,{})}),Rt=o.jsx(ne,{type:"button",variant:"ghost",size:"icon",className:"size-9 shrink-0","aria-label":E?"Hide Session resources":"Show Session resources",title:E?"Hide Session resources":"Show Session resources",onClick:E?jr:Jr,children:E?o.jsx(a6,{}):o.jsx(l6,{})}),Xt=o.jsx(ne,{type:"button",variant:"ghost",size:"icon-sm",className:"hidden size-8 shrink-0 lg:inline-flex","aria-label":le?"Restore split view":"Expand resource pane","aria-pressed":le,title:le?"Restore split view":"Expand resource pane",onClick:()=>be(he=>!he),children:le?o.jsx(I6,{}):o.jsx(lO,{})});return o.jsx("div",{className:"flex h-full min-h-0 min-w-0 flex-col overflow-hidden",children:o.jsxs("div",{ref:q,className:"relative flex min-h-0 min-w-0 flex-1 overflow-hidden [--session-resource-dock-width:44%]",children:[o.jsxs("section",{"aria-hidden":le,className:We("min-h-0 min-w-0 flex-1 flex-col overflow-hidden",le?"hidden":"flex"),children:[o.jsxs("header",{className:"desktop-macos-titlebar-header app-drag-region flex h-12 shrink-0 items-center justify-between gap-3 border-b border-[var(--border)] px-3 sm:px-4",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r,o.jsx("h2",{className:"min-w-0 truncate text-sm font-medium",children:e.title??Qr??"session"})]}),o.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[Bt,!E&&Rt]})]}),o.jsxs(fF,{value:C,className:"relative flex min-h-0 min-w-0 flex-1 flex-col gap-0",children:[o.jsxs(gx,{value:"chat",forceMount:!0,className:"mt-0 flex min-h-0 flex-1 flex-col data-[state=inactive]:hidden",children:[o.jsx(hq,{todos:De.todos}),o.jsx(Iq,{items:cs,historyLoaded:De.historyLoaded,running:ct,startingUp:Et,startupStatus:kt?De.note:void 0,mcpStatus:tr,waitingForInteraction:De.waitingForInteraction,queueStatus:De.statusKind==="queue"?De.note:void 0,sessionId:e.id,runtimeSelector:t,canResolveInteractions:!p}),!p&&o.jsx(VW,{initialDraft:s,model:Ct,running:ct,sessionId:e.id,runtimeSelector:t,onSend:Pe,onStop:Ue})]}),o.jsx(gx,{value:"terminal",forceMount:!0,"aria-hidden":C!=="terminal",className:"mt-0 flex min-h-0 flex-1 flex-col data-[state=inactive]:invisible data-[state=inactive]:absolute data-[state=inactive]:inset-0",children:o.jsx("div",{ref:f,className:"flex min-h-0 flex-1 flex-col"})})]})]}),E&&o.jsxs(o.Fragment,{children:[!le&&o.jsx("div",{role:"separator","aria-label":"Resize Session resources","aria-orientation":"vertical","aria-valuemin":Math.min(Pu,oe),"aria-valuemax":oe,"aria-valuenow":Math.round(X??Pu),"aria-valuetext":`${Math.round(X??Pu)} pixels wide`,tabIndex:0,title:"Drag to resize Session resources",className:"group relative z-30 -mx-1 hidden w-2 shrink-0 cursor-col-resize touch-none outline-none lg:block",onPointerDown:Ls,onKeyDown:rt,children:o.jsx("span",{"aria-hidden":"true",className:`pointer-events-none absolute inset-y-0 left-1/2 -translate-x-1/2 bg-[var(--border)] transition-[width,background-color] duration-150 group-hover:w-0.5 group-hover:bg-[var(--primary)] group-focus-visible:w-0.5 group-focus-visible:bg-[var(--primary)] ${Z?"w-0.5 bg-[var(--primary)]":"w-px"}`})}),o.jsxs("aside",{className:We("flex min-h-0 min-w-0 flex-col overflow-hidden bg-[var(--card)]",le?"h-full w-full":"absolute inset-0 z-20 lg:static lg:z-auto lg:w-[var(--session-resource-dock-width)] lg:min-w-[22.5rem] lg:max-w-[calc(100%_-_26.25rem)]"),"aria-label":"Session resources",children:[Vt&&o.jsx(KW,{pages:us,order:Ze,selectedPageId:(k==null?void 0:k.type)==="browser"?Ve:null,selectionDisabled:qe.pendingAction!==null,mutationDisabled:qe.disabled,createDisabled:p||qe.createDisabled||T,createPending:T,emulatorAttached:!!Ie.binding,emulator:zt?{selected:(k==null?void 0:k.type)==="emulator",label:((Pt=Ie.binding)==null?void 0:Pt.deviceName)??"Emulator",busy:Ie.loading||Ie.mutating}:null,onSelectPage:he=>{var je;R.current=he,He(ln(he)),((je=qe.browser)==null?void 0:je.status)==="ready"&&qe.activatePage(he)},onClosePage:he=>{$.current+=1,R.current===he&&(R.current=null),qe.closePage(he)},onCreatePage:()=>{p||$t()},onSelectEmulator:()=>{var he;H(!0),He(cn((he=Ie.binding)==null?void 0:he.bindingId))},onCloseEmulator:()=>{H(!1),D.current="browser",He(Ve?ln(Ve):null)},onAddEmulator:()=>{var he;H(!0),He(cn((he=Ie.binding)==null?void 0:he.bindingId))},headerLeadingAction:le?r:void 0,leadingAction:Xt,trailingAction:Rt}),!Vt&&o.jsxs(o.Fragment,{children:[le&&r&&o.jsx("div",{className:"absolute left-3 top-1.5 z-10 flex h-8 items-center",children:r}),o.jsxs("div",{className:"absolute right-3 top-1.5 z-10 flex items-center gap-1 sm:right-4",children:[Xt,Rt]})]}),Vt?(k==null?void 0:k.type)==="emulator"?o.jsx(tq,{sessionId:e.id,runtimeSelector:t,controller:Ie,readOnly:p}):(k==null?void 0:k.type)==="browser"?o.jsx(zW,{sessionId:e.id,runtimeSelector:t,pageId:Ve,browserResource:qe,readOnly:p}):o.jsxs("div",{className:"grid min-h-0 flex-1 place-items-center","aria-live":"polite",children:[o.jsx(ze,{className:"size-5 animate-spin text-[var(--muted-foreground)]"}),o.jsx("span",{className:"sr-only",children:"Selecting Session resource"})]}):o.jsx(Vq,{browserBusy:p||qe.createDisabled||T,emulatorBusy:p||Ie.mutating,onOpenBrowser:()=>{p||$t()},onOpenEmulator:()=>{var he;H(!0),He(cn((he=Ie.binding)==null?void 0:he.bindingId))}})]})]})]})})}function Wq(){if(typeof window>"u")return null;try{const e=Number(window.localStorage.getItem(lM));return Number.isFinite(e)&&e>0?e:null}catch{return null}}function K2(e){const t=e.current;!t||typeof document>"u"||(document.documentElement.style.cursor=t.cursor,document.documentElement.style.userSelect=t.userSelect,e.current=null)}function qq(e,t){return e.length===t.length&&e.every((r,s)=>r===t[s])}function Vq({browserBusy:e,emulatorBusy:t,onOpenBrowser:r,onOpenEmulator:s}){return o.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center p-6",children:o.jsxs("div",{className:"w-full max-w-64 space-y-1","aria-label":"Session resource choices",children:[o.jsxs("button",{type:"button",disabled:e,onClick:r,className:"flex h-11 w-full items-center gap-3 rounded-md px-3 text-left text-sm outline-none transition-colors hover:bg-[var(--muted)] focus-visible:ring-2 focus-visible:ring-[var(--ring)] disabled:pointer-events-none disabled:opacity-50",children:[e?o.jsx(ze,{className:"size-4 shrink-0 animate-spin"}):o.jsx(Xu,{className:"size-4 shrink-0 text-[var(--muted-foreground)]"}),o.jsx("span",{children:"Browser"})]}),o.jsxs("button",{type:"button",disabled:t,onClick:s,className:"flex h-11 w-full items-center gap-3 rounded-md px-3 text-left text-sm outline-none transition-colors hover:bg-[var(--muted)] focus-visible:ring-2 focus-visible:ring-[var(--ring)] disabled:pointer-events-none disabled:opacity-50",children:[t?o.jsx(ze,{className:"size-4 shrink-0 animate-spin"}):o.jsx(uc,{className:"size-4 shrink-0 text-[var(--muted-foreground)]"}),o.jsx("span",{children:"Emulator"})]})]})})}const Gq=400,Yq=160;function Kq({sessions:e,runtimeSelector:t,runtimeLabel:r,listError:s,loading:n,selectedId:l,onCollapsedChange:u,onSelect:d,onNew:m,onRetry:f,onFork:v,onDeleted:p,readOnly:x=!1}){const[b,w]=g.useState(""),C=b.trim().toLocaleLowerCase(),k=g.useMemo(()=>C?e.filter(E=>[E.title,E.id,E.provider,E.provider?nd(E.provider):void 0,E.agent,E.source].some(N=>N==null?void 0:N.toLocaleLowerCase().includes(C))):e,[C,e]);async function S(E){try{await xe.closeSession(E,t)}catch(N){pe.error(`Delete session failed: ${N instanceof Error?N.message:String(N)}`);return}p(E)}return o.jsxs("aside",{className:"flex h-full min-h-0 min-w-0 flex-col bg-[var(--card)]/35","aria-label":"Sessions",children:[o.jsxs("div",{className:"app-drag-region desktop-macos-titlebar-inset shrink-0 border-b border-[var(--border)] p-2.5",children:[o.jsxs("div",{className:"mb-2 flex h-7 items-center gap-2 px-0.5",children:[o.jsxs(Ya,{to:vi(Ka(t)),className:"app-no-drag flex items-center gap-2","aria-label":"Rynx Sessions",children:[o.jsx("img",{src:am,alt:"rynx",className:"h-5 w-auto dark:brightness-0 dark:invert"}),o.jsx("span",{className:"label-caps text-[8px] text-[var(--muted-foreground)]",children:"control"})]}),o.jsx(ne,{variant:"ghost",size:"icon-sm",className:"app-no-drag ml-auto hidden md:inline-flex",onClick:()=>u(!0),title:"Collapse session list","aria-label":"Collapse session list","aria-expanded":"true",children:o.jsx(s6,{className:"size-3.5"})})]}),o.jsxs("div",{className:"app-no-drag flex items-center gap-2",children:[o.jsxs("label",{className:"relative min-w-0 flex-1",children:[o.jsx("span",{className:"sr-only",children:"Search sessions"}),o.jsx(fE,{className:"pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-[var(--muted-foreground)]"}),o.jsx(bt,{value:b,onChange:E=>w(E.target.value),placeholder:"Search sessions",className:"h-11 rounded-md pl-8 text-xs md:h-8"})]}),!x&&o.jsx(ne,{size:"icon",className:"size-11 shrink-0 md:size-8",onClick:m,title:"New session","aria-label":"New session",children:o.jsx(ls,{})})]})]}),s&&o.jsxs("div",{role:"alert",className:"flex items-start gap-2 border-b border-[var(--border)] bg-[var(--warning)]/8 px-3 py-2 text-xs",children:[o.jsx("span",{className:"min-w-0 flex-1 text-[var(--warning)]",children:s}),o.jsx(ne,{variant:"ghost",size:"sm",className:"h-6 shrink-0 px-2 text-[10px]",onClick:f,children:"Retry"})]}),o.jsx(xn,{className:"min-h-0 flex-1",children:n&&e.length===0?o.jsx(Zq,{}):e.length===0?o.jsxs("div",{className:"grid place-items-center gap-3 px-5 py-10 text-center",children:[o.jsxs("div",{children:[o.jsxs("p",{className:"text-sm font-medium",children:["No sessions on ",r]}),o.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:"Create one to start a conversation and terminal."})]}),!x&&o.jsxs(ne,{size:"sm",className:"h-11 md:h-8",onClick:m,children:[o.jsx(ls,{})," New session"]})]}):k.length===0?o.jsxs("div",{className:"px-5 py-10 text-center text-xs text-[var(--muted-foreground)]",children:["No sessions match “",b.trim(),"”."]}):o.jsx("ul",{className:"space-y-0.5 px-1.5 py-1.5",children:k.map(E=>o.jsx(Xq,{session:E,runtimeLabel:r,selected:l===E.id,onSelect:()=>d(E.id),onFork:()=>v(E.id),onDelete:()=>S(E.id),readOnly:x},E.id))})})]})}function Xq({session:e,runtimeLabel:t,selected:r,onSelect:s,onFork:n,onDelete:l,readOnly:u}){const[d,m]=g.useState(!1),[f,v]=g.useState(!1),[p,x]=g.useState(!1),[b,w]=g.useState(!1),C=g.useRef(null),k=g.useRef(null),S=Qq(e.updatedAt??e.createdAt),E=e.agent??(e.provider?nd(e.provider):void 0),N=e.title??E??e.source??"Untitled session";g.useEffect(()=>()=>{C.current!==null&&window.clearTimeout(C.current),k.current!==null&&window.clearTimeout(k.current)},[]);const R=()=>{C.current!==null&&(window.clearTimeout(C.current),C.current=null)},A=()=>{k.current!==null&&(window.clearTimeout(k.current),k.current=null)},D=()=>{R(),A(),!p&&v(!0)},B=()=>{A(),!(p||f||C.current!==null)&&(C.current=window.setTimeout(()=>{C.current=null,v(!0)},Gq))},$=()=>{R(),A(),v(!1)},q=()=>{R(),A(),f&&(k.current=window.setTimeout(()=>{k.current=null,v(!1)},Yq))};return o.jsxs("li",{className:We("group relative flex min-h-9 items-center rounded-md transition-colors",r?"bg-[var(--muted)]/70":"hover:bg-[var(--muted)]/40"),onMouseEnter:B,onMouseLeave:q,children:[o.jsxs(ed,{modal:!1,open:f,onOpenChange:Y=>{Y?D():$()},children:[o.jsx(fc,{asChild:!0,children:o.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute right-0 top-2 size-px"})}),o.jsxs(mc,{side:"right",align:"start",sideOffset:8,className:"w-72 p-3","aria-label":`Details for ${N}`,onMouseEnter:D,onMouseLeave:q,onOpenAutoFocus:Y=>Y.preventDefault(),onCloseAutoFocus:Y=>Y.preventDefault(),children:[o.jsxs("div",{className:"mb-2.5 flex min-w-0 items-center justify-between gap-3",children:[o.jsx("p",{className:"min-w-0 truncate text-xs font-medium",children:N}),o.jsx("span",{className:"shrink-0 text-[10px] text-[var(--muted-foreground)]",children:S})]}),o.jsxs("div",{className:"space-y-2 font-mono text-[11px] leading-4",children:[E&&o.jsxs("div",{className:"flex min-w-0 items-center gap-2","aria-label":`Target: ${E}`,children:[o.jsx(Sm,{"aria-hidden":"true",className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),o.jsx("span",{className:"min-w-0 truncate",children:E})]}),o.jsxs("div",{className:"flex min-w-0 items-center gap-2","aria-label":`Source: ${e.source}`,children:[o.jsx(L4,{"aria-hidden":"true",className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),o.jsx("span",{className:"min-w-0 truncate",children:e.source})]}),o.jsxs("div",{className:"flex min-w-0 items-start gap-2","aria-label":`Session: ${e.id}`,children:[o.jsx(fO,{"aria-hidden":"true",className:"mt-px size-3.5 shrink-0 text-[var(--muted-foreground)]"}),o.jsx("span",{className:"min-w-0 select-text break-all",children:e.id})]})]})]})]}),o.jsx("button",{type:"button",className:"min-w-0 flex-1 px-2.5 py-2 text-left outline-none focus-visible:rounded-md focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--ring)]","aria-current":r?"page":void 0,onClick:s,onFocus:D,onBlur:q,children:o.jsx("span",{className:"block truncate text-sm font-medium",children:N})}),!u&&o.jsxs("div",{className:"group/actions relative mr-2 size-8 shrink-0",onMouseEnter:$,onMouseLeave:B,children:[e.status==="running"&&o.jsx("span",{role:"status","aria-label":"Running",title:"Running",className:"pointer-events-none absolute inset-0 grid place-items-center text-[var(--muted-foreground)] transition-opacity duration-150 group-hover:opacity-0 group-focus-within/actions:opacity-0 group-has-data-[state=open]/actions:opacity-0 [@media(hover:none)]:opacity-0",children:o.jsx(ze,{className:"size-3.5 animate-spin motion-reduce:animate-none"})}),o.jsxs(ed,{open:p,onOpenChange:Y=>{x(Y),Y&&$()},children:[o.jsx(fc,{asChild:!0,children:o.jsx(ne,{variant:"ghost",size:"icon",className:"absolute inset-0 size-8 text-[var(--muted-foreground)] opacity-0 transition-opacity duration-150 group-hover:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100 [@media(hover:none)]:opacity-100",title:`Session actions for ${N}`,"aria-label":`Session actions for ${N}`,children:o.jsx(iO,{})})}),o.jsxs(mc,{align:"end",children:[o.jsxs(Ii,{disabled:b||e.status==="running",onSelect:()=>{w(!0),n().finally(()=>w(!1))},children:[b?o.jsx(ze,{className:"animate-spin motion-reduce:animate-none"}):o.jsx(wO,{}),"Fork session"]}),o.jsxs(Ii,{variant:"destructive",onSelect:()=>m(!0),children:[o.jsx(lo,{}),"Delete session"]})]})]}),o.jsx(ki,{open:d,onOpenChange:m,children:o.jsxs(Xs,{children:[o.jsxs(Ei,{children:[o.jsx(Zs,{children:"Delete this session?"}),o.jsxs(Qs,{children:["“",N,"” will be deleted from ",t,". This cannot be undone."]})]}),o.jsxs(Ri,{children:[o.jsx(Js,{children:"Cancel"}),o.jsx(Ni,{variant:"destructive",onClick:()=>void l(),children:"Delete"})]})]})})]})]})}function Zq(){return o.jsx("div",{"aria-label":"Loading sessions",className:"space-y-0.5 px-1.5 py-1.5",children:Array.from({length:6},(e,t)=>o.jsx("div",{className:"grid min-h-9 content-center rounded-md px-2.5",children:o.jsx("div",{className:"h-3 w-2/3 animate-pulse rounded bg-[var(--muted)]"})},t))})}function Qq(e){const t=Date.parse(e);if(!Number.isFinite(t))return"unknown";const r=Math.max(0,Math.round((Date.now()-t)/1e3));return r<60?"now":r<3600?`${Math.floor(r/60)}m ago`:r<86400?`${Math.floor(r/3600)}h ago`:r<604800?`${Math.floor(r/86400)}d ago`:new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"}).format(t)}const a_="!no-project",X2="!new-project";function Jq({runtimeLabel:e,options:t,selection:r,configuration:s,projects:n,projectId:l,loading:u,projectsLoading:d,submitting:m,error:f,projectError:v,listCollapsed:p,onShowSessions:x,onRetryOptions:b,onSelectionChange:w,onConfigurationChange:C,onProjectChange:k,onNewProject:S,onSubmit:E}){const[N,R]=g.useState(""),A=g.useRef(null),D=g.useRef(!1),B=g.useRef(void 0),$=ZA({policy:Sx,onChange:()=>{B.current=void 0}}),q=px(r,t),Y=l?n.find(L=>L.id===l):void 0,V=!!((N.trim()||$.images.length>0)&&r&&!u&&!m&&!$.hasPending&&!$.hasFailed);async function U(){const L=N.trim();if(!L&&$.images.length===0||!r||u||m||$.hasPending||$.hasFailed)return;const I=$.images.length>0?B.current??od("msg"):void 0;I&&(B.current=I),await E({text:L,images:$.readyUploads,...I?{clientMessageId:I}:{}})&&($.clear(),R(""),B.current=void 0)}return o.jsxs("main",{className:"relative h-full min-h-0 min-w-0 flex-1 overflow-hidden bg-[radial-gradient(circle_at_50%_-10%,color-mix(in_srgb,var(--primary)_9%,transparent),transparent_38%)]",children:[p&&o.jsx(ne,{type:"button",variant:"ghost",size:"icon-sm",className:"desktop-macos-titlebar-leading-control absolute left-3 top-2.5 z-10 hidden md:inline-flex",onClick:x,title:"Show session list","aria-label":"Show session list",children:o.jsx(dE,{className:"size-3.5"})}),o.jsx("div",{className:"desktop-macos-home-titlebar","aria-hidden":"true"}),o.jsx(xn,{className:"h-full",viewportClassName:"[&>div]:!flex [&>div]:min-h-full [&>div]:flex-col",children:o.jsxs("div",{className:"mx-auto grid w-full max-w-3xl flex-1 content-center px-4 py-8 sm:px-6 lg:py-12",children:[o.jsx("div",{className:"mb-6 flex items-center gap-2 md:hidden",children:o.jsxs(ne,{type:"button",variant:"ghost",size:"sm",className:"h-11 px-2",onClick:x,children:[o.jsx(Yo,{})," Sessions"]})}),o.jsxs("div",{className:"mb-7",children:[o.jsx("p",{className:"label-caps mb-3 text-[10px] text-[var(--primary)]",children:"New session"}),o.jsx("h1",{className:"text-3xl font-semibold tracking-[-0.035em] sm:text-4xl",children:"What should we work on?"}),o.jsxs("p",{className:"mt-3 max-w-2xl text-sm leading-6 text-[var(--muted-foreground)] sm:text-base",children:["Describe the outcome you want. The session and terminal will run on"," ",o.jsx("span",{className:"font-medium text-[var(--foreground)]",children:e}),"."]})]}),o.jsxs("form",{ref:A,onSubmit:L=>{L.preventDefault(),U()},children:[o.jsxs("div",{className:"overflow-hidden rounded-xl border border-[var(--border)] bg-[var(--card)] shadow-[0_12px_34px_rgba(24,24,27,0.08)] transition-[border-color,box-shadow] focus-within:border-[color-mix(in_srgb,var(--primary)_55%,var(--border))] focus-within:shadow-[0_0_0_3px_color-mix(in_srgb,var(--primary)_9%,transparent),0_12px_34px_rgba(24,24,27,0.08)]","aria-busy":m,children:[o.jsx("label",{htmlFor:"session-initial-prompt",className:"sr-only",children:"Initial task"}),o.jsx(QA,{images:$.images,disabled:m,onRemove:$.remove,className:"px-5 pt-4"}),o.jsx(wd,{id:"session-initial-prompt",value:N,disabled:m,rows:7,className:"min-h-40 max-h-[min(45dvh,24rem)] resize-none overflow-y-auto rounded-none border-0 bg-transparent px-5 py-5 text-base leading-7 shadow-none focus-visible:border-0 focus-visible:ring-0 md:text-base",placeholder:"Fix a bug, build a feature, or investigate the codebase…",onChange:L=>{B.current=void 0,R(L.target.value)},onPaste:$.onPaste,onCompositionStart:()=>{D.current=!0},onCompositionEnd:()=>{D.current=!1},onKeyDown:L=>{var I;L.key!=="Enter"||L.shiftKey||D.current||L.nativeEvent.isComposing||L.keyCode===229||(L.preventDefault(),(I=A.current)==null||I.requestSubmit())}}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-t border-[var(--border)] bg-[var(--muted)]/15 p-2.5 sm:flex-nowrap sm:pl-4",children:[o.jsx(JA,{policy:Sx,imageCount:$.images.length,disabled:m,onFiles:$.addFiles}),o.jsx("label",{htmlFor:"session-project",className:"sr-only",children:"Project"}),o.jsxs(gn,{value:l?`project:${l}`:a_,disabled:d||m,onValueChange:L=>{if(L===X2){S();return}k(L===a_?null:L.startsWith("project:")?L.slice(8):null)},children:[o.jsx(Ui,{id:"session-project",className:"w-36 bg-[var(--background)] sm:w-40","aria-label":"Project",children:o.jsx($i,{placeholder:d?"Loading projects…":"Choose project",children:o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[Y?o.jsx(qf,{className:"size-3.5 shrink-0 text-[var(--primary)]"}):o.jsx(JS,{className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),o.jsx("span",{className:"truncate",children:(Y==null?void 0:Y.name)??"No project"})]})})}),o.jsxs(Hi,{align:"start",children:[n.length>0&&o.jsxs(Oj,{children:[o.jsxs(Ij,{className:"font-mono text-[9px] uppercase tracking-[0.12em]",children:["Projects on ",e]}),n.map(L=>o.jsx(cr,{value:`project:${L.id}`,textValue:L.name,children:o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[o.jsx(qf,{className:"size-3.5 shrink-0 text-[var(--primary)]"}),o.jsx("span",{className:"truncate",children:L.name})]})},L.id))]}),n.length>0&&o.jsx(Xm,{}),o.jsx(cr,{value:X2,children:o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[o.jsx(JS,{className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),o.jsx("span",{children:"New project"})]})}),o.jsx(cr,{value:a_,children:o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[o.jsx(_n,{className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),o.jsx("span",{children:"No project"})]})})]})]}),o.jsx(eV,{options:t,selection:r,configuration:s,selectedOption:q,disabled:u||m,loading:u,onSelectionChange:w,onConfigurationChange:C}),o.jsx("label",{htmlFor:"session-permission",className:"sr-only",children:"Permissions"}),o.jsxs(gn,{value:s.permissionPreset,disabled:m,onValueChange:L=>C({...s,permissionPreset:L}),children:[o.jsx(Ui,{id:"session-permission",className:"w-36 bg-[var(--background)] sm:w-40","aria-label":"Permissions",children:o.jsx($i,{children:o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[o.jsx(B6,{className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),o.jsx("span",{className:"truncate",children:tV(s.permissionPreset)})]})})}),o.jsxs(Hi,{align:"end",children:[o.jsx(cr,{value:"default",children:"Default permissions"}),o.jsx(cr,{value:"read-only",children:"Read only"}),o.jsx(cr,{value:"workspace-write",children:"Workspace write"}),o.jsx(cr,{value:"full-access",children:"Full access"})]})]}),o.jsx(ne,{type:"submit",size:"icon",className:"size-11 shrink-0 rounded-full md:size-10",disabled:!V,"aria-label":m?"Starting session":"Start session",children:m?o.jsx(ze,{className:"animate-spin"}):o.jsx(mE,{})})]})]}),o.jsxs("div",{className:"mt-2 flex min-h-6 flex-wrap items-start justify-between gap-x-4 gap-y-1 px-1 text-xs text-[var(--muted-foreground)]",children:[o.jsxs("span",{className:"flex items-center gap-2",role:f||v?"alert":"status","aria-live":f||v?"assertive":"polite",children:[o.jsx("span",{children:f??v??(q&&!q.ready?`${q.reason??`${q.name} needs setup on ${e}.`} Start to open its login terminal; your task will wait safely.`:"")}),f&&t.providers.length===0&&t.agents.length===0&&!u&&o.jsx(ne,{type:"button",variant:"link",size:"sm",className:"h-auto px-0 text-xs",onClick:b,children:"Retry"})]}),o.jsx("span",{className:"hidden font-mono text-[10px] sm:inline",children:"Enter to start · Shift+Enter for newline"})]})]})]})})]})}function eV({options:e,selection:t,configuration:r,selectedOption:s,disabled:n,loading:l,onSelectionChange:u,onConfigurationChange:d}){var x;const m=(t==null?void 0:t.kind)==="provider"?e.providers.find(b=>b.id===t.id):void 0,f=(x=m==null?void 0:m.models)==null?void 0:x.find(b=>b.id===r.model),v=f==null?void 0:f.reasoningOptions.find(b=>b.value===r.reasoningEffort),p=(b,w,C)=>{u({kind:"provider",id:b}),d({permissionPreset:r.permissionPreset,...w?{model:w}:{},...C?{reasoningEffort:C}:{}})};return o.jsxs(ed,{children:[o.jsx(fc,{asChild:!0,children:o.jsxs(ne,{id:"session-launch-target",type:"button",variant:"outline",disabled:n,className:"w-44 justify-start bg-[var(--background)] font-normal sm:w-48 md:ml-auto","aria-label":"Run with",children:[s?o.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-2",children:[o.jsx(df,{status:nf(s)}),o.jsxs("span",{className:"truncate",children:[s.name,f?` / ${f.label}`:"",v?` / ${v.label}`:""]})]}):o.jsx("span",{className:"min-w-0 flex-1 truncate text-[var(--muted-foreground)]",children:l?"Loading…":"Choose runtime / model / thinking"}),o.jsx(md,{className:"ml-auto size-3.5 shrink-0 opacity-55"})]})}),o.jsxs(mc,{align:"end",className:"min-w-56",children:[e.providers.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Uo,{className:"font-mono text-[9px] uppercase tracking-[0.12em]",children:"Providers · Runtime → Model → Thinking"}),e.providers.map(b=>{const w=b.models??[],C=(t==null?void 0:t.kind)==="provider"&&t.id===b.id;return w.length===0?o.jsxs(Ii,{onSelect:()=>p(b.id),children:[o.jsx(df,{status:nf(b)}),o.jsx("span",{className:"min-w-0 flex-1 truncate",children:b.name}),C&&o.jsx(Br,{className:"size-3.5 text-[var(--primary)]"})]},`provider:${b.id}`):o.jsxs(Y_,{children:[o.jsxs(sm,{children:[o.jsx(df,{status:nf(b)}),o.jsx("span",{className:"min-w-0 flex-1 truncate",children:b.name})]}),o.jsxs(im,{children:[o.jsx(Uo,{className:"font-mono text-[9px] uppercase tracking-[0.12em]",children:"Model"}),w.map(k=>{const S=C&&r.model===k.id;return k.reasoningOptions.length===0?o.jsxs(Ii,{onSelect:()=>p(b.id,k.id),children:[o.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[k.label,k.isDefault?" · default":""]}),S&&o.jsx(Br,{className:"size-3.5 text-[var(--primary)]"})]},k.id):o.jsxs(Y_,{children:[o.jsx(sm,{children:o.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[k.label,k.isDefault?" · default":""]})}),o.jsxs(im,{children:[o.jsx(Uo,{className:"font-mono text-[9px] uppercase tracking-[0.12em]",children:"Thinking effort"}),k.reasoningOptions.map(E=>{const N=S&&r.reasoningEffort===E.value;return o.jsxs(Ii,{onSelect:()=>p(b.id,k.id,E.value),children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:E.label}),N&&o.jsx(Br,{className:"size-3.5 text-[var(--primary)]"})]},E.value)})]})]},k.id)})]})]},`provider:${b.id}`)})]}),e.providers.length>0&&e.agents.length>0&&o.jsx(qN,{}),e.agents.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Uo,{className:"font-mono text-[9px] uppercase tracking-[0.12em]",children:"Agents"}),e.agents.map(b=>{const w=(t==null?void 0:t.kind)==="agent"&&t.id===b.id;return o.jsxs(Ii,{onSelect:()=>u({kind:"agent",id:b.id}),children:[o.jsx(df,{status:nf(b)}),o.jsx("span",{className:"min-w-0 flex-1 truncate",children:b.name??b.id}),w&&o.jsx(Br,{className:"size-3.5 text-[var(--primary)]"})]},`agent:${b.id}`)})]})]})]})}function tV(e){return{default:"Default","read-only":"Read only","workspace-write":"Workspace write","full-access":"Full access"}[e]}function df({status:e}){const t=e==="ready"?"Ready":e==="needs_setup"?"Needs setup":"Readiness not reported",r=e==="ready"?"bg-[var(--success)]":e==="needs_setup"?"bg-[var(--warning)]":"bg-[var(--muted-foreground)]/55";return o.jsxs("span",{className:"inline-flex size-3.5 shrink-0 items-center justify-center",title:t,children:[o.jsx("span",{className:`size-2 rounded-full ${r}`,"aria-hidden":"true"}),o.jsx("span",{className:"sr-only",children:t})]})}const cM="rynx.control.theme";function rV(){const e=localStorage.getItem(cM);return e==="light"||e==="dark"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Dy(){const[e,t]=g.useState(rV);return g.useEffect(()=>{document.documentElement.classList.toggle("dark",e==="dark"),localStorage.setItem(cM,e)},[e]),{theme:e,toggle:()=>t(r=>r==="dark"?"light":"dark")}}/**
|
|
588
|
-
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
589
|
-
* @license MIT
|
|
590
|
-
*
|
|
591
|
-
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
592
|
-
* @license MIT
|
|
593
|
-
*
|
|
594
|
-
* Originally forked from (with the author's permission):
|
|
595
|
-
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
596
|
-
* http://bellard.org/jslinux/
|
|
597
|
-
* Copyright (c) 2011 Fabrice Bellard
|
|
598
|
-
*/var sV=2,iV=1,nV=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var p;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:((p=this._terminal.options.overviewRuler)==null?void 0:p.width)||14,r=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(r.getPropertyValue("height")),n=Math.max(0,parseInt(r.getPropertyValue("width"))),l=window.getComputedStyle(this._terminal.element),u={top:parseInt(l.getPropertyValue("padding-top")),bottom:parseInt(l.getPropertyValue("padding-bottom")),right:parseInt(l.getPropertyValue("padding-right")),left:parseInt(l.getPropertyValue("padding-left"))},d=u.top+u.bottom,m=u.right+u.left,f=s-d,v=n-m-t;return{cols:Math.max(sV,Math.floor(v/e.css.cell.width)),rows:Math.max(iV,Math.floor(f/e.css.cell.height))}}};/**
|
|
599
|
-
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
600
|
-
* @license MIT
|
|
601
|
-
*
|
|
602
|
-
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
603
|
-
* @license MIT
|
|
604
|
-
*
|
|
605
|
-
* Originally forked from (with the author's permission):
|
|
606
|
-
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
607
|
-
* http://bellard.org/jslinux/
|
|
608
|
-
* Copyright (c) 2011 Fabrice Bellard
|
|
609
|
-
*/var aV=class{constructor(t,r,s,n={}){this._terminal=t,this._regex=r,this._handler=s,this._options=n}provideLinks(t,r){let s=lV.computeLink(t,this._regex,this._terminal,this._handler);r(this._addCallbacks(s))}_addCallbacks(t){return t.map(r=>(r.leave=this._options.leave,r.hover=(s,n)=>{if(this._options.hover){let{range:l}=r;this._options.hover(s,n,l)}},r))}};function oV(e){try{let t=new URL(e),r=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(r.toLocaleLowerCase())}catch{return!1}}var lV=class Df{static computeLink(t,r,s,n){let l=new RegExp(r.source,(r.flags||"")+"g"),[u,d]=Df._getWindowedLineStrings(t-1,s),m=u.join(""),f,v=[];for(;f=l.exec(m);){let p=f[0];if(!oV(p))continue;let[x,b]=Df._mapStrIdx(s,d,0,f.index),[w,C]=Df._mapStrIdx(s,x,b,p.length);if(x===-1||b===-1||w===-1||C===-1)continue;let k={start:{x:b+1,y:x+1},end:{x:C,y:w+1}};v.push({range:k,text:p,activate:n})}return v}static _getWindowedLineStrings(t,r){let s,n=t,l=t,u=0,d="",m=[];if(s=r.buffer.active.getLine(t)){let f=s.translateToString(!0);if(s.isWrapped&&f[0]!==" "){for(u=0;(s=r.buffer.active.getLine(--n))&&u<2048&&(d=s.translateToString(!0),u+=d.length,m.push(d),!(!s.isWrapped||d.indexOf(" ")!==-1)););m.reverse()}for(m.push(f),u=0;(s=r.buffer.active.getLine(++l))&&s.isWrapped&&u<2048&&(d=s.translateToString(!0),u+=d.length,m.push(d),d.indexOf(" ")===-1););}return[m,n]}static _mapStrIdx(t,r,s,n){let l=t.buffer.active,u=l.getNullCell(),d=s;for(;n;){let m=l.getLine(r);if(!m)return[-1,-1];for(let f=d;f<m.length;++f){m.getCell(f,u);let v=u.getChars();if(u.getWidth()&&(n-=v.length||1,f===m.length-1&&v==="")){let p=l.getLine(r+1);p&&p.isWrapped&&(p.getCell(0,u),u.getWidth()===2&&(n+=1))}if(n<0)return[r,f]}r++,d=0}return[r,d]}},cV=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function uV(e,t){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var dV=class{constructor(t=uV,r={}){this._handler=t,this._options=r}activate(t){this._terminal=t;let r=this._options,s=r.urlRegex||cV;this._linkProvider=this._terminal.registerLinkProvider(new aV(this._terminal,s,this._handler,r))}dispose(){var t;(t=this._linkProvider)==null||t.dispose()}};/**
|
|
610
|
-
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
611
|
-
* @license MIT
|
|
612
|
-
*
|
|
613
|
-
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
614
|
-
* @license MIT
|
|
615
|
-
*
|
|
616
|
-
* Originally forked from (with the author's permission):
|
|
617
|
-
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
618
|
-
* http://bellard.org/jslinux/
|
|
619
|
-
* Copyright (c) 2011 Fabrice Bellard
|
|
620
|
-
*/var hV=(e,t,r,s)=>{for(var n=t,l=e.length-1,u;l>=0;l--)(u=e[l])&&(n=u(n)||n);return n},fV=(e,t)=>(r,s)=>t(r,s,e),mV=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Z2.isErrorNoTelemetry(e)?new Z2(e.message+`
|
|
621
|
-
|
|
622
|
-
`+e.stack):new Error(e.message+`
|
|
623
|
-
|
|
624
|
-
`+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)}},pV=new mV;function o_(e){gV(e)||pV.onUnexpectedError(e)}var Cx="Canceled";function gV(e){return e instanceof vV?!0:e instanceof Error&&e.name===Cx&&e.message===Cx}var vV=class extends Error{constructor(){super(Cx),this.name=this.message}},Z2=class kx extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof kx)return t;let r=new kx;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},_V;(e=>{function t(l){return l<0}e.isLessThan=t;function r(l){return l<=0}e.isLessThanOrEqual=r;function s(l){return l>0}e.isGreaterThan=s;function n(l){return l===0}e.isNeitherLessOrGreaterThan=n,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(_V||(_V={}));function xV(e,t){let r=this,s=!1,n;return function(){return s||(s=!0,t||(n=e.apply(r,arguments))),n}}var uM;(e=>{function t(R){return R&&typeof R=="object"&&typeof R[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function s(){return r}e.empty=s;function*n(R){yield R}e.single=n;function l(R){return t(R)?R:n(R)}e.wrap=l;function u(R){return R||r}e.from=u;function*d(R){for(let A=R.length-1;A>=0;A--)yield R[A]}e.reverse=d;function m(R){return!R||R[Symbol.iterator]().next().done===!0}e.isEmpty=m;function f(R){return R[Symbol.iterator]().next().value}e.first=f;function v(R,A){let D=0;for(let B of R)if(A(B,D++))return!0;return!1}e.some=v;function p(R,A){for(let D of R)if(A(D))return D}e.find=p;function*x(R,A){for(let D of R)A(D)&&(yield D)}e.filter=x;function*b(R,A){let D=0;for(let B of R)yield A(B,D++)}e.map=b;function*w(R,A){let D=0;for(let B of R)yield*A(B,D++)}e.flatMap=w;function*C(...R){for(let A of R)yield*A}e.concat=C;function k(R,A,D){let B=D;for(let $ of R)B=A(B,$);return B}e.reduce=k;function*S(R,A,D=R.length){for(A<0&&(A+=R.length),D<0?D+=R.length:D>R.length&&(D=R.length);A<D;A++)yield R[A]}e.slice=S;function E(R,A=Number.POSITIVE_INFINITY){let D=[];if(A===0)return[D,R];let B=R[Symbol.iterator]();for(let $=0;$<A;$++){let q=B.next();if(q.done)return[D,e.empty()];D.push(q.value)}return[D,{[Symbol.iterator](){return B}}]}e.consume=E;async function N(R){let A=[];for await(let D of R)A.push(D);return Promise.resolve(A)}e.asyncToArray=N})(uM||(uM={}));function dM(e){if(uM.is(e)){let t=[];for(let r of e)if(r)try{r.dispose()}catch(s){t.push(s)}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 hM(...e){return ps(()=>dM(e))}function ps(e){return{dispose:xV(()=>{e()})}}var fM=class mM{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{dM(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?mM.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)}};fM.DISABLE_DISPOSED_WARNING=!1;var cc=fM,qi=class{constructor(){this._store=new cc,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)}};qi.None=Object.freeze({dispose(){}});var ku=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){var r;this._isDisposed||t===this._value||((r=this._value)==null||r.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){var t;this._isDisposed=!0,(t=this._value)==null||t.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t}},Ly=typeof process<"u"&&"title"in process,ap=Ly?"node":navigator.userAgent,yV=Ly?"node":navigator.platform,bV=ap.includes("Firefox"),wV=ap.includes("Edge"),pM=/^((?!chrome|android).)*safari/i.test(ap);function SV(){if(!pM)return 0;let e=ap.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}yV.indexOf("Linux")>=0;var CV="",Fr=0,Wr=0,qr=0,or=0,mi={css:"#00000000",rgba:0},ys;(e=>{function t(n,l,u,d){return d!==void 0?`#${Bo(n)}${Bo(l)}${Bo(u)}${Bo(d)}`:`#${Bo(n)}${Bo(l)}${Bo(u)}`}e.toCss=t;function r(n,l,u,d=255){return(n<<24|l<<16|u<<8|d)>>>0}e.toRgba=r;function s(n,l,u,d){return{css:e.toCss(n,l,u,d),rgba:e.toRgba(n,l,u,d)}}e.toColor=s})(ys||(ys={}));var zu;(e=>{function t(m,f){if(or=(f.rgba&255)/255,or===1)return{css:f.css,rgba:f.rgba};let v=f.rgba>>24&255,p=f.rgba>>16&255,x=f.rgba>>8&255,b=m.rgba>>24&255,w=m.rgba>>16&255,C=m.rgba>>8&255;Fr=b+Math.round((v-b)*or),Wr=w+Math.round((p-w)*or),qr=C+Math.round((x-C)*or);let k=ys.toCss(Fr,Wr,qr),S=ys.toRgba(Fr,Wr,qr);return{css:k,rgba:S}}e.blend=t;function r(m){return(m.rgba&255)===255}e.isOpaque=r;function s(m,f,v){let p=qo.ensureContrastRatio(m.rgba,f.rgba,v);if(p)return ys.toColor(p>>24&255,p>>16&255,p>>8&255)}e.ensureContrastRatio=s;function n(m){let f=(m.rgba|255)>>>0;return[Fr,Wr,qr]=qo.toChannels(f),{css:ys.toCss(Fr,Wr,qr),rgba:f}}e.opaque=n;function l(m,f){return or=Math.round(f*255),[Fr,Wr,qr]=qo.toChannels(m.rgba),{css:ys.toCss(Fr,Wr,qr,or),rgba:ys.toRgba(Fr,Wr,qr,or)}}e.opacity=l;function u(m,f){return or=m.rgba&255,l(m,or*f/255)}e.multiplyOpacity=u;function d(m){return[m.rgba>>24&255,m.rgba>>16&255,m.rgba>>8&255]}e.toColorRGB=d})(zu||(zu={}));var kV;(e=>{let t,r;try{let n=document.createElement("canvas");n.width=1,n.height=1;let l=n.getContext("2d",{willReadFrequently:!0});l&&(t=l,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function s(n){if(n.match(/#[\da-f]{3,8}/i))switch(n.length){case 4:return Fr=parseInt(n.slice(1,2).repeat(2),16),Wr=parseInt(n.slice(2,3).repeat(2),16),qr=parseInt(n.slice(3,4).repeat(2),16),ys.toColor(Fr,Wr,qr);case 5:return Fr=parseInt(n.slice(1,2).repeat(2),16),Wr=parseInt(n.slice(2,3).repeat(2),16),qr=parseInt(n.slice(3,4).repeat(2),16),or=parseInt(n.slice(4,5).repeat(2),16),ys.toColor(Fr,Wr,qr,or);case 7:return{css:n,rgba:(parseInt(n.slice(1),16)<<8|255)>>>0};case 9:return{css:n,rgba:parseInt(n.slice(1),16)>>>0}}let l=n.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(l)return Fr=parseInt(l[1]),Wr=parseInt(l[2]),qr=parseInt(l[3]),or=Math.round((l[5]===void 0?1:parseFloat(l[5]))*255),ys.toColor(Fr,Wr,qr,or);if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=n,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Fr,Wr,qr,or]=t.getImageData(0,0,1,1).data,or!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:ys.toRgba(Fr,Wr,qr,or),css:n}}e.toColor=s})(kV||(kV={}));var _s;(e=>{function t(s){return r(s>>16&255,s>>8&255,s&255)}e.relativeLuminance=t;function r(s,n,l){let u=s/255,d=n/255,m=l/255,f=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),v=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),p=m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4);return f*.2126+v*.7152+p*.0722}e.relativeLuminance2=r})(_s||(_s={}));var qo;(e=>{function t(u,d){if(or=(d&255)/255,or===1)return d;let m=d>>24&255,f=d>>16&255,v=d>>8&255,p=u>>24&255,x=u>>16&255,b=u>>8&255;return Fr=p+Math.round((m-p)*or),Wr=x+Math.round((f-x)*or),qr=b+Math.round((v-b)*or),ys.toRgba(Fr,Wr,qr)}e.blend=t;function r(u,d,m){let f=_s.relativeLuminance(u>>8),v=_s.relativeLuminance(d>>8);if(Gn(f,v)<m){if(v<f){let b=s(u,d,m),w=Gn(f,_s.relativeLuminance(b>>8));if(w<m){let C=n(u,d,m),k=Gn(f,_s.relativeLuminance(C>>8));return w>k?b:C}return b}let p=n(u,d,m),x=Gn(f,_s.relativeLuminance(p>>8));if(x<m){let b=s(u,d,m),w=Gn(f,_s.relativeLuminance(b>>8));return x>w?p:b}return p}}e.ensureContrastRatio=r;function s(u,d,m){let f=u>>24&255,v=u>>16&255,p=u>>8&255,x=d>>24&255,b=d>>16&255,w=d>>8&255,C=Gn(_s.relativeLuminance2(x,b,w),_s.relativeLuminance2(f,v,p));for(;C<m&&(x>0||b>0||w>0);)x-=Math.max(0,Math.ceil(x*.1)),b-=Math.max(0,Math.ceil(b*.1)),w-=Math.max(0,Math.ceil(w*.1)),C=Gn(_s.relativeLuminance2(x,b,w),_s.relativeLuminance2(f,v,p));return(x<<24|b<<16|w<<8|255)>>>0}e.reduceLuminance=s;function n(u,d,m){let f=u>>24&255,v=u>>16&255,p=u>>8&255,x=d>>24&255,b=d>>16&255,w=d>>8&255,C=Gn(_s.relativeLuminance2(x,b,w),_s.relativeLuminance2(f,v,p));for(;C<m&&(x<255||b<255||w<255);)x=Math.min(255,x+Math.ceil((255-x)*.1)),b=Math.min(255,b+Math.ceil((255-b)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),C=Gn(_s.relativeLuminance2(x,b,w),_s.relativeLuminance2(f,v,p));return(x<<24|b<<16|w<<8|255)>>>0}e.increaseLuminance=n;function l(u){return[u>>24&255,u>>16&255,u>>8&255,u&255]}e.toChannels=l})(qo||(qo={}));function Bo(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Gn(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function Cr(e){if(!e)throw new Error("value must not be falsy");return e}function Oy(e){return 57508<=e&&e<=57558}function EV(e){return 57520<=e&&e<=57527}function RV(e){return 57344<=e&&e<=63743}function NV(e){return 9472<=e&&e<=9631}function jV(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}function AV(e,t,r,s){return t===1&&r>Math.ceil(s*1.5)&&e!==void 0&&e>255&&!jV(e)&&!Oy(e)&&!RV(e)}function gM(e){return Oy(e)||NV(e)}function MV(){return{css:{canvas:hf(),cell:hf()},device:{canvas:hf(),cell:hf(),char:{width:0,height:0,left:0,top:0}}}}function hf(){return{width:0,height:0}}function TV(e,t,r=0){return(e-(Math.round(t)*2-r))%(Math.round(t)*2)}var is=0,Ur=0,nn=!1,Yn=!1,ff=!1,js,l_=0,DV=class{constructor(e,t,r,s,n,l){this._terminal=e,this._optionService=t,this._selectionRenderModel=r,this._decorationService=s,this._coreBrowserService=n,this._themeService=l,this.result={fg:0,bg:0,ext:0}}resolve(e,t,r,s){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,Ur=0,is=0,Yn=!1,nn=!1,ff=!1,js=this._themeService.colors,l_=0,e.getCode()!==0&&e.extended.underlineStyle===4){let n=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));l_=t*s%(Math.round(n)*2)}if(this._decorationService.forEachDecorationAtCell(t,r,"bottom",n=>{n.backgroundColorRGB&&(Ur=n.backgroundColorRGB.rgba>>8&16777215,Yn=!0),n.foregroundColorRGB&&(is=n.foregroundColorRGB.rgba>>8&16777215,nn=!0)}),ff=this._selectionRenderModel.isCellSelected(this._terminal,t,r),ff){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:Ur=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Ur=(this.result.fg&16777215)<<8|255;break;case 0:default:Ur=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:Ur=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Ur=(this.result.bg&16777215)<<8|255;break}Ur=qo.blend(Ur,(this._coreBrowserService.isFocused?js.selectionBackgroundOpaque:js.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else Ur=(this._coreBrowserService.isFocused?js.selectionBackgroundOpaque:js.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Yn=!0,js.selectionForeground&&(is=js.selectionForeground.rgba>>8&16777215,nn=!0),gM(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)is=(this._coreBrowserService.isFocused?js.selectionBackgroundOpaque:js.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:is=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:is=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:is=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:is=(this.result.fg&16777215)<<8|255;break;case 0:default:is=this._themeService.colors.foreground.rgba}is=qo.blend(is,(this._coreBrowserService.isFocused?js.selectionBackgroundOpaque:js.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}nn=!0}}this._decorationService.forEachDecorationAtCell(t,r,"top",n=>{n.backgroundColorRGB&&(Ur=n.backgroundColorRGB.rgba>>8&16777215,Yn=!0),n.foregroundColorRGB&&(is=n.foregroundColorRGB.rgba>>8&16777215,nn=!0)}),Yn&&(ff?Ur=e.bg&-16777216&-134217729|Ur|50331648:Ur=e.bg&-16777216|Ur|50331648),nn&&(is=e.fg&-16777216&-67108865|is|50331648),this.result.fg&67108864&&(Yn&&!nn&&((this.result.bg&50331648)===0?is=this.result.fg&-134217728|js.background.rgba>>8&16777215&16777215|50331648:is=this.result.fg&-134217728|this.result.bg&67108863,nn=!0),!Yn&&nn&&((this.result.fg&50331648)===0?Ur=this.result.bg&-67108864|js.foreground.rgba>>8&16777215&16777215|50331648:Ur=this.result.bg&-67108864|this.result.fg&67108863,Yn=!0)),js=void 0,this.result.bg=Yn?Ur:this.result.bg,this.result.fg=nn?is:this.result.fg,this.result.ext&=536870911,this.result.ext|=l_<<29&3758096384}},LV=.5,vM=bV||wV?"bottom":"ideographic",OV={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},BV={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]},PV={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"║":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╒":{1:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╓":{1:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`},"╔":{1:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╕":{1:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`},"╖":{1:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`},"╗":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`},"╘":{1:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`},"╙":{1:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╚":{1:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`},"╛":{1:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`},"╜":{1:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`},"╝":{1:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`},"╞":{1:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╟":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`},"╠":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╡":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`},"╢":{1:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╣":{1:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`},"╤":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`},"╥":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`},"╦":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╧":{1:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╨":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╩":{1:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╪":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╫":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╬":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`},"╮":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`},"╯":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`},"╰":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`}},ld={"":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};ld[""]=ld[""];ld[""]=ld[""];function IV(e,t,r,s,n,l,u,d){let m=OV[t];if(m)return zV(e,m,r,s,n,l),!0;let f=BV[t];if(f)return $V(e,f,r,s,n,l),!0;let v=PV[t];if(v)return UV(e,v,r,s,n,l,d),!0;let p=ld[t];return p?(HV(e,p,r,s,n,l,u,d),!0):!1}function zV(e,t,r,s,n,l){for(let u=0;u<t.length;u++){let d=t[u],m=n/8,f=l/8;e.fillRect(r+d.x*m,s+d.y*f,d.w*m,d.h*f)}}var Q2=new Map;function $V(e,t,r,s,n,l){let u=Q2.get(t);u||(u=new Map,Q2.set(t,u));let d=e.fillStyle;if(typeof d!="string")throw new Error(`Unexpected fillStyle type "${d}"`);let m=u.get(d);if(!m){let f=t[0].length,v=t.length,p=e.canvas.ownerDocument.createElement("canvas");p.width=f,p.height=v;let x=Cr(p.getContext("2d")),b=new ImageData(f,v),w,C,k,S;if(d.startsWith("#"))w=parseInt(d.slice(1,3),16),C=parseInt(d.slice(3,5),16),k=parseInt(d.slice(5,7),16),S=d.length>7&&parseInt(d.slice(7,9),16)||1;else if(d.startsWith("rgba"))[w,C,k,S]=d.substring(5,d.length-1).split(",").map(E=>parseFloat(E));else throw new Error(`Unexpected fillStyle color format "${d}" when drawing pattern glyph`);for(let E=0;E<v;E++)for(let N=0;N<f;N++)b.data[(E*f+N)*4]=w,b.data[(E*f+N)*4+1]=C,b.data[(E*f+N)*4+2]=k,b.data[(E*f+N)*4+3]=t[E][N]*(S*255);x.putImageData(b,0,0),m=Cr(e.createPattern(p,null)),u.set(d,m)}e.fillStyle=m,e.fillRect(r,s,n,l)}function UV(e,t,r,s,n,l,u){e.strokeStyle=e.fillStyle;for(let[d,m]of Object.entries(t)){e.beginPath(),e.lineWidth=u*Number.parseInt(d);let f;if(typeof m=="function"){let v=.15/l*n;f=m(.15,v)}else f=m;for(let v of f.split(" ")){let p=v[0],x=_M[p];if(!x){console.error(`Could not find drawing instructions for "${p}"`);continue}let b=v.substring(1).split(",");!b[0]||!b[1]||x(e,xM(b,n,l,r,s,!0,u))}e.stroke(),e.closePath()}}function HV(e,t,r,s,n,l,u,d){let m=new Path2D;m.rect(r,s,n,l),e.clip(m),e.beginPath();let f=u/12;e.lineWidth=d*f;for(let v of t.d.split(" ")){let p=v[0],x=_M[p];if(!x){console.error(`Could not find drawing instructions for "${p}"`);continue}let b=v.substring(1).split(",");!b[0]||!b[1]||x(e,xM(b,n,l,r,s,!1,d,(t.leftPadding??0)*(f/2),(t.rightPadding??0)*(f/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function J2(e,t,r=0){return Math.max(Math.min(e,t),r)}var _M={C:(e,t)=>e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),L:(e,t)=>e.lineTo(t[0],t[1]),M:(e,t)=>e.moveTo(t[0],t[1])};function xM(e,t,r,s,n,l,u,d=0,m=0){let f=e.map(v=>parseFloat(v)||parseInt(v));if(f.length<2)throw new Error("Too few arguments for instruction");for(let v=0;v<f.length;v+=2)f[v]*=t-d*u-m*u,l&&f[v]!==0&&(f[v]=J2(Math.round(f[v]+.5)-.5,t,0)),f[v]+=s+d*u;for(let v=1;v<f.length;v+=2)f[v]*=r,l&&f[v]!==0&&(f[v]=J2(Math.round(f[v]+.5)-.5,r,0)),f[v]+=n;return f}var e5=class{constructor(){this._data={}}set(t,r,s){this._data[t]||(this._data[t]={}),this._data[t][r]=s}get(t,r){return this._data[t]?this._data[t][r]:void 0}clear(){this._data={}}},t5=class{constructor(){this._data=new e5}set(e,t,r,s,n){this._data.get(e,t)||this._data.set(e,t,new e5),this._data.get(e,t).set(r,s,n)}get(e,t,r,s){var n;return(n=this._data.get(e,t))==null?void 0:n.get(r,s)}clear(){this._data.clear()}},yM=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,r=0,s=e.timeRemaining(),n=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),r=Math.max(t,r),n=e.timeRemaining(),r*1.5>n){s-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),this._start();return}s=n}this.clear()}},FV=class extends yM{_requestCallback(t){return setTimeout(()=>t(this._createDeadline(16)))}_cancelCallback(t){clearTimeout(t)}_createDeadline(t){let r=performance.now()+t;return{timeRemaining:()=>Math.max(0,r-performance.now())}}},WV=class extends yM{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},qV=!Ly&&"requestIdleCallback"in window?WV:FV,ic=class bM{constructor(){this.fg=0,this.bg=0,this.extended=new wM}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 bM;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}},wM=class SM{constructor(t=0,r=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=r}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 SM(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},VV=globalThis.performance&&typeof globalThis.performance.now=="function",GV=class CM{static create(t){return new CM(t)}constructor(t){this._now=VV&&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}},Jn;(e=>{e.None=()=>qi.None;function t(U,L){return p(U,()=>{},0,void 0,!0,void 0,L)}e.defer=t;function r(U){return(L,I=null,F)=>{let M=!1,P;return P=U(O=>{if(!M)return P?P.dispose():M=!0,L.call(I,O)},null,F),M&&P.dispose(),P}}e.once=r;function s(U,L,I){return f((F,M=null,P)=>U(O=>F.call(M,L(O)),null,P),I)}e.map=s;function n(U,L,I){return f((F,M=null,P)=>U(O=>{L(O),F.call(M,O)},null,P),I)}e.forEach=n;function l(U,L,I){return f((F,M=null,P)=>U(O=>L(O)&&F.call(M,O),null,P),I)}e.filter=l;function u(U){return U}e.signal=u;function d(...U){return(L,I=null,F)=>{let M=hM(...U.map(P=>P(O=>L.call(I,O))));return v(M,F)}}e.any=d;function m(U,L,I,F){let M=I;return s(U,P=>(M=L(M,P),M),F)}e.reduce=m;function f(U,L){let I,F={onWillAddFirstListener(){I=U(M.fire,M)},onDidRemoveLastListener(){I==null||I.dispose()}},M=new qt(F);return L==null||L.add(M),M.event}function v(U,L){return L instanceof Array?L.push(U):L&&L.add(U),U}function p(U,L,I=100,F=!1,M=!1,P,O){let W,H,T,G=0,X,ee={leakWarningThreshold:P,onWillAddFirstListener(){W=U(de=>{G++,H=L(H,de),F&&!T&&(oe.fire(H),H=void 0),X=()=>{let Z=H;H=void 0,T=void 0,(!F||G>1)&&oe.fire(Z),G=0},typeof I=="number"?(clearTimeout(T),T=setTimeout(X,I)):T===void 0&&(T=0,queueMicrotask(X))})},onWillRemoveListener(){M&&G>0&&(X==null||X())},onDidRemoveLastListener(){X=void 0,W.dispose()}},oe=new qt(ee);return O==null||O.add(oe),oe.event}e.debounce=p;function x(U,L=0,I){return e.debounce(U,(F,M)=>F?(F.push(M),F):[M],L,void 0,!0,void 0,I)}e.accumulate=x;function b(U,L=(F,M)=>F===M,I){let F=!0,M;return l(U,P=>{let O=F||!L(P,M);return F=!1,M=P,O},I)}e.latch=b;function w(U,L,I){return[e.filter(U,L,I),e.filter(U,F=>!L(F),I)]}e.split=w;function C(U,L=!1,I=[],F){let M=I.slice(),P=U(H=>{M?M.push(H):W.fire(H)});F&&F.add(P);let O=()=>{M==null||M.forEach(H=>W.fire(H)),M=null},W=new qt({onWillAddFirstListener(){P||(P=U(H=>W.fire(H)),F&&F.add(P))},onDidAddFirstListener(){M&&(L?setTimeout(O):O())},onDidRemoveLastListener(){P&&P.dispose(),P=null}});return F&&F.add(W),W.event}e.buffer=C;function k(U,L){return(I,F,M)=>{let P=L(new E);return U(function(O){let W=P.evaluate(O);W!==S&&I.call(F,W)},void 0,M)}}e.chain=k;let S=Symbol("HaltChainable");class E{constructor(){this.steps=[]}map(L){return this.steps.push(L),this}forEach(L){return this.steps.push(I=>(L(I),I)),this}filter(L){return this.steps.push(I=>L(I)?I:S),this}reduce(L,I){let F=I;return this.steps.push(M=>(F=L(F,M),F)),this}latch(L=(I,F)=>I===F){let I=!0,F;return this.steps.push(M=>{let P=I||!L(M,F);return I=!1,F=M,P?M:S}),this}evaluate(L){for(let I of this.steps)if(L=I(L),L===S)break;return L}}function N(U,L,I=F=>F){let F=(...W)=>O.fire(I(...W)),M=()=>U.on(L,F),P=()=>U.removeListener(L,F),O=new qt({onWillAddFirstListener:M,onDidRemoveLastListener:P});return O.event}e.fromNodeEventEmitter=N;function R(U,L,I=F=>F){let F=(...W)=>O.fire(I(...W)),M=()=>U.addEventListener(L,F),P=()=>U.removeEventListener(L,F),O=new qt({onWillAddFirstListener:M,onDidRemoveLastListener:P});return O.event}e.fromDOMEventEmitter=R;function A(U){return new Promise(L=>r(U)(L))}e.toPromise=A;function D(U){let L=new qt;return U.then(I=>{L.fire(I)},()=>{L.fire(void 0)}).finally(()=>{L.dispose()}),L.event}e.fromPromise=D;function B(U,L){return U(I=>L.fire(I))}e.forward=B;function $(U,L,I){return L(I),U(F=>L(F))}e.runAndSubscribe=$;class q{constructor(L,I){this._observable=L,this._counter=0,this._hasChanged=!1;let F={onWillAddFirstListener:()=>{L.addObserver(this)},onDidRemoveLastListener:()=>{L.removeObserver(this)}};this.emitter=new qt(F),I&&I.add(this.emitter)}beginUpdate(L){this._counter++}handlePossibleChange(L){}handleChange(L,I){this._hasChanged=!0}endUpdate(L){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Y(U,L){return new q(U,L).emitter.event}e.fromObservable=Y;function V(U){return(L,I,F)=>{let M=0,P=!1,O={beginUpdate(){M++},endUpdate(){M--,M===0&&(U.reportChanges(),P&&(P=!1,L.call(I)))},handlePossibleChange(){},handleChange(){P=!0}};U.addObserver(O),U.reportChanges();let W={dispose(){U.removeObserver(O)}};return F instanceof cc?F.add(W):Array.isArray(F)&&F.push(W),W}}e.fromObservableLight=V})(Jn||(Jn={}));var Ex=class Rx{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Rx._idPool++}`,Rx.all.add(this)}start(t){this._stopWatch=new GV,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}}};Ex.all=new Set,Ex._idPool=0;var YV=Ex,KV=-1,kM=class EM{constructor(t,r,s=(EM._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=r,this.name=s,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,r){let s=this.threshold;if(s<=0||r<s)return;this._stacks||(this._stacks=new Map);let n=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,n+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=s*.5;let[l,u]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${u}):`;console.warn(d),console.warn(l);let m=new QV(d,l);this._errorHandler(m)}return()=>{let l=this._stacks.get(t.value)||0;this._stacks.set(t.value,l-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[s,n]of this._stacks)(!t||r<n)&&(t=[s,n],r=n);return t}};kM._idPool=1;var XV=kM,ZV=class RM{constructor(t){this.value=t}static create(){let t=new Error;return new RM(t.stack??"")}print(){console.warn(this.value.split(`
|
|
625
|
-
`).slice(2).join(`
|
|
626
|
-
`))}},QV=class extends Error{constructor(t,r){super(t),this.name="ListenerLeakError",this.stack=r}},JV=class extends Error{constructor(t,r){super(t),this.name="ListenerRefusalError",this.stack=r}},eG=0,c_=class{constructor(e){this.value=e,this.id=eG++}},tG=2,rG,qt=class{constructor(t){var r,s,n,l;this._size=0,this._options=t,this._leakageMon=(r=this._options)!=null&&r.leakWarningThreshold?new XV((t==null?void 0:t.onListenerError)??o_,((s=this._options)==null?void 0:s.leakWarningThreshold)??KV):void 0,this._perfMon=(n=this._options)!=null&&n._profName?new YV(this._options._profName):void 0,this._deliveryQueue=(l=this._options)==null?void 0:l.deliveryQueue}dispose(){var t,r,s,n;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),(s=(r=this._options)==null?void 0:r.onDidRemoveLastListener)==null||s.call(r),(n=this._leakageMon)==null||n.dispose())}get event(){return this._event??(this._event=(t,r,s)=>{var d,m,f,v,p;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let x=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(x);let b=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],w=new JV(`${x}. HINT: Stack shows most frequent listener (${b[1]}-times)`,b[0]);return(((d=this._options)==null?void 0:d.onListenerError)||o_)(w),qi.None}if(this._disposed)return qi.None;r&&(t=t.bind(r));let n=new c_(t),l;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(n.stack=ZV.create(),l=this._leakageMon.check(n.stack,this._size+1)),this._listeners?this._listeners instanceof c_?(this._deliveryQueue??(this._deliveryQueue=new sG),this._listeners=[this._listeners,n]):this._listeners.push(n):((f=(m=this._options)==null?void 0:m.onWillAddFirstListener)==null||f.call(m,this),this._listeners=n,(p=(v=this._options)==null?void 0:v.onDidAddFirstListener)==null||p.call(v,this)),this._size++;let u=ps(()=>{l==null||l(),this._removeListener(n)});return s instanceof cc?s.add(u):Array.isArray(s)&&s.push(u),u}),this._event}_removeListener(t){var l,u,d,m;if((u=(l=this._options)==null?void 0:l.onWillRemoveListener)==null||u.call(l,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(m=(d=this._options)==null?void 0:d.onDidRemoveLastListener)==null||m.call(d,this),this._size=0;return}let r=this._listeners,s=r.indexOf(t);if(s===-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--,r[s]=void 0;let n=this._deliveryQueue.current===this;if(this._size*tG<=r.length){let f=0;for(let v=0;v<r.length;v++)r[v]?r[f++]=r[v]:n&&(this._deliveryQueue.end--,f<this._deliveryQueue.i&&this._deliveryQueue.i--);r.length=f}}_deliver(t,r){var n;if(!t)return;let s=((n=this._options)==null?void 0:n.onListenerError)||o_;if(!s){t.value(r);return}try{t.value(r)}catch(l){s(l)}}_deliverQueue(t){let r=t.current._listeners;for(;t.i<t.end;)this._deliver(r[t.i++],t.value);t.reset()}fire(t){var r,s,n,l;if((r=this._deliveryQueue)!=null&&r.current&&(this._deliverQueue(this._deliveryQueue),(s=this._perfMon)==null||s.stop()),(n=this._perfMon)==null||n.start(this._size),this._listeners)if(this._listeners instanceof c_)this._deliver(this._listeners,t);else{let u=this._deliveryQueue;u.enqueue(this,t,this._listeners.length),this._deliverQueue(u)}(l=this._perfMon)==null||l.stop()}hasListeners(){return this._size>0}},sG=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,r){this.i=0,this.end=r,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},r5={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},Eu=2,Ru,Wa=class sc{constructor(t,r,s){this._document=t,this._config=r,this._unicodeService=s,this._didWarmUp=!1,this._cacheMap=new t5,this._cacheMapCombined=new t5,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new ic,this._textureSize=512,this._onAddTextureAtlasCanvas=new qt,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new qt,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=NM(t,this._config.deviceCellWidth*4+Eu*2,this._config.deviceCellHeight+Eu*2),this._tmpCtx=Cr(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let t of this.pages)t.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let t=new qV;for(let r=33;r<126;r++)t.enqueue(()=>{if(!this._cacheMap.get(r,0,0,0)){let s=this._drawToCache(r,0,0,0,!1,void 0);this._cacheMap.set(r,0,0,0,s)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let t of this._pages)t.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(sc.maxAtlasPages&&this._pages.length>=Math.max(4,sc.maxAtlasPages)){let r=this._pages.filter(f=>f.canvas.width*2<=(sc.maxTextureSize||4096)).sort((f,v)=>v.canvas.width!==f.canvas.width?v.canvas.width-f.canvas.width:v.percentageUsed-f.percentageUsed),s=-1,n=0;for(let f=0;f<r.length;f++)if(r[f].canvas.width!==n)s=f,n=r[f].canvas.width;else if(f-s===3)break;let l=r.slice(s,s+4),u=l.map(f=>f.glyphs[0].texturePage).sort((f,v)=>f>v?1:-1),d=this.pages.length-l.length,m=this._mergePages(l,d);m.version++;for(let f=u.length-1;f>=0;f--)this._deletePage(u[f]);this.pages.push(m),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(m.canvas)}let t=new u_(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,r){let s=t[0].canvas.width*2,n=new u_(this._document,s,t);for(let[l,u]of t.entries()){let d=l*u.canvas.width%s,m=Math.floor(l/2)*u.canvas.height;n.ctx.drawImage(u.canvas,d,m);for(let v of u.glyphs)v.texturePage=r,v.sizeClipSpace.x=v.size.x/s,v.sizeClipSpace.y=v.size.y/s,v.texturePosition.x+=d,v.texturePosition.y+=m,v.texturePositionClipSpace.x=v.texturePosition.x/s,v.texturePositionClipSpace.y=v.texturePosition.y/s;this._onRemoveTextureAtlasCanvas.fire(u.canvas);let f=this._activePages.indexOf(u);f!==-1&&this._activePages.splice(f,1)}return n}_deletePage(t){this._pages.splice(t,1);for(let r=t;r<this._pages.length;r++){let s=this._pages[r];for(let n of s.glyphs)n.texturePage--;s.version++}}getRasterizedGlyphCombinedChar(t,r,s,n,l,u){return this._getFromCacheMap(this._cacheMapCombined,t,r,s,n,l,u)}getRasterizedGlyph(t,r,s,n,l,u){return this._getFromCacheMap(this._cacheMap,t,r,s,n,l,u)}_getFromCacheMap(t,r,s,n,l,u,d){return Ru=t.get(r,s,n,l),Ru||(Ru=this._drawToCache(r,s,n,l,u,d),t.set(r,s,n,l,Ru)),Ru}_getColorFromAnsiIndex(t){if(t>=this._config.colors.ansi.length)throw new Error("No color found for idx "+t);return this._config.colors.ansi[t]}_getBackgroundColor(t,r,s,n){if(this._config.allowTransparency)return mi;let l;switch(t){case 16777216:case 33554432:l=this._getColorFromAnsiIndex(r);break;case 50331648:let u=ic.toColorRGB(r);l=ys.toColor(u[0],u[1],u[2]);break;case 0:default:s?l=zu.opaque(this._config.colors.foreground):l=this._config.colors.background;break}return this._config.allowTransparency||(l=zu.opaque(l)),l}_getForegroundColor(t,r,s,n,l,u,d,m,f,v){let p=this._getMinimumContrastColor(t,r,s,n,l,u,d,f,m,v);if(p)return p;let x;switch(l){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&f&&u<8&&(u+=8),x=this._getColorFromAnsiIndex(u);break;case 50331648:let b=ic.toColorRGB(u);x=ys.toColor(b[0],b[1],b[2]);break;case 0:default:d?x=this._config.colors.background:x=this._config.colors.foreground}return this._config.allowTransparency&&(x=zu.opaque(x)),m&&(x=zu.multiplyOpacity(x,LV)),x}_resolveBackgroundRgba(t,r,s){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(r).rgba;case 50331648:return r<<8;case 0:default:return s?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,r,s,n){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&n&&r<8&&(r+=8),this._getColorFromAnsiIndex(r).rgba;case 50331648:return r<<8;case 0:default:return s?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,r,s,n,l,u,d,m,f,v){if(this._config.minimumContrastRatio===1||v)return;let p=this._getContrastCache(f),x=p.getColor(t,n);if(x!==void 0)return x||void 0;let b=this._resolveBackgroundRgba(r,s,d),w=this._resolveForegroundRgba(l,u,d,m),C=qo.ensureContrastRatio(b,w,this._config.minimumContrastRatio/(f?2:1));if(!C){p.setColor(t,n,null);return}let k=ys.toColor(C>>24&255,C>>16&255,C>>8&255);return p.setColor(t,n,k),k}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,r,s,n,l,u){let d=typeof t=="number"?String.fromCharCode(t):t;u&&this._tmpCanvas.parentElement!==u&&(this._tmpCanvas.style.display="none",u.append(this._tmpCanvas));let m=Math.min(this._config.deviceCellWidth*Math.max(d.length,2)+Eu*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<m&&(this._tmpCanvas.width=m);let f=Math.min(this._config.deviceCellHeight+Eu*4,this._textureSize);if(this._tmpCanvas.height<f&&(this._tmpCanvas.height=f),this._tmpCtx.save(),this._workAttributeData.fg=s,this._workAttributeData.bg=r,this._workAttributeData.extended.ext=n,!!this._workAttributeData.isInvisible())return r5;let v=!!this._workAttributeData.isBold(),p=!!this._workAttributeData.isInverse(),x=!!this._workAttributeData.isDim(),b=!!this._workAttributeData.isItalic(),w=!!this._workAttributeData.isUnderline(),C=!!this._workAttributeData.isStrikethrough(),k=!!this._workAttributeData.isOverline(),S=this._workAttributeData.getFgColor(),E=this._workAttributeData.getFgColorMode(),N=this._workAttributeData.getBgColor(),R=this._workAttributeData.getBgColorMode();if(p){let H=S;S=N,N=H;let T=E;E=R,R=T}let A=this._getBackgroundColor(R,N,p,x);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=A.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let D=v?this._config.fontWeightBold:this._config.fontWeight,B=b?"italic":"";this._tmpCtx.font=`${B} ${D} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=vM;let $=d.length===1&&Oy(d.charCodeAt(0)),q=d.length===1&&EV(d.charCodeAt(0)),Y=this._getForegroundColor(r,R,N,s,E,S,p,x,v,gM(d.charCodeAt(0)));this._tmpCtx.fillStyle=Y.css;let V=q?0:Eu*2,U=!1;this._config.customGlyphs!==!1&&(U=IV(this._tmpCtx,d,V,V,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let L=!$,I;if(typeof t=="number"?I=this._unicodeService.wcwidth(t):I=this._unicodeService.getStringCellWidth(t),w){this._tmpCtx.save();let H=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),T=H%2===1?.5:0;if(this._tmpCtx.lineWidth=H,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())L=!1,this._tmpCtx.strokeStyle=`rgb(${ic.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{L=!1;let Z=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&Z<8&&(Z+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(Z).css}this._tmpCtx.beginPath();let G=V,X=Math.ceil(V+this._config.deviceCharHeight)-T-(l?H*2:0),ee=X+H,oe=X+H*2,de=this._workAttributeData.getUnderlineVariantOffset();for(let Z=0;Z<I;Z++){this._tmpCtx.save();let ce=G+Z*this._config.deviceCellWidth,le=G+(Z+1)*this._config.deviceCellWidth,be=ce+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(ce,X),this._tmpCtx.lineTo(le,X),this._tmpCtx.moveTo(ce,oe),this._tmpCtx.lineTo(le,oe);break;case 3:let ke=H<=1?oe:Math.ceil(V+this._config.deviceCharHeight-H/2)-T,Ee=H<=1?X:Math.ceil(V+this._config.deviceCharHeight+H/2)-T,te=new Path2D;te.rect(ce,X,this._config.deviceCellWidth,oe-X),this._tmpCtx.clip(te),this._tmpCtx.moveTo(ce-this._config.deviceCellWidth/2,ee),this._tmpCtx.bezierCurveTo(ce-this._config.deviceCellWidth/2,Ee,ce,Ee,ce,ee),this._tmpCtx.bezierCurveTo(ce,ke,be,ke,be,ee),this._tmpCtx.bezierCurveTo(be,Ee,le,Ee,le,ee),this._tmpCtx.bezierCurveTo(le,ke,le+this._config.deviceCellWidth/2,ke,le+this._config.deviceCellWidth/2,ee);break;case 4:let re=de===0?0:de>=H?H*2-de:H-de;de>=H||re===0?(this._tmpCtx.setLineDash([Math.round(H),Math.round(H)]),this._tmpCtx.moveTo(ce+re,X),this._tmpCtx.lineTo(le,X)):(this._tmpCtx.setLineDash([Math.round(H),Math.round(H)]),this._tmpCtx.moveTo(ce,X),this._tmpCtx.lineTo(ce+re,X),this._tmpCtx.moveTo(ce+re+H,X),this._tmpCtx.lineTo(le,X)),de=TV(le-ce,H,de);break;case 5:let Ce=.6,De=.3,_e=le-ce,Re=Math.floor(Ce*_e),Pe=Math.floor(De*_e),Ue=_e-Re-Pe;this._tmpCtx.setLineDash([Re,Pe,Ue]),this._tmpCtx.moveTo(ce,X),this._tmpCtx.lineTo(le,X);break;case 1:default:this._tmpCtx.moveTo(ce,X),this._tmpCtx.lineTo(le,X);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!U&&this._config.fontSize>=12&&!this._config.allowTransparency&&d!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let Z=this._tmpCtx.measureText(d);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in Z&&Z.actualBoundingBoxDescent>0){this._tmpCtx.save();let ce=new Path2D;ce.rect(G,X-Math.ceil(H/2),this._config.deviceCellWidth*I,oe-X+Math.ceil(H/2)),this._tmpCtx.clip(ce),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=A.css,this._tmpCtx.strokeText(d,V,V+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(k){let H=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),T=H%2===1?.5:0;this._tmpCtx.lineWidth=H,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(V,V+T),this._tmpCtx.lineTo(V+this._config.deviceCharWidth*I,V+T),this._tmpCtx.stroke()}if(U||this._tmpCtx.fillText(d,V,V+this._config.deviceCharHeight),d==="_"&&!this._config.allowTransparency){let H=d_(this._tmpCtx.getImageData(V,V,this._config.deviceCellWidth,this._config.deviceCellHeight),A,Y,L);if(H)for(let T=1;T<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=A.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(d,V,V+this._config.deviceCharHeight-T),H=d_(this._tmpCtx.getImageData(V,V,this._config.deviceCellWidth,this._config.deviceCellHeight),A,Y,L),!!H);T++);}if(C){let H=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),T=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=H,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(V,V+Math.floor(this._config.deviceCharHeight/2)-T),this._tmpCtx.lineTo(V+this._config.deviceCharWidth*I,V+Math.floor(this._config.deviceCharHeight/2)-T),this._tmpCtx.stroke()}this._tmpCtx.restore();let F=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),M;if(this._config.allowTransparency?M=iG(F):M=d_(F,A,Y,L),M)return r5;let P=this._findGlyphBoundingBox(F,this._workBoundingBox,m,q,U,V),O,W;for(;;){if(this._activePages.length===0){let H=this._createNewPage();O=H,W=H.currentRow,W.height=P.size.y;break}O=this._activePages[this._activePages.length-1],W=O.currentRow;for(let H of this._activePages)P.size.y<=H.currentRow.height&&(O=H,W=H.currentRow);for(let H=this._activePages.length-1;H>=0;H--)for(let T of this._activePages[H].fixedRows)T.height<=W.height&&P.size.y<=T.height&&(O=this._activePages[H],W=T);if(P.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new u_(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),O=this._overflowSizePage,W=this._overflowSizePage.currentRow,W.x+P.size.x>=O.canvas.width&&(W.x=0,W.y+=W.height,W.height=0);break}if(W.y+P.size.y>=O.canvas.height||W.height>P.size.y+2){let H=!1;if(O.currentRow.y+O.currentRow.height+P.size.y>=O.canvas.height){let T;for(let G of this._activePages)if(G.currentRow.y+G.currentRow.height+P.size.y<G.canvas.height){T=G;break}if(T)O=T;else if(sc.maxAtlasPages&&this._pages.length>=sc.maxAtlasPages&&W.y+P.size.y<=O.canvas.height&&W.height>=P.size.y&&W.x+P.size.x<=O.canvas.width)H=!0;else{let G=this._createNewPage();O=G,W=G.currentRow,W.height=P.size.y,H=!0}}H||(O.currentRow.height>0&&O.fixedRows.push(O.currentRow),W={x:0,y:O.currentRow.y+O.currentRow.height,height:P.size.y},O.fixedRows.push(W),O.currentRow={x:0,y:W.y+W.height,height:0})}if(W.x+P.size.x<=O.canvas.width)break;W===O.currentRow?(W.x=0,W.y+=W.height,W.height=0):O.fixedRows.splice(O.fixedRows.indexOf(W),1)}return P.texturePage=this._pages.indexOf(O),P.texturePosition.x=W.x,P.texturePosition.y=W.y,P.texturePositionClipSpace.x=W.x/O.canvas.width,P.texturePositionClipSpace.y=W.y/O.canvas.height,P.sizeClipSpace.x/=O.canvas.width,P.sizeClipSpace.y/=O.canvas.height,W.height=Math.max(W.height,P.size.y),W.x+=P.size.x,O.ctx.putImageData(F,P.texturePosition.x-this._workBoundingBox.left,P.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,P.size.x,P.size.y),O.addGlyph(P),O.version++,P}_findGlyphBoundingBox(t,r,s,n,l,u){r.top=0;let d=n?this._config.deviceCellHeight:this._tmpCanvas.height,m=n?this._config.deviceCellWidth:s,f=!1;for(let v=0;v<d;v++){for(let p=0;p<m;p++){let x=v*this._tmpCanvas.width*4+p*4+3;if(t.data[x]!==0){r.top=v,f=!0;break}}if(f)break}r.left=0,f=!1;for(let v=0;v<u+m;v++){for(let p=0;p<d;p++){let x=p*this._tmpCanvas.width*4+v*4+3;if(t.data[x]!==0){r.left=v,f=!0;break}}if(f)break}r.right=m,f=!1;for(let v=u+m-1;v>=u;v--){for(let p=0;p<d;p++){let x=p*this._tmpCanvas.width*4+v*4+3;if(t.data[x]!==0){r.right=v,f=!0;break}}if(f)break}r.bottom=d,f=!1;for(let v=d-1;v>=0;v--){for(let p=0;p<m;p++){let x=v*this._tmpCanvas.width*4+p*4+3;if(t.data[x]!==0){r.bottom=v,f=!0;break}}if(f)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:r.right-r.left+1,y:r.bottom-r.top+1},sizeClipSpace:{x:r.right-r.left+1,y:r.bottom-r.top+1},offset:{x:-r.left+u+(n||l?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-r.top+u+(n||l?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},u_=class{constructor(t,r,s){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],s)for(let n of s)this._glyphs.push(...n.glyphs),this._usedPixels+=n._usedPixels;this.canvas=NM(t,r,r),this.ctx=Cr(this.canvas.getContext("2d",{alpha:!0}))}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(t){this._glyphs.push(t),this._usedPixels+=t.size.x*t.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}};function d_(e,t,r,s){let n=t.rgba>>>24,l=t.rgba>>>16&255,u=t.rgba>>>8&255,d=r.rgba>>>24,m=r.rgba>>>16&255,f=r.rgba>>>8&255,v=Math.floor((Math.abs(n-d)+Math.abs(l-m)+Math.abs(u-f))/12),p=!0;for(let x=0;x<e.data.length;x+=4)e.data[x]===n&&e.data[x+1]===l&&e.data[x+2]===u||s&&Math.abs(e.data[x]-n)+Math.abs(e.data[x+1]-l)+Math.abs(e.data[x+2]-u)<v?e.data[x+3]=0:p=!1;return p}function iG(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function NM(e,t,r){let s=e.createElement("canvas");return s.width=t,s.height=r,s}function nG(e,t,r,s,n,l,u,d){let m={foreground:l.foreground,background:l.background,cursor:mi,cursorAccent:mi,selectionForeground:mi,selectionBackgroundTransparent:mi,selectionBackgroundOpaque:mi,selectionInactiveBackgroundTransparent:mi,selectionInactiveBackgroundOpaque:mi,overviewRulerBorder:mi,scrollbarSliderBackground:mi,scrollbarSliderHoverBackground:mi,scrollbarSliderActiveBackground:mi,ansi:l.ansi.slice(),contrastCache:l.contrastCache,halfContrastCache:l.halfContrastCache};return{customGlyphs:n.customGlyphs,devicePixelRatio:u,deviceMaxTextureSize:d,letterSpacing:n.letterSpacing,lineHeight:n.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:r,deviceCharHeight:s,fontFamily:n.fontFamily,fontSize:n.fontSize,fontWeight:n.fontWeight,fontWeightBold:n.fontWeightBold,allowTransparency:n.allowTransparency,drawBoldTextInBrightColors:n.drawBoldTextInBrightColors,minimumContrastRatio:n.minimumContrastRatio,colors:m}}function s5(e,t){for(let r=0;r<e.colors.ansi.length;r++)if(e.colors.ansi[r].rgba!==t.colors.ansi[r].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba}function aG(e){return(e&50331648)===16777216||(e&50331648)===33554432}var xi=[];function jM(e,t,r,s,n,l,u,d,m){let f=nG(s,n,l,u,t,r,d,m);for(let x=0;x<xi.length;x++){let b=xi[x],w=b.ownedBy.indexOf(e);if(w>=0){if(s5(b.config,f))return b.atlas;b.ownedBy.length===1?(b.atlas.dispose(),xi.splice(x,1)):b.ownedBy.splice(w,1);break}}for(let x=0;x<xi.length;x++){let b=xi[x];if(s5(b.config,f))return b.ownedBy.push(e),b.atlas}let v=e._core,p={atlas:new Wa(document,f,v.unicodeService),config:f,ownedBy:[e]};return xi.push(p),p.atlas}function i5(e){for(let t=0;t<xi.length;t++){let r=xi[t].ownedBy.indexOf(e);if(r!==-1){xi[t].ownedBy.length===1?(xi[t].atlas.dispose(),xi.splice(t,1)):xi[t].ownedBy.splice(r,1);break}}}var mf=600,oG=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(e=mf){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=mf-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,t>0){this._restartInterval(t);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let t=mf-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(t);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},mf)},e)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function n5(e,t,r){let s=new t.ResizeObserver(n=>{let l=n.find(m=>m.target===e);if(!l)return;if(!("devicePixelContentBoxSize"in l)){s==null||s.disconnect(),s=void 0;return}let u=l.devicePixelContentBoxSize[0].inlineSize,d=l.devicePixelContentBoxSize[0].blockSize;u>0&&d>0&&r(u,d)});try{s.observe(e,{box:["device-pixel-content-box"]})}catch{s.disconnect(),s=void 0}return ps(()=>s==null?void 0:s.disconnect())}function lG(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var a5=class AM extends ic{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new wM,this.combinedData=""}static fromCharData(t){let r=new AM;return r.setFromCharData(t),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?lG(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 r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let n=t[1].charCodeAt(1);56320<=n&&n<=57343?this.content=(s-55296)*1024+n-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},MM=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function TM(e,t,r){let s=Cr(e.createProgram());if(e.attachShader(s,Cr(o5(e,e.VERTEX_SHADER,t))),e.attachShader(s,Cr(o5(e,e.FRAGMENT_SHADER,r))),e.linkProgram(s),e.getProgramParameter(s,e.LINK_STATUS))return s;console.error(e.getProgramInfoLog(s)),e.deleteProgram(s)}function o5(e,t,r){let s=Cr(e.createShader(t));if(e.shaderSource(s,r),e.compileShader(s),e.getShaderParameter(s,e.COMPILE_STATUS))return s;console.error(e.getShaderInfoLog(s)),e.deleteShader(s)}function cG(e,t){let r=Math.min(e.length*2,t),s=new Float32Array(r);for(let n=0;n<e.length;n++)s[n]=e[n];return s}var uG=class{constructor(t){this.texture=t,this.version=-1}},dG=`#version 300 es
|
|
627
|
-
layout (location = 0) in vec2 a_unitquad;
|
|
628
|
-
layout (location = 1) in vec2 a_cellpos;
|
|
629
|
-
layout (location = 2) in vec2 a_offset;
|
|
630
|
-
layout (location = 3) in vec2 a_size;
|
|
631
|
-
layout (location = 4) in float a_texpage;
|
|
632
|
-
layout (location = 5) in vec2 a_texcoord;
|
|
633
|
-
layout (location = 6) in vec2 a_texsize;
|
|
634
|
-
|
|
635
|
-
uniform mat4 u_projection;
|
|
636
|
-
uniform vec2 u_resolution;
|
|
637
|
-
|
|
638
|
-
out vec2 v_texcoord;
|
|
639
|
-
flat out int v_texpage;
|
|
640
|
-
|
|
641
|
-
void main() {
|
|
642
|
-
vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
|
|
643
|
-
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
644
|
-
v_texpage = int(a_texpage);
|
|
645
|
-
v_texcoord = a_texcoord + a_unitquad * a_texsize;
|
|
646
|
-
}`;function hG(e){let t="";for(let r=1;r<e;r++)t+=` else if (v_texpage == ${r}) { outColor = texture(u_texture[${r}], v_texcoord); }`;return`#version 300 es
|
|
647
|
-
precision lowp float;
|
|
648
|
-
|
|
649
|
-
in vec2 v_texcoord;
|
|
650
|
-
flat in int v_texpage;
|
|
651
|
-
|
|
652
|
-
uniform sampler2D u_texture[${e}];
|
|
653
|
-
|
|
654
|
-
out vec4 outColor;
|
|
655
|
-
|
|
656
|
-
void main() {
|
|
657
|
-
if (v_texpage == 0) {
|
|
658
|
-
outColor = texture(u_texture[0], v_texcoord);
|
|
659
|
-
} ${t}
|
|
660
|
-
}`}var qa=11,Xl=qa*Float32Array.BYTES_PER_ELEMENT,fG=2,ar=0,Ft,h_=0,Nu=0,mG=class extends qi{constructor(t,r,s,n){super(),this._terminal=t,this._gl=r,this._dimensions=s,this._optionsService=n,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let l=this._gl;Wa.maxAtlasPages===void 0&&(Wa.maxAtlasPages=Math.min(32,Cr(l.getParameter(l.MAX_TEXTURE_IMAGE_UNITS))),Wa.maxTextureSize=Cr(l.getParameter(l.MAX_TEXTURE_SIZE))),this._program=Cr(TM(l,dG,hG(Wa.maxAtlasPages))),this._register(ps(()=>l.deleteProgram(this._program))),this._projectionLocation=Cr(l.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=Cr(l.getUniformLocation(this._program,"u_resolution")),this._textureLocation=Cr(l.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=l.createVertexArray(),l.bindVertexArray(this._vertexArrayObject);let u=new Float32Array([0,0,1,0,0,1,1,1]),d=l.createBuffer();this._register(ps(()=>l.deleteBuffer(d))),l.bindBuffer(l.ARRAY_BUFFER,d),l.bufferData(l.ARRAY_BUFFER,u,l.STATIC_DRAW),l.enableVertexAttribArray(0),l.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let m=new Uint8Array([0,1,2,3]),f=l.createBuffer();this._register(ps(()=>l.deleteBuffer(f))),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,f),l.bufferData(l.ELEMENT_ARRAY_BUFFER,m,l.STATIC_DRAW),this._attributesBuffer=Cr(l.createBuffer()),this._register(ps(()=>l.deleteBuffer(this._attributesBuffer))),l.bindBuffer(l.ARRAY_BUFFER,this._attributesBuffer),l.enableVertexAttribArray(2),l.vertexAttribPointer(2,2,l.FLOAT,!1,Xl,0),l.vertexAttribDivisor(2,1),l.enableVertexAttribArray(3),l.vertexAttribPointer(3,2,l.FLOAT,!1,Xl,2*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(3,1),l.enableVertexAttribArray(4),l.vertexAttribPointer(4,1,l.FLOAT,!1,Xl,4*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(4,1),l.enableVertexAttribArray(5),l.vertexAttribPointer(5,2,l.FLOAT,!1,Xl,5*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(5,1),l.enableVertexAttribArray(6),l.vertexAttribPointer(6,2,l.FLOAT,!1,Xl,7*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(6,1),l.enableVertexAttribArray(1),l.vertexAttribPointer(1,2,l.FLOAT,!1,Xl,9*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(1,1),l.useProgram(this._program);let v=new Int32Array(Wa.maxAtlasPages);for(let p=0;p<Wa.maxAtlasPages;p++)v[p]=p;l.uniform1iv(this._textureLocation,v),l.uniformMatrix4fv(this._projectionLocation,!1,MM),this._atlasTextures=[];for(let p=0;p<Wa.maxAtlasPages;p++){let x=new uG(Cr(l.createTexture()));this._register(ps(()=>l.deleteTexture(x.texture))),l.activeTexture(l.TEXTURE0+p),l.bindTexture(l.TEXTURE_2D,x.texture),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texImage2D(l.TEXTURE_2D,0,l.RGBA,1,1,0,l.RGBA,l.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[p]=x}l.enable(l.BLEND),l.blendFunc(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(t,r,s,n,l,u,d,m,f){this._updateCell(this._vertices.attributes,t,r,s,n,l,u,d,m,f)}_updateCell(t,r,s,n,l,u,d,m,f,v){if(ar=(s*this._terminal.cols+r)*qa,n===0||n===void 0){t.fill(0,ar,ar+qa-1-fG);return}this._atlas&&(m&&m.length>1?Ft=this._atlas.getRasterizedGlyphCombinedChar(m,l,u,d,!1,this._terminal.element):Ft=this._atlas.getRasterizedGlyph(n,l,u,d,!1,this._terminal.element),h_=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),l!==v&&Ft.offset.x>h_?(Nu=Ft.offset.x-h_,t[ar]=-(Ft.offset.x-Nu)+this._dimensions.device.char.left,t[ar+1]=-Ft.offset.y+this._dimensions.device.char.top,t[ar+2]=(Ft.size.x-Nu)/this._dimensions.device.canvas.width,t[ar+3]=Ft.size.y/this._dimensions.device.canvas.height,t[ar+4]=Ft.texturePage,t[ar+5]=Ft.texturePositionClipSpace.x+Nu/this._atlas.pages[Ft.texturePage].canvas.width,t[ar+6]=Ft.texturePositionClipSpace.y,t[ar+7]=Ft.sizeClipSpace.x-Nu/this._atlas.pages[Ft.texturePage].canvas.width,t[ar+8]=Ft.sizeClipSpace.y):(t[ar]=-Ft.offset.x+this._dimensions.device.char.left,t[ar+1]=-Ft.offset.y+this._dimensions.device.char.top,t[ar+2]=Ft.size.x/this._dimensions.device.canvas.width,t[ar+3]=Ft.size.y/this._dimensions.device.canvas.height,t[ar+4]=Ft.texturePage,t[ar+5]=Ft.texturePositionClipSpace.x,t[ar+6]=Ft.texturePositionClipSpace.y,t[ar+7]=Ft.sizeClipSpace.x,t[ar+8]=Ft.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&AV(n,f,Ft.size.x,this._dimensions.device.cell.width)&&(t[ar+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let t=this._terminal,r=t.cols*t.rows*qa;this._vertices.count!==r?this._vertices.attributes=new Float32Array(r):this._vertices.attributes.fill(0);let s=0;for(;s<this._vertices.attributesBuffers.length;s++)this._vertices.count!==r?this._vertices.attributesBuffers[s]=new Float32Array(r):this._vertices.attributesBuffers[s].fill(0);this._vertices.count=r,s=0;for(let n=0;n<t.rows;n++)for(let l=0;l<t.cols;l++)this._vertices.attributes[s+9]=l/t.cols,this._vertices.attributes[s+10]=n/t.rows,s+=qa}handleResize(){let t=this._gl;t.useProgram(this._program),t.viewport(0,0,t.canvas.width,t.canvas.height),t.uniform2f(this._resolutionLocation,t.canvas.width,t.canvas.height),this.clear()}render(t){if(!this._atlas)return;let r=this._gl;r.useProgram(this._program),r.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let s=this._vertices.attributesBuffers[this._activeBuffer],n=0;for(let l=0;l<t.lineLengths.length;l++){let u=l*this._terminal.cols*qa,d=this._vertices.attributes.subarray(u,u+t.lineLengths[l]*qa);s.set(d,n),n+=d.length}r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.bufferData(r.ARRAY_BUFFER,s.subarray(0,n),r.STREAM_DRAW);for(let l=0;l<this._atlas.pages.length;l++)this._atlas.pages[l].version!==this._atlasTextures[l].version&&this._bindAtlasPageTexture(r,this._atlas,l);r.drawElementsInstanced(r.TRIANGLE_STRIP,4,r.UNSIGNED_BYTE,0,n/qa)}setAtlas(t){this._atlas=t;for(let r of this._atlasTextures)r.version=-1}_bindAtlasPageTexture(t,r,s){t.activeTexture(t.TEXTURE0+s),t.bindTexture(t.TEXTURE_2D,this._atlasTextures[s].texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,r.pages[s].canvas),t.generateMipmap(t.TEXTURE_2D),this._atlasTextures[s].version=r.pages[s].version}setDimensions(t){this._dimensions=t}},pG=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(t,r,s,n=!1){if(this.selectionStart=r,this.selectionEnd=s,!r||!s||r[0]===s[0]&&r[1]===s[1]){this.clear();return}let l=t.buffers.active.ydisp,u=r[1]-l,d=s[1]-l,m=Math.max(u,0),f=Math.min(d,t.rows-1);if(m>=t.rows||f<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=n,this.viewportStartRow=u,this.viewportEndRow=d,this.viewportCappedStartRow=m,this.viewportCappedEndRow=f,this.startCol=r[0],this.endCol=s[0]}isCellSelected(t,r,s){return this.hasSelection?(s-=t.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?r>=this.startCol&&s>=this.viewportCappedStartRow&&r<this.endCol&&s<=this.viewportCappedEndRow:r<this.startCol&&s>=this.viewportCappedStartRow&&r>=this.endCol&&s<=this.viewportCappedEndRow:s>this.viewportStartRow&&s<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&s===this.viewportStartRow&&r>=this.startCol&&r<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportEndRow&&r<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportStartRow&&r>=this.startCol):!1}};function gG(){return new pG}var dm=4,Lf=1,Of=2,f_=3,vG=2147483648,_G=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=gG()}resize(t,r){let s=t*r*dm;s!==this.cells.length&&(this.cells=new Uint32Array(s),this.lineLengths=new Uint32Array(r))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},xG=`#version 300 es
|
|
661
|
-
layout (location = 0) in vec2 a_position;
|
|
662
|
-
layout (location = 1) in vec2 a_size;
|
|
663
|
-
layout (location = 2) in vec4 a_color;
|
|
664
|
-
layout (location = 3) in vec2 a_unitquad;
|
|
665
|
-
|
|
666
|
-
uniform mat4 u_projection;
|
|
667
|
-
|
|
668
|
-
out vec4 v_color;
|
|
669
|
-
|
|
670
|
-
void main() {
|
|
671
|
-
vec2 zeroToOne = a_position + (a_unitquad * a_size);
|
|
672
|
-
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
673
|
-
v_color = a_color;
|
|
674
|
-
}`,yG=`#version 300 es
|
|
675
|
-
precision lowp float;
|
|
676
|
-
|
|
677
|
-
in vec4 v_color;
|
|
678
|
-
|
|
679
|
-
out vec4 outColor;
|
|
680
|
-
|
|
681
|
-
void main() {
|
|
682
|
-
outColor = v_color;
|
|
683
|
-
}`,Zn=8,m_=Zn*Float32Array.BYTES_PER_ELEMENT,bG=20*Zn,l5=class{constructor(){this.attributes=new Float32Array(bG),this.count=0}},Kn=0,c5=0,u5=0,d5=0,h5=0,f5=0,m5=0,wG=class extends qi{constructor(e,t,r,s){super(),this._terminal=e,this._gl=t,this._dimensions=r,this._themeService=s,this._vertices=new l5,this._verticesCursor=new l5;let n=this._gl;this._program=Cr(TM(n,xG,yG)),this._register(ps(()=>n.deleteProgram(this._program))),this._projectionLocation=Cr(n.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=n.createVertexArray(),n.bindVertexArray(this._vertexArrayObject);let l=new Float32Array([0,0,1,0,0,1,1,1]),u=n.createBuffer();this._register(ps(()=>n.deleteBuffer(u))),n.bindBuffer(n.ARRAY_BUFFER,u),n.bufferData(n.ARRAY_BUFFER,l,n.STATIC_DRAW),n.enableVertexAttribArray(3),n.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let d=new Uint8Array([0,1,2,3]),m=n.createBuffer();this._register(ps(()=>n.deleteBuffer(m))),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,m),n.bufferData(n.ELEMENT_ARRAY_BUFFER,d,n.STATIC_DRAW),this._attributesBuffer=Cr(n.createBuffer()),this._register(ps(()=>n.deleteBuffer(this._attributesBuffer))),n.bindBuffer(n.ARRAY_BUFFER,this._attributesBuffer),n.enableVertexAttribArray(0),n.vertexAttribPointer(0,2,n.FLOAT,!1,m_,0),n.vertexAttribDivisor(0,1),n.enableVertexAttribArray(1),n.vertexAttribPointer(1,2,n.FLOAT,!1,m_,2*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(1,1),n.enableVertexAttribArray(2),n.vertexAttribPointer(2,4,n.FLOAT,!1,m_,4*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(2,1),this._updateCachedColors(s.colors),this._register(this._themeService.onChangeColors(f=>{this._updateCachedColors(f),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,MM),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,r=this._vertices,s=1,n,l,u,d,m,f,v,p,x,b,w;for(n=0;n<t.rows;n++){for(u=-1,d=0,m=0,f=!1,l=0;l<t.cols;l++)v=(n*t.cols+l)*dm,p=e.cells[v+Lf],x=e.cells[v+Of],b=!!(x&67108864),(p!==d||x!==m&&(f||b))&&((d!==0||f&&m!==0)&&(w=s++*Zn,this._updateRectangle(r,w,m,d,u,l,n)),u=l,d=p,m=x,f=b);(d!==0||f&&m!==0)&&(w=s++*Zn,this._updateRectangle(r,w,m,d,u,t.cols,n))}r.count=s}updateCursor(e){let t=this._verticesCursor,r=e.cursor;if(!r||r.style==="block"){t.count=0;return}let s,n=0;(r.style==="bar"||r.style==="outline")&&(s=n++*Zn,this._addRectangleFloat(t.attributes,s,r.x*this._dimensions.device.cell.width,r.y*this._dimensions.device.cell.height,r.style==="bar"?r.dpr*r.cursorWidth:r.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(r.style==="underline"||r.style==="outline")&&(s=n++*Zn,this._addRectangleFloat(t.attributes,s,r.x*this._dimensions.device.cell.width,(r.y+1)*this._dimensions.device.cell.height-r.dpr,r.width*this._dimensions.device.cell.width,r.dpr,this._cursorFloat)),r.style==="outline"&&(s=n++*Zn,this._addRectangleFloat(t.attributes,s,r.x*this._dimensions.device.cell.width,r.y*this._dimensions.device.cell.height,r.width*this._dimensions.device.cell.width,r.dpr,this._cursorFloat),s=n++*Zn,this._addRectangleFloat(t.attributes,s,(r.x+r.width)*this._dimensions.device.cell.width-r.dpr,r.y*this._dimensions.device.cell.height,r.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=n}_updateRectangle(e,t,r,s,n,l,u){if(r&67108864)switch(r&50331648){case 16777216:case 33554432:Kn=this._themeService.colors.ansi[r&255].rgba;break;case 50331648:Kn=(r&16777215)<<8;break;case 0:default:Kn=this._themeService.colors.foreground.rgba}else switch(s&50331648){case 16777216:case 33554432:Kn=this._themeService.colors.ansi[s&255].rgba;break;case 50331648:Kn=(s&16777215)<<8;break;case 0:default:Kn=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=cG(e.attributes,this._terminal.rows*this._terminal.cols*Zn)),c5=n*this._dimensions.device.cell.width,u5=u*this._dimensions.device.cell.height,d5=(Kn>>24&255)/255,h5=(Kn>>16&255)/255,f5=(Kn>>8&255)/255,m5=1,this._addRectangle(e.attributes,t,c5,u5,(l-n)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,d5,h5,f5,m5)}_addRectangle(e,t,r,s,n,l,u,d,m,f){e[t]=r/this._dimensions.device.canvas.width,e[t+1]=s/this._dimensions.device.canvas.height,e[t+2]=n/this._dimensions.device.canvas.width,e[t+3]=l/this._dimensions.device.canvas.height,e[t+4]=u,e[t+5]=d,e[t+6]=m,e[t+7]=f}_addRectangleFloat(e,t,r,s,n,l,u){e[t]=r/this._dimensions.device.canvas.width,e[t+1]=s/this._dimensions.device.canvas.height,e[t+2]=n/this._dimensions.device.canvas.width,e[t+3]=l/this._dimensions.device.canvas.height,e[t+4]=u[0],e[t+5]=u[1],e[t+6]=u[2],e[t+7]=u[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(e.rgba&255)/255])}},SG=class extends qi{constructor(t,r,s,n,l,u,d,m){super(),this._container=r,this._alpha=l,this._coreBrowserService=u,this._optionsService=d,this._themeService=m,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${s}-layer`),this._canvas.style.zIndex=n.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(f=>{this._refreshCharAtlas(t,f),this.reset(t)})),this._register(ps(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=Cr(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(t){}handleFocus(t){}handleCursorMove(t){}handleGridChanged(t,r,s){}handleSelectionChanged(t,r,s,n=!1){}_setTransparency(t,r){if(r===this._alpha)return;let s=this._canvas;this._alpha=r,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,s),this._refreshCharAtlas(t,this._themeService.colors),this.handleGridChanged(t,0,t.rows-1)}_refreshCharAtlas(t,r){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=jM(t,this._optionsService.rawOptions,r,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(t,r){this._deviceCellWidth=r.device.cell.width,this._deviceCellHeight=r.device.cell.height,this._deviceCharWidth=r.device.char.width,this._deviceCharHeight=r.device.char.height,this._deviceCharLeft=r.device.char.left,this._deviceCharTop=r.device.char.top,this._canvas.width=r.device.canvas.width,this._canvas.height=r.device.canvas.height,this._canvas.style.width=`${r.css.canvas.width}px`,this._canvas.style.height=`${r.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(t,this._themeService.colors)}_fillBottomLineAtCells(t,r,s=1){this._ctx.fillRect(t*this._deviceCellWidth,(r+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,s*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(t,r,s,n){this._alpha?this._ctx.clearRect(t*this._deviceCellWidth,r*this._deviceCellHeight,s*this._deviceCellWidth,n*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(t*this._deviceCellWidth,r*this._deviceCellHeight,s*this._deviceCellWidth,n*this._deviceCellHeight))}_fillCharTrueColor(t,r,s,n){this._ctx.font=this._getFont(t,!1,!1),this._ctx.textBaseline=vM,this._clipCell(s,n,r.getWidth()),this._ctx.fillText(r.getChars(),s*this._deviceCellWidth+this._deviceCharLeft,n*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(t,r,s){this._ctx.beginPath(),this._ctx.rect(t*this._deviceCellWidth,r*this._deviceCellHeight,s*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(t,r,s){let n=r?t.options.fontWeightBold:t.options.fontWeight;return`${s?"italic":""} ${n} ${t.options.fontSize*this._coreBrowserService.dpr}px ${t.options.fontFamily}`}},CG=class extends SG{constructor(t,r,s,n,l,u,d){super(s,t,"link",r,!0,l,u,d),this._register(n.onShowLinkUnderline(m=>this._handleShowLinkUnderline(m))),this._register(n.onHideLinkUnderline(m=>this._handleHideLinkUnderline(m)))}resize(t,r){super.resize(t,r),this._state=void 0}reset(t){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let t=this._state.y2-this._state.y1-1;t>0&&this._clearCells(0,this._state.y1+1,this._state.cols,t),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(t){if(t.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:t.fg!==void 0&&aG(t.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[t.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,t.y1===t.y2)this._fillBottomLineAtCells(t.x1,t.y1,t.x2-t.x1);else{this._fillBottomLineAtCells(t.x1,t.y1,t.cols-t.x1);for(let r=t.y1+1;r<t.y2;r++)this._fillBottomLineAtCells(0,r,t.cols);this._fillBottomLineAtCells(0,t.y2,t.x2)}this._state=t}_handleHideLinkUnderline(t){this._clearCurrentLink()}},Ho=typeof window=="object"?window:globalThis,Nx=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new qt,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new qt,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,r){if(this.getZoomLevel(r)===t)return;let s=this.getWindowId(r);this.mapWindowIdToZoomLevel.set(s,t),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,r){this.mapWindowIdToZoomFactor.set(this.getWindowId(r),t)}setFullscreen(t,r){if(this.isFullscreen(r)===t)return;let s=this.getWindowId(r);this.mapWindowIdToFullScreen.set(s,t),this._onDidChangeFullscreen.fire(s)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Nx.INSTANCE=new Nx;var DM=Nx;function kG(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}DM.INSTANCE.onDidChangeZoomLevel;DM.INSTANCE.onDidChangeFullscreen;var Cc=typeof navigator=="object"?navigator.userAgent:"";Cc.indexOf("Firefox")>=0;Cc.indexOf("AppleWebKit")>=0;var EG=Cc.indexOf("Chrome")>=0;!EG&&Cc.indexOf("Safari")>=0;Cc.indexOf("Electron/")>=0;Cc.indexOf("Android")>=0;var p_=!1;if(typeof Ho.matchMedia=="function"){let e=Ho.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Ho.matchMedia("(display-mode: fullscreen)");p_=e.matches,kG(Ho,e,({matches:r})=>{p_&&t.matches||(p_=r)})}var nc="en",g_=!1,LM=!1,pf,Bf=nc,p5=nc,RG,Oi,Vo=globalThis,ns,kk;typeof Vo.vscode<"u"&&typeof Vo.vscode.process<"u"?ns=Vo.vscode.process:typeof process<"u"&&typeof((kk=process==null?void 0:process.versions)==null?void 0:kk.node)=="string"&&(ns=process);var Ek,NG=typeof((Ek=ns==null?void 0:ns.versions)==null?void 0:Ek.electron)=="string",jG=NG&&(ns==null?void 0:ns.type)==="renderer",Rk;if(typeof ns=="object"){ns.platform,ns.platform,g_=ns.platform==="linux",g_&&ns.env.SNAP&&ns.env.SNAP_REVISION,ns.env.CI||ns.env.BUILD_ARTIFACTSTAGINGDIRECTORY,pf=nc,Bf=nc;let e=ns.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);pf=t.userLocale,p5=t.osLocale,Bf=t.resolvedLanguage||nc,RG=(Rk=t.languagePack)==null?void 0:Rk.translationsConfigFile}catch{}LM=!0}else typeof navigator=="object"&&!jG?(Oi=navigator.userAgent,Oi.indexOf("Windows")>=0,Oi.indexOf("Macintosh")>=0,(Oi.indexOf("Macintosh")>=0||Oi.indexOf("iPad")>=0||Oi.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,g_=Oi.indexOf("Linux")>=0,(Oi==null?void 0:Oi.indexOf("Mobi"))>=0,Bf=globalThis._VSCODE_NLS_LANGUAGE||nc,pf=navigator.language.toLowerCase(),p5=pf):console.error("Unable to resolve platform.");var g5=LM,yn=Oi,za=Bf,AG;(e=>{function t(){return za}e.value=t;function r(){return za.length===2?za==="en":za.length>=3?za[0]==="e"&&za[1]==="n"&&za[2]==="-":!1}e.isDefaultVariant=r;function s(){return za==="en"}e.isDefault=s})(AG||(AG={}));var MG=typeof Vo.postMessage=="function"&&!Vo.importScripts;(()=>{if(MG){let e=[];Vo.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let s=0,n=e.length;s<n;s++){let l=e[s];if(l.id===r.data.vscodeScheduleAsyncWork){e.splice(s,1),l.callback();return}}});let t=0;return r=>{let s=++t;e.push({id:s,callback:r}),Vo.postMessage({vscodeScheduleAsyncWork:s},"*")}}return e=>setTimeout(e)})();var TG=!!(yn&&yn.indexOf("Chrome")>=0);yn&&yn.indexOf("Firefox")>=0;!TG&&yn&&yn.indexOf("Safari")>=0;yn&&yn.indexOf("Edg/")>=0;yn&&yn.indexOf("Android")>=0;var Zl=typeof navigator=="object"?navigator:{};g5||document.queryCommandSupported&&document.queryCommandSupported("copy")||Zl&&Zl.clipboard&&Zl.clipboard.writeText,g5||Zl&&Zl.clipboard&&Zl.clipboard.readText;var By=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}},v_=new By,v5=new By,_5=new By;new Array(230);var DG;(e=>{function t(d){return v_.keyCodeToStr(d)}e.toString=t;function r(d){return v_.strToKeyCode(d)}e.fromString=r;function s(d){return v5.keyCodeToStr(d)}e.toUserSettingsUS=s;function n(d){return _5.keyCodeToStr(d)}e.toUserSettingsGeneral=n;function l(d){return v5.strToKeyCode(d)||_5.strToKeyCode(d)}e.fromUserSettings=l;function u(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 v_.keyCodeToStr(d)}e.toElectronAccelerator=u})(DG||(DG={}));var OM=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),LG;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof OG?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Jn.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:OM})})(LG||(LG={}));var OG=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?OM:(this._emitter||(this._emitter=new qt),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},BG;(e=>{async function t(s){let n,l=await Promise.all(s.map(u=>u.then(d=>d,d=>{n||(n=d)})));if(typeof n<"u")throw n;return l}e.settled=t;function r(s){return new Promise(async(n,l)=>{try{await s(n,l)}catch(u){l(u)}})}e.withAsyncBody=r})(BG||(BG={}));var x5=class pi{static fromArray(t){return new pi(r=>{r.emitMany(t)})}static fromPromise(t){return new pi(async r=>{r.emitMany(await t)})}static fromPromises(t){return new pi(async r=>{await Promise.all(t.map(async s=>r.emitOne(await s)))})}static merge(t){return new pi(async r=>{await Promise.all(t.map(async s=>{for await(let n of s)r.emitOne(n)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new qt,queueMicrotask(async()=>{let s={emitOne:n=>this.emitOne(n),emitMany:n=>this.emitMany(n),reject:n=>this.reject(n)};try{await Promise.resolve(t(s)),this.resolve()}catch(n){this.reject(n)}finally{s.emitOne=void 0,s.emitMany=void 0,s.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 Jn.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var r;return(r=this._onReturn)==null||r.call(this),{done:!0,value:void 0}}}}static map(t,r){return new pi(async s=>{for await(let n of t)s.emitOne(r(n))})}map(t){return pi.map(this,t)}static filter(t,r){return new pi(async s=>{for await(let n of t)r(n)&&s.emitOne(n)})}filter(t){return pi.filter(this,t)}static coalesce(t){return pi.filter(t,r=>!!r)}coalesce(){return pi.coalesce(this)}static async toPromise(t){let r=[];for await(let s of t)r.push(s);return r}toPromise(){return pi.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())}};x5.EMPTY=x5.fromArray([]);var{getWindow:PG}=(function(){let e=new Map,t={window:Ho,disposables:new cc};e.set(Ho.vscodeWindowId,t);let r=new qt,s=new qt,n=new qt;function l(u,d){return(typeof u=="number"?e.get(u):void 0)??(d?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:n.event,onDidUnregisterWindow:s.event,registerWindow(u){if(e.has(u.vscodeWindowId))return qi.None;let d=new cc,m={window:u,disposables:d.add(new cc)};return e.set(u.vscodeWindowId,m),d.add(ps(()=>{e.delete(u.vscodeWindowId),s.fire(u)})),d.add(jx(u,zG.BEFORE_UNLOAD,()=>{n.fire(u)})),r.fire(m),d},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(u){return u.vscodeWindowId},hasWindow(u){return e.has(u)},getWindowById:l,getWindow(u){var f;let d=u;if((f=d==null?void 0:d.ownerDocument)!=null&&f.defaultView)return d.ownerDocument.defaultView.window;let m=u;return m!=null&&m.view?m.view.window:Ho},getDocument(u){return PG(u).document}}})(),IG=class{constructor(t,r,s,n){this._node=t,this._type=r,this._handler=s,this._options=n||!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 jx(e,t,r,s){return new IG(e,t,r,s)}var zG={BEFORE_UNLOAD:"beforeunload"},$G=class extends qi{constructor(t,r,s,n,l,u,d,m,f){super(),this._terminal=t,this._characterJoinerService=r,this._charSizeService=s,this._coreBrowserService=n,this._coreService=l,this._decorationService=u,this._optionsService=d,this._themeService=m,this._cursorBlinkStateManager=new ku,this._charAtlasDisposable=this._register(new ku),this._observerDisposable=this._register(new ku),this._model=new _G,this._workCell=new a5,this._workCell2=new a5,this._rectangleRenderer=this._register(new ku),this._glyphRenderer=this._register(new ku),this._onChangeTextureAtlas=this._register(new qt),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new qt),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new qt),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new qt),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new qt),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let v={antialias:!1,depth:!1,preserveDrawingBuffer:f};if(this._gl=this._canvas.getContext("webgl2",v),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new DV(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new CG(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,d,this._themeService)],this.dimensions=MV(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(d.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(jx(this._canvas,"webglcontextlost",p=>{console.log("webglcontextlost event received"),p.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(p)},3e3)})),this._register(jx(this._canvas,"webglcontextrestored",p=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,i5(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=n5(this._canvas,this._coreBrowserService.window,(p,x)=>this._setCanvasDevicePixelDimensions(p,x)),this._register(this._coreBrowserService.onWindowChange(p=>{this._observerDisposable.value=n5(this._canvas,p,(x,b)=>this._setCanvasDevicePixelDimensions(x,b))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(ps(()=>{var p;for(let x of this._renderLayers)x.dispose();(p=this._canvas.parentElement)==null||p.removeChild(this._canvas),i5(this._terminal)}))}get textureAtlas(){var t;return(t=this._charAtlas)==null?void 0:t.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(t,r){var s,n,l,u;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let d of this._renderLayers)d.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,(s=this._rectangleRenderer.value)==null||s.setDimensions(this.dimensions),(n=this._rectangleRenderer.value)==null||n.handleResize(),(l=this._glyphRenderer.value)==null||l.setDimensions(this.dimensions),(u=this._glyphRenderer.value)==null||u.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var t;for(let r of this._renderLayers)r.handleBlur(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.pause(),this._requestRedrawViewport()}handleFocus(){var t;for(let r of this._renderLayers)r.handleFocus(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.resume(),this._requestRedrawViewport()}handleSelectionChanged(t,r,s){for(let n of this._renderLayers)n.handleSelectionChanged(this._terminal,t,r,s);this._model.selection.update(this._core,t,r,s),this._requestRedrawViewport()}handleCursorMove(){var t;for(let r of this._renderLayers)r.handleCursorMove(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new wG(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new mG(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var r;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let t=jM(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==t&&(this._onChangeTextureAtlas.fire(t.pages[0].canvas),this._charAtlasDisposable.value=hM(Jn.forward(t.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Jn.forward(t.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=t,this._charAtlas.warmUp(),(r=this._glyphRenderer.value)==null||r.setAtlas(this._charAtlas)}_clearModel(t){var r;this._model.clear(),t&&((r=this._glyphRenderer.value)==null||r.clear())}clearTextureAtlas(){var t;(t=this._charAtlas)==null||t.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var t;this._clearModel(!0);for(let r of this._renderLayers)r.reset(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(t,r){var s;if(!this._isAttached)if((s=this._core.screenElement)!=null&&s.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let n of this._renderLayers)n.handleGridChanged(this._terminal,t,r);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(t,r),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new oG(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(t,r){let s=this._core,n=this._workCell,l,u,d,m,f,v,p=0,x=!0,b,w,C,k,S,E,N,R,A;t=y5(t,s.rows-1,0),r=y5(r,s.rows-1,0);let D=this._coreService.decPrivateModes.cursorStyle??s.options.cursorStyle??"block",B=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,$=B-s.buffer.ydisp,q=Math.min(this._terminal.buffer.active.cursorX,s.cols-1),Y=-1,V=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let U=!1;for(u=t;u<=r;u++)for(d=u+s.buffer.ydisp,m=s.buffer.lines.get(d),this._model.lineLengths[u]=0,C=B===d,p=0,f=this._characterJoinerService.getJoinedCharacters(d),R=0;R<s.cols;R++){if(l=this._cellColorResolver.result.bg,m.loadCell(R,n),R===0&&(l=this._cellColorResolver.result.bg),v=!1,x=R>=p,b=R,f.length>0&&R===f[0][0]&&x){w=f.shift();let L=this._model.selection.isCellSelected(this._terminal,w[0],d);for(N=w[0]+1;N<w[1];N++)x&&(x=L===this._model.selection.isCellSelected(this._terminal,N,d));x&&(x=!C||q<w[0]||q>=w[1]),x?(v=!0,n=new UG(n,m.translateToString(!0,w[0],w[1]),w[1]-w[0]),b=w[1]-1):p=w[1]}if(k=n.getChars(),S=n.getCode(),N=(u*s.cols+R)*dm,this._cellColorResolver.resolve(n,R,d,this.dimensions.device.cell.width),V&&d===B&&(R===q&&(this._model.cursor={x:q,y:$,width:n.getWidth(),style:this._coreBrowserService.isFocused?D:s.options.cursorInactiveStyle,cursorWidth:s.options.cursorWidth,dpr:this._devicePixelRatio},Y=q+n.getWidth()-1),R>=q&&R<=Y&&(this._coreBrowserService.isFocused&&D==="block"||this._coreBrowserService.isFocused===!1&&s.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),S!==0&&(this._model.lineLengths[u]=R+1),!(this._model.cells[N]===S&&this._model.cells[N+Lf]===this._cellColorResolver.result.bg&&this._model.cells[N+Of]===this._cellColorResolver.result.fg&&this._model.cells[N+f_]===this._cellColorResolver.result.ext)&&(U=!0,k.length>1&&(S|=vG),this._model.cells[N]=S,this._model.cells[N+Lf]=this._cellColorResolver.result.bg,this._model.cells[N+Of]=this._cellColorResolver.result.fg,this._model.cells[N+f_]=this._cellColorResolver.result.ext,E=n.getWidth(),this._glyphRenderer.value.updateCell(R,u,S,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,k,E,l),v)){for(n=this._workCell,R++;R<=b;R++)A=(u*s.cols+R)*dm,this._glyphRenderer.value.updateCell(R,u,0,0,0,0,CV,0,0),this._model.cells[A]=0,this._model.cells[A+Lf]=this._cellColorResolver.result.bg,this._model.cells[A+Of]=this._cellColorResolver.result.fg,this._model.cells[A+f_]=this._cellColorResolver.result.ext;R--}}U&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(t,r){this._canvas.width===t&&this._canvas.height===r||(this._canvas.width=t,this._canvas.height=r,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let t=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:t,end:t})}},UG=class extends ic{constructor(t,r,s){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=r,this._width=s}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(t){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function y5(e,t,r=0){return Math.max(Math.min(e,t),r)}var b5="di$target",w5="di$dependencies",__=new Map;function En(e){if(__.has(e))return __.get(e);let t=function(r,s,n){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");HG(t,r,n)};return t._id=e,__.set(e,t),t}function HG(e,t,r){t[b5]===t?t[w5].push({id:e,index:r}):(t[w5]=[{id:e,index:r}],t[b5]=t)}En("BufferService");En("CoreMouseService");En("CoreService");En("CharsetService");En("InstantiationService");En("LogService");var FG=En("OptionsService");En("OscLinkService");En("UnicodeService");En("DecorationService");var WG={trace:0,debug:1,info:2,warn:3,error:4,off:5},qG="xterm.js: ",S5=class extends qi{constructor(t){super(),this._optionsService=t,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=WG[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(t){for(let r=0;r<t.length;r++)typeof t[r]=="function"&&(t[r]=t[r]())}_log(t,r,s){this._evalLazyOptionalParams(s),t.call(console,(this._optionsService.options.logger?"":qG)+r,...s)}trace(t,...r){var s;this._logLevel<=0&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.trace.bind(this._optionsService.options.logger))??console.log,t,r)}debug(t,...r){var s;this._logLevel<=1&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.debug.bind(this._optionsService.options.logger))??console.log,t,r)}info(t,...r){var s;this._logLevel<=2&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.info.bind(this._optionsService.options.logger))??console.info,t,r)}warn(t,...r){var s;this._logLevel<=3&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.warn.bind(this._optionsService.options.logger))??console.warn,t,r)}error(t,...r){var s;this._logLevel<=4&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.error.bind(this._optionsService.options.logger))??console.error,t,r)}};S5=hV([fV(0,FG)],S5);var VG=class extends qi{constructor(t){if(pM&&SV()<16){let r={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",r))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=t,this._onChangeTextureAtlas=this._register(new qt),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new qt),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new qt),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new qt),this.onContextLoss=this._onContextLoss.event}activate(t){let r=t._core;if(!t.element){this._register(r.onWillOpen(()=>this.activate(t)));return}this._terminal=t;let s=r.coreService,n=r.optionsService,l=r,u=l._renderService,d=l._characterJoinerService,m=l._charSizeService,f=l._coreBrowserService,v=l._decorationService;l._logService;let p=l._themeService;this._renderer=this._register(new $G(t,d,m,f,s,v,n,p,this._preserveDrawingBuffer)),this._register(Jn.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Jn.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Jn.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Jn.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),u.setRenderer(this._renderer),this._register(ps(()=>{if(this._terminal._core._store._isDisposed)return;let x=this._terminal._core._renderService;x.setRenderer(this._terminal._core._createRenderer()),x.handleResize(t.cols,t.rows)}))}get textureAtlas(){var t;return(t=this._renderer)==null?void 0:t.textureAtlas}clearTextureAtlas(){var t;(t=this._renderer)==null||t.clearTextureAtlas()}};/**
|
|
684
|
-
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
685
|
-
* @license MIT
|
|
686
|
-
*
|
|
687
|
-
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
688
|
-
* @license MIT
|
|
689
|
-
*
|
|
690
|
-
* Originally forked from (with the author's permission):
|
|
691
|
-
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
692
|
-
* http://bellard.org/jslinux/
|
|
693
|
-
* Copyright (c) 2011 Fabrice Bellard
|
|
694
|
-
*/var BM=Object.defineProperty,GG=Object.getOwnPropertyDescriptor,YG=(e,t)=>{for(var r in t)BM(e,r,{get:t[r],enumerable:!0})},dr=(e,t,r,s)=>{for(var n=s>1?void 0:s?GG(t,r):t,l=e.length-1,u;l>=0;l--)(u=e[l])&&(n=(s?u(t,r,n):u(n))||n);return s&&n&&BM(t,r,n),n},Ne=(e,t)=>(r,s)=>t(r,s,e),C5="Terminal input",Ax={get:()=>C5,set:e=>C5=e},k5="Too much output to announce, navigate to rows manually to read",Mx={get:()=>k5,set:e=>k5=e};function KG(e){return e.replace(/\r?\n/g,"\r")}function XG(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function ZG(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function QG(e,t,r,s){if(e.stopPropagation(),e.clipboardData){let n=e.clipboardData.getData("text/plain");PM(n,t,r,s)}}function PM(e,t,r,s){e=KG(e),e=XG(e,r.decPrivateModes.bracketedPasteMode&&s.rawOptions.ignoreBracketedPasteMode!==!0),r.triggerDataEvent(e,!0),t.value=""}function IM(e,t,r){let s=r.getBoundingClientRect(),n=e.clientX-s.left-10,l=e.clientY-s.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${n}px`,t.style.top=`${l}px`,t.style.zIndex="1000",t.focus()}function E5(e,t,r,s,n){IM(e,t,r),n&&s.rightClickSelect(e),t.value=s.selectionText,t.select()}function Ga(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function op(e,t=0,r=e.length){let s="";for(let n=t;n<r;++n){let l=e[n];l>65535?(l-=65536,s+=String.fromCharCode((l>>10)+55296)+String.fromCharCode(l%1024+56320)):s+=String.fromCharCode(l)}return s}var JG=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let r=e.length;if(!r)return 0;let s=0,n=0;if(this._interim){let l=e.charCodeAt(n++);56320<=l&&l<=57343?t[s++]=(this._interim-55296)*1024+l-56320+65536:(t[s++]=this._interim,t[s++]=l),this._interim=0}for(let l=n;l<r;++l){let u=e.charCodeAt(l);if(55296<=u&&u<=56319){if(++l>=r)return this._interim=u,s;let d=e.charCodeAt(l);56320<=d&&d<=57343?t[s++]=(u-55296)*1024+d-56320+65536:(t[s++]=u,t[s++]=d);continue}u!==65279&&(t[s++]=u)}return s}},eY=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let r=e.length;if(!r)return 0;let s=0,n,l,u,d,m=0,f=0;if(this.interim[0]){let x=!1,b=this.interim[0];b&=(b&224)===192?31:(b&240)===224?15:7;let w=0,C;for(;(C=this.interim[++w]&63)&&w<4;)b<<=6,b|=C;let k=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,S=k-w;for(;f<S;){if(f>=r)return 0;if(C=e[f++],(C&192)!==128){f--,x=!0;break}else this.interim[w++]=C,b<<=6,b|=C&63}x||(k===2?b<128?f--:t[s++]=b:k===3?b<2048||b>=55296&&b<=57343||b===65279||(t[s++]=b):b<65536||b>1114111||(t[s++]=b)),this.interim.fill(0)}let v=r-4,p=f;for(;p<r;){for(;p<v&&!((n=e[p])&128)&&!((l=e[p+1])&128)&&!((u=e[p+2])&128)&&!((d=e[p+3])&128);)t[s++]=n,t[s++]=l,t[s++]=u,t[s++]=d,p+=4;if(n=e[p++],n<128)t[s++]=n;else if((n&224)===192){if(p>=r)return this.interim[0]=n,s;if(l=e[p++],(l&192)!==128){p--;continue}if(m=(n&31)<<6|l&63,m<128){p--;continue}t[s++]=m}else if((n&240)===224){if(p>=r)return this.interim[0]=n,s;if(l=e[p++],(l&192)!==128){p--;continue}if(p>=r)return this.interim[0]=n,this.interim[1]=l,s;if(u=e[p++],(u&192)!==128){p--;continue}if(m=(n&15)<<12|(l&63)<<6|u&63,m<2048||m>=55296&&m<=57343||m===65279)continue;t[s++]=m}else if((n&248)===240){if(p>=r)return this.interim[0]=n,s;if(l=e[p++],(l&192)!==128){p--;continue}if(p>=r)return this.interim[0]=n,this.interim[1]=l,s;if(u=e[p++],(u&192)!==128){p--;continue}if(p>=r)return this.interim[0]=n,this.interim[1]=l,this.interim[2]=u,s;if(d=e[p++],(d&192)!==128){p--;continue}if(m=(n&7)<<18|(l&63)<<12|(u&63)<<6|d&63,m<65536||m>1114111)continue;t[s++]=m}}return s}},zM="",Xa=" ",Rd=class $M{constructor(){this.fg=0,this.bg=0,this.extended=new hm}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 $M;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}},hm=class UM{constructor(t=0,r=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=r}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 UM(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Si=class HM extends Rd{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new hm,this.combinedData=""}static fromCharData(t){let r=new HM;return r.setFromCharData(t),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Ga(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 r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let n=t[1].charCodeAt(1);56320<=n&&n<=57343?this.content=(s-55296)*1024+n-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},R5="di$target",Tx="di$dependencies",x_=new Map;function tY(e){return e[Tx]||[]}function Zr(e){if(x_.has(e))return x_.get(e);let t=function(r,s,n){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");rY(t,r,n)};return t._id=e,x_.set(e,t),t}function rY(e,t,r){t[R5]===t?t[Tx].push({id:e,index:r}):(t[Tx]=[{id:e,index:r}],t[R5]=t)}var bs=Zr("BufferService"),FM=Zr("CoreMouseService"),ll=Zr("CoreService"),sY=Zr("CharsetService"),Py=Zr("InstantiationService"),WM=Zr("LogService"),ws=Zr("OptionsService"),qM=Zr("OscLinkService"),iY=Zr("UnicodeService"),Nd=Zr("DecorationService"),Dx=class{constructor(e,t,r){this._bufferService=e,this._optionsService=t,this._oscLinkService=r}provideLinks(e,t){var v;let r=this._bufferService.buffer.lines.get(e-1);if(!r){t(void 0);return}let s=[],n=this._optionsService.rawOptions.linkHandler,l=new Si,u=r.getTrimmedLength(),d=-1,m=-1,f=!1;for(let p=0;p<u;p++)if(!(m===-1&&!r.hasContent(p))){if(r.loadCell(p,l),l.hasExtendedAttrs()&&l.extended.urlId)if(m===-1){m=p,d=l.extended.urlId;continue}else f=l.extended.urlId!==d;else m!==-1&&(f=!0);if(f||m!==-1&&p===u-1){let x=(v=this._oscLinkService.getLinkData(d))==null?void 0:v.uri;if(x){let b={start:{x:m+1,y:e},end:{x:p+(!f&&p===u-1?1:0),y:e}},w=!1;if(!(n!=null&&n.allowNonHttpProtocols))try{let C=new URL(x);["http:","https:"].includes(C.protocol)||(w=!0)}catch{w=!0}w||s.push({text:x,range:b,activate:(C,k)=>n?n.activate(C,k,b):nY(C,k),hover:(C,k)=>{var S;return(S=n==null?void 0:n.hover)==null?void 0:S.call(n,C,k,b)},leave:(C,k)=>{var S;return(S=n==null?void 0:n.leave)==null?void 0:S.call(n,C,k,b)}})}f=!1,l.hasExtendedAttrs()&&l.extended.urlId?(m=p,d=l.extended.urlId):(m=-1,d=-1)}}t(s)}};Dx=dr([Ne(0,bs),Ne(1,ws),Ne(2,qM)],Dx);function nY(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
695
|
-
|
|
696
|
-
WARNING: This link could potentially be dangerous`)){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var lp=Zr("CharSizeService"),ha=Zr("CoreBrowserService"),Iy=Zr("MouseService"),fa=Zr("RenderService"),aY=Zr("SelectionService"),VM=Zr("CharacterJoinerService"),kc=Zr("ThemeService"),GM=Zr("LinkProviderService"),oY=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?N5.isErrorNoTelemetry(e)?new N5(e.message+`
|
|
697
|
-
|
|
698
|
-
`+e.stack):new Error(e.message+`
|
|
699
|
-
|
|
700
|
-
`+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)}},lY=new oY;function Pf(e){cY(e)||lY.onUnexpectedError(e)}var Lx="Canceled";function cY(e){return e instanceof uY?!0:e instanceof Error&&e.name===Lx&&e.message===Lx}var uY=class extends Error{constructor(){super(Lx),this.name=this.message}};function dY(e){return new Error(`Illegal argument: ${e}`)}var N5=class Ox extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Ox)return t;let r=new Ox;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Bx=class YM extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,YM.prototype)}};function Hs(e,t=0){return e[e.length-(1+t)]}var hY;(e=>{function t(l){return l<0}e.isLessThan=t;function r(l){return l<=0}e.isLessThanOrEqual=r;function s(l){return l>0}e.isGreaterThan=s;function n(l){return l===0}e.isNeitherLessOrGreaterThan=n,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(hY||(hY={}));function fY(e,t){let r=this,s=!1,n;return function(){return s||(s=!0,t||(n=e.apply(r,arguments))),n}}var KM;(e=>{function t(R){return R&&typeof R=="object"&&typeof R[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function s(){return r}e.empty=s;function*n(R){yield R}e.single=n;function l(R){return t(R)?R:n(R)}e.wrap=l;function u(R){return R||r}e.from=u;function*d(R){for(let A=R.length-1;A>=0;A--)yield R[A]}e.reverse=d;function m(R){return!R||R[Symbol.iterator]().next().done===!0}e.isEmpty=m;function f(R){return R[Symbol.iterator]().next().value}e.first=f;function v(R,A){let D=0;for(let B of R)if(A(B,D++))return!0;return!1}e.some=v;function p(R,A){for(let D of R)if(A(D))return D}e.find=p;function*x(R,A){for(let D of R)A(D)&&(yield D)}e.filter=x;function*b(R,A){let D=0;for(let B of R)yield A(B,D++)}e.map=b;function*w(R,A){let D=0;for(let B of R)yield*A(B,D++)}e.flatMap=w;function*C(...R){for(let A of R)yield*A}e.concat=C;function k(R,A,D){let B=D;for(let $ of R)B=A(B,$);return B}e.reduce=k;function*S(R,A,D=R.length){for(A<0&&(A+=R.length),D<0?D+=R.length:D>R.length&&(D=R.length);A<D;A++)yield R[A]}e.slice=S;function E(R,A=Number.POSITIVE_INFINITY){let D=[];if(A===0)return[D,R];let B=R[Symbol.iterator]();for(let $=0;$<A;$++){let q=B.next();if(q.done)return[D,e.empty()];D.push(q.value)}return[D,{[Symbol.iterator](){return B}}]}e.consume=E;async function N(R){let A=[];for await(let D of R)A.push(D);return Promise.resolve(A)}e.asyncToArray=N})(KM||(KM={}));function Jo(e){if(KM.is(e)){let t=[];for(let r of e)if(r)try{r.dispose()}catch(s){t.push(s)}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 mY(...e){return Kt(()=>Jo(e))}function Kt(e){return{dispose:fY(()=>{e()})}}var XM=class ZM{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{Jo(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?ZM.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)}};XM.DISABLE_DISPOSED_WARNING=!1;var Ja=XM,lt=class{constructor(){this._store=new Ja,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};lt.None=Object.freeze({dispose(){}});var pc=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}},ea=typeof window=="object"?window:globalThis,Px=class Ix{constructor(t){this.element=t,this.next=Ix.Undefined,this.prev=Ix.Undefined}};Px.Undefined=new Px(void 0);var Qt=Px,j5=class{constructor(){this._first=Qt.Undefined,this._last=Qt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Qt.Undefined}clear(){let e=this._first;for(;e!==Qt.Undefined;){let t=e.next;e.prev=Qt.Undefined,e.next=Qt.Undefined,e=t}this._first=Qt.Undefined,this._last=Qt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new Qt(e);if(this._first===Qt.Undefined)this._first=r,this._last=r;else if(t){let n=this._last;this._last=r,r.prev=n,n.next=r}else{let n=this._first;this._first=r,r.next=n,n.prev=r}this._size+=1;let s=!1;return()=>{s||(s=!0,this._remove(r))}}shift(){if(this._first!==Qt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Qt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Qt.Undefined&&e.next!==Qt.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Qt.Undefined&&e.next===Qt.Undefined?(this._first=Qt.Undefined,this._last=Qt.Undefined):e.next===Qt.Undefined?(this._last=this._last.prev,this._last.next=Qt.Undefined):e.prev===Qt.Undefined&&(this._first=this._first.next,this._first.prev=Qt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Qt.Undefined;)yield e.element,e=e.next}},pY=globalThis.performance&&typeof globalThis.performance.now=="function",gY=class QM{static create(t){return new QM(t)}constructor(t){this._now=pY&&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}},os;(e=>{e.None=()=>lt.None;function t(U,L){return p(U,()=>{},0,void 0,!0,void 0,L)}e.defer=t;function r(U){return(L,I=null,F)=>{let M=!1,P;return P=U(O=>{if(!M)return P?P.dispose():M=!0,L.call(I,O)},null,F),M&&P.dispose(),P}}e.once=r;function s(U,L,I){return f((F,M=null,P)=>U(O=>F.call(M,L(O)),null,P),I)}e.map=s;function n(U,L,I){return f((F,M=null,P)=>U(O=>{L(O),F.call(M,O)},null,P),I)}e.forEach=n;function l(U,L,I){return f((F,M=null,P)=>U(O=>L(O)&&F.call(M,O),null,P),I)}e.filter=l;function u(U){return U}e.signal=u;function d(...U){return(L,I=null,F)=>{let M=mY(...U.map(P=>P(O=>L.call(I,O))));return v(M,F)}}e.any=d;function m(U,L,I,F){let M=I;return s(U,P=>(M=L(M,P),M),F)}e.reduce=m;function f(U,L){let I,F={onWillAddFirstListener(){I=U(M.fire,M)},onDidRemoveLastListener(){I==null||I.dispose()}},M=new we(F);return L==null||L.add(M),M.event}function v(U,L){return L instanceof Array?L.push(U):L&&L.add(U),U}function p(U,L,I=100,F=!1,M=!1,P,O){let W,H,T,G=0,X,ee={leakWarningThreshold:P,onWillAddFirstListener(){W=U(de=>{G++,H=L(H,de),F&&!T&&(oe.fire(H),H=void 0),X=()=>{let Z=H;H=void 0,T=void 0,(!F||G>1)&&oe.fire(Z),G=0},typeof I=="number"?(clearTimeout(T),T=setTimeout(X,I)):T===void 0&&(T=0,queueMicrotask(X))})},onWillRemoveListener(){M&&G>0&&(X==null||X())},onDidRemoveLastListener(){X=void 0,W.dispose()}},oe=new we(ee);return O==null||O.add(oe),oe.event}e.debounce=p;function x(U,L=0,I){return e.debounce(U,(F,M)=>F?(F.push(M),F):[M],L,void 0,!0,void 0,I)}e.accumulate=x;function b(U,L=(F,M)=>F===M,I){let F=!0,M;return l(U,P=>{let O=F||!L(P,M);return F=!1,M=P,O},I)}e.latch=b;function w(U,L,I){return[e.filter(U,L,I),e.filter(U,F=>!L(F),I)]}e.split=w;function C(U,L=!1,I=[],F){let M=I.slice(),P=U(H=>{M?M.push(H):W.fire(H)});F&&F.add(P);let O=()=>{M==null||M.forEach(H=>W.fire(H)),M=null},W=new we({onWillAddFirstListener(){P||(P=U(H=>W.fire(H)),F&&F.add(P))},onDidAddFirstListener(){M&&(L?setTimeout(O):O())},onDidRemoveLastListener(){P&&P.dispose(),P=null}});return F&&F.add(W),W.event}e.buffer=C;function k(U,L){return(I,F,M)=>{let P=L(new E);return U(function(O){let W=P.evaluate(O);W!==S&&I.call(F,W)},void 0,M)}}e.chain=k;let S=Symbol("HaltChainable");class E{constructor(){this.steps=[]}map(L){return this.steps.push(L),this}forEach(L){return this.steps.push(I=>(L(I),I)),this}filter(L){return this.steps.push(I=>L(I)?I:S),this}reduce(L,I){let F=I;return this.steps.push(M=>(F=L(F,M),F)),this}latch(L=(I,F)=>I===F){let I=!0,F;return this.steps.push(M=>{let P=I||!L(M,F);return I=!1,F=M,P?M:S}),this}evaluate(L){for(let I of this.steps)if(L=I(L),L===S)break;return L}}function N(U,L,I=F=>F){let F=(...W)=>O.fire(I(...W)),M=()=>U.on(L,F),P=()=>U.removeListener(L,F),O=new we({onWillAddFirstListener:M,onDidRemoveLastListener:P});return O.event}e.fromNodeEventEmitter=N;function R(U,L,I=F=>F){let F=(...W)=>O.fire(I(...W)),M=()=>U.addEventListener(L,F),P=()=>U.removeEventListener(L,F),O=new we({onWillAddFirstListener:M,onDidRemoveLastListener:P});return O.event}e.fromDOMEventEmitter=R;function A(U){return new Promise(L=>r(U)(L))}e.toPromise=A;function D(U){let L=new we;return U.then(I=>{L.fire(I)},()=>{L.fire(void 0)}).finally(()=>{L.dispose()}),L.event}e.fromPromise=D;function B(U,L){return U(I=>L.fire(I))}e.forward=B;function $(U,L,I){return L(I),U(F=>L(F))}e.runAndSubscribe=$;class q{constructor(L,I){this._observable=L,this._counter=0,this._hasChanged=!1;let F={onWillAddFirstListener:()=>{L.addObserver(this)},onDidRemoveLastListener:()=>{L.removeObserver(this)}};this.emitter=new we(F),I&&I.add(this.emitter)}beginUpdate(L){this._counter++}handlePossibleChange(L){}handleChange(L,I){this._hasChanged=!0}endUpdate(L){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Y(U,L){return new q(U,L).emitter.event}e.fromObservable=Y;function V(U){return(L,I,F)=>{let M=0,P=!1,O={beginUpdate(){M++},endUpdate(){M--,M===0&&(U.reportChanges(),P&&(P=!1,L.call(I)))},handlePossibleChange(){},handleChange(){P=!0}};U.addObserver(O),U.reportChanges();let W={dispose(){U.removeObserver(O)}};return F instanceof Ja?F.add(W):Array.isArray(F)&&F.push(W),W}}e.fromObservableLight=V})(os||(os={}));var zx=class $x{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${$x._idPool++}`,$x.all.add(this)}start(t){this._stopWatch=new gY,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}}};zx.all=new Set,zx._idPool=0;var vY=zx,_Y=-1,JM=class eT{constructor(t,r,s=(eT._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=r,this.name=s,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,r){let s=this.threshold;if(s<=0||r<s)return;this._stacks||(this._stacks=new Map);let n=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,n+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=s*.5;let[l,u]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${u}):`;console.warn(d),console.warn(l);let m=new bY(d,l);this._errorHandler(m)}return()=>{let l=this._stacks.get(t.value)||0;this._stacks.set(t.value,l-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[s,n]of this._stacks)(!t||r<n)&&(t=[s,n],r=n);return t}};JM._idPool=1;var xY=JM,yY=class tT{constructor(t){this.value=t}static create(){let t=new Error;return new tT(t.stack??"")}print(){console.warn(this.value.split(`
|
|
701
|
-
`).slice(2).join(`
|
|
702
|
-
`))}},bY=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},wY=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},SY=0,y_=class{constructor(e){this.value=e,this.id=SY++}},CY=2,kY,we=class{constructor(e){var t,r,s,n;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new xY((e==null?void 0:e.onListenerError)??Pf,((r=this._options)==null?void 0:r.leakWarningThreshold)??_Y):void 0,this._perfMon=(s=this._options)!=null&&s._profName?new vY(this._options._profName):void 0,this._deliveryQueue=(n=this._options)==null?void 0:n.deliveryQueue}dispose(){var e,t,r,s;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(r=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t),(s=this._leakageMon)==null||s.dispose())}get event(){return this._event??(this._event=(e,t,r)=>{var u,d,m,f,v;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let p=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(p);let x=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],b=new wY(`${p}. HINT: Stack shows most frequent listener (${x[1]}-times)`,x[0]);return(((u=this._options)==null?void 0:u.onListenerError)||Pf)(b),lt.None}if(this._disposed)return lt.None;t&&(e=e.bind(t));let s=new y_(e),n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=yY.create(),n=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof y_?(this._deliveryQueue??(this._deliveryQueue=new EY),this._listeners=[this._listeners,s]):this._listeners.push(s):((m=(d=this._options)==null?void 0:d.onWillAddFirstListener)==null||m.call(d,this),this._listeners=s,(v=(f=this._options)==null?void 0:f.onDidAddFirstListener)==null||v.call(f,this)),this._size++;let l=Kt(()=>{n==null||n(),this._removeListener(s)});return r instanceof Ja?r.add(l):Array.isArray(r)&&r.push(l),l}),this._event}_removeListener(e){var n,l,u,d;if((l=(n=this._options)==null?void 0:n.onWillRemoveListener)==null||l.call(n,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(d=(u=this._options)==null?void 0:u.onDidRemoveLastListener)==null||d.call(u,this),this._size=0;return}let t=this._listeners,r=t.indexOf(e);if(r===-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--,t[r]=void 0;let s=this._deliveryQueue.current===this;if(this._size*CY<=t.length){let m=0;for(let f=0;f<t.length;f++)t[f]?t[m++]=t[f]:s&&(this._deliveryQueue.end--,m<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=m}}_deliver(e,t){var s;if(!e)return;let r=((s=this._options)==null?void 0:s.onListenerError)||Pf;if(!r){e.value(t);return}try{e.value(t)}catch(n){r(n)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,r,s,n;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(r=this._perfMon)==null||r.stop()),(s=this._perfMon)==null||s.start(this._size),this._listeners)if(this._listeners instanceof y_)this._deliver(this._listeners,e);else{let l=this._deliveryQueue;l.enqueue(this,e,this._listeners.length),this._deliverQueue(l)}(n=this._perfMon)==null||n.stop()}hasListeners(){return this._size>0}},EY=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,r){this.i=0,this.end=r,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Ux=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new we,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new we,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,r){if(this.getZoomLevel(r)===t)return;let s=this.getWindowId(r);this.mapWindowIdToZoomLevel.set(s,t),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,r){this.mapWindowIdToZoomFactor.set(this.getWindowId(r),t)}setFullscreen(t,r){if(this.isFullscreen(r)===t)return;let s=this.getWindowId(r);this.mapWindowIdToFullScreen.set(s,t),this._onDidChangeFullscreen.fire(s)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Ux.INSTANCE=new Ux;var zy=Ux;function RY(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}zy.INSTANCE.onDidChangeZoomLevel;function NY(e){return zy.INSTANCE.getZoomFactor(e)}zy.INSTANCE.onDidChangeFullscreen;var Ec=typeof navigator=="object"?navigator.userAgent:"",Hx=Ec.indexOf("Firefox")>=0,jY=Ec.indexOf("AppleWebKit")>=0,$y=Ec.indexOf("Chrome")>=0,AY=!$y&&Ec.indexOf("Safari")>=0;Ec.indexOf("Electron/")>=0;Ec.indexOf("Android")>=0;var b_=!1;if(typeof ea.matchMedia=="function"){let e=ea.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=ea.matchMedia("(display-mode: fullscreen)");b_=e.matches,RY(ea,e,({matches:r})=>{b_&&t.matches||(b_=r)})}var ac="en",Fx=!1,Wx=!1,If=!1,rT=!1,gf,zf=ac,A5=ac,MY,Bi,Go=globalThis,as,Nk;typeof Go.vscode<"u"&&typeof Go.vscode.process<"u"?as=Go.vscode.process:typeof process<"u"&&typeof((Nk=process==null?void 0:process.versions)==null?void 0:Nk.node)=="string"&&(as=process);var jk,TY=typeof((jk=as==null?void 0:as.versions)==null?void 0:jk.electron)=="string",DY=TY&&(as==null?void 0:as.type)==="renderer",Ak;if(typeof as=="object"){Fx=as.platform==="win32",Wx=as.platform==="darwin",If=as.platform==="linux",If&&as.env.SNAP&&as.env.SNAP_REVISION,as.env.CI||as.env.BUILD_ARTIFACTSTAGINGDIRECTORY,gf=ac,zf=ac;let e=as.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);gf=t.userLocale,A5=t.osLocale,zf=t.resolvedLanguage||ac,MY=(Ak=t.languagePack)==null?void 0:Ak.translationsConfigFile}catch{}rT=!0}else typeof navigator=="object"&&!DY?(Bi=navigator.userAgent,Fx=Bi.indexOf("Windows")>=0,Wx=Bi.indexOf("Macintosh")>=0,(Bi.indexOf("Macintosh")>=0||Bi.indexOf("iPad")>=0||Bi.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,If=Bi.indexOf("Linux")>=0,(Bi==null?void 0:Bi.indexOf("Mobi"))>=0,zf=globalThis._VSCODE_NLS_LANGUAGE||ac,gf=navigator.language.toLowerCase(),A5=gf):console.error("Unable to resolve platform.");var sT=Fx,vn=Wx,LY=If,M5=rT,bn=Bi,$a=zf,OY;(e=>{function t(){return $a}e.value=t;function r(){return $a.length===2?$a==="en":$a.length>=3?$a[0]==="e"&&$a[1]==="n"&&$a[2]==="-":!1}e.isDefaultVariant=r;function s(){return $a==="en"}e.isDefault=s})(OY||(OY={}));var BY=typeof Go.postMessage=="function"&&!Go.importScripts;(()=>{if(BY){let e=[];Go.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let s=0,n=e.length;s<n;s++){let l=e[s];if(l.id===r.data.vscodeScheduleAsyncWork){e.splice(s,1),l.callback();return}}});let t=0;return r=>{let s=++t;e.push({id:s,callback:r}),Go.postMessage({vscodeScheduleAsyncWork:s},"*")}}return e=>setTimeout(e)})();var PY=!!(bn&&bn.indexOf("Chrome")>=0);bn&&bn.indexOf("Firefox")>=0;!PY&&bn&&bn.indexOf("Safari")>=0;bn&&bn.indexOf("Edg/")>=0;bn&&bn.indexOf("Android")>=0;var Ql=typeof navigator=="object"?navigator:{};M5||document.queryCommandSupported&&document.queryCommandSupported("copy")||Ql&&Ql.clipboard&&Ql.clipboard.writeText,M5||Ql&&Ql.clipboard&&Ql.clipboard.readText;var Uy=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}},w_=new Uy,T5=new Uy,D5=new Uy,IY=new Array(230),iT;(e=>{function t(d){return w_.keyCodeToStr(d)}e.toString=t;function r(d){return w_.strToKeyCode(d)}e.fromString=r;function s(d){return T5.keyCodeToStr(d)}e.toUserSettingsUS=s;function n(d){return D5.keyCodeToStr(d)}e.toUserSettingsGeneral=n;function l(d){return T5.strToKeyCode(d)||D5.strToKeyCode(d)}e.fromUserSettings=l;function u(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 w_.keyCodeToStr(d)}e.toElectronAccelerator=u})(iT||(iT={}));var zY=class nT{constructor(t,r,s,n,l){this.ctrlKey=t,this.shiftKey=r,this.altKey=s,this.metaKey=n,this.keyCode=l}equals(t){return t instanceof nT&&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",r=this.shiftKey?"1":"0",s=this.altKey?"1":"0",n=this.metaKey?"1":"0";return`K${t}${r}${s}${n}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new $Y([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},$Y=class{constructor(e){if(e.length===0)throw dY("chords");this.chords=e}getHashCode(){let e="";for(let t=0,r=this.chords.length;t<r;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 UY(e){if(e.charCode){let r=String.fromCharCode(e.charCode).toUpperCase();return iT.fromString(r)}let t=e.keyCode;if(t===3)return 7;if(Hx)switch(t){case 59:return 85;case 60:if(LY)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(vn)return 57;break}else if(jY&&(vn&&t===93||!vn&&t===92))return 57;return IY[t]||0}var HY=vn?256:2048,FY=512,WY=1024,qY=vn?2048:256,L5=class{constructor(e){var r;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=(r=t.getModifierState)==null?void 0:r.call(t,"AltGraph"),this.keyCode=UY(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|=HY),this.altKey&&(t|=FY),this.shiftKey&&(t|=WY),this.metaKey&&(t|=qY),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new zY(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},O5=new WeakMap;function VY(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,r=e.parent.location;if(t.origin!=="null"&&r.origin!=="null"&&t.origin!==r.origin)return null}catch{return null}return e.parent}var GY=class{static getSameOriginWindowChain(e){let t=O5.get(e);if(!t){t=[],O5.set(e,t);let r=e,s;do s=VY(r),s?t.push({window:new WeakRef(r),iframeElement:r.frameElement||null}):t.push({window:new WeakRef(r),iframeElement:null}),r=s;while(r)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let r=0,s=0,n=this.getSameOriginWindowChain(e);for(let l of n){let u=l.window.deref();if(r+=(u==null?void 0:u.scrollY)??0,s+=(u==null?void 0:u.scrollX)??0,u===t||!l.iframeElement)break;let d=l.iframeElement.getBoundingClientRect();r+=d.top,s+=d.left}return{top:r,left:s}}},vf=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 r=GY.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=r.left,this.posy-=r.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},B5=class{constructor(e,t=0,r=0){var n;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=r,this.deltaX=t;let s=!1;if($y){let l=navigator.userAgent.match(/Chrome\/(\d+)/);s=(l?parseInt(l[1]):123)<=122}if(e){let l=e,u=e,d=((n=e.view)==null?void 0:n.devicePixelRatio)||1;if(typeof l.wheelDeltaY<"u")s?this.deltaY=l.wheelDeltaY/(120*d):this.deltaY=l.wheelDeltaY/120;else if(typeof u.VERTICAL_AXIS<"u"&&u.axis===u.VERTICAL_AXIS)this.deltaY=-u.detail/3;else if(e.type==="wheel"){let m=e;m.deltaMode===m.DOM_DELTA_LINE?Hx&&!vn?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof l.wheelDeltaX<"u")AY&&sT?this.deltaX=-(l.wheelDeltaX/120):s?this.deltaX=l.wheelDeltaX/(120*d):this.deltaX=l.wheelDeltaX/120;else if(typeof u.HORIZONTAL_AXIS<"u"&&u.axis===u.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let m=e;m.deltaMode===m.DOM_DELTA_LINE?Hx&&!vn?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(s?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()}},aT=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),YY;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof KY?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:os.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:aT})})(YY||(YY={}));var KY=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?aT:(this._emitter||(this._emitter=new we),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Hy=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 Bx("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Bx("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},XY=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,r=globalThis){if(this.isDisposed)throw new Bx("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let s=r.setInterval(()=>{e()},t);this.disposable=Kt(()=>{r.clearInterval(s),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},ZY;(e=>{async function t(s){let n,l=await Promise.all(s.map(u=>u.then(d=>d,d=>{n||(n=d)})));if(typeof n<"u")throw n;return l}e.settled=t;function r(s){return new Promise(async(n,l)=>{try{await s(n,l)}catch(u){l(u)}})}e.withAsyncBody=r})(ZY||(ZY={}));var P5=class gi{static fromArray(t){return new gi(r=>{r.emitMany(t)})}static fromPromise(t){return new gi(async r=>{r.emitMany(await t)})}static fromPromises(t){return new gi(async r=>{await Promise.all(t.map(async s=>r.emitOne(await s)))})}static merge(t){return new gi(async r=>{await Promise.all(t.map(async s=>{for await(let n of s)r.emitOne(n)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new we,queueMicrotask(async()=>{let s={emitOne:n=>this.emitOne(n),emitMany:n=>this.emitMany(n),reject:n=>this.reject(n)};try{await Promise.resolve(t(s)),this.resolve()}catch(n){this.reject(n)}finally{s.emitOne=void 0,s.emitMany=void 0,s.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 os.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var r;return(r=this._onReturn)==null||r.call(this),{done:!0,value:void 0}}}}static map(t,r){return new gi(async s=>{for await(let n of t)s.emitOne(r(n))})}map(t){return gi.map(this,t)}static filter(t,r){return new gi(async s=>{for await(let n of t)r(n)&&s.emitOne(n)})}filter(t){return gi.filter(this,t)}static coalesce(t){return gi.filter(t,r=>!!r)}coalesce(){return gi.coalesce(this)}static async toPromise(t){let r=[];for await(let s of t)r.push(s);return r}toPromise(){return gi.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())}};P5.EMPTY=P5.fromArray([]);var{getWindow:mn,getWindowId:QY,onDidRegisterWindow:JY}=(function(){let e=new Map,t={window:ea,disposables:new Ja};e.set(ea.vscodeWindowId,t);let r=new we,s=new we,n=new we;function l(u,d){return(typeof u=="number"?e.get(u):void 0)??(d?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:n.event,onDidUnregisterWindow:s.event,registerWindow(u){if(e.has(u.vscodeWindowId))return lt.None;let d=new Ja,m={window:u,disposables:d.add(new Ja)};return e.set(u.vscodeWindowId,m),d.add(Kt(()=>{e.delete(u.vscodeWindowId),s.fire(u)})),d.add(Ke(u,Hr.BEFORE_UNLOAD,()=>{n.fire(u)})),r.fire(m),d},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(u){return u.vscodeWindowId},hasWindow(u){return e.has(u)},getWindowById:l,getWindow(u){var f;let d=u;if((f=d==null?void 0:d.ownerDocument)!=null&&f.defaultView)return d.ownerDocument.defaultView.window;let m=u;return m!=null&&m.view?m.view.window:ea},getDocument(u){return mn(u).document}}})(),eK=class{constructor(e,t,r,s){this._node=e,this._type=t,this._handler=r,this._options=s||!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 Ke(e,t,r,s){return new eK(e,t,r,s)}var I5=function(e,t,r,s){return Ke(e,t,r,s)},Fy,tK=class extends XY{constructor(e){super(),this.defaultTarget=e&&mn(e)}cancelAndSet(e,t,r){return super.cancelAndSet(e,t,r??this.defaultTarget)}},z5=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){Pf(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,r=new Map,s=new Map,n=l=>{r.set(l,!1);let u=e.get(l)??[];for(t.set(l,u),e.set(l,[]),s.set(l,!0);u.length>0;)u.sort(z5.sort),u.shift().execute();s.set(l,!1)};Fy=(l,u,d=0)=>{let m=QY(l),f=new z5(u,d),v=e.get(m);return v||(v=[],e.set(m,v)),v.push(f),r.get(m)||(r.set(m,!0),l.requestAnimationFrame(()=>n(m))),f}})();function rK(e){let t=e.getBoundingClientRect(),r=mn(e);return{left:t.left+r.scrollX,top:t.top+r.scrollY,width:t.width,height:t.height}}var Hr={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"},sK=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=As(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=As(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=As(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=As(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=As(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=As(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=As(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=As(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=As(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=As(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=As(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=As(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=As(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=As(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 As(e){return typeof e=="number"?`${e}px`:e}function Yu(e){return new sK(e)}var oT=class{constructor(){this._hooks=new Ja,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 r=this._onStopCallback;this._onStopCallback=null,e&&r&&r(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,r,s,n){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=s,this._onStopCallback=n;let l=e;try{e.setPointerCapture(t),this._hooks.add(Kt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{l=mn(e)}this._hooks.add(Ke(l,Hr.POINTER_MOVE,u=>{if(u.buttons!==r){this.stopMonitoring(!0);return}u.preventDefault(),this._pointerMoveCallback(u)})),this._hooks.add(Ke(l,Hr.POINTER_UP,u=>this.stopMonitoring(!0)))}};function iK(e,t,r){let s=null,n=null;if(typeof r.value=="function"?(s="value",n=r.value,n.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof r.get=="function"&&(s="get",n=r.get),!n)throw new Error("not supported");let l=`$memoize$${t}`;r[s]=function(...u){return this.hasOwnProperty(l)||Object.defineProperty(this,l,{configurable:!1,enumerable:!1,writable:!1,value:n.apply(this,u)}),this[l]}}var un;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(un||(un={}));var $u=class ms extends lt{constructor(){super(),this.dispatched=!1,this.targets=new j5,this.ignoreTargets=new j5,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(os.runAndSubscribe(JY,({window:t,disposables:r})=>{r.add(Ke(t.document,"touchstart",s=>this.onTouchStart(s),{passive:!1})),r.add(Ke(t.document,"touchend",s=>this.onTouchEnd(t,s))),r.add(Ke(t.document,"touchmove",s=>this.onTouchMove(s),{passive:!1}))},{window:ea,disposables:this._store}))}static addTarget(t){if(!ms.isTouchDevice())return lt.None;ms.INSTANCE||(ms.INSTANCE=new ms);let r=ms.INSTANCE.targets.push(t);return Kt(r)}static ignoreTarget(t){if(!ms.isTouchDevice())return lt.None;ms.INSTANCE||(ms.INSTANCE=new ms);let r=ms.INSTANCE.ignoreTargets.push(t);return Kt(r)}static isTouchDevice(){return"ontouchstart"in ea||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let r=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let s=0,n=t.targetTouches.length;s<n;s++){let l=t.targetTouches.item(s);this.activeTouches[l.identifier]={id:l.identifier,initialTarget:l.target,initialTimeStamp:r,initialPageX:l.pageX,initialPageY:l.pageY,rollingTimestamps:[r],rollingPageX:[l.pageX],rollingPageY:[l.pageY]};let u=this.newGestureEvent(un.Start,l.target);u.pageX=l.pageX,u.pageY=l.pageY,this.dispatchEvent(u)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,r){let s=Date.now(),n=Object.keys(this.activeTouches).length;for(let l=0,u=r.changedTouches.length;l<u;l++){let d=r.changedTouches.item(l);if(!this.activeTouches.hasOwnProperty(String(d.identifier))){console.warn("move of an UNKNOWN touch",d);continue}let m=this.activeTouches[d.identifier],f=Date.now()-m.initialTimeStamp;if(f<ms.HOLD_DELAY&&Math.abs(m.initialPageX-Hs(m.rollingPageX))<30&&Math.abs(m.initialPageY-Hs(m.rollingPageY))<30){let v=this.newGestureEvent(un.Tap,m.initialTarget);v.pageX=Hs(m.rollingPageX),v.pageY=Hs(m.rollingPageY),this.dispatchEvent(v)}else if(f>=ms.HOLD_DELAY&&Math.abs(m.initialPageX-Hs(m.rollingPageX))<30&&Math.abs(m.initialPageY-Hs(m.rollingPageY))<30){let v=this.newGestureEvent(un.Contextmenu,m.initialTarget);v.pageX=Hs(m.rollingPageX),v.pageY=Hs(m.rollingPageY),this.dispatchEvent(v)}else if(n===1){let v=Hs(m.rollingPageX),p=Hs(m.rollingPageY),x=Hs(m.rollingTimestamps)-m.rollingTimestamps[0],b=v-m.rollingPageX[0],w=p-m.rollingPageY[0],C=[...this.targets].filter(k=>m.initialTarget instanceof Node&&k.contains(m.initialTarget));this.inertia(t,C,s,Math.abs(b)/x,b>0?1:-1,v,Math.abs(w)/x,w>0?1:-1,p)}this.dispatchEvent(this.newGestureEvent(un.End,m.initialTarget)),delete this.activeTouches[d.identifier]}this.dispatched&&(r.preventDefault(),r.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,r){let s=document.createEvent("CustomEvent");return s.initEvent(t,!1,!0),s.initialTarget=r,s.tapCount=0,s}dispatchEvent(t){if(t.type===un.Tap){let r=new Date().getTime(),s=0;r-this._lastSetTapCountTime>ms.CLEAR_TAP_COUNT_TIME?s=1:s=2,this._lastSetTapCountTime=r,t.tapCount=s}else(t.type===un.Change||t.type===un.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let s of this.ignoreTargets)if(s.contains(t.initialTarget))return;let r=[];for(let s of this.targets)if(s.contains(t.initialTarget)){let n=0,l=t.initialTarget;for(;l&&l!==s;)n++,l=l.parentElement;r.push([n,s])}r.sort((s,n)=>s[0]-n[0]);for(let[s,n]of r)n.dispatchEvent(t),this.dispatched=!0}}inertia(t,r,s,n,l,u,d,m,f){this.handle=Fy(t,()=>{let v=Date.now(),p=v-s,x=0,b=0,w=!0;n+=ms.SCROLL_FRICTION*p,d+=ms.SCROLL_FRICTION*p,n>0&&(w=!1,x=l*n*p),d>0&&(w=!1,b=m*d*p);let C=this.newGestureEvent(un.Change);C.translationX=x,C.translationY=b,r.forEach(k=>k.dispatchEvent(C)),w||this.inertia(t,r,v,n,l,u+x,d,m,f+b)})}onTouchMove(t){let r=Date.now();for(let s=0,n=t.changedTouches.length;s<n;s++){let l=t.changedTouches.item(s);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("end of an UNKNOWN touch",l);continue}let u=this.activeTouches[l.identifier],d=this.newGestureEvent(un.Change,u.initialTarget);d.translationX=l.pageX-Hs(u.rollingPageX),d.translationY=l.pageY-Hs(u.rollingPageY),d.pageX=l.pageX,d.pageY=l.pageY,this.dispatchEvent(d),u.rollingPageX.length>3&&(u.rollingPageX.shift(),u.rollingPageY.shift(),u.rollingTimestamps.shift()),u.rollingPageX.push(l.pageX),u.rollingPageY.push(l.pageY),u.rollingTimestamps.push(r)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};$u.SCROLL_FRICTION=-.005,$u.HOLD_DELAY=700,$u.CLEAR_TAP_COUNT_TIME=400,dr([iK],$u,"isTouchDevice",1);var nK=$u,Wy=class extends lt{onclick(e,t){this._register(Ke(e,Hr.CLICK,r=>t(new vf(mn(e),r))))}onmousedown(e,t){this._register(Ke(e,Hr.MOUSE_DOWN,r=>t(new vf(mn(e),r))))}onmouseover(e,t){this._register(Ke(e,Hr.MOUSE_OVER,r=>t(new vf(mn(e),r))))}onmouseleave(e,t){this._register(Ke(e,Hr.MOUSE_LEAVE,r=>t(new vf(mn(e),r))))}onkeydown(e,t){this._register(Ke(e,Hr.KEY_DOWN,r=>t(new L5(r))))}onkeyup(e,t){this._register(Ke(e,Hr.KEY_UP,r=>t(new L5(r))))}oninput(e,t){this._register(Ke(e,Hr.INPUT,t))}onblur(e,t){this._register(Ke(e,Hr.BLUR,t))}onfocus(e,t){this._register(Ke(e,Hr.FOCUS,t))}onchange(e,t){this._register(Ke(e,Hr.CHANGE,t))}ignoreGesture(e){return nK.ignoreTarget(e)}},$5=11,aK=class extends Wy{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=$5+"px",this.domNode.style.height=$5+"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 oT),this._register(I5(this.bgDomNode,Hr.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(I5(this.domNode,Hr.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new tK),this._pointerdownScheduleRepeatTimer=this._register(new Hy)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,mn(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},oK=class qx{constructor(t,r,s,n,l,u,d){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(r=r|0,s=s|0,n=n|0,l=l|0,u=u|0,d=d|0),this.rawScrollLeft=n,this.rawScrollTop=d,r<0&&(r=0),n+r>s&&(n=s-r),n<0&&(n=0),l<0&&(l=0),d+l>u&&(d=u-l),d<0&&(d=0),this.width=r,this.scrollWidth=s,this.scrollLeft=n,this.height=l,this.scrollHeight=u,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,r){return new qx(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,r?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,r?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new qx(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,r){let s=this.width!==t.width,n=this.scrollWidth!==t.scrollWidth,l=this.scrollLeft!==t.scrollLeft,u=this.height!==t.height,d=this.scrollHeight!==t.scrollHeight,m=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:r,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:s,scrollWidthChanged:n,scrollLeftChanged:l,heightChanged:u,scrollHeightChanged:d,scrollTopChanged:m}}},lK=class extends lt{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new we),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new oK(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 s;let r=this._state.withScrollDimensions(e,t);this._setState(r,!!this._smoothScrolling),(s=this._smoothScrolling)==null||s.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 r=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===r.scrollLeft&&this._smoothScrolling.to.scrollTop===r.scrollTop)return;let s;t?s=new H5(this._smoothScrolling.from,r,this._smoothScrolling.startTime,this._smoothScrolling.duration):s=this._smoothScrolling.combine(this._state,r,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=s}else{let r=this._state.withScrollPosition(e);this._smoothScrolling=H5.start(this._state,r,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 r=this._state;r.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(r,t)))}},U5=class{constructor(e,t,r){this.scrollLeft=e,this.scrollTop=t,this.isDone=r}};function S_(e,t){let r=t-e;return function(s){return e+r*dK(s)}}function cK(e,t,r){return function(s){return s<r?e(s/r):t((s-r)/(1-r))}}var H5=class Vx{constructor(t,r,s,n){this.from=t,this.to=r,this.duration=n,this.startTime=s,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,r,s){if(Math.abs(t-r)>2.5*s){let n,l;return t<r?(n=t+.75*s,l=r-.75*s):(n=t-.75*s,l=r+.75*s),cK(S_(t,n),S_(l,r),.33)}return S_(t,r)}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 r=(t-this.startTime)/this.duration;if(r<1){let s=this.scrollLeft(r),n=this.scrollTop(r);return new U5(s,n,!1)}return new U5(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,r,s){return Vx.start(t,r,s)}static start(t,r,s){s=s+10;let n=Date.now()-10;return new Vx(t,r,n,s)}};function uK(e){return Math.pow(e,3)}function dK(e){return 1-uK(1-e)}var hK=class extends lt{constructor(e,t,r){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=r,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Hy)}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":"")))}},fK=140,lT=class extends Wy{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 hK(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new oT),this._shouldRender=!0,this.domNode=Yu(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(Ke(this.domNode.domNode,Hr.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new aK(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,r,s){this.slider=Yu(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof r=="number"&&this.slider.setWidth(r),typeof s=="number"&&this.slider.setHeight(s),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Ke(this.slider.domNode,Hr.POINTER_DOWN,n=>{n.button===0&&(n.preventDefault(),this._sliderPointerDown(n))})),this.onclick(this.slider.domNode,n=>{n.leftButton&&n.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,r=t+this._scrollbarState.getSliderPosition(),s=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),n=this._sliderPointerPosition(e);r<=n&&n<=s?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,r;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,r=e.offsetY;else{let n=rK(this.domNode.domNode);t=e.pageX-n.left,r=e.pageY-n.top}let s=this._pointerDownRelativePosition(t,r);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(s):this._scrollbarState.getDesiredScrollPositionFromOffset(s)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),r=this._sliderOrthogonalPointerPosition(e),s=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{let l=this._sliderOrthogonalPointerPosition(n),u=Math.abs(l-r);if(sT&&u>fK){this._setDesiredScrollPositionNow(s.getScrollPosition());return}let d=this._sliderPointerPosition(n)-t;this._setDesiredScrollPositionNow(s.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()}},cT=class Gx{constructor(t,r,s,n,l,u){this._scrollbarSize=Math.round(r),this._oppositeScrollbarSize=Math.round(s),this._arrowSize=Math.round(t),this._visibleSize=n,this._scrollSize=l,this._scrollPosition=u,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Gx(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let r=Math.round(t);return this._visibleSize!==r?(this._visibleSize=r,this._refreshComputedValues(),!0):!1}setScrollSize(t){let r=Math.round(t);return this._scrollSize!==r?(this._scrollSize=r,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let r=Math.round(t);return this._scrollPosition!==r?(this._scrollPosition=r,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,r,s,n,l){let u=Math.max(0,s-t),d=Math.max(0,u-2*r),m=n>0&&n>s;if(!m)return{computedAvailableSize:Math.round(u),computedIsNeeded:m,computedSliderSize:Math.round(d),computedSliderRatio:0,computedSliderPosition:0};let f=Math.round(Math.max(20,Math.floor(s*d/n))),v=(d-f)/(n-s),p=l*v;return{computedAvailableSize:Math.round(u),computedIsNeeded:m,computedSliderSize:Math.round(f),computedSliderRatio:v,computedSliderPosition:Math.round(p)}}_refreshComputedValues(){let t=Gx._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 r=t-this._arrowSize-this._computedSliderSize/2;return Math.round(r/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let r=t-this._arrowSize,s=this._scrollPosition;return r<this._computedSliderPosition?s-=this._visibleSize:s+=this._visibleSize,s}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let r=this._computedSliderPosition+t;return Math.round(r/this._computedSliderRatio)}},mK=class extends lT{constructor(e,t,r){let s=e.getScrollDimensions(),n=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new cT(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,s.width,s.scrollWidth,n.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}},pK=class extends lT{constructor(e,t,r){let s=e.getScrollDimensions(),n=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new cT(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,s.height,s.scrollHeight,n.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}},gK=500,F5=50,vK=class{constructor(e,t,r){this.timestamp=e,this.deltaX=t,this.deltaY=r,this.score=0}},Yx=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,r=0,s=1,n=this._rear;do{let l=n===this._front?t:Math.pow(2,-s);if(t-=l,r+=this._memory[n].score*l,n===this._front)break;n=(this._capacity+n-1)%this._capacity,s++}while(!0);return r<=.5}acceptStandardWheelEvent(t){if($y){let r=mn(t.browserEvent),s=NY(r);this.accept(Date.now(),t.deltaX*s,t.deltaY*s)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,r,s){let n=null,l=new vK(t,r,s);this._front===-1&&this._rear===-1?(this._memory[0]=l,this._front=0,this._rear=0):(n=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]=l),l.score=this._computeScore(l,n)}_computeScore(t,r){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let s=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(s+=.25),r){let n=Math.abs(t.deltaX),l=Math.abs(t.deltaY),u=Math.abs(r.deltaX),d=Math.abs(r.deltaY),m=Math.max(Math.min(n,u),1),f=Math.max(Math.min(l,d),1),v=Math.max(n,u),p=Math.max(l,d);v%m===0&&p%f===0&&(s-=.5)}return Math.min(Math.max(s,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Yx.INSTANCE=new Yx;var _K=Yx,xK=class extends Wy{constructor(e,t,r){super(),this._onScroll=this._register(new we),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new we),this.onWillScroll=this._onWillScroll.event,this._options=bK(t),this._scrollable=r,this._register(this._scrollable.onScroll(n=>{this._onWillScroll.fire(n),this._onDidScroll(n),this._onScroll.fire(n)}));let s={onMouseWheel:n=>this._onMouseWheel(n),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new pK(this._scrollable,this._options,s)),this._horizontalScrollbar=this._register(new mK(this._scrollable,this._options,s)),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=Yu(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Yu(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Yu(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,n=>this._onMouseOver(n)),this.onmouseleave(this._listenOnDomNode,n=>this._onMouseLeave(n)),this._hideTimeout=this._register(new Hy),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Jo(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,vn&&(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 B5(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Jo(this._mouseWheelToDispose),e)){let t=r=>{this._onMouseWheel(new B5(r))};this._mouseWheelToDispose.push(Ke(this._listenOnDomNode,Hr.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var n;if((n=e.browserEvent)!=null&&n.defaultPrevented)return;let t=_K.INSTANCE;t.acceptStandardWheelEvent(e);let r=!1;if(e.deltaY||e.deltaX){let l=e.deltaY*this._options.mouseWheelScrollSensitivity,u=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&u+l===0?u=l=0:Math.abs(l)>=Math.abs(u)?u=0:l=0),this._options.flipAxes&&([l,u]=[u,l]);let d=!vn&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||d)&&!u&&(u=l,l=0),e.browserEvent&&e.browserEvent.altKey&&(u=u*this._options.fastScrollSensitivity,l=l*this._options.fastScrollSensitivity);let m=this._scrollable.getFutureScrollPosition(),f={};if(l){let v=F5*l,p=m.scrollTop-(v<0?Math.floor(v):Math.ceil(v));this._verticalScrollbar.writeScrollPosition(f,p)}if(u){let v=F5*u,p=m.scrollLeft-(v<0?Math.floor(v):Math.ceil(v));this._horizontalScrollbar.writeScrollPosition(f,p)}f=this._scrollable.validateScrollPosition(f),(m.scrollLeft!==f.scrollLeft||m.scrollTop!==f.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(f):this._scrollable.setScrollPositionNow(f),r=!0)}let s=r;!s&&this._options.alwaysConsumeMouseWheel&&(s=!0),!s&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(s=!0),s&&(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,r=e.scrollLeft>0,s=r?" left":"",n=t?" top":"",l=r||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${s}`),this._topShadowDomNode.setClassName(`shadow${n}`),this._topLeftShadowDomNode.setClassName(`shadow${l}${n}${s}`)}}_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(),gK)}},yK=class extends xK{constructor(e,t,r){super(e,t,r)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function bK(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,vn&&(t.className+=" mac"),t}var Kx=class extends lt{constructor(e,t,r,s,n,l,u,d){super(),this._bufferService=r,this._optionsService=u,this._renderService=d,this._onRequestScrollLines=this._register(new we),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let m=this._register(new lK({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:f=>Fy(s.window,f)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{m.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new yK(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},m)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(n.onProtocolChange(f=>{this._scrollableElement.updateOptions({handleMouseWheel:!(f&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(os.runAndSubscribe(l.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=l.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Kt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=s.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Kt(()=>this._styleElement.remove())),this._register(os.runAndSubscribe(l.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${l.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${l.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${l.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
703
|
-
`)})),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(f=>this._handleScroll(f)))}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),r=t-this._bufferService.buffer.ydisp;r!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(r)),this._isHandlingScroll=!1}};Kx=dr([Ne(2,bs),Ne(3,ha),Ne(4,FM),Ne(5,kc),Ne(6,ws),Ne(7,fa)],Kx);var Xx=class extends lt{constructor(e,t,r,s,n){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=r,this._decorationService=s,this._renderService=n,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(l=>this._removeDecoration(l))),this._register(Kt(()=>{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 s;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((s=e==null?void 0:e.options)==null?void 0:s.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 r=e.options.x??0;return r&&r>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 r=this._decorationElements.get(e);r||(r=this._createElement(e),e.element=r,this._decorationElements.set(e,r),this._container.appendChild(r),e.onDispose(()=>{this._decorationElements.delete(e),r.remove()})),r.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(r.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,r.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,r.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,r.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(r)}}_refreshXPosition(e,t=e.element){if(!t)return;let r=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=r?`${r*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=r?`${r*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()}};Xx=dr([Ne(1,bs),Ne(2,ha),Ne(3,Nd),Ne(4,fa)],Xx);var wK=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,r){return t>=e.startBufferLine-this._linePadding[r||"full"]&&t<=e.endBufferLine+this._linePadding[r||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},an={full:0,left:0,center:0,right:0},Ua={full:0,left:0,center:0,right:0},ju={full:0,left:0,center:0,right:0},fm=class extends lt{constructor(e,t,r,s,n,l,u,d){var f;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=r,this._decorationService=s,this._renderService=n,this._optionsService=l,this._themeService=u,this._coreBrowserService=d,this._colorZoneStore=new wK,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(),(f=this._viewportElement.parentElement)==null||f.insertBefore(this._canvas,this._viewportElement),this._register(Kt(()=>{var v;return(v=this._canvas)==null?void 0:v.remove()}));let m=this._canvas.getContext("2d");if(m)this._ctx=m;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);Ua.full=this._canvas.width,Ua.left=e,Ua.center=t,Ua.right=e,this._refreshDrawHeightConstants(),ju.full=1,ju.left=1,ju.center=1+Ua.left,ju.right=1+Ua.left+Ua.center}_refreshDrawHeightConstants(){an.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);an.left=t,an.center=t,an.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*an.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*an.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*an.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*an.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(ju[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-an[e.position||"full"]/2),Ua[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+an[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}))}};fm=dr([Ne(2,bs),Ne(3,Nd),Ne(4,fa),Ne(5,ws),Ne(6,kc),Ne(7,ha)],fm);var ve;(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=`
|
|
704
|
-
`,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=""))(ve||(ve={}));var $f;(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=""))($f||($f={}));var uT;(e=>e.ST=`${ve.ESC}\\`)(uT||(uT={}));var Zx=class{constructor(e,t,r,s,n,l){this._textarea=e,this._compositionView=t,this._bufferService=r,this._optionsService=s,this._coreService=n,this._renderService=l,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 r;t.start+=this._dataAlreadySent.length,this._isComposing?r=this._textarea.value.substring(t.start,this._compositionPosition.start):r=this._textarea.value.substring(t.start),r.length>0&&this._coreService.triggerDataEvent(r,!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,r=t.replace(e,"");this._dataAlreadySent=r,t.length>e.length?this._coreService.triggerDataEvent(r,!0):t.length<e.length?this._coreService.triggerDataEvent(`${ve.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),r=this._renderService.dimensions.css.cell.height,s=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,n=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=n+"px",this._compositionView.style.top=s+"px",this._compositionView.style.height=r+"px",this._compositionView.style.lineHeight=r+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let l=this._compositionView.getBoundingClientRect();this._textarea.style.left=n+"px",this._textarea.style.top=s+"px",this._textarea.style.width=Math.max(l.width,1)+"px",this._textarea.style.height=Math.max(l.height,1)+"px",this._textarea.style.lineHeight=l.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Zx=dr([Ne(2,bs),Ne(3,ws),Ne(4,ll),Ne(5,fa)],Zx);var Vr=0,Gr=0,Yr=0,lr=0,W5={css:"#00000000",rgba:0},kr;(e=>{function t(n,l,u,d){return d!==void 0?`#${Po(n)}${Po(l)}${Po(u)}${Po(d)}`:`#${Po(n)}${Po(l)}${Po(u)}`}e.toCss=t;function r(n,l,u,d=255){return(n<<24|l<<16|u<<8|d)>>>0}e.toRgba=r;function s(n,l,u,d){return{css:e.toCss(n,l,u,d),rgba:e.toRgba(n,l,u,d)}}e.toColor=s})(kr||(kr={}));var Wt;(e=>{function t(m,f){if(lr=(f.rgba&255)/255,lr===1)return{css:f.css,rgba:f.rgba};let v=f.rgba>>24&255,p=f.rgba>>16&255,x=f.rgba>>8&255,b=m.rgba>>24&255,w=m.rgba>>16&255,C=m.rgba>>8&255;Vr=b+Math.round((v-b)*lr),Gr=w+Math.round((p-w)*lr),Yr=C+Math.round((x-C)*lr);let k=kr.toCss(Vr,Gr,Yr),S=kr.toRgba(Vr,Gr,Yr);return{css:k,rgba:S}}e.blend=t;function r(m){return(m.rgba&255)===255}e.isOpaque=r;function s(m,f,v){let p=Uf.ensureContrastRatio(m.rgba,f.rgba,v);if(p)return kr.toColor(p>>24&255,p>>16&255,p>>8&255)}e.ensureContrastRatio=s;function n(m){let f=(m.rgba|255)>>>0;return[Vr,Gr,Yr]=Uf.toChannels(f),{css:kr.toCss(Vr,Gr,Yr),rgba:f}}e.opaque=n;function l(m,f){return lr=Math.round(f*255),[Vr,Gr,Yr]=Uf.toChannels(m.rgba),{css:kr.toCss(Vr,Gr,Yr,lr),rgba:kr.toRgba(Vr,Gr,Yr,lr)}}e.opacity=l;function u(m,f){return lr=m.rgba&255,l(m,lr*f/255)}e.multiplyOpacity=u;function d(m){return[m.rgba>>24&255,m.rgba>>16&255,m.rgba>>8&255]}e.toColorRGB=d})(Wt||(Wt={}));var Jt;(e=>{let t,r;try{let n=document.createElement("canvas");n.width=1,n.height=1;let l=n.getContext("2d",{willReadFrequently:!0});l&&(t=l,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function s(n){if(n.match(/#[\da-f]{3,8}/i))switch(n.length){case 4:return Vr=parseInt(n.slice(1,2).repeat(2),16),Gr=parseInt(n.slice(2,3).repeat(2),16),Yr=parseInt(n.slice(3,4).repeat(2),16),kr.toColor(Vr,Gr,Yr);case 5:return Vr=parseInt(n.slice(1,2).repeat(2),16),Gr=parseInt(n.slice(2,3).repeat(2),16),Yr=parseInt(n.slice(3,4).repeat(2),16),lr=parseInt(n.slice(4,5).repeat(2),16),kr.toColor(Vr,Gr,Yr,lr);case 7:return{css:n,rgba:(parseInt(n.slice(1),16)<<8|255)>>>0};case 9:return{css:n,rgba:parseInt(n.slice(1),16)>>>0}}let l=n.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(l)return Vr=parseInt(l[1]),Gr=parseInt(l[2]),Yr=parseInt(l[3]),lr=Math.round((l[5]===void 0?1:parseFloat(l[5]))*255),kr.toColor(Vr,Gr,Yr,lr);if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=n,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Vr,Gr,Yr,lr]=t.getImageData(0,0,1,1).data,lr!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:kr.toRgba(Vr,Gr,Yr,lr),css:n}}e.toColor=s})(Jt||(Jt={}));var xs;(e=>{function t(s){return r(s>>16&255,s>>8&255,s&255)}e.relativeLuminance=t;function r(s,n,l){let u=s/255,d=n/255,m=l/255,f=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),v=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),p=m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4);return f*.2126+v*.7152+p*.0722}e.relativeLuminance2=r})(xs||(xs={}));var Uf;(e=>{function t(u,d){if(lr=(d&255)/255,lr===1)return d;let m=d>>24&255,f=d>>16&255,v=d>>8&255,p=u>>24&255,x=u>>16&255,b=u>>8&255;return Vr=p+Math.round((m-p)*lr),Gr=x+Math.round((f-x)*lr),Yr=b+Math.round((v-b)*lr),kr.toRgba(Vr,Gr,Yr)}e.blend=t;function r(u,d,m){let f=xs.relativeLuminance(u>>8),v=xs.relativeLuminance(d>>8);if(Xn(f,v)<m){if(v<f){let b=s(u,d,m),w=Xn(f,xs.relativeLuminance(b>>8));if(w<m){let C=n(u,d,m),k=Xn(f,xs.relativeLuminance(C>>8));return w>k?b:C}return b}let p=n(u,d,m),x=Xn(f,xs.relativeLuminance(p>>8));if(x<m){let b=s(u,d,m),w=Xn(f,xs.relativeLuminance(b>>8));return x>w?p:b}return p}}e.ensureContrastRatio=r;function s(u,d,m){let f=u>>24&255,v=u>>16&255,p=u>>8&255,x=d>>24&255,b=d>>16&255,w=d>>8&255,C=Xn(xs.relativeLuminance2(x,b,w),xs.relativeLuminance2(f,v,p));for(;C<m&&(x>0||b>0||w>0);)x-=Math.max(0,Math.ceil(x*.1)),b-=Math.max(0,Math.ceil(b*.1)),w-=Math.max(0,Math.ceil(w*.1)),C=Xn(xs.relativeLuminance2(x,b,w),xs.relativeLuminance2(f,v,p));return(x<<24|b<<16|w<<8|255)>>>0}e.reduceLuminance=s;function n(u,d,m){let f=u>>24&255,v=u>>16&255,p=u>>8&255,x=d>>24&255,b=d>>16&255,w=d>>8&255,C=Xn(xs.relativeLuminance2(x,b,w),xs.relativeLuminance2(f,v,p));for(;C<m&&(x<255||b<255||w<255);)x=Math.min(255,x+Math.ceil((255-x)*.1)),b=Math.min(255,b+Math.ceil((255-b)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),C=Xn(xs.relativeLuminance2(x,b,w),xs.relativeLuminance2(f,v,p));return(x<<24|b<<16|w<<8|255)>>>0}e.increaseLuminance=n;function l(u){return[u>>24&255,u>>16&255,u>>8&255,u&255]}e.toChannels=l})(Uf||(Uf={}));function Po(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Xn(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var SK=class extends Rd{constructor(e,t,r){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=r}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()]}},mm=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Si}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 r=[],s=t.translateToString(!0),n=0,l=0,u=0,d=t.getFg(0),m=t.getBg(0);for(let f=0;f<t.getTrimmedLength();f++)if(t.loadCell(f,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==d||this._workCell.bg!==m){if(f-n>1){let v=this._getJoinedRanges(s,u,l,t,n);for(let p=0;p<v.length;p++)r.push(v[p])}n=f,u=l,d=this._workCell.fg,m=this._workCell.bg}l+=this._workCell.getChars().length||Xa.length}if(this._bufferService.cols-n>1){let f=this._getJoinedRanges(s,u,l,t,n);for(let v=0;v<f.length;v++)r.push(f[v])}return r}_getJoinedRanges(e,t,r,s,n){let l=e.substring(t,r),u=[];try{u=this._characterJoiners[0].handler(l)}catch(d){console.error(d)}for(let d=1;d<this._characterJoiners.length;d++)try{let m=this._characterJoiners[d].handler(l);for(let f=0;f<m.length;f++)mm._mergeRanges(u,m[f])}catch(m){console.error(m)}return this._stringRangesToCellRanges(u,s,n),u}_stringRangesToCellRanges(e,t,r){let s=0,n=!1,l=0,u=e[s];if(u){for(let d=r;d<this._bufferService.cols;d++){let m=t.getWidth(d),f=t.getString(d).length||Xa.length;if(m!==0){if(!n&&u[0]<=l&&(u[0]=d,n=!0),u[1]<=l){if(u[1]=d,u=e[++s],!u)break;u[0]<=l?(u[0]=d,n=!0):n=!1}l+=f}}u&&(u[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let r=!1;for(let s=0;s<e.length;s++){let n=e[s];if(r){if(t[1]<=n[0])return e[s-1][1]=t[1],e;if(t[1]<=n[1])return e[s-1][1]=Math.max(t[1],n[1]),e.splice(s,1),e;e.splice(s,1),s--}else{if(t[1]<=n[0])return e.splice(s,0,t),e;if(t[1]<=n[1])return n[0]=Math.min(t[0],n[0]),e;t[0]<n[1]&&(n[0]=Math.min(t[0],n[0]),r=!0);continue}}return r?e[e.length-1][1]=t[1]:e.push(t),e}};mm=dr([Ne(0,bs)],mm);function CK(e){return 57508<=e&&e<=57558}function kK(e){return 9472<=e&&e<=9631}function EK(e){return CK(e)||kK(e)}function RK(){return{css:{canvas:_f(),cell:_f()},device:{canvas:_f(),cell:_f(),char:{width:0,height:0,left:0,top:0}}}}function _f(){return{width:0,height:0}}var Qx=class{constructor(e,t,r,s,n,l,u){this._document=e,this._characterJoinerService=t,this._optionsService=r,this._coreBrowserService=s,this._coreService=n,this._decorationService=l,this._themeService=u,this._workCell=new Si,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,r){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=r}createRow(e,t,r,s,n,l,u,d,m,f,v){let p=[],x=this._characterJoinerService.getJoinedCharacters(t),b=this._themeService.colors,w=e.getNoBgTrimmedLength();r&&w<l+1&&(w=l+1);let C,k=0,S="",E=0,N=0,R=0,A=0,D=!1,B=0,$=!1,q=0,Y=0,V=[],U=f!==-1&&v!==-1;for(let L=0;L<w;L++){e.loadCell(L,this._workCell);let I=this._workCell.getWidth();if(I===0)continue;let F=!1,M=L>=Y,P=L,O=this._workCell;if(x.length>0&&L===x[0][0]&&M){let te=x.shift(),re=this._isCellInSelection(te[0],t);for(E=te[0]+1;E<te[1];E++)M&&(M=re===this._isCellInSelection(E,t));M&&(M=!r||l<te[0]||l>=te[1]),M?(F=!0,O=new SK(this._workCell,e.translateToString(!0,te[0],te[1]),te[1]-te[0]),P=te[1]-1,I=O.getWidth()):Y=te[1]}let W=this._isCellInSelection(L,t),H=r&&L===l,T=U&&L>=f&&L<=v,G=!1;this._decorationService.forEachDecorationAtCell(L,t,void 0,te=>{G=!0});let X=O.getChars()||Xa;if(X===" "&&(O.isUnderline()||O.isOverline())&&(X=" "),q=I*d-m.get(X,O.isBold(),O.isItalic()),!C)C=this._document.createElement("span");else if(k&&(W&&$||!W&&!$&&O.bg===N)&&(W&&$&&b.selectionForeground||O.fg===R)&&O.extended.ext===A&&T===D&&q===B&&!H&&!F&&!G&&M){O.isInvisible()?S+=Xa:S+=X,k++;continue}else k&&(C.textContent=S),C=this._document.createElement("span"),k=0,S="";if(N=O.bg,R=O.fg,A=O.extended.ext,D=T,B=q,$=W,F&&l>=L&&l<=P&&(l=L),!this._coreService.isCursorHidden&&H&&this._coreService.isCursorInitialized){if(V.push("xterm-cursor"),this._coreBrowserService.isFocused)u&&V.push("xterm-cursor-blink"),V.push(s==="bar"?"xterm-cursor-bar":s==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(n)switch(n){case"outline":V.push("xterm-cursor-outline");break;case"block":V.push("xterm-cursor-block");break;case"bar":V.push("xterm-cursor-bar");break;case"underline":V.push("xterm-cursor-underline");break}}if(O.isBold()&&V.push("xterm-bold"),O.isItalic()&&V.push("xterm-italic"),O.isDim()&&V.push("xterm-dim"),O.isInvisible()?S=Xa:S=O.getChars()||Xa,O.isUnderline()&&(V.push(`xterm-underline-${O.extended.underlineStyle}`),S===" "&&(S=" "),!O.isUnderlineColorDefault()))if(O.isUnderlineColorRGB())C.style.textDecorationColor=`rgb(${Rd.toColorRGB(O.getUnderlineColor()).join(",")})`;else{let te=O.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&O.isBold()&&te<8&&(te+=8),C.style.textDecorationColor=b.ansi[te].css}O.isOverline()&&(V.push("xterm-overline"),S===" "&&(S=" ")),O.isStrikethrough()&&V.push("xterm-strikethrough"),T&&(C.style.textDecoration="underline");let ee=O.getFgColor(),oe=O.getFgColorMode(),de=O.getBgColor(),Z=O.getBgColorMode(),ce=!!O.isInverse();if(ce){let te=ee;ee=de,de=te;let re=oe;oe=Z,Z=re}let le,be,ke=!1;this._decorationService.forEachDecorationAtCell(L,t,void 0,te=>{te.options.layer!=="top"&&ke||(te.backgroundColorRGB&&(Z=50331648,de=te.backgroundColorRGB.rgba>>8&16777215,le=te.backgroundColorRGB),te.foregroundColorRGB&&(oe=50331648,ee=te.foregroundColorRGB.rgba>>8&16777215,be=te.foregroundColorRGB),ke=te.options.layer==="top")}),!ke&&W&&(le=this._coreBrowserService.isFocused?b.selectionBackgroundOpaque:b.selectionInactiveBackgroundOpaque,de=le.rgba>>8&16777215,Z=50331648,ke=!0,b.selectionForeground&&(oe=50331648,ee=b.selectionForeground.rgba>>8&16777215,be=b.selectionForeground)),ke&&V.push("xterm-decoration-top");let Ee;switch(Z){case 16777216:case 33554432:Ee=b.ansi[de],V.push(`xterm-bg-${de}`);break;case 50331648:Ee=kr.toColor(de>>16,de>>8&255,de&255),this._addStyle(C,`background-color:#${q5((de>>>0).toString(16),"0",6)}`);break;case 0:default:ce?(Ee=b.foreground,V.push("xterm-bg-257")):Ee=b.background}switch(le||O.isDim()&&(le=Wt.multiplyOpacity(Ee,.5)),oe){case 16777216:case 33554432:O.isBold()&&ee<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ee+=8),this._applyMinimumContrast(C,Ee,b.ansi[ee],O,le,void 0)||V.push(`xterm-fg-${ee}`);break;case 50331648:let te=kr.toColor(ee>>16&255,ee>>8&255,ee&255);this._applyMinimumContrast(C,Ee,te,O,le,be)||this._addStyle(C,`color:#${q5(ee.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(C,Ee,b.foreground,O,le,be)||ce&&V.push("xterm-fg-257")}V.length&&(C.className=V.join(" "),V.length=0),!H&&!F&&!G&&M?k++:C.textContent=S,q!==this.defaultSpacing&&(C.style.letterSpacing=`${q}px`),p.push(C),L=P}return C&&k&&(C.textContent=S),p}_applyMinimumContrast(e,t,r,s,n,l){if(this._optionsService.rawOptions.minimumContrastRatio===1||EK(s.getCode()))return!1;let u=this._getContrastCache(s),d;if(!n&&!l&&(d=u.getColor(t.rgba,r.rgba)),d===void 0){let m=this._optionsService.rawOptions.minimumContrastRatio/(s.isDim()?2:1);d=Wt.ensureContrastRatio(n||t,l||r,m),u.setColor((n||t).rgba,(l||r).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 r=this._selectionStart,s=this._selectionEnd;return!r||!s?!1:this._columnSelectMode?r[0]<=s[0]?e>=r[0]&&t>=r[1]&&e<s[0]&&t<=s[1]:e<r[0]&&t>=r[1]&&e>=s[0]&&t<=s[1]:t>r[1]&&t<s[1]||r[1]===s[1]&&t===r[1]&&e>=r[0]&&e<s[0]||r[1]<s[1]&&t===s[1]&&e<s[0]||r[1]<s[1]&&t===r[1]&&e>=r[0]}};Qx=dr([Ne(1,VM),Ne(2,ws),Ne(3,ha),Ne(4,ll),Ne(5,Nd),Ne(6,kc)],Qx);function q5(e,t,r){for(;e.length<r;)e=t+e;return e}var NK=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 r=e.createElement("span");r.classList.add("xterm-char-measure-element");let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold";let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontStyle="italic";let l=e.createElement("span");l.classList.add("xterm-char-measure-element"),l.style.fontWeight="bold",l.style.fontStyle="italic",this._measureElements=[r,s,n,l],this._container.appendChild(r),this._container.appendChild(s),this._container.appendChild(n),this._container.appendChild(l),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,r,s){e===this._font&&t===this._fontSize&&r===this._weight&&s===this._weightBold||(this._font=e,this._fontSize=t,this._weight=r,this._weightBold=s,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${r}`,this._measureElements[1].style.fontWeight=`${s}`,this._measureElements[2].style.fontWeight=`${r}`,this._measureElements[3].style.fontWeight=`${s}`,this.clear())}get(e,t,r){let s=0;if(!t&&!r&&e.length===1&&(s=e.charCodeAt(0))<256){if(this._flat[s]!==-9999)return this._flat[s];let u=this._measure(e,0);return u>0&&(this._flat[s]=u),u}let n=e;t&&(n+="B"),r&&(n+="I");let l=this._holey.get(n);if(l===void 0){let u=0;t&&(u|=1),r&&(u|=2),l=this._measure(e,u),l>0&&this._holey.set(n,l)}return l}_measure(e,t){let r=this._measureElements[t];return r.textContent=e.repeat(32),r.offsetWidth/32}},jK=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,r,s=!1){if(this.selectionStart=t,this.selectionEnd=r,!t||!r||t[0]===r[0]&&t[1]===r[1]){this.clear();return}let n=e.buffers.active.ydisp,l=t[1]-n,u=r[1]-n,d=Math.max(l,0),m=Math.min(u,e.rows-1);if(d>=e.rows||m<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=l,this.viewportEndRow=u,this.viewportCappedStartRow=d,this.viewportCappedEndRow=m,this.startCol=t[0],this.endCol=r[0]}isCellSelected(e,t,r){return this.hasSelection?(r-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&r>=this.viewportCappedStartRow&&t<this.endCol&&r<=this.viewportCappedEndRow:t<this.startCol&&r>=this.viewportCappedStartRow&&t>=this.endCol&&r<=this.viewportCappedEndRow:r>this.viewportStartRow&&r<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol):!1}};function AK(){return new jK}var C_="xterm-dom-renderer-owner-",fi="xterm-rows",xf="xterm-fg-",V5="xterm-bg-",Au="xterm-focus",yf="xterm-selection",MK=1,Jx=class extends lt{constructor(e,t,r,s,n,l,u,d,m,f,v,p,x,b){super(),this._terminal=e,this._document=t,this._element=r,this._screenElement=s,this._viewportElement=n,this._helperContainer=l,this._linkifier2=u,this._charSizeService=m,this._optionsService=f,this._bufferService=v,this._coreService=p,this._coreBrowserService=x,this._themeService=b,this._terminalClass=MK++,this._rowElements=[],this._selectionRenderModel=AK(),this.onRequestRedraw=this._register(new we).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(fi),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(yf),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=RK(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(w=>this._injectCss(w))),this._injectCss(this._themeService.colors),this._rowFactory=d.createInstance(Qx,document),this._element.classList.add(C_+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(w=>this._handleLinkHover(w))),this._register(this._linkifier2.onHideLinkUnderline(w=>this._handleLinkLeave(w))),this._register(Kt(()=>{this._element.classList.remove(C_+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new NK(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 r of this._rowElements)r.style.width=`${this.dimensions.css.canvas.width}px`,r.style.height=`${this.dimensions.css.cell.height}px`,r.style.lineHeight=`${this.dimensions.css.cell.height}px`,r.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${fi} 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} .${fi} { 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} .${fi} .xterm-dim { color: ${Wt.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 r=`blink_underline_${this._terminalClass}`,s=`blink_bar_${this._terminalClass}`,n=`blink_block_${this._terminalClass}`;t+=`@keyframes ${r} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${s} { 50% { box-shadow: none; }}`,t+=`@keyframes ${n} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${fi}.${Au} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${fi}.${Au} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${fi}.${Au} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${fi} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${fi} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${fi} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${fi} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${fi} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${yf} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${yf} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${yf} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[l,u]of e.ansi.entries())t+=`${this._terminalSelector} .${xf}${l} { color: ${u.css}; }${this._terminalSelector} .${xf}${l}.xterm-dim { color: ${Wt.multiplyOpacity(u,.5).css}; }${this._terminalSelector} .${V5}${l} { background-color: ${u.css}; }`;t+=`${this._terminalSelector} .${xf}257 { color: ${Wt.opaque(e.background).css}; }${this._terminalSelector} .${xf}257.xterm-dim { color: ${Wt.multiplyOpacity(Wt.opaque(e.background),.5).css}; }${this._terminalSelector} .${V5}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 r=this._rowElements.length;r<=t;r++){let s=this._document.createElement("div");this._rowContainer.appendChild(s),this._rowElements.push(s)}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(Au),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Au),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,r){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,r),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,r),!this._selectionRenderModel.hasSelection))return;let s=this._selectionRenderModel.viewportStartRow,n=this._selectionRenderModel.viewportEndRow,l=this._selectionRenderModel.viewportCappedStartRow,u=this._selectionRenderModel.viewportCappedEndRow,d=this._document.createDocumentFragment();if(r){let m=e[0]>t[0];d.appendChild(this._createSelectionElement(l,m?t[0]:e[0],m?e[0]:t[0],u-l+1))}else{let m=s===l?e[0]:0,f=l===n?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(l,m,f));let v=u-l-1;if(d.appendChild(this._createSelectionElement(l+1,0,this._bufferService.cols,v)),l!==u){let p=n===u?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(u,0,p))}}this._selectionContainer.appendChild(d)}_createSelectionElement(e,t,r,s=1){let n=this._document.createElement("div"),l=t*this.dimensions.css.cell.width,u=this.dimensions.css.cell.width*(r-t);return l+u>this.dimensions.css.canvas.width&&(u=this.dimensions.css.canvas.width-l),n.style.height=`${s*this.dimensions.css.cell.height}px`,n.style.top=`${e*this.dimensions.css.cell.height}px`,n.style.left=`${l}px`,n.style.width=`${u}px`,n}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 r=this._bufferService.buffer,s=r.ybase+r.y,n=Math.min(r.x,this._bufferService.cols-1),l=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,u=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,d=this._optionsService.rawOptions.cursorInactiveStyle;for(let m=e;m<=t;m++){let f=m+r.ydisp,v=this._rowElements[m],p=r.lines.get(f);if(!v||!p)break;v.replaceChildren(...this._rowFactory.createRow(p,f,f===s,u,d,n,l,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${C_}${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,r,s,n,l){r<0&&(e=0),s<0&&(t=0);let u=this._bufferService.rows-1;r=Math.max(Math.min(r,u),0),s=Math.max(Math.min(s,u),0),n=Math.min(n,this._bufferService.cols);let d=this._bufferService.buffer,m=d.ybase+d.y,f=Math.min(d.x,n-1),v=this._optionsService.rawOptions.cursorBlink,p=this._optionsService.rawOptions.cursorStyle,x=this._optionsService.rawOptions.cursorInactiveStyle;for(let b=r;b<=s;++b){let w=b+d.ydisp,C=this._rowElements[b],k=d.lines.get(w);if(!C||!k)break;C.replaceChildren(...this._rowFactory.createRow(k,w,w===m,p,x,f,v,this.dimensions.css.cell.width,this._widthCache,l?b===r?e:0:-1,l?(b===s?t:n)-1:-1))}}};Jx=dr([Ne(7,Py),Ne(8,lp),Ne(9,ws),Ne(10,bs),Ne(11,ll),Ne(12,ha),Ne(13,kc)],Jx);var e0=class extends lt{constructor(e,t,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this._register(new we),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new DK(this._optionsService))}catch{this._measureStrategy=this._register(new TK(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())}};e0=dr([Ne(2,ws)],e0);var dT=class extends lt{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)}},TK=class extends dT{constructor(e,t,r){super(),this._document=e,this._parentElement=t,this._optionsService=r,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}},DK=class extends dT{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}},LK=class extends lt{constructor(e,t,r){super(),this._textarea=e,this._window=t,this.mainDocument=r,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new OK(this._window)),this._onDprChange=this._register(new we),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new we),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(s=>this._screenDprMonitor.setWindow(s))),this._register(os.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Ke(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Ke(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}},OK=class extends lt{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new pc),this._onDprChange=this._register(new we),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Kt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Ke(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)}},BK=class extends lt{constructor(){super(),this.linkProviders=[],this._register(Kt(()=>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 qy(e,t,r){let s=r.getBoundingClientRect(),n=e.getComputedStyle(r),l=parseInt(n.getPropertyValue("padding-left")),u=parseInt(n.getPropertyValue("padding-top"));return[t.clientX-s.left-l,t.clientY-s.top-u]}function PK(e,t,r,s,n,l,u,d,m){if(!l)return;let f=qy(e,t,r);if(f)return f[0]=Math.ceil((f[0]+(m?u/2:0))/u),f[1]=Math.ceil(f[1]/d),f[0]=Math.min(Math.max(f[0],1),s+(m?1:0)),f[1]=Math.min(Math.max(f[1],1),n),f}var t0=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,r,s,n){return PK(window,e,t,r,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,n)}getMouseReportCoords(e,t){let r=qy(window,e,t);if(this._charSizeService.hasValidSize)return r[0]=Math.min(Math.max(r[0],0),this._renderService.dimensions.css.canvas.width-1),r[1]=Math.min(Math.max(r[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(r[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(r[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(r[0]),y:Math.floor(r[1])}}};t0=dr([Ne(0,fa),Ne(1,lp)],t0);var IK=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,r){this._rowCount=r,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=[]}},hT={};YG(hT,{getSafariVersion:()=>$K,isChromeOS:()=>gT,isFirefox:()=>fT,isIpad:()=>UK,isIphone:()=>HK,isLegacyEdge:()=>zK,isLinux:()=>Vy,isMac:()=>pm,isNode:()=>cp,isSafari:()=>mT,isWindows:()=>pT});var cp=typeof process<"u"&&"title"in process,jd=cp?"node":navigator.userAgent,Ad=cp?"node":navigator.platform,fT=jd.includes("Firefox"),zK=jd.includes("Edge"),mT=/^((?!chrome|android).)*safari/i.test(jd);function $K(){if(!mT)return 0;let e=jd.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var pm=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Ad),UK=Ad==="iPad",HK=Ad==="iPhone",pT=["Windows","Win16","Win32","WinCE"].includes(Ad),Vy=Ad.indexOf("Linux")>=0,gT=/\bCrOS\b/.test(jd),vT=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,r=0,s=e.timeRemaining(),n=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),r=Math.max(t,r),n=e.timeRemaining(),r*1.5>n){s-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),this._start();return}s=n}this.clear()}},FK=class extends vT{_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())}}},WK=class extends vT{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},gm=!cp&&"requestIdleCallback"in window?WK:FK,qK=class{constructor(){this._queue=new gm}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},r0=class extends lt{constructor(e,t,r,s,n,l,u,d,m){super(),this._rowCount=e,this._optionsService=r,this._charSizeService=s,this._coreService=n,this._coreBrowserService=d,this._renderer=this._register(new pc),this._pausedResizeTask=new qK,this._observerDisposable=this._register(new pc),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 we),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new we),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new we),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new we),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new IK((f,v)=>this._renderRows(f,v),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new VK(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Kt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(u.onResize(()=>this._fullRefresh())),this._register(u.buffers.onBufferActivate(()=>{var f;return(f=this._renderer.value)==null?void 0:f.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(l.onDecorationRegistered(()=>this._fullRefresh())),this._register(l.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(u.cols,u.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(u.buffer.y,u.buffer.y,!0))),this._register(m.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(f=>this._registerIntersectionObserver(f,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let r=new e.IntersectionObserver(s=>this._handleIntersectionChange(s[s.length-1]),{threshold:0});r.observe(t),this._observerDisposable.value=Kt(()=>r.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,r=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let s=this._syncOutputHandler.flush();s&&(e=Math.min(e,s.start),t=Math.max(t,s.end)),r||(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 r;return(r=this._renderer.value)==null?void 0:r.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,r){var s;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=r,(s=this._renderer.value)==null||s.handleSelectionChanged(e,t,r)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};r0=dr([Ne(2,ws),Ne(3,lp),Ne(4,ll),Ne(5,Nd),Ne(6,bs),Ne(7,ha),Ne(8,kc)],r0);var VK=class{constructor(e,t,r){this._coreBrowserService=e,this._coreService=t,this._onTimeout=r,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 GK(e,t,r,s){let n=r.buffer.x,l=r.buffer.y;if(!r.buffer.hasScrollback)return XK(n,l,e,t,r,s)+up(l,t,r,s)+ZK(n,l,e,t,r,s);let u;if(l===t)return u=n>e?"D":"C",ud(Math.abs(n-e),cd(u,s));u=l>t?"D":"C";let d=Math.abs(l-t),m=KK(l>t?e:n,r)+(d-1)*r.cols+1+YK(l>t?n:e);return ud(m,cd(u,s))}function YK(e,t){return e-1}function KK(e,t){return t.cols-e}function XK(e,t,r,s,n,l){return up(t,s,n,l).length===0?"":ud(xT(e,t,e,t-el(t,n),!1,n).length,cd("D",l))}function up(e,t,r,s){let n=e-el(e,r),l=t-el(t,r),u=Math.abs(n-l)-QK(e,t,r);return ud(u,cd(_T(e,t),s))}function ZK(e,t,r,s,n,l){let u;up(t,s,n,l).length>0?u=s-el(s,n):u=t;let d=s,m=JK(e,t,r,s,n,l);return ud(xT(e,u,r,d,m==="C",n).length,cd(m,l))}function QK(e,t,r){var u;let s=0,n=e-el(e,r),l=t-el(t,r);for(let d=0;d<Math.abs(n-l);d++){let m=_T(e,t)==="A"?-1:1;(u=r.buffer.lines.get(n+m*d))!=null&&u.isWrapped&&s++}return s}function el(e,t){let r=0,s=t.buffer.lines.get(e),n=s==null?void 0:s.isWrapped;for(;n&&e>=0&&e<t.rows;)r++,s=t.buffer.lines.get(--e),n=s==null?void 0:s.isWrapped;return r}function JK(e,t,r,s,n,l){let u;return up(r,s,n,l).length>0?u=s-el(s,n):u=t,e<r&&u<=s||e>=r&&u<s?"C":"D"}function _T(e,t){return e>t?"A":"B"}function xT(e,t,r,s,n,l){let u=e,d=t,m="";for(;(u!==r||d!==s)&&d>=0&&d<l.buffer.lines.length;)u+=n?1:-1,n&&u>l.cols-1?(m+=l.buffer.translateBufferLineToString(d,!1,e,u),u=0,e=0,d++):!n&&u<0&&(m+=l.buffer.translateBufferLineToString(d,!1,0,e+1),u=l.cols-1,e=u,d--);return m+l.buffer.translateBufferLineToString(d,!1,e,u)}function cd(e,t){let r=t?"O":"[";return ve.ESC+r+e}function ud(e,t){e=Math.floor(e);let r="";for(let s=0;s<e;s++)r+=t;return r}var eX=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 G5(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 k_=50,tX=15,rX=50,sX=500,iX=" ",nX=new RegExp(iX,"g"),s0=class extends lt{constructor(e,t,r,s,n,l,u,d,m){super(),this._element=e,this._screenElement=t,this._linkifier=r,this._bufferService=s,this._coreService=n,this._mouseService=l,this._optionsService=u,this._renderService=d,this._coreBrowserService=m,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Si,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new we),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new we),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new we),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new we),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=f=>this._handleMouseMove(f),this._mouseUpListener=f=>this._handleMouseUp(f),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(f=>this._handleTrim(f)),this._register(this._bufferService.buffers.onBufferActivate(f=>this._handleBufferActivate(f))),this.enable(),this._model=new eX(this._bufferService),this._activeSelectionMode=0,this._register(Kt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(f=>{f.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 r=this._bufferService.buffer,s=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let n=e[0]<t[0]?e[0]:t[0],l=e[0]<t[0]?t[0]:e[0];for(let u=e[1];u<=t[1];u++){let d=r.translateBufferLineToString(u,!0,n,l);s.push(d)}}else{let n=e[1]===t[1]?t[0]:void 0;s.push(r.translateBufferLineToString(e[1],!0,e[0],n));for(let l=e[1]+1;l<=t[1]-1;l++){let u=r.lines.get(l),d=r.translateBufferLineToString(l,!0);u!=null&&u.isWrapped?s[s.length-1]+=d:s.push(d)}if(e[1]!==t[1]){let l=r.lines.get(t[1]),u=r.translateBufferLineToString(t[1],!0,0,t[0]);l&&l.isWrapped?s[s.length-1]+=u:s.push(u)}}return s.map(n=>n.replace(nX," ")).join(pT?`\r
|
|
705
|
-
`:`
|
|
706
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Vy&&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),r=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!r||!s||!t?!1:this._areCoordsInSelection(t,r,s)}isCellInSelection(e,t){let r=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!r||!s?!1:this._areCoordsInSelection([e,t],r,s)}_areCoordsInSelection(e,t,r){return e[1]>t[1]&&e[1]<r[1]||t[1]===r[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<r[0]||t[1]<r[1]&&e[1]===r[1]&&e[0]<r[0]||t[1]<r[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var n,l;let r=(l=(n=this._linkifier.currentLink)==null?void 0:n.link)==null?void 0:l.range;if(r)return this._model.selectionStart=[r.start.x-1,r.start.y-1],this._model.selectionStartLength=G5(r,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let s=this._getMouseBufferCoords(e);return s?(this._selectWordAt(s,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=qy(this._coreBrowserService.window,e,this._screenElement)[1],r=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=r?0:(t>r&&(t-=r),t=Math.min(Math.max(t,-k_),k_),t/=k_,t/Math.abs(t)+Math.round(t*(tX-1)))}shouldForceSelection(e){return pm?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(),rX)}_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&&!(pm&&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 r=this._bufferService.buffer;if(this._model.selectionEnd[1]<r.lines.length){let s=r.lines.get(this._model.selectionEnd[1]);s&&s.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<sX&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let r=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(r&&r[0]!==void 0&&r[1]!==void 0){let s=GK(r[0]-1,r[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(s,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,r=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!r){this._oldHasSelection&&this._fireOnSelectionChange(e,t,r);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,r)}_fireOnSelectionChange(e,t,r){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=r,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let r=t;for(let s=0;t>=s;s++){let n=e.loadCell(s,this._workCell).getChars().length;this._workCell.getWidth()===0?r--:n>1&&t!==s&&(r+=n-1)}return r}setSelection(e,t,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=r,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,r=!0,s=!0){if(e[0]>=this._bufferService.cols)return;let n=this._bufferService.buffer,l=n.lines.get(e[1]);if(!l)return;let u=n.translateBufferLineToString(e[1],!1),d=this._convertViewportColToCharacterIndex(l,e[0]),m=d,f=e[0]-d,v=0,p=0,x=0,b=0;if(u.charAt(d)===" "){for(;d>0&&u.charAt(d-1)===" ";)d--;for(;m<u.length&&u.charAt(m+1)===" ";)m++}else{let k=e[0],S=e[0];l.getWidth(k)===0&&(v++,k--),l.getWidth(S)===2&&(p++,S++);let E=l.getString(S).length;for(E>1&&(b+=E-1,m+=E-1);k>0&&d>0&&!this._isCharWordSeparator(l.loadCell(k-1,this._workCell));){l.loadCell(k-1,this._workCell);let N=this._workCell.getChars().length;this._workCell.getWidth()===0?(v++,k--):N>1&&(x+=N-1,d-=N-1),d--,k--}for(;S<l.length&&m+1<u.length&&!this._isCharWordSeparator(l.loadCell(S+1,this._workCell));){l.loadCell(S+1,this._workCell);let N=this._workCell.getChars().length;this._workCell.getWidth()===2?(p++,S++):N>1&&(b+=N-1,m+=N-1),m++,S++}}m++;let w=d+f-v+x,C=Math.min(this._bufferService.cols,m-d+v+p-x-b);if(!(!t&&u.slice(d,m).trim()==="")){if(r&&w===0&&l.getCodePoint(0)!==32){let k=n.lines.get(e[1]-1);if(k&&l.isWrapped&&k.getCodePoint(this._bufferService.cols-1)!==32){let S=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(S){let E=this._bufferService.cols-S.start;w-=E,C+=E}}}if(s&&w+C===this._bufferService.cols&&l.getCodePoint(this._bufferService.cols-1)!==32){let k=n.lines.get(e[1]+1);if(k!=null&&k.isWrapped&&k.getCodePoint(0)!==32){let S=this._getWordAt([0,e[1]+1],!1,!1,!0);S&&(C+=S.length)}}return{start:w,length:C}}}_selectWordAt(e,t){let r=this._getWordAt(e,t);if(r){for(;r.start<0;)r.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[r.start,e[1]],this._model.selectionStartLength=r.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let r=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,r--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,r++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,r]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),r={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=G5(r,this._bufferService.cols)}};s0=dr([Ne(3,bs),Ne(4,ll),Ne(5,Iy),Ne(6,ws),Ne(7,fa),Ne(8,ha)],s0);var Y5=class{constructor(){this._data={}}set(e,t,r){this._data[e]||(this._data[e]={}),this._data[e][t]=r}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},K5=class{constructor(){this._color=new Y5,this._css=new Y5}setCss(e,t,r){this._css.set(e,t,r)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,r){this._color.set(e,t,r)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Dr=Object.freeze((()=>{let e=[Jt.toColor("#2e3436"),Jt.toColor("#cc0000"),Jt.toColor("#4e9a06"),Jt.toColor("#c4a000"),Jt.toColor("#3465a4"),Jt.toColor("#75507b"),Jt.toColor("#06989a"),Jt.toColor("#d3d7cf"),Jt.toColor("#555753"),Jt.toColor("#ef2929"),Jt.toColor("#8ae234"),Jt.toColor("#fce94f"),Jt.toColor("#729fcf"),Jt.toColor("#ad7fa8"),Jt.toColor("#34e2e2"),Jt.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let r=0;r<216;r++){let s=t[r/36%6|0],n=t[r/6%6|0],l=t[r%6];e.push({css:kr.toCss(s,n,l),rgba:kr.toRgba(s,n,l)})}for(let r=0;r<24;r++){let s=8+r*10;e.push({css:kr.toCss(s,s,s),rgba:kr.toRgba(s,s,s)})}return e})()),zo=Jt.toColor("#ffffff"),Uu=Jt.toColor("#000000"),X5=Jt.toColor("#ffffff"),Z5=Uu,Mu={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},aX=zo,i0=class extends lt{constructor(e){super(),this._optionsService=e,this._contrastCache=new K5,this._halfContrastCache=new K5,this._onChangeColors=this._register(new we),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:zo,background:Uu,cursor:X5,cursorAccent:Z5,selectionForeground:void 0,selectionBackgroundTransparent:Mu,selectionBackgroundOpaque:Wt.blend(Uu,Mu),selectionInactiveBackgroundTransparent:Mu,selectionInactiveBackgroundOpaque:Wt.blend(Uu,Mu),scrollbarSliderBackground:Wt.opacity(zo,.2),scrollbarSliderHoverBackground:Wt.opacity(zo,.4),scrollbarSliderActiveBackground:Wt.opacity(zo,.5),overviewRulerBorder:zo,ansi:Dr.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=Lt(e.foreground,zo),t.background=Lt(e.background,Uu),t.cursor=Wt.blend(t.background,Lt(e.cursor,X5)),t.cursorAccent=Wt.blend(t.background,Lt(e.cursorAccent,Z5)),t.selectionBackgroundTransparent=Lt(e.selectionBackground,Mu),t.selectionBackgroundOpaque=Wt.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Lt(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Wt.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Lt(e.selectionForeground,W5):void 0,t.selectionForeground===W5&&(t.selectionForeground=void 0),Wt.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Wt.opacity(t.selectionBackgroundTransparent,.3)),Wt.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Wt.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Lt(e.scrollbarSliderBackground,Wt.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Lt(e.scrollbarSliderHoverBackground,Wt.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Lt(e.scrollbarSliderActiveBackground,Wt.opacity(t.foreground,.5)),t.overviewRulerBorder=Lt(e.overviewRulerBorder,aX),t.ansi=Dr.slice(),t.ansi[0]=Lt(e.black,Dr[0]),t.ansi[1]=Lt(e.red,Dr[1]),t.ansi[2]=Lt(e.green,Dr[2]),t.ansi[3]=Lt(e.yellow,Dr[3]),t.ansi[4]=Lt(e.blue,Dr[4]),t.ansi[5]=Lt(e.magenta,Dr[5]),t.ansi[6]=Lt(e.cyan,Dr[6]),t.ansi[7]=Lt(e.white,Dr[7]),t.ansi[8]=Lt(e.brightBlack,Dr[8]),t.ansi[9]=Lt(e.brightRed,Dr[9]),t.ansi[10]=Lt(e.brightGreen,Dr[10]),t.ansi[11]=Lt(e.brightYellow,Dr[11]),t.ansi[12]=Lt(e.brightBlue,Dr[12]),t.ansi[13]=Lt(e.brightMagenta,Dr[13]),t.ansi[14]=Lt(e.brightCyan,Dr[14]),t.ansi[15]=Lt(e.brightWhite,Dr[15]),e.extendedAnsi){let r=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let s=0;s<r;s++)t.ansi[s+16]=Lt(e.extendedAnsi[s],Dr[s+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()}}};i0=dr([Ne(0,ws)],i0);function Lt(e,t){if(e!==void 0)try{return Jt.toColor(e)}catch{}return t}var oX=class{constructor(...e){this._entries=new Map;for(let[t,r]of e)this.set(t,r)}set(e,t){let r=this._entries.get(e);return this._entries.set(e,t),r}forEach(e){for(let[t,r]of this._entries.entries())e(t,r)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},lX=class{constructor(){this._services=new oX,this._services.set(Py,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let r=tY(e).sort((l,u)=>l.index-u.index),s=[];for(let l of r){let u=this._services.get(l.id);if(!u)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${l.id._id}.`);s.push(u)}let n=r.length>0?r[0].index:t.length;if(t.length!==n)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${n+1} conflicts with ${t.length} static arguments`);return new e(...t,...s)}},cX={trace:0,debug:1,info:2,warn:3,error:4,off:5},uX="xterm.js: ",n0=class extends lt{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=cX[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,r){this._evalLazyOptionalParams(r),e.call(console,(this._optionsService.options.logger?"":uX)+t,...r)}trace(e,...t){var r;this._logLevel<=0&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var r;this._logLevel<=1&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var r;this._logLevel<=2&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var r;this._logLevel<=3&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var r;this._logLevel<=4&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.error.bind(this._optionsService.options.logger))??console.error,e,t)}};n0=dr([Ne(0,ws)],n0);var Q5=class extends lt{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new we),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new we),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new we),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 r=0;r<Math.min(e,this.length);r++)t[r]=this._array[this._getCyclicIndex(r)];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,...r){if(t){for(let s=e;s<this._length-t;s++)this._array[this._getCyclicIndex(s)]=this._array[this._getCyclicIndex(s+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let s=this._length-1;s>=e;s--)this._array[this._getCyclicIndex(s+r.length)]=this._array[this._getCyclicIndex(s)];for(let s=0;s<r.length;s++)this._array[this._getCyclicIndex(e+s)]=r[s];if(r.length&&this.onInsertEmitter.fire({index:e,amount:r.length}),this._length+r.length>this._maxLength){let s=this._length+r.length-this._maxLength;this._startIndex+=s,this._length=this._maxLength,this.onTrimEmitter.fire(s)}else this._length+=r.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,r){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+r<0)throw new Error("Cannot shift elements in list beyond index 0");if(r>0){for(let n=t-1;n>=0;n--)this.set(e+n+r,this.get(e+n));let s=e+t+r-this._length;if(s>0)for(this._length+=s;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let s=0;s<t;s++)this.set(e+s+r,this.get(e+s))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},at=3,Sr=Object.freeze(new Rd),bf=0,E_=2,Hu=class yT{constructor(t,r,s=!1){this.isWrapped=s,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*at);let n=r||Si.fromCharData([0,zM,1,0]);for(let l=0;l<t;++l)this.setCell(l,n);this.length=t}get(t){let r=this._data[t*at+0],s=r&2097151;return[this._data[t*at+1],r&2097152?this._combined[t]:s?Ga(s):"",r>>22,r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):s]}set(t,r){this._data[t*at+1]=r[0],r[1].length>1?(this._combined[t]=r[1],this._data[t*at+0]=t|2097152|r[2]<<22):this._data[t*at+0]=r[1].charCodeAt(0)|r[2]<<22}getWidth(t){return this._data[t*at+0]>>22}hasWidth(t){return this._data[t*at+0]&12582912}getFg(t){return this._data[t*at+1]}getBg(t){return this._data[t*at+2]}hasContent(t){return this._data[t*at+0]&4194303}getCodePoint(t){let r=this._data[t*at+0];return r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r&2097151}isCombined(t){return this._data[t*at+0]&2097152}getString(t){let r=this._data[t*at+0];return r&2097152?this._combined[t]:r&2097151?Ga(r&2097151):""}isProtected(t){return this._data[t*at+2]&536870912}loadCell(t,r){return bf=t*at,r.content=this._data[bf+0],r.fg=this._data[bf+1],r.bg=this._data[bf+2],r.content&2097152&&(r.combinedData=this._combined[t]),r.bg&268435456&&(r.extended=this._extendedAttrs[t]),r}setCell(t,r){r.content&2097152&&(this._combined[t]=r.combinedData),r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*at+0]=r.content,this._data[t*at+1]=r.fg,this._data[t*at+2]=r.bg}setCellFromCodepoint(t,r,s,n){n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*at+0]=r|s<<22,this._data[t*at+1]=n.fg,this._data[t*at+2]=n.bg}addCodepointToCell(t,r,s){let n=this._data[t*at+0];n&2097152?this._combined[t]+=Ga(r):n&2097151?(this._combined[t]=Ga(n&2097151)+Ga(r),n&=-2097152,n|=2097152):n=r|1<<22,s&&(n&=-12582913,n|=s<<22),this._data[t*at+0]=n}insertCells(t,r,s){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),r<this.length-t){let n=new Si;for(let l=this.length-t-r-1;l>=0;--l)this.setCell(t+r+l,this.loadCell(t+l,n));for(let l=0;l<r;++l)this.setCell(t+l,s)}else for(let n=t;n<this.length;++n)this.setCell(n,s);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,s)}deleteCells(t,r,s){if(t%=this.length,r<this.length-t){let n=new Si;for(let l=0;l<this.length-t-r;++l)this.setCell(t+l,this.loadCell(t+r+l,n));for(let l=this.length-r;l<this.length;++l)this.setCell(l,s)}else for(let n=t;n<this.length;++n)this.setCell(n,s);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,s)}replaceCells(t,r,s,n=!1){if(n){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,s),r<this.length&&this.getWidth(r-1)===2&&!this.isProtected(r)&&this.setCellFromCodepoint(r,0,1,s);t<r&&t<this.length;)this.isProtected(t)||this.setCell(t,s),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),r<this.length&&this.getWidth(r-1)===2&&this.setCellFromCodepoint(r,0,1,s);t<r&&t<this.length;)this.setCell(t++,s)}resize(t,r){if(t===this.length)return this._data.length*4*E_<this._data.buffer.byteLength;let s=t*at;if(t>this.length){if(this._data.buffer.byteLength>=s*4)this._data=new Uint32Array(this._data.buffer,0,s);else{let n=new Uint32Array(s);n.set(this._data),this._data=n}for(let n=this.length;n<t;++n)this.setCell(n,r)}else{this._data=this._data.subarray(0,s);let n=Object.keys(this._combined);for(let u=0;u<n.length;u++){let d=parseInt(n[u],10);d>=t&&delete this._combined[d]}let l=Object.keys(this._extendedAttrs);for(let u=0;u<l.length;u++){let d=parseInt(l[u],10);d>=t&&delete this._extendedAttrs[d]}}return this.length=t,s*4*E_<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*E_<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,r=!1){if(r){for(let s=0;s<this.length;++s)this.isProtected(s)||this.setCell(s,t);return}this._combined={},this._extendedAttrs={};for(let s=0;s<this.length;++s)this.setCell(s,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 r in t._combined)this._combined[r]=t._combined[r];this._extendedAttrs={};for(let r in t._extendedAttrs)this._extendedAttrs[r]=t._extendedAttrs[r];this.isWrapped=t.isWrapped}clone(){let t=new yT(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let r in this._combined)t._combined[r]=this._combined[r];for(let r in this._extendedAttrs)t._extendedAttrs[r]=this._extendedAttrs[r];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*at+0]&4194303)return t+(this._data[t*at+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*at+0]&4194303||this._data[t*at+2]&50331648)return t+(this._data[t*at+0]>>22);return 0}copyCellsFrom(t,r,s,n,l){let u=t._data;if(l)for(let m=n-1;m>=0;m--){for(let f=0;f<at;f++)this._data[(s+m)*at+f]=u[(r+m)*at+f];u[(r+m)*at+2]&268435456&&(this._extendedAttrs[s+m]=t._extendedAttrs[r+m])}else for(let m=0;m<n;m++){for(let f=0;f<at;f++)this._data[(s+m)*at+f]=u[(r+m)*at+f];u[(r+m)*at+2]&268435456&&(this._extendedAttrs[s+m]=t._extendedAttrs[r+m])}let d=Object.keys(t._combined);for(let m=0;m<d.length;m++){let f=parseInt(d[m],10);f>=r&&(this._combined[f-r+s]=t._combined[f])}}translateToString(t,r,s,n){r=r??0,s=s??this.length,t&&(s=Math.min(s,this.getTrimmedLength())),n&&(n.length=0);let l="";for(;r<s;){let u=this._data[r*at+0],d=u&2097151,m=u&2097152?this._combined[r]:d?Ga(d):Xa;if(l+=m,n)for(let f=0;f<m.length;++f)n.push(r);r+=u>>22||1}return n&&n.push(r),l}};function dX(e,t,r,s,n,l){let u=[];for(let d=0;d<e.length-1;d++){let m=d,f=e.get(++m);if(!f.isWrapped)continue;let v=[e.get(d)];for(;m<e.length&&f.isWrapped;)v.push(f),f=e.get(++m);if(!l&&s>=d&&s<m){d+=v.length-1;continue}let p=0,x=dd(v,p,t),b=1,w=0;for(;b<v.length;){let k=dd(v,b,t),S=k-w,E=r-x,N=Math.min(S,E);v[p].copyCellsFrom(v[b],w,x,N,!1),x+=N,x===r&&(p++,x=0),w+=N,w===k&&(b++,w=0),x===0&&p!==0&&v[p-1].getWidth(r-1)===2&&(v[p].copyCellsFrom(v[p-1],r-1,x++,1,!1),v[p-1].setCell(r-1,n))}v[p].replaceCells(x,r,n);let C=0;for(let k=v.length-1;k>0&&(k>p||v[k].getTrimmedLength()===0);k--)C++;C>0&&(u.push(d+v.length-C),u.push(C)),d+=v.length-1}return u}function hX(e,t){let r=[],s=0,n=t[s],l=0;for(let u=0;u<e.length;u++)if(n===u){let d=t[++s];e.onDeleteEmitter.fire({index:u-l,amount:d}),u+=d-1,l+=d,n=t[++s]}else r.push(u);return{layout:r,countRemoved:l}}function fX(e,t){let r=[];for(let s=0;s<t.length;s++)r.push(e.get(t[s]));for(let s=0;s<r.length;s++)e.set(s,r[s]);e.length=t.length}function mX(e,t,r){let s=[],n=e.map((m,f)=>dd(e,f,t)).reduce((m,f)=>m+f),l=0,u=0,d=0;for(;d<n;){if(n-d<r){s.push(n-d);break}l+=r;let m=dd(e,u,t);l>m&&(l-=m,u++);let f=e[u].getWidth(l-1)===2;f&&l--;let v=f?r-1:r;s.push(v),d+=v}return s}function dd(e,t,r){if(t===e.length-1)return e[t].getTrimmedLength();let s=!e[t].hasContent(r-1)&&e[t].getWidth(r-1)===1,n=e[t+1].getWidth(0)===2;return s&&n?r-1:r}var bT=class wT{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=wT._nextId++,this._onDispose=this.register(new we),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Jo(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};bT._nextId=1;var pX=bT,Ir={},$o=Ir.B;Ir[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Ir.A={"#":"£"};Ir.B=void 0;Ir[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Ir.C=Ir[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Ir.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Ir.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Ir.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Ir.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Ir.E=Ir[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Ir.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Ir.H=Ir[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Ir["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var J5=4294967295,ek=class{constructor(e,t,r){this._hasScrollback=e,this._optionsService=t,this._bufferService=r,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Sr.clone(),this.savedCharset=$o,this.markers=[],this._nullCell=Si.fromCharData([0,zM,1,0]),this._whitespaceCell=Si.fromCharData([0,Xa,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new gm,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Q5(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 hm),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 hm),this._whitespaceCell}getBlankLine(e,t){return new Hu(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>J5?J5:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Sr);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 Q5(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let r=this.getNullCell(Sr),s=0,n=this._getCorrectBufferLength(t);if(n>this.lines.maxLength&&(this.lines.maxLength=n),this.lines.length>0){if(this._cols<e)for(let u=0;u<this.lines.length;u++)s+=+this.lines.get(u).resize(e,r);let l=0;if(this._rows<t)for(let u=this._rows;u<t;u++)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 Hu(e,r)):this.ybase>0&&this.lines.length<=this.ybase+this.y+l+1?(this.ybase--,l++,this.ydisp>0&&this.ydisp--):this.lines.push(new Hu(e,r)));else for(let u=this._rows;u>t;u--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(n<this.lines.maxLength){let u=this.lines.length-n;u>0&&(this.lines.trimStart(u),this.ybase=Math.max(this.ybase-u,0),this.ydisp=Math.max(this.ydisp-u,0),this.savedY=Math.max(this.savedY-u,0)),this.lines.maxLength=n}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),l&&(this.y+=l),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 l=0;l<this.lines.length;l++)s+=+this.lines.get(l).resize(e,r);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),s>.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 r=this._optionsService.rawOptions.reflowCursorLine,s=dX(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Sr),r);if(s.length>0){let n=hX(this.lines,s);fX(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,r){let s=this.getNullCell(Sr),n=r;for(;n-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Hu(e,s))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-r,0)}_reflowSmaller(e,t){let r=this._optionsService.rawOptions.reflowCursorLine,s=this.getNullCell(Sr),n=[],l=0;for(let u=this.lines.length-1;u>=0;u--){let d=this.lines.get(u);if(!d||!d.isWrapped&&d.getTrimmedLength()<=e)continue;let m=[d];for(;d.isWrapped&&u>0;)d=this.lines.get(--u),m.unshift(d);if(!r){let N=this.ybase+this.y;if(N>=u&&N<u+m.length)continue}let f=m[m.length-1].getTrimmedLength(),v=mX(m,this._cols,e),p=v.length-m.length,x;this.ybase===0&&this.y!==this.lines.length-1?x=Math.max(0,this.y-this.lines.maxLength+p):x=Math.max(0,this.lines.length-this.lines.maxLength+p);let b=[];for(let N=0;N<p;N++){let R=this.getBlankLine(Sr,!0);b.push(R)}b.length>0&&(n.push({start:u+m.length+l,newLines:b}),l+=b.length),m.push(...b);let w=v.length-1,C=v[w];C===0&&(w--,C=v[w]);let k=m.length-p-1,S=f;for(;k>=0;){let N=Math.min(S,C);if(m[w]===void 0)break;if(m[w].copyCellsFrom(m[k],S-N,C-N,N,!0),C-=N,C===0&&(w--,C=v[w]),S-=N,S===0){k--;let R=Math.max(k,0);S=dd(m,R,this._cols)}}for(let N=0;N<m.length;N++)v[N]<e&&m[N].setCell(v[N],s);let E=p-x;for(;E-- >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+l)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+p,this.ybase+t-1)}if(n.length>0){let u=[],d=[];for(let C=0;C<this.lines.length;C++)d.push(this.lines.get(C));let m=this.lines.length,f=m-1,v=0,p=n[v];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+l);let x=0;for(let C=Math.min(this.lines.maxLength-1,m+l-1);C>=0;C--)if(p&&p.start>f+x){for(let k=p.newLines.length-1;k>=0;k--)this.lines.set(C--,p.newLines[k]);C++,u.push({index:f+1,amount:p.newLines.length}),x+=p.newLines.length,p=n[++v]}else this.lines.set(C,d[f--]);let b=0;for(let C=u.length-1;C>=0;C--)u[C].index+=b,this.lines.onInsertEmitter.fire(u[C]),b+=u[C].amount;let w=Math.max(0,m+l-this.lines.maxLength);w>0&&this.lines.onTrimEmitter.fire(w)}}translateBufferLineToString(e,t,r=0,s){let n=this.lines.get(e);return n?n.translateToString(t,r,s):""}getWrappedRangeForLine(e){let t=e,r=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;r+1<this.lines.length&&this.lines.get(r+1).isWrapped;)r++;return{first:t,last:r}}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 pX(e);return this.markers.push(t),t.register(this.lines.onTrim(r=>{t.line-=r,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(r=>{t.line>=r.index&&(t.line+=r.amount)})),t.register(this.lines.onDelete(r=>{t.line>=r.index&&t.line<r.index+r.amount&&t.dispose(),t.line>r.index&&(t.line-=r.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},gX=class extends lt{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new we),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 ek(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new ek(!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)}},ST=2,CT=1,a0=class extends lt{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new we),this.onResize=this._onResize.event,this._onScroll=this._register(new we),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,ST),this.rows=Math.max(e.rawOptions.rows||0,CT),this.buffers=this._register(new gX(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let r=this.cols!==e,s=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:r,rowsChanged:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let r=this.buffer,s;s=this._cachedBlankLine,(!s||s.length!==this.cols||s.getFg(0)!==e.fg||s.getBg(0)!==e.bg)&&(s=r.getBlankLine(e,t),this._cachedBlankLine=s),s.isWrapped=t;let n=r.ybase+r.scrollTop,l=r.ybase+r.scrollBottom;if(r.scrollTop===0){let u=r.lines.isFull;l===r.lines.length-1?u?r.lines.recycle().copyFrom(s):r.lines.push(s.clone()):r.lines.splice(l+1,0,s.clone()),u?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{let u=l-n+1;r.lines.shiftElements(n+1,u-1,-1),r.lines.set(l,s.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(e,t){let r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let s=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),s!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))}};a0=dr([Ne(0,ws)],a0);var Jl={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:pm,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},vX=["normal","bold","100","200","300","400","500","600","700","800","900"],_X=class extends lt{constructor(e){super(),this._onOptionChange=this._register(new we),this.onOptionChange=this._onOptionChange.event;let t={...Jl};for(let r in e)if(r in t)try{let s=e[r];t[r]=this._sanitizeAndValidateOption(r,s)}catch(s){console.error(s)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(Kt(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(r=>{r===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(r=>{e.indexOf(r)!==-1&&t()})}_setupOptions(){let e=r=>{if(!(r in Jl))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},t=(r,s)=>{if(!(r in Jl))throw new Error(`No option with key "${r}"`);s=this._sanitizeAndValidateOption(r,s),this.rawOptions[r]!==s&&(this.rawOptions[r]=s,this._onOptionChange.fire(r))};for(let r in this.rawOptions){let s={get:e.bind(this,r),set:t.bind(this,r)};Object.defineProperty(this.options,r,s)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=Jl[e]),!xX(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Jl[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=vX.includes(t)?t:Jl[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 xX(e){return e==="block"||e==="underline"||e==="bar"}function Fu(e,t=5){if(typeof e!="object")return e;let r=Array.isArray(e)?[]:{};for(let s in e)r[s]=t<=1?e[s]:e[s]&&Fu(e[s],t-1);return r}var tk=Object.freeze({insertMode:!1}),rk=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),o0=class extends lt{constructor(e,t,r){super(),this._bufferService=e,this._logService=t,this._optionsService=r,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new we),this.onData=this._onData.event,this._onUserInput=this._register(new we),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new we),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new we),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Fu(tk),this.decPrivateModes=Fu(rk)}reset(){this.modes=Fu(tk),this.decPrivateModes=Fu(rk)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let r=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&r.ybase!==r.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(s=>s.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};o0=dr([Ne(0,bs),Ne(1,WM),Ne(2,ws)],o0);var sk={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 R_(e,t){let r=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(r|=64,r|=e.action):(r|=e.button&3,e.button&4&&(r|=64),e.button&8&&(r|=128),e.action===32?r|=32:e.action===0&&!t&&(r|=3)),r}var N_=String.fromCharCode,ik={DEFAULT:e=>{let t=[R_(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${N_(t[0])}${N_(t[1])}${N_(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${R_(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${R_(e,!0)};${e.x};${e.y}${t}`}},l0=class extends lt{constructor(e,t,r){super(),this._bufferService=e,this._coreService=t,this._optionsService=r,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new we),this.onProtocolChange=this._onProtocolChange.event;for(let s of Object.keys(sk))this.addProtocol(s,sk[s]);for(let s of Object.keys(ik))this.addEncoding(s,ik[s]);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,r){if(e.deltaY===0||e.shiftKey||t===void 0||r===void 0)return 0;let s=t/r,n=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(n/=s+0,Math.abs(e.deltaY)<50&&(n*=.3),this._wheelPartialScroll+=n,n=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(n*=this._bufferService.rows),n}_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,r){if(r){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)}};l0=dr([Ne(0,bs),Ne(1,ll),Ne(2,ws)],l0);var j_=[[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]],yX=[[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]],Lr;function bX(e,t){let r=0,s=t.length-1,n;if(e<t[0][0]||e>t[s][1])return!1;for(;s>=r;)if(n=r+s>>1,e>t[n][1])r=n+1;else if(e<t[n][0])s=n-1;else return!0;return!1}var wX=class{constructor(){if(this.version="6",!Lr){Lr=new Uint8Array(65536),Lr.fill(1),Lr[0]=0,Lr.fill(0,1,32),Lr.fill(0,127,160),Lr.fill(2,4352,4448),Lr[9001]=2,Lr[9002]=2,Lr.fill(2,11904,42192),Lr[12351]=1,Lr.fill(2,44032,55204),Lr.fill(2,63744,64256),Lr.fill(2,65040,65050),Lr.fill(2,65072,65136),Lr.fill(2,65280,65377),Lr.fill(2,65504,65511);for(let e=0;e<j_.length;++e)Lr.fill(0,j_[e][0],j_[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Lr[e]:bX(e,yX)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let r=this.wcwidth(e),s=r===0&&t!==0;if(s){let n=Fo.extractWidth(t);n===0?s=!1:n>r&&(r=n)}return Fo.createPropertyValue(0,r,s)}},Fo=class Hf{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new we,this.onChange=this._onChange.event;let t=new wX;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,r,s=!1){return(t&16777215)<<3|(r&3)<<1|(s?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 r=0,s=0,n=t.length;for(let l=0;l<n;++l){let u=t.charCodeAt(l);if(55296<=u&&u<=56319){if(++l>=n)return r+this.wcwidth(u);let f=t.charCodeAt(l);56320<=f&&f<=57343?u=(u-55296)*1024+f-56320+65536:r+=this.wcwidth(f)}let d=this.charProperties(u,s),m=Hf.extractWidth(d);Hf.extractShouldJoin(d)&&(m-=Hf.extractWidth(s)),r+=m,s=d}return r}charProperties(t,r){return this._activeProvider.charProperties(t,r)}},SX=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 nk(e){var s;let t=(s=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:s.get(e.cols-1),r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);r&&t&&(r.isWrapped=t[3]!==0&&t[3]!==32)}var Tu=2147483647,CX=256,kT=class c0{constructor(t=32,r=32){if(this.maxLength=t,this.maxSubParamsLength=r,r>CX)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(r),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let r=new c0;if(!t.length)return r;for(let s=Array.isArray(t[0])?1:0;s<t.length;++s){let n=t[s];if(Array.isArray(n))for(let l=0;l<n.length;++l)r.addSubParam(n[l]);else r.addParam(n)}return r}clone(){let t=new c0(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 r=0;r<this.length;++r){t.push(this.params[r]);let s=this._subParamsIdx[r]>>8,n=this._subParamsIdx[r]&255;n-s>0&&t.push(Array.prototype.slice.call(this._subParams,s,n))}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>Tu?Tu: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>Tu?Tu:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let r=this._subParamsIdx[t]>>8,s=this._subParamsIdx[t]&255;return s-r>0?this._subParams.subarray(r,s):null}getSubParamsAll(){let t={};for(let r=0;r<this.length;++r){let s=this._subParamsIdx[r]>>8,n=this._subParamsIdx[r]&255;n-s>0&&(t[r]=this._subParams.slice(s,n))}return t}addDigit(t){let r;if(this._rejectDigits||!(r=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let s=this._digitIsSub?this._subParams:this.params,n=s[r-1];s[r-1]=~n?Math.min(n*10+t,Tu):t}},Du=[],kX=class{constructor(){this._state=0,this._active=Du,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 r=this._handlers[e];return r.push(t),{dispose:()=>{let s=r.indexOf(t);s!==-1&&r.splice(s,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=Du}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=Du,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Du,!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,r){if(!this._active.length)this._handlerFb(this._id,"PUT",op(e,t,r));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,r)}start(){this.reset(),this._state=1}put(e,t,r){if(this._state!==3){if(this._state===1)for(;t<r;){let s=e[t++];if(s===59){this._state=2,this._start();break}if(s<48||57<s){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+s-48}this._state===2&&r-t>0&&this._put(e,t,r)}}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 r=!1,s=this._active.length-1,n=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,r=t,n=this._stack.fallThrough,this._stack.paused=!1),!n&&r===!1){for(;s>=0&&(r=this._active[s].end(e),r!==!0);s--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,r;s--}for(;s>=0;s--)if(r=this._active[s].end(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,r}this._active=Du,this._id=-1,this._state=0}}},Fs=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=op(e,t,r),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(r=>(this._data="",this._hitLimit=!1,r));return this._data="",this._hitLimit=!1,t}},Lu=[],EX=class{constructor(){this._handlers=Object.create(null),this._active=Lu,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Lu}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(t),{dispose:()=>{let s=r.indexOf(t);s!==-1&&r.splice(s,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=Lu,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Lu,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let r=this._active.length-1;r>=0;r--)this._active[r].hook(t)}put(e,t,r){if(!this._active.length)this._handlerFb(this._ident,"PUT",op(e,t,r));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,r)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let r=!1,s=this._active.length-1,n=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,r=t,n=this._stack.fallThrough,this._stack.paused=!1),!n&&r===!1){for(;s>=0&&(r=this._active[s].unhook(e),r!==!0);s--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,r;s--}for(;s>=0;s--)if(r=this._active[s].unhook(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,r}this._active=Lu,this._ident=0}},Wu=new kT;Wu.addParam(0);var ak=class{constructor(e){this._handler=e,this._data="",this._params=Wu,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Wu,this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=op(e,t,r),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(r=>(this._params=Wu,this._data="",this._hitLimit=!1,r));return this._params=Wu,this._data="",this._hitLimit=!1,t}},RX=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,r,s){this.table[t<<8|e]=r<<4|s}addMany(e,t,r,s){for(let n=0;n<e.length;n++)this.table[t<<8|e[n]]=r<<4|s}},_i=160,NX=(function(){let e=new RX(4095),t=Array.apply(null,Array(256)).map((d,m)=>m),r=(d,m)=>t.slice(d,m),s=r(32,127),n=r(0,24);n.push(25),n.push.apply(n,r(28,32));let l=r(0,14),u;e.setDefault(1,0),e.addMany(s,0,2,0);for(u in l)e.addMany([24,26,153,154],u,3,0),e.addMany(r(128,144),u,3,0),e.addMany(r(144,152),u,3,0),e.add(156,u,0,0),e.add(27,u,11,1),e.add(157,u,4,8),e.addMany([152,158,159],u,0,7),e.add(155,u,11,3),e.add(144,u,11,9);return e.addMany(n,0,3,0),e.addMany(n,1,3,1),e.add(127,1,0,1),e.addMany(n,8,0,8),e.addMany(n,3,3,3),e.add(127,3,0,3),e.addMany(n,4,3,4),e.add(127,4,0,4),e.addMany(n,6,3,6),e.addMany(n,5,3,5),e.add(127,5,0,5),e.addMany(n,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(s,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(r(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(s,7,0,7),e.addMany(n,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(r(64,127),3,7,0),e.addMany(r(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(r(48,60),4,8,4),e.addMany(r(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(r(32,64),6,0,6),e.add(127,6,0,6),e.addMany(r(64,127),6,0,0),e.addMany(r(32,48),3,9,5),e.addMany(r(32,48),5,9,5),e.addMany(r(48,64),5,0,6),e.addMany(r(64,127),5,7,0),e.addMany(r(32,48),4,9,5),e.addMany(r(32,48),1,9,2),e.addMany(r(32,48),2,9,2),e.addMany(r(48,127),2,10,0),e.addMany(r(48,80),1,10,0),e.addMany(r(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(r(96,127),1,10,0),e.add(80,1,11,9),e.addMany(n,9,0,9),e.add(127,9,0,9),e.addMany(r(28,32),9,0,9),e.addMany(r(32,48),9,9,12),e.addMany(r(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(n,11,0,11),e.addMany(r(32,128),11,0,11),e.addMany(r(28,32),11,0,11),e.addMany(n,10,0,10),e.add(127,10,0,10),e.addMany(r(28,32),10,0,10),e.addMany(r(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(r(32,48),10,9,12),e.addMany(n,12,0,12),e.add(127,12,0,12),e.addMany(r(28,32),12,0,12),e.addMany(r(32,48),12,9,12),e.addMany(r(48,64),12,0,11),e.addMany(r(64,127),12,12,13),e.addMany(r(64,127),10,12,13),e.addMany(r(64,127),9,12,13),e.addMany(n,13,13,13),e.addMany(s,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(_i,0,2,0),e.add(_i,8,5,8),e.add(_i,6,0,6),e.add(_i,11,0,11),e.add(_i,13,13,13),e})(),jX=class extends lt{constructor(e=NX){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 kT,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,r,s)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,r)=>{},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(Kt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new kX),this._dcsParser=this._register(new EX),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let r=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(r=e.prefix.charCodeAt(0),r&&60>r||r>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 n=0;n<e.intermediates.length;++n){let l=e.intermediates.charCodeAt(n);if(32>l||l>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=l}}if(e.final.length!==1)throw new Error("final must be a single byte");let s=e.final.charCodeAt(0);if(t[0]>s||s>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return r<<=8,r|=s,r}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 r=this._identifier(e,[48,126]);this._escHandlers[r]===void 0&&(this._escHandlers[r]=[]);let s=this._escHandlers[r];return s.push(t),{dispose:()=>{let n=s.indexOf(t);n!==-1&&s.splice(n,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 r=this._identifier(e);this._csiHandlers[r]===void 0&&(this._csiHandlers[r]=[]);let s=this._csiHandlers[r];return s.push(t),{dispose:()=>{let n=s.indexOf(t);n!==-1&&s.splice(n,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,r,s,n){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=r,this._parseStack.transition=s,this._parseStack.chunkPos=n}parse(e,t,r){let s=0,n=0,l=0,u;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,l=this._parseStack.chunkPos+1;else{if(r===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,m=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&m>-1){for(;m>=0&&(u=d[m](this._params),u!==!0);m--)if(u instanceof Promise)return this._parseStack.handlerPos=m,u}this._parseStack.handlers=[];break;case 4:if(r===!1&&m>-1){for(;m>=0&&(u=d[m](),u!==!0);m--)if(u instanceof Promise)return this._parseStack.handlerPos=m,u}this._parseStack.handlers=[];break;case 6:if(s=e[this._parseStack.chunkPos],u=this._dcsParser.unhook(s!==24&&s!==26,r),u)return u;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(s=e[this._parseStack.chunkPos],u=this._oscParser.end(s!==24&&s!==26,r),u)return u;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,l=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let d=l;d<t;++d){switch(s=e[d],n=this._transitions.table[this.currentState<<8|(s<160?s:_i)],n>>4){case 2:for(let x=d+1;;++x){if(x>=t||(s=e[x])<32||s>126&&s<_i){this._printHandler(e,d,x),d=x-1;break}if(++x>=t||(s=e[x])<32||s>126&&s<_i){this._printHandler(e,d,x),d=x-1;break}if(++x>=t||(s=e[x])<32||s>126&&s<_i){this._printHandler(e,d,x),d=x-1;break}if(++x>=t||(s=e[x])<32||s>126&&s<_i){this._printHandler(e,d,x),d=x-1;break}}break;case 3:this._executeHandlers[s]?this._executeHandlers[s]():this._executeHandlerFb(s),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:d,code:s,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let m=this._csiHandlers[this._collect<<8|s],f=m?m.length-1:-1;for(;f>=0&&(u=m[f](this._params),u!==!0);f--)if(u instanceof Promise)return this._preserveStack(3,m,f,n,d),u;f<0&&this._csiHandlerFb(this._collect<<8|s,this._params),this.precedingJoinState=0;break;case 8:do switch(s){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(s-48)}while(++d<t&&(s=e[d])>47&&s<60);d--;break;case 9:this._collect<<=8,this._collect|=s;break;case 10:let v=this._escHandlers[this._collect<<8|s],p=v?v.length-1:-1;for(;p>=0&&(u=v[p](),u!==!0);p--)if(u instanceof Promise)return this._preserveStack(4,v,p,n,d),u;p<0&&this._escHandlerFb(this._collect<<8|s),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|s,this._params);break;case 13:for(let x=d+1;;++x)if(x>=t||(s=e[x])===24||s===26||s===27||s>127&&s<_i){this._dcsParser.put(e,d,x),d=x-1;break}break;case 14:if(u=this._dcsParser.unhook(s!==24&&s!==26),u)return this._preserveStack(6,[],0,n,d),u;s===27&&(n|=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 x=d+1;;x++)if(x>=t||(s=e[x])<32||s>127&&s<_i){this._oscParser.put(e,d,x),d=x-1;break}break;case 6:if(u=this._oscParser.end(s!==24&&s!==26),u)return this._preserveStack(5,[],0,n,d),u;s===27&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=n&15}}},AX=/^([\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})$/,MX=/^[\da-f]+$/;function ok(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let r=AX.exec(t);if(r){let s=r[1]?15:r[4]?255:r[7]?4095:65535;return[Math.round(parseInt(r[1]||r[4]||r[7]||r[10],16)/s*255),Math.round(parseInt(r[2]||r[5]||r[8]||r[11],16)/s*255),Math.round(parseInt(r[3]||r[6]||r[9]||r[12],16)/s*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),MX.exec(t)&&[3,6,9,12].includes(t.length))){let r=t.length/3,s=[0,0,0];for(let n=0;n<3;++n){let l=parseInt(t.slice(r*n,r*n+r),16);s[n]=r===1?l<<4:r===2?l:r===3?l>>4:l>>8}return s}}function A_(e,t){let r=e.toString(16),s=r.length<2?"0"+r:r;switch(t){case 4:return r[0];case 8:return s;case 12:return(s+s).slice(0,3);default:return s+s}}function TX(e,t=16){let[r,s,n]=e;return`rgb:${A_(r,t)}/${A_(s,t)}/${A_(n,t)}`}var DX={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Ha=131072,lk=10;function ck(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 uk=5e3,dk=0,LX=class extends lt{constructor(e,t,r,s,n,l,u,d,m=new jX){super(),this._bufferService=e,this._charsetService=t,this._coreService=r,this._logService=s,this._optionsService=n,this._oscLinkService=l,this._coreMouseService=u,this._unicodeService=d,this._parser=m,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new JG,this._utf8Decoder=new eY,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Sr.clone(),this._eraseAttrDataInternal=Sr.clone(),this._onRequestBell=this._register(new we),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new we),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new we),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new we),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new we),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new we),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new we),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new we),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new we),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new we),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new we),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new we),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new we),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 u0(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(f=>this._activeBuffer=f.activeBuffer)),this._parser.setCsiHandlerFallback((f,v)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(f),params:v.toArray()})}),this._parser.setEscHandlerFallback(f=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(f)})}),this._parser.setExecuteHandlerFallback(f=>{this._logService.debug("Unknown EXECUTE code: ",{code:f})}),this._parser.setOscHandlerFallback((f,v,p)=>{this._logService.debug("Unknown OSC code: ",{identifier:f,action:v,data:p})}),this._parser.setDcsHandlerFallback((f,v,p)=>{v==="HOOK"&&(p=p.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(f),action:v,payload:p})}),this._parser.setPrintHandler((f,v,p)=>this.print(f,v,p)),this._parser.registerCsiHandler({final:"@"},f=>this.insertChars(f)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},f=>this.scrollLeft(f)),this._parser.registerCsiHandler({final:"A"},f=>this.cursorUp(f)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},f=>this.scrollRight(f)),this._parser.registerCsiHandler({final:"B"},f=>this.cursorDown(f)),this._parser.registerCsiHandler({final:"C"},f=>this.cursorForward(f)),this._parser.registerCsiHandler({final:"D"},f=>this.cursorBackward(f)),this._parser.registerCsiHandler({final:"E"},f=>this.cursorNextLine(f)),this._parser.registerCsiHandler({final:"F"},f=>this.cursorPrecedingLine(f)),this._parser.registerCsiHandler({final:"G"},f=>this.cursorCharAbsolute(f)),this._parser.registerCsiHandler({final:"H"},f=>this.cursorPosition(f)),this._parser.registerCsiHandler({final:"I"},f=>this.cursorForwardTab(f)),this._parser.registerCsiHandler({final:"J"},f=>this.eraseInDisplay(f,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},f=>this.eraseInDisplay(f,!0)),this._parser.registerCsiHandler({final:"K"},f=>this.eraseInLine(f,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},f=>this.eraseInLine(f,!0)),this._parser.registerCsiHandler({final:"L"},f=>this.insertLines(f)),this._parser.registerCsiHandler({final:"M"},f=>this.deleteLines(f)),this._parser.registerCsiHandler({final:"P"},f=>this.deleteChars(f)),this._parser.registerCsiHandler({final:"S"},f=>this.scrollUp(f)),this._parser.registerCsiHandler({final:"T"},f=>this.scrollDown(f)),this._parser.registerCsiHandler({final:"X"},f=>this.eraseChars(f)),this._parser.registerCsiHandler({final:"Z"},f=>this.cursorBackwardTab(f)),this._parser.registerCsiHandler({final:"`"},f=>this.charPosAbsolute(f)),this._parser.registerCsiHandler({final:"a"},f=>this.hPositionRelative(f)),this._parser.registerCsiHandler({final:"b"},f=>this.repeatPrecedingCharacter(f)),this._parser.registerCsiHandler({final:"c"},f=>this.sendDeviceAttributesPrimary(f)),this._parser.registerCsiHandler({prefix:">",final:"c"},f=>this.sendDeviceAttributesSecondary(f)),this._parser.registerCsiHandler({final:"d"},f=>this.linePosAbsolute(f)),this._parser.registerCsiHandler({final:"e"},f=>this.vPositionRelative(f)),this._parser.registerCsiHandler({final:"f"},f=>this.hVPosition(f)),this._parser.registerCsiHandler({final:"g"},f=>this.tabClear(f)),this._parser.registerCsiHandler({final:"h"},f=>this.setMode(f)),this._parser.registerCsiHandler({prefix:"?",final:"h"},f=>this.setModePrivate(f)),this._parser.registerCsiHandler({final:"l"},f=>this.resetMode(f)),this._parser.registerCsiHandler({prefix:"?",final:"l"},f=>this.resetModePrivate(f)),this._parser.registerCsiHandler({final:"m"},f=>this.charAttributes(f)),this._parser.registerCsiHandler({final:"n"},f=>this.deviceStatus(f)),this._parser.registerCsiHandler({prefix:"?",final:"n"},f=>this.deviceStatusPrivate(f)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},f=>this.softReset(f)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},f=>this.setCursorStyle(f)),this._parser.registerCsiHandler({final:"r"},f=>this.setScrollRegion(f)),this._parser.registerCsiHandler({final:"s"},f=>this.saveCursor(f)),this._parser.registerCsiHandler({final:"t"},f=>this.windowOptions(f)),this._parser.registerCsiHandler({final:"u"},f=>this.restoreCursor(f)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},f=>this.insertColumns(f)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},f=>this.deleteColumns(f)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},f=>this.selectProtected(f)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},f=>this.requestMode(f,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},f=>this.requestMode(f,!1)),this._parser.setExecuteHandler(ve.BEL,()=>this.bell()),this._parser.setExecuteHandler(ve.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ve.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ve.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ve.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ve.BS,()=>this.backspace()),this._parser.setExecuteHandler(ve.HT,()=>this.tab()),this._parser.setExecuteHandler(ve.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ve.SI,()=>this.shiftIn()),this._parser.setExecuteHandler($f.IND,()=>this.index()),this._parser.setExecuteHandler($f.NEL,()=>this.nextLine()),this._parser.setExecuteHandler($f.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Fs(f=>(this.setTitle(f),this.setIconName(f),!0))),this._parser.registerOscHandler(1,new Fs(f=>this.setIconName(f))),this._parser.registerOscHandler(2,new Fs(f=>this.setTitle(f))),this._parser.registerOscHandler(4,new Fs(f=>this.setOrReportIndexedColor(f))),this._parser.registerOscHandler(8,new Fs(f=>this.setHyperlink(f))),this._parser.registerOscHandler(10,new Fs(f=>this.setOrReportFgColor(f))),this._parser.registerOscHandler(11,new Fs(f=>this.setOrReportBgColor(f))),this._parser.registerOscHandler(12,new Fs(f=>this.setOrReportCursorColor(f))),this._parser.registerOscHandler(104,new Fs(f=>this.restoreIndexedColor(f))),this._parser.registerOscHandler(110,new Fs(f=>this.restoreFgColor(f))),this._parser.registerOscHandler(111,new Fs(f=>this.restoreBgColor(f))),this._parser.registerOscHandler(112,new Fs(f=>this.restoreCursorColor(f))),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 f in Ir)this._parser.registerEscHandler({intermediates:"(",final:f},()=>this.selectCharset("("+f)),this._parser.registerEscHandler({intermediates:")",final:f},()=>this.selectCharset(")"+f)),this._parser.registerEscHandler({intermediates:"*",final:f},()=>this.selectCharset("*"+f)),this._parser.registerEscHandler({intermediates:"+",final:f},()=>this.selectCharset("+"+f)),this._parser.registerEscHandler({intermediates:"-",final:f},()=>this.selectCharset("-"+f)),this._parser.registerEscHandler({intermediates:".",final:f},()=>this.selectCharset("."+f)),this._parser.registerEscHandler({intermediates:"/",final:f},()=>this.selectCharset("/"+f));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(f=>(this._logService.error("Parsing error: ",f),f)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new ak((f,v)=>this.requestStatusString(f,v)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,r,s){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=r,this._parseStack.position=s}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,r)=>setTimeout(()=>r("#SLOW_TIMEOUT"),uk))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${uk} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let r,s=this._activeBuffer.x,n=this._activeBuffer.y,l=0,u=this._parseStack.paused;if(u){if(r=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(r),r;s=this._parseStack.cursorStartX,n=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Ha&&(l=this._parseStack.position+Ha)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,f=>String.fromCharCode(f)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(f=>f.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Ha&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Ha))),u||this._dirtyRowTracker.clearRange(),e.length>Ha)for(let f=l;f<e.length;f+=Ha){let v=f+Ha<e.length?f+Ha:e.length,p=typeof e=="string"?this._stringDecoder.decode(e.substring(f,v),this._parseBuffer):this._utf8Decoder.decode(e.subarray(f,v),this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,p))return this._preserveStack(s,n,p,f),this._logSlowResolvingAsync(r),r}else if(!u){let f=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,f))return this._preserveStack(s,n,f,0),this._logSlowResolvingAsync(r),r}(this._activeBuffer.x!==s||this._activeBuffer.y!==n)&&this._onCursorMove.fire();let d=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),m=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);m<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(m,this._bufferService.rows-1),end:Math.min(d,this._bufferService.rows-1)})}print(e,t,r){let s,n,l=this._charsetService.charset,u=this._optionsService.rawOptions.screenReaderMode,d=this._bufferService.cols,m=this._coreService.decPrivateModes.wraparound,f=this._coreService.modes.insertMode,v=this._curAttrData,p=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&r-t>0&&p.getWidth(this._activeBuffer.x-1)===2&&p.setCellFromCodepoint(this._activeBuffer.x-1,0,1,v);let x=this._parser.precedingJoinState;for(let b=t;b<r;++b){if(s=e[b],s<127&&l){let S=l[String.fromCharCode(s)];S&&(s=S.charCodeAt(0))}let w=this._unicodeService.charProperties(s,x);n=Fo.extractWidth(w);let C=Fo.extractShouldJoin(w),k=C?Fo.extractWidth(x):0;if(x=w,u&&this._onA11yChar.fire(Ga(s)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+n-k>d){if(m){let S=p,E=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),p=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),k>0&&p instanceof Hu&&p.copyCellsFrom(S,E,0,k,!1);E<d;)S.setCellFromCodepoint(E++,0,1,v)}else if(this._activeBuffer.x=d-1,n===2)continue}if(C&&this._activeBuffer.x){let S=p.getWidth(this._activeBuffer.x-1)?1:2;p.addCodepointToCell(this._activeBuffer.x-S,s,n);for(let E=n-k;--E>=0;)p.setCellFromCodepoint(this._activeBuffer.x++,0,0,v);continue}if(f&&(p.insertCells(this._activeBuffer.x,n-k,this._activeBuffer.getNullCell(v)),p.getWidth(d-1)===2&&p.setCellFromCodepoint(d-1,0,1,v)),p.setCellFromCodepoint(this._activeBuffer.x++,s,n,v),n>0)for(;--n;)p.setCellFromCodepoint(this._activeBuffer.x++,0,0,v)}this._parser.precedingJoinState=x,this._activeBuffer.x<d&&r-t>0&&p.getWidth(this._activeBuffer.x)===0&&!p.hasContent(this._activeBuffer.x)&&p.setCellFromCodepoint(this._activeBuffer.x,0,1,v),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,r=>ck(r.params[0],this._optionsService.rawOptions.windowOptions)?t(r):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new ak(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Fs(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,r,s=!1,n=!1){let l=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);l.replaceCells(t,r,this._activeBuffer.getNullCell(this._eraseAttrData()),n),s&&(l.isWrapped=!1)}_resetBufferLine(e,t=!1){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r&&(r.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),r.isWrapped=!1)}eraseInDisplay(e,t=!1){var s;this._restrictCursor(this._bufferService.cols);let r;switch(e.params[0]){case 0:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);r<this._bufferService.rows;r++)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(r);break;case 1:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(r+1).isWrapped=!1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(r=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,r-1);r--&&!((s=this._activeBuffer.lines.get(this._activeBuffer.ybase+r))!=null&&s.getTrimmedLength()););for(;r>=0;r--)this._bufferService.scroll(this._eraseAttrData())}else{for(r=this._bufferService.rows,this._dirtyRowTracker.markDirty(r-1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let n=this._activeBuffer.lines.length-this._bufferService.rows;n>0&&(this._activeBuffer.lines.trimStart(n),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-n,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-n,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 r=this._activeBuffer.ybase+this._activeBuffer.y,s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,n=this._bufferService.rows-1+this._activeBuffer.ybase-s+1;for(;t--;)this._activeBuffer.lines.splice(n-1,1),this._activeBuffer.lines.splice(r,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 r=this._activeBuffer.ybase+this._activeBuffer.y,s;for(s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-s;t--;)this._activeBuffer.lines.splice(r,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}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(Sr));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 r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);s.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.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 r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);s.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.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 r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);s.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.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 r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);s.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.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 r=e.params[0]||1,s=Fo.extractWidth(t),n=this._activeBuffer.x-s,l=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(n),u=new Uint32Array(l.length*r),d=0;for(let f=0;f<l.length;){let v=l.codePointAt(f)||0;u[d++]=v,f+=v>65535?2:1}let m=d;for(let f=1;f<r;++f)u.copyWithin(m,0,d),m+=d;return this.print(u,0,m),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(ve.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ve.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ve.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ve.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ve.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,$o),this._charsetService.setgCharset(1,$o),this._charsetService.setgCharset(2,$o),this._charsetService.setgCharset(3,$o);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){(C=>(C[C.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",C[C.SET=1]="SET",C[C.RESET=2]="RESET",C[C.PERMANENTLY_SET=3]="PERMANENTLY_SET",C[C.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(r={}));let s=this._coreService.decPrivateModes,{activeProtocol:n,activeEncoding:l}=this._coreMouseService,u=this._coreService,{buffers:d,cols:m}=this._bufferService,{active:f,alt:v}=d,p=this._optionsService.rawOptions,x=(C,k)=>(u.triggerDataEvent(`${ve.ESC}[${t?"":"?"}${C};${k}$y`),!0),b=C=>C?1:2,w=e.params[0];return t?w===2?x(w,4):w===4?x(w,b(u.modes.insertMode)):w===12?x(w,3):w===20?x(w,b(p.convertEol)):x(w,0):w===1?x(w,b(s.applicationCursorKeys)):w===3?x(w,p.windowOptions.setWinLines?m===80?2:m===132?1:0:0):w===6?x(w,b(s.origin)):w===7?x(w,b(s.wraparound)):w===8?x(w,3):w===9?x(w,b(n==="X10")):w===12?x(w,b(p.cursorBlink)):w===25?x(w,b(!u.isCursorHidden)):w===45?x(w,b(s.reverseWraparound)):w===66?x(w,b(s.applicationKeypad)):w===67?x(w,4):w===1e3?x(w,b(n==="VT200")):w===1002?x(w,b(n==="DRAG")):w===1003?x(w,b(n==="ANY")):w===1004?x(w,b(s.sendFocus)):w===1005?x(w,4):w===1006?x(w,b(l==="SGR")):w===1015?x(w,4):w===1016?x(w,b(l==="SGR_PIXELS")):w===1048?x(w,1):w===47||w===1047||w===1049?x(w,b(f===v)):w===2004?x(w,b(s.bracketedPasteMode)):w===2026?x(w,b(s.synchronizedOutput)):x(w,0)}_updateAttrColor(e,t,r,s,n){return t===2?(e|=50331648,e&=-16777216,e|=Rd.fromColorRGB([r,s,n])):t===5&&(e&=-50331904,e|=33554432|r&255),e}_extractColor(e,t,r){let s=[0,0,-1,0,0,0],n=0,l=0;do{if(s[l+n]=e.params[t+l],e.hasSubParams(t+l)){let u=e.getSubParams(t+l),d=0;do s[1]===5&&(n=1),s[l+d+1+n]=u[d];while(++d<u.length&&d+l+1+n<s.length);break}if(s[1]===5&&l+n>=2||s[1]===2&&l+n>=5)break;s[1]&&(n=1)}while(++l+t<e.length&&l+n<s.length);for(let u=2;u<s.length;++u)s[u]===-1&&(s[u]=0);switch(s[0]){case 38:r.fg=this._updateAttrColor(r.fg,s[1],s[3],s[4],s[5]);break;case 48:r.bg=this._updateAttrColor(r.bg,s[1],s[3],s[4],s[5]);break;case 58:r.extended=r.extended.clone(),r.extended.underlineColor=this._updateAttrColor(r.extended.underlineColor,s[1],s[3],s[4],s[5])}return l}_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=Sr.fg,e.bg=Sr.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,r,s=this._curAttrData;for(let n=0;n<t;n++)r=e.params[n],r>=30&&r<=37?(s.fg&=-50331904,s.fg|=16777216|r-30):r>=40&&r<=47?(s.bg&=-50331904,s.bg|=16777216|r-40):r>=90&&r<=97?(s.fg&=-50331904,s.fg|=16777216|r-90|8):r>=100&&r<=107?(s.bg&=-50331904,s.bg|=16777216|r-100|8):r===0?this._processSGR0(s):r===1?s.fg|=134217728:r===3?s.bg|=67108864:r===4?(s.fg|=268435456,this._processUnderline(e.hasSubParams(n)?e.getSubParams(n)[0]:1,s)):r===5?s.fg|=536870912:r===7?s.fg|=67108864:r===8?s.fg|=1073741824:r===9?s.fg|=2147483648:r===2?s.bg|=134217728:r===21?this._processUnderline(2,s):r===22?(s.fg&=-134217729,s.bg&=-134217729):r===23?s.bg&=-67108865:r===24?(s.fg&=-268435457,this._processUnderline(0,s)):r===25?s.fg&=-536870913:r===27?s.fg&=-67108865:r===28?s.fg&=-1073741825:r===29?s.fg&=2147483647:r===39?(s.fg&=-67108864,s.fg|=Sr.fg&16777215):r===49?(s.bg&=-67108864,s.bg|=Sr.bg&16777215):r===38||r===48||r===58?n+=this._extractColor(e,n,s):r===53?s.bg|=1073741824:r===55?s.bg&=-1073741825:r===59?(s.extended=s.extended.clone(),s.extended.underlineColor=-1,s.updateExtended()):r===100?(s.fg&=-67108864,s.fg|=Sr.fg&16777215,s.bg&=-67108864,s.bg|=Sr.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",r);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${ve.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ve.ESC}[${t};${r}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ve.ESC}[?${t};${r}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=Sr.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 r=t%2===1;this._coreService.decPrivateModes.cursorBlink=r}return!0}setScrollRegion(e){let t=e.params[0]||1,r;return(e.length<2||(r=e.params[1])>this._bufferService.rows||r===0)&&(r=this._bufferService.rows),r>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=r-1,this._setCursor(0,0)),!0}windowOptions(e){if(!ck(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(`${ve.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>lk&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>lk&&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=[],r=e.split(";");for(;r.length>1;){let s=r.shift(),n=r.shift();if(/^\d+$/.exec(s)){let l=parseInt(s);if(hk(l))if(n==="?")t.push({type:0,index:l});else{let u=ok(n);u&&t.push({type:1,index:l,color:u})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let r=e.slice(0,t).trim(),s=e.slice(t+1);return s?this._createHyperlink(r,s):r.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let r=e.split(":"),s,n=r.findIndex(l=>l.startsWith("id="));return n!==-1&&(s=r[n].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:s,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 r=e.split(";");for(let s=0;s<r.length&&!(t>=this._specialColors.length);++s,++t)if(r[s]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let n=ok(r[s]);n&&this._onColor.fire([{type:1,index:this._specialColors[t],color:n}])}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=[],r=e.split(";");for(let s=0;s<r.length;++s)if(/^\d+$/.exec(r[s])){let n=parseInt(r[s]);hk(n)&&t.push({type:2,index:n})}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,$o),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(DX[e[0]],Ir[e[1]]||$o),!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=Sr.clone(),this._eraseAttrDataInternal=Sr.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 Si;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 r=this._activeBuffer.ybase+this._activeBuffer.y+t,s=this._activeBuffer.lines.get(r);s&&(s.fill(e),s.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let r=u=>(this._coreService.triggerDataEvent(`${ve.ESC}${u}${ve.ESC}\\`),!0),s=this._bufferService.buffer,n=this._optionsService.rawOptions;return r(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${s.scrollTop+1};${s.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[n.cursorStyle]-(n.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},u0=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&&(dk=e,e=t,t=dk),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};u0=dr([Ne(0,bs)],u0);function hk(e){return 0<=e&&e<256}var OX=5e7,fk=12,BX=50,PX=class extends lt{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 we),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 r;for(;r=this._writeBuffer.shift();){this._action(r);let s=this._callbacks.shift();s&&s()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>OX)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 r=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let s=this._writeBuffer[this._bufferOffset],n=this._action(s,t);if(n){let u=d=>performance.now()-r>=fk?setTimeout(()=>this._innerWrite(0,d)):this._innerWrite(r,d);n.catch(d=>(queueMicrotask(()=>{throw d}),Promise.resolve(!1))).then(u);return}let l=this._callbacks[this._bufferOffset];if(l&&l(),this._bufferOffset++,this._pendingData-=s.length,performance.now()-r>=fk)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>BX&&(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()}},d0=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),m={data:e,id:this._nextId++,lines:[d]};return d.onDispose(()=>this._removeMarkerFromLink(m,d)),this._dataByLinkId.set(m.id,m),m.id}let r=e,s=this._getEntryIdKey(r),n=this._entriesWithId.get(s);if(n)return this.addLineToLink(n.id,t.ybase+t.y),n.id;let l=t.addMarker(t.ybase+t.y),u={id:this._nextId++,key:this._getEntryIdKey(r),data:r,lines:[l]};return l.onDispose(()=>this._removeMarkerFromLink(u,l)),this._entriesWithId.set(u.key,u),this._dataByLinkId.set(u.id,u),u.id}addLineToLink(e,t){let r=this._dataByLinkId.get(e);if(r&&r.lines.every(s=>s.line!==t)){let s=this._bufferService.buffer.addMarker(t);r.lines.push(s),s.onDispose(()=>this._removeMarkerFromLink(r,s))}}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 r=e.lines.indexOf(t);r!==-1&&(e.lines.splice(r,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};d0=dr([Ne(0,bs)],d0);var mk=!1,IX=class extends lt{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new pc),this._onBinary=this._register(new we),this.onBinary=this._onBinary.event,this._onData=this._register(new we),this.onData=this._onData.event,this._onLineFeed=this._register(new we),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new we),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new we),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new we),this._instantiationService=new lX,this.optionsService=this._register(new _X(e)),this._instantiationService.setService(ws,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(a0)),this._instantiationService.setService(bs,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(n0)),this._instantiationService.setService(WM,this._logService),this.coreService=this._register(this._instantiationService.createInstance(o0)),this._instantiationService.setService(ll,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(l0)),this._instantiationService.setService(FM,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Fo)),this._instantiationService.setService(iY,this.unicodeService),this._charsetService=this._instantiationService.createInstance(SX),this._instantiationService.setService(sY,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(d0),this._instantiationService.setService(qM,this._oscLinkService),this._inputHandler=this._register(new LX(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(os.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(os.forward(this._bufferService.onResize,this._onResize)),this._register(os.forward(this.coreService.onData,this._onData)),this._register(os.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 PX((t,r)=>this._inputHandler.parse(t,r))),this._register(os.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new we),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&&!mk&&(this._logService.warn("writeSync is unreliable and will be removed soon."),mk=!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,ST),t=Math.max(t,CT),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(nk.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(nk(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Kt(()=>{for(let t of e)t.dispose()})}}},zX={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 $X(e,t,r,s){var u;let n={type:0,cancel:!1,key:void 0},l=(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?n.key=ve.ESC+"OA":n.key=ve.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?n.key=ve.ESC+"OD":n.key=ve.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?n.key=ve.ESC+"OC":n.key=ve.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?n.key=ve.ESC+"OB":n.key=ve.ESC+"[B");break;case 8:n.key=e.ctrlKey?"\b":ve.DEL,e.altKey&&(n.key=ve.ESC+n.key);break;case 9:if(e.shiftKey){n.key=ve.ESC+"[Z";break}n.key=ve.HT,n.cancel=!0;break;case 13:n.key=e.altKey?ve.ESC+ve.CR:ve.CR,n.cancel=!0;break;case 27:n.key=ve.ESC,e.altKey&&(n.key=ve.ESC+ve.ESC),n.cancel=!0;break;case 37:if(e.metaKey)break;l?n.key=ve.ESC+"[1;"+(l+1)+"D":t?n.key=ve.ESC+"OD":n.key=ve.ESC+"[D";break;case 39:if(e.metaKey)break;l?n.key=ve.ESC+"[1;"+(l+1)+"C":t?n.key=ve.ESC+"OC":n.key=ve.ESC+"[C";break;case 38:if(e.metaKey)break;l?n.key=ve.ESC+"[1;"+(l+1)+"A":t?n.key=ve.ESC+"OA":n.key=ve.ESC+"[A";break;case 40:if(e.metaKey)break;l?n.key=ve.ESC+"[1;"+(l+1)+"B":t?n.key=ve.ESC+"OB":n.key=ve.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(n.key=ve.ESC+"[2~");break;case 46:l?n.key=ve.ESC+"[3;"+(l+1)+"~":n.key=ve.ESC+"[3~";break;case 36:l?n.key=ve.ESC+"[1;"+(l+1)+"H":t?n.key=ve.ESC+"OH":n.key=ve.ESC+"[H";break;case 35:l?n.key=ve.ESC+"[1;"+(l+1)+"F":t?n.key=ve.ESC+"OF":n.key=ve.ESC+"[F";break;case 33:e.shiftKey?n.type=2:e.ctrlKey?n.key=ve.ESC+"[5;"+(l+1)+"~":n.key=ve.ESC+"[5~";break;case 34:e.shiftKey?n.type=3:e.ctrlKey?n.key=ve.ESC+"[6;"+(l+1)+"~":n.key=ve.ESC+"[6~";break;case 112:l?n.key=ve.ESC+"[1;"+(l+1)+"P":n.key=ve.ESC+"OP";break;case 113:l?n.key=ve.ESC+"[1;"+(l+1)+"Q":n.key=ve.ESC+"OQ";break;case 114:l?n.key=ve.ESC+"[1;"+(l+1)+"R":n.key=ve.ESC+"OR";break;case 115:l?n.key=ve.ESC+"[1;"+(l+1)+"S":n.key=ve.ESC+"OS";break;case 116:l?n.key=ve.ESC+"[15;"+(l+1)+"~":n.key=ve.ESC+"[15~";break;case 117:l?n.key=ve.ESC+"[17;"+(l+1)+"~":n.key=ve.ESC+"[17~";break;case 118:l?n.key=ve.ESC+"[18;"+(l+1)+"~":n.key=ve.ESC+"[18~";break;case 119:l?n.key=ve.ESC+"[19;"+(l+1)+"~":n.key=ve.ESC+"[19~";break;case 120:l?n.key=ve.ESC+"[20;"+(l+1)+"~":n.key=ve.ESC+"[20~";break;case 121:l?n.key=ve.ESC+"[21;"+(l+1)+"~":n.key=ve.ESC+"[21~";break;case 122:l?n.key=ve.ESC+"[23;"+(l+1)+"~":n.key=ve.ESC+"[23~";break;case 123:l?n.key=ve.ESC+"[24;"+(l+1)+"~":n.key=ve.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?n.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?n.key=ve.NUL:e.keyCode>=51&&e.keyCode<=55?n.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?n.key=ve.DEL:e.keyCode===219?n.key=ve.ESC:e.keyCode===220?n.key=ve.FS:e.keyCode===221&&(n.key=ve.GS);else if((!r||s)&&e.altKey&&!e.metaKey){let d=(u=zX[e.keyCode])==null?void 0:u[e.shiftKey?1:0];if(d)n.key=ve.ESC+d;else if(e.keyCode>=65&&e.keyCode<=90){let m=e.ctrlKey?e.keyCode-64:e.keyCode+32,f=String.fromCharCode(m);e.shiftKey&&(f=f.toUpperCase()),n.key=ve.ESC+f}else if(e.keyCode===32)n.key=ve.ESC+(e.ctrlKey?ve.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let m=e.code.slice(3,4);e.shiftKey||(m=m.toLowerCase()),n.key=ve.ESC+m,n.cancel=!0}}else r&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(n.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?n.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(n.key=ve.US),e.key==="@"&&(n.key=ve.NUL));break}return n}var vr=0,UX=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new gm,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new gm,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((n,l)=>this._getKey(n)-this._getKey(l)),t=0,r=0,s=new Array(this._array.length+this._insertedValues.length);for(let n=0;n<s.length;n++)r>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[r])?(s[n]=e[t],t++):s[n]=this._array[r++];this._array=s,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||(vr=this._search(t),vr===-1)||this._getKey(this._array[vr])!==t)return!1;do if(this._array[vr]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(vr),!0;while(++vr<this._array.length&&this._getKey(this._array[vr])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((n,l)=>n-l),t=0,r=new Array(this._array.length-e.length),s=0;for(let n=0;n<this._array.length;n++)e[t]===n?t++:r[s++]=this._array[n];this._array=r,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&&(vr=this._search(e),!(vr<0||vr>=this._array.length)&&this._getKey(this._array[vr])===e))do yield this._array[vr];while(++vr<this._array.length&&this._getKey(this._array[vr])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(vr=this._search(e),!(vr<0||vr>=this._array.length)&&this._getKey(this._array[vr])===e))do t(this._array[vr]);while(++vr<this._array.length&&this._getKey(this._array[vr])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,r=this._array.length-1;for(;r>=t;){let s=t+r>>1,n=this._getKey(this._array[s]);if(n>e)r=s-1;else if(n<e)t=s+1;else{for(;s>0&&this._getKey(this._array[s-1])===e;)s--;return s}}return t}},M_=0,pk=0,HX=class extends lt{constructor(){super(),this._decorations=new UX(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new we),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new we),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Kt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new FX(e);if(t){let r=t.marker.onDispose(()=>t.dispose()),s=t.onDispose(()=>{s.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),r.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,r){let s=0,n=0;for(let l of this._decorations.getKeyIterator(t))s=l.options.x??0,n=s+(l.options.width??1),e>=s&&e<n&&(!r||(l.options.layer??"bottom")===r)&&(yield l)}forEachDecorationAtCell(e,t,r,s){this._decorations.forEachByKey(t,n=>{M_=n.options.x??0,pk=M_+(n.options.width??1),e>=M_&&e<pk&&(!r||(n.options.layer??"bottom")===r)&&s(n)})}},FX=class extends Ja{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new we),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new we),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=Jt.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Jt.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},WX=1e3,qX=class{constructor(e,t=WX){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,r){this._rowCount=r,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 s=performance.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){let n=s-this._lastRefreshMs,l=this._debounceThresholdMS-n;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},l)}}_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)}},gk=20,vm=class extends lt{constructor(e,t,r,s){super(),this._terminal=e,this._coreBrowserService=r,this._renderService=s,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let n=this._coreBrowserService.mainDocument;this._accessibilityContainer=n.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=n.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let l=0;l<this._terminal.rows;l++)this._rowElements[l]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[l]);if(this._topBoundaryFocusListener=l=>this._handleBoundaryFocus(l,0),this._bottomBoundaryFocusListener=l=>this._handleBoundaryFocus(l,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=n.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new qX(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(l=>this._handleResize(l.rows))),this._register(this._terminal.onRender(l=>this._refreshRows(l.start,l.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(l=>this._handleChar(l))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
707
|
-
`))),this._register(this._terminal.onA11yTab(l=>this._handleTab(l))),this._register(this._terminal.onKey(l=>this._handleKey(l.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Ke(n,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Kt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<gk+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
708
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===gk+1&&(this._liveRegion.textContent+=Mx.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 r=this._terminal.buffer,s=r.lines.length.toString();for(let n=e;n<=t;n++){let l=r.lines.get(r.ydisp+n),u=[],d=(l==null?void 0:l.translateToString(!0,void 0,void 0,u))||"",m=(r.ydisp+n+1).toString(),f=this._rowElements[n];f&&(d.length===0?(f.textContent=" ",this._rowColumns.set(f,[0,1])):(f.textContent=d,this._rowColumns.set(f,u)),f.setAttribute("aria-posinset",m),f.setAttribute("aria-setsize",s),this._alignRowWidth(f))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let r=e.target,s=this._rowElements[t===0?1:this._rowElements.length-2],n=r.getAttribute("aria-posinset"),l=t===0?"1":`${this._terminal.buffer.lines.length}`;if(n===l||e.relatedTarget!==s)return;let u,d;if(t===0?(u=r,d=this._rowElements.pop(),this._rowContainer.removeChild(d)):(u=this._rowElements.shift(),d=r,this._rowContainer.removeChild(u)),u.removeEventListener("focus",this._topBoundaryFocusListener),d.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let m=this._createAccessibilityTreeNode();this._rowElements.unshift(m),this._rowContainer.insertAdjacentElement("afterbegin",m)}else{let m=this._createAccessibilityTreeNode();this._rowElements.push(m),this._rowContainer.appendChild(m)}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},r={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(r.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===r.node&&t.offset>r.offset)&&([t,r]=[r,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 s=this._rowElements.slice(-1)[0];if(r.node.compareDocumentPosition(s)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(r={node:s,offset:((d=s.textContent)==null?void 0:d.length)??0}),!this._rowContainer.contains(r.node))return;let n=({node:m,offset:f})=>{let v=m instanceof Text?m.parentNode:m,p=parseInt(v==null?void 0:v.getAttribute("aria-posinset"),10)-1;if(isNaN(p))return console.warn("row is invalid. Race condition?"),null;let x=this._rowColumns.get(v);if(!x)return console.warn("columns is null. Race condition?"),null;let b=f<x.length?x[f]:x.slice(-1)[0]+1;return b>=this._terminal.cols&&(++p,b=0),{row:p,column:b}},l=n(t),u=n(r);if(!(!l||!u)){if(l.row>u.row||l.row===u.row&&l.column>=u.column)throw new Error("invalid range");this._terminal.select(l.column,l.row,(u.row-l.row)*this._terminal.cols-l.column+u.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 n,l;e.style.transform="";let t=e.getBoundingClientRect().width,r=(l=(n=this._rowColumns.get(e))==null?void 0:n.slice(-1))==null?void 0:l[0];if(!r)return;let s=r*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${s/t})`}};vm=dr([Ne(1,Py),Ne(2,ha),Ne(3,fa)],vm);var h0=class extends lt{constructor(e,t,r,s,n){super(),this._element=e,this._mouseService=t,this._renderService=r,this._bufferService=s,this._linkProviderService=n,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new we),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new we),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Kt(()=>{var l;Jo(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(l=this._activeProviderReplies)==null||l.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Ke(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Ke(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Ke(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Ke(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 r=e.composedPath();for(let s=0;s<r.length;s++){let n=r[s];if(n.classList.contains("xterm"))break;if(n.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 s,n;(!this._activeProviderReplies||!t)&&((s=this._activeProviderReplies)==null||s.forEach(l=>{l==null||l.forEach(u=>{u.link.dispose&&u.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let r=!1;for(let[l,u]of this._linkProviderService.linkProviders.entries())t?(n=this._activeProviderReplies)!=null&&n.get(l)&&(r=this._checkLinkProviderResult(l,e,r)):u.provideLinks(e.y,d=>{var f,v;if(this._isMouseOut)return;let m=d==null?void 0:d.map(p=>({link:p}));(f=this._activeProviderReplies)==null||f.set(l,m),r=this._checkLinkProviderResult(l,e,r),((v=this._activeProviderReplies)==null?void 0:v.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let r=new Set;for(let s=0;s<t.size;s++){let n=t.get(s);if(n)for(let l=0;l<n.length;l++){let u=n[l],d=u.link.range.start.y<e?0:u.link.range.start.x,m=u.link.range.end.y>e?this._bufferService.cols:u.link.range.end.x;for(let f=d;f<=m;f++){if(r.has(f)){n.splice(l--,1);break}r.add(f)}}}}_checkLinkProviderResult(e,t,r){var l;if(!this._activeProviderReplies)return r;let s=this._activeProviderReplies.get(e),n=!1;for(let u=0;u<e;u++)(!this._activeProviderReplies.has(u)||this._activeProviderReplies.get(u))&&(n=!0);if(!n&&s){let u=s.find(d=>this._linkAtPosition(d.link,t));u&&(r=!0,this._handleNewLink(u))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let u=0;u<this._activeProviderReplies.size;u++){let d=(l=this._activeProviderReplies.get(u))==null?void 0:l.find(m=>this._linkAtPosition(m.link,t));if(d){r=!0,this._handleNewLink(d);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&VX(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,Jo(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 r,s;return(s=(r=this._currentLink)==null?void 0:r.state)==null?void 0:s.decorations.pointerCursor},set:r=>{var s;(s=this._currentLink)!=null&&s.state&&this._currentLink.state.decorations.pointerCursor!==r&&(this._currentLink.state.decorations.pointerCursor=r,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",r))}},underline:{get:()=>{var r,s;return(s=(r=this._currentLink)==null?void 0:r.state)==null?void 0:s.decorations.underline},set:r=>{var s,n,l;(s=this._currentLink)!=null&&s.state&&((l=(n=this._currentLink)==null?void 0:n.state)==null?void 0:l.decorations.underline)!==r&&(this._currentLink.state.decorations.underline=r,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,r))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(r=>{if(!this._currentLink)return;let s=r.start===0?0:r.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+r.end;if(this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(s,n),this._lastMouseEvent)){let l=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);l&&this._askForLink(l,!1)}})))}_linkHover(e,t,r){var s;(s=this._currentLink)!=null&&s.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(r,t.text)}_fireUnderlineEvent(e,t){let r=e.range,s=this._bufferService.buffer.ydisp,n=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-s-1,r.end.x,r.end.y-s-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(n)}_linkLeave(e,t,r){var s;(s=this._currentLink)!=null&&s.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(r,t.text)}_linkAtPosition(e,t){let r=e.range.start.y*this._bufferService.cols+e.range.start.x,s=e.range.end.y*this._bufferService.cols+e.range.end.x,n=t.y*this._bufferService.cols+t.x;return r<=n&&n<=s}_positionFromMouseEvent(e,t,r){let s=r.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(s)return{x:s[0],y:s[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,r,s,n){return{x1:e,y1:t,x2:r,y2:s,cols:this._bufferService.cols,fg:n}}};h0=dr([Ne(1,Iy),Ne(2,fa),Ne(3,bs),Ne(4,GM)],h0);function VX(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 GX=class extends IX{constructor(e={}){super(e),this._linkifier=this._register(new pc),this.browser=hT,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new pc),this._onCursorMove=this._register(new we),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new we),this.onKey=this._onKey.event,this._onRender=this._register(new we),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new we),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new we),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new we),this.onBell=this._onBell.event,this._onFocus=this._register(new we),this._onBlur=this._register(new we),this._onA11yCharEmitter=this._register(new we),this._onA11yTabEmitter=this._register(new we),this._onWillOpen=this._register(new we),this._setup(),this._decorationService=this._instantiationService.createInstance(HX),this._instantiationService.setService(Nd,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(BK),this._instantiationService.setService(GM,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Dx)),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(os.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(os.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(os.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(os.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(Kt(()=>{var t,r;this._customKeyEventHandler=void 0,(r=(t=this.element)==null?void 0:t.parentNode)==null||r.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 r,s="";switch(t.index){case 256:r="foreground",s="10";break;case 257:r="background",s="11";break;case 258:r="cursor",s="12";break;default:r="ansi",s="4;"+t.index}switch(t.type){case 0:let n=Wt.toColorRGB(r==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[r]);this.coreService.triggerDataEvent(`${ve.ESC}]${s};${TX(n)}${uT.ST}`);break;case 1:if(r==="ansi")this._themeService.modifyColors(l=>l.ansi[t.index]=kr.toColor(...t.color));else{let l=r;this._themeService.modifyColors(u=>u[l]=kr.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(vm,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ve.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(ve.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 r=Math.min(this.buffer.x,this.cols-1),s=this._renderService.dimensions.css.cell.height,n=t.getWidth(r),l=this._renderService.dimensions.css.cell.width*n,u=this.buffer.y*this._renderService.dimensions.css.cell.height,d=r*this._renderService.dimensions.css.cell.width;this.textarea.style.left=d+"px",this.textarea.style.top=u+"px",this.textarea.style.width=l+"px",this.textarea.style.height=s+"px",this.textarea.style.lineHeight=s+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Ke(this.element,"copy",t=>{this.hasSelection()&&ZG(t,this._selectionService)}));let e=t=>QG(t,this.textarea,this.coreService,this.optionsService);this._register(Ke(this.textarea,"paste",e)),this._register(Ke(this.element,"paste",e)),fT?this._register(Ke(this.element,"mousedown",t=>{t.button===2&&E5(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Ke(this.element,"contextmenu",t=>{E5(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Vy&&this._register(Ke(this.element,"auxclick",t=>{t.button===1&&IM(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Ke(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Ke(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Ke(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Ke(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Ke(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Ke(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Ke(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var n;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"),((n=this.element)==null?void 0:n.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(Ke(this.screenElement,"mousemove",l=>this.updateCursorStyle(l))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let r=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Ax.get()),gT||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",()=>r.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(LK,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(ha,this._coreBrowserService),this._register(Ke(this.textarea,"focus",l=>this._handleTextAreaFocus(l))),this._register(Ke(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(e0,this._document,this._helperContainer),this._instantiationService.setService(lp,this._charSizeService),this._themeService=this._instantiationService.createInstance(i0),this._instantiationService.setService(kc,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(mm),this._instantiationService.setService(VM,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(r0,this.rows,this.screenElement)),this._instantiationService.setService(fa,this._renderService),this._register(this._renderService.onRenderedViewportChange(l=>this._onRender.fire(l))),this.onResize(l=>this._renderService.resize(l.cols,l.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Zx,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(t0),this._instantiationService.setService(Iy,this._mouseService);let s=this._linkifier.value=this._register(this._instantiationService.createInstance(h0,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(Kx,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(l=>{super.scrollLines(l,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(s0,this.element,this.screenElement,s)),this._instantiationService.setService(aY,this._selectionService),this._register(this._selectionService.onRequestScrollLines(l=>this.scrollLines(l.amount,l.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(l=>this._renderService.handleSelectionChanged(l.start,l.end,l.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(l=>{this.textarea.value=l,this.textarea.focus(),this.textarea.select()})),this._register(os.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var l;this._selectionService.refresh(),(l=this._viewport)==null||l.queueSync()})),this._register(this._instantiationService.createInstance(Xx,this.screenElement)),this._register(Ke(this.element,"mousedown",l=>this._selectionService.handleMouseDown(l))),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(vm,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",l=>this._handleScreenReaderModeOptionChange(l))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(fm,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",l=>{!this._overviewRulerRenderer&&l&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(fm,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Jx,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function r(l){var f,v,p,x,b;let u=e._mouseService.getMouseReportCoords(l,e.screenElement);if(!u)return!1;let d,m;switch(l.overrideType||l.type){case"mousemove":m=32,l.buttons===void 0?(d=3,l.button!==void 0&&(d=l.button<3?l.button:3)):d=l.buttons&1?0:l.buttons&4?1:l.buttons&2?2:3;break;case"mouseup":m=0,d=l.button<3?l.button:3;break;case"mousedown":m=1,d=l.button<3?l.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(l)===!1)return!1;let w=l.deltaY;if(w===0||e.coreMouseService.consumeWheelEvent(l,(x=(p=(v=(f=e._renderService)==null?void 0:f.dimensions)==null?void 0:v.device)==null?void 0:p.cell)==null?void 0:x.height,(b=e._coreBrowserService)==null?void 0:b.dpr)===0)return!1;m=w<0?0:1,d=4;break;default:return!1}return m===void 0||d===void 0||d>4?!1:e.coreMouseService.triggerMouseEvent({col:u.col,row:u.row,x:u.x,y:u.y,button:d,action:m,ctrl:l.ctrlKey,alt:l.altKey,shift:l.shiftKey})}let s={mouseup:null,wheel:null,mousedrag:null,mousemove:null},n={mouseup:l=>(r(l),l.buttons||(this._document.removeEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.removeEventListener("mousemove",s.mousedrag)),this.cancel(l)),wheel:l=>(r(l),this.cancel(l,!0)),mousedrag:l=>{l.buttons&&r(l)},mousemove:l=>{l.buttons||r(l)}};this._register(this.coreMouseService.onProtocolChange(l=>{l?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(l)),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()),l&8?s.mousemove||(t.addEventListener("mousemove",n.mousemove),s.mousemove=n.mousemove):(t.removeEventListener("mousemove",s.mousemove),s.mousemove=null),l&16?s.wheel||(t.addEventListener("wheel",n.wheel,{passive:!1}),s.wheel=n.wheel):(t.removeEventListener("wheel",s.wheel),s.wheel=null),l&2?s.mouseup||(s.mouseup=n.mouseup):(this._document.removeEventListener("mouseup",s.mouseup),s.mouseup=null),l&4?s.mousedrag||(s.mousedrag=n.mousedrag):(this._document.removeEventListener("mousemove",s.mousedrag),s.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Ke(t,"mousedown",l=>{if(l.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(l)))return r(l),s.mouseup&&this._document.addEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.addEventListener("mousemove",s.mousedrag),this.cancel(l)})),this._register(Ke(t,"wheel",l=>{var u,d,m,f,v;if(!s.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(l)===!1)return!1;if(!this.buffer.hasScrollback){if(l.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(l,(f=(m=(d=(u=e._renderService)==null?void 0:u.dimensions)==null?void 0:d.device)==null?void 0:m.cell)==null?void 0:f.height,(v=e._coreBrowserService)==null?void 0:v.dpr)===0)return this.cancel(l,!0);let p=ve.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(l.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(p,!0),this.cancel(l,!0)}}},{passive:!1}))}refresh(e,t){var r;(r=this._renderService)==null||r.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){PM(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,r){this._selectionService.setSelection(e,t,r)}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 r;(r=this._selectionService)==null||r.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 r=$X(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),r.type===3||r.type===2){let s=this.rows-1;return this.scrollLines(r.type===2?-s:s),this.cancel(e,!0)}if(r.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(r.cancel&&this.cancel(e,!0),!r.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((r.key===ve.ETX||r.key===ve.CR)&&(this.textarea.value=""),this._onKey.fire({key:r.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(r.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let r=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"?r:r&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(YX(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 r;(r=this._charSizeService)==null||r.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(Sr));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(ve.ESC+"[I"):this.coreService.triggerDataEvent(ve.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),r=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${ve.ESC}[4;${r};${t}t`);break;case 1:let s=this._renderService.dimensions.css.cell.width.toFixed(0),n=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${ve.ESC}[6;${n};${s}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function YX(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var KX=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let r={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(r),t.dispose=()=>this._wrappedAddonDispose(r),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let r=0;r<this._addons.length;r++)if(this._addons[r]===e){t=r;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)}},XX=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 Si)}translateToString(e,t,r){return this._line.translateToString(e,t,r)}},vk=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 XX(t)}getNullCell(){return new Si}},ZX=class extends lt{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new we),this.onBufferChange=this._onBufferChange.event,this._normal=new vk(this._core.buffers.normal,"normal"),this._alternate=new vk(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)}},QX=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,r=>t(r.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(r,s)=>t(r,s.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)}},JX=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}},eZ=["cols","rows"],on=0,tZ=class extends lt{constructor(e){super(),this._core=this._register(new GX(e)),this._addonManager=this._register(new KX),this._publicOptions={...this._core.options};let t=s=>this._core.options[s],r=(s,n)=>{this._checkReadonlyOptions(s),this._core.options[s]=n};for(let s in this._core.options){let n={get:t.bind(this,s),set:r.bind(this,s)};Object.defineProperty(this._publicOptions,s,n)}}_checkReadonlyOptions(e){if(eZ.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 QX(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new JX(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 ZX(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,r){this._verifyIntegers(e,t,r),this._core.select(e,t,r)}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
|
|
709
|
-
`,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 Ax.get()},set promptLabel(e){Ax.set(e)},get tooMuchOutput(){return Mx.get()},set tooMuchOutput(e){Mx.set(e)}}}_verifyIntegers(...e){for(on of e)if(on===1/0||isNaN(on)||on%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(on of e)if(on&&(on===1/0||isNaN(on)||on%1!==0||on<0))throw new Error("This API only accepts positive integers")}};function _k(e,t){if(typeof document>"u")return t;try{const r=document.createElement("span");r.style.color=`var(${e})`,r.style.position="absolute",r.style.opacity="0",r.style.pointerEvents="none",document.body.appendChild(r);const s=getComputedStyle(r).color;return r.remove(),s||t}catch{return t}}function xk(){const e=_k("--card","#0b0b12"),t=_k("--foreground","#e5e5ef"),r=typeof document<"u"&&document.documentElement.classList.contains("dark");return{background:e,foreground:t,cursor:"#a855f7",cursorAccent:e,selectionBackground:"#9333ea55",...r?{}:{black:t,white:"#3f3f46",brightWhite:t,brightBlack:"#a1a1aa"}}}function rZ(e,t){e.preventDefault(),window.open(t,"_blank","noopener,noreferrer")}function sZ(e){let t;try{t=JSON.parse(e)}catch{return null}if(!t||typeof t!="object")return null;const r=t;return r.t==="opened"?{kind:"opened"}:r.t==="error"?{kind:"error",message:typeof r.message=="string"&&r.message.trim()?r.message:"Terminal bridge error"}:null}function ET(e){return e===1001||e===1006||e===1012||e===1013}function iZ(e,t,r){return!e&&t&&r.kind==="closed"&&(r.code===4404||ET(r.code))}function nZ(e){if(typeof e=="object"&&e!==null){const r=e.status;if(typeof r=="number"&&r>=500)return!0}const t=e instanceof Error?e.message:String(e);return/failed to fetch|fetch failed|load failed|network\s*error/i.test(t)}const aZ="\x1B[13;2u";function oZ(e){return e.key==="Enter"&&e.shiftKey&&!e.altKey&&!e.ctrlKey&&!e.metaKey?aZ:null}const yk=new TextEncoder,lZ=750,cZ=2048;function uZ(e,t){return t<lZ&&e<=cZ}function dZ(e){let t;try{t=new VG}catch{return null}t.onContextLoss(()=>t.dispose());try{e.loadAddon(t)}catch{return t.dispose(),null}return t}function hZ(e,t){var r;return t?((r=e.clipboardData)==null||r.setData("text/plain",t),e.preventDefault(),!0):!1}class fZ{constructor(t,r,s,n=!1){hs(this,"term");hs(this,"fit");hs(this,"webgl");hs(this,"listenerCtl");hs(this,"resizeObserver");hs(this,"ws",null);hs(this,"dataDispose",null);hs(this,"lastUserInputAt",0);hs(this,"disposed",!1);hs(this,"connectedOnce",!1);hs(this,"connectionGeneration",0);hs(this,"layoutVisible",!1);this.url=r,this.onState=s,this.readOnly=n,this.term=new tZ({fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",fontSize:13,scrollback:2e4,cursorBlink:!0,theme:xk(),minimumContrastRatio:4.5,macOptionClickForcesSelection:!0,allowProposedApi:!0,disableStdin:n}),this.fit=new nV,this.term.loadAddon(this.fit),this.term.loadAddon(new dV(rZ)),this.term.open(t),this.webgl=dZ(this.term),this.listenerCtl=new AbortController;const{signal:l}=this.listenerCtl;t.addEventListener("copy",u=>hZ(u,this.term.getSelection()),{capture:!0,signal:l}),this.onState({kind:"connecting"}),this.resizeObserver=new ResizeObserver(u=>{var f;if(this.disposed)return;const d=(f=u[0])==null?void 0:f.contentRect,m=!!d&&d.width>0&&d.height>0;if(this.layoutVisible=m,!this.connectedOnce&&!this.ws){m&&this.connect();return}m&&this.sendResize()}),this.resizeObserver.observe(t)}async connect(){var l;if(this.disposed)return;const t=++this.connectionGeneration;this.connectedOnce=!0;try{this.fit.fit()}catch{this.term.resize(80,24)}let r;try{if(r=typeof this.url=="function"?await this.url({cols:this.term.cols,rows:this.term.rows}):this.url,this.disposed||t!==this.connectionGeneration)return;const u=new URL(r);u.searchParams.set("cols",String(this.term.cols)),u.searchParams.set("rows",String(this.term.rows)),r=u.toString()}catch(u){if(this.disposed||t!==this.connectionGeneration)return;nZ(u)?this.onState({kind:"closed",code:1006,reason:"Terminal connection temporarily unavailable"}):this.onState({kind:"error",message:u instanceof Error?u.message:"Could not prepare terminal connection"});return}let s;try{s=new WebSocket(r)}catch(u){if(this.disposed||t!==this.connectionGeneration)return;this.onState({kind:"error",message:u instanceof Error?u.message:"Could not open terminal connection"});return}s.binaryType="arraybuffer",this.ws=s;let n=null;s.addEventListener("open",()=>{this.sendResize(),this.term.focus()},{signal:this.listenerCtl.signal}),s.addEventListener("message",u=>{if(u.data instanceof ArrayBuffer){this.writeOutput(new Uint8Array(u.data));return}if(typeof u.data!="string")return;const d=sZ(u.data);(d==null?void 0:d.kind)==="opened"?this.onState({kind:"connected"}):(d==null?void 0:d.kind)==="error"&&(n=d.message,this.onState({kind:"error",message:d.message}))},{signal:this.listenerCtl.signal}),s.addEventListener("close",u=>{var d;this.ws===s&&(this.ws=null,(d=this.dataDispose)==null||d.dispose(),this.dataDispose=null,!(n!==null&&u.code===4500)&&this.onState({kind:"closed",reason:u.reason||`code ${u.code}`,code:u.code}))},{signal:this.listenerCtl.signal}),s.addEventListener("error",()=>{this.ws===s&&this.onState({kind:"error",message:"Terminal WebSocket error"})},{signal:this.listenerCtl.signal}),(l=this.dataDispose)==null||l.dispose(),this.readOnly||(this.dataDispose=this.term.onData(u=>{this.lastUserInputAt=performance.now(),s.readyState===WebSocket.OPEN&&s.send(yk.encode(u))}),this.term.attachCustomKeyEventHandler(u=>{const d=oZ(u);return d===null?!0:(u.type==="keydown"&&(u.preventDefault(),this.lastUserInputAt=performance.now(),s.readyState===WebSocket.OPEN&&s.send(yk.encode(d))),!1)}))}setTheme(){this.term.options.theme=xk()}focus(){this.term.focus()}reconnect({silent:t=!1}={}){var s;if(this.disposed)return;const r=this.ws;this.ws=null,(s=this.dataDispose)==null||s.dispose(),this.dataDispose=null;try{r==null||r.close()}catch{}this.onState({kind:t?"probing":"connecting"}),this.connect()}dispose(){var r,s;if(this.disposed)return;this.disposed=!0,this.connectionGeneration+=1,this.listenerCtl.abort(),this.resizeObserver.disconnect(),(r=this.dataDispose)==null||r.dispose();const t=this.ws;this.ws=null;try{t==null||t.close()}catch{}(s=this.webgl)==null||s.dispose(),this.term.dispose()}writeOutput(t){if(uZ(t.length,performance.now()-this.lastUserInputAt)){const r=this.term._core;if(typeof(r==null?void 0:r.writeSync)=="function")try{r.writeSync(t,1);return}catch{}}this.term.write(t)}sendResize(){if(!(this.readOnly||!this.layoutVisible||!this.ws||this.ws.readyState!==WebSocket.OPEN)){try{this.fit.fit()}catch{return}this.ws.send(JSON.stringify({t:"resize",cols:this.term.cols,rows:this.term.rows}))}}}const bk=[500,1e3,2e3,4e3,8e3],mZ=3e4;function pZ({sessionId:e,runtimeSelector:t,active:r,role:s="owner",setup:n}){const[l,u]=g.useState({kind:"connecting"}),[d,m]=g.useState(0),[f,v]=g.useState(!1),[p,x]=g.useState(!1),[b,w]=g.useState(null),C=g.useRef(0),k=g.useRef(null),S=g.useRef(null),E=g.useRef(r),N=`${t}\0${e}`,R=g.useRef(N);R.current=N;const{theme:A}=Dy(),D=g.useCallback(Y=>u(Y),[]);g.useEffect(()=>{var Y;(Y=S.current)==null||Y.setTheme()},[A]),g.useEffect(()=>{w(null),x(!1)},[N]);const B=g.useCallback(Y=>{if(Y===null)return;D({kind:"connecting"});let V=null,U=!1;return queueMicrotask(()=>{U||(V=new fZ(Y,({cols:L,rows:I})=>B9(t,e,{role:s,cols:L,rows:I,refreshCapability:!0}),D,s==="read-only"),S.current=V)}),()=>{U=!0,V==null||V.dispose(),S.current=null}},[e,t,s,D]);g.useEffect(()=>{if(l.kind==="connected"){k.current=Date.now(),v(!1);return}if(l.kind!=="closed")return;if(!ET(l.code)){v(!1);return}if(k.current!==null&&Date.now()-k.current>=mZ&&(C.current=0),k.current=null,C.current>=bk.length){v(!1);return}const Y=bk[C.current];C.current+=1,v(!0);let V=!1;const U=()=>{V||(V=!0,S.current?S.current.reconnect():m(F=>F+1))},L=window.setTimeout(U,Y),I=()=>{document.visibilityState==="visible"&&U()};return document.addEventListener("visibilitychange",I),()=>{window.clearTimeout(L),document.removeEventListener("visibilitychange",I)}},[l]);const $=g.useCallback(()=>{C.current=0,k.current=null,v(!1),S.current?S.current.reconnect():m(Y=>Y+1)},[]);g.useEffect(()=>{var V,U;const Y=E.current;E.current=r,!Y&&r&&((V=S.current)==null||V.focus()),iZ(Y,r,l)&&(C.current=0,k.current=null,v(!1),(U=S.current)==null||U.reconnect({silent:l.kind==="closed"&&l.code===4404}))},[r,l]);const q=g.useCallback(async()=>{if(p)return;const Y=N;x(!0),w(null);try{if(await xe.startSessionTerminal(t,e),R.current!==Y)return;$()}catch(V){if(R.current!==Y)return;w(V instanceof Error?V.message:"Could not start terminal")}finally{R.current===Y&&x(!1)}},[$,t,e,p,N]);return o.jsxs("div",{"data-state":l.kind,className:"flex min-h-0 flex-1 flex-col overflow-hidden bg-[var(--card)]",children:[o.jsxs("div",{className:"relative min-h-0 flex-1 overflow-hidden p-1",children:[o.jsx("div",{ref:B,className:"h-full w-full overflow-hidden"},d),l.kind!=="connected"&&o.jsx(_Z,{state:l,reconnectPending:f,startingTerminal:p,startError:b,onRetry:$,onStartTerminal:()=>void q(),setup:n,readOnly:s==="read-only"})]}),o.jsx("div",{className:"flex min-h-8 shrink-0 select-none items-center gap-2 px-2 font-mono text-[10px] text-[var(--muted-foreground)]/70",children:o.jsx("span",{className:"min-w-0 flex-1 truncate px-2",children:vZ(gZ())})})]})}function gZ(){if(typeof navigator>"u")return!1;const e=navigator.userAgentData,t=(e==null?void 0:e.platform)??navigator.platform??"";return/mac/i.test(t)}function vZ(e){return e?"Hold ⌥ and drag to select · ⌘C to copy":"Hold Shift and drag to select · right-click to copy"}function _Z({state:e,reconnectPending:t,startingTerminal:r,startError:s,onRetry:n,onStartTerminal:l,setup:u,readOnly:d}){return o.jsxs("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-[var(--background)]/85 text-sm text-[var(--foreground)] backdrop-blur-[1px]",children:[e.kind==="connecting"&&o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx(ze,{className:"size-4 animate-spin"}),"Connecting…"]}),e.kind==="closed"&&t&&o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx(ze,{className:"size-4 animate-spin"}),"Reconnecting…"]}),e.kind==="closed"&&!t&&(e.code===4404?o.jsx(xZ,{starting:r,error:s,onStart:l,setup:u,readOnly:d}):o.jsx(wk,{message:e.reason||"Terminal connection closed",onRetry:n})),e.kind==="probing"&&o.jsxs("span",{className:"flex items-center gap-2 text-[var(--muted-foreground)]",children:[o.jsx(ze,{className:"size-4 animate-spin"}),"Checking terminal…"]}),e.kind==="error"&&o.jsx(wk,{message:e.message,onRetry:n})]})}function xZ({starting:e,error:t,onStart:r,setup:s,readOnly:n}){const l=(s==null?void 0:s.target)??"Provider",u=(s==null?void 0:s.kind)==="delivery_unknown"?"Task delivery needs confirmation":(s==null?void 0:s.kind)==="required"?`${l} needs setup`:"Terminal is not running",d=(s==null?void 0:s.kind)==="delivery_unknown"?"Rynx could not confirm whether the queued task was accepted. Open the terminal and check its history before retrying.":(s==null?void 0:s.kind)==="required"?s.taskQueued?`Complete login or first-run setup. The queued task will start automatically when ${l} is ready.`:s.reason??`Complete ${l} login or first-run setup before starting this Session.`:"Start it when you need terminal access for this Session.",m=(s==null?void 0:s.kind)==="required"?`Open ${l} setup`:"Start terminal";return o.jsxs("div",{className:"grid max-w-sm place-items-center gap-3 px-6 text-center",children:[o.jsxs("div",{className:"grid gap-1",children:[o.jsx("span",{className:"font-medium",children:u}),o.jsx("span",{className:"text-[var(--muted-foreground)]",children:d})]}),t&&o.jsx("span",{className:"text-[var(--destructive)]",children:t}),!n&&o.jsxs(ne,{variant:"outline",size:"sm",disabled:e,onClick:r,children:[e?o.jsx(ze,{className:"animate-spin"}):o.jsx(f6,{}),e?"Opening…":m]})]})}function wk({message:e,onRetry:t}){return o.jsxs("div",{className:"grid max-w-sm place-items-center gap-3 px-6 text-center",children:[o.jsx("span",{className:"text-[var(--muted-foreground)]",children:e}),o.jsxs(ne,{variant:"outline",size:"sm",onClick:t,children:[o.jsx(_t,{})," Retry"]})]})}function yZ(e,t){return`${e}\0${t}`}function Sk(e,t){return[...e.filter(s=>s.runtimeSelector===t.runtimeSelector&&s.key!==t.key),t].slice(-8)}function bZ({selected:e,slot:t,visible:r}){const[s,n]=g.useState([]),[l,u]=g.useState(null);g.useEffect(()=>{e&&n(m=>{const f=m[m.length-1];return f&&wZ(f,e)?m:Sk(m,e)})},[e]);const d=e?Sk(s,e):s;return o.jsxs(o.Fragment,{children:[o.jsx("div",{ref:u,className:"pointer-events-none invisible absolute inset-0 min-h-0 min-w-0 overflow-hidden","aria-hidden":"true"}),d.map(m=>o.jsx(SZ,{entry:m,parkingHost:l,slot:(e==null?void 0:e.key)===m.key?t:null,visible:(e==null?void 0:e.key)===m.key&&r},m.key))]})}function wZ(e,t){var r,s,n,l,u,d;return e.key===t.key&&e.runtimeSelector===t.runtimeSelector&&e.sessionId===t.sessionId&&e.readOnly===t.readOnly&&((r=e.setup)==null?void 0:r.kind)===((s=t.setup)==null?void 0:s.kind)&&((n=e.setup)==null?void 0:n.target)===((l=t.setup)==null?void 0:l.target)&&(((u=e.setup)==null?void 0:u.kind)!=="required"||((d=t.setup)==null?void 0:d.kind)!=="required"||e.setup.taskQueued===t.setup.taskQueued&&e.setup.reason===t.setup.reason)}function SZ({entry:e,parkingHost:t,slot:r,visible:s}){const n=g.useRef(null);if(n.current===null&&typeof document<"u"){const u=document.createElement("div");u.className="flex h-full min-h-0 w-full min-w-0 flex-col",u.dataset.warmTerminal=e.key,n.current=u}g.useLayoutEffect(()=>{const u=n.current,d=r??t;if(!(!u||!d))return d.appendChild(u),()=>u.remove()},[t,r]);const l=n.current;return l?na.createPortal(o.jsx(pZ,{sessionId:e.sessionId,runtimeSelector:e.runtimeSelector,active:s,role:e.readOnly?"read-only":"owner",setup:e.setup}),l,e.key):null}function T_(){const e=al(),t=(e==null?void 0:e.access)==="read_only",r=(e==null?void 0:e.scope)==="single_session"?e.sessionId:void 0,s=!!r,n=ao(),{sessionId:l}=Kk(),{runtimeSelector:u,selectedRuntime:d}=Sc(),{status:m,operation:f}=Ey(),v=rF(m,f),[p,x]=g.useState([]),[b,w]=g.useState({providers:[],agents:[]}),[C,k]=g.useState(null),[S,E]=g.useState({permissionPreset:"default"}),[N,R]=g.useState([]),[A,D]=g.useState(null),[B,$]=g.useState(!0),[q,Y]=g.useState(!0),[V,U]=g.useState(),[L,I]=g.useState(),[F,M]=g.useState(),[P,O]=g.useState(!0),[W,H]=g.useState(!1),[T,G]=g.useState(!1),[X,ee]=g.useState(null),[oe,de]=g.useState(null),[Z,ce]=g.useState(!1),[le,be]=g.useState(),[ke,Ee]=g.useState(),te=g.useRef(!1),re=g.useRef(0),Ce=g.useRef(0),De=g.useRef(0),_e=g.useRef(0),Re=g.useRef(void 0),Pe=g.useRef(u),Ue=g.useRef(u),qe=g.useRef(v);qe.current=v;const Ie=g.useRef({selector:u});Ie.current.selector!==u&&(Ie.current={selector:u});const Ve=Ie.current,ct=r??l??null,Qr=g.useRef(ct);g.useEffect(()=>{!r||l===r||n(vi(Io(u,r)),{replace:!0})},[n,u,l,r]),g.useEffect(()=>()=>{_e.current+=1},[]),g.useEffect(()=>{Qr.current!==ct&&(Qr.current=ct,_e.current+=1)},[ct]);const Ct=g.useCallback(async(Le=!1)=>{if(qe.current)return;const Ze=++re.current;Le&&O(!0);try{const He=await xe.listSessions(u);if(re.current!==Ze)return;Pe.current=u,x(He),M(void 0)}catch(He){if(re.current!==Ze||qe.current)return;M(`Could not load sessions: ${He.message}`)}finally{re.current===Ze&&O(!1)}},[u]);g.useEffect(()=>{Ue.current!==u&&(Ue.current=u,Re.current=void 0,De.current+=1,re.current+=1,x([]),R([]),D(null),I(void 0),Y(!0),M(void 0),O(!0))},[u]);const Nr=g.useCallback(async()=>{if(e){R([]),D(null),I(void 0),Y(!1);return}if(qe.current)return;const Le=++De.current;Y(!0),I(void 0);try{const Ze=await xe.listProjects(u);if(De.current!==Le)return;R(Ze),D(He=>He&&Ze.some(jr=>jr.id===He)?He:null)}catch(Ze){if(De.current!==Le||qe.current)return;R([]),D(null),I(`Could not load projects: ${Ze.message}`)}finally{De.current===Le&&Y(!1)}},[e,t,u]);g.useEffect(()=>{if(v){re.current+=1,M(void 0),O(!1);return}Ct(!0);const Le=setInterval(()=>void Ct(),4e3);return()=>clearInterval(Le)},[Ct,v]);const cs=g.useCallback(async()=>{if(e){w({providers:[],agents:[]}),k(null),U(void 0),$(!1);return}if(qe.current)return;const Le=++Ce.current;$(!0),U(void 0);try{let Ze;try{Ze=await xe.listSessionLaunchOptions(u)}catch(Jr){if(!(Jr instanceof Qa)||Jr.code!=="incompatible"&&Jr.code!=="method_not_found")throw Jr;Ze=hF(await xe.listSessionAgentOptions(u))}if(Ce.current!==Le)return;const He=lF(u,typeof window>"u"?void 0:window.localStorage),jr=oF(Ze,He);w(Ze),k(jr),E(g2(jr,Ze))}catch(Ze){if(Ce.current!==Le||qe.current)return;w({providers:[],agents:[]}),k(null),E({permissionPreset:"default"}),U(`Could not load launch options: ${Ze.message}`)}finally{Ce.current===Le&&$(!1)}},[e,t,u]);g.useEffect(()=>{if(v){Ce.current+=1,U(void 0),$(!1);return}return w({providers:[],agents:[]}),k(null),E({permissionPreset:"default"}),$(!0),U(void 0),G(!1),be(void 0),Ee(void 0),cs(),()=>{Ce.current+=1}},[cs,v]),g.useEffect(()=>{if(v){De.current+=1,I(void 0),Y(!1);return}return R([]),D(null),Y(!0),I(void 0),Nr(),()=>{De.current+=1}},[Nr,v]);const tr=g.useCallback(async Le=>{var sr,Ls;if(te.current)return!1;const Ze=Le.text,He=C;if(!He)return U("Choose a provider or Agent before starting."),!1;const jr=px(He,b);if(!jr)return U("Choose a provider or Agent before starting."),!1;const Jr=!jr.ready&&jr.readiness!=="unverified";if(Jr&&Le.images.length>0)return U(`${jr.name} must finish login or first-run setup before starting with images.`),!1;const $t=Ie.current,rr=d.displayName,Fe=++_e.current,wt=dF(Ze||((sr=Le.images[0])==null?void 0:sr.file.name)||"Image");let Gt;te.current=!0,ce(!0),U(void 0);try{const rt=Re.current,Bt=rt&&rt.selector===$t.selector&&rt.selection.kind===He.kind&&rt.selection.id===He.id&&rt.projectId===A&&rt.configuration.model===S.model&&rt.configuration.reasoningEffort===S.reasoningEffort&&rt.configuration.permissionPreset===S.permissionPreset?rt.sessionId:(await xe.createSession(uF(He,wt,A??void 0,S),$t.selector)).sessionId;if(Gt=Bt,Re.current={selector:$t.selector,selection:He,projectId:A,configuration:{...S},sessionId:Bt},!Jr&&Le.images.length===0){const mr=new Date().toISOString(),Pt=He.kind==="agent"?(Ls=b.agents.find(nt=>nt.id===He.id))==null?void 0:Ls.runtime:void 0,he=He.kind==="provider"?He.id:CZ(Pt)?Pt:void 0,je={id:Bt,...he?{provider:he}:{},title:wt,status:"running",createdAt:mr,updatedAt:mr,source:"console"};return Pe.current=$t.selector,x(nt=>[je,...nt.filter(Zt=>Zt.id!==Bt)]),Ee({sessionId:Bt,message:Ze,started:!1}),G(!1),Re.current=void 0,n(vi(Io($t.selector,Bt))),!0}let Rt,Xt=!1,ei=!1;if(Jr)try{await xe.enqueueSessionMessage($t.selector,Bt,Ze),Xt=!0}catch(mr){Rt=mr}else try{if(!(await xe.getSessionResourcePolicy($t.selector,Bt)).enabled)throw new Qa("Session image resources are unavailable on this Runtime",409,"failed_precondition","not_started");const Pt=await Promise.all(Le.images.map(he=>xe.uploadSessionResource($t.selector,Bt,he.file,he.clientUploadId)));ei=!0,await xe.sendSessionMessage(Bt,{content:[...Pt.map(he=>({type:"input_image",resourceId:he.resourceId,mediaType:he.mediaType,...he.filename?{filename:he.filename}:{},...he.byteLength?{byteLength:he.byteLength}:{},...he.width?{width:he.width}:{},...he.height?{height:he.height}:{}})),...Ze?[{type:"input_text",text:Ze}]:[]],clientMessageId:Le.clientMessageId},()=>{},void 0,$t.selector)}catch(mr){Rt=mr}const fr=!!(!Xt&&(Le.images.length>0&&!ei&&Rt||Jm(Rt)));if(Ie.current!==$t)return Re.current=void 0,Rt?fr?pe.error(`Session created on ${rr}, but the first message was not sent: ${Rt.message}`):pe.warning(`Session created on ${rr}, but message delivery is unknown. Check its history before retrying.`):pe.success(`Session started on ${rr}; switch back to view it.`),!0;if(_e.current!==Fe)return Re.current=void 0,Rt?fr?pe.error(`Session created on ${rr}, but the first message was not sent. Open it to retry.`):pe.warning(`Session created on ${rr}, but message delivery is unknown. Check its history before retrying.`):pe.success(`Session started on ${rr} in the background.`),!0;if(Le.images.length>0&&fr)return U(`Session created, but the first image message was not sent: ${Rt.message}. Retry will reuse this Session.`),Ct(),!1;const Rn=new Date().toISOString(),mo={id:Bt,...He.kind==="provider"?{provider:He.id}:{agent:He.id},title:wt,status:fr?"idle":"running",createdAt:Rn,updatedAt:Rn,source:"console",...Xt?{setupStatus:"waiting_for_provider"}:{}};return Pe.current=$t.selector,x(mr=>[mo,...mr.filter(Pt=>Pt.id!==Bt)]),be(fr?{sessionId:Bt,message:Ze}:void 0),G(!1),Re.current=void 0,n(vi(Xt?`${Io($t.selector,Bt)}?view=terminal`:Io($t.selector,Bt))),Ct(),Xt?pe.info(`${jr.name} needs setup. The task is queued and will start automatically when the Provider is ready.`):Rt&&(fr?pe.error(`Session created, but the first message was not sent: ${Rt.message}`):pe.warning("Session created, but message delivery is unknown. Check its history before retrying.")),!0}catch(rt){const hr=rt instanceof Qa&&rt.outcome==="unknown",Bt=Gt?`Session created, but its first message was not sent: ${rt.message}. Retry will reuse this Session.`:hr?"Session creation outcome is unknown. Check the Session list before retrying.":`Could not start session: ${rt.message}`;return Ie.current===$t&&_e.current===Fe?U(Bt):hr?pe.warning(`Session creation on ${rr} may have succeeded. Check its Session list before retrying.`):pe.error(`Could not start Session on ${rr}: ${rt.message}`),!Gt&&hr?(Re.current=void 0,!0):!1}finally{te.current=!1,ce(!1)}},[b,S,C,n,A,Ct,d.displayName]),kt=Pe.current===u?p:[],Ge=kt.find(Le=>Le.id===ct)??null,Et=Ge?px(Ge.provider?{kind:"provider",id:Ge.provider}:Ge.agent?{kind:"agent",id:Ge.agent}:null,b):null,us=(Ge==null?void 0:Ge.setupStatus)==="delivery_unknown"?{kind:"delivery_unknown",target:(Et==null?void 0:Et.name)??(Ge.provider?nd(Ge.provider):Ge.agent)}:Ge&&(Ge.setupStatus==="waiting_for_provider"||(Et==null?void 0:Et.ready)===!1)?{kind:"required",target:(Et==null?void 0:Et.name)??(Ge.provider?nd(Ge.provider):Ge.agent),taskQueued:Ge.setupStatus==="waiting_for_provider",...Et!=null&&Et.reason?{reason:Et.reason}:{}}:void 0;g.useEffect(()=>{(le==null?void 0:le.sessionId)===(Ge==null?void 0:Ge.id)&&be(void 0)},[le,Ge==null?void 0:Ge.id]);const zt=Ge&&!s?o.jsxs("div",{className:We("flex shrink-0 items-center gap-1",W&&"desktop-macos-titlebar-leading-inset"),children:[o.jsx(ne,{variant:"ghost",size:"icon",className:"size-10 md:hidden",title:"Back to sessions","aria-label":"Back to sessions",onClick:()=>{G(!0),n(vi(Ka(u)),{replace:!0})},children:o.jsx(Yo,{})}),W&&o.jsx(ne,{variant:"ghost",size:"icon-sm",className:"-ml-1 hidden md:inline-flex",title:"Show session list","aria-label":"Show session list",onClick:()=>H(!1),children:o.jsx(dE,{className:"size-3.5"})})]}):void 0,ds=g.useCallback((Le,Ze)=>{de(He=>Ze?Le:He===Le?null:He)},[]),Vt=Ge?{key:yZ(u,Ge.id),runtimeSelector:u,sessionId:Ge.id,readOnly:!!t,setup:us}:null;return o.jsxs("div",{className:We("grid h-full min-h-0 min-w-0 bg-[var(--background)]",s||W?"grid-cols-[minmax(0,1fr)]":"md:grid-cols-[14rem_minmax(0,1fr)]"),children:[!s&&!W&&o.jsx("div",{className:We("min-h-0 min-w-0 border-r border-[var(--border)]",(!T||Ge)&&"hidden md:block"),children:o.jsx(Kq,{sessions:kt,runtimeSelector:u,runtimeLabel:d.displayName,listError:F,loading:P,selectedId:ct,readOnly:!!e,onCollapsedChange:H,onSelect:Le=>{_e.current+=1,Re.current=void 0,G(!1),be(void 0),n(vi(Io(u,Le)))},onNew:()=>{_e.current+=1,Re.current=void 0,G(!1),be(void 0),Ee(void 0),n(vi(Ka(u)))},onRetry:()=>void Ct(!0),onFork:async Le=>{try{const Ze=await xe.forkSession(u,Le,{operationId:`web_${crypto.randomUUID()}`});if(Ie.current!==Ve)return;await Ct(),G(!1),n(vi(Io(u,Ze.sessionId))),pe.success("Session forked")}catch(Ze){pe.error(`Fork session failed: ${Ze instanceof Error?Ze.message:String(Ze)}`)}},onDeleted:Le=>{Ie.current===Ve&&(ct===Le&&n(vi(Ka(u)),{replace:!0}),Ct())}},u)}),o.jsxs("div",{className:"relative min-h-0 min-w-0 overflow-hidden",children:[Ge?o.jsx(Fq,{session:Ge,runtimeSelector:u,readOnly:t,leadingControls:zt,initialDraft:(le==null?void 0:le.sessionId)===Ge.id?le.message:void 0,initialMessage:(ke==null?void 0:ke.sessionId)===Ge.id?ke.message:void 0,sendInitialMessage:(ke==null?void 0:ke.sessionId)===Ge.id&&!ke.started,onInitialMessageStarted:()=>{Ee(Le=>(Le==null?void 0:Le.sessionId)===Ge.id?{...Le,started:!0}:Le)},onInitialMessageConsumed:()=>{Ee(Le=>(Le==null?void 0:Le.sessionId)===Ge.id?void 0:Le)},onInitialMessageFailed:Le=>{Ee(Ze=>(Ze==null?void 0:Ze.sessionId)===Ge.id?void 0:Ze),be({sessionId:Ge.id,message:Le})},terminalSlotRef:ee,onTerminalActiveChange:ds},`${u}:${Ge.id}`):ct&&P?o.jsx("div",{className:"grid h-full min-h-0 min-w-0 place-items-center",role:"status","aria-live":"polite",children:o.jsxs("span",{className:"flex items-center gap-2 text-sm text-[var(--muted-foreground)]",children:[o.jsx(ze,{className:"size-4 animate-spin"})," Loading session…"]})}):e?o.jsx("div",{className:"grid h-full min-h-0 min-w-0 place-items-center px-6 text-center text-sm text-[var(--muted-foreground)]",children:ct?"Session not found.":"Choose a Session from the list."}):o.jsx("div",{className:We("h-full min-h-0 min-w-0",T&&!W&&"hidden md:block"),children:o.jsx(Jq,{runtimeLabel:d.displayName,options:b,selection:C,configuration:S,projects:N,projectId:A,loading:B,projectsLoading:q,submitting:Z,error:V??F??(ct?"Session not found. Start a new session or choose another from the list.":void 0),projectError:L,listCollapsed:W,onShowSessions:()=>{_e.current+=1,H(!1),G(!0)},onRetryOptions:()=>{cs()},onSelectionChange:Le=>{Re.current=void 0,k(Le),E(Ze=>g2(Le,b,Ze.permissionPreset)),U(void 0),cF(u,typeof window>"u"?void 0:window.localStorage,Le)},onConfigurationChange:Le=>{Re.current=void 0,E(Le),U(void 0)},onProjectChange:Le=>{Re.current=void 0,D(Le),U(void 0)},onNewProject:()=>{n(vt.projects,{state:{returnTo:Ka(u),createProject:!0}})},onSubmit:tr},u)}),o.jsx(bZ,{selected:Vt,slot:X,visible:oe===(Ge==null?void 0:Ge.id)})]})]})}function CZ(e){return e==="codex"||e==="claude"||e==="traex"}function kZ(){const[e,t]=g.useState(null),[r,s]=g.useState(""),[n,l]=g.useState(null),[u,d]=g.useState(!1),[m,f]=g.useState(""),[v,p]=g.useState(""),[x,b]=g.useState(!1),[w,C]=g.useState(!1),[k,S]=g.useState(!1);async function E(){try{const R=await xe.listSkills();t(R),s(A=>{var D;return R.some(B=>B.name===A)?A:((D=R[0])==null?void 0:D.name)??""})}catch(R){t([]),pe.error(`Failed to load Skills: ${R.message}`)}}g.useEffect(()=>{E()},[]),g.useEffect(()=>{if(!r){l(null);return}let R=!1;return d(!0),xe.getSkill(r).then(A=>{var D;R||(l(A),f(((D=A.files.find(B=>B.path==="SKILL.md")??A.files[0])==null?void 0:D.path)??""))}).catch(A=>!R&&pe.error(`Load Skill failed: ${A.message}`)).finally(()=>!R&&d(!1)),()=>{R=!0}},[r]),g.useEffect(()=>{if(!r||!m){p("");return}let R=!1;return b(!0),xe.readSkillFile(r,m).then(A=>!R&&p(A.content)).catch(A=>!R&&p(`⚠ ${A.message}`)).finally(()=>!R&&b(!1)),()=>{R=!0}},[m,r]);const N=(e==null?void 0:e.filter(R=>{var D;const A=((D=R.ref)==null?void 0:D.install.tool)==="skills-cli"?R.ref.install.source:"";return A.includes("/artifacts/skills/")||A.includes("\\artifacts\\skills\\")}).length)??0;return o.jsxs("div",{className:"grid gap-5",children:[o.jsxs("div",{className:"flex items-start justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-xl font-semibold",children:"Skills"}),o.jsxs("p",{className:"mt-1 text-sm text-[var(--muted-foreground)]",children:["Local catalog discovered from ",o.jsx("code",{children:"~/.rynx/skills"}),"."]})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(ne,{variant:"outline",onClick:()=>void E(),children:[o.jsx(_t,{})," Refresh"]}),o.jsx(BA,{onInstalled:R=>{var A;t(R),s(((A=R[0])==null?void 0:A.name)??"")},triggerLabel:"From URL",triggerVariant:"outline"}),o.jsxs(ne,{variant:"outline",onClick:()=>S(!0),children:[o.jsx(aE,{})," From ZIP"]}),o.jsxs(ne,{onClick:()=>C(!0),children:[o.jsx(e6,{})," From runtime"]})]})]}),o.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[o.jsx(D_,{label:"skills",value:(e==null?void 0:e.length)??0,detail:"Registered catalog entries"}),o.jsx(D_,{label:"local imports",value:N,detail:"Immutable runtime copies"}),o.jsx(D_,{label:"selectable",value:(e==null?void 0:e.filter(R=>R.ref).length)??0,detail:"Skills with a valid receipt"})]}),o.jsxs("div",{className:"grid min-h-[640px] gap-4 lg:grid-cols-[320px_minmax(0,1fr)]",children:[o.jsxs(At,{className:"overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-4 py-3",children:[o.jsx("h2",{className:"text-sm font-semibold",children:"Skill list"}),o.jsx("span",{className:"text-xs text-[var(--muted-foreground)]",children:(e==null?void 0:e.length)??0})]}),o.jsxs("div",{className:"grid gap-2 p-2",children:[e===null&&o.jsx("div",{className:"px-3 py-6 text-sm text-[var(--muted-foreground)]",children:"Loading Skills…"}),(e==null?void 0:e.length)===0&&o.jsx("div",{className:"rounded-lg border border-dashed border-[var(--border)] px-4 py-6 text-sm text-[var(--muted-foreground)]",children:"No local Skills registered yet."}),e==null?void 0:e.map(R=>o.jsxs("button",{type:"button",onClick:()=>s(R.name),className:We("flex w-full items-start gap-3 rounded-lg border px-3 py-3 text-left transition-colors",r===R.name?"border-[var(--primary)] bg-[var(--primary)]/10":"border-[var(--border)] hover:bg-[var(--muted)]/45"),children:[o.jsx("span",{className:"grid size-9 shrink-0 place-items-center rounded-md bg-amber-500/10 text-amber-600",children:o.jsx(oE,{className:"size-4"})}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"truncate font-mono text-sm font-semibold",children:R.name}),r===R.name&&o.jsx(oo,{className:"size-4 shrink-0 text-[var(--primary)]"})]}),o.jsx("span",{className:"mt-1 block line-clamp-2 text-xs text-[var(--muted-foreground)]",children:R.description}),o.jsx("span",{className:"mt-2 inline-block rounded bg-[var(--muted)] px-1.5 py-1 text-[10px] text-[var(--muted-foreground)]",children:R.ref?RT(R):"receipt-less"})]})]},R.name))]})]}),o.jsx(RZ,{detail:n,loading:u,activeFile:m,onSelectFile:f,fileContent:v,fileLoading:x,onDeleted:E})]}),o.jsx(NZ,{open:w,onOpenChange:C,onImported:async R=>{await E(),R&&s(R)}}),o.jsx(EZ,{open:k,onOpenChange:S,onImported:async R=>{await E(),R&&s(R)}})]})}function EZ({open:e,onOpenChange:t,onImported:r}){const[s,n]=g.useState(null),[l,u]=g.useState(!1),[d,m]=g.useState([]),f=s&&(!s.name.toLowerCase().endsWith(".zip")||s.size>20*1024*1024);async function v(){var p;if(!(!s||f)){u(!0),m([]);try{const x=await xe.importSkillArchive(s.name,await MZ(s));m(x);const b=(p=x.find(w=>w.status==="created"||w.status==="updated"))==null?void 0:p.name;await r(b)}catch(x){pe.error(`Import ZIP failed: ${x.message}`)}finally{u(!1)}}}return o.jsx(oa,{open:e,onOpenChange:p=>{t(p),p||(n(null),m([]))},children:o.jsxs(Sn,{className:"sm:max-w-xl",children:[o.jsx(la,{children:o.jsx(Cn,{children:"Import Skills from ZIP"})}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("label",{className:"grid cursor-pointer place-items-center gap-2 rounded-lg border border-dashed border-[var(--border)] px-4 py-8 text-center hover:bg-[var(--muted)]/30",children:[o.jsx("input",{type:"file",accept:".zip,application/zip",className:"sr-only",onChange:p=>{var x;n(((x=p.target.files)==null?void 0:x[0])??null),m([])}}),o.jsx(aE,{className:"size-6 text-[var(--primary)]"}),o.jsx("span",{className:"text-sm font-medium",children:(s==null?void 0:s.name)??"Choose a .zip archive"}),o.jsx("span",{className:"text-xs text-[var(--muted-foreground)]",children:"One Skill at the root or multiple Skill directories, up to 20 MB."})]}),f&&o.jsx("div",{className:"text-xs text-[var(--destructive)]",children:"Choose a .zip archive no larger than 20 MB."}),d.length>0&&o.jsx(AZ,{results:d})]}),o.jsxs(ca,{children:[o.jsx(ne,{variant:"outline",onClick:()=>t(!1),children:"Done"}),o.jsx(ne,{disabled:!s||!!f||l,onClick:()=>void v(),children:l?"Importing…":"Import"})]})]})})}function RZ({detail:e,loading:t,activeFile:r,onSelectFile:s,fileContent:n,fileLoading:l,onDeleted:u}){var m;if(t||!e)return o.jsx(At,{className:"p-6 text-sm text-[var(--muted-foreground)]",children:t?"Loading Skill…":"Select a Skill to inspect its files."});const d=WW((m=e.ref)==null?void 0:m.install);return o.jsxs(At,{className:"overflow-hidden",children:[o.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-[var(--border)] px-5 py-4",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("h2",{className:"font-mono text-lg font-semibold",children:e.name}),o.jsx("span",{className:"rounded bg-[var(--muted)] px-2 py-1 text-[10px] text-[var(--muted-foreground)]",children:RT(e)})]}),o.jsx("p",{className:"mt-2 text-sm text-[var(--muted-foreground)]",children:e.description}),d.source&&o.jsx("div",{className:"mt-2 max-w-2xl truncate font-mono text-[10px] text-[var(--muted-foreground)]",children:d.source})]}),o.jsx(jZ,{name:e.name,onDeleted:u})]}),o.jsxs("div",{className:"grid min-h-[500px] lg:grid-cols-[240px_minmax(0,1fr)]",children:[o.jsxs("div",{className:"border-b border-[var(--border)] p-3 lg:border-b-0 lg:border-r",children:[o.jsxs("div",{className:"label-caps mb-2 px-1 text-[10px] text-[var(--muted-foreground)]",children:["files · ",e.files.length]}),o.jsx("div",{className:"grid gap-1",children:e.files.map(f=>o.jsxs("button",{onClick:()=>s(f.path),className:We("flex items-center gap-2 rounded-md px-2 py-2 text-left text-xs",r===f.path?"bg-[var(--primary)]/10 text-[var(--primary)]":"hover:bg-[var(--muted)]/50"),children:[o.jsx(oE,{className:"size-3.5 shrink-0"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-mono",children:f.path}),o.jsx("span",{className:"text-[10px] text-[var(--muted-foreground)]",children:TZ(f.size)})]},f.path))})]}),o.jsxs("div",{className:"min-w-0 p-4",children:[o.jsx("div",{className:"mb-3 truncate font-mono text-xs text-[var(--muted-foreground)]",children:r||"No file selected"}),o.jsx("pre",{className:"min-h-[440px] overflow-auto whitespace-pre-wrap break-words rounded-lg border border-[var(--border)] bg-[var(--muted)]/25 p-4 font-mono text-xs leading-5",children:l?"Loading…":n})]})]})]})}function NZ({open:e,onOpenChange:t,onImported:r}){const[s,n]=g.useState([]),[l,u]=g.useState(""),[d,m]=g.useState([]),[f,v]=g.useState(new Set),[p,x]=g.useState(!1),[b,w]=g.useState(!1),[C,k]=g.useState([]);g.useEffect(()=>{if(!e)return;let A=!1;return xe.listAgentRuntimeOptions().then(D=>{if(A)return;n(D);const B=D.find($=>$.available)??D[0];u((B==null?void 0:B.id)??"")}).catch(D=>!A&&pe.error(`Load runtimes failed: ${D.message}`)),()=>{A=!0}},[e]);function S(){m([]),v(new Set),k([]),x(!1),w(!1)}async function E(){if(l){x(!0),m([]),v(new Set),k([]);try{const A=await xe.scanLocalSkills(l);m(A)}catch(A){pe.error(`Scan local Skills failed: ${A.message}`)}finally{x(!1)}}}async function N(){var A;if(!(!l||f.size===0)){w(!0);try{const D=await xe.importLocalSkills(l,[...f]);k(D);const B=(A=D.find($=>$.status==="created"||$.status==="updated"))==null?void 0:A.name;await r(B),pe.success(`Local Skill import finished: ${D.filter($=>$.status==="created"||$.status==="updated").length} changed`)}catch(D){pe.error(`Import local Skills failed: ${D.message}`)}finally{w(!1)}}}const R=d.length>0&&d.every(A=>f.has(A.key));return o.jsx(oa,{open:e,onOpenChange:A=>{t(A),A||S()},children:o.jsxs(Sn,{className:"sm:max-w-3xl",children:[o.jsx(la,{children:o.jsx(Cn,{children:"Import Skills from a local runtime"})}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2 sm:grid-cols-[minmax(0,1fr)_auto_auto]",children:[o.jsxs(gn,{value:l,onValueChange:A=>{u(A),S()},disabled:s.length===0,children:[o.jsx(Ui,{children:o.jsx($i,{placeholder:"No local runtime found"})}),o.jsx(Hi,{children:s.map(A=>o.jsxs(cr,{value:A.id,children:[A.name,A.version?` · ${A.version}`:"",A.available?"":" · CLI missing"]},A.id))})]}),o.jsxs(ne,{variant:"outline",disabled:!l||p,onClick:()=>void E(),children:[o.jsx(_t,{className:p?"animate-spin":""})," Scan"]}),o.jsxs(ne,{variant:"outline",disabled:d.length===0,onClick:()=>v(R?new Set:new Set(d.map(A=>A.key))),children:[o.jsx(Br,{})," ",R?"Clear":"All"]})]}),o.jsxs("div",{className:"max-h-80 overflow-y-auto rounded-lg border border-[var(--border)]",children:[p&&o.jsx("div",{className:"px-4 py-6 text-sm text-[var(--muted-foreground)]",children:"Scanning local runtime Skill roots…"}),!p&&d.length===0&&o.jsx("div",{className:"px-4 py-6 text-sm text-[var(--muted-foreground)]",children:"Choose a runtime family and click Scan. The local Skill directory can be scanned even when its CLI is missing."}),!p&&d.map(A=>o.jsxs("label",{className:"flex cursor-pointer items-start gap-3 border-b border-[var(--border)] px-4 py-3 last:border-0 hover:bg-[var(--muted)]/40",children:[o.jsx("input",{type:"checkbox",className:"mt-1 size-4",checked:f.has(A.key),onChange:()=>v(D=>{const B=new Set(D);return B.has(A.key)?B.delete(A.key):B.add(A.key),B})}),o.jsx(CO,{className:"mt-0.5 size-4 shrink-0 text-[var(--primary)]"}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("span",{className:"font-mono text-sm font-medium",children:A.name}),o.jsx("span",{className:"rounded bg-[var(--muted)] px-1.5 py-1 text-[10px] text-[var(--muted-foreground)]",children:A.root}),o.jsxs("span",{className:"rounded bg-[var(--muted)] px-1.5 py-1 text-[10px] text-[var(--muted-foreground)]",children:[A.fileCount," files"]})]}),o.jsx("span",{className:"mt-1 block text-xs text-[var(--muted-foreground)]",children:A.description}),o.jsx("span",{className:"mt-1 block truncate font-mono text-[10px] text-[var(--muted-foreground)]",children:A.sourcePath})]})]},A.key))]}),C.length>0&&o.jsx("div",{className:"max-h-44 overflow-y-auto rounded-lg border border-[var(--border)]",children:C.map((A,D)=>o.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-[var(--border)] px-4 py-3 text-sm last:border-0",children:[o.jsxs("div",{children:[o.jsx("div",{className:"font-mono font-medium",children:A.name}),A.message&&o.jsx("div",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:A.message})]}),o.jsx("span",{className:We("rounded px-2 py-1 text-xs",A.status==="failed"||A.status==="conflict"?"bg-red-500/10 text-red-600":A.status==="skipped"?"bg-[var(--muted)] text-[var(--muted-foreground)]":"bg-emerald-500/10 text-emerald-600"),children:A.status})]},`${A.name}-${D}`))})]}),o.jsxs(ca,{children:[o.jsx(ne,{variant:"outline",onClick:()=>t(!1),children:"Done"}),o.jsx(ne,{disabled:f.size===0||b,onClick:()=>void N(),children:b?"Importing…":`Import ${f.size||""}`})]})]})})}function jZ({name:e,onDeleted:t}){return o.jsxs(ki,{children:[o.jsx(wn,{asChild:!0,children:o.jsxs(ne,{variant:"ghost",size:"sm",className:"text-[var(--destructive)]",children:[o.jsx(lo,{})," Remove"]})}),o.jsxs(Xs,{children:[o.jsxs(Ei,{children:[o.jsxs(Zs,{children:['Remove Skill "',e,'"?']}),o.jsx(Qs,{children:"Removes the current catalog registration. Immutable artifacts referenced by existing Agents are preserved."})]}),o.jsxs(Ri,{children:[o.jsx(Js,{children:"Cancel"}),o.jsx(Ni,{variant:"destructive",onClick:async()=>{try{await xe.deleteSkill(e),pe.success(`Skill "${e}" removed`),await t()}catch(r){pe.error(`Remove failed: ${r.message}`)}},children:"Remove"})]})]})]})}function RT(e){var r,s;const t=((r=e.ref)==null?void 0:r.install.tool)==="skills-cli"?e.ref.install.source:"";return t.includes("/artifacts/skills/")||t.includes("\\artifacts\\skills\\")?"local runtime":((s=e.ref)==null?void 0:s.install.tool)==="command"?e.ref.install.command:t?"URL / repository":"receipt-less"}function AZ({results:e}){return o.jsx("div",{className:"max-h-44 overflow-y-auto rounded-lg border border-[var(--border)]",children:e.map((t,r)=>o.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-[var(--border)] px-4 py-3 text-sm last:border-0",children:[o.jsxs("div",{children:[o.jsx("div",{className:"font-mono font-medium",children:t.name}),t.message&&o.jsx("div",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:t.message})]}),o.jsx("span",{className:We("rounded px-2 py-1 text-xs",t.status==="failed"||t.status==="conflict"?"bg-red-500/10 text-red-600":t.status==="skipped"?"bg-[var(--muted)] text-[var(--muted-foreground)]":"bg-emerald-500/10 text-emerald-600"),children:t.status})]},`${t.name}-${r}`))})}function MZ(e){return new Promise((t,r)=>{const s=new FileReader;s.onerror=()=>r(s.error??new Error("File read failed")),s.onload=()=>{const n=String(s.result??"");t(n.includes(",")?n.slice(n.indexOf(",")+1):n)},s.readAsDataURL(e)})}function D_({label:e,value:t,detail:r}){return o.jsxs(At,{className:"p-4",children:[o.jsx("div",{className:"label-caps text-[10px] text-[var(--muted-foreground)]",children:e}),o.jsx("div",{className:"mt-2 text-2xl font-semibold",children:t}),o.jsx("div",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:r})]})}function TZ(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function DZ(e){var t;return((t=e.daemonBuild)==null?void 0:t.restartRequired)??!0}function LZ(){const e=ol();return e?o.jsxs(o.Fragment,{children:[o.jsx(X9,{bridge:e,children:o.jsx(Ck,{desktopIntegrationAvailable:!0})}),o.jsx(tU,{bridge:e})]}):o.jsx(Ck,{desktopIntegrationAvailable:!1})}function Ck({desktopIntegrationAvailable:e}){const t=al(),{theme:r,toggle:s}=Dy(),n=Xr(),l=M9(n.pathname,e),u=g.useRef(null),[d,m]=g.useState([]),[f,v]=g.useState([]),[p,x]=g.useState(!1),b=g.useCallback(async()=>{try{m(await xe.listAgents())}catch(S){pe.error(`Failed to load agents: ${S.message}`)}},[]),w=g.useCallback(async()=>{const S=await Promise.allSettled([xe.listPlugins(),xe.listAgents()]);S[0].status==="fulfilled"&&v(S[0].value),S[1].status==="fulfilled"&&m(S[1].value)},[]);g.useEffect(()=>{l&&l!=="emulator"&&w()},[w,l]),g.useEffect(()=>{if(t)return;let S=!0;const E=async()=>{try{const R=await xe.meta();S&&x(DZ(R))}catch{}};E();const N=window.setInterval(()=>void E(),15e3);return()=>{S=!1,window.clearInterval(N)}},[t]),g.useEffect(()=>{const S=window.requestAnimationFrame(()=>{var E;return(E=u.current)==null?void 0:E.focus({preventScroll:!0})});return()=>window.cancelAnimationFrame(S)},[n.pathname]);const C=DL([{path:"/",element:o.jsx(Va,{replace:!0,to:vt.sessions})},{path:rd,element:o.jsx(Va,{replace:!0,to:lx})},{path:vt.overview,element:o.jsx(fH,{plugins:f,agents:d,desktopIntegrationAvailable:e})},{path:vt.runtimes,element:o.jsx(KH,{})},{path:vt.providers,element:o.jsx($H,{})},{path:vt.projects,element:o.jsx(LH,{})},{path:vt.plugins,element:o.jsx(yH,{plugins:f,theme:r,onChange:w})},{path:vt.agents,element:o.jsx(yU,{agents:d,onChange:b})},{path:vt.skills,element:o.jsx(kZ,{})},{path:k9,element:o.jsx(T_,{})},{path:E9,element:o.jsx(T_,{})},{path:vt.sessions,element:o.jsx(T_,{})},{path:`${vt.sessions}/:sessionId`,element:o.jsx(OZ,{})},{path:vt.emulator,element:o.jsx(JU,{})},...e?[{path:vt.localRuntime,element:o.jsx(aH,{})},{path:vt.computerUse,element:o.jsx(TU,{})}]:bA.map(S=>({path:vt[S],element:o.jsx(Va,{replace:!0,to:lx})})),...Object.entries(N9).map(([S,E])=>({path:E,element:o.jsx(Va,{replace:!0,to:vt[S]})})),...Object.entries(j9).map(([S,E])=>({path:S,element:o.jsx(Va,{replace:!0,to:E})})),{path:"*",element:o.jsx(Va,{replace:!0,to:vt.sessions})}]),k=l?o.jsx(sU,{activeView:l,desktopIntegrationAvailable:e,children:C}):C;return o.jsx(K9,{theme:r,onToggleTheme:s,children:o.jsxs("div",{ref:u,id:"main-content",tabIndex:-1,className:"flex h-full min-h-0 flex-col overflow-hidden focus:outline-none",children:[p&&o.jsxs("div",{role:"alert",className:"flex shrink-0 items-start gap-2 border-b border-[color-mix(in_srgb,var(--warning)_35%,var(--border))] bg-[color-mix(in_srgb,var(--warning)_8%,var(--background))] px-4 py-2 text-xs text-[var(--warning)]",children:[o.jsx(bi,{className:"mt-0.5 size-4 shrink-0","aria-hidden":"true"}),e?o.jsxs("span",{children:["The local Runtime is running an older build. Restart it from"," ",o.jsx("strong",{children:"Settings → Local Runtime"}),", then reload this page."]}):o.jsxs("span",{children:["The resident daemon is running an older build. Run"," ",o.jsx("code",{className:"font-mono font-semibold",children:"rynx restart"}),", then reload this page."]})]}),o.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:k})]})})}function OZ(){const{sessionId:e}=Kk(),t=Xr();if(!e)return o.jsx(Va,{replace:!0,to:vt.sessions});const r=CA(t.search)??"local";return o.jsx(Va,{replace:!0,to:Io(r,e)})}function BZ(e){const{theme:t}=Dy();return o.jsx(AB,{theme:t,...e})}var Mk;((Mk=window.rynxDesktopIntegration)==null?void 0:Mk.platform)==="darwin"&&(document.documentElement.dataset.rynxDesktopPlatform="macos");YD.createRoot(document.getElementById("root")).render(o.jsx(g.StrictMode,{children:o.jsx(v4,{children:o.jsx(q9,{children:o.jsxs(G9,{children:[o.jsx(LZ,{}),o.jsx(BZ,{richColors:!0,position:"top-right"})]})})})}));export{bq as _,na as a,D0 as c,Tk as g,o as j,g as r,vR as t};
|