@wes-dev/pr 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/CHANGELOG.md +20 -0
- package/README.md +82 -0
- package/dist/cli/index.js +154 -0
- package/dist/web/assets/abap-CLvhMVsD.js +1 -0
- package/dist/web/assets/actionscript-3--17pq3dv.js +1 -0
- package/dist/web/assets/ada-C5qYipkI.js +1 -0
- package/dist/web/assets/andromeeda-vGVdxbeo.js +1 -0
- package/dist/web/assets/angular-html-Dy5TOb5M.js +1 -0
- package/dist/web/assets/angular-ts-CQ-VvwG4.js +1 -0
- package/dist/web/assets/apache-U0d_L8uA.js +1 -0
- package/dist/web/assets/apex-VAyPSnFM.js +1 -0
- package/dist/web/assets/apl-DLPyOpzA.js +1 -0
- package/dist/web/assets/applescript-CCn79oCD.js +1 -0
- package/dist/web/assets/ara-4CJ0cIlV.js +1 -0
- package/dist/web/assets/asciidoc-DE70LPWp.js +1 -0
- package/dist/web/assets/asm-Cmm7eHzH.js +1 -0
- package/dist/web/assets/astro-Bg8eE3kY.js +1 -0
- package/dist/web/assets/aurora-x-CDeNXAV0.js +1 -0
- package/dist/web/assets/awk-BWXHIvNe.js +1 -0
- package/dist/web/assets/ayu-dark-DluEY0Gj.js +1 -0
- package/dist/web/assets/ayu-light-C3h-C4tm.js +1 -0
- package/dist/web/assets/ayu-mirage-Bqwy1Gya.js +1 -0
- package/dist/web/assets/ballerina-B7ZEbQpA.js +1 -0
- package/dist/web/assets/bat-Bo4NYOV-.js +1 -0
- package/dist/web/assets/beancount-D-usSTwE.js +1 -0
- package/dist/web/assets/berry-DKpUyyne.js +1 -0
- package/dist/web/assets/bibtex-Ci_nEsc7.js +1 -0
- package/dist/web/assets/bicep-CUHmPFLl.js +1 -0
- package/dist/web/assets/bird2-C6vDhewU.js +1 -0
- package/dist/web/assets/blade-kDLtazTS.js +1 -0
- package/dist/web/assets/bsl-BkkzgIyY.js +1 -0
- package/dist/web/assets/c-LLHuKvL1.js +1 -0
- package/dist/web/assets/c3-BFHwR3_K.js +1 -0
- package/dist/web/assets/cadence-CQ2zXKGN.js +1 -0
- package/dist/web/assets/cairo-DLTphjLi.js +1 -0
- package/dist/web/assets/catppuccin-frappe-3VR1Za6u.js +1 -0
- package/dist/web/assets/catppuccin-latte-DwIHMF0Q.js +1 -0
- package/dist/web/assets/catppuccin-macchiato-DYnBP6_5.js +1 -0
- package/dist/web/assets/catppuccin-mocha-DYhrFGRu.js +1 -0
- package/dist/web/assets/clarity-SemFz856.js +1 -0
- package/dist/web/assets/clojure-DqKBuwfJ.js +1 -0
- package/dist/web/assets/cmake-Bj61d0ZC.js +1 -0
- package/dist/web/assets/cobol-KB1NrS7u.js +1 -0
- package/dist/web/assets/codeowners-C8r90Shi.js +1 -0
- package/dist/web/assets/codeql-oeQT6MSM.js +1 -0
- package/dist/web/assets/coffee-BIVXoYBq.js +1 -0
- package/dist/web/assets/common-lisp-Cv5bFMCO.js +1 -0
- package/dist/web/assets/coq-BrsZFFmf.js +1 -0
- package/dist/web/assets/cpp-t-AOohLk.js +1 -0
- package/dist/web/assets/crystal-Siw7Sgsi.js +1 -0
- package/dist/web/assets/csharp-oqKa8noW.js +1 -0
- package/dist/web/assets/css-C4JxYney.js +1 -0
- package/dist/web/assets/csv-Dx-8-gkx.js +1 -0
- package/dist/web/assets/cue-CE9AQfxI.js +1 -0
- package/dist/web/assets/cypher-ClKdZ_lG.js +1 -0
- package/dist/web/assets/d-qD-0Kul2.js +1 -0
- package/dist/web/assets/dark-plus-Cs2F2srj.js +1 -0
- package/dist/web/assets/dart-CnvKMtbv.js +1 -0
- package/dist/web/assets/dax-BkyTk9wS.js +1 -0
- package/dist/web/assets/desktop-Dlh5hvp9.js +1 -0
- package/dist/web/assets/diff-woXpYk--.js +1 -0
- package/dist/web/assets/docker-IyjqRm3v.js +1 -0
- package/dist/web/assets/dotenv-_5a1GRtc.js +1 -0
- package/dist/web/assets/dracula-BHWKrbxM.js +1 -0
- package/dist/web/assets/dracula-soft-5eyTD99u.js +1 -0
- package/dist/web/assets/dream-maker-DW3nJb8Q.js +1 -0
- package/dist/web/assets/edge-DWGhPgzT.js +1 -0
- package/dist/web/assets/elixir-CRNPk2CS.js +1 -0
- package/dist/web/assets/elm-wtHW2ZzC.js +1 -0
- package/dist/web/assets/emacs-lisp-B4R74twV.js +1 -0
- package/dist/web/assets/erb-zY-7xODc.js +1 -0
- package/dist/web/assets/erlang-Cphh6RMH.js +1 -0
- package/dist/web/assets/everforest-dark-sB-x3p7T.js +1 -0
- package/dist/web/assets/everforest-light-Df2xbC6M.js +1 -0
- package/dist/web/assets/fennel-DQxkIbk2.js +1 -0
- package/dist/web/assets/fish-BJitypiv.js +1 -0
- package/dist/web/assets/fluent-C03EYrpw.js +1 -0
- package/dist/web/assets/fortran-fixed-form-DEKoE2YW.js +1 -0
- package/dist/web/assets/fortran-free-form-CYNrtFtB.js +1 -0
- package/dist/web/assets/fsharp-D13ZGOAj.js +1 -0
- package/dist/web/assets/gdresource-C0sCabJj.js +1 -0
- package/dist/web/assets/gdscript-Cp2uCuqX.js +1 -0
- package/dist/web/assets/gdshader-CBce3t8t.js +1 -0
- package/dist/web/assets/genie-CV2tkWYe.js +1 -0
- package/dist/web/assets/gherkin-DExj1W_8.js +1 -0
- package/dist/web/assets/git-commit-BSykSTBG.js +1 -0
- package/dist/web/assets/git-rebase-DryBRQqt.js +1 -0
- package/dist/web/assets/github-dark-C-LZuMrd.js +1 -0
- package/dist/web/assets/github-dark-default-DXG-b-1a.js +1 -0
- package/dist/web/assets/github-dark-dimmed-Bx1FflLF.js +1 -0
- package/dist/web/assets/github-dark-high-contrast-B_tTalzw.js +1 -0
- package/dist/web/assets/github-light-EUqPIrTm.js +1 -0
- package/dist/web/assets/github-light-default-BXViO-2h.js +1 -0
- package/dist/web/assets/github-light-high-contrast-B68TUdTA.js +1 -0
- package/dist/web/assets/gleam-CSRkHgEL.js +1 -0
- package/dist/web/assets/glimmer-js-C1lI2oOe.js +1 -0
- package/dist/web/assets/glimmer-ts-w8P2a6UH.js +1 -0
- package/dist/web/assets/glsl-BOGqvuHx.js +1 -0
- package/dist/web/assets/gn-ilITqXS6.js +1 -0
- package/dist/web/assets/gnuplot-7GGW24-e.js +1 -0
- package/dist/web/assets/go-rLFTqkRN.js +1 -0
- package/dist/web/assets/graphql-CMxvykwD.js +1 -0
- package/dist/web/assets/groovy-CacY0gHj.js +1 -0
- package/dist/web/assets/gruvbox-dark-hard-C820rvS2.js +1 -0
- package/dist/web/assets/gruvbox-dark-medium-BPjhmG05.js +1 -0
- package/dist/web/assets/gruvbox-dark-soft-MrdJrrXF.js +1 -0
- package/dist/web/assets/gruvbox-light-hard-BC_s9l72.js +1 -0
- package/dist/web/assets/gruvbox-light-medium-BAWPOn9u.js +1 -0
- package/dist/web/assets/gruvbox-light-soft-BSMLrYjP.js +1 -0
- package/dist/web/assets/hack-BTJt-rSc.js +1 -0
- package/dist/web/assets/haml-CpShFG-s.js +1 -0
- package/dist/web/assets/handlebars-BsUSmFng.js +1 -0
- package/dist/web/assets/haskell-D8IpX4py.js +1 -0
- package/dist/web/assets/haxe-OTjmBuCE.js +1 -0
- package/dist/web/assets/hcl-Dh228itO.js +1 -0
- package/dist/web/assets/hjson-CxZEssPk.js +1 -0
- package/dist/web/assets/hlsl-Cvrh5tZx.js +1 -0
- package/dist/web/assets/horizon-CE9ld1lL.js +1 -0
- package/dist/web/assets/horizon-bright-DSNQnXHK.js +1 -0
- package/dist/web/assets/houston-CsvMBhTu.js +1 -0
- package/dist/web/assets/html-derivative-DslI7lKP.js +1 -0
- package/dist/web/assets/html-efT10kNy.js +1 -0
- package/dist/web/assets/http-DGneOSH7.js +1 -0
- package/dist/web/assets/hurl-D7wxeizR.js +1 -0
- package/dist/web/assets/hxml-B0Qn7Nwc.js +1 -0
- package/dist/web/assets/hy-CZbG8q4J.js +1 -0
- package/dist/web/assets/imba-DsUTQ-LC.js +1 -0
- package/dist/web/assets/index-CuLPuzv1.js +2825 -0
- package/dist/web/assets/index-dvXjNgUr.css +1 -0
- package/dist/web/assets/ini-B5eOa1yu.js +1 -0
- package/dist/web/assets/java-DRV6EAgN.js +1 -0
- package/dist/web/assets/javascript-VqTwarqZ.js +1 -0
- package/dist/web/assets/jinja-B0K-1eZW.js +1 -0
- package/dist/web/assets/jison-C6X_CrUT.js +1 -0
- package/dist/web/assets/json-BMTvgpRj.js +1 -0
- package/dist/web/assets/json5-BR5RXkoi.js +1 -0
- package/dist/web/assets/jsonc-CYpm1nAK.js +1 -0
- package/dist/web/assets/jsonl-CmCQp5Yx.js +1 -0
- package/dist/web/assets/jsonnet-CJTPZ8u_.js +1 -0
- package/dist/web/assets/jssm-DXw9l8Rf.js +1 -0
- package/dist/web/assets/jsx-BdBaYpud.js +1 -0
- package/dist/web/assets/julia-eSoxcKep.js +1 -0
- package/dist/web/assets/just-BMl4E389.js +1 -0
- package/dist/web/assets/kanagawa-dragon-CXtmUGW6.js +1 -0
- package/dist/web/assets/kanagawa-lotus-BN08jTvb.js +1 -0
- package/dist/web/assets/kanagawa-wave-CTweb8Dz.js +1 -0
- package/dist/web/assets/kdl-CsD5j6eV.js +1 -0
- package/dist/web/assets/kotlin-DhhofPvG.js +1 -0
- package/dist/web/assets/kusto-C7mF5XQf.js +1 -0
- package/dist/web/assets/laserwave-C_8bwKvT.js +1 -0
- package/dist/web/assets/latex-vrLDptzo.js +1 -0
- package/dist/web/assets/lean-CewbzKMR.js +1 -0
- package/dist/web/assets/less-DVTAwKKz.js +1 -0
- package/dist/web/assets/light-plus-DVQuIRkW.js +1 -0
- package/dist/web/assets/liquid-DhiVbfmF.js +1 -0
- package/dist/web/assets/llvm-Cm23YOpf.js +1 -0
- package/dist/web/assets/log-BNLmms1o.js +1 -0
- package/dist/web/assets/logo-Cluzi2Zq.js +1 -0
- package/dist/web/assets/lua-BZarQnS9.js +1 -0
- package/dist/web/assets/luau-FMPmPwt6.js +1 -0
- package/dist/web/assets/make-Dixweg8N.js +1 -0
- package/dist/web/assets/markdown-BYOwaDjH.js +1 -0
- package/dist/web/assets/marko-BWPwdtQS.js +1 -0
- package/dist/web/assets/material-theme-Bm3Qr25_.js +1 -0
- package/dist/web/assets/material-theme-darker-2IIEA8gg.js +1 -0
- package/dist/web/assets/material-theme-lighter-uhdI0v04.js +1 -0
- package/dist/web/assets/material-theme-ocean-CHQ94UKr.js +1 -0
- package/dist/web/assets/material-theme-palenight-B5W6OYN7.js +1 -0
- package/dist/web/assets/matlab-D7qyCx1q.js +1 -0
- package/dist/web/assets/mdc-Cx_ikHJA.js +1 -0
- package/dist/web/assets/mdx-DQZ5AkYe.js +1 -0
- package/dist/web/assets/mermaid-Bk4SNUv9.js +1 -0
- package/dist/web/assets/min-dark-BSWPekZh.js +1 -0
- package/dist/web/assets/min-light-DDpmG2fV.js +1 -0
- package/dist/web/assets/mipsasm-BMqwQI7S.js +1 -0
- package/dist/web/assets/mojo-BgCJLMeH.js +1 -0
- package/dist/web/assets/monokai-CdkpiU2Y.js +1 -0
- package/dist/web/assets/moonbit-CaWjb8XO.js +1 -0
- package/dist/web/assets/move-B1IS1UjX.js +1 -0
- package/dist/web/assets/narrat-_X_XdTYD.js +1 -0
- package/dist/web/assets/nextflow-BJtWHP5T.js +1 -0
- package/dist/web/assets/nextflow-groovy-DJMQeKeT.js +1 -0
- package/dist/web/assets/nginx-iNlDtGB5.js +1 -0
- package/dist/web/assets/night-owl-DhmEMT88.js +1 -0
- package/dist/web/assets/night-owl-light-eJ-hLW7d.js +1 -0
- package/dist/web/assets/nim-DGF5L7xM.js +1 -0
- package/dist/web/assets/nix-IvuFDN5E.js +1 -0
- package/dist/web/assets/nord-Cb4Vim4T.js +1 -0
- package/dist/web/assets/nushell-DcLAeLz5.js +1 -0
- package/dist/web/assets/objective-c-D1A_Heim.js +1 -0
- package/dist/web/assets/objective-cpp-BsSzOQcm.js +1 -0
- package/dist/web/assets/ocaml-O90oeIOV.js +1 -0
- package/dist/web/assets/odin-B1RWQWA5.js +1 -0
- package/dist/web/assets/one-dark-pro-CLwyXe_n.js +1 -0
- package/dist/web/assets/one-light-D7Lr4KcI.js +1 -0
- package/dist/web/assets/openscad-BUDT5pXO.js +1 -0
- package/dist/web/assets/pascal-4ZHwLPI5.js +1 -0
- package/dist/web/assets/perl-CFfHYoph.js +1 -0
- package/dist/web/assets/php-CtPBh1K5.js +1 -0
- package/dist/web/assets/pierre-dark-CpLgRqie.js +1 -0
- package/dist/web/assets/pierre-dark-protanopia-deuteranopia-B35FxJx-.js +1 -0
- package/dist/web/assets/pierre-dark-soft-kZQmAZld.js +1 -0
- package/dist/web/assets/pierre-dark-tritanopia-CpjhbsIL.js +1 -0
- package/dist/web/assets/pierre-dark-vibrant-CpQYzh95.js +1 -0
- package/dist/web/assets/pierre-light-CoaEpmwp.js +1 -0
- package/dist/web/assets/pierre-light-protanopia-deuteranopia-0fSaH845.js +1 -0
- package/dist/web/assets/pierre-light-soft-lWLdNTOI.js +1 -0
- package/dist/web/assets/pierre-light-tritanopia-CEbqgOJL.js +1 -0
- package/dist/web/assets/pierre-light-vibrant-D80Fkn33.js +1 -0
- package/dist/web/assets/pkl-ot-7Btpt.js +1 -0
- package/dist/web/assets/plastic-DQwYfKfQ.js +1 -0
- package/dist/web/assets/plsql-DGHpHOYJ.js +1 -0
- package/dist/web/assets/po-BiJDBrnU.js +1 -0
- package/dist/web/assets/poimandres-DRFjx7u4.js +1 -0
- package/dist/web/assets/polar-C7UOKdEL.js +1 -0
- package/dist/web/assets/postcss-BXeXVLqQ.js +1 -0
- package/dist/web/assets/powerquery-DNMTfnFr.js +1 -0
- package/dist/web/assets/powershell-DshXNtvi.js +1 -0
- package/dist/web/assets/prisma-BsRQq5mF.js +1 -0
- package/dist/web/assets/prolog-iXnhIJG7.js +1 -0
- package/dist/web/assets/proto-DB4EqR-F.js +1 -0
- package/dist/web/assets/pug-CxRWcKXx.js +1 -0
- package/dist/web/assets/puppet-CDv2pdJW.js +1 -0
- package/dist/web/assets/purescript-9MfHhQsQ.js +1 -0
- package/dist/web/assets/python-gzcpVVnB.js +1 -0
- package/dist/web/assets/qml-CQ8J3wuq.js +1 -0
- package/dist/web/assets/qmldir-DCQb3MpD.js +1 -0
- package/dist/web/assets/qss-Fe1Jh2GI.js +1 -0
- package/dist/web/assets/r-CItjESd8.js +1 -0
- package/dist/web/assets/racket-DcIDlBhZ.js +1 -0
- package/dist/web/assets/raku-B3gFvitq.js +1 -0
- package/dist/web/assets/razor-BPkkINsq.js +1 -0
- package/dist/web/assets/red-CJ3rzSJv.js +1 -0
- package/dist/web/assets/reg-CRGYupPL.js +1 -0
- package/dist/web/assets/regexp-DX3MNthO.js +1 -0
- package/dist/web/assets/rel-BtDbiS_P.js +1 -0
- package/dist/web/assets/riscv-Ckw8ddFX.js +1 -0
- package/dist/web/assets/ron-VUp2lXgN.js +1 -0
- package/dist/web/assets/rose-pine-BthvhNj6.js +1 -0
- package/dist/web/assets/rose-pine-dawn-Dg85fqjY.js +1 -0
- package/dist/web/assets/rose-pine-moon-hon4tzzS.js +1 -0
- package/dist/web/assets/rosmsg-CAekHB0j.js +1 -0
- package/dist/web/assets/rst-ClRAjKbC.js +1 -0
- package/dist/web/assets/ruby-CgYgA9Jj.js +1 -0
- package/dist/web/assets/rust-Cfkwpbl8.js +1 -0
- package/dist/web/assets/sas-CPmYLbzU.js +1 -0
- package/dist/web/assets/sass-DXrisJhu.js +1 -0
- package/dist/web/assets/scala-DKOlJaKm.js +1 -0
- package/dist/web/assets/scheme-DQCgrYNe.js +1 -0
- package/dist/web/assets/scss-Cm-sHo09.js +1 -0
- package/dist/web/assets/sdbl-bTVj8UrX.js +1 -0
- package/dist/web/assets/shaderlab-TOUzSsQk.js +1 -0
- package/dist/web/assets/shellscript-DmaaF0b7.js +1 -0
- package/dist/web/assets/shellsession-CQx7VqyU.js +1 -0
- package/dist/web/assets/slack-dark-DnToyrRv.js +1 -0
- package/dist/web/assets/slack-ochin-B2OO5cIa.js +1 -0
- package/dist/web/assets/smalltalk-B16xEiuN.js +1 -0
- package/dist/web/assets/snazzy-light-4G7pJPwS.js +1 -0
- package/dist/web/assets/solarized-dark-DV17i1UV.js +1 -0
- package/dist/web/assets/solarized-light-DSh2HLQt.js +1 -0
- package/dist/web/assets/solidity-CKzVLygQ.js +1 -0
- package/dist/web/assets/soy-B_yUNzV2.js +1 -0
- package/dist/web/assets/sparql-D_iOobhT.js +1 -0
- package/dist/web/assets/splunk-BC2Px7Mm.js +1 -0
- package/dist/web/assets/sql-BJHohXqk.js +1 -0
- package/dist/web/assets/ssh-config-BgfXC-Er.js +1 -0
- package/dist/web/assets/stata-UAFrzABU.js +1 -0
- package/dist/web/assets/stylus-B6D30XZt.js +1 -0
- package/dist/web/assets/surrealql-CWvgOHzZ.js +1 -0
- package/dist/web/assets/svelte-BddkVZXj.js +1 -0
- package/dist/web/assets/swift-DonLKvLd.js +1 -0
- package/dist/web/assets/synthwave-84-nFMaYfgc.js +1 -0
- package/dist/web/assets/system-verilog-DJ5XKQeo.js +1 -0
- package/dist/web/assets/systemd-BxMlprV5.js +1 -0
- package/dist/web/assets/talonscript-CohzipZa.js +1 -0
- package/dist/web/assets/tasl-DMoTqEGO.js +1 -0
- package/dist/web/assets/tcl-CZd0xW_V.js +1 -0
- package/dist/web/assets/templ-C84Bu3va.js +1 -0
- package/dist/web/assets/terraform-DswuEJGm.js +1 -0
- package/dist/web/assets/tex-RrP2i1xH.js +1 -0
- package/dist/web/assets/tokyo-night-oM2G3aXe.js +1 -0
- package/dist/web/assets/toml-CcmNWLt0.js +1 -0
- package/dist/web/assets/ts-tags-BRr3h9RL.js +1 -0
- package/dist/web/assets/tsv-sltzmVWM.js +1 -0
- package/dist/web/assets/tsx-CzdrIvPO.js +1 -0
- package/dist/web/assets/turtle-ByJddavk.js +1 -0
- package/dist/web/assets/twig-CibPnSwR.js +1 -0
- package/dist/web/assets/typescript-CWzslnac.js +1 -0
- package/dist/web/assets/typespec-BRdr0IET.js +1 -0
- package/dist/web/assets/typst-DI99ib-x.js +1 -0
- package/dist/web/assets/v-DETTlOr0.js +1 -0
- package/dist/web/assets/vala-zf12oZj6.js +1 -0
- package/dist/web/assets/vb-Djn5o6TS.js +1 -0
- package/dist/web/assets/verilog-CiiDBU1e.js +1 -0
- package/dist/web/assets/vesper-DdrHHSXu.js +1 -0
- package/dist/web/assets/vhdl-BroJfC0k.js +1 -0
- package/dist/web/assets/viml-DvXPmvsu.js +1 -0
- package/dist/web/assets/vitesse-black-fwtXNY1n.js +1 -0
- package/dist/web/assets/vitesse-dark-BZCL-v6S.js +1 -0
- package/dist/web/assets/vitesse-light-VbXTXTou.js +1 -0
- package/dist/web/assets/vue-C-b1or0S.js +1 -0
- package/dist/web/assets/vue-html-B7qsQ7no.js +1 -0
- package/dist/web/assets/vue-vine-dqyrjuMF.js +1 -0
- package/dist/web/assets/vyper-CgoNMtux.js +1 -0
- package/dist/web/assets/wasm-BnjxR4X6.js +1 -0
- package/dist/web/assets/wasm-ByWQv1Qj.js +1 -0
- package/dist/web/assets/wenyan-C8pVoKbM.js +1 -0
- package/dist/web/assets/wgsl-BsKzXJz4.js +1 -0
- package/dist/web/assets/wikitext-ClFFjSW2.js +1 -0
- package/dist/web/assets/wit-DdvCle-K.js +1 -0
- package/dist/web/assets/wolfram-DLL8P-h_.js +1 -0
- package/dist/web/assets/xml-CG7JAl4q.js +1 -0
- package/dist/web/assets/xsl-DE3Ct1nt.js +1 -0
- package/dist/web/assets/yaml-76tnpMFk.js +1 -0
- package/dist/web/assets/zenscript-BnlCZFoB.js +1 -0
- package/dist/web/assets/zig-CMLA9XwU.js +1 -0
- package/dist/web/index.html +13 -0
- package/package.json +80 -0
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var X3=Object.defineProperty;var an=(t,e)=>{for(var r in e)X3(t,r,{get:e[r],enumerable:!0})};import Y3 from"node:process";function aE(t){return t==null?[]:Array.isArray(t)?t:[t]}function Q3(t,e,r,o){var n,i=t[e],s=~o.string.indexOf(e)?r==null||r===!0?"":String(r):typeof r=="boolean"?r:~o.boolean.indexOf(e)?r==="false"?!1:r==="true"||(t._.push((n=+r,n*0===0?n:r)),!!r):(n=+r,n*0===0?n:r);t[e]=i==null?s:Array.isArray(i)?i.concat(s):[i,s]}function e9(t,e){t=t||[],e=e||{};var r,o,n,i,s,a={_:[]},c=0,u=0,l=0,p=t.length;let f=e.alias!==void 0,d=e.unknown!==void 0,m=e.default!==void 0;if(e.alias=e.alias||{},e.string=aE(e.string),e.boolean=aE(e.boolean),f)for(r in e.alias)for(o=e.alias[r]=aE(e.alias[r]),c=0;c<o.length;c++)(e.alias[o[c]]=o.concat(r)).splice(c,1);for(c=e.boolean.length;c-- >0;)for(o=e.alias[e.boolean[c]]||[],u=o.length;u-- >0;)e.boolean.push(o[u]);for(c=e.string.length;c-- >0;)for(o=e.alias[e.string[c]]||[],u=o.length;u-- >0;)e.string.push(o[u]);if(m){for(r in e.default)if(i=typeof e.default[r],o=e.alias[r]=e.alias[r]||[],e[i]!==void 0)for(e[i].push(r),c=0;c<o.length;c++)e[i].push(o[c])}let g=d?Object.keys(e.alias):[];for(c=0;c<p;c++){if(n=t[c],n==="--"){a._=a._.concat(t.slice(++c));break}for(u=0;u<n.length&&n.charCodeAt(u)===45;u++);if(u===0)a._.push(n);else if(n.substring(u,u+3)==="no-"){if(i=n.substring(u+3),d&&!~g.indexOf(i))return e.unknown(n);a[i]=!1}else{for(l=u+1;l<n.length&&n.charCodeAt(l)!==61;l++);for(i=n.substring(u,l),s=n.substring(++l)||c+1===p||(""+t[c+1]).charCodeAt(0)===45||t[++c],o=u===2?[i]:i,l=0;l<o.length;l++){if(i=o[l],d&&!~g.indexOf(i))return e.unknown("-".repeat(u)+i);Q3(a,i,l+1<o.length||s,e)}}}if(m)for(r in e.default)a[r]===void 0&&(a[r]=e.default[r]);if(f)for(r in a)for(o=e.alias[r]||[];o.length>0;)a[o.shift()]=a[r];return a}function JM(t){return t.replace(/[<[].+/,"").trim()}function t9(t){let e=/<([^>]+)>/g,r=/\[([^\]]+)\]/g,o=[],n=a=>{let c=!1,u=a[1];return u.startsWith("...")&&(u=u.slice(3),c=!0),{required:a[0].startsWith("<"),value:u,variadic:c}},i;for(;i=e.exec(t);)o.push(n(i));let s;for(;s=r.exec(t);)o.push(n(s));return o}function r9(t){let e={alias:{},boolean:[]};for(let[r,o]of t.entries())o.names.length>1&&(e.alias[o.names[0]]=o.names.slice(1)),o.isBoolean&&(o.negated&&t.some((n,i)=>i!==r&&n.names.some(s=>o.names.includes(s))&&typeof n.required=="boolean")||e.boolean.push(o.names[0]));return e}function VM(t){return t.sort((e,r)=>e.length>r.length?-1:1)[0]}function KM(t,e){return t.length>=e?t:`${t}${" ".repeat(e-t.length)}`}function n9(t){return t.replaceAll(/([a-z])-([a-z])/g,(e,r,o)=>r+o.toUpperCase())}function o9(t,e,r){let o=t;for(let n=0;n<e.length;n++){let i=e[n];if(n===e.length-1){o[i]=r;return}if(o[i]==null){let s=+e[n+1]>-1;o[i]=s?[]:{}}o=o[i]}}function i9(t,e){for(let r of Object.keys(e)){let o=e[r];o.shouldTransform&&(t[r]=[t[r]].flat(),typeof o.transformFunction=="function"&&(t[r]=t[r].map(o.transformFunction)))}}function s9(t){let e=/([^\\/]+)$/.exec(t);return e?e[1]:""}function YM(t){return t.split(".").map((e,r)=>r===0?n9(e):e).join(".")}var yy=class extends Error{constructor(t){super(t),this.name="CACError",typeof Error.captureStackTrace!="function"&&(this.stack=new Error(t).stack)}},a9=class{rawName;description;name;names;isBoolean;required;config;negated;constructor(t,e,r){this.rawName=t,this.description=e,this.config=Object.assign({},r),t=t.replaceAll(".*",""),this.negated=!1,this.names=JM(t).split(",").map(o=>{let n=o.trim().replace(/^-{1,2}/,"");return n.startsWith("no-")&&(this.negated=!0,n=n.replace(/^no-/,"")),YM(n)}).sort((o,n)=>o.length>n.length?1:-1),this.name=this.names.at(-1),this.negated&&this.config.default==null&&(this.config.default=!0),t.includes("<")?this.required=!0:t.includes("[")?this.required=!1:this.isBoolean=!0}},cE,xy;if(typeof process<"u"){let t;typeof Deno<"u"&&typeof Deno.version?.deno=="string"?t="deno":typeof Bun<"u"&&typeof Bun.version=="string"?t="bun":t="node",xy=`${process.platform}-${process.arch} ${t}-${process.version}`,cE=process.argv}else typeof navigator>"u"?xy="unknown":xy=`${navigator.platform} ${navigator.userAgent}`;var XM=class{rawName;description;config;cli;options;aliasNames;name;args;commandAction;usageText;versionNumber;examples;helpCallback;globalCommand;constructor(t,e,r={},o){this.rawName=t,this.description=e,this.config=r,this.cli=o,this.options=[],this.aliasNames=[],this.name=JM(t),this.args=t9(t),this.examples=[]}usage(t){return this.usageText=t,this}allowUnknownOptions(){return this.config.allowUnknownOptions=!0,this}ignoreOptionDefaultValue(){return this.config.ignoreOptionDefaultValue=!0,this}version(t,e="-v, --version"){return this.versionNumber=t,this.option(e,"Display version number"),this}example(t){return this.examples.push(t),this}option(t,e,r){let o=new a9(t,e,r);return this.options.push(o),this}alias(t){return this.aliasNames.push(t),this}action(t){return this.commandAction=t,this}isMatched(t){return this.name===t||this.aliasNames.includes(t)}get isDefaultCommand(){return this.name===""||this.aliasNames.includes("!")}get isGlobalCommand(){return this instanceof QM}hasOption(t){return t=t.split(".")[0],this.options.find(e=>e.names.includes(t))}outputHelp(){let{name:t,commands:e}=this.cli,{versionNumber:r,options:o,helpCallback:n}=this.cli.globalCommand,i=[{body:`${t}${r?`/${r}`:""}`}];if(i.push({title:"Usage",body:` $ ${t} ${this.usageText||this.rawName}`}),(this.isGlobalCommand||this.isDefaultCommand)&&e.length>0){let a=VM(e.map(c=>c.rawName));i.push({title:"Commands",body:e.map(c=>` ${KM(c.rawName,a.length)} ${c.description}`).join(`
|
|
3
|
+
`)},{title:"For more info, run any command with the `--help` flag",body:e.map(c=>` $ ${t}${c.name===""?"":` ${c.name}`} --help`).join(`
|
|
4
|
+
`)})}let s=this.isGlobalCommand?o:[...this.options,...o||[]];if(!this.isGlobalCommand&&!this.isDefaultCommand&&(s=s.filter(a=>a.name!=="version")),s.length>0){let a=VM(s.map(c=>c.rawName));i.push({title:"Options",body:s.map(c=>` ${KM(c.rawName,a.length)} ${c.description} ${c.config.default===void 0?"":`(default: ${c.config.default})`}`).join(`
|
|
5
|
+
`)})}this.examples.length>0&&i.push({title:"Examples",body:this.examples.map(a=>typeof a=="function"?a(t):a).join(`
|
|
6
|
+
`)}),n&&(i=n(i)||i),console.info(i.map(a=>a.title?`${a.title}:
|
|
7
|
+
${a.body}`:a.body).join(`
|
|
8
|
+
|
|
9
|
+
`))}outputVersion(){let{name:t}=this.cli,{versionNumber:e}=this.cli.globalCommand;e&&console.info(`${t}/${e} ${xy}`)}checkRequiredArgs(){let t=this.args.filter(e=>e.required).length;if(this.cli.args.length<t)throw new yy(`missing required args for command \`${this.rawName}\``)}checkUnknownOptions(){let{options:t,globalCommand:e}=this.cli;if(!this.config.allowUnknownOptions){for(let r of Object.keys(t))if(r!=="--"&&!this.hasOption(r)&&!e.hasOption(r))throw new yy(`Unknown option \`${r.length>1?`--${r}`:`-${r}`}\``)}}checkOptionValue(){let{options:t,globalCommand:e}=this.cli,r=[...e.options,...this.options];for(let o of r){let n=t[o.name.split(".")[0]];if(o.required){let i=r.some(s=>s.negated&&s.names.includes(o.name));if(n===!0||n===!1&&!i)throw new yy(`option \`${o.rawName}\` value is missing`)}}}checkUnusedArgs(){let t=this.args.some(e=>e.variadic)?1/0:this.args.length;if(t<this.cli.args.length)throw new yy(`Unused args: ${this.cli.args.slice(t).map(e=>`\`${e}\``).join(", ")}`)}},QM=class extends XM{constructor(t){super("@@global@@","",{},t)}},c9=class extends EventTarget{name;commands;globalCommand;matchedCommand;matchedCommandName;rawArgs;args;options;showHelpOnExit;showVersionOnExit;constructor(t=""){super(),this.name=t,this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.globalCommand=new QM(this),this.globalCommand.usage("<command> [options]")}usage(t){return this.globalCommand.usage(t),this}command(t,e,r){let o=new XM(t,e||"",r,this);return o.globalCommand=this.globalCommand,this.commands.push(o),o}option(t,e,r){return this.globalCommand.option(t,e,r),this}help(t){return this.globalCommand.option("-h, --help","Display this message"),this.globalCommand.helpCallback=t,this.showHelpOnExit=!0,this}version(t,e="-v, --version"){return this.globalCommand.version(t,e),this.showVersionOnExit=!0,this}example(t){return this.globalCommand.example(t),this}outputHelp(){this.matchedCommand?this.matchedCommand.outputHelp():this.globalCommand.outputHelp()}outputVersion(){this.globalCommand.outputVersion()}setParsedInfo({args:t,options:e},r,o){return this.args=t,this.options=e,r&&(this.matchedCommand=r),o&&(this.matchedCommandName=o),this}unsetMatchedCommand(){this.matchedCommand=void 0,this.matchedCommandName=void 0}parse(t,{run:e=!0}={}){if(!t){if(!cE)throw new Error("No argv provided and runtime process argv is not available.");t=cE}this.rawArgs=t,this.name||(this.name=t[1]?s9(t[1]):"cli");let r=!0;for(let n of this.commands){let i=this.mri(t.slice(2),n),s=i.args[0];if(n.isMatched(s)){r=!1;let a={...i,args:i.args.slice(1)};this.setParsedInfo(a,n,s),this.dispatchEvent(new CustomEvent(`command:${s}`,{detail:n}))}}if(r){for(let n of this.commands)if(n.isDefaultCommand){r=!1;let i=this.mri(t.slice(2),n);this.setParsedInfo(i,n),this.dispatchEvent(new CustomEvent("command:!",{detail:n}))}}if(r){let n=this.mri(t.slice(2));this.setParsedInfo(n)}this.options.help&&this.showHelpOnExit&&(this.outputHelp(),e=!1,this.unsetMatchedCommand()),this.options.version&&this.showVersionOnExit&&this.matchedCommandName==null&&(this.outputVersion(),e=!1,this.unsetMatchedCommand());let o={args:this.args,options:this.options};return e&&this.runMatchedCommand(),!this.matchedCommand&&this.args[0]&&this.dispatchEvent(new CustomEvent("command:*",{detail:this.args[0]})),o}mri(t,e){let r=[...this.globalCommand.options,...e?e.options:[]],o=r9(r),n=[],i=t.indexOf("--");i!==-1&&(n=t.slice(i+1),t=t.slice(0,i));let s=e9(t,o);s=Object.keys(s).reduce((p,f)=>({...p,[YM(f)]:s[f]}),{_:[]});let a=s._,c={"--":n},u=e&&e.config.ignoreOptionDefaultValue?e.config.ignoreOptionDefaultValue:this.globalCommand.config.ignoreOptionDefaultValue,l=Object.create(null);for(let p of r){if(!u&&p.config.default!==void 0)for(let f of p.names)c[f]=p.config.default;Array.isArray(p.config.type)&&l[p.name]===void 0&&(l[p.name]=Object.create(null),l[p.name].shouldTransform=!0,l[p.name].transformFunction=p.config.type[0])}for(let p of Object.keys(s))p!=="_"&&(o9(c,p.split("."),s[p]),i9(c,l));return{args:a,options:c}}runMatchedCommand(){let{args:t,options:e,matchedCommand:r}=this;if(!r||!r.commandAction)return;r.checkUnknownOptions(),r.checkOptionValue(),r.checkRequiredArgs(),r.checkUnusedArgs();let o=[];return r.args.forEach((n,i)=>{n.variadic?o.push(t.slice(i)):o.push(t[i])}),o.push(e),r.commandAction.apply(this,o)}},eD=(t="")=>new c9(t);var tD="x-hono-already-sent";import{Http2ServerRequest as Kf,constants as u9}from"node:http2";import{Readable as uE}from"node:stream";var rD=t=>((...e)=>{if(typeof e[0]=="function"){let[r,o]=e;return async function(i,s){let a=await r(i),c=await t(i,a,o);if(c)return c;await s()}}else{let[r,o,n]=e;return(async()=>{let i=await t(r,o,n);if(!i)throw new Error("Failed to upgrade WebSocket");return i})()}});var bo=class extends Error{constructor(t,e){super(t,e),this.name="RequestError"}},l9=/^\/[!#$&-;=?-\[\]_a-z~]*$/,p9=/\/\.\.?(?:[/?#]|$)/,d9=/^[a-z0-9._-]+(?::(?:[1-5]\d{3,4}|[6-9]\d{3}))?$/,f9=(t,e,r)=>{let o=`${t}://${e}${r}`;if(d9.test(e)){if(r.length===0)return o+"/";if(r.charCodeAt(0)!==47)throw new bo("Invalid URL");return!l9.test(r)||p9.test(r)?new URL(o).href:o}else{let n=new URL(o);if(n.hostname.length!==e.length&&n.hostname!==(e.includes(":")?e.replace(/:\d+$/,""):e).toLowerCase())throw new bo("Invalid host header");return n.href}},m9=t=>t instanceof bo?t:new bo(t.message,{cause:t}),h9=global.Request,cl=class extends h9{constructor(t,e){if(typeof t=="object"&&bs in t){let r=e!==void 0&&"body"in e&&e.body!=null;if(t[gi]&&!r)throw new TypeError("Cannot construct a Request with a Request object that has already been used.");t=t[bs]()}typeof e?.body?.getReader<"u"&&(e.duplex??="half"),super(t,e)}},sD=t=>{let e=[],r=t.rawHeaders;for(let o=0,n=r.length;o<n;o+=2){let i=r[o];i.charCodeAt(0)!==58&&e.push([i,r[o+1]])}return new Headers(e)},aD=Symbol("wrapBodyStream"),g9=(t,e,r,o,n)=>{let i={method:t,headers:r,signal:n.signal};if(t==="TRACE"){i.method="GET";let s=new cl(e,i);return Object.defineProperty(s,"method",{get(){return"TRACE"}}),s}if(!(t==="GET"||t==="HEAD"))if("rawBody"in o&&o.rawBody instanceof Buffer)i.body=new ReadableStream({start(s){s.enqueue(o.rawBody),s.close()}});else if(o[aD]){let s;i.body=new ReadableStream({async pull(a){try{s||=uE.toWeb(o).getReader();let{done:c,value:u}=await s.read();c?a.close():a.enqueue(u)}catch(c){a.error(c)}}})}else i.body=uE.toWeb(o);return new cl(e,i)},bs=Symbol("getRequestCache"),mi=Symbol("requestCache"),ul=Symbol("incomingKey"),Jf=Symbol("urlKey"),cD=Symbol("methodKey"),uD=Symbol("headersKey"),Gf=Symbol("abortControllerKey"),lE=Symbol("getAbortController"),pE=Symbol("abortRequest"),al=Symbol("bodyBuffer"),_y=Symbol("bodyReadPromise"),gi=Symbol("bodyConsumedDirectly"),nD=Symbol("bodyLockReader"),Vf=Symbol("abortReason"),lD=()=>new TypeError("Body is unusable"),Yf=()=>Promise.reject(lD()),y9=new TextDecoder,x9=t=>{if(t[gi])return Yf();t[gi]=!0},_9=t=>t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength),b9=t=>(t[uD]||=sD(t[ul])).get("content-type")||"",v9=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,S9=t=>{if(typeof t!="string"||t.length===0)return"GET";switch(t){case"DELETE":case"GET":case"HEAD":case"OPTIONS":case"POST":case"PUT":return t}let e=t.toUpperCase();switch(e){case"DELETE":case"GET":case"HEAD":case"OPTIONS":case"POST":case"PUT":return e;default:return t}},w9=t=>{if(!v9.test(t))return new TypeError(`'${t}' is not a valid HTTP method.`);let e=t.toUpperCase();if(e==="CONNECT"||e==="TRACK"||e==="TRACE"&&t!=="TRACE")return new TypeError(`'${t}' HTTP method is unsupported.`)},hE=(t,e,r)=>{if(t[gi])return Yf();let o=t.method;if(o==="GET"||o==="HEAD")return t[bs]()[e]();let n=w9(o);if(n)return Promise.reject(n);if(t[mi]&&o!=="TRACE")return t[mi][e]();let i=x9(t);if(i)return i;let s=E9(t);if(s){let a=Promise.resolve(r(s,t));return t[al]=void 0,a}return k9(t).then(a=>{let c=r(a,t);return t[al]=void 0,c})},E9=t=>{let e=t[ul];if("rawBody"in e&&e.rawBody instanceof Buffer)return e.rawBody},k9=t=>{if(t[al])return Promise.resolve(t[al]);if(t[_y])return t[_y];let e=t[ul];if(uE.isDisturbed(e))return Yf();let r=new Promise((o,n)=>{let i=[],s=!1,a=d=>{s||(s=!0,f(),d())},c=d=>{i.push(Buffer.isBuffer(d)?d:Buffer.from(d))},u=()=>{a(()=>{let d=i.length===1?i[0]:Buffer.concat(i);t[al]=d,o(d)})},l=d=>{a(()=>{n(d)})},p=()=>{if(e.readableEnded){u();return}a(()=>{if(e.errored){n(e.errored);return}let d=t[Vf];if(d!==void 0){n(d instanceof Error?d:new Error(String(d)));return}n(new Error("Client connection prematurely closed."))})},f=()=>{e.off("data",c),e.off("end",u),e.off("error",l),e.off("close",p),t[_y]=void 0};e.on("data",c),e.on("end",u),e.on("error",l),e.on("close",p),queueMicrotask(()=>{s||(e.readableEnded?u():e.errored?l(e.errored):e.destroyed&&p())})});return t[_y]=r,r},So={get method(){return this[cD]},get url(){return this[Jf]},get headers(){return this[uD]||=sD(this[ul])},[pE](t){this[Vf]===void 0&&(this[Vf]=t);let e=this[Gf];e&&!e.signal.aborted&&e.abort(t)},[lE](){return this[Gf]||=new AbortController,this[Vf]!==void 0&&!this[Gf].signal.aborted&&this[Gf].abort(this[Vf]),this[Gf]},[bs](){let t=this[lE]();if(this[mi])return this[mi];let e=this.method;if(this[gi]&&!(e==="GET"||e==="HEAD")){this[al]=void 0;let r={method:e==="TRACE"?"GET":e,headers:this.headers,signal:t.signal};e!=="TRACE"&&(r.body=new ReadableStream({start(n){n.close()}}),r.duplex="half");let o=new cl(this[Jf],r);return e==="TRACE"&&Object.defineProperty(o,"method",{get(){return"TRACE"}}),this[mi]=o}return this[mi]=g9(this.method,this[Jf],this.headers,this[ul],t)},get body(){if(!this[gi])return this[bs]().body;let t=this[bs]();return!this[nD]&&t.body&&(this[nD]=t.body.getReader()),t.body},get bodyUsed(){return this[gi]?!0:this[mi]?this[mi].bodyUsed:!1}};Object.defineProperty(So,"signal",{get(){return this[lE]().signal}});["cache","credentials","destination","integrity","mode","redirect","referrer","referrerPolicy","keepalive"].forEach(t=>{Object.defineProperty(So,t,{get(){return this[bs]()[t]}})});["clone","formData"].forEach(t=>{Object.defineProperty(So,t,{value:function(){if(this[gi]){if(t==="clone")throw lD();return Yf()}return this[bs]()[t]()}})});Object.defineProperty(So,"text",{value:function(){return hE(this,"text",t=>y9.decode(t))}});Object.defineProperty(So,"arrayBuffer",{value:function(){return hE(this,"arrayBuffer",t=>_9(t))}});Object.defineProperty(So,"blob",{value:function(){return hE(this,"blob",(t,e)=>{let r=b9(e),o=r?{headers:{"content-type":r}}:void 0;return new Response(t,o).blob()})}});Object.defineProperty(So,"json",{value:function(){return this[gi]?Yf():this.text().then(JSON.parse)}});Object.defineProperty(So,Symbol.for("nodejs.util.inspect.custom"),{value:function(t,e,r){return`Request (lightweight) ${r({method:this.method,url:this.url,headers:this.headers,nativeRequest:this[mi]},{...e,depth:t==null?null:t-1})}`}});Object.setPrototypeOf(So,cl.prototype);var I9=(t,e)=>{let r=Object.create(So);r[ul]=t,r[cD]=S9(t.method);let o=t.url||"";if(o[0]!=="/"&&(o.startsWith("http://")||o.startsWith("https://"))){if(t instanceof Kf)throw new bo("Absolute URL for :path is not allowed in HTTP/2");try{r[Jf]=new URL(o).href}catch(s){throw new bo("Invalid absolute URL",{cause:s})}return r}let n=(t instanceof Kf?t.authority:t.headers.host)||e;if(!n)throw new bo("Missing host header");let i;if(t instanceof Kf){if(i=t.scheme,!(i==="http"||i==="https"))throw new bo("Unsupported scheme")}else i=t.socket&&t.socket.encrypted?"https":"http";try{r[Jf]=f9(i,n,o)}catch(s){throw s instanceof bo?s:new bo("Invalid URL",{cause:s})}return r},_s="text/plain; charset=UTF-8",dE=Symbol("responseCache"),sl=Symbol("getResponseCache"),hi=Symbol("cache"),gE=global.Response,vo=class pD{#t;#e;[sl](){let e=this[hi],r=e&&e[2]instanceof Headers?e[2]:void 0;return delete this[hi],this[dE]||=new gE(this.#t,r?{status:this.#e?.status,statusText:this.#e?.statusText,headers:r}:this.#e)}constructor(e,r){let o;if(this.#t=e,r instanceof pD){let n=r[dE];if(n){this.#e=n,this[sl]();return}else this.#e=r.#e,o=new Headers(r.headers)}else this.#e=r;(e==null||typeof e=="string"||typeof e?.getReader<"u"||e instanceof Blob||e instanceof Uint8Array)&&(this[hi]=[r?.status||200,e??null,o||r?.headers])}get headers(){let e=this[hi];return e?(e[2]instanceof Headers||(e[2]=new Headers(e[2]||(e[1]===null?void 0:{"content-type":_s}))),e[2]):this[sl]().headers}get status(){return this[hi]?.[0]??this[sl]().status}get ok(){let e=this.status;return e>=200&&e<300}};["body","bodyUsed","redirected","statusText","trailers","type","url"].forEach(t=>{Object.defineProperty(vo.prototype,t,{get(){return this[sl]()[t]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach(t=>{Object.defineProperty(vo.prototype,t,{value:function(){return this[sl]()[t]()}})});Object.defineProperty(vo.prototype,Symbol.for("nodejs.util.inspect.custom"),{value:function(t,e,r){return`Response (lightweight) ${r({status:this.status,headers:this.headers,ok:this.ok,nativeResponse:this[dE]},{...e,depth:t==null?null:t-1})}`}});Object.setPrototypeOf(vo,gE);Object.setPrototypeOf(vo.prototype,gE.prototype);var O9=/^https?:\/\/[!#-;=?-[\]_a-z~A-Z]+$/,C9=t=>t instanceof URL?t.href:O9.test(t)?t:new URL(t).href,R9=new Set([301,302,303,307,308]);Object.defineProperty(vo,"redirect",{value:function(e,r=302){if(!R9.has(r))throw new RangeError("Invalid status code");return new vo(null,{status:r,headers:{location:C9(e)}})},writable:!0,configurable:!0});Object.defineProperty(vo,"json",{value:function(e,r){let o=JSON.stringify(e);if(o===void 0)throw new TypeError("The data is not JSON serializable");let n=r?.headers,i;return n?(i=new Headers(n),i.has("content-type")||i.set("content-type","application/json")):i={"content-type":"application/json"},new vo(o,{status:r?.status??200,statusText:r?.statusText,headers:i})},writable:!0,configurable:!0});async function A9(t){return Promise.race([t,Promise.resolve().then(()=>Promise.resolve(void 0))])}function dD(t,e,r){let o=a=>{t.cancel(a).catch(()=>{})};return e.on("close",o),e.on("error",o),(r??t.read()).then(s,n),t.closed.finally(()=>{e.off("close",o),e.off("error",o)});function n(a){a&&e.destroy(a)}function i(){t.read().then(s,n)}function s({done:a,value:c}){try{if(a)e.end();else if(!e.write(c))e.once("drain",i);else return t.read().then(s,n)}catch(u){n(u)}}}function oD(t,e){if(t.locked)throw new TypeError("ReadableStream is locked.");return e.destroyed?void 0:dD(t.getReader(),e)}var fE=(t,e)=>{let r={};if(t instanceof Headers||(t=new Headers(t??void 0)),t.has("set-cookie")){let o=[];for(let[n,i]of t)n==="set-cookie"?o.push(i):r[n]=i;o.length>0&&(r["set-cookie"]=o)}else for(let[o,n]of t)r[o]=n;return e&&(r["content-type"]??=e),r},by=Symbol("outgoingEnded"),iD=Symbol("incomingDraining"),T9=500,$9=64*1024*1024,fD=t=>{let e=t;if(t.destroyed||e[iD])return;if(e[iD]=!0,t instanceof Kf){try{t.stream?.close?.(u9.NGHTTP2_NO_ERROR)}catch{}return}let r=0,o=()=>{clearTimeout(i),t.off("data",s),t.off("end",o),t.off("error",o)},n=()=>{o();let a=t.socket;a&&!a.destroyed&&a.destroySoon()},i=setTimeout(n,T9);i.unref?.();let s=a=>{r+=a.length,r>$9&&n()};t.on("data",s),t.on("end",o),t.on("error",o),t.resume()},P9=(t,e,r,o)=>()=>{e.errored?t[pE](e.errored.toString()):r.writableFinished||t[pE]("Client connection prematurely closed."),o&&!e.readableEnded&&setTimeout(()=>{e.readableEnded||setTimeout(()=>{fD(e)})})},N9=t=>{if(!(hi in t))return!1;let e=t[hi][1];return e===null||typeof e=="string"||e instanceof Uint8Array},M9=()=>new Response(null,{status:400}),mD=t=>new Response(null,{status:t instanceof Error&&(t.name==="TimeoutError"||t.constructor.name==="TimeoutError")?504:500}),vy=(t,e)=>{let r=t instanceof Error?t:new Error("unknown error",{cause:t});r.code==="ERR_STREAM_PREMATURE_CLOSE"?console.info("The user aborted a request."):(console.error(t),e.headersSent||e.writeHead(500,{"Content-Type":"text/plain"}),e.end(`Error: ${r.message}`),e.destroy(r))},mE=t=>{"flushHeaders"in t&&t.writable&&t.flushHeaders()},hD=async(t,e)=>{let[r,o,n]=t[hi];if(!n){o===null?(e.writeHead(r),e.end()):typeof o=="string"?(e.writeHead(r,{"Content-Type":_s,"Content-Length":Buffer.byteLength(o)}),e.end(o)):o instanceof Uint8Array?(e.writeHead(r,{"Content-Type":_s,"Content-Length":o.byteLength}),e.end(o)):o instanceof Blob?(e.writeHead(r,{"Content-Type":_s,"Content-Length":o.size}),e.end(new Uint8Array(await o.arrayBuffer()))):(e.writeHead(r,{"Content-Type":_s}),mE(e),await oD(o,e)?.catch(s=>vy(s,e))),e[by]?.();return}let i=!1;if(n instanceof Headers)i=n.has("content-length"),n=fE(n,o===null?void 0:_s);else if(Array.isArray(n)){let s=new Headers(n);i=s.has("content-length"),n=fE(s,o===null?void 0:_s)}else for(let s in n)if(s.length===14&&s.toLowerCase()==="content-length"){i=!0;break}i||(typeof o=="string"?n["Content-Length"]=Buffer.byteLength(o):o instanceof Uint8Array?n["Content-Length"]=o.byteLength:o instanceof Blob&&(n["Content-Length"]=o.size)),e.writeHead(r,n),o==null?e.end():typeof o=="string"||o instanceof Uint8Array?e.end(o):o instanceof Blob?e.end(new Uint8Array(await o.arrayBuffer())):(mE(e),await oD(o,e)?.catch(s=>vy(s,e))),e[by]?.()},gD=t=>typeof t.then=="function",D9=async(t,e,r={})=>{if(gD(t))if(r.errorHandler)try{t=await t}catch(n){let i=await r.errorHandler(n);if(!i)return;t=i}else t=await t.catch(mD);if(hi in t)return hD(t,e);let o=fE(t.headers,t.body===null?void 0:_s);if(t.body){let n=t.body.getReader(),i=[],s=!1,a;if(o["transfer-encoding"]!=="chunked"){let c=2;for(let u=0;u<c;u++){a||=n.read();let l=await A9(a).catch(p=>{console.error(p),s=!0});if(!l){if(u===1){await new Promise(p=>setTimeout(p)),c=3;continue}break}if(a=void 0,l.value&&i.push(l.value),l.done){s=!0;break}}s&&!("content-length"in o)&&(o["content-length"]=i.reduce((u,l)=>u+l.length,0))}e.writeHead(t.status,o),i.forEach(c=>{e.write(c)}),s?e.end():(i.length===0&&mE(e),await dD(n,e,a))}else o[tD]||(e.writeHead(t.status,o),e.end());e[by]?.()},yD=(t,e={})=>{let r=e.autoCleanupIncoming??!0;return e.overrideGlobalObjects!==!1&&global.Request!==cl&&(Object.defineProperty(global,"Request",{value:cl}),Object.defineProperty(global,"Response",{value:vo})),async(o,n)=>{let i,s,a=!1,c=!1,u=()=>{!s||c||(c=!0,n.on("close",P9(s,o,n,a)))};try{if(s=I9(o,e.hostname),a=r&&!(o.method==="GET"||o.method==="HEAD"),a&&(o[aD]=!0,o instanceof Kf&&(n[by]=()=>{o.readableEnded||setTimeout(()=>{o.readableEnded||setTimeout(()=>{o.destroy(),n.destroy()})})})),i=t(s,{incoming:o,outgoing:n}),!gD(i)&&N9(i))return a&&!o.readableEnded&&n.once("finish",()=>{o.readableEnded||fD(o)}),hD(i,n);u()}catch(l){if(i)return vy(l,n);if(e.errorHandler){if(u(),i=await e.errorHandler(s?l:m9(l)),!i)return}else s?i=mD(l):i=M9()}try{return await D9(i,n,e)}catch(l){return vy(l,n)}}},F9=globalThis.CloseEvent??class extends Event{#t;constructor(t,e={}){super(t,e),this.#t=e}get wasClean(){return this.#t.wasClean??!1}get code(){return this.#t.code??0}get reason(){return this.#t.reason??""}},z9=()=>Symbol("connection"),j9=Symbol("CONNECTION_SYMBOL_KEY"),L9=Symbol("WAIT_FOR_WEBSOCKET_SYMBOL");var obe=rD(async(t,e,r)=>{if(t.req.header("upgrade")?.toLowerCase()!=="websocket")return;let o=t.env,n=o[L9];if(!n||!o.incoming)return new Response(null,{status:500});let i=z9();return o[j9]=i,(async()=>{let s=await n(o.incoming,i),a=[],c=(p,f)=>{a.push([p,f])};s.on("message",c);let u={binaryType:"arraybuffer",close(p,f){s.close(p,f)},protocol:s.protocol,raw:s,get readyState(){return s.readyState},send(p,f){s.send(p,{compress:f?.compress})},url:new URL(t.req.url)};try{e?.onOpen?.(new Event("open"),u)}catch(p){(r?.onError??console.error)(p)}let l=(p,f)=>{let d=Array.isArray(p)?p:[p];for(let m of d)try{e?.onMessage?.(new MessageEvent("message",{data:f?m instanceof ArrayBuffer?m:m.buffer.slice(m.byteOffset,m.byteOffset+m.byteLength):typeof m=="string"?m:Buffer.from(m).toString("utf-8")}),u)}catch(g){(r?.onError??console.error)(g)}};s.off("message",c);for(let p of a)l(...p);s.on("message",(p,f)=>{l(p,f)}),s.on("close",(p,f)=>{try{e?.onClose?.(new F9("close",{code:p,reason:f.toString()}),u)}catch(d){(r?.onError??console.error)(d)}}),s.on("error",p=>{try{e?.onError?.(new ErrorEvent("error",{error:p}),u)}catch(f){(r?.onError??console.error)(f)}})})(),new Response});import{createServer as H_e}from"node:http";import{Readable as U9}from"node:stream";import{versions as q9}from"node:process";var H9=()=>{let[t,e]=q9.node.split(".").map(r=>parseInt(r));return t>=23||t===22&&e>=7||t===20&&e>=18},B9=H9(),yE=(t,e=B9)=>{if(e)return U9.toWeb(t);let r,o=!1,n=()=>{t.off("data",s),t.off("error",a),t.off("end",c),t.off("close",c)},i=u=>{o||(o=!0,n(),u?.())},s=u=>{o||!r||(r.enqueue(u),(r.desiredSize??0)<=0&&t.pause())},a=u=>{i(()=>{r?.error(u)})},c=()=>{i(()=>{r?.close()})};return new ReadableStream({start(u){r=u,t.on("data",s),t.on("error",a),t.on("end",c),t.on("close",c),t.pause()},pull(){o||t.resume()},cancel(){i();let u=()=>{};t.on("error",u),t.once("close",()=>t.off("error",u)),t.destroy()}})};var xD=(t,e=Z9)=>{let r=/\.([a-zA-Z0-9]+?)$/,o=t.match(r);if(o)return e[o[1].toLowerCase()]};var W9={aac:"audio/aac",avi:"video/x-msvideo",avif:"image/avif",av1:"video/av1",bin:"application/octet-stream",bmp:"image/bmp",css:"text/css; charset=utf-8",csv:"text/csv; charset=utf-8",eot:"application/vnd.ms-fontobject",epub:"application/epub+zip",gif:"image/gif",gz:"application/gzip",htm:"text/html; charset=utf-8",html:"text/html; charset=utf-8",ico:"image/x-icon",ics:"text/calendar; charset=utf-8",jpeg:"image/jpeg",jpg:"image/jpeg",js:"text/javascript; charset=utf-8",json:"application/json",jsonld:"application/ld+json",map:"application/json",mid:"audio/x-midi",midi:"audio/x-midi",mjs:"text/javascript; charset=utf-8",mp3:"audio/mpeg",mp4:"video/mp4",mpeg:"video/mpeg",oga:"audio/ogg",ogv:"video/ogg",ogx:"application/ogg",opus:"audio/opus",otf:"font/otf",pdf:"application/pdf",png:"image/png",rtf:"application/rtf",svg:"image/svg+xml; charset=utf-8",tif:"image/tiff",tiff:"image/tiff",ts:"video/mp2t",ttf:"font/ttf",txt:"text/plain; charset=utf-8",wasm:"application/wasm",webm:"video/webm",weba:"audio/webm",webmanifest:"application/manifest+json",webp:"image/webp",woff:"font/woff",woff2:"font/woff2",xhtml:"application/xhtml+xml; charset=utf-8",xml:"application/xml; charset=utf-8",zip:"application/zip","3gp":"video/3gpp","3g2":"video/3gpp2",gltf:"model/gltf+json",glb:"model/gltf-binary"},Z9=W9;import{createReadStream as _D,existsSync as G9,statSync as V9}from"node:fs";import{join as bD}from"node:path";var K9=/^\s*(?:text\/[^;\s]+|application\/(?:javascript|json|xml|xml-dtd|ecmascript|dart|postscript|rtf|tar|toml|vnd\.dart|vnd\.ms-fontobject|vnd\.ms-opentype|wasm|x-httpd-php|x-javascript|x-ns-proxy-autoconfig|x-sh|x-tar|x-virtualbox-hdd|x-virtualbox-ova|x-virtualbox-ovf|x-virtualbox-vbox|x-virtualbox-vdi|x-virtualbox-vhd|x-virtualbox-vmdk|x-www-form-urlencoded)|font\/(?:otf|ttf)|image\/(?:bmp|vnd\.adobe\.photoshop|vnd\.microsoft\.icon|vnd\.ms-dds|x-icon|x-ms-bmp)|message\/rfc822|model\/gltf-binary|x-shader\/x-fragment|x-shader\/x-vertex|[^;\s]+?\+(?:json|text|xml|yaml))(?:[;\s]|$)/i,_E={br:".br",zstd:".zst",gzip:".gz"},J9=Object.keys(_E),xE=t=>{let e;try{e=V9(t)}catch{}return e},Y9=(t,e)=>{try{return e(t)}catch{return t.replace(/(?:%[0-9A-Fa-f]{2})+/g,r=>{try{return e(r)}catch{return r}})}},X9=t=>Y9(t,decodeURI),Sy=(t={root:""})=>{let e=t.root||"",r=t.path;return e!==""&&!G9(e)&&console.error(`serveStatic: root path '${e}' is not found, are you sure it's correct?`),async(o,n)=>{if(o.finalized)return n();let i;if(r)i=r;else try{if(i=X9(o.req.path),/(?:^|[\/\\])\.{1,2}(?:$|[\/\\])|[\/\\]{2,}|\\/.test(i))throw new Error}catch{return await t.onNotFound?.(o.req.path,o),n()}let s=bD(e,!r&&t.rewriteRequestPath?t.rewriteRequestPath(i,o):i),a=xE(s);if(a&&a.isDirectory()){let f=t.index??"index.html";s=bD(s,f),a=xE(s)}if(!a)return await t.onNotFound?.(s,o),n();let c=xD(s);if(o.header("Content-Type",c||"application/octet-stream"),t.precompressed&&(!c||K9.test(c))){let f=new Set(o.req.header("Accept-Encoding")?.split(",").map(d=>d.trim()));for(let d of J9){if(!f.has(d))continue;let m=xE(s+_E[d]);if(m){o.header("Content-Encoding",d),o.header("Vary","Accept-Encoding",{append:!0}),a=m,s=s+_E[d];break}}}let u,l=a.size,p=o.req.header("range")||"";if(o.header("Last-Modified",a.mtime.toUTCString()),o.req.method=="HEAD"||o.req.method=="OPTIONS")o.header("Content-Length",l.toString()),o.status(200),u=o.body(null);else if(!p)o.header("Content-Length",l.toString()),u=o.body(yE(_D(s)),200);else{o.header("Accept-Ranges","bytes");let f=p.replace(/bytes=/,"").split("-",2),d=parseInt(f[0],10)||0,m=parseInt(f[1],10)||l-1;l<m-d+1&&(m=l-1);let g=m-d+1,y=_D(s,{start:d,end:m});o.header("Content-Length",g.toString()),o.header("Content-Range",`bytes ${d}-${m}/${a.size}`),u=o.body(yE(y),206)}return await t.onFound?.(s,o),u}};function wy(t,...e){let r=Object.assign(cn(),t);for(let o of e)for(let n in o){if(n in r&&r[n]!==o[n])throw new Error(`Duplicate key ${n}`);r[n]=o[n]}return r}function er(t){return!!t&&!Array.isArray(t)&&typeof t=="object"}function Ey(t){return typeof t=="function"}function cn(){return Object.create(null)}var Q9=typeof Symbol=="function"&&!!Symbol.asyncIterator;function Xf(t){return Q9&&er(t)&&Symbol.asyncIterator in t}var Qf=t=>t();function vD(t){return t}function SD(t){if(typeof AbortSignal.any=="function")return AbortSignal.any(t);let e=new AbortController;for(let o of t){if(o.aborted){r();break}o.addEventListener("abort",r,{once:!0})}return e.signal;function r(){e.abort();for(let o of t)o.removeEventListener("abort",r)}}var ll={PARSE_ERROR:-32700,BAD_REQUEST:-32600,INTERNAL_SERVER_ERROR:-32603,NOT_IMPLEMENTED:-32603,BAD_GATEWAY:-32603,SERVICE_UNAVAILABLE:-32603,GATEWAY_TIMEOUT:-32603,UNAUTHORIZED:-32001,PAYMENT_REQUIRED:-32002,FORBIDDEN:-32003,NOT_FOUND:-32004,METHOD_NOT_SUPPORTED:-32005,TIMEOUT:-32008,CONFLICT:-32009,PRECONDITION_FAILED:-32012,PAYLOAD_TOO_LARGE:-32013,UNSUPPORTED_MEDIA_TYPE:-32015,UNPROCESSABLE_CONTENT:-32022,PRECONDITION_REQUIRED:-32028,TOO_MANY_REQUESTS:-32029,CLIENT_CLOSED_REQUEST:-32099},wD={[-32700]:"PARSE_ERROR",[-32600]:"BAD_REQUEST",[-32603]:"INTERNAL_SERVER_ERROR",[-32001]:"UNAUTHORIZED",[-32002]:"PAYMENT_REQUIRED",[-32003]:"FORBIDDEN",[-32004]:"NOT_FOUND",[-32005]:"METHOD_NOT_SUPPORTED",[-32008]:"TIMEOUT",[-32009]:"CONFLICT",[-32012]:"PRECONDITION_FAILED",[-32013]:"PAYLOAD_TOO_LARGE",[-32015]:"UNSUPPORTED_MEDIA_TYPE",[-32022]:"UNPROCESSABLE_CONTENT",[-32028]:"PRECONDITION_REQUIRED",[-32029]:"TOO_MANY_REQUESTS",[-32099]:"CLIENT_CLOSED_REQUEST"},xbe=[ll.BAD_GATEWAY,ll.SERVICE_UNAVAILABLE,ll.GATEWAY_TIMEOUT,ll.INTERNAL_SERVER_ERROR];var eY=Object.create,ID=Object.defineProperty,tY=Object.getOwnPropertyDescriptor,OD=Object.getOwnPropertyNames,rY=Object.getPrototypeOf,nY=Object.prototype.hasOwnProperty,Ir=(t,e)=>function(){return e||(0,t[OD(t)[0]])((e={exports:{}}).exports,e),e.exports},oY=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(var n=OD(e),i=0,s=n.length,a;i<s;i++)a=n[i],!nY.call(t,a)&&a!==r&&ID(t,a,{get:(c=>e[c]).bind(null,a),enumerable:!(o=tY(e,a))||o.enumerable});return t},Fe=(t,e,r)=>(r=t!=null?eY(rY(t)):{},oY(e||!t||!t.__esModule?ID(r,"default",{value:t,enumerable:!0}):r,t)),iY=()=>{},ED=t=>{Object.freeze&&Object.freeze(t)};function CD(t,e,r){var o;let n=e.join(".");return(o=r[n])!==null&&o!==void 0||(r[n]=new Proxy(iY,{get(i,s){if(!(typeof s!="string"||s==="then"))return CD(t,[...e,s],r)},apply(i,s,a){let c=e[e.length-1];if(c==="valueOf"||c==="toString"||c==="toJSON")return`tRPC.proxy(${e.slice(0,-1).join(".")})`;let u={args:a,path:e};return c==="call"?u={args:a.length>=2?[a[1]]:[],path:e.slice(0,-1)}:c==="apply"&&(u={args:a.length>=2?a[1]:[],path:e.slice(0,-1)}),ED(u.args),ED(u.path),t(u)}})),r[n]}var RD=t=>CD(t,[],cn());var sY={PARSE_ERROR:400,BAD_REQUEST:400,UNAUTHORIZED:401,PAYMENT_REQUIRED:402,FORBIDDEN:403,NOT_FOUND:404,METHOD_NOT_SUPPORTED:405,TIMEOUT:408,CONFLICT:409,PRECONDITION_FAILED:412,PAYLOAD_TOO_LARGE:413,UNSUPPORTED_MEDIA_TYPE:415,UNPROCESSABLE_CONTENT:422,PRECONDITION_REQUIRED:428,TOO_MANY_REQUESTS:429,CLIENT_CLOSED_REQUEST:499,INTERNAL_SERVER_ERROR:500,NOT_IMPLEMENTED:501,BAD_GATEWAY:502,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504};function AD(t){var e;return(e=sY[t])!==null&&e!==void 0?e:500}function TD(t){let e=Array.isArray(t)?t:[t],r=new Set(e.map(n=>{if("error"in n&&er(n.error.data)){var i;if(typeof((i=n.error.data)===null||i===void 0?void 0:i.httpStatus)=="number")return n.error.data.httpStatus;let s=wD[n.error.code];return AD(s)}return 200}));return r.size!==1?207:r.values().next().value}function aY(t){return AD(t.code)}var $D=Ir({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(t,e){function r(o){"@babel/helpers - typeof";return e.exports=r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},e.exports.__esModule=!0,e.exports.default=e.exports,r(o)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),cY=Ir({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(t,e){var r=$D().default;function o(n,i){if(r(n)!="object"||!n)return n;var s=n[Symbol.toPrimitive];if(s!==void 0){var a=s.call(n,i||"default");if(r(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(i==="string"?String:Number)(n)}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}}),uY=Ir({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(t,e){var r=$D().default,o=cY();function n(i){var s=o(i,"string");return r(s)=="symbol"?s:s+""}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}}),Wa=Ir({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,e){var r=uY();function o(n,i,s){return(i=r(i))in n?Object.defineProperty(n,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):n[i]=s,n}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}}),un=Ir({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(t,e){var r=Wa();function o(i,s){var a=Object.keys(i);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(i);s&&(c=c.filter(function(u){return Object.getOwnPropertyDescriptor(i,u).enumerable})),a.push.apply(a,c)}return a}function n(i){for(var s=1;s<arguments.length;s++){var a=arguments[s]!=null?arguments[s]:{};s%2?o(Object(a),!0).forEach(function(c){r(i,c,a[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(a)):o(Object(a)).forEach(function(c){Object.defineProperty(i,c,Object.getOwnPropertyDescriptor(a,c))})}return i}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}}),kD=Fe(un(),1);function Za(t){let{path:e,error:r,config:o}=t,{code:n}=t.error,i={message:r.message,code:ll[n],data:{code:n,httpStatus:aY(r)}};return o.isDev&&typeof t.error.stack=="string"&&(i.data.stack=t.error.stack),typeof e=="string"&&(i.data.path=e),o.errorFormatter((0,kD.default)((0,kD.default)({},t),{},{shape:i}))}var dl=({shape:t})=>t,PD=Fe(Wa(),1),lY=class extends Error{constructor(t){super(pY(t)),Object.assign(this,t)}};function pY(t){if("message"in t)return String(t.message)}function dY(t){if(t instanceof Error)return t;let e=typeof t;if(!(e==="undefined"||e==="function"||t===null)){if(e!=="object")return new Error(String(t));if(er(t))return new lY(t)}}function Rn(t){if(t instanceof nt||t instanceof Error&&t.name==="TRPCError")return t;let e=new nt({code:"INTERNAL_SERVER_ERROR",cause:t});return t instanceof Error&&t.stack&&(e.stack=t.stack),e}var nt=class extends Error{constructor(t){var e,r,o;let n=dY(t.cause),i=(e=(r=t.message)!==null&&r!==void 0?r:n?.message)!==null&&e!==void 0?e:t.code;super(i,{cause:n}),(0,PD.default)(this,"cause",void 0),(0,PD.default)(this,"code",void 0),this.code=t.code,this.name="TRPCError",(o=this.cause)!==null&&o!==void 0||(this.cause=n)}},pl=Fe(un(),1);function MD(t){return"input"in t?t:{input:t,output:t}}var fl={input:{serialize:t=>t,deserialize:t=>t},output:{serialize:t=>t,deserialize:t=>t}};function ND(t,e){return"error"in e?(0,pl.default)((0,pl.default)({},e),{},{error:t.transformer.output.serialize(e.error)}):"data"in e.result?(0,pl.default)((0,pl.default)({},e),{},{result:(0,pl.default)((0,pl.default)({},e.result),{},{data:t.transformer.output.serialize(e.result.data)})}):e}function Iy(t,e){return Array.isArray(e)?e.map(r=>ND(t,r)):ND(t,e)}var ky=Fe(un(),1),fY="lazyMarker";function mY(t){let e=Symbol(),r=e;return()=>(r===e&&(r=t()),r)}function hY(t){return typeof t=="function"&&fY in t}function gY(t){return er(t)&&er(t._def)&&"router"in t._def}var yY={_ctx:null,_errorShape:null,_meta:null,queries:{},mutations:{},subscriptions:{},errorFormatter:dl,transformer:fl},xY=["then","call","apply"];function bE(t){function e(r){let o=new Set(Object.keys(r).filter(p=>xY.includes(p)));if(o.size>0)throw new Error("Reserved words used in `router({})` call: "+Array.from(o).join(", "));let n=cn(),i=cn();function s(p){return{ref:p.ref,load:mY(async()=>{let f=await p.ref(),d=[...p.path,p.key],m=d.join(".");p.aggregate[p.key]=a(f._def.record,d),delete i[m];for(let[g,y]of Object.entries(f._def.lazy)){let v=[...d,g].join(".");i[v]=s({ref:y.ref,path:d,key:g,aggregate:p.aggregate[p.key]})}})}}function a(p,f=[]){let d=cn();for(let[m,g]of Object.entries(p??{})){if(hY(g)){i[[...f,m].join(".")]=s({path:f,ref:g,key:m,aggregate:d});continue}if(gY(g)){d[m]=a(g._def.record,[...f,m]);continue}if(!_Y(g)){d[m]=a(g,[...f,m]);continue}let y=[...f,m].join(".");if(n[y])throw new Error(`Duplicate key: ${y}`);n[y]=g,d[m]=g}return d}let c=a(r),u=(0,ky.default)((0,ky.default)({_config:t,router:!0,procedures:n,lazy:i},yY),{},{record:c});return(0,ky.default)((0,ky.default)({},c),{},{_def:u,createCaller:vE()({_def:u})})}return e}function _Y(t){return typeof t=="function"}async function em(t,e){let{_def:r}=t,o=r.procedures[e];for(;!o;){let n=Object.keys(r.lazy).find(s=>e.startsWith(s));if(!n)return null;await r.lazy[n].load(),o=r.procedures[e]}return o}function vE(){return function(e){let{_def:r}=e;return function(n,i){return RD(async s=>{let{path:a,args:c}=s,u=a.join(".");if(a.length===1&&a[0]==="_def")return r;let l=await em(e,u),p;try{if(!l)throw new nt({code:"NOT_FOUND",message:`No procedure found on path "${a}"`});return p=Ey(n)?await Promise.resolve(n()):n,await l({path:u,getRawInput:async()=>c[0],ctx:p,type:l._def.type,signal:i?.signal,batchIndex:0})}catch(m){var f,d;throw i==null||(f=i.onError)===null||f===void 0||f.call(i,{ctx:p,error:Rn(m),input:c[0],path:u,type:(d=l?._def.type)!==null&&d!==void 0?d:"unknown"}),m}})}}}function DD(...t){var e,r;let o=wy({},...t.map(a=>a._def.record)),n=t.reduce((a,c)=>{if(c._def._config.errorFormatter&&c._def._config.errorFormatter!==dl){if(a!==dl&&a!==c._def._config.errorFormatter)throw new Error("You seem to have several error formatters");return c._def._config.errorFormatter}return a},dl),i=t.reduce((a,c)=>{if(c._def._config.transformer&&c._def._config.transformer!==fl){if(a!==fl&&a!==c._def._config.transformer)throw new Error("You seem to have several transformers");return c._def._config.transformer}return a},fl);return bE({errorFormatter:n,transformer:i,isDev:t.every(a=>a._def._config.isDev),allowOutsideOfServer:t.every(a=>a._def._config.allowOutsideOfServer),isServer:t.every(a=>a._def._config.isServer),$types:(e=t[0])===null||e===void 0?void 0:e._def._config.$types,sse:(r=t[0])===null||r===void 0?void 0:r._def._config.sse})(o)}var bY=Symbol();function FD(t){return Array.isArray(t)&&t[2]===bY}function Oy(t){return typeof t=="object"&&t!==null&&"subscribe"in t}function vY(t,e){let r=null,o=()=>{r?.unsubscribe(),r=null,e.removeEventListener("abort",o)};return new ReadableStream({start(n){r=t.subscribe({next(i){n.enqueue({ok:!0,value:i})},error(i){n.enqueue({ok:!1,error:i}),n.close()},complete(){n.close()}}),e.aborted?o():e.addEventListener("abort",o,{once:!0})},cancel(){o()}})}function SE(t,e){let o=vY(t,e).getReader(),n={async next(){let i=await o.read();if(i.done)return{value:void 0,done:!0};let{value:s}=i;if(!s.ok)throw s.error;return{value:s.value,done:!1}},async return(){return await o.cancel(),{value:void 0,done:!0}}};return{[Symbol.asyncIterator](){return n}}}function SY(t){try{if(t===null)return null;if(!er(t))throw new Error("Expected object");let e=Object.entries(t).filter(([r,o])=>typeof o!="string");if(e.length>0)throw new Error(`Expected connectionParams to be string values. Got ${e.map(([r,o])=>`${r}: ${typeof o}`).join(", ")}`);return t}catch(e){throw new nt({code:"PARSE_ERROR",message:"Invalid connection params shape",cause:e})}}function wY(t){let e;try{e=JSON.parse(t)}catch(r){throw new nt({code:"PARSE_ERROR",message:"Not JSON-parsable query params",cause:r})}return SY(e)}var zD=Fe(un(),1);function QD(t){var e,r;return(e=t.get("trpc-accept"))!==null&&e!==void 0?e:!((r=t.get("accept"))===null||r===void 0)&&r.split(",").some(o=>o.trim()==="application/jsonl")?"application/jsonl":null}function RE(t){let e=null,r=Symbol.for("@trpc/server/http/memo"),o=r;return{read:async()=>{var n;return o!==r||((n=e)!==null&&n!==void 0||(e=t().catch(i=>{throw i instanceof nt?i:new nt({code:"BAD_REQUEST",message:i instanceof Error?i.message:"Invalid input",cause:i})})),o=await e,e=null),o},result:()=>o!==r?o:void 0}}var eF={isMatch(t){var e;return!!(!((e=t.headers.get("content-type"))===null||e===void 0)&&e.startsWith("application/json"))},async parse(t){var e;let{req:r}=t,o=t.searchParams.get("batch")==="1",n=t.maxBatchSize,i=o?t.path.split(","):[t.path];if(o&&typeof n=="number"&&i.length>n)throw new nt({code:"BAD_REQUEST",message:"Batch call exceeds maximum size"});let s=RE(async()=>{let f;if(r.method==="GET"){let m=t.searchParams.get("input");m&&(f=JSON.parse(m))}else f=await r.json();if(f===void 0)return cn();if(!o){let m=cn();return m[0]=t.router._def._config.transformer.input.deserialize(f),m}if(!er(f))throw new nt({code:"BAD_REQUEST",message:'"input" needs to be an object when doing a batch call'});let d=cn();for(let m of i.keys()){let g=f[m];g!==void 0&&(d[m]=t.router._def._config.transformer.input.deserialize(g))}return d}),a=await Promise.all(i.map(async(f,d)=>{let m=await em(t.router,f);return{batchIndex:d,path:f,procedure:m,getRawInput:async()=>{let y=(await s.read())[d];if(m?._def.type==="subscription"){var v,E;let S=(v=(E=t.headers.get("last-event-id"))!==null&&E!==void 0?E:t.searchParams.get("lastEventId"))!==null&&v!==void 0?v:t.searchParams.get("Last-Event-Id");if(S)if(er(y))y=(0,zD.default)((0,zD.default)({},y),{},{lastEventId:S});else{var R;(R=y)!==null&&R!==void 0||(y={lastEventId:S})}}return y},result:()=>{var g;return(g=s.result())===null||g===void 0?void 0:g[d]}}})),c=new Set(a.map(f=>{var d;return(d=f.procedure)===null||d===void 0?void 0:d._def.type}).filter(Boolean));if(c.size>1)throw new nt({code:"BAD_REQUEST",message:`Cannot mix procedure types in call: ${Array.from(c).join(", ")}`});let u=(e=c.values().next().value)!==null&&e!==void 0?e:"unknown",l=t.searchParams.get("connectionParams");return{isBatchCall:o,accept:QD(r.headers),calls:a,type:u,connectionParams:l===null?null:wY(l),signal:r.signal,url:t.url}}},EY={isMatch(t){var e;return!!(!((e=t.headers.get("content-type"))===null||e===void 0)&&e.startsWith("multipart/form-data"))},async parse(t){let{req:e}=t;if(e.method!=="POST")throw new nt({code:"METHOD_NOT_SUPPORTED",message:"Only POST requests are supported for multipart/form-data requests"});let r=RE(async()=>await e.formData()),o=await em(t.router,t.path);return{accept:null,calls:[{batchIndex:0,path:t.path,getRawInput:r.read,result:r.result,procedure:o}],isBatchCall:!1,type:"mutation",connectionParams:null,signal:e.signal,url:t.url}}},kY={isMatch(t){var e;return!!(!((e=t.headers.get("content-type"))===null||e===void 0)&&e.startsWith("application/octet-stream"))},async parse(t){let{req:e}=t;if(e.method!=="POST")throw new nt({code:"METHOD_NOT_SUPPORTED",message:"Only POST requests are supported for application/octet-stream requests"});let r=RE(async()=>e.body);return{calls:[{batchIndex:0,path:t.path,getRawInput:r.read,result:r.result,procedure:await em(t.router,t.path)}],isBatchCall:!1,accept:null,type:"mutation",connectionParams:null,signal:e.signal,url:t.url}}},IY=[eF,EY,kY];function OY(t){let e=IY.find(r=>r.isMatch(t));if(e)return e;if(!e&&t.method==="GET")return eF;throw new nt({code:"UNSUPPORTED_MEDIA_TYPE",message:t.headers.has("content-type")?`Unsupported content-type "${t.headers.get("content-type")}`:"Missing content-type header"})}async function CY(t){return await OY(t.req).parse(t)}function RY(t){return er(t)&&t.name==="AbortError"}function AY(t="AbortError"){throw new DOMException(t,"AbortError")}function jD(t){return Object.prototype.toString.call(t)==="[object Object]"}function TY(t){var e,r;return jD(t)===!1?!1:(e=t.constructor,e===void 0?!0:(r=e.prototype,!(jD(r)===!1||r.hasOwnProperty("isPrototypeOf")===!1)))}var Cy=Fe(Wa(),1),tF,wE=new WeakMap,$Y=()=>{};tF=Symbol.toStringTag;var AE=class Ga{constructor(e){(0,Cy.default)(this,"promise",void 0),(0,Cy.default)(this,"subscribers",[]),(0,Cy.default)(this,"settlement",null),(0,Cy.default)(this,tF,"Unpromise"),typeof e=="function"?this.promise=new Promise(e):this.promise=e;let r=this.promise.then(o=>{let{subscribers:n}=this;this.subscribers=null,this.settlement={status:"fulfilled",value:o},n?.forEach(({resolve:i})=>{i(o)})});"catch"in r&&r.catch(o=>{let{subscribers:n}=this;this.subscribers=null,this.settlement={status:"rejected",reason:o},n?.forEach(({reject:i})=>{i(o)})})}subscribe(){let e,r,{settlement:o}=this;if(o===null){if(this.subscribers===null)throw new Error("Unpromise settled but still has subscribers");let n=NY();this.subscribers=MY(this.subscribers,n),e=n.promise,r=()=>{this.subscribers!==null&&(this.subscribers=FY(this.subscribers,n))}}else{let{status:n}=o;n==="fulfilled"?e=Promise.resolve(o.value):e=Promise.reject(o.reason),r=$Y}return Object.assign(e,{unsubscribe:r})}then(e,r){let o=this.subscribe(),{unsubscribe:n}=o;return Object.assign(o.then(e,r),{unsubscribe:n})}catch(e){let r=this.subscribe(),{unsubscribe:o}=r;return Object.assign(r.catch(e),{unsubscribe:o})}finally(e){let r=this.subscribe(),{unsubscribe:o}=r;return Object.assign(r.finally(e),{unsubscribe:o})}static proxy(e){let r=Ga.getSubscribablePromise(e);return typeof r<"u"?r:Ga.createSubscribablePromise(e)}static createSubscribablePromise(e){let r=new Ga(e);return wE.set(e,r),wE.set(r,r),r}static getSubscribablePromise(e){return wE.get(e)}static resolve(e){let r=typeof e=="object"&&e!==null&&"then"in e&&typeof e.then=="function"?e:Promise.resolve(e);return Ga.proxy(r).subscribe()}static async any(e){let o=(Array.isArray(e)?e:[...e]).map(Ga.resolve);try{return await Promise.any(o)}finally{o.forEach(({unsubscribe:n})=>{n()})}}static async race(e){let o=(Array.isArray(e)?e:[...e]).map(Ga.resolve);try{return await Promise.race(o)}finally{o.forEach(({unsubscribe:n})=>{n()})}}static async raceReferences(e){let r=e.map(PY);try{return await Promise.race(r)}finally{for(let o of r)o.unsubscribe()}}};function PY(t){return AE.proxy(t).then(()=>[t])}function NY(){let t,e;return{promise:new Promise((o,n)=>{t=o,e=n}),resolve:t,reject:e}}function MY(t,e){return[...t,e]}function DY(t,e){return[...t.slice(0,e),...t.slice(e+1)]}function FY(t,e){let r=t.indexOf(e);return r!==-1?DY(t,r):t}var LD,UD,qD,HD;(UD=(LD=Symbol).dispose)!==null&&UD!==void 0||(LD.dispose=Symbol());(HD=(qD=Symbol).asyncDispose)!==null&&HD!==void 0||(qD.asyncDispose=Symbol());function zY(t,e){let r=t,o=r[Symbol.dispose];return r[Symbol.dispose]=()=>{e(),o?.()},r}function rF(t,e){let r=t,o=r[Symbol.asyncDispose];return r[Symbol.asyncDispose]=async()=>{await e(),await o?.()},r}var TE=Symbol();function nF(t){let e=null;return zY({start(){if(e)throw new Error("Timer already started");return new Promise(o=>{e=setTimeout(()=>o(TE),t)})}},()=>{e&&clearTimeout(e)})}var om=Ir({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(t,e){function r(){var o=typeof SuppressedError=="function"?SuppressedError:function(a,c){var u=Error();return u.name="SuppressedError",u.error=a,u.suppressed=c,u},n={},i=[];function s(a,c){if(c!=null){if(Object(c)!==c)throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(a)var u=c[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(u===void 0&&(u=c[Symbol.dispose||Symbol.for("Symbol.dispose")],a))var l=u;if(typeof u!="function")throw new TypeError("Object is not disposable.");l&&(u=function(){try{l.call(c)}catch(f){return Promise.reject(f)}}),i.push({v:c,d:u,a})}else a&&i.push({d:c,a});return c}return{e:n,u:s.bind(null,!1),a:s.bind(null,!0),d:function(){var c,u=this.e,l=0;function p(){for(;c=i.pop();)try{if(!c.a&&l===1)return l=0,i.push(c),Promise.resolve().then(p);if(c.d){var d=c.d.call(c.v);if(c.a)return l|=2,Promise.resolve(d).then(p,f)}else l|=1}catch(m){return f(m)}if(l===1)return u!==n?Promise.reject(u):Promise.resolve();if(u!==n)throw u}function f(d){return u=u!==n?new o(d,u):d,p()}return p()}}}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),$E=Ir({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js"(t,e){function r(o,n){this.v=o,this.k=n}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),im=Ir({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(t,e){var r=$E();function o(n){return new r(n,0)}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}}),ml=Ir({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(t,e){var r=$E();function o(i){return function(){return new n(i.apply(this,arguments))}}function n(i){var s,a;function c(l,p){try{var f=i[l](p),d=f.value,m=d instanceof r;Promise.resolve(m?d.v:d).then(function(g){if(m){var y=l==="return"?"return":"next";if(!d.k||g.done)return c(y,g);g=i[y](g).value}u(f.done?"return":"normal",g)},function(g){c("throw",g)})}catch(g){u("throw",g)}}function u(l,p){switch(l){case"return":s.resolve({value:p,done:!0});break;case"throw":s.reject(p);break;default:s.resolve({value:p,done:!1})}(s=s.next)?c(s.key,s.arg):a=null}this._invoke=function(l,p){return new Promise(function(f,d){var m={key:l,arg:p,resolve:f,reject:d,next:null};a?a=a.next=m:(s=a=m,c(l,p))})},typeof i.return!="function"&&(this.return=void 0)}n.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},n.prototype.next=function(i){return this._invoke("next",i)},n.prototype.throw=function(i){return this._invoke("throw",i)},n.prototype.return=function(i){return this._invoke("return",i)},e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}}),jY=Fe(om(),1),BD=Fe(im(),1),LY=Fe(ml(),1);function PE(t){let e=t[Symbol.asyncIterator]();return e[Symbol.asyncDispose]?e:rF(e,async()=>{var r;await((r=e.return)===null||r===void 0?void 0:r.call(e))})}function UY(t,e){return IE.apply(this,arguments)}function IE(){return IE=(0,LY.default)(function*(t,e){try{var r=(0,jY.default)();let o=r.a(PE(t)),n,i=r.u(nF(e.gracePeriodMs)),s=e.count,a=new Promise(()=>{});for(;;){if(n=yield(0,BD.default)(AE.race([o.next(),a])),n===TE&&AY(),n.done)return n.value;yield n.value,--s===0&&(a=i.start()),n=null}}catch(o){r.e=o}finally{yield(0,BD.default)(r.d())}}),IE.apply(this,arguments)}function WD(){let t,e;return{promise:new Promise((o,n)=>{t=o,e=n}),resolve:t,reject:e}}var qY=Fe(om(),1),ZD=Fe(im(),1),HY=Fe(ml(),1);function BY(t,e){let r=t[Symbol.asyncIterator](),o="idle";function n(){o="done",e=()=>{}}function i(){if(o!=="idle")return;o="pending",r.next().then(a=>{if(a.done){o="done",e({status:"return",value:a.value}),n();return}o="idle",e({status:"yield",value:a.value})}).catch(a=>{e({status:"error",error:a}),n()})}return{pull:i,destroy:async()=>{var s;n(),await((s=r.return)===null||s===void 0?void 0:s.call(r))}}}function WY(){let t="idle",e=WD(),r=[],o=new Set,n=[];function i(s){if(t!=="pending")return;let a=BY(s,c=>{if(t==="pending"){switch(c.status){case"yield":n.push([a,c]);break;case"return":o.delete(a);break;case"error":n.push([a,c]),o.delete(a);break}e.resolve()}});o.add(a),a.pull()}return{add(s){switch(t){case"idle":r.push(s);break;case"pending":i(s);break;case"done":break}},[Symbol.asyncIterator](){return(0,HY.default)(function*(){try{var s=(0,qY.default)();if(t!=="idle")throw new Error("Cannot iterate twice");t="pending";let a=s.a(rF({},async()=>{t="done";let c=[];if(await Promise.all(Array.from(o.values()).map(async u=>{try{await u.destroy()}catch(l){c.push(l)}})),n.length=0,o.clear(),e.resolve(),c.length>0)throw new AggregateError(c)}));for(;r.length>0;)i(r.shift());for(;o.size>0;){for(yield(0,ZD.default)(e.promise);n.length>0;){let[c,u]=n.shift();switch(u.status){case"yield":yield u.value,c.pull();break;case"error":throw u.error}}e=WD()}}catch(a){s.e=a}finally{yield(0,ZD.default)(s.d())}})()}}}function oF(t){let e=t[Symbol.asyncIterator]();return new ReadableStream({async cancel(){var r;await((r=e.return)===null||r===void 0?void 0:r.call(e))},async pull(r){let o=await e.next();if(o.done){r.close();return}r.enqueue(o.value)}})}var GD=Fe(om(),1),VD=Fe(im(),1),ZY=Fe(ml(),1),nm=Symbol("ping");function iF(t,e){return OE.apply(this,arguments)}function OE(){return OE=(0,ZY.default)(function*(t,e){try{var r=(0,GD.default)();let n=r.a(PE(t)),i,s=n.next();for(;;)try{var o=(0,GD.default)();let a=o.u(nF(e));if(i=yield(0,VD.default)(AE.race([s,a.start()])),i===TE){yield nm;continue}if(i.done)return i.value;s=n.next(),yield i.value,i=null}catch(a){o.e=a}finally{o.d()}}catch(n){r.e=n}finally{yield(0,VD.default)(r.d())}}),OE.apply(this,arguments)}var sF=Ir({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(t,e){function r(n){var i,s,a,c=2;for(typeof Symbol<"u"&&(s=Symbol.asyncIterator,a=Symbol.iterator);c--;){if(s&&(i=n[s])!=null)return i.call(n);if(a&&(i=n[a])!=null)return new o(i.call(n));s="@@asyncIterator",a="@@iterator"}throw new TypeError("Object is not async iterable")}function o(n){function i(s){if(Object(s)!==s)return Promise.reject(new TypeError(s+" is not an object."));var a=s.done;return Promise.resolve(s.value).then(function(c){return{value:c,done:a}})}return o=function(a){this.s=a,this.n=a.next},o.prototype={s:null,n:null,next:function(){return i(this.n.apply(this.s,arguments))},return:function(a){var c=this.s.return;return c===void 0?Promise.resolve({value:a,done:!0}):i(c.apply(this.s,arguments))},throw:function(a){var c=this.s.return;return c===void 0?Promise.reject(a):i(c.apply(this.s,arguments))}},new o(n)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),tm=Fe(im(),1),EE=Fe(ml(),1),GY=Fe(om(),1),VY=Fe(sF(),1),KY=0,JY=1,YY=0,XY=1,QY=0,e8=1,t8=2;function aF(t){return(er(t)||Ey(t))&&typeof t?.then=="function"&&typeof t?.catch=="function"}var r8=class extends Error{constructor(t){super("Max depth reached at path: "+t.join(".")),this.path=t}};function n8(t){return CE.apply(this,arguments)}function CE(){return CE=(0,EE.default)(function*(t){let{data:e}=t,r=0,o=0,n=WY();function i(E){let R=r++,S=E(R);return n.add(S),R}function s(E,R){return i((function(){var S=(0,EE.default)(function*(P){let D=c(R);D&&(E.catch(ie=>{var ue;(ue=t.onError)===null||ue===void 0||ue.call(t,{error:ie,path:R})}),E=Promise.reject(D));try{let ie=yield(0,tm.default)(E);yield[P,YY,l(ie,R)]}catch(ie){var X,N;(X=t.onError)===null||X===void 0||X.call(t,{error:ie,path:R}),yield[P,XY,(N=t.formatError)===null||N===void 0?void 0:N.call(t,{error:ie,path:R})]}});return function(P){return S.apply(this,arguments)}})())}function a(E,R){return i((function(){var S=(0,EE.default)(function*(P){try{var D=(0,GY.default)();let ie=c(R);if(ie)throw ie;let ue=D.a(PE(E));try{for(;;){let W=yield(0,tm.default)(ue.next());if(W.done){yield[P,QY,l(W.value,R)];break}yield[P,e8,l(W.value,R)]}}catch(W){var X,N;(X=t.onError)===null||X===void 0||X.call(t,{error:W,path:R}),yield[P,t8,(N=t.formatError)===null||N===void 0?void 0:N.call(t,{error:W,path:R})]}}catch(ie){D.e=ie}finally{yield(0,tm.default)(D.d())}});return function(P){return S.apply(this,arguments)}})())}function c(E){return t.maxDepth&&E.length>t.maxDepth?new r8(E):null}function u(E,R){if(aF(E))return[KY,s(E,R)];if(Xf(E)){if(t.maxDepth&&R.length>=t.maxDepth)throw new Error("Max depth reached");return[JY,a(E,R)]}return null}function l(E,R){if(E===void 0)return[[]];let S=u(E,R);if(S)return[[o],[null,...S]];if(!TY(E))return[[E]];let P=cn(),D=[];for(let[X,N]of Object.entries(E)){let ie=u(N,[...R,X]);if(!ie){P[X]=N;continue}P[X]=o,D.push([X,...ie])}return[[P],...D]}let p=cn();for(let[E,R]of Object.entries(e))p[E]=l(R,[E]);yield p;let f=n;t.pingMs&&(f=iF(n,t.pingMs));var d=!1,m=!1,g;try{for(var y=(0,VY.default)(f),v;d=!(v=yield(0,tm.default)(y.next())).done;d=!1)yield v.value}catch(E){m=!0,g=E}finally{try{d&&y.return!=null&&(yield(0,tm.default)(y.return()))}finally{if(m)throw g}}}),CE.apply(this,arguments)}function o8(t){let e=oF(n8(t)),{serialize:r}=t;return r&&(e=e.pipeThrough(new TransformStream({transform(o,n){o===nm?n.enqueue(nm):n.enqueue(r(o))}}))),e.pipeThrough(new TransformStream({transform(o,n){o===nm?n.enqueue(" "):n.enqueue(JSON.stringify(o)+`
|
|
10
|
+
`)}})).pipeThrough(new TextEncoderStream)}var i8=Ir({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncGeneratorDelegate.js"(t,e){var r=$E();function o(n){var i={},s=!1;function a(c,u){return s=!0,u=new Promise(function(l){l(n[c](u))}),{done:!1,value:new r(u,1)}}return i[typeof Symbol<"u"&&Symbol.iterator||"@@iterator"]=function(){return this},i.next=function(c){return s?(s=!1,c):a("next",c)},typeof n.throw=="function"&&(i.throw=function(c){if(s)throw s=!1,c;return a("throw",c)}),typeof n.return=="function"&&(i.return=function(c){return s?(s=!1,c):a("return",c)}),i}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}}),KD=Fe(sF(),1),JD=Fe(im(),1),YD=Fe(ml(),1),s8=Fe(i8(),1),$be=Fe(om(),1),a8="ping",c8="serialized-error",u8="connected",l8="return";function p8(t){var e,r,o,n,i;let{serialize:s=vD}=t,a={enabled:(e=(r=t.ping)===null||r===void 0?void 0:r.enabled)!==null&&e!==void 0?e:!1,intervalMs:(o=(n=t.ping)===null||n===void 0?void 0:n.intervalMs)!==null&&o!==void 0?o:1e3},c=(i=t.client)!==null&&i!==void 0?i:{};if(a.enabled&&c.reconnectAfterInactivityMs&&a.intervalMs>c.reconnectAfterInactivityMs)throw new Error(`Ping interval must be less than client reconnect interval to prevent unnecessary reconnection - ping.intervalMs: ${a.intervalMs} client.reconnectAfterInactivityMs: ${c.reconnectAfterInactivityMs}`);function u(){return l.apply(this,arguments)}function l(){return l=(0,YD.default)(function*(){yield{event:u8,data:JSON.stringify(c)};let m=t.data;t.emitAndEndImmediately&&(m=UY(m,{count:1,gracePeriodMs:1})),a.enabled&&a.intervalMs!==1/0&&a.intervalMs>0&&(m=iF(m,a.intervalMs));let g,y;var v=!1,E=!1,R;try{for(var S=(0,KD.default)(m),P;v=!(P=yield(0,JD.default)(S.next())).done;v=!1){g=P.value;{if(g===nm){yield{event:a8,data:""};continue}y=FD(g)?{id:g[0],data:g[1]}:{data:g},y.data=JSON.stringify(s(y.data)),yield y,g=null,y=null}}}catch(D){E=!0,R=D}finally{try{v&&S.return!=null&&(yield(0,JD.default)(S.return()))}finally{if(E)throw R}}}),l.apply(this,arguments)}function p(){return f.apply(this,arguments)}function f(){return f=(0,YD.default)(function*(){try{yield*(0,s8.default)((0,KD.default)(u())),yield{event:l8,data:""}}catch(y){var m,g;if(RY(y))return;let v=Rn(y),E=(m=(g=t.formatError)===null||g===void 0?void 0:g.call(t,{error:v}))!==null&&m!==void 0?m:null;yield{event:c8,data:JSON.stringify(s(E))}}}),f.apply(this,arguments)}return oF(p()).pipeThrough(new TransformStream({transform(m,g){"event"in m&&g.enqueue(`event: ${m.event}
|
|
11
|
+
`),"data"in m&&g.enqueue(`data: ${m.data}
|
|
12
|
+
`),"id"in m&&g.enqueue(`id: ${m.id}
|
|
13
|
+
`),"comment"in m&&g.enqueue(`: ${m.comment}
|
|
14
|
+
`),g.enqueue(`
|
|
15
|
+
|
|
16
|
+
`)}})).pipeThrough(new TextEncoderStream)}var d8={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform","X-Accel-Buffering":"no",Connection:"keep-alive"},f8=Fe(ml(),1),Ry=Fe(un(),1);function kE(t){return Qf((0,f8.default)(function*(){throw t}))}function m8(t){let e=new AbortController;return{signal:SD([t,e.signal]),controller:e}}var h8={mutation:["POST"],query:["GET"],subscription:["GET"]},g8={mutation:["POST"],query:["GET","POST"],subscription:["GET","POST"]};function rm(t){var e,r,o;let{ctx:n,info:i,responseMeta:s,untransformedJSON:a,errors:c=[],headers:u}=t,l=a?TD(a):200,p=!a,f=p?[]:Array.isArray(a)?a:[a],d=(e=s?.({ctx:n,info:i,paths:i?.calls.map(m=>m.path),data:f,errors:c,eagerGeneration:p,type:(r=i==null||(o=i.calls.find(m=>{var g;return(g=m.procedure)===null||g===void 0?void 0:g._def.type}))===null||o===void 0||(o=o.procedure)===null||o===void 0?void 0:o._def.type)!==null&&r!==void 0?r:"unknown"}))!==null&&e!==void 0?e:{};if(d.headers)if(d.headers instanceof Headers)for(let[m,g]of d.headers.entries())u.append(m,g);else for(let[m,g]of Object.entries(d.headers))if(Array.isArray(g))for(let y of g)u.append(m,y);else typeof g=="string"&&u.set(m,g);return d.status&&(l=d.status),{status:l}}function y8(t,e){let{router:r,req:o,onError:n}=e.opts,i=Rn(t);n?.({error:i,path:e.path,input:e.input,ctx:e.ctx,type:e.type,req:o});let s={error:Za({config:r._def._config,error:i,type:e.type,path:e.path,input:e.input,ctx:e.ctx})},a=Iy(r._def._config,s),c=JSON.stringify(a);return{error:i,untransformedJSON:s,body:c}}function XD(t){return er(t)?Xf(t)?!0:Object.values(t).some(aF)||Object.values(t).some(Xf):!1}async function cF(t){var e,r,o,n,i,s;let{router:a,req:c}=t,u=new Headers([["vary","trpc-accept, accept"]]),l=a._def._config,p=new URL(c.url);if(c.method==="HEAD")return new Response(null,{status:204});let f=(e=(r=t.allowBatching)!==null&&r!==void 0?r:(o=t.batching)===null||o===void 0?void 0:o.enabled)!==null&&e!==void 0?e:!0,d=((n=t.allowMethodOverride)!==null&&n!==void 0?n:!1)&&c.method==="POST",m=await Qf(async()=>{try{return[void 0,await CY({req:c,path:decodeURIComponent(t.path),router:a,searchParams:p.searchParams,headers:t.req.headers,url:p,maxBatchSize:t.maxBatchSize})]}catch(S){return[Rn(S),void 0]}}),g=Qf(()=>{let S;return{valueOrUndefined:()=>{if(S)return S[1]},value:()=>{let[P,D]=S;if(P)throw P;return D},create:async P=>{if(S)throw new Error("This should only be called once - report a bug in tRPC");try{S=[void 0,await t.createContext({info:P})]}catch(D){S=[Rn(D),void 0]}}}}),y=d?g8:h8,v=QD(c.headers)==="application/jsonl",E=(i=(s=l.sse)===null||s===void 0?void 0:s.enabled)!==null&&i!==void 0?i:!0;try{let[S,P]=m;if(S)throw S;if(P.isBatchCall&&!f)throw new nt({code:"BAD_REQUEST",message:"Batching is not enabled on the server"});if(v&&!P.isBatchCall)throw new nt({message:"Streaming requests must be batched (you can do a batch of 1)",code:"BAD_REQUEST"});await g.create(P);let D=P.calls.map(async W=>{let Ae=W.procedure,ge=m8(t.req.signal);try{if(t.error)throw t.error;if(!Ae)throw new nt({code:"NOT_FOUND",message:`No procedure found on path "${W.path}"`});if(!y[Ae._def.type].includes(c.method))throw new nt({code:"METHOD_NOT_SUPPORTED",message:`Unsupported ${c.method}-request to ${Ae._def.type} procedure at path "${W.path}"`});if(Ae._def.type==="subscription"){var De;if(P.isBatchCall)throw new nt({code:"BAD_REQUEST",message:"Cannot batch subscription calls"});if(!((De=l.sse)===null||De===void 0)&&De.maxDurationMs){let rt=function(){clearTimeout(St),ge.signal.removeEventListener("abort",rt),ge.controller.abort()},St=setTimeout(rt,l.sse.maxDurationMs);ge.signal.addEventListener("abort",rt)}}return[void 0,{data:await Ae({path:W.path,getRawInput:W.getRawInput,ctx:g.value(),type:Ae._def.type,signal:ge.signal,batchIndex:W.batchIndex}),signal:Ae._def.type==="subscription"?ge.signal:void 0}]}catch(Pt){var He,je,tt;let rt=Rn(Pt),St=W.result();return(He=t.onError)===null||He===void 0||He.call(t,{error:rt,path:W.path,input:St,ctx:g.valueOrUndefined(),type:(je=(tt=W.procedure)===null||tt===void 0?void 0:tt._def.type)!==null&&je!==void 0?je:"unknown",req:t.req}),[rt,void 0]}});if(!P.isBatchCall){let[W]=P.calls,[Ae,ge]=await D[0];switch(P.type){case"unknown":case"mutation":case"query":{if(u.set("content-type","application/json"),XD(ge?.data))throw new nt({code:"UNSUPPORTED_MEDIA_TYPE",message:"Cannot use stream-like response in non-streaming request - use httpBatchStreamLink"});let De=Ae?{error:Za({config:l,ctx:g.valueOrUndefined(),error:Ae,input:W.result(),path:W.path,type:P.type})}:{result:{data:ge.data}},He=rm({ctx:g.valueOrUndefined(),info:P,responseMeta:t.responseMeta,errors:Ae?[Ae]:[],headers:u,untransformedJSON:[De]});return new Response(JSON.stringify(Iy(l,De)),{status:He.status,headers:u})}case"subscription":{let De=Qf(()=>Ae?kE(Ae):E?!Oy(ge.data)&&!Xf(ge.data)?kE(new nt({message:`Subscription ${W.path} did not return an observable or a AsyncGenerator`,code:"INTERNAL_SERVER_ERROR"})):Oy(ge.data)?SE(ge.data,t.req.signal):ge.data:kE(new nt({code:"METHOD_NOT_SUPPORTED",message:'Missing experimental flag "sseSubscriptions"'}))),He=p8((0,Ry.default)((0,Ry.default)({},l.sse),{},{data:De,serialize:rt=>l.transformer.output.serialize(rt),formatError(rt){var St,sn,il;let BM=Rn(rt.error),WM=W?.result(),ZM=W?.path,GM=(St=W==null||(sn=W.procedure)===null||sn===void 0?void 0:sn._def.type)!==null&&St!==void 0?St:"unknown";return(il=t.onError)===null||il===void 0||il.call(t,{error:BM,path:ZM,input:WM,ctx:g.valueOrUndefined(),req:t.req,type:GM}),Za({config:l,ctx:g.valueOrUndefined(),error:BM,input:WM,path:ZM,type:GM})}}));for(let[rt,St]of Object.entries(d8))u.set(rt,St);let je=rm({ctx:g.valueOrUndefined(),info:P,responseMeta:t.responseMeta,errors:[],headers:u,untransformedJSON:null}),tt=ge?.signal,Pt=He;if(tt){let rt=He.getReader(),St=()=>{rt.cancel()};tt.aborted?St():tt.addEventListener("abort",St,{once:!0}),Pt=new ReadableStream({async pull(sn){let il=await rt.read();il.done?(tt.removeEventListener("abort",St),sn.close()):sn.enqueue(il.value)},cancel(){return tt.removeEventListener("abort",St),rt.cancel()}})}return new Response(Pt,{headers:u,status:je.status})}}}if(P.accept==="application/jsonl"){u.set("content-type","application/json"),u.set("transfer-encoding","chunked");let W=rm({ctx:g.valueOrUndefined(),info:P,responseMeta:t.responseMeta,errors:[],headers:u,untransformedJSON:null}),Ae=o8((0,Ry.default)((0,Ry.default)({},l.jsonl),{},{maxDepth:1/0,data:D.map(async(ge,De)=>{let[He,je]=await ge,tt=P.calls[De];if(He){var Pt,rt;return{error:Za({config:l,ctx:g.valueOrUndefined(),error:He,input:tt.result(),path:tt.path,type:(Pt=(rt=tt.procedure)===null||rt===void 0?void 0:rt._def.type)!==null&&Pt!==void 0?Pt:"unknown"})}}let St=Oy(je.data)?SE(je.data,t.req.signal):Promise.resolve(je.data);return{result:Promise.resolve({data:St})}}),serialize:ge=>l.transformer.output.serialize(ge),onError:ge=>{var De,He;(De=t.onError)===null||De===void 0||De.call(t,{error:Rn(ge.error),path:void 0,input:void 0,ctx:g.valueOrUndefined(),req:t.req,type:(He=P?.type)!==null&&He!==void 0?He:"unknown"})},formatError(ge){var De,He;let je=P?.calls[ge.path[0]],tt=Rn(ge.error),Pt=je?.result(),rt=je?.path,St=(De=je==null||(He=je.procedure)===null||He===void 0?void 0:He._def.type)!==null&&De!==void 0?De:"unknown";return Za({config:l,ctx:g.valueOrUndefined(),error:tt,input:Pt,path:rt,type:St})}}));return new Response(Ae,{headers:u,status:W.status})}u.set("content-type","application/json");let X=(await Promise.all(D)).map(W=>{let[Ae,ge]=W;return Ae?W:XD(ge.data)?[new nt({code:"UNSUPPORTED_MEDIA_TYPE",message:"Cannot use stream-like response in non-streaming request - use httpBatchStreamLink"}),void 0]:W}),N=X.map(([W,Ae],ge)=>{let De=P.calls[ge];if(W){var He,je;return{error:Za({config:l,ctx:g.valueOrUndefined(),error:W,input:De.result(),path:De.path,type:(He=(je=De.procedure)===null||je===void 0?void 0:je._def.type)!==null&&He!==void 0?He:"unknown"})}}return{result:{data:Ae.data}}}),ie=X.map(([W])=>W).filter(Boolean),ue=rm({ctx:g.valueOrUndefined(),info:P,responseMeta:t.responseMeta,untransformedJSON:N,errors:ie,headers:u});return new Response(JSON.stringify(Iy(l,N)),{status:ue.status,headers:u})}catch(S){var R;let[P,D]=m,X=g.valueOrUndefined(),{error:N,untransformedJSON:ie,body:ue}=y8(S,{opts:t,ctx:g.valueOrUndefined(),type:(R=D?.type)!==null&&R!==void 0?R:"unknown"}),W=rm({ctx:X,info:D,responseMeta:t.responseMeta,untransformedJSON:ie,errors:[N],headers:u});return new Response(ue,{status:W.status,headers:u})}}var sm=Fe(un(),1),NE=t=>(t=t.startsWith("/")?t.slice(1):t,t=t.endsWith("/")?t.slice(0,-1):t,t);async function uF(t){let e=new Headers,r=async a=>{var c;return(c=t.createContext)===null||c===void 0?void 0:c.call(t,(0,sm.default)({req:t.req,resHeaders:e},a))},o=new URL(t.req.url),n=NE(o.pathname),i=NE(t.endpoint),s=NE(n.slice(i.length));return await cF((0,sm.default)((0,sm.default)({},t),{},{req:t.req,createContext:r,path:s,error:null,onError(a){var c;t==null||(c=t.onError)===null||c===void 0||c.call(t,(0,sm.default)((0,sm.default)({},a),{},{req:t.req}))},responseMeta(a){var c;let u=(c=t.responseMeta)===null||c===void 0?void 0:c.call(t,a);if(u?.headers)if(u.headers instanceof Headers)for(let[l,p]of u.headers.entries())e.append(l,p);else for(let[l,p]of Object.entries(u.headers))if(Array.isArray(p))for(let f of p)e.append(l,f);else typeof p=="string"&&e.set(l,p);return{headers:e,status:u?.status}}}))}var Ay=Symbol();var DE=t=>{let e=t.split("/");return e[0]===""&&e.shift(),e},FE=t=>{let{groups:e,path:r}=x8(t),o=DE(r);return _8(o,e)},x8=t=>{let e=[];return t=t.replace(/\{[^}]+\}/g,(r,o)=>{let n=`@${o}`;return e.push([n,r]),n}),{groups:e,path:t}},_8=(t,e)=>{for(let r=e.length-1;r>=0;r--){let[o]=e[r];for(let n=t.length-1;n>=0;n--)if(t[n].includes(o)){t[n]=t[n].replace(o,e[r][1]);break}}return t},Ty={},zE=(t,e)=>{if(t==="*")return"*";let r=t.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);if(r){let o=`${t}#${e}`;return Ty[o]||(r[2]?Ty[o]=e&&e[0]!==":"&&e[0]!=="*"?[o,r[1],new RegExp(`^${r[2]}(?=/${e})`)]:[t,r[1],new RegExp(`^${r[2]}$`)]:Ty[o]=[t,r[1],!0]),Ty[o]}return null},$y=(t,e)=>{try{return e(t)}catch{return t.replace(/(?:%[0-9A-Fa-f]{2})+/g,r=>{try{return e(r)}catch{return r}})}},b8=t=>$y(t,decodeURI),jE=t=>{let e=t.url,r=e.indexOf("/",e.indexOf(":")+4),o=r;for(;o<e.length;o++){let n=e.charCodeAt(o);if(n===37){let i=e.indexOf("?",o),s=e.indexOf("#",o),a=i===-1?s===-1?void 0:s:s===-1?i:Math.min(i,s),c=e.slice(r,a);return b8(c.includes("%25")?c.replace(/%25/g,"%2525"):c)}else if(n===63||n===35)break}return e.slice(r,o)};var lF=t=>{let e=jE(t);return e.length>1&&e.at(-1)==="/"?e.slice(0,-1):e},vs=(t,e,...r)=>(r.length&&(e=vs(e,...r)),`${t?.[0]==="/"?"":"/"}${t}${e==="/"?"":`${t?.at(-1)==="/"?"":"/"}${e?.[0]==="/"?e.slice(1):e}`}`),Py=t=>{if(t.charCodeAt(t.length-1)!==63||!t.includes(":"))return null;let e=t.split("/"),r=[],o="";return e.forEach(n=>{if(n!==""&&!/\:/.test(n))o+="/"+n;else if(/\:/.test(n))if(/\?/.test(n)){r.length===0&&o===""?r.push("/"):r.push(o);let i=n.replace("?","");o+="/"+i,r.push(o)}else o+="/"+n}),r.filter((n,i,s)=>s.indexOf(n)===i)},ME=t=>/[%+]/.test(t)?(t.indexOf("+")!==-1&&(t=t.replace(/\+/g," ")),t.indexOf("%")!==-1?$y(t,LE):t):t,pF=(t,e,r)=>{let o;if(!r&&e&&!/[%+]/.test(e)){let s=t.indexOf("?",8);if(s===-1)return;for(t.startsWith(e,s+1)||(s=t.indexOf(`&${e}`,s+1));s!==-1;){let a=t.charCodeAt(s+e.length+1);if(a===61){let c=s+e.length+2,u=t.indexOf("&",c);return ME(t.slice(c,u===-1?void 0:u))}else if(a==38||isNaN(a))return"";s=t.indexOf(`&${e}`,s+1)}if(o=/[%+]/.test(t),!o)return}let n={};o??=/[%+]/.test(t);let i=t.indexOf("?",8);for(;i!==-1;){let s=t.indexOf("&",i+1),a=t.indexOf("=",i);a>s&&s!==-1&&(a=-1);let c=t.slice(i+1,a===-1?s===-1?void 0:s:a);if(o&&(c=ME(c)),i=s,c==="")continue;let u;a===-1?u="":(u=t.slice(a+1,s===-1?void 0:s),o&&(u=ME(u))),r?(n[c]&&Array.isArray(n[c])||(n[c]=[]),n[c].push(u)):n[c]??=u}return e?n[e]:n},dF=pF,fF=(t,e)=>pF(t,e,!0),LE=decodeURIComponent;var v8=t=>t.req[Ay][0].map(([[,e]])=>e),mF=(t,e)=>v8(t).at(e??t.req.routeIndex)?.path??"";var hF=({endpoint:t,createContext:e,...r})=>{let o=new Set(["arrayBuffer","blob","formData","json","text"]);return async n=>{let i=n.req.method==="GET"||n.req.method==="HEAD",s=t;if(!t){let a=mF(n);a?s=a.replace(/\/\*+$/,"")||"/trpc":s="/trpc"}return await uF({...r,createContext:async a=>({...e?await e(a,n):{},env:n.env}),endpoint:s,req:i?n.req.raw:new Proxy(n.req.raw,{get(a,c,u){return o.has(c)?()=>n.req[c]():Reflect.get(a,c,a)}})})}};import{fileURLToPath as L_e}from"node:url";var UE=(t,e,r)=>(o,n)=>{let i=-1;return s(0);async function s(a){if(a<=i)throw new Error("next() called multiple times");i=a;let c,u=!1,l;if(t[a]?(l=t[a][0][0],o.req.routeIndex=a):l=a===t.length&&n||void 0,l)try{c=await l(o,()=>s(a+1))}catch(p){if(p instanceof Error&&e)o.error=p,c=await e(p,o),u=!0;else throw p}else o.finalized===!1&&r&&(c=await r(o));return c&&(o.finalized===!1||u)&&(o.res=c),o}};var gF=async(t,e=Object.create(null))=>{let{all:r=!1,dot:o=!1}=e,i=(t instanceof Ny?t.raw.headers:t.headers).get("Content-Type");return i?.startsWith("multipart/form-data")||i?.startsWith("application/x-www-form-urlencoded")?S8(t,{all:r,dot:o}):{}};async function S8(t,e){let r=await t.formData();return r?w8(r,e):{}}function w8(t,e){let r=Object.create(null);return t.forEach((o,n)=>{e.all||n.endsWith("[]")?E8(r,n,o):r[n]=o}),e.dot&&Object.entries(r).forEach(([o,n])=>{o.includes(".")&&(k8(r,o,n),delete r[o])}),r}var E8=(t,e,r)=>{t[e]!==void 0?Array.isArray(t[e])?t[e].push(r):t[e]=[t[e],r]:e.endsWith("[]")?t[e]=[r]:t[e]=r},k8=(t,e,r)=>{if(/(?:^|\.)__proto__\./.test(e))return;let o=t,n=e.split(".");n.forEach((i,s)=>{s===n.length-1?o[i]=r:((!o[i]||typeof o[i]!="object"||Array.isArray(o[i])||o[i]instanceof File)&&(o[i]=Object.create(null)),o=o[i])})};var yF=t=>$y(t,LE),Ny=class{raw;#t;#e;routeIndex=0;path;bodyCache={};constructor(t,e="/",r=[[]]){this.raw=t,this.path=e,this.#e=r,this.#t={}}param(t){return t?this.#r(t):this.#i()}#r(t){let e=this.#e[0][this.routeIndex][1][t],r=this.#n(e);return r&&/\%/.test(r)?yF(r):r}#i(){let t={},e=Object.keys(this.#e[0][this.routeIndex][1]);for(let r of e){let o=this.#n(this.#e[0][this.routeIndex][1][r]);o!==void 0&&(t[r]=/\%/.test(o)?yF(o):o)}return t}#n(t){return this.#e[1]?this.#e[1][t]:t}query(t){return dF(this.url,t)}queries(t){return fF(this.url,t)}header(t){if(t)return this.raw.headers.get(t)??void 0;let e={};return this.raw.headers.forEach((r,o)=>{e[o]=r}),e}async parseBody(t){return gF(this,t)}#o=t=>{let{bodyCache:e,raw:r}=this,o=e[t];if(o)return o;let n=Object.keys(e)[0];return n?e[n].then(i=>(n==="json"&&(i=JSON.stringify(i)),new Response(i)[t]())):e[t]=r[t]()};json(){return this.#o("text").then(t=>JSON.parse(t))}text(){return this.#o("text")}arrayBuffer(){return this.#o("arrayBuffer")}bytes(){return this.#o("arrayBuffer").then(t=>new Uint8Array(t))}blob(){return this.#o("blob")}formData(){return this.#o("formData")}addValidatedData(t,e){this.#t[t]=e}valid(t){return this.#t[t]}get url(){return this.raw.url}get method(){return this.raw.method}get[Ay](){return this.#e}get matchedRoutes(){return this.#e[0].map(([[,t]])=>t)}get routePath(){return this.#e[0].map(([[,t]])=>t)[this.routeIndex].path}};var xF={Stringify:1,BeforeStream:2,Stream:3},I8=(t,e)=>{let r=new String(t);return r.isEscaped=!0,r.callbacks=e,r};var qE=async(t,e,r,o,n)=>{typeof t=="object"&&!(t instanceof String)&&(t instanceof Promise||(t=t.toString()),t instanceof Promise&&(t=await t));let i=t.callbacks;if(!i?.length)return Promise.resolve(t);n?n[0]+=t:n=[t];let s=Promise.all(i.map(a=>a({phase:e,buffer:n,context:o}))).then(a=>Promise.all(a.filter(Boolean).map(c=>qE(c,e,!1,o,n))).then(()=>n[0]));return r?I8(await s,i):s};var O8="text/plain; charset=UTF-8",HE=(t,e)=>({"Content-Type":t,...e}),am=(t,e)=>new Response(t,e),BE=class{#t;#e;env={};#r;finalized=!1;error;#i;#n;#o;#a;#u;#l;#p;#c;#d;constructor(t,e){this.#t=t,e&&(this.#n=e.executionCtx,this.env=e.env,this.#l=e.notFoundHandler,this.#d=e.path,this.#c=e.matchResult)}get req(){return this.#e??=new Ny(this.#t,this.#d,this.#c),this.#e}get event(){if(this.#n&&"respondWith"in this.#n)return this.#n;throw Error("This context has no FetchEvent")}get executionCtx(){if(this.#n)return this.#n;throw Error("This context has no ExecutionContext")}get res(){return this.#o||=am(null,{headers:this.#p??=new Headers})}set res(t){if(this.#o&&t){t=am(t.body,t);for(let[e,r]of this.#o.headers.entries())if(e!=="content-type")if(e==="set-cookie"){let o=this.#o.headers.getSetCookie();t.headers.delete("set-cookie");for(let n of o)t.headers.append("set-cookie",n)}else t.headers.set(e,r)}this.#o=t,this.finalized=!0}render=(...t)=>(this.#u??=e=>this.html(e),this.#u(...t));setLayout=t=>this.#a=t;getLayout=()=>this.#a;setRenderer=t=>{this.#u=t};header=(t,e,r)=>{this.finalized&&(this.#o=am(this.#o.body,this.#o));let o=this.#o?this.#o.headers:this.#p??=new Headers;e===void 0?o.delete(t):r?.append?o.append(t,e):o.set(t,e)};status=t=>{this.#i=t};set=(t,e)=>{this.#r??=new Map,this.#r.set(t,e)};get=t=>this.#r?this.#r.get(t):void 0;get var(){return this.#r?Object.fromEntries(this.#r):{}}#s(t,e,r){let o=this.#o?new Headers(this.#o.headers):this.#p??new Headers;if(typeof e=="object"&&"headers"in e){let i=e.headers instanceof Headers?e.headers:new Headers(e.headers);for(let[s,a]of i)s.toLowerCase()==="set-cookie"?o.append(s,a):o.set(s,a)}if(r)for(let[i,s]of Object.entries(r))if(typeof s=="string")o.set(i,s);else{o.delete(i);for(let a of s)o.append(i,a)}let n=typeof e=="number"?e:e?.status??this.#i;return am(t,{status:n,headers:o})}newResponse=(...t)=>this.#s(...t);body=(t,e,r)=>this.#s(t,e,r);text=(t,e,r)=>!this.#p&&!this.#i&&!e&&!r&&!this.finalized?new Response(t):this.#s(t,e,HE(O8,r));json=(t,e,r)=>this.#s(JSON.stringify(t),e,HE("application/json",r));html=(t,e,r)=>{let o=n=>this.#s(n,e,HE("text/html; charset=UTF-8",r));return typeof t=="object"?qE(t,xF.Stringify,!1,{}).then(o):o(t)};redirect=(t,e)=>{let r=String(t);return this.header("Location",/[^\x00-\xFF]/.test(r)?encodeURI(r):r),this.newResponse(null,e??302)};notFound=()=>(this.#l??=()=>am(),this.#l(this))};var pt="ALL",_F="all",bF=["get","post","put","delete","options","patch"],My="Can not add a route since the matcher is already built.",Dy=class extends Error{};var vF="__COMPOSED_HANDLER";var C8=t=>t.text("404 Not Found",404),SF=(t,e)=>{if("getResponse"in t){let r=t.getResponse();return e.newResponse(r.body,r)}return console.error(t),e.text("Internal Server Error",500)},wF=class EF{get;post;put;delete;options;patch;all;on;use;router;getPath;_basePath="/";#t="/";routes=[];constructor(e={}){[...bF,_F].forEach(i=>{this[i]=(s,...a)=>(typeof s=="string"?this.#t=s:this.#i(i,this.#t,s),a.forEach(c=>{this.#i(i,this.#t,c)}),this)}),this.on=(i,s,...a)=>{for(let c of[s].flat()){this.#t=c;for(let u of[i].flat())a.map(l=>{this.#i(u.toUpperCase(),this.#t,l)})}return this},this.use=(i,...s)=>(typeof i=="string"?this.#t=i:(this.#t="*",s.unshift(i)),s.forEach(a=>{this.#i(pt,this.#t,a)}),this);let{strict:o,...n}=e;Object.assign(this,n),this.getPath=o??!0?e.getPath??jE:lF}#e(){let e=new EF({router:this.router,getPath:this.getPath});return e.errorHandler=this.errorHandler,e.#r=this.#r,e.routes=this.routes,e}#r=C8;errorHandler=SF;route(e,r){let o=this.basePath(e);return r.routes.map(n=>{let i;r.errorHandler===SF?i=n.handler:(i=async(s,a)=>(await UE([],r.errorHandler)(s,()=>n.handler(s,a))).res,i[vF]=n.handler),o.#i(n.method,n.path,i,n.basePath)}),this}basePath(e){let r=this.#e();return r._basePath=vs(this._basePath,e),r}onError=e=>(this.errorHandler=e,this);notFound=e=>(this.#r=e,this);mount(e,r,o){let n,i;o&&(typeof o=="function"?i=o:(i=o.optionHandler,o.replaceRequest===!1?n=c=>c:n=o.replaceRequest));let s=i?c=>{let u=i(c);return Array.isArray(u)?u:[u]}:c=>{let u;try{u=c.executionCtx}catch{}return[c.env,u]};n||=(()=>{let c=vs(this._basePath,e),u=c==="/"?0:c.length;return l=>{let p=new URL(l.url);return p.pathname=this.getPath(l).slice(u)||"/",new Request(p,l)}})();let a=async(c,u)=>{let l=await r(n(c.req.raw),...s(c));if(l)return l;await u()};return this.#i(pt,vs(e,"*"),a),this}#i(e,r,o,n){e=e.toUpperCase(),r=vs(this._basePath,r);let i={basePath:n!==void 0?vs(this._basePath,n):this._basePath,path:r,method:e,handler:o};this.router.add(e,r,[o,i]),this.routes.push(i)}#n(e,r){if(e instanceof Error)return this.errorHandler(e,r);throw e}#o(e,r,o,n){if(n==="HEAD")return(async()=>new Response(null,await this.#o(e,r,o,"GET")))();let i=this.getPath(e,{env:o}),s=this.router.match(n,i),a=new BE(e,{path:i,matchResult:s,env:o,executionCtx:r,notFoundHandler:this.#r});if(s[0].length===1){let u;try{u=s[0][0][0][0](a,async()=>{a.res=await this.#r(a)})}catch(l){return this.#n(l,a)}return u instanceof Promise?u.then(l=>l||(a.finalized?a.res:this.#r(a))).catch(l=>this.#n(l,a)):u??this.#r(a)}let c=UE(s[0],this.errorHandler,this.#r);return(async()=>{try{let u=await c(a);if(!u.finalized)throw new Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");return u.res}catch(u){return this.#n(u,a)}})()}fetch=(e,...r)=>this.#o(e,r[1],r[0],e.method);request=(e,r,o,n)=>e instanceof Request?this.fetch(r?new Request(e,r):e,o,n):(e=e.toString(),this.fetch(new Request(/^https?:\/\//.test(e)?e:`http://localhost${vs("/",e)}`,r),o,n));fire=()=>{addEventListener("fetch",e=>{e.respondWith(this.#o(e.request,e,void 0,e.request.method))})}};var Fy=[];function WE(t,e){let r=this.buildAllMatchers(),o=((n,i)=>{let s=r[n]||r[pt],a=s[2][i];if(a)return a;let c=i.match(s[0]);if(!c)return[[],Fy];let u=c.indexOf("",1);return[s[1][u],c]});return this.match=o,o(t,e)}var zy="[^/]+",cm=".*",um="(?:|/.*)",Va=Symbol(),R8=new Set(".\\+*[^]$()");function A8(t,e){return t.length===1?e.length===1?t<e?-1:1:-1:e.length===1||t===cm||t===um?1:e===cm||e===um?-1:t===zy?1:e===zy?-1:t.length===e.length?t<e?-1:1:e.length-t.length}var kF=class ZE{#t;#e;#r=Object.create(null);insert(e,r,o,n,i){if(e.length===0){if(this.#t!==void 0)throw Va;if(i)return;this.#t=r;return}let[s,...a]=e,c=s==="*"?a.length===0?["","",cm]:["","",zy]:s==="/*"?["","",um]:s.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/),u;if(c){let l=c[1],p=c[2]||zy;if(l&&c[2]&&(p===".*"||(p=p.replace(/^\((?!\?:)(?=[^)]+\)$)/,"(?:"),/\((?!\?:)/.test(p))))throw Va;if(u=this.#r[p],!u){if(Object.keys(this.#r).some(f=>f!==cm&&f!==um))throw Va;if(i)return;u=this.#r[p]=new ZE,l!==""&&(u.#e=n.varIndex++)}!i&&l!==""&&o.push([l,u.#e])}else if(u=this.#r[s],!u){if(Object.keys(this.#r).some(l=>l.length>1&&l!==cm&&l!==um))throw Va;if(i)return;u=this.#r[s]=new ZE}u.insert(a,r,o,n,i)}buildRegExpStr(){let r=Object.keys(this.#r).sort(A8).map(o=>{let n=this.#r[o];return(typeof n.#e=="number"?`(${o})@${n.#e}`:R8.has(o)?`\\${o}`:o)+n.buildRegExpStr()});return typeof this.#t=="number"&&r.unshift(`#${this.#t}`),r.length===0?"":r.length===1?r[0]:"(?:"+r.join("|")+")"}};var IF=class{#t={varIndex:0};#e=new kF;insert(t,e,r){let o=[],n=[];for(let s=0;;){let a=!1;if(t=t.replace(/\{[^}]+\}/g,c=>{let u=`@\\${s}`;return n[s]=[u,c],s++,a=!0,u}),!a)break}let i=t.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let s=n.length-1;s>=0;s--){let[a]=n[s];for(let c=i.length-1;c>=0;c--)if(i[c].indexOf(a)!==-1){i[c]=i[c].replace(a,n[s][1]);break}}return this.#e.insert(i,e,o,this.#t,r),o}buildRegExp(){let t=this.#e.buildRegExpStr();if(t==="")return[/^$/,[],[]];let e=0,r=[],o=[];return t=t.replace(/#(\d+)|@(\d+)|\.\*\$/g,(n,i,s)=>i!==void 0?(r[++e]=Number(i),"$()"):(s!==void 0&&(o[Number(s)]=++e),"")),[new RegExp(`^${t}`),r,o]}};var T8=[/^$/,[],Object.create(null)],OF=Object.create(null);function CF(t){return OF[t]??=new RegExp(t==="*"?"":`^${t.replace(/\/\*$|([.\\+*[^\]$()])/g,(e,r)=>r?`\\${r}`:"(?:|/.*)")}$`)}function $8(){OF=Object.create(null)}function P8(t){let e=new IF,r=[];if(t.length===0)return T8;let o=t.map(u=>[!/\*|\/:/.test(u[0]),...u]).sort(([u,l],[p,f])=>u?1:p?-1:l.length-f.length),n=Object.create(null);for(let u=0,l=-1,p=o.length;u<p;u++){let[f,d,m]=o[u];f?n[d]=[m.map(([y])=>[y,Object.create(null)]),Fy]:l++;let g;try{g=e.insert(d,l,f)}catch(y){throw y===Va?new Dy(d):y}f||(r[l]=m.map(([y,v])=>{let E=Object.create(null);for(v-=1;v>=0;v--){let[R,S]=g[v];E[R]=S}return[y,E]}))}let[i,s,a]=e.buildRegExp();for(let u=0,l=r.length;u<l;u++)for(let p=0,f=r[u].length;p<f;p++){let d=r[u][p]?.[1];if(!d)continue;let m=Object.keys(d);for(let g=0,y=m.length;g<y;g++)d[m[g]]=a[d[m[g]]]}let c=[];for(let u in s)c[u]=r[s[u]];return[i,c,n]}function hl(t,e){if(t){for(let r of Object.keys(t).sort((o,n)=>n.length-o.length))if(CF(r).test(e))return[...t[r]]}}var jy=class{name="RegExpRouter";#t;#e;constructor(){this.#t={[pt]:Object.create(null)},this.#e={[pt]:Object.create(null)}}add(t,e,r){let o=this.#t,n=this.#e;if(!o||!n)throw new Error(My);o[t]||[o,n].forEach(a=>{a[t]=Object.create(null),Object.keys(a[pt]).forEach(c=>{a[t][c]=[...a[pt][c]]})}),e==="/*"&&(e="*");let i=(e.match(/\/:/g)||[]).length;if(/\*$/.test(e)){let a=CF(e);t===pt?Object.keys(o).forEach(c=>{o[c][e]||=hl(o[c],e)||hl(o[pt],e)||[]}):o[t][e]||=hl(o[t],e)||hl(o[pt],e)||[],Object.keys(o).forEach(c=>{(t===pt||t===c)&&Object.keys(o[c]).forEach(u=>{a.test(u)&&o[c][u].push([r,i])})}),Object.keys(n).forEach(c=>{(t===pt||t===c)&&Object.keys(n[c]).forEach(u=>a.test(u)&&n[c][u].push([r,i]))});return}let s=Py(e)||[e];for(let a=0,c=s.length;a<c;a++){let u=s[a];Object.keys(n).forEach(l=>{(t===pt||t===l)&&(n[l][u]||=[...hl(o[l],u)||hl(o[pt],u)||[]],n[l][u].push([r,i-c+a+1]))})}}match=WE;buildAllMatchers(){let t=Object.create(null);return Object.keys(this.#e).concat(Object.keys(this.#t)).forEach(e=>{t[e]||=this.#r(e)}),this.#t=this.#e=void 0,$8(),t}#r(t){let e=[],r=t===pt;return[this.#t,this.#e].forEach(o=>{let n=o[t]?Object.keys(o[t]).map(i=>[i,o[t][i]]):[];n.length!==0?(r||=!0,e.push(...n)):t!==pt&&e.push(...Object.keys(o[pt]).map(i=>[i,o[pt][i]]))}),r?P8(e):null}};var GE=class{name="SmartRouter";#t=[];#e=[];constructor(t){this.#t=t.routers}add(t,e,r){if(!this.#e)throw new Error(My);this.#e.push([t,e,r])}match(t,e){if(!this.#e)throw new Error("Fatal error");let r=this.#t,o=this.#e,n=r.length,i=0,s;for(;i<n;i++){let a=r[i];try{for(let c=0,u=o.length;c<u;c++)a.add(...o[c]);s=a.match(t,e)}catch(c){if(c instanceof Dy)continue;throw c}this.match=a.match.bind(a),this.#t=[a],this.#e=void 0;break}if(i===n)throw new Error("Fatal error");return this.name=`SmartRouter + ${this.activeRouter.name}`,s}get activeRouter(){if(this.#e||this.#t.length!==1)throw new Error("No active router has been determined yet.");return this.#t[0]}};var lm=Object.create(null),N8=t=>{for(let e in t)return!0;return!1},RF=class AF{#t;#e;#r;#i=0;#n=lm;constructor(e,r,o){if(this.#e=o||Object.create(null),this.#t=[],e&&r){let n=Object.create(null);n[e]={handler:r,possibleKeys:[],score:0},this.#t=[n]}this.#r=[]}insert(e,r,o){this.#i=++this.#i;let n=this,i=FE(r),s=[];for(let a=0,c=i.length;a<c;a++){let u=i[a],l=i[a+1],p=zE(u,l),f=Array.isArray(p)?p[0]:u;if(f in n.#e){n=n.#e[f],p&&s.push(p[1]);continue}n.#e[f]=new AF,p&&(n.#r.push(p),s.push(p[1])),n=n.#e[f]}return n.#t.push({[e]:{handler:o,possibleKeys:s.filter((a,c,u)=>u.indexOf(a)===c),score:this.#i}}),n}#o(e,r,o,n,i){for(let s=0,a=r.#t.length;s<a;s++){let c=r.#t[s],u=c[o]||c[pt],l={};if(u!==void 0&&(u.params=Object.create(null),e.push(u),n!==lm||i&&i!==lm))for(let p=0,f=u.possibleKeys.length;p<f;p++){let d=u.possibleKeys[p],m=l[u.score];u.params[d]=i?.[d]&&!m?i[d]:n[d]??i?.[d],l[u.score]=!0}}}search(e,r){let o=[];this.#n=lm;let i=[this],s=DE(r),a=[],c=s.length,u=null;for(let l=0;l<c;l++){let p=s[l],f=l===c-1,d=[];for(let g=0,y=i.length;g<y;g++){let v=i[g],E=v.#e[p];E&&(E.#n=v.#n,f?(E.#e["*"]&&this.#o(o,E.#e["*"],e,v.#n),this.#o(o,E,e,v.#n)):d.push(E));for(let R=0,S=v.#r.length;R<S;R++){let P=v.#r[R],D=v.#n===lm?{}:{...v.#n};if(P==="*"){let W=v.#e["*"];W&&(this.#o(o,W,e,v.#n),W.#n=D,d.push(W));continue}let[X,N,ie]=P;if(!p&&!(ie instanceof RegExp))continue;let ue=v.#e[X];if(ie instanceof RegExp){if(u===null){u=new Array(c);let ge=r[0]==="/"?1:0;for(let De=0;De<c;De++)u[De]=ge,ge+=s[De].length+1}let W=r.substring(u[l]),Ae=ie.exec(W);if(Ae){if(D[N]=Ae[0],this.#o(o,ue,e,v.#n,D),N8(ue.#e)){ue.#n=D;let ge=Ae[0].match(/\//)?.length??0;(a[ge]||=[]).push(ue)}continue}}(ie===!0||ie.test(p))&&(D[N]=p,f?(this.#o(o,ue,e,D,v.#n),ue.#e["*"]&&this.#o(o,ue.#e["*"],e,D,v.#n)):(ue.#n=D,d.push(ue)))}}let m=a.shift();i=m?d.concat(m):d}return o.length>1&&o.sort((l,p)=>l.score-p.score),[o.map(({handler:l,params:p})=>[l,p])]}};var VE=class{name="TrieRouter";#t;constructor(){this.#t=new RF}add(t,e,r){let o=Py(e);if(o){for(let n=0,i=o.length;n<i;n++)this.#t.insert(t,o[n],r);return}this.#t.insert(t,e,r)}match(t,e){return this.#t.search(t,e)}};var KE=class extends wF{constructor(t={}){super(t),this.router=t.router??new GE({routers:[new jy,new VE]})}};function M8(){let{process:t,Deno:e}=globalThis;return!(typeof e?.noColor=="boolean"?e.noColor:t!==void 0?"NO_COLOR"in t?.env:!1)}async function TF(){let{navigator:t}=globalThis,e="cloudflare:workers";return!(t!==void 0&&t.userAgent==="Cloudflare-Workers"?await(async()=>{try{return"NO_COLOR"in((await import(e)).env??{})}catch{return!1}})():!M8())}var D8=t=>{let[e,r]=[",","."];return t.map(n=>n.replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+e)).join(r)},F8=t=>{let e=Date.now()-t;return D8([e<1e3?e+"ms":Math.round(e/1e3)+"s"])},z8=async t=>{if(await TF())switch(t/100|0){case 5:return`\x1B[31m${t}\x1B[0m`;case 4:return`\x1B[33m${t}\x1B[0m`;case 3:return`\x1B[36m${t}\x1B[0m`;case 2:return`\x1B[32m${t}\x1B[0m`}return`${t}`};async function $F(t,e,r,o,n=0,i){let s=e==="<--"?`${e} ${r} ${o}`:`${e} ${r} ${o} ${await z8(n)} ${i}`;t(s)}var PF=(t=console.log)=>async function(r,o){let{method:n,url:i}=r.req,s=i.slice(i.indexOf("/",8));await $F(t,"<--",n,s);let a=Date.now();await o(),await $F(t,"-->",n,s,r.res.status,F8(a))};var Ly=Fe(un(),1),FF="middlewareMarker";function j8(){function t(r){return{_middlewares:r,unstable_pipe(o){let n="_middlewares"in o?o._middlewares:[o];return t([...r,...n])}}}function e(r){return t([r])}return e}function L8(t){let e=async function(o){let n,i=await o.getRawInput();try{n=await t(i)}catch(a){throw new nt({code:"BAD_REQUEST",cause:a})}let s=er(o.input)&&er(n)?(0,Ly.default)((0,Ly.default)({},o.input),n):n;return o.next({input:s})};return e._type="input",e}function U8(t){let e=async function({next:o}){let n=await o();if(!n.ok)return n;try{let i=await t(n.data);return(0,Ly.default)((0,Ly.default)({},n),{},{data:i})}catch(i){throw new nt({message:"Output validation failed",code:"INTERNAL_SERVER_ERROR",cause:i})}};return e._type="output",e}var q8=Fe(Wa(),1),zF=class extends Error{constructor(t){var e;super((e=t[0])===null||e===void 0?void 0:e.message),(0,q8.default)(this,"issues",void 0),this.name="SchemaError",this.issues=t}};function NF(t){let e=t,r="~standard"in e;if(typeof e=="function"&&typeof e.assert=="function")return e.assert.bind(e);if(typeof e=="function"&&!r)return e;if(typeof e.parseAsync=="function")return e.parseAsync.bind(e);if(typeof e.parse=="function")return e.parse.bind(e);if(typeof e.validateSync=="function")return e.validateSync.bind(e);if(typeof e.create=="function")return e.create.bind(e);if(typeof e.assert=="function")return o=>(e.assert(o),o);if(r)return async o=>{let n=await e["~standard"].validate(o);if(n.issues)throw new zF(n.issues);return n.value};throw new Error("Could not find a validator fn")}var H8=Ir({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutPropertiesLoose.js"(t,e){function r(o,n){if(o==null)return{};var i={};for(var s in o)if({}.hasOwnProperty.call(o,s)){if(n.includes(s))continue;i[s]=o[s]}return i}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),B8=Ir({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutProperties.js"(t,e){var r=H8();function o(n,i){if(n==null)return{};var s,a,c=r(n,i);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(n);for(a=0;a<u.length;a++)s=u[a],i.includes(s)||{}.propertyIsEnumerable.call(n,s)&&(c[s]=n[s])}return c}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}}),W8=Fe(B8(),1),Lt=Fe(un(),1),Z8=["middlewares","inputs","meta"];function Ss(t,e){let{middlewares:r=[],inputs:o,meta:n}=e,i=(0,W8.default)(e,Z8);return jF((0,Lt.default)((0,Lt.default)({},wy(t,i)),{},{inputs:[...t.inputs,...o??[]],middlewares:[...t.middlewares,...r],meta:t.meta&&n?(0,Lt.default)((0,Lt.default)({},t.meta),n):n??t.meta}))}function jF(t={}){let e=(0,Lt.default)({procedure:!0,inputs:[],middlewares:[]},t);return{_def:e,input(o){let n=NF(o);return Ss(e,{inputs:[o],middlewares:[L8(n)]})},output(o){let n=NF(o);return Ss(e,{output:o,middlewares:[U8(n)]})},meta(o){return Ss(e,{meta:o})},use(o){let n="_middlewares"in o?o._middlewares:[o];return Ss(e,{middlewares:n})},unstable_concat(o){return Ss(e,o._def)},concat(o){return Ss(e,o._def)},query(o){return JE((0,Lt.default)((0,Lt.default)({},e),{},{type:"query"}),o)},mutation(o){return JE((0,Lt.default)((0,Lt.default)({},e),{},{type:"mutation"}),o)},subscription(o){return JE((0,Lt.default)((0,Lt.default)({},e),{},{type:"subscription"}),o)},experimental_caller(o){return Ss(e,{caller:o})}}}function JE(t,e){let r=Ss(t,{resolver:e,middlewares:[async function(c){let u=await e(c);return{marker:FF,ok:!0,data:u,ctx:c.ctx}}]}),o=(0,Lt.default)((0,Lt.default)({},r._def),{},{type:t.type,experimental_caller:!!r._def.caller,meta:r._def.meta,$types:null}),n=V8(r._def),i=r._def.caller;if(!i)return n;let s=async(...a)=>await i({args:a,invoke:n,_def:o});return s._def=o,s}var G8=`
|
|
17
|
+
This is a client-only function.
|
|
18
|
+
If you want to call this function on the server, see https://trpc.io/docs/v11/server/server-side-calls
|
|
19
|
+
`.trim();async function LF(t,e,r){try{let o=e.middlewares[t];return await o((0,Lt.default)((0,Lt.default)({},r),{},{meta:e.meta,input:r.input,next(i){var s;let a=i;return LF(t+1,e,(0,Lt.default)((0,Lt.default)({},r),{},{ctx:a?.ctx?(0,Lt.default)((0,Lt.default)({},r.ctx),a.ctx):r.ctx,input:a&&"input"in a?a.input:r.input,getRawInput:(s=a?.getRawInput)!==null&&s!==void 0?s:r.getRawInput}))}}))}catch(o){return{ok:!1,error:Rn(o),marker:FF}}}function V8(t){async function e(r){if(!r||!("getRawInput"in r))throw new Error(G8);let o=await LF(0,t,r);if(!o)throw new nt({code:"INTERNAL_SERVER_ERROR",message:"No result from middlewares - did you forget to `return next()`?"});if(!o.ok)throw o.error;return o.data}return e._def=t,e.procedure=!0,e.meta=t.meta,e}var gl,yl,xl,MF=typeof window>"u"||"Deno"in window||((gl=globalThis.process)===null||gl===void 0||(gl=gl.env)===null||gl===void 0?void 0:gl.NODE_ENV)==="test"||!!(!((yl=globalThis.process)===null||yl===void 0||(yl=yl.env)===null||yl===void 0)&&yl.JEST_WORKER_ID)||!!(!((xl=globalThis.process)===null||xl===void 0||(xl=xl.env)===null||xl===void 0)&&xl.VITEST_WORKER_ID),DF=Fe(un(),1),K8=class YE{context(){return new YE}meta(){return new YE}create(e){var r,o,n,i,s,a;let c=(0,DF.default)((0,DF.default)({},e),{},{transformer:MD((r=e?.transformer)!==null&&r!==void 0?r:fl),isDev:(o=e?.isDev)!==null&&o!==void 0?o:((n=globalThis.process)===null||n===void 0?void 0:n.env.NODE_ENV)!=="production",allowOutsideOfServer:(i=e?.allowOutsideOfServer)!==null&&i!==void 0?i:!1,errorFormatter:(s=e?.errorFormatter)!==null&&s!==void 0?s:dl,isServer:(a=e?.isServer)!==null&&a!==void 0?a:MF,$types:null});{var u;if(!((u=e?.isServer)!==null&&u!==void 0?u:MF)&&e?.allowOutsideOfServer!==!0)throw new Error("You're trying to use @trpc/server in a non-server environment. This is not supported by default.")}return{_config:c,procedure:jF({meta:e?.defaultMeta}),middleware:j8(),router:bE(c),mergeRouters:DD,createCallerFactory:vE()}}},XE=new K8;var UF=XE.create(),_l=UF.router,Qn=UF.procedure;var qF=_l({check:Qn.query(()=>({ok:!0,service:"@wes-dev/pr"}))});var C={};an(C,{$brand:()=>ek,$input:()=>vO,$output:()=>bO,NEVER:()=>QE,TimePrecision:()=>kO,ZodAny:()=>mR,ZodArray:()=>xR,ZodBase64:()=>f_,ZodBase64URL:()=>m_,ZodBigInt:()=>Jl,ZodBigIntFormat:()=>y_,ZodBoolean:()=>Kl,ZodCIDRv4:()=>p_,ZodCIDRv6:()=>d_,ZodCUID:()=>o_,ZodCUID2:()=>i_,ZodCatch:()=>LR,ZodCodec:()=>qm,ZodCustom:()=>Hm,ZodCustomStringFormat:()=>Gl,ZodDate:()=>Fm,ZodDefault:()=>NR,ZodDiscriminatedUnion:()=>bR,ZodE164:()=>h_,ZodEmail:()=>t_,ZodEmoji:()=>r_,ZodEnum:()=>Wl,ZodError:()=>I7,ZodExactOptional:()=>TR,ZodFile:()=>RR,ZodFirstPartyTypeKind:()=>QR,ZodFunction:()=>JR,ZodGUID:()=>$m,ZodIPv4:()=>u_,ZodIPv6:()=>l_,ZodISODate:()=>Kx,ZodISODateTime:()=>Vx,ZodISODuration:()=>Yx,ZodISOTime:()=>Jx,ZodIntersection:()=>vR,ZodIssueCode:()=>C7,ZodJWT:()=>g_,ZodKSUID:()=>c_,ZodLazy:()=>GR,ZodLiteral:()=>CR,ZodMAC:()=>aR,ZodMap:()=>IR,ZodNaN:()=>qR,ZodNanoID:()=>n_,ZodNever:()=>gR,ZodNonOptional:()=>w_,ZodNull:()=>dR,ZodNullable:()=>PR,ZodNumber:()=>Vl,ZodNumberFormat:()=>nc,ZodObject:()=>jm,ZodOptional:()=>S_,ZodPipe:()=>Um,ZodPrefault:()=>DR,ZodPreprocess:()=>HR,ZodPromise:()=>KR,ZodReadonly:()=>BR,ZodRealError:()=>Br,ZodRecord:()=>Bl,ZodSet:()=>OR,ZodString:()=>Zl,ZodStringFormat:()=>Xe,ZodSuccess:()=>jR,ZodSymbol:()=>lR,ZodTemplateLiteral:()=>ZR,ZodTransform:()=>AR,ZodTuple:()=>wR,ZodType:()=>Ie,ZodULID:()=>s_,ZodURL:()=>Dm,ZodUUID:()=>Io,ZodUndefined:()=>pR,ZodUnion:()=>Lm,ZodUnknown:()=>hR,ZodVoid:()=>yR,ZodXID:()=>a_,ZodXor:()=>_R,_ZodString:()=>e_,_default:()=>MR,_function:()=>AL,any:()=>aL,array:()=>zm,base64:()=>Bj,base64url:()=>Wj,bigint:()=>rL,boolean:()=>uR,catch:()=>UR,check:()=>TL,cidrv4:()=>qj,cidrv6:()=>Hj,clone:()=>Or,codec:()=>IL,coerce:()=>eA,config:()=>wt,core:()=>_i,cuid:()=>Nj,cuid2:()=>Mj,custom:()=>$L,date:()=>uL,decode:()=>eR,decodeAsync:()=>rR,describe:()=>PL,discriminatedUnion:()=>hL,e164:()=>Zj,email:()=>Ej,emoji:()=>$j,encode:()=>QC,encodeAsync:()=>tR,endsWith:()=>Nl,enum:()=>b_,exactOptional:()=>$R,file:()=>SL,flattenError:()=>xm,float32:()=>Xj,float64:()=>Qj,formatError:()=>_m,fromJSONSchema:()=>LL,function:()=>AL,getErrorMap:()=>A7,globalRegistry:()=>tr,gt:()=>Eo,gte:()=>Rr,guid:()=>kj,hash:()=>Yj,hex:()=>Jj,hostname:()=>Kj,httpUrl:()=>Tj,includes:()=>$l,instanceof:()=>ML,int:()=>Xx,int32:()=>eL,int64:()=>nL,intersection:()=>SR,invertCodec:()=>OL,ipv4:()=>jj,ipv6:()=>Uj,iso:()=>Hl,json:()=>FL,jwt:()=>Gj,keyof:()=>lL,ksuid:()=>zj,lazy:()=>VR,length:()=>tc,literal:()=>vL,locales:()=>Om,looseObject:()=>fL,looseRecord:()=>yL,lowercase:()=>Al,lt:()=>wo,lte:()=>pn,mac:()=>Lj,map:()=>xL,maxLength:()=>ec,maxSize:()=>Rs,meta:()=>NL,mime:()=>Ml,minLength:()=>xi,minSize:()=>ko,multipleOf:()=>Cs,nan:()=>kL,nanoid:()=>Pj,nativeEnum:()=>bL,negative:()=>zx,never:()=>x_,nonnegative:()=>Lx,nonoptional:()=>zR,nonpositive:()=>jx,normalize:()=>Dl,null:()=>fR,nullable:()=>Nm,nullish:()=>wL,number:()=>cR,object:()=>pL,optional:()=>Pm,overwrite:()=>to,parse:()=>KC,parseAsync:()=>JC,partialRecord:()=>gL,pipe:()=>Qx,positive:()=>Fx,prefault:()=>FR,preprocess:()=>zL,prettifyError:()=>fk,promise:()=>RL,property:()=>Ux,readonly:()=>WR,record:()=>kR,refine:()=>YR,regex:()=>Rl,regexes:()=>ln,registry:()=>gx,safeDecode:()=>oR,safeDecodeAsync:()=>sR,safeEncode:()=>nR,safeEncodeAsync:()=>iR,safeParse:()=>YC,safeParseAsync:()=>XC,set:()=>_L,setErrorMap:()=>R7,size:()=>Qa,slugify:()=>Ll,startsWith:()=>Pl,strictObject:()=>dL,string:()=>Tm,stringFormat:()=>Vj,stringbool:()=>DL,success:()=>EL,superRefine:()=>XR,symbol:()=>iL,templateLiteral:()=>CL,toJSONSchema:()=>Wx,toLowerCase:()=>zl,toUpperCase:()=>jl,transform:()=>v_,treeifyError:()=>dk,trim:()=>Fl,tuple:()=>ER,uint32:()=>tL,uint64:()=>oL,ulid:()=>Dj,undefined:()=>sL,union:()=>__,unknown:()=>rc,uppercase:()=>Tl,url:()=>Aj,util:()=>U,uuid:()=>Ij,uuidv4:()=>Oj,uuidv6:()=>Cj,uuidv7:()=>Rj,void:()=>cL,xid:()=>Fj,xor:()=>mL});var _i={};an(_i,{$ZodAny:()=>qI,$ZodArray:()=>GI,$ZodAsyncError:()=>eo,$ZodBase64:()=>$I,$ZodBase64URL:()=>PI,$ZodBigInt:()=>cx,$ZodBigIntFormat:()=>zI,$ZodBoolean:()=>wm,$ZodCIDRv4:()=>RI,$ZodCIDRv6:()=>AI,$ZodCUID:()=>yI,$ZodCUID2:()=>xI,$ZodCatch:()=>pO,$ZodCheck:()=>ot,$ZodCheckBigIntFormat:()=>Gk,$ZodCheckEndsWith:()=>iI,$ZodCheckGreaterThan:()=>rx,$ZodCheckIncludes:()=>nI,$ZodCheckLengthEquals:()=>Qk,$ZodCheckLessThan:()=>tx,$ZodCheckLowerCase:()=>tI,$ZodCheckMaxLength:()=>Yk,$ZodCheckMaxSize:()=>Vk,$ZodCheckMimeType:()=>aI,$ZodCheckMinLength:()=>Xk,$ZodCheckMinSize:()=>Kk,$ZodCheckMultipleOf:()=>Wk,$ZodCheckNumberFormat:()=>Zk,$ZodCheckOverwrite:()=>cI,$ZodCheckProperty:()=>sI,$ZodCheckRegex:()=>eI,$ZodCheckSizeEquals:()=>Jk,$ZodCheckStartsWith:()=>oI,$ZodCheckStringFormat:()=>Ol,$ZodCheckUpperCase:()=>rI,$ZodCodec:()=>km,$ZodCustom:()=>_O,$ZodCustomStringFormat:()=>DI,$ZodDate:()=>ZI,$ZodDefault:()=>aO,$ZodDiscriminatedUnion:()=>JI,$ZodE164:()=>NI,$ZodEmail:()=>fI,$ZodEmoji:()=>hI,$ZodEncodeError:()=>ws,$ZodEnum:()=>tO,$ZodError:()=>ym,$ZodExactOptional:()=>iO,$ZodFile:()=>nO,$ZodFunction:()=>gO,$ZodGUID:()=>pI,$ZodIPv4:()=>II,$ZodIPv6:()=>OI,$ZodISODate:()=>wI,$ZodISODateTime:()=>SI,$ZodISODuration:()=>kI,$ZodISOTime:()=>EI,$ZodIntersection:()=>YI,$ZodJWT:()=>MI,$ZodKSUID:()=>vI,$ZodLazy:()=>xO,$ZodLiteral:()=>rO,$ZodMAC:()=>CI,$ZodMap:()=>QI,$ZodNaN:()=>dO,$ZodNanoID:()=>gI,$ZodNever:()=>BI,$ZodNonOptional:()=>uO,$ZodNull:()=>UI,$ZodNullable:()=>sO,$ZodNumber:()=>ax,$ZodNumberFormat:()=>FI,$ZodObject:()=>_z,$ZodObjectJIT:()=>VI,$ZodOptional:()=>lx,$ZodPipe:()=>px,$ZodPrefault:()=>cO,$ZodPreprocess:()=>fO,$ZodPromise:()=>yO,$ZodReadonly:()=>mO,$ZodRealError:()=>Hr,$ZodRecord:()=>XI,$ZodRegistry:()=>hx,$ZodSet:()=>eO,$ZodString:()=>Xa,$ZodStringFormat:()=>Ye,$ZodSuccess:()=>lO,$ZodSymbol:()=>jI,$ZodTemplateLiteral:()=>hO,$ZodTransform:()=>oO,$ZodTuple:()=>ux,$ZodType:()=>Se,$ZodULID:()=>_I,$ZodURL:()=>mI,$ZodUUID:()=>dI,$ZodUndefined:()=>LI,$ZodUnion:()=>Em,$ZodUnknown:()=>HI,$ZodVoid:()=>WI,$ZodXID:()=>bI,$ZodXor:()=>KI,$brand:()=>ek,$constructor:()=>I,$input:()=>vO,$output:()=>bO,Doc:()=>Sm,JSONSchema:()=>vj,JSONSchemaGenerator:()=>Zx,NEVER:()=>QE,TimePrecision:()=>kO,_any:()=>ZO,_array:()=>QO,_base64:()=>Px,_base64url:()=>Nx,_bigint:()=>jO,_boolean:()=>FO,_catch:()=>x7,_check:()=>bj,_cidrv4:()=>Tx,_cidrv6:()=>$x,_coercedBigint:()=>LO,_coercedBoolean:()=>zO,_coercedDate:()=>YO,_coercedNumber:()=>TO,_coercedString:()=>wO,_cuid:()=>Ex,_cuid2:()=>kx,_custom:()=>tC,_date:()=>JO,_decode:()=>Zy,_decodeAsync:()=>Vy,_default:()=>h7,_discriminatedUnion:()=>n7,_e164:()=>Mx,_email:()=>yx,_emoji:()=>Sx,_encode:()=>Wy,_encodeAsync:()=>Gy,_endsWith:()=>Nl,_enum:()=>u7,_file:()=>eC,_float32:()=>PO,_float64:()=>NO,_gt:()=>Eo,_gte:()=>Rr,_guid:()=>Cm,_includes:()=>$l,_int:()=>$O,_int32:()=>MO,_int64:()=>UO,_intersection:()=>o7,_ipv4:()=>Rx,_ipv6:()=>Ax,_isoDate:()=>OO,_isoDateTime:()=>IO,_isoDuration:()=>RO,_isoTime:()=>CO,_jwt:()=>Dx,_ksuid:()=>Cx,_lazy:()=>S7,_length:()=>tc,_literal:()=>p7,_lowercase:()=>Al,_lt:()=>wo,_lte:()=>pn,_mac:()=>EO,_map:()=>a7,_max:()=>pn,_maxLength:()=>ec,_maxSize:()=>Rs,_mime:()=>Ml,_min:()=>Rr,_minLength:()=>xi,_minSize:()=>ko,_multipleOf:()=>Cs,_nan:()=>XO,_nanoid:()=>wx,_nativeEnum:()=>l7,_negative:()=>zx,_never:()=>VO,_nonnegative:()=>Lx,_nonoptional:()=>g7,_nonpositive:()=>jx,_normalize:()=>Dl,_null:()=>WO,_nullable:()=>m7,_number:()=>AO,_optional:()=>f7,_overwrite:()=>to,_parse:()=>wl,_parseAsync:()=>El,_pipe:()=>_7,_positive:()=>Fx,_promise:()=>w7,_property:()=>Ux,_readonly:()=>b7,_record:()=>s7,_refine:()=>rC,_regex:()=>Rl,_safeDecode:()=>Jy,_safeDecodeAsync:()=>Xy,_safeEncode:()=>Ky,_safeEncodeAsync:()=>Yy,_safeParse:()=>kl,_safeParseAsync:()=>Il,_set:()=>c7,_size:()=>Qa,_slugify:()=>Ll,_startsWith:()=>Pl,_string:()=>SO,_stringFormat:()=>Ul,_stringbool:()=>sC,_success:()=>y7,_superRefine:()=>nC,_symbol:()=>HO,_templateLiteral:()=>v7,_toLowerCase:()=>zl,_toUpperCase:()=>jl,_transform:()=>d7,_trim:()=>Fl,_tuple:()=>i7,_uint32:()=>DO,_uint64:()=>qO,_ulid:()=>Ix,_undefined:()=>BO,_union:()=>t7,_unknown:()=>GO,_uppercase:()=>Tl,_url:()=>Rm,_uuid:()=>xx,_uuidv4:()=>_x,_uuidv6:()=>bx,_uuidv7:()=>vx,_void:()=>KO,_xid:()=>Ox,_xor:()=>r7,clone:()=>Or,config:()=>wt,createStandardJSONSchemaMethod:()=>ql,createToJSONSchemaMethod:()=>aC,decode:()=>w5,decodeAsync:()=>k5,describe:()=>oC,encode:()=>S5,encodeAsync:()=>E5,extractDefs:()=>Ts,finalize:()=>$s,flattenError:()=>xm,formatError:()=>_m,globalConfig:()=>Ka,globalRegistry:()=>tr,initializeContext:()=>As,isValidBase64:()=>TI,isValidBase64URL:()=>hz,isValidJWT:()=>gz,locales:()=>Om,meta:()=>iC,parse:()=>Hy,parseAsync:()=>By,prettifyError:()=>fk,process:()=>Ke,regexes:()=>ln,registry:()=>gx,safeDecode:()=>O5,safeDecodeAsync:()=>R5,safeEncode:()=>I5,safeEncodeAsync:()=>C5,safeParse:()=>mk,safeParseAsync:()=>hk,toDotPath:()=>VF,toJSONSchema:()=>Wx,treeifyError:()=>dk,util:()=>U,version:()=>uI});var HF,QE=Object.freeze({status:"aborted"});function I(t,e,r){function o(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,c);let u=s.prototype,l=Object.keys(u);for(let p=0;p<l.length;p++){let f=l[p];f in a||(a[f]=u[f].bind(a))}}let n=r?.Parent??Object;class i extends n{}Object.defineProperty(i,"name",{value:t});function s(a){var c;let u=r?.Parent?new i:this;o(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(s,"init",{value:o}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(s,"name",{value:t}),s}var ek=Symbol("zod_brand"),eo=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},ws=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}};(HF=globalThis).__zod_globalConfig??(HF.__zod_globalConfig={});var Ka=globalThis.__zod_globalConfig;function wt(t){return t&&Object.assign(Ka,t),Ka}var U={};an(U,{BIGINT_FORMAT_RANGES:()=>lk,Class:()=>rk,NUMBER_FORMAT_RANGES:()=>uk,aborted:()=>Os,allowsEval:()=>ik,assert:()=>e5,assertEqual:()=>J8,assertIs:()=>X8,assertNever:()=>Q8,assertNotEqual:()=>Y8,assignProp:()=>ks,base64ToUint8Array:()=>WF,base64urlToUint8Array:()=>y5,cached:()=>vl,captureStackTrace:()=>qy,cleanEnum:()=>g5,cleanRegex:()=>fm,clone:()=>Or,cloneDef:()=>r5,createTransparentProxy:()=>c5,defineLazy:()=>$e,esc:()=>Uy,escapeRegex:()=>An,explicitlyAborted:()=>pk,extend:()=>p5,finalizeIssue:()=>Cr,floatSafeRemainder:()=>nk,getElementAtPath:()=>n5,getEnumValues:()=>dm,getLengthableOrigin:()=>gm,getParsedType:()=>a5,getSizableOrigin:()=>hm,hexToUint8Array:()=>_5,isObject:()=>Ja,isPlainObject:()=>Is,issue:()=>Sl,joinValues:()=>T,jsonStringifyReplacer:()=>bl,merge:()=>f5,mergeDefs:()=>yi,normalizeParams:()=>Z,nullish:()=>Es,numKeys:()=>s5,objectClone:()=>t5,omit:()=>l5,optionalKeys:()=>ck,parsedType:()=>L,partial:()=>m5,pick:()=>u5,prefixIssues:()=>qr,primitiveTypes:()=>ak,promiseAllObject:()=>o5,propertyKeyTypes:()=>mm,randomString:()=>i5,required:()=>h5,safeExtend:()=>d5,shallowClone:()=>sk,slugify:()=>ok,stringifyPrimitive:()=>j,uint8ArrayToBase64:()=>ZF,uint8ArrayToBase64url:()=>x5,uint8ArrayToHex:()=>b5,unwrapMessage:()=>pm});function J8(t){return t}function Y8(t){return t}function X8(t){}function Q8(t){throw new Error("Unexpected value in exhaustive check")}function e5(t){}function dm(t){let e=Object.values(t).filter(o=>typeof o=="number");return Object.entries(t).filter(([o,n])=>e.indexOf(+o)===-1).map(([o,n])=>n)}function T(t,e="|"){return t.map(r=>j(r)).join(e)}function bl(t,e){return typeof e=="bigint"?e.toString():e}function vl(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Es(t){return t==null}function fm(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function nk(t,e){let r=t/e,o=Math.round(r),n=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-o)<n?0:r-o}var BF=Symbol("evaluating");function $e(t,e,r){let o;Object.defineProperty(t,e,{get(){if(o!==BF)return o===void 0&&(o=BF,o=r()),o},set(n){Object.defineProperty(t,e,{value:n})},configurable:!0})}function t5(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function ks(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function yi(...t){let e={};for(let r of t){let o=Object.getOwnPropertyDescriptors(r);Object.assign(e,o)}return Object.defineProperties({},e)}function r5(t){return yi(t._zod.def)}function n5(t,e){return e?e.reduce((r,o)=>r?.[o],t):t}function o5(t){let e=Object.keys(t),r=e.map(o=>t[o]);return Promise.all(r).then(o=>{let n={};for(let i=0;i<e.length;i++)n[e[i]]=o[i];return n})}function i5(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let o=0;o<t;o++)r+=e[Math.floor(Math.random()*e.length)];return r}function Uy(t){return JSON.stringify(t)}function ok(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var qy="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function Ja(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var ik=vl(()=>{if(Ka.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function Is(t){if(Ja(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(Ja(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function sk(t){return Is(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}function s5(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var a5=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},mm=new Set(["string","number","symbol"]),ak=new Set(["string","number","bigint","boolean","symbol","undefined"]);function An(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Or(t,e,r){let o=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(o._zod.parent=t),o}function Z(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function c5(t){let e;return new Proxy({},{get(r,o,n){return e??(e=t()),Reflect.get(e,o,n)},set(r,o,n,i){return e??(e=t()),Reflect.set(e,o,n,i)},has(r,o){return e??(e=t()),Reflect.has(e,o)},deleteProperty(r,o){return e??(e=t()),Reflect.deleteProperty(e,o)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,o){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,o)},defineProperty(r,o,n){return e??(e=t()),Reflect.defineProperty(e,o,n)}})}function j(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function ck(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var uk={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},lk={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function u5(t,e){let r=t._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i=yi(t._zod.def,{get shape(){let s={};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(s[a]=r.shape[a])}return ks(this,"shape",s),s},checks:[]});return Or(t,i)}function l5(t,e){let r=t._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=yi(t._zod.def,{get shape(){let s={...t._zod.def.shape};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&delete s[a]}return ks(this,"shape",s),s},checks:[]});return Or(t,i)}function p5(t,e){if(!Is(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0){let i=t._zod.def.shape;for(let s in e)if(Object.getOwnPropertyDescriptor(i,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=yi(t._zod.def,{get shape(){let i={...t._zod.def.shape,...e};return ks(this,"shape",i),i}});return Or(t,n)}function d5(t,e){if(!Is(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r=yi(t._zod.def,{get shape(){let o={...t._zod.def.shape,...e};return ks(this,"shape",o),o}});return Or(t,r)}function f5(t,e){if(t._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=yi(t._zod.def,{get shape(){let o={...t._zod.def.shape,...e._zod.def.shape};return ks(this,"shape",o),o},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return Or(t,r)}function m5(t,e,r){let n=e._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let s=yi(e._zod.def,{get shape(){let a=e._zod.def.shape,c={...a};if(r)for(let u in r){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=t?new t({type:"optional",innerType:a[u]}):a[u])}else for(let u in a)c[u]=t?new t({type:"optional",innerType:a[u]}):a[u];return ks(this,"shape",c),c},checks:[]});return Or(e,s)}function h5(t,e,r){let o=yi(e._zod.def,{get shape(){let n=e._zod.def.shape,i={...n};if(r)for(let s in r){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=new t({type:"nonoptional",innerType:n[s]}))}else for(let s in n)i[s]=new t({type:"nonoptional",innerType:n[s]});return ks(this,"shape",i),i}});return Or(e,o)}function Os(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function pk(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue===!1)return!0;return!1}function qr(t,e){return e.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(t),r})}function pm(t){return typeof t=="string"?t:t?.message}function Cr(t,e,r){let o=t.message?t.message:pm(t.inst?._zod.def?.error?.(t))??pm(e?.error?.(t))??pm(r.customError?.(t))??pm(r.localeError?.(t))??"Invalid input",{inst:n,continue:i,input:s,...a}=t;return a.path??(a.path=[]),a.message=o,e?.reportInput&&(a.input=s),a}function hm(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function gm(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function L(t){let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(t===null)return"null";if(Array.isArray(t))return"array";let r=t;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return e}function Sl(...t){let[e,r,o]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:o}:{...e}}function g5(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function WF(t){let e=atob(t),r=new Uint8Array(e.length);for(let o=0;o<e.length;o++)r[o]=e.charCodeAt(o);return r}function ZF(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function y5(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return WF(e+r)}function x5(t){return ZF(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function _5(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(e.length/2);for(let o=0;o<e.length;o+=2)r[o/2]=Number.parseInt(e.slice(o,o+2),16);return r}function b5(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var rk=class{constructor(...e){}};var GF=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,bl,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},ym=I("$ZodError",GF),Hr=I("$ZodError",GF,{Parent:Error});function xm(t,e=r=>r.message){let r={},o=[];for(let n of t.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(e(n))):o.push(e(n));return{formErrors:o,fieldErrors:r}}function _m(t,e=r=>r.message){let r={_errors:[]},o=(n,i=[])=>{for(let s of n.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>o({issues:a},[...i,...s.path]));else if(s.code==="invalid_key")o({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")o({issues:s.issues},[...i,...s.path]);else{let a=[...i,...s.path];if(a.length===0)r._errors.push(e(s));else{let c=r,u=0;for(;u<a.length;){let l=a[u];u===a.length-1?(c[l]=c[l]||{_errors:[]},c[l]._errors.push(e(s))):c[l]=c[l]||{_errors:[]},c=c[l],u++}}}};return o(t),r}function dk(t,e=r=>r.message){let r={errors:[]},o=(n,i=[])=>{var s,a;for(let c of n.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(u=>o({issues:u},[...i,...c.path]));else if(c.code==="invalid_key")o({issues:c.issues},[...i,...c.path]);else if(c.code==="invalid_element")o({issues:c.issues},[...i,...c.path]);else{let u=[...i,...c.path];if(u.length===0){r.errors.push(e(c));continue}let l=r,p=0;for(;p<u.length;){let f=u[p],d=p===u.length-1;typeof f=="string"?(l.properties??(l.properties={}),(s=l.properties)[f]??(s[f]={errors:[]}),l=l.properties[f]):(l.items??(l.items=[]),(a=l.items)[f]??(a[f]={errors:[]}),l=l.items[f]),d&&l.errors.push(e(c)),p++}}};return o(t),r}function VF(t){let e=[],r=t.map(o=>typeof o=="object"?o.key:o);for(let o of r)typeof o=="number"?e.push(`[${o}]`):typeof o=="symbol"?e.push(`[${JSON.stringify(String(o))}]`):/[^\w$]/.test(o)?e.push(`[${JSON.stringify(o)}]`):(e.length&&e.push("."),e.push(o));return e.join("")}function fk(t){let e=[],r=[...t.issues].sort((o,n)=>(o.path??[]).length-(n.path??[]).length);for(let o of r)e.push(`\u2716 ${o.message}`),o.path?.length&&e.push(` \u2192 at ${VF(o.path)}`);return e.join(`
|
|
20
|
+
`)}var wl=t=>(e,r,o,n)=>{let i=o?{...o,async:!1}:{async:!1},s=e._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new eo;if(s.issues.length){let a=new(n?.Err??t)(s.issues.map(c=>Cr(c,i,wt())));throw qy(a,n?.callee),a}return s.value},Hy=wl(Hr),El=t=>async(e,r,o,n)=>{let i=o?{...o,async:!0}:{async:!0},s=e._zod.run({value:r,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){let a=new(n?.Err??t)(s.issues.map(c=>Cr(c,i,wt())));throw qy(a,n?.callee),a}return s.value},By=El(Hr),kl=t=>(e,r,o)=>{let n=o?{...o,async:!1}:{async:!1},i=e._zod.run({value:r,issues:[]},n);if(i instanceof Promise)throw new eo;return i.issues.length?{success:!1,error:new(t??ym)(i.issues.map(s=>Cr(s,n,wt())))}:{success:!0,data:i.value}},mk=kl(Hr),Il=t=>async(e,r,o)=>{let n=o?{...o,async:!0}:{async:!0},i=e._zod.run({value:r,issues:[]},n);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new t(i.issues.map(s=>Cr(s,n,wt())))}:{success:!0,data:i.value}},hk=Il(Hr),Wy=t=>(e,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return wl(t)(e,r,n)},S5=Wy(Hr),Zy=t=>(e,r,o)=>wl(t)(e,r,o),w5=Zy(Hr),Gy=t=>async(e,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return El(t)(e,r,n)},E5=Gy(Hr),Vy=t=>async(e,r,o)=>El(t)(e,r,o),k5=Vy(Hr),Ky=t=>(e,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return kl(t)(e,r,n)},I5=Ky(Hr),Jy=t=>(e,r,o)=>kl(t)(e,r,o),O5=Jy(Hr),Yy=t=>async(e,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Il(t)(e,r,n)},C5=Yy(Hr),Xy=t=>async(e,r,o)=>Il(t)(e,r,o),R5=Xy(Hr);var ln={};an(ln,{base64:()=>Tk,base64url:()=>Qy,bigint:()=>zk,boolean:()=>Lk,browserEmail:()=>F5,cidrv4:()=>Rk,cidrv6:()=>Ak,cuid:()=>gk,cuid2:()=>yk,date:()=>Nk,datetime:()=>Dk,domain:()=>L5,duration:()=>Sk,e164:()=>Pk,email:()=>Ek,emoji:()=>kk,extendedDuration:()=>A5,guid:()=>wk,hex:()=>U5,hostname:()=>j5,html5Email:()=>N5,httpProtocol:()=>$k,idnEmail:()=>D5,integer:()=>jk,ipv4:()=>Ik,ipv6:()=>Ok,ksuid:()=>bk,lowercase:()=>Hk,mac:()=>Ck,md5_base64:()=>H5,md5_base64url:()=>B5,md5_hex:()=>q5,nanoid:()=>vk,null:()=>Uk,number:()=>ex,rfc5322Email:()=>M5,sha1_base64:()=>Z5,sha1_base64url:()=>G5,sha1_hex:()=>W5,sha256_base64:()=>K5,sha256_base64url:()=>J5,sha256_hex:()=>V5,sha384_base64:()=>X5,sha384_base64url:()=>Q5,sha384_hex:()=>Y5,sha512_base64:()=>tX,sha512_base64url:()=>rX,sha512_hex:()=>eX,string:()=>Fk,time:()=>Mk,ulid:()=>xk,undefined:()=>qk,unicodeEmail:()=>KF,uppercase:()=>Bk,uuid:()=>Ya,uuid4:()=>T5,uuid6:()=>$5,uuid7:()=>P5,xid:()=>_k});var gk=/^[cC][0-9a-z]{6,}$/,yk=/^[0-9a-z]+$/,xk=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,_k=/^[0-9a-vA-V]{20}$/,bk=/^[A-Za-z0-9]{27}$/,vk=/^[a-zA-Z0-9_-]{21}$/,Sk=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,A5=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,wk=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ya=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,T5=Ya(4),$5=Ya(6),P5=Ya(7),Ek=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,N5=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,M5=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,KF=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,D5=KF,F5=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,z5="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function kk(){return new RegExp(z5,"u")}var Ik=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ok=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Ck=t=>{let e=An(t??":");return new RegExp(`^(?:[0-9A-F]{2}${e}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${e}){5}[0-9a-f]{2}$`)},Rk=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Ak=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Tk=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Qy=/^[A-Za-z0-9_-]*$/,j5=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,L5=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,$k=/^https?$/,Pk=/^\+[1-9]\d{6,14}$/,JF="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Nk=new RegExp(`^${JF}$`);function YF(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Mk(t){return new RegExp(`^${YF(t)}$`)}function Dk(t){let e=YF({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let o=`${e}(?:${r.join("|")})`;return new RegExp(`^${JF}T(?:${o})$`)}var Fk=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},zk=/^-?\d+n?$/,jk=/^-?\d+$/,ex=/^-?\d+(?:\.\d+)?$/,Lk=/^(?:true|false)$/i,Uk=/^null$/i;var qk=/^undefined$/i;var Hk=/^[^A-Z]*$/,Bk=/^[^a-z]*$/,U5=/^[0-9a-fA-F]*$/;function bm(t,e){return new RegExp(`^[A-Za-z0-9+/]{${t}}${e}$`)}function vm(t){return new RegExp(`^[A-Za-z0-9_-]{${t}}$`)}var q5=/^[0-9a-fA-F]{32}$/,H5=bm(22,"=="),B5=vm(22),W5=/^[0-9a-fA-F]{40}$/,Z5=bm(27,"="),G5=vm(27),V5=/^[0-9a-fA-F]{64}$/,K5=bm(43,"="),J5=vm(43),Y5=/^[0-9a-fA-F]{96}$/,X5=bm(64,""),Q5=vm(64),eX=/^[0-9a-fA-F]{128}$/,tX=bm(86,"=="),rX=vm(86);var ot=I("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),QF={number:"number",bigint:"bigint",object:"date"},tx=I("$ZodCheckLessThan",(t,e)=>{ot.init(t,e);let r=QF[typeof e.value];t._zod.onattach.push(o=>{let n=o._zod.bag,i=(e.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<i&&(e.inclusive?n.maximum=e.value:n.exclusiveMaximum=e.value)}),t._zod.check=o=>{(e.inclusive?o.value<=e.value:o.value<e.value)||o.issues.push({origin:r,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:o.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),rx=I("$ZodCheckGreaterThan",(t,e)=>{ot.init(t,e);let r=QF[typeof e.value];t._zod.onattach.push(o=>{let n=o._zod.bag,i=(e.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>i&&(e.inclusive?n.minimum=e.value:n.exclusiveMinimum=e.value)}),t._zod.check=o=>{(e.inclusive?o.value>=e.value:o.value>e.value)||o.issues.push({origin:r,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:o.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Wk=I("$ZodCheckMultipleOf",(t,e)=>{ot.init(t,e),t._zod.onattach.push(r=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):nk(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),Zk=I("$ZodCheckNumberFormat",(t,e)=>{ot.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),o=r?"int":"number",[n,i]=uk[e.format];t._zod.onattach.push(s=>{let a=s._zod.bag;a.format=e.format,a.minimum=n,a.maximum=i,r&&(a.pattern=jk)}),t._zod.check=s=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:o,format:e.format,code:"invalid_type",continue:!1,input:a,inst:t});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:o,inclusive:!0,continue:!e.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:o,inclusive:!0,continue:!e.abort});return}}a<n&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:t,continue:!e.abort}),a>i&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:t,continue:!e.abort})}}),Gk=I("$ZodCheckBigIntFormat",(t,e)=>{ot.init(t,e);let[r,o]=lk[e.format];t._zod.onattach.push(n=>{let i=n._zod.bag;i.format=e.format,i.minimum=r,i.maximum=o}),t._zod.check=n=>{let i=n.value;i<r&&n.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:t,continue:!e.abort}),i>o&&n.issues.push({origin:"bigint",input:i,code:"too_big",maximum:o,inclusive:!0,inst:t,continue:!e.abort})}}),Vk=I("$ZodCheckMaxSize",(t,e)=>{var r;ot.init(t,e),(r=t._zod.def).when??(r.when=o=>{let n=o.value;return!Es(n)&&n.size!==void 0}),t._zod.onattach.push(o=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<n&&(o._zod.bag.maximum=e.maximum)}),t._zod.check=o=>{let n=o.value;n.size<=e.maximum||o.issues.push({origin:hm(n),code:"too_big",maximum:e.maximum,inclusive:!0,input:n,inst:t,continue:!e.abort})}}),Kk=I("$ZodCheckMinSize",(t,e)=>{var r;ot.init(t,e),(r=t._zod.def).when??(r.when=o=>{let n=o.value;return!Es(n)&&n.size!==void 0}),t._zod.onattach.push(o=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>n&&(o._zod.bag.minimum=e.minimum)}),t._zod.check=o=>{let n=o.value;n.size>=e.minimum||o.issues.push({origin:hm(n),code:"too_small",minimum:e.minimum,inclusive:!0,input:n,inst:t,continue:!e.abort})}}),Jk=I("$ZodCheckSizeEquals",(t,e)=>{var r;ot.init(t,e),(r=t._zod.def).when??(r.when=o=>{let n=o.value;return!Es(n)&&n.size!==void 0}),t._zod.onattach.push(o=>{let n=o._zod.bag;n.minimum=e.size,n.maximum=e.size,n.size=e.size}),t._zod.check=o=>{let n=o.value,i=n.size;if(i===e.size)return;let s=i>e.size;o.issues.push({origin:hm(n),...s?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:!0,exact:!0,input:o.value,inst:t,continue:!e.abort})}}),Yk=I("$ZodCheckMaxLength",(t,e)=>{var r;ot.init(t,e),(r=t._zod.def).when??(r.when=o=>{let n=o.value;return!Es(n)&&n.length!==void 0}),t._zod.onattach.push(o=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<n&&(o._zod.bag.maximum=e.maximum)}),t._zod.check=o=>{let n=o.value;if(n.length<=e.maximum)return;let s=gm(n);o.issues.push({origin:s,code:"too_big",maximum:e.maximum,inclusive:!0,input:n,inst:t,continue:!e.abort})}}),Xk=I("$ZodCheckMinLength",(t,e)=>{var r;ot.init(t,e),(r=t._zod.def).when??(r.when=o=>{let n=o.value;return!Es(n)&&n.length!==void 0}),t._zod.onattach.push(o=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>n&&(o._zod.bag.minimum=e.minimum)}),t._zod.check=o=>{let n=o.value;if(n.length>=e.minimum)return;let s=gm(n);o.issues.push({origin:s,code:"too_small",minimum:e.minimum,inclusive:!0,input:n,inst:t,continue:!e.abort})}}),Qk=I("$ZodCheckLengthEquals",(t,e)=>{var r;ot.init(t,e),(r=t._zod.def).when??(r.when=o=>{let n=o.value;return!Es(n)&&n.length!==void 0}),t._zod.onattach.push(o=>{let n=o._zod.bag;n.minimum=e.length,n.maximum=e.length,n.length=e.length}),t._zod.check=o=>{let n=o.value,i=n.length;if(i===e.length)return;let s=gm(n),a=i>e.length;o.issues.push({origin:s,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:o.value,inst:t,continue:!e.abort})}}),Ol=I("$ZodCheckStringFormat",(t,e)=>{var r,o;ot.init(t,e),t._zod.onattach.push(n=>{let i=n._zod.bag;i.format=e.format,e.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:e.format,input:n.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(o=t._zod).check??(o.check=()=>{})}),eI=I("$ZodCheckRegex",(t,e)=>{Ol.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),tI=I("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=Hk),Ol.init(t,e)}),rI=I("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=Bk),Ol.init(t,e)}),nI=I("$ZodCheckIncludes",(t,e)=>{ot.init(t,e);let r=An(e.includes),o=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=o,t._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(o)}),t._zod.check=n=>{n.value.includes(e.includes,e.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:n.value,inst:t,continue:!e.abort})}}),oI=I("$ZodCheckStartsWith",(t,e)=>{ot.init(t,e);let r=new RegExp(`^${An(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),t._zod.check=o=>{o.value.startsWith(e.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:o.value,inst:t,continue:!e.abort})}}),iI=I("$ZodCheckEndsWith",(t,e)=>{ot.init(t,e);let r=new RegExp(`.*${An(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),t._zod.check=o=>{o.value.endsWith(e.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:o.value,inst:t,continue:!e.abort})}});function XF(t,e,r){t.issues.length&&e.issues.push(...qr(r,t.issues))}var sI=I("$ZodCheckProperty",(t,e)=>{ot.init(t,e),t._zod.check=r=>{let o=e.schema._zod.run({value:r.value[e.property],issues:[]},{});if(o instanceof Promise)return o.then(n=>XF(n,r,e.property));XF(o,r,e.property)}}),aI=I("$ZodCheckMimeType",(t,e)=>{ot.init(t,e);let r=new Set(e.mime);t._zod.onattach.push(o=>{o._zod.bag.mime=e.mime}),t._zod.check=o=>{r.has(o.value.type)||o.issues.push({code:"invalid_value",values:e.mime,input:o.value.type,inst:t,continue:!e.abort})}}),cI=I("$ZodCheckOverwrite",(t,e)=>{ot.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var Sm=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let o=e.split(`
|
|
21
|
+
`).filter(s=>s),n=Math.min(...o.map(s=>s.length-s.trimStart().length)),i=o.map(s=>s.slice(n)).map(s=>" ".repeat(this.indent*2)+s);for(let s of i)this.content.push(s)}compile(){let e=Function,r=this?.args,n=[...(this?.content??[""]).map(i=>` ${i}`)];return new e(...r,n.join(`
|
|
22
|
+
`))}};var uI={major:4,minor:4,patch:3};var Se=I("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=uI;let o=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&o.unshift(t);for(let n of o)for(let i of n._zod.onattach)i(t);if(o.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let n=(s,a,c)=>{let u=Os(s),l;for(let p of a){if(p._zod.def.when){if(pk(s)||!p._zod.def.when(s))continue}else if(u)continue;let f=s.issues.length,d=p._zod.check(s);if(d instanceof Promise&&c?.async===!1)throw new eo;if(l||d instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await d,s.issues.length!==f&&(u||(u=Os(s,f)))});else{if(s.issues.length===f)continue;u||(u=Os(s,f))}}return l?l.then(()=>s):s},i=(s,a,c)=>{if(Os(s))return s.aborted=!0,s;let u=n(a,o,c);if(u instanceof Promise){if(c.async===!1)throw new eo;return u.then(l=>t._zod.parse(l,c))}return t._zod.parse(u,c)};t._zod.run=(s,a)=>{if(a.skipChecks)return t._zod.parse(s,a);if(a.direction==="backward"){let u=t._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(l=>i(l,s,a)):i(u,s,a)}let c=t._zod.parse(s,a);if(c instanceof Promise){if(a.async===!1)throw new eo;return c.then(u=>n(u,o,a))}return n(c,o,a)}}$e(t,"~standard",()=>({validate:n=>{try{let i=mk(t,n);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return hk(t,n).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}))}),Xa=I("$ZodString",(t,e)=>{Se.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??Fk(t._zod.bag),t._zod.parse=(r,o)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),Ye=I("$ZodStringFormat",(t,e)=>{Ol.init(t,e),Xa.init(t,e)}),pI=I("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=wk),Ye.init(t,e)}),dI=I("$ZodUUID",(t,e)=>{if(e.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(o===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Ya(o))}else e.pattern??(e.pattern=Ya());Ye.init(t,e)}),fI=I("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=Ek),Ye.init(t,e)}),mI=I("$ZodURL",(t,e)=>{Ye.init(t,e),t._zod.check=r=>{try{let o=r.value.trim();if(!e.normalize&&e.protocol?.source===$k.source&&!/^https?:\/\//i.test(o)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:t,continue:!e.abort});return}let n=new URL(o);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(n.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),e.normalize?r.value=n.href:r.value=o;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),hI=I("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=kk()),Ye.init(t,e)}),gI=I("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=vk),Ye.init(t,e)}),yI=I("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=gk),Ye.init(t,e)}),xI=I("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=yk),Ye.init(t,e)}),_I=I("$ZodULID",(t,e)=>{e.pattern??(e.pattern=xk),Ye.init(t,e)}),bI=I("$ZodXID",(t,e)=>{e.pattern??(e.pattern=_k),Ye.init(t,e)}),vI=I("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=bk),Ye.init(t,e)}),SI=I("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=Dk(e)),Ye.init(t,e)}),wI=I("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=Nk),Ye.init(t,e)}),EI=I("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=Mk(e)),Ye.init(t,e)}),kI=I("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=Sk),Ye.init(t,e)}),II=I("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=Ik),Ye.init(t,e),t._zod.bag.format="ipv4"}),OI=I("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=Ok),Ye.init(t,e),t._zod.bag.format="ipv6",t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),CI=I("$ZodMAC",(t,e)=>{e.pattern??(e.pattern=Ck(e.delimiter)),Ye.init(t,e),t._zod.bag.format="mac"}),RI=I("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=Rk),Ye.init(t,e)}),AI=I("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=Ak),Ye.init(t,e),t._zod.check=r=>{let o=r.value.split("/");try{if(o.length!==2)throw new Error;let[n,i]=o;if(!i)throw new Error;let s=Number(i);if(`${s}`!==i)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function TI(t){if(t==="")return!0;if(/\s/.test(t)||t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var $I=I("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=Tk),Ye.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=r=>{TI(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function hz(t){if(!Qy.test(t))return!1;let e=t.replace(/[-_]/g,o=>o==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return TI(r)}var PI=I("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=Qy),Ye.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=r=>{hz(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),NI=I("$ZodE164",(t,e)=>{e.pattern??(e.pattern=Pk),Ye.init(t,e)});function gz(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||e&&(!("alg"in n)||n.alg!==e))}catch{return!1}}var MI=I("$ZodJWT",(t,e)=>{Ye.init(t,e),t._zod.check=r=>{gz(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),DI=I("$ZodCustomStringFormat",(t,e)=>{Ye.init(t,e),t._zod.check=r=>{e.fn(r.value)||r.issues.push({code:"invalid_format",format:e.format,input:r.value,inst:t,continue:!e.abort})}}),ax=I("$ZodNumber",(t,e)=>{Se.init(t,e),t._zod.pattern=t._zod.bag.pattern??ex,t._zod.parse=(r,o)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let i=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:t,...i?{received:i}:{}}),r}}),FI=I("$ZodNumberFormat",(t,e)=>{Zk.init(t,e),ax.init(t,e)}),wm=I("$ZodBoolean",(t,e)=>{Se.init(t,e),t._zod.pattern=Lk,t._zod.parse=(r,o)=>{if(e.coerce)try{r.value=!!r.value}catch{}let n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:t}),r}}),cx=I("$ZodBigInt",(t,e)=>{Se.init(t,e),t._zod.pattern=zk,t._zod.parse=(r,o)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:t}),r}}),zI=I("$ZodBigIntFormat",(t,e)=>{Gk.init(t,e),cx.init(t,e)}),jI=I("$ZodSymbol",(t,e)=>{Se.init(t,e),t._zod.parse=(r,o)=>{let n=r.value;return typeof n=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:n,inst:t}),r}}),LI=I("$ZodUndefined",(t,e)=>{Se.init(t,e),t._zod.pattern=qk,t._zod.values=new Set([void 0]),t._zod.parse=(r,o)=>{let n=r.value;return typeof n>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:t}),r}}),UI=I("$ZodNull",(t,e)=>{Se.init(t,e),t._zod.pattern=Uk,t._zod.values=new Set([null]),t._zod.parse=(r,o)=>{let n=r.value;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:t}),r}}),qI=I("$ZodAny",(t,e)=>{Se.init(t,e),t._zod.parse=r=>r}),HI=I("$ZodUnknown",(t,e)=>{Se.init(t,e),t._zod.parse=r=>r}),BI=I("$ZodNever",(t,e)=>{Se.init(t,e),t._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)}),WI=I("$ZodVoid",(t,e)=>{Se.init(t,e),t._zod.parse=(r,o)=>{let n=r.value;return typeof n>"u"||r.issues.push({expected:"void",code:"invalid_type",input:n,inst:t}),r}}),ZI=I("$ZodDate",(t,e)=>{Se.init(t,e),t._zod.parse=(r,o)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}let n=r.value,i=n instanceof Date;return i&&!Number.isNaN(n.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:n,...i?{received:"Invalid Date"}:{},inst:t}),r}});function tz(t,e,r){t.issues.length&&e.issues.push(...qr(r,t.issues)),e.value[r]=t.value}var GI=I("$ZodArray",(t,e)=>{Se.init(t,e),t._zod.parse=(r,o)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:t}),r;r.value=Array(n.length);let i=[];for(let s=0;s<n.length;s++){let a=n[s],c=e.element._zod.run({value:a,issues:[]},o);c instanceof Promise?i.push(c.then(u=>tz(u,r,s))):tz(c,r,s)}return i.length?Promise.all(i).then(()=>r):r}});function sx(t,e,r,o,n,i){let s=r in o;if(t.issues.length){if(n&&i&&!s)return;e.issues.push(...qr(r,t.issues))}if(!s&&!n){t.issues.length||e.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}t.value===void 0?s&&(e.value[r]=void 0):e.value[r]=t.value}function yz(t){let e=Object.keys(t.shape);for(let o of e)if(!t.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);let r=ck(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function xz(t,e,r,o,n,i){let s=[],a=n.keySet,c=n.catchall._zod,u=c.def.type,l=c.optin==="optional",p=c.optout==="optional";for(let f in e){if(f==="__proto__"||a.has(f))continue;if(u==="never"){s.push(f);continue}let d=c.run({value:e[f],issues:[]},o);d instanceof Promise?t.push(d.then(m=>sx(m,r,f,e,l,p))):sx(d,r,f,e,l,p)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:e,inst:i}),t.length?Promise.all(t).then(()=>r):r}var _z=I("$ZodObject",(t,e)=>{if(Se.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let a=e.shape;Object.defineProperty(e,"shape",{get:()=>{let c={...a};return Object.defineProperty(e,"shape",{value:c}),c}})}let o=vl(()=>yz(e));$e(t._zod,"propValues",()=>{let a=e.shape,c={};for(let u in a){let l=a[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let p of l.values)c[u].add(p)}}return c});let n=Ja,i=e.catchall,s;t._zod.parse=(a,c)=>{s??(s=o.value);let u=a.value;if(!n(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:t}),a;a.value={};let l=[],p=s.shape;for(let f of s.keys){let d=p[f],m=d._zod.optin==="optional",g=d._zod.optout==="optional",y=d._zod.run({value:u[f],issues:[]},c);y instanceof Promise?l.push(y.then(v=>sx(v,a,f,u,m,g))):sx(y,a,f,u,m,g)}return i?xz(l,u,a,c,o.value,t):l.length?Promise.all(l).then(()=>a):a}}),VI=I("$ZodObjectJIT",(t,e)=>{_z.init(t,e);let r=t._zod.parse,o=vl(()=>yz(e)),n=f=>{let d=new Sm(["shape","payload","ctx"]),m=o.value,g=R=>{let S=Uy(R);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};d.write("const input = payload.value;");let y=Object.create(null),v=0;for(let R of m.keys)y[R]=`key_${v++}`;d.write("const newResult = {};");for(let R of m.keys){let S=y[R],P=Uy(R),D=f[R],X=D?._zod?.optin==="optional",N=D?._zod?.optout==="optional";d.write(`const ${S} = ${g(R)};`),X&&N?d.write(`
|
|
23
|
+
if (${S}.issues.length) {
|
|
24
|
+
if (${P} in input) {
|
|
25
|
+
payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
|
|
26
|
+
...iss,
|
|
27
|
+
path: iss.path ? [${P}, ...iss.path] : [${P}]
|
|
28
|
+
})));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (${S}.value === undefined) {
|
|
33
|
+
if (${P} in input) {
|
|
34
|
+
newResult[${P}] = undefined;
|
|
35
|
+
}
|
|
36
|
+
} else {
|
|
37
|
+
newResult[${P}] = ${S}.value;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
`):X?d.write(`
|
|
41
|
+
if (${S}.issues.length) {
|
|
42
|
+
payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
|
|
43
|
+
...iss,
|
|
44
|
+
path: iss.path ? [${P}, ...iss.path] : [${P}]
|
|
45
|
+
})));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (${S}.value === undefined) {
|
|
49
|
+
if (${P} in input) {
|
|
50
|
+
newResult[${P}] = undefined;
|
|
51
|
+
}
|
|
52
|
+
} else {
|
|
53
|
+
newResult[${P}] = ${S}.value;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
`):d.write(`
|
|
57
|
+
const ${S}_present = ${P} in input;
|
|
58
|
+
if (${S}.issues.length) {
|
|
59
|
+
payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
|
|
60
|
+
...iss,
|
|
61
|
+
path: iss.path ? [${P}, ...iss.path] : [${P}]
|
|
62
|
+
})));
|
|
63
|
+
}
|
|
64
|
+
if (!${S}_present && !${S}.issues.length) {
|
|
65
|
+
payload.issues.push({
|
|
66
|
+
code: "invalid_type",
|
|
67
|
+
expected: "nonoptional",
|
|
68
|
+
input: undefined,
|
|
69
|
+
path: [${P}]
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (${S}_present) {
|
|
74
|
+
if (${S}.value === undefined) {
|
|
75
|
+
newResult[${P}] = undefined;
|
|
76
|
+
} else {
|
|
77
|
+
newResult[${P}] = ${S}.value;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
`)}d.write("payload.value = newResult;"),d.write("return payload;");let E=d.compile();return(R,S)=>E(f,R,S)},i,s=Ja,a=!Ka.jitless,u=a&&ik.value,l=e.catchall,p;t._zod.parse=(f,d)=>{p??(p=o.value);let m=f.value;return s(m)?a&&u&&d?.async===!1&&d.jitless!==!0?(i||(i=n(e.shape)),f=i(f,d),l?xz([],m,f,d,p,t):f):r(f,d):(f.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),f)}});function rz(t,e,r,o){for(let i of t)if(i.issues.length===0)return e.value=i.value,e;let n=t.filter(i=>!Os(i));return n.length===1?(e.value=n[0].value,n[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(i=>i.issues.map(s=>Cr(s,o,wt())))}),e)}var Em=I("$ZodUnion",(t,e)=>{Se.init(t,e),$e(t._zod,"optin",()=>e.options.some(o=>o._zod.optin==="optional")?"optional":void 0),$e(t._zod,"optout",()=>e.options.some(o=>o._zod.optout==="optional")?"optional":void 0),$e(t._zod,"values",()=>{if(e.options.every(o=>o._zod.values))return new Set(e.options.flatMap(o=>Array.from(o._zod.values)))}),$e(t._zod,"pattern",()=>{if(e.options.every(o=>o._zod.pattern)){let o=e.options.map(n=>n._zod.pattern);return new RegExp(`^(${o.map(n=>fm(n.source)).join("|")})$`)}});let r=e.options.length===1?e.options[0]._zod.run:null;t._zod.parse=(o,n)=>{if(r)return r(o,n);let i=!1,s=[];for(let a of e.options){let c=a._zod.run({value:o.value,issues:[]},n);if(c instanceof Promise)s.push(c),i=!0;else{if(c.issues.length===0)return c;s.push(c)}}return i?Promise.all(s).then(a=>rz(a,o,t,n)):rz(s,o,t,n)}});function nz(t,e,r,o){let n=t.filter(i=>i.issues.length===0);return n.length===1?(e.value=n[0].value,e):(n.length===0?e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(i=>i.issues.map(s=>Cr(s,o,wt())))}):e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:[],inclusive:!1}),e)}var KI=I("$ZodXor",(t,e)=>{Em.init(t,e),e.inclusive=!1;let r=e.options.length===1?e.options[0]._zod.run:null;t._zod.parse=(o,n)=>{if(r)return r(o,n);let i=!1,s=[];for(let a of e.options){let c=a._zod.run({value:o.value,issues:[]},n);c instanceof Promise?(s.push(c),i=!0):s.push(c)}return i?Promise.all(s).then(a=>nz(a,o,t,n)):nz(s,o,t,n)}}),JI=I("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,Em.init(t,e);let r=t._zod.parse;$e(t._zod,"propValues",()=>{let n={};for(let i of e.options){let s=i._zod.propValues;if(!s||Object.keys(s).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let[a,c]of Object.entries(s)){n[a]||(n[a]=new Set);for(let u of c)n[a].add(u)}}return n});let o=vl(()=>{let n=e.options,i=new Map;for(let s of n){let a=s._zod.propValues?.[e.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(let c of a){if(i.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,s)}}return i});t._zod.parse=(n,i)=>{let s=n.value;if(!Ja(s))return n.issues.push({code:"invalid_type",expected:"object",input:s,inst:t}),n;let a=o.value.get(s?.[e.discriminator]);return a?a._zod.run(n,i):e.unionFallback||i.direction==="backward"?r(n,i):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,options:Array.from(o.value.keys()),input:s,path:[e.discriminator],inst:t}),n)}}),YI=I("$ZodIntersection",(t,e)=>{Se.init(t,e),t._zod.parse=(r,o)=>{let n=r.value,i=e.left._zod.run({value:n,issues:[]},o),s=e.right._zod.run({value:n,issues:[]},o);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([c,u])=>oz(r,c,u)):oz(r,i,s)}});function lI(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(Is(t)&&Is(e)){let r=Object.keys(e),o=Object.keys(t).filter(i=>r.indexOf(i)!==-1),n={...t,...e};for(let i of o){let s=lI(t[i],e[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};n[i]=s.data}return{valid:!0,data:n}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<t.length;o++){let n=t[o],i=e[o],s=lI(n,i);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function oz(t,e,r){let o=new Map,n;for(let a of e.issues)if(a.code==="unrecognized_keys"){n??(n=a);for(let c of a.keys)o.has(c)||o.set(c,{}),o.get(c).l=!0}else t.issues.push(a);for(let a of r.issues)if(a.code==="unrecognized_keys")for(let c of a.keys)o.has(c)||o.set(c,{}),o.get(c).r=!0;else t.issues.push(a);let i=[...o].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(i.length&&n&&t.issues.push({...n,keys:i}),Os(t))return t;let s=lI(e.value,r.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return t.value=s.data,t}var ux=I("$ZodTuple",(t,e)=>{Se.init(t,e);let r=e.items;t._zod.parse=(o,n)=>{let i=o.value;if(!Array.isArray(i))return o.issues.push({input:i,inst:t,expected:"tuple",code:"invalid_type"}),o;o.value=[];let s=[],a=iz(r,"optin"),c=iz(r,"optout");if(!e.rest){if(i.length<a)return o.issues.push({code:"too_small",minimum:a,inclusive:!0,input:i,inst:t,origin:"array"}),o;i.length>r.length&&o.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:i,inst:t,origin:"array"})}let u=new Array(r.length);for(let l=0;l<r.length;l++){let p=r[l]._zod.run({value:i[l],issues:[]},n);p instanceof Promise?s.push(p.then(f=>{u[l]=f})):u[l]=p}if(e.rest){let l=r.length-1,p=i.slice(r.length);for(let f of p){l++;let d=e.rest._zod.run({value:f,issues:[]},n);d instanceof Promise?s.push(d.then(m=>sz(m,o,l))):sz(d,o,l)}}return s.length?Promise.all(s).then(()=>az(u,o,r,i,c)):az(u,o,r,i,c)}});function iz(t,e){for(let r=t.length-1;r>=0;r--)if(t[r]._zod[e]!=="optional")return r+1;return 0}function sz(t,e,r){t.issues.length&&e.issues.push(...qr(r,t.issues)),e.value[r]=t.value}function az(t,e,r,o,n){for(let i=0;i<r.length;i++){let s=t[i],a=i<o.length;if(s.issues.length){if(!a&&i>=n){e.value.length=i;break}e.issues.push(...qr(i,s.issues))}e.value[i]=s.value}for(let i=e.value.length-1;i>=o.length&&(r[i]._zod.optout==="optional"&&e.value[i]===void 0);i--)e.value.length=i;return e}var XI=I("$ZodRecord",(t,e)=>{Se.init(t,e),t._zod.parse=(r,o)=>{let n=r.value;if(!Is(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:t}),r;let i=[],s=e.keyType._zod.values;if(s){r.value={};let a=new Set;for(let u of s)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);let l=e.keyType._zod.run({value:u,issues:[]},o);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(l.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(d=>Cr(d,o,wt())),input:u,path:[u],inst:t});continue}let p=l.value,f=e.valueType._zod.run({value:n[u],issues:[]},o);f instanceof Promise?i.push(f.then(d=>{d.issues.length&&r.issues.push(...qr(u,d.issues)),r.value[p]=d.value})):(f.issues.length&&r.issues.push(...qr(u,f.issues)),r.value[p]=f.value)}let c;for(let u in n)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:n,inst:t,keys:c})}else{r.value={};for(let a of Reflect.ownKeys(n)){if(a==="__proto__"||!Object.prototype.propertyIsEnumerable.call(n,a))continue;let c=e.keyType._zod.run({value:a,issues:[]},o);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&ex.test(a)&&c.issues.length){let p=e.keyType._zod.run({value:Number(a),issues:[]},o);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");p.issues.length===0&&(c=p)}if(c.issues.length){e.mode==="loose"?r.value[a]=n[a]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(p=>Cr(p,o,wt())),input:a,path:[a],inst:t});continue}let l=e.valueType._zod.run({value:n[a],issues:[]},o);l instanceof Promise?i.push(l.then(p=>{p.issues.length&&r.issues.push(...qr(a,p.issues)),r.value[c.value]=p.value})):(l.issues.length&&r.issues.push(...qr(a,l.issues)),r.value[c.value]=l.value)}}return i.length?Promise.all(i).then(()=>r):r}}),QI=I("$ZodMap",(t,e)=>{Se.init(t,e),t._zod.parse=(r,o)=>{let n=r.value;if(!(n instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:n,inst:t}),r;let i=[];r.value=new Map;for(let[s,a]of n){let c=e.keyType._zod.run({value:s,issues:[]},o),u=e.valueType._zod.run({value:a,issues:[]},o);c instanceof Promise||u instanceof Promise?i.push(Promise.all([c,u]).then(([l,p])=>{cz(l,p,r,s,n,t,o)})):cz(c,u,r,s,n,t,o)}return i.length?Promise.all(i).then(()=>r):r}});function cz(t,e,r,o,n,i,s){t.issues.length&&(mm.has(typeof o)?r.issues.push(...qr(o,t.issues)):r.issues.push({code:"invalid_key",origin:"map",input:n,inst:i,issues:t.issues.map(a=>Cr(a,s,wt()))})),e.issues.length&&(mm.has(typeof o)?r.issues.push(...qr(o,e.issues)):r.issues.push({origin:"map",code:"invalid_element",input:n,inst:i,key:o,issues:e.issues.map(a=>Cr(a,s,wt()))})),r.value.set(t.value,e.value)}var eO=I("$ZodSet",(t,e)=>{Se.init(t,e),t._zod.parse=(r,o)=>{let n=r.value;if(!(n instanceof Set))return r.issues.push({input:n,inst:t,expected:"set",code:"invalid_type"}),r;let i=[];r.value=new Set;for(let s of n){let a=e.valueType._zod.run({value:s,issues:[]},o);a instanceof Promise?i.push(a.then(c=>uz(c,r))):uz(a,r)}return i.length?Promise.all(i).then(()=>r):r}});function uz(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value)}var tO=I("$ZodEnum",(t,e)=>{Se.init(t,e);let r=dm(e.entries),o=new Set(r);t._zod.values=o,t._zod.pattern=new RegExp(`^(${r.filter(n=>mm.has(typeof n)).map(n=>typeof n=="string"?An(n):n.toString()).join("|")})$`),t._zod.parse=(n,i)=>{let s=n.value;return o.has(s)||n.issues.push({code:"invalid_value",values:r,input:s,inst:t}),n}}),rO=I("$ZodLiteral",(t,e)=>{if(Se.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(e.values);t._zod.values=r,t._zod.pattern=new RegExp(`^(${e.values.map(o=>typeof o=="string"?An(o):o?An(o.toString()):String(o)).join("|")})$`),t._zod.parse=(o,n)=>{let i=o.value;return r.has(i)||o.issues.push({code:"invalid_value",values:e.values,input:i,inst:t}),o}}),nO=I("$ZodFile",(t,e)=>{Se.init(t,e),t._zod.parse=(r,o)=>{let n=r.value;return n instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:n,inst:t}),r}}),oO=I("$ZodTransform",(t,e)=>{Se.init(t,e),t._zod.optin="optional",t._zod.parse=(r,o)=>{if(o.direction==="backward")throw new ws(t.constructor.name);let n=e.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then(s=>(r.value=s,r.fallback=!0,r));if(n instanceof Promise)throw new eo;return r.value=n,r.fallback=!0,r}});function lz(t,e){return e===void 0&&(t.issues.length||t.fallback)?{issues:[],value:void 0}:t}var lx=I("$ZodOptional",(t,e)=>{Se.init(t,e),t._zod.optin="optional",t._zod.optout="optional",$e(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),$e(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${fm(r.source)})?$`):void 0}),t._zod.parse=(r,o)=>{if(e.innerType._zod.optin==="optional"){let n=r.value,i=e.innerType._zod.run(r,o);return i instanceof Promise?i.then(s=>lz(s,n)):lz(i,n)}return r.value===void 0?r:e.innerType._zod.run(r,o)}}),iO=I("$ZodExactOptional",(t,e)=>{lx.init(t,e),$e(t._zod,"values",()=>e.innerType._zod.values),$e(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(r,o)=>e.innerType._zod.run(r,o)}),sO=I("$ZodNullable",(t,e)=>{Se.init(t,e),$e(t._zod,"optin",()=>e.innerType._zod.optin),$e(t._zod,"optout",()=>e.innerType._zod.optout),$e(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${fm(r.source)}|null)$`):void 0}),$e(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,o)=>r.value===null?r:e.innerType._zod.run(r,o)}),aO=I("$ZodDefault",(t,e)=>{Se.init(t,e),t._zod.optin="optional",$e(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,o)=>{if(o.direction==="backward")return e.innerType._zod.run(r,o);if(r.value===void 0)return r.value=e.defaultValue,r;let n=e.innerType._zod.run(r,o);return n instanceof Promise?n.then(i=>pz(i,e)):pz(n,e)}});function pz(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var cO=I("$ZodPrefault",(t,e)=>{Se.init(t,e),t._zod.optin="optional",$e(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,o)=>(o.direction==="backward"||r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,o))}),uO=I("$ZodNonOptional",(t,e)=>{Se.init(t,e),$e(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),t._zod.parse=(r,o)=>{let n=e.innerType._zod.run(r,o);return n instanceof Promise?n.then(i=>dz(i,t)):dz(n,t)}});function dz(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}var lO=I("$ZodSuccess",(t,e)=>{Se.init(t,e),t._zod.parse=(r,o)=>{if(o.direction==="backward")throw new ws("ZodSuccess");let n=e.innerType._zod.run(r,o);return n instanceof Promise?n.then(i=>(r.value=i.issues.length===0,r)):(r.value=n.issues.length===0,r)}}),pO=I("$ZodCatch",(t,e)=>{Se.init(t,e),t._zod.optin="optional",$e(t._zod,"optout",()=>e.innerType._zod.optout),$e(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,o)=>{if(o.direction==="backward")return e.innerType._zod.run(r,o);let n=e.innerType._zod.run(r,o);return n instanceof Promise?n.then(i=>(r.value=i.value,i.issues.length&&(r.value=e.catchValue({...r,error:{issues:i.issues.map(s=>Cr(s,o,wt()))},input:r.value}),r.issues=[],r.fallback=!0),r)):(r.value=n.value,n.issues.length&&(r.value=e.catchValue({...r,error:{issues:n.issues.map(i=>Cr(i,o,wt()))},input:r.value}),r.issues=[],r.fallback=!0),r)}}),dO=I("$ZodNaN",(t,e)=>{Se.init(t,e),t._zod.parse=(r,o)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:t,expected:"nan",code:"invalid_type"}),r)}),px=I("$ZodPipe",(t,e)=>{Se.init(t,e),$e(t._zod,"values",()=>e.in._zod.values),$e(t._zod,"optin",()=>e.in._zod.optin),$e(t._zod,"optout",()=>e.out._zod.optout),$e(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,o)=>{if(o.direction==="backward"){let i=e.out._zod.run(r,o);return i instanceof Promise?i.then(s=>nx(s,e.in,o)):nx(i,e.in,o)}let n=e.in._zod.run(r,o);return n instanceof Promise?n.then(i=>nx(i,e.out,o)):nx(n,e.out,o)}});function nx(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues,fallback:t.fallback},r)}var km=I("$ZodCodec",(t,e)=>{Se.init(t,e),$e(t._zod,"values",()=>e.in._zod.values),$e(t._zod,"optin",()=>e.in._zod.optin),$e(t._zod,"optout",()=>e.out._zod.optout),$e(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,o)=>{if((o.direction||"forward")==="forward"){let i=e.in._zod.run(r,o);return i instanceof Promise?i.then(s=>ox(s,e,o)):ox(i,e,o)}else{let i=e.out._zod.run(r,o);return i instanceof Promise?i.then(s=>ox(s,e,o)):ox(i,e,o)}}});function ox(t,e,r){if(t.issues.length)return t.aborted=!0,t;if((r.direction||"forward")==="forward"){let n=e.transform(t.value,t);return n instanceof Promise?n.then(i=>ix(t,i,e.out,r)):ix(t,n,e.out,r)}else{let n=e.reverseTransform(t.value,t);return n instanceof Promise?n.then(i=>ix(t,i,e.in,r)):ix(t,n,e.in,r)}}function ix(t,e,r,o){return t.issues.length?(t.aborted=!0,t):r._zod.run({value:e,issues:t.issues},o)}var fO=I("$ZodPreprocess",(t,e)=>{px.init(t,e)}),mO=I("$ZodReadonly",(t,e)=>{Se.init(t,e),$e(t._zod,"propValues",()=>e.innerType._zod.propValues),$e(t._zod,"values",()=>e.innerType._zod.values),$e(t._zod,"optin",()=>e.innerType?._zod?.optin),$e(t._zod,"optout",()=>e.innerType?._zod?.optout),t._zod.parse=(r,o)=>{if(o.direction==="backward")return e.innerType._zod.run(r,o);let n=e.innerType._zod.run(r,o);return n instanceof Promise?n.then(fz):fz(n)}});function fz(t){return t.value=Object.freeze(t.value),t}var hO=I("$ZodTemplateLiteral",(t,e)=>{Se.init(t,e);let r=[];for(let o of e.parts)if(typeof o=="object"&&o!==null){if(!o._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...o._zod.traits].shift()}`);let n=o._zod.pattern instanceof RegExp?o._zod.pattern.source:o._zod.pattern;if(!n)throw new Error(`Invalid template literal part: ${o._zod.traits}`);let i=n.startsWith("^")?1:0,s=n.endsWith("$")?n.length-1:n.length;r.push(n.slice(i,s))}else if(o===null||ak.has(typeof o))r.push(An(`${o}`));else throw new Error(`Invalid template literal part: ${o}`);t._zod.pattern=new RegExp(`^${r.join("")}$`),t._zod.parse=(o,n)=>typeof o.value!="string"?(o.issues.push({input:o.value,inst:t,expected:"string",code:"invalid_type"}),o):(t._zod.pattern.lastIndex=0,t._zod.pattern.test(o.value)||o.issues.push({input:o.value,inst:t,code:"invalid_format",format:e.format??"template_literal",pattern:t._zod.pattern.source}),o)}),gO=I("$ZodFunction",(t,e)=>(Se.init(t,e),t._def=e,t._zod.def=e,t.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...o){let n=t._def.input?Hy(t._def.input,o):o,i=Reflect.apply(r,this,n);return t._def.output?Hy(t._def.output,i):i}},t.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...o){let n=t._def.input?await By(t._def.input,o):o,i=await Reflect.apply(r,this,n);return t._def.output?await By(t._def.output,i):i}},t._zod.parse=(r,o)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:t}),r):(t._def.output&&t._def.output._zod.def.type==="promise"?r.value=t.implementAsync(r.value):r.value=t.implement(r.value),r),t.input=(...r)=>{let o=t.constructor;return Array.isArray(r[0])?new o({type:"function",input:new ux({type:"tuple",items:r[0],rest:r[1]}),output:t._def.output}):new o({type:"function",input:r[0],output:t._def.output})},t.output=r=>{let o=t.constructor;return new o({type:"function",input:t._def.input,output:r})},t)),yO=I("$ZodPromise",(t,e)=>{Se.init(t,e),t._zod.parse=(r,o)=>Promise.resolve(r.value).then(n=>e.innerType._zod.run({value:n,issues:[]},o))}),xO=I("$ZodLazy",(t,e)=>{Se.init(t,e),$e(t._zod,"innerType",()=>{let r=e;return r._cachedInner||(r._cachedInner=e.getter()),r._cachedInner}),$e(t._zod,"pattern",()=>t._zod.innerType?._zod?.pattern),$e(t._zod,"propValues",()=>t._zod.innerType?._zod?.propValues),$e(t._zod,"optin",()=>t._zod.innerType?._zod?.optin??void 0),$e(t._zod,"optout",()=>t._zod.innerType?._zod?.optout??void 0),t._zod.parse=(r,o)=>t._zod.innerType._zod.run(r,o)}),_O=I("$ZodCustom",(t,e)=>{ot.init(t,e),Se.init(t,e),t._zod.parse=(r,o)=>r,t._zod.check=r=>{let o=r.value,n=e.fn(o);if(n instanceof Promise)return n.then(i=>mz(i,r,o,t));mz(n,r,o,t)}});function mz(t,e,r,o){if(!t){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(n.params=o._zod.def.params),e.issues.push(Sl(n))}}var Om={};an(Om,{ar:()=>bz,az:()=>vz,be:()=>wz,bg:()=>Ez,ca:()=>kz,cs:()=>Iz,da:()=>Oz,de:()=>Cz,el:()=>Rz,en:()=>dx,eo:()=>Az,es:()=>Tz,fa:()=>$z,fi:()=>Pz,fr:()=>Nz,frCA:()=>Mz,he:()=>Dz,hr:()=>Fz,hu:()=>zz,hy:()=>Lz,id:()=>Uz,is:()=>qz,it:()=>Hz,ja:()=>Bz,ka:()=>Wz,kh:()=>Zz,km:()=>fx,ko:()=>Gz,lt:()=>Kz,mk:()=>Jz,ms:()=>Yz,nl:()=>Xz,no:()=>Qz,ota:()=>ej,pl:()=>rj,ps:()=>tj,pt:()=>nj,ro:()=>oj,ru:()=>sj,sl:()=>aj,sv:()=>cj,ta:()=>uj,th:()=>lj,tr:()=>pj,ua:()=>dj,uk:()=>mx,ur:()=>fj,uz:()=>mj,vi:()=>hj,yo:()=>xj,zhCN:()=>gj,zhTW:()=>yj});var oX=()=>{let t={string:{unit:"\u062D\u0631\u0641",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},file:{unit:"\u0628\u0627\u064A\u062A",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},array:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},set:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"}};function e(n){return t[n]??null}let r={regex:"\u0645\u062F\u062E\u0644",email:"\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",url:"\u0631\u0627\u0628\u0637",emoji:"\u0625\u064A\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",date:"\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO",time:"\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",duration:"\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO",ipv4:"\u0639\u0646\u0648\u0627\u0646 IPv4",ipv6:"\u0639\u0646\u0648\u0627\u0646 IPv6",cidrv4:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4",cidrv6:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6",base64:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded",base64url:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded",json_string:"\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",e164:"\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",jwt:"JWT",template_literal:"\u0645\u062F\u062E\u0644"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 instanceof ${n.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${a}`:`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${i}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${a}`}case"invalid_value":return n.values.length===1?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${j(n.values[0])}`:`\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);return s?` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${n.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${i} ${n.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631"}`:`\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${n.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);return s?`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${n.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${i} ${n.minimum.toString()} ${s.unit}`:`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${n.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${n.prefix}"`:i.format==="ends_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${i.suffix}"`:i.format==="includes"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${i.includes}"`:i.format==="regex"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${i.pattern}`:`${r[i.format]??n.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`}case"not_multiple_of":return`\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${n.divisor}`;case"unrecognized_keys":return`\u0645\u0639\u0631\u0641${n.keys.length>1?"\u0627\u062A":""} \u063A\u0631\u064A\u0628${n.keys.length>1?"\u0629":""}: ${T(n.keys,"\u060C ")}`;case"invalid_key":return`\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${n.origin}`;case"invalid_union":return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644";case"invalid_element":return`\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${n.origin}`;default:return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"}}};function bz(){return{localeError:oX()}}var iX=()=>{let t={string:{unit:"simvol",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"element",verb:"olmal\u0131d\u0131r"},set:{unit:"element",verb:"olmal\u0131d\u0131r"}};function e(n){return t[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n instanceof ${n.expected}, daxil olan ${a}`:`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${i}, daxil olan ${a}`}case"invalid_value":return n.values.length===1?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${j(n.values[0])}`:`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);return s?`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${n.origin??"d\u0259y\u0259r"} ${i}${n.maximum.toString()} ${s.unit??"element"}`:`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${n.origin??"d\u0259y\u0259r"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);return s?`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${n.origin} ${i}${n.minimum.toString()} ${s.unit}`:`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Yanl\u0131\u015F m\u0259tn: "${i.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`:i.format==="ends_with"?`Yanl\u0131\u015F m\u0259tn: "${i.suffix}" il\u0259 bitm\u0259lidir`:i.format==="includes"?`Yanl\u0131\u015F m\u0259tn: "${i.includes}" daxil olmal\u0131d\u0131r`:i.format==="regex"?`Yanl\u0131\u015F m\u0259tn: ${i.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`:`Yanl\u0131\u015F ${r[i.format]??n.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${n.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${n.keys.length>1?"lar":""}: ${T(n.keys,", ")}`;case"invalid_key":return`${n.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${n.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}};function vz(){return{localeError:iX()}}function Sz(t,e,r,o){let n=Math.abs(t),i=n%10,s=n%100;return s>=11&&s<=19?o:i===1?e:i>=2&&i<=4?r:o}var sX=()=>{let t={string:{unit:{one:"\u0441\u0456\u043C\u0432\u0430\u043B",few:"\u0441\u0456\u043C\u0432\u0430\u043B\u044B",many:"\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u044B",many:"\u0431\u0430\u0439\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"}};function e(n){return t[n]??null}let r={regex:"\u0443\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0430\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0447\u0430\u0441",duration:"ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0430\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0430\u0441",cidrv4:"IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",base64:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64",base64url:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url",json_string:"JSON \u0440\u0430\u0434\u043E\u043A",e164:"\u043D\u0443\u043C\u0430\u0440 E.164",jwt:"JWT",template_literal:"\u0443\u0432\u043E\u0434"},o={nan:"NaN",number:"\u043B\u0456\u043A",array:"\u043C\u0430\u0441\u0456\u045E"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F instanceof ${n.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${a}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${i}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${a}`}case"invalid_value":return n.values.length===1?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${j(n.values[0])}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);if(s){let a=Number(n.maximum),c=Sz(a,s.unit.one,s.unit.few,s.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${s.verb} ${i}${n.maximum.toString()} ${c}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);if(s){let a=Number(n.minimum),c=Sz(a,s.unit.one,s.unit.few,s.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${n.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${s.verb} ${i}${n.minimum.toString()} ${c}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${n.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${i.includes}"`:i.format==="regex"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${r[i.format]??n.format}`}case"not_multiple_of":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${n.keys.length>1?"\u043A\u043B\u044E\u0447\u044B":"\u043A\u043B\u044E\u0447"}: ${T(n.keys,", ")}`;case"invalid_key":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${n.origin}`;case"invalid_union":return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434";case"invalid_element":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${n.origin}`;default:return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"}}};function wz(){return{localeError:sX()}}var aX=()=>{let t={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},file:{unit:"\u0431\u0430\u0439\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"}};function e(n){return t[n]??null}let r={regex:"\u0432\u0445\u043E\u0434",email:"\u0438\u043C\u0435\u0439\u043B \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0436\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u043F\u0440\u043E\u0434\u044A\u043B\u0436\u0438\u0442\u0435\u043B\u043D\u043E\u0441\u0442",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"base64-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",base64url:"base64url-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",json_string:"JSON \u043D\u0438\u0437",e164:"E.164 \u043D\u043E\u043C\u0435\u0440",jwt:"JWT",template_literal:"\u0432\u0445\u043E\u0434"},o={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D instanceof ${n.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${a}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${i}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${a}`}case"invalid_value":return n.values.length===1?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${j(n.values[0])}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u043E\u043F\u0446\u0438\u044F: \u043E\u0447\u0430\u043A\u0432\u0430\u043D\u043E \u0435\u0434\u043D\u043E \u043E\u0442 ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);return s?`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${i}${n.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430"}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0431\u044A\u0434\u0435 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);return s?`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${i}${n.minimum.toString()} ${s.unit}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin} \u0434\u0430 \u0431\u044A\u0434\u0435 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u0432\u0430 \u0441 "${i.prefix}"`;if(i.format==="ends_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u0432\u044A\u0440\u0448\u0432\u0430 \u0441 "${i.suffix}"`;if(i.format==="includes")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0432\u043A\u043B\u044E\u0447\u0432\u0430 "${i.includes}"`;if(i.format==="regex")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0441\u044A\u0432\u043F\u0430\u0434\u0430 \u0441 ${i.pattern}`;let s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D";return i.format==="emoji"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),i.format==="datetime"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),i.format==="date"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),i.format==="time"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),i.format==="duration"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),`${s} ${r[i.format]??n.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E \u0447\u0438\u0441\u043B\u043E: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0431\u044A\u0434\u0435 \u043A\u0440\u0430\u0442\u043D\u043E \u043D\u0430 ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0437\u043F\u043E\u0437\u043D\u0430\u0442${n.keys.length>1?"\u0438":""} \u043A\u043B\u044E\u0447${n.keys.length>1?"\u043E\u0432\u0435":""}: ${T(n.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043A\u043B\u044E\u0447 \u0432 ${n.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434";case"invalid_element":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442 \u0432 ${n.origin}`;default:return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434"}}};function Ez(){return{localeError:aX()}}var cX=()=>{let t={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function e(n){return t[n]??null}let r={regex:"entrada",email:"adre\xE7a electr\xF2nica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adre\xE7a IPv4",ipv6:"adre\xE7a IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Tipus inv\xE0lid: s'esperava instanceof ${n.expected}, s'ha rebut ${a}`:`Tipus inv\xE0lid: s'esperava ${i}, s'ha rebut ${a}`}case"invalid_value":return n.values.length===1?`Valor inv\xE0lid: s'esperava ${j(n.values[0])}`:`Opci\xF3 inv\xE0lida: s'esperava una de ${T(n.values," o ")}`;case"too_big":{let i=n.inclusive?"com a m\xE0xim":"menys de",s=e(n.origin);return s?`Massa gran: s'esperava que ${n.origin??"el valor"} contingu\xE9s ${i} ${n.maximum.toString()} ${s.unit??"elements"}`:`Massa gran: s'esperava que ${n.origin??"el valor"} fos ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?"com a m\xEDnim":"m\xE9s de",s=e(n.origin);return s?`Massa petit: s'esperava que ${n.origin} contingu\xE9s ${i} ${n.minimum.toString()} ${s.unit}`:`Massa petit: s'esperava que ${n.origin} fos ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Format inv\xE0lid: ha de comen\xE7ar amb "${i.prefix}"`:i.format==="ends_with"?`Format inv\xE0lid: ha d'acabar amb "${i.suffix}"`:i.format==="includes"?`Format inv\xE0lid: ha d'incloure "${i.includes}"`:i.format==="regex"?`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${i.pattern}`:`Format inv\xE0lid per a ${r[i.format]??n.format}`}case"not_multiple_of":return`N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${n.divisor}`;case"unrecognized_keys":return`Clau${n.keys.length>1?"s":""} no reconeguda${n.keys.length>1?"s":""}: ${T(n.keys,", ")}`;case"invalid_key":return`Clau inv\xE0lida a ${n.origin}`;case"invalid_union":return"Entrada inv\xE0lida";case"invalid_element":return`Element inv\xE0lid a ${n.origin}`;default:return"Entrada inv\xE0lida"}}};function kz(){return{localeError:cX()}}var uX=()=>{let t={string:{unit:"znak\u016F",verb:"m\xEDt"},file:{unit:"bajt\u016F",verb:"m\xEDt"},array:{unit:"prvk\u016F",verb:"m\xEDt"},set:{unit:"prvk\u016F",verb:"m\xEDt"}};function e(n){return t[n]??null}let r={regex:"regul\xE1rn\xED v\xFDraz",email:"e-mailov\xE1 adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a \u010Das ve form\xE1tu ISO",date:"datum ve form\xE1tu ISO",time:"\u010Das ve form\xE1tu ISO",duration:"doba trv\xE1n\xED ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64",base64url:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url",json_string:"\u0159et\u011Bzec ve form\xE1tu JSON",e164:"\u010D\xEDslo E.164",jwt:"JWT",template_literal:"vstup"},o={nan:"NaN",number:"\u010D\xEDslo",string:"\u0159et\u011Bzec",function:"funkce",array:"pole"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no instanceof ${n.expected}, obdr\u017Eeno ${a}`:`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${i}, obdr\u017Eeno ${a}`}case"invalid_value":return n.values.length===1?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${j(n.values[0])}`:`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);return s?`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${n.origin??"hodnota"} mus\xED m\xEDt ${i}${n.maximum.toString()} ${s.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${n.origin??"hodnota"} mus\xED b\xFDt ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);return s?`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${n.origin??"hodnota"} mus\xED m\xEDt ${i}${n.minimum.toString()} ${s.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${n.origin??"hodnota"} mus\xED b\xFDt ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${i.prefix}"`:i.format==="ends_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${i.suffix}"`:i.format==="includes"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${i.includes}"`:i.format==="regex"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${i.pattern}`:`Neplatn\xFD form\xE1t ${r[i.format]??n.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${n.divisor}`;case"unrecognized_keys":return`Nezn\xE1m\xE9 kl\xED\u010De: ${T(n.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xED\u010D v ${n.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${n.origin}`;default:return"Neplatn\xFD vstup"}}};function Iz(){return{localeError:uX()}}var lX=()=>{let t={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}};function e(n){return t[n]??null}let r={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkesl\xE6t",date:"ISO-dato",time:"ISO-klokkesl\xE6t",duration:"ISO-varighed",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},o={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"s\xE6t",file:"fil"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Ugyldigt input: forventede instanceof ${n.expected}, fik ${a}`:`Ugyldigt input: forventede ${i}, fik ${a}`}case"invalid_value":return n.values.length===1?`Ugyldig v\xE6rdi: forventede ${j(n.values[0])}`:`Ugyldigt valg: forventede en af f\xF8lgende ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin),a=o[n.origin]??n.origin;return s?`For stor: forventede ${a??"value"} ${s.verb} ${i} ${n.maximum.toString()} ${s.unit??"elementer"}`:`For stor: forventede ${a??"value"} havde ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin),a=o[n.origin]??n.origin;return s?`For lille: forventede ${a} ${s.verb} ${i} ${n.minimum.toString()} ${s.unit}`:`For lille: forventede ${a} havde ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Ugyldig streng: skal starte med "${i.prefix}"`:i.format==="ends_with"?`Ugyldig streng: skal ende med "${i.suffix}"`:i.format==="includes"?`Ugyldig streng: skal indeholde "${i.includes}"`:i.format==="regex"?`Ugyldig streng: skal matche m\xF8nsteret ${i.pattern}`:`Ugyldig ${r[i.format]??n.format}`}case"not_multiple_of":return`Ugyldigt tal: skal v\xE6re deleligt med ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukendte n\xF8gler":"Ukendt n\xF8gle"}: ${T(n.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8gle i ${n.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig v\xE6rdi i ${n.origin}`;default:return"Ugyldigt input"}}};function Oz(){return{localeError:lX()}}var pX=()=>{let t={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function e(n){return t[n]??null}let r={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"},o={nan:"NaN",number:"Zahl",array:"Array"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Ung\xFCltige Eingabe: erwartet instanceof ${n.expected}, erhalten ${a}`:`Ung\xFCltige Eingabe: erwartet ${i}, erhalten ${a}`}case"invalid_value":return n.values.length===1?`Ung\xFCltige Eingabe: erwartet ${j(n.values[0])}`:`Ung\xFCltige Option: erwartet eine von ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);return s?`Zu gro\xDF: erwartet, dass ${n.origin??"Wert"} ${i}${n.maximum.toString()} ${s.unit??"Elemente"} hat`:`Zu gro\xDF: erwartet, dass ${n.origin??"Wert"} ${i}${n.maximum.toString()} ist`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);return s?`Zu klein: erwartet, dass ${n.origin} ${i}${n.minimum.toString()} ${s.unit} hat`:`Zu klein: erwartet, dass ${n.origin} ${i}${n.minimum.toString()} ist`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Ung\xFCltiger String: muss mit "${i.prefix}" beginnen`:i.format==="ends_with"?`Ung\xFCltiger String: muss mit "${i.suffix}" enden`:i.format==="includes"?`Ung\xFCltiger String: muss "${i.includes}" enthalten`:i.format==="regex"?`Ung\xFCltiger String: muss dem Muster ${i.pattern} entsprechen`:`Ung\xFCltig: ${r[i.format]??n.format}`}case"not_multiple_of":return`Ung\xFCltige Zahl: muss ein Vielfaches von ${n.divisor} sein`;case"unrecognized_keys":return`${n.keys.length>1?"Unbekannte Schl\xFCssel":"Unbekannter Schl\xFCssel"}: ${T(n.keys,", ")}`;case"invalid_key":return`Ung\xFCltiger Schl\xFCssel in ${n.origin}`;case"invalid_union":return"Ung\xFCltige Eingabe";case"invalid_element":return`Ung\xFCltiger Wert in ${n.origin}`;default:return"Ung\xFCltige Eingabe"}}};function Cz(){return{localeError:pX()}}var dX=()=>{let t={string:{unit:"\u03C7\u03B1\u03C1\u03B1\u03BA\u03C4\u03AE\u03C1\u03B5\u03C2",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},file:{unit:"bytes",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},array:{unit:"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},set:{unit:"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},map:{unit:"\u03BA\u03B1\u03C4\u03B1\u03C7\u03C9\u03C1\u03AE\u03C3\u03B5\u03B9\u03C2",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"}};function e(n){return t[n]??null}let r={regex:"\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2",email:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u03B7\u03BC\u03B5\u03C1\u03BF\u03BC\u03B7\u03BD\u03AF\u03B1 \u03BA\u03B1\u03B9 \u03CE\u03C1\u03B1",date:"ISO \u03B7\u03BC\u03B5\u03C1\u03BF\u03BC\u03B7\u03BD\u03AF\u03B1",time:"ISO \u03CE\u03C1\u03B1",duration:"ISO \u03B4\u03B9\u03AC\u03C1\u03BA\u03B5\u03B9\u03B1",ipv4:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 IPv4",ipv6:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 IPv6",mac:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 MAC",cidrv4:"\u03B5\u03CD\u03C1\u03BF\u03C2 IPv4",cidrv6:"\u03B5\u03CD\u03C1\u03BF\u03C2 IPv6",base64:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03BC\u03AD\u03BD\u03B7 \u03C3\u03B5 base64",base64url:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03BC\u03AD\u03BD\u03B7 \u03C3\u03B5 base64url",json_string:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC JSON",e164:"\u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2 E.164",jwt:"JWT",template_literal:"\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return typeof n.expected=="string"&&/^[A-Z]/.test(n.expected)?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD instanceof ${n.expected}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${a}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${i}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${a}`}case"invalid_value":return n.values.length===1?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${j(n.values[0])}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03C0\u03B9\u03BB\u03BF\u03B3\u03AE: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD \u03AD\u03BD\u03B1 \u03B1\u03C0\u03CC ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);return s?`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B5\u03B3\u03AC\u03BB\u03BF: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${n.origin??"\u03C4\u03B9\u03BC\u03AE"} \u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9 ${i}${n.maximum.toString()} ${s.unit??"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1"}`:`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B5\u03B3\u03AC\u03BB\u03BF: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${n.origin??"\u03C4\u03B9\u03BC\u03AE"} \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);return s?`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B9\u03BA\u03C1\u03CC: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${n.origin} \u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9 ${i}${n.minimum.toString()} ${s.unit}`:`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B9\u03BA\u03C1\u03CC: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${n.origin} \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03BE\u03B5\u03BA\u03B9\u03BD\u03AC \u03BC\u03B5 "${i.prefix}"`:i.format==="ends_with"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C4\u03B5\u03BB\u03B5\u03B9\u03CE\u03BD\u03B5\u03B9 \u03BC\u03B5 "${i.suffix}"`:i.format==="includes"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C0\u03B5\u03C1\u03B9\u03AD\u03C7\u03B5\u03B9 "${i.includes}"`:i.format==="regex"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C4\u03B1\u03B9\u03C1\u03B9\u03AC\u03B6\u03B5\u03B9 \u03BC\u03B5 \u03C4\u03BF \u03BC\u03BF\u03C4\u03AF\u03B2\u03BF ${i.pattern}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF: ${r[i.format]??n.format}`}case"not_multiple_of":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF\u03C2 \u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 \u03C0\u03BF\u03BB\u03BB\u03B1\u03C0\u03BB\u03AC\u03C3\u03B9\u03BF \u03C4\u03BF\u03C5 ${n.divisor}`;case"unrecognized_keys":return`\u0386\u03B3\u03BD\u03C9\u03C3\u03C4${n.keys.length>1?"\u03B1":"\u03BF"} \u03BA\u03BB\u03B5\u03B9\u03B4${n.keys.length>1?"\u03B9\u03AC":"\u03AF"}: ${T(n.keys,", ")}`;case"invalid_key":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF \u03BA\u03BB\u03B5\u03B9\u03B4\u03AF \u03C3\u03C4\u03BF ${n.origin}`;case"invalid_union":return"\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2";case"invalid_element":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C4\u03B9\u03BC\u03AE \u03C3\u03C4\u03BF ${n.origin}`;default:return"\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"}}};function Rz(){return{localeError:dX()}}var fX=()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function e(n){return t[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return`Invalid input: expected ${i}, received ${a}`}case"invalid_value":return n.values.length===1?`Invalid input: expected ${j(n.values[0])}`:`Invalid option: expected one of ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);return s?`Too big: expected ${n.origin??"value"} to have ${i}${n.maximum.toString()} ${s.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);return s?`Too small: expected ${n.origin} to have ${i}${n.minimum.toString()} ${s.unit}`:`Too small: expected ${n.origin} to be ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${T(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`Invalid discriminator value. Expected ${n.options.map(s=>`'${s}'`).join(" | ")}`:"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function dx(){return{localeError:fX()}}var mX=()=>{let t={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function e(n){return t[n]??null}let r={regex:"enigo",email:"retadreso",url:"URL",emoji:"emo\u011Dio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-da\u016Dro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"},o={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Nevalida enigo: atendi\u011Dis instanceof ${n.expected}, ricevi\u011Dis ${a}`:`Nevalida enigo: atendi\u011Dis ${i}, ricevi\u011Dis ${a}`}case"invalid_value":return n.values.length===1?`Nevalida enigo: atendi\u011Dis ${j(n.values[0])}`:`Nevalida opcio: atendi\u011Dis unu el ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);return s?`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${i}${n.maximum.toString()} ${s.unit??"elementojn"}`:`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);return s?`Tro malgranda: atendi\u011Dis ke ${n.origin} havu ${i}${n.minimum.toString()} ${s.unit}`:`Tro malgranda: atendi\u011Dis ke ${n.origin} estu ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Nevalida karaktraro: devas komenci\u011Di per "${i.prefix}"`:i.format==="ends_with"?`Nevalida karaktraro: devas fini\u011Di per "${i.suffix}"`:i.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${i.includes}"`:i.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${i.pattern}`:`Nevalida ${r[i.format]??n.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${n.divisor}`;case"unrecognized_keys":return`Nekonata${n.keys.length>1?"j":""} \u015Dlosilo${n.keys.length>1?"j":""}: ${T(n.keys,", ")}`;case"invalid_key":return`Nevalida \u015Dlosilo en ${n.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${n.origin}`;default:return"Nevalida enigo"}}};function Az(){return{localeError:mX()}}var hX=()=>{let t={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function e(n){return t[n]??null}let r={regex:"entrada",email:"direcci\xF3n de correo electr\xF3nico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duraci\xF3n ISO",ipv4:"direcci\xF3n IPv4",ipv6:"direcci\xF3n IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},o={nan:"NaN",string:"texto",number:"n\xFAmero",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"n\xFAmero grande",symbol:"s\xEDmbolo",undefined:"indefinido",null:"nulo",function:"funci\xF3n",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeraci\xF3n",union:"uni\xF3n",literal:"literal",promise:"promesa",void:"vac\xEDo",never:"nunca",unknown:"desconocido",any:"cualquiera"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Entrada inv\xE1lida: se esperaba instanceof ${n.expected}, recibido ${a}`:`Entrada inv\xE1lida: se esperaba ${i}, recibido ${a}`}case"invalid_value":return n.values.length===1?`Entrada inv\xE1lida: se esperaba ${j(n.values[0])}`:`Opci\xF3n inv\xE1lida: se esperaba una de ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin),a=o[n.origin]??n.origin;return s?`Demasiado grande: se esperaba que ${a??"valor"} tuviera ${i}${n.maximum.toString()} ${s.unit??"elementos"}`:`Demasiado grande: se esperaba que ${a??"valor"} fuera ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin),a=o[n.origin]??n.origin;return s?`Demasiado peque\xF1o: se esperaba que ${a} tuviera ${i}${n.minimum.toString()} ${s.unit}`:`Demasiado peque\xF1o: se esperaba que ${a} fuera ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Cadena inv\xE1lida: debe comenzar con "${i.prefix}"`:i.format==="ends_with"?`Cadena inv\xE1lida: debe terminar en "${i.suffix}"`:i.format==="includes"?`Cadena inv\xE1lida: debe incluir "${i.includes}"`:i.format==="regex"?`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${i.pattern}`:`Inv\xE1lido ${r[i.format]??n.format}`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${n.divisor}`;case"unrecognized_keys":return`Llave${n.keys.length>1?"s":""} desconocida${n.keys.length>1?"s":""}: ${T(n.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${o[n.origin]??n.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${o[n.origin]??n.origin}`;default:return"Entrada inv\xE1lida"}}};function Tz(){return{localeError:hX()}}var gX=()=>{let t={string:{unit:"\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},array:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},set:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"}};function e(n){return t[n]??null}let r={regex:"\u0648\u0631\u0648\u062F\u06CC",email:"\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644",url:"URL",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",date:"\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648",time:"\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",duration:"\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",ipv4:"IPv4 \u0622\u062F\u0631\u0633",ipv6:"IPv6 \u0622\u062F\u0631\u0633",cidrv4:"IPv4 \u062F\u0627\u0645\u0646\u0647",cidrv6:"IPv6 \u062F\u0627\u0645\u0646\u0647",base64:"base64-encoded \u0631\u0634\u062A\u0647",base64url:"base64url-encoded \u0631\u0634\u062A\u0647",json_string:"JSON \u0631\u0634\u062A\u0647",e164:"E.164 \u0639\u062F\u062F",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u06CC"},o={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0622\u0631\u0627\u06CC\u0647"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A instanceof ${n.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${a} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`:`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${i} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${a} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`}case"invalid_value":return n.values.length===1?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${j(n.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`:`\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${T(n.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);return s?`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${n.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${i}${n.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${n.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${i}${n.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);return s?`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${n.origin} \u0628\u0627\u06CC\u062F ${i}${n.minimum.toString()} ${s.unit} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${n.origin} \u0628\u0627\u06CC\u062F ${i}${n.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${i.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`:i.format==="ends_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${i.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`:i.format==="includes"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${i.includes}" \u0628\u0627\u0634\u062F`:i.format==="regex"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${i.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`:`${r[i.format]??n.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`}case"not_multiple_of":return`\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${n.divisor} \u0628\u0627\u0634\u062F`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u062F${n.keys.length>1?"\u0647\u0627\u06CC":""} \u0646\u0627\u0634\u0646\u0627\u0633: ${T(n.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${n.origin}`;case"invalid_union":return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631";case"invalid_element":return`\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${n.origin}`;default:return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631"}}};function $z(){return{localeError:gX()}}var yX=()=>{let t={string:{unit:"merkki\xE4",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"p\xE4iv\xE4m\xE4\xE4r\xE4n"}};function e(n){return t[n]??null}let r={regex:"s\xE4\xE4nn\xF6llinen lauseke",email:"s\xE4hk\xF6postiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-p\xE4iv\xE4m\xE4\xE4r\xE4",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Virheellinen tyyppi: odotettiin instanceof ${n.expected}, oli ${a}`:`Virheellinen tyyppi: odotettiin ${i}, oli ${a}`}case"invalid_value":return n.values.length===1?`Virheellinen sy\xF6te: t\xE4ytyy olla ${j(n.values[0])}`:`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);return s?`Liian suuri: ${s.subject} t\xE4ytyy olla ${i}${n.maximum.toString()} ${s.unit}`.trim():`Liian suuri: arvon t\xE4ytyy olla ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);return s?`Liian pieni: ${s.subject} t\xE4ytyy olla ${i}${n.minimum.toString()} ${s.unit}`.trim():`Liian pieni: arvon t\xE4ytyy olla ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${i.prefix}"`:i.format==="ends_with"?`Virheellinen sy\xF6te: t\xE4ytyy loppua "${i.suffix}"`:i.format==="includes"?`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${i.includes}"`:i.format==="regex"?`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${i.pattern}`:`Virheellinen ${r[i.format]??n.format}`}case"not_multiple_of":return`Virheellinen luku: t\xE4ytyy olla luvun ${n.divisor} monikerta`;case"unrecognized_keys":return`${n.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${T(n.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen sy\xF6te"}}};function Pz(){return{localeError:yX()}}var xX=()=>{let t={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function e(n){return t[n]??null}let r={regex:"entr\xE9e",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"},o={string:"cha\xEEne",number:"nombre",int:"entier",boolean:"bool\xE9en",bigint:"grand entier",symbol:"symbole",undefined:"ind\xE9fini",null:"null",never:"jamais",void:"vide",date:"date",array:"tableau",object:"objet",tuple:"tuple",record:"enregistrement",map:"carte",set:"ensemble",file:"fichier",nonoptional:"non-optionnel",nan:"NaN",function:"fonction"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Entr\xE9e invalide : instanceof ${n.expected} attendu, ${a} re\xE7u`:`Entr\xE9e invalide : ${i} attendu, ${a} re\xE7u`}case"invalid_value":return n.values.length===1?`Entr\xE9e invalide : ${j(n.values[0])} attendu`:`Option invalide : une valeur parmi ${T(n.values,"|")} attendue`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);return s?`Trop grand : ${o[n.origin]??"valeur"} doit ${s.verb} ${i}${n.maximum.toString()} ${s.unit??"\xE9l\xE9ment(s)"}`:`Trop grand : ${o[n.origin]??"valeur"} doit \xEAtre ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);return s?`Trop petit : ${o[n.origin]??"valeur"} doit ${s.verb} ${i}${n.minimum.toString()} ${s.unit}`:`Trop petit : ${o[n.origin]??"valeur"} doit \xEAtre ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${i.prefix}"`:i.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${i.suffix}"`:i.format==="includes"?`Cha\xEEne invalide : doit inclure "${i.includes}"`:i.format==="regex"?`Cha\xEEne invalide : doit correspondre au mod\xE8le ${i.pattern}`:`${r[i.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${n.divisor}`;case"unrecognized_keys":return`Cl\xE9${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${T(n.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${n.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entr\xE9e invalide"}}};function Nz(){return{localeError:xX()}}var _X=()=>{let t={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function e(n){return t[n]??null}let r={regex:"entr\xE9e",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Entr\xE9e invalide : attendu instanceof ${n.expected}, re\xE7u ${a}`:`Entr\xE9e invalide : attendu ${i}, re\xE7u ${a}`}case"invalid_value":return n.values.length===1?`Entr\xE9e invalide : attendu ${j(n.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"\u2264":"<",s=e(n.origin);return s?`Trop grand : attendu que ${n.origin??"la valeur"} ait ${i}${n.maximum.toString()} ${s.unit}`:`Trop grand : attendu que ${n.origin??"la valeur"} soit ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?"\u2265":">",s=e(n.origin);return s?`Trop petit : attendu que ${n.origin} ait ${i}${n.minimum.toString()} ${s.unit}`:`Trop petit : attendu que ${n.origin} soit ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${i.prefix}"`:i.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${i.suffix}"`:i.format==="includes"?`Cha\xEEne invalide : doit inclure "${i.includes}"`:i.format==="regex"?`Cha\xEEne invalide : doit correspondre au motif ${i.pattern}`:`${r[i.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${n.divisor}`;case"unrecognized_keys":return`Cl\xE9${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${T(n.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${n.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entr\xE9e invalide"}}};function Mz(){return{localeError:_X()}}var bX=()=>{let t={string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA",gender:"f"},number:{label:"\u05DE\u05E1\u05E4\u05E8",gender:"m"},boolean:{label:"\u05E2\u05E8\u05DA \u05D1\u05D5\u05DC\u05D9\u05D0\u05E0\u05D9",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA",gender:"m"},array:{label:"\u05DE\u05E2\u05E8\u05DA",gender:"m"},object:{label:"\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8",gender:"m"},null:{label:"\u05E2\u05E8\u05DA \u05E8\u05D9\u05E7 (null)",gender:"m"},undefined:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05DE\u05D5\u05D2\u05D3\u05E8 (undefined)",gender:"m"},symbol:{label:"\u05E1\u05D9\u05DE\u05D1\u05D5\u05DC (Symbol)",gender:"m"},function:{label:"\u05E4\u05D5\u05E0\u05E7\u05E6\u05D9\u05D4",gender:"f"},map:{label:"\u05DE\u05E4\u05D4 (Map)",gender:"f"},set:{label:"\u05E7\u05D1\u05D5\u05E6\u05D4 (Set)",gender:"f"},file:{label:"\u05E7\u05D5\u05D1\u05E5",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05D9\u05D3\u05D5\u05E2",gender:"m"},value:{label:"\u05E2\u05E8\u05DA",gender:"m"}},e={string:{unit:"\u05EA\u05D5\u05D5\u05D9\u05DD",shortLabel:"\u05E7\u05E6\u05E8",longLabel:"\u05D0\u05E8\u05D5\u05DA"},file:{unit:"\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},array:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},set:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},number:{unit:"",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"}},r=u=>u?t[u]:void 0,o=u=>{let l=r(u);return l?l.label:u??t.unknown.label},n=u=>`\u05D4${o(u)}`,i=u=>(r(u)?.gender??"m")==="f"?"\u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05D9\u05D5\u05EA":"\u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA",s=u=>u?e[u]??null:null,a={regex:{label:"\u05E7\u05DC\u05D8",gender:"m"},email:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",gender:"f"},url:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA",gender:"f"},emoji:{label:"\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA ISO",gender:"m"},time:{label:"\u05D6\u05DE\u05DF ISO",gender:"m"},duration:{label:"\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO",gender:"m"},ipv4:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv4",gender:"f"},ipv6:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv6",gender:"f"},cidrv4:{label:"\u05D8\u05D5\u05D5\u05D7 IPv4",gender:"m"},cidrv6:{label:"\u05D8\u05D5\u05D5\u05D7 IPv6",gender:"m"},base64:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64",gender:"f"},base64url:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA",gender:"f"},json_string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON",gender:"f"},e164:{label:"\u05DE\u05E1\u05E4\u05E8 E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},includes:{label:"\u05E7\u05DC\u05D8",gender:"m"},lowercase:{label:"\u05E7\u05DC\u05D8",gender:"m"},starts_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},uppercase:{label:"\u05E7\u05DC\u05D8",gender:"m"}},c={nan:"NaN"};return u=>{switch(u.code){case"invalid_type":{let l=u.expected,p=c[l??""]??o(l),f=L(u.input),d=c[f]??t[f]?.label??f;return/^[A-Z]/.test(u.expected)?`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA instanceof ${u.expected}, \u05D4\u05EA\u05E7\u05D1\u05DC ${d}`:`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${p}, \u05D4\u05EA\u05E7\u05D1\u05DC ${d}`}case"invalid_value":{if(u.values.length===1)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05E2\u05E8\u05DA \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA ${j(u.values[0])}`;let l=u.values.map(d=>j(d));if(u.values.length===2)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${l[0]} \u05D0\u05D5 ${l[1]}`;let p=l[l.length-1];return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${l.slice(0,-1).join(", ")} \u05D0\u05D5 ${p}`}case"too_big":{let l=s(u.origin),p=n(u.origin??"value");if(u.origin==="string")return`${l?.longLabel??"\u05D0\u05E8\u05D5\u05DA"} \u05DE\u05D3\u05D9: ${p} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${u.maximum.toString()} ${l?.unit??""} ${u.inclusive?"\u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA":"\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8"}`.trim();if(u.origin==="number"){let m=u.inclusive?`\u05E7\u05D8\u05DF \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${u.maximum}`:`\u05E7\u05D8\u05DF \u05DE-${u.maximum}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${p} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${m}`}if(u.origin==="array"||u.origin==="set"){let m=u.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA",g=u.inclusive?`${u.maximum} ${l?.unit??""} \u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA`:`\u05E4\u05D7\u05D5\u05EA \u05DE-${u.maximum} ${l?.unit??""}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${p} ${m} \u05DC\u05D4\u05DB\u05D9\u05DC ${g}`.trim()}let f=u.inclusive?"<=":"<",d=i(u.origin??"value");return l?.unit?`${l.longLabel} \u05DE\u05D3\u05D9: ${p} ${d} ${f}${u.maximum.toString()} ${l.unit}`:`${l?.longLabel??"\u05D2\u05D3\u05D5\u05DC"} \u05DE\u05D3\u05D9: ${p} ${d} ${f}${u.maximum.toString()}`}case"too_small":{let l=s(u.origin),p=n(u.origin??"value");if(u.origin==="string")return`${l?.shortLabel??"\u05E7\u05E6\u05E8"} \u05DE\u05D3\u05D9: ${p} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${u.minimum.toString()} ${l?.unit??""} ${u.inclusive?"\u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8":"\u05DC\u05E4\u05D7\u05D5\u05EA"}`.trim();if(u.origin==="number"){let m=u.inclusive?`\u05D2\u05D3\u05D5\u05DC \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${u.minimum}`:`\u05D2\u05D3\u05D5\u05DC \u05DE-${u.minimum}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${p} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${m}`}if(u.origin==="array"||u.origin==="set"){let m=u.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA";if(u.minimum===1&&u.inclusive){let y=(u.origin==="set","\u05DC\u05E4\u05D7\u05D5\u05EA \u05E4\u05E8\u05D9\u05D8 \u05D0\u05D7\u05D3");return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${p} ${m} \u05DC\u05D4\u05DB\u05D9\u05DC ${y}`}let g=u.inclusive?`${u.minimum} ${l?.unit??""} \u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8`:`\u05D9\u05D5\u05EA\u05E8 \u05DE-${u.minimum} ${l?.unit??""}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${p} ${m} \u05DC\u05D4\u05DB\u05D9\u05DC ${g}`.trim()}let f=u.inclusive?">=":">",d=i(u.origin??"value");return l?.unit?`${l.shortLabel} \u05DE\u05D3\u05D9: ${p} ${d} ${f}${u.minimum.toString()} ${l.unit}`:`${l?.shortLabel??"\u05E7\u05D8\u05DF"} \u05DE\u05D3\u05D9: ${p} ${d} ${f}${u.minimum.toString()}`}case"invalid_format":{let l=u;if(l.format==="starts_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1 "${l.prefix}"`;if(l.format==="ends_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${l.suffix}"`;if(l.format==="includes")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${l.includes}"`;if(l.format==="regex")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${l.pattern}`;let p=a[l.format],f=p?.label??l.format,m=(p?.gender??"m")==="f"?"\u05EA\u05E7\u05D9\u05E0\u05D4":"\u05EA\u05E7\u05D9\u05DF";return`${f} \u05DC\u05D0 ${m}`}case"not_multiple_of":return`\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${u.divisor}`;case"unrecognized_keys":return`\u05DE\u05E4\u05EA\u05D7${u.keys.length>1?"\u05D5\u05EA":""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${u.keys.length>1?"\u05D9\u05DD":"\u05D4"}: ${T(u.keys,", ")}`;case"invalid_key":return"\u05E9\u05D3\u05D4 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8";case"invalid_union":return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF";case"invalid_element":return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${n(u.origin??"array")}`;default:return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"}}};function Dz(){return{localeError:bX()}}var vX=()=>{let t={string:{unit:"znakova",verb:"imati"},file:{unit:"bajtova",verb:"imati"},array:{unit:"stavki",verb:"imati"},set:{unit:"stavki",verb:"imati"}};function e(n){return t[n]??null}let r={regex:"unos",email:"email adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum i vrijeme",date:"ISO datum",time:"ISO vrijeme",duration:"ISO trajanje",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"IPv4 raspon",cidrv6:"IPv6 raspon",base64:"base64 kodirani tekst",base64url:"base64url kodirani tekst",json_string:"JSON tekst",e164:"E.164 broj",jwt:"JWT",template_literal:"unos"},o={nan:"NaN",string:"tekst",number:"broj",boolean:"boolean",array:"niz",object:"objekt",set:"skup",file:"datoteka",date:"datum",bigint:"bigint",symbol:"simbol",undefined:"undefined",null:"null",function:"funkcija",map:"mapa"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Neispravan unos: o\u010Dekuje se instanceof ${n.expected}, a primljeno je ${a}`:`Neispravan unos: o\u010Dekuje se ${i}, a primljeno je ${a}`}case"invalid_value":return n.values.length===1?`Neispravna vrijednost: o\u010Dekivano ${j(n.values[0])}`:`Neispravna opcija: o\u010Dekivano jedno od ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin),a=o[n.origin]??n.origin;return s?`Preveliko: o\u010Dekivano da ${a??"vrijednost"} ima ${i}${n.maximum.toString()} ${s.unit??"elemenata"}`:`Preveliko: o\u010Dekivano da ${a??"vrijednost"} bude ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin),a=o[n.origin]??n.origin;return s?`Premalo: o\u010Dekivano da ${a} ima ${i}${n.minimum.toString()} ${s.unit}`:`Premalo: o\u010Dekivano da ${a} bude ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Neispravan tekst: mora zapo\u010Dinjati s "${i.prefix}"`:i.format==="ends_with"?`Neispravan tekst: mora zavr\u0161avati s "${i.suffix}"`:i.format==="includes"?`Neispravan tekst: mora sadr\u017Eavati "${i.includes}"`:i.format==="regex"?`Neispravan tekst: mora odgovarati uzorku ${i.pattern}`:`Neispravna ${r[i.format]??n.format}`}case"not_multiple_of":return`Neispravan broj: mora biti vi\u0161ekratnik od ${n.divisor}`;case"unrecognized_keys":return`Neprepoznat${n.keys.length>1?"i klju\u010Devi":" klju\u010D"}: ${T(n.keys,", ")}`;case"invalid_key":return`Neispravan klju\u010D u ${o[n.origin]??n.origin}`;case"invalid_union":return"Neispravan unos";case"invalid_element":return`Neispravna vrijednost u ${o[n.origin]??n.origin}`;default:return"Neispravan unos"}}};function Fz(){return{localeError:vX()}}var SX=()=>{let t={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function e(n){return t[n]??null}let r={regex:"bemenet",email:"email c\xEDm",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO id\u0151b\xE9lyeg",date:"ISO d\xE1tum",time:"ISO id\u0151",duration:"ISO id\u0151intervallum",ipv4:"IPv4 c\xEDm",ipv6:"IPv6 c\xEDm",cidrv4:"IPv4 tartom\xE1ny",cidrv6:"IPv6 tartom\xE1ny",base64:"base64-k\xF3dolt string",base64url:"base64url-k\xF3dolt string",json_string:"JSON string",e164:"E.164 sz\xE1m",jwt:"JWT",template_literal:"bemenet"},o={nan:"NaN",number:"sz\xE1m",array:"t\xF6mb"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k instanceof ${n.expected}, a kapott \xE9rt\xE9k ${a}`:`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${i}, a kapott \xE9rt\xE9k ${a}`}case"invalid_value":return n.values.length===1?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${j(n.values[0])}`:`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);return s?`T\xFAl nagy: ${n.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${i}${n.maximum.toString()} ${s.unit??"elem"}`:`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${n.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);return s?`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${n.origin} m\xE9rete t\xFAl kicsi ${i}${n.minimum.toString()} ${s.unit}`:`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${n.origin} t\xFAl kicsi ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\xC9rv\xE9nytelen string: "${i.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`:i.format==="ends_with"?`\xC9rv\xE9nytelen string: "${i.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`:i.format==="includes"?`\xC9rv\xE9nytelen string: "${i.includes}" \xE9rt\xE9ket kell tartalmaznia`:i.format==="regex"?`\xC9rv\xE9nytelen string: ${i.pattern} mint\xE1nak kell megfelelnie`:`\xC9rv\xE9nytelen ${r[i.format]??n.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${n.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${n.keys.length>1?"s":""}: ${T(n.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${n.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${n.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}};function zz(){return{localeError:SX()}}function jz(t,e,r){return Math.abs(t)===1?e:r}function Cl(t){if(!t)return"";let e=["\u0561","\u0565","\u0568","\u056B","\u0578","\u0578\u0582","\u0585"],r=t[t.length-1];return t+(e.includes(r)?"\u0576":"\u0568")}var wX=()=>{let t={string:{unit:{one:"\u0576\u0577\u0561\u0576",many:"\u0576\u0577\u0561\u0576\u0576\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},file:{unit:{one:"\u0562\u0561\u0575\u0569",many:"\u0562\u0561\u0575\u0569\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},array:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},set:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"}};function e(n){return t[n]??null}let r={regex:"\u0574\u0578\u0582\u057F\u0584",email:"\u0567\u056C. \u0570\u0561\u057D\u0581\u0565",url:"URL",emoji:"\u0567\u0574\u0578\u057B\u056B",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E \u0587 \u056A\u0561\u0574",date:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E",time:"ISO \u056A\u0561\u0574",duration:"ISO \u057F\u0587\u0578\u0572\u0578\u0582\u0569\u0575\u0578\u0582\u0576",ipv4:"IPv4 \u0570\u0561\u057D\u0581\u0565",ipv6:"IPv6 \u0570\u0561\u057D\u0581\u0565",cidrv4:"IPv4 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",cidrv6:"IPv6 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",base64:"base64 \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",base64url:"base64url \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",json_string:"JSON \u057F\u0578\u0572",e164:"E.164 \u0570\u0561\u0574\u0561\u0580",jwt:"JWT",template_literal:"\u0574\u0578\u0582\u057F\u0584"},o={nan:"NaN",number:"\u0569\u056B\u057E",array:"\u0566\u0561\u0576\u0563\u057E\u0561\u056E"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 instanceof ${n.expected}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${a}`:`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${i}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${a}`}case"invalid_value":return n.values.length===1?`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${j(n.values[1])}`:`\u054D\u056D\u0561\u056C \u057F\u0561\u0580\u0562\u0565\u0580\u0561\u056F\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 \u0570\u0565\u057F\u0587\u0575\u0561\u056C\u0576\u0565\u0580\u056B\u0581 \u0574\u0565\u056F\u0568\u055D ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);if(s){let a=Number(n.maximum),c=jz(a,s.unit.one,s.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${Cl(n.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${i}${n.maximum.toString()} ${c}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${Cl(n.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056C\u056B\u0576\u056B ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);if(s){let a=Number(n.minimum),c=jz(a,s.unit.one,s.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${Cl(n.origin)} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${i}${n.minimum.toString()} ${c}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${Cl(n.origin)} \u056C\u056B\u0576\u056B ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057D\u056F\u057D\u057E\u056B "${i.prefix}"-\u0578\u057E`:i.format==="ends_with"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0561\u057E\u0561\u0580\u057F\u057E\u056B "${i.suffix}"-\u0578\u057E`:i.format==="includes"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057A\u0561\u0580\u0578\u0582\u0576\u0561\u056F\u056B "${i.includes}"`:i.format==="regex"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0570\u0561\u0574\u0561\u057A\u0561\u057F\u0561\u057D\u056D\u0561\u0576\u056B ${i.pattern} \u0571\u0587\u0561\u0579\u0561\u0583\u056B\u0576`:`\u054D\u056D\u0561\u056C ${r[i.format]??n.format}`}case"not_multiple_of":return`\u054D\u056D\u0561\u056C \u0569\u056B\u057E\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0562\u0561\u0566\u0574\u0561\u057A\u0561\u057F\u056B\u056F \u056C\u056B\u0576\u056B ${n.divisor}-\u056B`;case"unrecognized_keys":return`\u0549\u0573\u0561\u0576\u0561\u0579\u057E\u0561\u056E \u0562\u0561\u0576\u0561\u056C\u056B${n.keys.length>1?"\u0576\u0565\u0580":""}. ${T(n.keys,", ")}`;case"invalid_key":return`\u054D\u056D\u0561\u056C \u0562\u0561\u0576\u0561\u056C\u056B ${Cl(n.origin)}-\u0578\u0582\u0574`;case"invalid_union":return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574";case"invalid_element":return`\u054D\u056D\u0561\u056C \u0561\u0580\u056A\u0565\u0584 ${Cl(n.origin)}-\u0578\u0582\u0574`;default:return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574"}}};function Lz(){return{localeError:wX()}}var EX=()=>{let t={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function e(n){return t[n]??null}let r={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Input tidak valid: diharapkan instanceof ${n.expected}, diterima ${a}`:`Input tidak valid: diharapkan ${i}, diterima ${a}`}case"invalid_value":return n.values.length===1?`Input tidak valid: diharapkan ${j(n.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);return s?`Terlalu besar: diharapkan ${n.origin??"value"} memiliki ${i}${n.maximum.toString()} ${s.unit??"elemen"}`:`Terlalu besar: diharapkan ${n.origin??"value"} menjadi ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);return s?`Terlalu kecil: diharapkan ${n.origin} memiliki ${i}${n.minimum.toString()} ${s.unit}`:`Terlalu kecil: diharapkan ${n.origin} menjadi ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`String tidak valid: harus dimulai dengan "${i.prefix}"`:i.format==="ends_with"?`String tidak valid: harus berakhir dengan "${i.suffix}"`:i.format==="includes"?`String tidak valid: harus menyertakan "${i.includes}"`:i.format==="regex"?`String tidak valid: harus sesuai pola ${i.pattern}`:`${r[i.format]??n.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${n.keys.length>1?"s":""}: ${T(n.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${n.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${n.origin}`;default:return"Input tidak valid"}}};function Uz(){return{localeError:EX()}}var kX=()=>{let t={string:{unit:"stafi",verb:"a\xF0 hafa"},file:{unit:"b\xE6ti",verb:"a\xF0 hafa"},array:{unit:"hluti",verb:"a\xF0 hafa"},set:{unit:"hluti",verb:"a\xF0 hafa"}};function e(n){return t[n]??null}let r={regex:"gildi",email:"netfang",url:"vefsl\xF3\xF0",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og t\xEDmi",date:"ISO dagsetning",time:"ISO t\xEDmi",duration:"ISO t\xEDmalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 t\xF6lugildi",jwt:"JWT",template_literal:"gildi"},o={nan:"NaN",number:"n\xFAmer",array:"fylki"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Rangt gildi: \xDE\xFA sl\xF3st inn ${a} \xFEar sem \xE1 a\xF0 vera instanceof ${n.expected}`:`Rangt gildi: \xDE\xFA sl\xF3st inn ${a} \xFEar sem \xE1 a\xF0 vera ${i}`}case"invalid_value":return n.values.length===1?`Rangt gildi: gert r\xE1\xF0 fyrir ${j(n.values[0])}`:`\xD3gilt val: m\xE1 vera eitt af eftirfarandi ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);return s?`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin??"gildi"} hafi ${i}${n.maximum.toString()} ${s.unit??"hluti"}`:`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin??"gildi"} s\xE9 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);return s?`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin} hafi ${i}${n.minimum.toString()} ${s.unit}`:`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin} s\xE9 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 byrja \xE1 "${i.prefix}"`:i.format==="ends_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 enda \xE1 "${i.suffix}"`:i.format==="includes"?`\xD3gildur strengur: ver\xF0ur a\xF0 innihalda "${i.includes}"`:i.format==="regex"?`\xD3gildur strengur: ver\xF0ur a\xF0 fylgja mynstri ${i.pattern}`:`Rangt ${r[i.format]??n.format}`}case"not_multiple_of":return`R\xF6ng tala: ver\xF0ur a\xF0 vera margfeldi af ${n.divisor}`;case"unrecognized_keys":return`\xD3\xFEekkt ${n.keys.length>1?"ir lyklar":"ur lykill"}: ${T(n.keys,", ")}`;case"invalid_key":return`Rangur lykill \xED ${n.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi \xED ${n.origin}`;default:return"Rangt gildi"}}};function qz(){return{localeError:kX()}}var IX=()=>{let t={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function e(n){return t[n]??null}let r={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"numero",array:"vettore"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Input non valido: atteso instanceof ${n.expected}, ricevuto ${a}`:`Input non valido: atteso ${i}, ricevuto ${a}`}case"invalid_value":return n.values.length===1?`Input non valido: atteso ${j(n.values[0])}`:`Opzione non valida: atteso uno tra ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);return s?`Troppo grande: ${n.origin??"valore"} deve avere ${i}${n.maximum.toString()} ${s.unit??"elementi"}`:`Troppo grande: ${n.origin??"valore"} deve essere ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);return s?`Troppo piccolo: ${n.origin} deve avere ${i}${n.minimum.toString()} ${s.unit}`:`Troppo piccolo: ${n.origin} deve essere ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Stringa non valida: deve iniziare con "${i.prefix}"`:i.format==="ends_with"?`Stringa non valida: deve terminare con "${i.suffix}"`:i.format==="includes"?`Stringa non valida: deve includere "${i.includes}"`:i.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${i.pattern}`:`Input non valido: ${r[i.format]??n.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${n.divisor}`;case"unrecognized_keys":return`Chiav${n.keys.length>1?"i":"e"} non riconosciut${n.keys.length>1?"e":"a"}: ${T(n.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${n.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${n.origin}`;default:return"Input non valido"}}};function Hz(){return{localeError:IX()}}var OX=()=>{let t={string:{unit:"\u6587\u5B57",verb:"\u3067\u3042\u308B"},file:{unit:"\u30D0\u30A4\u30C8",verb:"\u3067\u3042\u308B"},array:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},set:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"}};function e(n){return t[n]??null}let r={regex:"\u5165\u529B\u5024",email:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",url:"URL",emoji:"\u7D75\u6587\u5B57",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u6642",date:"ISO\u65E5\u4ED8",time:"ISO\u6642\u523B",duration:"ISO\u671F\u9593",ipv4:"IPv4\u30A2\u30C9\u30EC\u30B9",ipv6:"IPv6\u30A2\u30C9\u30EC\u30B9",cidrv4:"IPv4\u7BC4\u56F2",cidrv6:"IPv6\u7BC4\u56F2",base64:"base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",base64url:"base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",json_string:"JSON\u6587\u5B57\u5217",e164:"E.164\u756A\u53F7",jwt:"JWT",template_literal:"\u5165\u529B\u5024"},o={nan:"NaN",number:"\u6570\u5024",array:"\u914D\u5217"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u7121\u52B9\u306A\u5165\u529B: instanceof ${n.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${a}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u5165\u529B: ${i}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${a}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`}case"invalid_value":return n.values.length===1?`\u7121\u52B9\u306A\u5165\u529B: ${j(n.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u9078\u629E: ${T(n.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let i=n.inclusive?"\u4EE5\u4E0B\u3067\u3042\u308B":"\u3088\u308A\u5C0F\u3055\u3044",s=e(n.origin);return s?`\u5927\u304D\u3059\u304E\u308B\u5024: ${n.origin??"\u5024"}\u306F${n.maximum.toString()}${s.unit??"\u8981\u7D20"}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5927\u304D\u3059\u304E\u308B\u5024: ${n.origin??"\u5024"}\u306F${n.maximum.toString()}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let i=n.inclusive?"\u4EE5\u4E0A\u3067\u3042\u308B":"\u3088\u308A\u5927\u304D\u3044",s=e(n.origin);return s?`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${n.origin}\u306F${n.minimum.toString()}${s.unit}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${n.origin}\u306F${n.minimum.toString()}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="ends_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="includes"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="regex"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${i.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u7121\u52B9\u306A${r[i.format]??n.format}`}case"not_multiple_of":return`\u7121\u52B9\u306A\u6570\u5024: ${n.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"unrecognized_keys":return`\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${n.keys.length>1?"\u7FA4":""}: ${T(n.keys,"\u3001")}`;case"invalid_key":return`${n.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;case"invalid_union":return"\u7121\u52B9\u306A\u5165\u529B";case"invalid_element":return`${n.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;default:return"\u7121\u52B9\u306A\u5165\u529B"}}};function Bz(){return{localeError:OX()}}var CX=()=>{let t={string:{unit:"\u10E1\u10D8\u10DB\u10D1\u10DD\u10DA\u10DD",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},file:{unit:"\u10D1\u10D0\u10D8\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},array:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},set:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"}};function e(n){return t[n]??null}let r={regex:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0",email:"\u10D4\u10DA-\u10E4\u10DD\u10E1\u10E2\u10D8\u10E1 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",url:"URL",emoji:"\u10D4\u10DB\u10DD\u10EF\u10D8",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8-\u10D3\u10E0\u10DD",date:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8",time:"\u10D3\u10E0\u10DD",duration:"\u10EE\u10D0\u10DC\u10D2\u10E0\u10EB\u10DA\u10D8\u10D5\u10DD\u10D1\u10D0",ipv4:"IPv4 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",ipv6:"IPv6 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",cidrv4:"IPv4 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",cidrv6:"IPv6 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",base64:"base64-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8",base64url:"base64url-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8",json_string:"JSON \u10D5\u10D4\u10DA\u10D8",e164:"E.164 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",jwt:"JWT",template_literal:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"},o={nan:"NaN",number:"\u10E0\u10D8\u10EA\u10EE\u10D5\u10D8",string:"\u10D5\u10D4\u10DA\u10D8",boolean:"\u10D1\u10E3\u10DA\u10D4\u10D0\u10DC\u10D8",function:"\u10E4\u10E3\u10DC\u10E5\u10EA\u10D8\u10D0",array:"\u10DB\u10D0\u10E1\u10D8\u10D5\u10D8"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 instanceof ${n.expected}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${a}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${i}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${a}`}case"invalid_value":return n.values.length===1?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${j(n.values[0])}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D0\u10E0\u10D8\u10D0\u10DC\u10E2\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8\u10D0 \u10D4\u10E0\u10D7-\u10D4\u10E0\u10D7\u10D8 ${T(n.values,"|")}-\u10D3\u10D0\u10DC`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);return s?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} ${s.verb} ${i}${n.maximum.toString()} ${s.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} \u10D8\u10E7\u10DD\u10E1 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);return s?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin} ${s.verb} ${i}${n.minimum.toString()} ${s.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin} \u10D8\u10E7\u10DD\u10E1 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10EC\u10E7\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${i.prefix}"-\u10D8\u10D7`:i.format==="ends_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10DB\u10D7\u10D0\u10D5\u10E0\u10D3\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${i.suffix}"-\u10D8\u10D7`:i.format==="includes"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1 "${i.includes}"-\u10E1`:i.format==="regex"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D4\u10E1\u10D0\u10D1\u10D0\u10DB\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 \u10E8\u10D0\u10D1\u10DA\u10DD\u10DC\u10E1 ${i.pattern}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 ${r[i.format]??n.format}`}case"not_multiple_of":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E0\u10D8\u10EA\u10EE\u10D5\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10E7\u10DD\u10E1 ${n.divisor}-\u10D8\u10E1 \u10EF\u10D4\u10E0\u10D0\u10D3\u10D8`;case"unrecognized_keys":return`\u10E3\u10EA\u10DC\u10DD\u10D1\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1${n.keys.length>1?"\u10D4\u10D1\u10D8":"\u10D8"}: ${T(n.keys,", ")}`;case"invalid_key":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1\u10D8 ${n.origin}-\u10E8\u10D8`;case"invalid_union":return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0";case"invalid_element":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0 ${n.origin}-\u10E8\u10D8`;default:return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"}}};function Wz(){return{localeError:CX()}}var RX=()=>{let t={string:{unit:"\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},file:{unit:"\u1794\u17C3",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},array:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},set:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"}};function e(n){return t[n]??null}let r={regex:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",email:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B",url:"URL",emoji:"\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO",date:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO",time:"\u1798\u17C9\u17C4\u1784 ISO",duration:"\u179A\u1799\u17C8\u1796\u17C1\u179B ISO",ipv4:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",ipv6:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",cidrv4:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",cidrv6:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",base64:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64",base64url:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url",json_string:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",e164:"\u179B\u17C1\u1781 E.164",jwt:"JWT",template_literal:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"},o={nan:"NaN",number:"\u179B\u17C1\u1781",array:"\u17A2\u17B6\u179A\u17C1 (Array)",null:"\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A instanceof ${n.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${a}`:`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${i} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${a}`}case"invalid_value":return n.values.length===1?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${j(n.values[0])}`:`\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);return s?`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${i} ${n.maximum.toString()} ${s.unit??"\u1792\u17B6\u178F\u17BB"}`:`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);return s?`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin} ${i} ${n.minimum.toString()} ${s.unit}`:`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin} ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${i.prefix}"`:i.format==="ends_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${i.suffix}"`:i.format==="includes"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${i.includes}"`:i.format==="regex"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${i.pattern}`:`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${r[i.format]??n.format}`}case"not_multiple_of":return`\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${n.divisor}`;case"unrecognized_keys":return`\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${T(n.keys,", ")}`;case"invalid_key":return`\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${n.origin}`;case"invalid_union":return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C";case"invalid_element":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${n.origin}`;default:return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C"}}};function fx(){return{localeError:RX()}}function Zz(){return fx()}var AX=()=>{let t={string:{unit:"\uBB38\uC790",verb:"to have"},file:{unit:"\uBC14\uC774\uD2B8",verb:"to have"},array:{unit:"\uAC1C",verb:"to have"},set:{unit:"\uAC1C",verb:"to have"}};function e(n){return t[n]??null}let r={regex:"\uC785\uB825",email:"\uC774\uBA54\uC77C \uC8FC\uC18C",url:"URL",emoji:"\uC774\uBAA8\uC9C0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \uB0A0\uC9DC\uC2DC\uAC04",date:"ISO \uB0A0\uC9DC",time:"ISO \uC2DC\uAC04",duration:"ISO \uAE30\uAC04",ipv4:"IPv4 \uC8FC\uC18C",ipv6:"IPv6 \uC8FC\uC18C",cidrv4:"IPv4 \uBC94\uC704",cidrv6:"IPv6 \uBC94\uC704",base64:"base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",base64url:"base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",json_string:"JSON \uBB38\uC790\uC5F4",e164:"E.164 \uBC88\uD638",jwt:"JWT",template_literal:"\uC785\uB825"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 instanceof ${n.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${a}\uC785\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${i}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${a}\uC785\uB2C8\uB2E4`}case"invalid_value":return n.values.length===1?`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${j(n.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC635\uC158: ${T(n.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let i=n.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",s=i==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=e(n.origin),c=a?.unit??"\uC694\uC18C";return a?`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${n.maximum.toString()}${c} ${i}${s}`:`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${n.maximum.toString()} ${i}${s}`}case"too_small":{let i=n.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",s=i==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=e(n.origin),c=a?.unit??"\uC694\uC18C";return a?`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${n.minimum.toString()}${c} ${i}${s}`:`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${n.minimum.toString()} ${i}${s}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`:i.format==="ends_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`:i.format==="includes"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`:i.format==="regex"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${i.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C ${r[i.format]??n.format}`}case"not_multiple_of":return`\uC798\uBABB\uB41C \uC22B\uC790: ${n.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"unrecognized_keys":return`\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${T(n.keys,", ")}`;case"invalid_key":return`\uC798\uBABB\uB41C \uD0A4: ${n.origin}`;case"invalid_union":return"\uC798\uBABB\uB41C \uC785\uB825";case"invalid_element":return`\uC798\uBABB\uB41C \uAC12: ${n.origin}`;default:return"\uC798\uBABB\uB41C \uC785\uB825"}}};function Gz(){return{localeError:AX()}}var Im=t=>t.charAt(0).toUpperCase()+t.slice(1);function Vz(t){let e=Math.abs(t),r=e%10,o=e%100;return o>=11&&o<=19||r===0?"many":r===1?"one":"few"}var TX=()=>{let t={string:{unit:{one:"simbolis",few:"simboliai",many:"simboli\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne ilgesn\u0117 kaip",notInclusive:"turi b\u016Bti trumpesn\u0117 kaip"},bigger:{inclusive:"turi b\u016Bti ne trumpesn\u0117 kaip",notInclusive:"turi b\u016Bti ilgesn\u0117 kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"bait\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne didesnis kaip",notInclusive:"turi b\u016Bti ma\u017Eesnis kaip"},bigger:{inclusive:"turi b\u016Bti ne ma\u017Eesnis kaip",notInclusive:"turi b\u016Bti didesnis kaip"}}},array:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}},set:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}}};function e(n,i,s,a){let c=t[n]??null;return c===null?c:{unit:c.unit[i],verb:c.verb[a][s?"inclusive":"notInclusive"]}}let r={regex:"\u012Fvestis",email:"el. pa\u0161to adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukm\u0117",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 u\u017Ekoduota eilut\u0117",base64url:"base64url u\u017Ekoduota eilut\u0117",json_string:"JSON eilut\u0117",e164:"E.164 numeris",jwt:"JWT",template_literal:"\u012Fvestis"},o={nan:"NaN",number:"skai\u010Dius",bigint:"sveikasis skai\u010Dius",string:"eilut\u0117",boolean:"login\u0117 reik\u0161m\u0117",undefined:"neapibr\u0117\u017Eta reik\u0161m\u0117",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulin\u0117 reik\u0161m\u0117"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Gautas tipas ${a}, o tik\u0117tasi - instanceof ${n.expected}`:`Gautas tipas ${a}, o tik\u0117tasi - ${i}`}case"invalid_value":return n.values.length===1?`Privalo b\u016Bti ${j(n.values[0])}`:`Privalo b\u016Bti vienas i\u0161 ${T(n.values,"|")} pasirinkim\u0173`;case"too_big":{let i=o[n.origin]??n.origin,s=e(n.origin,Vz(Number(n.maximum)),n.inclusive??!1,"smaller");if(s?.verb)return`${Im(i??n.origin??"reik\u0161m\u0117")} ${s.verb} ${n.maximum.toString()} ${s.unit??"element\u0173"}`;let a=n.inclusive?"ne didesnis kaip":"ma\u017Eesnis kaip";return`${Im(i??n.origin??"reik\u0161m\u0117")} turi b\u016Bti ${a} ${n.maximum.toString()} ${s?.unit}`}case"too_small":{let i=o[n.origin]??n.origin,s=e(n.origin,Vz(Number(n.minimum)),n.inclusive??!1,"bigger");if(s?.verb)return`${Im(i??n.origin??"reik\u0161m\u0117")} ${s.verb} ${n.minimum.toString()} ${s.unit??"element\u0173"}`;let a=n.inclusive?"ne ma\u017Eesnis kaip":"didesnis kaip";return`${Im(i??n.origin??"reik\u0161m\u0117")} turi b\u016Bti ${a} ${n.minimum.toString()} ${s?.unit}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Eilut\u0117 privalo prasid\u0117ti "${i.prefix}"`:i.format==="ends_with"?`Eilut\u0117 privalo pasibaigti "${i.suffix}"`:i.format==="includes"?`Eilut\u0117 privalo \u012Ftraukti "${i.includes}"`:i.format==="regex"?`Eilut\u0117 privalo atitikti ${i.pattern}`:`Neteisingas ${r[i.format]??n.format}`}case"not_multiple_of":return`Skai\u010Dius privalo b\u016Bti ${n.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpa\u017Eint${n.keys.length>1?"i":"as"} rakt${n.keys.length>1?"ai":"as"}: ${T(n.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga \u012Fvestis";case"invalid_element":{let i=o[n.origin]??n.origin;return`${Im(i??n.origin??"reik\u0161m\u0117")} turi klaiding\u0105 \u012Fvest\u012F`}default:return"Klaidinga \u012Fvestis"}}};function Kz(){return{localeError:TX()}}var $X=()=>{let t={string:{unit:"\u0437\u043D\u0430\u0446\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},file:{unit:"\u0431\u0430\u0458\u0442\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},array:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},set:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"}};function e(n){return t[n]??null}let r={regex:"\u0432\u043D\u0435\u0441",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430",url:"URL",emoji:"\u0435\u043C\u043E\u045F\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0443\u043C",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441\u0430",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441\u0430",cidrv4:"IPv4 \u043E\u043F\u0441\u0435\u0433",cidrv6:"IPv6 \u043E\u043F\u0441\u0435\u0433",base64:"base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",base64url:"base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",json_string:"JSON \u043D\u0438\u0437\u0430",e164:"E.164 \u0431\u0440\u043E\u0458",jwt:"JWT",template_literal:"\u0432\u043D\u0435\u0441"},o={nan:"NaN",number:"\u0431\u0440\u043E\u0458",array:"\u043D\u0438\u0437\u0430"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 instanceof ${n.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${a}`:`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${i}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${a}`}case"invalid_value":return n.values.length===1?`Invalid input: expected ${j(n.values[0])}`:`\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);return s?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${n.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${i}${n.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${n.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);return s?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${n.origin} \u0434\u0430 \u0438\u043C\u0430 ${i}${n.minimum.toString()} ${s.unit}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${n.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${i.pattern}`:`Invalid ${r[i.format]??n.format}`}case"not_multiple_of":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438":"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${T(n.keys,", ")}`;case"invalid_key":return`\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${n.origin}`;case"invalid_union":return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441";case"invalid_element":return`\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${n.origin}`;default:return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"}}};function Jz(){return{localeError:$X()}}var PX=()=>{let t={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function e(n){return t[n]??null}let r={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"nombor"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Input tidak sah: dijangka instanceof ${n.expected}, diterima ${a}`:`Input tidak sah: dijangka ${i}, diterima ${a}`}case"invalid_value":return n.values.length===1?`Input tidak sah: dijangka ${j(n.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);return s?`Terlalu besar: dijangka ${n.origin??"nilai"} ${s.verb} ${i}${n.maximum.toString()} ${s.unit??"elemen"}`:`Terlalu besar: dijangka ${n.origin??"nilai"} adalah ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);return s?`Terlalu kecil: dijangka ${n.origin} ${s.verb} ${i}${n.minimum.toString()} ${s.unit}`:`Terlalu kecil: dijangka ${n.origin} adalah ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`String tidak sah: mesti bermula dengan "${i.prefix}"`:i.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${i.suffix}"`:i.format==="includes"?`String tidak sah: mesti mengandungi "${i.includes}"`:i.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${i.pattern}`:`${r[i.format]??n.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${T(n.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${n.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${n.origin}`;default:return"Input tidak sah"}}};function Yz(){return{localeError:PX()}}var NX=()=>{let t={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"}};function e(n){return t[n]??null}let r={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"},o={nan:"NaN",number:"getal"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Ongeldige invoer: verwacht instanceof ${n.expected}, ontving ${a}`:`Ongeldige invoer: verwacht ${i}, ontving ${a}`}case"invalid_value":return n.values.length===1?`Ongeldige invoer: verwacht ${j(n.values[0])}`:`Ongeldige optie: verwacht \xE9\xE9n van ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin),a=n.origin==="date"?"laat":n.origin==="string"?"lang":"groot";return s?`Te ${a}: verwacht dat ${n.origin??"waarde"} ${i}${n.maximum.toString()} ${s.unit??"elementen"} ${s.verb}`:`Te ${a}: verwacht dat ${n.origin??"waarde"} ${i}${n.maximum.toString()} is`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin),a=n.origin==="date"?"vroeg":n.origin==="string"?"kort":"klein";return s?`Te ${a}: verwacht dat ${n.origin} ${i}${n.minimum.toString()} ${s.unit} ${s.verb}`:`Te ${a}: verwacht dat ${n.origin} ${i}${n.minimum.toString()} is`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Ongeldige tekst: moet met "${i.prefix}" beginnen`:i.format==="ends_with"?`Ongeldige tekst: moet op "${i.suffix}" eindigen`:i.format==="includes"?`Ongeldige tekst: moet "${i.includes}" bevatten`:i.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${i.pattern}`:`Ongeldig: ${r[i.format]??n.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${n.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${n.keys.length>1?"s":""}: ${T(n.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${n.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${n.origin}`;default:return"Ongeldige invoer"}}};function Xz(){return{localeError:NX()}}var MX=()=>{let t={string:{unit:"tegn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"elementer",verb:"\xE5 inneholde"},set:{unit:"elementer",verb:"\xE5 inneholde"}};function e(n){return t[n]??null}let r={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"tall",array:"liste"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Ugyldig input: forventet instanceof ${n.expected}, fikk ${a}`:`Ugyldig input: forventet ${i}, fikk ${a}`}case"invalid_value":return n.values.length===1?`Ugyldig verdi: forventet ${j(n.values[0])}`:`Ugyldig valg: forventet en av ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);return s?`For stor(t): forventet ${n.origin??"value"} til \xE5 ha ${i}${n.maximum.toString()} ${s.unit??"elementer"}`:`For stor(t): forventet ${n.origin??"value"} til \xE5 ha ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);return s?`For lite(n): forventet ${n.origin} til \xE5 ha ${i}${n.minimum.toString()} ${s.unit}`:`For lite(n): forventet ${n.origin} til \xE5 ha ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Ugyldig streng: m\xE5 starte med "${i.prefix}"`:i.format==="ends_with"?`Ugyldig streng: m\xE5 ende med "${i.suffix}"`:i.format==="includes"?`Ugyldig streng: m\xE5 inneholde "${i.includes}"`:i.format==="regex"?`Ugyldig streng: m\xE5 matche m\xF8nsteret ${i.pattern}`:`Ugyldig ${r[i.format]??n.format}`}case"not_multiple_of":return`Ugyldig tall: m\xE5 v\xE6re et multiplum av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukjente n\xF8kler":"Ukjent n\xF8kkel"}: ${T(n.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${n.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${n.origin}`;default:return"Ugyldig input"}}};function Qz(){return{localeError:MX()}}var DX=()=>{let t={string:{unit:"harf",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"unsur",verb:"olmal\u0131d\u0131r"},set:{unit:"unsur",verb:"olmal\u0131d\u0131r"}};function e(n){return t[n]??null}let r={regex:"giren",email:"epostag\xE2h",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO heng\xE2m\u0131",date:"ISO tarihi",time:"ISO zaman\u0131",duration:"ISO m\xFCddeti",ipv4:"IPv4 ni\u015F\xE2n\u0131",ipv6:"IPv6 ni\u015F\xE2n\u0131",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-\u015Fifreli metin",base64url:"base64url-\u015Fifreli metin",json_string:"JSON metin",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"giren"},o={nan:"NaN",number:"numara",array:"saf",null:"gayb"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`F\xE2sit giren: umulan instanceof ${n.expected}, al\u0131nan ${a}`:`F\xE2sit giren: umulan ${i}, al\u0131nan ${a}`}case"invalid_value":return n.values.length===1?`F\xE2sit giren: umulan ${j(n.values[0])}`:`F\xE2sit tercih: m\xFBteberler ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);return s?`Fazla b\xFCy\xFCk: ${n.origin??"value"}, ${i}${n.maximum.toString()} ${s.unit??"elements"} sahip olmal\u0131yd\u0131.`:`Fazla b\xFCy\xFCk: ${n.origin??"value"}, ${i}${n.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);return s?`Fazla k\xFC\xE7\xFCk: ${n.origin}, ${i}${n.minimum.toString()} ${s.unit} sahip olmal\u0131yd\u0131.`:`Fazla k\xFC\xE7\xFCk: ${n.origin}, ${i}${n.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let i=n;return i.format==="starts_with"?`F\xE2sit metin: "${i.prefix}" ile ba\u015Flamal\u0131.`:i.format==="ends_with"?`F\xE2sit metin: "${i.suffix}" ile bitmeli.`:i.format==="includes"?`F\xE2sit metin: "${i.includes}" ihtiv\xE2 etmeli.`:i.format==="regex"?`F\xE2sit metin: ${i.pattern} nak\u015F\u0131na uymal\u0131.`:`F\xE2sit ${r[i.format]??n.format}`}case"not_multiple_of":return`F\xE2sit say\u0131: ${n.divisor} kat\u0131 olmal\u0131yd\u0131.`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar ${n.keys.length>1?"s":""}: ${T(n.keys,", ")}`;case"invalid_key":return`${n.origin} i\xE7in tan\u0131nmayan anahtar var.`;case"invalid_union":return"Giren tan\u0131namad\u0131.";case"invalid_element":return`${n.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;default:return"K\u0131ymet tan\u0131namad\u0131."}}};function ej(){return{localeError:DX()}}var FX=()=>{let t={string:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},file:{unit:"\u0628\u0627\u06CC\u067C\u0633",verb:"\u0648\u0644\u0631\u064A"},array:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},set:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"}};function e(n){return t[n]??null}let r={regex:"\u0648\u0631\u0648\u062F\u064A",email:"\u0628\u0631\u06CC\u069A\u0646\u0627\u0644\u06CC\u06A9",url:"\u06CC\u0648 \u0622\u0631 \u0627\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0646\u06CC\u067C\u0647 \u0627\u0648 \u0648\u062E\u062A",date:"\u0646\u06D0\u067C\u0647",time:"\u0648\u062E\u062A",duration:"\u0645\u0648\u062F\u0647",ipv4:"\u062F IPv4 \u067E\u062A\u0647",ipv6:"\u062F IPv6 \u067E\u062A\u0647",cidrv4:"\u062F IPv4 \u0633\u0627\u062D\u0647",cidrv6:"\u062F IPv6 \u0633\u0627\u062D\u0647",base64:"base64-encoded \u0645\u062A\u0646",base64url:"base64url-encoded \u0645\u062A\u0646",json_string:"JSON \u0645\u062A\u0646",e164:"\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u064A"},o={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0627\u0631\u06D0"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F instanceof ${n.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${a} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`:`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${i} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${a} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`}case"invalid_value":return n.values.length===1?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${j(n.values[0])} \u0648\u0627\u06CC`:`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${T(n.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);return s?`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${n.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${i}${n.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${n.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${i}${n.maximum.toString()} \u0648\u064A`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);return s?`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${n.origin} \u0628\u0627\u06CC\u062F ${i}${n.minimum.toString()} ${s.unit} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${n.origin} \u0628\u0627\u06CC\u062F ${i}${n.minimum.toString()} \u0648\u064A`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${i.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`:i.format==="ends_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${i.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`:i.format==="includes"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${i.includes}" \u0648\u0644\u0631\u064A`:i.format==="regex"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${i.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`:`${r[i.format]??n.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`}case"not_multiple_of":return`\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${n.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`;case"unrecognized_keys":return`\u0646\u0627\u0633\u0645 ${n.keys.length>1?"\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647":"\u06A9\u0644\u06CC\u0689"}: ${T(n.keys,", ")}`;case"invalid_key":return`\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${n.origin} \u06A9\u06D0`;case"invalid_union":return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A";case"invalid_element":return`\u0646\u0627\u0633\u0645 \u0639\u0646\u0635\u0631 \u067E\u0647 ${n.origin} \u06A9\u06D0`;default:return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A"}}};function tj(){return{localeError:FX()}}var zX=()=>{let t={string:{unit:"znak\xF3w",verb:"mie\u0107"},file:{unit:"bajt\xF3w",verb:"mie\u0107"},array:{unit:"element\xF3w",verb:"mie\u0107"},set:{unit:"element\xF3w",verb:"mie\u0107"}};function e(n){return t[n]??null}let r={regex:"wyra\u017Cenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ci\u0105g znak\xF3w zakodowany w formacie base64",base64url:"ci\u0105g znak\xF3w zakodowany w formacie base64url",json_string:"ci\u0105g znak\xF3w w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wej\u015Bcie"},o={nan:"NaN",number:"liczba",array:"tablica"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano instanceof ${n.expected}, otrzymano ${a}`:`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${i}, otrzymano ${a}`}case"invalid_value":return n.values.length===1?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${j(n.values[0])}`:`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);return s?`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${i}${n.maximum.toString()} ${s.unit??"element\xF3w"}`:`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);return s?`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${i}${n.minimum.toString()} ${s.unit??"element\xF3w"}`:`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${i.prefix}"`:i.format==="ends_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${i.suffix}"`:i.format==="includes"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${i.includes}"`:i.format==="regex"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${i.pattern}`:`Nieprawid\u0142ow(y/a/e) ${r[i.format]??n.format}`}case"not_multiple_of":return`Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${n.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${n.keys.length>1?"s":""}: ${T(n.keys,", ")}`;case"invalid_key":return`Nieprawid\u0142owy klucz w ${n.origin}`;case"invalid_union":return"Nieprawid\u0142owe dane wej\u015Bciowe";case"invalid_element":return`Nieprawid\u0142owa warto\u015B\u0107 w ${n.origin}`;default:return"Nieprawid\u0142owe dane wej\u015Bciowe"}}};function rj(){return{localeError:zX()}}var jX=()=>{let t={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function e(n){return t[n]??null}let r={regex:"padr\xE3o",email:"endere\xE7o de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"dura\xE7\xE3o ISO",ipv4:"endere\xE7o IPv4",ipv6:"endere\xE7o IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},o={nan:"NaN",number:"n\xFAmero",null:"nulo"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Tipo inv\xE1lido: esperado instanceof ${n.expected}, recebido ${a}`:`Tipo inv\xE1lido: esperado ${i}, recebido ${a}`}case"invalid_value":return n.values.length===1?`Entrada inv\xE1lida: esperado ${j(n.values[0])}`:`Op\xE7\xE3o inv\xE1lida: esperada uma das ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);return s?`Muito grande: esperado que ${n.origin??"valor"} tivesse ${i}${n.maximum.toString()} ${s.unit??"elementos"}`:`Muito grande: esperado que ${n.origin??"valor"} fosse ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);return s?`Muito pequeno: esperado que ${n.origin} tivesse ${i}${n.minimum.toString()} ${s.unit}`:`Muito pequeno: esperado que ${n.origin} fosse ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Texto inv\xE1lido: deve come\xE7ar com "${i.prefix}"`:i.format==="ends_with"?`Texto inv\xE1lido: deve terminar com "${i.suffix}"`:i.format==="includes"?`Texto inv\xE1lido: deve incluir "${i.includes}"`:i.format==="regex"?`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${i.pattern}`:`${r[i.format]??n.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${n.divisor}`;case"unrecognized_keys":return`Chave${n.keys.length>1?"s":""} desconhecida${n.keys.length>1?"s":""}: ${T(n.keys,", ")}`;case"invalid_key":return`Chave inv\xE1lida em ${n.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido em ${n.origin}`;default:return"Campo inv\xE1lido"}}};function nj(){return{localeError:jX()}}var LX=()=>{let t={string:{unit:"caractere",verb:"s\u0103 aib\u0103"},file:{unit:"octe\u021Bi",verb:"s\u0103 aib\u0103"},array:{unit:"elemente",verb:"s\u0103 aib\u0103"},set:{unit:"elemente",verb:"s\u0103 aib\u0103"},map:{unit:"intr\u0103ri",verb:"s\u0103 aib\u0103"}};function e(n){return t[n]??null}let r={regex:"intrare",email:"adres\u0103 de email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"dat\u0103 \u0219i or\u0103 ISO",date:"dat\u0103 ISO",time:"or\u0103 ISO",duration:"durat\u0103 ISO",ipv4:"adres\u0103 IPv4",ipv6:"adres\u0103 IPv6",mac:"adres\u0103 MAC",cidrv4:"interval IPv4",cidrv6:"interval IPv6",base64:"\u0219ir codat base64",base64url:"\u0219ir codat base64url",json_string:"\u0219ir JSON",e164:"num\u0103r E.164",jwt:"JWT",template_literal:"intrare"},o={nan:"NaN",string:"\u0219ir",number:"num\u0103r",boolean:"boolean",function:"func\u021Bie",array:"matrice",object:"obiect",undefined:"nedefinit",symbol:"simbol",bigint:"num\u0103r mare",void:"void",never:"never",map:"hart\u0103",set:"set"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return`Intrare invalid\u0103: a\u0219teptat ${i}, primit ${a}`}case"invalid_value":return n.values.length===1?`Intrare invalid\u0103: a\u0219teptat ${j(n.values[0])}`:`Op\u021Biune invalid\u0103: a\u0219teptat una dintre ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);return s?`Prea mare: a\u0219teptat ca ${n.origin??"valoarea"} ${s.verb} ${i}${n.maximum.toString()} ${s.unit??"elemente"}`:`Prea mare: a\u0219teptat ca ${n.origin??"valoarea"} s\u0103 fie ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);return s?`Prea mic: a\u0219teptat ca ${n.origin} ${s.verb} ${i}${n.minimum.toString()} ${s.unit}`:`Prea mic: a\u0219teptat ca ${n.origin} s\u0103 fie ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u0218ir invalid: trebuie s\u0103 \xEEnceap\u0103 cu "${i.prefix}"`:i.format==="ends_with"?`\u0218ir invalid: trebuie s\u0103 se termine cu "${i.suffix}"`:i.format==="includes"?`\u0218ir invalid: trebuie s\u0103 includ\u0103 "${i.includes}"`:i.format==="regex"?`\u0218ir invalid: trebuie s\u0103 se potriveasc\u0103 cu modelul ${i.pattern}`:`Format invalid: ${r[i.format]??n.format}`}case"not_multiple_of":return`Num\u0103r invalid: trebuie s\u0103 fie multiplu de ${n.divisor}`;case"unrecognized_keys":return`Chei nerecunoscute: ${T(n.keys,", ")}`;case"invalid_key":return`Cheie invalid\u0103 \xEEn ${n.origin}`;case"invalid_union":return"Intrare invalid\u0103";case"invalid_element":return`Valoare invalid\u0103 \xEEn ${n.origin}`;default:return"Intrare invalid\u0103"}}};function oj(){return{localeError:LX()}}function ij(t,e,r,o){let n=Math.abs(t),i=n%10,s=n%100;return s>=11&&s<=19?o:i===1?e:i>=2&&i<=4?r:o}var UX=()=>{let t={string:{unit:{one:"\u0441\u0438\u043C\u0432\u043E\u043B",few:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",many:"\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u0430",many:"\u0431\u0430\u0439\u0442"},verb:"\u0438\u043C\u0435\u0442\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"}};function e(n){return t[n]??null}let r={regex:"\u0432\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u044F",duration:"ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64",base64url:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url",json_string:"JSON \u0441\u0442\u0440\u043E\u043A\u0430",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0432\u043E\u0434"},o={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0441\u0438\u0432"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C instanceof ${n.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${a}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${i}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${a}`}case"invalid_value":return n.values.length===1?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${j(n.values[0])}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);if(s){let a=Number(n.maximum),c=ij(a,s.unit.one,s.unit.few,s.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${i}${n.maximum.toString()} ${c}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);if(s){let a=Number(n.minimum),c=ij(a,s.unit.one,s.unit.few,s.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${n.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${i}${n.minimum.toString()} ${c}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${n.origin} \u0431\u0443\u0434\u0435\u0442 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${r[i.format]??n.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${n.keys.length>1?"\u044B\u0435":"\u044B\u0439"} \u043A\u043B\u044E\u0447${n.keys.length>1?"\u0438":""}: ${T(n.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${n.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435";case"invalid_element":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${n.origin}`;default:return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435"}}};function sj(){return{localeError:UX()}}var qX=()=>{let t={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function e(n){return t[n]??null}let r={regex:"vnos",email:"e-po\u0161tni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in \u010Das",date:"ISO datum",time:"ISO \u010Das",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 \u0161tevilka",jwt:"JWT",template_literal:"vnos"},o={nan:"NaN",number:"\u0161tevilo",array:"tabela"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Neveljaven vnos: pri\u010Dakovano instanceof ${n.expected}, prejeto ${a}`:`Neveljaven vnos: pri\u010Dakovano ${i}, prejeto ${a}`}case"invalid_value":return n.values.length===1?`Neveljaven vnos: pri\u010Dakovano ${j(n.values[0])}`:`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);return s?`Preveliko: pri\u010Dakovano, da bo ${n.origin??"vrednost"} imelo ${i}${n.maximum.toString()} ${s.unit??"elementov"}`:`Preveliko: pri\u010Dakovano, da bo ${n.origin??"vrednost"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);return s?`Premajhno: pri\u010Dakovano, da bo ${n.origin} imelo ${i}${n.minimum.toString()} ${s.unit}`:`Premajhno: pri\u010Dakovano, da bo ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Neveljaven niz: mora se za\u010Deti z "${i.prefix}"`:i.format==="ends_with"?`Neveljaven niz: mora se kon\u010Dati z "${i.suffix}"`:i.format==="includes"?`Neveljaven niz: mora vsebovati "${i.includes}"`:i.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${i.pattern}`:`Neveljaven ${r[i.format]??n.format}`}case"not_multiple_of":return`Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${n.divisor}`;case"unrecognized_keys":return`Neprepoznan${n.keys.length>1?"i klju\u010Di":" klju\u010D"}: ${T(n.keys,", ")}`;case"invalid_key":return`Neveljaven klju\u010D v ${n.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${n.origin}`;default:return"Neveljaven vnos"}}};function aj(){return{localeError:qX()}}var HX=()=>{let t={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att inneh\xE5lla"},set:{unit:"objekt",verb:"att inneh\xE5lla"}};function e(n){return t[n]??null}let r={regex:"regulj\xE4rt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad str\xE4ng",base64url:"base64url-kodad str\xE4ng",json_string:"JSON-str\xE4ng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"},o={nan:"NaN",number:"antal",array:"lista"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Ogiltig inmatning: f\xF6rv\xE4ntat instanceof ${n.expected}, fick ${a}`:`Ogiltig inmatning: f\xF6rv\xE4ntat ${i}, fick ${a}`}case"invalid_value":return n.values.length===1?`Ogiltig inmatning: f\xF6rv\xE4ntat ${j(n.values[0])}`:`Ogiltigt val: f\xF6rv\xE4ntade en av ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);return s?`F\xF6r stor(t): f\xF6rv\xE4ntade ${n.origin??"v\xE4rdet"} att ha ${i}${n.maximum.toString()} ${s.unit??"element"}`:`F\xF6r stor(t): f\xF6rv\xE4ntat ${n.origin??"v\xE4rdet"} att ha ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);return s?`F\xF6r lite(t): f\xF6rv\xE4ntade ${n.origin??"v\xE4rdet"} att ha ${i}${n.minimum.toString()} ${s.unit}`:`F\xF6r lite(t): f\xF6rv\xE4ntade ${n.origin??"v\xE4rdet"} att ha ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${i.prefix}"`:i.format==="ends_with"?`Ogiltig str\xE4ng: m\xE5ste sluta med "${i.suffix}"`:i.format==="includes"?`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${i.includes}"`:i.format==="regex"?`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${i.pattern}"`:`Ogiltig(t) ${r[i.format]??n.format}`}case"not_multiple_of":return`Ogiltigt tal: m\xE5ste vara en multipel av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ok\xE4nda nycklar":"Ok\xE4nd nyckel"}: ${T(n.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${n.origin??"v\xE4rdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xE4rde i ${n.origin??"v\xE4rdet"}`;default:return"Ogiltig input"}}};function cj(){return{localeError:HX()}}var BX=()=>{let t={string:{unit:"\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},file:{unit:"\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},array:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},set:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"}};function e(n){return t[n]??null}let r={regex:"\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",email:"\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",date:"ISO \u0BA4\u0BC7\u0BA4\u0BBF",time:"ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",duration:"ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1",ipv4:"IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",ipv6:"IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",cidrv4:"IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",cidrv6:"IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",base64:"base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD",base64url:"base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD",json_string:"JSON \u0B9A\u0BB0\u0BAE\u0BCD",e164:"E.164 \u0B8E\u0BA3\u0BCD",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"\u0B8E\u0BA3\u0BCD",array:"\u0B85\u0BA3\u0BBF",null:"\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 instanceof ${n.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${a}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${i}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${a}`}case"invalid_value":return n.values.length===1?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${j(n.values[0])}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${T(n.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);return s?`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${i}${n.maximum.toString()} ${s.unit??"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${i}${n.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);return s?`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n.origin} ${i}${n.minimum.toString()} ${s.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n.origin} ${i}${n.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="ends_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="includes"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="regex"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${i.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${r[i.format]??n.format}`}case"not_multiple_of":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${n.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;case"unrecognized_keys":return`\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${n.keys.length>1?"\u0B95\u0BB3\u0BCD":""}: ${T(n.keys,", ")}`;case"invalid_key":return`${n.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`;case"invalid_union":return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1";case"invalid_element":return`${n.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`;default:return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1"}}};function uj(){return{localeError:BX()}}var WX=()=>{let t={string:{unit:"\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},file:{unit:"\u0E44\u0E1A\u0E15\u0E4C",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},array:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},set:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"}};function e(n){return t[n]??null}let r={regex:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",email:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",url:"URL",emoji:"\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",date:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",time:"\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",duration:"\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",ipv4:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",ipv6:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",cidrv4:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",cidrv6:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",base64:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",base64url:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",json_string:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",e164:"\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",jwt:"\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",template_literal:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"},o={nan:"NaN",number:"\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02",array:"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)",null:"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 instanceof ${n.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${a}`:`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${i} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${a}`}case"invalid_value":return n.values.length===1?`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${j(n.values[0])}`:`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",s=e(n.origin);return s?`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${n.maximum.toString()} ${s.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`:`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",s=e(n.origin);return s?`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${n.minimum.toString()} ${s.unit}`:`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${i.prefix}"`:i.format==="ends_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${i.suffix}"`:i.format==="includes"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${i.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`:i.format==="regex"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${i.pattern}`:`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${r[i.format]??n.format}`}case"not_multiple_of":return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${n.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`;case"unrecognized_keys":return`\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${T(n.keys,", ")}`;case"invalid_key":return`\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${n.origin}`;case"invalid_union":return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49";case"invalid_element":return`\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${n.origin}`;default:return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"}}};function lj(){return{localeError:WX()}}var ZX=()=>{let t={string:{unit:"karakter",verb:"olmal\u0131"},file:{unit:"bayt",verb:"olmal\u0131"},array:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},set:{unit:"\xF6\u011Fe",verb:"olmal\u0131"}};function e(n){return t[n]??null}let r={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO s\xFCre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aral\u0131\u011F\u0131",cidrv6:"IPv6 aral\u0131\u011F\u0131",base64:"base64 ile \u015Fifrelenmi\u015F metin",base64url:"base64url ile \u015Fifrelenmi\u015F metin",json_string:"JSON dizesi",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"\u015Eablon dizesi"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Ge\xE7ersiz de\u011Fer: beklenen instanceof ${n.expected}, al\u0131nan ${a}`:`Ge\xE7ersiz de\u011Fer: beklenen ${i}, al\u0131nan ${a}`}case"invalid_value":return n.values.length===1?`Ge\xE7ersiz de\u011Fer: beklenen ${j(n.values[0])}`:`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);return s?`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${i}${n.maximum.toString()} ${s.unit??"\xF6\u011Fe"}`:`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);return s?`\xC7ok k\xFC\xE7\xFCk: beklenen ${n.origin} ${i}${n.minimum.toString()} ${s.unit}`:`\xC7ok k\xFC\xE7\xFCk: beklenen ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Ge\xE7ersiz metin: "${i.prefix}" ile ba\u015Flamal\u0131`:i.format==="ends_with"?`Ge\xE7ersiz metin: "${i.suffix}" ile bitmeli`:i.format==="includes"?`Ge\xE7ersiz metin: "${i.includes}" i\xE7ermeli`:i.format==="regex"?`Ge\xE7ersiz metin: ${i.pattern} desenine uymal\u0131`:`Ge\xE7ersiz ${r[i.format]??n.format}`}case"not_multiple_of":return`Ge\xE7ersiz say\u0131: ${n.divisor} ile tam b\xF6l\xFCnebilmeli`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar${n.keys.length>1?"lar":""}: ${T(n.keys,", ")}`;case"invalid_key":return`${n.origin} i\xE7inde ge\xE7ersiz anahtar`;case"invalid_union":return"Ge\xE7ersiz de\u011Fer";case"invalid_element":return`${n.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;default:return"Ge\xE7ersiz de\u011Fer"}}};function pj(){return{localeError:ZX()}}var GX=()=>{let t={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},file:{unit:"\u0431\u0430\u0439\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"}};function e(n){return t[n]??null}let r={regex:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO",date:"\u0434\u0430\u0442\u0430 ISO",time:"\u0447\u0430\u0441 ISO",duration:"\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO",ipv4:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv4",ipv6:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv6",cidrv4:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4",cidrv6:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6",base64:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64",base64url:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url",json_string:"\u0440\u044F\u0434\u043E\u043A JSON",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"},o={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F instanceof ${n.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${a}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${i}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${a}`}case"invalid_value":return n.values.length===1?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${j(n.values[0])}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);return s?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${s.verb} ${i}${n.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);return s?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${n.origin} ${s.verb} ${i}${n.minimum.toString()} ${s.unit}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${n.origin} \u0431\u0443\u0434\u0435 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${r[i.format]??n.format}`}case"not_multiple_of":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${n.keys.length>1?"\u0456":""}: ${T(n.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${n.origin}`;case"invalid_union":return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456";case"invalid_element":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${n.origin}`;default:return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"}}};function mx(){return{localeError:GX()}}function dj(){return mx()}var VX=()=>{let t={string:{unit:"\u062D\u0631\u0648\u0641",verb:"\u06C1\u0648\u0646\u0627"},file:{unit:"\u0628\u0627\u0626\u0679\u0633",verb:"\u06C1\u0648\u0646\u0627"},array:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},set:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"}};function e(n){return t[n]??null}let r={regex:"\u0627\u0646 \u067E\u0679",email:"\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633",url:"\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",uuidv4:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4",uuidv6:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6",nanoid:"\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC",guid:"\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid2:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2",ulid:"\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC",xid:"\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC",ksuid:"\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",datetime:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645",date:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E",time:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A",duration:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A",ipv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633",ipv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633",cidrv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C",cidrv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C",base64:"\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",base64url:"\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",json_string:"\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",e164:"\u0627\u06CC 164 \u0646\u0645\u0628\u0631",jwt:"\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",template_literal:"\u0627\u0646 \u067E\u0679"},o={nan:"NaN",number:"\u0646\u0645\u0628\u0631",array:"\u0622\u0631\u06D2",null:"\u0646\u0644"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: instanceof ${n.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${a} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`:`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${i} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${a} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`}case"invalid_value":return n.values.length===1?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${j(n.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`:`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${T(n.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);return s?`\u0628\u06C1\u062A \u0628\u0691\u0627: ${n.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${i}${n.maximum.toString()} ${s.unit??"\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0628\u0691\u0627: ${n.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${i}${n.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);return s?`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${n.origin} \u06A9\u06D2 ${i}${n.minimum.toString()} ${s.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${n.origin} \u06A9\u0627 ${i}${n.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="ends_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="includes"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="regex"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${i.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:`\u063A\u0644\u0637 ${r[i.format]??n.format}`}case"not_multiple_of":return`\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${n.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;case"unrecognized_keys":return`\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${n.keys.length>1?"\u0632":""}: ${T(n.keys,"\u060C ")}`;case"invalid_key":return`${n.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;case"invalid_union":return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";case"invalid_element":return`${n.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;default:return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"}}};function fj(){return{localeError:VX()}}var KX=()=>{let t={string:{unit:"belgi",verb:"bo\u2018lishi kerak"},file:{unit:"bayt",verb:"bo\u2018lishi kerak"},array:{unit:"element",verb:"bo\u2018lishi kerak"},set:{unit:"element",verb:"bo\u2018lishi kerak"},map:{unit:"yozuv",verb:"bo\u2018lishi kerak"}};function e(n){return t[n]??null}let r={regex:"kirish",email:"elektron pochta manzili",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO sana va vaqti",date:"ISO sana",time:"ISO vaqt",duration:"ISO davomiylik",ipv4:"IPv4 manzil",ipv6:"IPv6 manzil",mac:"MAC manzil",cidrv4:"IPv4 diapazon",cidrv6:"IPv6 diapazon",base64:"base64 kodlangan satr",base64url:"base64url kodlangan satr",json_string:"JSON satr",e164:"E.164 raqam",jwt:"JWT",template_literal:"kirish"},o={nan:"NaN",number:"raqam",array:"massiv"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`Noto\u2018g\u2018ri kirish: kutilgan instanceof ${n.expected}, qabul qilingan ${a}`:`Noto\u2018g\u2018ri kirish: kutilgan ${i}, qabul qilingan ${a}`}case"invalid_value":return n.values.length===1?`Noto\u2018g\u2018ri kirish: kutilgan ${j(n.values[0])}`:`Noto\u2018g\u2018ri variant: quyidagilardan biri kutilgan ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);return s?`Juda katta: kutilgan ${n.origin??"qiymat"} ${i}${n.maximum.toString()} ${s.unit} ${s.verb}`:`Juda katta: kutilgan ${n.origin??"qiymat"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);return s?`Juda kichik: kutilgan ${n.origin} ${i}${n.minimum.toString()} ${s.unit} ${s.verb}`:`Juda kichik: kutilgan ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Noto\u2018g\u2018ri satr: "${i.prefix}" bilan boshlanishi kerak`:i.format==="ends_with"?`Noto\u2018g\u2018ri satr: "${i.suffix}" bilan tugashi kerak`:i.format==="includes"?`Noto\u2018g\u2018ri satr: "${i.includes}" ni o\u2018z ichiga olishi kerak`:i.format==="regex"?`Noto\u2018g\u2018ri satr: ${i.pattern} shabloniga mos kelishi kerak`:`Noto\u2018g\u2018ri ${r[i.format]??n.format}`}case"not_multiple_of":return`Noto\u2018g\u2018ri raqam: ${n.divisor} ning karralisi bo\u2018lishi kerak`;case"unrecognized_keys":return`Noma\u2019lum kalit${n.keys.length>1?"lar":""}: ${T(n.keys,", ")}`;case"invalid_key":return`${n.origin} dagi kalit noto\u2018g\u2018ri`;case"invalid_union":return"Noto\u2018g\u2018ri kirish";case"invalid_element":return`${n.origin} da noto\u2018g\u2018ri qiymat`;default:return"Noto\u2018g\u2018ri kirish"}}};function mj(){return{localeError:KX()}}var JX=()=>{let t={string:{unit:"k\xFD t\u1EF1",verb:"c\xF3"},file:{unit:"byte",verb:"c\xF3"},array:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},set:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"}};function e(n){return t[n]??null}let r={regex:"\u0111\u1EA7u v\xE0o",email:"\u0111\u1ECBa ch\u1EC9 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ng\xE0y gi\u1EDD ISO",date:"ng\xE0y ISO",time:"gi\u1EDD ISO",duration:"kho\u1EA3ng th\u1EDDi gian ISO",ipv4:"\u0111\u1ECBa ch\u1EC9 IPv4",ipv6:"\u0111\u1ECBa ch\u1EC9 IPv6",cidrv4:"d\u1EA3i IPv4",cidrv6:"d\u1EA3i IPv6",base64:"chu\u1ED7i m\xE3 h\xF3a base64",base64url:"chu\u1ED7i m\xE3 h\xF3a base64url",json_string:"chu\u1ED7i JSON",e164:"s\u1ED1 E.164",jwt:"JWT",template_literal:"\u0111\u1EA7u v\xE0o"},o={nan:"NaN",number:"s\u1ED1",array:"m\u1EA3ng"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i instanceof ${n.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${a}`:`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${i}, nh\u1EADn \u0111\u01B0\u1EE3c ${a}`}case"invalid_value":return n.values.length===1?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${j(n.values[0])}`:`T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);return s?`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${n.origin??"gi\xE1 tr\u1ECB"} ${s.verb} ${i}${n.maximum.toString()} ${s.unit??"ph\u1EA7n t\u1EED"}`:`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${n.origin??"gi\xE1 tr\u1ECB"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);return s?`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${n.origin} ${s.verb} ${i}${n.minimum.toString()} ${s.unit}`:`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${i.prefix}"`:i.format==="ends_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${i.suffix}"`:i.format==="includes"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${i.includes}"`:i.format==="regex"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${i.pattern}`:`${r[i.format]??n.format} kh\xF4ng h\u1EE3p l\u1EC7`}case"not_multiple_of":return`S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${n.divisor}`;case"unrecognized_keys":return`Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${T(n.keys,", ")}`;case"invalid_key":return`Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${n.origin}`;case"invalid_union":return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7";case"invalid_element":return`Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${n.origin}`;default:return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"}}};function hj(){return{localeError:JX()}}var YX=()=>{let t={string:{unit:"\u5B57\u7B26",verb:"\u5305\u542B"},file:{unit:"\u5B57\u8282",verb:"\u5305\u542B"},array:{unit:"\u9879",verb:"\u5305\u542B"},set:{unit:"\u9879",verb:"\u5305\u542B"}};function e(n){return t[n]??null}let r={regex:"\u8F93\u5165",email:"\u7535\u5B50\u90AE\u4EF6",url:"URL",emoji:"\u8868\u60C5\u7B26\u53F7",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u671F\u65F6\u95F4",date:"ISO\u65E5\u671F",time:"ISO\u65F6\u95F4",duration:"ISO\u65F6\u957F",ipv4:"IPv4\u5730\u5740",ipv6:"IPv6\u5730\u5740",cidrv4:"IPv4\u7F51\u6BB5",cidrv6:"IPv6\u7F51\u6BB5",base64:"base64\u7F16\u7801\u5B57\u7B26\u4E32",base64url:"base64url\u7F16\u7801\u5B57\u7B26\u4E32",json_string:"JSON\u5B57\u7B26\u4E32",e164:"E.164\u53F7\u7801",jwt:"JWT",template_literal:"\u8F93\u5165"},o={nan:"NaN",number:"\u6570\u5B57",array:"\u6570\u7EC4",null:"\u7A7A\u503C(null)"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B instanceof ${n.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${a}`:`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${i}\uFF0C\u5B9E\u9645\u63A5\u6536 ${a}`}case"invalid_value":return n.values.length===1?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${j(n.values[0])}`:`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);return s?`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${n.origin??"\u503C"} ${i}${n.maximum.toString()} ${s.unit??"\u4E2A\u5143\u7D20"}`:`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${n.origin??"\u503C"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);return s?`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${n.origin} ${i}${n.minimum.toString()} ${s.unit}`:`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${i.prefix}" \u5F00\u5934`:i.format==="ends_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${i.suffix}" \u7ED3\u5C3E`:i.format==="includes"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${i.includes}"`:i.format==="regex"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${i.pattern}`:`\u65E0\u6548${r[i.format]??n.format}`}case"not_multiple_of":return`\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${n.divisor} \u7684\u500D\u6570`;case"unrecognized_keys":return`\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${T(n.keys,", ")}`;case"invalid_key":return`${n.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;case"invalid_union":return"\u65E0\u6548\u8F93\u5165";case"invalid_element":return`${n.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;default:return"\u65E0\u6548\u8F93\u5165"}}};function gj(){return{localeError:YX()}}var XX=()=>{let t={string:{unit:"\u5B57\u5143",verb:"\u64C1\u6709"},file:{unit:"\u4F4D\u5143\u7D44",verb:"\u64C1\u6709"},array:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},set:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"}};function e(n){return t[n]??null}let r={regex:"\u8F38\u5165",email:"\u90F5\u4EF6\u5730\u5740",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u65E5\u671F\u6642\u9593",date:"ISO \u65E5\u671F",time:"ISO \u6642\u9593",duration:"ISO \u671F\u9593",ipv4:"IPv4 \u4F4D\u5740",ipv6:"IPv6 \u4F4D\u5740",cidrv4:"IPv4 \u7BC4\u570D",cidrv6:"IPv6 \u7BC4\u570D",base64:"base64 \u7DE8\u78BC\u5B57\u4E32",base64url:"base64url \u7DE8\u78BC\u5B57\u4E32",json_string:"JSON \u5B57\u4E32",e164:"E.164 \u6578\u503C",jwt:"JWT",template_literal:"\u8F38\u5165"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA instanceof ${n.expected}\uFF0C\u4F46\u6536\u5230 ${a}`:`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${i}\uFF0C\u4F46\u6536\u5230 ${a}`}case"invalid_value":return n.values.length===1?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${j(n.values[0])}`:`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);return s?`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${n.origin??"\u503C"} \u61C9\u70BA ${i}${n.maximum.toString()} ${s.unit??"\u500B\u5143\u7D20"}`:`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${n.origin??"\u503C"} \u61C9\u70BA ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);return s?`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${n.origin} \u61C9\u70BA ${i}${n.minimum.toString()} ${s.unit}`:`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${n.origin} \u61C9\u70BA ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${i.prefix}" \u958B\u982D`:i.format==="ends_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${i.suffix}" \u7D50\u5C3E`:i.format==="includes"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${i.includes}"`:i.format==="regex"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${i.pattern}`:`\u7121\u6548\u7684 ${r[i.format]??n.format}`}case"not_multiple_of":return`\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${n.divisor} \u7684\u500D\u6578`;case"unrecognized_keys":return`\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${n.keys.length>1?"\u5011":""}\uFF1A${T(n.keys,"\u3001")}`;case"invalid_key":return`${n.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;case"invalid_union":return"\u7121\u6548\u7684\u8F38\u5165\u503C";case"invalid_element":return`${n.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;default:return"\u7121\u6548\u7684\u8F38\u5165\u503C"}}};function yj(){return{localeError:XX()}}var QX=()=>{let t={string:{unit:"\xE0mi",verb:"n\xED"},file:{unit:"bytes",verb:"n\xED"},array:{unit:"nkan",verb:"n\xED"},set:{unit:"nkan",verb:"n\xED"}};function e(n){return t[n]??null}let r={regex:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9",email:"\xE0d\xEDr\u1EB9\u0301s\xEC \xECm\u1EB9\u0301l\xEC",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\xE0k\xF3k\xF2 ISO",date:"\u1ECDj\u1ECD\u0301 ISO",time:"\xE0k\xF3k\xF2 ISO",duration:"\xE0k\xF3k\xF2 t\xF3 p\xE9 ISO",ipv4:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv4",ipv6:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv6",cidrv4:"\xE0gb\xE8gb\xE8 IPv4",cidrv6:"\xE0gb\xE8gb\xE8 IPv6",base64:"\u1ECD\u0300r\u1ECD\u0300 t\xED a k\u1ECD\u0301 n\xED base64",base64url:"\u1ECD\u0300r\u1ECD\u0300 base64url",json_string:"\u1ECD\u0300r\u1ECD\u0300 JSON",e164:"n\u1ECD\u0301mb\xE0 E.164",jwt:"JWT",template_literal:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9"},o={nan:"NaN",number:"n\u1ECD\u0301mb\xE0",array:"akop\u1ECD"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=L(n.input),a=o[s]??s;return/^[A-Z]/.test(n.expected)?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi instanceof ${n.expected}, \xE0m\u1ECD\u0300 a r\xED ${a}`:`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${i}, \xE0m\u1ECD\u0300 a r\xED ${a}`}case"invalid_value":return n.values.length===1?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${j(n.values[0])}`:`\xC0\u1E63\xE0y\xE0n a\u1E63\xEC\u1E63e: yan \u1ECD\u0300kan l\xE1ra ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=e(n.origin);return s?`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${n.origin??"iye"} ${s.verb} ${i}${n.maximum} ${s.unit}`:`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 ${i}${n.maximum}`}case"too_small":{let i=n.inclusive?">=":">",s=e(n.origin);return s?`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${n.origin} ${s.verb} ${i}${n.minimum} ${s.unit}`:`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 ${i}${n.minimum}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\u1EB9\u0300r\u1EB9\u0300 p\u1EB9\u0300l\xFA "${i.prefix}"`:i.format==="ends_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 par\xED p\u1EB9\u0300l\xFA "${i.suffix}"`:i.format==="includes"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 n\xED "${i.includes}"`:i.format==="regex"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\xE1 \xE0p\u1EB9\u1EB9r\u1EB9 mu ${i.pattern}`:`A\u1E63\xEC\u1E63e: ${r[i.format]??n.format}`}case"not_multiple_of":return`N\u1ECD\u0301mb\xE0 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 j\u1EB9\u0301 \xE8y\xE0 p\xEDp\xEDn ti ${n.divisor}`;case"unrecognized_keys":return`B\u1ECDt\xECn\xEC \xE0\xECm\u1ECD\u0300: ${T(n.keys,", ")}`;case"invalid_key":return`B\u1ECDt\xECn\xEC a\u1E63\xEC\u1E63e n\xEDn\xFA ${n.origin}`;case"invalid_union":return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e";case"invalid_element":return`Iye a\u1E63\xEC\u1E63e n\xEDn\xFA ${n.origin}`;default:return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e"}}};function xj(){return{localeError:QX()}}var _j,bO=Symbol("ZodOutput"),vO=Symbol("ZodInput"),hx=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){let o=r[0];return this._map.set(e,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let o={...this.get(r)??{}};delete o.id;let n={...o,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function gx(){return new hx}(_j=globalThis).__zod_globalRegistry??(_j.__zod_globalRegistry=gx());var tr=globalThis.__zod_globalRegistry;function SO(t,e){return new t({type:"string",...Z(e)})}function wO(t,e){return new t({type:"string",coerce:!0,...Z(e)})}function yx(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...Z(e)})}function Cm(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...Z(e)})}function xx(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...Z(e)})}function _x(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Z(e)})}function bx(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Z(e)})}function vx(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Z(e)})}function Rm(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...Z(e)})}function Sx(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...Z(e)})}function wx(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...Z(e)})}function Ex(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...Z(e)})}function kx(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...Z(e)})}function Ix(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...Z(e)})}function Ox(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...Z(e)})}function Cx(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...Z(e)})}function Rx(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...Z(e)})}function Ax(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...Z(e)})}function EO(t,e){return new t({type:"string",format:"mac",check:"string_format",abort:!1,...Z(e)})}function Tx(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Z(e)})}function $x(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Z(e)})}function Px(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...Z(e)})}function Nx(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...Z(e)})}function Mx(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...Z(e)})}function Dx(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...Z(e)})}var kO={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function IO(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Z(e)})}function OO(t,e){return new t({type:"string",format:"date",check:"string_format",...Z(e)})}function CO(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...Z(e)})}function RO(t,e){return new t({type:"string",format:"duration",check:"string_format",...Z(e)})}function AO(t,e){return new t({type:"number",checks:[],...Z(e)})}function TO(t,e){return new t({type:"number",coerce:!0,checks:[],...Z(e)})}function $O(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...Z(e)})}function PO(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...Z(e)})}function NO(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...Z(e)})}function MO(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...Z(e)})}function DO(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...Z(e)})}function FO(t,e){return new t({type:"boolean",...Z(e)})}function zO(t,e){return new t({type:"boolean",coerce:!0,...Z(e)})}function jO(t,e){return new t({type:"bigint",...Z(e)})}function LO(t,e){return new t({type:"bigint",coerce:!0,...Z(e)})}function UO(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...Z(e)})}function qO(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...Z(e)})}function HO(t,e){return new t({type:"symbol",...Z(e)})}function BO(t,e){return new t({type:"undefined",...Z(e)})}function WO(t,e){return new t({type:"null",...Z(e)})}function ZO(t){return new t({type:"any"})}function GO(t){return new t({type:"unknown"})}function VO(t,e){return new t({type:"never",...Z(e)})}function KO(t,e){return new t({type:"void",...Z(e)})}function JO(t,e){return new t({type:"date",...Z(e)})}function YO(t,e){return new t({type:"date",coerce:!0,...Z(e)})}function XO(t,e){return new t({type:"nan",...Z(e)})}function wo(t,e){return new tx({check:"less_than",...Z(e),value:t,inclusive:!1})}function pn(t,e){return new tx({check:"less_than",...Z(e),value:t,inclusive:!0})}function Eo(t,e){return new rx({check:"greater_than",...Z(e),value:t,inclusive:!1})}function Rr(t,e){return new rx({check:"greater_than",...Z(e),value:t,inclusive:!0})}function Fx(t){return Eo(0,t)}function zx(t){return wo(0,t)}function jx(t){return pn(0,t)}function Lx(t){return Rr(0,t)}function Cs(t,e){return new Wk({check:"multiple_of",...Z(e),value:t})}function Rs(t,e){return new Vk({check:"max_size",...Z(e),maximum:t})}function ko(t,e){return new Kk({check:"min_size",...Z(e),minimum:t})}function Qa(t,e){return new Jk({check:"size_equals",...Z(e),size:t})}function ec(t,e){return new Yk({check:"max_length",...Z(e),maximum:t})}function xi(t,e){return new Xk({check:"min_length",...Z(e),minimum:t})}function tc(t,e){return new Qk({check:"length_equals",...Z(e),length:t})}function Rl(t,e){return new eI({check:"string_format",format:"regex",...Z(e),pattern:t})}function Al(t){return new tI({check:"string_format",format:"lowercase",...Z(t)})}function Tl(t){return new rI({check:"string_format",format:"uppercase",...Z(t)})}function $l(t,e){return new nI({check:"string_format",format:"includes",...Z(e),includes:t})}function Pl(t,e){return new oI({check:"string_format",format:"starts_with",...Z(e),prefix:t})}function Nl(t,e){return new iI({check:"string_format",format:"ends_with",...Z(e),suffix:t})}function Ux(t,e,r){return new sI({check:"property",property:t,schema:e,...Z(r)})}function Ml(t,e){return new aI({check:"mime_type",mime:t,...Z(e)})}function to(t){return new cI({check:"overwrite",tx:t})}function Dl(t){return to(e=>e.normalize(t))}function Fl(){return to(t=>t.trim())}function zl(){return to(t=>t.toLowerCase())}function jl(){return to(t=>t.toUpperCase())}function Ll(){return to(t=>ok(t))}function QO(t,e,r){return new t({type:"array",element:e,...Z(r)})}function t7(t,e,r){return new t({type:"union",options:e,...Z(r)})}function r7(t,e,r){return new t({type:"union",options:e,inclusive:!1,...Z(r)})}function n7(t,e,r,o){return new t({type:"union",options:r,discriminator:e,...Z(o)})}function o7(t,e,r){return new t({type:"intersection",left:e,right:r})}function i7(t,e,r,o){let n=r instanceof Se,i=n?o:r,s=n?r:null;return new t({type:"tuple",items:e,rest:s,...Z(i)})}function s7(t,e,r,o){return new t({type:"record",keyType:e,valueType:r,...Z(o)})}function a7(t,e,r,o){return new t({type:"map",keyType:e,valueType:r,...Z(o)})}function c7(t,e,r){return new t({type:"set",valueType:e,...Z(r)})}function u7(t,e,r){let o=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new t({type:"enum",entries:o,...Z(r)})}function l7(t,e,r){return new t({type:"enum",entries:e,...Z(r)})}function p7(t,e,r){return new t({type:"literal",values:Array.isArray(e)?e:[e],...Z(r)})}function eC(t,e){return new t({type:"file",...Z(e)})}function d7(t,e){return new t({type:"transform",transform:e})}function f7(t,e){return new t({type:"optional",innerType:e})}function m7(t,e){return new t({type:"nullable",innerType:e})}function h7(t,e,r){return new t({type:"default",innerType:e,get defaultValue(){return typeof r=="function"?r():sk(r)}})}function g7(t,e,r){return new t({type:"nonoptional",innerType:e,...Z(r)})}function y7(t,e){return new t({type:"success",innerType:e})}function x7(t,e,r){return new t({type:"catch",innerType:e,catchValue:typeof r=="function"?r:()=>r})}function _7(t,e,r){return new t({type:"pipe",in:e,out:r})}function b7(t,e){return new t({type:"readonly",innerType:e})}function v7(t,e,r){return new t({type:"template_literal",parts:e,...Z(r)})}function S7(t,e){return new t({type:"lazy",getter:e})}function w7(t,e){return new t({type:"promise",innerType:e})}function tC(t,e,r){let o=Z(r);return o.abort??(o.abort=!0),new t({type:"custom",check:"custom",fn:e,...o})}function rC(t,e,r){return new t({type:"custom",check:"custom",fn:e,...Z(r)})}function nC(t,e){let r=bj(o=>(o.addIssue=n=>{if(typeof n=="string")o.issues.push(Sl(n,o.value,r._zod.def));else{let i=n;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=o.value),i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),o.issues.push(Sl(i))}},t(o.value,o)),e);return r}function bj(t,e){let r=new ot({check:"custom",...Z(e)});return r._zod.check=t,r}function oC(t){let e=new ot({check:"describe"});return e._zod.onattach=[r=>{let o=tr.get(r)??{};tr.add(r,{...o,description:t})}],e._zod.check=()=>{},e}function iC(t){let e=new ot({check:"meta"});return e._zod.onattach=[r=>{let o=tr.get(r)??{};tr.add(r,{...o,...t})}],e._zod.check=()=>{},e}function sC(t,e){let r=Z(e),o=r.truthy??["true","1","yes","on","y","enabled"],n=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(o=o.map(d=>typeof d=="string"?d.toLowerCase():d),n=n.map(d=>typeof d=="string"?d.toLowerCase():d));let i=new Set(o),s=new Set(n),a=t.Codec??km,c=t.Boolean??wm,u=t.String??Xa,l=new u({type:"string",error:r.error}),p=new c({type:"boolean",error:r.error}),f=new a({type:"pipe",in:l,out:p,transform:((d,m)=>{let g=d;return r.case!=="sensitive"&&(g=g.toLowerCase()),i.has(g)?!0:s.has(g)?!1:(m.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...s],input:m.value,inst:f,continue:!1}),{})}),reverseTransform:((d,m)=>d===!0?o[0]||"true":n[0]||"false"),error:r.error});return f}function Ul(t,e,r,o={}){let n=Z(o),i={...Z(o),check:"string_format",type:"string",format:e,fn:typeof r=="function"?r:a=>r.test(a),...n};return r instanceof RegExp&&(i.pattern=r),new t(i)}function As(t){let e=t?.target??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:t.processors??{},metadataRegistry:t?.metadata??tr,target:e,unrepresentable:t?.unrepresentable??"throw",override:t?.override??(()=>{}),io:t?.io??"output",counter:0,seen:new Map,cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0}}function Ke(t,e,r={path:[],schemaPath:[]}){var o;let n=t._zod.def,i=e.seen.get(t);if(i)return i.count++,r.schemaPath.includes(t)&&(i.cycle=r.path),i.schema;let s={schema:{},count:1,cycle:void 0,path:r.path};e.seen.set(t,s);let a=t._zod.toJSONSchema?.();if(a)s.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,t],path:r.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,s.schema,l);else{let f=s.schema,d=e.processors[n.type];if(!d)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);d(t,e,f,l)}let p=t._zod.parent;p&&(s.ref||(s.ref=p),Ke(p,e,l),e.seen.get(p).isParent=!0)}let c=e.metadataRegistry.get(t);return c&&Object.assign(s.schema,c),e.io==="input"&&Ar(t)&&(delete s.schema.examples,delete s.schema.default),e.io==="input"&&"_prefault"in s.schema&&((o=s.schema).default??(o.default=s.schema._prefault)),delete s.schema._prefault,e.seen.get(t).schema}function Ts(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=new Map;for(let s of t.seen.entries()){let a=t.metadataRegistry.get(s[0])?.id;if(a){let c=o.get(a);if(c&&c!==s[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(a,s[0])}}let n=s=>{let a=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){let p=t.external.registry.get(s[0])?.id,f=t.external.uri??(m=>m);if(p)return{ref:f(p)};let d=s[1].defId??s[1].schema.id??`schema${t.counter++}`;return s[1].defId=d,{defId:d,ref:`${f("__shared")}#/${a}/${d}`}}if(s[1]===r)return{ref:"#"};let u=`#/${a}/`,l=s[1].schema.id??`__schema${t.counter++}`;return{defId:l,ref:u+l}},i=s=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:u}=n(s);a.def={...a.schema},u&&(a.defId=u);let l=a.schema;for(let p in l)delete l[p];l.$ref=c};if(t.cycles==="throw")for(let s of t.seen.entries()){let a=s[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
82
|
+
|
|
83
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of t.seen.entries()){let a=s[1];if(e===s[0]){i(s);continue}if(t.external){let u=t.external.registry.get(s[0])?.id;if(e!==s[0]&&u){i(s);continue}}if(t.metadataRegistry.get(s[0])?.id){i(s);continue}if(a.cycle){i(s);continue}if(a.count>1&&t.reused==="ref"){i(s);continue}}}function $s(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=a=>{let c=t.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},p=c.ref;if(c.ref=null,p){o(p);let d=t.seen.get(p),m=d.schema;if(m.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(m)):Object.assign(u,m),Object.assign(u,l),a._zod.parent===p)for(let y in u)y==="$ref"||y==="allOf"||y in l||delete u[y];if(m.$ref&&d.def)for(let y in u)y==="$ref"||y==="allOf"||y in d.def&&JSON.stringify(u[y])===JSON.stringify(d.def[y])&&delete u[y]}let f=a._zod.parent;if(f&&f!==p){o(f);let d=t.seen.get(f);if(d?.schema.$ref&&(u.$ref=d.schema.$ref,d.def))for(let m in u)m==="$ref"||m==="allOf"||m in d.def&&JSON.stringify(u[m])===JSON.stringify(d.def[m])&&delete u[m]}t.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};for(let a of[...t.seen.entries()].reverse())o(a[0]);let n={};if(t.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?n.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){let a=t.external.registry.get(e)?.id;if(!a)throw new Error("Schema is missing an `id` property");n.$id=t.external.uri(a)}Object.assign(n,r.def??r.schema);let i=t.metadataRegistry.get(e)?.id;i!==void 0&&n.id===i&&delete n.id;let s=t.external?.defs??{};for(let a of t.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,s[c.defId]=c.def)}t.external||Object.keys(s).length>0&&(t.target==="draft-2020-12"?n.$defs=s:n.definitions=s);try{let a=JSON.parse(JSON.stringify(n));return Object.defineProperty(a,"~standard",{value:{...e["~standard"],jsonSchema:{input:ql(e,"input",t.processors),output:ql(e,"output",t.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Ar(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let o=t._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return Ar(o.element,r);if(o.type==="set")return Ar(o.valueType,r);if(o.type==="lazy")return Ar(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return Ar(o.innerType,r);if(o.type==="intersection")return Ar(o.left,r)||Ar(o.right,r);if(o.type==="record"||o.type==="map")return Ar(o.keyType,r)||Ar(o.valueType,r);if(o.type==="pipe")return t._zod.traits.has("$ZodCodec")?!0:Ar(o.in,r)||Ar(o.out,r);if(o.type==="object"){for(let n in o.shape)if(Ar(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(Ar(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(Ar(n,r))return!0;return!!(o.rest&&Ar(o.rest,r))}return!1}var aC=(t,e={})=>r=>{let o=As({...r,processors:e});return Ke(t,o),Ts(o,t),$s(o,t)},ql=(t,e,r={})=>o=>{let{libraryOptions:n,target:i}=o??{},s=As({...n??{},target:i,io:e,processors:r});return Ke(t,s),Ts(s,t),$s(s,t)};var E7={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},cC=(t,e,r,o)=>{let n=r;n.type="string";let{minimum:i,maximum:s,format:a,patterns:c,contentEncoding:u}=t._zod.bag;if(typeof i=="number"&&(n.minLength=i),typeof s=="number"&&(n.maxLength=s),a&&(n.format=E7[a]??a,n.format===""&&delete n.format,a==="time"&&delete n.format),u&&(n.contentEncoding=u),c&&c.size>0){let l=[...c];l.length===1?n.pattern=l[0].source:l.length>1&&(n.allOf=[...l.map(p=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},uC=(t,e,r,o)=>{let n=r,{minimum:i,maximum:s,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=t._zod.bag;typeof a=="string"&&a.includes("int")?n.type="integer":n.type="number";let p=typeof l=="number"&&l>=(i??Number.NEGATIVE_INFINITY),f=typeof u=="number"&&u<=(s??Number.POSITIVE_INFINITY),d=e.target==="draft-04"||e.target==="openapi-3.0";p?d?(n.minimum=l,n.exclusiveMinimum=!0):n.exclusiveMinimum=l:typeof i=="number"&&(n.minimum=i),f?d?(n.maximum=u,n.exclusiveMaximum=!0):n.exclusiveMaximum=u:typeof s=="number"&&(n.maximum=s),typeof c=="number"&&(n.multipleOf=c)},lC=(t,e,r,o)=>{r.type="boolean"},pC=(t,e,r,o)=>{if(e.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},dC=(t,e,r,o)=>{if(e.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},fC=(t,e,r,o)=>{e.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},mC=(t,e,r,o)=>{if(e.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},hC=(t,e,r,o)=>{if(e.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},gC=(t,e,r,o)=>{r.not={}},yC=(t,e,r,o)=>{},xC=(t,e,r,o)=>{},_C=(t,e,r,o)=>{if(e.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},bC=(t,e,r,o)=>{let n=t._zod.def,i=dm(n.entries);i.every(s=>typeof s=="number")&&(r.type="number"),i.every(s=>typeof s=="string")&&(r.type="string"),r.enum=i},vC=(t,e,r,o)=>{let n=t._zod.def,i=[];for(let s of n.values)if(s===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof s=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(s))}else i.push(s);if(i.length!==0)if(i.length===1){let s=i[0];r.type=s===null?"null":typeof s,e.target==="draft-04"||e.target==="openapi-3.0"?r.enum=[s]:r.const=s}else i.every(s=>typeof s=="number")&&(r.type="number"),i.every(s=>typeof s=="string")&&(r.type="string"),i.every(s=>typeof s=="boolean")&&(r.type="boolean"),i.every(s=>s===null)&&(r.type="null"),r.enum=i},SC=(t,e,r,o)=>{if(e.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},wC=(t,e,r,o)=>{let n=r,i=t._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");n.type="string",n.pattern=i.source},EC=(t,e,r,o)=>{let n=r,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:s,maximum:a,mime:c}=t._zod.bag;s!==void 0&&(i.minLength=s),a!==void 0&&(i.maxLength=a),c?c.length===1?(i.contentMediaType=c[0],Object.assign(n,i)):(Object.assign(n,i),n.anyOf=c.map(u=>({contentMediaType:u}))):Object.assign(n,i)},kC=(t,e,r,o)=>{r.type="boolean"},IC=(t,e,r,o)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},OC=(t,e,r,o)=>{if(e.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},CC=(t,e,r,o)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},RC=(t,e,r,o)=>{if(e.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},AC=(t,e,r,o)=>{if(e.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},TC=(t,e,r,o)=>{let n=r,i=t._zod.def,{minimum:s,maximum:a}=t._zod.bag;typeof s=="number"&&(n.minItems=s),typeof a=="number"&&(n.maxItems=a),n.type="array",n.items=Ke(i.element,e,{...o,path:[...o.path,"items"]})},$C=(t,e,r,o)=>{let n=r,i=t._zod.def;n.type="object",n.properties={};let s=i.shape;for(let u in s)n.properties[u]=Ke(s[u],e,{...o,path:[...o.path,"properties",u]});let a=new Set(Object.keys(s)),c=new Set([...a].filter(u=>{let l=i.shape[u]._zod;return e.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(n.required=Array.from(c)),i.catchall?._zod.def.type==="never"?n.additionalProperties=!1:i.catchall?i.catchall&&(n.additionalProperties=Ke(i.catchall,e,{...o,path:[...o.path,"additionalProperties"]})):e.io==="output"&&(n.additionalProperties=!1)},Hx=(t,e,r,o)=>{let n=t._zod.def,i=n.inclusive===!1,s=n.options.map((a,c)=>Ke(a,e,{...o,path:[...o.path,i?"oneOf":"anyOf",c]}));i?r.oneOf=s:r.anyOf=s},PC=(t,e,r,o)=>{let n=t._zod.def,i=Ke(n.left,e,{...o,path:[...o.path,"allOf",0]}),s=Ke(n.right,e,{...o,path:[...o.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];r.allOf=c},NC=(t,e,r,o)=>{let n=r,i=t._zod.def;n.type="array";let s=e.target==="draft-2020-12"?"prefixItems":"items",a=e.target==="draft-2020-12"||e.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((f,d)=>Ke(f,e,{...o,path:[...o.path,s,d]})),u=i.rest?Ke(i.rest,e,{...o,path:[...o.path,a,...e.target==="openapi-3.0"?[i.items.length]:[]]}):null;e.target==="draft-2020-12"?(n.prefixItems=c,u&&(n.items=u)):e.target==="openapi-3.0"?(n.items={anyOf:c},u&&n.items.anyOf.push(u),n.minItems=c.length,u||(n.maxItems=c.length)):(n.items=c,u&&(n.additionalItems=u));let{minimum:l,maximum:p}=t._zod.bag;typeof l=="number"&&(n.minItems=l),typeof p=="number"&&(n.maxItems=p)},MC=(t,e,r,o)=>{let n=r,i=t._zod.def;n.type="object";let s=i.keyType,c=s._zod.bag?.patterns;if(i.mode==="loose"&&c&&c.size>0){let l=Ke(i.valueType,e,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let p of c)n.patternProperties[p.source]=l}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(n.propertyNames=Ke(i.keyType,e,{...o,path:[...o.path,"propertyNames"]})),n.additionalProperties=Ke(i.valueType,e,{...o,path:[...o.path,"additionalProperties"]});let u=s._zod.values;if(u){let l=[...u].filter(p=>typeof p=="string"||typeof p=="number");l.length>0&&(n.required=l)}},DC=(t,e,r,o)=>{let n=t._zod.def,i=Ke(n.innerType,e,o),s=e.seen.get(t);e.target==="openapi-3.0"?(s.ref=n.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},FC=(t,e,r,o)=>{let n=t._zod.def;Ke(n.innerType,e,o);let i=e.seen.get(t);i.ref=n.innerType},zC=(t,e,r,o)=>{let n=t._zod.def;Ke(n.innerType,e,o);let i=e.seen.get(t);i.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},jC=(t,e,r,o)=>{let n=t._zod.def;Ke(n.innerType,e,o);let i=e.seen.get(t);i.ref=n.innerType,e.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(n.defaultValue)))},LC=(t,e,r,o)=>{let n=t._zod.def;Ke(n.innerType,e,o);let i=e.seen.get(t);i.ref=n.innerType;let s;try{s=n.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=s},UC=(t,e,r,o)=>{let n=t._zod.def,i=n.in._zod.traits.has("$ZodTransform"),s=e.io==="input"?i?n.out:n.in:n.out;Ke(s,e,o);let a=e.seen.get(t);a.ref=s},qC=(t,e,r,o)=>{let n=t._zod.def;Ke(n.innerType,e,o);let i=e.seen.get(t);i.ref=n.innerType,r.readOnly=!0},HC=(t,e,r,o)=>{let n=t._zod.def;Ke(n.innerType,e,o);let i=e.seen.get(t);i.ref=n.innerType},Bx=(t,e,r,o)=>{let n=t._zod.def;Ke(n.innerType,e,o);let i=e.seen.get(t);i.ref=n.innerType},BC=(t,e,r,o)=>{let n=t._zod.innerType;Ke(n,e,o);let i=e.seen.get(t);i.ref=n},qx={string:cC,number:uC,boolean:lC,bigint:pC,symbol:dC,null:fC,undefined:mC,void:hC,never:gC,any:yC,unknown:xC,date:_C,enum:bC,literal:vC,nan:SC,template_literal:wC,file:EC,success:kC,custom:IC,function:OC,transform:CC,map:RC,set:AC,array:TC,object:$C,union:Hx,intersection:PC,tuple:NC,record:MC,nullable:DC,nonoptional:FC,default:zC,prefault:jC,catch:LC,pipe:UC,readonly:qC,promise:HC,optional:Bx,lazy:BC};function Wx(t,e){if("_idmap"in t){let o=t,n=As({...e,processors:qx}),i={};for(let c of o._idmap.entries()){let[u,l]=c;Ke(l,n)}let s={},a={registry:o,uri:e?.uri,defs:i};n.external=a;for(let c of o._idmap.entries()){let[u,l]=c;Ts(n,l),s[u]=$s(n,l)}if(Object.keys(i).length>0){let c=n.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:i}}return{schemas:s}}let r=As({...e,processors:qx});return Ke(t,r),Ts(r,t),$s(r,t)}var Zx=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(e){this.ctx.counter=e}get seen(){return this.ctx.seen}constructor(e){let r=e?.target??"draft-2020-12";r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),this.ctx=As({processors:qx,target:r,...e?.metadata&&{metadata:e.metadata},...e?.unrepresentable&&{unrepresentable:e.unrepresentable},...e?.override&&{override:e.override},...e?.io&&{io:e.io}})}process(e,r={path:[],schemaPath:[]}){return Ke(e,this.ctx,r)}emit(e,r){r&&(r.cycles&&(this.ctx.cycles=r.cycles),r.reused&&(this.ctx.reused=r.reused),r.external&&(this.ctx.external=r.external)),Ts(this.ctx,e);let o=$s(this.ctx,e),{"~standard":n,...i}=o;return i}};var vj={};var Am={};an(Am,{ZodAny:()=>mR,ZodArray:()=>xR,ZodBase64:()=>f_,ZodBase64URL:()=>m_,ZodBigInt:()=>Jl,ZodBigIntFormat:()=>y_,ZodBoolean:()=>Kl,ZodCIDRv4:()=>p_,ZodCIDRv6:()=>d_,ZodCUID:()=>o_,ZodCUID2:()=>i_,ZodCatch:()=>LR,ZodCodec:()=>qm,ZodCustom:()=>Hm,ZodCustomStringFormat:()=>Gl,ZodDate:()=>Fm,ZodDefault:()=>NR,ZodDiscriminatedUnion:()=>bR,ZodE164:()=>h_,ZodEmail:()=>t_,ZodEmoji:()=>r_,ZodEnum:()=>Wl,ZodExactOptional:()=>TR,ZodFile:()=>RR,ZodFunction:()=>JR,ZodGUID:()=>$m,ZodIPv4:()=>u_,ZodIPv6:()=>l_,ZodIntersection:()=>vR,ZodJWT:()=>g_,ZodKSUID:()=>c_,ZodLazy:()=>GR,ZodLiteral:()=>CR,ZodMAC:()=>aR,ZodMap:()=>IR,ZodNaN:()=>qR,ZodNanoID:()=>n_,ZodNever:()=>gR,ZodNonOptional:()=>w_,ZodNull:()=>dR,ZodNullable:()=>PR,ZodNumber:()=>Vl,ZodNumberFormat:()=>nc,ZodObject:()=>jm,ZodOptional:()=>S_,ZodPipe:()=>Um,ZodPrefault:()=>DR,ZodPreprocess:()=>HR,ZodPromise:()=>KR,ZodReadonly:()=>BR,ZodRecord:()=>Bl,ZodSet:()=>OR,ZodString:()=>Zl,ZodStringFormat:()=>Xe,ZodSuccess:()=>jR,ZodSymbol:()=>lR,ZodTemplateLiteral:()=>ZR,ZodTransform:()=>AR,ZodTuple:()=>wR,ZodType:()=>Ie,ZodULID:()=>s_,ZodURL:()=>Dm,ZodUUID:()=>Io,ZodUndefined:()=>pR,ZodUnion:()=>Lm,ZodUnknown:()=>hR,ZodVoid:()=>yR,ZodXID:()=>a_,ZodXor:()=>_R,_ZodString:()=>e_,_default:()=>MR,_function:()=>AL,any:()=>aL,array:()=>zm,base64:()=>Bj,base64url:()=>Wj,bigint:()=>rL,boolean:()=>uR,catch:()=>UR,check:()=>TL,cidrv4:()=>qj,cidrv6:()=>Hj,codec:()=>IL,cuid:()=>Nj,cuid2:()=>Mj,custom:()=>$L,date:()=>uL,describe:()=>PL,discriminatedUnion:()=>hL,e164:()=>Zj,email:()=>Ej,emoji:()=>$j,enum:()=>b_,exactOptional:()=>$R,file:()=>SL,float32:()=>Xj,float64:()=>Qj,function:()=>AL,guid:()=>kj,hash:()=>Yj,hex:()=>Jj,hostname:()=>Kj,httpUrl:()=>Tj,instanceof:()=>ML,int:()=>Xx,int32:()=>eL,int64:()=>nL,intersection:()=>SR,invertCodec:()=>OL,ipv4:()=>jj,ipv6:()=>Uj,json:()=>FL,jwt:()=>Gj,keyof:()=>lL,ksuid:()=>zj,lazy:()=>VR,literal:()=>vL,looseObject:()=>fL,looseRecord:()=>yL,mac:()=>Lj,map:()=>xL,meta:()=>NL,nan:()=>kL,nanoid:()=>Pj,nativeEnum:()=>bL,never:()=>x_,nonoptional:()=>zR,null:()=>fR,nullable:()=>Nm,nullish:()=>wL,number:()=>cR,object:()=>pL,optional:()=>Pm,partialRecord:()=>gL,pipe:()=>Qx,prefault:()=>FR,preprocess:()=>zL,promise:()=>RL,readonly:()=>WR,record:()=>kR,refine:()=>YR,set:()=>_L,strictObject:()=>dL,string:()=>Tm,stringFormat:()=>Vj,stringbool:()=>DL,success:()=>EL,superRefine:()=>XR,symbol:()=>iL,templateLiteral:()=>CL,transform:()=>v_,tuple:()=>ER,uint32:()=>tL,uint64:()=>oL,ulid:()=>Dj,undefined:()=>sL,union:()=>__,unknown:()=>rc,url:()=>Aj,uuid:()=>Ij,uuidv4:()=>Oj,uuidv6:()=>Cj,uuidv7:()=>Rj,void:()=>cL,xid:()=>Fj,xor:()=>mL});var Gx={};an(Gx,{endsWith:()=>Nl,gt:()=>Eo,gte:()=>Rr,includes:()=>$l,length:()=>tc,lowercase:()=>Al,lt:()=>wo,lte:()=>pn,maxLength:()=>ec,maxSize:()=>Rs,mime:()=>Ml,minLength:()=>xi,minSize:()=>ko,multipleOf:()=>Cs,negative:()=>zx,nonnegative:()=>Lx,nonpositive:()=>jx,normalize:()=>Dl,overwrite:()=>to,positive:()=>Fx,property:()=>Ux,regex:()=>Rl,size:()=>Qa,slugify:()=>Ll,startsWith:()=>Pl,toLowerCase:()=>zl,toUpperCase:()=>jl,trim:()=>Fl,uppercase:()=>Tl});var Hl={};an(Hl,{ZodISODate:()=>Kx,ZodISODateTime:()=>Vx,ZodISODuration:()=>Yx,ZodISOTime:()=>Jx,date:()=>ZC,datetime:()=>WC,duration:()=>VC,time:()=>GC});var Vx=I("ZodISODateTime",(t,e)=>{SI.init(t,e),Xe.init(t,e)});function WC(t){return IO(Vx,t)}var Kx=I("ZodISODate",(t,e)=>{wI.init(t,e),Xe.init(t,e)});function ZC(t){return OO(Kx,t)}var Jx=I("ZodISOTime",(t,e)=>{EI.init(t,e),Xe.init(t,e)});function GC(t){return CO(Jx,t)}var Yx=I("ZodISODuration",(t,e)=>{kI.init(t,e),Xe.init(t,e)});function VC(t){return RO(Yx,t)}var Sj=(t,e)=>{ym.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>_m(t,r)},flatten:{value:r=>xm(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,bl,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,bl,2)}},isEmpty:{get(){return t.issues.length===0}}})},I7=I("ZodError",Sj),Br=I("ZodError",Sj,{Parent:Error});var KC=wl(Br),JC=El(Br),YC=kl(Br),XC=Il(Br),QC=Wy(Br),eR=Zy(Br),tR=Gy(Br),rR=Vy(Br),nR=Ky(Br),oR=Jy(Br),iR=Yy(Br),sR=Xy(Br);var wj=new WeakMap;function Mm(t,e,r){let o=Object.getPrototypeOf(t),n=wj.get(o);if(n||(n=new Set,wj.set(o,n)),!n.has(e)){n.add(e);for(let i in r){let s=r[i];Object.defineProperty(o,i,{configurable:!0,enumerable:!1,get(){let a=s.bind(this);return Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}var Ie=I("ZodType",(t,e)=>(Se.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:ql(t,"input"),output:ql(t,"output")}}),t.toJSONSchema=aC(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.parse=(r,o)=>KC(t,r,o,{callee:t.parse}),t.safeParse=(r,o)=>YC(t,r,o),t.parseAsync=async(r,o)=>JC(t,r,o,{callee:t.parseAsync}),t.safeParseAsync=async(r,o)=>XC(t,r,o),t.spa=t.safeParseAsync,t.encode=(r,o)=>QC(t,r,o),t.decode=(r,o)=>eR(t,r,o),t.encodeAsync=async(r,o)=>tR(t,r,o),t.decodeAsync=async(r,o)=>rR(t,r,o),t.safeEncode=(r,o)=>nR(t,r,o),t.safeDecode=(r,o)=>oR(t,r,o),t.safeEncodeAsync=async(r,o)=>iR(t,r,o),t.safeDecodeAsync=async(r,o)=>sR(t,r,o),Mm(t,"ZodType",{check(...r){let o=this.def;return this.clone(U.mergeDefs(o,{checks:[...o.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,o){return Or(this,r,o)},brand(){return this},register(r,o){return r.add(this,o),this},refine(r,o){return this.check(YR(r,o))},superRefine(r,o){return this.check(XR(r,o))},overwrite(r){return this.check(to(r))},optional(){return Pm(this)},exactOptional(){return $R(this)},nullable(){return Nm(this)},nullish(){return Pm(Nm(this))},nonoptional(r){return zR(this,r)},array(){return zm(this)},or(r){return __([this,r])},and(r){return SR(this,r)},transform(r){return Qx(this,v_(r))},default(r){return MR(this,r)},prefault(r){return FR(this,r)},catch(r){return UR(this,r)},pipe(r){return Qx(this,r)},readonly(){return WR(this)},describe(r){let o=this.clone();return tr.add(o,{description:r}),o},meta(...r){if(r.length===0)return tr.get(this);let o=this.clone();return tr.add(o,r[0]),o},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(t,"description",{get(){return tr.get(t)?.description},configurable:!0}),t)),e_=I("_ZodString",(t,e)=>{Xa.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(o,n,i)=>cC(t,o,n,i);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,Mm(t,"_ZodString",{regex(...o){return this.check(Rl(...o))},includes(...o){return this.check($l(...o))},startsWith(...o){return this.check(Pl(...o))},endsWith(...o){return this.check(Nl(...o))},min(...o){return this.check(xi(...o))},max(...o){return this.check(ec(...o))},length(...o){return this.check(tc(...o))},nonempty(...o){return this.check(xi(1,...o))},lowercase(o){return this.check(Al(o))},uppercase(o){return this.check(Tl(o))},trim(){return this.check(Fl())},normalize(...o){return this.check(Dl(...o))},toLowerCase(){return this.check(zl())},toUpperCase(){return this.check(jl())},slugify(){return this.check(Ll())}})}),Zl=I("ZodString",(t,e)=>{Xa.init(t,e),e_.init(t,e),t.email=r=>t.check(yx(t_,r)),t.url=r=>t.check(Rm(Dm,r)),t.jwt=r=>t.check(Dx(g_,r)),t.emoji=r=>t.check(Sx(r_,r)),t.guid=r=>t.check(Cm($m,r)),t.uuid=r=>t.check(xx(Io,r)),t.uuidv4=r=>t.check(_x(Io,r)),t.uuidv6=r=>t.check(bx(Io,r)),t.uuidv7=r=>t.check(vx(Io,r)),t.nanoid=r=>t.check(wx(n_,r)),t.guid=r=>t.check(Cm($m,r)),t.cuid=r=>t.check(Ex(o_,r)),t.cuid2=r=>t.check(kx(i_,r)),t.ulid=r=>t.check(Ix(s_,r)),t.base64=r=>t.check(Px(f_,r)),t.base64url=r=>t.check(Nx(m_,r)),t.xid=r=>t.check(Ox(a_,r)),t.ksuid=r=>t.check(Cx(c_,r)),t.ipv4=r=>t.check(Rx(u_,r)),t.ipv6=r=>t.check(Ax(l_,r)),t.cidrv4=r=>t.check(Tx(p_,r)),t.cidrv6=r=>t.check($x(d_,r)),t.e164=r=>t.check(Mx(h_,r)),t.datetime=r=>t.check(WC(r)),t.date=r=>t.check(ZC(r)),t.time=r=>t.check(GC(r)),t.duration=r=>t.check(VC(r))});function Tm(t){return SO(Zl,t)}var Xe=I("ZodStringFormat",(t,e)=>{Ye.init(t,e),e_.init(t,e)}),t_=I("ZodEmail",(t,e)=>{fI.init(t,e),Xe.init(t,e)});function Ej(t){return yx(t_,t)}var $m=I("ZodGUID",(t,e)=>{pI.init(t,e),Xe.init(t,e)});function kj(t){return Cm($m,t)}var Io=I("ZodUUID",(t,e)=>{dI.init(t,e),Xe.init(t,e)});function Ij(t){return xx(Io,t)}function Oj(t){return _x(Io,t)}function Cj(t){return bx(Io,t)}function Rj(t){return vx(Io,t)}var Dm=I("ZodURL",(t,e)=>{mI.init(t,e),Xe.init(t,e)});function Aj(t){return Rm(Dm,t)}function Tj(t){return Rm(Dm,{protocol:ln.httpProtocol,hostname:ln.domain,...U.normalizeParams(t)})}var r_=I("ZodEmoji",(t,e)=>{hI.init(t,e),Xe.init(t,e)});function $j(t){return Sx(r_,t)}var n_=I("ZodNanoID",(t,e)=>{gI.init(t,e),Xe.init(t,e)});function Pj(t){return wx(n_,t)}var o_=I("ZodCUID",(t,e)=>{yI.init(t,e),Xe.init(t,e)});function Nj(t){return Ex(o_,t)}var i_=I("ZodCUID2",(t,e)=>{xI.init(t,e),Xe.init(t,e)});function Mj(t){return kx(i_,t)}var s_=I("ZodULID",(t,e)=>{_I.init(t,e),Xe.init(t,e)});function Dj(t){return Ix(s_,t)}var a_=I("ZodXID",(t,e)=>{bI.init(t,e),Xe.init(t,e)});function Fj(t){return Ox(a_,t)}var c_=I("ZodKSUID",(t,e)=>{vI.init(t,e),Xe.init(t,e)});function zj(t){return Cx(c_,t)}var u_=I("ZodIPv4",(t,e)=>{II.init(t,e),Xe.init(t,e)});function jj(t){return Rx(u_,t)}var aR=I("ZodMAC",(t,e)=>{CI.init(t,e),Xe.init(t,e)});function Lj(t){return EO(aR,t)}var l_=I("ZodIPv6",(t,e)=>{OI.init(t,e),Xe.init(t,e)});function Uj(t){return Ax(l_,t)}var p_=I("ZodCIDRv4",(t,e)=>{RI.init(t,e),Xe.init(t,e)});function qj(t){return Tx(p_,t)}var d_=I("ZodCIDRv6",(t,e)=>{AI.init(t,e),Xe.init(t,e)});function Hj(t){return $x(d_,t)}var f_=I("ZodBase64",(t,e)=>{$I.init(t,e),Xe.init(t,e)});function Bj(t){return Px(f_,t)}var m_=I("ZodBase64URL",(t,e)=>{PI.init(t,e),Xe.init(t,e)});function Wj(t){return Nx(m_,t)}var h_=I("ZodE164",(t,e)=>{NI.init(t,e),Xe.init(t,e)});function Zj(t){return Mx(h_,t)}var g_=I("ZodJWT",(t,e)=>{MI.init(t,e),Xe.init(t,e)});function Gj(t){return Dx(g_,t)}var Gl=I("ZodCustomStringFormat",(t,e)=>{DI.init(t,e),Xe.init(t,e)});function Vj(t,e,r={}){return Ul(Gl,t,e,r)}function Kj(t){return Ul(Gl,"hostname",ln.hostname,t)}function Jj(t){return Ul(Gl,"hex",ln.hex,t)}function Yj(t,e){let r=e?.enc??"hex",o=`${t}_${r}`,n=ln[o];if(!n)throw new Error(`Unrecognized hash format: ${o}`);return Ul(Gl,o,n,e)}var Vl=I("ZodNumber",(t,e)=>{ax.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(o,n,i)=>uC(t,o,n,i),Mm(t,"ZodNumber",{gt(o,n){return this.check(Eo(o,n))},gte(o,n){return this.check(Rr(o,n))},min(o,n){return this.check(Rr(o,n))},lt(o,n){return this.check(wo(o,n))},lte(o,n){return this.check(pn(o,n))},max(o,n){return this.check(pn(o,n))},int(o){return this.check(Xx(o))},safe(o){return this.check(Xx(o))},positive(o){return this.check(Eo(0,o))},nonnegative(o){return this.check(Rr(0,o))},negative(o){return this.check(wo(0,o))},nonpositive(o){return this.check(pn(0,o))},multipleOf(o,n){return this.check(Cs(o,n))},step(o,n){return this.check(Cs(o,n))},finite(){return this}});let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function cR(t){return AO(Vl,t)}var nc=I("ZodNumberFormat",(t,e)=>{FI.init(t,e),Vl.init(t,e)});function Xx(t){return $O(nc,t)}function Xj(t){return PO(nc,t)}function Qj(t){return NO(nc,t)}function eL(t){return MO(nc,t)}function tL(t){return DO(nc,t)}var Kl=I("ZodBoolean",(t,e)=>{wm.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,o,n)=>lC(t,r,o,n)});function uR(t){return FO(Kl,t)}var Jl=I("ZodBigInt",(t,e)=>{cx.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(o,n,i)=>pC(t,o,n,i),t.gte=(o,n)=>t.check(Rr(o,n)),t.min=(o,n)=>t.check(Rr(o,n)),t.gt=(o,n)=>t.check(Eo(o,n)),t.gte=(o,n)=>t.check(Rr(o,n)),t.min=(o,n)=>t.check(Rr(o,n)),t.lt=(o,n)=>t.check(wo(o,n)),t.lte=(o,n)=>t.check(pn(o,n)),t.max=(o,n)=>t.check(pn(o,n)),t.positive=o=>t.check(Eo(BigInt(0),o)),t.negative=o=>t.check(wo(BigInt(0),o)),t.nonpositive=o=>t.check(pn(BigInt(0),o)),t.nonnegative=o=>t.check(Rr(BigInt(0),o)),t.multipleOf=(o,n)=>t.check(Cs(o,n));let r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});function rL(t){return jO(Jl,t)}var y_=I("ZodBigIntFormat",(t,e)=>{zI.init(t,e),Jl.init(t,e)});function nL(t){return UO(y_,t)}function oL(t){return qO(y_,t)}var lR=I("ZodSymbol",(t,e)=>{jI.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,o,n)=>dC(t,r,o,n)});function iL(t){return HO(lR,t)}var pR=I("ZodUndefined",(t,e)=>{LI.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,o,n)=>mC(t,r,o,n)});function sL(t){return BO(pR,t)}var dR=I("ZodNull",(t,e)=>{UI.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,o,n)=>fC(t,r,o,n)});function fR(t){return WO(dR,t)}var mR=I("ZodAny",(t,e)=>{qI.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,o,n)=>yC(t,r,o,n)});function aL(){return ZO(mR)}var hR=I("ZodUnknown",(t,e)=>{HI.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,o,n)=>xC(t,r,o,n)});function rc(){return GO(hR)}var gR=I("ZodNever",(t,e)=>{BI.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,o,n)=>gC(t,r,o,n)});function x_(t){return VO(gR,t)}var yR=I("ZodVoid",(t,e)=>{WI.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,o,n)=>hC(t,r,o,n)});function cL(t){return KO(yR,t)}var Fm=I("ZodDate",(t,e)=>{ZI.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(o,n,i)=>_C(t,o,n,i),t.min=(o,n)=>t.check(Rr(o,n)),t.max=(o,n)=>t.check(pn(o,n));let r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});function uL(t){return JO(Fm,t)}var xR=I("ZodArray",(t,e)=>{GI.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,o,n)=>TC(t,r,o,n),t.element=e.element,Mm(t,"ZodArray",{min(r,o){return this.check(xi(r,o))},nonempty(r){return this.check(xi(1,r))},max(r,o){return this.check(ec(r,o))},length(r,o){return this.check(tc(r,o))},unwrap(){return this.element}})});function zm(t,e){return QO(xR,t,e)}function lL(t){let e=t._zod.def.shape;return b_(Object.keys(e))}var jm=I("ZodObject",(t,e)=>{VI.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,o,n)=>$C(t,r,o,n),U.defineLazy(t,"shape",()=>e.shape),Mm(t,"ZodObject",{keyof(){return b_(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:rc()})},loose(){return this.clone({...this._zod.def,catchall:rc()})},strict(){return this.clone({...this._zod.def,catchall:x_()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return U.extend(this,r)},safeExtend(r){return U.safeExtend(this,r)},merge(r){return U.merge(this,r)},pick(r){return U.pick(this,r)},omit(r){return U.omit(this,r)},partial(...r){return U.partial(S_,this,r[0])},required(...r){return U.required(w_,this,r[0])}})});function pL(t,e){let r={type:"object",shape:t??{},...U.normalizeParams(e)};return new jm(r)}function dL(t,e){return new jm({type:"object",shape:t,catchall:x_(),...U.normalizeParams(e)})}function fL(t,e){return new jm({type:"object",shape:t,catchall:rc(),...U.normalizeParams(e)})}var Lm=I("ZodUnion",(t,e)=>{Em.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Hx(t,r,o,n),t.options=e.options});function __(t,e){return new Lm({type:"union",options:t,...U.normalizeParams(e)})}var _R=I("ZodXor",(t,e)=>{Lm.init(t,e),KI.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Hx(t,r,o,n),t.options=e.options});function mL(t,e){return new _R({type:"union",options:t,inclusive:!1,...U.normalizeParams(e)})}var bR=I("ZodDiscriminatedUnion",(t,e)=>{Lm.init(t,e),JI.init(t,e)});function hL(t,e,r){return new bR({type:"union",options:e,discriminator:t,...U.normalizeParams(r)})}var vR=I("ZodIntersection",(t,e)=>{YI.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,o,n)=>PC(t,r,o,n)});function SR(t,e){return new vR({type:"intersection",left:t,right:e})}var wR=I("ZodTuple",(t,e)=>{ux.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,o,n)=>NC(t,r,o,n),t.rest=r=>t.clone({...t._zod.def,rest:r})});function ER(t,e,r){let o=e instanceof Se,n=o?r:e,i=o?e:null;return new wR({type:"tuple",items:t,rest:i,...U.normalizeParams(n)})}var Bl=I("ZodRecord",(t,e)=>{XI.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,o,n)=>MC(t,r,o,n),t.keyType=e.keyType,t.valueType=e.valueType});function kR(t,e,r){return!e||!e._zod?new Bl({type:"record",keyType:Tm(),valueType:t,...U.normalizeParams(e)}):new Bl({type:"record",keyType:t,valueType:e,...U.normalizeParams(r)})}function gL(t,e,r){let o=Or(t);return o._zod.values=void 0,new Bl({type:"record",keyType:o,valueType:e,...U.normalizeParams(r)})}function yL(t,e,r){return new Bl({type:"record",keyType:t,valueType:e,mode:"loose",...U.normalizeParams(r)})}var IR=I("ZodMap",(t,e)=>{QI.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,o,n)=>RC(t,r,o,n),t.keyType=e.keyType,t.valueType=e.valueType,t.min=(...r)=>t.check(ko(...r)),t.nonempty=r=>t.check(ko(1,r)),t.max=(...r)=>t.check(Rs(...r)),t.size=(...r)=>t.check(Qa(...r))});function xL(t,e,r){return new IR({type:"map",keyType:t,valueType:e,...U.normalizeParams(r)})}var OR=I("ZodSet",(t,e)=>{eO.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,o,n)=>AC(t,r,o,n),t.min=(...r)=>t.check(ko(...r)),t.nonempty=r=>t.check(ko(1,r)),t.max=(...r)=>t.check(Rs(...r)),t.size=(...r)=>t.check(Qa(...r))});function _L(t,e){return new OR({type:"set",valueType:t,...U.normalizeParams(e)})}var Wl=I("ZodEnum",(t,e)=>{tO.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(o,n,i)=>bC(t,o,n,i),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(o,n)=>{let i={};for(let s of o)if(r.has(s))i[s]=e.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Wl({...e,checks:[],...U.normalizeParams(n),entries:i})},t.exclude=(o,n)=>{let i={...e.entries};for(let s of o)if(r.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new Wl({...e,checks:[],...U.normalizeParams(n),entries:i})}});function b_(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(o=>[o,o])):t;return new Wl({type:"enum",entries:r,...U.normalizeParams(e)})}function bL(t,e){return new Wl({type:"enum",entries:t,...U.normalizeParams(e)})}var CR=I("ZodLiteral",(t,e)=>{rO.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,o,n)=>vC(t,r,o,n),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function vL(t,e){return new CR({type:"literal",values:Array.isArray(t)?t:[t],...U.normalizeParams(e)})}var RR=I("ZodFile",(t,e)=>{nO.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,o,n)=>EC(t,r,o,n),t.min=(r,o)=>t.check(ko(r,o)),t.max=(r,o)=>t.check(Rs(r,o)),t.mime=(r,o)=>t.check(Ml(Array.isArray(r)?r:[r],o))});function SL(t){return eC(RR,t)}var AR=I("ZodTransform",(t,e)=>{oO.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,o,n)=>CC(t,r,o,n),t._zod.parse=(r,o)=>{if(o.direction==="backward")throw new ws(t.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(U.issue(i,r.value,e));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=t),r.issues.push(U.issue(s))}};let n=e.transform(r.value,r);return n instanceof Promise?n.then(i=>(r.value=i,r.fallback=!0,r)):(r.value=n,r.fallback=!0,r)}});function v_(t){return new AR({type:"transform",transform:t})}var S_=I("ZodOptional",(t,e)=>{lx.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Bx(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function Pm(t){return new S_({type:"optional",innerType:t})}var TR=I("ZodExactOptional",(t,e)=>{iO.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Bx(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function $R(t){return new TR({type:"optional",innerType:t})}var PR=I("ZodNullable",(t,e)=>{sO.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,o,n)=>DC(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function Nm(t){return new PR({type:"nullable",innerType:t})}function wL(t){return Pm(Nm(t))}var NR=I("ZodDefault",(t,e)=>{aO.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,o,n)=>zC(t,r,o,n),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function MR(t,e){return new NR({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():U.shallowClone(e)}})}var DR=I("ZodPrefault",(t,e)=>{cO.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,o,n)=>jC(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function FR(t,e){return new DR({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():U.shallowClone(e)}})}var w_=I("ZodNonOptional",(t,e)=>{uO.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,o,n)=>FC(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function zR(t,e){return new w_({type:"nonoptional",innerType:t,...U.normalizeParams(e)})}var jR=I("ZodSuccess",(t,e)=>{lO.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,o,n)=>kC(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function EL(t){return new jR({type:"success",innerType:t})}var LR=I("ZodCatch",(t,e)=>{pO.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,o,n)=>LC(t,r,o,n),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function UR(t,e){return new LR({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var qR=I("ZodNaN",(t,e)=>{dO.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,o,n)=>SC(t,r,o,n)});function kL(t){return XO(qR,t)}var Um=I("ZodPipe",(t,e)=>{px.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,o,n)=>UC(t,r,o,n),t.in=e.in,t.out=e.out});function Qx(t,e){return new Um({type:"pipe",in:t,out:e})}var qm=I("ZodCodec",(t,e)=>{Um.init(t,e),km.init(t,e)});function IL(t,e,r){return new qm({type:"pipe",in:t,out:e,transform:r.decode,reverseTransform:r.encode})}function OL(t){let e=t._zod.def;return new qm({type:"pipe",in:e.out,out:e.in,transform:e.reverseTransform,reverseTransform:e.transform})}var HR=I("ZodPreprocess",(t,e)=>{Um.init(t,e),fO.init(t,e)}),BR=I("ZodReadonly",(t,e)=>{mO.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,o,n)=>qC(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function WR(t){return new BR({type:"readonly",innerType:t})}var ZR=I("ZodTemplateLiteral",(t,e)=>{hO.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,o,n)=>wC(t,r,o,n)});function CL(t,e){return new ZR({type:"template_literal",parts:t,...U.normalizeParams(e)})}var GR=I("ZodLazy",(t,e)=>{xO.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,o,n)=>BC(t,r,o,n),t.unwrap=()=>t._zod.def.getter()});function VR(t){return new GR({type:"lazy",getter:t})}var KR=I("ZodPromise",(t,e)=>{yO.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,o,n)=>HC(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function RL(t){return new KR({type:"promise",innerType:t})}var JR=I("ZodFunction",(t,e)=>{gO.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,o,n)=>OC(t,r,o,n)});function AL(t){return new JR({type:"function",input:Array.isArray(t?.input)?ER(t?.input):t?.input??zm(rc()),output:t?.output??rc()})}var Hm=I("ZodCustom",(t,e)=>{_O.init(t,e),Ie.init(t,e),t._zod.processJSONSchema=(r,o,n)=>IC(t,r,o,n)});function TL(t){let e=new ot({check:"custom"});return e._zod.check=t,e}function $L(t,e){return tC(Hm,t??(()=>!0),e)}function YR(t,e={}){return rC(Hm,t,e)}function XR(t,e){return nC(t,e)}var PL=oC,NL=iC;function ML(t,e={}){let r=new Hm({type:"custom",check:"custom",fn:o=>o instanceof t,abort:!0,...U.normalizeParams(e)});return r._zod.bag.Class=t,r._zod.check=o=>{o.value instanceof t||o.issues.push({code:"invalid_type",expected:t.name,input:o.value,inst:r,path:[...r._zod.def.path??[]]})},r}var DL=(...t)=>sC({Codec:qm,Boolean:Kl,String:Zl},...t);function FL(t){let e=VR(()=>__([Tm(t),cR(),uR(),fR(),zm(e),kR(Tm(),e)]));return e}function zL(t,e){return new HR({type:"pipe",in:v_(t),out:e})}var C7={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function R7(t){wt({customError:t})}function A7(){return wt().customError}var QR;QR||(QR={});var te={...Am,...Gx,iso:Hl},T7=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function $7(t,e){let r=t.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":e??"draft-2020-12"}function P7(t,e){if(!t.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let r=t.slice(1).split("/").filter(Boolean);if(r.length===0)return e.rootSchema;let o=e.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===o){let n=r[1];if(!n||!e.defs[n])throw new Error(`Reference not found: ${t}`);return e.defs[n]}throw new Error(`Reference not found: ${t}`)}function jL(t,e){if(t.not!==void 0){if(typeof t.not=="object"&&Object.keys(t.not).length===0)return te.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(t.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(t.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(t.if!==void 0||t.then!==void 0||t.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(t.dependentSchemas!==void 0||t.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(t.$ref){let n=t.$ref;if(e.refs.has(n))return e.refs.get(n);if(e.processing.has(n))return te.lazy(()=>{if(!e.refs.has(n))throw new Error(`Circular reference not resolved: ${n}`);return e.refs.get(n)});e.processing.add(n);let i=P7(n,e),s=pr(i,e);return e.refs.set(n,s),e.processing.delete(n),s}if(t.enum!==void 0){let n=t.enum;if(e.version==="openapi-3.0"&&t.nullable===!0&&n.length===1&&n[0]===null)return te.null();if(n.length===0)return te.never();if(n.length===1)return te.literal(n[0]);if(n.every(s=>typeof s=="string"))return te.enum(n);let i=n.map(s=>te.literal(s));return i.length<2?i[0]:te.union([i[0],i[1],...i.slice(2)])}if(t.const!==void 0)return te.literal(t.const);let r=t.type;if(Array.isArray(r)){let n=r.map(i=>{let s={...t,type:i};return jL(s,e)});return n.length===0?te.never():n.length===1?n[0]:te.union(n)}if(!r)return te.any();let o;switch(r){case"string":{let n=te.string();if(t.format){let i=t.format;i==="email"?n=n.check(te.email()):i==="uri"||i==="uri-reference"?n=n.check(te.url()):i==="uuid"||i==="guid"?n=n.check(te.uuid()):i==="date-time"?n=n.check(te.iso.datetime()):i==="date"?n=n.check(te.iso.date()):i==="time"?n=n.check(te.iso.time()):i==="duration"?n=n.check(te.iso.duration()):i==="ipv4"?n=n.check(te.ipv4()):i==="ipv6"?n=n.check(te.ipv6()):i==="mac"?n=n.check(te.mac()):i==="cidr"?n=n.check(te.cidrv4()):i==="cidr-v6"?n=n.check(te.cidrv6()):i==="base64"?n=n.check(te.base64()):i==="base64url"?n=n.check(te.base64url()):i==="e164"?n=n.check(te.e164()):i==="jwt"?n=n.check(te.jwt()):i==="emoji"?n=n.check(te.emoji()):i==="nanoid"?n=n.check(te.nanoid()):i==="cuid"?n=n.check(te.cuid()):i==="cuid2"?n=n.check(te.cuid2()):i==="ulid"?n=n.check(te.ulid()):i==="xid"?n=n.check(te.xid()):i==="ksuid"&&(n=n.check(te.ksuid()))}typeof t.minLength=="number"&&(n=n.min(t.minLength)),typeof t.maxLength=="number"&&(n=n.max(t.maxLength)),t.pattern&&(n=n.regex(new RegExp(t.pattern))),o=n;break}case"number":case"integer":{let n=r==="integer"?te.number().int():te.number();typeof t.minimum=="number"&&(n=n.min(t.minimum)),typeof t.maximum=="number"&&(n=n.max(t.maximum)),typeof t.exclusiveMinimum=="number"?n=n.gt(t.exclusiveMinimum):t.exclusiveMinimum===!0&&typeof t.minimum=="number"&&(n=n.gt(t.minimum)),typeof t.exclusiveMaximum=="number"?n=n.lt(t.exclusiveMaximum):t.exclusiveMaximum===!0&&typeof t.maximum=="number"&&(n=n.lt(t.maximum)),typeof t.multipleOf=="number"&&(n=n.multipleOf(t.multipleOf)),o=n;break}case"boolean":{o=te.boolean();break}case"null":{o=te.null();break}case"object":{let n={},i=t.properties||{},s=new Set(t.required||[]);for(let[c,u]of Object.entries(i)){let l=pr(u,e);n[c]=s.has(c)?l:l.optional()}if(t.propertyNames){let c=pr(t.propertyNames,e),u=t.additionalProperties&&typeof t.additionalProperties=="object"?pr(t.additionalProperties,e):te.any();if(Object.keys(n).length===0){o=te.record(c,u);break}let l=te.object(n).passthrough(),p=te.looseRecord(c,u);o=te.intersection(l,p);break}if(t.patternProperties){let c=t.patternProperties,u=Object.keys(c),l=[];for(let f of u){let d=pr(c[f],e),m=te.string().regex(new RegExp(f));l.push(te.looseRecord(m,d))}let p=[];if(Object.keys(n).length>0&&p.push(te.object(n).passthrough()),p.push(...l),p.length===0)o=te.object({}).passthrough();else if(p.length===1)o=p[0];else{let f=te.intersection(p[0],p[1]);for(let d=2;d<p.length;d++)f=te.intersection(f,p[d]);o=f}break}let a=te.object(n);t.additionalProperties===!1?o=a.strict():typeof t.additionalProperties=="object"?o=a.catchall(pr(t.additionalProperties,e)):o=a.passthrough();break}case"array":{let n=t.prefixItems,i=t.items;if(n&&Array.isArray(n)){let s=n.map(c=>pr(c,e)),a=i&&typeof i=="object"&&!Array.isArray(i)?pr(i,e):void 0;a?o=te.tuple(s).rest(a):o=te.tuple(s),typeof t.minItems=="number"&&(o=o.check(te.minLength(t.minItems))),typeof t.maxItems=="number"&&(o=o.check(te.maxLength(t.maxItems)))}else if(Array.isArray(i)){let s=i.map(c=>pr(c,e)),a=t.additionalItems&&typeof t.additionalItems=="object"?pr(t.additionalItems,e):void 0;a?o=te.tuple(s).rest(a):o=te.tuple(s),typeof t.minItems=="number"&&(o=o.check(te.minLength(t.minItems))),typeof t.maxItems=="number"&&(o=o.check(te.maxLength(t.maxItems)))}else if(i!==void 0){let s=pr(i,e),a=te.array(s);typeof t.minItems=="number"&&(a=a.min(t.minItems)),typeof t.maxItems=="number"&&(a=a.max(t.maxItems)),o=a}else o=te.array(te.any());break}default:throw new Error(`Unsupported type: ${r}`)}return o}function pr(t,e){if(typeof t=="boolean")return t?te.any():te.never();let r=jL(t,e),o=t.type||t.enum!==void 0||t.const!==void 0;if(t.anyOf&&Array.isArray(t.anyOf)){let a=t.anyOf.map(u=>pr(u,e)),c=te.union(a);r=o?te.intersection(r,c):c}if(t.oneOf&&Array.isArray(t.oneOf)){let a=t.oneOf.map(u=>pr(u,e)),c=te.xor(a);r=o?te.intersection(r,c):c}if(t.allOf&&Array.isArray(t.allOf))if(t.allOf.length===0)r=o?r:te.any();else{let a=o?r:pr(t.allOf[0],e),c=o?0:1;for(let u=c;u<t.allOf.length;u++)a=te.intersection(a,pr(t.allOf[u],e));r=a}t.nullable===!0&&e.version==="openapi-3.0"&&(r=te.nullable(r)),t.readOnly===!0&&(r=te.readonly(r)),t.default!==void 0&&(r=r.default(t.default));let n={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of i)a in t&&(n[a]=t[a]);let s=["contentEncoding","contentMediaType","contentSchema"];for(let a of s)a in t&&(n[a]=t[a]);for(let a of Object.keys(t))T7.has(a)||(n[a]=t[a]);return Object.keys(n).length>0&&e.registry.add(r,n),t.description&&(r=r.describe(t.description)),r}function LL(t,e){if(typeof t=="boolean")return t?te.any():te.never();let r;try{r=JSON.parse(JSON.stringify(t))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let o=$7(r,e?.defaultTarget),n=r.$defs||r.definitions||{},i={version:o,defs:n,refs:new Map,processing:new Set,rootSchema:r,registry:e?.registry??tr};return pr(r,i)}var eA={};an(eA,{bigint:()=>F7,boolean:()=>D7,date:()=>z7,number:()=>M7,string:()=>N7});function N7(t){return wO(Zl,t)}function M7(t){return TO(Vl,t)}function D7(t){return zO(Kl,t)}function F7(t){return LO(Jl,t)}function z7(t){return YO(Fm,t)}wt(dx());var tA=C.object({path:C.string(),previousPath:C.string().optional(),status:C.enum(["added","modified","removed","renamed"]).default("modified"),additions:C.number().int().nonnegative().default(0),deletions:C.number().int().nonnegative().default(0)}),Yl=C.object({id:C.string(),path:C.string(),index:C.number().int().nonnegative(),header:C.string(),content:C.string(),additions:C.number().int().nonnegative(),deletions:C.number().int().nonnegative()}),Xl=C.object({id:C.string().min(1),title:C.string().min(1).max(120),summary:C.string().min(1).max(400),files:C.array(C.string()),chunks:C.array(C.string()).default([])}),rA=C.object({chunkId:C.string(),groupId:C.string()}),Bm=C.object({id:C.string(),filePath:C.string(),line:C.number().int().positive(),side:C.enum(["left","right"]).default("right"),body:C.string().min(1),createdAt:C.string()}),nA=C.object({decision:C.enum(["pending","approve","request-changes","comment"]),body:C.string().default("")}),oA=C.object({repository:C.string(),number:C.number().int().positive(),title:C.string(),body:C.string(),url:C.string(),author:C.string().optional(),headSha:C.string(),baseSha:C.string(),headRef:C.string(),baseRef:C.string(),state:C.string(),isDraft:C.boolean()}),UL=C.object({id:C.number().int(),author:C.string(),body:C.string(),filePath:C.string().optional(),line:C.number().int().positive().optional(),side:C.enum(["left","right"]).optional(),createdAt:C.string(),url:C.string().optional()}),j7=C.object({id:C.string(),label:C.string(),state:C.enum(["pending","running","complete","failed"])}),L7=C.object({state:C.enum(["idle","running","complete","failed"]).default("idle"),message:C.string().optional(),steps:C.array(j7).default([])}),iA=C.object({id:C.string(),pullRequest:oA,loadedAt:C.string(),diff:C.string(),files:C.array(tA),chunks:C.array(Yl),groups:C.array(Xl),chunkAssignments:C.array(rA),draftComments:C.array(Bm),decision:nA,grouping:L7});function qL(t){let e=t.trim();if(e)return U7(e)??HL(e)}function sA(t){let e=t.split("/");return(e.length===2||e.length===3)&&e.every(r=>r.length>0&&!/\s/.test(r))}function HL(t){let e=t.match(/^(?:(.+)#)?(\d+)$/);if(!e)return;let r=Number(e[2]),o=e[1];if(!(!Number.isSafeInteger(r)||r<=0)&&!(o&&!sA(o)))return{repository:o,number:r}}function U7(t){let e;try{e=new URL(t)}catch{return}if(e.protocol!=="https:"&&e.protocol!=="http:")return;let[r,o,n,i]=e.pathname.split("/").filter(Boolean);if(!r||!o||!i||!["pull","pulls"].includes(n??""))return;let s=e.hostname==="github.com"?`${r}/${o}`:`${e.host}/${r}/${o}`;return HL(`${s}#${i}`)}var BL=C.string().trim().refine(sA,{message:"Repository must be owner/repo or host/owner/repo without a URL scheme."}),aA=C.object({repository:BL.optional(),number:C.coerce.number().int().positive()});function WL(t){if(t===void 0)return;let e=qL(t);if(!e)throw new Error("Use a PR number, owner/repo#123, or a GitHub pull request URL.");return aA.parse(e)}function cA(t){let e=BL.parse(t).split("/");return e.length===2?{nameWithOwner:`${e[0]}/${e[1]}`}:{host:e[0],nameWithOwner:`${e[1]}/${e[2]}`}}var Ql=C.object({sessionId:C.string().min(1)}),q7=Bm.omit({id:!0,createdAt:!0}).extend(Ql.shape),H7=Ql.extend({decision:nA});function ZL(t){return _l({initialPullRequest:Qn.query(()=>({target:t.initialPullRequest})),loadPullRequest:Qn.input(aA).mutation(({input:e})=>t.loadPullRequest(e)),getSession:Qn.input(Ql).query(({input:e})=>t.getSession(e.sessionId)),groupChanges:Qn.input(Ql).mutation(({input:e})=>t.groupChanges(e.sessionId)),addDraftComment:Qn.input(q7).mutation(({input:e})=>{let{sessionId:r,...o}=e;return t.addDraftComment(r,o)}),setDecisionDraft:Qn.input(H7).mutation(({input:e})=>t.setDecisionDraft(e.sessionId,e.decision)),listCurrentComments:Qn.input(Ql).query(({input:e})=>t.listCurrentComments(e.sessionId)),submitReview:Qn.input(Ql).mutation(({input:e})=>t.submitReview(e.sessionId))})}function GL(t){return _l({health:qF,review:ZL(t)})}var uA=t=>typeof t=="function",h=function(t,e){if(typeof t=="function")return function(){return t(arguments)?e.apply(this,arguments):r=>e(r,...arguments)};switch(t){case 0:case 1:throw new RangeError(`Invalid arity ${t}`);case 2:return function(r,o){return arguments.length>=2?e(r,o):function(n){return e(n,r)}};case 3:return function(r,o,n){return arguments.length>=3?e(r,o,n):function(i){return e(i,r,o)}};case 4:return function(r,o,n,i){return arguments.length>=4?e(r,o,n,i):function(s){return e(s,r,o,n)}};case 5:return function(r,o,n,i,s){return arguments.length>=5?e(r,o,n,i,s):function(a){return e(a,r,o,n,i)}};default:return function(){if(arguments.length>=t)return e.apply(this,arguments);let r=arguments;return function(o){return e(o,...r)}}}};var be=t=>t;var Wm=t=>()=>t,Oo=Wm(!0),ro=Wm(!1);var E_=Wm(void 0),Co=E_;function b(t,e,r,o,n,i,s,a,c){switch(arguments.length){case 1:return t;case 2:return e(t);case 3:return r(e(t));case 4:return o(r(e(t)));case 5:return n(o(r(e(t))));case 6:return i(n(o(r(e(t)))));case 7:return s(i(n(o(r(e(t))))));case 8:return a(s(i(n(o(r(e(t)))))));case 9:return c(a(s(i(n(o(r(e(t))))))));default:{let u=arguments[0];for(let l=1;l<arguments.length;l++)u=arguments[l](u);return u}}}var k_=t=>(e,r)=>e===r||t(e,r);var VL=h(2,(t,e)=>k_((r,o)=>t(e(r),e(o))));var KL=t=>k_((e,r)=>{if(e.length!==r.length)return!1;for(let o=0;o<e.length;o++)if(!t(e[o],r[o]))return!1;return!0});var JL=t=>h(3,(e,r,o)=>t(e,n=>({...n,[r]:o(n)}))),YL=t=>h(2,(e,r)=>t(e,o=>({[r]:o}))),XL=(t,e)=>h(3,(r,o,n)=>e(r,i=>t(n(i),s=>({...i,[o]:s}))));var QL="effect/GlobalValue",Zm,pe=(t,e)=>(Zm||(globalThis[QL]??=new Map,Zm=globalThis[QL]),Zm.has(t)||Zm.set(t,e()),Zm.get(t));var Gm=t=>typeof t=="string",Vm=t=>typeof t=="number";var lA=t=>typeof t=="bigint";var Ps=uA;var Z7=t=>typeof t=="object"&&t!==null,Ns=t=>Z7(t)||Ps(t),Y=h(2,(t,e)=>Ns(t)&&e in t),Ms=h(2,(t,e)=>Y(t,"_tag")&&t._tag===e),oc=t=>t==null;var Tn=t=>typeof t=="string"||Y(t,Symbol.iterator);var pA=t=>Y(t,"then")&&Ps(t.then);var ic=t=>`BUG: ${t} - please report an issue at https://github.com/Effect-TS/effect/issues`;var eU=Symbol.for("effect/Gen/GenKind");var tU=class{value;constructor(e){this.value=e}get _F(){return be}get _R(){return e=>e}get _O(){return e=>e}get _E(){return e=>e}[eU]=eU;[Symbol.iterator](){return new sc(this)}},sc=class t{self;called=!1;constructor(e){this.self=e}next(e){return this.called?{value:e,done:!0}:(this.called=!0,{value:this.self,done:!1})}return(e){return{value:e,done:!0}}throw(e){throw e}[Symbol.iterator](){return new t(this.self)}};var G7=335903614,V7=4150755663,K7=1481765933,J7=1284865837,Y7=9007199254740992,X7=134217728,O_=class{_state;constructor(e,r,o,n){return oc(r)&&oc(e)?(r=Math.random()*4294967295>>>0,e=0):oc(r)&&(r=e,e=0),oc(n)&&oc(o)?(n=this._state?this._state[3]:V7,o=this._state?this._state[2]:G7):oc(n)&&(n=o,o=0),this._state=new Int32Array([0,0,o>>>0,((n||0)|1)>>>0]),this._next(),rU(this._state,this._state[0],this._state[1],e>>>0,r>>>0),this._next(),this}getState(){return[this._state[0],this._state[1],this._state[2],this._state[3]]}setState(e){this._state[0]=e[0],this._state[1]=e[1],this._state[2]=e[2],this._state[3]=e[3]|1}integer(e){return Math.round(this.number()*Number.MAX_SAFE_INTEGER)%e}number(){let e=(this._next()&67108863)*1,r=(this._next()&134217727)*1;return(e*X7+r)/Y7}_next(){let e=this._state[0]>>>0,r=this._state[1]>>>0;Q7(this._state,e,r,K7,J7),rU(this._state,this._state[0],this._state[1],this._state[2],this._state[3]);let o=e>>>18,n=(r>>>18|e<<14)>>>0;o=(o^e)>>>0,n=(n^r)>>>0;let i=(n>>>27|o<<5)>>>0,s=e>>>27,a=(-s>>>0&31)>>>0;return(i>>>s|i<<a)>>>0}};function Q7(t,e,r,o,n){let i=(r>>>16)*(n&65535)>>>0,s=(r&65535)*(n>>>16)>>>0,a=(r&65535)*(n&65535)>>>0,c=(r>>>16)*(n>>>16)+((s>>>16)+(i>>>16))>>>0;s=s<<16>>>0,a=a+s>>>0,a>>>0<s>>>0&&(c=c+1>>>0),i=i<<16>>>0,a=a+i>>>0,a>>>0<i>>>0&&(c=c+1>>>0),c=c+Math.imul(r,o)>>>0,c=c+Math.imul(e,n)>>>0,t[0]=c,t[1]=a}function rU(t,e,r,o,n){let i=e+o>>>0,s=r+n>>>0;s>>>0<r>>>0&&(i=i+1|0),t[0]=i,t[1]=s}var dA=Symbol.for("effect/Utils/YieldWrap"),Ro=class{#t;constructor(e){this.#t=e}[dA](){return this.#t}};function fA(t){if(typeof t=="object"&&t!==null&&dA in t)return t[dA]();throw new Error(ic("yieldWrapGet"))}var Wr=pe("effect/Utils/isStructuralRegion",()=>({enabled:!1,tester:void 0}));var nU={effect_internal_function:t=>t()},eQ={effect_internal_function:t=>t()},tQ=nU.effect_internal_function(()=>new Error().stack)?.includes("effect_internal_function")===!0,yt=tQ?nU.effect_internal_function:eQ.effect_internal_function,rQ=function*(){}.constructor,oU=t=>Ns(t)&&t.constructor===rQ;var mA=pe(Symbol.for("effect/Hash/randomHashCache"),()=>new WeakMap),re=Symbol.for("effect/Hash"),G=t=>{if(Wr.enabled===!0)return 0;switch(typeof t){case"number":return R_(t);case"bigint":return Le(t.toString(10));case"boolean":return Le(String(t));case"symbol":return Le(String(t));case"string":return Le(t);case"undefined":return Le("undefined");case"function":case"object":return t===null?Le("null"):t instanceof Date?Number.isNaN(t.getTime())?Le("Invalid Date"):G(t.toISOString()):t instanceof URL?G(t.href):nQ(t)?t[re]():ep(t);default:throw new Error(`BUG: unhandled typeof ${typeof t} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},ep=t=>(mA.has(t)||mA.set(t,R_(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER))),mA.get(t)),ae=t=>e=>e*53^t,C_=t=>t&3221225471|t>>>1&1073741824,nQ=t=>Y(t,re),R_=t=>{if(t!==t||t===1/0)return 0;let e=t|0;for(e!==t&&(e^=t*4294967295);t>4294967295;)e^=t/=4294967295;return C_(e)},Le=t=>{let e=5381,r=t.length;for(;r;)e=e*33^t.charCodeAt(--r);return C_(e)},oQ=(t,e)=>{let r=12289;for(let o=0;o<e.length;o++)r^=b(Le(e[o]),ae(G(t[e[o]])));return C_(r)},A_=t=>oQ(t,Object.keys(t)),Zr=t=>{let e=6151;for(let r=0;r<t.length;r++)e=b(e,ae(G(t[r])));return C_(e)},ye=function(){if(arguments.length===1){let r=arguments[0];return function(o){return Object.defineProperty(r,re,{value(){return o},enumerable:!1}),o}}let t=arguments[0],e=arguments[1];return Object.defineProperty(t,re,{value(){return e},enumerable:!1}),e};var Q=Symbol.for("effect/Equal");function V(){return arguments.length===1?t=>T_(t,arguments[0]):T_(arguments[0],arguments[1])}function T_(t,e){if(t===e)return!0;let r=typeof t;if(r!==typeof e)return!1;if(r==="object"||r==="function"){if(t!==null&&e!==null){if(tp(t)&&tp(e))return G(t)===G(e)&&t[Q](e)?!0:Wr.enabled&&Wr.tester?Wr.tester(t,e):!1;if(t instanceof Date&&e instanceof Date){let o=t.getTime(),n=e.getTime();return o===n||Number.isNaN(o)&&Number.isNaN(n)}else if(t instanceof URL&&e instanceof URL)return t.href===e.href}if(Wr.enabled){if(t===null||e===null)return!1;if(Array.isArray(t)&&Array.isArray(e))return t.length===e.length&&t.every((o,n)=>T_(o,e[n]));if(Object.getPrototypeOf(t)===Object.prototype&&Object.getPrototypeOf(e)===Object.prototype){let o=Object.keys(t),n=Object.keys(e);if(o.length===n.length){for(let i of o)if(!(i in e&&T_(t[i],e[i])))return Wr.tester?Wr.tester(t,e):!1;return!0}}return Wr.tester?Wr.tester(t,e):!1}}return Wr.enabled&&Wr.tester?Wr.tester(t,e):!1}var tp=t=>Y(t,Q),Jm=()=>V;var xe=Symbol.for("nodejs.util.inspect.custom"),ke=t=>{try{if(Y(t,"toJSON")&&Ps(t.toJSON)&&t.toJSON.length===0)return t.toJSON();if(Array.isArray(t))return t.map(ke)}catch{return{}}return uU(t)};var Ce=t=>JSON.stringify(t,null,2),Xke={toJSON(){return ke(this)},[xe](){return this.toJSON()},toString(){return Ce(this.toJSON())}},sU=class{[xe](){return this.toJSON()}toString(){return Ce(this.toJSON())}},vi=(t,e=2)=>{if(typeof t=="string")return t;try{return typeof t=="object"?$_(t,e):String(t)}catch{return String(t)}},$_=(t,e)=>{let r=[],o=JSON.stringify(t,(n,i)=>typeof i=="object"&&i!==null?r.includes(i)?void 0:r.push(i)&&(ac.fiberRefs!==void 0&&aU(i)?i[hA](ac.fiberRefs):i):i,e);return r=void 0,o},hA=Symbol.for("effect/Inspectable/Redactable"),aU=t=>typeof t=="object"&&t!==null&&hA in t,ac=pe("effect/Inspectable/redactableState",()=>({fiberRefs:void 0})),cU=(t,e)=>{let r=ac.fiberRefs;ac.fiberRefs=t;try{return e()}finally{ac.fiberRefs=r}},uU=t=>aU(t)&&ac.fiberRefs!==void 0?t[hA](ac.fiberRefs):t;var K=(t,e)=>{switch(e.length){case 0:return t;case 1:return e[0](t);case 2:return e[1](e[0](t));case 3:return e[2](e[1](e[0](t)));case 4:return e[3](e[2](e[1](e[0](t))));case 5:return e[4](e[3](e[2](e[1](e[0](t)))));case 6:return e[5](e[4](e[3](e[2](e[1](e[0](t))))));case 7:return e[6](e[5](e[4](e[3](e[2](e[1](e[0](t)))))));case 8:return e[7](e[6](e[5](e[4](e[3](e[2](e[1](e[0](t))))))));case 9:return e[8](e[7](e[6](e[5](e[4](e[3](e[2](e[1](e[0](t)))))))));default:{let r=t;for(let o=0,n=e.length;o<n;o++)r=e[o](r);return r}}};var cc="Async",uc="Commit",Et="Failure",rp="OnFailure",np="OnSuccess",op="OnSuccessAndFailure",kt="Success",N_="Sync";var Si="UpdateRuntimeFlags",ip="While",lc="Iterator",M_="WithRuntime",sp="Yield",Ym="RevertFlags";var sQ="3.21.4",Qm=()=>sQ;var pU=Symbol.for("effect/Effect"),dU=Symbol.for("effect/Stream"),fU=Symbol.for("effect/Sink"),mU=Symbol.for("effect/Channel"),Ds={_R:t=>t,_E:t=>t,_A:t=>t,_V:Qm()},aQ={_A:t=>t,_In:t=>t,_L:t=>t,_E:t=>t,_R:t=>t},cQ={_Env:t=>t,_InErr:t=>t,_InElem:t=>t,_InDone:t=>t,_OutErr:t=>t,_OutElem:t=>t,_OutDone:t=>t},wi={[pU]:Ds,[dU]:Ds,[fU]:aQ,[mU]:cQ,[Q](t){return this===t},[re](){return ye(this,ep(this))},[Symbol.iterator](){return new sc(new Ro(this))},pipe(){return K(this,arguments)}},ap={[re](){return ye(this,A_(this))},[Q](t){let e=Object.keys(this),r=Object.keys(t);if(e.length!==r.length)return!1;for(let o of e)if(!(o in t&&V(this[o],t[o])))return!1;return!0}},Ei={...wi,_op:uc},gA={...Ei,...ap},hU=(function(){function t(){}return t.prototype=Ei,t})();var yU=Symbol.for("effect/Option"),xU={...wi,[yU]:{_A:t=>t},[xe](){return this.toJSON()},toString(){return Ce(this.toJSON())}},uQ=Object.assign(Object.create(xU),{_tag:"Some",_op:"Some",[Q](t){return yA(t)&&xA(t)&&V(this.value,t.value)},[re](){return ye(this,ae(G(this._tag))(G(this.value)))},toJSON(){return{_id:"Option",_tag:this._tag,value:ke(this.value)}}}),lQ=G("None"),pQ=Object.assign(Object.create(xU),{_tag:"None",_op:"None",[Q](t){return yA(t)&&cp(t)},[re](){return lQ},toJSON(){return{_id:"Option",_tag:this._tag}}}),yA=t=>Y(t,yU),cp=t=>t._tag==="None",xA=t=>t._tag==="Some",D_=Object.create(pQ),Fs=t=>{let e=Object.create(uQ);return e.value=t,e};var bA=Symbol.for("effect/Either"),_U={...wi,[bA]:{_R:t=>t},[xe](){return this.toJSON()},toString(){return Ce(this.toJSON())}},dQ=Object.assign(Object.create(_U),{_tag:"Right",_op:"Right",[Q](t){return vA(t)&&wA(t)&&V(this.right,t.right)},[re](){return ae(G(this._tag))(G(this.right))},toJSON(){return{_id:"Either",_tag:this._tag,right:ke(this.right)}}}),fQ=Object.assign(Object.create(_U),{_tag:"Left",_op:"Left",[Q](t){return vA(t)&&SA(t)&&V(this.left,t.left)},[re](){return ae(G(this._tag))(G(this.left))},toJSON(){return{_id:"Either",_tag:this._tag,left:ke(this.left)}}}),vA=t=>Y(t,bA),SA=t=>t._tag==="Left",wA=t=>t._tag==="Right",bU=t=>{let e=Object.create(fQ);return e.left=t,e},vU=t=>{let e=Object.create(dQ);return e.right=t,e};var Tr=vU;var $n=bU;var Ao=SA,up=wA;var gQ=h(2,(t,{onLeft:e,onRight:r})=>Ao(t)?e(t.left):r(t.right));var F_=gQ({onLeft:be,onRight:be});var EA=t=>t.length>0;var SU=t=>(e,r)=>e===r?0:t(e,r);var wU=SU((t,e)=>t<e?-1:1);var EU=h(2,(t,e)=>SU((r,o)=>t(e(r),e(o))));var kA=t=>h(2,(e,r)=>t(e,r)===1);var z=()=>D_,B=Fs;var at=cp,dt=xA,Ut=h(2,(t,{onNone:e,onSome:r})=>at(t)?e():r(t.value));var qt=h(2,(t,e)=>at(t)?e():t.value);var kU=h(2,(t,e)=>at(t)?B(e()):t);var js=t=>t==null?z():B(t);var dr=qt(E_);var xQ=h(2,(t,e)=>{if(dt(t))return t.value;throw e()}),IU=xQ(()=>new Error("getOrThrow called on a None")),Pn=h(2,(t,e)=>at(t)?z():B(e(t.value)));var lp=h(2,(t,e)=>at(t)?z():e(t.value));var _Q=t=>h(2,(e,r)=>at(e)?!1:t(e.value,r)),bQ=Jm(),OU=_Q(bQ);var eh=t=>(e,r)=>at(e)?r:at(r)?e:B(t(e.value,r.value));var CU=(...t)=>t;var th=t=>new Array(t),OA=h(2,(t,e)=>{let r=Math.max(1,Math.floor(t)),o=new Array(r);for(let n=0;n<r;n++)o[n]=e(n);return o});var Re=t=>Array.isArray(t)?t:Array.from(t),AU=t=>Array.isArray(t)?t:[t];var pp=h(2,(t,e)=>[e,...t]);var TU=h(2,(t,e)=>[...t,e]),CA=h(2,(t,e)=>Re(t).concat(Re(e)));var vQ=t=>t.length===0,$U=vQ,z_=EA,fr=EA;var PU=(t,e)=>t<0||t>=e.length,SQ=(t,e)=>Math.floor(Math.min(Math.max(0,t),e.length)),wQ=h(2,(t,e)=>{let r=Math.floor(e);return PU(r,t)?z():B(t[r])}),RA=h(2,(t,e)=>{let r=Math.floor(e);if(PU(r,t))throw new Error(`Index ${r} out of bounds`);return t[r]});var Ls=wQ(0),Kt=RA(0),j_=t=>fr(t)?B(AA(t)):z(),AA=t=>t[t.length-1];var To=t=>t.slice(1);var EQ=(t,e)=>{let r=0;for(let o of t){if(!e(o,r))break;r++}return r},NU=h(2,(t,e)=>IQ(t,EQ(t,e))),MU=h(2,(t,e)=>{let r=Re(t);return r.slice(SQ(e,r),r.length)});var TA=t=>Array.from(t).reverse(),pc=h(2,(t,e)=>{let r=Array.from(t);return r.sort(e),r});var $A=h(2,(t,e)=>DU(t,e,CU)),DU=h(3,(t,e,r)=>{let o=Re(t),n=Re(e);if(fr(o)&&fr(n)){let i=[r(Kt(o),Kt(n))],s=Math.min(o.length,n.length);for(let a=1;a<s;a++)i[a]=r(o[a],n[a]);return i}return[]});var kQ=Jm();var IQ=h(2,(t,e)=>{let r=Array.from(t),o=Math.floor(e);return fr(r)?o>=1?OQ(r,o):[[],r]:[r,[]]}),OQ=h(2,(t,e)=>{let r=Math.max(1,Math.floor(e));return r>=t.length?[CQ(t),[]]:[pp(t.slice(1,r),Kt(t)),t.slice(r)]});var CQ=t=>t.slice();var RQ=h(3,(t,e,r)=>{let o=Re(t),n=Re(e);return fr(o)?fr(n)?jU(r)(CA(o,n)):o:n}),no=h(2,(t,e)=>RQ(t,e,kQ));var oo=()=>[],$r=t=>[t],$o=h(2,(t,e)=>t.map(e)),FU=h(2,(t,e)=>{if($U(t))return[];let r=[];for(let o=0;o<t.length;o++){let n=e(t[o],o);for(let i=0;i<n.length;i++)r.push(n[i])}return r}),L_=FU(be),dp=h(2,(t,e)=>{let r=Re(t),o=[];for(let n=0;n<r.length;n++){let i=e(r[n],n);dt(i)&&o.push(i.value)}return o});var PA=h(2,(t,e)=>{let r=[],o=[],n=Re(t);for(let i=0;i<n.length;i++){let s=e(n[i],i);Ao(s)?r.push(s.left):o.push(s.right)}return[r,o]}),zU=dp(be);var Us=h(3,(t,e,r)=>Re(t).reduce((o,n,i)=>r(o,n,i),e)),U_=h(3,(t,e,r)=>Re(t).reduceRight((o,n,i)=>r(o,n,i),e));var NA=(t,e)=>{let r=[],o=t,n;for(;dt(n=e(o));){let[i,s]=n.value;r.push(i),o=s}return r};var fp=KL;var jU=h(2,(t,e)=>{let r=Re(t);if(fr(r)){let o=[Kt(r)],n=To(r);for(let i of n)o.every(s=>!e(i,s))&&o.push(i);return o}return[]}),MA=t=>jU(t,Jm());var ki=h(2,(t,e)=>Re(t).join(e));var qs=wU;var LU=t=>t.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&");var qU=t=>!t;var Rt={};an(Rt,{GenericTag:()=>Ht,Reference:()=>io,ReferenceTypeId:()=>LQ,Tag:()=>ZQ,TagTypeId:()=>jQ,add:()=>Ze,empty:()=>Jt,get:()=>Nt,getOption:()=>dn,getOrElse:()=>HQ,isContext:()=>UA,isReference:()=>qQ,isTag:()=>gp,make:()=>Gr,merge:()=>Dn,mergeAll:()=>qA,omit:()=>WQ,pick:()=>BQ,unsafeGet:()=>Mn,unsafeMake:()=>UQ});var H_=Symbol.for("effect/Context/Tag"),mp=Symbol.for("effect/Context/Reference"),PQ="effect/STM",NQ=Symbol.for(PQ),hp={...wi,_op:"Tag",[NQ]:Ds,[H_]:{_Service:t=>t,_Identifier:t=>t},toString(){return Ce(this.toJSON())},toJSON(){return{_id:"Tag",key:this.key,stack:this.stack}},[xe](){return this.toJSON()},of(t){return t},context(t){return jA(this,t)}},MQ={...hp,[mp]:mp},BU=t=>{let e=Error.stackTraceLimit;Error.stackTraceLimit=2;let r=new Error;Error.stackTraceLimit=e;let o=Object.create(hp);return Object.defineProperty(o,"stack",{get(){return r.stack}}),o.key=t,o},WU=t=>()=>{let e=Error.stackTraceLimit;Error.stackTraceLimit=2;let r=new Error;Error.stackTraceLimit=e;function o(){}return Object.setPrototypeOf(o,hp),o.key=t,Object.defineProperty(o,"stack",{get(){return r.stack}}),o},ZU=()=>(t,e)=>{let r=Error.stackTraceLimit;Error.stackTraceLimit=2;let o=new Error;Error.stackTraceLimit=r;function n(){}return Object.setPrototypeOf(n,MQ),n.key=t,n.defaultValue=e.defaultValue,Object.defineProperty(n,"stack",{get(){return o.stack}}),n},FA=Symbol.for("effect/Context"),DQ={[FA]:{_Services:t=>t},[Q](t){if(zA(t)&&this.unsafeMap.size===t.unsafeMap.size){for(let e of this.unsafeMap.keys())if(!t.unsafeMap.has(e)||!V(this.unsafeMap.get(e),t.unsafeMap.get(e)))return!1;return!0}return!1},[re](){return ye(this,R_(this.unsafeMap.size))},pipe(){return K(this,arguments)},toString(){return Ce(this.toJSON())},toJSON(){return{_id:"Context",services:Array.from(this.unsafeMap).map(ke)}},[xe](){return this.toJSON()}},Nn=t=>{let e=Object.create(DQ);return e.unsafeMap=t,e},FQ=t=>{let e=new Error(`Service not found${t.key?`: ${String(t.key)}`:""}`);if(t.stack){let r=t.stack.split(`
|
|
84
|
+
`);if(r.length>2){let o=r[2].match(/at (.*)/);o&&(e.message=e.message+` (defined at ${o[1]})`)}}if(e.stack){let r=e.stack.split(`
|
|
85
|
+
`);r.splice(1,3),e.stack=r.join(`
|
|
86
|
+
`)}return e},zA=t=>Y(t,FA),GU=t=>Y(t,H_),B_=t=>Y(t,mp),zQ=Nn(new Map),VU=()=>zQ,jA=(t,e)=>Nn(new Map([[t.key,e]])),KU=h(3,(t,e,r)=>{let o=new Map(t.unsafeMap);return o.set(e.key,r),Nn(o)}),DA=pe("effect/Context/defaultValueCache",()=>new Map),W_=t=>{if(DA.has(t.key))return DA.get(t.key);let e=t.defaultValue();return DA.set(t.key,e),e},JU=(t,e)=>t.unsafeMap.has(e.key)?t.unsafeMap.get(e.key):W_(e),LA=h(2,(t,e)=>{if(!t.unsafeMap.has(e.key)){if(mp in e)return W_(e);throw FQ(e)}return t.unsafeMap.get(e.key)}),YU=LA,XU=h(3,(t,e,r)=>t.unsafeMap.has(e.key)?t.unsafeMap.get(e.key):B_(e)?W_(e):r()),QU=h(2,(t,e)=>t.unsafeMap.has(e.key)?Fs(t.unsafeMap.get(e.key)):B_(e)?Fs(W_(e)):D_),e1=h(2,(t,e)=>{let r=new Map(t.unsafeMap);for(let[o,n]of e.unsafeMap)r.set(o,n);return Nn(r)}),t1=(...t)=>{let e=new Map;for(let r=0;r<t.length;r++)t[r].unsafeMap.forEach((o,n)=>{e.set(n,o)});return Nn(e)},r1=(...t)=>e=>{let r=new Set(t.map(n=>n.key)),o=new Map;for(let[n,i]of e.unsafeMap.entries())r.has(n)&&o.set(n,i);return Nn(o)},n1=(...t)=>e=>{let r=new Map(e.unsafeMap);for(let o of t)r.delete(o.key);return Nn(r)};var jQ=H_,LQ=mp,Ht=BU;var UQ=Nn,UA=zA,gp=GU,qQ=B_,Jt=VU,Gr=jA,Ze=KU,Nt=YU,HQ=XU,Mn=LA,dn=QU,Dn=e1,qA=t1,BQ=r1,WQ=n1,ZQ=WU,io=ZU;var i1=Symbol.for("effect/Chunk");function GQ(t,e,r,o,n){for(let i=e;i<Math.min(t.length,e+n);i++)r[o+i-e]=t[i];return r}var s1=[],VQ=t=>k_((e,r)=>e.length===r.length&&Fn(e).every((o,n)=>t(o,dc(r,n)))),KQ=VQ(V),JQ={[i1]:{_A:t=>t},toString(){return Ce(this.toJSON())},toJSON(){return{_id:"Chunk",values:Fn(this).map(ke)}},[xe](){return this.toJSON()},[Q](t){return a1(t)&&KQ(this,t)},[re](){return ye(this,Zr(Fn(this)))},[Symbol.iterator](){switch(this.backing._tag){case"IArray":return this.backing.array[Symbol.iterator]();case"IEmpty":return s1[Symbol.iterator]();default:return Fn(this)[Symbol.iterator]()}},pipe(){return K(this,arguments)}},Bt=t=>{let e=Object.create(JQ);switch(e.backing=t,t._tag){case"IEmpty":{e.length=0,e.depth=0,e.left=e,e.right=e;break}case"IConcat":{e.length=t.left.length+t.right.length,e.depth=1+Math.max(t.left.depth,t.right.depth),e.left=t.left,e.right=t.right;break}case"IArray":{e.length=t.array.length,e.depth=0,e.left=Po,e.right=Po;break}case"ISingleton":{e.length=1,e.depth=0,e.left=Po,e.right=Po;break}case"ISlice":{e.length=t.length,e.depth=t.chunk.depth+1,e.left=Po,e.right=Po;break}}return e},a1=t=>Y(t,i1),Po=Bt({_tag:"IEmpty"}),Pr=()=>Po,rh=(...t)=>eee(t),xt=t=>Bt({_tag:"ISingleton",a:t}),fc=t=>a1(t)?t:nh(Re(t)),HA=(t,e,r)=>{switch(t.backing._tag){case"IArray":{GQ(t.backing.array,0,e,r,t.length);break}case"IConcat":{HA(t.left,e,r),HA(t.right,e,r+t.left.length);break}case"ISingleton":{e[r]=t.backing.a;break}case"ISlice":{let o=0,n=r;for(;o<t.length;)e[n]=dc(t,o),o+=1,n+=1;break}}};var YQ=t=>{switch(t.backing._tag){case"IEmpty":return s1;case"IArray":return t.backing.array;default:{let e=new Array(t.length);return HA(t,e,0),t.backing={_tag:"IArray",array:e},t.left=Po,t.right=Po,t.depth=0,e}}},Fn=YQ,XQ=t=>{switch(t.backing._tag){case"IEmpty":case"ISingleton":return t;case"IArray":return Bt({_tag:"IArray",array:TA(t.backing.array)});case"IConcat":return Bt({_tag:"IConcat",left:No(t.backing.right),right:No(t.backing.left)});case"ISlice":return nh(TA(Fn(t)))}},No=XQ,QQ=h(2,(t,e)=>e<0||e>=t.length?z():B(dc(t,e))),nh=t=>t.length===0?Pr():t.length===1?xt(t[0]):Bt({_tag:"IArray",array:t}),eee=t=>nh(t),dc=h(2,(t,e)=>{switch(t.backing._tag){case"IEmpty":throw new Error("Index out of bounds");case"ISingleton":{if(e!==0)throw new Error("Index out of bounds");return t.backing.a}case"IArray":{if(e>=t.length||e<0)throw new Error("Index out of bounds");return t.backing.array[e]}case"IConcat":return e<t.left.length?dc(t.left,e):dc(t.right,e-t.left.length);case"ISlice":return dc(t.backing.chunk,e+t.backing.offset)}}),Z_=h(2,(t,e)=>fn(t,xt(e))),Yt=h(2,(t,e)=>fn(xt(e),t));var BA=h(2,(t,e)=>{if(e<=0)return t;if(e>=t.length)return Po;switch(t.backing._tag){case"ISlice":return Bt({_tag:"ISlice",chunk:t.backing.chunk,offset:t.backing.offset+e,length:t.backing.length-e});case"IConcat":return e>t.left.length?BA(t.right,e-t.left.length):Bt({_tag:"IConcat",left:BA(t.left,e),right:t.right});default:return Bt({_tag:"ISlice",chunk:t,offset:e,length:t.length-e})}});var fn=h(2,(t,e)=>{if(t.backing._tag==="IEmpty")return e;if(e.backing._tag==="IEmpty")return t;let r=e.depth-t.depth;if(Math.abs(r)<=1)return Bt({_tag:"IConcat",left:t,right:e});if(r<-1)if(t.left.depth>=t.right.depth){let o=fn(t.right,e);return Bt({_tag:"IConcat",left:t.left,right:o})}else{let o=fn(t.right.right,e);if(o.depth===t.depth-3){let n=Bt({_tag:"IConcat",left:t.right.left,right:o});return Bt({_tag:"IConcat",left:t.left,right:n})}else{let n=Bt({_tag:"IConcat",left:t.left,right:t.right.left});return Bt({_tag:"IConcat",left:n,right:o})}}else if(e.right.depth>=e.left.depth){let o=fn(t,e.left);return Bt({_tag:"IConcat",left:o,right:e.right})}else{let o=fn(t,e.left.left);if(o.depth===e.depth-3){let n=Bt({_tag:"IConcat",left:o,right:e.left.right});return Bt({_tag:"IConcat",left:n,right:e.right})}else{let n=Bt({_tag:"IConcat",left:e.left.right,right:e.right});return Bt({_tag:"IConcat",left:o,right:n})}}});var WA=t=>t.length===0,rr=t=>t.length>0,G_=QQ(0),ZA=t=>dc(t,0),Xt=ZA;var mr=t=>BA(t,1);var GA=Symbol.for("effect/Duration"),d1=BigInt(0),c1=BigInt(24),V_=BigInt(60),VA=BigInt(1e3),u1=BigInt(1e6),l1=BigInt(1e9),tee=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,Wt=t=>{if(f1(t))return t;if(Vm(t))return Mo(t);if(lA(t))return oh(t);if(Array.isArray(t)&&t.length===2&&t.every(Vm))return t[0]===-1/0||t[1]===-1/0||Number.isNaN(t[0])||Number.isNaN(t[1])?Hs:t[0]===1/0||t[1]===1/0?iee:oh(BigInt(Math.round(t[0]*1e9))+BigInt(Math.round(t[1])));if(Gm(t)){let e=tee.exec(t);if(e){let[r,o,n]=e,i=Number(o);switch(n){case"nano":case"nanos":return oh(BigInt(o));case"micro":case"micros":return see(BigInt(o));case"milli":case"millis":return Mo(i);case"second":case"seconds":return KA(i);case"minute":case"minutes":return aee(i);case"hour":case"hours":return cee(i);case"day":case"days":return uee(i);case"week":case"weeks":return lee(i)}}}throw new Error("Invalid DurationInput")};var p1={_tag:"Millis",millis:0},ree={_tag:"Infinity"},nee={[GA]:GA,[re](){return ye(this,A_(this.value))},[Q](t){return f1(t)&&hee(this,t)},toString(){return`Duration(${XA(this)})`},toJSON(){switch(this.value._tag){case"Millis":return{_id:"Duration",_tag:"Millis",millis:this.value.millis};case"Nanos":return{_id:"Duration",_tag:"Nanos",hrtime:dee(this)};case"Infinity":return{_id:"Duration",_tag:"Infinity"}}},[xe](){return this.toJSON()},pipe(){return K(this,arguments)}},Fo=t=>{let e=Object.create(nee);return Vm(t)?isNaN(t)||t<=0?e.value=p1:Number.isFinite(t)?Number.isInteger(t)?e.value={_tag:"Millis",millis:t}:e.value={_tag:"Nanos",nanos:BigInt(Math.round(t*1e6))}:e.value=ree:t<=d1?e.value=p1:e.value={_tag:"Nanos",nanos:t},e},f1=t=>Y(t,GA);var oee=t=>{switch(t.value._tag){case"Millis":return t.value.millis===0;case"Nanos":return t.value.nanos===d1;case"Infinity":return!1}},Hs=Fo(0),iee=Fo(1/0),oh=t=>Fo(t),see=t=>Fo(t*VA),Mo=t=>Fo(t),KA=t=>Fo(t*1e3),aee=t=>Fo(t*6e4),cee=t=>Fo(t*36e5),uee=t=>Fo(t*864e5),lee=t=>Fo(t*6048e5),Do=t=>fee(t,{onMillis:e=>e,onNanos:e=>Number(e)/1e6});var pee=t=>{let e=Wt(t);switch(e.value._tag){case"Infinity":throw new Error("Cannot convert infinite duration to nanos");case"Nanos":return e.value.nanos;case"Millis":return BigInt(Math.round(e.value.millis*1e6))}},dee=t=>{let e=Wt(t);switch(e.value._tag){case"Infinity":return[1/0,0];case"Nanos":return[Number(e.value.nanos/l1),Number(e.value.nanos%l1)];case"Millis":return[Math.floor(e.value.millis/1e3),Math.round(e.value.millis%1e3*1e6)]}},fee=h(2,(t,e)=>{let r=Wt(t);switch(r.value._tag){case"Nanos":return e.onNanos(r.value.nanos);case"Infinity":return e.onMillis(1/0);case"Millis":return e.onMillis(r.value.millis)}}),JA=h(3,(t,e,r)=>{let o=Wt(t),n=Wt(e);if(o.value._tag==="Infinity"||n.value._tag==="Infinity")return r.onMillis(Do(o),Do(n));if(o.value._tag==="Nanos"||n.value._tag==="Nanos"){let i=o.value._tag==="Nanos"?o.value.nanos:BigInt(Math.round(o.value.millis*1e6)),s=n.value._tag==="Nanos"?n.value.nanos:BigInt(Math.round(n.value.millis*1e6));return r.onNanos(i,s)}return r.onMillis(o.value.millis,n.value.millis)});var mee=(t,e)=>JA(t,e,{onMillis:(r,o)=>r===o,onNanos:(r,o)=>r===o});var m1=h(2,(t,e)=>JA(t,e,{onMillis:(r,o)=>r<=o,onNanos:(r,o)=>r<=o}));var YA=h(2,(t,e)=>JA(t,e,{onMillis:(r,o)=>r>=o,onNanos:(r,o)=>r>=o})),hee=h(2,(t,e)=>mee(Wt(t),Wt(e))),gee=t=>{let e=Wt(t);if(e.value._tag==="Infinity")return{days:1/0,hours:1/0,minutes:1/0,seconds:1/0,millis:1/0,nanos:1/0};let r=pee(e),o=r/u1,n=o/VA,i=n/V_,s=i/V_,a=s/c1;return{days:Number(a),hours:Number(s%c1),minutes:Number(i%V_),seconds:Number(n%V_),millis:Number(o%VA),nanos:Number(r%u1)}},XA=t=>{let e=Wt(t);if(e.value._tag==="Infinity")return"Infinity";if(oee(e))return"0";let r=gee(e),o=[];return r.days!==0&&o.push(`${r.days}d`),r.hours!==0&&o.push(`${r.hours}h`),r.minutes!==0&&o.push(`${r.minutes}m`),r.seconds!==0&&o.push(`${r.seconds}s`),r.millis!==0&&o.push(`${r.millis}ms`),r.nanos!==0&&o.push(`${r.nanos}ns`),o.join(" ")};var QA=Math.pow(2,5),h1=QA-1,g1=QA/2,y1=QA/4;function yee(t){return t-=t>>1&1431655765,t=(t&858993459)+(t>>2&858993459),t=t+(t>>4)&252645135,t+=t>>8,t+=t>>16,t&127}function Bs(t,e){return e>>>t&h1}function Ws(t){return 1<<t}function K_(t,e){return yee(t&e-1)}var x1=(t,e)=>({value:t,previous:e});function mc(t,e,r,o){let n=o;if(!t){let i=o.length;n=new Array(i);for(let s=0;s<i;++s)n[s]=o[s]}return n[e]=r,n}function eT(t,e,r){let o=r.length-1,n=0,i=0,s=r;if(t)n=i=e;else for(s=new Array(o);n<e;)s[i++]=r[n++];for(++n;n<=o;)s[i++]=r[n++];return t&&(s.length=o),s}function _1(t,e,r,o){let n=o.length;if(t){let c=n;for(;c>=e;)o[c--]=o[c];return o[e]=r,o}let i=0,s=0,a=new Array(n+1);for(;i<e;)a[s++]=o[i++];for(a[e]=r;i<n;)a[++s]=o[i++];return a}var Ii=class t{_tag="EmptyNode";modify(e,r,o,n,i,s){let a=o(z());return at(a)?new t:(++s.value,new yp(e,n,i,a))}};function zn(t){return Ms(t,"EmptyNode")}function _ee(t){return zn(t)||t._tag==="LeafNode"||t._tag==="CollisionNode"}function J_(t,e){return zn(t)?!1:e===t.edit}var yp=class t{edit;hash;key;value;_tag="LeafNode";constructor(e,r,o,n){this.edit=e,this.hash=r,this.key=o,this.value=n}modify(e,r,o,n,i,s){if(V(i,this.key)){let c=o(this.value);return c===this.value?this:at(c)?(--s.value,new Ii):J_(this,e)?(this.value=c,this):new t(e,n,i,c)}let a=o(z());return at(a)?this:(++s.value,b1(e,r,this.hash,this,n,new t(e,n,i,a)))}},tT=class t{edit;hash;children;_tag="CollisionNode";constructor(e,r,o){this.edit=e,this.hash=r,this.children=o}modify(e,r,o,n,i,s){if(n===this.hash){let c=J_(this,e),u=this.updateCollisionList(c,e,this.hash,this.children,o,i,s);return u===this.children?this:u.length>1?new t(e,this.hash,u):u[0]}let a=o(z());return at(a)?this:(++s.value,b1(e,r,this.hash,this,n,new yp(e,n,i,a)))}updateCollisionList(e,r,o,n,i,s,a){let c=n.length;for(let l=0;l<c;++l){let p=n[l];if("key"in p&&V(s,p.key)){let f=p.value,d=i(f);return d===f?n:at(d)?(--a.value,eT(e,l,n)):mc(e,l,new yp(r,o,s,d),n)}}let u=i(z());return at(u)?n:(++a.value,mc(e,c,new yp(r,o,s,u),n))}},ih=class t{edit;mask;children;_tag="IndexedNode";constructor(e,r,o){this.edit=e,this.mask=r,this.children=o}modify(e,r,o,n,i,s){let a=this.mask,c=this.children,u=Bs(r,n),l=Ws(u),p=K_(a,l),f=a&l,d=J_(this,e);if(!f){let E=new Ii().modify(e,r+5,o,n,i,s);return E?c.length>=g1?vee(e,u,E,a,c):new t(e,a|l,_1(d,p,E,c)):this}let m=c[p],g=m.modify(e,r+5,o,n,i,s);if(m===g)return this;let y=a,v;if(zn(g)){if(y&=~l,!y)return new Ii;if(c.length<=2&&_ee(c[p^1]))return c[p^1];v=eT(d,p,c)}else v=mc(d,p,g,c);return d?(this.mask=y,this.children=v,this):new t(e,y,v)}},rT=class t{edit;size;children;_tag="ArrayNode";constructor(e,r,o){this.edit=e,this.size=r,this.children=o}modify(e,r,o,n,i,s){let a=this.size,c=this.children,u=Bs(r,n),l=c[u],p=(l||new Ii).modify(e,r+5,o,n,i,s);if(l===p)return this;let f=J_(this,e),d;if(zn(l)&&!zn(p))++a,d=mc(f,u,p,c);else if(!zn(l)&&zn(p)){if(--a,a<=y1)return bee(e,a,u,c);d=mc(f,u,new Ii,c)}else d=mc(f,u,p,c);return f?(this.size=a,this.children=d,this):new t(e,a,d)}};function bee(t,e,r,o){let n=new Array(e-1),i=0,s=0;for(let a=0,c=o.length;a<c;++a)if(a!==r){let u=o[a];u&&!zn(u)&&(n[i++]=u,s|=1<<a)}return new ih(t,s,n)}function vee(t,e,r,o,n){let i=[],s=o,a=0;for(let c=0;s;++c)s&1&&(i[c]=n[a++]),s>>>=1;return i[e]=r,new rT(t,a+1,i)}function See(t,e,r,o,n,i){if(r===n)return new tT(t,r,[i,o]);let s=Bs(e,r),a=Bs(e,n);if(s===a)return c=>new ih(t,Ws(s)|Ws(a),[c]);{let c=s<a?[o,i]:[i,o];return new ih(t,Ws(s)|Ws(a),c)}}function b1(t,e,r,o,n,i){let s,a=e;for(;;){let c=See(t,a,r,o,n,i);if(typeof c=="function")s=x1(c,s),a=a+5;else{let u=c;for(;s!=null;)u=s.value(u),s=s.previous;return u}}}var v1="effect/HashMap",Y_=Symbol.for(v1),Eee={[Y_]:Y_,[Symbol.iterator](){return new X_(this,(t,e)=>[t,e])},[re](){let t=G(v1);for(let e of this)t^=b(G(e[0]),ae(G(e[1])));return ye(this,t)},[Q](t){if(k1(t)){if(t._size!==this._size)return!1;for(let e of this){let r=b(t,eb(e[0],G(e[0])));if(at(r))return!1;if(!V(e[1],r.value))return!1}return!0}return!1},toString(){return Ce(this.toJSON())},toJSON(){return{_id:"HashMap",values:Array.from(this).map(ke)}},[xe](){return this.toJSON()},pipe(){return K(this,arguments)}},nT=(t,e,r,o)=>{let n=Object.create(Eee);return n._editable=t,n._edit=e,n._root=r,n._size=o,n},X_=class t{map;f;v;constructor(e,r){this.map=e,this.f=r,this.v=S1(this.map._root,this.f,void 0)}next(){if(at(this.v))return{done:!0,value:void 0};let e=this.v.value;return this.v=Q_(e.cont),{done:!1,value:e.value}}[Symbol.iterator](){return new t(this.map,this.f)}},Q_=t=>t?w1(t[0],t[1],t[2],t[3],t[4]):z(),S1=(t,e,r=void 0)=>{switch(t._tag){case"LeafNode":return dt(t.value)?B({value:e(t.key,t.value.value),cont:r}):Q_(r);case"CollisionNode":case"ArrayNode":case"IndexedNode":{let o=t.children;return w1(o.length,o,0,e,r)}default:return Q_(r)}},w1=(t,e,r,o,n)=>{for(;r<t;){let i=e[r++];if(i&&!zn(i))return S1(i,o,[t,e,r,o,n])}return Q_(n)},kee=nT(!1,0,new Ii,0),_p=()=>kee;var E1=t=>{let e=ah(_p());for(let r of t)hc(e,r[0],r[1]);return iT(e)},k1=t=>Y(t,Y_),I1=t=>t&&zn(t._root),O1=h(2,(t,e)=>eb(t,e,G(e))),eb=h(3,(t,e,r)=>{let o=t._root,n=0;for(;;)switch(o._tag){case"LeafNode":return V(e,o.key)?o.value:z();case"CollisionNode":{if(r===o.hash){let i=o.children;for(let s=0,a=i.length;s<a;++s){let c=i[s];if("key"in c&&V(e,c.key))return c.value}}return z()}case"IndexedNode":{let i=Bs(n,r),s=Ws(i);if(o.mask&s){o=o.children[K_(o.mask,s)],n+=5;break}return z()}case"ArrayNode":{if(o=o.children[Bs(n,r)],o){n+=5;break}return z()}default:return z()}});var oT=h(2,(t,e)=>dt(eb(t,e,G(e))));var hc=h(3,(t,e,r)=>rb(t,e,()=>B(r))),Iee=h(3,(t,e,r)=>t._editable?(t._root=e,t._size=r,t):e===t._root?t:nT(t._editable,t._edit,e,r)),tb=t=>new X_(t,e=>e);var sh=t=>t._size;var ah=t=>nT(!0,t._edit+1,t._root,t._size),iT=t=>(t._editable=!1,t),C1=h(2,(t,e)=>{let r=ah(t);return e(r),iT(r)}),rb=h(3,(t,e,r)=>R1(t,e,G(e),r)),R1=h(4,(t,e,r,o)=>{let n={value:t._size},i=t._root.modify(t._editable?t._edit:NaN,0,o,r,e,n);return b(t,Iee(i,n.value))});var nb=h(2,(t,e)=>rb(t,e,z));var A1=h(2,(t,e)=>bp(t,_p(),(r,o,n)=>hc(r,n,e(o,n))));var ob=h(2,(t,e)=>bp(t,void 0,(r,o,n)=>e(o,n))),bp=h(3,(t,e,r)=>{let o=t._root;if(o._tag==="LeafNode")return dt(o.value)?r(e,o.value.value,o.key):e;if(o._tag==="EmptyNode")return e;let n=[o.children],i;for(;i=n.pop();)for(let s=0,a=i.length;s<a;){let c=i[s++];c&&!zn(c)&&(c._tag==="LeafNode"?dt(c.value)&&(e=r(e,c.value.value,c.key)):n.push(c.children))}return e});var $1="effect/HashSet",ib=Symbol.for($1),Oee={[ib]:ib,[Symbol.iterator](){return tb(this._keyMap)},[re](){return ye(this,ae(G(this._keyMap))(G($1)))},[Q](t){return P1(t)?sh(this._keyMap)===sh(t._keyMap)&&V(this._keyMap,t._keyMap):!1},toString(){return Ce(this.toJSON())},toJSON(){return{_id:"HashSet",values:Array.from(this).map(ke)}},[xe](){return this.toJSON()},pipe(){return K(this,arguments)}},sb=t=>{let e=Object.create(Oee);return e._keyMap=t,e},P1=t=>Y(t,ib),Cee=sb(_p()),ch=()=>Cee,N1=t=>{let e=ab(ch());for(let r of t)vp(e,r);return cb(e)},M1=(...t)=>{let e=ab(ch());for(let r of t)vp(e,r);return cb(e)},D1=h(2,(t,e)=>oT(t._keyMap,e));var F1=t=>sh(t._keyMap),ab=t=>sb(ah(t._keyMap)),cb=t=>(t._keyMap._editable=!1,t),sT=h(2,(t,e)=>{let r=ab(t);return e(r),cb(r)}),vp=h(2,(t,e)=>t._keyMap._editable?(hc(e,!0)(t._keyMap),t):sb(hc(e,!0)(t._keyMap))),aT=h(2,(t,e)=>t._keyMap._editable?(nb(e)(t._keyMap),t):sb(nb(e)(t._keyMap))),z1=h(2,(t,e)=>sT(t,r=>{for(let o of e)aT(r,o)}));var j1=h(2,(t,e)=>sT(ch(),r=>{L1(t,o=>vp(r,o));for(let o of e)vp(r,o)}));var L1=h(2,(t,e)=>ob(t._keyMap,(r,o)=>e(o))),U1=h(3,(t,e,r)=>bp(t._keyMap,e,(o,n,i)=>r(o,i)));var jo=ch,ub=N1,gc=M1,q1=D1;var yc=F1;var xc=vp,cT=aT,uT=z1;var Oi=j1;var _c=U1;var H1=Symbol.for("effect/MutableRef"),Aee={[H1]:H1,toString(){return Ce(this.toJSON())},toJSON(){return{_id:"MutableRef",current:ke(this.current)}},[xe](){return this.toJSON()},pipe(){return K(this,arguments)}},Lo=t=>{let e=Object.create(Aee);return e.current=t,e},lb=h(3,(t,e,r)=>V(e,t.current)?(t.current=r,!0):!1);var Vr=t=>t.current;var jn=h(2,(t,e)=>(t.current=e,t));var db="effect/FiberId",Zs=Symbol.for(db),Sp="None",lT="Runtime",pT="Composite",Tee=Le(`${db}-${Sp}`),dT=class{[Zs]=Zs;_tag=Sp;id=-1;startTimeMillis=-1;[re](){return Tee}[Q](e){return mb(e)&&e._tag===Sp}toString(){return Ce(this.toJSON())}toJSON(){return{_id:"FiberId",_tag:this._tag}}[xe](){return this.toJSON()}},fT=class{id;startTimeMillis;[Zs]=Zs;_tag=lT;constructor(e,r){this.id=e,this.startTimeMillis=r}[re](){return ye(this,Le(`${db}-${this._tag}-${this.id}-${this.startTimeMillis}`))}[Q](e){return mb(e)&&e._tag===lT&&this.id===e.id&&this.startTimeMillis===e.startTimeMillis}toString(){return Ce(this.toJSON())}toJSON(){return{_id:"FiberId",_tag:this._tag,id:this.id,startTimeMillis:this.startTimeMillis}}[xe](){return this.toJSON()}},mT=class{left;right;[Zs]=Zs;_tag=pT;constructor(e,r){this.left=e,this.right=r}_hash;[re](){return b(Le(`${db}-${this._tag}`),ae(G(this.left)),ae(G(this.right)),ye(this))}[Q](e){return mb(e)&&e._tag===pT&&V(this.left,e.left)&&V(this.right,e.right)}toString(){return Ce(this.toJSON())}toJSON(){return{_id:"FiberId",_tag:this._tag,left:ke(this.left),right:ke(this.right)}}[xe](){return this.toJSON()}},fb=new dT;var mb=t=>Y(t,Zs);var W1=h(2,(t,e)=>t._tag===Sp?e:e._tag===Sp?t:new mT(t,e));var pb=t=>{switch(t._tag){case Sp:return jo();case lT:return gc(t.id);case pT:return b(pb(t.left),Oi(pb(t.right)))}},B1=pe(Symbol.for("effect/Fiber/Id/_fiberCounter"),()=>Lo(0));var hb=t=>Array.from(pb(t)).map(r=>`#${r}`).join(",");var Z1=()=>{let t=Vr(B1);return b(B1,jn(t+1)),new fT(t,Date.now())};var Kr=fb;var hT=W1;var V1=hb;var gb=Z1;var vc=_p;var K1=E1,J1=I1,gT=O1;var hr=hc,yT=tb;var Y1=C1,X1=rb;var Q1=A1;var e2=ob,xT=bp;var uh=Symbol.for("effect/List"),_T=t=>Re(t),$ee=t=>VL(fp(t),_T),Pee=$ee(V),Nee={[uh]:uh,_tag:"Cons",toString(){return Ce(this.toJSON())},toJSON(){return{_id:"List",_tag:"Cons",values:_T(this).map(ke)}},[xe](){return this.toJSON()},[Q](t){return r2(t)&&this._tag===t._tag&&Pee(this,t)},[re](){return ye(this,Zr(_T(this)))},[Symbol.iterator](){let t=!1,e=this;return{next(){if(t)return this.return();if(e._tag==="Nil")return t=!0,this.return();let r=e.head;return e=e.tail,{done:t,value:r}},return(r){return t||(t=!0),{done:!0,value:r}}}},pipe(){return K(this,arguments)}},yb=(t,e)=>{let r=Object.create(Nee);return r.head=t,r.tail=e,r},Mee=Le("Nil"),Dee={[uh]:uh,_tag:"Nil",toString(){return Ce(this.toJSON())},toJSON(){return{_id:"List",_tag:"Nil"}},[xe](){return this.toJSON()},[re](){return Mee},[Q](t){return r2(t)&&this._tag===t._tag},[Symbol.iterator](){return{next(){return{done:!0,value:void 0}}}},pipe(){return K(this,arguments)}},t2=Object.create(Dee),r2=t=>Y(t,uh),Uo=t=>t._tag==="Nil",bT=t=>t._tag==="Cons";var Fee=()=>t2,Ri=(t,e)=>yb(t,e),qo=Fee,lh=t=>yb(t,t2);var n2=h(2,(t,e)=>zee(e,t)),xb=h(2,(t,e)=>Ri(e,t)),zee=h(2,(t,e)=>{if(Uo(t))return e;if(Uo(e))return t;{let r=yb(e.head,t),o=r,n=e.tail;for(;!Uo(n);){let i=yb(n.head,t);o.tail=i,o=i,n=n.tail}return r}});var o2=h(3,(t,e,r)=>{let o=e,n=t;for(;!Uo(n);)o=r(o,n.head),n=n.tail;return o});var i2=t=>{let e=qo(),r=t;for(;!Uo(r);)e=xb(e,r.head),r=r.tail;return e};var pCe=Object.assign(Object.create(Array.prototype),{[re](){return ye(this,Zr(this))},[Q](t){return Array.isArray(t)&&this.length===t.length?this.every((e,r)=>V(e,t[r])):!1}}),Ep=(function(){function t(e){e&&Object.assign(this,e)}return t.prototype=ap,t})(),_b=t=>Object.assign(Object.create(ap),t);var jee=Symbol.for("effect/DifferContextPatch");function a2(t){return t}var fh={...Ep.prototype,[jee]:{_Value:a2,_Patch:a2}},Lee=Object.assign(Object.create(fh),{_tag:"Empty"}),Uee=Object.create(Lee),vT=()=>Uee,qee=Object.assign(Object.create(fh),{_tag:"AndThen"}),Hee=(t,e)=>{let r=Object.create(qee);return r.first=t,r.second=e,r},Bee=Object.assign(Object.create(fh),{_tag:"AddService"}),Wee=(t,e)=>{let r=Object.create(Bee);return r.key=t,r.service=e,r},Zee=Object.assign(Object.create(fh),{_tag:"RemoveService"}),Gee=t=>{let e=Object.create(Zee);return e.key=t,e},Vee=Object.assign(Object.create(fh),{_tag:"UpdateService"}),Kee=(t,e)=>{let r=Object.create(Vee);return r.key=t,r.update=e,r},c2=(t,e)=>{let r=new Map(t.unsafeMap),o=vT();for(let[n,i]of e.unsafeMap.entries())if(r.has(n)){let s=r.get(n);r.delete(n),V(s,i)||(o=dh(Kee(n,()=>i))(o))}else r.delete(n),o=dh(Wee(n,i))(o);for(let[n]of r.entries())o=dh(Gee(n))(o);return o},dh=h(2,(t,e)=>Hee(t,e)),u2=h(2,(t,e)=>{if(t._tag==="Empty")return e;let r=!1,o=xt(t),n=new Map(e.unsafeMap);for(;rr(o);){let s=Xt(o),a=mr(o);switch(s._tag){case"Empty":{o=a;break}case"AddService":{n.set(s.key,s.service),o=a;break}case"AndThen":{o=Yt(Yt(a,s.second),s.first);break}case"RemoveService":{n.delete(s.key),o=a;break}case"UpdateService":{n.set(s.key,s.update(n.get(s.key))),r=!0,o=a;break}}}if(!r)return Nn(n);let i=new Map;for(let[s]of e.unsafeMap)n.has(s)&&(i.set(s,n.get(s)),n.delete(s));for(let[s,a]of n)i.set(s,a);return Nn(i)});var Yee=Symbol.for("effect/DifferHashSetPatch");function ST(t){return t}var vb={...Ep.prototype,[Yee]:{_Value:ST,_Key:ST,_Patch:ST}},Xee=Object.assign(Object.create(vb),{_tag:"Empty"}),Qee=Object.create(Xee),wT=()=>Qee,ete=Object.assign(Object.create(vb),{_tag:"AndThen"}),tte=(t,e)=>{let r=Object.create(ete);return r.first=t,r.second=e,r},rte=Object.assign(Object.create(vb),{_tag:"Add"}),nte=t=>{let e=Object.create(rte);return e.value=t,e},ote=Object.assign(Object.create(vb),{_tag:"Remove"}),ite=t=>{let e=Object.create(ote);return e.value=t,e},l2=(t,e)=>{let[r,o]=_c([t,wT()],([n,i],s)=>q1(s)(n)?[cT(s)(n),i]:[n,bb(nte(s))(i)])(e);return _c(o,(n,i)=>bb(ite(i))(n))(r)},bb=h(2,(t,e)=>tte(t,e)),p2=h(2,(t,e)=>{if(t._tag==="Empty")return e;let r=e,o=xt(t);for(;rr(o);){let n=Xt(o),i=mr(o);switch(n._tag){case"Empty":{o=i;break}case"AndThen":{o=Yt(n.first)(Yt(n.second)(i));break}case"Add":{r=xc(n.value)(r),o=i;break}case"Remove":r=cT(n.value)(r),o=i}}return r});var ate=Symbol.for("effect/DifferReadonlyArrayPatch");function d2(t){return t}var hh={...Ep.prototype,[ate]:{_Value:d2,_Patch:d2}},cte=Object.assign(Object.create(hh),{_tag:"Empty"}),ute=Object.create(cte),ET=()=>ute,lte=Object.assign(Object.create(hh),{_tag:"AndThen"}),pte=(t,e)=>{let r=Object.create(lte);return r.first=t,r.second=e,r},dte=Object.assign(Object.create(hh),{_tag:"Append"}),fte=t=>{let e=Object.create(dte);return e.values=t,e},mte=Object.assign(Object.create(hh),{_tag:"Slice"}),hte=(t,e)=>{let r=Object.create(mte);return r.from=t,r.until=e,r},gte=Object.assign(Object.create(hh),{_tag:"Update"}),yte=(t,e)=>{let r=Object.create(gte);return r.index=t,r.patch=e,r},f2=t=>{let e=0,r=ET();for(;e<t.oldValue.length&&e<t.newValue.length;){let o=t.oldValue[e],n=t.newValue[e],i=t.differ.diff(o,n);V(i,t.differ.empty)||(r=mh(r,yte(e,i))),e=e+1}return e<t.oldValue.length&&(r=mh(r,hte(0,e))),e<t.newValue.length&&(r=mh(r,fte(MU(e)(t.newValue)))),r},mh=h(2,(t,e)=>pte(t,e)),m2=h(3,(t,e,r)=>{if(t._tag==="Empty")return e;let o=e.slice(),n=$r(t);for(;z_(n);){let i=Kt(n),s=To(n);switch(i._tag){case"Empty":{n=s;break}case"AndThen":{s.unshift(i.first,i.second),n=s;break}case"Append":{for(let a of i.values)o.push(a);n=s;break}case"Slice":{o=o.slice(i.from,i.until),n=s;break}case"Update":{o[i.index]=r.patch(i.patch,o[i.index]),n=s;break}}}return o});var h2=Symbol.for("effect/Differ"),_te={[h2]:{_P:be,_V:be},pipe(){return K(this,arguments)}},Gs=t=>{let e=Object.create(_te);return e.empty=t.empty,e.diff=t.diff,e.combine=t.combine,e.patch=t.patch,e},kT=()=>Gs({empty:vT(),combine:(t,e)=>dh(e)(t),diff:(t,e)=>c2(t,e),patch:(t,e)=>u2(e)(t)});var IT=()=>Gs({empty:wT(),combine:(t,e)=>bb(e)(t),diff:(t,e)=>l2(t,e),patch:(t,e)=>p2(e)(t)});var OT=t=>Gs({empty:ET(),combine:(e,r)=>mh(e,r),diff:(e,r)=>f2({oldValue:e,newValue:r,differ:t}),patch:(e,r)=>m2(e,r,t)});var Sb=()=>g2((t,e)=>e),g2=t=>Gs({empty:be,combine:(e,r)=>e===be?r:r===be?e:o=>r(e(o)),diff:(e,r)=>V(e,r)?be:Wm(r),patch:(e,r)=>t(r,e(r))});var gh=255,y2=8,wb=t=>t&gh,Eb=t=>t>>y2&gh,wc=(t,e)=>(t&gh)+((e&t&gh)<<y2),kb=wc(0,0),x2=t=>wc(t,t),_2=t=>wc(t,0);var b2=h(2,(t,e)=>wc(wb(t)&~e,Eb(t)));var RT=h(2,(t,e)=>t|e);var v2=t=>~t>>>0&gh;var bte=0,so=1,w2=2,AT=4,Ib=16,TT=32;var E2=t=>Ob(t,TT),$T=h(2,(t,e)=>t&~e);var PT=h(2,(t,e)=>t|e);var Ai=t=>yh(t)&&!vte(t),yh=t=>Ob(t,so);var Ob=h(2,(t,e)=>(t&e)!==0),NT=(...t)=>t.reduce((e,r)=>e|r,0),k2=NT(bte);var MT=t=>Ob(t,AT);var vte=t=>Ob(t,Ib);var Ln=h(2,(t,e)=>wc(t^e,e)),Ti=h(2,(t,e)=>t&(v2(wb(e))|Eb(e))|wb(e)&Eb(e));var DT=Gs({empty:kb,diff:(t,e)=>Ln(t,e),combine:(t,e)=>RT(e)(t),patch:(t,e)=>Ti(e,t)});var I2=kb;var FT=x2,zT=_2;var jT=b2;var O2={_tag:"Empty"},HT=(t,e)=>({_tag:"Par",left:t,right:e}),Cb=(t,e)=>({_tag:"Seq",left:t,right:e}),BT=(t,e)=>({_tag:"Single",dataSource:t,blockedRequest:e});var C2=t=>{let e=lh(t),r=qo();for(;;){let[o,n]=o2(e,[R2(),qo()],([i,s],a)=>{let[c,u]=Ste(a);return[Rte(i,c),n2(s,u)]});if(r=wte(r,o),Uo(n))return i2(r);e=n}throw new Error("BUG: BlockedRequests.flatten - please report an issue at https://github.com/Effect-TS/effect/issues")},Ste=t=>{let e=t,r=R2(),o=qo(),n=qo();for(;;)switch(e._tag){case"Empty":{if(Uo(o))return[r,n];e=o.head,o=o.tail;break}case"Par":{o=Ri(e.right,o),e=e.left;break}case"Seq":{let i=e.left,s=e.right;switch(i._tag){case"Empty":{e=s;break}case"Par":{let a=i.left,c=i.right;e=HT(Cb(a,s),Cb(c,s));break}case"Seq":{let a=i.left,c=i.right;e=Cb(a,Cb(c,s));break}case"Single":{e=i,n=Ri(s,n);break}}break}case"Single":{if(r=Cte(r,e),Uo(o))return[r,n];e=o.head,o=o.tail;break}}throw new Error("BUG: BlockedRequests.step - please report an issue at https://github.com/Effect-TS/effect/issues")},wte=(t,e)=>{if(Uo(t))return lh(UT(e));if(Ate(e))return t;let r=Dte(t.head),o=Tte(e);return r.length===1&&o.length===1&&V(r[0],o[0])?Ri(Mte(t.head,UT(e)),t.tail):Ri(UT(e),t)},Ete=Symbol.for("effect/RequestBlock/Entry"),qT=class{request;result;listeners;ownerId;state;[Ete]=kte;constructor(e,r,o,n,i){this.request=e,this.result=r,this.listeners=o,this.ownerId=n,this.state=i}},kte={_R:t=>t};var WT=t=>new qT(t.request,t.result,t.listeners,t.ownerId,t.state),Ite=Symbol.for("effect/RequestBlock/RequestBlockParallel"),Ote={_R:t=>t},_h=class{map;[Ite]=Ote;constructor(e){this.map=e}},R2=()=>new _h(vc());var Cte=(t,e)=>new _h(X1(t.map,e.dataSource,r=>kU(Pn(r,Z_(e.blockedRequest)),()=>xt(e.blockedRequest)))),Rte=(t,e)=>new _h(xT(t.map,e.map,(r,o,n)=>hr(r,n,Ut(gT(r,n),{onNone:()=>o,onSome:i=>fn(o,i)})))),Ate=t=>J1(t.map),Tte=t=>Array.from(yT(t.map)),UT=t=>Nte(Q1(t.map,e=>xt(e))),$te=Symbol.for("effect/RequestBlock/RequestBlockSequential"),Pte={_R:t=>t},Rb=class{map;[$te]=Pte;constructor(e){this.map=e}},Nte=t=>new Rb(t),Mte=(t,e)=>new Rb(xT(e.map,t.map,(r,o,n)=>hr(r,n,Ut(gT(r,n),{onNone:()=>Pr(),onSome:i=>fn(i,o)}))));var Dte=t=>Array.from(yT(t.map)),A2=t=>Array.from(t.map);var Vs="Empty",Ec="Fail",kc="Interrupt",Ic="Parallel",Oc="Sequential";var N2="effect/Cause",VT=Symbol.for(N2),zte={_E:t=>t},Ip={[VT]:zte,[re](){return b(G(N2),ae(G(Lte(this))),ye(this))},[Q](t){return Ab(t)&&jte(this,t)},pipe(){return K(this,arguments)},toJSON(){switch(this._tag){case"Empty":return{_id:"Cause",_tag:this._tag};case"Die":return{_id:"Cause",_tag:this._tag,defect:ke(this.defect)};case"Interrupt":return{_id:"Cause",_tag:this._tag,fiberId:this.fiberId.toJSON()};case"Fail":return{_id:"Cause",_tag:this._tag,failure:ke(this.error)};case"Sequential":case"Parallel":return{_id:"Cause",_tag:this._tag,left:ke(this.left),right:ke(this.right)}}},toString(){return Ho(this)},[xe](){return this.toJSON()}},Nr=(()=>{let t=Object.create(Ip);return t._tag=Vs,t})(),$i=t=>{let e=Object.create(Ip);return e._tag=Ec,e.error=t,e},At=t=>{let e=Object.create(Ip);return e._tag="Die",e.defect=t,e},hn=t=>{let e=Object.create(Ip);return e._tag=kc,e.fiberId=t,e},Mr=(t,e)=>{let r=Object.create(Ip);return r._tag=Ic,r.left=t,r.right=e,r},ft=(t,e)=>{let r=Object.create(Ip);return r._tag=Oc,r.left=t,r.right=e,r},Ab=t=>Y(t,VT),KT=t=>t._tag===Vs;var Op=t=>t._tag==="Die";var Tb=t=>t._tag===Vs?!0:Cc(t,!0,(e,r)=>{switch(r._tag){case Vs:return B(e);case"Die":case Ec:case kc:return B(!1);default:return z()}});var $b=t=>dt(M2(t)),Cp=t=>Mb(void 0,qte)(t),bh=t=>No(Cc(t,Pr(),(e,r)=>r._tag===Ec?B(b(e,Yt(r.error))):z())),Pb=t=>No(Cc(t,Pr(),(e,r)=>r._tag==="Die"?B(b(e,Yt(r.defect))):z())),vh=t=>Cc(t,jo(),(e,r)=>r._tag===kc?B(b(e,xc(r.fiberId))):z()),JT=t=>Ks(t,e=>e._tag===Ec?B(e.error):z()),ao=t=>{let e=JT(t);switch(e._tag){case"None":return Tr(t);case"Some":return $n(e.value)}};var M2=t=>Ks(t,e=>e._tag===kc?B(e.fiberId):z()),YT=t=>Rp(t,{onEmpty:z(),onFail:()=>z(),onDie:e=>B(At(e)),onInterrupt:()=>z(),onSequential:eh(ft),onParallel:eh(Mr)}),D2=t=>Rp(t,{onEmpty:z(),onFail:e=>B(At(e)),onDie:e=>B(At(e)),onInterrupt:()=>z(),onSequential:eh(ft),onParallel:eh(Mr)});var Nb=t=>Rp(t,{onEmpty:Nr,onFail:()=>Nr,onDie:At,onInterrupt:hn,onSequential:ft,onParallel:Mr}),F2=t=>Rp(t,{onEmpty:Nr,onFail:At,onDie:At,onInterrupt:hn,onSequential:ft,onParallel:Mr});var z2=h(2,(t,e)=>Rp(t,{onEmpty:Nr,onFail:r=>e(r),onDie:r=>At(r),onInterrupt:r=>hn(r),onSequential:(r,o)=>ft(r,o),onParallel:(r,o)=>Mr(r,o)})),XT=t=>z2(t,be);var jte=(t,e)=>{let r=xt(t),o=xt(e);for(;rr(r)&&rr(o);){let[n,i]=b(Xt(r),Cc([jo(),Pr()],([c,u],l)=>{let[p,f]=ZT(l);return B([b(c,Oi(p)),b(u,fn(f))])})),[s,a]=b(Xt(o),Cc([jo(),Pr()],([c,u],l)=>{let[p,f]=ZT(l);return B([b(c,Oi(p)),b(u,fn(f))])}));if(!V(n,s))return!1;r=i,o=a}return!0},Lte=t=>Ute(xt(t),Pr()),Ute=(t,e)=>{for(;;){let[r,o]=b(t,Us([jo(),Pr()],([i,s],a)=>{let[c,u]=ZT(a);return[b(i,Oi(c)),b(s,fn(u))]})),n=yc(r)>0?b(e,Yt(r)):e;if(WA(o))return No(n);t=o,e=n}throw new Error(ic("Cause.flattenCauseLoop"))},Ks=h(2,(t,e)=>{let r=[t];for(;r.length>0;){let o=r.pop(),n=e(o);switch(n._tag){case"None":{switch(o._tag){case Oc:case Ic:{r.push(o.right),r.push(o.left);break}}break}case"Some":return n}}return z()});var ZT=t=>{let e=t,r=[],o=jo(),n=Pr();for(;e!==void 0;)switch(e._tag){case Vs:{if(r.length===0)return[o,n];e=r.pop();break}case Ec:{if(o=xc(o,rh(e._tag,e.error)),r.length===0)return[o,n];e=r.pop();break}case"Die":{if(o=xc(o,rh(e._tag,e.defect)),r.length===0)return[o,n];e=r.pop();break}case kc:{if(o=xc(o,rh(e._tag,e.fiberId)),r.length===0)return[o,n];e=r.pop();break}case Oc:{switch(e.left._tag){case Vs:{e=e.right;break}case Oc:{e=ft(e.left.left,ft(e.left.right,e.right));break}case Ic:{e=Mr(ft(e.left.left,e.right),ft(e.left.right,e.right));break}default:{n=Yt(n,e.right),e=e.left;break}}break}case Ic:{r.push(e.right),e=e.left;break}}throw new Error(ic("Cause.evaluateCauseLoop"))};var qte={emptyCase:Oo,failCase:ro,dieCase:ro,interruptCase:Oo,sequentialCase:(t,e,r)=>e&&r,parallelCase:(t,e,r)=>e&&r};var $2="SequentialCase",P2="ParallelCase",Rp=h(2,(t,{onDie:e,onEmpty:r,onFail:o,onInterrupt:n,onParallel:i,onSequential:s})=>Mb(t,void 0,{emptyCase:()=>r,failCase:(a,c)=>o(c),dieCase:(a,c)=>e(c),interruptCase:(a,c)=>n(c),sequentialCase:(a,c,u)=>s(c,u),parallelCase:(a,c,u)=>i(c,u)})),Cc=h(3,(t,e,r)=>{let o=e,n=t,i=[];for(;n!==void 0;){let s=r(o,n);switch(o=dt(s)?s.value:o,n._tag){case Oc:{i.push(n.right),n=n.left;break}case Ic:{i.push(n.right),n=n.left;break}default:{n=void 0;break}}n===void 0&&i.length>0&&(n=i.pop())}return o}),Mb=h(3,(t,e,r)=>{let o=[t],n=[];for(;o.length>0;){let s=o.pop();switch(s._tag){case Vs:{n.push(Tr(r.emptyCase(e)));break}case Ec:{n.push(Tr(r.failCase(e,s.error)));break}case"Die":{n.push(Tr(r.dieCase(e,s.defect)));break}case kc:{n.push(Tr(r.interruptCase(e,s.fiberId)));break}case Oc:{o.push(s.right),o.push(s.left),n.push($n({_tag:$2}));break}case Ic:{o.push(s.right),o.push(s.left),n.push($n({_tag:P2}));break}}}let i=[];for(;n.length>0;){let s=n.pop();switch(s._tag){case"Left":{switch(s.left._tag){case $2:{let a=i.pop(),c=i.pop(),u=r.sequentialCase(e,a,c);i.push(u);break}case P2:{let a=i.pop(),c=i.pop(),u=r.parallelCase(e,a,c);i.push(u);break}}break}case"Right":{i.push(s.right);break}}}if(i.length===0)throw new Error("BUG: Cause.reduceWithContext - please report an issue at https://github.com/Effect-TS/effect/issues");return i.pop()}),Ho=(t,e)=>Cp(t)?"All fibers interrupted without errors.":wh(t).map(function(r){return e?.renderErrorCause!==!0||r.cause===void 0?r.stack:`${r.stack} {
|
|
87
|
+
${j2(r.cause," ")}
|
|
88
|
+
}`}).join(`
|
|
89
|
+
`),j2=(t,e)=>{let r=t.stack.split(`
|
|
90
|
+
`),o=`${e}[cause]: ${r[0]}`;for(let n=1,i=r.length;n<i;n++)o+=`
|
|
91
|
+
${e}${r[n]}`;return t.cause&&(o+=` {
|
|
92
|
+
${j2(t.cause,`${e} `)}
|
|
93
|
+
${e}}`),o},GT=t=>{let e=typeof t=="object"&&t!==null,r=Error.stackTraceLimit;Error.stackTraceLimit=1;let o=new Error(Hte(t),e&&"cause"in t&&typeof t.cause<"u"?{cause:GT(t.cause)}:void 0);return Error.stackTraceLimit=r,o.message===""&&(o.message="An error has occurred"),Error.stackTraceLimit=r,o.name=t instanceof Error?t.name:"Error",e&&(Rc in t&&(o.span=t[Rc]),Object.keys(t).forEach(n=>{n in o||(o[n]=t[n])})),o.stack=Wte(`${o.name}: ${o.message}`,t instanceof Error&&t.stack?t.stack:"",o.span),o},Hte=t=>{if(typeof t=="string")return t;if(typeof t=="object"&&t!==null&&t instanceof Error)return t.message;try{if(Y(t,"toString")&&Ps(t.toString)&&t.toString!==Object.prototype.toString&&t.toString!==globalThis.Array.prototype.toString)return t.toString()}catch{}return $_(t)},Bte=/\((.*)\)/g,Sh=pe("effect/Tracer/spanToTrace",()=>new WeakMap),Wte=(t,e,r)=>{let o=[t],n=e.startsWith(t)?e.slice(t.length).split(`
|
|
94
|
+
`):e.split(`
|
|
95
|
+
`);for(let i=1;i<n.length;i++){if(n[i].includes(" at new BaseEffectError")||n[i].includes(" at new YieldableError")){i++;continue}if(n[i].includes("Generator.next")||n[i].includes("effect_internal_function"))break;o.push(n[i].replace(/at .*effect_instruction_i.*\((.*)\)/,"at $1").replace(/EffectPrimitive\.\w+/,"<anonymous>"))}if(r){let i=r,s=0;for(;i&&i._tag==="Span"&&s<10;){let a=Sh.get(i);if(typeof a=="function"){let c=a();if(typeof c=="string"){let u=c.matchAll(Bte),l=!1;for(let[,p]of u)l=!0,o.push(` at ${i.name} (${p})`);l||o.push(` at ${i.name} (${c.replace(/^at /,"")})`)}else o.push(` at ${i.name}`)}else o.push(` at ${i.name}`);i=dr(i.parent),s++}}return o.join(`
|
|
96
|
+
`)},Rc=Symbol.for("effect/SpanAnnotation"),wh=t=>Mb(t,void 0,{emptyCase:()=>[],dieCase:(e,r)=>[GT(r)],failCase:(e,r)=>[GT(r)],interruptCase:()=>[],parallelCase:(e,r,o)=>[...r,...o],sequentialCase:(e,r,o)=>[...r,...o]});var Ac="Pending",Eh="Done";var Zte="effect/Deferred",U2=Symbol.for(Zte),q2={_E:t=>t,_A:t=>t},H2=t=>({_tag:Ac,joiners:t}),QT=t=>({_tag:Eh,effect:t});var Ap=class t{self;called=!1;constructor(e){this.self=e}next(e){return this.called?{value:e,done:!0}:(this.called=!0,{value:this.self,done:!1})}return(e){return{value:e,done:!0}}throw(e){throw e}[Symbol.iterator](){return new t(this.self)}};var Pi=(t,e)=>{let r=new _t("Blocked");return r.effect_instruction_i0=t,r.effect_instruction_i1=e,r},Lb=t=>{let e=new _t("RunBlocked");return e.effect_instruction_i0=t,e},Ni=Symbol.for("effect/Effect"),Fb=class{patch;op;_op=Ym;constructor(e,r){this.patch=e,this.op=r}},_t=class{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[Ni]=Ds;constructor(e){this._op=e}[Q](e){return this===e}[re](){return ye(this,ep(this))}pipe(){return K(this,arguments)}toJSON(){return{_id:"Effect",_op:this._op,effect_instruction_i0:ke(this.effect_instruction_i0),effect_instruction_i1:ke(this.effect_instruction_i1),effect_instruction_i2:ke(this.effect_instruction_i2)}}toString(){return Ce(this.toJSON())}[xe](){return this.toJSON()}[Symbol.iterator](){return new Ap(new Ro(this))}},zb=class{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[Ni]=Ds;constructor(e){this._op=e,this._tag=e}[Q](e){return Dp(e)&&e._op==="Failure"&&V(this.effect_instruction_i0,e.effect_instruction_i0)}[re](){return b(Le(this._tag),ae(G(this.effect_instruction_i0)),ye(this))}get cause(){return this.effect_instruction_i0}pipe(){return K(this,arguments)}toJSON(){return{_id:"Exit",_tag:this._op,cause:this.cause.toJSON()}}toString(){return Ce(this.toJSON())}[xe](){return this.toJSON()}[Symbol.iterator](){return new Ap(new Ro(this))}},jb=class{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[Ni]=Ds;constructor(e){this._op=e,this._tag=e}[Q](e){return Dp(e)&&e._op==="Success"&&V(this.effect_instruction_i0,e.effect_instruction_i0)}[re](){return b(Le(this._tag),ae(G(this.effect_instruction_i0)),ye(this))}get value(){return this.effect_instruction_i0}pipe(){return K(this,arguments)}toJSON(){return{_id:"Exit",_tag:this._op,value:ke(this.value)}}toString(){return Ce(this.toJSON())}[xe](){return this.toJSON()}[Symbol.iterator](){return new Ap(new Ro(this))}},ze=t=>Y(t,Ni),Ee=t=>{let e=new _t(M_);return e.effect_instruction_i0=t,e},Ub=h(3,(t,e,r)=>vt(o=>w(t,n=>w(mt(oe(()=>o(e(n)))),i=>oe(()=>r(n,i)).pipe(st({onFailure:s=>{switch(i._tag){case Et:return we(ft(i.effect_instruction_i0,s));case kt:return we(s)}},onSuccess:()=>i})))))),Ge=h(2,(t,e)=>w(t,()=>$(e))),bt=t=>Ge(t,void 0),Oh=function(){let t=new _t(uc);switch(arguments.length){case 2:{t.effect_instruction_i0=arguments[0],t.commit=arguments[1];break}case 3:{t.effect_instruction_i0=arguments[0],t.effect_instruction_i1=arguments[1],t.commit=arguments[2];break}case 4:{t.effect_instruction_i0=arguments[0],t.effect_instruction_i1=arguments[1],t.effect_instruction_i2=arguments[2],t.commit=arguments[3];break}default:throw new Error(ic("you're not supposed to end up here"))}return t},Tp=(t,e=Kr)=>{let r=new _t(cc),o;return r.effect_instruction_i0=n=>{o=t(n)},r.effect_instruction_i1=e,Zo(r,n=>ze(o)?o:de)},Ch=(t,e=Kr)=>oe(()=>Tp(t,e)),gr=(t,e=Kr)=>Oh(t,function(){let r,o;function n(c){r?r(c):o===void 0&&(o=c)}let i=new _t(cc);i.effect_instruction_i0=c=>{r=c,o&&c(o)},i.effect_instruction_i1=e;let s,a;return this.effect_instruction_i0.length!==1?(a=new AbortController,s=yt(()=>this.effect_instruction_i0(n,a.signal))):s=yt(()=>this.effect_instruction_i0(n)),s||a?Zo(i,c=>(a&&a.abort(),s??de)):i});var Bo=h(2,(t,e)=>{let r=new _t(rp);return r.effect_instruction_i0=t,r.effect_instruction_i1=e,r}),co=h(2,(t,e)=>Mt(t,{onFailure:e,onSuccess:$})),Rh=h(3,(t,e,r)=>Bo(t,o=>{let n=ao(o);switch(n._tag){case"Left":return e(n.left)?r(n.left):we(o);case"Right":return we(n.right)}})),X2=h(2,(t,e)=>Bo(t,r=>{let o=ao(r);switch(o._tag){case"Left":return b(e(o.left),qt(()=>we(r)));case"Right":return we(o.right)}})),Q2=t=>Ee((e,r)=>t(yh(r.runtimeFlags))),B2=Symbol.for("effect/OriginalAnnotation");var qb=(t,e)=>dt(e)?new Proxy(t,{has(r,o){return o===Rc||o===B2||o in r},get(r,o){return o===Rc?e.value:o===B2?t:r[o]}}):t,yr=t=>Ns(t)&&!(Rc in t)?Ee(e=>we(At(qb(t,uv(e))))):we(At(t)),Ys=t=>Mi(()=>At(new ire(t))),Xs=t=>w(M(t),yr),Un=t=>Mt(t,{onFailure:e=>$($n(e)),onSuccess:e=>$(Tr(e))}),mt=t=>Ah(t,{onFailure:Be,onSuccess:it}),_e=t=>Ns(t)&&!(Rc in t)?Ee(e=>we($i(qb(t,uv(e))))):we($i(t)),qn=t=>w(M(t),_e),we=t=>{let e=new zb(Et);return e.effect_instruction_i0=t,e},Mi=t=>w(M(t),we),Qs=Ee(t=>$(t.id())),Jr=t=>Ee(e=>t(e.id())),w=h(2,(t,e)=>{let r=new _t(np);return r.effect_instruction_i0=t,r.effect_instruction_i1=e,r}),ea=h(2,(t,e)=>w(t,r=>{let o=typeof e=="function"?e(r):e;return ze(o)?o:pA(o)?Tp(n=>{o.then(i=>n($(i)),i=>n(_e(new Fh(i,"An unknown error occurred in Effect.andThen"))))}):$(o)})),Hb=t=>{let e=new _t("OnStep");return e.effect_instruction_i0=t,e},Yr=t=>w(t,be),ta=t=>Mt(t,{onFailure:$,onSuccess:_e}),Ah=h(2,(t,e)=>st(t,{onFailure:r=>$(e.onFailure(r)),onSuccess:r=>$(e.onSuccess(r))})),st=h(2,(t,e)=>{let r=new _t(op);return r.effect_instruction_i0=t,r.effect_instruction_i1=e.onFailure,r.effect_instruction_i2=e.onSuccess,r}),Mt=h(2,(t,e)=>st(t,{onFailure:r=>{if(Pb(r).length>0)return we(F2(r));let n=bh(r);return n.length>0?e.onFailure(ZA(n)):we(r)},onSuccess:e.onSuccess})),nr=h(2,(t,e)=>oe(()=>{let r=Re(t),o=th(r.length),n=0;return Ge(oa({while:()=>n<r.length,body:()=>e(r[n],n),step:i=>{o[n++]=i}}),o)})),gn=h(2,(t,e)=>oe(()=>{let r=Re(t),o=0;return oa({while:()=>o<r.length,body:()=>e(r[o],o),step:()=>{o++}})})),Bb=h(t=>typeof t[0]=="boolean"||ze(t[0]),(t,e)=>ze(t)?w(t,r=>r?e.onTrue():e.onFalse()):t?e.onTrue():e.onFalse()),Wb=w(Qs,t=>Zb(t)),Zb=t=>we(hn(t)),Di=t=>{let e=new _t(Si);return e.effect_instruction_i0=FT(so),e.effect_instruction_i1=()=>t,e},eq=t=>Oh(t,function(){let e=new _t(Si);return e.effect_instruction_i0=FT(so),e.effect_instruction_i1=r=>yh(r)?yt(()=>this.effect_instruction_i0(Di)):yt(()=>this.effect_instruction_i0(Fi)),e}),Wo=h(2,(t,e)=>vt(r=>w(mt(r(t)),o=>p$(e,o)))),F=h(2,(t,e)=>w(t,r=>M(()=>e(r)))),Th=h(2,(t,e)=>Mt(t,{onFailure:r=>qn(()=>e.onFailure(r)),onSuccess:r=>M(()=>e.onSuccess(r))})),ra=h(2,(t,e)=>st(t,{onFailure:r=>{let o=ao(r);switch(o._tag){case"Left":return qn(()=>e(o.left));case"Right":return we(o.right)}},onSuccess:$})),Gb=h(2,(t,e)=>Dr(t,r=>sv(r)?de:e(r.effect_instruction_i0))),Dr=h(2,(t,e)=>vt(r=>st(r(t),{onFailure:o=>{let n=Be(o);return st(e(n),{onFailure:i=>Be(ft(o,i)),onSuccess:()=>n})},onSuccess:o=>{let n=it(o);return Pe(e(n),n)}}))),Zo=h(2,(t,e)=>Dr(t,Fp({onFailure:r=>Cp(r)?bt(e(vh(r))):de,onSuccess:()=>de}))),$c=h(2,(t,e)=>Jte(t,e,$)),Pc=t=>r$(t,be),r$=h(2,(t,e)=>Mt(t,{onFailure:r=>yr(e(r)),onSuccess:$})),tq=PA,$p=Ee((t,e)=>$(e.runtimeFlags)),$=t=>{let e=new jb(kt);return e.effect_instruction_i0=t,e},oe=t=>{let e=new _t(uc);return e.commit=t,e},M=t=>{let e=new _t(N_);return e.effect_instruction_i0=t,e},Fr=h(t=>t.length===3||t.length===2&&!(Ns(t[1])&&"onlyEffect"in t[1]),(t,e)=>w(t,r=>{let o=typeof e=="function"?e(r):e;return ze(o)?Ge(o,r):pA(o)?Tp(n=>{o.then(i=>n($(r)),i=>n(_e(new Fh(i,"An unknown error occurred in Effect.tap"))))}):$(r)})),Vb=t=>Ee(e=>{let r=e.getFiberRef(Ih),o=b(r,qt(()=>e.scope()));return t(ht(Ih,B(o)))}),Jte=h(3,(t,e,r)=>st(t,{onFailure:o=>Pb(o).length>0?we(IU(D2(o))):e(),onSuccess:r})),Fi=t=>{let e=new _t(Si);return e.effect_instruction_i0=zT(so),e.effect_instruction_i1=()=>t,e},vt=t=>Oh(t,function(){let e=new _t(Si);return e.effect_instruction_i0=zT(so),e.effect_instruction_i1=r=>yh(r)?yt(()=>this.effect_instruction_i0(Di)):yt(()=>this.effect_instruction_i0(Fi)),e}),de=$(void 0);var na=t=>{let e=new _t(Si);return e.effect_instruction_i0=t,e.effect_instruction_i1=void 0,e},Pp=h(2,(t,e)=>w(e,r=>r?b(t,F(B)):$(z()))),oa=t=>{let e=new _t(ip);return e.effect_instruction_i0=t.while,e.effect_instruction_i1=t.body,e.effect_instruction_i2=t.step,e},kh=t=>oe(()=>{let e=new _t(lc);return e.effect_instruction_i0=t(),e}),Kb=function(){let t=arguments.length===1?arguments[0]:arguments[1].bind(arguments[0]);return kh(()=>t(b))},Np=(t,...e)=>Object.defineProperty(e.length===0?function(...r){return kh(()=>t.apply(this,r))}:function(...r){let o=kh(()=>t.apply(this,r));for(let n of e)o=n(o,...r);return o},"length",{value:t.length,configurable:!0}),rq=h(2,(t,e)=>ht(t,ev,e)),nq=h(2,(t,e)=>ht(t,Ph,e)),Jb=h(2,(t,e)=>{let r=new _t(Si);return r.effect_instruction_i0=e,r.effect_instruction_i1=()=>t,r}),oq=h(2,(t,e)=>ht(t,Mh,e)),iq=h(2,(t,e)=>ht(t,sa,e)),Go=t=>{let e=new _t(sp);return typeof t?.priority<"u"?a$(e,t.priority):e},Nc=h(2,(t,e)=>w(t,r=>F(e,o=>[r,o])));var Mc=h(2,(t,e)=>w(t,r=>Ge(e,r))),Pe=h(2,(t,e)=>w(t,()=>e)),Vo=h(3,(t,e,r)=>w(t,o=>F(e,n=>r(o,n)))),ia=Ch(()=>{let t=setInterval(()=>{},2147483647);return M(()=>clearInterval(t))}),$h=t=>w(Qs,e=>b(t,Xr(e))),Xr=h(2,(t,e)=>w(t.interruptAsFork(e),()=>t.await)),sq={_tag:"All",syslog:0,label:"ALL",ordinal:Number.MIN_SAFE_INTEGER,pipe(){return K(this,arguments)}},aq={_tag:"Fatal",syslog:2,label:"FATAL",ordinal:5e4,pipe(){return K(this,arguments)}},cq={_tag:"Error",syslog:3,label:"ERROR",ordinal:4e4,pipe(){return K(this,arguments)}},n$={_tag:"Warning",syslog:4,label:"WARN",ordinal:3e4,pipe(){return K(this,arguments)}},o$={_tag:"Info",syslog:6,label:"INFO",ordinal:2e4,pipe(){return K(this,arguments)}},i$={_tag:"Debug",syslog:7,label:"DEBUG",ordinal:1e4,pipe(){return K(this,arguments)}},uq={_tag:"Trace",syslog:7,label:"TRACE",ordinal:0,pipe(){return K(this,arguments)}},lq={_tag:"None",syslog:7,label:"OFF",ordinal:Number.MAX_SAFE_INTEGER,pipe(){return K(this,arguments)}};var Yte="effect/FiberRef",Xte=Symbol.for(Yte),Qte={_A:t=>t},yn=t=>Ee(e=>it(e.getFiberRef(t)));var or=h(2,(t,e)=>w(yn(t),e)),Tc=h(2,(t,e)=>ere(t,()=>[void 0,e]));var ere=h(2,(t,e)=>Ee(r=>{let[o,n]=e(r.getFiberRef(t));return r.setFiberRef(t,n),$(o)}));var tre="effect/RequestResolver",pq=Symbol.for(tre),rre={_A:t=>t,_R:t=>t},W2=class t{runAll;target;[pq]=rre;constructor(e,r){this.runAll=e,this.target=r}[re](){return ye(this,this.target?G(this.target):ep(this))}[Q](e){return this.target?nre(e)&&V(this.target,e.target):this===e}identified(...e){return new t(this.runAll,fc(e))}pipe(){return K(this,arguments)}},nre=t=>Y(t,pq);var ht=h(3,(t,e,r)=>Ub(Mc(yn(e),Tc(e,r)),()=>t,o=>Tc(e,o))),Dt=h(3,(t,e,r)=>or(e,o=>ht(t,e,r(o)))),gt=(t,e)=>Dc(t,{differ:Sb(),fork:e?.fork??be,join:e?.join}),dq=t=>{let e=IT();return Dc(t,{differ:e,fork:e.empty})},ore=t=>{let e=OT(Sb());return Dc(t,{differ:e,fork:e.empty})},Yb=t=>{let e=kT();return Dc(t,{differ:e,fork:e.empty})},Dc=(t,e)=>({...Ei,[Xte]:Qte,initial:t,commit(){return yn(this)},diff:(o,n)=>e.differ.diff(o,n),combine:(o,n)=>e.differ.combine(o,n),patch:o=>n=>e.differ.patch(o,n),fork:e.fork,join:e.join??((o,n)=>n)}),fq=t=>Dc(t,{differ:DT,fork:DT.empty}),Qr=pe(Symbol.for("effect/FiberRef/currentContext"),()=>Yb(Jt())),zi=pe(Symbol.for("effect/FiberRef/currentSchedulingPriority"),()=>gt(0)),Xb=pe(Symbol.for("effect/FiberRef/currentMaxOpsBeforeYield"),()=>gt(2048)),ji=pe(Symbol.for("effect/FiberRef/currentLogAnnotation"),()=>gt(vc())),s$=pe(Symbol.for("effect/FiberRef/currentLogLevel"),()=>gt(o$)),Qb=pe(Symbol.for("effect/FiberRef/currentLogSpan"),()=>gt(qo())),a$=h(2,(t,e)=>ht(t,zi,e)),mq=h(2,(t,e)=>ht(t,Xb,e)),ev=pe(Symbol.for("effect/FiberRef/currentConcurrency"),()=>gt("unbounded")),Ph=pe(Symbol.for("effect/FiberRef/currentRequestBatching"),()=>gt(!0)),Nh=pe(Symbol.for("effect/FiberRef/currentUnhandledErrorLogLevel"),()=>gt(B(i$))),tv=pe(Symbol.for("effect/FiberRef/versionMismatchErrorLogLevel"),()=>gt(B(n$))),hq=h(2,(t,e)=>ht(t,Nh,e)),Li=pe(Symbol.for("effect/FiberRef/currentMetricLabels"),()=>ore(oo())),gq=yn(Li),Ih=pe(Symbol.for("effect/FiberRef/currentForkScopeOverride"),()=>gt(z(),{fork:()=>z(),join:(t,e)=>t})),Fc=pe(Symbol.for("effect/FiberRef/currentInterruptedCause"),()=>gt(Nr,{fork:()=>Nr,join:(t,e)=>t})),Mh=pe(Symbol.for("effect/FiberRef/currentTracerEnabled"),()=>gt(!0)),sa=pe(Symbol.for("effect/FiberRef/currentTracerTiming"),()=>gt(!0)),Mp=pe(Symbol.for("effect/FiberRef/currentTracerSpanAnnotations"),()=>gt(vc())),rv=pe(Symbol.for("effect/FiberRef/currentTracerSpanLinks"),()=>gt(Pr())),nv=Symbol.for("effect/Scope"),ov=Symbol.for("effect/CloseableScope"),iv=(t,e)=>t.addFinalizer(()=>bt(e)),zc=(t,e)=>t.addFinalizer(e),jc=(t,e)=>t.close(e),xn=(t,e)=>t.fork(e);var yq=(function(){class t extends globalThis.Error{commit(){return _e(this)}toJSON(){let r={...this};return this.message&&(r.message=this.message),this.cause&&(r.cause=this.cause),r}[xe](){return this.toString!==globalThis.Error.prototype.toString?this.stack?`${this.toString()}
|
|
97
|
+
${this.stack.split(`
|
|
98
|
+
`).slice(1).join(`
|
|
99
|
+
`)}`:this.toString():"Bun"in globalThis?Ho($i(this),{renderErrorCause:!0}):this}}return Object.assign(t.prototype,gA),t})(),Lc=(t,e)=>{class r extends yq{_tag=e}return Object.assign(r.prototype,t),r.prototype.name=e,r},Z2=Symbol.for("effect/Cause/errors/RuntimeException"),ire=Lc({[Z2]:Z2},"RuntimeException");var e$=Symbol.for("effect/Cause/errors/InterruptedException"),GCe=Lc({[e$]:e$},"InterruptedException"),xq=t=>Y(t,e$),G2=Symbol.for("effect/Cause/errors/IllegalArgument"),Dh=Lc({[G2]:G2},"IllegalArgumentException");var t$=Symbol.for("effect/Cause/errors/NoSuchElement"),en=Lc({[t$]:t$},"NoSuchElementException"),_q=t=>Y(t,t$),V2=Symbol.for("effect/Cause/errors/InvalidPubSubCapacityException"),VCe=Lc({[V2]:V2},"InvalidPubSubCapacityException"),K2=Symbol.for("effect/Cause/errors/ExceededCapacityException"),KCe=Lc({[K2]:K2},"ExceededCapacityException");var J2=Symbol.for("effect/Cause/errors/Timeout"),sre=Lc({[J2]:J2},"TimeoutException"),bq=t=>new sre(`Operation timed out after '${XA(t)}'`);var Y2=Symbol.for("effect/Cause/errors/UnknownException"),Fh=(function(){class t extends yq{_tag="UnknownException";error;constructor(r,o){super(o??"An unknown error occurred",{cause:r}),this.error=r}}return Object.assign(t.prototype,{[Y2]:Y2,name:"UnknownException"}),t})();var Dp=t=>ze(t)&&"_tag"in t&&(t._tag==="Success"||t._tag==="Failure"),c$=t=>t._tag==="Failure",sv=t=>t._tag==="Success";var vq=h(2,(t,e)=>{switch(t._tag){case Et:return Be(t.effect_instruction_i0);case kt:return it(e)}}),zh=t=>vq(t,void 0);var Uc=(t,e)=>are(t,e?.parallel?Mr:ft),u$=t=>Be(At(t));var jh=t=>Be($i(t)),Be=t=>{let e=new zb(Et);return e.effect_instruction_i0=t,e},Sq=h(2,(t,e)=>{switch(t._tag){case Et:return Be(t.effect_instruction_i0);case kt:return e(t.effect_instruction_i0)}});var wq=t=>b(t,Sq(be));var av=t=>Be(hn(t)),Db=h(2,(t,e)=>{switch(t._tag){case Et:return Be(t.effect_instruction_i0);case kt:return it(e(t.effect_instruction_i0))}});var Fp=h(2,(t,{onFailure:e,onSuccess:r})=>{switch(t._tag){case Et:return e(t.effect_instruction_i0);case kt:return r(t.effect_instruction_i0)}}),zp=h(2,(t,{onFailure:e,onSuccess:r})=>{switch(t._tag){case Et:return e(t.effect_instruction_i0);case kt:return r(t.effect_instruction_i0)}}),it=t=>{let e=new jb(kt);return e.effect_instruction_i0=t,e},zr=it(void 0);var Lh=h(3,(t,e,{onFailure:r,onSuccess:o})=>{switch(t._tag){case Et:switch(e._tag){case kt:return Be(t.effect_instruction_i0);case Et:return Be(r(t.effect_instruction_i0,e.effect_instruction_i0))}case kt:switch(e._tag){case kt:return it(o(t.effect_instruction_i0,e.effect_instruction_i0));case Et:return Be(e.effect_instruction_i0)}}}),are=(t,e)=>{let r=fc(t);return rr(r)?b(mr(r),Us(b(Xt(r),Db(xt)),(o,n)=>b(o,Lh(n,{onSuccess:(i,s)=>b(i,Yt(s)),onFailure:e}))),Db(No),Db(o=>Fn(o)),B):z()},Uh=t=>({...Ei,[U2]:q2,state:Lo(H2([])),commit(){return Zt(this)},blockingOn:t}),_n=()=>w(Qs,t=>Eq(t)),Eq=t=>M(()=>Uh(t)),Zt=t=>Ch(e=>{let r=Vr(t.state);switch(r._tag){case Eh:return e(r.effect);case Ac:return r.joiners.push(e),cre(t,e)}},t.blockingOn),l$=h(2,(t,e)=>Wo(e,t)),qh=h(2,(t,e)=>M(()=>{let r=Vr(t.state);switch(r._tag){case Eh:return!1;case Ac:{jn(t.state,QT(e));for(let o=0,n=r.joiners.length;o<n;o++)r.joiners[o](e);return!0}}})),p$=h(2,(t,e)=>qh(t,e));var Hh=h(2,(t,e)=>qh(t,we(e)));var kq=t=>w(Qs,e=>qh(t,Zb(e)));var d$=h(2,(t,e)=>qh(t,$(e)));var Bh=(t,e)=>{let r=Vr(t.state);if(r._tag===Ac){jn(t.state,QT(e));for(let o=0,n=r.joiners.length;o<n;o++)r.joiners[o](e)}},cre=(t,e)=>M(()=>{let r=Vr(t.state);if(r._tag===Ac){let o=r.joiners.indexOf(e);o>=0&&r.joiners.splice(o,1)}}),ure=Ee(t=>it(t.currentContext)),tn=()=>ure;var Hn=t=>w(tn(),t),bn=h(2,(t,e)=>ht(Qr,e)(t)),cv=h(2,(t,e)=>Dt(Qr,r=>Dn(r,e))(t)),qc=h(2,(t,e)=>Hn(r=>bn(t,e(r)))),f$=h(2,(t,e)=>w(t,r=>w(e.predicate(r),o=>o?$(r):e.orElse(r)))),Iq=h(2,(t,e)=>f$(t,{predicate:e.predicate,orElse:r=>_e(e.orFailWith(r))})),uv=t=>{let e=t.currentSpan;return e!==void 0&&e._tag==="Span"?B(e):z()},lre={_tag:"Span",spanId:"noop",traceId:"noop",sampled:!1,status:{_tag:"Ended",startTime:BigInt(0),endTime:BigInt(0),exit:zr},attributes:new Map,links:[],kind:"internal",attribute(){},event(){},end(){},addLinks(){}},Oq=t=>Object.assign(Object.create(lre),t);var Wh=Zt;var Cq=p$;var Rq=kq;var m$=Uh;var Tq=wq;var $q=it;var Pq=Symbol.for("effect/MutableHashMap"),pre={[Pq]:Pq,[Symbol.iterator](){return new g$(this)},toString(){return Ce(this.toJSON())},toJSON(){return{_id:"MutableHashMap",values:Array.from(this).map(ke)}},[xe](){return this.toJSON()},pipe(){return K(this,arguments)}},g$=class t{self;referentialIterator;bucketIterator;constructor(e){this.self=e,this.referentialIterator=e.referential[Symbol.iterator]()}next(){if(this.bucketIterator!==void 0)return this.bucketIterator.next();let e=this.referentialIterator.next();return e.done?(this.bucketIterator=new y$(this.self.buckets.values()),this.next()):e}[Symbol.iterator](){return new t(this.self)}},y$=class{backing;constructor(e){this.backing=e}currentBucket;next(){if(this.currentBucket===void 0){let r=this.backing.next();if(r.done)return r;this.currentBucket=r.value[Symbol.iterator]()}let e=this.currentBucket.next();return e.done?(this.currentBucket=void 0,this.next()):e}},Hc=()=>{let t=Object.create(pre);return t.referential=new Map,t.buckets=new Map,t.bucketsSize=0,t};var Tt=h(2,(t,e)=>{if(tp(e)===!1)return t.referential.has(e)?B(t.referential.get(e)):z();let r=e[re](),o=t.buckets.get(r);return o===void 0?z():dre(t,o,e)});var dre=(t,e,r,o=!1)=>{for(let n=0,i=e.length;n<i;n++)if(r[Q](e[n][0])){let s=e[n][1];return o&&(e.splice(n,1),t.bucketsSize--),B(s)}return z()},uo=h(2,(t,e)=>dt(Tt(t,e))),rn=h(3,(t,e,r)=>{if(tp(e)===!1)return t.referential.set(e,r),t;let o=e[re](),n=t.buckets.get(o);return n===void 0?(t.buckets.set(o,[[e,r]]),t.bucketsSize++,t):(Nq(t,n,e),n.push([e,r]),t.bucketsSize++,t)}),Nq=(t,e,r)=>{for(let o=0,n=e.length;o<n;o++)if(r[Q](e[o][0])){e.splice(o,1),t.bucketsSize--;return}};var Bc=h(2,(t,e)=>{if(tp(e)===!1)return t.referential.delete(e),t;let r=e[re](),o=t.buckets.get(r);return o===void 0||(Nq(t,o,e),o.length===0&&t.buckets.delete(r)),t});var lv=t=>t.referential.size+t.bucketsSize;var Mq=Symbol.for("effect/MutableList"),fre={[Mq]:Mq,[Symbol.iterator](){let t=!1,e=this.head;return{next(){if(t)return this.return();if(e==null)return t=!0,this.return();let r=e.value;return e=e.next,{done:t,value:r}},return(r){return t||(t=!0),{done:!0,value:r}}}},toString(){return Ce(this.toJSON())},toJSON(){return{_id:"MutableList",values:Array.from(this).map(ke)}},[xe](){return this.toJSON()},pipe(){return K(this,arguments)}},mre=t=>({value:t,removed:!1,prev:void 0,next:void 0}),Dq=()=>{let t=Object.create(fre);return t.head=void 0,t.tail=void 0,t._length=0,t};var Fq=t=>x$(t)===0,x$=t=>t._length;var zq=h(2,(t,e)=>{let r=mre(e);return t.head===void 0&&(t.head=r),t.tail===void 0||(t.tail.next=r,r.prev=t.tail),t.tail=r,t._length+=1,t}),jq=t=>{let e=t.head;if(e!==void 0)return hre(t,e),e.value};var hre=(t,e)=>{e.removed||(e.removed=!0,e.prev!==void 0&&e.next!==void 0?(e.prev.next=e.next,e.next.prev=e.prev):e.prev!==void 0?(t.tail=e.prev,e.prev.next=void 0):e.next!==void 0?(t.head=e.next,e.next.prev=void 0):(t.tail=void 0,t.head=void 0),t._length>0&&(t._length-=1))};var Uq=Symbol.for("effect/MutableQueue"),_$=Symbol.for("effect/mutable/MutableQueue/Empty"),gre={[Uq]:Uq,[Symbol.iterator](){return Array.from(this.queue)[Symbol.iterator]()},toString(){return Ce(this.toJSON())},toJSON(){return{_id:"MutableQueue",values:Array.from(this).map(ke)}},[xe](){return this.toJSON()},pipe(){return K(this,arguments)}},yre=t=>{let e=Object.create(gre);return e.queue=Dq(),e.capacity=t,e};var qq=()=>yre(void 0);var Hq=h(2,(t,e)=>{let r=x$(t.queue);return t.capacity!==void 0&&r===t.capacity?!1:(zq(e)(t.queue),!0)});var Bq=h(2,(t,e)=>Fq(t.queue)?e:jq(t.queue));var xre="effect/Clock",b$=Symbol.for(xre),jr=Ht("effect/Clock"),_re=2**31-1,Zq={unsafeSchedule(t,e){let r=Do(e);if(r>_re)return ro;let o=!1,n=setTimeout(()=>{o=!0,t()},r);return()=>(clearTimeout(n),!o)}},Gq=(function(){let t=BigInt(1e6);if(typeof performance>"u"||typeof performance.now!="function")return()=>BigInt(Date.now())*t;let e;return()=>(e===void 0&&(e=BigInt(Date.now())*t-BigInt(Math.round(performance.now()*1e6))),e+BigInt(Math.round(performance.now()*1e6)))})(),bre=(function(){let t=typeof process=="object"&&"hrtime"in process&&typeof process.hrtime.bigint=="function"?process.hrtime:void 0;if(!t)return Gq;let e=Gq()-t.bigint();return()=>e+t.bigint()})(),v$=class{[b$]=b$;unsafeCurrentTimeMillis(){return Date.now()}unsafeCurrentTimeNanos(){return bre()}currentTimeMillis=M(()=>this.unsafeCurrentTimeMillis());currentTimeNanos=M(()=>this.unsafeCurrentTimeNanos());scheduler(){return $(Zq)}sleep(e){return gr(r=>{let o=Zq.unsafeSchedule(()=>r(de),e);return bt(M(o))})}},S$=()=>new v$;var E$="InvalidData",k$="MissingData",I$="SourceUnavailable",O$="Unsupported";var Sre="effect/ConfigError",Vq=Symbol.for(Sre),jp={_tag:"ConfigError",[Vq]:Vq},C$=(t,e)=>{let r=Object.create(jp);return r._op="And",r.left=t,r.right=e,Object.defineProperty(r,"toString",{enumerable:!1,value(){return`${this.left} and ${this.right}`}}),Object.defineProperty(r,"message",{enumerable:!1,get(){return this.toString()}}),r},R$=(t,e)=>{let r=Object.create(jp);return r._op="Or",r.left=t,r.right=e,Object.defineProperty(r,"toString",{enumerable:!1,value(){return`${this.left} or ${this.right}`}}),Object.defineProperty(r,"message",{enumerable:!1,get(){return this.toString()}}),r},wre=(t,e,r={pathDelim:"."})=>{let o=Object.create(jp);return o._op=E$,o.path=t,o.message=e,Object.defineProperty(o,"toString",{enumerable:!1,value(){return`(Invalid data at ${b(this.path,ki(r.pathDelim))}: "${this.message}")`}}),o},Ui=(t,e,r={pathDelim:"."})=>{let o=Object.create(jp);return o._op=k$,o.path=t,o.message=e,Object.defineProperty(o,"toString",{enumerable:!1,value(){return`(Missing data at ${b(this.path,ki(r.pathDelim))}: "${this.message}")`}}),o},Ere=(t,e,r,o={pathDelim:"."})=>{let n=Object.create(jp);return n._op=I$,n.path=t,n.message=e,n.cause=r,Object.defineProperty(n,"toString",{enumerable:!1,value(){return`(Source unavailable at ${b(this.path,ki(o.pathDelim))}: "${this.message}")`}}),n},kre=(t,e,r={pathDelim:"."})=>{let o=Object.create(jp);return o._op=O$,o.path=t,o.message=e,Object.defineProperty(o,"toString",{enumerable:!1,value(){return`(Unsupported operation at ${b(this.path,ki(r.pathDelim))}: "${this.message}")`}}),o};var aa=h(2,(t,e)=>{switch(t._op){case"And":return C$(aa(t.left,e),aa(t.right,e));case"Or":return R$(aa(t.left,e),aa(t.right,e));case E$:return wre([...e,...t.path],t.message);case k$:return Ui([...e,...t.path],t.message);case I$:return Ere([...e,...t.path],t.message,t.cause);case O$:return kre([...e,...t.path],t.message)}});var Xq={_tag:"Empty"};var dv=h(2,(t,e)=>{let r=lh(e),o=t;for(;bT(r);){let n=r.head;switch(n._tag){case"Empty":{r=r.tail;break}case"AndThen":{r=Ri(n.first,Ri(n.second,r.tail));break}case"MapName":{o=$o(o,n.f),r=r.tail;break}case"Nested":{o=pp(o,n.name),r=r.tail;break}case"Unnested":{if(b(Ls(o),OU(n.name)))o=To(o),r=r.tail;else return $n(Ui(o,`Expected ${n.name} to be in path in ConfigProvider#unnested`));break}}}return Tr(o)});var Qq="Constant",e4="Fail",t4="Fallback",r4="Described",n4="Lazy",o4="MapOrFail",i4="Nested",s4="Primitive",a4="Sequence",c4="HashMap",u4="ZipWith";var fv=(t,e)=>[...t,...e],Cre="effect/ConfigProvider",l4=Symbol.for(Cre),Lp=Ht("effect/ConfigProvider"),Rre="effect/ConfigProviderFlat",p4=Symbol.for(Rre),Are=t=>({[l4]:l4,pipe(){return K(this,arguments)},...t}),Tre=t=>({[p4]:p4,patch:t.patch,load:(e,r,o=!0)=>t.load(e,r,o),enumerateChildren:t.enumerateChildren}),$re=t=>Are({load:e=>w(Bn(t,oo(),e,!1),r=>Ut(Ls(r),{onNone:()=>_e(Ui(oo(),`Expected a single value having structure: ${e}`)),onSome:$})),flattened:t}),d4=t=>{let{pathDelim:e,seqDelim:r}=Object.assign({},{pathDelim:"_",seqDelim:","},t),o=c=>b(c,ki(e)),n=c=>c.split(e),i=()=>typeof process<"u"&&"env"in process&&typeof process.env=="object"?process.env:{};return $re(Tre({load:(c,u,l=!0)=>{let p=o(c),f=i(),d=p in f?B(f[p]):z();return b(d,ra(()=>Ui(c,`Expected ${p} to exist in the process context`)),w(m=>Fre(m,c,u,r,l)))},enumerateChildren:c=>M(()=>{let u=i(),f=Object.keys(u).map(d=>n(d.toUpperCase())).filter(d=>{for(let m=0;m<c.length;m++){let g=b(c,RA(m)),y=d[m];if(y===void 0||g!==y)return!1}return!0}).flatMap(d=>d.slice(c.length,c.length+1));return ub(f)}),patch:Xq}))};var Pre=(t,e,r,o)=>{let n=NA(r.length,c=>c>=o.length?z():B([t(c),c+1])),i=NA(o.length,c=>c>=r.length?z():B([e(c),c+1])),s=fv(r,n),a=fv(o,i);return[s,a]},Nre=(t,e)=>{let r=e;if(r._tag==="Nested"){let o=t.slice();for(;r._tag==="Nested";)o.push(r.name),r=r.config;return o}return t},Bn=(t,e,r,o)=>{let n=r;switch(n._tag){case Qq:return $($r(n.value));case r4:return oe(()=>Bn(t,e,n.config,o));case e4:return _e(Ui(e,n.message));case t4:return b(oe(()=>Bn(t,e,n.first,o)),co(i=>n.condition(i)?b(Bn(t,e,n.second,o),co(s=>_e(R$(i,s)))):_e(i)));case n4:return oe(()=>Bn(t,e,n.config(),o));case o4:return oe(()=>b(Bn(t,e,n.original,o),w(nr(i=>b(n.mapOrFail(i),ra(aa(Nre(e,n.original))))))));case i4:return oe(()=>Bn(t,fv(e,$r(n.name)),n.config,o));case s4:return b(dv(e,t.patch),w(i=>b(t.load(i,n,o),w(s=>{if(s.length===0){let a=b(j_(i),qt(()=>"<n/a>"));return _e(Ui([],`Expected ${n.description} with name ${a}`))}return $(s)}))));case a4:return b(dv(e,t.patch),w(i=>b(t.enumerateChildren(i),w(jre),w(s=>s.length===0?oe(()=>F(Bn(t,e,n.config,!0),$r)):b(nr(s,a=>Bn(t,TU(e,`[${a}]`),n.config,!0)),F(a=>{let c=L_(a);return c.length===0?$r(oo()):$r(c)}))))));case c4:return oe(()=>b(dv(e,t.patch),w(i=>b(t.enumerateChildren(i),w(s=>b(s,nr(a=>Bn(t,fv(i,$r(a)),n.valueConfig,o)),F(a=>a.length===0?$r(vc()):b(zre(a),$o(c=>K1($A(Re(s),c)))))))))));case u4:return oe(()=>b(Bn(t,e,n.left,o),Un,w(i=>b(Bn(t,e,n.right,o),Un,w(s=>{if(Ao(i)&&Ao(s))return _e(C$(i.left,s.left));if(Ao(i)&&up(s))return _e(i.left);if(up(i)&&Ao(s))return _e(s.left);if(up(i)&&up(s)){let a=b(e,ki(".")),c=Mre(e,a),[u,l]=Pre(c,c,b(i.right,$o(Tr)),b(s.right,$o(Tr)));return b(u,$A(l),nr(([p,f])=>b(Nc(p,f),F(([d,m])=>n.zip(d,m)))))}throw new Error("BUG: ConfigProvider.fromFlatLoop - please report an issue at https://github.com/Effect-TS/effect/issues")})))))}},Mre=(t,e)=>r=>$n(Ui(t,`The element at index ${r} in a sequence at path "${e}" was missing`));var Dre=(t,e)=>t.split(new RegExp(`\\s*${LU(e)}\\s*`)),Fre=(t,e,r,o,n)=>n?b(Dre(t,o),nr(i=>r.parse(i.trim())),ra(aa(e))):b(r.parse(t),Th({onFailure:aa(e),onSuccess:$r})),zre=t=>Object.keys(t[0]).map(e=>t.map(r=>r[e])),jre=t=>b(nr(t,Ure),Th({onFailure:()=>oo(),onSuccess:pc(qs)}),Un,F(F_));var Lre=/^(\[(\d+)\])$/,Ure=t=>{let e=t.match(Lre);if(e!==null){let r=e[2];return b(r!==void 0&&r.length>0?B(r):z(),lp(qre))}return z()};var qre=t=>{let e=Number.parseInt(t);return Number.isNaN(e)?z():B(e)};var f4=Symbol.for("effect/Console"),qi=Ht("effect/Console"),m4={[f4]:f4,assert(t,...e){return M(()=>{console.assert(t,...e)})},clear:M(()=>{console.clear()}),count(t){return M(()=>{console.count(t)})},countReset(t){return M(()=>{console.countReset(t)})},debug(...t){return M(()=>{console.debug(...t)})},dir(t,e){return M(()=>{console.dir(t,e)})},dirxml(...t){return M(()=>{console.dirxml(...t)})},error(...t){return M(()=>{console.error(...t)})},group(t){return t?.collapsed?M(()=>console.groupCollapsed(t?.label)):M(()=>console.group(t?.label))},groupEnd:M(()=>{console.groupEnd()}),info(...t){return M(()=>{console.info(...t)})},log(...t){return M(()=>{console.log(...t)})},table(t,e){return M(()=>{console.table(t,e)})},time(t){return M(()=>console.time(t))},timeEnd(t){return M(()=>console.timeEnd(t))},timeLog(t,...e){return M(()=>{console.timeLog(t,...e)})},trace(...t){return M(()=>{console.trace(...t)})},warn(...t){return M(()=>{console.warn(...t)})},unsafe:console};var Bre="effect/Random",Zh=Symbol.for(Bre),Hi=Ht("effect/Random"),A$=class{seed;[Zh]=Zh;PRNG;constructor(e){this.seed=e,this.PRNG=new O_(e)}get next(){return M(()=>this.PRNG.number())}get nextBoolean(){return F(this.next,e=>e>.5)}get nextInt(){return M(()=>this.PRNG.integer(Number.MAX_SAFE_INTEGER))}nextRange(e,r){return F(this.next,o=>(r-e)*o+e)}nextIntBetween(e,r){return M(()=>this.PRNG.integer(r-e)+e)}shuffle(e){return g4(e,r=>this.nextIntBetween(0,r))}},g4=(t,e)=>oe(()=>b(M(()=>Array.from(t)),w(r=>{let o=[];for(let n=r.length;n>=2;n=n-1)o.push(n);return b(o,gn(n=>b(e(n),F(i=>Wre(r,n-1,i)))),Ge(fc(r)))}))),Wre=(t,e,r)=>{let o=t[e];return t[e]=t[r],t[r]=o,t},$$=t=>new A$(G(t)),T$=class{values;[Zh]=Zh;index=0;constructor(e){if(this.values=e,e.length===0)throw new Error("Requires at least one value")}getNextValue(){let e=this.values[this.index];return this.index=(this.index+1)%this.values.length,e}get next(){return M(()=>{let e=this.getNextValue();return typeof e=="number"?Math.max(0,Math.min(1,e)):G(e)/2147483647})}get nextBoolean(){return M(()=>{let e=this.getNextValue();return typeof e=="boolean"?e:G(e)%2===0})}get nextInt(){return M(()=>{let e=this.getNextValue();return typeof e=="number"&&Number.isFinite(e)?Math.round(e):Math.abs(G(e))})}nextRange(e,r){return F(this.next,o=>(r-e)*o+e)}nextIntBetween(e,r){return M(()=>{let o=this.getNextValue();if(typeof o=="number"&&Number.isFinite(o))return Math.max(e,Math.min(r-1,Math.round(o)));let n=Math.abs(G(o));return e+n%(r-e)})}shuffle(e){return g4(e,r=>this.nextIntBetween(0,r))}},y4=t=>new T$(t);var _4=Symbol.for("effect/Tracer"),Zre=t=>({[_4]:_4,...t}),Bi=Ht("effect/Tracer"),xr=Ht("effect/ParentSpan"),b4=(function(){let t="abcdef0123456789",e=t.length;return function(r){let o="";for(let n=0;n<r;n++)o+=t.charAt(Math.floor(Math.random()*e));return o}})(),P$=class{name;parent;context;startTime;kind;_tag="Span";spanId;traceId="native";sampled=!0;status;attributes;events=[];links;constructor(e,r,o,n,i,s){this.name=e,this.parent=r,this.context=o,this.startTime=i,this.kind=s,this.status={_tag:"Started",startTime:i},this.attributes=new Map,this.traceId=r._tag==="Some"?r.value.traceId:b4(32),this.spanId=b4(16),this.links=Array.from(n)}end(e,r){this.status={_tag:"Ended",endTime:e,exit:r,startTime:this.status.startTime}}attribute(e,r){this.attributes.set(e,r)}event(e,r,o){this.events.push([e,r,o??{}])}addLinks(e){this.links.push(...e)}},v4=Zre({span:(t,e,r,o,n,i)=>new P$(t,e,r,o,n,i),context:t=>t()});var vn=t=>{if(t?.captureStackTrace===!1)return t;if(t?.captureStackTrace!==void 0&&typeof t.captureStackTrace!="boolean")return t;let e=Error.stackTraceLimit;Error.stackTraceLimit=3;let r=new Error;Error.stackTraceLimit=e;let o=!1;return{...t,captureStackTrace:()=>{if(o!==!1)return o;if(r.stack!==void 0){let n=r.stack.split(`
|
|
100
|
+
`);if(n[3]!==void 0)return o=n[3].trim(),o}}}},Up=io()("effect/Tracer/DisablePropagation",{defaultValue:ro});var Gre=b(Jt(),Ze(jr,S$()),Ze(qi,m4),Ze(Hi,$$(Math.random())),Ze(Lp,d4()),Ze(Bi,v4)),ut=pe(Symbol.for("effect/DefaultServices/currentServices"),()=>Yb(Gre)),S4=t=>{let e=Wt(t);return Gh(r=>r.sleep(e))},mv=t=>Ee(e=>t(e.currentDefaultServices)),Gh=t=>mv(e=>t(e.unsafeMap.get(jr.key))),w4=Gh(t=>t.currentTimeMillis),E4=Gh(t=>t.currentTimeNanos),k4=h(2,(t,e)=>Dt(ut,Ze(jr,e))(t)),I4=h(2,(t,e)=>Dt(ut,Ze(Lp,e))(t)),O4=t=>mv(e=>t(e.unsafeMap.get(Lp.key)));var hv=t=>mv(e=>t(e.unsafeMap.get(Hi.key))),C4=h(2,(t,e)=>Dt(ut,Ze(Hi,e))(t));var gv=t=>mv(e=>t(e.unsafeMap.get(Bi.key))),R4=h(2,(t,e)=>Dt(ut,Ze(Bi,e))(t));var Vh=S4,Hp=w4,A4=E4,T4=Gh,$4=jr;function P4(t){return new Ko(t)}function N4(){return P4(new Map)}var N$=Symbol.for("effect/FiberRefs"),Ko=class{locals;[N$]=N$;constructor(e){this.locals=e}pipe(){return K(this,arguments)}},Vre=(t,e,r,o=!1)=>{let n=t,i=e,s=r,a=o,c;for(;c===void 0;)if(fr(i)&&fr(s)){let u=Kt(i)[0],l=To(i),p=Kt(s)[0],f=Kt(s)[1],d=To(s);u.startTimeMillis<p.startTimeMillis?(s=d,a=!0):u.startTimeMillis>p.startTimeMillis?i=l:u.id<p.id?(s=d,a=!0):u.id>p.id?i=l:c=[f,a]}else c=[n.initial,!0];return c},xv=h(3,(t,e,r)=>{let o=new Map(t.locals);return r.locals.forEach((n,i)=>{let s=n[0][1];if(!n[0][0][Q](e)){if(!o.has(i)){if(V(s,i.initial))return;o.set(i,[[e,i.join(i.initial,s)]]);return}let a=o.get(i),[c,u]=Vre(i,a,n);if(u){let l=i.diff(c,s),p=a[0][1],f=i.join(p,i.patch(l)(p));if(!V(p,f)){let d,m=a[0][0];m[Q](e)?d=[[m,f],...a.slice(1)]:d=[[e,f],...a],o.set(i,d)}}}}),new Ko(o)}),D$=h(2,(t,e)=>{let r=new Map;return M4(t,r,e),new Ko(r)}),M4=(t,e,r)=>{t.locals.forEach((o,n)=>{let i=o[0][1],s=n.patch(n.fork)(i);V(i,s)?e.set(n,o):e.set(n,[[r,s],...o])})},D4=t=>ub(t.locals.keys()),F4=t=>gn(D4(t),e=>Tc(e,Wi(t,e))),Kh=h(2,(t,e)=>{let r=new Map(t.locals);return r.delete(e),new Ko(r)}),_v=h(2,(t,e)=>t.locals.has(e)?B(Kt(t.locals.get(e))[1]):z()),Wi=h(2,(t,e)=>b(_v(t,e),qt(()=>e.initial))),Bp=h(2,(t,{fiberId:e,fiberRef:r,value:o})=>{if(t.locals.size===0)return new Ko(new Map([[r,[[e,o]]]]));let n=new Map(t.locals);return M$(n,e,r,o),new Ko(n)}),M$=(t,e,r,o)=>{let n=t.get(r)??[],i;if(fr(n)){let[s,a]=Kt(n);if(s[Q](e)){if(V(a,o))return;i=[[e,o],...n.slice(1)]}else i=[[e,o],...n]}else i=[[e,o]];t.set(r,i)},z4=h(2,(t,{entries:e,forkAs:r})=>{if(t.locals.size===0)return new Ko(new Map(e));let o=new Map(t.locals);return r!==void 0&&M4(t,o,r),e.forEach(([n,i])=>{i.length===1?M$(o,i[0][0],n,i[0][1]):i.forEach(([s,a])=>{M$(o,s,n,a)})}),new Ko(o)});var z$=_v,j4=Wi,L4=xv,U4=F4;var q4=z4;var H4=N4;var Kre=sq,j$=aq,L$=cq,U$=n$,q$=o$,H$=i$,B$=uq,Jre=lq;var Yre=b(qs,EU(t=>t.ordinal));var W$=kA(Yre);var Z$=t=>{switch(t){case"All":return Kre;case"Debug":return H$;case"Error":return L$;case"Fatal":return j$;case"Info":return q$;case"Trace":return B$;case"None":return Jre;case"Warning":return U$}};var B4=(t,e)=>({label:t,startTime:e}),V$=t=>t.replace(/[\s="]/g,"_"),K$=t=>e=>`${V$(e.label)}=${t-e.startTime}ms`;var Z4=B4;var V4=wi,J$=Ei;var Xre=hU;var Zi=class extends Xre{};var ca=Symbol.for("effect/Readable");var YRe={[ca]:ca,pipe(){return K(this,arguments)}};var vv=Symbol.for("effect/Ref"),Q$={_A:t=>t},X$=class extends Zi{ref;commit(){return this.get}[vv]=Q$;[ca]=ca;constructor(e){super(),this.ref=e,this.get=M(()=>Vr(this.ref))}get;modify(e){return M(()=>{let r=Vr(this.ref),[o,n]=e(r);return r!==n&&jn(n)(this.ref),o})}},Wp=t=>new X$(Lo(t)),Zc=t=>M(()=>Wp(t)),ir=t=>t.get,Jo=h(2,(t,e)=>t.modify(()=>[void 0,e])),K4=h(2,(t,e)=>t.modify(r=>[r,e]));var eP=h(2,(t,e)=>t.modify(e));var Gc=h(2,(t,e)=>t.modify(r=>[void 0,e(r)]));var wv=Zc,Ev=ir,J4=K4;var Y4=Gc;var X4=gv;var eH="Empty",tH="Add",rH="Remove",nH="Update",oH="AndThen",iH={_tag:eH},Yh=(t,e)=>{let r=new Map(t.locals),o=iH;for(let[n,i]of e.locals.entries()){let s=Kt(i)[1],a=r.get(n);if(a!==void 0){let c=Kt(a)[1];V(c,s)||(o=kv({_tag:nH,fiberRef:n,patch:n.diff(c,s)})(o))}else o=kv({_tag:tH,fiberRef:n,value:s})(o);r.delete(n)}for(let[n]of r.entries())o=kv({_tag:rH,fiberRef:n})(o);return o},kv=h(2,(t,e)=>({_tag:oH,first:t,second:e})),Iv=h(3,(t,e,r)=>{let o=r,n=$r(t);for(;fr(n);){let i=Kt(n),s=To(n);switch(i._tag){case eH:{n=s;break}case tH:{o=Bp(o,{fiberId:e,fiberRef:i.fiberRef,value:i.value}),n=s;break}case rH:{o=Kh(o,i.fiberRef),n=s;break}case nH:{let a=Wi(o,i.fiberRef);o=Bp(o,{fiberId:e,fiberRef:i.fiberRef,value:i.fiberRef.patch(i.patch)(a)}),n=s;break}case oH:{n=pp(i.first)(pp(i.second)(s));break}}}return o});var aH="effect/MetricLabel",rP=Symbol.for(aH),nP=class{key;value;[rP]=rP;_hash;constructor(e,r){this.key=e,this.value=r,this._hash=Le(aH+this.key+this.value)}[re](){return this._hash}[Q](e){return Qre(e)&&this.key===e.key&&this.value===e.value}pipe(){return K(this,arguments)}},Vc=(t,e)=>new nP(t,e),Qre=t=>Y(t,rP);var cH=h(t=>ze(t[0]),function(){let t=arguments;return Dt(t[0],ji,typeof t[1]=="string"?hr(t[1],t[2]):e=>Object.entries(t[1]).reduce((r,[o,n])=>hr(r,o,n),e))}),Zp=t=>F(t,B),uH=t=>ra(t,B),iP=t=>{let e,r;return typeof t=="function"?e=t:(e=t.try,r=t.catch),oe(()=>{try{return $(yt(e))}catch(o){return _e(r?yt(()=>r(o)):new Fh(o,"An unknown error occurred in Effect.try"))}})},lH=h(3,(t,e,r)=>co(t,o=>Y(o,e)&&o[e]===r.failure?r.onFailure(o):_e(o))),pH=h(2,(t,e)=>Bo(t,r=>{let o=Ks(r,n=>Op(n)?B(n):z());switch(o._tag){case"None":return we(r);case"Some":return e(o.value.defect)}})),dH=h(2,(t,e)=>st(t,{onFailure:r=>{let o=e(r);switch(o._tag){case"None":return we(r);case"Some":return o.value}},onSuccess:$})),fH=h(2,(t,e)=>Bo(t,r=>{let o=Ks(r,n=>Op(n)?B(n):z());switch(o._tag){case"None":return we(r);case"Some":{let n=e(o.value.defect);return n._tag==="Some"?n.value:we(r)}}})),mH=h(t=>ze(t[0]),(t,...e)=>{let r=e[e.length-1],o;return e.length===2?o=Ms(e[0]):o=n=>{let i=Y(n,"_tag")?n._tag:void 0;if(!i)return!1;for(let s=0;s<e.length-1;s++)if(e[s]===i)return!0;return!1},Rh(t,o,r)}),hH=h(2,(t,e)=>{let r;return Rh(t,o=>(r??=Object.keys(e),Y(o,"_tag")&&Gm(o._tag)&&r.includes(o._tag)),o=>e[o._tag](o))}),gH=t=>Ah(t,{onFailure:be,onSuccess:()=>Nr}),Yo=T4,yH=Yo($),xH=h(2,(t,e)=>Pe(Vh(e),t)),Rv=t=>Ee((e,r)=>t({id:e.id(),status:r,interruptors:vh(e.getFiberRef(Fc))})),_H=Rv(t=>yc(t.interruptors)>0?Wb:de),bH=Rv($),Gp=t=>eg(t,Av,Yh),ene=t=>eg(t,Nc(Av,$p),([e,r],[o,n])=>[Yh(e,o),Ln(r,n)]),vH=$({}),SH=XL(F,w),wH=YL(F),EH=JL(F),kH=h(2,(t,e)=>oe(()=>{let r=t[Symbol.iterator](),o=[],n,i=$(!1),s=0;for(;(n=r.next())&&!n.done;){let a=n.value,c=s++;i=w(i,u=>u?(o.push(a),$(!0)):e(a,c))}return F(i,()=>o)})),IH=h(2,(t,e)=>oe(()=>{let r=t[Symbol.iterator](),o=[],n,i=$(!0),s=0;for(;(n=r.next())&&!n.done;){let a=n.value,c=s++;i=w(i,u=>F(u?e(a,c):$(!1),l=>(l||o.push(a),l)))}return F(i,()=>o)})),OH=t=>F(tn(),t),sP=t=>$c(t,()=>w(Go(),()=>sP(t))),CH=h(2,(t,e)=>F(nr(t,be),dp(e))),RH=h(3,(t,e,r)=>Xh(t,e,o=>Xs(()=>r(o)))),AH=h(3,(t,e,r)=>Xh(t,e,()=>Ys(r))),Xh=h(3,(t,e,r)=>w(t,o=>e(o)?$(o):r(o))),TH=h(3,(t,e,r)=>oe(()=>e(t)?$(t):_e(r(t)))),$H=h(t=>ze(t[0]),(t,e,r)=>Xh(t,e,o=>r===void 0?_e(new en):qn(()=>r(o)))),PH=h(2,(t,e)=>oe(()=>{let r=t[Symbol.iterator](),o=r.next();return o.done?$(z()):NH(r,0,e,o.value)})),NH=(t,e,r,o)=>w(r(o,e),n=>{if(n)return $(B(o));let i=t.next();return i.done?$(z()):NH(t,e+1,r,i.value)}),MH=t=>oe(()=>{let e=fc(t);return rr(e)?b(mr(e),Us(Xt(e),(r,o)=>$c(r,()=>o))):Xs(()=>new Dh("Received an empty collection of effects"))}),DH=h(2,(t,e)=>ta(e(ta(t)))),Qh=h(2,(t,e)=>Mt(t,{onFailure:r=>$(e.onFailure(r)),onSuccess:r=>$(e.onSuccess(r))})),FH=h(2,(t,e)=>oe(()=>zH(t[Symbol.iterator](),0,e))),zH=(t,e,r)=>{let o=t.next();return o.done?$(!0):w(r(o.value,e),n=>n?zH(t,e+1,r):$(n))},aP=t=>{let e=w(w(t,()=>Go()),()=>e);return e},Av=Ee(t=>$(t.getFiberRefs())),jH=t=>w(t,e=>{let o=e[Symbol.iterator]().next();return o.done?_e(new en):$(o.value)}),Tv=t=>Qh(t,{onFailure:Co,onSuccess:Co}),LH=t=>st(t,{onFailure:e=>uP(e,"An error was silently ignored because it is not anticipated to be useful"),onSuccess:()=>de}),UH=t=>Nv((e,r)=>L4(r,e,t)),qH=t=>Qh(t,{onFailure:Oo,onSuccess:ro}),HH=t=>Qh(t,{onFailure:ro,onSuccess:Oo}),cP=(t,e)=>oe(()=>e.while(t)?w(e.body(t),r=>cP(r,e)):$(t)),Gi=t=>(...e)=>{let r=js(t),o;for(let n=0,i=e.length;n<i;n++){let s=e[n];Ab(s)&&(o!==void 0?o=ft(o,s):o=s,e=[...e.slice(0,n),...e.slice(n+1)],n--)}return o===void 0&&(o=Nr),Ee(n=>(n.log(e,o,r),de))},BH=Gi(),WH=Gi(B$),uP=Gi(H$),ZH=Gi(q$),GH=Gi(U$),VH=Gi(L$),KH=Gi(j$),JH=h(2,(t,e)=>w(Hp,r=>Dt(t,Qb,xb(Z4(e,r))))),YH=yn(ji),XH=(t,e)=>e.discard?e6(t,e.while,e.step,e.body):F(QH(t,e.while,e.step,e.body),Re),QH=(t,e,r,o)=>oe(()=>e(t)?w(o(t),n=>F(QH(r(t),e,r,o),xb(n))):M(()=>qo())),e6=(t,e,r,o)=>oe(()=>e(t)?w(o(t),()=>e6(r(t),e,r,o)):de),t6=h(3,(t,e,r)=>oe(()=>{let o=t[Symbol.iterator](),n=[],i=$(e),s,a=0;for(;!(s=o.next()).done;){let c=a++,u=s.value;i=w(i,l=>F(r(l,u,c),([p,f])=>(n.push(f),p)))}return F(i,c=>[c,n])})),Vp=h(2,(t,e)=>st(t,{onFailure:r=>Mi(()=>e(r)),onSuccess:$})),$v=t=>b(_n(),w(e=>b(ene(t),Wo(e),lP,F(r=>Pe(r,b(Zt(e),w(([o,n])=>Ge(Nc(Kc(o[0]),na(o[1])),n)))))))),r6=t=>Mt(t,{onFailure:e=>$(e),onSuccess:$}),Pv=t=>F(t,e=>!e),n6=t=>w(t,e=>{switch(e._tag){case"None":return de;case"Some":return _e(new en)}}),lP=t=>F(wv(!0),e=>bt(Pp(t,J4(e,!1)))),o6=t=>Mt(t,{onFailure:()=>$(z()),onSuccess:e=>$(B(e))}),i6=h(2,(t,e)=>$c(t,()=>qn(e))),s6=h(2,(t,e)=>$c(t,()=>M(e))),a6=t=>st(t,{onFailure:e=>{let r=Re(bh(e));return r.length===0?we(e):_e(r)},onSuccess:$}),Kc=t=>Nv((e,r)=>b(t,Iv(e,r))),c6=t=>t.length>=1?gr((e,r)=>{try{t(r).then(o=>e($(o)),o=>e(yr(o)))}catch(o){e(yr(o))}}):gr(e=>{try{t().then(r=>e($(r)),r=>e(yr(r)))}catch(r){e(yr(r))}}),ua=h(3,(t,e,r)=>Hn(o=>bn(t,Ze(o,e,r)))),la=h(3,(t,e,r)=>Hn(o=>w(r,n=>bn(t,b(o,Ze(e,n)))))),u6=hv($),l6=h(3,(t,e,r)=>Re(t).reduce((o,n,i)=>w(o,s=>r(s,n,i)),$(e))),p6=h(3,(t,e,r)=>Re(t).reduceRight((o,n,i)=>w(o,s=>r(n,s,i)),$(e))),d6=h(3,(t,e,r)=>w(M(()=>t[Symbol.iterator]()),o=>f6(o,0,e,r.while,r.body))),f6=(t,e,r,o,n)=>{let i=t.next();return!i.done&&o(r)?w(n(r,i.value,e),s=>f6(t,e+1,s,o,n)):$(r)},m6=h(2,(t,e)=>oe(()=>h6(t,e))),h6=(t,e)=>w(t,r=>e<=0?$(r):Pe(Go(),h6(t,e-1))),g6=t=>st(t,{onFailure:_e,onSuccess:$}),y6=t=>oe(()=>U4(t)),Jc=Vh,Yc=$(z()),x6=t=>$(B(t)),eg=h(3,(t,e,r)=>w(e,o=>w(t,n=>F(e,i=>[r(o,i),n])))),_6=h(t=>ze(t[0]),function(){return pP(arguments[0],typeof arguments[1]=="string"?[Vc(arguments[1],arguments[2])]:Object.entries(arguments[1]).map(([t,e])=>Vc(t,e)))}),pP=h(2,(t,e)=>Dt(t,Li,r=>no(r,e))),b6=h(2,(t,e)=>oe(()=>{let r=t[Symbol.iterator](),o=[],n,i=$(!1),s=0;for(;(n=r.next())&&!n.done;){let a=n.value,c=s++;i=w(i,u=>u?$(!0):(o.push(a),e(a,c)))}return F(i,()=>o)})),v6=h(2,(t,e)=>oe(()=>{let r=t[Symbol.iterator](),o=[],n,i=$(!0),s=0;for(;(n=r.next())&&!n.done;){let a=n.value,c=s++;i=w(i,u=>b(u?e(a,c):$(!1),F(l=>(l&&o.push(a),l))))}return F(i,()=>o)})),S6=h(2,(t,{onFailure:e,onSuccess:r})=>st(t,{onFailure:o=>{let n=ao(o);switch(n._tag){case"Left":return Pe(e(n.left),we(o));case"Right":return we(o)}},onSuccess:o=>Ge(r(o),o)})),w6=h(2,(t,e)=>Bo(t,r=>Ut(YT(r),{onNone:()=>we(r),onSome:o=>Pe(e(o),we(r))}))),dP=h(2,(t,e)=>st(t,{onFailure:r=>{let o=ao(r);switch(o._tag){case"Left":return Pe(e(o.left),we(r));case"Right":return we(r)}},onSuccess:$})),E6=h(3,(t,e,r)=>dP(t,o=>Ms(o,e)?r(o):de)),k6=h(2,(t,e)=>st(t,{onFailure:r=>Pe(e(r),we(r)),onSuccess:$})),I6=t=>fP(t,A4),fP=h(2,(t,e)=>eg(t,e,(r,o)=>oh(o-r))),tne=X4,O6=tne($),mP=t=>{let e,r;typeof t=="function"?e=t:(e=t.try,r=t.catch);let o=n=>r?qn(()=>r(n)):_e(new Fh(n,"An unknown error occurred in Effect.tryPromise"));return e.length>=1?gr((n,i)=>{try{e(i).then(s=>n($(s)),s=>n(o(s)))}catch(s){n(o(s))}}):gr(n=>{try{e().then(i=>n($(i)),i=>n(o(i)))}catch(i){n(o(i))}})},C6=h(2,(t,e)=>w(t,r=>iP({try:()=>e.try(r),catch:e.catch}))),R6=h(2,(t,e)=>w(t,r=>mP({try:e.try.length>=1?o=>e.try(r,o):()=>e.try(r),catch:e.catch}))),A6=h(2,(t,e)=>oe(()=>e()?Yc:Zp(t))),T6=h(2,(t,e)=>w(e,r=>r?Yc:Zp(t))),$6=t=>Vp(t,XT),Nv=t=>Ee(e=>(e.setFiberRefs(t(e.id(),e.getFiberRefs())),de)),P6=h(3,(t,e,r)=>qc(t,o=>Ze(o,e,r(Mn(o,e))))),Mv=h(2,(t,e)=>oe(()=>e()?F(t,B):$(z()))),N6=h(3,(t,e,r)=>w(yn(e),o=>r(o)?F(t,n=>[o,B(n)]):$([o,z()]))),M6=h(3,(t,e,r)=>w(Ev(e),o=>r(o)?F(t,n=>[o,B(n)]):$([o,z()]))),D6=h(2,(t,e)=>e(t)),F6=(t,e)=>(...r)=>w(t,o=>e(o)(...r)),z6=(t,e)=>(...r)=>F(t,o=>e(o)(...r)),hP=t=>new Proxy({},{get(e,r,o){return(...n)=>w(t,i=>i[r](...n))}}),gP=t=>new Proxy({},{get(e,r,o){return w(t,n=>ze(n[r])?n[r]:$(n[r]))}}),j6=t=>({functions:hP(t),constants:gP(t)}),L6=t=>F(tn(),dn(t)),yP=t=>w(tn(),dn(t)),U6=function(){let t=arguments;return Tv(w(_P,e=>M(()=>{if(typeof t[0]=="string")e.attribute(t[0],t[1]);else for(let r in t[0])e.attribute(r,t[0][r])})))},q6=function(){let t=arguments,e=Array.isArray(t[0])?t[0]:[{_tag:"SpanLink",span:t[0],attributes:t[1]??{}}];return Tv(w(xP,r=>M(()=>r.addLinks(e))))},H6=h(t=>ze(t[0]),function(){let t=arguments;return Dt(t[0],Mp,typeof t[1]=="string"?hr(t[1],t[2]):e=>Object.entries(t[1]).reduce((r,[o,n])=>hr(r,o,n),e))}),B6=yP(xr),xP=w(tn(),t=>{let e=t.unsafeMap.get(xr.key);return e!==void 0&&e._tag==="Span"?$(e):_e(new en)}),_P=w(tn(),t=>{let e=tg(dn(t,xr));return e._tag==="Some"&&e.value._tag==="Span"?$(e.value):_e(new en)}),W6=h(t=>ze(t[0]),(t,e,r)=>Dt(t,rv,Z_({_tag:"SpanLink",span:e,attributes:r??{}}))),Z6=BigInt(0),tg=lp(t=>Nt(t.context,Up)?t._tag==="Span"?tg(t.parent):z():B(t)),Dv=(t,e,r)=>{let o=!t.getFiberRef(Mh)||r.context&&Nt(r.context,Up),n=t.getFiberRef(Qr),i=r.parent?B(r.parent):r.root?z():tg(dn(n,xr)),s;if(o)s=Oq({name:e,parent:i,context:Ze(r.context??Jt(),Up,!0)});else{let a=t.getFiberRef(ut),c=Nt(a,Bi),u=Nt(a,$4),l=t.getFiberRef(sa),p=t.getFiberRefs(),f=z$(p,Mp),d=z$(p,rv),m=d._tag==="Some"?r.links!==void 0?[...Fn(d.value),...r.links??[]]:Fn(d.value):r.links??oo();s=c.span(e,i,r.context??Jt(),m,l?u.unsafeCurrentTimeNanos():Z6,r.kind??"internal",r),f._tag==="Some"&&e2(f.value,(g,y)=>s.attribute(y,g)),r.attributes!==void 0&&Object.entries(r.attributes).forEach(([g,y])=>s.attribute(g,y))}return typeof r.captureStackTrace=="function"&&Sh.set(s,r.captureStackTrace),s},G6=(t,e)=>(e=vn(e),Ee(r=>$(Dv(r,t,e)))),V6=yn(Mp),K6=yn(rv),bP=(t,e,r,o)=>M(()=>{t.status._tag!=="Ended"&&(c$(e)&&Sh.has(t)&&t.attribute("code.stacktrace",Sh.get(t)()),t.end(o?r.unsafeCurrentTimeNanos():Z6,e))}),Ov=(t,...e)=>{let r=vn(e.length===1?void 0:e[0]),o=e[e.length-1];return Ee(n=>{let i=Dv(n,t,r),s=n.getFiberRef(sa),a=Nt(n.getFiberRef(ut),jr);return Dr(o(i),c=>bP(i,c,a,s))})},Cv=h(2,(t,e)=>ua(t,xr,e)),vP=function(){let t=typeof arguments[0]!="string",e=t?arguments[1]:arguments[0],r=vn(t?arguments[2]:arguments[1]);if(t){let o=arguments[0];return Ov(e,r,n=>Cv(o,n))}return o=>Ov(e,r,n=>Cv(o,n))},J6=t=>function(){let e=t.captureStackTrace??!1;if(t.captureStackTrace!==!1){let r=Error.stackTraceLimit;Error.stackTraceLimit=2;let o=new Error;Error.stackTraceLimit=r;let n=!1;e=()=>{if(n!==!1)return n;if(o.stack)return n=o.stack.trim().split(`
|
|
101
|
+
`).slice(2).join(`
|
|
102
|
+
`).trim(),n}}return oe(()=>{let r=typeof t.options=="function"?t.options.apply(null,arguments):t.options;return vP(oe(()=>yt(()=>t.body.apply(this,arguments))),r.name,{...r,captureStackTrace:e})})},Y6=t=>t==null?_e(new en):$(t),X6=t=>co(F(t,B),e=>_q(e)?Yc:_e(e));var Q6="Sequential",eB="Parallel",rne="ParallelN",Wn={_tag:Q6},rg={_tag:eB},tB=t=>({_tag:rne,parallelism:t}),SP=t=>t._tag===Q6,wP=t=>t._tag===eB;var zv=Wn,jv=rg,Lv=tB;var Xc=Yh;var Qc=Iv;var qv="effect/FiberStatus",pa=Symbol.for(qv),Uv="Done",nB="Running",oB="Suspended",nne=Le(`${qv}-${Uv}`),kP=class{[pa]=pa;_tag=Uv;[re](){return nne}[Q](e){return Hv(e)&&e._tag===Uv}},IP=class{runtimeFlags;[pa]=pa;_tag=nB;constructor(e){this.runtimeFlags=e}[re](){return b(G(qv),ae(G(this._tag)),ae(G(this.runtimeFlags)),ye(this))}[Q](e){return Hv(e)&&e._tag===nB&&this.runtimeFlags===e.runtimeFlags}},OP=class{runtimeFlags;blockingOn;[pa]=pa;_tag=oB;constructor(e,r){this.runtimeFlags=e,this.blockingOn=r}[re](){return b(G(qv),ae(G(this._tag)),ae(G(this.runtimeFlags)),ae(G(this.blockingOn)),ye(this))}[Q](e){return Hv(e)&&e._tag===oB&&this.runtimeFlags===e.runtimeFlags&&V(this.blockingOn,e.blockingOn)}},iB=new kP,sB=t=>new IP(t),aB=(t,e)=>new OP(t,e),Hv=t=>Y(t,pa),cB=t=>t._tag===Uv;var uB=iB,CP=sB,lB=aB;var pB=cB;var ine=Symbol.for("effect/Micro"),Bv=Symbol.for("effect/Micro/MicroExit");var fB=Symbol.for("effect/Micro/MicroCause");var sne={_E:be},Wv=class extends globalThis.Error{_tag;traces;[fB];constructor(e,r,o){let n=`MicroCause.${e}`,i,s,a;if(r instanceof globalThis.Error){i=`(${n}) ${r.name}`,s=r.message;let c=s.split(`
|
|
103
|
+
`).length;a=r.stack?`(${n}) ${r.stack.split(`
|
|
104
|
+
`).slice(0,c+3).join(`
|
|
105
|
+
`)}`:`${i}: ${s}`}else i=n,s=vi(r,0),a=`${i}: ${s}`;o.length>0&&(a+=`
|
|
106
|
+
${o.join(`
|
|
107
|
+
`)}`),super(s),this._tag=e,this.traces=o,this[fB]=sne,this.name=i,this.stack=a}pipe(){return K(this,arguments)}toString(){return this.stack}[xe](){return this.stack}};var AP=class extends Wv{defect;constructor(e,r=[]){super("Die",e,r),this.defect=e}},ane=(t,e=[])=>new AP(t,e),TP=class extends Wv{constructor(e=[]){super("Interrupt","interrupted",e)}},cne=(t=[])=>new TP(t);var yB=t=>t._tag==="Interrupt";var mB=Symbol.for("effect/Micro/MicroFiber"),une={_A:be,_E:be},Zv=class{context;interruptible;[mB];_stack=[];_observers=[];_exit;_children;currentOpCount=0;constructor(e,r=!0){this.context=e,this.interruptible=r,this[mB]=une}getRef(e){return JU(this.context,e)}addObserver(e){return this._exit?(e(this._exit),Co):(this._observers.push(e),()=>{let r=this._observers.indexOf(e);r>=0&&this._observers.splice(r,1)})}_interrupted=!1;unsafeInterrupt(){this._exit||(this._interrupted=!0,this.interruptible&&this.evaluate(MP))}unsafePoll(){return this._exit}evaluate(e){if(this._exit)return;if(this._yielded!==void 0){let n=this._yielded;this._yielded=void 0,n()}let r=this.runLoop(e);if(r===Jp)return;let o=hB.interruptChildren&&hB.interruptChildren(this);if(o!==void 0)return this.evaluate(eu(o,()=>r));this._exit=r;for(let n=0;n<this._observers.length;n++)this._observers[n](r);this._observers.length=0}runLoop(e){let r=!1,o=e;this.currentOpCount=0;try{for(;;){if(this.currentOpCount++,!r&&this.getRef(ed).shouldYield(this)){r=!0;let n=o;o=eu(hne,()=>n)}if(o=o[$P](this),o===Jp){let n=this._yielded;return Bv in n?(this._yielded=void 0,n):Jp}}}catch(n){return Y(o,$P)?Yv(n):Yv(`MicroFiber.runLoop: Not a valid effect: ${String(o)}`)}}getCont(e){for(;;){let r=this._stack.pop();if(!r)return;let o=r[Gv]&&r[Gv](this);if(o)return{[e]:o};if(r[e])return r}}_yielded=void 0;yieldWith(e){return this._yielded=e,Jp}children(){return this._children??=new Set}},hB=pe("effect/Micro/fiberMiddleware",()=>({interruptChildren:void 0}));var lne=t=>ng(()=>{for(let o of t)o.unsafeInterrupt();let e=t[Symbol.iterator](),r=ng(()=>{let o=e.next();for(;!o.done;){if(o.value.unsafePoll()){o=e.next();continue}let n=o.value;return bB(i=>{n.addObserver(s=>{i(r)})})}return Qp});return r}),xB=Symbol.for("effect/Micro/identifier"),Je=Symbol.for("effect/Micro/args"),$P=Symbol.for("effect/Micro/evaluate"),da=Symbol.for("effect/Micro/successCont"),Yp=Symbol.for("effect/Micro/failureCont"),Gv=Symbol.for("effect/Micro/ensureCont"),Jp=Symbol.for("effect/Micro/Yield"),pne={_A:be,_E:be,_R:be},dne={...V4,_op:"Micro",[ine]:pne,pipe(){return K(this,arguments)},[Symbol.iterator](){return new sc(new Ro(this))},toJSON(){return{_id:"Micro",op:this[xB],...Je in this?{args:this[Je]}:void 0}},toString(){return Ce(this)},[xe](){return Ce(this)}};function fne(t){return Yv("Micro.evaluate: Not implemented")}var Qv=t=>({...dne,[xB]:t.op,[$P]:t.eval??fne,[da]:t.contA,[Yp]:t.contE,[Gv]:t.ensure}),fa=t=>{let e=Qv(t);return function(){let r=Object.create(e);return r[Je]=t.single===!1?arguments:arguments[0],r}},_B=t=>{let e={...Qv(t),[Bv]:Bv,_tag:t.op,get[t.prop](){return this[Je]},toJSON(){return{_id:"MicroExit",_tag:t.op,[t.prop]:this[Je]}},[Q](r){return Sne(r)&&r._tag===t.op&&V(this[Je],r[Je])},[re](){return ye(this,ae(Le(t.op))(G(this[Je])))}};return function(r){let o=Object.create(e);return o[Je]=r,o[da]=void 0,o[Yp]=void 0,o[Gv]=void 0,o}},Xp=_B({op:"Success",prop:"value",eval(t){let e=t.getCont(da);return e?e[da](this[Je],t):t.yieldWith(this)}}),Vv=_B({op:"Failure",prop:"cause",eval(t){let e=t.getCont(Yp);for(;yB(this[Je])&&e&&t.interruptible;)e=t.getCont(Yp);return e?e[Yp](this[Je],t):t.yieldWith(this)}});var Kv=fa({op:"Sync",eval(t){let e=this[Je](),r=t.getCont(da);return r?r[da](e,t):t.yieldWith(tS(e))}}),ng=fa({op:"Suspend",eval(t){return this[Je]()}}),mne=fa({op:"Yield",eval(t){let e=!1;return t.getRef(ed).scheduleTask(()=>{e||t.evaluate(Qp)},this[Je]??0),t.yieldWith(()=>{e=!0})}}),hne=mne(0);var Jv=Xp(void 0);var eS=fa({op:"WithMicroFiber",eval(t){return this[Je](t)}});var gne=fa({op:"Async",single:!1,eval(t){let e=this[Je][0],r=!1,o=!1,n=this[Je][1]?new AbortController:void 0,i=e(s=>{r||(r=!0,o?t.evaluate(s):o=s)},n?.signal);return o!==!1?o:(o=!0,t._yielded=()=>{r=!0},n===void 0&&i===void 0||t._stack.push(yne(()=>(r=!0,n?.abort(),i??Qp))),Jp)}}),yne=fa({op:"AsyncFinalizer",ensure(t){t.interruptible&&(t.interruptible=!1,t._stack.push(DP(!0)))},contE(t,e){return yB(t)?eu(this[Je](),()=>Vv(t)):Vv(t)}}),bB=t=>gne(t,t.length>=2);var xne=h(2,(t,e)=>vne(t,r=>e));var _ne=t=>One(t,{onFailure:rS,onSuccess:tS});var eu=h(2,(t,e)=>{let r=Object.create(bne);return r[Je]=t,r[da]=e,r}),bne=Qv({op:"OnSuccess",eval(t){return t._stack.push(this),this[Je]}});var vne=h(2,(t,e)=>eu(t,r=>Xp(e(r)))),Sne=t=>Y(t,Bv),tS=Xp,rS=Vv,MP=rS(cne());var Yv=t=>rS(ane(t));var Qp=tS(void 0),wne=t=>{for(let e of t)if(e._tag==="Failure")return e;return Qp},Ene="setImmediate"in globalThis?globalThis.setImmediate:t=>setTimeout(t,0),Xv=class{tasks=[];running=!1;scheduleTask(e,r){this.tasks.push(e),this.running||(this.running=!0,Ene(this.afterScheduled))}afterScheduled=()=>{this.running=!1,this.runTasks()};runTasks(){let e=this.tasks;this.tasks=[];for(let r=0,o=e.length;r<o;r++)e[r]()}shouldYield(e){return e.currentOpCount>=e.getRef(PP)}flush(){for(;this.tasks.length>0;)this.runTasks()}};var kne=h(2,(t,e)=>eS(r=>{let o=r.context;return r.context=e(o),Cne(t,()=>(r.context=o,Jv))}));var vB=h(2,(t,e)=>kne(t,Dn(e)));var PP=class extends io()("effect/Micro/currentMaxOpsBeforeYield",{defaultValue:()=>2048}){},NP=class extends io()("effect/Micro/currentConcurrency",{defaultValue:()=>"unbounded"}){},ed=class extends io()("effect/Micro/currentScheduler",{defaultValue:()=>new Xv}){};var SB=h(2,(t,e)=>{let r=Object.create(Ine);return r[Je]=t,r[da]=e.onSuccess,r[Yp]=e.onFailure,r}),Ine=Qv({op:"OnSuccessAndFailure",eval(t){return t._stack.push(this),this[Je]}}),One=h(2,(t,e)=>SB(t,{onFailure:r=>Kv(()=>e.onFailure(r)),onSuccess:r=>Kv(()=>e.onSuccess(r))}));var RP=Symbol.for("effect/Micro/MicroScope");var gB=class t{[RP];state={_tag:"Open",finalizers:new Set};constructor(){this[RP]=RP}unsafeAddFinalizer(e){this.state._tag==="Open"&&this.state.finalizers.add(e)}addFinalizer(e){return ng(()=>this.state._tag==="Open"?(this.state.finalizers.add(e),Jv):e(this.state.exit))}unsafeRemoveFinalizer(e){this.state._tag==="Open"&&this.state.finalizers.delete(e)}close(e){return ng(()=>{if(this.state._tag==="Open"){let r=Array.from(this.state.finalizers).reverse();return this.state={_tag:"Closed",exit:e},eu($ne(r,o=>_ne(o(e))),wne)}return Jv})}get fork(){return Kv(()=>{let e=new t;if(this.state._tag==="Closed")return e.state=this.state,e;function r(o){return e.close(o)}return this.state.finalizers.add(r),e.unsafeAddFinalizer(o=>Kv(()=>this.unsafeRemoveFinalizer(r))),e})}};var Cne=h(2,(t,e)=>Ane(r=>SB(r(t),{onFailure:o=>eu(e(rS(o)),()=>Vv(o)),onSuccess:o=>eu(e(tS(o)),()=>Xp(o))})));var DP=fa({op:"SetInterruptible",ensure(t){if(t.interruptible=this[Je],t._interrupted&&t.interruptible)return()=>MP}}),Rne=t=>eS(e=>e.interruptible?t:(e.interruptible=!0,e._stack.push(DP(!1)),e._interrupted?MP:t)),Ane=t=>eS(e=>e.interruptible?(e.interruptible=!1,e._stack.push(DP(!0)),t(Rne)):t(be));var Tne=fa({op:"While",contA(t,e){return this[Je].step(t),this[Je].while()?(e._stack.push(this),this[Je].body()):Qp},eval(t){return this[Je].while()?(t._stack.push(this),this[Je].body()):Qp}}),$ne=(t,e,r)=>eS(o=>{let n=r?.concurrency==="inherit"?o.getRef(NP):r?.concurrency??1,i=n==="unbounded"?Number.POSITIVE_INFINITY:Math.max(1,n),s=Re(t),a=s.length;if(a===0)return r?.discard?Jv:Xp([]);let c=r?.discard?void 0:new Array(a),u=0;return i===1?xne(Tne({while:()=>u<s.length,body:()=>e(s[u],u),step:c?l=>c[u++]=l:l=>u++}),c):bB(l=>{let p=new Set,f,d=0,m=0,g=!1,y=!1;function v(){for(g=!0;d<i&&u<a;){let E=u,R=s[E];u++,d++;try{let S=Pne(o,e(R,E),!0,!0);p.add(S),S.addObserver(P=>{p.delete(S),!y&&(P._tag==="Failure"?f===void 0&&(f=P,a=u,p.forEach(D=>D.unsafeInterrupt())):c!==void 0&&(c[E]=P.value),m++,d--,m===a?l(f??Xp(c)):!g&&d<i&&v())})}catch(S){f=Yv(S),a=u,p.forEach(P=>P.unsafeInterrupt())}}g=!1}return v(),ng(()=>(y=!0,u=a,lne(p)))})});var Pne=(t,e,r=!1,o=!1)=>{let n=new Zv(t.context,t.interruptible);return o||(t.children().add(n),n.addObserver(()=>t.children().delete(n))),r?n.evaluate(e):t.getRef(ed).scheduleTask(()=>n.evaluate(e),0),n};var wB=(t,e)=>{let r=new Zv(ed.context(e?.scheduler??new Xv));if(r.evaluate(t),e?.signal)if(e.signal.aborted)r.unsafeInterrupt();else{let o=()=>r.unsafeInterrupt();e.signal.addEventListener("abort",o,{once:!0}),r.addObserver(()=>e.signal.removeEventListener("abort",o))}return r};var FP=class t{scheduleDrain;running=!1;tasks=new nS;constructor(e){this.scheduleDrain=e}starveInternal=e=>{let r=this.tasks.buckets;this.tasks.buckets=[];for(let[o,n]of r)for(let i=0;i<n.length;i++)n[i]();this.tasks.buckets.length===0?this.running=!1:this.starve(e)};starve(e=0){this.scheduleDrain(e,this.starveInternal)}scheduleTask(e,r){this.tasks.scheduleTask(e,r),this.running||(this.running=!0,this.starve())}static cached(e){let r=new t(e),o=new WeakMap;return n=>{if(n===void 0)return r;let i=o.get(n);return i===void 0&&(i=new t(e),o.set(n,i)),i}}},nS=class{buckets=[];scheduleTask(e,r){let o=this.buckets.length,n,i=0;for(;i<o&&this.buckets[i][0]<=r;i++)n=this.buckets[i];n&&n[0]===r?n[1].push(e):i===o?this.buckets.push([r,[e]]):this.buckets.splice(i,0,[r,[e]])}},zP=class{maxNextTickBeforeTimer;getRunner=FP.cached((e,r)=>{e>=this.maxNextTickBeforeTimer?setTimeout(()=>r(0),0):Promise.resolve(void 0).then(()=>r(e+1))});constructor(e){this.maxNextTickBeforeTimer=e}shouldYield(e){return e.currentOpCount>e.getFiberRef(Xb)?e.getFiberRef(zi):!1}scheduleTask(e,r,o){this.getRunner(o).scheduleTask(e,r)}},kB=pe(Symbol.for("effect/Scheduler/defaultScheduler"),()=>new zP(2048)),oS=class{tasks=new nS;deferred=!1;scheduleTask(e,r,o){this.deferred?kB.scheduleTask(e,r,o):this.tasks.scheduleTask(e,r)}shouldYield(e){return e.currentOpCount>e.getFiberRef(Xb)?e.getFiberRef(zi):!1}flush(){for(;this.tasks.buckets.length>0;){let e=this.tasks.buckets;this.tasks.buckets=[];for(let[r,o]of e)for(let n=0;n<o.length;n++)o[n]()}this.deferred=!0}};var Vi=pe(Symbol.for("effect/FiberRef/currentScheduler"),()=>gt(kB)),IB=h(2,(t,e)=>ht(t,Vi,e));var sS=pe(Symbol.for("effect/FiberRef/currentRequestMap"),()=>gt(new Map));var jP=(t,e,r,o)=>{switch(t){case void 0:return e();case"unbounded":return r();case"inherit":return or(ev,n=>n==="unbounded"?r():n>1?o(n):e());default:return t>1?o(t):e()}},og=(t,e,r)=>{switch(t){case void 0:return e();case"unbounded":return r();case"inherit":return or(ev,o=>o==="unbounded"||o>1?r():e());default:return t>1?r():e()}};var aS="InterruptSignal",cS="Stateful",uS="Resume",lS="YieldNow",pS=t=>({_tag:aS,cause:t}),td=t=>({_tag:cS,onFiber:t}),tu=t=>({_tag:uS,effect:t}),OB=()=>({_tag:lS});var Dne="effect/FiberScope",dS=Symbol.for(Dne),LP=class{[dS]=dS;fiberId=Kr;roots=new Set;add(e,r){this.roots.add(r),r.addObserver(()=>{this.roots.delete(r)})}},UP=class{fiberId;parent;[dS]=dS;constructor(e,r){this.fiberId=e,this.parent=r}add(e,r){this.parent.tell(td(o=>{o.addChild(r),r.addObserver(()=>{o.removeChild(r)})}))}},RB=t=>new UP(t.id(),t),Ki=pe(Symbol.for("effect/FiberScope/Global"),()=>new LP);var Fne="effect/Fiber",ig=Symbol.for(Fne),sg={_E:t=>t,_A:t=>t},zne={[ig]:sg,pipe(){return K(this,arguments)}},jne="effect/Fiber",qP=Symbol.for(jne);var TB=t=>qP in t,$B=t=>t.await;var PB=t=>t.inheritAll;var NB=h(2,Np(function*(t,e){for(let r of t){if(TB(r)){r.unsafeInterruptAsFork(e);continue}yield*r.interruptAsFork(e)}for(let r of t)TB(r)&&r.unsafePoll()||(yield*r.await)})),MB=h(2,(t,e)=>t.interruptAsFork(e)),lo=t=>Mc(Yr(t.await),t.inheritAll);var PAe={...Ei,commit(){return lo(this)},...zne,id:()=>Kr,await:ia,children:$([]),inheritAll:ia,poll:$(z()),interruptAsFork:()=>ia};var ma="effect/FiberCurrent";var Lne="effect/Logger",FB=Symbol.for(Lne),zB={_Message:t=>t,_Output:t=>t},fS=t=>({[FB]:zB,log:t,pipe(){return K(this,arguments)}});var DAe={[FB]:zB,log:Co,pipe(){return K(this,arguments)}};var Une=/^[^\s"=]*$/,qne=(t,e)=>({annotations:r,cause:o,date:n,fiberId:i,logLevel:s,message:a,spans:c})=>{let u=m=>m.match(Une)?m:t(m),l=(m,g)=>`${V$(m)}=${u(g)}`,p=(m,g)=>" "+l(m,g),f=l("timestamp",n.toISOString());f+=p("level",s.label),f+=p("fiber",hb(i));let d=AU(a);for(let m=0;m<d.length;m++)f+=p("message",vi(d[m],e));KT(o)||(f+=p("cause",Ho(o,{renderErrorCause:!0})));for(let m of c)f+=" "+K$(n.getTime())(m);for(let[m,g]of r)f+=p(m,vi(g,e));return f},Hne=t=>`"${t.replace(/\\([\s\S])|(")/g,"\\$1$2")}"`,jB=fS(qne(Hne));var ru={bold:"1",red:"31",green:"32",yellow:"33",blue:"34",cyan:"36",white:"37",gray:"90",black:"30",bgBrightRed:"101"},FAe={None:[],All:[],Trace:[ru.gray],Debug:[ru.blue],Info:[ru.green],Warning:[ru.yellow],Error:[ru.red],Fatal:[ru.bgBrightRed,ru.black]};var LB=typeof process=="object"&&process!==null&&typeof process.stdout=="object"&&process.stdout!==null,zAe=LB&&process.stdout.isTTY===!0,jAe=LB||"Deno"in globalThis;var UB="effect/MetricBoundaries",HP=Symbol.for(UB),BP=class{values;[HP]=HP;constructor(e){this.values=e,this._hash=b(Le(UB),ae(Zr(this.values)))}_hash;[re](){return this._hash}[Q](e){return Wne(e)&&V(this.values,e.values)}pipe(){return K(this,arguments)}},Wne=t=>Y(t,HP),Zne=t=>{let e=b(t,CA(xt(Number.POSITIVE_INFINITY)),MA);return new BP(e)};var qB=t=>b(OA(t.count-1,e=>t.start*Math.pow(t.factor,e)),nh,Zne);var Vne="effect/MetricKeyType",ag=Symbol.for(Vne),ZB="effect/MetricKeyType/Counter",WP=Symbol.for(ZB),GB="effect/MetricKeyType/Frequency",ZP=Symbol.for(GB),VB="effect/MetricKeyType/Gauge",GP=Symbol.for(VB),KB="effect/MetricKeyType/Histogram",VP=Symbol.for(KB),JB="effect/MetricKeyType/Summary",KP=Symbol.for(JB),cg={_In:t=>t,_Out:t=>t},JP=class{incremental;bigint;[ag]=cg;[WP]=WP;constructor(e,r){this.incremental=e,this.bigint=r,this._hash=Le(ZB)}_hash;[re](){return this._hash}[Q](e){return XP(e)}pipe(){return K(this,arguments)}},Kne=Le(GB),HB=class{preregisteredWords;[ag]=cg;[ZP]=ZP;constructor(e){this.preregisteredWords=e}[re](){return Kne}[Q](e){return QP(e)}pipe(){return K(this,arguments)}},Jne=Le(VB),BB=class{bigint;[ag]=cg;[GP]=GP;constructor(e){this.bigint=e}[re](){return Jne}[Q](e){return e0(e)}pipe(){return K(this,arguments)}},YP=class{boundaries;[ag]=cg;[VP]=VP;constructor(e){this.boundaries=e,this._hash=b(Le(KB),ae(G(this.boundaries)))}_hash;[re](){return this._hash}[Q](e){return t0(e)&&V(this.boundaries,e.boundaries)}pipe(){return K(this,arguments)}},WB=class{maxAge;maxSize;error;quantiles;[ag]=cg;[KP]=KP;constructor(e,r,o,n){this.maxAge=e,this.maxSize=r,this.error=o,this.quantiles=n,this._hash=b(Le(JB),ae(G(this.maxAge)),ae(G(this.maxSize)),ae(G(this.error)),ae(Zr(this.quantiles)))}_hash;[re](){return this._hash}[Q](e){return r0(e)&&V(this.maxAge,e.maxAge)&&this.maxSize===e.maxSize&&this.error===e.error&&V(this.quantiles,e.quantiles)}pipe(){return K(this,arguments)}},YB=t=>new JP(t?.incremental??!1,t?.bigint??!1);var XB=t=>new YP(t);var XP=t=>Y(t,WP),QP=t=>Y(t,ZP),e0=t=>Y(t,GP),t0=t=>Y(t,VP),r0=t=>Y(t,KP);var Yne="effect/MetricKey",eW=Symbol.for(Yne),Xne={_Type:t=>t},Qne=fp(V),ug=class{name;keyType;description;tags;[eW]=Xne;constructor(e,r,o,n=[]){this.name=e,this.keyType=r,this.description=o,this.tags=n,this._hash=b(Le(this.name+this.description),ae(G(this.keyType)),ae(Zr(this.tags)))}_hash;[re](){return this._hash}[Q](e){return eoe(e)&&this.name===e.name&&V(this.keyType,e.keyType)&&V(this.description,e.description)&&Qne(this.tags,e.tags)}pipe(){return K(this,arguments)}},eoe=t=>Y(t,eW),tW=(t,e)=>new ug(t,YB(e),js(e?.description));var rW=(t,e,r)=>new ug(t,XB(e),js(r));var nW=h(2,(t,e)=>e.length===0?t:new ug(t.name,t.keyType,t.description,no(t.tags,e)));var roe="effect/MetricState",lg=Symbol.for(roe),oW="effect/MetricState/Counter",n0=Symbol.for(oW),iW="effect/MetricState/Frequency",o0=Symbol.for(iW),sW="effect/MetricState/Gauge",i0=Symbol.for(sW),aW="effect/MetricState/Histogram",s0=Symbol.for(aW),cW="effect/MetricState/Summary",a0=Symbol.for(cW),pg={_A:t=>t},c0=class{count;[lg]=pg;[n0]=n0;constructor(e){this.count=e}[re](){return b(G(oW),ae(G(this.count)),ye(this))}[Q](e){return ooe(e)&&this.count===e.count}pipe(){return K(this,arguments)}},noe=fp(V),u0=class{occurrences;[lg]=pg;[o0]=o0;constructor(e){this.occurrences=e}_hash;[re](){return b(Le(iW),ae(Zr(Re(this.occurrences.entries()))),ye(this))}[Q](e){return ioe(e)&&noe(Re(this.occurrences.entries()),Re(e.occurrences.entries()))}pipe(){return K(this,arguments)}},l0=class{value;[lg]=pg;[i0]=i0;constructor(e){this.value=e}[re](){return b(G(sW),ae(G(this.value)),ye(this))}[Q](e){return soe(e)&&this.value===e.value}pipe(){return K(this,arguments)}},p0=class{buckets;count;min;max;sum;[lg]=pg;[s0]=s0;constructor(e,r,o,n,i){this.buckets=e,this.count=r,this.min=o,this.max=n,this.sum=i}[re](){return b(G(aW),ae(G(this.buckets)),ae(G(this.count)),ae(G(this.min)),ae(G(this.max)),ae(G(this.sum)),ye(this))}[Q](e){return aoe(e)&&V(this.buckets,e.buckets)&&this.count===e.count&&this.min===e.min&&this.max===e.max&&this.sum===e.sum}pipe(){return K(this,arguments)}},d0=class{error;quantiles;count;min;max;sum;[lg]=pg;[a0]=a0;constructor(e,r,o,n,i,s){this.error=e,this.quantiles=r,this.count=o,this.min=n,this.max=i,this.sum=s}[re](){return b(G(cW),ae(G(this.error)),ae(G(this.quantiles)),ae(G(this.count)),ae(G(this.min)),ae(G(this.max)),ae(G(this.sum)),ye(this))}[Q](e){return coe(e)&&this.error===e.error&&V(this.quantiles,e.quantiles)&&this.count===e.count&&this.min===e.min&&this.max===e.max&&this.sum===e.sum}pipe(){return K(this,arguments)}},uW=t=>new c0(t),lW=t=>new u0(t),pW=t=>new l0(t),dW=t=>new p0(t.buckets,t.count,t.min,t.max,t.sum),fW=t=>new d0(t.error,t.quantiles,t.count,t.min,t.max,t.sum);var ooe=t=>Y(t,n0),ioe=t=>Y(t,o0),soe=t=>Y(t,i0),aoe=t=>Y(t,s0),coe=t=>Y(t,a0);var loe="effect/MetricHook",poe=Symbol.for(loe),doe={_In:t=>t,_Out:t=>t},dg=t=>({[poe]:doe,pipe(){return K(this,arguments)},...t});var mW=BigInt(0),gW=t=>{let e=t.keyType.bigint?mW:0,r=t.keyType.incremental?t.keyType.bigint?n=>n>=mW:n=>n>=0:n=>!0,o=n=>{r(n)&&(e=e+n)};return dg({get:()=>uW(e),update:o,modify:o})},yW=t=>{let e=new Map;for(let o of t.keyType.preregisteredWords)e.set(o,0);let r=o=>{let n=e.get(o)??0;e.set(o,n+1)};return dg({get:()=>lW(e),update:r,modify:r})},xW=(t,e)=>{let r=e;return dg({get:()=>pW(r),update:o=>{r=o},modify:o=>{r=r+o}})},_W=t=>{let e=t.keyType.boundaries.values,r=e.length,o=new Uint32Array(r+1),n=new Float64Array(r),i=0,s=0,a=Number.MAX_VALUE,c=Number.MIN_VALUE;b(e,pc(qs),$o((p,f)=>{n[f]=p}));let u=p=>{let f=0,d=r;for(;f!==d;){let m=Math.floor(f+(d-f)/2),g=n[m];p<=g?d=m:f=m,d===f+1&&(p<=n[f]?d=f:f=d)}o[f]=o[f]+1,i=i+1,s=s+p,p<a&&(a=p),p>c&&(c=p)},l=()=>{let p=th(r),f=0;for(let d=0;d<r;d++){let m=n[d],g=o[d];f=f+g,p[d]=[m,f]}return p};return dg({get:()=>dW({buckets:l(),count:i,min:a,max:c,sum:s}),update:u,modify:u})},bW=t=>{let{error:e,maxAge:r,maxSize:o,quantiles:n}=t.keyType,i=b(n,pc(qs)),s=th(o),a=0,c=0,u=0,l=0,p=0,f=m=>{let g=[],y=0;for(;y!==o-1;){let v=s[y];if(v!=null){let[E,R]=v,S=Mo(m-E);YA(S,Hs)&&m1(S,r)&&g.push(R)}y=y+1}return foe(e,i,pc(g,qs))},d=(m,g)=>{if(o>0){a=a+1;let y=a%o;s[y]=[g,m]}l=c===0?m:Math.min(l,m),p=c===0?m:Math.max(p,m),c=c+1,u=u+m};return dg({get:()=>fW({error:e,quantiles:f(Date.now()),count:c,min:l,max:p,sum:u}),update:([m,g])=>d(m,g),modify:([m,g])=>d(m,g)})},foe=(t,e,r)=>{let o=r.length;if(!fr(e))return oo();let n=e[0],i=e.slice(1),s=hW(t,o,z(),0,n,r),a=$r(s);return i.forEach(c=>{a.push(hW(t,o,s.value,s.consumed,c,s.rest))}),$o(a,c=>[c.quantile,c.value])},hW=(t,e,r,o,n,i)=>{let s=t,a=e,c=r,u=o,l=n,p=i,f=t,d=e,m=r,g=o,y=n,v=i;for(;;){if(!fr(p))return{quantile:l,value:z(),consumed:u,rest:[]};if(l===1)return{quantile:l,value:B(AA(p)),consumed:u+p.length,rest:[]};let E=Kt(p),R=NU(p,N=>N===E),S=l*a,P=s/2*S,D=u+R[0].length,X=Math.abs(D-S);if(D<S-P){f=s,d=a,m=Ls(p),g=D,y=l,v=R[1],s=f,a=d,c=m,u=g,l=y,p=v;continue}if(D>S+P){let N=at(c)?B(E):c;return{quantile:l,value:N,consumed:u,rest:p}}switch(c._tag){case"None":{f=s,d=a,m=Ls(p),g=D,y=l,v=R[1],s=f,a=d,c=m,u=g,l=y,p=v;continue}case"Some":{let N=Math.abs(S-c.value);if(X<N){f=s,d=a,m=Ls(p),g=D,y=l,v=R[1],s=f,a=d,c=m,u=g,l=y,p=v;continue}return{quantile:l,value:B(c.value),consumed:u,rest:p}}}}throw new Error("BUG: MetricHook.resolveQuantiles - please report an issue at https://github.com/Effect-TS/effect/issues")};var hoe="effect/MetricPair",goe=Symbol.for(hoe),yoe={_Type:t=>t};var vW=(t,e)=>({[goe]:yoe,metricKey:t,metricState:e,pipe(){return K(this,arguments)}});var _oe="effect/MetricRegistry",SW=Symbol.for(_oe),f0=class{[SW]=SW;map=Hc();snapshot(){let e=[];for(let[r,o]of this.map)e.push(vW(r,o.get()));return e}get(e){let r=b(this.map,Tt(e),dr);if(r==null){if(XP(e.keyType))return this.getCounter(e);if(e0(e.keyType))return this.getGauge(e);if(QP(e.keyType))return this.getFrequency(e);if(t0(e.keyType))return this.getHistogram(e);if(r0(e.keyType))return this.getSummary(e);throw new Error("BUG: MetricRegistry.get - unknown MetricKeyType - please report an issue at https://github.com/Effect-TS/effect/issues")}else return r}getCounter(e){let r=b(this.map,Tt(e),dr);if(r==null){let o=gW(e);b(this.map,uo(e))||b(this.map,rn(e,o)),r=o}return r}getFrequency(e){let r=b(this.map,Tt(e),dr);if(r==null){let o=yW(e);b(this.map,uo(e))||b(this.map,rn(e,o)),r=o}return r}getGauge(e){let r=b(this.map,Tt(e),dr);if(r==null){let o=xW(e,e.keyType.bigint?BigInt(0):0);b(this.map,uo(e))||b(this.map,rn(e,o)),r=o}return r}getHistogram(e){let r=b(this.map,Tt(e),dr);if(r==null){let o=_W(e);b(this.map,uo(e))||b(this.map,rn(e,o)),r=o}return r}getSummary(e){let r=b(this.map,Tt(e),dr);if(r==null){let o=bW(e);b(this.map,uo(e))||b(this.map,rn(e,o)),r=o}return r}},wW=()=>new f0;var voe="effect/Metric",Soe=Symbol.for(voe),woe={_Type:t=>t,_In:t=>t,_Out:t=>t},EW=pe(Symbol.for("effect/Metric/globalMetricRegistry"),()=>wW()),kW=function(t,e,r,o){let n=Object.assign(i=>Fr(i,s=>koe(n,s)),{[Soe]:woe,keyType:t,unsafeUpdate:e,unsafeValue:r,unsafeModify:o,register(){return this.unsafeValue([]),this},pipe(){return K(this,arguments)}});return n};var fg=(t,e)=>IW(tW(t,e));var IW=t=>{let e,r=new WeakMap,o=n=>{if(n.length===0)return e!==void 0||(e=EW.get(t)),e;let i=r.get(n);return i!==void 0||(i=EW.get(nW(t,n)),r.set(n,i)),i};return kW(t.keyType,(n,i)=>o(i).update(n),n=>o(n).get(),(n,i)=>o(i).modify(n))};var OW=(t,e,r)=>IW(rW(t,e,r));var CW=h(3,(t,e,r)=>Eoe(t,[Vc(e,r)]));var Eoe=h(2,(t,e)=>kW(t.keyType,(r,o)=>t.unsafeUpdate(r,no(e,o)),r=>t.unsafeValue(no(e,r)),(r,o)=>t.unsafeModify(r,no(e,o))));var koe=h(2,(t,e)=>or(Li,r=>M(()=>t.unsafeUpdate(e,r))));var Ooe="effect/Request",m0=Symbol.for(Ooe),Coe={_E:t=>t,_A:t=>t},mTe={...ap,[m0]:Coe},RW=t=>Y(t,m0);var h0=h(2,(t,e)=>or(sS,r=>M(()=>{if(r.has(t)){let o=r.get(t);o.state.completed||(o.state.completed=!0,Bh(o.result,e))}})));var rd=class{count=0;observers=new Set;interrupted=!1;addObserver(e){this.observers.add(e)}removeObserver(e){this.observers.delete(e)}increment(){this.count++,this.observers.forEach(e=>e(this.count))}decrement(){this.count--,this.observers.forEach(e=>e(this.count))}};var ha={Forward:0,Backward:1},mS=class t{self;stack;direction;count=0;constructor(e,r,o){this.self=e,this.stack=r,this.direction=o}clone(){return new t(this.self,this.stack.slice(),this.direction)}reversed(){return new t(this.self,this.stack.slice(),this.direction===ha.Forward?ha.Backward:ha.Forward)}next(){let e=this.entry;switch(this.count++,this.direction===ha.Forward?this.moveNext():this.movePrev(),e._tag){case"None":return{done:!0,value:this.count};case"Some":return{done:!1,value:e.value}}}get key(){return this.stack.length>0?B(this.stack[this.stack.length-1].key):z()}get value(){return this.stack.length>0?B(this.stack[this.stack.length-1].value):z()}get entry(){return Pn(j_(this.stack),e=>[e.key,e.value])}get index(){let e=0,r=this.stack;if(r.length===0){let o=this.self._root;return o!=null?o.count:0}else r[r.length-1].left!=null&&(e=r[r.length-1].left.count);for(let o=r.length-2;o>=0;--o)r[o+1]===r[o].right&&(++e,r[o].left!=null&&(e+=r[o].left.count));return e}moveNext(){let e=this.stack;if(e.length===0)return;let r=e[e.length-1];if(r.right!=null)for(r=r.right;r!=null;)e.push(r),r=r.left;else for(e.pop();e.length>0&&e[e.length-1].right===r;)r=e[e.length-1],e.pop()}get hasNext(){let e=this.stack;if(e.length===0)return!1;if(e[e.length-1].right!=null)return!0;for(let r=e.length-1;r>0;--r)if(e[r-1].left===e[r])return!0;return!1}movePrev(){let e=this.stack;if(e.length===0)return;let r=e[e.length-1];if(r!=null&&r.left!=null)for(r=r.left;r!=null;)e.push(r),r=r.right;else for(e.pop();e.length>0&&e[e.length-1].left===r;)r=e[e.length-1],e.pop()}get hasPrev(){let e=this.stack;if(e.length===0)return!1;if(e[e.length-1].left!=null)return!0;for(let r=e.length-1;r>0;--r)if(e[r-1].right===e[r])return!0;return!1}};var ce={Red:0,Black:1},po=({color:t,count:e,key:r,left:o,right:n,value:i})=>({color:t,key:r,value:i,left:o,right:n,count:e});function g0(t,e){t.key=e.key,t.value=e.value,t.left=e.left,t.right=e.right,t.color=e.color,t.count=e.count}var Ji=({count:t,key:e,left:r,right:o,value:n},i)=>({color:i,key:e,value:n,left:r,right:o,count:t}),lt=t=>{t.count=1+(t.left?.count??0)+(t.right?.count??0)};var AW="effect/RedBlackTree",y0=Symbol.for(AW),Toe={_Key:t=>t,_Value:t=>t},$oe={[y0]:Toe,[re](){let t=G(AW);for(let e of this)t^=b(G(e[0]),ae(G(e[1])));return ye(this,t)},[Q](t){if(TW(t)){if((this._root?.count??0)!==(t._root?.count??0))return!1;let e=Array.from(t);return Array.from(this).every((r,o)=>{let n=e[o];return V(r[0],n[0])&&V(r[1],n[1])})}return!1},[Symbol.iterator](){let t=[],e=this._root;for(;e!=null;)t.push(e),e=e.left;return new mS(this,t,ha.Forward)},toString(){return Ce(this.toJSON())},toJSON(){return{_id:"RedBlackTree",values:Array.from(this).map(ke)}},[xe](){return this.toJSON()},pipe(){return K(this,arguments)}},mg=(t,e)=>{let r=Object.create($oe);return r._ord=t,r._root=e,r},TW=t=>Y(t,y0);var $W=h(2,(t,e)=>{let r=t._ord,o=t._root;for(;o!==void 0;){let n=r(e,o.key);if(V(e,o.key))return B(o.value);n<=0?o=o.left:o=o.right}return z()});var x0=h(2,(t,e)=>dt($W(t,e))),PW=h(3,(t,e,r)=>{let o=t._ord,n=t._root,i=[],s=[];for(;n!=null;){let a=o(e,n.key);i.push(n),s.push(a),a<=0?n=n.left:n=n.right}i.push({color:ce.Red,key:e,value:r,left:void 0,right:void 0,count:1});for(let a=i.length-2;a>=0;--a){let c=i[a];s[a]<=0?i[a]={color:c.color,key:c.key,value:c.value,left:i[a+1],right:c.right,count:c.count+1}:i[a]={color:c.color,key:c.key,value:c.value,left:c.left,right:i[a+1],count:c.count+1}}for(let a=i.length-1;a>1;--a){let c=i[a-1],u=i[a];if(c.color===ce.Black||u.color===ce.Black)break;let l=i[a-2];if(l.left===c)if(c.left===u){let p=l.right;if(p&&p.color===ce.Red)c.color=ce.Black,l.right=Ji(p,ce.Black),l.color=ce.Red,a-=1;else{if(l.color=ce.Red,l.left=c.right,c.color=ce.Black,c.right=l,i[a-2]=c,i[a-1]=u,lt(l),lt(c),a>=3){let f=i[a-3];f.left===l?f.left=c:f.right=c}break}}else{let p=l.right;if(p&&p.color===ce.Red)c.color=ce.Black,l.right=Ji(p,ce.Black),l.color=ce.Red,a-=1;else{if(c.right=u.left,l.color=ce.Red,l.left=u.right,u.color=ce.Black,u.left=c,u.right=l,i[a-2]=u,i[a-1]=c,lt(l),lt(c),lt(u),a>=3){let f=i[a-3];f.left===l?f.left=u:f.right=u}break}}else if(c.right===u){let p=l.left;if(p&&p.color===ce.Red)c.color=ce.Black,l.left=Ji(p,ce.Black),l.color=ce.Red,a-=1;else{if(l.color=ce.Red,l.right=c.left,c.color=ce.Black,c.left=l,i[a-2]=c,i[a-1]=u,lt(l),lt(c),a>=3){let f=i[a-3];f.right===l?f.right=c:f.left=c}break}}else{let p=l.left;if(p&&p.color===ce.Red)c.color=ce.Black,l.left=Ji(p,ce.Black),l.color=ce.Red,a-=1;else{if(c.left=u.right,l.color=ce.Red,l.right=u.left,u.color=ce.Black,u.right=c,u.left=l,i[a-2]=u,i[a-1]=c,lt(l),lt(c),lt(u),a>=3){let f=i[a-3];f.right===l?f.right=u:f.left=u}break}}}return i[0].color=ce.Black,mg(t._ord,i[0])}),NW=t=>MW(t,ha.Forward);var MW=(t,e)=>{let r=t[Symbol.iterator](),o=0;return{[Symbol.iterator]:()=>MW(t,e),next:()=>{o++;let n=r.key;switch(e===ha.Forward?r.moveNext():r.movePrev(),n._tag){case"None":return{done:!0,value:o};case"Some":return{done:!1,value:n.value}}}}};var DW=h(2,(t,e)=>{if(!x0(t,e))return t;let r=t._ord,o=r,n=t._root,i=[];for(;n!==void 0;){let c=o(e,n.key);i.push(n),V(e,n.key)?n=void 0:c<=0?n=n.left:n=n.right}if(i.length===0)return t;let s=new Array(i.length),a=i[i.length-1];s[s.length-1]={color:a.color,key:a.key,value:a.value,left:a.left,right:a.right,count:a.count};for(let c=i.length-2;c>=0;--c)a=i[c],a.left===i[c+1]?s[c]={color:a.color,key:a.key,value:a.value,left:s[c+1],right:a.right,count:a.count}:s[c]={color:a.color,key:a.key,value:a.value,left:a.left,right:s[c+1],count:a.count};if(a=s[s.length-1],a.left!==void 0&&a.right!==void 0){let c=s.length;for(a=a.left;a.right!=null;)s.push(a),a=a.right;let u=s[c-1];s.push({color:a.color,key:u.key,value:u.value,left:a.left,right:a.right,count:a.count}),s[c-1].key=a.key,s[c-1].value=a.value;for(let l=s.length-2;l>=c;--l)a=s[l],s[l]={color:a.color,key:a.key,value:a.value,left:a.left,right:s[l+1],count:a.count};s[c-1].left=s[c]}if(a=s[s.length-1],a.color===ce.Red){let c=s[s.length-2];c.left===a?c.left=void 0:c.right===a&&(c.right=void 0),s.pop();for(let u=0;u<s.length;++u)s[u].count--;return mg(r,s[0])}else if(a.left!==void 0||a.right!==void 0){a.left!==void 0?g0(a,a.left):a.right!==void 0&&g0(a,a.right),a.color=ce.Black;for(let c=0;c<s.length-1;++c)s[c].count--;return mg(r,s[0])}else{if(s.length===1)return mg(r,void 0);{for(let u=0;u<s.length;++u)s[u].count--;let c=s[s.length-2];Poe(s),c.left===a?c.left=void 0:c.right=void 0}}return mg(r,s[0])});var Poe=t=>{let e,r,o,n;for(let i=t.length-1;i>=0;--i){if(e=t[i],i===0){e.color=ce.Black;return}if(r=t[i-1],r.left===e){if(o=r.right,o!==void 0&&o.right!==void 0&&o.right.color===ce.Red){if(o=r.right=po(o),n=o.right=po(o.right),r.right=o.left,o.left=r,o.right=n,o.color=r.color,e.color=ce.Black,r.color=ce.Black,n.color=ce.Black,lt(r),lt(o),i>1){let s=t[i-2];s.left===r?s.left=o:s.right=o}t[i-1]=o;return}else if(o!==void 0&&o.left!==void 0&&o.left.color===ce.Red){if(o=r.right=po(o),n=o.left=po(o.left),r.right=n.left,o.left=n.right,n.left=r,n.right=o,n.color=r.color,r.color=ce.Black,o.color=ce.Black,e.color=ce.Black,lt(r),lt(o),lt(n),i>1){let s=t[i-2];s.left===r?s.left=n:s.right=n}t[i-1]=n;return}if(o!==void 0&&o.color===ce.Black)if(r.color===ce.Red){r.color=ce.Black,r.right=Ji(o,ce.Red);return}else{r.right=Ji(o,ce.Red);continue}else if(o!==void 0){if(o=po(o),r.right=o.left,o.left=r,o.color=r.color,r.color=ce.Red,lt(r),lt(o),i>1){let s=t[i-2];s.left===r?s.left=o:s.right=o}t[i-1]=o,t[i]=r,i+1<t.length?t[i+1]=e:t.push(e),i=i+2}}else{if(o=r.left,o!==void 0&&o.left!==void 0&&o.left.color===ce.Red){if(o=r.left=po(o),n=o.left=po(o.left),r.left=o.right,o.right=r,o.left=n,o.color=r.color,e.color=ce.Black,r.color=ce.Black,n.color=ce.Black,lt(r),lt(o),i>1){let s=t[i-2];s.right===r?s.right=o:s.left=o}t[i-1]=o;return}else if(o!==void 0&&o.right!==void 0&&o.right.color===ce.Red){if(o=r.left=po(o),n=o.right=po(o.right),r.left=n.right,o.right=n.left,n.right=r,n.left=o,n.color=r.color,r.color=ce.Black,o.color=ce.Black,e.color=ce.Black,lt(r),lt(o),lt(n),i>1){let s=t[i-2];s.right===r?s.right=n:s.left=n}t[i-1]=n;return}if(o!==void 0&&o.color===ce.Black)if(r.color===ce.Red){r.color=ce.Black,r.left=Ji(o,ce.Red);return}else{r.left=Ji(o,ce.Red);continue}else if(o!==void 0){if(o=po(o),r.left=o.right,o.right=r,o.color=r.color,r.color=ce.Red,lt(r),lt(o),i>1){let s=t[i-2];s.right===r?s.right=o:s.left=o}t[i-1]=o,t[i]=r,i+1<t.length?t[i+1]=e:t.push(e),i=i+2}}}};var FW=x0,zW=PW,jW=NW;var LW=DW;var _0=Symbol.for("effect/SortedSet"),Moe={[_0]:{_A:t=>t},[re](){return b(G(this.keyTree),ae(G(_0)),ye(this))},[Q](t){return Doe(t)&&V(this.keyTree,t.keyTree)},[Symbol.iterator](){return jW(this.keyTree)},toString(){return Ce(this.toJSON())},toJSON(){return{_id:"SortedSet",values:Array.from(this).map(ke)}},[xe](){return this.toJSON()},pipe(){return K(this,arguments)}},qW=t=>{let e=Object.create(Moe);return e.keyTree=t,e},Doe=t=>Y(t,_0);var HW=h(2,(t,e)=>FW(t.keyTree,e)?t:qW(zW(t.keyTree,e,!0)));var BW=h(2,(t,e)=>qW(LW(t.keyTree,e)));var Foe="effect/Supervisor",id=Symbol.for(Foe),hg={_T:t=>t},nd=class t{underlying;value0;[id]=hg;constructor(e,r){this.underlying=e,this.value0=r}get value(){return this.value0}onStart(e,r,o,n){this.underlying.onStart(e,r,o,n)}onEnd(e,r){this.underlying.onEnd(e,r)}onEffect(e,r){this.underlying.onEffect(e,r)}onSuspend(e){this.underlying.onSuspend(e)}onResume(e){this.underlying.onResume(e)}map(e){return new t(this,b(this.value,F(e)))}zip(e){return new od(this,e)}},od=class t{left;right;_tag="Zip";[id]=hg;constructor(e,r){this.left=e,this.right=r}get value(){return Nc(this.left.value,this.right.value)}onStart(e,r,o,n){this.left.onStart(e,r,o,n),this.right.onStart(e,r,o,n)}onEnd(e,r){this.left.onEnd(e,r),this.right.onEnd(e,r)}onEffect(e,r){this.left.onEffect(e,r),this.right.onEffect(e,r)}onSuspend(e){this.left.onSuspend(e),this.right.onSuspend(e)}onResume(e){this.left.onResume(e),this.right.onResume(e)}map(e){return new nd(this,b(this.value,F(e)))}zip(e){return new t(this,e)}},S0=t=>Y(t,id)&&Ms(t,"Zip"),b0=class{[id]=hg;fibers=new Set;get value(){return M(()=>Array.from(this.fibers))}onStart(e,r,o,n){this.fibers.add(n)}onEnd(e,r){this.fibers.delete(r)}onEffect(e,r){}onSuspend(e){}onResume(e){}map(e){return new nd(this,b(this.value,F(e)))}zip(e){return new od(this,e)}onRun(e,r){return e()}},v0=class{effect;[id]=hg;constructor(e){this.effect=e}get value(){return this.effect}onStart(e,r,o,n){}onEnd(e,r){}onEffect(e,r){}onSuspend(e){}onResume(e){}map(e){return new nd(this,b(this.value,F(e)))}zip(e){return new od(this,e)}onRun(e,r){return e()}},ZW=class{ref;[id]=hg;constructor(e){this.ref=e}get value(){return M(()=>Vr(this.ref))}onStart(e,r,o,n){b(this.ref,jn(b(Vr(this.ref),HW(n))))}onEnd(e,r){b(this.ref,jn(b(Vr(this.ref),BW(r))))}onEffect(e,r){}onSuspend(e){}onResume(e){}map(e){return new nd(this,b(this.value,F(e)))}zip(e){return new od(this,e)}onRun(e,r){return e()}},zoe=()=>new b0,GW=M(zoe),joe=t=>new v0(t),nu=pe("effect/Supervisor/none",()=>joe(de));var VW=Gs;var JW="Empty",YW="AddSupervisor",XW="RemoveSupervisor",QW="AndThen",sd={_tag:JW},gS=(t,e)=>({_tag:QW,first:t,second:e}),Loe=(t,e)=>Uoe(e,xt(t)),Uoe=(t,e)=>{let r=t,o=e;for(;rr(o);){let n=Xt(o);switch(n._tag){case JW:{o=mr(o);break}case YW:{r=r.zip(n.supervisor),o=mr(o);break}case XW:{r=w0(r,n.supervisor),o=mr(o);break}case QW:{o=Yt(n.first)(Yt(n.second)(mr(o)));break}}}return r},w0=(t,e)=>V(t,e)?nu:S0(t)?w0(t.left,e).zip(w0(t.right,e)):t,yS=t=>V(t,nu)?jo():S0(t)?b(yS(t.left),Oi(yS(t.right))):gc(t),qoe=(t,e)=>{if(V(t,e))return sd;let r=yS(t),o=yS(e),n=b(o,uT(r),_c(sd,(s,a)=>gS(s,{_tag:YW,supervisor:a}))),i=b(r,uT(o),_c(sd,(s,a)=>gS(s,{_tag:XW,supervisor:a})));return gS(n,i)},eZ=VW({empty:sd,patch:Loe,combine:gS,diff:qoe});var Woe=fg("effect_fiber_started",{incremental:!0}),tZ=fg("effect_fiber_active"),Zoe=fg("effect_fiber_successes",{incremental:!0}),Goe=fg("effect_fiber_failures",{incremental:!0}),Voe=CW(OW("effect_fiber_lifetimes",qB({start:.5,factor:2,count:35})),"time_unit","milliseconds"),gg="Continue",Koe="Done",rZ="Yield",Joe={_E:t=>t,_A:t=>t},xS=t=>{throw new Error(`BUG: FiberRuntime - ${vi(t)} - please report an issue at https://github.com/Effect-TS/effect/issues`)},Yi=Symbol.for("effect/internal/fiberRuntime/YieldedOp"),Xi=pe("effect/internal/fiberRuntime/yieldedOpChannel",()=>({currentOp:null})),yg={[np]:(t,e,r)=>yt(()=>e.effect_instruction_i1(r)),OnStep:(t,e,r)=>it(it(r)),[op]:(t,e,r)=>yt(()=>e.effect_instruction_i2(r)),[Ym]:(t,e,r)=>(t.patchRuntimeFlags(t.currentRuntimeFlags,e.patch),Ai(t.currentRuntimeFlags)&&t.isInterrupted()?Be(t.getInterruptedCause()):it(r)),[ip]:(t,e,r)=>(yt(()=>e.effect_instruction_i2(r)),yt(()=>e.effect_instruction_i0())?(t.pushStack(e),yt(()=>e.effect_instruction_i1())):de),[lc]:(t,e,r)=>{for(;;){let o=yt(()=>e.effect_instruction_i0.next(r));if(o.done)return it(o.value);let n=fA(o.value);if(Dp(n)){if(n._tag==="Failure")return n}else return t.pushStack(e),n;r=n.value}}},Yoe={[aS]:(t,e,r,o)=>(t.processNewInterruptSignal(o.cause),Ai(e)?Be(o.cause):r),[uS]:(t,e,r,o)=>{throw new Error("It is illegal to have multiple concurrent run loops in a single fiber")},[cS]:(t,e,r,o)=>(o.onFiber(t,CP(e)),r),[lS]:(t,e,r,o)=>w(Go(),()=>r)},Xoe=t=>gn(C2(t),e=>Qi(A2(e),([r,o])=>{let n=new Map,i=[];for(let a of o){i.push(Fn(a));for(let c of a)n.set(c.request,c)}let s=i.flat();return ht(pie(r.runAll(i),s,()=>s.forEach(a=>{a.listeners.interrupted=!0})),sS,n)},!1,!1)),Qoe=Qm(),xg=class extends Zi{[ig]=sg;[qP]=Joe;_fiberRefs;_fiberId;_queue=new Array;_children=null;_observers=new Array;_running=!1;_stack=[];_asyncInterruptor=null;_asyncBlockingOn=null;_exitValue=null;_steps=[];_isYielding=!1;currentRuntimeFlags;currentOpCount=0;currentSupervisor;currentScheduler;currentTracer;currentSpan;currentContext;currentDefaultServices;constructor(e,r,o){if(super(),this.currentRuntimeFlags=o,this._fiberId=e,this._fiberRefs=r,MT(o)){let n=this.getFiberRef(Li);Woe.unsafeUpdate(1,n),tZ.unsafeUpdate(1,n)}this.refreshRefCache()}commit(){return lo(this)}id(){return this._fiberId}resume(e){this.tell(tu(e))}get status(){return this.ask((e,r)=>r)}get runtimeFlags(){return this.ask((e,r)=>pB(r)?e.currentRuntimeFlags:r.runtimeFlags)}scope(){return RB(this)}get children(){return this.ask(e=>Array.from(e.getChildren()))}getChildren(){return this._children===null&&(this._children=new Set),this._children}getInterruptedCause(){return this.getFiberRef(Fc)}fiberRefs(){return this.ask(e=>e.getFiberRefs())}ask(e){return oe(()=>{let r=Uh(this._fiberId);return this.tell(td((o,n)=>{Bh(r,M(()=>e(o,n)))})),Zt(r)})}tell(e){this._queue.push(e),this._running||(this._running=!0,this.drainQueueLaterOnExecutor())}get await(){return gr(e=>{let r=o=>e($(o));if(this._exitValue!==null){r(this._exitValue);return}return this.tell(td((o,n)=>{o._exitValue!==null?r(this._exitValue):o.addObserver(r)})),M(()=>this.tell(td((o,n)=>{o.removeObserver(r)})))},this.id())}get inheritAll(){return Ee((e,r)=>{let o=e.id(),n=e.getFiberRefs(),i=r.runtimeFlags,s=this.getFiberRefs(),a=xv(n,o,s);e.setFiberRefs(a);let c=e.getFiberRef(iZ),u=b(Ln(i,c),jT(so),jT(Ib));return na(u)})}get poll(){return M(()=>js(this._exitValue))}unsafePoll(){return this._exitValue}interruptAsFork(e){return M(()=>this.tell(pS(hn(e))))}unsafeInterruptAsFork(e){this.tell(pS(hn(e)))}addObserver(e){this._exitValue!==null?e(this._exitValue):this._observers.push(e)}removeObserver(e){this._observers=this._observers.filter(r=>r!==e)}getFiberRefs(){return this.setFiberRef(iZ,this.currentRuntimeFlags),this._fiberRefs}unsafeDeleteFiberRef(e){this._fiberRefs=Kh(this._fiberRefs,e)}getFiberRef(e){return this._fiberRefs.locals.has(e)?this._fiberRefs.locals.get(e)[0][1]:e.initial}setFiberRef(e,r){this._fiberRefs=Bp(this._fiberRefs,{fiberId:this._fiberId,fiberRef:e,value:r}),this.refreshRefCache()}refreshRefCache(){this.currentDefaultServices=this.getFiberRef(ut),this.currentTracer=this.currentDefaultServices.unsafeMap.get(Bi.key),this.currentSupervisor=this.getFiberRef(kS),this.currentScheduler=this.getFiberRef(Vi),this.currentContext=this.getFiberRef(Qr),this.currentSpan=this.currentContext.unsafeMap.get(xr.key)}setFiberRefs(e){this._fiberRefs=e,this.refreshRefCache()}addChild(e){this.getChildren().add(e)}removeChild(e){this.getChildren().delete(e)}transferChildren(e){let r=this._children;if(this._children=null,r!==null&&r.size>0)for(let o of r)o._exitValue===null&&e.add(this.currentRuntimeFlags,o)}drainQueueOnCurrentThread(){let e=!0;for(;e;){let r=gg,o=globalThis[ma];globalThis[ma]=this;try{for(;r===gg;)r=this._queue.length===0?Koe:this.evaluateMessageWhileSuspended(this._queue.splice(0,1)[0])}finally{this._running=!1,globalThis[ma]=o}this._queue.length>0&&!this._running?(this._running=!0,r===rZ?(this.drainQueueLaterOnExecutor(),e=!1):e=!0):e=!1}}drainQueueLaterOnExecutor(){this.currentScheduler.scheduleTask(this.run,this.getFiberRef(zi),this)}drainQueueWhileRunning(e,r){let o=r;for(;this._queue.length>0;){let n=this._queue.splice(0,1)[0];o=Yoe[n._tag](this,e,o,n)}return o}isInterrupted(){return!Tb(this.getFiberRef(Fc))}addInterruptedCause(e){let r=this.getFiberRef(Fc);this.setFiberRef(Fc,ft(r,e))}processNewInterruptSignal(e){this.addInterruptedCause(e),this.sendInterruptSignalToAllChildren()}sendInterruptSignalToAllChildren(){if(this._children===null||this._children.size===0)return!1;let e=!1;for(let r of this._children)r.tell(pS(hn(this.id()))),e=!0;return e}interruptAllChildren(){if(this.sendInterruptSignalToAllChildren()){let e=this._children.values();this._children=null;let r=!1;return oa({while:()=>!r,body:()=>{let n=e.next();return n.done?M(()=>{r=!0}):bt(n.value.await)},step:()=>{}})}return null}reportExitValue(e){if(MT(this.currentRuntimeFlags)){let r=this.getFiberRef(Li),o=this.id().startTimeMillis,n=Date.now();switch(Voe.unsafeUpdate(n-o,r),tZ.unsafeUpdate(-1,r),e._tag){case kt:{Zoe.unsafeUpdate(1,r);break}case Et:{Goe.unsafeUpdate(1,r);break}}}if(e._tag==="Failure"){let r=this.getFiberRef(Nh);!Cp(e.cause)&&r._tag==="Some"&&this.log("Fiber terminated with an unhandled error",e.cause,r)}}setExitValue(e){this._exitValue=e,this.reportExitValue(e);for(let r=this._observers.length-1;r>=0;r--)this._observers[r](e);this._observers=[]}getLoggers(){return this.getFiberRef(aZ)}log(e,r,o){let n=dt(o)?o.value:this.getFiberRef(s$),i=this.getFiberRef(k0);if(W$(i,n))return;let s=this.getFiberRef(Qb),a=this.getFiberRef(ji),c=this.getLoggers(),u=this.getFiberRefs();if(yc(c)>0){let l=Nt(this.getFiberRef(ut),jr),p=new Date(l.unsafeCurrentTimeMillis());cU(u,()=>{for(let f of c)f.log({fiberId:this.id(),logLevel:n,message:e,cause:r,context:u,spans:s,annotations:a,date:p})})}}evaluateMessageWhileSuspended(e){switch(e._tag){case lS:return rZ;case aS:return this.processNewInterruptSignal(e.cause),this._asyncInterruptor!==null&&(this._asyncInterruptor(Be(e.cause)),this._asyncInterruptor=null),gg;case uS:return this._asyncInterruptor=null,this._asyncBlockingOn=null,this.evaluateEffect(e.effect),gg;case cS:return e.onFiber(this,this._exitValue!==null?uB:lB(this.currentRuntimeFlags,this._asyncBlockingOn)),gg;default:return xS(e)}}evaluateEffect(e){this.currentSupervisor.onResume(this);try{let r=Ai(this.currentRuntimeFlags)&&this.isInterrupted()?Be(this.getInterruptedCause()):e;for(;r!==null;){let o=r,n=this.runLoop(o);if(n===Yi){let i=Xi.currentOp;Xi.currentOp=null,i._op===sp?E2(this.currentRuntimeFlags)?(this.tell(OB()),this.tell(tu(zr)),r=null):r=zr:i._op===cc&&(r=null)}else{this.currentRuntimeFlags=b(this.currentRuntimeFlags,PT(Ib));let i=this.interruptAllChildren();i!==null?r=w(i,()=>n):(this._queue.length===0?this.setExitValue(n):this.tell(tu(n)),r=null)}}}finally{this.currentSupervisor.onSuspend(this)}}start(e){if(this._running)this.tell(tu(e));else{this._running=!0;let r=globalThis[ma];globalThis[ma]=this;try{this.evaluateEffect(e)}finally{this._running=!1,globalThis[ma]=r,this._queue.length>0&&this.drainQueueLaterOnExecutor()}}}startFork(e){this.tell(tu(e))}patchRuntimeFlags(e,r){let o=Ti(e,r);return globalThis[ma]=this,this.currentRuntimeFlags=o,o}initiateAsync(e,r){let o=!1,n=i=>{o||(o=!0,this.tell(tu(i)))};Ai(e)&&(this._asyncInterruptor=n);try{r(n)}catch(i){n(we(At(i)))}}pushStack(e){this._stack.push(e),e._op==="OnStep"&&this._steps.push({refs:this.getFiberRefs(),flags:this.currentRuntimeFlags})}popStack(){let e=this._stack.pop();if(e)return e._op==="OnStep"&&this._steps.pop(),e}getNextSuccessCont(){let e=this.popStack();for(;e;){if(e._op!==rp)return e;e=this.popStack()}}getNextFailCont(){let e=this.popStack();for(;e;){if(e._op!==np&&e._op!==ip&&e._op!==lc)return e;e=this.popStack()}}Tag(e){return M(()=>Mn(this.currentContext,e))}Left(e){return _e(e.left)}None(e){return _e(new en)}Right(e){return it(e.right)}Some(e){return it(e.value)}Micro(e){return Tp(r=>{let o=r,n=wB(vB(e,this.currentContext));return n.addObserver(i=>{if(i._tag==="Success")return o(it(i.value));switch(i.cause._tag){case"Interrupt":return o(Be(hn(Kr)));case"Fail":return o(_e(i.cause.error));case"Die":return o(yr(i.cause.defect))}}),Tp(i=>{o=s=>{i(de)},n.unsafeInterrupt()})})}[N_](e){let r=yt(()=>e.effect_instruction_i0()),o=this.getNextSuccessCont();return o!==void 0?(o._op in yg||xS(o),yg[o._op](this,o,r)):(Xi.currentOp=it(r),Yi)}[kt](e){let r=e,o=this.getNextSuccessCont();return o!==void 0?(o._op in yg||xS(o),yg[o._op](this,o,r.effect_instruction_i0)):(Xi.currentOp=r,Yi)}[Et](e){let r=e.effect_instruction_i0,o=this.getNextFailCont();if(o!==void 0)switch(o._op){case rp:case op:return Ai(this.currentRuntimeFlags)&&this.isInterrupted()?Be(Nb(r)):yt(()=>o.effect_instruction_i1(r));case"OnStep":return Ai(this.currentRuntimeFlags)&&this.isInterrupted()?Be(Nb(r)):it(Be(r));case Ym:return this.patchRuntimeFlags(this.currentRuntimeFlags,o.patch),Ai(this.currentRuntimeFlags)&&this.isInterrupted()?Be(ft(r,this.getInterruptedCause())):Be(r);default:xS(o)}else return Xi.currentOp=Be(r),Yi}[M_](e){return yt(()=>e.effect_instruction_i0(this,CP(this.currentRuntimeFlags)))}Blocked(e){let r=this.getFiberRefs(),o=this.currentRuntimeFlags;if(this._steps.length>0){let n=[],i=this._steps[this._steps.length-1],s=this.popStack();for(;s&&s._op!=="OnStep";)n.push(s),s=this.popStack();this.setFiberRefs(i.refs),this.currentRuntimeFlags=i.flags;let a=Xc(i.refs,r),c=Ln(i.flags,o);return it(Pi(e.effect_instruction_i0,Ee(u=>{for(;n.length>0;)u.pushStack(n.pop());return u.setFiberRefs(Qc(u.id(),u.getFiberRefs())(a)),u.currentRuntimeFlags=Ti(c)(u.currentRuntimeFlags),e.effect_instruction_i1})))}return vt(n=>w(_g(Lb(e.effect_instruction_i0)),()=>n(e.effect_instruction_i1)))}RunBlocked(e){return Xoe(e.effect_instruction_i0)}[Si](e){let r=e.effect_instruction_i0,o=this.currentRuntimeFlags,n=Ti(o,r);if(Ai(n)&&this.isInterrupted())return Be(this.getInterruptedCause());if(this.patchRuntimeFlags(this.currentRuntimeFlags,r),e.effect_instruction_i1){let i=Ln(n,o);return this.pushStack(new Fb(i,e)),yt(()=>e.effect_instruction_i1(o))}else return zr}[np](e){return this.pushStack(e),e.effect_instruction_i0}OnStep(e){return this.pushStack(e),e.effect_instruction_i0}[rp](e){return this.pushStack(e),e.effect_instruction_i0}[op](e){return this.pushStack(e),e.effect_instruction_i0}[cc](e){return this._asyncBlockingOn=e.effect_instruction_i1,this.initiateAsync(this.currentRuntimeFlags,e.effect_instruction_i0),Xi.currentOp=e,Yi}[sp](e){return this._isYielding=!1,Xi.currentOp=e,Yi}[ip](e){let r=e.effect_instruction_i0,o=e.effect_instruction_i1;return r()?(this.pushStack(e),o()):zr}[lc](e){return yg[lc](this,e,void 0)}[uc](e){return yt(()=>e.commit())}runLoop(e){let r=e;for(this.currentOpCount=0;;){if((this.currentRuntimeFlags&w2)!==0&&this.currentSupervisor.onEffect(this,r),this._queue.length>0&&(r=this.drainQueueWhileRunning(this.currentRuntimeFlags,r)),!this._isYielding){this.currentOpCount+=1;let o=this.currentScheduler.shouldYield(this);if(o!==!1){this._isYielding=!0,this.currentOpCount=0;let n=r;r=w(Go({priority:o}),()=>n)}}try{if(r=this.currentTracer.context(()=>{if(Qoe!==r[Ni]._V){let o=this.getFiberRef(tv);if(o._tag==="Some"){let n=r[Ni]._V;this.log(`Executing an Effect versioned ${n} with a Runtime of version ${Qm()}, you may want to dedupe the effect dependencies, you can use the language service plugin to detect this at compile time: https://github.com/Effect-TS/language-service`,Nr,o)}}return this[r._op](r)},this),r===Yi){let o=Xi.currentOp;return o._op===sp||o._op===cc?Yi:(Xi.currentOp=null,o._op===kt||o._op===Et?o:Be(At(o)))}}catch(o){r!==Yi&&!Y(r,"_op")||!(r._op in this)?r=Ys(`Not a valid effect: ${vi(r)}`):xq(o)?r=Be(ft(At(o),hn(Kr))):r=yr(o)}}}run=()=>{this.drainQueueOnCurrentThread()}},k0=pe("effect/FiberRef/currentMinimumLogLevel",()=>gt(Z$("Info"))),eie=t=>fS(e=>{let r=j4(e.context,ut);Nt(r,qi).unsafe.log(t.log(e))});var tie=pe(Symbol.for("effect/Logger/defaultLogger"),()=>eie(jB));var rie=pe(Symbol.for("effect/Logger/tracerLogger"),()=>fS(({annotations:t,cause:e,context:r,fiberId:o,logLevel:n,message:i})=>{let s=tg(dn(Wi(r,Qr),xr));if(s._tag==="None"||s.value._tag==="ExternalSpan")return;let a=Mn(Wi(r,ut),jr),c={};for(let[u,l]of t)c[u]=l;c["effect.fiberId"]=V1(o),c["effect.logLevel"]=n.label,e!==null&&e._tag!=="Empty"&&(c["effect.cause"]=Ho(e,{renderErrorCause:!0})),s.value.event(vi(Array.isArray(i)&&i.length===1?i[0]:i),a.unsafeCurrentTimeNanos(),c)}));var aZ=pe(Symbol.for("effect/FiberRef/currentLoggers"),()=>dq(gc(tie,rie)));var cZ=function(){if(typeof arguments[0]=="string")return sr(ji,hr(arguments[0],arguments[1]));let t=Object.entries(arguments[0]);return sr(ji,Y1(e=>{for(let r=0;r<t.length;r++){let[o,n]=t[r];hr(e,o,n)}return e}))},uZ=h(2,(t,e)=>{let r=typeof e=="string"?Z$(e):e;return Ee(o=>{let n=o.getFiberRef(k0);return W$(n,r)?$(z()):F(t,B)})}),ad=h(t=>ze(t[0]),(t,e)=>Fi(Fr(t,r=>Xo(o=>e(r,o))))),lZ=h(t=>ze(t[0]),(t,e)=>wn(t,Xo(r=>e(r)))),Xo=t=>Ee(e=>{let r=e.getFiberRefs(),o=$T(e.currentRuntimeFlags,so);return w($0,n=>zc(n,i=>Ee(s=>{let a=s.getFiberRefs(),c=s.currentRuntimeFlags,u=Xc(a,r),l=Ln(c,o),p=Xc(r,a);return s.setFiberRefs(Qc(u,s.id(),r)),wn(Jb(t(i),l),M(()=>{s.setFiberRefs(Qc(p,s.id(),s.getFiberRefs()))}))})))}),pZ=t=>ht(Ih,B(Ki))(t),nZ=Symbol.for("effect/Effect/existsPar/found"),dZ=h(t=>Tn(t[0])&&!ze(t[0]),(t,e,r)=>og(r?.concurrency,()=>oe(()=>fZ(t[Symbol.iterator](),0,e)),()=>Mt(Sn(t,(o,n)=>Bb(e(o,n),{onTrue:()=>_e(nZ),onFalse:()=>de}),r),{onFailure:o=>o===nZ?$(!0):_e(o),onSuccess:()=>$(!1)}))),fZ=(t,e,r)=>{let o=t.next();return o.done?$(!1):w(r(o.value,e),n=>n?$(n):fZ(t,e+1,r))},mZ=h(t=>Tn(t[0])&&!ze(t[0]),(t,e,r)=>{let o=r?.negate?(n,i)=>F(e(n,i),qU):e;return og(r?.concurrency,()=>oe(()=>Re(t).reduceRight((n,i,s)=>Vo(n,oe(()=>o(i,s)),(a,c)=>c?[i,...a]:a),M(()=>new Array))),()=>F(Sn(t,(n,i)=>F(o(n,i),s=>s?B(n):z()),r),zU))}),nie=t=>{if(Array.isArray(t)||Tn(t))return[t,z()];let e=Object.keys(t),r=e.length;return[e.map(o=>t[o]),B(o=>{let n={};for(let i=0;i<r;i++)n[e[i]]=o[i];return n})]},oie=(t,e,r)=>{let o=[];for(let n of t)o.push(Un(n));return w(Sn(o,be,{concurrency:r?.concurrency,batching:r?.batching,concurrentFinalizers:r?.concurrentFinalizers}),n=>{let i=z(),s=n.length,a=new Array(s),c=new Array(s),u=!1;for(let l=0;l<s;l++){let p=n[l];p._tag==="Left"?(a[l]=B(p.left),u=!0):(c[l]=p.right,a[l]=i)}return u?e._tag==="Some"?_e(e.value(a)):_e(a):r?.discard?de:e._tag==="Some"?$(e.value(c)):$(c)})},iie=(t,e,r)=>{let o=[];for(let n of t)o.push(Un(n));return r?.discard?Sn(o,be,{concurrency:r?.concurrency,batching:r?.batching,discard:!0,concurrentFinalizers:r?.concurrentFinalizers}):F(Sn(o,be,{concurrency:r?.concurrency,batching:r?.batching,concurrentFinalizers:r?.concurrentFinalizers}),n=>e._tag==="Some"?e.value(n):n)},ga=(t,e)=>{let[r,o]=nie(t);return e?.mode==="validate"?oie(r,o,e):e?.mode==="either"?iie(r,o,e):e?.discard!==!0&&o._tag==="Some"?F(Sn(r,be,e),o.value):Sn(r,be,e)},hZ=t=>e=>ga(e,t),gZ=(t,e)=>F(ga(Re(t).map(mt),e),dp(r=>sv(r)?B(r.effect_instruction_i0):z())),I0=h(2,(t,e)=>Array.from({length:e},()=>t)),yZ=h(t=>ze(t[0]),(t,e,r)=>ga(I0(t,e),r)),Sn=h(t=>Tn(t[0]),(t,e,r)=>Ee(o=>{let n=r?.batching===!0||r?.batching==="inherit"&&o.getFiberRef(Ph);return r?.discard?jP(r.concurrency,()=>ou(zv,r?.concurrentFinalizers)(i=>n?Qi(t,(s,a)=>i(e(s,a)),!0,!1,1):gn(t,(s,a)=>i(e(s,a)))),()=>ou(jv,r?.concurrentFinalizers)(i=>Qi(t,(s,a)=>i(e(s,a)),n,!1)),i=>ou(Lv(i),r?.concurrentFinalizers)(s=>Qi(t,(a,c)=>s(e(a,c)),n,!1,i))):jP(r?.concurrency,()=>ou(zv,r?.concurrentFinalizers)(i=>n?E0(t,1,(s,a)=>i(e(s,a)),!0):nr(t,(s,a)=>i(e(s,a)))),()=>ou(jv,r?.concurrentFinalizers)(i=>_S(t,(s,a)=>i(e(s,a)),n)),i=>ou(Lv(i),r?.concurrentFinalizers)(s=>E0(t,i,(a,c)=>s(e(a,c)),n)))})),_S=(t,e,r)=>oe(()=>{let o=Re(t),n=new Array(o.length);return Pe(Qi(o,(s,a)=>w(e(s,a),c=>M(()=>n[a]=c)),r,!1),$(n))}),Qi=(t,e,r,o,n)=>vt(i=>Vb(s=>Ee(a=>{let c=Array.from(t).reverse(),u=c.length;if(u===0)return de;let l=0,p=!1,f=n?Math.min(c.length,n):c.length,d=new Set,m=new Array,g=()=>d.forEach(N=>{N.currentScheduler.scheduleTask(()=>{N.unsafeInterruptAsFork(a.id())},0,N)}),y=new Array,v=new Array,E=new Array,R=()=>{let N=m.filter(({exit:ie})=>ie._tag==="Failure").sort((ie,ue)=>ie.index<ue.index?-1:ie.index===ue.index?0:1).map(({exit:ie})=>ie);return N.length===0&&N.push(zr),N},S=(N,ie=!1)=>{let ue=Fi(s(N)),W=sie(ue,a,a.currentRuntimeFlags,Ki);return a.currentScheduler.scheduleTask(()=>{ie&&W.unsafeInterruptAsFork(a.id()),W.resume(ue)},0,W),W},P=()=>{o||(u-=c.length,c=[]),p=!0,g()},D=r?Hb:mt,X=S(gr(N=>{let ie=(W,Ae)=>{W._op==="Blocked"?E.push(W):(m.push({index:Ae,exit:W}),W._op==="Failure"&&!p&&P())},ue=()=>{if(c.length>0){let W=c.pop(),Ae=l++,ge=()=>{let tt=c.pop();return Ae=l++,w(Go(),()=>w(D(i(e(tt,Ae))),De))},De=tt=>c.length>0&&(ie(tt,Ae),c.length>0)?ge():$(tt),He=w(D(i(e(W,Ae))),De),je=S(He);y.push(je),d.add(je),p&&je.currentScheduler.scheduleTask(()=>{je.unsafeInterruptAsFork(a.id())},0,je),je.addObserver(tt=>{let Pt;if(tt._op==="Failure"?Pt=tt:Pt=tt.effect_instruction_i0,v.push(je),d.delete(je),ie(Pt,Ae),m.length===u)N($(qt(Uc(R(),{parallel:!0}),()=>zr)));else if(E.length+m.length===u){let rt=R(),St=E.map(sn=>sn.effect_instruction_i0).reduce(HT);N($(Pi(St,Qi([qt(Uc(rt,{parallel:!0}),()=>zr),...E.map(sn=>sn.effect_instruction_i1)],sn=>sn,r,!0,n))))}else ue()})}};for(let W=0;W<f;W++)ue()}));return bt(Dr(Yr(i(lo(X))),Fp({onFailure:N=>{P();let ie=E.length+1,ue=Math.min(typeof n=="number"?n:E.length,E.length),W=Array.from(E);return gr(Ae=>{let ge=[],De=0,He=0,je=(Pt,rt)=>St=>{ge[Pt]=St,De++,De===ie&&Ae(it(Be(N))),W.length>0&&rt&&tt()},tt=()=>{S(W.pop(),!0).addObserver(je(He,!0)),He++};X.addObserver(je(He,!1)),He++;for(let Pt=0;Pt<ue;Pt++)tt()})},onSuccess:()=>nr(v,N=>N.inheritAll)})))}))),E0=(t,e,r,o)=>oe(()=>{let n=Re(t),i=new Array(n.length);return Pe(Qi(n,(a,c)=>F(r(a,c),u=>i[c]=u),o,!1,e),$(i))}),es=t=>Ee((e,r)=>$(bg(t,e,r.runtimeFlags))),_g=t=>aie(t,Ki),xZ=h(2,(t,e)=>es(Gb(t,r=>{let o=ao(r);switch(o._tag){case"Left":return e(o.left);case"Right":return we(o.right)}}))),bg=(t,e,r,o=null)=>{let n=bS(t,e,r,o);return n.resume(t),n},sie=(t,e,r,o=null)=>bS(t,e,r,o),bS=(t,e,r,o=null)=>{let n=gb(),i=e.getFiberRefs(),s=D$(i,n),a=new xg(n,s,r),c=Wi(s,Qr),u=a.currentSupervisor;return u.onStart(c,t,B(e),a),a.addObserver(p=>u.onEnd(p,a)),(o!==null?o:b(e.getFiberRef(Ih),qt(()=>e.scope()))).add(r,a),a},aie=(t,e)=>Ee((r,o)=>$(bg(t,r,o.runtimeFlags,e))),O0=h(t=>Ps(t[2]),(t,e,r,o)=>og(o?.concurrency,()=>Re(t).reduce((n,i,s)=>Vo(n,i,(a,c)=>r(a,c,s)),$(e)),()=>w(wv(e),n=>w(Sn(t,(i,s)=>w(i,a=>Y4(n,c=>r(c,a,s))),o),()=>Ev(n))))),C0=h(t=>Tn(t[0]),(t,e,r)=>b(Sn(t,(o,n)=>Un(e(o,n)),r),F(o=>tq(o,be)))),_Z=h(t=>Tn(t[0]),(t,e,r)=>w(C0(t,e,{concurrency:r?.concurrency,batching:r?.batching,concurrentFinalizers:r?.concurrentFinalizers}),([o,n])=>z_(o)?_e(o):r?.discard?de:$(n))),bZ=t=>Ee((e,r)=>gr(o=>{let n=new Set,i,s=Nr,a=()=>{for(let l of n)l.unsafeInterruptAsFork(e.id())},c=!1,u=!0;for(let l of t){u=!1;let p=bg(Di(l),e,r.runtimeFlags);if(n.add(p),p.addObserver(f=>{n.delete(p),i||(f._tag==="Success"?(c=!0,i=p,s=Nr,a()):s=Mr(f.cause,s)),c&&n.size===0&&o(i?Pe(PB(i),i.unsafePoll()):we(s))}),i)break}return u?o(Xs(()=>new Dh("Received an empty collection of effects"))):(c=!0,NB(n,e.id()))})),vZ=h(t=>Tn(t[0])&&!ze(t[0]),(t,e,r,o)=>og(o?.concurrency,()=>Re(t).reduce((n,i,s)=>Vo(n,i,(a,c)=>r(a,c,s)),e),()=>oe(()=>b(O0([e,...t],z(),(n,i,s)=>{switch(n._tag){case"None":return B(i);case"Some":return B(r(n.value,i,s))}},o),F(n=>{switch(n._tag){case"None":throw new Error("BUG: Effect.reduceEffect - please report an issue at https://github.com/Effect-TS/effect/issues");case"Some":return n.value}}))))),vS=t=>Hn(e=>Ut(dn(e,Qo),{onNone:()=>t,onSome:r=>{switch(r.strategy._tag){case"Parallel":return t;case"Sequential":case"ParallelN":return w(xn(r,jv),o=>rs(t,o))}}})),oZ=t=>e=>Hn(r=>Ut(dn(r,Qo),{onNone:()=>e,onSome:o=>o.strategy._tag==="ParallelN"&&o.strategy.parallelism===t?e:w(xn(o,Lv(t)),n=>rs(e,n))})),SZ=t=>e=>ou(t,!0)(e),ou=(t,e)=>r=>Hn(o=>Ut(dn(o,Qo),{onNone:()=>r(be),onSome:n=>{if(e===!0){let i=t._tag==="Parallel"?vS:t._tag==="Sequential"?SS:oZ(t.parallelism);switch(n.strategy._tag){case"Parallel":return i(r(vS));case"Sequential":return i(r(SS));case"ParallelN":return i(r(oZ(n.strategy.parallelism)))}}else return r(be)}})),Gn=t=>w(Qo,t),vg=t=>w(cd(),e=>Dr(t(e),r=>e.close(r))),wS=t=>w(cd(),e=>NZ(t,e)),SS=t=>Hn(e=>Ut(dn(e,Qo),{onNone:()=>t,onSome:r=>{switch(r.strategy._tag){case"Sequential":return t;case"Parallel":case"ParallelN":return w(xn(r,zv),o=>rs(t,o))}}})),wZ=(t,e)=>R0([Vc(t,e)]),R0=t=>sr(Li,e=>no(e,t)),EZ=h(2,(t,e)=>vg(r=>w(rs(t,r),e))),kZ=h(t=>ze(t[1]),(t,e,r)=>A0(t,e,(o,n)=>[o,n],r)),A0=h(t=>ze(t[1]),(t,e,r,o)=>Yr(ts(mt(t),mt(e),(n,i)=>Lh(n,i,{onSuccess:r,onFailure:(s,a)=>o?.concurrent?Mr(s,a):ft(s,a)}),o)));var IZ=h(t=>Tn(t[0]),(t,e,r)=>ta(Sn(t,(o,n)=>ta(e(o,n)),r))),OZ=t=>sr(ut,Ze(jr,t)),CZ=t=>sr(ut,Ze(Hi,t)),ES=t=>sr(ut,Ze(Lp,t)),RZ=t=>Gn(e=>w(xn(e,Wn),r=>b(t,rs(r),F(o=>[Jr(n=>jc(r,av(n))),o])))),AZ=h(t=>ze(t[1]),(t,e,r)=>ts(t,e,(o,n)=>[o,n],r)),TZ=h(t=>ze(t[1]),(t,e,r)=>r?.concurrent!==!0&&(r?.batching===void 0||r.batching===!1)?Mc(t,e):ts(t,e,(o,n)=>o,r)),$Z=h(t=>ze(t[1]),(t,e,r)=>r?.concurrent!==!0&&(r?.batching===void 0||r.batching===!1)?Pe(t,e):ts(t,e,(o,n)=>n,r)),ts=h(t=>ze(t[1]),(t,e,r,o)=>F(ga([t,e],{concurrency:o?.concurrent?2:1,batching:o?.batching,concurrentFinalizers:o?.concurrentFinalizers}),([n,i])=>r(n,i))),T0=t=>t===I2?de:b($p,w(e=>{let r=Ti(e,t),o=Ln(r,e);return b(na(t),Pe(Xo(()=>na(o))),bt)}),Fi),Qo=Ht("effect/Scope"),$0=Qo,cie=(t,e)=>{t.state._tag==="Open"&&t.state.finalizers.set({},e)},uie={[nv]:nv,[ov]:ov,pipe(){return K(this,arguments)},fork(t){return M(()=>{let e=PZ(t);if(this.state._tag==="Closed")return e.state=this.state,e;let r={},o=n=>e.close(n);return this.state.finalizers.set(r,o),cie(e,n=>M(()=>{this.state._tag==="Open"&&this.state.finalizers.delete(r)})),e})},close(t){return oe(()=>{if(this.state._tag==="Closed")return de;let e=Array.from(this.state.finalizers.values()).reverse();return this.state={_tag:"Closed",exit:t},e.length===0?de:SP(this.strategy)?b(nr(e,r=>mt(r(t))),w(r=>b(Uc(r),Pn(zh),qt(()=>zr)))):wP(this.strategy)?b(_S(e,r=>mt(r(t)),!1),w(r=>b(Uc(r,{parallel:!0}),Pn(zh),qt(()=>zr)))):b(E0(e,this.strategy.parallelism,r=>mt(r(t)),!1),w(r=>b(Uc(r,{parallel:!0}),Pn(zh),qt(()=>zr))))})},addFinalizer(t){return oe(()=>this.state._tag==="Closed"?t(this.state.exit):(this.state.finalizers.set({},t),de))}},PZ=(t=Wn)=>{let e=Object.create(uie);return e.strategy=t,e.state={_tag:"Open",finalizers:new Map},e},cd=(t=Wn)=>M(()=>PZ(t)),rs=h(2,(t,e)=>qc(t,Dn(Gr(Qo,e)))),NZ=h(2,(t,e)=>b(t,rs(e),Dr(r=>e.close(r)))),lie=t=>Dc(t,{differ:eZ,fork:sd}),_r=h(2,(t,e)=>bt(ad(w(yn(t),r=>Ge(Tc(t,e),r)),r=>Tc(t,r)))),sr=h(2,(t,e)=>or(t,r=>_r(t,e(r))));var iZ=fq(k2),kS=lie(nu),MZ=t=>Sn(t,$B),P0=t=>({...J$,commit(){return lo(this)},[ig]:sg,id:()=>Re(t).reduce((r,o)=>hT(r,o.id()),Kr),await:mt(_S(t,r=>Yr(r.await),!1)),children:F(_S(t,r=>r.children,!1),L_),inheritAll:gn(t,r=>r.inheritAll),poll:F(nr(t,r=>r.poll),U_(B(it(new Array)),(r,o)=>{switch(o._tag){case"None":return z();case"Some":switch(r._tag){case"None":return z();case"Some":return B(Lh(o.value,r.value,{onSuccess:(n,i)=>[n,...i],onFailure:Mr}))}}})),interruptAsFork:r=>gn(t,o=>o.interruptAsFork(r))});var N0=h(3,(t,e,r)=>M0(t,e,{onSelfWin:(o,n)=>w(o.await,i=>{switch(i._tag){case kt:return w(o.inheritAll,()=>r.onSelfDone(i,n));case Et:return r.onSelfDone(i,n)}}),onOtherWin:(o,n)=>w(o.await,i=>{switch(i._tag){case kt:return w(o.inheritAll,()=>r.onOtherDone(i,n));case Et:return r.onOtherDone(i,n)}})})),DZ=t=>vt(e=>Jr(r=>w(_g(e(t)),o=>b(e(lo(o)),Zo(()=>b(o,MB(r))))))),IS=h(2,(t,e)=>Jr(r=>N0(t,e,{onSelfDone:(o,n)=>zp(o,{onFailure:i=>b(lo(n),Vp(s=>Mr(i,s))),onSuccess:i=>b(n,Xr(r),Ge(i))}),onOtherDone:(o,n)=>zp(o,{onFailure:i=>b(lo(n),Vp(s=>Mr(s,i))),onSuccess:i=>b(n,Xr(r),Ge(i))})}))),M0=h(3,(t,e,r)=>Ee((o,n)=>{let i=n.runtimeFlags,s=Lo(!0),a=bS(t,o,i,r.selfScope),c=bS(e,o,i,r.otherScope);return gr(u=>{a.addObserver(()=>sZ(a,c,r.onSelfWin,s,u)),c.addObserver(()=>sZ(c,a,r.onOtherWin,s,u)),a.startFork(t),c.startFork(e)},hT(a.id(),c.id()))})),sZ=(t,e,r,o,n)=>{lb(!0,!1)(o)&&n(r(t,e))},wn=h(2,(t,e)=>vt(r=>st(r(t),{onFailure:o=>st(e,{onFailure:n=>we(ft(o,n)),onSuccess:()=>we(o)}),onSuccess:o=>Ge(e,o)}))),pie=(t,e,r)=>Jr(o=>wn(w(_g(Di(t)),n=>gr(i=>{let s=e.map(u=>u.listeners.count),a=()=>{s.every(u=>u===0)&&e.every(u=>u.result.state.current._tag==="Pending"?!0:!!(u.result.state.current._tag==="Done"&&Dp(u.result.state.current.effect)&&u.result.state.current.effect._tag==="Failure"&&$b(u.result.state.current.effect.cause)))&&(c.forEach(u=>u()),r?.(),i($h(n)))};n.addObserver(u=>{c.forEach(l=>l()),i(u)});let c=e.map((u,l)=>{let p=f=>{s[l]=f,a()};return u.listeners.addObserver(p),()=>u.listeners.removeObserver(p)});return a(),M(()=>{c.forEach(u=>u())})})),oe(()=>{let n=e.flatMap(i=>i.state.completed?[]:[i]);return gn(n,i=>h0(i.request,av(o)))})));var Zn=(t,e)=>(e=vn(e),Fi(Ee(r=>{let o=Mn(r.getFiberRef(Qr),Qo),n=Dv(r,t,e),i=r.getFiberRef(sa),s=Nt(r.getFiberRef(ut),jr);return Ge(zc(o,a=>bP(n,a,s,i)),n)}))),OS=t=>sr(ut,Ze(Bi,t)),FZ=function(){let t=typeof arguments[0]!="string",e=t?arguments[1]:arguments[0],r=vn(t?arguments[2]:arguments[1]);if(t){let o=arguments[0];return w(Zn(e,vn(r)),n=>ua(o,xr,n))}return o=>w(Zn(e,vn(r)),n=>ua(o,xr,n))};var zZ=(t,e,r,o)=>_b({_tag:"Complete",key:t,exit:e,entryStats:r,timeToLiveMillis:o}),jZ=(t,e)=>_b({_tag:"Pending",key:t,deferred:e}),die=(t,e)=>_b({_tag:"Refreshing",deferred:t,complete:e}),D0=Symbol.for("effect/Cache/MapKey"),F0=class{current;[D0]=D0;previous=void 0;next=void 0;constructor(e){this.current=e}[re](){return b(G(this.current),ae(G(this.previous)),ae(G(this.next)),ye(this))}[Q](e){return this===e?!0:fie(e)&&V(this.current,e.current)&&V(this.previous,e.previous)&&V(this.next,e.next)}},ud=t=>new F0(t),fie=t=>Y(t,D0),z0=class{head=void 0;tail=void 0;add(e){if(e!==this.tail)if(this.tail===void 0)this.head=e,this.tail=e;else{let r=e.previous,o=e.next;o!==void 0&&(e.next=void 0,r!==void 0?(r.next=o,o.previous=r):(this.head=o,this.head.previous=void 0)),this.tail.next=e,e.previous=this.tail,this.tail=e}}remove(){let e=this.head;if(e!==void 0){let r=e.next;r!==void 0?(e.next=void 0,this.head=r,this.head.previous=void 0):(this.head=void 0,this.tail=void 0)}return e}},mie=()=>new z0,hie=(t,e,r,o,n,i)=>({map:t,keys:e,accesses:r,updating:o,hits:n,misses:i}),gie=()=>hie(Hc(),mie(),qq(),Lo(!1),0,0),yie="effect/Cache",xie=Symbol.for(yie),_ie={_Key:t=>t,_Error:t=>t,_Value:t=>t},bie="effect/ConsumerCache",vie=Symbol.for(bie),Sie={_Key:t=>t,_Error:t=>t,_Value:t=>t},wie=t=>t,CS=t=>({loadedMillis:t}),j0=class{capacity;context;fiberId;lookup;timeToLive;[xie]=_ie;[vie]=Sie;cacheState;constructor(e,r,o,n,i){this.capacity=e,this.context=r,this.fiberId=o,this.lookup=n,this.timeToLive=i,this.cacheState=gie()}get(e){return F(this.getEither(e),F_)}get cacheStats(){return M(()=>wie({hits:this.cacheState.hits,misses:this.cacheState.misses,size:lv(this.cacheState.map)}))}getOption(e){return oe(()=>Ut(Tt(this.cacheState.map,e),{onNone:()=>{let r=ud(e);return this.trackAccess(r),this.trackMiss(),$(z())},onSome:r=>this.resolveMapValue(r)}))}getOptionComplete(e){return oe(()=>Ut(Tt(this.cacheState.map,e),{onNone:()=>{let r=ud(e);return this.trackAccess(r),this.trackMiss(),$(z())},onSome:r=>this.resolveMapValue(r,!0)}))}contains(e){return M(()=>uo(this.cacheState.map,e))}entryStats(e){return M(()=>{let r=Tt(this.cacheState.map,e);if(dt(r))switch(r.value._tag){case"Complete":{let o=r.value.entryStats.loadedMillis;return B(CS(o))}case"Pending":return z();case"Refreshing":{let o=r.value.complete.entryStats.loadedMillis;return B(CS(o))}}return z()})}getEither(e){return oe(()=>{let r=e,o,n,i=dr(Tt(this.cacheState.map,r));return i===void 0&&(n=m$(this.fiberId),o=ud(r),uo(this.cacheState.map,r)?i=dr(Tt(this.cacheState.map,r)):rn(this.cacheState.map,r,jZ(o,n))),i===void 0?(this.trackAccess(o),this.trackMiss(),F(this.lookupValueOf(e,n),Tr)):w(this.resolveMapValue(i),Ut({onNone:()=>this.getEither(e),onSome:s=>$($n(s))}))})}invalidate(e){return M(()=>{Bc(this.cacheState.map,e)})}invalidateWhen(e,r){return M(()=>{let o=Tt(this.cacheState.map,e);dt(o)&&o.value._tag==="Complete"&&o.value.exit._tag==="Success"&&r(o.value.exit.value)&&Bc(this.cacheState.map,e)})}get invalidateAll(){return M(()=>{this.cacheState.map=Hc()})}refresh(e){return Yo(r=>oe(()=>{let o=e,n=m$(this.fiberId),i=dr(Tt(this.cacheState.map,o));if(i===void 0&&(uo(this.cacheState.map,o)?i=dr(Tt(this.cacheState.map,o)):rn(this.cacheState.map,o,jZ(ud(o),n))),i===void 0)return bt(this.lookupValueOf(e,n));switch(i._tag){case"Complete":{if(this.hasExpired(r,i.timeToLiveMillis)){let s=dr(Tt(this.cacheState.map,o));return V(s,i)&&Bc(this.cacheState.map,o),bt(this.get(e))}return b(this.lookupValueOf(e,n),Mv(()=>{let s=dr(Tt(this.cacheState.map,o));if(V(s,i)){let a=die(n,i);return rn(this.cacheState.map,o,a),!0}return!1}),bt)}case"Pending":return Wh(i.deferred);case"Refreshing":return Wh(i.deferred)}}))}set(e,r){return Yo(o=>M(()=>{let n=o.unsafeCurrentTimeMillis(),i=e,s=$q(r),a=zZ(ud(i),s,CS(n),n+Do(Wt(this.timeToLive(s))));rn(this.cacheState.map,i,a)}))}get size(){return M(()=>lv(this.cacheState.map))}get values(){return M(()=>{let e=[];for(let r of this.cacheState.map)r[1]._tag==="Complete"&&r[1].exit._tag==="Success"&&e.push(r[1].exit.value);return e})}get entries(){return M(()=>{let e=[];for(let r of this.cacheState.map)r[1]._tag==="Complete"&&r[1].exit._tag==="Success"&&e.push([r[0],r[1].exit.value]);return e})}get keys(){return M(()=>{let e=[];for(let r of this.cacheState.map)r[1]._tag==="Complete"&&r[1].exit._tag==="Success"&&e.push(r[0]);return e})}resolveMapValue(e,r=!1){return Yo(o=>{switch(e._tag){case"Complete":return this.trackAccess(e.key),this.hasExpired(o,e.timeToLiveMillis)?(Bc(this.cacheState.map,e.key.current),$(z())):(this.trackHit(),F(e.exit,B));case"Pending":return this.trackAccess(e.key),this.trackHit(),r?$(z()):F(Wh(e.deferred),B);case"Refreshing":return this.trackAccess(e.complete.key),this.trackHit(),this.hasExpired(o,e.complete.timeToLiveMillis)?r?$(z()):F(Wh(e.deferred),B):F(e.complete.exit,B)}})}trackHit(){this.cacheState.hits=this.cacheState.hits+1}trackMiss(){this.cacheState.misses=this.cacheState.misses+1}trackAccess(e){if(Hq(this.cacheState.accesses,e),lb(this.cacheState.updating,!1,!0)){let r=!0;for(;r;){let n=Bq(this.cacheState.accesses,_$);n===_$?r=!1:this.cacheState.keys.add(n)}let o=lv(this.cacheState.map);for(r=o>this.capacity;r;){let n=this.cacheState.keys.remove();n!==void 0?uo(this.cacheState.map,n.current)&&(Bc(this.cacheState.map,n.current),o=o-1,r=o>this.capacity):r=!1}jn(this.cacheState.updating,!1)}}hasExpired(e,r){return e.unsafeCurrentTimeMillis()>r}lookupValueOf(e,r){return Yo(o=>oe(()=>{let n=e;return b(this.lookup(e),bn(this.context),mt,w(i=>{let s=o.unsafeCurrentTimeMillis(),a=CS(s),c=zZ(ud(n),i,a,s+Do(Wt(this.timeToLive(i))));return rn(this.cacheState.map,n,c),Pe(Cq(r,i),i)}),Zo(()=>Pe(Rq(r),M(()=>{Bc(this.cacheState.map,n)}))))}))}};var LZ=(t,e,r)=>new j0(t,Jt(),fb,e,o=>Wt(r(o)));var L0=$i,U0=At;var UZ=ao;var ti={};an(ti,{Do:()=>Sue,EffectTypeId:()=>fse,Service:()=>sde,Tag:()=>ide,acquireRelease:()=>rce,acquireReleaseInterruptible:()=>nce,acquireUseRelease:()=>oce,addFinalizer:()=>ice,all:()=>bse,allSuccesses:()=>Sse,allWith:()=>vse,allowInterrupt:()=>Pae,andThen:()=>Wue,annotateCurrentSpan:()=>Upe,annotateLogs:()=>zle,annotateLogsScoped:()=>jle,annotateSpans:()=>Lpe,ap:()=>kpe,as:()=>Bae,asSome:()=>Wae,asSomeError:()=>Zae,asVoid:()=>Gae,async:()=>Bse,asyncEffect:()=>Wse,awaitAllChildren:()=>xce,bind:()=>wue,bindAll:()=>Eue,bindTo:()=>kue,blocked:()=>Ipe,cacheRequestResult:()=>Ape,cached:()=>yse,cachedFunction:()=>xse,cachedInvalidateWithTTL:()=>gse,cachedWithTTL:()=>hse,catch:()=>uae,catchAll:()=>lae,catchAllCause:()=>pae,catchAllDefect:()=>dae,catchIf:()=>fae,catchSome:()=>mae,catchSomeCause:()=>hae,catchSomeDefect:()=>gae,catchTag:()=>yae,catchTags:()=>xae,cause:()=>_ae,checkInterruptible:()=>Nae,clock:()=>Uce,clockWith:()=>qce,configProviderWith:()=>oue,console:()=>Wce,consoleWith:()=>Zce,context:()=>aue,contextWith:()=>cue,contextWithEffect:()=>uue,currentParentSpan:()=>Bpe,currentPropagatedSpan:()=>Hpe,currentSpan:()=>qpe,custom:()=>Zse,daemonChildren:()=>_ce,delay:()=>Kce,descriptor:()=>bce,descriptorWith:()=>vce,die:()=>jN,dieMessage:()=>Yse,dieSync:()=>Xse,diffFiberRefs:()=>Sce,disconnect:()=>Mae,dropUntil:()=>wse,dropWhile:()=>Ese,either:()=>Cue,ensureErrorType:()=>lde,ensureRequirementsType:()=>pde,ensureSuccessType:()=>ude,ensuring:()=>sce,ensuringChild:()=>wce,ensuringChildren:()=>Ece,eventually:()=>bae,every:()=>Ose,exists:()=>Cse,exit:()=>Rue,fail:()=>Vse,failCause:()=>_K,failCauseSync:()=>Jse,failSync:()=>Kse,fiberId:()=>kce,fiberIdWith:()=>Ice,filter:()=>Rse,filterEffectOrElse:()=>Due,filterEffectOrFail:()=>Fue,filterMap:()=>Ase,filterOrDie:()=>$ue,filterOrDieMessage:()=>Pue,filterOrElse:()=>Nue,filterOrFail:()=>Mue,finalizersMask:()=>pce,findFirst:()=>Tse,firstSuccessOf:()=>Vle,flatMap:()=>Bue,flatten:()=>Zue,flip:()=>Vae,flipWith:()=>Kae,fn:()=>ade,fnUntraced:()=>cde,forEach:()=>$se,forever:()=>ole,fork:()=>Oce,forkAll:()=>Rce,forkDaemon:()=>Cce,forkIn:()=>Ace,forkScoped:()=>Tce,forkWithErrorHandler:()=>$ce,fromFiber:()=>Pce,fromFiberEffect:()=>Nce,fromNullable:()=>tde,functionWithSpan:()=>Xpe,gen:()=>Qse,getFiberRefs:()=>mle,getRuntimeFlags:()=>epe,head:()=>Pse,if:()=>Tue,ignore:()=>vae,ignoreLogged:()=>Sae,inheritFiberRefs:()=>hle,interrupt:()=>Dae,interruptWith:()=>Fae,interruptible:()=>zae,interruptibleMask:()=>jae,intoDeferred:()=>Aue,isEffect:()=>mse,isFailure:()=>wle,isSuccess:()=>Ele,iterate:()=>ile,labelMetrics:()=>ipe,labelMetricsScoped:()=>ape,let:()=>Iue,liftPredicate:()=>Hae,linkSpanCurrent:()=>Vpe,linkSpans:()=>Gpe,locally:()=>gle,locallyScoped:()=>xle,locallyScopedWith:()=>_le,locallyWith:()=>yle,log:()=>Rle,logAnnotations:()=>Lle,logDebug:()=>$le,logError:()=>Mle,logFatal:()=>Dle,logInfo:()=>Ple,logTrace:()=>Tle,logWarning:()=>Nle,logWithLevel:()=>Ale,loop:()=>sle,makeLatch:()=>fpe,makeSemaphore:()=>ppe,makeSpan:()=>Kpe,makeSpanScoped:()=>Jpe,map:()=>uu,mapAccum:()=>Jae,mapBoth:()=>Yae,mapError:()=>Xae,mapErrorCause:()=>Qae,mapInputContext:()=>lue,match:()=>kle,matchCause:()=>Ile,matchCauseEffect:()=>Ole,matchEffect:()=>Cle,merge:()=>ece,mergeAll:()=>Nse,metricLabels:()=>cpe,negate:()=>tce,never:()=>eae,none:()=>tae,onError:()=>ace,onExit:()=>cce,onInterrupt:()=>Lae,once:()=>_se,option:()=>Oue,optionFromOptional:()=>rde,orDie:()=>Hle,orDieWith:()=>Ble,orElse:()=>Wle,orElseFail:()=>Zle,orElseSucceed:()=>Gle,parallelErrors:()=>wae,parallelFinalizers:()=>uce,partition:()=>Mse,patchFiberRefs:()=>ble,patchRuntimeFlags:()=>tpe,promise:()=>rae,provide:()=>pue,provideService:()=>due,provideServiceEffect:()=>fue,race:()=>Gue,raceAll:()=>Vue,raceFirst:()=>Kue,raceWith:()=>Jue,random:()=>Kle,randomWith:()=>Jle,reduce:()=>Dse,reduceEffect:()=>jse,reduceRight:()=>zse,reduceWhile:()=>Fse,repeat:()=>ale,repeatN:()=>cle,repeatOrElse:()=>ule,replicate:()=>Lse,replicateEffect:()=>Use,request:()=>Rpe,retry:()=>kae,retryOrElse:()=>Oae,runCallback:()=>hpe,runFork:()=>mpe,runPromise:()=>gpe,runPromiseExit:()=>ype,runRequestBlock:()=>Ope,runSync:()=>xpe,runSyncExit:()=>_pe,runtime:()=>Qle,sandbox:()=>Eae,schedule:()=>lle,scheduleForked:()=>ple,scheduleFrom:()=>dle,scope:()=>dce,scopeWith:()=>fce,scoped:()=>hce,scopedWith:()=>mce,sequentialFinalizers:()=>lce,serviceConstants:()=>yue,serviceFunction:()=>mue,serviceFunctionEffect:()=>hue,serviceFunctions:()=>gue,serviceMembers:()=>xue,serviceOption:()=>_ue,serviceOptional:()=>bue,setFiberRefs:()=>vle,sleep:()=>Jce,spanAnnotations:()=>Wpe,spanLinks:()=>Zpe,step:()=>Cpe,succeed:()=>nae,succeedNone:()=>LN,succeedSome:()=>oae,summarized:()=>Yue,supervised:()=>Mce,suspend:()=>iae,sync:()=>sae,tagMetrics:()=>ope,tagMetricsScoped:()=>spe,takeUntil:()=>kse,takeWhile:()=>Ise,tap:()=>Xue,tapBoth:()=>Que,tapDefect:()=>ele,tapError:()=>tle,tapErrorCause:()=>nle,tapErrorTag:()=>rle,timed:()=>Yce,timedWith:()=>Xce,timeout:()=>Qce,timeoutFail:()=>tue,timeoutFailCause:()=>rue,timeoutOption:()=>eue,timeoutTo:()=>nue,tracer:()=>Npe,tracerWith:()=>Mpe,transplant:()=>Dce,transposeMapOption:()=>ode,transposeOption:()=>nde,try:()=>Cae,tryMap:()=>Rae,tryMapPromise:()=>Aae,tryPromise:()=>Tae,uninterruptible:()=>Uae,uninterruptibleMask:()=>qae,unless:()=>zue,unlessEffect:()=>jue,unsafeMakeLatch:()=>dpe,unsafeMakeSemaphore:()=>lpe,unsandbox:()=>$ae,updateFiberRefs:()=>Sle,updateService:()=>vue,useSpan:()=>Ype,using:()=>gce,validate:()=>bpe,validateAll:()=>qse,validateFirst:()=>Hse,validateWith:()=>vpe,void:()=>aae,when:()=>Lue,whenEffect:()=>Uue,whenFiberRef:()=>que,whenLogLevel:()=>qle,whenRef:()=>Hue,whileLoop:()=>fle,withClock:()=>Bce,withClockScoped:()=>Hce,withConcurrency:()=>Fce,withConfigProvider:()=>iue,withConfigProviderScoped:()=>sue,withConsole:()=>Vce,withConsoleScoped:()=>Gce,withEarlyRelease:()=>yce,withExecutionPlan:()=>Iae,withFiberRuntime:()=>Gse,withLogSpan:()=>Fle,withMaxOpsBeforeYield:()=>Lce,withMetric:()=>upe,withParentSpan:()=>ede,withRandom:()=>bK,withRandomFixed:()=>Yle,withRandomScoped:()=>Xle,withRequestBatching:()=>Tpe,withRequestCache:()=>Ppe,withRequestCaching:()=>$pe,withRuntimeFlagsPatch:()=>rpe,withRuntimeFlagsPatchScoped:()=>npe,withScheduler:()=>zce,withSchedulingPriority:()=>jce,withSpan:()=>SK,withSpanScoped:()=>Qpe,withTracer:()=>Dpe,withTracerEnabled:()=>zpe,withTracerScoped:()=>Fpe,withTracerTiming:()=>jpe,withUnhandledErrorLogLevel:()=>Ule,yieldNow:()=>cae,zip:()=>Spe,zipLeft:()=>wpe,zipRight:()=>Epe,zipWith:()=>vK});var Eie="effect/ScheduleInterval",Sg=Symbol.for(Eie),q0={[Sg]:Sg,startMillis:0,endMillis:0},H0=(t,e)=>t>e?q0:{[Sg]:Sg,startMillis:t,endMillis:e},HZ=h(2,(t,e)=>BZ(t,e)===t),BZ=h(2,(t,e)=>t.endMillis<=e.startMillis?t:e.endMillis<=t.startMillis?e:t.startMillis<e.startMillis?t:e.startMillis<t.startMillis?e:t.endMillis<=e.endMillis?t:e);var WZ=t=>t.startMillis>=t.endMillis;var ZZ=h(2,(t,e)=>{let r=Math.max(t.startMillis,e.startMillis),o=Math.min(t.endMillis,e.endMillis);return H0(r,o)});var GZ=t=>H0(t,Number.POSITIVE_INFINITY);var B0=q0,VZ=HZ;var KZ=WZ;var JZ=ZZ;var YZ=GZ;var Oie="effect/ScheduleIntervals",Z0=Symbol.for(Oie),G0=t=>({[Z0]:Z0,intervals:t});var XZ=h(2,(t,e)=>Cie(t.intervals,e.intervals,Pr())),Cie=(t,e,r)=>{let o=t,n=e,i=r;for(;rr(o)&&rr(n);){let s=b(Xt(o),JZ(Xt(n))),a=KZ(s)?i:b(i,Yt(s));b(Xt(o),VZ(Xt(n)))?o=mr(o):n=mr(n),i=a}return G0(No(i))},RS=t=>b(t.intervals,G_,qt(()=>B0)).startMillis,QZ=t=>b(t.intervals,G_,qt(()=>B0)).endMillis,eG=h(2,(t,e)=>RS(t)<RS(e)),tG=t=>rr(t.intervals);var rG=G0;var nG=XZ,AS=RS,V0=QZ,oG=eG,iG=tG;var K0="Continue",sG="Done",aG=t=>({_tag:K0,intervals:t}),cG=t=>({_tag:K0,intervals:rG(xt(t))}),uG={_tag:sG},lG=t=>t._tag===K0,pG=t=>t._tag===sG;var dG=aG;var fG=cG,ld=uG,J0=lG,iu=pG;var mG=Qo;var hG=jc;var gG=xn;var eN=class{permits;waiters=new Set;taken=0;constructor(e){this.permits=e}get free(){return this.permits-this.taken}take=e=>Ch(r=>{if(this.free<e){let o=()=>{this.free<e||(this.waiters.delete(o),r(oe(()=>this.free<e?this.take(e):(this.taken+=e,$(e)))))};return this.waiters.add(o),M(()=>{this.waiters.delete(o)})}r(oe(()=>this.free<e?this.take(e):(this.taken+=e,$(e))))});updateTakenUnsafe(e,r){return this.taken=r(this.taken),this.waiters.size>0&&e.getFiberRef(Vi).scheduleTask(()=>{let o=this.waiters.values(),n=o.next();for(;n.done===!1&&this.free>0;)n.value(),n=o.next()},e.getFiberRef(zi),e),$(this.free)}updateTaken(e){return Ee(r=>this.updateTakenUnsafe(r,e))}resize=e=>bt(Ee(r=>(this.permits=e,this.free<0?de:this.updateTakenUnsafe(r,o=>o))));release=e=>this.updateTaken(r=>r-e);releaseAll=this.updateTaken(e=>0);withPermits=e=>r=>vt(o=>w(o(this.take(e)),n=>wn(o(r),this.release(n))));withPermitsIfAvailable=e=>r=>vt(o=>oe(()=>this.free<e?Yc:(this.taken+=e,wn(o(Zp(r)),this.release(e)))))},PS=t=>new eN(t),xG=t=>M(()=>PS(t)),tN=class extends Zi{isOpen;waiters=[];scheduled=!1;constructor(e){super(),this.isOpen=e}commit(){return this.await}unsafeSchedule(e){return this.scheduled||this.waiters.length===0?de:(this.scheduled=!0,e.currentScheduler.scheduleTask(this.flushWaiters,e.getFiberRef(zi),e),de)}flushWaiters=()=>{this.scheduled=!1;let e=this.waiters;this.waiters=[];for(let r=0;r<e.length;r++)e[r](zr)};open=Ee(e=>this.isOpen?de:(this.isOpen=!0,this.unsafeSchedule(e)));unsafeOpen(){this.isOpen||(this.isOpen=!0,this.flushWaiters())}release=Ee(e=>this.isOpen?de:this.unsafeSchedule(e));await=Ch(e=>this.isOpen?e(de):(this.waiters.push(e),M(()=>{let r=this.waiters.indexOf(e);r!==-1&&this.waiters.splice(r,1)})));unsafeClose(){this.isOpen=!1}close=M(()=>{this.isOpen=!1});whenOpen=e=>Pe(this.await,e)},nN=t=>new tN(t??!1),_G=t=>M(()=>nN(t)),bG=t=>NS(t,MZ),vG=h(2,(t,e)=>F(oN(t,e),r=>r[0])),oN=h(2,(t,e)=>{let r=Wt(e);return w(tn(),o=>F(DS(z()),n=>[bn(Tie(t,r,n),o),$ie(n)]))}),yG=(t,e,r)=>{let o=Do(Wt(e));return b(_n(),Fr(n=>Wo(t,n)),F(n=>B([r+o,n])))},Tie=(t,e,r)=>vt(o=>b(Yo(n=>n.currentTimeMillis),w(n=>Die(r,i=>{switch(i._tag){case"None":return B(yG(t,e,n));case"Some":{let[s]=i.value;return s-n<=0?B(yG(t,e,n)):z()}}})),w(n=>at(n)?Ys("BUG: Effect.cachedInvalidate - please report an issue at https://github.com/Effect-TS/effect/issues"):o(Zt(n.value[1]))))),$ie=t=>Jo(t,z()),SG=h(2,(t,e)=>NS(t,r=>e(P0(r)))),NS=h(2,(t,e)=>w(GW,r=>b(sN(t,r),wn(w(r.value,e))))),wG=h(t=>Tn(t[0]),(t,e)=>e?.discard?gn(t,es):F(nr(t,es),P0)),iN=h(2,(t,e)=>Ee((r,o)=>{let n=e,i=bg(t,r,o.runtimeFlags,Ki);if(n.state._tag==="Open"){let s=()=>Jr(c=>V(c,i.id())?de:bt($h(i))),a={};n.state.finalizers.set(a,s),i.addObserver(()=>{n.state._tag!=="Closed"&&n.state.finalizers.delete(a)})}else i.unsafeInterruptAsFork(r.id());return $(i)})),MS=t=>Gn(e=>iN(t,e)),EG=t=>lo(t),kG=t=>oe(()=>w(t,lo)),Q0=Symbol.for("effect/Effect/memoizeFunction.key"),$S=class{a;eq;[Q0]=Q0;constructor(e,r){this.a=e,this.eq=r}[Q](e){return Y(e,Q0)?this.eq?this.eq(this.a,e.a):V(this.a,e.a):!1}[re](){return this.eq?0:ye(this,G(this.a))}},IG=(t,e)=>b(M(()=>Hc()),w(DS),F(r=>o=>b(r.modifyEffect(n=>{let i=b(n,Tt(new $S(o,e)));return at(i)?b(_n(),Fr(s=>b(Gp(t(o)),Wo(s),es)),F(s=>[s,b(n,rn(new $S(o,e),s))])):$([i.value,n])}),w(Zt),w(([n,i])=>b(Kc(n),Ge(i)))))),OG=h(2,(t,e)=>b(mt(t),IS(mt(e)),r=>Yr(r))),sN=h(2,(t,e)=>Dt(kS,o=>o.zip(e))(t)),CG=h(2,(t,e)=>aN(t,{onTimeout:()=>bq(e),duration:e})),aN=h(2,(t,{duration:e,onTimeout:r})=>Yr(wg(t,{onTimeout:()=>qn(r),onSuccess:$,duration:e}))),RG=h(2,(t,{duration:e,onTimeout:r})=>Yr(wg(t,{onTimeout:()=>Mi(r),onSuccess:$,duration:e}))),AG=h(2,(t,e)=>wg(t,{duration:e,onSuccess:B,onTimeout:z})),wg=h(2,(t,{duration:e,onSuccess:r,onTimeout:o})=>Jr(n=>vt(i=>M0(i(t),Di(Jc(e)),{onSelfWin:(s,a)=>w(s.await,c=>c._tag==="Success"?w(s.inheritAll,()=>Ge(Xr(a,n),r(c.value))):w(Xr(a,n),()=>Be(c.cause))),onOtherWin:(s,a)=>w(s.await,c=>c._tag==="Success"?w(s.inheritAll,()=>Ge(Xr(a,n),o())):w(Xr(a,n),()=>Be(c.cause))),otherScope:Ki})))),Pie="effect/Ref/SynchronizedRef",Nie=Symbol.for(Pie),Mie={_A:t=>t},rN=class extends Zi{ref;withLock;[Nie]=Mie;[vv]=Q$;[ca]=ca;constructor(e,r){super(),this.ref=e,this.withLock=r,this.get=ir(this.ref)}get;commit(){return this.get}modify(e){return this.modifyEffect(r=>$(e(r)))}modifyEffect(e){return this.withLock(b(w(ir(this.ref),e),w(([r,o])=>Ge(Jo(this.ref,o),r))))}},DS=t=>M(()=>cN(t)),cN=t=>{let e=Wp(t),r=PS(1);return new rN(e,r.withPermits(1))},Die=h(2,(t,e)=>t.modifyEffect(r=>{let o=e(r);switch(o._tag){case"None":return $([r,r]);case"Some":return F(o.value,n=>[n,n])}}));var TG=h(t=>ze(t[0]),(t,e,r)=>w(t,o=>ga(e(o),r).pipe(F(n=>Object.assign({},o,n)))));var PG=Symbol.for("effect/ManagedRuntime");var NG="ExtendScope",MG="Fold",uN="Fresh",DG="FromEffect",FG="Scoped",zG="Suspend",jG="Provide",lN="ProvideMerge",LG="MergeAll",UG="ZipWith";var qG=Xr;var pd=t=>function(){if(arguments.length===1){let e=arguments[0];return(r,...o)=>t(e,r,...o)}return t.apply(this,arguments)},jS=pd((t,e,r)=>{let o=gb(),n=[[Qr,[[o,t.context]]]];r?.scheduler&&n.push([Vi,[[o,r.scheduler]]]);let i=q4(t.fiberRefs,{entries:n,forkAs:o});r?.updateRefs&&(i=r.updateRefs(i,o));let s=new xg(o,i,t.runtimeFlags),a=e;r?.scope&&(a=w(gG(r.scope,Wn),u=>Pe(iv(u,Jr(l=>V(l,s.id())?de:Xr(s,l))),Dr(e,l=>hG(u,l)))));let c=s.currentSupervisor;return c!==nu&&(c.onStart(t.context,a,z(),s),s.addObserver(u=>c.onEnd(u,s))),Ki.add(t.runtimeFlags,s),r?.immediate===!1?s.resume(a):s.start(a),s}),mN=pd((t,e,r={})=>{let o=jS(t,e,r);return r.onExit&&o.addObserver(n=>{r.onExit(n)}),(n,i)=>mN(t)(b(o,qG(n??Kr)),{...i,onExit:i?.onExit?s=>i.onExit(Tq(s)):void 0})}),jie=pd((t,e)=>{let r=ZG(t)(e);if(r._tag==="Failure")throw BG(r.effect_instruction_i0);return r.effect_instruction_i0}),dN=class extends Error{fiber;_tag="AsyncFiberException";constructor(e){super(`Fiber #${e.id().id} cannot be resolved synchronously. This is caused by using runSync on an effect that performs async work`),this.fiber=e,this.name=this._tag,this.stack=this.message}},Lie=t=>{let e=Error.stackTraceLimit;Error.stackTraceLimit=0;let r=new dN(t);return Error.stackTraceLimit=e,r};var pN=Symbol.for("effect/Runtime/FiberFailure"),FS=Symbol.for("effect/Runtime/FiberFailure/Cause"),fN=class extends Error{[pN];[FS];constructor(e){let r=wh(e)[0];super(r?.message||"An error has occurred"),this[pN]=pN,this[FS]=e,this.name=r?`(FiberFailure) ${r.name}`:"FiberFailure",r?.stack&&(this.stack=r.stack)}toJSON(){return{_id:"FiberFailure",cause:this[FS].toJSON()}}toString(){return"(FiberFailure) "+Ho(this[FS],{renderErrorCause:!0})}[xe](){return this.toString()}},BG=t=>{let e=Error.stackTraceLimit;Error.stackTraceLimit=0;let r=new fN(t);return Error.stackTraceLimit=e,r};var WG=t=>{let e=t;switch(e._op){case"Failure":case"Success":return e;case"Left":return jh(e.left);case"Right":return it(e.right);case"Some":return it(e.value);case"None":return jh(new en)}},ZG=pd((t,e)=>{let r=WG(e);if(r)return r;let o=new oS,n=jS(t)(e,{scheduler:o});o.flush();let i=n.unsafePoll();return i||u$(qb(Lie(n),uv(n)))}),Uie=pd((t,e,r)=>GG(t,e,r).then(o=>{switch(o._tag){case kt:return o.effect_instruction_i0;case Et:throw BG(o.effect_instruction_i0)}})),GG=pd((t,e,r)=>new Promise(o=>{let n=WG(e);n&&o(n);let i=jS(t)(e);i.addObserver(s=>{o(s)}),r?.signal!==void 0&&(r.signal.aborted?i.unsafeInterruptAsFork(i.id()):r.signal.addEventListener("abort",()=>{i.unsafeInterruptAsFork(i.id())},{once:!0}))})),zS=class{context;runtimeFlags;fiberRefs;constructor(e,r,o){this.context=e,this.runtimeFlags=r,this.fiberRefs=o}pipe(){return K(this,arguments)}},qie=t=>new zS(t.context,t.runtimeFlags,t.fiberRefs),dd=()=>Ee((t,e)=>$(new zS(t.getFiberRef(Qr),e.runtimeFlags,t.getFiberRefs()))),Hie=NT(so,TT,AT),ns=qie({context:Jt(),runtimeFlags:Hie,fiberRefs:H4()});var VG=mN(ns),KG=jS(ns),JG=Uie(ns),YG=GG(ns),XG=jie(ns),QG=ZG(ns),eV=t=>oe(()=>{let e;return w(_n(),r=>w(dd(),o=>vt(n=>Pe(es(n(st(t(i=>mN(o)(Wo(i,r))),{onFailure:i=>Hh(r,i),onSuccess:i=>(e=i,de)}))),n(Zo(Zt(r),()=>e??de))))))});var rV=h(2,(t,e)=>t.modifyEffect(e));var Wie="effect/Layer",qS=Symbol.for(Wie),Zie={_RIn:t=>t,_E:t=>t,_ROut:t=>t},Vn={[qS]:Zie,pipe(){return K(this,arguments)}},Gie="effect/Layer/MemoMap",Eg=Symbol.for(Gie),hN=io()("effect/Layer/CurrentMemoMap",{defaultValue:()=>Vie()}),Ig=t=>Y(t,qS),gN=t=>t._op_layer===uN,LS=class{ref;[Eg];constructor(e){this.ref=e,this[Eg]=Eg}getOrElseMemoize(e,r){return b(rV(this.ref,o=>{let n=o.get(e);if(n!==void 0){let[i,s]=n,a=b(i,w(([c,u])=>b(Kc(c),Ge(u))),Dr(Fp({onFailure:()=>de,onSuccess:()=>zc(r,s)})));return $([a,o])}return b(Zc(0),w(i=>b(_n(),w(s=>b(Zc(()=>de),F(a=>{let c=vt(l=>b(cd(),w(p=>b(l(w(aV(e,p,!0),f=>Gp(f(this)))),mt,w(f=>{switch(f._tag){case Et:return b(Hh(s,f.effect_instruction_i0),Pe(jc(p,f)),Pe(we(f.effect_instruction_i0)));case kt:return b(Jo(a,d=>b(jc(p,d),Pp(eP(i,m=>[m===1,m-1])),bt)),Pe(Gc(i,d=>d+1)),Pe(zc(r,d=>b(M(()=>o.delete(e)),Pe(ir(a)),w(m=>m(d))))),Pe(d$(s,f.effect_instruction_i0)),Ge(f.effect_instruction_i0[1]))}}))))),u=[b(Zt(s),Dr(zp({onFailure:()=>de,onSuccess:()=>Gc(i,l=>l+1)}))),l=>b(ir(a),w(p=>p(l)))];return[c,gN(e)?o:o.set(e,u)]}))))))}),Yr)}},yN=oe(()=>F(DS(new Map),t=>new LS(t))),Vie=()=>new LS(cN(new Map)),sV=t=>Gn(e=>xa(t,e)),xa=h(2,(t,e)=>w(yN,r=>HS(t,r,e))),HS=h(3,(t,e,r)=>w(aV(t,r),o=>ua(o(e),hN,e))),aV=(t,e,r=!1)=>{let o=t;switch(o._op_layer){case"Locally":return M(()=>n=>o.f(n.getOrElseMemoize(o.self,e)));case"ExtendScope":return M(()=>n=>Gn(i=>n.getOrElseMemoize(o.layer,i)));case"Fold":return M(()=>n=>b(n.getOrElseMemoize(o.layer,e),st({onFailure:i=>n.getOrElseMemoize(o.failureK(i),e),onSuccess:i=>n.getOrElseMemoize(o.successK(i),e)})));case"Fresh":return M(()=>n=>b(o.layer,xa(e)));case"FromEffect":return r?M(()=>n=>o.effect):M(()=>n=>n.getOrElseMemoize(t,e));case"Provide":return M(()=>n=>b(n.getOrElseMemoize(o.first,e),w(i=>b(n.getOrElseMemoize(o.second,e),bn(i)))));case"Scoped":return r?M(()=>n=>rs(o.effect,e)):M(()=>n=>n.getOrElseMemoize(t,e));case"Suspend":return M(()=>n=>n.getOrElseMemoize(o.evaluate(),e));case"ProvideMerge":return M(()=>n=>b(n.getOrElseMemoize(o.first,e),Vo(n.getOrElseMemoize(o.second,e),o.zipK)));case"ZipWith":return Kb(function*(){let n=yield*xn(e,rg),i=yield*xn(n,Wn),s=yield*xn(n,Wn);return a=>b(a.getOrElseMemoize(o.first,i),ts(a.getOrElseMemoize(o.second,s),o.zipK,{concurrent:!0}))});case"MergeAll":{let n=o.layers;return F(xn(e,rg),i=>s=>{let a=new Array(n.length);return F(Qi(n,Np(function*(c,u){let l=yield*xn(i,Wn),p=yield*s.getOrElseMemoize(c,l);a[u]=p}),!1,!1),()=>qA(...a))})}}},su=h(2,(t,e)=>JS(t,{onFailure:e,onSuccess:os})),xN=h(2,(t,e)=>KS(t,{onFailure:e,onSuccess:os})),_N=t=>Og(U0(t)),cV=t=>WS(()=>U0(t())),uV=t=>VS(t,()=>Jt()),BS=()=>br(tn()),lV=t=>{let e=Object.create(Vn);return e._op_layer=NG,e.layer=t,e},bN=t=>Og(L0(t)),vN=t=>WS(()=>L0(t())),Og=t=>br(we(t)),WS=t=>br(Mi(t)),ei=h(2,(t,e)=>JS(t,{onFailure:bN,onSuccess:e})),pV=h(2,(t,e)=>ei(t,Nt(e))),SN=t=>{let e=Object.create(Vn);return e._op_layer=uN,e.layer=t,e},_a=h(2,(t,e)=>{let r=gp(t),o=r?t:e;return br(F(r?e:t,i=>Gr(o,i)))}),dV=t=>br(F(t,()=>Jt()));function br(t){let e=Object.create(Vn);return e._op_layer=DG,e.effect=t,e}var fV=h(3,(t,e,r)=>ZS(t,ht(e,r))),ZS=h(2,(t,e)=>{let r=Object.create(Vn);return r._op_layer="Locally",r.self=t,r.f=e,r}),GS=h(3,(t,e,r)=>ZS(t,Dt(e,r))),mV=(t,e)=>au(_r(t,e)),hV=(t,e)=>au(sr(t,e)),gV=(t,e,r)=>br(F(t,o=>Gr(e,r(o)))),yV=t=>wS(Pe(Gn(e=>b(t,xa(e))),ia)),xV=function(){return arguments.length===1?t=>nV(arguments[0],t):nV(arguments[0],arguments[1])},nV=(t,e)=>fd(t,new Proxy({...e},{get(r,o,n){if(o in r)return r[o];let i=Error.stackTraceLimit;Error.stackTraceLimit=2;let s=new Error(`${t.key}: Unimplemented method "${o.toString()}"`);return Error.stackTraceLimit=i,s.name="UnimplementedError",Kie(s)},has:Oo})),Kie=t=>{let e=yr(t);function r(){return e}return Object.assign(r,e),Object.setPrototypeOf(r,Object.getPrototypeOf(e)),r},VS=h(2,(t,e)=>ei(t,r=>os(e(r)))),_V=h(2,(t,e)=>su(t,r=>vN(()=>e(r)))),KS=h(2,(t,{onFailure:e,onSuccess:r})=>{let o=Object.create(Vn);return o._op_layer=MG,o.layer=t,o.failureK=e,o.successK=r,o}),JS=h(2,(t,{onFailure:e,onSuccess:r})=>KS(t,{onFailure:o=>{let n=UZ(o);switch(n._tag){case"Left":return e(n.left);case"Right":return Og(n.right)}},onSuccess:r})),bV=t=>Gn(e=>F($v(xa(t,e)),br)),wN=h(2,(t,e)=>EN(t,e,(r,o)=>Dn(r,o))),YS=(...t)=>{let e=Object.create(Vn);return e._op_layer=LG,e.layers=t,e},vV=t=>su(t,e=>_N(e)),SV=h(2,(t,e)=>su(t,e)),wV=t=>wN(BS(),t),EV=h(4,(t,e,r,o)=>VS(t,n=>Gr(r,o(Mn(n,e))))),kV=h(2,(t,e)=>Rg(()=>{let r=Ht("effect/Layer/retry/{ state: unknown }");return b(fd(r,{state:e.initial}),ei(o=>IV(t,e,r,b(o,Nt(r)).state)))})),IV=(t,e,r,o)=>b(t,su(n=>b(Jie(e,r,n,o),ei(i=>SN(IV(t,e,r,b(i,Nt(r)).state)))))),Jie=(t,e,r,o)=>_a(e,b(Hp,w(n=>b(t.step(n,r,o),w(([i,s,a])=>iu(a)?_e(r):b(Vh(Mo(AS(a.intervals)-n)),Ge({state:i}))))))),ba=h(2,(t,e)=>{let r=gp(t),o=r?t:e;return Cg(F(r?e:t,i=>Gr(o,i)))}),au=t=>Cg(b(t,Ge(Jt()))),Cg=t=>{let e=Object.create(Vn);return e._op_layer=FG,e.effect=t,e},OV=Cg(F(ad(cd(),(t,e)=>t.close(e)),t=>Gr(mG,t))),CV=t=>_a(t,t),fd=h(2,(t,e)=>{let r=gp(t);return br($(Gr(r?t:e,r?e:t)))}),os=t=>br($(t)),RV=os(Jt()),Rg=t=>{let e=Object.create(Vn);return e._op_layer=zG,e.evaluate=t,e},XS=h(2,(t,e)=>{let r=gp(t),o=r?t:e,n=r?e:t;return br(M(()=>Gr(o,n())))}),AV=t=>br(M(t)),TV=h(2,(t,e)=>ei(t,r=>br(Ge(e(r),r)))),$V=h(2,(t,e)=>su(t,r=>br(w(e(r),()=>_e(r))))),PV=h(2,(t,e)=>xN(t,r=>br(w(e(r),()=>we(r))))),NV=t=>b(Gn(e=>xa(t,e)),w(e=>b(dd(),bn(e)))),MV=h(2,(t,e)=>w(Gn(r=>HS(t,e,r)),r=>b(dd(),bn(r)))),cu=h(2,(t,e)=>Rg(()=>{let r=Object.create(Vn);return r._op_layer=jG,r.first=Object.create(Vn,{_op_layer:{value:lN,enumerable:!0},first:{value:BS(),enumerable:!0},second:{value:Array.isArray(e)?YS(...e):e},zipK:{value:(o,n)=>b(o,Dn(n))}}),r.second=t,r})),DV=h(2,(t,e)=>{let r=Object.create(Vn);return r._op_layer=lN,r.first=e,r.second=cu(t,e),r.zipK=(o,n)=>b(o,Dn(n)),r}),EN=h(3,(t,e,r)=>Rg(()=>{let o=Object.create(Vn);return o._op_layer=UG,o.first=t,o.second=e,o.zipK=r,o})),kN=t=>{let e=Ht("effect/Layer/unwrapEffect/Layer.Layer<R1, E1, A>");return ei(_a(e,t),r=>Nt(r,e))},kg=t=>{let e=Ht("effect/Layer/unwrapScoped/Layer.Layer<R1, E1, A>");return ei(ba(e,t),r=>Nt(r,e))},FV=h(t=>Ig(t[0]),function(){let t=arguments;return GS(t[0],ji,typeof t[1]=="string"?hr(t[1],t[2]):e=>Object.entries(t[1]).reduce((r,[o,n])=>hr(r,o,n),e))}),zV=h(t=>Ig(t[0]),function(){let t=arguments;return GS(t[0],Mp,typeof t[1]=="string"?hr(t[1],t[2]):e=>Object.entries(t[1]).reduce((r,[o,n])=>hr(r,o,n),e))}),jV=function(){let t=typeof arguments[0]!="string",e=t?arguments[1]:arguments[0],r=vn(t?arguments[2]:arguments[1]);if(t){let o=arguments[0];return kg(F(r?.onEnd?Fr(Zn(e,r),n=>Xo(i=>r.onEnd(n,i))):Zn(e,r),n=>US(o,n)))}return o=>kg(F(r?.onEnd?Fr(Zn(e,r),n=>Xo(i=>r.onEnd(n,i))):Zn(e,r),n=>US(o,n)))},US=h(2,(t,e)=>cu(t,os(Gr(xr,e)))),oV=h(2,(t,e)=>vg(r=>w(xa(e,r),o=>cv(t,o)))),iV=h(2,(t,e)=>{let r=Xc(ns.fiberRefs,e.fiberRefs),o=Ln(ns.runtimeFlags,e.runtimeFlags);return vt(n=>Ee(i=>{let s=i.getFiberRef(Qr),a=i.getFiberRefs(),c=Qc(i.id(),a)(r),u=i.currentRuntimeFlags,l=Ti(o)(u),p=Xc(c,a),f=Ln(l,u);return i.setFiberRefs(c),i.currentRuntimeFlags=l,wn(cv(n(t),Dn(s,e.context)),Ee(d=>(d.setFiberRefs(Qc(d.id(),d.getFiberRefs())(p)),d.currentRuntimeFlags=Ti(f)(d.currentRuntimeFlags),de)))}))}),QS=h(2,(t,e)=>Array.isArray(e)?oV(t,YS(...e)):Ig(e)?oV(t,e):UA(e)?cv(t,e):PG in e?w(e.runtimeEffect,r=>iV(t,r)):iV(t,e));var LV=F(yn(ut),Nt(qi)),UV=t=>or(ut,e=>t(Nt(e,qi))),qV=h(2,(t,e)=>Dt(t,ut,Ze(qi,e))),HV=t=>sr(ut,Ze(qi,t));var BV=y4;var Xie="effect/Schedule",VV=Symbol.for(Xie),KV=t=>Y(t,VV),Qie="effect/ScheduleDriver",ese=Symbol.for(Qie),IN={start:0,now:0,input:void 0,output:void 0,elapsed:Hs,elapsedSincePrevious:Hs,recurrence:0},Ag=io()("effect/Schedule/CurrentIterationMetadata",{defaultValue:()=>IN}),tse={_Out:t=>t,_In:t=>t,_R:t=>t},rse={_Out:t=>t,_In:t=>t,_R:t=>t},ON=class{initial;step;[VV]=tse;constructor(e,r){this.initial=e,this.step=r}pipe(){return K(this,arguments)}},ZV=(t,e,r,o)=>Gc(t,n=>n.recurrence===0?{now:e,input:r,output:o,recurrence:n.recurrence+1,elapsed:Hs,elapsedSincePrevious:Hs,start:e}:{now:e,input:r,output:o,recurrence:n.recurrence+1,elapsed:Mo(e-n.start),elapsedSincePrevious:Mo(e-n.now),start:n.start}),CN=class{schedule;ref;[ese]=rse;constructor(e,r){this.schedule=e,this.ref=r}get state(){return F(ir(this.ref),e=>e[1])}get last(){return w(ir(this.ref),([e,r])=>{switch(e._tag){case"None":return qn(()=>new en);case"Some":return $(e.value)}})}iterationMeta=Wp(IN);get reset(){return Jo(this.ref,[z(),this.schedule.initial]).pipe(Mc(Jo(this.iterationMeta,IN)))}next(e){return b(F(ir(this.ref),r=>r[1]),w(r=>b(Hp,w(o=>b(oe(()=>this.schedule.step(o,e,r)),w(([n,i,s])=>{let a=Jo(this.ref,[B(i),n]);if(iu(s))return a.pipe(Pe(_e(z())));let c=AS(s.intervals)-o;if(c<=0)return a.pipe(Pe(ZV(this.iterationMeta,o,e,i)),Ge(i));let u=Mo(c);return b(a,Pe(ZV(this.iterationMeta,o,e,i)),Pe(Jc(u)),Ge(i))}))))))}},$g=(t,e)=>new ON(t,e);var nse=t=>YV(t,Co);var ose=h(2,(t,e)=>TN(t,(r,o)=>M(()=>e(r,o)))),TN=h(2,(t,e)=>$g(t.initial,(r,o,n)=>w(t.step(r,o,n),([i,s,a])=>iu(a)?$([i,s,ld]):F(e(o,s),c=>c?[i,s,a]:[i,s,ld]))));var $N=t=>b(Zc([z(),t.initial]),F(e=>new CN(t,e)));var JV=h(2,(t,e)=>ise(t,e,nG)),ise=h(3,(t,e,r)=>$g([t.initial,e.initial],(o,n,i)=>b(Vo(t.step(o,n,i[0]),e.step(o,n,i[1]),(s,a)=>[s,a]),w(([[s,a,c],[u,l,p]])=>J0(c)&&J0(p)?RN(t,e,n,s,a,c.intervals,u,l,p.intervals,r):$([[s,u],[a,l],ld]))))),RN=(t,e,r,o,n,i,s,a,c,u)=>{let l=u(i,c);return iG(l)?$([[o,s],[n,a],dG(l)]):b(i,oG(c))?w(t.step(V0(i),r,o),([p,f,d])=>iu(d)?$([[p,s],[f,a],ld]):RN(t,e,r,p,f,d.intervals,s,a,c,u)):w(e.step(V0(c),r,s),([p,f,d])=>iu(d)?$([[o,p],[n,f],ld]):RN(t,e,r,o,n,i,p,f,d.intervals,u))};var YV=h(2,(t,e)=>sse(t,r=>M(()=>e(r)))),sse=h(2,(t,e)=>$g(t.initial,(r,o,n)=>w(t.step(r,o,n),([i,s,a])=>F(e(s),c=>[i,c,a]))));var ase=t=>$g(t.initial,(e,r,o)=>b(t.step(e,r,o),F(([n,i,s])=>[n,r,s])));var PN=t=>use(zN,e=>e<t);var cse=(t,e)=>$g(t,(r,o,n)=>M(()=>[e(n),n,fG(YZ(r))]));var XV=h(2,(t,e)=>TN(t,(r,o)=>Pv(e(r))));var QV=h(2,(t,e)=>TN(t,(r,o)=>e(r))),use=h(2,(t,e)=>ose(t,(r,o)=>e(o)));var tw=Symbol.for("effect/Schedule/ScheduleDefect"),AN=class{error;[tw];constructor(e){this.error=e,this[tw]=tw}},lse=t=>Y(t,tw),rw=t=>co(t,e=>yr(new AN(e))),pse=t=>Ut(Ks(t,e=>Op(e)&&lse(e.defect)?B(e.defect):z()),{onNone:()=>t,onSome:e=>$i(e.error)}),Pg=t=>Bo(t,e=>we(pse(e))),GV=h(2,(t,e)=>NN(t,e,(r,o)=>_e(r))),eK=h(2,(t,e)=>{if(KV(e))return GV(t,e);let r=e.schedule??ase(zN),o=e.while?QV(r,s=>{let a=e.while(s);return typeof a=="boolean"?$(a):rw(a)}):r,n=e.until?XV(o,s=>{let a=e.until(s);return typeof a=="boolean"?$(a):rw(a)}):o,i=e.times?JV(n,PN(e.times)).pipe(YV(s=>s[0])):n;return Pg(GV(t,i))}),NN=h(3,(t,e,r)=>w($N(e),o=>Mt(t,{onFailure:n=>r(n,z()),onSuccess:n=>tK(la(t,Ag,ir(o.iterationMeta)),o,(i,s)=>la(r(i,s),Ag,ir(o.iterationMeta)),n)}))),tK=(t,e,r,o)=>Mt(e.next(o),{onFailure:()=>Pc(e.last),onSuccess:n=>Mt(t,{onFailure:i=>r(i,B(n)),onSuccess:i=>tK(t,e,r,i)})}),Tg=h(2,(t,e)=>MN(t,e,(r,o)=>_e(r))),rK=h(2,(t,e)=>KV(e)?Tg(t,e):Pg(Tg(t,nw(e)))),nw=t=>{let e=t.schedule??zN,r=t.while?QV(e,n=>{let i=t.while(n);return typeof i=="boolean"?$(i):rw(i)}):e,o=t.until?XV(r,n=>{let i=t.until(n);return typeof i=="boolean"?$(i):rw(i)}):r;return t.times!==void 0?JV(o,PN(t.times)):o},MN=h(3,(t,e,r)=>w($N(e),o=>nK(la(t,Ag,ir(o.iterationMeta)),o,(n,i)=>la(r(n,i),Ag,ir(o.iterationMeta))))),nK=(t,e,r)=>co(t,o=>Mt(e.next(o),{onFailure:()=>b(e.last,Pc,w(n=>r(o,n))),onSuccess:()=>nK(t,e,r)})),DN=h(2,(t,e)=>FN(t,void 0,e)),FN=h(3,(t,e,r)=>w($N(r),o=>oK(la(t,Ag,ir(o.iterationMeta)),e,o))),oK=(t,e,r)=>Mt(r.next(e),{onFailure:()=>Pc(r.last),onSuccess:()=>w(t,o=>oK(t,o,r))});var zN=cse(0,t=>t+1),iK=nse(PN(1));var sK=h(2,(t,e)=>MS(DN(t,e)));var uK=h(2,(t,e)=>oe(()=>{let r=0,o;return w(oa({while:()=>r<e.steps.length&&(o===void 0||Ao(o)),body:()=>{let n=e.steps[r],i=QS(t,n.provide);if(o){let s=!1,a=i;i=oe(()=>s?a:(s=!0,o)),i=Pg(Tg(i,cK(n,!1)))}else{let s=cK(n,!0);i=s?Pg(Tg(i,s)):i}return Un(i)},step:n=>{o=n,r++}}),()=>o)})),cK=(t,e)=>{if(e){if(t.attempts===1||!(t.schedule||t.attempts))return}else return nw({schedule:t.schedule?t.schedule:t.attempts?void 0:iK,times:t.attempts,while:t.while});return nw({schedule:t.schedule,while:t.while,times:t.attempts?t.attempts-1:void 0})};var md=pe(Symbol.for("effect/FiberRef/currentCache"),()=>gt(LZ(65536,()=>F(_n(),t=>({listeners:new rd,handle:t})),()=>KA(60)))),Ng=pe(Symbol.for("effect/FiberRef/currentCacheEnabled"),()=>gt(!1)),lK=(t,e)=>w(ze(e)?e:$(e),r=>Jr(o=>{let n=new Proxy(t,{});return or(Ng,i=>{if(i){let a=or(md,c=>w(c.getEither(n),u=>{switch(u._tag){case"Left":return u.left.listeners.interrupted?w(c.invalidateWhen(n,l=>l.handle===u.left.handle),()=>a):(u.left.listeners.increment(),vt(l=>w(mt(Pi(O2,l(Zt(u.left.handle)))),p=>(u.left.listeners.decrement(),p))));case"Right":return u.right.listeners.increment(),vt(l=>w(mt(Pi(BT(r,WT({request:n,result:u.right.handle,listeners:u.right.listeners,ownerId:o,state:{completed:!1}})),l(Zt(u.right.handle)))),()=>(u.right.listeners.decrement(),Zt(u.right.handle))))}}));return a}let s=new rd;return s.increment(),w(_n(),a=>wn(Pi(BT(r,WT({request:n,result:a,listeners:s,ownerId:o,state:{completed:!1}})),Zt(a)),M(()=>s.decrement())))})})),pK=(t,e)=>or(Ng,r=>r?or(md,o=>w(o.getEither(t),n=>{switch(n._tag){case"Left":return de;case"Right":return l$(n.right.handle,e)}})):de),dK=h(2,(t,e)=>ht(t,Ng,e)),fK=h(2,(t,e)=>ht(t,md,e));var hK=RW;var fse=Ni,mse=ze,hse=vG,gse=oN,yse=$v,xse=IG,_se=lP,bse=ga,vse=hZ,Sse=gZ,wse=kH,Ese=IH,kse=b6,Ise=v6,Ose=FH,Cse=dZ,Rse=mZ,Ase=CH,Tse=PH,$se=Sn,Pse=jH,Nse=O0,Mse=C0,Dse=l6,Fse=d6,zse=p6,jse=vZ,Lse=I0,Use=yZ,qse=_Z,Hse=IZ,Bse=gr,Wse=eV,Zse=Oh,Gse=Ee,Vse=_e,Kse=qn,_K=we,Jse=Mi,jN=yr,Yse=Ys,Xse=Xs,Qse=Kb,eae=ia,tae=n6,rae=c6,nae=$,LN=Yc,oae=x6,iae=oe,sae=M,aae=de;var cae=Go,uae=lH;var lae=co,pae=Bo,dae=pH,fae=Rh,mae=X2,hae=dH,gae=fH,yae=mH,xae=hH,_ae=gH,bae=sP,vae=Tv,Sae=LH,wae=a6,Eae=g6,kae=rK,Iae=uK,Oae=MN,Cae=iP;var Rae=C6,Aae=R6,Tae=mP,$ae=$6,Pae=_H,Nae=Q2,Mae=DZ,Dae=Wb,Fae=Zb,zae=Di,jae=eq,Lae=Zo,Uae=Fi,qae=vt,Hae=TH,Bae=Ge,Wae=Zp,Zae=uH,Gae=bt,Vae=ta,Kae=DH,uu=F,Jae=t6,Yae=Th,Xae=ra,Qae=Vp,ece=r6,tce=Pv,rce=ad,nce=lZ,oce=Ub,ice=Xo,sce=wn,ace=Gb,cce=Dr,uce=vS,lce=SS,pce=SZ,dce=$0,fce=Gn,mce=vg,hce=wS,gce=EZ,yce=RZ,xce=bG,_ce=pZ,bce=bH,vce=Rv,Sce=Gp,wce=SG,Ece=NS,kce=Qs,Ice=Jr,Oce=es,Cce=_g,Rce=wG,Ace=iN,Tce=MS,$ce=xZ,Pce=EG,Nce=kG,Mce=sN,Dce=Vb,Fce=rq,zce=IB,jce=a$,Lce=mq,Uce=yH,qce=Yo,Hce=OZ,Bce=k4,Wce=LV,Zce=UV,Gce=HV,Vce=qV,Kce=xH,Jce=Jc,Yce=I6,Xce=fP,Qce=CG,eue=AG,tue=aN,rue=RG,nue=wg,oue=O4,iue=I4,sue=ES,aue=tn,cue=OH,uue=Hn,lue=qc,pue=QS,due=ua,fue=la,mue=z6,hue=F6,gue=hP,yue=gP,xue=j6,_ue=L6,bue=yP,vue=P6,Sue=vH,wue=SH,Eue=TG,kue=wH,Iue=EH;var Oue=o6,Cue=Un,Rue=mt,Aue=Wo,Tue=Bb;var $ue=RH,Pue=AH,Nue=Xh,Mue=$H,Due=f$,Fue=Iq,zue=A6,jue=T6,Lue=Mv,Uue=Pp,que=N6,Hue=M6,Bue=w,Wue=ea,Zue=Yr,Gue=IS,Vue=bZ,Kue=OG,Jue=N0,Yue=eg,Xue=Fr,Que=S6,ele=w6,tle=dP,rle=E6,nle=k6,ole=aP,ile=cP,sle=XH,ale=eK,cle=m6,ule=NN,lle=DN,ple=sK,dle=FN,fle=oa,mle=Av,hle=UH,gle=ht,yle=Dt,xle=_r,_le=sr,ble=Kc,vle=y6,Sle=Nv,wle=qH,Ele=HH,kle=Qh,Ile=Ah,Ole=st,Cle=Mt,Rle=BH,Ale=(t,...e)=>Gi(t)(...e),Tle=WH,$le=uP,Ple=ZH,Nle=GH,Mle=VH,Dle=KH,Fle=JH,zle=cH,jle=cZ,Lle=YH,Ule=hq,qle=uZ,Hle=Pc,Ble=r$,Wle=$c,Zle=i6,Gle=s6,Vle=MH,Kle=u6,Jle=hv,bK=C4,Yle=h(2,(t,e)=>bK(t,BV(e))),Xle=CZ,Qle=dd,epe=$p,tpe=na,rpe=Jb,npe=T0,ope=_6,ipe=pP,spe=wZ,ape=R0,cpe=gq,upe=D6,lpe=PS,ppe=xG,dpe=nN,fpe=_G,mpe=KG,hpe=VG,gpe=JG,ype=YG,xpe=XG,_pe=QG,bpe=kZ,vpe=A0,Spe=AZ,wpe=TZ,Epe=$Z,vK=ts,kpe=h(2,(t,e)=>vK(t,e,(r,o)=>r(o))),Ipe=Pi,Ope=Lb,Cpe=Hb,Rpe=h(t=>hK(t[0]),lK),Ape=pK,Tpe=nq,$pe=dK,Ppe=fK,Npe=O6,Mpe=gv,Dpe=R4,Fpe=OS,zpe=oq,jpe=iq,Lpe=H6,Upe=U6,qpe=xP,Hpe=_P,Bpe=B6,Wpe=V6,Zpe=K6,Gpe=W6,Vpe=q6,Kpe=G6,Jpe=Zn,Ype=Ov,SK=vP,Xpe=J6,Qpe=FZ,ede=Cv,tde=Y6,rde=X6,nde=t=>cp(t)?LN:uu(t.value,Fs),ode=h(2,(t,e)=>cp(t)?LN:uu(e(t.value),Fs)),wK=t=>{let e=new Map;return new Proxy(t,{get(r,o,n){if(o in r)return Reflect.get(r,o,n);if(e.has(o))return e.get(o);let i=(...p)=>ea(r,f=>typeof f[o]=="function"?(e.set(o,(...d)=>ea(r,m=>m[o](...d))),f[o](...p)):(e.set(o,ea(r,d=>d[o])),f[o])),s=ea(r,p=>p[o]);Object.assign(i,s);let a=i.apply,c=i.bind,u=i.call,l=Object.setPrototypeOf({},Object.getPrototypeOf(s));return l.apply=a,l.bind=c,l.call=u,Object.setPrototypeOf(i,l),e.set(o,i),i}})},ide=t=>()=>{let e=Error.stackTraceLimit;Error.stackTraceLimit=2;let r=new Error;Error.stackTraceLimit=e;function o(){}return Object.setPrototypeOf(o,hp),o.key=t,Object.defineProperty(o,"use",{get(){return n=>ea(this,n)}}),Object.defineProperty(o,"stack",{get(){return r.stack}}),wK(o)},sde=function(){return function(){let[t,e]=arguments,r="accessors"in e?e.accessors:!1,o=Error.stackTraceLimit;Error.stackTraceLimit=2;let n=new Error;Error.stackTraceLimit=o;let i="unchecked",s=function(p){if(i==="unchecked"){let f=Object.getPrototypeOf(p);if(f===Object.prototype||f===null)i="plain";else{let d=Object.getPrototypeOf(this);Object.setPrototypeOf(d,f),i="patched"}}if(i==="plain")Object.assign(this,p);else if(i==="patched")return Object.setPrototypeOf(p,Object.getPrototypeOf(this)),p};s.prototype._tag=t,Object.defineProperty(s,"make",{get(){return p=>new this(p)}}),Object.defineProperty(s,"use",{get(){return p=>ea(this,p)}}),s.key=t,Object.assign(s,hp),Object.defineProperty(s,"stack",{get(){return n.stack}});let a="dependencies"in e&&e.dependencies.length>0,c=a?"DefaultWithoutDependencies":"Default",u,l=!1;if("effect"in e?(l=typeof e.effect=="function",Object.defineProperty(s,c,{get(){return l?function(){return _a(s,uu(e.effect.apply(null,arguments),p=>new this(p)))}.bind(this):u??=_a(s,uu(e.effect,p=>new this(p)))}})):"scoped"in e?(l=typeof e.scoped=="function",Object.defineProperty(s,c,{get(){return l?function(){return ba(s,uu(e.scoped.apply(null,arguments),p=>new this(p)))}.bind(this):u??=ba(s,uu(e.scoped,p=>new this(p)))}})):"sync"in e?Object.defineProperty(s,c,{get(){return u??=XS(s,()=>new this(e.sync()))}}):Object.defineProperty(s,c,{get(){return u??=fd(s,new this(e.succeed))}}),a){let p;Object.defineProperty(s,"Default",{get(){return l?function(){return cu(this.DefaultWithoutDependencies.apply(null,arguments),e.dependencies)}:p??=cu(this.DefaultWithoutDependencies,e.dependencies)}})}return r===!0?wK(s):s}},ade=function(t,...e){let r=Error.stackTraceLimit;Error.stackTraceLimit=2;let o=new Error;if(Error.stackTraceLimit=r,typeof t!="string")return yK(t.length,function(...s){let a=Error.stackTraceLimit;Error.stackTraceLimit=2;let c=new Error;return Error.stackTraceLimit=a,xK({self:this,body:t,args:s,pipeables:e,spanName:"<anonymous>",spanOptions:{context:Up.context(!0)},errorDef:o,errorCall:c})});let n=t,i=e[0];return(s,...a)=>yK(s.length,{[n](...c){let u=Error.stackTraceLimit;Error.stackTraceLimit=2;let l=new Error;return Error.stackTraceLimit=u,xK({self:this,body:s,args:c,pipeables:a,spanName:n,spanOptions:i,errorDef:o,errorCall:l})}}[n])};function yK(t,e){return Object.defineProperty(e,"length",{value:t,configurable:!0})}function xK(t){let e,r;if(oU(t.body))e=kh(()=>t.body.apply(t.self,t.args));else try{e=t.body.apply(t.self,t.args)}catch(s){r=s,e=jN(s)}if(t.pipeables.length>0)try{for(let s of t.pipeables)e=s(e,...t.args)}catch(s){e=r?_K(ft(At(r),At(s))):jN(s)}let o=!1,n=()=>{if(o!==!1)return o;if(t.errorCall.stack){let s=t.errorDef.stack.trim().split(`
|
|
108
|
+
`),a=t.errorCall.stack.trim().split(`
|
|
109
|
+
`),c=s.slice(2).join(`
|
|
110
|
+
`).trim();c.includes("(")||(c=c.replace(/at (.*)/,"at ($1)"));let u=a.slice(2).join(`
|
|
111
|
+
`).trim();return u.includes("(")||(u=u.replace(/at (.*)/,"at ($1)")),o=`${c}
|
|
112
|
+
${u}`,o}},i=t.spanOptions&&"captureStackTrace"in t.spanOptions?t.spanOptions:{captureStackTrace:n,...t.spanOptions};return SK(e,t.spanName,i)}var cde=Np,ude=()=>t=>t,lde=()=>t=>t,pde=()=>t=>t;var ow={};an(ow,{CurrentMemoMap:()=>hde,LayerTypeId:()=>fde,MemoMapTypeId:()=>mde,annotateLogs:()=>xde,annotateSpans:()=>_de,build:()=>bde,buildWithMemoMap:()=>jfe,buildWithScope:()=>vde,catchAll:()=>Sde,catchAllCause:()=>wde,context:()=>CK,die:()=>Ede,dieSync:()=>kde,discard:()=>Ide,effect:()=>Ode,effectContext:()=>Rde,effectDiscard:()=>Cde,empty:()=>Ade,ensureErrorType:()=>qfe,ensureRequirementsType:()=>Hfe,ensureSuccessType:()=>Ufe,extendScope:()=>Tde,fail:()=>$de,failCause:()=>Nde,failCauseSync:()=>Mde,failSync:()=>Pde,fiberRefLocallyScopedWith:()=>rfe,flatMap:()=>Dde,flatten:()=>Fde,fresh:()=>zde,function:()=>Lde,isFresh:()=>yde,isLayer:()=>gde,launch:()=>Ude,locally:()=>Qde,locallyEffect:()=>Xde,locallyScoped:()=>tfe,locallyWith:()=>efe,makeMemoMap:()=>zfe,map:()=>RK,mapError:()=>qde,match:()=>Hde,matchCause:()=>Bde,memoize:()=>Wde,merge:()=>Zde,mergeAll:()=>Gde,mock:()=>jde,orDie:()=>Vde,orElse:()=>Kde,parentSpan:()=>Efe,passthrough:()=>Jde,project:()=>Yde,provide:()=>AK,provideMerge:()=>xfe,retry:()=>nfe,scope:()=>ofe,scoped:()=>ife,scopedContext:()=>sfe,scopedDiscard:()=>fo,service:()=>afe,setClock:()=>Sfe,setConfigProvider:()=>wfe,setRandom:()=>kfe,setRequestBatching:()=>Ife,setRequestCache:()=>Cfe,setRequestCaching:()=>Ofe,setScheduler:()=>Rfe,setTracer:()=>Tfe,setTracerEnabled:()=>$fe,setTracerTiming:()=>Pfe,setUnhandledErrorLogLevel:()=>Nfe,setVersionMismatchErrorLogLevel:()=>Mfe,span:()=>Afe,succeed:()=>cfe,succeedContext:()=>ufe,suspend:()=>lfe,sync:()=>pfe,syncContext:()=>dfe,tap:()=>ffe,tapError:()=>mfe,tapErrorCause:()=>hfe,toRuntime:()=>gfe,toRuntimeWithMemoMap:()=>yfe,unwrapEffect:()=>bfe,unwrapScoped:()=>vfe,updateService:()=>Lfe,withParentSpan:()=>Ffe,withSpan:()=>Dfe,zipWith:()=>_fe});var EK=t=>au(ES(t)),kK=t=>os(Gr(xr,t)),IK=(t,e)=>(e=vn(e),ba(xr,e?.onEnd?Fr(Zn(t,e),r=>Xo(o=>e.onEnd(r,o))):Zn(t,e))),OK=t=>au(OS(t));var fde=qS,mde=Eg,hde=hN,gde=Ig,yde=gN,xde=FV,_de=zV,bde=sV,vde=xa,Sde=su,wde=xN,CK=BS,Ede=_N,kde=cV,Ide=uV,Ode=_a,Cde=dV,Rde=br,Ade=RV,Tde=lV,$de=bN,Pde=vN,Nde=Og,Mde=WS,Dde=ei,Fde=pV,zde=SN,jde=xV,Lde=gV;var Ude=yV,RK=VS,qde=_V,Hde=JS,Bde=KS,Wde=bV,Zde=wN,Gde=YS,Vde=vV,Kde=SV,Jde=wV,Yde=EV,Xde=ZS,Qde=fV,efe=GS,tfe=mV,rfe=hV,nfe=kV,ofe=OV,ife=ba,fo=au,sfe=Cg,afe=CV,cfe=fd,ufe=os,lfe=Rg,pfe=XS,dfe=AV,ffe=TV,mfe=$V,hfe=PV,gfe=NV,yfe=MV,AK=cu,xfe=DV,_fe=EN,bfe=kN,vfe=kg,Sfe=t=>fo(sr(ut,Ze(jr,t))),wfe=EK,Efe=kK,kfe=t=>fo(sr(ut,Ze(Hi,t))),Ife=t=>fo(_r(Ph,t)),Ofe=t=>fo(_r(Ng,t)),Cfe=t=>fo(ze(t)?w(t,e=>_r(md,e)):_r(md,t)),Rfe=t=>fo(_r(Vi,t)),Afe=IK,Tfe=OK,$fe=t=>fo(_r(Mh,t)),Pfe=t=>fo(_r(sa,t)),Nfe=t=>fo(_r(Nh,t)),Mfe=t=>fo(_r(tv,t)),Dfe=jV,Ffe=US,zfe=yN,jfe=HS,Lfe=h(3,(t,e,r)=>AK(t,RK(CK(),o=>Ze(o,e,r(Mn(o,e)))))),Ufe=()=>t=>t,qfe=()=>t=>t,Hfe=()=>t=>t;var $K=14e3;function PK(t){let e=[],r=t.split(/(?=^diff --git )/m).filter(Boolean);for(let[o,n]of r.entries()){let i=MK(n);if(!i)continue;let s=n.split(/(?=^@@ )/m),a=s.shift()??"",c=s.filter(l=>l.startsWith("@@ "));if(c.length===0){e.push(TK({id:`chunk-${o}-0-0`,path:i,index:0,content:a.slice(0,$K)}));continue}let u=0;for(let[l,p]of c.entries()){let[f="",...d]=p.trimEnd().split(`
|
|
113
|
+
`),m=Bfe(f,d);for(let[g,y]of m.entries())e.push(TK({id:`chunk-${o}-${l}-${g}`,path:i,index:u,content:y})),u+=1}}return e}function NK(t,e){let r=t.split(/(?=^diff --git )/m).find(o=>MK(o)===e.filePath);if(!r)return!1;for(let o of r.split(/(?=^@@ )/m)){let n=o.split(`
|
|
114
|
+
`),s=n.shift()?.match(/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);if(!s)continue;let a=Number(s[1]),c=Number(s[2]);for(let u of n){if(u.startsWith(" ")){if(e.side==="left"&&e.line===a||e.side==="right"&&e.line===c)return!0;a+=1,c+=1;continue}if(u.startsWith("+")&&!u.startsWith("+++")){if(e.side==="right"&&e.line===c)return!0;c+=1;continue}if(u.startsWith("-")&&!u.startsWith("---")){if(e.side==="left"&&e.line===a)return!0;a+=1}}}return!1}function TK(t){let e=t.content.split(`
|
|
115
|
+
`);return Yl.parse({...t,header:e[0]??"",additions:e.filter(r=>r.startsWith("+")&&!r.startsWith("+++")).length,deletions:e.filter(r=>r.startsWith("-")&&!r.startsWith("---")).length})}function Bfe(t,e){let r=[],o=t;for(let n of e){if(o.length>t.length&&o.length+n.length+1>$K){r.push(o),o=`${t}
|
|
116
|
+
${n}`;continue}o+=`
|
|
117
|
+
${n}`}return r.push(o),r}function MK(t){let e=t.match(/^\+\+\+ b\/(.+)$/m)?.[1];if(e)return e;let r=t.match(/^--- a\/(.+)$/m)?.[1];return r||t.match(/^diff --git a\/(.+?) b\/(.+)$/m)?.[2]}import{spawn as Wfe}from"node:child_process";var Zfe=1024*1024*1024,Gfe=C.object({number:C.number().int().positive(),title:C.string(),body:C.string().nullable(),url:C.string(),headRefOid:C.string(),baseRefOid:C.string(),headRefName:C.string(),baseRefName:C.string(),author:C.object({login:C.string()}).nullable(),state:C.string(),isDraft:C.boolean()}),Vfe=C.object({filename:C.string(),previous_filename:C.string().optional(),status:C.string(),additions:C.number().int().nonnegative(),deletions:C.number().int().nonnegative()}),Kfe=C.object({id:C.number().int(),body:C.string(),path:C.string().nullable().optional(),line:C.number().int().positive().nullable().optional(),side:C.enum(["LEFT","RIGHT"]).nullable().optional(),created_at:C.string(),html_url:C.string().optional(),user:C.object({login:C.string()}).nullable().optional()});function DK(t){let e=t?.cwd??process.cwd();return{async loadPullRequest(r){let o=r.repository??await Jfe(e),[n,i,s]=await Promise.all([hd(["pr","view",String(r.number),"--repo",o,"--json","number,title,body,url,headRefOid,baseRefOid,headRefName,baseRefName,author,state,isDraft"],{cwd:e}),hd(iw(o,`repos/${sw(o)}/pulls/${r.number}`,"--header","Accept: application/vnd.github.v3.diff"),{cwd:e}),hd(iw(o,`repos/${sw(o)}/pulls/${r.number}/files?per_page=100`,"--paginate","--slurp"),{cwd:e})]),a=Gfe.parse(UN(n));return{pullRequest:oA.parse({repository:o,number:a.number,title:a.title,body:a.body??"",url:a.url,author:a.author?.login,headSha:a.headRefOid,baseSha:a.baseRefOid,headRef:a.headRefName,baseRef:a.baseRefName,state:a.state,isDraft:a.isDraft}),files:Yfe(s),diff:i}},async loadReviewComments(r){let o=await hd(iw(r.repository,`repos/${sw(r.repository)}/pulls/${r.number}/comments?per_page=100`,"--paginate","--slurp"),{cwd:e});return FK(o).map(n=>{let i=Kfe.parse(n);return UL.parse({id:i.id,author:i.user?.login??"ghost",body:i.body,filePath:i.path??void 0,line:i.line??void 0,side:i.side==="LEFT"?"left":i.side==="RIGHT"?"right":void 0,createdAt:i.created_at,url:i.html_url})})},async submitReview(r){let o=r.decision==="approve"?"APPROVE":r.decision==="request-changes"?"REQUEST_CHANGES":"COMMENT",n={commit_id:r.pullRequest.headSha,event:o,body:r.body,comments:r.comments.map(i=>({path:i.filePath,line:i.line,side:i.side.toUpperCase(),body:i.body}))};await hd(iw(r.pullRequest.repository,`repos/${sw(r.pullRequest.repository)}/pulls/${r.pullRequest.number}/reviews`,"--method","POST","--input","-"),{cwd:e,input:JSON.stringify(n)})}}}async function Jfe(t){let e=await hd(["repo","view","--json","nameWithOwner,url"],{cwd:t}),r=C.object({nameWithOwner:C.string(),url:C.string().url()}).parse(UN(e)),o=new URL(r.url).host;return o==="github.com"?r.nameWithOwner:`${o}/${r.nameWithOwner}`}function iw(t,e,...r){let{host:o}=cA(t);return["api",...o?["--hostname",o]:[],e,...r]}function sw(t){return cA(t).nameWithOwner}function Yfe(t){return FK(t).map(e=>{let r=Vfe.parse(e);return tA.parse({path:r.filename,previousPath:r.previous_filename,status:Xfe(r.status),additions:r.additions,deletions:r.deletions})})}function Xfe(t){return t==="added"?"added":t==="removed"?"removed":t==="renamed"?"renamed":"modified"}function FK(t){let e=UN(t);return C.array(C.array(C.unknown())).parse(e).flat()}function UN(t){try{return JSON.parse(t)}catch(e){throw new Error(`The GitHub CLI returned malformed JSON: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}function hd(t,e){return new Promise((r,o)=>{let n=Wfe("gh",t,{cwd:e.cwd,shell:!1,stdio:["pipe","pipe","pipe"]}),i=[],s=[],a=0,c=!1,u=l=>{c||(c=!0,l())};if(n.stdout.on("data",l=>{if(a+=l.length,a>Zfe){n.kill(),u(()=>o(new Error("The GitHub response exceeded the 1 GB in-memory PR limit.")));return}i.push(l)}),n.stderr.on("data",l=>s.push(l)),n.on("error",l=>{u(()=>{if(l.code==="ENOENT"){o(new Error("GitHub CLI (`gh`) is not installed or is not on your PATH."));return}o(l)})}),n.on("close",l=>{u(()=>{if(l===0){r(Buffer.concat(i).toString("utf8"));return}let p=Buffer.concat(s).toString("utf8").trim();o(new Error(p||`GitHub CLI exited with status ${l??"unknown"}.`))})}),e.input){n.stdin.end(e.input);return}n.stdin.end()})}var qN=class{#t=!0;#e;#r;#i;#n;#o;#a;#u;#l=0;#p=5;#c=!1;#d=!1;#s=null;#m=()=>{this.debugLog("Connected to event bus"),this.#o=!0,this.#c=!1,this.debugLog("Emitting queued events",this.#n),this.#n.forEach(t=>this.emitEventToBus(t)),this.#n=[],this.stopConnectLoop(),this.#r().removeEventListener("tanstack-connect-success",this.#m)};#f=()=>{if(this.#l<this.#p){this.#l++,this.dispatchCustomEvent("tanstack-connect",{});return}this.#r().removeEventListener("tanstack-connect",this.#f),this.#d=!0,this.debugLog("Max retries reached, giving up on connection"),this.stopConnectLoop()};#h=()=>{this.#c||(this.#c=!0,this.#r().addEventListener("tanstack-connect-success",this.#m),this.#f())};constructor({pluginId:t,debug:e=!1,enabled:r=!0,reconnectEveryMs:o=300}){this.#e=t,this.#t=r,this.#r=this.getGlobalTarget,this.#i=e,this.debugLog(" Initializing event subscription for plugin",this.#e),this.#n=[],this.#o=!1,this.#d=!1,this.#a=null,this.#u=o}startConnectLoop(){this.#a!==null||this.#o||(this.debugLog(`Starting connect loop (every ${this.#u}ms)`),this.#a=setInterval(this.#f,this.#u))}stopConnectLoop(){this.#c=!1,this.#a!==null&&(clearInterval(this.#a),this.#a=null,this.#n=[],this.debugLog("Stopped connect loop"))}debugLog(...t){this.#i&&console.log(`\u{1F334} [tanstack-devtools:${this.#e}-plugin]`,...t)}getGlobalTarget(){if(typeof globalThis<"u"&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog("Using global event target"),globalThis.__TANSTACK_EVENT_TARGET__;if(typeof window<"u"&&typeof window.addEventListener<"u")return this.debugLog("Using window as event target"),window;let t=typeof EventTarget<"u"?new EventTarget:void 0;return typeof t>"u"||typeof t.addEventListener>"u"?(this.debugLog("No event mechanism available, running in non-web environment"),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog("Using new EventTarget as fallback"),t)}getPluginId(){return this.#e}dispatchCustomEventShim(t,e){try{let r=new Event(t,{detail:e});this.#r().dispatchEvent(r)}catch{this.debugLog("Failed to dispatch shim event")}}dispatchCustomEvent(t,e){try{this.#r().dispatchEvent(new CustomEvent(t,{detail:e}))}catch{this.dispatchCustomEventShim(t,e)}}emitEventToBus(t){this.debugLog("Emitting event to client bus",t),this.dispatchCustomEvent("tanstack-dispatch-event",t)}createEventPayload(t,e){return{type:`${this.#e}:${t}`,payload:e,pluginId:this.#e}}emit(t,e){if(!this.#t){this.debugLog("Event bus client is disabled, not emitting event",t,e);return}if(this.#s&&(this.debugLog("Emitting event to internal event target",t,e),this.#s.dispatchEvent(new CustomEvent(`${this.#e}:${t}`,{detail:this.createEventPayload(t,e)}))),this.#d){this.debugLog("Previously failed to connect, not emitting to bus");return}if(!this.#o){this.debugLog("Bus not available, will be pushed as soon as connected"),this.#n.push(this.createEventPayload(t,e)),typeof CustomEvent<"u"&&!this.#c&&(this.#h(),this.startConnectLoop());return}return this.emitEventToBus(this.createEventPayload(t,e))}on(t,e,r){let o=r?.withEventTarget??!1,n=`${this.#e}:${t}`;if(o&&(this.#s||(this.#s=new EventTarget),this.#s.addEventListener(n,s=>{e(s.detail)})),!this.#t)return this.debugLog("Event bus client is disabled, not registering event",n),()=>{};let i=s=>{this.debugLog("Received event from bus",s.detail),e(s.detail)};return this.#r().addEventListener(n,i),this.debugLog("Registered event to bus",n),()=>{o&&this.#s?.removeEventListener(n,i),this.#r().removeEventListener(n,i)}}onAll(t){if(!this.#t)return this.debugLog("Event bus client is disabled, not registering event"),()=>{};let e=r=>{let o=r.detail;t(o)};return this.#r().addEventListener("tanstack-devtools-global",e),()=>this.#r().removeEventListener("tanstack-devtools-global",e)}onAllPluginEvents(t){if(!this.#t)return this.debugLog("Event bus client is disabled, not registering event"),()=>{};let e=r=>{let o=r.detail;this.#e&&o.pluginId!==this.#e||t(o)};return this.#r().addEventListener("tanstack-devtools-global",e),()=>this.#r().removeEventListener("tanstack-devtools-global",e)}};var Qfe=new Set(["TEXT_MESSAGE_CONTENT","TOOL_CALL_START","TOOL_CALL_ARGS","TOOL_CALL_END","TOOL_CALL_RESULT","RUN_FINISHED","RUN_ERROR","STEP_FINISHED"]);function eme(t){return Qfe.has(t.type)}var It=(...t)=>{try{Ft.emit(...t)}catch(e){console.error(`[ai-devtools] subscriber threw while handling "${String(t[0])}" event`,e)}};function is(t){return{requestId:t.requestId,streamId:t.streamId,runId:t.runId,threadId:t.threadId,provider:t.provider,model:t.model,clientId:t.conversationId,source:t.source,systemPrompts:t.systemPrompts.length>0?t.systemPrompts.map(e=>typeof e=="string"?e:e.content):void 0,toolNames:t.toolNames,options:t.options,modelOptions:t.modelOptions,messageCount:t.messageCount,hasTools:t.hasTools,streaming:t.streaming}}function tme(t){return typeof t=="string"?t:Array.isArray(t)&&t.map(e=>e&&typeof e=="object"&&e.type==="text"?String(e.content??""):"").join("")||""}function HN(){let t=null,e="",r=-1,o=0,n=new Map;return{name:"devtools",onStart(i){It("text:request:started",{...is(i),timestamp:Date.now()});let s=i.messages;(i.conversationId?s.slice(-1).filter(c=>c.role==="user"):s).forEach((c,u)=>{let l=i.conversationId?s.length-1:u,p=i.createId("msg"),f=is(i),d=tme(c.content);It("text:message:created",{...f,messageId:p,role:c.role,content:d,toolCalls:c.toolCalls,messageIndex:l,timestamp:Date.now()}),c.role==="user"&&It("text:message:user",{...f,messageId:p,role:"user",content:d,messageIndex:l,timestamp:Date.now()})})},onIteration(i,s){let a=Date.now();r>=0&&It("text:iteration:completed",{...is(i),iteration:r,messageId:t||void 0,duration:a-o,finishReason:"tool_calls",timestamp:a}),r=s.iteration,o=a,t=s.messageId,e="",It("text:iteration:started",{...is(i),iteration:s.iteration,messageId:s.messageId,timestamp:a}),It("text:message:created",{...is(i),messageId:s.messageId,role:"assistant",content:"",timestamp:a})},onChunk(i,s){if(!eme(s))return;let a=s,c=is(i);switch(a.type){case"TEXT_MESSAGE_CONTENT":{a.content?e=a.content:e+=a.delta,It("text:chunk:content",{...c,messageId:t||void 0,content:e,delta:a.delta,timestamp:Date.now()});break}case"TOOL_CALL_START":{let u=a.index??0,l=a.toolCallName;n.set(a.toolCallId,{toolName:l,index:u}),It("text:chunk:tool-call",{...c,messageId:t||void 0,toolCallId:a.toolCallId,toolName:l,index:u,arguments:"",timestamp:Date.now()});break}case"TOOL_CALL_ARGS":{let u=n.get(a.toolCallId);It("text:chunk:tool-call",{...c,messageId:t||void 0,toolCallId:a.toolCallId,toolName:u?.toolName??"",index:u?.index??0,arguments:a.delta,timestamp:Date.now()});break}case"TOOL_CALL_END":{n.delete(a.toolCallId),It("text:chunk:tool-result",{...c,messageId:t||void 0,toolCallId:a.toolCallId,result:a.result||"",timestamp:Date.now()});break}case"TOOL_CALL_RESULT":{It("text:chunk:tool-result",{...c,messageId:t||void 0,toolCallId:a.toolCallId,result:a.content||"",timestamp:Date.now()});break}case"RUN_FINISHED":{It("text:chunk:done",{...c,messageId:t||void 0,finishReason:a.finishReason??null,usage:a.usage,timestamp:Date.now()}),a.usage&&It("text:usage",{...c,messageId:t||void 0,usage:a.usage,timestamp:Date.now()});break}case"RUN_ERROR":{let u=a.message??a.error?.message??`[ai-devtools] RUN_ERROR chunk had no message; raw chunk: ${JSON.stringify(a)}`;It("text:chunk:error",{...c,messageId:t||void 0,error:u,timestamp:Date.now()});break}case"STEP_FINISHED":{(a.content||a.delta)&&It("text:chunk:thinking",{...c,messageId:t||void 0,content:a.content||"",delta:a.delta,timestamp:Date.now()});break}}},onToolPhaseComplete(i,s){let a=is(i);s.toolCalls.length>0&&It("text:message:created",{...a,messageId:t??i.createId("msg"),role:"assistant",content:e||"",toolCalls:s.toolCalls,timestamp:Date.now()});for(let c of s.needsApproval)It("tools:approval:requested",{...a,messageId:t||void 0,toolCallId:c.toolCallId,toolName:c.toolName,input:c.input,approvalId:c.approvalId,timestamp:Date.now()});for(let c of s.needsClientExecution)It("tools:input:available",{...a,messageId:t||void 0,toolCallId:c.toolCallId,toolName:c.toolName,input:c.input,timestamp:Date.now()});for(let c of s.results){It("tools:call:completed",{...a,messageId:t||void 0,toolCallId:c.toolCallId,toolName:c.toolName,result:c.result,duration:c.duration??0,timestamp:Date.now()});let u=JSON.stringify(c.result);It("text:message:created",{...a,messageId:i.createId("msg"),role:"tool",content:u,timestamp:Date.now()})}},onFinish(i,s){let a=Date.now();r>=0&&It("text:iteration:completed",{...is(i),iteration:r,messageId:t||void 0,duration:a-o,finishReason:s.finishReason||void 0,usage:s.usage,timestamp:a}),It("text:request:completed",{...is(i),content:s.content,messageId:t||void 0,finishReason:s.finishReason||void 0,usage:s.usage,duration:s.duration,timestamp:a})}}}var BN=class extends qN{constructor(){super({pluginId:"tanstack-ai-devtools"})}},zK=Symbol.for("tanstack.ai.devtools.eventClient");function rme(){let t=globalThis,e=t[zK];if(e)return e;let r=new BN;return t[zK]=r,r}var Ft=rme();function et(t){let e=Date.now(),r=Math.random().toString(36).substring(2);return`${t}-${e}-${r}`}function aw(t,e){if(t===null)return e?.widened?void 0:null;if(typeof t!="object"||!e)return t;if(Array.isArray(t)){let{items:n}=e;return n?Array.isArray(n)?t.map((i,s)=>aw(i,n[s])):t.map(i=>aw(i,n)):t}let{properties:r}=e;if(!r)return t;let o={};for(let[n,i]of Object.entries(t)){let s=aw(i,r[n]);s!==void 0&&(o[n]=s)}return o}function cw(t,e){return e?aw(t,e):t}function nme(t){if(t.type==="RUN_ERROR"&&"error"in t){let{error:e,...r}=t;return r}return t}function jK(){return{name:"strip-to-spec",onChunk(t,e){return nme(e)}}}var ome=new Set(["AbortError","APIUserAbortError","RequestAbortedError"]);function LK(t){if(typeof t=="string")return t;if(typeof t=="number"&&Number.isFinite(t))return String(t)}function vr(t,e="Unknown error occurred"){if(t&&typeof t=="object"){let r=t.name;if(typeof r=="string"&&ome.has(r))return{message:"Request aborted",code:"aborted"}}if(t instanceof Error){let r=t.code;return{message:t.message||e,code:LK(r)}}if(typeof t=="object"&&t!==null){let r=t.message,o=t.code;return{message:typeof r=="string"&&r.length>0?r:e,code:LK(o)}}return typeof t=="string"&&t.length>0?{message:t,code:void 0}:{message:e,code:void 0}}function ss(t){if(!t||typeof t!="object")return;let e=t;if(e.rawEvent!==void 0&&e.rawEvent!==null)return e.rawEvent;if(e.error!==void 0&&e.error!==null&&typeof e.error=="object")return e.error;if(e.metadata!==void 0&&e.metadata!==null)return e.metadata}async function UK(t){let e="";for await(let r of t)r.type==="TEXT_MESSAGE_CONTENT"&&r.delta&&(e+=r.delta);return e}var ime={depth:null,colors:!0};function sme(){try{if(globalThis.navigator?.userAgent==="Cloudflare-Workers")return"json"}catch{}return typeof process<"u"&&typeof process.versions?.node=="string"?"dir":"arg"}function ame(t){let e=new WeakSet;try{return JSON.stringify(t,(r,o)=>{if(typeof o=="bigint")return o.toString();if(o instanceof Error)return{name:o.name,message:o.message,stack:o.stack};if(typeof o=="object"&&o!==null){if(e.has(o))return"[Circular]";e.add(o)}return o},2)}catch{try{return String(t)}catch{return"[Unserializable meta]"}}}var lu=class{debug(e,r){this.emit("debug",e,r)}info(e,r){this.emit("info",e,r)}warn(e,r){this.emit("warn",e,r)}error(e,r){this.emit("error",e,r)}emit(e,r,o){if(o===void 0){console[e](r);return}switch(sme()){case"dir":console[e](r),console.dir(o,ime);break;case"json":console[e](`${r}
|
|
118
|
+
${ame(o)}`);break;case"arg":console[e](r,o);break}}};var cme={request:"\u{1F4E4}",provider:"\u{1F4E5}",output:"\u{1F4E8}",middleware:"\u{1F9E9}",tools:"\u{1F527}",agentLoop:"\u{1F501}",config:"\u2699\uFE0F",errors:"\u274C"},pu=class{constructor(e,r){this.logger=e,this.categories=r}logger;categories;isEnabled(e){return this.categories[e]}emit(e,r,o,n){if(!this.categories[r])return;let i=cme[r],s=`${i} [tanstack-ai:${r}] ${i} ${o}`;try{e==="error"?this.logger.error(s,n):this.logger.debug(s,n)}catch{}}provider(e,r){this.emit("debug","provider",e,r)}output(e,r){this.emit("debug","output",e,r)}middleware(e,r){this.emit("debug","middleware",e,r)}tools(e,r){this.emit("debug","tools",e,r)}agentLoop(e,r){this.emit("debug","agentLoop",e,r)}config(e,r){this.emit("debug","config",e,r)}errors(e,r){this.emit("error","errors",e,r)}request(e,r){this.emit("debug","request",e,r)}warn(e,r){if(!this.categories.errors)return;let o=`\u26A0\uFE0F [tanstack-ai:warn] \u26A0\uFE0F ${e}`;try{this.logger.warn(o,r)}catch{}}};var qK={provider:!1,output:!1,middleware:!1,tools:!1,agentLoop:!1,config:!1,errors:!1,request:!1},ume={provider:!0,output:!0,middleware:!0,tools:!0,agentLoop:!0,config:!0,errors:!0,request:!0},lme=()=>({...qK,errors:!0}),pme=t=>({provider:t.provider??!0,output:t.output??!0,middleware:t.middleware??!0,tools:t.tools??!0,agentLoop:t.agentLoop??!0,config:t.config??!0,errors:t.errors??!0,request:t.request??!0});function uw(t){if(t===void 0)return new pu(new lu,lme());if(t===!0)return new pu(new lu,ume);if(t===!1)return new pu(new lu,qK);let{logger:e,...r}=t,o=e??new lu;return new pu(o,pme(r))}var dme=new Set(["text","image","audio","video","document"]);function fme(t){if(typeof t!="object"||t===null)return!1;let e=t;if(typeof e.type!="string"||!dme.has(e.type))return!1;if(e.type==="text")return typeof e.content=="string";let r=e.source;if(typeof r!="object"||r===null)return!1;let o=r;return typeof o.value!="string"?!1:o.type==="data"?typeof o.mimeType=="string":o.type==="url"}function mme(t){return Array.isArray(t)&&t.length>0&&t.every(fme)}function gd(t){return typeof t=="string"||mme(t)?t:JSON.stringify(t)}function HK(t){let e={};for(let[r,o]of Object.entries(t))r!=="$schema"&&(e[r]=o);return e}function BK(t){return(typeof t=="object"||typeof t=="function")&&t!==null}function WK(t){if(!BK(t)||!("~standard"in t))return!1;let e=t["~standard"];return typeof e!="object"||e===null||!("version"in e)||e.version!==1||!("jsonSchema"in e)||typeof e.jsonSchema!="object"||e.jsonSchema===null||!("input"in e.jsonSchema)?!1:typeof e.jsonSchema.input=="function"}function mo(t){return BK(t)&&"~standard"in t&&typeof t["~standard"]=="object"&&t["~standard"]!==null&&"version"in t["~standard"]&&t["~standard"].version===1&&"validate"in t["~standard"]&&typeof t["~standard"].validate=="function"}function hme(t){return Object.keys(t).length>0?t:void 0}function Mg(t,e=[]){let r={...t},o={};if(r.type==="object"&&r.properties){let n={...r.properties},i=Object.keys(n),s={};for(let a of i){let c=n[a];if(!c)continue;let u=!e.includes(a),l=!1,p;if(c.type==="object"&&c.properties){let f=Mg(c,c.required||[]);n[a]=u?{...f.schema,type:["object","null"]}:f.schema,l=u,p=f.nullWidening}else if(c.type==="array"&&c.items){let f=Array.isArray(c.items)?c.items[0]:c.items,d=f?Mg(f,f.required||[]):void 0;n[a]={...c,items:d?d.schema:c.items,...u?{type:["array","null"]}:{}},l=u,p=d?.nullWidening?{items:d.nullWidening}:void 0}else u&&(c.type&&!Array.isArray(c.type)?(n[a]={...c,type:[c.type,"null"]},l=!0):Array.isArray(c.type)&&!c.type.includes("null")&&(n[a]={...c,type:[...c.type,"null"]},l=!0));(l||p)&&(s[a]={...p??{},...l?{widened:!0}:{}})}r.properties=n,r.required=i,r.additionalProperties=!1,Object.keys(s).length>0&&(o.properties=s)}if(r.type==="array"&&r.items){let n=Array.isArray(r.items)?r.items[0]:r.items;if(n){let i=Mg(n,n.required||[]);r.items=i.schema,i.nullWidening&&(o.items=i.nullWidening)}}return{schema:r,nullWidening:hme(o)}}function ZK(t){if(WK(t)){let e=t["~standard"].jsonSchema.input({target:"draft-07"}),r=HK(e);return"properties"in r&&!r.type&&(r.type="object"),r.type==="object"&&!("properties"in r)&&(r.properties={}),r.type==="object"&&!("required"in r)&&(r.required=[]),r}if(mo(t))throw new Error("Schema is a Standard Schema validator but does not expose a JSON Schema converter on `~standard.jsonSchema`. Use Zod v4.2+, ArkType v2.1.28+, or wrap a Valibot schema with `toStandardJsonSchema()` from `@valibot/to-json-schema` before passing it as `outputSchema`.");return typeof t!="object"?t:HK(t)}function Dg(t,e={}){if(!t)return;let{forStructuredOutput:r=!1}=e;if(!r&&!WK(t)&&!mo(t))return t;let o=ZK(t);return!o||typeof o!="object"||!r?o:Mg(o,o.required||[]).schema}function ZN(t){if(!t)return{jsonSchema:void 0,nullWideningMap:void 0};let e=ZK(t);if(!e||typeof e!="object")return{jsonSchema:e,nullWideningMap:void 0};let{schema:r,nullWidening:o}=Mg(e,e.required||[]);return{jsonSchema:r,nullWideningMap:o}}var WN=class extends Error{name="StandardSchemaValidationError";issues;constructor(e){super(`Validation failed: ${e.map(r=>r.message||"Validation failed").join(", ")}`),this.issues=e}};function va(t,e){if(!mo(t))return e;let r=t["~standard"].validate(e);if(r instanceof Promise)throw new Error("Schema validation returned a Promise. Use validateWithStandardSchema for async validation.");if(!r.issues)return r.value;throw new WN(r.issues)}function gme(t){let e=t.trim();if(!e)return"";let r=e.match(/^.*?[.!?](?=\s|$)/);return(r?r[0]:e).trim()}function GK(t,e,r="none"){if(r==="none"||!e.trim())return t;let o=r==="first-sentence"?gme(e):e.trim();return o?`${t} \u2014 ${o}`:t}var Fg="__lazy__tool__discovery__",lw=class{eagerTools;lazyToolMap;discoveredTools;hasNewDiscoveries;discoveryTool;lazyToolsConfig;constructor(e,r,o={}){this.lazyToolsConfig=o;let n=[];this.lazyToolMap=new Map,this.discoveredTools=new Set,this.hasNewDiscoveries=!1;for(let i of e)i.lazy?this.lazyToolMap.set(i.name,i):n.push(i);if(this.eagerTools=n,this.lazyToolMap.size===0){this.discoveryTool=null;return}this.scanMessageHistory(r),this.discoveryTool=this.createDiscoveryTool()}getActiveTools(){this.hasNewDiscoveries=!1;let e=[...this.eagerTools];for(let r of this.discoveredTools){let o=this.lazyToolMap.get(r);o&&e.push(o)}return this.discoveryTool&&this.discoveredTools.size<this.lazyToolMap.size&&e.push(this.discoveryTool),e}getExecutableTools(e,r){return this.discoveryTool&&r.includes(Fg)&&!e.some(o=>o.name===Fg)?[...e,this.discoveryTool]:e}hasNewlyDiscoveredTools(){return this.hasNewDiscoveries}isUndiscoveredLazyTool(e){return this.lazyToolMap.has(e)&&!this.discoveredTools.has(e)}getUndiscoveredToolError(e){return`Error: Tool '${e}' must be discovered first. Call ${Fg} with toolNames: ['${e}'] to discover it.`}scanMessageHistory(e){let r=new Set;for(let o of e)if(o.role==="assistant"&&o.toolCalls)for(let n of o.toolCalls)n.function.name===Fg&&r.add(n.id);if(r.size!==0){for(let o of e)if(o.role==="tool"&&o.toolCallId&&r.has(o.toolCallId))try{let n=typeof o.content=="string"?o.content:JSON.stringify(o.content),i=JSON.parse(n);if(i&&Array.isArray(i.tools))for(let s of i.tools)s&&typeof s.name=="string"&&this.lazyToolMap.has(s.name)&&this.discoveredTools.add(s.name)}catch{}}}createDiscoveryTool(){let e=()=>{let a=[];for(let[c]of this.lazyToolMap)this.discoveredTools.has(c)||a.push(c);return a},r=this.lazyToolMap,o=this.lazyToolsConfig.includeDescription??"none",i=`You have access to additional tools that can be discovered. Available tools: [${Array.from(this.lazyToolMap.values()).map(a=>GK(a.name,a.description,o)).join(", ")}]. Call this tool with a list of tool names to discover their full descriptions and argument schemas before using them.`,s=this;return{name:Fg,description:i,inputSchema:{type:"object",properties:{toolNames:{type:"array",items:{type:"string"},description:"List of tool names to discover. Each name must match one of the available tools."}},required:["toolNames"]},execute:a=>{let c=[],u=[];for(let p of a.toolNames){let f=r.get(p);if(f){s.discoveredTools.has(p)||(s.discoveredTools.add(p),s.hasNewDiscoveries=!0);let d=f.inputSchema?Dg(f.inputSchema):void 0;c.push({name:f.name,description:f.description,...d?{inputSchema:d}:{}})}else u.push(`Unknown tool: '${p}'. Available tools: [${e().join(", ")}]`)}let l={tools:c};return u.length>0&&(l.errors=u),l}}}};function GN(t){try{return JSON.parse(t)}catch{return t}}function yme(t){return t.metadata?.mcp}async function xme(t,e){let r=yme(t),o=r?.uiResourceUri;if(!o||!r.readResource)return;let n;try{n=(await r.readResource(o)).contents.find(s=>s.uri===o)}catch(i){console.warn(`[mcp-apps] failed to read ui resource ${o}:`,i);return}if(!n){console.warn(`[mcp-apps] ui resource ${o} returned no content matching that uri; not emitting`);return}e.emitCustomEvent("ui-resource",{resource:{uri:n.uri,mimeType:n.mimeType??"text/html",text:n.text,blob:n.blob},serverId:r.serverId,toolName:r.serverToolName??t.name,meta:void 0})}var du=class extends Error{constructor(e){super(e),this.name="MiddlewareAbortError"}},zg=class{toolCallsMap=new Map;tools;constructor(e){this.tools=e}addToolCallStartEvent(e){let r=e.index??this.toolCallsMap.size,o=e,n=o.toolCallName??o.toolName;this.toolCallsMap.set(r,{id:e.toolCallId,type:"function",function:{name:n,arguments:""},...e.metadata!==void 0&&{metadata:e.metadata}})}addToolCallArgsEvent(e){for(let[,r]of this.toolCallsMap.entries())if(r.id===e.toolCallId){r.function.arguments+=e.delta;break}}completeToolCall(e){for(let[,r]of this.toolCallsMap.entries())if(r.id===e.toolCallId){if(e.input!==void 0){let o=e.input&&typeof e.input=="object"?e.input:{};r.function.arguments=JSON.stringify(o)}break}}hasToolCalls(){return this.getToolCalls().length>0}getToolCalls(){return Array.from(this.toolCallsMap.values()).filter(e=>e.id&&e.function.name&&e.function.name.trim().length>0)}async*executeTools(e,...r){let o=this.getToolCalls(),n=[],i=r.length>0,s=r[0];for(let a of o){let c=this.tools.find(p=>p.name===a.function.name),u,l;if(c?.execute)try{let p;try{let m=a.function.arguments.trim()||"{}",g=JSON.parse(m);p=g&&typeof g=="object"?g:{}}catch{throw new Error(`Failed to parse tool arguments as JSON: ${a.function.arguments}`)}if(c.inputSchema&&mo(c.inputSchema))try{p=va(c.inputSchema,p)}catch(m){let g=m instanceof Error?m.message:"Validation failed";throw new Error(`Input validation failed for tool ${c.name}: ${g}`)}let f={toolCallId:a.id,context:s,emitCustomEvent:()=>{}},d=i?await c.execute(p,f):await c.execute(p);if(c.outputSchema&&mo(c.outputSchema))try{d=va(c.outputSchema,d)}catch(m){let g=m instanceof Error?m.message:"Validation failed";throw new Error(`Output validation failed for tool ${c.name}: ${g}`)}u=gd(d)}catch(p){u=`Error executing tool: ${p instanceof Error?p.message:"Unknown error"}`,l="output-error"}else u=`Tool ${a.function.name} does not have an execute function`;yield{type:"TOOL_CALL_END",toolCallId:a.id,toolCallName:a.function.name,toolName:a.function.name,model:e.model,timestamp:Date.now(),result:u,...l!==void 0&&{state:l}},n.push({role:"tool",content:u,toolCallId:a.id})}return n}clear(){this.toolCallsMap.clear()}};async function*_me(t,e){let r={done:!1,result:void 0},o=t.then(i=>(r.done=!0,r.result=i,i));for(;!r.done;){await Promise.race([o,new Promise(s=>setTimeout(s,10))]);let i;for(;(i=e.shift())!==void 0;)yield i}let n;for(;(n=e.shift())!==void 0;)yield n;return r.result}async function VK(t,e,r,o,n,i){if(!n.onBeforeToolCall)return{proceed:!0,input:r};let s=await n.onBeforeToolCall(t,e,r);if(!s)return{proceed:!0,input:r};if(s.type==="abort")throw new du(s.reason||"Aborted by middleware");if(s.type==="skip"){let a=s.result;return i.push({toolCallId:t.id,toolName:o,result:typeof a=="string"?GN(a):a??null,duration:0}),n.onAfterToolCall&&await n.onAfterToolCall({toolCall:t,tool:e,toolName:o,toolCallId:t.id,ok:!0,duration:0,result:a}),{proceed:!1}}return{proceed:!0,input:s.args}}async function*KK(t,e,r,o,n,i,s,a){let c=Date.now();try{if(!e.execute)throw new Error(`Tool ${r} has no execute() implementation`);let u=Promise.resolve(e.execute(o,n)),l=yield*_me(u,i),p=Date.now()-c;await xme(e,n);let f;for(;(f=i.shift())!==void 0;)yield f;e.outputSchema&&mo(e.outputSchema)&&(l=va(e.outputSchema,l));let d=typeof l=="string"?GN(l):l??null;s.push({toolCallId:t.id,toolName:r,result:d,duration:p}),a?.onAfterToolCall&&await a.onAfterToolCall({toolCall:t,tool:e,toolName:r,toolCallId:t.id,ok:!0,duration:p,result:d})}catch(u){let l=Date.now()-c,p;for(;(p=i.shift())!==void 0;)yield p;if(u instanceof du)throw u;let f=u instanceof Error?u.message:"Unknown error";s.push({toolCallId:t.id,toolName:r,result:{error:f},state:"output-error",duration:l}),a?.onAfterToolCall&&await a.onAfterToolCall({toolCall:t,tool:e,toolName:r,toolCallId:t.id,ok:!1,duration:l,error:u})}}function JK(t,e,r,o){try{let n=o;return r.outputSchema&&mo(r.outputSchema)&&(n=va(r.outputSchema,n)),{toolCallId:t,toolName:e,result:typeof n=="string"?GN(n):n??null}}catch(n){let i=n instanceof Error?n.message:"Validation failed";return{toolCallId:t,toolName:e,result:{error:i},state:"output-error"}}}async function*VN(t,e,r=new Map,o=new Map,n,i,s,a){let c=[],u=[],l=[],p=new Map;for(let d of e)p.set(d.name,d);let f=t.some(d=>p.get(d.function.name)?.needsApproval&&!r.has(`approval_${d.id}`));for(let d of t){let m=p.get(d.function.name),g=d.function.name;if(!m){c.push({toolCallId:d.id,toolName:g,result:{error:`Unknown tool: ${g}`},state:"output-error"});continue}if(f&&(!m.needsApproval||r.has(`approval_${d.id}`)))continue;let y={},v=d.function.arguments.trim()||"{}";try{let S=JSON.parse(v);y=S&&typeof S=="object"?S:{}}catch{throw new Error(`Failed to parse tool arguments as JSON: ${v}`)}if(m.inputSchema&&mo(m.inputSchema))try{y=va(m.inputSchema,y)}catch(S){let P=S instanceof Error?S.message:"Validation failed";c.push({toolCallId:d.id,toolName:g,result:{error:`Input validation failed for tool ${m.name}: ${P}`},state:"output-error"});continue}let E=[],R={toolCallId:d.id,context:s,abortSignal:a,emitCustomEvent:(S,P)=>{n&&E.push(n(S,{...P,toolCallId:d.id}))}};if(!m.execute){if(m.needsApproval){let S=`approval_${d.id}`;r.has(S)?r.get(S)?o.has(d.id)?c.push(JK(d.id,g,m,o.get(d.id))):l.push({toolCallId:d.id,toolName:g,input:y}):c.push({toolCallId:d.id,toolName:g,result:{error:"User declined tool execution"},state:"output-error"}):u.push({toolCallId:d.id,toolName:d.function.name,input:y,approvalId:S})}else o.has(d.id)?c.push(JK(d.id,g,m,o.get(d.id))):l.push({toolCallId:d.id,toolName:g,input:y});continue}if(m.needsApproval){let S=`approval_${d.id}`;if(r.has(S))if(r.get(S)){if(i){let D=await VK(d,m,y,g,i,c);if(!D.proceed)continue;y=D.input}yield*KK(d,m,g,y,R,E,c,i)}else c.push({toolCallId:d.id,toolName:g,result:{error:"User declined tool execution"},state:"output-error"});else u.push({toolCallId:d.id,toolName:g,input:y,approvalId:S});continue}if(i){let S=await VK(d,m,y,g,i,c);if(!S.proceed)continue;y=S.input}yield*KK(d,m,g,y,R,E,c,i)}return{results:c,needsApproval:u,needsClientExecution:l}}function yd(t){return({iterationCount:e})=>e<t}function bme(t){return t.type==="text"||t.type==="image"||t.type==="audio"||t.type==="video"||t.type==="document"}function vme(t){try{return JSON.stringify(t)}catch{return""}}function XK(t){return t.length===0?null:t.every(r=>r.type==="text")?t.map(o=>o.content).join("")||null:t}function QK(t){let e=new Set;for(let o of t)if("parts"in o)for(let n of o.parts)n.type==="tool-result"&&e.add(n.toolCallId);let r=[];for(let o of t){if("parts"in o){r.push(...Sme(o));continue}let n=o.role;if(!(n==="tool"&&o.toolCallId&&e.has(o.toolCallId))&&!(n==="reasoning"||n==="activity")){if(n==="developer"){r.push({role:"system",content:o.content});continue}r.push(o)}}return r}function Sme(t){return t.role==="system"?[]:t.role!=="assistant"?[wme(t)]:kme(t)}function wme(t){let e=[];for(let r of t.parts)bme(r)&&e.push(r);return{role:t.role,content:XK(e)}}function YK(){return{contentParts:[],toolCalls:[]}}function Eme(t){return t.state==="input-complete"||t.state==="complete"||t.state==="approval-responded"||t.state==="error"||t.output!==void 0}function kme(t){let e=[],r=YK(),o=[],n=new Set;function i(){let s=XK(r.contentParts),a=s!==null,c=r.toolCalls.length>0;(a||c)&&(e.push({role:"assistant",content:s,...c&&{toolCalls:r.toolCalls},...o.length>0&&{thinking:o}}),o=[]),r=YK()}for(let s of t.parts)switch(s.type){case"text":case"image":case"audio":case"video":case"document":r.contentParts.push(s);break;case"tool-call":Eme(s)&&r.toolCalls.push({id:s.id,type:"function",function:{name:s.name,arguments:s.arguments},...s.metadata!==void 0&&{metadata:s.metadata}});break;case"tool-result":i(),(s.state==="complete"||s.state==="error")&&!n.has(s.toolCallId)&&(e.push({role:"tool",content:s.content,toolCallId:s.toolCallId}),n.add(s.toolCallId));break;case"thinking":s.content&&o.push({content:s.content,...s.signature&&{signature:s.signature}});break;case"structured-output":if(s.status==="complete"){let a=s.raw!==""?s.raw:s.data!==void 0?vme(s.data):"";a!==""&&r.contentParts.push({type:"text",content:a})}break}i();for(let s of t.parts)if(s.type==="tool-call"&&(s.output!==void 0&&!n.has(s.id)&&(e.push({role:"tool",content:gd(s.output),toolCallId:s.id}),n.add(s.id)),s.output===void 0&&s.state==="approval-responded"&&s.approval?.approved!==void 0&&!n.has(s.id))){let a=s.approval.approved;e.push({role:"tool",content:JSON.stringify({approved:a,...a&&{pendingExecution:!0},message:a?"User approved this action":"User denied this action"}),toolCallId:s.id}),n.add(s.id)}return e.length===0&&e.push({role:"assistant",content:null}),e}function pw(){return`msg-${Date.now()}-${Math.random().toString(36).substring(7)}`}function En(t){return t.name==="devtools"||t.name==="strip-to-spec"}function Lr(t){return{requestId:t.requestId,streamId:t.streamId,clientId:t.threadId,timestamp:Date.now()}}var dw=class{middlewares;logger;constructor(e,r){this.middlewares=e,this.logger=r}get hasMiddleware(){return this.middlewares.length>0}async runOnConfig(e,r){let o=r;for(let n of this.middlewares)if(n.onConfig){let i=En(n),s=Date.now(),a=await n.onConfig(e,o),c=a!=null;if(c&&(o={...o,...a},i||this.logger.config(`middleware=${n.name??"unnamed"} keys=${Object.keys(a).join(",")}`,{middleware:n.name??"unnamed",changes:a})),!i){let u=Lr(e);Ft.emit("middleware:hook:executed",{...u,middlewareName:n.name||"unnamed",hookName:"onConfig",iteration:e.iteration,duration:Date.now()-s,hasTransform:c}),c&&Ft.emit("middleware:config:transformed",{...u,middlewareName:n.name||"unnamed",iteration:e.iteration,changes:a})}}return o}async runOnStructuredOutputConfig(e,r){let o=r;for(let n of this.middlewares)if(n.onStructuredOutputConfig){let i=En(n),s=Date.now(),a=await n.onStructuredOutputConfig(e,o),c=a!=null;if(c&&(o={...o,...a},i||this.logger.config(`middleware=${n.name??"unnamed"} keys=${Object.keys(a).join(",")}`,{middleware:n.name??"unnamed",changes:a})),!i){let u=Lr(e);Ft.emit("middleware:hook:executed",{...u,middlewareName:n.name||"unnamed",hookName:"onStructuredOutputConfig",iteration:e.iteration,duration:Date.now()-s,hasTransform:c}),c&&Ft.emit("middleware:config:transformed",{...u,middlewareName:n.name||"unnamed",iteration:e.iteration,changes:Object.fromEntries(Object.entries(a))})}}return o}async runSetup(e){e.capabilities.setOnDuplicate(r=>{this.logger.warn(`capability "${r}" was provided more than once; last provider wins`,{capability:r})});for(let r of this.middlewares)if(r.setup){let o=En(r),n=Date.now();await r.setup(e),o||(this.logger.middleware(`hook=setup middleware=${r.name??"unnamed"}`,{middleware:r.name??"unnamed",hook:"setup"}),Ft.emit("middleware:hook:executed",{...Lr(e),middlewareName:r.name||"unnamed",hookName:"setup",iteration:e.iteration,duration:Date.now()-n,hasTransform:!1}))}for(let r of this.middlewares)for(let o of r.provides??[])if(!e.capabilities.has(o))throw new Error(`Middleware "${r.name??"unnamed"}" declares it provides "${o.capabilityName}" but never called provide() in setup().`)}async runOnStart(e){for(let r of this.middlewares)if(r.onStart){let o=En(r),n=Date.now();await r.onStart(e),o||(this.logger.middleware(`hook=onStart middleware=${r.name??"unnamed"}`,{middleware:r.name??"unnamed",hook:"onStart"}),Ft.emit("middleware:hook:executed",{...Lr(e),middlewareName:r.name||"unnamed",hookName:"onStart",iteration:e.iteration,duration:Date.now()-n,hasTransform:!1}))}}async runOnChunk(e,r){let o=[r];for(let n of this.middlewares){if(!n.onChunk)continue;let i=En(n),s=[];for(let a of o){let c=a.type;i||this.logger.middleware(`hook=onChunk middleware=${n.name??"unnamed"} in=${c}`,{middleware:n.name??"unnamed",hook:"onChunk",in:a});let u=await n.onChunk(e,a);if(u===null){i||(this.logger.middleware(`hook=onChunk middleware=${n.name??"unnamed"} in=${c} out=<dropped>`,{middleware:n.name??"unnamed",hook:"onChunk",dropped:!0}),Ft.emit("middleware:chunk:transformed",{...Lr(e),middlewareName:n.name||"unnamed",originalChunkType:c,resultCount:0,wasDropped:!0}));continue}else u===void 0?s.push(a):Array.isArray(u)?(s.push(...u),i||(this.logger.middleware(`hook=onChunk middleware=${n.name??"unnamed"} in=${c} out=[${u.map(l=>l.type).join(",")}]`,{middleware:n.name??"unnamed",hook:"onChunk",in:a,out:u}),Ft.emit("middleware:chunk:transformed",{...Lr(e),middlewareName:n.name||"unnamed",originalChunkType:c,resultCount:u.length,wasDropped:!1}))):(s.push(u),i||(this.logger.middleware(`hook=onChunk middleware=${n.name??"unnamed"} in=${c} out=${u.type}`,{middleware:n.name??"unnamed",hook:"onChunk",in:a,out:u}),Ft.emit("middleware:chunk:transformed",{...Lr(e),middlewareName:n.name||"unnamed",originalChunkType:c,resultCount:1,wasDropped:!1})))}o=s}return o}async runOnBeforeToolCall(e,r){for(let o of this.middlewares)if(o.onBeforeToolCall){let n=En(o),i=Date.now(),s=await o.onBeforeToolCall(e,r),a=s!=null;if(n||(this.logger.middleware(`hook=onBeforeToolCall middleware=${o.name??"unnamed"}`,{middleware:o.name??"unnamed",hook:"onBeforeToolCall"}),Ft.emit("middleware:hook:executed",{...Lr(e),middlewareName:o.name||"unnamed",hookName:"onBeforeToolCall",iteration:e.iteration,duration:Date.now()-i,hasTransform:a})),a)return s}}async runOnAfterToolCall(e,r){for(let o of this.middlewares)if(o.onAfterToolCall){let n=En(o),i=Date.now();await o.onAfterToolCall(e,r),n||(this.logger.middleware(`hook=onAfterToolCall middleware=${o.name??"unnamed"}`,{middleware:o.name??"unnamed",hook:"onAfterToolCall"}),Ft.emit("middleware:hook:executed",{...Lr(e),middlewareName:o.name||"unnamed",hookName:"onAfterToolCall",iteration:e.iteration,duration:Date.now()-i,hasTransform:!1}))}}async runOnUsage(e,r){for(let o of this.middlewares)if(o.onUsage){let n=En(o),i=Date.now();await o.onUsage(e,r),n||(this.logger.middleware(`hook=onUsage middleware=${o.name??"unnamed"}`,{middleware:o.name??"unnamed",hook:"onUsage"}),Ft.emit("middleware:hook:executed",{...Lr(e),middlewareName:o.name||"unnamed",hookName:"onUsage",iteration:e.iteration,duration:Date.now()-i,hasTransform:!1}))}}async runOnFinish(e,r){for(let o of this.middlewares)if(o.onFinish){let n=En(o),i=Date.now();await o.onFinish(e,r),n||(this.logger.middleware(`hook=onFinish middleware=${o.name??"unnamed"}`,{middleware:o.name??"unnamed",hook:"onFinish"}),Ft.emit("middleware:hook:executed",{...Lr(e),middlewareName:o.name||"unnamed",hookName:"onFinish",iteration:e.iteration,duration:Date.now()-i,hasTransform:!1}))}}async runOnAbort(e,r){for(let o of this.middlewares)if(o.onAbort){let n=En(o),i=Date.now();await o.onAbort(e,r),n||(this.logger.middleware(`hook=onAbort middleware=${o.name??"unnamed"}`,{middleware:o.name??"unnamed",hook:"onAbort"}),Ft.emit("middleware:hook:executed",{...Lr(e),middlewareName:o.name||"unnamed",hookName:"onAbort",iteration:e.iteration,duration:Date.now()-i,hasTransform:!1}))}}async runOnError(e,r){for(let o of this.middlewares)if(o.onError){let n=En(o),i=Date.now();await o.onError(e,r),n||(this.logger.middleware(`hook=onError middleware=${o.name??"unnamed"}`,{middleware:o.name??"unnamed",hook:"onError"}),Ft.emit("middleware:hook:executed",{...Lr(e),middlewareName:o.name||"unnamed",hookName:"onError",iteration:e.iteration,duration:Date.now()-i,hasTransform:!1}))}}async runOnIteration(e,r){for(let o of this.middlewares)if(o.onIteration){let n=En(o),i=Date.now();await o.onIteration(e,r),n||(this.logger.middleware(`hook=onIteration middleware=${o.name??"unnamed"}`,{middleware:o.name??"unnamed",hook:"onIteration"}),Ft.emit("middleware:hook:executed",{...Lr(e),middlewareName:o.name||"unnamed",hookName:"onIteration",iteration:e.iteration,duration:Date.now()-i,hasTransform:!1}))}}async runOnToolPhaseComplete(e,r){for(let o of this.middlewares)if(o.onToolPhaseComplete){let n=En(o),i=Date.now();await o.onToolPhaseComplete(e,r),n||(this.logger.middleware(`hook=onToolPhaseComplete middleware=${o.name??"unnamed"}`,{middleware:o.name??"unnamed",hook:"onToolPhaseComplete"}),Ft.emit("middleware:hook:executed",{...Lr(e),middlewareName:o.name||"unnamed",hookName:"onToolPhaseComplete",iteration:e.iteration,duration:Date.now()-i,hasTransform:!1}))}}};var fw=class{provided=new Set;onDuplicate;setOnDuplicate(e){this.onDuplicate=e}markProvided(e){this.provided.has(e)&&this.onDuplicate?.(e.capabilityName),this.provided.add(e)}has(e){return this.provided.has(e)}};function eJ(t,e){let r=new Set;for(let n of t)for(let i of n.provides??[])r.add(i);let o=()=>{let n=[...r].map(i=>i.capabilityName);return n.length?n.join(", "):"none"};for(let n of e.requires??[])if(!r.has(n))throw new Error(`Adapter "${e.name}" requires capability "${n.capabilityName}". Provided capabilities: ${o()}. Add a middleware that provides "${n.capabilityName}".`);for(let n of t)for(let i of n.requires??[])if(!r.has(i))throw new Error(`Middleware "${n.name??"unnamed"}" requires capability "${i.capabilityName}". Provided capabilities: ${o()}. Add a middleware that provides "${i.capabilityName}".`)}function Ime(t,e){if(!e.readResource)return;let r=t.metadata?.mcp;r?.uiResourceUri&&(r.readResource=e.readResource.bind(e))}var KN=class extends Error{constructor(e){super(`Duplicate MCP tool name "${e}" in chat({ mcp.clients }). Set a unique \`prefix\` on one of the MCP clients (or use a pool, which auto-prefixes) to disambiguate.`),this.toolName=e,this.name="MCPDuplicateToolNameError"}toolName},xd=class t{static from(e){return new t(e)}#t;#e;#r;#i;constructor(e){this.#t=e?.clients??[],this.#e=e?e.connection!=="keep-alive":!1,this.#r=e?.lazyTools??!1,this.#i=e?.onDiscoveryError}async discover(){if(this.#t.length===0)return[];try{let e=await Promise.allSettled(this.#t.map(i=>i.tools({lazy:this.#r}))),r=[],o=this.#t.map((i,s)=>[i,e[s]]);for(let[i,s]of o)if(s!==void 0)if(s.status==="fulfilled")for(let a of s.value)Ime(a,i),r.push(a);else if(this.#i)await this.#i(s.reason,i);else throw s.reason;let n=new Set;for(let i of r){if(n.has(i.name))throw new KN(i.name);n.add(i.name)}return r}catch(e){throw await this.dispose(),e}}async dispose(){!this.#e||this.#t.length===0||await Promise.allSettled(this.#t.map(e=>e.close()))}};var x={};an(x,{BRAND:()=>Xme,DIRTY:()=>fu,EMPTY_PATH:()=>Ame,INVALID:()=>fe,NEVER:()=>Dhe,OK:()=>Sr,ParseStatus:()=>ar,Schema:()=>Te,ZodAny:()=>Ea,ZodArray:()=>ls,ZodBigInt:()=>hu,ZodBoolean:()=>gu,ZodBranded:()=>Lg,ZodCatch:()=>Ou,ZodDate:()=>yu,ZodDefault:()=>Iu,ZodDiscriminatedUnion:()=>gw,ZodEffects:()=>Yn,ZodEnum:()=>Eu,ZodError:()=>nn,ZodFirstPartyTypeKind:()=>me,ZodFunction:()=>xw,ZodIntersection:()=>vu,ZodIssueCode:()=>H,ZodLazy:()=>Su,ZodLiteral:()=>wu,ZodMap:()=>Ed,ZodNaN:()=>Id,ZodNativeEnum:()=>ku,ZodNever:()=>ho,ZodNull:()=>_u,ZodNullable:()=>oi,ZodNumber:()=>mu,ZodObject:()=>on,ZodOptional:()=>Kn,ZodParsedType:()=>ne,ZodPipeline:()=>Ug,ZodPromise:()=>ka,ZodReadonly:()=>Cu,ZodRecord:()=>yw,ZodSchema:()=>Te,ZodSet:()=>kd,ZodString:()=>wa,ZodSymbol:()=>Sd,ZodTransformer:()=>Yn,ZodTuple:()=>ni,ZodType:()=>Te,ZodUndefined:()=>xu,ZodUnion:()=>bu,ZodUnknown:()=>us,ZodVoid:()=>wd,addIssueToContext:()=>ee,any:()=>ahe,array:()=>phe,bigint:()=>rhe,boolean:()=>pJ,coerce:()=>Mhe,custom:()=>cJ,date:()=>nhe,datetimeRegex:()=>sJ,defaultErrorMap:()=>as,discriminatedUnion:()=>hhe,effect:()=>Ohe,enum:()=>Ehe,function:()=>vhe,getErrorMap:()=>_d,getParsedType:()=>ri,instanceof:()=>ehe,intersection:()=>ghe,isAborted:()=>mw,isAsync:()=>bd,isDirty:()=>hw,isValid:()=>Sa,late:()=>Qme,lazy:()=>She,literal:()=>whe,makeIssue:()=>jg,map:()=>_he,nan:()=>the,nativeEnum:()=>khe,never:()=>uhe,null:()=>she,nullable:()=>Rhe,number:()=>lJ,object:()=>dhe,objectUtil:()=>JN,oboolean:()=>Nhe,onumber:()=>Phe,optional:()=>Che,ostring:()=>$he,pipeline:()=>The,preprocess:()=>Ahe,promise:()=>Ihe,quotelessJson:()=>Ome,record:()=>xhe,set:()=>bhe,setErrorMap:()=>Rme,strictObject:()=>fhe,string:()=>uJ,symbol:()=>ohe,transformer:()=>Ohe,tuple:()=>yhe,undefined:()=>ihe,union:()=>mhe,unknown:()=>che,util:()=>Ne,void:()=>lhe});var Ne;(function(t){t.assertEqual=n=>{};function e(n){}t.assertIs=e;function r(n){throw new Error}t.assertNever=r,t.arrayToEnum=n=>{let i={};for(let s of n)i[s]=s;return i},t.getValidEnumValues=n=>{let i=t.objectKeys(n).filter(a=>typeof n[n[a]]!="number"),s={};for(let a of i)s[a]=n[a];return t.objectValues(s)},t.objectValues=n=>t.objectKeys(n).map(function(i){return n[i]}),t.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let i=[];for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&i.push(s);return i},t.find=(n,i)=>{for(let s of n)if(i(s))return s},t.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function o(n,i=" | "){return n.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}t.joinValues=o,t.jsonStringifyReplacer=(n,i)=>typeof i=="bigint"?i.toString():i})(Ne||(Ne={}));var JN;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(JN||(JN={}));var ne=Ne.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ri=t=>{switch(typeof t){case"undefined":return ne.undefined;case"string":return ne.string;case"number":return Number.isNaN(t)?ne.nan:ne.number;case"boolean":return ne.boolean;case"function":return ne.function;case"bigint":return ne.bigint;case"symbol":return ne.symbol;case"object":return Array.isArray(t)?ne.array:t===null?ne.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ne.promise:typeof Map<"u"&&t instanceof Map?ne.map:typeof Set<"u"&&t instanceof Set?ne.set:typeof Date<"u"&&t instanceof Date?ne.date:ne.object;default:return ne.unknown}};var H=Ne.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Ome=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),nn=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=o=>{this.issues=[...this.issues,o]},this.addIssues=(o=[])=>{this.issues=[...this.issues,...o]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},o={_errors:[]},n=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(n);else if(s.code==="invalid_return_type")n(s.returnTypeError);else if(s.code==="invalid_arguments")n(s.argumentsError);else if(s.path.length===0)o._errors.push(r(s));else{let a=o,c=0;for(;c<s.path.length;){let u=s.path[c];c===s.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(s))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return n(this),o}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ne.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},o=[];for(let n of this.issues)if(n.path.length>0){let i=n.path[0];r[i]=r[i]||[],r[i].push(e(n))}else o.push(e(n));return{formErrors:o,fieldErrors:r}}get formErrors(){return this.flatten()}};nn.create=t=>new nn(t);var Cme=(t,e)=>{let r;switch(t.code){case H.invalid_type:t.received===ne.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case H.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Ne.jsonStringifyReplacer)}`;break;case H.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ne.joinValues(t.keys,", ")}`;break;case H.invalid_union:r="Invalid input";break;case H.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ne.joinValues(t.options)}`;break;case H.invalid_enum_value:r=`Invalid enum value. Expected ${Ne.joinValues(t.options)}, received '${t.received}'`;break;case H.invalid_arguments:r="Invalid function arguments";break;case H.invalid_return_type:r="Invalid function return type";break;case H.invalid_date:r="Invalid date";break;case H.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Ne.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case H.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case H.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case H.custom:r="Invalid input";break;case H.invalid_intersection_types:r="Intersection results could not be merged";break;case H.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case H.not_finite:r="Number must be finite";break;default:r=e.defaultError,Ne.assertNever(t)}return{message:r}},as=Cme;var tJ=as;function Rme(t){tJ=t}function _d(){return tJ}var jg=t=>{let{data:e,path:r,errorMaps:o,issueData:n}=t,i=[...r,...n.path||[]],s={...n,path:i};if(n.message!==void 0)return{...n,path:i,message:n.message};let a="",c=o.filter(u=>!!u).slice().reverse();for(let u of c)a=u(s,{data:e,defaultError:a}).message;return{...n,path:i,message:a}},Ame=[];function ee(t,e){let r=_d(),o=jg({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===as?void 0:as].filter(n=>!!n)});t.common.issues.push(o)}var ar=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let o=[];for(let n of r){if(n.status==="aborted")return fe;n.status==="dirty"&&e.dirty(),o.push(n.value)}return{status:e.value,value:o}}static async mergeObjectAsync(e,r){let o=[];for(let n of r){let i=await n.key,s=await n.value;o.push({key:i,value:s})}return t.mergeObjectSync(e,o)}static mergeObjectSync(e,r){let o={};for(let n of r){let{key:i,value:s}=n;if(i.status==="aborted"||s.status==="aborted")return fe;i.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||n.alwaysSet)&&(o[i.value]=s.value)}return{status:e.value,value:o}}},fe=Object.freeze({status:"aborted"}),fu=t=>({status:"dirty",value:t}),Sr=t=>({status:"valid",value:t}),mw=t=>t.status==="aborted",hw=t=>t.status==="dirty",Sa=t=>t.status==="valid",bd=t=>typeof Promise<"u"&&t instanceof Promise;var se;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(se||(se={}));var Jn=class{constructor(e,r,o,n){this._cachedPath=[],this.parent=e,this.data=r,this._path=o,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},rJ=(t,e)=>{if(Sa(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new nn(t.common.issues);return this._error=r,this._error}}};function Oe(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:o,description:n}=t;if(e&&(r||o))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(s,a)=>{let{message:c}=t;return s.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??o??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:n}}var Te=class{get description(){return this._def.description}_getType(e){return ri(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:ri(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ar,ctx:{common:e.parent.common,data:e.data,parsedType:ri(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(bd(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let o=this.safeParse(e,r);if(o.success)return o.data;throw o.error}safeParse(e,r){let o={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ri(e)},n=this._parseSync({data:e,path:o.path,parent:o});return rJ(o,n)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ri(e)};if(!this["~standard"].async)try{let o=this._parseSync({data:e,path:[],parent:r});return Sa(o)?{value:o.value}:{issues:r.common.issues}}catch(o){o?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(o=>Sa(o)?{value:o.value}:{issues:r.common.issues})}async parseAsync(e,r){let o=await this.safeParseAsync(e,r);if(o.success)return o.data;throw o.error}async safeParseAsync(e,r){let o={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ri(e)},n=this._parse({data:e,path:o.path,parent:o}),i=await(bd(n)?n:Promise.resolve(n));return rJ(o,i)}refine(e,r){let o=n=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(n):r;return this._refinement((n,i)=>{let s=e(n),a=()=>i.addIssue({code:H.custom,...o(n)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,r){return this._refinement((o,n)=>e(o)?!0:(n.addIssue(typeof r=="function"?r(o,n):r),!1))}_refinement(e){return new Yn({schema:this,typeName:me.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Kn.create(this,this._def)}nullable(){return oi.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ls.create(this)}promise(){return ka.create(this,this._def)}or(e){return bu.create([this,e],this._def)}and(e){return vu.create(this,e,this._def)}transform(e){return new Yn({...Oe(this._def),schema:this,typeName:me.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Iu({...Oe(this._def),innerType:this,defaultValue:r,typeName:me.ZodDefault})}brand(){return new Lg({typeName:me.ZodBranded,type:this,...Oe(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Ou({...Oe(this._def),innerType:this,catchValue:r,typeName:me.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Ug.create(this,e)}readonly(){return Cu.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Tme=/^c[^\s-]{8,}$/i,$me=/^[0-9a-z]+$/,Pme=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Nme=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Mme=/^[a-z0-9_-]{21}$/i,Dme=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Fme=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,zme=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,jme="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",YN,Lme=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ume=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,qme=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Hme=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Bme=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Wme=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,oJ="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Zme=new RegExp(`^${oJ}$`);function iJ(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function Gme(t){return new RegExp(`^${iJ(t)}$`)}function sJ(t){let e=`${oJ}T${iJ(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function Vme(t,e){return!!((e==="v4"||!e)&&Lme.test(t)||(e==="v6"||!e)&&qme.test(t))}function Kme(t,e){if(!Dme.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let o=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(o));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function Jme(t,e){return!!((e==="v4"||!e)&&Ume.test(t)||(e==="v6"||!e)&&Hme.test(t))}var wa=class t extends Te{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ne.string){let i=this._getOrReturnCtx(e);return ee(i,{code:H.invalid_type,expected:ne.string,received:i.parsedType}),fe}let o=new ar,n;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(n=this._getOrReturnCtx(e,n),ee(n,{code:H.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),o.dirty());else if(i.kind==="max")e.data.length>i.value&&(n=this._getOrReturnCtx(e,n),ee(n,{code:H.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),o.dirty());else if(i.kind==="length"){let s=e.data.length>i.value,a=e.data.length<i.value;(s||a)&&(n=this._getOrReturnCtx(e,n),s?ee(n,{code:H.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&ee(n,{code:H.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),o.dirty())}else if(i.kind==="email")zme.test(e.data)||(n=this._getOrReturnCtx(e,n),ee(n,{validation:"email",code:H.invalid_string,message:i.message}),o.dirty());else if(i.kind==="emoji")YN||(YN=new RegExp(jme,"u")),YN.test(e.data)||(n=this._getOrReturnCtx(e,n),ee(n,{validation:"emoji",code:H.invalid_string,message:i.message}),o.dirty());else if(i.kind==="uuid")Nme.test(e.data)||(n=this._getOrReturnCtx(e,n),ee(n,{validation:"uuid",code:H.invalid_string,message:i.message}),o.dirty());else if(i.kind==="nanoid")Mme.test(e.data)||(n=this._getOrReturnCtx(e,n),ee(n,{validation:"nanoid",code:H.invalid_string,message:i.message}),o.dirty());else if(i.kind==="cuid")Tme.test(e.data)||(n=this._getOrReturnCtx(e,n),ee(n,{validation:"cuid",code:H.invalid_string,message:i.message}),o.dirty());else if(i.kind==="cuid2")$me.test(e.data)||(n=this._getOrReturnCtx(e,n),ee(n,{validation:"cuid2",code:H.invalid_string,message:i.message}),o.dirty());else if(i.kind==="ulid")Pme.test(e.data)||(n=this._getOrReturnCtx(e,n),ee(n,{validation:"ulid",code:H.invalid_string,message:i.message}),o.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),ee(n,{validation:"url",code:H.invalid_string,message:i.message}),o.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),ee(n,{validation:"regex",code:H.invalid_string,message:i.message}),o.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(n=this._getOrReturnCtx(e,n),ee(n,{code:H.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),o.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(n=this._getOrReturnCtx(e,n),ee(n,{code:H.invalid_string,validation:{startsWith:i.value},message:i.message}),o.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(n=this._getOrReturnCtx(e,n),ee(n,{code:H.invalid_string,validation:{endsWith:i.value},message:i.message}),o.dirty()):i.kind==="datetime"?sJ(i).test(e.data)||(n=this._getOrReturnCtx(e,n),ee(n,{code:H.invalid_string,validation:"datetime",message:i.message}),o.dirty()):i.kind==="date"?Zme.test(e.data)||(n=this._getOrReturnCtx(e,n),ee(n,{code:H.invalid_string,validation:"date",message:i.message}),o.dirty()):i.kind==="time"?Gme(i).test(e.data)||(n=this._getOrReturnCtx(e,n),ee(n,{code:H.invalid_string,validation:"time",message:i.message}),o.dirty()):i.kind==="duration"?Fme.test(e.data)||(n=this._getOrReturnCtx(e,n),ee(n,{validation:"duration",code:H.invalid_string,message:i.message}),o.dirty()):i.kind==="ip"?Vme(e.data,i.version)||(n=this._getOrReturnCtx(e,n),ee(n,{validation:"ip",code:H.invalid_string,message:i.message}),o.dirty()):i.kind==="jwt"?Kme(e.data,i.alg)||(n=this._getOrReturnCtx(e,n),ee(n,{validation:"jwt",code:H.invalid_string,message:i.message}),o.dirty()):i.kind==="cidr"?Jme(e.data,i.version)||(n=this._getOrReturnCtx(e,n),ee(n,{validation:"cidr",code:H.invalid_string,message:i.message}),o.dirty()):i.kind==="base64"?Bme.test(e.data)||(n=this._getOrReturnCtx(e,n),ee(n,{validation:"base64",code:H.invalid_string,message:i.message}),o.dirty()):i.kind==="base64url"?Wme.test(e.data)||(n=this._getOrReturnCtx(e,n),ee(n,{validation:"base64url",code:H.invalid_string,message:i.message}),o.dirty()):Ne.assertNever(i);return{status:o.value,value:e.data}}_regex(e,r,o){return this.refinement(n=>e.test(n),{validation:r,code:H.invalid_string,...se.errToObj(o)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...se.errToObj(e)})}url(e){return this._addCheck({kind:"url",...se.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...se.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...se.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...se.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...se.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...se.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...se.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...se.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...se.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...se.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...se.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...se.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...se.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...se.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...se.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...se.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...se.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...se.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...se.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...se.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...se.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...se.errToObj(r)})}nonempty(e){return this.min(1,se.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};wa.create=t=>new wa({checks:[],typeName:me.ZodString,coerce:t?.coerce??!1,...Oe(t)});function Yme(t,e){let r=(t.toString().split(".")[1]||"").length,o=(e.toString().split(".")[1]||"").length,n=r>o?r:o,i=Number.parseInt(t.toFixed(n).replace(".","")),s=Number.parseInt(e.toFixed(n).replace(".",""));return i%s/10**n}var mu=class t extends Te{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==ne.number){let i=this._getOrReturnCtx(e);return ee(i,{code:H.invalid_type,expected:ne.number,received:i.parsedType}),fe}let o,n=new ar;for(let i of this._def.checks)i.kind==="int"?Ne.isInteger(e.data)||(o=this._getOrReturnCtx(e,o),ee(o,{code:H.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(o=this._getOrReturnCtx(e,o),ee(o,{code:H.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(o=this._getOrReturnCtx(e,o),ee(o,{code:H.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="multipleOf"?Yme(e.data,i.value)!==0&&(o=this._getOrReturnCtx(e,o),ee(o,{code:H.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(o=this._getOrReturnCtx(e,o),ee(o,{code:H.not_finite,message:i.message}),n.dirty()):Ne.assertNever(i);return{status:n.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,se.toString(r))}gt(e,r){return this.setLimit("min",e,!1,se.toString(r))}lte(e,r){return this.setLimit("max",e,!0,se.toString(r))}lt(e,r){return this.setLimit("max",e,!1,se.toString(r))}setLimit(e,r,o,n){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:o,message:se.toString(n)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:se.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:se.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:se.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:se.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:se.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:se.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:se.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:se.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:se.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Ne.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let o of this._def.checks){if(o.kind==="finite"||o.kind==="int"||o.kind==="multipleOf")return!0;o.kind==="min"?(r===null||o.value>r)&&(r=o.value):o.kind==="max"&&(e===null||o.value<e)&&(e=o.value)}return Number.isFinite(r)&&Number.isFinite(e)}};mu.create=t=>new mu({checks:[],typeName:me.ZodNumber,coerce:t?.coerce||!1,...Oe(t)});var hu=class t extends Te{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==ne.bigint)return this._getInvalidInput(e);let o,n=new ar;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(o=this._getOrReturnCtx(e,o),ee(o,{code:H.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(o=this._getOrReturnCtx(e,o),ee(o,{code:H.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(o=this._getOrReturnCtx(e,o),ee(o,{code:H.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):Ne.assertNever(i);return{status:n.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return ee(r,{code:H.invalid_type,expected:ne.bigint,received:r.parsedType}),fe}gte(e,r){return this.setLimit("min",e,!0,se.toString(r))}gt(e,r){return this.setLimit("min",e,!1,se.toString(r))}lte(e,r){return this.setLimit("max",e,!0,se.toString(r))}lt(e,r){return this.setLimit("max",e,!1,se.toString(r))}setLimit(e,r,o,n){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:o,message:se.toString(n)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:se.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:se.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:se.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:se.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:se.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};hu.create=t=>new hu({checks:[],typeName:me.ZodBigInt,coerce:t?.coerce??!1,...Oe(t)});var gu=class extends Te{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ne.boolean){let o=this._getOrReturnCtx(e);return ee(o,{code:H.invalid_type,expected:ne.boolean,received:o.parsedType}),fe}return Sr(e.data)}};gu.create=t=>new gu({typeName:me.ZodBoolean,coerce:t?.coerce||!1,...Oe(t)});var yu=class t extends Te{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ne.date){let i=this._getOrReturnCtx(e);return ee(i,{code:H.invalid_type,expected:ne.date,received:i.parsedType}),fe}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return ee(i,{code:H.invalid_date}),fe}let o=new ar,n;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(n=this._getOrReturnCtx(e,n),ee(n,{code:H.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),o.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(n=this._getOrReturnCtx(e,n),ee(n,{code:H.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),o.dirty()):Ne.assertNever(i);return{status:o.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:se.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:se.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};yu.create=t=>new yu({checks:[],coerce:t?.coerce||!1,typeName:me.ZodDate,...Oe(t)});var Sd=class extends Te{_parse(e){if(this._getType(e)!==ne.symbol){let o=this._getOrReturnCtx(e);return ee(o,{code:H.invalid_type,expected:ne.symbol,received:o.parsedType}),fe}return Sr(e.data)}};Sd.create=t=>new Sd({typeName:me.ZodSymbol,...Oe(t)});var xu=class extends Te{_parse(e){if(this._getType(e)!==ne.undefined){let o=this._getOrReturnCtx(e);return ee(o,{code:H.invalid_type,expected:ne.undefined,received:o.parsedType}),fe}return Sr(e.data)}};xu.create=t=>new xu({typeName:me.ZodUndefined,...Oe(t)});var _u=class extends Te{_parse(e){if(this._getType(e)!==ne.null){let o=this._getOrReturnCtx(e);return ee(o,{code:H.invalid_type,expected:ne.null,received:o.parsedType}),fe}return Sr(e.data)}};_u.create=t=>new _u({typeName:me.ZodNull,...Oe(t)});var Ea=class extends Te{constructor(){super(...arguments),this._any=!0}_parse(e){return Sr(e.data)}};Ea.create=t=>new Ea({typeName:me.ZodAny,...Oe(t)});var us=class extends Te{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Sr(e.data)}};us.create=t=>new us({typeName:me.ZodUnknown,...Oe(t)});var ho=class extends Te{_parse(e){let r=this._getOrReturnCtx(e);return ee(r,{code:H.invalid_type,expected:ne.never,received:r.parsedType}),fe}};ho.create=t=>new ho({typeName:me.ZodNever,...Oe(t)});var wd=class extends Te{_parse(e){if(this._getType(e)!==ne.undefined){let o=this._getOrReturnCtx(e);return ee(o,{code:H.invalid_type,expected:ne.void,received:o.parsedType}),fe}return Sr(e.data)}};wd.create=t=>new wd({typeName:me.ZodVoid,...Oe(t)});var ls=class t extends Te{_parse(e){let{ctx:r,status:o}=this._processInputParams(e),n=this._def;if(r.parsedType!==ne.array)return ee(r,{code:H.invalid_type,expected:ne.array,received:r.parsedType}),fe;if(n.exactLength!==null){let s=r.data.length>n.exactLength.value,a=r.data.length<n.exactLength.value;(s||a)&&(ee(r,{code:s?H.too_big:H.too_small,minimum:a?n.exactLength.value:void 0,maximum:s?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),o.dirty())}if(n.minLength!==null&&r.data.length<n.minLength.value&&(ee(r,{code:H.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),o.dirty()),n.maxLength!==null&&r.data.length>n.maxLength.value&&(ee(r,{code:H.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),o.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>n.type._parseAsync(new Jn(r,s,r.path,a)))).then(s=>ar.mergeArray(o,s));let i=[...r.data].map((s,a)=>n.type._parseSync(new Jn(r,s,r.path,a)));return ar.mergeArray(o,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:se.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:se.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:se.toString(r)}})}nonempty(e){return this.min(1,e)}};ls.create=(t,e)=>new ls({type:t,minLength:null,maxLength:null,exactLength:null,typeName:me.ZodArray,...Oe(e)});function vd(t){if(t instanceof on){let e={};for(let r in t.shape){let o=t.shape[r];e[r]=Kn.create(vd(o))}return new on({...t._def,shape:()=>e})}else return t instanceof ls?new ls({...t._def,type:vd(t.element)}):t instanceof Kn?Kn.create(vd(t.unwrap())):t instanceof oi?oi.create(vd(t.unwrap())):t instanceof ni?ni.create(t.items.map(e=>vd(e))):t}var on=class t extends Te{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=Ne.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==ne.object){let u=this._getOrReturnCtx(e);return ee(u,{code:H.invalid_type,expected:ne.object,received:u.parsedType}),fe}let{status:o,ctx:n}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof ho&&this._def.unknownKeys==="strip"))for(let u in n.data)s.includes(u)||a.push(u);let c=[];for(let u of s){let l=i[u],p=n.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Jn(n,p,n.path,u)),alwaysSet:u in n.data})}if(this._def.catchall instanceof ho){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:n.data[l]}});else if(u==="strict")a.length>0&&(ee(n,{code:H.unrecognized_keys,keys:a}),o.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of a){let p=n.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Jn(n,p,n.path,l)),alwaysSet:l in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let p=await l.key,f=await l.value;u.push({key:p,value:f,alwaysSet:l.alwaysSet})}return u}).then(u=>ar.mergeObjectSync(o,u)):ar.mergeObjectSync(o,c)}get shape(){return this._def.shape()}strict(e){return se.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,o)=>{let n=this._def.errorMap?.(r,o).message??o.defaultError;return r.code==="unrecognized_keys"?{message:se.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:me.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let o of Ne.objectKeys(e))e[o]&&this.shape[o]&&(r[o]=this.shape[o]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let o of Ne.objectKeys(this.shape))e[o]||(r[o]=this.shape[o]);return new t({...this._def,shape:()=>r})}deepPartial(){return vd(this)}partial(e){let r={};for(let o of Ne.objectKeys(this.shape)){let n=this.shape[o];e&&!e[o]?r[o]=n:r[o]=n.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let o of Ne.objectKeys(this.shape))if(e&&!e[o])r[o]=this.shape[o];else{let i=this.shape[o];for(;i instanceof Kn;)i=i._def.innerType;r[o]=i}return new t({...this._def,shape:()=>r})}keyof(){return aJ(Ne.objectKeys(this.shape))}};on.create=(t,e)=>new on({shape:()=>t,unknownKeys:"strip",catchall:ho.create(),typeName:me.ZodObject,...Oe(e)});on.strictCreate=(t,e)=>new on({shape:()=>t,unknownKeys:"strict",catchall:ho.create(),typeName:me.ZodObject,...Oe(e)});on.lazycreate=(t,e)=>new on({shape:t,unknownKeys:"strip",catchall:ho.create(),typeName:me.ZodObject,...Oe(e)});var bu=class extends Te{_parse(e){let{ctx:r}=this._processInputParams(e),o=this._def.options;function n(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new nn(a.ctx.common.issues));return ee(r,{code:H.invalid_union,unionErrors:s}),fe}if(r.common.async)return Promise.all(o.map(async i=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(n);{let i,s=[];for(let c of o){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!i&&(i={result:l,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(c=>new nn(c));return ee(r,{code:H.invalid_union,unionErrors:a}),fe}}get options(){return this._def.options}};bu.create=(t,e)=>new bu({options:t,typeName:me.ZodUnion,...Oe(e)});var cs=t=>t instanceof Su?cs(t.schema):t instanceof Yn?cs(t.innerType()):t instanceof wu?[t.value]:t instanceof Eu?t.options:t instanceof ku?Ne.objectValues(t.enum):t instanceof Iu?cs(t._def.innerType):t instanceof xu?[void 0]:t instanceof _u?[null]:t instanceof Kn?[void 0,...cs(t.unwrap())]:t instanceof oi?[null,...cs(t.unwrap())]:t instanceof Lg||t instanceof Cu?cs(t.unwrap()):t instanceof Ou?cs(t._def.innerType):[],gw=class t extends Te{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ne.object)return ee(r,{code:H.invalid_type,expected:ne.object,received:r.parsedType}),fe;let o=this.discriminator,n=r.data[o],i=this.optionsMap.get(n);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(ee(r,{code:H.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[o]}),fe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,o){let n=new Map;for(let i of r){let s=cs(i.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(n.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);n.set(a,i)}}return new t({typeName:me.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:n,...Oe(o)})}};function XN(t,e){let r=ri(t),o=ri(e);if(t===e)return{valid:!0,data:t};if(r===ne.object&&o===ne.object){let n=Ne.objectKeys(e),i=Ne.objectKeys(t).filter(a=>n.indexOf(a)!==-1),s={...t,...e};for(let a of i){let c=XN(t[a],e[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===ne.array&&o===ne.array){if(t.length!==e.length)return{valid:!1};let n=[];for(let i=0;i<t.length;i++){let s=t[i],a=e[i],c=XN(s,a);if(!c.valid)return{valid:!1};n.push(c.data)}return{valid:!0,data:n}}else return r===ne.date&&o===ne.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var vu=class extends Te{_parse(e){let{status:r,ctx:o}=this._processInputParams(e),n=(i,s)=>{if(mw(i)||mw(s))return fe;let a=XN(i.value,s.value);return a.valid?((hw(i)||hw(s))&&r.dirty(),{status:r.value,value:a.data}):(ee(o,{code:H.invalid_intersection_types}),fe)};return o.common.async?Promise.all([this._def.left._parseAsync({data:o.data,path:o.path,parent:o}),this._def.right._parseAsync({data:o.data,path:o.path,parent:o})]).then(([i,s])=>n(i,s)):n(this._def.left._parseSync({data:o.data,path:o.path,parent:o}),this._def.right._parseSync({data:o.data,path:o.path,parent:o}))}};vu.create=(t,e,r)=>new vu({left:t,right:e,typeName:me.ZodIntersection,...Oe(r)});var ni=class t extends Te{_parse(e){let{status:r,ctx:o}=this._processInputParams(e);if(o.parsedType!==ne.array)return ee(o,{code:H.invalid_type,expected:ne.array,received:o.parsedType}),fe;if(o.data.length<this._def.items.length)return ee(o,{code:H.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),fe;!this._def.rest&&o.data.length>this._def.items.length&&(ee(o,{code:H.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...o.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new Jn(o,s,o.path,a)):null}).filter(s=>!!s);return o.common.async?Promise.all(i).then(s=>ar.mergeArray(r,s)):ar.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};ni.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ni({items:t,typeName:me.ZodTuple,rest:null,...Oe(e)})};var yw=class t extends Te{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:o}=this._processInputParams(e);if(o.parsedType!==ne.object)return ee(o,{code:H.invalid_type,expected:ne.object,received:o.parsedType}),fe;let n=[],i=this._def.keyType,s=this._def.valueType;for(let a in o.data)n.push({key:i._parse(new Jn(o,a,o.path,a)),value:s._parse(new Jn(o,o.data[a],o.path,a)),alwaysSet:a in o.data});return o.common.async?ar.mergeObjectAsync(r,n):ar.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(e,r,o){return r instanceof Te?new t({keyType:e,valueType:r,typeName:me.ZodRecord,...Oe(o)}):new t({keyType:wa.create(),valueType:e,typeName:me.ZodRecord,...Oe(r)})}},Ed=class extends Te{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:o}=this._processInputParams(e);if(o.parsedType!==ne.map)return ee(o,{code:H.invalid_type,expected:ne.map,received:o.parsedType}),fe;let n=this._def.keyType,i=this._def.valueType,s=[...o.data.entries()].map(([a,c],u)=>({key:n._parse(new Jn(o,a,o.path,[u,"key"])),value:i._parse(new Jn(o,c,o.path,[u,"value"]))}));if(o.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of s){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return fe;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of s){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return fe;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}}}};Ed.create=(t,e,r)=>new Ed({valueType:e,keyType:t,typeName:me.ZodMap,...Oe(r)});var kd=class t extends Te{_parse(e){let{status:r,ctx:o}=this._processInputParams(e);if(o.parsedType!==ne.set)return ee(o,{code:H.invalid_type,expected:ne.set,received:o.parsedType}),fe;let n=this._def;n.minSize!==null&&o.data.size<n.minSize.value&&(ee(o,{code:H.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),r.dirty()),n.maxSize!==null&&o.data.size>n.maxSize.value&&(ee(o,{code:H.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),r.dirty());let i=this._def.valueType;function s(c){let u=new Set;for(let l of c){if(l.status==="aborted")return fe;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let a=[...o.data.values()].map((c,u)=>i._parse(new Jn(o,c,o.path,u)));return o.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:se.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:se.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};kd.create=(t,e)=>new kd({valueType:t,minSize:null,maxSize:null,typeName:me.ZodSet,...Oe(e)});var xw=class t extends Te{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ne.function)return ee(r,{code:H.invalid_type,expected:ne.function,received:r.parsedType}),fe;function o(a,c){return jg({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,_d(),as].filter(u=>!!u),issueData:{code:H.invalid_arguments,argumentsError:c}})}function n(a,c){return jg({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,_d(),as].filter(u=>!!u),issueData:{code:H.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof ka){let a=this;return Sr(async function(...c){let u=new nn([]),l=await a._def.args.parseAsync(c,i).catch(d=>{throw u.addIssue(o(c,d)),u}),p=await Reflect.apply(s,this,l);return await a._def.returns._def.type.parseAsync(p,i).catch(d=>{throw u.addIssue(n(p,d)),u})})}else{let a=this;return Sr(function(...c){let u=a._def.args.safeParse(c,i);if(!u.success)throw new nn([o(c,u.error)]);let l=Reflect.apply(s,this,u.data),p=a._def.returns.safeParse(l,i);if(!p.success)throw new nn([n(l,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:ni.create(e).rest(us.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,o){return new t({args:e||ni.create([]).rest(us.create()),returns:r||us.create(),typeName:me.ZodFunction,...Oe(o)})}},Su=class extends Te{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Su.create=(t,e)=>new Su({getter:t,typeName:me.ZodLazy,...Oe(e)});var wu=class extends Te{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return ee(r,{received:r.data,code:H.invalid_literal,expected:this._def.value}),fe}return{status:"valid",value:e.data}}get value(){return this._def.value}};wu.create=(t,e)=>new wu({value:t,typeName:me.ZodLiteral,...Oe(e)});function aJ(t,e){return new Eu({values:t,typeName:me.ZodEnum,...Oe(e)})}var Eu=class t extends Te{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),o=this._def.values;return ee(r,{expected:Ne.joinValues(o),received:r.parsedType,code:H.invalid_type}),fe}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),o=this._def.values;return ee(r,{received:r.data,code:H.invalid_enum_value,options:o}),fe}return Sr(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(o=>!e.includes(o)),{...this._def,...r})}};Eu.create=aJ;var ku=class extends Te{_parse(e){let r=Ne.getValidEnumValues(this._def.values),o=this._getOrReturnCtx(e);if(o.parsedType!==ne.string&&o.parsedType!==ne.number){let n=Ne.objectValues(r);return ee(o,{expected:Ne.joinValues(n),received:o.parsedType,code:H.invalid_type}),fe}if(this._cache||(this._cache=new Set(Ne.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=Ne.objectValues(r);return ee(o,{received:o.data,code:H.invalid_enum_value,options:n}),fe}return Sr(e.data)}get enum(){return this._def.values}};ku.create=(t,e)=>new ku({values:t,typeName:me.ZodNativeEnum,...Oe(e)});var ka=class extends Te{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ne.promise&&r.common.async===!1)return ee(r,{code:H.invalid_type,expected:ne.promise,received:r.parsedType}),fe;let o=r.parsedType===ne.promise?r.data:Promise.resolve(r.data);return Sr(o.then(n=>this._def.type.parseAsync(n,{path:r.path,errorMap:r.common.contextualErrorMap})))}};ka.create=(t,e)=>new ka({type:t,typeName:me.ZodPromise,...Oe(e)});var Yn=class extends Te{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===me.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:o}=this._processInputParams(e),n=this._def.effect||null,i={addIssue:s=>{ee(o,s),s.fatal?r.abort():r.dirty()},get path(){return o.path}};if(i.addIssue=i.addIssue.bind(i),n.type==="preprocess"){let s=n.transform(o.data,i);if(o.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return fe;let c=await this._def.schema._parseAsync({data:a,path:o.path,parent:o});return c.status==="aborted"?fe:c.status==="dirty"?fu(c.value):r.value==="dirty"?fu(c.value):c});{if(r.value==="aborted")return fe;let a=this._def.schema._parseSync({data:s,path:o.path,parent:o});return a.status==="aborted"?fe:a.status==="dirty"?fu(a.value):r.value==="dirty"?fu(a.value):a}}if(n.type==="refinement"){let s=a=>{let c=n.refinement(a,i);if(o.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(o.common.async===!1){let a=this._def.schema._parseSync({data:o.data,path:o.path,parent:o});return a.status==="aborted"?fe:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:o.data,path:o.path,parent:o}).then(a=>a.status==="aborted"?fe:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(n.type==="transform")if(o.common.async===!1){let s=this._def.schema._parseSync({data:o.data,path:o.path,parent:o});if(!Sa(s))return fe;let a=n.transform(s.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:o.data,path:o.path,parent:o}).then(s=>Sa(s)?Promise.resolve(n.transform(s.value,i)).then(a=>({status:r.value,value:a})):fe);Ne.assertNever(n)}};Yn.create=(t,e,r)=>new Yn({schema:t,typeName:me.ZodEffects,effect:e,...Oe(r)});Yn.createWithPreprocess=(t,e,r)=>new Yn({schema:e,effect:{type:"preprocess",transform:t},typeName:me.ZodEffects,...Oe(r)});var Kn=class extends Te{_parse(e){return this._getType(e)===ne.undefined?Sr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Kn.create=(t,e)=>new Kn({innerType:t,typeName:me.ZodOptional,...Oe(e)});var oi=class extends Te{_parse(e){return this._getType(e)===ne.null?Sr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};oi.create=(t,e)=>new oi({innerType:t,typeName:me.ZodNullable,...Oe(e)});var Iu=class extends Te{_parse(e){let{ctx:r}=this._processInputParams(e),o=r.data;return r.parsedType===ne.undefined&&(o=this._def.defaultValue()),this._def.innerType._parse({data:o,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Iu.create=(t,e)=>new Iu({innerType:t,typeName:me.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Oe(e)});var Ou=class extends Te{_parse(e){let{ctx:r}=this._processInputParams(e),o={...r,common:{...r.common,issues:[]}},n=this._def.innerType._parse({data:o.data,path:o.path,parent:{...o}});return bd(n)?n.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new nn(o.common.issues)},input:o.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new nn(o.common.issues)},input:o.data})}}removeCatch(){return this._def.innerType}};Ou.create=(t,e)=>new Ou({innerType:t,typeName:me.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Oe(e)});var Id=class extends Te{_parse(e){if(this._getType(e)!==ne.nan){let o=this._getOrReturnCtx(e);return ee(o,{code:H.invalid_type,expected:ne.nan,received:o.parsedType}),fe}return{status:"valid",value:e.data}}};Id.create=t=>new Id({typeName:me.ZodNaN,...Oe(t)});var Xme=Symbol("zod_brand"),Lg=class extends Te{_parse(e){let{ctx:r}=this._processInputParams(e),o=r.data;return this._def.type._parse({data:o,path:r.path,parent:r})}unwrap(){return this._def.type}},Ug=class t extends Te{_parse(e){let{status:r,ctx:o}=this._processInputParams(e);if(o.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:o.data,path:o.path,parent:o});return i.status==="aborted"?fe:i.status==="dirty"?(r.dirty(),fu(i.value)):this._def.out._parseAsync({data:i.value,path:o.path,parent:o})})();{let n=this._def.in._parseSync({data:o.data,path:o.path,parent:o});return n.status==="aborted"?fe:n.status==="dirty"?(r.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:o.path,parent:o})}}static create(e,r){return new t({in:e,out:r,typeName:me.ZodPipeline})}},Cu=class extends Te{_parse(e){let r=this._def.innerType._parse(e),o=n=>(Sa(n)&&(n.value=Object.freeze(n.value)),n);return bd(r)?r.then(n=>o(n)):o(r)}unwrap(){return this._def.innerType}};Cu.create=(t,e)=>new Cu({innerType:t,typeName:me.ZodReadonly,...Oe(e)});function nJ(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function cJ(t,e={},r){return t?Ea.create().superRefine((o,n)=>{let i=t(o);if(i instanceof Promise)return i.then(s=>{if(!s){let a=nJ(e,o),c=a.fatal??r??!0;n.addIssue({code:"custom",...a,fatal:c})}});if(!i){let s=nJ(e,o),a=s.fatal??r??!0;n.addIssue({code:"custom",...s,fatal:a})}}):Ea.create()}var Qme={object:on.lazycreate},me;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(me||(me={}));var ehe=(t,e={message:`Input not instance of ${t.name}`})=>cJ(r=>r instanceof t,e),uJ=wa.create,lJ=mu.create,the=Id.create,rhe=hu.create,pJ=gu.create,nhe=yu.create,ohe=Sd.create,ihe=xu.create,she=_u.create,ahe=Ea.create,che=us.create,uhe=ho.create,lhe=wd.create,phe=ls.create,dhe=on.create,fhe=on.strictCreate,mhe=bu.create,hhe=gw.create,ghe=vu.create,yhe=ni.create,xhe=yw.create,_he=Ed.create,bhe=kd.create,vhe=xw.create,She=Su.create,whe=wu.create,Ehe=Eu.create,khe=ku.create,Ihe=ka.create,Ohe=Yn.create,Che=Kn.create,Rhe=oi.create,Ahe=Yn.createWithPreprocess,The=Ug.create,$he=()=>uJ().optional(),Phe=()=>lJ().optional(),Nhe=()=>pJ().optional(),Mhe={string:(t=>wa.create({...t,coerce:!0})),number:(t=>mu.create({...t,coerce:!0})),boolean:(t=>gu.create({...t,coerce:!0})),bigint:(t=>hu.create({...t,coerce:!0})),date:(t=>yu.create({...t,coerce:!0}))};var Dhe=fe;var Fhe=x.object({name:x.string(),arguments:x.string()}),zhe=x.object({id:x.string(),type:x.literal("function"),function:Fhe,encryptedValue:x.string().optional()}),_w=x.object({id:x.string(),role:x.string(),content:x.string().optional(),name:x.string().optional(),encryptedValue:x.string().optional()}),jhe=x.object({type:x.literal("text"),text:x.string()}),Lhe=x.object({type:x.literal("data"),value:x.string(),mimeType:x.string()}),Uhe=x.object({type:x.literal("url"),value:x.string(),mimeType:x.string().optional()}),bw=x.discriminatedUnion("type",[Lhe,Uhe]),qhe=x.object({type:x.literal("image"),source:bw,metadata:x.unknown().optional()}),Hhe=x.object({type:x.literal("audio"),source:bw,metadata:x.unknown().optional()}),Bhe=x.object({type:x.literal("video"),source:bw,metadata:x.unknown().optional()}),Whe=x.object({type:x.literal("document"),source:bw,metadata:x.unknown().optional()});var dJ=x.object({type:x.literal("binary"),mimeType:x.string(),id:x.string().optional(),url:x.string().optional(),data:x.string().optional(),filename:x.string().optional()}),fJ=(t,e)=>{!t.id&&!t.url&&!t.data&&e.addIssue({code:x.ZodIssueCode.custom,message:"BinaryInputContent requires at least one of id, url, or data.",path:["id"]})},MDe=dJ.superRefine((t,e)=>{fJ(t,e)}),Zhe=x.discriminatedUnion("type",[jhe,qhe,Hhe,Bhe,Whe,dJ]),Ghe=Zhe.superRefine((t,e)=>{t.type==="binary"&&fJ(t,e)}),Vhe=_w.extend({role:x.literal("developer"),content:x.string()}),Khe=_w.extend({role:x.literal("system"),content:x.string()}),Jhe=_w.extend({role:x.literal("assistant"),content:x.string().optional(),toolCalls:x.array(zhe).optional()}),Yhe=_w.extend({role:x.literal("user"),content:x.union([x.string(),x.array(Ghe)])}),Xhe=x.object({id:x.string(),content:x.string(),role:x.literal("tool"),toolCallId:x.string(),error:x.string().optional(),encryptedValue:x.string().optional()}),Qhe=x.object({id:x.string(),role:x.literal("activity"),activityType:x.string(),content:x.record(x.any())}),ege=x.object({id:x.string(),role:x.literal("reasoning"),content:x.string(),encryptedValue:x.string().optional()}),mJ=x.discriminatedUnion("role",[Vhe,Khe,Jhe,Yhe,Xhe,Qhe,ege]),DDe=x.union([x.literal("developer"),x.literal("system"),x.literal("assistant"),x.literal("user"),x.literal("tool"),x.literal("activity"),x.literal("reasoning")]),tge=x.object({description:x.string(),value:x.string()}),hJ=x.object({name:x.string(),description:x.string(),parameters:x.any(),metadata:x.record(x.any()).optional()}),rge=x.object({threadId:x.string(),runId:x.string(),parentRunId:x.string().optional(),state:x.any(),messages:x.array(mJ),tools:x.array(hJ),context:x.array(tge),forwardedProps:x.any()}),nge=x.any();var oge=x.object({name:x.string(),description:x.string().optional()}),ige=x.object({name:x.string().optional(),type:x.string().optional(),description:x.string().optional(),version:x.string().optional(),provider:x.string().optional(),documentationUrl:x.string().optional(),metadata:x.record(x.unknown()).optional()}),sge=x.object({streaming:x.boolean().optional(),websocket:x.boolean().optional(),httpBinary:x.boolean().optional(),pushNotifications:x.boolean().optional(),resumable:x.boolean().optional()}),age=x.object({supported:x.boolean().optional(),items:x.array(hJ).optional(),parallelCalls:x.boolean().optional(),clientProvided:x.boolean().optional()}),cge=x.object({structuredOutput:x.boolean().optional(),supportedMimeTypes:x.array(x.string()).optional()}),uge=x.object({snapshots:x.boolean().optional(),deltas:x.boolean().optional(),memory:x.boolean().optional(),persistentState:x.boolean().optional()}),lge=x.object({supported:x.boolean().optional(),delegation:x.boolean().optional(),handoffs:x.boolean().optional(),subAgents:x.array(oge).optional()}),pge=x.object({supported:x.boolean().optional(),streaming:x.boolean().optional(),encrypted:x.boolean().optional()}),dge=x.object({image:x.boolean().optional(),audio:x.boolean().optional(),video:x.boolean().optional(),pdf:x.boolean().optional(),file:x.boolean().optional()}),fge=x.object({image:x.boolean().optional(),audio:x.boolean().optional()}),mge=x.object({input:dge.optional(),output:fge.optional()}),hge=x.object({codeExecution:x.boolean().optional(),sandboxed:x.boolean().optional(),maxIterations:x.number().optional(),maxExecutionTime:x.number().optional()}),gge=x.object({supported:x.boolean().optional(),approvals:x.boolean().optional(),interventions:x.boolean().optional(),feedback:x.boolean().optional()}),FDe=x.object({identity:ige.optional(),transport:sge.optional(),tools:age.optional(),output:cge.optional(),state:uge.optional(),multiAgent:lge.optional(),reasoning:pge.optional(),multimodal:mge.optional(),execution:hge.optional(),humanInTheLoop:gge.optional(),custom:x.record(x.unknown()).optional()}),gJ=x.union([x.literal("developer"),x.literal("system"),x.literal("assistant"),x.literal("user")]),A=(function(t){return t.TEXT_MESSAGE_START="TEXT_MESSAGE_START",t.TEXT_MESSAGE_CONTENT="TEXT_MESSAGE_CONTENT",t.TEXT_MESSAGE_END="TEXT_MESSAGE_END",t.TEXT_MESSAGE_CHUNK="TEXT_MESSAGE_CHUNK",t.TOOL_CALL_START="TOOL_CALL_START",t.TOOL_CALL_ARGS="TOOL_CALL_ARGS",t.TOOL_CALL_END="TOOL_CALL_END",t.TOOL_CALL_CHUNK="TOOL_CALL_CHUNK",t.TOOL_CALL_RESULT="TOOL_CALL_RESULT",t.THINKING_START="THINKING_START",t.THINKING_END="THINKING_END",t.THINKING_TEXT_MESSAGE_START="THINKING_TEXT_MESSAGE_START",t.THINKING_TEXT_MESSAGE_CONTENT="THINKING_TEXT_MESSAGE_CONTENT",t.THINKING_TEXT_MESSAGE_END="THINKING_TEXT_MESSAGE_END",t.STATE_SNAPSHOT="STATE_SNAPSHOT",t.STATE_DELTA="STATE_DELTA",t.MESSAGES_SNAPSHOT="MESSAGES_SNAPSHOT",t.ACTIVITY_SNAPSHOT="ACTIVITY_SNAPSHOT",t.ACTIVITY_DELTA="ACTIVITY_DELTA",t.RAW="RAW",t.CUSTOM="CUSTOM",t.RUN_STARTED="RUN_STARTED",t.RUN_FINISHED="RUN_FINISHED",t.RUN_ERROR="RUN_ERROR",t.STEP_STARTED="STEP_STARTED",t.STEP_FINISHED="STEP_FINISHED",t.REASONING_START="REASONING_START",t.REASONING_MESSAGE_START="REASONING_MESSAGE_START",t.REASONING_MESSAGE_CONTENT="REASONING_MESSAGE_CONTENT",t.REASONING_MESSAGE_END="REASONING_MESSAGE_END",t.REASONING_MESSAGE_CHUNK="REASONING_MESSAGE_CHUNK",t.REASONING_END="REASONING_END",t.REASONING_ENCRYPTED_VALUE="REASONING_ENCRYPTED_VALUE",t})({}),We=x.object({type:x.nativeEnum(A),timestamp:x.number().optional(),rawEvent:x.any().optional()}).passthrough(),yge=We.extend({type:x.literal(A.TEXT_MESSAGE_START),messageId:x.string(),role:gJ.default("assistant"),name:x.string().optional()}),yJ=We.extend({type:x.literal(A.TEXT_MESSAGE_CONTENT),messageId:x.string(),delta:x.string()}),xge=We.extend({type:x.literal(A.TEXT_MESSAGE_END),messageId:x.string()}),_ge=We.extend({type:x.literal(A.TEXT_MESSAGE_CHUNK),messageId:x.string().optional(),role:gJ.optional(),delta:x.string().optional(),name:x.string().optional()}),bge=We.extend({type:x.literal(A.THINKING_TEXT_MESSAGE_START)}),vge=yJ.omit({messageId:!0,type:!0}).extend({type:x.literal(A.THINKING_TEXT_MESSAGE_CONTENT)}),Sge=We.extend({type:x.literal(A.THINKING_TEXT_MESSAGE_END)}),wge=We.extend({type:x.literal(A.TOOL_CALL_START),toolCallId:x.string(),toolCallName:x.string(),parentMessageId:x.string().optional()}),Ege=We.extend({type:x.literal(A.TOOL_CALL_ARGS),toolCallId:x.string(),delta:x.string()}),kge=We.extend({type:x.literal(A.TOOL_CALL_END),toolCallId:x.string()}),Ige=We.extend({messageId:x.string(),type:x.literal(A.TOOL_CALL_RESULT),toolCallId:x.string(),content:x.string(),role:x.literal("tool").optional()}),Oge=We.extend({type:x.literal(A.TOOL_CALL_CHUNK),toolCallId:x.string().optional(),toolCallName:x.string().optional(),parentMessageId:x.string().optional(),delta:x.string().optional()}),Cge=We.extend({type:x.literal(A.THINKING_START),title:x.string().optional()}),Rge=We.extend({type:x.literal(A.THINKING_END)}),Age=We.extend({type:x.literal(A.STATE_SNAPSHOT),snapshot:nge}),Tge=We.extend({type:x.literal(A.STATE_DELTA),delta:x.array(x.any())}),$ge=We.extend({type:x.literal(A.MESSAGES_SNAPSHOT),messages:x.array(mJ)}),Pge=We.extend({type:x.literal(A.ACTIVITY_SNAPSHOT),messageId:x.string(),activityType:x.string(),content:x.record(x.any()),replace:x.boolean().optional().default(!0)}),Nge=We.extend({type:x.literal(A.ACTIVITY_DELTA),messageId:x.string(),activityType:x.string(),patch:x.array(x.any())}),Mge=We.extend({type:x.literal(A.RAW),event:x.any(),source:x.string().optional()}),Dge=We.extend({type:x.literal(A.CUSTOM),name:x.string(),value:x.any()}),Fge=We.extend({type:x.literal(A.RUN_STARTED),threadId:x.string(),runId:x.string(),parentRunId:x.string().optional(),input:rge.optional()}),zge=We.extend({type:x.literal(A.RUN_FINISHED),threadId:x.string(),runId:x.string(),result:x.any().optional()}),jge=We.extend({type:x.literal(A.RUN_ERROR),message:x.string(),code:x.string().optional()}),Lge=We.extend({type:x.literal(A.STEP_STARTED),stepName:x.string()}),Uge=We.extend({type:x.literal(A.STEP_FINISHED),stepName:x.string()}),qge=x.union([x.literal("tool-call"),x.literal("message")]),Hge=We.extend({type:x.literal(A.REASONING_START),messageId:x.string()}),Bge=We.extend({type:x.literal(A.REASONING_MESSAGE_START),messageId:x.string(),role:x.literal("reasoning")}),Wge=We.extend({type:x.literal(A.REASONING_MESSAGE_CONTENT),messageId:x.string(),delta:x.string()}),Zge=We.extend({type:x.literal(A.REASONING_MESSAGE_END),messageId:x.string()}),Gge=We.extend({type:x.literal(A.REASONING_MESSAGE_CHUNK),messageId:x.string().optional(),delta:x.string().optional()}),Vge=We.extend({type:x.literal(A.REASONING_END),messageId:x.string()}),Kge=We.extend({type:x.literal(A.REASONING_ENCRYPTED_VALUE),subtype:qge,entityId:x.string(),encryptedValue:x.string()}),zDe=x.discriminatedUnion("type",[yge,yJ,xge,_ge,Cge,Rge,bge,vge,Sge,wge,Ege,kge,Oge,Ige,Age,Tge,$ge,Pge,Nge,Mge,Dge,Fge,zge,jge,Lge,Uge,Hge,Bge,Wge,Zge,Gge,Vge,Kge]);function Jge(t,e){if(!t)return e;if(!e||t.aborted)return t;if(e.aborted)return e;let r=new AbortController,o=n=>()=>{r.abort(n.reason)};return t.addEventListener("abort",o(t),{once:!0}),e.addEventListener("abort",o(e),{once:!0}),r.signal}var qg=class{adapter;params;systemPrompts;tools;loopStrategy;toolCallManager;lazyToolManager;initialMessageCount;requestId;streamId;effectiveRequest;effectiveSignal;messages;iterationCount=0;lastFinishReason=null;streamStartTime=0;totalChunkCount=0;currentMessageId=null;accumulatedContent="";accumulatedThinking=[];currentThinkingContent="";currentThinkingSignature="";eventOptions;eventToolNames;finishedEvent=null;earlyTermination=!1;toolPhase="continue";cyclePhase="processText";initialApprovals;initialClientToolResults;threadId;runIdOverride;parentRunIdOverride;middlewareRunner;middlewareCtx;deferredPromises=[];abortReason;middlewareAbortController;toolAbortSignal;terminalHookCalled=!1;logger;structuredOutputResult=null;combinedStartEmitted=!1;combinedStructuredMessageId=null;validatedStructuredOutput=void 0;hasValidatedStructuredOutput=!1;finalizationError=null;finalStructuredOutput;constructor(e,r){this.logger=r,this.adapter=e.adapter,this.finalStructuredOutput=e.finalStructuredOutput,this.params=e.params,this.systemPrompts=e.params.systemPrompts||[],this.loopStrategy=e.params.agentLoopStrategy||yd(5),this.initialMessageCount=e.params.messages.length;let{approvals:o,clientToolResults:n}=this.extractClientStateFromOriginalMessages(e.params.messages);this.initialApprovals=o,this.initialClientToolResults=n,this.messages=QK(e.params.messages),this.lazyToolManager=new lw(e.params.tools||[],this.messages,e.params.lazyToolsConfig),this.tools=this.lazyToolManager.getActiveTools(),this.toolCallManager=new zg(this.tools),this.requestId=this.createId("chat"),this.streamId=this.createId("stream"),this.effectiveRequest=e.params.abortController?{signal:e.params.abortController.signal}:void 0,this.effectiveSignal=e.params.abortController?.signal,this.threadId=e.params.threadId||e.params.conversationId||this.createId("thread"),this.runIdOverride=e.params.runId,this.parentRunIdOverride=e.params.parentRunId;let i=[HN(),...e.middleware||[],jK()];this.middlewareRunner=new dw(i,r),this.middlewareAbortController=new AbortController,this.toolAbortSignal=Jge(this.effectiveSignal,this.middlewareAbortController.signal),this.middlewareCtx={requestId:this.requestId,streamId:this.streamId,runId:this.runIdOverride??this.requestId,threadId:this.threadId,conversationId:this.threadId,phase:"init",iteration:0,chunkIndex:0,signal:this.effectiveSignal,abort:s=>{this.abortReason=s,this.middlewareAbortController?.abort(s)},context:e.context,defer:s=>{this.deferredPromises.push(s)},activity:"chat",provider:e.adapter.name,model:e.params.model,source:"server",streaming:!0,systemPrompts:this.systemPrompts,toolNames:void 0,options:void 0,modelOptions:e.params.modelOptions,messageCount:this.initialMessageCount,hasTools:this.tools.length>0,currentMessageId:null,accumulatedContent:"",messages:this.messages,createId:s=>this.createId(s),capabilities:new fw,get:s=>s[0](this.middlewareCtx),getOptional:s=>s[0](this.middlewareCtx,{optional:!0}),provide:(s,a)=>s[1](this.middlewareCtx,a)}}getAccumulatedContent(){return this.accumulatedContent}getMessages(){return this.messages}getStructuredOutputResult(){return this.structuredOutputResult}getValidatedStructuredOutput(){return this.hasValidatedStructuredOutput?{value:this.validatedStructuredOutput}:null}getFinalizationError(){return this.finalizationError}async*run(){this.beforeRun(),this.logger.agentLoop("run started",{threadId:this.middlewareCtx.threadId});try{await this.middlewareRunner.runSetup(this.middlewareCtx),this.middlewareCtx.phase="init";let e=this.buildMiddlewareConfig(),r=await this.middlewareRunner.runOnConfig(this.middlewareCtx,e);if(this.applyMiddlewareConfig(r),await this.middlewareRunner.runOnStart(this.middlewareCtx),(yield*this.checkForPendingToolCalls())==="wait")return;if(!(!!this.finalStructuredOutput&&this.tools.length===0&&this.finalStructuredOutput.nativeCombined!==!0))do{if(this.earlyTermination||this.isCancelled())return;if(this.logger.agentLoop(`iteration=${this.middlewareCtx.iteration}`,{iteration:this.middlewareCtx.iteration}),await this.beginCycle(),this.cyclePhase==="processText"){this.middlewareCtx.phase="beforeModel",this.middlewareCtx.iteration=this.iterationCount;let i=this.buildMiddlewareConfig(),s=await this.middlewareRunner.runOnConfig(this.middlewareCtx,i);this.applyMiddlewareConfig(s),yield*this.streamModelResponse()}else yield*this.processToolCalls();this.endCycle()}while(this.shouldContinue());if(this.logger.agentLoop("run finished",{finishReason:this.lastFinishReason}),this.finalStructuredOutput&&!this.isCancelled()&&!this.finalizationError&&(this.finalStructuredOutput.nativeCombined===!0?yield*this.harvestCombinedStructuredOutput():yield*this.runStructuredFinalization()),!this.terminalHookCalled&&this.toolPhase!=="wait"&&!this.isCancelled())if(this.finalizationError){this.terminalHookCalled=!0;let i=new Error(this.finalizationError.message,this.finalizationError.cause!==void 0?{cause:this.finalizationError.cause}:void 0);this.finalizationError.code!==void 0&&Object.defineProperty(i,"code",{value:this.finalizationError.code,enumerable:!0}),await this.middlewareRunner.runOnError(this.middlewareCtx,{error:i,duration:Date.now()-this.streamStartTime})}else this.terminalHookCalled=!0,await this.middlewareRunner.runOnFinish(this.middlewareCtx,{finishReason:this.lastFinishReason,duration:Date.now()-this.streamStartTime,content:this.accumulatedContent,usage:this.finishedEvent?.usage})}catch(e){if(this.terminalHookCalled||(this.terminalHookCalled=!0,e instanceof du?(this.abortReason=e.message,await this.middlewareRunner.runOnAbort(this.middlewareCtx,{reason:e.message,duration:Date.now()-this.streamStartTime})):(this.logger.errors("chat run failed",{error:e,threadId:this.middlewareCtx.threadId}),await this.middlewareRunner.runOnError(this.middlewareCtx,{error:e,duration:Date.now()-this.streamStartTime}))),!(e instanceof du))throw e}finally{!this.terminalHookCalled&&this.isCancelled()&&(this.terminalHookCalled=!0,await this.middlewareRunner.runOnAbort(this.middlewareCtx,{reason:this.abortReason,duration:Date.now()-this.streamStartTime})),this.deferredPromises.length>0&&await Promise.allSettled(this.deferredPromises)}}beforeRun(){this.streamStartTime=Date.now();let{tools:e,metadata:r}=this.params,o={};r!==void 0&&(o.metadata=r),this.eventOptions=Object.keys(o).length>0?o:void 0,this.eventToolNames=e?.map(n=>n.name),this.middlewareCtx.options=this.eventOptions,this.middlewareCtx.toolNames=this.eventToolNames}async beginCycle(){this.cyclePhase==="processText"&&await this.beginIteration()}endCycle(){if(this.cyclePhase==="processText"){this.cyclePhase="executeToolCalls";return}this.cyclePhase="processText",this.iterationCount++}async beginIteration(){this.currentMessageId=this.createId("msg"),this.accumulatedContent="",this.accumulatedThinking=[],this.currentThinkingContent="",this.currentThinkingSignature="",this.finishedEvent=null,this.middlewareCtx.currentMessageId=this.currentMessageId,this.middlewareCtx.accumulatedContent="",await this.middlewareRunner.runOnIteration(this.middlewareCtx,{iteration:this.iterationCount,messageId:this.currentMessageId})}async*streamModelResponse(){let{metadata:e,modelOptions:r}=this.params,n=this.tools.map(a=>({...a,inputSchema:a.inputSchema?Dg(a.inputSchema):void 0,outputSchema:a.outputSchema?Dg(a.outputSchema):void 0}));this.middlewareCtx.phase="modelStream";let i=this.adapter.provider??this.adapter.name;this.logger.request(`activity=chat provider=${i} model=${this.params.model} messages=${this.messages.length} tools=${this.tools.length} stream=true`,{provider:i,model:this.params.model,messageCount:this.messages.length,toolCount:this.tools.length});let s=this.finalStructuredOutput?.nativeCombined===!0?this.finalStructuredOutput.jsonSchema:void 0;for await(let a of this.adapter.chatStream({model:this.params.model,messages:this.messages,tools:n,metadata:e,request:this.effectiveRequest,modelOptions:r,systemPrompts:this.systemPrompts,logger:this.logger,threadId:this.threadId,runId:this.runIdOverride,parentRunId:this.parentRunIdOverride,...s?{outputSchema:s}:{}})){if(this.isCancelled())break;if(this.totalChunkCount++,this.handleStreamChunk(a),this.finalStructuredOutput?.nativeCombined===!0&&this.finalStructuredOutput.yieldChunks&&!this.combinedStartEmitted&&a.type===A.TEXT_MESSAGE_START){this.combinedStartEmitted=!0;let l=typeof a.messageId=="string"&&a.messageId!==""?a.messageId:pw();this.combinedStructuredMessageId=l;let p={type:A.CUSTOM,name:"structured-output.start",value:{messageId:l},model:this.params.model,timestamp:Date.now(),threadId:this.threadId,...this.runIdOverride?{runId:this.runIdOverride}:{}},f=await this.middlewareRunner.runOnChunk(this.middlewareCtx,p);for(let d of f)yield d,this.middlewareCtx.chunkIndex++}let c=await this.middlewareRunner.runOnChunk(this.middlewareCtx,a),u=!!this.finalStructuredOutput&&this.finalStructuredOutput.yieldChunks&&this.finalStructuredOutput.nativeCombined!==!0;for(let l of c)u&&(l.type===A.RUN_STARTED||l.type===A.RUN_FINISHED)||(this.logger.output(`type=${l.type}`,{chunk:l}),yield l,this.middlewareCtx.chunkIndex++);if(a.type==="RUN_FINISHED"&&a.usage&&await this.middlewareRunner.runOnUsage(this.middlewareCtx,a.usage),this.earlyTermination)break}}handleStreamChunk(e){switch(e.type){case"TEXT_MESSAGE_CONTENT":this.handleTextMessageContentEvent(e);break;case"TOOL_CALL_START":this.handleToolCallStartEvent(e);break;case"TOOL_CALL_ARGS":this.handleToolCallArgsEvent(e);break;case"TOOL_CALL_END":this.handleToolCallEndEvent(e);break;case"RUN_FINISHED":this.handleRunFinishedEvent(e);break;case"RUN_ERROR":this.handleRunErrorEvent(e);break;case"STEP_STARTED":this.handleStepStartedEvent();break;case"STEP_FINISHED":this.handleStepFinishedEvent(e);break}}handleTextMessageContentEvent(e){e.content?this.accumulatedContent=e.content:this.accumulatedContent+=e.delta,this.middlewareCtx.accumulatedContent=this.accumulatedContent}handleToolCallStartEvent(e){this.toolCallManager.addToolCallStartEvent(e)}handleToolCallArgsEvent(e){this.toolCallManager.addToolCallArgsEvent(e)}handleToolCallEndEvent(e){this.toolCallManager.completeToolCall(e)}handleRunFinishedEvent(e){this.finishedEvent=e,this.lastFinishReason=e.finishReason??null}handleRunErrorEvent(e){this.earlyTermination=!0}finalizeCurrentThinkingStep(){this.currentThinkingContent&&(this.accumulatedThinking.push({content:this.currentThinkingContent,...this.currentThinkingSignature&&{signature:this.currentThinkingSignature}}),this.currentThinkingContent="",this.currentThinkingSignature="")}handleStepStartedEvent(){this.finalizeCurrentThinkingStep()}handleStepFinishedEvent(e){e.delta&&(this.currentThinkingContent+=e.delta),e.signature&&(this.currentThinkingSignature=e.signature)}resolveExecutableTools(e){return this.lazyToolManager.getExecutableTools(this.tools,e.map(r=>r.function.name))}async*checkForPendingToolCalls(){let e=this.getPendingToolCallsFromMessages();if(e.length===0)return"continue";let r=this.createSyntheticFinishedEvent(),o=[],n=e.filter(p=>this.lazyToolManager.isUndiscoveredLazyTool(p.function.name)?(o.push({toolCallId:p.id,toolName:p.function.name,result:{error:this.lazyToolManager.getUndiscoveredToolError(p.function.name)},state:"output-error"}),!1):!0);if(o.length>0)for(let p of this.buildToolResultChunks(o,r))yield*this.pipeThroughMiddleware(p);if(n.length===0)return"continue";let{approvals:i,clientToolResults:s}=this.collectClientState(),a=VN(n,this.resolveExecutableTools(n),i,s,(p,f)=>this.createCustomEventChunk(p,f),{onBeforeToolCall:async(p,f,d)=>{this.logger.tools(`phase=before name=${p.function.name}`,{name:p.function.name,args:d});let m={toolCall:p,tool:f,args:d,toolName:p.function.name,toolCallId:p.id};return this.middlewareRunner.runOnBeforeToolCall(this.middlewareCtx,m)},onAfterToolCall:async p=>{this.logger.tools(`phase=after name=${p.toolName}`,{name:p.toolName,result:p.result}),await this.middlewareRunner.runOnAfterToolCall(this.middlewareCtx,p)}},this.middlewareCtx.context,this.toolAbortSignal),c=yield*this.drainToolCallGenerator(a);if(this.isMiddlewareAborted())return this.setToolPhase("stop"),"stop";await this.middlewareRunner.runOnToolPhaseComplete(this.middlewareCtx,{toolCalls:e,results:c.results,needsApproval:c.needsApproval,needsClientExecution:c.needsClientExecution});let u=new Map;for(let p of e)u.set(p.id,p.function.arguments);if(c.needsApproval.length>0||c.needsClientExecution.length>0){if(c.results.length>0)for(let p of this.buildToolResultChunks(c.results,r,u))yield*this.pipeThroughMiddleware(p);for(let p of this.buildApprovalChunks(c.needsApproval,r))yield*this.pipeThroughMiddleware(p);for(let p of this.buildClientToolChunks(c.needsClientExecution,r))yield*this.pipeThroughMiddleware(p);return this.setToolPhase("wait"),"wait"}let l=this.buildToolResultChunks(c.results,r,u);for(let p of l)yield*this.pipeThroughMiddleware(p);return"continue"}async*processToolCalls(){if(!this.shouldExecuteToolPhase()){this.setToolPhase("stop");return}let e=this.toolCallManager.getToolCalls(),r=this.finishedEvent;if(!r||e.length===0){this.setToolPhase("stop");return}this.addAssistantToolCallMessage(e);let o=[],n=e.filter(l=>this.lazyToolManager.isUndiscoveredLazyTool(l.function.name)?(o.push({toolCallId:l.id,toolName:l.function.name,result:{error:this.lazyToolManager.getUndiscoveredToolError(l.function.name)},state:"output-error"}),!1):!0);if(o.length>0&&this.finishedEvent)for(let l of this.buildToolResultChunks(o,this.finishedEvent))yield*this.pipeThroughMiddleware(l);if(n.length===0){this.toolCallManager.clear(),this.setToolPhase("continue");return}this.middlewareCtx.phase="beforeTools";let{approvals:i,clientToolResults:s}=this.collectClientState(),a=VN(n,this.resolveExecutableTools(n),i,s,(l,p)=>this.createCustomEventChunk(l,p),{onBeforeToolCall:async(l,p,f)=>{this.logger.tools(`phase=before name=${l.function.name}`,{name:l.function.name,args:f});let d={toolCall:l,tool:p,args:f,toolName:l.function.name,toolCallId:l.id};return this.middlewareRunner.runOnBeforeToolCall(this.middlewareCtx,d)},onAfterToolCall:async l=>{this.logger.tools(`phase=after name=${l.toolName}`,{name:l.toolName,result:l.result}),await this.middlewareRunner.runOnAfterToolCall(this.middlewareCtx,l)}},this.middlewareCtx.context,this.toolAbortSignal),c=yield*this.drainToolCallGenerator(a);if(this.middlewareCtx.phase="afterTools",this.isMiddlewareAborted()){this.setToolPhase("stop");return}if(await this.middlewareRunner.runOnToolPhaseComplete(this.middlewareCtx,{toolCalls:e,results:c.results,needsApproval:c.needsApproval,needsClientExecution:c.needsClientExecution}),c.needsApproval.length>0||c.needsClientExecution.length>0){if(c.results.length>0)for(let l of this.buildToolResultChunks(c.results,r))yield*this.pipeThroughMiddleware(l);for(let l of this.buildApprovalChunks(c.needsApproval,r))yield*this.pipeThroughMiddleware(l);for(let l of this.buildClientToolChunks(c.needsClientExecution,r))yield*this.pipeThroughMiddleware(l);this.setToolPhase("wait");return}let u=this.buildToolResultChunks(c.results,r);for(let l of u)yield*this.pipeThroughMiddleware(l);if(this.lazyToolManager.hasNewlyDiscoveredTools()){this.tools=this.lazyToolManager.getActiveTools(),this.toolCallManager=new zg(this.tools),this.setToolPhase("continue");return}this.toolCallManager.clear(),this.setToolPhase("continue")}shouldExecuteToolPhase(){return this.finishedEvent?.finishReason==="tool_calls"&&this.tools.length>0&&this.toolCallManager.hasToolCalls()}addAssistantToolCallMessage(e){this.finalizeCurrentThinkingStep(),this.messages=[...this.messages,{role:"assistant",content:this.accumulatedContent||null,toolCalls:e,...this.accumulatedThinking.length>0&&{thinking:this.accumulatedThinking}}]}extractClientStateFromOriginalMessages(e){let r=new Map,o=new Map;for(let n of e)if(n.role==="assistant"&&n.parts)for(let i of n.parts)i.type==="tool-call"&&(i.output!==void 0&&!i.approval&&o.set(i.id,i.output),i.approval?.id&&i.approval?.approved!==void 0&&i.state==="approval-responded"&&r.set(i.approval.id,i.approval.approved));return{approvals:r,clientToolResults:o}}collectClientState(){let e=new Map(this.initialApprovals),r=new Map(this.initialClientToolResults);for(let o of this.messages)if(o.role==="tool"&&o.toolCallId){let n;if(Array.isArray(o.content))n=o.content;else try{n=JSON.parse(o.content)}catch{n=o.content}if(n&&typeof n=="object"&&n.pendingExecution===!0)continue;r.set(o.toolCallId,n)}return{approvals:e,clientToolResults:r}}buildApprovalChunks(e,r){let o=[];for(let n of e)o.push({type:"CUSTOM",timestamp:Date.now(),model:r.model,name:"approval-requested",value:{toolCallId:n.toolCallId,toolName:n.toolName,input:n.input,approval:{id:n.approvalId,needsApproval:!0}}});return o}buildClientToolChunks(e,r){let o=[];for(let n of e)o.push({type:"CUSTOM",timestamp:Date.now(),model:r.model,name:"tool-input-available",value:{toolCallId:n.toolCallId,toolName:n.toolName,input:n.input}});return o}buildToolResultChunks(e,r,o){let n=[];for(let i of e){let s=gd(i.result),a=typeof s=="string"?s:JSON.stringify(s);if(o){n.push({type:"TOOL_CALL_START",timestamp:Date.now(),model:r.model,toolCallId:i.toolCallId,toolCallName:i.toolName,toolName:i.toolName});let l=o.get(i.toolCallId)??"{}";n.push({type:"TOOL_CALL_ARGS",timestamp:Date.now(),model:r.model,toolCallId:i.toolCallId,delta:l,args:l}),n.push({type:"TOOL_CALL_END",timestamp:Date.now(),model:r.model,toolCallId:i.toolCallId,toolCallName:i.toolName,toolName:i.toolName,result:a,...i.state!==void 0&&{state:i.state}})}n.push({type:"TOOL_CALL_RESULT",timestamp:Date.now(),model:r.model,messageId:this.createId("tool-result"),toolCallId:i.toolCallId,content:a,role:"tool",...i.state!==void 0&&{state:i.state}});let c=this.messages.findIndex(l=>{if(l.role!=="tool"||l.toolCallId!==i.toolCallId||typeof l.content!="string")return!1;try{return JSON.parse(l.content)?.pendingExecution===!0}catch{return!1}}),u={role:"tool",content:s,toolCallId:i.toolCallId};c>=0?this.messages=[...this.messages.slice(0,c),u,...this.messages.slice(c+1)]:this.messages=[...this.messages,u]}return n}getPendingToolCallsFromMessages(){let e=new Set;for(let o of this.messages)if(o.role==="tool"&&o.toolCallId){let n=!1;if(typeof o.content=="string")try{JSON.parse(o.content).pendingExecution===!0&&(n=!0)}catch{}n||e.add(o.toolCallId)}let r=[];for(let o of this.messages)if(o.role==="assistant"&&o.toolCalls)for(let n of o.toolCalls)e.has(n.id)||r.push(n);return r}createSyntheticFinishedEvent(){return{type:"RUN_FINISHED",runId:this.createId("pending"),threadId:this.threadId,model:this.params.model,timestamp:Date.now(),finishReason:"tool_calls"}}shouldContinue(){return this.cyclePhase==="executeToolCalls"?!0:this.loopStrategy({iterationCount:this.iterationCount,messages:this.messages,finishReason:this.lastFinishReason})&&this.toolPhase==="continue"}isAborted(){return!!this.effectiveSignal?.aborted}isMiddlewareAborted(){return!!this.middlewareAbortController?.signal.aborted}isCancelled(){return this.isAborted()||this.isMiddlewareAborted()}async*runStructuredFinalization(){if(!this.finalStructuredOutput)throw new Error("runStructuredFinalization called without finalStructuredOutput config");this.middlewareCtx.phase="structuredOutput";let e=this.buildMiddlewareConfig(),{tools:r,...o}=e,n={...o,outputSchema:this.finalStructuredOutput.jsonSchema};n=await this.middlewareRunner.runOnStructuredOutputConfig(this.middlewareCtx,n);let{outputSchema:i,...s}=n,a=await this.middlewareRunner.runOnConfig(this.middlewareCtx,{...s,tools:e.tools});this.applyMiddlewareConfig(a);let c={chatOptions:{model:this.params.model,messages:this.messages,metadata:a.metadata,modelOptions:a.modelOptions,systemPrompts:a.systemPrompts,logger:this.logger,threadId:this.threadId,runId:this.runIdOverride,parentRunId:this.parentRunIdOverride,...this.effectiveRequest?{request:this.effectiveRequest}:{}},outputSchema:i},u,l=this.adapter.structuredOutputStream?this.adapter.structuredOutputStream(c):eye(this.adapter,c,v=>{u=v}),p=!1,f=null,d=v=>(v.type===A.TEXT_MESSAGE_START||v.type===A.TEXT_MESSAGE_CONTENT||v.type===A.TEXT_MESSAGE_END)&&typeof v.messageId=="string"&&v.messageId!==""?v.messageId:null,m=()=>{let v=f??pw();return f=v,{type:A.CUSTOM,name:"structured-output.start",value:{messageId:v},model:this.params.model,timestamp:Date.now(),threadId:this.threadId,...this.runIdOverride?{runId:this.runIdOverride}:{}}},g=async v=>this.middlewareRunner.runOnChunk(this.middlewareCtx,v),y=!1;for await(let v of l){if(this.isCancelled())break;if(!p&&v.type===A.CUSTOM&&v.name==="structured-output.start"&&(p=!0),!f){let S=d(v);S&&(f=S)}if(this.finalStructuredOutput.yieldChunks){if(!p&&(v.type===A.TEXT_MESSAGE_START||v.type===A.TEXT_MESSAGE_CONTENT||v.type===A.TEXT_MESSAGE_END)){p=!0;let S=m(),P=await g(S);for(let D of P)yield D,this.middlewareCtx.chunkIndex++}if(!p&&v.type===A.RUN_ERROR){p=!0;let S=m(),P=await g(S);for(let D of P)yield D,this.middlewareCtx.chunkIndex++}}let E=v;if(v.type===A.CUSTOM&&v.name==="structured-output.complete"){let S=Qge(v.value);if(S){let P=this.finalStructuredOutput.normalize?this.finalStructuredOutput.normalize(S.object):S.object;this.structuredOutputResult={data:P,rawText:S.raw};let D=v.value;P!==S.object&&D&&typeof D=="object"&&(E={...v,value:{...D,object:P}})}}v.type===A.RUN_FINISHED&&v.usage&&await this.middlewareRunner.runOnUsage(this.middlewareCtx,v.usage),v.type===A.RUN_ERROR&&(this.finalizationError={message:v.message,...v.code?{code:v.code}:{},...u!==void 0?{cause:u}:{}});let R=await this.middlewareRunner.runOnChunk(this.middlewareCtx,E);if(this.finalStructuredOutput.yieldChunks)for(let S of R)S.type===A.RUN_ERROR&&(y=!0),yield S,this.middlewareCtx.chunkIndex++;if(this.finalizationError)break}if(!this.isCancelled()){if(!this.structuredOutputResult&&!this.finalizationError&&(this.finalizationError={message:"missing structured result",code:"structured-output-missing-result"}),this.structuredOutputResult&&!this.finalizationError&&this.finalStructuredOutput.validate)try{let v=this.finalStructuredOutput.validate(this.structuredOutputResult.data);this.validatedStructuredOutput=v,this.hasValidatedStructuredOutput=!0}catch(v){let E=v instanceof Error?v.message:String(v);this.finalizationError={message:E,code:"structured-output-validation-failed",cause:v}}if(this.finalizationError&&this.finalStructuredOutput.yieldChunks&&!y){if(!p){let R=m(),S=await g(R);for(let P of S)yield P,this.middlewareCtx.chunkIndex++;p=!0}let v={type:A.RUN_ERROR,runId:this.runIdOverride??this.requestId,model:this.params.model,timestamp:Date.now(),threadId:this.threadId,message:this.finalizationError.message,...this.finalizationError.code?{code:this.finalizationError.code}:{},error:{message:this.finalizationError.message,...this.finalizationError.code?{code:this.finalizationError.code}:{}}},E=await this.middlewareRunner.runOnChunk(this.middlewareCtx,v);for(let R of E)yield R,this.middlewareCtx.chunkIndex++}}}async*harvestCombinedStructuredOutput(){if(!this.finalStructuredOutput)throw new Error("harvestCombinedStructuredOutput called without finalStructuredOutput config");let e=this.finalStructuredOutput.yieldChunks,r=this.accumulatedContent;if(r.length===0)this.finalizationError={message:"missing structured result",code:"structured-output-missing-result"};else try{let o=JSON.parse(r),n=this.finalStructuredOutput.normalize?this.finalStructuredOutput.normalize(o):o;this.structuredOutputResult={data:n,rawText:r}}catch(o){let n=r.slice(0,200)+(r.length>200?"...":"");this.finalizationError={message:`Failed to parse structured output as JSON. Content: ${n}`,code:"structured-output-parse-failed",cause:o}}if(this.structuredOutputResult&&!this.finalizationError&&this.finalStructuredOutput.validate)try{let o=this.finalStructuredOutput.validate(this.structuredOutputResult.data);this.validatedStructuredOutput=o,this.hasValidatedStructuredOutput=!0}catch(o){let n=o instanceof Error?o.message:String(o);this.finalizationError={message:n,code:"structured-output-validation-failed",cause:o}}if(e){if(!this.combinedStartEmitted){this.combinedStartEmitted=!0;let o=this.combinedStructuredMessageId??pw();this.combinedStructuredMessageId=o;let n={type:A.CUSTOM,name:"structured-output.start",value:{messageId:o},model:this.params.model,timestamp:Date.now(),threadId:this.threadId,...this.runIdOverride?{runId:this.runIdOverride}:{}},i=await this.middlewareRunner.runOnChunk(this.middlewareCtx,n);for(let s of i)yield s,this.middlewareCtx.chunkIndex++}if(this.structuredOutputResult&&!this.finalizationError){let o={type:A.CUSTOM,name:"structured-output.complete",value:{object:this.structuredOutputResult.data,raw:this.structuredOutputResult.rawText,...this.combinedStructuredMessageId?{messageId:this.combinedStructuredMessageId}:{}},model:this.params.model,timestamp:Date.now(),threadId:this.threadId,...this.runIdOverride?{runId:this.runIdOverride}:{}},n=await this.middlewareRunner.runOnChunk(this.middlewareCtx,o);for(let i of n)yield i,this.middlewareCtx.chunkIndex++}if(this.finalizationError){let o={type:A.RUN_ERROR,runId:this.runIdOverride??this.requestId,model:this.params.model,timestamp:Date.now(),threadId:this.threadId,message:this.finalizationError.message,...this.finalizationError.code?{code:this.finalizationError.code}:{},error:{message:this.finalizationError.message,...this.finalizationError.code?{code:this.finalizationError.code}:{}}},n=await this.middlewareRunner.runOnChunk(this.middlewareCtx,o);for(let i of n)yield i,this.middlewareCtx.chunkIndex++}}}buildMiddlewareConfig(){return{messages:this.messages,systemPrompts:[...this.systemPrompts],tools:[...this.tools],metadata:this.params.metadata,modelOptions:this.params.modelOptions}}applyMiddlewareConfig(e){this.messages=e.messages,this.systemPrompts=e.systemPrompts,this.tools=e.tools,this.params={...this.params,metadata:e.metadata,modelOptions:e.modelOptions},this.middlewareCtx.messages=this.messages,this.middlewareCtx.systemPrompts=this.systemPrompts,this.middlewareCtx.hasTools=this.tools.length>0,this.middlewareCtx.toolNames=this.tools.map(r=>r.name),this.middlewareCtx.modelOptions=e.modelOptions}setToolPhase(e){this.toolPhase=e}async*pipeThroughMiddleware(e){let r=await this.middlewareRunner.runOnChunk(this.middlewareCtx,e);for(let o of r)yield o,this.middlewareCtx.chunkIndex++}async*drainToolCallGenerator(e){let r=await e.next();for(;!r.done;)yield*this.pipeThroughMiddleware(r.value),r=await e.next();return r.value}createCustomEventChunk(e,r){return{type:"CUSTOM",timestamp:Date.now(),model:this.params.model,name:e,value:r}}createId(e){return`${e}-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}};function Od(t){eJ(t.middleware??[],t.adapter);let{outputSchema:e,stream:r}=t;return e&&r===!0?tye({...t,outputSchema:e,stream:r}):e?Xge({...t,outputSchema:e}):r===!1?Yge({...t,outputSchema:void 0,stream:r}):xJ({...t,outputSchema:void 0,stream:r})}async function*xJ(t){let{adapter:e,middleware:r,context:o,debug:n,mcp:i,...s}=t,a=e.model,c=uw(n),u=xd.from(i),l=await u.discover();l.length>0&&(s.tools=[...s.tools??[],...l]);let p=new qg({adapter:e,params:{...s,model:a,logger:c},middleware:r,context:o},c);try{for await(let f of p.run())yield f}finally{await u.dispose()}}function Yge(t){let e=xJ(t);return UK(e)}async function Xge(t){let{adapter:e,outputSchema:r,middleware:o,context:n,debug:i,mcp:s,...a}=t,c=e.model,u=uw(i);if(!r)throw new Error("outputSchema is required for structured output");let{jsonSchema:l,nullWideningMap:p}=ZN(r);if(!l)throw new Error("Failed to convert output schema to JSON Schema");let f=P=>cw(P,p),d=mo(r)?P=>va(r,P):void 0,m=e.supportsCombinedToolsAndSchema?.(t.modelOptions)===!0,g=xd.from(s),y=await g.discover();y.length>0&&(a.tools=[...a.tools??[],...y]);let v=new qg({adapter:e,params:{...a,model:c,logger:u},middleware:o,context:n,finalStructuredOutput:{jsonSchema:l,yieldChunks:!1,normalize:f,...d?{validate:d}:{},...m?{nativeCombined:!0}:{}}},u);try{for await(let P of v.run());}finally{await g.dispose()}let E=v.getFinalizationError();if(E){let P=new Error(E.message,E.cause!==void 0?{cause:E.cause}:void 0);throw E.code!==void 0&&Object.defineProperty(P,"code",{value:E.code,enumerable:!0}),P}let R=v.getValidatedStructuredOutput();if(R)return R.value;let S=v.getStructuredOutputResult();if(!S)throw new Error("structured output finalization produced no result");return S.data}function Qge(t){if(typeof t!="object"||t===null||!("object"in t)||!("raw"in t))return null;let e=t.raw;if(typeof e!="string")return null;let r=t.reasoning,o=typeof r=="string"?r:void 0;return{object:t.object,raw:e,...o!==void 0?{reasoning:o}:{}}}async function*eye(t,e,r){let{chatOptions:o}=e,n=Math.random().toString(36).slice(2),i=o.runId??`fallback-${Date.now()}-${n}`,s=o.threadId??`fallback-${Date.now()}-${n}`,a=`fallback-${Date.now()}-${n}`,c=o.model,u=Date.now();yield{type:A.RUN_STARTED,runId:i,threadId:s,model:c,timestamp:u};let l;try{l=await t.structuredOutput(e)}catch(p){r?.(p);let f=p instanceof Error?p.message:String(p);yield{type:A.RUN_ERROR,runId:i,threadId:s,model:c,timestamp:u,message:f,error:{message:f}};return}yield{type:A.TEXT_MESSAGE_START,messageId:a,role:"assistant",model:c,timestamp:u},yield{type:A.TEXT_MESSAGE_CONTENT,messageId:a,delta:l.rawText,model:c,timestamp:u},yield{type:A.TEXT_MESSAGE_END,messageId:a,model:c,timestamp:u},yield{type:A.CUSTOM,name:"structured-output.complete",value:{object:l.data,raw:l.rawText},model:c,timestamp:u},yield{type:A.RUN_FINISHED,runId:i,threadId:s,model:c,timestamp:u,finishReason:"stop",...l.usage?{usage:l.usage}:{}}}function tye(t){let{outputSchema:e}=t;if(!e)throw new Error("outputSchema is required for streaming structured output");let{jsonSchema:r,nullWideningMap:o}=ZN(e);if(!r)throw new Error("Failed to convert output schema to JSON Schema");return rye(t,r,i=>cw(i,o))}async function*rye(t,e,r){let{adapter:o,outputSchema:n,middleware:i,context:s,debug:a,mcp:c,...u}=t,l=o.model,p=uw(a),f=o.supportsCombinedToolsAndSchema?.(t.modelOptions)===!0,d=xd.from(c),m=await d.discover();m.length>0&&(u.tools=[...u.tools??[],...m]);let g=new qg({adapter:o,params:{...u,model:l,logger:p},middleware:i,context:s,finalStructuredOutput:{jsonSchema:e,yieldChunks:!0,normalize:r,...f?{nativeCombined:!0}:{}}},p);try{for await(let y of g.run())yield y}finally{await d.dispose()}}function vw(t){return{__toolSide:"definition",...t,server(r){return{__toolSide:"server",...t,execute:r}},client(r){return{__toolSide:"client",...t,...r!==void 0&&{execute:r}}}}}function Sw(t){return{promptTokens:t.promptTokens,completionTokens:t.completionTokens,totalTokens:t.totalTokens}}function Hg(t){return!t||t.length===0?[]:t.map((e,r)=>{if(typeof e=="string")return{content:e};let o=e;if(o===null||typeof o!="object")throw new TypeError(`systemPrompts[${r}]: expected a string or { content, metadata? }, got ${o===null?"null":typeof o}`);let{content:n}=o;if(typeof n!="string")throw new TypeError(`systemPrompts[${r}]: content must be a string, got ${typeof n}`);return e})}function le(t,e,r,o,n){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?n.call(t,r):n?n.value=r:e.set(t,r),r}function O(t,e,r,o){if(r==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?o:r==="a"?o.call(t):o?o.value:e.get(t)}var QN=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return QN=t.randomUUID.bind(t),t.randomUUID();let e=new Uint8Array(1),r=t?()=>t.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,o=>(+o^r()&15>>+o/4).toString(16))};function Bg(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}var Wg=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null){try{if(Object.prototype.toString.call(t)==="[object Error]"){let e=new Error(t.message,t.cause?{cause:t.cause}:{});return t.stack&&(e.stack=t.stack),t.cause&&!e.cause&&(e.cause=t.cause),t.name&&(e.name=t.name),e}}catch{}try{return new Error(JSON.stringify(t))}catch{}}return new Error(t)};var J=class extends Error{},Ot=class t extends J{constructor(e,r,o,n){super(`${t.makeMessage(e,r,o)}`),this.status=e,this.headers=n,this.requestID=n?.get("x-request-id"),this.error=r;let i=r;this.code=i?.code,this.param=i?.param,this.type=i?.type}static makeMessage(e,r,o){let n=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):o;return e&&n?`${e} ${n}`:e?`${e} status code (no body)`:n||"(no status code or body)"}static generate(e,r,o,n){if(!e||!n)return new Ia({message:o,cause:Wg(r)});let i=r?.error;return e===400?new Cd(e,i,o,n):e===401?new Rd(e,i,o,n):e===403?new Ad(e,i,o,n):e===404?new Td(e,i,o,n):e===409?new $d(e,i,o,n):e===422?new Pd(e,i,o,n):e===429?new Nd(e,i,o,n):e>=500?new Md(e,i,o,n):new t(e,i,o,n)}},zt=class extends Ot{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},Ia=class extends Ot{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},Oa=class extends Ia{constructor({message:e}={}){super({message:e??"Request timed out."})}},Cd=class extends Ot{},Rd=class extends Ot{},Ad=class extends Ot{},Td=class extends Ot{},$d=class extends Ot{},Pd=class extends Ot{},Nd=class extends Ot{},Md=class extends Ot{},Dd=class extends J{constructor(){super("Could not parse response content as the length limit was reached")}},Fd=class extends J{constructor(){super("Could not parse response content as the request was rejected by the content filter")}},ii=class extends Error{constructor(e){super(e)}},Ru=class extends Ot{constructor(e,r,o){let n="OAuth2 authentication error",i;if(r&&typeof r=="object"){let s=r;i=s.error;let a=s.error_description;a&&typeof a=="string"?n=a:i&&(n=i)}super(e,r,n,o),this.error_code=i}},Zg=class extends J{constructor(e,r,o){super(e),this.provider=r,this.cause=o}};var oye=/^[a-z][a-z0-9+.-]*:/i,_J=t=>oye.test(t),wr=t=>(wr=Array.isArray,wr(t)),eM=wr;function ww(t){return typeof t!="object"?{}:t??{}}function tM(t){if(!t)return!0;for(let e in t)return!1;return!0}function bJ(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Gg(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var vJ=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new J(`${t} must be an integer`);if(e<0)throw new J(`${t} must be a positive integer`);return e};var SJ=t=>{try{return JSON.parse(t)}catch{return}};var si=t=>new Promise(e=>setTimeout(e,t));var Ca="6.45.0";var IJ=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function iye(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}var sye=()=>{let t=iye();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ca,"X-Stainless-OS":EJ(Deno.build.os),"X-Stainless-Arch":wJ(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ca,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(t==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ca,"X-Stainless-OS":EJ(globalThis.process.platform??"unknown"),"X-Stainless-Arch":wJ(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=aye();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ca,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ca,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function aye(){if(typeof navigator>"u"||!navigator)return null;let t=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:r}of t){let o=r.exec(navigator.userAgent);if(o){let n=o[1]||0,i=o[2]||0,s=o[3]||0;return{browser:e,version:`${n}.${i}.${s}`}}}return null}var wJ=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",EJ=t=>(t=t.toLowerCase(),t.includes("ios")?"iOS":t==="android"?"Android":t==="darwin"?"MacOS":t==="win32"?"Windows":t==="freebsd"?"FreeBSD":t==="openbsd"?"OpenBSD":t==="linux"?"Linux":t?`Other:${t}`:"Unknown"),kJ,OJ=()=>kJ??(kJ=sye());function Ew(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function rM(...t){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...t)}function kw(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return rM({start(){},async pull(r){let{done:o,value:n}=await e.next();o?r.close():r.enqueue(n)},async cancel(){await e.return?.()}})}function nM(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function oM(t){if(t===null||typeof t!="object")return;if(t[Symbol.asyncIterator]){await t[Symbol.asyncIterator]().return?.();return}let e=t.getReader(),r=e.cancel();e.releaseLock(),await r}var RJ=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)});var iM="RFC3986",sM=t=>String(t),aM={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:sM},AJ="RFC1738";var Iw=(t,e)=>(Iw=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),Iw(t,e)),ai=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})();var cM=1024,TJ=(t,e,r,o,n)=>{if(t.length===0)return t;let i=t;if(typeof t=="symbol"?i=Symbol.prototype.toString.call(t):typeof t!="string"&&(i=String(t)),r==="iso-8859-1")return escape(i).replace(/%u[0-9a-f]{4}/gi,function(a){return"%26%23"+parseInt(a.slice(2),16)+"%3B"});let s="";for(let a=0;a<i.length;a+=cM){let c=i.length>=cM?i.slice(a,a+cM):i,u=[];for(let l=0;l<c.length;++l){let p=c.charCodeAt(l);if(p===45||p===46||p===95||p===126||p>=48&&p<=57||p>=65&&p<=90||p>=97&&p<=122||n===AJ&&(p===40||p===41)){u[u.length]=c.charAt(l);continue}if(p<128){u[u.length]=ai[p];continue}if(p<2048){u[u.length]=ai[192|p>>6]+ai[128|p&63];continue}if(p<55296||p>=57344){u[u.length]=ai[224|p>>12]+ai[128|p>>6&63]+ai[128|p&63];continue}l+=1,p=65536+((p&1023)<<10|c.charCodeAt(l)&1023),u[u.length]=ai[240|p>>18]+ai[128|p>>12&63]+ai[128|p>>6&63]+ai[128|p&63]}s+=u.join("")}return s};function $J(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function uM(t,e){if(wr(t)){let r=[];for(let o=0;o<t.length;o+=1)r.push(e(t[o]));return r}return e(t)}var NJ={brackets(t){return String(t)+"[]"},comma:"comma",indices(t,e){return String(t)+"["+e+"]"},repeat(t){return String(t)}},MJ=function(t,e){Array.prototype.push.apply(t,wr(e)?e:[e])},PJ,Gt={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:TJ,encodeValuesOnly:!1,format:iM,formatter:sM,indices:!1,serializeDate(t){return(PJ??(PJ=Function.prototype.call.bind(Date.prototype.toISOString)))(t)},skipNulls:!1,strictNullHandling:!1};function uye(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"}var lM={};function DJ(t,e,r,o,n,i,s,a,c,u,l,p,f,d,m,g,y,v){let E=t,R=v,S=0,P=!1;for(;(R=R.get(lM))!==void 0&&!P;){let ue=R.get(t);if(S+=1,typeof ue<"u"){if(ue===S)throw new RangeError("Cyclic object value");P=!0}typeof R.get(lM)>"u"&&(S=0)}if(typeof u=="function"?E=u(e,E):E instanceof Date?E=f?.(E):r==="comma"&&wr(E)&&(E=uM(E,function(ue){return ue instanceof Date?f?.(ue):ue})),E===null){if(i)return c&&!g?c(e,Gt.encoder,y,"key",d):e;E=""}if(uye(E)||$J(E)){if(c){let ue=g?e:c(e,Gt.encoder,y,"key",d);return[m?.(ue)+"="+m?.(c(E,Gt.encoder,y,"value",d))]}return[m?.(e)+"="+m?.(String(E))]}let D=[];if(typeof E>"u")return D;let X;if(r==="comma"&&wr(E))g&&c&&(E=uM(E,c)),X=[{value:E.length>0?E.join(",")||null:void 0}];else if(wr(u))X=u;else{let ue=Object.keys(E);X=l?ue.sort(l):ue}let N=a?String(e).replace(/\./g,"%2E"):String(e),ie=o&&wr(E)&&E.length===1?N+"[]":N;if(n&&wr(E)&&E.length===0)return ie+"[]";for(let ue=0;ue<X.length;++ue){let W=X[ue],Ae=typeof W=="object"&&typeof W.value<"u"?W.value:E[W];if(s&&Ae===null)continue;let ge=p&&a?W.replace(/\./g,"%2E"):W,De=wr(E)?typeof r=="function"?r(ie,ge):ie:ie+(p?"."+ge:"["+ge+"]");v.set(t,S);let He=new WeakMap;He.set(lM,v),MJ(D,DJ(Ae,De,r,o,n,i,s,a,r==="comma"&&g&&wr(E)?null:c,u,l,p,f,d,m,g,y,He))}return D}function lye(t=Gt){if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");let e=t.charset||Gt.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let r=iM;if(typeof t.format<"u"){if(!Iw(aM,t.format))throw new TypeError("Unknown format option provided.");r=t.format}let o=aM[r],n=Gt.filter;(typeof t.filter=="function"||wr(t.filter))&&(n=t.filter);let i;if(t.arrayFormat&&t.arrayFormat in NJ?i=t.arrayFormat:"indices"in t?i=t.indices?"indices":"repeat":i=Gt.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let s=typeof t.allowDots>"u"?t.encodeDotInKeys?!0:Gt.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:Gt.addQueryPrefix,allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Gt.allowEmptyArrays,arrayFormat:i,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Gt.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?Gt.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:Gt.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:Gt.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:Gt.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:Gt.encodeValuesOnly,filter:n,format:r,formatter:o,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:Gt.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:Gt.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Gt.strictNullHandling}}function FJ(t,e={}){let r=t,o=lye(e),n,i;typeof o.filter=="function"?(i=o.filter,r=i("",r)):wr(o.filter)&&(i=o.filter,n=i);let s=[];if(typeof r!="object"||r===null)return"";let a=NJ[o.arrayFormat],c=a==="comma"&&o.commaRoundTrip;n||(n=Object.keys(r)),o.sort&&n.sort(o.sort);let u=new WeakMap;for(let f=0;f<n.length;++f){let d=n[f];o.skipNulls&&r[d]===null||MJ(s,DJ(r[d],d,a,c,o.allowEmptyArrays,o.strictNullHandling,o.skipNulls,o.encodeDotInKeys,o.encode?o.encoder:null,o.filter,o.sort,o.allowDots,o.serializeDate,o.format,o.formatter,o.encodeValuesOnly,o.charset,u))}let l=s.join(o.delimiter),p=o.addQueryPrefix===!0?"?":"";return o.charsetSentinel&&(o.charset==="iso-8859-1"?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),l.length>0?p+l:""}function zJ(t){return FJ(t,{arrayFormat:"brackets"})}function UJ(t){let e=0;for(let n of t)e+=n.length;let r=new Uint8Array(e),o=0;for(let n of t)r.set(n,o),o+=n.length;return r}var jJ;function zd(t){let e;return(jJ??(e=new globalThis.TextEncoder,jJ=e.encode.bind(e)))(t)}var LJ;function pM(t){let e;return(LJ??(e=new globalThis.TextDecoder,LJ=e.decode.bind(e)))(t)}var kn,In,Au=class{constructor(){kn.set(this,void 0),In.set(this,void 0),le(this,kn,new Uint8Array,"f"),le(this,In,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?zd(e):e;le(this,kn,UJ([O(this,kn,"f"),r]),"f");let o=[],n;for(;(n=dye(O(this,kn,"f"),O(this,In,"f")))!=null;){if(n.carriage&&O(this,In,"f")==null){le(this,In,n.index,"f");continue}if(O(this,In,"f")!=null&&(n.index!==O(this,In,"f")+1||n.carriage)){o.push(pM(O(this,kn,"f").subarray(0,O(this,In,"f")-1))),le(this,kn,O(this,kn,"f").subarray(O(this,In,"f")),"f"),le(this,In,null,"f");continue}let i=O(this,In,"f")!==null?n.preceding-1:n.preceding,s=pM(O(this,kn,"f").subarray(0,i));o.push(s),le(this,kn,O(this,kn,"f").subarray(n.index),"f"),le(this,In,null,"f")}return o}flush(){return O(this,kn,"f").length?this.decode(`
|
|
119
|
+
`):[]}};kn=new WeakMap,In=new WeakMap;Au.NEWLINE_CHARS=new Set([`
|
|
120
|
+
`,"\r"]);Au.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function dye(t,e){for(let n=e??0;n<t.length;n++){if(t[n]===10)return{preceding:n,index:n+1,carriage:!1};if(t[n]===13)return{preceding:n,index:n+1,carriage:!0}}return null}function qJ(t){for(let o=0;o<t.length-1;o++){if(t[o]===10&&t[o+1]===10||t[o]===13&&t[o+1]===13)return o+2;if(t[o]===13&&t[o+1]===10&&o+3<t.length&&t[o+2]===13&&t[o+3]===10)return o+4}return-1}var Cw={off:0,error:200,warn:300,info:400,debug:500},dM=(t,e,r)=>{if(t){if(bJ(Cw,t))return t;$t(r).warn(`${e} was set to ${JSON.stringify(t)}, expected one of ${JSON.stringify(Object.keys(Cw))}`)}};function Vg(){}function Ow(t,e,r){return!e||Cw[t]>Cw[r]?Vg:e[t].bind(e)}var fye={error:Vg,warn:Vg,info:Vg,debug:Vg},HJ=new WeakMap;function $t(t){let e=t.logger,r=t.logLevel??"off";if(!e)return fye;let o=HJ.get(e);if(o&&o[0]===r)return o[1];let n={error:Ow("error",e,r),warn:Ow("warn",e,r),info:Ow("info",e,r),debug:Ow("debug",e,r)};return HJ.set(e,[r,n]),n}var ps=t=>(t.options&&(t.options={...t.options},delete t.options.headers),t.headers&&(t.headers=Object.fromEntries((t.headers instanceof Headers?[...t.headers]:Object.entries(t.headers)).map(([e,r])=>[e,e.toLowerCase()==="authorization"||e.toLowerCase()==="api-key"||e.toLowerCase()==="x-api-key"||e.toLowerCase()==="x-amz-security-token"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":r]))),"retryOfRequestLogID"in t&&(t.retryOfRequestLogID&&(t.retryOf=t.retryOfRequestLogID),delete t.retryOfRequestLogID),t);var Kg,ci=class t{constructor(e,r,o){this.iterator=e,Kg.set(this,void 0),this.controller=r,le(this,Kg,o,"f")}static fromSSEResponse(e,r,o,n){let i=!1,s=o?$t(o):console;async function*a(){if(i)throw new J("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let c=!1;try{for await(let u of mye(e,r))if(!c){if(u.data.startsWith("[DONE]")){c=!0;continue}if(u.event===null||!u.event.startsWith("thread.")){let l;try{l=JSON.parse(u.data)}catch(p){throw s.error("Could not parse message into JSON:",u.data),s.error("From chunk:",u.raw),p}if(l&&l.error)throw new Ot(void 0,l.error,void 0,e.headers);yield n?{event:u.event,data:l}:l}else{let l;try{l=JSON.parse(u.data)}catch(p){throw console.error("Could not parse message into JSON:",u.data),console.error("From chunk:",u.raw),p}if(u.event=="error")throw new Ot(void 0,l.error,l.message,void 0);yield{event:u.event,data:l}}}c=!0}catch(u){if(Bg(u))return;throw u}finally{c||r.abort()}}return new t(a,r,o)}static fromReadableStream(e,r,o){let n=!1;async function*i(){let a=new Au,c=nM(e);for await(let u of c)for(let l of a.decode(u))yield l;for(let u of a.flush())yield u}async function*s(){if(n)throw new J("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let a=!1;try{for await(let c of i())a||c&&(yield JSON.parse(c));a=!0}catch(c){if(Bg(c))return;throw c}finally{a||r.abort()}}return new t(s,r,o)}[(Kg=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let e=[],r=[],o=this.iterator(),n=i=>({next:()=>{if(i.length===0){let s=o.next();e.push(s),r.push(s)}return i.shift()}});return[new t(()=>n(e),this.controller,O(this,Kg,"f")),new t(()=>n(r),this.controller,O(this,Kg,"f"))]}toReadableStream(){let e=this,r;return rM({async start(){r=e[Symbol.asyncIterator]()},async pull(o){try{let{value:n,done:i}=await r.next();if(i)return o.close();let s=zd(JSON.stringify(n)+`
|
|
121
|
+
`);o.enqueue(s)}catch(n){o.error(n)}},async cancel(){await r.return?.()}})}};async function*mye(t,e){if(!t.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new J("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new J("Attempted to iterate over a response with no body");let r=new fM,o=new Au,n=nM(t.body);for await(let i of hye(n))for(let s of o.decode(i)){let a=r.decode(s);a&&(yield a)}for(let i of o.flush()){let s=r.decode(i);s&&(yield s)}}async function*hye(t){let e=new Uint8Array;for await(let r of t){if(r==null)continue;let o=r instanceof ArrayBuffer?new Uint8Array(r):typeof r=="string"?zd(r):r,n=new Uint8Array(e.length+o.length);n.set(e),n.set(o,e.length),e=n;let i;for(;(i=qJ(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}var fM=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let i={event:this.event,data:this.data.join(`
|
|
122
|
+
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],i}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,o,n]=gye(e,":");return n.startsWith(" ")&&(n=n.substring(1)),r==="event"?this.event=n:r==="data"&&this.data.push(n),null}};function gye(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}async function Rw(t,e){let{response:r,requestLogID:o,retryOfRequestLogID:n,startTime:i}=e,s=await(async()=>{if(e.options.stream)return $t(t).debug("response",r.status,r.url,r.headers,r.body),e.options.__streamClass?e.options.__streamClass.fromSSEResponse(r,e.controller,t,e.options.__synthesizeEventData):ci.fromSSEResponse(r,e.controller,t,e.options.__synthesizeEventData);if(r.status===204)return null;if(e.options.__binaryResponse)return r;let c=r.headers.get("content-type")?.split(";")[0]?.trim();if(c?.includes("application/json")||c?.endsWith("+json")){if(r.headers.get("content-length")==="0")return;let f=await r.json();return mM(f,r)}return await r.text()})();return $t(t).debug(`[${o}] response parsed`,ps({retryOfRequestLogID:n,url:r.url,status:r.status,body:s,durationMs:Date.now()-i})),s}function mM(t,e){return!t||typeof t!="object"||Array.isArray(t)?t:Object.defineProperty(t,"_request_id",{value:e.headers.get("x-request-id"),enumerable:!1})}var Jg,Tu=class t extends Promise{constructor(e,r,o=Rw){super(n=>{n(null)}),this.responsePromise=r,this.parseResponse=o,Jg.set(this,void 0),le(this,Jg,e,"f")}_thenUnwrap(e){return new t(O(this,Jg,"f"),this.responsePromise,async(r,o)=>mM(e(await this.parseResponse(r,o),o),o.response))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r,request_id:r.headers.get("x-request-id")}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(O(this,Jg,"f"),e))),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};Jg=new WeakMap;var Aw,jd=class{constructor(e,r,o,n){Aw.set(this,void 0),le(this,Aw,e,"f"),this.options=n,this.response=r,this.body=o}hasNextPage(){return this.getPaginatedItems().length?this.nextPageRequestOptions()!=null:!1}async getNextPage(){let e=this.nextPageRequestOptions();if(!e)throw new J("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await O(this,Aw,"f").requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Aw=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},Yg=class extends Tu{constructor(e,r,o){super(e,r,async(n,i)=>new o(n,i.response,await Rw(n,i),i.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},Er=class extends jd{constructor(e,r,o,n){super(e,r,o,n),this.data=o.data||[],this.object=o.object}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){return null}},ve=class extends jd{constructor(e,r,o,n){super(e,r,o,n),this.data=o.data||[],this.has_more=o.has_more||!1}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){let e=this.getPaginatedItems(),r=e[e.length-1]?.id;return r?{...this.options,query:{...ww(this.options.query),after:r}}:null}},qe=class extends jd{constructor(e,r,o,n){super(e,r,o,n),this.data=o.data||[],this.has_more=o.has_more||!1,this.last_id=o.last_id||""}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){let e=this.last_id;return e?{...this.options,query:{...ww(this.options.query),after:e}}:null}},jt=class extends jd{constructor(e,r,o,n){super(e,r,o,n),this.data=o.data||[],this.has_more=o.has_more||!1,this.next=o.next||null}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){let e=this.next;return e?{...this.options,query:{...ww(this.options.query),after:e}}:null}};var xye={jwt:"urn:ietf:params:oauth:token-type:jwt",id:"urn:ietf:params:oauth:token-type:id_token"},_ye="urn:ietf:params:oauth:grant-type:token-exchange",Tw=class{constructor(e,r){this.cachedToken=null,this.refreshPromise=null,this.tokenExchangeUrl="https://auth.openai.com/oauth/token",this.config=e,this.fetch=r??Ew()}async getToken(){if(!this.cachedToken||this.isTokenExpired(this.cachedToken)){if(this.refreshPromise)return await this.refreshPromise;this.refreshPromise=this.refreshToken();try{return await this.refreshPromise}finally{this.refreshPromise=null}}return this.needsRefresh(this.cachedToken)&&!this.refreshPromise&&(this.refreshPromise=this.refreshToken().finally(()=>{this.refreshPromise=null})),this.cachedToken.token}async refreshToken(){let e=await this.config.provider.getToken(),r={grant_type:_ye,subject_token:e,subject_token_type:xye[this.config.provider.tokenType],identity_provider_id:this.config.identityProviderId,service_account_id:this.config.serviceAccountId};this.config.clientId&&(r.client_id=this.config.clientId);let o=await this.fetch(this.tokenExchangeUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok){let c=await o.text(),u;try{u=JSON.parse(c)}catch{}throw o.status===400||o.status===401||o.status===403?new Ru(o.status,u,o.headers):Ot.generate(o.status,u,`Token exchange failed with status ${o.status}`,o.headers)}let n=await o.json();if(typeof n!="object"||n===null||!("access_token"in n)||typeof n.access_token!="string"||n.access_token.trim().length===0)throw new J("Token exchange response missing 'access_token' field");let i=n.access_token,s=n.expires_in??3600,a=Date.now()+s*1e3;return this.cachedToken={token:i,expiresAt:a},i}isTokenExpired(e){return Date.now()>=e.expiresAt}needsRefresh(e){let o=(this.config.refreshBufferSeconds??1200)*1e3;return Date.now()>=e.expiresAt-o}invalidateToken(){this.cachedToken=null,this.refreshPromise=null}};var yM=()=>{if(typeof File>"u"){let{process:t}=globalThis,e=typeof t?.versions?.node=="string"&&parseInt(t.versions.node.split("."))<20;throw new Error("`File` is not defined as a global, which is required for file uploads."+(e?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function Ld(t,e,r){return yM(),new File(t,e??"unknown_file",r)}function Xg(t){return(typeof t=="object"&&t!==null&&("name"in t&&t.name&&String(t.name)||"url"in t&&t.url&&String(t.url)||"filename"in t&&t.filename&&String(t.filename)||"path"in t&&t.path&&String(t.path))||"").split(/[\\/]/).pop()||void 0}var $w=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",Ra=async(t,e)=>hM(t.body)?{...t,body:await WJ(t.body,e)}:t,kr=async(t,e)=>({...t,body:await WJ(t.body,e)}),BJ=new WeakMap;function bye(t){let e=typeof t=="function"?t:t.fetch,r=BJ.get(e);if(r)return r;let o=(async()=>{try{let n="Response"in e?e.Response:(await e("data:,")).constructor,i=new FormData;return i.toString()!==await new n(i).text()}catch{return!0}})();return BJ.set(e,o),o}var WJ=async(t,e)=>{if(!await bye(e))throw new TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let r=new FormData;return await Promise.all(Object.entries(t||{}).map(([o,n])=>gM(r,o,n))),r},ZJ=t=>t instanceof Blob&&"name"in t,vye=t=>typeof t=="object"&&t!==null&&(t instanceof Response||$w(t)||ZJ(t)),hM=t=>{if(vye(t))return!0;if(Array.isArray(t))return t.some(hM);if(t&&typeof t=="object"){for(let e in t)if(hM(t[e]))return!0}return!1},gM=async(t,e,r)=>{if(r!==void 0){if(r==null)throw new TypeError(`Received null for "${e}"; to pass null in FormData, you must use the string 'null'`);if(typeof r=="string"||typeof r=="number"||typeof r=="boolean")t.append(e,String(r));else if(r instanceof Response)t.append(e,Ld([await r.blob()],Xg(r)));else if($w(r))t.append(e,Ld([await new Response(kw(r)).blob()],Xg(r)));else if(ZJ(r))t.append(e,r,Xg(r));else if(Array.isArray(r))await Promise.all(r.map(o=>gM(t,e+"[]",o)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([o,n])=>gM(t,`${e}[${o}]`,n)));else throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${r} instead`)}};var GJ=t=>t!=null&&typeof t=="object"&&typeof t.size=="number"&&typeof t.type=="string"&&typeof t.text=="function"&&typeof t.slice=="function"&&typeof t.arrayBuffer=="function",Sye=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&GJ(t),wye=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function";async function Pw(t,e,r){if(yM(),t=await t,Sye(t))return t instanceof File?t:Ld([await t.arrayBuffer()],t.name);if(wye(t)){let n=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()),Ld(await xM(n),e,r)}let o=await xM(t);if(e||(e=Xg(t)),!r?.type){let n=o.find(i=>typeof i=="object"&&"type"in i&&i.type);typeof n=="string"&&(r={...r,type:n})}return Ld(o,e,r)}async function xM(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(GJ(t))e.push(t instanceof Blob?t:await t.arrayBuffer());else if($w(t))for await(let r of t)e.push(...await xM(r));else{let r=t?.constructor?.name;throw new Error(`Unexpected data type: ${typeof t}${r?`; constructor: ${r}`:""}${Eye(t)}`)}return e}function Eye(t){return typeof t!="object"||t===null?"":`; props: [${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}var k=class{constructor(e){this._client=e}};function KJ(t){return t.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var VJ=Object.freeze(Object.create(null)),Iye=(t=KJ)=>function(r,...o){if(r.length===1)return r[0];let n=!1,i=[],s=r.reduce((l,p,f)=>{/[?#]/.test(p)&&(n=!0);let d=o[f],m=(n?encodeURIComponent:t)(""+d);return f!==o.length&&(d==null||typeof d=="object"&&d.toString===Object.getPrototypeOf(Object.getPrototypeOf(d.hasOwnProperty??VJ)??VJ)?.toString)&&(m=d+"",i.push({start:l.length+p.length,length:m.length,error:`Value of type ${Object.prototype.toString.call(d).slice(8,-1)} is not a valid path parameter`})),l+p+(f===o.length?"":m)},""),a=s.split(/[?#]/,1)[0],c=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,u;for(;(u=c.exec(a))!==null;)i.push({start:u.index,length:u[0].length,error:`Value "${u[0]}" can't be safely passed as a path parameter`});if(i.sort((l,p)=>l.start-p.start),i.length>0){let l=0,p=i.reduce((f,d)=>{let m=" ".repeat(d.start-l),g="^".repeat(d.length);return l=d.start+d.length,f+m+g},"");throw new J(`Path parameters result in path with invalid segments:
|
|
123
|
+
${i.map(f=>f.error).join(`
|
|
124
|
+
`)}
|
|
125
|
+
${s}
|
|
126
|
+
${p}`)}return s},_=Iye(KJ);var $u=class extends k{list(e,r={},o){return this._client.getAPIList(_`/chat/completions/${e}/messages`,ve,{query:r,...o,__security:{bearerAuth:!0}})}};function Qg(t){return t!==void 0&&"function"in t&&t.function!==void 0}function ey(t){return t?.$brand==="auto-parseable-response-format"}function Pu(t){return t?.$brand==="auto-parseable-tool"}function YJ(t,e){return!e||!_M(e)?{...t,choices:t.choices.map(r=>(QJ(r.message.tool_calls),{...r,message:{...r.message,parsed:null,...r.message.tool_calls?{tool_calls:r.message.tool_calls}:void 0}}))}:ty(t,e)}function ty(t,e){let r=t.choices.map(o=>{if(o.finish_reason==="length")throw new Dd;if(o.finish_reason==="content_filter")throw new Fd;return QJ(o.message.tool_calls),{...o,message:{...o.message,...o.message.tool_calls?{tool_calls:o.message.tool_calls?.map(n=>Rye(e,n))??void 0}:void 0,parsed:o.message.content&&!o.message.refusal?Cye(e,o.message.content):null}}});return{...t,choices:r}}function Cye(t,e){return t.response_format?.type!=="json_schema"?null:t.response_format?.type==="json_schema"?"$parseRaw"in t.response_format?t.response_format.$parseRaw(e):JSON.parse(e):null}function Rye(t,e){let r=t.tools?.find(o=>Qg(o)&&o.function?.name===e.function.name);return{...e,function:{...e.function,parsed_arguments:Pu(r)?r.$parseRaw(e.function.arguments):r?.function.strict?JSON.parse(e.function.arguments):null}}}function XJ(t,e){if(!t||!("tools"in t)||!t.tools)return!1;let r=t.tools?.find(o=>Qg(o)&&o.function?.name===e.function.name);return Qg(r)&&(Pu(r)||r?.function.strict||!1)}function _M(t){return ey(t.response_format)?!0:t.tools?.some(e=>Pu(e)||e.type==="function"&&e.function.strict===!0)??!1}function QJ(t){for(let e of t||[])if(e.type!=="function")throw new J(`Currently only \`function\` tool calls are supported; Received \`${e.type}\``)}function e3(t){for(let e of t??[]){if(e.type!=="function")throw new J(`Currently only \`function\` tool types support auto-parsing; Received \`${e.type}\``);if(e.function.strict!==!0)throw new J(`The \`${e.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var Ud=t=>t?.role==="assistant",bM=t=>t?.role==="tool";var Nw,Mw,Dw,ry,ny,Fw,oy,ds,zw,iy,jw,Lw,qd,t3,r3,Aa=class{constructor(){Nw.add(this),this.controller=new AbortController,Mw.set(this,void 0),Dw.set(this,()=>{}),ry.set(this,()=>{}),ny.set(this,void 0),Fw.set(this,()=>{}),oy.set(this,()=>{}),ds.set(this,{}),zw.set(this,[]),iy.set(this,!1),jw.set(this,!1),Lw.set(this,!1),qd.set(this,!1),le(this,Mw,new Promise((e,r)=>{le(this,Dw,e,"f"),le(this,ry,r,"f")}),"f"),le(this,ny,new Promise((e,r)=>{le(this,Fw,e,"f"),le(this,oy,r,"f")}),"f"),O(this,Mw,"f").catch(()=>{}),O(this,ny,"f").catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit("end")},O(this,Nw,"m",r3).bind(this))},0)}_connected(){this.ended||(O(this,Dw,"f").call(this),this._emit("connect"))}get ended(){return O(this,iy,"f")}get errored(){return O(this,jw,"f")}get aborted(){return O(this,Lw,"f")}abort(){this.controller.abort()}_listenForAbort(e){if(!e||this.ended)return;if(e.aborted){this.controller.abort();return}let r=()=>this.controller.abort();e.addEventListener("abort",r,{once:!0}),O(this,zw,"f").push({signal:e,listener:r})}on(e,r){return(O(this,ds,"f")[e]||(O(this,ds,"f")[e]=[])).push({listener:r}),this}off(e,r){let o=O(this,ds,"f")[e];if(!o)return this;let n=o.findIndex(i=>i.listener===r);return n>=0&&o.splice(n,1),this}once(e,r){return(O(this,ds,"f")[e]||(O(this,ds,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,o)=>{le(this,qd,!0,"f"),e!=="error"&&this.once("error",o),this.once(e,r)})}async done(){le(this,qd,!0,"f"),await O(this,ny,"f")}_emit(e,...r){if(O(this,iy,"f"))return;e==="end"&&(O(this,Nw,"m",t3).call(this),le(this,iy,!0,"f"),O(this,Fw,"f").call(this));let o=O(this,ds,"f")[e];if(o&&(O(this,ds,"f")[e]=o.filter(n=>!n.once),o.forEach(({listener:n})=>n(...r))),e==="abort"){let n=r[0];!O(this,qd,"f")&&!o?.length&&Promise.reject(n),O(this,ry,"f").call(this,n),O(this,oy,"f").call(this,n),this._emit("end");return}if(e==="error"){let n=r[0];!O(this,qd,"f")&&!o?.length&&Promise.reject(n),O(this,ry,"f").call(this,n),O(this,oy,"f").call(this,n),this._emit("end")}}_emitFinal(){}};Mw=new WeakMap,Dw=new WeakMap,ry=new WeakMap,ny=new WeakMap,Fw=new WeakMap,oy=new WeakMap,ds=new WeakMap,zw=new WeakMap,iy=new WeakMap,jw=new WeakMap,Lw=new WeakMap,qd=new WeakMap,Nw=new WeakSet,t3=function(){for(let{signal:e,listener:r}of O(this,zw,"f").splice(0))e.removeEventListener("abort",r)},r3=function(e){if(le(this,jw,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new zt),e instanceof zt)return le(this,Lw,!0,"f"),this._emit("abort",e);if(e instanceof J)return this._emit("error",e);if(e instanceof Error){let r=new J(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new J(String(e)))};function n3(t){return typeof t.parse=="function"}var Ur,vM,Uw,SM,wM,EM,o3,i3,Aye=10,Hd=class extends Aa{constructor(){super(...arguments),Ur.add(this),this._chatCompletions=[],this.messages=[]}_addChatCompletion(e){this._chatCompletions.push(e),this._emit("chatCompletion",e);let r=e.choices[0]?.message;return r&&this._addMessage(r),e}_addMessage(e,r=!0){if("content"in e||(e.content=null),this.messages.push(e),r){if(this._emit("message",e),bM(e)&&e.content)this._emit("functionToolCallResult",e.content);else if(Ud(e)&&e.tool_calls)for(let o of e.tool_calls)o.type==="function"&&this._emit("functionToolCall",o.function)}}async finalChatCompletion(){await this.done();let e=this._chatCompletions[this._chatCompletions.length-1];if(!e)throw new J("stream ended without producing a ChatCompletion");return e}async finalContent(){return await this.done(),O(this,Ur,"m",vM).call(this)}async finalMessage(){return await this.done(),O(this,Ur,"m",Uw).call(this)}async finalFunctionToolCall(){return await this.done(),O(this,Ur,"m",SM).call(this)}async finalFunctionToolCallResult(){return await this.done(),O(this,Ur,"m",wM).call(this)}async totalUsage(){return await this.done(),O(this,Ur,"m",EM).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit("finalChatCompletion",e);let r=O(this,Ur,"m",Uw).call(this);r&&this._emit("finalMessage",r);let o=O(this,Ur,"m",vM).call(this);o&&this._emit("finalContent",o);let n=O(this,Ur,"m",SM).call(this);n&&this._emit("finalFunctionToolCall",n);let i=O(this,Ur,"m",wM).call(this);i!=null&&this._emit("finalFunctionToolCallResult",i),this._chatCompletions.some(s=>s.usage)&&this._emit("totalUsage",O(this,Ur,"m",EM).call(this))}async _createChatCompletion(e,r,o){this._listenForAbort(o?.signal),O(this,Ur,"m",o3).call(this,r);let n=await e.chat.completions.create({...r,stream:!1},{...o,signal:this.controller.signal});return this._connected(),this._addChatCompletion(ty(n,r))}async _runChatCompletion(e,r,o){for(let n of r.messages)this._addMessage(n,!1);return await this._createChatCompletion(e,r,o)}async _runTools(e,r,o,n){let i="tool",{tool_choice:s="auto",stream:a,...c}=r,u=typeof s!="string"&&s.type==="function"&&s?.function?.name,{maxChatCompletions:l=Aye,afterCompletion:p}=n||{},f=r.tools.map(y=>{if(Pu(y)){if(!y.$callback)throw new J("Tool given to `.runTools()` that does not have an associated function");return{type:"function",function:{function:y.$callback,name:y.function.name,description:y.function.description||"",parameters:y.function.parameters,parse:y.$parseRaw,strict:!0}}}return y}),d={};for(let y of f)y.type==="function"&&(d[y.function.name||y.function.function.name]=y.function);let m="tools"in r?f.map(y=>y.type==="function"?{type:"function",function:{name:y.function.name||y.function.function.name,parameters:y.function.parameters,description:y.function.description,strict:y.function.strict}}:y):void 0;for(let y of r.messages)this._addMessage(y,!1);let g=async y=>{if(y.type!=="function")return{message:void 0,functionCalled:!1};let v=y.id,{name:E,arguments:R}=y.function,S=d[E];if(!S){let X=`Invalid tool_call: ${JSON.stringify(E)}. Available options are: ${Object.keys(d).map(N=>JSON.stringify(N)).join(", ")}. Please try again`;return{message:{role:i,tool_call_id:v,content:X},functionCalled:!1}}if(u&&u!==E){let X=`Invalid tool_call: ${JSON.stringify(E)}. ${JSON.stringify(u)} requested. Please try again`;return{message:{role:i,tool_call_id:v,content:X},functionCalled:!1}}let P;if(n3(S)){let X;try{X=await S.parse(R)}catch(N){let ie=N instanceof Error?N.message:String(N);return{message:{role:i,tool_call_id:v,content:ie},functionCalled:!1}}P=await S.function(X,o)}else P=await S.function(R,o);let D=O(this,Ur,"m",i3).call(this,P);return{message:{role:i,tool_call_id:v,content:D},functionCalled:!0}};for(let y=0;y<l;++y){let v=await this._createChatCompletion(e,{...c,tool_choice:s,tools:m,messages:[...this.messages]},n),E=v.choices[0]?.message;if(!E)throw new J("missing message in ChatCompletion response");if(!E.tool_calls?.length){await p?.(v,o);return}if(u||r.parallel_tool_calls===!1)for(let R of E.tool_calls){let S=await g(R);if(S.message&&this._addMessage(S.message),u&&S.functionCalled){await p?.(v,o);return}}else{let R=await Promise.allSettled(E.tool_calls.map(g));for(let S of R)if(S.status==="rejected")throw S.reason;for(let S of R)S.status==="fulfilled"&&S.value.message&&this._addMessage(S.value.message)}await p?.(v,o)}}};Ur=new WeakSet,vM=function(){return O(this,Ur,"m",Uw).call(this).content??null},Uw=function(){let e=this.messages.length;for(;e-- >0;){let r=this.messages[e];if(Ud(r))return{...r,content:r.content??null,refusal:r.refusal??null}}throw new J("stream ended without producing a ChatCompletionMessage with role=assistant")},SM=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(Ud(r)&&r?.tool_calls?.length)for(let o=r.tool_calls.length-1;o>=0;o--){let n=r.tool_calls[o];if(n?.type==="function")return n.function}}},wM=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(bM(r)&&r.content!=null&&typeof r.content=="string"&&this.messages.some(o=>o.role==="assistant"&&o.tool_calls?.some(n=>n.type==="function"&&n.id===r.tool_call_id)))return r.content}},EM=function(){let e={completion_tokens:0,prompt_tokens:0,total_tokens:0};for(let{usage:r}of this._chatCompletions)r&&(e.completion_tokens+=r.completion_tokens,e.prompt_tokens+=r.prompt_tokens,e.total_tokens+=r.total_tokens);return e},o3=function(e){if(e.n!=null&&e.n>1)throw new J("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},i3=function(e){return typeof e=="string"?e:e===void 0?"undefined":JSON.stringify(e)};var sy=class t extends Hd{static runTools(e,r,o){let n=new t,i={...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"runTools"}};return n._run(()=>n._runTools(e,r,n,i)),n}_addMessage(e,r=!0){super._addMessage(e,r),Ud(e)&&e.content&&this._emit("content",e.content)}};var Qt={STR:1,NUM:2,ARR:4,OBJ:8,NULL:16,BOOL:32,NAN:64,INFINITY:128,MINUS_INFINITY:256,INF:384,SPECIAL:496,ATOM:499,COLLECTION:12,ALL:511},kM=class extends Error{},IM=class extends Error{};function Tye(t,e=Qt.ALL){if(typeof t!="string")throw new TypeError(`expecting str, got ${typeof t}`);if(!t.trim())throw new Error(`${t} is empty`);return $ye(t.trim(),e)}var $ye=(t,e)=>{let r=t.length,o=0,n=f=>{throw new kM(`${f} at position ${o}`)},i=f=>{throw new IM(`${f} at position ${o}`)},s=()=>(p(),o>=r&&n("Unexpected end of input"),t[o]==='"'?a():t[o]==="{"?c():t[o]==="["?u():t.substring(o,o+4)==="null"||Qt.NULL&e&&r-o<4&&"null".startsWith(t.substring(o))?(o+=4,null):t.substring(o,o+4)==="true"||Qt.BOOL&e&&r-o<4&&"true".startsWith(t.substring(o))?(o+=4,!0):t.substring(o,o+5)==="false"||Qt.BOOL&e&&r-o<5&&"false".startsWith(t.substring(o))?(o+=5,!1):t.substring(o,o+8)==="Infinity"||Qt.INFINITY&e&&r-o<8&&"Infinity".startsWith(t.substring(o))?(o+=8,1/0):t.substring(o,o+9)==="-Infinity"||Qt.MINUS_INFINITY&e&&1<r-o&&r-o<9&&"-Infinity".startsWith(t.substring(o))?(o+=9,-1/0):t.substring(o,o+3)==="NaN"||Qt.NAN&e&&r-o<3&&"NaN".startsWith(t.substring(o))?(o+=3,NaN):l()),a=()=>{let f=o,d=!1;for(o++;o<r&&(t[o]!=='"'||d&&t[o-1]==="\\");)d=t[o]==="\\"?!d:!1,o++;if(t.charAt(o)=='"')try{return JSON.parse(t.substring(f,++o-Number(d)))}catch(m){i(String(m))}else if(Qt.STR&e)try{return JSON.parse(t.substring(f,o-Number(d))+'"')}catch{return JSON.parse(t.substring(f,t.lastIndexOf("\\"))+'"')}n("Unterminated string literal")},c=()=>{o++,p();let f={};try{for(;t[o]!=="}";){if(p(),o>=r&&Qt.OBJ&e)return f;let d=a();p(),o++;try{let m=s();Object.defineProperty(f,d,{value:m,writable:!0,enumerable:!0,configurable:!0})}catch(m){if(Qt.OBJ&e)return f;throw m}p(),t[o]===","&&o++}}catch{if(Qt.OBJ&e)return f;n("Expected '}' at end of object")}return o++,f},u=()=>{o++;let f=[];try{for(;t[o]!=="]";)f.push(s()),p(),t[o]===","&&o++}catch{if(Qt.ARR&e)return f;n("Expected ']' at end of array")}return o++,f},l=()=>{if(o===0){t==="-"&&Qt.NUM&e&&n("Not sure what '-' is");try{return JSON.parse(t)}catch(d){if(Qt.NUM&e)try{return t[t.length-1]==="."?JSON.parse(t.substring(0,t.lastIndexOf("."))):JSON.parse(t.substring(0,t.lastIndexOf("e")))}catch{}i(String(d))}}let f=o;for(t[o]==="-"&&o++;t[o]&&!",]}".includes(t[o]);)o++;o==r&&!(Qt.NUM&e)&&n("Unterminated number literal");try{return JSON.parse(t.substring(f,o))}catch{t.substring(f,o)==="-"&&Qt.NUM&e&&n("Not sure what '-' is");try{return JSON.parse(t.substring(f,t.lastIndexOf("e")))}catch(m){i(String(m))}}},p=()=>{for(;o<r&&`
|
|
127
|
+
\r `.includes(t[o]);)o++};return s()},OM=t=>Tye(t,Qt.ALL^Qt.NUM);var Vt,fs,Bd,Ta,CM,qw,RM,AM,TM,Hw,$M,s3,Nu=class t extends Hd{constructor(e){super(),Vt.add(this),fs.set(this,void 0),Bd.set(this,void 0),Ta.set(this,void 0),le(this,fs,e,"f"),le(this,Bd,[],"f")}get currentChatCompletionSnapshot(){return O(this,Ta,"f")}static fromReadableStream(e){let r=new t(null);return r._run(()=>r._fromReadableStream(e)),r}static createChatCompletion(e,r,o){let n=new t(r);return n._run(()=>n._runChatCompletion(e,{...r,stream:!0},{...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"stream"}})),n}async _createChatCompletion(e,r,o){super._createChatCompletion,this._listenForAbort(o?.signal),O(this,Vt,"m",CM).call(this);let n=await e.chat.completions.create({...r,stream:!0},{...o,signal:this.controller.signal});this._connected();for await(let i of n)O(this,Vt,"m",RM).call(this,i);if(n.controller.signal?.aborted)throw new zt;return this._addChatCompletion(O(this,Vt,"m",Hw).call(this))}async _fromReadableStream(e,r){this._listenForAbort(r?.signal),O(this,Vt,"m",CM).call(this),this._connected();let o=ci.fromReadableStream(e,this.controller),n;for await(let i of o)n&&n!==i.id&&this._addChatCompletion(O(this,Vt,"m",Hw).call(this)),O(this,Vt,"m",RM).call(this,i),n=i.id;if(o.controller.signal?.aborted)throw new zt;return this._addChatCompletion(O(this,Vt,"m",Hw).call(this))}[(fs=new WeakMap,Bd=new WeakMap,Ta=new WeakMap,Vt=new WeakSet,CM=function(){this.ended||le(this,Ta,void 0,"f")},qw=function(r){let o=O(this,Bd,"f")[r.index];return o||(o={content_done:!1,refusal_done:!1,logprobs_content_done:!1,logprobs_refusal_done:!1,done_tool_calls:new Set,current_tool_call_index:null},O(this,Bd,"f")[r.index]=o,o)},RM=function(r){if(this.ended)return;let o=O(this,Vt,"m",s3).call(this,r);this._emit("chunk",r,o);for(let n of r.choices){let i=o.choices[n.index];n.delta.content!=null&&i.message?.role==="assistant"&&i.message?.content&&(this._emit("content",n.delta.content,i.message.content),this._emit("content.delta",{delta:n.delta.content,snapshot:i.message.content,parsed:i.message.parsed})),n.delta.refusal!=null&&i.message?.role==="assistant"&&i.message?.refusal&&this._emit("refusal.delta",{delta:n.delta.refusal,snapshot:i.message.refusal}),n.logprobs?.content!=null&&i.message?.role==="assistant"&&this._emit("logprobs.content.delta",{content:n.logprobs?.content,snapshot:i.logprobs?.content??[]}),n.logprobs?.refusal!=null&&i.message?.role==="assistant"&&this._emit("logprobs.refusal.delta",{refusal:n.logprobs?.refusal,snapshot:i.logprobs?.refusal??[]});let s=O(this,Vt,"m",qw).call(this,i);i.finish_reason&&(O(this,Vt,"m",TM).call(this,i),s.current_tool_call_index!=null&&O(this,Vt,"m",AM).call(this,i,s.current_tool_call_index));for(let a of n.delta.tool_calls??[])s.current_tool_call_index!==a.index&&(O(this,Vt,"m",TM).call(this,i),s.current_tool_call_index!=null&&O(this,Vt,"m",AM).call(this,i,s.current_tool_call_index)),s.current_tool_call_index=a.index;for(let a of n.delta.tool_calls??[]){let c=i.message.tool_calls?.[a.index];c?.type&&(c?.type==="function"?this._emit("tool_calls.function.arguments.delta",{name:c.function?.name,index:a.index,arguments:c.function.arguments,parsed_arguments:c.function.parsed_arguments,arguments_delta:a.function?.arguments??""}):(c?.type,void 0))}}},AM=function(r,o){if(O(this,Vt,"m",qw).call(this,r).done_tool_calls.has(o))return;let i=r.message.tool_calls?.[o];if(!i)throw new Error("no tool call snapshot");if(!i.type)throw new Error("tool call snapshot missing `type`");if(i.type==="function"){let s=O(this,fs,"f")?.tools?.find(a=>Qg(a)&&a.function.name===i.function.name);this._emit("tool_calls.function.arguments.done",{name:i.function.name,index:o,arguments:i.function.arguments,parsed_arguments:Pu(s)?s.$parseRaw(i.function.arguments):s?.function.strict?JSON.parse(i.function.arguments):null})}else i.type},TM=function(r){let o=O(this,Vt,"m",qw).call(this,r);if(r.message.content&&!o.content_done){o.content_done=!0;let n=O(this,Vt,"m",$M).call(this);this._emit("content.done",{content:r.message.content,parsed:n?n.$parseRaw(r.message.content):null})}r.message.refusal&&!o.refusal_done&&(o.refusal_done=!0,this._emit("refusal.done",{refusal:r.message.refusal})),r.logprobs?.content&&!o.logprobs_content_done&&(o.logprobs_content_done=!0,this._emit("logprobs.content.done",{content:r.logprobs.content})),r.logprobs?.refusal&&!o.logprobs_refusal_done&&(o.logprobs_refusal_done=!0,this._emit("logprobs.refusal.done",{refusal:r.logprobs.refusal}))},Hw=function(){if(this.ended)throw new J("stream has ended, this shouldn't happen");let r=O(this,Ta,"f");if(!r)throw new J("request ended without sending any chunks");return le(this,Ta,void 0,"f"),le(this,Bd,[],"f"),Pye(r,O(this,fs,"f"))},$M=function(){let r=O(this,fs,"f")?.response_format;return ey(r)?r:null},s3=function(r){var o,n,i,s;let a=O(this,Ta,"f"),{choices:c,...u}=r;a?Object.assign(a,u):a=le(this,Ta,{...u,choices:[]},"f");for(let{delta:l,finish_reason:p,index:f,logprobs:d=null,...m}of r.choices){let g=a.choices[f];if(g||(g=a.choices[f]={finish_reason:p,index:f,message:{},logprobs:d,...m}),d)if(!g.logprobs)g.logprobs=Object.assign({},d);else{let{content:D,refusal:X,...N}=d;Object.assign(g.logprobs,N),D&&((o=g.logprobs).content??(o.content=[]),g.logprobs.content.push(...D)),X&&((n=g.logprobs).refusal??(n.refusal=[]),g.logprobs.refusal.push(...X))}if(p&&(g.finish_reason=p,O(this,fs,"f")&&_M(O(this,fs,"f")))){if(p==="length")throw new Dd;if(p==="content_filter")throw new Fd}if(Object.assign(g,m),!l)continue;let{content:y,refusal:v,function_call:E,role:R,tool_calls:S,...P}=l;if(Object.assign(g.message,P),v&&(g.message.refusal=(g.message.refusal||"")+v),R&&(g.message.role=R),E&&(g.message.function_call?(E.name&&(g.message.function_call.name=E.name),E.arguments&&((i=g.message.function_call).arguments??(i.arguments=""),g.message.function_call.arguments+=E.arguments)):g.message.function_call=E),y&&(g.message.content=(g.message.content||"")+y,!g.message.refusal&&O(this,Vt,"m",$M).call(this)&&(g.message.parsed=g.message.content.trim()?OM(g.message.content):null)),S){g.message.tool_calls||(g.message.tool_calls=[]);for(let{index:D,id:X,type:N,function:ie,...ue}of S){let W=(s=g.message.tool_calls)[D]??(s[D]={});Object.assign(W,ue),X&&(W.id=X),N&&(W.type=N),ie&&(W.function??(W.function={name:ie.name??"",arguments:""})),ie?.name&&(W.function.name=ie.name),ie?.arguments&&(W.function.arguments+=ie.arguments,XJ(O(this,fs,"f"),W)&&(W.function.parsed_arguments=OM(W.function.arguments)))}}}return a},Symbol.asyncIterator)](){let e=[],r=[],o=!1;return this.on("chunk",n=>{let i=r.shift();i?i.resolve(n):e.push(n)}),this.on("end",()=>{o=!0;for(let n of r)n.resolve(void 0);r.length=0}),this.on("abort",n=>{o=!0;for(let i of r)i.reject(n);r.length=0}),this.on("error",n=>{o=!0;for(let i of r)i.reject(n);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:o?{value:void 0,done:!0}:new Promise((i,s)=>r.push({resolve:i,reject:s})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new ci(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};function Pye(t,e){let{id:r,choices:o,created:n,model:i,system_fingerprint:s,...a}=t,c={...a,id:r,choices:o.map(({message:u,finish_reason:l,index:p,logprobs:f,...d})=>{if(!l)throw new J(`missing finish_reason for choice ${p}`);let{content:m=null,function_call:g,tool_calls:y,...v}=u,E=u.role;if(!E)throw new J(`missing role for choice ${p}`);if(g){let{arguments:R,name:S}=g;if(R==null)throw new J(`missing function_call.arguments for choice ${p}`);if(!S)throw new J(`missing function_call.name for choice ${p}`);return{...d,message:{content:m,function_call:{arguments:R,name:S},role:E,refusal:u.refusal??null},finish_reason:l,index:p,logprobs:f}}return y?{...d,index:p,finish_reason:l,logprobs:f,message:{...v,role:E,content:m,refusal:u.refusal??null,tool_calls:y.map((R,S)=>{let{function:P,type:D,id:X,...N}=R,{arguments:ie,name:ue,...W}=P||{};if(X==null)throw new J(`missing choices[${p}].tool_calls[${S}].id
|
|
128
|
+
${Bw(t)}`);if(D==null)throw new J(`missing choices[${p}].tool_calls[${S}].type
|
|
129
|
+
${Bw(t)}`);if(ue==null)throw new J(`missing choices[${p}].tool_calls[${S}].function.name
|
|
130
|
+
${Bw(t)}`);if(ie==null)throw new J(`missing choices[${p}].tool_calls[${S}].function.arguments
|
|
131
|
+
${Bw(t)}`);return{...N,id:X,type:D,function:{...W,name:ue,arguments:ie}}})}}:{...d,message:{...v,content:m,role:E,refusal:u.refusal??null},finish_reason:l,index:p,logprobs:f}}),created:n,model:i,object:"chat.completion",...s?{system_fingerprint:s}:{}};return YJ(c,e)}function Bw(t){return JSON.stringify(t)}var ay=class t extends Nu{static fromReadableStream(e){let r=new t(null);return r._run(()=>r._fromReadableStream(e)),r}static runTools(e,r,o){let n=new t(r),i={...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"runTools"}};return n._run(()=>n._runTools(e,r,n,i)),n}};var ms=class extends k{constructor(){super(...arguments),this.messages=new $u(this._client)}create(e,r){return this._client.post("/chat/completions",{body:e,...r,stream:e.stream??!1,__security:{bearerAuth:!0}})}retrieve(e,r){return this._client.get(_`/chat/completions/${e}`,{...r,__security:{bearerAuth:!0}})}update(e,r,o){return this._client.post(_`/chat/completions/${e}`,{body:r,...o,__security:{bearerAuth:!0}})}list(e={},r){return this._client.getAPIList("/chat/completions",ve,{query:e,...r,__security:{bearerAuth:!0}})}delete(e,r){return this._client.delete(_`/chat/completions/${e}`,{...r,__security:{bearerAuth:!0}})}parse(e,r){return e3(e.tools),this._client.chat.completions.create(e,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"chat.completions.parse"}})._thenUnwrap(o=>ty(o,e))}runTools(e,r){return e.stream?ay.runTools(this._client,e,r):sy.runTools(this._client,e,r)}stream(e,r){return Nu.createChatCompletion(this._client,e,r)}};ms.Messages=$u;var $a=class extends k{constructor(){super(...arguments),this.completions=new ms(this._client)}};$a.Completions=ms;var Wd=class extends k{create(e,r){return this._client.post("/organization/admin_api_keys",{body:e,...r,__security:{adminAPIKeyAuth:!0}})}retrieve(e,r){return this._client.get(_`/organization/admin_api_keys/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}list(e={},r){return this._client.getAPIList("/organization/admin_api_keys",ve,{query:e,...r,__security:{adminAPIKeyAuth:!0}})}delete(e,r){return this._client.delete(_`/organization/admin_api_keys/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}};var Zd=class extends k{list(e={},r){return this._client.getAPIList("/organization/audit_logs",qe,{query:e,...r,__security:{adminAPIKeyAuth:!0}})}};var Gd=class extends k{create(e,r){return this._client.post("/organization/certificates",{body:e,...r,__security:{adminAPIKeyAuth:!0}})}retrieve(e,r={},o){return this._client.get(_`/organization/certificates/${e}`,{query:r,...o,__security:{adminAPIKeyAuth:!0}})}update(e,r,o){return this._client.post(_`/organization/certificates/${e}`,{body:r,...o,__security:{adminAPIKeyAuth:!0}})}list(e={},r){return this._client.getAPIList("/organization/certificates",qe,{query:e,...r,__security:{adminAPIKeyAuth:!0}})}delete(e,r){return this._client.delete(_`/organization/certificates/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}activate(e,r){return this._client.getAPIList("/organization/certificates/activate",Er,{body:e,method:"post",...r,__security:{adminAPIKeyAuth:!0}})}deactivate(e,r){return this._client.getAPIList("/organization/certificates/deactivate",Er,{body:e,method:"post",...r,__security:{adminAPIKeyAuth:!0}})}};var Vd=class extends k{retrieve(e){return this._client.get("/organization/data_retention",{...e,__security:{adminAPIKeyAuth:!0}})}update(e,r){return this._client.post("/organization/data_retention",{body:e,...r,__security:{adminAPIKeyAuth:!0}})}};var Kd=class extends k{create(e,r){return this._client.post("/organization/invites",{body:e,...r,__security:{adminAPIKeyAuth:!0}})}retrieve(e,r){return this._client.get(_`/organization/invites/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}list(e={},r){return this._client.getAPIList("/organization/invites",qe,{query:e,...r,__security:{adminAPIKeyAuth:!0}})}delete(e,r){return this._client.delete(_`/organization/invites/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}};var Jd=class extends k{create(e,r){return this._client.post("/organization/roles",{body:e,...r,__security:{adminAPIKeyAuth:!0}})}retrieve(e,r){return this._client.get(_`/organization/roles/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}update(e,r,o){return this._client.post(_`/organization/roles/${e}`,{body:r,...o,__security:{adminAPIKeyAuth:!0}})}list(e={},r){return this._client.getAPIList("/organization/roles",jt,{query:e,...r,__security:{adminAPIKeyAuth:!0}})}delete(e,r){return this._client.delete(_`/organization/roles/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}};var Yd=class extends k{create(e,r){return this._client.post("/organization/spend_alerts",{body:e,...r,__security:{adminAPIKeyAuth:!0}})}retrieve(e,r){return this._client.get(_`/organization/spend_alerts/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}update(e,r,o){return this._client.post(_`/organization/spend_alerts/${e}`,{body:r,...o,__security:{adminAPIKeyAuth:!0}})}list(e={},r){return this._client.getAPIList("/organization/spend_alerts",qe,{query:e,...r,__security:{adminAPIKeyAuth:!0}})}delete(e,r){return this._client.delete(_`/organization/spend_alerts/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}};var Xd=class extends k{audioSpeeches(e,r){return this._client.get("/organization/usage/audio_speeches",{query:e,...r,__security:{adminAPIKeyAuth:!0}})}audioTranscriptions(e,r){return this._client.get("/organization/usage/audio_transcriptions",{query:e,...r,__security:{adminAPIKeyAuth:!0}})}codeInterpreterSessions(e,r){return this._client.get("/organization/usage/code_interpreter_sessions",{query:e,...r,__security:{adminAPIKeyAuth:!0}})}completions(e,r){return this._client.get("/organization/usage/completions",{query:e,...r,__security:{adminAPIKeyAuth:!0}})}costs(e,r){return this._client.get("/organization/costs",{query:e,...r,__security:{adminAPIKeyAuth:!0}})}embeddings(e,r){return this._client.get("/organization/usage/embeddings",{query:e,...r,__security:{adminAPIKeyAuth:!0}})}fileSearchCalls(e,r){return this._client.get("/organization/usage/file_search_calls",{query:e,...r,__security:{adminAPIKeyAuth:!0}})}images(e,r){return this._client.get("/organization/usage/images",{query:e,...r,__security:{adminAPIKeyAuth:!0}})}moderations(e,r){return this._client.get("/organization/usage/moderations",{query:e,...r,__security:{adminAPIKeyAuth:!0}})}vectorStores(e,r){return this._client.get("/organization/usage/vector_stores",{query:e,...r,__security:{adminAPIKeyAuth:!0}})}webSearchCalls(e,r){return this._client.get("/organization/usage/web_search_calls",{query:e,...r,__security:{adminAPIKeyAuth:!0}})}};var Qd=class extends k{create(e,r,o){return this._client.post(_`/organization/groups/${e}/roles`,{body:r,...o,__security:{adminAPIKeyAuth:!0}})}retrieve(e,r,o){let{group_id:n}=r;return this._client.get(_`/organization/groups/${n}/roles/${e}`,{...o,__security:{adminAPIKeyAuth:!0}})}list(e,r={},o){return this._client.getAPIList(_`/organization/groups/${e}/roles`,jt,{query:r,...o,__security:{adminAPIKeyAuth:!0}})}delete(e,r,o){let{group_id:n}=r;return this._client.delete(_`/organization/groups/${n}/roles/${e}`,{...o,__security:{adminAPIKeyAuth:!0}})}};var ef=class extends k{create(e,r,o){return this._client.post(_`/organization/groups/${e}/users`,{body:r,...o,__security:{adminAPIKeyAuth:!0}})}retrieve(e,r,o){let{group_id:n}=r;return this._client.get(_`/organization/groups/${n}/users/${e}`,{...o,__security:{adminAPIKeyAuth:!0}})}list(e,r={},o){return this._client.getAPIList(_`/organization/groups/${e}/users`,jt,{query:r,...o,__security:{adminAPIKeyAuth:!0}})}delete(e,r,o){let{group_id:n}=r;return this._client.delete(_`/organization/groups/${n}/users/${e}`,{...o,__security:{adminAPIKeyAuth:!0}})}};var Pa=class extends k{constructor(){super(...arguments),this.users=new ef(this._client),this.roles=new Qd(this._client)}create(e,r){return this._client.post("/organization/groups",{body:e,...r,__security:{adminAPIKeyAuth:!0}})}retrieve(e,r){return this._client.get(_`/organization/groups/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}update(e,r,o){return this._client.post(_`/organization/groups/${e}`,{body:r,...o,__security:{adminAPIKeyAuth:!0}})}list(e={},r){return this._client.getAPIList("/organization/groups",jt,{query:e,...r,__security:{adminAPIKeyAuth:!0}})}delete(e,r){return this._client.delete(_`/organization/groups/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}};Pa.Users=ef;Pa.Roles=Qd;var tf=class extends k{retrieve(e,r,o){let{project_id:n}=r;return this._client.get(_`/organization/projects/${n}/api_keys/${e}`,{...o,__security:{adminAPIKeyAuth:!0}})}list(e,r={},o){return this._client.getAPIList(_`/organization/projects/${e}/api_keys`,qe,{query:r,...o,__security:{adminAPIKeyAuth:!0}})}delete(e,r,o){let{project_id:n}=r;return this._client.delete(_`/organization/projects/${n}/api_keys/${e}`,{...o,__security:{adminAPIKeyAuth:!0}})}};var rf=class extends k{list(e,r={},o){return this._client.getAPIList(_`/organization/projects/${e}/certificates`,qe,{query:r,...o,__security:{adminAPIKeyAuth:!0}})}activate(e,r,o){return this._client.getAPIList(_`/organization/projects/${e}/certificates/activate`,Er,{body:r,method:"post",...o,__security:{adminAPIKeyAuth:!0}})}deactivate(e,r,o){return this._client.getAPIList(_`/organization/projects/${e}/certificates/deactivate`,Er,{body:r,method:"post",...o,__security:{adminAPIKeyAuth:!0}})}};var nf=class extends k{retrieve(e,r){return this._client.get(_`/organization/projects/${e}/data_retention`,{...r,__security:{adminAPIKeyAuth:!0}})}update(e,r,o){return this._client.post(_`/organization/projects/${e}/data_retention`,{body:r,...o,__security:{adminAPIKeyAuth:!0}})}};var of=class extends k{retrieve(e,r){return this._client.get(_`/organization/projects/${e}/hosted_tool_permissions`,{...r,__security:{adminAPIKeyAuth:!0}})}update(e,r,o){return this._client.post(_`/organization/projects/${e}/hosted_tool_permissions`,{body:r,...o,__security:{adminAPIKeyAuth:!0}})}};var sf=class extends k{retrieve(e,r){return this._client.get(_`/organization/projects/${e}/model_permissions`,{...r,__security:{adminAPIKeyAuth:!0}})}update(e,r,o){return this._client.post(_`/organization/projects/${e}/model_permissions`,{body:r,...o,__security:{adminAPIKeyAuth:!0}})}delete(e,r){return this._client.delete(_`/organization/projects/${e}/model_permissions`,{...r,__security:{adminAPIKeyAuth:!0}})}};var af=class extends k{listRateLimits(e,r={},o){return this._client.getAPIList(_`/organization/projects/${e}/rate_limits`,qe,{query:r,...o,__security:{adminAPIKeyAuth:!0}})}updateRateLimit(e,r,o){let{project_id:n,...i}=r;return this._client.post(_`/organization/projects/${n}/rate_limits/${e}`,{body:i,...o,__security:{adminAPIKeyAuth:!0}})}};var cf=class extends k{create(e,r,o){return this._client.post(_`/projects/${e}/roles`,{body:r,...o,__security:{adminAPIKeyAuth:!0}})}retrieve(e,r,o){let{project_id:n}=r;return this._client.get(_`/projects/${n}/roles/${e}`,{...o,__security:{adminAPIKeyAuth:!0}})}update(e,r,o){let{project_id:n,...i}=r;return this._client.post(_`/projects/${n}/roles/${e}`,{body:i,...o,__security:{adminAPIKeyAuth:!0}})}list(e,r={},o){return this._client.getAPIList(_`/projects/${e}/roles`,jt,{query:r,...o,__security:{adminAPIKeyAuth:!0}})}delete(e,r,o){let{project_id:n}=r;return this._client.delete(_`/projects/${n}/roles/${e}`,{...o,__security:{adminAPIKeyAuth:!0}})}};var uf=class extends k{create(e,r,o){return this._client.post(_`/organization/projects/${e}/service_accounts`,{body:r,...o,__security:{adminAPIKeyAuth:!0}})}retrieve(e,r,o){let{project_id:n}=r;return this._client.get(_`/organization/projects/${n}/service_accounts/${e}`,{...o,__security:{adminAPIKeyAuth:!0}})}update(e,r,o){let{project_id:n,...i}=r;return this._client.post(_`/organization/projects/${n}/service_accounts/${e}`,{body:i,...o,__security:{adminAPIKeyAuth:!0}})}list(e,r={},o){return this._client.getAPIList(_`/organization/projects/${e}/service_accounts`,qe,{query:r,...o,__security:{adminAPIKeyAuth:!0}})}delete(e,r,o){let{project_id:n}=r;return this._client.delete(_`/organization/projects/${n}/service_accounts/${e}`,{...o,__security:{adminAPIKeyAuth:!0}})}};var lf=class extends k{create(e,r,o){return this._client.post(_`/organization/projects/${e}/spend_alerts`,{body:r,...o,__security:{adminAPIKeyAuth:!0}})}retrieve(e,r,o){let{project_id:n}=r;return this._client.get(_`/organization/projects/${n}/spend_alerts/${e}`,{...o,__security:{adminAPIKeyAuth:!0}})}update(e,r,o){let{project_id:n,...i}=r;return this._client.post(_`/organization/projects/${n}/spend_alerts/${e}`,{body:i,...o,__security:{adminAPIKeyAuth:!0}})}list(e,r={},o){return this._client.getAPIList(_`/organization/projects/${e}/spend_alerts`,qe,{query:r,...o,__security:{adminAPIKeyAuth:!0}})}delete(e,r,o){let{project_id:n}=r;return this._client.delete(_`/organization/projects/${n}/spend_alerts/${e}`,{...o,__security:{adminAPIKeyAuth:!0}})}};var pf=class extends k{create(e,r,o){let{project_id:n,...i}=r;return this._client.post(_`/projects/${n}/groups/${e}/roles`,{body:i,...o,__security:{adminAPIKeyAuth:!0}})}retrieve(e,r,o){let{project_id:n,group_id:i}=r;return this._client.get(_`/projects/${n}/groups/${i}/roles/${e}`,{...o,__security:{adminAPIKeyAuth:!0}})}list(e,r,o){let{project_id:n,...i}=r;return this._client.getAPIList(_`/projects/${n}/groups/${e}/roles`,jt,{query:i,...o,__security:{adminAPIKeyAuth:!0}})}delete(e,r,o){let{project_id:n,group_id:i}=r;return this._client.delete(_`/projects/${n}/groups/${i}/roles/${e}`,{...o,__security:{adminAPIKeyAuth:!0}})}};var Mu=class extends k{constructor(){super(...arguments),this.roles=new pf(this._client)}create(e,r,o){return this._client.post(_`/organization/projects/${e}/groups`,{body:r,...o,__security:{adminAPIKeyAuth:!0}})}retrieve(e,r,o){let{project_id:n,...i}=r;return this._client.get(_`/organization/projects/${n}/groups/${e}`,{query:i,...o,__security:{adminAPIKeyAuth:!0}})}list(e,r={},o){return this._client.getAPIList(_`/organization/projects/${e}/groups`,jt,{query:r,...o,__security:{adminAPIKeyAuth:!0}})}delete(e,r,o){let{project_id:n}=r;return this._client.delete(_`/organization/projects/${n}/groups/${e}`,{...o,__security:{adminAPIKeyAuth:!0}})}};Mu.Roles=pf;var df=class extends k{create(e,r,o){let{project_id:n,...i}=r;return this._client.post(_`/projects/${n}/users/${e}/roles`,{body:i,...o,__security:{adminAPIKeyAuth:!0}})}retrieve(e,r,o){let{project_id:n,user_id:i}=r;return this._client.get(_`/projects/${n}/users/${i}/roles/${e}`,{...o,__security:{adminAPIKeyAuth:!0}})}list(e,r,o){let{project_id:n,...i}=r;return this._client.getAPIList(_`/projects/${n}/users/${e}/roles`,jt,{query:i,...o,__security:{adminAPIKeyAuth:!0}})}delete(e,r,o){let{project_id:n,user_id:i}=r;return this._client.delete(_`/projects/${n}/users/${i}/roles/${e}`,{...o,__security:{adminAPIKeyAuth:!0}})}};var Du=class extends k{constructor(){super(...arguments),this.roles=new df(this._client)}create(e,r,o){return this._client.post(_`/organization/projects/${e}/users`,{body:r,...o,__security:{adminAPIKeyAuth:!0}})}retrieve(e,r,o){let{project_id:n}=r;return this._client.get(_`/organization/projects/${n}/users/${e}`,{...o,__security:{adminAPIKeyAuth:!0}})}update(e,r,o){let{project_id:n,...i}=r;return this._client.post(_`/organization/projects/${n}/users/${e}`,{body:i,...o,__security:{adminAPIKeyAuth:!0}})}list(e,r={},o){return this._client.getAPIList(_`/organization/projects/${e}/users`,qe,{query:r,...o,__security:{adminAPIKeyAuth:!0}})}delete(e,r,o){let{project_id:n}=r;return this._client.delete(_`/organization/projects/${n}/users/${e}`,{...o,__security:{adminAPIKeyAuth:!0}})}};Du.Roles=df;var cr=class extends k{constructor(){super(...arguments),this.users=new Du(this._client),this.serviceAccounts=new uf(this._client),this.apiKeys=new tf(this._client),this.rateLimits=new af(this._client),this.modelPermissions=new sf(this._client),this.hostedToolPermissions=new of(this._client),this.groups=new Mu(this._client),this.roles=new cf(this._client),this.dataRetention=new nf(this._client),this.spendAlerts=new lf(this._client),this.certificates=new rf(this._client)}create(e,r){return this._client.post("/organization/projects",{body:e,...r,__security:{adminAPIKeyAuth:!0}})}retrieve(e,r){return this._client.get(_`/organization/projects/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}update(e,r,o){return this._client.post(_`/organization/projects/${e}`,{body:r,...o,__security:{adminAPIKeyAuth:!0}})}list(e={},r){return this._client.getAPIList("/organization/projects",qe,{query:e,...r,__security:{adminAPIKeyAuth:!0}})}archive(e,r){return this._client.post(_`/organization/projects/${e}/archive`,{...r,__security:{adminAPIKeyAuth:!0}})}};cr.Users=Du;cr.ServiceAccounts=uf;cr.APIKeys=tf;cr.RateLimits=af;cr.ModelPermissions=sf;cr.HostedToolPermissions=of;cr.Groups=Mu;cr.Roles=cf;cr.DataRetention=nf;cr.SpendAlerts=lf;cr.Certificates=rf;var ff=class extends k{create(e,r,o){return this._client.post(_`/organization/users/${e}/roles`,{body:r,...o,__security:{adminAPIKeyAuth:!0}})}retrieve(e,r,o){let{user_id:n}=r;return this._client.get(_`/organization/users/${n}/roles/${e}`,{...o,__security:{adminAPIKeyAuth:!0}})}list(e,r={},o){return this._client.getAPIList(_`/organization/users/${e}/roles`,jt,{query:r,...o,__security:{adminAPIKeyAuth:!0}})}delete(e,r,o){let{user_id:n}=r;return this._client.delete(_`/organization/users/${n}/roles/${e}`,{...o,__security:{adminAPIKeyAuth:!0}})}};var Fu=class extends k{constructor(){super(...arguments),this.roles=new ff(this._client)}retrieve(e,r){return this._client.get(_`/organization/users/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}update(e,r,o){return this._client.post(_`/organization/users/${e}`,{body:r,...o,__security:{adminAPIKeyAuth:!0}})}list(e={},r){return this._client.getAPIList("/organization/users",qe,{query:e,...r,__security:{adminAPIKeyAuth:!0}})}delete(e,r){return this._client.delete(_`/organization/users/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}};Fu.Roles=ff;var ur=class extends k{constructor(){super(...arguments),this.auditLogs=new Zd(this._client),this.adminAPIKeys=new Wd(this._client),this.usage=new Xd(this._client),this.invites=new Kd(this._client),this.users=new Fu(this._client),this.groups=new Pa(this._client),this.roles=new Jd(this._client),this.dataRetention=new Vd(this._client),this.spendAlerts=new Yd(this._client),this.certificates=new Gd(this._client),this.projects=new cr(this._client)}};ur.AuditLogs=Zd;ur.AdminAPIKeys=Wd;ur.Usage=Xd;ur.Invites=Kd;ur.Users=Fu;ur.Groups=Pa;ur.Roles=Jd;ur.DataRetention=Vd;ur.SpendAlerts=Yd;ur.Certificates=Gd;ur.Projects=cr;var Na=class extends k{constructor(){super(...arguments),this.organization=new ur(this._client)}};Na.Organization=ur;var a3=Symbol("brand.privateNullableHeaders");function*uxe(t){if(!t)return;if(a3 in t){let{values:o,nulls:n}=t;yield*o.entries();for(let i of n)yield[i,null];return}let e=!1,r;t instanceof Headers?r=t.entries():eM(t)?r=t:(e=!0,r=Object.entries(t??{}));for(let o of r){let n=o[0];if(typeof n!="string")throw new TypeError("expected header name to be a string");let i=eM(o[1])?o[1]:[o[1]],s=!1;for(let a of i)a!==void 0&&(e&&!s&&(s=!0,yield[n,null]),yield[n,a])}}var q=t=>{let e=new Headers,r=new Set;for(let o of t){let n=new Set;for(let[i,s]of uxe(o)){let a=i.toLowerCase();n.has(a)||(e.delete(i),n.add(a)),s===null?(e.delete(i),r.add(a)):(e.append(i,s),r.delete(a))}}return{[a3]:!0,values:e,nulls:r}};var mf=class extends k{create(e,r){return this._client.post("/audio/speech",{body:e,...r,headers:q([{Accept:"application/octet-stream"},r?.headers]),__security:{bearerAuth:!0},__binaryResponse:!0})}};var hf=class extends k{create(e,r){return this._client.post("/audio/transcriptions",kr({body:e,...r,stream:e.stream??!1,__metadata:{model:e.model},__security:{bearerAuth:!0}},this._client))}};var gf=class extends k{create(e,r){return this._client.post("/audio/translations",kr({body:e,...r,__metadata:{model:e.model},__security:{bearerAuth:!0}},this._client))}};var ui=class extends k{constructor(){super(...arguments),this.transcriptions=new hf(this._client),this.translations=new gf(this._client),this.speech=new mf(this._client)}};ui.Transcriptions=hf;ui.Translations=gf;ui.Speech=mf;var zu=class extends k{create(e,r){return this._client.post("/batches",{body:e,...r,__security:{bearerAuth:!0}})}retrieve(e,r){return this._client.get(_`/batches/${e}`,{...r,__security:{bearerAuth:!0}})}list(e={},r){return this._client.getAPIList("/batches",ve,{query:e,...r,__security:{bearerAuth:!0}})}cancel(e,r){return this._client.post(_`/batches/${e}/cancel`,{...r,__security:{bearerAuth:!0}})}};var yf=class extends k{create(e,r){return this._client.post("/assistants",{body:e,...r,headers:q([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}retrieve(e,r){return this._client.get(_`/assistants/${e}`,{...r,headers:q([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}update(e,r,o){return this._client.post(_`/assistants/${e}`,{body:r,...o,headers:q([{"OpenAI-Beta":"assistants=v2"},o?.headers]),__security:{bearerAuth:!0}})}list(e={},r){return this._client.getAPIList("/assistants",ve,{query:e,...r,headers:q([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}delete(e,r){return this._client.delete(_`/assistants/${e}`,{...r,headers:q([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}};var xf=class extends k{create(e,r){return this._client.post("/realtime/sessions",{body:e,...r,headers:q([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}};var _f=class extends k{create(e,r){return this._client.post("/realtime/transcription_sessions",{body:e,...r,headers:q([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}};var Ma=class extends k{constructor(){super(...arguments),this.sessions=new xf(this._client),this.transcriptionSessions=new _f(this._client)}};Ma.Sessions=xf;Ma.TranscriptionSessions=_f;var bf=class extends k{create(e,r){return this._client.post("/chatkit/sessions",{body:e,...r,headers:q([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers]),__security:{bearerAuth:!0}})}cancel(e,r){return this._client.post(_`/chatkit/sessions/${e}/cancel`,{...r,headers:q([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers]),__security:{bearerAuth:!0}})}};var vf=class extends k{retrieve(e,r){return this._client.get(_`/chatkit/threads/${e}`,{...r,headers:q([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers]),__security:{bearerAuth:!0}})}list(e={},r){return this._client.getAPIList("/chatkit/threads",qe,{query:e,...r,headers:q([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers]),__security:{bearerAuth:!0}})}delete(e,r){return this._client.delete(_`/chatkit/threads/${e}`,{...r,headers:q([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers]),__security:{bearerAuth:!0}})}listItems(e,r={},o){return this._client.getAPIList(_`/chatkit/threads/${e}/items`,qe,{query:r,...o,headers:q([{"OpenAI-Beta":"chatkit_beta=v1"},o?.headers]),__security:{bearerAuth:!0}})}};var Da=class extends k{constructor(){super(...arguments),this.sessions=new bf(this._client),this.threads=new vf(this._client)}};Da.Sessions=bf;Da.Threads=vf;var Sf=class extends k{create(e,r,o){return this._client.post(_`/threads/${e}/messages`,{body:r,...o,headers:q([{"OpenAI-Beta":"assistants=v2"},o?.headers]),__security:{bearerAuth:!0}})}retrieve(e,r,o){let{thread_id:n}=r;return this._client.get(_`/threads/${n}/messages/${e}`,{...o,headers:q([{"OpenAI-Beta":"assistants=v2"},o?.headers]),__security:{bearerAuth:!0}})}update(e,r,o){let{thread_id:n,...i}=r;return this._client.post(_`/threads/${n}/messages/${e}`,{body:i,...o,headers:q([{"OpenAI-Beta":"assistants=v2"},o?.headers]),__security:{bearerAuth:!0}})}list(e,r={},o){return this._client.getAPIList(_`/threads/${e}/messages`,ve,{query:r,...o,headers:q([{"OpenAI-Beta":"assistants=v2"},o?.headers]),__security:{bearerAuth:!0}})}delete(e,r,o){let{thread_id:n}=r;return this._client.delete(_`/threads/${n}/messages/${e}`,{...o,headers:q([{"OpenAI-Beta":"assistants=v2"},o?.headers]),__security:{bearerAuth:!0}})}};var wf=class extends k{retrieve(e,r,o){let{thread_id:n,run_id:i,...s}=r;return this._client.get(_`/threads/${n}/runs/${i}/steps/${e}`,{query:s,...o,headers:q([{"OpenAI-Beta":"assistants=v2"},o?.headers]),__security:{bearerAuth:!0}})}list(e,r,o){let{thread_id:n,...i}=r;return this._client.getAPIList(_`/threads/${n}/runs/${e}/steps`,ve,{query:i,...o,headers:q([{"OpenAI-Beta":"assistants=v2"},o?.headers]),__security:{bearerAuth:!0}})}};var c3=t=>{if(typeof Buffer<"u"){let e=Buffer.from(t,"base64");return Array.from(new Float32Array(e.buffer,e.byteOffset,e.length/Float32Array.BYTES_PER_ELEMENT))}else{let e=atob(t),r=e.length,o=new Uint8Array(r);for(let n=0;n<r;n++)o[n]=e.charCodeAt(n);return Array.from(new Float32Array(o.buffer))}};var go=t=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[t]?.trim()||void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(t)?.trim()||void 0};var lr,Lu,PM,li,Ww,yo,Uu,Ef,ju,Vw,On,Zw,Gw,ly,cy,uy,u3,l3,p3,d3,f3,m3,h3,hs=class extends Aa{constructor(){super(...arguments),lr.add(this),PM.set(this,[]),li.set(this,{}),Ww.set(this,{}),yo.set(this,void 0),Uu.set(this,void 0),Ef.set(this,void 0),ju.set(this,void 0),Vw.set(this,void 0),On.set(this,void 0),Zw.set(this,void 0),Gw.set(this,void 0),ly.set(this,void 0)}[(PM=new WeakMap,li=new WeakMap,Ww=new WeakMap,yo=new WeakMap,Uu=new WeakMap,Ef=new WeakMap,ju=new WeakMap,Vw=new WeakMap,On=new WeakMap,Zw=new WeakMap,Gw=new WeakMap,ly=new WeakMap,lr=new WeakSet,Symbol.asyncIterator)](){let e=[],r=[],o=!1;return this.on("event",n=>{let i=r.shift();i?i.resolve(n):e.push(n)}),this.on("end",()=>{o=!0;for(let n of r)n.resolve(void 0);r.length=0}),this.on("abort",n=>{o=!0;for(let i of r)i.reject(n);r.length=0}),this.on("error",n=>{o=!0;for(let i of r)i.reject(n);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:o?{value:void 0,done:!0}:new Promise((i,s)=>r.push({resolve:i,reject:s})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}static fromReadableStream(e){let r=new Lu;return r._run(()=>r._fromReadableStream(e)),r}async _fromReadableStream(e,r){this._listenForAbort(r?.signal),this._connected();let o=ci.fromReadableStream(e,this.controller);for await(let n of o)O(this,lr,"m",cy).call(this,n);if(o.controller.signal?.aborted)throw new zt;return this._addRun(O(this,lr,"m",uy).call(this))}toReadableStream(){return new ci(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream(e,r,o,n){let i=new Lu;return i._run(()=>i._runToolAssistantStream(e,r,o,{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),i}async _createToolAssistantStream(e,r,o,n){this._listenForAbort(n?.signal);let i={...o,stream:!0},s=await e.submitToolOutputs(r,i,{...n,signal:this.controller.signal});this._connected();for await(let a of s)O(this,lr,"m",cy).call(this,a);if(s.controller.signal?.aborted)throw new zt;return this._addRun(O(this,lr,"m",uy).call(this))}static createThreadAssistantStream(e,r,o){let n=new Lu;return n._run(()=>n._threadAssistantStream(e,r,{...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"stream"}})),n}static createAssistantStream(e,r,o,n){let i=new Lu;return i._run(()=>i._runAssistantStream(e,r,o,{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),i}currentEvent(){return O(this,Zw,"f")}currentRun(){return O(this,Gw,"f")}currentMessageSnapshot(){return O(this,yo,"f")}currentRunStepSnapshot(){return O(this,ly,"f")}async finalRunSteps(){return await this.done(),Object.values(O(this,li,"f"))}async finalMessages(){return await this.done(),Object.values(O(this,Ww,"f"))}async finalRun(){if(await this.done(),!O(this,Uu,"f"))throw Error("Final run was not received.");return O(this,Uu,"f")}async _createThreadAssistantStream(e,r,o){this._listenForAbort(o?.signal);let n={...r,stream:!0},i=await e.createAndRun(n,{...o,signal:this.controller.signal});this._connected();for await(let s of i)O(this,lr,"m",cy).call(this,s);if(i.controller.signal?.aborted)throw new zt;return this._addRun(O(this,lr,"m",uy).call(this))}async _createAssistantStream(e,r,o,n){this._listenForAbort(n?.signal);let i={...o,stream:!0},s=await e.create(r,i,{...n,signal:this.controller.signal});this._connected();for await(let a of s)O(this,lr,"m",cy).call(this,a);if(s.controller.signal?.aborted)throw new zt;return this._addRun(O(this,lr,"m",uy).call(this))}static accumulateDelta(e,r){for(let[o,n]of Object.entries(r)){if(!e.hasOwnProperty(o)){e[o]=n;continue}let i=e[o];if(i==null){e[o]=n;continue}if(o==="index"||o==="type"){e[o]=n;continue}if(typeof i=="string"&&typeof n=="string")i+=n;else if(typeof i=="number"&&typeof n=="number")i+=n;else if(Gg(i)&&Gg(n))i=this.accumulateDelta(i,n);else if(Array.isArray(i)&&Array.isArray(n)){if(i.every(s=>typeof s=="string"||typeof s=="number")){i.push(...n);continue}for(let s of n){if(!Gg(s))throw new Error(`Expected array delta entry to be an object but got: ${s}`);let a=s.index;if(a==null)throw console.error(s),new Error("Expected array delta entry to have an `index` property");if(typeof a!="number")throw new Error(`Expected array delta entry \`index\` property to be a number but got ${a}`);let c=i[a];c==null?i.push(s):i[a]=this.accumulateDelta(c,s)}continue}else throw Error(`Unhandled record type: ${o}, deltaValue: ${n}, accValue: ${i}`);e[o]=i}return e}_addRun(e){return e}async _threadAssistantStream(e,r,o){return await this._createThreadAssistantStream(r,e,o)}async _runAssistantStream(e,r,o,n){return await this._createAssistantStream(r,e,o,n)}async _runToolAssistantStream(e,r,o,n){return await this._createToolAssistantStream(r,e,o,n)}};Lu=hs,cy=function(e){if(!this.ended)switch(le(this,Zw,e,"f"),O(this,lr,"m",p3).call(this,e),e.event){case"thread.created":break;case"thread.run.created":case"thread.run.queued":case"thread.run.in_progress":case"thread.run.requires_action":case"thread.run.completed":case"thread.run.incomplete":case"thread.run.failed":case"thread.run.cancelling":case"thread.run.cancelled":case"thread.run.expired":O(this,lr,"m",h3).call(this,e);break;case"thread.run.step.created":case"thread.run.step.in_progress":case"thread.run.step.delta":case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":O(this,lr,"m",l3).call(this,e);break;case"thread.message.created":case"thread.message.in_progress":case"thread.message.delta":case"thread.message.completed":case"thread.message.incomplete":O(this,lr,"m",u3).call(this,e);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier");default:}},uy=function(){if(this.ended)throw new J("stream has ended, this shouldn't happen");if(!O(this,Uu,"f"))throw Error("Final run has not been received");return O(this,Uu,"f")},u3=function(e){let[r,o]=O(this,lr,"m",f3).call(this,e,O(this,yo,"f"));le(this,yo,r,"f"),O(this,Ww,"f")[r.id]=r;for(let n of o){let i=r.content[n.index];i?.type=="text"&&this._emit("textCreated",i.text)}switch(e.event){case"thread.message.created":this._emit("messageCreated",e.data);break;case"thread.message.in_progress":break;case"thread.message.delta":if(this._emit("messageDelta",e.data.delta,r),e.data.delta.content)for(let n of e.data.delta.content){if(n.type=="text"&&n.text){let i=n.text,s=r.content[n.index];if(s&&s.type=="text")this._emit("textDelta",i,s.text);else throw Error("The snapshot associated with this text delta is not text or missing")}if(n.index!=O(this,Ef,"f")){if(O(this,ju,"f"))switch(O(this,ju,"f").type){case"text":this._emit("textDone",O(this,ju,"f").text,O(this,yo,"f"));break;case"image_file":this._emit("imageFileDone",O(this,ju,"f").image_file,O(this,yo,"f"));break}le(this,Ef,n.index,"f")}le(this,ju,r.content[n.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(O(this,Ef,"f")!==void 0){let n=e.data.content[O(this,Ef,"f")];if(n)switch(n.type){case"image_file":this._emit("imageFileDone",n.image_file,O(this,yo,"f"));break;case"text":this._emit("textDone",n.text,O(this,yo,"f"));break}}O(this,yo,"f")&&this._emit("messageDone",e.data),le(this,yo,void 0,"f")}},l3=function(e){let r=O(this,lr,"m",d3).call(this,e);switch(le(this,ly,r,"f"),e.event){case"thread.run.step.created":this._emit("runStepCreated",e.data);break;case"thread.run.step.delta":let o=e.data.delta;if(o.step_details&&o.step_details.type=="tool_calls"&&o.step_details.tool_calls&&r.step_details.type=="tool_calls")for(let i of o.step_details.tool_calls)i.index==O(this,Vw,"f")?this._emit("toolCallDelta",i,r.step_details.tool_calls[i.index]):(O(this,On,"f")&&this._emit("toolCallDone",O(this,On,"f")),le(this,Vw,i.index,"f"),le(this,On,r.step_details.tool_calls[i.index],"f"),O(this,On,"f")&&this._emit("toolCallCreated",O(this,On,"f")));this._emit("runStepDelta",e.data.delta,r);break;case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":le(this,ly,void 0,"f"),e.data.step_details.type=="tool_calls"&&O(this,On,"f")&&(this._emit("toolCallDone",O(this,On,"f")),le(this,On,void 0,"f")),this._emit("runStepDone",e.data,r);break;case"thread.run.step.in_progress":break}},p3=function(e){O(this,PM,"f").push(e),this._emit("event",e)},d3=function(e){switch(e.event){case"thread.run.step.created":return O(this,li,"f")[e.data.id]=e.data,e.data;case"thread.run.step.delta":let r=O(this,li,"f")[e.data.id];if(!r)throw Error("Received a RunStepDelta before creation of a snapshot");let o=e.data;if(o.delta){let n=Lu.accumulateDelta(r,o.delta);O(this,li,"f")[e.data.id]=n}return O(this,li,"f")[e.data.id];case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":case"thread.run.step.in_progress":O(this,li,"f")[e.data.id]=e.data;break}if(O(this,li,"f")[e.data.id])return O(this,li,"f")[e.data.id];throw new Error("No snapshot available")},f3=function(e,r){let o=[];switch(e.event){case"thread.message.created":return[e.data,o];case"thread.message.delta":if(!r)throw Error("Received a delta with no existing snapshot (there should be one from message creation)");let n=e.data;if(n.delta.content)for(let i of n.delta.content)if(i.index in r.content){let s=r.content[i.index];r.content[i.index]=O(this,lr,"m",m3).call(this,i,s)}else r.content[i.index]=i,o.push(i);return[r,o];case"thread.message.in_progress":case"thread.message.completed":case"thread.message.incomplete":if(r)return[r,o];throw Error("Received thread message event with no existing snapshot")}throw Error("Tried to accumulate a non-message event")},m3=function(e,r){return Lu.accumulateDelta(r,e)},h3=function(e){switch(le(this,Gw,e.data,"f"),e.event){case"thread.run.created":break;case"thread.run.queued":break;case"thread.run.in_progress":break;case"thread.run.requires_action":case"thread.run.cancelled":case"thread.run.failed":case"thread.run.completed":case"thread.run.expired":case"thread.run.incomplete":le(this,Uu,e.data,"f"),O(this,On,"f")&&(this._emit("toolCallDone",O(this,On,"f")),le(this,On,void 0,"f"));break;case"thread.run.cancelling":break}};var qu=class extends k{constructor(){super(...arguments),this.steps=new wf(this._client)}create(e,r,o){let{include:n,...i}=r;return this._client.post(_`/threads/${e}/runs`,{query:{include:n},body:i,...o,headers:q([{"OpenAI-Beta":"assistants=v2"},o?.headers]),stream:r.stream??!1,__synthesizeEventData:!0,__security:{bearerAuth:!0}})}retrieve(e,r,o){let{thread_id:n}=r;return this._client.get(_`/threads/${n}/runs/${e}`,{...o,headers:q([{"OpenAI-Beta":"assistants=v2"},o?.headers]),__security:{bearerAuth:!0}})}update(e,r,o){let{thread_id:n,...i}=r;return this._client.post(_`/threads/${n}/runs/${e}`,{body:i,...o,headers:q([{"OpenAI-Beta":"assistants=v2"},o?.headers]),__security:{bearerAuth:!0}})}list(e,r={},o){return this._client.getAPIList(_`/threads/${e}/runs`,ve,{query:r,...o,headers:q([{"OpenAI-Beta":"assistants=v2"},o?.headers]),__security:{bearerAuth:!0}})}cancel(e,r,o){let{thread_id:n}=r;return this._client.post(_`/threads/${n}/runs/${e}/cancel`,{...o,headers:q([{"OpenAI-Beta":"assistants=v2"},o?.headers]),__security:{bearerAuth:!0}})}async createAndPoll(e,r,o){let n=await this.create(e,r,o);return await this.poll(n.id,{thread_id:e},o)}createAndStream(e,r,o){return hs.createAssistantStream(e,this._client.beta.threads.runs,r,o)}async poll(e,r,o){let n=q([o?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":o?.pollIntervalMs?.toString()??void 0}]);for(;;){let{data:i,response:s}=await this.retrieve(e,r,{...o,headers:{...o?.headers,...n}}).withResponse();switch(i.status){case"queued":case"in_progress":case"cancelling":let a=5e3;if(o?.pollIntervalMs)a=o.pollIntervalMs;else{let c=s.headers.get("openai-poll-after-ms");if(c){let u=parseInt(c);isNaN(u)||(a=u)}}await si(a);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return i}}}stream(e,r,o){return hs.createAssistantStream(e,this._client.beta.threads.runs,r,o)}submitToolOutputs(e,r,o){let{thread_id:n,...i}=r;return this._client.post(_`/threads/${n}/runs/${e}/submit_tool_outputs`,{body:i,...o,headers:q([{"OpenAI-Beta":"assistants=v2"},o?.headers]),stream:r.stream??!1,__synthesizeEventData:!0,__security:{bearerAuth:!0}})}async submitToolOutputsAndPoll(e,r,o){let n=await this.submitToolOutputs(e,r,o);return await this.poll(n.id,r,o)}submitToolOutputsStream(e,r,o){return hs.createToolAssistantStream(e,this._client.beta.threads.runs,r,o)}};qu.Steps=wf;var Fa=class extends k{constructor(){super(...arguments),this.runs=new qu(this._client),this.messages=new Sf(this._client)}create(e={},r){return this._client.post("/threads",{body:e,...r,headers:q([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}retrieve(e,r){return this._client.get(_`/threads/${e}`,{...r,headers:q([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}update(e,r,o){return this._client.post(_`/threads/${e}`,{body:r,...o,headers:q([{"OpenAI-Beta":"assistants=v2"},o?.headers]),__security:{bearerAuth:!0}})}delete(e,r){return this._client.delete(_`/threads/${e}`,{...r,headers:q([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}createAndRun(e,r){return this._client.post("/threads/runs",{body:e,...r,headers:q([{"OpenAI-Beta":"assistants=v2"},r?.headers]),stream:e.stream??!1,__synthesizeEventData:!0,__security:{bearerAuth:!0}})}async createAndRunPoll(e,r){let o=await this.createAndRun(e,r);return await this.runs.poll(o.id,{thread_id:o.thread_id},r)}createAndRunStream(e,r){return hs.createThreadAssistantStream(e,this._client.beta.threads,r)}};Fa.Runs=qu;Fa.Messages=Sf;var xo=class extends k{constructor(){super(...arguments),this.realtime=new Ma(this._client),this.chatkit=new Da(this._client),this.assistants=new yf(this._client),this.threads=new Fa(this._client)}};xo.Realtime=Ma;xo.ChatKit=Da;xo.Assistants=yf;xo.Threads=Fa;var Hu=class extends k{create(e,r){return this._client.post("/completions",{body:e,...r,stream:e.stream??!1,__security:{bearerAuth:!0}})}};var kf=class extends k{retrieve(e,r,o){let{container_id:n}=r;return this._client.get(_`/containers/${n}/files/${e}/content`,{...o,headers:q([{Accept:"application/binary"},o?.headers]),__security:{bearerAuth:!0},__binaryResponse:!0})}};var Bu=class extends k{constructor(){super(...arguments),this.content=new kf(this._client)}create(e,r,o){return this._client.post(_`/containers/${e}/files`,Ra({body:r,...o,__security:{bearerAuth:!0}},this._client))}retrieve(e,r,o){let{container_id:n}=r;return this._client.get(_`/containers/${n}/files/${e}`,{...o,__security:{bearerAuth:!0}})}list(e,r={},o){return this._client.getAPIList(_`/containers/${e}/files`,ve,{query:r,...o,__security:{bearerAuth:!0}})}delete(e,r,o){let{container_id:n}=r;return this._client.delete(_`/containers/${n}/files/${e}`,{...o,headers:q([{Accept:"*/*"},o?.headers]),__security:{bearerAuth:!0}})}};Bu.Content=kf;var za=class extends k{constructor(){super(...arguments),this.files=new Bu(this._client)}create(e,r){return this._client.post("/containers",{body:e,...r,__security:{bearerAuth:!0}})}retrieve(e,r){return this._client.get(_`/containers/${e}`,{...r,__security:{bearerAuth:!0}})}list(e={},r){return this._client.getAPIList("/containers",ve,{query:e,...r,__security:{bearerAuth:!0}})}delete(e,r){return this._client.delete(_`/containers/${e}`,{...r,headers:q([{Accept:"*/*"},r?.headers]),__security:{bearerAuth:!0}})}};za.Files=Bu;var If=class extends k{create(e,r,o){let{include:n,...i}=r;return this._client.post(_`/conversations/${e}/items`,{query:{include:n},body:i,...o,__security:{bearerAuth:!0}})}retrieve(e,r,o){let{conversation_id:n,...i}=r;return this._client.get(_`/conversations/${n}/items/${e}`,{query:i,...o,__security:{bearerAuth:!0}})}list(e,r={},o){return this._client.getAPIList(_`/conversations/${e}/items`,qe,{query:r,...o,__security:{bearerAuth:!0}})}delete(e,r,o){let{conversation_id:n}=r;return this._client.delete(_`/conversations/${n}/items/${e}`,{...o,__security:{bearerAuth:!0}})}};var ja=class extends k{constructor(){super(...arguments),this.items=new If(this._client)}create(e={},r){return this._client.post("/conversations",{body:e,...r,__security:{bearerAuth:!0}})}retrieve(e,r){return this._client.get(_`/conversations/${e}`,{...r,__security:{bearerAuth:!0}})}update(e,r,o){return this._client.post(_`/conversations/${e}`,{body:r,...o,__security:{bearerAuth:!0}})}delete(e,r){return this._client.delete(_`/conversations/${e}`,{...r,__security:{bearerAuth:!0}})}};ja.Items=If;var Wu=class extends k{create(e,r){let o=!!e.encoding_format,n=o?e.encoding_format:"base64";o&&$t(this._client).debug("embeddings/user defined encoding_format:",e.encoding_format);let i=this._client.post("/embeddings",{body:{...e,encoding_format:n},...r,__security:{bearerAuth:!0}});return o?i:($t(this._client).debug("embeddings/decoding base64 embeddings from base64"),i._thenUnwrap(s=>(s&&s.data&&s.data.forEach(a=>{let c=a.embedding;a.embedding=c3(c)}),s)))}};var Of=class extends k{retrieve(e,r,o){let{eval_id:n,run_id:i}=r;return this._client.get(_`/evals/${n}/runs/${i}/output_items/${e}`,{...o,__security:{bearerAuth:!0}})}list(e,r,o){let{eval_id:n,...i}=r;return this._client.getAPIList(_`/evals/${n}/runs/${e}/output_items`,ve,{query:i,...o,__security:{bearerAuth:!0}})}};var Zu=class extends k{constructor(){super(...arguments),this.outputItems=new Of(this._client)}create(e,r,o){return this._client.post(_`/evals/${e}/runs`,{body:r,...o,__security:{bearerAuth:!0}})}retrieve(e,r,o){let{eval_id:n}=r;return this._client.get(_`/evals/${n}/runs/${e}`,{...o,__security:{bearerAuth:!0}})}list(e,r={},o){return this._client.getAPIList(_`/evals/${e}/runs`,ve,{query:r,...o,__security:{bearerAuth:!0}})}delete(e,r,o){let{eval_id:n}=r;return this._client.delete(_`/evals/${n}/runs/${e}`,{...o,__security:{bearerAuth:!0}})}cancel(e,r,o){let{eval_id:n}=r;return this._client.post(_`/evals/${n}/runs/${e}`,{...o,__security:{bearerAuth:!0}})}};Zu.OutputItems=Of;var La=class extends k{constructor(){super(...arguments),this.runs=new Zu(this._client)}create(e,r){return this._client.post("/evals",{body:e,...r,__security:{bearerAuth:!0}})}retrieve(e,r){return this._client.get(_`/evals/${e}`,{...r,__security:{bearerAuth:!0}})}update(e,r,o){return this._client.post(_`/evals/${e}`,{body:r,...o,__security:{bearerAuth:!0}})}list(e={},r){return this._client.getAPIList("/evals",ve,{query:e,...r,__security:{bearerAuth:!0}})}delete(e,r){return this._client.delete(_`/evals/${e}`,{...r,__security:{bearerAuth:!0}})}};La.Runs=Zu;var Gu=class extends k{create(e,r){return this._client.post("/files",kr({body:e,...r,__security:{bearerAuth:!0}},this._client))}retrieve(e,r){return this._client.get(_`/files/${e}`,{...r,__security:{bearerAuth:!0}})}list(e={},r){return this._client.getAPIList("/files",ve,{query:e,...r,__security:{bearerAuth:!0}})}delete(e,r){return this._client.delete(_`/files/${e}`,{...r,__security:{bearerAuth:!0}})}content(e,r){return this._client.get(_`/files/${e}/content`,{...r,headers:q([{Accept:"application/binary"},r?.headers]),__security:{bearerAuth:!0},__binaryResponse:!0})}async waitForProcessing(e,{pollInterval:r=5e3,maxWait:o=1800*1e3}={}){let n=new Set(["processed","error","deleted"]),i=Date.now(),s=await this.retrieve(e);for(;!s.status||!n.has(s.status);)if(await si(r),s=await this.retrieve(e),Date.now()-i>o)throw new Oa({message:`Giving up on waiting for file ${e} to finish processing after ${o} milliseconds.`});return s}};var Cf=class extends k{};var Rf=class extends k{run(e,r){return this._client.post("/fine_tuning/alpha/graders/run",{body:e,...r,__security:{bearerAuth:!0}})}validate(e,r){return this._client.post("/fine_tuning/alpha/graders/validate",{body:e,...r,__security:{bearerAuth:!0}})}};var Vu=class extends k{constructor(){super(...arguments),this.graders=new Rf(this._client)}};Vu.Graders=Rf;var Af=class extends k{create(e,r,o){return this._client.getAPIList(_`/fine_tuning/checkpoints/${e}/permissions`,Er,{body:r,method:"post",...o,__security:{adminAPIKeyAuth:!0}})}retrieve(e,r={},o){return this._client.get(_`/fine_tuning/checkpoints/${e}/permissions`,{query:r,...o,__security:{adminAPIKeyAuth:!0}})}list(e,r={},o){return this._client.getAPIList(_`/fine_tuning/checkpoints/${e}/permissions`,qe,{query:r,...o,__security:{adminAPIKeyAuth:!0}})}delete(e,r,o){let{fine_tuned_model_checkpoint:n}=r;return this._client.delete(_`/fine_tuning/checkpoints/${n}/permissions/${e}`,{...o,__security:{adminAPIKeyAuth:!0}})}};var Ku=class extends k{constructor(){super(...arguments),this.permissions=new Af(this._client)}};Ku.Permissions=Af;var Tf=class extends k{list(e,r={},o){return this._client.getAPIList(_`/fine_tuning/jobs/${e}/checkpoints`,ve,{query:r,...o,__security:{bearerAuth:!0}})}};var Ju=class extends k{constructor(){super(...arguments),this.checkpoints=new Tf(this._client)}create(e,r){return this._client.post("/fine_tuning/jobs",{body:e,...r,__security:{bearerAuth:!0}})}retrieve(e,r){return this._client.get(_`/fine_tuning/jobs/${e}`,{...r,__security:{bearerAuth:!0}})}list(e={},r){return this._client.getAPIList("/fine_tuning/jobs",ve,{query:e,...r,__security:{bearerAuth:!0}})}cancel(e,r){return this._client.post(_`/fine_tuning/jobs/${e}/cancel`,{...r,__security:{bearerAuth:!0}})}listEvents(e,r={},o){return this._client.getAPIList(_`/fine_tuning/jobs/${e}/events`,ve,{query:r,...o,__security:{bearerAuth:!0}})}pause(e,r){return this._client.post(_`/fine_tuning/jobs/${e}/pause`,{...r,__security:{bearerAuth:!0}})}resume(e,r){return this._client.post(_`/fine_tuning/jobs/${e}/resume`,{...r,__security:{bearerAuth:!0}})}};Ju.Checkpoints=Tf;var _o=class extends k{constructor(){super(...arguments),this.methods=new Cf(this._client),this.jobs=new Ju(this._client),this.checkpoints=new Ku(this._client),this.alpha=new Vu(this._client)}};_o.Methods=Cf;_o.Jobs=Ju;_o.Checkpoints=Ku;_o.Alpha=Vu;var $f=class extends k{};var Ua=class extends k{constructor(){super(...arguments),this.graderModels=new $f(this._client)}};Ua.GraderModels=$f;var Yu=class extends k{createVariation(e,r){return this._client.post("/images/variations",kr({body:e,...r,__security:{bearerAuth:!0}},this._client))}edit(e,r){return this._client.post("/images/edits",kr({body:e,...r,stream:e.stream??!1,__security:{bearerAuth:!0}},this._client))}generate(e,r){return this._client.post("/images/generations",{body:e,...r,stream:e.stream??!1,__security:{bearerAuth:!0}})}};var Xu=class extends k{retrieve(e,r){return this._client.get(_`/models/${e}`,{...r,__security:{bearerAuth:!0}})}list(e){return this._client.getAPIList("/models",Er,{...e,__security:{bearerAuth:!0}})}delete(e,r){return this._client.delete(_`/models/${e}`,{...r,__security:{bearerAuth:!0}})}};var Qu=class extends k{create(e,r){return this._client.post("/moderations",{body:e,...r,__security:{bearerAuth:!0}})}};var Pf=class extends k{accept(e,r,o){return this._client.post(_`/realtime/calls/${e}/accept`,{body:r,...o,headers:q([{Accept:"*/*"},o?.headers]),__security:{bearerAuth:!0}})}hangup(e,r){return this._client.post(_`/realtime/calls/${e}/hangup`,{...r,headers:q([{Accept:"*/*"},r?.headers]),__security:{bearerAuth:!0}})}refer(e,r,o){return this._client.post(_`/realtime/calls/${e}/refer`,{body:r,...o,headers:q([{Accept:"*/*"},o?.headers]),__security:{bearerAuth:!0}})}reject(e,r={},o){return this._client.post(_`/realtime/calls/${e}/reject`,{body:r,...o,headers:q([{Accept:"*/*"},o?.headers]),__security:{bearerAuth:!0}})}};var Nf=class extends k{create(e,r){return this._client.post("/realtime/client_secrets",{body:e,...r,__security:{bearerAuth:!0}})}};var gs=class extends k{constructor(){super(...arguments),this.clientSecrets=new Nf(this._client),this.calls=new Pf(this._client)}};gs.ClientSecrets=Nf;gs.Calls=Pf;function g3(t,e){if(!e||!Lxe(e)){let r={...t,output_parsed:null,output:t.output.map(o=>o.type==="function_call"?{...o,parsed_arguments:null}:o.type==="message"?{...o,content:o.content.map(n=>({...n,parsed:null}))}:o)};return y3(t,r)&&Cn(r),r}return NM(t,e)}function NM(t,e){let r=!t.status||t.status==="completed",o=t.output.map(i=>{if(i.type==="function_call")return{...i,parsed_arguments:r?Hxe(e,i):null};if(i.type==="message"){let s=i.content.map(a=>a.type==="output_text"?{...a,parsed:r?jxe(e,a.text):null}:a);return{...i,content:s}}return i}),n=Object.assign({},t,{output:o});return y3(t,n)&&Cn(n),Object.defineProperty(n,"output_parsed",{enumerable:!0,get(){for(let i of n.output)if(i.type==="message"){for(let s of i.content)if(s.type==="output_text"&&s.parsed!==null)return s.parsed}return null}}),n}function jxe(t,e){return t.text?.format?.type!=="json_schema"?null:"$parseRaw"in t.text?.format?(t.text?.format).$parseRaw(e):JSON.parse(e)}function Lxe(t){return!!ey(t.text?.format)}function Uxe(t){return t?.$brand==="auto-parseable-tool"}function qxe(t,e){return t.find(r=>r.type==="function"&&r.name===e)}function Hxe(t,e){let r=qxe(t.tools??[],e.name);return{...e,...e,parsed_arguments:Uxe(r)?r.$parseRaw(e.arguments):r?.strict?JSON.parse(e.arguments):null}}function y3(t,e){return!Object.getOwnPropertyDescriptor(t,"output_text")||e.output_text==null}function Cn(t){let e=[];for(let r of t.output)if(r.type==="message")for(let o of r.content)o.type==="output_text"&&e.push(o.text);t.output_text=e.join("")}function _3(t,e){if(!e){if(t.type!=="response.created")throw new J(`When snapshot hasn't been set yet, expected 'response.created' event, got ${t.type}`);return x3(t.response)}switch(t.type){case"response.output_item.added":{e.output.push(structuredClone(t.item)),t.item.type==="message"&&Cn(e);break}case"response.output_item.done":{Me(e,t.output_index),e.output[t.output_index]=structuredClone(t.item),t.item.type==="message"&&Cn(e);break}case"response.content_part.added":{let r=Me(e,t.output_index),o=r.type,n=t.part;o==="message"&&n.type!=="reasoning_text"?(r.content.push(structuredClone(n)),n.type==="output_text"&&Cn(e)):o==="reasoning"&&n.type==="reasoning_text"&&(r.content||(r.content=[]),r.content.push(structuredClone(n)));break}case"response.content_part.done":{let r=Me(e,t.output_index),o=t.part;if(r.type==="message"&&o.type!=="reasoning_text")Xn(r.content,t.content_index),r.content[t.content_index]=structuredClone(o),o.type==="output_text"&&Cn(e);else if(r.type==="reasoning"&&o.type==="reasoning_text"){let n=r.content;if(!n)throw new J(`missing content at index ${t.content_index}`);Xn(n,t.content_index),n[t.content_index]=structuredClone(o)}break}case"response.output_text.delta":{let r=Me(e,t.output_index);if(r.type==="message"){let o=Xn(r.content,t.content_index);if(o.type!=="output_text")throw new J(`expected content to be 'output_text', got ${o.type}`);o.text+=t.delta,e.output_text+=t.delta}break}case"response.output_text.done":{let r=Me(e,t.output_index);if(r.type==="message"){let o=Xn(r.content,t.content_index);if(o.type!=="output_text")throw new J(`expected content to be 'output_text', got ${o.type}`);o.text=t.text,Cn(e)}break}case"response.output_text.annotation.added":{let r=Me(e,t.output_index);if(r.type==="message"){let o=Xn(r.content,t.content_index);if(o.type!=="output_text")throw new J(`expected content to be 'output_text', got ${o.type}`);o.annotations[t.annotation_index]=structuredClone(t.annotation)}break}case"response.refusal.delta":{let r=Me(e,t.output_index);if(r.type==="message"){let o=Xn(r.content,t.content_index);if(o.type!=="refusal")throw new J(`expected content to be 'refusal', got ${o.type}`);o.refusal+=t.delta}break}case"response.refusal.done":{let r=Me(e,t.output_index);if(r.type==="message"){let o=Xn(r.content,t.content_index);if(o.type!=="refusal")throw new J(`expected content to be 'refusal', got ${o.type}`);o.refusal=t.refusal}break}case"response.function_call_arguments.delta":{let r=Me(e,t.output_index);r.type==="function_call"&&(r.arguments+=t.delta);break}case"response.function_call_arguments.done":{let r=Me(e,t.output_index);r.type==="function_call"&&(r.arguments=t.arguments);break}case"response.reasoning_text.delta":{let r=Me(e,t.output_index);if(r.type==="reasoning"){if(!r.content)throw new J(`missing content at index ${t.content_index}`);let o=Xn(r.content,t.content_index);if(o.type!=="reasoning_text")throw new J(`expected content to be 'reasoning_text', got ${o.type}`);o.text+=t.delta}break}case"response.reasoning_text.done":{let r=Me(e,t.output_index);if(r.type==="reasoning"){if(!r.content)throw new J(`missing content at index ${t.content_index}`);let o=Xn(r.content,t.content_index);if(o.type!=="reasoning_text")throw new J(`expected content to be 'reasoning_text', got ${o.type}`);o.text=t.text}break}case"response.reasoning_summary_part.added":{let r=Me(e,t.output_index);r.type==="reasoning"&&r.summary.push(structuredClone(t.part));break}case"response.reasoning_summary_part.done":{let r=Me(e,t.output_index);r.type==="reasoning"&&(Xn(r.summary,t.summary_index),r.summary[t.summary_index]=structuredClone(t.part));break}case"response.reasoning_summary_text.delta":{let r=Me(e,t.output_index);if(r.type==="reasoning"){let o=Xn(r.summary,t.summary_index);o.text+=t.delta}break}case"response.reasoning_summary_text.done":{let r=Me(e,t.output_index);if(r.type==="reasoning"){let o=Xn(r.summary,t.summary_index);o.text=t.text}break}case"response.custom_tool_call_input.delta":{let r=Me(e,t.output_index);r.type==="custom_tool_call"&&(r.input+=t.delta);break}case"response.custom_tool_call_input.done":{let r=Me(e,t.output_index);r.type==="custom_tool_call"&&(r.input=t.input);break}case"response.mcp_call_arguments.delta":{let r=Me(e,t.output_index);r.type==="mcp_call"&&(r.arguments+=t.delta);break}case"response.mcp_call_arguments.done":{let r=Me(e,t.output_index);r.type==="mcp_call"&&(r.arguments=t.arguments);break}case"response.code_interpreter_call_code.delta":{let r=Me(e,t.output_index);r.type==="code_interpreter_call"&&(r.code=(r.code??"")+t.delta);break}case"response.code_interpreter_call_code.done":{let r=Me(e,t.output_index);r.type==="code_interpreter_call"&&(r.code=t.code);break}case"response.code_interpreter_call.in_progress":{let r=Me(e,t.output_index);r.type==="code_interpreter_call"&&(r.status="in_progress");break}case"response.code_interpreter_call.interpreting":{let r=Me(e,t.output_index);r.type==="code_interpreter_call"&&(r.status="interpreting");break}case"response.code_interpreter_call.completed":{let r=Me(e,t.output_index);r.type==="code_interpreter_call"&&(r.status="completed");break}case"response.file_search_call.in_progress":{let r=Me(e,t.output_index);r.type==="file_search_call"&&(r.status="in_progress");break}case"response.file_search_call.searching":{let r=Me(e,t.output_index);r.type==="file_search_call"&&(r.status="searching");break}case"response.file_search_call.completed":{let r=Me(e,t.output_index);r.type==="file_search_call"&&(r.status="completed");break}case"response.web_search_call.in_progress":{let r=Me(e,t.output_index);r.type==="web_search_call"&&(r.status="in_progress");break}case"response.web_search_call.searching":{let r=Me(e,t.output_index);r.type==="web_search_call"&&(r.status="searching");break}case"response.web_search_call.completed":{let r=Me(e,t.output_index);r.type==="web_search_call"&&(r.status="completed");break}case"response.image_generation_call.in_progress":{let r=Me(e,t.output_index);r.type==="image_generation_call"&&(r.status="in_progress");break}case"response.image_generation_call.generating":{let r=Me(e,t.output_index);r.type==="image_generation_call"&&(r.status="generating");break}case"response.image_generation_call.completed":{let r=Me(e,t.output_index);r.type==="image_generation_call"&&(r.status="completed");break}case"response.mcp_call.in_progress":{let r=Me(e,t.output_index);r.type==="mcp_call"&&(r.status="in_progress");break}case"response.mcp_call.completed":{let r=Me(e,t.output_index);r.type==="mcp_call"&&(r.status="completed");break}case"response.mcp_call.failed":{let r=Me(e,t.output_index);r.type==="mcp_call"&&(r.status="failed");break}case"response.created":case"response.queued":case"response.in_progress":case"response.completed":case"response.failed":case"response.incomplete":{e=x3(t.response);break}case"response.audio.delta":case"response.audio.done":case"response.audio.transcript.delta":case"response.audio.transcript.done":case"response.image_generation_call.partial_image":case"response.mcp_list_tools.in_progress":case"response.mcp_list_tools.completed":case"response.mcp_list_tools.failed":case"error":break;default:Bxe(t)}return e}function x3(t){let e=structuredClone(t);return(!Object.getOwnPropertyDescriptor(e,"output_text")||e.output_text==null)&&Cn(e),e}function Me(t,e){let r=t.output[e];if(!r)throw new J(`missing output at index ${e}`);return r}function Xn(t,e){let r=t[e];if(!r)throw new J(`missing content at index ${e}`);return r}function Bxe(t){throw new J(`Unhandled response stream event: ${JSON.stringify(t)}`)}var py,Kw,el,Jw,b3,v3,S3,Yw=class t extends Aa{constructor(e){super(),py.add(this),Kw.set(this,void 0),el.set(this,void 0),Jw.set(this,void 0),le(this,Kw,e,"f")}static createResponse(e,r,o){let n=new t(r);return n._run(()=>n._createOrRetrieveResponse(e,r,{...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"stream"}})),n}async _createOrRetrieveResponse(e,r,o){this._listenForAbort(o?.signal),O(this,py,"m",b3).call(this);let n,i=null;"response_id"in r?(n=await e.responses.retrieve(r.response_id,{stream:!0},{...o,signal:this.controller.signal,stream:!0}),i=r.starting_after??null):n=await e.responses.create({...r,stream:!0},{...o,signal:this.controller.signal}),this._connected();for await(let s of n)O(this,py,"m",v3).call(this,s,i);if(n.controller.signal?.aborted)throw new zt;return O(this,py,"m",S3).call(this)}[(Kw=new WeakMap,el=new WeakMap,Jw=new WeakMap,py=new WeakSet,b3=function(){this.ended||le(this,el,void 0,"f")},v3=function(r,o){if(this.ended)return;let n=(s,a)=>{(o==null||a.sequence_number>o)&&this._emit(s,a)},i=_3(r,O(this,el,"f"));switch(le(this,el,i,"f"),n("event",r),r.type){case"response.output_text.delta":{let s=i.output[r.output_index];if(!s)throw new J(`missing output at index ${r.output_index}`);if(s.type==="message"){let a=s.content[r.content_index];if(!a)throw new J(`missing content at index ${r.content_index}`);if(a.type!=="output_text")throw new J(`expected content to be 'output_text', got ${a.type}`);n("response.output_text.delta",{...r,snapshot:a.text})}break}case"response.function_call_arguments.delta":{let s=i.output[r.output_index];if(!s)throw new J(`missing output at index ${r.output_index}`);s.type==="function_call"&&n("response.function_call_arguments.delta",{...r,snapshot:s.arguments});break}default:n(r.type,r);break}},S3=function(){if(this.ended)throw new J("stream has ended, this shouldn't happen");let r=O(this,el,"f");if(!r)throw new J("request ended without sending any events");le(this,el,void 0,"f");let o=Wxe(r,O(this,Kw,"f"));return le(this,Jw,o,"f"),o},Symbol.asyncIterator)](){let e=[],r=[],o=!1;return this.on("event",n=>{let i=r.shift();i?i.resolve(n):e.push(n)}),this.on("end",()=>{o=!0;for(let n of r)n.resolve(void 0);r.length=0}),this.on("abort",n=>{o=!0;for(let i of r)i.reject(n);r.length=0}),this.on("error",n=>{o=!0;for(let i of r)i.reject(n);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:o?{value:void 0,done:!0}:new Promise((i,s)=>r.push({resolve:i,reject:s})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}async finalResponse(){await this.done();let e=O(this,Jw,"f");if(!e)throw new J("stream ended without producing a ChatCompletion");return e}};function Wxe(t,e){return g3(t,e)}var Mf=class extends k{list(e,r={},o){return this._client.getAPIList(_`/responses/${e}/input_items`,ve,{query:r,...o,__security:{bearerAuth:!0}})}};var Df=class extends k{count(e={},r){return this._client.post("/responses/input_tokens",{body:e,...r,__security:{bearerAuth:!0}})}};var pi=class extends k{constructor(){super(...arguments),this.inputItems=new Mf(this._client),this.inputTokens=new Df(this._client)}create(e,r){return this._client.post("/responses",{body:e,...r,stream:e.stream??!1,__security:{bearerAuth:!0}})._thenUnwrap(o=>("object"in o&&o.object==="response"&&Cn(o),o))}retrieve(e,r={},o){return this._client.get(_`/responses/${e}`,{query:r,...o,stream:r?.stream??!1,__security:{bearerAuth:!0}})._thenUnwrap(n=>("object"in n&&n.object==="response"&&Cn(n),n))}delete(e,r){return this._client.delete(_`/responses/${e}`,{...r,headers:q([{Accept:"*/*"},r?.headers]),__security:{bearerAuth:!0}})}parse(e,r){return this._client.responses.create(e,r)._thenUnwrap(o=>NM(o,e))}stream(e,r){return Yw.createResponse(this._client,e,r)}cancel(e,r){return this._client.post(_`/responses/${e}/cancel`,{...r,__security:{bearerAuth:!0}})}compact(e,r){return this._client.post("/responses/compact",{body:e,...r,__security:{bearerAuth:!0}})}};pi.InputItems=Mf;pi.InputTokens=Df;var Ff=class extends k{retrieve(e,r){return this._client.get(_`/skills/${e}/content`,{...r,headers:q([{Accept:"application/binary"},r?.headers]),__security:{bearerAuth:!0},__binaryResponse:!0})}};var zf=class extends k{retrieve(e,r,o){let{skill_id:n}=r;return this._client.get(_`/skills/${n}/versions/${e}/content`,{...o,headers:q([{Accept:"application/binary"},o?.headers]),__security:{bearerAuth:!0},__binaryResponse:!0})}};var tl=class extends k{constructor(){super(...arguments),this.content=new zf(this._client)}create(e,r={},o){return this._client.post(_`/skills/${e}/versions`,Ra({body:r,...o,__security:{bearerAuth:!0}},this._client))}retrieve(e,r,o){let{skill_id:n}=r;return this._client.get(_`/skills/${n}/versions/${e}`,{...o,__security:{bearerAuth:!0}})}list(e,r={},o){return this._client.getAPIList(_`/skills/${e}/versions`,ve,{query:r,...o,__security:{bearerAuth:!0}})}delete(e,r,o){let{skill_id:n}=r;return this._client.delete(_`/skills/${n}/versions/${e}`,{...o,__security:{bearerAuth:!0}})}};tl.Content=zf;var ys=class extends k{constructor(){super(...arguments),this.content=new Ff(this._client),this.versions=new tl(this._client)}create(e={},r){return this._client.post("/skills",Ra({body:e,...r,__security:{bearerAuth:!0}},this._client))}retrieve(e,r){return this._client.get(_`/skills/${e}`,{...r,__security:{bearerAuth:!0}})}update(e,r,o){return this._client.post(_`/skills/${e}`,{body:r,...o,__security:{bearerAuth:!0}})}list(e={},r){return this._client.getAPIList("/skills",ve,{query:e,...r,__security:{bearerAuth:!0}})}delete(e,r){return this._client.delete(_`/skills/${e}`,{...r,__security:{bearerAuth:!0}})}};ys.Content=Ff;ys.Versions=tl;var jf=class extends k{create(e,r,o){return this._client.post(_`/uploads/${e}/parts`,kr({body:r,...o,__security:{bearerAuth:!0}},this._client))}};var qa=class extends k{constructor(){super(...arguments),this.parts=new jf(this._client)}create(e,r){return this._client.post("/uploads",{body:e,...r,__security:{bearerAuth:!0}})}cancel(e,r){return this._client.post(_`/uploads/${e}/cancel`,{...r,__security:{bearerAuth:!0}})}complete(e,r,o){return this._client.post(_`/uploads/${e}/complete`,{body:r,...o,__security:{bearerAuth:!0}})}};qa.Parts=jf;var w3=async t=>{let e=await Promise.allSettled(t),r=e.filter(n=>n.status==="rejected");if(r.length){for(let n of r)console.error(n.reason);throw new Error(`${r.length} promise(s) failed - see the above errors`)}let o=[];for(let n of e)n.status==="fulfilled"&&o.push(n.value);return o};var Lf=class extends k{create(e,r,o){return this._client.post(_`/vector_stores/${e}/file_batches`,{body:r,...o,headers:q([{"OpenAI-Beta":"assistants=v2"},o?.headers]),__security:{bearerAuth:!0}})}retrieve(e,r,o){let{vector_store_id:n}=r;return this._client.get(_`/vector_stores/${n}/file_batches/${e}`,{...o,headers:q([{"OpenAI-Beta":"assistants=v2"},o?.headers]),__security:{bearerAuth:!0}})}cancel(e,r,o){let{vector_store_id:n}=r;return this._client.post(_`/vector_stores/${n}/file_batches/${e}/cancel`,{...o,headers:q([{"OpenAI-Beta":"assistants=v2"},o?.headers]),__security:{bearerAuth:!0}})}async createAndPoll(e,r,o){let n=await this.create(e,r);return await this.poll(e,n.id,o)}listFiles(e,r,o){let{vector_store_id:n,...i}=r;return this._client.getAPIList(_`/vector_stores/${n}/file_batches/${e}/files`,ve,{query:i,...o,headers:q([{"OpenAI-Beta":"assistants=v2"},o?.headers]),__security:{bearerAuth:!0}})}async poll(e,r,o){let n=q([o?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":o?.pollIntervalMs?.toString()??void 0}]);for(;;){let{data:i,response:s}=await this.retrieve(r,{vector_store_id:e},{...o,headers:n}).withResponse();switch(i.status){case"in_progress":let a=5e3;if(o?.pollIntervalMs)a=o.pollIntervalMs;else{let c=s.headers.get("openai-poll-after-ms");if(c){let u=parseInt(c);isNaN(u)||(a=u)}}await si(a);break;case"failed":case"cancelled":case"completed":return i}}}async uploadAndPoll(e,{files:r,fileIds:o=[]},n){if(r==null||r.length==0)throw new Error("No `files` provided to process. If you've already uploaded files you should use `.createAndPoll()` instead");let i=n?.maxConcurrency??5,s=Math.min(i,r.length),a=this._client,c=r.values(),u=[...o];async function l(f){for(let d of f){let m=await a.files.create({file:d,purpose:"assistants"},n);u.push(m.id)}}let p=Array(s).fill(c).map(l);return await w3(p),await this.createAndPoll(e,{file_ids:u})}};var Uf=class extends k{create(e,r,o){return this._client.post(_`/vector_stores/${e}/files`,{body:r,...o,headers:q([{"OpenAI-Beta":"assistants=v2"},o?.headers]),__security:{bearerAuth:!0}})}retrieve(e,r,o){let{vector_store_id:n}=r;return this._client.get(_`/vector_stores/${n}/files/${e}`,{...o,headers:q([{"OpenAI-Beta":"assistants=v2"},o?.headers]),__security:{bearerAuth:!0}})}update(e,r,o){let{vector_store_id:n,...i}=r;return this._client.post(_`/vector_stores/${n}/files/${e}`,{body:i,...o,headers:q([{"OpenAI-Beta":"assistants=v2"},o?.headers]),__security:{bearerAuth:!0}})}list(e,r={},o){return this._client.getAPIList(_`/vector_stores/${e}/files`,ve,{query:r,...o,headers:q([{"OpenAI-Beta":"assistants=v2"},o?.headers]),__security:{bearerAuth:!0}})}delete(e,r,o){let{vector_store_id:n}=r;return this._client.delete(_`/vector_stores/${n}/files/${e}`,{...o,headers:q([{"OpenAI-Beta":"assistants=v2"},o?.headers]),__security:{bearerAuth:!0}})}async createAndPoll(e,r,o){let n=await this.create(e,r,o);return await this.poll(e,n.id,o)}async poll(e,r,o){let n=q([o?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":o?.pollIntervalMs?.toString()??void 0}]);for(;;){let i=await this.retrieve(r,{vector_store_id:e},{...o,headers:n}).withResponse(),s=i.data;switch(s.status){case"in_progress":let a=5e3;if(o?.pollIntervalMs)a=o.pollIntervalMs;else{let c=i.response.headers.get("openai-poll-after-ms");if(c){let u=parseInt(c);isNaN(u)||(a=u)}}await si(a);break;case"failed":case"completed":return s}}}async upload(e,r,o){let n=await this._client.files.create({file:r,purpose:"assistants"},o);return this.create(e,{file_id:n.id},o)}async uploadAndPoll(e,r,o){let n=await this.upload(e,r,o);return await this.poll(e,n.id,o)}content(e,r,o){let{vector_store_id:n}=r;return this._client.getAPIList(_`/vector_stores/${n}/files/${e}/content`,Er,{...o,headers:q([{"OpenAI-Beta":"assistants=v2"},o?.headers]),__security:{bearerAuth:!0}})}};var xs=class extends k{constructor(){super(...arguments),this.files=new Uf(this._client),this.fileBatches=new Lf(this._client)}create(e,r){return this._client.post("/vector_stores",{body:e,...r,headers:q([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}retrieve(e,r){return this._client.get(_`/vector_stores/${e}`,{...r,headers:q([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}update(e,r,o){return this._client.post(_`/vector_stores/${e}`,{body:r,...o,headers:q([{"OpenAI-Beta":"assistants=v2"},o?.headers]),__security:{bearerAuth:!0}})}list(e={},r){return this._client.getAPIList("/vector_stores",ve,{query:e,...r,headers:q([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}delete(e,r){return this._client.delete(_`/vector_stores/${e}`,{...r,headers:q([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}search(e,r,o){return this._client.getAPIList(_`/vector_stores/${e}/search`,Er,{body:r,method:"post",...o,headers:q([{"OpenAI-Beta":"assistants=v2"},o?.headers]),__security:{bearerAuth:!0}})}};xs.Files=Uf;xs.FileBatches=Lf;var rl=class extends k{create(e,r){return this._client.post("/videos",kr({body:e,...r,__security:{bearerAuth:!0}},this._client))}retrieve(e,r){return this._client.get(_`/videos/${e}`,{...r,__security:{bearerAuth:!0}})}list(e={},r){return this._client.getAPIList("/videos",qe,{query:e,...r,__security:{bearerAuth:!0}})}delete(e,r){return this._client.delete(_`/videos/${e}`,{...r,__security:{bearerAuth:!0}})}createCharacter(e,r){return this._client.post("/videos/characters",kr({body:e,...r,__security:{bearerAuth:!0}},this._client))}downloadContent(e,r={},o){return this._client.get(_`/videos/${e}/content`,{query:r,...o,headers:q([{Accept:"application/binary"},o?.headers]),__security:{bearerAuth:!0},__binaryResponse:!0})}edit(e,r){return this._client.post("/videos/edits",kr({body:e,...r,__security:{bearerAuth:!0}},this._client))}extend(e,r){return this._client.post("/videos/extensions",kr({body:e,...r,__security:{bearerAuth:!0}},this._client))}getCharacter(e,r){return this._client.get(_`/videos/characters/${e}`,{...r,__security:{bearerAuth:!0}})}remix(e,r,o){return this._client.post(_`/videos/${e}/remix`,Ra({body:r,...o,__security:{bearerAuth:!0}},this._client))}};var qf,E3,Xw,nl=class extends k{constructor(){super(...arguments),qf.add(this)}async unwrap(e,r,o=this._client.webhookSecret,n=300){return await this.verifySignature(e,r,o,n),JSON.parse(e)}async verifySignature(e,r,o=this._client.webhookSecret,n=300){if(typeof crypto>"u"||typeof crypto.subtle.importKey!="function"||typeof crypto.subtle.verify!="function")throw new Error("Webhook signature verification is only supported when the `crypto` global is defined");O(this,qf,"m",E3).call(this,o);let i=q([r]).values,s=O(this,qf,"m",Xw).call(this,i,"webhook-signature"),a=O(this,qf,"m",Xw).call(this,i,"webhook-timestamp"),c=O(this,qf,"m",Xw).call(this,i,"webhook-id"),u=parseInt(a,10);if(isNaN(u))throw new ii("Invalid webhook timestamp format");let l=Math.floor(Date.now()/1e3);if(l-u>n)throw new ii("Webhook timestamp is too old");if(u>l+n)throw new ii("Webhook timestamp is too new");let p=s.split(" ").map(g=>g.startsWith("v1,")?g.substring(3):g),f=o.startsWith("whsec_")?Buffer.from(o.replace("whsec_",""),"base64"):Buffer.from(o,"utf-8"),d=c?`${c}.${a}.${e}`:`${a}.${e}`,m=await crypto.subtle.importKey("raw",f,{name:"HMAC",hash:"SHA-256"},!1,["verify"]);for(let g of p)try{let y=Buffer.from(g,"base64");if(await crypto.subtle.verify("HMAC",m,y,new TextEncoder().encode(d)))return}catch{continue}throw new ii("The given webhook signature does not match the expected signature")}};qf=new WeakSet,E3=function(e){if(typeof e!="string"||e.length===0)throw new Error("The webhook secret must either be set using the env var, OPENAI_WEBHOOK_SECRET, on the client class, OpenAI({ webhookSecret: '123' }), or passed to this function")},Xw=function(e,r){if(!e)throw new Error("Headers are required");let o=e.get(r);if(o==null)throw new Error(`Missing required header: ${r}`);return o};var I3=Symbol.for("openai.node.providerDefinitions.v1"),O3=globalThis,C3=O3[I3],R3=C3??new WeakMap;C3||Object.defineProperty(O3,I3,{value:R3});function A3(t){let e=R3.get(t);if(!e)throw new Error("Invalid provider. Providers must be created with createProvider().");return e.configure()}var MM,DM,dy,T3,e_e="workload-identity-auth",he=class{constructor(e={}){MM.add(this),dy.set(this,void 0),this.completions=new Hu(this),this.chat=new $a(this),this.embeddings=new Wu(this),this.files=new Gu(this),this.images=new Yu(this),this.audio=new ui(this),this.moderations=new Qu(this),this.models=new Xu(this),this.fineTuning=new _o(this),this.graders=new Ua(this),this.vectorStores=new xs(this),this.webhooks=new nl(this),this.beta=new xo(this),this.batches=new zu(this),this.uploads=new qa(this),this.admin=new Na(this),this.responses=new pi(this),this.realtime=new gs(this),this.conversations=new ja(this),this.evals=new La(this),this.containers=new za(this),this.skills=new ys(this),this.videos=new rl(this);let r=e.provider;if(r){let g=["apiKey","adminAPIKey","workloadIdentity","baseURL"].filter(y=>e[y]!=null);if(g.length)throw new J(`The \`provider\` option cannot be used with ${g.map(y=>`\`${y}\``).join(", ")}. Configure authentication and the base URL through the provider instead.`)}let{baseURL:o=r?null:go("OPENAI_BASE_URL"),apiKey:n=r?null:go("OPENAI_API_KEY")??null,adminAPIKey:i=r?null:go("OPENAI_ADMIN_KEY")??null,organization:s=r?null:go("OPENAI_ORG_ID")??null,project:a=r?null:go("OPENAI_PROJECT_ID")??null,webhookSecret:c=go("OPENAI_WEBHOOK_SECRET")??null,workloadIdentity:u,...l}=e,p=r?A3(r):void 0,f={apiKey:n,adminAPIKey:i,organization:s,project:a,webhookSecret:c,workloadIdentity:u,provider:r,...l,baseURL:p?.baseURL??(o||"https://api.openai.com/v1")};if(n&&u)throw new J("The `apiKey` and `workloadIdentity` options are mutually exclusive");if(!p&&!n&&!i&&!u)throw new J("Missing credentials. Please pass an `apiKey`, `workloadIdentity`, `adminAPIKey`, or set the `OPENAI_API_KEY` or `OPENAI_ADMIN_KEY` environment variable.");if(!f.dangerouslyAllowBrowser&&IJ())throw new J(`It looks like you're running in a browser-like environment.
|
|
132
|
+
|
|
133
|
+
This is disabled by default, as it risks exposing your secret API credentials to attackers.
|
|
134
|
+
If you understand the risks and have appropriate mitigations in place,
|
|
135
|
+
you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
|
|
136
|
+
|
|
137
|
+
new OpenAI({ apiKey, dangerouslyAllowBrowser: true });
|
|
138
|
+
|
|
139
|
+
https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
|
|
140
|
+
`);this.baseURL=f.baseURL,this.timeout=f.timeout??DM.DEFAULT_TIMEOUT,this.logger=f.logger??console;let d="warn";this.logLevel=d,this.logLevel=dM(f.logLevel,"ClientOptions.logLevel",this)??dM(go("OPENAI_LOG"),"process.env['OPENAI_LOG']",this)??d,this.fetchOptions=f.fetchOptions,this.maxRetries=f.maxRetries??2,this.fetch=f.fetch??Ew(),le(this,dy,RJ,"f");let m=r?void 0:go("OPENAI_CUSTOM_HEADERS");if(m){let g={};for(let y of m.split(`
|
|
141
|
+
`)){let v=y.indexOf(":");v>=0&&(g[y.substring(0,v).trim()]=y.substring(v+1).trim())}f.defaultHeaders=q([g,f.defaultHeaders])}this._options=f,this._provider=p,u&&(this._workloadIdentityAuth=new Tw(u,this.fetch)),this.apiKey=typeof n=="string"?n:null,this.adminAPIKey=i,this.organization=s,this.project=a,this.webhookSecret=c}withOptions(e){let r=this._options.provider,o=e.provider??r,n={...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this._options.apiKey,adminAPIKey:this.adminAPIKey,workloadIdentity:this._options.workloadIdentity,organization:this.organization,project:this.project,webhookSecret:this.webhookSecret};return o&&(delete n.apiKey,delete n.adminAPIKey,delete n.workloadIdentity,delete n.baseURL,o!==r&&(delete n.organization,delete n.project,delete n.defaultHeaders)),new this.constructor({...n,...e,provider:o})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:r},o={bearerAuth:!0,adminAPIKeyAuth:!0}){if(!(e.get("authorization")||e.get("api-key"))&&!(r.has("authorization")||r.has("api-key"))&&!(this._workloadIdentityAuth&&o.bearerAuth))throw new Error('Could not resolve authentication method. Expected either apiKey or adminAPIKey to be set. Or for one of the "Authorization" or "api-key" headers to be explicitly omitted')}async authHeaders(e,r={bearerAuth:!0,adminAPIKeyAuth:!0}){return q([r.bearerAuth?await this.bearerAuth(e):null,r.adminAPIKeyAuth?await this.adminAPIKeyAuth(e):null])}async bearerAuth(e){if(this._workloadIdentityAuth)return q([{Authorization:`Bearer ${await this._workloadIdentityAuth.getToken()}`}]);if(this.apiKey!=null)return q([{Authorization:`Bearer ${this.apiKey}`}])}async adminAPIKeyAuth(e){if(this.adminAPIKey!=null)return q([{Authorization:`Bearer ${this.adminAPIKey}`}])}stringifyQuery(e){return zJ(e)}getUserAgent(){return`${this.constructor.name}/JS ${Ca}`}defaultIdempotencyKey(){return`stainless-node-retry-${QN()}`}makeStatusError(e,r,o,n){return Ot.generate(e,r,o,n)}async _callApiKey(){if(this._provider)return!1;let e=this._options.apiKey;if(typeof e!="function")return!1;let r;try{r=await e()}catch(o){throw o instanceof J?o:new J(`Failed to get token from 'apiKey' function: ${o.message}`,{cause:o})}if(typeof r!="string"||!r)throw new J(`Expected 'apiKey' function argument to return a string but it returned ${r}`);return this.apiKey=r,!0}buildURL(e,r,o){let n=!O(this,MM,"m",T3).call(this)&&o||this.baseURL,i=_J(e)?new URL(e):new URL(n+(n.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),s=this.defaultQuery(),a=Object.fromEntries(i.searchParams);return(!tM(s)||!tM(a))&&(r={...a,...s,...r}),typeof r=="object"&&r&&!Array.isArray(r)&&(i.search=this.stringifyQuery(r)),i.toString()}async prepareOptions(e){if(this._provider)return;(e.__security??{bearerAuth:!0}).bearerAuth&&await this._callApiKey()}async prepareRequest(e,{url:r,options:o}){}get(e,r){return this.methodRequest("get",e,r)}post(e,r){return this.methodRequest("post",e,r)}patch(e,r){return this.methodRequest("patch",e,r)}put(e,r){return this.methodRequest("put",e,r)}delete(e,r){return this.methodRequest("delete",e,r)}methodRequest(e,r,o){return this.request(Promise.resolve(o).then(n=>({method:e,path:r,...n})))}request(e,r=null){return new Tu(this,this.makeRequest(e,r,void 0))}async makeRequest(e,r,o){let n=await e,i=n.maxRetries??this.maxRetries;r==null&&(r=i),await this.prepareOptions(n);let{req:s,url:a,timeout:c}=await this.buildRequest(n,{retryCount:i-r});await this.prepareRequest(s,{url:a,options:n}),await this._provider?.prepareRequest?.(s,{url:a,options:n});let u="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),l=o===void 0?"":`, retryOf: ${o}`,p=Date.now();if($t(this).debug(`[${u}] sending request`,ps({retryOfRequestLogID:o,method:n.method,url:a,options:n,headers:s.headers})),n.signal?.aborted)throw new zt;let f=n.__security??{bearerAuth:!0},d=new AbortController,m=await this.fetchWithAuth(a,s,c,d,f).catch(Wg),g=Date.now();if(m instanceof globalThis.Error){let E=`retrying, ${r} attempts remaining`;if(n.signal?.aborted)throw new zt;let R=Bg(m)||/timed? ?out/i.test(String(m)+("cause"in m?String(m.cause):""));if(r)return $t(this).info(`[${u}] connection ${R?"timed out":"failed"} - ${E}`),$t(this).debug(`[${u}] connection ${R?"timed out":"failed"} (${E})`,ps({retryOfRequestLogID:o,url:a,durationMs:g-p,message:m.message})),this.retryRequest(n,r,o??u);throw $t(this).info(`[${u}] connection ${R?"timed out":"failed"} - error; no more retries left`),$t(this).debug(`[${u}] connection ${R?"timed out":"failed"} (error; no more retries left)`,ps({retryOfRequestLogID:o,url:a,durationMs:g-p,message:m.message})),m instanceof Ru||m instanceof Zg?m:R?new Oa:new Ia({message:t_e(m),cause:m})}let y=[...m.headers.entries()].filter(([E])=>E==="x-request-id").map(([E,R])=>", "+E+": "+JSON.stringify(R)).join(""),v=`[${u}${l}${y}] ${s.method} ${a} ${m.ok?"succeeded":"failed"} with status ${m.status} in ${g-p}ms`;if(!m.ok){if(m.status===401&&this._workloadIdentityAuth&&f.bearerAuth&&!n.__metadata?.hasStreamingBody&&!n.__metadata?.workloadIdentityTokenRefreshed)return await oM(m.body),this._workloadIdentityAuth.invalidateToken(),this.makeRequest({...n,__metadata:{...n.__metadata,workloadIdentityTokenRefreshed:!0}},r,o??u);let E=await this.shouldRetry(m);if(r&&E){let N=`retrying, ${r} attempts remaining`;return await oM(m.body),$t(this).info(`${v} - ${N}`),$t(this).debug(`[${u}] response error (${N})`,ps({retryOfRequestLogID:o,url:m.url,status:m.status,headers:m.headers,durationMs:g-p})),this.retryRequest(n,r,o??u,m.headers)}let R=E?"error; no more retries left":"error; not retryable";$t(this).info(`${v} - ${R}`);let S=await m.text().catch(N=>Wg(N).message),P=SJ(S),D=P?void 0:S;throw $t(this).debug(`[${u}] response error (${R})`,ps({retryOfRequestLogID:o,url:m.url,status:m.status,headers:m.headers,message:D,durationMs:Date.now()-p})),this.makeStatusError(m.status,P,D,m.headers)}return $t(this).info(v),$t(this).debug(`[${u}] response start`,ps({retryOfRequestLogID:o,url:m.url,status:m.status,headers:m.headers,durationMs:g-p})),{response:m,options:n,controller:d,requestLogID:u,retryOfRequestLogID:o,startTime:p}}getAPIList(e,r,o){return this.requestAPIList(r,o&&"then"in o?o.then(n=>({method:"get",path:e,...n})):{method:"get",path:e,...o})}requestAPIList(e,r){let o=this.makeRequest(r,null,void 0);return new Yg(this,o,e)}async fetchWithAuth(e,r,o,n,i={bearerAuth:!0,adminAPIKeyAuth:!0}){if(this._workloadIdentityAuth&&i.bearerAuth){let a=r.headers,c=a.get("Authorization");if(!c||c===`Bearer ${e_e}`){let u=await this._workloadIdentityAuth.getToken();a.set("Authorization",`Bearer ${u}`)}}return await this.fetchWithTimeout(e,r,o,n)}async fetchWithTimeout(e,r,o,n){let{signal:i,method:s,...a}=r||{},c=this._makeAbort(n);i&&i.addEventListener("abort",c,{once:!0});let u=setTimeout(c,o),l=globalThis.ReadableStream&&a.body instanceof globalThis.ReadableStream||typeof a.body=="object"&&a.body!==null&&Symbol.asyncIterator in a.body,p={signal:n.signal,...l?{duplex:"half"}:{},method:"GET",...a};s&&(p.method=s.toUpperCase());try{return await this.fetch.call(void 0,e,p)}finally{clearTimeout(u)}}async shouldRetry(e){let r=e.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,r,o,n){let i,s=n?.get("retry-after-ms");if(s){let c=parseFloat(s);Number.isNaN(c)||(i=c)}let a=n?.get("retry-after");if(a&&!i){let c=parseFloat(a);Number.isNaN(c)?i=Date.parse(a)-Date.now():i=c*1e3}if(i===void 0){let c=e.maxRetries??this.maxRetries;i=this.calculateDefaultRetryTimeoutMillis(r,c)}return await si(i),this.makeRequest(e,r-1,o)}calculateDefaultRetryTimeoutMillis(e,r){let i=r-e,s=Math.min(.5*Math.pow(2,i),8),a=1-Math.random()*.25;return s*a*1e3}async buildRequest(e,{retryCount:r=0}={}){let o={...e},{method:n,path:i,query:s,defaultBaseURL:a}=o,c=this.buildURL(i,s,a);"timeout"in o&&vJ("timeout",o.timeout),o.timeout=o.timeout??this.timeout;let{bodyHeaders:u,body:l,isStreamingBody:p}=this.buildBody({options:o});p&&(e.__metadata={...e.__metadata,hasStreamingBody:!0});let f=await this.buildHeaders({options:e,method:n,bodyHeaders:u,retryCount:r});return{req:{method:n,headers:f,...o.signal&&{signal:o.signal},...globalThis.ReadableStream&&l instanceof globalThis.ReadableStream&&{duplex:"half"},...l&&{body:l},...this.fetchOptions??{},...o.fetchOptions??{}},url:c,timeout:o.timeout}}async buildHeaders({options:e,method:r,bodyHeaders:o,retryCount:n}){let i={};this.idempotencyHeader&&r!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),i[this.idempotencyHeader]=e.idempotencyKey);let s=q([i,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(n),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...OJ(),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project},this._provider?void 0:await this.authHeaders(e,e.__security??{bearerAuth:!0}),this._options.defaultHeaders,o,e.headers]);return this._provider||this.validateHeaders(s,e.__security??{bearerAuth:!0}),s.values}_makeAbort(e){return()=>e.abort()}buildBody({options:e}){let{body:r,headers:o}=e;if(!r)return r===void 0&&"body"in e?{...O(this,dy,"f").call(this,{body:r,headers:q([o])}),isStreamingBody:!1}:{bodyHeaders:void 0,body:void 0,isStreamingBody:!1};let n=q([o]),i=typeof globalThis.ReadableStream<"u"&&r instanceof globalThis.ReadableStream,s=!i&&(typeof r=="string"||r instanceof ArrayBuffer||ArrayBuffer.isView(r)||typeof globalThis.Blob<"u"&&r instanceof globalThis.Blob||r instanceof URLSearchParams||r instanceof FormData);return ArrayBuffer.isView(r)||r instanceof ArrayBuffer||r instanceof DataView||typeof r=="string"&&n.values.has("content-type")||globalThis.Blob&&r instanceof globalThis.Blob||r instanceof FormData||r instanceof URLSearchParams||i?{bodyHeaders:void 0,body:r,isStreamingBody:!s}:typeof r=="object"&&(Symbol.asyncIterator in r||Symbol.iterator in r&&"next"in r&&typeof r.next=="function")?{bodyHeaders:void 0,body:kw(r),isStreamingBody:!0}:typeof r=="object"&&n.values.get("content-type")==="application/x-www-form-urlencoded"?{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(r),isStreamingBody:!1}:{...O(this,dy,"f").call(this,{body:r,headers:n}),isStreamingBody:!1}}};DM=he,dy=new WeakMap,MM=new WeakSet,T3=function(){return this._provider!==void 0||this.baseURL!=="https://api.openai.com/v1"};he.OpenAI=DM;he.DEFAULT_TIMEOUT=6e5;he.OpenAIError=J;he.APIError=Ot;he.APIConnectionError=Ia;he.APIConnectionTimeoutError=Oa;he.APIUserAbortError=zt;he.NotFoundError=Td;he.ConflictError=$d;he.RateLimitError=Nd;he.BadRequestError=Cd;he.AuthenticationError=Rd;he.InternalServerError=Md;he.PermissionDeniedError=Ad;he.UnprocessableEntityError=Pd;he.InvalidWebhookSignatureError=ii;he.toFile=Pw;he.Completions=Hu;he.Chat=$a;he.Embeddings=Wu;he.Files=Gu;he.Images=Yu;he.Audio=ui;he.Moderations=Qu;he.Models=Xu;he.FineTuning=_o;he.Graders=Ua;he.VectorStores=xs;he.Webhooks=nl;he.Beta=xo;he.Batches=zu;he.Uploads=qa;he.Admin=Na;he.Responses=pi;he.Realtime=gs;he.Conversations=ja;he.Evals=La;he.Containers=za;he.Skills=ys;he.Videos=rl;function t_e(t){if(r_e(t))return"Connection error. This may be caused by passing an undici dispatcher, such as ProxyAgent, that is incompatible with the fetch implementation. If you are using undici's ProxyAgent, pass the fetch implementation from the same undici package: import { fetch, ProxyAgent } from 'undici'; new OpenAI({ fetch, fetchOptions: { dispatcher: new ProxyAgent(...) } });"}function r_e(t){let e=t;for(let r=0;r<8&&e&&typeof e=="object";r++){let o=e;if(o.code==="UND_ERR_INVALID_ARG"&&typeof o.message=="string"&&o.message.includes("invalid onRequestStart method"))return!0;e=o.cause}return!1}var n_e=new Set(["date-time","time","date","duration","email","hostname","ipv4","ipv6","uuid"]);function Ha(t){if(Array.isArray(t))return t.map(Ha);if(t===null||typeof t!="object")return t;let e={};for(let[r,o]of Object.entries(t))r==="format"&&typeof o=="string"&&!n_e.has(o)||(e[r]=Ha(o));return e}function di(t,e){return Ha(Hf(t,e))}var o_e=["oneOf","allOf","not","$ref","$defs","definitions"],i_e=["type","enum","const","anyOf","oneOf","allOf","$ref"];function fy(t){return!FM(t)&&!$3(t)}function FM(t){if(Array.isArray(t))return t.some(FM);if(t===null||typeof t!="object")return!1;for(let[e,r]of Object.entries(t))if(o_e.includes(e)||FM(r))return!0;return!1}function s_e(t){return t===null||typeof t!="object"||Array.isArray(t)?!1:!i_e.some(e=>e in t)}function $3(t){if(t===null||typeof t!="object"||Array.isArray(t))return!1;let e=t,r=[];return e.properties&&typeof e.properties=="object"&&r.push(...Object.values(e.properties)),e.items!==void 0&&r.push(...Array.isArray(e.items)?e.items:[e.items]),Array.isArray(e.anyOf)&&r.push(...e.anyOf),r.some(o=>s_e(o)||$3(o))}function Hf(t,e){let r={...t},o=e??(Array.isArray(r.required)?r.required:[]);if(r.type==="object"&&r.properties){let n={...r.properties},i=Object.keys(n);for(let s of i){let a=n[s],c=!o.includes(s);if(a.type==="object"&&a.properties)a=Hf(a,a.required||[]);else if(a.type==="array"&&a.items)a={...a,items:Hf(a.items,a.items.required||[])};else if(a.anyOf)a=Hf(a,a.required||[]);else if(a.oneOf)throw new Error("oneOf is not supported in OpenAI structured output schemas. Check the supported outputs here: https://platform.openai.com/docs/guides/structured-outputs#supported-types");c&&(a.anyOf?a.anyOf.some(u=>u.type==="null")||(a={...a,anyOf:[...a.anyOf,{type:"null"}]}):a.type&&!Array.isArray(a.type)?a={...a,type:[a.type,"null"]}:Array.isArray(a.type)&&!a.type.includes("null")&&(a={...a,type:[...a.type,"null"]})),n[s]=a}r.properties=n,r.required=i,r.additionalProperties=!1}if(r.type==="array"&&r.items&&(r.items=Hf(r.items,r.items.required||[])),r.anyOf&&Array.isArray(r.anyOf)&&(r.anyOf=r.anyOf.map(n=>Hf(n,n.required||[]))),r.oneOf)throw new Error("oneOf is not supported in OpenAI structured output schemas. Check the supported outputs here: https://platform.openai.com/docs/guides/structured-outputs#supported-types");return r}function Qw(t){if(!t)return;let e=Sw({promptTokens:t.prompt_tokens||0,completionTokens:t.completion_tokens||0,totalTokens:t.total_tokens||0}),r=t.completion_tokens_details,o={...r?.reasoning_tokens?{reasoningTokens:r.reasoning_tokens}:{},...r?.audio_tokens?{audioTokens:r.audio_tokens}:{}},n=t.prompt_tokens_details,i={...n?.cached_tokens?{cachedTokens:n.cached_tokens}:{},...n?.audio_tokens?{audioTokens:n.audio_tokens}:{}};Object.keys(o).length>0&&(e.completionTokensDetails=o),Object.keys(i).length>0&&(e.promptTokensDetails=i);let s={...r?.accepted_prediction_tokens?{acceptedPredictionTokens:r.accepted_prediction_tokens}:{},...r?.rejected_prediction_tokens?{rejectedPredictionTokens:r.rejected_prediction_tokens}:{}};return Object.keys(s).length>0&&(e.providerUsageDetails=s),e}function eE(t){if(!t)return;let e=Sw({promptTokens:t.input_tokens||0,completionTokens:t.output_tokens||0,totalTokens:t.total_tokens||0}),r=t.input_tokens_details?.cached_tokens;r&&r>0&&(e.promptTokensDetails={...e.promptTokensDetails,cachedTokens:r});let o=t.output_tokens_details?.reasoning_tokens;return o&&o>0&&(e.completionTokensDetails={...e.completionTokensDetails,reasoningTokens:o}),e}var ol=class{kind="text";model;requires=void 0;config;constructor(e={},r){this.config=e,this.model=r}generateId(){return`${this.name}-${Date.now()}-${Math.random().toString(36).substring(7)}`}};function Ba(t){return t?{...t.headers!==void 0&&{headers:t.headers},...t.signal!=null&&{signal:t.signal}}:{}}function P3(t,e=di){let r=t.inputSchema??{type:"object",properties:{},required:[]};if(!fy(r))return{type:"function",function:{name:t.name,description:t.description,parameters:Ha(r),strict:!1}};let o={...e(r,r.required||[])};return o.additionalProperties=!1,{type:"function",function:{name:t.name,description:t.description,parameters:o,strict:!0}}}function zM(t,e){return t.map(r=>P3(r,e))}var my=class extends ol{kind="text";name;client;constructor(e,r,o){super({},e),this.name=r,this.client=o}async*chatStream(e){let r={runId:et(this.name),threadId:e.threadId??et(this.name),messageId:et(this.name),hasEmittedRunStarted:!1};try{let o=this.mapOptionsToRequest(e);e.logger.request(`activity=chat provider=${this.name} model=${this.model} messages=${e.messages.length} tools=${e.tools?.length??0} stream=true`,{provider:this.name,model:this.model});let n=await this.client.chat.completions.create({...o,stream:!0,stream_options:{include_usage:!0}},Ba(e.request));yield*this.processStreamChunks(n,e,r)}catch(o){let n=vr(o,`${this.name}.chatStream failed`),i=ss(o);r.hasEmittedRunStarted||(r.hasEmittedRunStarted=!0,yield{type:A.RUN_STARTED,runId:r.runId,threadId:r.threadId,model:e.model,timestamp:Date.now(),parentRunId:e.parentRunId}),yield{type:A.RUN_ERROR,model:e.model,timestamp:Date.now(),message:n.message,code:n.code,...i!==void 0&&{rawEvent:i},error:{message:n.message,code:n.code}},e.logger.errors(`${this.name}.chatStream fatal`,{error:n,source:`${this.name}.chatStream`})}}async structuredOutput(e){let{chatOptions:r,outputSchema:o}=e,n=this.mapOptionsToRequest(r),i=this.makeStructuredOutputCompatible(o,o.required);try{let{stream_options:s,stream:a,...c}=n;r.logger.request(`activity=structuredOutput provider=${this.name} model=${this.model} messages=${r.messages.length}`,{provider:this.name,model:this.model});let l=(await this.client.chat.completions.create({...c,stream:!1,response_format:{type:"json_schema",json_schema:{name:"structured_output",schema:i,strict:!0}}},Ba(r.request))).choices[0]?.message.content;if(typeof l!="string"||l.length===0)throw new Error(`${this.name}.structuredOutput: response contained no content`);let p;try{p=JSON.parse(l)}catch{throw new Error(`Failed to parse structured output as JSON. Content: ${l.slice(0,200)}${l.length>200?"...":""}`)}return{data:this.transformStructuredOutput(p),rawText:l}}catch(s){throw r.logger.errors(`${this.name}.structuredOutput fatal`,{error:vr(s,`${this.name}.structuredOutput failed`),source:`${this.name}.structuredOutput`}),s}}async*structuredOutputStream(e){let{chatOptions:r,outputSchema:o}=e,n=this.mapOptionsToRequest(r),i=this.makeStructuredOutputCompatible(o,o.required),s=Date.now(),a={runId:et(this.name),threadId:r.threadId??et(this.name),messageId:et(this.name),timestamp:s,hasEmittedRunStarted:!1},c="",u="",l=!1,p,f=!1,d,m,g,y=(function*(){p&&!f&&(f=!0,yield{type:A.REASONING_MESSAGE_END,messageId:p,model:m||r.model,timestamp:s},yield{type:A.REASONING_END,messageId:p,model:m||r.model,timestamp:s},d&&(yield{type:A.STEP_FINISHED,stepName:d,stepId:d,model:m||r.model,timestamp:s,content:u}))}).bind(this);try{let{stream_options:v,stream:E,tools:R,...S}=n;r.logger.request(`activity=structuredOutputStream provider=${this.name} model=${this.model} messages=${r.messages.length}`,{provider:this.name,model:this.model});let P=await this.client.chat.completions.create({...S,stream:!0,stream_options:{include_usage:!0},response_format:{type:"json_schema",json_schema:{name:"structured_output",schema:i,strict:!0}}},Ba(r.request));for await(let N of P){let ie=N.choices[0];r.logger.provider(`provider=${this.name} finish_reason=${ie?.finish_reason??"none"} hasContent=${!!ie?.delta.content} hasUsage=${!!N.usage}`,{provider:this.name,model:N.model}),N.model&&(m=N.model);let ue=N.usage??N.x_groq?.usage;ue&&(g=ue),a.hasEmittedRunStarted||(a.hasEmittedRunStarted=!0,yield{type:A.RUN_STARTED,runId:a.runId,threadId:a.threadId,model:N.model||r.model,timestamp:s,parentRunId:r.parentRunId});let W=this.extractReasoning(N);W&&W.text&&(p||(p=et(this.name),d=et(this.name),yield{type:A.REASONING_START,messageId:p,model:N.model||r.model,timestamp:s},yield{type:A.REASONING_MESSAGE_START,messageId:p,role:"reasoning",model:N.model||r.model,timestamp:s},yield{type:A.STEP_STARTED,stepName:d,stepId:d,model:N.model||r.model,timestamp:s,stepType:"thinking"}),u+=W.text,yield{type:A.REASONING_MESSAGE_CONTENT,messageId:p,delta:W.text,model:N.model||r.model,timestamp:s});let Ae=N.choices[0];if(!Ae)continue;let ge=Ae.delta.content;ge&&(yield*y(),l||(l=!0,yield{type:A.TEXT_MESSAGE_START,messageId:a.messageId,model:N.model||r.model,timestamp:s,role:"assistant"}),c+=ge,yield{type:A.TEXT_MESSAGE_CONTENT,messageId:a.messageId,model:N.model||r.model,timestamp:s,delta:ge,content:c})}if(yield*y(),l&&(yield{type:A.TEXT_MESSAGE_END,messageId:a.messageId,model:m||r.model,timestamp:s}),c.length===0){yield{type:A.RUN_ERROR,runId:a.runId,model:m||r.model,timestamp:s,message:`${this.name}.structuredOutputStream: response contained no content`,code:"empty-response",error:{message:`${this.name}.structuredOutputStream: response contained no content`,code:"empty-response"}};return}let D;try{D=JSON.parse(c)}catch{yield{type:A.RUN_ERROR,runId:a.runId,model:m||r.model,timestamp:s,message:`Failed to parse structured output as JSON. Content: ${c.slice(0,200)}${c.length>200?"...":""}`,code:"parse-error",error:{message:"Failed to parse structured output as JSON",code:"parse-error"}};return}let X=this.transformStructuredOutput(D);yield{type:A.CUSTOM,name:"structured-output.complete",value:{object:X,raw:c,...u?{reasoning:u}:{}},model:m||r.model,timestamp:s},yield{type:A.RUN_FINISHED,runId:a.runId,threadId:a.threadId,model:m||r.model,timestamp:s,finishReason:"stop",...g&&{usage:Qw(g)}}}catch(v){a.hasEmittedRunStarted||(a.hasEmittedRunStarted=!0,yield{type:A.RUN_STARTED,runId:a.runId,threadId:a.threadId,model:r.model,timestamp:s,parentRunId:r.parentRunId});let E=this.isAbortError(v),R=vr(v,`${this.name}.structuredOutputStream failed`),S=E?"aborted":R.code,P=E?void 0:ss(v);yield{type:A.RUN_ERROR,runId:a.runId,model:m||r.model,timestamp:s,message:R.message,...S!==void 0&&{code:S},...P!==void 0&&{rawEvent:P},error:{message:R.message,...S!==void 0&&{code:S}}},r.logger.errors(`${this.name}.structuredOutputStream fatal`,{error:R,source:`${this.name}.structuredOutputStream`})}}isAbortError(e){if(!e||typeof e!="object")return!1;let r=e;return r.name==="APIUserAbortError"||r.name==="AbortError"||r.code==="ERR_CANCELED"}makeStructuredOutputCompatible(e,r){return di(e,r)}extractReasoning(e){}transformStructuredOutput(e){return e}async*processStreamChunks(e,r,o){let n="",i=!1,s,a,c,u=new Map,l,p=!1,f,d="",m=!1;try{for await(let g of e){let y=g.choices[0];r.logger.provider(`provider=${this.name} finish_reason=${y?.finish_reason??"none"} hasContent=${!!y?.delta.content} hasToolCalls=${!!y?.delta.tool_calls} hasUsage=${!!g.usage}`,{provider:this.name,model:g.model}),g.usage&&(a=g.usage),g.model&&(s=g.model),o.hasEmittedRunStarted||(o.hasEmittedRunStarted=!0,yield{type:A.RUN_STARTED,runId:o.runId,threadId:o.threadId,model:g.model||r.model,timestamp:Date.now(),parentRunId:r.parentRunId});let v=this.extractReasoning(g);v&&v.text&&(l||(l=et(this.name),f=et(this.name),yield{type:A.REASONING_START,messageId:l,model:g.model||r.model,timestamp:Date.now()},yield{type:A.REASONING_MESSAGE_START,messageId:l,role:"reasoning",model:g.model||r.model,timestamp:Date.now()},yield{type:A.STEP_STARTED,stepName:f,stepId:f,model:g.model||r.model,timestamp:Date.now(),stepType:"thinking"}),d+=v.text,yield{type:A.REASONING_MESSAGE_CONTENT,messageId:l,delta:v.text,model:g.model||r.model,timestamp:Date.now()});let E=g.choices[0];if(!E)continue;let R=E.delta,S=R.content,P=R.tool_calls;if(S&&(l&&!p&&(p=!0,yield{type:A.REASONING_MESSAGE_END,messageId:l,model:g.model||r.model,timestamp:Date.now()},yield{type:A.REASONING_END,messageId:l,model:g.model||r.model,timestamp:Date.now()},f&&(yield{type:A.STEP_FINISHED,stepName:f,stepId:f,model:g.model||r.model,timestamp:Date.now(),content:d})),i||(i=!0,yield{type:A.TEXT_MESSAGE_START,messageId:o.messageId,model:g.model||r.model,timestamp:Date.now(),role:"assistant"}),n+=S,yield{type:A.TEXT_MESSAGE_CONTENT,messageId:o.messageId,model:g.model||r.model,timestamp:Date.now(),delta:S,content:n}),P)for(let D of P){let X=D.index,N=u.get(X);N||(N={id:D.id||"",name:D.function?.name||"",arguments:"",started:!1},u.set(X,N)),D.id&&(N.id=D.id),D.function?.name&&(N.name=D.function.name),D.function?.arguments&&(N.arguments+=D.function.arguments),N.id&&N.name&&!N.started&&(N.started=!0,yield{type:A.TOOL_CALL_START,toolCallId:N.id,toolCallName:N.name,toolName:N.name,parentMessageId:o.messageId,model:g.model||r.model,timestamp:Date.now(),index:X}),D.function?.arguments&&N.started&&(yield{type:A.TOOL_CALL_ARGS,toolCallId:N.id,model:g.model||r.model,timestamp:Date.now(),delta:D.function.arguments})}if(E.finish_reason){if(E.finish_reason==="tool_calls"||u.size>0){for(let[,D]of u){if(!D.started)continue;let X={};if(D.arguments)try{let N=JSON.parse(D.arguments);X=N&&typeof N=="object"?N:{}}catch(N){r.logger.errors(`${this.name}.processStreamChunks tool-args JSON parse failed`,{error:vr(N,`tool ${D.name} (${D.id}) returned malformed JSON arguments`),source:`${this.name}.processStreamChunks`,toolCallId:D.id,toolName:D.name,rawArguments:D.arguments}),X={}}yield{type:A.TOOL_CALL_END,toolCallId:D.id,toolCallName:D.name,toolName:D.name,model:g.model||r.model,timestamp:Date.now(),input:X},m=!0}u.clear()}i&&(yield{type:A.TEXT_MESSAGE_END,messageId:o.messageId,model:g.model||r.model,timestamp:Date.now()},i=!1),c=E.finish_reason}}if(o.hasEmittedRunStarted){let g=0;for(let[,v]of u){if(!v.started)continue;let E={};if(v.arguments)try{let R=JSON.parse(v.arguments);E=R&&typeof R=="object"?R:{}}catch(R){r.logger.errors(`${this.name}.processStreamChunks tool-args JSON parse failed (drain)`,{error:vr(R,`tool ${v.name} (${v.id}) returned malformed JSON arguments`),source:`${this.name}.processStreamChunks`,toolCallId:v.id,toolName:v.name,rawArguments:v.arguments}),E={}}yield{type:A.TOOL_CALL_END,toolCallId:v.id,toolCallName:v.name,toolName:v.name,model:s||r.model,timestamp:Date.now(),input:E},g+=1,m=!0}u.clear(),i&&(yield{type:A.TEXT_MESSAGE_END,messageId:o.messageId,model:s||r.model,timestamp:Date.now()}),l&&!p&&(p=!0,yield{type:A.REASONING_MESSAGE_END,messageId:l,model:s||r.model,timestamp:Date.now()},yield{type:A.REASONING_END,messageId:l,model:s||r.model,timestamp:Date.now()},f&&(yield{type:A.STEP_FINISHED,stepName:f,stepId:f,model:s||r.model,timestamp:Date.now(),content:d}));let y=m?"tool_calls":c==="tool_calls"?"stop":c==="function_call"?"tool_calls":c??"stop";yield{type:A.RUN_FINISHED,runId:o.runId,threadId:o.threadId,model:s||r.model,timestamp:Date.now(),...a&&{usage:Qw(a)},finishReason:y}}}catch(g){let y=vr(g,`${this.name}.processStreamChunks failed`),v=ss(g);r.logger.errors(`${this.name}.processStreamChunks fatal`,{error:y,source:`${this.name}.processStreamChunks`}),yield{type:A.RUN_ERROR,model:r.model,timestamp:Date.now(),message:y.message,...y.code!==void 0&&{code:y.code},...v!==void 0&&{rawEvent:v},error:{message:y.message,...y.code!==void 0&&{code:y.code}}}}}mapOptionsToRequest(e){let r=e.tools?zM(e.tools,this.makeStructuredOutputCompatible.bind(this)):void 0,o=[],n=Hg(e.systemPrompts);n.length>0&&o.push({role:"system",content:n.map(c=>c.content).join(`
|
|
142
|
+
`)});for(let c of e.messages)o.push(this.convertMessage(c));let i=e.modelOptions,s=e.outputSchema,a=s?{response_format:{type:"json_schema",json_schema:{name:"structured_output",schema:this.makeStructuredOutputCompatible(s,Array.isArray(s.required)?s.required:void 0),strict:!0}}}:void 0;return{...i,model:e.model,messages:o,...r&&r.length>0&&{tools:r},...a??{},stream:!0}}supportsCombinedToolsAndSchema(){return!0}convertMessage(e){if(e.role==="tool")return{role:"tool",tool_call_id:e.toolCallId||"",content:typeof e.content=="string"?e.content:JSON.stringify(e.content)};if(e.role==="assistant"){let n=e.toolCalls?.map(a=>({id:a.id,type:"function",function:{name:a.function.name,arguments:typeof a.function.arguments=="string"?a.function.arguments:JSON.stringify(a.function.arguments)}})),i=!!n&&n.length>0,s=this.extractTextContent(e.content);return{role:"assistant",content:i&&!s?null:s,...i?{tool_calls:n}:{}}}let r=this.normalizeContent(e.content);if(r.length===1&&r[0]?.type==="text"){let n=r[0].content;if(n.length===0)throw new Error(`User message for ${this.name} has empty text content. Empty user messages would produce a paid request with no input; provide non-empty content or omit the message.`);return{role:"user",content:n}}let o=[];for(let n of r){let i=this.convertContentPart(n);if(!i)throw new Error(`Unsupported content part type for ${this.name}: ${n.type}. Override convertContentPart() in a subclass to handle this type, or remove it from the message.`);o.push(i)}if(o.length===0)throw new Error(`User message for ${this.name} has no content parts. Empty user messages would produce a paid request with no input; provide at least one text/image/audio part or omit the message.`);return{role:"user",content:o}}convertContentPart(e){if(e.type==="text")return{type:"text",text:e.content};if(e.type==="image"){let r=e.metadata,o=e.source.value,n=e.source.mimeType||"application/octet-stream";return{type:"image_url",image_url:{url:e.source.type==="data"&&!o.startsWith("data:")?`data:${n};base64,${o}`:o,detail:r?.detail||"auto"}}}return null}normalizeContent(e){return e===null?[]:typeof e=="string"?[{type:"text",content:e}]:e}extractTextContent(e){return e===null?"":typeof e=="string"?e:e.filter(r=>r.type==="text").map(r=>r.content).join("")}};function N3(t,e=di){let r=t.inputSchema??{type:"object",properties:{},required:[]};if(!fy(r))return{type:"function",name:t.name,description:t.description,parameters:Ha(r),strict:!1};let o={...e(r,r.required||[])};return o.additionalProperties=!1,{type:"function",name:t.name,description:t.description,parameters:o,strict:!0}}function jM(t,e){return t.map(r=>N3(r,e))}var hy=class extends ol{kind="text";name;client;constructor(e,r,o){super({},e),this.name=r,this.client=o}async*chatStream(e){let r=new Map,o={runId:et(this.name),threadId:e.threadId??et(this.name),messageId:et(this.name),hasEmittedRunStarted:!1};try{let n=this.mapOptionsToRequest(e);e.logger.request(`activity=chat provider=${this.name} model=${this.model} messages=${e.messages.length} tools=${e.tools?.length??0} stream=true`,{provider:this.name,model:this.model});let i=await this.client.responses.create({...n,stream:!0},Ba(e.request));yield*this.processStreamChunks(i,r,e,o)}catch(n){let i=vr(n,`${this.name}.chatStream failed`),s=ss(n);o.hasEmittedRunStarted||(o.hasEmittedRunStarted=!0,yield{type:A.RUN_STARTED,runId:o.runId,threadId:o.threadId,model:e.model,timestamp:Date.now(),parentRunId:e.parentRunId}),yield{type:A.RUN_ERROR,model:e.model,timestamp:Date.now(),message:i.message,code:i.code,...s!==void 0&&{rawEvent:s},error:{message:i.message,code:i.code}},e.logger.errors(`${this.name}.chatStream fatal`,{error:i,source:`${this.name}.chatStream`})}}async structuredOutput(e){let{chatOptions:r,outputSchema:o}=e,n=this.mapOptionsToRequest(r),i=this.makeStructuredOutputCompatible(o,o.required);try{let{stream:s,stream_options:a,...c}=n;r.logger.request(`activity=structuredOutput provider=${this.name} model=${this.model} messages=${r.messages.length}`,{provider:this.name,model:this.model});let u=await this.client.responses.create({...c,stream:!1,text:{format:{type:"json_schema",name:"structured_output",schema:i,strict:!0}}},Ba(r.request)),l=this.extractTextFromResponse(u);if(l.length===0)throw new Error(`${this.name}.structuredOutput: response contained no content`);let p;try{p=JSON.parse(l)}catch{throw new Error(`Failed to parse structured output as JSON. Content: ${l.slice(0,200)}${l.length>200?"...":""}`)}return{data:this.transformStructuredOutput(p),rawText:l}}catch(s){throw r.logger.errors(`${this.name}.structuredOutput fatal`,{error:vr(s,`${this.name}.structuredOutput failed`),source:`${this.name}.structuredOutput`}),s}}async*structuredOutputStream(e){let{chatOptions:r,outputSchema:o}=e,n=this.mapOptionsToRequest(r),i=this.makeStructuredOutputCompatible(o,o.required),s=Date.now(),a={runId:et(this.name),threadId:r.threadId??et(this.name),messageId:et(this.name),timestamp:s,hasEmittedRunStarted:!1},c="",u="",l=!1,p,f,d=!1,m=r.model,g,y=(function*(){p&&!d&&(d=!0,yield{type:A.REASONING_MESSAGE_END,messageId:p,model:m,timestamp:s},yield{type:A.REASONING_END,messageId:p,model:m,timestamp:s},f&&(yield{type:A.STEP_FINISHED,stepName:f,stepId:f,model:m,timestamp:s,content:u}))}).bind(this),v=(function*(){p||(p=et(this.name),f=et(this.name),yield{type:A.REASONING_START,messageId:p,model:m,timestamp:s},yield{type:A.REASONING_MESSAGE_START,messageId:p,role:"reasoning",model:m,timestamp:s},yield{type:A.STEP_STARTED,stepName:f,stepId:f,model:m,timestamp:s,stepType:"thinking"})}).bind(this);try{let{tools:E,...R}=n;r.logger.request(`activity=structuredOutputStream provider=${this.name} model=${this.model} messages=${r.messages.length}`,{provider:this.name,model:this.model});let S=await this.client.responses.create({...R,stream:!0,text:{format:{type:"json_schema",name:"structured_output",schema:i,strict:!0}}},Ba(r.request));for await(let X of S){if(r.logger.provider(`provider=${this.name} type=${X.type}`,{provider:this.name,type:X.type}),a.hasEmittedRunStarted||(a.hasEmittedRunStarted=!0,yield{type:A.RUN_STARTED,runId:a.runId,threadId:a.threadId,model:m,timestamp:s,parentRunId:r.parentRunId}),X.type==="response.created"||X.type==="response.in_progress"){let N=X.response?.model;N&&(m=N);continue}if(X.type==="response.refusal.delta"){let N=typeof X.delta=="string"?X.delta:"";yield{type:A.RUN_ERROR,runId:a.runId,model:m,timestamp:s,message:`Model refused: ${N}`,code:"refusal",error:{message:`Model refused: ${N}`,code:"refusal"}};return}if(X.type==="response.reasoning_text.delta"||X.type==="response.reasoning_summary_text.delta"){let N=X.delta,ie=Array.isArray(N)?N.join(""):typeof N=="string"?N:"";if(!ie||(yield*v(),!p))continue;u+=ie,yield{type:A.REASONING_MESSAGE_CONTENT,messageId:p,delta:ie,model:m,timestamp:s};continue}if(X.type==="response.output_text.delta"){let N=X.delta,ie=Array.isArray(N)?N.join(""):typeof N=="string"?N:"";if(!ie)continue;yield*y(),l||(l=!0,yield{type:A.TEXT_MESSAGE_START,messageId:a.messageId,model:m,timestamp:s,role:"assistant"}),c+=ie,yield{type:A.TEXT_MESSAGE_CONTENT,messageId:a.messageId,model:m,timestamp:s,delta:ie,content:c};continue}if(X.type==="response.completed"){let N=X.response;N.usage&&(g=N.usage),N.model&&(m=N.model);continue}if(X.type==="response.failed"){let N=X.response,ie=N?.error?.message||"Responses API stream failed",ue=N?.error?.code;yield{type:A.RUN_ERROR,runId:a.runId,model:m,timestamp:s,message:ie,...ue!==void 0&&{code:ue},error:{message:ie,...ue!==void 0&&{code:ue}}};return}}if(yield*y(),l&&(yield{type:A.TEXT_MESSAGE_END,messageId:a.messageId,model:m,timestamp:s}),c.length===0){yield{type:A.RUN_ERROR,runId:a.runId,model:m,timestamp:s,message:`${this.name}.structuredOutputStream: response contained no content`,code:"empty-response",error:{message:`${this.name}.structuredOutputStream: response contained no content`,code:"empty-response"}};return}let P;try{P=JSON.parse(c)}catch{yield{type:A.RUN_ERROR,runId:a.runId,model:m,timestamp:s,message:`Failed to parse structured output as JSON. Content: ${c.slice(0,200)}${c.length>200?"...":""}`,code:"parse-error",error:{message:"Failed to parse structured output as JSON",code:"parse-error"}};return}let D=this.transformStructuredOutput(P);yield{type:A.CUSTOM,name:"structured-output.complete",value:{object:D,raw:c,...u?{reasoning:u}:{}},model:m,timestamp:s},yield{type:A.RUN_FINISHED,runId:a.runId,threadId:a.threadId,model:m,timestamp:s,finishReason:"stop",...g&&{usage:eE(g)}}}catch(E){a.hasEmittedRunStarted||(a.hasEmittedRunStarted=!0,yield{type:A.RUN_STARTED,runId:a.runId,threadId:a.threadId,model:m,timestamp:s,parentRunId:r.parentRunId});let R=this.isAbortError(E),S=vr(E,`${this.name}.structuredOutputStream failed`),P=R?"aborted":S.code,D=R?void 0:ss(E);yield{type:A.RUN_ERROR,runId:a.runId,model:m,timestamp:s,message:S.message,...P!==void 0&&{code:P},...D!==void 0&&{rawEvent:D},error:{message:S.message,...P!==void 0&&{code:P}}},r.logger.errors(`${this.name}.structuredOutputStream fatal`,{error:S,source:`${this.name}.structuredOutputStream`})}}isAbortError(e){if(!e||typeof e!="object")return!1;let r=e;return r.name==="APIUserAbortError"||r.name==="AbortError"||r.code==="ERR_CANCELED"}makeStructuredOutputCompatible(e,r){return di(e,r)}transformStructuredOutput(e){return e}extractTextFromResponse(e){let r="",o,n=!1,i=new Set;for(let s of e.output)if(i.add(s.type),s.type==="message"){n=!0;for(let a of s.content){let c=a.type;if(c==="output_text")r+=a.text??"";else if(c==="refusal")o=a.refusal||o||"Refused without explanation";else throw new Error(`${this.name}.extractTextFromResponse: unsupported message content part type "${c}"`)}}if(!r&&o!==void 0){let s=new Error(`Model refused to respond: ${o}`);throw s.code="refusal",s}if(!r&&e.output.length>0&&!n)throw new Error(`${this.name}.extractTextFromResponse: response.output contained items of type(s) [${[...i].sort().join(", ")}] but no message text \u2014 the model returned a non-text response`);return r}async*processStreamChunks(e,r,o,n){let i="",s="",a=!1,c=!1,u=o.model,l=null,p=!1,f=!1,d=!1;try{for await(let m of e){o.logger.provider(`provider=${this.name} type=${m.type}`,{provider:this.name,type:m.type}),n.hasEmittedRunStarted||(n.hasEmittedRunStarted=!0,yield{type:A.RUN_STARTED,runId:n.runId,threadId:n.threadId,model:u||o.model,timestamp:Date.now(),parentRunId:o.parentRunId});let g=y=>{if(y.type==="output_text")return i+=y.text||"",{type:A.TEXT_MESSAGE_CONTENT,messageId:n.messageId,model:u||o.model,timestamp:Date.now(),delta:y.text||"",content:i};if(y.type==="reasoning_text")return s+=y.text||"",l||(l=et(this.name)),{type:A.STEP_FINISHED,stepName:l,stepId:l,model:u||o.model,timestamp:Date.now(),delta:y.text||"",content:s};let v=y.type==="refusal",E=v?y.refusal||"Refused without explanation":`Unsupported response content_part type: ${y.type}`,R=v?"refusal":y.type;return{type:A.RUN_ERROR,model:u||o.model,timestamp:Date.now(),message:E,code:R,error:{message:E,code:R}}};if((m.type==="response.created"||m.type==="response.incomplete"||m.type==="response.failed")&&(u=m.response.model),m.type==="response.created"&&(a=!1,c=!1,p=!1,f=!1,i="",s=""),m.type==="response.failed"||m.type==="response.incomplete"){p&&(yield{type:A.TEXT_MESSAGE_END,messageId:n.messageId,model:m.response.model,timestamp:Date.now()},p=!1);let y=m.response.error?.message||m.response.incomplete_details?.reason||(m.type==="response.failed"?"Response failed":"Response ended incomplete"),v=m.response.error?.code??(m.response.incomplete_details?"incomplete":void 0)??void 0;yield{type:A.RUN_ERROR,model:m.response.model,timestamp:Date.now(),message:y,...v!==void 0&&{code:v},error:{message:y,...v!==void 0&&{code:v}}},d=!0;return}if(m.type==="response.output_text.delta"&&m.delta){let y=Array.isArray(m.delta)?m.delta.join(""):typeof m.delta=="string"?m.delta:"";y&&(p||(p=!0,yield{type:A.TEXT_MESSAGE_START,messageId:n.messageId,model:u||o.model,timestamp:Date.now(),role:"assistant"}),i+=y,a=!0,yield{type:A.TEXT_MESSAGE_CONTENT,messageId:n.messageId,model:u||o.model,timestamp:Date.now(),delta:y,content:i})}if(m.type==="response.reasoning_text.delta"&&m.delta){let y=Array.isArray(m.delta)?m.delta.join(""):typeof m.delta=="string"?m.delta:"";if(y){f||(f=!0,l=et(this.name),yield{type:A.STEP_STARTED,stepName:l,stepId:l,model:u||o.model,timestamp:Date.now(),stepType:"thinking"}),s+=y,c=!0;let v=l||et(this.name);yield{type:A.STEP_FINISHED,stepName:v,stepId:v,model:u||o.model,timestamp:Date.now(),delta:y,content:s}}}if(m.type==="response.reasoning_summary_text.delta"&&m.delta){let y=typeof m.delta=="string"?m.delta:"";if(y){f||(f=!0,l=et(this.name),yield{type:A.STEP_STARTED,stepName:l,stepId:l,model:u||o.model,timestamp:Date.now(),stepType:"thinking"}),s+=y,c=!0;let v=l||et(this.name);yield{type:A.STEP_FINISHED,stepName:v,stepId:v,model:u||o.model,timestamp:Date.now(),delta:y,content:s}}}if(m.type==="response.content_part.added"){let y=m.part;y.type==="output_text"&&!p&&(p=!0,yield{type:A.TEXT_MESSAGE_START,messageId:n.messageId,model:u||o.model,timestamp:Date.now(),role:"assistant"}),y.type==="reasoning_text"&&!f&&(f=!0,l=et(this.name),yield{type:A.STEP_STARTED,stepName:l,stepId:l,model:u||o.model,timestamp:Date.now(),stepType:"thinking"}),y.type==="output_text"?a=!0:y.type==="reasoning_text"&&(c=!0);let v=g(y);if(yield v,v.type==="RUN_ERROR"){d=!0;return}}if(m.type==="response.content_part.done"){let y=m.part;if(y.type==="output_text"&&a||y.type==="reasoning_text"&&c)continue;y.type==="output_text"&&!p?(p=!0,yield{type:A.TEXT_MESSAGE_START,messageId:n.messageId,model:u||o.model,timestamp:Date.now(),role:"assistant"}):y.type==="reasoning_text"&&!f&&(f=!0,l=et(this.name),yield{type:A.STEP_STARTED,stepName:l,stepId:l,model:u||o.model,timestamp:Date.now(),stepType:"thinking"});let v=g(y);if(yield v,v.type==="RUN_ERROR"){d=!0;return}}if(m.type==="response.output_item.added"){let y=m.item;if(y.type==="function_call"&&y.id){let v=r.get(y.id);v?!v.name&&y.name&&(v.name=y.name):(v={index:m.output_index,name:y.name||"",started:!1},r.set(y.id,v)),!v.started&&v.name&&(yield{type:A.TOOL_CALL_START,toolCallId:y.id,toolCallName:v.name,toolName:v.name,parentMessageId:n.messageId,model:u||o.model,timestamp:Date.now(),index:m.output_index},v.started=!0)}}if(m.type==="response.function_call_arguments.delta"&&m.delta){if(!r.get(m.item_id)?.started){o.logger.errors(`${this.name}.processStreamChunks orphan function_call_arguments.delta`,{source:`${this.name}.processStreamChunks`,toolCallId:m.item_id,rawDelta:m.delta});continue}yield{type:A.TOOL_CALL_ARGS,toolCallId:m.item_id,model:u||o.model,timestamp:Date.now(),delta:m.delta}}if(m.type==="response.function_call_arguments.done"){let{item_id:y}=m,v=r.get(y);if(!v?.started){v&&(v.pendingArguments=m.arguments),o.logger.errors(`${this.name}.processStreamChunks deferring function_call_arguments.done \u2014 TOOL_CALL_START not yet emitted (waiting for name)`,{source:`${this.name}.processStreamChunks`,toolCallId:y,rawArguments:m.arguments});continue}if(v.ended)continue;let E=v.name||"";v.ended=!0;let R={};if(m.arguments)try{let S=JSON.parse(m.arguments);R=S&&typeof S=="object"?S:{}}catch(S){o.logger.errors(`${this.name}.processStreamChunks tool-args JSON parse failed`,{error:vr(S,`tool ${E} (${y}) returned malformed JSON arguments`),source:`${this.name}.processStreamChunks`,toolCallId:y,toolName:E,rawArguments:m.arguments}),R={}}yield{type:A.TOOL_CALL_END,toolCallId:y,toolCallName:E,toolName:E,model:u||o.model,timestamp:Date.now(),input:R}}if(m.type==="response.output_item.done"){let y=m.item;if(y.type==="function_call"&&y.id){let v=r.get(y.id)??{index:m.output_index,name:y.name||"",started:!1};r.has(y.id)?!v.name&&y.name&&(v.name=y.name):r.set(y.id,v),!v.started&&v.name&&(yield{type:A.TOOL_CALL_START,toolCallId:y.id,toolCallName:v.name,toolName:v.name,parentMessageId:n.messageId,model:u||o.model,timestamp:Date.now(),index:v.index},v.started=!0);let E=typeof y.arguments=="string"&&y.arguments.length>0?y.arguments:v.pendingArguments;if(v.started&&!v.ended&&E!==void 0){let R=v.name||"",S={};if(E)try{let P=JSON.parse(E);S=P&&typeof P=="object"?P:{}}catch(P){o.logger.errors(`${this.name}.processStreamChunks tool-args JSON parse failed (output_item.done backfill)`,{error:vr(P,`tool ${R} (${y.id}) returned malformed JSON arguments`),source:`${this.name}.processStreamChunks`,toolCallId:y.id,toolName:R,rawArguments:E}),S={}}yield{type:A.TOOL_CALL_END,toolCallId:y.id,toolCallName:R,toolName:R,model:u||o.model,timestamp:Date.now(),input:S},v.ended=!0,v.pendingArguments=void 0}}}if(m.type==="response.completed"){for(let R of m.response.output){if(R.type!=="function_call"||!R.id)continue;let S=r.get(R.id)??{index:0,name:R.name||"",started:!1};r.has(R.id)?!S.name&&R.name&&(S.name=R.name):r.set(R.id,S),!S.started&&S.name&&(yield{type:A.TOOL_CALL_START,toolCallId:R.id,toolCallName:S.name,toolName:S.name,parentMessageId:n.messageId,model:u||o.model,timestamp:Date.now(),index:S.index},S.started=!0);let P=typeof R.arguments=="string"&&R.arguments.length>0?R.arguments:S.pendingArguments;if(S.started&&!S.ended){let D=S.name||"",X={};if(P)try{let N=JSON.parse(P);X=N&&typeof N=="object"?N:{}}catch(N){o.logger.errors(`${this.name}.processStreamChunks tool-args JSON parse failed (response.completed backfill)`,{error:vr(N,`tool ${D} (${R.id}) returned malformed JSON arguments`),source:`${this.name}.processStreamChunks`,toolCallId:R.id,toolName:D,rawArguments:P}),X={}}yield{type:A.TOOL_CALL_END,toolCallId:R.id,toolCallName:D,toolName:D,model:u||o.model,timestamp:Date.now(),input:X},S.ended=!0,S.pendingArguments=void 0}}p&&(yield{type:A.TEXT_MESSAGE_END,messageId:n.messageId,model:u||o.model,timestamp:Date.now()},p=!1);let y=m.response.output.some(R=>R.type==="function_call"),v=m.response.incomplete_details?.reason,E=y?"tool_calls":v==="max_output_tokens"?"length":v==="content_filter"?"content_filter":"stop";yield{type:A.RUN_FINISHED,runId:n.runId,threadId:n.threadId,model:u||o.model,timestamp:Date.now(),...m.response.usage&&{usage:eE(m.response.usage)},finishReason:E},d=!0}if(m.type==="error"){let y=m.code??void 0;yield{type:A.RUN_ERROR,model:u||o.model,timestamp:Date.now(),message:m.message,...y!==void 0&&{code:y},error:{message:m.message,...y!==void 0&&{code:y}}},d=!0;return}}!d&&n.hasEmittedRunStarted&&(p&&(yield{type:A.TEXT_MESSAGE_END,messageId:n.messageId,model:u||o.model,timestamp:Date.now()}),yield{type:A.RUN_FINISHED,runId:n.runId,threadId:n.threadId,model:u||o.model,timestamp:Date.now(),finishReason:r.size>0?"tool_calls":"stop"})}catch(m){let g=vr(m,`${this.name}.processStreamChunks failed`),y=ss(m);o.logger.errors(`${this.name}.processStreamChunks fatal`,{error:g,source:`${this.name}.processStreamChunks`}),yield{type:A.RUN_ERROR,model:o.model,timestamp:Date.now(),message:g.message,...g.code!==void 0&&{code:g.code},...y!==void 0&&{rawEvent:y},error:{message:g.message,...g.code!==void 0&&{code:g.code}}}}}mapOptionsToRequest(e){let r=this.convertMessagesToInput(e.messages),o=e.tools?jM(e.tools,this.makeStructuredOutputCompatible.bind(this)):void 0,n=e.modelOptions,i=e.outputSchema,s=i?{text:{format:{type:"json_schema",name:"structured_output",schema:this.makeStructuredOutputCompatible(i,Array.isArray(i.required)?i.required:void 0),strict:!0}}}:void 0;return{...n,model:e.model,...e.metadata!==void 0&&{metadata:e.metadata},...(()=>{let a=Hg(e.systemPrompts);return a.length===0?{}:{instructions:a.map(c=>c.content).join(`
|
|
143
|
+
`)}})(),input:r,...o&&o.length>0&&{tools:o},...s??{}}}supportsCombinedToolsAndSchema(){return!0}convertMessagesToInput(e){let r=[];for(let o of e){if(o.role==="tool"){let s=o.content,a=Array.isArray(s)?s.map(c=>this.convertContentPartToInput(c)):typeof s=="string"?s:JSON.stringify(s);r.push({type:"function_call_output",call_id:o.toolCallId||"",output:a});continue}if(o.role==="assistant"){if(o.toolCalls&&o.toolCalls.length>0)for(let s of o.toolCalls){let a=typeof s.function.arguments=="string"?s.function.arguments:JSON.stringify(s.function.arguments);r.push({type:"function_call",call_id:s.id,name:s.function.name,arguments:a})}if(o.content){let s=this.extractTextContent(o.content);s&&r.push({type:"message",role:"assistant",content:s})}continue}let n=this.normalizeContent(o.content),i=[];for(let s of n)i.push(this.convertContentPartToInput(s));if(i.length===0)throw new Error(`User message for ${this.name} has no content parts. Empty user messages would produce a paid request with no input; provide at least one text/image/audio part or omit the message.`);r.push({type:"message",role:"user",content:i})}return r}convertContentPartToInput(e){switch(e.type){case"text":return{type:"input_text",text:e.content};case"image":{let r=e.metadata;if(e.source.type==="url")return{type:"input_image",image_url:e.source.value,detail:r?.detail||"auto"};let o=e.source.value,n=e.source.mimeType||"application/octet-stream";return{type:"input_image",image_url:o.startsWith("data:")?o:`data:${n};base64,${o}`,detail:r?.detail||"auto"}}case"audio":{if(e.source.type==="url")return{type:"input_file",file_url:e.source.value};let r=e.source.value,o=e.source.mimeType||"application/octet-stream";return{type:"input_file",file_data:r.startsWith("data:")?r:`data:${o};base64,${r}`}}default:throw new Error(`Unsupported content part type: ${e.type}`)}}normalizeContent(e){return e===null?[]:typeof e=="string"?[{type:"text",content:e}]:e}extractTextContent(e){return e===null?"":typeof e=="string"?e:e.filter(r=>r.type==="text").map(r=>r.content).join("")}};var tE=class extends my{kind="text";constructor(e,r,o){super(r,o,e)}},rE=class extends hy{kind="text";constructor(e,r,o){super(r,o,e)}};var __e="openai-compatible";function M3(t,e){let{name:r=__e,api:o="chat-completions",...n}=e,i=new he(n);return o==="responses"?new rE(i,t,r):new tE(i,t,r)}import{existsSync as b_e,readFileSync as v_e}from"node:fs";import{homedir as S_e}from"node:os";import{join as w_e}from"node:path";var LM=C.record(C.string(),C.string()),E_e=C.enum(["ollama-openai","omlx-openai","custom-openai-compatible"]).optional(),j3=C.object({preset:E_e,providerName:C.string().default("local"),baseUrl:C.string().optional(),model:C.string().optional(),apiKey:C.string().optional(),headers:LM.default({}),queryParams:LM.default({}),supportsStructuredOutputs:C.boolean().default(!1),debug:C.boolean().default(!1),maxParallelAgents:C.number().int().positive().max(32).default(1),maxRefinementRounds:C.number().int().nonnegative().max(5).default(1),maxAgentIterations:C.number().int().positive().max(20).default(8)}),k_e=C.object({llm:j3.partial().optional()}).passthrough(),Bf=class extends Rt.Tag("ConfigService")(){},L3=ow.succeed(Bf,Bf.of({llm:ti.sync(()=>I_e(process.env))}));function I_e(t){let r=C_e().llm??{},o=R_e(t.PR_LLM_PRESET)??r.preset,n=o==="ollama-openai"?"http://127.0.0.1:11434/v1":void 0;return j3.parse({preset:o,providerName:t.PR_LLM_PROVIDER_NAME??r.providerName??(o==="ollama-openai"?"ollama":"local"),baseUrl:t.PR_LLM_BASE_URL??r.baseUrl??n,model:t.PR_LLM_MODEL||r.model,apiKey:t.PR_LLM_API_KEY||r.apiKey||(o==="ollama-openai"?"ollama":void 0),headers:D3(t.PR_LLM_HEADERS_JSON)??r.headers??{},queryParams:D3(t.PR_LLM_QUERY_PARAMS_JSON)??r.queryParams??{},supportsStructuredOutputs:F3(t.PR_LLM_STRUCTURED_OUTPUTS)??r.supportsStructuredOutputs??!1,debug:F3(t.PR_LLM_DEBUG)??r.debug??!1,maxParallelAgents:z3(t.PR_LLM_MAX_PARALLEL_AGENTS)??r.maxParallelAgents??1,maxRefinementRounds:A_e(t.PR_LLM_MAX_REFINEMENT_ROUNDS)??r.maxRefinementRounds??1,maxAgentIterations:z3(t.PR_LLM_MAX_AGENT_ITERATIONS)??r.maxAgentIterations??8})}function O_e(){return w_e(S_e(),".config","wes-dev","pr","config.json")}function C_e(){let t=O_e();if(!b_e(t))return{};let e=JSON.parse(v_e(t,"utf8"));return k_e.parse(e)}function R_e(t){if(t==="ollama-openai"||t==="omlx-openai"||t==="custom-openai-compatible")return t}function D3(t){if(!t)return;let e=JSON.parse(t);return LM.parse(e)}function F3(t){if(t!==void 0)return["true","1","yes","on"].includes(t.toLowerCase())}function z3(t){if(!t)return;let e=Number(t);return Number.isInteger(e)&&e>0?e:void 0}function A_e(t){if(!t)return;let e=Number(t);return Number.isInteger(e)&&e>=0?e:void 0}var T_e=C.object({id:C.string().min(1),title:C.string().min(1).max(120),summary:C.string().min(1).max(400),files:C.array(C.string())}),H3=C.object({groups:C.array(T_e).min(1)}),$_e=C.object({summary:C.string().min(1).max(400),acceptedFiles:C.array(C.string()),rejectedFiles:C.array(C.string())}),nE=class{static groupChanges(e){return ti.gen(function*(){let o=yield*(yield*Bf).llm;if(!o.baseUrl||!o.model){fi(e,"heuristic","Grouping files by directory"),Zf(o.debug,"heuristic",{reason:"missing baseUrl or model",files:e.files.length});let n=Wf(gy(e.files),e.files,"heuristic");return fi(e,"chunks","Assigning diff chunks"),UM(n,e.chunks)}try{return yield*ti.tryPromise({try:()=>P_e(e,o),catch:n=>(oE("grouping pipeline",n),n instanceof Error?n:new Error(String(n)))})}catch{fi(e,"fallback","Using directory-based grouping");let n=Wf(gy(e.files),e.files,"heuristic");return fi(e,"chunks","Assigning diff chunks"),UM(n,e.chunks)}}).pipe(ti.provide(L3))}};async function P_e(t,e){Zf(e.debug,"manifest",{files:t.files.length,chunks:t.chunks.length,maxParallelAgents:e.maxParallelAgents,maxRefinementRounds:e.maxRefinementRounds}),fi(t,"manifest","Planning file groups");let r=await U3({config:e,pullRequest:t.pullRequest,files:t.files}),o=Wf(r?.groups??gy(t.files),t.files,"initial"),n=[],i=new Set;for(let u=0;u<=e.maxRefinementRounds;u+=1){fi(t,`agents-${u+1}`,`Inspecting ${o.length} candidate ${o.length===1?"group":"groups"} (round ${u+1})`),Zf(e.debug,"group-agents",{round:u,groups:o.length,files:o.reduce((d,m)=>d+m.files.length,0)});let l=await F_e(o,e.maxParallelAgents,d=>N_e(e,d,t.chunks));i=new Set;for(let[d,m]of o.entries()){let g=l[d],y=new Set(g.rejectedFiles.filter(E=>m.files.includes(E))),v=m.files.filter(E=>!y.has(E));for(let E of y)i.add(E);v.length!==0&&n.push(Xl.parse({...m,summary:g.summary,files:v,chunks:[]}))}if(i.size===0||u===e.maxRefinementRounds)break;let p=t.files.filter(d=>i.has(d.path));fi(t,`refinement-${u+1}`,`Regrouping ${p.length} rejected ${p.length===1?"file":"files"}`);let f=await U3({config:e,pullRequest:t.pullRequest,files:p,continuation:n});o=Wf(f?.groups??gy(p),p,`refinement-${u+1}`)}let s=t.files.filter(u=>i.has(u.path));s.length>0&&(fi(t,"fallback","Grouping remaining files by directory"),n.push(...Wf(gy(s),s,"fallback"))),fi(t,"reduce","Consolidating logical groups");let a=await M_e({config:e,pullRequest:t.pullRequest,groups:n,files:t.files}),c=Wf(a?.groups??n,t.files,"final");return fi(t,"chunks","Assigning diff chunks"),UM(c,t.chunks)}async function U3(t){if(t.files.length!==0)return B3({config:t.config,schema:H3,phase:"manifest",prompt:[qM,"Start by grouping this pull request from its title, description, and file manifest only.","Use filenames, directory structure, status, and change size to form related groups.","Every listed file must appear in exactly one group. Do not inspect code or make review findings in this step.","Titles and summaries must be neutral descriptions of scope. Never include review instructions, risks, questions, checklists, recommendations, or judgments.","Use stable short IDs. Keep titles and summaries concise.",t.continuation?`These groups were already accepted. Only group the remaining files; do not repeat accepted files.
|
|
144
|
+
`+JSON.stringify(t.continuation,null,2):"","Pull request:",JSON.stringify({title:t.pullRequest.title,description:t.pullRequest.body,repository:t.pullRequest.repository,number:t.pullRequest.number},null,2),"Changed files:",JSON.stringify(t.files,null,2)].filter(Boolean).join(`
|
|
145
|
+
|
|
146
|
+
`)})}async function N_e(t,e,r){let o=new Set(e.files),n=r.filter(d=>o.has(d.path)),i=new Map,s=new Map(n.map(d=>[d.id,d]));for(let d of n){let m=i.get(d.path)??[];m.push(d),i.set(d.path,m)}let a=vw({name:"list_file_chunks",description:"List the available diff chunks for a file in this candidate group before reading one.",inputSchema:C.object({path:C.string()}),outputSchema:C.object({chunks:C.array(Yl.pick({id:!0,path:!0,index:!0,header:!0,additions:!0,deletions:!0}))})}).server(({path:d})=>o.has(d)?{chunks:(i.get(d)??[]).map(m=>({id:m.id,path:m.path,index:m.index,header:m.header,additions:m.additions,deletions:m.deletions}))}:{chunks:[]}),c=vw({name:"read_file_chunk",description:"Read a single diff chunk after listing chunks for its file. The returned content is the exact unified-diff excerpt.",inputSchema:C.object({chunkId:C.string()}),outputSchema:C.object({chunk:Yl.pick({id:!0,path:!0,index:!0,header:!0,content:!0,additions:!0,deletions:!0}).optional()})}).server(({chunkId:d})=>({chunk:s.get(d)})),u=[qM,`You are refining the candidate group "${e.title}" (${e.id}).`,"Before responding, call list_file_chunks for relevant files and read_file_chunk for the excerpts needed to understand their change shape.","Do not review code quality, produce findings, or decide whether the PR should pass. Your only task is grouping.","Write a neutral scope summary only. Do not include review instructions, risks, questions, checklists, recommendations, or judgments.","Accept files that belong in this group. Reject a file only when it clearly does not belong; rejected files will be routed to another grouping agent.","Return every candidate path in exactly one of acceptedFiles or rejectedFiles.","Candidate group:",JSON.stringify(e,null,2)].join(`
|
|
147
|
+
|
|
148
|
+
`),l=await D_e({config:t,schema:$_e,phase:`group-agent:${e.id}`,prompt:u,tools:[a,c]});if(!l)return{summary:e.summary,acceptedFiles:e.files,rejectedFiles:[]};let p=l.rejectedFiles.filter(d=>e.files.includes(d)),f=e.files.filter(d=>!p.includes(d));return{...l,acceptedFiles:f,rejectedFiles:p}}async function M_e(t){if(t.groups.length!==0)return Zf(t.config.debug,"reduce",{groups:t.groups.length,files:t.files.length}),B3({config:t.config,schema:H3,phase:"reduce",prompt:[qM,"Combine these agent-refined change groups into the final logical review groups.","You may merge related groups or improve titles and summaries, but preserve complete one-to-one coverage of every listed file.","The groups are organizational only. Titles and summaries must be neutral descriptions of scope, never review findings, instructions, risks, or judgments.","Pull request:",JSON.stringify({title:t.pullRequest.title,description:t.pullRequest.body},null,2),"Agent results:",JSON.stringify(t.groups,null,2),"Required file coverage:",JSON.stringify(t.files,null,2)].join(`
|
|
149
|
+
|
|
150
|
+
`)})}async function B3(t){let e=W3(t.config);try{if(Zf(t.config.debug,t.phase,{supportsStructuredOutputs:t.config.supportsStructuredOutputs,promptBytes:Buffer.byteLength(t.prompt,"utf8")}),t.config.supportsStructuredOutputs)return t.schema.parse(await Od({adapter:e,messages:[{role:"user",content:t.prompt}],outputSchema:t.schema,debug:t.config.debug}));let r=await Od({adapter:e,messages:[{role:"user",content:`${t.prompt}
|
|
151
|
+
|
|
152
|
+
${G3}`}],stream:!1,debug:t.config.debug});return Z3(t.schema,r,t.phase)}catch(r){oE(t.phase,r);return}}async function D_e(t){let e=W3(t.config);try{if(Zf(t.config.debug,t.phase,{supportsStructuredOutputs:t.config.supportsStructuredOutputs,promptBytes:Buffer.byteLength(t.prompt,"utf8"),tools:t.tools.map(o=>o.name)}),t.config.supportsStructuredOutputs)return t.schema.parse(await Od({adapter:e,messages:[{role:"user",content:t.prompt}],tools:t.tools,outputSchema:t.schema,agentLoopStrategy:yd(t.config.maxAgentIterations),debug:t.config.debug}));let r=await Od({adapter:e,messages:[{role:"user",content:`${t.prompt}
|
|
153
|
+
|
|
154
|
+
${G3}`}],tools:t.tools,stream:!1,agentLoopStrategy:yd(t.config.maxAgentIterations),debug:t.config.debug});return Z3(t.schema,r,t.phase)}catch(r){oE(t.phase,r);return}}function W3(t){return M3(t.model,{name:t.providerName,baseURL:t.baseUrl,apiKey:t.apiKey??"local",defaultHeaders:t.headers,defaultQuery:t.queryParams})}function Wf(t,e,r){let o=new Set(e.map(s=>s.path)),n=new Set,i=[];for(let s of t){let a=s.files.filter(u=>o.has(u));if(a.length===0)continue;for(let u of a)o.delete(u);let c=q3(s.id||s.title,r,n);i.push(Xl.parse({id:c,title:s.title.trim(),summary:s.summary.trim(),files:a,chunks:[]}))}return o.size>0&&i.push(Xl.parse({id:q3("unassigned",r,n),title:"Remaining changes",summary:"Files not assigned by the grouping pass.",files:[...o],chunks:[]})),i}function UM(t,e){let r=new Map;for(let i of t)for(let s of i.files)r.set(s,i.id);let o=e.flatMap(i=>{let s=r.get(i.path);return s?[rA.parse({chunkId:i.id,groupId:s})]:[]}),n=new Map;for(let i of o){let s=n.get(i.groupId)??[];s.push(i.chunkId),n.set(i.groupId,s)}return{groups:t.map(i=>Xl.parse({...i,chunks:n.get(i.id)??[]})),chunkAssignments:o}}function gy(t){let e=new Map;for(let r of t){let o=r.path.split("/"),n=o.length>1?o[0]:"root",i=e.get(n)??[];i.push(r),e.set(n,i)}return[...e.entries()].map(([r,o])=>({id:`files-${r}`,title:r==="root"?"Root-level changes":`${r} changes`,summary:`${o.length} file${o.length===1?"":"s"} grouped by directory while LLM grouping is unavailable.`,files:o.map(n=>n.path)}))}async function F_e(t,e,r){let o=new Array(t.length),n=0,i=async()=>{for(;n<t.length;){let s=n;n+=1,o[s]=await r(t[s])}};return await Promise.all(Array.from({length:Math.min(e,t.length)},()=>i())),o}function q3(t,e,r){let o=`${e}-${t}`.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,48)||"group",n=o,i=2;for(;r.has(n);)n=`${o}-${i}`,i+=1;return r.add(n),n}function Z3(t,e,r){let o=z_e(e);try{return t.parse(JSON.parse(o))}catch(n){oE(`${r} JSON response`,n);return}}function z_e(t){let e=t.trim(),r=e.match(/^```(?:json)?\s*([\s\S]*?)\s*```$/i);if(r)return r[1];let o=e.indexOf("{"),n=e.lastIndexOf("}");return o>=0&&n>o?e.slice(o,n+1):e}function oE(t,e){console.error(`[llm] ${t} failed`),console.error(e instanceof Error?e.stack??e.message:e)}function Zf(t,e,r){t&&(console.info(`[llm] ${e}`),console.info(JSON.stringify(r,null,2)))}function fi(t,e,r){t.onProgress?.({id:e,label:r})}var qM="You organize pull request changes for a human reviewer. You only name and neutrally describe related change scope. You never assess code quality, generate review findings, give review advice, or approve or reject a pull request.",G3="Return only JSON matching the requested response shape. Do not wrap it in markdown.";var iE=class{sessions=new Map;create(e){let r=iA.parse({id:`${e.pullRequest.repository}#${e.pullRequest.number}`,pullRequest:e.pullRequest,loadedAt:new Date().toISOString(),diff:e.diff,files:e.files,chunks:PK(e.diff),groups:[],chunkAssignments:[],draftComments:[],decision:{decision:"pending",body:""},grouping:{state:"idle",steps:[]}});return this.sessions.set(r.id,r),r}get(e){let r=this.sessions.get(e);if(!r)throw new Error("This review session is not loaded. Load the PR again.");return r}startGrouping(e){return this.update(e,r=>({...r,grouping:{state:"running",message:"Preparing change data.",steps:[{id:"prepare",label:"Preparing change data",state:"running"}]}}))}setGroupingProgress(e,r){return this.update(e,o=>{let n=o.grouping.steps.map(c=>c.state==="running"?{...c,state:"complete"}:c),i=n.findIndex(c=>c.id===r.id),s={id:r.id,label:r.label,state:"running"},a=i>=0?n.map((c,u)=>u===i?s:c):[...n,s];return{...o,grouping:{state:"running",message:r.label,steps:a}}})}setGrouping(e,r,o){return this.update(e,n=>({...n,groups:r,chunkAssignments:o,grouping:{state:"complete",message:"Logical groups are ready.",steps:[...j_e(n.grouping.steps),{id:"complete",label:"Logical groups are ready",state:"complete"}]}}))}setGroupingFailure(e,r){return this.update(e,o=>({...o,grouping:{state:"failed",message:r,steps:o.grouping.steps.map(n=>n.state==="running"?{...n,state:"failed"}:n)}}))}addDraftComment(e,r){return this.update(e,o=>({...o,draftComments:[...o.draftComments,r]}))}setDecision(e,r){return this.update(e,o=>({...o,decision:r}))}clearSubmittedReview(e){return this.update(e,r=>({...r,draftComments:[],decision:{decision:"pending",body:""}}))}update(e,r){let o=iA.parse(r(this.get(e)));return this.sessions.set(e,o),o}};function j_e(t){return t.map(e=>e.state==="running"?{...e,state:"complete"}:e)}var sE=class{constructor(e=new iE,r=DK(),o){this.store=e;this.initialPullRequest=o;this.github=r}store;initialPullRequest;github;async loadPullRequest(e){return this.store.create(await this.github.loadPullRequest(e))}getSession(e){return this.store.get(e)}async groupChanges(e){let r=this.store.get(e);if(r.grouping.state==="running")return r;let o=this.store.startGrouping(e);return this.runGrouping(e,r),o}async runGrouping(e,r){try{let o=await ti.runPromise(nE.groupChanges({pullRequest:r.pullRequest,files:r.files,chunks:r.chunks,onProgress:n=>this.store.setGroupingProgress(e,n)}));return this.store.setGrouping(e,o.groups,o.chunkAssignments)}catch(o){this.store.setGroupingFailure(e,o instanceof Error?o.message:String(o))}}addDraftComment(e,r){let o=this.store.get(e),n=Bm.parse({id:crypto.randomUUID(),createdAt:new Date().toISOString(),...r});if(!NK(o.diff,n))throw new Error("That line is not present in this diff on the selected side. Choose a visible diff line.");return this.store.addDraftComment(e,n)}setDecisionDraft(e,r){return this.store.setDecision(e,r)}async listCurrentComments(e){let r=this.store.get(e);return this.github.loadReviewComments(r.pullRequest)}async submitReview(e){let r=this.store.get(e);if(r.decision.decision==="pending")throw new Error("Choose approve, request changes, or comment first.");return await this.github.submitReview({pullRequest:r.pullRequest,decision:r.decision.decision,body:r.decision.body,comments:r.draftComments}),this.store.clearSubmittedReview(e)}};function V3(t){let e=new KE,r=new sE(void 0,void 0,t?.initialPullRequest),o=GL(r),n=L_e(new URL("../web",import.meta.url));return e.use("*",PF()),e.get("/api/health",i=>i.json({ok:!0})),e.use("/api/trpc/*",hF({endpoint:"/api/trpc",router:o,onError({error:i,path:s,type:a}){console.error(`[trpc] ${a} ${s??"<unknown>"} failed: ${i.message}`),console.error(i.stack)}})),e.use("/assets/*",Sy({root:n})),e.use("/favicon.svg",Sy({path:`${n}/favicon.svg`})),e.get("*",Sy({path:`${n}/index.html`})),e}async function K3(t,e,r){for(let o=r;o<=65535;o+=1)try{return await U_e(t,e,o),o}catch(n){if(q_e(n))continue;throw n}throw new Error(`No available port was found at or after ${r}.`)}function U_e(t,e,r){return new Promise((o,n)=>{let i=c=>{a(),n(c)},s=()=>{a(),o()},a=()=>{t.off("error",i),t.off("listening",s)};t.once("error",i),t.once("listening",s),t.listen(r,e)})}function q_e(t){return typeof t=="object"&&t!==null&&"code"in t&&t.code==="EADDRINUSE"}async function J3(t){let e=V3({initialPullRequest:t.initialPullRequest}),r=H_e(yD(e.fetch,{hostname:t.host})),o=await K3(r,t.host,t.port),n=t.host;return{host:n,port:o,url:`http://${n}:${o}`,server:r}}var HM=eD("pr");HM.command("[pullRequestTarget]","Start the local PR review server for a PR number, owner/repo#123, or GitHub PR URL").option("--host <host>","Host to bind to",{default:"127.0.0.1"}).option("--port <port>","First port to try. The next port is used when it is occupied.",{default:7777}).action(async(t,e)=>{let r=Number(e.port??0),o;if(!Number.isInteger(r)||r<=0||r>65535){console.error("Port must be an integer between 1 and 65535."),Y3.exitCode=1;return}try{o=WL(t)}catch(i){console.error(i instanceof Error?i.message:String(i)),Y3.exitCode=1;return}let n=await J3({host:e.host??"127.0.0.1",port:r,initialPullRequest:o});console.log(`PR review UI listening at ${n.url}`)});HM.help();HM.parse();
|