@fungi.computer/inkcap 0.0.0-stage → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +106 -2
- package/backend/document-activity.ts +77 -0
- package/backend/documents-changed.ts +31 -0
- package/backend/gills.ts +55 -0
- package/backend/index.ts +52 -0
- package/backend/methods.ts +194 -0
- package/backend/test/cloudflare-workers.fixture.ts +1 -0
- package/backend/test/document-marker.test.ts +128 -0
- package/backend/test/gills.test.ts +156 -0
- package/backend/test/methods.test.ts +456 -0
- package/backend/tsconfig.json +14 -0
- package/backend/vitest.config.ts +12 -0
- package/dist/assets/Anton-5.3.0-latin-Byf51wtH.woff2 +0 -0
- package/dist/assets/BricolageGrotesque-VF-latin-Cre6nC2_.woff2 +0 -0
- package/dist/assets/DepartureMono-Regular-2BZob_Zz.woff2 +0 -0
- package/dist/assets/FileTab-bwd_G6y3.js +2078 -0
- package/dist/assets/Fraunces-Italic-VF-latin-D2JnYqd-.woff2 +0 -0
- package/dist/assets/Fraunces-VF-latin-CFFu7zhK.woff2 +0 -0
- package/dist/assets/GrenzeGotisch-VF-latin-BhUVw2FV.woff2 +0 -0
- package/dist/assets/InkcapFileTree-Cx3HsaWr.js +1 -0
- package/dist/assets/InstrumentSans-Italic-VF-latin-BlcgWI5J.woff2 +0 -0
- package/dist/assets/InstrumentSans-VF-latin-BbzFLZTg.woff2 +0 -0
- package/dist/assets/MapleMono-VF-CCDrizxw.woff2 +0 -0
- package/dist/assets/NothingYouCouldDo-Regular-B7VfwEBS.woff2 +0 -0
- package/dist/assets/Nunito-VF-8c6a9bb-cyrillic-BsWUdSU9.woff2 +0 -0
- package/dist/assets/Nunito-VF-8c6a9bb-cyrillic-ext-Cb1j0nGJ.woff2 +0 -0
- package/dist/assets/Nunito-VF-8c6a9bb-latin-BYs3GYNf.woff2 +0 -0
- package/dist/assets/Nunito-VF-8c6a9bb-latin-ext-0RvtKGDy.woff2 +0 -0
- package/dist/assets/Nunito-VF-8c6a9bb-vietnamese-cS2dauUA.woff2 +0 -0
- package/dist/assets/abap-CLvhMVsD.js +1 -0
- package/dist/assets/actionscript-3-Cs6JJXT5.js +1 -0
- package/dist/assets/ada-C5qYipkI.js +1 -0
- package/dist/assets/ahk-CA9gdOdF.js +1 -0
- package/dist/assets/ahk2-_6rzW9BS.js +1 -0
- package/dist/assets/andromeeda-vGVdxbeo.js +1 -0
- package/dist/assets/angular-html-B8mrqUL5.js +1 -0
- package/dist/assets/angular-ts-Bzix210W.js +1 -0
- package/dist/assets/apache-U0d_L8uA.js +1 -0
- package/dist/assets/apex-KFGFyKwG.js +1 -0
- package/dist/assets/apl-Dhin1L29.js +1 -0
- package/dist/assets/applescript-CCn79oCD.js +1 -0
- package/dist/assets/ara-4CJ0cIlV.js +1 -0
- package/dist/assets/asciidoc-SCjQUq34.js +1 -0
- package/dist/assets/asm-Cmm7eHzH.js +1 -0
- package/dist/assets/astro-B-4NNgOP.js +1 -0
- package/dist/assets/aurora-x-CDeNXAV0.js +1 -0
- package/dist/assets/awk-BWXHIvNe.js +1 -0
- package/dist/assets/ayu-dark-DluEY0Gj.js +1 -0
- package/dist/assets/ayu-light-C3h-C4tm.js +1 -0
- package/dist/assets/ayu-mirage-Bqwy1Gya.js +1 -0
- package/dist/assets/ballerina-B7ZEbQpA.js +1 -0
- package/dist/assets/bat-qdxAdBWQ.js +1 -0
- package/dist/assets/beancount-D-usSTwE.js +1 -0
- package/dist/assets/berry-DKpUyyne.js +1 -0
- package/dist/assets/bibtex-Ci_nEsc7.js +1 -0
- package/dist/assets/bicep-CUHmPFLl.js +1 -0
- package/dist/assets/bird2-CYIUgYqB.js +1 -0
- package/dist/assets/blade-C6Gedziy.js +1 -0
- package/dist/assets/bsl-_VjlB9mv.js +1 -0
- package/dist/assets/c-iCihek07.js +1 -0
- package/dist/assets/c3-D0apG41V.js +1 -0
- package/dist/assets/cadence-CQ2zXKGN.js +1 -0
- package/dist/assets/cairo-DLTphjLi.js +1 -0
- package/dist/assets/catppuccin-frappe-C9Q5zVZY.js +1 -0
- package/dist/assets/catppuccin-latte-CtsyrtPq.js +1 -0
- package/dist/assets/catppuccin-macchiato-R8nAf1vR.js +1 -0
- package/dist/assets/catppuccin-mocha-DjuaAJKi.js +1 -0
- package/dist/assets/chapel-DmtgEXO_.js +1 -0
- package/dist/assets/clarity-CtfBBspg.js +1 -0
- package/dist/assets/clojure-DqKBuwfJ.js +1 -0
- package/dist/assets/cmake-Bj61d0ZC.js +1 -0
- package/dist/assets/cobol-Cw2-KvLW.js +1 -0
- package/dist/assets/codeowners-C8r90Shi.js +1 -0
- package/dist/assets/codeql-oeQT6MSM.js +1 -0
- package/dist/assets/coffee-CiiSLhB6.js +1 -0
- package/dist/assets/common-lisp-Cv5bFMCO.js +1 -0
- package/dist/assets/coq-DuBRPxYg.js +1 -0
- package/dist/assets/cpp-71xkOQct.js +1 -0
- package/dist/assets/crystal-DGPAtLeY.js +1 -0
- package/dist/assets/csharp-oqKa8noW.js +1 -0
- package/dist/assets/css-CNuuLpMC.js +1 -0
- package/dist/assets/csv-Dx-8-gkx.js +1 -0
- package/dist/assets/cue-CE9AQfxI.js +1 -0
- package/dist/assets/cypher-ClKdZ_lG.js +1 -0
- package/dist/assets/d-qD-0Kul2.js +1 -0
- package/dist/assets/dark-plus-Cs2F2srj.js +1 -0
- package/dist/assets/dart-CnvKMtbv.js +1 -0
- package/dist/assets/dax-BkyTk9wS.js +1 -0
- package/dist/assets/desktop-Dlh5hvp9.js +1 -0
- package/dist/assets/dialog-CWwO4mBD.js +71 -0
- package/dist/assets/diff-woXpYk--.js +1 -0
- package/dist/assets/docker-IyjqRm3v.js +1 -0
- package/dist/assets/dotenv-_5a1GRtc.js +1 -0
- package/dist/assets/dracula-BHWKrbxM.js +1 -0
- package/dist/assets/dracula-soft-5eyTD99u.js +1 -0
- package/dist/assets/dream-maker-DW3nJb8Q.js +1 -0
- package/dist/assets/edge-DCY0a-ow.js +1 -0
- package/dist/assets/elixir-DP304Xio.js +1 -0
- package/dist/assets/elm-o4NJxfws.js +1 -0
- package/dist/assets/emacs-lisp-c_oH4hRZ.js +1 -0
- package/dist/assets/erb-C7MPl934.js +1 -0
- package/dist/assets/erlang-Cphh6RMH.js +1 -0
- package/dist/assets/everforest-dark-sB-x3p7T.js +1 -0
- package/dist/assets/everforest-light-Df2xbC6M.js +1 -0
- package/dist/assets/fennel-DQxkIbk2.js +1 -0
- package/dist/assets/fish-BJitypiv.js +1 -0
- package/dist/assets/fluent-C03EYrpw.js +1 -0
- package/dist/assets/fortran-fixed-form-DEKoE2YW.js +1 -0
- package/dist/assets/fortran-free-form-CYNrtFtB.js +1 -0
- package/dist/assets/fsharp-D13ZGOAj.js +1 -0
- package/dist/assets/gdresource-xMC7jr7x.js +1 -0
- package/dist/assets/gdscript-DYvRD3hg.js +1 -0
- package/dist/assets/gdshader-CBce3t8t.js +1 -0
- package/dist/assets/genie-CV2tkWYe.js +1 -0
- package/dist/assets/gherkin-DExj1W_8.js +1 -0
- package/dist/assets/git-commit-BSykSTBG.js +1 -0
- package/dist/assets/git-rebase-BDPpS8w6.js +1 -0
- package/dist/assets/github-dark-C-LZuMrd.js +1 -0
- package/dist/assets/github-dark-default-DXG-b-1a.js +1 -0
- package/dist/assets/github-dark-dimmed-Bx1FflLF.js +1 -0
- package/dist/assets/github-dark-high-contrast-B_tTalzw.js +1 -0
- package/dist/assets/github-light-EUqPIrTm.js +1 -0
- package/dist/assets/github-light-default-BXViO-2h.js +1 -0
- package/dist/assets/github-light-high-contrast-B68TUdTA.js +1 -0
- package/dist/assets/gleam-CSRkHgEL.js +1 -0
- package/dist/assets/glimmer-js-BONyzAsu.js +1 -0
- package/dist/assets/glimmer-ts-f9c0GCOe.js +1 -0
- package/dist/assets/glsl-D5MA2a_X.js +1 -0
- package/dist/assets/gn-ilITqXS6.js +1 -0
- package/dist/assets/gnuplot-7GGW24-e.js +1 -0
- package/dist/assets/go-rLFTqkRN.js +1 -0
- package/dist/assets/graphql-Ctjuxyvl.js +1 -0
- package/dist/assets/groovy-CacY0gHj.js +1 -0
- package/dist/assets/gruvbox-dark-hard-C820rvS2.js +1 -0
- package/dist/assets/gruvbox-dark-medium-BPjhmG05.js +1 -0
- package/dist/assets/gruvbox-dark-soft-MrdJrrXF.js +1 -0
- package/dist/assets/gruvbox-light-hard-BC_s9l72.js +1 -0
- package/dist/assets/gruvbox-light-medium-BAWPOn9u.js +1 -0
- package/dist/assets/gruvbox-light-soft-BSMLrYjP.js +1 -0
- package/dist/assets/hack-Dh_ZLRbs.js +1 -0
- package/dist/assets/haml-CwEpbK1d.js +1 -0
- package/dist/assets/handlebars-ryMP1rBR.js +1 -0
- package/dist/assets/haskell-D8IpX4py.js +1 -0
- package/dist/assets/haxe-C8oCnwJJ.js +1 -0
- package/dist/assets/hcl-Dh228itO.js +1 -0
- package/dist/assets/hjson-CxZEssPk.js +1 -0
- package/dist/assets/hlsl-Cvrh5tZx.js +1 -0
- package/dist/assets/horizon-CE9ld1lL.js +1 -0
- package/dist/assets/horizon-bright-DSNQnXHK.js +1 -0
- package/dist/assets/houston-CsvMBhTu.js +1 -0
- package/dist/assets/html-XwrE-1r6.js +1 -0
- package/dist/assets/html-derivative-i4STDFnl.js +1 -0
- package/dist/assets/http-kmH8AyfE.js +1 -0
- package/dist/assets/hurl-DCZHXKU4.js +1 -0
- package/dist/assets/hxml-Dcm88srW.js +1 -0
- package/dist/assets/hy-CZbG8q4J.js +1 -0
- package/dist/assets/imba-DsUTQ-LC.js +1 -0
- package/dist/assets/index-BNEzthyN.js +1279 -0
- package/dist/assets/index-ByFi_OY2.css +2 -0
- package/dist/assets/ini-B5eOa1yu.js +1 -0
- package/dist/assets/java-DdHNQ9hk.js +1 -0
- package/dist/assets/javascript-obGGvMPs.js +1 -0
- package/dist/assets/jinja-B-tLrNsM.js +1 -0
- package/dist/assets/jison-CBjhYtSs.js +1 -0
- package/dist/assets/json-DAgxKhMr.js +1 -0
- package/dist/assets/json5-BR5RXkoi.js +1 -0
- package/dist/assets/jsonc-CYpm1nAK.js +1 -0
- package/dist/assets/jsonl-CmCQp5Yx.js +1 -0
- package/dist/assets/jsonnet-CJTPZ8u_.js +1 -0
- package/dist/assets/jssm-DXw9l8Rf.js +1 -0
- package/dist/assets/jsx-gTgmArGx.js +1 -0
- package/dist/assets/julia-CXJVy74_.js +1 -0
- package/dist/assets/just-B9Xn_Dp4.js +1 -0
- package/dist/assets/kanagawa-dragon-Bozd7klA.js +1 -0
- package/dist/assets/kanagawa-lotus-BmuOG9ZW.js +1 -0
- package/dist/assets/kanagawa-wave-BML5mF2J.js +1 -0
- package/dist/assets/kdl-CsD5j6eV.js +1 -0
- package/dist/assets/kotlin-DhhofPvG.js +1 -0
- package/dist/assets/kusto-C7mF5XQf.js +1 -0
- package/dist/assets/laserwave-C_8bwKvT.js +1 -0
- package/dist/assets/latex-o9DRzaEe.js +1 -0
- package/dist/assets/lean-CewbzKMR.js +1 -0
- package/dist/assets/less-DVTAwKKz.js +1 -0
- package/dist/assets/light-plus-DVQuIRkW.js +1 -0
- package/dist/assets/liquid-G0MH4h_m.js +1 -0
- package/dist/assets/llvm-DqHOMS-s.js +1 -0
- package/dist/assets/log-BNLmms1o.js +1 -0
- package/dist/assets/logo-Cluzi2Zq.js +1 -0
- package/dist/assets/lua-FONpmTUP.js +1 -0
- package/dist/assets/luau-C2pBCSgt.js +1 -0
- package/dist/assets/make-Dixweg8N.js +1 -0
- package/dist/assets/markdown-BYOwaDjH.js +1 -0
- package/dist/assets/marko-DV5GrDmo.js +1 -0
- package/dist/assets/material-theme-Bm3Qr25_.js +1 -0
- package/dist/assets/material-theme-darker-2IIEA8gg.js +1 -0
- package/dist/assets/material-theme-lighter-uhdI0v04.js +1 -0
- package/dist/assets/material-theme-ocean-CHQ94UKr.js +1 -0
- package/dist/assets/material-theme-palenight-B5W6OYN7.js +1 -0
- package/dist/assets/matlab-D7qyCx1q.js +1 -0
- package/dist/assets/mdc-BKfPFPZw.js +1 -0
- package/dist/assets/mdx-DQZ5AkYe.js +1 -0
- package/dist/assets/mermaid-BxpfTIzt.js +1 -0
- package/dist/assets/min-dark-BSWPekZh.js +1 -0
- package/dist/assets/min-light-DDpmG2fV.js +1 -0
- package/dist/assets/mipsasm-BMqwQI7S.js +1 -0
- package/dist/assets/mojo-fg40_ntQ.js +1 -0
- package/dist/assets/monokai-B_bV9PQ9.js +1 -0
- package/dist/assets/moonbit-DgjMoLWr.js +1 -0
- package/dist/assets/move-BYnGhZoM.js +1 -0
- package/dist/assets/narrat-_X_XdTYD.js +1 -0
- package/dist/assets/nextflow-BJtWHP5T.js +1 -0
- package/dist/assets/nextflow-groovy-DJMQeKeT.js +1 -0
- package/dist/assets/nginx-BTMw9COX.js +1 -0
- package/dist/assets/night-owl-DhmEMT88.js +1 -0
- package/dist/assets/night-owl-light-eJ-hLW7d.js +1 -0
- package/dist/assets/nim-B6yJ_yaC.js +1 -0
- package/dist/assets/nix-IvuFDN5E.js +1 -0
- package/dist/assets/nord-Cb4Vim4T.js +1 -0
- package/dist/assets/nsis-CjNLYCLg.js +1 -0
- package/dist/assets/nushell-DHYfO66s.js +1 -0
- package/dist/assets/objective-c-D1A_Heim.js +1 -0
- package/dist/assets/objective-cpp-BsSzOQcm.js +1 -0
- package/dist/assets/ocaml-O90oeIOV.js +1 -0
- package/dist/assets/odin-B1RWQWA5.js +1 -0
- package/dist/assets/one-dark-pro-CLwyXe_n.js +1 -0
- package/dist/assets/one-light-D7Lr4KcI.js +1 -0
- package/dist/assets/openscad-BUDT5pXO.js +1 -0
- package/dist/assets/org-Ddi8Gs6E.js +1 -0
- package/dist/assets/pascal-4ZHwLPI5.js +1 -0
- package/dist/assets/perl-DEgXgjuC.js +1 -0
- package/dist/assets/php-B9UPq-vz.js +1 -0
- package/dist/assets/pierre-dark-CpLgRqie.js +1 -0
- package/dist/assets/pierre-dark-protanopia-deuteranopia-B35FxJx-.js +1 -0
- package/dist/assets/pierre-dark-soft-kZQmAZld.js +1 -0
- package/dist/assets/pierre-dark-tritanopia-CpjhbsIL.js +1 -0
- package/dist/assets/pierre-dark-vibrant-CpQYzh95.js +1 -0
- package/dist/assets/pierre-light-CoaEpmwp.js +1 -0
- package/dist/assets/pierre-light-protanopia-deuteranopia-0fSaH845.js +1 -0
- package/dist/assets/pierre-light-soft-lWLdNTOI.js +1 -0
- package/dist/assets/pierre-light-tritanopia-CEbqgOJL.js +1 -0
- package/dist/assets/pierre-light-vibrant-D80Fkn33.js +1 -0
- package/dist/assets/pkl-ot-7Btpt.js +1 -0
- package/dist/assets/plastic-DQwYfKfQ.js +1 -0
- package/dist/assets/plsql-DGHpHOYJ.js +1 -0
- package/dist/assets/po-BiJDBrnU.js +1 -0
- package/dist/assets/poimandres-DRFjx7u4.js +1 -0
- package/dist/assets/polar-C7UOKdEL.js +1 -0
- package/dist/assets/postcss-BXeXVLqQ.js +1 -0
- package/dist/assets/powerquery-DNMTfnFr.js +1 -0
- package/dist/assets/powershell-CCSX75yM.js +1 -0
- package/dist/assets/prisma-DMgNhnYS.js +1 -0
- package/dist/assets/prolog-iXnhIJG7.js +1 -0
- package/dist/assets/proto-DB4EqR-F.js +1 -0
- package/dist/assets/pug-DkgDHZci.js +1 -0
- package/dist/assets/puppet-CDv2pdJW.js +1 -0
- package/dist/assets/purescript-9MfHhQsQ.js +1 -0
- package/dist/assets/python-gzcpVVnB.js +1 -0
- package/dist/assets/qml-_a-QhfPD.js +1 -0
- package/dist/assets/qmldir-DCQb3MpD.js +1 -0
- package/dist/assets/qss-Fe1Jh2GI.js +1 -0
- package/dist/assets/r-BHcO8Vjq.js +1 -0
- package/dist/assets/racket-DcIDlBhZ.js +1 -0
- package/dist/assets/raku-B3gFvitq.js +1 -0
- package/dist/assets/razor-BMJ0eI3p.js +1 -0
- package/dist/assets/rbs-C0MpOrj4.js +1 -0
- package/dist/assets/red-DX1BQOs8.js +1 -0
- package/dist/assets/reg-CRGYupPL.js +1 -0
- package/dist/assets/regexp-DR20uMnK.js +1 -0
- package/dist/assets/rel-BtDbiS_P.js +1 -0
- package/dist/assets/riscv-Ckw8ddFX.js +1 -0
- package/dist/assets/rolldown-runtime-hePW80VL.js +1 -0
- package/dist/assets/ron-VUp2lXgN.js +1 -0
- package/dist/assets/rose-pine-aMsaMD1D.js +1 -0
- package/dist/assets/rose-pine-dawn-8PwUyIlP.js +1 -0
- package/dist/assets/rose-pine-moon-DO-qXg-I.js +1 -0
- package/dist/assets/rosmsg-CAekHB0j.js +1 -0
- package/dist/assets/rst-BQCbfb9V.js +1 -0
- package/dist/assets/ruby-B8JcIHv0.js +1 -0
- package/dist/assets/rust-Cfkwpbl8.js +1 -0
- package/dist/assets/sas-CBpMWA2M.js +1 -0
- package/dist/assets/sass-DXrisJhu.js +1 -0
- package/dist/assets/scala-BiFt_7mu.js +1 -0
- package/dist/assets/scheme-DQCgrYNe.js +1 -0
- package/dist/assets/scss-YesllqfO.js +1 -0
- package/dist/assets/sdbl-bTVj8UrX.js +1 -0
- package/dist/assets/shaderlab-TOUzSsQk.js +1 -0
- package/dist/assets/shellscript-Da78Ox-3.js +1 -0
- package/dist/assets/shellsession-CVsQGYfZ.js +1 -0
- package/dist/assets/slack-dark-DnToyrRv.js +1 -0
- package/dist/assets/slack-ochin-B2OO5cIa.js +1 -0
- package/dist/assets/smalltalk-BHpQb5nM.js +1 -0
- package/dist/assets/smithy-Dgaz7aur.js +1 -0
- package/dist/assets/snazzy-light-4G7pJPwS.js +1 -0
- package/dist/assets/solarized-dark-UdsmMDCL.js +1 -0
- package/dist/assets/solarized-light-C1IUL_tW.js +1 -0
- package/dist/assets/solidity-Bj7E1mRn.js +1 -0
- package/dist/assets/soy-DEd-qcad.js +1 -0
- package/dist/assets/sparql-D_iOobhT.js +1 -0
- package/dist/assets/splunk-BC2Px7Mm.js +1 -0
- package/dist/assets/sql-DdD7vxS4.js +1 -0
- package/dist/assets/ssh-config-BgfXC-Er.js +1 -0
- package/dist/assets/stata-CMv7m7Gi.js +1 -0
- package/dist/assets/stylus-B6D30XZt.js +1 -0
- package/dist/assets/surrealql-BZoq2lXR.js +1 -0
- package/dist/assets/svelte-Bj3Hmc9F.js +1 -0
- package/dist/assets/swift-CyEgAFGc.js +1 -0
- package/dist/assets/synthwave-84-nFMaYfgc.js +1 -0
- package/dist/assets/system-verilog-Dh5ihWbf.js +1 -0
- package/dist/assets/systemd-BxMlprV5.js +1 -0
- package/dist/assets/talonscript-CohzipZa.js +1 -0
- package/dist/assets/tasl-DMoTqEGO.js +1 -0
- package/dist/assets/tcl-CZd0xW_V.js +1 -0
- package/dist/assets/templ-TjxbArHn.js +1 -0
- package/dist/assets/terraform-DswuEJGm.js +1 -0
- package/dist/assets/tex-BK-H2Wn4.js +1 -0
- package/dist/assets/tokyo-night-oM2G3aXe.js +1 -0
- package/dist/assets/toml-CcmNWLt0.js +1 -0
- package/dist/assets/ts-tags-Cc5do7zu.js +1 -0
- package/dist/assets/tsv-sltzmVWM.js +1 -0
- package/dist/assets/tsx-CUOciP0b.js +1 -0
- package/dist/assets/turtle-ByJddavk.js +1 -0
- package/dist/assets/twig-BVSnuTf-.js +1 -0
- package/dist/assets/typescript-BydbNFcO.js +1 -0
- package/dist/assets/typespec-BRdr0IET.js +1 -0
- package/dist/assets/typst-C40W_gC6.js +1 -0
- package/dist/assets/useForm-CuiUTLkb.js +1 -0
- package/dist/assets/v-DBj4K9d_.js +1 -0
- package/dist/assets/vala-zf12oZj6.js +1 -0
- package/dist/assets/vb-DOwzaHZ0.js +1 -0
- package/dist/assets/verilog-B2gwz-sJ.js +1 -0
- package/dist/assets/vesper-DdrHHSXu.js +1 -0
- package/dist/assets/vhdl-BroJfC0k.js +1 -0
- package/dist/assets/viml-DvXPmvsu.js +1 -0
- package/dist/assets/vitesse-black-fwtXNY1n.js +1 -0
- package/dist/assets/vitesse-dark-BZCL-v6S.js +1 -0
- package/dist/assets/vitesse-light-VbXTXTou.js +1 -0
- package/dist/assets/vue-BNQF7r6F.js +1 -0
- package/dist/assets/vue-html-DkKkQnZL.js +1 -0
- package/dist/assets/vue-vine-DFaKYU4X.js +1 -0
- package/dist/assets/vyper-CgoNMtux.js +1 -0
- package/dist/assets/wasm-BnjxR4X6.js +1 -0
- package/dist/assets/wasm-ByWQv1Qj.js +1 -0
- package/dist/assets/wenyan-C8pVoKbM.js +1 -0
- package/dist/assets/wgsl-BsKzXJz4.js +1 -0
- package/dist/assets/wikitext-ClFFjSW2.js +1 -0
- package/dist/assets/wit-DdvCle-K.js +1 -0
- package/dist/assets/wolfram-DLL8P-h_.js +1 -0
- package/dist/assets/xml-BlnrEAEy.js +1 -0
- package/dist/assets/xsl-BOPS8gLt.js +1 -0
- package/dist/assets/yaml-Du_6cdrH.js +1 -0
- package/dist/assets/zenscript-BnlCZFoB.js +1 -0
- package/dist/assets/zig-CMLA9XwU.js +1 -0
- package/dist/index.html +15 -0
- package/package.json +225 -3
|
@@ -0,0 +1,1279 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./FileTab-bwd_G6y3.js","./rolldown-runtime-hePW80VL.js","./dialog-CWwO4mBD.js","./useForm-CuiUTLkb.js","./InkcapFileTree-Cx3HsaWr.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{$t as n,Bn as r,Cr as i,In as a,Ir as o,Ln as s,Lr as c,Nn as l,Rn as u,Rr as d,Sr as f,Vn as p,_r as m,a as h,ar as g,br as _,c as v,cr as y,dr as b,en as x,er as S,fr as C,gr as w,hr as T,i as ee,ir as te,jn as ne,lr as E,mr as D,n as re,nr as O,o as k,or as A,pr as j,r as ie,rr as ae,s as oe,sr as se,t as ce,tn as le,ur as ue,vr as M,xr as N,yr as P,zn as de}from"./dialog-CWwO4mBD.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var fe=(e,t)=>{switch(t.length){case 0:return e;case 1:return t[0](e);case 2:return t[1](t[0](e));case 3:return t[2](t[1](t[0](e)));case 4:return t[3](t[2](t[1](t[0](e))));case 5:return t[4](t[3](t[2](t[1](t[0](e)))));case 6:return t[5](t[4](t[3](t[2](t[1](t[0](e))))));case 7:return t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))));case 8:return t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e))))))));case 9:return t[8](t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))))));default:{let n=e;for(let e=0,r=t.length;e<r;e++)n=t[e](n);return n}}},pe={pipe(){return fe(this,arguments)}},me=function(){function e(){}return e.prototype=pe,e}(),F=function(e,t){if(typeof e==`function`)return function(){return e(arguments)?t.apply(this,arguments):e=>t(e,...arguments)};switch(e){case 0:case 1:throw RangeError(`Invalid arity ${e}`);case 2:return function(e,n){return arguments.length>=2?t(e,n):function(n){return t(n,e)}};case 3:return function(e,n,r){return arguments.length>=3?t(e,n,r):function(r){return t(r,e,n)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);let n=arguments;return function(e){return t(e,...n)}}}},he=e=>e,ge=e=>()=>e,_e=ge(!0),ve=ge(void 0),ye=ve;function be(e,t,n,r,i,a,o,s,c){switch(arguments.length){case 1:return e;case 2:return function(){return t(e.apply(this,arguments))};case 3:return function(){return n(t(e.apply(this,arguments)))};case 4:return function(){return r(n(t(e.apply(this,arguments))))};case 5:return function(){return i(r(n(t(e.apply(this,arguments)))))};case 6:return function(){return a(i(r(n(t(e.apply(this,arguments))))))};case 7:return function(){return o(a(i(r(n(t(e.apply(this,arguments)))))))};case 8:return function(){return s(o(a(i(r(n(t(e.apply(this,arguments))))))))};case 9:return function(){return c(s(o(a(i(r(n(t(e.apply(this,arguments)))))))))}}}function xe(e){let t=new WeakMap;return n=>{let r=t.get(n);if(r!==void 0)return r;let i=e(n);return t.set(n,i),i}}function Se(e){let t=new WeakMap;return n=>{let r=t.get(n);if(r!==void 0)return r;let i=e(n);return t.set(n,i),i!==n&&t.set(i,i),i}}var Ce=e=>{let t=new Set(Reflect.ownKeys(e));if(e.constructor===Object)return t;e instanceof Error&&t.delete(`stack`);let n=Object.getPrototypeOf(e),r=n;for(;r!==null&&r!==Object.prototype;){let e=Reflect.ownKeys(r);for(let n=0;n<e.length;n++)t.add(e[n]);r=Object.getPrototypeOf(r)}return t.has(`constructor`)&&typeof e.constructor==`function`&&n===e.constructor.prototype&&t.delete(`constructor`),t},we=new WeakSet,Te=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),I=0,Ee=()=>{I++};function De(e){return typeof e==`string`}function Oe(e){return typeof e==`number`}function ke(e){return typeof e==`boolean`}function Ae(e){return typeof e==`symbol`}function je(e){return De(e)||Oe(e)||Ae(e)}function Me(e){return typeof e==`function`}function Ne(e){return e===void 0}function Pe(e){return e!=null}function Fe(e){return!0}function Ie(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Le(e){return typeof e==`object`&&!!e||Me(e)}var Re=F(2,(e,t)=>Le(e)&&t in e),ze=`~effect/Hash`,Be=e=>{switch(typeof e){case`number`:return Ke(e);case`bigint`:return qe(e.toString(10));case`string`:return qe(e);case`function`:case`object`:if(e===null)break;if(e instanceof Date)return Number.isNaN(e.getTime())?qe(`Invalid Date`):qe(e.toISOString());if(e instanceof RegExp)return qe(e.toString());{if(we.has(e))return Ve(e);let t=nt.get(e);if(t!==void 0)return t;if(rt.has(e))return Ee(),qe(`[Circular]`);rt.add(e);let n=I,r;try{r=`~effect/Hash`in e?e[ze]():typeof e==`function`?Ve(e):e instanceof DataView?Ze(Te(e)):Array.isArray(e)||ArrayBuffer.isView(e)?Ze(e):e instanceof Map?Qe(e):e instanceof Set?et(e):Ye(e)}finally{rt.delete(e)}return n===I&&nt.set(e,r),r}}return We(He(qe(String(e))))},Ve=e=>(tt.has(e)||tt.set(e,We(Math.random()*4294967296|0)),tt.get(e)),He=e=>(e^=e>>>16,e=Math.imul(e,2246822507),e^=e>>>13,e=Math.imul(e,3266489909),e^e>>>16),Ue=F(2,(e,t)=>He(Math.imul(e,2654435761)+Math.imul(t,2246822507))),We=e=>e&3221225471|e>>>1&1073741824,Ge=new DataView(new ArrayBuffer(8)),Ke=e=>{let t=e|0;return t===e?We(t):(Ge.setFloat64(0,e===e?e:NaN),We(Ue(Ge.getInt32(0),Ge.getInt32(4))))},qe=e=>{let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return We(t)},Je=(e,t)=>{let n=12289;for(let r of t)n^=Ue(Be(r),Be(e[r]));return We(n)},Ye=e=>Je(e,Ce(e)),Xe=(e,t)=>n=>{let r=e;for(let e of n)r^=t(e);return We(r)},Ze=e=>{let t=6151;for(let n of e)t=Ue(t,Be(n));return We(t)},Qe=Xe(qe(`Map`),([e,t])=>Ue(Be(e),Be(t))),$e=qe(`Set`),et=Xe($e,e=>Ue($e,Be(e))),tt=new WeakMap,nt=new WeakMap,rt=new WeakSet,it=`~effect/Equal`;function at(){return arguments.length===1?e=>ot(e,arguments[0]):ot(arguments[0],arguments[1])}function ot(e,t){if(e===t)return!0;if(e==null||t==null)return!1;let n=typeof e;return n===typeof t?n===`number`&&e!==e&&t!==t?!0:n!==`object`&&n!==`function`||we.has(e)||we.has(t)?!1:st(e,t):!1}function st(e,t){let n=R.length;for(let r=n;r-->0;)if(R[r]===e&&ct[r]===t)return!0;if(n)return L(e,t);let r=lt.get(e);r||lt.set(e,r=new WeakMap);let i=r.get(t);return i===void 0&&r.set(t,i=L(e,t)),i}function L(e,t){R.push(e),ct.push(t);try{return ut(e,t)}finally{R.pop(),ct.pop()}}var R=[],ct=[],lt=new WeakMap;function ut(e,t){if(Be(e)!==Be(t))return!1;if(e instanceof Date){if(!(t instanceof Date))return!1;let n=e.getTime(),r=t.getTime();return n===r||Number.isNaN(n)&&Number.isNaN(r)}if(e instanceof RegExp)return t instanceof RegExp&&e.toString()===t.toString();let n=_t(e);if(n!==_t(t)||typeof e==`function`&&!n)return!1;if(n)return e[it](t);if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:dt(e,t);if(ArrayBuffer.isView(e)){let n=e instanceof DataView;return!ArrayBuffer.isView(t)||e.byteLength!==t.byteLength||n!==t instanceof DataView?!1:n?ft(Te(e),Te(t)):ft(e,t)}return e instanceof Map?!(t instanceof Map)||e.size!==t.size?!1:mt(e,t,ht,gt):e instanceof Set?!(t instanceof Set)||e.size!==t.size?!1:mt(e,t,Be,ot):pt(e,t)}function dt(e,t){for(let n=0;n<e.length;n++)if(!ot(e[n],t[n]))return!1;return!0}function ft(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function pt(e,t){let n=Ce(e),r=Ce(t);if(n.size!==r.size)return!1;for(let i of n)if(!r.has(i)||!ot(e[i],t[i]))return!1;return!0}function mt(e,t,n,r){let i=new Map,a=0;for(let e of t){let t=n(e),r=i.get(t);r?r.push(e):i.set(t,[e]),a++}outer:for(let t of e){let e=i.get(n(t));if(e){for(let n=0;n<e.length;n++)if(r(t,e[n])){e[n]=e[e.length-1],e.pop(),a--;continue outer}}return!1}return a===0}var ht=e=>Be(e[0]),gt=(e,t)=>ot(e[0],t[0])&&ot(e[1],t[1]),_t=e=>Re(e,it),vt=Symbol.for(`~effect/Redactable`),yt=e=>Re(e,vt);function bt(e){return yt(e)?xt(e):e}function xt(e){return e[vt](globalThis[`~effect/Fiber/currentFiber`]?.context??wt)}var St=`~effect/Fiber/currentFiber`,Ct=new Map,wt={"~effect/Context":{},base:Ct,depth:0,mapUnsafe:Ct,pipe(){return fe(this,arguments)}};function Tt(e,t){let n=t?.space??0,r=new WeakSet,i=n?typeof n==`number`?` `.repeat(n):n:``,a=e=>i.repeat(e),o=(e,t)=>{let n=e?.constructor;return n&&n!==Object.prototype.constructor&&n.name?`${n.name}(${t})`:t},s=e=>{try{return Reflect.ownKeys(e)}catch{return[`[ownKeys threw]`]}};function c(e,t=0){try{return l(e,t)}catch{return(typeof e==`object`&&e||typeof e==`function`)&&r.delete(e),`[inspection threw]`}}function l(e,n=0){if(typeof e==`string`)return JSON.stringify(e);if(typeof e==`number`||e==null||typeof e==`boolean`||typeof e==`symbol`)return String(e);if(typeof e==`bigint`)return String(e)+`n`;if(typeof e==`object`||typeof e==`function`){if(r.has(e))return Et;r.add(e);let l;if(vt in e)l=c(xt(e),n);else if(Array.isArray(e))l=!i||e.length<=1?`[${e.map(e=>c(e,n)).join(`,`)}]`:`[\n${a(n+1)}${e.map(e=>c(e,n+1)).join(`,
|
|
3
|
+
`+a(n+1))}\n${a(n)}]`;else if(e instanceof Date)l=kt(e);else if(!t?.ignoreToString&&Re(e,`toString`)&&typeof e.toString==`function`&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString){let t=At(e);l=e instanceof Error&&e.cause!==void 0?`${t} (cause: ${c(e.cause,n)})`:t}else if(Symbol.iterator in e)l=`${e.constructor.name}(${c(Array.from(e),n)})`;else{let t=s(e);if(!i||t.length<=1){let r=`{${t.map(t=>`${Dt(t)}:${c(jt(e,t),n)}`).join(`,`)}}`;l=o(e,r)}else{let r=`{\n${t.map(t=>`${a(n+1)}${Dt(t)}: ${c(jt(e,t),n+1)}`).join(`,
|
|
4
|
+
`)}\n${a(n)}}`;l=o(e,r)}}return r.delete(e),l}return String(e)}return c(e,0)}var Et=`[Circular]`;function Dt(e){return typeof e==`string`?JSON.stringify(e):String(e)}function Ot(e){return e.map(e=>`[${Dt(e)}]`).join(``)}function kt(e){try{return e.toISOString()}catch{return`Invalid Date`}}function At(e){try{let t=e.toString();return typeof t==`string`?t:String(t)}catch{return`[toString threw]`}}function jt(e,t){try{return e[t]}catch{return`[property access threw]`}}function Mt(e,t){let n=[];return JSON.stringify(e,function(e,t){let r=Object.getOwnPropertyDescriptor(this,e)?.value,i=Re(r,vt)?bt(r):bt(t);if(typeof i==`bigint`)return Tt(i);if(typeof i!=`object`||!i)return i;let a=i instanceof Error&&!Re(i,`toJSON`)?{...i,name:i.name,message:i.message}:i;for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(n.includes(i))return;if(n.push(i),a!==i&&n.push(a),!Nt(a)||Pt(a))return a;let o=new Proxy(a,{get(e,t){let n=Reflect.get(e,t,e);return Object.getOwnPropertyDescriptor(e,t)?.get===void 0?n:bt(n)}});return n.push(o),o},t?.space)??`null`}function Nt(e){for(let t of Object.getOwnPropertyNames(e))if(Object.getOwnPropertyDescriptor(e,t)?.get!==void 0)return!0;return!1}function Pt(e){for(let t of[Number.prototype.valueOf,Boolean.prototype.valueOf,String.prototype.valueOf])try{return Reflect.apply(t,e,[]),!0}catch{}return!1}var Ft=Symbol.for(`nodejs.util.inspect.custom`),It=e=>{try{return e=bt(e),Re(e,`toJSON`)&&Me(e.toJSON)&&e.toJSON.length===0?e.toJSON():Array.isArray(e)?e.map(It):e}catch{return`[toJSON threw]`}},Lt={toJSON(){return It(this)},[Ft](){return this.toJSON()},toString(){return Tt(this.toJSON())}},Rt=(()=>{let e=Object.getOwnPropertyDescriptor(Error,`stackTraceLimit`);return e===void 0?Object.isExtensible(Error):Object.hasOwn(e,`writable`)?e.writable===!0:e.set!==void 0})(),zt=()=>Error.stackTraceLimit,Bt=e=>{Rt&&(Error.stackTraceLimit=e)},Vt=class{constructor(e){this.value=e,this.done=!1}next(e){return this.done?(this.value=e,this):(this.done=!0,{value:this.value,done:!1})}},Ht=(()=>{let e=`~effect/Utils/internal`,t={[e]:e=>e()},n={[e]:e=>{try{return e()}finally{}}};return zt()!==0&&t[e](()=>Error().stack)?.includes(e)===!0?t[e]:n[e]})();function Ut(e,t,n){t===`__proto__`?Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[t]=n}function Wt(e,t){for(let n of Reflect.ownKeys(t))Object.prototype.propertyIsEnumerable.call(t,n)&&Ut(e,n,t[n])}var Gt=`~effect/Effect`,Kt=`~effect/Exit`,qt={_A:he,_E:he,_R:he},Jt=`${Gt}/identifier`,z=`${Gt}/args`,Yt=`${Gt}/evaluate`,Xt=`${Gt}/successCont`,Zt=`${Gt}/failureCont`,Qt=`${Gt}/ensureCont`,$t=Symbol.for(`effect/Effect/Yield`),en={pipe(){return fe(this,arguments)},toJSON(){return{...this}},toString(){return Tt(this.toJSON(),{ignoreToString:!0,space:2})},[Ft](){return this.toJSON()}},tn={[Gt]:qt,...en,[Symbol.iterator](){return new Vt(this)},toJSON(){return{_id:`Effect`,op:this[Jt],...z in this?{args:this[z]}:void 0}}},nn=e=>Re(e,Kt),rn=`~effect/Cause`,an=`~effect/Cause/Reason`,on=e=>Re(e,rn),sn=class{constructor(e){this[rn]=rn,this.reasons=e}pipe(){return fe(this,arguments)}toJSON(){return{_id:`Cause`,failures:this.reasons.map(e=>e.toJSON())}}toString(){return`Cause(${Tt(this.reasons)})`}[Ft](){return this.toJSON()}[it](e){return on(e)&&this.reasons.length===e.reasons.length&&this.reasons.every((t,n)=>at(t,e.reasons[n]))}[ze](){return Ze(this.reasons)}},cn=new WeakMap,ln=class{[an];annotations;_tag;constructor(e,t,n){if(this[an]=an,this._tag=e,t!==un&&typeof n==`object`&&n&&t.size>0){let e=cn.get(n);e&&(t=new Map([...e,...t])),cn.set(n,t)}this.annotations=t}annotate(e,t){if(e.mapUnsafe.size===0)return this;let n=new Map(this.annotations);e.mapUnsafe.forEach((e,r)=>{t?.overwrite!==!0&&n.has(r)||n.set(r,e)});let r=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return r.annotations=n,r}pipe(){return fe(this,arguments)}toString(){return Tt(this)}[Ft](){return this.toString()}},un=new Map,dn=class extends ln{constructor(e,t=un){super(`Fail`,t,e),this.error=e}toString(){return`Fail(${Tt(this.error)})`}toJSON(){return{_tag:`Fail`,error:this.error}}[it](e){return yn(e)&&at(this.error,e.error)&&at(this.annotations,e.annotations)}[ze](){return Ue(qe(this._tag))(Ue(Be(this.error))(Be(this.annotations)))}},fn=e=>new sn(e),pn=(e,t)=>{let n=new Map,r=[];for(let i of e.concat(t)){let e=Be(i),t=n.get(e);if(t===void 0)n.set(e,[i]);else if(t.some(e=>at(e,i)))continue;else t.push(i);r.push(i)}return r},mn=F(2,(e,t)=>{if(e.reasons.length===0)return t;if(t.reasons.length===0)return e;let n=new sn(pn(e.reasons,t.reasons));return at(e,n)?e:n}),hn=e=>new sn([new dn(e)]),gn=class extends ln{constructor(e,t=un){super(`Die`,t,e),this.defect=e}toString(){return`Die(${Tt(this.defect)})`}toJSON(){return{_tag:`Die`,defect:this.defect}}[it](e){return bn(e)&&at(this.defect,e.defect)&&at(this.annotations,e.annotations)}[ze](){return Ue(qe(this._tag))(Ue(Be(this.defect))(Be(this.annotations)))}},_n=e=>new sn([new gn(e)]),vn=F(e=>on(e[0]),(e,t,n)=>t.mapUnsafe.size===0?e:new sn(e.reasons.map(e=>e.annotate(t,n)))),yn=e=>e._tag===`Fail`,bn=e=>e._tag===`Die`,xn=e=>e._tag===`Interrupt`;function Sn(e){return jn(`Effect.evaluate: Not implemented`)}var Cn=e=>({...tn,[Jt]:e.op,[Yt]:e[Yt]??Sn,[Xt]:e[Xt],[Zt]:e[Zt],[Qt]:e[Qt]}),wn=e=>{let t=Cn(e),n=function(e){this[z]=e};return n.prototype=t,function(e){return new n(e)}},Tn=e=>{let t={[Kt]:Kt,_tag:e.op,get[e.prop](){return this[z]},...Cn(e),toString(){return`${e.op}(${Tt(this[z])})`},toJSON(){return{_id:`Exit`,_tag:e.op,[e.prop]:this[z]}},[it](e){return nn(e)&&e._tag===this._tag&&at(this[z],e[z])},[ze](){return Ue(qe(e.op),Be(this[z]))}},n=function(e){this[z]=e};return n.prototype=t,function(e){return new n(e)}},En=Tn({op:`Success`,prop:`value`,[Yt](e){let t=e.getCont(Xt);return t?t[Xt](this[z],e,this):e.yieldWith(this)}}),Dn={key:`effect/Cause/StackTrace`},On={key:`effect/Cause/InterruptorStackTrace`},kn=Tn({op:`Failure`,prop:`cause`,[Yt](e){let t=this[z],n=!1;e.cache.stackFrame&&(t=vn(t,{mapUnsafe:new Map([[Dn.key,e.cache.stackFrame]])}),n=!0);let r=e.getCont(Zt),i=e._interruptedCause;if(i&&e.interruptible){let a=!1;for(;r&&e.interruptible;)a||=Jt in r,r=e.getCont(Zt);a&&(t=fn(t.reasons.filter(e=>e._tag!==`Fail`))),t=mn(t,i),n=!0}return r?r[Zt](t,e,n?void 0:this):e.yieldWith(n?kn(t):this)}}),An=e=>kn(hn(e)),jn=e=>kn(_n(e)),Mn=wn({op:`WithFiber`,[Yt](e){return this[z](e)}}),Nn=function(){class e extends globalThis.Error{}let t=Cn({op:`YieldableError`,[Yt](){return An(this)}});return delete t.toString,Object.assign(e.prototype,t),e}(),Pn=function(){let e=Symbol.for(`effect/Data/Error/plainArgs`);return class extends Nn{constructor(t){super(t?.message,t?.cause?{cause:t.cause}:void 0),t&&(Wt(this,t),Object.defineProperty(this,e,{value:t,enumerable:!1}))}toJSON(){return{...this[e],...this}}}}(),Fn=e=>{class t extends Pn{_tag=e}return t.prototype.name=e,t};Fn(`NoSuchElementError`);var In=e=>Cn({op:e.label,[Yt]:e.evaluate}),Ln=`~effect/Option`,Rn={[Ln]:{_A:e=>e},...en,[Symbol.iterator](){return new Vt(this)}},zn=Object.defineProperty(Object.assign(Object.create(Rn),{_tag:`Some`,_op:`Some`,[it](e){return Hn(e)&&Wn(e)&&at(this.value,e.value)},[ze](){return Ue(Be(this._tag))(Be(this.value))},toString(){return`some(${Tt(this.value)})`},toJSON(){return{_id:`Option`,_tag:this._tag,value:It(this.value)}}}),"valueOrUndefined",{get(){return this.value}}),Bn=Be(`None`),Vn=Object.assign(Object.create(Rn),{_tag:`None`,_op:`None`,valueOrUndefined:void 0,[it](e){return Hn(e)&&Un(e)},[ze](){return Bn},toString(){return`none()`},toJSON(){return{_id:`Option`,_tag:this._tag}}}),Hn=e=>Re(e,Ln),Un=e=>e._tag===`None`,Wn=e=>e._tag===`Some`,Gn=Object.create(Vn),Kn=function(e){this.value=e};Kn.prototype=zn;var qn=e=>new Kn(e),Jn=`~effect/Result`,Yn={[Jn]:{_A:e=>e,_E:e=>e},...en,[Symbol.iterator](){return new Vt(this)}},Xn=Object.assign(Object.create(Yn),{_tag:`Success`,_op:`Success`,[it](e){return Qn(e)&&er(e)&&at(this.success,e.success)},[ze](){return Ue(Be(this._tag))(Be(this.success))},toString(){return`success(${Tt(this.success)})`},toJSON(){return{_id:`Result`,_tag:this._tag,value:It(this.success)}}}),Zn=Object.assign(Object.create(Yn),{_tag:`Failure`,_op:`Failure`,[it](e){return Qn(e)&&$n(e)&&at(this.failure,e.failure)},[ze](){return Ue(Be(this._tag))(Be(this.failure))},toString(){return`failure(${Tt(this.failure)})`},toJSON(){return{_id:`Result`,_tag:this._tag,failure:It(this.failure)}}}),Qn=e=>Re(e,Jn),$n=e=>e._tag===`Failure`,er=e=>e._tag===`Success`,tr=function(e){this.failure=e};tr.prototype=Zn;var nr=e=>new tr(e),rr=function(e){this.success=e};rr.prototype=Xn;var ir=e=>new rr(e);function ar(e){return(t,n)=>t===n?0:e(t,n)}var or=ar((e,t)=>e<t?-1:1),sr=ar((e,t)=>globalThis.Number.isNaN(e)&&globalThis.Number.isNaN(t)?0:globalThis.Number.isNaN(e)?-1:globalThis.Number.isNaN(t)?1:e<t?-1:1),cr=e=>F(2,(t,n)=>e(t,n)===-1),lr=e=>F(2,(t,n)=>e(t,n)===1),ur=e=>F(2,(t,n)=>e(t,n)!==1),dr=e=>F(2,(t,n)=>e(t,n)!==-1),fr=()=>Gn,pr=qn,mr=Un,hr=Wn,gr=F(2,(e,{onNone:t,onSome:n})=>mr(e)?t():n(e.value)),_r=F(2,(e,t)=>mr(e)?t():e.value),vr=F(2,(e,t)=>mr(e)?t():e),yr=_r(ve),br=F(2,(e,t)=>mr(e)?fr():pr(t(e.value))),xr=`~effect/Context/Service`,Sr=function(){function e(){}let t=e;Object.setPrototypeOf(t,Cr);let n=(e,n)=>(t.key=e,n?.defaultValue&&(t[Tr]=Tr,t.defaultValue=n.defaultValue),n?.make&&(t.make=n.make),n?.fiberCached&&wr.add(e),t);return arguments.length>0?n(arguments[0],arguments[1]):n},Cr={[xr]:xr,...In({label:`Service`,evaluate(e){return En(Gr(e.context,this))}}),toJSON(){return{_id:`Service`,key:this.key}},of(e){return e},context(e){return Vr(this,e)},use(e){return Mn(t=>e(Gr(t.context,this)))},useSync(e){return Mn(t=>En(e(Gr(t.context,this))))}},wr=new Set,Tr=`~effect/Context/Reference`,Er=`~effect/Context`,Dr=8,Or=8,kr=(e,t,n,r)=>{let i=Object.create(Fr);return i.cacheRoot=e??i,i.base=t,i.overlay=n,i.depth=r,i._flat=void 0,i.baseHits=0,i},Ar=(e,t)=>{t&&(Ar(e,t.parent),e.set(t.key,t.value))},jr=e=>{if(e._flat)return e._flat;if(!e.overlay)return e._flat=e.base;let t=new Map(e.base);return Ar(t,e.overlay),e._flat=t},Mr=Symbol(),Nr=(e,t)=>{let n=e;for(let e=n.overlay;e;e=e.parent)if(e.key===t)return e.value;let r=n.base.get(t);return r===void 0&&!n.base.has(t)?Mr:(n.overlay&&++n.baseHits>=n.base.size&&n.baseHits>=Or&&(n.base=jr(n),n.overlay=void 0,n.depth=0),r)},Pr=e=>kr(void 0,e,void 0,0),Fr={get mapUnsafe(){return jr(this)},...en,[Er]:{_Services:e=>e},toJSON(){return{_id:`Context`,services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[it](e){if(!Lr(e))return!1;let t=this.mapUnsafe,n=e.mapUnsafe;if(t.size!==n.size)return!1;for(let[e,r]of t)if(!n.has(e)||!at(r,n.get(e)))return!1;return!0},[ze](){return Ke(this.mapUnsafe.size)}},Ir=(e,t)=>e.cacheRoot===t.cacheRoot,Lr=e=>Re(e,Er),Rr=e=>!!e[Tr],zr=()=>Br,Br=Pr(new Map),Vr=(e,t)=>Pr(new Map([[e.key,t]])),Hr=F(3,(e,t,n)=>Ur(e,t.key,n)),Ur=(e,t,n)=>{let r=e,i=wr.has(t)?void 0:r.cacheRoot;if(r.depth>=Dr){let e=new Map(r.mapUnsafe);return e.set(t,n),kr(i,e,void 0,0)}return kr(i,r.base,{key:t,value:n,parent:r.overlay},r.depth+1)},Wr=(e,t)=>{let n=Nr(e,t);return n===Mr?void 0:n},Gr=F(2,(e,t)=>{let n=Nr(e,t.key);if(n===Mr){if(Rr(t))return qr(t);throw Jr(t)}return n}),Kr=`~effect/Context/defaultValue`,qr=e=>Kr in e?e[Kr]:e[Kr]=e.defaultValue(),Jr=e=>{let t=Error(`Service not found${e.key?`: ${String(e.key)}`:``}`);if(t.stack){let e=t.stack.split(`
|
|
5
|
+
`);e.splice(1,3),t.stack=e.join(`
|
|
6
|
+
`)}return t},Yr=Sr,Xr=e=>e.length>0,Zr=ir,Qr=nr,$r=$n,ei=F(2,(e,t)=>$r(e)?Qr(t(e.failure)):e),ti=F(2,(e,{onFailure:t,onSuccess:n})=>$r(e)?t(e.failure):n(e.success)),ni=globalThis.Array,ri=F(2,(e,t)=>[...e,t]);ni.isArray;var ii=Xr,ai=Xr,oi=()=>[],si=F(2,(e,t)=>e.map(t)),ci=`~effect/Duration`,li=BigInt(0),ui=BigInt(1),di=BigInt(2),fi=BigInt(10),pi=BigInt(1e3),mi=e=>BigInt(e<0?Math.ceil(e-.5):Math.floor(e+.5)),hi=e=>mi(e*1e6),gi=(e,t)=>{let n=e.indexOf(`.`);if(n===-1)return BigInt(e)*t;let r=e[0]===`-`,i=e.slice(n+1),a=fi**BigInt(i.length),o=(BigInt(e.slice(+!!r,n))*a+BigInt(i))*t,s=o/a+(o%a*di>=a?ui:li);return r?-s:s},_i=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,vi=e=>{switch(typeof e){case`number`:return Ai(e);case`bigint`:return ki(e);case`string`:{if(e===`Infinity`)return Di;if(e===`-Infinity`)return Oi;let t=_i.exec(e);if(!t)break;let[n,r,i]=t;if(i===`nano`||i===`nanos`)return ki(gi(r,ui));if(i===`micro`||i===`micros`)return ki(gi(r,pi));let a=Number(r);switch(i){case`milli`:case`millis`:return Ai(a);case`second`:case`seconds`:return ji(a);case`minute`:case`minutes`:return Mi(a);case`hour`:case`hours`:return Ni(a);case`day`:case`days`:return Pi(a);case`week`:case`weeks`:return Fi(a)}break}case`object`:{if(e===null)break;if(ci in e)return e;if(Array.isArray(e))return e.length!==2||!e.every(Oe)?yi(e):Number.isNaN(e[0])||Number.isNaN(e[1])?Ei:e[0]===-1/0||e[1]===-1/0?Oi:e[0]===1/0||e[1]===1/0?Di:wi(mi(e[0]*1e9+e[1]));let t=e,n=0;return t.weeks&&(n+=t.weeks*6048e5),t.days&&(n+=t.days*864e5),t.hours&&(n+=t.hours*36e5),t.minutes&&(n+=t.minutes*6e4),t.seconds&&(n+=t.seconds*1e3),t.milliseconds&&(n+=t.milliseconds),!t.microseconds&&!t.nanoseconds?wi(n):wi(mi(n*1e6+(t.microseconds??0)*1e3+(t.nanoseconds??0)))}}return yi(e)},yi=e=>{throw Error(`Invalid Input: ${e}`)},bi={_tag:`Millis`,millis:0},xi={_tag:`Infinity`},Si={_tag:`NegativeInfinity`},Ci={[ci]:ci,[ze](){switch(this.value._tag){case`Millis`:{let e=this.value.millis*1e6;return Number.isFinite(e)?Be(mi(e)):Ke(this.value.millis)}case`Nanos`:return Be(this.value.nanos);default:return Ye(this.value)}},[it](e){return Ti(e)&&zi(this,e)},toString(){switch(this.value._tag){case`Infinity`:return`Infinity`;case`NegativeInfinity`:return`-Infinity`;case`Nanos`:return`${this.value.nanos} nanos`;case`Millis`:return`${this.value.millis} millis`}},toJSON(){switch(this.value._tag){case`Millis`:return{_id:`Duration`,_tag:`Millis`,millis:this.value.millis};case`Nanos`:return{_id:`Duration`,_tag:`Nanos`,nanos:String(this.value.nanos)};case`Infinity`:return{_id:`Duration`,_tag:`Infinity`};case`NegativeInfinity`:return{_id:`Duration`,_tag:`NegativeInfinity`}}},[Ft](){return this.toJSON()},pipe(){return fe(this,arguments)}},wi=e=>{let t=Object.create(Ci);return t.value=typeof e==`number`?isNaN(e)||e===0||Object.is(e,-0)?bi:Number.isFinite(e)?Number.isInteger(e)?{_tag:`Millis`,millis:e}:{_tag:`Nanos`,nanos:hi(e)}:e>0?xi:Si:e===li?bi:{_tag:`Nanos`,nanos:e},t},Ti=e=>Re(e,ci),Ei=wi(0),Di=wi(1/0),Oi=wi(-1/0),ki=e=>wi(e),Ai=e=>wi(e),ji=e=>wi(e*1e3),Mi=e=>wi(e*6e4),Ni=e=>wi(e*36e5),Pi=e=>wi(e*864e5),Fi=e=>wi(e*6048e5),Ii=e=>{let t=vi(e);switch(t.value._tag){case`Infinity`:case`NegativeInfinity`:throw Error(`Cannot convert infinite duration to nanos`);case`Nanos`:return t.value.nanos;case`Millis`:return hi(t.value.millis)}},Li=F(3,(e,t,n)=>e.value._tag===`Infinity`||e.value._tag===`NegativeInfinity`||t.value._tag===`Infinity`||t.value._tag===`NegativeInfinity`?n.onInfinity(e,t):e.value._tag===`Millis`?t.value._tag===`Millis`?n.onMillis(e.value.millis,t.value.millis):n.onNanos(Ii(e),t.value.nanos):n.onNanos(e.value.nanos,Ii(t))),Ri=(e,t)=>Li(e,t,{onMillis:(e,t)=>e===t,onNanos:(e,t)=>e===t,onInfinity:(e,t)=>e.value._tag===t.value._tag}),zi=F(2,(e,t)=>Ri(e,t)),Bi=Yr(`effect/Scheduler`,{fiberCached:!0,defaultValue:()=>new Gi}),Vi=e=>{let t=!1;return Promise.resolve().then(()=>{t||e()}),()=>{t=!0}},Hi=`setImmediate`in globalThis?e=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{let t=setTimeout(e,0);return()=>clearTimeout(t)},Ui=e=>{try{return Hi(e)}catch{return Vi(e)}},Wi=class{buckets=[];scheduleTask(e,t){let n=this.buckets,r=n.length,i,a=0;for(;a<r&&!(n[a][0]>t);a++)i=n[a];i&&i[0]===t?i[1].push(e):a===r?n.push([t,[e]]):n.splice(a,0,[t,[e]])}drain(){let e=this.buckets;return this.buckets=[],e}},Gi=class{executionMode;setImmediate;constructor(e=`async`,t){this.executionMode=e,this.setImmediate=t??(e===`sync`?Vi:Ui)}shouldYield(e){return e.currentOpCount>=e.cache.maxOpsBeforeYield}makeDispatcher(){return new Ki(this.setImmediate)}},Ki=class{tasks=new Wi;running=void 0;setImmediate;constructor(e=Ui){this.setImmediate=e}scheduleTask(e,t){this.tasks.scheduleTask(e,t),this.running===void 0&&(this.running=this.setImmediate(this.afterScheduled))}afterScheduled=()=>{this.running=void 0,this.runTasks()};runTasks(){let e=this.tasks.drain();for(let t=0;t<e.length;t++){let n=e[t][1];for(let e=0;e<n.length;e++)n[e]()}}flush(){for(;this.tasks.buckets.length>0;)this.running!==void 0&&(this.running(),this.running=void 0),this.runTasks()}},qi=Yr(`effect/Scheduler/MaxOpsBeforeYield`,{fiberCached:!0,defaultValue:()=>2048}),Ji=Yr(`effect/Scheduler/PreventSchedulerYield`,{fiberCached:!0,defaultValue:()=>!1}),Yi=Fn,Xi=`~effect/encoding/EncodingError`,Zi=class extends Yi(`EncodingError`){[Xi]=Xi},Qi=`effect/Tracer/ParentSpan`;Sr()(Qi,{fiberCached:!0});var $i=`effect/Tracer`,ea=`effect/Metric/FiberRuntimeMetrics`,ta=Yr(`effect/References/CurrentStackFrame`,{fiberCached:!0,defaultValue:ve}),na=Yr(`effect/References/TracerEnabled`,{fiberCached:!0,defaultValue:_e}),ra=Yr(`effect/References/CurrentLogLevel`,{fiberCached:!0,defaultValue:()=>`Info`}),ia=Yr(`effect/References/MinimumLogLevel`,{fiberCached:!0,defaultValue:()=>`Info`}),aa=class extends ln{constructor(e,t=un){super(`Interrupt`,t,`Interrupted`),this.fiberId=e}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:`Interrupt`,fiberId:this.fiberId}}[it](e){return xn(e)&&this.fiberId===e.fiberId&&this.annotations===e.annotations}[ze](){return Ue(qe(`${this._tag}:${this.fiberId}`))(Ve(this.annotations))}},oa=e=>new sn([new aa(e)]),sa=e=>{for(let t=0;t<e.reasons.length;t++){let n=e.reasons[t];if(n._tag===`Fail`)return Zr(n.error)}return Qr(e)},ca=e=>e.reasons.some(xn),la=F(2,(e,t)=>{let n=!1,r=e.reasons.map(e=>yn(e)?(n=!0,new dn(t(e.error),e.annotations)):e);return n?fn(r):e}),ua=(e,t)=>{let n=[],r=[];if(e.reasons.length===0)return n;let i=zt();i!==0&&Bt(1);try{for(let i of e.reasons){if(i._tag===`Interrupt`){r.push(i);continue}n.push(da(i._tag===`Die`?i.defect:i.error,i.annotations,t))}if(n.length===0){let e=Error(`The fiber was interrupted by:`);e.name=`InterruptCause`,e.stack=ga(e,r);let i=new globalThis.Error(`All fibers interrupted without error`,{cause:e});i.name=`InterruptError`,i.stack=`${i.name}: ${i.message}`,n.push(da(i,r[0].annotations,t))}}finally{i!==0&&Bt(i)}return n},da=(e,t,n)=>{let r=typeof e,i;if(e&&r===`object`){if(i=new globalThis.Error(fa(e),{cause:e.cause?da(e.cause):void 0}),typeof e.name==`string`&&(i.name=e.name),typeof e.stack==`string`)i.stack=ma(e.stack,i,t);else{let e=`${i.name}: ${i.message}`;i.stack=t?ha(e,t):e}n?.includeCauseInStack&&(i.stack=ya(i));for(let t of Object.keys(e))t in i||(i[t]=e[t])}else{i=new globalThis.Error(e?r===`string`?e:Mt(e):`Unknown error: ${e}`);let n=`${i.name}: ${i.message}`;i.stack=t?ha(n,t):n}return i},fa=e=>{if(typeof e.message==`string`)return e.message;if(typeof e.toString==`function`&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString)try{return e.toString()}catch{}return Mt(e)},pa=/\((.*)\)/g,ma=(e,t,n)=>{let r=`${t.name}: ${t.message}`,i=(e.startsWith(r)?e.slice(r.length):e).split(`
|
|
7
|
+
`),a=[r];for(let e=1;e<i.length&&!/Generator\.next|~effect\/(?:Effect|Utils)/.test(i[e]);e++)a.push(i[e]);return n?ha(a.join(`
|
|
8
|
+
`),n):a.join(`
|
|
9
|
+
`)},ha=(e,t)=>{let n=t?.get(Dn.key);return n&&(e=`${e}\n${_a(n)}`),e},ga=(e,t)=>{let n=[`${e.name}: ${e.message}`];for(let e of t){let t=e.fiberId===void 0?`unknown`:`#${e.fiberId}`,r=e.annotations.get(On.key);n.push(` at fiber (${t})`),r&&n.push(_a(r))}return n.join(`
|
|
10
|
+
`)},_a=e=>{let t=[],n=e,r=0;for(;n&&r<10;){let e=n.stack();if(e){let r=e.matchAll(pa),i=!1;for(let[,e]of r)i=!0,t.push(` at ${n.name} (${e})`);i||t.push(` at ${n.name} (${e.replace(/^at /,``)})`)}else t.push(` at ${n.name}`);n=n.parent,r++}return t.join(`
|
|
11
|
+
`)},va=e=>ua(e).map(ya).join(`
|
|
12
|
+
`),ya=e=>e.cause?`${e.stack} {\n${ba(e.cause,` `)}\n}`:e.stack,ba=(e,t)=>{let n=e.stack.split(`
|
|
13
|
+
`),r=`${t}[cause]: ${n[0]}`;for(let e=1,i=n.length;e<i;e++)r+=`\n${t}${n[e]}`;return e.cause&&(r+=` {\n${ba(e.cause,`${t} `)}\n${t}}`),r},xa=`~effect/Fiber`,Sa={_A:he,_E:he},Ca={id:0},wa=(()=>{try{return globalThis.process?.getBuiltinModule?.(`node:async_hooks`)?.AsyncResource}catch{return}})(),Ta=()=>wa===void 0?void 0:new wa(`effect/Fiber`),Ea=()=>globalThis[St],Da=class{constructor(e,t=!0){this.setContext(e),this.id=++Ca.id,this.currentOpCount=0,this.interruptible=t,this._stack=[],this._observers=void 0,this._exit=void 0,this._children=void 0,this._interruptedCause=void 0,this._yielded=void 0,this._running=!1,this._deferredInterrupt=!1,this._parent=void 0,this._asyncContext=void 0,this.cache.runtimeMetrics?.recordFiberStart(this.context)}get[xa](){return Sa}get currentDispatcher(){return this._dispatcher??=this.cache.scheduler.makeDispatcher()}getRef(e){return Gr(this.context,e)}addObserver(e){return this._exit?(e(this._exit),ye):(this._observers===void 0?this._observers=[e]:this._observers.push(e),()=>this.removeObserver(e))}removeObserver(e){if(this._exit||this._observers===void 0)return;let t=this._observers.indexOf(e);t>=0&&this._observers.splice(t,1)}interruptUnsafe(e,t){if(this._exit)return;let n=oa(e);this.cache.stackFrame&&(n=vn(n,Vr(Dn,this.cache.stackFrame))),t&&(n=vn(n,t)),this._interruptedCause=this._interruptedCause?mn(this._interruptedCause,n):n,this.interruptible&&(this._running?this._deferredInterrupt=!0:this.evaluate(Ia(this._interruptedCause)))}pollUnsafe(){return this._exit}evaluate(e){if(this._exit)return;if(this._asyncContext!==void 0){let t=this._asyncContext;return this._asyncContext=void 0,t.runInAsyncScope(this.evaluate,this,e)}if(this._yielded!==void 0){let e=this._yielded;this._yielded=void 0,e()}let t=this.runLoop(e);if(t===$t){this._asyncContext=Ta();return}let n=ja.interruptChildren&&ja.interruptChildren(this);if(n!==void 0)return this.evaluate(co(n,()=>t));if(this._exit=t,this.cache.runtimeMetrics?.recordFiberEnd(this.context,this._exit),this._parent&&=(this._parent._children?.delete(this),void 0),this._observers!==void 0){let e=this._observers;this._observers=void 0;for(let n=0;n<e.length;n++)e[n](t)}this._stack.length=0,this._children=void 0,this.context=zr()}runLoop(e){let t=globalThis[St];globalThis[St]=this;let n=this._running;this._running=!0;let r=!1,i=e;this.currentOpCount=0;try{for(;;)try{this._deferredInterrupt&&(this._deferredInterrupt=!1,i=Ia(this._interruptedCause)),this.currentOpCount++;let e=this.cache;if(!r&&!e.preventYield&&e.scheduler.shouldYield(this)){r=!0;let e=i;i=co(Va,()=>e)}if(i=e.tracerContext?e.tracerContext(i,this):i[Yt](this),i===$t){let e=this._yielded;if(Kt in e)return this._deferredInterrupt=!1,this._yielded=void 0,e;if(this._deferredInterrupt){this._yielded=void 0,e();continue}return $t}}catch(e){if(!Re(i,Yt))return jn(`Fiber.runLoop: Not a valid effect: ${String(i)}`);i=jn(e)}}finally{this._running=n,globalThis[St]=t}}getCont(e){if(this._deferredInterrupt)return this._deferredInterrupt=!1,ka;for(;;){let t=this._stack.pop();if(!t)return;let n=t[Qt];if(n!==void 0){let r=n.call(t,this);if(r)return r[e]=r,r}if(t[e])return t}}succeedWith(e){if(!(++this.currentOpCount&Aa-1))return En(e);let t=this.getCont(Xt);return t?t[Xt](e,this):this.yieldWith(En(e))}yieldWith(e){return this._yielded=e,$t}children(){return this._children??=new Set}pipe(){return fe(this,arguments)}setContext(e){let t=this.context;if(this.context=e,t!==void 0&&Ir(t,e))return;let n=e.cacheRoot,r=n._fiberCache??=Oa(e);this.cache?.scheduler!==r.scheduler&&(this._dispatcher=void 0),this.cache=r}get currentSpanLocal(){let e=this.cache.span;return e?._tag===`Span`?e:void 0}},Oa=e=>{let t=Wr(e,$i);return{scheduler:Gr(e,Bi),tracer:t,tracerContext:t?t.context:void 0,tracerEnabled:Gr(e,na),span:Wr(e,Qi),logLevel:Gr(e,ra),minimumLogLevel:Gr(e,ia),stackFrame:Gr(e,ta),runtimeMetrics:Wr(e,ea),maxOpsBeforeYield:Gr(e,qi),preventYield:Gr(e,Ji)}},ka={[Xt](e,t){return Ia(t._interruptedCause)},[Zt](e,t){return Ia(t._interruptedCause)}},Aa=32,ja={interruptChildren:void 0},Ma=e=>{if(!e.cache.stackFrame)return;let t=new Map;return t.set(On.key,e.cache.stackFrame),Pr(t)},Na=e=>Ya(t=>{let n=e[Symbol.iterator](),r=[],i;function a(){let e=n.next();for(;!e.done;){if(e.value._exit){r.push(e.value._exit),e=n.next();continue}i=e.value.addObserver(e=>{r.push(e),a()});return}t(Fa(r))}return a(),Ra(()=>i?.())}),Pa=e=>Mn(t=>{let n=Ma(t),r=oi();for(let i of e)i.interruptUnsafe(t.id,n),r.push(i);return so(Na(r))}),Fa=En,Ia=kn,La=An,Ra=wn({op:`Sync`,[Yt](e){let t=this[z](),n=e.getCont(Xt);return n?n[Xt](t,e):e.yieldWith(En(t))}}),za=wn({op:`Suspend`,[Yt](e){return this[z]()}}),Ba=ti({onFailure:La,onSuccess:Fa}),Va=wn({op:`Yield`,[Yt](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate(go)},this[z]??0),e.yieldWith(()=>{t=!0})}})(0),Ha=e=>za(()=>Ia(e())),Ua=e=>jn(e),Wa=e=>za(()=>La(e())),Ga=Fa(void 0),Ka=e=>{let t=typeof e==`function`?e:e.try,n=typeof e==`function`?e=>new Wo(e,`An error occurred in Effect.try`):e.catch;return za(()=>{try{return Fa(t())}catch(e){return La(n(e))}})},qa=function(){let e=Cn({op:`Async`,[Yt](e){let t=!1,n=!1,r=this.withSignal?new AbortController:void 0,i=this.register.call(e.cache.scheduler,r=>{t||(t=!0,n?e.evaluate(r):n=r)},r?.signal);return n===!1?(n=!0,e._yielded=()=>{t=!0},r===void 0&&i===void 0||e._stack.push(Ja(()=>(t=!0,r?.abort(),i??go))),$t):n}}),t=function(e,t){this.register=e,this.withSignal=t};return t.prototype=e,function(e,n){return new t(e,n)}}(),Ja=wn({op:`AsyncFinalizer`,[Qt](e){e.interruptible&&(e.interruptible=!1,e._stack.push(Mo))},[Zt](e,t){return ca(e)?co(Ao(kn(e),this[z]()),()=>Ia(e)):Ia(e)}}),Ya=e=>qa(e,e.length>=2),Xa=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0}),Za=(e,...t)=>Xa(e.length,t.length===0?function(){return Qa(()=>e.apply(this,arguments))}:function(){let n=Qa(()=>e.apply(this,arguments));for(let e of t)n=e(n,...arguments);return n}),Qa=e=>{try{let t=e(),n;for(;;){let r=t.next(n);if(r.done)return Fa(r.value);let i=r.value;if(i&&i._tag===`Success`){n=i.value;continue}if(i&&i._tag===`Failure`)return r.value;{let n=!0;return za(()=>n?(n=!1,co(r.value,e=>$a(t,e))):za(()=>$a(e())))}}}catch(e){return Ua(e)}},$a=function(){let e=Cn({op:`Iterator`,[Xt](e,t){let n=this.iterator;for(;;){let r=n.next(e);if(r.done)return Fa(r.value);if(!lo(r.value))return t._stack.push(this),r.value;if(r.value._tag===`Failure`)return r.value;e=r.value.value}},[Yt](e){return this[Xt](this.initial,e)}}),t=function(e,t){this.iterator=e,this.initial=t};return t.prototype=e,function(e,n){return new t(e,n)}}(),eo=function(e){return e._stack.push(this),this[z]},to=Cn({op:`OnSuccess`,[Yt]:eo}),no=function(e,t,n){this[z]=e,this[Xt]=t,this.payload=n};no.prototype=to;var ro=function(){return this.payload},io=(()=>{let e=`~effect/Effect/stackProbe`;return{[e]:function(){return Error().stack}}[e]()?.includes(`[as `+e+`]`)===!0})(),ao=function(e,t){let n=this.payload;return t.succeedWith(io?n(e):Ht(()=>n(e)))},oo=function(e){let t=this.payload;return t(e)},so=e=>new no(e,ro,go),co=F(2,(e,t)=>new no(e,oo,t)),lo=e=>e[Kt]!==void 0,uo=F(2,(e,t)=>lo(e)?e._tag===`Success`?t(e.value):e:co(e,t)),fo=F(2,(e,t)=>new no(e,ao,t)),po=F(2,(e,t)=>lo(e)?_o(e,t):fo(e,t)),mo=F(2,(e,t)=>lo(e)?vo(e,t):wo(e,t)),ho=e=>e._tag===`Success`,go=En(void 0),_o=F(2,(e,t)=>e._tag===`Success`?En(t(e.value)):e),vo=F(2,(e,t)=>{if(e._tag===`Success`)return e;let n=sa(e.cause);return $r(n)?e:An(t(n.success))}),yo=F(2,(e,t)=>new xo(e,t.length===1?t:e=>t(e))),bo=Cn({op:`OnFailure`,[Yt]:eo}),xo=function(e,t){this[z]=e,this[Zt]=t};xo.prototype=bo;var So=F(3,(e,t,n)=>yo(e,e=>{let r=t(e);return $r(r)?Ia(r.failure):n(r.success,e)})),Co=F(2,(e,t)=>So(e,sa,e=>t(e))),wo=F(2,(e,t)=>Co(e,e=>Wa(()=>t(e)))),To=function(e,t){let n=this.payload;return t.succeedWith(io?n.onSuccess(e):Ht(()=>n.onSuccess(e)))},Eo=((e,t)=>{let n=Cn({op:e,[Yt]:eo,[Xt]:To,[Zt]:t}),r=function(e,t){this[z]=e,this.payload=t};return r.prototype=n,r})(`Match`,function(e,t){let n=e.reasons.find(yn);if(n===void 0)return Ia(e);let r=this.payload;return t.succeedWith(io?r.onFailure(n.error):Ht(()=>r.onFailure(n.error)))}),Do=F(2,(e,t)=>new Eo(e,t)),Oo=e=>lo(e)?En(e):ko(e),ko=wn({op:`Exit`,[Yt](e){return e._stack.push(this),this[z]},[Xt](e,t,n){return t.succeedWith(n??En(e))},[Zt](e,t,n){return t.succeedWith(n??kn(e))}}),Ao=(e,t)=>ho(e)?t:yo(t,t=>Ia(mn(e.cause,t))),jo=e=>Mn(t=>t.interruptible?(t.interruptible=!1,t._stack.push(Mo),e):e),Mo=wn({op:`SetInterruptible`,[Qt](e){if(e.interruptible=this[z],e._interruptedCause&&e.interruptible)return()=>Ia(e._interruptedCause)}})(!0),No=e=>e===`unbounded`?1/0:Math.max(1,e??1),Po=()=>e=>{let t=e.onItem,n=e.step,r=(e,t,r,a,o)=>co(Oo(o),o=>n(e,t[r],o,r)??i(e,t,r+1,a)??Ga),i=(e,i,a=0,o=i.length)=>{for(;a<o;a++){let s=i[a],c=t(e,s,a);if(!lo(c))return r(e,i,a,o,c);let l=n(e,s,c,a);if(l)return l._tag===`Failure`?l:void 0}};return i},Fo=e=>{let t=e.onItem,n=e.step;return(e,r,i)=>{let a=0,o=i.end??r.length,s=i.concurrency,c=!1,l,u,d,f,p,m=e=>{let t=jn(e);return f=t,c=!0,u&&u.size>0?co(jo(Pa(Array.from(u))),()=>f??t):t},h=()=>{let i=!1;for(;!f&&a<o;a++){let o=r[a],g=p??t(e,o,a);if(lo(g)){if(f=n(e,o,g,a),f)break}else if(l){p=void 0;let t=Lo(l,g,!0,!0,`inherit`);if(t._exit){if(f=n(e,o,t._exit,a),f)break;continue}u.add(t);let r=a;if(t.addObserver(a=>{u.delete(t);try{if(f){if(a._tag===`Failure`){let e=a.cause.reasons.filter(e=>e._tag!==`Interrupt`);if(e.length>0){let t=fn(e);f=kn(f._tag===`Failure`?mn(f.cause,t):t)}}}else{let t=n(e,o,a,r);t&&(f=t,h())}if(i){let e=h();e&&d(e)}else c&&u.size===0&&d(f??Ga)}catch(e){d(m(e))}}),u.size<s)continue;i=!0,a++;return}else return Ya(e=>{l=Ea(),u=new Set,p=g,d=e;let t;try{t=h()}catch(t){return e(m(t))}return t?e(t):za(()=>(f??=go,co(u?Pa(u):Ga,()=>f?._tag===`Failure`?f:Ga)))})}if(c=!0,f){if(u&&u.size>0){let e=Ma(l);u.forEach(t=>t.interruptUnsafe(l.id,e));return}if(d||f._tag===`Failure`)return f}else if(d){if(u)u.size===0&&d(Ga);else return go}};return h()}},Io=()=>e=>Fo(e),Lo=(e,t,n=!1,r=!1,i=!1)=>{let a=e,o=i===`inherit`?a.interruptible:!i,s=new Da(a.context,o);return r||(a.children().add(s),s._parent=a),n?s.evaluate(t):(s._asyncContext=Ta(),a.currentDispatcher.scheduleTask(()=>s.evaluate(t),0)),s},Ro=e=>(t,n)=>{let r=new Da(n?.scheduler?Hr(e,Bi,n.scheduler):e,n?.uninterruptible!==!0);if(r.evaluate(t),r._exit)return r;if(n?.signal){if(n.signal.aborted)r.interruptUnsafe();else{let e=()=>r.interruptUnsafe();n.signal.addEventListener(`abort`,e,{once:!0}),r.addObserver(()=>n.signal.removeEventListener(`abort`,e))}}return n?.onFiberStart&&n.onFiberStart(r),r},zo=Ro(zr()),Bo=(e=>{let t=Ro(e);return e=>{if(lo(e))return e;let n=new Gi(`sync`),r=t(e,{scheduler:n});return r._dispatcher?.flush(),r._exit??jn(new Ho(r))}})(zr());Fn(`TimeoutError`),Fn(`IllegalArgumentError`),Fn(`ExceededCapacityError`);var Vo=`~effect/Cause/AsyncFiberError`,Ho=class extends Fn(`AsyncFiberError`){[Vo]=Vo;constructor(e){super({message:`An asynchronous Effect was executed with Effect.runSync`,fiber:e})}},Uo=`~effect/Cause/UnknownError`,Wo=class extends Fn(`UnknownError`){[Uo]=Uo;constructor(e,t){super({message:t,cause:e})}},Go={bold:`1`,red:`31`,green:`32`,yellow:`33`,blue:`34`,cyan:`36`,white:`37`,gray:`90`,black:`30`,bgBrightRed:`101`};Go.gray,Go.blue,Go.green,Go.yellow,Go.red,Go.bgBrightRed,Go.black;var Ko=yn,qo=_n,Jo=la,Yo=va;Sr()(`effect/Cause/StackTrace`),Sr()(`effect/Cause/InterruptorStackTrace`);var Xo=En,Zo=kn,Qo=An,$o=go,es=ho,ts=`~effect/DateTime`,ns=`~effect/DateTime/TimeZone`,rs={[ts]:ts,pipe(){return fe(this,arguments)},[Ft](){return this.toString()},toJSON(){return as(this).toJSON()}};({...rs}),{...rs};var is={[ns]:ns,[Ft](){return this.toString()}};({...is}),{...is};var as=e=>new Date(e.epochMilliseconds);globalThis.String;var os=e=>e.trim(),ss=Fa,cs=za,ls=La,us=Ha,ds=Ua,fs=Ka,ps=Ba,ms=co,hs=Oo,gs=yo,_s=Do,vs=zo,ys=Bo;Sr()(`effect/Effect/Transaction`);var bs=po,xs=mo,Ss=uo,Cs=Za,ws=`~effect/BigDecimal`,Ts={[ws]:ws,[ze](){let e=Ns(this);return Ue(qe(String(e.value)),Ke(e.scale))},[it](e){return Es(e)&&Rs(this,e)===0},toString(){return`BigDecimal(${Bs(this)})`},toJSON(){return{_id:`BigDecimal`,value:String(this.value),scale:this.scale}},[Ft](){return this.toJSON()},pipe(){return fe(this,arguments)}},Es=e=>Re(e,ws),Ds=(e,t)=>{if(!Number.isSafeInteger(t))throw RangeError(`Scale must be a safe integer, got ${t}`);let n=Object.create(Ts);return n.value=e,n.scale=t,n},Os=(e,t)=>{let n=Ds(e,t);return n.normalized=n,n},ks=BigInt(0),As=BigInt(1),js=BigInt(10),Ms=Os(ks,0),Ns=e=>{if(e.normalized===void 0){if(e.value===ks)e.normalized=Ms;else{let t=`${e.value}`,n=t.length;for(;t[n-1]===`0`;)n--;e.normalized=Os(BigInt(t.slice(0,n)),e.scale-(t.length-n))}}return e.normalized},Ps=100,Fs=[As],Is=(e,t)=>e===t?0:e<t?-1:1,Ls=(e,t)=>{let n=`${e.value<ks?-e.value:e.value}`,r=`${t.value<ks?-t.value:t.value}`,i=BigInt(n.length-r.length)-BigInt(e.scale)+BigInt(t.scale);if(i!==ks)return i<ks?-1:1;let a=Math.max(n.length,r.length);return or(n.padEnd(a,`0`),r.padEnd(a,`0`))},Rs=(e,t)=>{if(e.scale===t.scale)return Is(e.value,t.value);let n=zs(e),r=zs(t);if(n!==r)return n<r?-1:1;if(n===0)return 0;let i=e.scale-t.scale,a=Math.abs(i);if(a>Ps)return n===-1?Ls(t,e):Ls(e,t);let o=Fs[a]??=js**BigInt(a);return i>0?Is(e.value,t.value*o):Is(e.value*o,t.value)},zs=e=>e.value===ks?0:e.value<ks?-1:1,Bs=e=>{let t=Ns(e);if(Math.abs(t.scale)>=16)return Vs(t);let n=t.value<ks,r=`${n?-t.value:t.value}`,i=t.scale>0?r.padStart(t.scale+1,`0`):r.padEnd(r.length-t.scale,`0`),a=i.length-t.scale,o=t.scale>0?`${i.slice(0,a)}.${i.slice(a)}`:i;return n?`-${o}`:o},Vs=e=>{if(Hs(e))return`0e+0`;let t=Ns(e),n=`${t.value}`,r=t.value<ks?2:1,i=n.slice(0,r),a=n.slice(r),o=a.length-t.scale;return`${i}${a===``?``:`.${a}`}e${o>=0?`+`:``}${o}`},Hs=e=>e.value===ks;Sr()(`effect/DateTime/CurrentTimeZone`);var Us=e=>Gs(typeof e==`string`?Ks.encode(e):e),Ws=e=>{let t=qs(e),n=t.length;if(n%4!=0)return Qr(new Zi({kind:`Decode`,module:`Base64`,input:t,message:`Length must be a multiple of 4, but is ${n}`}));let r=t.indexOf(`=`);if(r!==-1&&(r<n-2||r===n-2&&t[n-1]!==`=`))return Qr(new Zi({kind:`Decode`,module:`Base64`,input:t,message:`Found a '=' character, but it is not at the end`}));try{let e=t.endsWith(`==`)?2:+!!t.endsWith(`=`),r=new Uint8Array(n/4*3-e);for(let e=0,i=0;e<n;e+=4,i+=3){let n=Xs(t.charCodeAt(e))<<18|Xs(t.charCodeAt(e+1))<<12|Xs(t.charCodeAt(e+2))<<6|Xs(t.charCodeAt(e+3));r[i]=n>>16,r[i+1]=n>>8&255,r[i+2]=n&255}return Zr(r)}catch(e){return Qr(new Zi({kind:`Decode`,module:`Base64`,input:t,message:e instanceof Error?e.message:`Invalid input`}))}},Gs=e=>{let t=e.length,n=``,r;for(r=2;r<t;r+=3)n+=Js[e[r-2]>>2],n+=Js[(e[r-2]&3)<<4|e[r-1]>>4],n+=Js[(e[r-1]&15)<<2|e[r]>>6],n+=Js[e[r]&63];return r===t+1&&(n+=Js[e[r-2]>>2],n+=Js[(e[r-2]&3)<<4],n+=`==`),r===t&&(n+=Js[e[r-2]>>2],n+=Js[(e[r-2]&3)<<4|e[r-1]>>4],n+=Js[(e[r-1]&15)<<2],n+=`=`),n},Ks=new TextEncoder,qs=e=>e.replace(/[\n\r]/g,``),Js=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Ys=new Uint8Array(123).fill(255);for(let e=0;e<64;e++)Ys[Js.charCodeAt(e)]=e;Ys[61]=0;var Xs=e=>{if(e>=Ys.length||Ys[e]===255)throw TypeError(`Invalid character ${String.fromCharCode(e)}`);return Ys[e]};Yi(`CookiesError`),{...Lt},{...Lt};var Zs=new WeakMap,Qs=`~effect/Redacted`,$s=e=>Re(e,Qs),ec=(e,t)=>{let n=Object.create(tc);return t?.label&&(n.label=t.label),Zs.set(n,e),n},tc={[Qs]:{_A:e=>e},label:void 0,...en,toJSON(){return this.toString()},toString(){return`<redacted${De(this.label)?`:`+this.label:``}>`},[ze](){return Be(Zs.get(this))},[it](e){return $s(e)&&at(Zs.get(this),Zs.get(e))}};({...en});function nc(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function rc(e){return t=>nc(t)?.[e]}var ic=`~structural`,ac=`~sentinels`,oc=`~constructor`,sc=rc(`title`),cc=rc(`description`),lc=xe(e=>{let t=nc(e)?.identifier;return typeof t==`string`?t:e.getExpected(lc)}),B=Symbol(),uc=Xo,dc=uc(B),fc=uc(B),pc=e=>e===B?fr():pr(e),mc=e=>e._tag===`None`?dc:uc(e.value),hc=`~effect/SchemaIssue/Issue`;function gc(e){return Re(e,hc)&&e[hc]===hc}function _c(e){return Object.hasOwn(e,`input`)}var vc=class{[hc]=hc;constructor(e,t){t?.reportInput===!0&&e!==B&&(this.input=e)}},yc=class extends vc{_tag=`Filter`;filter;issue;constructor(e,t,n,r){super(n,r),this.filter=e,this.issue=t}},bc=class extends vc{_tag=`Encoding`;ast;issue;constructor(e,t,n,r){super(n,r),this.ast=e,this.issue=t}},xc=class extends vc{_tag=`Pointer`;path;issue;constructor(e,t){super(),this.path=e,this.issue=t}},Sc=class extends vc{_tag=`MissingKey`;annotations;constructor(e){super(),this.annotations=e}},Cc=class extends vc{_tag=`UnexpectedKey`;ast;constructor(e,t,n){super(t,n),this.ast=e}},wc=class extends vc{_tag=`Composite`;ast;issues;constructor(e,t,n,r){super(n,r),this.ast=e,this.issues=t}},Tc=class extends vc{_tag=`InvalidType`;ast;constructor(e,t,n){super(t,n),this.ast=e}},Ec=class extends vc{_tag=`InvalidValue`;annotations;constructor(e,t,n){super(t,n),this.annotations=e}},Dc=class extends vc{_tag=`AnyOf`;ast;issues;constructor(e,t,n,r){super(n,r),this.ast=e,this.issues=t}},Oc=class extends vc{_tag=`OneOf`;ast;successes;constructor(e,t,n,r){super(n,r),this.ast=e,this.successes=t}};function kc(e,t,n){if(gc(e))return e;if(typeof e==`string`)return new Ec({message:e},t,n);let r=typeof e.issue==`string`?new Ec({message:e.issue},t,n):e.issue;return new xc(e.path,r)}function Ac(e,t,n){if(e!==void 0)return typeof e==`boolean`?e?void 0:new Ec(void 0,t,n):kc(e,t,n)}function jc(e,t,n,r){return Array.isArray(t)?ai(t)?t.length===1?kc(t[0],n,r):new wc(e,si(t,e=>kc(e,n,r)),n,r):void 0:Ac(t,n,r)}var Mc=e=>{let t=Uc(e);if(t!==void 0)return t;switch(e._tag){case`InvalidType`:return Lc(lc(e.ast),e);case`InvalidValue`:{let t=Ic(e);if(t!==void 0)return Lc(t,e);let n=Fc(e);return n===void 0?`Expected a valid value`:`Invalid data ${n}`}case`MissingKey`:return`Missing key`;case`UnexpectedKey`:{let t=Fc(e);return t===void 0?`Expected no excess property`:`Unexpected key with value ${t}`}case`Forbidden`:return`Forbidden operation`;case`OneOf`:{let t=Fc(e);return t===void 0?`Expected exactly one member to match`:`Expected exactly one member to match the input ${t}`}}},Nc=e=>Uc(e.issue)??Uc(e);function Pc(e){return t=>({issues:Rc(t,[],e?.leafHook??Mc,e?.checkHook??Nc)})}function Fc(e){return _c(e)?Tt(e.input):void 0}function Ic(e){let t=e.annotations?.expected;return typeof t==`string`?t:void 0}function Lc(e,t){let n=Fc(t);return n===void 0?`Expected ${e}`:`Expected ${e}, got ${n}`}function Rc(e,t,n,r){switch(e._tag){case`Filter`:{let i=r(e);if(i!==void 0)return[{path:t,message:i}];if(e.issue._tag!==`InvalidValue`)return Rc(e.issue,t,n,r);let a=Ic(e.issue);return[{path:t,message:a===void 0?Lc(zc(e.filter),e):Lc(a,e.issue)}]}case`Encoding`:return Rc(e.issue,t,n,r);case`Pointer`:return Rc(e.issue,[...t,...e.path],n,r);case`Composite`:return e.issues.flatMap(e=>Rc(e,t,n,r));case`AnyOf`:return e.issues.length===0?[{path:t,message:Uc(e)??Lc(lc(e.ast),e)}]:e.issues.flatMap(e=>Rc(e,t,n,r));default:return[{path:t,message:n(e)}]}}function zc(e){let t=e.annotations?.expected;if(typeof t==`string`)return t;switch(e._tag){case`Filter`:return`<filter>`;case`FilterGroup`:return e.checks.map(e=>zc(e)).join(` & `)}}function Bc(){return e=>Hc(e,``)}var Vc=Bc();function Hc(e,t){let n;switch(e._tag){case`Filter`:{let r=Nc(e);if(r!==void 0)n=r;else{if(e.issue._tag!==`InvalidValue`)return Hc(e.issue,t);let r=Ic(e.issue);n=r===void 0?Lc(zc(e.filter),e):Lc(r,e.issue)}break}case`Encoding`:return Hc(e.issue,t);case`Pointer`:return Hc(e.issue,t+Ot(e.path));case`Composite`:case`AnyOf`:if(e._tag===`Composite`||e.issues.length>0)return e.issues.map(e=>Hc(e,t)).join(`
|
|
14
|
+
`);n=Uc(e)??Lc(lc(e.ast),e);break;default:n=Mc(e)}return t?`${n}\n at ${t}`:n}function Uc(e){if(e._tag===`Pointer`)return;if(e._tag===`Encoding`)return Uc(e.issue);let t=(e._tag===`Filter`?e.filter.annotations:`annotations`in e?e.annotations:e.ast.annotations)?.[e._tag===`MissingKey`?`messageMissingKey`:e._tag===`UnexpectedKey`?`messageUnexpectedKey`:`message`];if(typeof t==`string`)return t}function Wc(e){let t;for(let n of e.reasons){if(!Ko(n)||!gc(n.error))return;t??=n.error}return t}function Gc(e,t){let n=Wc(e);if(n===void 0)throw Error(t,{cause:e});return n}var Kc=e=>Object.assign(Object.create(pe),e),qc=Kc({_tag:`Passthrough`});function Jc(){return qc}function Yc(e){return Kc({_tag:`Transform`,transform:e})}function Xc(e){return Kc({_tag:`TransformEffect`,transform:e})}function Zc(){return Yc(globalThis.String)}function Qc(){return Yc(globalThis.Number)}function $c(){return Yc(os)}function el(e){return Xc((t,n)=>fs({try:()=>JSON.parse(t,e?.reviver),catch:()=>new Ec({expected:`a valid JSON string`},t,n)}))}function tl(e){return Xc((t,n)=>fs({try:()=>{let n=JSON.stringify(t,e?.replacer,e?.space);if(n===void 0)throw TypeError(`Value cannot be represented as JSON`);return n},catch:()=>new Ec({expected:`a JSON-serializable value`},t,n)}))}function nl(){return Yc(Us)}function rl(){return Xc((e,t)=>xs(ps(Ws(e)),()=>new Ec({expected:`a valid Base64 string`},e,t)))}var il=class extends me{_tag=`Middleware`;decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new il(this.encode,this.decode)}},al=`~effect/SchemaTransformation/Transformation`,ol=class extends me{[al]=al;_tag=`Transformation`;decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new ol(this.encode,this.decode)}};function sl(e){return Re(e,al)&&e[al]===al}var cl=e=>sl(e)?e:new ol(e.decode,e.encode);function ll(){return new ol($c(),Jc())}var ul=new ol(Jc(),Jc());function dl(){return ul}var fl=new ol(Qc(),Zc()),pl=new ol(rl(),nl());function ml(e){return new ol(el(e??{}),tl(e))}function hl(e){return t=>t._tag===e}var gl=hl(`Declaration`),_l=hl(`Null`),vl=hl(`Undefined`),yl=hl(`Never`),bl=hl(`String`),xl=hl(`Number`),Sl=hl(`Boolean`),Cl=hl(`Literal`),wl=hl(`UniqueSymbol`),Tl=hl(`Arrays`),El=hl(`Objects`),Dl=hl(`Union`),Ol=hl(`Suspend`),kl=class{to;transformation;constructor(e,t){this.to=e,this.transformation=t}},Al={},jl=class{isOptional;isMutable;constructorDefault;annotations;constructor(e,t,n=void 0,r=void 0){this.isOptional=e,this.isMutable=t,this.constructorDefault=n,this.annotations=r}},Ml=`~effect/Schema`,Nl=class{[Ml]=Ml;annotations;checks;encoding;context;constructor(e=void 0,t=void 0,n=void 0,r=void 0){this.annotations=e,this.checks=t,this.encoding=n,this.context=r}toString(){return`<${this._tag}>`}},Pl=class extends Nl{_tag=`Declaration`;typeParameters;run;encodingChecks;encodingRun;constructor(e,t,n,r,i,a,o,s){super(n,r,i,a),this.typeParameters=e,this.run=t,this.encodingChecks=o,this.encodingRun=s}getParser(){let e;return(t,n)=>t===B?dc:(e??=this.run(this.typeParameters))(t,this,n)}_rebuild(e,t,n,r,i){let a=$u(this.typeParameters,e);return a===this.typeParameters&&t===this.checks&&n===this.encodingChecks&&r===this.run&&i===this.encodingRun?this:new Pl(a,r,this.annotations,t,void 0,this.context,n,i)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks,this.run,this.encodingRun)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks,this.encodingRun??this.run,this.run)}getExpected(){let e=this.annotations?.expected;return typeof e==`string`?e:`<Declaration>`}},Fl=new class extends Nl{_tag=`Null`;getParser(){return gd(this,null)}getExpected(){return`null`}},Il=class extends Nl{_tag=`Undefined`;getParser(){return gd(this,void 0)}toCodecJson(){return Hu(this,[Ll])}getExpected(){return`undefined`}},Ll=new kl(Fl,new ol(Yc(()=>void 0),Yc(()=>null))),Rl=new Il,zl=new class extends Nl{_tag=`Unknown`;getParser(){return _d(this,Fe)}getExpected(){return`unknown`}},Bl=class extends Nl{_tag=`Literal`;literal;constructor(e,t,n,r,i){if(super(t,n,r,i),typeof e==`number`&&!globalThis.Number.isFinite(e))throw Error(`A numeric literal must be finite, got ${Tt(e)}`);this.literal=e}getParser(){return gd(this,this.literal)}matchPart(e,t){return e===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal==`bigint`?Vl(this):this}toCodecStringTree(){return typeof this.literal==`string`?this:Vl(this)}getExpected(){return typeof this.literal==`string`?JSON.stringify(this.literal):globalThis.String(this.literal)}};function Vl(e){let t=globalThis.String(e.literal);return Hu(e,[new kl(new Bl(t),new ol(Yc(()=>e.literal),Yc(()=>t)))])}var Hl=new class extends Nl{_tag=`String`;getParser(){return _d(this,De)}matchPart(e,t){let n=this.checks;return n&&!t.disableChecks&&Td(n,e,void 0,this,t)?void 0:e}getExpected(){return`string`}},Ul=class extends Nl{_tag=`Number`;getParser(){return _d(this,Oe)}matchKey(e,t){return this._match(bd,e,t)}matchPart(e,t){return this._match(yd,e,t)}_match(e,t,n){if(!e.test(t))return;let r=globalThis.Number(t);return n.disableChecks||!this.checks?r:Td(this.checks,r,void 0,this,n)?void 0:r}toCodecJson(){return this.checks&&(Wl(this.checks,`effect/schema/isFinite`)||Wl(this.checks,`effect/schema/isInt`))?this:Hu(this,[Lu])}toCodecStringTree(){return this.toCodecJson()===this?Hu(this,[Cd]):Hu(this,[wd])}getExpected(){return`number`}};function Wl(e,t){return e.some(e=>e.annotations?.representation?.id===t||e._tag===`FilterGroup`&&Wl(e.checks,t))}var Gl=new Ul,Kl=new class extends Nl{_tag=`Boolean`;getParser(){return _d(this,ke)}getExpected(){return`boolean`}},ql=class extends Nl{_tag=`Arrays`;isMutable;elements;rest;encodingChecks;constructor(e,t,n,r,i,a,o,s){super(r,i,a,o),this.isMutable=e,this.elements=t,this.rest=n,this.encodingChecks=s;let c=!1;for(let e=0;e<t.length;e++)if(sd(t[e]))c=!0;else if(c)throw Error(`A required element cannot follow an optional element. ts(1257)`);if(c&&n.length>1)throw Error(`A required element cannot follow an optional element. ts(1257)`);for(let e=1;e<n.length;e++)if(sd(n[e]))throw Error(`An optional element cannot follow a rest element. ts(1266)`)}getParser(e,t=e){let n=this,r,i,a=n.elements.length,o=Math.max(0,n.rest.length-1);function s(e,t){return t<a?r[t]:t>=e?i[t-e+1]:i[0]}let c=e=>{let{input:t,len:r,options:i}=e;if(n.rest.length===0&&r>a)for(let o=a;o<r;o++){let r=new Cc(n,t[o],i),a=new xc([o],r);if(i.errors===`all`)e.issues?e.issues.push(a):e.issues=[a];else return ls(new wc(n,[a],t,i))}return e.issues?ls(new wc(n,e.issues,t,i)):uc(e.output)},l=(e,t)=>{let r=e.length,i={ast:n,getParser:s,input:e,len:r,tailThreshold:Math.max(a,r-o),output:new globalThis.Array(r),issues:void 0,options:t},u=n.rest.length===0?a:Math.max(r,a+o),d=t.concurrency===void 0?1:No(t.concurrency),f=d===1?Xl(i,e,0,u):Zl(i,e,{concurrency:d,end:u});if(!f)return c(i);if(lo(f))return Ss(f,()=>c(i));let p=!0;return cs(()=>p?(p=!1,ms(f,()=>c(i))):l(e,t))};return(e,a)=>{if(e===B)return dc;try{return Array.isArray(e)?(r||(r=n.elements.map(e=>({ast:e,parser:t(e)})),i=n.rest.map(e=>({ast:e,parser:t(e)}))),l(e,a)):ls(new Tc(n,e,a))}catch(e){return ds(e)}}}_rebuild(e,t,n){let r=$u(this.elements,e),i=$u(this.rest,e);return r===this.elements&&i===this.rest&&t===this.checks&&n===this.encodingChecks?this:new ql(this.isMutable,r,i,this.annotations,t,void 0,this.context,n)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}getExpected(){return`array`}};function Jl(e,t,n,r){if(n._tag===`Failure`)return Ql(e,e.ast,r,n);let i=n===fc?t:n[z];if(i!==B)e.output[r]=i;else{let t=e.getParser(e.tailThreshold,r);if(sd(t.ast))return;let n=new xc([r],new Sc(t.ast.context?.annotations));if(e.options.errors===`all`)e.issues?e.issues.push(n):e.issues=[n];else return Qo(new wc(e.ast,[n],e.input,e.options))}}var Yl={onItem(e,t,n){let r=n<e.len?t:B;return e.getParser(e.tailThreshold,n).parser(r,e.options)},step:Jl},Xl=Po()(Yl),Zl=Io()(Yl),Ql=(e,t,n,r)=>{if(r.cause.reasons.length===0)return r;let i=Wc(r.cause);if(i===void 0)return Zo(Jo(r.cause,r=>new wc(t,[new xc([n],r)],e.input,e.options)));let a=new xc([n],i);if(e.options.errors===`all`)e.issues?e.issues.push(a):e.issues=[a];else return Qo(new wc(t,[a],e.input,e.options))},$l=`[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?`;function eu(e,t,n=Al){let r,i;function a(t){switch(t._tag){case`String`:case`TemplateLiteral`:return(r??=Object.keys(e)).filter(e=>t.matchPart(e,n)!==void 0);case`Number`:return(r??=Object.keys(e)).filter(e=>t.matchKey(e,n)!==void 0);case`Symbol`:return(i??=Object.getOwnPropertySymbols(e)).filter(r=>Object.prototype.propertyIsEnumerable.call(e,r)&&t.matchKey(r,n)!==void 0);case`Union`:return[...new Set(t.types.flatMap(a))];default:return[]}}return a(vd(fd(t)))}var tu=class{name;type;constructor(e,t){this.name=e,this.type=t}};function nu(e){switch(e._tag){case`String`:case`Number`:case`Symbol`:case`TemplateLiteral`:return!0;case`Union`:return e.types.every(nu);default:return!1}}function ru(e){let t=Wu(e);switch(t._tag){case`String`:case`Number`:case`Symbol`:case`TemplateLiteral`:return!0;case`Union`:return t.types.every(ru);default:return!1}}function iu(e){return nu(e)&&ru(e)}var au=class{parameter;type;constructor(e,t){if(!iu(e))throw Error(`Invalid index signature parameter ${e._tag}`);if(this.parameter=e,this.type=t,sd(t)&&!hd(t))throw Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}},ou=class extends Nl{_tag=`Objects`;propertySignatures;indexSignatures;encodingChecks;constructor(e,t,n,r,i,a,o){super(n,r,i,a),this.propertySignatures=e,this.indexSignatures=t,this.encodingChecks=o}getParser(e,t=e){let n=this,r=n.propertySignatures.length,i=n.indexSignatures.length;if(!r&&!i)return _d(n,Pe);let a,o,s=()=>(a||(a=n.propertySignatures.map(e=>({parser:t(e.type),name:e.name,type:e.type})),o=i?n.indexSignatures.map(n=>({is:n,parserKey:e(vd(n.parameter)),parserValue:t(n.type)})):void 0),a),c=()=>{let e=new Set(n.propertySignatures.map(e=>typeof e.name==`number`?globalThis.String(e.name):e.name)),t=(t,i,a,o,s)=>{if(s._tag===`Failure`)return Ql(t,n,i,s)??$o;let c=s===fc?o:s[z];if(a!==B&&c!==B){if(r&&(e.has(i)||e.has(typeof a==`number`?globalThis.String(a):a)))return $o;Ut(t.out,a,c)}return $o},c=(e,r,i,a)=>{if(!a){let t=i.parserKey(r,e.options);if(!lo(t))return ms(hs(t),t=>c(e,r,i,t));a=t}if(a._tag===`Failure`)return Ql(e,n,r,a)??$o;let o=a===fc?r:a[z],s=e.input[r],l=i.parserValue(s,e.options);return lo(l)?t(e,r,o,s,l):ms(hs(l),n=>t(e,r,o,s,n))},l=(e,n,r)=>{let i=e.input[n],a=r.parserValue(i,e.options);return lo(a)?t(e,n,n,i,a):ms(hs(a),r=>t(e,n,n,i,r))},u=i?Io()({onItem:(e,[t,n])=>n.is.parameter===Hl?l(e,t,n):c(e,t,n),step:(e,t,n)=>n._tag===`Failure`?n:void 0}):void 0;return Cs(function*(t,d){if(t===B)return B;if(!(typeof t==`object`&&t&&!Array.isArray(t)))return yield*ls(new Tc(n,t,d));s();let f=t,p={},m={ast:n,input:f,out:p,issues:void 0,options:d},h=d.errors===`all`,g=d.onExcessProperty===`error`,_=d.concurrency===void 0?1:No(d.concurrency),v=i&&g?n.indexSignatures.map(e=>eu(f,e.parameter,d)):void 0;if(g){let r=v?new Set(e):e;if(v)for(let e of v)for(let t of e)r.add(t);let i=Reflect.ownKeys(f);for(let e=0;e<i.length;e++){let a=i[e];if(!r.has(a)&&Object.prototype.propertyIsEnumerable.call(f,a)){let e=new Cc(n,f[a],d),r=new xc([a],e);if(h){m.issues?m.issues.push(r):m.issues=[r];continue}return yield*ls(new wc(n,[r],t,d))}}}if(r){let e=_===1?lu(m,a):uu(m,a,{concurrency:_});e&&(yield*e)}if(i&&_===1)for(let e=0;e<i;e++){let t=o[e],n=t.is.parameter===Hl?l:c,r=v?.[e]??(t.is.parameter===Hl?Object.keys(f):eu(f,t.is.parameter,d));for(let e=0;e<r.length;e++){let i=n(m,r[e],t);if(!lo(i))yield*i;else if(i._tag===`Failure`)return yield*i}}else if(u){let e=oi();for(let t=0;t<i;t++){let n=o[t],r=v?.[t]??(n.is.parameter===Hl?Object.keys(f):eu(f,n.is.parameter,d));for(let t=0;t<r.length;t++)e.push([r[t],n])}let t=u(m,e,{concurrency:_});t&&(yield*t)}return m.issues?yield*ls(new wc(n,m.issues,t,d)):p})};if(i)return c();let l,u=(e,t,n)=>{let r=a[t];return ms(hs(n),n=>{let i=su(e,r,n);if(i)return i;let o=()=>uc(e.out),s=lu(e,a.slice(t+1));return s?Ss(s,o):o()})};return(e,t)=>{if(e===B)return dc;if(t.errors===`all`||t.onExcessProperty!==void 0||t.concurrency!==void 0&&No(t.concurrency)!==1)return(l??=c())(e,t);if(!(typeof e==`object`&&e&&!Array.isArray(e)))return ls(new Tc(n,e,t));let r=s(),i=e,a={},o={ast:n,input:i,out:a,issues:void 0,options:t};try{for(let e=0;e<r.length;e++){let n=r[e],s=n.name,c=xu(i,s),l=c?i[s]:B,d=n.parser(l,t);if(!lo(d))return u(o,e,d);if(d===fc){c&&Ut(a,s,l);continue}let f=su(o,n,d);if(f)return f}}catch(e){return ds(e)}return uc(a)}}_rebuild(e,t,n,r){let i=$u(this.propertySignatures,t=>{let n=e(t.type);return n===t.type?t:new tu(t.name,n)}),a=$u(this.indexSignatures,n=>{let r=t(n.parameter),i=e(n.type);return r===n.parameter&&i===n.type?n:new au(r,i)});return i===this.propertySignatures&&a===this.indexSignatures&&n===this.checks&&r===this.encodingChecks?this:new ou(i,a,this.annotations,n,void 0,this.context,r)}flip(e){return this._rebuild(e,e,this.encodingChecks,this.checks)}recur(e,t=e){return this._rebuild(e,t,this.checks,this.encodingChecks)}getExpected(){return this.propertySignatures.length===0&&this.indexSignatures.length===0?`object | array`:`object`}};function su(e,t,n){if(n._tag===`Failure`)return Ql(e,e.ast,t.name,n);if(n===fc)return;let r=n[z];if(r!==B){Ut(e.out,t.name,r);return}if(delete e.out[t.name],!sd(t.type)){let n=new xc([t.name],new Sc(t.type.context?.annotations));if(e.options.errors===`all`){e.issues?e.issues.push(n):e.issues=[n];return}return Qo(new wc(e.ast,[n],e.input,e.options))}}var cu={onItem(e,t){if(!xu(e.input,t.name))return t.parser(B,e.options);let n=e.input[t.name];return Ut(e.out,t.name,n),t.parser(n,e.options)},step:su},lu=Po()(cu),uu=Io()(cu);function du(e,t){return e?t?[...e,...t]:e:t}function fu(e,t,n){return new ou(Reflect.ownKeys(e).map(t=>new tu(t,e[t].ast)),[],n,t)}function pu(e){return e.ast}function mu(e,t,n){return new Cu(e.map(pu),t,void 0,n)}var hu=Se(e=>{for(;;){if(Ol(e))return zl;let t=e.encoding;if(!t)return e.recur?.(hu,he)??e;if(t.some(e=>e.transformation._tag===`Middleware`&&e.transformation.decode!==he))return zl;e=t[t.length-1].to}});function gu(e){switch(e._tag){case`Null`:return[`null`];case`Undefined`:return[`undefined`];case`String`:case`TemplateLiteral`:return[`string`];case`Number`:return[`number`];case`Boolean`:return[`boolean`];case`Symbol`:case`UniqueSymbol`:return[`symbol`];case`BigInt`:return[`bigint`];case`Arrays`:return[`array`];case`ObjectKeyword`:return[`object`,`array`,`function`];case`Objects`:return e.propertySignatures.length||e.indexSignatures.length?[`object`]:[`string`,`number`,`boolean`,`symbol`,`bigint`,`object`,`array`,`function`];case`Enum`:return Array.from(new Set(e.enums.map(([,e])=>typeof e)));case`Literal`:return[typeof e.literal];case`Union`:return Array.from(new Set(e.types.flatMap(gu)));default:return[`null`,`undefined`,`string`,`number`,`boolean`,`symbol`,`bigint`,`object`,`array`,`function`]}}function _u(e){switch(e._tag){default:return[];case`Declaration`:{let t=e.annotations?.[ac];return Array.isArray(t)?t:[]}case`Objects`:return e.propertySignatures.flatMap(e=>{let t=e.type;if(!sd(t)){if(Cl(t))return[{key:e.name,literal:t.literal}];if(wl(t))return[{key:e.name,literal:t.symbol}]}return[]});case`Arrays`:return e.elements.flatMap((e,t)=>{if(!sd(e)){if(Cl(e))return[{key:t,literal:e.literal}];if(wl(e))return[{key:t,literal:e.symbol}]}return[]});case`Union`:{if(e.types.length===0)return[];let t=e.types.map(e=>_u(hu(e)));return t[0].filter(e=>t.every(t=>t.some(t=>t.key===e.key&&t.literal===e.literal)))}case`Suspend`:return _u(e.thunk())}}var vu=new WeakMap,yu=Object.freeze([]),bu=e=>e===null?`null`:Array.isArray(e)?`array`:typeof e,xu=(e,t)=>t===`__proto__`?Object.hasOwn(e,t):t in e;function Su(e){let t=vu.get(e);if(t)return t;let n,r=0,i,a,o=!0,s=[];for(let t=0;t<e.length;t++){let c=e[t],l=hu(c);if(yl(l))continue;if(Cl(l)||wl(l)){a??=new Map;let e=Cl(l)?l.literal:l.symbol;s[t]=e;let n=a.get(e);n||a.set(e,n=[]),n.push(t)}else o=!1;let u=_u(l);if(u.length){n??=new Map,r++;for(let{key:e,literal:r}of u){let i=n.get(e);i||n.set(e,i=[new Map,new Set]),i[1].add(t);let a=i[0].get(r);a||i[0].set(r,a=new Set),a.add(t)}}else{i??={};let e=gu(l);for(let n of e)(i[n]??=[]).push(t)}}let c={},l=e=>c[e]??=Object.freeze(i?.[e]??yu);if(o&&a)a.forEach(Object.freeze),t=e=>a.get(e)??yu;else if(n?.size===1&&!i){let[r,[i]]=n.entries().next().value,a=new Map;for(let[e,t]of i)a.set(e,Object.freeze(Array.from(t)));let o=Object.freeze(e.map((e,t)=>t));t=(e,t)=>{if(Le(e)){let n=xu(e,r)?e[r]:void 0;if(n!==void 0)return a.get(n)??yu;if(t)return o}return yu}}else if(n){let e;for(let t of n)(!e||t[1][0].size>e[1][0].size)&&t[1][1].size===r&&(e=t);t=(t,r)=>{let a=bu(t);if(!Le(t))return l(a);let o=new Set(i?.[a]),s;if(e){let[n,[i]]=e,c=xu(t,n),u=c?t[n]:void 0;if(c&&(!r||u!==void 0)){let e=i.get(u);if(!e)return l(a);for(let t of e)o.add(t);s=n}}if(s===void 0)for(let[e,[i,a]]of n){let n=xu(t,e),s=n?t[e]:void 0;if(n&&(!r||s!==void 0)){let e=i.get(s);if(e)for(let t of e)o.add(t)}else if(r)for(let e of a)o.add(e)}for(let[e,[i,a]]of n){if(e===s)continue;let n=xu(t,e),c=n?t[e]:void 0;if(n&&(!r||c!==void 0)){let e=i.get(c);for(let t of o)a.has(t)&&!e?.has(t)&&o.delete(t)}}return Array.from(o).sort((e,t)=>e-t)}}else t=e=>{let t=l(bu(e));return a?t.filter(t=>s[t]===void 0||s[t]===e):t};return vu.set(e,t),t}var Cu=class extends Nl{_tag=`Union`;types;options;encodingChecks;constructor(e,t,n,r,i,a,o){super(n,r,i,a),this.types=e,this.options=t,this.encodingChecks=o}getParser(e,t){let n=this,r=t!==void 0,i=[],a=t=>i[t]??=e(n.types[t]),o;return(e,t)=>{if(e===B)return dc;let i=(o??=Su(n.types))(e,r);if(i.length===0)return ls(new Dc(n,[],e,t));if(i.length===1){let r=a(i[0])(e,t);return r._tag===`Success`?r:lo(r)?wu(n,r.cause,e,t):Tu(n,r,e,t)}return Eu(n,a,i,e,t)}}_rebuild(e,t,n){let r=$u(this.types,e);return r===this.types&&t===this.checks&&n===this.encodingChecks?this:new Cu(r,this.options,this.annotations,t,void 0,this.context,n)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}matchPart(e,t){for(let n of this.types){let r=n.matchPart(e,t);if(r!==void 0)return r}}getExpected(e){let t=this.annotations?.expected;if(typeof t==`string`)return t;if(this.types.length===0)return`never`;let n=this.types.map(t=>{let n=fd(t);switch(n._tag){case`Arrays`:{let t=n.elements.filter(Cl);if(t.length>0)return`${Au(n.isMutable)}[ ${t.map(t=>e(t)+ju(t.context?.isOptional)).join(`, `)}, ... ]`;break}case`Objects`:{let t=n.propertySignatures.filter(e=>Cl(e.type));if(t.length>0)return`{ ${t.map(t=>`${Au(t.type.context?.isMutable)}${Dt(t.name)}${ju(t.type.context?.isOptional)}: ${e(t.type)}`).join(`, `)}, ... }`;break}}return e(n)});return Array.from(new Set(n)).join(` | `)}};function wu(e,t,n,r){let i=Wc(t);return i?Qo(new Dc(e,[i],n,r)):Zo(t)}function Tu(e,t,n,r){return gs(t,t=>wu(e,t,n,r))}function Eu(e,t,n,r,i){let a={ast:e,parser:t,input:r,out:void 0,successes:e.options?.mode===`oneOf`?[]:void 0,issues:void 0,options:i},o=Ou(a,n);if(!o)return a.out?a.out:ls(new Dc(e,a.issues??[],r,i));if(lo(o))return Du(o,a);let s=!0;return cs(()=>s?(s=!1,Du(o,a)):Eu(e,t,n,r,i))}function Du(e,t){return Ss(e,e=>t.out===fc?ss(t.input):t.out?t.out:ls(new Dc(t.ast,t.issues??[],t.input,t.options)))}var Ou=Po()({onItem(e,t){return e.parser(t)(e.input,e.options)},step(e,t,n){if(n._tag===`Failure`){let t=Wc(n.cause);if(t===void 0)return n;e.issues?e.issues.push(t):e.issues=[t]}else{if(e.out&&e.successes)return e.successes.push(e.ast.types[t]),Qo(new Oc(e.ast,e.successes,e.input,e.options));if(e.out=n,e.successes)e.successes.push(e.ast.types[t]);else return $o}}}),ku=new Cu([new Bl(`Infinity`),new Bl(`-Infinity`),new Bl(`NaN`)]);function Au(e){return e?``:`readonly `}function ju(e){return e?`?`:``}var Mu=class extends me{_tag=`Filter`;run;annotations;aborted;constructor(e,t=void 0,n=!1){super(),this.run=e,this.annotations=t,this.aborted=n}annotate(e){return new Mu(this.run,{...this.annotations,...e},this.aborted)}abort(){return new Mu(this.run,this.annotations,!0)}and(e,t){return new Nu([this,e],t)}},Nu=class extends me{_tag=`FilterGroup`;checks;annotations;constructor(e,t=void 0){super(),this.checks=e,this.annotations=t}annotate(e){return new Nu(this.checks,{...this.annotations,...e})}and(e,t){return new Nu([this,e],t)}};function Pu(e,t,n=!1){return new Mu((t,n,r)=>jc(n,e(t,n,r),t,r),t,n)}function Fu(e){return Pu(e=>globalThis.Number.isFinite(e),{expected:`a finite number`,representation:{id:`effect/schema/isFinite`,payload:null},toJsonSchema:()=>({type:`number`}),toCode:()=>({runtime:`Schema.isFinite()`}),arbitraryConstraint:{number:`finite`},...e})}var Iu=qu(Gl,[Fu()]),Lu=new kl(new Cu([Iu,ku]),new ol(Qc(),Yc(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function Ru(e,t){let n=new globalThis.RegExp(e),r={source:n.source,flags:n.flags};return Pu(e=>(n.lastIndex=0,n.test(e)),{expected:`a string matching the RegExp ${r.source}`,representation:{id:`effect/schema/isPattern`,payload:r},toJsonSchema:()=>[{},!0],arbitraryConstraint:{patterns:[r]},...t})}var zu=new WeakMap;function Bu(e,t){let n=Object.assign(Object.create(Object.getPrototypeOf(e)),e,t);return Reflect.ownKeys(t).every(e=>e===`context`||e===`encoding`)&&zu.set(n,Vu(e)),n}function Vu(e){let t=zu.get(e);if(t!==void 0)return t;if(e.encoding===void 0)return e;let n=Object.assign(Object.create(Object.getPrototypeOf(e)),e,{encoding:void 0});return zu.set(e,n),n}function Hu(e,t){return e.encoding===t?e:Bu(e,{encoding:t})}function Uu(e,t){if(e.context===t)return e;let n=Vu(e);return n.context===t&&n.encoding===e.encoding?n:Bu(e,{context:t})}function Wu(e){return e.encoding?Wu(e.encoding[e.encoding.length-1].to):e}function Gu(e,t){if(e.checks){let n=e.checks[e.checks.length-1];return Ku(e,ri(e.checks.slice(0,-1),n.annotate(t)))}return Bu(e,{annotations:{...e.annotations,...t}})}function Ku(e,t){if(e._tag===`Suspend`&&t)throw Error(`Cannot add checks to Suspend`);return e.checks===t?e:Bu(e,{checks:t})}function qu(e,t){return Ku(e,du(e.checks,t))}function Ju(e,t){let n=t(e.to);return n===e.to?e:new kl(n,e.transformation)}function Yu(e,t){let n=e,r=n[n.length-1],i=Ju(r,t);return i===r?e:ri(e.slice(0,e.length-1),i)}function Xu(e){return t=>t.encoding?Hu(t,Yu(t.encoding,e)):t}function Zu(e,t){function n(r){if(r.encoding){let e=r.encoding[r.encoding.length-1];return t?.stopAt?.(e)?r:Hu(r,Yu(r.encoding,n))}return e(r)}return Se(n)}function Qu(e,t,n){let r=new kl(e,t);return Hu(n,n.encoding?[...n.encoding,r]:[r])}function $u(e,t){let n;for(let r=0;r<e.length;r++){let i=e[r],a=t(i);if(n)n[r]=a;else if(a!==i){n=Array(e.length);for(let t=0;t<r;t++)n[t]=e[t];n[r]=a}}return n??e}function ed(e,t){return Uu(e,e.context?new jl(e.context.isOptional,e.context.isMutable,e.context.constructorDefault,{...e.context.annotations,...t}):new jl(!1,!1,void 0,t))}var td=Se(e=>nd(Uu(e,e.context?e.context.isOptional===!1?new jl(!0,e.context.isMutable,e.context.constructorDefault,e.context.annotations):e.context:new jl(!0,!1)))),nd=Xu(td),rd=xe(e=>td(new Cu([e,Rl])));function id(e,t,n){return Qu(e,n,t)}function ad(e){let t=[],n=[];function r(e){switch(e._tag){case`Literal`:je(e.literal)&&!t.includes(e.literal)&&t.push(e.literal);return;case`UniqueSymbol`:t.includes(e.symbol)||t.push(e.symbol);return;case`Never`:return;case`Union`:for(let t=0;t<e.types.length;t++)r(e.types[t]);return;default:n.push(e)}}return r(e),{literals:t,parameters:n}}function od(e,t){let{literals:n,parameters:r}=ad(e);return new ou(n.map(e=>new tu(e,t)),r.map(e=>new au(e,t)))}function sd(e){return e.context?.isOptional??!1}function cd(e){return e.annotations?.[`~structural`]===!0||e._tag===`FilterGroup`&&e.checks.every(cd)}function ld(e){function t(e){return cd(e)?[e]:e._tag===`FilterGroup`?e.checks.flatMap(t):[]}let n=e.flatMap(t);return ii(n)?n:void 0}function ud(e){let t=!0;function n(e){return t=t&&!e.encoding&&!Ol(e),t&&`recur`in e&&e.recur(n),e}return`recur`in e&&e.recur(n),t}var dd=Se(e=>{let t=Vu(e);if(t!==e){let n=dd(t);return n===t&&e.encoding===void 0?e:Uu(n,e.context)}let n=`recur`in e?e.recur(dd):e;if(`encodingChecks`in n&&n.encodingChecks){let t=ud(e)?n.encodingChecks:Tl(n)||El(n)||gl(n)&&n.typeParameters.length>0?ld(n.encodingChecks):void 0;return Bu(n,{encodingChecks:void 0,checks:du(n.checks,t)})}return n}),fd=Se(e=>dd(md(e)));function pd(e,t){let n=t,r=n.length,i=n[r-1],a=[new kl(md(Hu(e,void 0)),n[0].transformation.flip())];for(let e=1;e<r;e++)a.unshift(new kl(md(n[e-1].to),n[e].transformation.flip()));let o=md(i.to);return o.encoding?Hu(o,[...o.encoding,...a]):Hu(o,a)}var md=xe(e=>{if(e.encoding)return pd(e,e.encoding);let t=Vu(e);if(t!==e){let n=md(t);return n===t?e:Uu(n,e.context)}return`flip`in e?e.flip(md):`recur`in e?e.recur(md):e});function hd(e){switch(e._tag){case`Undefined`:return!0;case`Union`:return e.types.some(hd);default:return!1}}function gd(e,t){let n=t===0?fc:uc(t);return(r,i)=>r===B?dc:r===t?n:ls(new Tc(e,r,i))}function _d(e,t){return(n,r)=>n===B?dc:t(n)?fc:ls(new Tc(e,n,r))}var vd=Zu(e=>{switch(e._tag){default:return e;case`Number`:return e.toCodecStringTree();case`Union`:return e.recur(vd)}}),yd=new globalThis.RegExp(`^${$l}$`),bd=new globalThis.RegExp(`^(?:${$l}|Infinity|-Infinity|NaN)$`);function xd(e){return Ru(yd,{expected:`a string representing a finite number`,representation:{id:`effect/schema/isStringFinite`,payload:null},toJsonSchema:()=>({pattern:yd.source}),...e})}var Sd=qu(Hl,[xd()]),Cd=new kl(Sd,fl),wd=new kl(new Cu([Sd,ku]),fl);function Td(e,t,n,r,i){for(let a=0;a<e.length;a++){let o=e[a];if(o._tag===`FilterGroup`){if(n=Td(o.checks,t,n,r,i),n&&(i.errors!==`all`||n[n.length-1].filter.aborted))return n}else{let e=o.run(t,r,i);if(e){let r=new yc(o,e,t,i);if(n?n.push(r):n=[r],i.errors!==`all`||o.aborted)return n}}}return n}function Ed(e){if(!gl(e))return;let t=e.annotations?.[oc];return Me(t)?t(e.typeParameters):void 0}var Dd=nc,Od=sc,kd=cc,Ad=(e,t,n)=>e===fc?n(t):Ss(e,n);function jd(e){if(e._tag===`Middleware`)return(t,n,r)=>Md(t===fc?e.decode(uc(pc(n)),r):e.decode(bs(t,pc),r));let t=e.decode;switch(t._tag){case`Passthrough`:return(e,t)=>e===fc?uc(t):e;case`Transform`:{let e=e=>e===B?dc:uc(t.transform(e));return(t,n)=>Ad(t,n,e)}case`TransformOptional`:{let e=e=>mc(t.transform(pc(e)));return(t,n)=>Ad(t,n,e)}case`TransformEffect`:return(e,n,r)=>Ad(e,n,e=>e===B?dc:t.transform(e,r));case`TransformOptionalEffect`:return(e,n,r)=>Ad(e,n,e=>Md(t.transform(pc(e),r)))}}var Md=e=>Ss(e,mc),Nd=(e,t,n,r)=>gs(r,r=>us(()=>Jo(r,r=>new bc(e,r,t,n))));function Pd(e,t){let n=jd(e.link.transformation),r;return(i,a)=>{if(i===B)return dc;if(e.isConstructed(i))return fc;let o=(r??=t(e.link.to))(i,a);return n(o,i,a)}}function Fd(e,t){let n=e.context.constructorDefault;return(r,i)=>{if(r!==B&&r!==void 0)return t(r,i);let a=n;if(lo(a)&&a._tag===`Success`){let e=t(a[z],i);return e===fc?a:e}return Ss(Nd(e,r,i,a),e=>{let n=t(e,i);return n===fc?uc(e):n})}}function Id(e,t){let n=t(e);return e.context?.constructorDefault===void 0?n:Fd(e,n)}function Ld(e,t,n,r,i){if(e._tag===`Declaration`)for(let n of e.typeParameters)t(n);let a=n?Ed(e):void 0,o=a?Pd(a,t):r??e.getParser(t,n),s=e.checks,c=e.encoding,l=c?.map(e=>jd(e.transformation)),u=e.encodingChecks;if(!c&&!s&&!u)return o;let d,f=(t,n)=>{let r=o(t,n);if(u&&!n.disableChecks){if(lo(r)){if(r._tag===`Success`){let i=r===fc?t:r[z];if(t!==B&&i!==B){let i=Td(u,t,void 0,e,n);i&&(r=ls(new wc(e,i,t,n)))}}}else r=ms(r,r=>{if(t!==B&&r!==B){let r=Td(u,t,void 0,e,n);if(r)return ls(new wc(e,r,t,n))}return ss(r)})}if(s&&!n.disableChecks){if(lo(r)){if(r._tag===`Success`){let i=r===fc?t:r[z];if(i===B)return r;let a=Td(s,i,void 0,e,n);a&&(r=ls(new wc(e,a,i,n)))}}else r=ms(r,t=>{if(t!==B){let r=Td(s,t,void 0,e,n);if(r)return ls(new wc(e,r,t,n))}return ss(t)})}return r},p=i===void 0?f:i(f);return c?(n,r)=>{let i=d??=c.map(e=>t(e.to)),a=n,o=i[i.length-1](n,r);for(let e=c.length-1;e>=0;e--)if(o=l[e](o,a,r),e!==0){let t=i[e-1];o._tag===`Success`?(a=o[z],o=t(a,r)):o=Ss(o,e=>{let n=t(e,r);return n===fc?uc(e):n})}if(o._tag===`Success`){let e=o[z],t=p(e,r);return t===fc?o:t}return o=Nd(e,n,r,o),Ss(o,e=>{let t=p(e,r);return t===fc?uc(e):t})}:p}var Rd=Symbol(),zd=new WeakMap,Bd=e=>Wd(e).parser,Vd=e=>Wd(e).makeEffect,Hd=e=>Id(e,Vd),Ud=class{ast;constructor(e){this.ast=e}get decodeEffect(){return this.cachedDecodeEffect??=Ld(this.ast,Bd)}get parser(){return this.decodeEffect}get makeEffect(){return this.cachedMakeEffect??=Ld(this.ast,Vd,Hd)}};function Wd(e){let t=zd.get(e);if(t!==void 0)return t;let n=new Ud(e);return zd.set(e,n),n}function Gd(e){let t=e.ast,n;return(e,r)=>(n??=af(ff,dd(t)))(e,r?.disableChecks?r?.parseOptions?{...r.parseOptions,disableChecks:!0}:{disableChecks:!0}:r?.parseOptions)}function Kd(e){let t=Gd(e);return(e,n)=>{let r=ys(t(e,n));return es(r)?pr(r.value):(Gc(r.cause,`Option adapter can only return none for schema issues`),fr())}}function qd(e){return uf(dd(e.ast))}function Jd(e){return Xd(e.ast)}function Yd(e){{let t=of(nf(e));return e=>{let n=t(e,Al);return es(n)?!0:(Gc(n.cause,`Type guard adapter can only return false for schema issues`),!1)}}}function Xd(e){let t=dd(e),n=e=>(n=Yd(t),n(e));return e=>n(e)}function Zd(e,t){let n=nf(e.ast);return t===void 0?n:(e,r)=>n(e,ef(t,r))}function Qd(e,t){return sf(Zd(e,t))}function $d(e,t){return cf(Zd(e,t))}var ef=(e,t)=>t?{...e,...t}:e,tf=e=>e===B?ls(new Ec):ss(e);function nf(e){return af(df,e)}function rf(e,t){return e===fc?ss(t):lo(e)?e[z]===B?tf(B):e:Ss(e,tf)}function af(e,t){let n;return(r,i)=>{let a=(n??=e(t))(r,i??Al);return a===fc?ss(r):lo(a)?a[z]===B?tf(B):a:Ss(a,tf)}}function of(e){return(t,n)=>ys(e(t,n))}function sf(e){let t=of(e);return(e,n)=>{let r=t(e,n);return es(r)?pr(r.value):(Gc(r.cause,`Option adapter can only return none for schema issues`),fr())}}function cf(e){let t=of(e);return(e,n)=>{let r=t(e,n);return es(r)?Zr(r.value):Qr(Gc(r.cause,`Result adapter can only return schema issues`))}}function lf(e,t){let n=ys(e);if(es(n))return n.value;let r=Gc(n.cause,t);throw Error(`Schema validation failed`,{cause:r})}function uf(e){let t,n;return(r,i)=>{t??=Wd(e);let a=i?.disableChecks?i.parseOptions?{...i.parseOptions,disableChecks:!0}:{disableChecks:!0}:i?.parseOptions??Al,o=t.make;if(o!==void 0&&r!==B){let e;try{e=o(r,a)}catch(e){throw Gc(qo(e),`Constructor adapter can only throw schema issues`),e}if(e!==Rd&&e!==B)return e}return lf(rf((n??=t.makeEffect)(r,a),r),`Constructor adapter can only throw schema issues`)}}var df=e=>Wd(e).parser,ff=e=>Wd(e).makeEffect,pf=`~effect/Schema/Schema`,mf=Symbol(),hf={[pf]:pf,get make(){let e=qd(this);return Object.defineProperty(this,"make",{value:e,enumerable:!0}),e},get makeEffect(){let e=Gd(this);return Object.defineProperty(this,"makeEffect",{value:e,enumerable:!0}),e},get makeOption(){let e=Kd(this);return Object.defineProperty(this,"makeOption",{value:e,enumerable:!0}),e},pipe(){return fe(this,arguments)},annotate(e){return this.rebuild(Gu(this.ast,e))},annotateKey(e){return this.rebuild(ed(this.ast,e))},check(...e){return this.rebuild(qu(this.ast,e))},rebuild(e){return gf(e,this[mf])}};function gf(e,t){function n(){}let r=Object.setPrototypeOf(n,hf);return t&&(Object.hasOwn(t,`name`)||Object.hasOwn(t,`length`)||Object.hasOwn(t,`__proto__`))?Object.defineProperties(r,Object.getOwnPropertyDescriptors({...t})):Object.assign(r,t),r[mf]=t,r.ast=e,r}function _f(e){return es(e)?e.value:{issues:[{message:Yo(e.cause)}]}}function vf(e,t){let n=Zd(e),r={errors:`all`,...t?.parseOptions},i=Pc(t),a=e=>{let t=new Gi(`sync`),a=vs(_s(n(e,r),{onFailure:i,onSuccess:e=>({value:e})}),{scheduler:t});a.currentDispatcher?.flush();let o=a.pollUnsafe();return o?_f(o):new Promise(e=>{a.addObserver(t=>{e(_f(t))})})};if(Object.hasOwn(e,`~standard`)){let t=e;return`validate`in t[`~standard`]||Object.assign(t[`~standard`],{validate:a}),t}return Object.assign(e,{"~standard":{version:1,vendor:`effect`,validate:a}})}var yf=e=>e,bf=`~effect/Schema/SchemaError`;function xf(e){return Re(e,`~effect/Schema/SchemaError`)&&e[`~effect/Schema/SchemaError`]===`~effect/Schema/SchemaError`}function Sf(){return(e,t,n)=>If(new Pl(e.map(pu),e=>t(e.map(e=>If(e))),n))}function Cf(e,t){return Sf()([],()=>(t,n,r)=>e(t)?ss(t):ls(new Tc(n,t,r)),t)}var wf=class extends Yi(`SchemaError`){[bf]=bf;constructor(e){let t=zt();Bt(0);try{super({issue:e})}finally{Bt(t)}}get message(){return Vc(this.issue)}toString(){return`SchemaError(${this.message})`}};function Tf(e){return xf(e)}function Ef(e){return lo(e)?Df(e):gs(e,e=>us(()=>Jo(e,e=>new wf(e))))}function Df(e){return es(e)?e:Zo(Jo(e.cause,e=>new wf(e)))}function Of(e,t){let n;for(let r of e.reasons){if(!Ko(r)||!Tf(r.error))throw new globalThis.Error(t,{cause:e});n??=r.error}if(n===void 0)throw new globalThis.Error(t,{cause:e});return n}function kf(e){let t=ys(e);if(es(t))return t.value;throw Of(t.cause,`Sync adapter can only throw schema errors`)}function Af(e,t){return vf(e,t)}var jf=Jd;function Mf(e,t){let n=Zd(e,t);return(e,t)=>Ef(n(e,t))}var Nf=Qd;function Pf(e,t){let n=$d(e,t);return(e,t)=>ei(n(e,t),e=>new wf(e))}function Ff(e,t){let n=Mf(e,t);return(e,t)=>kf(n(e,t))}var If=gf,Lf=yf(e=>If(td(e.ast),{schema:e})),Rf=yf(e=>{let t=Qf(e);return If(rd(e.ast),{schema:t})});function V(e){let t=If(new Bl(e),{literal:e,transform(n){return t.pipe(ep(V(n),{decode:Yc(()=>n),encode:Yc(()=>e)}))}});return t}var zf=If(zl),Bf=If(Fl),Vf=If(Rl),Hf=If(Hl),Uf=If(Gl),Wf=If(Kl);function Gf(e,t){return If(e,{fields:t,mapFields(e,t){let n=e(this.fields);return Gf(fu(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function H(e){return Gf(fu(e,void 0),e)}function Kf(e,t){return If(od(e.ast,t.ast),{key:e,value:t})}var qf=yf(e=>If(new ql(!1,[],[e.ast]),{value:e}));function Jf(e,t){return If(e,{members:t,mapMembers(e,t){let n=e(this.members);return Jf(mu(n,this.ast.options,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function Yf(e,t){return Jf(mu(e,t,void 0),e)}function Xf(e){let t=e.map(V);return If(mu(t,void 0,void 0),{literals:e,members:t,mapMembers(e){return Yf(e(this.members))},pick(e){return Xf(e)},transform(e){return Yf(t.map((t,n)=>t.transform(e[n])))}})}var Zf=yf(e=>Yf([e,Bf])),Qf=yf(e=>Yf([e,Vf]));function U(...e){return t=>t.check(...e)}function $f(e){return t=>If(t.ast,{schema:t,identifier:e})}function ep(e,t){return n=>If(id(n.ast,e.ast,t?cl(t):dl()),{from:n,to:e})}function tp(e,t){return Cf(t=>t instanceof e,t)}function np(){return(e,t)=>new kl(e.ast,cl(t))}var rp=Pu,ip=`^\\S[\\s\\S]*\\S$|^\\S$|^$`;function ap(e){let t=new globalThis.RegExp(ip);return rp(e=>e.trim()===e,{expected:`a string with no leading or trailing whitespace`,representation:{id:`effect/schema/isTrimmed`,payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:`Schema.isTrimmed()`}),arbitraryConstraint:{patterns:[{source:ip,flags:``}]},...e})}function op(e,t){let n=e.source,r=e.flags,i=/^[dg]*uy?$/.test(r),a=r===``?`new RegExp(${Tt(n)})`:`new RegExp(${Tt(n)}, ${Tt(r)})`;return Ru(e,{toJsonSchema:()=>i?{pattern:r.endsWith(`y`)?`^(?:${n})`:n}:[{},!0],toCode:()=>({runtime:`Schema.isPattern(${a})`}),...t})}var sp=If(Iu);function cp(e){let t=lr(e.order),n=e.formatter??Tt;return(r,i)=>rp(e=>t(e,r),{expected:`a value greater than ${n(r)}`,arbitraryConstraint:{order:e.order,minimum:r,exclusiveMinimum:!0},...e.annotate?.(r),...i})}function lp(e){let t=dr(e.order),n=e.formatter??Tt;return(r,i)=>rp(e=>t(e,r),{expected:`a value greater than or equal to ${n(r)}`,arbitraryConstraint:{order:e.order,minimum:r},...e.annotate?.(r),...i})}function up(e){let t=dr(e.order),n=lr(e.order),r=ur(e.order),i=cr(e.order),a=e.formatter??Tt;return(o,s)=>{let c=o.exclusiveMinimum?n:t,l=o.exclusiveMaximum?i:r;return rp(e=>c(e,o.minimum)&&l(e,o.maximum),{expected:`a value between ${a(o.minimum)}${o.exclusiveMinimum?` (excluded)`:``} and ${a(o.maximum)}${o.exclusiveMaximum?` (excluded)`:``}`,arbitraryConstraint:{order:e.order,minimum:o.minimum,maximum:o.maximum,...o.exclusiveMinimum&&{exclusiveMinimum:!0},...o.exclusiveMaximum&&{exclusiveMaximum:!0}},...e.annotate?.(o),...s})}}function dp(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${Tt(e)}`);return e}var fp=cp({order:sr,annotate:e=>({representation:{id:`effect/schema/isGreaterThan`,payload:{exclusiveMinimum:dp(e)}},toJsonSchema:()=>({exclusiveMinimum:e}),toCode:()=>({runtime:`Schema.isGreaterThan(${Tt(e)})`})})}),pp=lp({order:sr,annotate:e=>({representation:{id:`effect/schema/isGreaterThanOrEqualTo`,payload:{minimum:dp(e)}},toJsonSchema:()=>({minimum:e}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualTo(${Tt(e)})`})})}),mp=up({order:sr,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,n=e.exclusiveMaximum?!0:void 0;return{representation:{id:`effect/schema/isBetween`,payload:{minimum:dp(e.minimum),maximum:dp(e.maximum),...t&&{exclusiveMinimum:t},...n&&{exclusiveMaximum:n}}},toJsonSchema:()=>({[t?`exclusiveMinimum`:`minimum`]:e.minimum,[n?`exclusiveMaximum`:`maximum`]:e.maximum}),toCode:()=>({runtime:`Schema.isBetween({ minimum: ${Tt(e.minimum)}, maximum: ${Tt(e.maximum)}, exclusiveMinimum: ${Tt(t)}, exclusiveMaximum: ${Tt(n)} })`})}}});function hp(e){return rp(e=>globalThis.Number.isSafeInteger(e),{expected:`an integer`,representation:{id:`effect/schema/isInt`,payload:null},toJsonSchema:()=>[{type:`integer`},!0],toCode:()=>({runtime:`Schema.isInt()`}),arbitraryConstraint:{number:`integer`},...e})}function gp(e,t){return e=bp(e),_p(e,Math.ceil(e/2),t)}function _p(e,t,n){return rp(t=>t.length>=e,{expected:`a value with a length of at least ${e}`,representation:{id:`effect/schema/isMinLength`,payload:{minLength:e}},toJsonSchema:({type:n})=>n===`string`?e<=1?{minLength:t}:[{minLength:t},!0]:n===`array`?{minItems:e}:n===void 0?[{minLength:t,minItems:e},!0]:[{},!0],toCode:()=>({runtime:`Schema.isMinLength(${e})`}),[ic]:!0,arbitraryConstraint:{minLength:e},...n})}function vp(e){return _p(1,1,e)}function yp(e,t){return e=bp(e),rp(t=>t.length<=e,{expected:`a value with a length of at most ${e}`,representation:{id:`effect/schema/isMaxLength`,payload:{maxLength:e}},toJsonSchema:({type:t})=>t===`string`?e===0?{maxLength:e}:[{maxLength:e},!0]:t===`array`?{maxItems:e}:t===void 0?[{maxLength:e,maxItems:e},!0]:[{},!0],toCode:()=>({runtime:`Schema.isMaxLength(${e})`}),[ic]:!0,arbitraryConstraint:{maxLength:e},...t})}function bp(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${e}`);return Math.max(0,Math.floor(e))}var xp=Hf.check(vp());globalThis.RegExp,globalThis.URL;var Sp=Hf.annotate({expected:`a string that will be decoded as JSON`,contentMediaType:`application/json`});function Cp(e,t){return Sp.pipe(ep(e,ml(t)))}globalThis.File,globalThis.FormData,globalThis.URLSearchParams;var wp=Hf.check(ap()),Tp=Hf.annotate({expected:`a string that will be decoded as a trimmed string`}).pipe(ep(wp,ll())),Ep=Hf.annotate({expected:`a base64 encoded string that will be decoded as Uint8Array`,format:`byte`,contentEncoding:`base64`}),Dp=tp(globalThis.Uint8Array,{representation:{id:`effect/schema/Uint8Array`,payload:null},toCode:()=>({runtime:`Schema.Uint8Array`,Type:`globalThis.Uint8Array`}),expected:`Uint8Array`,toCodecJson:()=>np()(Ep,pl)}),W=e(d(),1),G=c(),Op=W.createContext(void 0),kp=e=>{let t=W.useContext(Op);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Ap=({client:e,children:t})=>(W.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,G.jsx)(Op.Provider,{value:e,children:t})),jp={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Mp=new class{#e=jp;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function Np(e){setTimeout(e,0)}var Pp=typeof window>`u`||`Deno`in globalThis;function Fp(){}function Ip(e,t){return typeof e==`function`?e(t):e}function Lp(e){return typeof e==`number`&&e>=0&&e!==1/0}function Rp(e,t){return Math.max(e+(t||0)-Date.now(),0)}function zp(e,t){return typeof e==`function`?e(t):e}function Bp(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==Hp(o,t.options))return!1}else if(!Wp(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function Vp(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Up(t.options.mutationKey)!==Up(a))return!1}else if(!Wp(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Hp(e,t){return(t?.queryKeyHashFn||Up)(e)}function Up(e){return JSON.stringify(e,(e,t)=>Yp(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Wp(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n<t.length;n++)if(!Wp(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!Wp(e[r],t[r]))return!1;return!0}return!1}var Gp=Object.prototype.hasOwnProperty;function Kp(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Jp(e)&&Jp(t);if(!r&&!(Yp(e)&&Yp(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:Gp.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=Kp(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function qp(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function Jp(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Yp(e){if(!Xp(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Xp(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function Xp(e){return Object.prototype.toString.call(e)===`[object Object]`}function Zp(e){return new Promise(t=>{Mp.setTimeout(t,e)})}function Qp(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:Kp(e,t)}function $p(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function em(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var tm=Symbol();function nm(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===tm?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function rm(e,t){return typeof e==`function`?e(...t):!!e}function im(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var am=()=>Pp,om=()=>am(),sm=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},cm=new class extends sm{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},lm=Np;function um(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=lm,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var dm=um(),fm=new class extends sm{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function pm(e){return Math.min(1e3*2**e,3e4)}function mm(e){return(e??`online`)!==`online`||fm.isOnline()}var hm=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function gm(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(Fp);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new hm(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>cm.isFocused()&&(e.networkMode===`always`||fm.isOnline())&&e.canRun(),p=()=>mm(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(om()?0:3),a=e.retryDelay??pm,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!s){h(r);return}n++,e.onFail?.(n,r),Zp(o).then(()=>f()?void 0:g()).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g().then(_),s)}}var _m=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Lp(this.gcTime)&&(this.#e=Mp.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(om()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(Mp.clearTimeout(this.#e),this.#e=void 0)}};function vm(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{im(e,()=>t.signal,()=>n=!0)},u=nm(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?em:$p;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?bm:ym,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:ym(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function ym(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function bm(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var xm=class extends _m{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=wm(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=wm(this.options);e.data!==void 0&&(this.setState(Cm(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Qp(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(Fp).catch(Fp):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>zp(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===tm||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>zp(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!Rp(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=nm(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?vm(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=gm({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof hm&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof hm){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Sm(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Cm(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),dm.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Sm(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:mm(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Cm(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function wm(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Tm=class extends sm{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Dm(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Om(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Om(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof zp(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!qp(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&km(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||zp(this.options.enabled,this.#t)!==zp(t.enabled,this.#t)||zp(this.options.staleTime,this.#t)!==zp(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||zp(this.options.enabled,this.#t)!==zp(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return qp(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(Fp)),t}#h(e){return!om()&&zp(this.options.enabled,this.#t)!==!1&&Lp(e)}#g(){this.#b();let e=zp(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=Rp(this.#r.dataUpdatedAt,e)+1;this.#u=Mp.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#f=e,!(this.#f===0||!this.#h(this.#f))&&(this.#d=Mp.setInterval(()=>{(this.options.refetchIntervalInBackground||cm.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(Mp.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(Mp.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Dm(e,t),o=i&&km(e,n,t,r);(a||o)&&(l={...l,...Sm(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=Qp(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=Qp(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Am(e,t),refetch:this.refetch,isEnabled:zp(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),qp(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();dm.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function Em(e,t){return zp(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||zp(t.retryOnMount,e)!==!1)}function Dm(e,t){return Em(e,t)||e.state.data!==void 0&&Om(e,t,t.refetchOnMount)}function Om(e,t,n){if(zp(t.enabled,e)!==!1&&zp(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Am(e,t)}return!1}function km(e,t,n,r){return(e!==t||zp(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Am(e,n)}function Am(e,t){return zp(t.enabled,e)!==!1&&e.isStaleByTime(zp(t.staleTime,e))}var jm=class extends _m{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Mm(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=gm({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),dm.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Mm(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Nm=class extends sm{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new jm({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Pm(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Pm(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Pm(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=Pm(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){dm.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Vp(t,e))}findAll(e={}){return this.getAll().filter(t=>Vp(e,t))}notify(e){dm.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return dm.batch(()=>Promise.all(e.map(e=>e.continue().catch(Fp))))}};function Pm(e){return e.options.scope?.id}var Fm=class extends sm{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??Hp(r,t),a=this.get(i);return a||(a=new xm({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){dm.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Bp(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Bp(e,t)):t}notify(e){dm.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){dm.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){dm.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Im=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Fm,this.#t=e.mutationCache||new Nm,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=cm.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=fm.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(zp(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=Ip(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return dm.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;dm.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return dm.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=dm.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Fp).catch(Fp)}invalidateQueries(e,t={}){return dm.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=dm.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(Fp)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Fp)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(zp(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(zp(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Fp).catch(Fp)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Fp).catch(Fp)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return fm.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(Up(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Wp(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Up(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Wp(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=Hp(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===tm&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Lm=W.createContext(!1),Rm=()=>W.useContext(Lm);Lm.Provider;function zm(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Bm=W.createContext(zm()),Vm=()=>W.useContext(Bm),Hm=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?rm(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},Um=e=>{W.useEffect(()=>{e.clearReset()},[e])},Wm=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||rm(n,[e.error,r])),Gm=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Km=(e,t)=>e?.suspense&&t.isPending,qm=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Jm(e,t,n){let r=Rm(),i=Vm(),a=kp(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Gm(o),Hm(o,i,s),Um(i);let[l]=W.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(W.useSyncExternalStore(W.useCallback(e=>{let t=d?l.subscribe(dm.batchCalls(e)):Fp;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),W.useEffect(()=>{l.setOptions(o)},[o,l]),Km(o,u))throw qm(o,l,i);if(Wm({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function Ym(e,t){return Jm(e,Tm,t)}function Xm(e){return e}var Zm=class extends Error{code;details;constructor(e,t,n){super(t),this.code=e,this.details=n,this.name=`WhistleActionError`}},Qm=class extends Error{constructor(){super(`Whistle runtime is closed`),this.name=`WhistleClosedError`}};function $m(){let e=!1,t=jh,n=[],r=[],i=!1,a=[],o=new Set,s=()=>{for(let e of o)e()};return Object.freeze({close:()=>{e||(e=!0,n=[],a=[],r=[],t=jh,s(),o.clear())},contribute:t=>{if(sh(t),e)throw new Qm;ch(t,n),lh(t,n);let r=Symbol(`whistle-contribution`);oh(t)||(n=[...n,{contribution:uh(t),generation:r}],i=!0,s());let a=!0;return kh(o=>{if(!a||e)return;let c={...t,commands:o};sh(c);let l=n.findIndex(e=>e.generation===r),u=n.filter(e=>e.generation!==r);ch(c,u),lh(c,u);let d=uh(c);if(oh(c)){if(l<0)return;n=u}else n=l<0?[...n,{contribution:d,generation:r}]:n.map(e=>e.generation===r?{contribution:d,generation:r}:e);i=!0,s()},()=>{a&&(a=!1,n.find(e=>e.generation===r)!==void 0&&(n=n.filter(e=>e.generation!==r),i=!0,s()))})},execute:async function t(r,i){if(r.trim().length===0)return{status:`invalid`};if(e)return{status:`closed`};let o=ah(r,n);if(o===void 0)return{status:`missing`};let s;try{let e=Nh(o);if(e.status===`unavailable`)return e;let n=a.at(-1)?.presenter;i.interaction===void 0&&n!==void 0&&eh.has(i.origin)&&(s=n({commandId:r,title:o.title,retry:()=>{t(r,i)}}));let c={...i,signal:i.signal??new AbortController().signal};s!==void 0&&(c.interaction=s.interaction,c.signal=AbortSignal.any([c.signal,s.interaction.signal]));let l=await o.handler(c);return s?.settle({status:`handled`}),l===void 0?{status:`handled`}:{status:`handled`,result:l}}catch(e){let t=Fh(e instanceof Error?e:Error(`Command handler threw a non-Error value`));return s?.settle(s.interaction.signal.aborted?{status:`cancelled`}:{status:`failed`,message:t.message}),{status:`failed`,error:t}}},present:t=>{let n={presenter:t};return e||(a=[...a,n]),()=>{a=a.filter(e=>e!==n)}},snapshot:()=>{if(e)return jh;let a=n.flatMap(e=>e.contribution.commands.map(Nh));return(i||a.some((e,t)=>!Ph(e,r[t])))&&(t=Ih(n,a),r=a,i=!1),t},subscribe:t=>e?()=>void 0:(o.add(t),()=>{o.delete(t)})})}var eh=new Set([`browser`,`keyboard`,`menu`,`palette`,`slash`,`terminal`]),th=16,nh=32,rh=64,ih=256;function ah(e,t){for(let n of t)for(let t of n.contribution.commands)if(`${n.contribution.namespace}:${t.id}`===e)return t}function oh(e){return e.commands.length===0}function sh(e){Dh(e.sourceId,`source ID`),Dh(e.namespace,`namespace`,!0),e.scope!==void 0&&Dh(e.scope,`scope`);for(let t of e.commands)Sh(t)}function ch(e,t){t.find(t=>t.contribution.namespace===e.namespace&&t.contribution.sourceId!==e.sourceId)!==void 0&&Ah(`Namespace is already owned by another source`);let n=new Set,r=new Set;for(let i of t){let t=i.contribution.scope===e.scope;for(let e of i.contribution.commands)if(n.add(`${i.contribution.namespace}:${e.id}`),t)for(let t of e.projections?.slash?.aliases??[])r.add(t)}for(let t of e.commands){let i=`${e.namespace}:${t.id}`;n.has(i)&&Ah(`Canonical command ID is already registered`),n.add(i);for(let e of t.projections?.slash?.aliases??[])r.has(e)&&Ah(`Slash alias is already registered`),r.add(e)}}function lh(e,t){t.length>=rh&&Ah(`Live contribution capacity exceeded`),t.reduce((e,t)=>e+t.contribution.commands.length,0)+e.commands.length>ih&&Ah(`Live command capacity exceeded`)}function uh(e){let t={sourceId:e.sourceId,namespace:e.namespace,commands:e.commands.map(dh)};return e.scope===void 0?t:{...t,scope:e.scope}}function dh(e){let t={id:e.id,title:e.title,category:e.category,handler:e.handler};return e.description!==void 0&&(t.description=e.description),e.action!==void 0&&(t.action=fh(e.action)),e.availability!==void 0&&(t.availability=e.availability),e.projections!==void 0&&(t.projections=gh(e.projections)),t}function fh(e){let t={};return e.inputSchema!==void 0&&(t.inputSchema=ph(e.inputSchema)),e.outputSchema!==void 0&&(t.outputSchema=ph(e.outputSchema)),e.presentation!==void 0&&(t.presentation=hh(e.presentation)),Object.freeze(t)}function ph(e){return Object.freeze(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,mh(t)])))}function mh(e){return Array.isArray(e)?Object.freeze(e.map(mh)):e!==null&&e instanceof Object?Object.freeze(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,mh(t)]))):e}function hh(e){switch(e.type){case`action`:return Object.freeze({type:`action`});case`custom`:return Object.freeze({type:`custom`,data:ph(e.data)});case`choice`:return Object.freeze({type:`choice`,options:Object.freeze(e.options.map(e=>Object.freeze({...e,value:mh(e.value)})))});case`form`:return Object.freeze({...e});case`confirmation`:return Object.freeze({...e})}}function gh(e){let t={};return e.bindings!==void 0&&(t.bindings=_h(e.bindings)),e.agent!==void 0&&(t.agent=vh(e.agent)),e.help!==void 0&&(t.help=yh(e.help.order)),e.menu!==void 0&&(t.menu=yh(e.menu.order)),e.palette!==void 0&&(t.palette=yh(e.palette.order)),e.slash!==void 0&&(t.slash=bh(e.slash)),t}function _h(e){let t={values:[...e.values]};return e.order!==void 0&&(t.order=e.order),t}function vh(e){let t={};return e.keybind!==void 0&&(t.keybind=e.keybind),e.order!==void 0&&(t.order=e.order),t}function yh(e){let t={};return e!==void 0&&(t.order=e),t}function bh(e){let t={aliases:[...e.aliases]};return e.order!==void 0&&(t.order=e.order),e.arguments!==void 0&&(t.arguments=xh(e.arguments)),t}function xh(e){let t={hint:e.hint};return e.words!==void 0&&(t.words=Object.freeze(e.words.map(e=>Object.freeze({...e,arguments:ph(e.arguments)})))),e.text!==void 0&&(t.text=Object.freeze({...e.text,arguments:ph(e.text.arguments)})),Object.freeze(t)}function Sh(e){Dh(e.id,`command ID`,!0),Dh(e.title,`title`),Dh(e.category,`category`),Ch(e.action),wh(e.projections)}function Ch(e){if(e?.presentation!==void 0)switch(e.presentation.type){case`action`:case`custom`:return;case`choice`:for(let t of e.presentation.options)Dh(t.label,`choice label`),t.description!==void 0&&Dh(t.description,`choice description`);return;case`form`:e.presentation.submitLabel!==void 0&&Dh(e.presentation.submitLabel,`submit label`);return;case`confirmation`:Dh(e.presentation.message,`confirmation message`),e.presentation.confirmLabel!==void 0&&Dh(e.presentation.confirmLabel,`confirmation label`),e.presentation.cancelLabel!==void 0&&Dh(e.presentation.cancelLabel,`cancellation label`)}}function wh(e){if(e!==void 0){for(let t of[e.bindings,e.palette,e.slash,e.help,e.menu,e.agent])t!==void 0&&Oh(t.order);if(e.bindings!==void 0&&Eh(e.bindings.values,`binding`),e.slash!==void 0){Eh(e.slash.aliases,`slash alias`);for(let t of e.slash.aliases)/\s/u.test(t)&&Ah(`slash alias must not contain whitespace`);Th(e.slash.arguments)}e.agent?.keybind!==void 0&&Dh(e.agent.keybind,`agent keybind`)}}function Th(e){if(e===void 0)return;Dh(e.hint,`argument hint`),e.words===void 0&&e.text===void 0&&Ah(`slash arguments need words or text`);let t=new Set;for(let n of e.words??[])Dh(n.word,`argument word`),/\s/u.test(n.word)&&Ah(`argument word must not contain whitespace`),t.has(n.word)&&Ah(`argument word is repeated`),t.add(n.word),n.description!==void 0&&Dh(n.description,`argument word description`);t.size>nh&&Ah(`argument word count exceeds 32`),e.text!==void 0&&(Dh(e.text.field,`argument text field`),e.text.requestIdField!==void 0&&Dh(e.text.requestIdField,`request id field`))}function Eh(e,t){e.length>th&&Ah(`${t} count exceeds 16`);for(let n of e)Dh(n,t)}function Dh(e,t,n=!1){e.trim().length===0&&Ah(`${t} must not be blank`),n&&e.includes(`:`)&&Ah(`${t} must not contain a colon`)}function Oh(e){e!==void 0&&!Number.isSafeInteger(e)&&Ah(`order must be a safe integer`)}function kh(e=()=>void 0,t=()=>void 0){return Object.freeze({update:e,dispose:t})}function Ah(e){throw Error(e)}var jh=Object.freeze({bindings:Object.freeze([]),palette:Object.freeze([]),slash:Object.freeze([]),help:Object.freeze([]),menu:Object.freeze([]),agent:Object.freeze([])}),Mh=Object.freeze({status:`available`});function Nh(e){let t=e.availability?.()??Mh;return t.status===`available`?Mh:Object.freeze({status:`unavailable`,reason:t.reason})}function Ph(e,t){return e.status===`available`?t?.status===`available`:t?.status===`unavailable`&&e.reason===t.reason}function Fh(e){if(e instanceof Zm){let t={code:e.code,message:e.message};return Object.freeze(e.details===void 0?t:{...t,details:mh(e.details)})}return Object.freeze({code:`command_failed`,message:e.message})}function Ih(e,t){let n=[],r=[],i=[],a=[],o=[],s=[],c=0;for(let l of e){let e=l.contribution;for(let l of e.commands){let u=l.projections,d=t[c++]??Mh;if(u?.bindings!==void 0)for(let t of u.bindings.values)n.push({...Uh(e,l,u.bindings.order,d),binding:t});if(u?.palette!==void 0&&r.push({...Uh(e,l,u.palette.order,d)}),u?.slash!==void 0)for(let t of u.slash.aliases){let n={...Uh(e,l,u.slash.order,d),alias:t};i.push(u.slash.arguments===void 0?n:{...n,arguments:u.slash.arguments})}u?.help!==void 0&&a.push({...Uh(e,l,u.help.order,d)}),u?.menu!==void 0&&o.push({...Uh(e,l,u.menu.order,d)}),u?.agent!==void 0&&s.push(Gh(e,l,u.agent,d))}}return Bh(n),Vh(i),zh(r),zh(a),zh(o),zh(s),Object.freeze({bindings:Hh(n),palette:Hh(r),slash:Hh(i),help:Hh(a),menu:Hh(o),agent:Hh(s)})}var Lh=new TextEncoder;function Rh(e,t){let n=Lh.encode(e),r=Lh.encode(t),i=Math.min(n.length,r.length);for(let e=0;e<i;e+=1){let t=n[e]??0,i=r[e]??0;if(t!==i)return t<i?-1:1}return n.length<r.length?-1:+(n.length>r.length)}function zh(e){e.sort((e,t)=>e.order-t.order||Rh(e.commandId,t.commandId))}function Bh(e){e.sort((e,t)=>e.order-t.order||Rh(e.commandId,t.commandId)||Rh(e.binding,t.binding))}function Vh(e){e.sort((e,t)=>e.order-t.order||Rh(e.commandId,t.commandId)||Rh(e.alias,t.alias))}function Hh(e){return Object.freeze(e.map(e=>Object.freeze(e)))}function Uh(e,t,n,r){let i=Wh(e,t,n,r);return e.scope===void 0?i:{...i,scope:e.scope}}function Wh(e,t,n,r){let i={commandId:`${e.namespace}:${t.id}`,sourceId:e.sourceId,title:t.title,category:t.category,order:n??0,availability:r},a=t.description===void 0?i:{...i,description:t.description};return t.action===void 0?a:{...a,action:t.action}}function Gh(e,t,n,r){let i=Uh(e,t,n.order,r),a=i.action===void 0?i:{...i,action:Kh(i.action)};return n.keybind===void 0?a:{...a,keybind:n.keybind}}function Kh(e){let t={};return e.inputSchema!==void 0&&(t.inputSchema=e.inputSchema),e.outputSchema!==void 0&&(t.outputSchema=e.outputSchema),Object.freeze(t)}var qh=b(),Jh=ue(`status`,[T({status:j(`available`)}).strict(),T({status:j(`unavailable`),reason:P()}).strict()]),Yh=qh,Xh=m(P(),Yh),Zh=e=>Yh.parse(e),Qh=T({code:P().min(1).max(160),message:P().min(1).max(512),details:Yh.optional()}).strict(),$h=e=>Qh.parse(e),eg=Xh,tg=P().refine(e=>e.trim().length>0),ng=Jh,rg=_([T({type:j(`action`)}).strict(),T({type:j(`custom`),data:Xh}).strict(),T({type:j(`choice`),options:A(T({value:Yh,label:tg,description:tg.optional()}))}).strict(),T({type:j(`form`),submitLabel:tg.optional()}).strict(),T({type:j(`confirmation`),message:tg,confirmLabel:tg.optional(),cancelLabel:tg.optional()}).strict()]),ig=T({inputSchema:eg.optional(),outputSchema:eg.optional(),presentation:rg.optional()}).strict(),ag=D().int().refine(e=>Number.isSafeInteger(e)),og=T({hint:tg.pipe(P().max(120)),words:A(T({word:P().regex(/^\S{1,64}$/u),description:tg.pipe(P().max(512)).optional(),arguments:Xh}).strict()).max(32).optional(),text:T({field:tg.pipe(P().max(120)),arguments:Xh,requestIdField:tg.pipe(P().max(120)).optional()}).strict().optional()}).strict().refine(e=>e.words!==void 0||e.text!==void 0,`slash arguments need words or text`),sg=T({order:ag.optional()}).strict(),cg=T({bindings:T({order:ag.optional(),values:A(tg).max(16)}).strict().optional(),agent:T({keybind:tg.optional(),order:ag.optional()}).strict().optional(),help:sg.optional(),menu:sg.optional(),palette:sg.optional(),slash:T({aliases:A(tg).max(16),order:ag.optional(),arguments:og.optional()}).strict().optional()}).strict(),lg=T({id:tg.refine(e=>!e.includes(`:`)),title:tg,category:tg,description:tg.optional(),projections:cg.optional(),action:ig.optional(),availability:ng.optional()}).strict(),ug=e=>lg.parse(e),dg=T({inputSchema:eg.optional(),outputSchema:eg.optional()}).strict(),fg=T({commandId:P(),sourceId:P(),scope:P().optional(),title:P(),category:P(),description:P().optional(),order:D(),availability:Jh,action:dg.optional(),keybind:P().optional()}).strict();A(fg);var pg=tg.pipe(P().max(8192)),mg=f({protocol:/^https?$/u});ue(`type`,[T({type:j(`choice`),message:pg,collapsedGroup:pg.optional(),options:A(T({value:pg,label:pg,description:pg.optional(),group:pg.optional()}).strict()).min(1).max(256)}).strict(),T({type:j(`text`),message:pg,placeholder:pg.optional(),secret:y().optional()}).strict(),T({type:j(`confirmation`),message:pg,confirmLabel:pg.optional(),cancelLabel:pg.optional()}).strict()]),ue(`type`,[T({type:j(`info`),message:pg,links:A(T({url:mg,label:pg.optional()}).strict()).max(16).optional()}).strict(),T({type:j(`progress`),message:pg}).strict(),T({type:j(`handoff`),url:mg,code:pg.optional(),message:pg.optional()}).strict(),T({type:j(`success`),message:pg}).strict()]);function hg(e,t){let n=!1,r=[];for(let i of t){let{availability:t,handler:a,...o}=i,s=a,c=t===void 0?o:{...o,availability:t()};e.register(c,async({arguments:e,origin:t,signal:n})=>{let r=await s(e===void 0?{origin:t,signal:n}:{arguments:e,origin:t,signal:n});return r===void 0?void 0:Zh(r)}).then(e=>{n?e():r.push(e)},e=>{console.warn(`App command ${i.id} was not registered`,e)})}return()=>{if(!n){n=!0;for(let e of r.splice(0))e()}}}O(`light.dark.latte.mocha.readout.readout-night.field-guide.field-guide-night.embed.embed-dark.phosphor.codec.paper.ember.tide.tape.sunrise.pirate-radio.pirate-radio-night.consulting.consulting-ink.consulting-night.consulting-night-ink.consulting-riso-latte.consulting-riso-latte-ink.consulting-riso-glomzy.consulting-riso-glomzy-ink.vishnu.coin.coin-night.chamfer`.split(`.`));var gg=`data-theme`;function _g(e){return e||(globalThis.document?.documentElement??null)}function vg(e){let t=e.trim();if(t.length===0)throw TypeError(`Theme must be a non-empty string`);return t}function yg(e,t){let n=vg(e),r=_g(t);r&&r.setAttribute(gg,n)}function bg(e){return _g(e)?.getAttribute(gg)??null}function xg(e,t){let n=_g(t),r=globalThis,i=(n?.ownerDocument??null)?.defaultView?.MutationObserver??r.MutationObserver;if(!n||!i)return()=>void 0;let a=new i(t=>{if(!t.some(e=>e.type===`attributes`&&e.attributeName===gg))return;let r=n.getAttribute(gg);r&&e(r)});a.observe(n,{attributes:!0,attributeFilter:[gg]});let o=!1;return()=>{o||(o=!0,a.disconnect())}}var Sg=t((e=>{var t=r();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot}))();function Cg(e,t){console.error(JSON.stringify({source:`agar`,operation:e,failureKind:t instanceof Error?`Error`:`NonErrorThrown`}),ec(t))}var wg=Symbol(`workers-module`);Symbol.dispose||(Symbol.dispose=Symbol.for(`dispose`)),Symbol.asyncDispose||(Symbol.asyncDispose=Symbol.for(`asyncDispose`)),Promise.withResolvers||(Promise.withResolvers=function(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}});var Tg=globalThis[wg],Eg=Tg?Tg.RpcTarget:class{},Dg=async function(){}.constructor,Og=typeof Buffer<`u`?Buffer.prototype:void 0;function kg(e){switch(typeof e){case`boolean`:case`number`:case`string`:return`primitive`;case`undefined`:return`undefined`;case`object`:case`function`:break;case`bigint`:return`bigint`;default:return`unsupported`}if(e===null)return`primitive`;let t=Object.getPrototypeOf(e);switch(t){case Object.prototype:return`object`;case Function.prototype:case Dg.prototype:return`function`;case Array.prototype:return`array`;case Date.prototype:return`date`;case Uint8Array.prototype:case Og:case ArrayBuffer.prototype:case DataView.prototype:case Int8Array.prototype:case Uint8ClampedArray.prototype:case Int16Array.prototype:case Uint16Array.prototype:case Int32Array.prototype:case Uint32Array.prototype:case BigInt64Array.prototype:case BigUint64Array.prototype:case Float32Array.prototype:case Float64Array.prototype:return`bytes`;case WritableStream.prototype:return`writable`;case ReadableStream.prototype:return`readable`;case URL.prototype:return`url`;case Headers.prototype:return`headers`;case Request.prototype:return`request`;case Response.prototype:return`response`;case Blob.prototype:return`blob`;case Vg.prototype:return`stub`;case Hg.prototype:return`rpc-promise`;default:if(Tg){if(t==Tg.RpcStub.prototype||e instanceof Tg.ServiceStub)return`rpc-target`;if(t==Tg.RpcPromise.prototype||t==Tg.RpcProperty.prototype)return`rpc-thenable`}return e instanceof Eg?`rpc-target`:e instanceof Error?`error`:`unsupported`}}function Ag(){throw Error(`RPC map() implementation was not loaded.`)}var jg={applyMap:Ag,sendMap:Ag};function Mg(){throw Error(`Stream implementation was not loaded.`)}var Ng={createWritableStreamHook:Mg,createWritableStreamFromHook:Mg,createReadableStreamHook:Mg},Pg=class{stream(e,t){let n=this.call(e,t),r;try{r=n.pull()}catch(e){throw n.dispose(),e}let i;return r instanceof Promise?i=r.then(e=>{e.dispose()}):(r.dispose(),i=Promise.resolve()),{promise:i}}},Fg=class extends Pg{error;constructor(e){super(),this.error=e}call(e,t){return t.dispose(),this}map(e,t,n){for(let e of t)e.dispose();return this}get(e){return this}dup(){return this}pull(){return Promise.reject(this.error)}ignoreUnhandledRejections(){}dispose(){}onBroken(e){try{e(this.error)}catch(e){Promise.resolve(e)}}},Ig=new Fg(Error(`Attempted to use RPC stub after it has been disposed.`)),Lg=(e,t,n)=>e.call(t,n);function Rg(e,t){let n=Lg;Lg=e;try{return t()}finally{Lg=n}}var zg=Symbol(`realStub`),Bg={apply(e,t,n){let r=e.raw;return new Hg(Lg(r.hook,r.pathIfPromise||[],Yg.fromAppParams(n)),[])},get(e,t,n){let r=e.raw;if(t===zg)return r;if(t in Hg.prototype)return r[t];if(typeof t==`string`)return new Hg(r.hook,r.pathIfPromise?[...r.pathIfPromise,t]:[t]);if(t===Symbol.dispose&&(!r.pathIfPromise||r.pathIfPromise.length==0))return()=>{r.hook.dispose(),r.hook=Ig}},has(e,t){let n=e.raw;return t===zg?!0:t in Hg.prototype?t in n:typeof t==`string`||t===Symbol.dispose&&(!n.pathIfPromise||n.pathIfPromise.length==0)},construct(e,t){throw Error(`An RPC stub cannot be used as a constructor.`)},defineProperty(e,t,n){throw Error(`Can't define properties on RPC stubs.`)},deleteProperty(e,t){throw Error(`Can't delete properties on RPC stubs.`)},getOwnPropertyDescriptor(e,t){},getPrototypeOf(e){return Object.getPrototypeOf(e.raw)},isExtensible(e){return!1},ownKeys(e){return[]},preventExtensions(e){return!0},set(e,t,n,r){throw Error(`Can't assign properties on RPC stubs.`)},setPrototypeOf(e,t){throw Error(`Can't override prototype of RPC stubs.`)}},Vg=class e extends Eg{constructor(e,t){if(super(),!(e instanceof Pg)){let n=e;if(e=n instanceof Eg||n instanceof Function?e_.create(n,void 0):new Qg(Yg.fromAppReturn(n)),t)throw TypeError(`RpcStub constructor expected one argument, received two.`)}this.hook=e,this.pathIfPromise=t;let n=()=>{};return n.raw=this,new Proxy(n,Bg)}hook;pathIfPromise;dup(){let t=this[zg];return t.pathIfPromise?new e(t.hook.get(t.pathIfPromise)):new e(t.hook.dup())}onRpcBroken(e){this[zg].hook.onBroken(e)}map(e){let{hook:t,pathIfPromise:n}=this[zg];return jg.sendMap(t,n||[],e)}toString(){return`[object RpcStub]`}},Hg=class extends Vg{constructor(e,t){if(e instanceof Pg)super(e,t??[]);else{if(t!==void 0)throw TypeError(`RpcPromise constructor expected one argument, received two.`);let n=kg(e);if(n===`rpc-promise`){let t=qg(e);if(t.pathIfPromise.length>0)super(t.hook,t.pathIfPromise);else{let e=t.hook;t.hook=Ig,super(e,[])}}else if(n===`rpc-thenable`)super(e_.create(e,void 0),[]);else{let t=new t_(Promise.resolve(e).then(e=>new Qg(Yg.fromAppReturn(e))));t.ignoreUnhandledRejections(),super(t,[])}}}then(e,t){return Jg(this).then(...arguments)}catch(e){return Jg(this).catch(...arguments)}finally(e){return Jg(this).finally(...arguments)}toString(){return`[object RpcPromise]`}};function Ug(e){let{hook:t,pathIfPromise:n}=e[zg];return n&&n.length>0?t.get(n):t}function Wg(e){let{hook:t,pathIfPromise:n}=e[zg];return n?t.get(n):t.dup()}function Gg(e){let{hook:t,pathIfPromise:n}=e[zg];if(!(n&&n.length>0))return t}function Kg(e){return e[zg].hook}function qg(e){return e[zg]}async function Jg(e){let{hook:t,pathIfPromise:n}=e[zg];return n.length>0&&(t=t.get(n)),(await t.pull()).deliverResolve()}var Yg=class e{value;source;hooks;promises;static fromAppParams(t){return new e(t,`params`)}static fromAppReturn(t){return new e(t,`return`)}static fromArray(t){let n=[],r=[],i=[];for(let e of t){e.ensureDeepCopied();for(let t of e.hooks)n.push(t);for(let t of e.promises)t.parent===e&&(t={parent:i,property:i.length,promise:t.promise}),r.push(t);i.push(e.value)}return new e(i,`owned`,n,r)}static forEvaluate(t,n){return new e(null,`owned`,t,n)}static deepCopyFrom(t,n,r){let i=new e(null,`owned`,[],[]);return i.value=i.deepCopy(t,n,`value`,i,!0,r),i}constructor(e,t,n,r){this.value=e,this.source=t,this.hooks=n,this.promises=r}rpcTargets;getHookForRpcTarget(e,t,n=!0){if(this.source===`params`){if(n){let t=e;typeof t.dup==`function`&&(e=t.dup())}return e_.create(e,t)}if(this.source===`return`){let r=this.rpcTargets?.get(e);return r?n?r.dup():(this.rpcTargets?.delete(e),r):(r=e_.create(e,t),n?(this.rpcTargets||=new Map,this.rpcTargets.set(e,r),r.dup()):r)}throw Error(`owned payload shouldn't contain raw RpcTargets`)}getHookForWritableStream(e,t,n=!0){if(this.source===`params`)return Ng.createWritableStreamHook(e);if(this.source===`return`){let t=this.rpcTargets?.get(e);return t?n?t.dup():(this.rpcTargets?.delete(e),t):(t=Ng.createWritableStreamHook(e),n?(this.rpcTargets||=new Map,this.rpcTargets.set(e,t),t.dup()):t)}throw Error(`owned payload shouldn't contain raw WritableStreams`)}getHookForReadableStream(e,t,n=!0){if(this.source===`params`)return Ng.createReadableStreamHook(e);if(this.source===`return`){let t=this.rpcTargets?.get(e);return t?n?t.dup():(this.rpcTargets?.delete(e),t):(t=Ng.createReadableStreamHook(e),n?(this.rpcTargets||=new Map,this.rpcTargets.set(e,t),t.dup()):t)}throw Error(`owned payload shouldn't contain raw ReadableStreams`)}deepCopy(e,t,n,r,i,a){switch(kg(e)){case`unsupported`:return e;case`primitive`:case`bigint`:case`date`:case`bytes`:case`blob`:case`url`:case`error`:case`undefined`:return e;case`array`:{let t=e,n=t.length,r=Array(n);for(let e=0;e<n;e++)r[e]=this.deepCopy(t[e],t,e,r,i,a);return r}case`object`:{let t={},n=e;for(let e in n)t[e]=this.deepCopy(n[e],n,e,t,i,a);return t}case`stub`:case`rpc-promise`:{let t=e,a;if(a=i?Wg(t):Ug(t),t instanceof Hg){let e=new Hg(a,[]);return this.promises.push({parent:r,property:n,promise:e}),e}return this.hooks.push(a),new Vg(a)}case`function`:case`rpc-target`:{let n=e,r;return r=a?a.getHookForRpcTarget(n,t,i):e_.create(n,t),this.hooks.push(r),new Vg(r)}case`rpc-thenable`:{let o=e,s;return s=a?new Hg(a.getHookForRpcTarget(o,t,i),[]):new Hg(e_.create(o,t),[]),this.promises.push({parent:r,property:n,promise:s}),s}case`writable`:{let n=e,r;return r=a?a.getHookForWritableStream(n,t,i):Ng.createWritableStreamHook(n),this.hooks.push(r),n}case`readable`:{let n=e,r;return r=a?a.getHookForReadableStream(n,t,i):Ng.createReadableStreamHook(n),this.hooks.push(r),n}case`headers`:return new Headers(e);case`request`:{let t=e;return t.body&&this.deepCopy(t.body,t,`body`,t,i,a),new Request(t)}case`response`:{let t=e;return t.body&&this.deepCopy(t.body,t,`body`,t,i,a),new Response(t.body,t)}default:throw Error(`unreachable`)}}ensureDeepCopied(){if(this.source!==`owned`){let e=this.source===`params`;this.hooks=[],this.promises=[];try{this.value=this.deepCopy(this.value,void 0,`value`,this,e,this)}catch(e){throw this.hooks=void 0,this.promises=void 0,e}if(this.source=`owned`,this.rpcTargets&&this.rpcTargets.size>0)throw Error(`Not all rpcTargets were accounted for in deep-copy?`);this.rpcTargets=void 0}}deliverTo(t,n,r){if(this.ensureDeepCopied(),this.value instanceof Hg)e.deliverRpcPromiseTo(this.value,t,n,r);else{t[n]=this.value;for(let t of this.promises)e.deliverRpcPromiseTo(t.promise,t.parent,t.property,r)}}static deliverRpcPromiseTo(t,n,r,i){let a=Gg(t);if(!a)throw Error(`property promises should have been resolved earlier`);let o=a.pull();o instanceof e?o.deliverTo(n,r,i):i.push(o.then(e=>{let t=[];if(e.deliverTo(n,r,t),t.length>0)return Promise.all(t)}))}async deliverCall(t,n){try{let r=[];this.deliverTo(this,`value`,r),r.length>0&&await Promise.all(r);let i=Function.prototype.apply.call(t,n,this.value);return i instanceof Hg?e.fromAppReturn(i):e.fromAppReturn(await i)}finally{this.dispose()}}async deliverStreamWrite(t){try{let n=[];this.deliverTo(this,`value`,n),n.length>0&&await Promise.all(n);let r=this.value[0];return(this.hooks.length>0||this.promises.length>0)&&r instanceof Object?(Symbol.dispose in r||Object.defineProperty(r,Symbol.dispose,{value:()=>this.dispose(),writable:!0,enumerable:!1,configurable:!0}),await t.write(r),e.fromAppReturn(void 0)):(await t.write(r),this.dispose(),e.fromAppReturn(void 0))}catch(e){throw this.dispose(),e}}async deliverResolve(){try{let e=[];this.deliverTo(this,`value`,e),e.length>0&&await Promise.all(e);let t=this.value;return t instanceof Object&&(Symbol.dispose in t||Object.defineProperty(t,Symbol.dispose,{value:()=>this.dispose(),writable:!0,enumerable:!1,configurable:!0})),t}catch(e){throw this.dispose(),e}}dispose(){if(this.source===`owned`)this.hooks.forEach(e=>e.dispose()),this.promises.forEach(e=>e.promise[Symbol.dispose]());else if(this.source===`return`&&(this.disposeImpl(this.value,void 0),this.rpcTargets&&this.rpcTargets.size>0))throw Error(`Not all rpcTargets were accounted for in disposeImpl()?`);this.source=`owned`,this.hooks=[],this.promises=[]}disposeImpl(e,t){switch(kg(e)){case`unsupported`:case`primitive`:case`bigint`:case`bytes`:case`blob`:case`date`:case`url`:case`error`:case`undefined`:return;case`array`:{let t=e,n=t.length;for(let e=0;e<n;e++)this.disposeImpl(t[e],t);return}case`object`:{let t=e;for(let e in t)this.disposeImpl(t[e],t);return}case`stub`:case`rpc-promise`:{let t=Gg(e);t&&t.dispose();return}case`function`:case`rpc-target`:{let t=e,n=this.rpcTargets?.get(t);n?(n.dispose(),this.rpcTargets.delete(t)):$g(t);return}case`rpc-thenable`:return;case`headers`:return;case`request`:{let t=e;t.body&&this.disposeImpl(t.body,t);return}case`response`:{let t=e;t.body&&this.disposeImpl(t.body,t);return}case`writable`:{let t=e,n=this.rpcTargets?.get(t);n?this.rpcTargets.delete(t):n=Ng.createWritableStreamHook(t),n.dispose();return}case`readable`:{let t=e,n=this.rpcTargets?.get(t);n?this.rpcTargets.delete(t):n=Ng.createReadableStreamHook(t),n.dispose();return}default:return}}ignoreUnhandledRejections(){this.hooks?(this.hooks.forEach(e=>{e.ignoreUnhandledRejections()}),this.promises.forEach(e=>Kg(e.promise).ignoreUnhandledRejections())):this.ignoreUnhandledRejectionsImpl(this.value)}ignoreUnhandledRejectionsImpl(e){switch(kg(e)){case`unsupported`:case`primitive`:case`bigint`:case`bytes`:case`blob`:case`date`:case`error`:case`undefined`:case`function`:case`rpc-target`:case`writable`:case`readable`:case`url`:case`headers`:case`request`:case`response`:return;case`array`:{let t=e,n=t.length;for(let e=0;e<n;e++)this.ignoreUnhandledRejectionsImpl(t[e]);return}case`object`:{let t=e;for(let e in t)this.ignoreUnhandledRejectionsImpl(t[e]);return}case`stub`:case`rpc-promise`:Kg(e).ignoreUnhandledRejections();return;case`rpc-thenable`:e.then(e=>{},e=>{});return;default:return}}};function Xg(e,t,n,r){for(let i=0;i<n.length;i++){t=e;let a=n[i];if(a in Object.prototype){e=void 0;continue}switch(kg(e)){case`object`:case`function`:e=Object.hasOwn(e,a)?e[a]:void 0;break;case`array`:e=Number.isInteger(a)&&a>=0?e[a]:void 0;break;case`rpc-target`:case`rpc-thenable`:if(Object.hasOwn(e,a))throw TypeError(`Attempted to access property '${a}', which is an instance property of the RpcTarget. To avoid leaking private internals, instance properties cannot be accessed over RPC. If you want to make this property available over RPC, define it as a method or getter on the class, instead of an instance property.`);e=e[a],r=null;break;case`stub`:case`rpc-promise`:{let{hook:t,pathIfPromise:r}=qg(e);return{hook:t,remainingPath:r?r.concat(n.slice(i)):n.slice(i)}}case`writable`:e=void 0;break;case`readable`:e=void 0;break;case`primitive`:case`bigint`:case`bytes`:case`blob`:case`date`:case`error`:case`url`:case`headers`:case`request`:case`response`:e=void 0;break;case`undefined`:e=e[a];break;case`unsupported`:if(i===0)throw TypeError(`RPC stub points at a non-serializable type.`);{let e=n.slice(0,i).join(`.`),t=n.slice(0,i).join(`.`);throw TypeError(`'${e}' is not a serializable type, so property ${t} cannot be accessed.`)}default:throw TypeError(`unreachable`)}}if(e instanceof Hg){let{hook:t,pathIfPromise:n}=qg(e);return{hook:t,remainingPath:n||[]}}return{value:e,parent:t,owner:r}}var Zg=class extends Pg{call(e,t){let n;try{let{value:t,owner:r}=this.getValue();n=Xg(t,void 0,e,r)}catch(e){return t.dispose(),new Fg(e)}return n.hook?n.hook.call(n.remainingPath,t):typeof n.value==`function`?new t_(t.deliverCall(n.value,n.parent).then(e=>new Qg(e))):(t.dispose(),new Fg(TypeError(`'${e.join(`.`)}' is not a function.`)))}map(e,t,n){try{let r;try{let{value:t,owner:n}=this.getValue();r=Xg(t,void 0,e,n)}catch(e){for(let e of t)e.dispose();throw e}return r.hook?r.hook.map(r.remainingPath,t,n):jg.applyMap(r.value,r.parent,r.owner,t,n)}catch(e){return new Fg(e)}}get(e){try{let{value:t,owner:n}=this.getValue();if(e.length===0&&n===null){if(t instanceof Object&&`then`in t)return this.dup();throw Error(`Can't dup an RpcTarget stub as a promise.`)}let r=Xg(t,void 0,e,n);return r.hook?r.hook.get(r.remainingPath):new Qg(Yg.deepCopyFrom(r.value,r.parent,r.owner))}catch(e){return new Fg(e)}}},Qg=class e extends Zg{constructor(e){super(),this.payload=e}payload;getPayload(){if(this.payload)return this.payload;throw Error(`Attempted to use an RPC StubHook after it was disposed.`)}getValue(){let e=this.getPayload();return{value:e.value,owner:e}}dup(){let t=this.getPayload();return new e(Yg.deepCopyFrom(t.value,void 0,t))}pull(){return this.getPayload()}ignoreUnhandledRejections(){this.payload&&this.payload.ignoreUnhandledRejections()}dispose(){this.payload&&=(this.payload.dispose(),void 0)}onBroken(e){this.payload&&this.payload.value instanceof Vg&&this.payload.value.onRpcBroken(e)}};function $g(e){if(Symbol.dispose in e)try{e[Symbol.dispose]()}catch(e){Promise.reject(e)}}var e_=class e extends Zg{static create(t,n){return typeof t!=`function`&&(n=void 0),new e(t,n)}constructor(e,t,n){super(),this.target=e,this.parent=t,n?n.refcount&&(this.refcount=n.refcount,++this.refcount.count):Symbol.dispose in e&&(this.refcount={count:1})}target;parent;refcount;getTarget(){if(this.target)return this.target;throw Error(`Attempted to use an RPC StubHook after it was disposed.`)}getValue(){return{value:this.getTarget(),owner:null}}dup(){return new e(this.getTarget(),this.parent,this)}pull(){let e=this.getTarget();return`then`in e?Promise.resolve(e).then(e=>Yg.fromAppReturn(e)):Promise.reject(Error(`Tried to resolve a non-promise stub.`))}ignoreUnhandledRejections(){}dispose(){this.target&&=(this.refcount&&--this.refcount.count==0&&$g(this.target),void 0)}onBroken(e){let t=this.target;t&&`then`in t&&Promise.resolve(t).then(()=>{},e)}},t_=class e extends Pg{promise;resolution;constructor(e){super(),this.promise=e.then(e=>(this.resolution=e,e))}call(t,n){return n.ensureDeepCopied(),new e(this.promise.then(e=>e.call(t,n),e=>{throw n.dispose(),e}))}stream(e,t){return t.ensureDeepCopied(),{promise:this.promise.then(n=>n.stream(e,t).promise,e=>{throw t.dispose(),e})}}map(t,n,r){return new e(this.promise.then(e=>e.map(t,n,r),e=>{for(let e of n)e.dispose();throw e}))}get(t){return new e(this.promise.then(e=>e.get(t)))}dup(){return this.resolution?this.resolution.dup():new e(this.promise.then(e=>e.dup()))}pull(){return this.resolution?this.resolution.pull():this.promise.then(e=>e.pull())}ignoreUnhandledRejections(){this.resolution?this.resolution.ignoreUnhandledRejections():this.promise.then(e=>{e.ignoreUnhandledRejections()},e=>{})}dispose(){this.promise.then(e=>e.dispose(),()=>{})}onBroken(e){this.resolution?this.resolution.onBroken(e):this.promise.then(t=>{t.onBroken(e)},e)}},n_={maxBigIntDigits:16384,maxDepth:256,maxMessageSize:33554432},r_=new Uint8Array(new Uint16Array([1]).buffer)[0]===1,i_=[`ArrayBuffer`,`DataView`,`Int8Array`,`Uint8Array`,`Uint8ClampedArray`,`Int16Array`,`Uint16Array`,`Int32Array`,`Uint32Array`,`BigInt64Array`,`BigUint64Array`,`Float32Array`,`Float64Array`];function a_(e){return i_.includes(e)}var o_={ArrayBuffer:void 0,DataView:void 0,Int8Array:void 0,Uint8Array:void 0,Uint8ClampedArray:void 0,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,BigInt64Array:8,BigUint64Array:8,Float32Array:4,Float64Array:8},s_={ArrayBuffer:ArrayBuffer.prototype,DataView:DataView.prototype,Int8Array:Int8Array.prototype,Uint8ClampedArray:Uint8ClampedArray.prototype,Int16Array:Int16Array.prototype,Uint16Array:Uint16Array.prototype,Int32Array:Int32Array.prototype,Uint32Array:Uint32Array.prototype,BigInt64Array:BigInt64Array.prototype,BigUint64Array:BigUint64Array.prototype,Float32Array:Float32Array.prototype,Float64Array:Float64Array.prototype},c_=new Map;for(let e of Object.keys(s_))c_.set(s_[e],e);function l_(e,t){if(t!==2&&t!==4&&t!==8)throw RangeError(`Unsupported element size: ${t}`);let n=new DataView(e.buffer,e.byteOffset,e.byteLength);for(let r=0;r<e.byteLength;r+=t)switch(t){case 2:n.setUint16(r,n.getUint16(r,!1),!0);break;case 4:n.setUint32(r,n.getUint32(r,!1),!0);break;case 8:n.setBigUint64(r,n.getBigUint64(r,!1),!0)}}var u_=new class{exportStub(e){throw Error(`Cannot serialize RPC stubs without an RPC session.`)}exportPromise(e){throw Error(`Cannot serialize RPC stubs without an RPC session.`)}getImport(e){}unexport(e){}createPipe(e){throw Error(`Cannot create pipes without an RPC session.`)}onSendError(e){}};async function d_(e,t){let n=await new Response(e).blob();return n.type===t?n:n.slice(0,n.size,t)}var f_={__proto__:null,Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError},p_=class e{exporter;source;encodingLevel;constructor(e,t,n){this.exporter=e,this.source=t,this.encodingLevel=n}static devaluate(t,n,r=u_,i,a=`string`){let o=new e(r,i,a);try{return o.devaluateImpl(t,n,0)}catch(e){if(o.exports)try{r.unexport(o.exports)}catch{}throw e}}exports;devaluateImpl(e,t,n){if(n>=256)throw Error(`Serialization exceeded maximum allowed depth. (Does the message contain cycles?)`);switch(kg(e)){case`unsupported`:{let t;try{t=`Cannot serialize value: ${e}`}catch{t=`Cannot serialize value: (couldn't stringify value)`}throw TypeError(t)}case`primitive`:return typeof e==`number`&&!isFinite(e)?this.encodingLevel===`structuredClonable`?e:e===1/0?[`inf`]:e===-1/0?[`-inf`]:[`nan`]:e;case`object`:{let t=e,r={};for(let e in t)r[e]=this.devaluateImpl(t[e],t,n+1);return r}case`array`:{let t=e,r=t.length,i=Array(r);for(let e=0;e<r;e++)i[e]=this.devaluateImpl(t[e],t,n+1);return[i]}case`bigint`:return this.encodingLevel===`structuredClonable`?e:[`bigint`,e.toString()];case`date`:{if(this.encodingLevel===`structuredClonable`)return e;let t=e.getTime();return[`date`,Number.isNaN(t)?null:t]}case`bytes`:{let t=c_.get(Object.getPrototypeOf(e)),n;if(t===`ArrayBuffer`)n=new Uint8Array(e);else if(t===void 0)n=e;else{let r=e;n=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);let i=o_[t];!r_&&i&&(n=n.slice(),l_(n,i))}if(this.encodingLevel===`structuredClonable`||this.encodingLevel===`jsonCompatibleWithBytes`)return t===void 0?[`bytes`,n]:[`bytes`,n,t];let r;if(n.toBase64)r=n.toBase64({omitPadding:!0});else if(typeof Buffer<`u`)r=(n instanceof Buffer?n:Buffer.from(n.buffer,n.byteOffset,n.byteLength)).toString(`base64`);else{let e=``;for(let t=0;t<n.length;t++)e+=String.fromCharCode(n[t]);r=btoa(e)}return r=r.replace(/=+$/,``),t===void 0?[`bytes`,r]:[`bytes`,r,t]}case`url`:return[`url`,e.href];case`headers`:return[`headers`,[...e]];case`request`:{let t=e,r={};t.method!==`GET`&&(r.method=t.method);let i=[...t.headers];if(i.length>0&&(r.headers=i),t.body)r.body=this.devaluateImpl(t.body,t,n+1),r.duplex=t.duplex||`half`;else if(t.body===void 0&&![`GET`,`HEAD`,`OPTIONS`,`TRACE`,`DELETE`].includes(t.method)){let e=t.arrayBuffer(),n=new ReadableStream({async start(t){try{t.enqueue(new Uint8Array(await e)),t.close()}catch(e){t.error(e)}}}),i=Ng.createReadableStreamHook(n);r.body=[`readable`,this.exporter.createPipe(n,i)],r.duplex=t.duplex||`half`}t.cache&&t.cache!=="default"&&(r.cache=t.cache),t.redirect!==`follow`&&(r.redirect=t.redirect),t.integrity&&(r.integrity=t.integrity),t.mode&&t.mode!==`cors`&&(r.mode=t.mode),t.credentials&&t.credentials!==`same-origin`&&(r.credentials=t.credentials),t.referrer&&t.referrer!==`about:client`&&(r.referrer=t.referrer),t.referrerPolicy&&(r.referrerPolicy=t.referrerPolicy),t.keepalive&&(r.keepalive=t.keepalive);let a=t;return a.cf&&(r.cf=a.cf),a.encodeResponseBody&&a.encodeResponseBody!==`automatic`&&(r.encodeResponseBody=a.encodeResponseBody),[`request`,t.url,r]}case`response`:{let t=e,r=this.devaluateImpl(t.body,t,n+1),i={};t.status!==200&&(i.status=t.status),t.statusText&&(i.statusText=t.statusText);let a=[...t.headers];a.length>0&&(i.headers=a);let o=t;if(o.cf&&(i.cf=o.cf),o.encodeBody&&o.encodeBody!==`automatic`&&(i.encodeBody=o.encodeBody),o.webSocket)throw TypeError(`Can't serialize a Response containing a webSocket.`);return[`response`,r,i]}case`blob`:{let t=e,n=t.stream(),r=Ng.createReadableStreamHook(n),i=this.exporter.createPipe(n,r);return[`blob`,t.type,[`readable`,i]]}case`error`:{let t=e,r=this.exporter.onSendError(t);r&&(t=r);let i=t,a,o=(e,r)=>{let i=this.exports?.length??0;try{let i=this.devaluateImpl(r,t,n+1);a||={},a[e]=i}catch{if(this.exports&&this.exports.length>i){let e=this.exports.splice(i);try{this.exporter.unexport(e)}catch{}}}};for(let e of Object.keys(t))e!==`name`&&e!==`message`&&e!==`stack`&&o(e,i[e]);`cause`in t&&o(`cause`,i.cause),t instanceof AggregateError&&o(`errors`,t.errors);let s=[`error`,t.name,t.message];return a?(s.push(r&&r.stack?r.stack:null),s.push(a)):r&&r.stack&&s.push(r.stack),s}case`undefined`:return this.encodingLevel===`structuredClonable`?void 0:[`undefined`];case`stub`:case`rpc-promise`:{if(!this.source)throw Error(`Can't serialize RPC stubs in this context.`);let{hook:t,pathIfPromise:n}=qg(e),r=this.exporter.getImport(t);return r===void 0?(t=n?t.get(n):t.dup(),this.devaluateHook(n?`promise`:`export`,t)):n?n.length>0?[`pipeline`,r,n]:[`pipeline`,r]:[`import`,r]}case`function`:case`rpc-target`:{if(!this.source)throw Error(`Can't serialize RPC stubs in this context.`);let n=this.source.getHookForRpcTarget(e,t);return this.devaluateHook(`export`,n)}case`rpc-thenable`:{if(!this.source)throw Error(`Can't serialize RPC stubs in this context.`);let n=this.source.getHookForRpcTarget(e,t);return this.devaluateHook(`promise`,n)}case`writable`:{if(!this.source)throw Error(`Can't serialize WritableStream in this context.`);let n=this.source.getHookForWritableStream(e,t);return this.devaluateHook(`writable`,n)}case`readable`:{if(!this.source)throw Error(`Can't serialize ReadableStream in this context.`);let n=e,r=this.source.getHookForReadableStream(n,t);return[`readable`,this.exporter.createPipe(n,r)]}default:throw Error(`unreachable`)}}devaluateHook(e,t){this.exports||=[];let n=e===`promise`?this.exporter.exportPromise(t):this.exporter.exportStub(t);return this.exports.push(n),[e,n]}};new class{importStub(e){throw Error(`Cannot deserialize RPC stubs without an RPC session.`)}importPromise(e){throw Error(`Cannot deserialize RPC stubs without an RPC session.`)}getExport(e){}getPipeReadable(e){throw Error(`Cannot retrieve pipe readable without an RPC session.`)}getLimits(){return n_}};function m_(e,t){return new Hg(new t_(new Response(t).arrayBuffer().then(t=>{let n=new Uint8Array(t),r=new Request(e,{body:n});return new Qg(Yg.fromAppReturn(r))})),[])}function h_(e,t){return new Hg(new t_(d_(e,t).then(e=>new Qg(Yg.fromAppReturn(e)))),[])}var g_=class e{importer;encodingLevel;limits;constructor(e,t=`string`){this.importer=e,this.encodingLevel=t,this.limits=e.getLimits()}hooks=[];promises=[];evaluate(e){return this.evaluateWithDepth(e,0)}evaluateWithDepth(e,t){let n=Yg.forEvaluate(this.hooks,this.promises);try{return n.value=this.evaluateImpl(e,n,`value`,t),n}catch(e){throw n.dispose(),e}}evaluateCopy(e){return this.evaluate(structuredClone(e))}evaluateImpl(t,n,r,i){let a=this.limits.maxDepth;if(i>=a)throw TypeError(`Deserialization exceeded maximum allowed message depth of ${a}.`);if(this.encodingLevel===`structuredClonable`&&(t instanceof Date||typeof t==`bigint`))return t;if(t instanceof Array){if(t.length==1&&t[0]instanceof Array){let e=t[0];for(let t=0;t<e.length;t++)e[t]=this.evaluateImpl(e[t],e,t,i+1);return e}switch(t[0]){case`bigint`:if(typeof t[1]==`string`){let e=t[1],n=this.limits.maxBigIntDigits;if(e.length>n)throw TypeError(`Deserialized bigint exceeds maximum length of ${n} digits.`);return BigInt(e)}break;case`date`:if(t[1]===null)return new Date(NaN);if(typeof t[1]==`number`)return new Date(t[1]);break;case`bytes`:{let e;if(t[1]instanceof Uint8Array)e=t[1];else if(typeof t[1]==`string`){if(typeof Buffer<`u`)e=Buffer.from(t[1],`base64`);else if(Uint8Array.fromBase64)e=Uint8Array.fromBase64(t[1]);else{let n=atob(t[1]),r=n.length;e=new Uint8Array(r);for(let t=0;t<r;t++)e[t]=n.charCodeAt(t)}}else break;if(t.length===2)return e;if(typeof t[2]!=`string`)throw TypeError(`Unknown bytes type marker type: ${typeof t[2]}`);if(!a_(t[2])){let e=t[2].slice(0,64);throw TypeError(`Unknown bytes type marker: ${e}`)}let n=t[2],r=o_[n];if(r!==void 0&&e.byteLength%r!==0)throw TypeError(`Invalid byte length ${e.byteLength} for ${n}; expected a multiple of ${r}`);let i=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);switch(!r_&&r!==void 0&&l_(new Uint8Array(i),r),n){case`ArrayBuffer`:return i;case`DataView`:return new DataView(i);case`Int8Array`:return new Int8Array(i);case`Uint8Array`:return new Uint8Array(i);case`Uint8ClampedArray`:return new Uint8ClampedArray(i);case`Int16Array`:return new Int16Array(i);case`Uint16Array`:return new Uint16Array(i);case`Int32Array`:return new Int32Array(i);case`Uint32Array`:return new Uint32Array(i);case`BigInt64Array`:return new BigInt64Array(i);case`BigUint64Array`:return new BigUint64Array(i);case`Float32Array`:return new Float32Array(i);case`Float64Array`:return new Float64Array(i)}}case`error`:if(t.length>=3&&typeof t[1]==`string`&&typeof t[2]==`string`){let e=f_[t[1]]||Error,n=e===AggregateError?new e([],t[2]):new e(t[2]);if(typeof t[3]==`string`&&(n.stack=t[3]),t.length>=5){let e=t[4];if(!e||typeof e!=`object`||Array.isArray(e))break;let r=n,a=e;for(let e of Object.keys(a))if(e!==`name`&&e!==`message`&&e!==`stack`){if(e in Object.prototype||e===`toJSON`){this.evaluateImpl(a[e],n,e,i+1);continue}r[e]=this.evaluateImpl(a[e],n,e,i+1)}}return n}break;case`undefined`:if(t.length===1)return;break;case`inf`:return 1/0;case`-inf`:return-1/0;case`nan`:return NaN;case`url`:if(t.length===2&&typeof t[1]==`string`)return new URL(t[1]);break;case`headers`:if(t.length===2&&t[1]instanceof Array)return new Headers(t[1]);break;case`request`:{if(t.length!==3||typeof t[1]!=`string`)break;let e=t[1],a=t[2];if(typeof a!=`object`||!a)break;if(a.body&&(a.body=this.evaluateImpl(a.body,a,`body`,i+1),!(a.body===null||typeof a.body==`string`||a.body instanceof Uint8Array||a.body instanceof ReadableStream)))throw TypeError(`Request body must be of type ReadableStream.`);if(a.signal&&(a.signal=this.evaluateImpl(a.signal,a,`signal`,i+1),!(a.signal instanceof AbortSignal)))throw TypeError(`Request siganl must be of type AbortSignal.`);if(a.headers&&!(a.headers instanceof Array))throw TypeError(`Request headers must be serialized as an array of pairs.`);let o=new Request(e,a);if(a.body instanceof ReadableStream&&o.body===void 0){let e=m_(o,a.body);return this.promises.push({promise:e,parent:n,property:r}),e}return o}case`response`:{if(t.length!==3)break;let e=this.evaluateImpl(t[1],n,r,i+1);if(!(e===null||typeof e==`string`||e instanceof Uint8Array||e instanceof ReadableStream))throw TypeError(`Response body must be of type ReadableStream.`);let a=t[2];if(typeof a!=`object`||!a)break;if(a.webSocket)throw TypeError(`Can't deserialize a Response containing a webSocket.`);if(a.headers&&!(a.headers instanceof Array))throw TypeError(`Request headers must be serialized as an array of pairs.`);return new Response(e,a)}case`blob`:{if(t.length!==3||typeof t[1]!=`string`)break;let e=t[1],a=this.evaluateImpl(t[2],n,r,i+1);if(!(a instanceof ReadableStream))throw TypeError(`Blob content must be serialized as a ReadableStream.`);let o=h_(a,e);return this.promises.push({promise:o,parent:n,property:r}),o}case`import`:case`pipeline`:{if(t.length<2||t.length>4||typeof t[1]!=`number`)break;let a=this.importer.getExport(t[1]);if(!a)throw Error(`no such entry on exports table: ${t[1]}`);let o=t[0]==`pipeline`,s=e=>{if(o){let t=new Hg(e,[]);return this.promises.push({promise:t,parent:n,property:r}),t}return this.hooks.push(e),new Hg(e,[])};if(t.length==2)return s(o?a.get([]):a.dup());let c=t[2];if(!(c instanceof Array)||!c.every(e=>typeof e==`string`||typeof e==`number`))break;if(t.length==3)return s(a.get(c));let l=t[3];if(!(l instanceof Array))break;return l=new e(this.importer).evaluateWithDepth([l],i),s(a.call(c,l))}case`remap`:{if(t.length!==5||typeof t[1]!=`number`||!(t[2]instanceof Array)||!(t[3]instanceof Array)||!(t[4]instanceof Array))break;let e=this.importer.getExport(t[1]);if(!e)throw Error(`no such entry on exports table: ${t[1]}`);let i=t[2];if(!i.every(e=>typeof e==`string`||typeof e==`number`))break;let a=t[3].map(e=>{if(!(e instanceof Array)||e.length!==2||e[0]!==`import`&&e[0]!==`export`||typeof e[1]!=`number`)throw TypeError(`unknown map capture: ${JSON.stringify(e)}`);if(e[0]===`export`)return this.importer.importStub(e[1]);{let t=this.importer.getExport(e[1]);if(!t)throw Error(`no such entry on exports table: ${e[1]}`);return t.dup()}}),o=t[4],s=new Hg(e.map(i,a,o),[]);return this.promises.push({promise:s,parent:n,property:r}),s}case`export`:case`promise`:if(typeof t[1]==`number`){if(t[0]==`promise`){let e=new Hg(this.importer.importPromise(t[1]),[]);return this.promises.push({parent:n,property:r,promise:e}),e}{let e=this.importer.importStub(t[1]);return this.hooks.push(e),new Vg(e)}}break;case`writable`:if(typeof t[1]==`number`){let e=this.importer.importStub(t[1]),n=Ng.createWritableStreamFromHook(e);return this.hooks.push(e),n}break;case`readable`:if(typeof t[1]==`number`){let e=this.importer.getPipeReadable(t[1]),n=Ng.createReadableStreamHook(e);return this.hooks.push(n),e}}throw TypeError(`unknown special value: ${JSON.stringify(t)}`)}if(t instanceof Object){let e=t;for(let t in e)t in Object.prototype||t===`toJSON`?(this.evaluateImpl(e[t],e,t,i+1),delete e[t]):e[t]=this.evaluateImpl(e[t],e,t,i+1);return e}return t}},__=16,v_=8,y_=16,b_=64;function x_(e){return 2+e.length*3}function S_(e,t,n=0){if(n>=b_)return v_;switch(typeof e){case`string`:return x_(e);case`number`:return 16;case`bigint`:return 16;case`boolean`:return 8;case`undefined`:return 16;case`object`:{if(e===null)return 8;if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer)return y_+e.byteLength;if(typeof Blob<`u`&&e instanceof Blob)return y_+e.size;if(e instanceof Date)return 16;if(t??=new WeakSet,t.has(e))return v_;if(t.add(e),e instanceof Array){let r=__;for(let i of e)r+=v_+S_(i,t,n+1);return r}if(e instanceof Error){let r=__+x_(e.name)+x_(e.message)+x_(e.stack??``);for(let i of Object.keys(e))r+=v_+x_(i)+S_(e[i],t,n+1);return r}let r=__;for(let i of Object.keys(e))r+=v_+x_(i)+S_(e[i],t,n+1);return r}default:return 16}}var C_=class{session;importId;constructor(e,t,n){this.session=e,this.importId=t,n&&(this.activePull=Promise.withResolvers())}localRefcount=0;remoteRefcount=1;activePull;resolution;onBrokenRegistrations;resolve(e){if(this.localRefcount==0){e.dispose();return}if(this.resolution=e,this.sendRelease(),this.onBrokenRegistrations){for(let t of this.onBrokenRegistrations){let n=this.session.onBrokenCallbacks[t],r=this.session.onBrokenCallbacks.length;e.onBroken(n),this.session.onBrokenCallbacks[r]===n?delete this.session.onBrokenCallbacks[r]:delete this.session.onBrokenCallbacks[t]}this.onBrokenRegistrations=void 0}this.activePull&&=(this.activePull.resolve(),void 0)}async awaitResolution(){return this.activePull||=(this.session.sendPull(this.importId),Promise.withResolvers()),await this.activePull.promise,this.resolution.pull()}dispose(){this.resolution?this.resolution.dispose():(this.abort(Error(`RPC was canceled because the RpcPromise was disposed.`)),this.sendRelease())}abort(e){this.resolution||(this.resolution=new Fg(e),this.activePull&&=(this.activePull.reject(e),void 0),this.onBrokenRegistrations=void 0)}onBroken(e){if(this.resolution)this.resolution.onBroken(e);else{let t=this.session.onBrokenCallbacks.length;this.session.onBrokenCallbacks.push(e),this.onBrokenRegistrations||=[],this.onBrokenRegistrations.push(t)}}sendRelease(){this.remoteRefcount>0&&(this.session.sendRelease(this.importId,this.remoteRefcount),this.remoteRefcount=0)}},w_=class e extends Pg{isPromise;entry;constructor(e,t){super(),this.isPromise=e,++t.localRefcount,this.entry=t}collectPath(e){return this}getEntry(){if(this.entry)return this.entry;throw Error(`This RpcImportHook was already disposed.`)}getEntryTakingOwnership(e){try{return this.getEntry()}catch(t){throw e(),t}}call(e,t){let n=this.getEntryTakingOwnership(()=>t.dispose());return n.resolution?n.resolution.call(e,t):n.session.sendCall(n.importId,e,t)}stream(e,t){let n=this.getEntryTakingOwnership(()=>t.dispose());return n.resolution?n.resolution.stream(e,t):n.session.sendStream(n.importId,e,t)}map(e,t,n){let r=this.getEntryTakingOwnership(()=>{for(let e of t)e.dispose()});return r.resolution?r.resolution.map(e,t,n):r.session.sendMap(r.importId,e,t,n)}get(e){let t=this.getEntry();return t.resolution?t.resolution.get(e):t.session.sendCall(t.importId,e)}dup(){return new e(!1,this.getEntry())}pull(){let e=this.getEntry();if(!this.isPromise)throw Error(`Can't pull this hook because it's not a promise hook.`);return e.resolution?e.resolution.pull():e.awaitResolution()}ignoreUnhandledRejections(){}dispose(){let e=this.entry;this.entry=void 0,e&&--e.localRefcount===0&&e.dispose()}onBroken(e){this.entry&&this.entry.onBroken(e)}},T_=class extends w_{session;constructor(e){super(!1,e),this.session=e.session}dispose(){if(this.session){let e=this.session;this.session=void 0,e.shutdown()}}},E_=class{transport;options;exports=[];reverseExports=new Map;imports=[];abortReason;cancelReadLoop;nextExportId=-1;onBatchDone;pullCount=0;onBrokenCallbacks=[];encodingLevel;limits;constructor(e,t,n){this.transport=e,this.options=n;let r=`string`;if(`encodingLevel`in e){let t=e.encodingLevel;if(t!==void 0){if(t!==`string`&&t!==`jsonCompatible`&&t!==`jsonCompatibleWithBytes`&&t!==`structuredClonable`)throw TypeError(`Unknown transport encodingLevel: ${String(t)}`);r=t}}this.encodingLevel=r,this.limits={...n_,...n.limits},this.exports.push({hook:t,refcount:1}),this.imports.push(new C_(this,0,!1)),this.readLoop().catch(e=>this.abort(e))}getMainImport(){return new T_(this.imports[0])}shutdown(){this.abort(Error(`RPC session was shut down by disposing the main stub`),!1)}exportStub(e){if(this.abortReason)throw this.abortReason;let t=this.reverseExports.get(e);if(t!==void 0)return++this.exports[t].refcount,t;{let t=this.nextExportId--;return this.exports[t]={hook:e,refcount:1},this.reverseExports.set(e,t),t}}exportPromise(e){if(this.abortReason)throw this.abortReason;let t=this.nextExportId--;return this.exports[t]={hook:e,refcount:1},this.reverseExports.set(e,t),this.ensureResolvingExport(t),t}unexport(e){for(let t of e)this.releaseExport(t,1)}releaseExport(e,t){let n=this.exports[e];if(!n)throw Error(`no such export ID: ${e}`);if(n.refcount<t)throw Error(`refcount would go negative: ${n.refcount} < ${t}`);n.refcount-=t,n.refcount===0&&(delete this.exports[e],this.reverseExports.delete(n.hook),n.hook.dispose())}onSendError(e){if(this.options.onSendError)return this.options.onSendError(e)}ensureResolvingExport(e){let t=this.exports[e];if(!t)throw Error(`no such export ID: ${e}`);if(!t.pull){let n=async()=>{let e=t.hook;for(;;){let t=await e.pull();if(t.value instanceof Vg){let{hook:n,pathIfPromise:r}=qg(t.value);if(r&&r.length==0&&this.getImport(e)===void 0){e=n;continue}}return t}},r=t.autoRelease;++this.pullCount,t.pull=n().then(t=>{let n=p_.devaluate(t.value,void 0,this,t,this.encodingLevel);this.send([`resolve`,e,n]),r&&this.releaseExport(e,1)},t=>{this.send([`reject`,e,p_.devaluate(t,void 0,this,void 0,this.encodingLevel)]),r&&this.releaseExport(e,1)}).catch(t=>{try{this.send([`reject`,e,p_.devaluate(t,void 0,this,void 0,this.encodingLevel)]),r&&this.releaseExport(e,1)}catch(e){this.abort(e)}}).finally(()=>{--this.pullCount===0&&this.onBatchDone&&this.onBatchDone.resolve()})}}getImport(e){if(e instanceof w_&&e.entry&&e.entry.session===this)return e.entry.importId}importStub(e){if(this.abortReason)throw this.abortReason;let t=this.imports[e];return t||(t=new C_(this,e,!1),this.imports[e]=t),new w_(!1,t)}importPromise(e){if(this.abortReason)throw this.abortReason;if(this.imports[e])return new Fg(Error(`Bug in RPC system: The peer sent a promise reusing an existing export ID.`));let t=new C_(this,e,!0);return this.imports[e]=t,new w_(!0,t)}getExport(e){return this.exports[e]?.hook}getPipeReadable(e){let t=this.exports[e];if(!t||!t.pipeReadable)throw Error(`Export ${e} is not a pipe or its readable end was already consumed.`);let n=t.pipeReadable;return t.pipeReadable=void 0,n}getLimits(){return this.limits}createPipe(e,t){if(this.abortReason)throw this.abortReason;this.send([`pipe`]);let n=this.imports.length,r=new C_(this,n,!1);this.imports.push(r);let i=new w_(!1,r),a=Ng.createWritableStreamFromHook(i);return e.pipeTo(a).catch(()=>{}).finally(()=>t.dispose()),n}send(e){if(this.abortReason!==void 0)return 0;if(this.encodingLevel===`string`){let t;try{t=JSON.stringify(e)}catch(e){try{this.abort(e)}catch{}throw e}try{let e=this.transport.send(t);e!==void 0&&typeof e.catch==`function`&&e.catch(e=>this.abort(e,!1))}catch(e){queueMicrotask(()=>this.abort(e,!1))}return t.length}try{let t=this.transport.send(e);if(typeof t==`number`)return t;let n=t;n&&typeof n.then==`function`&&Promise.resolve(n).catch(e=>this.abort(e,!1));return}catch(e){queueMicrotask(()=>this.abort(e,!1));return}}sendCall(e,t,n){if(this.abortReason)throw n?.dispose(),this.abortReason;let r=[`pipeline`,e,t];if(n){let e;try{e=p_.devaluate(n.value,void 0,this,n,this.encodingLevel)}catch(e){throw n.dispose(),e}r.push(e[0])}this.send([`push`,r]);let i=new C_(this,this.imports.length,!1);return this.imports.push(i),new w_(!0,i)}sendStream(e,t,n){if(this.abortReason)throw n.dispose(),this.abortReason;let r=[`pipeline`,e,t],i;try{i=p_.devaluate(n.value,void 0,this,n,this.encodingLevel)}catch(e){throw n.dispose(),e}r.push(i[0]);let a=[`stream`,r],o=this.send(a);o===void 0&&(o=S_(a));let s=this.imports.length,c=new C_(this,s,!0);return c.remoteRefcount=0,c.localRefcount=1,this.imports.push(c),{promise:c.awaitResolution().then(e=>{e.dispose(),delete this.imports[s]},e=>{throw delete this.imports[s],e}),size:o}}sendMap(e,t,n,r){if(this.abortReason){for(let e of n)e.dispose();throw this.abortReason}let i=[`remap`,e,t,n.map(e=>{let t=this.getImport(e);return t===void 0?[`export`,this.exportStub(e)]:[`import`,t]}),r];this.send([`push`,i]);let a=new C_(this,this.imports.length,!1);return this.imports.push(a),new w_(!0,a)}sendPull(e){if(this.abortReason)throw this.abortReason;this.send([`pull`,e])}sendRelease(e,t){this.abortReason||(this.send([`release`,e,t]),delete this.imports[e])}abort(e,t=!0){if(this.abortReason===void 0){if(this.cancelReadLoop?.(e),this.cancelReadLoop=void 0,t)try{let t=[`abort`,p_.devaluate(e,void 0,this,void 0,this.encodingLevel)];if(this.encodingLevel===`string`){let e=this.transport.send(JSON.stringify(t));e!==void 0&&typeof e.catch==`function`&&e.catch(e=>{})}else{let e=this.transport.send(t);e&&typeof e.then==`function`&&Promise.resolve(e).catch(e=>{})}}catch{}if(e===void 0&&(e=`undefined`),this.abortReason=e,this.onBatchDone&&this.onBatchDone.reject(e),this.transport.abort)try{this.transport.abort(e)}catch(e){Promise.resolve(e)}for(let t in this.onBrokenCallbacks)try{this.onBrokenCallbacks[t](e)}catch(e){Promise.resolve(e)}for(let t in this.imports)this.imports[t].abort(e);for(let e in this.exports)this.exports[e].hook.dispose()}}async readLoop(){for(;!this.abortReason;){let e=Promise.withResolvers();this.cancelReadLoop=e.reject;let t;try{t=await Promise.race([this.transport.receive(),e.promise])}finally{this.cancelReadLoop===e.reject&&(this.cancelReadLoop=void 0)}if(this.encodingLevel===`string`&&t.length>this.limits.maxMessageSize)throw TypeError(`Incoming message exceeds maximum size of ${this.limits.maxMessageSize} UTF-16 code units.`);if(this.abortReason)break;let n=this.encodingLevel===`string`?JSON.parse(t):t;if(n instanceof Array)switch(n[0]){case`push`:if(n.length>1){let e=new Qg(new g_(this,this.encodingLevel).evaluate(n[1]));e.ignoreUnhandledRejections(),this.exports.push({hook:e,refcount:1});continue}break;case`stream`:if(n.length>1){let e=new Qg(new g_(this,this.encodingLevel).evaluate(n[1]));e.ignoreUnhandledRejections();let t=this.exports.length;this.exports.push({hook:e,refcount:1,autoRelease:!0}),this.ensureResolvingExport(t);continue}break;case`pipe`:{let{readable:e,writable:t}=new TransformStream,n=Ng.createWritableStreamHook(t);this.exports.push({hook:n,refcount:1,pipeReadable:e});continue}case`pull`:{let e=n[1];if(typeof e==`number`){this.ensureResolvingExport(e);continue}break}case`resolve`:case`reject`:{let e=n[1];if(typeof e==`number`&&n.length>2){let t=this.imports[e];if(t){if(n[0]==`resolve`)t.resolve(new Qg(new g_(this,this.encodingLevel).evaluate(n[2])));else{let e=new g_(this,this.encodingLevel).evaluate(n[2]);e.dispose(),t.resolve(new Fg(e.value))}}else n[0]==`resolve`&&new g_(this,this.encodingLevel).evaluate(n[2]).dispose();continue}break}case`release`:{let e=n[1],t=n[2];if(typeof e==`number`&&typeof t==`number`){this.releaseExport(e,t);continue}break}case`abort`:{let e=new g_(this,this.encodingLevel).evaluate(n[1]);e.dispose(),this.abort(e.value,!1);break}}throw Error(`bad RPC message: ${JSON.stringify(n)}`)}}async drain(){if(this.abortReason)throw this.abortReason;if(this.pullCount>0){let{promise:e,resolve:t,reject:n}=Promise.withResolvers();this.onBatchDone={resolve:t,reject:n},await e}}getStats(){let e={imports:0,exports:0};for(let t in this.imports)++e.imports;for(let t in this.exports)++e.exports;return e}},D_=class{#e;#t;constructor(e,t,n={}){let r;r=t?new Qg(Yg.fromAppReturn(t)):new Fg(Error(`This connection has no main object.`)),this.#e=new E_(e,r,n),this.#t=new Vg(this.#e.getMainImport())}getRemoteMain(){return this.#t}getStats(){return this.#e.getStats()}drain(){return this.#e.drain()}};function O_(e,t,n){return new D_(new k_(e),t,n).getRemoteMain()}var k_=class{encodingLevel=`structuredClonable`;constructor(e){this.#e=e,e.start(),e.addEventListener(`message`,e=>{this.#i||(e.data===null?this.#a(Error(`Peer closed MessagePort connection.`)):this.#t?(this.#t(e.data),this.#t=void 0,this.#n=void 0):this.#r.push(e.data))}),e.addEventListener(`messageerror`,e=>{this.#a(Error(`MessagePort message error.`))})}#e;#t;#n;#r=[];#i;send(e){if(this.#i)throw this.#i;this.#e.postMessage(e)}async receive(){if(this.#r.length>0)return this.#r.shift();if(this.#i)throw this.#i;return new Promise((e,t)=>{this.#t=e,this.#n=t})}abort(e){try{this.#e.postMessage(null)}catch{}this.#e.close(),this.#i||=e}#a(e){this.#i||(this.#i=e,this.#n&&=(this.#n(e),this.#t=void 0,void 0))}},A_,j_=class{context;captureMap=new Map;instructions=[];constructor(e,t){this.context=A_?{parent:A_,captures:[],subject:A_.capture(e),path:t}:{parent:void 0,captures:[],subject:e,path:t},A_=this}unregister(){A_=this.context.parent}makeInput(){return new N_(this,0)}makeOutput(e){let t;try{t=p_.devaluate(e.value,void 0,this,e)}finally{e.dispose()}return this.instructions.push(t),this.context.parent?(this.context.parent.instructions.push([`remap`,this.context.subject,this.context.path,this.context.captures.map(e=>[`import`,e]),this.instructions]),new N_(this.context.parent,this.context.parent.instructions.length)):this.context.subject.map(this.context.path,this.context.captures,this.instructions)}pushCall(e,t,n){let r=p_.devaluate(n.value,void 0,this,n);r=r[0];let i=this.capture(e.dup());return this.instructions.push([`pipeline`,i,t,r]),new N_(this,this.instructions.length)}pushGet(e,t){let n=this.capture(e.dup());return this.instructions.push([`pipeline`,n,t]),new N_(this,this.instructions.length)}capture(e){if(e instanceof N_&&e.mapper===this)return e.idx;let t=this.captureMap.get(e);if(t===void 0){if(this.context.parent){let t=this.context.parent.capture(e);this.context.captures.push(t)}else this.context.captures.push(e);t=-this.context.captures.length,this.captureMap.set(e,t)}return t}exportStub(e){throw Error(`Can't construct an RpcTarget or RPC callback inside a mapper function. Try creating a new RpcStub outside the callback first, then using it inside the callback.`)}exportPromise(e){return this.exportStub(e)}getImport(e){return this.capture(e)}unexport(e){}createPipe(e){throw Error(`Cannot send ReadableStream inside a mapper function.`)}onSendError(e){}};jg.sendMap=(e,t,n)=>{let r=new j_(e,t),i;try{i=Yg.fromAppReturn(Rg(r.pushCall.bind(r),()=>n(new Hg(r.makeInput(),[]))))}finally{r.unregister()}if(i instanceof Promise)throw i.catch(e=>{}),Error(`RPC map() callbacks cannot be async.`);return new Hg(r.makeOutput(i),[])};function M_(){throw Error(`Attempted to use an abstract placeholder from a mapper function. Please make sure your map function has no side effects.`)}var N_=class extends Pg{mapper;idx;constructor(e,t){super(),this.mapper=e,this.idx=t}dup(){return this}dispose(){}get(e){if(e.length==0)return this;if(A_)return A_.pushGet(this,e);M_()}call(e,t){t.dispose(),M_()}map(e,t,n){for(let e of t)e.dispose();M_()}pull(){M_()}ignoreUnhandledRejections(){}onBroken(e){M_()}},P_=class{captures;variables;constructor(e,t){this.captures=e,this.variables=[t]}dispose(){for(let e of this.variables)e.dispose()}apply(e){try{if(e.length<1)throw Error(`Invalid empty mapper function.`);for(let t of e.slice(0,-1)){let e=new g_(this).evaluateCopy(t);if(e.value instanceof Vg){let t=Gg(e.value);if(t){this.variables.push(t);continue}}this.variables.push(new Qg(e))}return new g_(this).evaluateCopy(e[e.length-1])}finally{for(let e of this.variables)e.dispose()}}importStub(e){throw Error(`A mapper function cannot refer to exports.`)}importPromise(e){return this.importStub(e)}getExport(e){return e<0?this.captures[-e-1]:this.variables[e]}getPipeReadable(e){throw Error(`A mapper function cannot use pipe readables.`)}getLimits(){return n_}};function F_(e,t,n,r,i){let a=new P_(r,new Qg(Yg.deepCopyFrom(e,t,n)));try{return a.apply(i)}finally{a.dispose()}}jg.applyMap=(e,t,n,r,i)=>{try{let a;if(e instanceof Hg)throw Error(`applyMap() can't be called on RpcPromise`);if(e instanceof Array){let t=[];try{for(let a of e)t.push(F_(a,e,n,r,i))}catch(e){for(let e of t)e.dispose();throw e}a=Yg.fromArray(t)}else a=e==null?Yg.fromAppReturn(e):F_(e,t,n,r,i);return new Qg(a)}finally{for(let e of r)e.dispose()}};var I_=class e extends Pg{state;static create(t){let n=t.getWriter();return new e({refcount:1,writer:n,closed:!1})}constructor(e,t){super(),this.state=e,t&&++e.refcount}getState(){if(this.state)return this.state;throw Error(`Attempted to use a WritableStreamStubHook after it was disposed.`)}call(e,t){try{let n=this.getState();if(e.length!==1||typeof e[0]!=`string`)throw Error(`WritableStream stub only supports direct method calls`);let r=e[0];if(r!==`write`&&r!==`close`&&r!==`abort`)throw Error(`Unknown WritableStream method: ${r}`);return(r===`close`||r===`abort`)&&(n.closed=!0),new t_((r===`write`?t.deliverStreamWrite(n.writer):t.deliverCall(n.writer[r],n.writer)).then(e=>new Qg(e)))}catch(e){return t.dispose(),new Fg(e)}}map(e,t,n){for(let e of t)e.dispose();return new Fg(Error(`Cannot use map() on a WritableStream`))}get(e){return new Fg(Error(`Cannot access properties on a WritableStream stub`))}dup(){let t=this.getState();return new e(t,this)}pull(){return Promise.reject(Error(`Cannot pull a WritableStream stub`))}ignoreUnhandledRejections(){}dispose(){let e=this.state;this.state=void 0,e&&--e.refcount===0&&(e.closed||e.writer.abort(Error(`WritableStream RPC stub was disposed without calling close()`)).catch(()=>{}),e.writer.releaseLock())}onBroken(e){}},L_=262144,R_=1073741824,z_=65536,B_=2,V_=1.25,H_=.9,U_=3,W_=class{now;window=L_;bytesInFlight=0;inStartupPhase=!0;delivered=0;deliveredTime=0;firstAckTime=0;firstAckDelivered=0;minRtt=1/0;roundsWithoutIncrease=0;lastRoundWindow=0;roundStartTime=0;constructor(e){this.now=e}onSend(e){this.bytesInFlight+=e;let t={sentTime:this.now(),size:e,deliveredAtSend:this.delivered,deliveredTimeAtSend:this.deliveredTime,windowAtSend:this.window,windowFullAtSend:this.bytesInFlight>=this.window};return{token:t,shouldBlock:t.windowFullAtSend}}onError(e){this.bytesInFlight-=e.size}onAck(e){let t=this.now();this.delivered+=e.size,this.deliveredTime=t,this.bytesInFlight-=e.size;let n=t-e.sentTime;if(this.minRtt=Math.min(this.minRtt,n),this.firstAckTime===0)this.firstAckTime=t,this.firstAckDelivered=this.delivered;else{let n,r;e.deliveredTimeAtSend===0?(n=this.firstAckTime,r=this.firstAckDelivered):(n=e.deliveredTimeAtSend,r=e.deliveredAtSend);let i=t-n,a=(this.delivered-r)/i,o=this.inStartupPhase?B_:V_,s=a*this.minRtt*o;s=Math.min(s,e.windowAtSend*o),s=e.windowFullAtSend?Math.max(s,e.windowAtSend*H_):Math.max(s,this.window),this.window=Math.max(Math.min(s,R_),z_),this.inStartupPhase&&e.sentTime>=this.roundStartTime&&(this.window>this.lastRoundWindow*V_?this.roundsWithoutIncrease=0:++this.roundsWithoutIncrease>=U_&&(this.inStartupPhase=!1),this.roundStartTime=t,this.lastRoundWindow=this.window)}return this.bytesInFlight<this.window}};function G_(e){let t,n=!1,r=new W_(()=>performance.now()),i,a,o=()=>{n||(n=!0,e.dispose())};return new WritableStream({write(n,s){if(t!==void 0)throw t;let c=Yg.fromAppParams([n]),{promise:l,size:u}=e.stream([`write`],c);if(u===void 0)return l.catch(e=>{throw t===void 0&&(t=e),e});{let{token:e,shouldBlock:n}=r.onSend(u);if(l.then(()=>{r.onAck(e)&&i&&(i(),i=void 0,a=void 0)},n=>{r.onError(e),t===void 0&&(t=n,s.error(n),o()),a&&=(a(n),i=void 0,void 0)}),n)return new Promise((e,t)=>{i=e,a=t})}},async close(){if(t!==void 0)throw o(),t;let{promise:n}=e.stream([`close`],Yg.fromAppParams([]));try{await n}catch(e){throw t??e}finally{o()}},abort(n){if(t!==void 0)return;t=n??Error(`WritableStream was aborted`),a&&=(a(t),i=void 0,void 0);let{promise:r}=e.stream([`abort`],Yg.fromAppParams([n]));r.then(()=>o(),()=>o())}})}var K_=class e extends Pg{state;static create(t){return new e({refcount:1,stream:t,canceled:!1})}constructor(e,t){super(),this.state=e,t&&++e.refcount}call(e,t){return t.dispose(),new Fg(Error(`Cannot call methods on a ReadableStream stub`))}map(e,t,n){for(let e of t)e.dispose();return new Fg(Error(`Cannot use map() on a ReadableStream`))}get(e){return new Fg(Error(`Cannot access properties on a ReadableStream stub`))}dup(){let t=this.state;if(!t)throw Error(`Attempted to dup a ReadableStreamStubHook after it was disposed.`);return new e(t,this)}pull(){return Promise.reject(Error(`Cannot pull a ReadableStream stub`))}ignoreUnhandledRejections(){}dispose(){let e=this.state;this.state=void 0,e&&--e.refcount===0&&(e.canceled||(e.canceled=!0,e.stream.locked||e.stream.cancel(Error(`ReadableStream RPC stub was disposed without being consumed`)).catch(()=>{})))}onBroken(e){}};Ng.createWritableStreamHook=I_.create,Ng.createWritableStreamFromHook=G_,Ng.createReadableStreamHook=K_.create;var q_=Vg,J_=Eg,Y_=O_;function X_(e){return e<32||e>=127&&e<=159||e===1564||e>=8203&&e<=8207||e===8232||e===8233||e>=8234&&e<=8238||e>=8294&&e<=8297||e===65279}function Z_(e,t){let n=e.find(e=>e.id===t.itemId);if(n===void 0||n.kind===`text`)return!1;if(n.kind===`menu`){let e=n.options.find(e=>e.id===t.optionId);return e!==void 0&&e.disabled!==!0}return t.optionId===void 0?n.kind!==`button`||n.disabled!==!0:!1}function Q_(e){let t=e.trim().toLowerCase();if(!t)throw Error(`Invalid keymap token: token cannot be empty`);return t}function $_(e){let t=e.trim().toLowerCase();if(!t)throw Error(`Invalid key name: key name cannot be empty`);return t}function ev(e){return{name:$_(e.name),ctrl:e.ctrl??!1,shift:e.shift??!1,meta:e.meta??!1,super:e.super??!1,hyper:e.hyper||void 0}}function tv(e){return{name:e.name,ctrl:e.ctrl,shift:e.shift,meta:e.meta,super:e.super,hyper:e.hyper||void 0}}function nv(e,t){let n=tv(ev(e));return{stroke:n,display:t?.display??uv(n),match:t?.match??ov(n),tokenName:t?.tokenName?Q_(t.tokenName):void 0}}function rv(e){return{stroke:tv(e.stroke),display:e.display,match:e.match,tokenName:e.tokenName,patternName:e.patternName,payloadKey:e.payloadKey}}function iv(e){return e.map(e=>rv(e))}function av(e){return`match`in e?e.match:`stroke`in e?ov(e.stroke):ov(e)}function ov(e){return`key:${dv(ev(e))}`}function sv(e){let t=e.trim();if(!t)throw Error(`Invalid keymap match id: id cannot be empty`);return`text:${t}`}function cv(e,t){return`stroke`in e?t?.preferDisplay&&e.display?e.display:uv(e.stroke):uv(ev(e))}function lv(e,t){return e.map(e=>cv(e,t)).join(t?.separator??``)}function uv(e){let t=[];return e.ctrl&&t.push(`ctrl`),e.shift&&t.push(`shift`),e.meta&&t.push(`meta`),e.super&&t.push(`super`),e.hyper&&t.push(`hyper`),t.push(e.name===`return`?`enter`:e.name),t.join(`+`)}function dv(e){return`${e.name}:${+!!e.ctrl}:${+!!e.shift}:${+!!e.meta}:${+!!e.super}:${+!!e.hyper}`}var fv=Symbol(`keymap-extension-context`);function pv(e){return e.isDestroyed?null:e.getFocusedTarget()}function mv(e,t,n){let r=t??e.rootTarget,i=t!==null;for(;r;){if(n(r,i)===!1)return;r=e.getParentTarget(r),i=!1}}function hv(e,t){let n=new Set;return mv(e,t,e=>{n.add(e)}),n}function gv(e,t,n){let r=[],i=hv(t,n),a=Array.isArray(e)?e:_v(e);for(let e of a)vv(t,e,n,i)&&r.push(e);return r}function _v(e){return[...e].sort((e,t)=>t.priority-e.priority||t.order-e.order)}function vv(e,t,n,r=hv(e,n)){let i=t.target;return i?e.isTargetDestroyed(i)?!1:t.targetMode===`focus`?i===n:r.has(i):!0}function yv(e){let t=e.binding.sequence[e.index];if(!t?.patternName)return 0;let n=e.patterns?.at(-1);return n?.name===t.patternName?n.values.length:0}function bv(e,t,n=!0){let r=e.binding.sequence[e.index];if(!r?.patternName)return!0;let i=t.get(r.patternName);return i?yv(e)>=i.min:n}function xv(e,t,n=!0){let r=e.binding.sequence[e.index];if(r?.patternName){let n=t.get(r.patternName);if(n&&yv(e)<n.max)return!0}return bv(e,t,n)&&e.index+1<e.binding.sequence.length}function Sv(e,t){return e.index===e.binding.sequence.length-1&&bv(e,t,!1)}function Cv(e,t,n,r){return{parent:e,depth:e?e.depth+1:0,stroke:t,match:n,pattern:r,children:new Map,patternChildren:[],bindings:[],reachableBindings:[]}}function wv(e,t){let n=Cv(null,null,null);for(let r of e){if(r.event!==`press`)continue;let e=n;for(let n of r.sequence){let i;if(n.patternName){let r=t.get(n.patternName);i=e.patternChildren.find(e=>e.pattern?.name===n.patternName),i||(i=Cv(e,n.stroke,n.match,r),e.patternChildren.push(i))}else i=e.children.get(n.match),i||(i=Cv(e,n.stroke,n.match),e.children.set(n.match,i));i.reachableBindings.push(r),e=i}e.bindings.push(r)}return n}function Tv(e,t){let n=[];for(let r of e){if(!bv(r,t))continue;let e=r.index+1,i=r.binding.sequence[e];i&&n.push({part:i,binding:r.binding,index:e,exact:e===r.binding.sequence.length-1,continues:e<r.binding.sequence.length-1})}return n}function Ev(e,t,n,r){let i=n.patternName;if(!i)return{...e,index:t};let a=[...e.patterns??[]],o=a.at(-1);return o?.name===i?a[a.length-1]={...o,values:[...o.values,r],parts:[...o.parts,n]}:a.push({name:i,payloadKey:n.payloadKey??i,values:[r],parts:[n]}),{layer:e.layer,binding:e.binding,index:t,parts:[...e.parts,n],patterns:a}}function Dv(e,t){let n=e.parts.at(-1);if(!n||n.patternName)return t.length;let r=t.indexOf(n.match);return r===-1?t.length:r}function Ov(e,t,n,r,i,a,o,s,c){let l=t.sequence[n];if(l){if(l.patternName){let a=s(l.patternName,o);if(!a)return;let u=c(o,l.patternName,a);return Ev({layer:e,binding:t,index:n,parts:r,patterns:i},n,u,a.value??o.name)}if(a.includes(l.match))return{layer:e,binding:t,index:n,parts:[...r,l],patterns:i}}}function kv(e,t,n,r,i,a){let o=e.binding.sequence[e.index];if(o?.patternName){let s=r.get(o.patternName);if(s&&yv(e)<s.max){let t=i(s.name,n);if(t){let r=a(n,s.name,t);return Ev(e,e.index,r,t.value??n.name)}}return bv(e,r,!1)?Ov(e.layer,e.binding,e.index+1,e.parts,e.patterns,t,n,i,a):void 0}return Ov(e.layer,e.binding,e.index+1,e.parts,e.patterns,t,n,i,a)}function Av(e,t,n,r,i){let a=[],o=1/0;for(let s of e.bindings){if(s.event!==`press`)continue;let c=Ov(e,s,0,[],void 0,t,n,r,i);if(!c)continue;let l=Dv(c,t);l<o&&(o=l,a.length=0),l===o&&a.push(c)}return a}import.meta.require;function jv(e){let t=Object.create(null),n=(e,n)=>{let r=t[e];if(!r)return;let i=r.filter(e=>e!==n);i.length===0?delete t[e]:i.length!==r.length&&(t[e]=i)};return{hook(e,r){return t[e]=[...t[e]??[],r],()=>n(e,r)},has(e){return(t[e]?.length??0)>0},emit(n,...r){let i=t[n];if(i)for(let t of i)try{r.length===0?t():t(r[0])}catch(t){e(n,t)}}}}function Mv(){let e=[];return{get:()=>e,set:t=>{e=t},remove(t){e=e.filter(e=>e!==t)},has:()=>e.length>0,clear:()=>{e=[]}}}function Nv(){let e=Mv();return{append(t){return e.set([...e.get(),t]),()=>e.remove(t)},prepend(t){return e.set([t,...e.get()]),()=>e.remove(t)},values:e.get,has:e.has,clear:e.clear}}function Pv(){let e=Mv(),t=0;return{register(n,r){let i={...r,listener:n,order:t++};return e.set([...e.get(),i].sort((e,t)=>t.priority-e.priority||e.order-t.order)),()=>e.remove(i)},entries:e.get,has:e.has,clear:e.clear}}function Fv(e){return typeof e==`string`||!!e&&typeof e==`object`&&!Array.isArray(e)}function Iv(e){if(!Array.isArray(e))return{ok:!1,reason:`Invalid keymap bindings: expected an array of binding objects`};for(let[t,n]of e.entries()){if(!n||typeof n!=`object`||Array.isArray(n))return{ok:!1,reason:`Invalid keymap binding at index ${t}: expected a binding object`};if(!Fv(n.key))return{ok:!1,reason:`Invalid keymap binding at index ${t}: expected "key" to be a string or keystroke object`}}return{ok:!0}}function Lv(e){let t=Iv(e);if(!t.ok)throw Error(t.reason);return e.map(e=>({...e,key:typeof e.key==`string`?e.key:{...e.key}}))}function Rv(e){return{...e,sequence:iv(e.sequence)}}function zv(e,t){let n=Nv();return{prependLayerAnalyzer(e){return n.prepend(e)},appendLayerAnalyzer(e){return n.append(e)},clearLayerAnalyzers(){n.clear()},analyzeLayer(r){let i=n.values();if(i.length===0)return;let a=Bv(r.bindings),o={target:r.target,order:r.order,sourceBindings:r.sourceBindings,bindings:a,hasTokenBindings:r.hasTokenBindings,checkCommandResolution(e){return t.getCommandResolutionStatus(e,r.commands)},warn(t,n,r){e.emitWarning(t,n,r)},warnOnce(t,n,r,i){e.warnOnce(t,n,r,i)},error(t,n,r){e.emitError(t,n,r)}};for(let t of i)try{t(o)}catch(t){e.emitError(`layer-analyzer-error`,t,`[Keymap] Error in layer analyzer:`)}}}}function Bv(e){return e.map(t=>({sequence:iv(t.sequence),command:t.command,attrs:t.attrs,event:t.event,preventDefault:t.preventDefault,fallthrough:t.fallthrough,parsedBinding:Rv(t.parsedBinding),sourceTarget:t.sourceTarget,sourceLayerOrder:t.sourceLayerOrder,bindingIndex:t.bindingIndex,hasCommandAtSequence:e.some(e=>e.event===`press`&&e.command!==void 0&&Vv(e,t)),hasContinuations:e.some(e=>e.event===`press`&&Hv(t,e))}))}function Vv(e,t){return e.sequence.length===t.sequence.length&&e.sequence.every((e,n)=>e.match===t.sequence[n]?.match)}function Hv(e,t){return e.sequence.length<t.sequence.length&&e.sequence.every((e,n)=>e.match===t.sequence[n]?.match)}function Uv(){return{version:-1,notifyVersion:-1,focused:void 0,value:[],targets:new WeakMap}}function Wv(){return{plain:Uv(),bindings:Uv(),metadata:Uv(),bindingsAndMetadata:Uv()}}function Gv(e,t){if(t===void 0)return e.plain;let n=t.includeBindings===!0,r=t.includeMetadata===!0;return n?r?e.bindingsAndMetadata:e.bindings:r?e.metadata:e.plain}function Kv(e,t,n){let r=n?e.targets.get(n):e.nullTarget;return r?.version===t?r:void 0}function qv(e,t,n,r){let i={version:t,value:r};n?e.targets.set(n,i):e.nullTarget=i}function Jv(e,t){if(e===t)return!0;if(!e||!t||e.captures.length!==t.captures.length)return!1;for(let n=0;n<e.captures.length;n+=1){let r=e.captures[n],i=t.captures[n];if(!r||!i||r.layer!==i.layer||r.binding!==i.binding||r.index!==i.index||r.parts.length!==i.parts.length)return!1;for(let e=0;e<r.parts.length;e+=1)if(r.parts[e]?.match!==i.parts[e]?.match)return!1;let a=r.patterns??[],o=i.patterns??[];if(a.length!==o.length)return!1;for(let e=0;e<a.length;e+=1){let t=a[e],n=o[e];if(!t||!n||t.name!==n.name||t.values.length!==n.values.length)return!1;for(let e=0;e<t.values.length;e+=1)if(!Object.is(t.values[e],n.values[e]))return!1}}return!0}function Yv(e){let t=e.parts.at(-1);if(!t||e.parts.length<=1)return;let n=e.index-1,r=e.patterns;if(t.patternName){let i=r?.at(-1);i?.name===t.patternName&&(i.values.length>1?(n=e.index,r=[...(r??[]).slice(0,-1),{...i,values:i.values.slice(0,-1),parts:i.parts.slice(0,-1)}]):r=(r??[]).slice(0,-1))}return{layer:e.layer,binding:e.binding,index:n,parts:e.parts.slice(0,-1),patterns:r}}function Xv(e){let t=e.captures[0];if(!t||t.parts.length===0)return[];let n=[];for(let r=0;r<t.parts.length;r+=1){let i=t.parts[r];if(!i)continue;let a,o,s=!1,c=!1;for(let t of e.captures){let e=t.parts[r];if(e){if(a===void 0){a=e.display,o=e.tokenName;continue}!s&&a!==e.display&&(s=!0),!c&&o!==e.tokenName&&(c=!0)}}(a===void 0||s)&&(a=cv(i.stroke)),c&&(o=void 0),n.push(nv(i.stroke,{display:a,match:i.match,tokenName:o}))}return n}function Zv(e){if(e.isDestroyed)throw Error(`Cannot use a keymap after its host was destroyed`);return e}function Qv(e,t,n,r,i,a,o={}){let s=Wv(),c=-1,l=[],u=()=>Zv(t).getFocusedTarget(),d=()=>pv(t),f=t=>{let n=e.pending;Jv(n,t)||(e.pending=t,o.onPendingSequenceChanged?.(n,t),P(),r.queueStateChange())},p=()=>{let t=e.pending;if(!t)return;let n=u(),r=a.getActiveCommandView(n),o=t.captures.filter(t=>e.layers.has(t.layer)&&C(t.layer,n)&&i.matchesConditions(t.layer)&&te(t.binding,n,r)&&xv(t,e.patterns));if(o.length===0){f(null);return}return o.length!==t.captures.length&&f({captures:o}),e.pending??void 0},m=()=>{t.isDestroyed||!e.pending||p()},h=()=>!t.isDestroyed&&e.pending!==null,g=()=>{if(c===e.cacheVersion)return l;let t=p(),n=t?Xv(t):[];return(!t||T())&&(c=e.cacheVersion,l=n),n},_=()=>{let e=p();if(!e)return!1;let t=e.captures[0];if(!t||t.parts.length<=1)return f(null),!0;let n=[];for(let t of e.captures){let e=Yv(t);e&&n.push(e)}return n.length===0?(f(null),!0):(f({captures:n}),!0)},v=t=>{let n=t?.includeBindings===!0,r=t?.includeMetadata===!0,i=Gv(s,t);return i.notifyVersion===e.derivedVersion?i.value:y(i,n,r)},y=(n,r,i)=>{t.isDestroyed&&Zv(t);let o=u(),s=Kv(n,e.cacheVersion,o);if(s)return n.notifyVersion=e.derivedVersion,n.version=e.cacheVersion,n.focused=o,n.value=s.value,s.value;let c=a.getActiveCommandView(o),l=p(),d=l?[]:S(o),f=l?j(l.captures,r,i,o,c):re(d,r,i,o,c);return(l?T():w(d))&&(n.version=e.cacheVersion,n.notifyVersion=e.derivedVersion,n.focused=o,n.value=f,qv(n,e.cacheVersion,o,f)),f},b=(e,t)=>{let n=t?.includeBindings===!0,r=t?.includeMetadata===!0,i=u(),o=a.getActiveCommandView(i);return j(e,n,r,i,o)},x=(e,t)=>{let n=t?.includeBindings===!0,r=t?.includeMetadata===!0,i=e===d()?p():void 0,o=a.getActiveCommandView(e);return i?j(i.captures,n,r,e,o):re(S(e),n,r,e,o)},S=n=>e.activeLayersCacheVersion===e.cacheVersion&&e.activeLayersCacheFocused===n?e.activeLayersCache:(e.activeLayersCacheVersion=e.cacheVersion,e.activeLayersCacheFocused=n,e.activeLayersCache=gv(e.sortedLayers,t,n),e.activeLayersCache),C=(e,n)=>vv(t,e,n),w=t=>!e.commandResolvers.has()&&e.activeKeyCacheBlockers===0,T=()=>!e.commandResolvers.has()&&e.activeKeyCacheBlockers===0,ee=(e,t,n)=>{let r=[];for(let o of e)i.matchesConditions(o)&&a.isBindingVisible(o,t,n)&&r.push(o);return r},te=(e,t,n)=>i.matchesConditions(e)&&a.isBindingVisible(e,t,n),ne=(e,t)=>{let n,r,i=!1,a=!1;for(let o of e){let e=o.sequence[t];if(e){if(n===void 0){n=e.display,r=e.tokenName;continue}!i&&n!==e.display&&(i=!0),!a&&r!==e.tokenName&&(a=!0)}}if(n===void 0||i){let r=e[0]?.sequence[t]?.stroke;n=r?cv(r):``}return a&&(r=void 0),{display:n,tokenName:r}},E=(e,t,n)=>({sequence:e.sequence,command:e.command,commandAttrs:a.getBindingCommandAttrs(e,t,n),attrs:e.attrs,event:e.event,preventDefault:e.preventDefault,fallthrough:e.fallthrough}),D=(e,t,n)=>e.map(e=>E(e,t,n)),re=(e,t,n,r,a)=>{let o=new Map,s=new Set;for(let n of e)n.root.children.size===0&&n.root.patternChildren.length===0||!i.matchesConditions(n)||(O(n.root.children.values(),o,s,t,r,a),O(n.root.patternChildren,o,s,t,r,a));return oe(o,t,n,r,a)},O=(e,t,n,r,i,a)=>{for(let o of e){let e=o.match;if(!e||n.has(e)||!o.stroke)continue;let s=k(o,r,i,a);if(!s)continue;let c=t.get(e);c?M(c,s,r):t.set(e,ue(o.stroke,s,r)),s.stop&&n.add(e)}},k=(e,t,n,r)=>{if(!(e.children.size>0||e.patternChildren.length>0)){let i=le(A(e)?ee(e.bindings,n,r):e.bindings,n,r);if(!i)return;let a=ne(i.bindings,e.depth-1);return{display:a.display,tokenName:a.tokenName,continues:!1,firstBinding:i.bindings[0],commandBinding:i.commandBinding,bindings:t?[...i.bindings]:void 0,stop:i.stop}}let i=ee(e.reachableBindings,n,r);if(i.length===0)return;let a=le(e.bindings,n,r),o=ne(i,e.depth-1);return{display:o.display,tokenName:o.tokenName,continues:!0,firstBinding:a?.bindings[0],commandBinding:a?.commandBinding,bindings:t&&a?[...a.bindings]:void 0,stop:!0}},A=t=>{if(e.commandResolvers.has())return!0;for(let e of t.bindings)if(e.matchers.length>0)return!0;return!1},j=(t,n,r,i,a)=>{let o=new Map,s=new Set;return ie(Tv(t,e.patterns),o,s,n,i,a),oe(o,n,r,i,a)},ie=(e,t,n,r,i,a)=>{let o=new Set;for(let s of e)o.has(s.part.match)||(o.add(s.part.match),ae(s,e,t,n,r,i,a))},ae=(e,t,n,r,i,a,o)=>{let s=e.part.match;if(r.has(s))return;let c=se(e,t,i,a,o);if(!c)return;let l=n.get(s);l?M(l,c,i):n.set(s,ue(e.part.stroke,c,i)),c.stop&&r.add(s)},oe=(e,t,n,r,i)=>{let a=[];for(let o of e.values()){let e=N(o,t,n,r,i);e&&a.push(e)}return a},se=(e,t,n,r,i)=>{let a=t.filter(t=>t.part.match===e.part.match),o=a.filter(e=>e.exact).map(e=>e.binding),s=le(o,r,i),c=a.some(e=>e.continues);if(!c&&!s)return;let l=ce(a);return{display:l.display,tokenName:l.tokenName,continues:c,firstBinding:s?.bindings[0],commandBinding:s?.commandBinding,bindings:n&&s?[...s.bindings]:void 0,stop:c||s?.stop===!0}},ce=e=>{let t,n,r=!1,i=!1;for(let a of e){let e=a.part;if(t===void 0){t=e.display,n=e.tokenName;continue}!r&&t!==e.display&&(r=!0),!i&&n!==e.tokenName&&(i=!0)}let a=e[0]?.part;return(t===void 0||r)&&(t=a?cv(a.stroke):``),i&&(n=void 0),{display:t,tokenName:n}},le=(e,t,n)=>{let r=[],o;for(let s of e)if(!(!i.matchesConditions(s)||!a.isBindingVisible(s,t,n))&&(r.push(s),s.command!==void 0&&(o??=s,!s.fallthrough)))return{bindings:r,commandBinding:o,stop:!0};if(r.length!==0)return{bindings:r,commandBinding:o,stop:!1}},ue=(e,t,n)=>({stroke:e,display:t.display,tokenName:t.tokenName,continues:t.continues,firstBinding:t.firstBinding,commandBinding:t.commandBinding,bindings:n&&t.bindings?[...t.bindings]:void 0}),M=(e,t,n)=>{if(!e.firstBinding&&t.firstBinding&&(e.firstBinding=t.firstBinding),!e.commandBinding&&t.commandBinding&&(e.commandBinding=t.commandBinding),t.continues&&(e.continues=!0),!(!n||!t.bindings||t.bindings.length===0)){if(!e.bindings){e.bindings=[...t.bindings];return}e.bindings.push(...t.bindings)}},N=(e,t,n,r,i)=>{if(!e.commandBinding&&!e.continues)return;let o={stroke:tv(e.stroke),display:e.display,continues:e.continues};if(e.tokenName&&(o.tokenName=e.tokenName),e.commandBinding&&(o.command=e.commandBinding.command),t&&e.bindings&&e.bindings.length>0&&(o.bindings=e.bindings.length===1?[E(e.bindings[0],r,i)]:D(e.bindings,r,i)),n){e.firstBinding?.attrs&&(o.bindingAttrs=e.firstBinding.attrs);let t=e.commandBinding?a.getBindingCommandAttrs(e.commandBinding,r,i):void 0;t&&(o.commandAttrs=t)}return o},P=()=>{n.has(`pendingSequence`)&&n.emit(`pendingSequence`,e.pending?Xv(e.pending):[])};return{getFocusedTarget:u,getFocusedTargetIfAvailable:d,setPendingSequence:f,ensureValidPendingSequence:p,revalidatePendingSequenceIfNeeded:m,hasPendingSequenceState:h,getPendingSequence:g,popPendingSequence:_,getActiveKeys:v,getActiveKeysForCaptures:b,getActiveKeysForFocused:x,getActiveLayers:S,isLayerActiveForFocused:C,collectSequencePartsFromPending:Xv,collectMatchingBindings:ee,collectActiveBindings:D}}var $v=new Set([`name`,`run`,`fields`,`attrs`,`rejectedResult`]),ey=new Set([`key`,`cmd`,`event`,`preventDefault`,`fallthrough`]),ty=new Set([`target`,`targetMode`,`priority`,`bindings`,`commands`]);function ny(e){if(e===void 0||typeof e==`function`)return e;let t=e.trim();if(!t)throw Error(`Invalid keymap command: command cannot be empty`);return t}function ry(e){let t=e.trim();if(!t)throw Error(`Invalid keymap command name: name cannot be empty`);if(/\s/.test(t))throw Error(`Invalid keymap command name "${e}": command names cannot contain whitespace`);return t}function iy(e,t,n){let r=e.get(t);r?r.push(n):e.set(t,[n])}function ay(e){let t=[],n=new Map;for(let r of e.layers)for(let e of r.commands){let i={layer:r,commandState:e};t.push(i),iy(n,e.command.name,i)}return{entries:t,chainsByName:n}}function oy(e,t,n){let r=[],i=[],a=new Map,o=new Map;for(let s of e)if(s.commands.length!==0&&!(n&&!t.matchesConditions(s)))for(let e of s.commands){if(!t.matchesConditions(e))continue;let n={layer:s,commandState:e};r.push(n),iy(o,e.command.name,n),a.has(e.command.name)||(a.set(e.command.name,n),i.push(n))}return{layers:e,entries:r,reachable:i,reachableByName:a,chainsByName:o}}function sy(e,t,n,r){return(e.activeLayersCacheVersion!==e.cacheVersion||e.activeLayersCacheFocused!==r)&&(e.activeLayersCacheVersion=e.cacheVersion,e.activeLayersCacheFocused=r,e.activeLayersCache=gv(e.sortedLayers,t,r)),oy(e.activeLayersCache,n,!0)}function cy(e,t,n,r){if(Object.prototype.hasOwnProperty.call(e,t)&&!Object.is(e[t],n))throw Error(`Conflicting keymap requirement for "${t}" from ${r}`);e[t]=n}function ly(e,t,n,r){if(Object.prototype.hasOwnProperty.call(e,t)&&!Object.is(e[t],n))throw Error(`Conflicting keymap attribute for "${t}" from ${r}`);e[t]=n}function uy(e){let t=`field ${e.fieldName}`;return{require(n,r){cy(e.requirements,n,r,t)},attr(n,r){if(!e.attrs)throw Error(`Keymap ${t} cannot publish attrs`);ly(e.attrs,n,r,t)},activeWhen(n){e.matchers.push(e.conditions.buildRuntimeMatcher(n,t))}}}function dy(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function fy(e,t){return e instanceof Error&&e.message?e.message:t}function py(e){return!e||typeof e!=`object`&&typeof e!=`function`?!1:typeof e.then==`function`}function my(e,t){let n=t?.deep===!0,r=t?.freeze===!0,i=t?.preserveNonPlainObjects===!0;if(Array.isArray(e)){let i=n?e.map(e=>my(e,t)):[...e];return r?Object.freeze(i):i}if(e&&typeof e==`object`){if(i&&!dy(e))return e;let a={};for(let[r,i]of Object.entries(e))a[r]=n?my(i,t):i;return r?Object.freeze(a):a}return e}var hy=[`name`],gy=Object.freeze({}),_y=new WeakMap;function vy(e,t,n,r,i){let a=-1,o,s=-1,c,l,u=-1,d,f,p=-1,m,h=-1,g=new Map,_=t=>by({commands:t,commandFields:e.commandFields,conditions:r,onError:(e,t,r)=>{n.emitError(e,t,r)}}),v=t=>oe(()=>e.commandResolvers.prepend(t),t),y=t=>oe(()=>e.commandResolvers.append(t),t),b=()=>{e.commandResolvers.has()&&n.runWithStateChangeBatch(()=>{e.commandResolvers.clear(),i.onCommandResolversChanged(),n.queueStateChange()})},x=e=>fe(e).map(e=>yy(e.commandState)),S=e=>{let t=de(e),n=fe(e,t);if(n.length===0)return[];let r=n.map(e=>({entry:e,command:yy(e.commandState),commandAttrs:e.commandState.attrs,bindings:[]})),i=new Map;for(let[e,t]of r.entries()){let n=i.get(t.command.name);n?n.push(e):i.set(t.command.name,[e])}return i.size>0&&pe(r,i,t),r.map(e=>({command:e.command,bindings:e.bindings}))},C=t=>{if(t.visibility===`registered`&&u===e.derivedVersion&&d===t.commands&&f)return f;let n=new Map;for(let e of t.commands)n.has(e)||n.set(e,[]);return n.size===0?n:(me(n,de(t)),t.visibility===`registered`&&(u=e.derivedVersion,d=t.commands,f=n),n)},w=(e,t,n)=>{let r=O(t);if(n){let i=[],a=r.chainsByName.get(e);if(a)for(let e of a)i.push({target:e.layer.target,command:e.commandState.command,attrs:e.commandState.attrs,payload:n.payload});let o=ye(e,t,{mode:`active`,execution:n});return o.resolved&&i.push(o.resolved),{entries:i.length>0?i:void 0,hadError:o.hadError}}let i=[];for(let t of r.chainsByName.get(e)??[])i.push({target:t.layer.target,command:t.commandState.command,attrs:t.commandState.attrs});let a=ye(e,t,{mode:`active`});return a.resolved&&i.push(a.resolved),{entries:i.length>0?i:void 0,hadError:a.hadError}},T=t=>{if(h!==e.derivedVersion&&(h=e.derivedVersion,g=new Map),g.has(t))return g.get(t)??void 0;let n=ue(le(t));return g.set(t,n??null),n},ee=(e,t)=>ue(O(t).chainsByName.get(e)),te=(e,t)=>ye(e,null,{mode:`registered`,execution:t}),ne=(e,t,n)=>ye(e,t,{mode:`active`,execution:n}),E=(e,t)=>se(e,t)?.command,D=e=>ce(e)?.commandState.command,re=(e,n,i)=>{let a=k().chainsByName.get(e);if(!a||a.length===0)return;let o,s;for(let e of a){if(!vv(t,e.layer,n)){o??=e;continue}(!r.matchesConditions(e.layer)||!r.matchesConditions(e.commandState))&&(s??=e)}let c=s??o;if(c)return{reason:s?`disabled`:`inactive`,command:i?c.commandState.command:void 0}},O=n=>{if(s===e.derivedVersion&&c===n&&l)return l;let i=sy(e,t,r,n);return A()&&(s=e.derivedVersion,c=n,l=i),i},k=()=>a===e.derivedVersion&&o?o:(a=e.derivedVersion,o=ay(e),o),A=()=>e.activeCommandViewCacheBlockers===0,j=(e,t,n)=>e.command===void 0||e.run?!0:typeof e.command==`string`?n.reachableByName.has(e.command)?!0:M(e.command,t,`active`)!==void 0:!1,ie=(e,t,n)=>{if(typeof e.command!=`string`)return;let r=n.reachableByName.get(e.command);return r?r.commandState.attrs:M(e.command,t,`active`)?.attrs},ae=(e,n)=>{if(n?.some(t=>t.command.name===e)||k().chainsByName.has(e))return`resolved`;let r=ye(e,pv(t));return r.resolved||r.hadError?r.resolved?`resolved`:`error`:`unresolved`},oe=(t,r)=>n.runWithStateChangeBatch(()=>{let a=t();return i.onCommandResolversChanged(),n.queueStateChange(),()=>{n.runWithStateChangeBatch(()=>{a(),!e.commandResolvers.values().includes(r)&&(i.onCommandResolversChanged(),n.queueStateChange())})}}),se=(e,t)=>{let n=O(t).reachableByName.get(e);return n?{target:n.layer.target,command:n.commandState.command,attrs:n.commandState.attrs}:M(e,t,`active`)},ce=e=>le(e)?.[0],le=t=>{let n=[];for(let r of e.sortedLayers)for(let e of r.commands)e.command.name===t&&n.push({layer:r,commandState:e});return n.length>0?n:void 0},ue=e=>{if(e?.length)return e.map(e=>({target:e.layer.target,command:e.commandState.command,attrs:e.commandState.attrs}))},M=(e,t,n)=>ye(e,t,{mode:n}).resolved,N=()=>k().entries,P=()=>{if(p===e.derivedVersion&&m)return m;let t=new Map;for(let n of e.layers)for(let e of n.bindings){if(typeof e.command!=`string`)continue;let n=t.get(e.command);n?n.push(e):t.set(e.command,[e])}return p=e.derivedVersion,m=t,t},de=e=>{let n=e?.visibility??`reachable`,r=e&&Object.prototype.hasOwnProperty.call(e,`focused`)?e.focused??null:pv(t);return n===`registered`?{visibility:n,focused:r}:{visibility:n,focused:r,activeView:O(r)}},fe=(e,t=de(e))=>{let r;return r=t.visibility===`registered`?N():t.visibility===`active`?t.activeView?.entries??[]:t.activeView?.reachable??[],Ty({entries:r,query:e,getCommand:e=>yy(e),onFilterError:e=>{n.emitError(`command-query-filter-error`,e,`[Keymap] Error in command query filter:`)}})},pe=(e,t,n)=>{F(n,n=>{he(e,t,n)})},me=(e,t)=>{if(t.visibility===`registered`){let t=P();for(let[n,r]of e){let e=k().chainsByName.get(n)?.[0]?.commandState.attrs;for(let i of t.get(n)??[])r.push(_e(i,e))}return}F(t,n=>{ge(e,n,t)})},F=(t,n)=>{if(t.visibility===`registered`){for(let t of e.layers)for(let e of t.bindings)n(e);return}let i=t.activeView;if(i){for(let e of i.layers)if(!(e.bindings.length===0||!r.matchesConditions(e)))for(let a of e.bindings)r.matchesConditions(a)&&j(a,t.focused,i)&&n(a)}},he=(e,t,n)=>{if(typeof n.command!=`string`)return;let r=t.get(n.command);if(!(!r||r.length===0))for(let t of r){let r=e[t];r&&r.bindings.push(_e(n,r.commandAttrs))}},ge=(e,t,n)=>{if(typeof t.command!=`string`)return;let r=e.get(t.command);r&&r.push(_e(t,ve(t,n)))},_e=(e,t)=>({sequence:e.sequence,command:e.command,commandAttrs:t,attrs:e.attrs,event:e.event,preventDefault:e.preventDefault,fallthrough:e.fallthrough}),ve=(e,t)=>{if(typeof e.command!=`string`)return;if(t.visibility===`registered`)return k().chainsByName.get(e.command)?.[0]?.commandState.attrs;let n=t.activeView;if(n)return ie(e,t.focused,n)},ye=(t,r,i)=>{let a=i?.mode??`active`,o=i?.execution??{input:t},s=xy(t,e.commandResolvers.values(),()=>Se(r,a,o),e=>{n.emitError(`command-resolver-error`,e,`[Keymap] Error in command resolver for "${t}":`)}),c=s.resolved;if(c){let e=xe(c.command.name,r,a);e?.commandState.command===c.command&&c.target===void 0&&(c={...c,target:e.layer.target},s.resolved=c)}if(c&&!c.attrs){let e=be(c.command.name,r,a)??wy(c.command);e&&(s.resolved={...c,attrs:e})}return s},be=(e,t,n)=>n===`registered`?ce(e)?.commandState.attrs:O(t).reachableByName.get(e)?.commandState.attrs,xe=(e,t,n)=>n===`registered`?ce(e):O(t).reachableByName.get(e),Se=(e,t,n)=>{let r=n.input,i=n.payload;return{context:{get input(){return r},get payload(){return i},setInput(e){r=e},setPayload(e){i=e},getCommand:n=>t===`registered`?D(n):E(n,e)},getExecutionFields(){return{input:r,payload:i}}}};return{normalizeCommands:_,prependCommandResolver:v,appendCommandResolver:y,clearCommandResolvers:b,getCommands:x,getCommandEntries:S,getCommandBindings:C,getResolvedCommandChain:w,getRegisteredResolvedEntries:T,getActiveRegisteredResolvedEntries:ee,resolveRegisteredResolverFallback:te,resolveActiveResolverFallback:ne,getTopCommand:E,getDispatchUnavailableCommandState:re,getActiveCommandView:O,isBindingVisible:j,getBindingCommandAttrs:ie,getCommandResolutionStatus:ae}}function yy(e){return e.command}function by(e){let t=[],n=new Set;for(let r of e.commands)try{let i={},a=[],o=ry(r.name),s=Sy(r),c={};if(n.has(o)){e.onError(`duplicate-command`,{command:o},`Duplicate keymap command "${o}" in the same layer`);continue}r.name=o;for(let[t,n]of Object.entries(s)){if(n===void 0)continue;let r=e.commandFields.get(t);r&&r(n,uy({fieldName:t,conditions:e.conditions,requirements:i,matchers:a,attrs:c}))}let l={command:r,fields:s,attrs:Object.keys(c).length===0?void 0:c,requires:Object.entries(i),matchers:a};n.add(l.command.name),t.push(l)}catch(t){e.onError(`register-command-failed`,t,fy(t,`Failed to register keymap command "${String(r.name)}"`));continue}return t}function xy(e,t,n,r){if(t.length===0)return{hadError:!1};let i=!1;for(let a of t){let t,o=n();try{t=a(e,o.context)}catch(e){i=!0,r(e);continue}if(t)return{hadError:i,resolved:Cy(t,o.getExecutionFields())}}return{hadError:i}}function Sy(e){let t={};for(let[n,r]of Object.entries(e))!$v.has(n)&&r!==void 0&&(t[n]=r);return Object.keys(t).length===0?gy:t}function Cy(e,t){return{command:e,input:t.input,payload:t.payload}}function wy(e){let t=Sy(e);return t===gy?void 0:t}function Ty(e){let t=e.query?.namespace,n=Ey(e.query?.limit);if(n===0)return[];let r=e.query?.search?.trim().toLowerCase()??``,i=hy;e.query?.searchIn&&e.query.searchIn.length>0&&(i=e.query.searchIn);let a=e.query?.filter,o,s,c;if(typeof a==`function`)s=a;else if(a){let e=Object.entries(a),t=[];for(let[n,r]of e){if(n===`name`){if(typeof r==`string`){c=new Set([r]);continue}if(Array.isArray(r)){let e=new Set;for(let t of r)typeof t==`string`&&e.add(t);c=e;continue}}t.push([n,r])}o=t.length>0?t:void 0}let l=[];for(let a of e.entries){let u=a.commandState;if(Oy(u,t)&&Dy(u,r,i)&&!(c&&!c.has(u.command.name))&&ky(u,o,e)){if(s){let t=!1;try{t=s(e.getCommand(u))}catch(t){e.onFilterError(t);continue}if(!t)continue}if(l.push(a),n!==void 0&&l.length>=n)break}}return l}function Ey(e){if(e===void 0)return;let t=Math.floor(Number(e));return!Number.isFinite(t)||t<=0?0:t}function Dy(e,t,n){if(!t)return!0;for(let r of n)if(Ay(e,r,t))return!0;return!1}function Oy(e,t){if(t===void 0)return!0;let n=e.fields;return Object.prototype.hasOwnProperty.call(n,`namespace`)?Ly(n.namespace,t):!1}function ky(e,t,n){if(!t)return!0;for(let[r,i]of t)if(!Py(e,r,i,n))return!1;return!0}function Ay(e,t,n){return jy(e,t)?.includes(n)===!0}function jy(e,t){let n=_y.get(e);if(n||(n=new Map,_y.set(e,n)),n.has(t))return n.get(t);let r=e.fields,i=e.attrs,a;t===`name`?a=e.command.name:Object.prototype.hasOwnProperty.call(r,t)?a=r[t]:i&&Object.prototype.hasOwnProperty.call(i,t)&&(a=i[t]);let o=My(a);return n.set(t,o),o}function My(e){if(Array.isArray(e)){let t=[];for(let n of e){let e=My(n);e!==void 0&&t.push(e)}return t.length>0?t.join(`\0`):void 0}if(typeof e==`string`)return e.toLowerCase();if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return String(e).toLowerCase()}function Ny(e,t,n,r){try{return e(t,n)}catch(e){return r(e),!1}}function Py(e,t,n,r){return typeof n==`function`?Fy(e,t,n,r):Iy(e,t,n)}function Fy(e,t,n,r){let i=e.command,a=e.fields,o=e.attrs,s,c=!1,l=()=>s??=r.getCommand(e);return t===`name`&&(c=!0,Ny(n,i.name,l(),r.onFilterError))||Object.prototype.hasOwnProperty.call(a,t)&&(c=!0,Ny(n,a[t],l(),r.onFilterError))||o&&Object.prototype.hasOwnProperty.call(o,t)&&(c=!0,Ny(n,o[t],l(),r.onFilterError))?!0:!c&&Ny(n,void 0,l(),r.onFilterError)}function Iy(e,t,n){let r=e.command,i=e.fields,a=e.attrs;return t===`name`&&Ly(r.name,n)||Object.prototype.hasOwnProperty.call(i,t)&&Ly(i[t],n)?!0:!!a&&Object.prototype.hasOwnProperty.call(a,t)&&Ly(a[t],n)}function Ly(e,t){return Array.isArray(t)?t.some(t=>Ry(e,t)):Ry(e,t)}function Ry(e,t){return Array.isArray(e)?e.some(e=>Ry(e,t)):Object.is(e,t)}function zy(e,t,n,r,i){let a=(e,t,n,r,a,o)=>({keymap:i.keymap,event:e,focused:t,target:n,data:r,input:a,payload:o}),o=(t,n,r,i)=>{let a=typeof n==`function`?void 0:n,o=typeof n==`function`?n:n.run,s=i?a:void 0,c;try{c=o(a?{...r,command:a}:r)}catch(n){return e.emitError(`command-execution-error`,n,`[Keymap] Error running command "${t}":`),{status:`error`,result:s?{ok:!1,reason:`error`,command:s}:{ok:!1,reason:`error`}}}if(py(c))return c.catch(n=>{e.emitError(`async-command-error`,n,`[Keymap] Async error in command "${t}":`)}),{status:`handled`,result:s?{ok:!0,command:s}:{ok:!0}};if(By(c)){let e=c;return(!c.ok&&c.reason!==`not-found`&&i&&a&&!c.command||c.ok&&i&&a&&!c.command)&&(e={...c,command:a}),{status:c.ok?`handled`:`rejected`,result:e}}return c===!1?{status:`rejected`,result:s?{ok:!1,reason:`rejected`,command:s}:{ok:!1,reason:`rejected`}}:{status:`handled`,result:s?{ok:!0,command:s}:{ok:!0}}},s=(e,t,n,r,i,s,c,l)=>{let u;for(let d of t??[]){let t=o(e,d.command,a(n,r,i??d.target??null,s,e,c),l);if(t.status===`handled`||t.status===`error`)return[t.result,u];u=t.result}return[void 0,u]},c=(e,c,l)=>{let u;try{u=ny(e)}catch{return{ok:!1,reason:`invalid-args`}}if(typeof u!=`string`)return{ok:!1,reason:`not-found`};let d=c?.includeCommand===!0,f=c?.focused??n.getFocusedTargetIfAvailable(),p=c?.event??i.createCommandEvent(),m=t.getReadonlyData(),h=c?.payload,g=l===`registered`?r.getRegisteredResolvedEntries(u):r.getActiveRegisteredResolvedEntries(u,f),[_,v]=s(u,g,p,f,c?.target,m,h,d);if(_)return _;let y=v,b=l===`registered`?r.resolveRegisteredResolverFallback(u,{input:u,payload:h}):r.resolveActiveResolverFallback(u,f,{input:u,payload:h});if(b.resolved){let e=o(u,b.resolved.command,a(p,f,c?.target??b.resolved.target??null,m,b.resolved.input??u,b.resolved.payload),d);if(e.status===`handled`||e.status===`error`)return e.result;y=e.result}if(b.hadError)return{ok:!1,reason:`error`};if(l===`active`){let e=r.getDispatchUnavailableCommandState(u,f,d);if(e)return e.command?{ok:!1,reason:e.reason,command:e.command}:{ok:!1,reason:e.reason}}return y??{ok:!1,reason:`not-found`}};return{runCommand(e,t){return c(e,t,`registered`)},dispatchCommand(e,t){return c(e,t,`active`)},runBinding(e,n,i,s,c){let l=t.getReadonlyData();if(n.run)return o(typeof n.command==`string`?n.command:`<function>`,n.run,a(i,s,e.target??null,l,typeof n.command==`string`?n.command:`<function>`,c),!1).status!==`rejected`&&(Vy(n,i),!0);if(typeof n.command!=`string`)return!1;let u=r.getResolvedCommandChain(n.command,s,c===void 0?void 0:{input:n.command,payload:c}).entries;for(let t of u??[])if(o(n.command,t.command,a(i,s,t.target??e.target??null,l,t.input??n.command,t.payload),!1).status!==`rejected`)return Vy(n,i),!0;return!1}}}function By(e){return typeof e==`object`&&!!e&&`ok`in e}function Vy(e,t){e.preventDefault&&(t.preventDefault(),t.stopPropagation())}var Hy=Object.freeze({}),Uy=[],Wy=[];function Gy(e){if(Object.keys(e).length!==0)return my(e,{freeze:!0})}function Ky(e,t,n,r){let i=t=>Qy(t,e.bindingParsers.values(),{tokens:e.tokens,patterns:e.patterns,layer:Hy,parseObjectKey:(e,t)=>c(e,t)}),a=t=>{if(typeof t!=`string`)return[c(t)];let n=Zy(t,e.bindingParsers.values(),{tokens:e.tokens,patterns:e.patterns,layer:Hy,parseObjectKey:(e,t)=>c(e,t)});for(let e of n.unknownTokens)r.warnUnknownToken(e,t);return n.unknownTokens.length>0?[]:n.parts},o=(e,t)=>lv(a(e),t),s=(i,a,o,s,d)=>{let f=[],p=!1,m=e.bindingExpanders.values(),h=e.bindingParsers.values(),g=e.bindingFields,_=e.disambiguationResolvers.has(),v=r.warnUnknownField,y=r.warnUnknownToken;for(let[r,b]of i.entries()){let i;try{i=Yy(b.key,m,{layer:d})}catch(e){t.emitError(`binding-expand-error`,e,fy(e,`Failed to expand keymap binding`));continue}for(let m of i){let i=m.key,x;try{x=typeof i==`string`?Zy(i,h,{tokens:a,patterns:e.patterns,layer:d,parseObjectKey:(e,t)=>c(e,t)}):{parts:[c(i)],usedTokens:[],unknownTokens:[],hasTokenBindings:!1},x=Xy(x,m)}catch(e){t.emitError(`binding-parse-error`,e,fy(e,`Failed to parse keymap binding`));continue}let S=x.parts;p||=x.hasTokenBindings;for(let e of x.unknownTokens)y(e,typeof i==`string`?i:String(i.name));if(!(x.unknownTokens.length>0))for(let i of u(b,S,a,h,d))try{let t=l(i.event),a=i.sequence,c={},u={},d=[];for(let e in i){if(e===`sequence`||ey.has(e))continue;let t=i[e];if(t===void 0)continue;let r=g.get(e);if(!r){v(`binding`,e);continue}r(t,uy({fieldName:e,conditions:n,requirements:c,matchers:d,attrs:u}))}let p=Object.keys(u).length>0?Gy(u):void 0,m=ny(i.cmd),h={binding:b,sequence:a,command:m,event:t,parsedBinding:Rv(i),sourceTarget:o,sourceLayerOrder:s,bindingIndex:r,requires:Object.keys(c).length>0?Object.entries(c):Uy,matchers:d.length>0?d:Wy,preventDefault:i.preventDefault!==!1,fallthrough:i.fallthrough??!1};if(p&&(h.attrs=p),typeof m==`function`&&(h.run=m),a.length===0)continue;if(t===`release`&&a.length>1)throw Error(`Keymap release bindings only support a single key stroke`);let y=a.at(-1);if(y?.patternName){let t=e.patterns.get(y.patternName);if(t&&t.max!==t.min)throw Error(`Keymap unbounded sequence patterns must be followed by a concrete continuation`)}t===`press`&&!_&&Jy(f,h),f.push(h)}catch(e){t.emitError(`binding-compile-error`,e,fy(e,`Failed to compile keymap binding`))}}}return{bindings:f,hasTokenBindings:p}},c=(e,t)=>nv(e,t),l=e=>{if(e===void 0||e===`press`)return`press`;if(e===`release`)return`release`;throw Error(`Invalid keymap binding event "${String(e)}": expected "press" or "release"`)},u=(n,r,i,a,o)=>{let s=e.bindingTransformers.values();if(s.length===0)return[{...n,sequence:iv(r)}];let l={...n,sequence:iv(r)},u=[],d=!0,f=o??Hy;for(let n of s)try{n(l,{layer:f,parseKey:t=>Qy(t,a,{tokens:i,patterns:e.patterns,layer:f,parseObjectKey:(e,t)=>c(e,t)}),add:e=>{u.push(Rv(e))},skipOriginal:()=>{d=!1}})}catch(e){t.emitError(`binding-transformer-error`,e,`[Keymap] Error in binding transformer:`)}return d?u.length===0?[l]:[l,...u]:u};return{parseTokenKey:i,parseKeySequence:a,formatKey:o,compileBindings:s}}function qy(e,t){if(e.length>=t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]?.match!==t[n]?.match)return!1;return!0}function Jy(e,t){for(let n of e)if(n.event===`press`&&(n.command!==void 0&&qy(n.sequence,t.sequence)||t.command!==void 0&&qy(t.sequence,n.sequence)))throw Error(`Keymap bindings cannot use the same sequence as both an exact match and a prefix in the same layer`)}function Yy(e,t,n){if(typeof e!=`string`||t.length===0)return[{key:e}];let r=n?.layer??Hy,i=[{key:e}];for(let e of t){let t=[];for(let n of i){let i=e({input:n.key,displays:n.displays,layer:r});if(!i){t.push(n);continue}if(i.length===0)throw Error(`Keymap binding expander must return at least one key sequence for "${n.key}"`);for(let e of i){if(!e||typeof e!=`object`||Array.isArray(e)||typeof e.key!=`string`)throw Error(`Keymap binding expander must return expansion objects with string keys for "${n.key}"`);if(e.displays!==void 0){if(!Array.isArray(e.displays))throw Error(`Keymap binding expander displays must be an array of strings for "${n.key}"`);for(let t of e.displays)if(typeof t!=`string`)throw Error(`Keymap binding expander displays must be an array of strings for "${n.key}"`)}t.push(e)}}i=t}return i}function Xy(e,t){if(!t.displays)return e;if(t.displays.length!==e.parts.length)throw Error(`Keymap binding expansion displays length must match parsed sequence length for "${String(t.key)}"`);return{...e,parts:e.parts.map((e,n)=>({...e,display:t.displays[n]}))}}function Zy(e,t,n){if(e.length===0)throw Error(`Invalid key sequence: sequence cannot be empty`);if(t.length===0)throw Error(`No keymap binding parsers are registered`);let r=n.tokens??new Map,i=n.patterns??new Map,a=n.layer??Hy,o=n.parseObjectKey,s=[],c=new Set,l=new Set,u=0;for(;u<e.length;){let n=!1;for(let d of t){let t=d({input:e,index:u,layer:a,tokens:r,patterns:i,normalizeTokenName:Q_,createMatch:sv,parseObjectKey:o});if(t){if(t.nextIndex<=u||t.nextIndex>e.length)throw Error(`Keymap binding parser must advance the input for "${e}" at index ${u}`);s.push(...t.parts);for(let e of t.usedTokens??[])c.add(e);for(let e of t.unknownTokens??[])l.add(e);u=t.nextIndex,n=!0;break}}if(!n)throw Error(`No keymap binding parser handled input at index ${u} in "${e}"`)}return{parts:s,usedTokens:[...c],unknownTokens:[...l],hasTokenBindings:c.size>0||l.size>0}}function Qy(e,t,n){if(typeof e!=`string`)return n.parseObjectKey(e);let{parts:r}=Zy(e,t,n),[i]=r;if(!i||r.length!==1)throw Error(`Invalid key "${String(e)}": expected a single key stroke`);return i}function $y(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.get==`function`&&typeof t.subscribe==`function`}function eb(e,t){let n=e=>e.requires.length===0&&e.matchers.length===0,r=e=>{try{return e.match()}catch(n){return t.emitError(`runtime-matcher-error`,n,`[Keymap] Error evaluating runtime matcher from ${e.source}:`),!1}},i=e=>{if(e.matchers.length===0)return!0;if(e.matchers.length===1){let[t]=e.matchers;return!t||r(t)}for(let t of e.matchers)if(!r(t))return!1;return!0},a=t=>{if(t.length===0)return!0;for(let[n,r]of t)if(!Object.is(e.data[n],r))return!1;return!0};return{buildRuntimeMatcher(e,t){if(typeof e==`function`)return{source:t,match:e};if($y(e))return{source:t,match:()=>e.get(),subscribe:t=>e.subscribe(t)};throw Error(`Keymap ${t} expected a function or a reactive matcher`)},matchesConditions:e=>n(e)||a(e.requires)&&i(e)}}var tb=Symbol(`keymap-disambiguation-decision`),nb=Symbol(`keymap-deferred-disambiguation-decision`);function rb(e,t){return{[tb]:!0,action:e,handler:t}}function ib(e){return{[nb]:!0,action:e}}function ab(e){return!!e&&typeof e==`object`&&e[tb]===!0}function ob(e){return!!e&&typeof e==`object`&&e[nb]===!0}function sb(e,t){return t.aborted?Promise.resolve(!1):new Promise(n=>{let r=setTimeout(()=>{t.removeEventListener(`abort`,i),n(!0)},Math.max(0,e)),i=()=>{clearTimeout(r),t.removeEventListener(`abort`,i),n(!1)};t.addEventListener(`abort`,i,{once:!0})})}function cb(e,t,n,r){let i=e.get(n);if(i)try{return i.matcher(r)}catch(e){t.emitError(`sequence-pattern-match-error`,e,`[Keymap] Error matching sequence pattern "${i.name}":`);return}}function lb(e,t,n,r){let i=e.get(n)?.payloadKey??n;return{...nv({name:t.name,ctrl:t.ctrl,shift:t.shift,meta:t.meta,super:t.super??!1,hyper:t.hyper||void 0},{display:r.display??String(r.value??t.name)}),patternName:n,payloadKey:i}}function ub(e,t,n){if(!n?.patterns||n.patterns.length===0)return;let r={},i=!1;for(let a of n.patterns){let n=e.get(a.name),o;try{o=n?.finalize?n.finalize(a.values):a.values.length===1?a.values[0]:[...a.values]}catch(e){t.emitError(`sequence-pattern-finalize-error`,e,`[Keymap] Error finalizing sequence pattern "${a.name}":`);continue}let s=r[a.payloadKey];s===void 0?(r[a.payloadKey]=o,i=!0):Array.isArray(s)?s.push(o):r[a.payloadKey]=[s,o]}return i?r:void 0}function db(e,t,n,r,i,a,o,s,c,l){let u={resolveKey:e=>o.parseTokenKey(e).match},d=null,f=0;function p(t,n,r){if(t===`key`){let t=r;return e.keyHooks.register(n,{priority:t?.priority??0,release:t?.release??!1})}if(t===`key:after`){let t=r;return e.keyAfterHooks.register(n,{priority:t?.priority??0,release:t?.release??!1})}let i=r;return e.rawHooks.register(n,{priority:i?.priority??0})}function m(t){return e.eventMatchResolvers.prepend(t)}function h(t){return e.eventMatchResolvers.append(t)}function g(){e.eventMatchResolvers.clear()}function _(t){return ae(()=>e.disambiguationResolvers.prepend(t),t)}function v(t){return ae(()=>e.disambiguationResolvers.append(t),t)}function y(){e.disambiguationResolvers.has()&&t.runWithStateChangeBatch(()=>{e.disambiguationResolvers.clear(),c.recompileBindings()})}function b(e,t){d&&_e()}function x(n){let r=e.rawHooks.entries();if(r.length===0)return!1;let i=!1,a={sequence:n,stop(){i=!0}};for(let e of r){try{e.listener(a)}catch(e){t.emitError(`raw-intercept-error`,e,`[Keymap] Error in raw intercept listener:`)}if(i)return!0}return!1}function S(e,t){return{sequence:iv(e.sequence),command:e.command,commandAttrs:s.getBindingCommandAttrs(e,t,s.getActiveCommandView(t)),attrs:e.attrs,event:e.event,preventDefault:e.preventDefault,fallthrough:e.fallthrough,sourceLayerOrder:e.sourceLayerOrder,bindingIndex:e.bindingIndex}}function C(e){l.has(`dispatch`)&&l.emit(`dispatch`,e)}function w(e,t,n,r){l.has(`dispatch`)&&C({phase:e,event:n.event,focused:r,layer:{order:t.order,priority:t.priority,target:t.target,targetMode:t.targetMode},binding:S(n,r),sequence:iv(n.sequence),command:n.command})}function T(e,t,n){if(!l.has(`dispatch`))return;let i=t[0],a=t.length>0?r.collectSequencePartsFromPending({captures:t}):[];C({phase:e,event:`press`,focused:n,layer:i?{order:i.layer.order,priority:i.layer.priority,target:i.layer.target,targetMode:i.layer.targetMode}:void 0,sequence:a})}function ee(t){let n=e.keyAfterHooks.entries();for(let e of n)if(e.release===t)return n}function te(e){return e.sequence?iv(e.sequence):e.captures?r.collectSequencePartsFromPending({captures:e.captures}):[]}function ne(e,t){return{handled:e!==`sequence-miss`,reason:e,captures:t}}function E(e,t){return{handled:t,reason:t?`binding-handled`:`binding-rejected`,sequence:e.sequence}}function D(e,t){return t.handled||e.reason===`no-match`?t:e}function re(e,i,a,o,s){let c={event:i,eventType:a?`release`:`press`,focused:o,handled:s.handled,reason:s.reason,sequence:te(s),pendingSequence:r.getPendingSequence(),setData:(e,t)=>{n.setData(e,t)},getData:e=>n.getData(e),consume:e=>{let t=e?.preventDefault??!0,n=e?.stopPropagation??!0;t&&i.preventDefault(),n&&i.stopPropagation()}};for(let n of e)if(n.release===a)try{n.listener(c)}catch(e){t.emitError(`key-after-intercept-error`,e,`[Keymap] Error in key:after intercept listener:`)}}function O(){return{handled:!1,reason:`no-match`}}function k(e){e.preventDefault(),e.stopPropagation()}function A(e,t,n,i){r.setPendingSequence({captures:t});let a=ne(`sequence-pending`,t);return T(e,t,n),k(i),a}function j(e,t,n,i){let a=ne(e,t);return T(`sequence-clear`,t,n),r.setPendingSequence(null),k(i),a}function ie(i,a){a||_e();let o=ee(a),s=o?r.getFocusedTarget():null,c=e.keyHooks.entries(),l={event:i,setData:(e,t)=>{n.setData(e,t)},getData:e=>n.getData(e),consume:e=>{let t=e?.preventDefault??!0,n=e?.stopPropagation??!0;t&&i.preventDefault(),n&&i.stopPropagation()}};for(let e of c)if(e.release===a){try{e.listener(l)}catch(e){t.emitError(`key-intercept-error`,e,`[Keymap] Error in key intercept listener:`)}if(i.propagationStopped){o&&re(o,i,a,s,{handled:!0,reason:`intercept-consumed`,sequence:[]});return}}if(a){let e=oe(i);o&&re(o,i,a,s,e);return}let u=se(i);o&&re(o,i,a,s,u)}function ae(n,r){return t.runWithStateChangeBatch(()=>{let i=e.disambiguationResolvers.has(),a=n();return!i&&e.disambiguationResolvers.has()&&c.recompileBindings(),()=>{t.runWithStateChangeBatch(()=>{let t=e.disambiguationResolvers.has();a(),!e.disambiguationResolvers.values().includes(r)&&t&&!e.disambiguationResolvers.has()&&c.recompileBindings()})}})}function oe(e){let t=r.getFocusedTarget(),n=r.getActiveLayers(t),a=Ce(e),o=O();for(let r of a)layerLoop:for(let a of n){if(a.bindings.length===0||!i.matchesConditions(a))continue;let n=we(a,r,e,t);if(o=D(o,n.outcome),n.handled){if(n.stop)return o;continue layerLoop}}return o}function se(e){let t=r.getFocusedTarget(),n=r.ensureValidPendingSequence(),i=Ce(e);if(n)return ce(n,i,e,t);let a=r.getActiveLayers(t),o=O();for(let n of i){let r=ue(a,[n],e,t);if(o=D(o,r),r.handled)return o}return o}function ce(t,n,i,a){let o=s.getActiveCommandView(a),c=[];for(let r of t.captures){let t=kv(r,n,i,e.patterns,Te,I);t&&c.push(t)}let l=c.reduce((e,t)=>Math.min(e,Dv(t,n)),1/0),u=c.filter(e=>Dv(e,n)===l);if(u.length===0||!u.some(e=>ke(e,a,o))){let e=ne(`sequence-miss`,t.captures);return T(`sequence-clear`,t.captures,a),r.setPendingSequence(null),e}return le(u,0,!1,i,a)}function le(t,n,i,a,o){let s=i,c=O(),l=new Set;for(let i=n;i<t.length;i+=1){let n=t[i];if(!n||l.has(n))continue;let u=xe(t,i,n);if(u.length>0){if(s)continue;let e=Se(t,n);return P(t,i,u,e,a,o,s)||A(`sequence-advance`,u,o,a)}if(!Sv(n,e.patterns))continue;let d=Se(t,n);for(let e of d)l.add(e);let f=Ae(n.layer,d,a,o);if(c=D(c,f.outcome),f.handled&&(s=!0,f.stop))return T(`sequence-clear`,t,o),r.setPendingSequence(null),c}return T(`sequence-clear`,t,o),r.setPendingSequence(null),c}function ue(e,t,n,r){return M(e,0,t,n,r)}function M(t,n,r,a,o){let c=s.getActiveCommandView(o),l=O();for(let s=n;s<t.length;s+=1){let n=t[s];if(!n||!i.matchesConditions(n))continue;let u=Ee(n,r,a,o,c);if(u.length===0)continue;if(u.filter(t=>xv(t,e.patterns,!1)).length>0){let n=u.filter(t=>Sv(t,e.patterns)),i=be(t,s,r,a,o);return N(t,s,r,i,n,a,o)||A(`sequence-start`,i,o,a)}let d=Ae(n,u.filter(t=>Sv(t,e.patterns)),a,o);if(l=D(l,d.outcome),d.handled&&d.stop)return l}return l}function N(e,t,n,i,a,o,s){return de({event:o,focused:s,continuationCaptures:i,exactBindingsSource:a.map(e=>e.binding),sequencePhase:`sequence-start`,runExact:()=>{r.setPendingSequence(null);let i=a[0]?.layer;if(!i)return O();let c=Ae(i,a,o,s);return c.stop?c.outcome:D(c.outcome,M(e,t+1,n,o,s))}})}function P(e,t,n,i,a,o,s){return de({event:a,focused:o,continuationCaptures:n,exactBindingsSource:i.map(e=>e.binding),sequencePhase:`sequence-advance`,runExact:()=>{r.setPendingSequence(null);let n=i[0]?.layer;if(!n)return O();let c=Ae(n,i,a,o);return c.stop?c.outcome:D(c.outcome,le(e,t+1,s||c.handled,a,o))}})}function de(t){let{event:n,focused:i,continuationCaptures:a,exactBindingsSource:o,sequencePhase:c,runExact:l}=t;if(!e.disambiguationResolvers.has()||a.length===0)return;let u=s.getActiveCommandView(i),d=r.collectMatchingBindings(o,i,u);if(!d.some(e=>e.command!==void 0))return;let f=()=>A(c,a,i,n),p=()=>j(`sequence-cleared`,a,i,n),m,h=()=>(m??=r.collectSequencePartsFromPending({captures:a}),m),g=pe({event:n,focused:i,getSequence:h,exactBindings:d,continuationCaptures:a,activeView:u});return g?fe(g,a,l,f,p,i,h):(ye(h()),f())}function fe(e,t,n,r,i,a,o){if(e.action===`run-exact`)return n();if(e.action===`continue-sequence`)return r();if(e.action===`clear`)return i();let s=r();return me(t,e.handler,a,o(),e=>{if(e){if(e.action===`run-exact`){n();return}if(e.action===`continue-sequence`){r();return}i()}}),s}function pe(i){let a,o,s,c,l={event:i.event,focused:i.focused,get sequence(){return a??=iv(i.getSequence()),a},get stroke(){let e=i.getSequence().at(-1);if(!e)throw Error(`Disambiguation context expected a non-empty sequence`);return c??={...e,stroke:tv(e.stroke)},c},get exact(){return o??=r.collectActiveBindings(i.exactBindings,i.focused,i.activeView).map(e=>({...e,sequence:iv(e.sequence)})),o},get continuations(){return s??=r.getActiveKeysForCaptures(i.continuationCaptures,{includeBindings:!0,includeMetadata:!0}),s},getData:e=>n.getData(e),setData:(e,t)=>{n.setData(e,t)},runExact:()=>rb(`run-exact`),continueSequence:()=>rb(`continue-sequence`),clear:()=>rb(`clear`),defer:e=>rb(`defer`,e)};for(let n of e.disambiguationResolvers.values()){let e;try{e=n(l)}catch(e){t.emitError(`disambiguation-resolver-error`,e,`[Keymap] Error in disambiguation resolver:`);continue}if(e!==void 0){if(py(e)){t.emitError(`invalid-disambiguation-resolver-return`,e,`[Keymap] Disambiguation resolvers must return synchronously; use ctx.defer(...) for async handling`);continue}if(!ab(e)){t.emitError(`invalid-disambiguation-decision`,e,`[Keymap] Invalid disambiguation decision returned by resolver:`);continue}return e}}}function me(e,t,n,r,i){_e();let a=new AbortController,o={id:f++,controller:a,captures:e,apply:i};d=o,queueMicrotask(()=>{F(o,t,n,r)})}function F(e,n,r,i){if(!ve(e))return;let a={signal:e.controller.signal,sequence:iv(i),focused:r,sleep:t=>sb(t,e.controller.signal),runExact:()=>ib(`run-exact`),continueSequence:()=>ib(`continue-sequence`),clear:()=>ib(`clear`)},o;try{o=n(a)}catch(n){ve(e)&&(t.emitError(`deferred-disambiguation-error`,n,`[Keymap] Error in deferred disambiguation handler:`),ge(e));return}if(py(o)){o.then(t=>{he(e,t)}).catch(n=>{ve(e)&&(t.emitError(`deferred-disambiguation-error`,n,`[Keymap] Error in deferred disambiguation handler:`),ge(e))});return}he(e,o)}function he(e,n){if(ve(e)){if(n!==void 0&&!ob(n)){t.emitError(`invalid-deferred-disambiguation-decision`,n,`[Keymap] Invalid deferred disambiguation decision returned by handler:`),ge(e);return}ge(e),e.apply(n)}}function ge(e){ve(e)&&(d=null)}function _e(){let e=d;e&&(d=null,e.controller.abort())}function ve(e){return d===e}function ye(e){let n=lv(e,{preferDisplay:!0});t.warnOnce(`unresolved-disambiguation:${n}`,`unresolved-disambiguation`,{sequence:n},`[Keymap] Ambiguous exact/prefix sequence "${n}" fell back to prefix handling because no disambiguation resolver resolved it`)}function be(t,n,r,a,o){let c=[],l=s.getActiveCommandView(o);for(let s=n;s<t.length;s+=1){let n=t[s];if(n&&i.matchesConditions(n))for(let t of Ee(n,r,a,o,l))xv(t,e.patterns,!1)&&c.push(t)}return c}function xe(t,n,r){return t.filter((t,i)=>i>=n&&xv(t,e.patterns,!1)&&pb(t.parts,r.parts))}function Se(t,n){return t.filter(t=>t.layer===n.layer&&Sv(t,e.patterns)&&pb(t.parts,n.parts))}function Ce(n){let r=e.eventMatchResolvers.values();if(r.length===0)return[];if(r.length===1)return fb(r[0],n,u,t);let i=[],a=new Set;for(let e of r){let r;try{r=e(n,u)}catch(e){t.emitError(`event-match-resolver-error`,e,`[Keymap] Error in event match resolver:`);continue}if(!(!r||r.length===0))for(let e of r){if(typeof e!=`string`){t.emitError(`invalid-event-match-resolver-candidate`,e,`[Keymap] Invalid event match resolver candidate:`);continue}a.has(e)||(a.add(e),i.push(e))}}return i}function we(e,t,n,r){let o=!1,s=O();for(let c of e.bindings){if(c.event!==`release`)continue;let l=c.sequence[0];if(!l||l.match!==t||!i.matchesConditions(c))continue;let u=a.runBinding(e,c,n,r);if(s=D(s,E(c,u)),!u){w(`binding-reject`,e,c,r);continue}if(w(`binding-execute`,e,c,r),o=!0,!c.fallthrough)return{handled:!0,stop:!0,outcome:s}}return{handled:o,stop:!1,outcome:s}}function Te(n,r){return cb(e.patterns,t,n,r)}function I(t,n,r){return lb(e.patterns,t,n,r)}function Ee(e,t,n,r,i){let a=Av(e,t,n,Te,I);return a.some(e=>ke(e,r,i))?a:[]}function De(n){return ub(e.patterns,t,n)}function Oe(e,t,n){return i.matchesConditions(e)&&s.isBindingVisible(e,t,n)}function ke(e,t,n){return Oe(e.binding,t,n)}function Ae(e,t,n,r){let o=!1,s=O();for(let c of t){let t=c.binding;if(!i.matchesConditions(t))continue;let l=a.runBinding(e,t,n,r,De(c));if(s=D(s,E(t,l)),!l){w(`binding-reject`,e,t,r);continue}if(w(`binding-execute`,e,t,r),o=!0,!t.fallthrough)return{handled:!0,stop:!0,outcome:s}}return{handled:o,stop:!1,outcome:s}}return{intercept:p,prependEventMatchResolver:m,appendEventMatchResolver:h,clearEventMatchResolvers:g,prependDisambiguationResolver:_,appendDisambiguationResolver:v,clearDisambiguationResolvers:y,handlePendingSequenceChange:b,handleRawSequence:x,handleKeyEvent:ie}}function fb(e,t,n,r){let i;try{i=e(t,n)}catch(e){return r.emitError(`event-match-resolver-error`,e,`[Keymap] Error in event match resolver:`),[]}if(!i||i.length===0)return[];if(i.length===1){let[e]=i;return typeof e==`string`?[e]:(r.emitError(`invalid-event-match-resolver-candidate`,e,`[Keymap] Invalid event match resolver candidate:`),[])}let a=[],o=new Set;for(let e of i){if(typeof e!=`string`){r.emitError(`invalid-event-match-resolver-candidate`,e,`[Keymap] Invalid event match resolver candidate:`);continue}o.has(e)||(o.add(e),a.push(e))}return a}function pb(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]?.match!==t[n]?.match)return!1;return!0}var mb=()=>{};function hb(e,t,n,r){if(n===void 0)return r;if(typeof n!=`number`||!Number.isInteger(n)||n<0)throw Error(`Keymap sequence pattern "${e}" ${t} must be a non-negative integer`);return n}function gb(e,t){let{kind:n,reservedFields:r,registeredFields:i,emitError:a}=t,o=Object.entries(e),s=[];for(let[e,t]of o){if(r.has(e)){a(`reserved-${n}-field`,{field:e,kind:n},`Keymap ${n} field "${e}" is reserved`);continue}if(i.has(e)){a(`duplicate-${n}-field`,{field:e,kind:n},`Keymap ${n} field "${e}" is already registered`);continue}i.set(e,t),s.push([e,t])}return()=>{for(let[e,t]of s)i.get(e)===t&&i.delete(e)}}function _b(e,t,n,r,i){let a;try{a=Q_(i.name)}catch(e){return t.emitError(`token-name-normalize-error`,e,fy(e,`Failed to register keymap token`)),mb}if(e.tokens.has(a)||e.patterns.has(a))return t.emitError(`duplicate-token`,{token:a},`Keymap token "${a}" is already registered`),mb;let o;try{if(o=n.parseTokenKey(i.key),o.patternName)throw Error(`Invalid key "${String(i.key)}": expected a concrete key stroke`)}catch(e){return t.emitError(`token-parse-error`,e,fy(e,`Failed to register keymap token "${a}"`)),mb}let s={stroke:o.stroke,match:o.match},c=new Map(e.tokens);c.set(a,s);try{r.applyTokenState(c)}catch(e){return t.emitError(`token-register-error`,e,fy(e,`Failed to register keymap token "${a}"`)),mb}return()=>{if(e.tokens.get(a)!==s)return;let n=new Map(e.tokens);n.delete(a);try{r.applyTokenState(n)}catch(e){t.emitError(`token-unregister-error`,e,fy(e,`Failed to unregister keymap token "${a}"`))}}}function vb(e,t,n,r){let i,a;try{i=Q_(r.name);let e=hb(i,`min`,r.min,1),t=hb(i,`max`,r.max,2**53-1);if(t<e)throw Error(`Keymap sequence pattern "${i}" max must be greater than or equal to min`);a={name:i,display:r.display,payloadKey:r.payloadKey??i,match:sv(`pattern:${i}`),min:e,max:t,matcher:e=>r.match(e),finalize:r.finalize}}catch(e){return t.emitError(`sequence-pattern-register-error`,e,fy(e,`Failed to register keymap sequence pattern`)),mb}return e.tokens.has(i)||e.patterns.has(i)?(t.emitError(`duplicate-sequence-pattern`,{pattern:i},`Keymap sequence pattern "${i}" is already registered`),mb):(e.patterns.set(i,a),n.recompileBindings(),()=>{e.patterns.get(i)===a&&(e.patterns.delete(i),n.recompileBindings())})}function yb(e,t,n,r){return gb(r,{kind:n,reservedFields:n===`layer`?ty:n===`binding`?ey:$v,registeredFields:n===`layer`?e.layerFields:n===`binding`?e.bindingFields:e.commandFields,emitError:(e,n,r)=>t.emitError(e,n,r)})}var bb=()=>{};function xb(e,t){return t.priority-e.priority||t.order-e.order}function Sb(e){if(e.matchers.length>0)return!0;for(let t of e.commands)if(t.matchers.length>0)return!0;for(let t of e.bindings)if(t.matchers.length>0)return!0;return!1}function Cb(e){if(e.commands.length===0)return!1;if(e.matchers.length>0)return!0;for(let t of e.commands)if(t.matchers.length>0)return!0;return!1}function wb(e,t,n,r,i){let a=n=>t.runWithStateChangeBatch(()=>{let a=n.target;if(a&&i.host.isTargetDestroyed(a))return t.emitError(`destroyed-layer-target`,{target:a},`Cannot register a keymap layer for a destroyed keymap target`),bb;let o,s,c,p,m,v,y;try{y=l(n),o=u(Lv(n.bindings??[]),n);let e=d(n.commands??[],n);v=e.length===0?[]:i.commands.normalizeCommands(e),{requires:s,matchers:c,fields:p,attrs:m}=f(n)}catch(e){return t.emitError(`register-layer-failed`,e,fy(e,`Failed to register keymap layer`)),bb}let b=e.order++,x=i.compiler.compileBindings(o,e.tokens,a,b,p);if(x.bindings.length===0&&!x.hasTokenBindings&&v.length===0)return bb;i.diagnostics?.analyzeLayer({target:a,order:b,commands:v,sourceBindings:o,bindings:x.bindings,hasTokenBindings:x.hasTokenBindings});let S={order:b,target:a,targetMode:y,priority:n.priority??0,requires:s,matchers:c,fields:p,attrs:m,commands:v,sourceBindings:o,bindings:x.bindings,root:wv(x.bindings,e.patterns),hasTokenBindings:x.hasTokenBindings,activeKeyCacheBlocked:!1,activeCommandViewCacheBlocked:!1};_(S),e.layers.add(S),e.sortedLayers=[...e.sortedLayers,S].sort(xb),g(S);for(let e of S.commands)g(e);for(let e of S.bindings)g(e);return a&&(S.offTargetDestroy=i.host.onTargetDestroy(a,()=>{h(S)})),S.commands.length>0&&r.ensureValidPendingSequence(),t.queueStateChange(),()=>{h(S)}}),o=n=>{t.runWithStateChangeBatch(()=>{let i=new Map;for(let t of e.layers)t.hasTokenBindings&&i.set(t,p(t,n));e.tokens=n;let a=!1;for(let[e,t]of i)m(e,t)&&(a=!0);a&&r.setPendingSequence(null),i.size>0&&t.queueStateChange()})},s=()=>{t.runWithStateChangeBatch(()=>{let n=0,i=!1;for(let t of e.layers){if(t.sourceBindings.length===0)continue;let r=p(t,e.tokens);m(t,r)&&(i=!0),n+=1}i&&r.setPendingSequence(null),n>0&&t.queueStateChange()})},c=()=>{for(let t of e.layers){y(t);for(let e of t.commands)y(e);for(let e of t.bindings)y(e);t.offTargetDestroy?.(),t.offTargetDestroy=void 0}},l=e=>{if(e.targetMode){if(!e.target)throw Error(`Keymap targetMode "${e.targetMode}" requires a target`);return e.targetMode}return e.target?`focus-within`:void 0},u=(t,n)=>{let r=e.layerBindingsTransformers.values();if(r.length===0)return t;let i=t;for(let e of r){let t=e(i,{layer:n,validateBindings:e=>Iv(e)});t&&(i=Lv(t))}return i},d=(n,r)=>{let i=e.commandTransformers.values();if(n.length===0||i.length===0)return n;let a=[];for(let e of n){let n={...e},o=[],s=!0;for(let e of i)try{e(n,{layer:r,add(e){o.push({...e})},skipOriginal(){s=!1}})}catch(e){t.emitError(`command-transformer-error`,e,`[Keymap] Error in command transformer:`)}s&&a.push(n),a.push(...o)}return a},f=t=>{let r={},a=[],o=Object.create(null),s={};for(let[c,l]of Object.entries(t)){if(ty.has(c)||l===void 0)continue;o[c]=my(l);let t=e.layerFields.get(c);if(!t){i.warnUnknownField(`layer`,c);continue}t(l,uy({fieldName:c,conditions:n,requirements:r,matchers:a,attrs:s}))}return{requires:Object.entries(r),matchers:a,fields:Object.keys(o).length>0?Object.freeze(o):void 0,attrs:Object.keys(s).length>0?my(s,{freeze:!0}):void 0}},p=(e,t)=>i.compiler.compileBindings(e.sourceBindings,t,e.target,e.order,e.fields),m=(t,n)=>{i.diagnostics?.analyzeLayer({target:t.target,order:t.order,commands:t.commands,sourceBindings:t.sourceBindings,bindings:n.bindings,hasTokenBindings:n.hasTokenBindings}),v(t);for(let e of t.bindings)y(e);t.bindings=n.bindings,t.root=wv(n.bindings,e.patterns),t.hasTokenBindings=n.hasTokenBindings,_(t);for(let e of t.bindings)g(e);return e.pending?.captures.some(e=>e.layer===t)??!1},h=n=>{t.runWithStateChangeBatch(()=>{if(e.layers.delete(n)){e.sortedLayers=e.sortedLayers.filter(e=>e!==n),v(n),y(n);for(let e of n.commands)y(e);for(let e of n.bindings)y(e);n.offTargetDestroy?.(),n.offTargetDestroy=void 0,e.pending?.captures.some(e=>e.layer===n)?r.setPendingSequence(null):n.commands.length>0&&!i.host.isDestroyed&&r.ensureValidPendingSequence(),t.queueStateChange()}})},g=e=>{for(let n of e.matchers)if(n.subscribe)try{n.dispose=n.subscribe(()=>{if(!r.hasPendingSequenceState()){t.queueStateChange();return}t.runWithStateChangeBatch(()=>{r.revalidatePendingSequenceIfNeeded(),t.queueStateChange()})})}catch(e){t.emitError(`reactive-matcher-subscribe-error`,e,fy(e,`Failed to subscribe to reactive matcher from ${n.source}`))}},_=t=>{let n=Sb(t),r=Cb(t);t.activeKeyCacheBlocked=n,t.activeCommandViewCacheBlocked=r,n&&(e.activeKeyCacheBlockers+=1),r&&(e.activeCommandViewCacheBlockers+=1)},v=t=>{t.activeKeyCacheBlocked&&=(--e.activeKeyCacheBlockers,!1),t.activeCommandViewCacheBlocked&&=(--e.activeCommandViewCacheBlockers,!1)},y=e=>{for(let n of e.matchers)if(n.dispose){try{n.dispose()}catch(e){t.emitError(`reactive-matcher-dispose-error`,e,fy(e,`Failed to dispose reactive matcher from ${n.source}`))}n.dispose=void 0}};return{registerLayer:a,applyTokenState:o,recompileBindings:s,cleanup:c}}var Tb=1e3;function Eb(e,t,n){let r=(e,n,r)=>{if(!t.has(`warning`)){let t=`[${e}] ${r}`;n instanceof Error?console.warn(t,n):console.warn(t);return}t.emit(`warning`,{code:e,message:r,warning:n})},i=(e,n,r)=>{if(!t.has(`error`)){let t=`[${e}] ${r}`;n instanceof Error?console.error(t,n):console.error(t);return}t.emit(`error`,{code:e,message:r,error:n})},a=()=>{if(!(!e.stateChangePending||e.stateChangeDepth>0||e.flushingStateChange)){e.flushingStateChange=!0;try{let t=0;for(;e.stateChangePending&&e.stateChangeDepth===0;){if(t>=Tb){e.stateChangePending=!1,i(`state-change-feedback-loop`,{iterations:Tb},`[Keymap] Possible infinite state listener feedback loop detected after ${Tb} iterations; pending state notifications were dropped`);break}t+=1,e.stateChangePending=!1,n.emit(`state`)}}finally{e.flushingStateChange=!1}}};return{runWithStateChangeBatch(t){e.stateChangeDepth+=1;try{return t()}finally{--e.stateChangeDepth,e.stateChangeDepth===0&&a()}},queueStateChange(t){e.derivedVersion+=1,t?.invalidateCaches!==!1&&(e.cacheVersion+=1),n.has(`state`)&&(e.stateChangePending=!0,e.stateChangeDepth===0&&!e.flushingStateChange&&a())},emitWarning:r,emitError:i,reportListenerError(e,t){if(e===`state`){i(`state-listener-error`,t,`[Keymap] Error in state listener:`);return}if(e===`pendingSequence`){i(`pending-sequence-listener-error`,t,`[Keymap] Error in pending sequence listener:`);return}e===`dispatch`&&i(`dispatch-listener-error`,t,`[Keymap] Error in dispatch listener:`)},warnOnce(t,n,i,a){e.usedWarningKeys.has(t)||(e.usedWarningKeys.add(t),r(n,i,a))}}}function Db(e,t,n){return{getData(t){return e.data[t]},setData(r,i){t.runWithStateChangeBatch(()=>{if(i===void 0){if(!(r in e.data))return;delete e.data[r],e.dataVersion+=1,n.ensureValidPendingSequence(),t.queueStateChange();return}Object.is(e.data[r],i)||(e.data[r]=i,e.dataVersion+=1,n.ensureValidPendingSequence(),t.queueStateChange())})},getReadonlyData(){return e.readonlyDataVersion===e.dataVersion?e.readonlyData:(e.readonlyData=Object.freeze({...e.data}),e.readonlyDataVersion=e.dataVersion,e.readonlyData)}}}var Ob=Object.freeze({});function kb(){return{order:0,tokens:new Map,patterns:new Map,layerFields:new Map,layerBindingsTransformers:Nv(),bindingExpanders:Nv(),bindingParsers:Nv(),bindingTransformers:Nv(),bindingFields:new Map,commandTransformers:Nv(),commandFields:new Map,eventMatchResolvers:Nv(),disambiguationResolvers:Nv(),keyHooks:Pv(),keyAfterHooks:Pv(),rawHooks:Pv(),layers:new Set,sortedLayers:[],activeLayersCacheVersion:-1,activeLayersCacheFocused:void 0,activeLayersCache:[],activeKeyCacheBlockers:0,activeCommandViewCacheBlockers:0,commandResolvers:Nv(),pending:null,data:{},dataVersion:0,readonlyDataVersion:-1,readonlyData:Ob,cacheVersion:0,derivedVersion:0,stateChangeDepth:0,stateChangePending:!1,flushingStateChange:!1,usedWarningKeys:new Set}}function Ab(e){return av(e)}var jb=class{#e=kb();#t=!1;#n=new Map;#r=[];#i=jv(()=>{});#a;#o;#s;#c;#l;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y;#b;getPendingSequence;getActiveKeys;constructor(e){if(this.#b=e,e.isDestroyed)throw Error(`Cannot create a keymap for a destroyed host`);this.#a=jv((e,t)=>{this.#o.reportListenerError(e,t)}),this.#o=Eb(this.#e,this.#i,this.#a),this.#l=eb(this.#e,this.#o),this.#u=vy(this.#e,this.#b,this.#o,this.#l,{onCommandResolversChanged:()=>{this.#s.ensureValidPendingSequence()}}),this.#s=Qv(this.#e,this.#b,this.#a,this.#o,this.#l,this.#u,{onPendingSequenceChanged:(e,t)=>{this.#p?.handlePendingSequenceChange(e,t)}}),this.#c=Db(this.#e,this.#o,this.#s),this.#d=zy(this.#o,this.#c,this.#s,this.#u,{keymap:this,createCommandEvent:()=>this.#b.createCommandEvent()}),this.#f=Ky(this.#e,this.#o,this.#l,{warnUnknownField:(e,t)=>{this.#C(e,t)},warnUnknownToken:(e,t)=>{this.#w(e,t)}}),this.#h=zv(this.#o,this.#u),this.#m=wb(this.#e,this.#o,this.#l,this.#s,{compiler:this.#f,commands:this.#u,host:this.#b,diagnostics:this.#h,warnUnknownField:(e,t)=>{this.#C(e,t)}}),this.#p=db(this.#e,this.#o,this.#c,this.#s,this.#l,this.#d,this.#f,this.#u,this.#m,this.#a),this.getPendingSequence=this.#s.getPendingSequence,this.getActiveKeys=this.#s.getActiveKeys,this.#g=e=>{this.#p.handleKeyEvent(e,!1)},this.#_=e=>{this.#p.handleKeyEvent(e,!0)},this.#v=e=>this.#p.handleRawSequence(e),this.#y=e=>{this.#S(e)},this.#r.push(this.#b.onKeyPress(this.#g)),this.#r.push(this.#b.onKeyRelease(this.#_)),this.#b.onRawInput&&this.#r.push(this.#b.onRawInput(this.#v)),this.#r.push(this.#b.onFocusChange(this.#y)),this.#b.onDestroy&&this.#r.push(this.#b.onDestroy(()=>{this.#x()}))}[fv](){return{state:this.#e,host:this.#b,conditions:this.#l,catalog:this.#u,activation:this.#s}}#x(){if(!this.#t){this.#t=!0,this.#s.setPendingSequence(null);for(let e of this.#n.values())e.dispose();this.#n.clear(),this.#m.cleanup();for(let e of this.#r.splice(0))e()}}setData(e,t){this.#c.setData(e,t)}getData(e){return this.#c.getData(e)}getHostMetadata(){return this.#b.metadata}hasPendingSequence(){return this.#s.ensureValidPendingSequence()!==void 0}createKeyMatcher(e){let t=this.#f.parseTokenKey(e).match;return e=>e?Ab(e)===t:!1}parseKeySequence(e){return this.#f.parseKeySequence(e)}formatKey(e,t){return this.#f.formatKey(e,t)}clearPendingSequence(){this.#s.setPendingSequence(null)}popPendingSequence(){return this.#s.popPendingSequence()}getCommands(e){return this.#u.getCommands(e)}getCommandEntries(e){return this.#u.getCommandEntries(e)}getCommandBindings(e){return this.#u.getCommandBindings(e)}acquireResource(e,t){if(this.#t||this.#b.isDestroyed)throw Error(`Cannot use a keymap after its host was destroyed`);let n=this.#n.get(e);if(n)return n.count+=1,()=>{this.#T(e,n)};let r={count:1,dispose:t()};return this.#n.set(e,r),()=>{this.#T(e,r)}}runCommand(e,t){return this.#d.runCommand(e,t)}dispatchCommand(e,t){return this.#d.dispatchCommand(e,t)}on(e,t){return e===`warning`||e===`error`?this.#i.hook(e,t):this.#a.hook(e,t)}intercept(e,t,n){return this.#p.intercept(e,t,n)}registerLayer(e){return this.#m.registerLayer(e)}registerLayerFields(e){return yb(this.#e,this.#o,`layer`,e)}prependLayerBindingsTransformer(e){return this.#e.layerBindingsTransformers.prepend(e)}appendLayerBindingsTransformer(e){return this.#e.layerBindingsTransformers.append(e)}clearLayerBindingsTransformers(){this.#e.layerBindingsTransformers.clear()}prependBindingTransformer(e){return this.#e.bindingTransformers.prepend(e)}appendBindingTransformer(e){return this.#e.bindingTransformers.append(e)}clearBindingTransformers(){this.#e.bindingTransformers.clear()}prependCommandTransformer(e){return this.#e.commandTransformers.prepend(e)}appendCommandTransformer(e){return this.#e.commandTransformers.append(e)}clearCommandTransformers(){this.#e.commandTransformers.clear()}prependBindingParser(e){return this.#e.bindingParsers.prepend(e)}appendBindingParser(e){return this.#e.bindingParsers.append(e)}clearBindingParsers(){this.#e.bindingParsers.clear()}registerToken(e){return _b(this.#e,this.#o,this.#f,this.#m,e)}registerSequencePattern(e){return vb(this.#e,this.#o,this.#m,e)}prependBindingExpander(e){return this.#e.bindingExpanders.prepend(e)}appendBindingExpander(e){return this.#e.bindingExpanders.append(e)}clearBindingExpanders(){this.#e.bindingExpanders.clear()}registerBindingFields(e){return yb(this.#e,this.#o,`binding`,e)}registerCommandFields(e){return yb(this.#e,this.#o,`command`,e)}prependCommandResolver(e){return this.#u.prependCommandResolver(e)}appendCommandResolver(e){return this.#u.appendCommandResolver(e)}clearCommandResolvers(){this.#u.clearCommandResolvers()}prependLayerAnalyzer(e){return this.#h.prependLayerAnalyzer(e)}appendLayerAnalyzer(e){return this.#h.appendLayerAnalyzer(e)}clearLayerAnalyzers(){this.#h.clearLayerAnalyzers()}prependEventMatchResolver(e){return this.#p.prependEventMatchResolver(e)}appendEventMatchResolver(e){return this.#p.appendEventMatchResolver(e)}clearEventMatchResolvers(){this.#p.clearEventMatchResolvers()}prependDisambiguationResolver(e){return this.#p.prependDisambiguationResolver(e)}appendDisambiguationResolver(e){return this.#p.appendDisambiguationResolver(e)}clearDisambiguationResolvers(){this.#p.clearDisambiguationResolvers()}#S(e){this.#o.runWithStateChangeBatch(()=>{this.#s.setPendingSequence(null),this.#o.queueStateChange({invalidateCaches:!1})})}#C(e,t){this.#o.warnOnce(`${e}:${t}`,`unknown-${e}-field`,{field:t,kind:e},`[Keymap] Unknown ${e} field "${t}" was ignored`)}#w(e,t){this.#o.warnOnce(`token:${e}`,`unknown-token`,{token:e,sequence:t},`[Keymap] Unknown token "${e}" in key sequence "${t}"; binding was skipped until the token is registered`)}#T(e,t){this.#n.get(e)===t&&(--t.count,!(t.count>0)&&(t.dispose(),this.#n.delete(e)))}},Mb=new Set(`up.down.left.right.clear.escape.return.linefeed.enter.tab.backspace.delete.insert.home.end.pageup.pagedown.space.lt.gt.plus.minus.equal.comma.period.slash.backslash.semicolon.quote.backquote.leftbracket.rightbracket.capslock.numlock.scrolllock.printscreen.pause.menu.apps.kp0.kp1.kp2.kp3.kp4.kp5.kp6.kp7.kp8.kp9.kpdecimal.kpdivide.kpmultiply.kpminus.kpplus.kpenter.kpequal.kpseparator.kpleft.kpright.kpup.kpdown.kppageup.kppagedown.kphome.kpend.kpinsert.kpdelete.mediaplay.mediapause.mediaplaypause.mediareverse.mediastop.mediafastforward.mediarewind.medianext.mediaprev.mediarecord.volumedown.volumeup.mute.leftshift.leftctrl.leftalt.leftsuper.lefthyper.leftmeta.rightshift.rightctrl.rightalt.rightsuper.righthyper.rightmeta.iso_level3_shift.iso_level5_shift.option.alt.meta.super.hyper.control.ctrl.shift`.split(`.`)),Nb=new Set([`ctrl`,`control`,`shift`,`meta`,`alt`,`option`,`super`,`hyper`]),Pb=Ib(Mb),Fb=Ib(Nb);function Ib(e){let t=new Map;for(let n of e){let e=n.charCodeAt(0);if(Number.isNaN(e))continue;let r=t.get(e);r||(r=[],t.set(e,r)),r.push(n)}for(let e of t.values())e.sort((e,t)=>t.length-e.length);return t}function Lb(e){return e>=65&&e<=90?e+32:e}function Rb(e){return e>=48&&e<=57}function zb(e,t,n){if(e.startsWith(t,n))return!0;if(n+t.length>e.length)return!1;for(let r=0;r<t.length;r+=1)if(Lb(e.charCodeAt(n+r))!==t.charCodeAt(r))return!1;return!0}function Bb(e,t,n){let r=t.charCodeAt(n);if(Number.isNaN(r))return;let i=e.get(Lb(r));if(i){for(let e of i)if(zb(t,e,n))return e}}function Vb(e,t,n,r,i){return e.parseObjectKey(t,{display:n,match:r,tokenName:i})}function Hb(e,t){if(e===` `)return t.parseObjectKey({name:`space`},{display:`space`});if(e===`+`)return t.parseObjectKey({name:`+`},{display:`+`});let n=e.split(`+`),r=``,i=``,a=!1,o=!1,s=!1,c=!1,l=!1;for(let t of n){let n=t.trim();if(!n)continue;let u=n.toLowerCase();if(u===`ctrl`||u===`control`){a=!0;continue}if(u===`shift`){o=!0;continue}if(u===`meta`||u===`alt`||u===`option`){s=!0;continue}if(u===`super`){c=!0;continue}if(u===`hyper`){l=!0;continue}if(r)throw Error(`Invalid key "${e}": multiple key names are not supported`);r=n,i=u}if(!r)throw Error(`Invalid key "${e}": missing key name`);let u=[];return a&&u.push(`ctrl`),o&&u.push(`shift`),s&&u.push(`meta`),c&&u.push(`super`),l&&u.push(`hyper`),u.push(i),t.parseObjectKey({name:r,ctrl:a,shift:o,meta:s,super:c,hyper:l||void 0},{display:u.join(`+`)})}function Ub(e,t){let n=e.trim().toLowerCase();return t.parseObjectKey({name:n},{display:n})}function Wb(e,t){let n=Bb(Pb,e,t);if(n)return n;if(Lb(e.charCodeAt(t))!==102||!Rb(e.charCodeAt(t+1)))return;let r=Rb(e.charCodeAt(t+2))?t+3:t+2;return e.slice(t,r).toLowerCase()}function Gb(e,t){return Bb(Fb,e,t)}function Kb(e,t,n){let r=t,i=!1,a=!1,o=!1,s=!1,c=!1;for(;r<e.length;){let t=Gb(e,r);if(!t)break;let n=r+t.length;if(e[n]!==`+`)break;t===`ctrl`||t===`control`?i=!0:t===`shift`?a=!0:t===`meta`||t===`alt`||t===`option`?o=!0:t===`super`?s=!0:t===`hyper`&&(c=!0),r=n+1}if(r===t)return;let l=e[r];if(l===void 0)throw Error(`Invalid key "${e.slice(t)}": missing key name`);let u=Wb(e,r)??l,d=u===` `?`space`:u===`+`?`+`:u.toLowerCase(),f=[];return i&&f.push(`ctrl`),a&&f.push(`shift`),o&&f.push(`meta`),s&&f.push(`super`),c&&f.push(`hyper`),f.push(d),{part:n.parseObjectKey({name:u===` `?`space`:u,ctrl:i,shift:a,meta:o,super:s,hyper:c||void 0},{display:f.join(`+`)}),nextIndex:r+u.length}}var qb=e=>{let{input:t,index:n,tokens:r,normalizeTokenName:i}=e;if(n===0&&t.includes(`+`)&&/\s/.test(t))return{parts:[Hb(t,e)],nextIndex:t.length};let a=t[n];if(a===void 0)return;if(a===`<`){let o=t.indexOf(`>`,n);if(o===-1)return{parts:[Hb(a,e)],nextIndex:n+1};let s=i(t.slice(n+1,o)),c=r.get(s);return c?{parts:[Vb(e,c.stroke,`<${s}>`,c.match,s)],nextIndex:o+1,usedTokens:[s]}:{parts:[],nextIndex:o+1,unknownTokens:[s]}}if(a===`{`){let r=t.indexOf(`}`,n);if(r===-1)return{parts:[Hb(a,e)],nextIndex:n+1};let o=i(t.slice(n+1,r)),s=e.patterns.get(o);return s?{parts:[{...e.parseObjectKey({name:o,ctrl:!1,shift:!1,meta:!1,super:!1},{display:s.display??`{${o}}`,match:s.match}),patternName:s.name,payloadKey:s.payloadKey}],nextIndex:r+1,usedTokens:[o]}:{parts:[],nextIndex:r+1,unknownTokens:[o]}}let o=Kb(t,n,e);if(o)return{parts:[o.part],nextIndex:o.nextIndex};let s=Wb(t,n);return s?{parts:[Ub(s,e)],nextIndex:n+s.length}:{parts:[Hb(a,e)],nextIndex:n+1}},Jb=(e,t)=>[t.resolveKey({name:e.name,ctrl:e.ctrl,shift:e.shift,meta:e.meta,super:e.super??!1,hyper:e.hyper||void 0})];function Yb(e){return e.appendBindingParser(e=>qb(e))}function Xb(e){return e.appendEventMatchResolver((e,t)=>Jb(e,t))}function Zb(e){let t=Yb(e),n=Xb(e);return()=>{n(),t()}}var Qb=Symbol(`keymap:mod-bindings`),$b=/(^|[+,\s])mod(?=\s*\+)/i,ex=/(^|[+,\s])mod(?=\s*\+)/gi;function tx(e){let t=e.primaryModifier;return(t===`ctrl`||t===`super`)&&e.modifiers[t]!==`unsupported`?t:e.modifiers.ctrl===`unsupported`?`super`:`ctrl`}function nx(e){if(e.includes(`,`))return[e];let t=e.trim();return t.includes(` `)?t.split(/\s+/):[e]}function rx(e){return e.acquireResource(Qb,()=>e.appendBindingExpander(({input:t,displays:n})=>{if(!$b.test(t))return;let r=tx(e.getHostMetadata());return[{key:t.replace(ex,(e,t)=>`${t}${r}`),displays:n??nx(t)}]}))}var ix=new Map([[` `,`space`],[`Spacebar`,`space`],[`ArrowUp`,`up`],[`ArrowDown`,`down`],[`ArrowLeft`,`left`],[`ArrowRight`,`right`],[`Escape`,`escape`],[`Esc`,`escape`],[`Enter`,`return`],[`Backspace`,`backspace`],[`Delete`,`delete`],[`Tab`,`tab`],[`Home`,`home`],[`End`,`end`],[`PageUp`,`pageup`],[`PageDown`,`pagedown`],[`Insert`,`insert`],[`CapsLock`,`capslock`],[`NumLock`,`numlock`],[`ScrollLock`,`scrolllock`],[`ContextMenu`,`menu`],[`Meta`,`super`],[`OS`,`super`],[`Alt`,`alt`],[`Control`,`control`],[`Shift`,`shift`]]);function ax(e){let t=e?.trim().toLowerCase();return t?t.includes(`mac`)||t.includes(`darwin`)?`macos`:t.includes(`win`)?`windows`:t.includes(`linux`)||t.includes(`x11`)?`linux`:`unknown`:`unknown`}function ox(){let e=globalThis.navigator,t=e?.userAgentData?.platform,n=ax(t);return n===`unknown`?ax(e?.platform??e?.userAgent):n}function sx(){let e=ox();return{platform:e,primaryModifier:e===`macos`?`super`:e===`unknown`?`unknown`:`ctrl`,modifiers:{ctrl:`supported`,shift:`supported`,meta:`supported`,super:`supported`,hyper:`unsupported`}}}function cx(e){return e.length===1&&!/^[a-z0-9]$/i.test(e)}function lx(e){let t={name:e.name,ctrl:e.ctrl,shift:e.shift,meta:e.meta,super:e.super??!1,hyper:e.hyper||void 0};return!t.shift||!cx(t.name)?[t]:[t,{...t,shift:!1}]}var ux=class{name;ctrl;shift;meta;superKey;originalEvent;propagationStopped=!1;constructor(e,t,n,r,i,a){this.name=e,this.ctrl=t,this.shift=n,this.meta=r,this.superKey=i,this.originalEvent=a}get super(){return this.superKey}preventDefault(){this.originalEvent?.preventDefault()}stopPropagation(){this.propagationStopped=!0,this.originalEvent?.stopPropagation()}};function dx(){return globalThis.MutationObserver}function fx(e){return ix.get(e)||(/^F\d{1,2}$/i.test(e)||e.length===1?e.toLowerCase():e.trim().toLowerCase().replace(/\s+/g,``))}function px(e){if(!e)return new ux(`command`,!1,!1,!1,!1);let t=globalThis.KeyboardEvent;return new ux(fx(e.key),e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,t&&e instanceof t?e:void 0)}var mx=class{metadata=sx();rootTarget;isDestroyed=!1;observer;targetDestroyListeners=new Map;constructor(e){this.rootTarget=e}getFocusedTarget(){let e=this.rootTarget.ownerDocument.activeElement;return!e||typeof e!=`object`?null:e===this.rootTarget||this.rootTarget.contains(e)?e:null}getParentTarget(e){return e.parentElement}isTargetDestroyed(e){return e===this.rootTarget?!1:!e.isConnected||!this.rootTarget.contains(e)}onKeyPress(e){let t=t=>{e(px(t))};return this.rootTarget.addEventListener(`keydown`,t,{capture:!0}),()=>{this.rootTarget.removeEventListener(`keydown`,t,{capture:!0})}}onKeyRelease(e){let t=t=>{e(px(t))};return this.rootTarget.addEventListener(`keyup`,t,{capture:!0}),()=>{this.rootTarget.removeEventListener(`keyup`,t,{capture:!0})}}onFocusChange(e){let t=()=>{queueMicrotask(()=>{e(this.getFocusedTarget())})};return this.rootTarget.addEventListener(`focusin`,t,{capture:!0}),this.rootTarget.addEventListener(`focusout`,t,{capture:!0}),()=>{this.rootTarget.removeEventListener(`focusin`,t,{capture:!0}),this.rootTarget.removeEventListener(`focusout`,t,{capture:!0})}}onTargetDestroy(e,t){let n=this.targetDestroyListeners.get(e);return n||(n=new Set,this.targetDestroyListeners.set(e,n)),n.add(t),this.ensureObserver(),this.flushDisconnectedTargets(),()=>{let n=this.targetDestroyListeners.get(e);n&&(n.delete(t),n.size===0&&this.targetDestroyListeners.delete(e),this.targetDestroyListeners.size===0&&this.disconnectObserver())}}createCommandEvent(){return px()}ensureObserver(){if(this.observer||this.targetDestroyListeners.size===0)return;let e=dx();e&&(this.observer=new e(()=>{this.flushDisconnectedTargets()}),this.observer.observe(this.rootTarget,{childList:!0,subtree:!0}))}disconnectObserver(){this.observer&&=(this.observer.disconnect(),void 0)}flushDisconnectedTargets(){for(let[e,t]of this.targetDestroyListeners)if(this.isTargetDestroyed(e)){this.targetDestroyListeners.delete(e);for(let e of[...t])e()}this.targetDestroyListeners.size===0&&this.disconnectObserver()}};function hx(e){return new mx(e)}var gx=(e,t)=>lx(e).map(e=>t.resolveKey(e)),_x=`fungi.app.ready`,vx=`fungi.app.connect`,yx=[`PROTOCOL`,`IDENTITY`,`INSUFFICIENT_CREDIT`,`FILE_TOO_LARGE`,`CAPABILITY_DENIED`,`CAPABILITY_REVOKED`,`COMMAND_NOT_DECLARED`,`CONFLICT`,`INVALID_ARGUMENT`,`TIMEOUT`,`CANCELLED`,`DISCONNECTED`,`HOST_FAILURE`,`SELECTION_CHANGED`,`SAFETY_FILTER_REFUSED`],K=e=>Hf.pipe(U(gp(1)),U(yp(e))),bx=e=>Rf(K(e)),xx=Uf.pipe(U(hp()),U(rp(Number.isSafeInteger,{message:`Expected a safe integer`}))),Sx=xx.pipe(U(pp(0))),Cx=xx.pipe(U(fp(0))),wx=H({appId:K(160),releaseId:K(160),surfaceId:K(160)}),Tx=H({editing:Wf,surface:Yf([K(160),Bf])}),Ex=Yf([H({kind:V(`compose`),requestId:K(160),text:K(2e3)}),H({kind:V(`navigate`),requestId:K(160),params:qf(H({key:K(64),value:K(4096)})).pipe(U(yp(16)))})]),Dx=H({computerId:Yf([K(256),Bf]),teamHasComputers:Rf(Zf(Wf)),computerAccessGranted:Rf(Wf),focus:Tx,openRequest:Yf([Bf,Ex]),visibility:Xf([`visible`,`hidden`])}),Ox=Xf([`connecting`,`connected`,`suspended`,`disconnected`,`disposing`,`disposed`]),kx=H({altKey:Wf,ctrlKey:Wf,id:K(160),key:K(64),metaKey:Wf,shiftKey:Wf}),Ax=H({action:Rf(zf),availability:Rf(zf),category:K(160),description:bx(512),id:K(160),projections:Rf(zf),title:K(160)}),jx=H({arguments:Rf(zf),commandId:K(321),origin:Xf([`agent`,`browser`,`keyboard`,`menu`,`palette`,`programmatic`,`slash`,`terminal`]),requestId:K(160)}),Mx=Yf([H({result:Rf(zf),status:V(`handled`)}),H({error:zf,status:V(`failed`)})]),Nx=e=>K(e).pipe(U(rp(e=>{for(let t=0;t<e.length;t+=1)if(X_(e.charCodeAt(t)))return!1;return!0},{message:`Expected one line of plain text`}))),Px={id:K(64),text:Nx(80),end:Lf(Wf)},Fx=Lf(Uf.pipe(U(hp()),U(mp({minimum:0,maximum:9999})))),Ix=qf(Yf([H({...Px,kind:V(`text`),tone:Lf(Xf([`neutral`,`success`,`warning`,`error`]))}),H({...Px,kind:V(`button`),icon:Lf(Xf([`folder`,`ports`,`processes`,`access`])),count:Fx,title:Lf(Nx(1024)),disabled:Lf(Wf),opens:Lf(V(`dialog`)),expanded:Lf(Wf)}),H({...Px,kind:V(`toggle`),pressed:Wf}),H({...Px,kind:V(`menu`),count:Fx,title:Lf(Nx(1024)),options:qf(H({id:K(64),text:Nx(80),checked:Lf(Wf),disabled:Lf(Wf)})).pipe(U(yp(16)),U(rp(e=>new Set(e.map(e=>e.id)).size===e.length,{message:`Expected unique status option ids`})))})])).pipe(U(yp(6)),U(rp(e=>new Set(e.map(e=>e.id)).size===e.length,{message:`Expected unique status item ids`}))),Lx=H({computerId:K(256),path:K(1024)}),Rx=K(80).pipe(U(rp(e=>e.trim()===e,{message:`Expected a trimmed title`}))),zx=H({contractVersion:V(1),canGoBack:Wf,title:Rf(Rx)}),Bx=H({canGoBack:Wf,title:Rf(Hf)}),Vx=Zf(H({agentId:K(256),sessionId:K(256)})),Hx=H({agents:Rf(qf(Xf([`agent.list`,`agent.manage`,`agent.read`,`agent.send`])).pipe(U(yp(4)))),computers:Rf(qf(Xf([`computer.list`,`computer.readFile`,`computer.writeFile`,`computer.execute`])).pipe(U(yp(4))))}),Ux=Xf([`granted`,`declined`,`customize`]),Wx=H({message:K(512),tone:Rf(Xf([`info`,`success`,`warning`,`error`]))}),Gx=H({code:Xf(yx),message:K(512),retryable:Wf}),Kx=H({protocolVersion:V(2),type:V(_x)}),qx=H({epoch:K(160),protocolVersion:V(2),type:V(vx)}),Jx=H({epoch:K(160),protocolVersion:V(2)}),Yx={[Symbol.dispose]:Rf(zf)},Xx=Yf([H({...Yx,ok:V(!0),value:zf}),H({...Yx,error:Gx,ok:V(!1)})]);function q(e,t,n=`PROTOCOL`){return be(Pf(e,{onExcessProperty:`error`}),ti({onFailure:e=>{throw new p(`The peer sent malformed protocol data`,{cause:e,code:n,retryable:!1})},onSuccess:t}))}function J(e){return Object.freeze(e)}function Zx(e,t){let n=e.arguments===void 0?void 0:Zh(e.arguments),r={origin:e.origin,signal:t};return n!==void 0&&Object.assign(r,{arguments:n}),J(r)}var Qx=q(Ax,e=>{let t={category:e.category,id:e.id,title:e.title};return e.action!==void 0&&Object.assign(t,{action:e.action}),e.availability!==void 0&&Object.assign(t,{availability:e.availability}),e.description!==void 0&&Object.assign(t,{description:e.description}),e.projections!==void 0&&Object.assign(t,{projections:e.projections}),J(FS(()=>ug(t)))},`INVALID_ARGUMENT`),$x=q(K(321),e=>e),eS=q(jx,e=>{let t=e.arguments===void 0?void 0:Zh(e.arguments),n={commandId:e.commandId,origin:e.origin,requestId:e.requestId};return t!==void 0&&Object.assign(n,{arguments:t}),J(n)}),tS=q(Yf([Vf,zf]),e=>e===void 0?void 0:Zh(e)),nS=q(qx,e=>J(e));q(Jx,e=>J(e));var rS=q(Dx,e=>{let t={computerId:e.computerId,focus:J({...e.focus}),openRequest:e.openRequest===null?null:J({...e.openRequest}),visibility:e.visibility};return e.teamHasComputers!==void 0&&(t.teamHasComputers=e.teamHasComputers),e.computerAccessGranted!==void 0&&(t.computerAccessGranted=e.computerAccessGranted),J(t)}),iS=q(Gx,e=>J({...e})),aS=q(Tx,e=>J({...e}),`INVALID_ARGUMENT`),oS=q(wx,e=>J({...e})),sS=q(Ox,e=>e),cS=q(Ix,e=>J(e.map(e=>e.kind===`menu`?J({...e,options:J(e.options.map(e=>J(e)))}):J(e))),`INVALID_ARGUMENT`),lS=q(H({itemId:K(64),optionId:Lf(K(64)),anchor:Lf(H({start:Uf.pipe(U(mp({minimum:0,maximum:1e5}))),width:Uf.pipe(U(mp({minimum:0,maximum:1e5})))}))}),e=>J(e.anchor===void 0?{...e}:{...e,anchor:J({...e.anchor})}),`INVALID_ARGUMENT`),uS=q(Lx,e=>J({...e}),`INVALID_ARGUMENT`);q(zx,e=>J(e.title===void 0?{canGoBack:e.canGoBack}:{canGoBack:e.canGoBack,title:e.title}),`INVALID_ARGUMENT`);var dS=q(Bx,e=>{let t=e.title?.trim();return fS(t===void 0||t.length===0?{contractVersion:1,canGoBack:e.canGoBack}:{contractVersion:1,canGoBack:e.canGoBack,title:t})},`INVALID_ARGUMENT`),fS=q(zx,e=>J({...e}),`INVALID_ARGUMENT`),pS=q(Vx,e=>e===null?null:J({...e}),`INVALID_ARGUMENT`),mS=q(Hx,e=>J({agents:J([...new Set(e.agents??[])]),computers:J([...new Set(e.computers??[])])}),`INVALID_ARGUMENT`);q(Kx,e=>J(e));var hS=q(K(512),e=>e),gS=q(Wx,e=>J({...e}),`INVALID_ARGUMENT`);q(H({id:K(160),repeat:Wf}),e=>J(e));var _S=q(qf(kx).pipe(U(yp(64))),e=>{if(new Set(e.map(e=>e.id)).size!==e.length)throw new p(`Reserved chords are invalid`,{code:`PROTOCOL`,retryable:!1});return J(e.map(e=>J({...e})))});function vS(e){return q(H({value:zf,version:Sx}),t=>J({value:e(t.value),version:t.version}))}var yS=vS(rS),bS=q(H({capabilities:qf(zf).pipe(U(yp(128))),context:zf}),e=>J({capabilities:J(e.capabilities.map(e=>ES(e))),context:yS(e.context)})),xS=vS(sS),SS=vS(_S),CS=vS(hS),wS=be(xS,e=>{if(e.value!==`connected`&&e.value!==`suspended`)throw new p(`The host lifecycle is invalid`,{code:`PROTOCOL`,retryable:!1});return J({value:e.value,version:e.version})});function TS(e){return q(H({handle:zf,id:K(160),version:Cx}),t=>{if(!(t.handle instanceof q_)&&!(e&&t.handle instanceof J_))throw new p(`A capability handle is invalid`,{code:`PROTOCOL`,retryable:!1});return J({handle:t.handle,id:t.id,version:t.version})})}var ES=TS(!1),DS=TS(!0);function OS(e){let t=e?DS:ES;return q(H({capabilities:qf(zf).pipe(U(yp(128))),context:zf,identity:zf,lifecycle:zf,reservedChords:zf,theme:zf}),e=>J({capabilities:J(e.capabilities.map(e=>t(e))),context:yS(e.context),identity:oS(e.identity),lifecycle:wS(e.lifecycle),reservedChords:SS(e.reservedChords),theme:CS(e.theme)}))}var kS=OS(!1);OS(!0);function AS(e){return q(Xx,t=>t.ok?J({ok:!0,value:e(t.value)}):J({ok:!1,error:iS(t.error)}))}var jS=AS(kS),MS=AS(q(H({commandId:K(321)}),e=>J(e)));AS(q(Mx,e=>{if(e.status===`failed`)return J({status:`failed`,error:FS(()=>$h(e.error))});let t=e.result===void 0?void 0:Zh(e.result);return J(t===void 0?{status:`handled`}:{status:`handled`,result:t})}));var NS=AS(q(Vf,()=>void 0)),PS=AS(q(Ux,e=>e));AS(q(Wf,e=>e)),AS(q(Wf,e=>e));function FS(e){try{return e()}catch(e){throw new p(`The command metadata is invalid`,{cause:e,code:`INVALID_ARGUMENT`,retryable:!1})}}var IS=Yf([H({kind:V(`saveFile`),name:K(255).pipe(U(op(/^[^\p{Cc}/\\]+$/u))),mime:K(255),bytes:Dp}),H({kind:V(`copyText`),text:Hf})]);function LS(e){let t=Pf(IS,{onExcessProperty:`error`})(e);if($r(t))return{kind:`refused`,reason:`invalid-request`};let n=t.success;return n.kind===`saveFile`?n.name===`.`||n.name===`..`?{kind:`refused`,reason:`invalid-request`}:n.bytes.byteLength>33554432?{kind:`refused`,reason:`too-large`}:{...n,bytes:new Uint8Array(n.bytes)}:n.text.length>1048576||new TextEncoder().encode(n.text).byteLength>1048576?{kind:`refused`,reason:`too-large`}:n}var RS=AS(q(Yf([H({kind:V(`saved`)}),H({kind:V(`copied`)}),H({kind:V(`refused`),reason:Xf([`no-user-gesture`,`too-large`,`invalid-request`,`unavailable`,`denied`,`busy`])})]),e=>J(e)));function zS(e){return e instanceof p?{code:e.code,message:VS(e.message),retryable:e.retryable}:{code:`HOST_FAILURE`,message:`Host operation failed`,retryable:!1}}function BS(e){try{let t=iS(e);return new p(t.message,{code:t.code,retryable:t.retryable})}catch(e){return new p(`The host returned a malformed error`,{cause:e,code:`PROTOCOL`,retryable:!1})}}function VS(e){return e.trim().slice(0,512)||`Host operation failed`}var HS=e=>({ok:!0,value:e}),US=e=>({error:zS(e),ok:!1});async function WS(e,t){let n,r=new Set;try{return n=await e,GS(t(n))}catch(e){throw KS(e)&&qS(e,r),e instanceof p?e:new p(`The remote operation failed`,{cause:e,code:`HOST_FAILURE`,retryable:!0})}finally{n!==e&&KS(n)&&qS(n,r)}}function GS(e){if(e.ok)return e.value;throw BS(e.error)}function KS(e){return Ie(e)&&Symbol.dispose in e&&Me(e[Symbol.dispose])}function qS(e,t){if(!t.has(e)){t.add(e);try{e[Symbol.dispose]()}catch(e){console.warn(`RPC result disposal failed`,e)}}}function JS(){let e=[],t=new Set;return{get:()=>e,subscribe:e=>(t.add(e),()=>t.delete(e)),update:n=>{e=n;for(let e of Array.from(t))try{e()}catch(e){console.warn(`App binding subscriber failed`,e)}}}}function YS(e){let t=_S(e),n=new Set;return{get:()=>t,subscribe:e=>(n.add(e),()=>n.delete(e)),update:e=>{t=_S(e);for(let e of Array.from(n))try{e()}catch(e){console.warn(`Reserved chord subscriber failed`,e)}}}}function XS(e){let t=!0,n,r=e.window.document.querySelector(`html`);if(!r)return()=>{t=!1};let i=hx(r),a=new jb(i);Zb(a),rx(a),a.prependEventMatchResolver(gx);let o=QS(e.onBroken),s=nC(a,e.chords,e.remote,o),c=ZS(e,o,()=>t,e=>{n=e},()=>n),l=i.onFocusChange(()=>{queueMicrotask(c)}),u=()=>{queueMicrotask(c)};e.window.addEventListener(`focus`,u),e.window.addEventListener(`blur`,u);let d=e.bindings,f=()=>$S(e.window.document,e.identity.surfaceId).editing,p=d===void 0?()=>void 0:eC(a,d,f),m=d===void 0?()=>void 0:d.subscribe(()=>{p(),p=eC(a,d,f)}),h=e.chords.subscribe(()=>{s(),s=nC(a,e.chords,e.remote,o)});return queueMicrotask(c),()=>{t&&(t=!1,l(),e.window.removeEventListener(`focus`,u),e.window.removeEventListener(`blur`,u),h(),s(),m(),p())}}function ZS(e,t,n,r,i){return()=>{if(!n())return;let a=$S(e.window.document,e.identity.surfaceId),o=i();(a.editing!==o?.editing||a.surface!==o.surface)&&(r(a),t(()=>e.remote.reportFocus(a)))}}function QS(e){return t=>{try{WS(t(),NS).catch(t=>{Cg(`browser-bridge.host-call`,t),e(t)})}catch(t){Cg(`browser-bridge.host-call`,t),e(t)}}}function $S(e,t){let n=e.activeElement;return aS({editing:!!(n?.matches(`input, textarea, select, [contenteditable='true']`)===!0||n?.closest(`[contenteditable='true']`)),surface:e.hasFocus()?t:null})}function eC(e,t,n){let r=t.get();return e.registerLayer({bindings:r.map((e,t)=>({cmd:`app/${String(t)}`,key:e.key})),commands:r.map((e,t)=>({name:`app/${String(t)}`,run:t=>{let r=t.event.originalEvent;if(r?.defaultPrevented||r?.isComposing||tC(e.key)&&n())return!1;e.run()}})),priority:500})}function tC(e){return!/(?:^|\+)(?:ctrl|control|super|meta|cmd|alt|option|mod)\+/iu.test(e)}function nC(e,t,n,r){let i=t.get();return e.registerLayer({bindings:i.map(e=>({cmd:`reserved/${e.id}`,key:{ctrl:e.ctrlKey,meta:e.altKey,name:fx(e.key),shift:e.shiftKey,super:e.metaKey}})),commands:i.map(e=>({name:`reserved/${e.id}`,run:t=>{let i=t.event.originalEvent;if(i?.defaultPrevented||i?.isComposing)return!1;r(()=>n.invokeReservedChord(e.id,i?.repeat??!1))}})),priority:1e3})}function rC(e){let t=t=>{if(t.defaultPrevented||t.isComposing)return;let n=oC(t,e.mac);n!==null&&(t.preventDefault(),n===`back`&&!t.repeat&&e.canGoBack()&&e.back())},n=t=>{let n=aC(t.button);if(n===null)return;let r=t.defaultPrevented;t.preventDefault(),t.type===`mouseup`&&n===`back`&&!r&&e.canGoBack()&&e.back()};e.window.addEventListener(`keydown`,t);for(let t of iC)e.window.addEventListener(t,n);return()=>{e.window.removeEventListener(`keydown`,t);for(let t of iC)e.window.removeEventListener(t,n)}}var iC=[`mousedown`,`mouseup`,`auxclick`];function aC(e){return e===3?`back`:e===4?`forward`:null}function oC(e,t){return e.shiftKey||e.ctrlKey?null:t?!e.metaKey||e.altKey?null:e.key===`[`?`back`:e.key===`]`?`forward`:sC(e.target)?null:e.key===`ArrowLeft`?`back`:e.key===`ArrowRight`?`forward`:null:!e.altKey||e.metaKey?null:e.key===`ArrowLeft`?`back`:e.key===`ArrowRight`?`forward`:null}function sC(e){return e instanceof HTMLElement?e.isContentEditable||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement:!1}function cC(){return!Ne(globalThis.navigator)&&/Mac|iPhone|iPad/u.test(globalThis.navigator.userAgent)}function lC(e){let t=e,n=new Set;return{get:()=>t,subscribe(e){n.add(e);let t=!0;return()=>{t&&(t=!1,n.delete(e))}},update(e){if(!Object.is(t,e)){t=e;for(let e of Array.from(n))try{e(t)}catch(e){console.warn(`App store subscriber failed`,e)}}}}}function uC(e){let t=new Map,n=lC(0),r=!1,i=e=>{let t=new Map;try{for(let n of e){let e=ES(n),r=mC(e.id,e.version);if(t.has(r))throw fC(e.handle),new p(`Duplicate capability grant`,{code:`PROTOCOL`,retryable:!1});t.set(r,e.handle)}}catch(e){for(let e of t.values())fC(e);throw e}return t};for(let[n,r]of i(e))t.set(n,r);let a=e=>{for(let t of e)fC(t)},o=e=>{if(r)throw new p(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0});let n=mC(e.id,e.version);return t.get(n)};return{directory:Object.freeze({get version(){return n.get()},subscribe:e=>n.subscribe(e),has(e){return!!o(e)},require(e){let t=o(e);if(!t)throw new p(`The capability is not granted`,{code:`CAPABILITY_DENIED`,retryable:!1});try{return e.schema.parse(t)}catch(e){throw new p(`The capability interface is malformed`,{cause:e,code:`PROTOCOL`,retryable:!1})}}}),replace(e){if(r)throw new p(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0});let o=i(e),s=[...t.values()];t.clear();for(let[e,n]of o)t.set(e,n);a(s.filter(e=>![...o.values()].includes(e))),n.update(n.get()+1)},disconnect(){r||(r=!0,a(t.values()),t.clear(),n.update(n.get()+1))}}}var dC=N().transform(e=>{let t=te(Object).safeParse(e);if(!t.success)return;let n=Object.create(t.data),r=Ff(H({[Symbol.dispose]:Rf(tp(Function))}))(n);return{owner:t.data,dispose:r[Symbol.dispose]}});function fC(e){try{let t=dC.parse(e);if(t===void 0||pC.has(t.owner))return;pC.add(t.owner),t.dispose?.call(t.owner)}catch(e){console.warn(`RPC value disposal failed`,e)}}var pC=new WeakSet;function mC(e,t){return`${e}@${String(t)}`}var hC=class extends J_{#e=!0;#t;#n=new Map;constructor(e){super(),this.#t=e}cancel(e){try{return this.#n.get($x(e))?.abort(),Promise.resolve(HS(void 0))}catch(e){return Promise.resolve(US(e))}}dispose(){if(this.#e){this.#e=!1;for(let e of this.#n.values())e.abort();this.#n.clear()}}async invoke(e){try{if(!this.#e)throw new p(`The command is disposed`,{code:`DISCONNECTED`,retryable:!0});let t=eS(e);if(this.#n.has(t.requestId))throw new p(`Duplicate command request`,{code:`PROTOCOL`,retryable:!1});if(this.#n.size>=64)throw new p(`Too many command requests`,{code:`HOST_FAILURE`,retryable:!0});let n=new AbortController;this.#n.set(t.requestId,n);try{let e=tS(await this.#t(Zx(t,n.signal)));return HS(e===void 0?{status:`handled`}:{status:`handled`,result:e})}finally{this.#n.delete(t.requestId)}}catch(e){if(e instanceof Zm)try{return HS({status:`failed`,error:$h({code:e.code,message:e.message,details:e.details})})}catch(e){return US(e)}return US(e)}}[Symbol.dispose](){this.dispose()}};function gC(e){let t=[];for(let n of e.values()){let{definition:e,handler:r}=n;if(n.commandId===void 0)continue;let i=e.availability?.status!==`unavailable`;for(let n of e.projections?.bindings?.values??[])n.trim().includes(` `)||n.startsWith(`<`)||t.push({key:n,run:()=>{i&&Promise.resolve().then(()=>r({origin:`keyboard`,signal:new AbortController().signal})).catch(e=>{console.warn(`App key command failed`,e)})}})}return t}function _C(e,t,n,r){let i=new Map,a=!1,o=()=>{r?.update(a?[]:gC(i))},s=e=>{try{n()}catch(t){console.warn(`App command failure callback failed`,t,e)}},c=e=>{try{WS(e(),NS).catch(e=>{s(e)})}catch(e){console.warn(`App command RPC supervision failed`,e),s(e)}};return{commands:yC(e,t,i,()=>a,t=>{let n=i.get(t);if(!n)return;i.delete(t),n.target.dispose(),o();let r=n.commandId;!a&&r!==void 0&&c(()=>e.unregisterCommand(r))},o),dispose(){if(!a){a=!0;for(let e of i.values())e.target[Symbol.dispose]();i.clear(),o()}}}}function vC(e,t,n,r){let i=t.id;if(e.size>=128||e.has(i))throw r.dispose(),new p(`Command registration is unavailable`,{code:`INVALID_ARGUMENT`,retryable:!1});let a={commandId:void 0,definition:t,handler:n,target:r};e.set(i,a);let o=!1;return{commit(e){o||(a.commandId=e)},release(){o||(o=!0,e.get(i)===a&&e.delete(i),r.dispose())},target:r}}function yC(e,t,n,r,i,a){return Object.freeze({async register(o,s){if(t(),!Me(s))throw new p(`Command handler must be a function`,{code:`INVALID_ARGUMENT`,retryable:!1});let c=Qx(o),l=new hC(s),u=vC(n,c,s,l);try{let t=await bC(e,c,u.target);r()&&await xC(e,t.commandId,l),u.commit(t.commandId),a()}catch(e){throw u.release(),e}let d=!0;return()=>{d&&(d=!1,i(c.id))}}})}async function bC(e,t,n){return WS(e.registerCommand(t,n),MS)}async function xC(e,t,n){throw n.dispose(),await WS(e.unregisterCommand(t),NS),new p(`The command controller is disposed`,{code:`DISCONNECTED`,retryable:!0})}var SC=Cf(e=>e instanceof q_),CC=class extends J_{#e=!1;#t;constructor(e){super(),this.#t=e}disconnect(e){try{if(this.#e)throw PC();let t=e===void 0?void 0:iS(e);return setTimeout(()=>this.#t.disconnect?.(t??RC()),0),Promise.resolve(HS(void 0))}catch(e){return Promise.resolve(US(e))}}async requestClose(){try{if(this.#e)throw PC();return HS(await(this.#t.beforeClose?.()??!0))}catch(e){return US(e)}}async requestBack(){try{if(this.#e)throw PC();return HS(await(this.#t.back?.()??!1))}catch(e){return US(e)}}async activateStatus(e){try{if(this.#e)throw PC();let t=lS(e);return Z_(this.#t.statusItems,t)?HS(await(this.#t.statusAction?.(t)??!1)):HS(!1)}catch(e){return US(e)}}[Symbol.dispose](){this.#e=!0}async updateContext(e){return this.#e?US(PC()):this.#n(e,`context`,rS,e=>{this.#t.context.update(e)})}reconfigure(e){let t=[];try{if(this.#e)throw PC();let n=bS(e);if(n.context.version<=this.#t.versions.context)return Promise.resolve(HS(void 0));for(let e of n.capabilities)t.push({...e,handle:Ff(SC)(e.handle).dup()});if(!this.#t.capabilities)throw PC();return this.#t.capabilities.replace(t),t=[],this.#t.versions.context=n.context.version,this.#t.context.update(n.context.value),Promise.resolve(HS(void 0))}catch(e){for(let e of t)fC(e.handle);return Promise.resolve(US(e))}}updateLifecycle(e){try{if(this.#e)throw PC();let t=vS(sS)(e);if(t.version<=this.#t.versions.lifecycle)return Promise.resolve(HS(void 0));if(!zC(this.#t.lifecycle.get(),t.value))throw new p(`The host sent an invalid lifecycle transition`,{code:`PROTOCOL`,retryable:!1});return this.#t.versions.lifecycle=t.version,this.#t.lifecycle.update(t.value),Promise.resolve(HS(void 0))}catch(e){return Promise.resolve(US(e))}}async updateReservedChords(e){return this.#e?US(PC()):this.#n(e,`chords`,_S,e=>{this.#t.chords.update(e)})}async updateTheme(e){return this.#e?US(PC()):this.#n(e,`theme`,hS,e=>{this.#t.theme.update(e)})}#n(e,t,n,r){try{let i=vS(n)(e);return i.version>this.#t.versions[t]&&(this.#t.versions[t]=i.version,r(i.value)),Promise.resolve(HS(void 0))}catch(e){return Promise.resolve(US(e))}}};async function wC(e){let t=OC(),n=new CC(t),r=Y_(e.port,n),i,a=DC(r);try{performance.mark(`fungi.app-open.agar-rpc-connect-start`);let o=await Promise.race([r.connect({epoch:e.epoch,protocolVersion:2}),a]);performance.mark(`fungi.app-open.agar-rpc-connect-ready`),i=o;let s=GS(jS(o));if(!e.isActive())throw EC();let c=kC({bootstrap:s,bootstrapOwner:i,options:e,remote:r,state:t,target:n});return performance.mark(`fungi.app-open.agar-root-created`),i=void 0,c}catch(t){return VC(t,e,n,r,i)}}function TC(e,t){e.context.update(t.context.value),e.theme.update(t.theme.value),e.lifecycle.update(t.lifecycle.value),e.chords.update(t.chords.value),e.versions.context=t.context.version,e.versions.theme=t.theme.version,e.versions.lifecycle=t.lifecycle.version,e.versions.chords=t.chords.version}function EC(){return new p(`App connection was cancelled`,{code:`CANCELLED`,retryable:!1})}function DC(e){let t,n=new Promise((e,n)=>{t=n});return n.catch(e=>{Cg(`app-session.rpc-disconnect`,e)}),e.onRpcBroken(()=>t?.(new p(`The app host disconnected`,{code:`DISCONNECTED`,retryable:!0}))),n}function OC(){return{statusItems:[],bindings:JS(),chords:YS([]),context:lC({computerId:null,focus:{editing:!1,surface:null},openRequest:null,visibility:`hidden`}),lifecycle:lC(`connecting`),theme:lC(`default`),canGoBack:!1,versions:{chords:-1,context:-1,lifecycle:-1,theme:-1}}}function kC(e){let t=oS(e.bootstrap.identity),n=BC(e.bootstrap);TC(e.state,n);let r=uC(e.bootstrap.capabilities);return e.state.capabilities=r,jC(e,t,r)}function AC(e,t,n){return XS({bindings:e.state.bindings,chords:e.state.chords,identity:t,onBroken:e=>{n({code:`DISCONNECTED`,message:e instanceof p?e.message:`The app host rejected a browser bridge operation`,retryable:!0})},remote:e.remote,window:e.options.window})}function jC(e,t,n){let r=!1,i=t=>{r||(r=!0,IC([()=>{t&&e.state.lifecycle.update(`disconnected`)},()=>{e.state.lifecycle.update(`disposing`)},l,u,()=>{o.dispose()},()=>{e.state.beforeClose=void 0,e.state.back=void 0,e.state.statusAction=void 0},()=>{n.disconnect()},()=>{e.target[Symbol.dispose]()},()=>{fC(e.bootstrapOwner)},()=>{fC(e.remote)},()=>{e.options.port.close()},()=>{e.state.lifecycle.update(`disposed`)},e.options.onDisposed],`app connection disposal`))},a=()=>{if(r)throw new p(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0})},o=_C(e.remote,a,()=>{i({code:`DISCONNECTED`,message:`The app host rejected a terminal command operation`,retryable:!0})},e.state.bindings),s=NC(e.remote,a,e.state),c=MC(e.state,e.remote,a),l=AC(e,t,i),u=rC({window:e.options.window,mac:cC(),canGoBack:()=>e.state.canGoBack&&e.state.back!==void 0,back:()=>{let t=e.state.back;t&&Promise.resolve().then(t).catch(e=>{Cg(`app-window.back-input`,e)})}});return e.state.disconnect=i,e.remote.onRpcBroken(()=>{FC(i)}),LC({capabilities:n.directory,commands:o.commands,context:e.state.context,dispose:i,identity:t,lifecycle:e.state.lifecycle,theme:e.state.theme,ui:s,window:c})}function MC(e,t,n){let r=Object.freeze({async publish(r){n();let i=dS(r);e.canGoBack=i.canGoBack,await WS(t.reportNavigation(i),NS)},onBack(t){if(n(),e.back!==void 0)throw new p(`The App already owns Back requests`,{code:`INVALID_ARGUMENT`,retryable:!1});e.back=t;let r=!1;return()=>{r||(r=!0,e.back===t&&(e.back=void 0))}}});return Object.freeze({navigation:r,onBeforeClose(t){if(n(),e.beforeClose!==void 0)throw new p(`The App already owns a close consultation`,{code:`INVALID_ARGUMENT`,retryable:!1});e.beforeClose=t;let r=!1;return()=>{r||(r=!0,e.beforeClose===t&&(e.beforeClose=void 0))}}})}function NC(e,t,n){return Object.freeze({async requestComputerChoice(){t(),await WS(e.requestComputerChoice(),NS)},async requestBrowserAction(n){t();let r=LS(n);return r.kind===`refused`?r:await WS(e.requestBrowserAction(r),RS)},onStatusAction(e){if(t(),n.statusAction!==void 0)throw new p(`The App already owns its status actions`,{code:`INVALID_ARGUMENT`,retryable:!1});n.statusAction=e;let r=!1;return()=>{r||(r=!0,n.statusAction===e&&(n.statusAction=void 0))}},async requestAppPermissions(n){return t(),await WS(e.requestAppPermissions(mS(n)),PS)},async openDesktopSettings(){t(),await WS(e.openDesktopSettings(),NS)},async openTeamBilling(){t(),await WS(e.openTeamBilling(),NS)},async openNavigation(n){t(),await WS(e.openNavigation(uS(n)),NS)},async reportStatus(r){t();let i=cS(r);n.statusItems=i,await WS(e.reportStatus(i),NS)},async reportAgentSessionSelection(n){t(),await WS(e.reportAgentSessionSelection(pS(n)),NS)},async showToast(n){t(),await WS(e.showToast(gS(n)),NS)}})}function PC(){return new p(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0})}function FC(e){e({code:`DISCONNECTED`,message:`The app host disconnected`,retryable:!0})}function IC(e,t){for(let n of e)try{n()}catch(e){console.warn(`${t} cleanup failed`,e)}}function LC(e){return Object.freeze(e)}function RC(){return{code:`DISCONNECTED`,message:`The app host disconnected`,retryable:!1}}function zC(e,t){return e===t||e===`connected`&&t===`suspended`||e===`suspended`&&t===`connected`}function BC(e){let t=vS(rS)(e.context),n=vS(hS)(e.theme),r=vS(sS)(e.lifecycle),i=vS(_S)(e.reservedChords);if(r.value!==`connected`&&r.value!==`suspended`)throw new p(`The bootstrap lifecycle is invalid`,{code:`PROTOCOL`,retryable:!1});return{chords:i,context:t,lifecycle:r,theme:n}}function VC(e,t,n,r,i){throw IC([()=>{n[Symbol.dispose]()},()=>{i&&fC(i)},()=>{fC(r)},()=>{t.port.close()},t.onDisposed],`app connection rejection`),e instanceof p?e:new p(`Unable to establish the app RPC session`,{cause:e,code:`PROTOCOL`,retryable:!1})}var HC=!1,UC=class{options;#e;#t;#n;#r=!1;#i;#a;constructor(e){this.options=e,this.#t=JC(e.expectedHostOrigin),this.#e=globalThis.window}start(){performance.mark(`fungi.app-open.agar-connect-start`);let e=this.#t;if(!e)return Promise.reject(XC());let t=this.#u();return t?Promise.reject(t):(HC=!0,this.#o(e))}#o(e){return new Promise((t,n)=>{let r=(e,r)=>{this.#s(e,r,a,i,t,n)},i=()=>{r(GC())},a=t=>{this.#c(t,e,r,a)};this.#e.addEventListener(`message`,a),this.options.signal?.addEventListener(`abort`,i,{once:!0});let o=()=>{try{performance.mark(`fungi.app-open.agar-ready-sent`),this.#e.parent.postMessage({protocolVersion:2,type:_x},e)}catch(e){Cg(`connect.notify-host`,e),r(QC(e))}};this.#i=setInterval(o,200),this.#a=setTimeout(()=>{r(qC())},1e4),o()})}#s(e,t,n,r,i,a){if(!this.#r){if(this.#r=!0,this.#l(),this.#e.removeEventListener(`message`,n),this.options.signal?.removeEventListener(`abort`,r),e||!t){this.#n?.close(),HC=!1,a(e??qC());return}i(t)}}#c(e,t,n,r){if(!ZC(e.data))return;if(performance.mark(`fungi.app-open.agar-connect-received`),e.source!==this.#e.parent||e.origin!==t){n(YC());return}let i=$C(e,n);if(!i)return;let a=e.ports.length===1?e.ports[0]:void 0;if(!a){n(ew(`The app host did not transfer exactly one port`));return}this.#n=a,this.#l(),this.#e.removeEventListener(`message`,r),wC({epoch:i.epoch,isActive:()=>!this.#r,onDisposed:()=>{HC=!1},port:a,window:this.#e}).then(e=>{performance.mark(`fungi.app-open.agar-root-ready`),n(void 0,e)},e=>{n(KC(e))})}#l(){clearInterval(this.#i),clearTimeout(this.#a),this.#i=void 0,this.#a=void 0}#u(){if(this.options.signal?.aborted)return GC();if(HC)return new p(`An app connection is already live`,{code:`IDENTITY`,retryable:!1});if(Ne(globalThis.window)||this.#e.parent===this.#e)return new p(`The app host is unavailable`,{code:`DISCONNECTED`,retryable:!0})}};function WC(e){return new UC(e).start()}function GC(){return new p(`App connection was cancelled`,{code:`CANCELLED`,retryable:!1})}function KC(e){return e instanceof p?e:new p(`Unable to connect to the app host`,{cause:e,code:`PROTOCOL`,retryable:!1})}function qC(){return new p(`The app host disconnected`,{code:`DISCONNECTED`,retryable:!0})}function JC(e){if(!URL.canParse(e))return;let t=new URL(e).origin;return t===e?t:void 0}function YC(){return new p(`The app connection identity is invalid`,{code:`IDENTITY`,retryable:!1})}function XC(){return new p(`expectedHostOrigin must be an origin`,{code:`INVALID_ARGUMENT`,retryable:!1})}var ZC=jf(H({type:V(vx)}));function QC(e){return new p(`Unable to notify the app host`,{cause:e,code:`DISCONNECTED`,retryable:!0})}function $C(e,t){try{return nS(e.data)}catch(e){Cg(`connect.decode-message`,e),t(e instanceof p?e:new p(`Malformed app connection`,{cause:e,code:`PROTOCOL`,retryable:!1}));return}}function ew(e){return new p(e,{code:`PROTOCOL`,retryable:!1})}function tw(e,t,n){e.style.isolation=`isolate`;let r=(0,Sg.createRoot)(e),i=new AbortController,a=e.ownerDocument.documentElement,o=bg(a),s,c,l,u=!1,d=e=>{let i=(0,W.createElement)(nw,{state:e,render:n});r.render(t.queryClient?(0,W.createElement)(Ap,{client:t.queryClient},i):i)},f=()=>{l?.(),l=void 0,c?.(),c=void 0;let e=s;s=void 0,e?.dispose(),u&&=(o===null?a.removeAttribute(`data-theme`):yg(o,a),!1)},{referrer:m,defaultView:h}=e.ownerDocument;return performance.mark(`fungi.app-open.react-root-render-start`),!h||h.parent===h||!URL.canParse(m)?d({app:null,status:`standalone`}):(d({app:null,status:`connecting`}),WC({expectedHostOrigin:new URL(m).origin,signal:i.signal}).then(e=>{if(i.signal.aborted){e.dispose();return}s=e;let t=()=>{let t=e.lifecycle.get();return t===`disposing`||t===`disconnected`||t===`disposed`?(f(),d({app:null,status:`ended`}),!0):!1};l=e.lifecycle.subscribe(t),!t()&&(u=!0,yg(e.theme.get(),a),c=e.theme.subscribe(e=>{yg(e,a)}),d({app:e,status:`live`}))}).catch(e=>{i.signal.aborted&&e instanceof p&&e.code===`CANCELLED`||(console.error(`${t.name} host connection failed`,e),f(),i.signal.aborted||d({app:null,status:`ended`}))})),()=>{i.signal.aborted||(i.abort(),r.unmount(),f())}}function nw({state:e,render:t}){return(0,W.useLayoutEffect)(()=>{performance.mark(`fungi.app-open.react-initial-commit`)},[]),(0,W.useLayoutEffect)(()=>{e.app&&performance.mark(`fungi.app-open.react-connected-commit`)},[e.app]),t(e)}function rw(e){let t=(0,W.useCallback)(t=>e?.subscribe(t)??(()=>void 0),[e]),n=(0,W.useCallback)(()=>e?.get(),[e]);return(0,W.useSyncExternalStore)(t,n,n)}function iw(e){return rw(e?.context)??null}function aw(e){return iw(e)?.computerId??null}function ow(e,t,n,r){let i=(0,W.useRef)(t);i.current=t;let a=(0,W.useRef)(n);a.current=n;let o=(0,W.useRef)(r);o.current=r;let s=JSON.stringify(t),c=n!==void 0;(0,W.useEffect)(()=>{e&&e.ui.reportStatus(i.current).catch(e=>{o.current?o.current(e):console.error(`Window status report failed`,e)})},[e,s]),(0,W.useEffect)(()=>{if(!(!e||!c))return e.ui.onStatusAction(e=>a.current?.(e)??!1)},[e,c]),(0,W.useEffect)(()=>()=>{e?.ui.reportStatus([]).catch(e=>{console.error(`Window status report failed`,e)})},[e])}function sw(e,{sourceId:t,namespace:n},r){let i=(0,W.useMemo)(()=>$m(),[]),a=(0,W.useMemo)(r,[r]);return(0,W.useEffect)(()=>{let e=i.contribute({sourceId:t,namespace:n,commands:a});return()=>{e.dispose()}},[i,t,n,a]),(0,W.useEffect)(()=>e?hg(e.commands,a):void 0,[e,a]),i}function cw(e,{canGoBack:t,title:n,onBack:r}){let i=(0,W.useRef)(r);(0,W.useEffect)(()=>{i.current=r},[r]),(0,W.useEffect)(()=>{if(!e)return;let t=e.onBack(()=>i.current());return()=>{t(),lw(e,{canGoBack:!1})}},[e]),(0,W.useEffect)(()=>{e&&lw(e,n===void 0?{canGoBack:t}:{canGoBack:t,title:n})},[e,t,n])}function lw(e,t){e.publish(t).catch(e=>{e instanceof p&&e.code===`DISCONNECTED`||console.warn(`App navigation report failed`,e)})}var uw=class{id;version;#e;constructor(e,t,n){this.id=e,this.version=t,this.#e=n,Object.freeze(this)}get schema(){return this.#e}};function dw(e,t,n){return new uw(e,t,n)}function fw(e){let t=T(e),n=te(Object),r=T(Object.fromEntries(Object.keys(e).map(e=>[e,N().optional()])));return N().transform(e=>{let i=n.parse(e),a=Object.create(i),o=r.parse(a),s=Object.fromEntries(Object.entries(o).map(([e,t])=>[e,ae().parse(t).bind(i)]));return{...t.parse(s),[Symbol.dispose](){fC(e)}}})}function pw(e){return N().transform(t=>{try{return e.parse(t)}catch(e){throw e instanceof p?e:new p(`The capability returned malformed data`,{cause:e,code:`PROTOCOL`,retryable:!1})}finally{fC(t)}})}function mw(e){return ae({output:w(N().transform(t=>{try{return e.parse(t)}catch(e){throw fC(t),e instanceof p?e:new p(`The capability returned a malformed result`,{cause:e,code:`PROTOCOL`,retryable:!1})}}))})}var hw=mw(pw(g()));fw({fetch:mw(te(Response)),close:hw});var gw=e=>crypto.getRandomValues(new Uint8Array(e)),_w=(e,t,n)=>{let r=256-256%e.length;if(r===256){let r=e.length-1;return(i=t)=>{if(!i)return``;let a=``;for(;;){let t=n(i),o=i;for(;o--;)if(a+=e[t[o]&r],a.length>=i)return a}}}let i=Math.ceil(409.6*t/r);return(a=t)=>{if(!a)return``;let o=``;for(;;){let t=n(i),s=i;for(;s--;)if(t[s]<r&&(o+=e[t[s]%e.length],o.length>=a))return o}}},vw=(e,t=21)=>_w(e,t|0,gw),yw=`abcdefghijklmnopqrstuvwxyz0123456789`;function bw(e=21){if(e===1/0||e===-1/0)throw RangeError(`nanoid length must be finite`);return vw(yw,e)()}var xw=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Sw=/^[a-z][a-z0-9]*(?:_[a-z][a-z0-9]*)*$/,Cw=P().min(1).max(64).regex(xw),ww=P().min(1).max(64).regex(xw),Tw=P().min(1).max(32).regex(Sw),Ew=T({prefix:Tw}),Dw=T({family:Cw,version:j(1),kinds:m(ww,Ew)}).superRefine((e,t)=>{let n=Object.entries(e.kinds);if(n.length<1||n.length>64){t.addIssue({code:`custom`,message:`Identifier families must declare between one and 64 kinds`});return}let r=new Set;for(let[,e]of n){if(r.has(e.prefix)){t.addIssue({code:`custom`,message:`Identifier kind prefixes must be distinct`});return}r.add(e.prefix)}}),Ow=P(),kw=/^[a-z0-9]+$/,Aw=new TextEncoder;function jw(e){return e===32||e>=9&&e<=13}function Mw(e){let t=0,n=e.length;for(;t<n&&jw(e.charCodeAt(t));)t+=1;for(;n>t&&jw(e.charCodeAt(n-1));)--n;return e.slice(t,n).replace(/[A-Z]/g,e=>String.fromCharCode(e.charCodeAt(0)+32))}function Nw(e){let t=`${e.prefix}_`;function n(e){if(!e.startsWith(t))return!1;let n=e.slice(t.length);return n.length===21&&kw.test(n)}let r=C(()=>E(e=>{let t=Ow.safeParse(e);return t.success&&n(t.data)}));function i(i){let a,o=i,s=Aw.encode(o).byteLength,c=r.safeParse(o),l=o.startsWith(t)?o.slice(t.length):void 0;if(s<3||s>96)a=`bounds`;else if(l!==void 0&&Array.from(l).length!==21)a=`bounds`;else if(c.success)return{ok:!0,value:c.data};else a=n(Mw(o))?`non_canonical`:`grammar`;return{ok:!1,error:{code:`invalid_id`,family:e.family,kind:e.kind,version:1,reason:a}}}let a=C(()=>Ow.transform((e,t)=>{let n=i(e);return n.ok?n.value:(t.addIssue({code:`custom`,message:n.error.reason}),o)}));function s(){let n;try{n=bw(21)}catch{throw e.entropyUnavailable()}return r.parse(`${t}${n}`)}return{family:e.family,kind:e.kind,version:1,generate:s,schema:a,parse:i,is:e=>i(e).ok}}var Pw=m(P(),T({family:P(),kind:P(),version:j(1),generate:ae(),schema:te(S),parse:ae(),is:ae()})),Fw=class extends Error{name=`CairnDefinitionError`;code=`invalid_definition`;constructor(){super(`Cairn identifier family definition is invalid`)}},Iw=class extends Error{name=`CairnGenerationError`;code=`entropy_unavailable`;family;kind;version=1;constructor(e){super(`Cairn entropy source is unavailable`),this.family=e.family,this.kind=e.kind}};function Lw(e){let t;try{t=Dw.safeParse(e)}catch{throw new Fw}if(!t.success)throw new Fw;let n=t.data,r={};for(let[t,i]of Object.entries(n.kinds)){let a=i.prefix;r[t]=Nw({family:e.family,kind:t,prefix:a,entropyUnavailable:()=>new Iw({family:n.family,kind:t})})}let i=E(e=>{let t=Pw.safeParse(e);if(!t.success)return!1;let r=Object.entries(t.data);return r.length===Object.keys(n.kinds).length&&r.every(([e,t])=>Object.hasOwn(n.kinds,e)&&t.kind===e&&t.family===n.family)}).safeParse(r);if(!i.success)throw new Fw;return i.data}function Rw(e){return e instanceof p?e:new p(`App operation failed`,{cause:e,code:`HOST_FAILURE`,retryable:!1})}var zw=new WeakMap,Bw={of(e,...t){return[e?.identity.surfaceId??null,e?.context.get().computerId??null,...t]}};function Vw(e){let t={};return e&&zw.set(t,e),t}function Hw(){let e=new Im({defaultOptions:{queries:{retry:!1,staleTime:3e4,refetchOnWindowFocus:!1},mutations:{retry:!1}}}),t=new Map;return e.getQueryCache().subscribe(n=>{let r=n.query;if(n.type===`removed`){t.get(r.queryHash)?.release(),t.delete(r.queryHash);return}let i=r.meta&&zw.get(r.meta),a=t.get(r.queryHash);if(a?.app===i||(a?.release(),t.delete(r.queryHash),!i))return;let o=()=>{queueMicrotask(()=>{e.getQueryCache().get(r.queryHash)===r&&t.get(r.queryHash)?.app===i&&e.resetQueries({predicate:e=>e===r})})},s=i.capabilities.subscribe(o);t.set(r.queryHash,{app:i,release:s}),a&&o()}),e}function Uw(e,t,n,r){let i=e?.context.get().computerId;return Xm({queryKey:n,meta:Vw(e),enabled:e!==null,retry:!1,queryFn:async({signal:n})=>{try{if(!e)throw new p(`No App connection`,{code:`DISCONNECTED`,retryable:!0});if(e.context.get().computerId!==i)throw new p(`The selected Computer changed`,{code:`SELECTION_CHANGED`,retryable:!1});return await r(e.capabilities.require(t),n)}catch(e){throw Rw(e)}}})}var Ww=Yf([H({kind:V(`compose`),text:Hf.pipe(U(gp(1)),U(yp(2e3)))}),H({kind:V(`navigate`),params:qf(H({key:Hf.pipe(U(gp(1)),U(yp(64))),value:Hf.pipe(U(yp(1024)))})).pipe(U(yp(16)))})]);Yf([H({role:Hf.pipe(U(gp(1)),U(yp(80))),intent:Ww}),H({appId:Hf.pipe(U(gp(1)),U(yp(128))),intent:Ww})],{mode:`oneOf`}),dw(`apps.open`,1,fw({open:hw,role:mw(pw(M({displayName:P().min(1).max(80).nullable()}).nullable()))}));var Gw=dw(`apps.call`,1,fw({call:mw(pw(N().transform(e=>Zh(e))))})),Kw={neutral:`alert-neutral`,primary:`alert-primary`,secondary:`alert-secondary`,accent:`alert-accent`,success:`alert-success`,info:`alert-info`,warning:`alert-warning`,error:`alert-error`},qw=(0,W.forwardRef)(function({action:e,children:t,className:n,description:r,title:i,tone:a=`neutral`,...o},s){return(0,G.jsxs)(`div`,{...o,className:de(`alert caps-alert`,Kw[a],n),"data-tone":a,role:o.role??`alert`,ref:s,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[i?(0,G.jsx)(`h3`,{className:`font-semibold`,children:i}):null,r?(0,G.jsx)(`p`,{className:`text-sm`,children:r}):null,t]}),e?(0,G.jsx)(`div`,{className:`shrink-0`,children:e}):null]})}),Jw=P().regex(/^[a-z0-9][a-z0-9-]{0,62}$/),Yw=P().trim().min(1).max(256),Xw=ue(`kind`,[M({kind:j(`platform-container`)}),M({kind:j(`on-box-vm`),hostId:Jw})]),Zw=M({kind:j(`local`),deviceId:P().regex(/^[a-z2-7]{16}$/),publicKey:se().length(44),hostLabel:Yw,folderLabel:Yw}),Qw=ue(`kind`,[...Xw.options,Zw]);function $w(e){switch(e.kind){case`platform-container`:return`container`;case`on-box-vm`:return`vm-${e.hostId}`;case`local`:return`local-${e.deviceId}`}}A(Qw).max(16).refine(e=>new Set(e.map($w)).size===e.length,`attached backend ids must be unique`);var eT=P().regex(/^(container|vm-[a-z0-9][a-z0-9-]{0,62}|local-[a-z2-7]{16})$/),tT=new TextEncoder,nT=131072,rT=16384,iT=Object.freeze({maximumTimeMs:12e4}),aT=b(),oT=P().min(1).max(128).regex(/^[A-Za-z][A-Za-z0-9_]*$/),sT=D().int().min(1).max(65535);M({port:sT}),M({port:sT,exposed:y()}),M({port:sT,removed:y()}),M({ports:A(sT).max(64)});var cT=m(P(),N()).refine(e=>aT.safeParse(e).success,`Capability schema must contain JSON values`);A(M({id:oT,name:oT,kind:P(),description:P(),parameters:cT,output:cT}));var lT=P().min(1).max(4096).startsWith(`/`).refine(e=>!e.includes(`\0`),`Path cannot contain null bytes`),uT=(e=0)=>P().min(e).refine(e=>tT.encode(e).byteLength<=nT,`Text exceeds the ${String(nT)}-byte Computer bound`);M({path:lT}),M({path:lT,content:uT()});var dT=M({path:lT,byteOffset:D().int().nonnegative().optional(),byteLength:D().int().positive().max(nT).optional()});M({path:dT.shape.path,byteOffset:D().int().nonnegative(),content:P(),encoding:j(`base64`),truncated:y()}),M({previewUrl:f(),expiresAt:D().int().positive()});var fT=D().int().min(1).max(256).default(100),pT=D().int().nonnegative().default(0);M({path:lT.default(`/`),limit:fT,offset:pT});var mT=M({name:P(),size:D().int().nonnegative(),modifiedAt:D(),type:O([`file`,`directory`,`symlink`])});M({path:lT,entries:A(mT).max(256),nextOffset:D().int().nonnegative().nullable()});var hT=P().refine(e=>tT.encode(e).byteLength<=nT,`File exceeds the Computer write bound`);M({path:lT,content:hT}),M({path:lT,bytes:D().int().nonnegative()}),M({path:lT,expectedContent:hT,content:hT}),M({path:lT,pattern:P().min(1).max(512),limit:D().int().min(1).max(256).default(256)}),M({path:lT,matches:A(lT).max(256),truncated:y()}),M({path:lT,pattern:P().min(1).max(512),regex:y().default(!1),ignoreCase:y().default(!1),limit:D().int().min(1).max(256).default(256)}),M({path:lT,matches:A(M({path:lT,line:D().int().positive(),text:P()})).max(256),truncated:y()}),M({path:lT,oldText:uT(1),newText:uT()}),M({path:lT,bytes:D().int().nonnegative(),diff:P(),firstChangedLine:D().int().positive().nullable()}),M({path:lT,recursive:y().default(!0)}),M({path:lT});var gT=i({version:`v7`});function _T(e){return M({command:P().min(1).max(rT),cwd:lT.optional(),backend:eT.optional(),timeoutMs:D().int().min(1).max(e.maximumTimeMs).default(1e4)})}_T(iT).extend({requestId:gT});var vT=M({status:O([`completed`,`failed`,`cancelled`]),exitCode:D().int(),stdout:P(),stderr:P(),truncated:y()}),yT=Lw({family:`computer-process`,version:1,kinds:{process:{prefix:`computer_process`}}}).process,bT=P().refine(e=>yT.is(e));M({requestId:P().min(1).max(256),requestScope:P().min(1).max(512),port:sT.optional(),command:P().min(1).max(rT),cwd:lT.optional()}).omit({requestId:!0,requestScope:!0}),M({id:bT});var xT=O([`running`,`exited`,`uncertain`]),ST=O([`synced`,`pending`,`unknown`]),CT=M({id:bT,port:sT.nullable(),command:P(),cwd:P().nullable(),state:xT,exitCode:D().int().nullable(),sync:ST,startedAt:D().int(),endedAt:D().int().nullable()});M({processes:A(CT).max(64)}),M({process:CT,signalled:y()});var wT=O([`accepted`,`running`,`succeeded`,`failed`,`unknown`,`expired`]);M({requestId:gT,status:wT,output:vT.nullable()}).omit({requestId:!0}),O([`files.read`,`files.readBytes`,`files.write`,`files.writeBytes`,`files.list`,`files.glob`,`files.grep`,`files.edit`,`files.patch`,`mkdir`,`bash`,`exec`]);var TT=Lw({family:`inkcap`,version:1,kinds:{document:{prefix:`inkcap_document`}}}),ET=D().int().positive().max(2**53-1),DT=M({computerId:P().min(1).max(256),path:lT.refine(e=>!e.split(`/`).includes(`..`),`Parent path segments are not allowed`)}),OT=DT.extend({id:P().refine(e=>TT.document.is(e),`Invalid document identity`),activity:O([`opened`,`edited`]),occurredAt:D().int().nonnegative().max(2**53-1),sequence:ET});M({limit:D().int().min(1).max(50).default(20),after:M({before:ET}).optional()}),M({rows:A(OT).max(50),next:M({before:ET}).nullable()});var kT=M({recorded:j(!0)}),AT=M({error:j(`not_granted`)});dw(`app.backend`,1,fw({request:mw(pw(N().transform(e=>Zh(e))))}));var jT=dw(`app.methods`,1,fw({call:mw(pw(N().transform(e=>Zh(e))))}));async function MT(e,t,n,r){try{let i=DT.parse({computerId:t,path:n}),a=await e.capabilities.require(jT).call(`documents.${r}`,JSON.stringify(i));if(AT.safeParse(a).success)throw Error(`Document activity was not admitted`);return kT.parse(a),!0}catch(e){return console.error(`Inkcap document activity could not be recorded`,ec(e)),!1}}var NT=P().regex(/^[a-zA-Z0-9._-]{1,128}$/).refine(e=>e!==`.`&&e!==`..`),PT=P().regex(/^[0-9a-f]{40}$/);M({ref:P().startsWith(`refs/`).max(1024),before:PT,after:PT}),P().min(1).max(512);var FT=M({name:P(),email:P()}),IT=M({hash:PT,treeHash:PT,message:P(),author:FT,committer:FT,parents:A(PT),authoredAt:D(),committedAt:D()}),LT=M({name:P(),mode:P(),hash:PT,type:O([`blob`,`tree`,`commit`])}),RT=M({ref:P(),commit:IT,path:P(),entries:A(LT)}),zT=65536,BT=P().min(1).max(1024).refine(e=>!e.startsWith(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)&&e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`&&e!==`.git`),`Choose a relative repository file path.`),VT=P().min(1).max(256),HT={repo:NT,branch:VT,path:BT},UT=O([`pending`,`synced`,`conflict`,`failed`]),WT=M({text:P(),revision:D().int().positive(),state:UT,theirs:M({blob:PT.nullable(),commit:PT}).optional(),failure:O([`branch_missing`,`access_changed`,`sync_failed`,`permanent_material`]).optional()}),GT=M({...HT,baseBlob:PT.nullable(),baseCommit:PT,text:P().max(zT),revision:D().int().positive().nullable()}),KT=_([M({kind:j(`saved`),revision:D().int().positive(),state:j(`pending`)}),M({kind:j(`synced`),revision:D().int().positive(),commit:PT}),M({kind:j(`conflict`),revision:D().int().nonnegative(),theirs:WT.shape.theirs.optional()}),M({kind:j(`failed`),revision:D().int().positive(),reason:O([`branch_missing`,`access_changed`,`sync_failed`,`permanent_material`])}),M({kind:j(`refused`),reason:O([`not-source-writer`,`background-unavailable`])})]),qT=M({...HT,revision:D().int().positive()}),JT=_([M({kind:O([`discarded`,`not_found`])}),M({kind:j(`conflict`),revision:D().int().positive()})]),YT=M({settled:A(M({...HT,result:KT})),more:y()}),XT=M({version:D().int().positive().nullable(),commit:PT,blob:PT.nullable(),pending:WT.optional(),ref:P(),path:P(),size:D(),binary:y(),text:P().nullable()}),ZT=M({ref:P(),commits:A(M({commit:IT,agent:P().nullable()})),next:P().optional()}),QT=M({ref:P(),commit:IT,paths:A(P()),truncated:y()}),$T=M({kind:j(`rebuilding`)}),eE=M({done:y(),cursor:P().nullable()}),tE=_([M({repository:NT,branch:VT,path:BT}),M({path:P().min(1).max(1024)})]);function nE(e){let t=tE.safeParse(Object.fromEntries(e.map(({key:e,value:t})=>[e,t])));return t.success?t.data:null}var rE=Nf(Cp(H({error:V(`too_large`)})));async function iE(e,t){let n,r=()=>n??=e.close(),i=()=>{r().catch(e=>{Cg(`files.read.abort-close`,e)})};t.signal?.addEventListener(`abort`,i,{once:!0});try{t.signal?.throwIfAborted();let n=await e.response();try{let e=Ff(tp(Response))(n);if(e.status===413){let t=rE(await e.text());throw new p(`App file exceeds the read bound`,{code:t._tag===`Some`?`FILE_TOO_LARGE`:`PROTOCOL`,retryable:!1})}if(!e.ok)throw Error(`App file unavailable (${String(e.status)})`);let r=await e.blob();return t.signal?.throwIfAborted(),new File([r],t.name,{type:r.type,lastModified:0})}finally{fC(n)}}finally{t.signal?.removeEventListener(`abort`,i);try{await r()}finally{e[Symbol.dispose]()}}}async function aE(e,t,n){let r,i=()=>r??=e.close(),a=()=>{i().catch(e=>{Cg(`files.write.abort-close`,e)})};n.signal?.addEventListener(`abort`,a,{once:!0});try{n.signal?.throwIfAborted(),await e.write(t.stream())}finally{n.signal?.removeEventListener(`abort`,a);try{await i()}catch(e){Cg(`files.write.remote-close`,e)}try{e[Symbol.dispose]()}catch(e){Cg(`files.write.local-dispose`,e)}}}var oE=H({path:Hf,entries:qf(H({name:Hf,type:Xf([`file`,`directory`,`symlink`]),size:Uf,modifiedAt:Uf})),nextOffset:Zf(Uf)}),sE=dw(`computer.list`,1,fw({list:mw(pw(N().transform(e=>Ff(oE)(e))))})),cE=Yf([H({state:Xf([`running`,`sleeping`,`starting`])}),H({state:V(`queued`),position:Uf.pipe(U(hp()),U(fp(0)))})]),lE=H({enabled:Wf,effective:Wf,blockedBy:Zf(Xf([`team`,`global`]))}),uE=H({computerId:xp,name:xp,runtime:cE,backends:qf(H({id:xp,kind:Xf([`platform-container`,`on-box-vm`,`local`]),status:Xf([`ready`,`queued`,`online`,`offline`]),queuePosition:Zf(Uf.pipe(U(hp()),U(fp(0)))),hostId:Zf(Hf),hostLabel:Zf(Hf),folderLabel:Zf(Hf),detachable:Wf})),internet:lE});dw(`computer.instrument.read`,1,fw({read:mw(pw(N().transform(e=>Ff(uE)(e))))})),dw(`computer.instrument.control`,1,fw({start:mw(pw(N().transform(e=>Ff(cE)(e)))),setInternetAccess:mw(pw(N().transform(e=>Ff(lE)(e)))),detachLocal:mw(pw(N().transform(e=>Ff(H({detached:Wf}))(e))))}));var dE=Yf([H({ports:qf(H({port:Uf.pipe(U(hp()),U(mp({minimum:1,maximum:65535}))),previewUrl:xp,openMode:Xf([`inline`,`external-only`]),expiresAt:Uf.pipe(U(hp()),U(fp(0)))})).pipe(U(yp(64)))}),H({error:V(`port_previews_not_configured`)})]),fE=H({port:Uf.annotate({message:`Use a port from 1 to 65535.`}).check(hp({message:`Use a port from 1 to 65535.`}),mp({minimum:1,maximum:65535},{message:`Use a port from 1 to 65535.`})),exposed:Wf}),pE=H({port:Uf.pipe(U(hp()),U(mp({minimum:1,maximum:65535}))),removed:Wf});dw(`computer.ports`,2,fw({list:mw(pw(N().transform(e=>Ff(dE)(e)))),expose:mw(pw(N().transform(e=>Ff(fE)(e)))),unexpose:mw(pw(N().transform(e=>Ff(pE)(e))))}));var mE=Xf([`synced`,`pending`,`unknown`]),hE=H({port:Zf(fE.fields.port),id:xp,command:xp,cwd:Zf(Hf),startedAt:Uf.pipe(U(hp()),U(pp(0))),state:Xf([`running`,`exited`,`uncertain`]),exitCode:Zf(Uf.pipe(U(hp()))),sync:mE,endedAt:Zf(Uf.pipe(U(hp()),U(pp(0))))}),gE=H({processes:qf(hE)}),_E=H({process:hE,signalled:Wf});H({requestId:xp.pipe(U(yp(256))),command:xp.pipe(U(yp(16384))),cwd:Lf(Hf),port:Lf(fE.fields.port)}),dw(`computer.processes`,1,fw({start:mw(pw(N().transform(e=>Ff(hE)(e)))),list:mw(pw(N().transform(e=>Ff(gE)(e)))),kill:mw(pw(N().transform(e=>Ff(_E)(e))))}));var vE=dw(`computer.readFile`,1,fw({open:mw(fw({response:mw(te(Response)),close:hw}))}));async function yE(e,t,n){return await iE(await e.require(vE).open(t),{...n,name:t.path.split(`/`).at(-1)??`file`})}async function bE(e,t){return Ff(oE)(await e.require(sE).list(t))}var xE=dw(`computer.writeFile`,3,fw({open:mw(fw({write:hw,close:hw})),mkdir:hw,replace:mw(pw(N().transform(e=>Ff(SE)(e))))})),SE=Yf([H({kind:V(`replaced`),path:xp,bytes:Uf.pipe(U(hp()),U(pp(0)))}),H({kind:V(`conflict`)})]);async function CE(e,t,n){n.signal?.throwIfAborted();let r=await e.require(xE).replace(t);if(r.kind===`conflict`)throw new p(`Computer file changed since it was opened`,{code:`CONFLICT`,retryable:!1});return{path:r.path,bytes:r.bytes}}var wE=H({computerName:xp.pipe(U(yp(256))),teamName:xp.pipe(U(yp(256))),modelDoor:xp.pipe(U(yp(256))),uptimeSeconds:Uf.pipe(U(hp()),U(pp(0))),version:xp.pipe(U(yp(64)))});dw(`computer.terminal`,2,fw({open:mw(fw({information:mw(pw(N().transform(e=>Ff(wE)(e)))),output:mw(te(ReadableStream).transform(e=>e.pipeThrough(new TransformStream({transform(e,t){t.enqueue(te(Uint8Array).parse(e))}})))),input:mw(te(WritableStream)),resize:hw,close:hw}))}));async function TE(e,t,n){await aE(await e.require(xE).open({path:t.path}),t.content,n)}var EE={entries:[],index:-1};function DE(e,t){if(t.type===`visit`){if(e.entries[e.index]===t.key)return e;let n=[...e.entries.slice(0,e.index+1),t.key];return{entries:n,index:n.length-1}}if(t.type===`remove`){let n=[],r=-1;return e.entries.forEach((i,a)=>{i!==t.key&&(n.at(-1)!==i&&n.push(i),a<=e.index&&(r=n.length-1))}),{entries:n,index:n.length?Math.max(0,r):-1}}let n=e.index-1;return n<0||n>=e.entries.length?e:{...e,index:n}}var OE={id:`new-draft`,title:`New Draft`,category:`File`,description:`Create a new draft in Inkcap`,projections:{bindings:{values:[`<leader> n`],order:0},menu:{order:0},palette:{order:0}},action:{presentation:{type:`action`}}},kE={id:`save`,title:`Save`,category:`File`,description:`Save the focused Inkcap document`,projections:{bindings:{values:[`mod+s`],order:1},menu:{order:1},palette:{order:1}},action:{presentation:{type:`action`}}},AE={id:`open-file`,title:`Open File`,category:`File`,description:`Open a file handed off by another App`,projections:{menu:{order:2}},action:{inputSchema:{type:`object`,properties:{computerId:{type:`string`},path:{type:`string`}},required:[`computerId`,`path`],additionalProperties:!1},presentation:{type:`action`}}},jE=H({computerId:Hf.check(gp(1),yp(256)),path:Hf.check(gp(1),yp(1024))});function ME(e,t){let n=(0,W.useRef)();(0,W.useEffect)(()=>(n.current={app:e,binding:t},()=>{n.current=void 0}),[e,t]);let r=t.save?.()?.availability(),i=r?.status??`unavailable`,a=r?.status===`unavailable`?r.reason:r?void 0:`No focused savable dirty document.`;sw(e,{sourceId:`inkcap-file`,namespace:`inkcap`},(0,W.useCallback)(()=>{let t=t=>{if(!(!e||t?.aborted||n.current?.app!==e||!NE(e)))return n.current.binding};return[{...OE,handler:({signal:e})=>{t(e)?.newDraft()}},{...kE,availability:()=>i===`available`?{status:`available`}:{status:`unavailable`,reason:a??`No focused savable dirty document.`},handler:async({signal:e})=>{let n=t(e);if(!n)return;let r=n.save?.();if(!r)throw Error(`No focused savable dirty document.`);let i=r.availability();if(i.status===`unavailable`)throw Error(i.reason);if(!await r.save())throw Error(`No focused savable dirty document.`)}},{...AE,handler:async({arguments:e,signal:n})=>{let r=t(n);if(!r)return;if(!r.openFile)throw Error(`Inkcap is not ready to open a handed-off file.`);let i;try{i=Ff(jE,{onExcessProperty:`error`})(e)}catch(e){throw Error(`Inkcap open-file arguments are invalid.`,{cause:e})}await r.openFile(i)}}]},[e,i,a]))}function NE(e){let t=e.lifecycle.get();return t!==`disposing`&&t!==`disposed`&&t!==`disconnected`}var PE=new Map([[`png`,`image/png`],[`jpg`,`image/jpeg`],[`jpeg`,`image/jpeg`],[`gif`,`image/gif`],[`webp`,`image/webp`],[`svg`,`image/svg+xml`],[`avif`,`image/avif`]]),FE=new Map([[`mp4`,`video/mp4`],[`webm`,`video/webm`]]);function IE(e){return PE.get(e.split(`.`).pop()?.toLowerCase()??``)}function LE(e){return FE.get(e.split(`.`).pop()?.toLowerCase()??``)}function RE(e){let t=IE(e);if(t)return{kind:`image`,mediaType:t};let n=LE(e);if(n)return{kind:`video`,mediaType:n}}function zE(e){return e.toLowerCase().endsWith(`.md`)}async function BE(e,t){let n=t?.revision,r=await(await e()).arrayBuffer();if(t?.closed)return{kind:`closed`};if(t&&t.revision!==n)return{kind:`changed`};try{return{kind:`ready`,contents:new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0}).decode(r)}}catch{return{kind:`invalid-text`}}}async function VE(e,t){let n=t?.revision,r=await e();return t?.closed?{kind:`closed`}:t&&t.revision!==n?{kind:`changed`}:{kind:`ready`,blob:r}}async function HE(e,t,n,r){let i=()=>yE(e.capabilities,{path:t},{signal:n}),a=RE(t);if(a){let e=await VE(i,r);return e.kind===`ready`?{kind:a.kind,blob:e.blob.slice(0,e.blob.size,a.mediaType)}:e}let o=await BE(i,r);return o.kind===`ready`?{kind:`text`,contents:o.contents}:o}var UE=u(`FileCode2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`m5 12-3 3 3 3`,key:`oke12k`}],[`path`,{d:`m9 18 3-3-3-3`,key:`112psh`}]]),WE=u(`FilePlus2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M3 15h6`,key:`4e2qda`}],[`path`,{d:`M6 12v6`,key:`1u72j0`}]]),GE=u(`FolderOpen`,[[`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`}]]),KE=u(`GitBranch`,[[`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`}]]),qE=u(`History`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),JE=u(`PanelLeft`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),YE={2:`h2`,3:`h3`,4:`h4`};function XE(e,t){let{reduced:n}=t,r=e&&!n,i=ne(t,600),[a,o]=(0,W.useState)(r);return(0,W.useEffect)(()=>{if(o(r),!r)return;let e=globalThis.setTimeout(()=>{o(!1)},i);return()=>{globalThis.clearTimeout(e)}},[r,i]),a}var ZE=(0,W.forwardRef)(function({actions:e,className:t,description:n,headingLevel:r=2,suggestions:i,thinking:a=!1,title:o,visual:s,renderVisual:c,variant:u=`plain`,...d},f){let p=(0,W.useId)(),m=(0,W.useRef)(null),h=l(m),g=XE(u===`speech`,h)&&!a,_=YE[r],v=c?c({speaking:g,thinking:a}):s,y=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(_,{ref:m,className:`empty-state-title`,id:d[`aria-labelledby`]?void 0:p,children:o}),(0,G.jsx)(`p`,{children:n}),i&&i.length>0?(0,G.jsx)(`ul`,{"aria-label":`Try one of these`,className:`empty-state-suggestions`,children:i.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsx)(x,{size:`sm`,variant:`outline`,onClick:e.onSelect,children:e.label})},e.label))}):null,e?(0,G.jsx)(`div`,{className:`empty-state-actions`,children:e}):null]});return(0,G.jsxs)(`section`,{...d,"aria-labelledby":d[`aria-labelledby`]??p,className:de(`empty-state`,u!==`plain`&&`empty-state-${u}`,t),ref:f,children:[v?(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`empty-state-visual`,children:v}):null,u===`speech`?(0,G.jsx)(`div`,{className:`empty-state-bubble`,children:y}):y]})}),QE=(0,W.createContext)(null),$E=(0,W.forwardRef)(function({children:e,defaultValue:t,onValueChange:n,value:r,...i},a){let[o,s]=(0,W.useState)(t),c=r??o,l=(0,W.useId)(),u=e=>{r===void 0&&s(e),n?.(e)},d=(e,t)=>`${l}-${e}-${encodeURIComponent(t)}`;return(0,G.jsx)(QE.Provider,{value:{onValueChange:u,panelId:e=>d(`panel`,e),selectedValue:c,tabId:e=>d(`tab`,e)},children:(0,G.jsx)(`div`,{...i,className:de(`w-full`,i.className),ref:a,children:e})})});function eD(){let e=(0,W.useContext)(QE);if(!e)throw Error(`Tabs parts must be used inside <Tabs>`);return e}var tD=(0,W.forwardRef)(function({className:e,variant:t=`bordered`,...n},r){return(0,G.jsx)(`div`,{...n,"aria-orientation":n[`aria-orientation`]??`horizontal`,className:de(t===`segmented`?`tabs caps-tabs-segmented w-full`:`tabs tabs-border flex w-full items-center gap-xs`,e),"data-variant":t,ref:r,role:`tablist`})}),nD=(0,W.forwardRef)(function({className:e,disabled:t,onClick:n,onKeyDown:r,value:i,...a},o){let s=eD(),c=s.selectedValue===i,l=e=>{let t=e.currentTarget.closest(`[role="tablist"]`);if(!(t instanceof HTMLElement))return;let n=Array.from(t.querySelectorAll(`[role="tab"]`)).filter(e=>!e.disabled&&e.getAttribute(`aria-disabled`)!==`true`),r=n.indexOf(e.currentTarget);if(r<0||n.length===0)return;let a;if(e.key===`ArrowRight`)a=(r+1)%n.length;else if(e.key===`ArrowLeft`)a=(r-1+n.length)%n.length;else if(e.key===`Home`)a=0;else if(e.key===`End`)a=n.length-1;else return;e.preventDefault();let o=n[a];o?.focus(),o&&s.onValueChange(o.dataset.tabValue??i)};return(0,G.jsx)(`button`,{...a,"aria-controls":s.panelId(i),"aria-disabled":t?!0:void 0,"aria-selected":c,className:de(`tab whitespace-nowrap text-base-content transition-colors focus-visible:outline-none focus-visible:ring-2 caps-focus-color`,c&&`tab-active`,e),"data-tab-value":i,disabled:t,id:s.tabId(i),onClick:e=>{n?.(e),!e.defaultPrevented&&!t&&s.onValueChange(i)},onKeyDown:e=>{r?.(e),e.defaultPrevented||l(e)},ref:o,role:`tab`,tabIndex:t?-1:c?0:-1,type:a.type??`button`})}),rD=(0,W.forwardRef)(function({children:e,className:t,forceMount:n=!1,value:r,...i},a){let o=eD(),s=o.selectedValue===r;return!s&&!n?null:(0,G.jsx)(`div`,{...i,"aria-labelledby":o.tabId(r),className:de(`mt-md focus-visible:outline-none`,t),hidden:!s,id:o.panelId(r),ref:a,role:`tabpanel`,tabIndex:0,children:e})}),iD=(0,W.forwardRef)(function({tone:e=`neutral`,size:t=`md`,pressed:n=!1,className:r,...i},a){return(0,G.jsx)(`kbd`,{...i,ref:a,className:de(`caps-keycap`,r),"data-tone":e,"data-size":t,"data-pressed":n})});(0,W.forwardRef)(function({label:e,shortcut:t,icon:n,readout:r,tone:i=`neutral`,pressed:a,expanded:o,className:s,type:c=`button`,...l},u){let d=a??o;return(0,G.jsxs)(`button`,{...l,ref:u,type:c,className:de(`caps-keycap-button`,s),"data-tone":i,"aria-pressed":a,"aria-expanded":o,"aria-keyshortcuts":l[`aria-keyshortcuts`]??t,children:[d===void 0?null:(0,G.jsx)(`span`,{className:`caps-keycap-led`,"data-lit":d,"aria-hidden":`true`}),n?(0,G.jsx)(`span`,{className:`caps-keycap-button-icon`,"aria-hidden":`true`,children:n}):null,e===null?null:(0,G.jsx)(`span`,{className:`caps-keycap-button-label`,children:e}),r,t?(0,G.jsx)(iD,{size:`sm`,tone:`neutral`,"aria-hidden":`true`,children:t}):null]})});function aD(e,t){let n=e.trim();return n.startsWith(`/`)?n:`${t.endsWith(`/`)?t:`${t}/`}${n}`}function oD(e){if(e.endsWith(`/`))return e.replace(/\/+$/,``)||`/`;let t=e.lastIndexOf(`/`);return t<=0?`/`:e.slice(0,t)}var sD=`modulepreload`,cD=function(e,t){return new URL(e,t).href},lD={},uD=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=cD(t,n),t=s(t),t in lD)return;lD[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:sD,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},dD=(0,W.lazy)(async()=>({default:(await uD(()=>import(`./FileTab-bwd_G6y3.js`),__vite__mapDeps([0,1,2,3]),import.meta.url)).FileTab})),fD=(0,W.lazy)(async()=>({default:(await uD(()=>import(`./InkcapFileTree-Cx3HsaWr.js`),__vite__mapDeps([4,1,2,3]),import.meta.url)).InkcapFileTree}));function pD({model:e}){let[t,r]=(0,W.useState)(!0),[i,o]=(0,W.useState)(!1),[s,c]=(0,W.useState)(!1),l=(0,W.useRef)(null);(0,W.useEffect)(()=>{let e=l.current;if(!e||!(`ResizeObserver`in globalThis))return;let t=()=>{o(e.clientWidth<=576)},n=new ResizeObserver(t);return t(),n.observe(e),()=>{n.disconnect()}},[]);let[u,d]=(0,W.useState)(!1),[f,p]=(0,W.useState)(null),m=(0,W.useId)(),g=e.sourceLabel??e.context.computerName??`Computer`,_=e.tabs.filter(e=>e.dirty).length;ow(e.connection?.app,[{kind:`text`,id:`documents`,text:`${String(e.tabs.length)} ${e.tabs.length===1?`open file`:`open files`}`},{kind:`text`,id:`save`,text:_?`${String(_)} unsaved`:e.downloadedFile?.tabKey===e.active?`Downloaded ${e.downloadedFile.name}`:e.repositoryStatus??(e.tabs.length?`All changes saved`:`Ready`),end:!0}]);let y=e.tabs.find(t=>t.tabKey===e.active);(0,W.useEffect)(()=>{p(null)},[e.selectedConnection?.app.identity.surfaceId,e.context.computerId,e.context.projectPath]),(0,W.useEffect)(()=>{t&&e.selectedConnection&&e.context.computerId!==null&&e.canList&&d(!0)},[t,e.canList,e.context.computerId,e.selectedConnection]);let b=e.fileTree?.(t=>{e.onOpenFile(t),c(!1)})??(0,G.jsx)(mD,{model:e,treeLoadRequested:u,active:y,computer:g,onOpenFile:t=>{e.onOpenFile(t),c(!1)},onSelectPath:p,onDismissExplorerDialog:()=>{c(!1)}});return(0,G.jsxs)(`main`,{ref:l,className:`inkcap-app`,"aria-label":`Inkcap editor`,onKeyDown:e=>{e.nativeEvent.composedPath().some(e=>e instanceof HTMLElement&&e.isContentEditable)&&e.stopPropagation()},children:[e.error?(0,G.jsx)(qw,{className:`inkcap-notice`,tone:`error`,title:`Couldn't complete that action`,description:e.error}):null,(0,G.jsxs)(`div`,{className:`inkcap-work`,"data-explorer":t,children:[i?(0,G.jsx)(ce,{open:s,onOpenChange:c,children:(0,G.jsxs)(`div`,{className:`inkcap-explorer-rail`,children:[(0,G.jsx)(v,{render:(0,G.jsx)(n,{size:`sm`,icon:(0,G.jsx)(JE,{}),"aria-label":`Open file explorer`})}),(0,G.jsxs)(ie,{className:`inkcap-explorer-dialog`,children:[(0,G.jsxs)(k,{children:[(0,G.jsx)(oe,{children:`File explorer`}),(0,G.jsx)(ee,{children:`Browse files on ${e.sourceLabel??(!e.selectedConnection||e.context.computerId===null?`your Computer`:g)}.`})]}),b,(0,G.jsx)(h,{children:(0,G.jsx)(re,{render:(0,G.jsx)(x,{variant:`outline`}),children:`Close explorer`})})]})]})}):(0,G.jsx)(`div`,{className:`inkcap-explorer`,id:`${m}-explorer`,hidden:!t,children:b}),(0,G.jsxs)($E,{className:`inkcap-editors`,value:e.active===null?``:String(e.active),onValueChange:t=>{let n=e.tabs.find(e=>String(e.tabKey)===t);n&&e.onActivate(n.tabKey)},children:[(0,G.jsxs)(`div`,{className:`inkcap-tab-bar`,children:[i?null:(0,G.jsx)(n,{size:`xs`,variant:`ghost`,className:`inkcap-explorer-toggle`,icon:(0,G.jsx)(JE,{}),"aria-label":`Toggle file explorer`,title:t?`Hide file explorer`:`Show file explorer`,"aria-expanded":t,"aria-controls":`${m}-explorer`,onClick:()=>{r(e=>!e)}}),(0,G.jsx)(tD,{className:`inkcap-tabs gap-0`,"aria-label":`Editor tabs`,children:e.tabs.map(t=>(0,G.jsxs)(W.Fragment,{children:[(0,G.jsxs)(nD,{className:`inkcap-tab`,value:String(t.tabKey),title:t.connection?.source?`${t.path} · ${t.connection.source.label}`:t.path,children:[(0,G.jsx)(UE,{"aria-hidden":`true`}),(0,G.jsx)(`span`,{children:t.path.split(`/`).at(-1)}),t.dirty?(0,G.jsx)(`span`,{className:`inkcap-dirty`,"aria-label":`Unsaved changes`}):null]}),(0,G.jsx)(n,{size:`xs`,variant:`ghost`,icon:(0,G.jsx)(a,{}),"aria-label":`Close ${t.path}`,onClick:()=>{e.onClose(t.tabKey)}})]},t.tabKey))}),(0,G.jsx)(`div`,{className:`inkcap-tab-actions`,children:(0,G.jsx)(n,{icon:(0,G.jsx)(WE,{}),"aria-label":`New draft`,title:`New draft (⌘K, then N)`,onClick:e.onNewDraft})})]}),e.tabs.map(t=>(0,G.jsx)(W.Suspense,{fallback:(0,G.jsx)(`p`,{role:`status`,children:`Opening editor…`}),children:(0,G.jsx)(dD,{activityNotice:e.activityNotice?.path===t.path&&e.activityNotice.computerId===t.computerId,onDismissActivityNotice:e.onDismissActivityNotice,path:t.path,initial:t.initial,active:e.active===t.tabKey,narrow:i,local:t.connection===null,savable:t.connection===null||hD(t.connection),sourceLabel:(t.connection??e.selectedConnection)?.source?.kind===`repository`?(t.connection??e.selectedConnection)?.source?.label:void 0,previewUrl:t.previewUrl,previewKind:t.previewKind,target:t.target,syncConflict:t.connection?.source!==void 0&&e.repositoryStates?.get(`${t.connection.source.id}:${t.path}`)?.kind===`conflict`,tabKey:t.tabKey,onSaveBinding:e.onSaveBinding,onReopen:t.connection===null?void 0:()=>{e.onReopen(t)},onSaveAs:async(n,r)=>{let i=f&&e.selectedConnection&&(t.connection===null||t.connection===e.selectedConnection)?oD(f):t.path.startsWith(`/`)?oD(t.path):e.context.projectPath,a=(t.connection??e.selectedConnection)?.source?.kind===`repository`?BT.parse(n.trim()):t.connection||e.selectedConnection?aD(n,i):n.trim();return await e.onSaveAs(t,a,r),a},onPathChange:n=>{e.onPathChange(t,n)},onStatus:(n,r)=>{e.onStatus(t,n,r)},write:(n,r)=>e.onWrite(t,n,r),overwrite:n=>e.onOverwrite(t,n),readCurrent:n=>e.onReadCurrent(t,n)})},t.tabKey)),e.tabs.length===0?(0,G.jsx)(ZE,{className:`inkcap-empty`,variant:`panel`,visual:(0,G.jsx)(UE,{className:`inkcap-empty-icon`}),title:`A little room to think.`,description:`Open a file${e.canList?` from the explorer`:``}, or start with a blank page.`,actions:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(x,{size:`sm`,onClick:e.onNewDraft,children:`New draft`}),(0,G.jsxs)(`span`,{className:`inkcap-shortcut`,children:[(0,G.jsx)(iD,{size:`sm`,children:_D()}),(0,G.jsx)(`span`,{children:`then`}),(0,G.jsx)(iD,{size:`sm`,children:`N`})]})]})}):null]})]}),(0,G.jsx)(gD,{open:e.windowClosing||e.closing!==null,all:e.windowClosing,reviewWhileSaving:e.windowClosing?e.tabs.some(e=>e.connection?.source?.kind===`repository`):e.tabs.some(t=>t.tabKey===e.closing&&t.connection?.source?.kind===`repository`),busy:e.windowCloseSaving||e.tabs.some(t=>t.tabKey===e.closing&&t.target.saving),error:e.error,onSave:e.windowClosing?e.onSaveWindowClose:()=>{e.closing!==null&&e.onSaveClose(e.closing)},onDiscard:e.windowClosing?e.onDiscardWindowClose:()=>{e.closing!==null&&e.onDiscardClose(e.closing)},onCancel:e.windowClosing?e.onCancelWindowClose:e.onCancelClose})]})}function mD({model:e,treeLoadRequested:t,active:n,computer:r,onOpenFile:i,onSelectPath:a,onDismissExplorerDialog:o}){return!e.selectedConnection||e.context.computerId===null||!e.canList?(0,G.jsx)(ZE,{className:`inkcap-tree inkcap-access`,"aria-label":`File tree`,variant:`panel`,visual:(0,G.jsx)(GE,{"aria-hidden":`true`}),title:e.selectedConnection?e.context.computerId===null?`No Computer selected`:`Files unavailable`:`No Computer connected`,description:e.selectedConnection?e.context.computerId===null?`No Computer is attached to this window. You can still write a draft.`:`File access isn't granted. Your open documents remain available.`:`No Computer is attached to this window. You can still write a draft.`,actions:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(x,{className:`whitespace-nowrap`,size:`sm`,onClick:e.onNewDraft,children:`New draft`}),e.connection&&e.context.computerId===null&&(0,G.jsx)(x,{className:`whitespace-nowrap`,size:`sm`,variant:`outline`,onClick:()=>{o(),e.onChooseComputer()},children:`Choose Computer`})]})}):t?(0,G.jsx)(W.Suspense,{fallback:(0,G.jsx)(`aside`,{className:`inkcap-tree inkcap-access`,role:`status`,children:`Loading files…`}),children:(0,G.jsx)(fD,{app:e.selectedConnection.app,rootPath:e.context.projectPath,rootLabel:r,activePath:n?.connection===e.selectedConnection&&n.computerId===e.context.computerId?n.path:null,onOpenFile:i,onSelectPath:a},`${e.selectedConnection.app.identity.surfaceId}:${e.context.computerId}:${e.context.projectPath}`)}):(0,G.jsx)(`aside`,{className:`inkcap-tree inkcap-access`,role:`status`,children:`Loading files…`})}function hD(e){let t=e.app.lifecycle.get();return t!==`disposing`&&t!==`disposed`&&t!==`disconnected`}function gD({open:e,all:t,busy:n,reviewWhileSaving:r,error:i,onSave:a,onDiscard:o,onCancel:s}){return(0,G.jsx)(ce,{open:e&&!(r&&n),onOpenChange:e=>{!e&&!n&&s()},children:(0,G.jsxs)(ie,{children:[(0,G.jsxs)(k,{children:[(0,G.jsx)(oe,{children:t?`Close Inkcap with unsaved changes`:`Unsaved changes`}),(0,G.jsx)(ee,{children:t?`Save your changed documents before closing Inkcap?`:`Save your changes before closing this document?`})]}),i?(0,G.jsx)(qw,{tone:`error`,title:`Couldn't save`,description:i}):null,(0,G.jsxs)(h,{children:[(0,G.jsx)(x,{variant:`ghost`,size:`sm`,disabled:n,onClick:s,children:`Cancel`}),(0,G.jsx)(x,{variant:`ghost`,size:`sm`,disabled:n,onClick:o,children:`Discard`}),(0,G.jsx)(x,{size:`sm`,disabled:n,onClick:a,children:n?`Saving…`:t?`Save all`:`Save`})]})]})})}function _D(){return/Mac|iPhone|iPad/u.test(navigator.userAgent)?`⌘ K`:`Ctrl K`}var vD={computerId:null,computerName:null,projectPath:`/`},yD={read:(e,t,n,r)=>HE(e,t,n,r),replace:async(e,t,n)=>{await CE(e.capabilities,t,{signal:n})},write:async(e,t,n,r)=>{await TE(e.capabilities,{path:t,content:new Blob([n],{type:`text/plain;charset=utf-8`})},{signal:r})}};function bD(e){let t=e.app.lifecycle.get();return t!==`disposing`&&t!==`disposed`&&t!==`disconnected`}function xD(e,t,n,r,i){return!e.aborted&&bD(t)&&(t.source?.kind===`repository`||t.app.context.get().computerId===i)&&(n!==void 0||r===t)}function SD(e,t,n,r){let i=t===void 0?void 0:n.find(e=>e.tabKey===t),a=i?.connection??r;if(!a||!bD(a))return null;let o=a.source?.kind===`repository`?null:a.app.context.get().computerId;if(i&&a.source?.kind!==`repository`&&i.computerId!==o)return null;let s=n.find(t=>t.path===e&&t.connection===a&&t.computerId===o);return t!==void 0&&!i?null:{selected:a,replacement:i,existing:s}}function CD(e,t,n,r,i,a,o,s,c){let l=wD(e,t,r,i);if(l){o(l);return}a!==void 0&&s(r,a),o(``),(e.kind===`image`||e.kind===`video`)&&c(t,``,n,URL.createObjectURL(e.blob),e.kind),e.kind===`text`&&c(t,e.contents,n)}function wD(e,t,n,r){if(e.kind===`changed`||e.kind===`closed`)return e.kind===`changed`?`Reopen cancelled because this tab changed during the read. Your edits remain open.`:`Reopen cancelled because this tab was closed.`;let i=n!==void 0&&n.target.revision!==r;if(n?.target.closed||i)return i?`Reopen cancelled because this tab changed during the read. Your edits remain open.`:`Reopen cancelled because this tab was closed.`;if(e.kind===`invalid-text`)return`The file ${t} is not valid UTF-8 text. Existing edits remain open.`}function TD({connection:e,context:t=vD,files:n=yD}){let r=kp();function i(e){return e.source??{kind:`computer`,id:e.app.context.get().computerId??``,label:`Computer`,read:(t,r,i)=>n.read(e.app,t,r,i),replace:(t,r,i,a)=>n.replace(e.app,{path:t,content:r,expectedContent:i},a),write:(t,r,i)=>n.write(e.app,t,r,i)}}let a=aw(e?.app),o=iw(e?.app)?.openRequest,s=(0,W.useRef)(new Set),c=e?{...t,computerId:a,computerName:t.computerId===a?t.computerName:null}:t,[l,u]=(0,W.useState)([]),[d,f]=(0,W.useReducer)(DE,EE),m=d.entries[d.index]??null,h=(0,W.useCallback)(()=>d.index<=0?!1:(f({type:`back`}),!0),[d.index]);cw(e?.app.window.navigation,{canGoBack:d.index>0,onBack:h});let g=(0,W.useCallback)(e=>{f({type:`visit`,key:e})},[]),[_,v]=(0,W.useState)(null),[y,b]=(0,W.useState)(!1),[x,S]=(0,W.useState)(!1),[C,w]=(0,W.useState)(``),[T,ee]=(0,W.useState)(null),[te,ne]=(0,W.useState)(null),E=(0,W.useRef)([]),D=(0,W.useRef)(0),re=(0,W.useRef)(new Set),O=(0,W.useRef)(new Set),k=(0,W.useRef)(e),A=(0,W.useRef)(null),j=(0,W.useRef)(new Map),ie=(0,W.useRef)(()=>Promise.reject(Error(`Inkcap is not ready to open a handed-off file.`))),ae=(0,W.useRef)(null);A.current=m,(0,W.useEffect)(()=>{k.current=e,ne(null);let t=e?.app.lifecycle.subscribe(t=>{(t===`disposing`||t===`disposed`||t===`disconnected`)&&k.current===e&&(k.current=null)});return()=>t?.()},[e,a]),(0,W.useEffect)(()=>()=>{ae.current?.resolve(!1),ae.current=null,k.current=null,j.current.clear();for(let e of re.current)e.abort();re.current.clear()},[]),E.current=l,(0,W.useEffect)(()=>()=>{for(let e of E.current)e.previewUrl&&URL.revokeObjectURL(e.previewUrl)},[]);let oe=(0,W.useCallback)((e,t,n,r,i,a=!0)=>{let o=++D.current,s=n?.source?.kind===`repository`?null:n?.app.context.get().computerId??null;u(a=>[...a,{tabKey:o,path:e,initial:t,connection:n,computerId:s,previewUrl:r,previewKind:i,dirty:!1,target:{revision:0,closed:!1,dirty:!1,saving:!1}}]),a&&g(o)},[g]),se=(0,W.useCallback)(()=>{oe(`Untitled ${String(D.current+1)}`,``,null)},[oe]),ce=(0,W.useCallback)(()=>{let e=A.current;return e===null?void 0:j.current.get(e)},[]);ME(e?.app??null,{newDraft:se,save:ce,openFile:e=>ie.current(e)});function le(e){e.previewUrl&&URL.revokeObjectURL(e.previewUrl)}function ue(e,t){e&&(e.target.closed=!0,le(e),u(e=>e.filter(e=>e.tabKey!==t)),f({type:`remove`,key:t}))}async function M(e,t,n,r){if(e.source?.kind===`repository`||t===null)return;let i=await MT(e.app,t,n,r);k.current===e&&e.app.context.get().computerId===t&&bD(e)&&ne(i?null:{computerId:t,path:n})}async function N(e,t,n=!1){let r=SD(e,t,l,k.current);if(!r)return;let{selected:a,replacement:o,existing:s}=r,c=a.source?.kind===`repository`?null:a.app.context.get().computerId;if(s&&t===void 0){g(s.tabKey);return}if(t!==void 0&&!o)return;let u=`${a.app.identity.surfaceId}:${a.source?.id??c??``}:${e}`;if(O.current.has(u))return;let d=o?.target.revision;O.current.add(u);let f=new AbortController;re.current.add(f);try{let r=await i(a).read(e,f.signal,o?.target);if(!xD(f.signal,a,t,k.current,c))return;let s=!wD(r,e,o,d);CD(r,e,a,o,d,t,w,ue,(e,r,i,a,o)=>{oe(e,r,i,a,o,!n||A.current===t)}),!n&&s&&await M(a,c,e,`opened`)}catch(t){console.error(`Inkcap file read failed`,t),f.signal.aborted||w(t instanceof p&&t.code===`FILE_TOO_LARGE`?a.source?.kind===`repository`?`This repository file is too large to edit in Inkcap. Choose a smaller file. Existing edits remain open.`:`This file is too large to preview in Inkcap. Choose a smaller file. Existing edits remain open.`:`Could not read ${e}. Access may be denied or ${a.source?.label??`the Computer`} unavailable. Existing edits remain open.`)}finally{re.current.delete(f),O.current.delete(u)}}ie.current=async({computerId:e,path:t})=>{if(k.current?.source?.kind===`repository`)throw Error(`Open Computer file handoffs in the Computer source.`);if(k.current?.app.context.get().computerId!==e)throw Error(`The handed-off file belongs to a different admitted Computer.`);await N(t)};function P(e,t=!1){let n=l.find(t=>t.tabKey===e);if(n){if(n.target.saving){w(`Wait for this save to finish before closing. Your edits remain open.`);return}if(n.target.dirty&&!t){v(e),w(``);return}n.target.closed=!0,le(n),v(t=>t===e?null:t),u(t=>t.filter(t=>t.tabKey!==e)),f({type:`remove`,key:e})}}(0,W.useEffect)(()=>{if(!e||o?.kind!==`navigate`)return;let t=nE(o.params);if(t===null||`repository`in t)return;let n=JSON.stringify([e.app.identity.surfaceId,o.requestId]);if(s.current.has(n))return;if(s.current.add(n),s.current.size>64){let e=s.current.values().next().value;e!==void 0&&s.current.delete(e)}let r=DT.safeParse({computerId:a,path:t.path});if(!r.success||e.source?.kind===`repository`){w(`This Recent File is unavailable on the current Computer source.`);return}let i=!0;return ie.current(r.data).catch(t=>{console.error(`Inkcap Recent File could not be opened`,ec(t)),i&&k.current===e&&w(`This Recent File could not be opened. Your existing documents remain open.`)}),()=>{i=!1}},[e,a,o]);async function de(e,t,n){if(!bD(e))throw Error(`${e.source?.label??`Computer`} disconnected`);if(e.source?.kind!==`repository`&&(t===null||e.app.context.get().computerId!==t)){let e=`Select this file's original Computer before saving or reloading. Your edits remain open.`;throw w(e),Error(e)}let r=new AbortController;re.current.add(r);try{return await n(r.signal)}finally{re.current.delete(r)}}function fe(e,t,n,r){return de(e,t,async a=>{await i(e).write(n,r,a),await M(e,t,n,`edited`)})}async function pe(e,t,n){let r=k.current?.app;if(!r)throw Error(`Download requires a connected App host.`);let i=t.split(`/`).at(-1)??t,a=/\.[^.]+$/.test(i)?i:`${i}.txt`,o=await r.ui.requestBrowserAction({kind:`saveFile`,name:a,mime:`text/plain;charset=utf-8`,bytes:new TextEncoder().encode(n)});if(o.kind===`refused`)throw Error(`Download refused: ${o.reason}`);if(o.kind!==`saved`)throw Error(`The App host did not accept this download.`);ee({tabKey:e.tabKey,name:a})}function me(e,t={}){let n=e.connection;if(n){if(e.target.saving){w(`Wait for this save to finish before reopening.`);return}if(e.target.dirty){w(`Save your edits before reopening this file.`);return}if(!bD(n)){w(`Computer disconnected. Existing edits remain open.`);return}if(n.source?.kind!==`repository`&&n.app.context.get().computerId!==e.computerId){w(`Select this file's original Computer before reopening. Existing edits remain open.`);return}N(e.path,e.tabKey,t.background)}}let F=e,he=F?.app.capabilities.has(sE)??!1,ge=(0,W.useCallback)((e,t)=>{t?j.current.set(e,t):j.current.delete(e)},[]),_e=(0,W.useCallback)(e=>{let t=ae.current;ae.current=null,b(!1),S(!1),t?.resolve(e)},[]),ve=(0,W.useCallback)(()=>{let e=ae.current;if(e)return e.promise;if(!E.current.some(e=>e.target.dirty))return Promise.resolve(!0);if(E.current.some(e=>e.target.saving))return w(`Wait for the current save to finish before closing Inkcap.`),Promise.resolve(!1);let t,n=new Promise(e=>{t=e});return ae.current={promise:n,resolve:t},w(``),b(!0),n},[]),ye=(0,W.useCallback)(async()=>{if(!(!ae.current||x)){S(!0);try{for(let e of E.current.filter(e=>e.target.dirty)){let t=j.current.get(e.tabKey);if(!t)throw Error(`A dirty document is unavailable to save.`);if(await t.save(),e.target.dirty)throw Error(`A dirty document could not be saved.`)}_e(!0)}catch(e){w(e instanceof Error?`${e.message} Inkcap remains open.`:`A document could not be saved. Inkcap remains open.`),S(!1)}}},[_e,x]);return{connection:e,selectedConnection:F,canList:he,context:c,error:C,downloadedFile:T,activityNotice:te,onDismissActivityNotice:()=>{ne(null)},tabs:l,active:m,closing:_,windowClosing:y,windowCloseSaving:x,requestWindowClose:ve,onSaveWindowClose:()=>{ye()},onDiscardWindowClose:()=>{_e(!0)},onCancelWindowClose:()=>{_e(!1)},onNewDraft:se,onChooseComputer:()=>{let e=k.current?.app;if(!e){w(`The Computer picker requires a connected App host.`);return}e.ui.requestComputerChoice().catch(e=>{console.error(`Inkcap Computer choice failed`,ec(e)),w(e instanceof Error?e.message:`Couldn't open the Computer picker.`)})},onOpenFile:e=>{N(e)},onActivate:g,onClose:e=>{P(e)},onSaveClose:e=>{let t=j.current.get(e);if(!t){w(`This document is no longer available to save.`);return}t.save().catch(e=>{w(e instanceof Error?e.message:`Couldn't save. Your document remains open.`)})},onDiscardClose:e=>{P(e,!0)},onCancelClose:()=>{v(null)},onReopen:me,onSaveAs:async(e,t,n)=>{let i=e.connection??k.current;if(!i||i.source?.kind!==`repository`&&i.app.context.get().computerId===null){await pe(e,t,n);return}let a=i.source?.kind===`repository`?null:e.connection?e.computerId:i.app.context.get().computerId,o=Bw.of(i.app,`tree`);await fe(i,a,t,n),r.invalidateQueries({queryKey:o}),e.connection||u(t=>t.map(t=>t.tabKey===e.tabKey?{...t,connection:i,computerId:a}:t))},onPathChange:(e,t)=>{u(n=>n.map(n=>n.tabKey===e.tabKey?{...n,path:t}:n))},onStatus:(e,t,n)=>{t&&ee(t=>t?.tabKey===e.tabKey?null:t),u(n=>n.map(n=>n.tabKey===e.tabKey?{...n,dirty:t}:n)),_===e.tabKey&&!t&&!n&&P(e.tabKey)},onSaveBinding:ge,onWrite:async(e,t,n)=>{let r=e.connection;if(!r){await pe(e,e.path,t);return}await de(r,e.computerId,async a=>{await i(r).replace(e.path,t,n,a),await M(r,e.computerId,e.path,`edited`)})},onOverwrite:async(e,t)=>{if(!e.connection){await pe(e,e.path,t);return}await fe(e.connection,e.computerId,e.path,t)},onReadCurrent:async e=>{let t=e.connection;if(!t||e.target.closed)throw Error(`File is no longer open on ${t?.source?.label??`a Computer`}`);return de(t,e.computerId,async n=>{let r=await i(t).read(e.path,n);if(n.aborted||e.target.closed||!bD(t)||t.source?.kind!==`repository`&&t.app.context.get().computerId!==e.computerId)throw Error(`The original ${t.source?.label??`Computer`} is no longer available`);if(r.kind!==`text`)throw Error(`The ${t.source?.label??`Computer`} file could not be read as text`);return r.contents})}}}function ED({connection:e,context:t=vD,onReady:n}){let r=TD({connection:e,context:t});return(0,W.useEffect)(()=>{if(e)return e.app.window.onBeforeClose(r.requestWindowClose)},[e,r.requestWindowClose]),(0,W.useEffect)(()=>{n?.({requestWindowClose:r.requestWindowClose})},[n,r.requestWindowClose]),(0,G.jsx)(pD,{model:r})}var DD=(0,W.forwardRef)(function({className:e,message:t,...n},r){return(0,G.jsxs)(`div`,{...n,className:de(`caps-loading-state`,e),ref:r,role:`status`,children:[(0,G.jsx)(le,{decorative:!0,size:`sm`}),(0,G.jsx)(`span`,{children:t})]})}),OD=256;async function kD(e,t,n,r,i){r.throwIfAborted();let a=await n(e,t);if(!$T.safeParse(a).success)return a;i(!0);try{let i=null,a=!1;for(let e=0;e<OD&&!a;e++){r.throwIfAborted();let e=eE.parse(await n(`rebuildCopies`,{cursor:i}));a=e.done,i=e.cursor}if(!a)throw new p(`Bonsai is still preparing this repository. Try again shortly.`,{code:`TIMEOUT`,retryable:!0});r.throwIfAborted();let o=await n(e,t);if($T.safeParse(o).success)throw Error(`The repository changed while loading. Refresh to retry.`);return o}finally{i(!1)}}function AD({repository:e,branch:t,request:n,onSaved:r,onSaveState:i}){let a=new Map;async function o(r,i){i.throwIfAborted();let a=XT.parse(await n(`files.read`,{repo:e,ref:t,path:r}));if(i.throwIfAborted(),a.binary)throw Error(`This Bonsai file is not a text document.`);if(a.text===null&&a.blob!==null)throw new p(`This Bonsai file is too large to edit.`,{code:`FILE_TOO_LARGE`,retryable:!1});return a}async function s(o,s){s.throwIfAborted();let c=YT.parse(await n(`files.sync`,{}));s.throwIfAborted();let l=c.settled.find(n=>n.repo===e&&n.branch===t&&n.path===o);if(l){if(l.result.kind===`refused`)throw new p(`Bonsai refused sync: ${l.result.reason}`,{code:`CAPABILITY_DENIED`,retryable:l.result.reason===`background-unavailable`});let e=a.get(o);if(l.result.revision!==e?.version)throw new p(`Your saved file changed. Compare before syncing.`,{code:`CONFLICT`,retryable:!0});i(o,l.result)}r()}async function c(c,l,u,d){d.throwIfAborted();let f=a.get(c);if(u===void 0){let e=await o(c,d);f={file:e,contents:e.pending?.text??e.text??``,version:e.version}}if(!f)throw Error(`Reopen this Bonsai file before saving.`);if(u!==void 0&&f.contents!==u)throw new p(`The file baseline changed. Compare before saving.`,{code:`CONFLICT`,retryable:!0});if(u!==void 0){let e=await o(c,d);if(e.version!==f.version||(e.pending?.text??e.text??``)!==f.contents)throw new p(`The file changed. Compare before saving.`,{code:`CONFLICT`,retryable:!0});e.pending===void 0&&(f.file=e)}let m=GT.parse({repo:e,branch:t,path:c,baseCommit:f.file.commit,baseBlob:f.file.blob,text:l,revision:f.version}),h=KT.parse(await n(`files.save`,m));if(h.kind===`refused`)throw new p(`Bonsai refused this save: ${h.reason}`,{code:`CAPABILITY_DENIED`,retryable:h.reason===`background-unavailable`});if(i(c,h),h.kind===`conflict`)throw new p(`Your saved file changed. Compare before saving.`,{code:`CONFLICT`,retryable:!0});a.set(c,{file:f.file,contents:l,version:h.revision}),r(),h.kind===`saved`&&s(c,d).catch(e=>{console.error(`Bonsai sync status could not be refreshed`,e),!(a.get(c)?.version!==h.revision||d.aborted)&&i(c,{kind:`failed`,revision:h.revision,reason:`sync_failed`})})}return{kind:`repository`,id:`${e}:${t}`,label:`${e} · ${t}`,async read(e,t,n){let r=n?.revision,s=await o(e,t);if(n?.closed)return{kind:`closed`};if(n&&n.revision!==r)return{kind:`changed`};let c=s.pending?.text??s.text??``;a.set(e,{file:s,contents:c,version:s.version});let l=s.pending;return l?.state===`pending`?i(e,{kind:`saved`,revision:l.revision,state:`pending`}):l?.state===`conflict`?i(e,{kind:`conflict`,revision:l.revision,theirs:l.theirs}):l?.state===`failed`?i(e,{kind:`failed`,revision:l.revision,reason:l.failure??`sync_failed`}):s.version!==null&&i(e,{kind:`synced`,revision:s.version,commit:s.commit}),{kind:`text`,contents:c}},replace:(e,t,n,r)=>c(e,t,n,r),write:(e,t,n)=>c(e,t,void 0,n),retry:s,async discard(o,s){s.throwIfAborted();let c=a.get(o);if(!c)throw Error(`Reopen this saved file before discarding it.`);if(c.version===null)return;let l=qT.parse({repo:e,branch:t,path:o,revision:c.version}),u=JT.parse(await n(`files.discard`,l));if(s.throwIfAborted(),u.kind===`conflict`)throw new p(`Your saved file changed. Refresh before discarding.`,{code:`CONFLICT`,retryable:!0});a.delete(o),i(o,null),r()},async readCommitted(e,t){let n=await o(e,t),r=n.text??``;return a.has(e)||a.set(e,{file:n,contents:r,version:n.version}),r}}}async function jD(e,t,n){let r={repo:t,ref:n},i=RT.parse(await e(`files.tree`,{...r,path:``})),a=QT.parse(await e(`files.list`,r)),o=ZT.parse(await e(`commits.list`,{...r,limit:20}));if(i.commit.hash!==a.commit.hash)throw Error(`The repository changed while loading. Refresh to retry.`);return{head:i.commit.hash,branch:n,files:a.paths.map(e=>({path:e})),history:o.commits.map(e=>e.commit),truncated:a.truncated}}var MD=`file-tree-container`,ND=`data-file-tree-style`,PD=`data-file-tree-unsafe-css`,FD=`data-file-tree-scrollbar-measure`,ID=`data-file-tree-scrollbar-gutter-measured`,LD=`--trees-scrollbar-gutter-measured`,RD=`header`,zD=`context-menu`,BD=`context-menu-trigger`,VD=typeof window>`u`?W.useEffect:W.useLayoutEffect;function HD(e,t,n){let r=e==null?null:(0,G.jsx)(`div`,{slot:RD,children:e}),i=t!=null&&n!=null?(0,G.jsx)(`div`,{slot:zD,children:t(n.item,n.context)}):null;return r==null&&i==null?null:(0,G.jsxs)(G.Fragment,{children:[r,i]})}function UD(e,t){return typeof window>`u`&&t!=null?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t.shadowHtml}}),e]}):(0,G.jsx)(G.Fragment,{children:e})}function WD(e){let t=e.shadowRoot;return t?.querySelector(`[data-file-tree-id]`)instanceof HTMLElement||t?.querySelector(`[data-file-tree-id]`)instanceof SVGElement||e.querySelector(`template[shadowrootmode="open"]`)instanceof HTMLTemplateElement}function GD(e,t,n,r,i){let a={...e??{}};if(t!=null&&delete a.header,n){let t=e?.contextMenu,n=t?.onClose,o=t?.onOpen;a.contextMenu={...t??{},enabled:!0,onClose:()=>{n?.(),r()},onOpen:(e,t)=>{i(e,t),o?.(e,t)}},delete a.contextMenu.render}return a.header!=null||a.contextMenu!=null?a:void 0}function KD({header:e,id:t,model:n,preloadedData:r,renderContextMenu:i,...a}){let[o,s]=(0,W.useState)(null),[c,l]=(0,W.useState)(null),u=(0,W.useRef)(n.getComposition()),d=(0,W.useRef)(n);d.current!==n&&(d.current=n,u.current=n.getComposition());let f=i!=null,p=(0,W.useCallback)(()=>{s(null)},[]),m=(0,W.useCallback)((e,t)=>{s({context:t,item:e})},[]),h=u.current,g=(0,W.useMemo)(()=>GD(h,e,f,p,m),[h,p,m,f,e]),_=(0,W.useCallback)(e=>{l(e)},[]);(0,W.useEffect)(()=>{f||s(null)},[f]),VD(()=>{n.setComposition(g)},[g,n]),VD(()=>{if(c!=null)return r!=null&&WD(c)?n.hydrate({fileTreeContainer:c}):n.render({fileTreeContainer:c}),()=>{n.unmount(),n.setComposition(h)}},[h,c,n,r]);let v=UD(HD(e,i,o),r),y=t??r?.id,b={"--trees-item-height":`${String(n.getItemHeight())}px`,"--trees-density-override":n.getDensityFactor(),...a.style};return(0,G.jsx)(MD,{...a,id:y,ref:_,style:b,suppressHydrationWarning:r!=null,children:v})}var qD=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
15
|
+
<symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
|
|
16
|
+
<path d="M12.4697 5.46973C12.7626 5.17684 13.2374 5.17684 13.5303 5.46973C13.8232 5.76262 13.8232 6.23738 13.5303 6.53028L8.53028 11.5303C8.23738 11.8232 7.76262 11.8232 7.46973 11.5303L2.46973 6.53028C2.17684 6.23738 2.17684 5.76262 2.46973 5.46973C2.76262 5.17684 3.23738 5.17684 3.53028 5.46973L8 9.93946L12.4697 5.46973Z" fill="currentcolor"/>
|
|
17
|
+
</symbol>
|
|
18
|
+
<symbol id="file-tree-icon-dot" viewBox="0 0 6 6">
|
|
19
|
+
<circle cx="3" cy="3" r="3" />
|
|
20
|
+
</symbol>
|
|
21
|
+
<symbol id="file-tree-icon-file" viewBox="0 0 16 16">
|
|
22
|
+
<path fill="currentColor" d="M8 1v3a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1z" class="bg" opacity=".5"/>
|
|
23
|
+
<path fill="currentColor" d="M9.5 1a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z" class="fg"/>
|
|
24
|
+
</symbol>
|
|
25
|
+
<symbol id="file-tree-icon-lock" viewBox="0 0 16 16">
|
|
26
|
+
<path fill="currentcolor" d="M4 5.336V4a4 4 0 1 1 8 0v1.336c1.586.54 2 1.843 2 4.664v1c0 4.118-.883 5-5 5H7c-4.117 0-5-.883-5-5v-1c0-2.821.414-4.124 2-4.664M5.5 4v1.054Q6.166 4.998 7 5h2q.834-.002 1.5.054V4a2.5 2.5 0 0 0-5 0m-2 6v1c0 .995.055 1.692.167 2.193.107.483.246.686.35.79s.307.243.79.35c.5.112 1.198.167 2.193.167h2c.995 0 1.692-.055 2.193-.166.483-.108.686-.247.79-.35.104-.105.243-.308.35-.791.112-.5.167-1.198.167-2.193v-1c0-.995-.055-1.692-.166-2.193-.108-.483-.247-.686-.35-.79-.105-.104-.308-.243-.791-.35C10.693 6.555 9.995 6.5 9 6.5H7c-.995 0-1.692.055-2.193.167-.483.107-.686.246-.79.35s-.243.307-.35.79C3.555 8.307 3.5 9.005 3.5 10" />
|
|
27
|
+
</symbol>
|
|
28
|
+
<symbol id="file-tree-icon-ellipsis" viewBox="0 0 16 16">
|
|
29
|
+
<path d="M5 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M9.5 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M14 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0" />
|
|
30
|
+
</symbol>
|
|
31
|
+
</svg>`,JD=`<symbol id="file-tree-builtin-astro" viewBox="0 0 16 16">
|
|
32
|
+
<path fill="currentColor" d="M6.08 13.92c-.63-.57-.81-1.79-.55-2.67.45.56 1.08.73 1.73.83 1 .15 1.99.1 2.92-.37l.32-.19q.13.38.08.78a2.1 2.1 0 0 1-.9 1.5q-.3.24-.61.43c-.64.44-.81.95-.57 1.69l.02.08a1.7 1.7 0 0 1-.74-.64 2 2 0 0 1-.3-.98q0-.27-.02-.52-.07-.61-.61-.62a.7.7 0 0 0-.75.6z" class="bg" opacity=".6"/>
|
|
33
|
+
<path fill="currentColor" d="M2.5 11.1s1.86-.9 3.72-.9l1.4-4.39c.05-.21.2-.36.38-.36s.33.15.38.36l1.4 4.38c2.2 0 3.72.92 3.72.92l-3.16-8.69q-.13-.4-.45-.42H6.11q-.3.02-.45.42z" class="fg"/>
|
|
34
|
+
</symbol>`,YD=`<symbol id="file-tree-builtin-babel" viewBox="0 0 16 16">
|
|
35
|
+
<path fill="currentColor" fill-rule="evenodd" d="M9.49.5q1.92.05 2.66.54 1.27.6 1.35 1.52v.23a4 4 0 0 1-.53 1.9l-1.38 1.24q-.74.38-.72.63c.77.82 1.33 1.29.85 2.42q-.47 1.1-2.04 2.28c-.5.32-1.88 1.35-2.96 1.86-1.64.77-3.1 1.4-4.65 1.89-.51.16-1.5.16-1.5.16L.5 15A76 76 0 0 0 5.76 3.49q-.1-.08-.1-.2.1 0 .32-.35l-.03-.09q-1.17.39-2.38 1.3l-.13.03q0-.1-.21-.16-.46.31-.82.7l-.13-.19.16-.06-.03-.16-.34.29L2 4.5q.36-.48.72-.54l.04-.1V3.8q.16 0 .15-.06l.13-.06a6 6 0 0 0 1.13-.9v-.03H4.1l-.12.07q0-.1-.1-.1l-.15.07-.04-.1q.93-.52 1.63-1.05Q7.89.65 9.5.5M8.46 7.83l-.32.04c-1.31.54-2.31.82-2.91.88a71 71 0 0 0-2.2 4.54h.07q.58-.04 3.04-1.42.13 0 1.66-1.05L9.18 9.7v.03q.45-.2.81-1.3v-.2q-.5-.46-1.53-.4m.28-5.75c-.5.1-.75.19-.72.38l-1.16 2.6q-.17.1-.34.95-.3.48-.25.77v.1l.22.05A15 15 0 0 1 8.86 6c1.1-.71 2.12-1.38 2.8-2.54q.24-.33.21-.54-.02-.33-.4-.54c-.54 0-1.07-.34-1.63-.28l-.94-.03z" clip-rule="evenodd"/>
|
|
36
|
+
</symbol>`,XD=`<symbol id="file-tree-builtin-bash" viewBox="0 0 16 16">
|
|
37
|
+
<path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
|
|
38
|
+
<path fill="currentColor" d="M11.5 11a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1zM7 6.75C7 6.42 6.64 6 6 6s-1 .42-1 .75q-.01.25.22.41.26.21.89.35.74.14 1.28.53c.37.29.61.7.61 1.21 0 .87-.68 1.5-1.5 1.7v.55a.5.5 0 0 1-1 0v-.56c-.82-.18-1.5-.82-1.5-1.69a.5.5 0 0 1 1 0c0 .33.36.75 1 .75s1-.42 1-.75q.01-.25-.22-.41a2 2 0 0 0-.89-.35q-.74-.14-1.28-.53A1.5 1.5 0 0 1 4 6.75c0-.87.68-1.5 1.5-1.7V4.5a.5.5 0 0 1 1 0v.56c.82.18 1.5.82 1.5 1.69a.5.5 0 0 1-1 0" class="fg-stroke"/>
|
|
39
|
+
</symbol>`,ZD=`<symbol id="file-tree-builtin-biome" viewBox="0 0 16 16">
|
|
40
|
+
<path fill="currentColor" d="M8 2 4.88 7.35a7 7 0 0 1 3.7-.13l1.04.25-.99 4.16-1.05-.25a2.7 2.7 0 0 0-3.07 1.45l-.98-.47a4 4 0 0 1 1.07-1.31 3.8 3.8 0 0 1 3.23-.71l.5-2.08a6 6 0 0 0-5.07 1.12A5.9 5.9 0 0 0 1 14h14z"/>
|
|
41
|
+
</symbol>`,QD=`<symbol id="file-tree-builtin-bootstrap" viewBox="0 0 16 16">
|
|
42
|
+
<path fill="currentColor" fill-rule="evenodd" d="M11.72 1.5A2.5 2.5 0 0 1 14.2 4q.02 1.08.3 2.09c.22.73.56 1.24 1.08 1.45.22.08.4.27.4.5s-.18.43-.4.51q-.76.34-1.08 1.45c-.2.65-.27 1.32-.3 2a2.5 2.5 0 0 1-2.48 2.5H4.25A2.6 2.6 0 0 1 1.7 12c-.04-.85-.1-1.68-.22-2.04C1.26 9.23.92 8.7.4 8.5.18 8.42 0 8.23 0 8s.18-.42.4-.5q.77-.35 1.09-1.46c.1-.36.17-1.19.2-2.04a2.6 2.6 0 0 1 2.56-2.5z" class="bg" clip-rule="evenodd" opacity=".2"/>
|
|
43
|
+
<path fill="currentColor" fill-rule="evenodd" d="M8.47 4.54c1.23 0 2.04.68 2.04 1.73 0 .73-.55 1.39-1.24 1.5v.04c.94.1 1.58.77 1.58 1.7 0 1.2-.9 1.95-2.37 1.95H5.97a.3.3 0 0 1-.2-.08.3.3 0 0 1-.08-.2V4.82a.3.3 0 0 1 .08-.2.3.3 0 0 1 .2-.08zm-1.7 6.04h1.49q1.47-.01 1.49-1.15Q9.74 8.31 8.2 8.3H6.77zm0-5.16v2.06h1.21c.93 0 1.45-.38 1.45-1.06 0-.65-.44-1-1.22-1z" class="fg" clip-rule="evenodd"/>
|
|
44
|
+
</symbol>`,$D=`<symbol id="file-tree-builtin-browserslist" viewBox="0 0 16 16">
|
|
45
|
+
<path fill="currentColor" d="M8.88 6.96c0 3.82 3.72 4.7 5.7 3.74-.23.9-1.04 1.67-2.35 1.93-.02.4.42 1.28.82 1.63-.9.35-1.94-.12-2.51-.48a5 5 0 0 0-.32 1.87c-.68 0-1.57-1-1.8-1.37-.3.18-.85 1.15-.96 1.72a2.4 2.4 0 0 1-.81-.86 2.4 2.4 0 0 1-.3-1.15c-.38.27-1.48.95-1.99 1.18-.25-.58-.15-1.3 0-2.06-.21.12-1.8.27-2.43.12.32-.36.75-1.19.94-1.57A4.5 4.5 0 0 1 .44 10.6c.48-.22.97-.53 1.49-1.06C1.26 9.17.24 8.64 0 7.7a6 6 0 0 0 1.79-.32C1.28 7.08.44 6.15.6 5.01c.42.21 1.3.37 1.73.3a3.4 3.4 0 0 1-.25-2.75 5 5 0 0 0 1.48 1c-.08-.8.3-2.31.8-2.71.2.46.73 1.21 1.08 1.4.09-.61.87-2.06 1.57-2.25 0 .5.27 1.4.5 1.67.51-.54 2.25-1.44 3.64-1.13-.43.45-.75.61-.86.98 1.05 0 2.78.34 4.27 1.93-2.34-.89-5.69.56-5.69 3.5" class="bg" opacity=".5"/>
|
|
46
|
+
<path fill="currentColor" d="M11.21 3.59a4.1 4.1 0 0 0 2.47 2.89c.24-.22.61-.38.95-.19.76.44.2 1.26-.34 1.66l-.07.06a13 13 0 0 1-4.49 1.61l-.3-.43a10.5 10.5 0 0 0 4.13-1.31 1 1 0 0 0 .23-.25.5.5 0 0 0-.21-.69l-.15-.06a4.5 4.5 0 0 1-1.77-1.31 4.5 4.5 0 0 1-.88-1.77q.2-.12.43-.21"/>
|
|
47
|
+
<path fill="currentColor" d="M10.36 5.18a.4.4 0 0 0-.03.38c.09.2.3.3.46.23s.24-.3.15-.5l-.01-.02q.23.13.34.39a.83.83 0 0 1-.43 1.08.8.8 0 0 1-1.08-.43.83.83 0 0 1 .6-1.13"/>
|
|
48
|
+
</symbol>`,eO=`<symbol id="file-tree-builtin-bun" viewBox="0 0 16 16">
|
|
49
|
+
<path fill="currentColor" d="M8 14c3.87 0 7-2.46 7-5.49 0-1.88-1.2-3.53-3.04-4.52q-1.1-.61-1.84-1.07C9.2 2.35 8.64 2 8 2s-1.36.45-2.31 1.03A29 29 0 0 1 4.04 4C2.2 4.98 1 6.63 1 8.51 1 11.54 4.13 14 8 14M7.18 3.88q.3-.66.3-1.37c0-.08.11-.1.13-.01.38 1.57-.53 2.35-1.2 2.61-.08.03-.12-.07-.06-.12a3 3 0 0 0 .83-1.12m1.2-.05a3 3 0 0 0-.45-1.3V2.5c-.04-.07.05-.15.1-.1 1.15 1.2.77 2.3.33 2.87-.05.05-.13 0-.11-.08q.21-.67.13-1.37m1.04-.32a3 3 0 0 0-.94-1.02v-.01c-.06-.05-.01-.16.07-.12 1.51.61 1.61 1.8 1.43 2.5l-.03.03a.07.07 0 0 1-.1-.06 3 3 0 0 0-.43-1.32m-2.97.32c-.36.3-.74.43-1.2.56q-.11 0-.1-.1a3.5 3.5 0 0 0 1.76-1.57s.09-.07.1.04c0 .18-.2.76-.56 1.07m2.89 6.36q-.13.52-.55.88a1.3 1.3 0 0 1-.75.35 1.3 1.3 0 0 1-.77-.35 1.7 1.7 0 0 1-.54-.88.13.13 0 0 1 .15-.15h2.31a.14.14 0 0 1 .15.15M6.15 8.95a1.1 1.1 0 0 1-1.39-.14A1.1 1.1 0 0 1 5.12 7a1.1 1.1 0 0 1 1.2.25 1.1 1.1 0 0 1-.17 1.69m4.96 0a1.1 1.1 0 0 1-1.4-.14 1.1 1.1 0 0 1 .37-1.8 1.1 1.1 0 0 1 1.2.25 1.1 1.1 0 0 1 .24 1.2 1 1 0 0 1-.41.5"/>
|
|
50
|
+
</symbol>`,tO=`<symbol id="file-tree-builtin-c" viewBox="0 0 16 16">
|
|
51
|
+
<path fill="currentColor" fill-rule="evenodd" d="M8 1q.084 0 .166.021.098.023.186.075c1.055.624 4.22 2.486 5.277 3.11.085.05.15.112.209.192h-.002l.028.037a.5.5 0 0 1 .103.21q.031.102.033.21v6.29a.71.71 0 0 1-.347.616l-5.307 3.144a.68.68 0 0 1-.693 0l-5.307-3.144A.72.72 0 0 1 2 11.145V4.832a.71.71 0 0 1 .346-.612l5.288-3.126A.7.7 0 0 1 7.992 1zm2.901 4.349a3.75 3.75 0 1 0 0 5.302l-1.06-1.06a2.25 2.25 0 1 1 0-3.182z" clip-rule="evenodd"/>
|
|
52
|
+
</symbol>`,nO=`<symbol id="file-tree-builtin-claude" viewBox="0 0 16 16">
|
|
53
|
+
<path fill="currentColor" d="M3.75 10.31 6.5 8.77l.04-.14-.04-.07h-.14l-.46-.03-1.57-.04-1.38-.07-1.33-.07-.34-.07L1 7.86l.03-.21.28-.18.4.03.89.07 1.33.08.97.06 1.43.16h.22l.03-.1-.07-.05-.06-.06-1.39-.92-1.48-.98-.79-.57-.42-.28-.2-.28-.1-.6.39-.41.52.04.12.03.52.4 1.12.86L6.2 6.04l.2.17.09-.06.01-.04-.1-.15-.76-1.46-.85-1.46-.37-.6-.1-.36a1 1 0 0 1-.06-.42l.42-.59.25-.07.6.08.22.2.36.84.58 1.3.9 1.77.29.53.14.47.04.14h.1v-.07l.07-1 .14-1.22.14-1.57.04-.45.23-.53.42-.28.36.15.28.41-.04.25-.16 1.08-.36 1.7-.21 1.14h.12l.14-.15.58-.76.97-1.2.42-.5.5-.51.32-.25h.6l.44.66-.2.68-.61.79-.52.65-.74 1-.45.8.04.05h.1l1.68-.36.9-.16 1.06-.18.5.23.05.22-.2.48-1.15.28-1.34.28-2 .46-.04.01.03.04.9.09.4.03h.94l1.77.14.46.28.27.37-.04.28-.72.37-.95-.23-2.24-.53-.76-.18h-.11v.06l.64.63L12 10.86l1.48 1.35.07.34-.18.28-.2-.03-1.29-.98-.5-.42-1.12-.95h-.07v.1l.25.38 1.37 2.05.07.63-.1.2-.36.14-.38-.08-.8-1.12-.85-1.26-.66-1.15-.07.05-.4 4.23-.19.21-.42.17-.35-.28-.2-.42.2-.87.23-1.12.18-.9.17-1.1.1-.36v-.03h-.1l-.84 1.16-1.27 1.72-1 1.07-.24.1-.42-.22.04-.39.22-.32 1.4-1.8.84-1.1.57-.64-.02-.07h-.04l-3.7 2.4-.66.09-.28-.28.03-.42.14-.14 1.12-.77z"/>
|
|
54
|
+
</symbol>`,rO=`<symbol id="file-tree-builtin-cpp" viewBox="0 0 16 16">
|
|
55
|
+
<path fill="currentColor" fill-rule="evenodd" d="M8 1q.084 0 .166.021.098.023.186.075c1.055.624 4.22 2.486 5.277 3.11.085.05.15.112.209.192h-.002l.028.037a.5.5 0 0 1 .103.21q.031.102.033.21v6.29a.71.71 0 0 1-.347.616l-5.307 3.144a.68.68 0 0 1-.693 0l-5.307-3.144A.72.72 0 0 1 2 11.145V4.832a.71.71 0 0 1 .346-.612l5.288-3.126A.7.7 0 0 1 7.992 1zm2.901 4.349a3.75 3.75 0 1 0 0 5.302l-1.06-1.06a2.25 2.25 0 1 1 0-3.182z" clip-rule="evenodd"/>
|
|
56
|
+
</symbol>`,iO=`<symbol id="file-tree-builtin-css" viewBox="0 0 16 16">
|
|
57
|
+
<path fill="currentColor" d="M8 15c-5.76 0-7-1.24-7-7V2a1 1 0 0 1 1-1h6c5.77 0 7 1.24 7 7s-1.24 7-7 7" class="vector" opacity=".2"/>
|
|
58
|
+
<path fill="currentColor" d="M10.1 9.19h.73c.03.49.22.6 1 .6.76 0 .93-.12.93-.68 0-.52-.17-.67-.94-.85-1.38-.3-1.68-.56-1.68-1.47 0-1.05.3-1.29 1.67-1.29 1.29 0 1.57.2 1.6 1.13h-.74c-.01-.34-.17-.42-.85-.42-.77 0-.94.1-.94.58 0 .42.17.55.96.73 1.36.3 1.66.58 1.66 1.59 0 1.14-.31 1.39-1.73 1.39-1.39 0-1.69-.24-1.67-1.31m-3.9 0h.74c.03.49.21.6.99.6.76 0 .93-.12.93-.68 0-.52-.17-.67-.93-.85-1.39-.3-1.69-.56-1.69-1.47 0-1.05.3-1.29 1.67-1.29 1.3 0 1.58.2 1.6 1.13h-.73c-.02-.34-.18-.42-.85-.42-.78 0-.95.1-.95.58 0 .42.17.55.96.73 1.37.3 1.67.58 1.67 1.59 0 1.14-.32 1.39-1.74 1.39-1.38 0-1.68-.24-1.66-1.31m-1.22 0h.75c-.09 1.07-.37 1.31-1.56 1.31-1.37 0-1.68-.45-1.68-2.5 0-1.96.36-2.5 1.68-2.5 1.16 0 1.44.25 1.52 1.35h-.76c-.08-.52-.22-.64-.76-.64-.74 0-.9.33-.9 1.78 0 1.47.16 1.8.9 1.8.58 0 .74-.11.8-.6"/>
|
|
59
|
+
</symbol>`,aO=`<symbol id="file-tree-builtin-database" viewBox="0 0 16 16">
|
|
60
|
+
<path fill="currentColor" d="M14.953 9.733a12.4 12.4 0 0 1-.244 1.936c-.207.933-.532 1.58-.996 2.044s-1.11.789-2.044.996C10.73 14.918 9.533 15 8 15s-2.73-.082-3.669-.291c-.933-.207-1.58-.532-2.044-.996s-.789-1.11-.996-2.044c-.122-.547-.2-1.182-.244-1.92q.23.364.532.667c.64.639 1.482 1.031 2.533 1.265 1.046.232 2.33.315 3.884.315 1.555 0 2.838-.083 3.884-.315 1.051-.234 1.893-.626 2.532-1.265a4 4 0 0 0 .541-.683"/>
|
|
61
|
+
<path fill="currentColor" d="M14.93 5.924c-.046.663-.118 1.24-.23 1.743-.207.932-.532 1.579-.995 2.042s-1.11.789-2.042.996c-.938.209-2.135.291-3.667.291-1.531 0-2.729-.082-3.667-.29-.932-.208-1.579-.534-2.042-.997s-.789-1.11-.996-2.042a12 12 0 0 1-.227-1.683l.016-.188a4 4 0 0 0 .5.62c.638.639 1.48 1.031 2.532 1.265 1.046.232 2.33.315 3.884.315 1.555 0 2.838-.083 3.884-.315 1.051-.234 1.893-.626 2.532-1.265.192-.192.357-.404.506-.633z"/>
|
|
62
|
+
<path fill="currentColor" d="M8 1c1.533 0 2.73.082 3.669.291.933.207 1.58.533 2.044.996.403.404.904.944.91 1.695.004.764-.509 1.318-.918 1.727-.463.463-1.11.789-2.042.996-.938.209-2.135.291-3.667.291-1.531 0-2.729-.082-3.667-.29-.932-.208-1.579-.534-2.042-.997-.406-.406-.915-.953-.915-1.71 0-.758.509-1.305.915-1.712.464-.463 1.11-.789 2.044-.996C5.27 1.082 6.467 1 8 1"/>
|
|
63
|
+
</symbol>`,oO=`<symbol id="file-tree-builtin-default" viewBox="0 0 16 16">
|
|
64
|
+
<path fill="currentColor" d="M8 1v3a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1z" class="bg" opacity=".4"/>
|
|
65
|
+
<path fill="currentColor" d="M9.5 1a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z" class="fg"/>
|
|
66
|
+
</symbol>`,sO=`<symbol id="file-tree-builtin-docker" viewBox="0 0 16 16">
|
|
67
|
+
<path fill="currentColor" d="M15.85 6.54c-.05-.04-.45-.36-1.31-.36q-.34 0-.68.06a2.7 2.7 0 0 0-1.14-1.79l-.23-.14-.15.23a3 3 0 0 0-.4 1q-.24 1.01.26 1.84c-.4.24-1.03.3-1.17.3H.5a.5.5 0 0 0-.5.52q-.01 1.46.46 2.83.55 1.5 1.6 2.18c.79.5 2.08.79 3.54.79q.96 0 1.94-.18a8 8 0 0 0 2.55-.97 7 7 0 0 0 1.73-1.5 10 10 0 0 0 1.7-3.06h.15a2.4 2.4 0 0 0 1.8-.7 2 2 0 0 0 .47-.74l.06-.2z"/>
|
|
68
|
+
<path fill="currentColor" d="M1.48 7.36h1.4a.14.14 0 0 0 .14-.13V5.91q-.01-.12-.13-.14H1.48a.13.13 0 0 0-.13.14v1.32q.02.13.13.13m1.94 0h1.41a.14.14 0 0 0 .13-.13V5.91q-.01-.12-.13-.14h-1.4a.13.13 0 0 0-.13.14v1.32q0 .13.12.13m1.98 0h1.4q.13 0 .14-.13V5.91a.13.13 0 0 0-.14-.14H5.4q-.1.01-.12.14v1.32q0 .13.12.13m1.95 0h1.42q.1 0 .12-.13V5.91q0-.12-.12-.14H7.35q-.1.01-.12.14v1.32q.01.13.12.13M3.42 5.5h1.41c.07 0 .13-.08.13-.15V4.03a.13.13 0 0 0-.13-.14h-1.4q-.12 0-.13.14v1.31q0 .13.12.15m1.98 0h1.4c.08 0 .14-.08.14-.15V4.03q0-.13-.14-.14H5.4q-.1 0-.12.14v1.31q0 .13.12.15m1.95 0h1.42c.06 0 .12-.08.12-.15V4.03q-.01-.13-.12-.14H7.35q-.1 0-.12.14v1.31q.01.13.12.15m0-1.9h1.42q.1-.02.12-.14v-1.3Q8.88 2 8.77 2H7.35q-.1 0-.12.14v1.3q.01.13.12.14m1.97 3.78h1.4a.13.13 0 0 0 .14-.13V5.91q-.01-.12-.13-.14H9.32q-.1.01-.12.14v1.32q.01.13.12.13" opacity=".5"/>
|
|
69
|
+
</symbol>`,cO=`<symbol id="file-tree-builtin-eslint" viewBox="0 0 16 16">
|
|
70
|
+
<path fill="currentColor" d="M11.16 6.1 8.12 4.35a.3.3 0 0 0-.24 0L4.84 6.1a.3.3 0 0 0-.12.2v3.5q0 .14.12.22l3.04 1.74q.12.08.24 0l3.04-1.74a.2.2 0 0 0 .13-.22V6.3a.3.3 0 0 0-.13-.2" opacity=".5"/>
|
|
71
|
+
<path fill="currentColor" d="m.1 7.69 3.63-6.3A.8.8 0 0 1 4.37 1h7.26c.26 0 .5.17.64.4l3.63 6.27a.8.8 0 0 1 0 .75l-3.63 6.24a.7.7 0 0 1-.64.34H4.37a.7.7 0 0 1-.64-.34L.1 8.41a.7.7 0 0 1 0-.72m3 3.02q.01.15.14.23l4.63 2.66q.13.06.26 0l4.63-2.66a.3.3 0 0 0 .14-.23V5.4a.3.3 0 0 0-.14-.23L8.13 2.52a.3.3 0 0 0-.26 0L3.24 5.17a.3.3 0 0 0-.14.23z"/>
|
|
72
|
+
</symbol>`,lO=`<symbol id="file-tree-builtin-font" viewBox="0 0 16 16">
|
|
73
|
+
<path fill="currentColor" d="M12.3 13c-1.59 0-2.68-.99-2.68-2.5 0-1.43 1-2.34 2.88-2.35h2.16v-.83c0-1.08-.62-1.68-1.73-1.68-1.05 0-1.66.54-1.73 1.36H9.93c.09-1.43 1.06-2.48 3.05-2.48 1.75 0 3.02.95 3.02 2.68v5.66h-1.29v-1.02h-.04c-.41.66-1.16 1.16-2.37 1.16m.36-1.12c1.14 0 2-.72 2-1.74v-.96H12.6c-1.12 0-1.6.54-1.6 1.28 0 .97.8 1.42 1.66 1.42m-11.24.98H0L3.8 2h1.39l3.8 10.86H7.54l-1.08-3.2H2.5zm3.09-9.25h-.04l-1.6 4.95H6.1z"/>
|
|
74
|
+
</symbol>`,uO=`<symbol id="file-tree-builtin-git" viewBox="0 0 16 16">
|
|
75
|
+
<path fill="currentColor" d="M14.74 7.38 8.62 1.26a.9.9 0 0 0-1.27 0L6.08 2.53l1.61 1.61a1.07 1.07 0 0 1 1.36 1.37l1.55 1.55a1.07 1.07 0 0 1 1.1 1.77 1.07 1.07 0 0 1-1.74-1.16L8.5 6.22v3.8a1.07 1.07 0 1 1-.89-.02V6.15a1.07 1.07 0 0 1-.58-1.4l-1.58-1.6-4.2 4.2a.9.9 0 0 0 0 1.27l6.12 6.12a.9.9 0 0 0 1.27 0l6.09-6.09a.9.9 0 0 0 0-1.27"/>
|
|
76
|
+
</symbol>`,dO=`<symbol id="file-tree-builtin-go" viewBox="0 0 16 16">
|
|
77
|
+
<path fill="currentColor" fill-rule="evenodd" d="M4.41 4.57A3.2 3.2 0 0 1 6.87 5q.74.49 1.08 1.29.08.12-.1.16l-1.55.4c-.14.03-.15.04-.27-.1a1 1 0 0 0-.44-.34 1.6 1.6 0 0 0-1.68.14q-.95.61-.94 1.73c0 .73.52 1.33 1.25 1.43q.95.1 1.58-.6l.25-.34h-1.8c-.19 0-.24-.12-.17-.27.12-.28.34-.76.47-1a.3.3 0 0 1 .24-.14h2.98a4 4 0 0 1 .64-1.19 4 4 0 0 1 2.6-1.52 3.5 3.5 0 0 1 2.64.46q1.13.73 1.31 2.04a3.5 3.5 0 0 1-1.06 3.09q-.93.92-2.23 1.17l-.74.08a3.5 3.5 0 0 1-2.27-.8 3 3 0 0 1-.93-1.42 4 4 0 0 1-.39.61 4 4 0 0 1-2.64 1.56 3.3 3.3 0 0 1-2.5-.6 3 3 0 0 1-1.18-2.03 3.5 3.5 0 0 1 .8-2.67 4 4 0 0 1 2.6-1.58M13.1 7.5a1.53 1.53 0 0 0-1.9-1.21q-1.3.3-1.62 1.59a1.5 1.5 0 0 0 .85 1.72q.77.33 1.52-.05a2 2 0 0 0 1.18-1.74q0-.17-.03-.3" clip-rule="evenodd"/>
|
|
78
|
+
</symbol>`,fO=`<symbol id="file-tree-builtin-graphql" viewBox="0 0 16 16">
|
|
79
|
+
<path fill="currentColor" fill-rule="evenodd" d="M8 1a1.25 1.25 0 0 1 1.18 1.65l2.8 1.61q.33-.25.77-.26a1.25 1.25 0 0 1 .48 2.4v3.2a1.25 1.25 0 1 1-1.25 2.13l-2.8 1.62A1.25 1.25 0 0 1 8 15a1.25 1.25 0 0 1-1.18-1.65l-2.8-1.62q-.33.26-.77.27a1.25 1.25 0 0 1-.48-2.4V6.4a1.25 1.25 0 1 1 1.25-2.14l2.8-1.61A1.25 1.25 0 0 1 8 1M4.44 11.14l-.06.13 2.75 1.58a1.25 1.25 0 0 1 1.74 0l2.74-1.58-.05-.13zm3.89-7.68a1.3 1.3 0 0 1-.66 0L4.03 9.77q.37.3.45.78h7.04q.08-.48.45-.78zM4.38 4.73a1.24 1.24 0 0 1-1.02 1.76v3.02l.13.01 3.67-6.35-.03-.02zm4.46-1.56 3.67 6.35.13-.01V6.49a1.25 1.25 0 0 1-1.03-1.76L8.87 3.15z" clip-rule="evenodd"/>
|
|
80
|
+
</symbol>`,pO=`<symbol id="file-tree-builtin-html" viewBox="0 0 16 16">
|
|
81
|
+
<path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
|
|
82
|
+
<path fill="currentColor" d="M10.48 3.76a.5.5 0 0 1 .4.58L10.6 5.8h1.14a.5.5 0 0 1 0 1h-1.32L10 9.2h1.08a.5.5 0 0 1 0 1H9.8l-.3 1.64a.5.5 0 1 1-.98-.18l.27-1.46H6.4l-.3 1.64a.5.5 0 1 1-.98-.18l.27-1.46H4.25a.5.5 0 0 1 0-1h1.32L6 6.8H4.93a.5.5 0 0 1 0-1H6.2l.3-1.64a.5.5 0 1 1 .98.18L7.2 5.8h2.4l.3-1.64a.5.5 0 0 1 .58-.4M6.58 9.2h2.4l.44-2.4h-2.4z" class="fg"/>
|
|
83
|
+
</symbol>`,mO=`<symbol id="file-tree-builtin-image" viewBox="0 0 16 16">
|
|
84
|
+
<path fill="currentColor" d="M12.5 2A2.5 2.5 0 0 1 15 4.5v4.67l-4.05-3.54-4.08 4.08-3-2L1 10.6V4.5A2.5 2.5 0 0 1 3.5 2z" opacity=".3"/>
|
|
85
|
+
<path fill="currentColor" d="M15 10.5v1a2.5 2.5 0 0 1-2.5 2.5h-9a2.5 2.5 0 0 1-2.46-2.04L4 9l3 2 4-4zm-7-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0"/>
|
|
86
|
+
</symbol>`,hO=`<symbol id="file-tree-builtin-javascript" viewBox="0 0 16 16">
|
|
87
|
+
<path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
|
|
88
|
+
<path fill="currentColor" d="M8.1 9.64h.95c.04.62.28.76 1.28.76s1.2-.14 1.2-.85c0-.66-.2-.85-1.2-1.07-1.79-.38-2.18-.7-2.18-1.86C8.15 5.3 8.54 5 10.31 5c1.67 0 2.04.26 2.07 1.42h-.95c-.02-.43-.23-.53-1.1-.53-1 0-1.22.14-1.22.74 0 .52.22.7 1.24.92 1.76.38 2.15.73 2.15 2 0 1.44-.4 1.75-2.24 1.75-1.8 0-2.18-.3-2.15-1.66M3.5 9.5h.98c0 .76.15.92.85.92.77 0 .94-.18.94-1.02V5.1h1v4.34c0 1.54-.35 1.87-1.92 1.87-1.55 0-1.89-.32-1.86-1.8"/>
|
|
89
|
+
</symbol>`,gO=`<symbol id="file-tree-builtin-json" viewBox="0 0 16 16">
|
|
90
|
+
<path fill="currentColor" d="M13.25 11.5V9.75a.5.5 0 0 1 .36-.48l.55-.15a1.16 1.16 0 0 0 0-2.24l-.55-.15a.5.5 0 0 1-.36-.48V4.5a2.5 2.5 0 0 0-2.5-2.5h-.25a.5.5 0 0 0 0 1h.25a1.5 1.5 0 0 1 1.5 1.5v1.75a1.5 1.5 0 0 0 1.09 1.44l.54.15a.16.16 0 0 1 0 .32l-.54.15a1.5 1.5 0 0 0-1.09 1.44v1.75a1.5 1.5 0 0 1-1.5 1.5h-.25a.5.5 0 0 0 0 1h.25a2.5 2.5 0 0 0 2.5-2.5m-10.5 0V9.75a.5.5 0 0 0-.36-.48l-.55-.15a1.16 1.16 0 0 1 0-2.24l.55-.15a.5.5 0 0 0 .36-.48V4.5A2.5 2.5 0 0 1 5.25 2h.25a.5.5 0 0 1 0 1h-.25a1.5 1.5 0 0 0-1.5 1.5v1.75a1.5 1.5 0 0 1-1.09 1.44l-.54.15a.16.16 0 0 0 0 .32l.54.15a1.5 1.5 0 0 1 1.09 1.45v1.74a1.5 1.5 0 0 0 1.5 1.5h.25a.5.5 0 0 1 0 1h-.25a2.5 2.5 0 0 1-2.5-2.5"/>
|
|
91
|
+
</symbol>`,_O=`<symbol id="file-tree-builtin-markdown" viewBox="0 0 16 16">
|
|
92
|
+
<path fill="currentColor" d="M1 12V4h2l2 2.5L7 4h2v8H7V7.5l-2 2-2-2V12zm9-3 3 3.5L16 9h-2V4h-2v5z"/>
|
|
93
|
+
</symbol>`,vO=`<symbol id="file-tree-builtin-mcp" viewBox="0 0 16 16">
|
|
94
|
+
<path fill="currentColor" d="M9.26-.04a3 3 0 0 1 2 .82 2.8 2.8 0 0 1 .8 2.35 2.9 2.9 0 0 1 2.41.8l.03.02a2.74 2.74 0 0 1 0 3.94l-5.8 5.69-.04.06-.02.07q0 .04.02.07.01.04.04.06l1.2 1.17a.55.55 0 0 1 0 .79.6.6 0 0 1-.81 0l-1.2-1.17a1.3 1.3 0 0 1 0-1.84L13.7 7.1a1.65 1.65 0 0 0 .37-1.82 2 2 0 0 0-.37-.54l-.03-.03a1.73 1.73 0 0 0-2.4 0L6.47 9.4l-.07.06a.58.58 0 0 1-.92-.18.6.6 0 0 1 .12-.6l4.85-4.76a1.65 1.65 0 0 0 0-2.36 1.73 1.73 0 0 0-2.4 0l-6.43 6.3a.6.6 0 0 1-.8 0 .55.55 0 0 1 0-.8L7.25.79a3 3 0 0 1 2-.82"/>
|
|
95
|
+
<path fill="currentColor" d="M9.26 2.19a.6.6 0 0 1 .52.34.6.6 0 0 1 0 .43l-.12.18L4.9 7.79a1.65 1.65 0 0 0 0 2.36 1.73 1.73 0 0 0 2.4 0l4.75-4.66a.58.58 0 0 1 .93.18.6.6 0 0 1-.12.61l-4.75 4.66a2.9 2.9 0 0 1-4.01 0 2.75 2.75 0 0 1-.62-3.04A3 3 0 0 1 4.1 7l4.74-4.65a.6.6 0 0 1 .4-.16"/>
|
|
96
|
+
</symbol>`,yO=`<symbol id="file-tree-builtin-nextjs" viewBox="0 0 16 16">
|
|
97
|
+
<defs>
|
|
98
|
+
<linearGradient id="a" x1="4.522" x2="14" y1="3.943" y2="16" gradientUnits="userSpaceOnUse">
|
|
99
|
+
<stop stop-color="currentColor"/>
|
|
100
|
+
<stop offset="1" stop-color="currentColor" stop-opacity="0"/>
|
|
101
|
+
</linearGradient>
|
|
102
|
+
</defs>
|
|
103
|
+
<path fill="currentColor" d="M3 2h1.522v9.09H3z"/>
|
|
104
|
+
<path fill="url(#a)" d="M4.903 2 15 15.075q-.565.5-1.195.925L4.522 3.943z"/>
|
|
105
|
+
<path fill="currentColor" d="M12.172 2h-1.508v9.094h1.508z"/>
|
|
106
|
+
</symbol>`,bO=`<symbol id="file-tree-builtin-npm" viewBox="0 0 16 16">
|
|
107
|
+
<path fill="currentColor" d="M2 1a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1z" class="vector" opacity=".2"/>
|
|
108
|
+
<path fill="currentColor" d="M10.5 13H13V3H3v10h5V5.5h2.5z"/>
|
|
109
|
+
</symbol>`,xO=`<symbol id="file-tree-builtin-oxc" viewBox="0 0 16 16">
|
|
110
|
+
<path fill="currentColor" d="M9.5 1a.5.5 0 0 1 .5.5V3h3.5a.5.5 0 0 1 .38.83L10.5 7.69v1.44q.41.04.95-.16a4 4 0 0 0 .72-.35l.04-.03h.01a.5.5 0 0 1 .67.1l2 2.5a.5.5 0 0 1 0 .62c-.76.96-3.14 2.69-6.89 2.69s-6.13-1.73-6.89-2.69a.5.5 0 0 1 0-.62l2-2.5a.5.5 0 0 1 .67-.1l.05.03.16.09q.22.13.56.26.54.2.95.16V7.69L2.12 3.83A.5.5 0 0 1 2.5 3H6V1.5a.5.5 0 0 1 .5-.5zM7 3.5a.5.5 0 0 1-.5.5H3.6l2.78 3.17a.5.5 0 0 1 .12.33v2a.5.5 0 0 1-.28.45c-.7.35-1.5.15-2.02-.05a5 5 0 0 1-.58-.26l-1.46 1.84c.82.78 2.8 2.02 5.84 2.02s5.02-1.24 5.84-2.02l-1.46-1.83a5 5 0 0 1-.58.26c-.52.2-1.33.39-2.02.04a.5.5 0 0 1-.28-.45v-2a.5.5 0 0 1 .12-.33L12.4 4H9.5a.5.5 0 0 1-.5-.5V2H7z"/>
|
|
111
|
+
</symbol>`,SO=`<symbol id="file-tree-builtin-postcss" viewBox="0 0 16 16">
|
|
112
|
+
<path fill="currentColor" d="M14.5 8a6.5 6.5 0 0 0-5.9-6.47l5.42 8.93A7 7 0 0 0 14.5 8M2.88 12A6.5 6.5 0 0 0 8 14.5c2.08 0 3.93-.98 5.12-2.5zm8.62-1h1.68L11.5 8.24zm-1-.55a4 4 0 0 1-.7.55h.7zM8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5M5.5 11h.7a4 4 0 0 1-.7-.55zm-2.68 0H4.5V8.24zm3.76-6.2A4 4 0 0 1 8 4.5q.76 0 1.42.3L8 2.46zM1.5 8q0 1.31.48 2.46L7.4 1.53A6.5 6.5 0 0 0 1.5 8m14 0a7.5 7.5 0 0 1-.99 3.72l-.01.03-.02.03A7.5 7.5 0 0 1 8 15.5a7.5 7.5 0 0 1-6.5-3.75l-.01-.03A7.5 7.5 0 1 1 15.5 8"/>
|
|
113
|
+
</symbol>`,CO=`<symbol id="file-tree-builtin-prettier" viewBox="0 0 16 16">
|
|
114
|
+
<path fill="currentColor" d="M6 12v1H4.93v-1zm1-2v1H2v-1zm6-4v1h-3V6zm-1-4v1H9V2z"/>
|
|
115
|
+
<path fill="currentColor" d="M11.5 10v1H8v-1zM5 6v1H2V6zm5-2v1H9V4z" opacity=".8"/>
|
|
116
|
+
<path fill="currentColor" d="M6 14v1H2v-1zm-.5-6v1H2V8zM13 4v1h-3V4zM4.93 2v1H2V2z" opacity=".6"/>
|
|
117
|
+
<path fill="currentColor" d="M4.93 12v1H2v-1zM13 8v1H9V8zM5.5 4v1H2V4zM9 2v1H4.93V2z" opacity=".4"/>
|
|
118
|
+
</symbol>`,wO=`<symbol id="file-tree-builtin-python" viewBox="0 0 16 16">
|
|
119
|
+
<path fill="currentColor" d="M8.33 8.4H10c1.16 0 1.9-.73 1.9-1.86V5.08q0-.24.25-.24h.74c.75 0 1.33.32 1.66.97q.4.73.41 1.46c.09.9.09 1.78-.24 2.67-.25.73-.75 1.3-1.58 1.46h-4.8c-.08 0-.25 0-.25.08v.4s.17.09.25.09h2.82q.34-.02.33.32v1.06c0 .56-.25.97-.75 1.13-.41.16-.83.33-1.24.4a7 7 0 0 1-2.98-.07 3 3 0 0 1-1.16-.49c-.33-.32-.58-.65-.5-1.14v-2.91c0-1.13.67-1.78 1.82-1.78q.89-.1 1.66-.08m2.32 4.86a.65.65 0 0 0-.66-.65c-.34 0-.67.33-.67.65s.33.57.67.65a.65.65 0 0 0 .66-.65" class="bg" opacity=".8"/>
|
|
120
|
+
<path fill="currentColor" d="M7.67 7.6H6c-1.16 0-1.9.73-1.9 1.86v1.46q0 .24-.25.24h-.74c-.75 0-1.33-.32-1.66-.97a3 3 0 0 1-.41-1.46 6 6 0 0 1 .24-2.67c.25-.73.75-1.3 1.58-1.46h4.8c.08 0 .25 0 .25-.08v-.4s-.17-.09-.25-.09H4.85c-.24 0-.33-.08-.33-.32V2.65c0-.56.25-.97.75-1.13.41-.16.83-.33 1.24-.4a7 7 0 0 1 2.98.07c.41.09.83.25 1.16.49.33.32.58.65.5 1.13v2.92c0 1.14-.67 1.78-1.82 1.78-.58.08-1.16.08-1.66.08M5.35 2.73c0 .33.25.65.66.65.33 0 .66-.32.66-.65 0-.32-.33-.56-.66-.64a.65.65 0 0 0-.66.64" class="fg"/>
|
|
121
|
+
</symbol>`,TO=`<symbol id="file-tree-builtin-react" viewBox="0 0 16 16">
|
|
122
|
+
<path fill="currentColor" d="M8 6.65c.73 0 1.31.6 1.31 1.35S8.73 9.35 8 9.35 6.69 8.75 6.69 8 7.27 6.65 8 6.65"/>
|
|
123
|
+
<path fill="currentColor" fill-rule="evenodd" d="M8 2.55c1.3-.99 2.59-1.34 3.5-.8.92.55 1.27 1.87 1.08 3.53C14.06 5.94 15 6.9 15 8s-.94 2.06-2.42 2.72c.19 1.65-.16 2.98-1.08 3.52-.91.55-2.2.2-3.5-.8-1.3 1-2.58 1.35-3.5.8-.91-.54-1.27-1.87-1.08-3.52C1.94 10.06 1 9.1 1 8s.94-2.06 2.42-2.72c-.19-1.66.17-2.98 1.08-3.52s2.2-.2 3.5.8M4.26 11.2c-.08 1.34.28 2.03.68 2.26s1.15.22 2.25-.52l.11-.09a12 12 0 0 1-1.24-1.39 11 11 0 0 1-1.8-.41zm7.47-.15q-.83.27-1.79.41-.6.8-1.24 1.4l.11.08c1.1.74 1.86.76 2.25.52.4-.23.76-.92.68-2.26zm-3.04.54a14 14 0 0 1-1.38 0q.34.38.69.7.35-.32.7-.7M8 5.29q-.76 0-1.47.1A13 13 0 0 0 5.07 8a14 14 0 0 0 1.46 2.62 13 13 0 0 0 2.94 0A13 13 0 0 0 10.93 8a14 14 0 0 0-1.46-2.62A13 13 0 0 0 8 5.3M4.64 9.18q-.15.5-.25.96.44.16.94.27a15 15 0 0 1-.7-1.23m6.73 0a15 15 0 0 1-.7 1.23q.5-.11.95-.27a10 10 0 0 0-.25-.96M3.44 6.26C2.27 6.86 1.87 7.53 1.87 8s.4 1.14 1.57 1.74l.13.07q.18-.88.55-1.81a12 12 0 0 1-.55-1.8q-.07.02-.13.06m8.99-.07A12 12 0 0 1 11.88 8q.36.94.55 1.8l.13-.06c1.17-.6 1.56-1.27 1.56-1.74s-.39-1.14-1.56-1.74zm-7.1-.6q-.5.11-.94.27.1.46.25.96a15 15 0 0 1 .69-1.23m5.34 0a15 15 0 0 1 .7 1.23q.14-.5.24-.96-.44-.15-.94-.27M7.18 3.06c-1.09-.74-1.85-.76-2.24-.52s-.76.92-.69 2.26l.01.15a11 11 0 0 1 1.8-.41q.6-.8 1.24-1.4zm3.88-.52c-.4-.24-1.15-.22-2.25.52l-.12.08q.65.6 1.25 1.4.96.15 1.8.41v-.14c.08-1.35-.28-2.04-.68-2.27M8 3.7a10 10 0 0 0-.7.7 14 14 0 0 1 1.4 0 10 10 0 0 0-.7-.7" clip-rule="evenodd"/>
|
|
124
|
+
</symbol>`,EO=`<symbol id="file-tree-builtin-ruby" viewBox="0 0 16 16">
|
|
125
|
+
<path fill="currentColor" fill-rule="evenodd" d="M11.04 2c.48 0 .92.23 1.18.6l2.54 3.65c.37.52.3 1.23-.15 1.69l-5.58 5.64a1.47 1.47 0 0 1-2.06 0L1.39 7.94a1.3 1.3 0 0 1-.15-1.7l2.54-3.63q.2-.3.5-.45.33-.16.68-.16zm.84 2.17a.5.5 0 0 0-.7-.05L8 6.84 4.83 4.12a.5.5 0 0 0-.65.76L6.65 7H3.5a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1H9.35l2.48-2.12a.5.5 0 0 0 .05-.7" clip-rule="evenodd"/>
|
|
126
|
+
</symbol>`,DO=`<symbol id="file-tree-builtin-rust" viewBox="0 0 16 16">
|
|
127
|
+
<path fill="currentColor" fill-rule="evenodd" d="M8 .8a.2.2 0 0 1 .18.1l.38.6.16.02.5-.53.01-.01a.2.2 0 0 1 .33.08l.25.68.16.05.59-.43h.02a.2.2 0 0 1 .3.14l.12.71.15.08.65-.3a.2.2 0 0 1 .2.02.2.2 0 0 1 .1.18l-.03.72.12.1.71-.16a.2.2 0 0 1 .25.25l-.17.7q.06.06.1.13l.73-.03A.2.2 0 0 1 14 4a.2.2 0 0 1 .02.2l-.3.66.08.14.71.12a.2.2 0 0 1 .14.32l-.43.59.05.16.68.25a.2.2 0 0 1 .07.35l-.53.49.01.16.62.38a.2.2 0 0 1 0 .36l-.62.38-.01.16.53.5a.2.2 0 0 1-.07.34l-.68.25-.05.16.43.59a.2.2 0 0 1-.14.32l-.72.12-.07.15.3.65a.2.2 0 0 1-.02.2.2.2 0 0 1-.18.1l-.72-.03-.1.13.16.7a.2.2 0 0 1-.25.25l-.7-.17-.13.1.03.73a.2.2 0 0 1-.1.18.2.2 0 0 1-.2.02l-.66-.3-.14.08-.12.71a.2.2 0 0 1-.32.14l-.59-.43-.16.05-.25.68a.2.2 0 0 1-.34.07l-.5-.53-.16.01-.38.62a.2.2 0 0 1-.36 0l-.38-.62-.16-.01-.5.53a.2.2 0 0 1-.34-.07l-.25-.68-.16-.05-.59.43a.2.2 0 0 1-.32-.14L5 13.78l-.15-.07-.65.3a.2.2 0 0 1-.2-.02.2.2 0 0 1-.1-.18l.03-.72-.13-.1-.7.16a.2.2 0 0 1-.25-.25l.17-.7-.1-.13-.73.03a.2.2 0 0 1-.2-.3l.3-.66-.08-.14-.71-.12a.2.2 0 0 1-.14-.32l.43-.59-.05-.16-.68-.25A.2.2 0 0 1 1 9.22l.53-.5-.02-.16-.6-.38A.2.2 0 0 1 .8 8a.2.2 0 0 1 .1-.18l.6-.38.02-.16-.53-.5a.2.2 0 0 1 .07-.34l.68-.25.05-.16-.43-.59a.2.2 0 0 1 .14-.32L2.2 5l.08-.15L2 4.2a.2.2 0 0 1 .2-.3l.72.03.1-.13-.16-.7a.2.2 0 0 1 .25-.25l.7.16.13-.1-.03-.72A.2.2 0 0 1 4 2a.2.2 0 0 1 .2-.02l.65.3L5 2.2l.12-.71v-.03a.2.2 0 0 1 .32-.1l.59.41.16-.04.25-.68.01-.02A.2.2 0 0 1 6.8.99l.49.53.16-.02.38-.61.02-.02A.2.2 0 0 1 8 .79M6.8 9.45h1.26l.06.01q.03.01.03.05v1.52q0 .07-.09.06h-4.5A5.4 5.4 0 0 0 8 13.42a5.4 5.4 0 0 0 4.45-2.33h-2.42c-.36 0-.68-.5-.77-.75-.08-.22-.2-.91-.25-1.12-.15-.61-.59-.71-.78-.73H6.8zM8 2.58a5.4 5.4 0 0 0-4.07 1.85h5.74l.17.02c.23.03.6.12.96.35.34.23.83.68.83 1.4 0 .66-.55 1.16-1.08 1.5.42.33.7.53.86 1.44.04.17.34.32.62.29.29-.03.62-.16.62-.75v-.24q0-.1.07-.1h.68A5.43 5.43 0 0 0 8 2.59M2.96 6.03a5.4 5.4 0 0 0-.19 3.37h1.66V6.03zM6.8 7.06h1.66c.35 0 .77-.12.77-.47 0-.42-.55-.53-.65-.53H6.8z" clip-rule="evenodd"/>
|
|
128
|
+
</symbol>`,OO=`<symbol id="file-tree-builtin-sass" viewBox="0 0 16 16">
|
|
129
|
+
<path fill="currentColor" fill-rule="evenodd" d="M8.08 1.44c2.41-.91 4.96-.37 5.35 1.27.39 1.62-.92 3.56-2.6 4.25a5 5 0 0 1-3.26.35c-.58-.2-.92-.62-1-.85-.03-.09-.09-.24 0-.3.05-.03.08-.02.22.15s.7.6 1.75.48c2.78-.34 4.45-2.64 3.92-3.88-.37-.87-2.5-1.26-5.18.16C4.03 4.81 3.85 6.24 3.82 6.8c-.08 1.5 1.73 2.28 2.7 3.4q.04.03.07.08c.3-.12.7-.19 1.35-.2 1.58-.03 2.47 1.08 2.43 2.08-.03.78-.7 1.1-.82 1.13-.1.01-.14.02-.15-.06q-.03-.06.13-.15c.16-.09.42-.3.48-.72.05-.43-.24-1.44-1.76-1.63a3 3 0 0 0-1.33.08c.27.62.32 1.87-.29 2.83-.63 1-1.8 1.61-2.93 1.27-.37-.1-.93-.92-.45-2.05.46-1.07 2.4-2.12 2.66-2.26-.9-.83-3.08-1.95-3.4-3.65-.08-.49.13-1.65 1.46-2.98a12 12 0 0 1 4.11-2.52m-1.88 9.7c-.01.01-.9.47-1.52 1.17-.59.66-.75 1.48-.43 1.69.3.18 1-.04 1.51-.62a3 3 0 0 0 .5-.9q.2-.64.02-1.39z" clip-rule="evenodd"/>
|
|
130
|
+
</symbol>`,kO=`<symbol id="file-tree-builtin-stylelint" viewBox="0 0 16 16">
|
|
131
|
+
<path fill="currentColor" d="M4 3v3.5l1.5-1L7 15 .5 6l1-1.5L0 3l2.5-2h1zm12 0-1.5 1.5 1 1.5L9 15l1.5-9.5 1.5 1V3l.5-2h1zm-8 8.5a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1m0-3a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1m0-3a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1"/>
|
|
132
|
+
<path fill="currentColor" d="M6.5 2.5V4l-2 1.5v-4zm5 3L9.5 4V2.5l2-1zM9 4H7V2.5h2z"/>
|
|
133
|
+
</symbol>`,AO=`<symbol id="file-tree-builtin-svelte" viewBox="0 0 16 16">
|
|
134
|
+
<path fill="currentColor" d="m3.98 3.7 3.36-2.08a4.5 4.5 0 0 1 5.9 1.23 4 4 0 0 1 .7 3.02q-.16.75-.58 1.4c.42.77.56 1.66.4 2.52a3.7 3.7 0 0 1-1.57 2.4l-.17.1-3.36 2.09a4.5 4.5 0 0 1-5.9-1.23 4 4 0 0 1-.66-1.44 4 4 0 0 1-.04-1.58 4 4 0 0 1 .58-1.4 4 4 0 0 1-.4-2.52 3.7 3.7 0 0 1 1.57-2.4zl3.36-2.08zm7.87 0a2.7 2.7 0 0 0-1.26-.95 2.7 2.7 0 0 0-1.6-.07 3 3 0 0 0-.52.2l-.16.09-3.36 2.08a2 2 0 0 0-.69.64 2 2 0 0 0-.36.86 2.3 2.3 0 0 0 .42 1.81A2.7 2.7 0 0 0 7.18 9.4q.28-.06.53-.2l.16-.09 1.28-.79.2-.09a.8.8 0 0 1 .87.31.7.7 0 0 1 .13.55.7.7 0 0 1-.24.4l-.08.05-3.36 2.08-.2.09a1 1 0 0 1-.49-.02 1 1 0 0 1-.38-.3 1 1 0 0 1-.13-.37v-.1l.01-.13-.13-.03a4 4 0 0 1-1.1-.5l-.2-.14-.18-.12-.07.18-.08.3a2.3 2.3 0 0 0 .43 1.82q.45.64 1.19.93.73.28 1.51.14l.16-.04q.27-.07.52-.2l.16-.09 3.36-2.08q.4-.25.69-.64.27-.4.36-.86a2.3 2.3 0 0 0-.42-1.82 2.7 2.7 0 0 0-1.27-.95 2.7 2.7 0 0 0-1.6-.08q-.27.07-.52.2l-.16.1-1.28.79-.2.09a1 1 0 0 1-.49-.03 1 1 0 0 1-.38-.29.7.7 0 0 1-.13-.54.7.7 0 0 1 .24-.4l.08-.06L9.33 4.4l.2-.1a.8.8 0 0 1 .87.32 1 1 0 0 1 .13.38v.22l.11.04q.6.18 1.12.5l.2.14.17.12.06-.19.08-.3a2.3 2.3 0 0 0-.42-1.81z"/>
|
|
135
|
+
</symbol>`,jO=`<symbol id="file-tree-builtin-svg" viewBox="0 0 16 16">
|
|
136
|
+
<path fill="currentColor" d="M5 7a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2z"/>
|
|
137
|
+
<path fill="currentColor" d="M6 1a5 5 0 0 1 4.58 3H7a3 3 0 0 0-3 3v3.58A5 5 0 0 1 6 1" opacity=".5"/>
|
|
138
|
+
</symbol>`,MO=`<symbol id="file-tree-builtin-svgo" viewBox="0 0 16 16">
|
|
139
|
+
<path fill="currentColor" d="M9.43 4.8A.6.6 0 1 1 9.19 6l-.56.96a1.2 1.2 0 0 1 .32 1.58l.7.53a.89.89 0 1 1-.17.22l-.7-.52a1.2 1.2 0 0 1-1.4.25l-.56.87a.75.75 0 1 1-.57-.2 1 1 0 0 1 .32.05l.56-.87a1.2 1.2 0 0 1-.4-1.24l-1.2-.47a.56.56 0 1 1 .1-.28v.02l1.2.47a1.2 1.2 0 0 1 1.56-.55l.56-.97a.6.6 0 0 1-.15-.64.6.6 0 0 1 .63-.4"/>
|
|
140
|
+
<path fill="currentColor" fill-rule="evenodd" d="M9.17 1q.16.63.27 1.26a6 6 0 0 1 1.61.67q.52-.38 1.08-.71l1.65 1.64q-.32.56-.68 1.05.48.78.72 1.67.6.09 1.18.25v2.32q-.55.15-1.11.24a6 6 0 0 1-.7 1.82q.31.44.59.91l-1.65 1.65-.85-.55a6 6 0 0 1-1.9.83q-.08.47-.2.95H6.84q-.12-.46-.2-.93a6 6 0 0 1-1.96-.81q-.39.27-.8.51l-1.65-1.65q.25-.43.53-.84a6 6 0 0 1-.75-1.9L1 9.16V6.83q.54-.14 1.09-.24a6 6 0 0 1 .77-1.74q-.33-.47-.63-.98l1.65-1.65q.54.32 1.03.68a6 6 0 0 1 1.66-.66q.1-.61.26-1.24zM7.96 3.73a4 4 0 0 0-1.74.36 4.5 4.5 0 0 0-2.3 2.3 4.4 4.4 0 0 0-.1 3.29l.03.06a4.4 4.4 0 0 0 2.4 2.47 4.4 4.4 0 0 0 3.48-.02l.03-.02a4.4 4.4 0 0 0 2.3-2.42l.06-.14a4.4 4.4 0 0 0-.2-3.4 4.4 4.4 0 0 0-2.13-2.07L9.47 4a4 4 0 0 0-1.51-.27" clip-rule="evenodd"/>
|
|
141
|
+
</symbol>`,NO=`<symbol id="file-tree-builtin-swift" viewBox="0 0 16 16">
|
|
142
|
+
<path fill="currentColor" d="M9.63 1c6.15 4.35 4.16 9.15 4.16 9.15s1.75 2.05 1.04 3.85c0 0-.72-1.26-1.93-1.26-1.17 0-1.85 1.26-4.2 1.26C3.47 14 1 9.46 1 9.46c4.71 3.22 7.93.94 7.93.94C6.8 9.12 2.29 3 2.29 3c3.93 3.47 5.63 4.39 5.63 4.39-1.01-.87-3.86-5.13-3.86-5.13C6.34 4.66 10.86 8 10.86 8c1.28-3.7-1.23-7-1.23-7"/>
|
|
143
|
+
</symbol>`,PO=`<symbol id="file-tree-builtin-table" viewBox="0 0 16 16">
|
|
144
|
+
<path fill="currentColor" d="M8 4a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1H8z" class="bg" opacity=".4"/>
|
|
145
|
+
<path fill="currentColor" d="M11.5 8a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5h-7a.5.5 0 0 1-.5-.5v-4a.5.5 0 0 1 .5-.5zM5 12h2.5v-1H5zm3.5 0H11v-1H8.5zM5 10h2.5V9H5zm3.5 0H11V9H8.5zm1-9a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z" class="fg"/>
|
|
146
|
+
</symbol>`,FO=`<symbol id="file-tree-builtin-tailwind" viewBox="0 0 16 16">
|
|
147
|
+
<path fill="currentColor" fill-rule="evenodd" d="M8 4Q5.2 4 4.5 6.67q1.05-1.34 2.45-1c.53.12.91.5 1.33.9C8.98 7.23 9.77 8 11.5 8q2.8 0 3.5-2.67-1.05 1.34-2.45 1c-.53-.12-.91-.5-1.33-.9C10.52 4.77 9.73 4 8 4M4.5 8Q1.7 8 1 10.67q1.05-1.34 2.45-1c.53.12.91.5 1.33.9C5.48 11.23 6.26 12 8 12q2.8 0 3.5-2.67-1.05 1.34-2.45 1c-.53-.12-.91-.5-1.33-.9C7.02 8.77 6.24 8 4.5 8" clip-rule="evenodd"/>
|
|
148
|
+
</symbol>`,IO=`<symbol id="file-tree-builtin-terraform" viewBox="0 0 16 16">
|
|
149
|
+
<path fill="currentColor" d="M1 0v5.05l4.35 2.53V2.53zm9.18 5.34L5.83 2.82v5.05l4.35 2.53zm.47 5.06V5.34L15 2.82v5.05zm-.48 5.6-4.35-2.53V8.42l4.35 2.53z"/>
|
|
150
|
+
</symbol>`,LO=`<symbol id="file-tree-builtin-text" viewBox="0 0 16 16">
|
|
151
|
+
<path fill="currentColor" fill-rule="evenodd" d="M8 4a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1H8z" class="bg" clip-rule="evenodd" opacity=".4"/>
|
|
152
|
+
<path fill="currentColor" d="M8.5 11a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1zm2-2a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1zm-1-8a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z"/>
|
|
153
|
+
</symbol>`,RO=`<symbol id="file-tree-builtin-typescript" viewBox="0 0 16 16">
|
|
154
|
+
<path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
|
|
155
|
+
<path fill="currentColor" d="M8.1 9.64h.95c.04.62.28.76 1.28.76s1.2-.14 1.2-.85c0-.66-.2-.85-1.2-1.07-1.79-.38-2.18-.7-2.18-1.86C8.15 5.3 8.54 5 10.31 5c1.67 0 2.04.26 2.07 1.42h-.95c-.02-.43-.23-.53-1.1-.53-1 0-1.22.14-1.22.74 0 .52.22.7 1.24.92 1.76.38 2.15.73 2.15 2 0 1.44-.4 1.75-2.24 1.75-1.8 0-2.18-.3-2.15-1.66m-3 1.57V5.99H3.5v-.9h4.21v.9H6.1v5.22z"/>
|
|
156
|
+
</symbol>`,zO=`<symbol id="file-tree-builtin-vite" viewBox="0 0 16 16">
|
|
157
|
+
<path fill="currentColor" d="M8.57 14.87c-.18.26-.55.11-.55-.22v-3.18l-.05-.27-.13-.22-.2-.15-.24-.06H4.29c-.26 0-.4-.32-.26-.55L6.08 7c.3-.46 0-1.1-.5-1.1H1.8c-.25 0-.4-.32-.25-.56l2.65-4.2A.3.3 0 0 1 4.46 1h7.9c.26 0 .4.32.26.55l-2.05 3.23c-.29.46 0 1.1.5 1.1h3.12c.26 0 .4.34.24.57z"/>
|
|
158
|
+
</symbol>`,BO=`<symbol id="file-tree-builtin-vscode" viewBox="0 0 16 16">
|
|
159
|
+
<path fill="currentColor" d="m5.11 9.68-2.4 1.84a.6.6 0 0 1-.75-.04l-.77-.7a.6.6 0 0 1 0-.87L3.28 8zm5.52-8.42a.51.51 0 0 1 .87.36V4.8L7.32 8 5.1 6.32z" opacity=".75"/>
|
|
160
|
+
<path fill="currentColor" d="M11.1 14.99h.03zM1.96 4.52a.6.6 0 0 1 .75-.04l8.8 6.71v3.19a.51.51 0 0 1-.88.36L1.19 6.1a.6.6 0 0 1 0-.87z" opacity=".65"/>
|
|
161
|
+
<path fill="currentColor" d="M11.62 14.91a.9.9 0 0 1-1-.17.51.51 0 0 0 .88-.36V1.62a.51.51 0 0 0-.87-.36.9.9 0 0 1 1-.17l2.87 1.39a.9.9 0 0 1 .5.8v9.44a.9.9 0 0 1-.5.8z"/>
|
|
162
|
+
</symbol>`,VO=`<symbol id="file-tree-builtin-vue" viewBox="0 0 16 16">
|
|
163
|
+
<path fill="currentColor" d="M9.62 2.25 8 5.02 6.38 2.25H1l7 12 7-12z" opacity=".5"/>
|
|
164
|
+
<path fill="currentColor" d="M9.54 2.25 8 4.95l-1.54-2.7H4l4 7 4-7z"/>
|
|
165
|
+
</symbol>`,HO=`<symbol id="file-tree-builtin-wasm" viewBox="0 0 16 16">
|
|
166
|
+
<path fill="currentColor" d="M13 1a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h3a2 2 0 1 0 4 0z" class="subtract" opacity=".2"/>
|
|
167
|
+
<path fill="currentColor" d="M4.64 11.4h.02l.8-3.4h.91l.73 3.45L7.88 8h.96l-1.25 5h-.97L5.9 9.6 5.1 13h-1L3 8h.98z"/>
|
|
168
|
+
<path fill="currentColor" fill-rule="evenodd" d="M13 13h-1.02l-.33-1.11H9.9L9.64 13h-.97l1.26-5h1.54zm-2.49-3.77-.42 1.84h1.32l-.49-1.84z" clip-rule="evenodd"/>
|
|
169
|
+
</symbol>`,UO=`<symbol id="file-tree-builtin-webpack" viewBox="0 0 16 16">
|
|
170
|
+
<path fill="currentColor" d="M14.1 11.79 8.26 15v-2.5l3.64-1.94zm.4-.35V4.73l-2.14 1.2v4.3zm-12.6.35L7.74 15v-2.5L4.1 10.56zm-.4-.35V4.73l2.14 1.2v4.3zm.25-7.15 6-3.29v2.42L3.9 5.47l-.03.01zm12.5 0L8.25 1v2.42l3.85 2.05.03.01z" class="bg" opacity=".4"/>
|
|
171
|
+
<path fill="currentColor" d="m7.74 11.93-3.59-1.92v-3.8l3.6 2.02zm.52 0 3.59-1.92v-3.8l-3.6 2.02zM4.4 5.77 8 3.85l3.6 1.93L8 7.8z" class="fg"/>
|
|
172
|
+
</symbol>`,WO=`<symbol id="file-tree-builtin-yml" viewBox="0 0 16 16">
|
|
173
|
+
<path fill="currentColor" d="M7.5 2A1.5 1.5 0 0 1 9 3.5v3A1.5 1.5 0 0 1 7.5 8h-2v2A1.5 1.5 0 0 0 7 11.5v-1A1.5 1.5 0 0 1 8.5 9h5a1.5 1.5 0 0 1 1.5 1.5v3a1.5 1.5 0 0 1-1.5 1.5h-5A1.5 1.5 0 0 1 7 13.5v-1A2.5 2.5 0 0 1 4.5 10V8h-2A1.5 1.5 0 0 1 1 6.5v-3A1.5 1.5 0 0 1 2.5 2zm1 8a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h5a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5zm-6-7a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h5a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5z"/>
|
|
174
|
+
</symbol>`,GO=`<symbol id="file-tree-builtin-zig" viewBox="0 0 16 16">
|
|
175
|
+
<path fill="currentColor" d="m14.73 1.5-7.29 8.82h4.17l-1.73 2.04H5.76L1.27 14.5l7.3-8.91H4.39l1.73-2.05h4.12z"/>
|
|
176
|
+
<path fill="currentColor" d="M5.21 3.54 3.56 5.6h-.55v4.73h.83L2.1 12.36H1V3.54zm9.79 0v8.82h-4.3l1.74-2.04h.55V5.68h-.83l1.74-2.14z"/>
|
|
177
|
+
</symbol>`,KO=[XD,tO,rO,iO,aO,oO,lO,uO,dO,pO,mO,hO,gO,_O,vO,wO,EO,DO,NO,PO,LO,RO,`<symbol id="file-tree-builtin-zip" viewBox="0 0 16 16">
|
|
178
|
+
<path fill="currentColor" d="M4.585 2a2 2 0 0 1 1.028.285l1.788 1.072a1 1 0 0 0 .514.143H12A2 2 0 0 1 13.935 5H0V4a2 2 0 0 1 2-2z" class="bg" opacity=".5"/>
|
|
179
|
+
<path fill="currentColor" fill-rule="evenodd" d="M14 12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-1.25h1v-1H0V6h14zM9.9 8.25c-.883 0-1.9.5-1.9.5H7v1h1v1s1.017.5 1.9.5c.884 0 1.6-.672 1.6-1.5s-.716-1.5-1.6-1.5M2 9.75v1h1v-1zm2 0v1h1v-1zm2 0v1h1v-1zm-5-1v1h1v-1zm2 0v1h1v-1zm2 0v1h1v-1z" class="fg" clip-rule="evenodd"/>
|
|
180
|
+
</symbol>`],qO=[JD,YD,ZD,QD,$D,eO,nO,sO,cO,fO,yO,bO,xO,SO,CO,TO,OO,kO,AO,jO,MO,FO,IO,zO,BO,VO,HO,UO,WO,GO];function JO(e,t){return t.length===0?e:e.replace(`</svg>`,`\n ${t.join(`
|
|
181
|
+
`)}\n</svg>`)}var YO=JO(qD,KO),XO={minimal:qD,standard:YO,complete:JO(YO,qO)},ZO={".babelrc":`babel`,".babelrc.json":`babel`,".bash_profile":`bash`,".bashrc":`bash`,".browserslistrc":`browserslist`,".dockerignore":`docker`,".eslintignore":`eslint`,".eslintrc":`eslint`,".eslintrc.cjs":`eslint`,".eslintrc.js":`eslint`,".eslintrc.json":`eslint`,".eslintrc.yaml":`eslint`,".eslintrc.yml":`eslint`,".gitattributes":`git`,".gitignore":`git`,".gitkeep":`git`,".gitmodules":`git`,".oxlintrc.json":`oxc`,".postcssrc":`postcss`,".postcssrc.json":`postcss`,".postcssrc.yaml":`postcss`,".postcssrc.yml":`postcss`,".prettierignore":`prettier`,".prettierrc":`prettier`,".prettierrc.cjs":`prettier`,".prettierrc.js":`prettier`,".prettierrc.json":`prettier`,".prettierrc.mjs":`prettier`,".prettierrc.toml":`prettier`,".prettierrc.yaml":`prettier`,".prettierrc.yml":`prettier`,".stylelintignore":`stylelint`,".stylelintrc":`stylelint`,".stylelintrc.cjs":`stylelint`,".stylelintrc.js":`stylelint`,".stylelintrc.json":`stylelint`,".stylelintrc.mjs":`stylelint`,".stylelintrc.yaml":`stylelint`,".stylelintrc.yml":`stylelint`,".terraform.lock.hcl":`terraform`,".zprofile":`bash`,".zshenv":`bash`,".zshrc":`bash`,"babel.config.cjs":`babel`,"babel.config.js":`babel`,"babel.config.json":`babel`,"babel.config.mjs":`babel`,"biome.json":`biome`,"biome.jsonc":`biome`,"bootstrap.bundle.js":`bootstrap`,"bootstrap.bundle.min.js":`bootstrap`,"bootstrap.css":`bootstrap`,"bootstrap.js":`bootstrap`,"bootstrap.min.css":`bootstrap`,"bootstrap.min.js":`bootstrap`,"bun.lock":`bun`,"bun.lockb":`bun`,"bunfig.toml":`bun`,"claude.md":`claude`,"compose.yaml":`docker`,"compose.yml":`docker`,"docker-compose.override.yml":`docker`,"docker-compose.yaml":`docker`,"docker-compose.yml":`docker`,dockerfile:`docker`,"eslint.config.cjs":`eslint`,"eslint.config.js":`eslint`,"eslint.config.mjs":`eslint`,"eslint.config.mts":`eslint`,"eslint.config.ts":`eslint`,gemfile:`ruby`,"next.config.js":`nextjs`,"next.config.mjs":`nextjs`,"next.config.mts":`nextjs`,"next.config.ts":`nextjs`,"postcss.config.cjs":`postcss`,"postcss.config.js":`postcss`,"postcss.config.mjs":`postcss`,"postcss.config.ts":`postcss`,"prettier.config.cjs":`prettier`,"prettier.config.js":`prettier`,"prettier.config.mjs":`prettier`,rakefile:`ruby`,"readme.md":`markdown`,"stylelint.config.cjs":`stylelint`,"stylelint.config.js":`stylelint`,"stylelint.config.mjs":`stylelint`,"svgo.config.cjs":`svgo`,"svgo.config.js":`svgo`,"svgo.config.mjs":`svgo`,"svgo.config.ts":`svgo`,"tailwind.config.cjs":`tailwind`,"tailwind.config.js":`tailwind`,"tailwind.config.mjs":`tailwind`,"tailwind.config.ts":`tailwind`,"vite.config.js":`vite`,"vite.config.mjs":`vite`,"vite.config.mts":`vite`,"vite.config.ts":`vite`,"webpack.config.babel.js":`webpack`,"webpack.config.cjs":`webpack`,"webpack.config.js":`webpack`,"webpack.config.mjs":`webpack`,"webpack.config.ts":`webpack`},QO={"7z":`zip`,astro:`astro`,AUTHORS:`text`,avif:`image`,bash:`bash`,bmp:`image`,bz2:`zip`,c:`c`,cc:`cpp`,cfg:`text`,CHANGELOG:`text`,cjs:`javascript`,"code-workspace":`vscode`,conf:`text`,CONTRIBUTORS:`text`,cpp:`cpp`,csh:`bash`,css:`css`,csv:`table`,cts:`typescript`,cxx:`cpp`,db:`database`,editorconfig:`text`,env:`text`,"env.development":`text`,"env.local":`text`,"env.production":`text`,eot:`font`,erb:`ruby`,fish:`bash`,gemspec:`ruby`,gif:`image`,go:`go`,gql:`graphql`,graphql:`graphql`,gz:`zip`,h:`c`,hh:`cpp`,hpp:`cpp`,htm:`html`,html:`html`,hxx:`cpp`,icns:`image`,ico:`image`,ini:`text`,inl:`cpp`,jar:`zip`,jpeg:`image`,jpg:`image`,js:`javascript`,json:`json`,json5:`json`,jsonc:`json`,jsonl:`json`,jsx:`javascript`,ksh:`bash`,less:`css`,LICENSE:`text`,log:`text`,markdown:`markdown`,mcp:`mcp`,md:`markdown`,mdx:`markdown`,"mdx.tsx":`markdown`,mjs:`javascript`,mm:`cpp`,mts:`typescript`,ods:`table`,otf:`font`,png:`image`,postcss:`css`,py:`python`,pyi:`python`,pyw:`python`,pyx:`python`,rake:`ruby`,rar:`zip`,rb:`ruby`,rs:`rust`,rst:`text`,rtf:`text`,sass:`css`,scss:`css`,sh:`bash`,sql:`database`,sqlite:`database`,sqlite3:`database`,styl:`css`,svelte:`svelte`,svg:`svg`,swift:`swift`,tar:`zip`,tf:`terraform`,tfstate:`terraform`,tfvars:`terraform`,tgz:`zip`,tif:`image`,tiff:`image`,ts:`typescript`,tsv:`table`,tsx:`typescript`,ttf:`font`,txt:`text`,vue:`vue`,war:`zip`,wasm:`wasm`,wast:`wasm`,wat:`wasm`,webp:`image`,woff:`font`,woff2:`font`,xhtml:`html`,xls:`table`,xlsx:`table`,xz:`zip`,yaml:`yml`,yml:`yml`,zig:`zig`,zip:`zip`,zsh:`bash`},$O={jsx:`react`,sass:`sass`,scss:`sass`,tsx:`react`},ek=new Set([`bash`,`c`,`cpp`,`css`,`database`,`default`,`font`,`git`,`go`,`html`,`image`,`javascript`,`json`,`markdown`,`mcp`,`python`,`ruby`,`rust`,`swift`,`table`,`text`,`typescript`,`zip`]),tk=new Set([`complete`]);function nk(e){return XO[e===`none`?`minimal`:e]}function rk(e){return`file-tree-builtin-${e}`}function ik(e){return e!==`none`&&tk.has(e)}function ak(e,t,n){if(e===`minimal`||e===`none`)return;let r=e===`complete`,i=ZO[t.toLowerCase()];if(i!=null&&(r||ek.has(i)))return i;for(let e of n){if(r){let t=$O[e];if(t!=null)return t}let t=QO[e];if(t!=null&&(r||ek.has(t)))return t}return`default`}function ok(e){return e.spriteSheet!=null||e.remap!=null||e.byFileName!=null||e.byFileExtension!=null||e.byFileNameContains!=null}function sk(e){return e==null?{set:`complete`,colored:!0}:typeof e==`string`?{set:e,colored:!0}:{...e,set:e.set??(ok(e)?`none`:`complete`),colored:e.colored??!0}}var ck={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function lk(e,t){if(typeof e==`number`)return{itemHeight:t??ck.default.itemHeight,factor:e};let n=ck[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var uk=ck.default.itemHeight,dk=`@layer base {
|
|
182
|
+
:host {
|
|
183
|
+
--trees-accent: var(--trees-accent-override, #009fff);
|
|
184
|
+
--trees-fg: var(--trees-fg-override, var(--trees-theme-sidebar-fg, light-dark(#6c6c71, #adadb1)));
|
|
185
|
+
--trees-fg-muted: var(--trees-fg-muted-override, var(--trees-theme-sidebar-header-fg, light-dark(#84848a, #84848a)));
|
|
186
|
+
--trees-bg: var(--trees-bg-override, var(--trees-theme-sidebar-bg, light-dark(#f8f8f8, #141415)));
|
|
187
|
+
--trees-bg-muted: var(--trees-bg-muted-override, var(--trees-theme-list-hover-bg, light-dark(color-mix(in lab,
|
|
188
|
+
var(--trees-accent) var(--trees-bg-alpha-light, 8%),
|
|
189
|
+
var(--trees-bg)), color-mix(in lab,
|
|
190
|
+
var(--trees-accent) var(--trees-bg-alpha-dark, 10%),
|
|
191
|
+
var(--trees-bg)))));
|
|
192
|
+
--trees-input-bg: var(--trees-input-bg-override, light-dark(#f8f8f8, #070707));
|
|
193
|
+
--trees-added-light: #16a994;
|
|
194
|
+
--trees-added-dark: #00cab1;
|
|
195
|
+
--trees-ignored-light: #adadb1;
|
|
196
|
+
--trees-ignored-dark: #4a4a4e;
|
|
197
|
+
--trees-modified-light: #1ca1c7;
|
|
198
|
+
--trees-modified-dark: #08c0ef;
|
|
199
|
+
--trees-renamed-light: #d5a910;
|
|
200
|
+
--trees-renamed-dark: #ffd452;
|
|
201
|
+
--trees-untracked-light: #16a994;
|
|
202
|
+
--trees-untracked-dark: #00cab1;
|
|
203
|
+
--trees-deleted-light: #ff2e3f;
|
|
204
|
+
--trees-deleted-dark: #ff6762;
|
|
205
|
+
--trees-border-color: var(--trees-border-color-override, var(--trees-theme-sidebar-border, light-dark(#eeeeef, #070707)));
|
|
206
|
+
--trees-indent-guide-bg: var(--trees-indent-guide-bg-override, color-mix(in lab, var(--trees-fg-muted) 25%, transparent));
|
|
207
|
+
--trees-density: var(--trees-density-override, 1);
|
|
208
|
+
--trees-border-radius: var(--trees-border-radius-override, calc(6px * var(--trees-density)));
|
|
209
|
+
--trees-font-family: var(--trees-font-family-override, system-ui);
|
|
210
|
+
--trees-font-size: var(--trees-font-size-override, 13px);
|
|
211
|
+
--trees-font-weight-regular: var(--trees-font-weight-regular-override, 400);
|
|
212
|
+
--trees-font-weight-semibold: var(--trees-font-weight-semibold-override, 600);
|
|
213
|
+
--trees-focus-ring-color: var(--trees-focus-ring-color-override, var(--trees-theme-focus-ring, var(--trees-accent)));
|
|
214
|
+
--trees-focus-ring-width: var(--trees-focus-ring-width-override, 1px);
|
|
215
|
+
--trees-focus-ring-offset: var(--trees-focus-ring-offset-override, -1px);
|
|
216
|
+
--trees-search-fg: var(--trees-search-fg-override, var(--trees-theme-input-fg, var(--trees-fg)));
|
|
217
|
+
--trees-search-font-weight: var(--trees-search-font-weight-override, 600);
|
|
218
|
+
--trees-search-bg: var(--trees-search-bg-override, var(--trees-theme-input-bg, var(--trees-input-bg)));
|
|
219
|
+
--trees-scrollbar-thumb: var(--trees-scrollbar-thumb-override, var(--trees-theme-scrollbar-thumb, color-mix(in lab, var(--trees-fg) 25%, var(--trees-bg))));
|
|
220
|
+
--trees-selected-fg: var(--trees-selected-fg-override, var(--trees-theme-list-active-selection-fg, var(--trees-fg)));
|
|
221
|
+
--trees-selected-bg: var(--trees-selected-bg-override, var(--trees-theme-list-active-selection-bg, light-dark(color-mix(in lab, var(--trees-accent) 12%, var(--trees-bg)), color-mix(in lab, var(--trees-accent) 15%, var(--trees-bg)))));
|
|
222
|
+
--trees-selected-focused-border-color: var(--trees-selected-focused-border-color-override, var(--trees-theme-focus-ring, var(--trees-accent)));
|
|
223
|
+
--trees-status-added: var(--trees-status-added-override, var(--trees-theme-git-added-fg, light-dark(var(--trees-added-light), var(--trees-added-dark))));
|
|
224
|
+
--trees-status-ignored: var(--trees-status-ignored-override, var(--trees-theme-git-ignored-fg, light-dark(var(--trees-ignored-light), var(--trees-ignored-dark))));
|
|
225
|
+
--trees-status-modified: var(--trees-status-modified-override, var(--trees-theme-git-modified-fg, light-dark(var(--trees-modified-light), var(--trees-modified-dark))));
|
|
226
|
+
--trees-status-renamed: var(--trees-status-renamed-override, var(--trees-theme-git-renamed-fg, light-dark(var(--trees-renamed-light), var(--trees-renamed-dark))));
|
|
227
|
+
--trees-status-untracked: var(--trees-status-untracked-override, var(--trees-theme-git-untracked-fg, light-dark(var(--trees-untracked-light), var(--trees-untracked-dark))));
|
|
228
|
+
--trees-status-deleted: var(--trees-status-deleted-override, var(--trees-theme-git-deleted-fg, light-dark(var(--trees-deleted-light), var(--trees-deleted-dark))));
|
|
229
|
+
--trees-git-modified-color: var(--trees-git-modified-color-override, var(--trees-status-modified));
|
|
230
|
+
--trees-git-added-color: var(--trees-git-added-color-override, var(--trees-status-added));
|
|
231
|
+
--trees-git-ignored-color: var(--trees-git-ignored-color-override, var(--trees-status-ignored));
|
|
232
|
+
--trees-git-deleted-color: var(--trees-git-deleted-color-override, var(--trees-status-deleted));
|
|
233
|
+
--trees-git-renamed-color: var(--trees-git-renamed-color-override, var(--trees-status-renamed));
|
|
234
|
+
--trees-git-untracked-color: var(--trees-git-untracked-color-override, var(--trees-status-untracked));
|
|
235
|
+
--trees-icon-gray: light-dark(#84848a, #adadb1);
|
|
236
|
+
--trees-icon-red: light-dark(#d52c36, #ff6762);
|
|
237
|
+
--trees-icon-vermilion: light-dark(#ff8c5b, #d5512f);
|
|
238
|
+
--trees-icon-orange: light-dark(#d47628, #ffa359);
|
|
239
|
+
--trees-icon-yellow: light-dark(#d5a910, #ffd452);
|
|
240
|
+
--trees-icon-green: light-dark(#199f43, #5ecc71);
|
|
241
|
+
--trees-icon-teal: light-dark(#17a5af, #64d1db);
|
|
242
|
+
--trees-icon-cyan: light-dark(#1ca1c7, #68cdf2);
|
|
243
|
+
--trees-icon-blue: light-dark(#1a85d4, #69b1ff);
|
|
244
|
+
--trees-icon-indigo: light-dark(#693acf, #9d6afb);
|
|
245
|
+
--trees-icon-purple: light-dark(#a631be, #d568ea);
|
|
246
|
+
--trees-icon-pink: light-dark(#d32a61, #ff678d);
|
|
247
|
+
--trees-icon-mauve: light-dark(#594c5b, #79697b);
|
|
248
|
+
--trees-file-icon-color-default: var(--trees-file-icon-color, var(--trees-icon-gray));
|
|
249
|
+
--trees-file-icon-color-astro: var(--trees-file-icon-color, var(--trees-icon-purple));
|
|
250
|
+
--trees-file-icon-color-babel: var(--trees-file-icon-color, var(--trees-icon-yellow));
|
|
251
|
+
--trees-file-icon-color-bash: var(--trees-file-icon-color, var(--trees-icon-green));
|
|
252
|
+
--trees-file-icon-color-biome: var(--trees-file-icon-color, var(--trees-icon-blue));
|
|
253
|
+
--trees-file-icon-color-bootstrap: var(--trees-file-icon-color, var(--trees-icon-indigo));
|
|
254
|
+
--trees-file-icon-color-browserslist: var(--trees-file-icon-color, var(--trees-icon-yellow));
|
|
255
|
+
--trees-file-icon-color-bun: var(--trees-file-icon-color, var(--trees-icon-mauve));
|
|
256
|
+
--trees-file-icon-color-c: var(--trees-file-icon-color, var(--trees-icon-blue));
|
|
257
|
+
--trees-file-icon-color-cpp: var(--trees-file-icon-color, var(--trees-icon-blue));
|
|
258
|
+
--trees-file-icon-color-claude: var(--trees-file-icon-color, var(--trees-icon-orange));
|
|
259
|
+
--trees-file-icon-color-css: var(--trees-file-icon-color, var(--trees-icon-indigo));
|
|
260
|
+
--trees-file-icon-color-database: var(--trees-file-icon-color, var(--trees-icon-purple));
|
|
261
|
+
--trees-file-icon-color-docker: var(--trees-file-icon-color, var(--trees-icon-blue));
|
|
262
|
+
--trees-file-icon-color-eslint: var(--trees-file-icon-color, var(--trees-icon-indigo));
|
|
263
|
+
--trees-file-icon-color-git: var(--trees-file-icon-vermilion, var(--trees-icon-vermilion));
|
|
264
|
+
--trees-file-icon-color-go: var(--trees-file-icon-color, var(--trees-icon-cyan));
|
|
265
|
+
--trees-file-icon-color-graphql: var(--trees-file-icon-color, var(--trees-icon-pink));
|
|
266
|
+
--trees-file-icon-color-html: var(--trees-file-icon-color, var(--trees-icon-orange));
|
|
267
|
+
--trees-file-icon-color-image: var(--trees-file-icon-color, var(--trees-icon-pink));
|
|
268
|
+
--trees-file-icon-color-javascript: var(--trees-file-icon-color, var(--trees-icon-yellow));
|
|
269
|
+
--trees-file-icon-color-json: var(--trees-file-icon-color, var(--trees-icon-orange));
|
|
270
|
+
--trees-file-icon-color-markdown: var(--trees-file-icon-color, var(--trees-icon-green));
|
|
271
|
+
--trees-file-icon-color-mcp: var(--trees-file-icon-color, var(--trees-icon-teal));
|
|
272
|
+
--trees-file-icon-color-npm: var(--trees-file-icon-color, var(--trees-icon-red));
|
|
273
|
+
--trees-file-icon-color-oxc: var(--trees-file-icon-cyan, var(--trees-icon-cyan));
|
|
274
|
+
--trees-file-icon-color-postcss: var(--trees-file-icon-color, var(--trees-icon-red));
|
|
275
|
+
--trees-file-icon-color-prettier: var(--trees-file-icon-color, var(--trees-icon-teal));
|
|
276
|
+
--trees-file-icon-color-python: var(--trees-file-icon-color, var(--trees-icon-blue));
|
|
277
|
+
--trees-file-icon-color-react: var(--trees-file-icon-color, var(--trees-icon-cyan));
|
|
278
|
+
--trees-file-icon-color-ruby: var(--trees-file-icon-color, var(--trees-icon-red));
|
|
279
|
+
--trees-file-icon-color-rust: var(--trees-file-icon-color, var(--trees-icon-orange));
|
|
280
|
+
--trees-file-icon-color-sass: var(--trees-file-icon-color, var(--trees-icon-pink));
|
|
281
|
+
--trees-file-icon-color-svg: var(--trees-file-icon-color, var(--trees-icon-orange));
|
|
282
|
+
--trees-file-icon-color-svelte: var(--trees-file-icon-color, var(--trees-icon-red));
|
|
283
|
+
--trees-file-icon-color-svgo: var(--trees-file-icon-color, var(--trees-icon-green));
|
|
284
|
+
--trees-file-icon-color-swift: var(--trees-file-icon-color, var(--trees-icon-orange));
|
|
285
|
+
--trees-file-icon-color-table: var(--trees-file-icon-color, var(--trees-icon-teal));
|
|
286
|
+
--trees-file-icon-color-text: var(--trees-file-icon-color, var(--trees-icon-gray));
|
|
287
|
+
--trees-file-icon-color-tailwind: var(--trees-file-icon-color, var(--trees-icon-cyan));
|
|
288
|
+
--trees-file-icon-color-terraform: var(--trees-file-icon-color, var(--trees-icon-indigo));
|
|
289
|
+
--trees-file-icon-color-typescript: var(--trees-file-icon-color, var(--trees-icon-blue));
|
|
290
|
+
--trees-file-icon-color-vite: var(--trees-file-icon-color, var(--trees-icon-purple));
|
|
291
|
+
--trees-file-icon-color-vscode: var(--trees-file-icon-color, var(--trees-icon-blue));
|
|
292
|
+
--trees-file-icon-color-vue: var(--trees-file-icon-color, var(--trees-icon-green));
|
|
293
|
+
--trees-file-icon-color-wasm: var(--trees-file-icon-color, var(--trees-icon-indigo));
|
|
294
|
+
--trees-file-icon-color-webpack: var(--trees-file-icon-color, var(--trees-icon-blue));
|
|
295
|
+
--trees-file-icon-color-yml: var(--trees-file-icon-color, var(--trees-icon-red));
|
|
296
|
+
--trees-file-icon-color-zig: var(--trees-file-icon-color, var(--trees-icon-orange));
|
|
297
|
+
--trees-file-icon-color-zip: var(--trees-file-icon-color, var(--trees-icon-orange));
|
|
298
|
+
--trees-level-gap: var(--trees-level-gap-override, calc(8px * var(--trees-density)));
|
|
299
|
+
--trees-item-padding-x: var(--trees-item-padding-x-override, calc(8px * var(--trees-density)));
|
|
300
|
+
--trees-item-margin-x: var(--trees-item-margin-x-override, calc(2px * var(--trees-density)));
|
|
301
|
+
--trees-item-row-gap: var(--trees-item-row-gap-override, calc(6px * var(--trees-density)));
|
|
302
|
+
--trees-icon-width: var(--trees-icon-width-override, 16px);
|
|
303
|
+
--trees-icon-nudge: var(--trees-icon-nudge-override, calc(1px * var(--trees-density)));
|
|
304
|
+
--trees-row-height: var(--trees-item-height, 30px);
|
|
305
|
+
--trees-git-lane-width: var(--trees-git-lane-width-override, 12px);
|
|
306
|
+
--trees-action-lane-width: var(--trees-action-lane-width-override, calc(var(--trees-icon-width) + 2px));
|
|
307
|
+
--trees-context-menu-trigger-inline-offset: calc(var(--trees-padding-inline) + var(--trees-item-padding-x) -
|
|
308
|
+
var(--trees-focus-ring-width));
|
|
309
|
+
--trees-scrollbar-gutter: var(--trees-scrollbar-gutter-override, 6px);
|
|
310
|
+
--trees-padding-inline: var(--trees-padding-inline-override, 16px);
|
|
311
|
+
color-scheme: light dark;
|
|
312
|
+
font-size: var(--trees-font-size);
|
|
313
|
+
color: var(--trees-fg);
|
|
314
|
+
background-color: var(--trees-bg);
|
|
315
|
+
--truncate-marker-background-color: var(--trees-bg);
|
|
316
|
+
--truncate-marker-background-overlay-color: transparent;
|
|
317
|
+
font-family: var(--trees-font-family);
|
|
318
|
+
font-weight: var(--trees-font-weight-regular);
|
|
319
|
+
flex-direction: column;
|
|
320
|
+
display: flex;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
:host([data-file-tree-virtualized="true"]) {
|
|
324
|
+
height: 100%;
|
|
325
|
+
overflow: hidden;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
[data-file-tree-virtualized-wrapper="true"], [data-file-tree-virtualized-root="true"] {
|
|
329
|
+
flex-direction: column;
|
|
330
|
+
height: 100%;
|
|
331
|
+
display: flex;
|
|
332
|
+
overflow: hidden;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
[data-file-tree-virtualized-scroll="true"], [data-file-tree-scrollbar-measure="true"] {
|
|
336
|
+
--trees-scrollbar-thumb-current: transparent;
|
|
337
|
+
scrollbar-gutter: stable;
|
|
338
|
+
overflow-y: auto;
|
|
339
|
+
|
|
340
|
+
&:hover {
|
|
341
|
+
--trees-scrollbar-thumb-current: var(--trees-scrollbar-thumb);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
&::-webkit-scrollbar {
|
|
345
|
+
width: var(--trees-scrollbar-gutter);
|
|
346
|
+
height: var(--trees-scrollbar-gutter);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
&::-webkit-scrollbar-track {
|
|
350
|
+
background: none;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
&::-webkit-scrollbar-thumb {
|
|
354
|
+
background-color: var(--trees-scrollbar-thumb-current);
|
|
355
|
+
border-radius: calc(var(--trees-scrollbar-gutter) / 2);
|
|
356
|
+
background-clip: content-box;
|
|
357
|
+
border: 1px solid #0000;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
&::-webkit-scrollbar-corner {
|
|
361
|
+
background-color: #0000;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
[data-file-tree-scrollbar-measure="true"] {
|
|
366
|
+
visibility: hidden;
|
|
367
|
+
pointer-events: none;
|
|
368
|
+
width: 100px;
|
|
369
|
+
height: 100px;
|
|
370
|
+
position: absolute;
|
|
371
|
+
top: 0;
|
|
372
|
+
left: 0;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
@supports ((-moz-appearance: none)) {
|
|
376
|
+
[data-file-tree-virtualized-scroll="true"], [data-file-tree-scrollbar-measure="true"] {
|
|
377
|
+
scrollbar-width: thin;
|
|
378
|
+
scrollbar-color: var(--trees-scrollbar-thumb-current) transparent;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
[data-file-tree-virtualized-scroll="true"] {
|
|
383
|
+
min-height: 0;
|
|
384
|
+
padding-inline: max(calc(var(--trees-padding-inline) - var(--trees-item-margin-x)),
|
|
385
|
+
0px)
|
|
386
|
+
/* NOTE(amadeus): We can assume that all Webkit based browser gutters
|
|
387
|
+
* will align to the value of '--trees-scrollbar-gutter', however if not, then
|
|
388
|
+
* \`--trees-scrollbar-gutter-measured\` should correct it. Mostly we are
|
|
389
|
+
* hoping to avoid SSR alignment jumps if possible. In non-SSR'd environments
|
|
390
|
+
* \`--trees-scrollbar-gutter-measured\` should always be immediately available.
|
|
391
|
+
*/
|
|
392
|
+
max(calc(var(--trees-padding-inline) - var(--trees-item-margin-x) -
|
|
393
|
+
var(--trees-scrollbar-gutter-measured, var(--trees-scrollbar-gutter))),
|
|
394
|
+
0px);
|
|
395
|
+
flex: 1 1 0;
|
|
396
|
+
position: relative;
|
|
397
|
+
overflow-y: auto;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
@supports ((-moz-appearance: none)) {
|
|
401
|
+
[data-file-tree-virtualized-scroll="true"] {
|
|
402
|
+
padding-inline: max(calc(var(--trees-padding-inline) - var(--trees-item-margin-x)),
|
|
403
|
+
0px)
|
|
404
|
+
/* NOTE(amadeus): However on Firefox it can vary a little bit, but most
|
|
405
|
+
* likely the majority of cases will default to a 0px width scrollbar lets
|
|
406
|
+
* inherit that first to avoid SSR jumps. In non-SSR'd environments
|
|
407
|
+
* \`--trees-scrollbar-gutter-measured\` should always be immediately available.
|
|
408
|
+
*/
|
|
409
|
+
max(calc(var(--trees-padding-inline) - var(--trees-item-margin-x) -
|
|
410
|
+
var(--trees-scrollbar-gutter-measured, 0px)),
|
|
411
|
+
0px);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
[data-file-tree-sticky-overlay="true"] {
|
|
416
|
+
z-index: 4;
|
|
417
|
+
pointer-events: none;
|
|
418
|
+
height: 0;
|
|
419
|
+
position: sticky;
|
|
420
|
+
top: 0;
|
|
421
|
+
overflow: visible;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
[data-file-tree-virtualized-root="true"][data-scroll-at-top="true"]:not([data-overlay-reveal]) [data-file-tree-sticky-overlay="true"] {
|
|
425
|
+
visibility: hidden;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
[data-file-tree-sticky-overlay-content="true"] {
|
|
429
|
+
background-color: var(--trees-bg);
|
|
430
|
+
pointer-events: none;
|
|
431
|
+
position: relative;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
[data-file-tree-virtualized-list="true"] {
|
|
435
|
+
background-color: var(--trees-bg);
|
|
436
|
+
overflow-anchor: none;
|
|
437
|
+
width: 100%;
|
|
438
|
+
min-height: 100%;
|
|
439
|
+
position: relative;
|
|
440
|
+
|
|
441
|
+
&[data-is-scrolling] {
|
|
442
|
+
pointer-events: none;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
[data-file-tree-virtualized-sticky-offset="true"] {
|
|
447
|
+
contain: layout size;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
[data-file-tree-virtualized-sticky="true"] {
|
|
451
|
+
isolation: isolate;
|
|
452
|
+
will-change: transform;
|
|
453
|
+
flex-direction: column;
|
|
454
|
+
width: 100%;
|
|
455
|
+
display: flex;
|
|
456
|
+
position: sticky;
|
|
457
|
+
top: 0;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
[data-file-tree-search-container] {
|
|
461
|
+
padding: 0;
|
|
462
|
+
padding-inline: var(--trees-padding-inline);
|
|
463
|
+
margin-bottom: var(--trees-item-row-gap);
|
|
464
|
+
display: flex;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
[data-file-tree-search-input] {
|
|
468
|
+
--trees-focus-ring-width: 2px;
|
|
469
|
+
font-family: var(--trees-font-family);
|
|
470
|
+
font-size: var(--trees-font-size);
|
|
471
|
+
height: var(--trees-row-height);
|
|
472
|
+
padding-inline: var(--trees-item-padding-x);
|
|
473
|
+
line-height: var(--trees-row-height);
|
|
474
|
+
color: var(--trees-search-fg);
|
|
475
|
+
background-color: var(--trees-search-bg);
|
|
476
|
+
border: 1px solid var(--trees-border-color);
|
|
477
|
+
border-radius: var(--trees-border-radius);
|
|
478
|
+
outline: none;
|
|
479
|
+
flex: 1;
|
|
480
|
+
margin-block: 1px;
|
|
481
|
+
|
|
482
|
+
&::placeholder {
|
|
483
|
+
color: color-mix(in lab,
|
|
484
|
+
var(--trees-search-fg) 65%,
|
|
485
|
+
var(--trees-search-bg));
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
&:focus-visible, &[data-file-tree-search-input-fake-focus="true"] {
|
|
489
|
+
outline: var(--trees-focus-ring-width) solid var(--trees-focus-ring-color);
|
|
490
|
+
outline-offset: var(--trees-focus-ring-offset);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
[role="tree"] {
|
|
495
|
+
gap: var(--trees-gap-override, 0);
|
|
496
|
+
flex-direction: column;
|
|
497
|
+
display: flex;
|
|
498
|
+
position: relative;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
[data-type="item"] {
|
|
502
|
+
color: inherit;
|
|
503
|
+
font-family: var(--trees-font-family);
|
|
504
|
+
font-size: var(--trees-font-size);
|
|
505
|
+
text-align: start;
|
|
506
|
+
background-color: var(--trees-bg);
|
|
507
|
+
padding: 0 var(--trees-item-padding-x);
|
|
508
|
+
margin: 0 var(--trees-item-margin-x);
|
|
509
|
+
cursor: pointer;
|
|
510
|
+
user-select: none;
|
|
511
|
+
-webkit-touch-callout: none;
|
|
512
|
+
touch-action: manipulation;
|
|
513
|
+
flex: 0 0 var(--trees-row-height);
|
|
514
|
+
height: var(--trees-row-height);
|
|
515
|
+
line-height: var(--trees-row-height);
|
|
516
|
+
align-items: center;
|
|
517
|
+
gap: var(--trees-item-row-gap);
|
|
518
|
+
border-radius: var(--trees-border-radius);
|
|
519
|
+
--truncate-marker-background-color: var(--trees-bg);
|
|
520
|
+
--truncate-marker-background-overlay-color: transparent;
|
|
521
|
+
--truncate-marker-block-inset: 0px;
|
|
522
|
+
border: none;
|
|
523
|
+
outline: none;
|
|
524
|
+
display: flex;
|
|
525
|
+
position: relative;
|
|
526
|
+
|
|
527
|
+
&:hover, &[data-item-context-hover="true"] {
|
|
528
|
+
background-color: var(--trees-bg-muted);
|
|
529
|
+
--truncate-marker-background-overlay-color: var(--trees-bg-muted);
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
&[data-item-focused="true"], &:focus-visible {
|
|
533
|
+
z-index: 2;
|
|
534
|
+
|
|
535
|
+
& [data-item-flattened-subitems] {
|
|
536
|
+
--truncate-marker-block-inset: var(--trees-focus-ring-width);
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
&:before {
|
|
540
|
+
content: "";
|
|
541
|
+
border-radius: var(--trees-border-radius);
|
|
542
|
+
outline: var(--trees-focus-ring-width) solid
|
|
543
|
+
var(--trees-focus-ring-color);
|
|
544
|
+
outline-offset: var(--trees-focus-ring-offset);
|
|
545
|
+
pointer-events: none;
|
|
546
|
+
display: block;
|
|
547
|
+
position: absolute;
|
|
548
|
+
inset: 0;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
&[data-item-selected="true"]:before {
|
|
552
|
+
outline-color: var(--trees-selected-focused-border-color);
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
&[data-item-selected="true"] {
|
|
557
|
+
color: var(--trees-selected-fg);
|
|
558
|
+
background-color: var(--trees-selected-bg);
|
|
559
|
+
--truncate-marker-background-overlay-color: var(--trees-selected-bg);
|
|
560
|
+
z-index: 3;
|
|
561
|
+
|
|
562
|
+
& [data-item-section="icon"] {
|
|
563
|
+
color: var(--trees-selected-fg);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
&[data-item-search-match="true"] {
|
|
568
|
+
font-weight: var(--trees-search-font-weight);
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
[data-type="item"][data-file-tree-sticky-row="true"] {
|
|
573
|
+
pointer-events: auto;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
[data-file-tree-virtualized-root="true"][data-is-scrolling] [data-type="item"][data-file-tree-sticky-row="true"] {
|
|
577
|
+
pointer-events: none;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
[data-file-tree-virtualized-root="true"][data-is-scrolling] [data-type="item"][data-file-tree-sticky-row="true"]:hover:not([data-item-selected="true"]), [data-file-tree-virtualized-root="true"][data-is-scrolling] [data-type="item"][data-file-tree-sticky-row="true"][data-item-context-hover="true"]:not([data-item-selected="true"]) {
|
|
581
|
+
background-color: var(--trees-bg);
|
|
582
|
+
--truncate-marker-background-overlay-color: transparent;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
[data-item-selected="true"]:has( + [data-item-selected="true"]) {
|
|
586
|
+
border-bottom-right-radius: 0;
|
|
587
|
+
border-bottom-left-radius: 0;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
[data-item-selected="true"] + [data-item-selected="true"] {
|
|
591
|
+
border-top-left-radius: 0;
|
|
592
|
+
border-top-right-radius: 0;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
[data-item-flattened-subitems] {
|
|
596
|
+
align-items: center;
|
|
597
|
+
gap: 2px;
|
|
598
|
+
display: inline-flex;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
[data-item-flattened-subitem]:hover, [data-item-flattened-subitem-drag-target="true"] {
|
|
602
|
+
text-decoration: underline;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
[data-item-section="icon"] {
|
|
606
|
+
color: var(--trees-fg-muted);
|
|
607
|
+
fill: currentColor;
|
|
608
|
+
width: var(--trees-icon-width);
|
|
609
|
+
flex-shrink: 0;
|
|
610
|
+
justify-content: center;
|
|
611
|
+
align-items: center;
|
|
612
|
+
display: flex;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
:where([data-item-section="icon"] > [data-icon-token]) {
|
|
616
|
+
color: var(--trees-fg-muted);
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
[data-file-tree-colored-icons="true"] {
|
|
620
|
+
& [data-icon-token="astro"] {
|
|
621
|
+
color: var(--trees-file-icon-color-astro);
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
& [data-icon-token="babel"] {
|
|
625
|
+
color: var(--trees-file-icon-color-babel);
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
& [data-icon-token="bash"] {
|
|
629
|
+
color: var(--trees-file-icon-color-bash);
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
& [data-icon-token="biome"] {
|
|
633
|
+
color: var(--trees-file-icon-color-biome);
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
& [data-icon-token="bootstrap"] {
|
|
637
|
+
color: var(--trees-file-icon-color-bootstrap);
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
& [data-icon-token="browserslist"] {
|
|
641
|
+
color: var(--trees-file-icon-color-browserslist);
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
& [data-icon-token="bun"] {
|
|
645
|
+
color: var(--trees-file-icon-color-bun);
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
& [data-icon-token="c"] {
|
|
649
|
+
color: var(--trees-file-icon-color-c);
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
& [data-icon-token="cpp"] {
|
|
653
|
+
color: var(--trees-file-icon-color-cpp);
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
& [data-icon-token="claude"] {
|
|
657
|
+
color: var(--trees-file-icon-color-claude);
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
& [data-icon-token="css"] {
|
|
661
|
+
color: var(--trees-file-icon-color-css);
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
& [data-icon-token="database"] {
|
|
665
|
+
color: var(--trees-file-icon-color-database);
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
& [data-icon-token="default"] {
|
|
669
|
+
color: var(--trees-file-icon-color-default);
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
& [data-icon-token="docker"] {
|
|
673
|
+
color: var(--trees-file-icon-color-docker);
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
& [data-icon-token="eslint"] {
|
|
677
|
+
color: var(--trees-file-icon-color-eslint);
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
& [data-icon-token="git"] {
|
|
681
|
+
color: var(--trees-file-icon-color-git);
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
& [data-icon-token="go"] {
|
|
685
|
+
color: var(--trees-file-icon-color-go);
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
& [data-icon-token="graphql"] {
|
|
689
|
+
color: var(--trees-file-icon-color-graphql);
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
& [data-icon-token="html"] {
|
|
693
|
+
color: var(--trees-file-icon-color-html);
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
& [data-icon-token="image"] {
|
|
697
|
+
color: var(--trees-file-icon-color-image);
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
& [data-icon-token="javascript"] {
|
|
701
|
+
color: var(--trees-file-icon-color-javascript);
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
& [data-icon-token="json"] {
|
|
705
|
+
color: var(--trees-file-icon-color-json);
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
& [data-icon-token="markdown"] {
|
|
709
|
+
color: var(--trees-file-icon-color-markdown);
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
& [data-icon-token="mcp"] {
|
|
713
|
+
color: var(--trees-file-icon-color-mcp);
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
& [data-icon-token="npm"] {
|
|
717
|
+
color: var(--trees-file-icon-color-npm);
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
& [data-icon-token="oxc"] {
|
|
721
|
+
color: var(--trees-file-icon-color-oxc);
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
& [data-icon-token="postcss"] {
|
|
725
|
+
color: var(--trees-file-icon-color-postcss);
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
& [data-icon-token="prettier"] {
|
|
729
|
+
color: var(--trees-file-icon-color-prettier);
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
& [data-icon-token="python"] {
|
|
733
|
+
color: var(--trees-file-icon-color-python);
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
& [data-icon-token="react"] {
|
|
737
|
+
color: var(--trees-file-icon-color-react);
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
& [data-icon-token="ruby"] {
|
|
741
|
+
color: var(--trees-file-icon-color-ruby);
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
& [data-icon-token="rust"] {
|
|
745
|
+
color: var(--trees-file-icon-color-rust);
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
& [data-icon-token="sass"] {
|
|
749
|
+
color: var(--trees-file-icon-color-sass);
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
& [data-icon-token="svg"] {
|
|
753
|
+
color: var(--trees-file-icon-color-svg);
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
& [data-icon-token="svelte"] {
|
|
757
|
+
color: var(--trees-file-icon-color-svelte);
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
& [data-icon-token="svgo"] {
|
|
761
|
+
color: var(--trees-file-icon-color-svgo);
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
& [data-icon-token="swift"] {
|
|
765
|
+
color: var(--trees-file-icon-color-swift);
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
& [data-icon-token="table"] {
|
|
769
|
+
color: var(--trees-file-icon-color-table);
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
& [data-icon-token="text"] {
|
|
773
|
+
color: var(--trees-file-icon-color-text);
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
& [data-icon-token="tailwind"] {
|
|
777
|
+
color: var(--trees-file-icon-color-tailwind);
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
& [data-icon-token="terraform"] {
|
|
781
|
+
color: var(--trees-file-icon-color-terraform);
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
& [data-icon-token="typescript"] {
|
|
785
|
+
color: var(--trees-file-icon-color-typescript);
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
& [data-icon-token="vite"] {
|
|
789
|
+
color: var(--trees-file-icon-color-vite);
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
& [data-icon-token="vscode"] {
|
|
793
|
+
color: var(--trees-file-icon-color-vscode);
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
& [data-icon-token="vue"] {
|
|
797
|
+
color: var(--trees-file-icon-color-vue);
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
& [data-icon-token="wasm"] {
|
|
801
|
+
color: var(--trees-file-icon-color-wasm);
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
& [data-icon-token="webpack"] {
|
|
805
|
+
color: var(--trees-file-icon-color-webpack);
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
& [data-icon-token="yml"] {
|
|
809
|
+
color: var(--trees-file-icon-color-yml);
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
& [data-icon-token="zig"] {
|
|
813
|
+
color: var(--trees-file-icon-color-zig);
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
& [data-icon-token="zip"] {
|
|
817
|
+
color: var(--trees-file-icon-color-zip);
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
[data-icon-name="file-tree-icon-chevron"] {
|
|
822
|
+
&[data-align-capitals="false"] {
|
|
823
|
+
transform: translate(0, var(--trees-icon-nudge));
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
&[data-align-capitals="true"] {
|
|
827
|
+
transform: translate(0);
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
[data-item-section="content"] {
|
|
832
|
+
text-align: start;
|
|
833
|
+
text-overflow: ellipsis;
|
|
834
|
+
flex: 0 auto;
|
|
835
|
+
min-width: 0;
|
|
836
|
+
max-width: 100%;
|
|
837
|
+
overflow: hidden;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
[data-item-section="decoration"] {
|
|
841
|
+
text-align: end;
|
|
842
|
+
min-width: 0;
|
|
843
|
+
color: var(--trees-fg-muted);
|
|
844
|
+
flex: 1 1 0;
|
|
845
|
+
justify-content: flex-end;
|
|
846
|
+
display: flex;
|
|
847
|
+
overflow: hidden;
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
[data-item-section="decoration"] > span {
|
|
851
|
+
text-overflow: ellipsis;
|
|
852
|
+
white-space: nowrap;
|
|
853
|
+
justify-content: flex-end;
|
|
854
|
+
align-items: center;
|
|
855
|
+
min-width: 0;
|
|
856
|
+
max-width: 100%;
|
|
857
|
+
display: inline-flex;
|
|
858
|
+
overflow: hidden;
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
[data-item-section="git"], [data-item-section="action"] {
|
|
862
|
+
flex: none;
|
|
863
|
+
justify-content: center;
|
|
864
|
+
align-items: center;
|
|
865
|
+
display: flex;
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
[data-item-section="git"] {
|
|
869
|
+
width: var(--trees-git-lane-width);
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
[data-item-section="action"] {
|
|
873
|
+
width: var(--trees-action-lane-width);
|
|
874
|
+
color: var(--trees-fg-muted);
|
|
875
|
+
fill: currentColor;
|
|
876
|
+
pointer-events: none;
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
[data-item-section="git"] > span, [data-item-section="action"] > span {
|
|
880
|
+
justify-content: center;
|
|
881
|
+
align-items: center;
|
|
882
|
+
width: 100%;
|
|
883
|
+
display: inline-flex;
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
[data-item-action-affordance="decorative"] {
|
|
887
|
+
opacity: .85;
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
[data-item-rename-input] {
|
|
891
|
+
appearance: none;
|
|
892
|
+
width: 100%;
|
|
893
|
+
min-width: 0;
|
|
894
|
+
height: calc(var(--trees-row-height) - 4px);
|
|
895
|
+
font-family: inherit;
|
|
896
|
+
font-size: inherit;
|
|
897
|
+
color: inherit;
|
|
898
|
+
box-sizing: border-box;
|
|
899
|
+
background-color: #0000;
|
|
900
|
+
border: 0;
|
|
901
|
+
outline: none;
|
|
902
|
+
padding-inline: 6px;
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
[data-item-section="content"]:has([data-item-rename-input]) ~ [data-item-section="action"], [data-item-section="content"]:has([data-item-rename-input]) ~ [data-item-section="decoration"] {
|
|
906
|
+
display: none;
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
[aria-expanded="false"][data-item-type="folder"] > [data-item-section="icon"] > [data-icon-name="file-tree-icon-chevron"] {
|
|
910
|
+
&[data-align-capitals="true"] {
|
|
911
|
+
transform: rotate(-90deg)
|
|
912
|
+
translate(calc(var(--trees-icon-nudge) / 2),
|
|
913
|
+
calc(var(--trees-icon-nudge) / 2));
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
&[data-align-capitals="false"] {
|
|
917
|
+
transform: rotate(-90deg)
|
|
918
|
+
translate(calc(var(--trees-icon-nudge) / 2 * -1),
|
|
919
|
+
calc(var(--trees-icon-nudge) / 2));
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
[data-item-section="spacing"] {
|
|
924
|
+
height: var(--trees-row-height);
|
|
925
|
+
padding-left: calc(calc(var(--trees-icon-width) / 2) - .5px);
|
|
926
|
+
flex-direction: row;
|
|
927
|
+
justify-content: center;
|
|
928
|
+
align-items: center;
|
|
929
|
+
display: flex;
|
|
930
|
+
|
|
931
|
+
&:empty {
|
|
932
|
+
padding-left: 0;
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
[data-item-section="spacing-item"] {
|
|
937
|
+
border-left: 1px solid var(--trees-indent-guide-bg);
|
|
938
|
+
height: 100%;
|
|
939
|
+
margin-right: calc(var(--trees-level-gap) - 1px);
|
|
940
|
+
opacity: 0;
|
|
941
|
+
transition: opacity .15s;
|
|
942
|
+
display: inline-block;
|
|
943
|
+
transform: translateX(-.25px);
|
|
944
|
+
|
|
945
|
+
& + & {
|
|
946
|
+
margin-left: calc(var(--trees-item-row-gap) + calc(var(--trees-icon-width) / 2) - .5px);
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
:host(:hover) [data-item-section="spacing-item"] {
|
|
951
|
+
opacity: .75;
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
[data-item-contains-git-change="true"] > [data-item-section="git"] {
|
|
955
|
+
color: var(--trees-git-modified-color);
|
|
956
|
+
opacity: .5;
|
|
957
|
+
fill: currentColor;
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
[data-item-git-status] {
|
|
961
|
+
& > :where([data-item-section="icon"]) > :where(:not([data-icon-name="file-tree-icon-chevron"])), & > [data-item-section="content"] {
|
|
962
|
+
color: var(--trees-item-git-status-color);
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
& > [data-item-section="git"] {
|
|
966
|
+
color: var(--trees-item-git-status-color);
|
|
967
|
+
font-weight: var(--trees-font-weight-semibold);
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
[data-item-git-status="added"] {
|
|
972
|
+
--trees-item-git-status-color: var(--trees-git-added-color);
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
[data-item-git-status="deleted"] {
|
|
976
|
+
--trees-item-git-status-color: var(--trees-git-deleted-color);
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
[data-item-git-status="ignored"] {
|
|
980
|
+
--trees-item-git-status-color: var(--trees-git-ignored-color);
|
|
981
|
+
|
|
982
|
+
& > [data-item-section="icon"] {
|
|
983
|
+
opacity: .5;
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
[data-item-section="git"] [data-icon-name="file-tree-icon-dot"] {
|
|
988
|
+
transform: translateY(calc(.65ex - 50%));
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
[data-item-git-status="modified"] {
|
|
992
|
+
--trees-item-git-status-color: var(--trees-git-modified-color);
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
[data-item-git-status="renamed"] {
|
|
996
|
+
--trees-item-git-status-color: var(--trees-git-renamed-color);
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
[data-item-git-status="untracked"] {
|
|
1000
|
+
--trees-item-git-status-color: var(--trees-git-untracked-color);
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
[data-item-drag-target="true"] {
|
|
1004
|
+
background-color: var(--trees-selected-bg);
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
[data-item-dragging="true"] {
|
|
1008
|
+
opacity: .5;
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
[data-item-section="lock"] {
|
|
1012
|
+
color: var(--trees-fg-muted);
|
|
1013
|
+
flex: none;
|
|
1014
|
+
align-items: center;
|
|
1015
|
+
margin-left: auto;
|
|
1016
|
+
display: flex;
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
[data-item-section="lock"] svg {
|
|
1020
|
+
display: block;
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
[data-type="header-slot"] {
|
|
1024
|
+
flex: none;
|
|
1025
|
+
display: block;
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
[data-type="context-menu-wash"] {
|
|
1029
|
+
z-index: 3;
|
|
1030
|
+
touch-action: none;
|
|
1031
|
+
background-color: #0000;
|
|
1032
|
+
position: absolute;
|
|
1033
|
+
inset: 0;
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
[data-type="context-menu-anchor"] {
|
|
1037
|
+
top: 0;
|
|
1038
|
+
right: var(--trees-context-menu-trigger-inline-offset);
|
|
1039
|
+
z-index: 4;
|
|
1040
|
+
align-items: center;
|
|
1041
|
+
display: none;
|
|
1042
|
+
position: absolute;
|
|
1043
|
+
|
|
1044
|
+
&[data-visible="true"] {
|
|
1045
|
+
display: flex;
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
[data-file-tree-virtualized-root="true"][data-is-scrolling] [data-type="context-menu-anchor"] {
|
|
1050
|
+
display: none;
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
[data-type="context-menu-anchor"] > slot[name="context-menu"] {
|
|
1054
|
+
flex: 0 0 0;
|
|
1055
|
+
width: 0;
|
|
1056
|
+
min-width: 0;
|
|
1057
|
+
display: block;
|
|
1058
|
+
overflow: visible;
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
[data-type="context-menu-trigger"] {
|
|
1062
|
+
all: unset;
|
|
1063
|
+
width: var(--trees-action-lane-width);
|
|
1064
|
+
color: var(--trees-fg-muted);
|
|
1065
|
+
fill: currentColor;
|
|
1066
|
+
cursor: pointer;
|
|
1067
|
+
font-family: var(--trees-font-family);
|
|
1068
|
+
font-size: var(--trees-font-size);
|
|
1069
|
+
border-top-right-radius: var(--trees-border-radius);
|
|
1070
|
+
border-bottom-right-radius: var(--trees-border-radius);
|
|
1071
|
+
margin: var(--trees-focus-ring-width);
|
|
1072
|
+
height: calc(var(--trees-row-height) - var(--trees-focus-ring-width) * 2);
|
|
1073
|
+
border-width: 0;
|
|
1074
|
+
justify-content: center;
|
|
1075
|
+
align-items: center;
|
|
1076
|
+
transition: color .12s;
|
|
1077
|
+
display: flex;
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
[data-type="context-menu-trigger"]:hover, [data-type="context-menu-trigger"][aria-expanded="true"] {
|
|
1081
|
+
color: var(--trees-fg);
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
[data-truncate-container] {
|
|
1085
|
+
--truncate-internal-marker-fade-width: var(--truncate-marker-fade-width, 2px);
|
|
1086
|
+
--truncate-internal-marker-gap: var(--truncate-marker-gap, 0px);
|
|
1087
|
+
--truncate-internal-marker-opacity: var(--truncate-marker-opacity, 50%);
|
|
1088
|
+
--truncate-internal-middle-marker-opacity: var(--truncate-middle-marker-opacity, 80%);
|
|
1089
|
+
--truncate-internal-marker-background-color: var(--truncate-marker-background-color, light-dark(#fff, #000));
|
|
1090
|
+
--truncate-internal-marker-background-overlay-color: var(--truncate-marker-background-overlay-color, transparent);
|
|
1091
|
+
--truncate-internal-marker-block-inset: var(--truncate-marker-block-inset, 0px);
|
|
1092
|
+
--truncate-internal-marker-fade-out-duration: var(--truncate-marker-fade-out-duration, 0s);
|
|
1093
|
+
--truncate-internal-marker-fade-in-duration: var(--truncate-marker-fade-in-duration, .1s);
|
|
1094
|
+
--truncate-internal-fade-marker-color: var(--truncate-fade-marker-color, #000);
|
|
1095
|
+
--truncate-internal-fade-marker-width: var(--truncate-fade-marker-width, .2lh);
|
|
1096
|
+
--truncate-internal-single-line-height: 1lh;
|
|
1097
|
+
height: var(--truncate-internal-single-line-height);
|
|
1098
|
+
min-width: 0;
|
|
1099
|
+
margin-top: -1px;
|
|
1100
|
+
margin-bottom: -1px;
|
|
1101
|
+
overflow: hidden;
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
[data-truncate-marker] {
|
|
1105
|
+
height: var(--truncate-internal-single-line-height);
|
|
1106
|
+
padding-block: var(--truncate-internal-marker-block-inset);
|
|
1107
|
+
box-sizing: border-box;
|
|
1108
|
+
z-index: 2;
|
|
1109
|
+
color: color-mix(in srgb,
|
|
1110
|
+
currentColor var(--truncate-internal-marker-opacity),
|
|
1111
|
+
transparent);
|
|
1112
|
+
opacity: 0;
|
|
1113
|
+
transition: opacity var(--truncate-internal-marker-fade-out-duration)
|
|
1114
|
+
ease-in-out;
|
|
1115
|
+
background-clip: content-box;
|
|
1116
|
+
align-items: center;
|
|
1117
|
+
display: flex;
|
|
1118
|
+
position: absolute;
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
@container measure (height > 1lh) {
|
|
1122
|
+
[data-truncate-marker] {
|
|
1123
|
+
opacity: 1;
|
|
1124
|
+
transition: opacity var(--truncate-internal-marker-fade-in-duration)
|
|
1125
|
+
ease-in-out;
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
[data-truncate-grid] {
|
|
1130
|
+
display: grid;
|
|
1131
|
+
position: relative;
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
[data-truncate-content="visible"] {
|
|
1135
|
+
white-space: nowrap;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
[data-truncate-content="overflow"] {
|
|
1139
|
+
opacity: 0;
|
|
1140
|
+
pointer-events: none;
|
|
1141
|
+
user-select: none;
|
|
1142
|
+
word-break: break-all;
|
|
1143
|
+
margin-top: calc(-1 * var(--truncate-internal-single-line-height));
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
[data-truncate-marker-cell] {
|
|
1147
|
+
user-select: none;
|
|
1148
|
+
pointer-events: none;
|
|
1149
|
+
overflow: visible;
|
|
1150
|
+
container: measure / size;
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
[data-truncate-container="truncate"] {
|
|
1154
|
+
& [data-truncate-grid] {
|
|
1155
|
+
grid-template-columns: minmax(0, max-content) 0;
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
& [data-truncate-marker] {
|
|
1159
|
+
right: 0;
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
& [data-truncate-fade] {
|
|
1163
|
+
margin-right: calc(-2 * var(--truncate-internal-fade-marker-width));
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
[data-truncate-container="fruncate"] {
|
|
1168
|
+
& [data-truncate-grid] {
|
|
1169
|
+
grid-template-columns: 0 minmax(0, max-content) auto;
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
& [data-truncate-content] {
|
|
1173
|
+
direction: rtl;
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
& [data-truncate-content] > span {
|
|
1177
|
+
unicode-bidi: plaintext;
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
& [data-truncate-fade] {
|
|
1181
|
+
margin-left: calc(-2 * var(--truncate-internal-fade-marker-width));
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
[data-truncate-variant="default"] {
|
|
1186
|
+
& [data-truncate-marker] {
|
|
1187
|
+
background-color: var(--truncate-internal-marker-background-color);
|
|
1188
|
+
background-image: linear-gradient(var(--truncate-internal-marker-background-overlay-color),
|
|
1189
|
+
var(--truncate-internal-marker-background-overlay-color));
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
& [data-truncate-marker]:after, & [data-truncate-marker]:before {
|
|
1193
|
+
content: "";
|
|
1194
|
+
width: calc(var(--truncate-internal-marker-fade-width) +
|
|
1195
|
+
var(--truncate-internal-marker-gap));
|
|
1196
|
+
height: max(0px,
|
|
1197
|
+
calc(var(--truncate-internal-single-line-height) -
|
|
1198
|
+
var(--truncate-internal-marker-block-inset) * 2));
|
|
1199
|
+
background-color: var(--truncate-internal-marker-background-color);
|
|
1200
|
+
background-image: linear-gradient(var(--truncate-internal-marker-background-overlay-color),
|
|
1201
|
+
var(--truncate-internal-marker-background-overlay-color));
|
|
1202
|
+
-webkit-mask-image: linear-gradient(var(--truncate-internal-fade-dir),
|
|
1203
|
+
#000 0%,
|
|
1204
|
+
#000 var(--truncate-internal-marker-gap),
|
|
1205
|
+
transparent 100%);
|
|
1206
|
+
mask-image: linear-gradient(var(--truncate-internal-fade-dir),
|
|
1207
|
+
#000 0%,
|
|
1208
|
+
#000 var(--truncate-internal-marker-gap),
|
|
1209
|
+
transparent 100%);
|
|
1210
|
+
position: absolute;
|
|
1211
|
+
inset-block-start: var(--truncate-internal-marker-block-inset);
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
& [data-truncate-marker]:after {
|
|
1215
|
+
--truncate-internal-fade-dir: to right;
|
|
1216
|
+
right: calc(-1 *
|
|
1217
|
+
(
|
|
1218
|
+
var(--truncate-internal-marker-fade-width) +
|
|
1219
|
+
var(--truncate-internal-marker-gap)
|
|
1220
|
+
));
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
& [data-truncate-marker]:before {
|
|
1224
|
+
--truncate-internal-fade-dir: to left;
|
|
1225
|
+
left: calc(-1 *
|
|
1226
|
+
(
|
|
1227
|
+
var(--truncate-internal-marker-fade-width) +
|
|
1228
|
+
var(--truncate-internal-marker-gap)
|
|
1229
|
+
));
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
[data-truncate-variant="fade"] {
|
|
1234
|
+
& [data-truncate-marker] {
|
|
1235
|
+
background: none;
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
[data-truncate-fade] {
|
|
1240
|
+
box-shadow: 0 0 calc(var(--truncate-internal-fade-marker-width) / 2)
|
|
1241
|
+
var(--truncate-internal-fade-marker-color),
|
|
1242
|
+
0 0 var(--truncate-internal-fade-marker-width)
|
|
1243
|
+
var(--truncate-internal-fade-marker-color);
|
|
1244
|
+
width: calc(var(--truncate-internal-fade-marker-width) * 2);
|
|
1245
|
+
height: calc(var(--truncate-internal-single-line-height) -
|
|
1246
|
+
(var(--truncate-internal-fade-marker-width) * 2));
|
|
1247
|
+
margin: var(--truncate-internal-fade-marker-width) 0;
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
[data-truncate-group-container="middle"] {
|
|
1251
|
+
& [data-truncate-container] {
|
|
1252
|
+
--truncate-marker-opacity: var(--truncate-internal-middle-marker-opacity);
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
min-width: 0;
|
|
1256
|
+
display: flex;
|
|
1257
|
+
|
|
1258
|
+
& > div {
|
|
1259
|
+
min-width: 0;
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
& > div[data-truncate-segment-priority="1"] {
|
|
1263
|
+
flex: 0 1 max-content;
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
& > div[data-truncate-segment-priority="2"] {
|
|
1267
|
+
flex: 0 999999 max-content;
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
@layer theme, unsafe;
|
|
1273
|
+
`,fk=`@layer base, unsafe;`;function pk(e){return`${fk}
|
|
1274
|
+
@layer base {
|
|
1275
|
+
${e}
|
|
1276
|
+
}`}function mk(e){return`${fk}
|
|
1277
|
+
@layer unsafe {
|
|
1278
|
+
${e}
|
|
1279
|
+
}`}var hk=new WeakMap;function gk(e){let t=hk.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(FD,`true`);let r=document.createElement(`div`);r.style.position=`relative`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n);let i=Math.max(n.offsetWidth-n.clientWidth,0);return n.remove(),hk.set(e,i),i}function _k(e,t){if(!e.isConnected)return;let n=gk(t);if(n==null)return;let r=t.querySelector(`style[${ID}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(ID,``),t.appendChild(i)),i.textContent=`:host { ${LD}: ${n}px; }`}var vk;function yk(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){vk??(vk=new CSSStyleSheet,vk.replaceSync(pk(dk)));let t=!1;try{e.adoptedStyleSheets=[vk],t=!0}catch{}if(t){e.querySelector(`style[${ND}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(ND,``),t.textContent=pk(dk),e.prepend(t)}}function bk(e,t){xk(e,t),yk(t),_k(e,t)}function xk(e,t){let n=e.querySelector(`template[shadowrootmode="open"], template[data-file-tree-shadowrootmode="open"]`);n instanceof HTMLTemplateElement&&(t.childNodes.length>0||(t.appendChild(n.content.cloneNode(!0)),n.hasAttribute(`shadowrootmode`)&&n.remove()))}if(typeof HTMLElement<`u`&&customElements.get(`file-tree-container`)==null){class e extends HTMLElement{constructor(){super()}connectedCallback(){let e=this.shadowRoot??this.attachShadow({mode:`open`});bk(this,e)}}if(customElements.define(MD,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(MD)))e instanceof HTMLElement&&bk(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var Sk=5,Ck=32,wk=128;function Tk(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function Ek(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function Dk(e,t){if(t.childIdByNameId!=null)return t.childIdByNameId;let n=new Map;for(let r of t.childIds){let t=e[r];t!=null&&n.set(t.nameId,r)}return t.childIdByNameId=n,n}function Ok(e){if(e.childPositionById!=null)return e.childPositionById;let t=new Map;for(let n=0;n<e.childIds.length;n++){let r=e.childIds[n];r!=null&&t.set(r,n)}return e.childPositionById=t,t}function kk(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function Ak(e,t){if(e.childPositionById!=null)for(let n=t;n<e.childIds.length;n++){let t=e.childIds[n];t!=null&&e.childPositionById.set(t,n)}}function jk(e,t){let n=0,r=0;for(let i of t.childIds){let t=e[i];t!=null&&(n+=t.subtreeNodeCount,r+=t.visibleSubtreeCount)}t.totalChildSubtreeNodeCount=n,t.totalChildVisibleSubtreeCount=r,Fk(e,t)}function Mk(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=Ok(e).get(t);if(i===void 0)return;let a=i>>Sk;e.childVisibleChunkSums[a]+=r}function Nk(e,t,n){let r=t.childVisibleChunkSums;if(r!=null){let i=n,a=0;for(let o of r){if(i<o){let r=Ik(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=Ck}throw Error(`Visible child index ${String(n)} is out of range`)}let i=n;for(let r=0;r<t.childIds.length;r++){let a=t.childIds[r];if(a==null)continue;let o=e[a];if(o!=null){if(i<o.visibleSubtreeCount)return{childIndex:r,childVisibleIndex:n-i,localVisibleIndex:i};i-=o.visibleSubtreeCount}}throw Error(`Visible child index ${String(n)} is out of range`)}function Pk(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>Sk;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<Sk}for(let i=a;i<n;i+=1){let n=t.childIds[i];if(n==null)continue;let a=e[n];a!=null&&(r+=a.visibleSubtreeCount)}return r}function Fk(e,t){if(t.childIds.length<wk){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/Ck),r=new Int32Array(n);for(let n=0;n<t.childIds.length;n++){let i=t.childIds[n];if(i==null)continue;let a=e[i];a!=null&&(r[n>>Sk]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function Ik(e,t,n,r){let i=Math.min(t.childIds.length,n+Ck),a=r;for(let r=n;r<i;r++){let n=t.childIds[r];if(n==null)continue;let i=e[n];if(i!=null){if(a<i.visibleSubtreeCount)return{childIndex:r,localVisibleIndex:a};a-=i.visibleSubtreeCount}}throw Error(`Visible child index ${String(r)} is out of range`)}var Lk=7,Rk=3,zk=8,Bk=4;function Vk(e,t,n=0){return e<<Bk|n<<Rk|t}function Hk(e){return e.depthAndFlags>>>Bk}function Uk(e){return(e.depthAndFlags&zk)>>Rk}function Y(e){return(e.depthAndFlags&zk)!==0}function Wk(e){return e.depthAndFlags&Lk}function Gk(e,t){return(Wk(e)&t)!==0}function Kk(e,t){e.depthAndFlags|=t}function qk(e,t){e.depthAndFlags=Vk(t,Wk(e),Uk(e))}var Jk=Symbol(`benchmarkInstrumentation`);function Yk(e,t){return t==null||Object.defineProperty(e,Jk,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function Xk(e){return e==null?null:e[Jk]??null}function X(e,t,n){return e==null?n():e.measurePhase(t,n)}function Zk(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function Qk(e){return e>=48&&e<=57}function $k(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!Qk(e.charCodeAt(r));)r+=1;if(r>=e.length)break;r>n&&t.push(e.slice(n,r));let i=0;for(;r<e.length&&Qk(e.charCodeAt(r));)i=i*10+(e.charCodeAt(r)-48),r+=1;t.push(i),n=r}return(n<e.length||t.length===0)&&t.push(e.slice(n)),t}function eA(e){let t=e.toLowerCase();return{lowerValue:t,tokens:$k(t)}}function tA(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){let n=e[r],i=t[r];if(n===i)continue;if(typeof n==`number`&&typeof i==`number`)return n<i?-1:1;let a=String(n),o=String(i);if(a!==o)return a<o?-1:1}return e.length===t.length?0:e.length<t.length?-1:1}function nA(e,t){if(e.tokens.length===1&&t.tokens.length===1&&typeof e.tokens[0]==`string`&&typeof t.tokens[0]==`string`)return e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1;let n=tA(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function rA(e,t,n){let r=nA(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function iA(e,t){return rA(e,t,eA)}function aA(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function oA(e,t){let n=Math.min(e.segments.length,t.segments.length);for(let r=0;r<n;r++){let n=e.segments[r],i=t.segments[r];if(n===i)continue;let a=aA(e,r);return a===aA(t,r)?iA(n,i):a===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function sA(e,t){return oA(e,t)}function cA(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=eA(e);return n.set(e,r),r},i=Math.min(e.segments.length,t.segments.length);for(let n=0;n<i;n++){let i=e.segments[n],a=t.segments[n];if(i===a)continue;let o=aA(e,n);return o===aA(t,n)?rA(i,a,r):o===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function lA(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=eA(r);return e.sortKeyById[t]=i,i}function uA(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function dA(e){let t=e.length>0&&e.charCodeAt(e.length-1)===47,n=t?e.length-1:e.length,r=[],i=0;for(let t=0;t<n;t++)e.charCodeAt(t)===47&&(r.push(e.slice(i,t)),i=t+1);return r.push(e.slice(i,n)),{hasTrailingSlash:t,segments:r}}function fA(e){let{hasTrailingSlash:t,segments:n}=dA(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function pA(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=dA(e);return{requiresDirectory:t,segments:n}}function mA(){let e=new Map;return e.set(``,0),{idByValue:e,valueById:[``],sortKeyById:[eA(``)]}}function hA(e,t){let n=e.idByValue.get(t);if(n!==void 0)return n;let r=e.valueById.length;return e.idByValue.set(t,r),e.valueById.push(t),r}function gA(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var _A=Symbol(`pathStorePreparedInputKind`);function vA(e,t){return e[_A]=t,e}function yA(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function bA(e,t,n){return n==="default"?sA(e,t):n(yA(e),yA(t))}function xA(){return{depthAndFlags:Vk(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function SA(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return r;return n}function CA(e){return e.isDirectory?e.segments.length:e.segments.length-1}function wA(e){return Array.isArray(e)&&e.every(e=>typeof e==`object`&&!!e&&typeof e.path==`string`&&Array.isArray(e.segments)&&typeof e.basename==`string`&&typeof e.isDirectory==`boolean`)}function TA(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function EA(e,t={}){return MA(e,t).map(e=>e.path)}function DA(e,t={}){let n=MA(e,t);return vA({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function OA(e){let t=e.length,n=!1;for(let r=0;r<t;r+=1){let t=e[r];if(t.length>0&&t.charCodeAt(t.length-1)===47){n=!0;break}}return vA({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function kA(e){let t=e,n=t.preparedPaths;if(t[_A]===`prepared`&&n!=null)return n;if(!wA(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function AA(e){let t=e;return t[_A]===`presorted`&&t.presortedPaths!=null||TA(t.presortedPaths)?t.presortedPaths:null}function jA(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function MA(e,t={}){let n=uA(t),r=Xk(t);Zk(r,`workload.inputFiles`,e.length);let i=X(r,`store.preparePathEntries.parse`,()=>e.map(e=>fA(e)));return X(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>bA(e,t,n.sort))),i}var NA=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[xA()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=mA();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=Xk(e),this.options=uA(e);let t=e.initialExpandedPaths??null;if(t==null||t.length===0)this.initialExpandedPathSet=null;else{let e=new Set,n=t.length;for(let r=0;r<n;r+=1){let n=t[r],i=n.length;e.add(i>0&&n.charCodeAt(i-1)===47?n.slice(0,i-1):n)}this.initialExpandedPathSet=e,this.createdDirectoriesAllExpanded=!0}this.directories.set(0,Tk())}appendPaths(e){return X(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>fA(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,X(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return X(this.instrumentation,`store.builder.appendPresortedPaths`,()=>{if(t===!1){this.appendPresortedFilePaths(e);return}this.createdDirectoriesAllExpanded=!1;let n=null,r=0,i=this.nodes,a=this.segmentTable,o=a.idByValue,s=a.valueById,c=this.directoryStack,l=0,u=``,d=0;for(let t of e){if(n===t)throw Error(`Duplicate path: "${t}"`);let e=t.length>0&&t.charCodeAt(t.length-1)===47,a=e?t.length-1:t.length,f=0,p=0;if(n!=null){if(u.length>0&&t.length>u.length&&t.startsWith(u))f=d,p=u.length;else{let r=Math.min(a,n.length),i=!0;for(let e=0;e<r;e++){let r=t.charCodeAt(e);if(r!==n.charCodeAt(e)){i=!1;break}r===47&&(f++,p=e+1)}i&&e&&r===a&&n.length>a&&n.charCodeAt(a)===47&&(f++,p=a+1)}}l=f,r=f;let m=p,h=t.indexOf(`/`,m);for(;h>=0&&h<a;){let e=c[l];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);r++;let n=t.slice(m,h),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n));let u=i.length;i.push({depthAndFlags:Vk(r,0,1),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(t.slice(0,h)),l++,c[l]=u,m=h+1,h=t.indexOf(`/`,m)}if(e){if(m<a){let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory parent for "${t}"`);r++;let n=t.slice(m,a),u=o.get(n);u===void 0&&(u=s.length,o.set(n,u),s.push(n));let d=i.length;i.push({depthAndFlags:Vk(r,0,1),nameId:u,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),l++,c[l]=d,m=a+1}let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory node for "${t}"`);this.promoteDirectoryToExplicit(e,t)}else{let e=c[l];if(e===void 0)throw Error(`Unable to resolve file parent for "${t}"`);let n=t.slice(m),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n)),i.push({depthAndFlags:Vk(r+1,0),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1})}m!==u.length&&(u=t.substring(0,m),d=r),n=t}c.length=l+1,n!=null&&(this.lastPreparedPath=fA(n)),this.hasDeferredDirectoryIndexes=!0}),this}appendPresortedFilePaths(e){let t=null,n=0,r=this.nodes,i=this.segmentTable,a=i.idByValue,o=i.valueById,s=this.directoryStack,c=0,l=``,u=0;for(let i of e){if(t===i)throw Error(`Duplicate path: "${i}"`);let e=i.length,d=0,f=0;if(t!=null){if(l.length>0&&i.length>l.length&&i.startsWith(l))d=u,f=l.length;else{let n=Math.min(e,t.length);for(let e=0;e<n;e++){let n=i.charCodeAt(e);if(n!==t.charCodeAt(e))break;n===47&&(d++,f=e+1)}}}c=d,n=d;let p=f,m=i.indexOf(`/`,p);for(;m>=0;){let e=s[c];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);n++;let t=i.slice(p,m),l=a.get(t);l===void 0&&(l=o.length,a.set(t,l),o.push(t));let u=r.length;r.push({depthAndFlags:Vk(n,0,1),nameId:l,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(i.slice(0,m)),this.presortedDirectoryNodeIds.push(u),c++,s[c]=u,p=m+1,m=i.indexOf(`/`,p)}let h=s[c];if(h===void 0)throw Error(`Unable to resolve file parent for "${i}"`);let g=i.slice(p),_=a.get(g);_===void 0&&(_=o.length,a.set(g,_),o.push(g)),r.push({depthAndFlags:Vk(n+1,0),nameId:_,parentId:h,subtreeNodeCount:1,visibleSubtreeCount:1}),p!==l.length&&(l=i.substring(0,p),u=n),t=i}s.length=c+1,t!=null&&(this.lastPreparedPath=fA(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(X(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||X(this.instrumentation,`store.builder.computeSubtreeCounts`,()=>this.computeSubtreeCounts(0)),{directories:this.directories,nodes:this.nodes,options:this.options,rootId:0,segmentTable:this.segmentTable,presortedDirectoryNodeIds:this.presortedDirectoryNodeIds.length>0?this.presortedDirectoryNodeIds:null}}didMatchAllInitialExpandedPaths(){return this.createdDirectoriesAllExpanded&&this.initialExpandedPathSet!=null&&this.createdDirectoryCount===this.initialExpandedPathSet.size}appendPreparedPath(e,t){if(this.hasDeferredDirectoryIndexes&&=(this.buildDirectoryIndexes(),!1),this.lastPreparedPath!=null){if(e.path===this.lastPreparedPath.path)throw Error(`Duplicate path: "${e.path}"`);if(t&&(this.options.sort==="default"?cA(this.lastPreparedPath,e,this.segmentSortKeyCache):bA(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=CA(e),i=n==null?0:CA(n),a=n==null?0:SA(n.segments,e.segments),o=Math.min(a,r,i);this.directoryStack.length=o+1;for(let n=o;n<r;n++){let r=this.directoryStack[this.directoryStack.length-1];if(r===void 0)throw Error(`Directory stack underflow while building the path store`);let i=t?this.getOrCreateDirectoryChild(r,e.segments[n]):this.createDirectoryChild(r,e.segments[n]);this.directoryStack.push(i)}if(e.isDirectory){let t=this.directoryStack[this.directoryStack.length-1];if(t===void 0)throw Error(`Unable to resolve directory node for "${e.path}"`);this.promoteDirectoryToExplicit(t,e.path),this.lastPreparedPath=e;return}let s=this.directoryStack[this.directoryStack.length-1];if(s===void 0)throw Error(`Unable to resolve file parent for "${e.path}"`);t?this.createFileChild(s,e.basename,e.path):this.createFileChildUnchecked(s,e.basename),this.lastPreparedPath=e}recordCreatedDirectoryPath(e){!this.createdDirectoriesAllExpanded||this.initialExpandedPathSet==null||(this.createdDirectoryCount+=1,this.initialExpandedPathSet.has(e)||(this.createdDirectoriesAllExpanded=!1))}createFileChild(e,t,n){let r=hA(this.segmentTable,t),i=this.getDirectoryIndex(e),a=i.childIdByNameId;if(a!=null&&a.get(r)!==void 0)throw Error(`Path collides with an existing entry: "${n}"`);let o=this.nodes[e];if(o===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let s=this.nodes.length;return this.nodes.push({depthAndFlags:Vk(Hk(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),kk(i,s),s}createFileChildUnchecked(e,t){let n=hA(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:Vk(Hk(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),kk(r,a),a}getOrCreateDirectoryChild(e,t){let n=hA(this.segmentTable,t),r=this.getDirectoryIndex(e);if(r.childIdByNameId!=null){let e=r.childIdByNameId.get(n);if(e!==void 0){let n=this.nodes[e];if(n!=null&&!Y(n))throw Error(`Path collides with an existing file while creating directory "${t}"`);return e}}let i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:Vk(Hk(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),kk(r,a),this.directories.set(a,Tk()),a}createDirectoryChild(e,t){let n=hA(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:Vk(Hk(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),kk(r,a),this.directories.set(a,Tk()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!Y(n))throw Error(`Path is not a directory: "${t}"`);if(Gk(n,1))throw Error(`Duplicate path: "${t}"`);Kk(n,1)}getDirectoryIndex(e){let t=this.directories.get(e);if(t!==void 0)return t;throw Error(`Unknown directory child index for node ${String(e)}`)}buildPresortedFinish(e){let t=this.nodes,n=this.directories;n.set(0,Ek());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(Y(a)){let t=Ek();n.set(e,t),r=e,i=t}let o;a.parentId===r?o=i:(o=n.get(a.parentId),r=a.parentId,i=o??null),o?.childIds.push(e)}if(!e)for(let e=t.length-1;e>=1;e--){let n=t[e];if(n==null)continue;let r=t[n.parentId];r!=null&&(r.subtreeNodeCount+=n.subtreeNodeCount,r.visibleSubtreeCount+=n.visibleSubtreeCount)}}buildDirectoryIndexes(){let e=this.nodes;for(let t=1;t<e.length;t++){let n=e[t];if(n==null)continue;Y(n)&&this.directories.set(t,Tk());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),kk(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!Y(t))return t.subtreeNodeCount=1,t.visibleSubtreeCount=1,1;let n=this.getDirectoryIndex(e),r=1;for(let e of n.childIds)r+=this.computeSubtreeCounts(e);return jk(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function PA(e,t=`closed`,n=null){let r=IA(t);return{activeNodeCount:e.nodes.length-1,collapsedDirectoryIds:new Set,collapseNewDirectoriesByDefault:!1,defaultExpansion:r,directoriesOpenByDefault:r===`open`,hasCollapsedDirectoryOverrides:!1,directoryLoadInfoById:new Map,expandedDirectoryIds:new Set,instrumentation:n,listeners:new Map,pathCacheByNodeId:new Map([[e.rootId,{path:``,version:0}]]),pathCacheVersion:0,snapshot:e,transactionStack:[]}}function FA(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function IA(e){if(typeof e!=`number`)return e;if(!Number.isInteger(e)||e<0)throw Error(`initialExpansion must be "open", "closed", or a non-negative integer depth. Received: ${String(e)}`);return e}function LA(e,t){return Gk(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion!==`closed`&&Hk(t)<=e.defaultExpansion}function RA(e,t,n=e.snapshot.nodes[t]){return n==null||!Y(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:LA(e,n)}function zA(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!Y(r))return;let i=LA(e,r);if(n){if(i){e.collapsedDirectoryIds.delete(t),e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0;return}e.expandedDirectoryIds.add(t);return}if(i){e.collapsedDirectoryIds.add(t),e.hasCollapsedDirectoryOverrides=!0;return}e.expandedDirectoryIds.delete(t)}function BA(e,t){let n=e.directoryLoadInfoById.get(t);if(n!=null)return n;let r={activeAttemptId:null,errorMessage:null,nextAttemptId:1,state:`loaded`};return e.directoryLoadInfoById.set(t,r),r}function VA(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function HA(e,t){let n=BA(e,t);if(n.state===`loading`&&n.activeAttemptId!=null)return{attemptId:n.activeAttemptId,nodeId:t,reused:!0};let r=n.nextAttemptId;return n.activeAttemptId=r,n.errorMessage=null,n.nextAttemptId+=1,n.state=`loading`,{attemptId:r,nodeId:t,reused:!1}}function UA(e,t){let n=BA(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function WA(e,t,n){let r=e.directoryLoadInfoById.get(t);return r==null||r.activeAttemptId!==n?!1:(r.activeAttemptId=null,r.errorMessage=null,r.state=`loaded`,!0)}function GA(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function KA(e,t,n,r){let i=e.directoryLoadInfoById.get(t);return i==null||i.activeAttemptId!==n?!1:(i.activeAttemptId=null,i.errorMessage=r??null,i.state=`error`,!0)}function qA(e,t){e.directoryLoadInfoById.delete(t)}function JA(e,t,n){let r=n,i=e.listeners.get(t);return i==null?e.listeners.set(t,new Set([r])):i.add(r),()=>{let n=e.listeners.get(t);n!=null&&(n.delete(r),n.size===0&&e.listeners.delete(t))}}function YA(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function XA(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function ZA(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function QA(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function $A(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function ej(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function tj(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`begin-child-load`,path:e.path,projectionChanged:e.projectionChanged,reused:e.reused,visibleCountDelta:null}}function nj(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:e.childEvents.some(e=>e.canonicalChanged),childEvents:e.childEvents,operation:`apply-child-patch`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function rj(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`complete-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function ij(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,errorMessage:e.errorMessage,operation:`fail-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function aj(e){return{activeNodeCountAfter:e.activeNodeCountAfter,activeNodeCountBefore:e.activeNodeCountBefore,affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],cachedPathEntryCountAfter:e.cachedPathEntryCountAfter,cachedPathEntryCountBefore:e.cachedPathEntryCountBefore,canonicalChanged:!1,idsPreserved:e.idsPreserved,loadInfoEntryCountAfter:e.loadInfoEntryCountAfter,loadInfoEntryCountBefore:e.loadInfoEntryCountBefore,mode:e.mode,operation:`cleanup`,projectionChanged:e.projectionChanged,reclaimedCachedPathEntryCount:e.reclaimedCachedPathEntryCount,reclaimedLoadInfoEntryCount:e.reclaimedLoadInfoEntryCount,reclaimedNodeSlotCount:e.reclaimedNodeSlotCount,reclaimedSegmentCount:e.reclaimedSegmentCount,segmentCountAfter:e.segmentCountAfter,segmentCountBefore:e.segmentCountBefore,totalNodeSlotCountAfter:e.totalNodeSlotCountAfter,totalNodeSlotCountBefore:e.totalNodeSlotCountBefore,visibleCountDelta:null}}function oj(e,t,n){return{...n,visibleCountDelta:_j(e)-t}}function sj(e,t){let n=_j(e),r=FA();e.transactionStack.push(r);try{t()}catch(t){throw uj(e,r,!1),t}uj(e,r,!0,_j(e)-n)}function cj(e,t){let n=e.instrumentation;if(n==null){lj(e,t);return}X(n,`store.events.record`,()=>lj(e,t))}function lj(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){hj(e,t);return}n.events.push(t),mj(n,t)}function uj(e,t,n,r=null){if(e.transactionStack.pop()!==t)throw Error(`Transaction stack underflow`);if(!n)return;let i=e.transactionStack[e.transactionStack.length-1]??null;if(i!=null){let n=e.instrumentation;n==null?pj(i,t):X(n,`store.events.batch.merge`,()=>pj(i,t));return}let a=dj(t,r),o=e.instrumentation;if(o==null){hj(e,a);return}X(o,`store.events.batch.commit`,()=>hj(e,a))}function dj(e,t){return{affectedAncestorIds:[...e.affectedAncestorIds],affectedNodeIds:[...e.affectedNodeIds],canonicalChanged:e.events.some(e=>e.canonicalChanged),events:[...e.events],operation:`batch`,projectionChanged:e.events.some(e=>e.projectionChanged),visibleCountDelta:t}}function fj(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function pj(e,t){for(let n of t.events)e.events.push(n);fj(e,t)}function mj(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function hj(e,t){let n=e.instrumentation;if(n==null){gj(e,t);return}X(n,`store.events.emit`,()=>gj(e,t))}function gj(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function _j(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function vj(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!Y(n)||Gk(n,2))return null;let r=e.snapshot.directories.get(t);if(r==null||r.childIds.length!==1)return null;let i=r.childIds[0];if(i==null)return null;let a=e.snapshot.nodes[i];return a==null||!Y(a)?null:i}function yj(e,t){let n=t;for(;;){let t=vj(e,n);if(t==null)return n;n=t}}function bj(e,t){let n=[t],r=t;for(;;){let t=vj(e,r);if(t==null)return n;n.push(t),r=t}}function xj(e,t){let n=t==null?e.snapshot.rootId:jj(e,t);return n==null?[]:Pj(e,n)}function Sj(e,t){let n=fA(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=Yj(e,Jj(e,r)),{createdNodeIds:a,directoryId:o}=Fj(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=Z(e,o);if(Gk(n,1))throw Error(`Path already exists: "${t}"`);Kk(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=Lj(e,o,n.basename),s.add(c);Oj(e,o);let l=Yj(e,o);return YA({affectedAncestorIds:Aj(e,c),affectedNodeIds:[...s],path:t,projectionChanged:Xj(i,l)})}function Cj(e,t,n){let r=jj(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=Z(e,r);if(Gk(i,2))throw Error(`The root node cannot be removed`);if(Y(i)&&Nj(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=Yj(e,a),s=Kj(e,r);Bj(e,a,r,i.nameId),qj(e,a),Oj(e,a);let c=Yj(e,a);return XA({affectedAncestorIds:Aj(e,a),affectedNodeIds:s,path:t,projectionChanged:Xj(o,c),recursive:n.recursive===!0})}function wj(e,t,n,r){let i=jj(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=Z(e,i);if(Gk(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=Wj(e,i,n),c=Yj(e,a.parentId),l=Yj(e,s.parentId),u=gA(e.snapshot.segmentTable,a.nameId),d=hA(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(Y(a)&&eM(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=Dk(e.snapshot.nodes,Nj(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&Gj(e,p,o,Uk(a))===`skip`)return null;let m=a.parentId;Bj(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),$j(e,i),zj(e,s.parentId,i),qj(e,m),e.pathCacheVersion++,Oj(e,m),s.parentId!==m&&Oj(e,s.parentId);let h=Yj(e,m),g=Yj(e,s.parentId);return ZA({affectedAncestorIds:[...new Set([...Aj(e,m),...Aj(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:Zj([c,l],[h,g]),to:Dj(e,i)})}function Tj(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function Ej(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function Dj(e,t){let n=Z(e,t),r=Tj(e,t);if(r!=null)return r;if(Gk(n,2))return Ej(e,t,``);let i=Dj(e,n.parentId),a=gA(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return Ej(e,t,Y(n)?`${o}/`:o)}function Oj(e,t){let n=e.instrumentation;if(n==null){nM(e,t);return}X(n,`store.recomputeCountsUpwardFrom`,()=>nM(e,t))}function kj(e,t){let n=[[t,0]],{nodes:r,directories:i}=e.snapshot;for(;n.length>0;){let t=n[n.length-1],a=t[0],o=r[a];if(o==null||!Y(o)){tM(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){tM(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function Aj(e,t){let n=[],r=t;for(;r!=null;){let t=Z(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function jj(e,t){if(t.length===0)return e.snapshot.rootId;let n=pA(t);return Mj(e,n.segments,n.requiresDirectory)}function Mj(e,t,n){let r=e.snapshot.rootId;for(let n of t){let t=e.snapshot.segmentTable.idByValue.get(n);if(t===void 0)return null;let i=Nj(e,r),a=Dk(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=Z(e,r);return n&&!Y(i)?null:r}function Nj(e,t){let n=e.snapshot.directories.get(t);if(n===void 0)throw Error(`Unknown directory child index for node ${String(t)}`);return n}function Z(e,t){let n=e.snapshot.nodes[t];if(n===void 0||Gk(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function Pj(e,t){let n=e.snapshot.nodes[t];if(n===void 0||Gk(n,4))return[];if(!Y(n))return[Dj(e,t)];if(Nj(e,t).childIds.length===0)return Gk(n,1)&&!Gk(n,2)?[Dj(e,t)]:[];let r=[],i=[{childIndex:0,nodeId:t}];for(;i.length>0;){let t=i[i.length-1];if(t==null)break;let n=e.snapshot.nodes[t.nodeId];if(n===void 0||Gk(n,4)){i.pop();continue}if(!Y(n)){r.push(Dj(e,t.nodeId)),i.pop();continue}let a=Nj(e,t.nodeId);if(a.childIds.length===0){Gk(n,1)&&!Gk(n,2)&&r.push(Dj(e,t.nodeId)),i.pop();continue}let o=a.childIds[t.childIndex];if(o==null){i.pop();continue}t.childIndex++,i.push({childIndex:0,nodeId:o})}return r}function Fj(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=hA(e.snapshot.segmentTable,i),a=Nj(e,r),o=Dk(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!Y(Z(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=Ij(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function Ij(e,t,n){let r=Z(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:Vk(Hk(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,Tk()),zj(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function Lj(e,t,n){let r=hA(e.snapshot.segmentTable,n),i=Nj(e,t);if(Dk(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${iM(e,t,n)}"`);let a=Z(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:Vk(Hk(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),zj(e,t,o),e.activeNodeCount++,o}function Rj(e,t,n){let r=0,i=t.childIds.length;for(;r<i;){let a=r+i>>>1,o=t.childIds[a];if(o==null){i=a;continue}Vj(e,n,o)<0?i=a:r=a+1}return r}function zj(e,t,n){let r=Nj(e,t),i=Z(e,n);Dk(e.snapshot.nodes,r).set(i.nameId,n),Mk(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=Rj(e,r,n);r.childIds.splice(a,0,n),Ak(r,a),Fk(e.snapshot.nodes,r)}function Bj(e,t,n,r){let i=Nj(e,t),a=Ok(i),o=a.get(n)??-1;Dk(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&Mk(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),Ak(i,o),Fk(e.snapshot.nodes,i))}function Vj(e,t,n){let r=e.snapshot.options.sort;return r==="default"?Hj(e,t,n):r(Uj(e,t),Uj(e,n))}function Hj(e,t,n){let r=Z(e,t),i=Z(e,n),a=Y(r);if(a!==Y(i))return a?-1:1;let o=nA(lA(e.snapshot.segmentTable,r.nameId),lA(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=gA(e.snapshot.segmentTable,r.nameId),c=gA(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function Uj(e,t){let n=Z(e,t),r=Dj(e,t),i=Y(n),a=i?r.slice(0,-1):r;return{basename:gA(e.snapshot.segmentTable,n.nameId),depth:Hk(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function Wj(e,t,n){let r=Z(e,t),i=jj(e,n);if(i!=null){let t=Z(e,i);if(Y(t))return{basename:gA(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=pA(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=pA(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:Mj(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function Gj(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${Dj(e,t)}"`);let i=Z(e,t);if(Uk(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(Y(i)&&Nj(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return Kj(e,t),Bj(e,a,t,o),qj(e,a),Oj(e,a),`handled`}function Kj(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=Z(e,t.nodeId);if(t.visitedChildren||!Y(i)){Y(i)&&e.snapshot.directories.delete(t.nodeId),Kk(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),qA(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=Nj(e,t.nodeId);for(let e=a.childIds.length-1;e>=0;e--){let t=a.childIds[e];t!=null&&r.push({nodeId:t,visitedChildren:!1})}}return n}function qj(e,t){let n=t;for(;n!=null;){let t=Z(e,n);if(!Y(t)||Gk(t,2)||Nj(e,n).childIds.length>0)return;Kk(t,1),n=t.parentId===n?null:t.parentId}}function Jj(e,t){let n=e.snapshot.rootId;for(let r of t){let t=e.snapshot.segmentTable.idByValue.get(r);if(t==null)break;let i=Dk(e.snapshot.nodes,Nj(e,n)).get(t);if(i==null||!Y(Z(e,i)))break;n=i}return n}function Yj(e,t){let n=Qj(e,t);if(n==null)return null;let r=yj(e,n),i=Z(e,r),a=n===r?null:bj(e,n).map(t=>Dj(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:Nj(e,r).childIds.length>0,path:Dj(e,r),terminalKind:Uk(i)})}function Xj(e,t){return Zj([e],[t])}function Zj(e,t){for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(r==null||i==null||r!==i)return!0}return!1}function Qj(e,t){let n=t;for(;n!=null;){let t=Z(e,n);if(!Y(t)||Gk(t,2))return null;if(!RA(e,n,t))return n;n=t.parentId}return null}function $j(e,t){let n=Z(e,t);if(qk(n,(t===e.snapshot.rootId?-1:Hk(Z(e,n.parentId)))+1),!Y(n))return;let r=Nj(e,t);for(let t of r.childIds)$j(e,t)}function eM(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=Z(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function tM(e,t,n=Z(e,t),r=!1){let i=e.instrumentation;if(i==null){rM(e,t,n,r);return}X(i,`store.recomputeNodeCounts`,()=>rM(e,t,n,r))}function nM(e,t){let n=t;for(;n!=null;){let t=Z(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(tM(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&Mk(Nj(e,s),n,a,o),n=s}}function rM(e,t,n,r){if(!Y(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=Nj(e,t);if(r){let t=e.instrumentation;t==null?jk(e.snapshot.nodes,i):X(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>jk(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,Gk(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=vj(e,t)==null?RA(e,t,n)?1+o:1:o}function iM(e,t,n){let r=Dj(e,t);return r.length===0?n:`${r}${n}`}function aM(e){return e!=null&&!Gk(e,4)}function oM(e,t){let n=e.snapshot.nodes[t];return!aM(n)||!Y(n)||Gk(n,2)?null:n}function sM(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&aM(e.snapshot.nodes[n])&&(t+=1);return t}function cM(e){return Math.max(0,e.valueById.length-1)}function lM(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:sM(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:cM(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function uM(e,t,n,r){return{activeNodeCountAfter:r.activeNodeCount,activeNodeCountBefore:n.activeNodeCount,cachedPathEntryCountAfter:r.cachedPathEntryCount,cachedPathEntryCountBefore:n.cachedPathEntryCount,idsPreserved:t,loadInfoEntryCountAfter:r.loadInfoEntryCount,loadInfoEntryCountBefore:n.loadInfoEntryCount,mode:e,reclaimedCachedPathEntryCount:n.cachedPathEntryCount-r.cachedPathEntryCount,reclaimedLoadInfoEntryCount:n.loadInfoEntryCount-r.loadInfoEntryCount,reclaimedNodeSlotCount:n.totalNodeSlotCount-r.totalNodeSlotCount,reclaimedSegmentCount:n.segmentCount-r.segmentCount,segmentCountAfter:r.segmentCount,segmentCountBefore:n.segmentCount,totalNodeSlotCountAfter:r.totalNodeSlotCount,totalNodeSlotCountBefore:n.totalNodeSlotCount}}function dM(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)oM(e,n)!=null&&t.push(Dj(e,n));for(let t of e.expandedDirectoryIds)oM(e,t)!=null&&n.push(Dj(e,t));return{collapsedPaths:t,expandedPaths:n}}function fM(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)oM(e,n)!=null&&VA(e,n)!==`loaded`&&t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:Dj(e,n)});return t}function pM(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=jj(e,n);t!=null&&zA(e,t,!0,Z(e,t))}for(let n of t.collapsedPaths){let t=jj(e,n);t!=null&&zA(e,t,!1,Z(e,t))}}function mM(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=jj(e,n.path);t!=null&&oM(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function hM(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function gM(e){let t=e.snapshot.segmentTable,n=mA();for(let r of e.snapshot.nodes)if(aM(r)){if(Gk(r,2)){r.nameId=0;continue}r.nameId=hA(n,gA(t,r.nameId))}e.snapshot.segmentTable=n}function _M(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!aM(r)||!Y(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return aM(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[Z(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),jk(e.snapshot.nodes,n)}}function vM(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(aM(n))break;--t}e.snapshot.nodes.length=t+1}function yM(e){let t=dM(e),n=fM(e);X(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>hM(e)),X(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>gM(e)),X(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>_M(e)),X(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>vM(e)),X(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>pM(e,t)),X(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>mM(e,n)),X(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>kj(e,e.snapshot.rootId))}function bM(e){let t=dM(e),n=fM(e),r=X(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>xj(e)),i=Yk({...e.snapshot.options},e.instrumentation),a=X(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new NA(i);return e.appendPaths(r),e.finish()});e.snapshot=a,e.activeNodeCount=a.nodes.length-1,e.pathCacheByNodeId=new Map([[a.rootId,{path:``,version:0}]]),e.pathCacheVersion=0,X(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>pM(e,t)),X(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>mM(e,n)),X(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>kj(e,e.snapshot.rootId))}function xM(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function SM(e,t){let n=lM(e);t===`stable`?X(e.instrumentation,`store.cleanup.stable`,()=>yM(e)):X(e.instrumentation,`store.cleanup.aggressive`,()=>bM(e));let r=lM(e);return uM(t,t===`stable`,n,r)}var CM=64;function wM(e,t){let n=t+2;if(n<=e.length)return e;let r=e.length;for(;r<n;)r*=2;let i=new Int32Array(r);return i.fill(-1),i.set(e),i}function TM(e){return Z(e,e.snapshot.rootId).visibleSubtreeCount}function EM(e,t,n,r){let i=Z(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function DM(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:KM(e,t.cursor),setSize:t.setSize,subtreeEndIndex:EM(e,t.cursor,t.index,n)}}function OM(e,t,n,r,i,a){let o=Nj(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=Nk(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return kM(e,u,l,r+c,i+1,s,o.childIds.length,a)}function kM(e,t,n,r,i,a,o,s){if(!Y(Z(e,t))){if(n===0)return{ancestors:s,cursor:{headNodeId:t,terminalNodeId:t,visibleDepth:i},index:r,posInSet:a,setSize:o};throw Error(`Visible index ${String(n)} is out of range for file`)}let c=BM(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=Z(e,c.terminalNodeId);if(!Y(l)||!RA(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return OM(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function AM(e,t){let n=TM(e);if(t<0||t>=n)return null;let r=OM(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>Dj(e,t.cursor.terminalNodeId)),a=null;return{ancestorPaths:i,get ancestorRows(){if(a!=null)return a;let t=[],i=[];for(let a of r.ancestors){let r=DM(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:KM(e,r.cursor),setSize:r.setSize,subtreeEndIndex:EM(e,r.cursor,r.index,n)}}function jM(e,t,n){let r=e.instrumentation,i=TM(e);if(i<=0||n<t)return[];let a=Math.max(0,Math.min(t,i-1)),o=Math.max(a,Math.min(n,i-1));if(r==null){if(a===0)return GM(e,o+1);let t=[],n=LM(e,a);for(let r=a;r<=o&&n!=null;r++){let r=KM(e,n);t.push(r),n=HM(e,n)}return t}let s=[],c=0,l=0,u=X(r,`store.getVisibleSlice.selectFirstRow`,()=>LM(e,a));for(let t=a;t<=o&&u!=null;t++){let t=X(r,`store.getVisibleSlice.materializeRow`,()=>KM(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=X(r,`store.getVisibleSlice.advanceCursor`,()=>HM(e,u))}return Zk(r,`workload.visibleRowsRead`,s.length),Zk(r,`workload.flattenedRowsRead`,c),Zk(r,`workload.flattenedSegmentsRead`,l),s}function MM(e,t=TM(e)){let n=e.instrumentation;return n==null?WM(e,t):X(n,`store.getVisibleTreeProjection`,()=>WM(e,t))}function NM(e){return UM(MM(e))}function PM(e,t){let n=jj(e,t);if(n==null||n===e.snapshot.rootId||Y(Z(e,n))&&yj(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=Z(e,i).parentId,n=Nj(e,t),s=Ok(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=Pk(a,n,s),t!==o){let n=Z(e,t),a=vj(e,t);if(!RA(e,t,n)&&a!==i)return null;yj(e,t)===t&&(r+=1)}i=t}return r}function FM(e,t){let n=jj(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=Z(e,n);if(!Y(r))throw Error(`Path is not a directory: "${t}"`);return RA(e,n,r)?null:(zA(e,n,!0,r),Oj(e,n),QA({affectedAncestorIds:Aj(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function IM(e,t){let n=jj(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=Z(e,n);if(!Y(r))throw Error(`Path is not a directory: "${t}"`);return RA(e,n,r)?(zA(e,n,!1,r),Oj(e,n),$A({affectedAncestorIds:Aj(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function LM(e,t){return t<0||t>=TM(e)?null:RM(e,e.snapshot.rootId,t,-1)}function RM(e,t,n,r){let i=Nj(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?Nk(e.snapshot.nodes,i,n):X(a,`store.getVisibleSlice.selectChildIndex`,()=>Nk(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return zM(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function zM(e,t,n,r){if(!Y(Z(e,t))){if(n===0)return{headNodeId:t,terminalNodeId:t,visibleDepth:r};throw Error(`Visible index ${String(n)} is out of range for file`)}let i=BM(e,t,r);if(n===0)return i;let a=Z(e,i.terminalNodeId);if(!Y(a)||!RA(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return RM(e,i.terminalNodeId,n-1,i.visibleDepth)}function BM(e,t,n){return Y(Z(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:yj(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:X(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>yj(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function VM(e,t){let n=Z(e,t);if(!Y(n))return!0;let r=n.parentId;return r===e.snapshot.rootId||vj(e,r)!==t}function HM(e,t){let n=Z(e,t.terminalNodeId);if(Y(n)){let r=Nj(e,t.terminalNodeId);if(RA(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:zM(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=Z(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=Nj(e,n),o=Ok(a).get(r)??-1;if(o<0)throw Error(`Child ${String(r)} was not found in its parent index`);let s=a.childIds[o+1]??null;if(s!=null)return zM(e,s,0,i);VM(e,r)&&i--,r=n}}function UM(e){let t=e.paths.length,n=Array(t);for(let r=0;r<t;r+=1){let t=e.getParentIndex(r);n[r]={index:r,parentPath:t>=0?e.paths[t]??null:null,path:e.paths[r]??``,posInSet:e.posInSetByIndex[r]??0,setSize:e.setSizeByIndex[r]??0}}return{getParentIndex:e.getParentIndex,rows:n,get visibleIndexByPath(){return e.visibleIndexByPath}}}function WM(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(CM);o.fill(-1);let s=0,{nodes:c,directories:l,segmentTable:u}=e.snapshot,d=[[l.get(e.snapshot.rootId),0,-1,``]],f=e.snapshot.options.flattenEmptyDirectories,p=e.pathCacheByNodeId,m=e.pathCacheVersion,h=u.valueById;for(;d.length>0&&s<t;){let t=d[d.length-1],u=t[0];if(t[1]>=u.childIds.length){d.pop();continue}let g=t[1],_=u.childIds[t[1]++],v=c[_],y=t[2]+1,b=t[3];o=wM(o,y);let x,S=_;if(Y(v))S=f?yj(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:Dj(e,S);else{let e=p.get(_);x=e!=null&&e.version===m?e.path:`${b}${h[v.nameId]}`}r[s]=o[y],n[s]=x,i[s]=g,a[s]=u.childIds.length,o[y+1]=s,s+=1;let C=c[S];C!=null&&Y(C)&&RA(e,S,C)&&d.push([l.get(S),0,y,x])}s<t&&(n.length=s);let g=r.subarray(0,s),_=i.subarray(0,s),v=a.subarray(0,s),y=null;return{getParentIndex(e){return e<0||e>=s?-1:g[e]??-1},paths:n,posInSetByIndex:_,setSizeByIndex:v,get visibleIndexByPath(){if(y==null){y=new Map;for(let e=0;e<s;e+=1)y.set(n[e]??``,e)}return y}}}function GM(e,t){let n=Array(t),r=0,{nodes:i,directories:a,segmentTable:o}=e.snapshot,s=[[a.get(e.snapshot.rootId),0,-1]],c=o.valueById,l=e.snapshot.options.flattenEmptyDirectories,u=e.pathCacheByNodeId,d=e.pathCacheVersion;for(;s.length>0&&r<t;){let t=s[s.length-1],o=t[0];if(t[1]>=o.childIds.length){s.pop();continue}let f=o.childIds[t[1]++],p=i[f],m=t[2]+1;if(!Y(p)){let t=u.get(f);n[r++]={depth:m,flattenedSegments:void 0,hasChildren:!1,id:f,isExpanded:!1,isFlattened:!1,isLoading:!1,kind:`file`,loadState:void 0,name:c[p.nameId],path:t!=null&&t.version===d?t.path:Dj(e,f)};continue}let h=l?yj(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=KM(e,g);let _=i[h];_!=null&&Y(_)&&RA(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function KM(e,t){let n=Z(e,t.terminalNodeId),r=Y(n)?qM(e,t):null,i=Dj(e,t.terminalNodeId),a=gA(e.snapshot.segmentTable,n.nameId),o=Y(n)&&Nj(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?bj(e,t.headNodeId).map(n=>{let r=Z(e,n);return{isTerminal:n===t.terminalNodeId,name:gA(e.snapshot.segmentTable,r.nameId),nodeId:n,path:Dj(e,n)}}):X(c,`store.getVisibleSlice.flatten.collectSegments`,()=>bj(e,t.headNodeId).map(n=>{let r=Z(e,n);return{isTerminal:n===t.terminalNodeId,name:gA(e.snapshot.segmentTable,r.nameId),nodeId:n,path:Dj(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:Y(n)&&RA(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:Y(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function qM(e,t){if(t.headNodeId===t.terminalNodeId)return VA(e,t.terminalNodeId);let n=bj(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=VA(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}var JM=8;function YM(e){let{nodes:t,directories:n,rootId:r,options:i}=e,a=t.length,o=new Int32Array(a),s=new Int32Array(a),c=new Int32Array(a),l=new Int32Array(a),u=new Int32Array(a),d=new Int32Array(a),f=new Int32Array(a);for(let e=0;e<a;e+=1){let n=t[e];n!=null&&(o[e]=n.parentId,s[e]=n.nameId,c[e]=n.depthAndFlags,l[e]=n.subtreeNodeCount,u[e]=n.visibleSubtreeCount)}let p=0;for(let e of n.values())p+=e.childIds.length;let m=new Int32Array(p),h=0;for(let[e,t]of n){let n=t.childIds;d[e]=h,f[e]=n.length;for(let e=0;e<n.length;e+=1)m[h]=n[e],h+=1}return{nodeCount:a,rootId:r,flattenEmptyDirectories:i.flattenEmptyDirectories===!0,parentId:o,nameId:s,depthAndFlags:c,subtreeNodeCount:l,visibleSubtreeCount:u,childStart:d,childCount:f,childIdsFlat:m}}function XM(e){let{nodeCount:t,rootId:n,flattenEmptyDirectories:r,depthAndFlags:i,subtreeNodeCount:a,visibleSubtreeCount:o,childStart:s,childCount:c,childIdsFlat:l}=e;for(let e=t-1;e>=1;--e){if((i[e]&JM)===0)continue;let t=s[e],n=c[e],u=0,d=0;for(let e=0;e<n;e+=1){let n=l[t+e];u+=a[n],d+=o[n]}a[e]=1+u;let f;f=r&&n===1?(i[l[t]]&JM)===0?1+d:d:1+d,o[e]=f}let u=s[n],d=c[n],f=0,p=0;for(let e=0;e<d;e+=1){let t=l[u+e];f+=a[t],p+=o[t]}a[n]=1+f,o[n]=p}function ZM(e){let{directories:t,nodes:n,options:r,rootId:i,presortedDirectoryNodeIds:a}=e.snapshot,o=r.flattenEmptyDirectories===!0,s=e=>{let r=n[e];if(r==null||!Y(r))return;let i=t.get(e);if(i==null)throw Error(`Unknown directory child index for node ${String(e)}`);let a=i.childIds,s=a.length,c=0,l=0;for(let e=0;e<s;e++){let t=a[e];if(t==null)continue;let r=n[t];c+=r.subtreeNodeCount,l+=r.visibleSubtreeCount}i.totalChildSubtreeNodeCount=c,i.totalChildVisibleSubtreeCount=l,s>=128&&Fk(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&Y(e)?l:1+l}else u=1+l;r.visibleSubtreeCount=u};if(a!=null)for(let e=a.length-1;e>=0;e--)s(a[e]);else for(let e=n.length-1;e>=1;e--)s(e);let c=n[i],l=t.get(i);if(c==null||l==null)return;let u=l.childIds,d=0,f=0;for(let e=0;e<u.length;e++){let t=u[e];if(t==null)continue;let r=n[t];d+=r.subtreeNodeCount,f+=r.visibleSubtreeCount}l.totalChildSubtreeNodeCount=d,l.totalChildVisibleSubtreeCount=f,Fk(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function QM(e){let{directories:t,nodes:n,rootId:r}=e.snapshot,i=YM(e.snapshot);XM(i);let a=i.subtreeNodeCount,o=i.visibleSubtreeCount;for(let e=0;e<n.length;e+=1){let t=n[e];t!=null&&(t.subtreeNodeCount=a[e],t.visibleSubtreeCount=o[e])}for(let[e,i]of t){let t=i.childIds,a=t.length,o=0,s=0;for(let e=0;e<a;e++){let r=t[e];if(r==null)continue;let i=n[r];o+=i.subtreeNodeCount,s+=i.visibleSubtreeCount}i.totalChildSubtreeNodeCount=o,i.totalChildVisibleSubtreeCount=s,(e===r||a>=128)&&Fk(n,i)}}function $M(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var eN=class e{#e;constructor(e={}){let t=Xk(e),n=X(t,`store.builder.create`,()=>new NA(e));if(e.preparedInput!=null){let t=AA(e.preparedInput);t==null?n.appendPreparedPaths(kA(e.preparedInput),!1):n.appendPresortedPaths(t,jA(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(X(t,`store.preparePathEntries`,()=>MA(r,e)))}let r=X(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=X(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=X(t,`store.state.create`,()=>PA(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:X(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||$M(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&X(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?e.useSoaCountSweep===!0?X(t,`store.state.initializeOpenVisibleCountsViaSoa`,()=>QM(this.#e)):X(t,`store.state.initializeOpenVisibleCounts`,()=>ZM(this.#e)):X(t,`store.state.recomputeCounts`,()=>kj(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return EA(e,t)}static prepareInput(e,t={}){return DA(e,t)}static preparePresortedInput(e){return OA(e)}list(e){return X(this.#e.instrumentation,`store.list`,()=>xj(this.#e,e))}add(e){X(this.#e.instrumentation,`store.add`,()=>{let t=TM(this.#e);cj(this.#e,oj(this.#e,t,Sj(this.#e,e)))})}remove(e,t={}){X(this.#e.instrumentation,`store.remove`,()=>{let n=TM(this.#e);cj(this.#e,oj(this.#e,n,Cj(this.#e,e,t)))})}move(e,t,n={}){X(this.#e.instrumentation,`store.move`,()=>{let r=TM(this.#e),i=wj(this.#e,e,t,n);i!=null&&cj(this.#e,oj(this.#e,r,i))})}batch(e){sj(this.#e,()=>{if(typeof e==`function`){e(this);return}for(let t of e)switch(t.type){case`add`:this.add(t.path);break;case`remove`:this.remove(t.path,{recursive:t.recursive});break;case`move`:this.move(t.from,t.to,{collision:t.collision})}})}getVisibleCount(){return X(this.#e.instrumentation,`store.getVisibleCount`,()=>TM(this.#e))}getVisibleSlice(e,t){return X(this.#e.instrumentation,`store.getVisibleSlice`,()=>jM(this.#e,e,t))}getVisibleRowContext(e){return X(this.#e.instrumentation,`store.getVisibleRowContext`,()=>AM(this.#e,e))}getVisibleTreeProjection(){return NM(this.#e)}getVisibleTreeProjectionData(e){return MM(this.#e,e)}getVisibleIndex(e){return X(this.#e.instrumentation,`store.getVisibleIndex`,()=>PM(this.#e,e))}getPathInfo(e){return X(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=jj(this.#e,e);if(t==null)return null;let n=Z(this.#e,t);return{depth:Hk(n),kind:Y(n)?`directory`:`file`,path:Dj(this.#e,t)}})}isExpanded(e){return X(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=Z(this.#e,t);return RA(this.#e,t,n)})}expand(e){X(this.#e.instrumentation,`store.expand`,()=>{let t=TM(this.#e),n=FM(this.#e,e);n!=null&&cj(this.#e,oj(this.#e,t,n))})}collapse(e){X(this.#e.instrumentation,`store.collapse`,()=>{let t=TM(this.#e),n=IM(this.#e,e);n!=null&&cj(this.#e,oj(this.#e,t,n))})}on(e,t){return JA(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return VA(this.#e,t)}markDirectoryUnloaded(e){X(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(Nj(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=TM(this.#e);UA(this.#e,t),cj(this.#e,oj(this.#e,n,ej({affectedAncestorIds:Aj(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return X(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=TM(this.#e),r=HA(this.#e,t);return cj(this.#e,oj(this.#e,n,tj({affectedAncestorIds:Aj(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return X(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||VA(this.#e,n)!==`loading`||!GA(this.#e,n,e.attemptId))return!1;let r=Dj(this.#e,n);this.validateChildPatch(r,t);let i=TM(this.#e),a=[];for(let e of t.operations){tN(r,e);let t=TM(this.#e);switch(e.type){case`add`:a.push(oj(this.#e,t,Sj(this.#e,e.path)));break;case`remove`:a.push(oj(this.#e,t,Cj(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=wj(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(oj(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return cj(this.#e,oj(this.#e,i,nj({affectedAncestorIds:Aj(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:Dj(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return X(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=TM(this.#e),r=WA(this.#e,t,e.attemptId);return cj(this.#e,oj(this.#e,n,rj({affectedAncestorIds:Aj(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:Dj(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return X(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=TM(this.#e),i=KA(this.#e,n,e.attemptId,t);return cj(this.#e,oj(this.#e,r,ij({affectedAncestorIds:Aj(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:Dj(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return X(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(xM(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=TM(this.#e),n=SM(this.#e,e.mode??`stable`);return cj(this.#e,oj(this.#e,t,aj({...n,affectedAncestorIds:[],affectedNodeIds:[],projectionChanged:n.idsPreserved===!1}))),n})}getNodeCount(){return this.#e.activeNodeCount}initializeExpandedPaths(e){if(e==null||e.length===0)return 0;let t=0,n=[],r=[],i=0,a=null,o=this.#e.snapshot.segmentTable,s=o.valueById,c=this.#e.snapshot.nodes,l=new Map;for(let u of e){a!=null&&u<a&&(a=null,i=0,n.length=0,r.length=0);let e=u.length>0&&u.charCodeAt(u.length-1)===47?u.length-1:u.length;if(e===0){a=u,i=e,n.length=0,r.length=0;continue}let d=0,f=0;if(a!=null){let t=Math.min(e,i),n=!0;for(let e=0;e<t;e+=1){let t=u.charCodeAt(e);if(t!==a.charCodeAt(e)){n=!1;break}t===47&&(d+=1,f=e+1)}n&&(t===i&&e>t&&u.charCodeAt(t)===47?(d+=1,f=t+1):t===e&&i>t&&a.charCodeAt(t)===47&&(d+=1,f=e+1)),d=Math.min(d,r.length)}let p=d===0?this.#e.snapshot.rootId:r[d-1]??this.#e.snapshot.rootId,m=d,h=!0,g=f;for(;g<=e;){let t=u.indexOf(`/`,g),i=t===-1||t>e?e:t,a=u.slice(g,i),f=Nj(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??eA(a);l.set(a,b);let x=(e,t)=>{for(v=e;v<t;v+=1){let e=f[v],t=c[e],n=s[t.nameId];if(n===a)return y=e,!0;let r=nA(lA(o,t.nameId),b);if(r>0||r===0&&n>a)return!1}return!1};if(!x(_,f.length)&&_>0&&x(0,_),y===void 0){h=!1;break}if(!Y(Z(this.#e,y))){h=!1;break}if(n[m]=v,r[m]=y,p=y,m+=1,i===e)break;g=i+1}if(a=u,i=e,n.length=m,r.length=m,!h){a=null,i=0,n.length=0,r.length=0;continue}for(let e=d;e<m;e+=1){let n=r[e];if(n==null)continue;let i=Z(this.#e,n);RA(this.#e,n,i)||(zA(this.#e,n,!0,i),t+=1)}}return t}hasAllDirectoriesExpanded(){for(let e of this.#e.snapshot.directories.keys()){if(e===this.#e.snapshot.rootId)continue;let t=Z(this.#e,e);if(!RA(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=jj(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!Y(Z(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!Y(Z(this.#e,e)))throw Error(`Node is not a directory: ${String(e)}`);return e}catch{return null}}isDirectoryProjectionVisible(e){let t=e;for(;t!==this.#e.snapshot.rootId;){let e=Z(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=Z(this.#e,e),r=vj(this.#e,e);if(!RA(this.#e,e,n)&&r!==t)return!1}t=e}return!0}validateChildPatch(t,n){new e({paths:this.list(t),presorted:!0,sort:this.#e.snapshot.options.sort}).batch(n.operations)}};function tN(e,t){switch(t.type){case`add`:case`remove`:if(!t.path.startsWith(e)||t.path===e)throw Error(`Child patch operation must stay within ${e}: "${t.path}"`);break;case`move`:if(!t.from.startsWith(e)||!t.to.startsWith(e)||t.from===e||t.to===e)throw Error(`Child patch move must stay within ${e}: "${t.from}" -> "${t.to}"`)}}var nN=e=>e.startsWith(`f::`)?e.slice(3):e;function rN(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function iN(e,t){return e===``?t:`${e}/${t}`}function aN({files:e,path:t,isFolder:n,nextBasename:r}){let i=nN(t),a=r.trim();if(a.length===0)return{error:`Name cannot be empty.`};if(a.includes(`/`))return{error:`Name cannot include "/".`};let{parentPath:o,baseName:s}=rN(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=iN(o,a),l=Array(e.length),u=new Set;if(!n){let t=`${c}/`,r=!1;for(let n=0;n<e.length;n++){let a=e[n];if(a!==i&&a.startsWith(t))return{error:`"${c}" already exists.`};let o=a===i?c:a;if(u.has(o))return{error:`"${c}" already exists.`};u.add(o),l[n]=o,a===i&&(r=!0)}return r?{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}:{error:`Could not find the selected file to rename.`}}let d=`${i}/`,f=`${c}/`,p=0;for(let t=0;t<e.length;t++){let n=e[t],r=n===i||n.startsWith(d);if(!r&&(n===c||n.startsWith(f)))return{error:`"${c}" already exists.`};let a=r?`${c}${n.slice(i.length)}`:n;if(u.has(a))return{error:`"${c}" already exists.`};u.add(a),l[t]=a,r&&p++}return p===0?{error:`Could not find the selected folder to rename.`}:{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}}function oN(e){return e.endsWith(`/`)}function sN(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`),r=n<0?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function cN(e){let t=[],n=new Set;for(let r of e)n.has(r)||(n.add(r),t.push(r));let r=new Set;for(let e of t.toSorted((e,t)=>e.length===t.length?e.localeCompare(t):e.length-t.length)){let t=(e.endsWith(`/`)?e.slice(0,-1):e).split(`/`),n=!1;for(let e=0;e<t.length-1;e+=1){let i=`${t.slice(0,e+1).join(`/`)}/`;if(r.has(i)){n=!0;break}}n||r.add(e)}return t.filter(e=>r.has(e))}function lN(e,t){return t.includes(e)?cN(t):[e]}function uN(e,t){return e===t?!0:e==null||t==null?!1:e.kind===t.kind&&e.directoryPath===t.directoryPath&&e.flattenedSegmentPath===t.flattenedSegmentPath&&e.hoveredPath===t.hoveredPath}function dN(e,t){return{draggedPaths:e,target:t}}function fN(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(oN(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function pN(e,t){return t.kind===`root`||t.directoryPath==null?sN(e):t.directoryPath}function mN(e,t){let n=e.map(e=>{let n=pN(e,t);return n===e?null:{from:e,to:n,type:`move`}}).filter(e=>e!=null);return n.length===0?null:{operations:n,result:{draggedPaths:e,operation:n.length===1?`move`:`batch`,target:t}}}function hN(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function gN(e,t,n){let{paths:r,preparedInput:i}=e;if(i==null){if(r==null)throw Error(`FileTree requires paths or preparedInput`);return{paths:r,preparedInput:void 0}}let a=i.paths;if(r==null)return{paths:a,preparedInput:i};if(!hN(eN.preparePaths(r,n==null?{}:{sort:n}),a))throw Error(`FileTree ${t} received paths and preparedInput for different path lists`);return{paths:a,preparedInput:i}}function _N(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function vN(e,t,n){if(e===t)return n;let r=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(r)?`${n.endsWith(`/`)?n:`${n}/`}${e.slice(r.length)}`:e}function yN(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function bN(e,t,n=!1){if(e==null)return null;switch(t.operation){case`add`:case`expand`:case`collapse`:case`mark-directory-unloaded`:case`begin-child-load`:case`apply-child-patch`:case`complete-child-load`:case`fail-child-load`:case`cleanup`:return e;case`remove`:return yN(e,t.path)?n?e:null:e;case`move`:return vN(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=bN(r,e,n),r==null)return null;return r}}}function xN(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function SN(e){switch(e.operation){case`add`:return{...xN(e),operation:`add`,path:e.path};case`remove`:return{...xN(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...xN(e),from:e.from,operation:`move`,to:e.to}}}function CN(e){return{...xN(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>SN(e)),operation:`batch`}}function wN(e){switch(e.operation){case`add`:case`remove`:case`move`:return SN(e);case`batch`:return CN(e);default:return null}}function TN(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function EN(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function DN(e){return EN(e).at(-1)??null}function ON(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function kN(e){return e.endsWith(`/`)}var AN=e=>e.toLowerCase();function jN(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function MN(e){return e.endsWith(`/`)?e.slice(0,-1):e}function NN(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var PN=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},FN=Symbol(`FILE_TREE_RENAME_VIEW`),IN=512,LN=512;function RN(e){return e===`top`||e===`center`?e:`nearest`}function zN(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=EN(n);for(let e=r.length-1;e>=0;--e){let n=r[e];if(n==null)continue;let i=t(n);if(i!=null)return i}}return 0}function BN(e,t,n){if(e.paths.length===0)return{focusedIndex:-1,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};if(t==null)return{focusedIndex:0,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};let r=n??(t=>e.visibleIndexByPath.get(t)??null);return{focusedIndex:zN(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var VN=class e{static{Object.defineProperty(e.prototype,FN,{configurable:!0,value(){return{cancel:()=>{this.#q()},commit:()=>{this.#J()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#Y(e)}}},writable:!0})}#e;#t=new Set;#n=new Map;#r=null;#i=null;#a=new Map;#o=new Map;#s=-1;#c=null;#l=!1;#u=e=>-1;#d=new Map;#f=null;#p=null;#m=null;#h=null;#g=null;#_;#v;#y;#b=[];#x=new Int32Array;#S=new Int32Array;#C=void 0;#w=!1;#T=null;#E=``;#D=!1;#O=new Set;#k=[];#A;#j=null;#M=null;#N=null;#P=null;#F=null;#I=null;#L=null;#R=0;#z=null;#B=new Set;#V=0;#H;#U=0;#W=!1;#G=0;#K;constructor(e){let{dragAndDrop:t,fileTreeSearchMode:n,initialSearchQuery:r,initialSelectedPaths:i,renaming:a,onSearchChange:o,paths:s,preparedInput:c,...l}=e,u=gN({paths:s,preparedInput:c},`constructor`,l.sort);this.#e=l,t!=null&&t!==!1&&(this.#r=t===!0?{}:t),this.#w=a!=null&&a!==!1,a!=null&&a!==!1&&a!==!0&&(this.#C=a.canRename,this.#v=a.onError,this.#_=a.onRename),this.#y=o,this.#A=n??`hide-non-matches`,this.#H=this.#le(u.paths,u.preparedInput);let d=i?.map(e=>this.#Ne(e)).filter(e=>e!=null)??[],f=d.at(-1)??null;d.length>0&&(this.#B=new Set(d),this.#z=f,this.#V=1),this.#je(f,!1),r!=null&&this.#Te(r,!1),this.#K=this.#Re()}destroy(){this.#K?.(),this.#K=null,this.#n.clear(),this.#t.clear(),this.#d.clear(),this.#i=null,this.#he()}focusFirstItem(){this.#be().length>0&&this.#Fe(0)}focusLastItem(){this.#G<=0||(this.#Ie(),this.#Fe(this.#G-1))}focusNextItem(){this.#Ae(1)}focusParentItem(){if(this.#c==null)return;let e=DN(this.#c);if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t)}focusPath(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;this.#Ie();let n=this.#Z(t);n>=0&&this.#Fe(n)}scrollToPath(e,t){let n=this.#H.getPathInfo(e)?.path??null;if(n==null)return;this.#Ie();let r=this.#xe(n);r<0||this.#Me(r)!=null&&(t?.focus!==!1&&this.#Fe(r,!1),this.#L={id:this.#R+=1,offset:RN(t?.offset),visibleIndex:r},this.#De())}focusMountedPathFromInput(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;let n=this.#Z(t);n>=0&&this.#Fe(n)}focusNearestPath(e){let t=this.resolveNearestVisiblePath(e);if(t==null)return null;let n=this.#Z(t);return n>=0?(this.#Fe(n),this.#be()[n]??t):null}focusPreviousItem(){this.#Ae(-1)}getFocusedIndex(){return this.#s}getFocusedItem(){return this.#c==null?null:this.#Q(this.#c)}getFocusedPath(){return this.#c}getScrollRequest(){return this.#L}clearScrollRequest(e){this.#L?.id===e&&(this.#L=null)}resolveNearestVisiblePath(e){let t=this.#be();if(this.#G===0)return null;if(e==null)return this.#c??t[0]??null;let n=this.#H.getPathInfo(e)?.path??e,r=this.#Z(n);return r>=0?t[r]??n:this.#X(n)??this.#c??t[0]??null}getSelectedPaths(){return[...this.#B]}getSelectionVersion(){return this.#V}getVisibleCount(){return this.#G}getVisibleRows(e,t){if(t<e||this.#G===0)return[];let n=Math.max(0,e),r=Math.min(this.#G-1,t);if(r<n)return[];let i=r-n+1;if(this.#F==null&&!this.#l&&r>=this.#b.length&&i<=LN){let e=[];for(let t=n;t<=r;t+=1){let n=this.#H.getVisibleRowContext(t);if(n==null)break;e.push(this.#ee(n))}return e}if(!this.#l&&r>=this.#b.length&&this.#Ie(),this.#F!=null){let e=Array.from({length:r-n+1},(e,t)=>this.#Se(n+t)),t=new Map,i=e[0]??-1,a=i;for(let n=1;n<=e.length;n+=1){let r=e[n];if(r!=null&&r===a+1){a=r;continue}if(i>=0&&this.#H.getVisibleSlice(i,a).forEach((e,n)=>{t.set(i+n,e)}),r==null){i=-1,a=-1;continue}i=r,a=r}return Array.from({length:r-n+1},(e,r)=>{let i=n+r,a=this.#Se(i),o=t.get(a),s=this.#b[a];if(o==null||s==null)throw Error(`Missing projection row for filtered visible index ${String(i)}`);return this.#$(o,i,a,{ancestorPaths:this.#re(a),path:s})})}return this.#H.getVisibleSlice(n,r).map((e,t)=>{let r=n+t,i=this.#b[r];if(i==null)throw Error(`Missing projection path for visible index ${String(r)}`);return this.#$(e,r,r,{ancestorPaths:this.#re(r),path:i})})}getStickyRowCandidates(e,t){if(this.#F!=null)return null;if(this.#G===0||e<=0||t<=0)return[];let n=[];for(let r=0;r<this.#G;r+=1){let i=e+r*t,a=Math.min(this.#G-1,Math.floor(i/t)),o=this.#te(a,r)??(a>0?this.#te(a-1,r):void 0);if(o==null)break;n.push({row:this.#ee(o),subtreeEndIndex:o.subtreeEndIndex})}return n}getItem(e){let t=this.#H.getPathInfo(e);return t==null?null:this.#Q(t.path,t)}resolveMountedDirectoryPathFromInput(e){let t=this.#H.getPathInfo(e);return t?.kind===`directory`?t.path:null}toggleMountedDirectoryFromInput(e){let t=this.resolveMountedDirectoryPathFromInput(e);t!=null&&this.#ze(t)}selectAllVisiblePaths(){this.#Ie();let e=[...this.#be()];this.#ae(e,this.#c??this.#z)}selectOnlyPath(e){let t=this.#Ne(e);t!=null&&this.#ae([t],t)}selectOnlyMountedPathFromInput(e){this.#ae([e],e)}selectPath(e){let t=this.#Ne(e);t==null||this.#B.has(t)||this.#ae([...this.#B,t])}deselectPath(e){let t=this.#Ne(e);t==null||!this.#B.has(t)||this.#ae([...this.#B].filter(e=>e!==t))}toggleFocusedSelection(){this.#c!=null&&this.togglePathSelectionFromInput(this.#c)}togglePathSelection(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.deselectPath(t);return}this.selectPath(t)}}togglePathSelectionFromInput(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.#ae([...this.#B].filter(e=>e!==t),t);return}this.#ae([...this.#B,t],t)}}selectPathRange(e,t){let n=this.#Ne(e);if(n==null)return;this.#Ie();let r=this.#z,i=r==null?-1:this.#Ce(r),a=this.#Ce(n);if(i===-1||a===-1){let e=t?[...this.#B,n]:[n];this.#ae(e,n);return}let[o,s]=i<=a?[i,a]:[a,i],c=this.#be().slice(o,s+1),l=t?[...this.#B,...c]:c;this.#ae(l,r)}extendSelectionFromFocused(e){if(this.#c==null)return;let t=this.#s;if(t===-1)return;let n=Math.min(this.#G-1,Math.max(0,t+e));if(n===t)return;!this.#l&&n>=this.#b.length&&this.#Ie();let r=this.#be(),i=r[t]??null,a=r[n]??null;if(i==null||a==null)return;let o=new Set(this.#B);o.has(i)&&o.has(a)?o.delete(i):o.add(a),this.#ae([...o],this.#z??i,!1),this.#Fe(n)}getDragAndDropConfig(){return this.#r}isDragAndDropEnabled(){return this.#r!=null}getDragSession(){return this.#i==null?null:{draggedPaths:[...this.#i.draggedPaths],primaryPath:this.#i.primaryPath,target:this.#i.target==null?null:{...this.#i.target}}}startDrag(e){if(this.#r==null)return!1;let t=this.#Ne(e);if(t==null||this.#M!=null&&this.#M.length>0)return!1;let n=this.getSelectedPaths(),r=lN(t,n);return this.#r.canDrag?.(r)!==!1&&(n.includes(t)||this.#ae([t],t,!1),this.#Pe(t),this.#i={draggedPaths:r,primaryPath:t,target:null},this.#De(),!0)}setDragTarget(e){let t=this.#i;if(t==null)return;let n=e;if(n!=null){let e=dN(t.draggedPaths,n);(fN(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}uN(t.target,n)||(this.#i={...t,target:n},this.#De())}cancelDrag(){this.#i!=null&&(this.#i=null,this.#De())}completeDrag(){let e=this.#i;if(e==null)return!1;this.#i=null;let t=e.target==null?null:{...e.target};if(t==null)return this.#De(),!1;let n=dN(e.draggedPaths,t);if(fN(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=mN(e.draggedPaths,t);if(r==null)return this.#De(),!1;try{if(r.operations.length===1){let e=r.operations[0];if(e==null||e.type!==`move`)throw Error(`Expected a single move operation for one-item drops`);this.#H.move(e.from,e.to,{collision:e.collision})}else this.#ce(r.operations),this.#H.batch(r.operations)}catch(e){return this.#De(),this.#r?.onDropError?.(e instanceof Error?e.message:String(e),n),!1}return this.#r?.onDropComplete?.(r.result),!0}subscribe(e){return this.#t.add(e),e(),()=>{this.#t.delete(e)}}add(e){this.#H.add(e)}remove(e,t={}){this.#H.remove(e,t)}move(e,t,n={}){this.#H.move(e,t,n)}batch(e){this.#H.batch(e)}onMutation(e,t){let n=e,r=t,i=this.#n.get(n);return i??(i=new Set,this.#n.set(n,i)),i.add(r),()=>{let e=this.#n.get(n);e?.delete(r),e?.size===0&&this.#n.delete(n)}}setSearch(e){this.#Te(e,!0)}openSearch(e=``){this.#Te(e,!0)}closeSearch(){this.#Te(null,!0)}isSearchOpen(){return this.#M!==null}getSearchValue(){return this.#M??``}getSearchMatchingPaths(){return this.#k}focusNextSearchMatch(){this.#we(1)}focusPreviousSearchMatch(){this.#we(-1)}startRenaming(e=this.#c??``,t={}){if(!this.#w)return!1;let n=this.#H.getPathInfo(e);if(n==null)return!1;let r=n.path,i=kN(r),a=MN(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of EN(r))this.#H.isExpanded(e)||this.#H.expand(e);return this.#ae([r],r,!1),this.#M!=null&&(this.#Te(null,!1),this.#y?.(this.#M)),this.#Pe(r),this.#T=r,this.#E=jN(r),this.#D=t.removeIfCanceled??!1,this.#De(),!0}#q(){if(this.#T==null)return;let e=this.#T,t=this.#D;if(this.#T=null,this.#E=``,this.#D=!1,t){this.remove(e,kN(e)?{recursive:!0}:void 0);return}this.#Pe(e),this.#De()}#J(){let e=this.#T;if(e==null)return;if(this.#D&&this.#E.trim().length===0){this.#T=null,this.#E=``,this.#D=!1,this.remove(e,kN(e)?{recursive:!0}:void 0);return}let t=kN(e),n=aN({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:MN(e)});if(this.#T=null,this.#E=``,this.#D=!1,`error`in n){this.#Pe(e),this.#v?.(n.error),this.#De();return}if(n.sourcePath===n.destinationPath){this.#Pe(e),this.#De();return}this.#_?.({destinationPath:n.destinationPath,isFolder:n.isFolder,sourcePath:n.sourcePath}),this.move(NN(n.sourcePath,t),NN(n.destinationPath,t))}#Y(e){this.#T!=null&&this.#E!==e&&(this.#E=e,this.#De())}resetPaths(e,t={}){let n=!Array.isArray(e),r=n?void 0:e,i=n?e:t,a=this.#H.list().length,o=this.#G,s=gN({paths:r,preparedInput:i.preparedInput},`resetPaths`,this.#e.sort),c=this.#le(s.paths,s.preparedInput,i.initialExpandedPaths),l=this.#c,u=this.#T,d=this.getSelectedPaths(),f=this.#z;this.#K?.(),this.#H=c,this.#d.clear(),this.#he();let p=d.map(e=>c.getPathInfo(e)?.path??null).filter(e=>e!=null),m=!TN(this.#B,p);this.#B=new Set(p),m&&(this.#V+=1),this.#z=f==null?null:c.getPathInfo(f)?.path??null,this.#T=u==null?null:c.getPathInfo(u)?.path??null,this.#T??(this.#E=``,this.#D=!1),this.#je(l,l!=null||p.length>0||this.#z!=null),this.#K=this.#Re(),this.#De(),this.#Oe({canonicalChanged:!0,operation:`reset`,pathCountAfter:s.paths.length,pathCountBefore:a,projectionChanged:!0,usedPreparedInput:i.preparedInput!=null,visibleCountDelta:this.#G-o})}#X(e){this.#Ie();let t=DN(e),n=ON(e,t),r=null,i=null;for(let e of this.#be()){if(DN(e)!==t)continue;let a=ON(e,t);if(a<n){r=e;continue}if(a>n){i=e;break}}return r??i}#Z(e){let t=this.#Ce(e);if(t!==-1)return t;let n=EN(e);for(let e=n.length-1;e>=0;--e){let t=n[e];if(t==null)continue;let r=this.#Ce(t);if(r!==-1)return r}return this.#be().length>0?0:-1}#Q(e,t){let n=this.#d.get(e);if(n!=null)return n;let r=t??this.#H.getPathInfo(e);if(r==null)return null;let i=r.kind===`directory`?this.#oe(r.path):this.#se(r.path);return this.#d.set(r.path,i),i}#$(e,t,n,r){return{ancestorPaths:r.ancestorPaths,depth:e.depth,flattenedSegments:e.flattenedSegments?.map(e=>({isTerminal:e.isTerminal,name:e.name,path:e.path})),hasChildren:e.hasChildren,index:t,isExpanded:e.isExpanded,isFlattened:e.isFlattened,isFocused:r.path===this.#c,isSelected:this.#B.has(r.path),kind:e.kind,level:e.depth,name:e.name,path:r.path,posInSet:r.posInSet??this.#x[n]??0,setSize:r.setSize??this.#S[n]??0}}#ee(e){return this.#$(e.row,e.index,e.index,{ancestorPaths:e.ancestorPaths,path:e.row.path,posInSet:e.posInSet,setSize:e.setSize})}#te(e,t){let n=this.#H.getVisibleRowContext(e);return n==null?void 0:n.ancestorRows[t]??(t===n.ancestorRows.length&&n.row.kind===`directory`&&n.row.isExpanded?n:void 0)}#ne(e){let t=this.#a.get(e);if(t!=null)return t;let n=this.#u(e),r=n<0?[]:[...this.#ne(n),n];return this.#a.set(e,r),r}#re(e){let t=this.#o.get(e);if(t!=null)return t;let n=this.#ne(e).map(e=>this.#b[e]??``).filter(e=>e!==``);return this.#o.set(e,n),n}#ie(e){this.#H.collapse(e)}#ae(e,t=this.#z,n=!0){let r=[...new Set(e)],i=!TN(this.#B,r),a=this.#z!==t;!i&&!a||(this.#B=new Set(r),this.#z=t,i&&(this.#V+=1),n&&this.#De())}#oe(e){return{collapse:()=>{this.#ie(e)},deselect:()=>{this.deselectPath(e)},expand:()=>{this.#ke(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!0,isExpanded:()=>this.#H.isExpanded(e),isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)},toggle:()=>{this.#ze(e)}}}#se(e){return{deselect:()=>{this.deselectPath(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!1,isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)}}}#ce(e){let t=this.#H.list();this.#le(t).batch(e)}#le(e,t,n){return new eN({...this.#e,paths:e,preparedInput:t??void 0,...n===void 0?{}:{initialExpandedPaths:n}})}#ue(){return this.#h??=this.#H.list(),this.#h}#de(){if(this.#m!=null)return this.#m;let e=new Set;for(let t of this.#ue()){e.add(t);for(let n of EN(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(AN),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(AN),this.#p}#he(){this.#f=null,this.#p=null,this.#m=null,this.#h=null,this.#g=null}#ge(){return this.#pe().filter(e=>this.#H.isExpanded(e))}#_e(e){let t=new Set(this.#j??[]);if(e)for(let e of this.#B)for(let n of EN(e))t.add(n);this.#ve(t)}#ve(e){this.#W=!0;try{for(let t of this.#pe()){let n=e.has(t),r=this.#H.isExpanded(t);n&&!r?this.#H.expand(t):!n&&r&&this.#H.collapse(t)}}finally{this.#W=!1}}#ye(){if(this.#M==null||this.#M.length===0){this.#k=[],this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let e=this.#b;if(this.#k=e.filter(e=>this.#O.has(e)),this.#A!==`hide-non-matches`||this.#O.size===0){this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let t=[],n=[],r=new Map;for(let[i,a]of e.entries())this.#N?.has(a)===!0&&(r.set(a,n.length),t.push(i),n.push(a));this.#F=t,this.#I=n,this.#P=r,this.#G=n.length}#be(){return this.#I??this.#b}#xe(e){return this.#I==null?this.#H.getVisibleIndex(e)??-1:this.#P?.get(e)??-1}#Se(e){return this.#F?.[e]??e}#Ce(e){return this.#P?.get(e)??this.#H.getVisibleIndex(e)??-1}#we(e){let t=this.#k;if(t.length===0)return;let n=this.#c,r=n==null?-1:t.indexOf(n),i=t[r<0?e>0?0:t.length-1:Math.min(t.length-1,Math.max(0,r+e))];i!=null&&this.focusPath(i)}#Te(e,t){let n=e==null?null:PN(e),r=this.#M;if(r!==n){if(r==null&&n!=null&&(this.#j=this.#ge()),this.#M=n,n==null)this.#_e(!0),this.#j=null,this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else if(n.length===0)this.#_e(!1),this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else{let e=this.#Ee();this.#je(e,!0)}t&&(this.#y?.(this.#M),this.#De())}}#Ee(){if(this.#M==null||this.#M.length===0)return this.#O.clear(),this.#c;let e=this.#M,t=this.#ue(),n=this.#fe(),r=[],i=new Set,a=null;for(let o=0;o<t.length;o+=1){if(!n[o].includes(e))continue;let s=t[o];r.push(s),i.add(s),a??=s}let o=this.#pe(),s=this.#me();for(let t=0;t<o.length;t+=1){if(!s[t].includes(e))continue;let n=o[t];i.has(n)||(r.push(n),i.add(n),a??=n)}this.#O=i;let c=this.#A===`hide-non-matches`&&r.length>0?new Set:null;this.#N=c;let l=this.#A===`expand-matches`?new Set(this.#j??[]):new Set;for(let e of r){c?.add(e),e.endsWith(`/`)&&l.add(e);for(let t of EN(e))l.add(t),c?.add(t)}return this.#ve(l),a??this.#c}#De(){for(let e of this.#t)e()}#Oe(e){this.#n.get(e.operation)?.forEach(t=>{t(e)}),this.#n.get(`*`)?.forEach(t=>{t(e)})}#ke(e){for(let t of EN(e))this.#H.isExpanded(t)||this.#H.expand(t);this.#H.isExpanded(e)||this.#H.expand(e)}#Ae(e){let t=this.#G;if(t===0)return;let n=this.#s===-1?0:this.#s,r=Math.min(t-1,Math.max(0,n+e));(r!==n||this.#s===-1)&&(!this.#l&&this.#F==null&&r>=this.#b.length&&this.#Ie(),this.#Fe(r))}#je(e,t=!0){let n=this.#H.getVisibleCount();this.#U=n;let r=BN(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,IN)),e,t?e=>this.#H.getVisibleIndex(e):void 0);this.#a.clear(),this.#o.clear(),this.#l=r.paths.length>=n,this.#u=r.getParentIndex,this.#b=r.paths,this.#x=r.posInSetByIndex,this.#S=r.setSizeByIndex,this.#ye(),this.#s=e==null?this.#be().length>0?0:-1:this.#Z(e),this.#c=this.#s<0?null:this.#Me(this.#s)}#Me(e){return this.#be()[e]??(this.#F==null?this.#H.getVisibleRowContext(e)?.row.path??null:null)}#Ne(e){return this.#H.getPathInfo(e)?.path??null}#Pe(e){if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t,!1)}#Fe(e,t=!0){let n=this.#Me(e);n!=null&&(this.#s!==e||this.#c!==n)&&(this.#s=e,this.#c=n,t&&this.#De())}#Ie(){this.#l||this.#je(this.#c,!0)}#Le(e){let t=bN(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=bN(this.#c,e,!0),r=[...this.#B].map(t=>bN(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=bN(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return TN(this.#B,o)||(this.#B=new Set(o),this.#V+=1),this.#z=a,n}#Re(){return this.#H.on(`*`,e=>{if(this.#W)return;e.canonicalChanged&&(this.#d.clear(),this.#he()),this.#i!=null&&_N(e)&&(this.#i=null);let t=_N(e)?this.#Le(e):this.#c,n=this.#M!=null&&this.#M.length>0?this.#Ee():this.#M===``?this.#c:t,r=this.#M!=null||e.operation!==`expand`&&e.operation!==`collapse`;this.#je(n,r),this.#De();let i=wN(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},HN=e=>{if(e==null||e.length===0)return`0`;let t=`${e.length}`;for(let n of e)t+=`\0${n.path}\0${n.status}`;return t};function UN(e){let t=e.endsWith(`/`),n=``,r=-1;for(let t=0;t<=e.length;t+=1){if(e[t]!==`/`&&t!==e.length){r===-1&&(r=t);continue}r!==-1&&(n!==``&&(n+=`/`),n+=e.slice(r,t),r=-1)}return n===``?null:{isDirectory:t,path:n}}function WN(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=[],r=0;for(;;){let e=t.indexOf(`/`,r);if(e===-1)break;n.push(t.slice(0,e+1)),r=e+1}return n}function GN(e,t){return t?`${e}/`:e}function KN(e,t=null){let n=HN(e==null?void 0:[...e]);if(n===`0`)return null;if(t?.signature===n)return t;let r=new Map,i=new Set,a=new Set,o=new Map;for(let t of e??[]){let e=JN(t);e!=null&&ZN({canonicalPath:e.canonicalPath,changeCountByDirectoryPath:o,directoriesWithChanges:i,ignoredDirectoryPaths:a,isDirectory:e.isDirectory,status:t.status,statusByPath:r})}return r.size===0?null:{changeCountByDirectoryPath:o,directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}function qN(e,t){let n=t?.remove??[],r=t?.set??[];if(n.length===0&&r.length===0)return e;let i=new Map(e?.statusByPath),a=new Set(e?.directoriesWithChanges),o=new Set(e?.ignoredDirectoryPaths),s=new Map(e?.changeCountByDirectoryPath),c=!1;for(let e of n){let t=YN(e);t!=null&&(c=XN({canonicalPath:t.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,statusByPath:i})||c)}for(let e of r){let t=JN(e);t!=null&&(c=ZN({canonicalPath:t.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,isDirectory:t.isDirectory,status:e.status,statusByPath:i})||c)}return c?i.size===0?null:{changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,signature:eP(i),statusByPath:i}:e}function JN(e){return YN(e.path)}function YN(e){let t=UN(e);if(t!=null)return{canonicalPath:GN(t.path,t.isDirectory),isDirectory:t.isDirectory}}function XN({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,statusByPath:i}){let a=i.get(e);return a!=null&&(i.delete(e),a===`ignored`&&e.endsWith(`/`)&&r.delete(e),$N(t,n,e),!0)}function ZN({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,isDirectory:i,status:a,statusByPath:o}){let s=o.get(e);return s!==a&&(s??QN(t,n,e),o.set(e,a),a===`ignored`&&i?r.add(e):i&&r.delete(e),!0)}function QN(e,t,n){for(let r of WN(n))e.set(r,(e.get(r)??0)+1),t.add(r)}function $N(e,t,n){for(let r of WN(n)){let n=(e.get(r)??0)-1;n>0?e.set(r,n):(e.delete(r),t.delete(r))}}function eP(e){let t=`${e.size}`;for(let[n,r]of e)t+=`\0${n}\0${r}`;return t}var tP=e=>e.trim().toLowerCase(),nP=e=>e.split(`/`).at(-1)??e,rP=e=>{let t=e.toLowerCase().split(`.`),n=[];for(let e=1;e<t.length;e+=1)n.push(t.slice(e).join(`.`));return n};function iP(e,t){return typeof e==`string`?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function aP(e){let t=sk(e),n=t.remap,r=new Map;for(let[e,n]of Object.entries(t.byFileName??{}))r.set(e.toLowerCase(),n);let i=new Map;for(let[e,n]of Object.entries(t.byFileExtension??{}))i.set(tP(e),n);let a=Object.entries(t.byFileNameContains??{}).map(([e,t])=>[e.toLowerCase(),t]);return{resolveIcon:(e,o)=>{if(e===`file-tree-icon-file`&&o!=null){let s=nP(o),c=s.toLowerCase(),l=r.get(c);if(l!=null)return iP(l,e);for(let[t,n]of a)if(c.includes(t))return iP(n,e);let u=rP(s);for(let t of u){let n=i.get(t);if(n!=null)return iP(n,e)}let d=ak(t.set,s,u);if(d!=null&&t.set!==`none`){if(d==="default"){let t=n?.[e];if(t!=null)return iP(t,e)}return{name:rk(d),remappedFrom:e,token:d}}}let s=n?.[e];return s==null?{name:e}:iP(s,e)}}}var oP,sP,cP,lP,uP,dP,fP,pP,mP,hP,gP={},_P=[],vP=Array.isArray,yP=_P.slice,bP=Object.assign;function xP(e){e&&e.parentNode&&e.remove()}function SP(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`&&typeof e!=`function`?i=t[a]:o[a]=t[a];return arguments.length>2&&(o.children=arguments.length>3?yP.call(arguments,2):n),CP(e,o,r,i,null)}function CP(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++sP,__i:-1,__u:0};return i==null&&oP.vnode!=null&&oP.vnode(a),a}function wP(e){return e.children}function TP(e,t){this.props=e,this.context=t,this.__g=0}function EP(e,t){if(t==null)return e.__?EP(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?EP(e):null}function DP(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=n.__e;break}return DP(e)}}function OP(e){(8&e.__g||!(e.__g|=8)||!cP.push(e)||uP++)&&lP==oP.debounceRendering||((lP=oP.debounceRendering)||queueMicrotask)(kP)}function kP(){for(var e,t,n,r,i,a,o,s,c=1;cP.length;)cP.length>c&&cP.sort(dP),e=cP.shift(),c=cP.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=bP({},r)).__v=r.__v+1,oP.vnode&&oP.vnode(n),LP(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??EP(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,zP(a,n,o),n.__e!=i&&DP(n)));uP=0}function AP(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||_P,b=t.length;for(c=jP(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?gP:y[m.__i]||gP,m.__i=f,_=LP(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&HP(p.ref,null,m),u.push(m.ref,m.__c||h,m)),g==null&&h!=null&&(g=h),(v=!!(4&m.__u))||p.__k===m.__k?c=MP(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function jP(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(c=a+f,(o=e.__k[a]=typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?CP(null,o,null,null,null):vP(o)?CP(wP,{children:o},null,null,null):o.constructor==null&&o.__b>0?CP(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=e,o.__b=e.__b+1,s=null,(l=o.__i=NP(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=EP(s)),UP(s,s));return r}function MP(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=MP(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=EP(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function NP(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&!(2&l.__u);if(l===null&&e.key==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function PP(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function FP(e,t,n,r,i){var a;n:if(t==`style`){if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||PP(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||PP(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(fP,`$1`)),(t=t.slice(2))[0].toLowerCase()!=t[0]&&(t=t.toLowerCase()),e.__l||={},e.__l[t+a]=n,n?r?n.l=r.l:(n.l=pP,e.addEventListener(t,a?hP:mP,a)):e.removeEventListener(t,a?hP:mP,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function IP(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=pP++;else if(t.u<n.l)return;return n(oP.event?oP.event(t):t)}}}function LP(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,ee,te,ne,E,D,re,O=t.type;if(t.constructor!=null)return null;128&n.__u&&(c=!!(32&n.__u),n.__c.__z&&(s=t.__e=n.__e=(a=n.__c.__z)[0],n.__c.__z=null)),(d=oP.__b)&&d(t);n:if(typeof O==`function`)try{if(v=t.props,y=`prototype`in O&&O.prototype.render,b=(d=O.contextType)&&r[d.__c],x=d?b?b.props.value:d.__:r,n.__c?2&(f=t.__c=n.__c).__g&&(f.__g|=1,_=!0):(y?t.__c=f=new O(v,x):(t.__c=f=new TP(v,x),f.constructor=O,f.render=WP),b&&b.sub(f),f.props=v,f.state||(f.state={}),f.context=x,f.__n=r,p=!0,f.__g|=8,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&O.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=bP({},f.__s)),bP(f.__s,O.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&O.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&O.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),!(4&f.__g)&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,x)||t.__v==n.__v){for(t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),S=0;S<f._sb.length;S++)f.__h.push(f._sb[S]);f._sb=[],f.__h.length&&o.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=x,f.props=v,f.__P=e,f.__g&=-5,C=oP.__r,w=0,y){for(f.state=f.__s,f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),T=0;T<f._sb.length;T++)f.__h.push(f._sb[T]);f._sb=[]}else do f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(8&f.__g&&++w<25);f.state=f.__s,f.getChildContext!=null&&(r=bP({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),ee=d,d!=null&&d.type===wP&&d.key==null&&(ee=BP(d.props.children)),s=AP(e,vP(ee)?ee:[ee],t,n,r,i,a,o,s,c,l,u),t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__g&=-4)}catch(e){if(t.__v=null,c||a!=null){if(e.then){for(te=0,ne=!1,t.__u|=c?160:128,t.__c.__z=[],E=0;E<a.length;E++)(D=a[E])==null||ne||(D.nodeType==8&&D.data==`$s`?(te>0&&t.__c.__z.push(D),te++,a[E]=null):D.nodeType==8&&D.data==`/$s`?(--te>0&&t.__c.__z.push(D),ne=te===0,s=a[E],a[E]=null):te>0&&(t.__c.__z.push(D),a[E]=null));if(!ne){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(re=a.length;re--;)xP(a[re]);RP(t)}}else t.__e=n.__e,t.__k=n.__k,e.then||RP(t);oP.__e(e,t,n)}else s=t.__e=VP(n.__e,t,n,r,i,a,o,c,l,u);return(d=oP.diffed)&&d(t),128&t.__u?void 0:s}function RP(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(RP)}function zP(e,t,n){for(var r=0;r<n.length;r++)HP(n[r],n[++r],n[++r]);oP.__c&&oP.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){oP.__e(e,t.__v)}})}function BP(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:vP(e)?e.map(BP):bP({},e)}function VP(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v=n.props,y=t.props,b=t.type;if(b==`svg`?i=`http://www.w3.org/2000/svg`:b==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(u=0;u<a.length;u++)if((m=a[u])&&`setAttribute`in m==!!b&&(b?m.localName==b:m.nodeType==3)){e=m,a[u]=null;break}}if(e==null){if(b==null)return l.createTextNode(y);e=l.createElementNS(i,b,y.is&&y),s&&=(oP.__m&&oP.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=yP.call(e.childNodes),v=n.props||gP,!s&&a!=null)for(v={},u=0;u<e.attributes.length;u++)v[(m=e.attributes[u]).name]=m.value;for(u in v)if(m=v[u],u!=`children`){if(u==`dangerouslySetInnerHTML`)f=m;else if(!(u in y)){if(u==`value`&&`defaultValue`in y||u==`checked`&&`defaultChecked`in y)continue;FP(e,u,null,m,i)}}for(u in _=1&n.__u,y)m=y[u],u==`children`?p=m:u==`dangerouslySetInnerHTML`?d=m:u==`value`?h=m:u==`checked`?g=m:s&&typeof m!=`function`||v[u]===m&&!_||FP(e,u,m,v[u],i);if(d)s||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(f&&(e.innerHTML=``),AP(b==`template`?e.content:e,vP(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&EP(n,0),s,c,l),a!=null)for(u=a.length;u--;)xP(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||FP(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&FP(e,u,g,v[u],i))}return e}function HP(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){oP.__e(e,n)}}function UP(e,t,n){var r,i;if(oP.unmount&&oP.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||HP(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){oP.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&UP(r[i],t,n||typeof e.type!=`function`);n||xP(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function WP(e,t,n){return this.constructor(e,n)}function GP(e,t){var n,r,i,a;t==document&&(t=document.documentElement),oP.__&&oP.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=SP(wP,null,[e]),i=[],a=[],LP(t,e,r||gP,gP,t.namespaceURI,r?null:t.firstChild?yP.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),zP(i,e,a)}function KP(e,t){e.__u|=32,GP(e,t)}oP={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=8&i.__g),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=8&i.__g),o)return void(i.__g|=2)}catch(t){e=t}}throw uP=0,e}},sP=0,TP.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=bP({},this.state);typeof e==`function`&&(e=e(bP({},n),this.props)),e&&bP(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),OP(this))},TP.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),OP(this))},TP.prototype.render=wP,cP=[],uP=0,dP=function(e,t){return e.__v.__b-t.__v.__b},fP=/(PointerCapture)$|Capture$/i,pP=0,mP=IP(!1),hP=IP(!0);var qP=0;Array.isArray;function Q(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c&&typeof e!=`function`)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--qP,__i:-1,__u:0,__source:i,__self:a};return oP.vnode&&oP.vnode(l),l}var JP=16,YP=16,XP={};function ZP({name:e,remappedFrom:t,token:n,width:r,height:i,viewBox:a,label:o,alignCapitals:s=!1}){"use no memo";let c=`#${e.replace(/^#/,``)}`,{width:l,height:u,viewBox:d}=XP[e]??{width:JP,height:YP},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return Q(`svg`,{"data-icon-name":t??e,"data-icon-token":n,"data-align-capitals":s,...o==null?{"aria-hidden":!0}:{"aria-label":o,role:`img`},viewBox:m,width:f,height:p,children:Q(`use`,{href:c})})}var QP=e=>e!==void 0&&/\s/.test(e),$P=(e,t)=>{let n=t=>QP(e[t-1])||QP(e[t]);if(!n(t))return t;for(let r=1;r<e.length;r++){let i=t-r;if(i>0&&!n(i))return i;let a=t+r;if(a<e.length&&!n(a))return a}return t},eF=e=>$P(e,Math.ceil(e.length/2)),tF=e=>{if(e.length<2)return[e,``];let t=eF(e);return[e.slice(0,t),e.slice(t)]},nF=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:eF(e);return[e.slice(0,r),e.slice(r)]},rF=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`/`)+1,n=e.length-t>25,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},iF=(e,{splitIndex:t}={})=>{if(typeof t!=`number`){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}return[e.slice(0,t),e.slice(t)]},aF=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=e.length-t;return[e.slice(0,n),e.slice(n)]},oF=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=t;return[e.slice(0,n),e.slice(n)]};function sF({children:e,marker:t,variant:n=`default`}){"use no memo";return Q(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:Q(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?Q(`span`,{"data-truncate-fade":!0}):t})})}function cF(e){"use no memo";let{mode:t,children:n}=e;return Q(`div`,{children:[Q(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?Q(`span`,{children:n}):n}),Q(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?Q(`span`,{children:n}):n})]})}function lF({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=Q(cF,{mode:t,children:e},`content`),o=Q(sF,{marker:n,mode:t,variant:r},`marker`),s=Q(`div`,{"data-truncate-fill":!0},`fill`);return Q(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:Q(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function uF({children:e,...t}){"use no memo";return Q(lF,{mode:`truncate`,...t,children:e})}function dF({children:e,...t}){"use no memo";return Q(lF,{mode:`fruncate`,...t,children:e})}function fF({children:e,contents:t,priority:n=`end`,split:r=`center`,minimumLength:i=12,className:a,style:o,...s}){"use no memo";let c=null,l=null;if(Array.isArray(t)){if(t.length!==2)return console.error(`MiddleTruncate: contents must be an array of two items`),null;c=Q(uF,{...s,children:t[0]}),l=Q(dF,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return Q(`div`,{className:a,style:o});if(e.length<i)return Q(n===`end`?dF:uF,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=tF:r===`extension`?t=nF:r===`leaf-path`&&(t=rF);else if(typeof r==`number`)t=iF,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=aF:e===`first`&&(t=oF)}else typeof r==`function`&&(t=r);t??=tF;let[f,p]=t(e,{priority:n,variant:s.variant,splitIndex:typeof u==`number`?u:void 0,splitOffset:typeof d==`number`?d:void 0}),m=f.length>=p.length,h=n===`equal`&&!m,g=n===`equal`&&m,_={},v={};h&&(_.marker=``),g&&(v.marker=``),c=Q(uF,{...s,..._,children:f}),l=Q(dF,{...s,...v,children:p})}return Q(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[Q(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),Q(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var pF={endIndex:-1,startIndex:-1};function mF(e,t,n){return Math.min(Math.max(e,t),n)}function hF(e,t){return e<0||t<e?pF:{endIndex:t,startIndex:e}}function gF(e){return e.startIndex<0||e.endIndex<e.startIndex}function _F(e,t){return gF(e)?0:(e.endIndex-e.startIndex+1)*t}function vF(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function yF(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function bF(e){let t=new Map;return e.forEach((e,n)=>{if(e.kind!==`directory`||!e.isExpanded)return;let r=e.ancestorPaths.length,i=t.get(r);if(i==null){t.set(r,[n]);return}i.push(n)}),t}function xF(e,t){let n=0,r=e.length-1,i=-1;for(;n<=r;){let a=Math.floor((n+r)/2),o=e[a];if(o==null)break;if(o<=t){i=a,n=a+1;continue}r=a-1}return i}function SF(e){let t=new Map,n=[];for(let r=0;r<e.length;r+=1){let i=e[r];if(i==null)continue;let a=i.kind===`directory`&&i.isExpanded?[...i.ancestorPaths,i.path]:i.ancestorPaths,o=0;for(;o<n.length&&o<a.length&&n[o]===a[o];)o+=1;for(let e=n.length-1;e>=o;--e){let i=n[e];i!=null&&t.set(i,r-1)}n.length=o;for(let e=o;e<a.length;e+=1){let t=a[e];t!=null&&n.push(t)}}let r=e.length-1;for(let e of n)t.set(e,r);return t}function CF(e,t,n){if(e.length===0||t<=0)return[];let r=SF(e),i=bF(e),a=[];for(let r=0;r<e.length;r+=1){let o=i.get(r);if(o==null||o.length===0)break;let s=t+r*n,c=xF(o,Math.min(e.length-1,Math.floor(s/n))),l=null;for(;c>=0;){let t=o[c],n=t==null?null:e[t]??null;if(n!=null&&(r===0||n.ancestorPaths[r-1]===a[r-1]?.path)){l=n;break}--c}if(l==null)break;a.push(l)}return a.map((i,a)=>{let o=a*n,s=(r.get(i.path)??e.length-1)+1;if(s>=e.length)return{row:i,top:o};let c=s*n-t;return{row:i,top:Math.min(o,c-n)}}).filter(e=>e.top+n>0)}function wF(e,t){let n=t.totalRowCount??e.length,r=n*t.itemHeight,i=Math.max(0,t.viewportHeight),a=Math.max(0,Math.floor(t.overscan)),o=Math.max(0,r-i),s=mF(t.scrollTop,0,o),c=t.stickyRows??CF(e,s,t.itemHeight),l=c.reduce((e,n)=>Math.max(e,n.top+t.itemHeight),0),u=Math.min(r,s+l),d=Math.max(0,i-l),f=Math.max(0,r-u),p=vF(s,n,t.itemHeight),m=vF(u,n,t.itemHeight),h=l<=0||p<0||p>=n?-1:p,g=h===-1?-1:Math.min(n-1,m-1),_=h===-1||g<h?0:g-h+1,v=d<=0||m>=n?pF:hF(m,yF(u+d,n,t.itemHeight)),y=g+1,b=gF(v)?pF:hF(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=_F(b,t.itemHeight);return{occlusion:{firstOccludedIndex:h,lastOccludedIndex:g,occludedCount:_},physical:{itemHeight:t.itemHeight,maxScrollTop:o,overscan:a,scrollTop:s,totalHeight:r,totalRowCount:n,viewportHeight:i},projected:{contentHeight:f,paneHeight:d,paneTop:u},sticky:{height:l,rows:c},visible:v,window:{endIndex:b.endIndex,height:x,offsetTop:gF(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var TF={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},EF={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},DF=`Contains git status items`;function OF(e){return e.current?!0:(e.current=!0,!1)}function kF(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:i=0,viewportHeight:a}=e;if(n<0)return null;let o=Math.max(0,i),s=n*r,c=s+r;if(s<t+o){let e=Math.max(0,s-o);return e===t?null:e}if(c>t+a){let e=c-a;return e===t?null:e}return null}function AF(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return kF({currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:a,viewportHeight:s});if(n<0)return null;let c=Math.max(0,a),l=n*r,u=Math.max(0,s-c),d=i===`center`?c+Math.max(0,(u-r)/2):c,f=Math.max(0,o-s),p=Math.max(0,Math.min(l-d,f));return p===t?null:p}function jF(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,targetViewportOffset:i,totalHeight:a,viewportHeight:o}=e;if(n<0)return null;let s=Math.max(0,i),c=n*r,l=c+r,u=t+s,d=t+o;if(c>=u&&l<=d)return null;let f=Math.max(0,a-o),p=Math.max(0,Math.min(c-s,f));return p===t?null:p}function MF(e){if(e==null||!e.isConnected||e===document.body||e===document.documentElement)return!1;e.focus({preventScroll:!0});let t=e.getRootNode();return t instanceof ShadowRoot?t.activeElement===e:document.activeElement===e}function NF(e){let t=e.getRootNode();if(t instanceof ShadowRoot){let e=t.activeElement;return e instanceof HTMLElement?e:null}let n=document.activeElement;return n instanceof HTMLElement&&e.contains(n)?n:null}function PF(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function FF(e,t){return e!=null&&e>0?e:t}function IF(e){let t=e.borderBoxSize,n=Array.isArray(t)?t[0]:t;return n!=null&&Number.isFinite(n.blockSize)&&n.blockSize>0?n.blockSize:e.contentRect.height>0?e.contentRect.height:null}function LF(e,t,n,r,i=0){let a=kF({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a!=null&&(e.scrollTop=a,!0)}function RF(e,t,n,r,i,a,o=0){let s=AF({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s!=null&&(e.scrollTop=s,!0)}function zF(e,t,n,r,i,a){let o=jF({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o!=null&&(e.scrollTop=o,!0)}function BF(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function VF(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function HF({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return Q(`input`,{ref:n,"data-item-rename-input":!0,...t?{"data-item-flattened-rename-input":!0}:{},"aria-label":e,value:r,onBlur:i,onInput:a,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation()})}function UF(e){let{row:t,mode:n,targetPath:r,ariaLabel:i,domId:a,isParked:o,itemHeight:s,features:c,state:l,extraStyle:u}=e,d=n===`sticky`,f=t.ancestorPaths.at(-1)??``,p={};return l.isFocusRinged&&(p[`data-item-focused`]=!0),t.isSelected&&(p[`data-item-selected`]=!0),l.isContextHovered&&(p[`data-item-context-hover`]=`true`),l.isDragTarget&&(p[`data-item-drag-target`]=!0),l.isDragging&&(p[`data-item-dragging`]=!0),l.effectiveGitStatus!=null&&(p[`data-item-git-status`]=l.effectiveGitStatus),l.containsGitChange&&(p[`data-item-contains-git-change`]=`true`),{"aria-expanded":!d&&t.kind===`directory`?t.isExpanded:void 0,"aria-haspopup":c.contextMenuEnabled?`menu`:void 0,"aria-label":i,"aria-level":d?void 0:t.level+1,"aria-posinset":d?void 0:t.posInSet+1,"aria-selected":d?void 0:t.isSelected?`true`:`false`,"aria-setsize":d?void 0:t.setSize,"data-file-tree-sticky-path":d?r:void 0,"data-file-tree-sticky-row":d?`true`:void 0,"data-item-context-menu-button-visibility":c.actionLaneEnabled?c.contextMenuButtonVisibility:void 0,"data-item-context-menu-trigger-mode":c.contextMenuEnabled?c.contextMenuTriggerMode:void 0,"data-item-has-context-menu-action-lane":c.actionLaneEnabled?`true`:void 0,"data-item-has-git-lane":c.gitLaneActive?`true`:void 0,"data-item-parent-path":f.length>0?f:void 0,"data-item-parked":o?`true`:void 0,"data-item-path":r,"data-item-type":t.kind===`directory`?`folder`:`file`,"data-type":`item`,id:d?void 0:a,role:d?void 0:`treeitem`,style:{minHeight:`${s}px`,...u},tabIndex:!d&&t.isFocused?0:-1,...p}}function WF(e){let{event:t,mode:n,isSearchOpen:r,isDirectory:i}=e,a=t.ctrlKey||t.metaKey,o=t.shiftKey||a,s=t.shiftKey?{additive:a,kind:`range`}:a?{kind:`toggle`}:{kind:`single`};return{closeSearch:r,revealCanonical:n===`sticky`,selection:s,toggleDirectory:!o&&i}}var GF,KF,qF,JF,YF=Object.is,XF=0,ZF=[],QF=oP,$F=QF.__b,eI=QF.__r,tI=QF.diffed,nI=QF.__c,rI=QF.unmount,iI=QF.__;function aI(e,t){QF.__h&&QF.__h(KF,e,XF||t),XF=0;var n=KF.__H||(KF.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function oI(e){return XF=1,sI(vI,e)}function sI(e,t,n){var r=aI(GF++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):vI(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);YF(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=KF,!KF.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,YF(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};KF.__f=!0;var a=KF.shouldComponentUpdate,o=KF.componentWillUpdate;KF.componentWillUpdate=function(e,t,n){if(4&this.__g){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},KF.shouldComponentUpdate=i}return r.__N||r.__}function cI(e,t){var n=aI(GF++,3);!QF.__s&&_I(n.__H,t)&&(n.__=e,n.u=t,KF.__H.__h.push(n))}function lI(e,t){var n=aI(GF++,4);!QF.__s&&_I(n.__H,t)&&(n.__=e,n.u=t,KF.__h.push(n))}function $(e){return XF=5,uI(function(){return{current:e}},[])}function uI(e,t){var n=aI(GF++,7);return _I(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function dI(e,t){return XF=8,uI(function(){return e},t)}function fI(){for(var e;e=ZF.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(hI),e.__H.__h.forEach(gI),e.__H.__h=[]}catch(t){e.__H.__h=[],QF.__e(t,e.__v)}}QF.__b=function(e){KF=null,$F&&$F(e)},QF.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),iI&&iI(e,t)},QF.__r=function(e){eI&&eI(e),GF=0;var t=(KF=e.__c).__H;t&&(qF===KF?(t.__h=[],KF.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(hI),t.__h.forEach(gI),t.__h=[],GF=0)),qF=KF},QF.diffed=function(e){tI&&tI(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(ZF.push(t)!==1&&JF===QF.requestAnimationFrame||((JF=QF.requestAnimationFrame)||mI)(fI)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),qF=KF=null},QF.__c=function(e,t){t.some(function(e){try{e.__h.forEach(hI),e.__h=e.__h.filter(function(e){return!e.__||gI(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],QF.__e(n,e.__v)}}),nI&&nI(e,t)},QF.unmount=function(e){rI&&rI(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{hI(e)}catch(e){t=e}}),n.__H=void 0,t&&QF.__e(t,n.__v))};var pI=typeof requestAnimationFrame==`function`;function mI(e){var t,n=function(){clearTimeout(r),pI&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);pI&&(t=requestAnimationFrame(n))}function hI(e){var t=KF,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),KF=t}function gI(e){var t=KF;e.__c=e.__(),KF=t}function _I(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!YF(t,e[n])})}function vI(e,t){return typeof t==`function`?t(e):t}function yI(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:Q(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return Q(wP,{children:[Q(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:Q(uF,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function bI(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function xI(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function SI(e,t,n,r){return e.map((e,i)=>{let a=i*n,o=e.subtreeEndIndex+1;if(o>=r)return{row:e.row,top:a};let s=o*n-t;return{row:e.row,top:Math.min(a,s-n)}}).filter(e=>e.top+n>0)}function CI({controller:e,itemHeight:t,overscan:n,scrollTop:r,stickyFolders:i,viewportHeight:a}){let o=e.getVisibleCount(),s=i&&o>0?e.getStickyRowCandidates(r,t):[],c=s==null&&i&&o>0?e.getVisibleRows(0,o-1):[],l=wF(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:SI(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?SI(u,1,t,o):i&&r<=0&&c.length>0?CF(c,1,t):l.sticky.rows;return{overlayHeight:d.reduce((e,n)=>Math.max(e,n.top+t),0),overlayRows:d,snapshot:l,visibleRows:c}}var wI=400,TI=40,EI=18;function DI(e,t,n){let r=e,i=document.elementFromPoint?.bind(document)??null,a=r.elementFromPoint?.(t,n)??i?.(t,n)??null;return e instanceof ShadowRoot&&(a==null||!e.contains(a))?OI(e,t,n):a instanceof HTMLElement?a:null}function OI(e,t,n){let r=Array.from(e.querySelectorAll(`[data-type="item"], [data-item-flattened-subitem]`));for(let e=r.length-1;e>=0;e--){let i=r[e],a=i.getBoundingClientRect();if(t>=a.left&&t<=a.right&&n>=a.top&&n<=a.bottom)return i}return null}function kI(e){let t=e?.closest?.(`[data-type="item"]`);if(!(t instanceof HTMLElement))return null;let n=t.dataset.itemPath??null;if(n==null)return null;let r=e?.closest?.(`[data-item-flattened-subitem]`),i=r instanceof HTMLElement?r.getAttribute(`data-item-flattened-subitem`)??null:null;if(i!=null&&i.endsWith(`/`))return{directoryPath:i,flattenedSegmentPath:i,hoveredPath:n,kind:`directory`};if(t.dataset.itemType===`folder`)return{directoryPath:n,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`};let a=t.dataset.itemParentPath??null;return a==null||a.length===0?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:n,kind:`root`}:{directoryPath:a,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`}}function AI(e){let t=e.cloneNode(!0);return t.removeAttribute(`id`),t.dataset.fileTreeDragPreview=`true`,t.setAttribute(`aria-hidden`,`true`),t.tabIndex=-1,Object.assign(t.style,{boxShadow:`0 4px 12px rgba(0, 0, 0, 0.15)`,left:`0px`,margin:`0`,pointerEvents:`none`,position:`fixed`,top:`0px`,willChange:`transform`,zIndex:`10000`}),t}function jI(){return navigator.vendor!==`Apple Computer, Inc.`}function MI(e,t){let n=e-t.top;if(n<TI)return-Math.ceil((TI-Math.max(0,n))/TI*EI);let r=t.bottom-e;return r<TI?Math.ceil((TI-Math.max(0,r))/TI*EI):0}function NI(e,t){if(e!=null){let t=TF[e];return t==null?null:{text:t,title:EF[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:DF}:null}function PI(e,t,n){if(t==null||t.size===0)return null;let r=[];for(let i=e.length-1;i>=0;--i){let a=e[i],o=n.get(a);if(o!=null){for(let e of r)n.set(e,o);return o?`ignored`:null}if(t.has(a)){n.set(a,!0);for(let e of r)n.set(e,!0);return`ignored`}r.push(a)}for(let e of r)n.set(e,!1);return null}function FI(e){return e!=null&&`toggle`in e}function II(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function LI(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function RI(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function zI(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function BI(e,t){return t&&zI(e)||(e.ctrlKey||e.metaKey)&&II(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var VI=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function HI(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&(t.dataset.fileTreeContextMenuRoot===`true`||t.dataset.type===`context-menu-anchor`||t.dataset.type===`context-menu-trigger`||t.getAttribute(`slot`)===`context-menu`))return!0;return!1}function UI(e){return{bottom:e.bottom,height:e.height,left:e.left,right:e.right,top:e.top,width:e.width,x:e.x,y:e.y}}function WI(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function GI(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function KI(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function qI(e,t,n){if(e==null)return null;let r=t.get(e)??null;if(r!=null)return r;let i=n.get(e)??null;return i?.dataset.itemParked===`true`?null:i}function JI(e){if(e==null)return[];let t=[];for(let n of e.querySelectorAll(`button[data-file-tree-sticky-row="true"]`)){if(!(n instanceof HTMLElement))continue;let e=n.dataset.fileTreeStickyPath;e!=null&&t.push(e)}return t}function YI(e,t){if(e==null||t==null)return null;for(let n of e.querySelectorAll(`button[data-item-focused="true"][data-item-parked="true"]`))if(n instanceof HTMLElement&&n.dataset.itemPath===t)return n;return null}function XI(e,t,n,r,i,a,o){let s=Math.max(0,a-i),c=t?.getBoundingClientRect()??null,l=c==null||n==null?null:n.getBoundingClientRect().top-c.top,u=YI(e,r),d=c==null||u==null?null:u.getBoundingClientRect().top-c.top;return Math.max(0,Math.min(d??Math.max(l??0,s),Math.max(0,o-i)))}function ZI(e,t){return{kind:e.kind,name:xI(e),path:t}}function QI(e){return e==null?void 0:`${e}__tree`}function $I(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function eL(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function tL(e,t){if(e==null)return null;if(`text`in e)return e.parts==null?Q(`span`,{title:e.title,children:e.text}):Q(`span`,{title:e.title,children:e.parts.map((e,t)=>Q(`span`,{style:{color:e.color},children:e.text},t))});let n=typeof e.icon==`string`?eL(e.icon)?t(e.icon):{name:e.icon}:eL(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return Q(`span`,{title:e.title,children:Q(ZP,{...n})})}function nL(e){e!=null&&MF(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function rL(e,t,{actionLaneEnabled:n=!1,customDecoration:r=null,decorationLaneEnabled:i=!1,dragTargetFlattenedSegmentPath:a=null,gitDecoration:o=null,gitLaneActive:s=!1,renameInput:c=null,showDecorativeActionAffordance:l=!1}={}){let u=bI(e);return Q(wP,{children:[e.depth>0?Q(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>Q(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,Q(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?Q(ZP,{...t(`file-tree-icon-chevron`)}):Q(ZP,{...t(`file-tree-icon-file`,u)})}),Q(`div`,{"data-item-section":`content`,children:e.isFlattened?yI(e,c,a):c??Q(fF,{minimumLength:5,split:`extension`,children:e.name})}),i?Q(`div`,{"data-item-section":`decoration`,children:r==null?null:tL(r,t)}):null,s?Q(`div`,{"data-item-section":`git`,children:tL(o,t)}):null,n?Q(`div`,{"data-item-section":`action`,children:l?Q(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:Q(ZP,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function iL(e,t,n,r={}){let{controller:i,renameView:a,visualFocusPath:o,contextHoverPath:s,draggedPathSet:c,dragTarget:l,dragAndDropEnabled:u,shouldSuppressContextMenu:d,handleRowDragStart:f,handleRowDragEnd:p,handleRowTouchStart:m,instanceId:h,itemHeight:g,gitStatusByPath:_,ignoredGitDirectories:v,ignoredInheritanceCache:y,directoriesWithGitChanges:b,gitLaneActive:x,contextMenuEnabled:S,contextMenuTriggerMode:C,contextMenuButtonTriggerEnabled:w,contextMenuButtonVisibility:T,contextMenuRightClickEnabled:ee,registerRenameInput:te,registerButton:ne,resolveIcon:E,renderDecorationForRow:D,openContextMenuForRow:re,onRowClick:O,onKeyDown:k}=e,A=bI(t),{isParked:j=!1,mode:ie=`flow`,style:ae}=r,oe=ie===`sticky`,se=_?.get(A)??null??PI(t.ancestorPaths,v,y),ce=t.kind===`directory`&&(b?.has(A)??!1),le=D(t,A),ue=NI(se,ce),M=S&&w,N=le!=null||x||M,P=M&&T===`always`,de=a.getPath()===A,fe=de?a.getValue():``,pe=oe||!de?null:Q(HF,{ref:te,ariaLabel:`Rename ${xI(t)}`,isFlattened:t.isFlattened,value:fe,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),me=rL(t,E,{actionLaneEnabled:M,customDecoration:le,decorationLaneEnabled:N,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:ue,gitLaneActive:x,renameInput:pe,showDecorativeActionAffordance:P}),F={...UF({ariaLabel:xI(t),domId:t.isFocused?$I(h,A,j):void 0,extraStyle:ae,features:{actionLaneEnabled:M,contextMenuButtonVisibility:M?T:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:j,itemHeight:g,mode:ie,row:t,state:{containsGitChange:ce,effectiveGitStatus:se,isContextHovered:s===A,isDragTarget:l?.kind===`directory`&&l.directoryPath===A,isDragging:c?.has(A)===!0,isFocusRinged:t.isFocused&&o===A},targetPath:A}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),ee&&(i.focusMountedPathFromInput(A),re(t,A,{anchorRect:WI(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:oe?void 0:()=>{i.focusMountedPathFromInput(A)},onKeyDown:oe?void 0:k,ref:e=>{ne(A,e)}};return!oe&&de?Q(`div`,{...F,children:me}):Q(`button`,{...F,type:`button`,draggable:u&&!j,onDragEnd:u&&!j?p:void 0,onDragStart:u&&!j?e=>{f(e,t,A)}:void 0,onMouseDown:e=>{if(oe){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!j?e=>{m(e,t,A)}:void 0,onClick:e=>{O(e,t,A,ie)},children:me})}function aL(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(bI(e))).map((n,r)=>iL(e,n,t.start+r))}function oL({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=uk,overscan:c=10,renamingEnabled:l=!1,renderRowDecoration:u,searchBlurBehavior:d=`close`,searchEnabled:f=!1,searchFakeFocus:p=!1,slotHost:m,stickyFolders:h=!1,initialViewportHeight:g=420}){"use no memo";let _=$(null),v=$(null),y=$(!1),b=$(null),x=$(null),S=$(null),C=$(null),w=$(null),T=$(new Map),ee=$(new Map),te=$(()=>{}),ne=$(null),E=$(0),D=$(!1),re=$(null);re.current!==t&&(D.current=!1,re.current=t);let O=$(!1),k=$(null),A=$(null),j=$(!1),ie=$(null),ae=$(null),oe=$(null),se=$(null),ce=$(null),le=$(null),ue=$(null),M=$(null),N=$(!1),P=$(null),de=$(null),fe=$(null),pe=$(null),me=uI(()=>new Map,[]),[,F]=oI(0),he=$(!1),[ge,_e]=oI(null),[ve,ye]=oI(null),[be,xe]=oI(null),[Se,Ce]=oI(null),[we,Te]=oI(0),[I,Ee]=oI(null),De=$(I);De.current=I;let Oe=$(null),ke=$(null),Ae=$(null),je=$(null),Me=$(null),Ne=$(!1),Pe=()=>{ke.current=null,Ae.current=null,je.current=null},Fe=(e,t)=>{ke.current=e,Ae.current=null,je.current=t==null?null:{path:e,scrollTop:t}},Ie=(e,t)=>{ke.current=null,Ae.current={path:e,viewportOffset:t},je.current=null},Le=$(d===`retain`&&t.isSearchOpen()),[Re,ze]=oI(p);cI(()=>{p||ze(!1)},[p]);let Be=$(!1),Ve=dI(()=>{Be.current=!0,ze(e=>e&&!1)},[]),[He,Ue]=oI(()=>CI({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[We,Ge]=oI(!1);cI(()=>{Ge(!0)},[]);let Ke=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,qe=e?.contextMenu?.triggerMode??(Ke?`right-click`:`both`),Je=qe===`both`||qe===`button`,Ye=e?.contextMenu?.buttonVisibility??`when-needed`,Xe=qe===`both`||qe===`right-click`;lI(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;Me.current=t,ye(t),Ce(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(Ne.current=e.detail?.disabled===!0)};return e.addEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.addEventListener(`file-tree-debug-set-scroll-suppression`,n),()=>{e.removeEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.removeEventListener(`file-tree-debug-set-scroll-suppression`,n)}},[]);let Ze=dI((e,t)=>{KI(T.current,e,t)},[]),Qe=dI((e,t)=>{KI(ee.current,e,t)},[]),$e=dI(e=>{x.current=e},[]),et=dI(e=>qI(e,ee.current,T.current),[]),tt=n!=null||r!=null||i!=null,{resolveIcon:nt}=uI(()=>aP(a),[a]),rt=t[FN](),it=rt.getPath(),at=it!=null,ot=t.isSearchOpen(),st=t.getSearchValue(),L=t.getFocusedPath(),R=t.getFocusedIndex(),ct=t.getScrollRequest(),lt=t.isDragAndDropEnabled(),ut=t.getDragSession(),dt=uI(()=>ut==null?null:new Set(ut.draggedPaths),[ut]),ft=ut?.target??null,pt=ut?.primaryPath??null,mt=QI(o),{overlayHeight:ht,overlayRows:gt,snapshot:_t,visibleRows:vt}=He,yt=_t.physical.viewportHeight,bt=uI(()=>({end:_t.window.endIndex,start:_t.window.startIndex}),[_t.window.endIndex,_t.window.startIndex]),xt=gt,St=_t.sticky.rows,Ct=_t.physical.totalHeight,wt=_t.sticky.height,Tt=uI(()=>new Set(St.map(e=>bI(e.row))),[St]),Et=R>=0&&R>=bt.start&&R<=bt.end,Dt=dI((e,t)=>u?.({item:ZI(e,t),row:e})??null,[u]),Ot=dI(e=>MF(e==null?null:T.current.get(e)??null)?!0:MF(S.current),[]),kt=dI(e=>{Ot(t.focusNearestPath(e))},[t,Ot]),At=$(kt);At.current=kt;let jt=$(!0),Mt=$(()=>{}),Nt=dI((t=!0)=>{let n=De.current;n!=null&&(jt.current=jt.current&&t,Ee(null),e?.contextMenu?.onClose?.(),jt.current&&kt(n.path))},[e?.contextMenu,kt]);Mt.current=Nt;let Pt=dI(e=>{let t=e==null?null:GI(S.current,e);xe(e=>e===t?e:t)},[]),Ft=dI((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=et(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;Fe(n,e?.scrollTop??null),O.current=!0,_e(e=>e===n?e:n)}i.focus(),Pt(a),jt.current=!0,Ee({anchorRect:r?.anchorRect??null,item:ZI(e,n),path:n,source:r?.source??`keyboard`})},[t,et,Pt]),It=dI(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=PF(e,yt);ie.current=R<0||e==null?null:Math.max(0,Math.min(R*s-e.scrollTop,Math.max(0,t-s))),j.current=!0}t.startRenaming(e)!==!1&&(Ce(`focus`),F(e=>e+1))}},[t,R,s,l,yt]),Lt=dI((e,{restoreTreeFocus:n=!0,targetOffset:r=`live-overlay`}={})=>{let i=C.current;if(i==null)return!1;t.focusPath(e);let a=t.getFocusedIndex();if(a<0)return!1;let o=t.getVisibleRows(a,a)[0]??null;if(o==null)return!1;let l=PF(i,yt),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:CI({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return O.current=!0,zF(i,a,s,l,u,d),te.current(),Oe.current=n?e:null,!0},[t,s,c,yt,h]),Rt=()=>y.current===!0||pe.current!=null||N.current===!0,zt=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Bt=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},Vt=()=>{se.current!=null&&(clearTimeout(se.current),se.current=null),oe.current=null},Ht=()=>{le.current?.remove(),le.current=null},Ut=()=>{Bt(ae.current),ae.current=null,ce.current=null},Wt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Gt=()=>{M.current?.(),M.current=null,pe.current!=null&&(clearTimeout(pe.current),pe.current=null),N.current=!1,P.current=null,fe.current=null,de.current!=null&&(de.current.setAttribute(`draggable`,`true`),de.current.style.removeProperty(`touch-action`),de.current=null),Ht(),Vt(),Ut(),ue.current=null},Kt=(e,n)=>{let r=S.current?.getRootNode(),i=kI(DI(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},qt=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){Vt();return}let r=t.getItem(e.directoryPath),i=FI(r)?r:null;if(i==null||i.isExpanded()){Vt();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;oe.current!==a&&(Vt(),oe.current=a,se.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind===`directory`&&n.directoryPath===e.directoryPath&&n.flattenedSegmentPath===e.flattenedSegmentPath&&i.expand()},n))},Jt=()=>{ae.current=null;let e=ce.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=MI(e.clientY,r);if(i===0)return;let a=Math.max(0,n.scrollHeight-n.clientHeight),o=Math.max(0,Math.min(a,n.scrollTop+i));o!==n.scrollTop&&(n.scrollTop=o,te.current()),qt(Kt(e.clientX,e.clientY)),ae.current=zt(Jt)},z=(e,t)=>{ce.current={clientX:e,clientY:t},ae.current??=zt(Jt)},Yt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Gt(),Ht(),Vt(),Ut(),t.startDrag(r)===!1){e.preventDefault();return}if(ue.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),jI())){let t=AI(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),Wt(t),le.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},Xt=()=>{Ht(),Vt(),Ut(),ue.current=null,t.cancelDrag()},Zt=(e,n,r)=>{if(pe.current!=null||N.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;fe.current={clientX:i.clientX,clientY:i.clientY},de.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!N.current;pe.current!=null&&(clearTimeout(pe.current),pe.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),M.current===o&&(M.current=null),t&&(a.setAttribute(`draggable`,`true`),de.current===a&&(de.current=null),fe.current=null)},s=e=>{let t=e.touches[0],n=fe.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=100||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),M.current=o,pe.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),de.current===a&&(de.current=null),fe.current=null;return}N.current=!0,de.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),ue.current=n;let e=a.getBoundingClientRect(),s=AI(a);Object.assign(s.style,{height:`${e.height}px`,opacity:`0.85`,transform:`translate3d(${e.left}px, ${e.top}px, 0)`,width:`${e.width}px`}),Wt(s),le.current=s,P.current={x:i.clientX-e.left,y:i.clientY-e.top};let c=e=>{let t=e.touches[0];if(t==null)return;e.preventDefault();let n=P.current;n!=null&&le.current!=null&&(le.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),qt(Kt(t.clientX,t.clientY)),z(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&Kt(n.clientX,n.clientY),t.completeDrag(),Gt()},u=()=>{t.cancelDrag(),Gt()};M.current=()=>{document.removeEventListener(`touchmove`,c),document.removeEventListener(`touchend`,l),document.removeEventListener(`touchcancel`,u)},document.addEventListener(`touchmove`,c,{passive:!1}),document.addEventListener(`touchend`,l),document.addEventListener(`touchcancel`,u)},wI)},Qt=e=>{if(I!=null){if(e.key===`Escape`){Nt(),e.preventDefault(),e.stopPropagation();return}VI.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(rt.isActive()){if(e.isComposing||e.keyCode===229)return;if(e.key===`Escape`)rt.cancel();else if(e.key===`Enter`)rt.commit();else return;Ce(`focus`),F(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){It(L??void 0),e.preventDefault(),e.stopPropagation();return}if(ot){if(e.key===`Escape`)j.current=!1,ie.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=PF(n,yt);ie.current=R<0||n==null?null:Math.max(0,Math.min(R*s-n.scrollTop,Math.max(0,r-s))),j.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;Ce(`focus`),F(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&LI(e)){t.openSearch(e.key),F(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Ke&&zI(e),r=BI(e,Ke),i=r&&S.current!=null?NF(S.current):null,a=r?new Set(JI(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==L&&a.has(o)){let e=C.current;Fe(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=FI(p)?p:null,h=u!=null&&(Tt.has(u)||c&&o===u&&a.has(u)),g=e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`ArrowRight`&&m!=null&&m.isExpanded(),_=e.key===`ArrowLeft`&&h&&m!=null&&m.isExpanded(),v=C.current,y=!0;if(e.shiftKey&&e.key===`ArrowDown`)t.extendSelectionFromFocused(1);else if(e.shiftKey&&e.key===`ArrowUp`)t.extendSelectionFromFocused(-1);else if(n&&u!=null&&d>=0){let e=t.getVisibleRows(d,d)[0]??null,n=qI(u,ee.current,T.current);e==null||n==null?y=!1:Ft(e,u)}else if((e.ctrlKey||e.metaKey)&&II(e))t.toggleFocusedSelection();else if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`a`)t.selectAllVisiblePaths();else switch(e.key){case`ArrowDown`:t.focusNextItem();break;case`ArrowUp`:t.focusPreviousItem();break;case`ArrowRight`:m==null||m.isExpanded()?t.focusNextItem():m.expand();break;case`ArrowLeft`:m!=null&&m.isExpanded()?m.collapse():t.focusParentItem();break;case`Home`:t.focusFirstItem();break;case`End`:t.focusLastItem();break;default:y=!1}if(!y)return;Ce(`focus`);let b=t.getFocusedPath(),x=b!=null&&(Tt.has(b)||a.has(b)),w=g&&b!==u,te=n&&c&&o===u&&b===u;if((h||te)&&b!=null&&(w&&x||te))Fe(b,v?.scrollTop??null),O.current=!0,_e(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(Ie(b,XI(S.current,v,i,u,s,wt,yt)),O.current=!0,_e(e=>e===b?e:b)):Pe()}F(e=>e+1),e.preventDefault(),e.stopPropagation()};lI(()=>{if(!(!f||!ot)){if(Le.current){Le.current=!1;return}MF(w.current)}},[ot,f]),lI(()=>{let e=x.current;switch(VF({hasRenderedInput:e!=null,previousRenamingPath:A.current,renamingPath:it})){case`reset`:A.current=null;return;case`reveal-canonical`:it!=null&&Lt(it,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(Oe.current=null,A.current=it,MF(e),e.select());return}},[bt.end,bt.start,it,Lt,Tt]),lI(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=NF(e)?.dataset.itemPath??null;_e(e=>e===t?e:t)},i=()=>{n(),O.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,NF(e)!=null){r();return}O.current=!1,_e(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),O.current=!1,_e(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;_e(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),lI(()=>{let e=S.current;e!=null&&(_t.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[_t.physical.scrollTop]),lI(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;ne.current=PF(n,g);let a=()=>{let e=t.getVisibleCount(),r=FF(ne.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),Ue(CI({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};if(!D.current){D.current=!0;let e=t.getFocusedIndex();if(e>=0){let r=FF(ne.current,g),i=t.getVisibleRows(e,e)[0]??null;LF(n,e,s,r,h&&i!=null?Math.max(0,Math.min(i.ancestorPaths.length*s,Math.max(0,r-s))):0)}}te.current=a;let o=t.subscribe(()=>{OF(he)&&F(e=>e+1),a()}),l=()=>{Ne.current!==!0&&(r!=null&&(r.dataset.isScrolling??=``),i!=null&&(i.dataset.isScrolling??=``),y.current=!0,e!=null&&clearTimeout(e),e=setTimeout(()=>{r!=null&&delete r.dataset.isScrolling,i!=null&&delete i.dataset.isScrolling,y.current=!1,Te(e=>e+1),e=null},50))},u=null,d=()=>{i!=null&&delete i.dataset.overlayReveal,u!=null&&(clearTimeout(u),u=null)},f=()=>{i!=null&&Ne.current!==!0&&(n.scrollTop>0||(i.dataset.overlayReveal=`true`,u!=null&&clearTimeout(u),u=setTimeout(()=>{d()},200)))},p=()=>{if(a(),n.scrollTop>0&&d(),De.current!=null&&y.current&&Mt.current(),Ne.current===!0){y.current=!1;return}ye(e=>e==null?e:null),l()},m=()=>{l(),f()},_=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Spacebar`]),v=e=>{_.has(e.key)&&m()};n.addEventListener(`scroll`,p,{passive:!0}),n.addEventListener(`wheel`,m,{passive:!0}),n.addEventListener(`touchmove`,m,{passive:!0}),n.addEventListener(`keydown`,v);let x=typeof ResizeObserver<`u`?new ResizeObserver(e=>{ne.current=(e[0]==null?null:IF(e[0]))??PF(n,g),a()}):null;return x?.observe(n),()=>{te.current=()=>{},o(),n.removeEventListener(`scroll`,p),n.removeEventListener(`wheel`,m),n.removeEventListener(`touchmove`,m),n.removeEventListener(`keydown`,v),e!=null&&clearTimeout(e),u!=null&&clearTimeout(u),r!=null&&delete r.dataset.isScrolling,i!=null&&(delete i.dataset.isScrolling,delete i.dataset.overlayReveal),y.current=!1,ne.current=null,x?.disconnect()}},[t,g,s,c,h]),lI(()=>{Ke||I==null||Nt(!1)},[Nt,Ke,I]);let $t=uI(()=>I==null?null:`${I.path}::${I.source}`,[I]);lI(()=>{if($t==null){m?.clearSlotContent(zD);return}let t=De.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??UI(n.getBoundingClientRect()),close:e=>{Mt.current(e?.restoreFocus??!0)},restoreFocus:()=>{jt.current&&At.current(De.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(zD,i),e?.contextMenu?.onOpen?.(t.item,r),nL(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&nL(i)}),()=>{m?.clearSlotContent(zD)}},[$t,e?.contextMenu,m]),lI(()=>{I!=null&&t.getItem(I.path)==null&&Nt()},[Nt,I,t]),lI(()=>{if(I==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(HI(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&Nt())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),Nt())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[Nt,I]),lI(()=>{let e=C.current,n=S.current;if(e==null||n==null){k.current=L;return}let r=L==null?null:T.current.get(L)??null,i=NF(n),a=i?.dataset.itemPath??null,o=at&&x.current===i,c=f&&w.current===i,l=j.current&&!ot,u=ie.current??0,d=Oe.current,p=ke.current,m=Ae.current,g=je.current,_=i!=null,v=O.current||_,y=k.current!==L,b=p!=null&&p===L&&L!=null,ee=!1,ne=!1;if(ct!=null&&ct.id!==E.current){E.current=ct.id;let n=ct.visibleIndex,r=t.getVisibleRows(n,n)[0]??null;if(r!=null){let t=h?Math.max(0,Math.min(r.ancestorPaths.length*s,Math.max(0,yt-s))):wt;ee=!0,ne=RF(e,n,s,yt,Ct,ct.offset,t)}t.clearScrollRequest(ct.id)}let D=!ee&&l&&zF(e,R,s,yt,Ct,u),re=!ee&&d!=null&&d===L&&zF(e,R,s,yt,Ct,wt),A=!ee&&m!=null&&m.path===L&&zF(e,R,s,yt,Ct,m.viewportOffset),ae=!ee&&g!=null&&g.path===L&&e.scrollTop!==g.scrollTop;if(ae&&(e.scrollTop=g.scrollTop),(ae||ne||re||A||D||v&&y&&d!==L&&!b&&LF(e,R,s,yt,wt))&&te.current(),ee){k.current=L;return}if(!v){k.current=L;return}if(o){k.current=L;return}if(c&&!l){k.current=L;return}if(r==null){l&&R>=0&&(zF(e,R,s,yt,Ct,u),te.current()),k.current=L;return}(y||l||d===L||p===L||m?.path===L||g?.path===L||a==null||a!==L)&&(MF(r),d===L&&(Oe.current=null),p===L&&(ke.current=null),m?.path===L&&(Ae.current=null),g?.path===L&&(je.current=null),j.current=!1,ie.current=null),k.current=L},[t,R,L,Et,s,at,ot,bt,yt,f,ct,h,wt,Ct,vt]);let en=R>=0&&R>=_t.visible.startIndex&&R<=_t.visible.endIndex,tn=L!=null&&xt.some(e=>bI(e.row)===L),nn=en||tn,rn=Je&&O.current===!0&&nn?L:null,an=Se===`pointer`?ve:null,on=I?.path??Me.current??an??rn??ve,sn=I?.source===`right-click`;lI(()=>{y.current&&I==null||Pt(et(on))},[I,et,bt,yt,we,xt,on,Pt,vt]);let cn=dI(e=>{if(y.current||HI(e))return;let t=e.target;if(!(t instanceof HTMLElement)||t.closest?.(`[data-type="context-menu-trigger"]`)!=null)return;let n=t.closest?.(`[data-file-tree-sticky-row="true"]`),r=t.closest?.(`[data-type="item"]`),i=n instanceof HTMLElement?n.dataset.fileTreeStickyPath??null:r instanceof HTMLElement?r.dataset.itemPath??null:null;i!=null&&Ce(e=>e===`pointer`?e:`pointer`),ye(e=>e===i?e:i)},[]),ln=dI(()=>{ye(null)},[]);lI(()=>{if(!lt)return;let e=()=>{Gt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Gt(),t.cancelDrag()}},[t,lt]);let un=e=>{if(!lt||t.getDragSession()==null||N.current)return;let n=kI(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),qt(t.getDragSession()?.target??null),z(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},dn=e=>{if(!lt||t.getDragSession()==null||N.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(Vt(),Ut(),t.setDragTarget(null))},fn=e=>{!lt||t.getDragSession()==null||N.current||(e.preventDefault(),Kt(e.clientX,e.clientY),t.completeDrag(),Ht(),Vt(),Ut(),ue.current=null)},pn=_t.window.height,mn=_t.window.offsetTop,hn=Math.min(0,yt-pn),gn=Math.min(0,yt-pn-wt),_n=ge===L||j.current,vn=L!=null&&_n&&!Et&&R>=0?vt[R]??t.getVisibleRows(R,R)[0]??null:null,yn=vn==null?null:BF(R,s,bt,pn),bn=ue.current,xn=pt!=null&&bn!=null&&bn.path===pt&&bn.index>=bt.start&&bn.index<=bt.end,Sn=pt!=null&&bn!=null&&bn.path===pt&&!xn&&bn.path!==vn?.path?bn:null,Cn=Sn==null?null:BF(Sn.index,s,bt,pn),wn=RI((R>=0?vt[R]??t.getVisibleRows(R,R)[0]??null:null)?.ancestorPaths.at(-1)??null),Tn=ot&&L!=null?$I(o,L,!Et):void 0,En=I?.path??(ot?L:ge),Dn=I?.path??ve,On=et(on),kn=Ke&&Je&&!sn&&!at&&On!=null&&be!=null&&on!=null,An=Ke&&(kn||I!=null),jn=I?.anchorRect,Mn=jn==null&&On!=null&&be!=null&&(I!=null||kn)?be:null,Nn=jn==null?Mn==null?void 0:{top:`${Mn}px`}:{left:`${jn.left}px`,position:`fixed`,right:`auto`,top:`${jn.top}px`},Pn=sn?{opacity:`0`}:void 0,Fn=dI((e,n,r,i)=>{let a=WF({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:ot,mode:i}),o=a.toggleDirectory&&n.kind===`directory`,s=o?t.resolveMountedDirectoryPathFromInput(r):null;if(o&&s==null)return;let c=s??r;switch(a.selection.kind){case`range`:t.selectPathRange(c,a.selection.additive);break;case`toggle`:t.togglePathSelectionFromInput(c);break;case`single`:t.selectOnlyMountedPathFromInput(c)}let l=e.currentTarget instanceof HTMLElement?e.currentTarget:null,u=n.index>=_t.visible.startIndex&&n.index<=_t.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(O.current=!0,_e(e=>e===c?e:c),Ce(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&Lt(c,{targetOffset:`sticky-parents`})},[t,ot,_t.visible.endIndex,_t.visible.startIndex,Lt]),In=()=>{if(y.current||!Je||on==null||On==null)return;let e=t.getItem(on);e!=null&&(Pt(On),jt.current=!0,Ee({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:On.getAttribute(`aria-label`)??on,path:e.getPath()},path:e.getPath(),source:`button`}))},Ln={contextHoverPath:Dn,contextMenuButtonTriggerEnabled:Je,contextMenuButtonVisibility:Ye,contextMenuEnabled:Ke,contextMenuRightClickEnabled:Xe,contextMenuTriggerMode:qe,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:lt,draggedPathSet:dt,dragTarget:ft,gitLaneActive:tt,gitStatusByPath:n,handleRowDragEnd:Xt,handleRowDragStart:Yt,handleRowTouchStart:Zt,ignoredGitDirectories:r,ignoredInheritanceCache:me,instanceId:o,itemHeight:s,onKeyDown:Qt,onRowClick:Fn,openContextMenuForRow:Ft,registerButton:Ze,registerRenameInput:$e,renameView:rt,renderDecorationForRow:Dt,resolveIcon:nt,shouldSuppressContextMenu:Rt,visualFocusPath:En},Rn={...Ln,registerButton:Qe};return Q(`div`,{ref:S,id:mt,"data-file-tree-context-menu-button-visibility":Ke&&Je?Ye:void 0,"data-file-tree-context-menu-trigger-mode":Ke?qe:void 0,"data-file-tree-has-context-menu-action-lane":Ke&&Je?`true`:void 0,"data-file-tree-has-git-lane":tt?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:lt?dn:void 0,onDragOver:lt?un:void 0,onDrop:lt?fn:void 0,onKeyDown:Qt,onPointerLeave:Ke?ln:void 0,onPointerOver:Ke?cn:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[Q(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:wn}}),Q(`slot`,{name:RD,"data-type":`header-slot`}),f?Q(`div`,{"data-file-tree-search-container":!0,"data-open":ot?`true`:`false`,children:Q(`input`,{ref:w,"aria-activedescendant":Tn,"aria-controls":mt,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Re?`true`:void 0,value:st,onBlur:()=>{d===`retain`&&!Be.current||t.closeSearch()},onFocus:Ve,onPointerDown:Ve,onInput:e=>{Ve();let n=e.currentTarget;t.setSearch(n.value)}})}):null,Q(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&We&&xt.length>0?Q(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:Q(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${ht}px`},children:xt.map((e,t)=>iL(Rn,e.row,`sticky:${bI(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${xt.length-t}`}}))})}):null,Q(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${Ct}px`},children:[Q(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${mn}px`}}),Q(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${pn}px`,top:`${hn}px`,bottom:`${gn}px`},children:[aL(Ln,bt,Tt),vn!=null&&yn!=null?iL(Ln,vn,`parked:${vn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:pt===vn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${yn}px`}}):null,Sn!=null&&Cn!=null?iL(Ln,Sn,`parked-drag:${Sn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${Cn}px`}}):null]})]})]}),Ke?Q(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":An?`true`:`false`,style:Nn,children:[Q(`button`,{ref:v,type:`button`,"data-type":BD,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":I==null?`false`:`true`,"data-visible":kn?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),I!=null){Nt();return}In()},tabIndex:-1,style:Pn,children:Q(ZP,{...nt(`file-tree-icon-ellipsis`)})}),I==null?null:Q(`slot`,{name:zD})]}):null,I==null?null:Q(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),Nt()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),Nt()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var sL={hydrateRoot:(e,t)=>{KP(SP(oL,t),e)},renderRoot:(e,t)=>{GP(SP(oL,t),e)},unmountRoot:e=>{GP(null,e)}};function cL(e,t){sL.renderRoot(e,t)}function lL(e,t){sL.hydrateRoot(e,t)}function uL(e){sL.unmountRoot(e)}var dL=class{#e=new Map;#t=null;clearAll(){for(let e of this.#e.values())e.remove();this.#e.clear()}clearSlotContent(e){let t=this.#n(e);t!=null&&(t.remove(),this.#e.delete(e))}setHost(e){if(this.#t=e,e!=null){this.#i(e);for(let[e,t]of this.#e)this.#r(e,t)}}setSlotContent(e,t){let n=this.#n(e);if(n===t){t!=null&&(this.#e.set(e,t),this.#r(e,t));return}if(n?.remove(),t==null){this.#e.delete(e);return}this.#e.set(e,t),this.#r(e,t)}setSlotHtml(e,t){let n=t?.trim()??``;if(n.length===0){this.setSlotContent(e,null);return}let r=this.#n(e);if(r!=null&&r.innerHTML===n){this.#e.set(e,r),this.#r(e,r);return}let i=document.createElement(`div`);i.innerHTML=n,this.setSlotContent(e,i)}#n(e){let t=this.#e.get(e)??null;if(t!=null)return t;let n=this.#t;if(n==null)return null;for(let t of Array.from(n.children))if(t instanceof HTMLElement&&t.dataset.fileTreeManagedSlot===e)return t;return null}#r(e,t){t.slot=e,t.dataset.fileTreeManagedSlot=e,this.#t!=null&&t.parentNode!==this.#t&&this.#t.appendChild(t)}#i(e){for(let t of Array.from(e.children)){if(!(t instanceof HTMLElement))continue;let e=t.dataset.fileTreeManagedSlot;e==null||this.#e.has(e)||this.#e.set(e,t)}}};Array.isArray;var fL=0;function pL(e){return e!=null&&e.length>0?e:(fL+=1,`pst_ft_${fL}`)}function mL({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??uk)}function hL(e){if(typeof document>`u`)return;let t=document.createElement(`div`);t.innerHTML=e;let n=t.querySelector(`svg`);return n instanceof SVGElement?n:void 0}function gL(e){return e.querySelector(`#file-tree-icon-chevron`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-file`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-dot`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-lock`)instanceof SVGElement}function _L(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var vL=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new dL;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y=null;#b;#x=!1;#S=!1;constructor(e){let{composition:t,density:n,fileTreeSearchMode:r,gitStatus:i,id:a,initialSearchQuery:o,icons:s,itemHeight:c,onSearchChange:l,onSelectionChange:u,overscan:d,renderRowDecoration:f,renaming:p,search:m,searchBlurBehavior:h,searchFakeFocus:g,stickyFolders:_,unsafeCSS:v,initialVisibleRowCount:y,...b}=e;this.#e=t,this.#n=pL(a),this.#p=KN(i),this.#m=s,this.#h=v,this.#r=u,this.#i=f,this.#a=p!=null&&p!==!1,this.#o=h,this.#s=m===!0,this.#c=g===!0,this.#u=lk(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new VN({...b,fileTreeSearchMode:r,initialSearchQuery:o,onSearchChange:l,renaming:p}),this.#v=this.#t.getSelectionVersion(),this.#y=this.#r==null?null:this.subscribe(()=>{this.#D()})}unmount(){this.#b!=null&&(uL(this.#b),delete this.#b.dataset.fileTreeVirtualizedWrapper,this.#b=void 0),this.#l.clearAll(),this.#l.setHost(null),this.#f!=null&&(delete this.#f.dataset.fileTreeVirtualized,this.#I(this.#f),this.#f=void 0)}cleanUp(){this.unmount(),this.#y?.(),this.#y=null,this.#t.destroy()}getFileTreeContainer(){return this.#f}getItem(e){return this.#t.getItem(e)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getFocusedIndex(){return this.#t.getFocusedIndex()}getVisibleCount(){return this.#t.getVisibleCount()}getVisibleRows(e,t){return this.#t.getVisibleRows(e,t)}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#u.itemHeight}getDensityFactor(){return this.#u.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{if(!t){t=!0;return}e()})}focusPath(e){this.#t.focusPath(e)}focusFirstItem(){this.#t.focusFirstItem()}focusLastItem(){this.#t.focusLastItem()}focusNextItem(){this.#t.focusNextItem()}focusPreviousItem(){this.#t.focusPreviousItem()}focusParentItem(){this.#t.focusParentItem()}scrollToPath(e,t){this.#t.scrollToPath(e,t)}focusNearestPath(e){return this.#t.focusNearestPath(e)}add(e){this.#t.add(e)}batch(e){this.#t.batch(e)}applyGitStatusPatch(e){let t=qN(this.#p,e);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&cL(n.wrapper,this.#w())}move(e,t,n){this.#t.move(e,t,n)}onMutation(e,t){return this.#t.onMutation(e,t)}setSearch(e){this.#t.setSearch(e)}openSearch(e){this.#t.openSearch(e)}closeSearch(){this.#t.closeSearch()}isSearchOpen(){return this.#t.isSearchOpen()}getSearchValue(){return this.#t.getSearchValue()}getSearchMatchingPaths(){return this.#t.getSearchMatchingPaths()}focusNextSearchMatch(){this.#t.focusNextSearchMatch()}focusPreviousSearchMatch(){this.#t.focusPreviousSearchMatch()}startRenaming(e,t){return this.#t.startRenaming(e,t)}remove(e,t){this.#t.remove(e,t)}resetPaths(e,t){Array.isArray(e)?this.#t.resetPaths(e,t):this.#t.resetPaths(e)}setComposition(e){this.#e=e;let t=this.#T();t!=null&&(this.#O(),cL(t.wrapper,this.#w()))}setGitStatus(e){let t=KN(e,this.#p);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&cL(n.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),cL(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),lL(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),cL(r,this.#w())}#C(){return{initialViewportHeight:mL({initialVisibleRowCount:this.#d.initialVisibleRowCount,itemHeight:this.#d.itemHeight}),itemHeight:this.#d.itemHeight,overscan:this.#d.overscan,stickyFolders:this.#d.stickyFolders}}#w(){return{composition:this.#e,controller:this.#t,gitStatusByPath:this.#p?.statusByPath,ignoredGitDirectories:this.#p?.ignoredDirectoryPaths,directoriesWithGitChanges:this.#p?.directoriesWithChanges,icons:this.#m,instanceId:this.#n,renamingEnabled:this.#a,renderRowDecoration:this.#i,searchBlurBehavior:this.#o,searchEnabled:this.#s,searchFakeFocus:this.#c,slotHost:this.#l,...this.#C()}}#T(){let e=this.#f,t=this.#b;return e==null||t==null?null:{host:e,wrapper:t}}#E(e,t){let n=e.shadowRoot;n!=null&&(this.#k(n),this.#A(n)),this.#j(t)}#D(){let e=this.#r;if(e==null)return;let t=this.#t.getSelectionVersion();t!==this.#v&&(this.#v=t,e(this.#t.getSelectedPaths()))}#O(){let e=this.#e?.header?.render;if(e!=null){this.#l.setSlotContent(RD,e());return}this.#l.setSlotHtml(RD,this.#e?.header?.html??null)}#k(e){let t=_L(e).find(e=>gL(e)),n=hL(nk(sk(this.#m).set));n!=null&&(t==null||t.outerHTML!==n.outerHTML)&&(t==null?e.prepend(n):t.replaceWith(n))}#A(e){let t=_L(e),n=t.find(e=>gL(e)),r=t.filter(e=>e!==n),i=sk(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=hL(i);if(a==null){for(let e of r)e.remove();return}if(r.length!==1||r[0].outerHTML!==a.outerHTML){for(let e of r)e.remove();e.appendChild(a)}}#j(e){let t=sk(this.#m);t.colored&&ik(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${PD}]`);if(this.#g==null&&t instanceof HTMLStyleElement&&(this.#g=t),this.#h==null||this.#h===``){this.#g?.remove(),this.#g=void 0,this.#_=void 0;return}(this.#g?.parentNode!==e||this.#_!==this.#h)&&(this.#g??=document.createElement(`style`),this.#g.setAttribute(PD,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=mk(this.#h),this.#_=this.#h)}#N(e){if(this.#b!=null)return this.#b;let t=e.shadowRoot;if(t==null)throw Error(`FileTree requires a shadow root`);let n=Array.from(t.children).filter(e=>e instanceof HTMLDivElement&&typeof e.dataset.fileTreeId==`string`&&e.dataset.fileTreeId.length>0),r=n.find(e=>e.dataset.fileTreeId===this.#n)??n[0];return r!=null&&(this.#n=r.dataset.fileTreeId??this.#n),this.#b=r??document.createElement(`div`),this.#b.dataset.fileTreeId=this.#n,this.#b.dataset.fileTreeVirtualizedWrapper=`true`,this.#E(e,this.#b),this.#b.parentNode!==t&&t.appendChild(this.#b),this.#b}#P(e,t){let n=e??this.#f??document.createElement(`file-tree-container`);t!=null&&n.parentNode!==t&&t.appendChild(n);let r=n.shadowRoot??n.attachShadow({mode:`open`});return bk(n,r),this.#M(r),n.dataset.fileTreeVirtualized=`true`,n.style.display=`flex`,this.#F(n),this.#l.setHost(n),this.#f=n,n}#F(e){e.style.getPropertyValue(`--trees-item-height`)===``&&(e.style.setProperty(`--trees-item-height`,`${String(this.#u.itemHeight)}px`),this.#x=!0),e.style.getPropertyValue(`--trees-density-override`)===``&&(e.style.setProperty(`--trees-density-override`,String(this.#u.factor)),this.#S=!0)}#I(e){this.#x&&=(e.style.removeProperty(`--trees-item-height`),!1),this.#S&&=(e.style.removeProperty(`--trees-density-override`),!1)}};function yL(e){let[t]=(0,W.useState)(()=>new vL(e)),n=(0,W.useRef)({timeout:null,model:t});return(0,W.useEffect)(()=>{let{current:e}=n;return e.timeout!=null&&(clearTimeout(e.timeout),e.timeout=null),()=>{e.timeout=setTimeout(()=>e.model.cleanUp(),1)}},[]),{model:t}}function bL({files:e,dirtyPaths:t,activePath:r,busy:i,onRefresh:a,onOpenFile:o}){let c=(0,W.useRef)({files:e,onOpenFile:o});c.current={files:e,onOpenFile:o};let{model:l}=yL({paths:[],initialExpansion:`open`,itemHeight:32,onSelectionChange(e){let t=e[0];t&&!t.endsWith(`/`)&&c.current.files.some(e=>e.path===t)&&c.current.onOpenFile(t)}}),u=(0,W.useMemo)(()=>{let n=new Set(t);return e.flatMap(e=>n.has(e.path)?[{path:e.path,status:`modified`}]:[])},[e,t]);return(0,W.useEffect)(()=>{l.resetPaths(e.map(e=>e.path))},[l,e]),(0,W.useEffect)(()=>{l.setGitStatus(u)},[l,u]),(0,W.useEffect)(()=>{for(let e of l.getSelectedPaths())e!==r&&l.getItem(e)?.deselect();r&&l.getItem(r)?.select()},[l,r]),(0,G.jsxs)(`aside`,{className:`inkcap-tree`,"aria-label":`Repository files`,children:[(0,G.jsxs)(`div`,{className:`inkcap-tree-toolbar`,children:[(0,G.jsxs)(`span`,{children:[(0,G.jsx)(GE,{"aria-hidden":`true`}),` Explorer`]}),(0,G.jsx)(n,{icon:(0,G.jsx)(s,{}),"aria-label":`Refresh repository`,variant:`ghost`,size:`xs`,disabled:i,onClick:a})]}),(0,G.jsx)(`p`,{className:`inkcap-repository-legend`,children:`Changes in latest commit · drafts marked modified`}),(0,G.jsx)(KD,{model:l,style:{flex:`1`,"--trees-item-height":`32px`,"--trees-padding-inline-override":`var(--spacing-xs)`,"--trees-item-margin-x-override":`0px`,"--trees-item-padding-x-override":`var(--spacing-xs)`,"--trees-item-row-gap-override":`var(--spacing-xs)`,"--trees-border-radius-override":`var(--radius-field)`,"--trees-bg-override":`var(--color-base-100)`,"--trees-fg-override":`var(--color-base-content)`,"--trees-bg-muted-override":`var(--color-base-200)`,"--trees-selected-bg-override":`var(--color-base-300)`,"--trees-font-family-override":`var(--font-sans)`,"--trees-font-size-override":`12px`}})]})}var xL={all:(e,t)=>[`inkcap-repository`,e,t],branch:(e,t,n)=>[...xL.all(e,t),n]};function SL({connection:e,repository:t,initialBranch:n,initialPath:r,openRequestId:i,transport:a,onReady:o}){let s=kp(),[c,l]=(0,W.useState)(!1),[u,d]=(0,W.useState)(0),[f,p]=(0,W.useState)(new Map),[m,h]=(0,W.useState)(``),g=(0,W.useRef)(new AbortController);(0,W.useEffect)(()=>{let e=new AbortController;return g.current=e,()=>{e.abort()}},[]);let _=(0,W.useCallback)((t,n)=>a?a(t,n):e.app.capabilities.require(Gw).call(`app_bonsai`,t,JSON.stringify(n)),[e.app,a]),v=(0,W.useCallback)((e,t)=>kD(e,t,_,g.current.signal,e=>{d(t=>t+(e?1:-1))}),[_]),y=(0,W.useCallback)(()=>{s.invalidateQueries({queryKey:xL.all(e.app.identity.surfaceId,t)})},[s,e.app,t]),b=(0,W.useRef)(new Map),S=(0,W.useMemo)(()=>{let r=`${e.app.identity.surfaceId}:${t}:${n}`,i=b.current.get(r);if(i?.app===e.app)return i;let a=AD({repository:t,branch:n,request:v,onSaved:y,onSaveState:(e,r)=>{g.current.signal.aborted||p(i=>{let a=new Map(i),o=`${t}:${n}:${e}`;return r===null?a.delete(o):a.set(o,r),a})}}),o={app:e.app,source:a};return b.current.set(r,o),o},[t,n,v,y,e.app]),C=TD({connection:S}),w=Ym({queryKey:xL.branch(e.app.identity.surfaceId,t,n),queryFn:()=>jD(v,t,n),refetchInterval:15e3});(0,W.useEffect)(()=>e.app.window.onBeforeClose(C.requestWindowClose),[e.app,C.requestWindowClose]),(0,W.useEffect)(()=>{o?.({requestWindowClose:C.requestWindowClose})},[o,C.requestWindowClose]);let T=(0,W.useRef)(),te=(0,W.useRef)(new Map),ne=(0,W.useRef)(new Set);(0,W.useEffect)(()=>{if(!w.data)return;let e=`${S.app.identity.surfaceId}:${S.source.id}:${i}`;T.current!==e&&(T.current=e,C.onOpenFile(r));let t=te.current.get(S.source.id),n=t!==void 0&&t!==w.data.head;te.current.set(S.source.id,w.data.head);let a=new Set(C.tabs.map(e=>e.tabKey));for(let e of ne.current)a.has(e)||ne.current.delete(e);for(let e of C.tabs)if(!(e.target.closed||e.connection!==S||!n&&!ne.current.has(e.tabKey))){if(e.target.saving){ne.current.add(e.tabKey);continue}ne.current.delete(e.tabKey),e.target.dirty||C.onReopen(e,{background:!0})}},[w.data,S,r,i,C]);let E=C.tabs.find(e=>e.tabKey===C.active),D=E?.connection?.source?f.get(`${E.connection.source.id}:${E.path}`):void 0,re=D?.kind===`saved`?`Saved · syncing`:D?.kind===`synced`?`Synced · ${D.commit.slice(0,7)}`:D?.kind===`conflict`?`Sync conflict · Compare`:D?.kind===`failed`?`Sync failed · Retry`:void 0;async function O(){if(!E?.connection?.source)return;let e=b.current.get(`${E.connection.app.identity.surfaceId}:${E.connection.source.id}`);if(e)try{h(``),await e.source.retry(E.path,g.current.signal)}catch(e){console.error(`Bonsai sync retry failed`,e),h(`Could not retry sync. Your saved text remains in Bonsai.`)}}async function A(){if(!E?.connection?.source)return;let e=()=>!E.target.dirty&&!E.target.saving&&!E.target.closed;if(!e())return;let t=b.current.get(`${E.connection.app.identity.surfaceId}:${E.connection.source.id}`);if(t)try{h(``);let n=await t.source.read(E.path,g.current.signal);if(n.kind!==`text`)throw Error(`This saved text is unavailable.`);if(!e())return;await t.source.replace(E.path,n.contents,n.contents,g.current.signal)}catch(e){console.error(`Bonsai explicit re-save failed`,e),h(`Could not save again. Your saved text and open edits remain available.`)}}return(0,G.jsxs)(`div`,{className:`inkcap-repository`,children:[(0,G.jsxs)(`div`,{className:`inkcap-repository-toolbar`,children:[(0,G.jsxs)(`span`,{className:`inkcap-repository-name`,children:[(0,G.jsx)(KE,{"aria-hidden":`true`}),` `,t,` · `,n]}),(0,G.jsxs)(x,{size:`sm`,variant:`ghost`,onClick:()=>{l(!0)},children:[(0,G.jsx)(qE,{"aria-hidden":`true`}),` History`]})]}),u>0&&(0,G.jsx)(DD,{message:`Loading this repository…`}),w.data?.truncated&&(0,G.jsx)(qw,{tone:`info`,title:`Only the indexed files are shown`}),m&&(0,G.jsx)(qw,{tone:`error`,title:`Sync unavailable`,description:m}),D?.kind===`failed`&&(0,G.jsx)(qw,{tone:`warning`,title:D.reason===`permanent_material`?`Sync needs a new save`:`Sync failed`,description:D.reason===`permanent_material`?`Your text is saved. Save again using the current repository state to retry sync.`:`Your file is saved in Bonsai. Retry when access is available.`,action:(0,G.jsx)(x,{size:`sm`,disabled:D.reason===`permanent_material`&&E!==void 0&&(E.target.dirty||E.target.saving),onClick:()=>void(D.reason===`permanent_material`?A():O()),children:D.reason===`permanent_material`?`Save again`:`Retry`})}),(0,G.jsx)(pD,{model:{...C,repositoryStatus:re,repositoryStates:f,canList:!0,sourceLabel:S.source.label,onReadCurrent:async(e,t)=>{if(e.connection?.source?.kind!==`repository`)return C.onReadCurrent(e);let n=b.current.get(`${e.connection.app.identity.surfaceId}:${e.connection.source.id}`);if(!n||e.target.closed)throw Error(`This Bonsai file is no longer open.`);return t&&await n.source.discard(e.path,g.current.signal),n.source.readCommitted(e.path,g.current.signal)},error:w.error?`Could not refresh this repository. Your open edits remain available.`:C.error,fileTree:e=>(0,G.jsx)(bL,{files:w.data?.files??[],dirtyPaths:C.tabs.filter(e=>e.connection===S&&e.dirty).map(e=>e.path),activePath:E?.connection===S?E.path:null,busy:w.isFetching,onRefresh:y,onOpenFile:e})}}),(0,G.jsx)(ce,{open:c,onOpenChange:l,children:(0,G.jsxs)(ie,{children:[(0,G.jsxs)(k,{children:[(0,G.jsx)(oe,{children:`Commit history`}),(0,G.jsxs)(ee,{children:[t,` · `,n]})]}),(0,G.jsx)(`ol`,{className:`inkcap-repository-history`,children:w.data?.history.map(e=>(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`code`,{children:e.hash.slice(0,7)}),` `,e.message,(0,G.jsx)(`span`,{className:`text-dim`,children:e.author.name})]},e.hash))})]})})]})}function CL(e){if(e?.kind!==`navigate`||!e.params.some(({key:e})=>e===`repository`))return null;let t=nE(e.params);return t===null||!(`repository`in t)?`invalid`:{repository:t.repository,initialBranch:t.branch,initialPath:t.path,openRequestId:e.requestId}}function wL(e,t){return e.kind===`computer`||t.kind===`computer`?e.kind===t.kind:e.repository===t.repository&&e.initialBranch===t.initialBranch&&e.initialPath===t.initialPath&&e.openRequestId===t.openRequestId}function TL(e){let[t,n]=(0,W.useState)(e),r=(0,W.useRef)(null),i=(0,W.useRef)(!1);return(0,W.useEffect)(()=>{if(!wL(e,t)){if(e.kind===t.kind){n(e);return}i.current||(i.current=!0,(r.current??(()=>Promise.resolve(!0)))().then(t=>{i.current=!1,t&&n(e)}))}},[e,t]),{mounted:t,registerHandle:(0,W.useCallback)(e=>{r.current=e},[])}}function EL({app:e,computerName:t,projectPath:n}){let r=iw(e),i=CL(r?.openRequest??null),a=e?.capabilities.has(Gw)??!1,{mounted:o,registerHandle:s}=TL(i!==null&&i!==`invalid`&&a?{kind:`repository`,...i}:{kind:`computer`}),c=(0,W.useCallback)(e=>{s(e.requestWindowClose)},[s]);return o.kind===`repository`&&e!==null?(0,G.jsx)(SL,{connection:{app:e},repository:o.repository,initialBranch:o.initialBranch,initialPath:o.initialPath,openRequestId:o.openRequestId,onReady:c}):(0,G.jsxs)(G.Fragment,{children:[i===`invalid`?(0,G.jsx)(qw,{tone:`warning`,title:`This repository link cannot be opened`,description:`Open the file again from Bonsai. Computer files and local drafts are still available.`}):i!==null&&!a&&(0,G.jsx)(qw,{tone:`info`,title:`Repositories open from Bonsai`,description:`This host can still open Computer files and local drafts.`}),(0,G.jsx)(ED,{connection:e?{app:e}:null,context:{computerId:r?.computerId??null,computerName:t,projectPath:n},onReady:c})]})}var DL=document.getElementById(`inkcap-root`);if(!DL)throw Error(`Inkcap root is missing`);var OL=new URLSearchParams(window.location.search),kL=Ff(H({project:Zf(Hf),computerName:Zf(Hf)}))({project:OL.get(`project`),computerName:OL.get(`computerName`)}),AL=kL.project?.trim()??`/`;tw(DL,{name:`Inkcap`,queryClient:Hw()},({app:e})=>(0,W.createElement)(EL,{app:e,computerName:kL.computerName,projectPath:AL.startsWith(`/`)?AL:`/${AL}`}));export{Sl as $,dm as A,Zf as B,Km as C,Vm as D,Um as E,kp as F,Vf as G,Hf as H,qf as I,Nf as J,Yf as K,Wf as L,Fp as M,Kp as N,Rm as O,qp as P,Tl as Q,sp as R,qm as S,Wm as T,H as U,Kf as V,Tp as W,op as X,tp as Y,Af as Z,Bw as _,vr as _t,aD as a,vl as at,xg as b,WE as c,kd as ct,sE as d,ec as dt,Cl as et,xE as f,_r as ft,Uw as g,gr as gt,qw as h,br as ht,oD as i,bl as it,sm as j,Tm as k,IE as l,Od as lt,TE as m,hr as mt,KD as n,xl as nt,rD as o,Dl as ot,bE as p,yr as pt,$f as q,uD as r,El as rt,GE as s,Dd as st,yL as t,_l as tt,zE as u,fd as ut,aw as v,Hm as w,Gm as x,bg as y,Bf as z};
|