decocms 3.89.1 → 3.89.2
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-ChcBH14n.js → AlertCircle-flSoo6uw.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-BfxsIWO1.js → ArrowUpRight-BeOMO89N.js} +1 -1
- package/dist/client/assets/{CheckCircle-Cm1GnmVj.js → CheckCircle-B9ekAAw-.js} +1 -1
- package/dist/client/assets/{ChevronDown-aoqAeXtt.js → ChevronDown-BWfuTI7r.js} +1 -1
- package/dist/client/assets/{ChevronLeft-CoW1IpXE.js → ChevronLeft-BNcg18cx.js} +1 -1
- package/dist/client/assets/{ChevronRight-CUGhm8E7.js → ChevronRight-ChYOVgWd.js} +1 -1
- package/dist/client/assets/{ChevronUp-BDbnz61t.js → ChevronUp-BhWz3ylT.js} +1 -1
- package/dist/client/assets/{DotsVertical-BcvtEj5g.js → DotsVertical-C0YWb9xq.js} +1 -1
- package/dist/client/assets/{Eye-BhqO9K0O.js → Eye-DWTUBTZ_.js} +1 -1
- package/dist/client/assets/{FilterLines-DTI31VpW.js → FilterLines-Djqj6uj_.js} +1 -1
- package/dist/client/assets/{Form-gFXvv2WG.js → Form-Czxo_N56.js} +1 -1
- package/dist/client/assets/{Globe01-CTIuSSD9.js → Globe01-BgRW2EiE.js} +1 -1
- package/dist/client/assets/{Globe04-Dy3PA2Yl.js → Globe04-XITcP2mp.js} +1 -1
- package/dist/client/assets/{HardDrive-DYVC-Zaq.js → HardDrive-DS3VxDtU.js} +1 -1
- package/dist/client/assets/{Key01-bDEyn58I.js → Key01-DX7L8s0Z.js} +1 -1
- package/dist/client/assets/{LayoutLeft-DjTexk5_.js → LayoutLeft-BqtFvEWV.js} +1 -1
- package/dist/client/assets/{LinkExternal01-COQYOgEI.js → LinkExternal01-Cf-6A1_h.js} +1 -1
- package/dist/client/assets/{Monitor01-DV9tmVAF.js → Monitor01-CZ30bS8J.js} +1 -1
- package/dist/client/assets/{Palette-CD1fLCtB.js → Palette-Dy2dQgqx.js} +1 -1
- package/dist/client/assets/{Play-Dl0pf4M6.js → Play-DvFnuZIO.js} +1 -1
- package/dist/client/assets/{Plus-BEdvqzrP.js → Plus-jFajoMCA.js} +1 -1
- package/dist/client/assets/{SearchMd-DK3hZUVF.js → SearchMd-uzKFlzQB.js} +1 -1
- package/dist/client/assets/{Settings02-BIpY6Zhb.js → Settings02-47eDNk4K.js} +1 -1
- package/dist/client/assets/{Shield01-Dx8gqKG5.js → Shield01-BgRa80OR.js} +1 -1
- package/dist/client/assets/{Star01-HcsxMzHs.js → Star01-BrkbxV-A.js} +1 -1
- package/dist/client/assets/{Stars01-VD9js_iZ.js → Stars01-Daq_eW6a.js} +1 -1
- package/dist/client/assets/{Stars02-C-addu2P.js → Stars02-DlImJz_z.js} +1 -1
- package/dist/client/assets/{Sun-B11PPq5-.js → Sun-9FxiCes3.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-EOva-Jpw.js → SwitchHorizontal01-CB5mOBIf.js} +1 -1
- package/dist/client/assets/{Tool01-DcPFccxt.js → Tool01-rx0lKYM8.js} +1 -1
- package/dist/client/assets/{Trash01-BfKdeD7S.js → Trash01-DI7qV1ow.js} +1 -1
- package/dist/client/assets/{Upload01-T8pN8jBP.js → Upload01-Boqk1hvA.js} +1 -1
- package/dist/client/assets/{User01-DxWsEbM9.js → User01-B3UbdHmL.js} +1 -1
- package/dist/client/assets/{Users01-C7ItyIdk.js → Users01-BUyczaeV.js} +1 -1
- package/dist/client/assets/{Users03-NRaUurHt.js → Users03-gvBLUtvG.js} +1 -1
- package/dist/client/assets/{X-Ciyf96Wa.js → X-B-cRV-7d.js} +1 -1
- package/dist/client/assets/{XCircle-ovYWqZM6.js → XCircle-CkhBWURn.js} +1 -1
- package/dist/client/assets/{XClose-m9X1QqKX.js → XClose-Doj89HqF.js} +1 -1
- package/dist/client/assets/{Zap-Bci_Afjv.js → Zap-BCqTHl-x.js} +1 -1
- package/dist/client/assets/{ZapSquare-BlfnVn5C.js → ZapSquare-DdgE8vy-.js} +1 -1
- package/dist/client/assets/{ZoomOut-C-l0YUGT.js → ZoomOut-BdBjpsIq.js} +1 -1
- package/dist/client/assets/{access-gate-DelGJZFm.js → access-gate-BXDE0rsJ.js} +1 -1
- package/dist/client/assets/{add-section-modal-DK89xL9T.js → add-section-modal-7a6BUncs.js} +1 -1
- package/dist/client/assets/{agent-icon-Bk1Ofbdo.js → agent-icon-C6bJxQ04.js} +1 -1
- package/dist/client/assets/agents-list-sjsqj6Ot.js +1 -0
- package/dist/client/assets/ai-providers-6xIkfdtm.js +1 -0
- package/dist/client/assets/{alert-0234XVcw.js → alert-C81LnOX9.js} +1 -1
- package/dist/client/assets/{alert-dialog-CKnoCFTw.js → alert-dialog-HmiP05XU.js} +1 -1
- package/dist/client/assets/app-editor-k7Nl_uKp.js +1 -0
- package/dist/client/assets/{auth-Ci2ZRRcb.js → auth-B9Q1UUsp.js} +1 -1
- package/dist/client/assets/{auth-catchall-pBRRm1M1.js → auth-catchall-ClOrr_P8.js} +1 -1
- package/dist/client/assets/{auth-entry-C10wiLq4.js → auth-entry-B7DIloAw.js} +1 -1
- package/dist/client/assets/{auth-split-layout-DQUsM8Ag.js → auth-split-layout-dWTaQKch.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-CjSCavkQ.js → authenticate-and-persist-oauth-xCkDryiA.js} +1 -1
- package/dist/client/assets/{automation-list-row-Cuo6QaWy.js → automation-list-row-CLUMzxuG.js} +1 -1
- package/dist/client/assets/{automation-runs-BNON3nJA.js → automation-runs-DxPUfxy1.js} +1 -1
- package/dist/client/assets/automations-TTHh4EuE.js +1 -0
- package/dist/client/assets/{avatar-BLEdyY7-.js → avatar-oAcdiJ9v.js} +1 -1
- package/dist/client/assets/{badge-C9MXVg0W.js → badge-CpKEkIGn.js} +1 -1
- package/dist/client/assets/{block-document-BPNTiqTb.js → block-document-BVHsyU-9.js} +1 -1
- package/dist/client/assets/brand-context-CwjLKTtp.js +1 -0
- package/dist/client/assets/buckets-CM0nkgpJ.js +1 -0
- package/dist/client/assets/{capability-load-error-sRyEFexC.js → capability-load-error-CG-hWPTN.js} +1 -1
- package/dist/client/assets/{card-mAs4nLtf.js → card-BIwENur_.js} +1 -1
- package/dist/client/assets/category-editor-Bx9oTK3B.js +1 -0
- package/dist/client/assets/{chat-context-BdyPsWKn.js → chat-context-DN0_9Gee.js} +1 -1
- package/dist/client/assets/{checkbox-B9vj-Cdf.js → checkbox-Bi39v4Qa.js} +1 -1
- package/dist/client/assets/{cli-auth-success-DUamUZxb.js → cli-auth-success-pdfiwdy1.js} +1 -1
- package/dist/client/assets/collection-detail-BcWtgoUr.js +1 -0
- package/dist/client/assets/{collection-display-button-j1yy59k2.js → collection-display-button-Bzf7YHNy.js} +1 -1
- package/dist/client/assets/{collection-search-C1sxKyva.js → collection-search-DbQr2iji.js} +1 -1
- package/dist/client/assets/{collection-tabs-Csv5ENUX.js → collection-tabs-D77_So6e.js} +1 -1
- package/dist/client/assets/command-DyJgh8wP.js +1 -0
- package/dist/client/assets/commerce-onboarding-CJHzpHob.js +1 -0
- package/dist/client/assets/connect-desktop-dialog-ByWaevjw.js +1 -0
- package/dist/client/assets/{connection-card-gZqWtnUr.js → connection-card-DehsL0Sf.js} +1 -1
- package/dist/client/assets/connection-detail-CCaFPgvC.js +1 -0
- package/dist/client/assets/{connection-form-helpers-4cMYvdoC.js → connection-form-helpers-CASdXQaW.js} +1 -1
- package/dist/client/assets/connections-DZYmLj7X.js +1 -0
- package/dist/client/assets/{context-menu-BiiNCW4n.js → context-menu-Bt-E5y3C.js} +1 -1
- package/dist/client/assets/{decopilot-CW6d29Nv.js → decopilot-BXlT8NLf.js} +1 -1
- package/dist/client/assets/{decopilot-sse-pool-DhvSomLP.js → decopilot-sse-pool-CKTJhrtc.js} +1 -1
- package/dist/client/assets/{dialog-DtA5oh9D.js → dialog-BLvz2lK8.js} +1 -1
- package/dist/client/assets/{domain-settings-m1b0eyH2.js → domain-settings-ed9WclHg.js} +1 -1
- package/dist/client/assets/{drawer-zXrFQNCR.js → drawer-C4RJ4_GY.js} +1 -1
- package/dist/client/assets/{dropdown-menu-DBXGBAAP.js → dropdown-menu-CRyIPZil.js} +1 -1
- package/dist/client/assets/{empty-state-YJ1DU6Lk.js → empty-state-CmZpGujH.js} +1 -1
- package/dist/client/assets/{extract-connection-data-DlaPzbl9.js → extract-connection-data-iACc8UZO.js} +1 -1
- package/dist/client/assets/file-explorer-BveBp463.js +2 -0
- package/dist/client/assets/{file-type-icon-3wYgaJ1f.js → file-type-icon-Db262N7w.js} +1 -1
- package/dist/client/assets/{files-DaCiXODL.js → files-BwDocccC.js} +1 -1
- package/dist/client/assets/{form-BPgAGzjC.js → form-CPJbrMq5.js} +1 -1
- package/dist/client/assets/general-FW5Wth3b.js +1 -0
- package/dist/client/assets/{github-repo-picker-hOzqpBMc.js → github-repo-picker-Db_ehY6e.js} +1 -1
- package/dist/client/assets/{hooks-BdXI0ZZ7.js → hooks-chgqRyLj.js} +1 -1
- package/dist/client/assets/{import-from-deco-dialog-Sr2m6cI7.js → import-from-deco-dialog-Nrpq_g30.js} +1 -1
- package/dist/client/assets/{index-CDpdJTKU.js → index-1ECwD4fs.js} +12 -12
- package/dist/client/assets/{index-DXt_QCNf.js → index-4GXqE9fp.js} +2 -2
- package/dist/client/assets/{index-20lo5teZ.js → index-BkSIY6JJ.js} +3 -3
- package/dist/client/assets/index-D5RW_4sI.js +1 -0
- package/dist/client/assets/{index-DsiMEgqD.js → index-D7a1JQHt.js} +2 -2
- package/dist/client/assets/{index-BaiqhWaL.js → index-DAWoaMpc.js} +1 -1
- package/dist/client/assets/{index-wuE_wZDF.js → index-DAmj773w.js} +1 -1
- package/dist/client/assets/{index-BN5oIbn0.js → index-DC36sAC_.js} +2 -2
- package/dist/client/assets/{index-BBUDuLgB.js → index-DFNABgCe.js} +1 -1
- package/dist/client/assets/index-DoculpR5.js +1 -0
- package/dist/client/assets/{index-DHpZNTCL.js → index-K-17SMjl.js} +1 -1
- package/dist/client/assets/{index-CK4mkEbA.js → index-QdluHxPe.js} +1 -1
- package/dist/client/assets/{index-BoBbtnrJ.js → index-RkQpccOp.js} +1 -1
- package/dist/client/assets/index-UgEhsCuR.js +1 -0
- package/dist/client/assets/{index-redirect-CsfNxHhm.js → index-redirect-DO0D1qdv.js} +1 -1
- package/dist/client/assets/{input-D2VJ6ahm.js → input-jkT1z5r1.js} +1 -1
- package/dist/client/assets/{integration-icon-62cL4F-8.js → integration-icon-CZDEviNI.js} +1 -1
- package/dist/client/assets/{label-Xkc4XdLq.js → label-CETsHBZ0.js} +1 -1
- package/dist/client/assets/{login-CLUghQw8.js → login-eY2xl_Qt.js} +1 -1
- package/dist/client/assets/{mcp-oauth-CsZ919dh.js → mcp-oauth-BIBzZgcE.js} +1 -1
- package/dist/client/assets/{members-CB0UM83l.js → members-BAHTTEXJ.js} +2 -2
- package/dist/client/assets/{monaco-editor-C0cKgOd8.js → monaco-editor-tVsx1Jkl.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-COpSRcY-.js → monitoring-stats-row-CivwdnUP.js} +1 -1
- package/dist/client/assets/{oauth-callback-Bq9PHCzO.js → oauth-callback-BnrL3BsC.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-B4wHrtoi.js → oauth-callback-ai-provider-D3_UsvKg.js} +1 -1
- package/dist/client/assets/{onboarding-ChNzFBz9.js → onboarding-Cde-ZfY9.js} +1 -1
- package/dist/client/assets/{org-install-D3HGVhMw.js → org-install-Cri2HTyv.js} +1 -1
- package/dist/client/assets/{org-layout-CKL4gUDt.js → org-layout-DH1oGgfN.js} +1 -1
- package/dist/client/assets/{organization-choice-CmMr-EN1.js → organization-choice-BZIXFBHd.js} +1 -1
- package/dist/client/assets/{page-seo-form-tt8IzB9t.js → page-seo-form-DCgyqE3q.js} +1 -1
- package/dist/client/assets/page-seo-sheet-o3dCAhA-.js +1 -0
- package/dist/client/assets/{popover-CHlLC07g.js → popover-1pFpRX6s.js} +1 -1
- package/dist/client/assets/post-editor-CWr-_gb_.js +1 -0
- package/dist/client/assets/{preview-dialog-pnlDSJ8-.js → preview-dialog-DRmrGWbh.js} +1 -1
- package/dist/client/assets/{primitives-CDMj0aGG.js → primitives-C06Pn9p4.js} +1 -1
- package/dist/client/assets/profile-62y90jm_.js +1 -0
- package/dist/client/assets/project-app-view-BeZFUwcQ.js +1 -0
- package/dist/client/assets/record-editor-BsdzrkRD.js +1 -0
- package/dist/client/assets/registry-DpNbpkzg.js +2 -0
- package/dist/client/assets/{registry-layout-BdK58T7U.js → registry-layout-Dww7dssY.js} +2 -2
- package/dist/client/assets/{require-capability-BMiu3VbE.js → require-capability-BC8YsasG.js} +1 -1
- package/dist/client/assets/{required-auth-layout-hnMHneNT.js → required-auth-layout-DjRtF3m8.js} +1 -1
- package/dist/client/assets/{reset-password-DTJmY0M7.js → reset-password-DNWeSy4_.js} +1 -1
- package/dist/client/assets/roles-Cyz3Z1vr.js +1 -0
- package/dist/client/assets/{save-status-D-Y-u7Wx.js → save-status-BsQDaUlP.js} +1 -1
- package/dist/client/assets/{scroll-area-BlJNYaPT.js → scroll-area-D51A_KQ5.js} +1 -1
- package/dist/client/assets/{search-input-DucmHYf0.js → search-input-CEqRaXj6.js} +1 -1
- package/dist/client/assets/secrets-C6bKEzDN.js +1 -0
- package/dist/client/assets/{sections-editor-jzkZQ3Ec.js → sections-editor-331tz7B6.js} +2 -2
- package/dist/client/assets/{select-C0AEr1SL.js → select-Ct-_FhWe.js} +1 -1
- package/dist/client/assets/select-model-DJ7vH3M2.js +1 -0
- package/dist/client/assets/seo-editor-Ad8X__jc.js +1 -0
- package/dist/client/assets/settings-layout-CSyEHpma.js +1 -0
- package/dist/client/assets/{settings-section-CP7jibDA.js → settings-section-D6f1v8Lb.js} +1 -1
- package/dist/client/assets/{sheet-BBGbheOC.js → sheet-CUfjkNRy.js} +1 -1
- package/dist/client/assets/{shell-controls-BPsjYlm1.js → shell-controls-C6FYdYnB.js} +1 -1
- package/dist/client/assets/{shell-layout-xhRX4rsB.js → shell-layout-CR4YIb2n.js} +1 -1
- package/dist/client/assets/{shell-route-loading-C4SUOonb.js → shell-route-loading-fK7OWXny.js} +1 -1
- package/dist/client/assets/sidebar-C45GjVmp.js +1 -0
- package/dist/client/assets/{skeleton-CVRpN7O3.js → skeleton-h95MLET_.js} +1 -1
- package/dist/client/assets/{sortable.esm-DMoaSsem.js → sortable.esm-CbeYFn14.js} +2 -2
- package/dist/client/assets/sso-DGooE6a8.js +1 -0
- package/dist/client/assets/store-O5BcQA2t.js +1 -0
- package/dist/client/assets/store-registry-BPQHh-y5.js +2 -0
- package/dist/client/assets/{studio-tools-DqPhjgPW.js → studio-tools-BgUSKeCY.js} +1 -1
- package/dist/client/assets/{switch-BOUA2FBT.js → switch-Cf_WUos9.js} +1 -1
- package/dist/client/assets/{table-hboPJhBa.js → table-tHeeUiY0.js} +1 -1
- package/dist/client/assets/{tabs-BqGLbeO9.js → tabs-CNnqe_sK.js} +1 -1
- package/dist/client/assets/{task-status-DbMlzbTm.js → task-status-DzLkYYrk.js} +1 -1
- package/dist/client/assets/{textarea-BqMqcZIm.js → textarea-BzYVaGJ0.js} +1 -1
- package/dist/client/assets/{toggle-group-Db5bABta.js → toggle-group-BE1kDwdz.js} +1 -1
- package/dist/client/assets/{toolbar-DDUCJSbz.js → toolbar-D5FkjLVB.js} +1 -1
- package/dist/client/assets/{tools-list-DkXVWS7e.js → tools-list-BKN97Z6h.js} +1 -1
- package/dist/client/assets/tooltip-CAEDbADy.js +1 -0
- package/dist/client/assets/{types-Cms0eXYe.js → types-Dw2dcWcn.js} +1 -1
- package/dist/client/assets/{use-ai-providers-BFPg4Nao.js → use-ai-providers-BcLob6tS.js} +1 -1
- package/dist/client/assets/{use-automations-C_LX8Dvr.js → use-automations-CfP4AmpB.js} +1 -1
- package/dist/client/assets/{use-capability-C1-FHW22.js → use-capability-CbeJheXW.js} +1 -1
- package/dist/client/assets/{use-clock-tick-DvWNr9a0.js → use-clock-tick-DHvuEFIJ.js} +1 -1
- package/dist/client/assets/{use-collections-74mCujh3.js → use-collections-yHRKnSEt.js} +1 -1
- package/dist/client/assets/{use-connection-D-7QpVUJ.js → use-connection-BPcAXa47.js} +1 -1
- package/dist/client/assets/{use-copy-D6L-AQL_.js → use-copy-DOTEBoID.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-kRix1VSu.js → use-create-virtual-mcp-C88JBuQM.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-B3nrE_1Y.js → use-debounced-autosave-BnfFXRc0.js} +1 -1
- package/dist/client/assets/{use-delete-connection-VpHPQbnh.js → use-delete-connection-D1yU7B0G.js} +1 -1
- package/dist/client/assets/{use-file-configs-DNAtFvn4.js → use-file-configs-C8z3zSDD.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-hOEUoZD8.js → use-infinite-scroll-V4l3DQJD.js} +1 -1
- package/dist/client/assets/{use-join-requests-BvPzSuPP.js → use-join-requests-Duz0LeuZ.js} +1 -1
- package/dist/client/assets/{use-mcp-client-CxXf5rsq.js → use-mcp-client-DYpZuPPA.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-CqbI2uxQ.js → use-mcp-prompts-BxOgLeZF.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-CLWDDSx5.js → use-mcp-tools-xhV-ENX5.js} +1 -1
- package/dist/client/assets/{use-members-Cd4dRzb0.js → use-members-CJKZdynB.js} +1 -1
- package/dist/client/assets/use-mobile-CPyq18pe.js +1 -0
- package/dist/client/assets/{use-navigate-to-agent-D8CoEyF3.js → use-navigate-to-agent-Bhu6dr_a.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-CSAS1fgX.js → use-org-auth-client-Tiq6Yt9b.js} +1 -1
- package/dist/client/assets/{use-org-sso-D9H6UI9E.js → use-org-sso-DGBv3Hvc.js} +1 -1
- package/dist/client/assets/{use-organization-roles-rL51pKiY.js → use-organization-roles-1exN43Rd.js} +1 -1
- package/dist/client/assets/{use-organization-settings-CTH2EptF.js → use-organization-settings-DFnXSR7Z.js} +1 -1
- package/dist/client/assets/{use-registry-connections-jcbA10JV.js → use-registry-connections-Czx1u2H6.js} +1 -1
- package/dist/client/assets/{use-secrets-CfUCGkTu.js → use-secrets-DqgJI3yC.js} +1 -1
- package/dist/client/assets/{use-status-sounds-CfsHQQ72.js → use-status-sounds-DRhhwMt0.js} +1 -1
- package/dist/client/assets/use-view-mode-BB9Jcv_5.js +1 -0
- package/dist/client/assets/{use-virtual-mcp-CwSMwdwq.js → use-virtual-mcp-DnY7c9gE.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-DlRMWoIP.js +1 -0
- package/dist/client/assets/{useQueries-BdyCFKnV.js → useQueries-D96G2W1b.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-BjlxN-DZ.js +1 -0
- package/dist/client/assets/variant-calendar-BlIkgRxn.js +1 -0
- package/dist/client/assets/{view-mode-toggle-BZ52Zalr.js → view-mode-toggle-ncGR_sPB.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +1 -1
- package/package.json +1 -1
- package/dist/client/assets/agents-list-DGJQ5tbU.js +0 -1
- package/dist/client/assets/ai-providers-1Fg66YS1.js +0 -1
- package/dist/client/assets/app-editor-Dee1jydx.js +0 -1
- package/dist/client/assets/automations-CFj3iBHN.js +0 -1
- package/dist/client/assets/brand-context-5jDalvDO.js +0 -1
- package/dist/client/assets/buckets-BzZ5RUjr.js +0 -1
- package/dist/client/assets/category-editor-wDaIJOJ7.js +0 -1
- package/dist/client/assets/collection-detail-ClxlZsnZ.js +0 -1
- package/dist/client/assets/command-vbsMaAT6.js +0 -1
- package/dist/client/assets/commerce-onboarding-DoN5YJbZ.js +0 -1
- package/dist/client/assets/connect-desktop-dialog-CkD3zyKJ.js +0 -1
- package/dist/client/assets/connection-detail-rDE247RN.js +0 -1
- package/dist/client/assets/connections-DnwHKMbX.js +0 -1
- package/dist/client/assets/file-explorer-W1D9pH49.js +0 -2
- package/dist/client/assets/general-23V2Ho1C.js +0 -1
- package/dist/client/assets/index-BWkPiGuC.js +0 -1
- package/dist/client/assets/index-DgqWlUUI.js +0 -1
- package/dist/client/assets/index-KwJaTLZk.js +0 -1
- package/dist/client/assets/page-seo-sheet-DuUcGG-6.js +0 -1
- package/dist/client/assets/post-editor-D55m7k1S.js +0 -1
- package/dist/client/assets/profile-wDwUx_Mw.js +0 -1
- package/dist/client/assets/project-app-view-3zlWIcJu.js +0 -1
- package/dist/client/assets/record-editor-BNDljN0d.js +0 -1
- package/dist/client/assets/registry-52H0YdSD.js +0 -2
- package/dist/client/assets/roles-CzG0s_Ib.js +0 -1
- package/dist/client/assets/secrets-Cr6YxiSX.js +0 -1
- package/dist/client/assets/select-model-C78uu1xA.js +0 -1
- package/dist/client/assets/seo-editor-CHrrRJBI.js +0 -1
- package/dist/client/assets/settings-layout-DzHXF3Dv.js +0 -1
- package/dist/client/assets/sidebar-Cx68CPJi.js +0 -1
- package/dist/client/assets/sso-vWr0RkSo.js +0 -1
- package/dist/client/assets/store-BXcc72mi.js +0 -1
- package/dist/client/assets/store-registry-CzJeBBUG.js +0 -2
- package/dist/client/assets/tooltip-B_mKOQvv.js +0 -1
- package/dist/client/assets/use-view-mode-DdtTz0AS.js +0 -1
- package/dist/client/assets/useInfiniteQuery-CWme5rGZ.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-DVa_SnfJ.js +0 -1
- package/dist/client/assets/variant-calendar-D2hiqv-k.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as E,c as oe,j as t,E as Ye,i as ce,w as be,b as _e,u as Ze,a as Ne,q as et,v as tt,L as nt,G as st,F as ot,B as U,s as te,m as it,l as de,t as W,K as rt}from"./index-20lo5teZ.js";import{a as lt,b as De,g as at,e as ct}from"./extract-connection-data-DlaPzbl9.js";import{C as dt}from"./collection-display-button-j1yy59k2.js";import{S as mt}from"./search-input-DucmHYf0.js";import{C as ut}from"./collection-tabs-Csv5ENUX.js";import{u as pt,a as ke,g as ht,C as Ce}from"./connection-card-gZqWtnUr.js";import{E as gt}from"./empty-state-YJ1DU6Lk.js";import{I as xt}from"./integration-icon-62cL4F-8.js";import{P as ue}from"./index-BoBbtnrJ.js";import{u as ft,D as jt}from"./use-delete-connection-VpHPQbnh.js";import{u as ye}from"./use-capability-C1-FHW22.js";import{u as yt}from"./use-infinite-scroll-hOEUoZD8.js";import{u as Ct}from"./use-view-mode-DdtTz0AS.js";import{g as he}from"./connection-slug-eyAPH6o3.js";import{c as Ae,d as we,b as Te,A as Ie,e as Pe,g as $e,a as Le,f as Oe}from"./alert-dialog-CKnoCFTw.js";import{C as Fe}from"./checkbox-B9vj-Cdf.js";import{d as Me,c as ze,D as Ve,a as Ee,b as Be,e as Ke}from"./dialog-DtA5oh9D.js";import{D as vt,a as St,c as bt,b as _t,d as Nt,e as Dt,f as kt}from"./drawer-zXrFQNCR.js";import{u as At}from"./tooltip-B_mKOQvv.js";import{D as Ue,a as Re,b as He,c as re}from"./dropdown-menu-DBXGBAAP.js";import{F as Q,b as J,c as Y,d as Z,f as ee,a as ve}from"./form-BPgAGzjC.js";import{I as ie}from"./input-D2VJ6ahm.js";import{d as wt,b as Tt,c as It,S as Pt,a as ae}from"./select-C0AEr1SL.js";import{T as $t}from"./textarea-BqMqcZIm.js";import{b as We,u as Lt}from"./use-connection-D-7QpVUJ.js";import{u as Ot}from"./use-virtual-mcp-CwSMwdwq.js";import{u as Ft}from"./studio-tools-DqPhjgPW.js";import{a5 as Mt,af as zt,C as Vt,z as Et}from"./agent-icon-Bk1Ofbdo.js";import{n as ge}from"./XCircle-ovYWqZM6.js";import{a as Xe}from"./DotsVertical-BcvtEj5g.js";import{s as qe}from"./Eye-BhqO9K0O.js";import{s as je}from"./Star01-HcsxMzHs.js";import{s as Ge}from"./Plus-BEdvqzrP.js";import{s as Qe}from"./Trash01-BfKdeD7S.js";import{s as Je}from"./XClose-m9X1QqKX.js";import{i as pe,a as Se,E as Bt,c as Kt,p as Ut,b as Rt,d as Ht}from"./connection-form-helpers-4cMYvdoC.js";import{a as Wt}from"./authenticate-and-persist-oauth-CjSCavkQ.js";import"./use-mcp-client-CxXf5rsq.js";import"./auth-Ci2ZRRcb.js";import"./SwitchHorizontal01-EOva-Jpw.js";import"./ChevronUp-BDbnz61t.js";import"./view-mode-toggle-BZ52Zalr.js";import"./badge-C9MXVg0W.js";import"./SearchMd-DK3hZUVF.js";import"./use-registry-connections-jcbA10JV.js";import"./use-organization-settings-CTH2EptF.js";import"./useInfiniteQuery-CWme5rGZ.js";import"./card-mAs4nLtf.js";import"./sidebar-Cx68CPJi.js";import"./LayoutLeft-DjTexk5_.js";import"./sheet-BBGbheOC.js";import"./X-Ciyf96Wa.js";import"./ChevronRight-CUGhm8E7.js";import"./label-Xkc4XdLq.js";import"./index-BdQq_4o_.js";import"./ChevronDown-aoqAeXtt.js";import"./use-collections-74mCujh3.js";import"./AlertCircle-ChcBH14n.js";import"./Tool01-DcPFccxt.js";import"./Settings02-BIpY6Zhb.js";import"./ArrowUpRight-BfxsIWO1.js";import"./ZapSquare-BlfnVn5C.js";import"./Users03-NRaUurHt.js";import"./CheckCircle-Cm1GnmVj.js";import"./ChevronLeft-CoW1IpXE.js";import"./Stars02-C-addu2P.js";import"./ZoomOut-C-l0YUGT.js";import"./Globe01-CTIuSSD9.js";import"./FilterLines-DTI31VpW.js";import"./Globe04-Dy3PA2Yl.js";import"./HardDrive-DYVC-Zaq.js";import"./Key01-bDEyn58I.js";import"./LinkExternal01-COQYOgEI.js";import"./Monitor01-DV9tmVAF.js";import"./Sun-B11PPq5-.js";import"./Palette-CD1fLCtB.js";import"./Play-Dl0pf4M6.js";import"./Shield01-Dx8gqKG5.js";import"./Stars01-VD9js_iZ.js";import"./Upload01-T8pN8jBP.js";import"./User01-DxWsEbM9.js";import"./Users01-C7ItyIdk.js";import"./Zap-Bci_Afjv.js";import"./mcp-oauth-CsZ919dh.js";function Xt(f){const e=`deco-filters-${f}`,[n,p]=E.useState(()=>{try{const o=globalThis.localStorage?.getItem(e);if(o)return JSON.parse(o)}catch(o){console.error("Failed to parse stored filters:",o)}return[]});return[n,o=>{p(o);try{globalThis.localStorage?.setItem(e,JSON.stringify(o))}catch(i){console.error("Failed to save filters:",i)}}]}function qt(f){const e=oe.c(7),[n,p]=E.useState(f),[l,o]=E.useState(f?"desc":null);let i;e[0]!==l||e[1]!==n?(i=j=>{n!==j?(p(j),o("asc")):l==="asc"?o("desc"):l==="desc"&&(p(void 0),o(null))},e[0]=l,e[1]=n,e[2]=i):i=e[2];const g=i;let h;return e[3]!==g||e[4]!==l||e[5]!==n?(h={sortKey:n,sortDirection:l,handleSort:g},e[3]=g,e[4]=l,e[5]=n,e[6]=h):h=e[6],h}function Gt(f){const e=oe.c(20),{namespace:n,resource:p,defaultSortKey:l,defaultViewMode:o}=f,i=l===void 0?"title":l,g=o===void 0?"table":o,[h,j]=E.useState(""),y=E.useDeferredValue(h),N=`${n}-${p}`,[b,a]=Xt(N),x=`mesh-${p}-filter-visible-${n}`;let m;e[0]!==x?(m=()=>globalThis.localStorage?.getItem(x)==="true",e[0]=x,e[1]=m):m=e[1];const[v,_]=E.useState(m);let D;e[2]!==x?(D=T=>{_(T),globalThis.localStorage?.setItem(x,String(T))},e[2]=x,e[3]=D):D=e[3];const L=D;let O;e[4]!==v||e[5]!==L?(O=()=>{L(!v)},e[4]=v,e[5]=L,e[6]=O):O=e[6];const s=O,[A,F]=Ct(`mesh-${p}-${n}`,g),{sortKey:M,sortDirection:w,handleSort:P}=qt(i),z=M;let C;return e[7]!==v||e[8]!==b||e[9]!==P||e[10]!==h||e[11]!==y||e[12]!==L||e[13]!==a||e[14]!==F||e[15]!==w||e[16]!==z||e[17]!==s||e[18]!==A?(C={search:h,searchTerm:y,setSearch:j,filters:b,setFilters:a,filterBarVisible:v,setFilterBarVisible:L,toggleFilterBar:s,viewMode:A,setViewMode:F,sortKey:z,sortDirection:w,handleSort:P},e[7]=v,e[8]=b,e[9]=P,e[10]=h,e[11]=y,e[12]=L,e[13]=a,e[14]=F,e[15]=w,e[16]=z,e[17]=s,e[18]=A,e[19]=C):C=e[19],C}function Qt(f){const e=oe.c(51),{group:n,onOpen:p,selectionMode:l,selectedIds:o,onToggleSelect:i}=f;let g;if(e[0]!==n.connections||e[1]!==o){let C;e[3]!==o?(C=T=>o.has(T.id),e[3]=o,e[4]=C):C=e[4],g=n.connections.every(C),e[0]=n.connections,e[1]=o,e[2]=g}else g=e[2];const h=g;let j;if(e[5]!==n.connections||e[6]!==o){let C;e[8]!==o?(C=T=>o.has(T.id),e[8]=o,e[9]=C):C=e[9],j=n.connections.some(C),e[5]=n.connections,e[6]=o,e[7]=j}else j=e[7];const y=j,N=`${n.connections.length} instances`;let b;e[10]!==n.icon||e[11]!==n.title||e[12]!==N?(b={title:n.title,icon:n.icon,description:N},e[10]=n.icon,e[11]=n.title,e[12]=N,e[13]=b):b=e[13];let a;e[14]!==h||e[15]!==n.connections||e[16]!==p||e[17]!==i||e[18]!==o||e[19]!==l?(a=()=>l?(()=>{for(const C of n.connections)h?o.has(C.id)&&i(C.id):o.has(C.id)||i(C.id)})():p(),e[14]=h,e[15]=n.connections,e[16]=p,e[17]=i,e[18]=o,e[19]=l,e[20]=a):a=e[20];const x=l&&h&&"ring-2 ring-primary",m=l&&y&&!h&&"ring-1 ring-primary/50";let v;e[21]!==x||e[22]!==m?(v=de(x,m),e[21]=x,e[22]=m,e[23]=v):v=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=t.jsx(ge,{}),e[24]=_):_=e[24];let D;e[25]!==h||e[26]!==n.connections||e[27]!==i||e[28]!==o||e[29]!==l||e[30]!==y?(D=l?t.jsx(Fe,{checked:h?!0:y?"indeterminate":!1,onCheckedChange:()=>{for(const C of n.connections)h?o.has(C.id)&&i(C.id):o.has(C.id)||i(C.id)}}):t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}),t.jsxs("span",{className:"text-xs text-muted-foreground font-normal tabular-nums",children:["x",n.connections.length]})]}),e[25]=h,e[26]=n.connections,e[27]=i,e[28]=o,e[29]=l,e[30]=y,e[31]=D):D=e[31];const L=l?"w-8 opacity-100":"w-0 opacity-0 group-hover:w-8 group-hover:opacity-100";let O;e[32]!==L?(O=de("overflow-hidden transition-all duration-150 ease-out",L),e[32]=L,e[33]=O):O=e[33];let s;e[34]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsx(Re,{asChild:!0,children:t.jsx(U,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:Yt,children:t.jsx(Xe,{size:20})})}),e[34]=s):s=e[34];let A;e[35]!==p?(A=C=>{C.stopPropagation(),p()},e[35]=p,e[36]=A):A=e[36];let F;e[37]===Symbol.for("react.memo_cache_sentinel")?(F=t.jsx(qe,{size:16}),e[37]=F):F=e[37];let M;e[38]!==A?(M=t.jsxs(Ue,{children:[s,t.jsx(He,{align:"end",onClick:Jt,children:t.jsxs(re,{onClick:A,children:[F,"Open"]})})]}),e[38]=A,e[39]=M):M=e[39];let w;e[40]!==O||e[41]!==M?(w=t.jsx("div",{className:O,children:M}),e[40]=O,e[41]=M,e[42]=w):w=e[42];let P;e[43]!==D||e[44]!==w?(P=t.jsxs("div",{className:"flex items-center gap-1",children:[D,w]}),e[43]=D,e[44]=w,e[45]=P):P=e[45];let z;return e[46]!==P||e[47]!==b||e[48]!==a||e[49]!==v?(z=t.jsx(t.Fragment,{children:t.jsx(Ce,{connection:b,onClick:a,className:v,fallbackIcon:_,headerActionsAlwaysVisible:!0,headerActions:P})}),e[46]=P,e[47]=b,e[48]=a,e[49]=v,e[50]=z):z=e[50],z}function Jt(f){return f.stopPropagation()}function Yt(f){return f.stopPropagation()}function Zt(f){const e=oe.c(23),{count:n,total:p,canManage:l,canManageAgents:o,onSelectAll:i,onDeselectAll:g,onDelete:h,onAddToAgent:j,onToggleStatus:y,onCancel:N}=f;if(n===0)return null;let b;e[0]!==n?(b=t.jsxs("div",{className:"text-xs text-muted-foreground pr-1 tabular-nums",children:[n," selected"]}),e[0]=n,e[1]=b):b=e[1];let a;e[2]!==n||e[3]!==g||e[4]!==i||e[5]!==p?(a=n<p?t.jsxs(U,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:i,children:["Select all (",p,")"]}):t.jsx(U,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:g,children:"Clear selection"}),e[2]=n,e[3]=g,e[4]=i,e[5]=p,e[6]=a):a=e[6];let x;e[7]!==o||e[8]!==j?(x=o&&t.jsxs(U,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:j,children:[t.jsx(Ge,{size:13}),"Add to Agent"]}),e[7]=o,e[8]=j,e[9]=x):x=e[9];let m;e[10]!==l||e[11]!==h||e[12]!==y?(m=l&&t.jsxs(t.Fragment,{children:[t.jsx(U,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:()=>y("active"),children:"Enable"}),t.jsx(U,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:()=>y("inactive"),children:"Disable"}),t.jsxs(U,{variant:"destructive",size:"sm",className:"h-7 text-xs px-2",onClick:h,children:[t.jsx(Qe,{size:13}),"Delete"]})]}),e[10]=l,e[11]=h,e[12]=y,e[13]=m):m=e[13];let v;e[14]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx(Je,{size:13}),e[14]=v):v=e[14];let _;e[15]!==N?(_=t.jsx(U,{variant:"ghost",size:"sm",className:"h-7 text-xs px-2",onClick:N,children:v}),e[15]=N,e[16]=_):_=e[16];let D;return e[17]!==b||e[18]!==a||e[19]!==x||e[20]!==m||e[21]!==_?(D=t.jsx("div",{className:"fixed bottom-4 left-1/2 z-50 -translate-x-1/2",children:t.jsxs("div",{className:"rounded-xl border border-border bg-background/95 shadow-lg backdrop-blur px-3 py-2 flex items-center gap-2",children:[b,a,x,m,_]})}),e[17]=b,e[18]=a,e[19]=x,e[20]=m,e[21]=_,e[22]=D):D=e[22],D}function en(f){const e=oe.c(25),{open:n,onOpenChange:p,agents:l,onConfirm:o}=f,[i,g]=E.useState(null);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsxs(Ve,{children:[t.jsx(Ee,{children:"Add to Agent"}),t.jsx(Be,{children:"Select an agent to add the selected connections to."})]}),e[0]=h):h=e[0];let j;e[1]!==l||e[2]!==i?(j=l.length===0?t.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No agents found"}):l.map(D=>t.jsxs("button",{type:"button",onClick:()=>g(D.id),className:de("flex items-center gap-3 w-full rounded-md px-3 py-2 text-left transition-colors",i===D.id?"bg-primary/10 ring-1 ring-primary":"hover:bg-muted/50"),children:[t.jsx(xt,{icon:D.icon,name:D.title,size:"sm",className:"shrink-0"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:D.title}),D.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:D.description})]})]},D.id)),e[1]=l,e[2]=i,e[3]=j):j=e[3];let y;e[4]!==j?(y=t.jsx("div",{className:"max-h-60 overflow-auto py-2 space-y-1",children:j}),e[4]=j,e[5]=y):y=e[5];let N;e[6]!==p?(N=t.jsx(U,{variant:"outline",onClick:()=>p(!1),children:"Cancel"}),e[6]=p,e[7]=N):N=e[7];const b=!i;let a;e[8]!==o||e[9]!==p||e[10]!==i?(a=()=>{i&&(o(i),p(!1),g(null))},e[8]=o,e[9]=p,e[10]=i,e[11]=a):a=e[11];let x;e[12]!==b||e[13]!==a?(x=t.jsx(U,{disabled:b,onClick:a,children:"Add"}),e[12]=b,e[13]=a,e[14]=x):x=e[14];let m;e[15]!==N||e[16]!==x?(m=t.jsxs(Ke,{children:[N,x]}),e[15]=N,e[16]=x,e[17]=m):m=e[17];let v;e[18]!==y||e[19]!==m?(v=t.jsxs(ze,{className:"sm:max-w-[400px]",children:[h,y,m]}),e[18]=y,e[19]=m,e[20]=v):v=e[20];let _;return e[21]!==p||e[22]!==n||e[23]!==v?(_=t.jsx(Me,{open:n,onOpenChange:p,children:v}),e[21]=p,e[22]=n,e[23]=v,e[24]=_):_=e[24],_}function tn(f){const e=oe.c(20),{open:n,onOpenChange:p,count:l,onConfirm:o}=f,i=l!==1?"s":"";let g;e[0]!==l||e[1]!==i?(g=t.jsxs(Ae,{children:["Delete ",l," connection",i,"?"]}),e[0]=l,e[1]=i,e[2]=g):g=e[2];const h=l!==1?"s":"";let j;e[3]!==h?(j=t.jsxs(we,{children:["This will permanently delete the selected connection",h,". This action cannot be undone."]}),e[3]=h,e[4]=j):j=e[4];let y;e[5]!==g||e[6]!==j?(y=t.jsxs(Te,{children:[g,j]}),e[5]=g,e[6]=j,e[7]=y):y=e[7];let N;e[8]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(Ie,{children:"Cancel"}),e[8]=N):N=e[8];const b=l!==1?"s":"";let a;e[9]!==l||e[10]!==o||e[11]!==b?(a=t.jsxs(Pe,{children:[N,t.jsxs($e,{onClick:o,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:["Delete ",l," connection",b]})]}),e[9]=l,e[10]=o,e[11]=b,e[12]=a):a=e[12];let x;e[13]!==y||e[14]!==a?(x=t.jsxs(Le,{children:[y,a]}),e[13]=y,e[14]=a,e[15]=x):x=e[15];let m;return e[16]!==p||e[17]!==n||e[18]!==x?(m=t.jsx(Oe,{open:n,onOpenChange:p,children:x}),e[16]=p,e[17]=n,e[18]=x,e[19]=m):m=e[19],m}function nn(f){return f._registryId?.includes("community-registry")===!0}function sn(f){const e=oe.c(58),{item:n,canManage:p,allConnections:l,connectedAppNames:o,connectingItemId:i,onNavigateConnected:g,onConnect:h}=f,[j,y]=E.useState(!1),[N,b]=E.useState(null);let a,x;e[0]!==o||e[1]!==n?(a=De(n)??"",x=o.has(a),e[0]=o,e[1]=n,e[2]=a,e[3]=x):(a=e[2],x=e[3]);const m=x,v=n._meta?.["mcp.mesh"],_=v?.friendlyName||v?.friendly_name||n.server?.title||n.title||n.server?.name||n.name||n.id||"",D=n.server?.description||n.description||null;let L;e[4]!==n.server?.icons?.[0]?.src||e[5]!==n.server?.repository?(L=n.server?.icons?.[0]?.src||at(n.server?.repository)||null,e[4]=n.server?.icons?.[0]?.src,e[5]=n.server?.repository,e[6]=L):L=e[6];const O=L;let s;if(e[7]!==l||e[8]!==a){let k;e[10]!==a?(k=se=>se.connection_type!=="VIRTUAL"&&se.app_name===a,e[10]=a,e[11]=k):k=e[11],s=l.filter(k),e[7]=l,e[8]=a,e[9]=s}else s=e[9];const A=s;let F;e[12]!==n?(F=nn(n),e[12]=n,e[13]=F):F=e[13];const M=F;let w,P;e[14]!==A||e[15]!==p||e[16]!==M||e[17]!==m||e[18]!==n||e[19]!==h||e[20]!==g?(w=()=>{if(m){const k=A[0];k&&g(k);return}p&&P()},P=()=>{M?(b("connect"),y(!0)):h(n)},e[14]=A,e[15]=p,e[16]=M,e[17]=m,e[18]=n,e[19]=h,e[20]=g,e[21]=w,e[22]=P):(w=e[21],P=e[22]);let z;e[23]!==n||e[24]!==h||e[25]!==N?(z=()=>{te("connections_community_warning_confirmed",{registry_item_id:n.id}),y(!1),N==="connect"&&h(n),b(null)},e[23]=n,e[24]=h,e[25]=N,e[26]=z):z=e[26];const C=z;let T;e[27]!==D||e[28]!==O||e[29]!==_?(T={title:_,description:D,icon:O},e[27]=D,e[28]=O,e[29]=_,e[30]=T):T=e[30];let G;e[31]===Symbol.for("react.memo_cache_sentinel")?(G=t.jsx(ge,{}),e[31]=G):G=e[31];let H;e[32]!==M||e[33]!==n._sourceIcon?(H=M&&n._sourceIcon&&t.jsx("img",{src:n._sourceIcon,alt:"Community",className:"size-4 rounded-sm object-contain"}),e[32]=M,e[33]=n._sourceIcon,e[34]=H):H=e[34];let X;e[35]!==p||e[36]!==i||e[37]!==P||e[38]!==m||e[39]!==n.id?(X=m?t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}):p&&t.jsx(U,{variant:"outline",size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",disabled:i!==null,onClick:k=>{k.stopPropagation(),P()},children:i===n.id?t.jsx(ce,{size:14,className:"animate-spin"}):"Connect"}),e[35]=p,e[36]=i,e[37]=P,e[38]=m,e[39]=n.id,e[40]=X):X=e[40];let c;e[41]!==H||e[42]!==X?(c=t.jsxs("div",{className:"flex items-center gap-2",children:[H,X]}),e[41]=H,e[42]=X,e[43]=c):c=e[43];let S;e[44]!==w||e[45]!==c||e[46]!==T?(S=t.jsx(Ce,{connection:T,fallbackIcon:G,onClick:w,headerActionsAlwaysVisible:!0,headerActions:c}),e[44]=w,e[45]=c,e[46]=T,e[47]=S):S=e[47];let V;e[48]===Symbol.for("react.memo_cache_sentinel")?(V=t.jsxs(Te,{children:[t.jsx(Ae,{children:"Community MCP Server"}),t.jsx(we,{children:"This MCP server is from the Community MCP Registry and is not maintained or verified by Deco. Community servers may have varying levels of quality, security, and reliability. Proceed with caution and review the server details before connecting."})]}),e[48]=V):V=e[48];let R;e[49]===Symbol.for("react.memo_cache_sentinel")?(R=t.jsx(Ie,{children:"Cancel"}),e[49]=R):R=e[49];let B;e[50]!==C?(B=t.jsxs(Le,{children:[V,t.jsxs(Pe,{children:[R,t.jsx($e,{onClick:C,children:"Continue"})]})]}),e[50]=C,e[51]=B):B=e[51];let u;e[52]!==j||e[53]!==B?(u=t.jsx(Oe,{open:j,onOpenChange:y,children:B}),e[52]=j,e[53]=B,e[54]=u):u=e[54];let $;return e[55]!==S||e[56]!==u?($=t.jsxs(t.Fragment,{children:[S,u]}),e[55]=S,e[56]=u,e[57]=$):$=e[57],$}function on({listState:f,activeTab:e,typeFilter:n,statusFilter:p,registryFilter:l,enabledRegistries:o}){const{org:i}=be(),g=it(),h=_e(),{data:j}=Ne.useSession(),y=We(),N=Lt(f),b=ft(),{granted:a}=ye("connections:manage"),{granted:x}=ye("agents:manage"),[m,v]=E.useState(new Set),_=m.size>0,[D,L]=E.useState(!1),[O,s]=E.useState(!1),[A,F]=E.useState(null),M=Ot(),w=N.filter(r=>!(n!=="ALL"&&r.connection_type!==n||p!=="ALL"&&r.status!==p)),P=ht(w),z=r=>{v(d=>{const K=new Set(d);return K.has(r)?K.delete(r):K.add(r),K})},C=()=>{v(new Set)},T=ke(o,f.searchTerm),G=T.items,H=yt(T.loadMore,T.hasMore,T.isLoadingMore),X=new Set(N.filter(r=>r.app_name).map(r=>r.app_name)),c=l==="ALL"||o.some(r=>r.id===l)?l:"ALL",S=f.search.length>0,V=e==="all"||S?G.filter(r=>{if(c!=="ALL"&&r._registryId!==c)return!1;if(S){const d=De(r);if(d&&X.has(d))return!1}return!0}):[],R=e==="connected"||S?P:[],B=async r=>{if(!(!i||!j?.user?.id)){te("connection_add_clicked",{action:"connect_new",registry_item_id:r.id,source:"connections_page"}),F(r.id);try{const d=ct(r,i.id,j.user.id,{remoteIndex:0}),K=d.connection_type==="STDIO",I=!!d.connection_url,q=K&&d.connection_headers&&typeof d.connection_headers=="object"&&"command"in d.connection_headers;if(!I&&!q){W.error("This MCP Server cannot be connected: no connection method available"),F(null);return}const{id:ne}=await y.create.mutateAsync(d),le=await Wt({connectionId:ne,orgId:i.id,orgSlug:i.slug,persistFallback:fe=>y.update.mutateAsync({id:ne,data:{connection_token:fe}}).then(()=>{})});if(le.ran&&!le.ok){te("connection_oauth_failed",{connection_id:ne,flow:"connections_page_connect",error:le.error??"no_token"}),W.error(`Authentication failed: ${le.error??"no token received"}`);return}if(le.ran){te("connection_oauth_succeeded",{connection_id:ne,flow:"connections_page_connect"});const fe=new URL(`/api/${i.slug}/mcp/${ne}`,window.location.origin);await g.invalidateQueries({queryKey:rt.isMCPAuthenticated(fe.href,null)}),$(),W.success("Authentication successful")}W.success("Connected successfully")}catch(d){W.error(`Failed to connect: ${d instanceof Error?d.message:String(d)}`)}finally{F(null)}}},u=Ft(),$=()=>{g.invalidateQueries({predicate:r=>{const d=r.queryKey;return d[1]===i.id&&d[3]==="collection"&&d[4]==="CONNECTIONS"}})},k=async()=>{L(!1);const r=[...m];te("connections_bulk_delete",{count:r.length});let d=0;for(const K of r)try{await u.call("COLLECTION_CONNECTIONS_DELETE",{id:K,force:!0}),d++}catch{}$(),W.success(`Deleted ${d} connection${d!==1?"s":""}`),C()},se=async(r,d)=>{try{await y.update.mutateAsync({id:r,data:{status:d}}),$(),W.success(d==="active"?"Connection enabled":"Connection disabled")}catch{W.error("Failed to update connection")}},xe=async r=>{const d=[...m];te("connections_bulk_status_toggled",{count:d.length,to_status:r});let K=0;for(const I of d)try{await y.update.mutateAsync({id:I,data:{status:r}}),K++}catch{}$(),W.success(`${r==="active"?"Enabled":"Disabled"} ${K} connection${K!==1?"s":""}`),C()},me=async r=>{const d=M.find(q=>q.id===r);if(!d)return;te("connections_bulk_add_to_agent",{agent_id:r,count:m.size});const K=new Set(d.connections.map(q=>q.connection_id)),I=[...m].filter(q=>!K.has(q)).map(q=>({connection_id:q,selected_tools:null,selected_resources:null,selected_prompts:null}));if(I.length===0){W.info("All selected connections are already in that agent");return}try{await u.call("COLLECTION_VIRTUAL_MCP_UPDATE",{id:r,data:{connections:[...d.connections,...I]}}),g.invalidateQueries({predicate:q=>{const ne=q.queryKey;return ne[1]===i.id&&ne[3]==="collection"&&ne[4]==="VIRTUAL_MCP"}}),W.success(`Added ${I.length} connection${I.length!==1?"s":""} to "${d.title}"`),C()}catch{W.error("Failed to add connections to agent")}};return t.jsxs(t.Fragment,{children:[t.jsx(jt,{...b}),t.jsx(tn,{open:D,onOpenChange:L,count:m.size,onConfirm:k}),t.jsx(en,{open:O,onOpenChange:s,agents:M,onConfirm:me}),T.isInitialLoading&&e==="all"?t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(ce,{size:32,className:"animate-spin text-muted-foreground"})}):t.jsx("div",{children:(S?V.length===0&&w.length===0:e==="all"?V.length===0:w.length===0)?t.jsx(gt,{image:t.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:336,height:320,"aria-hidden":"true"}),title:"No Connections found",description:f.search?`No Connections match "${f.search}"`:a?"Create a connection to get started.":"Ask an organization admin to add one."}):t.jsxs("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:[R.map(r=>{if(r.type==="group")return t.jsx(Qt,{group:r,onOpen:()=>{h({to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:r.key}})},selectionMode:_,selectedIds:m,onToggleSelect:z},r.key);const d=r.connection,K=m.has(d.id);return t.jsx(Ce,{connection:d,fallbackIcon:t.jsx(ge,{}),onClick:()=>_?z(d.id):h({to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:he(d)}}),className:de(K&&"ring-2 ring-primary bg-primary/5"),headerActionsAlwaysVisible:!0,headerActions:t.jsxs("div",{className:"flex items-center gap-1",children:[_?t.jsx(Fe,{checked:K,onCheckedChange:()=>z(d.id),onClick:I=>I.stopPropagation()}):t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}),t.jsx("div",{className:de("overflow-hidden transition-all duration-150 ease-out",_?"w-8 opacity-100":"w-0 opacity-0 group-hover:w-8 group-hover:opacity-100"),children:t.jsxs(Ue,{children:[t.jsx(Re,{asChild:!0,children:t.jsx(U,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:I=>I.stopPropagation(),children:t.jsx(Xe,{size:20})})}),t.jsxs(He,{align:"end",onClick:I=>I.stopPropagation(),children:[t.jsxs(re,{onClick:I=>{I.stopPropagation(),h({to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:he(d)}})},children:[t.jsx(qe,{size:16}),"Open"]}),(a||x)&&t.jsxs(re,{onClick:I=>{I.stopPropagation(),z(d.id)},children:[t.jsx(zt,{size:16}),"Select"]}),a&&(d.status==="active"?t.jsxs(re,{onClick:I=>{I.stopPropagation(),se(d.id,"inactive")},children:[t.jsx(Vt,{size:16}),"Disable"]}):t.jsxs(re,{onClick:I=>{I.stopPropagation(),se(d.id,"active")},children:[t.jsx(Et,{size:16}),"Enable"]})),a&&t.jsxs(re,{variant:"destructive",onClick:I=>{I.stopPropagation(),b.requestDelete(d)},children:[t.jsx(Qe,{size:16}),"Delete"]})]})]})})]})},d.id)}),V.map(r=>t.jsx(sn,{item:r,canManage:a,allConnections:N,connectedAppNames:X,connectingItemId:A,onNavigateConnected:d=>h({to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:he(d)}}),onConnect:B},`catalog-${r._registryId}:${r.id}`)),(e==="all"||S)&&o.length>0&&t.jsx("div",{ref:H,className:"col-span-full h-4"}),(e==="all"||S)&&T.isLoadingMore&&t.jsx("div",{className:"col-span-full flex justify-center py-6",children:t.jsx(ce,{size:24,className:"animate-spin text-muted-foreground"})})]})}),_&&t.jsx(Zt,{count:m.size,total:w.length,canManage:a,canManageAgents:x,onSelectAll:()=>{v(new Set(w.map(r=>r.id)))},onDeselectAll:()=>v(new Set),onDelete:()=>L(!0),onAddToAgent:()=>s(!0),onToggleStatus:xe,onCancel:C})]})}function rn(){const{org:f}=be(),e=_e(),n=Ze({strict:!1}),{data:p}=Ne.useSession(),{stdioEnabled:l}=et(),o=At(),{granted:i}=ye("connections:manage"),g=Gt({namespace:f.slug,resource:"connections"}),h=We(),[j,y]=tt(nt.connectionsTab(f.slug),c=>n.tab==="all"||n.tab==="connected"?n.tab:c??"all"),[N,b]=E.useState("ALL"),[a,x]=E.useState("ALL"),[m,v]=E.useState("ALL"),_=pt(),L=ke(_,g.searchTerm).items,O=g.search!==g.searchTerm,s=st({resolver:ot(Kt),defaultValues:{title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),A=s.watch("ui_type"),F=s.watch("connection_url"),M=s.watch("npx_package"),w=pe({uiType:A,connectionUrl:F??"",npxPackage:M??""})??Se({uiType:A,connectionUrl:F??"",registryItems:L}),P=i&&n.action==="create",z=()=>{te("connections_custom_dialog_opened",{source:"connections_page"}),e({to:"/$org/settings/connections",params:{org:f.slug},search:{action:"create"}})},C=()=>{e({to:"/$org/settings/connections",params:{org:f.slug},search:{}})},T=async c=>{let S,V=null,R=null,B=null;c.ui_type==="NPX"?(S="STDIO",V="",B=Rt(c.npx_package||"",c.env_vars||[])):c.ui_type==="STDIO"?(S="STDIO",V="",B=Ht(c.stdio_command||"",c.stdio_args||"",c.stdio_cwd,c.env_vars||[])):(S=c.ui_type,V=c.connection_url||"",R=c.connection_token||null);const u=lt("conn");te("connection_custom_created",{connection_type:S,ui_type:c.ui_type}),await h.create.mutateAsync({id:u,title:c.title,description:c.description||null,connection_type:S,connection_url:V,connection_token:R,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:p?.user?.id||"system",organization_id:f.id,icon:c.icon??null,app_name:null,app_id:null,connection_headers:B,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),C(),s.reset(),e({to:"/$org/settings/connections/$appSlug",params:{org:f.slug,appSlug:he({app_name:null,connection_url:V,title:c.title,id:u})}})},G=c=>{c||(P&&C(),s.reset())},H=c=>{const S=c.trim();if(!S)return;const V=!!s.formState.dirtyFields.title,R=!!s.formState.dirtyFields.description,B=!!s.formState.dirtyFields.env_vars,u=k=>{if(k&&(!V&&!s.getValues("title").trim()&&k.title&&s.setValue("title",k.title,{shouldDirty:!1}),!R&&!(s.getValues("description")??"").trim()&&k.description&&s.setValue("description",k.description,{shouldDirty:!1}),!B&&k.envVarKeys?.length)){const se=s.getValues("env_vars")??[],xe=new Set(se.map(r=>r.key)),me=k.envVarKeys.filter(r=>!xe.has(r));me.length>0&&s.setValue("env_vars",[...se,...me.map(r=>({key:r,value:""}))],{shouldDirty:!0})}},$=Ut(S);if($&&l){s.setValue("ui_type","NPX",{shouldDirty:!0}),s.setValue("npx_package",$.packageName,{shouldDirty:!0}),s.setValue("connection_url","",{shouldDirty:!0}),s.setValue("connection_token",null,{shouldDirty:!0}),u(pe({uiType:"NPX",npxPackage:$.packageName}));return}if(S.startsWith("http://")||S.startsWith("https://")){const k=A==="HTTP"||A==="SSE"||A==="Websocket"?A:"HTTP";s.setValue("ui_type",k,{shouldDirty:!0}),s.setValue("connection_url",S,{shouldDirty:!0}),u(pe({uiType:k,connectionUrl:S})??Se({uiType:k,connectionUrl:S,registryItems:L}));return}A==="NPX"&&u(pe({uiType:"NPX",npxPackage:S}))},X=i?t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(U,{variant:"outline",onClick:z,children:[t.jsx(Ge,{size:14,className:"sm:hidden"}),t.jsx("span",{className:"hidden sm:inline",children:"Custom Connection"})]})}):null;return t.jsx(t.Fragment,{children:t.jsxs(ue,{children:[(()=>{const c="Create Connection",S="Create a custom connection in your organization. Fill in the details below.",V=s.formState.isSubmitting?"Saving...":"Create Connection",R=t.jsxs("div",{className:"grid gap-4",children:[t.jsx(Q,{control:s.control,name:"ui_type",render:({field:u})=>t.jsxs(J,{children:[t.jsx(Y,{children:"Type *"}),t.jsxs(wt,{value:u.value,onValueChange:u.onChange,children:[t.jsx(Z,{children:t.jsx(Tt,{children:t.jsx(It,{})})}),t.jsxs(Pt,{children:[t.jsx(ae,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(je,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(ae,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(je,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(ae,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(je,{className:"w-4 h-4"}),"Websocket"]})}),l&&t.jsxs(t.Fragment,{children:[t.jsx(ae,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ge,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(ae,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Mt,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(ee,{})]})}),A==="NPX"&&t.jsx(Q,{control:s.control,name:"npx_package",render:({field:u})=>t.jsxs(J,{children:[t.jsx(Y,{children:"NPM Package *"}),t.jsx(Z,{children:t.jsx(ie,{placeholder:"@perplexity-ai/mcp-server",...u,value:u.value??"",onPaste:$=>{const k=$.clipboardData.getData("text");k&&($.preventDefault(),s.setValue("npx_package",k.trim(),{shouldDirty:!0}),H(k))},onBlur:$=>{H($.target.value),u.onBlur()}})}),t.jsx(ee,{})]})}),A==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[t.jsx(Q,{control:s.control,name:"stdio_command",render:({field:u})=>t.jsxs(J,{children:[t.jsx(Y,{children:"Command *"}),t.jsx(Z,{children:t.jsx(ie,{placeholder:"node, bun, python...",...u,value:u.value??""})}),t.jsx(ee,{})]})}),t.jsx(Q,{control:s.control,name:"stdio_args",render:({field:u})=>t.jsxs(J,{children:[t.jsx(Y,{children:"Arguments"}),t.jsx(Z,{children:t.jsx(ie,{placeholder:"arg1 arg2 --flag value",...u,value:u.value??""})}),t.jsx(ee,{})]})})]}),t.jsx(Q,{control:s.control,name:"stdio_cwd",render:({field:u})=>t.jsxs(J,{children:[t.jsx(Y,{children:"Working Directory"}),t.jsx(Z,{children:t.jsx(ie,{placeholder:"/path/to/project (optional)",...u,value:u.value??""})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory where the command will be executed"}),t.jsx(ee,{})]})})]}),(A==="NPX"||A==="STDIO")&&t.jsx(Q,{control:s.control,name:"env_vars",render:({field:u})=>t.jsxs(J,{children:[t.jsx(Y,{children:"Environment Variables"}),t.jsx(Z,{children:t.jsx(Bt,{value:u.value??[],onChange:u.onChange})}),t.jsx(ee,{})]})}),A!=="NPX"&&A!=="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsx(Q,{control:s.control,name:"connection_url",render:({field:u})=>t.jsxs(J,{children:[t.jsx(Y,{children:"URL *"}),t.jsx(Z,{children:t.jsx(ie,{placeholder:"https://example.com/mcp",...u,value:u.value??"",onPaste:$=>{const k=$.clipboardData.getData("text");k&&($.preventDefault(),s.setValue("connection_url",k.trim(),{shouldDirty:!0}),H(k))},onBlur:$=>{H($.target.value),u.onBlur()}})}),t.jsx(ee,{})]})}),t.jsx(Q,{control:s.control,name:"connection_token",render:({field:u})=>t.jsxs(J,{children:[t.jsx(Y,{children:w?.token?.label??"Token (optional)"}),t.jsx(Z,{children:t.jsx(ie,{type:"password",placeholder:w?.token?.placeholder??"Bearer token or API key",...u,value:u.value??""})}),w?.token?.helperText&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:[w.token.helperText,w.id==="github"&&t.jsxs(t.Fragment,{children:[" ","·"," ",t.jsx("a",{className:"text-foreground underline underline-offset-4 hover:text-foreground/80",href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noreferrer",children:"Open GitHub PAT settings"})]})]}),t.jsx(ee,{})]})})]}),t.jsx(Q,{control:s.control,name:"title",render:({field:u})=>t.jsxs(J,{children:[t.jsx(Y,{children:"Name *"}),t.jsx(Z,{children:t.jsx(ie,{placeholder:"My Connection",...u})}),t.jsx(ee,{})]})}),t.jsx(Q,{control:s.control,name:"description",render:({field:u})=>t.jsxs(J,{children:[t.jsx(Y,{children:"Description"}),t.jsx(Z,{children:t.jsx($t,{placeholder:"A brief description of this connection",rows:3,...u,value:u.value??""})}),t.jsx(ee,{})]})})]}),B=P;return o?t.jsx(vt,{open:B,onOpenChange:G,children:t.jsxs(St,{className:"max-h-[90vh]",children:[t.jsx(bt,{className:"pb-2",children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"flex-1 text-left",children:[t.jsx(_t,{children:c}),t.jsx(Nt,{className:"mt-1",children:S})]}),t.jsx(Dt,{asChild:!0,children:t.jsx(U,{variant:"ghost",size:"icon",className:"shrink-0 -mt-1",children:t.jsx(Je,{size:16})})})]})}),t.jsx(ve,{...s,children:t.jsxs("form",{onSubmit:s.handleSubmit(T),children:[t.jsx("div",{className:"overflow-y-auto px-4 pb-4",children:R}),t.jsx(kt,{children:t.jsx(U,{type:"submit",disabled:s.formState.isSubmitting,className:"w-full",children:V})})]})})]})}):t.jsx(Me,{open:B,onOpenChange:G,children:t.jsxs(ze,{className:"sm:max-w-[525px]",children:[t.jsxs(Ve,{children:[t.jsx(Ee,{children:c}),t.jsx(Be,{children:S})]}),t.jsx(ve,{...s,children:t.jsxs("form",{onSubmit:s.handleSubmit(T),children:[t.jsx("div",{className:"py-4",children:R}),t.jsxs(Ke,{children:[t.jsx(U,{type:"button",variant:"outline",onClick:()=>G(!1),children:"Cancel"}),t.jsx(U,{type:"submit",disabled:s.formState.isSubmitting,className:"min-w-40",children:V})]})]})})]})})})(),t.jsx(ue.Content,{children:t.jsx(ue.Body,{children:t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsx(ue.Title,{children:"Connections"}),t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(mt,{value:g.search,onChange:g.setSearch,placeholder:"Search for a connection",className:"w-full md:w-[375px]",onKeyDown:c=>{c.key==="Escape"&&(g.setSearch(""),c.target.blur())}}),t.jsx(dt,{sortKey:g.sortKey,sortDirection:g.sortDirection,onSort:g.handleSort,sortOptions:[{id:"title",label:"Name"},{id:"description",label:"Description"},{id:"connection_type",label:"Type"},{id:"updated_by",label:"Updated by"},{id:"updated_at",label:"Updated"}],filters:[{label:"Type",value:N,onChange:c=>b(c||"ALL"),options:[{id:"ALL",label:"All"},{id:"HTTP",label:"HTTP"},{id:"SSE",label:"SSE"},{id:"Websocket",label:"WebSocket"},{id:"STDIO",label:"STDIO"}]},{label:"Status",value:a,onChange:c=>x(c||"ALL"),options:[{id:"ALL",label:"All"},{id:"active",label:"Active"},{id:"inactive",label:"Inactive"},{id:"error",label:"Error"}]},..._.length>1?[{label:"Registry",value:m,onChange:c=>v(c||"ALL"),options:[{id:"ALL",label:"All registries"},..._.map(c=>({id:c.id,label:c.id.includes("community-registry")?"Community MCP Registry":c.title}))]}]:[]]})]}),X]}),t.jsx(ut,{tabs:[{id:"all",label:"All"},{id:"connected",label:"Connected"}],activeTab:j,onTabChange:c=>{const S=c;S!==j&&te("connections_page_tab_changed",{to_tab:S}),y(S)}}),t.jsx(E.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(ce,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx("div",{style:{opacity:O?.5:1,transition:O?"opacity 0.2s 0.2s linear":"opacity 0s 0s linear",pointerEvents:O?"none":"auto"},children:t.jsx(on,{listState:g,activeTab:j,typeFilter:N,statusFilter:a,registryFilter:m,enabledRegistries:_})})})]})})})]})})}function Ms(){const f=oe.c(1);let e;return f[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Ye,{children:t.jsx(E.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(ce,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(rn,{})})}),f[0]=e):e=f[0],e}export{Ms as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{c as Ke,r as l,j as i,i as re,B as fe,l as Ve,m as ut,t as $,K as Te}from"./index-20lo5teZ.js";import{F as mt,l as pt}from"./index-BBUDuLgB.js";import{e as ht,au as xt,av as gt,aw as ae,ax as yt,U as $e}from"./agent-icon-Bk1Ofbdo.js";import{a as wt}from"./Tool01-DcPFccxt.js";import{s as jt}from"./XClose-m9X1QqKX.js";import{S as bt}from"./scroll-area-BlJNYaPT.js";import{b as Oe,T as Re,a as ze}from"./tooltip-B_mKOQvv.js";import{f as vt,a as Ct,b as Nt,c as St,d as Dt,e as kt,A as Ft,g as Lt}from"./alert-dialog-CKnoCFTw.js";import{u as Et}from"./chat-context-BdyPsWKn.js";import{b as Pt}from"./shell-layout-xhRX4rsB.js";import{al as le,am as Ae,an as Tt}from"./index-CDpdJTKU.js";import{a as $t,b as Ot,D as Rt,e as zt,c as At,d as Wt}from"./dialog-DtA5oh9D.js";import{I as We}from"./input-D2VJ6ahm.js";import{b as It,C as _,a as Ie,c as Mt,d as Kt}from"./context-menu-BiiNCW4n.js";import{t as Vt}from"./ChevronDown-aoqAeXtt.js";import{i as Bt}from"./ChevronRight-CUGhm8E7.js";import{b as Gt}from"./ZoomOut-C-l0YUGT.js";import{E as qt,z as Me,A as he,B as Qt,C as Ut,D as Jt,G as M,I as ce,g as xe,J as ge,K as Ht,M as Xt,N as ye,O as de,P as we,Q as Yt,U as Zt}from"./preview-dialog-pnlDSJ8-.js";import"./AlertCircle-ChcBH14n.js";import"./SwitchHorizontal01-EOva-Jpw.js";import"./Settings02-BIpY6Zhb.js";import"./XCircle-ovYWqZM6.js";import"./ArrowUpRight-BfxsIWO1.js";import"./ZapSquare-BlfnVn5C.js";import"./Users03-NRaUurHt.js";import"./CheckCircle-Cm1GnmVj.js";import"./ChevronUp-BDbnz61t.js";import"./ChevronLeft-CoW1IpXE.js";import"./DotsVertical-BcvtEj5g.js";import"./Stars02-C-addu2P.js";import"./Eye-BhqO9K0O.js";import"./Globe01-CTIuSSD9.js";import"./FilterLines-DTI31VpW.js";import"./Star01-HcsxMzHs.js";import"./Globe04-Dy3PA2Yl.js";import"./HardDrive-DYVC-Zaq.js";import"./Key01-bDEyn58I.js";import"./LayoutLeft-DjTexk5_.js";import"./LinkExternal01-COQYOgEI.js";import"./Monitor01-DV9tmVAF.js";import"./Sun-B11PPq5-.js";import"./Palette-CD1fLCtB.js";import"./Play-Dl0pf4M6.js";import"./Plus-BEdvqzrP.js";import"./SearchMd-DK3hZUVF.js";import"./Shield01-Dx8gqKG5.js";import"./Stars01-VD9js_iZ.js";import"./Trash01-BfKdeD7S.js";import"./Upload01-T8pN8jBP.js";import"./User01-DxWsEbM9.js";import"./Users01-C7ItyIdk.js";import"./X-Ciyf96Wa.js";import"./Zap-Bci_Afjv.js";import"./use-clock-tick-DvWNr9a0.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-D6L-AQL_.js";import"./file-type-icon-3wYgaJ1f.js";import"./tab-id-BptcWVWa.js";import"./content-blocks-o63cs2vh.js";import"./types-Cms0eXYe.js";import"./use-mcp-client-CxXf5rsq.js";import"./auth-Ci2ZRRcb.js";import"./hooks-BdXI0ZZ7.js";import"./decopilot-sse-pool-DhvSomLP.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./studio-tools-DqPhjgPW.js";import"./sheet-BBGbheOC.js";import"./integration-icon-62cL4F-8.js";import"./use-virtual-mcp-CwSMwdwq.js";import"./use-collections-74mCujh3.js";import"./use-navigate-to-agent-D8CoEyF3.js";import"./use-connection-D-7QpVUJ.js";import"./use-mcp-prompts-CqbI2uxQ.js";import"./form-BPgAGzjC.js";import"./label-Xkc4XdLq.js";import"./index-BdQq_4o_.js";import"./use-ai-providers-BFPg4Nao.js";import"./use-organization-settings-CTH2EptF.js";import"./avatar-BLEdyY7-.js";import"./required-auth-layout-hnMHneNT.js";import"./use-org-sso-D9H6UI9E.js";import"./index-DsiMEgqD.js";import"./drawer-zXrFQNCR.js";import"./collection-search-C1sxKyva.js";import"./select-C0AEr1SL.js";import"./tabs-BqGLbeO9.js";import"./toggle-group-Db5bABta.js";import"./sortable.esm-DMoaSsem.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-gZqWtnUr.js";import"./use-registry-connections-jcbA10JV.js";import"./useInfiniteQuery-CWme5rGZ.js";import"./use-infinite-scroll-hOEUoZD8.js";import"./extract-connection-data-DlaPzbl9.js";import"./card-mAs4nLtf.js";import"./collection-tabs-Csv5ENUX.js";import"./badge-C9MXVg0W.js";import"./textarea-BqMqcZIm.js";import"./connection-form-helpers-4cMYvdoC.js";import"./authenticate-and-persist-oauth-CjSCavkQ.js";import"./mcp-oauth-CsZ919dh.js";import"./useSuspenseInfiniteQuery-DVa_SnfJ.js";import"./connect-desktop-dialog-CkD3zyKJ.js";import"./decopilot-CW6d29Nv.js";import"./checkbox-B9vj-Cdf.js";import"./skeleton-CVRpN7O3.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-CP7jibDA.js";import"./popover-CHlLC07g.js";import"./command-vbsMaAT6.js";import"./index-wuE_wZDF.js";import"./dropdown-menu-DBXGBAAP.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-CfsHQQ72.js";import"./empty-state-YJ1DU6Lk.js";import"./toolbar-DDUCJSbz.js";import"./use-mcp-tools-CLWDDSx5.js";import"./use-capability-C1-FHW22.js";import"./shell-route-loading-C4SUOonb.js";import"./tools-list-DkXVWS7e.js";import"./switch-BOUA2FBT.js";import"./use-debounced-autosave-B3nrE_1Y.js";import"./index-BoBbtnrJ.js";import"./sidebar-Cx68CPJi.js";import"./search-input-DucmHYf0.js";import"./github-repo-picker-hOzqpBMc.js";import"./use-secrets-CfUCGkTu.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./view-mode-toggle-BZ52Zalr.js";import"./index-BaiqhWaL.js";import"./automation-runs-BNON3nJA.js";import"./table-hboPJhBa.js";import"./use-members-Cd4dRzb0.js";import"./use-org-auth-client-CSAS1fgX.js";import"./task-status-DbMlzbTm.js";import"./use-automations-C_LX8Dvr.js";import"./use-file-configs-DNAtFvn4.js";import"./monaco-editor-C0cKgOd8.js";import"./select-model-C78uu1xA.js";import"./automation-list-row-Cuo6QaWy.js";const _t={"new-file":{title:"New File",description:"Enter a name for the new file.",submit:"Create",placeholder:"filename.ts"},"new-folder":{title:"New Folder",description:"Enter a name for the new folder.",submit:"Create",placeholder:"folder-name"},rename:{title:"Rename",description:"Enter a new name for this item.",submit:"Rename",placeholder:"new-name"}};function en(y){const e=Ke.c(51),{open:c,mode:K,initialName:X,parentLabel:Q,isPending:A,onSubmit:V,onOpenChange:P}=y,W=X===void 0?"":X,o=A===void 0?!1:A,[p,O]=l.useState(W),[I,B]=l.useState(c),f=_t[K];c!==I&&(B(c),c&&O(W));let F;e[0]!==o||e[1]!==P?(F=E=>{!E&&!o&&P(!1)},e[0]=o,e[1]=P,e[2]=F):F=e[2];const U=F;let G;e[3]!==o||e[4]!==p||e[5]!==V?(G=async E=>{E.preventDefault();const z=p.trim();!z||o||await V(z)},e[3]=o,e[4]=p,e[5]=V,e[6]=G):G=e[6];const q=G;let L;e[7]!==f.title?(L=i.jsx($t,{children:f.title}),e[7]=f.title,e[8]=L):L=e[8];let N;e[9]!==f.description?(N=i.jsx(Ot,{children:f.description}),e[9]=f.description,e[10]=N):N=e[10];let R;e[11]!==L||e[12]!==N?(R=i.jsxs(Rt,{children:[L,N]}),e[11]=L,e[12]=N,e[13]=R):R=e[13];let S;e[14]!==Q?(S=Q&&i.jsxs("div",{className:"space-y-1.5",children:[i.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Location"}),i.jsx(We,{value:Q,readOnly:!0,disabled:!0,className:"font-mono text-xs"})]}),e[14]=Q,e[15]=S):S=e[15];let D;e[16]===Symbol.for("react.memo_cache_sentinel")?(D=i.jsx("label",{htmlFor:"file-explorer-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[16]=D):D=e[16];let j;e[17]===Symbol.for("react.memo_cache_sentinel")?(j=E=>O(E.target.value),e[17]=j):j=e[17];let b;e[18]!==f.placeholder||e[19]!==o||e[20]!==p?(b=i.jsxs("div",{className:"space-y-1.5",children:[D,i.jsx(We,{id:"file-explorer-name",value:p,onChange:j,placeholder:f.placeholder,autoFocus:!0,disabled:o})]}),e[18]=f.placeholder,e[19]=o,e[20]=p,e[21]=b):b=e[21];let h;e[22]!==b||e[23]!==S?(h=i.jsxs("div",{className:"space-y-4 py-4",children:[S,b]}),e[22]=b,e[23]=S,e[24]=h):h=e[24];let x;e[25]!==P?(x=()=>P(!1),e[25]=P,e[26]=x):x=e[26];let v;e[27]!==o||e[28]!==x?(v=i.jsx(fe,{type:"button",variant:"outline",onClick:x,disabled:o,children:"Cancel"}),e[27]=o,e[28]=x,e[29]=v):v=e[29];let C;e[30]!==o||e[31]!==p?(C=!p.trim()||o,e[30]=o,e[31]=p,e[32]=C):C=e[32];let u;e[33]!==f.submit||e[34]!==o?(u=o?i.jsxs(i.Fragment,{children:[i.jsx(re,{size:14,className:"animate-spin"}),"Saving…"]}):f.submit,e[33]=f.submit,e[34]=o,e[35]=u):u=e[35];let k;e[36]!==C||e[37]!==u?(k=i.jsx(fe,{type:"submit",disabled:C,children:u}),e[36]=C,e[37]=u,e[38]=k):k=e[38];let m;e[39]!==v||e[40]!==k?(m=i.jsxs(zt,{children:[v,k]}),e[39]=v,e[40]=k,e[41]=m):m=e[41];let g;e[42]!==q||e[43]!==h||e[44]!==m||e[45]!==R?(g=i.jsx(At,{className:"sm:max-w-md",children:i.jsxs("form",{onSubmit:q,children:[R,h,m]})}),e[42]=q,e[43]=h,e[44]=m,e[45]=R,e[46]=g):g=e[46];let T;return e[47]!==U||e[48]!==c||e[49]!==g?(T=i.jsx(Wt,{open:c,onOpenChange:U,children:g}),e[47]=U,e[48]=c,e[49]=g,e[50]=T):T=e[50],T}const tn="#d9a441";function nn(y){const e=Ke.c(45),{node:c,depth:K,isExpanded:X,isSelected:Q,isLoading:A,fileVisual:V,onOpen:P,onSelect:W,onNewFile:o,onNewFolder:p,onCopyPath:O,onCopyRelativePath:I,onRename:B,onDelete:f}=y,F=A===void 0?!1:A,U=c.kind==="directory",{Icon:G,color:q}=V,L=Q&&"bg-accent";let N;e[0]!==L?(N=Ve("flex w-full items-center gap-1.5 px-2 py-1.5 text-left text-[13px] hover:bg-accent transition-colors",L),e[0]=L,e[1]=N):N=e[1];const R=`${K*14+8}px`;let S;e[2]!==R?(S={paddingLeft:R},e[2]=R,e[3]=S):S=e[3];let D;e[4]!==P||e[5]!==W?(D=()=>{W(),P()},e[4]=P,e[5]=W,e[6]=D):D=e[6];let j;e[7]!==G||e[8]!==q||e[9]!==U||e[10]!==X||e[11]!==F?(j=U?i.jsxs(i.Fragment,{children:[F?i.jsx(re,{size:14,className:"shrink-0 animate-spin text-muted-foreground"}):X?i.jsx(Vt,{size:14,className:"shrink-0 text-muted-foreground"}):i.jsx(Bt,{size:14,className:"shrink-0 text-muted-foreground"}),i.jsx(Gt,{size:16,className:"shrink-0",style:{color:tn}})]}):i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"w-3.5 shrink-0"}),i.jsx(G,{size:16,className:"shrink-0",style:{color:q}})]}),e[7]=G,e[8]=q,e[9]=U,e[10]=X,e[11]=F,e[12]=j):j=e[12];let b;e[13]!==c.name?(b=i.jsx("span",{className:"truncate",children:c.name}),e[13]=c.name,e[14]=b):b=e[14];let h;e[15]!==N||e[16]!==S||e[17]!==D||e[18]!==j||e[19]!==b?(h=i.jsx(It,{asChild:!0,children:i.jsxs("button",{type:"button",className:N,style:S,onClick:D,children:[j,b]})}),e[15]=N,e[16]=S,e[17]=D,e[18]=j,e[19]=b,e[20]=h):h=e[20];let x;e[21]!==o?(x=i.jsx(_,{onSelect:o,children:"New File"}),e[21]=o,e[22]=x):x=e[22];let v;e[23]!==p?(v=i.jsx(_,{onSelect:p,children:"New Folder"}),e[23]=p,e[24]=v):v=e[24];let C;e[25]===Symbol.for("react.memo_cache_sentinel")?(C=i.jsx(Ie,{}),e[25]=C):C=e[25];let u;e[26]!==O?(u=i.jsx(_,{onSelect:O,children:"Copy Path"}),e[26]=O,e[27]=u):u=e[27];let k;e[28]!==I?(k=i.jsx(_,{onSelect:I,children:"Copy Relative Path"}),e[28]=I,e[29]=k):k=e[29];let m;e[30]===Symbol.for("react.memo_cache_sentinel")?(m=i.jsx(Ie,{}),e[30]=m):m=e[30];let g;e[31]!==B?(g=i.jsx(_,{onSelect:B,children:"Rename"}),e[31]=B,e[32]=g):g=e[32];let T;e[33]!==f?(T=i.jsx(_,{variant:"destructive",onSelect:f,children:"Delete"}),e[33]=f,e[34]=T):T=e[34];let E;e[35]!==x||e[36]!==v||e[37]!==u||e[38]!==k||e[39]!==g||e[40]!==T?(E=i.jsxs(Mt,{className:"w-52",children:[x,v,C,u,k,m,g,T]}),e[35]=x,e[36]=v,e[37]=u,e[38]=k,e[39]=g,e[40]=T,e[41]=E):E=e[41];let z;return e[42]!==E||e[43]!==h?(z=i.jsxs(Kt,{children:[h,E]}),e[42]=E,e[43]=h,e[44]=z):z=e[44],z}pt.config({paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.0/min/vs"}});function je(y,e,c,K){return`/api/${y}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(c)}/${K}`}function rn(y){const e=M(y);return!e||e.includes("..")||e.includes("\\")?!1:e.startsWith(".deco/blocks/")||!e.startsWith("/")&&!e.includes("://")}const sn="#94a3b8";function on(y){const e=y.toLowerCase();return e.endsWith(".tsx")||e.endsWith(".ts")?{Icon:ae,color:"#3b82f6"}:e.endsWith(".jsx")||e.endsWith(".js")||e.endsWith(".mjs")||e.endsWith(".cjs")?{Icon:ae,color:"#d9a441"}:e.endsWith(".json")?{Icon:yt,color:"#cb9b3f"}:e.endsWith(".css")||e.endsWith(".scss")?{Icon:ae,color:"#06b6d4"}:e.endsWith(".html")||e.endsWith(".xml")?{Icon:ae,color:"#f97316"}:/\.(png|jpe?g|gif|webp|avif|ico|svg)$/.test(e)?{Icon:wt,color:"#a855f7"}:e.endsWith(".md")||e.endsWith(".mdx")?{Icon:$e,color:"#64748b"}:{Icon:$e,color:sn}}function Mi({orgSlug:y,virtualMcpId:e,branch:c,openPath:K}){const[X,Q]=l.useState({files:[],directories:[],truncated:!1}),{files:A,directories:V}=X,[P,W]=l.useState(new Set),[o,p]=l.useState(null),[O,I]=l.useState(null),[B,f]=l.useState([]),[F,U]=l.useState(""),[G,q]=l.useState(!1),[L,N]=l.useState(!1),[,R]=l.useState(new Set),[S,D]=l.useState(new Set),j=l.useRef(0),b=l.useRef(null),h=l.useRef(new Set),x=l.useRef(new Map);function v(t){R(n=>{const r=typeof t=="function"?t(n):t;return h.current=r,r})}const[C,u]=l.useState(new Map),k=l.useRef(null),[m,g]=l.useState(null),{sendMessage:T}=Et(),{setChatOpen:E}=Pt(),z=ut(),[w,J]=l.useState(null),[H,ue]=l.useState(null),[ee,ie]=l.useState(!1);async function te(t,n){const r=await fetch(je(y,e,c,t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n)});if(!r.ok){const s=await r.json().catch(()=>({}));throw new Error(s.error??`Request failed (${r.status})`)}return r.json()}async function se(){z.invalidateQueries({queryKey:Ae(y,e,c)})}function be(t,n){navigator.clipboard.writeText(n).then(()=>$.success(`${t} copied`),()=>$.error(`Failed to copy ${t.toLowerCase()}`))}function Be(t){const n=Yt(t);if(!n)return;const r=`${y}/${e}/${c}`;z.setQueryData(Te.decofile(r),s=>{if(!s)return s;const{[n]:a,...d}=s;return d}),z.invalidateQueries({queryKey:Te.liveMeta(r)})}function Ge(t){const n=t.kind==="file"?[t.path]:A.filter(r=>r.startsWith(".deco/blocks/")).map(r=>ce(r)).filter(r=>r===t.path||r.startsWith(`${t.path}/`));for(const r of n)Be(r)}function qe(t){const n=ce(t);return B.filter(r=>{if(r!==n&&!r.startsWith(`${n}/`))return!1;const s=C.get(r);return!!(s?.loaded&&s.editorValue!==s.savedContent)})}function ve(t){f(n=>n.map(r=>t(r)).filter(r=>r!==null)),p(n=>n&&t(n)),u(n=>{const r=new Map;for(const[s,a]of n){const d=t(s);d&&r.set(d,a)}return r}),I(n=>{if(!n)return n;const r=t(n.path);return r?r===n.path?n:{...n,path:r,name:r.split("/").pop()??r}:null})}function Qe(t){const n=ce(t);I(r=>r&&(r.path===n||r.path.startsWith(`${n}/`)?null:r)),ve(r=>r===n||r.startsWith(`${n}/`)?null:r)}async function Ue(t){if(!w)return;const n=de(w.parentDir,t);if(we(n,A,V))throw new Error(`"${t}" already exists`);await te("write",{path:M(n),content:""}),await ne(),await se(),J(null),me(n)}async function Je(t){if(!w)return;const n=de(w.parentDir,t);if(we(n,A,V))throw new Error(`"${t}" already exists`);const r=M(n);await te("mkdir",{path:r}),Q(s=>({...s,directories:s.directories.includes(r)?s.directories:[...s.directories,r]})),await ne(),await se(),J(null),W(s=>{const a=new Set(s);for(const d of he(n))a.add(d);return a.add(n),a}),I({name:t,path:n,kind:"directory",children:[]})}async function He(t){if(!w)return;const n=w.node.path,r=ye(n),s=de(r,t);if(s===n){J(null);return}if(we(s,A,V))throw new Error(`"${t}" already exists`);await te("rename",{from:M(n),to:M(s)}),ve(a=>a===n?s:a.startsWith(`${n}/`)?de(s,a.slice(n.length+1)):a),await ne(),await se(),J(null)}async function Xe(t){ie(!0);try{await te("unlink",{path:M(t.path),recursive:t.kind==="directory"}),Ge(t),Qe(t.path),await ne(),await se(),ue(null),$.success(`Deleted "${t.name}"`)}catch(n){$.error(n instanceof Error?n.message:"Delete failed")}finally{ie(!1)}}async function Ye(t){const n=Xt(t);if(n){$.error(n);return}ie(!0);try{w?.mode==="new-file"?(await Ue(t),$.success(`Created "${t}"`)):w?.mode==="new-folder"?(await Je(t),$.success(`Created folder "${t}"`)):w?.mode==="rename"&&(await He(t),$.success(`Renamed to "${t}"`))}catch(r){$.error(r instanceof Error?r.message:"Operation failed")}finally{ie(!1)}}const Ce=l.useRef(!1);Ce.current||(Ce.current=!0,b.current=ne());const[Ze,_e]=l.useState(null);if(K&&K!==Ze){_e(K);const t=K;queueMicrotask(()=>{rn(t)&&me(t).catch(n=>{$.error(n instanceof Error?n.message:"Failed to open file")})})}async function Ne(t){const n=await te("glob",t);return{files:n.files??[],directories:n.directories??[],truncated:n.truncated}}function Se(t,n,r){if(r!==j.current)return!1;let s=!1;return Q(a=>{const d=n?Zt(a.files,a.directories,t,a.truncated):{files:t.files,directories:t.directories??[],truncated:!!t.truncated};return s=!!d.truncated,{files:d.files,directories:d.directories,truncated:s}}),s&&$.warning("File list truncated — some files may be hidden"),s}async function et(t){const n=x.current.get(t);if(n)return n;const r=j.current,s=(async()=>{const a=await Ne({pattern:"**/*",path:M(t),limit:Me}),d=Se(a,!0,r);return!d&&r===j.current&&v(Y=>{const oe=new Set(Y);return oe.add(t),oe}),d})();x.current.set(t,s);try{return await s}finally{x.current.delete(t)}}async function De(t){if(!ge(t,h.current))return!1;D(n=>new Set(n).add(t));try{return await et(t)}finally{D(n=>{const r=new Set(n);return r.delete(t),r})}}async function tt(t){const n=new Set(h.current);for(const r of he(t)){if(!ge(r,n))continue;if(await De(r))throw new Error("Folder listing truncated — expand again to load more");n.add(r)}}async function ne(){const t=++j.current;x.current.clear(),q(!0),v(new Set),W(new Set),D(new Set);try{const n=await Ne({pattern:"**/*",limit:Me,maxDepth:qt});Se(n,!1,t),N(!0)}catch{L&&$.error("Failed to refresh file tree")}finally{q(!1)}}async function ke(t){if(!C.get(t)?.loaded){u(r=>{const s=new Map(r);return s.set(t,{savedContent:"",editorValue:"",loaded:!1}),s});try{const r=await fetch(je(y,e,c,"read"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:M(t),full:!0})});if(!r.ok)return;const s=await r.json(),a=Ht(s.content??"");u(d=>{const Y=new Map(d);return Y.set(t,{savedContent:a,editorValue:a,loaded:!0}),Y})}catch{}}}async function nt(t,n){try{const r=await fetch(je(y,e,c,"write"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:M(t),content:n})});if(!r.ok){le("file save failed",{path:t,status:r.status});return}le("file saved via sandbox /write",{path:t}),z.invalidateQueries({queryKey:Ae(y,e,c)});try{const s=await Tt(y,e,c);le("git status after save",s)}catch(s){le("git status after save failed",{path:t,error:s instanceof Error?s.message:String(s)})}u(s=>{const a=new Map(s),d=a.get(t);return d&&a.set(t,{...d,savedContent:n}),a})}catch{}}function rt(t){p(t),I({name:t.split("/").pop()??t,path:t,kind:"file",children:[]}),g(null),B.includes(t)||f(n=>[...n,t]),ke(t)}function it(t){f(n=>{const r=n.filter(s=>s!==t);return o===t&&p(r[r.length-1]??null),r}),u(n=>{const r=new Map(n);return r.delete(t),r})}function Fe(t){W(n=>{const r=new Set(n);return r.has(t)?r.delete(t):r.add(t),r})}async function st(t){if(ge(t,h.current))try{if(await De(t))return}catch(n){$.error(n instanceof Error?n.message:"Failed to load folder");return}Fe(t)}async function ot(t,n){if(n){Fe(t);return}await st(t)}async function me(t){await b.current,await tt(t);const n=he(t);W(r=>{const s=new Set(r);for(const a of n)s.add(a);return s}),rt(t)}function at(){return O?.kind==="directory"?O.path:O?.kind==="file"?ye(O.path):o?ye(o):"/"}function Le(t){const n=at();J({mode:t,parentDir:n,node:{name:"",path:n,kind:"directory",children:[]}})}const lt=Qt(A,V),Ee=Ut(lt,P),Pe=F?Ee.filter(t=>t.node.name.toLowerCase().includes(F.toLowerCase())):Ee,Z=o?C.get(o):null,ct=Z?.loaded&&Z.editorValue!==Z.savedContent,pe=H?qe(H.path):[],dt=(t,n)=>{k.current=t,t.addCommand(n.KeyMod.CtrlCmd|n.KeyCode.KeyS,async()=>{if(!o)return;const r=t.getValue();await nt(o,r)}),t.addCommand(n.KeyMod.CtrlCmd|n.KeyCode.KeyK,()=>{const r=t.getSelection(),s=t.getModel();if(!r||!s||!o)return;const a=s.getValueInRange(r);g({filePath:o,lineStart:r.startLineNumber,lineEnd:r.endLineNumber,selectedCode:a})})};function ft(t){if(!m)return;const n=[`The user selected code in the file explorer and asked: **"${t.trim()}"**`,"",`**File:** \`${m.filePath}\``,`**Lines:** ${m.lineStart}–${m.lineEnd}`];if(m.selectedCode){const r=xe(m.filePath),s=m.selectedCode.replace(/```/g,"`` `");n.push("","**Selected code:**","```"+r,s,"```")}n.push("","Please read the source file, locate the code, and apply the requested change."),E(!0),T({parts:[{type:"text",text:n.join(`
|
|
2
|
-
`)}]}),g(null)}return G&&!L?i.jsx("div",{className:"flex items-center justify-center h-full w-full",children:i.jsx(re,{size:20,className:"animate-spin text-muted-foreground"})}):i.jsxs("div",{className:"flex h-full w-full overflow-hidden",children:[i.jsxs("div",{className:"w-64 shrink-0 border-r flex flex-col overflow-hidden",children:[i.jsxs("div",{className:"flex items-center gap-1 p-2 border-b",children:[i.jsxs("div",{className:"relative min-w-0 flex-1",children:[i.jsx(ht,{size:14,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground"}),i.jsx("input",{type:"text",value:F,onChange:t=>U(t.target.value),placeholder:"Search files...","aria-label":"Search files",className:"w-full rounded-md border border-input bg-transparent pl-7 pr-2 py-1.5 text-xs outline-none placeholder:text-muted-foreground focus:ring-1 focus:ring-ring"})]}),i.jsxs(Oe,{children:[i.jsx(Re,{asChild:!0,children:i.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0","aria-label":"New file",onClick:()=>Le("new-file"),children:i.jsx(xt,{size:14})})}),i.jsx(ze,{side:"bottom",children:"New file"})]}),i.jsxs(Oe,{children:[i.jsx(Re,{asChild:!0,children:i.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0","aria-label":"New folder",onClick:()=>Le("new-folder"),children:i.jsx(gt,{size:14})})}),i.jsx(ze,{side:"bottom",children:"New folder"})]})]}),i.jsx(bt,{className:"flex-1",children:i.jsxs("div",{className:"py-1",children:[Pe.map(t=>{const{node:n,depth:r}=t,s=n.kind==="directory",a=P.has(n.path),d=O?.path===n.path,Y=Jt(n.path,n.kind),oe=s&&S.has(n.path);return i.jsx(nn,{node:n,depth:r,isExpanded:a,isSelected:d,isLoading:oe,fileVisual:on(n.name),onSelect:()=>I(n),onOpen:()=>{s?ot(n.path,a):me(n.path)},onNewFile:()=>J({mode:"new-file",node:n,parentDir:Y}),onNewFolder:()=>J({mode:"new-folder",node:n,parentDir:Y}),onCopyPath:()=>be("Path",ce(n.path)),onCopyRelativePath:()=>be("Relative path",M(n.path)),onRename:()=>J({mode:"rename",node:n,parentDir:Y}),onDelete:()=>ue(n)},n.path)}),L&&Pe.length===0&&i.jsx("div",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:F?`No files match "${F}"`:"No files found"})]})})]}),i.jsxs("div",{className:"relative flex-1 flex flex-col overflow-hidden",children:[B.length>0&&i.jsx("div",{className:"flex items-center border-b overflow-x-auto shrink-0",children:B.map(t=>{const n=C.get(t),r=n?.loaded&&n.editorValue!==n.savedContent,s=o===t,a=t.split("/").pop()??t;return i.jsxs("div",{className:Ve("flex items-center gap-1 px-3 py-1.5 text-xs border-r cursor-pointer transition-colors",s?"bg-background text-foreground":"bg-muted/50 text-muted-foreground hover:bg-accent"),onClick:()=>{p(t),ke(t)},onKeyDown:()=>{},role:"tab",tabIndex:0,"aria-selected":s,children:[i.jsx("span",{className:"truncate max-w-32",children:a}),r&&i.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-foreground/60 shrink-0"}),i.jsx("button",{type:"button",className:"ml-1 rounded p-0.5 hover:bg-accent-foreground/10",onClick:d=>{d.stopPropagation(),it(t)},children:i.jsx(jt,{size:12})})]},t)})}),m&&i.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 z-20 mt-2",style:{width:"360px"},children:i.jsxs("form",{className:"flex w-full items-center gap-1.5 rounded-xl border border-border bg-background/95 px-3 py-1.5 shadow-lg backdrop-blur",onSubmit:t=>{t.preventDefault();const r=t.currentTarget.elements.namedItem("askAiInput");r.value.trim()&&ft(r.value)},children:[i.jsx("input",{name:"askAiInput",autoFocus:!0,type:"text",placeholder:"Ask the AI...",className:"min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground",onKeyDown:t=>{t.stopPropagation(),t.key==="Escape"&&g(null)}}),i.jsx("button",{type:"submit",className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-foreground text-background transition-opacity",title:"Send",children:i.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none","aria-hidden":"true",children:[i.jsx("title",{children:"Send"}),i.jsx("path",{d:"M5 9V1M1 5l4-4 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})}),i.jsx("div",{className:"flex-1 overflow-hidden",children:o&&Z?.loaded?i.jsx(mt,{language:xe(o),theme:document.documentElement.classList.contains("dark")?"vs-dark":"light",value:Z.editorValue,path:o,onChange:t=>{const n=o;n&&u(r=>{const s=new Map(r),a=s.get(n);return a&&s.set(n,{...a,editorValue:t??""}),s})},onMount:dt,loading:i.jsx("div",{className:"flex items-center justify-center h-full w-full",children:i.jsx(re,{size:20,className:"animate-spin text-muted-foreground"})}),options:{fontSize:13,scrollBeyondLastLine:!1,automaticLayout:!0,lineNumbersMinChars:2,wordWrap:"on",minimap:{enabled:!1},padding:{top:12,bottom:12},scrollbar:{vertical:"auto",horizontal:"auto",verticalScrollbarSize:8,horizontalScrollbarSize:8}}},o):o&&!Z?.loaded?i.jsx("div",{className:"flex items-center justify-center h-full w-full",children:i.jsx(re,{size:20,className:"animate-spin text-muted-foreground"})}):i.jsx("div",{className:"flex items-center justify-center h-full w-full text-sm text-muted-foreground",children:"Select a file to edit"})}),o&&i.jsxs("div",{className:"flex items-center justify-between px-3 py-1 border-t text-[11px] text-muted-foreground shrink-0",children:[i.jsx("span",{className:"truncate",children:o}),i.jsxs("span",{children:[ct?"Modified":"Saved"," ·"," ",xe(o)]})]})]}),i.jsx(en,{open:w!==null,mode:w?.mode??"new-file",initialName:w?.mode==="rename"?w.node.name:"",parentLabel:w&&w.mode!=="rename"?w.parentDir==="/"?"/":M(w.parentDir):void 0,isPending:ee,onSubmit:Ye,onOpenChange:t=>{!t&&!ee&&J(null)}}),i.jsx(vt,{open:H!==null,onOpenChange:t=>{!t&&!ee&&ue(null)},children:i.jsxs(Ct,{children:[i.jsxs(Nt,{children:[i.jsxs(St,{children:["Delete ",H?.kind==="directory"?"folder":"file","?"]}),i.jsxs(Dt,{children:["This will permanently delete"," ",i.jsx("span",{className:"font-mono",children:H?.name}),H?.kind==="directory"?" and everything inside it.":".",pe.length>0&&i.jsxs(i.Fragment,{children:[" ",pe.length===1?"One open file has unsaved changes that will be lost.":`${pe.length} open files have unsaved changes that will be lost.`]})]})]}),i.jsxs(kt,{children:[i.jsx(Ft,{disabled:ee,children:"Cancel"}),i.jsx(Lt,{disabled:ee||!H,onClick:t=>{t.preventDefault(),H&&Xe(H)},children:"Delete"})]})]})})]})}export{Mi as FileExplorer};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as M,w as $,m as U,G as Q,F as Y,d as q,s as P,t as w,K as L,j as n,ae as I,z as Z,C as k,c as F,r as T,B as H,L as B,o as J}from"./index-20lo5teZ.js";import{P as N}from"./index-BoBbtnrJ.js";import{u as W}from"./use-org-auth-client-CSAS1fgX.js";import{u as X}from"./use-debounced-autosave-B3nrE_1Y.js";import{A as ee}from"./avatar-BLEdyY7-.js";import{I as V}from"./input-D2VJ6ahm.js";import{S as G,a as K,b as A,c as te}from"./settings-section-CP7jibDA.js";import{D as ne}from"./domain-settings-m1b0eyH2.js";import{u as ae}from"./studio-tools-DqPhjgPW.js";import{c as se,b as oe,d as ie,A as re,e as le,g as ce,a as ue,f as de}from"./alert-dialog-CKnoCFTw.js";import{R as me}from"./require-capability-BMiu3VbE.js";import"./sidebar-Cx68CPJi.js";import"./LayoutLeft-DjTexk5_.js";import"./tooltip-B_mKOQvv.js";import"./sheet-BBGbheOC.js";import"./X-Ciyf96Wa.js";import"./User01-DxWsEbM9.js";import"./card-mAs4nLtf.js";import"./ArrowUpRight-BfxsIWO1.js";import"./badge-C9MXVg0W.js";import"./select-C0AEr1SL.js";import"./index-BdQq_4o_.js";import"./ChevronUp-BDbnz61t.js";import"./ChevronDown-aoqAeXtt.js";import"./use-capability-C1-FHW22.js";import"./access-gate-DelGJZFm.js";import"./capability-load-error-sRyEFexC.js";const ge=Z({name:k().min(1,"Name is required").max(255,"Name is too long"),slug:k().min(1,"Slug is required").max(50,"Slug is too long").regex(/^[a-z0-9-]+$/,"Slug must contain only lowercase letters, numbers, and hyphens"),logo:k().optional()});function fe(e){const t=F.c(13),{value:v,onChange:h,name:o,disabled:d}=e,m=T.useRef(null);let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=()=>m.current?.click(),t[0]=l):l=t[0];const r=l;let c;t[1]!==h?(c=x=>{const j=x.target.files?.[0];if(!j)return;if(j.size>2097152){w.error("Image must be smaller than 2MB");return}const u=new FileReader;u.onerror=pe,u.onloadend=()=>{u.result&&h(u.result),m.current&&(m.current.value="")},u.readAsDataURL(j)},t[1]=h,t[2]=c):c=t[2];const a=c;let s;t[3]!==d||t[4]!==a?(s=n.jsx("input",{ref:m,type:"file",accept:"image/*",onChange:a,className:"hidden",disabled:d}),t[3]=d,t[4]=a,t[5]=s):s=t[5];const i=v||void 0,p=o??"?";let g;t[6]!==i||t[7]!==p?(g=n.jsx(ee,{url:i,fallback:p,shape:"square",size:"base"}),t[6]=i,t[7]=p,t[8]=g):g=t[8];let f;return t[9]!==d||t[10]!==s||t[11]!==g?(f=n.jsxs("button",{type:"button",onClick:r,disabled:d,className:"rounded-lg overflow-hidden hover:ring-2 hover:ring-border transition-all disabled:opacity-50","aria-label":"Upload organization logo",children:[s,g]}),t[9]=d,t[10]=s,t[11]=g,t[12]=f):f=t[12],f}function pe(){return w.error("Failed to read image")}function he(){const e=M(),{org:t}=$(),v=W(),h=U(),o=Q({resolver:Y(ge),values:{name:t.name??"",slug:t.slug??"",logo:t.logo??""}}),d=q({mutationFn:async a=>{const s={name:a.name,slug:a.slug};a.logo&&(s.logo=a.logo);const i=await v.organization.update({data:s});if(i?.error)throw new Error(i.error.message||"Failed to update organization");return i},onSuccess:(a,s)=>{P("organization_settings_updated",{organization_id:t.id,fields:Object.keys(s)}),h.invalidateQueries({queryKey:L.organizations()}),h.invalidateQueries({queryKey:L.activeOrganization(t.slug)}),w.success("Organization updated successfully"),a?.data?.slug&&a.data.slug!==t.slug&&e({to:"/$org/settings/general",params:{org:a.data.slug}})},onError:(a,s)=>{P("organization_settings_update_failed",{organization_id:t.id,fields:Object.keys(s),error:a instanceof Error?a.message:String(a)}),w.error(a instanceof Error?a.message:"Failed to update organization")}}),{schedule:m,flush:l}=X({save:async()=>{const a=o.control._formState.dirtyFields;if(Object.keys(a).length===0||!await o.trigger())return;const i=o.getValues(),p=o.control._defaultValues;o.reset(i,{keepValues:!0});try{await d.mutateAsync(i)}catch{o.reset(p,{keepValues:!0})}}}),r=o.formState.errors,c=typeof window<"u"?`${window.location.host}/`:"";return n.jsx(G,{children:n.jsxs(K,{children:[n.jsx(A,{title:"Logo",description:"Recommended size is 256x256px",action:n.jsx(fe,{value:o.watch("logo"),onChange:a=>{o.setValue("logo",a??"",{shouldDirty:!0}),l()},name:o.watch("name")})}),n.jsx(A,{title:"Name",action:n.jsx(I,{control:o.control,name:"name",render:({field:a})=>n.jsx(V,{id:"org-name",...a,onChange:s=>{a.onChange(s),m()},onBlur:()=>{a.onBlur(),l()},placeholder:"Organization name",className:"w-[280px]"})})}),n.jsx(A,{title:"URL",action:n.jsxs("div",{className:"flex items-center w-[280px] rounded-md border border-input bg-input/30 focus-within:ring-2 focus-within:ring-ring/50 overflow-hidden",children:[c&&n.jsx("span",{className:"pl-3 text-sm text-muted-foreground select-none",children:c}),n.jsx(I,{control:o.control,name:"slug",render:({field:a})=>n.jsx("input",{id:"org-slug",value:a.value??"",name:a.name,ref:a.ref,placeholder:"my-organization",className:"flex-1 min-w-0 bg-transparent px-2 py-1.5 text-sm text-foreground placeholder:text-muted-foreground/60 outline-none",onChange:s=>{const i=s.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"");o.setValue("slug",i,{shouldDirty:!0,shouldTouch:!0,shouldValidate:!0}),m()},onBlur:()=>{a.onBlur(),l()}})})]})}),(r.name||r.slug||r.logo)&&n.jsxs("div",{className:"px-5 pb-3 flex flex-col gap-1",children:[r.name&&n.jsx("p",{className:"text-xs text-destructive",children:r.name.message}),r.slug&&n.jsx("p",{className:"text-xs text-destructive",children:r.slug.message}),r.logo&&n.jsx("p",{className:"text-xs text-destructive",children:r.logo.message})]})]})})}function xe(){const e=F.c(42),{org:t}=$(),[v,h]=T.useState(!1),[o,d]=T.useState(""),m=ae();let l;e[0]!==t.id||e[1]!==m?(l=async()=>{await m.call("ORGANIZATION_DELETE",{id:t.id})},e[0]=t.id,e[1]=m,e[2]=l):l=e[2];let r;e[3]!==t.id||e[4]!==t.slug?(r=()=>{P("organization_deleted",{organization_id:t.id}),localStorage.getItem(B.lastOrgSlug())===t.slug&&localStorage.removeItem(B.lastOrgSlug()),J(),w.success("Organization deleted"),window.location.href="/"},e[3]=t.id,e[4]=t.slug,e[5]=r):r=e[5];let c;e[6]!==l||e[7]!==r?(c={mutationFn:l,onSuccess:r,onError:je},e[6]=l,e[7]=r,e[8]=c):c=e[8];const a=q(c);let s;e[9]===Symbol.for("react.memo_cache_sentinel")?(s=()=>h(!0),e[9]=s):s=e[9];let i;e[10]!==a.isPending?(i=n.jsx(G,{title:"Danger Zone",description:"Irreversible actions that affect your entire organization.",children:n.jsx(K,{className:"border-destructive/40",children:n.jsx(A,{title:"Delete organization",description:"Permanently delete this organization and all of its data. This action cannot be undone.",action:n.jsx(H,{variant:"destructive",size:"sm",onClick:s,disabled:a.isPending,children:"Delete"})})})}),e[10]=a.isPending,e[11]=i):i=e[11];let p;e[12]===Symbol.for("react.memo_cache_sentinel")?(p=O=>{h(O),O||d("")},e[12]=p):p=e[12];let g;e[13]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(se,{children:"Delete Organization?"}),e[13]=g):g=e[13];let f;e[14]!==t.name?(f=n.jsxs("p",{children:["This will permanently delete all data associated with"," ",n.jsx("span",{className:"font-medium text-foreground",children:t.name}),". This action cannot be undone."]}),e[14]=t.name,e[15]=f):f=e[15];let x;e[16]!==t.name?(x=n.jsxs("p",{className:"mt-3 mb-1.5",children:["Type"," ",n.jsx("span",{className:"font-medium text-foreground",children:t.name})," ","to confirm:"]}),e[16]=t.name,e[17]=x):x=e[17];let j;e[18]===Symbol.for("react.memo_cache_sentinel")?(j=O=>d(O.target.value),e[18]=j):j=e[18];let u;e[19]!==o||e[20]!==t.name?(u=n.jsx(V,{value:o,onChange:j,placeholder:t.name,autoFocus:!0}),e[19]=o,e[20]=t.name,e[21]=u):u=e[21];let b;e[22]!==u||e[23]!==f||e[24]!==x?(b=n.jsxs(oe,{children:[g,n.jsx(ie,{asChild:!0,children:n.jsxs("div",{children:[f,x,u]})})]}),e[22]=u,e[23]=f,e[24]=x,e[25]=b):b=e[25];let D;e[26]===Symbol.for("react.memo_cache_sentinel")?(D=n.jsx(re,{children:"Cancel"}),e[26]=D):D=e[26];let y;e[27]!==a?(y=()=>a.mutate(),e[27]=a,e[28]=y):y=e[28];const E=o!==t.name||a.isPending,R=a.isPending?"Deleting…":"Delete organization";let S;e[29]!==y||e[30]!==E||e[31]!==R?(S=n.jsxs(le,{children:[D,n.jsx(ce,{onClick:y,disabled:E,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90 disabled:opacity-50",children:R})]}),e[29]=y,e[30]=E,e[31]=R,e[32]=S):S=e[32];let z;e[33]!==b||e[34]!==S?(z=n.jsxs(ue,{children:[b,S]}),e[33]=b,e[34]=S,e[35]=z):z=e[35];let C;e[36]!==v||e[37]!==z?(C=n.jsx(de,{open:v,onOpenChange:p,children:z}),e[36]=v,e[37]=z,e[38]=C):C=e[38];let _;return e[39]!==C||e[40]!==i?(_=n.jsxs(n.Fragment,{children:[i,C]}),e[39]=C,e[40]=i,e[41]=_):_=e[41],_}function je(e){w.error(e instanceof Error?e.message:"Failed to delete organization")}function ve(){const e=F.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx(N,{children:n.jsx(N.Content,{children:n.jsx(N.Body,{children:n.jsxs(te,{children:[n.jsx(N.Title,{children:"Organization"}),n.jsx(he,{}),n.jsx(ne,{}),n.jsx(xe,{})]})})})}),e[0]=t):t=e[0],t}function Qe(){const e=F.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx(me,{capability:"org:manage",area:"general settings",children:n.jsx(ve,{})}),e[0]=t):t=e[0],t}export{Qe as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{am as st,c as k,j as n,r as $,w as J,m as xe,l as Q,i as le,an as Z,t as U,K as te,k as se,B as Y,d as nt,a7 as it,E as ot,a as rt}from"./index-20lo5teZ.js";import{u as ge}from"./tooltip-B_mKOQvv.js";import{u as lt}from"./useQueries-BdyCFKnV.js";import{i as at,u as ae,m as ct,a as dt,S as mt}from"./use-mcp-client-CxXf5rsq.js";import{u as ut,b as ft,v as pt,a as ht}from"./use-virtual-mcp-CwSMwdwq.js";import{i as xt}from"./ChevronUp-BDbnz61t.js";import{e as gt,A as ce,Y as yt,a8 as bt,D as jt,k as vt}from"./agent-icon-Bk1Ofbdo.js";import{s as ye}from"./Plus-BEdvqzrP.js";import{i as $e}from"./X-Ciyf96Wa.js";import{C as oe}from"./index-DsiMEgqD.js";import{b as Nt}from"./chat-context-BdyPsWKn.js";import{N as wt}from"./decopilot-CW6d29Nv.js";import{g as St,b as Ae,c as re,K as Pe,P as Ee,D as Me,d as _t,S as Ct,v as It,e as Tt,C as kt,s as $t,l as At,k as Pt,o as Et,u as Mt,j as zt,h as Ot}from"./sortable.esm-DMoaSsem.js";import{u as ze,a as Oe,o as Lt}from"./use-organization-settings-CTH2EptF.js";import{c as be,b as Dt,h as Ht}from"./shell-layout-xhRX4rsB.js";import{I as Le}from"./input-D2VJ6ahm.js";import{S as Rt,t as je,P as Ft,j as Ut,s as Bt,g as Vt}from"./scroll-area-BlJNYaPT.js";import{S as Kt,a as qt,b as Wt,c as Gt,d as Qt}from"./sheet-BBGbheOC.js";import{S as H}from"./skeleton-CVRpN7O3.js";import{t as De}from"./ChevronDown-aoqAeXtt.js";import{d as He}from"./ZoomOut-C-l0YUGT.js";import{g as Re,M as Jt}from"./types-Cms0eXYe.js";import{I as Fe}from"./integration-icon-62cL4F-8.js";import{b as Xt,c as Zt,S as Yt,a as we,d as es}from"./select-C0AEr1SL.js";import{T as ts}from"./textarea-BqMqcZIm.js";import{u as Ue}from"./studio-tools-DqPhjgPW.js";import{a as ss}from"./use-mcp-tools-CLWDDSx5.js";import{i as ns}from"./XCircle-ovYWqZM6.js";import{f as is}from"./tab-id-BptcWVWa.js";import{g as os}from"./use-mcp-prompts-CqbI2uxQ.js";import{u as rs,w as ls}from"./hooks-BdXI0ZZ7.js";import{a as as,g as cs,c as ds,b as ms,D as us}from"./dropdown-menu-DBXGBAAP.js";import{s as fs}from"./Trash01-BfKdeD7S.js";import{a as ps,u as hs}from"./use-ai-providers-BFPg4Nao.js";import{u as xs}from"./connect-desktop-dialog-CkD3zyKJ.js";import{a as gs}from"./toolbar-DDUCJSbz.js";import"./auth-Ci2ZRRcb.js";import"./use-collections-74mCujh3.js";import"./AlertCircle-ChcBH14n.js";import"./Tool01-DcPFccxt.js";import"./SwitchHorizontal01-EOva-Jpw.js";import"./Settings02-BIpY6Zhb.js";import"./ArrowUpRight-BfxsIWO1.js";import"./ZapSquare-BlfnVn5C.js";import"./Users03-NRaUurHt.js";import"./CheckCircle-Cm1GnmVj.js";import"./ChevronLeft-CoW1IpXE.js";import"./ChevronRight-CUGhm8E7.js";import"./DotsVertical-BcvtEj5g.js";import"./Stars02-C-addu2P.js";import"./Eye-BhqO9K0O.js";import"./Globe01-CTIuSSD9.js";import"./FilterLines-DTI31VpW.js";import"./Star01-HcsxMzHs.js";import"./Globe04-Dy3PA2Yl.js";import"./HardDrive-DYVC-Zaq.js";import"./Key01-bDEyn58I.js";import"./LayoutLeft-DjTexk5_.js";import"./LinkExternal01-COQYOgEI.js";import"./Monitor01-DV9tmVAF.js";import"./Sun-B11PPq5-.js";import"./Palette-CD1fLCtB.js";import"./Play-Dl0pf4M6.js";import"./SearchMd-DK3hZUVF.js";import"./Shield01-Dx8gqKG5.js";import"./Stars01-VD9js_iZ.js";import"./Upload01-T8pN8jBP.js";import"./User01-DxWsEbM9.js";import"./Users01-C7ItyIdk.js";import"./XClose-m9X1QqKX.js";import"./Zap-Bci_Afjv.js";import"./dialog-DtA5oh9D.js";import"./drawer-zXrFQNCR.js";import"./collection-search-C1sxKyva.js";import"./form-BPgAGzjC.js";import"./label-Xkc4XdLq.js";import"./tabs-BqGLbeO9.js";import"./toggle-group-Db5bABta.js";import"./popover-CHlLC07g.js";import"./command-vbsMaAT6.js";import"./index-wuE_wZDF.js";import"./useInfiniteQuery-CWme5rGZ.js";import"./use-infinite-scroll-hOEUoZD8.js";import"./question-004-sINsf4GQ.js";import"./checkbox-B9vj-Cdf.js";import"./ai-providers-logos-DD3qZ33J.js";import"./avatar-BLEdyY7-.js";import"./settings-section-CP7jibDA.js";import"./card-mAs4nLtf.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-gZqWtnUr.js";import"./use-registry-connections-jcbA10JV.js";import"./use-connection-D-7QpVUJ.js";import"./extract-connection-data-DlaPzbl9.js";import"./collection-tabs-Csv5ENUX.js";import"./badge-C9MXVg0W.js";import"./connection-form-helpers-4cMYvdoC.js";import"./authenticate-and-persist-oauth-CjSCavkQ.js";import"./mcp-oauth-CsZ919dh.js";import"./useSuspenseInfiniteQuery-DVa_SnfJ.js";import"./required-auth-layout-hnMHneNT.js";import"./use-org-sso-D9H6UI9E.js";import"./use-clock-tick-DvWNr9a0.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-D6L-AQL_.js";import"./file-type-icon-3wYgaJ1f.js";import"./content-blocks-o63cs2vh.js";import"./use-navigate-to-agent-D8CoEyF3.js";import"./index-BdQq_4o_.js";import"./decopilot-sse-pool-DhvSomLP.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";function ys(t,e){return lt({...t,queries:t.queries.map(s=>({...s,suspense:!0,throwOnError:st,enabled:!0,placeholderData:void 0}))},e)}function Be(t){const e=k.c(11),{properties:s,required:o,values:i,onChange:r}=t;let a;e[0]!==o?(a=o??[],e[0]=o,e[1]=a):a=e[1];let d;e[2]!==a?(d=new Set(a),e[2]=a,e[3]=d):d=e[3];const l=d;let m;e[4]!==s?(m=Object.entries(s),e[4]=s,e[5]=m):m=e[5];let c;return e[6]!==r||e[7]!==l||e[8]!==m||e[9]!==i?(c=n.jsx("div",{className:"flex flex-col gap-2",children:m.map(u=>{const[f,p]=u;return n.jsxs("div",{className:"flex flex-col gap-0.5",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("label",{className:"text-xs font-medium leading-none flex items-center gap-1",children:[f,l.has(f)&&n.jsx("span",{className:"text-red-500 text-[10px]",children:"*"})]}),n.jsx("span",{className:"text-[10px] text-muted-foreground font-mono",children:p.type})]}),p.description&&n.jsx("p",{className:"text-[10px] text-muted-foreground leading-snug",children:p.description}),n.jsx(bs,{type:p.type,fieldKey:f,value:i[f],onChange:h=>r(f,h)})]},f)})}),e[6]=r,e[7]=l,e[8]=m,e[9]=i,e[10]=c):c=e[10],c}function bs(t){const e=k.c(19),{type:s,fieldKey:o,value:i,onChange:r}=t;if(s==="object"||s==="array"){const c=i??"";let u;e[0]!==r?(u=h=>r(h.target.value),e[0]=r,e[1]=u):u=e[1];const f=`Enter ${o} as JSON…`;let p;return e[2]!==c||e[3]!==u||e[4]!==f?(p=n.jsx(ts,{className:"font-mono text-xs h-16",value:c,onChange:u,placeholder:f,rows:2}),e[2]=c,e[3]=u,e[4]=f,e[5]=p):p=e[5],p}if(s==="boolean"){const c=i!=null?String(i):"";let u;e[6]!==r?(u=x=>r(x==="true"),e[6]=r,e[7]=u):u=e[7];let f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(Xt,{className:"h-7 text-xs",children:n.jsx(Zt,{placeholder:"Select…"})}),e[8]=f):f=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsxs(Yt,{children:[n.jsx(we,{value:"true",children:"true"}),n.jsx(we,{value:"false",children:"false"})]}),e[9]=p):p=e[9];let h;return e[10]!==c||e[11]!==u?(h=n.jsxs(es,{value:c,onValueChange:u,children:[f,p]}),e[10]=c,e[11]=u,e[12]=h):h=e[12],h}const a=i??"";let d;e[13]!==r?(d=c=>r(c.target.value),e[13]=r,e[14]=d):d=e[14];const l=`Enter ${o}…`;let m;return e[15]!==a||e[16]!==d||e[17]!==l?(m=n.jsx(Le,{className:"h-7 text-xs",value:a,onChange:d,placeholder:l}),e[15]=a,e[16]=d,e[17]=l,e[18]=m):m=e[18],m}const ne=8;function js(t){const e=k.c(16),{open:s,onOpenChange:o}=t,[i,r]=$.useState("");let a,d;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(Kt,{children:"Manage home"}),d=n.jsx(qt,{children:"Add agents to the home board and pin their interactive UIs or prompts."}),e[0]=a,e[1]=d):(a=e[0],d=e[1]);let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(gt,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none","aria-hidden":!0}),e[2]=l):l=e[2];let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m=x=>r(x.target.value),e[3]=m):m=e[3];let c;e[4]!==i?(c=n.jsxs(Wt,{className:"px-5 py-4 border-b border-border",children:[a,d,n.jsxs("div",{className:"relative mt-3",children:[l,n.jsx(Le,{value:i,onChange:m,placeholder:"Search agents…",className:"pl-8 h-8 text-sm"})]})]}),e[4]=i,e[5]=c):c=e[5];let u;e[6]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(Js,{}),e[6]=u):u=e[6];let f;e[7]!==i?(f=n.jsx(Rt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx("div",{className:"p-3 flex flex-col gap-4",children:n.jsx($.Suspense,{fallback:u,children:n.jsx(Ns,{search:i})})})}),e[7]=i,e[8]=f):f=e[8];let p;e[9]!==c||e[10]!==f?(p=n.jsxs(Gt,{side:"right",className:"w-full sm:max-w-md p-0 flex flex-col",children:[c,f]}),e[9]=c,e[10]=f,e[11]=p):p=e[11];let h;return e[12]!==o||e[13]!==s||e[14]!==p?(h=n.jsx(Qt,{open:s,onOpenChange:o,children:p}),e[12]=o,e[13]=s,e[14]=p,e[15]=h):h=e[15],h}function vs(t){const e=k.c(32),{org:s}=J(),o=ze();let i;e[0]!==o?.ids?(i=o?.ids??[],e[0]=o?.ids,e[1]=i):i=e[1];const r=i,a=Oe(),d=ft(),l=xe();let m;e[2]!==s||e[3]!==l?(m=()=>l.refetchQueries({queryKey:te.homeNextActions(s.slug),type:"active"}),e[2]=s,e[3]=l,e[4]=m):m=e[4];const c=m;let u;e[5]!==r?(u=_=>r.includes(_),e[5]=r,e[6]=u):u=e[6];const f=u;let p;e[7]!==r||e[8]!==t?(p=t?r.filter(_=>t.has(_)).length:r.length,e[7]=r,e[8]=t,e[9]=p):p=e[9];const x=p>=ne;let y;e[10]!==x||e[11]!==f||e[12]!==a?(y=_=>f(_)||x?Promise.resolve():a.apply(I=>I.includes(_)?null:[...I,_]),e[10]=x,e[11]=f,e[12]=a,e[13]=y):y=e[13];const b=y;let v;e[14]!==a?(v=_=>a.apply(I=>I.filter(T=>T!==_)),e[14]=a,e[15]=v):v=e[15];const N=v;let j;e[16]!==a?(j=_=>a.apply(()=>_),e[16]=a,e[17]=j):j=e[17];const g=j;let w;e[18]!==d||e[19]!==x||e[20]!==f||e[21]!==c||e[22]!==a?(w=async(_,I)=>{await d.update.mutateAsync({id:_.id,data:{metadata:I}}),!f(_.id)&&!x&&await a.apply(T=>T.includes(_.id)?null:[...T,_.id]),await c()},e[18]=d,e[19]=x,e[20]=f,e[21]=c,e[22]=a,e[23]=w):w=e[23];const S=w;let C;return e[24]!==b||e[25]!==x||e[26]!==r||e[27]!==f||e[28]!==N||e[29]!==g||e[30]!==S?(C={homeIds:r,isOnHome:f,atLimit:x,addAgent:b,removeAgent:N,reorder:g,saveAgentMetadata:S},e[24]=b,e[25]=x,e[26]=r,e[27]=f,e[28]=N,e[29]=g,e[30]=S,e[31]=C):C=e[31],C}function Ns(t){const e=k.c(21),{search:s}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={pageSize:1e3},e[0]=o):o=e[0];const i=ut(o);let r;e[1]!==i?(r=new Set(i.map(Is)),e[1]=i,e[2]=r):r=e[2];const a=vs(r);let d,l,m;if(e[3]!==i||e[4]!==a||e[5]!==s){const x=new Map(i.map(Cs));d=s.trim().toLowerCase();const y=N=>!d||N.title?.toLowerCase().includes(d);l=a.homeIds.map(N=>x.get(N)).filter(_s).filter(y);const b=St(i);let v;e[9]!==a?(v=N=>!a.isOnHome(N.id),e[9]=a,e[10]=v):v=e[10],m=i.filter(Ss).filter(N=>!b.has(N.id)).filter(v).filter(y).sort(ws),e[3]=i,e[4]=a,e[5]=s,e[6]=d,e[7]=l,e[8]=m}else d=e[6],l=e[7],m=e[8];const c=m;let u;e[11]!==a||e[12]!==l?(u=n.jsx(Ts,{home:a,agents:l}),e[11]=a,e[12]=l,e[13]=u):u=e[13];const f=!!d;let p;e[14]!==c||e[15]!==a||e[16]!==f?(p=n.jsx(As,{home:a,agents:c,hasSearch:f}),e[14]=c,e[15]=a,e[16]=f,e[17]=p):p=e[17];let h;return e[18]!==u||e[19]!==p?(h=n.jsxs(n.Fragment,{children:[u,p]}),e[18]=u,e[19]=p,e[20]=h):h=e[20],h}function ws(t,e){return(t.title??"").localeCompare(e.title??"")}function Ss(t){return t.id&&!at(t.id)}function _s(t){return!!t}function Cs(t){return[t.id,t]}function Is(t){return t.id}function Ve(t){const e=k.c(7),{title:s,hint:o}=t;let i;e[0]!==s?(i=n.jsx("span",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:s}),e[0]=s,e[1]=i):i=e[1];let r;e[2]!==o?(r=o&&n.jsx("span",{className:"text-xs text-muted-foreground",children:o}),e[2]=o,e[3]=r):r=e[3];let a;return e[4]!==i||e[5]!==r?(a=n.jsxs("div",{className:"flex items-center justify-between px-1",children:[i,r]}),e[4]=i,e[5]=r,e[6]=a):a=e[6],a}function Ts(t){const e=k.c(14),{home:s,agents:o}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={activationConstraint:{distance:5}},e[0]=i):i=e[0];let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r={coordinateGetter:$t},e[1]=r):r=e[1];const a=Ae(re(Ee,i),re(Pe,r));let d;e[2]!==s?(d=p=>{const{active:h,over:x}=p;if(!x||h.id===x.id)return;const y=s.homeIds,b=y.indexOf(h.id),v=y.indexOf(x.id);b===-1||v===-1||s.reorder(At([...y],b,v)).catch($s)},e[2]=s,e[3]=d):d=e[3];const l=d,m=`${s.homeIds.length}/${ne}`;let c;e[4]!==m?(c=n.jsx(Ve,{title:"On home",hint:m}),e[4]=m,e[5]=c):c=e[5];let u;e[6]!==o||e[7]!==l||e[8]!==s||e[9]!==a?(u=o.length===0?n.jsx("p",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:"No agents on the home yet."}):n.jsx(Me,{sensors:a,collisionDetection:_t,onDragEnd:l,children:n.jsx(Ct,{items:o.map(ks),strategy:It,children:n.jsx("div",{className:"flex flex-col gap-1",children:o.map(p=>n.jsx(Es,{agent:p,home:s},p.id))})})}),e[6]=o,e[7]=l,e[8]=s,e[9]=a,e[10]=u):u=e[10];let f;return e[11]!==c||e[12]!==u?(f=n.jsxs("div",{className:"flex flex-col gap-1.5",children:[c,u]}),e[11]=c,e[12]=u,e[13]=f):f=e[13],f}function ks(t){return t.id}function $s(){return U.error("Couldn't reorder home — please try again.")}function As(t){const e=k.c(6),{home:s,agents:o,hasSearch:i}=t,[r,a]=$.useState(20);let d;if(e[0]!==o||e[1]!==i||e[2]!==s||e[3]!==r){const l=o.slice(0,r);let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(Ve,{title:"Add to home"}),e[5]=m):m=e[5],d=n.jsxs("div",{className:"flex flex-col gap-1.5",children:[m,o.length===0?n.jsx("p",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:i?"No agents match.":"Every agent is on the home."}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"flex flex-col gap-1",children:l.map(c=>n.jsx(Os,{agent:c,home:s},c.id))}),o.length>r&&n.jsxs("button",{type:"button",onClick:()=>a(Ps),className:"mt-1 self-center rounded-md px-3 py-1.5 text-xs text-muted-foreground hover:bg-accent/40 hover:text-foreground",children:["Load more (",o.length-r,")"]})]})]}),e[0]=o,e[1]=i,e[2]=s,e[3]=r,e[4]=d}else d=e[4];return d}function Ps(t){return t+20}function Ke(t){const e=Z(t.metadata?.ui).filter(r=>!!r.resourceUri).length,s=t.metadata?.ui?.homePrompts,o=Array.isArray(s)?s.length:null,i=[];return e>0&&i.push(`${e} tile${e===1?"":"s"}`),o!==null&&o>0&&i.push(`${o} prompt${o===1?"":"s"}`),o===0&&i.push("prompts off"),i.join(" · ")}function Es(t){const e=k.c(57),{agent:s,home:o}=t,[i,r]=$.useState(!1);let a;e[0]!==s.id?(a={id:s.id},e[0]=s.id,e[1]=a):a=e[1];const{attributes:d,listeners:l,setNodeRef:m,transform:c,transition:u,isDragging:f}=Tt(a),p=Ke(s)||"Quick access";let h;e[2]!==c?(h=kt.Transform.toString(c),e[2]=c,e[3]=h):h=e[3];const x=f?.5:void 0,y=f?100:void 0;let b;e[4]!==h||e[5]!==x||e[6]!==y||e[7]!==u?(b={transform:h,transition:u,opacity:x,zIndex:y},e[4]=h,e[5]=x,e[6]=y,e[7]=u,e[8]=b):b=e[8];const v=b,N=f&&"shadow-lg";let j;e[9]!==N?(j=Q("rounded-lg border border-border bg-card",N),e[9]=N,e[10]=j):j=e[10];const g=`Drag to reorder ${s.title??s.id}`;let w;e[11]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsx(He,{size:14}),e[11]=w):w=e[11];let S;e[12]!==d||e[13]!==l||e[14]!==g?(S=n.jsx("button",{type:"button",...d,...l,className:"shrink-0 text-muted-foreground hover:text-foreground cursor-grab active:cursor-grabbing outline-none focus-visible:ring-2 focus-visible:ring-ring rounded","aria-label":g,children:w}),e[12]=d,e[13]=l,e[14]=g,e[15]=S):S=e[15];let C;e[16]===Symbol.for("react.memo_cache_sentinel")?(C=()=>r(zs),e[16]=C):C=e[16];const _=s.title??s.id;let I;e[17]!==s.icon||e[18]!==_?(I=n.jsx(ce,{icon:s.icon,name:_,size:"sm"}),e[17]=s.icon,e[18]=_,e[19]=I):I=e[19];const T=s.title??s.id;let P;e[20]!==T?(P=n.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:T}),e[20]=T,e[21]=P):P=e[21];let M;e[22]!==p?(M=n.jsx("div",{className:"truncate text-xs text-muted-foreground",children:p}),e[22]=p,e[23]=M):M=e[23];let z;e[24]!==P||e[25]!==M?(z=n.jsxs("div",{className:"min-w-0 flex-1",children:[P,M]}),e[24]=P,e[25]=M,e[26]=z):z=e[26];const B=i&&"rotate-180";let O;e[27]!==B?(O=Q("shrink-0 text-muted-foreground transition-transform",B),e[27]=B,e[28]=O):O=e[28];let L;e[29]!==O?(L=n.jsx(De,{size:16,className:O}),e[29]=O,e[30]=L):L=e[30];let K;e[31]!==i||e[32]!==I||e[33]!==z||e[34]!==L?(K=n.jsxs("button",{type:"button",onClick:C,className:"flex min-w-0 flex-1 items-center gap-2.5 text-left outline-none","aria-expanded":i,children:[I,z,L]}),e[31]=i,e[32]=I,e[33]=z,e[34]=L,e[35]=K):K=e[35];let A;e[36]!==s.id||e[37]!==o?(A=()=>o.removeAgent(s.id).catch(Ms),e[36]=s.id,e[37]=o,e[38]=A):A=e[38];const V=`Remove ${s.title??s.id} from home`;let D;e[39]===Symbol.for("react.memo_cache_sentinel")?(D=n.jsx($e,{size:14}),e[39]=D):D=e[39];let E;e[40]!==A||e[41]!==V?(E=n.jsx("button",{type:"button",onClick:A,"aria-label":V,title:"Remove from home",className:"shrink-0 inline-flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-destructive/10 hover:text-destructive",children:D}),e[40]=A,e[41]=V,e[42]=E):E=e[42];let R;e[43]!==S||e[44]!==K||e[45]!==E?(R=n.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-2.5",children:[S,K,E]}),e[43]=S,e[44]=K,e[45]=E,e[46]=R):R=e[46];let F;e[47]!==s||e[48]!==i||e[49]!==o?(F=i&&n.jsx(qe,{agent:s,home:o}),e[47]=s,e[48]=i,e[49]=o,e[50]=F):F=e[50];let W;return e[51]!==m||e[52]!==v||e[53]!==R||e[54]!==F||e[55]!==j?(W=n.jsxs("div",{ref:m,style:v,className:j,children:[R,F]}),e[51]=m,e[52]=v,e[53]=R,e[54]=F,e[55]=j,e[56]=W):W=e[56],W}function Ms(){return U.error("Couldn't remove from home — please try again.")}function zs(t){return!t}function Os({agent:t,home:e}){const[s,o]=$.useState(!1),[i,r]=$.useState(!1),a=Ke(t),d=async()=>{if(!e.atLimit){r(!0);try{await e.addAgent(t.id)}catch{U.error("Couldn't add to home — please try again.")}finally{r(!1)}}};return n.jsxs("div",{className:"rounded-lg border border-border bg-card",children:[n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[n.jsxs("button",{type:"button",onClick:()=>o(l=>!l),className:"flex min-w-0 flex-1 items-center gap-3 text-left outline-none","aria-expanded":s,children:[n.jsx(ce,{icon:t.icon,name:t.title??t.id,size:"sm"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:t.title??t.id}),a&&n.jsx("div",{className:"truncate text-xs text-muted-foreground",children:a})]}),n.jsx(De,{size:16,className:Q("shrink-0 text-muted-foreground transition-transform",s&&"rotate-180")})]}),n.jsx("button",{type:"button",onClick:d,disabled:i||e.atLimit,"aria-label":"Add to home",title:e.atLimit?`Home is full (${ne}) — remove an agent first`:"Add to home",className:"shrink-0 inline-flex size-7 items-center justify-center rounded-md bg-foreground text-background text-xs hover:opacity-90 disabled:opacity-40 disabled:cursor-not-allowed",children:i?n.jsx(le,{size:12,className:"animate-spin"}):n.jsx(ye,{size:14})})]}),s&&n.jsx(qe,{agent:t,home:e})]})}function qe(t){const e=k.c(17),{agent:s,home:o}=t,i=s.metadata?.ui;let r;e[0]!==i?(r=Z(i),e[0]=i,e[1]=r):r=e[1];const a=r;let d;e[2]!==s.connections?(d=(s.connections??[]).map(Ls).sort(),e[2]=s.connections,e[3]=d):d=e[3];const l=d,m=s.metadata?.ui?.homePrompts;let c;e[4]!==s||e[5]!==l||e[6]!==o||e[7]!==a?(c=n.jsx(Hs,{agent:s,home:o,connectionIds:l,pinnedTiles:a}),e[4]=s,e[5]=l,e[6]=o,e[7]=a,e[8]=c):c=e[8];let u;e[9]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(Ds,{}),e[9]=u):u=e[9];const f=m??null;let p;e[10]!==s||e[11]!==o||e[12]!==f?(p=n.jsx($.Suspense,{fallback:u,children:n.jsx(Vs,{agent:s,home:o,curated:f})}),e[10]=s,e[11]=o,e[12]=f,e[13]=p):p=e[13];let h;return e[14]!==c||e[15]!==p?(h=n.jsxs("div",{className:"border-t border-border px-3 py-2 flex flex-col gap-3",children:[c,p]}),e[14]=c,e[15]=p,e[16]=h):h=e[16],h}function Ls(t){return t.connection_id}function Ds(){const t=k.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsxs("div",{className:"flex flex-col gap-2 py-1",children:[n.jsx(H,{className:"h-8 w-full"}),n.jsx(H,{className:"h-8 w-2/3"})]}),t[0]=e):e=t[0],e}function Hs({agent:t,home:e,connectionIds:s,pinnedTiles:o}){const i=Ue(),{data:r,isLoading:a}=se({queryKey:te.projectConnectionDetails(t.id,s),enabled:s.length>0,queryFn:async()=>(await Promise.all(s.map(async u=>{try{const{item:f}=await i.call("COLLECTION_CONNECTIONS_GET",{id:u}),p=(f?.tools??[]).flatMap(h=>{const x=Re(h._meta);return x?[{name:h.name,description:h.description,resourceUri:x,inputSchema:h.inputSchema}]:[]});return{id:u,title:f?.title??u,icon:f?.icon??null,uiTools:p}}catch{return{id:u,title:u,icon:null,uiTools:[]}}}))).filter(u=>u.uiTools.length>0)});if(s.length===0)return null;if(a)return n.jsxs("div",{className:"flex flex-col gap-1 py-0.5",children:[n.jsx(H,{className:"h-7 w-full"}),n.jsx(H,{className:"h-7 w-2/3"})]});if(!r||r.length===0)return null;const d=new Map;for(const c of r)for(const u of c.uiTools)d.set(`${c.id}:${u.name}`,{conn:c,tool:u});const l=c=>{if(c.toolName&&c.connectionId)return d.get(`${c.connectionId}:${c.toolName}`);for(const[,u]of d)if(u.conn.id===c.connectionId&&u.tool.resourceUri===c.resourceUri)return u},m=o.some(c=>!!l(c));return n.jsxs("div",{className:"flex flex-col gap-2",children:[m&&n.jsxs("div",{className:"flex flex-col gap-0.5",children:[n.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground px-2",children:"Pinned tiles"}),o.map(c=>{const u=l(c);return u?n.jsx(Us,{agent:t,home:e,connection:u.conn,tool:u.tool,tile:c},c.tileId??`${c.connectionId}:${c.resourceUri}:${c.toolName}`):null})]}),n.jsxs("div",{className:"flex flex-col gap-0.5",children:[n.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground px-2",children:"Add tile"}),r.map(c=>c.uiTools.map(u=>n.jsx(Bs,{agent:t,home:e,connection:c,tool:u},`add:${c.id}:${u.name}`)))]})]})}function We(t,e){const s={};for(const[o,i]of Object.entries(t)){const r=e[o]?.type;if((r==="object"||r==="array")&&typeof i=="string"){if(!i.trim())continue;try{s[o]=JSON.parse(i)}catch{return null}}else if((r==="number"||r==="integer")&&typeof i=="string"){if(!i.trim())continue;s[o]=Number(i)}else i!==""&&i!=null&&(s[o]=i)}return s}function Rs(t,e){if(!t||!e)return{};const s={};for(const[o,i]of Object.entries(t)){const r=e[o]?.type;(r==="object"||r==="array")&&i!=null&&typeof i!="string"?s[o]=JSON.stringify(i,null,2):s[o]=i}return s}function Fs(t){if(!t)return"";const e=Object.entries(t).filter(([,s])=>s!=null&&s!=="");return e.length===0?"":e.slice(0,3).map(([s,o])=>{const i=typeof o=="object"?JSON.stringify(o):String(o);return`${s}=${i.length>20?`${i.slice(0,20)}…`:i}`}).join(", ")}function Us({agent:t,home:e,connection:s,tool:o,tile:i}){const[r,a]=$.useState(!1),[d,l]=$.useState(!1),m=o.inputSchema?.properties&&Object.keys(o.inputSchema.properties).length>0,[c,u]=$.useState(()=>Rs(i.toolInput,o.inputSchema?.properties)),f=async()=>{a(!0);try{const x=Z(t.metadata?.ui),y=i.tileId?x.filter(v=>v.tileId!==i.tileId):x.filter(v=>v!==i),b={...t.metadata??{},ui:{...t.metadata?.ui??{},homeTile:null,homeTiles:y}};await e.saveAgentMetadata(t,b),l(!1)}catch(x){console.error("[home-tiles] failed to remove tile",x),U.error("Couldn't update home — please try again.")}finally{a(!1)}},p=async()=>{a(!0);try{let x;if(m&&o.inputSchema?.properties){const N=We(c,o.inputSchema.properties);if(!N){U.error("Invalid JSON in one of the fields — please fix it."),a(!1);return}Object.keys(N).length>0&&(x=N)}const b=Z(t.metadata?.ui).map(N=>(i.tileId?N.tileId===i.tileId:N===i)?{...N,toolInput:x}:N),v={...t.metadata??{},ui:{...t.metadata?.ui??{},homeTile:null,homeTiles:b}};await e.saveAgentMetadata(t,v),l(!1)}catch(x){console.error("[home-tiles] failed to save tile",x),U.error("Couldn't update home — please try again.")}finally{a(!1)}},h=Fs(i.toolInput);return n.jsxs("div",{className:"flex flex-col rounded-md bg-accent/20",children:[n.jsxs("div",{className:"flex items-center gap-2.5 px-2 py-1",children:[n.jsx(Fe,{icon:s.icon,name:s.title,size:"xs"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"truncate text-sm text-foreground",children:je(o.name)}),h&&n.jsx("div",{className:"truncate text-[10px] text-muted-foreground font-mono",children:h})]}),m&&n.jsx("button",{type:"button",onClick:()=>l(x=>!x),"aria-label":"Configure tile props",title:"Configure tile props",className:"inline-flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-accent/60",children:n.jsx(yt,{size:14})}),n.jsx(ve,{isPinned:!0,submitting:r,onClick:f,label:"Remove from home"})]}),d&&m&&o.inputSchema?.properties&&n.jsxs("div",{className:"px-3 pb-2 pt-1 flex flex-col gap-2",children:[n.jsx(Be,{properties:o.inputSchema.properties,required:o.inputSchema.required,values:c,onChange:(x,y)=>u(b=>({...b,[x]:y}))}),n.jsxs("div",{className:"flex items-center gap-2 justify-end",children:[n.jsx(Y,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>l(!1),children:"Cancel"}),n.jsx(Y,{size:"sm",className:"h-7 text-xs",disabled:r,onClick:p,children:r?n.jsx(le,{size:12,className:"animate-spin"}):"Save"})]})]})]})}function Bs({agent:t,home:e,connection:s,tool:o}){const[i,r]=$.useState(!1),[a,d]=$.useState(!1),l=o.inputSchema?.properties&&Object.keys(o.inputSchema.properties).length>0,[m,c]=$.useState({}),u=async()=>{if(l&&!a){d(!0);return}if(!e.isOnHome(t.id)&&e.atLimit){U.error(`Home is full (${ne}) — remove an agent first`);return}await f()},f=async()=>{r(!0);try{let p;if(l&&o.inputSchema?.properties){const b=We(m,o.inputSchema.properties);if(!b){U.error("Invalid JSON in one of the fields — please fix it."),r(!1);return}Object.keys(b).length>0&&(p=b)}const x=[...Z(t.metadata?.ui),{tileId:crypto.randomUUID(),connectionId:s.id,resourceUri:o.resourceUri,toolName:o.name,...p?{toolInput:p}:{}}],y={...t.metadata??{},ui:{...t.metadata?.ui??{},homeTile:null,homeTiles:x}};await e.saveAgentMetadata(t,y),d(!1),c({})}catch(p){console.error("[home-tiles] failed to add tile",p),U.error("Couldn't update home — please try again.")}finally{r(!1)}};return n.jsxs("div",{className:"flex flex-col rounded-md hover:bg-accent/40",children:[n.jsxs("div",{className:"flex items-center gap-2.5 px-2 py-1",children:[n.jsx(Fe,{icon:s.icon,name:s.title,size:"xs"}),n.jsx("div",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:je(o.name)}),n.jsx(ve,{isPinned:!1,submitting:i,onClick:u,label:"Add to home"})]}),a&&l&&o.inputSchema?.properties&&n.jsxs("div",{className:"px-3 pb-2 pt-1 flex flex-col gap-2",children:[n.jsx(Be,{properties:o.inputSchema.properties,required:o.inputSchema.required,values:m,onChange:(p,h)=>c(x=>({...x,[p]:h}))}),n.jsxs("div",{className:"flex items-center gap-2 justify-end",children:[n.jsx(Y,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>{d(!1),c({})},children:"Cancel"}),n.jsx(Y,{size:"sm",className:"h-7 text-xs",disabled:i,onClick:f,children:i?n.jsx(le,{size:12,className:"animate-spin"}):"Pin"})]})]})]})}function ve(t){const e=k.c(11),{isPinned:s,submitting:o,onClick:i,label:r}=t,a=s?"text-muted-foreground hover:bg-destructive/10 hover:text-destructive":"bg-foreground text-background hover:opacity-90";let d;e[0]!==a?(d=Q("inline-flex size-7 shrink-0 items-center justify-center rounded-md text-xs transition-colors disabled:opacity-50 disabled:cursor-progress",a),e[0]=a,e[1]=d):d=e[1];let l;e[2]!==s||e[3]!==o?(l=o?n.jsx(le,{size:12,className:"animate-spin"}):s?n.jsx(bt,{size:14}):n.jsx(ye,{size:14}),e[2]=s,e[3]=o,e[4]=l):l=e[4];let m;return e[5]!==r||e[6]!==i||e[7]!==o||e[8]!==d||e[9]!==l?(m=n.jsx("button",{type:"button",onClick:i,disabled:o,"aria-label":r,title:r,className:d,children:l}),e[5]=r,e[6]=i,e[7]=o,e[8]=d,e[9]=l,e[10]=m):m=e[10],m}function Vs(t){const e=k.c(32),{agent:s,home:o,curated:i}=t,{org:r}=J();let a;e[0]!==s.id||e[1]!==r.id||e[2]!==r.slug?(a={connectionId:s.id,orgId:r.id,orgSlug:r.slug},e[0]=s.id,e[1]=r.id,e[2]=r.slug,e[3]=a):a=e[3];const d=ae(a);let l;e[4]!==s.id||e[5]!==r.id?(l=te.agentPrompts(r.id,s.id),e[4]=s.id,e[5]=r.id,e[6]=l):l=e[6];let m;e[7]!==d?(m=async()=>{const{prompts:g}=await d.listPrompts();return g.map(Gs)},e[7]=d,e[8]=m):m=e[8];let c;e[9]!==l||e[10]!==m?(c={queryKey:l,queryFn:m,staleTime:3e4,retry:!1},e[9]=l,e[10]=m,e[11]=c):c=e[11];const{data:u,isLoading:f,error:p}=se(c),h=be(r.slug);let x,y;if(e[12]!==s.id||e[13]!==u||e[14]!==h.prompts){let g;e[17]!==s.id?(g=S=>S.agentId===s.id&&S.promptName,e[17]=s.id,e[18]=g):g=e[18],x=h.prompts.filter(g).map(Ws);let w;e[19]!==u?(w=u??[],e[19]=u,e[20]=w):w=e[20],y=[...w];for(const S of x)y.some(C=>C.name===S.name)||y.push(S);e[12]=s.id,e[13]=u,e[14]=h.prompts,e[15]=x,e[16]=y}else x=e[15],y=e[16];if(f&&x.length===0){let g;return e[21]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx(H,{className:"h-7 w-full"}),n.jsx(H,{className:"h-7 w-2/3"})]}),e[21]=g):g=e[21],g}if(p&&x.length===0)return console.error("[home-tiles] listPrompts failed for agent",s.id,p),null;if(y.length===0)return null;let b;e[22]!==i||e[23]!==y?(b=i??y.map(qs),e[22]=i,e[23]=y,e[24]=b):b=e[24];let v;e[25]!==b?(v=new Set(b),e[25]=b,e[26]=v):v=e[26];const N=v;let j;return e[27]!==s||e[28]!==o||e[29]!==y||e[30]!==N?(j=n.jsx("div",{className:"flex flex-col gap-0.5",children:y.map(g=>n.jsx(Qs,{agent:s,home:o,prompt:g,allPromptNames:y.map(Ks),isPinned:N.has(g.name)},g.name))}),e[27]=s,e[28]=o,e[29]=y,e[30]=N,e[31]=j):j=e[31],j}function Ks(t){return t.name}function qs(t){return t.name}function Ws(t){return{name:t.promptName,title:t.title,description:t.description}}function Gs(t){return{name:t.name,title:t.title,description:t.description}}function Qs({agent:t,home:e,prompt:s,allPromptNames:o,isPinned:i}){const[r,a]=$.useState(!1),d=async()=>{if(!i&&!e.isOnHome(t.id)&&e.atLimit){U.error(`Home is full (${ne}) — remove an agent first`);return}a(!0);try{const l=t.metadata?.ui?.homePrompts;let m;Array.isArray(l)?m=i?l.filter(u=>u!==s.name):[...l,s.name]:m=i?o.filter(u=>u!==s.name):o;const c={...t.metadata??{},ui:{...t.metadata?.ui??{},homePrompts:m}};await e.saveAgentMetadata(t,c)}catch(l){console.error("[home-tiles] failed to toggle prompt",l),U.error("Couldn't update home — please try again.")}finally{a(!1)}};return n.jsxs("div",{className:"flex items-center gap-2.5 rounded-md px-2 py-1 hover:bg-accent/40",children:[n.jsx("div",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:s.title??je(s.name)}),n.jsx(ve,{isPinned:i,submitting:r,onClick:d,label:i?"Remove from home":"Add to home"})]})}function Js(){const t=k.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"flex flex-col gap-2 p-2",children:Array.from({length:4},Xs)}),t[0]=e):e=t[0],e}function Xs(t,e){return n.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border p-2.5",children:[n.jsx(H,{className:"size-8 rounded-md"}),n.jsxs("div",{className:"flex-1 space-y-1.5",children:[n.jsx(H,{className:"h-3 w-1/2"}),n.jsx(H,{className:"h-2.5 w-1/3"})]})]},e)}const ee=1,Ge=`home-board.layout.v${ee}`;function Qe(t){return`home-board.layout.v${ee}.${t}`}const Je={version:ee,tiles:{},hidden:[]};function fe(t){return!t||t.version!==ee?Je:{version:ee,tiles:t.tiles??{},hidden:Array.isArray(t.hidden)?t.hidden:[]}}function Zs(t){return Object.keys(t.tiles).length>0||t.hidden.length>0}function Ys(t){try{const e=localStorage.getItem(Qe(t));return e?fe(JSON.parse(e)):void 0}catch{return}}function Se(t,e){try{localStorage.setItem(Qe(t),JSON.stringify(e))}catch{}}async function _e(t,e){if(!(await fetch(`/api/${t}/kv/${Ge}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok)throw new Error("Failed to save board layout")}function en(t){const e=k.c(24),s=xe();let o;e[0]!==t?(o=te.boardLayout(t),e[0]=t,e[1]=o):o=e[1];const i=o;let r;e[2]!==t?(r=Ys(t),e[2]=t,e[3]=r):r=e[3];const a=r;let d;e[4]!==a||e[5]!==t?(d=async()=>{const b=await fetch(`/api/${t}/kv/${Ge}`);if(b.status===404)return a&&Zs(a)?(await _e(t,a),a):Je;if(!b.ok)throw new Error("Failed to load board layout");const v=await b.json(),N=fe(v.value);return Se(t,N),N},e[4]=a,e[5]=t,e[6]=d):d=e[6];let l;e[7]!==a||e[8]!==i||e[9]!==d?(l={queryKey:i,queryFn:d,initialData:a,staleTime:0,refetchOnWindowFocus:!1},e[7]=a,e[8]=i,e[9]=d,e[10]=l):l=e[10];const{data:m,isLoading:c}=se(l);let u;e[11]!==t?(u={mutationFn:b=>_e(t,b)},e[11]=t,e[12]=u):u=e[12];const f=nt(u);let p;e[13]!==f||e[14]!==t||e[15]!==s||e[16]!==i?(p=b=>{Se(t,b),s.setQueryData(i,b),f.mutate(b)},e[13]=f,e[14]=t,e[15]=s,e[16]=i,e[17]=p):p=e[17];const h=p;let x;e[18]!==m?(x=fe(m),e[18]=m,e[19]=x):x=e[19];let y;return e[20]!==c||e[21]!==h||e[22]!==x?(y={layout:x,isLoading:c,save:h},e[20]=c,e[21]=h,e[22]=x,e[23]=y):y=e[23],y}const Xe=$.createContext(null);function tn(t){const e=k.c(24),{children:s}=t,{org:o}=J(),i=en(o.slug),[r,a]=$.useState(!1),[d,l]=$.useState(null);let m;e[0]!==i.layout?(m=()=>{l(i.layout),a(!0)},e[0]=i.layout,e[1]=m):m=e[1];const c=m;let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=()=>{l(null),a(!1)},e[2]=u):u=e[2];const f=u;let p;e[3]!==d||e[4]!==i?(p=()=>{d&&i.save(d),l(null),a(!1)},e[3]=d,e[4]=i,e[5]=p):p=e[5];const h=p,x=r&&d!==null,y=x?d:i.layout;let b;e[6]!==d||e[7]!==x||e[8]!==i.layout?(b=x?JSON.stringify(d)!==JSON.stringify(i.layout):!1,e[6]=d,e[7]=x,e[8]=i.layout,e[9]=b):b=e[9];const v=b;let N;e[10]!==r||e[11]!==i?(N=S=>{r?l(S):i.save(S)},e[10]=r,e[11]=i,e[12]=N):N=e[12];const j=N;let g;e[13]!==j||e[14]!==c||e[15]!==v||e[16]!==r||e[17]!==y||e[18]!==h||e[19]!==i.isLoading?(g={isEditMode:r,enter:c,cancel:f,save:h,hasChanges:v,layout:y,isLayoutLoading:i.isLoading,commitLayout:j},e[13]=j,e[14]=c,e[15]=v,e[16]=r,e[17]=y,e[18]=h,e[19]=i.isLoading,e[20]=g):g=e[20];let w;return e[21]!==s||e[22]!==g?(w=n.jsx(Xe.Provider,{value:g,children:s}),e[21]=s,e[22]=g,e[23]=w):w=e[23],w}function Ze(){const t=$.useContext(Xe);if(!t)throw new Error("useHomeEdit must be used within a HomeEditProvider");return t}function sn({agentId:t}){const{org:e,locator:s}=J(),o=ae({connectionId:t,orgId:e.id,orgSlug:e.slug}),{create:i}=rs(),{setTaskId:r}=Dt(),[a,d]=$.useState(null),[l,m]=$.useState(!1),c=$.useRef(!1),u=async(y,b)=>{if(!o){U.error("MCP client not available");return}if(!c.current){c.current=!0,m(!0);try{const v=await os(o,y.name,b),N={type:"doc",content:[{type:"paragraph",content:[Ut({id:y.name,name:Bt(y.name,Vt(y._meta)),metadata:v.messages,char:"/",kind:"prompt",args:b}),{type:"text",text:" "}]}]},j=crypto.randomUUID();ls(sessionStorage,s,j,{tiptapDoc:N}),await i({id:j,virtual_mcp_id:t}),r(j,t,{autosend:!0})}catch(v){console.error("[start-thread-from-prompt] failed",v),U.error("Failed to start thread. Please try again.")}finally{c.current=!1,m(!1)}}},f=async y=>{if(!c.current){if(y.arguments&&y.arguments.length>0){d(y);return}await u(y)}},p=async y=>{if(!a)return;const b=a;d(null),await u(b,y)};return{start:f,startBlank:async y=>{if(!c.current){c.current=!0,m(!0);try{const b=crypto.randomUUID();await i({id:b,virtual_mcp_id:t}),r(b,t,y?.main?{main:y.main}:void 0)}catch(b){console.error("[start-thread-from-prompt] startBlank failed",b),U.error("Failed to start thread. Please try again.")}finally{c.current=!1,m(!1)}}},dialog:n.jsx(Ft,{prompt:a,setPrompt:y=>d(y),onSubmit:p}),dialogPrompt:a,starting:l}}const q=4,G=100,Ce=12,nn=5,on={w:2,h:2};class pe extends $.Component{state={hasError:!1};static getDerivedStateFromError(e){return{hasError:!0,message:e instanceof Error?e.message:"Unknown error"}}componentDidCatch(e,s){console.error("[home-tiles] tile crashed:",e,s.componentStack)}render(){return this.state.hasError?n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-4 text-center",children:[n.jsx("span",{className:"flex size-8 items-center justify-center rounded-md bg-destructive/10 text-destructive",children:n.jsx(it,{size:16})}),n.jsx("p",{className:"text-sm font-medium text-foreground",children:"This tile crashed"}),n.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:this.state.message??"Something went wrong rendering this tile."})]}):this.props.children}}function rn(t){const e=k.c(72),{tiles:s,isEditMode:o,renderTile:i,onMove:r,onResize:a,onRemove:d}=t,l=ge(),m=$.useRef(null),[c,u]=$.useState(null),[f,p]=$.useState(null);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={activationConstraint:{distance:4}},e[0]=h):h=e[0];const x=Ae(re(Ee,h),re(Pe)),y=s.reduce(ln,0),b=o?Math.max(y+2,4):Math.max(y,1);let v;e[1]===Symbol.for("react.memo_cache_sentinel")?(v=()=>{const A=m.current?.getBoundingClientRect();return A?{cellWidth:A.width/q,cellHeight:G}:null},e[1]=v):v=e[1];const N=v;let j;e[2]===Symbol.for("react.memo_cache_sentinel")?(j=A=>{u(String(A.active.id)),p(N())},e[2]=j):j=e[2];const g=j;let w;e[3]!==f||e[4]!==r||e[5]!==s?(w=A=>{const V=String(A.active.id),D=f??N();if(u(null),p(null),!D||D.cellWidth<=0)return;const E=s.find(W=>W.id===V);if(!E)return;const R=Math.round(A.delta.x/D.cellWidth),F=Math.round(A.delta.y/D.cellHeight);R===0&&F===0||r(V,{x:E.x+R,y:E.y+F})},e[3]=f,e[4]=r,e[5]=s,e[6]=w):w=e[6];const S=w;if(l){let A;if(e[7]!==i||e[8]!==s){let D;e[10]!==i?(D=E=>n.jsx("div",{className:"group bg-card card-shadow rounded-2xl overflow-hidden",style:{minHeight:G},children:n.jsx(pe,{children:i(E)})},E.id),e[10]=i,e[11]=D):D=e[11],A=s.map(D),e[7]=i,e[8]=s,e[9]=A}else A=e[9];let V;return e[12]!==A?(V=n.jsx("div",{className:"flex flex-col gap-3 px-4 pb-8",children:A}),e[12]=A,e[13]=V):V=e[13],V}let C,_,I,T,P,M,z,B,O;if(e[14]!==c||e[15]!==f||e[16]!==o||e[17]!==S||e[18]!==d||e[19]!==a||e[20]!==i||e[21]!==x||e[22]!==s||e[23]!==b){const A=c?s.find(X=>X.id===c):null;_=Me,B=x,O=g,I=S;const V=b*G,D=o?G*4:G;let E;e[33]!==V||e[34]!==D?(E={height:V,minHeight:D},e[33]=V,e[34]=D,e[35]=E):E=e[35];let R;e[36]!==o||e[37]!==s||e[38]!==b?(R=o&&n.jsx(an,{rows:b,tiles:s}),e[36]=o,e[37]=s,e[38]=b,e[39]=R):R=e[39];let F;if(e[40]!==c||e[41]!==o||e[42]!==d||e[43]!==a||e[44]!==i||e[45]!==s){let X;e[47]!==c||e[48]!==o||e[49]!==d||e[50]!==a||e[51]!==i?(X=ie=>n.jsx(dn,{tile:ie,isEditMode:o,isDragging:c===ie.id,onResize:a,onRemove:d,children:i(ie)},ie.id),e[47]=c,e[48]=o,e[49]=d,e[50]=a,e[51]=i,e[52]=X):X=e[52],F=s.map(X),e[40]=c,e[41]=o,e[42]=d,e[43]=a,e[44]=i,e[45]=s,e[46]=F}else F=e[46];e[53]!==E||e[54]!==R||e[55]!==F?(T=n.jsxs("div",{ref:m,className:"relative w-full",style:E,children:[R,F]}),e[53]=E,e[54]=R,e[55]=F,e[56]=T):T=e[56],C=Pt,P=null;const W=A&&f?A.w*f.cellWidth-Ce:void 0,de=A&&f?A.h*f.cellHeight-Ce:void 0;e[57]!==W||e[58]!==de?(M={width:W,height:de},e[57]=W,e[58]=de,e[59]=M):M=e[59],z=A&&n.jsx("div",{className:"bg-card card-shadow rounded-2xl shadow-2xl ring-2 ring-primary/40 h-full overflow-hidden opacity-95",children:n.jsx(pe,{children:i(A)})}),e[14]=c,e[15]=f,e[16]=o,e[17]=S,e[18]=d,e[19]=a,e[20]=i,e[21]=x,e[22]=s,e[23]=b,e[24]=C,e[25]=_,e[26]=I,e[27]=T,e[28]=P,e[29]=M,e[30]=z,e[31]=B,e[32]=O}else C=e[24],_=e[25],I=e[26],T=e[27],P=e[28],M=e[29],z=e[30],B=e[31],O=e[32];let L;e[60]!==C||e[61]!==P||e[62]!==M||e[63]!==z?(L=n.jsx(C,{dropAnimation:P,style:M,children:z}),e[60]=C,e[61]=P,e[62]=M,e[63]=z,e[64]=L):L=e[64];let K;return e[65]!==_||e[66]!==I||e[67]!==T||e[68]!==L||e[69]!==B||e[70]!==O?(K=n.jsxs(_,{sensors:B,onDragStart:O,onDragEnd:I,children:[T,L]}),e[65]=_,e[66]=I,e[67]=T,e[68]=L,e[69]=B,e[70]=O,e[71]=K):K=e[71],K}function ln(t,e){return Math.max(t,e.y+e.h)}function an(t){const e=k.c(7),{rows:s,tiles:o}=t;let i;e[0]!==o?(i=(l,m)=>o.some(c=>l>=c.x&&l<c.x+c.w&&m>=c.y&&m<c.y+c.h),e[0]=o,e[1]=i):i=e[1];const r=i;let a;if(e[2]!==r||e[3]!==s){a=[];for(let l=0;l<s;l++)for(let m=0;m<q;m++)r(m,l)||a.push({x:m,y:l});e[2]=r,e[3]=s,e[4]=a}else a=e[4];let d;return e[5]!==a?(d=n.jsx("div",{className:"absolute inset-0 pointer-events-none",children:a.map(cn)}),e[5]=a,e[6]=d):d=e[6],d}function cn(t){return n.jsx("div",{className:"absolute p-1",style:{left:`${t.x/q*100}%`,top:t.y*G,width:`${1/q*100}%`,height:G},children:n.jsx("div",{className:"h-full w-full rounded-2xl border border-dashed border-border/60"})},`${t.x}-${t.y}`)}function dn(t){const e=k.c(31),{tile:s,isEditMode:o,isDragging:i,onResize:r,onRemove:a,children:d}=t,l=!o;let m;e[0]!==l||e[1]!==s.id?(m={id:s.id,disabled:l},e[0]=l,e[1]=s.id,e[2]=m):m=e[2];const{setNodeRef:c,attributes:u,listeners:f,isDragging:p}=Et(m),h=`${s.x/q*100}%`,x=`${s.w/q*100}%`,y=s.y*G,b=s.h*G,v=p||i,N=!v&&"transition-[left,top,width,height,opacity] duration-200 ease-out",j=v&&"opacity-30";let g;e[3]!==N||e[4]!==j?(g=Q("absolute p-1 will-change-[left,top,width,height,opacity]",N,j),e[3]=N,e[4]=j,e[5]=g):g=e[5];let w;e[6]!==b||e[7]!==h||e[8]!==y||e[9]!==x?(w={left:h,top:y,width:x,height:b},e[6]=b,e[7]=h,e[8]=y,e[9]=x,e[10]=w):w=e[10];const S=o&&"outline outline-1 outline-transparent hover:outline-primary/40";let C;e[11]!==S?(C=Q("group relative h-full bg-card card-shadow rounded-2xl overflow-hidden",S),e[11]=S,e[12]=C):C=e[12];let _;e[13]!==u||e[14]!==o||e[15]!==f||e[16]!==a||e[17]!==r||e[18]!==s?(_=o&&n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",...u,...f,className:"absolute top-2 left-2 z-10 flex size-8 items-center justify-center rounded-md bg-background/90 border border-border text-muted-foreground hover:text-foreground hover:bg-muted cursor-grab active:cursor-grabbing","aria-label":"Drag tile",children:n.jsx(He,{size:16})}),n.jsx("div",{className:"absolute top-2 right-2 z-10 flex items-center gap-1",children:n.jsx(mn,{tile:s,onResize:r,onRemove:a})})]}),e[13]=u,e[14]=o,e[15]=f,e[16]=a,e[17]=r,e[18]=s,e[19]=_):_=e[19];let I;e[20]!==d?(I=n.jsx("div",{className:"h-full overflow-hidden",children:n.jsx(pe,{children:d})}),e[20]=d,e[21]=I):I=e[21];let T;e[22]!==I||e[23]!==C||e[24]!==_?(T=n.jsxs("div",{className:C,children:[_,I]}),e[22]=I,e[23]=C,e[24]=_,e[25]=T):T=e[25];let P;return e[26]!==c||e[27]!==T||e[28]!==g||e[29]!==w?(P=n.jsx("div",{ref:c,className:g,style:w,children:T}),e[26]=c,e[27]=T,e[28]=g,e[29]=w,e[30]=P):P=e[30],P}function mn(t){const e=k.c(20),{tile:s,onResize:o,onRemove:i}=t,[r,a]=$.useState(!1);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(as,{asChild:!0,children:n.jsx("button",{type:"button",className:"flex size-8 items-center justify-center rounded-md bg-background/90 border border-border text-muted-foreground hover:text-foreground hover:bg-muted","aria-label":"Tile options",children:n.jsx(jt,{size:16})})}),e[0]=d):d=e[0];let l;e[1]!==o||e[2]!==s.id?(l=y=>{o(s.id,y),a(!1)},e[1]=o,e[2]=s.id,e[3]=l):l=e[3];let m;e[4]!==l||e[5]!==s?(m=n.jsx(un,{tile:s,onPick:l}),e[4]=l,e[5]=s,e[6]=m):m=e[6];let c;e[7]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(cs,{}),e[7]=c):c=e[7];let u;e[8]!==i||e[9]!==s.id?(u=()=>i(s.id),e[8]=i,e[9]=s.id,e[10]=u):u=e[10];let f;e[11]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(fs,{size:14,className:"mr-2"}),e[11]=f):f=e[11];let p;e[12]!==u?(p=n.jsxs(ds,{onSelect:u,className:"text-destructive focus:text-destructive",children:[f,"Remove tile"]}),e[12]=u,e[13]=p):p=e[13];let h;e[14]!==m||e[15]!==p?(h=n.jsxs(ms,{align:"end",className:"w-auto",children:[m,c,p]}),e[14]=m,e[15]=p,e[16]=h):h=e[16];let x;return e[17]!==r||e[18]!==h?(x=n.jsxs(us,{open:r,onOpenChange:a,children:[d,h]}),e[17]=r,e[18]=h,e[19]=x):x=e[19],x}function un(t){const e=k.c(19),{tile:s,onPick:o}=t,i=s.minW??1,r=s.minH??1,[a,d]=$.useState(null);let l;e[0]!==a||e[1]!==s.h||e[2]!==s.w?(l=a??{w:s.w,h:s.h},e[0]=a,e[1]=s.h,e[2]=s.w,e[3]=l):l=e[3];const m=l;let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx("span",{className:"text-xs text-muted-foreground",children:"Size"}),e[4]=c):c=e[4];let u;e[5]!==m.h||e[6]!==m.w?(u=n.jsxs("div",{className:"mb-2 flex items-center justify-between gap-4",children:[c,n.jsxs("span",{className:"text-xs font-medium tabular-nums",children:[m.w," × ",m.h]})]}),e[5]=m.h,e[6]=m.w,e[7]=u):u=e[7];let f,p;e[8]===Symbol.for("react.memo_cache_sentinel")?(f={gridTemplateColumns:`repeat(${q}, 1.25rem)`},p=()=>d(null),e[8]=f,e[9]=p):(f=e[8],p=e[9]);let h;e[10]!==m.h||e[11]!==m.w||e[12]!==r||e[13]!==i||e[14]!==o?(h=n.jsx("div",{className:"grid w-max gap-1",style:f,onPointerLeave:p,children:Array.from({length:nn},(y,b)=>Array.from({length:q},(v,N)=>{const j=N+1,g=b+1,w=j<i||g<r,S=j<=m.w&&g<=m.h;return n.jsx("button",{type:"button",disabled:w,"aria-label":`${j} by ${g}`,onPointerEnter:()=>d({w:j,h:g}),onClick:()=>o({w:j,h:g}),className:Q("size-5 rounded-sm border transition-colors",S?"border-primary bg-primary/30":"border-border bg-muted",w?"cursor-not-allowed opacity-40":"cursor-pointer hover:border-primary/60")},`${j}x${g}`)}))}),e[10]=m.h,e[11]=m.w,e[12]=r,e[13]=i,e[14]=o,e[15]=h):h=e[15];let x;return e[16]!==u||e[17]!==h?(x=n.jsxs("div",{className:"px-2 py-1.5",children:[u,h]}),e[16]=u,e[17]=h,e[18]=x):x=e[18],x}function fn(t,e,s){return t.some(o=>e>=o.x&&e<o.x+o.w&&s>=o.y&&s<o.y+o.h)}function he(t,e,s){for(let o=0;o<100;o++)for(let i=0;i<=q-e;i++){let r=!0;for(let a=0;a<s&&r;a++)for(let d=0;d<e&&r;d++)fn(t,i+d,o+a)&&(r=!1);if(r)return{x:i,y:o}}return{x:0,y:0}}function me(t,e,s={w:1,h:1}){const o=Math.max(s.w,Math.min(q,t)),i=Math.max(s.h,Math.min(6,e));return{w:o,h:i}}function ue(t,e,s){const o=Math.max(0,Math.min(q-s,t)),i=Math.max(0,e);return{x:o,y:i}}function pn(t,e,s){const o=t.find(l=>l.id===e);if(!o)return t;const i=t.filter(l=>l.id!==e),r=i.find(l=>s.x>=l.x&&s.x<l.x+l.w&&s.y>=l.y&&s.y<l.y+l.h);if(r&&r.w===o.w&&r.h===o.h)return t.map(l=>l.id===e?{...l,x:r.x,y:r.y}:l.id===r.id?{...l,x:o.x,y:o.y}:l);const d=[{...o,x:s.x,y:s.y}];for(const l of i){const m=he(d,l.w,l.h);d.push({...l,x:m.x,y:m.y})}return d}function hn(t){const e=k.c(35),{layout:s,isLayoutLoading:o,commitLayout:i}=Ze();let r;e[0]!==s.hidden?(r=new Set(s.hidden),e[0]=s.hidden,e[1]=r):r=e[1];const a=r;let d,l;if(e[2]!==t||e[3]!==a||e[4]!==s.tiles){l=[];let v;e[7]!==a?(v=j=>j.pinned||!a.has(j.id),e[7]=a,e[8]=v):v=e[8];const N=t.filter(v);d=new Map;for(const j of t)j.minSize&&d.set(j.id,j.minSize);for(const j of N){const g=s.tiles[j.id];if(!g)continue;const w=d.get(j.id),{w:S,h:C}=me(g.w,g.h,w),{x:_,y:I}=ue(g.x,g.y,S);l.push({id:j.id,x:_,y:I,w:S,h:C,minW:w?.w,minH:w?.h})}for(const j of N){if(l.some(I=>I.id===j.id))continue;const g=j.defaultSize??on,w=d.get(j.id),{w:S,h:C}=me(g.w,g.h,w),_=he(l,S,C);l.push({id:j.id,x:_.x,y:_.y,w:S,h:C,minW:w?.w,minH:w?.h})}e[2]=t,e[3]=a,e[4]=s.tiles,e[5]=d,e[6]=l}else d=e[5],l=e[6];let m;e[9]!==t?(m=new Set(t.map(xn)),e[9]=t,e[10]=m):m=e[10];const c=m;let u;e[11]!==c||e[12]!==i?(u=(v,N)=>{const j={};for(const g of v)j[g.id]={x:g.x,y:g.y,w:g.w,h:g.h};i({version:ee,tiles:j,hidden:N.filter(g=>c.has(g))})},e[11]=c,e[12]=i,e[13]=u):u=e[13];const f=u;let p;e[14]!==l?(p={visible:l},e[14]=l,e[15]=p):p=e[15];let h;e[16]!==f||e[17]!==s||e[18]!==l?(h=(v,N)=>{const j=l.find(S=>S.id===v);if(!j)return;const g=ue(N.x,N.y,j.w);if(g.x===j.x&&g.y===j.y)return;const w=pn(l,v,g);f(w,s.hidden)},e[16]=f,e[17]=s,e[18]=l,e[19]=h):h=e[19];let x;e[20]!==f||e[21]!==s||e[22]!==d||e[23]!==l?(x=(v,N)=>{const j=l.find(T=>T.id===v);if(!j)return;const g=d.get(v),{w,h:S}=me(N.w,N.h,g);if(w===j.w&&S===j.h)return;const C={...j,w,h:S,x:ue(j.x,j.y,w).x},_=l.filter(T=>T.id!==v),I=[C];for(const T of _){const P=he(I,T.w,T.h);I.push({...T,x:P.x,y:P.y})}f(I,s.hidden)},e[20]=f,e[21]=s,e[22]=d,e[23]=l,e[24]=x):x=e[24];let y;e[25]!==f||e[26]!==s||e[27]!==l?(y=v=>{const N=l.filter(j=>j.id!==v);f(N,Array.from(new Set([...s.hidden,v])))},e[25]=f,e[26]=s,e[27]=l,e[28]=y):y=e[28];let b;return e[29]!==o||e[30]!==p||e[31]!==h||e[32]!==x||e[33]!==y?(b={snapshot:p,isLoading:o,moveTile:h,resizeTile:x,hideTile:y},e[29]=o,e[30]=p,e[31]=h,e[32]=x,e[33]=y,e[34]=b):b=e[34],b}function xn(t){return t.id}const gn={w:2,h:4},yn={w:1,h:2},bn={w:1,h:1};function jn(t){return`prompt:${t.agentId}:${t.promptName||"blank"}`}function vn(t){return t.tileId?`tile:${t.tileId}`:`tile:${t.agentId}:${t.resourceUri}`}function Nn(t){return t.promptName?t.agentName:t.description}function wn(t){return{name:t.promptName,title:t.title,description:t.description,arguments:t.arguments,_meta:t._meta}}function Ye(t){const e=k.c(14),{org:s}=J();let o;e[0]!==s.id||e[1]!==s.slug||e[2]!==t.connectionId?(o=ct({connectionId:t.connectionId,orgId:s.id,orgSlug:s.slug}),e[0]=s.id,e[1]=s.slug,e[2]=t.connectionId,e[3]=o):o=e[3];const{data:i}=se(o),r=!!i&&!t.toolName;let a;e[4]!==i||e[5]!==r?(a={client:i,enabled:r},e[4]=i,e[5]=r,e[6]=a):a=e[6];const{data:d}=ss(a);let l;e[7]!==t.resourceUri||e[8]!==t.toolName||e[9]!==d?.tools?(l=t.toolName??d?.tools.find(u=>Re(u._meta)===t.resourceUri)?.name,e[7]=t.resourceUri,e[8]=t.toolName,e[9]=d?.tools,e[10]=l):l=e[10];const m=l;let c;return e[11]!==t.connectionId||e[12]!==m?(c=m?is(t.connectionId,m):void 0,e[11]=t.connectionId,e[12]=m,e[13]=c):c=e[13],c}function Ne(t){const e=k.c(10);let s;e[0]!==t?(s={agentId:t},e[0]=t,e[1]=s):s=e[1];const{start:o,startBlank:i,dialog:r,starting:a}=sn(s);let d;e[2]!==o||e[3]!==i?(d=c=>{if(!c.promptName){i();return}o(wn(c))},e[2]=o,e[3]=i,e[4]=d):d=e[4];const l=d;let m;return e[5]!==r||e[6]!==l||e[7]!==i||e[8]!==a?(m={open:l,startBlank:i,dialog:r,starting:a},e[5]=r,e[6]=l,e[7]=i,e[8]=a,e[9]=m):m=e[9],m}function Sn(t){const e=k.c(32),{entry:s,isEditMode:o}=t,{open:i,dialog:r,starting:a}=Ne(s.agentId);let d;e[0]!==s||e[1]!==i?(d=()=>i(s),e[0]=s,e[1]=i,e[2]=d):d=e[2];const l=a||o,m=!o&&"cursor-pointer transition-colors hover:bg-accent/40",c=o&&"cursor-default pl-12",u=a&&"opacity-60";let f;e[3]!==m||e[4]!==c||e[5]!==u?(f=Q("group/tile relative flex h-full w-full items-center gap-3 px-4 py-3 text-left bg-card",m,c,u),e[3]=m,e[4]=c,e[5]=u,e[6]=f):f=e[6];let p;e[7]!==s.agentIcon||e[8]!==s.agentName?(p=n.jsx(ce,{icon:s.agentIcon,name:s.agentName,size:"sm+"}),e[7]=s.agentIcon,e[8]=s.agentName,e[9]=p):p=e[9];let h;e[10]!==s.title?(h=n.jsx("div",{className:"line-clamp-2 text-sm font-medium text-foreground leading-snug",children:s.title}),e[10]=s.title,e[11]=h):h=e[11];let x;e[12]!==s?(x=Nn(s),e[12]=s,e[13]=x):x=e[13];let y;e[14]!==x?(y=n.jsx("div",{className:"truncate text-xs text-muted-foreground mt-0.5",children:x}),e[14]=x,e[15]=y):y=e[15];let b;e[16]!==y||e[17]!==h?(b=n.jsxs("div",{className:"min-w-0 flex-1",children:[h,y]}),e[16]=y,e[17]=h,e[18]=b):b=e[18];let v;e[19]!==o?(v=!o&&n.jsx(ns,{size:16,className:"shrink-0 text-muted-foreground opacity-0 -translate-x-1 transition-all duration-200 group-hover/tile:opacity-100 group-hover/tile:translate-x-0","aria-hidden":!0}),e[19]=o,e[20]=v):v=e[20];let N;e[21]!==a||e[22]!==d||e[23]!==b||e[24]!==v||e[25]!==l||e[26]!==f||e[27]!==p?(N=n.jsxs("button",{type:"button",onClick:d,disabled:l,"aria-busy":a,className:f,children:[p,b,v]}),e[21]=a,e[22]=d,e[23]=b,e[24]=v,e[25]=l,e[26]=f,e[27]=p,e[28]=N):N=e[28];let j;return e[29]!==r||e[30]!==N?(j=n.jsxs(n.Fragment,{children:[N,r]}),e[29]=r,e[30]=N,e[31]=j):j=e[31],j}function _n(){const t=k.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"mt-4 grid w-full grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3",children:Array.from({length:3},Cn)}),t[0]=e):e=t[0],e}function Cn(t,e){return n.jsxs("div",{className:"flex w-full items-center gap-3 rounded-2xl bg-card card-shadow px-3 py-2.5",children:[n.jsx(H,{className:"size-10 rounded-xl"}),n.jsxs("div",{className:"flex-1 space-y-1.5",children:[n.jsx(H,{className:"h-3 w-2/3"}),n.jsx(H,{className:"h-2.5 w-1/3"})]})]},`chip-skeleton-${e}`)}function In(t){const e=k.c(17),{tile:s,prompts:o,isEditMode:i,tileWidth:r}=t,{org:a}=J(),{open:d,startBlank:l,dialog:m,starting:c}=Ne(s.agentId),u=o.filter(Tn),f=Ye(s),p="relative flex h-full w-full flex-col p-3";let h;e[0]!==i||e[1]!==f||e[2]!==l||e[3]!==c?(h=!i&&n.jsx("button",{type:"button",onClick:()=>{l(f?{main:f}:void 0)},disabled:c,"aria-busy":c,className:"mb-1 self-start rounded-md px-2 py-1 text-[10px] text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",children:"Open chat"}),e[0]=i,e[1]=f,e[2]=l,e[3]=c,e[4]=h):h=e[4];const x="flex min-h-0 flex-1 gap-3 overflow-hidden";let y;e[5]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx($n,{}),e[5]=y):y=e[5];let b;e[6]!==a.id||e[7]!==a.slug||e[8]!==s?(b=n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden rounded-lg border border-border",children:n.jsx($.Suspense,{fallback:y,children:n.jsx(kn,{tile:s,orgId:a.id,orgSlug:a.slug})})}),e[6]=a.id,e[7]=a.slug,e[8]=s,e[9]=b):b=e[9];const v=u.length>0&&!i&&r>=2&&n.jsx("div",{className:"flex w-44 shrink-0 flex-col gap-2 overflow-hidden",children:u.map(g=>n.jsx("button",{type:"button",onClick:()=>d(g),disabled:c,className:"shrink-0 rounded-lg border border-border bg-background px-2.5 py-2 text-left text-xs leading-snug text-foreground transition-colors hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",children:n.jsx("span",{className:"line-clamp-2",children:g.title})},g.promptName))});let N;e[10]!==b||e[11]!==v?(N=n.jsxs("div",{className:x,children:[b,v]}),e[10]=b,e[11]=v,e[12]=N):N=e[12];let j;return e[13]!==m||e[14]!==h||e[15]!==N?(j=n.jsxs("div",{className:p,children:[h,N,m]}),e[13]=m,e[14]=h,e[15]=N,e[16]=j):j=e[16],j}function Tn(t){return!!t.promptName}function kn(t){const e=k.c(13),{tile:s,orgId:o,orgSlug:i}=t;let r;e[0]!==o||e[1]!==i||e[2]!==s.connectionId?(r={connectionId:s.connectionId,orgId:o,orgSlug:i},e[0]=o,e[1]=i,e[2]=s.connectionId,e[3]=r):r=e[3];const a=ae(r),d=s.minHeight??200,l=s.maxHeight??4e3;let m;return e[4]!==a||e[5]!==o||e[6]!==i||e[7]!==d||e[8]!==l||e[9]!==s.connectionId||e[10]!==s.resourceUri||e[11]!==s.toolInput?(m=n.jsx(Jt,{resourceURI:s.resourceUri,orgId:o,orgSlug:i,connectionId:s.connectionId,client:a,toolInput:s.toolInput,displayMode:"fullscreen",minHeight:d,maxHeight:l,className:"h-full"}),e[4]=a,e[5]=o,e[6]=i,e[7]=d,e[8]=l,e[9]=s.connectionId,e[10]=s.resourceUri,e[11]=s.toolInput,e[12]=m):m=e[12],m}function $n(){const t=k.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsxs("div",{className:"flex h-full w-full flex-col gap-2 p-4",children:[n.jsx(H,{className:"h-3 w-2/3"}),n.jsx(H,{className:"h-3 w-1/2"}),n.jsx(H,{className:"mt-1 h-full w-full rounded-md"})]}),t[0]=e):e=t[0],e}function An(t){const e=k.c(14),{icon:s,name:o}=t;let i;e[0]!==s||e[1]!==o?(i=n.jsx(ce,{icon:s,name:o,size:"sm+"}),e[0]=s,e[1]=o,e[2]=i):i=e[2];let r;e[3]!==o?(r=n.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:o}),e[3]=o,e[4]=r):r=e[4];let a;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx("div",{className:"truncate text-xs text-muted-foreground",children:"Loading tile…"}),e[5]=a):a=e[5];let d;e[6]!==r?(d=n.jsxs("div",{className:"min-w-0 flex-1",children:[r,a]}),e[6]=r,e[7]=d):d=e[7];let l;e[8]!==i||e[9]!==d?(l=n.jsxs("div",{className:"flex items-center gap-2.5",children:[i,d]}),e[8]=i,e[9]=d,e[10]=l):l=e[10];let m;e[11]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsxs("div",{className:"flex flex-1 flex-col gap-2 pt-1",children:[n.jsx(H,{className:"h-3 w-3/4"}),n.jsx(H,{className:"h-3 w-1/2"}),n.jsx(H,{className:"h-3 w-2/3"})]}),e[11]=m):m=e[11];let c;return e[12]!==l?(c=n.jsxs("div",{className:"flex h-full w-full flex-col gap-3 p-5 opacity-60",children:[l,m]}),e[12]=l,e[13]=c):c=e[13],c}function Pn(t){const e=k.c(10),{tile:s,prompts:o,isEditMode:i}=t,{open:r,startBlank:a,dialog:d,starting:l}=Ne(s.agentId),m=o.filter(En),c=Ye(s),u="flex h-full w-full flex-col gap-3 p-4";let f;e[0]!==c||e[1]!==a?(f=()=>{a(c?{main:c}:void 0)},e[0]=c,e[1]=a,e[2]=f):f=e[2];const p=l||i;let h;e[3]!==f||e[4]!==p?(h=n.jsx("button",{type:"button",onClick:f,disabled:p,className:"mb-1 self-start rounded-md px-2 py-1 text-[10px] text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",children:"Open chat"}),e[3]=f,e[4]=p,e[5]=h):h=e[5];const x=m.length>0&&!i&&n.jsx("div",{className:"grid grid-cols-1 gap-2 overflow-hidden sm:grid-cols-2",children:m.map(b=>n.jsx("button",{type:"button",onClick:()=>!i&&r(b),disabled:l,className:"rounded-lg border border-border bg-background px-2.5 py-2 text-left text-xs leading-snug text-foreground transition-colors hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",children:n.jsx("span",{className:"line-clamp-2",children:b.title})},b.promptName))});let y;return e[6]!==d||e[7]!==h||e[8]!==x?(y=n.jsxs("div",{className:u,children:[h,x,d]}),e[6]=d,e[7]=h,e[8]=x,e[9]=y):y=e[9],y}function En(t){return!!t.promptName}function et({isEditMode:t}){const{org:e}=J(),{isLoading:s,prompts:o,tiles:i}=be(e.slug),r=ze()?.ids??[],a=new Set(r),d=Oe(),l=Ue(),m=xe(),c=new Set(i.map(g=>g.agentId)),u=new Map;for(const g of o){const w=u.get(g.agentId);w?w.push(g):u.set(g.agentId,[g])}const f=o.filter(g=>!c.has(g.agentId)),p=[...i.map(g=>({kind:"tile",id:vn(g),data:g})),...f.map(g=>({kind:"prompt",id:jn(g),data:g}))],h=new Map(p.map(g=>[g.id,g])),x=hn(p.map(g=>({id:g.id,defaultSize:g.kind==="tile"?gn:bn,minSize:g.kind==="tile"?yn:void 0,pinned:a.has(g.data.agentId)}))),y=g=>{d.apply(w=>w.filter(S=>S!==g)).catch(()=>U.error("Couldn't remove from home — please try again."))},b=async g=>{if(i.filter(S=>S.agentId===g.agentId).length<=1){y(g.agentId);return}try{const C=(await l.call("COLLECTION_VIRTUAL_MCP_GET",{id:g.agentId})).item;if(!C)throw new Error("Agent not found");const _=Z(C.metadata?.ui),I=g.tileId?_.filter(T=>T.tileId!==g.tileId):_.filter(T=>T.connectionId!==g.connectionId||T.resourceUri!==g.resourceUri);await l.call("COLLECTION_VIRTUAL_MCP_UPDATE",{id:g.agentId,data:{metadata:{...C.metadata??{},ui:{...C.metadata?.ui??{},homeTile:null,homeTiles:I}}}}),m.invalidateQueries({queryKey:te.homeNextActions(e.slug)})}catch{U.error("Couldn't remove tile — please try again.")}},v=g=>{const w=h.get(g);if(w){if(!a.has(w.data.agentId)){x.hideTile(g);return}w.kind==="tile"?b(w.data):y(w.data.agentId)}},N=g=>{const w=h.get(g.id);if(!w)return null;if(w.kind==="tile"){const S=u.get(w.data.agentId)??[];return n.jsx(ot,{fallback:n.jsx(Pn,{tile:w.data,prompts:S,isEditMode:t}),children:n.jsx($.Suspense,{fallback:n.jsx(An,{icon:w.data.agentIcon,name:w.data.agentName}),children:n.jsx(In,{tile:w.data,prompts:S,isEditMode:t,tileWidth:g.w})})})}return n.jsx(Sn,{entry:w.data,isEditMode:t})};return s||x.isLoading?n.jsx(_n,{}):x.snapshot.visible.length===0&&!t?null:n.jsx("div",{className:"mt-4 flex w-full max-w-7xl flex-col gap-4",children:n.jsx(rn,{tiles:x.snapshot.visible,isEditMode:t,renderTile:N,onMove:x.moveTile,onResize:x.resizeTile,onRemove:v})})}function Mn(t){const e=k.c(2),{prompts:s,tiles:o}=be(t),i=o.length>0||s.length>0;let r;return e[0]!==i?(r={hasVisibleTiles:i},e[0]=i,e[1]=r):r=e[1],r}const Ie=420,Te=305;function tt(){const t=k.c(4);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("img",{src:"/home/bg-top-left.svg",alt:"",className:"absolute top-0 left-0 h-auto select-none opacity-80 dark:hidden",style:{width:Ie}}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx("img",{src:"/home/bg-top-left-dark.svg",alt:"",className:"absolute top-0 left-0 hidden h-auto select-none opacity-80 dark:block",style:{width:Ie}}),t[1]=s):s=t[1];let o;t[2]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("img",{src:"/home/bg-bottom-right.svg",alt:"",className:"absolute bottom-0 right-0 h-auto select-none opacity-80 dark:hidden",style:{width:Te}}),t[2]=o):o=t[2];let i;return t[3]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsxs("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 overflow-hidden",children:[e,s,o,n.jsx("img",{src:"/home/bg-bottom-right-dark.svg",alt:"",className:"absolute bottom-0 right-0 hidden h-auto select-none opacity-80 dark:block",style:{width:Te}})]}),t[3]=i):i=t[3],i}function ke(){const t=k.c(33),{data:e}=rt.useSession(),{org:s}=J(),o=ge(),i=xs(),{selectedVirtualMcp:r}=Nt();let a;t[0]!==s.id?(a=dt(s.id),t[0]=s.id,t[1]=a):a=t[1];const l=r??a;let m;t[2]!==s.slug?(m=Ht(s.slug),t[2]=s.slug,t[3]=m):m=t[3],se(m);let c;t[4]!==s.id||t[5]!==s.slug?(c={connectionId:mt,orgId:s.id,orgSlug:s.slug},t[4]=s.id,t[5]=s.slug,t[6]=c):c=t[6];const u=ae(c);let f;t[7]!==s.id||t[8]!==s.slug?(f=ps(s.slug,s.id),t[7]=s.id,t[8]=s.slug,t[9]=f):f=t[9];let p;t[10]!==s.id||t[11]!==s.slug?(p=Lt(s.slug,s.id),t[10]=s.id,t[11]=s.slug,t[12]=p):p=t[12];let h;t[13]!==l.id||t[14]!==s.id||t[15]!==u?(h=pt(s.id,l.id,u),t[13]=l.id,t[14]=s.id,t[15]=u,t[16]=h):h=t[16];let x;t[17]!==f||t[18]!==p||t[19]!==h?(x={queries:[f,p,h]},t[17]=f,t[18]=p,t[19]=h,t[20]=x):x=t[20],ys(x);const y=hs(),b=ht(l.id),{hasDecoKey:v,isZeroBalance:N,isInitialFreeCredit:j,balanceDollars:g,hasOnlyDecoProvider:w}=Mt(),{hasVisibleTiles:S}=Mn(s.slug),C=zt(b?.metadata);if(y.length===0&&!(C&&Ot(i))){let L;return t[21]===Symbol.for("react.memo_cache_sentinel")?(L=n.jsx("div",{className:"flex-1 overflow-y-auto",children:n.jsx("div",{className:"min-h-full flex items-center justify-center px-4 py-10",children:n.jsx(wt,{})})}),t[21]=L):L=t[21],L}let I;t[22]!==e?.user?.name?(I=e?.user?.name?.split(" ")[0]||"there",t[22]=e?.user?.name,t[23]=I):I=t[23];const T=I,P=v&&j&&g!=null,M=v&&N&&w;let z;t[24]!==g||t[25]!==P||t[26]!==M?(z=P?n.jsx(oe.CreditsEyebrow,{balanceDollars:g}):M?n.jsx(oe.NoCreditsEyebrow,{}):null,t[24]=g,t[25]=P,t[26]=M,t[27]=z):z=t[27];const B=z;let O;return t[28]!==B||t[29]!==S||t[30]!==o||t[31]!==T?(O=n.jsx(tn,{children:o?n.jsx(zn,{eyebrow:B,userName:T}):n.jsx(On,{eyebrow:B,userName:T,hasVisibleTiles:S})}),t[28]=B,t[29]=S,t[30]=o,t[31]=T,t[32]=O):O=t[32],O}function zn(t){const e=k.c(12),{eyebrow:s,userName:o}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(tt,{}),e[0]=i):i=e[0];let r;e[1]!==s?(r=s&&n.jsx("div",{className:"mb-4",children:s}),e[1]=s,e[2]=r):r=e[2];let a;e[3]!==o?(a=n.jsxs("p",{className:"text-3xl font-medium text-foreground text-center max-w-[280px]",children:["What's on your mind, ",o,"?"]}),e[3]=o,e[4]=a):a=e[4];let d;e[5]!==r||e[6]!==a?(d=n.jsxs("div",{className:"relative flex flex-col items-center justify-center w-full pt-28 pb-8 px-4",children:[r,a]}),e[5]=r,e[6]=a,e[7]=d):d=e[7];let l;e[8]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx("div",{className:"relative w-full flex flex-col gap-4 pb-8 px-4",children:n.jsx(oe.Input,{showConnectionsBanner:!0})}),e[8]=l):l=e[8];let m;e[9]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx("div",{className:"relative w-full px-4 pb-8",children:n.jsx(et,{isEditMode:!1})}),e[9]=m):m=e[9];let c;return e[10]!==d?(c=n.jsxs("div",{className:"flex-1 relative flex flex-col items-center overflow-y-auto",children:[i,d,l,m]}),e[10]=d,e[11]=c):c=e[11],c}function On(t){const e=k.c(32),{eyebrow:s,userName:o,hasVisibleTiles:i}=t,{isEditMode:r,enter:a,save:d,cancel:l,hasChanges:m}=Ze(),[c,u]=$.useState(!1);let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=()=>u(!0),e[0]=f):f=e[0];let p;e[1]!==l||e[2]!==a||e[3]!==m||e[4]!==r||e[5]!==d?(p=n.jsx(gs.Right,{children:n.jsx(Ln,{isEditMode:r,hasChanges:m,onEnter:a,onSave:d,onCancel:l,onAddTile:f})}),e[1]=l,e[2]=a,e[3]=m,e[4]=r,e[5]=d,e[6]=p):p=e[6];let h;e[7]!==c?(h=n.jsx(js,{open:c,onOpenChange:u}),e[7]=c,e[8]=h):h=e[8];let x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx(tt,{}),e[9]=x):x=e[9];const y=i||r?"pt-32":"flex-1 justify-center";let b;e[10]!==y?(b=Q("relative flex flex-col items-center px-10 pb-4",y),e[10]=y,e[11]=b):b=e[11];let v;e[12]!==s?(v=s&&n.jsx("div",{className:"mb-4",children:s}),e[12]=s,e[13]=v):v=e[13];let N;e[14]!==o?(N=n.jsxs("p",{className:"text-3xl font-medium text-foreground",children:["What's on your mind, ",o,"?"]}),e[14]=o,e[15]=N):N=e[15];let j;e[16]!==v||e[17]!==N?(j=n.jsxs("div",{className:"text-center mb-10",children:[v,N]}),e[16]=v,e[17]=N,e[18]=j):j=e[18];let g;e[19]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsxs("div",{className:"relative w-full",children:[n.jsx(Dn,{}),n.jsx(oe.Input,{showConnectionsBanner:!0})]}),e[19]=g):g=e[19];let w;e[20]!==j?(w=n.jsxs("div",{className:"flex flex-col items-center w-full max-w-[672px]",children:[j,g]}),e[20]=j,e[21]=w):w=e[21];let S;e[22]!==r?(S=n.jsx("div",{className:"relative w-full mt-10 mx-auto max-w-[1280px] px-2 pb-16",children:n.jsx(et,{isEditMode:r})}),e[22]=r,e[23]=S):S=e[23];let C;e[24]!==w||e[25]!==S||e[26]!==b?(C=n.jsxs("div",{className:"flex-1 relative flex flex-col min-h-0",children:[x,n.jsx("div",{className:"flex-1 relative flex flex-col overflow-y-auto",children:n.jsxs("div",{className:b,children:[w,S]})})]}),e[24]=w,e[25]=S,e[26]=b,e[27]=C):C=e[27];let _;return e[28]!==C||e[29]!==p||e[30]!==h?(_=n.jsxs(n.Fragment,{children:[p,h,C]}),e[28]=C,e[29]=p,e[30]=h,e[31]=_):_=e[31],_}function Ln(t){const e=k.c(17),{isEditMode:s,hasChanges:o,onEnter:i,onSave:r,onCancel:a,onAddTile:d}=t;if(s){let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(ye,{size:14}),e[0]=c):c=e[0];let u;e[1]!==d?(u=n.jsxs("button",{type:"button",onClick:d,className:"flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground transition-colors",title:"Add a tile from any agent",children:[c,"Add tile"]}),e[1]=d,e[2]=u):u=e[2];let f;e[3]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx($e,{size:14}),e[3]=f):f=e[3];let p;e[4]!==a?(p=n.jsxs(Y,{size:"sm",variant:"ghost",onClick:a,className:"gap-1.5 h-7 text-xs",children:[f,"Cancel"]}),e[4]=a,e[5]=p):p=e[5];const h=!o;let x;e[6]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx(xt,{size:14}),e[6]=x):x=e[6];let y;e[7]!==r||e[8]!==h?(y=n.jsxs(Y,{size:"sm",onClick:r,disabled:h,className:"gap-1.5 h-7 text-xs",children:[x,"Save"]}),e[7]=r,e[8]=h,e[9]=y):y=e[9];let b;return e[10]!==u||e[11]!==p||e[12]!==y?(b=n.jsxs(n.Fragment,{children:[u,p,y]}),e[10]=u,e[11]=p,e[12]=y,e[13]=b):b=e[13],b}let l;e[14]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(vt,{size:14}),e[14]=l):l=e[14];let m;return e[15]!==i?(m=n.jsxs("button",{type:"button",onClick:i,className:"flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground transition-colors",title:"Customize your home",children:[l,"Customize"]}),e[15]=i,e[16]=m):m=e[16],m}function Dn(){const t=k.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("img",{src:"/home/capybara.png",alt:"","aria-hidden":!0,className:"pointer-events-none absolute -top-16 right-6 z-20 h-20 w-auto select-none"}),t[0]=e):e=t[0],e}function Vo(){const t=k.c(2);if(ge()){let o;return t[0]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("div",{className:"flex-1 min-h-0 flex flex-col bg-background overflow-hidden",children:n.jsx(ke,{})}),t[0]=o):o=t[0],o}let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx("div",{className:"flex-1 min-h-0 pb-1 pr-1 pl-0 pt-0",children:n.jsx("div",{className:"h-full p-0.5 pt-0.25",children:n.jsx("div",{className:"flex flex-col h-full bg-background overflow-hidden card-shadow rounded-[0.75rem]",children:n.jsx(ke,{})})})}),t[1]=s):s=t[1],s}export{Vo as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{bg as st,bh as q,bi as De,C as c,ak as A,aF as Y,bj as Le,aC as _,bk as pe,bl as G,aD as ee,bm as le,z as p,bn as He,bo as Ve,bp as nt,bq as it,br as Ke,bs as ot,bt as at,bu as lt,bv as Ye,bw as ct,b6 as Z,bx as ut,aE as K,by as dt,c as U,r as F,l as _e,j as o,aP as Qe,w as Ue,a as ft,t as xe,B as Ce,i as $e,b as mt,E as ht,aa as pt}from"./index-20lo5teZ.js";import{P as ce}from"./index-BoBbtnrJ.js";import{E as Xe}from"./empty-state-YJ1DU6Lk.js";import{A as gt,f as bt,h as yt,n as xt,j as vt,k as wt,i as St,u as jt}from"./use-mcp-client-CxXf5rsq.js";import{c as _t}from"./use-mcp-tools-CLWDDSx5.js";import{c as Ct}from"./ZoomOut-C-l0YUGT.js";import{i as Et}from"./Key01-bDEyn58I.js";import{b as Nt,u as Ot,a as Tt}from"./use-connection-D-7QpVUJ.js";import{U as ue,a as Ne,e as We}from"./auth-Ci2ZRRcb.js";import{i as kt,c as It,d as Pt,e as Mt}from"./extract-connection-data-DlaPzbl9.js";import{u as At}from"./use-registry-connections-jcbA10JV.js";import{b as Rt}from"./use-organization-settings-CTH2EptF.js";import{s as Lt}from"./Plus-BEdvqzrP.js";import{d as Ht,b as Ut,c as $t,S as Ft,a as Bt}from"./select-C0AEr1SL.js";import{F as Dt,v as Vt}from"./Form-gFXvv2WG.js";import"./index-CK4mkEbA.js";import{A as et}from"./agent-icon-Bk1Ofbdo.js";import{I as Wt}from"./input-D2VJ6ahm.js";import{a as qt,b as zt,P as Gt}from"./popover-CHlLC07g.js";import{u as Jt,a as Zt,T as Kt,c as Yt,b as Qt}from"./tooltip-B_mKOQvv.js";import{u as Xt}from"./use-virtual-mcp-CwSMwdwq.js";import{i as er}from"./ChevronUp-BDbnz61t.js";import{i as tr}from"./SearchMd-DK3hZUVF.js";import{a as rr}from"./Users03-NRaUurHt.js";import{u as sr}from"./use-create-virtual-mcp-kRix1VSu.js";function nr(){const t=new gt({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0,code:{optimize:!1}});return st(t),t}class ir{#e=nr();#t=new Map;#r=new WeakMap;getValidator(e){const r=this.#r.get(e);if(r)return r;let s;const n=i=>{if(!s){const a=or(e);let l=this.#t.get(a);l||(l=this.#e.compile(e),this.#t.set(a,l)),s=l}return s(i)?{valid:!0,data:i,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this.#e.errorsText(s.errors)}};return this.#r.set(e,n),n}}function or(t){return JSON.stringify(t,(e,r)=>r&&typeof r=="object"&&!Array.isArray(r)?Object.fromEntries(Object.keys(r).sort().map(s=>[s,r[s]])):r)}const ar=new ir;var lr=class{apply(t,e){if(!e.type)return;const r=Array.isArray(e.type)?e.type:[e.type],s=new Set(r);if(s.has("string")||(t.string=!1),!s.has("number")&&!s.has("integer")&&(t.number=!1),s.has("boolean")||(t.boolean=!1),s.has("null")||(t.null=!1),s.has("array")||(t.array=!1),s.has("object")||(t.object=!1),s.has("integer")&&t.number!==!1){const n=t.number||A();n instanceof le&&(t.number=n.int())}}},cr=class{apply(t,e){if(e.const===void 0)return;const r=e.const;t.string=!1,t.number=!1,t.boolean=!1,t.null=!1,t.array=!1,t.object=!1,typeof r=="string"?t.string=G(r):typeof r=="number"?t.number=G(r):typeof r=="boolean"?t.boolean=G(r):r===null?t.null=Le():Array.isArray(r)?t.array=void 0:typeof r=="object"&&(t.object=void 0)}},ur=class{apply(t,e){if(!e.enum)return;if(e.enum.length===0){e.type||(t.string=!1,t.number=!1,t.boolean=!1,t.null=!1,t.array=!1,t.object=!1);return}const r={string:e.enum.filter(s=>typeof s=="string"),number:e.enum.filter(s=>typeof s=="number"),boolean:e.enum.filter(s=>typeof s=="boolean"),null:e.enum.filter(s=>s===null),array:e.enum.filter(s=>Array.isArray(s)),object:e.enum.filter(s=>typeof s=="object"&&s!==null&&!Array.isArray(s))};t.string=this.createTypeSchema(r.string,"string"),t.number=this.createTypeSchema(r.number,"number"),t.boolean=this.createTypeSchema(r.boolean,"boolean"),t.null=r.null.length>0?Le():!1,t.array=r.array.length>0?void 0:!1,t.object=r.object.length>0?void 0:!1}createTypeSchema(t,e){if(t.length===0)return!1;if(t.length===1)return G(t[0]);if(e==="string")return ee(t);if(e==="number"){const[r,s,...n]=t;return pe([G(r),G(s),...n.map(i=>G(i))])}return e==="boolean"?pe([G(!0),G(!1)]):!1}},dr=class{apply(t,e){const r=e;if(r.type==="string"&&r.format==="binary"&&r.contentEncoding==="binary"){let s=lt();r.minLength!==void 0&&(s=s.min(r.minLength)),r.maxLength!==void 0&&(s=s.max(r.maxLength)),r.contentMediaType!==void 0&&(s=s.mime(r.contentMediaType)),t.file=s,t.string=!1}}},fr=class{apply(t,e){const r=e;e.type===void 0&&(r.minLength!==void 0||r.maxLength!==void 0||r.pattern!==void 0)&&t.string===void 0&&(t.string=c())}},mr=class{apply(t,e){const r=e;if(r.minLength!==void 0&&t.string!==!1){const s=t.string||c();s instanceof He&&(t.string=s.refine(n=>Array.from(n).length>=r.minLength,{message:`String must be at least ${r.minLength} characters long`}))}}},hr=class{apply(t,e){const r=e;if(r.maxLength!==void 0&&t.string!==!1){const s=t.string||c();s instanceof He&&(t.string=s.refine(n=>Array.from(n).length<=r.maxLength,{message:`String must be at most ${r.maxLength} characters long`}))}}},pr=class{apply(t,e){const r=e;if(r.pattern&&t.string!==!1){const s=t.string||c();if(s instanceof He){const n=new RegExp(r.pattern);t.string=s.regex(n)}}}},gr=class{apply(t,e){const r=e;if(r.minimum!==void 0&&t.number!==!1){const s=t.number||A();s instanceof le&&(t.number=s.min(r.minimum))}}},br=class{apply(t,e){const r=e;if(r.maximum!==void 0&&t.number!==!1){const s=t.number||A();s instanceof le&&(t.number=s.max(r.maximum))}}},yr=class{apply(t,e){const r=e;if(r.exclusiveMinimum!==void 0&&t.number!==!1){const s=t.number||A();s instanceof le&&(typeof r.exclusiveMinimum=="number"?t.number=s.gt(r.exclusiveMinimum):t.number=!1)}}},xr=class{apply(t,e){const r=e;if(r.exclusiveMaximum!==void 0&&t.number!==!1){const s=t.number||A();s instanceof le&&(typeof r.exclusiveMaximum=="number"?t.number=s.lt(r.exclusiveMaximum):t.number=!1)}}},vr=class{apply(t,e){const r=e;if(r.multipleOf!==void 0&&t.number!==!1){const s=t.number||A();s instanceof le&&(t.number=s.refine(n=>{if(r.multipleOf===0)return!1;const i=n/r.multipleOf,a=Math.round(i),l=Math.min(Math.abs(n)*Number.EPSILON*10,Math.abs(r.multipleOf)*Number.EPSILON*10);return Math.abs(i-a)<=l/Math.abs(r.multipleOf)},{message:`Must be a multiple of ${r.multipleOf}`}))}}},wr=class{apply(t,e){const r=e;e.type===void 0&&(r.minItems!==void 0||r.maxItems!==void 0||r.items!==void 0||r.prefixItems!==void 0)&&t.array===void 0&&(t.array=_(q()))}},Sr=class{apply(t,e){const r=e;r.minItems!==void 0&&t.array!==!1&&(t.array=(t.array||_(q())).min(r.minItems))}},jr=class{apply(t,e){const r=e;r.maxItems!==void 0&&t.array!==!1&&(t.array=(t.array||_(q())).max(r.maxItems))}},_r=class{apply(t,e){const r=e;if(t.array!==!1)if(Array.isArray(r.items))t.array=t.array||_(q());else if(r.items&&typeof r.items!="boolean"&&!r.prefixItems){const s=$(r.items);let n=_(s);if(t.array&&t.array instanceof nt){const i=t.array._def;i.checks&&i.checks.forEach(a=>{if(a._zod&&a._zod.def){const l=a._zod.def;l.check==="min_length"&&l.minimum!==void 0?n=n.min(l.minimum):l.check==="max_length"&&l.maximum!==void 0&&(n=n.max(l.maximum))}})}t.array=n}else typeof r.items=="boolean"&&r.items===!1?r.prefixItems?t.array=t.array||_(q()):t.array=_(q()).max(0):typeof r.items=="boolean"&&r.items===!0?t.array=t.array||_(q()):r.prefixItems&&(t.array=t.array||_(q()))}},Cr=class{apply(t,e){if(e.type!=="array")return;const r=e;if(!Array.isArray(r.items)||t.array===!1)return;const s=r.items.map(i=>$(i));let n;s.length===0?n=Ve([]):n=Ve(s),r.minItems!==void 0&&r.minItems>s.length&&(n=!1),r.maxItems!==void 0&&r.maxItems<s.length&&(n=!1),t.tuple=n,t.array=!1}},Er=class{apply(t,e){const r=e;t.object!==!1&&(r.properties||r.required||r.additionalProperties!==void 0)&&(t.object=t.object||p({}).passthrough())}},Nr=class{apply(t,e){const r=e;e.type===void 0&&(r.maxProperties!==void 0||r.minProperties!==void 0)&&t.object===void 0&&(t.object=p({}).passthrough())}},Or=class{apply(t,e){const r=e;if(r.maxProperties!==void 0&&t.object!==!1){const s=t.object||p({}).passthrough();t.object=s.refine(n=>Object.keys(n).length<=r.maxProperties,{message:`Object must have at most ${r.maxProperties} properties`})}}},Tr=class{apply(t,e){const r=e;if(r.minProperties!==void 0&&t.object!==!1){const s=t.object||p({}).passthrough();t.object=s.refine(n=>Object.keys(n).length>=r.minProperties,{message:`Object must have at least ${r.minProperties} properties`})}}};function ge(t,e){if(t===e)return!0;if(t==null||e==null)return t===e;if(typeof t!=typeof e)return!1;if(Array.isArray(t)&&Array.isArray(e))return t.length!==e.length?!1:t.every((r,s)=>ge(r,e[s]));if(typeof t=="object"&&typeof e=="object"){const r=Object.keys(t),s=Object.keys(e);return r.length!==s.length?!1:r.every(n=>s.includes(n)&&ge(t[n],e[n]))}return!1}function kr(){return t=>{if(!Array.isArray(t))return!0;const e=[];return t.every(r=>e.some(n=>ge(r,n))?!1:(e.push(r),!0))}}function Se(t,e){return t.safeParse(e).success}var Ir=class{apply(t,e){if(!e.not)return t;const r=$(e.not);return t.refine(s=>!Se(r,s),{message:"Value must not match the 'not' schema"})}},Pr=class{apply(t,e){return e.uniqueItems!==!0?t:t.refine(kr(),{message:"Array items must be unique"})}},Mr=class{apply(t,e){return!e.allOf||e.allOf.length===0?t:e.allOf.map(s=>$(s)).reduce((s,n)=>Ke(s,n),t)}},Ar=class{apply(t,e){if(!e.anyOf||e.anyOf.length===0)return t;const r=e.anyOf.length===1?$(e.anyOf[0]):pe([$(e.anyOf[0]),$(e.anyOf[1]),...e.anyOf.slice(2).map(s=>$(s))]);return Ke(t,r)}},Rr=class{apply(t,e){if(!e.oneOf||e.oneOf.length===0)return t;const r=e.oneOf.map(s=>$(s));return t.refine(s=>{let n=0;for(const i of r)if(i.safeParse(s).success&&(n++,n>1))return!1;return n===1},{message:"Value must match exactly one of the oneOf schemas"})}},Lr=class{apply(t,e){const r=e;if(r.prefixItems&&Array.isArray(r.prefixItems)){const n=r.prefixItems.map(i=>$(i));return t.refine(i=>{if(!Array.isArray(i))return!0;for(let a=0;a<Math.min(i.length,n.length);a++)if(!Se(n[a],i[a]))return!1;if(i.length>n.length){if(typeof r.items=="boolean"&&r.items===!1)return!1;if(r.items&&typeof r.items=="object"&&!Array.isArray(r.items)){const a=$(r.items);for(let l=n.length;l<i.length;l++)if(!Se(a,i[l]))return!1}}return!0},{message:"Array does not match prefixItems schema"})}return t}},Hr=class{apply(t,e){const r=e;if(!r.properties&&!r.required&&r.additionalProperties!==!1)return t;if(t instanceof ot||t instanceof at){const s={};if(r.properties)for(const[n,i]of Object.entries(r.properties))i!==void 0&&(s[n]=$(i));if(r.required&&Array.isArray(r.required)){const n=new Set(r.required);for(const i of Object.keys(s))n.has(i)||(s[i]=s[i].optional())}else for(const n of Object.keys(s))s[n]=s[n].optional();return r.additionalProperties===!1?p(s):p(s).passthrough()}return t.refine(s=>{if(typeof s!="object"||s===null||Array.isArray(s))return!0;if(r.properties){for(const[n,i]of Object.entries(r.properties))if(i!==void 0&&Object.getOwnPropertyDescriptor(s,n)!==void 0&&!$(i).safeParse(s[n]).success)return!1}if(r.required&&Array.isArray(r.required)){for(const n of r.required)if(!(Object.getOwnPropertyDescriptor(s,n)!==void 0))return!1}if(r.additionalProperties===!1&&r.properties){const n=new Set(Object.keys(r.properties));for(const i in s)if(!n.has(i))return!1}return!0},{message:"Object constraints validation failed"})}},Ur=class{apply(t,e){if(!e.enum||e.enum.length===0)return t;const r=e.enum.filter(s=>Array.isArray(s)||typeof s=="object"&&s!==null);return r.length===0?t:t.refine(s=>typeof s!="object"||s===null?!0:r.some(n=>ge(s,n)),{message:"Value must match one of the enum values"})}},$r=class{apply(t,e){if(e.const===void 0)return t;const r=e.const;return typeof r!="object"||r===null?t:t.refine(s=>ge(s,r),{message:"Value must equal the const value"})}},Fr=class{apply(t,e){return e.description&&(t=t.describe(e.description)),t}},Br=class{apply(t,e){var r;const s=e;return!((r=s.required)!=null&&r.includes("__proto__"))||e.type!==void 0?t:q().refine(n=>this.validateRequired(n,s.required),{message:"Missing required properties"})}validateRequired(t,e){return typeof t!="object"||t===null||Array.isArray(t)?!0:e.every(r=>Object.prototype.hasOwnProperty.call(t,r))}},Dr=class{apply(t,e){var r;const s=e;if(s.contains===void 0)return t;const n=$(s.contains),i=(r=s.minContains)!=null?r:1,a=s.maxContains;return t.refine(l=>{if(!Array.isArray(l))return!0;let d=0;for(const u of l)Se(n,u)&&d++;return!(d<i||a!==void 0&&d>a)},{message:"Array must contain required items matching the schema"})}},Vr=class{apply(t,e){const{default:r}=e;return r===void 0||!t.safeParse(r).success?t:t.default(r)}},Wr=[new cr,new ur,new lr,new dr,new fr,new wr,new Nr,new mr,new hr,new pr,new gr,new br,new yr,new xr,new vr,new Cr,new Sr,new jr,new _r,new Or,new Tr,new Er],qr=[new Br,new Ur,new $r,new Mr,new Ar,new Rr,new Lr,new Hr,new Dr,new Ir,new Pr,new Vr,new Fr];function $(t){if(typeof t=="boolean")return t?q():De();const e={};for(const n of Wr)n.apply(e,t);const r=[];if(e.string!==!1&&r.push(e.string||c()),e.number!==!1&&r.push(e.number||A()),e.boolean!==!1&&r.push(e.boolean||Y()),e.null!==!1&&r.push(e.null||Le()),e.array!==!1&&r.push(e.array||_(q())),e.tuple!==!1&&e.tuple!==void 0&&r.push(e.tuple),e.object!==!1)if(e.object)r.push(e.object);else{const n=it(i=>typeof i=="object"&&i!==null&&!Array.isArray(i),"Must be an object, not an array");r.push(n)}e.file!==!1&&e.file!==void 0&&r.push(e.file);let s;r.length===0?s=De():r.length===1?s=r[0]:Object.keys(t).some(i=>i!=="$schema"&&i!=="title"&&i!=="description")?s=pe(r):s=q();for(const n of qr)s=n.apply(s,t);return s}class qe extends Event{constructor(e,r){var s,n;super(e),this.code=(s=r?.code)!=null?s:void 0,this.message=(n=r?.message)!=null?n:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,r,s){return s(ze(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(ze(this),r)}}function zr(t){const e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function Oe(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(Oe).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${Oe(t.cause)}`:t.message:`${t}`}function ze(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}var tt=t=>{throw TypeError(t)},Fe=(t,e,r)=>e.has(t)||tt("Cannot "+r),v=(t,e,r)=>(Fe(t,e,"read from private field"),r?r.call(t):e.get(t)),H=(t,e,r)=>e.has(t)?tt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),T=(t,e,r,s)=>(Fe(t,e,"write to private field"),e.set(t,r),r),J=(t,e,r)=>(Fe(t,e,"access private method"),r),D,X,se,ve,je,me,oe,he,Q,ne,ae,ie,de,z,Te,ke,Ie,Ge,Pe,Me,fe,Ae,Re;class we extends EventTarget{constructor(e,r){var s,n;super(),H(this,z),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,H(this,D),H(this,X),H(this,se),H(this,ve),H(this,je),H(this,me),H(this,oe),H(this,he,null),H(this,Q),H(this,ne),H(this,ae,null),H(this,ie,null),H(this,de,null),H(this,ke,async i=>{var a;v(this,ne).reset();const{body:l,redirected:d,status:u,headers:m}=i;if(u===204){J(this,z,fe).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(d?T(this,se,new URL(i.url)):T(this,se,void 0),u!==200){J(this,z,fe).call(this,`Non-200 status code (${u})`,u);return}if(!(m.get("content-type")||"").startsWith("text/event-stream")){J(this,z,fe).call(this,'Invalid content type, expected "text/event-stream"',u);return}if(v(this,D)===this.CLOSED)return;T(this,D,this.OPEN);const f=new Event("open");if((a=v(this,de))==null||a.call(this,f),this.dispatchEvent(f),typeof l!="object"||!l||!("getReader"in l)){J(this,z,fe).call(this,"Invalid response body, expected a web ReadableStream",u),this.close();return}const h=new TextDecoder,x=l.getReader();let y=!0;do{const{done:b,value:w}=await x.read();w&&v(this,ne).feed(h.decode(w,{stream:!b})),b&&(y=!1,v(this,ne).reset(),J(this,z,Ae).call(this))}while(y)}),H(this,Ie,i=>{T(this,Q,void 0),!(i.name==="AbortError"||i.type==="aborted")&&J(this,z,Ae).call(this,Oe(i))}),H(this,Pe,i=>{typeof i.id=="string"&&T(this,he,i.id);const a=new MessageEvent(i.event||"message",{data:i.data,origin:v(this,se)?v(this,se).origin:v(this,X).origin,lastEventId:i.id||""});v(this,ie)&&(!i.event||i.event==="message")&&v(this,ie).call(this,a),this.dispatchEvent(a)}),H(this,Me,i=>{T(this,me,i)}),H(this,Re,()=>{T(this,oe,void 0),v(this,D)===this.CONNECTING&&J(this,z,Te).call(this)});try{if(e instanceof URL)T(this,X,e);else if(typeof e=="string")T(this,X,new URL(e,Gr()));else throw new Error("Invalid URL")}catch{throw zr("An invalid or illegal string was specified")}T(this,ne,bt({onEvent:v(this,Pe),onRetry:v(this,Me)})),T(this,D,this.CONNECTING),T(this,me,3e3),T(this,je,(s=r?.fetch)!=null?s:globalThis.fetch),T(this,ve,(n=r?.withCredentials)!=null?n:!1),J(this,z,Te).call(this)}get readyState(){return v(this,D)}get url(){return v(this,X).href}get withCredentials(){return v(this,ve)}get onerror(){return v(this,ae)}set onerror(e){T(this,ae,e)}get onmessage(){return v(this,ie)}set onmessage(e){T(this,ie,e)}get onopen(){return v(this,de)}set onopen(e){T(this,de,e)}addEventListener(e,r,s){const n=r;super.addEventListener(e,n,s)}removeEventListener(e,r,s){const n=r;super.removeEventListener(e,n,s)}close(){v(this,oe)&&clearTimeout(v(this,oe)),v(this,D)!==this.CLOSED&&(v(this,Q)&&v(this,Q).abort(),T(this,D,this.CLOSED),T(this,Q,void 0))}}D=new WeakMap,X=new WeakMap,se=new WeakMap,ve=new WeakMap,je=new WeakMap,me=new WeakMap,oe=new WeakMap,he=new WeakMap,Q=new WeakMap,ne=new WeakMap,ae=new WeakMap,ie=new WeakMap,de=new WeakMap,z=new WeakSet,Te=function(){T(this,D,this.CONNECTING),T(this,Q,new AbortController),v(this,je)(v(this,X),J(this,z,Ge).call(this)).then(v(this,ke)).catch(v(this,Ie))},ke=new WeakMap,Ie=new WeakMap,Ge=function(){var t;const e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...v(this,he)?{"Last-Event-ID":v(this,he)}:void 0},cache:"no-store",signal:(t=v(this,Q))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},Pe=new WeakMap,Me=new WeakMap,fe=function(t,e){var r;v(this,D)!==this.CLOSED&&T(this,D,this.CLOSED);const s=new qe("error",{code:e,message:t});(r=v(this,ae))==null||r.call(this,s),this.dispatchEvent(s)},Ae=function(t,e){var r;if(v(this,D)===this.CLOSED)return;T(this,D,this.CONNECTING);const s=new qe("error",{code:e,message:t});(r=v(this,ae))==null||r.call(this,s),this.dispatchEvent(s),T(this,oe,setTimeout(v(this,Re),v(this,me)))},Re=new WeakMap,we.CONNECTING=0,we.OPEN=1,we.CLOSED=2;function Gr(){const t="document"in globalThis?globalThis.document:void 0;return t&&typeof t=="object"&&"baseURI"in t&&typeof t.baseURI=="string"?t.baseURI:void 0}class Jr extends Error{constructor(e,r,s){super(`SSE error: ${r}`),this.code=e,this.event=s}}class Zr{constructor(e,r){this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=r?.eventSourceInit,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._fetchWithInit=yt(r?.fetch,r?.requestInit)}async _authThenStart(){if(!this._authProvider)throw new ue("No auth provider");let e;try{e=await Ne(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(r){throw this.onerror?.(r),r}if(e!=="AUTHORIZED")throw new ue;return await this._startOrAuth()}async _commonHeaders(){const e={};if(this._authProvider){const s=await this._authProvider.tokens();s&&(e.Authorization=`Bearer ${s.access_token}`)}this._protocolVersion&&(e["mcp-protocol-version"]=this._protocolVersion);const r=xt(this._requestInit?.headers);return new Headers({...e,...r})}_startOrAuth(){const e=this?._eventSourceInit?.fetch??this._fetch??fetch;return new Promise((r,s)=>{this._eventSource=new we(this._url.href,{...this._eventSourceInit,fetch:async(n,i)=>{const a=await this._commonHeaders();a.set("Accept","text/event-stream");const l=await e(n,{...i,headers:a});if(l.status===401&&l.headers.has("www-authenticate")){const{resourceMetadataUrl:d,scope:u}=We(l);this._resourceMetadataUrl=d,this._scope=u}return l}}),this._abortController=new AbortController,this._eventSource.onerror=n=>{if(n.code===401&&this._authProvider){this._authThenStart().then(r,s);return}const i=new Jr(n.code,n.message,n);s(i),this.onerror?.(i)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",n=>{const i=n;try{if(this._endpoint=new URL(i.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(a){s(a),this.onerror?.(a),this.close();return}r()}),this._eventSource.onmessage=n=>{const i=n;let a;try{a=Ye.parse(JSON.parse(i.data))}catch(l){this.onerror?.(l);return}this.onmessage?.(a)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(e){if(!this._authProvider)throw new ue("No auth provider");if(await Ne(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new ue("Failed to authorize")}async close(){this._abortController?.abort(),this._eventSource?.close(),this.onclose?.()}async send(e){if(!this._endpoint)throw new Error("Not connected");try{const r=await this._commonHeaders();r.set("content-type","application/json");const s={...this._requestInit,method:"POST",headers:r,body:JSON.stringify(e),signal:this._abortController?.signal},n=await(this._fetch??fetch)(this._endpoint,s);if(!n.ok){const i=await n.text().catch(()=>null);if(n.status===401&&this._authProvider){const{resourceMetadataUrl:a,scope:l}=We(n);if(this._resourceMetadataUrl=a,this._scope=l,await Ne(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new ue;return this.send(e)}throw new Error(`Error POSTing to endpoint (HTTP ${n.status}): ${i}`)}await n.body?.cancel()}catch(r){throw this.onerror?.(r),r}}setProtocolVersion(e){this._protocolVersion=e}}const Kr="mcp";class Yr{constructor(e){this._url=e}start(){if(this._socket)throw new Error("WebSocketClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((e,r)=>{this._socket=new WebSocket(this._url,Kr),this._socket.onerror=s=>{const n="error"in s?s.error:new Error(`WebSocket error: ${JSON.stringify(s)}`);r(n),this.onerror?.(n)},this._socket.onopen=()=>{e()},this._socket.onclose=()=>{this.onclose?.()},this._socket.onmessage=s=>{let n;try{n=Ye.parse(JSON.parse(s.data))}catch(i){this.onerror?.(i);return}this.onmessage?.(n)}})}async close(){this._socket?.close()}send(e){return new Promise((r,s)=>{if(!this._socket){s(new Error("Not connected"));return}this._socket?.send(JSON.stringify(e)),r()})}}class Qr extends vt{constructor(e,r){super(e,r)}send(e,r){const s=Xr(e);return s?.type==="emit"?(this.onmessage?.(s.message),Promise.resolve()):s?.type==="suppress"?Promise.resolve():super.send(e,r)}}function Xr(t){const e=t;if(!e||typeof e!="object"||!("method"in e))return null;switch(e.method){case"initialize":{const r=e?.params?.protocolVersion;return r?{type:"emit",message:{result:{protocolVersion:r,capabilities:{tools:{}},serverInfo:{name:"deco-chat-server",version:"1.0.0"}},jsonrpc:e.jsonrpc??"2.0",id:e.id}}:null}case"notifications/roots/list_changed":case"notifications/initialized":case"notifications/cancelled":case"notifications/progress":return{type:"suppress"};default:return null}}class es extends wt{constructor(e,r){super(e,{jsonSchemaValidator:ar,...r})}async listTools(e,r){return await this.request({method:"tools/list",params:e},ct,r)}}const ts=async(t,e,r)=>{const s=rs(t.connection,e,r);if(!s)throw new Error("Unknown MCP connection type");const n=new es({name:t?.name??"MCP Client",version:"1.0.0"});return await n.connect(s),{client:n}},rs=(t,e,r)=>{if(t.type==="Websocket")return new Yr(new URL(t.url));if(t.type!=="SSE"&&t.type!=="HTTP")return null;const n={...t.token?{authorization:`Bearer ${t.token}`}:{},...r??{},..."headers"in t?t.headers||{}:{}};if(t.type==="SSE"){const i={requestInit:{headers:n,signal:e}};return t.token&&(i.eventSourceInit={fetch:(a,l)=>fetch(a,{...l,headers:{...n,Accept:"text/event-stream"},signal:e})}),new Zr(new URL(t.url),i)}return new Qr(new URL(t.url),{requestInit:{headers:n,signal:e,credentials:"include"}})},Je=t=>{try{return JSON.parse(t)}catch{return t}},ye=new Map,Ze=(t,e)=>({...t,id:t.name,inputSchema:t.inputSchema?$(t.inputSchema):void 0,outputSchema:t.outputSchema?$(t.outputSchema):void 0,execute:r=>e(r.context,t.name)});function ss(t){const e=r=>"connection"in t?ts({connection:t.connection},void 0,r):t.client;return new Proxy({},{get(r,s){if(s==="toJSON")return null;if(typeof s!="string")throw new Error("Name must be a string");if(s==="listTools")return l;async function n(d,u=s){const m=t?.debugId?.(),f=m?{"x-trace-debug-id":m}:void 0,{client:h}=await e(f),{structuredContent:x,isError:y,content:b}=await h.callTool({name:String(u),arguments:d});if(y){const S=b?.[0]?.text,g=typeof S=="string"?Je(S):null,O=g?.code&&typeof t?.getErrorByStatusCode=="function"?t.getErrorByStatusCode(g.code,g.message,g.traceId):null;throw O||new Error(`Tool ${String(u)} returned an error: ${JSON.stringify(x??b)}`)}if(x!==void 0)return x;const w=b?.[0]?.text;return typeof w=="string"?Je(w):void 0}async function i(){const{client:d}=await e(),{tools:u}=await d.listTools();return u}async function a(){if(!("connection"in t))return i();const d=t.connection,u=JSON.stringify(d);try{return ye.has(u)||ye.set(u,i()),await ye.get(u)}catch(m){console.error("Failed to list tools",m),ye.delete(u);return}}async function l(){return(await a()??[]).map(u=>Ze(u,n))}return n.asTool=async()=>{const u=(await a()??[]).find(m=>m.name===s);if(!u)throw new Error(`Tool ${s} not found`);return Ze(u,n)},n}})}new Proxy({},{get(t,e){return e==="toJSON"?null:e==="forConnection"?r=>ns({connection:r}):global[e]}});function ns(t){return ss(t)}function is(t){return{isImplementedBy:e=>{for(const r of t){const s=typeof r.name=="string"?new RegExp(`^${r.name}$`):r.name,n=e.find(i=>s.test(i.name));if(!(!n&&r.opt)&&!n)return!1}return!0}}}const os=p({id:c().describe("Unique identifier for the entity"),title:c().describe("Human-readable title for the entity"),description:c().nullish().describe("Description of the entity"),created_at:c().datetime(),updated_at:c().datetime(),created_by:c().optional(),updated_by:c().optional()}),as=p({field:_(c()),operator:ee(["eq","gt","gte","lt","lte","in","like","contains"]),value:Z()}),rt=ut(()=>pe([as,p({operator:ee(["and","or","not"]),conditions:_(rt)})])),ls=p({field:_(c()),direction:ee(["asc","desc"]),nulls:ee(["first","last"]).optional()}),cs=p({where:rt.optional().describe("Filter expression"),orderBy:_(ls).optional().describe("Sort expressions"),limit:A().int().min(1).max(1e3).optional().describe("Maximum number of items to return"),offset:A().int().min(0).optional().describe("Number of items to skip")});function us(t){return p({items:_(t).describe("Array of collection items"),totalCount:A().int().min(0).optional().describe("Total number of matching items (if available)"),hasMore:Y().optional().describe("Whether there are more items available")})}const ds=p({id:c().describe("ID of the entity to retrieve")});function fs(t){return p({item:t.nullable().describe("The retrieved item, or null if not found")})}p({id:c().describe("ID of the entity to delete")});function ms(t,e,r){const s=t.toUpperCase();return[{name:`COLLECTION_${s}_LIST`,inputSchema:cs,outputSchema:us(e)},{name:`COLLECTION_${s}_GET`,inputSchema:ds,outputSchema:fs(e)}]}const hs=p({id:c(),name:c(),description:c().optional(),inputSchema:K(c(),Z()),outputSchema:K(c(),Z()).optional()}),ps=os.extend({_meta:p({"io.decocms":p({id:c(),verified:Y(),scopeName:c(),appName:c(),friendlyName:c().nullable().optional(),metadata:K(c(),Z()).nullable().optional(),publishedAt:c().datetime().optional(),updatedAt:c().datetime().optional(),tools:_(hs).nullable().optional().describe("Available tools exposed by this app")}).optional()}).optional(),server:p({$schema:c().optional(),_meta:K(c(),Z()).optional(),name:c().describe("The server name (scope/app)"),title:c().optional().describe("User-friendly title"),description:c().optional().describe("Server description"),icons:_(p({src:c(),mimeType:c().optional(),sizes:_(c()).optional(),theme:ee(["light","dark"]).optional()})).optional(),remotes:_(p({type:ee(["http","stdio","sse"]),url:c().optional(),headers:_(Z()).optional()})).optional(),packages:_(Z()).optional(),repository:p({url:c(),source:c().optional(),subfolder:c().optional()}).optional(),version:c().optional(),websiteUrl:c().optional()})});ms("registry_app",ps);const gs=p({specversion:G("1.0").describe("CloudEvents specification version"),id:c().describe("Unique identifier for this event (UUID recommended)"),source:c().describe("Connection ID of the event publisher"),type:c().describe("Event type (e.g., 'order.created', 'user.signup')"),time:c().datetime().optional().describe("Timestamp of when the event occurred (ISO 8601)"),subject:c().optional().describe("Subject/resource identifier (e.g., order ID, user ID)"),datacontenttype:c().optional().default("application/json").describe("Content type of the data attribute"),dataschema:c().url().optional().describe("URI to the schema for the data attribute"),data:Z().optional().describe("Event payload (any JSON value)")});p({events:_(gs).min(1).describe("Batch of CloudEvents to process")});const bs=p({success:Y().optional().describe("Whether this event was processed successfully"),error:c().optional().describe("Error message for this event"),retryAfter:A().int().positive().optional().describe("Re-deliver this event after this many ms")});p({success:Y().optional().describe("Batch success - applies to events not in results"),error:c().optional().describe("Batch error message - applies to events not in results"),processedCount:A().int().min(0).optional().describe("Number of events successfully processed"),retryAfter:A().int().positive().optional().describe("Batch retryAfter - applies to events not in results"),results:K(c(),bs).optional().describe("Per-event results keyed by event ID")});const ys=p({type:G("string"),enum:_(c()).optional(),description:c().optional()}),xs=p({type:c(),description:c(),paramsSchema:K(c(),ys)});p({});p({triggers:_(xs)});p({type:c(),params:K(c(),c()),enabled:Y(),callbackUrl:dt().optional(),callbackToken:c().min(1).optional()});p({success:Y()});p({prefix:c().optional().describe("Filter objects by prefix (e.g., 'folder/' for folder contents)"),maxKeys:A().optional().default(1e3).describe("Maximum number of keys to return (default: 1000)"),continuationToken:c().optional().describe("Token for pagination from previous response"),delimiter:c().optional().describe("Delimiter for grouping keys (typically '/'). When set, commonPrefixes returns folder paths.")});p({objects:_(p({key:c().describe("Object key/path"),size:A().describe("Object size in bytes"),lastModified:c().describe("Last modified timestamp"),etag:c().describe("Entity tag for the object")})),nextContinuationToken:c().optional().describe("Token for fetching next page of results"),isTruncated:Y().describe("Whether there are more results available"),commonPrefixes:_(c()).optional().describe("Folder paths when delimiter is used (e.g., ['photos/2024/', 'photos/2025/'])")});p({key:c().describe("Object key/path to get metadata for")});p({contentType:c().optional().describe("MIME type of the object"),contentLength:A().describe("Size of the object in bytes"),lastModified:c().describe("Last modified timestamp"),etag:c().describe("Entity tag for the object"),metadata:K(c(),c()).optional().describe("Custom metadata key-value pairs")});p({key:c().describe("Object key/path to generate URL for"),expiresIn:A().optional().describe("URL expiration time in seconds (default: from state config or 3600)")});p({url:c().describe("Presigned URL for downloading the object"),expiresIn:A().describe("Expiration time in seconds that was used")});p({key:c().describe("Object key/path for the upload"),expiresIn:A().optional().describe("URL expiration time in seconds (default: from state config or 3600)"),contentType:c().optional().describe("MIME type for the object being uploaded")});p({url:c().describe("Presigned URL for uploading the object"),expiresIn:A().describe("Expiration time in seconds that was used")});p({key:c().describe("Object key/path to delete")});p({success:Y().describe("Whether the deletion was successful"),key:c().describe("The key that was deleted")});p({keys:_(c()).max(1e3).describe("Array of object keys/paths to delete (max 1000)")});p({deleted:_(c()).describe("Array of successfully deleted keys"),errors:_(p({key:c(),message:c()})).describe("Array of errors for failed deletions")});const vs=p({primary:c().optional().describe("Primary brand color (hex)"),secondary:c().optional().describe("Secondary brand color (hex)"),accent:c().optional().describe("Accent / highlight color (hex)"),background:c().optional().describe("Background color (hex)"),foreground:c().optional().describe("Foreground / text color (hex)")}),ws=p({heading:c().optional().describe("Font family for headings"),body:c().optional().describe("Font family for body text"),code:c().optional().describe("Font family for code / monospace")}),Ss=p({logo:c().optional().describe("Logo URL"),favicon:c().optional().describe("Favicon URL"),ogImage:c().optional().describe("Open Graph image URL")}),js=p({id:c(),name:c().describe("Brand / company name"),domain:c().optional().describe("Company domain (e.g. example.com)"),colors:vs.optional().describe("Semantic color palette"),fonts:ws.optional().describe("Font families by role"),assets:Ss.optional().describe("Visual identity assets"),overview:c().optional().describe("Company overview / description"),tagline:c().optional().describe("Brand tagline"),tone:c().optional().describe("Tone of voice description"),metadata:K(c(),Z()).optional().describe("Extra design tokens and metadata")});p({id:c().optional().describe("Brand ID. Omit to get the default brand.")});p({});p({items:_(js)});const _s={"@deco/llm":"LLMS","@deco/trigger":"TRIGGER","@deco/object-storage":"OBJECT_STORAGE","@deco/brand":"BRAND"};function Cs(t){if(t)return _s[t]}function Cn(t,e){const r=t.tools;if(!r||r.length===0)return!1;const s=r.map(a=>({name:a.name,inputSchema:a.inputSchema})),n=e.map(a=>({name:a.name,inputSchema:a.inputSchema,opt:a.opt}));return is(n).isImplementedBy(s)}const Be=F.createContext(null);function En(t){const e=U.c(3),{children:r}=t,s=F.useContext(Be);if(!s?.tabsEl)return null;let n;return e[0]!==r||e[1]!==s.tabsEl?(n=Qe.createPortal(r,s.tabsEl),e[0]=r,e[1]=s.tabsEl,e[2]=n):n=e[2],n}function Es(t){const e=U.c(3),{children:r}=t,s=F.useContext(Be);if(!s?.actionsEl)return null;let n;return e[0]!==r||e[1]!==s.actionsEl?(n=Qe.createPortal(r,s.actionsEl),e[0]=r,e[1]=s.actionsEl,e[2]=n):n=e[2],n}const Nn=Es;function On(t){const e=U.c(21),{children:r,breadcrumb:s,hideHeader:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={leftEl:null,tabsEl:null,actionsEl:null},e[0]=i):i=e[0];const[a,l]=F.useState(i),d=F.useRef(null),u=F.useRef(null),m=F.useRef(null);let f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=j=>{d.current=j,j&&l(C=>C.leftEl===j?C:{...C,leftEl:j})},e[1]=f):f=e[1];const h=f;let x;e[2]===Symbol.for("react.memo_cache_sentinel")?(x=j=>{u.current=j,j&&l(C=>C.tabsEl===j?C:{...C,tabsEl:j})},e[2]=x):x=e[2];const y=x;let b;e[3]===Symbol.for("react.memo_cache_sentinel")?(b=j=>{m.current=j,j&&l(C=>C.actionsEl===j?C:{...C,actionsEl:j})},e[3]=b):b=e[3];const w=b,S=n&&"hidden";let g;e[4]!==S?(g=_e(S),e[4]=S,e[5]=g):g=e[5];let O;e[6]===Symbol.for("react.memo_cache_sentinel")?(O=o.jsx("div",{ref:h,className:"flex items-center gap-2 min-w-0"}),e[6]=O):O=e[6];let R;e[7]!==s?(R=o.jsxs(ce.Header.Left,{children:[s,O]}),e[7]=s,e[8]=R):R=e[8];let L;e[9]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsxs(ce.Header.Right,{children:[o.jsx("div",{ref:y,className:"flex items-center gap-2 overflow-x-auto min-w-0"}),o.jsx("div",{ref:w,className:"flex items-center gap-2 shrink-0"})]}),e[9]=L):L=e[9];let k;e[10]!==g||e[11]!==R?(k=o.jsxs(ce.Header,{className:g,children:[R,L]}),e[10]=g,e[11]=R,e[12]=k):k=e[12];let I;e[13]!==r?(I=o.jsx(ce.Content,{children:r}),e[13]=r,e[14]=I):I=e[14];let P;e[15]!==k||e[16]!==I?(P=o.jsxs(ce,{children:[k,I]}),e[15]=k,e[16]=I,e[17]=P):P=e[17];let N;return e[18]!==a||e[19]!==P?(N=o.jsx(Be,{value:a,children:P}),e[18]=a,e[19]=P,e[20]=N):N=e[20],N}function Ns(t){return t.startsWith("@")?t:`@${t}`}function Os(){const{org:t}=Ue(),{data:e}=ft.useSession(),r=Nt(),s=At(),n=Rt(),i=s.filter(l=>n(l.id));return{installByBinding:async l=>{if(!t||!e?.user?.id){xe.error("Not authenticated");return}const d=Ns(l),m=(await Promise.all(i.map(async b=>{const w=kt(b.id,t.id);try{const S=await It(b.id,t.id,t.slug,w,{where:{appName:d}});return Pt(S??[])[0]??null}catch{return null}}))).find(b=>b!==null);if(!m){xe.error(`MCP Server not found in registry: ${l}`);return}const f=Mt(m,t.id,e.user.id),h=f.connection_type==="STDIO",x=!!f.connection_url,y=h&&f.connection_headers&&typeof f.connection_headers=="object"&&"command"in f.connection_headers;if(!x&&!y){xe.error("This MCP Server cannot be connected: no connection method available");return}return await r.create.mutateAsync(f),{id:f.id,connection:f}},isInstalling:r.create.isPending}}function Ts(t){const e=U.c(21),{virtualMcp:r,isSelected:s}=t,n=s&&"bg-accent";let i;e[0]!==n?(i=_e("flex items-start gap-3 py-3 px-3 hover:bg-accent cursor-pointer rounded-xl transition-colors",n),e[0]=n,e[1]=i):i=e[1];let a;e[2]!==r.icon||e[3]!==r.title?(a=o.jsx(et,{icon:r.icon,name:r.title,size:"sm"}),e[2]=r.icon,e[3]=r.title,e[4]=a):a=e[4];let l;e[5]!==r.title?(l=o.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:r.title}),e[5]=r.title,e[6]=l):l=e[6];let d;e[7]!==s?(d=s&&o.jsx(er,{size:16,className:"text-foreground shrink-0"}),e[7]=s,e[8]=d):d=e[8];let u;e[9]!==l||e[10]!==d?(u=o.jsxs("div",{className:"flex items-center justify-between",children:[l,d]}),e[9]=l,e[10]=d,e[11]=u):u=e[11];let m;e[12]!==r.description?(m=r.description&&o.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1 leading-relaxed",children:r.description}),e[12]=r.description,e[13]=m):m=e[13];let f;e[14]!==u||e[15]!==m?(f=o.jsxs("div",{className:"flex flex-col flex-1 min-w-0 gap-0.5",children:[u,m]}),e[14]=u,e[15]=m,e[16]=f):f=e[16];let h;return e[17]!==i||e[18]!==a||e[19]!==f?(h=o.jsxs("div",{className:i,children:[a,f]}),e[17]=i,e[18]=a,e[19]=f,e[20]=h):h=e[20],h}function ks(){const t=U.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"flex items-center justify-center py-12",children:o.jsx($e,{size:20,className:"animate-spin text-muted-foreground"})}),t[0]=e):e=t[0],e}function Is(t){const e=U.c(33),{selectedVirtualMcpId:r,onVirtualMcpChange:s,searchInputRef:n}=t,i=Xt(),[a,l]=F.useState(""),d=F.useRef(null),u=n??d;let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m={navigateOnCreate:!0},e[0]=m):m=e[0];const{createVirtualMCP:f,isCreating:h}=sr(m);let x,y,b,w;if(e[1]!==f||e[2]!==u||e[3]!==h||e[4]!==s||e[5]!==a||e[6]!==r||e[7]!==i){let O;e:{const E=i.filter(Ps);if(!a.trim()){O=E;break e}const M=a.toLowerCase();O=E.filter(B=>B.title.toLowerCase().includes(M)||B.description?.toLowerCase().includes(M))}const R=O;let L;e[12]!==s?(L=E=>{s(E),l("")},e[12]=s,e[13]=L):L=e[13];const k=L;b="flex flex-col max-h-[min(400px,60dvh)]";let I;e[14]===Symbol.for("react.memo_cache_sentinel")?(I=o.jsx(tr,{size:16,className:"text-muted-foreground pointer-events-none shrink-0"}),e[14]=I):I=e[14];let P;e[15]===Symbol.for("react.memo_cache_sentinel")?(P=E=>l(E.target.value),e[15]=P):P=e[15];let N;e[16]!==u||e[17]!==a?(N=o.jsx(Wt,{ref:u,type:"text",placeholder:"Search for an agent...",value:a,onChange:P,className:"flex-1 h-8 text-sm border-0 focus-visible:ring-0 focus-visible:ring-offset-0 shadow-none p-0"}),e[16]=u,e[17]=a,e[18]=N):N=e[18];const j=h?"Creating...":"Create Agent";let C;e[19]!==f||e[20]!==h||e[21]!==j?(C=o.jsx(Ce,{onClick:f,variant:"outline",size:"sm",className:"h-8 px-3 rounded-lg text-sm font-medium shrink-0",disabled:h,children:j}),e[19]=f,e[20]=h,e[21]=j,e[22]=C):C=e[22],e[23]!==N||e[24]!==C?(w=o.jsx("div",{className:"border-b px-4 py-3 bg-background/95 backdrop-blur sticky top-0 z-10",children:o.jsxs("div",{className:"relative flex items-center gap-2",children:[I,N,C]})}),e[23]=N,e[24]=C,e[25]=w):w=e[25],x="overflow-y-auto p-1.5 flex-1 min-h-0 [touch-action:pan-y]",y=R.length>0?o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-0.5",children:R.map(E=>o.jsx("div",{role:"button",tabIndex:0,onClick:()=>k(E.id),onKeyDown:M=>{(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),k(E.id))},className:"outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 rounded-xl",children:o.jsx(Ts,{virtualMcp:E,isSelected:E.id===r})},E.id))}):o.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No agents found"}),e[1]=f,e[2]=u,e[3]=h,e[4]=s,e[5]=a,e[6]=r,e[7]=i,e[8]=x,e[9]=y,e[10]=b,e[11]=w}else x=e[8],y=e[9],b=e[10],w=e[11];let S;e[26]!==x||e[27]!==y?(S=o.jsx("div",{className:x,children:y}),e[26]=x,e[27]=y,e[28]=S):S=e[28];let g;return e[29]!==b||e[30]!==w||e[31]!==S?(g=o.jsxs("div",{className:b,children:[w,S]}),e[29]=b,e[30]=w,e[31]=S,e[32]=g):g=e[32],g}function Ps(t){return!t.id||!St(t.id)}function Ms(t){const e=U.c(3);let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(ks,{}),e[0]=r):r=e[0];let s;return e[1]!==t?(s=o.jsx(F.Suspense,{fallback:r,children:o.jsx(Is,{...t})}),e[1]=t,e[2]=s):s=e[2],s}function As(t){const e=U.c(32),{selectedVirtualMcpId:r,selectedVirtualMcp:s,onVirtualMcpChange:n,className:i,placeholder:a,showTooltip:l,disabled:d}=t,u=a===void 0?"Select Agent":a,m=l===void 0?!0:l,f=d===void 0?!1:d,[h,x]=F.useState(!1),y=F.useRef(null);let b;e[0]!==n?(b=W=>{n(W),x(!1)},e[0]=n,e[1]=b):b=e[1];const w=b,S=Jt();let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g=W=>{x(W)},e[2]=g):g=e[2];const O=g;let R,L;e[3]!==S||e[4]!==h?(R=()=>{h&&!S&&setTimeout(()=>{y.current?.focus()},0)},L=[h,S],e[3]=S,e[4]=h,e[5]=R,e[6]=L):(R=e[5],L=e[6]),F.useEffect(R,L);const k=f?!1:h,I=f?void 0:O,P=f?"cursor-not-allowed opacity-50":"cursor-pointer hover:text-muted-foreground";let N;e[7]!==i||e[8]!==P?(N=_e("relative flex items-center justify-center size-8 rounded-lg text-muted-foreground/75 transition-colors shrink-0",P,i),e[7]=i,e[8]=P,e[9]=N):N=e[9];let j;e[10]!==s?(j=s?o.jsx(et,{icon:s.icon,name:s.title,size:"sm",className:"absolute inset-0 size-full"}):o.jsxs(o.Fragment,{children:[o.jsxs("svg",{className:"absolute inset-0 size-full",fill:"none",children:[o.jsx("defs",{children:o.jsxs("linearGradient",{id:"agent-border-gradient",gradientUnits:"userSpaceOnUse",x1:"0",y1:"0",x2:"32",y2:"32",children:[o.jsx("animateTransform",{attributeName:"gradientTransform",type:"rotate",from:"0 16 16",to:"360 16 16",dur:"6s",repeatCount:"indefinite"}),o.jsx("stop",{offset:"0%",stopColor:"var(--chart-1)"}),o.jsx("stop",{offset:"100%",stopColor:"var(--chart-4)"})]})}),o.jsx("rect",{x:"0.5",y:"0.5",width:"31",height:"31",rx:"7.5",stroke:"url(#agent-border-gradient)",strokeWidth:"1",strokeDasharray:"3 3"})]}),o.jsx(rr,{size:16})]}),e[10]=s,e[11]=j):j=e[11];let C;e[12]!==f||e[13]!==u||e[14]!==N||e[15]!==j?(C=o.jsx(Kt,{asChild:!0,children:o.jsx(qt,{asChild:!0,children:o.jsx("button",{type:"button",disabled:f,className:N,"aria-label":u,children:j})})}),e[12]=f,e[13]=u,e[14]=N,e[15]=j,e[16]=C):C=e[16];let E;e[17]!==h||e[18]!==s?.title||e[19]!==m?(E=m&&!h&&o.jsx(Zt,{side:"top",className:"text-xs",children:s?.title??"Choose an agent to chat with"}),e[17]=h,e[18]=s?.title,e[19]=m,e[20]=E):E=e[20];let M;e[21]!==C||e[22]!==E?(M=o.jsx(Yt,{children:o.jsxs(Qt,{children:[C,E]})}),e[21]=C,e[22]=E,e[23]=M):M=e[23];let B;e[24]!==w||e[25]!==r?(B=o.jsx(zt,{className:"w-[min(550px,calc(100vw-2rem))] p-0 overflow-hidden",align:"start",side:"top",sideOffset:8,collisionPadding:16,children:o.jsx(Ms,{selectedVirtualMcpId:r,onVirtualMcpChange:w,searchInputRef:y})}),e[24]=w,e[25]=r,e[26]=B):B=e[26];let V;return e[27]!==M||e[28]!==B||e[29]!==k||e[30]!==I?(V=o.jsxs(Gt,{open:k,onOpenChange:I,children:[M,B]}),e[27]=M,e[28]=B,e[29]=k,e[30]=I,e[31]=V):V=e[31],V}function Rs(t){const e=t.properties;if(!e)return!1;const r=e.__type,s=e.__binding;return!!(r?.const||s?.const)}function Ls(t){const e=t.properties;if(!e)return{};const r=e.__type,s=e.__binding;return{bindingType:r?.const,bindingSchema:s?.const}}function Hs(t){const e=U.c(10),{bindingSchema:r,bindingType:s,currentValue:n,onValueChange:i,placeholder:a,onAddNew:l,className:d}=t;let u;e[0]!==s?(u=Cs(s),e[0]=s,e[1]=u):u=e[1];const f=u??(typeof r=="string"?r:r??void 0);let h;return e[2]!==s||e[3]!==d||e[4]!==n||e[5]!==l||e[6]!==i||e[7]!==a||e[8]!==f?(h=o.jsx(Us,{value:n,onValueChange:i,placeholder:a,binding:f,bindingType:s,onAddNew:l,className:d}),e[2]=s,e[3]=d,e[4]=n,e[5]=l,e[6]=i,e[7]=a,e[8]=f,e[9]=h):h=e[9],h}function Us({value:t,onValueChange:e,placeholder:r="Select a connection...",binding:s,bindingType:n,onAddNew:i,className:a}){const[l,d]=F.useState(!1),{installByBinding:u,isInstalling:m}=Os(),f=l||m,h=s?void 0:n||void 0,x=Ot(s?{binding:s}:h?{filters:[{column:"app_name",value:h}]}:{}),y=Tt(t&&!x.some(g=>g.id===t)?t:void 0),b=y?[y,...x]:x,w=n?.startsWith("@"),S=async()=>{if(w&&n){d(!0);try{const g=await u(n);g&&e(g.id)}catch(g){const O=g instanceof Error?g.message:String(g);xe.error(`Failed to connect MCP: ${O}`)}finally{d(!1)}return}i?.()};return o.jsxs(Ht,{value:t,onValueChange:e,children:[o.jsx(Ut,{size:"sm",className:_e("w-[200px]",a),children:o.jsx($t,{placeholder:r})}),o.jsxs(Ft,{children:[b.length===0?o.jsx("div",{className:"px-2 py-4 text-center text-sm text-muted-foreground",children:"No connections found"}):b.map(g=>o.jsx(Bt,{value:g.id,children:o.jsxs("div",{className:"flex items-center gap-2",children:[g.icon?o.jsx("img",{src:g.icon,alt:g.title,className:"w-4 h-4 rounded"}):o.jsx("div",{className:"w-4 h-4 rounded bg-linear-to-br from-primary/20 to-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:g.title.slice(0,1).toUpperCase()}),o.jsx("span",{children:g.title})]})},g.id)),(i||w)&&o.jsx("div",{className:"border-t border-border",children:o.jsx(Ce,{onClick:g=>{g.preventDefault(),g.stopPropagation(),S()},disabled:f,variant:"ghost",className:"w-full justify-start gap-2 px-2 py-2 h-auto hover:bg-muted rounded-md text-sm disabled:opacity-50 disabled:cursor-not-allowed",type:"button",children:f?o.jsxs(o.Fragment,{children:[o.jsx($e,{size:16,className:"animate-spin"}),o.jsx("span",{children:"Connecting..."})]}):o.jsxs(o.Fragment,{children:[o.jsx(Lt,{size:16}),o.jsx("span",{children:"Custom Connection"})]})})})]})]})}function $s(t){const e=U.c(49),{schema:r,formData:s,title:n,description:i,registry:a}=t,l=a.formContext,d=n||"",u=n||"";if(Rs(r)){const h=r;let x;e[0]!==h?(x=Ls(h),e[0]=h,e[1]=x):x=e[1];const{bindingType:y,bindingSchema:b}=x,S=(l?.formData?.[d]?.value??s?.value)||"";let g;e[2]!==y||e[3]!==d||e[4]!==l||e[5]!==s?(g=V=>{const W={...s,value:V??"",...y&&{__type:y}};l?.onFieldChange(d,W)},e[2]=y,e[3]=d,e[4]=l,e[5]=s,e[6]=g):g=e[6];const O=g,R=Bs;let L;e[7]!==u||e[8]!==d||e[9]!==n?(L=R(n||u||d),e[7]=u,e[8]=d,e[9]=n,e[10]=L):L=e[10];const k=L;if(y==="@deco/agent"){let V;e[11]!==k?(V=o.jsx("label",{className:"text-sm font-medium truncate block",children:k}),e[11]=k,e[12]=V):V=e[12];let W;e[13]!==i?(W=i&&o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:i}),e[13]=i,e[14]=W):W=e[14];let te;e[15]!==V||e[16]!==W?(te=o.jsxs("div",{className:"flex-1 min-w-0",children:[V,W]}),e[15]=V,e[16]=W,e[17]=te):te=e[17];const Ee=S||void 0;let re;e[18]!==O||e[19]!==Ee?(re=o.jsx(As,{selectedVirtualMcpId:Ee,onVirtualMcpChange:O,variant:"bordered",placeholder:"Select Agent",className:"w-[200px] shrink-0"}),e[18]=O,e[19]=Ee,e[20]=re):re=e[20];let be;return e[21]!==te||e[22]!==re?(be=o.jsxs("div",{className:"flex items-center gap-3 justify-between",children:[te,re]}),e[21]=te,e[22]=re,e[23]=be):be=e[23],be}let I;e[24]!==k?(I=o.jsx("label",{className:"text-sm font-medium truncate block",children:k}),e[24]=k,e[25]=I):I=e[25];let P;e[26]!==i?(P=i&&o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:i}),e[26]=i,e[27]=P):P=e[27];let N;e[28]!==I||e[29]!==P?(N=o.jsxs("div",{className:"flex-1 min-w-0",children:[I,P]}),e[28]=I,e[29]=P,e[30]=N):N=e[30];let j;e[31]!==k?(j=k.toLowerCase(),e[31]=k,e[32]=j):j=e[32];const C=`Select ${j}...`;let E;e[33]!==l?(E=()=>l?.onAddNew(),e[33]=l,e[34]=E):E=e[34];let M;e[35]!==b||e[36]!==y||e[37]!==S||e[38]!==O||e[39]!==C||e[40]!==E?(M=o.jsx(Hs,{bindingSchema:b,bindingType:y,currentValue:S,onValueChange:O,placeholder:C,onAddNew:E,className:"w-[200px] shrink-0"}),e[35]=b,e[36]=y,e[37]=S,e[38]=O,e[39]=C,e[40]=E,e[41]=M):M=e[41];let B;return e[42]!==M||e[43]!==N?(B=o.jsxs("div",{className:"flex items-center gap-3 justify-between",children:[N,M]}),e[42]=M,e[43]=N,e[44]=B):B=e[44],B}let m;e[45]!==t.properties?(m=t.properties.map(Fs),e[45]=t.properties,e[46]=m):m=e[46];let f;return e[47]!==m?(f=o.jsx("div",{className:"flex flex-col gap-4",children:m}),e[47]=m,e[48]=f):f=e[48],f}function Fs(t){return t.content}function Bs(t){return t.toLowerCase().replace(/_/g," ").replace(/\b\w/g,Ds)}function Ds(t){return t.toUpperCase()}function Vs(t){const e=U.c(13),{label:r,children:s,description:n,id:i,schema:a}=t;if(i.includes("__type")||i.includes("__binding"))return null;if(a.type==="object")return s;let l;e[0]!==i||e[1]!==r?(l=r&&o.jsx("label",{className:"text-sm font-medium truncate block",htmlFor:i,children:r}),e[0]=i,e[1]=r,e[2]=l):l=e[2];let d;e[3]!==n?(d=n&&o.jsx("div",{className:"text-xs text-muted-foreground truncate",children:n}),e[3]=n,e[4]=d):d=e[4];let u;e[5]!==l||e[6]!==d?(u=o.jsxs("div",{className:"flex-1 min-w-0",children:[l,d]}),e[5]=l,e[6]=d,e[7]=u):u=e[7];let m;e[8]!==s?(m=o.jsx("div",{className:"w-[200px] shrink-0",children:s}),e[8]=s,e[9]=m):m=e[9];let f;return e[10]!==u||e[11]!==m?(f=o.jsxs("div",{className:"flex items-center gap-3 justify-between",children:[u,m]}),e[10]=u,e[11]=m,e[12]=f):f=e[12],f}const Ws={ObjectFieldTemplate:$s,FieldTemplate:Vs};function qs(t){const e=U.c(19),{formKey:r,formState:s,onFormStateChange:n,stateSchema:i}=t,{org:a}=Ue(),l=mt();let d;e[0]!==n?(d=g=>{g.formData&&n(g.formData)},e[0]=n,e[1]=d):d=e[1];const u=d;let m;e[2]!==s||e[3]!==n?(m=(g,O)=>{const R={...s,[g]:O};n(R)},e[2]=s,e[3]=n,e[4]=m):m=e[4];const f=m;let h;e[5]!==l||e[6]!==a?(h=()=>{l({to:"/$org/settings/connections",params:{org:a.slug},search:{action:"create"}})},e[5]=l,e[6]=a,e[7]=h):h=e[7];const x=h;let y;e[8]!==s||e[9]!==x||e[10]!==f?(y={onFieldChange:f,formData:s,onAddNew:x},e[8]=s,e[9]=x,e[10]=f,e[11]=y):y=e[11];const b=y;let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(o.Fragment,{}),e[12]=w):w=e[12];let S;return e[13]!==b||e[14]!==r||e[15]!==s||e[16]!==u||e[17]!==i?(S=o.jsx("div",{className:"flex flex-col h-full overflow-auto",children:o.jsx(Dt,{schema:i,validator:Vt,formData:s,onChange:u,formContext:b,liveValidate:!1,showErrorList:!1,templates:Ws,children:w},r)}),e[13]=b,e[14]=r,e[15]=s,e[16]=u,e[17]=i,e[18]=S):S=e[18],S}function zs(t){const e=U.c(14),{org:r}=Ue();let s;e[0]!==t||e[1]!==r.id||e[2]!==r.slug?(s={connectionId:t,orgId:r.id,orgSlug:r.slug},e[0]=t,e[1]=r.id,e[2]=r.slug,e[3]=s):s=e[3];const n=jt(s);let i;e[4]===Symbol.for("react.memo_cache_sentinel")?(i={},e[4]=i):i=e[4];let a;e[5]!==n?(a={client:n,toolName:"MCP_CONFIGURATION",toolArguments:i,select:Gs},e[5]=n,e[6]=a):a=e[6];const{data:l}=_t(a);let d;e[7]!==l.stateSchema?(d=l.stateSchema??{type:"object",properties:{}},e[7]=l.stateSchema,e[8]=d):d=e[8];const u=d;let m;e[9]!==l.scopes?(m=l.scopes??[],e[9]=l.scopes,e[10]=m):m=e[10];const f=m;let h;return e[11]!==f||e[12]!==u?(h={stateSchema:u,scopes:f},e[11]=f,e[12]=u,e[13]=h):h=e[13],h}function Gs(t){return t.structuredContent??t}function Js(t){const e=U.c(4),{onAuthenticate:r,buttonText:s}=t,n=s===void 0?"Authenticate":s;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx("h3",{className:"text-sm font-semibold",children:"Authentication Required"}),o.jsx("p",{className:"text-xs text-muted-foreground max-w-md text-center",children:"This connection requires OAuth authentication to access resources."})]}),e[0]=i):i=e[0];let a;return e[1]!==n||e[2]!==r?(a=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[i,o.jsx(Ce,{onClick:r,size:"default",children:n})]})}),e[1]=n,e[2]=r,e[3]=a):a=e[3],a}function Zs(t){const e=U.c(7),{hasReadme:r,onViewReadme:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(Et,{size:36,className:"text-muted-foreground"}),e[0]=n):n=e[0];let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx("h3",{className:"text-sm font-semibold",children:"Manual Authentication Required"}),o.jsx("p",{className:"text-xs text-muted-foreground max-w-md text-center",children:"This server requires an API key or token that must be configured manually. Check the server's documentation for instructions on obtaining credentials."})]}),e[1]=i):i=e[1];let a;e[2]!==r||e[3]!==s?(a=r&&s&&o.jsxs(Ce,{onClick:s,variant:"outline",size:"lg",children:[o.jsx(Ct,{size:18,className:"mr-2"}),"View README"]}),e[2]=r,e[3]=s,e[4]=a):a=e[4];let l;return e[5]!==a?(l=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[n,i,a]})}),e[5]=a,e[6]=l):l=e[6],l}function Ks(){const t=U.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("img",{src:"/empty-state-error.svg",alt:"",width:160,height:160,"aria-hidden":"true"}),t[0]=e):e=t[0];let r;return t[1]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[e,o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"Server Error"}),o.jsx("p",{className:"text-sm text-muted-foreground max-w-md text-center",children:"The MCP server is currently experiencing issues. Please try again later or check the server's status."})]})]})}),t[1]=r):r=t[1],r}function Ys(t){const e=U.c(12),{connection:r,form:s}=t,{stateSchema:n}=zs(r.id);let i;e[0]!==s.control?(i={control:s.control,name:"configuration_state"},e[0]=s.control,e[1]=i):i=e[1];const a=pt(i);let l;e[2]!==s?(l=h=>{s.setValue("configuration_state",h,{shouldDirty:!0})},e[2]=s,e[3]=l):l=e[3];const d=l;if(!(n&&n.properties&&typeof n.properties=="object"&&Object.keys(n.properties).length>0)){let h;return e[4]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Xe,{image:o.jsx("img",{src:"/empty-state-success-muted.svg",alt:"",width:220,height:200,"aria-hidden":"true"}),title:"This server is all set!",description:"No additional configuration is needed. Everything is ready to go."})}),e[4]=h):h=e[4],h}let m;e[5]!==a?(m=a??{},e[5]=a,e[6]=m):m=e[6];let f;return e[7]!==r.id||e[8]!==d||e[9]!==n||e[10]!==m?(f=o.jsx("div",{className:"flex-1 overflow-auto",children:o.jsx(qs,{formKey:r.id,stateSchema:n,formState:m,onFormStateChange:d})}),e[7]=r.id,e[8]=d,e[9]=n,e[10]=m,e[11]=f):f=e[11],f}function Qs(t){const e=U.c(11),{connection:r,form:s,hasMcpBinding:n,isMCPAuthenticated:i,supportsOAuth:a,isServerError:l,onAuthenticate:d,onViewReadme:u}=t,f=!!r?.metadata?.repository?.url;if(!i){if(l){let b;return e[0]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(Ks,{}),e[0]=b):b=e[0],b}if(a){let b;return e[1]!==d?(b=o.jsx(Js,{onAuthenticate:d}),e[1]=d,e[2]=b):b=e[2],b}let y;return e[3]!==f||e[4]!==u?(y=o.jsx(Zs,{hasReadme:f,onViewReadme:u}),e[3]=f,e[4]=u,e[5]=y):y=e[5],y}if(!n){let y;return e[6]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Xe,{image:o.jsx("img",{src:"/empty-state-success-muted.svg",alt:"",width:220,height:200,"aria-hidden":"true"}),title:"This server is all set!",description:"No additional configuration is needed. Everything is ready to go."})}),e[6]=y):y=e[6],y}let h;e[7]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx($e,{size:32,className:"animate-spin text-muted-foreground"})}),e[7]=h):h=e[7];let x;return e[8]!==r||e[9]!==s?(x=o.jsx(ht,{children:o.jsx(F.Suspense,{fallback:h,children:o.jsx(Ys,{connection:r,form:s})})}),e[8]=r,e[9]=s,e[10]=x):x=e[10],x}function Tn(t){const e=U.c(2);let r;return e[0]!==t?(r=o.jsx("div",{className:"flex-1 flex h-full",children:o.jsx(Qs,{...t})}),e[0]=t,e[1]=r):r=e[1],r}export{Zs as M,Js as O,Tn as S,On as V,Nn as a,En as b,Cn as c};
|