@decocms/mesh 2.142.0 → 2.143.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/assets/{AlertCircle-Zx531KAn.js → AlertCircle-C33JEKEq.js} +1 -1
- package/dist/client/assets/{AlignLeft-CGBbKVHK.js → AlignLeft-REGjRwBJ.js} +1 -1
- package/dist/client/assets/{ArrowDown-BX-IIy5w.js → ArrowDown-aOFcd1rD.js} +1 -1
- package/dist/client/assets/{ArrowLeft-D4dc0UBb.js → ArrowLeft-6J-waWbb.js} +1 -1
- package/dist/client/assets/{ArrowUp-dcB4aDLZ.js → ArrowUp-DHX-mOU2.js} +1 -1
- package/dist/client/assets/{Check-DXoRcZpn.js → Check-BQYRNFNB.js} +1 -1
- package/dist/client/assets/{CheckCircle-BP8hgPfe.js → CheckCircle-BspahUp0.js} +1 -1
- package/dist/client/assets/{CheckDone01-ca6APAHc.js → CheckDone01-CKFgRwhA.js} +1 -1
- package/dist/client/assets/{CheckVerified02-C_Ewexdw.js → CheckVerified02-BNn37Me9.js} +1 -1
- package/dist/client/assets/{ChevronDown-D04Buvau.js → ChevronDown-1tcTabrX.js} +1 -1
- package/dist/client/assets/{ChevronLeft-C8cqrSli.js → ChevronLeft-Bj3ue1eK.js} +1 -1
- package/dist/client/assets/{ChevronRight-CkAAxLvD.js → ChevronRight-DhQpCpKK.js} +1 -1
- package/dist/client/assets/{Clock-DwwOuQI4.js → Clock-C30Ff6vt.js} +1 -1
- package/dist/client/assets/{Code01-BLJKgev-.js → Code01-CycseZkv.js} +1 -1
- package/dist/client/assets/{Container-CSl1es2V.js → Container-BU5QPEDW.js} +1 -1
- package/dist/client/assets/{Copy01-B4eRdmVC.js → Copy01-Bub_iK1k.js} +1 -1
- package/dist/client/assets/{Dataflow03-SiitV-oV.js → Dataflow03-CP3uRpJJ.js} +1 -1
- package/dist/client/assets/{DotsHorizontal-DzRIJPXY.js → DotsHorizontal-BCdQOVe0.js} +1 -1
- package/dist/client/assets/{DotsVertical-B6bpYQLL.js → DotsVertical-BSoYRiIr.js} +1 -1
- package/dist/client/assets/{Download01-DDnPOFFT.js → Download01-DYjfgXnI.js} +1 -1
- package/dist/client/assets/{Edit01-CoWrVJPj.js → Edit01-BIUDv_si.js} +1 -1
- package/dist/client/assets/{Edit05-BUQBpzoO.js → Edit05-B3UbFiYN.js} +1 -1
- package/dist/client/assets/{Eye-DNSEDYe8.js → Eye-CJ0GO8QL.js} +1 -1
- package/dist/client/assets/{File02-BXS3LEA8.js → File02-CJJT1Lsy.js} +1 -1
- package/dist/client/assets/{File06-h52WT7aG.js → File06-BzTcP1fd.js} +1 -1
- package/dist/client/assets/{FilterLines-CsjQLyQm.js → FilterLines-CgDlJMHC.js} +1 -1
- package/dist/client/assets/{Globe01-CSEqx1SJ.js → Globe01-pQgT6Pgy.js} +1 -1
- package/dist/client/assets/{Globe02-YyAAQROb.js → Globe02-DK-nDQII.js} +1 -1
- package/dist/client/assets/{Grid01-Ju9gLjOW.js → Grid01-Cv6nD-bp.js} +1 -1
- package/dist/client/assets/{Hash02-TG1GIkeV.js → Hash02-2uEkY5na.js} +1 -1
- package/dist/client/assets/{Home02-TzIRlDMK.js → Home02-Cuswvl5N.js} +1 -1
- package/dist/client/assets/{Image01-PGP5Jz22.js → Image01-_ugWt3d2.js} +1 -1
- package/dist/client/assets/{Inbox01-CjHNjCjB.js → Inbox01-B0oK7RI9.js} +1 -1
- package/dist/client/assets/{InfoCircle-CVW6wgFf.js → InfoCircle-WmJgMXWS.js} +1 -1
- package/dist/client/assets/{Key01-9PzzeBlc.js → Key01-DW6fqfWo.js} +1 -1
- package/dist/client/assets/{LayersTwo01-XOG8qRvr.js → LayersTwo01-BcA1LBal.js} +1 -1
- package/dist/client/assets/{LayoutLeft-BcthWHLG.js → LayoutLeft-B9EmI1if.js} +1 -1
- package/dist/client/assets/{Link01-2BHrruNj.js → Link01-BnhQ6HaU.js} +1 -1
- package/dist/client/assets/{LinkExternal01-CxAidvQ-.js → LinkExternal01-DYtAatm2.js} +1 -1
- package/dist/client/assets/{List-Bj4VjFJ6.js → List-BFACCNRk.js} +1 -1
- package/dist/client/assets/{Loading01-DF5pxnn8.js → Loading01-B8ixav8o.js} +1 -1
- package/dist/client/assets/{Lock01-CPqKu_Mb.js → Lock01-BOdqI63W.js} +1 -1
- package/dist/client/assets/{Play-CUMfSU-t.js → Play-CEbM08S_.js} +1 -1
- package/dist/client/assets/{Plus-CEtl-Eq7.js → Plus-D4t5EG83.js} +1 -1
- package/dist/client/assets/{RefreshCcw01-Bcbx9L0j.js → RefreshCcw01-CCgnRJd5.js} +1 -1
- package/dist/client/assets/{Save01-BtoFb1Cg.js → Save01-DynhEPAB.js} +1 -1
- package/dist/client/assets/{SearchMd-u1QGwQkU.js → SearchMd-B8KV3nui.js} +1 -1
- package/dist/client/assets/{Settings01-C1oZxROY.js → Settings01-BdGMn6lJ.js} +1 -1
- package/dist/client/assets/{Shield01-DoZAYqqP.js → Shield01-CpBrW2km.js} +1 -1
- package/dist/client/assets/{Terminal-DobKmqGm.js → Terminal-fmXnrrqs.js} +1 -1
- package/dist/client/assets/{Trash01-c47UOodj.js → Trash01-_Tzcparm.js} +1 -1
- package/dist/client/assets/{Upload01-C3K15n1N.js → Upload01-DtqvlWBL.js} +1 -1
- package/dist/client/assets/{Users03-Z0r1cCGf.js → Users03-Z1ByU7gs.js} +1 -1
- package/dist/client/assets/{X-CT_P09q2.js → X-DUw9p4mH.js} +1 -1
- package/dist/client/assets/{XCircle-BNAlXeL2.js → XCircle-B8o5NZjk.js} +1 -1
- package/dist/client/assets/{XClose-BIpOBHWg.js → XClose-DuxEOCv_.js} +1 -1
- package/dist/client/assets/{Zap-BYVebEYM.js → Zap-Bfu3dNEc.js} +1 -1
- package/dist/client/assets/{agent-connections-preview-B76ZYrs2.js → agent-connections-preview-K7AOWu8a.js} +1 -1
- package/dist/client/assets/agent-detail-C94NpUEI.js +2 -0
- package/dist/client/assets/{agents-avEyjtsq.js → agents-BSKLOaMu.js} +1 -1
- package/dist/client/assets/{alert-dialog-DXvhyacf.js → alert-dialog-DaXpWdw0.js} +2 -2
- package/dist/client/assets/{auth-catchall-FvylLzD9.js → auth-catchall-COBLdahK.js} +1 -1
- package/dist/client/assets/{avatar-DGDgNwX-.js → avatar-Ci3kAkCl.js} +1 -1
- package/dist/client/assets/{badge-DtcA_2rB.js → badge-Bjvc5XIA.js} +1 -1
- package/dist/client/assets/{binder-CaZ6b20X.js → binder-D8s-h8oe.js} +1 -1
- package/dist/client/assets/{breadcrumb-DPLSdTx1.js → breadcrumb-mjrAJ44V.js} +1 -1
- package/dist/client/assets/{card-Bz05CYUR.js → card-DFLwXVkm.js} +1 -1
- package/dist/client/assets/{chart-DYrz9LTc.js → chart-qGX5OGhH.js} +1 -1
- package/dist/client/assets/{checkbox-JiwlvimE.js → checkbox-YMBbuKOZ.js} +1 -1
- package/dist/client/assets/{circle-alert-CtnOwoV2.js → circle-alert-DGdpKWGk.js} +1 -1
- package/dist/client/assets/collapsible-CxJfsyMO.js +23 -0
- package/dist/client/assets/{collection-detail-CBGjxXPP.js → collection-detail-DVcCqR3z.js} +2 -2
- package/dist/client/assets/{collection-display-button-CXc-TgEJ.js → collection-display-button-BxbTqYSq.js} +1 -1
- package/dist/client/assets/{collection-search-Dl5JvsI0.js → collection-search-C_6fMPfN.js} +1 -1
- package/dist/client/assets/{collection-tab-BlE4CTwD.js → collection-tab-Bh2VOYGp.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-eN4uWzLn.js → collection-table-wrapper-COmJ-B8Q.js} +1 -1
- package/dist/client/assets/{collection-tabs-CK4RWFd-.js → collection-tabs-DQrbo9Ay.js} +1 -1
- package/dist/client/assets/{command-BzF9LDzy.js → command-B1HOWPFt.js} +1 -1
- package/dist/client/assets/{connect-B1CrEofK.js → connect-CpLI2s8J.js} +1 -1
- package/dist/client/assets/{connection-card-CC22E-3G.js → connection-card-JlUaDjOw.js} +1 -1
- package/dist/client/assets/connection-detail-C_SdT5ck.js +1 -0
- package/dist/client/assets/{connection-status-B1K3m1_w.js → connection-status-8Ht5iRaJ.js} +1 -1
- package/dist/client/assets/{connections-BuggzhbD.js → connections-DeEqc0GM.js} +1 -1
- package/dist/client/assets/constants-BSa33005.js +1 -0
- package/dist/client/assets/{constants-CRvMLa9p.js → constants-Bbw6jN_V.js} +1 -1
- package/dist/client/assets/{create-organization-dialog-DIZjTiis.js → create-organization-dialog-V-msF1Jz.js} +1 -1
- package/dist/client/assets/{create-project-dialog-Dut0dyR9.js → create-project-dialog-DaBc1e0V.js} +1 -1
- package/dist/client/assets/{danger-Dare7pC6.js → danger-BTw0q1dL.js} +1 -1
- package/dist/client/assets/{danger-zone-_BODcOmd.js → danger-zone-CROdw5xZ.js} +1 -1
- package/dist/client/assets/{decopilot-events-bTg09qGr.js → decopilot-events-CkaAIkUJ.js} +1 -1
- package/dist/client/assets/{dependencies-BT9TgTWZ.js → dependencies-mZgEmBs1.js} +1 -1
- package/dist/client/assets/{dialog-DSCIUn11.js → dialog-DP7DY4yr.js} +1 -1
- package/dist/client/assets/dropdown-menu-C6kuYZ7_.js +1 -0
- package/dist/client/assets/{dynamic-plugin-layout-CXCsSgRX.js → dynamic-plugin-layout-CjkQri2q.js} +1 -1
- package/dist/client/assets/{editable-task-title-DKlfwqLm.js → editable-task-title-C0JEoPnJ.js} +1 -1
- package/dist/client/assets/{empty-state-C64F3xDv.js → empty-state-DClv5r7C.js} +1 -1
- package/dist/client/assets/{env-vars-editor-ClFO22Eh.js → env-vars-editor-zacGIDRP.js} +1 -1
- package/dist/client/assets/{extract-connection-data-CrY_sL6W.js → extract-connection-data-BZQA712X.js} +1 -1
- package/dist/client/assets/{file-browser-DSHBHgjG.js → file-browser-BMpcvnxm.js} +2 -2
- package/dist/client/assets/{form-CVLoDgzL.js → form-CCy4OYZh.js} +1 -1
- package/dist/client/assets/{general-CYKgldaV.js → general-DsCslUFr.js} +1 -1
- package/dist/client/assets/{grid-view-DvrbtUer.js → grid-view-BJN_C_nJ.js} +1 -1
- package/dist/client/assets/{home-BuzXHaZj.js → home-ZNtjrtnf.js} +1 -1
- package/dist/client/assets/{icon-picker-5LH0UiWF.js → icon-picker-DBuQoDjt.js} +1 -1
- package/dist/client/assets/index-4jzw9CYj.js +25 -0
- package/dist/client/assets/{index-jBnBTTB0.js → index-5xKQyQZE.js} +1 -1
- package/dist/client/assets/{index-BCf_VMXY.js → index-BwnxEimb.js} +1 -1
- package/dist/client/assets/{index-6Z25-w5a.js → index-CEKEKIun.js} +1 -1
- package/dist/client/assets/{index-CoyJj2VR.js → index-CdiDGOKq.js} +50 -50
- package/dist/client/assets/{index-A_CnuSis.js → index-CuGOLHld.js} +1 -1
- package/dist/client/assets/{index-Co1xrsbj.js → index-Dig2D0kL.js} +1 -1
- package/dist/client/assets/{index-B7Bu7nQ7.js → index-Dw9bGcxk.js} +1 -1
- package/dist/client/assets/{index-KAycGEnT.js → index-WgRy4XEz.js} +28 -28
- package/dist/client/assets/{infiniteQueryObserver-DctmDFEe.js → infiniteQueryObserver-6Sv1mY48.js} +1 -1
- package/dist/client/assets/{input-s8rw5Kfa.js → input-BJJ-HZyT.js} +1 -1
- package/dist/client/assets/{integration-icon-BAlg7muO.js → integration-icon-R2eYJYHC.js} +1 -1
- package/dist/client/assets/{label-lqq4AMOf.js → label-meKA8koQ.js} +1 -1
- package/dist/client/assets/{layout-BdJDt40T.js → layout-CIWWZ1ER.js} +1 -1
- package/dist/client/assets/{layout-CaxeqVAE.js → layout-Cny1vUWb.js} +1 -1
- package/dist/client/assets/{localstorage-keys-DK1Id_ip.js → localstorage-keys-BUkugh6_.js} +1 -1
- package/dist/client/assets/{login--Bk_liKs.js → login-Dov4Ln-t.js} +1 -1
- package/dist/client/assets/{markdown-HCjujTl2.js → markdown-DdHbXzu-.js} +1 -1
- package/dist/client/assets/{mcp-app-renderer-Bconp3w4.js → mcp-app-renderer-PyxYtSmQ.js} +1 -1
- package/dist/client/assets/{mcp-oauth-DcSxwlYK.js → mcp-oauth-BUdDcINO.js} +1 -1
- package/dist/client/assets/{mcp-server-card-B0UwO4c6.js → mcp-server-card-wnDYG_0O.js} +1 -1
- package/dist/client/assets/{mcp-server-detail-zb689o0t.js → mcp-server-detail-CAZe7uN6.js} +2 -2
- package/dist/client/assets/{members-A9Co33Fe.js → members-H_aHt8EH.js} +1 -1
- package/dist/client/assets/{monaco-editor-BGkR3-IA.js → monaco-editor-CYn377dR.js} +4 -4
- package/dist/client/assets/{monitoring-DtdfvOM5.js → monitoring-IVWnDVEz.js} +1 -1
- package/dist/client/assets/{monitoring-dashboard-edit-GWWMfh0m.js → monitoring-dashboard-edit--p_6gE6M.js} +1 -1
- package/dist/client/assets/{monitoring-dashboard-view-Cm896dO-.js → monitoring-dashboard-view-pfH_ninA.js} +2 -2
- package/dist/client/assets/{oauth-callback-BSGOfJmL.js → oauth-callback-BBfWFUEO.js} +1 -1
- package/dist/client/assets/{page-PU0vqAHP.js → page-CcB9pt8_.js} +1 -1
- package/dist/client/assets/page-CsXX8k6j.js +1 -0
- package/dist/client/assets/{plugin-empty-state-CNAE295F.js → plugin-empty-state-BXGv0GDx.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-BdIJtKhO.js → plugin-empty-state-PHb3h5Mu.js} +1 -1
- package/dist/client/assets/{plugin-header-C3hBljo3.js → plugin-header-BbwqgGs3.js} +1 -1
- package/dist/client/assets/{plugin-header-BO6BGJC7.js → plugin-header-Bn5QWmGt.js} +1 -1
- package/dist/client/assets/plugins-rCmASNpc.js +1 -0
- package/dist/client/assets/{popover-DSO1tjgf.js → popover-BSwvSWKq.js} +1 -1
- package/dist/client/assets/{project-app-view-DEVHaVoM.js → project-app-view-CU4S5SVV.js} +1 -1
- package/dist/client/assets/{project-layout-BZqAcTC3.js → project-layout-D2s_-ed-.js} +1 -1
- package/dist/client/assets/{project-plugins-DkIXV878.js → project-plugins-CFsL8fat.js} +1 -1
- package/dist/client/assets/{projects-list-DD9bayAR.js → projects-list-BwshQdVA.js} +1 -1
- package/dist/client/assets/{readme-viewer-DEgSduvy.js → readme-viewer-BKWT3e1y.js} +1 -1
- package/dist/client/assets/{registry-layout-BbOZb50w.js → registry-layout-DVHyhv6u.js} +1 -1
- package/dist/client/assets/{registry-utils-BJRD11-o.js → registry-utils-DwrfZsML.js} +1 -1
- package/dist/client/assets/{reports-layout-0fvVXIA9.js → reports-layout-CRWz25vV.js} +1 -1
- package/dist/client/assets/{reset-password-BBFIx6IU.js → reset-password-DwDCI2Lt.js} +1 -1
- package/dist/client/assets/{resizable-FDnvuXI8.js → resizable-CuAJwpCE.js} +1 -1
- package/dist/client/assets/{save-actions-BrexEzhw.js → save-actions-DSOaJsEB.js} +1 -1
- package/dist/client/assets/{scroll-area-BoIKmmj_.js → scroll-area-DFSZEFGu.js} +1 -1
- package/dist/client/assets/{select-XWfX294J.js → select-D5UCIms-.js} +1 -1
- package/dist/client/assets/shell-layout-Bi6EGRx-.js +3 -0
- package/dist/client/assets/{sidebar-settings-CYnkTQwX.js → sidebar-settings-Ens_v1-3.js} +1 -1
- package/dist/client/assets/{skeleton-l9u4bmPQ.js → skeleton-DJ9ksHdo.js} +1 -1
- package/dist/client/assets/{spinner-CQhhuHCn.js → spinner-C_jBik6U.js} +1 -1
- package/dist/client/assets/{store-invite-QKjyJOdx.js → store-invite-B4x6yCxM.js} +1 -1
- package/dist/client/assets/{switch-BTH5DtNC.js → switch-CHDqnzpR.js} +1 -1
- package/dist/client/assets/{table-CObvzzoK.js → table-KeNwDMbd.js} +1 -1
- package/dist/client/assets/{tabs-B62zcrrU.js → tabs-BWF5GtqN.js} +1 -1
- package/dist/client/assets/tasks-B4Nf2WMJ.js +1 -0
- package/dist/client/assets/tasks-panel-F9MkKd8u.js +1 -0
- package/dist/client/assets/{textarea-CKFVaVym.js → textarea-BbLT_f8Z.js} +1 -1
- package/dist/client/assets/{time-range-picker-C2BX3Ytm.js → time-range-picker-D8n6QptR.js} +1 -1
- package/dist/client/assets/{toggle-group-BWymC1w6.js → toggle-group-CGeB8kMK.js} +1 -1
- package/dist/client/assets/{tools-list-CBKDjlC9.js → tools-list-B15drLS3.js} +1 -1
- package/dist/client/assets/{tooltip-BD36KVkP.js → tooltip-Babiaq0d.js} +1 -1
- package/dist/client/assets/{topbar-portal-CyJ7_aXv.js → topbar-portal-Dp4BFYej.js} +1 -1
- package/dist/client/assets/{types-CgRNzZIg.js → types-BJf49Mfd.js} +1 -1
- package/dist/client/assets/{use-binding-eAl0-ngZ.js → use-binding-CAoXPeYp.js} +1 -1
- package/dist/client/assets/{use-collections-ROKIiOzV.js → use-collections-B-x23mni.js} +1 -1
- package/dist/client/assets/{use-connection-DWTVYLGI.js → use-connection-CfeJyAqX.js} +1 -1
- package/dist/client/assets/{use-copy-Cxp-hpbY.js → use-copy-CMFYl2Ga.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-CWXwWPev.js → use-create-virtual-mcp-BQ2vLOYt.js} +1 -1
- package/dist/client/assets/{use-install-from-registry-CzqEIQq2.js → use-install-from-registry-D80VT6Ub.js} +1 -1
- package/dist/client/assets/{use-list-state-cW6KZE3t.js → use-list-state-D-tKxlpi.js} +1 -1
- package/dist/client/assets/{use-llm-D0wV35M9.js → use-llm-BMRIZw-b.js} +1 -1
- package/dist/client/assets/{use-mcp-resources-BTKxmEpv.js → use-mcp-resources-7Fl5_HS_.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-DkmUq8XI.js → use-mcp-tools-Bj_Ri2bf.js} +1 -1
- package/dist/client/assets/{use-members-Bksy3767.js → use-members-TEDVnI8Z.js} +1 -1
- package/dist/client/assets/{use-mobile-C7Xn-ZVB.js → use-mobile-PmmG7UNI.js} +1 -1
- package/dist/client/assets/{use-project-BZjOe5ok.js → use-project-IWwy_h7S.js} +1 -1
- package/dist/client/assets/{use-settings-modal-BpLqrFwi.js → use-settings-modal-C4b8mb1A.js} +1 -1
- package/dist/client/assets/{use-view-mode-DxCF7P6S.js → use-view-mode-DT0UZS0w.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-DrNWNgvb.js → use-virtual-mcp-DXNTpzcv.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-D2ydKX7z.js +1 -0
- package/dist/client/assets/{useMutation-Ctk5b8uR.js → useMutation-DmgIjz65.js} +1 -1
- package/dist/client/assets/useQuery-C48kdbmo.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-Dk_AfHIX.js +1 -0
- package/dist/client/assets/{user-BU3jjBpz.js → user-DC5rs3GH.js} +1 -1
- package/dist/client/assets/{workflow-BNkb2XNC.js → workflow-DaR6d6tq.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +181 -181
- package/dist/server/migrate.js +1 -1
- package/dist/server/server.js +167 -167
- package/package.json +1 -1
- package/dist/client/assets/agent-detail-ean34cyZ.js +0 -2
- package/dist/client/assets/collapsible-Dz6kdDQx.js +0 -23
- package/dist/client/assets/connection-detail-B-ICGeJ4.js +0 -1
- package/dist/client/assets/constants-I25hmjxi.js +0 -1
- package/dist/client/assets/dropdown-menu-DMgECNP1.js +0 -1
- package/dist/client/assets/index-Cg5VAr11.js +0 -25
- package/dist/client/assets/page-BjfHsKND.js +0 -1
- package/dist/client/assets/plugins-BttmmeIz.js +0 -1
- package/dist/client/assets/shell-layout-CfqRN6gC.js +0 -3
- package/dist/client/assets/tasks-DBMv6koR.js +0 -1
- package/dist/client/assets/tasks-panel-jUSk_q_P.js +0 -1
- package/dist/client/assets/useInfiniteQuery-Clfr9I7T.js +0 -1
- package/dist/client/assets/useQuery-DCrAUBx5.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-CG43fx0v.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as d,v as n,j as c,
|
|
1
|
+
import{c as d,v as n,j as c,ak as l,al as m}from"./index-WgRy4XEz.js";import{i as b}from"./Check-BQYRNFNB.js";function x(o){const e=d.c(9);let r,a;e[0]!==o?({className:r,...a}=o,e[0]=o,e[1]=r,e[2]=a):(r=e[1],a=e[2]);let i;e[3]!==r?(i=n("peer border-foreground dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",r),e[3]=r,e[4]=i):i=e[4];let t;e[5]===Symbol.for("react.memo_cache_sentinel")?(t=c.jsx(m,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-primary-foreground transition-none",children:c.jsx(b,{className:"size-3.5"})}),e[5]=t):t=e[5];let s;return e[6]!==a||e[7]!==i?(s=c.jsx(l,{"data-slot":"checkbox",className:i,...a,children:t}),e[6]=a,e[7]=i,e[8]=s):s=e[8],s}export{x as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c}from"./index-
|
|
1
|
+
import{r as c}from"./index-WgRy4XEz.js";const h=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),y=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,r,o)=>o?o.toUpperCase():r.toLowerCase()),i=t=>{const e=y(t);return e.charAt(0).toUpperCase()+e.slice(1)},l=(...t)=>t.filter((e,r,o)=>!!e&&e.trim()!==""&&o.indexOf(e)===r).join(" ").trim(),f=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};var k={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const w=c.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:s="",children:a,iconNode:p,...n},d)=>c.createElement("svg",{ref:d,...k,width:e,height:e,stroke:t,strokeWidth:o?Number(r)*24/Number(e):r,className:l("lucide",s),...!a&&!f(n)&&{"aria-hidden":"true"},...n},[...p.map(([m,C])=>c.createElement(m,C)),...Array.isArray(a)?a:[a]]));const u=(t,e)=>{const r=c.forwardRef(({className:o,...s},a)=>c.createElement(w,{ref:a,iconNode:e,className:l(`lucide-${h(i(t))}`,`lucide-${t}`,o),...s}));return r.displayName=i(t),r};const g=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],b=u("check",g);const x=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],L=u("circle-alert",x);export{L as C,b as a,u as c};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import{r as E,c9 as la,ca,a3 as ua,bP as Y,s as b,cb as Xe,cc as fs,bT as da,bU as pa,bO as ma,bQ as H,bK as Ue,w as We,o as L,bR as A,bS as ve,cd as fa,ce as Z,_ as ha,bI as ga,c as U,u as Ie,K as de,e as hs,n as at,t as Re,v as ze,j as u,E as Et,B as et,b as va,O as ya,a1 as xa,d as gs,I as ba,J as wt,av as Sa,T as _a,X as Ea,W as wa,M as Ia,az as Na}from"./index-WgRy4XEz.js";import{u as It,a as Nt,d as Ca}from"./constants-Bbw6jN_V.js";import{b as Ta}from"./use-virtual-mcp-DXNTpzcv.js";import{A as Zt,D as ut}from"./decopilot-events-CkaAIkUJ.js";import{u as Ct,a as Aa}from"./use-llm-BMRIZw-b.js";import{u as Ma}from"./useQuery-C48kdbmo.js";import{u as tt,L as Fe}from"./localstorage-keys-BUkugh6_.js";import{u as ja}from"./tabs-BWF5GtqN.js";import{C as ka}from"./checkbox-YMBbuKOZ.js";import{I as Ra}from"./input-BJJ-HZyT.js";import{f as Oa,c as Pa,a as Da,D as $a}from"./dialog-DP7DY4yr.js";import{S as La,a as Za,b as Fa,c as Ua,d as za}from"./select-D5UCIms-.js";import{S as q}from"./skeleton-DJ9ksHdo.js";import{i as Ba}from"./AlignLeft-REGjRwBJ.js";import{i as Va}from"./ArrowLeft-6J-waWbb.js";import{t as ht}from"./ChevronDown-1tcTabrX.js";import{a as qa}from"./Image01-_ugWt3d2.js";import{s as Wa}from"./RefreshCcw01-CCgnRJd5.js";import{i as vs}from"./SearchMd-B8KV3nui.js";import{t as Tt}from"./Settings01-BdGMn6lJ.js";import{b as At,c as Ja,a as Ha,e as Ga}from"./use-collections-B-x23mni.js";import{u as Ya}from"./useSuspenseInfiniteQuery-Dk_AfHIX.js";const Qa=({size:t=24,color:e="currentColor",...s})=>E.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},E.createElement("path",{d:"M4 7h11m0 0-4 4m4-4-4-4M4 17h16m0 0-4 4m4-4-4-4"}));Qa.displayName="ArrowsRight";const ys=({size:t=24,color:e="currentColor",...s})=>E.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},E.createElement("path",{d:"m7 15 5 5 5-5M7 9l5-5 5 5"}));ys.displayName="ChevronSelectorVertical";const Ka=({size:t=24,color:e="currentColor",...s})=>E.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},E.createElement("path",{d:"M10 17.659V20a2 2 0 1 0 4 0v-2.341M12 2v1m-9 9H2m3.5-6.5-.6-.6m13.6.6.6-.6M22 12h-1m-3 0a6 6 0 1 1-12 0 6 6 0 0 1 12 0Z"}));Ka.displayName="Lightbulb02";const xs=({size:t=24,color:e="currentColor",...s})=>E.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},E.createElement("path",{d:"m6.5 13 .784 1.569c.266.53.399.796.576 1.026a3 3 0 0 0 .545.545c.23.177.495.31 1.026.575L11 17.5l-1.569.785c-.53.265-.796.398-1.026.575a3 3 0 0 0-.545.545c-.177.23-.31.495-.576 1.026L6.5 22l-.784-1.569c-.266-.53-.399-.796-.576-1.026a3 3 0 0 0-.545-.545c-.23-.177-.495-.31-1.026-.575L2 17.5l1.569-.785c.53-.265.796-.398 1.026-.575a3 3 0 0 0 .545-.545c.177-.23.31-.495.576-1.026L6.5 13ZM15 2l1.179 3.064c.282.734.423 1.1.642 1.409a3 3 0 0 0 .706.706c.309.22.675.36 1.409.642L22 9l-3.064 1.179c-.734.282-1.1.423-1.409.642a3 3 0 0 0-.706.706c-.22.309-.36.675-.642 1.409L15 16l-1.179-3.064c-.282-.734-.423-1.1-.642-1.409a3 3 0 0 0-.706-.706c-.309-.22-.675-.36-1.409-.642L8 9l3.064-1.179c.734-.282 1.1-.423 1.409-.642a3 3 0 0 0 .706-.706c.22-.309.36-.675.642-1.409L15 2Z"}));xs.displayName="Stars01";const bs=({size:t=24,color:e="currentColor",...s})=>E.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},E.createElement("path",{d:"M15.631 7.631c-.396-.396-.594-.594-.668-.822a1 1 0 0 1 0-.618c.074-.228.272-.426.668-.822L18.47 2.53a6 6 0 0 0-8.3 6.895c.12.49.179.734.168.888a.849.849 0 0 1-.11.392c-.07.138-.207.274-.48.547L3.5 17.5a2.121 2.121 0 0 0 3 3l6.248-6.248c.273-.273.41-.41.547-.48a.849.849 0 0 1 .392-.11c.154-.011.399.049.888.168a6 6 0 0 0 6.895-8.3l-2.84 2.84c-.396.396-.594.594-.822.668a1 1 0 0 1-.618 0c-.228-.074-.426-.272-.822-.668l-.738-.738Z"}));bs.displayName="Tool01";var Be;(function(t){t.assertEqual=r=>{};function e(r){}t.assertIs=e;function s(r){throw new Error}t.assertNever=s,t.arrayToEnum=r=>{const n={};for(const i of r)n[i]=i;return n},t.getValidEnumValues=r=>{const n=t.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),i={};for(const o of n)i[o]=r[o];return t.objectValues(i)},t.objectValues=r=>t.objectKeys(r).map(function(n){return r[n]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const n=[];for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&n.push(i);return n},t.find=(r,n)=>{for(const i of r)if(n(i))return i},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function a(r,n=" | "){return r.map(i=>typeof i=="string"?`'${i}'`:i).join(n)}t.joinValues=a,t.jsonStringifyReplacer=(r,n)=>typeof n=="bigint"?n.toString():n})(Be||(Be={}));var Ft;(function(t){t.mergeShapes=(e,s)=>({...e,...s})})(Ft||(Ft={}));Be.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);Be.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class st extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=a=>{this.issues=[...this.issues,a]},this.addIssues=(a=[])=>{this.issues=[...this.issues,...a]};const s=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,s):this.__proto__=s,this.name="ZodError",this.issues=e}format(e){const s=e||function(n){return n.message},a={_errors:[]},r=n=>{for(const i of n.issues)if(i.code==="invalid_union")i.unionErrors.map(r);else if(i.code==="invalid_return_type")r(i.returnTypeError);else if(i.code==="invalid_arguments")r(i.argumentsError);else if(i.path.length===0)a._errors.push(s(i));else{let o=a,c=0;for(;c<i.path.length;){const l=i.path[c];c===i.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(s(i))):o[l]=o[l]||{_errors:[]},o=o[l],c++}}};return r(this),a}static assert(e){if(!(e instanceof st))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Be.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=s=>s.message){const s=Object.create(null),a=[];for(const r of this.issues)if(r.path.length>0){const n=r.path[0];s[n]=s[n]||[],s[n].push(e(r))}else a.push(e(r));return{formErrors:a,fieldErrors:s}}get formErrors(){return this.flatten()}}st.create=t=>new st(t);var Ut;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Ut||(Ut={}));var j;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(j||(j={}));var Ss="vercel.ai.error",Xa=Symbol.for(Ss),zt,Bt,ce=class _s extends(Bt=Error,zt=Xa,Bt){constructor({name:e,message:s,cause:a}){super(s),this[zt]=!0,this.name=e,this.cause=a}static isInstance(e){return _s.hasMarker(e,Ss)}static hasMarker(e,s){const a=Symbol.for(s);return e!=null&&typeof e=="object"&&a in e&&typeof e[a]=="boolean"&&e[a]===!0}};function Es(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var ws="AI_InvalidArgumentError",Is=`vercel.ai.error.${ws}`,er=Symbol.for(Is),Vt,qt,tr=class extends(qt=ce,Vt=er,qt){constructor({message:t,cause:e,argument:s}){super({name:ws,message:t,cause:e}),this[Vt]=!0,this.argument=s}static isInstance(t){return ce.hasMarker(t,Is)}},Ns="AI_JSONParseError",Cs=`vercel.ai.error.${Ns}`,sr=Symbol.for(Cs),Wt,Jt,Ht=class extends(Jt=ce,Wt=sr,Jt){constructor({text:t,cause:e}){super({name:Ns,message:`JSON parsing failed: Text: ${t}.
|
|
2
|
+
Error message: ${Es(e)}`,cause:e}),this[Wt]=!0,this.text=t}static isInstance(t){return ce.hasMarker(t,Cs)}},Ts="AI_TypeValidationError",As=`vercel.ai.error.${Ts}`,ar=Symbol.for(As),Gt,Yt,Oe=class gt extends(Yt=ce,Gt=ar,Yt){constructor({value:e,cause:s,context:a}){let r="Type validation failed";if(a?.field&&(r+=` for ${a.field}`),a?.entityName||a?.entityId){r+=" (";const n=[];a.entityName&&n.push(a.entityName),a.entityId&&n.push(`id: "${a.entityId}"`),r+=n.join(", "),r+=")"}super({name:Ts,message:`${r}: Value: ${JSON.stringify(e)}.
|
|
3
|
+
Error message: ${Es(s)}`,cause:s}),this[Gt]=!0,this.value=e,this.context=a}static isInstance(e){return ce.hasMarker(e,As)}static wrap({value:e,cause:s,context:a}){var r,n,i;return gt.isInstance(s)&&s.value===e&&((r=s.context)==null?void 0:r.field)===a?.field&&((n=s.context)==null?void 0:n.entityName)===a?.entityName&&((i=s.context)==null?void 0:i.entityId)===a?.entityId?s:new gt({value:e,cause:s,context:a})}},Je=({prefix:t,size:e=16,alphabet:s="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:a="-"}={})=>{const r=()=>{const n=s.length,i=new Array(e);for(let o=0;o<e;o++)i[o]=s[Math.random()*n|0];return i.join("")};if(t==null)return r;if(s.includes(a))throw new tr({argument:"separator",message:`The separator "${a}" must not be part of the alphabet "${s}".`});return()=>`${t}${a}${r()}`},rr=Je();function Qt(t=globalThis){var e,s,a;return t.window?"runtime/browser":(e=t.navigator)!=null&&e.userAgent?`runtime/${t.navigator.userAgent.toLowerCase()}`:(a=(s=t.process)==null?void 0:s.versions)!=null&&a.node?`runtime/node.js/${t.process.version.substring(0)}`:t.EdgeRuntime?"runtime/vercel-edge":"runtime/unknown"}function Ee(t){if(t==null)return{};const e={};if(t instanceof Headers)t.forEach((s,a)=>{e[a.toLowerCase()]=s});else{Array.isArray(t)||(t=Object.entries(t));for(const[s,a]of t)a!=null&&(e[s.toLowerCase()]=a)}return e}function Kt(t,...e){const s=new Headers(Ee(t)),a=s.get("user-agent")||"";return s.set("user-agent",[a,...e].filter(Boolean).join(" ")),Object.fromEntries(s.entries())}var nr=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,or=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function Xt(t){const e=JSON.parse(t);return e===null||typeof e!="object"||nr.test(t)===!1&&or.test(t)===!1?e:ir(e)}function ir(t){let e=[t];for(;e.length;){const s=e;e=[];for(const a of s){if(Object.prototype.hasOwnProperty.call(a,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(a,"constructor")&&a.constructor!==null&&typeof a.constructor=="object"&&Object.prototype.hasOwnProperty.call(a.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const r in a){const n=a[r];n&&typeof n=="object"&&e.push(n)}}}return t}function lr(t){const{stackTraceLimit:e}=Error;try{Error.stackTraceLimit=0}catch{return Xt(t)}try{return Xt(t)}finally{Error.stackTraceLimit=e}}function Mt(t){if(t.type==="object"||Array.isArray(t.type)&&t.type.includes("object")){t.additionalProperties=!1;const{properties:s}=t;if(s!=null)for(const a of Object.keys(s))s[a]=_e(s[a])}t.items!=null&&(t.items=Array.isArray(t.items)?t.items.map(_e):_e(t.items)),t.anyOf!=null&&(t.anyOf=t.anyOf.map(_e)),t.allOf!=null&&(t.allOf=t.allOf.map(_e)),t.oneOf!=null&&(t.oneOf=t.oneOf.map(_e));const{definitions:e}=t;if(e!=null)for(const s of Object.keys(e))e[s]=_e(e[s]);return t}function _e(t){return typeof t=="boolean"?t:Mt(t)}var cr=Symbol("Let zodToJsonSchema decide on which parser to use"),es={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},ur=t=>typeof t=="string"?{...es,name:t}:{...es,...t};function K(){return{}}function dr(t,e){var s,a,r;const n={type:"array"};return(s=t.type)!=null&&s._def&&((r=(a=t.type)==null?void 0:a._def)==null?void 0:r.typeName)!==j.ZodAny&&(n.items=$(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&(n.minItems=t.minLength.value),t.maxLength&&(n.maxItems=t.maxLength.value),t.exactLength&&(n.minItems=t.exactLength.value,n.maxItems=t.exactLength.value),n}function pr(t){const e={type:"integer",format:"int64"};if(!t.checks)return e;for(const s of t.checks)switch(s.kind){case"min":s.inclusive?e.minimum=s.value:e.exclusiveMinimum=s.value;break;case"max":s.inclusive?e.maximum=s.value:e.exclusiveMaximum=s.value;break;case"multipleOf":e.multipleOf=s.value;break}return e}function mr(){return{type:"boolean"}}function Ms(t,e){return $(t.type._def,e)}var fr=(t,e)=>$(t.innerType._def,e);function js(t,e,s){const a=s??e.dateStrategy;if(Array.isArray(a))return{anyOf:a.map((r,n)=>js(t,e,r))};switch(a){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return hr(t)}}var hr=t=>{const e={type:"integer",format:"unix-time"};for(const s of t.checks)switch(s.kind){case"min":e.minimum=s.value;break;case"max":e.maximum=s.value;break}return e};function gr(t,e){return{...$(t.innerType._def,e),default:t.defaultValue()}}function vr(t,e){return e.effectStrategy==="input"?$(t.schema._def,e):K()}function yr(t){return{type:"string",enum:Array.from(t.values)}}var xr=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function br(t,e){const s=[$(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),$(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(r=>!!r),a=[];return s.forEach(r=>{if(xr(r))a.push(...r.allOf);else{let n=r;if("additionalProperties"in r&&r.additionalProperties===!1){const{additionalProperties:i,...o}=r;n=o}a.push(n)}}),a.length?{allOf:a}:void 0}function Sr(t){const e=typeof t.value;return e!=="bigint"&&e!=="number"&&e!=="boolean"&&e!=="string"?{type:Array.isArray(t.value)?"array":"object"}:{type:e==="bigint"?"integer":e,const:t.value}}var dt=void 0,se={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(dt===void 0&&(dt=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),dt),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function ks(t,e){const s={type:"string"};if(t.checks)for(const a of t.checks)switch(a.kind){case"min":s.minLength=typeof s.minLength=="number"?Math.max(s.minLength,a.value):a.value;break;case"max":s.maxLength=typeof s.maxLength=="number"?Math.min(s.maxLength,a.value):a.value;break;case"email":switch(e.emailStrategy){case"format:email":ae(s,"email",a.message,e);break;case"format:idn-email":ae(s,"idn-email",a.message,e);break;case"pattern:zod":J(s,se.email,a.message,e);break}break;case"url":ae(s,"uri",a.message,e);break;case"uuid":ae(s,"uuid",a.message,e);break;case"regex":J(s,a.regex,a.message,e);break;case"cuid":J(s,se.cuid,a.message,e);break;case"cuid2":J(s,se.cuid2,a.message,e);break;case"startsWith":J(s,RegExp(`^${pt(a.value,e)}`),a.message,e);break;case"endsWith":J(s,RegExp(`${pt(a.value,e)}$`),a.message,e);break;case"datetime":ae(s,"date-time",a.message,e);break;case"date":ae(s,"date",a.message,e);break;case"time":ae(s,"time",a.message,e);break;case"duration":ae(s,"duration",a.message,e);break;case"length":s.minLength=typeof s.minLength=="number"?Math.max(s.minLength,a.value):a.value,s.maxLength=typeof s.maxLength=="number"?Math.min(s.maxLength,a.value):a.value;break;case"includes":{J(s,RegExp(pt(a.value,e)),a.message,e);break}case"ip":{a.version!=="v6"&&ae(s,"ipv4",a.message,e),a.version!=="v4"&&ae(s,"ipv6",a.message,e);break}case"base64url":J(s,se.base64url,a.message,e);break;case"jwt":J(s,se.jwt,a.message,e);break;case"cidr":{a.version!=="v6"&&J(s,se.ipv4Cidr,a.message,e),a.version!=="v4"&&J(s,se.ipv6Cidr,a.message,e);break}case"emoji":J(s,se.emoji(),a.message,e);break;case"ulid":{J(s,se.ulid,a.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{ae(s,"binary",a.message,e);break}case"contentEncoding:base64":{s.contentEncoding="base64";break}case"pattern:zod":{J(s,se.base64,a.message,e);break}}break}case"nanoid":J(s,se.nanoid,a.message,e)}return s}function pt(t,e){return e.patternStrategy==="escape"?Er(t):t}var _r=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Er(t){let e="";for(let s=0;s<t.length;s++)_r.has(t[s])||(e+="\\"),e+=t[s];return e}function ae(t,e,s,a){var r;t.format||(r=t.anyOf)!=null&&r.some(n=>n.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format}),delete t.format),t.anyOf.push({format:e,...s&&a.errorMessages&&{errorMessage:{format:s}}})):t.format=e}function J(t,e,s,a){var r;t.pattern||(r=t.allOf)!=null&&r.some(n=>n.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern}),delete t.pattern),t.allOf.push({pattern:ts(e,a),...s&&a.errorMessages&&{errorMessage:{pattern:s}}})):t.pattern=ts(e,a)}function ts(t,e){var s;if(!e.applyRegexFlags||!t.flags)return t.source;const a={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},r=a.i?t.source.toLowerCase():t.source;let n="",i=!1,o=!1,c=!1;for(let l=0;l<r.length;l++){if(i){n+=r[l],i=!1;continue}if(a.i){if(o){if(r[l].match(/[a-z]/)){c?(n+=r[l],n+=`${r[l-2]}-${r[l]}`.toUpperCase(),c=!1):r[l+1]==="-"&&((s=r[l+2])!=null&&s.match(/[a-z]/))?(n+=r[l],c=!0):n+=`${r[l]}${r[l].toUpperCase()}`;continue}}else if(r[l].match(/[a-z]/)){n+=`[${r[l]}${r[l].toUpperCase()}]`;continue}}if(a.m){if(r[l]==="^"){n+=`(^|(?<=[\r
|
|
4
|
+
]))`;continue}else if(r[l]==="$"){n+=`($|(?=[\r
|
|
5
|
+
]))`;continue}}if(a.s&&r[l]==="."){n+=o?`${r[l]}\r
|
|
6
|
+
`:`[${r[l]}\r
|
|
7
|
+
]`;continue}n+=r[l],r[l]==="\\"?i=!0:o&&r[l]==="]"?o=!1:!o&&r[l]==="["&&(o=!0)}try{new RegExp(n)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return n}function Rs(t,e){var s,a,r,n,i,o;const c={type:"object",additionalProperties:(s=$(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]}))!=null?s:e.allowedAdditionalProperties};if(((a=t.keyType)==null?void 0:a._def.typeName)===j.ZodString&&((r=t.keyType._def.checks)!=null&&r.length)){const{type:l,...d}=ks(t.keyType._def,e);return{...c,propertyNames:d}}else{if(((n=t.keyType)==null?void 0:n._def.typeName)===j.ZodEnum)return{...c,propertyNames:{enum:t.keyType._def.values}};if(((i=t.keyType)==null?void 0:i._def.typeName)===j.ZodBranded&&t.keyType._def.type._def.typeName===j.ZodString&&((o=t.keyType._def.type._def.checks)!=null&&o.length)){const{type:l,...d}=Ms(t.keyType._def,e);return{...c,propertyNames:d}}}return c}function wr(t,e){if(e.mapStrategy==="record")return Rs(t,e);const s=$(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||K(),a=$(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||K();return{type:"array",maxItems:125,items:{type:"array",items:[s,a],minItems:2,maxItems:2}}}function Ir(t){const e=t.values,a=Object.keys(t.values).filter(n=>typeof e[e[n]]!="number").map(n=>e[n]),r=Array.from(new Set(a.map(n=>typeof n)));return{type:r.length===1?r[0]==="string"?"string":"number":["string","number"],enum:a}}function Nr(){return{not:K()}}function Cr(){return{type:"null"}}var vt={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Tr(t,e){const s=t.options instanceof Map?Array.from(t.options.values()):t.options;if(s.every(a=>a._def.typeName in vt&&(!a._def.checks||!a._def.checks.length))){const a=s.reduce((r,n)=>{const i=vt[n._def.typeName];return i&&!r.includes(i)?[...r,i]:r},[]);return{type:a.length>1?a:a[0]}}else if(s.every(a=>a._def.typeName==="ZodLiteral"&&!a.description)){const a=s.reduce((r,n)=>{const i=typeof n._def.value;switch(i){case"string":case"number":case"boolean":return[...r,i];case"bigint":return[...r,"integer"];case"object":if(n._def.value===null)return[...r,"null"];default:return r}},[]);if(a.length===s.length){const r=a.filter((n,i,o)=>o.indexOf(n)===i);return{type:r.length>1?r:r[0],enum:s.reduce((n,i)=>n.includes(i._def.value)?n:[...n,i._def.value],[])}}}else if(s.every(a=>a._def.typeName==="ZodEnum"))return{type:"string",enum:s.reduce((a,r)=>[...a,...r._def.values.filter(n=>!a.includes(n))],[])};return Ar(t,e)}var Ar=(t,e)=>{const s=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((a,r)=>$(a._def,{...e,currentPath:[...e.currentPath,"anyOf",`${r}`]})).filter(a=>!!a&&(!e.strictUnions||typeof a=="object"&&Object.keys(a).length>0));return s.length?{anyOf:s}:void 0};function Mr(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return{type:[vt[t.innerType._def.typeName],"null"]};const s=$(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return s&&{anyOf:[s,{type:"null"}]}}function jr(t){const e={type:"number"};if(!t.checks)return e;for(const s of t.checks)switch(s.kind){case"int":e.type="integer";break;case"min":s.inclusive?e.minimum=s.value:e.exclusiveMinimum=s.value;break;case"max":s.inclusive?e.maximum=s.value:e.exclusiveMaximum=s.value;break;case"multipleOf":e.multipleOf=s.value;break}return e}function kr(t,e){const s={type:"object",properties:{}},a=[],r=t.shape();for(const i in r){let o=r[i];if(o===void 0||o._def===void 0)continue;const c=Or(o),l=$(o._def,{...e,currentPath:[...e.currentPath,"properties",i],propertyPath:[...e.currentPath,"properties",i]});l!==void 0&&(s.properties[i]=l,c||a.push(i))}a.length&&(s.required=a);const n=Rr(t,e);return n!==void 0&&(s.additionalProperties=n),s}function Rr(t,e){if(t.catchall._def.typeName!=="ZodNever")return $(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function Or(t){try{return t.isOptional()}catch{return!0}}var Pr=(t,e)=>{var s;if(e.currentPath.toString()===((s=e.propertyPath)==null?void 0:s.toString()))return $(t.innerType._def,e);const a=$(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return a?{anyOf:[{not:K()},a]}:K()},Dr=(t,e)=>{if(e.pipeStrategy==="input")return $(t.in._def,e);if(e.pipeStrategy==="output")return $(t.out._def,e);const s=$(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),a=$(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",s?"1":"0"]});return{allOf:[s,a].filter(r=>r!==void 0)}};function $r(t,e){return $(t.type._def,e)}function Lr(t,e){const a={type:"array",uniqueItems:!0,items:$(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&(a.minItems=t.minSize.value),t.maxSize&&(a.maxItems=t.maxSize.value),a}function Zr(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((s,a)=>$(s._def,{...e,currentPath:[...e.currentPath,"items",`${a}`]})).reduce((s,a)=>a===void 0?s:[...s,a],[]),additionalItems:$(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((s,a)=>$(s._def,{...e,currentPath:[...e.currentPath,"items",`${a}`]})).reduce((s,a)=>a===void 0?s:[...s,a],[])}}function Fr(){return{not:K()}}function Ur(){return K()}var zr=(t,e)=>$(t.innerType._def,e),Br=(t,e,s)=>{switch(e){case j.ZodString:return ks(t,s);case j.ZodNumber:return jr(t);case j.ZodObject:return kr(t,s);case j.ZodBigInt:return pr(t);case j.ZodBoolean:return mr();case j.ZodDate:return js(t,s);case j.ZodUndefined:return Fr();case j.ZodNull:return Cr();case j.ZodArray:return dr(t,s);case j.ZodUnion:case j.ZodDiscriminatedUnion:return Tr(t,s);case j.ZodIntersection:return br(t,s);case j.ZodTuple:return Zr(t,s);case j.ZodRecord:return Rs(t,s);case j.ZodLiteral:return Sr(t);case j.ZodEnum:return yr(t);case j.ZodNativeEnum:return Ir(t);case j.ZodNullable:return Mr(t,s);case j.ZodOptional:return Pr(t,s);case j.ZodMap:return wr(t,s);case j.ZodSet:return Lr(t,s);case j.ZodLazy:return()=>t.getter()._def;case j.ZodPromise:return $r(t,s);case j.ZodNaN:case j.ZodNever:return Nr();case j.ZodEffects:return vr(t,s);case j.ZodAny:return K();case j.ZodUnknown:return Ur();case j.ZodDefault:return gr(t,s);case j.ZodBranded:return Ms(t,s);case j.ZodReadonly:return zr(t,s);case j.ZodCatch:return fr(t,s);case j.ZodPipeline:return Dr(t,s);case j.ZodFunction:case j.ZodVoid:case j.ZodSymbol:return;default:return(a=>{})()}},Vr=(t,e)=>{let s=0;for(;s<t.length&&s<e.length&&t[s]===e[s];s++);return[(t.length-s).toString(),...e.slice(s)].join("/")};function $(t,e,s=!1){var a;const r=e.seen.get(t);if(e.override){const c=(a=e.override)==null?void 0:a.call(e,t,e,r,s);if(c!==cr)return c}if(r&&!s){const c=qr(r,e);if(c!==void 0)return c}const n={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,n);const i=Br(t,t.typeName,e),o=typeof i=="function"?$(i(),e):i;if(o&&Wr(t,e,o),e.postProcess){const c=e.postProcess(o,t,e);return n.jsonSchema=o,c}return n.jsonSchema=o,o}var qr=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Vr(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((s,a)=>e.currentPath[a]===s)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),K()):e.$refStrategy==="seen"?K():void 0}},Wr=(t,e,s)=>(t.description&&(s.description=t.description),s),Jr=t=>{const e=ur(t),s=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,currentPath:s,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([a,r])=>[r._def,{def:r._def,path:[...e.basePath,e.definitionPath,a],jsonSchema:void 0}]))}},Hr=(t,e)=>{var s;const a=Jr(e);let r=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[d,m])=>{var h;return{...l,[d]:(h=$(m._def,{...a,currentPath:[...a.basePath,a.definitionPath,d]},!0))!=null?h:K()}},{}):void 0;const n=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,i=(s=$(t._def,n===void 0?a:{...a,currentPath:[...a.basePath,a.definitionPath,n]},!1))!=null?s:K(),o=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;o!==void 0&&(i.title=o);const c=n===void 0?r?{...i,[a.definitionPath]:r}:i:{$ref:[...a.$refStrategy==="relative"?[]:a.basePath,a.definitionPath,n].join("/"),[a.definitionPath]:{...r,[n]:i}};return c.$schema="http://json-schema.org/draft-07/schema#",c},yt=Symbol.for("vercel.ai.schema");function Gr(t){let e;return()=>(e==null&&(e=t()),e)}function rt(t,{validate:e}={}){return{[yt]:!0,_type:void 0,get jsonSchema(){return typeof t=="function"&&(t=t()),t},validate:e}}function Yr(t){return typeof t=="object"&&t!==null&&yt in t&&t[yt]===!0&&"jsonSchema"in t&&"validate"in t}function jt(t){return t==null?rt({properties:{},additionalProperties:!1}):Yr(t)?t:"~standard"in t?t["~standard"].vendor==="zod"?Os(t):Qr(t):t()}function Qr(t){return rt(()=>Mt(t["~standard"].jsonSchema.input({target:"draft-07"})),{validate:async e=>{const s=await t["~standard"].validate(e);return"value"in s?{success:!0,value:s.value}:{success:!1,error:new Oe({value:e,cause:s.issues})}}})}function Kr(t,e){var s;const a=(s=void 0)!=null?s:!1;return rt(()=>Hr(t,{$refStrategy:a?"root":"none"}),{validate:async r=>{const n=await t.safeParseAsync(r);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function Xr(t,e){var s;const a=(s=void 0)!=null?s:!1;return rt(()=>Mt(ua(t,{target:"draft-7",io:"input",reused:a?"ref":"inline"})),{validate:async r=>{const n=await ca(t,r);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function en(t){return"_zod"in t}function Os(t,e){return en(t)?Xr(t):Kr(t)}async function ss({value:t,schema:e,context:s}){const a=await Ve({value:t,schema:e,context:s});if(!a.success)throw Oe.wrap({value:t,cause:a.error,context:s});return a.value}async function Ve({value:t,schema:e,context:s}){const a=jt(e);try{if(a.validate==null)return{success:!0,value:t,rawValue:t};const r=await a.validate(t);return r.success?{success:!0,value:r.value,rawValue:t}:{success:!1,error:Oe.wrap({value:t,cause:r.error,context:s}),rawValue:t}}catch(r){return{success:!1,error:Oe.wrap({value:t,cause:r,context:s}),rawValue:t}}}async function we({text:t,schema:e}){try{const s=lr(t);return e==null?{success:!0,value:s,rawValue:s}:await Ve({value:s,schema:e})}catch(s){return{success:!1,error:Ht.isInstance(s)?s:new Ht({text:t,cause:s}),rawValue:void 0}}}function tn({stream:t,schema:e}){return t.pipeThrough(new TextDecoderStream).pipeThrough(new la).pipeThrough(new TransformStream({async transform({data:s},a){s!=="[DONE]"&&a.enqueue(await we({text:s,schema:e}))}}))}async function xe(t){return typeof t=="function"&&(t=t()),Promise.resolve(t)}var sn=Object.defineProperty,an=(t,e)=>{for(var s in e)sn(t,s,{get:e[s],enumerable:!0})},Ps="AI_NoObjectGeneratedError",Ds=`vercel.ai.error.${Ps}`,rn=Symbol.for(Ds),$s,be=class extends ce{constructor({message:t="No object generated.",cause:e,text:s,response:a,usage:r,finishReason:n}){super({name:Ps,message:t,cause:e}),this[$s]=!0,this.text=s,this.response=a,this.usage=r,this.finishReason=n}static isInstance(t){return ce.hasMarker(t,Ds)}};$s=rn;var Ls="AI_UIMessageStreamError",Zs=`vercel.ai.error.${Ls}`,nn=Symbol.for(Zs),Fs,Me=class extends ce{constructor({chunkType:t,chunkId:e,message:s}){super({name:Ls,message:s}),this[Fs]=!0,this.chunkType=t,this.chunkId=e}static isInstance(t){return ce.hasMarker(t,Zs)}};Fs=nn;var as="6.0.116",Us=Y([b(),Xe(Uint8Array),Xe(ArrayBuffer),fs(t=>{var e,s;return(s=(e=globalThis.Buffer)==null?void 0:e.isBuffer(t))!=null?s:!1},{message:"Must be a Buffer"})]),qe=da(()=>Y([pa(),b(),ma(),H(),Ue(b(),qe.optional()),We(qe)])),O=Ue(b(),Ue(b(),qe.optional())),zs=L({type:A("text"),text:b(),providerOptions:O.optional()}),on=L({type:A("image"),image:Y([Us,Xe(URL)]),mediaType:b().optional(),providerOptions:O.optional()}),Bs=L({type:A("file"),data:Y([Us,Xe(URL)]),filename:b().optional(),mediaType:b(),providerOptions:O.optional()}),ln=L({type:A("reasoning"),text:b(),providerOptions:O.optional()}),cn=L({type:A("tool-call"),toolCallId:b(),toolName:b(),input:ve(),providerOptions:O.optional(),providerExecuted:H().optional()}),un=fa("type",[L({type:A("text"),value:b(),providerOptions:O.optional()}),L({type:A("json"),value:qe,providerOptions:O.optional()}),L({type:A("execution-denied"),reason:b().optional(),providerOptions:O.optional()}),L({type:A("error-text"),value:b(),providerOptions:O.optional()}),L({type:A("error-json"),value:qe,providerOptions:O.optional()}),L({type:A("content"),value:We(Y([L({type:A("text"),text:b(),providerOptions:O.optional()}),L({type:A("media"),data:b(),mediaType:b()}),L({type:A("file-data"),data:b(),mediaType:b(),filename:b().optional(),providerOptions:O.optional()}),L({type:A("file-url"),url:b(),providerOptions:O.optional()}),L({type:A("file-id"),fileId:Y([b(),Ue(b(),b())]),providerOptions:O.optional()}),L({type:A("image-data"),data:b(),mediaType:b(),providerOptions:O.optional()}),L({type:A("image-url"),url:b(),providerOptions:O.optional()}),L({type:A("image-file-id"),fileId:Y([b(),Ue(b(),b())]),providerOptions:O.optional()}),L({type:A("custom"),providerOptions:O.optional()})]))})]),Vs=L({type:A("tool-result"),toolCallId:b(),toolName:b(),output:un,providerOptions:O.optional()}),dn=L({type:A("tool-approval-request"),approvalId:b(),toolCallId:b()}),pn=L({type:A("tool-approval-response"),approvalId:b(),approved:H(),reason:b().optional()}),mn=L({role:A("system"),content:b(),providerOptions:O.optional()}),fn=L({role:A("user"),content:Y([b(),We(Y([zs,on,Bs]))]),providerOptions:O.optional()}),hn=L({role:A("assistant"),content:Y([b(),We(Y([zs,Bs,ln,cn,Vs,dn]))]),providerOptions:O.optional()}),gn=L({role:A("tool"),content:We(Y([Vs,pn])),providerOptions:O.optional()});Y([mn,fn,hn,gn]);function qs(t,e){if(t===void 0&&e===void 0)return;if(t===void 0)return e;if(e===void 0)return t;const s={...t};for(const a in e)if(Object.prototype.hasOwnProperty.call(e,a)){const r=e[a];if(r===void 0)continue;const n=a in t?t[a]:void 0,i=r!==null&&typeof r=="object"&&!Array.isArray(r)&&!(r instanceof Date)&&!(r instanceof RegExp),o=n!=null&&typeof n=="object"&&!Array.isArray(n)&&!(n instanceof Date)&&!(n instanceof RegExp);i&&o?s[a]=qs(n,r):s[a]=r}return s}var vn={};an(vn,{array:()=>Sn,choice:()=>_n,json:()=>En,object:()=>bn,text:()=>xn});function yn(t){const e=["ROOT"];let s=-1,a=null;function r(c,l,d){switch(c){case'"':{s=l,e.pop(),e.push(d),e.push("INSIDE_STRING");break}case"f":case"t":case"n":{s=l,a=l,e.pop(),e.push(d),e.push("INSIDE_LITERAL");break}case"-":{e.pop(),e.push(d),e.push("INSIDE_NUMBER");break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{s=l,e.pop(),e.push(d),e.push("INSIDE_NUMBER");break}case"{":{s=l,e.pop(),e.push(d),e.push("INSIDE_OBJECT_START");break}case"[":{s=l,e.pop(),e.push(d),e.push("INSIDE_ARRAY_START");break}}}function n(c,l){switch(c){case",":{e.pop(),e.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{s=l,e.pop();break}}}function i(c,l){switch(c){case",":{e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{s=l,e.pop();break}}}for(let c=0;c<t.length;c++){const l=t[c];switch(e[e.length-1]){case"ROOT":r(l,c,"FINISH");break;case"INSIDE_OBJECT_START":{switch(l){case'"':{e.pop(),e.push("INSIDE_OBJECT_KEY");break}case"}":{s=c,e.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{l==='"'&&(e.pop(),e.push("INSIDE_OBJECT_KEY"));break}case"INSIDE_OBJECT_KEY":{l==='"'&&(e.pop(),e.push("INSIDE_OBJECT_AFTER_KEY"));break}case"INSIDE_OBJECT_AFTER_KEY":{l===":"&&(e.pop(),e.push("INSIDE_OBJECT_BEFORE_VALUE"));break}case"INSIDE_OBJECT_BEFORE_VALUE":{r(l,c,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{n(l,c);break}case"INSIDE_STRING":{switch(l){case'"':{e.pop(),s=c;break}case"\\":{e.push("INSIDE_STRING_ESCAPE");break}default:s=c}break}case"INSIDE_ARRAY_START":{l==="]"?(s=c,e.pop()):(s=c,r(l,c,"INSIDE_ARRAY_AFTER_VALUE"));break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(l){case",":{e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{s=c,e.pop();break}default:{s=c;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{r(l,c,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{e.pop(),s=c;break}case"INSIDE_NUMBER":{switch(l){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{s=c;break}case"e":case"E":case"-":case".":break;case",":{e.pop(),e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(l,c),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&n(l,c);break}case"}":{e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&n(l,c);break}case"]":{e.pop(),e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(l,c);break}default:{e.pop();break}}break}case"INSIDE_LITERAL":{const m=t.substring(a,c+1);!"false".startsWith(m)&&!"true".startsWith(m)&&!"null".startsWith(m)?(e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?n(l,c):e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(l,c)):s=c;break}}}let o=t.slice(0,s+1);for(let c=e.length-1;c>=0;c--)switch(e[c]){case"INSIDE_STRING":{o+='"';break}case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":{o+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{o+="]";break}case"INSIDE_LITERAL":{const d=t.substring(a,t.length);"true".startsWith(d)?o+="true".slice(d.length):"false".startsWith(d)?o+="false".slice(d.length):"null".startsWith(d)&&(o+="null".slice(d.length))}}return o}async function He(t){if(t===void 0)return{value:void 0,state:"undefined-input"};let e=await we({text:t});return e.success?{value:e.value,state:"successful-parse"}:(e=await we({text:yn(t)}),e.success?{value:e.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var xn=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:t}){return t},async parsePartialOutput({text:t}){return{partial:t}},createElementStreamTransform(){}}),bn=({schema:t,name:e,description:s})=>{const a=jt(t);return{name:"object",responseFormat:xe(a.jsonSchema).then(r=>({type:"json",schema:r,...e!=null&&{name:e},...s!=null&&{description:s}})),async parseCompleteOutput({text:r},n){const i=await we({text:r});if(!i.success)throw new be({message:"No object generated: could not parse the response.",cause:i.error,text:r,response:n.response,usage:n.usage,finishReason:n.finishReason});const o=await Ve({value:i.value,schema:a});if(!o.success)throw new be({message:"No object generated: response did not match schema.",cause:o.error,text:r,response:n.response,usage:n.usage,finishReason:n.finishReason});return o.value},async parsePartialOutput({text:r}){const n=await He(r);switch(n.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:n.value}}},createElementStreamTransform(){}}},Sn=({element:t,name:e,description:s})=>{const a=jt(t);return{name:"array",responseFormat:xe(a.jsonSchema).then(r=>{const{$schema:n,...i}=r;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:i}},required:["elements"],additionalProperties:!1},...e!=null&&{name:e},...s!=null&&{description:s}}}),async parseCompleteOutput({text:r},n){const i=await we({text:r});if(!i.success)throw new be({message:"No object generated: could not parse the response.",cause:i.error,text:r,response:n.response,usage:n.usage,finishReason:n.finishReason});const o=i.value;if(o==null||typeof o!="object"||!("elements"in o)||!Array.isArray(o.elements))throw new be({message:"No object generated: response did not match schema.",cause:new Oe({value:o,cause:"response must be an object with an elements array"}),text:r,response:n.response,usage:n.usage,finishReason:n.finishReason});for(const c of o.elements){const l=await Ve({value:c,schema:a});if(!l.success)throw new be({message:"No object generated: response did not match schema.",cause:l.error,text:r,response:n.response,usage:n.usage,finishReason:n.finishReason})}return o.elements},async parsePartialOutput({text:r}){const n=await He(r);switch(n.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const i=n.value;if(i==null||typeof i!="object"||!("elements"in i)||!Array.isArray(i.elements))return;const o=n.state==="repaired-parse"&&i.elements.length>0?i.elements.slice(0,-1):i.elements,c=[];for(const l of o){const d=await Ve({value:l,schema:a});d.success&&c.push(d.value)}return{partial:c}}}},createElementStreamTransform(){let r=0;return new TransformStream({transform({partialOutput:n},i){if(n!=null)for(;r<n.length;r++)i.enqueue(n[r])}})}}},_n=({options:t,name:e,description:s})=>({name:"choice",responseFormat:Promise.resolve({type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:t}},required:["result"],additionalProperties:!1},...e!=null&&{name:e},...s!=null&&{description:s}}),async parseCompleteOutput({text:a},r){const n=await we({text:a});if(!n.success)throw new be({message:"No object generated: could not parse the response.",cause:n.error,text:a,response:r.response,usage:r.usage,finishReason:r.finishReason});const i=n.value;if(i==null||typeof i!="object"||!("result"in i)||typeof i.result!="string"||!t.includes(i.result))throw new be({message:"No object generated: response did not match schema.",cause:new Oe({value:i,cause:"response must be an object that contains a choice value."}),text:a,response:r.response,usage:r.usage,finishReason:r.finishReason});return i.result},async parsePartialOutput({text:a}){const r=await He(a);switch(r.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const n=r.value;if(n==null||typeof n!="object"||!("result"in n)||typeof n.result!="string")return;const i=t.filter(o=>o.startsWith(n.result));return r.state==="successful-parse"?i.includes(n.result)?{partial:n.result}:void 0:i.length===1?{partial:i[0]}:void 0}}},createElementStreamTransform(){}}),En=({name:t,description:e}={})=>({name:"json",responseFormat:Promise.resolve({type:"json",...t!=null&&{name:t},...e!=null&&{description:e}}),async parseCompleteOutput({text:s},a){const r=await we({text:s});if(!r.success)throw new be({message:"No object generated: could not parse the response.",cause:r.error,text:s,response:a.response,usage:a.usage,finishReason:a.finishReason});return r.value},async parsePartialOutput({text:s}){const a=await He(s);switch(a.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return a.value===void 0?void 0:{partial:a.value}}},createElementStreamTransform(){}});Je({prefix:"aitxt",size:24});(class extends TransformStream{constructor(){super({transform(t,e){e.enqueue(`data: ${JSON.stringify(t)}
|
|
8
|
+
|
|
9
|
+
`)},flush(t){t.enqueue(`data: [DONE]
|
|
10
|
+
|
|
11
|
+
`)}})}});var wn=Gr(()=>Os(Y([Z({type:A("text-start"),id:b(),providerMetadata:O.optional()}),Z({type:A("text-delta"),id:b(),delta:b(),providerMetadata:O.optional()}),Z({type:A("text-end"),id:b(),providerMetadata:O.optional()}),Z({type:A("error"),errorText:b()}),Z({type:A("tool-input-start"),toolCallId:b(),toolName:b(),providerExecuted:H().optional(),providerMetadata:O.optional(),dynamic:H().optional(),title:b().optional()}),Z({type:A("tool-input-delta"),toolCallId:b(),inputTextDelta:b()}),Z({type:A("tool-input-available"),toolCallId:b(),toolName:b(),input:ve(),providerExecuted:H().optional(),providerMetadata:O.optional(),dynamic:H().optional(),title:b().optional()}),Z({type:A("tool-input-error"),toolCallId:b(),toolName:b(),input:ve(),providerExecuted:H().optional(),providerMetadata:O.optional(),dynamic:H().optional(),errorText:b(),title:b().optional()}),Z({type:A("tool-approval-request"),approvalId:b(),toolCallId:b()}),Z({type:A("tool-output-available"),toolCallId:b(),output:ve(),providerExecuted:H().optional(),dynamic:H().optional(),preliminary:H().optional()}),Z({type:A("tool-output-error"),toolCallId:b(),errorText:b(),providerExecuted:H().optional(),dynamic:H().optional()}),Z({type:A("tool-output-denied"),toolCallId:b()}),Z({type:A("reasoning-start"),id:b(),providerMetadata:O.optional()}),Z({type:A("reasoning-delta"),id:b(),delta:b(),providerMetadata:O.optional()}),Z({type:A("reasoning-end"),id:b(),providerMetadata:O.optional()}),Z({type:A("source-url"),sourceId:b(),url:b(),title:b().optional(),providerMetadata:O.optional()}),Z({type:A("source-document"),sourceId:b(),mediaType:b(),title:b(),filename:b().optional(),providerMetadata:O.optional()}),Z({type:A("file"),url:b(),mediaType:b(),providerMetadata:O.optional()}),Z({type:fs(t=>typeof t=="string"&&t.startsWith("data-"),{message:'Type must start with "data-"'}),id:b().optional(),data:ve(),transient:H().optional()}),Z({type:A("start-step")}),Z({type:A("finish-step")}),Z({type:A("start"),messageId:b().optional(),messageMetadata:ve().optional()}),Z({type:A("finish"),finishReason:ha(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:ve().optional()}),Z({type:A("abort"),reason:b().optional()}),Z({type:A("message-metadata"),messageMetadata:ve()})])));function In(t){return t.type.startsWith("data-")}function xt(t){return t.type.startsWith("tool-")}function Nn(t){return t.type==="dynamic-tool"}function Pe(t){return xt(t)||Nn(t)}function rs(t){return t.type.split("-").slice(1).join("-")}function Cn({lastMessage:t,messageId:e}){return{message:t?.role==="assistant"?t:{id:e,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function Tn({stream:t,messageMetadataSchema:e,dataPartSchemas:s,runUpdateMessageJob:a,onError:r,onToolCall:n,onData:i}){return t.pipeThrough(new TransformStream({async transform(o,c){await a(async({state:l,write:d})=>{var m,h,f,v;function x(p){const C=l.message.parts.filter(Pe).find(I=>I.toolCallId===p);if(C==null)throw new Me({chunkType:"tool-invocation",chunkId:p,message:`No tool invocation found for tool call ID "${p}".`});return C}function S(p){var N;const C=l.message.parts.find(w=>xt(w)&&w.toolCallId===p.toolCallId),I=p,g=C;C!=null?(C.state=p.state,g.input=I.input,g.output=I.output,g.errorText=I.errorText,g.rawInput=I.rawInput,g.preliminary=I.preliminary,p.title!==void 0&&(g.title=p.title),g.providerExecuted=(N=I.providerExecuted)!=null?N:C.providerExecuted,I.providerMetadata!=null&&(C.callProviderMetadata=I.providerMetadata)):l.message.parts.push({type:`tool-${p.toolName}`,toolCallId:p.toolCallId,state:p.state,title:p.title,input:I.input,output:I.output,rawInput:I.rawInput,errorText:I.errorText,providerExecuted:I.providerExecuted,preliminary:I.preliminary,...I.providerMetadata!=null?{callProviderMetadata:I.providerMetadata}:{}})}function y(p){var N,C;const I=l.message.parts.find(T=>T.type==="dynamic-tool"&&T.toolCallId===p.toolCallId),g=p,w=I;I!=null?(I.state=p.state,w.toolName=p.toolName,w.input=g.input,w.output=g.output,w.errorText=g.errorText,w.rawInput=(N=g.rawInput)!=null?N:w.rawInput,w.preliminary=g.preliminary,p.title!==void 0&&(w.title=p.title),w.providerExecuted=(C=g.providerExecuted)!=null?C:I.providerExecuted,g.providerMetadata!=null&&(I.callProviderMetadata=g.providerMetadata)):l.message.parts.push({type:"dynamic-tool",toolName:p.toolName,toolCallId:p.toolCallId,state:p.state,input:g.input,output:g.output,errorText:g.errorText,preliminary:g.preliminary,providerExecuted:g.providerExecuted,title:p.title,...g.providerMetadata!=null?{callProviderMetadata:g.providerMetadata}:{}})}async function _(p){if(p!=null){const N=l.message.metadata!=null?qs(l.message.metadata,p):p;e!=null&&await ss({value:N,schema:e,context:{field:"message.metadata",entityId:l.message.id}}),l.message.metadata=N}}switch(o.type){case"text-start":{const p={type:"text",text:"",providerMetadata:o.providerMetadata,state:"streaming"};l.activeTextParts[o.id]=p,l.message.parts.push(p),d();break}case"text-delta":{const p=l.activeTextParts[o.id];if(p==null)throw new Me({chunkType:"text-delta",chunkId:o.id,message:`Received text-delta for missing text part with ID "${o.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`});p.text+=o.delta,p.providerMetadata=(m=o.providerMetadata)!=null?m:p.providerMetadata,d();break}case"text-end":{const p=l.activeTextParts[o.id];if(p==null)throw new Me({chunkType:"text-end",chunkId:o.id,message:`Received text-end for missing text part with ID "${o.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`});p.state="done",p.providerMetadata=(h=o.providerMetadata)!=null?h:p.providerMetadata,delete l.activeTextParts[o.id],d();break}case"reasoning-start":{const p={type:"reasoning",text:"",providerMetadata:o.providerMetadata,state:"streaming"};l.activeReasoningParts[o.id]=p,l.message.parts.push(p),d();break}case"reasoning-delta":{const p=l.activeReasoningParts[o.id];if(p==null)throw new Me({chunkType:"reasoning-delta",chunkId:o.id,message:`Received reasoning-delta for missing reasoning part with ID "${o.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`});p.text+=o.delta,p.providerMetadata=(f=o.providerMetadata)!=null?f:p.providerMetadata,d();break}case"reasoning-end":{const p=l.activeReasoningParts[o.id];if(p==null)throw new Me({chunkType:"reasoning-end",chunkId:o.id,message:`Received reasoning-end for missing reasoning part with ID "${o.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`});p.providerMetadata=(v=o.providerMetadata)!=null?v:p.providerMetadata,p.state="done",delete l.activeReasoningParts[o.id],d();break}case"file":{l.message.parts.push({type:"file",mediaType:o.mediaType,url:o.url,...o.providerMetadata!=null?{providerMetadata:o.providerMetadata}:{}}),d();break}case"source-url":{l.message.parts.push({type:"source-url",sourceId:o.sourceId,url:o.url,title:o.title,providerMetadata:o.providerMetadata}),d();break}case"source-document":{l.message.parts.push({type:"source-document",sourceId:o.sourceId,mediaType:o.mediaType,title:o.title,filename:o.filename,providerMetadata:o.providerMetadata}),d();break}case"tool-input-start":{const p=l.message.parts.filter(xt);l.partialToolCalls[o.toolCallId]={text:"",toolName:o.toolName,index:p.length,dynamic:o.dynamic,title:o.title},o.dynamic?y({toolCallId:o.toolCallId,toolName:o.toolName,state:"input-streaming",input:void 0,providerExecuted:o.providerExecuted,title:o.title,providerMetadata:o.providerMetadata}):S({toolCallId:o.toolCallId,toolName:o.toolName,state:"input-streaming",input:void 0,providerExecuted:o.providerExecuted,title:o.title,providerMetadata:o.providerMetadata}),d();break}case"tool-input-delta":{const p=l.partialToolCalls[o.toolCallId];if(p==null)throw new Me({chunkType:"tool-input-delta",chunkId:o.toolCallId,message:`Received tool-input-delta for missing tool call with ID "${o.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`});p.text+=o.inputTextDelta;const{value:N}=await He(p.text);p.dynamic?y({toolCallId:o.toolCallId,toolName:p.toolName,state:"input-streaming",input:N,title:p.title}):S({toolCallId:o.toolCallId,toolName:p.toolName,state:"input-streaming",input:N,title:p.title}),d();break}case"tool-input-available":{o.dynamic?y({toolCallId:o.toolCallId,toolName:o.toolName,state:"input-available",input:o.input,providerExecuted:o.providerExecuted,providerMetadata:o.providerMetadata,title:o.title}):S({toolCallId:o.toolCallId,toolName:o.toolName,state:"input-available",input:o.input,providerExecuted:o.providerExecuted,providerMetadata:o.providerMetadata,title:o.title}),d(),n&&!o.providerExecuted&&await n({toolCall:o});break}case"tool-input-error":{const p=l.message.parts.filter(Pe).find(C=>C.toolCallId===o.toolCallId);(p!=null?p.type==="dynamic-tool":!!o.dynamic)?y({toolCallId:o.toolCallId,toolName:o.toolName,state:"output-error",input:o.input,errorText:o.errorText,providerExecuted:o.providerExecuted,providerMetadata:o.providerMetadata}):S({toolCallId:o.toolCallId,toolName:o.toolName,state:"output-error",input:void 0,rawInput:o.input,errorText:o.errorText,providerExecuted:o.providerExecuted,providerMetadata:o.providerMetadata}),d();break}case"tool-approval-request":{const p=x(o.toolCallId);p.state="approval-requested",p.approval={id:o.approvalId},d();break}case"tool-output-denied":{const p=x(o.toolCallId);p.state="output-denied",d();break}case"tool-output-available":{const p=x(o.toolCallId);p.type==="dynamic-tool"?y({toolCallId:o.toolCallId,toolName:p.toolName,state:"output-available",input:p.input,output:o.output,preliminary:o.preliminary,providerExecuted:o.providerExecuted,title:p.title}):S({toolCallId:o.toolCallId,toolName:rs(p),state:"output-available",input:p.input,output:o.output,providerExecuted:o.providerExecuted,preliminary:o.preliminary,title:p.title}),d();break}case"tool-output-error":{const p=x(o.toolCallId);p.type==="dynamic-tool"?y({toolCallId:o.toolCallId,toolName:p.toolName,state:"output-error",input:p.input,errorText:o.errorText,providerExecuted:o.providerExecuted,title:p.title}):S({toolCallId:o.toolCallId,toolName:rs(p),state:"output-error",input:p.input,rawInput:p.rawInput,errorText:o.errorText,providerExecuted:o.providerExecuted,title:p.title}),d();break}case"start-step":{l.message.parts.push({type:"step-start"});break}case"finish-step":{l.activeTextParts={},l.activeReasoningParts={};break}case"start":{o.messageId!=null&&(l.message.id=o.messageId),await _(o.messageMetadata),(o.messageId!=null||o.messageMetadata!=null)&&d();break}case"finish":{o.finishReason!=null&&(l.finishReason=o.finishReason),await _(o.messageMetadata),o.messageMetadata!=null&&d();break}case"message-metadata":{await _(o.messageMetadata),o.messageMetadata!=null&&d();break}case"error":{r?.(new Error(o.errorText));break}default:if(In(o)){if(s?.[o.type]!=null){const C=l.message.parts.findIndex(g=>"id"in g&&"data"in g&&g.id===o.id&&g.type===o.type),I=C>=0?C:l.message.parts.length;await ss({value:o.data,schema:s[o.type],context:{field:`message.parts[${I}].data`,entityName:o.type,entityId:o.id}})}const p=o;if(p.transient){i?.(p);break}const N=p.id!=null?l.message.parts.find(C=>p.type===C.type&&p.id===C.id):void 0;N!=null?N.data=p.data:l.message.parts.push(p),i?.(p),d()}}c.enqueue(o)})}}))}async function An({stream:t,onError:e}){const s=t.getReader();try{for(;;){const{done:a}=await s.read();if(a)break}}catch(a){e?.(a)}finally{s.releaseLock()}}Je({prefix:"aitxt",size:24});Je({prefix:"aiobj",size:24});var Mn=class{constructor(){this.queue=[],this.isProcessing=!1}async processQueue(){if(!this.isProcessing){for(this.isProcessing=!0;this.queue.length>0;)await this.queue[0](),this.queue.shift();this.isProcessing=!1}}async run(t){return new Promise((e,s)=>{this.queue.push(async()=>{try{await t(),e()}catch(a){s(a)}}),this.processQueue()})}};Je({prefix:"aiobj",size:24});async function jn(t){if(t==null)return[];if(!globalThis.FileList||!(t instanceof globalThis.FileList))throw new Error("FileList is not supported in the current environment");return Promise.all(Array.from(t).map(async e=>{const{name:s,type:a}=e,r=await new Promise((n,i)=>{const o=new FileReader;o.onload=c=>{var l;n((l=c.target)==null?void 0:l.result)},o.onerror=c=>i(c),o.readAsDataURL(e)});return{type:"file",mediaType:a,filename:s,url:r}}))}var kn=class{constructor({api:t="/api/chat",credentials:e,headers:s,body:a,fetch:r,prepareSendMessagesRequest:n,prepareReconnectToStreamRequest:i}){this.api=t,this.credentials=e,this.headers=s,this.body=a,this.fetch=r,this.prepareSendMessagesRequest=n,this.prepareReconnectToStreamRequest=i}async sendMessages({abortSignal:t,...e}){var s,a,r,n,i;const o=await xe(this.body),c=await xe(this.headers),l=await xe(this.credentials),d={...Ee(c),...Ee(e.headers)},m=await((s=this.prepareSendMessagesRequest)==null?void 0:s.call(this,{api:this.api,id:e.chatId,messages:e.messages,body:{...o,...e.body},headers:d,credentials:l,requestMetadata:e.metadata,trigger:e.trigger,messageId:e.messageId})),h=(a=m?.api)!=null?a:this.api,f=m?.headers!==void 0?Ee(m.headers):d,v=m?.body!==void 0?m.body:{...o,...e.body,id:e.chatId,messages:e.messages,trigger:e.trigger,messageId:e.messageId},x=(r=m?.credentials)!=null?r:l,y=await((n=this.fetch)!=null?n:globalThis.fetch)(h,{method:"POST",headers:Kt({"Content-Type":"application/json",...f},`ai-sdk/${as}`,Qt()),body:JSON.stringify(v),credentials:x,signal:t});if(!y.ok)throw new Error((i=await y.text())!=null?i:"Failed to fetch the chat response.");if(!y.body)throw new Error("The response body is empty.");return this.processResponseStream(y.body)}async reconnectToStream(t){var e,s,a,r,n;const i=await xe(this.body),o=await xe(this.headers),c=await xe(this.credentials),l={...Ee(o),...Ee(t.headers)},d=await((e=this.prepareReconnectToStreamRequest)==null?void 0:e.call(this,{api:this.api,id:t.chatId,body:{...i,...t.body},headers:l,credentials:c,requestMetadata:t.metadata})),m=(s=d?.api)!=null?s:`${this.api}/${t.chatId}/stream`,h=d?.headers!==void 0?Ee(d.headers):l,f=(a=d?.credentials)!=null?a:c,x=await((r=this.fetch)!=null?r:globalThis.fetch)(m,{method:"GET",headers:Kt(h,`ai-sdk/${as}`,Qt()),credentials:f});if(x.status===204)return null;if(!x.ok)throw new Error((n=await x.text())!=null?n:"Failed to fetch the chat response.");if(!x.body)throw new Error("The response body is empty.");return this.processResponseStream(x.body)}},Ws=class extends kn{constructor(t={}){super(t)}processResponseStream(t){return tn({stream:t,schema:wn}).pipeThrough(new TransformStream({async transform(e,s){if(!e.success)throw e.error;s.enqueue(e.value)}}))}},Rn=class{constructor({generateId:t=rr,id:e=t(),transport:s=new Ws,messageMetadataSchema:a,dataPartSchemas:r,state:n,onError:i,onToolCall:o,onFinish:c,onData:l,sendAutomaticallyWhen:d}){this.activeResponse=void 0,this.jobExecutor=new Mn,this.sendMessage=async(m,h)=>{var f,v,x,S;if(m==null){await this.makeRequest({trigger:"submit-message",messageId:(f=this.lastMessage)==null?void 0:f.id,...h});return}let y;if("text"in m||"files"in m?y={parts:[...Array.isArray(m.files)?m.files:await jn(m.files),..."text"in m&&m.text!=null?[{type:"text",text:m.text}]:[]]}:y=m,m.messageId!=null){const _=this.state.messages.findIndex(p=>p.id===m.messageId);if(_===-1)throw new Error(`message with id ${m.messageId} not found`);if(this.state.messages[_].role!=="user")throw new Error(`message with id ${m.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,_+1),this.state.replaceMessage(_,{...y,id:m.messageId,role:(v=y.role)!=null?v:"user",metadata:m.metadata})}else this.state.pushMessage({...y,id:(x=y.id)!=null?x:this.generateId(),role:(S=y.role)!=null?S:"user",metadata:m.metadata});await this.makeRequest({trigger:"submit-message",messageId:m.messageId,...h})},this.regenerate=async({messageId:m,...h}={})=>{const f=m==null?this.state.messages.length-1:this.state.messages.findIndex(v=>v.id===m);if(f===-1)throw new Error(`message ${m} not found`);this.state.messages=this.state.messages.slice(0,this.messages[f].role==="assistant"?f:f+1),await this.makeRequest({trigger:"regenerate-message",messageId:m,...h})},this.resumeStream=async(m={})=>{await this.makeRequest({trigger:"resume-stream",...m})},this.clearError=()=>{this.status==="error"&&(this.state.error=void 0,this.setStatus({status:"ready"}))},this.addToolApprovalResponse=async({id:m,approved:h,reason:f})=>this.jobExecutor.run(async()=>{const v=this.state.messages,x=v[v.length-1],S=y=>Pe(y)&&y.state==="approval-requested"&&y.approval.id===m?{...y,state:"approval-responded",approval:{id:m,approved:h,reason:f}}:y;this.state.replaceMessage(v.length-1,{...x,parts:x.parts.map(S)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(S)),this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(y=>{var _;y&&this.makeRequest({trigger:"submit-message",messageId:(_=this.lastMessage)==null?void 0:_.id})})}),this.addToolOutput=async({state:m="output-available",tool:h,toolCallId:f,output:v,errorText:x})=>this.jobExecutor.run(async()=>{const S=this.state.messages,y=S[S.length-1],_=p=>Pe(p)&&p.toolCallId===f?{...p,state:m,output:v,errorText:x}:p;this.state.replaceMessage(S.length-1,{...y,parts:y.parts.map(_)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(_)),this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(p=>{var N;p&&this.makeRequest({trigger:"submit-message",messageId:(N=this.lastMessage)==null?void 0:N.id})})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{var m;this.status!=="streaming"&&this.status!=="submitted"||(m=this.activeResponse)!=null&&m.abortController&&this.activeResponse.abortController.abort()},this.id=e,this.transport=s,this.generateId=t,this.messageMetadataSchema=a,this.dataPartSchemas=r,this.state=n,this.onError=i,this.onToolCall=o,this.onFinish=c,this.onData=l,this.sendAutomaticallyWhen=d}get status(){return this.state.status}setStatus({status:t,error:e}){this.status!==t&&(this.state.status=t,this.state.error=e)}get error(){return this.state.error}get messages(){return this.state.messages}get lastMessage(){return this.state.messages[this.state.messages.length-1]}set messages(t){this.state.messages=t}async shouldSendAutomatically(){if(!this.sendAutomaticallyWhen)return!1;const t=this.sendAutomaticallyWhen({messages:this.state.messages});return t&&typeof t=="object"&&"then"in t?await t:t}async makeRequest({trigger:t,metadata:e,headers:s,body:a,messageId:r}){var n,i,o;let c;if(t==="resume-stream")try{const f=await this.transport.reconnectToStream({chatId:this.id,metadata:e,headers:s,body:a});if(f==null)return;c=f}catch(f){this.onError&&f instanceof Error&&this.onError(f),this.setStatus({status:"error",error:f});return}this.setStatus({status:"submitted",error:void 0});const l=this.lastMessage;let d=!1,m=!1,h=!1;try{const f={state:Cn({lastMessage:this.state.snapshot(l),messageId:this.generateId()}),abortController:new AbortController};f.abortController.signal.addEventListener("abort",()=>{d=!0}),this.activeResponse=f;let v;t==="resume-stream"?v=c:v=await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:f.abortController.signal,metadata:e,headers:s,body:a,trigger:t,messageId:r});const x=S=>this.jobExecutor.run(()=>S({state:f.state,write:()=>{var y;this.setStatus({status:"streaming"}),f.state.message.id===((y=this.lastMessage)==null?void 0:y.id)?this.state.replaceMessage(this.state.messages.length-1,f.state.message):this.state.pushMessage(f.state.message)}}));await An({stream:Tn({stream:v,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:x,onError:S=>{throw S}}),onError:S=>{throw S}}),this.setStatus({status:"ready"})}catch(f){if(d||f.name==="AbortError")return d=!0,this.setStatus({status:"ready"}),null;h=!0,f instanceof TypeError&&(f.message.toLowerCase().includes("fetch")||f.message.toLowerCase().includes("network"))&&(m=!0),this.onError&&f instanceof Error&&this.onError(f),this.setStatus({status:"error",error:f})}finally{try{(i=this.onFinish)==null||i.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:d,isDisconnect:m,isError:h,finishReason:(n=this.activeResponse)==null?void 0:n.state.finishReason})}catch(f){console.error(f)}this.activeResponse=void 0}!h&&await this.shouldSendAutomatically()&&await this.makeRequest({trigger:"submit-message",messageId:(o=this.lastMessage)==null?void 0:o.id,metadata:e,headers:s,body:a})}};function On({messages:t}){const e=t[t.length-1];if(!e||e.role!=="assistant")return!1;const s=e.parts.reduce((r,n,i)=>n.type==="step-start"?i:r,-1),a=e.parts.slice(s+1).filter(Pe).filter(r=>!r.providerExecuted);return a.filter(r=>r.state==="approval-responded").length>0&&a.every(r=>r.state==="output-available"||r.state==="output-error"||r.state==="approval-responded")}function Pn({messages:t}){const e=t[t.length-1];if(!e||e.role!=="assistant")return!1;const s=e.parts.reduce((r,n,i)=>n.type==="step-start"?i:r,-1),a=e.parts.slice(s+1).filter(Pe).filter(r=>!r.providerExecuted);return a.length>0&&a.every(r=>r.state==="output-available"||r.state==="output-error")}var mt,ns;function Dn(){if(ns)return mt;ns=1;function t(e,s){if(typeof e!="function")throw new TypeError(`Expected the first argument to be a \`function\`, got \`${typeof e}\`.`);let a,r=0;return function(...i){clearTimeout(a);const o=Date.now(),c=o-r,l=s-c;l<=0?(r=o,e.apply(this,i)):a=setTimeout(()=>{r=Date.now(),e.apply(this,i)},l)}}return mt=t,mt}var $n=Dn();const Ln=ga($n);var Js=(t,e,s)=>{if(!e.has(t))throw TypeError("Cannot "+s)},F=(t,e,s)=>(Js(t,e,"read from private field"),s?s.call(t):e.get(t)),le=(t,e,s)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,s)},ye=(t,e,s,a)=>(Js(t,e,"write to private field"),e.set(t,s),s);function Zn(t,e){return e!=null?Ln(t,e):t}var ee,Qe,Ke,$e,Le,Ze,je,bt,St,Fn=class{constructor(t=[]){le(this,ee,void 0),le(this,Qe,"ready"),le(this,Ke,void 0),le(this,$e,new Set),le(this,Le,new Set),le(this,Ze,new Set),this.pushMessage=e=>{ye(this,ee,F(this,ee).concat(e)),F(this,je).call(this)},this.popMessage=()=>{ye(this,ee,F(this,ee).slice(0,-1)),F(this,je).call(this)},this.replaceMessage=(e,s)=>{ye(this,ee,[...F(this,ee).slice(0,e),this.snapshot(s),...F(this,ee).slice(e+1)]),F(this,je).call(this)},this.snapshot=e=>structuredClone(e),this["~registerMessagesCallback"]=(e,s)=>{const a=s?Zn(e,s):e;return F(this,$e).add(a),()=>{F(this,$e).delete(a)}},this["~registerStatusCallback"]=e=>(F(this,Le).add(e),()=>{F(this,Le).delete(e)}),this["~registerErrorCallback"]=e=>(F(this,Ze).add(e),()=>{F(this,Ze).delete(e)}),le(this,je,()=>{F(this,$e).forEach(e=>e())}),le(this,bt,()=>{F(this,Le).forEach(e=>e())}),le(this,St,()=>{F(this,Ze).forEach(e=>e())}),ye(this,ee,t)}get status(){return F(this,Qe)}set status(t){ye(this,Qe,t),F(this,bt).call(this)}get error(){return F(this,Ke)}set error(t){ye(this,Ke,t),F(this,St).call(this)}get messages(){return F(this,ee)}set messages(t){ye(this,ee,[...t]),F(this,je).call(this)}};ee=new WeakMap;Qe=new WeakMap;Ke=new WeakMap;$e=new WeakMap;Le=new WeakMap;Ze=new WeakMap;je=new WeakMap;bt=new WeakMap;St=new WeakMap;var ke,os=class extends Rn{constructor({messages:t,...e}){const s=new Fn(t);super({...e,state:s}),le(this,ke,void 0),this["~registerMessagesCallback"]=(a,r)=>F(this,ke)["~registerMessagesCallback"](a,r),this["~registerStatusCallback"]=a=>F(this,ke)["~registerStatusCallback"](a),this["~registerErrorCallback"]=a=>F(this,ke)["~registerErrorCallback"](a),ye(this,ke,s)}};ke=new WeakMap;function Un({experimental_throttle:t,resume:e=!1,...s}={}){const a=E.useRef("chat"in s?{}:{onToolCall:s.onToolCall,onData:s.onData,onFinish:s.onFinish,onError:s.onError,sendAutomaticallyWhen:s.sendAutomaticallyWhen});"chat"in s||(a.current={onToolCall:s.onToolCall,onData:s.onData,onFinish:s.onFinish,onError:s.onError,sendAutomaticallyWhen:s.sendAutomaticallyWhen});const r={...s,onToolCall:h=>{var f,v;return(v=(f=a.current).onToolCall)==null?void 0:v.call(f,h)},onData:h=>{var f,v;return(v=(f=a.current).onData)==null?void 0:v.call(f,h)},onFinish:h=>{var f,v;return(v=(f=a.current).onFinish)==null?void 0:v.call(f,h)},onError:h=>{var f,v;return(v=(f=a.current).onError)==null?void 0:v.call(f,h)},sendAutomaticallyWhen:h=>{var f,v,x;return(x=(v=(f=a.current).sendAutomaticallyWhen)==null?void 0:v.call(f,h))!=null?x:!1}},n=E.useRef("chat"in s?s.chat:new os(r));("chat"in s&&s.chat!==n.current||"id"in s&&n.current.id!==s.id)&&(n.current="chat"in s?s.chat:new os(r));const o=E.useCallback(h=>n.current["~registerMessagesCallback"](h,t),[t,n.current.id]),c=E.useSyncExternalStore(o,()=>n.current.messages,()=>n.current.messages),l=E.useSyncExternalStore(n.current["~registerStatusCallback"],()=>n.current.status,()=>n.current.status),d=E.useSyncExternalStore(n.current["~registerErrorCallback"],()=>n.current.error,()=>n.current.error),m=E.useCallback(h=>{typeof h=="function"&&(h=h(n.current.messages)),n.current.messages=h},[n]);return E.useEffect(()=>{e&&n.current.resumeStream()},[e,n]),{id:n.current.id,messages:c,setMessages:m,sendMessage:n.current.sendMessage,regenerate:n.current.regenerate,clearError:n.current.clearError,stop:n.current.stop,error:d,resumeStream:n.current.resumeStream,status:l,addToolResult:n.current.addToolOutput,addToolOutput:n.current.addToolOutput,addToolApprovalResponse:n.current.addToolApprovalResponse}}function zn(t){const{buildUrl:e,eventTypes:s}=t,a=new Map;function r(n){let i=a.get(n);if(!i){const o=new EventSource(e(n));i={es:o,refCount:0},a.set(n,i),o.onerror=()=>{o.readyState===EventSource.CLOSED&&a.delete(n)}}return i}return{subscribe(n,i){const o=r(n);o.refCount++;for(const l of s)o.es.addEventListener(l,i);let c=!1;return()=>{if(!c){c=!0;for(const l of s)o.es.removeEventListener(l,i);o.refCount--,o.refCount<=0&&(o.es.close(),a.delete(n))}}}}}const Bn=zn({buildUrl:t=>{const e=Zt.join(",");return`/org/${t}/watch?types=${e}`},eventTypes:[...Zt]}),is=()=>0;function Hs(t){const{orgId:e,taskId:s,enabled:a=!0,onStep:r,onFinish:n,onTaskStatus:i}=t,o=E.useRef({taskId:s,onStep:r,onFinish:n,onTaskStatus:i});o.current={taskId:s,onStep:r,onFinish:n,onTaskStatus:i};const c=E.useRef(null),l=E.useRef(a),d=E.useRef(e);(!c.current||l.current!==a||d.current!==e)&&(l.current=a,d.current=e,c.current=m=>{if(!a||!e)return()=>{};const h=f=>{let v;try{v=JSON.parse(f.data)}catch{return}const x=o.current;if(!(x.taskId&&v.subject!==x.taskId)){switch(v.type){case ut.STEP:x.onStep?.(v);break;case ut.FINISH:x.onFinish?.(v);break;case ut.THREAD_STATUS:x.onTaskStatus?.(v);break}m()}};return Bn.subscribe(e,h)}),E.useSyncExternalStore(c.current,is,is)}function Gs(){const t=U.c(21),{locator:e,org:s}=Ie();let a;t[0]!==e?(a=de.allowedModels(e),t[0]=e,t[1]=a):a=t[1];let r;t[2]!==s?(r=async()=>{const S=await fetch(`/api/${s.slug}/decopilot/allowed-models`,{credentials:"include"});return S.ok?S.json():{allowAll:!0,models:{}}},t[2]=s,t[3]=r):r=t[3];let n;t[4]!==a||t[5]!==r?(n={queryKey:a,queryFn:r,staleTime:3e4},t[4]=a,t[5]=r,t[6]=n):n=t[6];const{data:i,isLoading:o}=Ma(n),c=i?.allowAll??!0;let l;t[7]!==i?.models?(l=i?.models??{},t[7]=i?.models,t[8]=l):l=t[8];const d=l;let m;t[9]!==c||t[10]!==d?(m=(S,y)=>{if(c)return!0;const _=d[S];return _?_.includes("*")||_.includes(y):d["*"]?.includes("*")??!1},t[9]=c,t[10]=d,t[11]=m):m=t[11];const h=m;let f;t[12]!==c||t[13]!==d?(f=S=>{if(c)return!0;const y=d[S];if(y&&y.length>0)return!0;const _=d["*"];return _?_.length>0:!1},t[12]=c,t[13]=d,t[14]=f):f=t[14];const v=f;let x;return t[15]!==c||t[16]!==v||t[17]!==o||t[18]!==h||t[19]!==d?(x={allowAll:c,models:d,isLoading:o,isModelAllowed:h,hasConnectionModels:v},t[15]=c,t[16]=v,t[17]=o,t[18]=h,t[19]=d,t[20]=x):x=t[20],x}function Vn(t){const e=U.c(10);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={strict:!1},e[0]=s):s=e[0];const a=hs(s);let r;if(e[1]!==a.collectionName||e[2]!==a.connectionId||e[3]!==a.itemId||e[4]!==t){r=[],t&&r.push(`### Selected Agent
|
|
12
|
+
- ID: ${t}`);let n;e[6]!==a.collectionName||e[7]!==a.connectionId||e[8]!==a.itemId?(n=[],a.connectionId&&n.push(`- Connection ID: ${a.connectionId}`),a.collectionName&&n.push(`- Collection: ${a.collectionName}`),a.itemId&&n.push(`- Item ID: ${a.itemId}`),e[6]=a.collectionName,e[7]=a.connectionId,e[8]=a.itemId,e[9]=n):n=e[9],n.length>0&&r.push(`### Current Resource
|
|
13
|
+
The user is viewing the following resource:
|
|
14
|
+
${n.join(`
|
|
15
|
+
`)}
|
|
16
|
+
|
|
17
|
+
Help the user understand and work with this resource.`),e[1]=a.collectionName,e[2]=a.connectionId,e[3]=a.itemId,e[4]=t,e[5]=r}else r=e[5];return r.join(`
|
|
18
|
+
|
|
19
|
+
`)}function qn(){const t=U.c(5),e=at(),{org:s}=Ie();let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a={strict:!1},t[0]=a):a=t[0];const r=hs(a);let n;return t[1]!==s||t[2]!==r||t[3]!==e?(n=i=>{const c=i.toolCall.toolName.match(/^COLLECTION_([A-Z_]+)_(CREATE|UPDATE|DELETE)$/);if(!c||!c[1])return;const l=c[1],d=r.connectionId;if(!d)return;e.invalidateQueries({queryKey:de.collection(s.slug,d,l)});const m=l.toLowerCase().replace(/_/g," ");Re.success(`${m} updated`)},t[1]=s,t[2]=r,t[3]=e,t[4]=n):n=t[4],n}const ft=(()=>{if(typeof window>"u")return null;const t=new Audio("/sounds/notification.mp3");return t.preload="auto",t.addEventListener("error",e=>{console.warn("Failed to preload notification sound:",e)}),t.load(),t})();function Wn(){return{showNotification:async e=>{const{title:s,body:a,icon:r="/favicon.svg",tag:n}=e;if(typeof Notification>"u")return;if(Notification.permission!=="granted"){Notification.requestPermission().then(o=>{o==="denied"&&Re.error("Notifications denied. Please enable them in your browser settings.")});return}if(document?.hasFocus())return;ft&&(ft.currentTime=0,ft.play().catch(o=>{console.warn("Failed to play notification sound:",o)}));const i=new Notification(s,{body:a,icon:r,tag:n});i.onclick=()=>{window.focus(),i.close()}}}}const ls=["smarter","faster","cheaper"],cs={smarter:"Smarter",faster:"Faster",cheaper:"Cheaper"},Jn=[{tier:"smarter",prefixes:["anthropic/claude-4.6-opus","anthropic/claude-opus-4.6","anthropic/claude-sonnet-4.6","anthropic/claude-4.6-sonnet","openai/gpt-5.3-codex","google/gemini-3-pro","google/gemini-2.5-pro","cohere/command-r-plus","cohere/command-a"]},{tier:"faster",prefixes:["anthropic/claude-haiku-4.5","anthropic/claude-4.5-haiku","google/gemini-3-flash","openai/gpt-5.1-codex-mini","x-ai/grok-code-fast","x-ai/grok-3","mistralai/mistral-large","mistralai/codestral","mistralai/mistral-medium","qwen/qwen-plus","qwen/qwen-turbo","qwen/qwen3-235b","minimax/minimax-m1"]},{tier:"cheaper",prefixes:["google/gemini-2.5-flash-lite","google/gemini-2.5-flash","google/gemini-2.0-flash","deepseek/deepseek-v3","openai/gpt-oss-120b","mistralai/mistral-small","mistralai/pixtral","qwen/qwen-long","cohere/command-r"]}],Hn=":free",Gn=Jn.flatMap(({tier:t,prefixes:e})=>e.map(s=>({tier:t,prefix:s}))).sort((t,e)=>e.prefix.length-t.prefix.length),Yn=new Set(["google/gemini-2.5-pro"]);function Qn(t){if(t.endsWith(Hn))return"cheaper";for(const{tier:e,prefix:s}of Gn)if(t.startsWith(s)){if(Yn.has(s)&&t.length>s.length&&t[s.length]==="-"){const r=t[s.length+1];if(!r||!/\d/.test(r))continue}return e}return null}const Ys=["anthropic/claude-4.6-opus-20260205","anthropic/claude-opus-4.6","anthropic/claude-sonnet-4.6","anthropic/claude-4.6-sonnet","anthropic/claude-sonnet-4.6:extended","openai/gpt-5.3-codex","google/gemini-3-pro-preview","google/gemini-2.5-pro","anthropic/claude-haiku-4.5","anthropic/claude-haiku-4.5-20251001","anthropic/claude-4.5-haiku","google/gemini-3-flash-preview","openai/gpt-5.1-codex-mini","x-ai/grok-code-fast-1","google/gemini-2.5-flash","deepseek/deepseek-v3.2","google/gemini-2.5-flash-lite","openai/gpt-oss-120b:free"],us=new Set(Ys),_t=new Map;Ys.forEach((t,e)=>_t.set(t,e));const Qs="mesh:model-shortlist:";function Kn(t){try{const e=localStorage.getItem(Qs+t);return e?JSON.parse(e):null}catch{return null}}function Xn(t,e){localStorage.setItem(Qs+t,JSON.stringify(e))}function kt(t){const e=U.c(3);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={pageSize:999},e[0]=s):s=e[0];const a=Aa(t??void 0,s);let r;return e[1]!==a?(r=a.filter(to).sort(eo),e[1]=a,e[2]=r):r=e[2],r}function eo(t,e){const s=_t.get(t.id),a=_t.get(e.id);return s!==void 0&&a!==void 0?s-a:s!==void 0?-1:a!==void 0?1:t.title.localeCompare(e.title)}function to(t){return t.limits?.contextWindow&&t.limits?.maxOutputTokens}function so(t){return t<32e3?{level:1,label:"Small",description:"Short conversations"}:t<2e5?{level:2,label:"Medium",description:"Good for most tasks"}:t<5e5?{level:3,label:"Large",description:"Long projects & research"}:{level:4,label:"Very large",description:"Massive files & data"}}const ao=["bg-destructive","bg-warning","bg-success","bg-success"],ro=["text-success","text-warning","text-warning","text-destructive"];function no(t){const e=Math.round(t*.75/1e3);return e>=1?`~${e}K words`:`~${Math.round(t*.75)} words`}function oo(t){return t<1?{level:1,label:"Cheap"}:t<5?{level:2,label:"Moderate"}:t<15?{level:3,label:"High"}:{level:4,label:"Expensive"}}const io={text:{icon:u.jsx(Ba,{className:"size-3.5"}),label:"Text"},vision:{icon:u.jsx(qa,{className:"size-3.5"}),label:"Vision"},tools:{icon:u.jsx(bs,{className:"size-3.5"}),label:"Tools"},reasoning:{icon:u.jsx(xs,{className:"size-3.5"}),label:"Reasoning"},"web-search":{icon:u.jsx(vs,{className:"size-3.5"}),label:"Web search"}};function lo(t){const e=U.c(5),{capability:s}=t;let a;e[0]!==s?(a=io[s]??{icon:null,label:s.charAt(0).toUpperCase()+s.slice(1)},e[0]=s,e[1]=a):a=e[1];const r=a;let n;return e[2]!==r.icon||e[3]!==r.label?(n=u.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground border border-border rounded px-2 py-0.5",children:[r.icon,r.label]}),e[2]=r.icon,e[3]=r.label,e[4]=n):n=e[4],n}function co(t){const e=U.c(53),{model:s,compact:a}=t,r=a===void 0?!1:a;if(!s){let g;return e[0]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Hover to preview"}),e[0]=g):g=e[0],g}const n=s.costs?.input!=null?s.costs.input*1e6:null,i=s.costs?.output!=null?s.costs.output*1e6:null;let o;e[1]!==s.id||e[2]!==s.provider||e[3]!==s.title?(o=s.title.includes(": ")?s.title.split(": ")[0]:s.provider??s.id.split("/")[0],e[1]=s.id,e[2]=s.provider,e[3]=s.title,e[4]=o):o=e[4];const c=o;let l;e[5]!==s.title?(l=s.title.includes(": ")?s.title.split(": ").slice(1).join(": "):s.title,e[5]=s.title,e[6]=l):l=e[6];const d=l;if(r){let g;e[7]!==s.limits?(g=s.limits?.contextWindow&&u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx("span",{className:"text-muted-foreground",children:"Context"}),u.jsxs("span",{className:"text-foreground font-medium",children:[s.limits.contextWindow.toLocaleString()," tokens"]})]}),e[7]=s.limits,e[8]=g):g=e[8];let w;e[9]!==n?(w=n!=null&&u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx("span",{className:"text-muted-foreground",children:"Input"}),u.jsxs("span",{className:"text-foreground font-medium",children:["$",n.toFixed(2)," / 1M"]})]}),e[9]=n,e[10]=w):w=e[10];let T;e[11]!==i?(T=i!=null&&u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx("span",{className:"text-muted-foreground",children:"Output"}),u.jsxs("span",{className:"text-foreground font-medium",children:["$",i.toFixed(2)," / 1M"]})]}),e[11]=i,e[12]=T):T=e[12];let D;e[13]!==s.limits?(D=s.limits?.maxOutputTokens&&u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx("span",{className:"text-muted-foreground",children:"Output limit"}),u.jsxs("span",{className:"text-foreground font-medium",children:[s.limits.maxOutputTokens.toLocaleString()," tokens"]})]}),e[13]=s.limits,e[14]=D):D=e[14];let R;return e[15]!==g||e[16]!==w||e[17]!==T||e[18]!==D?(R=u.jsxs("div",{className:"flex flex-col gap-2 pt-3 pb-3 px-3 text-xs",children:[g,w,T,D]}),e[15]=g,e[16]=w,e[17]=T,e[18]=D,e[19]=R):R=e[19],R}let m;e[20]!==c?(m=u.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:c}),e[20]=c,e[21]=m):m=e[21];let h;e[22]!==s.logo||e[23]!==s.title?(h=s.logo&&u.jsx("img",{src:s.logo,className:"size-6 shrink-0 rounded-md",alt:s.title}),e[22]=s.logo,e[23]=s.title,e[24]=h):h=e[24];let f;e[25]!==d?(f=u.jsx("p",{className:"text-lg font-semibold leading-snug tracking-tight",children:d}),e[25]=d,e[26]=f):f=e[26];let v;e[27]!==h||e[28]!==f?(v=u.jsxs("div",{className:"flex items-center gap-2.5",children:[h,f]}),e[27]=h,e[28]=f,e[29]=v):v=e[29];let x;e[30]!==s.id?(x=u.jsx("p",{className:"text-xs text-muted-foreground/50 font-mono",children:s.id}),e[30]=s.id,e[31]=x):x=e[31];let S;e[32]!==m||e[33]!==v||e[34]!==x?(S=u.jsxs("div",{className:"flex flex-col gap-1 pt-1 pr-6",children:[m,v,x]}),e[32]=m,e[33]=v,e[34]=x,e[35]=S):S=e[35];let y;e[36]!==s.capabilities?(y=s.capabilities&&s.capabilities.length>0&&u.jsx("div",{className:"flex flex-wrap items-center gap-1.5 pb-4 border-b border-border",children:s.capabilities.map(uo)}),e[36]=s.capabilities,e[37]=y):y=e[37];let _;e[38]!==s.limits?(_=s.limits?.contextWindow&&(()=>{const{level:g,label:w,description:T}=so(s.limits.contextWindow);return u.jsxs("div",{className:"flex flex-col gap-1.5",children:[u.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Context window"}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("div",{className:"flex items-center gap-0.5",children:[1,2,3,4].map(D=>u.jsx("div",{className:ze("w-2 h-2 rounded-full",D<=g?ao[g-1]:"bg-muted")},D))}),u.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:w}),u.jsxs("span",{className:"text-xs text-muted-foreground",children:["— ",T]})]}),u.jsxs("span",{className:"text-sm text-muted-foreground",children:[s.limits.contextWindow.toLocaleString()," tokens"]})]})})(),e[38]=s.limits,e[39]=_):_=e[39];let p;e[40]!==s.limits?(p=s.limits?.maxOutputTokens&&u.jsxs("div",{className:"flex flex-col gap-1",children:[u.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Output limit"}),u.jsxs("div",{className:"flex items-baseline gap-2",children:[u.jsxs("span",{className:"text-sm text-foreground",children:[s.limits.maxOutputTokens.toLocaleString()," tokens"]}),u.jsx("span",{className:"text-sm text-muted-foreground",children:no(s.limits.maxOutputTokens)})]})]}),e[40]=s.limits,e[41]=p):p=e[41];let N;e[42]!==n||e[43]!==i?(N=(n!=null||i!=null)&&(()=>{const{level:g,label:w}=n!=null?oo(n):{level:0,label:""};return u.jsxs("div",{className:"flex flex-col gap-2",children:[u.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Pricing"}),n!=null&&u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("div",{className:"flex items-center",children:[1,2,3,4].map(T=>u.jsx("span",{className:ze("text-sm font-bold leading-none",T<=g?ro[g-1]:"text-muted-foreground/20"),children:"$"},T))}),u.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:w})]}),u.jsxs("div",{className:"flex flex-col gap-1",children:[n!=null&&u.jsxs("div",{className:"flex justify-between items-center",children:[u.jsx("span",{className:"text-xs text-muted-foreground",children:"Input"}),u.jsxs("span",{className:"text-xs text-foreground",children:["$",n.toFixed(2)," / 1M tokens"]})]}),i!=null&&u.jsxs("div",{className:"flex justify-between items-center",children:[u.jsx("span",{className:"text-xs text-muted-foreground",children:"Output"}),u.jsxs("span",{className:"text-xs text-foreground",children:["$",i.toFixed(2)," / 1M tokens"]})]})]})]})})(),e[42]=n,e[43]=i,e[44]=N):N=e[44];let C;e[45]!==_||e[46]!==p||e[47]!==N?(C=u.jsxs("div",{className:"flex flex-col gap-6",children:[_,p,N]}),e[45]=_,e[46]=p,e[47]=N,e[48]=C):C=e[48];let I;return e[49]!==y||e[50]!==C||e[51]!==S?(I=u.jsxs("div",{className:"flex flex-col gap-5 py-1 px-1.5",children:[S,y,C]}),e[49]=y,e[50]=C,e[51]=S,e[52]=I):I=e[52],I}function uo(t){return u.jsx(lo,{capability:t},t)}function ds(t){const e=U.c(23),{model:s,onHover:a}=t;let r;e[0]!==s.title?(r=s.title.includes(": ")?s.title.split(": ").slice(1).join(": "):s.title,e[0]=s.title,e[1]=r):r=e[1];const n=r;let i;e[2]!==s.id||e[3]!==s.provider||e[4]!==s.title?(i=s.title.includes(": ")?s.title.split(": ")[0]:s.provider??s.id.split("/")[0],e[2]=s.id,e[3]=s.provider,e[4]=s.title,e[5]=i):i=e[5];const o=i;let c;e[6]!==s||e[7]!==a?(c=()=>a(s),e[6]=s,e[7]=a,e[8]=c):c=e[8];let l;e[9]!==s.logo||e[10]!==s.title?(l=s.logo&&u.jsx("img",{src:s.logo,className:"w-4 h-4 shrink-0 rounded-sm",alt:s.title}),e[9]=s.logo,e[10]=s.title,e[11]=l):l=e[11];let d;e[12]!==n?(d=u.jsx("span",{className:"text-sm text-foreground leading-tight truncate",children:n}),e[12]=n,e[13]=d):d=e[13];let m;e[14]!==o?(m=u.jsx("span",{className:"text-xs text-muted-foreground/60 leading-tight",children:o}),e[14]=o,e[15]=m):m=e[15];let h;e[16]!==d||e[17]!==m?(h=u.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[d,m]}),e[16]=d,e[17]=m,e[18]=h):h=e[18];let f;return e[19]!==c||e[20]!==l||e[21]!==h?(f=u.jsxs("div",{className:"flex items-center gap-2.5 py-2 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:c,children:[l,h]}),e[19]=c,e[20]=l,e[21]=h,e[22]=f):f=e[22],f}function po(t){const e=U.c(21),{error:s,onRetry:a,connectionId:r,orgSlug:n}=t,i=va();let o;e[0]!==r||e[1]!==i||e[2]!==n?(o=()=>{!r||!n||i({to:"/$org/$project/mcps/$connectionId",params:{org:n,project:ya,connectionId:r}})},e[0]=r,e[1]=i,e[2]=n,e[3]=o):o=e[3];const c=o;let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx("div",{className:"bg-destructive/10 p-2 rounded-full",children:u.jsx(xa,{className:"size-5 text-destructive"})}),e[4]=l):l=e[4];let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsx("p",{className:"text-sm font-medium text-foreground",children:"Failed to load models"}),e[5]=d):d=e[5];const m=s?.message||"Could not fetch models from this provider.";let h;e[6]!==m?(h=u.jsxs("div",{className:"flex flex-col gap-1",children:[d,u.jsxs("p",{className:"text-xs text-muted-foreground max-w-[260px]",children:[m," Try another provider or retry."]})]}),e[6]=m,e[7]=h):h=e[7];let f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=u.jsx(Wa,{className:"size-3.5"}),e[8]=f):f=e[8];let v;e[9]!==a?(v=u.jsxs(et,{variant:"outline",size:"sm",onClick:a,className:"gap-1.5",children:[f,"Retry"]}),e[9]=a,e[10]=v):v=e[10];let x;e[11]!==r||e[12]!==c||e[13]!==n?(x=r&&n&&u.jsxs(et,{variant:"outline",size:"sm",onClick:c,className:"gap-1.5",children:[u.jsx(Tt,{className:"size-3.5"}),"Configure"]}),e[11]=r,e[12]=c,e[13]=n,e[14]=x):x=e[14];let S;e[15]!==v||e[16]!==x?(S=u.jsxs("div",{className:"flex items-center gap-2",children:[v,x]}),e[15]=v,e[16]=x,e[17]=S):S=e[17];let y;return e[18]!==h||e[19]!==S?(y=u.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-4 py-8 text-center",children:[l,h,S]}),e[18]=h,e[19]=S,e[20]=y):y=e[20],y}function mo(){const t=U.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:Array.from({length:6}).map(fo)}),t[0]=e):e=t[0],e}function fo(t,e){return u.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[u.jsx(q,{className:"size-5 shrink-0 rounded-sm"}),u.jsx(q,{className:"flex-1 h-4"}),u.jsx(q,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function ho({connectionId:t,allowAll:e,isModelAllowed:s,searchTerm:a,selectedModel:r,onModelSelect:n,onHover:i,managing:o,onToggleManage:c,allModelsRef:l,onSelectedModelResolved:d}){const m=kt(t??void 0);l.current=m,E.useEffect(()=>{if(r&&m.length>0){const g=m.find(w=>w.id===r.thinking.id)??null;g&&d(g)}},[r,m,d]);const h=e?m:m.filter(g=>t&&s(t,g.id)),[f,v]=E.useState(0),x=t?Kn(t):null,S=x?new Set(x):us,y=g=>{const w={smarter:[],faster:[],cheaper:[],other:[]};for(const T of g){const D=Qn(T.id);w[D??"other"].push(T)}for(const T of Object.keys(w))w[T].sort((D,R)=>D.title.localeCompare(R.title));return w};if(o){const g=a.trim()?h.filter(R=>{const M=a.toLowerCase();return R.title.toLowerCase().includes(M)||R.provider?.toLowerCase().includes(M)}):h,w=y(g),T=R=>{if(!t)return;const M=x??[...us],k=M.includes(R)?M.filter(B=>B!==R):[...M,R];Xn(t,k),v(B=>B+1)},D=(R,M)=>M.length===0?null:u.jsxs("div",{children:[u.jsx("div",{className:"text-xs font-medium text-muted-foreground px-3 pt-3 pb-1",children:R}),M.map(k=>u.jsxs("label",{className:"flex items-center gap-3 min-h-8 py-2.5 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:()=>i(k),children:[u.jsx(ka,{checked:S.has(k.id),onCheckedChange:()=>T(k.id)}),k.logo&&u.jsx("img",{src:k.logo,className:"w-5 h-5 shrink-0",alt:k.title}),u.jsx("span",{className:"text-sm text-foreground flex-1 min-w-0 line-clamp-1",children:k.title})]},k.id))]},R);return u.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[u.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[u.jsxs("button",{type:"button",onClick:c,className:"flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground cursor-pointer",children:[u.jsx(Va,{size:14}),"Back"]}),u.jsxs("span",{className:"text-xs text-muted-foreground",children:[h.filter(R=>S.has(R.id)).length," selected"]})]}),u.jsxs("div",{className:"flex-1 overflow-y-auto px-0.5 pt-1",children:[ls.map(R=>D(cs[R],w[R])),D("Other",w.other)]})]})}const _=h.filter(g=>S.has(g.id)),p=_.length>0?_:h,N=a.trim()?p.filter(g=>{const w=a.toLowerCase();return g.title.toLowerCase().includes(w)||g.provider?.toLowerCase().includes(w)||g.description?.toLowerCase().includes(w)}):p;if(N.length===0)return u.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center py-8 gap-3",children:[u.jsx("p",{className:"text-sm text-muted-foreground",children:"No models found"}),u.jsxs(et,{variant:"outline",size:"sm",onClick:c,className:"gap-1.5",children:[u.jsx(Tt,{className:"size-3.5"}),"Manage models"]})]});if(a.trim().length>0)return u.jsx("div",{className:"flex-1 overflow-y-auto p-2",children:N.map(g=>{const w=g.id===r?.thinking.id;return u.jsx("div",{onClick:()=>n(g),className:ze("rounded-lg mb-1",w&&"bg-accent/50"),children:u.jsx(ds,{model:g,onHover:i})},g.id)})});const C=y(N),I=(g,w)=>w.length===0?null:u.jsxs("div",{children:[u.jsx("div",{className:"text-xs font-medium text-muted-foreground px-3 pt-3 pb-1",children:g}),w.map(T=>{const D=T.id===r?.thinking.id;return u.jsx("div",{onClick:()=>n(T),className:ze("rounded-lg mb-1",D&&"bg-accent/50"),children:u.jsx(ds,{model:T,onHover:i})},T.id)})]},g);return u.jsxs("div",{className:"flex-1 overflow-y-auto p-2",children:[ls.map(g=>I(cs[g],C[g])),C.other.length>0&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"mx-3 my-2 border-t border-border"}),I("Other",C.other)]})]})}function Rt(t){const e=U.c(16),{model:s,placeholder:a}=t,r=a===void 0?"Select model":a;if(!s){let m;e[0]!==r?(m=u.jsx("span",{className:"text-sm text-muted-foreground",children:r}),e[0]=r,e[1]=m):m=e[1];let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsx(ht,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[2]=h):h=e[2];let f;return e[3]!==m?(f=u.jsxs("div",{className:"flex items-center gap-1.5",children:[m,h]}),e[3]=m,e[4]=f):f=e[4],f}let n;e[5]!==s.title?(n=s.title.includes(": ")?s.title.split(": ").slice(1).join(": "):s.title,e[5]=s.title,e[6]=n):n=e[6];const i=n;let o;e[7]!==s.logo||e[8]!==s.title?(o=s.logo&&u.jsx("img",{src:s.logo,className:"w-5 h-5 shrink-0 rounded-sm",alt:s.title}),e[7]=s.logo,e[8]=s.title,e[9]=o):o=e[9];let c;e[10]!==i?(c=u.jsx("span",{className:"text-sm text-muted-foreground truncate whitespace-nowrap hidden md:inline",children:i}),e[10]=i,e[11]=c):c=e[11];let l;e[12]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx(ht,{size:14,className:"text-muted-foreground opacity-50 shrink-0 hidden md:inline"}),e[12]=l):l=e[12];let d;return e[13]!==o||e[14]!==c?(d=u.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 overflow-hidden",children:[o,c,l]}),e[13]=o,e[14]=c,e[15]=d):d=e[15],d}function Ii(t){return t?.thinking?.capabilities?.vision===!0}function go(){const t=U.c(6);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx("div",{className:"border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",children:u.jsxs("div",{className:"flex items-center gap-2.5 h-12 px-4",children:[u.jsx(q,{className:"size-4 shrink-0"}),u.jsx(q,{className:"flex-1 h-6"}),u.jsx(q,{className:"w-[140px] h-8 shrink-0"})]})}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=u.jsxs("div",{className:"flex-1 flex flex-col md:border-r md:w-[420px] md:min-w-[420px]",children:[e,u.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:Array.from({length:8}).map(vo)})]}),t[1]=s):s=t[1];let a;t[2]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[u.jsx(q,{className:"size-6 shrink-0"}),u.jsx(q,{className:"h-6 w-32"})]}),t[2]=a):a=t[2];let r;t[3]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsxs("div",{className:"flex flex-col gap-3 py-2 px-0",children:[a,u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(q,{className:"h-6 w-20 rounded-md"}),u.jsx(q,{className:"h-6 w-24 rounded-md"})]})]}),t[3]=r):r=t[3];let n;t[4]===Symbol.for("react.memo_cache_sentinel")?(n=u.jsxs("div",{className:"flex flex-col gap-1.5",children:[u.jsx(q,{className:"h-4 w-24"}),u.jsx(q,{className:"h-4 w-32"})]}),t[4]=n):n=t[4];let i;return t[5]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsxs("div",{className:"flex flex-col md:flex-row h-[460px]",children:[s,u.jsx("div",{className:"hidden md:block md:w-[320px] md:shrink-0 p-3",children:u.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[r,u.jsxs("div",{className:"flex flex-col gap-4",children:[n,u.jsxs("div",{className:"flex flex-col gap-1.5",children:[u.jsx(q,{className:"h-4 w-16"}),u.jsx(q,{className:"h-4 w-40"})]})]})]})})]}),t[5]=i):i=t[5],i}function vo(t,e){return u.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[u.jsx(q,{className:"size-5 shrink-0 rounded-sm"}),u.jsx(q,{className:"flex-1 h-4"}),u.jsx(q,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function yo(t){const e=U.c(51),{selectedModel:s,onModelChange:a,onClose:r,modelsConnections:n}=t,[i,o]=E.useState(null),[c,l]=E.useState(""),[d,m]=E.useState(!1),h=E.useRef(null);let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[0]=f):f=e[0];const v=E.useRef(f),[x,S]=E.useState(null),{org:y}=Ie(),_=Ct(),p=n??_,{isModelAllowed:N,allowAll:C,hasConnectionModels:I}=Gs();let g;e[1]!==p||e[2]!==C||e[3]!==I?(g=C?p:p.filter(W=>I(W.id)),e[1]=p,e[2]=C,e[3]=I,e[4]=g):g=e[4];const w=g,[T,D]=E.useState(s?.connectionId??w[0]?.id??null);let R,M;e[5]===Symbol.for("react.memo_cache_sentinel")?(R=()=>{setTimeout(()=>{h.current?.focus()},0)},M=[],e[5]=R,e[6]=M):(R=e[5],M=e[6]),E.useEffect(R,M);let k;e[7]===Symbol.for("react.memo_cache_sentinel")?(k=W=>{D(W),o(null)},e[7]=k):k=e[7];const B=k;let Q;e[8]!==r||e[9]!==a||e[10]!==T?(Q=W=>{T&&(a({id:W.id,connectionId:T,provider:W.provider??void 0,capabilities:W.capabilities,limits:W.limits??void 0}),l(""),r())},e[8]=r,e[9]=a,e[10]=T,e[11]=Q):Q=e[11];const re=Q;let z;e[12]===Symbol.for("react.memo_cache_sentinel")?(z=u.jsx(vs,{size:16,className:"text-muted-foreground shrink-0"}),e[12]=z):z=e[12];const ne=d?"Search all models...":"Search for a model...";let Se;e[13]===Symbol.for("react.memo_cache_sentinel")?(Se=W=>l(W.target.value),e[13]=Se):Se=e[13];let oe;e[14]!==c||e[15]!==ne?(oe=u.jsx(Ra,{ref:h,type:"text",placeholder:ne,value:c,onChange:Se,className:"flex-1 border-0 shadow-none focus-visible:ring-0 px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"}),e[14]=c,e[15]=ne,e[16]=oe):oe=e[16];let X;e[17]!==w||e[18]!==T?(X=w.length>0&&u.jsxs(La,{value:T??"",onValueChange:B,children:[u.jsxs(Za,{size:"sm",className:"w-auto min-w-[140px] h-8 shrink-0 [&>svg:last-child]:hidden",onClick:So,children:[u.jsx(Fa,{placeholder:"Select connection"}),u.jsx(ys,{className:"size-4 opacity-50 shrink-0 pointer-events-none"})]}),u.jsx(Ua,{children:w.map(bo)})]}),e[17]=w,e[18]=T,e[19]=X):X=e[19];let pe;e[20]!==oe||e[21]!==X?(pe=u.jsx("div",{className:"border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",children:u.jsxs("label",{className:"flex items-center gap-2.5 h-12 px-4 cursor-text",children:[z,oe,X]})}),e[20]=oe,e[21]=X,e[22]=pe):pe=e[22];let G;e[23]!==y.slug||e[24]!==T?(G=W=>{const{error:ot,resetError:it}=W;return u.jsx(po,{error:ot,onRetry:it,connectionId:T,orgSlug:y.slug})},e[23]=y.slug,e[24]=T,e[25]=G):G=e[25];let Ne;e[26]===Symbol.for("react.memo_cache_sentinel")?(Ne=u.jsx(mo,{}),e[26]=Ne):Ne=e[26];let Ce;e[27]===Symbol.for("react.memo_cache_sentinel")?(Ce=()=>m(xo),e[27]=Ce):Ce=e[27];let me;e[28]!==C||e[29]!==re||e[30]!==N||e[31]!==d||e[32]!==c||e[33]!==T||e[34]!==s?(me=u.jsx(E.Suspense,{fallback:Ne,children:u.jsx(ho,{connectionId:T,allowAll:C,isModelAllowed:N,searchTerm:c,selectedModel:s,onModelSelect:re,onHover:o,managing:d,onToggleManage:Ce,allModelsRef:v,onSelectedModelResolved:S})}),e[28]=C,e[29]=re,e[30]=N,e[31]=d,e[32]=c,e[33]=T,e[34]=s,e[35]=me):me=e[35];let fe;e[36]!==T||e[37]!==G||e[38]!==me?(fe=u.jsx(Et,{fallback:G,children:me},T),e[36]=T,e[37]=G,e[38]=me,e[39]=fe):fe=e[39];let he;e[40]!==d?(he=!d&&u.jsx("div",{className:"border-t border-border",children:u.jsxs("button",{type:"button",onClick:()=>m(!0),className:"flex items-center gap-2 w-full px-4 py-2.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent cursor-pointer",children:[u.jsx(Tt,{className:"size-3.5 shrink-0"}),"Manage models"]})}),e[40]=d,e[41]=he):he=e[41];let ie;e[42]!==pe||e[43]!==fe||e[44]!==he?(ie=u.jsxs("div",{className:"flex-1 flex flex-col md:border-r md:w-[420px] md:min-w-[420px]",children:[pe,fe,he]}),e[42]=pe,e[43]=fe,e[44]=he,e[45]=ie):ie=e[45];const De=i??x;let ge;e[46]!==De?(ge=u.jsx("div",{className:"hidden md:flex md:flex-col md:w-[320px] md:shrink-0 p-3",children:u.jsx(co,{model:De})}),e[46]=De,e[47]=ge):ge=e[47];let Te;return e[48]!==ie||e[49]!==ge?(Te=u.jsxs("div",{className:"flex flex-col md:flex-row h-[460px]",children:[ie,ge]}),e[48]=ie,e[49]=ge,e[50]=Te):Te=e[50],Te}function xo(t){return!t}function bo(t){return u.jsx(za,{value:t.id,children:u.jsxs("div",{className:"flex items-center gap-2",children:[t.icon?u.jsx("img",{src:t.icon,alt:t.title,className:"w-4 h-4 rounded"}):u.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:t.title.slice(0,1).toUpperCase()}),u.jsx("span",{children:t.title})]})},t.id)}function So(t){return t.stopPropagation()}function _o(t){const e=U.c(6),{selectedModel:s,placeholder:a}=t,r=s?.connectionId??void 0,n=kt(r);let i;e[0]!==n||e[1]!==s?(i=s?n.find(l=>l.id===s.thinking.id):void 0,e[0]=n,e[1]=s,e[2]=i):i=e[2];const o=i;let c;return e[3]!==o||e[4]!==a?(c=u.jsx(Rt,{model:o,placeholder:a}),e[3]=o,e[4]=a,e[5]=c):c=e[5],c}function Eo(t){const e=U.c(9),{selectedModel:s,placeholder:a}=t;if(!s){let d;return e[0]!==a?(d=u.jsx(Rt,{model:void 0,placeholder:a}),e[0]=a,e[1]=d):d=e[1],d}const r=s.thinking.id;let n;e[2]!==r?(n=r.split("/").pop()??r,e[2]=r,e[3]=n):n=e[3];const i=n;let o;e[4]!==i?(o=u.jsx("span",{className:"text-sm text-muted-foreground truncate whitespace-nowrap hidden md:inline",children:i}),e[4]=i,e[5]=o):o=e[5];let c;e[6]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(ht,{size:14,className:"text-muted-foreground opacity-50 shrink-0 hidden md:inline"}),e[6]=c):c=e[6];let l;return e[7]!==o?(l=u.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 overflow-hidden",children:[o,c]}),e[7]=o,e[8]=l):l=e[8],l}function Ni(t){const e=U.c(32),{selectedModel:s,onModelChange:a,modelsConnections:r,variant:n,className:i,placeholder:o}=t,c=n===void 0?"borderless":n,l=o===void 0?"Select model":o,[d,m]=E.useState(!1),h=Ct(),f=r??h;if(f.length===0)return null;const v=c==="borderless"?"ghost":"outline",x=c==="borderless"&&"md:border-none";let S;e[0]!==i||e[1]!==x?(S=ze("text-sm hover:bg-accent rounded-lg py-0.5 px-1 gap-1 shadow-none cursor-pointer border-0 group focus-visible:ring-0 focus-visible:ring-offset-0 min-w-0 shrink justify-start overflow-hidden",x,i),e[0]=i,e[1]=x,e[2]=S):S=e[2];let y;e[3]!==l||e[4]!==s?(y=u.jsx(Eo,{selectedModel:s,placeholder:l}),e[3]=l,e[4]=s,e[5]=y):y=e[5];let _;e[6]!==l?(_=u.jsx(Rt,{model:void 0,placeholder:l}),e[6]=l,e[7]=_):_=e[7];let p;e[8]!==l||e[9]!==s?(p=u.jsx(_o,{selectedModel:s,placeholder:l}),e[8]=l,e[9]=s,e[10]=p):p=e[10];let N;e[11]!==_||e[12]!==p?(N=u.jsx(E.Suspense,{fallback:_,children:p}),e[11]=_,e[12]=p,e[13]=N):N=e[13];let C;e[14]!==y||e[15]!==N?(C=u.jsx(Et,{fallback:y,children:N}),e[14]=y,e[15]=N,e[16]=C):C=e[16];let I;e[17]!==C||e[18]!==v||e[19]!==S?(I=u.jsx(Oa,{asChild:!0,children:u.jsx(et,{variant:v,size:"sm",className:S,children:C})}),e[17]=C,e[18]=v,e[19]=S,e[20]=I):I=e[20];let g;e[21]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx(Pa,{className:"sr-only",children:"Select model"}),e[21]=g):g=e[21];let w;e[22]===Symbol.for("react.memo_cache_sentinel")?(w=u.jsx(go,{}),e[22]=w):w=e[22];let T;e[23]===Symbol.for("react.memo_cache_sentinel")?(T=()=>m(!1),e[23]=T):T=e[23];let D;e[24]!==f||e[25]!==a||e[26]!==s?(D=u.jsxs(Da,{className:"p-0 gap-0 sm:max-w-fit overflow-hidden",closeButtonClassName:"top-3.5 right-3.5 z-20",children:[g,u.jsx(E.Suspense,{fallback:w,children:u.jsx(yo,{selectedModel:s,onModelChange:a,onClose:T,modelsConnections:f})})]}),e[24]=f,e[25]=a,e[26]=s,e[27]=D):D=e[27];let R;return e[28]!==d||e[29]!==I||e[30]!==D?(R=u.jsxs($a,{open:d,onOpenChange:m,children:[I,D]}),e[28]=d,e[29]=I,e[30]=D,e[31]=R):R=e[31],R}function wo(){const t=U.c(2),e=at();let s;return t[0]!==e?(s={prefillCollectionCache:(r,n,i,o)=>{if(!r)return;const c=At(r,n,i,o);if(e.getQueryData(c))return;const d={structuredContent:{items:[]},isError:!1};e.setQueryData(c,d)}},t[0]=e,t[1]=s):s=t[1],s}const ue={TASK_MESSAGES_PAGE_SIZE:100,TASKS_PAGE_SIZE:50,QUERY_STALE_TIME:3e4};function Ye(t,e,s,a,r,n){const i=de.tasks(e,r,n),o=t.getQueryData(i);if(!o)return;const c=o.pages.map(d=>{const m=d.items.findIndex(x=>x.id===s);if(m===-1)return d;const h=[...d.items],f=h[m];if(!f)return d;const v={...f,title:a.title??f.title,updated_at:a.updated_at??f.updated_at,hidden:a.hidden??f.hidden,status:a.status??f.status};return h[m]=v,{...d,items:h}});c.some((d,m)=>d.items.length!==o.pages[m]?.items.length||d.items.some((h,f)=>h.id===s&&h!==o.pages[m]?.items[f]))&&t.setQueryData(i,{...o,pages:c})}function Io(t,e,s,a,r){const n=de.tasks(e,a,r),i=t.getQueryData(n);if(!i){t.setQueryData(n,{pages:[{items:[s],hasMore:!1,totalCount:1}],pageParams:[0]});return}if(i.pages.some(l=>l.items.some(d=>d.id===s.id)))return;const c=i.pages[0];if(c){const l={...c,items:[s,...c.items],totalCount:(c.totalCount??c.items.length)+1};t.setQueryData(n,{...i,pages:[l,...i.pages.slice(1)]})}else t.setQueryData(n,{...i,pages:[{items:[s],hasMore:!1,totalCount:1}]})}async function No(t,e,s,a){if(!e)return;const r=At(e,"THREAD_MESSAGES",s,{filters:[{column:"thread_id",value:a}],pageSize:ue.TASK_MESSAGES_PAGE_SIZE});if(!r||t.getQueryData(r))return;const i="COLLECTION_THREAD_MESSAGES_LIST",o=Ja(void 0,[{column:"thread_id",value:a}],[]),c=Ha(void 0,void 0,"updated_at"),l={...o&&{where:o},...c&&{orderBy:c},limit:ue.TASK_MESSAGES_PAGE_SIZE,offset:0};await t.fetchQuery({queryKey:r,queryFn:async()=>await e.callTool({name:i,arguments:l}),staleTime:ue.QUERY_STALE_TIME,retry:!1})}function Co(t,e,s,a,r){if(!e)return;const n=At(e,"THREAD_MESSAGES",s,{filters:[{column:"thread_id",value:a}],pageSize:ue.TASK_MESSAGES_PAGE_SIZE});n&&t.setQueryData(n,{structuredContent:{items:r},isError:!1})}async function ps(t,e,s){if(!t)throw new Error("MCP client is not available");const a=await t.callTool({name:"COLLECTION_THREADS_UPDATE",arguments:{id:e,data:s}});return(a.structuredContent??a).item}function To(t){const e=new Date().toISOString();return{id:t,title:"New chat",created_at:e,updated_at:e}}function Ao(t,e){return t.find(s=>s.id!==e)??null}function Mo(t,e){const s=U.c(21),{locator:a,org:r}=Ie();let n;s[0]!==r.id?(n={connectionId:Nt,orgId:r.id},s[0]=r.id,s[1]=n):n=s[1];const i=It(n);let o;s[2]!==a||s[3]!==t||s[4]!==e?(o=de.tasks(a,t,t==="me"?e:void 0),s[2]=a,s[3]=t,s[4]=e,s[5]=o):o=s[5];let c;s[6]!==i||s[7]!==t||s[8]!==e?(c=async _=>{const{pageParam:p}=_,N=p===void 0?0:p;if(!i)throw new Error("MCP client is not available");if(t==="me"&&!e)return{items:[],hasMore:!1,totalCount:0};const C={limit:ue.TASKS_PAGE_SIZE,offset:N},I=t==="me"?{...C,where:{created_by:e}}:C,g=await i.callTool({name:"COLLECTION_THREADS_LIST",arguments:I}),w=g.structuredContent??g;return{items:w.items??[],hasMore:w.hasMore??!1,totalCount:w.totalCount}},s[6]=i,s[7]=t,s[8]=e,s[9]=c):c=s[9];let l;s[10]!==o||s[11]!==c?(l={queryKey:o,queryFn:c,getNextPageParam:ko,initialPageParam:0,staleTime:ue.QUERY_STALE_TIME},s[10]=o,s[11]=c,s[12]=l):l=s[12];const{data:d,fetchNextPage:m,hasNextPage:h,isFetchingNextPage:f,refetch:v}=Ya(l);let x;s[13]!==d?.pages?(x=d?.pages.flatMap(jo)??[],s[13]=d?.pages,s[14]=x):x=s[14];const S=x;let y;return s[15]!==m||s[16]!==h||s[17]!==f||s[18]!==v||s[19]!==S?(y={tasks:S,refetch:v,hasNextPage:h,isFetchingNextPage:f,fetchNextPage:m},s[15]=m,s[16]=h,s[17]=f,s[18]=v,s[19]=S,s[20]=y):y=s[20],y}function jo(t){return t.items}function ko(t,e){if(t.hasMore)return e.length*ue.TASKS_PAGE_SIZE}function Ro(t){const e=U.c(6),{org:s}=Ie();let a;e[0]!==s.id?(a={connectionId:Nt,orgId:s.id},e[0]=s.id,e[1]=a):a=e[1];const r=It(a);let n;e[2]!==t?(n={filters:t?[{column:"thread_id",value:t}]:[],pageSize:ue.TASK_MESSAGES_PAGE_SIZE},e[2]=t,e[3]=n):n=e[3];const i=Ga(s.id,"THREAD_MESSAGES",r,n);let o;return e[4]!==i?(o=i??[],e[4]=i,e[5]=o):o=e[5],o}function Oo(){const{locator:t,org:e}=Ie(),s=at(),{prefillCollectionCache:a}=wo(),{data:r}=gs.useSession(),n=r?.user?.id,i=M=>{try{const k=localStorage.getItem(Fe.chatTaskOwnerFilter(M));return k?JSON.parse(k):"me"}catch{return"me"}},[o,c]=E.useState(()=>i(t)),[l,d]=E.useState(t);l!==t&&(d(t),c(i(t)));const[m,h]=E.useTransition(),f=M=>{h(()=>c(M));try{localStorage.setItem(Fe.chatTaskOwnerFilter(t),JSON.stringify(M))}catch{}},{tasks:v,hasNextPage:x,isFetchingNextPage:S,fetchNextPage:y}=Mo(o,n),_=It({connectionId:Nt,orgId:e.id}),[p,N]=tt(Fe.assistantChatActiveTask(t),v[0]?.id??crypto.randomUUID()),C=Ro(p),I=()=>{const M=crypto.randomUUID(),k=To(M);Io(s,t,k,o,o==="me"?n:void 0),_&&a(_,"THREAD_MESSAGES",e.id,{filters:[{column:"thread_id",value:M}],pageSize:ue.TASK_MESSAGES_PAGE_SIZE}),N(M)},g=async M=>{await No(s,_,e.id,M),N(M)},w=(M,k)=>{Ye(s,t,M,k,o,o==="me"?n:void 0)},T=async(M,k)=>{try{const B=await ps(_,M,{title:k});B&&Ye(s,t,M,{title:k,updated_at:B.updated_at??new Date().toISOString()},o,o==="me"?n:void 0)}catch(B){const Q=B;Re.error(`Failed to rename task: ${Q.message}`),console.error("[chat] Failed to rename task:",B)}},D=async M=>{try{const k=await ps(_,M,{hidden:!0});if(k){if(M===p){const Q=Ao(v,M);Q?await g(Q.id):I()}Ye(s,t,M,{hidden:!0,updated_at:k.updated_at??new Date().toISOString()},o,o==="me"?n:void 0)}}catch(k){const B=k;Re.error(`Failed to update task: ${B.message}`),console.error("[chat] Failed to update task:",k)}},R=(M,k)=>{Co(s,_,e.id,M,k)};return Hs({orgId:e.id,enabled:!0,onTaskStatus:M=>{const k=M.subject,B=M.data.status,Q=M.time;for(const re of["me","everyone"]){const z=re==="me"?n:void 0;s.getQueryData(de.tasks(t,re,z))?.pages.some(oe=>oe.items.some(X=>X.id===k))??!1?Ye(s,t,k,{status:B,updated_at:Q},re,z):re==="everyone"&&s.invalidateQueries({queryKey:de.tasks(t,"everyone")})}}}),{tasks:v,activeTaskId:p,messages:C,hasNextPage:x,isFetchingNextPage:S,fetchNextPage:y,ownerFilter:o,setOwnerFilter:f,isFilterChangePending:m,createTask:I,switchToTask:g,updateTask:w,renameTask:T,hideTask:D,updateMessagesCache:R}}const Ks={parentTask:null,finishReason:null};function Po(t,e){switch(e.type){case"START_BRANCH":return{...t,parentTask:e.payload};case"CLEAR_BRANCH":return{...t,parentTask:null};case"SET_FINISH_REASON":return t.finishReason===e.payload?t:{...t,finishReason:e.payload};case"CLEAR_FINISH_REASON":return{...t,finishReason:null};case"RESET":return Ks;default:return t}}const Do=(t,e)=>new Ws({api:`/api/${t}/decopilot/stream`,credentials:"include",prepareReconnectToStreamRequest:({id:s})=>({api:`/api/${t}/decopilot/attach/${s}`}),prepareSendMessagesRequest:({messages:s,requestMetadata:a={}})=>{const{system:r,tiptapDoc:n,...i}=a,o=r?{id:crypto.randomUUID(),role:"system",parts:[{type:"text",text:r}]}:null,c=s.slice(-1).filter(Boolean),l=o?[o,...c]:c,d=s.at(-1)?.metadata??{},m={...i,agent:i.agent??d.agent,models:i.models??d.models,thread_id:i.thread_id??d.thread_id};return{body:{messages:l,...m,...e.current&&{toolApprovalLevel:e.current}}}}}),$o=(t,e)=>t?.find(s=>s.id===e)??t?.[0]??null,Lo=(t,e)=>{const s=U.c(11);let a;s[0]!==t?(a=Fe.chatSelectedModel(t),s[0]=t,s[1]=a):a=s[1];const[r,n]=tt(a,null),i=r?.connectionId;let o;s[2]!==e||s[3]!==i?(o=$o(e,i),s[2]=e,s[3]=i,s[4]=o):o=s[4];const c=o;let l;s[5]!==r||s[6]!==c?(l=r&&c?{connectionId:c.id,thinking:{id:r.id,provider:r.provider,capabilities:r.capabilities?{vision:r.capabilities.includes("vision")?!0:void 0,text:r.capabilities.includes("text")?!0:void 0,tools:r.capabilities.includes("tools")?!0:void 0}:void 0,limits:r.limits}}:null,s[5]=r,s[6]=c,s[7]=l):l=s[7];const d=l;let m;return s[8]!==d||s[9]!==n?(m=[d,n],s[8]=d,s[9]=n,s[10]=m):m=s[10],m};function Zo(t,e){const s=[];for(const a of t)"text"in a&&a.text?s.push({type:"text",text:`[${e}]
|
|
20
|
+
${a.text}`}):"blob"in a&&a.blob&&a.mimeType&&s.push({type:"file",url:`data:${a.mimeType};base64,${a.blob}`,filename:String(a.uri),mediaType:String(a.mimeType)});return s}function Fo(t,e){const s=[];for(const a of t){if(a.role!=="user"||!a.content)continue;const r=Array.isArray(a.content)?a.content:[a.content];for(const n of r)switch(n.type){case"text":{const i=n.text?.trim();if(!i)continue;s.push({type:"text",text:`[${e}]
|
|
21
|
+
${i}`});break}case"image":case"audio":{if(!n.data||!n.mimeType)continue;s.push({type:"file",url:`data:${n.mimeType};base64,${n.data}`,mediaType:n.mimeType});break}case"resource":{const i=n.resource;if(!i||!i.mimeType)continue;i&&("text"in i&&i.text?s.push({type:"text",text:`[${e}]
|
|
22
|
+
${i.text}`}):"blob"in i&&i.blob&&i.mimeType&&s.push({type:"file",url:`data:${i.mimeType};base64,${i.blob}`,filename:String(i.uri),mediaType:String(i.mimeType)}));break}}}return s}function Uo(t,e){const{mimeType:s,data:a}=t;if(s.startsWith("text/"))try{const r=atob(a);return[{type:"text",text:`${e}
|
|
23
|
+
${r}`}]}catch(r){console.error("Failed to decode text file:",r)}return[{type:"file",url:`data:${s};base64,${a}`,filename:e,mediaType:s}]}function zo(t){if(!t)return[];const e=[];let s="";const a=r=>{if(r){if(r.type==="text"&&"text"in r&&typeof r.text=="string")s+=r.text;else if(r.type==="mention"&&r.attrs){const n=r.attrs.char??"/",i=`${n}${r.attrs.name}`;if(s+=i,n==="@"){const o=r.attrs.metadata||[];e.push(...Zo(o,i))}else{const o=r.attrs.metadata||r.attrs.prompts||[];e.push(...Fo(o,i))}}else if(r.type==="file"&&r.attrs){const n=r.attrs,i=`[file:://${encodeURIComponent(n.name)}]`;s+=i,e.push(...Uo(n,i))}if("content"in r&&Array.isArray(r.content))for(const n of r.content)a(n)}};return a(t),s.trim()&&e.unshift({type:"text",text:s.trim()}),e}const Xs=E.createContext(null),ea=E.createContext(null);function Bo(t){const e=U.c(8),{modelsConnections:s,currentConfig:a,onAutoSelect:r,allowAll:n,isModelAllowed:i}=t,o=s[0],c=kt(o?.id);let l,d;return e[0]!==n||e[1]!==a||e[2]!==o||e[3]!==i||e[4]!==c||e[5]!==r?(l=()=>{if(a||!o||c.length===0)return;const m=n?c:c.filter(v=>i(o.id,v.id)),f=m.find(Jo)??m.find(Wo)??m.find(qo)??m.find(Vo)??m[0];f&&r({id:f.id,connectionId:o.id,provider:f.provider??void 0,capabilities:f.capabilities??void 0,limits:f.limits??void 0})},d=[c,a,o,r,n,i],e[0]=n,e[1]=a,e[2]=o,e[3]=i,e[4]=c,e[5]=r,e[6]=l,e[7]=d):(l=e[6],d=e[7]),E.useEffect(l,d),null}function Vo(t){return t.id.includes("claude-sonnet")}function qo(t){return t.id.includes("claude-sonnet-4.6")}function Wo(t){return t.id.includes("claude-opus-4.6")}function Jo(t){return t.id.includes("claude-4.6-opus")}const Ho=3e4,ms=()=>0;function Go(t){const e=U.c(24),{taskId:s,activeTask:a,isStreaming:r,chatRef:n,queryClient:i,locator:o,orgId:c}=t,l=E.useRef(null),d=E.useRef(0);let m;e[0]!==o||e[1]!==i||e[2]!==s?(m=()=>{i.invalidateQueries({queryKey:de.tasks(o)}),s&&i.invalidateQueries({predicate:I=>{const g=I.queryKey;return g[3]!=="collection"||g[4]!=="THREAD_MESSAGES"?!1:(typeof g[6]=="string"?g[6]:"").includes(s)}})},e[0]=o,e[1]=i,e[2]=s,e[3]=m):m=e[3];const h=m;let f;e[4]!==n||e[5]!==h||e[6]!==s?(f=I=>{!s||l.current===s||d.current>=3||(l.current=s,console.log(`[chat] resumeStream (${I})`,s),n.current.resumeStream().catch(g=>{console.error("[chat] resumeStream error",g),d.current=d.current+1,l.current=null,h()}))},e[4]=n,e[5]=h,e[6]=s,e[7]=f):f=e[7];const v=f;let x;e[8]!==v?(x=()=>v("sse-step"),e[8]=v,e[9]=x):x=e[9];let S,y;e[10]!==h||e[11]!==r?(S=()=>{l.current=null,d.current=0,r||h()},y=()=>{r||h()},e[10]=h,e[11]=r,e[12]=S,e[13]=y):(S=e[12],y=e[13]);let _;e[14]!==c||e[15]!==x||e[16]!==S||e[17]!==y||e[18]!==s?(_={orgId:c,taskId:s,onStep:x,onFinish:S,onTaskStatus:y},e[14]=c,e[15]=x,e[16]=S,e[17]=y,e[18]=s,e[19]=_):_=e[19],Hs(_);const p=(a?.status==="in_progress"||a?.status==="expired")&&!r;let N;e[20]!==h||e[21]!==p||e[22]!==v?(N=I=>{if(!p)return Yo;v("page-load");const g=setInterval(()=>h(),Ho);return()=>clearInterval(g)},e[20]=h,e[21]=p,e[22]=v,e[23]=N):N=e[23];const C=N;return E.useSyncExternalStore(C,ms,ms),null}function Yo(){}function Ci({children:t}){const{locator:e,org:s}=Ie(),a=at(),r=Oo(),{data:n}=gs.useSession(),i=n?.user??null,[o]=ja(),[c,l]=E.useReducer(Po,Ks),d=E.useRef(void 0),m=E.useRef(o.toolApprovalLevel);m.current=o.toolApprovalLevel;const h=Ta(),[f,v]=tt(`${e}:selected-virtual-mcp-id`,null),x=Ct(),{hasConnectionModels:S,isModelAllowed:y,allowAll:_}=Gs(),p=x.filter(P=>S(P.id)),[N,C]=Lo(e,p),[I,g]=tt(Fe.chatSelectedMode(e),"code_execution"),w=r.messages,T=Vn(f),D=qn(),{showNotification:R}=Wn(),M=f?h.find(P=>P.id===f)??null:null,k=Ca(s.id).id,B=Do(s.slug,m),Q=async({finishReason:P,isAbort:V,isDisconnect:te,isError:lt,message:ct,messages:Ge})=>{l({type:"SET_FINISH_REASON",payload:P??null});const Ae=ct.metadata?.thread_id??r.activeTaskId;if(V||te||lt){Ae&&Ge.length>0&&r.updateMessagesCache(Ae,Ge);return}Ae&&(Ge.length>0&&r.updateMessagesCache(Ae,Ge),o.enableNotifications&&R({tag:`chat-${Ae}`,title:"Decopilot is waiting for your input at",body:r.tasks.find(ia=>ia.id===Ae)?.title??"New chat"}))},re=P=>{console.error("[chat] Error",P)},z=Un({id:r.activeTaskId,messages:w,transport:B,sendAutomaticallyWhen:({messages:P})=>Pn({messages:P})||On({messages:P}),onFinish:Q,onToolCall:D,onError:re,onData:({data:P,type:V})=>{if(V==="data-thread-title"){const{title:te}=P;if(!te)return;r.updateTask(r.activeTaskId,{title:te,updated_at:new Date().toISOString()})}}}),ne=z.status==="submitted"||z.status==="streaming",Se=(()=>{const P=z.messages.at(-1);return!P||P.role!=="assistant"?!1:P.parts.some(V=>"state"in V&&V.state==="approval-requested")})(),oe=z.messages.length===0&&r.messages.length===0,X=r.tasks.find(P=>P.id===r.activeTaskId),pe=(X?.status==="in_progress"||X?.status==="expired")&&!ne,G=E.useRef(z);G.current=z;const Ne=ne?z.messages:r.messages,Ce=()=>{ie(),r.createTask()},me=r.switchToTask,fe=r.renameTask,he=r.hideTask,ie=()=>l({type:"RESET"}),De=P=>{v(P)},ge=P=>{C({id:P.id,connectionId:P.connectionId,provider:P.provider,capabilities:P.capabilities,limits:P.limits})},Te=async P=>{if(!N){Re.error("No model configured");return}const V=zo(P);if(V.length===0)return;r.messages.length>0&&G.current.setMessages(r.messages),ie();const te={tiptapDoc:P,created_at:new Date().toISOString(),thread_id:r.activeTaskId,agent:{id:M?.id??k,mode:I},user:{avatar:i?.image??void 0,name:i?.name??"you"}},lt={...te,system:T,models:N},ct={id:crypto.randomUUID(),role:"user",parts:V,metadata:te};await G.current.sendMessage(ct,{metadata:lt})},W=async()=>{const P=r.activeTaskId;if(P){G.current.messages.length>0&&r.updateMessagesCache(P,G.current.messages),G.current.stop();try{const V=await fetch(`/api/${s.slug}/decopilot/cancel/${P}`,{method:"POST",credentials:"include"});if(!V.ok){const te=await V.json().catch(()=>({}));throw new Error(te.message??`Cancel failed: ${V.status}`)}await a.invalidateQueries({queryKey:de.tasks(e)})}catch(V){const te=V instanceof Error?V.message:"Failed to cancel";Re.error(te),console.error("[chat] cancelRun",V)}}},ot=()=>{ne&&W(),z.stop()},it=()=>(ot(),Promise.resolve()),aa=()=>l({type:"CLEAR_FINISH_REASON"}),ra=E.useDeferredValue(Ne),na={tiptapDocRef:d,resetInteraction:ie,activeTaskId:r.activeTaskId,tasks:r.tasks,createTask:Ce,switchToTask:me,renameTask:fe,hideTask:he,hasNextPage:r.hasNextPage,isFetchingNextPage:r.isFetchingNextPage,fetchNextPage:r.fetchNextPage,ownerFilter:r.ownerFilter,setOwnerFilter:r.setOwnerFilter,isFilterChangePending:r.isFilterChangePending,virtualMcps:h,selectedVirtualMcp:M,setVirtualMcpId:De,modelsConnections:p,selectedModel:N,setSelectedModel:ge,selectedMode:I,setSelectedMode:g,sendMessage:Te,cancelRun:W},oa={messages:ra,status:z.status,setMessages:z.setMessages,error:z.error,clearError:z.clearError,stop:it,addToolOutput:z.addToolOutput,addToolApprovalResponse:z.addToolApprovalResponse,isStreaming:ne,isChatEmpty:oe,finishReason:c.finishReason,clearFinishReason:aa,isWaitingForApprovals:Se,isRunInProgress:pe};return u.jsx(Xs.Provider,{value:na,children:u.jsxs(ea.Provider,{value:oa,children:[u.jsx(Et,{fallback:null,children:u.jsxs(E.Suspense,{fallback:null,children:[u.jsx(Bo,{modelsConnections:p,currentConfig:N,onAutoSelect:C,allowAll:_,isModelAllowed:y}),u.jsx(Go,{taskId:r.activeTaskId,activeTask:X,isStreaming:ne,chatRef:G,queryClient:a,locator:e,orgId:s.id},r.activeTaskId)]})}),t]})})}function Qo(){const t=E.useContext(Xs);if(!t)throw new Error("useChatStable must be used within a ChatProvider");return t}function Ko(){const t=E.useContext(ea);if(!t)throw new Error("useChatStream must be used within a ChatProvider");return t}function Ti(){const t=U.c(3),e=Qo(),s=Ko();let a;return t[0]!==e||t[1]!==s?(a={...e,...s},t[0]=e,t[1]=s,t[2]=a):a=t[2],a}var nt="Collapsible",[Xo,Ai]=Ea(nt),[ei,Ot]=Xo(nt),ta=E.forwardRef((t,e)=>{const{__scopeCollapsible:s,open:a,defaultOpen:r,disabled:n,onOpenChange:i,...o}=t,[c,l]=ba({prop:a,defaultProp:r??!1,onChange:i,caller:nt});return u.jsx(ei,{scope:s,disabled:n,contentId:Sa(),open:c,onOpenToggle:E.useCallback(()=>l(d=>!d),[l]),children:u.jsx(wt.div,{"data-state":Lt(c),"data-disabled":n?"":void 0,...o,ref:e})})});ta.displayName=nt;var sa="CollapsibleTrigger",Pt=E.forwardRef((t,e)=>{const{__scopeCollapsible:s,...a}=t,r=Ot(sa,s);return u.jsx(wt.button,{type:"button","aria-controls":r.contentId,"aria-expanded":r.open||!1,"data-state":Lt(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled,...a,ref:e,onClick:_a(t.onClick,r.onOpenToggle)})});Pt.displayName=sa;var Dt="CollapsibleContent",$t=E.forwardRef((t,e)=>{const{forceMount:s,...a}=t,r=Ot(Dt,t.__scopeCollapsible);return u.jsx(wa,{present:s||r.open,children:({present:n})=>u.jsx(ti,{...a,ref:e,present:n})})});$t.displayName=Dt;var ti=E.forwardRef((t,e)=>{const{__scopeCollapsible:s,present:a,children:r,...n}=t,i=Ot(Dt,s),[o,c]=E.useState(a),l=E.useRef(null),d=Ia(e,l),m=E.useRef(0),h=m.current,f=E.useRef(0),v=f.current,x=i.open||o,S=E.useRef(x),y=E.useRef(void 0);return E.useEffect(()=>{const _=requestAnimationFrame(()=>S.current=!1);return()=>cancelAnimationFrame(_)},[]),Na(()=>{const _=l.current;if(_){y.current=y.current||{transitionDuration:_.style.transitionDuration,animationName:_.style.animationName},_.style.transitionDuration="0s",_.style.animationName="none";const p=_.getBoundingClientRect();m.current=p.height,f.current=p.width,S.current||(_.style.transitionDuration=y.current.transitionDuration,_.style.animationName=y.current.animationName),c(a)}},[i.open,a]),u.jsx(wt.div,{"data-state":Lt(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!x,...n,ref:d,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":v?`${v}px`:void 0,...t.style},children:x&&r})});function Lt(t){return t?"open":"closed"}var si=ta,Mi=Pt,ji=$t;function ki(t){const e=U.c(4);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];let a;return e[2]!==s?(a=u.jsx(si,{"data-slot":"collapsible",...s}),e[2]=s,e[3]=a):a=e[3],a}function Ri(t){const e=U.c(4);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];let a;return e[2]!==s?(a=u.jsx(Pt,{"data-slot":"collapsible-trigger",...s}),e[2]=s,e[3]=a):a=e[3],a}function Oi(t){const e=U.c(4);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];let a;return e[2]!==s?(a=u.jsx($t,{"data-slot":"collapsible-content",...s}),e[2]=s,e[3]=a):a=e[3],a}export{ki as C,Ni as M,si as R,Mi as T,Ti as a,bs as b,Ka as c,Ri as d,ys as e,Oi as f,ji as g,Ai as h,Qa as i,zn as j,Ci as k,Ii as m,xs as t,Qo as u};
|