decocms 2.181.1 → 2.181.3
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-CwQ-M1BH.js → AlertCircle-D2rRA9CS.js} +1 -1
- package/dist/client/assets/{ArrowLeft-7hoUFjWA.js → ArrowLeft-D4bkD9qi.js} +1 -1
- package/dist/client/assets/{ArrowUp-C8UJr_8S.js → ArrowUp-CpDF-NAu.js} +1 -1
- package/dist/client/assets/{Check-wCq9US95.js → Check-CecxQkQE.js} +1 -1
- package/dist/client/assets/{ChevronDown-C4UuUfvP.js → ChevronDown-Cm9SuGtV.js} +1 -1
- package/dist/client/assets/{ChevronRight-8vS2LfiE.js → ChevronRight-2xVQHhsF.js} +1 -1
- package/dist/client/assets/{ChevronUp-eUIC7wig.js → ChevronUp-B6bu9ZD3.js} +1 -1
- package/dist/client/assets/{Container-OKF_GeCq.js → Container-sfWYtc36.js} +1 -1
- package/dist/client/assets/{Dataflow03-CYOanaoD.js → Dataflow03-BcXlVxgR.js} +1 -1
- package/dist/client/assets/{Download01-D6Ut3-TC.js → Download01-DGSbxmSo.js} +1 -1
- package/dist/client/assets/{FolderClosed-DWPM1ogz.js → FolderClosed-DlY-lqwP.js} +1 -1
- package/dist/client/assets/{Grid01-CFCqtKvs.js → Grid01-CLnEHof5.js} +1 -1
- package/dist/client/assets/{List-Dm7hE_p7.js → List-CnkQuVUq.js} +1 -1
- package/dist/client/assets/{Loading01-CKkwknOS.js → Loading01-ZUH_hVSq.js} +1 -1
- package/dist/client/assets/{Play-B44HkfJ8.js → Play-CCpyKlpN.js} +1 -1
- package/dist/client/assets/{Plus-B_tfkXz3.js → Plus-D9CNWrFQ.js} +1 -1
- package/dist/client/assets/{RefreshCcw01-Dd-MCL9x.js → RefreshCcw01-Cu6svfY5.js} +1 -1
- package/dist/client/assets/{SearchMd-DwH-zFLD.js → SearchMd-BH_J7-7p.js} +1 -1
- package/dist/client/assets/{Settings01-Cc_jPdtk.js → Settings01-DTaoTYj1.js} +1 -1
- package/dist/client/assets/{Trash01-DFCUs2vM.js → Trash01-Cv31wiMP.js} +1 -1
- package/dist/client/assets/{Type01-DmSAzri2.js → Type01-BRLQyycA.js} +1 -1
- package/dist/client/assets/{Upload01-B4UOm_Kf.js → Upload01-BY6Noksk.js} +1 -1
- package/dist/client/assets/{User01-a2C2h2ws.js → User01-BloSEKZw.js} +1 -1
- package/dist/client/assets/{VideoRecorder-b8m_Ituf.js → VideoRecorder-CqjZf9cg.js} +1 -1
- package/dist/client/assets/{X-CVr_hKcl.js → X-1dO_8PIJ.js} +1 -1
- package/dist/client/assets/{XCircle-Dv-O5jd1.js → XCircle-BEC1SvTX.js} +1 -1
- package/dist/client/assets/{XClose-DXhO2ZT2.js → XClose-BzyTilGE.js} +1 -1
- package/dist/client/assets/{Zap-D6ZQZPYh.js → Zap-D6SUOiFY.js} +1 -1
- package/dist/client/assets/{agent-connections-preview-hZGsihWU.js → agent-connections-preview-COmBlzCd.js} +1 -1
- package/dist/client/assets/{agent-detail-D_DBZ4Bl.js → agent-detail-DAo3-7Gz.js} +1 -1
- package/dist/client/assets/{agents-CpLdJw8X.js → agents-Cy0iaygc.js} +1 -1
- package/dist/client/assets/{ai-providers-logos-HDlTKyFP.js → ai-providers-logos-Cr4iRu-0.js} +1 -1
- package/dist/client/assets/{alert-dialog-Dqc_24Os.js → alert-dialog-DnwDlp7T.js} +1 -1
- package/dist/client/assets/{auth-catchall-DZ2DNfI0.js → auth-catchall-CJb2iecY.js} +1 -1
- package/dist/client/assets/{automation-detail-5-Ty44fE.js → automation-detail-DIl5XDBS.js} +1 -1
- package/dist/client/assets/{automations-COLW1OP9.js → automations-4lM2x30V.js} +1 -1
- package/dist/client/assets/{avatar-BCNSpjov.js → avatar-CahK8DWE.js} +1 -1
- package/dist/client/assets/{badge-C9kSd2rC.js → badge-a1yIqkX1.js} +1 -1
- package/dist/client/assets/{binder-1tH_sZqU.js → binder-B_Xezby6.js} +1 -1
- package/dist/client/assets/{breadcrumb-BjaszutD.js → breadcrumb-DBLmG8ET.js} +1 -1
- package/dist/client/assets/{card-C_4nJrQs.js → card-BkMKAjKJ.js} +1 -1
- package/dist/client/assets/{checkbox-CKx9MIya.js → checkbox-DFbWpPSa.js} +1 -1
- package/dist/client/assets/{collapsible-DKOKNSjC.js → collapsible-CzCLTaIa.js} +1 -1
- package/dist/client/assets/{collection-detail-CpVZhrBd.js → collection-detail-CP2ikFfr.js} +1 -1
- package/dist/client/assets/{collection-display-button-07J7hFqi.js → collection-display-button-BTy8OMGo.js} +1 -1
- package/dist/client/assets/{collection-search-C014T-nI.js → collection-search-BaA_5hnO.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-1AJGYm4t.js → collection-table-wrapper-CeDvXZ6e.js} +1 -1
- package/dist/client/assets/{collection-tabs-BZp_rh35.js → collection-tabs-B_Ive8CL.js} +1 -1
- package/dist/client/assets/{command-DOoFRPUJ.js → command-DeF62mUG.js} +1 -1
- package/dist/client/assets/{connection-card-Dvo5xeIo.js → connection-card-ClL9bm7k.js} +1 -1
- package/dist/client/assets/{connection-detail-B512SIke.js → connection-detail-D6Ad6Uup.js} +1 -1
- package/dist/client/assets/{connections-BOj_J2If.js → connections-Dkdo-MxF.js} +1 -1
- package/dist/client/assets/{constants-C2NIYyeK.js → constants-kAo23sAc.js} +1 -1
- package/dist/client/assets/{context-Cfhj-jDE.js → context-C2WVT2wI.js} +1 -1
- package/dist/client/assets/{create-organization-dialog-CoH8Z4xz.js → create-organization-dialog--yeW4Rp3.js} +1 -1
- package/dist/client/assets/{create-project-dialog-Bo88aywl.js → create-project-dialog-DX0tom06.js} +1 -1
- package/dist/client/assets/{danger-Cm2vTS1T.js → danger-BEWSLgEr.js} +1 -1
- package/dist/client/assets/{danger-zone-DT2ENIL0.js → danger-zone-COttqiLk.js} +1 -1
- package/dist/client/assets/{dependencies-DwJHkCHB.js → dependencies-DQpwdViP.js} +1 -1
- package/dist/client/assets/{dialog-D2mcZnzN.js → dialog-B-I43lOk.js} +1 -1
- package/dist/client/assets/{drawer-vD6YQ-sA.js → drawer-Cc_fH-oc.js} +1 -1
- package/dist/client/assets/{dropdown-menu-5AX5yqCQ.js → dropdown-menu-KiFp7XSX.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-CVwFp6hh.js → dynamic-plugin-layout-DqyTuAzp.js} +1 -1
- package/dist/client/assets/{editable-task-title-DSaRvdkK.js → editable-task-title-DABFKKXz.js} +1 -1
- package/dist/client/assets/{empty-state-BnwPT1fd.js → empty-state-BclY67WC.js} +1 -1
- package/dist/client/assets/{empty-state-C_h_kfhM.js → empty-state-UToLDOJO.js} +1 -1
- package/dist/client/assets/{env-vars-editor-Cdhuqusz.js → env-vars-editor-D3JHoO0m.js} +1 -1
- package/dist/client/assets/{extract-connection-data-BJKmDa-6.js → extract-connection-data-GhIKo0Xr.js} +1 -1
- package/dist/client/assets/{file-browser-C-yRGqGr.js → file-browser-CZHih4nP.js} +2 -2
- package/dist/client/assets/{form-3OFR-VJQ.js → form-edx7u0Be.js} +1 -1
- package/dist/client/assets/{general-Bc8nPdrN.js → general-rmW6kn_q.js} +1 -1
- package/dist/client/assets/{generate-id-Dz9QYszT.js → generate-id-B0hqIne-.js} +1 -1
- package/dist/client/assets/{grid-view-B8S8xAuj.js → grid-view-SzsDCBqX.js} +1 -1
- package/dist/client/assets/{home-CgBkZx75.js → home-BW8Jzf61.js} +1 -1
- package/dist/client/assets/{index-D9tlV5w6.js → index--68a591R.js} +1 -1
- package/dist/client/assets/{index-1_kpvnU4.js → index-B3DLUye8.js} +1 -1
- package/dist/client/assets/{index-CU9cIMQQ.js → index-Bf3XZpZk.js} +1 -1
- package/dist/client/assets/{index-CpTXJjPF.js → index-BsYB-j4p.js} +1 -1
- package/dist/client/assets/{index-BKuN2Iot.js → index-C45O1mgu.js} +1 -1
- package/dist/client/assets/{index-BN5_gDph.js → index-CJ0BaJHY.js} +1 -1
- package/dist/client/assets/{index-Ums8T5hF.js → index-CNQ1T_R3.js} +1 -1
- package/dist/client/assets/{index-aw4p2K_Q.js → index-Ca6dFB6s.js} +1 -1
- package/dist/client/assets/{index-B0rHyq8i.js → index-CyaqcTbn.js} +1 -1
- package/dist/client/assets/{index-t6xY8FYJ.js → index-Di6oLb1g.js} +3 -3
- package/dist/client/assets/{index-CqfM11ms.js → index-SfPPYQt8.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-cSGG5mU_.js → infiniteQueryObserver-Cg7Qn-Py.js} +1 -1
- package/dist/client/assets/{input-qMconvxq.js → input-DQ4QcwHR.js} +1 -1
- package/dist/client/assets/{integration-icon-BlldxArX.js → integration-icon-DlCg0T4C.js} +1 -1
- package/dist/client/assets/{label-DQB9xwZM.js → label-BGeQL0ka.js} +1 -1
- package/dist/client/assets/{layout-CXznpTUY.js → layout-D6ZxqJKi.js} +1 -1
- package/dist/client/assets/{layout-D0kNFrGz.js → layout-DtwUtGx0.js} +1 -1
- package/dist/client/assets/{login-ByYrGnuD.js → login-DlB4I5sp.js} +1 -1
- package/dist/client/assets/{logo-upload-DXmtyQTR.js → logo-upload-BtAPf8sp.js} +1 -1
- package/dist/client/assets/{mcp-app-renderer-BgFTGV3R.js → mcp-app-renderer-Cg9Eew2n.js} +1 -1
- package/dist/client/assets/{mcp-server-card-CbbQ9zmv.js → mcp-server-card-4V1eOOTX.js} +1 -1
- package/dist/client/assets/{mcp-server-detail-C4NpEsJs.js → mcp-server-detail-CX9gEsnH.js} +2 -2
- package/dist/client/assets/{members-DwVIkRhC.js → members-D1cMWKgG.js} +1 -1
- package/dist/client/assets/{monaco-editor-DlS1kIEY.js → monaco-editor-DnqhgBvh.js} +1 -1
- package/dist/client/assets/{monitoring-BP_I8oHA.js → monitoring-BQpDfDrf.js} +1 -1
- package/dist/client/assets/{monitoring-dashboard-edit-B-Anvw32.js → monitoring-dashboard-edit-Cbicjk63.js} +1 -1
- package/dist/client/assets/{monitoring-dashboard-view-B4EKAI4H.js → monitoring-dashboard-view-Ci-RFMRb.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-_pMtDdXo.js → monitoring-stats-row-vvMdV41p.js} +1 -1
- package/dist/client/assets/{oauth-callback-oqOHT12Q.js → oauth-callback-DIjSwsej.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-BQrF4HBs.js → oauth-callback-ai-provider-Dh3KWtZ6.js} +1 -1
- package/dist/client/assets/{org-ai-providers-DJ2pJYJP.js → org-ai-providers-DGjdQR3W.js} +1 -1
- package/dist/client/assets/{page-BwYkJelt.js → page-DCh64rPG.js} +1 -1
- package/dist/client/assets/{page-C2dXKJSu.js → page-DqLtxYci.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-CWHcbfRs.js → plugin-empty-state-DXF12w3Y.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-ZcHYGE5m.js → plugin-empty-state-KrWE8h_c.js} +1 -1
- package/dist/client/assets/{plugin-header-BdlNegyr.js → plugin-header-BRNld0B2.js} +1 -1
- package/dist/client/assets/{plugin-header-CYJy88Hz.js → plugin-header-CxhFSwvz.js} +1 -1
- package/dist/client/assets/plugins-BVx4W74m.js +1 -0
- package/dist/client/assets/{popover-CRTw2B4t.js → popover-DnP50c_4.js} +1 -1
- package/dist/client/assets/{project-app-view-Dd-mlwjV.js → project-app-view-BjmqGgdc.js} +1 -1
- package/dist/client/assets/{project-layout-B74T6y-f.js → project-layout-B0N0-1u8.js} +1 -1
- package/dist/client/assets/{project-plugins-wKxoF0hg.js → project-plugins-W6YBdGTQ.js} +1 -1
- package/dist/client/assets/{projects-list-wmEMeN4i.js → projects-list-x0gTe3hu.js} +1 -1
- package/dist/client/assets/{registry-layout-BTO44Pm9.js → registry-layout-CCApya06.js} +1 -1
- package/dist/client/assets/{registry-utils-q14xY1bA.js → registry-utils-B2MGgFdM.js} +1 -1
- package/dist/client/assets/{reset-password-BzKcrrar.js → reset-password-BGRs1AsG.js} +1 -1
- package/dist/client/assets/{resizable-Cd0SSbbe.js → resizable-BUdS0TeH.js} +1 -1
- package/dist/client/assets/{save-actions--GeWosdW.js → save-actions-CZB_80fx.js} +1 -1
- package/dist/client/assets/{scroll-area-XEIbL86H.js → scroll-area-BDvsWD3_.js} +1 -1
- package/dist/client/assets/{select-D64t3Q_g.js → select-DE6nOtq4.js} +1 -1
- package/dist/client/assets/{select-virtual-mcp-7C78QF32.js → select-virtual-mcp-BcDL714M.js} +1 -1
- package/dist/client/assets/{shell-layout-ClRvSlWW.js → shell-layout-dlpBTl1V.js} +2 -2
- package/dist/client/assets/{sidebar-settings-DgIvJCIQ.js → sidebar-settings-DvmipHRI.js} +1 -1
- package/dist/client/assets/{skeleton-BPyW696G.js → skeleton-jHSQmvNz.js} +1 -1
- package/dist/client/assets/{spinner-CV28jHZI.js → spinner-uIlWy8Tn.js} +1 -1
- package/dist/client/assets/{store-invite-DbwSzRRK.js → store-invite-hyBdEV4m.js} +1 -1
- package/dist/client/assets/{switch-BI7Srio5.js → switch-DqoVcDTw.js} +1 -1
- package/dist/client/assets/{table-CvLgTwxu.js → table-BtUXt-LB.js} +1 -1
- package/dist/client/assets/{tabs-BcgepvIr.js → tabs-Co0v-Gtu.js} +1 -1
- package/dist/client/assets/{task-status-E_WeHLB-.js → task-status-mBvgK6CE.js} +5 -3
- package/dist/client/assets/tasks-D2ul5DI6.js +1 -0
- package/dist/client/assets/{tasks-panel-CgnSZwBZ.js → tasks-panel-CKxWhrpo.js} +1 -1
- package/dist/client/assets/{textarea-BjXJvI0O.js → textarea-DK_nHNH9.js} +1 -1
- package/dist/client/assets/{time-range-picker-CTHuop4k.js → time-range-picker-Dq2GzTz_.js} +1 -1
- package/dist/client/assets/{toggle-group-DF6ThyrQ.js → toggle-group-C2i_WN24.js} +1 -1
- package/dist/client/assets/{tools-list-BYjVtR4b.js → tools-list-SO4mO2yz.js} +1 -1
- package/dist/client/assets/{tooltip-CKRAIo8e.js → tooltip-Bt2vWRpT.js} +1 -1
- package/dist/client/assets/{topbar-portal-w0rGTzsN.js → topbar-portal-C9UZ6_6p.js} +1 -1
- package/dist/client/assets/{types-CEJbDNRj.js → types-C4sVrknd.js} +1 -1
- package/dist/client/assets/{use-automations-CZzmdooE.js → use-automations-DgVOPvmM.js} +1 -1
- package/dist/client/assets/{use-collections-CLlnuJpl.js → use-collections-CojcRvND.js} +1 -1
- package/dist/client/assets/{use-connection-DSXGpH93.js → use-connection-CJIltDo3.js} +1 -1
- package/dist/client/assets/{use-copy-C8N2hXkR.js → use-copy-_cPtrtTH.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-CCjeFnH5.js → use-create-virtual-mcp-D7i1HcQg.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-C1MEbO72.js → use-infinite-scroll-xFnZb5m2.js} +1 -1
- package/dist/client/assets/{use-install-from-registry-OGBcaDCK.js → use-install-from-registry-BUPQMjUV.js} +1 -1
- package/dist/client/assets/{use-list-state-CsPnDRB0.js → use-list-state-Bp_aU4BI.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-DSysuR0s.js → use-mcp-prompts-zeDoy0Xo.js} +1 -1
- package/dist/client/assets/{use-mcp-resources-BWxiCCmX.js → use-mcp-resources-BIFxFRhN.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-Ca8lRrYA.js → use-mcp-tools-BD0zsUGc.js} +1 -1
- package/dist/client/assets/{use-members-CRSSGJnt.js → use-members-CbUEMp3B.js} +1 -1
- package/dist/client/assets/{use-project-Cpu-iDuV.js → use-project-BVkW8l1T.js} +1 -1
- package/dist/client/assets/{use-store-discovery-1Qhmse-y.js → use-store-discovery-Dr1RNWE5.js} +1 -1
- package/dist/client/assets/{use-view-mode-CjInGBUv.js → use-view-mode-DNywUlq7.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-D5bKIffF.js → use-virtual-mcp-BdGbK3Wg.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-BKFOAK_4.js +1 -0
- package/dist/client/assets/{useMutation-Bncnalv9.js → useMutation-BOcaN318.js} +1 -1
- package/dist/client/assets/useQuery-BrfnS-T_.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-XlSq2d-l.js +1 -0
- package/dist/client/assets/{user-CwGhUrKE.js → user-BdXDOTfV.js} +1 -1
- package/dist/client/assets/{workflow-D6XUy7ku.js → workflow-C2zJzxLb.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +7 -2
- package/dist/server/server.js +7 -2
- package/package.json +1 -1
- package/dist/client/assets/plugins-vFW-WlI8.js +0 -1
- package/dist/client/assets/tasks-Db5wfUei.js +0 -1
- package/dist/client/assets/useInfiniteQuery-C-1ZqiFa.js +0 -1
- package/dist/client/assets/useQuery-CIPIMOb2.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-Dah_qudN.js +0 -1
- package/dist/server/node_modules/async-exit-hook/CHANGELOG.md +0 -62
- package/dist/server/node_modules/async-exit-hook/index.js +0 -171
- package/dist/server/node_modules/async-exit-hook/license +0 -21
- package/dist/server/node_modules/async-exit-hook/package.json +0 -66
- package/dist/server/node_modules/async-exit-hook/readme.md +0 -118
- package/dist/server/node_modules/pg-int8/LICENSE +0 -13
- package/dist/server/node_modules/pg-int8/README.md +0 -16
- package/dist/server/node_modules/pg-int8/index.js +0 -100
- package/dist/server/node_modules/pg-int8/package.json +0 -24
- package/dist/server/node_modules/postgres-bytea/index.js +0 -33
- package/dist/server/node_modules/postgres-bytea/license +0 -21
- package/dist/server/node_modules/postgres-bytea/package.json +0 -34
- package/dist/server/node_modules/postgres-bytea/readme.md +0 -34
- package/dist/server/node_modules/postgres-date/index.js +0 -116
- package/dist/server/node_modules/postgres-date/license +0 -21
- package/dist/server/node_modules/postgres-date/package.json +0 -33
- package/dist/server/node_modules/postgres-date/readme.md +0 -49
- package/dist/server/node_modules/postgres-interval/index.d.ts +0 -20
- package/dist/server/node_modules/postgres-interval/index.js +0 -125
- package/dist/server/node_modules/postgres-interval/license +0 -21
- package/dist/server/node_modules/postgres-interval/package.json +0 -36
- package/dist/server/node_modules/postgres-interval/readme.md +0 -48
- package/dist/server/node_modules/split2/LICENSE +0 -13
- package/dist/server/node_modules/split2/README.md +0 -85
- package/dist/server/node_modules/split2/bench.js +0 -27
- package/dist/server/node_modules/split2/index.js +0 -141
- package/dist/server/node_modules/split2/package.json +0 -39
- package/dist/server/node_modules/split2/test.js +0 -409
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as E,D as I,j as t}from"./index-
|
|
1
|
+
import{c as E,D as I,j as t}from"./index-Di6oLb1g.js";import{C as P}from"./card-BkMKAjKJ.js";import{I as R}from"./integration-icon-DlCg0T4C.js";function q(h){const e=E.c(37),{connection:s,onClick:u,headerActions:j,headerActionsAlwaysVisible:A,body:v,footer:N,className:b,fallbackIcon:C}=h,y=A===void 0?!1:A,k=u&&"hover:bg-muted/50";let i;e[0]!==b||e[1]!==k?(i=I("cursor-pointer transition-colors group overflow-hidden flex flex-col h-full",k,b),e[0]=b,e[1]=k,e[2]=i):i=e[2];let l;e[3]!==s.icon||e[4]!==s.title||e[5]!==C?(l=t.jsx(R,{icon:s.icon,name:s.title,size:"sm",className:"shrink-0 shadow-sm",fallbackIcon:C}),e[3]=s.icon,e[4]=s.title,e[5]=C,e[6]=l):l=e[6];let o;e[7]!==j||e[8]!==y?(o=j&&t.jsx("div",{className:I("transition-opacity",!y&&"sm:opacity-0 sm:group-hover:opacity-100"),onClick:_,children:j}),e[7]=j,e[8]=y,e[9]=o):o=e[9];let n;e[10]!==o?(n=t.jsx("div",{className:"relative",children:o}),e[10]=o,e[11]=n):n=e[11];let c;e[12]!==l||e[13]!==n?(c=t.jsxs("div",{className:"flex items-start justify-between",children:[l,n]}),e[12]=l,e[13]=n,e[14]=c):c=e[14];let r;e[15]!==s.title?(r=t.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:s.title}),e[15]=s.title,e[16]=r):r=e[16];const w=s.description||"No description";let a;e[17]!==w?(a=t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:w}),e[17]=w,e[18]=a):a=e[18];let d;e[19]!==a||e[20]!==r?(d=t.jsxs("div",{className:"flex flex-col gap-1",children:[r,a]}),e[19]=a,e[20]=r,e[21]=d):d=e[21];let f;e[22]!==v?(f=v&&t.jsx("div",{children:v}),e[22]=v,e[23]=f):f=e[23];let m;e[24]!==d||e[25]!==f||e[26]!==c?(m=t.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[c,d,f]}),e[24]=d,e[25]=f,e[26]=c,e[27]=m):m=e[27];let x;e[28]!==N?(x=N&&t.jsx("div",{className:"border-t border-border mt-auto",children:t.jsx("div",{className:"h-14 flex items-center p-4.5",onClick:V,children:N})}),e[28]=N,e[29]=x):x=e[29];let p;e[30]!==m||e[31]!==x?(p=t.jsxs("div",{className:"flex flex-col flex-1",children:[m,x]}),e[30]=m,e[31]=x,e[32]=p):p=e[32];let g;return e[33]!==u||e[34]!==p||e[35]!==i?(g=t.jsx(P,{className:i,onClick:u,children:p}),e[33]=u,e[34]=p,e[35]=i,e[36]=g):g=e[36],g}function V(h){return h.stopPropagation()}function _(h){return h.stopPropagation()}export{q as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as $,j as t,B as H,r as W,D as Ne,u as oe,x as Pe,K as le,O as q,G as ye,e as re,c5 as xe,y as Oe,p as Me,E as Ve,g as ze,w as Ee,t as Re,q as Le,i as Ue,b as Fe,v as Z,a as Be}from"./index-t6xY8FYJ.js";import{g as He}from"./generate-id-Dz9QYszT.js";import{E as _e}from"./empty-state-C_h_kfhM.js";import{E as Ge,c as Xe,r as We,e as Ce}from"./env-vars-editor-Cdhuqusz.js";import{d as Qe}from"./registry-utils-q14xY1bA.js";import{u as Se,S as Ke}from"./index-CpTXJjPF.js";import{u as qe}from"./use-members-CRSSGJnt.js";import{A as Je}from"./avatar-BCNSpjov.js";import{u as we,b as Ye,a as ke}from"./use-connection-DSXGpH93.js";import{u as ce,a as Ze}from"./constants-C2NIYyeK.js";import{d as et}from"./use-mcp-tools-Ca8lRrYA.js";import{b as tt}from"./use-mcp-resources-BWxiCCmX.js";import{a as st}from"./use-mcp-prompts-DSysuR0s.js";import{B as nt,a as ot,b as pe,d as rt,e as it,c as at}from"./breadcrumb-BjaszutD.js";import{I as ie,t as Te,D as lt,Q as ct,R as dt,s as te,i as mt}from"./integration-icon-BlldxArX.js";import{i as Ae}from"./Loading01-CKkwknOS.js";import{s as ut}from"./Plus-B_tfkXz3.js";import{t as Ie}from"./Settings01-Cc_jPdtk.js";import{s as de}from"./Trash01-DFCUs2vM.js";import{f as xt,a as pt,b as ht,c as ft,d as gt,e as jt,A as vt,h as bt}from"./alert-dialog-Dqc_24Os.js";import{S as Nt,b as yt,c as _t,d as Ct,e as St}from"./index-1_kpvnU4.js";import{F as L,b as U,c as F,d as E,f as B,e as wt,a as kt}from"./form-3OFR-VJQ.js";import{I as X}from"./input-qMconvxq.js";import{g as me}from"./connection-slug-Bw8dtz1U.js";import{V as Tt}from"./layout-D0kNFrGz.js";import{c as At,C as It,B as Dt,a as $t,b as Pt,d as Ot,e as Mt}from"./monitoring-stats-row-_pMtDdXo.js";import{b as Vt}from"./use-virtual-mcp-D5bKIffF.js";import{i as De}from"./ChevronRight-8vS2LfiE.js";import{T as se,a as zt,b as ne,c as Et}from"./tabs-BcgepvIr.js";import{g as ue}from"./types-CEJbDNRj.js";import{M as Rt}from"./mcp-app-renderer-BgFTGV3R.js";import{C as Lt}from"./collection-search-C014T-nI.js";import{T as Ut}from"./tools-list-BYjVtR4b.js";import{C as Ft}from"./card-C_4nJrQs.js";import{B as Bt}from"./badge-C9kSd2rC.js";import{D as Ht,a as Gt,b as Xt,c as he}from"./dropdown-menu-5AX5yqCQ.js";import{S as fe,a as ge,b as je,c as ve,d as R}from"./select-D64t3Q_g.js";import{c as Wt}from"./XCircle-Dv-O5jd1.js";import{t as Qt}from"./ChevronDown-C4UuUfvP.js";import{n as Kt}from"./Container-OKF_GeCq.js";import{a as qt}from"./RefreshCcw01-Dd-MCL9x.js";import{s as Jt}from"./XClose-DXhO2ZT2.js";import"./binder-1tH_sZqU.js";import"./VideoRecorder-b8m_Ituf.js";import"./Play-B44HkfJ8.js";import"./extract-connection-data-BJKmDa-6.js";import"./use-install-from-registry-OGBcaDCK.js";import"./index-CU9cIMQQ.js";import"./index-B0rHyq8i.js";import"./index-BdQq_4o_.js";import"./index-aw4p2K_Q.js";import"./select-virtual-mcp-7C78QF32.js";import"./popover-CRTw2B4t.js";import"./tooltip-CKRAIo8e.js";import"./index-BKuN2Iot.js";import"./Check-wCq9US95.js";import"./SearchMd-DwH-zFLD.js";import"./use-create-virtual-mcp-CCjeFnH5.js";import"./User01-a2C2h2ws.js";import"./use-collections-CLlnuJpl.js";import"./useMutation-Bncnalv9.js";import"./useQuery-CIPIMOb2.js";import"./AlertCircle-CwQ-M1BH.js";import"./ArrowUp-C8UJr_8S.js";import"./ArrowLeft-7hoUFjWA.js";import"./Type01-DmSAzri2.js";import"./ChevronUp-eUIC7wig.js";import"./Dataflow03-CYOanaoD.js";import"./Download01-D6Ut3-TC.js";import"./List-Dm7hE_p7.js";import"./FolderClosed-DWPM1ogz.js";import"./Grid01-CFCqtKvs.js";import"./Upload01-B4UOm_Kf.js";import"./X-CVr_hKcl.js";import"./Zap-D6ZQZPYh.js";import"./label-DQB9xwZM.js";import"./slugify-CEUa2lfQ.js";import"./collection-display-button-07J7hFqi.js";import"./collection-table-wrapper-1AJGYm4t.js";import"./table-CvLgTwxu.js";function Yt(s){const e=$.c(39),{instance:n,onConfigure:r,onAuthenticate:i,onDelete:o}=s;let l;e[0]!==n.id?(l={connectionId:n.id},e[0]=n.id,e[1]=l):l=e[1];const c=Se(l),d=!(n.connection_type==="VIRTUAL")&&c.supportsOAuth&&!c.isAuthenticated,x=d?"border-destructive/50 bg-destructive/5 px-4 py-2.5":"border-transparent";let p;e[2]!==x?(p=Ne("flex items-center gap-3 rounded-lg border transition-colors",x),e[2]=x,e[3]=p):p=e[3];let a;e[4]!==n.icon||e[5]!==n.title?(a=t.jsx(ie,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[4]=n.icon,e[5]=n.title,e[6]=a):a=e[6];let f;e[7]!==n.title?(f=t.jsx("p",{className:"text-sm font-medium truncate",children:n.title}),e[7]=n.title,e[8]=f):f=e[8];let g;e[9]!==d?(g=d&&t.jsx("span",{className:"text-xs text-destructive font-medium",children:"Needs authorization"}),e[9]=d,e[10]=g):g=e[10];let b;e[11]!==f||e[12]!==g?(b=t.jsxs("div",{className:"flex-1 min-w-0",children:[f,g]}),e[11]=f,e[12]=g,e[13]=b):b=e[13];let v;e[14]!==n||e[15]!==d||e[16]!==i?(v=d&&t.jsx(H,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>i(n),children:"Authorize"}),e[14]=n,e[15]=d,e[16]=i,e[17]=v):v=e[17];let j;e[18]!==n||e[19]!==r?(j=()=>r(n),e[18]=n,e[19]=r,e[20]=j):j=e[20];let _;e[21]===Symbol.for("react.memo_cache_sentinel")?(_=t.jsx(Ie,{size:13}),e[21]=_):_=e[21];let w;e[22]!==j?(w=t.jsx(H,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:j,title:"Configure",children:_}),e[22]=j,e[23]=w):w=e[23];let C;e[24]!==n||e[25]!==o?(C=()=>o(n),e[24]=n,e[25]=o,e[26]=C):C=e[26];let N;e[27]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(de,{size:13}),e[27]=N):N=e[27];let k;e[28]!==C?(k=t.jsx(H,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:C,title:"Delete",children:N}),e[28]=C,e[29]=k):k=e[29];let y;e[30]!==w||e[31]!==k||e[32]!==v?(y=t.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[v,w,k]}),e[30]=w,e[31]=k,e[32]=v,e[33]=y):y=e[33];let T;return e[34]!==y||e[35]!==p||e[36]!==a||e[37]!==b?(T=t.jsxs("div",{className:p,children:[a,b,y]}),e[34]=y,e[35]=p,e[36]=a,e[37]=b,e[38]=T):T=e[38],T}function Zt(s){const e=$.c(15),{instance:n,onConfigure:r}=s;let i;e[0]!==n.icon||e[1]!==n.title?(i=t.jsx(ie,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[0]=n.icon,e[1]=n.title,e[2]=i):i=e[2];let o;e[3]!==n.title?(o=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("p",{className:"text-sm font-medium truncate",children:n.title})}),e[3]=n.title,e[4]=o):o=e[4];let l;e[5]!==n||e[6]!==r?(l=()=>r(n),e[5]=n,e[6]=r,e[7]=l):l=e[7];let c;e[8]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(Ie,{size:13}),e[8]=c):c=e[8];let u;e[9]!==l?(u=t.jsx("div",{className:"flex items-center gap-1 shrink-0",children:t.jsx(H,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:l,title:"Configure",children:c})}),e[9]=l,e[10]=u):u=e[10];let d;return e[11]!==i||e[12]!==o||e[13]!==u?(d=t.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-transparent transition-colors",children:[i,o,u]}),e[11]=i,e[12]=o,e[13]=u,e[14]=d):d=e[14],d}function es(s){const e=$.c(25),{instances:n,onConfigure:r,onAuthenticate:i,onDelete:o,onAdd:l,isAdding:c}=s;if(n.length===0)return null;const u=n.length===1?"Instance":"Instances";let d;e[0]!==u?(d=t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:u}),e[0]=u,e[1]=d):d=e[1];let x;e[2]!==c?(x=c?t.jsx(Ae,{size:13,className:"animate-spin"}):t.jsx(ut,{size:13}),e[2]=c,e[3]=x):x=e[3];let p;e[4]!==c||e[5]!==l||e[6]!==x?(p=t.jsxs(H,{variant:"default",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:l,disabled:c,children:[x,"Add instance"]}),e[4]=c,e[5]=l,e[6]=x,e[7]=p):p=e[7];let a;e[8]!==d||e[9]!==p?(a=t.jsxs("div",{className:"px-5 py-4 border-b border-border flex items-center justify-between",children:[d,p]}),e[8]=d,e[9]=p,e[10]=a):a=e[10];let f;if(e[11]!==n||e[12]!==i||e[13]!==r||e[14]!==o){let v;e[16]!==i||e[17]!==r||e[18]!==o?(v=j=>t.jsx(W.Suspense,{fallback:t.jsx(Zt,{instance:j,onConfigure:r}),children:t.jsx(Yt,{instance:j,onConfigure:r,onAuthenticate:i,onDelete:o})},j.id),e[16]=i,e[17]=r,e[18]=o,e[19]=v):v=e[19],f=n.map(v),e[11]=n,e[12]=i,e[13]=r,e[14]=o,e[15]=f}else f=e[15];let g;e[20]!==f?(g=t.jsx("div",{className:"p-2 flex flex-col gap-1",children:f}),e[20]=f,e[21]=g):g=e[21];let b;return e[22]!==a||e[23]!==g?(b=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[a,g]}),e[22]=a,e[23]=g,e[24]=b):b=e[24],b}const ts=[{value:"7d",label:"7d"},{value:"14d",label:"14d"},{value:"30d",label:"30d"}];function ss(s){const e=new Date,n=new Date(e);return s==="7d"?n.setDate(n.getDate()-7):s==="14d"?n.setDate(n.getDate()-14):n.setDate(n.getDate()-30),{startDate:n,endDate:e}}const ns={calls:{label:"Tool calls"},errors:{label:"Errors"}};function os(s){const e=$.c(3),{connectionId:n,orgId:r,timeframe:i}=s;let o;e[0]!==r?(o={connectionId:Ze,orgId:r},e[0]=r,e[1]=o):o=e[1];const l=ce(o),c=ss(i),{data:u}=Pe({queryKey:le.connectionActivity(n,i,r),queryFn:async()=>{const f=await l.callTool({name:"MONITORING_LOGS_LIST",arguments:{startDate:c.startDate.toISOString(),endDate:c.endDate.toISOString(),connectionId:n,limit:2e3,offset:0}});return f.structuredContent??f},staleTime:3e5}),d=At(u?.logs??[],c),x=d.data,p=d.totalCalls>0;let a;return e[2]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Tool calls"}),e[2]=a):a=e[2],t.jsxs("div",{children:[t.jsxs("div",{className:"flex gap-6 px-5 pb-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-2xl font-semibold text-foreground tabular-nums",children:d.totalCalls.toLocaleString()}),a]}),d.totalErrors>0&&t.jsxs("div",{children:[t.jsx("p",{className:"text-2xl font-semibold text-destructive tabular-nums",children:d.totalErrors.toLocaleString()}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Errors"})]}),d.avgDurationMs>0&&t.jsxs("div",{children:[t.jsxs("p",{className:"text-2xl font-semibold text-foreground tabular-nums",children:[Math.round(d.avgDurationMs),"ms"]}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Avg latency"})]})]}),p?t.jsxs("div",{children:[t.jsx(It,{config:ns,className:"h-16 w-full",children:t.jsxs(Dt,{data:x,barCategoryGap:"4%",children:[t.jsx($t,{content:t.jsx(Pt,{labelFormatter:is}),cursor:{fill:"var(--muted)"}}),t.jsx(Ot,{dataKey:"calls",radius:[2,2,0,0],minPointSize:1,children:x.map(rs)})]})}),t.jsxs("div",{className:"flex justify-between px-3 mt-1 pb-3",children:[t.jsx("span",{className:"text-[10px] text-muted-foreground",children:x[0]?.label}),t.jsx("span",{className:"text-[10px] text-muted-foreground",children:x[x.length-1]?.label})]})]}):t.jsx("div",{className:"h-20 flex items-center justify-center",children:t.jsx("p",{className:"text-sm text-muted-foreground/60",children:"No activity in this period"})})]})}function rs(s,e){return t.jsx(Mt,{fill:s.errorRate>50?"var(--destructive)":"var(--chart-1)",fillOpacity:s.calls===0?.2:s.errorRate>50?.7:.85},`cell-${e}`)}function is(s,e){const n=Array.isArray(e)?e[0]:void 0;return n&&typeof n=="object"&&"payload"in n?n.payload?.label??"":""}function as(){const s=$.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsxs("div",{children:[t.jsx("div",{className:"flex gap-6 px-5 pb-4",children:t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx("div",{className:"h-7 w-16 rounded-md bg-muted animate-pulse"}),t.jsx("div",{className:"h-3 w-14 rounded bg-muted animate-pulse"})]})}),t.jsx("div",{className:"h-20 w-full rounded-md bg-muted animate-pulse"})]}),s[0]=e):e=s[0],e}function ls(s){const e=$.c(13),{connectionId:n}=s,[r,i]=W.useState("14d"),{org:o}=oe();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("div",{children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Activity"})}),e[0]=l):l=e[0];let c;e[1]!==r?(c=ts.map(a=>t.jsx("button",{type:"button",onClick:()=>i(a.value),className:Ne("px-2.5 py-1 text-xs font-medium rounded-md transition-colors",r===a.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:a.label},a.value)),e[1]=r,e[2]=c):c=e[2];let u;e[3]!==c?(u=t.jsxs("div",{className:"px-5 py-4 flex items-center justify-between",children:[l,t.jsx("div",{className:"flex items-center gap-0.5 bg-muted rounded-lg p-0.5",children:c})]}),e[3]=c,e[4]=u):u=e[4];let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(as,{}),e[5]=d):d=e[5];let x;e[6]!==n||e[7]!==o.id||e[8]!==r?(x=t.jsx(W.Suspense,{fallback:d,children:t.jsx(os,{connectionId:n,orgId:o.id,timeframe:r})}),e[6]=n,e[7]=o.id,e[8]=r,e[9]=x):x=e[9];let p;return e[10]!==u||e[11]!==x?(p=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[u,x]}),e[10]=u,e[11]=x,e[12]=p):p=e[12],p}function cs(s){const e=$.c(14),{virtualMcp:n,org:r}=s;let i;e[0]!==r||e[1]!==n.id?(i={org:r,project:q,agentId:n.id},e[0]=r,e[1]=n.id,e[2]=i):i=e[2];let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx(Te,{size:16}),e[3]=o):o=e[3];let l;e[4]!==n.icon||e[5]!==n.title?(l=t.jsx(ie,{icon:n.icon,name:n.title,size:"xs",fallbackIcon:o}),e[4]=n.icon,e[5]=n.title,e[6]=l):l=e[6];let c;e[7]!==n.title?(c=t.jsx("span",{className:"flex-1 text-sm font-medium text-foreground truncate",children:n.title}),e[7]=n.title,e[8]=c):c=e[8];let u;e[9]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(De,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors shrink-0"}),e[9]=u):u=e[9];let d;return e[10]!==i||e[11]!==l||e[12]!==c?(d=t.jsxs(ye,{to:"/$org/$project/agents/$agentId/",params:i,className:"flex items-center gap-3 rounded-lg hover:bg-muted/50 transition-colors group",children:[l,c,u]}),e[10]=i,e[11]=l,e[12]=c,e[13]=d):d=e[13],d}function ds(s){const e=$.c(7),{virtualMcps:n,org:r}=s;let i;if(e[0]!==r||e[1]!==n){let l;e[3]!==r?(l=c=>t.jsx(cs,{virtualMcp:c,org:r},c.id),e[3]=r,e[4]=l):l=e[4],i=n.map(l),e[0]=r,e[1]=n,e[2]=i}else i=e[2];let o;return e[5]!==i?(o=t.jsx("div",{className:"flex flex-col gap-3",children:t.jsx("div",{className:"flex flex-col gap-2",children:i})}),e[5]=i,e[6]=o):o=e[6],o}function ms(s){const e=$.c(7),{connection:n}=s,{org:r}=oe();let i;e[0]!==n.id?(i={filters:[{column:"connection_id",value:n.id}]},e[0]=n.id,e[1]=i):i=e[1];const o=Vt(i);if(!(o.length>0)){let d;return e[2]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(t.Fragment,{}),e[2]=d):d=e[2],d}let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"px-5 py-4 border-b border-border",children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Used by agents"})}),e[3]=c):c=e[3];let u;return e[4]!==r.slug||e[5]!==o?(u=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[c,t.jsx("div",{className:"px-5 py-4",children:t.jsx(ds,{virtualMcps:o,org:r.slug})})]}),e[4]=r.slug,e[5]=o,e[6]=u):u=e[6],u}function us(s){const e=$.c(30),{tools:n,connectionId:r,org:i}=s,o=re(),{org:l}=oe();let c;e[0]!==r||e[1]!==l.id?(c={connectionId:r,orgId:l.id},e[0]=r,e[1]=l.id,e[2]=c):c=e[2];const u=ce(c),d=we(r);let x;e[3]!==d||e[4]!==r?(x=d?me(d):r,e[3]=d,e[4]=r,e[5]=x):x=e[5];const p=x,[a,f]=W.useState("");let g,b,v,j;if(e[6]!==p||e[7]!==u||e[8]!==o||e[9]!==i||e[10]!==a||e[11]!==n){const C=(n??[]).filter(xs),N=a.toLowerCase().trim(),k=N?C.filter(h=>h.name.toLowerCase().includes(N)||h.description&&h.description.toLowerCase().includes(N)):C;let y;e[16]!==p||e[17]!==o||e[18]!==i?(y=h=>{o({to:"/$org/$project/mcps/$appSlug/$collectionName/$itemId",params:{org:i,project:q,appSlug:p,collectionName:"tools",itemId:encodeURIComponent(h.name)}})},e[16]=p,e[17]=o,e[18]=i,e[19]=y):y=e[19];const T=y;v="flex flex-col h-full overflow-hidden";let A;e[20]===Symbol.for("react.memo_cache_sentinel")?(A=h=>{h.key==="Escape"&&(f(""),h.target.blur())},e[20]=A):A=e[20],e[21]!==a?(j=t.jsx(Lt,{value:a,onChange:f,placeholder:"Search apps...",onKeyDown:A}),e[21]=a,e[22]=j):j=e[22],g="flex-1 overflow-auto p-5",b=k.length===0?t.jsx(_e,{image:null,title:a?"No apps found":"No apps available",description:a?"Try adjusting your search terms":"This connection doesn't have any tools with interactive UIs yet."}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(320px,1fr))] gap-4",children:k.map(h=>{const I=ue(h._meta);return t.jsxs(Ft,{className:"cursor-pointer transition-colors overflow-hidden gap-0",onClick:()=>T(h),children:[t.jsx("div",{className:"h-[200px] overflow-hidden border-b border-border",children:t.jsx(Rt,{resourceURI:I,toolInfo:{tool:h},displayMode:"inline",minHeight:200,maxHeight:200,client:u})}),t.jsxs("div",{className:"flex flex-col gap-2 p-4",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:h.name}),t.jsx(Ut,{annotations:h.annotations,_meta:h._meta})]}),h.description&&t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:h.description})]})]},h.name)})}),e[6]=p,e[7]=u,e[8]=o,e[9]=i,e[10]=a,e[11]=n,e[12]=g,e[13]=b,e[14]=v,e[15]=j}else g=e[12],b=e[13],v=e[14],j=e[15];let _;e[23]!==g||e[24]!==b?(_=t.jsx("div",{className:g,children:b}),e[23]=g,e[24]=b,e[25]=_):_=e[25];let w;return e[26]!==v||e[27]!==j||e[28]!==_?(w=t.jsxs("div",{className:v,children:[j,_]}),e[26]=v,e[27]=j,e[28]=_,e[29]=w):w=e[29],w}function xs(s){return!!ue(s._meta)}function $e(s){const e=s.replace(/[._]/g," ").trim().split(/\s+/),n=l=>l.charAt(0).toUpperCase()+l.slice(1),r=new Set(["list","create","get","update","delete","fetch","search","run","trigger","review","send","check"]),i=e.map(n),o=e[e.length-1];return i.length>=2&&o&&r.has(o)?[i.pop(),...i].join(" "):i.join(" ")}function ae(s){const e=$.c(2),{label:n}=s;let r;return e[0]!==n?(r=t.jsx("div",{className:"px-5 py-8 text-center",children:t.jsxs("p",{className:"text-sm text-muted-foreground",children:["No ",n," available."]})}),e[0]=n,e[1]=r):r=e[1],r}function ps(s){const e=$.c(50),{tools:n,prompts:r,resources:i,connectionId:o,org:l}=s;let c;e[0]!==r?(c=r===void 0?[]:r,e[0]=r,e[1]=c):c=e[1];const u=c;let d;e[2]!==i?(d=i===void 0?[]:i,e[2]=i,e[3]=d):d=e[3];const x=d,p=re(),a=we(o??"");let f;e[4]!==a||e[5]!==o?(f=a?me(a):o,e[4]=a,e[5]=o,e[6]=f):f=e[6];const g=f;let b;e[7]!==g||e[8]!==o||e[9]!==p||e[10]!==l?(b=function(J){!o||!l||p({to:"/$org/$project/mcps/$appSlug/$collectionName/$itemId",params:{org:l,project:q,appSlug:g,collectionName:"tools",itemId:encodeURIComponent(J)}})},e[7]=g,e[8]=o,e[9]=p,e[10]=l,e[11]=b):b=e[11];const v=b;let j;e[12]!==o||e[13]!==l||e[14]!==n?(j=o&&l&&n.some(gs),e[12]=o,e[13]=l,e[14]=n,e[15]=j):j=e[15];const _=j;if(n.length+u.length+x.length===0){let D;return e[16]===Symbol.for("react.memo_cache_sentinel")?(D=t.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[t.jsx("h3",{className:"text-sm font-semibold text-foreground mb-1",children:"Capabilities"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"No capabilities discovered yet. The connection may still be connecting."})]}),e[16]=D):D=e[16],D}let C;e[17]!==n.length?(C=t.jsxs(se,{value:"tools",variant:"underline",children:["Tools (",n.length,")"]}),e[17]=n.length,e[18]=C):C=e[18];let N;e[19]!==_?(N=_&&t.jsx(se,{value:"apps",variant:"underline",children:"UI"}),e[19]=_,e[20]=N):N=e[20];let k,y;e[21]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(se,{value:"prompts",variant:"underline",children:"Prompts"}),y=t.jsx(se,{value:"resources",variant:"underline",children:"Resources"}),e[21]=k,e[22]=y):(k=e[21],y=e[22]);let T;e[23]!==C||e[24]!==N?(T=t.jsx("div",{className:"px-5 flex items-center justify-between border-b border-border",children:t.jsxs(zt,{variant:"underline",className:"gap-1",children:[C,N,k,y]})}),e[23]=C,e[24]=N,e[25]=T):T=e[25];let A;e[26]!==v||e[27]!==n?(A=n.length>0?n.map(D=>t.jsxs("button",{type:"button",className:"w-full flex items-start gap-3 px-5 py-3 text-left hover:bg-muted/40 transition-colors cursor-pointer",onClick:()=>v(D.name),children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx(lt,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:$e(D.name)}),D.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:D.description})]}),t.jsx(De,{size:16,className:"text-muted-foreground shrink-0 mt-0.5"})]},D.name)):t.jsx(ae,{label:"tools"}),e[26]=v,e[27]=n,e[28]=A):A=e[28];let h;e[29]!==A?(h=t.jsx(ne,{value:"tools",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:A})}),e[29]=A,e[30]=h):h=e[30];let I;e[31]!==o||e[32]!==_||e[33]!==l||e[34]!==n?(I=_&&t.jsx(ne,{value:"apps",className:"h-auto min-h-[200px]",children:t.jsx(us,{tools:n,connectionId:o,org:l})}),e[31]=o,e[32]=_,e[33]=l,e[34]=n,e[35]=I):I=e[35];let V;e[36]!==u?(V=u.length>0?u.map(fs):t.jsx(ae,{label:"prompts"}),e[36]=u,e[37]=V):V=e[37];let O;e[38]!==V?(O=t.jsx(ne,{value:"prompts",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:V})}),e[38]=V,e[39]=O):O=e[39];let S;e[40]!==x?(S=x.length>0?x.map(hs):t.jsx(ae,{label:"resources"}),e[40]=x,e[41]=S):S=e[41];let M;e[42]!==S?(M=t.jsx(ne,{value:"resources",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:S})}),e[42]=S,e[43]=M):M=e[43];let G;return e[44]!==T||e[45]!==h||e[46]!==I||e[47]!==O||e[48]!==M?(G=t.jsx("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:t.jsxs(Et,{defaultValue:"tools",variant:"underline",children:[T,h,I,O,M]})}),e[44]=T,e[45]=h,e[46]=I,e[47]=O,e[48]=M,e[49]=G):G=e[49],G}function hs(s){return t.jsxs("div",{className:"flex items-start gap-3 px-5 py-3",children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx(dt,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:s.name}),s.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:s.description}),s.uri&&t.jsx("div",{className:"text-xs text-muted-foreground/60 font-mono mt-0.5 truncate",children:s.uri})]})]},s.uri??s.name)}function fs(s){return t.jsxs("div",{className:"flex items-start gap-3 px-5 py-3",children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx(ct,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:$e(s.name)}),s.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:s.description})]})]},s.name)}function gs(s){return ue(s._meta)}function js(s){const e=$.c(13),{connection:n,displayTitle:r}=s,i=r??n.title;let o;e[0]!==n.icon||e[1]!==i?(o=t.jsx(ie,{icon:n.icon,name:i,size:"xl",className:"shrink-0"}),e[0]=n.icon,e[1]=i,e[2]=o):o=e[2];let l;e[3]!==i?(l=t.jsx("div",{className:"flex flex-wrap items-center gap-2 mb-2",children:t.jsx("h1",{className:"text-lg md:text-xl font-semibold tracking-tight text-foreground leading-none",children:i})}),e[3]=i,e[4]=l):l=e[4];let c;e[5]!==n.description?(c=n.description&&t.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed line-clamp-2",children:n.description}),e[5]=n.description,e[6]=c):c=e[6];let u;e[7]!==l||e[8]!==c?(u=t.jsxs("div",{className:"flex-1 min-w-0",children:[l,c]}),e[7]=l,e[8]=c,e[9]=u):u=e[9];let d;return e[10]!==o||e[11]!==u?(d=t.jsxs("div",{className:"flex items-center gap-4 md:gap-6 py-5 md:py-7 px-4 md:px-8 bg-background border-b border-border shrink-0",children:[o,u]}),e[10]=o,e[11]=u,e[12]=d):d=e[12],d}function vs({form:s,connection:e,hasOAuthToken:n,onReauthenticate:r,onRemoveOAuth:i}){const o=xe({control:s.control,name:"ui_type"}),l=xe({control:s.control,name:"connection_url"}),{stdioEnabled:c}=Oe(),u=(()=>{if(typeof l!="string"||!l)return!1;try{const a=new URL(l);return a.hostname==="api.githubcopilot.com"&&a.pathname.replace(/\/+$/,"")==="/mcp"}catch{return!1}})(),d=c||e.connection_type==="STDIO",x=e.connection_type==="VIRTUAL",p=x?Me(e.connection_url):null;return x?t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Type"}),t.jsxs("div",{className:"flex items-center gap-2 h-10 px-3 border border-border rounded-lg bg-muted/50",children:[t.jsx(Te,{className:"w-4 h-4 text-muted-foreground"}),t.jsx("span",{className:"text-sm",children:"Virtual MCP"})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"This connection references a Virtual MCP. Tools and resources are aggregated dynamically from the Virtual MCP's underlying connections."})]}),p&&t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Virtual MCP ID"}),t.jsx("div",{className:"flex items-center gap-2 h-10 px-3 border border-border rounded-lg bg-muted/50",children:t.jsx("code",{className:"text-sm text-muted-foreground",children:p})})]})]}):t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(L,{control:s.control,name:"ui_type",render:({field:a})=>t.jsxs(U,{className:"flex flex-col gap-3",children:[t.jsx(F,{className:"text-xs text-muted-foreground font-medium",children:"Connection"}),o!=="NPX"&&o!=="STDIO"?t.jsxs("div",{className:"flex items-stretch rounded-lg border border-border overflow-hidden",children:[t.jsxs(fe,{value:a.value,onValueChange:a.onChange,children:[t.jsx(E,{children:t.jsxs(ge,{className:"h-10 w-auto min-w-[90px] border-0 rounded-none bg-muted/50 focus:ring-0 focus:ring-offset-0",children:[t.jsx(te,{className:"w-4 h-4 text-muted-foreground shrink-0"}),t.jsx(je,{})]})}),t.jsxs(ve,{children:[t.jsx(R,{value:"HTTP",children:"HTTP"}),t.jsx(R,{value:"SSE",children:"SSE"}),t.jsx(R,{value:"Websocket",children:"Websocket"}),d&&t.jsxs(t.Fragment,{children:[t.jsx(R,{value:"NPX",children:"NPX Package"}),t.jsx(R,{value:"STDIO",children:"Custom Command"})]})]})]}),t.jsx("div",{className:"w-px bg-border"}),t.jsx(L,{control:s.control,name:"connection_url",render:({field:f})=>t.jsx(U,{className:"flex-1 min-w-0",children:t.jsx(E,{children:t.jsx(X,{placeholder:"https://example.com/mcp",...f,value:f.value??"",className:"h-10 border-0 rounded-none focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent"})})})})]}):t.jsxs(fe,{value:a.value,onValueChange:a.onChange,children:[t.jsx(E,{children:t.jsx(ge,{className:"h-10",children:t.jsx(je,{})})}),t.jsxs(ve,{children:[t.jsx(R,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(te,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(R,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(te,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(R,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(te,{className:"w-4 h-4"}),"Websocket"]})}),d&&t.jsxs(t.Fragment,{children:[t.jsx(R,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Kt,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(R,{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(B,{})]})}),o==="NPX"&&t.jsx(L,{control:s.control,name:"npx_package",render:({field:a})=>t.jsxs(U,{className:"flex flex-col gap-3",children:[t.jsx(F,{className:"text-xs text-muted-foreground font-medium",children:"NPM Package"}),t.jsx(E,{children:t.jsx(X,{placeholder:"@perplexity-ai/mcp-server",...a,value:a.value||"",className:"h-10 rounded-lg"})}),t.jsx(B,{})]})}),o==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsx(L,{control:s.control,name:"stdio_command",render:({field:a})=>t.jsxs(U,{className:"flex flex-col gap-3",children:[t.jsx(F,{className:"text-xs text-muted-foreground font-medium",children:"Command"}),t.jsx(E,{children:t.jsx(X,{placeholder:"node, bun, python...",...a,value:a.value||"",className:"h-10 rounded-lg"})}),t.jsx(B,{})]})}),t.jsx(L,{control:s.control,name:"stdio_args",render:({field:a})=>t.jsxs(U,{className:"flex flex-col gap-3",children:[t.jsx(F,{className:"text-xs text-muted-foreground font-medium",children:"Arguments"}),t.jsx(E,{children:t.jsx(X,{placeholder:"arg1 arg2 --flag value",...a,value:a.value||"",className:"h-10 rounded-lg"})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Space-separated arguments"}),t.jsx(B,{})]})})]}),t.jsx(L,{control:s.control,name:"stdio_cwd",render:({field:a})=>t.jsxs(U,{className:"flex flex-col gap-3",children:[t.jsx(F,{className:"text-xs text-muted-foreground font-medium",children:"Working Directory"}),t.jsx(E,{children:t.jsx(X,{placeholder:"/path/to/project (optional)",...a,value:a.value||"",className:"h-10 rounded-lg"})}),t.jsx(B,{})]})})]}),(o==="NPX"||o==="STDIO")&&t.jsx(L,{control:s.control,name:"env_vars",render:({field:a})=>t.jsxs(U,{className:"flex flex-col gap-3",children:[t.jsx(F,{className:"text-xs text-muted-foreground font-medium",children:"Environment Variables"}),t.jsx(E,{children:t.jsx(Ge,{value:a.value??[],onChange:a.onChange})}),t.jsx(B,{})]})}),o!=="NPX"&&o!=="STDIO"&&t.jsx(L,{control:s.control,name:"connection_token",render:({field:a})=>t.jsxs(U,{className:"flex flex-col gap-3",children:[t.jsx(F,{className:"text-xs text-muted-foreground font-medium",children:u?"GitHub Personal Access Token":"Token"}),n?t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(Ht,{children:[t.jsx(Gt,{asChild:!0,children:t.jsx("button",{type:"button",className:"inline-flex items-center gap-1.5 cursor-pointer",children:t.jsxs(Bt,{variant:"success",className:"gap-1.5",children:[t.jsx(Wt,{size:12}),"Authenticated via OAuth",t.jsx(Qt,{size:12})]})})}),t.jsxs(Xt,{align:"start",children:[t.jsxs(he,{onClick:r,children:[t.jsx(qt,{size:16}),"Re-authenticate"]}),t.jsxs(he,{variant:"destructive",onClick:i,children:[t.jsx(de,{size:16}),"Remove OAuth"]})]})]})}):e.connection_token&&a.value===null?t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"h-10 px-3 flex items-center rounded-lg border border-border bg-muted/50 text-muted-foreground font-mono text-sm",children:"••••••••••••••••"}),t.jsx("button",{type:"button",onClick:()=>a.onChange(""),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-muted opacity-0 group-hover:opacity-100 transition-opacity",title:"Clear and replace token",children:t.jsx(Jt,{size:14,className:"text-muted-foreground"})})]}):t.jsxs(t.Fragment,{children:[t.jsx(E,{children:t.jsx(X,{type:"password",placeholder:u?"Paste your GitHub PAT":"Enter access token...",...a,value:a.value||"",className:"h-10 rounded-lg"})}),u&&t.jsxs(wt,{children:["Create a PAT at"," ",t.jsx("a",{href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"github.com/settings/personal-access-tokens"})]})]}),t.jsx(B,{})]})})]})}function bs(s){return s.command==="npx"}function Ns(s){return s.args?.find(e=>!e.startsWith("-"))??""}function ys(s){return{command:s.command,args:s.args?.join(" ")??"",cwd:s.cwd??""}}function _s(s,e){const n={command:"npx",args:["-y",s]},r=Ce(e);return Object.keys(r).length>0&&(n.envVars=r),n}function Cs(s,e,n,r){const i={command:s};e.trim()&&(i.args=e.trim().split(/\s+/)),n?.trim()&&(i.cwd=n.trim());const o=Ce(r);return Object.keys(o).length>0&&(i.envVars=o),i}function be(s,e){const n={title:s.title,description:s.description??"",icon:s.icon??null,configuration_state:s.configuration_state??{},configuration_scopes:s.configuration_scopes||[]};if(s.connection_type==="STDIO"&&Fe(s.connection_headers)){const r=s.connection_headers,i=We(r.envVars);if(bs(r)){const l=Ns(r);return{...n,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:l,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:i}}const o=ys(r);return{...n,ui_type:"STDIO",connection_url:"",connection_token:null,npx_package:"",stdio_command:o.command,stdio_args:o.args,stdio_cwd:o.cwd,env_vars:i}}return{...n,ui_type:s.connection_type,connection_url:s.connection_url??"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}function Ss(s){let e,n=null,r=null,i=null;return s.ui_type==="NPX"?(e="STDIO",n="",i=_s(s.npx_package||"",s.env_vars||[])):s.ui_type==="STDIO"?(e="STDIO",n="",i=Cs(s.stdio_command||"",s.stdio_args||"",s.stdio_cwd,s.env_vars||[])):(e=s.ui_type,n=s.connection_url||"",r=s.connection_token||null),{title:s.title,description:s.description||null,icon:s.icon??null,connection_type:e,connection_url:n,...r&&{connection_token:r},...i&&{connection_headers:i},configuration_state:s.configuration_state??null,configuration_scopes:s.configuration_scopes??null}}function ws({connection:s,connectionId:e,org:n,isUpdating:r,tools:i,prompts:o,resources:l,siblings:c}){const u=re({from:"/$org/$project/mcps/$appSlug"}),d=Ee(),x=ke(),[p,a]=W.useState(null),[f,g]=W.useState(null),[b,v]=W.useState(!1),j=Se({connectionId:e}),{data:_}=qe(),w=_?.data?.members??[],C=p??s,N=w.find(m=>m.userId===C.created_by),y=s?.connection_type==="VIRTUAL"||j.isAuthenticated,A=Qe({connections:[s],binding:"MCP"}).length>0,h=Re({resolver:Le(Xe),values:be(p??s)}),I=h.formState.isDirty,V=async()=>{if(!await h.trigger())return;const z=h.getValues(),P=Ss(z),Q=p?.id??e;await x.update.mutateAsync({id:Q,data:P}),h.reset(z)},O=()=>{h.reset(be(p??s))},S=async m=>{const{token:z,tokenInfo:P,error:Q}=await Be({connectionId:m});if(Q||!z){Z.error(`Authentication failed: ${Q}`);return}if(P)try{const K=await fetch(`/api/connections/${m}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:P.accessToken,refreshToken:P.refreshToken,expiresIn:P.expiresIn,scope:P.scope,clientId:P.clientId,clientSecret:P.clientSecret,tokenEndpoint:P.tokenEndpoint})});if(!K.ok)console.error("Failed to save OAuth token:",await K.text()),await x.update.mutateAsync({id:m,data:{connection_token:z}});else try{await x.update.mutateAsync({id:m,data:{}})}catch(ee){console.warn("Failed to refresh connection tools after OAuth:",ee)}}catch(K){console.error("Error saving OAuth token:",K),await x.update.mutateAsync({id:m,data:{connection_token:z}})}else await x.update.mutateAsync({id:m,data:{connection_token:z}});const Y=new URL(`/mcp/${m}`,window.location.origin);await d.invalidateQueries({queryKey:le.isMCPAuthenticated(Y.href,null)}),Z.success("Authentication successful")},M=()=>S(s.id),G=async()=>{try{const m=await fetch(`/api/connections/${s.id}/oauth-token`,{method:"DELETE",credentials:"include"});if(!m.ok){const P=await m.text();Z.error(`Failed to remove OAuth: ${P}`);return}const z=new URL(`/mcp/${s.id}`,window.location.origin);await d.invalidateQueries({queryKey:le.isMCPAuthenticated(z.href,null)}),Z.success("OAuth removed. You can now re-authenticate with a different account.")}catch(m){console.error("Error removing OAuth token:",m),Z.error("Failed to remove OAuth")}},D=async m=>{await x.delete.mutateAsync(m.id),c.length<=1&&u({to:"/$org/$project/mcps",params:{org:n,project:q}}),g(null)},J=t.jsx(nt,{children:t.jsxs(ot,{children:[t.jsx(pe,{children:t.jsx(rt,{asChild:!0,children:t.jsx(ye,{to:"/$org/$project/mcps",params:{org:n,project:q},children:"Connections"})})}),t.jsx(it,{}),t.jsx(pe,{children:t.jsx(at,{children:(()=>{const m=c[0]??s;return m.app_name?m.title.replace(/\s*\(\d+\)\s*$/,""):m.title})()})})]})});return t.jsxs(t.Fragment,{children:[t.jsx(xt,{open:f!==null,onOpenChange:m=>{m||g(null)},children:t.jsxs(pt,{children:[t.jsxs(ht,{children:[t.jsx(ft,{children:"Disconnect instance?"}),t.jsxs(gt,{children:["This will permanently remove"," ",t.jsx("span",{className:"font-medium text-foreground",children:f?.title}),". This action cannot be undone."]})]}),t.jsxs(jt,{children:[t.jsx(vt,{children:"Cancel"}),t.jsx(bt,{onClick:()=>f&&D(f),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})}),t.jsx(Nt,{open:p!==null,onOpenChange:m=>{m||a(null)},children:t.jsxs(yt,{side:"right",className:"sm:max-w-[520px] p-0 flex flex-col gap-0 overflow-hidden",children:[t.jsxs(_t,{className:"px-4 py-3 md:px-6 md:py-4 border-b border-border shrink-0",children:[t.jsx(Ct,{className:"text-base",children:p?.title??s.title}),t.jsx(St,{className:"text-xs",children:"Update URL, authentication, and other settings"}),N&&t.jsxs("div",{className:"flex items-center gap-1.5 pt-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:"Connected by"}),t.jsx(Je,{url:N.user?.image??void 0,fallback:N.user?.name??N.user?.email??"?",size:"3xs",shape:"circle"}),t.jsx("span",{className:"text-xs font-medium text-foreground",children:N.user?.name||N.user?.email})]})]}),t.jsxs(kt,{...h,children:[t.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3 md:px-6 md:py-5 flex flex-col gap-4 md:gap-6",children:[t.jsxs("div",{className:"flex flex-col gap-3 md:gap-4",children:[t.jsx(L,{control:h.control,name:"title",render:({field:m})=>t.jsxs(U,{children:[t.jsx(F,{children:"Name"}),t.jsx(E,{children:t.jsx(X,{...m})}),t.jsx(B,{})]})}),t.jsx(L,{control:h.control,name:"description",render:({field:m})=>t.jsxs(U,{children:[t.jsx(F,{children:"Description"}),t.jsx(E,{children:t.jsx(X,{...m,value:m.value||""})}),t.jsx(B,{})]})})]}),t.jsx(vs,{form:h,connection:p??s,hasOAuthToken:j.hasOAuthToken,onReauthenticate:M,onRemoveOAuth:G}),t.jsx(Ke,{connection:p??s,form:h,hasMcpBinding:A,isMCPAuthenticated:y,supportsOAuth:j.supportsOAuth,isServerError:j.isServerError,onAuthenticate:M,onViewReadme:void 0})]}),t.jsxs("div",{className:"px-6 py-4 border-t border-border flex gap-2 shrink-0",children:[t.jsx(H,{onClick:V,disabled:!I||r,className:"flex-1",children:r?"Saving…":"Save changes"}),I&&t.jsx(H,{variant:"outline",onClick:O,children:"Undo"}),t.jsxs(H,{variant:"outline",className:"gap-2 text-muted-foreground hover:text-destructive hover:border-destructive",onClick:()=>{const m=p??s;a(null),g(m)},children:[t.jsx(de,{size:15}),"Delete"]})]})]},p?.id??s.id)]})}),t.jsx(Tt,{breadcrumb:J,children:t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[t.jsx(js,{connection:s,displayTitle:(()=>{const m=c[0]??s;return m.app_name?m.title.replace(/\s*\(\d+\)\s*$/,""):m.title})()}),t.jsx("div",{className:"flex-1 overflow-auto @container",children:t.jsxs("div",{className:"grid grid-cols-1 @3xl:grid-cols-2 gap-5 p-6",children:[t.jsx(ls,{connectionId:e}),t.jsxs("div",{className:"flex flex-col gap-5",children:[t.jsx(es,{instances:c,onConfigure:m=>a(m),onAuthenticate:m=>S(m.id),onDelete:m=>g(m),isAdding:b,onAdd:async()=>{v(!0);try{const m=c[0]??s,z=m.title.replace(/\s*\(\d+\)\s*$/,""),P=c.length+1,Q=`${z} (${P})`,Y=He("conn");await x.create.mutateAsync({id:Y,title:Q,description:m.description??null,connection_type:m.connection_type,connection_url:m.connection_url??null,connection_token:null,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:m.created_by,organization_id:m.organization_id,icon:m.icon??null,app_name:m.app_name??null,app_id:m.app_id??null,connection_headers:m.connection_headers??null,oauth_config:null,configuration_state:m.configuration_state??null,metadata:null,tools:null,bindings:null,status:"inactive"});const K=new URL(`/mcp/${Y}`,window.location.origin),ee=await Ue({url:K.href,token:null});ee.supportsOAuth&&!ee.isAuthenticated&&await S(Y)}finally{v(!1)}}}),t.jsx(ms,{connection:s})]}),t.jsx("div",{className:"@3xl:col-span-2",children:t.jsx(ps,{tools:i,prompts:o,resources:l,connectionId:e,org:n})})]})})]})})]})}function ks(){const s=$.c(30);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/$org/$project/mcps/$appSlug"},s[0]=e):e=s[0];const n=re(e);let r;s[1]===Symbol.for("react.memo_cache_sentinel")?(r={from:"/shell/$org/$project/mcps/$appSlug"},s[1]=r):r=s[1];const{appSlug:i,org:o}=ze(r),{org:l}=oe(),c=Ye(),u=ke();let d;s[2]!==i?(d=S=>S.connection_type!=="VIRTUAL"&&me(S)===i,s[2]=i,s[3]=d):d=s[3];const x=c.filter(d),p=x[0]??null,a=p?.id??"",f=ce({connectionId:a||null,orgId:l.id});let g;s[4]!==f?(g={client:f},s[4]=f,s[5]=g):g=s[5];const{data:b}=et(g),v=b?b.tools.map(Ps):(p?.tools??[]).map($s);let j;e:{if(x.length<=1){j=v;break e}const S=new Set,M=[],G=Is;for(const D of x){const J=D.id===a?v:G(D.tools);for(const m of J)S.has(m.name)||(S.add(m.name),M.push(m))}j=M.length>0?M:v}const _=j;let w;s[6]!==f?(w={client:f},s[6]=f,s[7]=w):w=s[7];const{data:C}=st(w);let N;s[8]!==f?(N={client:f},s[8]=f,s[9]=N):N=s[9];const{data:k}=tt(N);let y;s[10]!==C?.prompts?(y=C?.prompts??[],s[10]=C?.prompts,s[11]=y):y=s[11];let T;s[12]!==y?(T=y.map(As),s[12]=y,s[13]=T):T=s[13];const A=T;let h;s[14]!==k?.resources?(h=k?.resources??[],s[14]=k?.resources,s[15]=h):h=s[15];let I;s[16]!==h?(I=h.map(Ts),s[16]=h,s[17]=I):I=s[17];const V=I;if(!p){let S;return s[18]!==n||s[19]!==o?(S=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(_e,{title:"Connection not found",description:"This connection may have been deleted or you may not have access.",actions:t.jsx(H,{variant:"outline",onClick:()=>n({to:"/$org/$project/mcps",params:{org:o,project:q}}),children:"Back to connections"})})}),s[18]=n,s[19]=o,s[20]=S):S=s[20],S}let O;return s[21]!==u.update.isPending||s[22]!==_||s[23]!==p||s[24]!==a||s[25]!==o||s[26]!==A||s[27]!==V||s[28]!==x?(O=t.jsx(ws,{org:o,connection:p,connectionId:a,isUpdating:u.update.isPending,tools:_,prompts:A,resources:V,siblings:x}),s[21]=u.update.isPending,s[22]=_,s[23]=p,s[24]=a,s[25]=o,s[26]=A,s[27]=V,s[28]=x,s[29]=O):O=s[29],O}function Ts(s){return{name:s.name,description:s.description,uri:s.uri}}function As(s){return{name:s.name,description:s.description}}function Is(s){return(s??[]).map(Ds)}function Ds(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema??{},outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function $s(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function Ps(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function Os(){const s=$.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Ve,{children:t.jsx(W.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:t.jsx(Ae,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(ks,{})})}),s[0]=e):e=s[0],e}function lo(){const s=$.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Os,{}),s[0]=e):e=s[0],e}export{lo as default};
|
|
1
|
+
import{c as $,j as t,B as H,r as W,D as Ne,u as oe,x as Pe,K as le,O as q,G as ye,e as re,c5 as xe,y as Oe,p as Me,E as Ve,g as ze,w as Ee,t as Re,q as Le,i as Ue,b as Fe,v as Z,a as Be}from"./index-Di6oLb1g.js";import{g as He}from"./generate-id-B0hqIne-.js";import{E as _e}from"./empty-state-UToLDOJO.js";import{E as Ge,c as Xe,r as We,e as Ce}from"./env-vars-editor-D3JHoO0m.js";import{d as Qe}from"./registry-utils-B2MGgFdM.js";import{u as Se,S as Ke}from"./index-BsYB-j4p.js";import{u as qe}from"./use-members-CbUEMp3B.js";import{A as Je}from"./avatar-CahK8DWE.js";import{u as we,b as Ye,a as ke}from"./use-connection-CJIltDo3.js";import{u as ce,a as Ze}from"./constants-kAo23sAc.js";import{d as et}from"./use-mcp-tools-BD0zsUGc.js";import{b as tt}from"./use-mcp-resources-BIFxFRhN.js";import{a as st}from"./use-mcp-prompts-zeDoy0Xo.js";import{B as nt,a as ot,b as pe,d as rt,e as it,c as at}from"./breadcrumb-DBLmG8ET.js";import{I as ie,t as Te,D as lt,Q as ct,R as dt,s as te,i as mt}from"./integration-icon-DlCg0T4C.js";import{i as Ae}from"./Loading01-ZUH_hVSq.js";import{s as ut}from"./Plus-D9CNWrFQ.js";import{t as Ie}from"./Settings01-DTaoTYj1.js";import{s as de}from"./Trash01-Cv31wiMP.js";import{f as xt,a as pt,b as ht,c as ft,d as gt,e as jt,A as vt,h as bt}from"./alert-dialog-DnwDlp7T.js";import{S as Nt,b as yt,c as _t,d as Ct,e as St}from"./index-B3DLUye8.js";import{F as L,b as U,c as F,d as E,f as B,e as wt,a as kt}from"./form-edx7u0Be.js";import{I as X}from"./input-DQ4QcwHR.js";import{g as me}from"./connection-slug-Bw8dtz1U.js";import{V as Tt}from"./layout-DtwUtGx0.js";import{c as At,C as It,B as Dt,a as $t,b as Pt,d as Ot,e as Mt}from"./monitoring-stats-row-vvMdV41p.js";import{b as Vt}from"./use-virtual-mcp-BdGbK3Wg.js";import{i as De}from"./ChevronRight-2xVQHhsF.js";import{T as se,a as zt,b as ne,c as Et}from"./tabs-Co0v-Gtu.js";import{g as ue}from"./types-C4sVrknd.js";import{M as Rt}from"./mcp-app-renderer-Cg9Eew2n.js";import{C as Lt}from"./collection-search-BaA_5hnO.js";import{T as Ut}from"./tools-list-SO4mO2yz.js";import{C as Ft}from"./card-BkMKAjKJ.js";import{B as Bt}from"./badge-a1yIqkX1.js";import{D as Ht,a as Gt,b as Xt,c as he}from"./dropdown-menu-KiFp7XSX.js";import{S as fe,a as ge,b as je,c as ve,d as R}from"./select-DE6nOtq4.js";import{c as Wt}from"./XCircle-BEC1SvTX.js";import{t as Qt}from"./ChevronDown-Cm9SuGtV.js";import{n as Kt}from"./Container-sfWYtc36.js";import{a as qt}from"./RefreshCcw01-Cu6svfY5.js";import{s as Jt}from"./XClose-BzyTilGE.js";import"./binder-B_Xezby6.js";import"./VideoRecorder-CqjZf9cg.js";import"./Play-CCpyKlpN.js";import"./extract-connection-data-GhIKo0Xr.js";import"./use-install-from-registry-BUPQMjUV.js";import"./index-Bf3XZpZk.js";import"./index-CyaqcTbn.js";import"./index-BdQq_4o_.js";import"./index-Ca6dFB6s.js";import"./select-virtual-mcp-BcDL714M.js";import"./popover-DnP50c_4.js";import"./tooltip-Bt2vWRpT.js";import"./index-C45O1mgu.js";import"./Check-CecxQkQE.js";import"./SearchMd-BH_J7-7p.js";import"./use-create-virtual-mcp-D7i1HcQg.js";import"./User01-BloSEKZw.js";import"./use-collections-CojcRvND.js";import"./useMutation-BOcaN318.js";import"./useQuery-BrfnS-T_.js";import"./AlertCircle-D2rRA9CS.js";import"./ArrowUp-CpDF-NAu.js";import"./ArrowLeft-D4bkD9qi.js";import"./Type01-BRLQyycA.js";import"./ChevronUp-B6bu9ZD3.js";import"./Dataflow03-BcXlVxgR.js";import"./Download01-DGSbxmSo.js";import"./List-CnkQuVUq.js";import"./FolderClosed-DlY-lqwP.js";import"./Grid01-CLnEHof5.js";import"./Upload01-BY6Noksk.js";import"./X-1dO_8PIJ.js";import"./Zap-D6SUOiFY.js";import"./label-BGeQL0ka.js";import"./slugify-CEUa2lfQ.js";import"./collection-display-button-BTy8OMGo.js";import"./collection-table-wrapper-CeDvXZ6e.js";import"./table-BtUXt-LB.js";function Yt(s){const e=$.c(39),{instance:n,onConfigure:r,onAuthenticate:i,onDelete:o}=s;let l;e[0]!==n.id?(l={connectionId:n.id},e[0]=n.id,e[1]=l):l=e[1];const c=Se(l),d=!(n.connection_type==="VIRTUAL")&&c.supportsOAuth&&!c.isAuthenticated,x=d?"border-destructive/50 bg-destructive/5 px-4 py-2.5":"border-transparent";let p;e[2]!==x?(p=Ne("flex items-center gap-3 rounded-lg border transition-colors",x),e[2]=x,e[3]=p):p=e[3];let a;e[4]!==n.icon||e[5]!==n.title?(a=t.jsx(ie,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[4]=n.icon,e[5]=n.title,e[6]=a):a=e[6];let f;e[7]!==n.title?(f=t.jsx("p",{className:"text-sm font-medium truncate",children:n.title}),e[7]=n.title,e[8]=f):f=e[8];let g;e[9]!==d?(g=d&&t.jsx("span",{className:"text-xs text-destructive font-medium",children:"Needs authorization"}),e[9]=d,e[10]=g):g=e[10];let b;e[11]!==f||e[12]!==g?(b=t.jsxs("div",{className:"flex-1 min-w-0",children:[f,g]}),e[11]=f,e[12]=g,e[13]=b):b=e[13];let v;e[14]!==n||e[15]!==d||e[16]!==i?(v=d&&t.jsx(H,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>i(n),children:"Authorize"}),e[14]=n,e[15]=d,e[16]=i,e[17]=v):v=e[17];let j;e[18]!==n||e[19]!==r?(j=()=>r(n),e[18]=n,e[19]=r,e[20]=j):j=e[20];let _;e[21]===Symbol.for("react.memo_cache_sentinel")?(_=t.jsx(Ie,{size:13}),e[21]=_):_=e[21];let w;e[22]!==j?(w=t.jsx(H,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:j,title:"Configure",children:_}),e[22]=j,e[23]=w):w=e[23];let C;e[24]!==n||e[25]!==o?(C=()=>o(n),e[24]=n,e[25]=o,e[26]=C):C=e[26];let N;e[27]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(de,{size:13}),e[27]=N):N=e[27];let k;e[28]!==C?(k=t.jsx(H,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:C,title:"Delete",children:N}),e[28]=C,e[29]=k):k=e[29];let y;e[30]!==w||e[31]!==k||e[32]!==v?(y=t.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[v,w,k]}),e[30]=w,e[31]=k,e[32]=v,e[33]=y):y=e[33];let T;return e[34]!==y||e[35]!==p||e[36]!==a||e[37]!==b?(T=t.jsxs("div",{className:p,children:[a,b,y]}),e[34]=y,e[35]=p,e[36]=a,e[37]=b,e[38]=T):T=e[38],T}function Zt(s){const e=$.c(15),{instance:n,onConfigure:r}=s;let i;e[0]!==n.icon||e[1]!==n.title?(i=t.jsx(ie,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[0]=n.icon,e[1]=n.title,e[2]=i):i=e[2];let o;e[3]!==n.title?(o=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("p",{className:"text-sm font-medium truncate",children:n.title})}),e[3]=n.title,e[4]=o):o=e[4];let l;e[5]!==n||e[6]!==r?(l=()=>r(n),e[5]=n,e[6]=r,e[7]=l):l=e[7];let c;e[8]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(Ie,{size:13}),e[8]=c):c=e[8];let u;e[9]!==l?(u=t.jsx("div",{className:"flex items-center gap-1 shrink-0",children:t.jsx(H,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:l,title:"Configure",children:c})}),e[9]=l,e[10]=u):u=e[10];let d;return e[11]!==i||e[12]!==o||e[13]!==u?(d=t.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-transparent transition-colors",children:[i,o,u]}),e[11]=i,e[12]=o,e[13]=u,e[14]=d):d=e[14],d}function es(s){const e=$.c(25),{instances:n,onConfigure:r,onAuthenticate:i,onDelete:o,onAdd:l,isAdding:c}=s;if(n.length===0)return null;const u=n.length===1?"Instance":"Instances";let d;e[0]!==u?(d=t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:u}),e[0]=u,e[1]=d):d=e[1];let x;e[2]!==c?(x=c?t.jsx(Ae,{size:13,className:"animate-spin"}):t.jsx(ut,{size:13}),e[2]=c,e[3]=x):x=e[3];let p;e[4]!==c||e[5]!==l||e[6]!==x?(p=t.jsxs(H,{variant:"default",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:l,disabled:c,children:[x,"Add instance"]}),e[4]=c,e[5]=l,e[6]=x,e[7]=p):p=e[7];let a;e[8]!==d||e[9]!==p?(a=t.jsxs("div",{className:"px-5 py-4 border-b border-border flex items-center justify-between",children:[d,p]}),e[8]=d,e[9]=p,e[10]=a):a=e[10];let f;if(e[11]!==n||e[12]!==i||e[13]!==r||e[14]!==o){let v;e[16]!==i||e[17]!==r||e[18]!==o?(v=j=>t.jsx(W.Suspense,{fallback:t.jsx(Zt,{instance:j,onConfigure:r}),children:t.jsx(Yt,{instance:j,onConfigure:r,onAuthenticate:i,onDelete:o})},j.id),e[16]=i,e[17]=r,e[18]=o,e[19]=v):v=e[19],f=n.map(v),e[11]=n,e[12]=i,e[13]=r,e[14]=o,e[15]=f}else f=e[15];let g;e[20]!==f?(g=t.jsx("div",{className:"p-2 flex flex-col gap-1",children:f}),e[20]=f,e[21]=g):g=e[21];let b;return e[22]!==a||e[23]!==g?(b=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[a,g]}),e[22]=a,e[23]=g,e[24]=b):b=e[24],b}const ts=[{value:"7d",label:"7d"},{value:"14d",label:"14d"},{value:"30d",label:"30d"}];function ss(s){const e=new Date,n=new Date(e);return s==="7d"?n.setDate(n.getDate()-7):s==="14d"?n.setDate(n.getDate()-14):n.setDate(n.getDate()-30),{startDate:n,endDate:e}}const ns={calls:{label:"Tool calls"},errors:{label:"Errors"}};function os(s){const e=$.c(3),{connectionId:n,orgId:r,timeframe:i}=s;let o;e[0]!==r?(o={connectionId:Ze,orgId:r},e[0]=r,e[1]=o):o=e[1];const l=ce(o),c=ss(i),{data:u}=Pe({queryKey:le.connectionActivity(n,i,r),queryFn:async()=>{const f=await l.callTool({name:"MONITORING_LOGS_LIST",arguments:{startDate:c.startDate.toISOString(),endDate:c.endDate.toISOString(),connectionId:n,limit:2e3,offset:0}});return f.structuredContent??f},staleTime:3e5}),d=At(u?.logs??[],c),x=d.data,p=d.totalCalls>0;let a;return e[2]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Tool calls"}),e[2]=a):a=e[2],t.jsxs("div",{children:[t.jsxs("div",{className:"flex gap-6 px-5 pb-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-2xl font-semibold text-foreground tabular-nums",children:d.totalCalls.toLocaleString()}),a]}),d.totalErrors>0&&t.jsxs("div",{children:[t.jsx("p",{className:"text-2xl font-semibold text-destructive tabular-nums",children:d.totalErrors.toLocaleString()}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Errors"})]}),d.avgDurationMs>0&&t.jsxs("div",{children:[t.jsxs("p",{className:"text-2xl font-semibold text-foreground tabular-nums",children:[Math.round(d.avgDurationMs),"ms"]}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Avg latency"})]})]}),p?t.jsxs("div",{children:[t.jsx(It,{config:ns,className:"h-16 w-full",children:t.jsxs(Dt,{data:x,barCategoryGap:"4%",children:[t.jsx($t,{content:t.jsx(Pt,{labelFormatter:is}),cursor:{fill:"var(--muted)"}}),t.jsx(Ot,{dataKey:"calls",radius:[2,2,0,0],minPointSize:1,children:x.map(rs)})]})}),t.jsxs("div",{className:"flex justify-between px-3 mt-1 pb-3",children:[t.jsx("span",{className:"text-[10px] text-muted-foreground",children:x[0]?.label}),t.jsx("span",{className:"text-[10px] text-muted-foreground",children:x[x.length-1]?.label})]})]}):t.jsx("div",{className:"h-20 flex items-center justify-center",children:t.jsx("p",{className:"text-sm text-muted-foreground/60",children:"No activity in this period"})})]})}function rs(s,e){return t.jsx(Mt,{fill:s.errorRate>50?"var(--destructive)":"var(--chart-1)",fillOpacity:s.calls===0?.2:s.errorRate>50?.7:.85},`cell-${e}`)}function is(s,e){const n=Array.isArray(e)?e[0]:void 0;return n&&typeof n=="object"&&"payload"in n?n.payload?.label??"":""}function as(){const s=$.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsxs("div",{children:[t.jsx("div",{className:"flex gap-6 px-5 pb-4",children:t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx("div",{className:"h-7 w-16 rounded-md bg-muted animate-pulse"}),t.jsx("div",{className:"h-3 w-14 rounded bg-muted animate-pulse"})]})}),t.jsx("div",{className:"h-20 w-full rounded-md bg-muted animate-pulse"})]}),s[0]=e):e=s[0],e}function ls(s){const e=$.c(13),{connectionId:n}=s,[r,i]=W.useState("14d"),{org:o}=oe();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("div",{children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Activity"})}),e[0]=l):l=e[0];let c;e[1]!==r?(c=ts.map(a=>t.jsx("button",{type:"button",onClick:()=>i(a.value),className:Ne("px-2.5 py-1 text-xs font-medium rounded-md transition-colors",r===a.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:a.label},a.value)),e[1]=r,e[2]=c):c=e[2];let u;e[3]!==c?(u=t.jsxs("div",{className:"px-5 py-4 flex items-center justify-between",children:[l,t.jsx("div",{className:"flex items-center gap-0.5 bg-muted rounded-lg p-0.5",children:c})]}),e[3]=c,e[4]=u):u=e[4];let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(as,{}),e[5]=d):d=e[5];let x;e[6]!==n||e[7]!==o.id||e[8]!==r?(x=t.jsx(W.Suspense,{fallback:d,children:t.jsx(os,{connectionId:n,orgId:o.id,timeframe:r})}),e[6]=n,e[7]=o.id,e[8]=r,e[9]=x):x=e[9];let p;return e[10]!==u||e[11]!==x?(p=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[u,x]}),e[10]=u,e[11]=x,e[12]=p):p=e[12],p}function cs(s){const e=$.c(14),{virtualMcp:n,org:r}=s;let i;e[0]!==r||e[1]!==n.id?(i={org:r,project:q,agentId:n.id},e[0]=r,e[1]=n.id,e[2]=i):i=e[2];let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx(Te,{size:16}),e[3]=o):o=e[3];let l;e[4]!==n.icon||e[5]!==n.title?(l=t.jsx(ie,{icon:n.icon,name:n.title,size:"xs",fallbackIcon:o}),e[4]=n.icon,e[5]=n.title,e[6]=l):l=e[6];let c;e[7]!==n.title?(c=t.jsx("span",{className:"flex-1 text-sm font-medium text-foreground truncate",children:n.title}),e[7]=n.title,e[8]=c):c=e[8];let u;e[9]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(De,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors shrink-0"}),e[9]=u):u=e[9];let d;return e[10]!==i||e[11]!==l||e[12]!==c?(d=t.jsxs(ye,{to:"/$org/$project/agents/$agentId/",params:i,className:"flex items-center gap-3 rounded-lg hover:bg-muted/50 transition-colors group",children:[l,c,u]}),e[10]=i,e[11]=l,e[12]=c,e[13]=d):d=e[13],d}function ds(s){const e=$.c(7),{virtualMcps:n,org:r}=s;let i;if(e[0]!==r||e[1]!==n){let l;e[3]!==r?(l=c=>t.jsx(cs,{virtualMcp:c,org:r},c.id),e[3]=r,e[4]=l):l=e[4],i=n.map(l),e[0]=r,e[1]=n,e[2]=i}else i=e[2];let o;return e[5]!==i?(o=t.jsx("div",{className:"flex flex-col gap-3",children:t.jsx("div",{className:"flex flex-col gap-2",children:i})}),e[5]=i,e[6]=o):o=e[6],o}function ms(s){const e=$.c(7),{connection:n}=s,{org:r}=oe();let i;e[0]!==n.id?(i={filters:[{column:"connection_id",value:n.id}]},e[0]=n.id,e[1]=i):i=e[1];const o=Vt(i);if(!(o.length>0)){let d;return e[2]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(t.Fragment,{}),e[2]=d):d=e[2],d}let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"px-5 py-4 border-b border-border",children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Used by agents"})}),e[3]=c):c=e[3];let u;return e[4]!==r.slug||e[5]!==o?(u=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[c,t.jsx("div",{className:"px-5 py-4",children:t.jsx(ds,{virtualMcps:o,org:r.slug})})]}),e[4]=r.slug,e[5]=o,e[6]=u):u=e[6],u}function us(s){const e=$.c(30),{tools:n,connectionId:r,org:i}=s,o=re(),{org:l}=oe();let c;e[0]!==r||e[1]!==l.id?(c={connectionId:r,orgId:l.id},e[0]=r,e[1]=l.id,e[2]=c):c=e[2];const u=ce(c),d=we(r);let x;e[3]!==d||e[4]!==r?(x=d?me(d):r,e[3]=d,e[4]=r,e[5]=x):x=e[5];const p=x,[a,f]=W.useState("");let g,b,v,j;if(e[6]!==p||e[7]!==u||e[8]!==o||e[9]!==i||e[10]!==a||e[11]!==n){const C=(n??[]).filter(xs),N=a.toLowerCase().trim(),k=N?C.filter(h=>h.name.toLowerCase().includes(N)||h.description&&h.description.toLowerCase().includes(N)):C;let y;e[16]!==p||e[17]!==o||e[18]!==i?(y=h=>{o({to:"/$org/$project/mcps/$appSlug/$collectionName/$itemId",params:{org:i,project:q,appSlug:p,collectionName:"tools",itemId:encodeURIComponent(h.name)}})},e[16]=p,e[17]=o,e[18]=i,e[19]=y):y=e[19];const T=y;v="flex flex-col h-full overflow-hidden";let A;e[20]===Symbol.for("react.memo_cache_sentinel")?(A=h=>{h.key==="Escape"&&(f(""),h.target.blur())},e[20]=A):A=e[20],e[21]!==a?(j=t.jsx(Lt,{value:a,onChange:f,placeholder:"Search apps...",onKeyDown:A}),e[21]=a,e[22]=j):j=e[22],g="flex-1 overflow-auto p-5",b=k.length===0?t.jsx(_e,{image:null,title:a?"No apps found":"No apps available",description:a?"Try adjusting your search terms":"This connection doesn't have any tools with interactive UIs yet."}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(320px,1fr))] gap-4",children:k.map(h=>{const I=ue(h._meta);return t.jsxs(Ft,{className:"cursor-pointer transition-colors overflow-hidden gap-0",onClick:()=>T(h),children:[t.jsx("div",{className:"h-[200px] overflow-hidden border-b border-border",children:t.jsx(Rt,{resourceURI:I,toolInfo:{tool:h},displayMode:"inline",minHeight:200,maxHeight:200,client:u})}),t.jsxs("div",{className:"flex flex-col gap-2 p-4",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:h.name}),t.jsx(Ut,{annotations:h.annotations,_meta:h._meta})]}),h.description&&t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:h.description})]})]},h.name)})}),e[6]=p,e[7]=u,e[8]=o,e[9]=i,e[10]=a,e[11]=n,e[12]=g,e[13]=b,e[14]=v,e[15]=j}else g=e[12],b=e[13],v=e[14],j=e[15];let _;e[23]!==g||e[24]!==b?(_=t.jsx("div",{className:g,children:b}),e[23]=g,e[24]=b,e[25]=_):_=e[25];let w;return e[26]!==v||e[27]!==j||e[28]!==_?(w=t.jsxs("div",{className:v,children:[j,_]}),e[26]=v,e[27]=j,e[28]=_,e[29]=w):w=e[29],w}function xs(s){return!!ue(s._meta)}function $e(s){const e=s.replace(/[._]/g," ").trim().split(/\s+/),n=l=>l.charAt(0).toUpperCase()+l.slice(1),r=new Set(["list","create","get","update","delete","fetch","search","run","trigger","review","send","check"]),i=e.map(n),o=e[e.length-1];return i.length>=2&&o&&r.has(o)?[i.pop(),...i].join(" "):i.join(" ")}function ae(s){const e=$.c(2),{label:n}=s;let r;return e[0]!==n?(r=t.jsx("div",{className:"px-5 py-8 text-center",children:t.jsxs("p",{className:"text-sm text-muted-foreground",children:["No ",n," available."]})}),e[0]=n,e[1]=r):r=e[1],r}function ps(s){const e=$.c(50),{tools:n,prompts:r,resources:i,connectionId:o,org:l}=s;let c;e[0]!==r?(c=r===void 0?[]:r,e[0]=r,e[1]=c):c=e[1];const u=c;let d;e[2]!==i?(d=i===void 0?[]:i,e[2]=i,e[3]=d):d=e[3];const x=d,p=re(),a=we(o??"");let f;e[4]!==a||e[5]!==o?(f=a?me(a):o,e[4]=a,e[5]=o,e[6]=f):f=e[6];const g=f;let b;e[7]!==g||e[8]!==o||e[9]!==p||e[10]!==l?(b=function(J){!o||!l||p({to:"/$org/$project/mcps/$appSlug/$collectionName/$itemId",params:{org:l,project:q,appSlug:g,collectionName:"tools",itemId:encodeURIComponent(J)}})},e[7]=g,e[8]=o,e[9]=p,e[10]=l,e[11]=b):b=e[11];const v=b;let j;e[12]!==o||e[13]!==l||e[14]!==n?(j=o&&l&&n.some(gs),e[12]=o,e[13]=l,e[14]=n,e[15]=j):j=e[15];const _=j;if(n.length+u.length+x.length===0){let D;return e[16]===Symbol.for("react.memo_cache_sentinel")?(D=t.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[t.jsx("h3",{className:"text-sm font-semibold text-foreground mb-1",children:"Capabilities"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"No capabilities discovered yet. The connection may still be connecting."})]}),e[16]=D):D=e[16],D}let C;e[17]!==n.length?(C=t.jsxs(se,{value:"tools",variant:"underline",children:["Tools (",n.length,")"]}),e[17]=n.length,e[18]=C):C=e[18];let N;e[19]!==_?(N=_&&t.jsx(se,{value:"apps",variant:"underline",children:"UI"}),e[19]=_,e[20]=N):N=e[20];let k,y;e[21]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(se,{value:"prompts",variant:"underline",children:"Prompts"}),y=t.jsx(se,{value:"resources",variant:"underline",children:"Resources"}),e[21]=k,e[22]=y):(k=e[21],y=e[22]);let T;e[23]!==C||e[24]!==N?(T=t.jsx("div",{className:"px-5 flex items-center justify-between border-b border-border",children:t.jsxs(zt,{variant:"underline",className:"gap-1",children:[C,N,k,y]})}),e[23]=C,e[24]=N,e[25]=T):T=e[25];let A;e[26]!==v||e[27]!==n?(A=n.length>0?n.map(D=>t.jsxs("button",{type:"button",className:"w-full flex items-start gap-3 px-5 py-3 text-left hover:bg-muted/40 transition-colors cursor-pointer",onClick:()=>v(D.name),children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx(lt,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:$e(D.name)}),D.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:D.description})]}),t.jsx(De,{size:16,className:"text-muted-foreground shrink-0 mt-0.5"})]},D.name)):t.jsx(ae,{label:"tools"}),e[26]=v,e[27]=n,e[28]=A):A=e[28];let h;e[29]!==A?(h=t.jsx(ne,{value:"tools",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:A})}),e[29]=A,e[30]=h):h=e[30];let I;e[31]!==o||e[32]!==_||e[33]!==l||e[34]!==n?(I=_&&t.jsx(ne,{value:"apps",className:"h-auto min-h-[200px]",children:t.jsx(us,{tools:n,connectionId:o,org:l})}),e[31]=o,e[32]=_,e[33]=l,e[34]=n,e[35]=I):I=e[35];let V;e[36]!==u?(V=u.length>0?u.map(fs):t.jsx(ae,{label:"prompts"}),e[36]=u,e[37]=V):V=e[37];let O;e[38]!==V?(O=t.jsx(ne,{value:"prompts",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:V})}),e[38]=V,e[39]=O):O=e[39];let S;e[40]!==x?(S=x.length>0?x.map(hs):t.jsx(ae,{label:"resources"}),e[40]=x,e[41]=S):S=e[41];let M;e[42]!==S?(M=t.jsx(ne,{value:"resources",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:S})}),e[42]=S,e[43]=M):M=e[43];let G;return e[44]!==T||e[45]!==h||e[46]!==I||e[47]!==O||e[48]!==M?(G=t.jsx("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:t.jsxs(Et,{defaultValue:"tools",variant:"underline",children:[T,h,I,O,M]})}),e[44]=T,e[45]=h,e[46]=I,e[47]=O,e[48]=M,e[49]=G):G=e[49],G}function hs(s){return t.jsxs("div",{className:"flex items-start gap-3 px-5 py-3",children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx(dt,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:s.name}),s.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:s.description}),s.uri&&t.jsx("div",{className:"text-xs text-muted-foreground/60 font-mono mt-0.5 truncate",children:s.uri})]})]},s.uri??s.name)}function fs(s){return t.jsxs("div",{className:"flex items-start gap-3 px-5 py-3",children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx(ct,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:$e(s.name)}),s.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:s.description})]})]},s.name)}function gs(s){return ue(s._meta)}function js(s){const e=$.c(13),{connection:n,displayTitle:r}=s,i=r??n.title;let o;e[0]!==n.icon||e[1]!==i?(o=t.jsx(ie,{icon:n.icon,name:i,size:"xl",className:"shrink-0"}),e[0]=n.icon,e[1]=i,e[2]=o):o=e[2];let l;e[3]!==i?(l=t.jsx("div",{className:"flex flex-wrap items-center gap-2 mb-2",children:t.jsx("h1",{className:"text-lg md:text-xl font-semibold tracking-tight text-foreground leading-none",children:i})}),e[3]=i,e[4]=l):l=e[4];let c;e[5]!==n.description?(c=n.description&&t.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed line-clamp-2",children:n.description}),e[5]=n.description,e[6]=c):c=e[6];let u;e[7]!==l||e[8]!==c?(u=t.jsxs("div",{className:"flex-1 min-w-0",children:[l,c]}),e[7]=l,e[8]=c,e[9]=u):u=e[9];let d;return e[10]!==o||e[11]!==u?(d=t.jsxs("div",{className:"flex items-center gap-4 md:gap-6 py-5 md:py-7 px-4 md:px-8 bg-background border-b border-border shrink-0",children:[o,u]}),e[10]=o,e[11]=u,e[12]=d):d=e[12],d}function vs({form:s,connection:e,hasOAuthToken:n,onReauthenticate:r,onRemoveOAuth:i}){const o=xe({control:s.control,name:"ui_type"}),l=xe({control:s.control,name:"connection_url"}),{stdioEnabled:c}=Oe(),u=(()=>{if(typeof l!="string"||!l)return!1;try{const a=new URL(l);return a.hostname==="api.githubcopilot.com"&&a.pathname.replace(/\/+$/,"")==="/mcp"}catch{return!1}})(),d=c||e.connection_type==="STDIO",x=e.connection_type==="VIRTUAL",p=x?Me(e.connection_url):null;return x?t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Type"}),t.jsxs("div",{className:"flex items-center gap-2 h-10 px-3 border border-border rounded-lg bg-muted/50",children:[t.jsx(Te,{className:"w-4 h-4 text-muted-foreground"}),t.jsx("span",{className:"text-sm",children:"Virtual MCP"})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"This connection references a Virtual MCP. Tools and resources are aggregated dynamically from the Virtual MCP's underlying connections."})]}),p&&t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Virtual MCP ID"}),t.jsx("div",{className:"flex items-center gap-2 h-10 px-3 border border-border rounded-lg bg-muted/50",children:t.jsx("code",{className:"text-sm text-muted-foreground",children:p})})]})]}):t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(L,{control:s.control,name:"ui_type",render:({field:a})=>t.jsxs(U,{className:"flex flex-col gap-3",children:[t.jsx(F,{className:"text-xs text-muted-foreground font-medium",children:"Connection"}),o!=="NPX"&&o!=="STDIO"?t.jsxs("div",{className:"flex items-stretch rounded-lg border border-border overflow-hidden",children:[t.jsxs(fe,{value:a.value,onValueChange:a.onChange,children:[t.jsx(E,{children:t.jsxs(ge,{className:"h-10 w-auto min-w-[90px] border-0 rounded-none bg-muted/50 focus:ring-0 focus:ring-offset-0",children:[t.jsx(te,{className:"w-4 h-4 text-muted-foreground shrink-0"}),t.jsx(je,{})]})}),t.jsxs(ve,{children:[t.jsx(R,{value:"HTTP",children:"HTTP"}),t.jsx(R,{value:"SSE",children:"SSE"}),t.jsx(R,{value:"Websocket",children:"Websocket"}),d&&t.jsxs(t.Fragment,{children:[t.jsx(R,{value:"NPX",children:"NPX Package"}),t.jsx(R,{value:"STDIO",children:"Custom Command"})]})]})]}),t.jsx("div",{className:"w-px bg-border"}),t.jsx(L,{control:s.control,name:"connection_url",render:({field:f})=>t.jsx(U,{className:"flex-1 min-w-0",children:t.jsx(E,{children:t.jsx(X,{placeholder:"https://example.com/mcp",...f,value:f.value??"",className:"h-10 border-0 rounded-none focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent"})})})})]}):t.jsxs(fe,{value:a.value,onValueChange:a.onChange,children:[t.jsx(E,{children:t.jsx(ge,{className:"h-10",children:t.jsx(je,{})})}),t.jsxs(ve,{children:[t.jsx(R,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(te,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(R,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(te,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(R,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(te,{className:"w-4 h-4"}),"Websocket"]})}),d&&t.jsxs(t.Fragment,{children:[t.jsx(R,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Kt,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(R,{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(B,{})]})}),o==="NPX"&&t.jsx(L,{control:s.control,name:"npx_package",render:({field:a})=>t.jsxs(U,{className:"flex flex-col gap-3",children:[t.jsx(F,{className:"text-xs text-muted-foreground font-medium",children:"NPM Package"}),t.jsx(E,{children:t.jsx(X,{placeholder:"@perplexity-ai/mcp-server",...a,value:a.value||"",className:"h-10 rounded-lg"})}),t.jsx(B,{})]})}),o==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsx(L,{control:s.control,name:"stdio_command",render:({field:a})=>t.jsxs(U,{className:"flex flex-col gap-3",children:[t.jsx(F,{className:"text-xs text-muted-foreground font-medium",children:"Command"}),t.jsx(E,{children:t.jsx(X,{placeholder:"node, bun, python...",...a,value:a.value||"",className:"h-10 rounded-lg"})}),t.jsx(B,{})]})}),t.jsx(L,{control:s.control,name:"stdio_args",render:({field:a})=>t.jsxs(U,{className:"flex flex-col gap-3",children:[t.jsx(F,{className:"text-xs text-muted-foreground font-medium",children:"Arguments"}),t.jsx(E,{children:t.jsx(X,{placeholder:"arg1 arg2 --flag value",...a,value:a.value||"",className:"h-10 rounded-lg"})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Space-separated arguments"}),t.jsx(B,{})]})})]}),t.jsx(L,{control:s.control,name:"stdio_cwd",render:({field:a})=>t.jsxs(U,{className:"flex flex-col gap-3",children:[t.jsx(F,{className:"text-xs text-muted-foreground font-medium",children:"Working Directory"}),t.jsx(E,{children:t.jsx(X,{placeholder:"/path/to/project (optional)",...a,value:a.value||"",className:"h-10 rounded-lg"})}),t.jsx(B,{})]})})]}),(o==="NPX"||o==="STDIO")&&t.jsx(L,{control:s.control,name:"env_vars",render:({field:a})=>t.jsxs(U,{className:"flex flex-col gap-3",children:[t.jsx(F,{className:"text-xs text-muted-foreground font-medium",children:"Environment Variables"}),t.jsx(E,{children:t.jsx(Ge,{value:a.value??[],onChange:a.onChange})}),t.jsx(B,{})]})}),o!=="NPX"&&o!=="STDIO"&&t.jsx(L,{control:s.control,name:"connection_token",render:({field:a})=>t.jsxs(U,{className:"flex flex-col gap-3",children:[t.jsx(F,{className:"text-xs text-muted-foreground font-medium",children:u?"GitHub Personal Access Token":"Token"}),n?t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(Ht,{children:[t.jsx(Gt,{asChild:!0,children:t.jsx("button",{type:"button",className:"inline-flex items-center gap-1.5 cursor-pointer",children:t.jsxs(Bt,{variant:"success",className:"gap-1.5",children:[t.jsx(Wt,{size:12}),"Authenticated via OAuth",t.jsx(Qt,{size:12})]})})}),t.jsxs(Xt,{align:"start",children:[t.jsxs(he,{onClick:r,children:[t.jsx(qt,{size:16}),"Re-authenticate"]}),t.jsxs(he,{variant:"destructive",onClick:i,children:[t.jsx(de,{size:16}),"Remove OAuth"]})]})]})}):e.connection_token&&a.value===null?t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"h-10 px-3 flex items-center rounded-lg border border-border bg-muted/50 text-muted-foreground font-mono text-sm",children:"••••••••••••••••"}),t.jsx("button",{type:"button",onClick:()=>a.onChange(""),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-muted opacity-0 group-hover:opacity-100 transition-opacity",title:"Clear and replace token",children:t.jsx(Jt,{size:14,className:"text-muted-foreground"})})]}):t.jsxs(t.Fragment,{children:[t.jsx(E,{children:t.jsx(X,{type:"password",placeholder:u?"Paste your GitHub PAT":"Enter access token...",...a,value:a.value||"",className:"h-10 rounded-lg"})}),u&&t.jsxs(wt,{children:["Create a PAT at"," ",t.jsx("a",{href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"github.com/settings/personal-access-tokens"})]})]}),t.jsx(B,{})]})})]})}function bs(s){return s.command==="npx"}function Ns(s){return s.args?.find(e=>!e.startsWith("-"))??""}function ys(s){return{command:s.command,args:s.args?.join(" ")??"",cwd:s.cwd??""}}function _s(s,e){const n={command:"npx",args:["-y",s]},r=Ce(e);return Object.keys(r).length>0&&(n.envVars=r),n}function Cs(s,e,n,r){const i={command:s};e.trim()&&(i.args=e.trim().split(/\s+/)),n?.trim()&&(i.cwd=n.trim());const o=Ce(r);return Object.keys(o).length>0&&(i.envVars=o),i}function be(s,e){const n={title:s.title,description:s.description??"",icon:s.icon??null,configuration_state:s.configuration_state??{},configuration_scopes:s.configuration_scopes||[]};if(s.connection_type==="STDIO"&&Fe(s.connection_headers)){const r=s.connection_headers,i=We(r.envVars);if(bs(r)){const l=Ns(r);return{...n,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:l,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:i}}const o=ys(r);return{...n,ui_type:"STDIO",connection_url:"",connection_token:null,npx_package:"",stdio_command:o.command,stdio_args:o.args,stdio_cwd:o.cwd,env_vars:i}}return{...n,ui_type:s.connection_type,connection_url:s.connection_url??"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}function Ss(s){let e,n=null,r=null,i=null;return s.ui_type==="NPX"?(e="STDIO",n="",i=_s(s.npx_package||"",s.env_vars||[])):s.ui_type==="STDIO"?(e="STDIO",n="",i=Cs(s.stdio_command||"",s.stdio_args||"",s.stdio_cwd,s.env_vars||[])):(e=s.ui_type,n=s.connection_url||"",r=s.connection_token||null),{title:s.title,description:s.description||null,icon:s.icon??null,connection_type:e,connection_url:n,...r&&{connection_token:r},...i&&{connection_headers:i},configuration_state:s.configuration_state??null,configuration_scopes:s.configuration_scopes??null}}function ws({connection:s,connectionId:e,org:n,isUpdating:r,tools:i,prompts:o,resources:l,siblings:c}){const u=re({from:"/$org/$project/mcps/$appSlug"}),d=Ee(),x=ke(),[p,a]=W.useState(null),[f,g]=W.useState(null),[b,v]=W.useState(!1),j=Se({connectionId:e}),{data:_}=qe(),w=_?.data?.members??[],C=p??s,N=w.find(m=>m.userId===C.created_by),y=s?.connection_type==="VIRTUAL"||j.isAuthenticated,A=Qe({connections:[s],binding:"MCP"}).length>0,h=Re({resolver:Le(Xe),values:be(p??s)}),I=h.formState.isDirty,V=async()=>{if(!await h.trigger())return;const z=h.getValues(),P=Ss(z),Q=p?.id??e;await x.update.mutateAsync({id:Q,data:P}),h.reset(z)},O=()=>{h.reset(be(p??s))},S=async m=>{const{token:z,tokenInfo:P,error:Q}=await Be({connectionId:m});if(Q||!z){Z.error(`Authentication failed: ${Q}`);return}if(P)try{const K=await fetch(`/api/connections/${m}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:P.accessToken,refreshToken:P.refreshToken,expiresIn:P.expiresIn,scope:P.scope,clientId:P.clientId,clientSecret:P.clientSecret,tokenEndpoint:P.tokenEndpoint})});if(!K.ok)console.error("Failed to save OAuth token:",await K.text()),await x.update.mutateAsync({id:m,data:{connection_token:z}});else try{await x.update.mutateAsync({id:m,data:{}})}catch(ee){console.warn("Failed to refresh connection tools after OAuth:",ee)}}catch(K){console.error("Error saving OAuth token:",K),await x.update.mutateAsync({id:m,data:{connection_token:z}})}else await x.update.mutateAsync({id:m,data:{connection_token:z}});const Y=new URL(`/mcp/${m}`,window.location.origin);await d.invalidateQueries({queryKey:le.isMCPAuthenticated(Y.href,null)}),Z.success("Authentication successful")},M=()=>S(s.id),G=async()=>{try{const m=await fetch(`/api/connections/${s.id}/oauth-token`,{method:"DELETE",credentials:"include"});if(!m.ok){const P=await m.text();Z.error(`Failed to remove OAuth: ${P}`);return}const z=new URL(`/mcp/${s.id}`,window.location.origin);await d.invalidateQueries({queryKey:le.isMCPAuthenticated(z.href,null)}),Z.success("OAuth removed. You can now re-authenticate with a different account.")}catch(m){console.error("Error removing OAuth token:",m),Z.error("Failed to remove OAuth")}},D=async m=>{await x.delete.mutateAsync(m.id),c.length<=1&&u({to:"/$org/$project/mcps",params:{org:n,project:q}}),g(null)},J=t.jsx(nt,{children:t.jsxs(ot,{children:[t.jsx(pe,{children:t.jsx(rt,{asChild:!0,children:t.jsx(ye,{to:"/$org/$project/mcps",params:{org:n,project:q},children:"Connections"})})}),t.jsx(it,{}),t.jsx(pe,{children:t.jsx(at,{children:(()=>{const m=c[0]??s;return m.app_name?m.title.replace(/\s*\(\d+\)\s*$/,""):m.title})()})})]})});return t.jsxs(t.Fragment,{children:[t.jsx(xt,{open:f!==null,onOpenChange:m=>{m||g(null)},children:t.jsxs(pt,{children:[t.jsxs(ht,{children:[t.jsx(ft,{children:"Disconnect instance?"}),t.jsxs(gt,{children:["This will permanently remove"," ",t.jsx("span",{className:"font-medium text-foreground",children:f?.title}),". This action cannot be undone."]})]}),t.jsxs(jt,{children:[t.jsx(vt,{children:"Cancel"}),t.jsx(bt,{onClick:()=>f&&D(f),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})}),t.jsx(Nt,{open:p!==null,onOpenChange:m=>{m||a(null)},children:t.jsxs(yt,{side:"right",className:"sm:max-w-[520px] p-0 flex flex-col gap-0 overflow-hidden",children:[t.jsxs(_t,{className:"px-4 py-3 md:px-6 md:py-4 border-b border-border shrink-0",children:[t.jsx(Ct,{className:"text-base",children:p?.title??s.title}),t.jsx(St,{className:"text-xs",children:"Update URL, authentication, and other settings"}),N&&t.jsxs("div",{className:"flex items-center gap-1.5 pt-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:"Connected by"}),t.jsx(Je,{url:N.user?.image??void 0,fallback:N.user?.name??N.user?.email??"?",size:"3xs",shape:"circle"}),t.jsx("span",{className:"text-xs font-medium text-foreground",children:N.user?.name||N.user?.email})]})]}),t.jsxs(kt,{...h,children:[t.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3 md:px-6 md:py-5 flex flex-col gap-4 md:gap-6",children:[t.jsxs("div",{className:"flex flex-col gap-3 md:gap-4",children:[t.jsx(L,{control:h.control,name:"title",render:({field:m})=>t.jsxs(U,{children:[t.jsx(F,{children:"Name"}),t.jsx(E,{children:t.jsx(X,{...m})}),t.jsx(B,{})]})}),t.jsx(L,{control:h.control,name:"description",render:({field:m})=>t.jsxs(U,{children:[t.jsx(F,{children:"Description"}),t.jsx(E,{children:t.jsx(X,{...m,value:m.value||""})}),t.jsx(B,{})]})})]}),t.jsx(vs,{form:h,connection:p??s,hasOAuthToken:j.hasOAuthToken,onReauthenticate:M,onRemoveOAuth:G}),t.jsx(Ke,{connection:p??s,form:h,hasMcpBinding:A,isMCPAuthenticated:y,supportsOAuth:j.supportsOAuth,isServerError:j.isServerError,onAuthenticate:M,onViewReadme:void 0})]}),t.jsxs("div",{className:"px-6 py-4 border-t border-border flex gap-2 shrink-0",children:[t.jsx(H,{onClick:V,disabled:!I||r,className:"flex-1",children:r?"Saving…":"Save changes"}),I&&t.jsx(H,{variant:"outline",onClick:O,children:"Undo"}),t.jsxs(H,{variant:"outline",className:"gap-2 text-muted-foreground hover:text-destructive hover:border-destructive",onClick:()=>{const m=p??s;a(null),g(m)},children:[t.jsx(de,{size:15}),"Delete"]})]})]},p?.id??s.id)]})}),t.jsx(Tt,{breadcrumb:J,children:t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[t.jsx(js,{connection:s,displayTitle:(()=>{const m=c[0]??s;return m.app_name?m.title.replace(/\s*\(\d+\)\s*$/,""):m.title})()}),t.jsx("div",{className:"flex-1 overflow-auto @container",children:t.jsxs("div",{className:"grid grid-cols-1 @3xl:grid-cols-2 gap-5 p-6",children:[t.jsx(ls,{connectionId:e}),t.jsxs("div",{className:"flex flex-col gap-5",children:[t.jsx(es,{instances:c,onConfigure:m=>a(m),onAuthenticate:m=>S(m.id),onDelete:m=>g(m),isAdding:b,onAdd:async()=>{v(!0);try{const m=c[0]??s,z=m.title.replace(/\s*\(\d+\)\s*$/,""),P=c.length+1,Q=`${z} (${P})`,Y=He("conn");await x.create.mutateAsync({id:Y,title:Q,description:m.description??null,connection_type:m.connection_type,connection_url:m.connection_url??null,connection_token:null,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:m.created_by,organization_id:m.organization_id,icon:m.icon??null,app_name:m.app_name??null,app_id:m.app_id??null,connection_headers:m.connection_headers??null,oauth_config:null,configuration_state:m.configuration_state??null,metadata:null,tools:null,bindings:null,status:"inactive"});const K=new URL(`/mcp/${Y}`,window.location.origin),ee=await Ue({url:K.href,token:null});ee.supportsOAuth&&!ee.isAuthenticated&&await S(Y)}finally{v(!1)}}}),t.jsx(ms,{connection:s})]}),t.jsx("div",{className:"@3xl:col-span-2",children:t.jsx(ps,{tools:i,prompts:o,resources:l,connectionId:e,org:n})})]})})]})})]})}function ks(){const s=$.c(30);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/$org/$project/mcps/$appSlug"},s[0]=e):e=s[0];const n=re(e);let r;s[1]===Symbol.for("react.memo_cache_sentinel")?(r={from:"/shell/$org/$project/mcps/$appSlug"},s[1]=r):r=s[1];const{appSlug:i,org:o}=ze(r),{org:l}=oe(),c=Ye(),u=ke();let d;s[2]!==i?(d=S=>S.connection_type!=="VIRTUAL"&&me(S)===i,s[2]=i,s[3]=d):d=s[3];const x=c.filter(d),p=x[0]??null,a=p?.id??"",f=ce({connectionId:a||null,orgId:l.id});let g;s[4]!==f?(g={client:f},s[4]=f,s[5]=g):g=s[5];const{data:b}=et(g),v=b?b.tools.map(Ps):(p?.tools??[]).map($s);let j;e:{if(x.length<=1){j=v;break e}const S=new Set,M=[],G=Is;for(const D of x){const J=D.id===a?v:G(D.tools);for(const m of J)S.has(m.name)||(S.add(m.name),M.push(m))}j=M.length>0?M:v}const _=j;let w;s[6]!==f?(w={client:f},s[6]=f,s[7]=w):w=s[7];const{data:C}=st(w);let N;s[8]!==f?(N={client:f},s[8]=f,s[9]=N):N=s[9];const{data:k}=tt(N);let y;s[10]!==C?.prompts?(y=C?.prompts??[],s[10]=C?.prompts,s[11]=y):y=s[11];let T;s[12]!==y?(T=y.map(As),s[12]=y,s[13]=T):T=s[13];const A=T;let h;s[14]!==k?.resources?(h=k?.resources??[],s[14]=k?.resources,s[15]=h):h=s[15];let I;s[16]!==h?(I=h.map(Ts),s[16]=h,s[17]=I):I=s[17];const V=I;if(!p){let S;return s[18]!==n||s[19]!==o?(S=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(_e,{title:"Connection not found",description:"This connection may have been deleted or you may not have access.",actions:t.jsx(H,{variant:"outline",onClick:()=>n({to:"/$org/$project/mcps",params:{org:o,project:q}}),children:"Back to connections"})})}),s[18]=n,s[19]=o,s[20]=S):S=s[20],S}let O;return s[21]!==u.update.isPending||s[22]!==_||s[23]!==p||s[24]!==a||s[25]!==o||s[26]!==A||s[27]!==V||s[28]!==x?(O=t.jsx(ws,{org:o,connection:p,connectionId:a,isUpdating:u.update.isPending,tools:_,prompts:A,resources:V,siblings:x}),s[21]=u.update.isPending,s[22]=_,s[23]=p,s[24]=a,s[25]=o,s[26]=A,s[27]=V,s[28]=x,s[29]=O):O=s[29],O}function Ts(s){return{name:s.name,description:s.description,uri:s.uri}}function As(s){return{name:s.name,description:s.description}}function Is(s){return(s??[]).map(Ds)}function Ds(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema??{},outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function $s(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function Ps(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function Os(){const s=$.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Ve,{children:t.jsx(W.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:t.jsx(Ae,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(ks,{})})}),s[0]=e):e=s[0],e}function lo(){const s=$.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Os,{}),s[0]=e):e=s[0],e}export{lo as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as me,j as t,E as Pt,r as X,u as $t,w as Et,e as Ot,d as Lt,f as zt,y as Vt,z as et,t as Ft,q as Mt,b as Ut,B as $,D as Z,O as G,v as E,i as Bt,a as Rt,K as Ht}from"./index-t6xY8FYJ.js";import{g as Kt}from"./generate-id-Dz9QYszT.js";import{C as Xt}from"./collection-display-button-07J7hFqi.js";import{C as Wt}from"./collection-search-C014T-nI.js";import{C as Gt}from"./collection-tabs-BZp_rh35.js";import{C as Ne}from"./connection-card-Dvo5xeIo.js";import{E as qt}from"./empty-state-C_h_kfhM.js";import{s as Ae,i as Qt,I as Ie,a as Yt}from"./integration-icon-BlldxArX.js";import{u as tt,P as ae}from"./index-1_kpvnU4.js";import{u as Jt,f as Zt,g as nt}from"./registry-utils-q14xY1bA.js";import{u as en}from"./use-infinite-scroll-C1MEbO72.js";import{u as tn}from"./use-list-state-CsPnDRB0.js";import{u as nn}from"./use-store-discovery-1Qhmse-y.js";import{g as ne}from"./connection-slug-Bw8dtz1U.js";import{s as sn}from"./slugify-CEUa2lfQ.js";import{f as Pe,a as $e,b as Ee,c as Oe,d as Le,e as ze,A as Ve,h as Fe}from"./alert-dialog-Dqc_24Os.js";import{B as on,a as rn,b as cn,c as ln}from"./breadcrumb-BjaszutD.js";import{C as ct}from"./checkbox-CKx9MIya.js";import{D as lt,a as at,b as dt,c as pt,d as ut,e as mt}from"./dialog-D2mcZnzN.js";import{D as an,a as dn,b as pn,c as un,d as mn,e as hn,f as xn}from"./drawer-vD6YQ-sA.js";import{u as fn}from"./tooltip-CKRAIo8e.js";import{D as Me,a as Ue,b as Be,c as pe}from"./dropdown-menu-5AX5yqCQ.js";import{F as U,b as B,c as R,d as H,f as K,a as st}from"./form-3OFR-VJQ.js";import{I as J}from"./input-qMconvxq.js";import{S as gn,a as jn,b as yn,c as vn,d as de}from"./select-D64t3Q_g.js";import{T as Cn}from"./textarea-BjXJvI0O.js";import{a as bn,b as ot}from"./use-connection-DSXGpH93.js";import{u as Nn,a as Sn}from"./constants-C2NIYyeK.js";import{b as kn}from"./use-virtual-mcp-D5bKIffF.js";import{i as _n}from"./XCircle-Dv-O5jd1.js";import{t as Tn}from"./ChevronDown-C4UuUfvP.js";import{n as ue}from"./Container-OKF_GeCq.js";import{i as ht,s as xt}from"./RefreshCcw01-Dd-MCL9x.js";import{i as Se}from"./Loading01-CKkwknOS.js";import{s as ft}from"./Plus-B_tfkXz3.js";import{s as gt}from"./Trash01-DFCUs2vM.js";import{s as jt}from"./XClose-DXhO2ZT2.js";import{r as wn,E as Dn,c as An,e as yt}from"./env-vars-editor-Cdhuqusz.js";import{e as In}from"./extract-connection-data-BJKmDa-6.js";import"./ArrowUp-C8UJr_8S.js";import"./Check-wCq9US95.js";import"./Grid01-CFCqtKvs.js";import"./List-Dm7hE_p7.js";import"./badge-C9kSd2rC.js";import"./SearchMd-DwH-zFLD.js";import"./card-C_4nJrQs.js";import"./AlertCircle-CwQ-M1BH.js";import"./ArrowLeft-7hoUFjWA.js";import"./Type01-DmSAzri2.js";import"./ChevronRight-8vS2LfiE.js";import"./ChevronUp-eUIC7wig.js";import"./Play-B44HkfJ8.js";import"./Dataflow03-CYOanaoD.js";import"./Download01-D6Ut3-TC.js";import"./VideoRecorder-b8m_Ituf.js";import"./FolderClosed-DWPM1ogz.js";import"./Settings01-Cc_jPdtk.js";import"./Upload01-B4UOm_Kf.js";import"./User01-a2C2h2ws.js";import"./X-CVr_hKcl.js";import"./Zap-D6ZQZPYh.js";import"./useQuery-CIPIMOb2.js";import"./useMutation-Bncnalv9.js";import"./binder-1tH_sZqU.js";import"./use-view-mode-CjInGBUv.js";import"./useInfiniteQuery-C-1ZqiFa.js";import"./infiniteQueryObserver-cSGG5mU_.js";import"./index-BKuN2Iot.js";import"./label-DQB9xwZM.js";import"./index-BdQq_4o_.js";import"./use-collections-CLlnuJpl.js";function it(i){return ne(i)}function Pn(i){const e=new Map;for(const c of i){if(c.connection_type==="VIRTUAL")continue;const a=it(c),f=e.get(a);f?f.push(c):e.set(a,[c])}const o=[],d=new Set;for(const c of i){if(c.connection_type==="VIRTUAL")continue;const a=it(c);if(d.has(a))continue;d.add(a);const f=e.get(a),h=f[0];f.length===1?o.push({type:"single",connection:h}):o.push({type:"group",key:a,icon:h.icon,title:h.app_name?h.title.replace(/\s*\(\d+\)\s*$/,""):h.title,connections:f})}return o}function ke(i){const e=i.trim();if(!e)return"";try{const o=new URL(e),d=o.pathname.length>1?o.pathname.replace(/\/+$/,""):o.pathname;return`${o.origin}${d}`}catch{return e.replace(/\/+$/,"")}}function $n(i){const e=i.trim().split(/\s+/).filter(Boolean);if(e.length<2)return null;const o=e[0]?.toLowerCase();if(o!=="npx"&&o!=="bunx")return null;const c=e.slice(1).find(a=>!a.startsWith("-"));return c?{packageName:c}:null}function be(i){const{uiType:e}=i,o=ke(i.connectionUrl??"");if((e==="HTTP"||e==="SSE"||e==="Websocket")&&o===ke("https://api.githubcopilot.com/mcp/"))return{id:"github",title:"GitHub",description:"GitHub Copilot MCP",token:{label:"GitHub PAT",placeholder:"github_pat_…",helperText:"Paste a GitHub Personal Access Token (PAT)"}};const d=(i.npxPackage??"").trim();return e==="NPX"&&d==="@perplexity-ai/mcp-server"?{id:"perplexity",title:"Perplexity",description:"Perplexity MCP Server",envVarKeys:["PERPLEXITY_API_KEY"]}:null}function rt(i){if(i.registryItems.length===0||i.uiType!=="HTTP"&&i.uiType!=="SSE"&&i.uiType!=="Websocket")return null;const e=ke(i.connectionUrl??"");if(!e)return null;const o=i.registryItems.find(a=>(a.server?.remotes??[]).some(h=>ke(h.url??"")===e));if(!o)return null;const d=o.title||o.name||o.server?.title||o.server?.name||"",c=o.server?.description||o.description||o.summary||null;return d?{id:"registry",title:d,description:c}:null}function En(i,e){const o={command:"npx",args:["-y",i]},d=yt(e);return Object.keys(d).length>0&&(o.envVars=d),o}function On(i,e,o,d){const c={command:i};e.trim()&&(c.args=e.trim().split(/\s+/)),o?.trim()&&(c.cwd=o.trim());const a=yt(d);return Object.keys(a).length>0&&(c.envVars=a),c}function Ln(i){return i.command==="npx"}function zn(i){return i.args?.find(e=>!e.startsWith("-"))??""}function Vn(i){return{command:i.command,args:i.args?.join(" ")??"",cwd:i.cwd??""}}function Fn(i,e){switch(e.type){case"edit":return{mode:"editing",connection:e.connection};case"delete":return{mode:"deleting",connection:e.connection};case"force-delete":return{mode:"force-deleting",connection:e.connection,agentNames:e.agentNames};case"close":return{mode:"idle"}}}function Mn(i){const e=me.c(51),{group:o,onOpen:d,selectionMode:c,selectedIds:a,onToggleSelect:f}=i;let h;if(e[0]!==o.connections||e[1]!==a){let S;e[3]!==a?(S=oe=>a.has(oe.id),e[3]=a,e[4]=S):S=e[4],h=o.connections.every(S),e[0]=o.connections,e[1]=a,e[2]=h}else h=e[2];const g=h;let k;if(e[5]!==o.connections||e[6]!==a){let S;e[8]!==a?(S=oe=>a.has(oe.id),e[8]=a,e[9]=S):S=e[9],k=o.connections.some(S),e[5]=o.connections,e[6]=a,e[7]=k}else k=e[7];const y=k,m=`${o.connections.length} instances`;let b;e[10]!==o.icon||e[11]!==o.title||e[12]!==m?(b={title:o.title,icon:o.icon,description:m},e[10]=o.icon,e[11]=o.title,e[12]=m,e[13]=b):b=e[13];let x;e[14]!==g||e[15]!==o.connections||e[16]!==d||e[17]!==f||e[18]!==a||e[19]!==c?(x=()=>c?(()=>{for(const S of o.connections)g?a.has(S.id)&&f(S.id):a.has(S.id)||f(S.id)})():d(),e[14]=g,e[15]=o.connections,e[16]=d,e[17]=f,e[18]=a,e[19]=c,e[20]=x):x=e[20];const C=c&&g&&"ring-2 ring-primary",N=c&&y&&!g&&"ring-1 ring-primary/50";let A;e[21]!==C||e[22]!==N?(A=Z(C,N),e[21]=C,e[22]=N,e[23]=A):A=e[23];let I;e[24]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx(ue,{}),e[24]=I):I=e[24];let _;e[25]!==g||e[26]!==o.connections||e[27]!==f||e[28]!==a||e[29]!==c||e[30]!==y?(_=c?t.jsx(ct,{checked:g?!0:y?"indeterminate":!1,onCheckedChange:()=>{for(const S of o.connections)g?a.has(S.id)&&f(S.id):a.has(S.id)||f(S.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",o.connections.length]})]}),e[25]=g,e[26]=o.connections,e[27]=f,e[28]=a,e[29]=c,e[30]=y,e[31]=_):_=e[31];const L=c?"w-8 opacity-100":"w-0 opacity-0 group-hover:w-8 group-hover:opacity-100";let T;e[32]!==L?(T=Z("overflow-hidden transition-all duration-150 ease-out",L),e[32]=L,e[33]=T):T=e[33];let ee;e[34]===Symbol.for("react.memo_cache_sentinel")?(ee=t.jsx(Ue,{asChild:!0,children:t.jsx($,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:Bn,children:t.jsx(ht,{size:20})})}),e[34]=ee):ee=e[34];let F;e[35]!==d?(F=S=>{S.stopPropagation(),d()},e[35]=d,e[36]=F):F=e[36];let te;e[37]===Symbol.for("react.memo_cache_sentinel")?(te=t.jsx(xt,{size:16}),e[37]=te):te=e[37];let M;e[38]!==F?(M=t.jsxs(Me,{children:[ee,t.jsx(Be,{align:"end",onClick:Un,children:t.jsxs(pe,{onClick:F,children:[te,"Open"]})})]}),e[38]=F,e[39]=M):M=e[39];let q;e[40]!==T||e[41]!==M?(q=t.jsx("div",{className:T,children:M}),e[40]=T,e[41]=M,e[42]=q):q=e[42];let W;e[43]!==_||e[44]!==q?(W=t.jsxs("div",{className:"flex items-center gap-1",children:[_,q]}),e[43]=_,e[44]=q,e[45]=W):W=e[45];let se;return e[46]!==W||e[47]!==b||e[48]!==x||e[49]!==A?(se=t.jsx(t.Fragment,{children:t.jsx(Ne,{connection:b,onClick:x,className:A,fallbackIcon:I,headerActionsAlwaysVisible:!0,headerActions:W})}),e[46]=W,e[47]=b,e[48]=x,e[49]=A,e[50]=se):se=e[50],se}function Un(i){return i.stopPropagation()}function Bn(i){return i.stopPropagation()}function Rn(i){const e=me.c(28),{count:o,total:d,onSelectAll:c,onDeselectAll:a,onDelete:f,onAddToAgent:h,onToggleStatus:g,onCancel:k}=i;if(o===0)return null;let y;e[0]!==o?(y=t.jsxs("div",{className:"text-xs text-muted-foreground pr-1 tabular-nums",children:[o," selected"]}),e[0]=o,e[1]=y):y=e[1];let m;e[2]!==o||e[3]!==a||e[4]!==c||e[5]!==d?(m=o<d?t.jsxs($,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:c,children:["Select all (",d,")"]}):t.jsx($,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:a,children:"Clear selection"}),e[2]=o,e[3]=a,e[4]=c,e[5]=d,e[6]=m):m=e[6];let b;e[7]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx(ft,{size:13}),e[7]=b):b=e[7];let x;e[8]!==h?(x=t.jsxs($,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:h,children:[b,"Add to Agent"]}),e[8]=h,e[9]=x):x=e[9];let C;e[10]!==g?(C=t.jsx($,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:()=>g("active"),children:"Enable"}),e[10]=g,e[11]=C):C=e[11];let N;e[12]!==g?(N=t.jsx($,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:()=>g("inactive"),children:"Disable"}),e[12]=g,e[13]=N):N=e[13];let A;e[14]===Symbol.for("react.memo_cache_sentinel")?(A=t.jsx(gt,{size:13}),e[14]=A):A=e[14];let I;e[15]!==f?(I=t.jsxs($,{variant:"destructive",size:"sm",className:"h-7 text-xs px-2",onClick:f,children:[A,"Delete"]}),e[15]=f,e[16]=I):I=e[16];let _;e[17]===Symbol.for("react.memo_cache_sentinel")?(_=t.jsx(jt,{size:13}),e[17]=_):_=e[17];let L;e[18]!==k?(L=t.jsx($,{variant:"ghost",size:"sm",className:"h-7 text-xs px-2",onClick:k,children:_}),e[18]=k,e[19]=L):L=e[19];let T;return e[20]!==y||e[21]!==L||e[22]!==m||e[23]!==x||e[24]!==C||e[25]!==N||e[26]!==I?(T=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:[y,m,x,C,N,I,L]})}),e[20]=y,e[21]=L,e[22]=m,e[23]=x,e[24]=C,e[25]=N,e[26]=I,e[27]=T):T=e[27],T}function Hn(i){const e=me.c(25),{open:o,onOpenChange:d,agents:c,onConfirm:a}=i,[f,h]=X.useState(null);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsxs(dt,{children:[t.jsx(pt,{children:"Add to Agent"}),t.jsx(ut,{children:"Select an agent to add the selected connections to."})]}),e[0]=g):g=e[0];let k;e[1]!==c||e[2]!==f?(k=c.length===0?t.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No agents found"}):c.map(_=>t.jsxs("button",{type:"button",onClick:()=>h(_.id),className:Z("flex items-center gap-3 w-full rounded-md px-3 py-2 text-left transition-colors",f===_.id?"bg-primary/10 ring-1 ring-primary":"hover:bg-muted/50"),children:[t.jsx(Ie,{icon:_.icon,name:_.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:_.title}),_.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:_.description})]})]},_.id)),e[1]=c,e[2]=f,e[3]=k):k=e[3];let y;e[4]!==k?(y=t.jsx("div",{className:"max-h-60 overflow-auto py-2 space-y-1",children:k}),e[4]=k,e[5]=y):y=e[5];let m;e[6]!==d?(m=t.jsx($,{variant:"outline",onClick:()=>d(!1),children:"Cancel"}),e[6]=d,e[7]=m):m=e[7];const b=!f;let x;e[8]!==a||e[9]!==d||e[10]!==f?(x=()=>{f&&(a(f),d(!1),h(null))},e[8]=a,e[9]=d,e[10]=f,e[11]=x):x=e[11];let C;e[12]!==b||e[13]!==x?(C=t.jsx($,{disabled:b,onClick:x,children:"Add"}),e[12]=b,e[13]=x,e[14]=C):C=e[14];let N;e[15]!==m||e[16]!==C?(N=t.jsxs(mt,{children:[m,C]}),e[15]=m,e[16]=C,e[17]=N):N=e[17];let A;e[18]!==y||e[19]!==N?(A=t.jsxs(at,{className:"sm:max-w-[400px]",children:[g,y,N]}),e[18]=y,e[19]=N,e[20]=A):A=e[20];let I;return e[21]!==d||e[22]!==o||e[23]!==A?(I=t.jsx(lt,{open:o,onOpenChange:d,children:A}),e[21]=d,e[22]=o,e[23]=A,e[24]=I):I=e[24],I}function Kn(i){const e=me.c(20),{open:o,onOpenChange:d,count:c,onConfirm:a}=i,f=c!==1?"s":"";let h;e[0]!==c||e[1]!==f?(h=t.jsxs(Oe,{children:["Delete ",c," connection",f,"?"]}),e[0]=c,e[1]=f,e[2]=h):h=e[2];const g=c!==1?"s":"";let k;e[3]!==g?(k=t.jsxs(Le,{children:["This will permanently delete the selected connection",g,". This action cannot be undone."]}),e[3]=g,e[4]=k):k=e[4];let y;e[5]!==h||e[6]!==k?(y=t.jsxs(Ee,{children:[h,k]}),e[5]=h,e[6]=k,e[7]=y):y=e[7];let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(Ve,{children:"Cancel"}),e[8]=m):m=e[8];const b=c!==1?"s":"";let x;e[9]!==c||e[10]!==a||e[11]!==b?(x=t.jsxs(ze,{children:[m,t.jsxs(Fe,{onClick:a,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:["Delete ",c," connection",b]})]}),e[9]=c,e[10]=a,e[11]=b,e[12]=x):x=e[12];let C;e[13]!==y||e[14]!==x?(C=t.jsxs($e,{children:[y,x]}),e[13]=y,e[14]=x,e[15]=C):C=e[15];let N;return e[16]!==d||e[17]!==o||e[18]!==C?(N=t.jsx(Pe,{open:o,onOpenChange:d,children:C}),e[16]=d,e[17]=o,e[18]=C,e[19]=N):N=e[19],N}function Xn(){const{org:i}=$t(),e=Et(),o=Ot(),d=Lt({strict:!1}),{data:c}=zt.useSession(),{stdioEnabled:a}=Vt(),f=fn(),h=tn({namespace:i.slug,resource:"connections"}),g=bn(),k=ot(h),y=ot(),[m,b]=X.useReducer(Fn,{mode:"idle"}),[x,C]=X.useState(new Set),N=x.size>0,[A,I]=X.useState(!1),[_,L]=X.useState(!1),[T,ee]=tt(et.connectionsTab(i.slug),n=>d.tab==="all"||d.tab==="connected"?d.tab:n??"all"),[F,te]=X.useState("ALL"),[M,q]=X.useState("ALL"),W=kn(),S=k.filter(n=>!(n.connection_type==="VIRTUAL"||F!=="ALL"&&n.connection_type!==F||M!=="ALL"&&n.status!==M)),oe=Pn(S),he=n=>{C(s=>{const r=new Set(s);return r.has(n)?r.delete(n):r.add(n),r})},xe=()=>{C(new Set)},Q=Jt(y).sort((n,s)=>{const r=n.app_name==="@deco/management-mcp",p=s.app_name==="@deco/management-mcp";return r&&!p?1:!r&&p?-1:0}),[ie,vt]=tt(et.selectedRegistry(i.slug),n=>n??""),Re=(ie?Q.find(n=>n.id===ie):void 0)??Q[0],_e=Re?.id??"",Ct=Zt(Re?.tools),re=nn({registryId:_e,listToolName:Ct}),Te=re.items,bt=en(re.loadMore,re.hasMore,re.isLoadingMore),He=new Set(y.filter(n=>n.connection_type!=="VIRTUAL"&&n.app_name).map(n=>n.app_name)),Y=h.search.toLowerCase(),Ke=T==="all"||Y?Te.filter(n=>{if(!Y)return!0;const s=n._meta?.["mcp.mesh"],r=[s?.friendly_name,n.server?.name,n.server?.title,n.name,n.title,n.id].filter(Boolean).join(" "),p=[s?.short_description,s?.mesh_description,n.server?.description,n.description].filter(Boolean).join(" ");return r.toLowerCase().includes(Y)||p.toLowerCase().includes(Y)}):[],fe=Ke.filter(n=>n.verified||n._meta?.["mcp.mesh"]?.verified||n.meta?.verified),ge=Ke.filter(n=>!n.verified&&!n._meta?.["mcp.mesh"]?.verified&&!n.meta?.verified),Nt=T==="all"&&!Y?[]:oe,Xe=n=>{const s=sn(n.name||n.title||n.server?.title||""),r=typeof n.id=="string"&&n.id.includes("/"),p=typeof n.server?.name=="string"&&n.server.name.includes("/"),j=r&&!p?n.id:n.server?.name||n.id||"";o({to:"/$org/$project/store/$appName",params:{org:i.slug,project:G,appName:s},search:{registryId:_e,serverName:j}})},[je,we]=X.useState(null),We=async n=>{if(!(!i||!c?.user?.id)){we(n.id);try{const s=In(n,i.id,c.user.id,{remoteIndex:0}),r=s.connection_type==="STDIO",p=!!s.connection_url,j=r&&s.connection_headers&&typeof s.connection_headers=="object"&&"command"in s.connection_headers;if(!p&&!j){E.error("This MCP Server cannot be connected: no connection method available"),we(null);return}const l=n.id??n.title,P=y.filter(V=>V.app_name===l||V.title===s.title);if(P.length>0){const V=s.title||"MCP Server";s.title=`${V} (${P.length+1})`}const{id:v}=await g.create.mutateAsync(s),D=new URL(`/mcp/${v}`,window.location.origin),Ce=await Bt({url:D.href,token:null});if(Ce.supportsOAuth&&!Ce.isAuthenticated){const{token:V,tokenInfo:O,error:Ze}=await Rt({connectionId:v});if(Ze||!V){E.error(`Authentication failed: ${Ze??"no token received"}`);return}else{if(O)try{(await fetch(`/api/connections/${v}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:O.accessToken,refreshToken:O.refreshToken,expiresIn:O.expiresIn,scope:O.scope,clientId:O.clientId,clientSecret:O.clientSecret,tokenEndpoint:O.tokenEndpoint})})).ok?await g.update.mutateAsync({id:v,data:{}}):await g.update.mutateAsync({id:v,data:{connection_token:V}})}catch{await g.update.mutateAsync({id:v,data:{connection_token:V}})}else await g.update.mutateAsync({id:v,data:{connection_token:V}});await e.invalidateQueries({queryKey:Ht.isMCPAuthenticated(D.href,null)}),E.success("Authentication successful")}}E.success("Connected successfully")}catch(s){E.error(`Failed to connect: ${s instanceof Error?s.message:String(s)}`)}finally{we(null)}}},Ge=d.action==="create",St=()=>{o({to:"/$org/$project/mcps",params:{org:i.slug,project:G},search:{action:"create"}})},qe=()=>{o({to:"/$org/$project/mcps",params:{org:i.slug,project:G},search:{}})},u=Ft({resolver:Mt(An),defaultValues:{title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),z=u.watch("ui_type"),Qe=u.watch("connection_url"),kt=u.watch("npx_package"),ce=be({uiType:z,connectionUrl:Qe??"",npxPackage:kt??""})??rt({uiType:z,connectionUrl:Qe??"",registryItems:Te}),w=m.mode==="editing"?m.connection:null;X.useEffect(()=>{if(w){const n=Ut(w.connection_headers)?w.connection_headers:null;if(n&&w.connection_type==="STDIO"){const s=wn(n.envVars);if(Ln(n)){const r=zn(n);u.reset({title:w.title,description:w.description,icon:w.icon??null,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:r,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:s})}else{const r=Vn(n);u.reset({title:w.title,description:w.description,icon:w.icon??null,ui_type:"STDIO",connection_url:"",connection_token:null,npx_package:"",stdio_command:r.command,stdio_args:r.args,stdio_cwd:r.cwd,env_vars:s})}}else u.reset({title:w.title,description:w.description,icon:w.icon??null,ui_type:w.connection_type,connection_url:w.connection_url??"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]})}else u.reset({title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]})},[w,u]);const le=Nn({connectionId:Sn,orgId:i.id}),ye=()=>{e.invalidateQueries({predicate:n=>{const s=n.queryKey;return s[1]===i.id&&s[3]==="collection"&&s[4]==="CONNECTIONS"}})},_t=async()=>{I(!1);const n=[...x];let s=0;for(const r of n)try{(await le.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:r,force:!0}})).isError||s++}catch{}ye(),E.success(`Deleted ${s} connection${s!==1?"s":""}`),xe()},Tt=async n=>{const s=[...x];let r=0;for(const p of s)try{await g.update.mutateAsync({id:p,data:{status:n}}),r++}catch{}ye(),E.success(`${n==="active"?"Enabled":"Disabled"} ${r} connection${r!==1?"s":""}`),xe()},wt=async n=>{const s=W.find(j=>j.id===n);if(!s||!le)return;const r=new Set(s.connections.map(j=>j.connection_id)),p=[...x].filter(j=>!r.has(j)).map(j=>({connection_id:j,selected_tools:null,selected_resources:null,selected_prompts:null}));if(p.length===0){E.info("All selected connections are already in that agent");return}try{await le.callTool({name:"COLLECTION_VIRTUAL_MCP_UPDATE",arguments:{id:n,data:{connections:[...s.connections,...p]}}}),e.invalidateQueries({predicate:j=>{const l=j.queryKey;return l[1]===i.id&&l[3]==="collection"&&l[4]==="VIRTUAL_MCP"}}),E.success(`Added ${p.length} connection${p.length!==1?"s":""} to "${s.title}"`),xe()}catch{E.error("Failed to add connections to agent")}},Ye=n=>{const s=n.content;return Array.isArray(s)&&s[0]?.type==="text"&&typeof s[0].text=="string"?s[0].text:"Unknown error"},Dt=async()=>{if(m.mode!=="deleting")return;const n=m.connection;b({type:"close"});try{const s=await le.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:n.id}});if(s.isError){const r=Ye(s),p=r.replace(/^Error:\s*/,"");try{const j=JSON.parse(p);if(j.code==="CONNECTION_IN_USE"&&j.agentNames){b({type:"force-delete",connection:n,agentNames:j.agentNames.map(l=>`"${l}"`).join(", ")});return}}catch{}E.error(`Failed to delete connection: ${r}`);return}ye(),E.success("Connection deleted successfully")}catch(s){const r=s instanceof Error?s.message:String(s);E.error(`Failed to delete connection: ${r}`)}},At=async()=>{if(m.mode!=="force-deleting")return;const n=m.connection.id;b({type:"close"});try{const s=await le.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:n,force:!0}});if(s.isError){E.error(`Failed to delete connection: ${Ye(s)}`);return}ye(),E.success("Connection deleted successfully")}catch(s){const r=s instanceof Error?s.message:String(s);E.error(`Failed to delete connection: ${r}`)}},Je=async n=>{let s,r=null,p=null,j=null;if(n.ui_type==="NPX"?(s="STDIO",r="",j=En(n.npx_package||"",n.env_vars||[])):n.ui_type==="STDIO"?(s="STDIO",r="",j=On(n.stdio_command||"",n.stdio_args||"",n.stdio_cwd,n.env_vars||[])):(s=n.ui_type,r=n.connection_url||"",p=n.connection_token||null),w){await g.update.mutateAsync({id:w.id,data:{title:n.title,description:n.description||null,icon:n.icon??null,connection_type:s,connection_url:r,...p&&{connection_token:p},...j&&{connection_headers:j}}}),b({type:"close"}),u.reset();return}const l=Kt("conn");await g.create.mutateAsync({id:l,title:n.title,description:n.description||null,connection_type:s,connection_url:r,connection_token:p,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:c?.user?.id||"system",organization_id:i.id,icon:n.icon??null,app_name:null,app_id:null,connection_headers:j,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),qe(),u.reset(),o({to:"/$org/$project/mcps/$appSlug",params:{org:i.slug,project:G,appSlug:ne({app_name:null,connection_url:r,title:n.title,id:l})}})},De=n=>{n||(Ge?qe():b({type:"close"}),u.reset())},ve=n=>{const s=n.trim();if(!s)return;const r=!!u.formState.dirtyFields.title,p=!!u.formState.dirtyFields.description,j=!!u.formState.dirtyFields.env_vars,l=v=>{if(v&&(!r&&!u.getValues("title").trim()&&v.title&&u.setValue("title",v.title,{shouldDirty:!1}),!p&&!(u.getValues("description")??"").trim()&&v.description&&u.setValue("description",v.description,{shouldDirty:!1}),!j&&v.envVarKeys?.length)){const D=u.getValues("env_vars")??[],Ce=new Set(D.map(O=>O.key)),V=v.envVarKeys.filter(O=>!Ce.has(O));V.length>0&&u.setValue("env_vars",[...D,...V.map(O=>({key:O,value:""}))],{shouldDirty:!0})}},P=$n(s);if(P&&a){u.setValue("ui_type","NPX",{shouldDirty:!0}),u.setValue("npx_package",P.packageName,{shouldDirty:!0}),u.setValue("connection_url","",{shouldDirty:!0}),u.setValue("connection_token",null,{shouldDirty:!0}),l(be({uiType:"NPX",npxPackage:P.packageName}));return}if(s.startsWith("http://")||s.startsWith("https://")){const v=z==="HTTP"||z==="SSE"||z==="Websocket"?z:"HTTP";u.setValue("ui_type",v,{shouldDirty:!0}),u.setValue("connection_url",s,{shouldDirty:!0}),l(be({uiType:v,connectionUrl:s})??rt({uiType:v,connectionUrl:s,registryItems:Te}));return}z==="NPX"&&l(be({uiType:"NPX",npxPackage:s}))},It=t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs($,{variant:"outline",onClick:St,size:"sm",className:"h-7 w-7 px-0 sm:w-auto sm:px-3 rounded-lg text-sm font-medium",children:[t.jsx(ft,{size:14,className:"sm:hidden"}),t.jsx("span",{className:"hidden sm:inline",children:"Custom Connection"})]})});return t.jsx(t.Fragment,{children:t.jsxs(ae,{children:[(()=>{const n=w?"Edit Connection":"Create Connection",s=w?"Update the connection details below.":"Create a custom connection in your organization. Fill in the details below.",r=u.formState.isSubmitting?"Saving...":w?"Update Connection":"Create Connection",p=t.jsxs("div",{className:"grid gap-4",children:[t.jsx(U,{control:u.control,name:"ui_type",render:({field:l})=>t.jsxs(B,{children:[t.jsx(R,{children:"Type *"}),t.jsxs(gn,{value:l.value,onValueChange:l.onChange,children:[t.jsx(H,{children:t.jsx(jn,{children:t.jsx(yn,{})})}),t.jsxs(vn,{children:[t.jsx(de,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ae,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(de,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ae,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(de,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ae,{className:"w-4 h-4"}),"Websocket"]})}),a&&t.jsxs(t.Fragment,{children:[t.jsx(de,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ue,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(de,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Qt,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(K,{})]})}),z==="NPX"&&t.jsx(U,{control:u.control,name:"npx_package",render:({field:l})=>t.jsxs(B,{children:[t.jsx(R,{children:"NPM Package *"}),t.jsx(H,{children:t.jsx(J,{placeholder:"@perplexity-ai/mcp-server",...l,value:l.value??"",onPaste:P=>{const v=P.clipboardData.getData("text");v&&(P.preventDefault(),u.setValue("npx_package",v.trim(),{shouldDirty:!0}),ve(v))},onBlur:P=>{ve(P.target.value),l.onBlur()}})}),t.jsx(K,{})]})}),z==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[t.jsx(U,{control:u.control,name:"stdio_command",render:({field:l})=>t.jsxs(B,{children:[t.jsx(R,{children:"Command *"}),t.jsx(H,{children:t.jsx(J,{placeholder:"node, bun, python...",...l,value:l.value??""})}),t.jsx(K,{})]})}),t.jsx(U,{control:u.control,name:"stdio_args",render:({field:l})=>t.jsxs(B,{children:[t.jsx(R,{children:"Arguments"}),t.jsx(H,{children:t.jsx(J,{placeholder:"arg1 arg2 --flag value",...l,value:l.value??""})}),t.jsx(K,{})]})})]}),t.jsx(U,{control:u.control,name:"stdio_cwd",render:({field:l})=>t.jsxs(B,{children:[t.jsx(R,{children:"Working Directory"}),t.jsx(H,{children:t.jsx(J,{placeholder:"/path/to/project (optional)",...l,value:l.value??""})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory where the command will be executed"}),t.jsx(K,{})]})})]}),(z==="NPX"||z==="STDIO")&&t.jsx(U,{control:u.control,name:"env_vars",render:({field:l})=>t.jsxs(B,{children:[t.jsx(R,{children:"Environment Variables"}),t.jsx(H,{children:t.jsx(Dn,{value:l.value??[],onChange:l.onChange})}),t.jsx(K,{})]})}),z!=="NPX"&&z!=="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsx(U,{control:u.control,name:"connection_url",render:({field:l})=>t.jsxs(B,{children:[t.jsx(R,{children:"URL *"}),t.jsx(H,{children:t.jsx(J,{placeholder:"https://example.com/mcp",...l,value:l.value??"",onPaste:P=>{const v=P.clipboardData.getData("text");v&&(P.preventDefault(),u.setValue("connection_url",v.trim(),{shouldDirty:!0}),ve(v))},onBlur:P=>{ve(P.target.value),l.onBlur()}})}),t.jsx(K,{})]})}),t.jsx(U,{control:u.control,name:"connection_token",render:({field:l})=>t.jsxs(B,{children:[t.jsx(R,{children:ce?.token?.label??"Token (optional)"}),t.jsx(H,{children:t.jsx(J,{type:"password",placeholder:ce?.token?.placeholder??"Bearer token or API key",...l,value:l.value??""})}),ce?.token?.helperText&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:[ce.token.helperText,ce.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(K,{})]})})]}),t.jsx(U,{control:u.control,name:"title",render:({field:l})=>t.jsxs(B,{children:[t.jsx(R,{children:"Name *"}),t.jsx(H,{children:t.jsx(J,{placeholder:"My Connection",...l})}),t.jsx(K,{})]})}),t.jsx(U,{control:u.control,name:"description",render:({field:l})=>t.jsxs(B,{children:[t.jsx(R,{children:"Description"}),t.jsx(H,{children:t.jsx(Cn,{placeholder:"A brief description of this connection",rows:3,...l,value:l.value??""})}),t.jsx(K,{})]})})]}),j=Ge||m.mode==="editing";return f?t.jsx(an,{open:j,onOpenChange:De,children:t.jsxs(dn,{className:"max-h-[90vh]",children:[t.jsx(pn,{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(un,{children:n}),t.jsx(mn,{className:"mt-1",children:s})]}),t.jsx(hn,{asChild:!0,children:t.jsx($,{variant:"ghost",size:"icon",className:"shrink-0 -mt-1",children:t.jsx(jt,{size:16})})})]})}),t.jsx(st,{...u,children:t.jsxs("form",{onSubmit:u.handleSubmit(Je),children:[t.jsx("div",{className:"overflow-y-auto px-4 pb-4",children:p}),t.jsx(xn,{children:t.jsx($,{type:"submit",disabled:u.formState.isSubmitting,className:"w-full",children:r})})]})})]})}):t.jsx(lt,{open:j,onOpenChange:De,children:t.jsxs(at,{className:"sm:max-w-[525px]",children:[t.jsxs(dt,{children:[t.jsx(pt,{children:n}),t.jsx(ut,{children:s})]}),t.jsx(st,{...u,children:t.jsxs("form",{onSubmit:u.handleSubmit(Je),children:[t.jsx("div",{className:"py-4",children:p}),t.jsxs(mt,{children:[t.jsx($,{type:"button",variant:"outline",onClick:()=>De(!1),children:"Cancel"}),t.jsx($,{type:"submit",disabled:u.formState.isSubmitting,className:"min-w-40",children:r})]})]})})]})})})(),t.jsx(Pe,{open:m.mode==="deleting",onOpenChange:n=>!n&&b({type:"close"}),children:t.jsxs($e,{children:[t.jsxs(Ee,{children:[t.jsx(Oe,{children:"Delete Connection?"}),t.jsxs(Le,{children:["This action cannot be undone. This will permanently delete"," ",t.jsx("span",{className:"font-medium text-foreground",children:m.mode==="deleting"&&m.connection.title}),"."]})]}),t.jsxs(ze,{children:[t.jsx(Ve,{children:"Cancel"}),t.jsx(Fe,{onClick:Dt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),t.jsx(Pe,{open:m.mode==="force-deleting",onOpenChange:n=>!n&&b({type:"close"}),children:t.jsxs($e,{children:[t.jsxs(Ee,{children:[t.jsx(Oe,{children:"Connection Used by Agents"}),t.jsx(Le,{asChild:!0,children:t.jsxs("div",{children:[t.jsxs("p",{children:["The connection"," ",t.jsx("span",{className:"font-medium text-foreground",children:m.mode==="force-deleting"&&m.connection.title})," ","is currently used by the following agent(s):"," ",t.jsx("span",{className:"font-medium text-foreground",children:m.mode==="force-deleting"&&m.agentNames}),"."]}),t.jsx("p",{className:"mt-2",children:"Deleting this connection will remove it from those agents, which may impact existing workflows that depend on them."})]})})]}),t.jsxs(ze,{children:[t.jsx(Ve,{children:"Cancel"}),t.jsx(Fe,{onClick:At,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete Anyway"})]})]})}),t.jsx(Kn,{open:A,onOpenChange:I,count:x.size,onConfirm:_t}),t.jsx(Hn,{open:_,onOpenChange:L,agents:W,onConfirm:wt}),t.jsxs(ae.Header,{children:[t.jsx(ae.Header.Left,{children:t.jsx(on,{children:t.jsx(rn,{children:t.jsx(cn,{children:t.jsx(ln,{children:"Connections"})})})})}),t.jsxs(ae.Header.Right,{children:[t.jsx(Xt,{sortKey:h.sortKey,sortDirection:h.sortDirection,onSort:h.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:F,onChange:n=>te(n||"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:M,onChange:n=>q(n||"ALL"),options:[{id:"ALL",label:"All"},{id:"active",label:"Active"},{id:"inactive",label:"Inactive"},{id:"error",label:"Error"}]}]}),It]})]}),t.jsxs("div",{className:"flex flex-col gap-0",children:[t.jsx("div",{children:t.jsx(Wt,{value:h.search,onChange:h.setSearch,placeholder:"Search for a Connection...",onKeyDown:n=>{n.key==="Escape"&&(h.setSearch(""),n.target.blur())}})}),t.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border",children:[t.jsx(Gt,{tabs:[{id:"all",label:"All"},{id:"connected",label:"Connected"}],activeTab:T,onTabChange:n=>ee(n)}),Q.length>0&&t.jsx("div",{className:Z(T!=="all"&&"invisible pointer-events-none"),children:t.jsxs(Me,{children:[t.jsx(Ue,{asChild:!0,children:t.jsxs($,{variant:"outline",size:"sm",className:"h-7 px-2 gap-1.5 text-sm font-normal",children:[(()=>{const n=Q.find(s=>s.id===(ie||Q[0]?.id))??Q[0];return t.jsxs(t.Fragment,{children:[t.jsx(Ie,{icon:n?.icon,name:n?.title??"",size:"2xs",className:"shrink-0 rounded-sm"}),t.jsx("span",{children:n?.title})]})})(),t.jsx(Tn,{size:14,className:"text-muted-foreground"})]})}),t.jsx(Be,{align:"end",children:Q.map(n=>t.jsxs(pe,{onClick:()=>vt(n.id),className:Z(ie===n.id||!ie&&n.id===Q[0]?.id?"bg-accent":""),children:[t.jsx(Ie,{icon:n.icon,name:n.title,size:"2xs",className:"shrink-0 rounded-sm"}),n.title]},n.id))})]})})]})]}),t.jsx(ae.Content,{children:t.jsx("div",{className:"flex-1 overflow-auto p-5",children:(Y?fe.length===0&&ge.length===0&&S.length===0:T==="all"?fe.length===0&&ge.length===0:S.length===0)?t.jsx(qt,{image:t.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:336,height:320,"aria-hidden":"true"}),title:"No Connections found",description:h.search?`No Connections match "${h.search}"`:"Create a connection to get started."}):t.jsxs("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:[Nt.map(n=>{if(n.type==="group")return t.jsx(Mn,{group:n,onOpen:()=>{o({to:"/$org/$project/mcps/$appSlug",params:{org:i.slug,project:G,appSlug:n.key}})},selectionMode:N,selectedIds:x,onToggleSelect:he},n.key);const s=n.connection,r=x.has(s.id);return t.jsx(Ne,{connection:s,fallbackIcon:t.jsx(ue,{}),onClick:()=>N?he(s.id):o({to:"/$org/$project/mcps/$appSlug",params:{org:i.slug,project:G,appSlug:ne(s)}}),className:Z(r&&"ring-2 ring-primary bg-primary/5"),headerActionsAlwaysVisible:!0,headerActions:t.jsxs("div",{className:"flex items-center gap-1",children:[N?t.jsx(ct,{checked:r,onCheckedChange:()=>he(s.id),onClick:p=>p.stopPropagation()}):t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}),t.jsx("div",{className:Z("overflow-hidden transition-all duration-150 ease-out",N?"w-8 opacity-100":"w-0 opacity-0 group-hover:w-8 group-hover:opacity-100"),children:t.jsxs(Me,{children:[t.jsx(Ue,{asChild:!0,children:t.jsx($,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:p=>p.stopPropagation(),children:t.jsx(ht,{size:20})})}),t.jsxs(Be,{align:"end",onClick:p=>p.stopPropagation(),children:[t.jsxs(pe,{onClick:p=>{p.stopPropagation(),o({to:"/$org/$project/mcps/$appSlug",params:{org:i.slug,project:G,appSlug:ne(s)}})},children:[t.jsx(xt,{size:16}),"Open"]}),t.jsxs(pe,{onClick:p=>{p.stopPropagation(),he(s.id)},children:[t.jsx(Yt,{size:16}),"Select"]}),t.jsxs(pe,{variant:"destructive",onClick:p=>{p.stopPropagation(),b({type:"delete",connection:s})},children:[t.jsx(gt,{size:16}),"Delete"]})]})]})})]})},s.id)}),T==="all"&&fe.length>0&&t.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[t.jsx(_n,{size:13,className:"text-muted-foreground shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:"Verified"}),t.jsx("div",{className:"flex-1 h-px bg-border"})]}),fe.map(n=>{const s=n.server?.name||n.name||n.id||"",r=He.has(s),p=n._meta?.["mcp.mesh"],j=p?.friendlyName||p?.friendly_name||n.server?.title||n.title||n.server?.name||n.name||n.id||"",l=n.server?.description||n.description||null,P=n.server?.icons?.[0]?.src||nt(n.server?.repository)||null,v=y.filter(D=>D.connection_type!=="VIRTUAL"&&D.app_name===s);return t.jsx(Ne,{connection:{title:j,description:l,icon:P},fallbackIcon:t.jsx(ue,{}),onClick:()=>{if(r){const D=v[0];D&&o({to:"/$org/$project/mcps/$appSlug",params:{org:i.slug,project:G,appSlug:ne(D)}})}else Xe(n)},headerActionsAlwaysVisible:!0,headerActions:r?t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}):t.jsx($,{variant:"outline",size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",disabled:je!==null,onClick:D=>{D.stopPropagation(),We(n)},children:je===n.id?t.jsx(Se,{size:14,className:"animate-spin"}):"Connect"})},`catalog-${n.id}`)}),T==="all"&&ge.length>0&&t.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[t.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:"All connections"}),t.jsx("div",{className:"flex-1 h-px bg-border"})]}),ge.map(n=>{const s=n.server?.name||n.name||n.id||"",r=He.has(s),p=n._meta?.["mcp.mesh"],j=p?.friendlyName||p?.friendly_name||n.server?.title||n.title||n.server?.name||n.name||n.id||"",l=n.server?.description||n.description||null,P=n.server?.icons?.[0]?.src||nt(n.server?.repository)||null,v=y.filter(D=>D.connection_type!=="VIRTUAL"&&D.app_name===s);return t.jsx(Ne,{connection:{title:j,description:l,icon:P},fallbackIcon:t.jsx(ue,{}),onClick:()=>{if(r){const D=v[0];D&&o({to:"/$org/$project/mcps/$appSlug",params:{org:i.slug,project:G,appSlug:ne(D)}})}else Xe(n)},headerActionsAlwaysVisible:!0,headerActions:r?t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}):t.jsx($,{variant:"outline",size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",disabled:je!==null,onClick:D=>{D.stopPropagation(),We(n)},children:je===n.id?t.jsx(Se,{size:14,className:"animate-spin"}):"Connect"})},`catalog-${n.id}`)}),(T==="all"||Y)&&_e&&t.jsx("div",{ref:bt,className:"col-span-full h-4"}),(T==="all"||Y)&&re.isLoadingMore&&t.jsx("div",{className:"col-span-full flex justify-center py-6",children:t.jsx(Se,{size:24,className:"animate-spin text-muted-foreground"})})]})})}),N&&t.jsx(Rn,{count:x.size,total:S.length,onSelectAll:()=>{C(new Set(S.map(n=>n.id)))},onDeselectAll:()=>C(new Set),onDelete:()=>I(!0),onAddToAgent:()=>L(!0),onToggleStatus:Tt,onCancel:xe})]})})}function uo(){const i=me.c(1);let e;return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Pt,{children:t.jsx(X.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(Se,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(Xn,{})})}),i[0]=e):e=i[0],e}export{uo as default};
|
|
1
|
+
import{c as me,j as t,E as Pt,r as X,u as $t,w as Et,e as Ot,d as Lt,f as zt,y as Vt,z as et,t as Ft,q as Mt,b as Ut,B as $,D as Z,O as G,v as E,i as Bt,a as Rt,K as Ht}from"./index-Di6oLb1g.js";import{g as Kt}from"./generate-id-B0hqIne-.js";import{C as Xt}from"./collection-display-button-BTy8OMGo.js";import{C as Wt}from"./collection-search-BaA_5hnO.js";import{C as Gt}from"./collection-tabs-B_Ive8CL.js";import{C as Ne}from"./connection-card-ClL9bm7k.js";import{E as qt}from"./empty-state-UToLDOJO.js";import{s as Ae,i as Qt,I as Ie,a as Yt}from"./integration-icon-DlCg0T4C.js";import{u as tt,P as ae}from"./index-B3DLUye8.js";import{u as Jt,f as Zt,g as nt}from"./registry-utils-B2MGgFdM.js";import{u as en}from"./use-infinite-scroll-xFnZb5m2.js";import{u as tn}from"./use-list-state-Bp_aU4BI.js";import{u as nn}from"./use-store-discovery-Dr1RNWE5.js";import{g as ne}from"./connection-slug-Bw8dtz1U.js";import{s as sn}from"./slugify-CEUa2lfQ.js";import{f as Pe,a as $e,b as Ee,c as Oe,d as Le,e as ze,A as Ve,h as Fe}from"./alert-dialog-DnwDlp7T.js";import{B as on,a as rn,b as cn,c as ln}from"./breadcrumb-DBLmG8ET.js";import{C as ct}from"./checkbox-DFbWpPSa.js";import{D as lt,a as at,b as dt,c as pt,d as ut,e as mt}from"./dialog-B-I43lOk.js";import{D as an,a as dn,b as pn,c as un,d as mn,e as hn,f as xn}from"./drawer-Cc_fH-oc.js";import{u as fn}from"./tooltip-Bt2vWRpT.js";import{D as Me,a as Ue,b as Be,c as pe}from"./dropdown-menu-KiFp7XSX.js";import{F as U,b as B,c as R,d as H,f as K,a as st}from"./form-edx7u0Be.js";import{I as J}from"./input-DQ4QcwHR.js";import{S as gn,a as jn,b as yn,c as vn,d as de}from"./select-DE6nOtq4.js";import{T as Cn}from"./textarea-DK_nHNH9.js";import{a as bn,b as ot}from"./use-connection-CJIltDo3.js";import{u as Nn,a as Sn}from"./constants-kAo23sAc.js";import{b as kn}from"./use-virtual-mcp-BdGbK3Wg.js";import{i as _n}from"./XCircle-BEC1SvTX.js";import{t as Tn}from"./ChevronDown-Cm9SuGtV.js";import{n as ue}from"./Container-sfWYtc36.js";import{i as ht,s as xt}from"./RefreshCcw01-Cu6svfY5.js";import{i as Se}from"./Loading01-ZUH_hVSq.js";import{s as ft}from"./Plus-D9CNWrFQ.js";import{s as gt}from"./Trash01-Cv31wiMP.js";import{s as jt}from"./XClose-BzyTilGE.js";import{r as wn,E as Dn,c as An,e as yt}from"./env-vars-editor-D3JHoO0m.js";import{e as In}from"./extract-connection-data-GhIKo0Xr.js";import"./ArrowUp-CpDF-NAu.js";import"./Check-CecxQkQE.js";import"./Grid01-CLnEHof5.js";import"./List-CnkQuVUq.js";import"./badge-a1yIqkX1.js";import"./SearchMd-BH_J7-7p.js";import"./card-BkMKAjKJ.js";import"./AlertCircle-D2rRA9CS.js";import"./ArrowLeft-D4bkD9qi.js";import"./Type01-BRLQyycA.js";import"./ChevronRight-2xVQHhsF.js";import"./ChevronUp-B6bu9ZD3.js";import"./Play-CCpyKlpN.js";import"./Dataflow03-BcXlVxgR.js";import"./Download01-DGSbxmSo.js";import"./VideoRecorder-CqjZf9cg.js";import"./FolderClosed-DlY-lqwP.js";import"./Settings01-DTaoTYj1.js";import"./Upload01-BY6Noksk.js";import"./User01-BloSEKZw.js";import"./X-1dO_8PIJ.js";import"./Zap-D6SUOiFY.js";import"./useQuery-BrfnS-T_.js";import"./useMutation-BOcaN318.js";import"./binder-B_Xezby6.js";import"./use-view-mode-DNywUlq7.js";import"./useInfiniteQuery-BKFOAK_4.js";import"./infiniteQueryObserver-Cg7Qn-Py.js";import"./index-C45O1mgu.js";import"./label-BGeQL0ka.js";import"./index-BdQq_4o_.js";import"./use-collections-CojcRvND.js";function it(i){return ne(i)}function Pn(i){const e=new Map;for(const c of i){if(c.connection_type==="VIRTUAL")continue;const a=it(c),f=e.get(a);f?f.push(c):e.set(a,[c])}const o=[],d=new Set;for(const c of i){if(c.connection_type==="VIRTUAL")continue;const a=it(c);if(d.has(a))continue;d.add(a);const f=e.get(a),h=f[0];f.length===1?o.push({type:"single",connection:h}):o.push({type:"group",key:a,icon:h.icon,title:h.app_name?h.title.replace(/\s*\(\d+\)\s*$/,""):h.title,connections:f})}return o}function ke(i){const e=i.trim();if(!e)return"";try{const o=new URL(e),d=o.pathname.length>1?o.pathname.replace(/\/+$/,""):o.pathname;return`${o.origin}${d}`}catch{return e.replace(/\/+$/,"")}}function $n(i){const e=i.trim().split(/\s+/).filter(Boolean);if(e.length<2)return null;const o=e[0]?.toLowerCase();if(o!=="npx"&&o!=="bunx")return null;const c=e.slice(1).find(a=>!a.startsWith("-"));return c?{packageName:c}:null}function be(i){const{uiType:e}=i,o=ke(i.connectionUrl??"");if((e==="HTTP"||e==="SSE"||e==="Websocket")&&o===ke("https://api.githubcopilot.com/mcp/"))return{id:"github",title:"GitHub",description:"GitHub Copilot MCP",token:{label:"GitHub PAT",placeholder:"github_pat_…",helperText:"Paste a GitHub Personal Access Token (PAT)"}};const d=(i.npxPackage??"").trim();return e==="NPX"&&d==="@perplexity-ai/mcp-server"?{id:"perplexity",title:"Perplexity",description:"Perplexity MCP Server",envVarKeys:["PERPLEXITY_API_KEY"]}:null}function rt(i){if(i.registryItems.length===0||i.uiType!=="HTTP"&&i.uiType!=="SSE"&&i.uiType!=="Websocket")return null;const e=ke(i.connectionUrl??"");if(!e)return null;const o=i.registryItems.find(a=>(a.server?.remotes??[]).some(h=>ke(h.url??"")===e));if(!o)return null;const d=o.title||o.name||o.server?.title||o.server?.name||"",c=o.server?.description||o.description||o.summary||null;return d?{id:"registry",title:d,description:c}:null}function En(i,e){const o={command:"npx",args:["-y",i]},d=yt(e);return Object.keys(d).length>0&&(o.envVars=d),o}function On(i,e,o,d){const c={command:i};e.trim()&&(c.args=e.trim().split(/\s+/)),o?.trim()&&(c.cwd=o.trim());const a=yt(d);return Object.keys(a).length>0&&(c.envVars=a),c}function Ln(i){return i.command==="npx"}function zn(i){return i.args?.find(e=>!e.startsWith("-"))??""}function Vn(i){return{command:i.command,args:i.args?.join(" ")??"",cwd:i.cwd??""}}function Fn(i,e){switch(e.type){case"edit":return{mode:"editing",connection:e.connection};case"delete":return{mode:"deleting",connection:e.connection};case"force-delete":return{mode:"force-deleting",connection:e.connection,agentNames:e.agentNames};case"close":return{mode:"idle"}}}function Mn(i){const e=me.c(51),{group:o,onOpen:d,selectionMode:c,selectedIds:a,onToggleSelect:f}=i;let h;if(e[0]!==o.connections||e[1]!==a){let S;e[3]!==a?(S=oe=>a.has(oe.id),e[3]=a,e[4]=S):S=e[4],h=o.connections.every(S),e[0]=o.connections,e[1]=a,e[2]=h}else h=e[2];const g=h;let k;if(e[5]!==o.connections||e[6]!==a){let S;e[8]!==a?(S=oe=>a.has(oe.id),e[8]=a,e[9]=S):S=e[9],k=o.connections.some(S),e[5]=o.connections,e[6]=a,e[7]=k}else k=e[7];const y=k,m=`${o.connections.length} instances`;let b;e[10]!==o.icon||e[11]!==o.title||e[12]!==m?(b={title:o.title,icon:o.icon,description:m},e[10]=o.icon,e[11]=o.title,e[12]=m,e[13]=b):b=e[13];let x;e[14]!==g||e[15]!==o.connections||e[16]!==d||e[17]!==f||e[18]!==a||e[19]!==c?(x=()=>c?(()=>{for(const S of o.connections)g?a.has(S.id)&&f(S.id):a.has(S.id)||f(S.id)})():d(),e[14]=g,e[15]=o.connections,e[16]=d,e[17]=f,e[18]=a,e[19]=c,e[20]=x):x=e[20];const C=c&&g&&"ring-2 ring-primary",N=c&&y&&!g&&"ring-1 ring-primary/50";let A;e[21]!==C||e[22]!==N?(A=Z(C,N),e[21]=C,e[22]=N,e[23]=A):A=e[23];let I;e[24]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx(ue,{}),e[24]=I):I=e[24];let _;e[25]!==g||e[26]!==o.connections||e[27]!==f||e[28]!==a||e[29]!==c||e[30]!==y?(_=c?t.jsx(ct,{checked:g?!0:y?"indeterminate":!1,onCheckedChange:()=>{for(const S of o.connections)g?a.has(S.id)&&f(S.id):a.has(S.id)||f(S.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",o.connections.length]})]}),e[25]=g,e[26]=o.connections,e[27]=f,e[28]=a,e[29]=c,e[30]=y,e[31]=_):_=e[31];const L=c?"w-8 opacity-100":"w-0 opacity-0 group-hover:w-8 group-hover:opacity-100";let T;e[32]!==L?(T=Z("overflow-hidden transition-all duration-150 ease-out",L),e[32]=L,e[33]=T):T=e[33];let ee;e[34]===Symbol.for("react.memo_cache_sentinel")?(ee=t.jsx(Ue,{asChild:!0,children:t.jsx($,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:Bn,children:t.jsx(ht,{size:20})})}),e[34]=ee):ee=e[34];let F;e[35]!==d?(F=S=>{S.stopPropagation(),d()},e[35]=d,e[36]=F):F=e[36];let te;e[37]===Symbol.for("react.memo_cache_sentinel")?(te=t.jsx(xt,{size:16}),e[37]=te):te=e[37];let M;e[38]!==F?(M=t.jsxs(Me,{children:[ee,t.jsx(Be,{align:"end",onClick:Un,children:t.jsxs(pe,{onClick:F,children:[te,"Open"]})})]}),e[38]=F,e[39]=M):M=e[39];let q;e[40]!==T||e[41]!==M?(q=t.jsx("div",{className:T,children:M}),e[40]=T,e[41]=M,e[42]=q):q=e[42];let W;e[43]!==_||e[44]!==q?(W=t.jsxs("div",{className:"flex items-center gap-1",children:[_,q]}),e[43]=_,e[44]=q,e[45]=W):W=e[45];let se;return e[46]!==W||e[47]!==b||e[48]!==x||e[49]!==A?(se=t.jsx(t.Fragment,{children:t.jsx(Ne,{connection:b,onClick:x,className:A,fallbackIcon:I,headerActionsAlwaysVisible:!0,headerActions:W})}),e[46]=W,e[47]=b,e[48]=x,e[49]=A,e[50]=se):se=e[50],se}function Un(i){return i.stopPropagation()}function Bn(i){return i.stopPropagation()}function Rn(i){const e=me.c(28),{count:o,total:d,onSelectAll:c,onDeselectAll:a,onDelete:f,onAddToAgent:h,onToggleStatus:g,onCancel:k}=i;if(o===0)return null;let y;e[0]!==o?(y=t.jsxs("div",{className:"text-xs text-muted-foreground pr-1 tabular-nums",children:[o," selected"]}),e[0]=o,e[1]=y):y=e[1];let m;e[2]!==o||e[3]!==a||e[4]!==c||e[5]!==d?(m=o<d?t.jsxs($,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:c,children:["Select all (",d,")"]}):t.jsx($,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:a,children:"Clear selection"}),e[2]=o,e[3]=a,e[4]=c,e[5]=d,e[6]=m):m=e[6];let b;e[7]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx(ft,{size:13}),e[7]=b):b=e[7];let x;e[8]!==h?(x=t.jsxs($,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:h,children:[b,"Add to Agent"]}),e[8]=h,e[9]=x):x=e[9];let C;e[10]!==g?(C=t.jsx($,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:()=>g("active"),children:"Enable"}),e[10]=g,e[11]=C):C=e[11];let N;e[12]!==g?(N=t.jsx($,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:()=>g("inactive"),children:"Disable"}),e[12]=g,e[13]=N):N=e[13];let A;e[14]===Symbol.for("react.memo_cache_sentinel")?(A=t.jsx(gt,{size:13}),e[14]=A):A=e[14];let I;e[15]!==f?(I=t.jsxs($,{variant:"destructive",size:"sm",className:"h-7 text-xs px-2",onClick:f,children:[A,"Delete"]}),e[15]=f,e[16]=I):I=e[16];let _;e[17]===Symbol.for("react.memo_cache_sentinel")?(_=t.jsx(jt,{size:13}),e[17]=_):_=e[17];let L;e[18]!==k?(L=t.jsx($,{variant:"ghost",size:"sm",className:"h-7 text-xs px-2",onClick:k,children:_}),e[18]=k,e[19]=L):L=e[19];let T;return e[20]!==y||e[21]!==L||e[22]!==m||e[23]!==x||e[24]!==C||e[25]!==N||e[26]!==I?(T=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:[y,m,x,C,N,I,L]})}),e[20]=y,e[21]=L,e[22]=m,e[23]=x,e[24]=C,e[25]=N,e[26]=I,e[27]=T):T=e[27],T}function Hn(i){const e=me.c(25),{open:o,onOpenChange:d,agents:c,onConfirm:a}=i,[f,h]=X.useState(null);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsxs(dt,{children:[t.jsx(pt,{children:"Add to Agent"}),t.jsx(ut,{children:"Select an agent to add the selected connections to."})]}),e[0]=g):g=e[0];let k;e[1]!==c||e[2]!==f?(k=c.length===0?t.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No agents found"}):c.map(_=>t.jsxs("button",{type:"button",onClick:()=>h(_.id),className:Z("flex items-center gap-3 w-full rounded-md px-3 py-2 text-left transition-colors",f===_.id?"bg-primary/10 ring-1 ring-primary":"hover:bg-muted/50"),children:[t.jsx(Ie,{icon:_.icon,name:_.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:_.title}),_.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:_.description})]})]},_.id)),e[1]=c,e[2]=f,e[3]=k):k=e[3];let y;e[4]!==k?(y=t.jsx("div",{className:"max-h-60 overflow-auto py-2 space-y-1",children:k}),e[4]=k,e[5]=y):y=e[5];let m;e[6]!==d?(m=t.jsx($,{variant:"outline",onClick:()=>d(!1),children:"Cancel"}),e[6]=d,e[7]=m):m=e[7];const b=!f;let x;e[8]!==a||e[9]!==d||e[10]!==f?(x=()=>{f&&(a(f),d(!1),h(null))},e[8]=a,e[9]=d,e[10]=f,e[11]=x):x=e[11];let C;e[12]!==b||e[13]!==x?(C=t.jsx($,{disabled:b,onClick:x,children:"Add"}),e[12]=b,e[13]=x,e[14]=C):C=e[14];let N;e[15]!==m||e[16]!==C?(N=t.jsxs(mt,{children:[m,C]}),e[15]=m,e[16]=C,e[17]=N):N=e[17];let A;e[18]!==y||e[19]!==N?(A=t.jsxs(at,{className:"sm:max-w-[400px]",children:[g,y,N]}),e[18]=y,e[19]=N,e[20]=A):A=e[20];let I;return e[21]!==d||e[22]!==o||e[23]!==A?(I=t.jsx(lt,{open:o,onOpenChange:d,children:A}),e[21]=d,e[22]=o,e[23]=A,e[24]=I):I=e[24],I}function Kn(i){const e=me.c(20),{open:o,onOpenChange:d,count:c,onConfirm:a}=i,f=c!==1?"s":"";let h;e[0]!==c||e[1]!==f?(h=t.jsxs(Oe,{children:["Delete ",c," connection",f,"?"]}),e[0]=c,e[1]=f,e[2]=h):h=e[2];const g=c!==1?"s":"";let k;e[3]!==g?(k=t.jsxs(Le,{children:["This will permanently delete the selected connection",g,". This action cannot be undone."]}),e[3]=g,e[4]=k):k=e[4];let y;e[5]!==h||e[6]!==k?(y=t.jsxs(Ee,{children:[h,k]}),e[5]=h,e[6]=k,e[7]=y):y=e[7];let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(Ve,{children:"Cancel"}),e[8]=m):m=e[8];const b=c!==1?"s":"";let x;e[9]!==c||e[10]!==a||e[11]!==b?(x=t.jsxs(ze,{children:[m,t.jsxs(Fe,{onClick:a,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:["Delete ",c," connection",b]})]}),e[9]=c,e[10]=a,e[11]=b,e[12]=x):x=e[12];let C;e[13]!==y||e[14]!==x?(C=t.jsxs($e,{children:[y,x]}),e[13]=y,e[14]=x,e[15]=C):C=e[15];let N;return e[16]!==d||e[17]!==o||e[18]!==C?(N=t.jsx(Pe,{open:o,onOpenChange:d,children:C}),e[16]=d,e[17]=o,e[18]=C,e[19]=N):N=e[19],N}function Xn(){const{org:i}=$t(),e=Et(),o=Ot(),d=Lt({strict:!1}),{data:c}=zt.useSession(),{stdioEnabled:a}=Vt(),f=fn(),h=tn({namespace:i.slug,resource:"connections"}),g=bn(),k=ot(h),y=ot(),[m,b]=X.useReducer(Fn,{mode:"idle"}),[x,C]=X.useState(new Set),N=x.size>0,[A,I]=X.useState(!1),[_,L]=X.useState(!1),[T,ee]=tt(et.connectionsTab(i.slug),n=>d.tab==="all"||d.tab==="connected"?d.tab:n??"all"),[F,te]=X.useState("ALL"),[M,q]=X.useState("ALL"),W=kn(),S=k.filter(n=>!(n.connection_type==="VIRTUAL"||F!=="ALL"&&n.connection_type!==F||M!=="ALL"&&n.status!==M)),oe=Pn(S),he=n=>{C(s=>{const r=new Set(s);return r.has(n)?r.delete(n):r.add(n),r})},xe=()=>{C(new Set)},Q=Jt(y).sort((n,s)=>{const r=n.app_name==="@deco/management-mcp",p=s.app_name==="@deco/management-mcp";return r&&!p?1:!r&&p?-1:0}),[ie,vt]=tt(et.selectedRegistry(i.slug),n=>n??""),Re=(ie?Q.find(n=>n.id===ie):void 0)??Q[0],_e=Re?.id??"",Ct=Zt(Re?.tools),re=nn({registryId:_e,listToolName:Ct}),Te=re.items,bt=en(re.loadMore,re.hasMore,re.isLoadingMore),He=new Set(y.filter(n=>n.connection_type!=="VIRTUAL"&&n.app_name).map(n=>n.app_name)),Y=h.search.toLowerCase(),Ke=T==="all"||Y?Te.filter(n=>{if(!Y)return!0;const s=n._meta?.["mcp.mesh"],r=[s?.friendly_name,n.server?.name,n.server?.title,n.name,n.title,n.id].filter(Boolean).join(" "),p=[s?.short_description,s?.mesh_description,n.server?.description,n.description].filter(Boolean).join(" ");return r.toLowerCase().includes(Y)||p.toLowerCase().includes(Y)}):[],fe=Ke.filter(n=>n.verified||n._meta?.["mcp.mesh"]?.verified||n.meta?.verified),ge=Ke.filter(n=>!n.verified&&!n._meta?.["mcp.mesh"]?.verified&&!n.meta?.verified),Nt=T==="all"&&!Y?[]:oe,Xe=n=>{const s=sn(n.name||n.title||n.server?.title||""),r=typeof n.id=="string"&&n.id.includes("/"),p=typeof n.server?.name=="string"&&n.server.name.includes("/"),j=r&&!p?n.id:n.server?.name||n.id||"";o({to:"/$org/$project/store/$appName",params:{org:i.slug,project:G,appName:s},search:{registryId:_e,serverName:j}})},[je,we]=X.useState(null),We=async n=>{if(!(!i||!c?.user?.id)){we(n.id);try{const s=In(n,i.id,c.user.id,{remoteIndex:0}),r=s.connection_type==="STDIO",p=!!s.connection_url,j=r&&s.connection_headers&&typeof s.connection_headers=="object"&&"command"in s.connection_headers;if(!p&&!j){E.error("This MCP Server cannot be connected: no connection method available"),we(null);return}const l=n.id??n.title,P=y.filter(V=>V.app_name===l||V.title===s.title);if(P.length>0){const V=s.title||"MCP Server";s.title=`${V} (${P.length+1})`}const{id:v}=await g.create.mutateAsync(s),D=new URL(`/mcp/${v}`,window.location.origin),Ce=await Bt({url:D.href,token:null});if(Ce.supportsOAuth&&!Ce.isAuthenticated){const{token:V,tokenInfo:O,error:Ze}=await Rt({connectionId:v});if(Ze||!V){E.error(`Authentication failed: ${Ze??"no token received"}`);return}else{if(O)try{(await fetch(`/api/connections/${v}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:O.accessToken,refreshToken:O.refreshToken,expiresIn:O.expiresIn,scope:O.scope,clientId:O.clientId,clientSecret:O.clientSecret,tokenEndpoint:O.tokenEndpoint})})).ok?await g.update.mutateAsync({id:v,data:{}}):await g.update.mutateAsync({id:v,data:{connection_token:V}})}catch{await g.update.mutateAsync({id:v,data:{connection_token:V}})}else await g.update.mutateAsync({id:v,data:{connection_token:V}});await e.invalidateQueries({queryKey:Ht.isMCPAuthenticated(D.href,null)}),E.success("Authentication successful")}}E.success("Connected successfully")}catch(s){E.error(`Failed to connect: ${s instanceof Error?s.message:String(s)}`)}finally{we(null)}}},Ge=d.action==="create",St=()=>{o({to:"/$org/$project/mcps",params:{org:i.slug,project:G},search:{action:"create"}})},qe=()=>{o({to:"/$org/$project/mcps",params:{org:i.slug,project:G},search:{}})},u=Ft({resolver:Mt(An),defaultValues:{title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),z=u.watch("ui_type"),Qe=u.watch("connection_url"),kt=u.watch("npx_package"),ce=be({uiType:z,connectionUrl:Qe??"",npxPackage:kt??""})??rt({uiType:z,connectionUrl:Qe??"",registryItems:Te}),w=m.mode==="editing"?m.connection:null;X.useEffect(()=>{if(w){const n=Ut(w.connection_headers)?w.connection_headers:null;if(n&&w.connection_type==="STDIO"){const s=wn(n.envVars);if(Ln(n)){const r=zn(n);u.reset({title:w.title,description:w.description,icon:w.icon??null,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:r,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:s})}else{const r=Vn(n);u.reset({title:w.title,description:w.description,icon:w.icon??null,ui_type:"STDIO",connection_url:"",connection_token:null,npx_package:"",stdio_command:r.command,stdio_args:r.args,stdio_cwd:r.cwd,env_vars:s})}}else u.reset({title:w.title,description:w.description,icon:w.icon??null,ui_type:w.connection_type,connection_url:w.connection_url??"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]})}else u.reset({title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]})},[w,u]);const le=Nn({connectionId:Sn,orgId:i.id}),ye=()=>{e.invalidateQueries({predicate:n=>{const s=n.queryKey;return s[1]===i.id&&s[3]==="collection"&&s[4]==="CONNECTIONS"}})},_t=async()=>{I(!1);const n=[...x];let s=0;for(const r of n)try{(await le.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:r,force:!0}})).isError||s++}catch{}ye(),E.success(`Deleted ${s} connection${s!==1?"s":""}`),xe()},Tt=async n=>{const s=[...x];let r=0;for(const p of s)try{await g.update.mutateAsync({id:p,data:{status:n}}),r++}catch{}ye(),E.success(`${n==="active"?"Enabled":"Disabled"} ${r} connection${r!==1?"s":""}`),xe()},wt=async n=>{const s=W.find(j=>j.id===n);if(!s||!le)return;const r=new Set(s.connections.map(j=>j.connection_id)),p=[...x].filter(j=>!r.has(j)).map(j=>({connection_id:j,selected_tools:null,selected_resources:null,selected_prompts:null}));if(p.length===0){E.info("All selected connections are already in that agent");return}try{await le.callTool({name:"COLLECTION_VIRTUAL_MCP_UPDATE",arguments:{id:n,data:{connections:[...s.connections,...p]}}}),e.invalidateQueries({predicate:j=>{const l=j.queryKey;return l[1]===i.id&&l[3]==="collection"&&l[4]==="VIRTUAL_MCP"}}),E.success(`Added ${p.length} connection${p.length!==1?"s":""} to "${s.title}"`),xe()}catch{E.error("Failed to add connections to agent")}},Ye=n=>{const s=n.content;return Array.isArray(s)&&s[0]?.type==="text"&&typeof s[0].text=="string"?s[0].text:"Unknown error"},Dt=async()=>{if(m.mode!=="deleting")return;const n=m.connection;b({type:"close"});try{const s=await le.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:n.id}});if(s.isError){const r=Ye(s),p=r.replace(/^Error:\s*/,"");try{const j=JSON.parse(p);if(j.code==="CONNECTION_IN_USE"&&j.agentNames){b({type:"force-delete",connection:n,agentNames:j.agentNames.map(l=>`"${l}"`).join(", ")});return}}catch{}E.error(`Failed to delete connection: ${r}`);return}ye(),E.success("Connection deleted successfully")}catch(s){const r=s instanceof Error?s.message:String(s);E.error(`Failed to delete connection: ${r}`)}},At=async()=>{if(m.mode!=="force-deleting")return;const n=m.connection.id;b({type:"close"});try{const s=await le.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:n,force:!0}});if(s.isError){E.error(`Failed to delete connection: ${Ye(s)}`);return}ye(),E.success("Connection deleted successfully")}catch(s){const r=s instanceof Error?s.message:String(s);E.error(`Failed to delete connection: ${r}`)}},Je=async n=>{let s,r=null,p=null,j=null;if(n.ui_type==="NPX"?(s="STDIO",r="",j=En(n.npx_package||"",n.env_vars||[])):n.ui_type==="STDIO"?(s="STDIO",r="",j=On(n.stdio_command||"",n.stdio_args||"",n.stdio_cwd,n.env_vars||[])):(s=n.ui_type,r=n.connection_url||"",p=n.connection_token||null),w){await g.update.mutateAsync({id:w.id,data:{title:n.title,description:n.description||null,icon:n.icon??null,connection_type:s,connection_url:r,...p&&{connection_token:p},...j&&{connection_headers:j}}}),b({type:"close"}),u.reset();return}const l=Kt("conn");await g.create.mutateAsync({id:l,title:n.title,description:n.description||null,connection_type:s,connection_url:r,connection_token:p,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:c?.user?.id||"system",organization_id:i.id,icon:n.icon??null,app_name:null,app_id:null,connection_headers:j,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),qe(),u.reset(),o({to:"/$org/$project/mcps/$appSlug",params:{org:i.slug,project:G,appSlug:ne({app_name:null,connection_url:r,title:n.title,id:l})}})},De=n=>{n||(Ge?qe():b({type:"close"}),u.reset())},ve=n=>{const s=n.trim();if(!s)return;const r=!!u.formState.dirtyFields.title,p=!!u.formState.dirtyFields.description,j=!!u.formState.dirtyFields.env_vars,l=v=>{if(v&&(!r&&!u.getValues("title").trim()&&v.title&&u.setValue("title",v.title,{shouldDirty:!1}),!p&&!(u.getValues("description")??"").trim()&&v.description&&u.setValue("description",v.description,{shouldDirty:!1}),!j&&v.envVarKeys?.length)){const D=u.getValues("env_vars")??[],Ce=new Set(D.map(O=>O.key)),V=v.envVarKeys.filter(O=>!Ce.has(O));V.length>0&&u.setValue("env_vars",[...D,...V.map(O=>({key:O,value:""}))],{shouldDirty:!0})}},P=$n(s);if(P&&a){u.setValue("ui_type","NPX",{shouldDirty:!0}),u.setValue("npx_package",P.packageName,{shouldDirty:!0}),u.setValue("connection_url","",{shouldDirty:!0}),u.setValue("connection_token",null,{shouldDirty:!0}),l(be({uiType:"NPX",npxPackage:P.packageName}));return}if(s.startsWith("http://")||s.startsWith("https://")){const v=z==="HTTP"||z==="SSE"||z==="Websocket"?z:"HTTP";u.setValue("ui_type",v,{shouldDirty:!0}),u.setValue("connection_url",s,{shouldDirty:!0}),l(be({uiType:v,connectionUrl:s})??rt({uiType:v,connectionUrl:s,registryItems:Te}));return}z==="NPX"&&l(be({uiType:"NPX",npxPackage:s}))},It=t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs($,{variant:"outline",onClick:St,size:"sm",className:"h-7 w-7 px-0 sm:w-auto sm:px-3 rounded-lg text-sm font-medium",children:[t.jsx(ft,{size:14,className:"sm:hidden"}),t.jsx("span",{className:"hidden sm:inline",children:"Custom Connection"})]})});return t.jsx(t.Fragment,{children:t.jsxs(ae,{children:[(()=>{const n=w?"Edit Connection":"Create Connection",s=w?"Update the connection details below.":"Create a custom connection in your organization. Fill in the details below.",r=u.formState.isSubmitting?"Saving...":w?"Update Connection":"Create Connection",p=t.jsxs("div",{className:"grid gap-4",children:[t.jsx(U,{control:u.control,name:"ui_type",render:({field:l})=>t.jsxs(B,{children:[t.jsx(R,{children:"Type *"}),t.jsxs(gn,{value:l.value,onValueChange:l.onChange,children:[t.jsx(H,{children:t.jsx(jn,{children:t.jsx(yn,{})})}),t.jsxs(vn,{children:[t.jsx(de,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ae,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(de,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ae,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(de,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ae,{className:"w-4 h-4"}),"Websocket"]})}),a&&t.jsxs(t.Fragment,{children:[t.jsx(de,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ue,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(de,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Qt,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(K,{})]})}),z==="NPX"&&t.jsx(U,{control:u.control,name:"npx_package",render:({field:l})=>t.jsxs(B,{children:[t.jsx(R,{children:"NPM Package *"}),t.jsx(H,{children:t.jsx(J,{placeholder:"@perplexity-ai/mcp-server",...l,value:l.value??"",onPaste:P=>{const v=P.clipboardData.getData("text");v&&(P.preventDefault(),u.setValue("npx_package",v.trim(),{shouldDirty:!0}),ve(v))},onBlur:P=>{ve(P.target.value),l.onBlur()}})}),t.jsx(K,{})]})}),z==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[t.jsx(U,{control:u.control,name:"stdio_command",render:({field:l})=>t.jsxs(B,{children:[t.jsx(R,{children:"Command *"}),t.jsx(H,{children:t.jsx(J,{placeholder:"node, bun, python...",...l,value:l.value??""})}),t.jsx(K,{})]})}),t.jsx(U,{control:u.control,name:"stdio_args",render:({field:l})=>t.jsxs(B,{children:[t.jsx(R,{children:"Arguments"}),t.jsx(H,{children:t.jsx(J,{placeholder:"arg1 arg2 --flag value",...l,value:l.value??""})}),t.jsx(K,{})]})})]}),t.jsx(U,{control:u.control,name:"stdio_cwd",render:({field:l})=>t.jsxs(B,{children:[t.jsx(R,{children:"Working Directory"}),t.jsx(H,{children:t.jsx(J,{placeholder:"/path/to/project (optional)",...l,value:l.value??""})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory where the command will be executed"}),t.jsx(K,{})]})})]}),(z==="NPX"||z==="STDIO")&&t.jsx(U,{control:u.control,name:"env_vars",render:({field:l})=>t.jsxs(B,{children:[t.jsx(R,{children:"Environment Variables"}),t.jsx(H,{children:t.jsx(Dn,{value:l.value??[],onChange:l.onChange})}),t.jsx(K,{})]})}),z!=="NPX"&&z!=="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsx(U,{control:u.control,name:"connection_url",render:({field:l})=>t.jsxs(B,{children:[t.jsx(R,{children:"URL *"}),t.jsx(H,{children:t.jsx(J,{placeholder:"https://example.com/mcp",...l,value:l.value??"",onPaste:P=>{const v=P.clipboardData.getData("text");v&&(P.preventDefault(),u.setValue("connection_url",v.trim(),{shouldDirty:!0}),ve(v))},onBlur:P=>{ve(P.target.value),l.onBlur()}})}),t.jsx(K,{})]})}),t.jsx(U,{control:u.control,name:"connection_token",render:({field:l})=>t.jsxs(B,{children:[t.jsx(R,{children:ce?.token?.label??"Token (optional)"}),t.jsx(H,{children:t.jsx(J,{type:"password",placeholder:ce?.token?.placeholder??"Bearer token or API key",...l,value:l.value??""})}),ce?.token?.helperText&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:[ce.token.helperText,ce.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(K,{})]})})]}),t.jsx(U,{control:u.control,name:"title",render:({field:l})=>t.jsxs(B,{children:[t.jsx(R,{children:"Name *"}),t.jsx(H,{children:t.jsx(J,{placeholder:"My Connection",...l})}),t.jsx(K,{})]})}),t.jsx(U,{control:u.control,name:"description",render:({field:l})=>t.jsxs(B,{children:[t.jsx(R,{children:"Description"}),t.jsx(H,{children:t.jsx(Cn,{placeholder:"A brief description of this connection",rows:3,...l,value:l.value??""})}),t.jsx(K,{})]})})]}),j=Ge||m.mode==="editing";return f?t.jsx(an,{open:j,onOpenChange:De,children:t.jsxs(dn,{className:"max-h-[90vh]",children:[t.jsx(pn,{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(un,{children:n}),t.jsx(mn,{className:"mt-1",children:s})]}),t.jsx(hn,{asChild:!0,children:t.jsx($,{variant:"ghost",size:"icon",className:"shrink-0 -mt-1",children:t.jsx(jt,{size:16})})})]})}),t.jsx(st,{...u,children:t.jsxs("form",{onSubmit:u.handleSubmit(Je),children:[t.jsx("div",{className:"overflow-y-auto px-4 pb-4",children:p}),t.jsx(xn,{children:t.jsx($,{type:"submit",disabled:u.formState.isSubmitting,className:"w-full",children:r})})]})})]})}):t.jsx(lt,{open:j,onOpenChange:De,children:t.jsxs(at,{className:"sm:max-w-[525px]",children:[t.jsxs(dt,{children:[t.jsx(pt,{children:n}),t.jsx(ut,{children:s})]}),t.jsx(st,{...u,children:t.jsxs("form",{onSubmit:u.handleSubmit(Je),children:[t.jsx("div",{className:"py-4",children:p}),t.jsxs(mt,{children:[t.jsx($,{type:"button",variant:"outline",onClick:()=>De(!1),children:"Cancel"}),t.jsx($,{type:"submit",disabled:u.formState.isSubmitting,className:"min-w-40",children:r})]})]})})]})})})(),t.jsx(Pe,{open:m.mode==="deleting",onOpenChange:n=>!n&&b({type:"close"}),children:t.jsxs($e,{children:[t.jsxs(Ee,{children:[t.jsx(Oe,{children:"Delete Connection?"}),t.jsxs(Le,{children:["This action cannot be undone. This will permanently delete"," ",t.jsx("span",{className:"font-medium text-foreground",children:m.mode==="deleting"&&m.connection.title}),"."]})]}),t.jsxs(ze,{children:[t.jsx(Ve,{children:"Cancel"}),t.jsx(Fe,{onClick:Dt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),t.jsx(Pe,{open:m.mode==="force-deleting",onOpenChange:n=>!n&&b({type:"close"}),children:t.jsxs($e,{children:[t.jsxs(Ee,{children:[t.jsx(Oe,{children:"Connection Used by Agents"}),t.jsx(Le,{asChild:!0,children:t.jsxs("div",{children:[t.jsxs("p",{children:["The connection"," ",t.jsx("span",{className:"font-medium text-foreground",children:m.mode==="force-deleting"&&m.connection.title})," ","is currently used by the following agent(s):"," ",t.jsx("span",{className:"font-medium text-foreground",children:m.mode==="force-deleting"&&m.agentNames}),"."]}),t.jsx("p",{className:"mt-2",children:"Deleting this connection will remove it from those agents, which may impact existing workflows that depend on them."})]})})]}),t.jsxs(ze,{children:[t.jsx(Ve,{children:"Cancel"}),t.jsx(Fe,{onClick:At,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete Anyway"})]})]})}),t.jsx(Kn,{open:A,onOpenChange:I,count:x.size,onConfirm:_t}),t.jsx(Hn,{open:_,onOpenChange:L,agents:W,onConfirm:wt}),t.jsxs(ae.Header,{children:[t.jsx(ae.Header.Left,{children:t.jsx(on,{children:t.jsx(rn,{children:t.jsx(cn,{children:t.jsx(ln,{children:"Connections"})})})})}),t.jsxs(ae.Header.Right,{children:[t.jsx(Xt,{sortKey:h.sortKey,sortDirection:h.sortDirection,onSort:h.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:F,onChange:n=>te(n||"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:M,onChange:n=>q(n||"ALL"),options:[{id:"ALL",label:"All"},{id:"active",label:"Active"},{id:"inactive",label:"Inactive"},{id:"error",label:"Error"}]}]}),It]})]}),t.jsxs("div",{className:"flex flex-col gap-0",children:[t.jsx("div",{children:t.jsx(Wt,{value:h.search,onChange:h.setSearch,placeholder:"Search for a Connection...",onKeyDown:n=>{n.key==="Escape"&&(h.setSearch(""),n.target.blur())}})}),t.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border",children:[t.jsx(Gt,{tabs:[{id:"all",label:"All"},{id:"connected",label:"Connected"}],activeTab:T,onTabChange:n=>ee(n)}),Q.length>0&&t.jsx("div",{className:Z(T!=="all"&&"invisible pointer-events-none"),children:t.jsxs(Me,{children:[t.jsx(Ue,{asChild:!0,children:t.jsxs($,{variant:"outline",size:"sm",className:"h-7 px-2 gap-1.5 text-sm font-normal",children:[(()=>{const n=Q.find(s=>s.id===(ie||Q[0]?.id))??Q[0];return t.jsxs(t.Fragment,{children:[t.jsx(Ie,{icon:n?.icon,name:n?.title??"",size:"2xs",className:"shrink-0 rounded-sm"}),t.jsx("span",{children:n?.title})]})})(),t.jsx(Tn,{size:14,className:"text-muted-foreground"})]})}),t.jsx(Be,{align:"end",children:Q.map(n=>t.jsxs(pe,{onClick:()=>vt(n.id),className:Z(ie===n.id||!ie&&n.id===Q[0]?.id?"bg-accent":""),children:[t.jsx(Ie,{icon:n.icon,name:n.title,size:"2xs",className:"shrink-0 rounded-sm"}),n.title]},n.id))})]})})]})]}),t.jsx(ae.Content,{children:t.jsx("div",{className:"flex-1 overflow-auto p-5",children:(Y?fe.length===0&&ge.length===0&&S.length===0:T==="all"?fe.length===0&&ge.length===0:S.length===0)?t.jsx(qt,{image:t.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:336,height:320,"aria-hidden":"true"}),title:"No Connections found",description:h.search?`No Connections match "${h.search}"`:"Create a connection to get started."}):t.jsxs("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:[Nt.map(n=>{if(n.type==="group")return t.jsx(Mn,{group:n,onOpen:()=>{o({to:"/$org/$project/mcps/$appSlug",params:{org:i.slug,project:G,appSlug:n.key}})},selectionMode:N,selectedIds:x,onToggleSelect:he},n.key);const s=n.connection,r=x.has(s.id);return t.jsx(Ne,{connection:s,fallbackIcon:t.jsx(ue,{}),onClick:()=>N?he(s.id):o({to:"/$org/$project/mcps/$appSlug",params:{org:i.slug,project:G,appSlug:ne(s)}}),className:Z(r&&"ring-2 ring-primary bg-primary/5"),headerActionsAlwaysVisible:!0,headerActions:t.jsxs("div",{className:"flex items-center gap-1",children:[N?t.jsx(ct,{checked:r,onCheckedChange:()=>he(s.id),onClick:p=>p.stopPropagation()}):t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}),t.jsx("div",{className:Z("overflow-hidden transition-all duration-150 ease-out",N?"w-8 opacity-100":"w-0 opacity-0 group-hover:w-8 group-hover:opacity-100"),children:t.jsxs(Me,{children:[t.jsx(Ue,{asChild:!0,children:t.jsx($,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:p=>p.stopPropagation(),children:t.jsx(ht,{size:20})})}),t.jsxs(Be,{align:"end",onClick:p=>p.stopPropagation(),children:[t.jsxs(pe,{onClick:p=>{p.stopPropagation(),o({to:"/$org/$project/mcps/$appSlug",params:{org:i.slug,project:G,appSlug:ne(s)}})},children:[t.jsx(xt,{size:16}),"Open"]}),t.jsxs(pe,{onClick:p=>{p.stopPropagation(),he(s.id)},children:[t.jsx(Yt,{size:16}),"Select"]}),t.jsxs(pe,{variant:"destructive",onClick:p=>{p.stopPropagation(),b({type:"delete",connection:s})},children:[t.jsx(gt,{size:16}),"Delete"]})]})]})})]})},s.id)}),T==="all"&&fe.length>0&&t.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[t.jsx(_n,{size:13,className:"text-muted-foreground shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:"Verified"}),t.jsx("div",{className:"flex-1 h-px bg-border"})]}),fe.map(n=>{const s=n.server?.name||n.name||n.id||"",r=He.has(s),p=n._meta?.["mcp.mesh"],j=p?.friendlyName||p?.friendly_name||n.server?.title||n.title||n.server?.name||n.name||n.id||"",l=n.server?.description||n.description||null,P=n.server?.icons?.[0]?.src||nt(n.server?.repository)||null,v=y.filter(D=>D.connection_type!=="VIRTUAL"&&D.app_name===s);return t.jsx(Ne,{connection:{title:j,description:l,icon:P},fallbackIcon:t.jsx(ue,{}),onClick:()=>{if(r){const D=v[0];D&&o({to:"/$org/$project/mcps/$appSlug",params:{org:i.slug,project:G,appSlug:ne(D)}})}else Xe(n)},headerActionsAlwaysVisible:!0,headerActions:r?t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}):t.jsx($,{variant:"outline",size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",disabled:je!==null,onClick:D=>{D.stopPropagation(),We(n)},children:je===n.id?t.jsx(Se,{size:14,className:"animate-spin"}):"Connect"})},`catalog-${n.id}`)}),T==="all"&&ge.length>0&&t.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[t.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:"All connections"}),t.jsx("div",{className:"flex-1 h-px bg-border"})]}),ge.map(n=>{const s=n.server?.name||n.name||n.id||"",r=He.has(s),p=n._meta?.["mcp.mesh"],j=p?.friendlyName||p?.friendly_name||n.server?.title||n.title||n.server?.name||n.name||n.id||"",l=n.server?.description||n.description||null,P=n.server?.icons?.[0]?.src||nt(n.server?.repository)||null,v=y.filter(D=>D.connection_type!=="VIRTUAL"&&D.app_name===s);return t.jsx(Ne,{connection:{title:j,description:l,icon:P},fallbackIcon:t.jsx(ue,{}),onClick:()=>{if(r){const D=v[0];D&&o({to:"/$org/$project/mcps/$appSlug",params:{org:i.slug,project:G,appSlug:ne(D)}})}else Xe(n)},headerActionsAlwaysVisible:!0,headerActions:r?t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}):t.jsx($,{variant:"outline",size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",disabled:je!==null,onClick:D=>{D.stopPropagation(),We(n)},children:je===n.id?t.jsx(Se,{size:14,className:"animate-spin"}):"Connect"})},`catalog-${n.id}`)}),(T==="all"||Y)&&_e&&t.jsx("div",{ref:bt,className:"col-span-full h-4"}),(T==="all"||Y)&&re.isLoadingMore&&t.jsx("div",{className:"col-span-full flex justify-center py-6",children:t.jsx(Se,{size:24,className:"animate-spin text-muted-foreground"})})]})})}),N&&t.jsx(Rn,{count:x.size,total:S.length,onSelectAll:()=>{C(new Set(S.map(n=>n.id)))},onDeselectAll:()=>C(new Set),onDelete:()=>I(!0),onAddToAgent:()=>L(!0),onToggleStatus:Tt,onCancel:xe})]})})}function uo(){const i=me.c(1);let e;return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Pt,{children:t.jsx(X.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(Se,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(Xn,{})})}),i[0]=e):e=i[0],e}export{uo as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bN as h,c as d,x as g,bO as y}from"./index-
|
|
1
|
+
import{bN as h,c as d,x as g,bO as y}from"./index-Di6oLb1g.js";const m={authConfig:()=>["authConfig"],threads:e=>["threads",e],virtualMcpThreads:(e,t)=>["threads",e,"virtual-mcp",t],thread:(e,t)=>["thread",e,t],threadMessages:(e,t)=>["thread-messages",e,t],messages:e=>["messages",e],organizations:()=>["organizations"],members:e=>[e,"members"],invitations:e=>[e,"invitations"],organizationRoles:e=>[e,"organization-roles"],connections:e=>[e,"connections"],connectionsByBinding:(e,t)=>[e,"connections",`binding:${t}`],connection:(e,t)=>[e,"connection",t],isMCPAuthenticated:(e,t)=>["is-mcp-authenticated",e,t],mcpTools:(e,t)=>["mcp","tools",e,t],mcpClient:(e,t,n,o)=>["mcp","client",e,t,n,o],mcpToolsList:e=>["mcp","client",e,"tools"],mcpResourcesList:e=>["mcp","client",e,"resources"],mcpPromptsList:e=>["mcp","client",e,"prompts"],mcpReadResource:(e,t)=>["mcp","client",e,"resource",t],mcpGetPrompt:(e,t,n)=>["mcp","client",e,"prompt",t,n],mcpToolCall:(e,t,n)=>["mcp","client",e,"tool-call",t,n],organizationSettings:e=>["organization-settings",e],activeOrganization:e=>["activeOrganization",e],modelsList:e=>["models-list",e],connectionCollections:e=>[e,"collections","discovery"],toolCall:(e,t,n)=>["tool-call",e,t,n],collectionItems:(e,t)=>["collection",e,t],collection:(e,t,n)=>[e,t,"collection",n],collectionItem:(e,t,n,o,i)=>[e,t,n,"collection",o,i],collectionList:(e,t,n,o,i)=>[e,t,n,"collection",o,"list",i],collectionListInfinite:(e,t,n,o,i)=>[e,t,n,"collection",o,"list-infinite",i],githubReadme:(e,t)=>["github-readme",e,t],monitoringStats:()=>["monitoring","stats"],monitoringLogs:e=>["monitoring","logs",e],monitoringLogsInfinite:(e,t)=>["monitoring","logs-infinite",e,t],virtualMcpPrompts:e=>["virtual-mcp",e,"prompts"],connectionPrompts:e=>["connection",e,"prompts"],connectionResources:e=>["connection",e,"resources"],user:e=>["user",e]};class _ extends h{constructor(t,n){super(t,n)}send(t,n){const o=C(t);return o?.type==="emit"?(this.onmessage?.(o.message),Promise.resolve()):o?.type==="suppress"?Promise.resolve():super.send(t,n)}}function C(e){const t=e;if(!t||typeof t!="object"||!("method"in t))return null;switch(t.method){case"initialize":{const n=t?.params?.protocolVersion;return n?{type:"emit",message:{result:{protocolVersion:n,capabilities:{tools:{},resources:{},prompts:{},tasks:{list:{},cancel:{},requests:{tool:{call:{}}}}},serverInfo:{name:"mesh-virtual-mcp",version:"1.0.0"}},jsonrpc:t.jsonrpc??"2.0",id:t.id}}:null}case"notifications/roots/list_changed":case"notifications/initialized":case"notifications/cancelled":case"notifications/progress":return{type:"suppress"};default:return null}}const b={name:"mesh-sdk",version:"1.0.0"};function T(e,t){const n=t??(typeof window<"u"?window.location.origin:void 0);if(!n)throw new Error("MCP client requires either meshUrl option or a browser environment.");const o=e?`/mcp/${e}`:"/mcp";return new URL(o,n).href}async function f({connectionId:e,orgId:t,token:n,meshUrl:o}){const i=T(e,o),s=new y(b,{capabilities:{tasks:{list:{},cancel:{},requests:{tool:{call:{}}}}}}),r=new _(new URL(i),{requestInit:{headers:{"Content-Type":"application/json",Accept:"application/json, text/event-stream","x-org-id":t,...n?{Authorization:`Bearer ${n}`}:{}}}});await s.connect(r);const l=m.mcpClient(t,e??"self",n??"",o??"");return s.toJSON=()=>`mcp-client:${l.join(":")}`,s}function S(e){const t=d.c(13),{connectionId:n,orgId:o,token:i,meshUrl:s}=e;let r;t[0]!==n||t[1]!==s||t[2]!==o||t[3]!==i?(r=m.mcpClient(o,n??"self",i??"",s??""),t[0]=n,t[1]=s,t[2]=o,t[3]=i,t[4]=r):r=t[4];const l=r;let c;t[5]!==n||t[6]!==s||t[7]!==o||t[8]!==i?(c=()=>f({connectionId:n,orgId:o,token:i,meshUrl:s}),t[5]=n,t[6]=s,t[7]=o,t[8]=i,t[9]=c):c=t[9];let a;t[10]!==l||t[11]!==c?(a={queryKey:l,queryFn:c,staleTime:1/0,gcTime:0},t[10]=l,t[11]=c,t[12]=a):a=t[12];const{data:u}=g(a);return u}function w(e){const t=d.c(13),{connectionId:n,orgId:o,token:i,meshUrl:s}=e;let r;t[0]!==n||t[1]!==s||t[2]!==o||t[3]!==i?(r=n!==void 0?m.mcpClient(o,n??"self",i??"",s??""):["mcp","client","skip",o],t[0]=n,t[1]=s,t[2]=o,t[3]=i,t[4]=r):r=t[4];const l=r;let c;t[5]!==n||t[6]!==s||t[7]!==o||t[8]!==i?(c=async()=>n===void 0?null:f({connectionId:n,orgId:o,token:i,meshUrl:s}),t[5]=n,t[6]=s,t[7]=o,t[8]=i,t[9]=c):c=t[9];let a;t[10]!==l||t[11]!==c?(a={queryKey:l,queryFn:c,staleTime:1/0,gcTime:0},t[10]=l,t[11]=c,t[12]=a):a=t[12];const{data:u}=g(a);return u??null}const P={SELF:e=>`${e}_self`,REGISTRY:e=>`${e}_registry`,COMMUNITY_REGISTRY:e=>`${e}_community-registry`,DEV_ASSETS:e=>`${e}_dev-assets`},M="self";function R(e){return{id:P.REGISTRY(e),title:"Deco Store",description:"Official deco MCP registry with curated integrations",connection_type:"HTTP",connection_url:"https://studio.decocms.com/org/deco/registry/mcp",icon:"https://assets.decocache.com/decocms/00ccf6c3-9e13-4517-83b0-75ab84554bb9/596364c63320075ca58483660156b6d9de9b526e.png",app_name:"deco-registry",app_id:null,connection_token:null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{isDefault:!0,type:"registry"}}}function L(){return{id:"community-registry",title:"MCP Registry",description:"Community MCP registry with thousands of handy MCPs",connection_type:"HTTP",connection_url:"https://sites-registry.decocache.com/mcp",icon:"https://assets.decocache.com/decocms/cd7ca472-0f72-463a-b0de-6e44bdd0f9b4/mcp.png",app_name:"mcp-registry",app_id:null,connection_token:null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{isDefault:!0,type:"registry"}}}function D(e){return{id:v(e),organization_id:e,title:"Decopilot",description:"Default agent that aggregates all organization connections",icon:"https://assets.decocache.com/decocms/fd07a578-6b1c-40f1-bc05-88a3b981695d/f7fc4ffa81aec04e37ae670c3cd4936643a7b269.png",status:"active",created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:"system",updated_by:void 0,metadata:{instructions:null},connections:[]}}const p="decopilot_";function E(e){return!e||!e.startsWith(p)?null:e.slice(p.length)||null}function v(e){return`${p}${e}`}export{m as K,_ as S,P as W,M as a,L as b,f as c,D as d,R as e,w as f,v as g,E as i,S as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c8 as It,c9 as _t,bQ as Et,bk as D,n as d,ca as oe,cb as qe,b_ as Tt,b$ as St,bo as At,bn as P,aN as Q,aP as te,o as S,bl as h,aO as L,cc as Mt,cd as w,aQ as wt,z as V,v as me,c as ze,r as z}from"./index-
|
|
1
|
+
import{c8 as It,c9 as _t,bQ as Et,bk as D,n as d,ca as oe,cb as qe,b_ as Tt,b$ as St,bo as At,bn as P,aN as Q,aP as te,o as S,bl as h,aO as L,cc as Mt,cd as w,aQ as wt,z as V,v as me,c as ze,r as z}from"./index-Di6oLb1g.js";import{d as xt}from"./constants-kAo23sAc.js";import{A as Te,D as de}from"./decopilot-events-Brt4gAR6.js";import"./index-CJ0BaJHY.js";var X;(function(t){t.assertEqual=r=>{};function e(r){}t.assertIs=e;function a(r){throw new Error}t.assertNever=a,t.arrayToEnum=r=>{const n={};for(const o of r)n[o]=o;return n},t.getValidEnumValues=r=>{const n=t.objectKeys(r).filter(i=>typeof r[r[i]]!="number"),o={};for(const i of n)o[i]=r[i];return t.objectValues(o)},t.objectValues=r=>t.objectKeys(r).map(function(n){return r[n]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const n=[];for(const o in r)Object.prototype.hasOwnProperty.call(r,o)&&n.push(o);return n},t.find=(r,n)=>{for(const o of r)if(n(o))return o},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function s(r,n=" | "){return r.map(o=>typeof o=="string"?`'${o}'`:o).join(n)}t.joinValues=s,t.jsonStringifyReplacer=(r,n)=>typeof n=="bigint"?n.toString():n})(X||(X={}));var Se;(function(t){t.mergeShapes=(e,a)=>({...e,...a})})(Se||(Se={}));X.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);X.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class le extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=e}format(e){const a=e||function(n){return n.message},s={_errors:[]},r=n=>{for(const o of n.issues)if(o.code==="invalid_union")o.unionErrors.map(r);else if(o.code==="invalid_return_type")r(o.returnTypeError);else if(o.code==="invalid_arguments")r(o.argumentsError);else if(o.path.length===0)s._errors.push(a(o));else{let i=s,u=0;for(;u<o.path.length;){const l=o.path[u];u===o.path.length-1?(i[l]=i[l]||{_errors:[]},i[l]._errors.push(a(o))):i[l]=i[l]||{_errors:[]},i=i[l],u++}}};return r(this),s}static assert(e){if(!(e instanceof le))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,X.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=a=>a.message){const a=Object.create(null),s=[];for(const r of this.issues)if(r.path.length>0){const n=r.path[0];a[n]=a[n]||[],a[n].push(e(r))}else s.push(e(r));return{formErrors:s,fieldErrors:a}}get formErrors(){return this.flatten()}}le.create=t=>new le(t);var Ae;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Ae||(Ae={}));var g;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(g||(g={}));var We="vercel.ai.error",Rt=Symbol.for(We),Me,we,F=class Ye extends(we=Error,Me=Rt,we){constructor({name:e,message:a,cause:s}){super(a),this[Me]=!0,this.name=e,this.cause=s}static isInstance(e){return Ye.hasMarker(e,We)}static hasMarker(e,a){const s=Symbol.for(a);return e!=null&&typeof e=="object"&&s in e&&typeof e[s]=="boolean"&&e[s]===!0}};function He(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var Ge="AI_InvalidArgumentError",Qe=`vercel.ai.error.${Ge}`,Nt=Symbol.for(Qe),xe,Re,Ot=class extends(Re=F,xe=Nt,Re){constructor({message:t,cause:e,argument:a}){super({name:Ge,message:t,cause:e}),this[xe]=!0,this.argument=a}static isInstance(t){return F.hasMarker(t,Qe)}},Xe="AI_JSONParseError",Ke=`vercel.ai.error.${Xe}`,Ct=Symbol.for(Ke),Ne,Oe,Ce=class extends(Oe=F,Ne=Ct,Oe){constructor({text:t,cause:e}){super({name:Xe,message:`JSON parsing failed: Text: ${t}.
|
|
2
2
|
Error message: ${He(e)}`,cause:e}),this[Ne]=!0,this.text=t}static isInstance(t){return F.hasMarker(t,Ke)}},et="AI_TypeValidationError",tt=`vercel.ai.error.${et}`,Pt=Symbol.for(tt),Pe,De,H=class ge extends(De=F,Pe=Pt,De){constructor({value:e,cause:a,context:s}){let r="Type validation failed";if(s?.field&&(r+=` for ${s.field}`),s?.entityName||s?.entityId){r+=" (";const n=[];s.entityName&&n.push(s.entityName),s.entityId&&n.push(`id: "${s.entityId}"`),r+=n.join(", "),r+=")"}super({name:et,message:`${r}: Value: ${JSON.stringify(e)}.
|
|
3
3
|
Error message: ${He(a)}`,cause:a}),this[Pe]=!0,this.value=e,this.context=s}static isInstance(e){return F.hasMarker(e,tt)}static wrap({value:e,cause:a,context:s}){var r,n,o;return ge.isInstance(a)&&a.value===e&&((r=a.context)==null?void 0:r.field)===s?.field&&((n=a.context)==null?void 0:n.entityName)===s?.entityName&&((o=a.context)==null?void 0:o.entityId)===s?.entityId?a:new ge({value:e,cause:a,context:s})}},ae=({prefix:t,size:e=16,alphabet:a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:s="-"}={})=>{const r=()=>{const n=a.length,o=new Array(e);for(let i=0;i<e;i++)o[i]=a[Math.random()*n|0];return o.join("")};if(t==null)return r;if(a.includes(s))throw new Ot({argument:"separator",message:`The separator "${s}" must not be part of the alphabet "${a}".`});return()=>`${t}${s}${r()}`},Dt=ae();function ke(t=globalThis){var e,a,s;return t.window?"runtime/browser":(e=t.navigator)!=null&&e.userAgent?`runtime/${t.navigator.userAgent.toLowerCase()}`:(s=(a=t.process)==null?void 0:a.versions)!=null&&s.node?`runtime/node.js/${t.process.version.substring(0)}`:t.EdgeRuntime?"runtime/vercel-edge":"runtime/unknown"}function q(t){if(t==null)return{};const e={};if(t instanceof Headers)t.forEach((a,s)=>{e[s.toLowerCase()]=a});else{Array.isArray(t)||(t=Object.entries(t));for(const[a,s]of t)s!=null&&(e[a.toLowerCase()]=s)}return e}function je(t,...e){const a=new Headers(q(t)),s=a.get("user-agent")||"";return a.set("user-agent",[s,...e].filter(Boolean).join(" ")),Object.fromEntries(a.entries())}var kt=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,jt=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function $e(t){const e=JSON.parse(t);return e===null||typeof e!="object"||kt.test(t)===!1&&jt.test(t)===!1?e:$t(e)}function $t(t){let e=[t];for(;e.length;){const a=e;e=[];for(const s of a){if(Object.prototype.hasOwnProperty.call(s,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(s,"constructor")&&s.constructor!==null&&typeof s.constructor=="object"&&Object.prototype.hasOwnProperty.call(s.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const r in s){const n=s[r];n&&typeof n=="object"&&e.push(n)}}}return t}function Zt(t){const{stackTraceLimit:e}=Error;try{Error.stackTraceLimit=0}catch{return $e(t)}try{return $e(t)}finally{Error.stackTraceLimit=e}}function Ie(t){if(t.type==="object"||Array.isArray(t.type)&&t.type.includes("object")){t.additionalProperties=!1;const{properties:a}=t;if(a!=null)for(const s of Object.keys(a))a[s]=J(a[s])}t.items!=null&&(t.items=Array.isArray(t.items)?t.items.map(J):J(t.items)),t.anyOf!=null&&(t.anyOf=t.anyOf.map(J)),t.allOf!=null&&(t.allOf=t.allOf.map(J)),t.oneOf!=null&&(t.oneOf=t.oneOf.map(J));const{definitions:e}=t;if(e!=null)for(const a of Object.keys(e))e[a]=J(e[a]);return t}function J(t){return typeof t=="boolean"?t:Ie(t)}var Ft=Symbol("Let zodToJsonSchema decide on which parser to use"),Ze={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},Lt=t=>typeof t=="string"?{...Ze,name:t}:{...Ze,...t};function k(){return{}}function Ut(t,e){var a,s,r;const n={type:"array"};return(a=t.type)!=null&&a._def&&((r=(s=t.type)==null?void 0:s._def)==null?void 0:r.typeName)!==g.ZodAny&&(n.items=_(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&(n.minItems=t.minLength.value),t.maxLength&&(n.maxItems=t.maxLength.value),t.exactLength&&(n.minItems=t.exactLength.value,n.maxItems=t.exactLength.value),n}function Bt(t){const e={type:"integer",format:"int64"};if(!t.checks)return e;for(const a of t.checks)switch(a.kind){case"min":a.inclusive?e.minimum=a.value:e.exclusiveMinimum=a.value;break;case"max":a.inclusive?e.maximum=a.value:e.exclusiveMaximum=a.value;break;case"multipleOf":e.multipleOf=a.value;break}return e}function Vt(){return{type:"boolean"}}function at(t,e){return _(t.type._def,e)}var Jt=(t,e)=>_(t.innerType._def,e);function st(t,e,a){const s=a??e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((r,n)=>st(t,e,r))};switch(s){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return qt(t)}}var qt=t=>{const e={type:"integer",format:"unix-time"};for(const a of t.checks)switch(a.kind){case"min":e.minimum=a.value;break;case"max":e.maximum=a.value;break}return e};function zt(t,e){return{..._(t.innerType._def,e),default:t.defaultValue()}}function Wt(t,e){return e.effectStrategy==="input"?_(t.schema._def,e):k()}function Yt(t){return{type:"string",enum:Array.from(t.values)}}var Ht=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function Gt(t,e){const a=[_(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),_(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(r=>!!r),s=[];return a.forEach(r=>{if(Ht(r))s.push(...r.allOf);else{let n=r;if("additionalProperties"in r&&r.additionalProperties===!1){const{additionalProperties:o,...i}=r;n=i}s.push(n)}}),s.length?{allOf:s}:void 0}function Qt(t){const e=typeof t.value;return e!=="bigint"&&e!=="number"&&e!=="boolean"&&e!=="string"?{type:Array.isArray(t.value)?"array":"object"}:{type:e==="bigint"?"integer":e,const:t.value}}var pe=void 0,$={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(pe===void 0&&(pe=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),pe),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function rt(t,e){const a={type:"string"};if(t.checks)for(const s of t.checks)switch(s.kind){case"min":a.minLength=typeof a.minLength=="number"?Math.max(a.minLength,s.value):s.value;break;case"max":a.maxLength=typeof a.maxLength=="number"?Math.min(a.maxLength,s.value):s.value;break;case"email":switch(e.emailStrategy){case"format:email":Z(a,"email",s.message,e);break;case"format:idn-email":Z(a,"idn-email",s.message,e);break;case"pattern:zod":C(a,$.email,s.message,e);break}break;case"url":Z(a,"uri",s.message,e);break;case"uuid":Z(a,"uuid",s.message,e);break;case"regex":C(a,s.regex,s.message,e);break;case"cuid":C(a,$.cuid,s.message,e);break;case"cuid2":C(a,$.cuid2,s.message,e);break;case"startsWith":C(a,RegExp(`^${fe(s.value,e)}`),s.message,e);break;case"endsWith":C(a,RegExp(`${fe(s.value,e)}$`),s.message,e);break;case"datetime":Z(a,"date-time",s.message,e);break;case"date":Z(a,"date",s.message,e);break;case"time":Z(a,"time",s.message,e);break;case"duration":Z(a,"duration",s.message,e);break;case"length":a.minLength=typeof a.minLength=="number"?Math.max(a.minLength,s.value):s.value,a.maxLength=typeof a.maxLength=="number"?Math.min(a.maxLength,s.value):s.value;break;case"includes":{C(a,RegExp(fe(s.value,e)),s.message,e);break}case"ip":{s.version!=="v6"&&Z(a,"ipv4",s.message,e),s.version!=="v4"&&Z(a,"ipv6",s.message,e);break}case"base64url":C(a,$.base64url,s.message,e);break;case"jwt":C(a,$.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&C(a,$.ipv4Cidr,s.message,e),s.version!=="v4"&&C(a,$.ipv6Cidr,s.message,e);break}case"emoji":C(a,$.emoji(),s.message,e);break;case"ulid":{C(a,$.ulid,s.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Z(a,"binary",s.message,e);break}case"contentEncoding:base64":{a.contentEncoding="base64";break}case"pattern:zod":{C(a,$.base64,s.message,e);break}}break}case"nanoid":C(a,$.nanoid,s.message,e)}return a}function fe(t,e){return e.patternStrategy==="escape"?Kt(t):t}var Xt=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Kt(t){let e="";for(let a=0;a<t.length;a++)Xt.has(t[a])||(e+="\\"),e+=t[a];return e}function Z(t,e,a,s){var r;t.format||(r=t.anyOf)!=null&&r.some(n=>n.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format}),delete t.format),t.anyOf.push({format:e,...a&&s.errorMessages&&{errorMessage:{format:a}}})):t.format=e}function C(t,e,a,s){var r;t.pattern||(r=t.allOf)!=null&&r.some(n=>n.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern}),delete t.pattern),t.allOf.push({pattern:Fe(e,s),...a&&s.errorMessages&&{errorMessage:{pattern:a}}})):t.pattern=Fe(e,s)}function Fe(t,e){var a;if(!e.applyRegexFlags||!t.flags)return t.source;const s={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},r=s.i?t.source.toLowerCase():t.source;let n="",o=!1,i=!1,u=!1;for(let l=0;l<r.length;l++){if(o){n+=r[l],o=!1;continue}if(s.i){if(i){if(r[l].match(/[a-z]/)){u?(n+=r[l],n+=`${r[l-2]}-${r[l]}`.toUpperCase(),u=!1):r[l+1]==="-"&&((a=r[l+2])!=null&&a.match(/[a-z]/))?(n+=r[l],u=!0):n+=`${r[l]}${r[l].toUpperCase()}`;continue}}else if(r[l].match(/[a-z]/)){n+=`[${r[l]}${r[l].toUpperCase()}]`;continue}}if(s.m){if(r[l]==="^"){n+=`(^|(?<=[\r
|
|
4
4
|
]))`;continue}else if(r[l]==="$"){n+=`($|(?=[\r
|