@mcp-use/inspector 0.18.9 → 0.18.10-canary.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.js +44 -44
- package/dist/web/assets/{1c-CLxqeB8M.js → 1c-B83LxSQO.js} +1 -1
- package/dist/web/assets/{abnf-BAMyIhu2.js → abnf-8w57erom.js} +1 -1
- package/dist/web/assets/{accesslog-dkOhB9yb.js → accesslog-ByTrMalr.js} +1 -1
- package/dist/web/assets/{actionscript-Bot5jY3F.js → actionscript--QvR6DaS.js} +1 -1
- package/dist/web/assets/{ada-DVGp4Cxs.js → ada-DgBDDMfn.js} +1 -1
- package/dist/web/assets/{angelscript-BsRgEcej.js → angelscript-BnLr68HM.js} +1 -1
- package/dist/web/assets/{apache-Cxlm4eJ-.js → apache-p0TCNv-O.js} +1 -1
- package/dist/web/assets/{applescript-afhHpumr.js → applescript-CRndcIRv.js} +1 -1
- package/dist/web/assets/{arcade-CgvokW1Q.js → arcade-D8TKOzXL.js} +1 -1
- package/dist/web/assets/{arduino-KvCFSaJ-.js → arduino-C0EAzI7R.js} +1 -1
- package/dist/web/assets/{armasm-BYi4-bRr.js → armasm-ewkpejin.js} +1 -1
- package/dist/web/assets/{asciidoc-D2ztEPWn.js → asciidoc-XaOzaTLI.js} +1 -1
- package/dist/web/assets/{aspectj-C_gj8MiZ.js → aspectj-CzZ6xgQh.js} +1 -1
- package/dist/web/assets/{autohotkey-BmGMepGt.js → autohotkey-8Rq9tDWZ.js} +1 -1
- package/dist/web/assets/{autoit-BWpVeTVE.js → autoit-BnNRvEDC.js} +1 -1
- package/dist/web/assets/{avrasm-BwM6yLuy.js → avrasm-W9xzAM0t.js} +1 -1
- package/dist/web/assets/{awk-Bc5Iaq6L.js → awk-fRHiGJXQ.js} +1 -1
- package/dist/web/assets/{axapta-CQnSMcu0.js → axapta-CjhOT3Nr.js} +1 -1
- package/dist/web/assets/{bash-nAVRkVV_.js → bash-CchrdCug.js} +1 -1
- package/dist/web/assets/{basic-DNIDflJm.js → basic-D7yKdpDR.js} +1 -1
- package/dist/web/assets/{bnf-C2LviGRf.js → bnf-0lA08cuQ.js} +1 -1
- package/dist/web/assets/{brainfuck-BqmO4zf2.js → brainfuck-DwUxCyHn.js} +1 -1
- package/dist/web/assets/{browser-74oXgNn8.js → browser-DIBzRB0Q.js} +3 -3
- package/dist/web/assets/{c-C2g09a5e.js → c-BxBmNv2T.js} +1 -1
- package/dist/web/assets/{c-like-DeaIQfda.js → c-like-em5d23hy.js} +1 -1
- package/dist/web/assets/{cal-DO0Lf7RY.js → cal-CvZ4V8BY.js} +1 -1
- package/dist/web/assets/{capnproto-Bxpzspue.js → capnproto-Beh6YKM9.js} +1 -1
- package/dist/web/assets/{ceylon-CotwXTNz.js → ceylon-Bu9mzaF1.js} +1 -1
- package/dist/web/assets/{clean-CNXi1oRD.js → clean-CS4PDfX7.js} +1 -1
- package/dist/web/assets/{client-CPcfUEPp.js → client-JS9OVRkD.js} +1 -1
- package/dist/web/assets/{clojure-CQyiQ0Yj.js → clojure-Bmrz6BlU.js} +1 -1
- package/dist/web/assets/{clojure-repl-fUv2acS1.js → clojure-repl-C8ZBeyD6.js} +1 -1
- package/dist/web/assets/{cmake-Ceb5-r5F.js → cmake-DnTkmL8Q.js} +1 -1
- package/dist/web/assets/{coffeescript-HL3yisbA.js → coffeescript--EJDa-FY.js} +1 -1
- package/dist/web/assets/{coq-CFcSKZLh.js → coq-DN45_sXe.js} +1 -1
- package/dist/web/assets/{core-DAPq3hDX.js → core-Biilcv9F.js} +1 -1
- package/dist/web/assets/{cos-nWxDz_He.js → cos-DV-_OBE0.js} +1 -1
- package/dist/web/assets/{cpp-Bc10eb3F.js → cpp-Xsd6yNw5.js} +1 -1
- package/dist/web/assets/{crmsh-vuGmRMs-.js → crmsh-B-xvEveO.js} +1 -1
- package/dist/web/assets/{crystal-V-kfJNtk.js → crystal-DWat645B.js} +1 -1
- package/dist/web/assets/{csharp-DjihDoUf.js → csharp-CaJYLl0S.js} +1 -1
- package/dist/web/assets/{csp-C-Ng9jQm.js → csp-aJCRQ2Nh.js} +1 -1
- package/dist/web/assets/{css--1ozVs7q.js → css-CENf2vZz.js} +1 -1
- package/dist/web/assets/{d-DD3uOqjT.js → d-2HlGhTbg.js} +1 -1
- package/dist/web/assets/{dart-Xas4W4Jw.js → dart-2TLGEdJG.js} +1 -1
- package/dist/web/assets/{delphi-B-_apk9b.js → delphi-BkPiReND.js} +1 -1
- package/dist/web/assets/{diff-DnDu5meZ.js → diff-Ddb6Ymqs.js} +1 -1
- package/dist/web/assets/{display-A5IEINAP-BoThkrNQ.js → display-A5IEINAP-04HoCSOi.js} +2 -2
- package/dist/web/assets/{django-Cz0RxXup.js → django-o7Kv8P9m.js} +1 -1
- package/dist/web/assets/{dns-xv2Ry-ey.js → dns-BN1CKori.js} +1 -1
- package/dist/web/assets/{dockerfile-CiaDmX0W.js → dockerfile-ba6_XOh5.js} +1 -1
- package/dist/web/assets/{dos-CFhX0vBe.js → dos-B7dZkpv_.js} +1 -1
- package/dist/web/assets/{dsconfig-ef0iv2n2.js → dsconfig-Di5h2kID.js} +1 -1
- package/dist/web/assets/{dts-DHEwaYfS.js → dts-rb0VJxBA.js} +1 -1
- package/dist/web/assets/{dust-FFlFQfvR.js → dust-C3nzYxBo.js} +1 -1
- package/dist/web/assets/{ebnf-Ck7qYvZI.js → ebnf-CUygSzZG.js} +1 -1
- package/dist/web/assets/{elixir-CK-PyMnm.js → elixir-DAANNheg.js} +1 -1
- package/dist/web/assets/{elm-oypjHKOV.js → elm-BTpB9q3C.js} +1 -1
- package/dist/web/assets/{embeddings-BCCRUz2i.js → embeddings-ChPesEyI.js} +1 -1
- package/dist/web/assets/{erb-DpmTWK_8.js → erb-0Qu-n2nk.js} +1 -1
- package/dist/web/assets/{erlang-BAQb9REd.js → erlang-DSxP01Kb.js} +1 -1
- package/dist/web/assets/{erlang-repl-CUFEvA88.js → erlang-repl-CFpQWD0j.js} +1 -1
- package/dist/web/assets/{excel-B88YtyRZ.js → excel-DypsZuUF.js} +1 -1
- package/dist/web/assets/{fix-DItskGc3.js → fix-BdQTvl6Q.js} +1 -1
- package/dist/web/assets/{flix-C9cfreow.js → flix-D6jzCeoH.js} +1 -1
- package/dist/web/assets/{fortran-Ch_U4C_f.js → fortran-3kdnzQ9b.js} +1 -1
- package/dist/web/assets/{fsharp-BWfAwTE9.js → fsharp-B-EqKSOr.js} +1 -1
- package/dist/web/assets/{gams-Ce515NcI.js → gams-N_Jlqwr9.js} +1 -1
- package/dist/web/assets/{gauss-Bk2O9za3.js → gauss-B_FqkdkU.js} +1 -1
- package/dist/web/assets/{gcode-CWRqzaRU.js → gcode-reeTqzM2.js} +1 -1
- package/dist/web/assets/{gherkin-CspSy7IX.js → gherkin--JLrx3VP.js} +1 -1
- package/dist/web/assets/{glsl-DGKaoOaI.js → glsl-CZXLMjCw.js} +1 -1
- package/dist/web/assets/{gml-B5N2XYtZ.js → gml-CdiSt9PR.js} +1 -1
- package/dist/web/assets/{go-CWx21Iog.js → go-BLSPe_6k.js} +1 -1
- package/dist/web/assets/{golo-FJ2YWuU-.js → golo-m1e1TnDH.js} +1 -1
- package/dist/web/assets/{gradle-D4UO1l55.js → gradle-BsctdBFW.js} +1 -1
- package/dist/web/assets/{groovy-BodgULpW.js → groovy-BS_uf7Jm.js} +1 -1
- package/dist/web/assets/{haml-TBlufCNG.js → haml-CXyHabHp.js} +1 -1
- package/dist/web/assets/{handlebars-BVoEA5Nn.js → handlebars-LgazuZYo.js} +1 -1
- package/dist/web/assets/{haskell-CvKJOBr8.js → haskell-BiZNnfWr.js} +1 -1
- package/dist/web/assets/{haxe-DtINP5BW.js → haxe-CwmCdHs9.js} +1 -1
- package/dist/web/assets/{hsp-Bh9fsrRr.js → hsp-DcC8zb_C.js} +1 -1
- package/dist/web/assets/{htmlbars-DIFs1hxN.js → htmlbars-Cagmdaro.js} +1 -1
- package/dist/web/assets/{http-F4Hr2rtI.js → http-BMX1SvsK.js} +1 -1
- package/dist/web/assets/{hy-BCNhlo_g.js → hy-DhjFpTLp.js} +1 -1
- package/dist/web/assets/{index-C-lCB0fL.js → index-BCH07Pb8.js} +1 -1
- package/dist/web/assets/{index-POfTybe0.js → index-B_Fwww3j.js} +1 -1
- package/dist/web/assets/{index-BCx_hbJZ.js → index-C6gIm28e.js} +1 -1
- package/dist/web/assets/{index-BRnQqFNi.js → index-CHXFb24y.js} +1 -1
- package/dist/web/assets/{index-DgNcFyAg.js → index-CjXv6G8C.js} +1 -1
- package/dist/web/assets/{index-sPok37Sg.js → index-DNEaT--D.js} +1 -1
- package/dist/web/assets/{index-CD_ljDun.js → index-bnjI3CWS.js} +9 -9
- package/dist/web/assets/{index-DMa0lxRx.js → index-vwNTkMIE.js} +1 -1
- package/dist/web/assets/{inform7-qM1BL-Ib.js → inform7-KUbRIqKm.js} +1 -1
- package/dist/web/assets/{ini-DZSt8buZ.js → ini-cR9tzOwm.js} +1 -1
- package/dist/web/assets/{irpf90-R3QpiYae.js → irpf90-BQ5OfxRb.js} +1 -1
- package/dist/web/assets/{isbl-DFVyoUSU.js → isbl-DzosNI25.js} +1 -1
- package/dist/web/assets/{java-heOrtayf.js → java-DEw5-BlM.js} +1 -1
- package/dist/web/assets/{javascript-BzOHDxfe.js → javascript-DKfCHNRQ.js} +1 -1
- package/dist/web/assets/{jboss-cli-CQF9a1Yd.js → jboss-cli-1Mvjduwz.js} +1 -1
- package/dist/web/assets/{json-B-9Vpwh6.js → json-9xuxu-HV.js} +1 -1
- package/dist/web/assets/{julia-CIUBPkiv.js → julia-B10LOhEh.js} +1 -1
- package/dist/web/assets/{julia-repl--nkcdKR1.js → julia-repl-Jt6ZtLXu.js} +1 -1
- package/dist/web/assets/{kotlin-BzqUWFqo.js → kotlin-OX1vHmm-.js} +1 -1
- package/dist/web/assets/{lasso-CAaOdXVI.js → lasso-cOeudQxr.js} +1 -1
- package/dist/web/assets/{latex-DnnaWnA4.js → latex-C8PlpjPc.js} +1 -1
- package/dist/web/assets/{ldif-4iKQR8oF.js → ldif-Dp1K5nc4.js} +1 -1
- package/dist/web/assets/{leaf-Bh7ouR7v.js → leaf-DRghSVT4.js} +1 -1
- package/dist/web/assets/{less-Dcea-FTK.js → less-CyS7wqKs.js} +1 -1
- package/dist/web/assets/{lisp-DuIBsGp2.js → lisp-B2_Rb9t8.js} +1 -1
- package/dist/web/assets/{livecodeserver-DO1xknm9.js → livecodeserver-DoeJw4nO.js} +1 -1
- package/dist/web/assets/{livescript-CLfNYJHX.js → livescript-BqAhDw7T.js} +1 -1
- package/dist/web/assets/{llms-Cnj9KbyY.js → llms-CL9CXu-Z.js} +1 -1
- package/dist/web/assets/{llvm-D8iJBmsE.js → llvm-BQMK2XnP.js} +1 -1
- package/dist/web/assets/{lsl-BS3iaX9u.js → lsl-sxhtkLYi.js} +1 -1
- package/dist/web/assets/{lua-gwu2dgbU.js → lua-B59_WfXO.js} +1 -1
- package/dist/web/assets/{makefile-BZUlPomk.js → makefile-DbLpiMQ6.js} +1 -1
- package/dist/web/assets/{markdown-nKZtxmjM.js → markdown-MzDbsK0v.js} +1 -1
- package/dist/web/assets/{mathematica-xpyH_STR.js → mathematica-DJu372Zu.js} +1 -1
- package/dist/web/assets/{matlab-CMqP2M5T.js → matlab-WBm1x3WQ.js} +1 -1
- package/dist/web/assets/{maxima-CdWH3WRg.js → maxima-D7SRVu1v.js} +1 -1
- package/dist/web/assets/{mel-DHXpqVP-.js → mel-HQnNOHMq.js} +1 -1
- package/dist/web/assets/{mercury-Bvg_9Mf4.js → mercury-Csd1bdN7.js} +1 -1
- package/dist/web/assets/{mipsasm-_4q5VfWr.js → mipsasm-C8HyAjKS.js} +1 -1
- package/dist/web/assets/{mizar-C7gOtgay.js → mizar-deeF3z-s.js} +1 -1
- package/dist/web/assets/{mojolicious-CwTJkPTg.js → mojolicious-D09X4ya3.js} +1 -1
- package/dist/web/assets/{monkey-JFYOfchc.js → monkey-BUYWwDoy.js} +1 -1
- package/dist/web/assets/{moonscript-Bck0wuBW.js → moonscript-CWin87XU.js} +1 -1
- package/dist/web/assets/{n1ql-C2r4M7hW.js → n1ql-DAL1Gnw_.js} +1 -1
- package/dist/web/assets/{nginx-CWhS9bIu.js → nginx-BsUZ57m0.js} +1 -1
- package/dist/web/assets/{nim-DqtdiBSk.js → nim-D9Vrf-BR.js} +1 -1
- package/dist/web/assets/{nix-B-fcae6f.js → nix-yQWhT9GK.js} +1 -1
- package/dist/web/assets/{node-repl-DoVyr56j.js → node-repl-Cpa-6Tue.js} +1 -1
- package/dist/web/assets/{nsis-DNfzwEuN.js → nsis-kLES2FWX.js} +1 -1
- package/dist/web/assets/{objectivec-BQHla-z-.js → objectivec-X_JxwK-c.js} +1 -1
- package/dist/web/assets/{ocaml-Bg9xISlg.js → ocaml-CYJ0HLXh.js} +1 -1
- package/dist/web/assets/{openscad-B_n-GhfP.js → openscad-BHJfxPN5.js} +1 -1
- package/dist/web/assets/{oxygene-BkrmeLAT.js → oxygene-B77HcahI.js} +1 -1
- package/dist/web/assets/{parser3-CuOsisSB.js → parser3-B5GqCdV6.js} +1 -1
- package/dist/web/assets/{perl-CVzRsZzy.js → perl-DDIQnFFC.js} +1 -1
- package/dist/web/assets/{pf-B_Rh_zbR.js → pf-CbtYZVao.js} +1 -1
- package/dist/web/assets/{pgsql-bcMG5c2R.js → pgsql-ueFS0VhX.js} +1 -1
- package/dist/web/assets/{php-BHIjU0kY.js → php-Clyzpo5n.js} +1 -1
- package/dist/web/assets/{php-template-D5eAxN1t.js → php-template-DGNYIB1K.js} +1 -1
- package/dist/web/assets/{plaintext-C4Wg13Mh.js → plaintext-DKDHSTMh.js} +1 -1
- package/dist/web/assets/{pony-Qzr1s_B5.js → pony-Gzy8Ag68.js} +1 -1
- package/dist/web/assets/{powershell-DHDGLKFz.js → powershell-MO_OKuQl.js} +1 -1
- package/dist/web/assets/{processing-BAHzsHr-.js → processing-Bw_eNvNy.js} +1 -1
- package/dist/web/assets/{profile-CxvioeH3.js → profile-Q7Isv22x.js} +1 -1
- package/dist/web/assets/{prolog-Si-9ctqg.js → prolog-D2dWr6tu.js} +1 -1
- package/dist/web/assets/{properties-m_3dxXJx.js → properties-BS7VocI1.js} +1 -1
- package/dist/web/assets/{protobuf-k7OErUOA.js → protobuf-B0rlSoqt.js} +1 -1
- package/dist/web/assets/{puppet-BRuuf1x2.js → puppet-C84xwYKk.js} +1 -1
- package/dist/web/assets/{purebasic-rSAjKdif.js → purebasic-jARJevA9.js} +1 -1
- package/dist/web/assets/{python-Bw5QCI7k.js → python-BfmPTIz2.js} +1 -1
- package/dist/web/assets/{python-repl-DaBizoem.js → python-repl-hdX6_Ftt.js} +1 -1
- package/dist/web/assets/{q-YDb5SLZ7.js → q-CeZdsWwC.js} +1 -1
- package/dist/web/assets/{qml-aM6AdtYh.js → qml-Cct6Dn-A.js} +1 -1
- package/dist/web/assets/{r-C16rlfGl.js → r-Bmg7Vdhk.js} +1 -1
- package/dist/web/assets/{reasonml-Cd7T_yCH.js → reasonml-0j9GZec7.js} +1 -1
- package/dist/web/assets/{rib-l00VcShJ.js → rib-CnqBNtQX.js} +1 -1
- package/dist/web/assets/{roboconf-DIy5ekop.js → roboconf-DS-dOGyG.js} +1 -1
- package/dist/web/assets/{routeros-BOMOP8E7.js → routeros-DRZqKnqc.js} +1 -1
- package/dist/web/assets/{rsl-loyIMOxx.js → rsl-0Zg15wi7.js} +1 -1
- package/dist/web/assets/{ruby-BPqNxiDm.js → ruby-C4qGtbE5.js} +1 -1
- package/dist/web/assets/{ruleslanguage-Gms7AaoX.js → ruleslanguage-BEUa514i.js} +1 -1
- package/dist/web/assets/{rust-Bbpy-GLS.js → rust-CoTmKBVP.js} +1 -1
- package/dist/web/assets/{sas-607wKomz.js → sas-DsiPWi8s.js} +1 -1
- package/dist/web/assets/{scala-Ewfmw7-A.js → scala-Csf7eZAQ.js} +1 -1
- package/dist/web/assets/{scheme-yb6d3G4a.js → scheme-CMqPqPSV.js} +1 -1
- package/dist/web/assets/{scilab-Cdla8s7M.js → scilab-CU4t63v-.js} +1 -1
- package/dist/web/assets/{scss-DI-zv5m6.js → scss-DpfVHW_w.js} +1 -1
- package/dist/web/assets/{shell-ryQiOzsR.js → shell-VREatZaK.js} +1 -1
- package/dist/web/assets/{smali-Bnv3RUwR.js → smali-B8GXT2rG.js} +1 -1
- package/dist/web/assets/{smalltalk-pTGpOSbB.js → smalltalk-DMeZmYFN.js} +1 -1
- package/dist/web/assets/{sml-Cxox0kdt.js → sml-NvAs7Ux1.js} +1 -1
- package/dist/web/assets/{sqf-Ba0bNrlO.js → sqf-Dj6-51Rw.js} +1 -1
- package/dist/web/assets/{sql-B00-j6pL.js → sql-DM9zNLf7.js} +1 -1
- package/dist/web/assets/{sql_more-CHE7ctzP.js → sql_more-C-H0GG9R.js} +1 -1
- package/dist/web/assets/{stan-BlCcmUfs.js → stan-DNkt8s0C.js} +1 -1
- package/dist/web/assets/{stata-BjK4lK-D.js → stata-DABIpAIQ.js} +1 -1
- package/dist/web/assets/{step21-DYftAXUC.js → step21-CYbEx55e.js} +1 -1
- package/dist/web/assets/{stylus-I8UYxLbZ.js → stylus-DQVq4UzO.js} +1 -1
- package/dist/web/assets/{subunit-lGOKOQp3.js → subunit-D2KdHrQb.js} +1 -1
- package/dist/web/assets/{swift-CeSqgcDb.js → swift-I70JSqdo.js} +1 -1
- package/dist/web/assets/{taggerscript-9jZ0cfvH.js → taggerscript-DpyrNro7.js} +1 -1
- package/dist/web/assets/{tap-pSN2j3s1.js → tap-DGt9TjYH.js} +1 -1
- package/dist/web/assets/{tcl-eOZGQDaC.js → tcl-Du4fLIkX.js} +1 -1
- package/dist/web/assets/{thrift-Da42ouWZ.js → thrift-Dw6c3bc3.js} +1 -1
- package/dist/web/assets/{tp-HYYcgKhP.js → tp-BcRtTP6A.js} +1 -1
- package/dist/web/assets/{twig-DwNj1mST.js → twig-4K4vpYUY.js} +1 -1
- package/dist/web/assets/{typescript-Cv2GJylu.js → typescript-DqX6pLVM.js} +1 -1
- package/dist/web/assets/{vala-Cml0yxQg.js → vala-Becm0OIO.js} +1 -1
- package/dist/web/assets/{vbnet-B-X9SylV.js → vbnet-DC9oUQ_S.js} +1 -1
- package/dist/web/assets/{vbscript-2ohZ4WWq.js → vbscript-D5BJirKA.js} +1 -1
- package/dist/web/assets/{vbscript-html-DnUx8-7l.js → vbscript-html-Xszvj0MG.js} +1 -1
- package/dist/web/assets/{verilog-BTtm2Vt6.js → verilog-xir3KomE.js} +1 -1
- package/dist/web/assets/{vhdl-DTQ-WTKq.js → vhdl-BdCWgK-3.js} +1 -1
- package/dist/web/assets/{vim-Dv_aw2DH.js → vim-DtHzhUCR.js} +1 -1
- package/dist/web/assets/{x86asm-ClFCLi0H.js → x86asm-NJia3NpK.js} +1 -1
- package/dist/web/assets/{xl-Cq_3qzcZ.js → xl-IMnhWeYS.js} +1 -1
- package/dist/web/assets/{xml-gIr-nDim.js → xml-DyplkiDq.js} +1 -1
- package/dist/web/assets/{xquery-zQ6LM8st.js → xquery-DgFT_abu.js} +1 -1
- package/dist/web/assets/{yaml-DQqXL3xh.js → yaml-C_LW_qXV.js} +1 -1
- package/dist/web/assets/{zephir-t4L8sy-8.js → zephir-CmYwR2BK.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as rt,f as ut,g as yt,O as Ot,h as vt,J as It,R as L}from"./index-DgNcFyAg.js";import{b as lt,bO as _t,bP as Et,bQ as Tt,bR as wt,bS as St,bT as At,bU as Rt,y as ct,bV as xt,bW as bt,bX as b,x as kt,bY as dt,bZ as Nt}from"./index-CD_ljDun.js";import{E as Mt,c as Dt}from"./embeddings-BCCRUz2i.js";function v(t){if(typeof t=="object"&&t!==null){const e={...t};"additionalProperties"in e&&delete e.additionalProperties,"$schema"in e&&delete e.$schema,"strict"in e&&delete e.strict;for(const n in e)n in e&&(Array.isArray(e[n])?e[n]=e[n].map(v):typeof e[n]=="object"&&e[n]!==null&&(e[n]=v(e[n])));return e}return t}function N(t){const e=v(lt(t)?_t(t):t),{$schema:n,...s}=e;return s}function Gt(t){const e=v(t),{$schema:n,...s}=e;return s}function E(t,e,n=[]){if(t==null||typeof t!="object")return;const s=t;if(Array.isArray(s.enum)&&s.enum.some(i=>i==="")){const i=n.length?` at path "${n.join(".")}"`:"",o=e?` in tool "${e}"`:"";throw new Error(`Invalid enum: empty string not allowed${o}${i}. Gemini API rejects empty strings in enums.`)}if(s.type==="object"&&s.properties&&typeof s.properties=="object")for(const[i,o]of Object.entries(s.properties))E(o,e,[...n,i]);s.items&&E(s.items,e,[...n,"[]"]);for(const i of["anyOf","oneOf","allOf"]){const o=s[i];Array.isArray(o)&&o.forEach((r,u)=>E(r,e,[...n,`${i}[${u}]`]))}s.additionalProperties&&typeof s.additionalProperties=="object"&&E(s.additionalProperties,e,[...n,"additionalProperties"])}const h=[];for(let t=0;t<256;++t)h.push((t+256).toString(16).slice(1));function Ut(t,e=0){return(h[t[e+0]]+h[t[e+1]]+h[t[e+2]]+h[t[e+3]]+"-"+h[t[e+4]]+h[t[e+5]]+"-"+h[t[e+6]]+h[t[e+7]]+"-"+h[t[e+8]]+h[t[e+9]]+"-"+h[t[e+10]]+h[t[e+11]]+h[t[e+12]]+h[t[e+13]]+h[t[e+14]]+h[t[e+15]]).toLowerCase()}let k;const Lt=new Uint8Array(16);function Pt(){if(!k){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");k=crypto.getRandomValues.bind(crypto)}return k(Lt)}const jt=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),P={randomUUID:jt};function ft(t,e,n){if(P.randomUUID&&!t)return P.randomUUID();t=t||{};const s=t.random??t.rng?.()??Pt();if(s.length<16)throw new Error("Random bytes length must be >= 16");return s[6]=s[6]&15|64,s[8]=s[8]&63|128,Ut(s)}const D="__gemini_function_call_thought_signatures__",Kt="ErYCCrMCAdHtim9kOoOkrPiCNVsmlpMIKd7ZMxgiFbVQOkgp7nlLcDMzVsZwIzvuT7nQROivoXA72ccC2lSDvR0Gh7dkWaGuj7ctv6t7ZceHnecx0QYa+ix8tYpRfjhyWozQ49lWiws6+YGjCt10KRTyWsZ2h6O7iHTYJwKIRwGUHRKy/qK/6kFxJm5ML00gLq4D8s5Z6DBpp2ZlR+uF4G8jJgeWQgyHWVdx2wGYElaceVAc66tZdPQRdOHpWtgYSI1YdaXgVI8KHY3/EfNc2YqqMIulvkDBAnuMhkAjV9xmBa54Tq+ih3Im4+r3DzqhGqYdsSkhS0kZMwte4Hjs65dZzCw9lANxIqYi1DJ639WNPYihp/DCJCos7o+/EeSPJaio5sgWDyUnMGkY1atsJZ+m7pj7DD5tvQ==",Ft=t=>t();function $t(t){return At.isInstance(t)?t.role:t.type}function Ht(t){switch(t){case"supervisor":case"ai":case"model":return"model";case"system":return"system";case"human":return"user";case"tool":case"function":return"function";default:throw new Error(`Unknown / unsupported author: ${t}`)}}function Yt(t){if("mimeType"in t&&"data"in t)return{inlineData:{mimeType:t.mimeType,data:t.data}};if("mimeType"in t&&"fileUri"in t)return{fileData:{mimeType:t.mimeType,fileUri:t.fileUri}};throw new Error("Invalid media content")}function Bt(t,e){return e.map(n=>ct(n)?n.tool_calls??[]:[]).flat().find(n=>n.id===t.tool_call_id)?.name}function qt(t){return{providerName:"Google Gemini",fromStandardTextBlock(n){return{text:n.text}},fromStandardImageBlock(n){if(!t)throw new Error("This model does not support images");if(n.source_type==="url"){const s=b({dataUrl:n.url});return s?{inlineData:{mimeType:s.mime_type,data:s.data}}:{fileData:{mimeType:n.mime_type??"",fileUri:n.url}}}if(n.source_type==="base64")return{inlineData:{mimeType:n.mime_type??"",data:n.data}};throw new Error(`Unsupported source type: ${n.source_type}`)},fromStandardAudioBlock(n){if(!t)throw new Error("This model does not support audio");if(n.source_type==="url"){const s=b({dataUrl:n.url});return s?{inlineData:{mimeType:s.mime_type,data:s.data}}:{fileData:{mimeType:n.mime_type??"",fileUri:n.url}}}if(n.source_type==="base64")return{inlineData:{mimeType:n.mime_type??"",data:n.data}};throw new Error(`Unsupported source type: ${n.source_type}`)},fromStandardFileBlock(n){if(!t)throw new Error("This model does not support files");if(n.source_type==="text")return{text:n.text};if(n.source_type==="url"){const s=b({dataUrl:n.url});return s?{inlineData:{mimeType:s.mime_type,data:s.data}}:{fileData:{mimeType:n.mime_type??"",fileUri:n.url}}}if(n.source_type==="base64")return{inlineData:{mimeType:n.mime_type??"",data:n.data}};throw new Error(`Unsupported source type: ${n.source_type}`)}}}function j(t,e){if(xt(t))return bt(t,qt(e));if(t.type==="text")return{text:t.text};if(t.type==="executableCode")return{executableCode:t.executableCode};if(t.type==="codeExecutionResult")return{codeExecutionResult:t.codeExecutionResult};if(t.type==="image_url"){if(!e)throw new Error("This model does not support images");let n;if(typeof t.image_url=="string")n=t.image_url;else if(typeof t.image_url=="object"&&"url"in t.image_url)n=t.image_url.url;else throw new Error("Please provide image as base64 encoded data URL");const[s,i]=n.split(",");if(!s.startsWith("data:"))throw new Error("Please provide image as base64 encoded data URL");const[o,r]=s.replace(/^data:/,"").split(";");if(r!=="base64")throw new Error("Please provide image as base64 encoded data URL");return{inlineData:{data:i,mimeType:o}}}else{if(t.type==="media")return Yt(t);if(t.type==="tool_use")return{functionCall:{name:t.name,args:t.input}};if(t.type==="tool_call")return{functionCall:{name:t.name,args:t.args}};if(t.type?.includes("/")&&t.type.split("/").length===2&&"data"in t&&typeof t.data=="string")return{inlineData:{mimeType:t.type,data:t.data}};if("functionCall"in t)return;throw"type"in t?new Error(`Unknown content type ${t.type}`):new Error(`Unknown content ${JSON.stringify(t)}`)}}function Vt(t,e,n,s){if(Rt(t)){const u=t.name??Bt(t,n);if(u===void 0)throw new Error(`Google requires a tool name for each tool call response, and we could not infer a called tool name for ToolMessage "${t.id}" from your passed messages. Please populate a "name" field on that ToolMessage explicitly.`);const c=Array.isArray(t.content)?t.content.map(f=>j(f,e)).filter(f=>f!==void 0):t.content;return t.status==="error"?[{functionResponse:{name:u,response:{error:{details:c}}}}]:[{functionResponse:{name:u,response:{result:c}}}]}let i=[];const o=[];typeof t.content=="string"&&t.content&&o.push({text:t.content}),Array.isArray(t.content)&&o.push(...t.content.map(u=>j(u,e)).filter(u=>u!==void 0));const r=t.additional_kwargs?.[D];return ct(t)&&t.tool_calls?.length&&(i=t.tool_calls.map(u=>{const c=Ft(()=>{if(u.id){const f=r?.[u.id];if(f)return f}return s?.includes("gemini-3")?Kt:""});return{functionCall:{name:u.name,args:u.args},...c?{thoughtSignature:c}:{}}})),[...o,...i]}function K(t,e,n=!1,s){return t.reduce((i,o,r)=>{if(!Et(o))throw new Error("Unsupported message input");const u=$t(o);if(u==="system"&&r!==0)throw new Error("System message should be the first one");const c=Ht(u),f=i.content[i.content.length];if(!i.mergeWithPreviousContent&&f&&f.role===c)throw new Error("Google Generative AI requires alternate messages between authors");const g=Vt(o,e,t.slice(0,r),s);if(i.mergeWithPreviousContent){const d=i.content[i.content.length-1];if(!d)throw new Error("There was a problem parsing your system message. Please try a prompt without one.");return d.parts.push(...g),{mergeWithPreviousContent:!1,content:i.content}}let a=c;(a==="function"||a==="system"&&!n)&&(a="user");const l={role:a,parts:g};return{mergeWithPreviousContent:u==="system"&&!n,content:[...i.content,l]}},{content:[],mergeWithPreviousContent:!1}).content}function Wt(t,e){if(!t.candidates||t.candidates.length===0||!t.candidates[0])return{generations:[],llmOutput:{filters:t.promptFeedback}};const[n]=t.candidates,{content:s,...i}=n,o=s.parts?.reduce((a,l)=>("functionCall"in l&&l.functionCall&&a.push({...l,id:"id"in l.functionCall&&typeof l.functionCall.id=="string"?l.functionCall.id:ft()}),a),[]);let r;const u=s?.parts;Array.isArray(u)&&u.length===1&&"text"in u[0]&&u[0].text&&!u[0].thought?r=u[0].text:Array.isArray(u)&&u.length>0?r=u.map(a=>a.thought&&"text"in a&&a.text?{type:"thinking",thinking:a.text,...a.thoughtSignature?{signature:a.thoughtSignature}:{}}:"text"in a?{type:"text",text:a.text}:"inlineData"in a?{type:"inlineData",inlineData:a.inlineData}:"functionCall"in a?{type:"functionCall",functionCall:a.functionCall}:"functionResponse"in a?{type:"functionResponse",functionResponse:a.functionResponse}:"fileData"in a?{type:"fileData",fileData:a.fileData}:"executableCode"in a?{type:"executableCode",executableCode:a.executableCode}:"codeExecutionResult"in a?{type:"codeExecutionResult",codeExecutionResult:a.codeExecutionResult}:a):r=[];const c=o?.reduce((a,l)=>("thoughtSignature"in l&&typeof l.thoughtSignature=="string"&&(a[l.id]=l.thoughtSignature),a),{});let f="";return typeof r=="string"?f=r:Array.isArray(r)&&r.length>0&&(f=r.find(l=>"text"in l)?.text??f),{generations:[{text:f,message:new Tt({content:r??"",tool_calls:o?.map(a=>({type:"tool_call",id:a.id,name:a.functionCall.name,args:a.functionCall.args})),additional_kwargs:{...i,[D]:c},usage_metadata:e?.usageMetadata}),generationInfo:i}],llmOutput:{tokenUsage:{promptTokens:e?.usageMetadata?.input_tokens,completionTokens:e?.usageMetadata?.output_tokens,totalTokens:e?.usageMetadata?.total_tokens}}}}function Jt(t,e){if(!t.candidates||t.candidates.length===0)return null;const[n]=t.candidates,{content:s,...i}=n,o=s.parts?.reduce((a,l)=>("functionCall"in l&&l.functionCall&&a.push({...l,id:"id"in l.functionCall&&typeof l.functionCall.id=="string"?l.functionCall.id:ft()}),a),[]);let r;const u=s?.parts;Array.isArray(u)&&u.every(a=>"text"in a&&!a.thought)?r=u.map(a=>a.text).join(""):Array.isArray(u)?r=u.map(a=>a.thought&&"text"in a&&a.text?{type:"thinking",thinking:a.text,...a.thoughtSignature?{signature:a.thoughtSignature}:{}}:"text"in a?{type:"text",text:a.text}:"inlineData"in a?{type:"inlineData",inlineData:a.inlineData}:"functionCall"in a?{type:"functionCall",functionCall:a.functionCall}:"functionResponse"in a?{type:"functionResponse",functionResponse:a.functionResponse}:"fileData"in a?{type:"fileData",fileData:a.fileData}:"executableCode"in a?{type:"executableCode",executableCode:a.executableCode}:"codeExecutionResult"in a?{type:"codeExecutionResult",codeExecutionResult:a.codeExecutionResult}:a):r=[];let c="";r&&typeof r=="string"?c=r:Array.isArray(r)&&(c=r.find(l=>"text"in l)?.text??"");const f=[];o&&f.push(...o.map(a=>({type:"tool_call_chunk",id:a.id,name:a.functionCall.name,args:JSON.stringify(a.functionCall.args)})));const g=o?.reduce((a,l)=>("thoughtSignature"in l&&typeof l.thoughtSignature=="string"&&(a[l.id]=l.thoughtSignature),a),{});return new wt({text:c,message:new St({content:r||"",name:s?s.role:void 0,tool_call_chunks:f,additional_kwargs:{[D]:g},response_metadata:{model_provider:"google-genai"},usage_metadata:e.usageMetadata}),generationInfo:i})}function zt(t){return t.every(e=>"functionDeclarations"in e&&Array.isArray(e.functionDeclarations))?t:[{functionDeclarations:t.map(e=>{if(rt(e)){const n=N(e.schema);return n.type==="object"&&"properties"in n&&Object.keys(n.properties).length===0?{name:e.name,description:e.description}:(E(n,e.name),{name:e.name,description:e.description,parameters:n})}if(ut(e)){const n=Gt(e.function.parameters);return E(n,e.function.name),{name:e.function.name,description:e.function.description??"A function available to call.",parameters:n}}return e})}]}function F(t,e){const n={input_tokens:t?.promptTokenCount??0,output_tokens:t?.candidatesTokenCount??0,total_tokens:t?.totalTokenCount??0};if(t?.cachedContentTokenCount&&(n.input_token_details??={},n.input_token_details.cache_read=t.cachedContentTokenCount),e==="gemini-3-pro-preview"){const s=Math.max(0,t?.promptTokenCount??-2e5),i=Math.max(0,t?.cachedContentTokenCount??-2e5);s&&(n.input_token_details={...n.input_token_details,over_200k:s}),i&&(n.input_token_details={...n.input_token_details,cache_read_over_200k:i})}return n}var $=class extends yt{static lc_name(){return"GoogleGenerativeAIToolsOutputParser"}lc_namespace=["langchain","google_genai","output_parsers"];returnId=!1;keyName;returnSingle=!1;zodSchema;constructor(t){super(t),this.keyName=t.keyName,this.returnSingle=t.returnSingle??this.returnSingle,this.zodSchema=t.zodSchema}async _validateResult(t){if(this.zodSchema===void 0)return t;const e=await kt(this.zodSchema,t);if(e.success)return e.data;throw new Ot(`Failed to parse. Text: "${JSON.stringify(t,null,2)}". Error: ${JSON.stringify(e.error.issues)}`,JSON.stringify(t,null,2))}async parseResult(t){const e=t.flatMap(i=>{const{message:o}=i;return!("tool_calls"in o)||!Array.isArray(o.tool_calls)?[]:o.tool_calls});if(e[0]===void 0)throw new Error("No parseable tool calls provided to GoogleGenerativeAIToolsOutputParser.");const[n]=e;return await this._validateResult(n.args)}},H;(function(t){t.STRING="string",t.NUMBER="number",t.INTEGER="integer",t.BOOLEAN="boolean",t.ARRAY="array",t.OBJECT="object"})(H||(H={}));var Y;(function(t){t.LANGUAGE_UNSPECIFIED="language_unspecified",t.PYTHON="python"})(Y||(Y={}));var B;(function(t){t.OUTCOME_UNSPECIFIED="outcome_unspecified",t.OUTCOME_OK="outcome_ok",t.OUTCOME_FAILED="outcome_failed",t.OUTCOME_DEADLINE_EXCEEDED="outcome_deadline_exceeded"})(B||(B={}));const q=["user","model","function","system"];var V;(function(t){t.HARM_CATEGORY_UNSPECIFIED="HARM_CATEGORY_UNSPECIFIED",t.HARM_CATEGORY_HATE_SPEECH="HARM_CATEGORY_HATE_SPEECH",t.HARM_CATEGORY_SEXUALLY_EXPLICIT="HARM_CATEGORY_SEXUALLY_EXPLICIT",t.HARM_CATEGORY_HARASSMENT="HARM_CATEGORY_HARASSMENT",t.HARM_CATEGORY_DANGEROUS_CONTENT="HARM_CATEGORY_DANGEROUS_CONTENT",t.HARM_CATEGORY_CIVIC_INTEGRITY="HARM_CATEGORY_CIVIC_INTEGRITY"})(V||(V={}));var W;(function(t){t.HARM_BLOCK_THRESHOLD_UNSPECIFIED="HARM_BLOCK_THRESHOLD_UNSPECIFIED",t.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",t.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",t.BLOCK_ONLY_HIGH="BLOCK_ONLY_HIGH",t.BLOCK_NONE="BLOCK_NONE"})(W||(W={}));var J;(function(t){t.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",t.NEGLIGIBLE="NEGLIGIBLE",t.LOW="LOW",t.MEDIUM="MEDIUM",t.HIGH="HIGH"})(J||(J={}));var z;(function(t){t.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",t.SAFETY="SAFETY",t.OTHER="OTHER"})(z||(z={}));var w;(function(t){t.FINISH_REASON_UNSPECIFIED="FINISH_REASON_UNSPECIFIED",t.STOP="STOP",t.MAX_TOKENS="MAX_TOKENS",t.SAFETY="SAFETY",t.RECITATION="RECITATION",t.LANGUAGE="LANGUAGE",t.BLOCKLIST="BLOCKLIST",t.PROHIBITED_CONTENT="PROHIBITED_CONTENT",t.SPII="SPII",t.MALFORMED_FUNCTION_CALL="MALFORMED_FUNCTION_CALL",t.OTHER="OTHER"})(w||(w={}));var Q;(function(t){t.TASK_TYPE_UNSPECIFIED="TASK_TYPE_UNSPECIFIED",t.RETRIEVAL_QUERY="RETRIEVAL_QUERY",t.RETRIEVAL_DOCUMENT="RETRIEVAL_DOCUMENT",t.SEMANTIC_SIMILARITY="SEMANTIC_SIMILARITY",t.CLASSIFICATION="CLASSIFICATION",t.CLUSTERING="CLUSTERING"})(Q||(Q={}));var T;(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.AUTO="AUTO",t.ANY="ANY",t.NONE="NONE"})(T||(T={}));var Z;(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.MODE_DYNAMIC="MODE_DYNAMIC"})(Z||(Z={}));class m extends Error{constructor(e){super(`[GoogleGenerativeAI Error]: ${e}`)}}class _ extends m{constructor(e,n){super(e),this.response=n}}class pt extends m{constructor(e,n,s,i){super(e),this.status=n,this.statusText=s,this.errorDetails=i}}class O extends m{}class gt extends m{}const Qt="https://generativelanguage.googleapis.com",Zt="v1beta",Xt="0.24.1",te="genai-js";var I;(function(t){t.GENERATE_CONTENT="generateContent",t.STREAM_GENERATE_CONTENT="streamGenerateContent",t.COUNT_TOKENS="countTokens",t.EMBED_CONTENT="embedContent",t.BATCH_EMBED_CONTENTS="batchEmbedContents"})(I||(I={}));class ee{constructor(e,n,s,i,o){this.model=e,this.task=n,this.apiKey=s,this.stream=i,this.requestOptions=o}toString(){var e,n;const s=((e=this.requestOptions)===null||e===void 0?void 0:e.apiVersion)||Zt;let o=`${((n=this.requestOptions)===null||n===void 0?void 0:n.baseUrl)||Qt}/${s}/${this.model}:${this.task}`;return this.stream&&(o+="?alt=sse"),o}}function ne(t){const e=[];return t?.apiClient&&e.push(t.apiClient),e.push(`${te}/${Xt}`),e.join(" ")}async function se(t){var e;const n=new Headers;n.append("Content-Type","application/json"),n.append("x-goog-api-client",ne(t.requestOptions)),n.append("x-goog-api-key",t.apiKey);let s=(e=t.requestOptions)===null||e===void 0?void 0:e.customHeaders;if(s){if(!(s instanceof Headers))try{s=new Headers(s)}catch(i){throw new O(`unable to convert customHeaders value ${JSON.stringify(s)} to Headers: ${i.message}`)}for(const[i,o]of s.entries()){if(i==="x-goog-api-key")throw new O(`Cannot set reserved header name ${i}`);if(i==="x-goog-api-client")throw new O(`Header name ${i} can only be set using the apiClient field`);n.append(i,o)}}return n}async function ie(t,e,n,s,i,o){const r=new ee(t,e,n,s,o);return{url:r.toString(),fetchOptions:Object.assign(Object.assign({},ue(o)),{method:"POST",headers:await se(r),body:i})}}async function R(t,e,n,s,i,o={},r=fetch){const{url:u,fetchOptions:c}=await ie(t,e,n,s,i,o);return oe(u,c,r)}async function oe(t,e,n=fetch){let s;try{s=await n(t,e)}catch(i){ae(i,t)}return s.ok||await re(s,t),s}function ae(t,e){let n=t;throw n.name==="AbortError"?(n=new gt(`Request aborted when fetching ${e.toString()}: ${t.message}`),n.stack=t.stack):t instanceof pt||t instanceof O||(n=new m(`Error fetching from ${e.toString()}: ${t.message}`),n.stack=t.stack),n}async function re(t,e){let n="",s;try{const i=await t.json();n=i.error.message,i.error.details&&(n+=` ${JSON.stringify(i.error.details)}`,s=i.error.details)}catch{}throw new pt(`Error fetching from ${e.toString()}: [${t.status} ${t.statusText}] ${n}`,t.status,t.statusText,s)}function ue(t){const e={};if(t?.signal!==void 0||t?.timeout>=0){const n=new AbortController;t?.timeout>=0&&setTimeout(()=>n.abort(),t.timeout),t?.signal&&t.signal.addEventListener("abort",()=>{n.abort()}),e.signal=n.signal}return e}function G(t){return t.text=()=>{if(t.candidates&&t.candidates.length>0){if(t.candidates.length>1&&console.warn(`This response had ${t.candidates.length} candidates. Returning text from the first candidate only. Access response.candidates directly to use the other candidates.`),x(t.candidates[0]))throw new _(`${y(t)}`,t);return le(t)}else if(t.promptFeedback)throw new _(`Text not available. ${y(t)}`,t);return""},t.functionCall=()=>{if(t.candidates&&t.candidates.length>0){if(t.candidates.length>1&&console.warn(`This response had ${t.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`),x(t.candidates[0]))throw new _(`${y(t)}`,t);return console.warn("response.functionCall() is deprecated. Use response.functionCalls() instead."),X(t)[0]}else if(t.promptFeedback)throw new _(`Function call not available. ${y(t)}`,t)},t.functionCalls=()=>{if(t.candidates&&t.candidates.length>0){if(t.candidates.length>1&&console.warn(`This response had ${t.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`),x(t.candidates[0]))throw new _(`${y(t)}`,t);return X(t)}else if(t.promptFeedback)throw new _(`Function call not available. ${y(t)}`,t)},t}function le(t){var e,n,s,i;const o=[];if(!((n=(e=t.candidates)===null||e===void 0?void 0:e[0].content)===null||n===void 0)&&n.parts)for(const r of(i=(s=t.candidates)===null||s===void 0?void 0:s[0].content)===null||i===void 0?void 0:i.parts)r.text&&o.push(r.text),r.executableCode&&o.push("\n```"+r.executableCode.language+`
|
|
1
|
+
import{c as rt,f as ut,g as yt,O as Ot,h as vt,J as It,R as L}from"./index-CjXv6G8C.js";import{b as lt,bO as _t,bP as Et,bQ as Tt,bR as wt,bS as St,bT as At,bU as Rt,y as ct,bV as xt,bW as bt,bX as b,x as kt,bY as dt,bZ as Nt}from"./index-bnjI3CWS.js";import{E as Mt,c as Dt}from"./embeddings-ChPesEyI.js";function v(t){if(typeof t=="object"&&t!==null){const e={...t};"additionalProperties"in e&&delete e.additionalProperties,"$schema"in e&&delete e.$schema,"strict"in e&&delete e.strict;for(const n in e)n in e&&(Array.isArray(e[n])?e[n]=e[n].map(v):typeof e[n]=="object"&&e[n]!==null&&(e[n]=v(e[n])));return e}return t}function N(t){const e=v(lt(t)?_t(t):t),{$schema:n,...s}=e;return s}function Gt(t){const e=v(t),{$schema:n,...s}=e;return s}function E(t,e,n=[]){if(t==null||typeof t!="object")return;const s=t;if(Array.isArray(s.enum)&&s.enum.some(i=>i==="")){const i=n.length?` at path "${n.join(".")}"`:"",o=e?` in tool "${e}"`:"";throw new Error(`Invalid enum: empty string not allowed${o}${i}. Gemini API rejects empty strings in enums.`)}if(s.type==="object"&&s.properties&&typeof s.properties=="object")for(const[i,o]of Object.entries(s.properties))E(o,e,[...n,i]);s.items&&E(s.items,e,[...n,"[]"]);for(const i of["anyOf","oneOf","allOf"]){const o=s[i];Array.isArray(o)&&o.forEach((r,u)=>E(r,e,[...n,`${i}[${u}]`]))}s.additionalProperties&&typeof s.additionalProperties=="object"&&E(s.additionalProperties,e,[...n,"additionalProperties"])}const h=[];for(let t=0;t<256;++t)h.push((t+256).toString(16).slice(1));function Ut(t,e=0){return(h[t[e+0]]+h[t[e+1]]+h[t[e+2]]+h[t[e+3]]+"-"+h[t[e+4]]+h[t[e+5]]+"-"+h[t[e+6]]+h[t[e+7]]+"-"+h[t[e+8]]+h[t[e+9]]+"-"+h[t[e+10]]+h[t[e+11]]+h[t[e+12]]+h[t[e+13]]+h[t[e+14]]+h[t[e+15]]).toLowerCase()}let k;const Lt=new Uint8Array(16);function Pt(){if(!k){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");k=crypto.getRandomValues.bind(crypto)}return k(Lt)}const jt=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),P={randomUUID:jt};function ft(t,e,n){if(P.randomUUID&&!t)return P.randomUUID();t=t||{};const s=t.random??t.rng?.()??Pt();if(s.length<16)throw new Error("Random bytes length must be >= 16");return s[6]=s[6]&15|64,s[8]=s[8]&63|128,Ut(s)}const D="__gemini_function_call_thought_signatures__",Kt="ErYCCrMCAdHtim9kOoOkrPiCNVsmlpMIKd7ZMxgiFbVQOkgp7nlLcDMzVsZwIzvuT7nQROivoXA72ccC2lSDvR0Gh7dkWaGuj7ctv6t7ZceHnecx0QYa+ix8tYpRfjhyWozQ49lWiws6+YGjCt10KRTyWsZ2h6O7iHTYJwKIRwGUHRKy/qK/6kFxJm5ML00gLq4D8s5Z6DBpp2ZlR+uF4G8jJgeWQgyHWVdx2wGYElaceVAc66tZdPQRdOHpWtgYSI1YdaXgVI8KHY3/EfNc2YqqMIulvkDBAnuMhkAjV9xmBa54Tq+ih3Im4+r3DzqhGqYdsSkhS0kZMwte4Hjs65dZzCw9lANxIqYi1DJ639WNPYihp/DCJCos7o+/EeSPJaio5sgWDyUnMGkY1atsJZ+m7pj7DD5tvQ==",Ft=t=>t();function $t(t){return At.isInstance(t)?t.role:t.type}function Ht(t){switch(t){case"supervisor":case"ai":case"model":return"model";case"system":return"system";case"human":return"user";case"tool":case"function":return"function";default:throw new Error(`Unknown / unsupported author: ${t}`)}}function Yt(t){if("mimeType"in t&&"data"in t)return{inlineData:{mimeType:t.mimeType,data:t.data}};if("mimeType"in t&&"fileUri"in t)return{fileData:{mimeType:t.mimeType,fileUri:t.fileUri}};throw new Error("Invalid media content")}function Bt(t,e){return e.map(n=>ct(n)?n.tool_calls??[]:[]).flat().find(n=>n.id===t.tool_call_id)?.name}function qt(t){return{providerName:"Google Gemini",fromStandardTextBlock(n){return{text:n.text}},fromStandardImageBlock(n){if(!t)throw new Error("This model does not support images");if(n.source_type==="url"){const s=b({dataUrl:n.url});return s?{inlineData:{mimeType:s.mime_type,data:s.data}}:{fileData:{mimeType:n.mime_type??"",fileUri:n.url}}}if(n.source_type==="base64")return{inlineData:{mimeType:n.mime_type??"",data:n.data}};throw new Error(`Unsupported source type: ${n.source_type}`)},fromStandardAudioBlock(n){if(!t)throw new Error("This model does not support audio");if(n.source_type==="url"){const s=b({dataUrl:n.url});return s?{inlineData:{mimeType:s.mime_type,data:s.data}}:{fileData:{mimeType:n.mime_type??"",fileUri:n.url}}}if(n.source_type==="base64")return{inlineData:{mimeType:n.mime_type??"",data:n.data}};throw new Error(`Unsupported source type: ${n.source_type}`)},fromStandardFileBlock(n){if(!t)throw new Error("This model does not support files");if(n.source_type==="text")return{text:n.text};if(n.source_type==="url"){const s=b({dataUrl:n.url});return s?{inlineData:{mimeType:s.mime_type,data:s.data}}:{fileData:{mimeType:n.mime_type??"",fileUri:n.url}}}if(n.source_type==="base64")return{inlineData:{mimeType:n.mime_type??"",data:n.data}};throw new Error(`Unsupported source type: ${n.source_type}`)}}}function j(t,e){if(xt(t))return bt(t,qt(e));if(t.type==="text")return{text:t.text};if(t.type==="executableCode")return{executableCode:t.executableCode};if(t.type==="codeExecutionResult")return{codeExecutionResult:t.codeExecutionResult};if(t.type==="image_url"){if(!e)throw new Error("This model does not support images");let n;if(typeof t.image_url=="string")n=t.image_url;else if(typeof t.image_url=="object"&&"url"in t.image_url)n=t.image_url.url;else throw new Error("Please provide image as base64 encoded data URL");const[s,i]=n.split(",");if(!s.startsWith("data:"))throw new Error("Please provide image as base64 encoded data URL");const[o,r]=s.replace(/^data:/,"").split(";");if(r!=="base64")throw new Error("Please provide image as base64 encoded data URL");return{inlineData:{data:i,mimeType:o}}}else{if(t.type==="media")return Yt(t);if(t.type==="tool_use")return{functionCall:{name:t.name,args:t.input}};if(t.type==="tool_call")return{functionCall:{name:t.name,args:t.args}};if(t.type?.includes("/")&&t.type.split("/").length===2&&"data"in t&&typeof t.data=="string")return{inlineData:{mimeType:t.type,data:t.data}};if("functionCall"in t)return;throw"type"in t?new Error(`Unknown content type ${t.type}`):new Error(`Unknown content ${JSON.stringify(t)}`)}}function Vt(t,e,n,s){if(Rt(t)){const u=t.name??Bt(t,n);if(u===void 0)throw new Error(`Google requires a tool name for each tool call response, and we could not infer a called tool name for ToolMessage "${t.id}" from your passed messages. Please populate a "name" field on that ToolMessage explicitly.`);const c=Array.isArray(t.content)?t.content.map(f=>j(f,e)).filter(f=>f!==void 0):t.content;return t.status==="error"?[{functionResponse:{name:u,response:{error:{details:c}}}}]:[{functionResponse:{name:u,response:{result:c}}}]}let i=[];const o=[];typeof t.content=="string"&&t.content&&o.push({text:t.content}),Array.isArray(t.content)&&o.push(...t.content.map(u=>j(u,e)).filter(u=>u!==void 0));const r=t.additional_kwargs?.[D];return ct(t)&&t.tool_calls?.length&&(i=t.tool_calls.map(u=>{const c=Ft(()=>{if(u.id){const f=r?.[u.id];if(f)return f}return s?.includes("gemini-3")?Kt:""});return{functionCall:{name:u.name,args:u.args},...c?{thoughtSignature:c}:{}}})),[...o,...i]}function K(t,e,n=!1,s){return t.reduce((i,o,r)=>{if(!Et(o))throw new Error("Unsupported message input");const u=$t(o);if(u==="system"&&r!==0)throw new Error("System message should be the first one");const c=Ht(u),f=i.content[i.content.length];if(!i.mergeWithPreviousContent&&f&&f.role===c)throw new Error("Google Generative AI requires alternate messages between authors");const g=Vt(o,e,t.slice(0,r),s);if(i.mergeWithPreviousContent){const d=i.content[i.content.length-1];if(!d)throw new Error("There was a problem parsing your system message. Please try a prompt without one.");return d.parts.push(...g),{mergeWithPreviousContent:!1,content:i.content}}let a=c;(a==="function"||a==="system"&&!n)&&(a="user");const l={role:a,parts:g};return{mergeWithPreviousContent:u==="system"&&!n,content:[...i.content,l]}},{content:[],mergeWithPreviousContent:!1}).content}function Wt(t,e){if(!t.candidates||t.candidates.length===0||!t.candidates[0])return{generations:[],llmOutput:{filters:t.promptFeedback}};const[n]=t.candidates,{content:s,...i}=n,o=s.parts?.reduce((a,l)=>("functionCall"in l&&l.functionCall&&a.push({...l,id:"id"in l.functionCall&&typeof l.functionCall.id=="string"?l.functionCall.id:ft()}),a),[]);let r;const u=s?.parts;Array.isArray(u)&&u.length===1&&"text"in u[0]&&u[0].text&&!u[0].thought?r=u[0].text:Array.isArray(u)&&u.length>0?r=u.map(a=>a.thought&&"text"in a&&a.text?{type:"thinking",thinking:a.text,...a.thoughtSignature?{signature:a.thoughtSignature}:{}}:"text"in a?{type:"text",text:a.text}:"inlineData"in a?{type:"inlineData",inlineData:a.inlineData}:"functionCall"in a?{type:"functionCall",functionCall:a.functionCall}:"functionResponse"in a?{type:"functionResponse",functionResponse:a.functionResponse}:"fileData"in a?{type:"fileData",fileData:a.fileData}:"executableCode"in a?{type:"executableCode",executableCode:a.executableCode}:"codeExecutionResult"in a?{type:"codeExecutionResult",codeExecutionResult:a.codeExecutionResult}:a):r=[];const c=o?.reduce((a,l)=>("thoughtSignature"in l&&typeof l.thoughtSignature=="string"&&(a[l.id]=l.thoughtSignature),a),{});let f="";return typeof r=="string"?f=r:Array.isArray(r)&&r.length>0&&(f=r.find(l=>"text"in l)?.text??f),{generations:[{text:f,message:new Tt({content:r??"",tool_calls:o?.map(a=>({type:"tool_call",id:a.id,name:a.functionCall.name,args:a.functionCall.args})),additional_kwargs:{...i,[D]:c},usage_metadata:e?.usageMetadata}),generationInfo:i}],llmOutput:{tokenUsage:{promptTokens:e?.usageMetadata?.input_tokens,completionTokens:e?.usageMetadata?.output_tokens,totalTokens:e?.usageMetadata?.total_tokens}}}}function Jt(t,e){if(!t.candidates||t.candidates.length===0)return null;const[n]=t.candidates,{content:s,...i}=n,o=s.parts?.reduce((a,l)=>("functionCall"in l&&l.functionCall&&a.push({...l,id:"id"in l.functionCall&&typeof l.functionCall.id=="string"?l.functionCall.id:ft()}),a),[]);let r;const u=s?.parts;Array.isArray(u)&&u.every(a=>"text"in a&&!a.thought)?r=u.map(a=>a.text).join(""):Array.isArray(u)?r=u.map(a=>a.thought&&"text"in a&&a.text?{type:"thinking",thinking:a.text,...a.thoughtSignature?{signature:a.thoughtSignature}:{}}:"text"in a?{type:"text",text:a.text}:"inlineData"in a?{type:"inlineData",inlineData:a.inlineData}:"functionCall"in a?{type:"functionCall",functionCall:a.functionCall}:"functionResponse"in a?{type:"functionResponse",functionResponse:a.functionResponse}:"fileData"in a?{type:"fileData",fileData:a.fileData}:"executableCode"in a?{type:"executableCode",executableCode:a.executableCode}:"codeExecutionResult"in a?{type:"codeExecutionResult",codeExecutionResult:a.codeExecutionResult}:a):r=[];let c="";r&&typeof r=="string"?c=r:Array.isArray(r)&&(c=r.find(l=>"text"in l)?.text??"");const f=[];o&&f.push(...o.map(a=>({type:"tool_call_chunk",id:a.id,name:a.functionCall.name,args:JSON.stringify(a.functionCall.args)})));const g=o?.reduce((a,l)=>("thoughtSignature"in l&&typeof l.thoughtSignature=="string"&&(a[l.id]=l.thoughtSignature),a),{});return new wt({text:c,message:new St({content:r||"",name:s?s.role:void 0,tool_call_chunks:f,additional_kwargs:{[D]:g},response_metadata:{model_provider:"google-genai"},usage_metadata:e.usageMetadata}),generationInfo:i})}function zt(t){return t.every(e=>"functionDeclarations"in e&&Array.isArray(e.functionDeclarations))?t:[{functionDeclarations:t.map(e=>{if(rt(e)){const n=N(e.schema);return n.type==="object"&&"properties"in n&&Object.keys(n.properties).length===0?{name:e.name,description:e.description}:(E(n,e.name),{name:e.name,description:e.description,parameters:n})}if(ut(e)){const n=Gt(e.function.parameters);return E(n,e.function.name),{name:e.function.name,description:e.function.description??"A function available to call.",parameters:n}}return e})}]}function F(t,e){const n={input_tokens:t?.promptTokenCount??0,output_tokens:t?.candidatesTokenCount??0,total_tokens:t?.totalTokenCount??0};if(t?.cachedContentTokenCount&&(n.input_token_details??={},n.input_token_details.cache_read=t.cachedContentTokenCount),e==="gemini-3-pro-preview"){const s=Math.max(0,t?.promptTokenCount??-2e5),i=Math.max(0,t?.cachedContentTokenCount??-2e5);s&&(n.input_token_details={...n.input_token_details,over_200k:s}),i&&(n.input_token_details={...n.input_token_details,cache_read_over_200k:i})}return n}var $=class extends yt{static lc_name(){return"GoogleGenerativeAIToolsOutputParser"}lc_namespace=["langchain","google_genai","output_parsers"];returnId=!1;keyName;returnSingle=!1;zodSchema;constructor(t){super(t),this.keyName=t.keyName,this.returnSingle=t.returnSingle??this.returnSingle,this.zodSchema=t.zodSchema}async _validateResult(t){if(this.zodSchema===void 0)return t;const e=await kt(this.zodSchema,t);if(e.success)return e.data;throw new Ot(`Failed to parse. Text: "${JSON.stringify(t,null,2)}". Error: ${JSON.stringify(e.error.issues)}`,JSON.stringify(t,null,2))}async parseResult(t){const e=t.flatMap(i=>{const{message:o}=i;return!("tool_calls"in o)||!Array.isArray(o.tool_calls)?[]:o.tool_calls});if(e[0]===void 0)throw new Error("No parseable tool calls provided to GoogleGenerativeAIToolsOutputParser.");const[n]=e;return await this._validateResult(n.args)}},H;(function(t){t.STRING="string",t.NUMBER="number",t.INTEGER="integer",t.BOOLEAN="boolean",t.ARRAY="array",t.OBJECT="object"})(H||(H={}));var Y;(function(t){t.LANGUAGE_UNSPECIFIED="language_unspecified",t.PYTHON="python"})(Y||(Y={}));var B;(function(t){t.OUTCOME_UNSPECIFIED="outcome_unspecified",t.OUTCOME_OK="outcome_ok",t.OUTCOME_FAILED="outcome_failed",t.OUTCOME_DEADLINE_EXCEEDED="outcome_deadline_exceeded"})(B||(B={}));const q=["user","model","function","system"];var V;(function(t){t.HARM_CATEGORY_UNSPECIFIED="HARM_CATEGORY_UNSPECIFIED",t.HARM_CATEGORY_HATE_SPEECH="HARM_CATEGORY_HATE_SPEECH",t.HARM_CATEGORY_SEXUALLY_EXPLICIT="HARM_CATEGORY_SEXUALLY_EXPLICIT",t.HARM_CATEGORY_HARASSMENT="HARM_CATEGORY_HARASSMENT",t.HARM_CATEGORY_DANGEROUS_CONTENT="HARM_CATEGORY_DANGEROUS_CONTENT",t.HARM_CATEGORY_CIVIC_INTEGRITY="HARM_CATEGORY_CIVIC_INTEGRITY"})(V||(V={}));var W;(function(t){t.HARM_BLOCK_THRESHOLD_UNSPECIFIED="HARM_BLOCK_THRESHOLD_UNSPECIFIED",t.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",t.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",t.BLOCK_ONLY_HIGH="BLOCK_ONLY_HIGH",t.BLOCK_NONE="BLOCK_NONE"})(W||(W={}));var J;(function(t){t.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",t.NEGLIGIBLE="NEGLIGIBLE",t.LOW="LOW",t.MEDIUM="MEDIUM",t.HIGH="HIGH"})(J||(J={}));var z;(function(t){t.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",t.SAFETY="SAFETY",t.OTHER="OTHER"})(z||(z={}));var w;(function(t){t.FINISH_REASON_UNSPECIFIED="FINISH_REASON_UNSPECIFIED",t.STOP="STOP",t.MAX_TOKENS="MAX_TOKENS",t.SAFETY="SAFETY",t.RECITATION="RECITATION",t.LANGUAGE="LANGUAGE",t.BLOCKLIST="BLOCKLIST",t.PROHIBITED_CONTENT="PROHIBITED_CONTENT",t.SPII="SPII",t.MALFORMED_FUNCTION_CALL="MALFORMED_FUNCTION_CALL",t.OTHER="OTHER"})(w||(w={}));var Q;(function(t){t.TASK_TYPE_UNSPECIFIED="TASK_TYPE_UNSPECIFIED",t.RETRIEVAL_QUERY="RETRIEVAL_QUERY",t.RETRIEVAL_DOCUMENT="RETRIEVAL_DOCUMENT",t.SEMANTIC_SIMILARITY="SEMANTIC_SIMILARITY",t.CLASSIFICATION="CLASSIFICATION",t.CLUSTERING="CLUSTERING"})(Q||(Q={}));var T;(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.AUTO="AUTO",t.ANY="ANY",t.NONE="NONE"})(T||(T={}));var Z;(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.MODE_DYNAMIC="MODE_DYNAMIC"})(Z||(Z={}));class m extends Error{constructor(e){super(`[GoogleGenerativeAI Error]: ${e}`)}}class _ extends m{constructor(e,n){super(e),this.response=n}}class pt extends m{constructor(e,n,s,i){super(e),this.status=n,this.statusText=s,this.errorDetails=i}}class O extends m{}class gt extends m{}const Qt="https://generativelanguage.googleapis.com",Zt="v1beta",Xt="0.24.1",te="genai-js";var I;(function(t){t.GENERATE_CONTENT="generateContent",t.STREAM_GENERATE_CONTENT="streamGenerateContent",t.COUNT_TOKENS="countTokens",t.EMBED_CONTENT="embedContent",t.BATCH_EMBED_CONTENTS="batchEmbedContents"})(I||(I={}));class ee{constructor(e,n,s,i,o){this.model=e,this.task=n,this.apiKey=s,this.stream=i,this.requestOptions=o}toString(){var e,n;const s=((e=this.requestOptions)===null||e===void 0?void 0:e.apiVersion)||Zt;let o=`${((n=this.requestOptions)===null||n===void 0?void 0:n.baseUrl)||Qt}/${s}/${this.model}:${this.task}`;return this.stream&&(o+="?alt=sse"),o}}function ne(t){const e=[];return t?.apiClient&&e.push(t.apiClient),e.push(`${te}/${Xt}`),e.join(" ")}async function se(t){var e;const n=new Headers;n.append("Content-Type","application/json"),n.append("x-goog-api-client",ne(t.requestOptions)),n.append("x-goog-api-key",t.apiKey);let s=(e=t.requestOptions)===null||e===void 0?void 0:e.customHeaders;if(s){if(!(s instanceof Headers))try{s=new Headers(s)}catch(i){throw new O(`unable to convert customHeaders value ${JSON.stringify(s)} to Headers: ${i.message}`)}for(const[i,o]of s.entries()){if(i==="x-goog-api-key")throw new O(`Cannot set reserved header name ${i}`);if(i==="x-goog-api-client")throw new O(`Header name ${i} can only be set using the apiClient field`);n.append(i,o)}}return n}async function ie(t,e,n,s,i,o){const r=new ee(t,e,n,s,o);return{url:r.toString(),fetchOptions:Object.assign(Object.assign({},ue(o)),{method:"POST",headers:await se(r),body:i})}}async function R(t,e,n,s,i,o={},r=fetch){const{url:u,fetchOptions:c}=await ie(t,e,n,s,i,o);return oe(u,c,r)}async function oe(t,e,n=fetch){let s;try{s=await n(t,e)}catch(i){ae(i,t)}return s.ok||await re(s,t),s}function ae(t,e){let n=t;throw n.name==="AbortError"?(n=new gt(`Request aborted when fetching ${e.toString()}: ${t.message}`),n.stack=t.stack):t instanceof pt||t instanceof O||(n=new m(`Error fetching from ${e.toString()}: ${t.message}`),n.stack=t.stack),n}async function re(t,e){let n="",s;try{const i=await t.json();n=i.error.message,i.error.details&&(n+=` ${JSON.stringify(i.error.details)}`,s=i.error.details)}catch{}throw new pt(`Error fetching from ${e.toString()}: [${t.status} ${t.statusText}] ${n}`,t.status,t.statusText,s)}function ue(t){const e={};if(t?.signal!==void 0||t?.timeout>=0){const n=new AbortController;t?.timeout>=0&&setTimeout(()=>n.abort(),t.timeout),t?.signal&&t.signal.addEventListener("abort",()=>{n.abort()}),e.signal=n.signal}return e}function G(t){return t.text=()=>{if(t.candidates&&t.candidates.length>0){if(t.candidates.length>1&&console.warn(`This response had ${t.candidates.length} candidates. Returning text from the first candidate only. Access response.candidates directly to use the other candidates.`),x(t.candidates[0]))throw new _(`${y(t)}`,t);return le(t)}else if(t.promptFeedback)throw new _(`Text not available. ${y(t)}`,t);return""},t.functionCall=()=>{if(t.candidates&&t.candidates.length>0){if(t.candidates.length>1&&console.warn(`This response had ${t.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`),x(t.candidates[0]))throw new _(`${y(t)}`,t);return console.warn("response.functionCall() is deprecated. Use response.functionCalls() instead."),X(t)[0]}else if(t.promptFeedback)throw new _(`Function call not available. ${y(t)}`,t)},t.functionCalls=()=>{if(t.candidates&&t.candidates.length>0){if(t.candidates.length>1&&console.warn(`This response had ${t.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`),x(t.candidates[0]))throw new _(`${y(t)}`,t);return X(t)}else if(t.promptFeedback)throw new _(`Function call not available. ${y(t)}`,t)},t}function le(t){var e,n,s,i;const o=[];if(!((n=(e=t.candidates)===null||e===void 0?void 0:e[0].content)===null||n===void 0)&&n.parts)for(const r of(i=(s=t.candidates)===null||s===void 0?void 0:s[0].content)===null||i===void 0?void 0:i.parts)r.text&&o.push(r.text),r.executableCode&&o.push("\n```"+r.executableCode.language+`
|
|
2
2
|
`+r.executableCode.code+"\n```\n"),r.codeExecutionResult&&o.push("\n```\n"+r.codeExecutionResult.output+"\n```\n");return o.length>0?o.join(""):""}function X(t){var e,n,s,i;const o=[];if(!((n=(e=t.candidates)===null||e===void 0?void 0:e[0].content)===null||n===void 0)&&n.parts)for(const r of(i=(s=t.candidates)===null||s===void 0?void 0:s[0].content)===null||i===void 0?void 0:i.parts)r.functionCall&&o.push(r.functionCall);if(o.length>0)return o}const ce=[w.RECITATION,w.SAFETY,w.LANGUAGE];function x(t){return!!t.finishReason&&ce.includes(t.finishReason)}function y(t){var e,n,s;let i="";if((!t.candidates||t.candidates.length===0)&&t.promptFeedback)i+="Response was blocked",!((e=t.promptFeedback)===null||e===void 0)&&e.blockReason&&(i+=` due to ${t.promptFeedback.blockReason}`),!((n=t.promptFeedback)===null||n===void 0)&&n.blockReasonMessage&&(i+=`: ${t.promptFeedback.blockReasonMessage}`);else if(!((s=t.candidates)===null||s===void 0)&&s[0]){const o=t.candidates[0];x(o)&&(i+=`Candidate was blocked due to ${o.finishReason}`,o.finishMessage&&(i+=`: ${o.finishMessage}`))}return i}function S(t){return this instanceof S?(this.v=t,this):new S(t)}function de(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var s=n.apply(t,e||[]),i,o=[];return i={},r("next"),r("throw"),r("return"),i[Symbol.asyncIterator]=function(){return this},i;function r(l){s[l]&&(i[l]=function(d){return new Promise(function(p,C){o.push([l,d,p,C])>1||u(l,d)})})}function u(l,d){try{c(s[l](d))}catch(p){a(o[0][3],p)}}function c(l){l.value instanceof S?Promise.resolve(l.value.v).then(f,g):a(o[0][2],l)}function f(l){u("next",l)}function g(l){u("throw",l)}function a(l,d){l(d),o.shift(),o.length&&u(o[0][0],o[0][1])}}const tt=/^data\: (.*)(?:\n\n|\r\r|\r\n\r\n)/;function fe(t){const e=t.body.pipeThrough(new TextDecoderStream("utf8",{fatal:!0})),n=he(e),[s,i]=n.tee();return{stream:ge(s),response:pe(i)}}async function pe(t){const e=[],n=t.getReader();for(;;){const{done:s,value:i}=await n.read();if(s)return G(me(e));e.push(i)}}function ge(t){return de(this,arguments,function*(){const n=t.getReader();for(;;){const{value:s,done:i}=yield S(n.read());if(i)break;yield yield S(G(s))}})}function he(t){const e=t.getReader();return new ReadableStream({start(s){let i="";return o();function o(){return e.read().then(({value:r,done:u})=>{if(u){if(i.trim()){s.error(new m("Failed to parse stream"));return}s.close();return}i+=r;let c=i.match(tt),f;for(;c;){try{f=JSON.parse(c[1])}catch{s.error(new m(`Error parsing JSON response: "${c[1]}"`));return}s.enqueue(f),i=i.substring(c[0].length),c=i.match(tt)}return o()}).catch(r=>{let u=r;throw u.stack=r.stack,u.name==="AbortError"?u=new gt("Request aborted when reading from the stream"):u=new m("Error reading from the stream"),u})}}})}function me(t){const e=t[t.length-1],n={promptFeedback:e?.promptFeedback};for(const s of t){if(s.candidates){let i=0;for(const o of s.candidates)if(n.candidates||(n.candidates=[]),n.candidates[i]||(n.candidates[i]={index:i}),n.candidates[i].citationMetadata=o.citationMetadata,n.candidates[i].groundingMetadata=o.groundingMetadata,n.candidates[i].finishReason=o.finishReason,n.candidates[i].finishMessage=o.finishMessage,n.candidates[i].safetyRatings=o.safetyRatings,o.content&&o.content.parts){n.candidates[i].content||(n.candidates[i].content={role:o.content.role||"user",parts:[]});const r={};for(const u of o.content.parts)u.text&&(r.text=u.text),u.functionCall&&(r.functionCall=u.functionCall),u.executableCode&&(r.executableCode=u.executableCode),u.codeExecutionResult&&(r.codeExecutionResult=u.codeExecutionResult),Object.keys(r).length===0&&(r.text=""),n.candidates[i].content.parts.push(r)}i++}s.usageMetadata&&(n.usageMetadata=s.usageMetadata)}return n}async function ht(t,e,n,s){const i=await R(e,I.STREAM_GENERATE_CONTENT,t,!0,JSON.stringify(n),s);return fe(i)}async function mt(t,e,n,s){const o=await(await R(e,I.GENERATE_CONTENT,t,!1,JSON.stringify(n),s)).json();return{response:G(o)}}function Ct(t){if(t!=null){if(typeof t=="string")return{role:"system",parts:[{text:t}]};if(t.text)return{role:"system",parts:[t]};if(t.parts)return t.role?t:{role:"system",parts:t.parts}}}function A(t){let e=[];if(typeof t=="string")e=[{text:t}];else for(const n of t)typeof n=="string"?e.push({text:n}):e.push(n);return Ce(e)}function Ce(t){const e={role:"user",parts:[]},n={role:"function",parts:[]};let s=!1,i=!1;for(const o of t)"functionResponse"in o?(n.parts.push(o),i=!0):(e.parts.push(o),s=!0);if(s&&i)throw new m("Within a single message, FunctionResponse cannot be mixed with other type of part in the request for sending chat message.");if(!s&&!i)throw new m("No content is provided for sending chat message.");return s?e:n}function ye(t,e){var n;let s={model:e?.model,generationConfig:e?.generationConfig,safetySettings:e?.safetySettings,tools:e?.tools,toolConfig:e?.toolConfig,systemInstruction:e?.systemInstruction,cachedContent:(n=e?.cachedContent)===null||n===void 0?void 0:n.name,contents:[]};const i=t.generateContentRequest!=null;if(t.contents){if(i)throw new O("CountTokensRequest must have one of contents or generateContentRequest, not both.");s.contents=t.contents}else if(i)s=Object.assign(Object.assign({},s),t.generateContentRequest);else{const o=A(t);s.contents=[o]}return{generateContentRequest:s}}function et(t){let e;return t.contents?e=t:e={contents:[A(t)]},t.systemInstruction&&(e.systemInstruction=Ct(t.systemInstruction)),e}function Oe(t){return typeof t=="string"||Array.isArray(t)?{content:A(t)}:t}const nt=["text","inlineData","functionCall","functionResponse","executableCode","codeExecutionResult"],ve={user:["text","inlineData"],function:["functionResponse"],model:["text","functionCall","executableCode","codeExecutionResult"],system:["text"]};function Ie(t){let e=!1;for(const n of t){const{role:s,parts:i}=n;if(!e&&s!=="user")throw new m(`First content should be with role 'user', got ${s}`);if(!q.includes(s))throw new m(`Each item should include role field. Got ${s} but valid roles are: ${JSON.stringify(q)}`);if(!Array.isArray(i))throw new m("Content should have 'parts' property with an array of Parts");if(i.length===0)throw new m("Each Content should have at least one part");const o={text:0,inlineData:0,functionCall:0,functionResponse:0,fileData:0,executableCode:0,codeExecutionResult:0};for(const u of i)for(const c of nt)c in u&&(o[c]+=1);const r=ve[s];for(const u of nt)if(!r.includes(u)&&o[u]>0)throw new m(`Content with role '${s}' can't contain '${u}' part`);e=!0}}function st(t){var e;if(t.candidates===void 0||t.candidates.length===0)return!1;const n=(e=t.candidates[0])===null||e===void 0?void 0:e.content;if(n===void 0||n.parts===void 0||n.parts.length===0)return!1;for(const s of n.parts)if(s===void 0||Object.keys(s).length===0||s.text!==void 0&&s.text==="")return!1;return!0}const it="SILENT_ERROR";class _e{constructor(e,n,s,i={}){this.model=n,this.params=s,this._requestOptions=i,this._history=[],this._sendPromise=Promise.resolve(),this._apiKey=e,s?.history&&(Ie(s.history),this._history=s.history)}async getHistory(){return await this._sendPromise,this._history}async sendMessage(e,n={}){var s,i,o,r,u,c;await this._sendPromise;const f=A(e),g={safetySettings:(s=this.params)===null||s===void 0?void 0:s.safetySettings,generationConfig:(i=this.params)===null||i===void 0?void 0:i.generationConfig,tools:(o=this.params)===null||o===void 0?void 0:o.tools,toolConfig:(r=this.params)===null||r===void 0?void 0:r.toolConfig,systemInstruction:(u=this.params)===null||u===void 0?void 0:u.systemInstruction,cachedContent:(c=this.params)===null||c===void 0?void 0:c.cachedContent,contents:[...this._history,f]},a=Object.assign(Object.assign({},this._requestOptions),n);let l;return this._sendPromise=this._sendPromise.then(()=>mt(this._apiKey,this.model,g,a)).then(d=>{var p;if(st(d.response)){this._history.push(f);const C=Object.assign({parts:[],role:"model"},(p=d.response.candidates)===null||p===void 0?void 0:p[0].content);this._history.push(C)}else{const C=y(d.response);C&&console.warn(`sendMessage() was unsuccessful. ${C}. Inspect response object for details.`)}l=d}).catch(d=>{throw this._sendPromise=Promise.resolve(),d}),await this._sendPromise,l}async sendMessageStream(e,n={}){var s,i,o,r,u,c;await this._sendPromise;const f=A(e),g={safetySettings:(s=this.params)===null||s===void 0?void 0:s.safetySettings,generationConfig:(i=this.params)===null||i===void 0?void 0:i.generationConfig,tools:(o=this.params)===null||o===void 0?void 0:o.tools,toolConfig:(r=this.params)===null||r===void 0?void 0:r.toolConfig,systemInstruction:(u=this.params)===null||u===void 0?void 0:u.systemInstruction,cachedContent:(c=this.params)===null||c===void 0?void 0:c.cachedContent,contents:[...this._history,f]},a=Object.assign(Object.assign({},this._requestOptions),n),l=ht(this._apiKey,this.model,g,a);return this._sendPromise=this._sendPromise.then(()=>l).catch(d=>{throw new Error(it)}).then(d=>d.response).then(d=>{if(st(d)){this._history.push(f);const p=Object.assign({},d.candidates[0].content);p.role||(p.role="model"),this._history.push(p)}else{const p=y(d);p&&console.warn(`sendMessageStream() was unsuccessful. ${p}. Inspect response object for details.`)}}).catch(d=>{d.message!==it&&console.error(d)}),l}}async function Ee(t,e,n,s){return(await R(e,I.COUNT_TOKENS,t,!1,JSON.stringify(n),s)).json()}async function Te(t,e,n,s){return(await R(e,I.EMBED_CONTENT,t,!1,JSON.stringify(n),s)).json()}async function we(t,e,n,s){const i=n.requests.map(r=>Object.assign(Object.assign({},r),{model:e}));return(await R(e,I.BATCH_EMBED_CONTENTS,t,!1,JSON.stringify({requests:i}),s)).json()}class ot{constructor(e,n,s={}){this.apiKey=e,this._requestOptions=s,n.model.includes("/")?this.model=n.model:this.model=`models/${n.model}`,this.generationConfig=n.generationConfig||{},this.safetySettings=n.safetySettings||[],this.tools=n.tools,this.toolConfig=n.toolConfig,this.systemInstruction=Ct(n.systemInstruction),this.cachedContent=n.cachedContent}async generateContent(e,n={}){var s;const i=et(e),o=Object.assign(Object.assign({},this._requestOptions),n);return mt(this.apiKey,this.model,Object.assign({generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:(s=this.cachedContent)===null||s===void 0?void 0:s.name},i),o)}async generateContentStream(e,n={}){var s;const i=et(e),o=Object.assign(Object.assign({},this._requestOptions),n);return ht(this.apiKey,this.model,Object.assign({generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:(s=this.cachedContent)===null||s===void 0?void 0:s.name},i),o)}startChat(e){var n;return new _e(this.apiKey,this.model,Object.assign({generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:(n=this.cachedContent)===null||n===void 0?void 0:n.name},e),this._requestOptions)}async countTokens(e,n={}){const s=ye(e,{model:this.model,generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:this.cachedContent}),i=Object.assign(Object.assign({},this._requestOptions),n);return Ee(this.apiKey,this.model,s,i)}async embedContent(e,n={}){const s=Oe(e),i=Object.assign(Object.assign({},this._requestOptions),n);return Te(this.apiKey,this.model,s,i)}async batchEmbedContents(e,n={}){const s=Object.assign(Object.assign({},this._requestOptions),n);return we(this.apiKey,this.model,e,s)}}class M{constructor(e){this.apiKey=e}getGenerativeModel(e,n){if(!e.model)throw new m("Must provide a model name. Example: genai.getGenerativeModel({ model: 'my-model-name' })");return new ot(this.apiKey,e,n)}getGenerativeModelFromCachedContent(e,n,s){if(!e.name)throw new O("Cached content must contain a `name` field.");if(!e.model)throw new O("Cached content must contain a `model` field.");const i=["model","systemInstruction"];for(const r of i)if(n?.[r]&&e[r]&&n?.[r]!==e[r]){if(r==="model"){const u=n.model.startsWith("models/")?n.model.replace("models/",""):n.model,c=e.model.startsWith("models/")?e.model.replace("models/",""):e.model;if(u===c)continue}throw new O(`Different value for "${r}" specified in modelParams (${n[r]}) and cachedContent (${e[r]})`)}const o=Object.assign(Object.assign({},n),{model:e.model,tools:e.tools,toolConfig:e.toolConfig,systemInstruction:e.systemInstruction,cachedContent:e});return new ot(this.apiKey,o,s)}}function at(t,e){const n=Se(t),s=Re(n,e);return{tools:n,toolConfig:s}}function Se(t){let e=[];const n=[];return t.forEach(i=>{if(rt(i)){const[o]=zt([i]);o.functionDeclarations&&e.push(...o.functionDeclarations)}else if(ut(i)){const{functionDeclarations:o}=Ae(i);if(o)e.push(...o);else throw new Error("Failed to convert OpenAI structured tool to GenerativeAI tool")}else n.push(i)}),n.find(i=>"functionDeclarations"in i)?n.map(i=>{if(e?.length>0&&"functionDeclarations"in i){const o={functionDeclarations:[...i.functionDeclarations||[],...e]};return e=[],o}return i}):[...n,...e.length>0?[{functionDeclarations:e}]:[]]}function Ae(t){return{functionDeclarations:[{name:t.function.name,description:t.function.description,parameters:v(t.function.parameters)}]}}function Re(t,e){if(!t.length||!e)return;const{toolChoice:n,allowedFunctionNames:s}=e,i={any:T.ANY,auto:T.AUTO,none:T.NONE};if(n&&["any","auto","none"].includes(n))return{functionCallingConfig:{mode:i[n]??"MODE_UNSPECIFIED",allowedFunctionNames:s}};if(typeof n=="string"||s)return{functionCallingConfig:{mode:T.ANY,allowedFunctionNames:[...s??[],...n&&typeof n=="string"?[n]:[]]}}}const xe={"gemini-embedding-001":{maxInputTokens:2048,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:3072,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!1,structuredOutput:!1},"gemini-2.5-flash-image":{maxInputTokens:32768,imageInputs:!0,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:32768,reasoningOutput:!0,imageOutputs:!0,audioOutputs:!1,videoOutputs:!1,toolCalling:!1,structuredOutput:!1},"gemini-2.5-flash-preview-05-20":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-flash-lite-latest":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-2.5-flash":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-flash-latest":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-2.5-pro-preview-05-06":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-2.5-flash-preview-tts":{maxInputTokens:8e3,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:16e3,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!0,videoOutputs:!1,toolCalling:!1,structuredOutput:!1},"gemini-2.0-flash-lite":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:8192,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-live-2.5-flash-preview-native-audio":{maxInputTokens:131072,imageInputs:!1,audioInputs:!0,pdfInputs:!1,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!0,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"gemini-2.0-flash":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:8192,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-2.5-flash-lite":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-2.5-pro-preview-06-05":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-live-2.5-flash":{maxInputTokens:128e3,imageInputs:!0,audioInputs:!0,pdfInputs:!1,videoInputs:!0,maxOutputTokens:8e3,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!0,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"gemini-2.5-flash-lite-preview-06-17":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"gemini-2.5-flash-image-preview":{maxInputTokens:32768,imageInputs:!0,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:32768,reasoningOutput:!0,imageOutputs:!0,audioOutputs:!1,videoOutputs:!1,toolCalling:!1,structuredOutput:!1},"gemini-2.5-flash-preview-09-2025":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-2.5-flash-preview-04-17":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"gemini-2.5-pro-preview-tts":{maxInputTokens:8e3,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:16e3,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!0,videoOutputs:!1,toolCalling:!1,structuredOutput:!1},"gemini-2.5-pro":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-1.5-flash":{maxInputTokens:1e6,imageInputs:!0,audioInputs:!0,pdfInputs:!1,videoInputs:!0,maxOutputTokens:8192,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"gemini-1.5-flash-8b":{maxInputTokens:1e6,imageInputs:!0,audioInputs:!0,pdfInputs:!1,videoInputs:!0,maxOutputTokens:8192,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"gemini-2.5-flash-lite-preview-09-2025":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-1.5-pro":{maxInputTokens:1e6,imageInputs:!0,audioInputs:!0,pdfInputs:!1,videoInputs:!0,maxOutputTokens:8192,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!1}};var be=xe,De=class extends vt{static lc_name(){return"ChatGoogleGenerativeAI"}lc_serializable=!0;get lc_secrets(){return{apiKey:"GOOGLE_API_KEY"}}lc_namespace=["langchain","chat_models","google_genai"];get lc_aliases(){return{apiKey:"google_api_key"}}model;temperature;maxOutputTokens;topP;topK;stopSequences=[];safetySettings;apiKey;streaming=!1;json;streamUsage=!0;convertSystemMessageToHumanContent;thinkingConfig;client;get _isMultimodalModel(){return this.model.includes("vision")||this.model.startsWith("gemini-1.5")||this.model.startsWith("gemini-2")||this.model.startsWith("gemma-3-")&&!this.model.startsWith("gemma-3-1b")||this.model.startsWith("gemini-3")}constructor(t){if(super(t),this.model=t.model.replace(/^models\//,""),this.maxOutputTokens=t.maxOutputTokens??this.maxOutputTokens,this.maxOutputTokens&&this.maxOutputTokens<0)throw new Error("`maxOutputTokens` must be a positive integer");if(this.temperature=t.temperature??this.temperature,this.temperature&&(this.temperature<0||this.temperature>2))throw new Error("`temperature` must be in the range of [0.0,2.0]");if(this.topP=t.topP??this.topP,this.topP&&this.topP<0)throw new Error("`topP` must be a positive integer");if(this.topP&&this.topP>1)throw new Error("`topP` must be below 1.");if(this.topK=t.topK??this.topK,this.topK&&this.topK<0)throw new Error("`topK` must be a positive integer");if(this.stopSequences=t.stopSequences??this.stopSequences,this.apiKey=t.apiKey??dt("GOOGLE_API_KEY"),!this.apiKey)throw new Error("Please set an API key for Google GenerativeAI in the environment variable GOOGLE_API_KEY or in the `apiKey` field of the ChatGoogleGenerativeAI constructor");if(this.safetySettings=t.safetySettings??this.safetySettings,this.safetySettings&&this.safetySettings.length>0&&new Set(this.safetySettings.map(n=>n.category)).size!==this.safetySettings.length)throw new Error("The categories in `safetySettings` array must be unique");this.streaming=t.streaming??this.streaming,this.json=t.json,this.thinkingConfig=t.thinkingConfig??this.thinkingConfig,this.client=new M(this.apiKey).getGenerativeModel({model:this.model,safetySettings:this.safetySettings,generationConfig:{stopSequences:this.stopSequences,maxOutputTokens:this.maxOutputTokens,temperature:this.temperature,topP:this.topP,topK:this.topK,...this.json?{responseMimeType:"application/json"}:{},...this.thinkingConfig?{thinkingConfig:this.thinkingConfig}:{}}},{apiVersion:t.apiVersion,baseUrl:t.baseUrl,customHeaders:t.customHeaders}),this.streamUsage=t.streamUsage??this.streamUsage}useCachedContent(t,e,n){this.apiKey&&(this.client=new M(this.apiKey).getGenerativeModelFromCachedContent(t,e,n))}get useSystemInstruction(){return typeof this.convertSystemMessageToHumanContent=="boolean"?!this.convertSystemMessageToHumanContent:this.computeUseSystemInstruction}get computeUseSystemInstruction(){return this.model==="gemini-1.0-pro-001"||this.model.startsWith("gemini-pro-vision")||this.model.startsWith("gemini-1.0-pro-vision")?!1:this.model!=="gemini-pro"}getLsParams(t){return{ls_provider:"google_genai",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:this.client.generationConfig.temperature,ls_max_tokens:this.client.generationConfig.maxOutputTokens,ls_stop:t.stop}}_combineLLMOutput(){return[]}_llmType(){return"googlegenerativeai"}bindTools(t,e){return this.withConfig({tools:at(t)?.tools,...e})}invocationParams(t){const e=t?.tools?.length?at(t.tools,{toolChoice:t.tool_choice,allowedFunctionNames:t.allowedFunctionNames}):void 0;return t?.responseSchema?(this.client.generationConfig.responseSchema=t.responseSchema,this.client.generationConfig.responseMimeType="application/json"):(this.client.generationConfig.responseSchema=void 0,this.client.generationConfig.responseMimeType=this.json?"application/json":void 0),{...e?.tools?{tools:e.tools}:{},...e?.toolConfig?{toolConfig:e.toolConfig}:{}}}async _generate(t,e,n){e.signal?.throwIfAborted();const s=K(t,this._isMultimodalModel,this.useSystemInstruction,this.model);let i=s;if(s[0].role==="system"){const[f]=s;this.client.systemInstruction=f,i=s.slice(1)}const o=this.invocationParams(e);if(this.streaming){const f={},g=this._streamResponseChunks(t,e,n),a=[];for await(const d of g){const p=d.generationInfo?.completion??0;a[p]===void 0?a[p]=d:a[p]=a[p].concat(d)}return{generations:a.filter(d=>d!==void 0),llmOutput:{estimatedTokenUsage:f}}}const r=await this.completionWithRetry({...o,contents:i});let u;"usageMetadata"in r.response&&(u=F(r.response.usageMetadata,this.model));const c=Wt(r.response,{usageMetadata:u});return c.generations?.length>0&&await n?.handleLLMNewToken(c.generations[0]?.text??""),c}async*_streamResponseChunks(t,e,n){const s=K(t,this._isMultimodalModel,this.useSystemInstruction,this.model);let i=s;if(s[0].role==="system"){const[l]=s;this.client.systemInstruction=l,i=s.slice(1)}const r={...this.invocationParams(e),contents:i},u=await this.caller.callWithOptions({signal:e?.signal},async()=>{const{stream:l}=await this.client.generateContentStream(r,{signal:e?.signal});return l});let c,f=0,g=0,a=0;for await(const l of u){if(e.signal?.aborted)return;if("usageMetadata"in l&&l.usageMetadata!==void 0&&this.streamUsage!==!1&&e.streamUsage!==!1){c=F(l.usageMetadata,this.model);const p=l.usageMetadata.promptTokenCount??0;c.input_tokens=Math.max(0,p-f),f=p;const C=l.usageMetadata.candidatesTokenCount??0;c.output_tokens=Math.max(0,C-g),g=C;const U=l.usageMetadata.totalTokenCount??0;c.total_tokens=Math.max(0,U-a),a=U}const d=Jt(l,{usageMetadata:c});d&&(yield d,await n?.handleLLMNewToken(d.text??""))}}async completionWithRetry(t,e){return this.caller.callWithOptions({signal:e?.signal},async()=>{try{return await this.client.generateContent(t,{signal:e?.signal})}catch(n){throw n.message?.includes("400 Bad Request")&&(n.status=400),n}})}get profile(){return be[this.model]??{}}withStructuredOutput(t,e){const n=t,s=e?.name,i=e?.method,o=e?.includeRaw;if(i==="jsonMode")throw new Error('ChatGoogleGenerativeAI only supports "jsonSchema" or "functionCalling" as a method.');let r,u;if(i==="functionCalling"){let a=s??"extract",l;if(lt(n)){const d=N(n);l=[{functionDeclarations:[{name:a,description:d.description??"A function available to call.",parameters:d}]}],u=new $({returnSingle:!0,keyName:a,zodSchema:n})}else{let d;typeof n.name=="string"&&typeof n.parameters=="object"&&n.parameters!=null?(d=n,d.parameters=v(n.parameters),a=n.name):d={name:a,description:n.description??"",parameters:v(n)},l=[{functionDeclarations:[d]}],u=new $({returnSingle:!0,keyName:a})}r=this.bindTools(l).withConfig({allowedFunctionNames:[a]})}else{const a=N(n);r=this.withConfig({responseSchema:a}),u=new It}if(!o)return r.pipe(u).withConfig({runName:"ChatGoogleGenerativeAIStructuredOutput"});const c=L.assign({parsed:(a,l)=>u.invoke(a.raw,l)}),f=L.assign({parsed:()=>null}),g=c.withFallbacks({fallbacks:[f]});return Nt.from([{raw:r},g]).withConfig({runName:"StructuredOutputRunnable"})}},Ge=class extends Mt{apiKey;modelName="embedding-001";model="embedding-001";taskType;title;stripNewLines=!0;maxBatchSize=100;client;constructor(t){if(super(t??{}),this.modelName=t?.model?.replace(/^models\//,"")??t?.modelName?.replace(/^models\//,"")??this.modelName,this.model=this.modelName,this.taskType=t?.taskType??this.taskType,this.title=t?.title??this.title,this.title&&this.taskType!=="RETRIEVAL_DOCUMENT")throw new Error("title can only be sepcified with TaskType.RETRIEVAL_DOCUMENT");if(this.apiKey=t?.apiKey??dt("GOOGLE_API_KEY"),!this.apiKey)throw new Error("Please set an API key for Google GenerativeAI in the environmentb variable GOOGLE_API_KEY or in the `apiKey` field of the GoogleGenerativeAIEmbeddings constructor");this.client=new M(this.apiKey).getGenerativeModel({model:this.model},{baseUrl:t?.baseUrl})}_convertToContent(t){return{content:{role:"user",parts:[{text:this.stripNewLines?t.replace(/\n/g," "):t}]},taskType:this.taskType,title:this.title}}async _embedQueryContent(t){const e=this._convertToContent(t);return(await this.client.embedContent(e)).embedding.values??[]}async _embedDocumentsContent(t){const e=Dt(t,this.maxBatchSize),n=e.map(o=>({requests:o.map(r=>this._convertToContent(r))}));return(await Promise.allSettled(n.map(o=>this.client.batchEmbedContents(o)))).flatMap((o,r)=>o.status==="fulfilled"?o.value.embeddings.map(u=>u.values||[]):Array(e[r].length).fill([]))}embedQuery(t){return this.caller.call(this._embedQueryContent.bind(this),t)}embedDocuments(t){return this.caller.call(this._embedDocumentsContent.bind(this),t)}};export{De as ChatGoogleGenerativeAI,Ge as GoogleGenerativeAIEmbeddings};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{E as je,F as ee,H as Ee,I as k,J as te,K as ze,S as be,L as qe,M as Ve,N as A,O,P as Ce,Q as K,U as We,V as Je,W as Xe,X as Ke,Y as xe,Z as se,$ as oe,a0 as Q,a1 as P,a2 as _e,a3 as Qe,a4 as Ge,a5 as Ye,a6 as Ze,a7 as et,a8 as tt,a9 as rt,aa as I,ab as at,ac as nt,ad as st,ae as $,af as ot,ag as ie,ah as it,ai as lt,aj as re,ak as U,al as ut,am as dt,an as ct}from"./index-CD_ljDun.js";import{ao as wr,ap as gr,aq as Rr,ar as Sr,as as vr,at as Er,au as br,av as Cr,aw as xr,ax as _r,ay as kr,az as Ar,aA as Dr,aB as Hr,aC as Tr,aD as Fr,aE as Pr,aF as Nr,aG as Ur,aH as Lr,aI as Or,aJ as Ir,aK as Br,aL as Mr,aM as $r,aN as jr,aO as zr,aP as qr,aQ as Vr,aR as Wr,aS as Jr,aT as Xr,aU as Kr,aV as Qr,aW as Gr,aX as Yr,aY as Zr,aZ as ea,a_ as ta,a$ as ra,b0 as aa,b1 as na,b2 as sa,b3 as oa,b4 as ia,b5 as la,b6 as ua,b7 as da,b8 as ca,b9 as fa,ba as ha,bb as pa,bc as ma,bd as ya,be as wa,bf as ga,bg as Ra,bh as Sa,bi as va,bj as Ea,bk as ba,bl as Ca,bm as xa,bn as _a,bo as ka,bp as Aa,bq as Da,br as Ha,bs as Ta,bt as Fa,bu as Pa,bv as Na,bw as Ua,bx as La,by as Oa,bz as Ia,bA as Ba,bB as Ma,bC as $a,bD as ja,bE as za,bF as qa,bG as Va,bH as Wa,bI as Ja,bJ as Xa,bK as Ka,bL as Qa,bM as Ga,bN as Ya}from"./index-CD_ljDun.js";var T={},le;function ft(){if(le)return T;le=1,Object.defineProperty(T,"__esModule",{value:!0}),T.parseCookie=u,T.parse=u,T.stringifyCookie=s,T.stringifySetCookie=i,T.serialize=i,T.parseSetCookie=l,T.stringifySetCookie=i,T.serialize=i;const e=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,t=/^[\u0021-\u003A\u003C-\u007E]*$/,r=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,a=/^[\u0020-\u003A\u003D-\u007E]*$/,n=/^-?\d+$/,o=Object.prototype.toString,d=(()=>{const f=function(){};return f.prototype=Object.create(null),f})();function u(f,v){const m=new d,c=f.length;if(c<2)return m;const R=v?.decode||y;let S=0;do{const C=p(f,S,c);if(C===-1)break;const E=h(f,S,c);if(C>E){S=f.lastIndexOf(";",C-1)+1;continue}const _=w(f,S,C);m[_]===void 0&&(m[_]=R(w(f,C+1,E))),S=E+1}while(S<c);return m}function s(f,v){const m=v?.encode||encodeURIComponent,c=[];for(const R of Object.keys(f)){const S=f[R];if(S===void 0)continue;if(!e.test(R))throw new TypeError(`cookie name is invalid: ${R}`);const C=m(S);if(!t.test(C))throw new TypeError(`cookie val is invalid: ${S}`);c.push(`${R}=${C}`)}return c.join("; ")}function i(f,v,m){const c=typeof f=="object"?f:{...m,name:f,value:String(v)},S=(typeof v=="object"?v:m)?.encode||encodeURIComponent;if(!e.test(c.name))throw new TypeError(`argument name is invalid: ${c.name}`);const C=c.value?S(c.value):"";if(!t.test(C))throw new TypeError(`argument val is invalid: ${c.value}`);let E=c.name+"="+C;if(c.maxAge!==void 0){if(!Number.isInteger(c.maxAge))throw new TypeError(`option maxAge is invalid: ${c.maxAge}`);E+="; Max-Age="+c.maxAge}if(c.domain){if(!r.test(c.domain))throw new TypeError(`option domain is invalid: ${c.domain}`);E+="; Domain="+c.domain}if(c.path){if(!a.test(c.path))throw new TypeError(`option path is invalid: ${c.path}`);E+="; Path="+c.path}if(c.expires){if(!g(c.expires)||!Number.isFinite(c.expires.valueOf()))throw new TypeError(`option expires is invalid: ${c.expires}`);E+="; Expires="+c.expires.toUTCString()}if(c.httpOnly&&(E+="; HttpOnly"),c.secure&&(E+="; Secure"),c.partitioned&&(E+="; Partitioned"),c.priority)switch(typeof c.priority=="string"?c.priority.toLowerCase():void 0){case"low":E+="; Priority=Low";break;case"medium":E+="; Priority=Medium";break;case"high":E+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${c.priority}`)}if(c.sameSite)switch(typeof c.sameSite=="string"?c.sameSite.toLowerCase():c.sameSite){case!0:case"strict":E+="; SameSite=Strict";break;case"lax":E+="; SameSite=Lax";break;case"none":E+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${c.sameSite}`)}return E}function l(f,v){const m=v?.decode||y,c=f.length,R=h(f,0,c),S=p(f,0,R),C=S===-1?{name:"",value:m(w(f,0,R))}:{name:w(f,0,S),value:m(w(f,S+1,R))};let E=R+1;for(;E<c;){const _=h(f,E,c),F=p(f,E,_),x=F===-1?w(f,E,_):w(f,E,F),b=F===-1?void 0:w(f,F+1,_);switch(x.toLowerCase()){case"httponly":C.httpOnly=!0;break;case"secure":C.secure=!0;break;case"partitioned":C.partitioned=!0;break;case"domain":C.domain=b;break;case"path":C.path=b;break;case"max-age":b&&n.test(b)&&(C.maxAge=Number(b));break;case"expires":if(!b)break;const D=new Date(b);Number.isFinite(D.valueOf())&&(C.expires=D);break;case"priority":if(!b)break;const H=b.toLowerCase();(H==="low"||H==="medium"||H==="high")&&(C.priority=H);break;case"samesite":if(!b)break;const M=b.toLowerCase();(M==="lax"||M==="strict"||M==="none")&&(C.sameSite=M);break}E=_+1}return C}function h(f,v,m){const c=f.indexOf(";",v);return c===-1?m:c}function p(f,v,m){const c=f.indexOf("=",v);return c<m?c:-1}function w(f,v,m){let c=v,R=m;do{const S=f.charCodeAt(c);if(S!==32&&S!==9)break}while(++c<R);for(;R>c;){const S=f.charCodeAt(R-1);if(S!==32&&S!==9)break;R--}return f.slice(c,R)}function y(f){if(f.indexOf("%")===-1)return f;try{return decodeURIComponent(f)}catch{return f}}function g(f){return o.call(f)==="[object Date]"}return T}var ue=ft(),L={exports:{}},de;function ht(){if(de)return L.exports;de=1;var e={decodeValues:!0,map:!1,silent:!1};function t(s){return typeof s!="string"||s in{}}function r(){return Object.create(null)}function a(s){return typeof s=="string"&&!!s.trim()}function n(s,i){var l=s.split(";").filter(a),h=l.shift(),p=o(h),w=p.name,y=p.value;if(i=i?Object.assign({},e,i):e,t(w))return null;try{y=i.decodeValues?decodeURIComponent(y):y}catch(f){console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",f)}var g=r();return g.name=w,g.value=y,l.forEach(function(f){var v=f.split("="),m=v.shift().trimLeft().toLowerCase();if(!t(m)){var c=v.join("=");if(m==="expires")g.expires=new Date(c);else if(m==="max-age"){var R=parseInt(c,10);Number.isNaN(R)||(g.maxAge=R)}else m==="secure"?g.secure=!0:m==="httponly"?g.httpOnly=!0:m==="samesite"?g.sameSite=c:m==="partitioned"?g.partitioned=!0:m&&(g[m]=c)}}),g}function o(s){var i="",l="",h=s.split("=");return h.length>1?(i=h.shift(),l=h.join("=")):l=s,{name:i,value:l}}function d(s,i){if(i=i?Object.assign({},e,i):e,!s)return i.map?r():[];if(s.headers)if(typeof s.headers.getSetCookie=="function")s=s.headers.getSetCookie();else if(s.headers["set-cookie"])s=s.headers["set-cookie"];else{var l=s.headers[Object.keys(s.headers).find(function(p){return p.toLowerCase()==="set-cookie"})];!l&&s.headers.cookie&&!i.silent&&console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."),s=l}if(Array.isArray(s)||(s=[s]),i.map){var h=r();return s.filter(a).reduce(function(p,w){var y=n(w,i);return y&&!t(y.name)&&(p[y.name]=y),p},h)}else return s.filter(a).map(function(p){return n(p,i)}).filter(Boolean)}function u(s){if(Array.isArray(s))return s;if(typeof s!="string")return[];var i=[],l=0,h,p,w,y,g;function f(){for(;l<s.length&&/\s/.test(s.charAt(l));)l+=1;return l<s.length}function v(){return p=s.charAt(l),p!=="="&&p!==";"&&p!==","}for(;l<s.length;){for(h=l,g=!1;f();)if(p=s.charAt(l),p===","){for(w=l,l+=1,f(),y=l;l<s.length&&v();)l+=1;l<s.length&&s.charAt(l)==="="?(g=!0,l=y,i.push(s.substring(h,w)),h=l):l=w+1}else l+=1;(!g||l>=s.length)&&i.push(s.substring(h,s.length))}return i}return L.exports=d,L.exports.parse=d,L.exports.parseString=n,L.exports.splitCookiesString=u,L.exports}var pt=ht(),mt={};function rr({context:e,url:t,nonce:r}){typeof t=="string"&&(t=new URL(t));let{manifest:a,routeModules:n,criticalCss:o,serverHandoffString:d}=e,u=je(a.routes,n,e.future,e.isSpaMode);e.staticHandlerContext.loaderData={...e.staticHandlerContext.loaderData};for(let i of e.staticHandlerContext.matches){let l=i.route.id,h=n[l],p=e.manifest.routes[l];h&&p&&ee(l,h.clientLoader,p.hasLoader,e.isSpaMode)&&(h.HydrateFallback||!p.hasLoader)&&delete e.staticHandlerContext.loaderData[l]}let s=Ee(u,e.staticHandlerContext);return k.createElement(k.Fragment,null,k.createElement(te.Provider,{value:{manifest:a,routeModules:n,criticalCss:o,serverHandoffString:d,future:e.future,ssr:e.ssr,isSpaMode:e.isSpaMode,routeDiscovery:e.routeDiscovery,serializeError:e.serializeError,renderMeta:e.renderMeta}},k.createElement(ze,{location:s.state.location},k.createElement(be,{router:s,context:e.staticHandlerContext,hydrate:!1}))),e.serverHandoffStream?k.createElement(k.Suspense,null,k.createElement(qe,{context:e,identifier:0,reader:e.serverHandoffStream.getReader(),textDecoder:new TextDecoder,nonce:r})):null)}function ar(e,t){return function({initialEntries:a,initialIndex:n,hydrationData:o,future:d}){let u=k.useRef(),s=k.useRef();if(u.current==null){s.current={future:{unstable_subResourceIntegrity:d?.unstable_subResourceIntegrity===!0,v8_middleware:d?.v8_middleware===!0,unstable_trailingSlashAwareDataRequests:d?.unstable_trailingSlashAwareDataRequests===!0},manifest:{routes:{},entry:{imports:[],module:""},url:"",version:""},routeModules:{},ssr:!1,isSpaMode:!1,routeDiscovery:{mode:"lazy",manifestPath:"/__manifest"}};let i=ke(We(e,l=>l),t!==void 0?t:d?.v8_middleware?new K:{},s.current.manifest,s.current.routeModules);u.current=Je(i,{initialEntries:a,initialIndex:n,hydrationData:o})}return k.createElement(te.Provider,{value:s.current},k.createElement(Xe,{router:u.current}))}}function ke(e,t,r,a,n){return e.map(o=>{if(!o.id)throw new Error("Expected a route.id in react-router processRoutes() function");let d={id:o.id,path:o.path,index:o.index,Component:o.Component?et(o.Component):void 0,HydrateFallback:o.HydrateFallback?Ze(o.HydrateFallback):void 0,ErrorBoundary:o.ErrorBoundary?Ye(o.ErrorBoundary):void 0,action:o.action?s=>o.action({...s,context:t}):void 0,loader:o.loader?s=>o.loader({...s,context:t}):void 0,middleware:o.middleware?o.middleware.map(s=>(...i)=>s({...i[0],context:t},i[1])):void 0,handle:o.handle,shouldRevalidate:o.shouldRevalidate},u={id:o.id,path:o.path,index:o.index,parentId:n,hasAction:o.action!=null,hasLoader:o.loader!=null,hasClientAction:!1,hasClientLoader:!1,hasClientMiddleware:!1,hasErrorBoundary:o.ErrorBoundary!=null,module:"build/stub-path-to-module.js",clientActionModule:void 0,clientLoaderModule:void 0,clientMiddlewareModule:void 0,hydrateFallbackModule:void 0};return r.routes[d.id]=u,a[o.id]={default:d.Component||tt,ErrorBoundary:d.ErrorBoundary||void 0,handle:o.handle,links:o.links,meta:o.meta,shouldRevalidate:o.shouldRevalidate},o.children&&(d.children=ke(o.children,t,r,a,d.id)),d})}var ae=new TextEncoder,yt=async(e,t)=>{let r=ae.encode(e),a=await Ae(t,["sign"]),n=await crypto.subtle.sign("HMAC",a,r),o=btoa(String.fromCharCode(...new Uint8Array(n))).replace(/=+$/,"");return e+"."+o},wt=async(e,t)=>{let r=e.lastIndexOf("."),a=e.slice(0,r),n=e.slice(r+1),o=ae.encode(a),d=await Ae(t,["verify"]);try{let u=gt(atob(n));return await crypto.subtle.verify("HMAC",d,u,o)?a:!1}catch{return!1}},Ae=async(e,t)=>crypto.subtle.importKey("raw",ae.encode(e),{name:"HMAC",hash:"SHA-256"},!1,t);function gt(e){let t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}var De=(e,t={})=>{let{secrets:r=[],...a}={path:"/",sameSite:"lax",...t};return Ct(e,a.expires),{get name(){return e},get isSigned(){return r.length>0},get expires(){return typeof a.maxAge<"u"?new Date(Date.now()+a.maxAge*1e3):a.expires},async parse(n,o){if(!n)return null;let d=ue.parse(n,{...a,...o});if(e in d){let u=d[e];return typeof u=="string"&&u!==""?await St(u,r):""}else return null},async serialize(n,o){return ue.serialize(e,n===""?"":await Rt(n,r),{...a,...o})}}},He=e=>e!=null&&typeof e.name=="string"&&typeof e.isSigned=="boolean"&&typeof e.parse=="function"&&typeof e.serialize=="function";async function Rt(e,t){let r=vt(e);return t.length>0&&(r=await yt(r,t[0])),r}async function St(e,t){if(t.length>0){for(let r of t){let a=await wt(e,r);if(a!==!1)return ce(a)}return null}return ce(e)}function vt(e){return btoa(bt(encodeURIComponent(JSON.stringify(e))))}function ce(e){try{return JSON.parse(decodeURIComponent(Et(atob(e))))}catch{return{}}}function Et(e){let t=e.toString(),r="",a=0,n,o;for(;a<t.length;)n=t.charAt(a++),/[\w*+\-./@]/.exec(n)?r+=n:(o=n.charCodeAt(0),o<256?r+="%"+fe(o,2):r+="%u"+fe(o,4).toUpperCase());return r}function fe(e,t){let r=e.toString(16);for(;r.length<t;)r="0"+r;return r}function bt(e){let t=e.toString(),r="",a=0,n,o;for(;a<t.length;){if(n=t.charAt(a++),n==="%"){if(t.charAt(a)==="u"){if(o=t.slice(a+1,a+5),/^[\da-f]{4}$/i.exec(o)){r+=String.fromCharCode(parseInt(o,16)),a+=5;continue}}else if(o=t.slice(a,a+2),/^[\da-f]{2}$/i.exec(o)){r+=String.fromCharCode(parseInt(o,16)),a+=2;continue}}r+=n}return r}function Ct(e,t){_e(!t,`The "${e}" cookie has an "expires" property set. This will cause the expires value to not be updated when the session is committed. Instead, you should set the expires value when serializing the cookie. You can use \`commitSession(session, { expires })\` if using a session storage object, or \`cookie.serialize("value", { expires })\` if you're using the cookie directly.`)}function xt(e){return Object.keys(e).reduce((t,r)=>{let a=e[r];return a&&(t[r]=a.module),t},{})}var _t=(e=>(e.Development="development",e.Production="production",e.Test="test",e))(_t||{});function kt(e){return e==="development"||e==="production"||e==="test"}function V(e,t){if(e instanceof Error&&t!=="development"){let r=new Error("Unexpected Server Error");return r.stack=void 0,r}return e}function z(e,t){return Object.entries(e).reduce((r,[a,n])=>Object.assign(r,{[a]:V(n,t)}),{})}function Te(e,t){let r=V(e,t);return{message:r.message,stack:r.stack}}function he(e,t){if(!e)return null;let r=Object.entries(e),a={};for(let[n,o]of r)if(P(o))a[n]={...o,__type:"RouteErrorResponse"};else if(o instanceof Error){let d=V(o,t);a[n]={message:d.message,stack:d.stack,__type:"Error",...d.name!=="Error"?{__subType:d.name}:{}}}else a[n]=o;return a}function G(e,t,r){let a=Ce(e,t,r);return a?a.map(n=>({params:n.params,pathname:n.pathname,route:n.route})):null}async function pe(e,t){let r=await e({request:Dt(At(t.request)),params:t.params,context:t.context,unstable_pattern:t.unstable_pattern});if(lt(r)&&r.init&&r.init.status&&re(r.init.status))throw new Response(null,r.init);return r}function At(e){let t=new URL(e.url),r=t.searchParams.getAll("index");t.searchParams.delete("index");let a=[];for(let o of r)o&&a.push(o);for(let o of a)t.searchParams.append("index",o);let n={method:e.method,body:e.body,headers:e.headers,signal:e.signal};return n.body&&(n.duplex="half"),new Request(t.href,n)}function Dt(e){let t=new URL(e.url);t.searchParams.delete("_routes");let r={method:e.method,body:e.body,headers:e.headers,signal:e.signal};return r.body&&(r.duplex="half"),new Request(t.href,r)}function j(e,t){if(e===!1||e===null||typeof e>"u")throw console.error("The following error is a bug in React Router; please open an issue! https://github.com/remix-run/react-router/issues/new/choose"),new Error(t)}var Fe="__reactRouterDevServerHooks";function nr(e){globalThis[Fe]=e}function W(){return globalThis[Fe]}function Pe(e,t){if(typeof process<"u")try{if(mt?.IS_RR_BUILD_REQUEST==="yes")return e.headers.get(t)}catch{}return null}function Ne(e){let t={};return Object.values(e).forEach(r=>{if(r){let a=r.parentId||"";t[a]||(t[a]=[]),t[a].push(r)}}),t}function Ue(e,t="",r=Ne(e)){return(r[t]||[]).map(a=>({...a,children:Ue(e,a.id,r)}))}function Le(e,t,r="",a=Ne(e)){return(a[r]||[]).map(n=>{let o={hasErrorBoundary:n.id==="root"||n.module.ErrorBoundary!=null,id:n.id,path:n.path,middleware:n.module.middleware,loader:n.module.loader?async d=>{let u=Pe(d.request,"X-React-Router-Prerender-Data");if(u!=null){let i=u&&decodeURI(u);j(i,"Missing prerendered data for route");let l=new TextEncoder().encode(i),h=new ReadableStream({start(y){y.enqueue(l),y.close()}}),w=(await rt(h,globalThis)).value;if(w&&I in w){let y=w[I],g={status:y.status};throw y.reload?at(y.redirect,g):y.replace?nt(y.redirect,g):st(y.redirect,g)}else{j(w&&n.id in w,"Unable to decode prerendered data");let y=w[n.id];return j("data"in y,"Unable to process prerendered data"),y.data}}return await pe(n.module.loader,d)}:void 0,action:n.module.action?d=>pe(n.module.action,d):void 0,handle:n.module.handle};return n.index?{index:!0,...o}:{caseSensitive:n.caseSensitive,children:Le(e,t,n.id,a),...o}})}function me(e){return Q(JSON.stringify(e))}function ne(e,t){return Ht(e,r=>{let a=t.routes[r.route.id];return j(a,`Route with id "${r.route.id}" not found in build`),a.module.headers})}function Ht(e,t,r){let a=e.errors?e.matches.findIndex(u=>e.errors[u.route.id]):-1,n=a>=0?e.matches.slice(0,a+1):e.matches,o;if(a>=0){let{actionHeaders:u,actionData:s,loaderHeaders:i,loaderData:l}=e;e.matches.slice(a).some(h=>{let p=h.route.id;return u[p]&&(!s||!s.hasOwnProperty(p))?o=u[p]:i[p]&&!l.hasOwnProperty(p)&&(o=i[p]),o!=null})}const d=new Headers(r);return n.reduce((u,s,i)=>{let{id:l}=s.route,h=e.loaderHeaders[l]||new Headers,p=e.actionHeaders[l]||new Headers,w=o!=null&&i===n.length-1,y=w&&o!==h&&o!==p,g=t(s);if(g==null){let v=new Headers(u);return y&&N(o,v),N(p,v),N(h,v),v}let f=new Headers(typeof g=="function"?g({loaderHeaders:h,parentHeaders:u,actionHeaders:p,errorHeaders:w?o:void 0}):g);return y&&N(o,f),N(p,f),N(h,f),N(u,f),f},new Headers(d))}function N(e,t){let r=e.get("Set-Cookie");if(r){let a=pt.splitCookiesString(r),n=new Set(t.getSetCookie());a.forEach(o=>{n.has(o)||t.append("Set-Cookie",o)})}}function Oe(e,t){let r=e.get("origin"),a=typeof r=="string"&&r!=="null"?new URL(r).host:r,n=Pt(e);if(a&&(!n||a!==n.value)&&!Ft(a,t))throw n?new Error(`${n.type} header does not match \`origin\` header from a forwarded action request. Aborting the action.`):new Error("`x-forwarded-host` or `host` headers are not provided. One of these is needed to compare the `origin` header from a forwarded action request. Aborting the action.")}function Tt(e,t){const r=e.split("."),a=t.split(".");if(a.length<1||r.length<a.length)return!1;for(;a.length;){const n=a.pop(),o=r.pop();switch(n){case"":return!1;case"*":{if(o)continue;return!1}case"**":return a.length>0?!1:o!==void 0;case void 0:default:if(o!==n)return!1}}return r.length===0}function Ft(e,t=[]){return t.some(r=>r&&(r===e||Tt(e,r)))}function Pt(e){let r=e.get("x-forwarded-host")?.split(",")[0]?.trim(),a=e.get("host");return r?{type:"x-forwarded-host",value:r}:a?{type:"host",value:a}:void 0}var Ie=new Set([...dt,304]);async function Nt(e,t,r,a,n,o,d){try{try{Oe(a.headers,Array.isArray(e.allowedActionOrigins)?e.allowedActionOrigins:[])}catch{return s(new Error("Bad Request"),400)}let l=new Request(n,{method:a.method,body:a.body,headers:a.headers,signal:a.signal,...a.body?{duplex:"half"}:void 0}),h=await r.query(l,{requestContext:o,skipLoaderErrorBubbling:!0,skipRevalidation:!0,generateMiddlewareResponse:e.future.v8_middleware?async p=>{try{let w=await p(l);return u(w)}catch(w){return s(w)}}:void 0});return u(h)}catch(l){return s(l)}function u(l){return U(l)?l:i(l)}function s(l,h=500){return d(l),B(a,e,t,{result:{error:l},headers:new Headers,status:h})}function i(l){let h=ne(l,e);if(re(l.statusCode)&&h.has("Location"))return new Response(null,{status:l.statusCode,headers:h});l.errors&&(Object.values(l.errors).forEach(w=>{(!P(w)||w.error)&&d(w)}),l.errors=z(l.errors,t));let p;return l.errors?p={error:Object.values(l.errors)[0]}:p={data:Object.values(l.actionData||{})[0]},B(a,e,t,{result:p,headers:h,status:l.statusCode})}}async function Ut(e,t,r,a,n,o,d){let u=new URL(a.url).searchParams.get("_routes"),s=u?new Set(u.split(",")):null;try{let p=new Request(n,{headers:a.headers,signal:a.signal}),w=await r.query(p,{requestContext:o,filterMatchesToLoad:y=>!s||s.has(y.route.id),skipLoaderErrorBubbling:!0,generateMiddlewareResponse:e.future.v8_middleware?async y=>{try{let g=await y(p);return i(g)}catch(g){return l(g)}}:void 0});return i(w)}catch(p){return l(p)}function i(p){return U(p)?p:h(p)}function l(p){return d(p),B(a,e,t,{result:{error:p},headers:new Headers,status:500})}function h(p){let w=ne(p,e);if(re(p.statusCode)&&w.has("Location"))return new Response(null,{status:p.statusCode,headers:w});p.errors&&(Object.values(p.errors).forEach(f=>{(!P(f)||f.error)&&d(f)}),p.errors=z(p.errors,t));let y={},g=new Set(p.matches.filter(f=>s?s.has(f.route.id):f.route.loader!=null).map(f=>f.route.id));if(p.errors)for(let[f,v]of Object.entries(p.errors))y[f]={error:v};for(let[f,v]of Object.entries(p.loaderData))!(f in y)&&g.has(f)&&(y[f]={data:v});return B(a,e,t,{result:y,headers:w,status:p.statusCode})}}function B(e,t,r,{result:a,headers:n,status:o}){let d=new Headers(n);return d.set("X-Remix-Response","yes"),Ie.has(o)?new Response(null,{status:o,headers:d}):(d.set("Content-Type","text/x-script"),d.delete("Content-Length"),new Response(Y(a,e.signal,t.entry.module.streamTimeout,r),{status:o||200,headers:d}))}function ye(e,t,r,a){let n=Lt(e.status,e.headers,r.basename),o=new Headers(e.headers);return o.delete("Location"),o.set("Content-Type","text/x-script"),B(t,r,a,{result:t.method==="GET"?{[I]:n}:n,headers:o,status:xe})}function Lt(e,t,r){let a=t.get("Location");return r&&(a=$(a,r)||a),{redirect:a,status:e,revalidate:t.has("X-Remix-Revalidate")||t.has("Set-Cookie"),reload:t.has("X-Remix-Reload-Document"),replace:t.has("X-Remix-Replace")}}function Y(e,t,r,a){let n=new AbortController,o=setTimeout(()=>n.abort(new Error("Server Timeout")),typeof r=="number"?r:4950);return t.addEventListener("abort",()=>clearTimeout(o)),ct(e,{signal:n.signal,plugins:[d=>{if(d instanceof Error){let{name:u,message:s,stack:i}=a==="production"?V(d,a):d;return["SanitizedError",u,s,i]}if(d instanceof O){let{data:u,status:s,statusText:i}=d;return["ErrorResponse",u,s,i]}if(d&&typeof d=="object"&&I in d)return["SingleFetchRedirect",d[I]]}],postPlugins:[d=>{if(d&&typeof d=="object")return["SingleFetchClassInstance",Object.fromEntries(Object.entries(d))]},()=>["SingleFetchFallback"]]})}function we(e,t){let r=Ue(e.routes),a=Le(e.routes,e.future),n=kt(t)?t:"production",o=Qe(a,{basename:e.basename,unstable_instrumentations:e.entry.module.unstable_instrumentations}),d=e.entry.module.handleError||((s,{request:i})=>{n!=="test"&&!i.signal.aborted&&console.error(P(s)&&s.error?s.error:s)}),u=async(s,i)=>{let l={},h,p=R=>{t==="development"&&W()?.processRequestError?.(R),d(R,{context:h,params:l,request:s})};if(e.future.v8_middleware){if(i&&!(i instanceof K)){let R=new Error("Invalid `context` value provided to `handleRequest`. When middleware is enabled you must return an instance of `RouterContextProvider` from your `getLoadContext` function.");return p(R),q(R,n)}h=i||new K}else h=i||{};let w=new URL(s.url),y=e.basename||"/",g=w.pathname;e.future.unstable_trailingSlashAwareDataRequests?g.endsWith("/_.data")?g=g.replace(/_.data$/,""):g=g.replace(/\.data$/,""):($(g,y)==="/_root.data"?g=y:g.endsWith(".data")&&(g=g.replace(/\.data$/,"")),$(g,y)!=="/"&&g.endsWith("/")&&(g=g.slice(0,-1)));let f=Pe(s,"X-React-Router-SPA-Mode")==="yes";if(!e.ssr){let R=decodeURI(g);if(y!=="/"){let S=$(R,y);if(S==null)return d(new O(404,"Not Found",`Refusing to prerender the \`${R}\` path because it does not start with the basename \`${y}\``),{context:h,params:l,request:s}),new Response("Not Found",{status:404,statusText:"Not Found"});R=S}if(e.prerender.length===0)f=!0;else if(!e.prerender.includes(R)&&!e.prerender.includes(R+"/")){if(w.pathname.endsWith(".data"))return d(new O(404,"Not Found",`Refusing to SSR the path \`${R}\` because \`ssr:false\` is set and the path is not included in the \`prerender\` config, so in production the path will be a 404.`),{context:h,params:l,request:s}),new Response("Not Found",{status:404,statusText:"Not Found"});f=!0}}let v=ot(e.routeDiscovery.manifestPath,y);if(w.pathname===v)try{return await Ot(e,r,w)}catch(R){return p(R),new Response("Unknown Server Error",{status:500})}let m=G(r,g,e.basename);m&&m.length>0&&Object.assign(l,m[0].params);let c;if(w.pathname.endsWith(".data")){let R=new URL(s.url);R.pathname=g;let S=G(r,R.pathname,e.basename);c=await It(n,e,o,s,R,h,p),ie(c)&&(c=ye(c,s,e,n)),e.entry.module.handleDataRequest&&(c=await e.entry.module.handleDataRequest(c,{context:h,params:S?S[0].params:{},request:s}),ie(c)&&(c=ye(c,s,e,n)))}else if(!f&&m&&m[m.length-1].route.module.default==null&&m[m.length-1].route.module.ErrorBoundary==null)c=await Mt(n,e,o,m.slice(-1)[0].route.id,s,h,p);else{let{pathname:R}=w,S;e.unstable_getCriticalCss?S=await e.unstable_getCriticalCss({pathname:R}):t==="development"&&W()?.getCriticalCss&&(S=await W()?.getCriticalCss?.(R)),c=await Bt(n,e,o,s,h,p,f,S)}return s.method==="HEAD"?new Response(null,{headers:c.headers,status:c.status,statusText:c.statusText}):c};return e.entry.module.unstable_instrumentations&&(u=Ge(u,e.entry.module.unstable_instrumentations.map(s=>s.handler).filter(Boolean))),{routes:r,dataRoutes:a,serverMode:n,staticHandler:o,errorHandler:d,requestHandler:u}}var sr=(e,t)=>{let r,a,n,o,d,u;return async function(i,l){if(r=typeof e=="function"?await e():e,typeof e=="function"){let h=we(r,t);a=h.routes,n=h.serverMode,o=h.staticHandler,d=h.errorHandler,u=h.requestHandler}else if(!a||!n||!o||!d||!u){let h=we(r,t);a=h.routes,n=h.serverMode,o=h.staticHandler,d=h.errorHandler,u=h.requestHandler}return u(i,l)}};async function Ot(e,t,r){if(e.assets.version!==r.searchParams.get("version"))return new Response(null,{status:204,headers:{"X-Remix-Reload-Document":"true"}});let a={};if(r.searchParams.has("paths")){let n=new Set;(r.searchParams.get("paths")||"").split(",").filter(Boolean).forEach(u=>{u.startsWith("/")||(u=`/${u}`);let s=u.split("/").slice(1);s.forEach((i,l)=>{let h=s.slice(0,l+1).join("/");n.add(`/${h}`)})});for(let u of n){let s=G(t,u,e.basename);if(s)for(let i of s){let l=i.route.id,h=e.assets.routes[l];h&&(a[l]=h)}}return Response.json(a,{headers:{"Cache-Control":"public, max-age=31536000, immutable"}})}return new Response("Invalid Request",{status:400})}async function It(e,t,r,a,n,o,d){return a.method!=="GET"?await Nt(t,e,r,a,n,o,d):await Ut(t,e,r,a,n,o,d)}async function Bt(e,t,r,a,n,o,d,u){try{if(a.method==="POST")try{Oe(a.headers,Array.isArray(t.allowedActionOrigins)?t.allowedActionOrigins:[])}catch(l){return o(l),new Response("Bad Request",{status:400})}let i=await r.query(a,{requestContext:n,generateMiddlewareResponse:t.future.v8_middleware?async l=>{try{let h=await l(a);return U(h)||(h=await s(h,d)),h}catch(h){return o(h),new Response(null,{status:500})}}:void 0});return U(i)||(i=await s(i,d)),i}catch(i){return o(i),new Response(null,{status:500})}async function s(i,l){let h=ne(i,t);if(Ie.has(i.statusCode))return new Response(null,{status:i.statusCode,headers:h});i.errors&&(Object.values(i.errors).forEach(f=>{(!P(f)||f.error)&&o(f)}),i.errors=z(i.errors,e));let p={loaderData:i.loaderData,actionData:i.actionData,errors:he(i.errors,e)},w={basename:t.basename,future:t.future,routeDiscovery:t.routeDiscovery,ssr:t.ssr,isSpaMode:l},y={manifest:t.assets,routeModules:xt(t.routes),staticHandlerContext:i,criticalCss:u,serverHandoffString:me({...w,criticalCss:u}),serverHandoffStream:Y(p,a.signal,t.entry.module.streamTimeout,e),renderMeta:{},future:t.future,ssr:t.ssr,routeDiscovery:t.routeDiscovery,isSpaMode:l,serializeError:f=>Te(f,e)},g=t.entry.module.default;try{return await g(a,i.statusCode,h,y,n)}catch(f){o(f);let v=f;if(U(f))try{let c=await jt(f);v=new O(f.status,f.statusText,c)}catch{}i=ut(r.dataRoutes,i,v),i.errors&&(i.errors=z(i.errors,e));let m={loaderData:i.loaderData,actionData:i.actionData,errors:he(i.errors,e)};y={...y,staticHandlerContext:i,serverHandoffString:me(w),serverHandoffStream:Y(m,a.signal,t.entry.module.streamTimeout,e),renderMeta:{}};try{return await g(a,i.statusCode,h,y,n)}catch(c){return o(c),q(c,e)}}}}async function Mt(e,t,r,a,n,o,d){try{let i=await r.queryRoute(n,{routeId:a,requestContext:o,generateMiddlewareResponse:t.future.v8_middleware?async l=>{try{let h=await l(n);return u(h)}catch(h){return s(h)}}:void 0});return u(i)}catch(i){return s(i)}function u(i){return U(i)?i:typeof i=="string"?new Response(i):Response.json(i)}function s(i){if(U(i))return i;if(P(i))return d(i),$t(i,e);if(i instanceof Error&&i.message==="Expected a response from queryRoute"){let l=new Error("Expected a Response to be returned from resource route handler");return d(l),q(l,e)}return d(i),q(i,e)}}function $t(e,t){return Response.json(Te(e.error||new Error("Unexpected Server Error"),t),{status:e.status,statusText:e.statusText})}function q(e,t){let r="Unexpected Server Error";return t!=="production"&&(r+=`
|
|
1
|
+
import{E as je,F as ee,H as Ee,I as k,J as te,K as ze,S as be,L as qe,M as Ve,N as A,O,P as Ce,Q as K,U as We,V as Je,W as Xe,X as Ke,Y as xe,Z as se,$ as oe,a0 as Q,a1 as P,a2 as _e,a3 as Qe,a4 as Ge,a5 as Ye,a6 as Ze,a7 as et,a8 as tt,a9 as rt,aa as I,ab as at,ac as nt,ad as st,ae as $,af as ot,ag as ie,ah as it,ai as lt,aj as re,ak as U,al as ut,am as dt,an as ct}from"./index-bnjI3CWS.js";import{ao as wr,ap as gr,aq as Rr,ar as Sr,as as vr,at as Er,au as br,av as Cr,aw as xr,ax as _r,ay as kr,az as Ar,aA as Dr,aB as Hr,aC as Tr,aD as Fr,aE as Pr,aF as Nr,aG as Ur,aH as Lr,aI as Or,aJ as Ir,aK as Br,aL as Mr,aM as $r,aN as jr,aO as zr,aP as qr,aQ as Vr,aR as Wr,aS as Jr,aT as Xr,aU as Kr,aV as Qr,aW as Gr,aX as Yr,aY as Zr,aZ as ea,a_ as ta,a$ as ra,b0 as aa,b1 as na,b2 as sa,b3 as oa,b4 as ia,b5 as la,b6 as ua,b7 as da,b8 as ca,b9 as fa,ba as ha,bb as pa,bc as ma,bd as ya,be as wa,bf as ga,bg as Ra,bh as Sa,bi as va,bj as Ea,bk as ba,bl as Ca,bm as xa,bn as _a,bo as ka,bp as Aa,bq as Da,br as Ha,bs as Ta,bt as Fa,bu as Pa,bv as Na,bw as Ua,bx as La,by as Oa,bz as Ia,bA as Ba,bB as Ma,bC as $a,bD as ja,bE as za,bF as qa,bG as Va,bH as Wa,bI as Ja,bJ as Xa,bK as Ka,bL as Qa,bM as Ga,bN as Ya}from"./index-bnjI3CWS.js";var T={},le;function ft(){if(le)return T;le=1,Object.defineProperty(T,"__esModule",{value:!0}),T.parseCookie=u,T.parse=u,T.stringifyCookie=s,T.stringifySetCookie=i,T.serialize=i,T.parseSetCookie=l,T.stringifySetCookie=i,T.serialize=i;const e=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,t=/^[\u0021-\u003A\u003C-\u007E]*$/,r=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,a=/^[\u0020-\u003A\u003D-\u007E]*$/,n=/^-?\d+$/,o=Object.prototype.toString,d=(()=>{const f=function(){};return f.prototype=Object.create(null),f})();function u(f,v){const m=new d,c=f.length;if(c<2)return m;const R=v?.decode||y;let S=0;do{const C=p(f,S,c);if(C===-1)break;const E=h(f,S,c);if(C>E){S=f.lastIndexOf(";",C-1)+1;continue}const _=w(f,S,C);m[_]===void 0&&(m[_]=R(w(f,C+1,E))),S=E+1}while(S<c);return m}function s(f,v){const m=v?.encode||encodeURIComponent,c=[];for(const R of Object.keys(f)){const S=f[R];if(S===void 0)continue;if(!e.test(R))throw new TypeError(`cookie name is invalid: ${R}`);const C=m(S);if(!t.test(C))throw new TypeError(`cookie val is invalid: ${S}`);c.push(`${R}=${C}`)}return c.join("; ")}function i(f,v,m){const c=typeof f=="object"?f:{...m,name:f,value:String(v)},S=(typeof v=="object"?v:m)?.encode||encodeURIComponent;if(!e.test(c.name))throw new TypeError(`argument name is invalid: ${c.name}`);const C=c.value?S(c.value):"";if(!t.test(C))throw new TypeError(`argument val is invalid: ${c.value}`);let E=c.name+"="+C;if(c.maxAge!==void 0){if(!Number.isInteger(c.maxAge))throw new TypeError(`option maxAge is invalid: ${c.maxAge}`);E+="; Max-Age="+c.maxAge}if(c.domain){if(!r.test(c.domain))throw new TypeError(`option domain is invalid: ${c.domain}`);E+="; Domain="+c.domain}if(c.path){if(!a.test(c.path))throw new TypeError(`option path is invalid: ${c.path}`);E+="; Path="+c.path}if(c.expires){if(!g(c.expires)||!Number.isFinite(c.expires.valueOf()))throw new TypeError(`option expires is invalid: ${c.expires}`);E+="; Expires="+c.expires.toUTCString()}if(c.httpOnly&&(E+="; HttpOnly"),c.secure&&(E+="; Secure"),c.partitioned&&(E+="; Partitioned"),c.priority)switch(typeof c.priority=="string"?c.priority.toLowerCase():void 0){case"low":E+="; Priority=Low";break;case"medium":E+="; Priority=Medium";break;case"high":E+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${c.priority}`)}if(c.sameSite)switch(typeof c.sameSite=="string"?c.sameSite.toLowerCase():c.sameSite){case!0:case"strict":E+="; SameSite=Strict";break;case"lax":E+="; SameSite=Lax";break;case"none":E+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${c.sameSite}`)}return E}function l(f,v){const m=v?.decode||y,c=f.length,R=h(f,0,c),S=p(f,0,R),C=S===-1?{name:"",value:m(w(f,0,R))}:{name:w(f,0,S),value:m(w(f,S+1,R))};let E=R+1;for(;E<c;){const _=h(f,E,c),F=p(f,E,_),x=F===-1?w(f,E,_):w(f,E,F),b=F===-1?void 0:w(f,F+1,_);switch(x.toLowerCase()){case"httponly":C.httpOnly=!0;break;case"secure":C.secure=!0;break;case"partitioned":C.partitioned=!0;break;case"domain":C.domain=b;break;case"path":C.path=b;break;case"max-age":b&&n.test(b)&&(C.maxAge=Number(b));break;case"expires":if(!b)break;const D=new Date(b);Number.isFinite(D.valueOf())&&(C.expires=D);break;case"priority":if(!b)break;const H=b.toLowerCase();(H==="low"||H==="medium"||H==="high")&&(C.priority=H);break;case"samesite":if(!b)break;const M=b.toLowerCase();(M==="lax"||M==="strict"||M==="none")&&(C.sameSite=M);break}E=_+1}return C}function h(f,v,m){const c=f.indexOf(";",v);return c===-1?m:c}function p(f,v,m){const c=f.indexOf("=",v);return c<m?c:-1}function w(f,v,m){let c=v,R=m;do{const S=f.charCodeAt(c);if(S!==32&&S!==9)break}while(++c<R);for(;R>c;){const S=f.charCodeAt(R-1);if(S!==32&&S!==9)break;R--}return f.slice(c,R)}function y(f){if(f.indexOf("%")===-1)return f;try{return decodeURIComponent(f)}catch{return f}}function g(f){return o.call(f)==="[object Date]"}return T}var ue=ft(),L={exports:{}},de;function ht(){if(de)return L.exports;de=1;var e={decodeValues:!0,map:!1,silent:!1};function t(s){return typeof s!="string"||s in{}}function r(){return Object.create(null)}function a(s){return typeof s=="string"&&!!s.trim()}function n(s,i){var l=s.split(";").filter(a),h=l.shift(),p=o(h),w=p.name,y=p.value;if(i=i?Object.assign({},e,i):e,t(w))return null;try{y=i.decodeValues?decodeURIComponent(y):y}catch(f){console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",f)}var g=r();return g.name=w,g.value=y,l.forEach(function(f){var v=f.split("="),m=v.shift().trimLeft().toLowerCase();if(!t(m)){var c=v.join("=");if(m==="expires")g.expires=new Date(c);else if(m==="max-age"){var R=parseInt(c,10);Number.isNaN(R)||(g.maxAge=R)}else m==="secure"?g.secure=!0:m==="httponly"?g.httpOnly=!0:m==="samesite"?g.sameSite=c:m==="partitioned"?g.partitioned=!0:m&&(g[m]=c)}}),g}function o(s){var i="",l="",h=s.split("=");return h.length>1?(i=h.shift(),l=h.join("=")):l=s,{name:i,value:l}}function d(s,i){if(i=i?Object.assign({},e,i):e,!s)return i.map?r():[];if(s.headers)if(typeof s.headers.getSetCookie=="function")s=s.headers.getSetCookie();else if(s.headers["set-cookie"])s=s.headers["set-cookie"];else{var l=s.headers[Object.keys(s.headers).find(function(p){return p.toLowerCase()==="set-cookie"})];!l&&s.headers.cookie&&!i.silent&&console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."),s=l}if(Array.isArray(s)||(s=[s]),i.map){var h=r();return s.filter(a).reduce(function(p,w){var y=n(w,i);return y&&!t(y.name)&&(p[y.name]=y),p},h)}else return s.filter(a).map(function(p){return n(p,i)}).filter(Boolean)}function u(s){if(Array.isArray(s))return s;if(typeof s!="string")return[];var i=[],l=0,h,p,w,y,g;function f(){for(;l<s.length&&/\s/.test(s.charAt(l));)l+=1;return l<s.length}function v(){return p=s.charAt(l),p!=="="&&p!==";"&&p!==","}for(;l<s.length;){for(h=l,g=!1;f();)if(p=s.charAt(l),p===","){for(w=l,l+=1,f(),y=l;l<s.length&&v();)l+=1;l<s.length&&s.charAt(l)==="="?(g=!0,l=y,i.push(s.substring(h,w)),h=l):l=w+1}else l+=1;(!g||l>=s.length)&&i.push(s.substring(h,s.length))}return i}return L.exports=d,L.exports.parse=d,L.exports.parseString=n,L.exports.splitCookiesString=u,L.exports}var pt=ht(),mt={};function rr({context:e,url:t,nonce:r}){typeof t=="string"&&(t=new URL(t));let{manifest:a,routeModules:n,criticalCss:o,serverHandoffString:d}=e,u=je(a.routes,n,e.future,e.isSpaMode);e.staticHandlerContext.loaderData={...e.staticHandlerContext.loaderData};for(let i of e.staticHandlerContext.matches){let l=i.route.id,h=n[l],p=e.manifest.routes[l];h&&p&&ee(l,h.clientLoader,p.hasLoader,e.isSpaMode)&&(h.HydrateFallback||!p.hasLoader)&&delete e.staticHandlerContext.loaderData[l]}let s=Ee(u,e.staticHandlerContext);return k.createElement(k.Fragment,null,k.createElement(te.Provider,{value:{manifest:a,routeModules:n,criticalCss:o,serverHandoffString:d,future:e.future,ssr:e.ssr,isSpaMode:e.isSpaMode,routeDiscovery:e.routeDiscovery,serializeError:e.serializeError,renderMeta:e.renderMeta}},k.createElement(ze,{location:s.state.location},k.createElement(be,{router:s,context:e.staticHandlerContext,hydrate:!1}))),e.serverHandoffStream?k.createElement(k.Suspense,null,k.createElement(qe,{context:e,identifier:0,reader:e.serverHandoffStream.getReader(),textDecoder:new TextDecoder,nonce:r})):null)}function ar(e,t){return function({initialEntries:a,initialIndex:n,hydrationData:o,future:d}){let u=k.useRef(),s=k.useRef();if(u.current==null){s.current={future:{unstable_subResourceIntegrity:d?.unstable_subResourceIntegrity===!0,v8_middleware:d?.v8_middleware===!0,unstable_trailingSlashAwareDataRequests:d?.unstable_trailingSlashAwareDataRequests===!0},manifest:{routes:{},entry:{imports:[],module:""},url:"",version:""},routeModules:{},ssr:!1,isSpaMode:!1,routeDiscovery:{mode:"lazy",manifestPath:"/__manifest"}};let i=ke(We(e,l=>l),t!==void 0?t:d?.v8_middleware?new K:{},s.current.manifest,s.current.routeModules);u.current=Je(i,{initialEntries:a,initialIndex:n,hydrationData:o})}return k.createElement(te.Provider,{value:s.current},k.createElement(Xe,{router:u.current}))}}function ke(e,t,r,a,n){return e.map(o=>{if(!o.id)throw new Error("Expected a route.id in react-router processRoutes() function");let d={id:o.id,path:o.path,index:o.index,Component:o.Component?et(o.Component):void 0,HydrateFallback:o.HydrateFallback?Ze(o.HydrateFallback):void 0,ErrorBoundary:o.ErrorBoundary?Ye(o.ErrorBoundary):void 0,action:o.action?s=>o.action({...s,context:t}):void 0,loader:o.loader?s=>o.loader({...s,context:t}):void 0,middleware:o.middleware?o.middleware.map(s=>(...i)=>s({...i[0],context:t},i[1])):void 0,handle:o.handle,shouldRevalidate:o.shouldRevalidate},u={id:o.id,path:o.path,index:o.index,parentId:n,hasAction:o.action!=null,hasLoader:o.loader!=null,hasClientAction:!1,hasClientLoader:!1,hasClientMiddleware:!1,hasErrorBoundary:o.ErrorBoundary!=null,module:"build/stub-path-to-module.js",clientActionModule:void 0,clientLoaderModule:void 0,clientMiddlewareModule:void 0,hydrateFallbackModule:void 0};return r.routes[d.id]=u,a[o.id]={default:d.Component||tt,ErrorBoundary:d.ErrorBoundary||void 0,handle:o.handle,links:o.links,meta:o.meta,shouldRevalidate:o.shouldRevalidate},o.children&&(d.children=ke(o.children,t,r,a,d.id)),d})}var ae=new TextEncoder,yt=async(e,t)=>{let r=ae.encode(e),a=await Ae(t,["sign"]),n=await crypto.subtle.sign("HMAC",a,r),o=btoa(String.fromCharCode(...new Uint8Array(n))).replace(/=+$/,"");return e+"."+o},wt=async(e,t)=>{let r=e.lastIndexOf("."),a=e.slice(0,r),n=e.slice(r+1),o=ae.encode(a),d=await Ae(t,["verify"]);try{let u=gt(atob(n));return await crypto.subtle.verify("HMAC",d,u,o)?a:!1}catch{return!1}},Ae=async(e,t)=>crypto.subtle.importKey("raw",ae.encode(e),{name:"HMAC",hash:"SHA-256"},!1,t);function gt(e){let t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}var De=(e,t={})=>{let{secrets:r=[],...a}={path:"/",sameSite:"lax",...t};return Ct(e,a.expires),{get name(){return e},get isSigned(){return r.length>0},get expires(){return typeof a.maxAge<"u"?new Date(Date.now()+a.maxAge*1e3):a.expires},async parse(n,o){if(!n)return null;let d=ue.parse(n,{...a,...o});if(e in d){let u=d[e];return typeof u=="string"&&u!==""?await St(u,r):""}else return null},async serialize(n,o){return ue.serialize(e,n===""?"":await Rt(n,r),{...a,...o})}}},He=e=>e!=null&&typeof e.name=="string"&&typeof e.isSigned=="boolean"&&typeof e.parse=="function"&&typeof e.serialize=="function";async function Rt(e,t){let r=vt(e);return t.length>0&&(r=await yt(r,t[0])),r}async function St(e,t){if(t.length>0){for(let r of t){let a=await wt(e,r);if(a!==!1)return ce(a)}return null}return ce(e)}function vt(e){return btoa(bt(encodeURIComponent(JSON.stringify(e))))}function ce(e){try{return JSON.parse(decodeURIComponent(Et(atob(e))))}catch{return{}}}function Et(e){let t=e.toString(),r="",a=0,n,o;for(;a<t.length;)n=t.charAt(a++),/[\w*+\-./@]/.exec(n)?r+=n:(o=n.charCodeAt(0),o<256?r+="%"+fe(o,2):r+="%u"+fe(o,4).toUpperCase());return r}function fe(e,t){let r=e.toString(16);for(;r.length<t;)r="0"+r;return r}function bt(e){let t=e.toString(),r="",a=0,n,o;for(;a<t.length;){if(n=t.charAt(a++),n==="%"){if(t.charAt(a)==="u"){if(o=t.slice(a+1,a+5),/^[\da-f]{4}$/i.exec(o)){r+=String.fromCharCode(parseInt(o,16)),a+=5;continue}}else if(o=t.slice(a,a+2),/^[\da-f]{2}$/i.exec(o)){r+=String.fromCharCode(parseInt(o,16)),a+=2;continue}}r+=n}return r}function Ct(e,t){_e(!t,`The "${e}" cookie has an "expires" property set. This will cause the expires value to not be updated when the session is committed. Instead, you should set the expires value when serializing the cookie. You can use \`commitSession(session, { expires })\` if using a session storage object, or \`cookie.serialize("value", { expires })\` if you're using the cookie directly.`)}function xt(e){return Object.keys(e).reduce((t,r)=>{let a=e[r];return a&&(t[r]=a.module),t},{})}var _t=(e=>(e.Development="development",e.Production="production",e.Test="test",e))(_t||{});function kt(e){return e==="development"||e==="production"||e==="test"}function V(e,t){if(e instanceof Error&&t!=="development"){let r=new Error("Unexpected Server Error");return r.stack=void 0,r}return e}function z(e,t){return Object.entries(e).reduce((r,[a,n])=>Object.assign(r,{[a]:V(n,t)}),{})}function Te(e,t){let r=V(e,t);return{message:r.message,stack:r.stack}}function he(e,t){if(!e)return null;let r=Object.entries(e),a={};for(let[n,o]of r)if(P(o))a[n]={...o,__type:"RouteErrorResponse"};else if(o instanceof Error){let d=V(o,t);a[n]={message:d.message,stack:d.stack,__type:"Error",...d.name!=="Error"?{__subType:d.name}:{}}}else a[n]=o;return a}function G(e,t,r){let a=Ce(e,t,r);return a?a.map(n=>({params:n.params,pathname:n.pathname,route:n.route})):null}async function pe(e,t){let r=await e({request:Dt(At(t.request)),params:t.params,context:t.context,unstable_pattern:t.unstable_pattern});if(lt(r)&&r.init&&r.init.status&&re(r.init.status))throw new Response(null,r.init);return r}function At(e){let t=new URL(e.url),r=t.searchParams.getAll("index");t.searchParams.delete("index");let a=[];for(let o of r)o&&a.push(o);for(let o of a)t.searchParams.append("index",o);let n={method:e.method,body:e.body,headers:e.headers,signal:e.signal};return n.body&&(n.duplex="half"),new Request(t.href,n)}function Dt(e){let t=new URL(e.url);t.searchParams.delete("_routes");let r={method:e.method,body:e.body,headers:e.headers,signal:e.signal};return r.body&&(r.duplex="half"),new Request(t.href,r)}function j(e,t){if(e===!1||e===null||typeof e>"u")throw console.error("The following error is a bug in React Router; please open an issue! https://github.com/remix-run/react-router/issues/new/choose"),new Error(t)}var Fe="__reactRouterDevServerHooks";function nr(e){globalThis[Fe]=e}function W(){return globalThis[Fe]}function Pe(e,t){if(typeof process<"u")try{if(mt?.IS_RR_BUILD_REQUEST==="yes")return e.headers.get(t)}catch{}return null}function Ne(e){let t={};return Object.values(e).forEach(r=>{if(r){let a=r.parentId||"";t[a]||(t[a]=[]),t[a].push(r)}}),t}function Ue(e,t="",r=Ne(e)){return(r[t]||[]).map(a=>({...a,children:Ue(e,a.id,r)}))}function Le(e,t,r="",a=Ne(e)){return(a[r]||[]).map(n=>{let o={hasErrorBoundary:n.id==="root"||n.module.ErrorBoundary!=null,id:n.id,path:n.path,middleware:n.module.middleware,loader:n.module.loader?async d=>{let u=Pe(d.request,"X-React-Router-Prerender-Data");if(u!=null){let i=u&&decodeURI(u);j(i,"Missing prerendered data for route");let l=new TextEncoder().encode(i),h=new ReadableStream({start(y){y.enqueue(l),y.close()}}),w=(await rt(h,globalThis)).value;if(w&&I in w){let y=w[I],g={status:y.status};throw y.reload?at(y.redirect,g):y.replace?nt(y.redirect,g):st(y.redirect,g)}else{j(w&&n.id in w,"Unable to decode prerendered data");let y=w[n.id];return j("data"in y,"Unable to process prerendered data"),y.data}}return await pe(n.module.loader,d)}:void 0,action:n.module.action?d=>pe(n.module.action,d):void 0,handle:n.module.handle};return n.index?{index:!0,...o}:{caseSensitive:n.caseSensitive,children:Le(e,t,n.id,a),...o}})}function me(e){return Q(JSON.stringify(e))}function ne(e,t){return Ht(e,r=>{let a=t.routes[r.route.id];return j(a,`Route with id "${r.route.id}" not found in build`),a.module.headers})}function Ht(e,t,r){let a=e.errors?e.matches.findIndex(u=>e.errors[u.route.id]):-1,n=a>=0?e.matches.slice(0,a+1):e.matches,o;if(a>=0){let{actionHeaders:u,actionData:s,loaderHeaders:i,loaderData:l}=e;e.matches.slice(a).some(h=>{let p=h.route.id;return u[p]&&(!s||!s.hasOwnProperty(p))?o=u[p]:i[p]&&!l.hasOwnProperty(p)&&(o=i[p]),o!=null})}const d=new Headers(r);return n.reduce((u,s,i)=>{let{id:l}=s.route,h=e.loaderHeaders[l]||new Headers,p=e.actionHeaders[l]||new Headers,w=o!=null&&i===n.length-1,y=w&&o!==h&&o!==p,g=t(s);if(g==null){let v=new Headers(u);return y&&N(o,v),N(p,v),N(h,v),v}let f=new Headers(typeof g=="function"?g({loaderHeaders:h,parentHeaders:u,actionHeaders:p,errorHeaders:w?o:void 0}):g);return y&&N(o,f),N(p,f),N(h,f),N(u,f),f},new Headers(d))}function N(e,t){let r=e.get("Set-Cookie");if(r){let a=pt.splitCookiesString(r),n=new Set(t.getSetCookie());a.forEach(o=>{n.has(o)||t.append("Set-Cookie",o)})}}function Oe(e,t){let r=e.get("origin"),a=typeof r=="string"&&r!=="null"?new URL(r).host:r,n=Pt(e);if(a&&(!n||a!==n.value)&&!Ft(a,t))throw n?new Error(`${n.type} header does not match \`origin\` header from a forwarded action request. Aborting the action.`):new Error("`x-forwarded-host` or `host` headers are not provided. One of these is needed to compare the `origin` header from a forwarded action request. Aborting the action.")}function Tt(e,t){const r=e.split("."),a=t.split(".");if(a.length<1||r.length<a.length)return!1;for(;a.length;){const n=a.pop(),o=r.pop();switch(n){case"":return!1;case"*":{if(o)continue;return!1}case"**":return a.length>0?!1:o!==void 0;case void 0:default:if(o!==n)return!1}}return r.length===0}function Ft(e,t=[]){return t.some(r=>r&&(r===e||Tt(e,r)))}function Pt(e){let r=e.get("x-forwarded-host")?.split(",")[0]?.trim(),a=e.get("host");return r?{type:"x-forwarded-host",value:r}:a?{type:"host",value:a}:void 0}var Ie=new Set([...dt,304]);async function Nt(e,t,r,a,n,o,d){try{try{Oe(a.headers,Array.isArray(e.allowedActionOrigins)?e.allowedActionOrigins:[])}catch{return s(new Error("Bad Request"),400)}let l=new Request(n,{method:a.method,body:a.body,headers:a.headers,signal:a.signal,...a.body?{duplex:"half"}:void 0}),h=await r.query(l,{requestContext:o,skipLoaderErrorBubbling:!0,skipRevalidation:!0,generateMiddlewareResponse:e.future.v8_middleware?async p=>{try{let w=await p(l);return u(w)}catch(w){return s(w)}}:void 0});return u(h)}catch(l){return s(l)}function u(l){return U(l)?l:i(l)}function s(l,h=500){return d(l),B(a,e,t,{result:{error:l},headers:new Headers,status:h})}function i(l){let h=ne(l,e);if(re(l.statusCode)&&h.has("Location"))return new Response(null,{status:l.statusCode,headers:h});l.errors&&(Object.values(l.errors).forEach(w=>{(!P(w)||w.error)&&d(w)}),l.errors=z(l.errors,t));let p;return l.errors?p={error:Object.values(l.errors)[0]}:p={data:Object.values(l.actionData||{})[0]},B(a,e,t,{result:p,headers:h,status:l.statusCode})}}async function Ut(e,t,r,a,n,o,d){let u=new URL(a.url).searchParams.get("_routes"),s=u?new Set(u.split(",")):null;try{let p=new Request(n,{headers:a.headers,signal:a.signal}),w=await r.query(p,{requestContext:o,filterMatchesToLoad:y=>!s||s.has(y.route.id),skipLoaderErrorBubbling:!0,generateMiddlewareResponse:e.future.v8_middleware?async y=>{try{let g=await y(p);return i(g)}catch(g){return l(g)}}:void 0});return i(w)}catch(p){return l(p)}function i(p){return U(p)?p:h(p)}function l(p){return d(p),B(a,e,t,{result:{error:p},headers:new Headers,status:500})}function h(p){let w=ne(p,e);if(re(p.statusCode)&&w.has("Location"))return new Response(null,{status:p.statusCode,headers:w});p.errors&&(Object.values(p.errors).forEach(f=>{(!P(f)||f.error)&&d(f)}),p.errors=z(p.errors,t));let y={},g=new Set(p.matches.filter(f=>s?s.has(f.route.id):f.route.loader!=null).map(f=>f.route.id));if(p.errors)for(let[f,v]of Object.entries(p.errors))y[f]={error:v};for(let[f,v]of Object.entries(p.loaderData))!(f in y)&&g.has(f)&&(y[f]={data:v});return B(a,e,t,{result:y,headers:w,status:p.statusCode})}}function B(e,t,r,{result:a,headers:n,status:o}){let d=new Headers(n);return d.set("X-Remix-Response","yes"),Ie.has(o)?new Response(null,{status:o,headers:d}):(d.set("Content-Type","text/x-script"),d.delete("Content-Length"),new Response(Y(a,e.signal,t.entry.module.streamTimeout,r),{status:o||200,headers:d}))}function ye(e,t,r,a){let n=Lt(e.status,e.headers,r.basename),o=new Headers(e.headers);return o.delete("Location"),o.set("Content-Type","text/x-script"),B(t,r,a,{result:t.method==="GET"?{[I]:n}:n,headers:o,status:xe})}function Lt(e,t,r){let a=t.get("Location");return r&&(a=$(a,r)||a),{redirect:a,status:e,revalidate:t.has("X-Remix-Revalidate")||t.has("Set-Cookie"),reload:t.has("X-Remix-Reload-Document"),replace:t.has("X-Remix-Replace")}}function Y(e,t,r,a){let n=new AbortController,o=setTimeout(()=>n.abort(new Error("Server Timeout")),typeof r=="number"?r:4950);return t.addEventListener("abort",()=>clearTimeout(o)),ct(e,{signal:n.signal,plugins:[d=>{if(d instanceof Error){let{name:u,message:s,stack:i}=a==="production"?V(d,a):d;return["SanitizedError",u,s,i]}if(d instanceof O){let{data:u,status:s,statusText:i}=d;return["ErrorResponse",u,s,i]}if(d&&typeof d=="object"&&I in d)return["SingleFetchRedirect",d[I]]}],postPlugins:[d=>{if(d&&typeof d=="object")return["SingleFetchClassInstance",Object.fromEntries(Object.entries(d))]},()=>["SingleFetchFallback"]]})}function we(e,t){let r=Ue(e.routes),a=Le(e.routes,e.future),n=kt(t)?t:"production",o=Qe(a,{basename:e.basename,unstable_instrumentations:e.entry.module.unstable_instrumentations}),d=e.entry.module.handleError||((s,{request:i})=>{n!=="test"&&!i.signal.aborted&&console.error(P(s)&&s.error?s.error:s)}),u=async(s,i)=>{let l={},h,p=R=>{t==="development"&&W()?.processRequestError?.(R),d(R,{context:h,params:l,request:s})};if(e.future.v8_middleware){if(i&&!(i instanceof K)){let R=new Error("Invalid `context` value provided to `handleRequest`. When middleware is enabled you must return an instance of `RouterContextProvider` from your `getLoadContext` function.");return p(R),q(R,n)}h=i||new K}else h=i||{};let w=new URL(s.url),y=e.basename||"/",g=w.pathname;e.future.unstable_trailingSlashAwareDataRequests?g.endsWith("/_.data")?g=g.replace(/_.data$/,""):g=g.replace(/\.data$/,""):($(g,y)==="/_root.data"?g=y:g.endsWith(".data")&&(g=g.replace(/\.data$/,"")),$(g,y)!=="/"&&g.endsWith("/")&&(g=g.slice(0,-1)));let f=Pe(s,"X-React-Router-SPA-Mode")==="yes";if(!e.ssr){let R=decodeURI(g);if(y!=="/"){let S=$(R,y);if(S==null)return d(new O(404,"Not Found",`Refusing to prerender the \`${R}\` path because it does not start with the basename \`${y}\``),{context:h,params:l,request:s}),new Response("Not Found",{status:404,statusText:"Not Found"});R=S}if(e.prerender.length===0)f=!0;else if(!e.prerender.includes(R)&&!e.prerender.includes(R+"/")){if(w.pathname.endsWith(".data"))return d(new O(404,"Not Found",`Refusing to SSR the path \`${R}\` because \`ssr:false\` is set and the path is not included in the \`prerender\` config, so in production the path will be a 404.`),{context:h,params:l,request:s}),new Response("Not Found",{status:404,statusText:"Not Found"});f=!0}}let v=ot(e.routeDiscovery.manifestPath,y);if(w.pathname===v)try{return await Ot(e,r,w)}catch(R){return p(R),new Response("Unknown Server Error",{status:500})}let m=G(r,g,e.basename);m&&m.length>0&&Object.assign(l,m[0].params);let c;if(w.pathname.endsWith(".data")){let R=new URL(s.url);R.pathname=g;let S=G(r,R.pathname,e.basename);c=await It(n,e,o,s,R,h,p),ie(c)&&(c=ye(c,s,e,n)),e.entry.module.handleDataRequest&&(c=await e.entry.module.handleDataRequest(c,{context:h,params:S?S[0].params:{},request:s}),ie(c)&&(c=ye(c,s,e,n)))}else if(!f&&m&&m[m.length-1].route.module.default==null&&m[m.length-1].route.module.ErrorBoundary==null)c=await Mt(n,e,o,m.slice(-1)[0].route.id,s,h,p);else{let{pathname:R}=w,S;e.unstable_getCriticalCss?S=await e.unstable_getCriticalCss({pathname:R}):t==="development"&&W()?.getCriticalCss&&(S=await W()?.getCriticalCss?.(R)),c=await Bt(n,e,o,s,h,p,f,S)}return s.method==="HEAD"?new Response(null,{headers:c.headers,status:c.status,statusText:c.statusText}):c};return e.entry.module.unstable_instrumentations&&(u=Ge(u,e.entry.module.unstable_instrumentations.map(s=>s.handler).filter(Boolean))),{routes:r,dataRoutes:a,serverMode:n,staticHandler:o,errorHandler:d,requestHandler:u}}var sr=(e,t)=>{let r,a,n,o,d,u;return async function(i,l){if(r=typeof e=="function"?await e():e,typeof e=="function"){let h=we(r,t);a=h.routes,n=h.serverMode,o=h.staticHandler,d=h.errorHandler,u=h.requestHandler}else if(!a||!n||!o||!d||!u){let h=we(r,t);a=h.routes,n=h.serverMode,o=h.staticHandler,d=h.errorHandler,u=h.requestHandler}return u(i,l)}};async function Ot(e,t,r){if(e.assets.version!==r.searchParams.get("version"))return new Response(null,{status:204,headers:{"X-Remix-Reload-Document":"true"}});let a={};if(r.searchParams.has("paths")){let n=new Set;(r.searchParams.get("paths")||"").split(",").filter(Boolean).forEach(u=>{u.startsWith("/")||(u=`/${u}`);let s=u.split("/").slice(1);s.forEach((i,l)=>{let h=s.slice(0,l+1).join("/");n.add(`/${h}`)})});for(let u of n){let s=G(t,u,e.basename);if(s)for(let i of s){let l=i.route.id,h=e.assets.routes[l];h&&(a[l]=h)}}return Response.json(a,{headers:{"Cache-Control":"public, max-age=31536000, immutable"}})}return new Response("Invalid Request",{status:400})}async function It(e,t,r,a,n,o,d){return a.method!=="GET"?await Nt(t,e,r,a,n,o,d):await Ut(t,e,r,a,n,o,d)}async function Bt(e,t,r,a,n,o,d,u){try{if(a.method==="POST")try{Oe(a.headers,Array.isArray(t.allowedActionOrigins)?t.allowedActionOrigins:[])}catch(l){return o(l),new Response("Bad Request",{status:400})}let i=await r.query(a,{requestContext:n,generateMiddlewareResponse:t.future.v8_middleware?async l=>{try{let h=await l(a);return U(h)||(h=await s(h,d)),h}catch(h){return o(h),new Response(null,{status:500})}}:void 0});return U(i)||(i=await s(i,d)),i}catch(i){return o(i),new Response(null,{status:500})}async function s(i,l){let h=ne(i,t);if(Ie.has(i.statusCode))return new Response(null,{status:i.statusCode,headers:h});i.errors&&(Object.values(i.errors).forEach(f=>{(!P(f)||f.error)&&o(f)}),i.errors=z(i.errors,e));let p={loaderData:i.loaderData,actionData:i.actionData,errors:he(i.errors,e)},w={basename:t.basename,future:t.future,routeDiscovery:t.routeDiscovery,ssr:t.ssr,isSpaMode:l},y={manifest:t.assets,routeModules:xt(t.routes),staticHandlerContext:i,criticalCss:u,serverHandoffString:me({...w,criticalCss:u}),serverHandoffStream:Y(p,a.signal,t.entry.module.streamTimeout,e),renderMeta:{},future:t.future,ssr:t.ssr,routeDiscovery:t.routeDiscovery,isSpaMode:l,serializeError:f=>Te(f,e)},g=t.entry.module.default;try{return await g(a,i.statusCode,h,y,n)}catch(f){o(f);let v=f;if(U(f))try{let c=await jt(f);v=new O(f.status,f.statusText,c)}catch{}i=ut(r.dataRoutes,i,v),i.errors&&(i.errors=z(i.errors,e));let m={loaderData:i.loaderData,actionData:i.actionData,errors:he(i.errors,e)};y={...y,staticHandlerContext:i,serverHandoffString:me(w),serverHandoffStream:Y(m,a.signal,t.entry.module.streamTimeout,e),renderMeta:{}};try{return await g(a,i.statusCode,h,y,n)}catch(c){return o(c),q(c,e)}}}}async function Mt(e,t,r,a,n,o,d){try{let i=await r.queryRoute(n,{routeId:a,requestContext:o,generateMiddlewareResponse:t.future.v8_middleware?async l=>{try{let h=await l(n);return u(h)}catch(h){return s(h)}}:void 0});return u(i)}catch(i){return s(i)}function u(i){return U(i)?i:typeof i=="string"?new Response(i):Response.json(i)}function s(i){if(U(i))return i;if(P(i))return d(i),$t(i,e);if(i instanceof Error&&i.message==="Expected a response from queryRoute"){let l=new Error("Expected a Response to be returned from resource route handler");return d(l),q(l,e)}return d(i),q(i,e)}}function $t(e,t){return Response.json(Te(e.error||new Error("Unexpected Server Error"),t),{status:e.status,statusText:e.statusText})}function q(e,t){let r="Unexpected Server Error";return t!=="production"&&(r+=`
|
|
2
2
|
|
|
3
3
|
${String(e)}`),new Response(r,{status:500,headers:{"Content-Type":"text/plain"}})}function jt(e){let t=e.headers.get("Content-Type");return t&&/\bapplication\/json\b/.test(t)?e.body==null?null:e.json():e.text()}function J(e){return`__flash_${e}__`}var Be=(e={},t="")=>{let r=new Map(Object.entries(e));return{get id(){return t},get data(){return Object.fromEntries(r)},has(a){return r.has(a)||r.has(J(a))},get(a){if(r.has(a))return r.get(a);let n=J(a);if(r.has(n)){let o=r.get(n);return r.delete(n),o}},set(a,n){r.set(a,n)},flash(a,n){r.set(J(a),n)},unset(a){r.delete(a)}}},or=e=>e!=null&&typeof e.id=="string"&&typeof e.data<"u"&&typeof e.has=="function"&&typeof e.get=="function"&&typeof e.set=="function"&&typeof e.flash=="function"&&typeof e.unset=="function";function zt({cookie:e,createData:t,readData:r,updateData:a,deleteData:n}){let o=He(e)?e:De(e?.name||"__session",e);return Me(o),{async getSession(d,u){let s=d&&await o.parse(d,u),i=s&&await r(s);return Be(i||{},s||"")},async commitSession(d,u){let{id:s,data:i}=d,l=u?.maxAge!=null?new Date(Date.now()+u.maxAge*1e3):u?.expires!=null?u.expires:o.expires;return s?await a(s,i,l):s=await t(i,l),o.serialize(s,u)},async destroySession(d,u){return await n(d.id),o.serialize("",{...u,maxAge:void 0,expires:new Date(0)})}}}function Me(e){_e(e.isSigned,`The "${e.name}" cookie is not signed, but session cookies should be signed to prevent tampering on the client before they are sent back to the server. See https://reactrouter.com/explanation/sessions-and-cookies#signing-cookies for more information.`)}function ir({cookie:e}={}){let t=He(e)?e:De(e?.name||"__session",e);return Me(t),{async getSession(r,a){return Be(r&&await t.parse(r,a)||{})},async commitSession(r,a){let n=await t.serialize(r.data,a);if(n.length>4096)throw new Error("Cookie length will exceed browser maximum. Length: "+n.length);return n},async destroySession(r,a){return t.serialize("",{...a,maxAge:void 0,expires:new Date(0)})}}}function lr({cookie:e}={}){let t=new Map;return zt({cookie:e,async createData(r,a){let n=Math.random().toString(36).substring(2,10);return t.set(n,{data:r,expires:a}),n},async readData(r){if(t.has(r)){let{data:a,expires:n}=t.get(r);if(!n||n>new Date)return a;n&&t.delete(r)}return null},async updateData(r,a,n){t.set(r,{data:a,expires:n})},async deleteData(r){t.delete(r)}})}function ur(e,...t){let r=t[0],a=qt(e).replace(/\/:([\w-]+)(\?)?/g,(n,o,d)=>{const u=d===void 0,s=r?.[o];if(u&&s===void 0)throw new Error(`Path '${e}' requires param '${o}' but it was not provided`);return s===void 0?"":"/"+s});if(e.endsWith("*")){const n=r?.["*"];n!==void 0&&(a+="/"+n)}return a||"/"}function qt(e){let t=e.length-1,r=e[t];if(r!=="*"&&r!=="/")return e;for(t--;t>=0&&e[t]==="/";t--);return e.slice(0,t+1)}var Z=new TextEncoder,ge="</body></html>";function Re(e){let t=new TextDecoder,r,a=new Promise(s=>r=s),n=!1,o=[],d=null;function u(s){for(let i of o){let l=t.decode(i,{stream:!0});l.endsWith(ge)&&(l=l.slice(0,-ge.length)),s.enqueue(Z.encode(l))}o.length=0,d=null}return new TransformStream({transform(s,i){o.push(s),!d&&(d=setTimeout(async()=>{u(i),n||(n=!0,Vt(e,i).catch(l=>i.error(l)).then(r))},0))},async flush(s){await a,d&&(clearTimeout(d),u(s)),s.enqueue(Z.encode("</body></html>"))}})}async function Vt(e,t){let r=new TextDecoder("utf-8",{fatal:!0});const a=e.getReader();try{let o;for(;(o=await a.read())&&!o.done;){const d=o.value;try{X(JSON.stringify(r.decode(d,{stream:!0})),t)}catch{let s=JSON.stringify(btoa(String.fromCodePoint(...d)));X(`Uint8Array.from(atob(${s}), m => m.codePointAt(0))`,t)}}}finally{a.releaseLock()}let n=r.decode();n.length&&X(JSON.stringify(n),t)}function X(e,t){t.enqueue(Z.encode(`<script>${Wt(`(self.__FLIGHT_DATA||=[]).push(${e})`)}<\/script>`))}function Wt(e){return e.replace(/<!--/g,"<\\!--").replace(/<\/(script)/gi,"</\\$1")}var Jt=class extends A.Component{constructor(e){super(e),this.state={error:null,location:e.location}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location?{error:null,location:e.location}:{error:t.error,location:t.location}}render(){return this.state.error?A.createElement($e,{error:this.state.error,renderAppShell:!0}):this.props.children}};function Se({renderAppShell:e,title:t,children:r}){return e?A.createElement("html",{lang:"en"},A.createElement("head",null,A.createElement("meta",{charSet:"utf-8"}),A.createElement("meta",{name:"viewport",content:"width=device-width,initial-scale=1,viewport-fit=cover"}),A.createElement("title",null,t)),A.createElement("body",null,A.createElement("main",{style:{fontFamily:"system-ui, sans-serif",padding:"2rem"}},r))):r}function $e({error:e,renderAppShell:t}){console.error(e);let r=A.createElement("script",{dangerouslySetInnerHTML:{__html:`
|
|
4
4
|
console.log(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as E,s as x,i as P,v as $,p as S,A as b,a as C,e as N,m as O,_ as g,b as A,c as I,d as L,f as J,T as f,g as F,C as R,h as M,j as y,k as B,l as _,n as j,q as Z}from"./index-
|
|
1
|
+
import{o as E,s as x,i as P,v as $,p as S,A as b,a as C,e as N,m as O,_ as g,b as A,c as I,d as L,f as J,T as f,g as F,C as R,h as M,j as y,k as B,l as _,n as j,q as Z}from"./index-bnjI3CWS.js";import{B as W,i as q,a as H,b as K,c as V}from"./index-CjXv6G8C.js";var z={};j(z,{BaseToolkit:()=>G,DynamicStructuredTool:()=>k,DynamicTool:()=>D,StructuredTool:()=>T,Tool:()=>w,ToolInputParsingException:()=>f,isLangChainTool:()=>V,isRunnableToolLike:()=>K,isStructuredTool:()=>H,isStructuredToolParams:()=>q,tool:()=>Q});var T=class extends W{extras;returnDirect=!1;verboseParsingErrors=!1;get lc_namespace(){return["langchain","tools"]}responseFormat="content";defaultConfig;constructor(t){super(t??{}),this.verboseParsingErrors=t?.verboseParsingErrors??this.verboseParsingErrors,this.responseFormat=t?.responseFormat??this.responseFormat,this.defaultConfig=t?.defaultConfig??this.defaultConfig,this.metadata=t?.metadata??this.metadata,this.extras=t?.extras??this.extras}async invoke(t,e){let a,s=N(O(this.defaultConfig,e));return g(t)?(a=t.args,s={...s,toolCall:t}):a=t,this.call(a,s)}async call(t,e,a){const s=g(t)?t.args:t;let u;if(A(this.schema))try{u=await I(this.schema,s)}catch(c){let o="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(o=`${o}
|
|
2
2
|
Details: ${c.message}`),L(c)&&(o=`${o}
|
|
3
3
|
|
|
4
4
|
${J(c)}`),new f(o,JSON.stringify(t))}else{const c=F(s,this.schema);if(!c.valid){let o="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(o=`${o}
|