decocms 3.103.2 → 3.103.4
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-B7YwjVuv.js → AlertCircle-BJzQ1lVJ.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-DvElag-V.js → ArrowUpRight-CA22UP6Q.js} +1 -1
- package/dist/client/assets/{CheckCircle-DIxU9fNb.js → CheckCircle-p5tYLXMg.js} +1 -1
- package/dist/client/assets/{ChevronDown-D7t2IbgZ.js → ChevronDown-DM7Zg7z0.js} +1 -1
- package/dist/client/assets/{ChevronLeft-DnVztwcc.js → ChevronLeft-lcwdftXp.js} +1 -1
- package/dist/client/assets/{ChevronRight-Cw6r4eF5.js → ChevronRight-CKc4NZet.js} +1 -1
- package/dist/client/assets/{ChevronUp-DrHOs0IB.js → ChevronUp-uk87fvlM.js} +1 -1
- package/dist/client/assets/{DotsVertical-p5cw6bzY.js → DotsVertical-DXDm8Xzs.js} +1 -1
- package/dist/client/assets/{Eye-CPb9WDyf.js → Eye-BHPT57Tm.js} +1 -1
- package/dist/client/assets/{FilterLines-2uX2Gf4U.js → FilterLines-HsRbW4y-.js} +1 -1
- package/dist/client/assets/{Globe01-D51Pf1ib.js → Globe01-DD63JJzL.js} +1 -1
- package/dist/client/assets/{Globe04-8CmI5zRW.js → Globe04-CokcJjWp.js} +1 -1
- package/dist/client/assets/{HardDrive-fBNuw9RE.js → HardDrive-xu95HLc0.js} +1 -1
- package/dist/client/assets/{Key01-B-V8oh6M.js → Key01-V7SPr6j-.js} +1 -1
- package/dist/client/assets/{LayoutLeft-B7KWV4nT.js → LayoutLeft-y1fOcQ0I.js} +1 -1
- package/dist/client/assets/{LinkExternal01-Cd3gNz9H.js → LinkExternal01-DCed5R2c.js} +1 -1
- package/dist/client/assets/{Monitor01-BzxQo8OV.js → Monitor01-BKqFs8Gp.js} +1 -1
- package/dist/client/assets/{Palette-TV4PomkE.js → Palette-DkcZCW1n.js} +1 -1
- package/dist/client/assets/{Play-B9WHtGRe.js → Play-CKPBuURg.js} +1 -1
- package/dist/client/assets/{Plus-DrCr8atg.js → Plus-Bi8BbQwT.js} +1 -1
- package/dist/client/assets/{SearchLg-C45t9PQZ.js → SearchLg-D0nJXyNY.js} +1 -1
- package/dist/client/assets/{SearchMd-C5JuA4Q_.js → SearchMd-BkXN-Kzx.js} +1 -1
- package/dist/client/assets/{Settings02-CWsiKyfu.js → Settings02-C-qi4-Q_.js} +1 -1
- package/dist/client/assets/{Shield01-BP8Krja8.js → Shield01-BaBnwolv.js} +1 -1
- package/dist/client/assets/{Star01-BvLdWUOq.js → Star01-D2l7-L0I.js} +1 -1
- package/dist/client/assets/{Stars01-ledCttL2.js → Stars01-CBpnmt-0.js} +1 -1
- package/dist/client/assets/{Stars02-CZ3C1sQr.js → Stars02-DC4cG_dc.js} +1 -1
- package/dist/client/assets/{Sun-DPnjEA61.js → Sun-ubimVQVz.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-fTq_Xj_0.js → SwitchHorizontal01-DkcNGyLK.js} +1 -1
- package/dist/client/assets/{Tool01-MvyjXDCb.js → Tool01-D4LA61If.js} +1 -1
- package/dist/client/assets/{Trash01-C3HJx9Eu.js → Trash01-CbqEHpx0.js} +1 -1
- package/dist/client/assets/{Upload01-DvSZDpgm.js → Upload01-C_kFf8l0.js} +1 -1
- package/dist/client/assets/{User01-TldGh0YP.js → User01-Cykpl4hh.js} +1 -1
- package/dist/client/assets/{Users01-B63UEiqj.js → Users01-fhFCwrP8.js} +1 -1
- package/dist/client/assets/{Users03-BiIAwLFR.js → Users03-BkBCkWQn.js} +1 -1
- package/dist/client/assets/{X-D1lT84o6.js → X-DEdLuuqP.js} +1 -1
- package/dist/client/assets/{XCircle-B1aV7AX3.js → XCircle-IAOWYKKA.js} +1 -1
- package/dist/client/assets/{XClose-9xeu7JIP.js → XClose-ChjX78ei.js} +1 -1
- package/dist/client/assets/{Zap-C8z5Nmtq.js → Zap-DE8YfoLa.js} +1 -1
- package/dist/client/assets/{ZapSquare-C-BUl6mg.js → ZapSquare-hkjSQWO8.js} +1 -1
- package/dist/client/assets/{ZoomOut-DnuKetHD.js → ZoomOut-DoQt1wdd.js} +1 -1
- package/dist/client/assets/{access-gate-BY3tN2ja.js → access-gate-C9EgwKjC.js} +1 -1
- package/dist/client/assets/{add-section-modal-B07Xr2Kn.js → add-section-modal-uGR2Gjzo.js} +1 -1
- package/dist/client/assets/{agent-icon-SFzfjqT3.js → agent-icon-C1dYfmgT.js} +1 -1
- package/dist/client/assets/agents-list-BYujSwxP.js +1 -0
- package/dist/client/assets/{ai-providers-CKzZgnvl.js → ai-providers-BNI68B_k.js} +1 -1
- package/dist/client/assets/{alert-Xi4tmGdJ.js → alert-D_TmabeW.js} +1 -1
- package/dist/client/assets/{alert-dialog-Dv-S36Xs.js → alert-dialog-DZvgeli3.js} +1 -1
- package/dist/client/assets/{app-editor-DkeeVFb9.js → app-editor-CzvUrXdA.js} +1 -1
- package/dist/client/assets/{auth-B9AdzGWs.js → auth-CPEoqZ5f.js} +1 -1
- package/dist/client/assets/{auth-catchall-0TYVm2fW.js → auth-catchall-B0YsSe8e.js} +1 -1
- package/dist/client/assets/{auth-entry-DnJxnsQa.js → auth-entry-BNBDxAD5.js} +1 -1
- package/dist/client/assets/{auth-split-layout-CRM5rJ4I.js → auth-split-layout-TVpnUfp8.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-CWwDFJ5t.js → authenticate-and-persist-oauth-BgoQZkYE.js} +1 -1
- package/dist/client/assets/{automation-list-row-CsaQkLKW.js → automation-list-row-Bic_MYAx.js} +1 -1
- package/dist/client/assets/{automation-runs-B7uMDF25.js → automation-runs-B_ZKhNSO.js} +1 -1
- package/dist/client/assets/automations-B-nS9KAc.js +1 -0
- package/dist/client/assets/{avatar-CdYywjB8.js → avatar-VZM5i0Ki.js} +1 -1
- package/dist/client/assets/{badge-Dxlv54DZ.js → badge-BGbD2JMR.js} +1 -1
- package/dist/client/assets/{block-document-DmBsan0A.js → block-document-alsZITys.js} +1 -1
- package/dist/client/assets/{brand-context-BXcXRl5I.js → brand-context-DSNeUFQk.js} +1 -1
- package/dist/client/assets/{buckets-bgNzTmcE.js → buckets-htbDyfKS.js} +1 -1
- package/dist/client/assets/{capability-load-error-CFxZVJfo.js → capability-load-error-7-bUVJZE.js} +1 -1
- package/dist/client/assets/{card-Dt5JuJj0.js → card-DjLKG66H.js} +1 -1
- package/dist/client/assets/{category-editor-4VhAzI64.js → category-editor-DlDVDfZO.js} +1 -1
- package/dist/client/assets/{chat-context-rSGx0F1S.js → chat-context-DJ9kQ1Gu.js} +5 -5
- package/dist/client/assets/{checkbox-D5qKxHwE.js → checkbox-CHfAThPE.js} +1 -1
- package/dist/client/assets/{cli-auth-success-fK-z6B11.js → cli-auth-success-C0Rp_k77.js} +1 -1
- package/dist/client/assets/{collection-detail-CKsULKt8.js → collection-detail-WRW5wTM9.js} +1 -1
- package/dist/client/assets/{collection-display-button-D1GAS3K4.js → collection-display-button-V-CSOAM6.js} +1 -1
- package/dist/client/assets/{collection-search-Yx1Vcd74.js → collection-search-C4TcbQ-p.js} +1 -1
- package/dist/client/assets/{collection-tabs-DEvCjzY2.js → collection-tabs-CA6SI6KD.js} +1 -1
- package/dist/client/assets/{command--DrDkfnb.js → command-CZZOMfiA.js} +1 -1
- package/dist/client/assets/commerce-onboarding-B618DbMl.js +1 -0
- package/dist/client/assets/{connect-desktop-dialog-Ny2ddpDi.js → connect-desktop-dialog-C7OzpQot.js} +1 -1
- package/dist/client/assets/{connection-card-DGJrNSMY.js → connection-card-CFZ9gVcC.js} +1 -1
- package/dist/client/assets/{connection-detail-CrxMas_a.js → connection-detail-Dz4PneDx.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-Cco6Qbpt.js → connection-form-helpers-CF-WQyTc.js} +1 -1
- package/dist/client/assets/{connections-D2DZU5GB.js → connections-3TpGWQgy.js} +1 -1
- package/dist/client/assets/{context-menu-BLuGnyVu.js → context-menu-DyhUbPtL.js} +1 -1
- package/dist/client/assets/{decopilot-DMutZh6M.js → decopilot-DrrsAbRN.js} +1 -1
- package/dist/client/assets/{decopilot-sse-pool--1mtBHxz.js → decopilot-sse-pool-CyIsiJ1H.js} +1 -1
- package/dist/client/assets/{dialog-Dy6eXpKe.js → dialog-Dj81EdMo.js} +1 -1
- package/dist/client/assets/{domain-settings-C1eV-9a-.js → domain-settings-xhuDCJzA.js} +1 -1
- package/dist/client/assets/{drawer-Dvd-9Sja.js → drawer-tdj9aCh7.js} +1 -1
- package/dist/client/assets/{dropdown-menu-OVr8TMr_.js → dropdown-menu-UriF3iJ3.js} +1 -1
- package/dist/client/assets/{empty-state-DQfglbNM.js → empty-state-pCesbyUM.js} +1 -1
- package/dist/client/assets/{extract-connection-data-DrUVsxqd.js → extract-connection-data-DumI9Ge5.js} +1 -1
- package/dist/client/assets/{file-explorer-CkPnNmO8.js → file-explorer-BrAHdPYq.js} +1 -1
- package/dist/client/assets/{file-type-icon-SP0v8UlM.js → file-type-icon-Czo8zyOj.js} +1 -1
- package/dist/client/assets/{files-Wz-xIRKZ.js → files-2-ylEzlS.js} +1 -1
- package/dist/client/assets/{form-CkEHHrgu.js → form--KUjsjlO.js} +1 -1
- package/dist/client/assets/{general-DdP8ztNk.js → general-CESQV-oz.js} +1 -1
- package/dist/client/assets/{github-repo-picker-DSR-TwBo.js → github-repo-picker-B2FrynHJ.js} +1 -1
- package/dist/client/assets/{hooks-o8yCDzJC.js → hooks-dZjznYow.js} +1 -1
- package/dist/client/assets/{import-from-deco-dialog-CEW3ZJjT.js → import-from-deco-dialog-BR852fbZ.js} +1 -1
- package/dist/client/assets/{index-XoC6Mv98.js → index-0P9allDr.js} +1 -1
- package/dist/client/assets/{index-DuwRwNmr.js → index-BBWislhf.js} +1 -1
- package/dist/client/assets/{index-B6kdF_L8.js → index-BWNTd3xK.js} +1 -1
- package/dist/client/assets/{index-Dp_9MLtk.js → index-BcYiAjiX.js} +1 -1
- package/dist/client/assets/{index-j1EmgqV8.js → index-BlbGtC1U.js} +3 -3
- package/dist/client/assets/{index-_cWo9NQL.js → index-BxxTJpbB.js} +30 -30
- package/dist/client/assets/{index-DrmUu6Oi.js → index-CCANgKdB.js} +1 -1
- package/dist/client/assets/{index-D3y2G80O.js → index-CSUPQJzr.js} +1 -1
- package/dist/client/assets/{index-Z9ET5M46.js → index-CTgm7OBW.js} +1 -1
- package/dist/client/assets/{index-kU0DbGlO.js → index-CsOdgboE.js} +1 -1
- package/dist/client/assets/{index-DgC1qvp3.js → index-Dc1mL4BR.js} +1 -1
- package/dist/client/assets/{index-_iXFFHGt.js → index-S2ZDAOoZ.js} +1 -1
- package/dist/client/assets/{index-BFhrz-f4.js → index-bqGy9pqv.js} +1 -1
- package/dist/client/assets/{index-C0th2ciG.js → index-gxmWeiHj.js} +1 -1
- package/dist/client/assets/{index-redirect-Cq22Ou3t.js → index-redirect-DfTnv8HP.js} +1 -1
- package/dist/client/assets/{input-zUoMTUjz.js → input-DHDgjmX0.js} +1 -1
- package/dist/client/assets/{integration-icon-Cpv4CIQ_.js → integration-icon-m4V5ew5R.js} +1 -1
- package/dist/client/assets/{label-DIdfff7-.js → label-PsbKXPB5.js} +1 -1
- package/dist/client/assets/{login-0NOIPa_i.js → login-CjZD7E7q.js} +1 -1
- package/dist/client/assets/{mcp-oauth-iKgiXli9.js → mcp-oauth-D8vUJRgp.js} +1 -1
- package/dist/client/assets/{members-CnFYAz0Z.js → members-BPqR9Tpk.js} +1 -1
- package/dist/client/assets/{monaco-editor-DvDR9w-L.js → monaco-editor-C6TIlc3v.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-BbY_q-eo.js → monitoring-stats-row-CuYST9yW.js} +1 -1
- package/dist/client/assets/{oauth-callback-BPtayFiR.js → oauth-callback-MIwBkTTF.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-K5aCOvaH.js → oauth-callback-ai-provider-DE51OBIS.js} +1 -1
- package/dist/client/assets/{onboarding-ZiU6JGv-.js → onboarding-D2dd9Hw0.js} +1 -1
- package/dist/client/assets/{org-install-Cy54wLGw.js → org-install-TvXy2En0.js} +1 -1
- package/dist/client/assets/{org-layout-D-P2tcqC.js → org-layout-B7of36Ug.js} +1 -1
- package/dist/client/assets/{organization-choice-C1y80Okj.js → organization-choice-ClD6fu3y.js} +1 -1
- package/dist/client/assets/{page-seo-form-xc_ndIWR.js → page-seo-form-B43PbD8q.js} +1 -1
- package/dist/client/assets/page-seo-sheet-Bms3CN63.js +1 -0
- package/dist/client/assets/{popover-DU5qAOzi.js → popover-Do5OoBkb.js} +1 -1
- package/dist/client/assets/{post-editor-Bu1uK3RV.js → post-editor-DyiVSt54.js} +1 -1
- package/dist/client/assets/{preview-dialog-C9-3VKyJ.js → preview-dialog-DxRKsymK.js} +1 -1
- package/dist/client/assets/{primitives-CykDcCCX.js → primitives-DxWZCDhA.js} +1 -1
- package/dist/client/assets/{profile-BKoUm-g9.js → profile-BhdJgKGB.js} +1 -1
- package/dist/client/assets/project-app-view-CI4_btQ-.js +1 -0
- package/dist/client/assets/record-editor-BXTRvz07.js +1 -0
- package/dist/client/assets/registry-Du_E4iar.js +2 -0
- package/dist/client/assets/{registry-layout-B9FmRjJz.js → registry-layout-B9PDVzF6.js} +1 -1
- package/dist/client/assets/{require-capability-CehH7jAZ.js → require-capability-D2RrR3BZ.js} +1 -1
- package/dist/client/assets/{required-auth-layout-CU8fve_K.js → required-auth-layout-BdWFlHgh.js} +1 -1
- package/dist/client/assets/{reset-password-zdekZmVd.js → reset-password-ZLVvnqus.js} +1 -1
- package/dist/client/assets/{roles-D-x_wkGo.js → roles-3wYBxtCJ.js} +1 -1
- package/dist/client/assets/{scroll-area-BAz3Rj9i.js → scroll-area-B3-Gj80e.js} +1 -1
- package/dist/client/assets/{search-input-DRzQD01R.js → search-input-Cmd3sBC3.js} +1 -1
- package/dist/client/assets/{secrets-CuUGkNhM.js → secrets-DwdsYco7.js} +1 -1
- package/dist/client/assets/{sections-editor-DPVFX_7V.js → sections-editor-DC39EH-a.js} +1 -1
- package/dist/client/assets/{select-svPYG6Bw.js → select-DxONb3Kt.js} +1 -1
- package/dist/client/assets/{select-model-Dq-JstQ8.js → select-model-RfbC0RGe.js} +1 -1
- package/dist/client/assets/{seo-editor-BFJub-eW.js → seo-editor-kUNtMQs9.js} +1 -1
- package/dist/client/assets/{settings-layout-a74u_hLy.js → settings-layout-BqoYV9gy.js} +1 -1
- package/dist/client/assets/{settings-section-CNscyKHW.js → settings-section-BlH2FRiM.js} +1 -1
- package/dist/client/assets/{sheet-DahuGsa4.js → sheet-C2Kfge9r.js} +1 -1
- package/dist/client/assets/{shell-controls-K52T5sMB.js → shell-controls-CHbMUihJ.js} +1 -1
- package/dist/client/assets/{shell-layout-Buk6j896.js → shell-layout-BihuyTtm.js} +1 -1
- package/dist/client/assets/{shell-route-loading-B0z1lBof.js → shell-route-loading-De-l4N89.js} +1 -1
- package/dist/client/assets/{sidebar-D5j5gPeI.js → sidebar-BjIzPMot.js} +1 -1
- package/dist/client/assets/{skeleton-U2Av8cLZ.js → skeleton-BG0I4KDd.js} +1 -1
- package/dist/client/assets/sortable.esm-DUIS-SLz.js +5 -0
- package/dist/client/assets/{sso-BoRzwrWA.js → sso-DHlsuJgQ.js} +1 -1
- package/dist/client/assets/{store-vubGBkGy.js → store-CF-c7AjJ.js} +1 -1
- package/dist/client/assets/store-registry-C91x-W79.js +2 -0
- package/dist/client/assets/{studio-tools-BAmwKCdT.js → studio-tools-7mZABBZl.js} +1 -1
- package/dist/client/assets/{switch-CjEoRRuC.js → switch-Dprre6Tx.js} +1 -1
- package/dist/client/assets/{table-T8p77nDy.js → table-2dv8FC6q.js} +1 -1
- package/dist/client/assets/{tabs-DDAkKuLU.js → tabs-nJ0qk72w.js} +1 -1
- package/dist/client/assets/{task-status-Dc-JFjIj.js → task-status-CvjZ7N6W.js} +1 -1
- package/dist/client/assets/{textarea-BrxTK711.js → textarea-HTN5AIWJ.js} +1 -1
- package/dist/client/assets/{toggle-group-r5JjNYaj.js → toggle-group-D22tG_vD.js} +1 -1
- package/dist/client/assets/{toolbar-Cd-zT0GV.js → toolbar-DktIJIGj.js} +1 -1
- package/dist/client/assets/{tooltip-D2IcwsrW.js → tooltip-oPF11xOc.js} +1 -1
- package/dist/client/assets/{types-DdqgwoF-.js → types-DZM3oHCm.js} +1 -1
- package/dist/client/assets/{use-ai-providers-B7DE5RlO.js → use-ai-providers-CZx1BFdY.js} +1 -1
- package/dist/client/assets/{use-automations-BaLowkA-.js → use-automations-DttN1_QI.js} +1 -1
- package/dist/client/assets/{use-capability-BYfWBphf.js → use-capability-CREa5hxg.js} +1 -1
- package/dist/client/assets/{use-clock-tick-vJNeZS2R.js → use-clock-tick-D4shCSZy.js} +1 -1
- package/dist/client/assets/{use-collections-DOhjyZoW.js → use-collections-DZi4alPB.js} +1 -1
- package/dist/client/assets/{use-connection-a48WkDyi.js → use-connection-BaK7gZK8.js} +1 -1
- package/dist/client/assets/{use-copy-Dm0W_H8p.js → use-copy-BGXnmJ0Y.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-BRQVpCUG.js → use-create-virtual-mcp-BzfjXCKR.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-oRzID6xD.js → use-debounced-autosave-DCle0l35.js} +1 -1
- package/dist/client/assets/{use-debounced-value-B1GdK5fU.js → use-debounced-value-D0ar8P23.js} +1 -1
- package/dist/client/assets/{use-delete-connection-CKYm7fJS.js → use-delete-connection-IE5Qqa0Q.js} +1 -1
- package/dist/client/assets/{use-file-configs-F_Lh19IF.js → use-file-configs-CZMtO580.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-Cs1p0W0X.js → use-infinite-scroll-c7yDanFw.js} +1 -1
- package/dist/client/assets/{use-join-requests-Cx83Qjv9.js → use-join-requests-CiTPLtoo.js} +1 -1
- package/dist/client/assets/{use-mcp-client-B1E7Nyjd.js → use-mcp-client-BYcrk6lz.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-B4idSZTh.js → use-mcp-prompts-BjyIsgXC.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-CqHv2Xxs.js → use-mcp-tools-DYc-d8kf.js} +1 -1
- package/dist/client/assets/{use-members-BqgoI8LN.js → use-members-CDV7-ikh.js} +1 -1
- package/dist/client/assets/{use-mobile-CWv_pUWp.js → use-mobile-BKRfr7ic.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-CWpJGmq-.js → use-navigate-to-agent-D_fgYk51.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-C3mEUOcx.js → use-org-auth-client-C2F1ILpp.js} +1 -1
- package/dist/client/assets/{use-org-sso-Dop9y0HC.js → use-org-sso-DHz7VJ1a.js} +1 -1
- package/dist/client/assets/{use-organization-roles-BJ74MotE.js → use-organization-roles-9DZ9iYns.js} +1 -1
- package/dist/client/assets/{use-organization-settings-8LInvXec.js → use-organization-settings-ClKaDrE7.js} +1 -1
- package/dist/client/assets/{use-registry-connections-D2DhXJmA.js → use-registry-connections-Bgebk2mm.js} +1 -1
- package/dist/client/assets/{use-secrets-BLkb7BZG.js → use-secrets-DLWDaup6.js} +1 -1
- package/dist/client/assets/{use-status-sounds-MjzDR8jw.js → use-status-sounds-CBCN2gk-.js} +1 -1
- package/dist/client/assets/{use-view-mode-pvlDGqxN.js → use-view-mode-MNe61YUF.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-BcsK_V5p.js → use-virtual-mcp-Bkiriz_M.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-bB2OO4_F.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-CgFmFjuu.js +1 -0
- package/dist/client/assets/{useSuspenseQueries-C20MRsU9.js → useSuspenseQueries-DO4LObMF.js} +1 -1
- package/dist/client/assets/{variant-calendar-Dnj2EkPc.js → variant-calendar-B-NYPIkC.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-DQyCEqbJ.js → view-mode-toggle-DbKux4TQ.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +510 -451
- package/dist/server/migrate.js +156 -97
- package/package.json +1 -1
- package/dist/client/assets/agents-list-DjZyRbNh.js +0 -1
- package/dist/client/assets/automations-Dss23VYg.js +0 -1
- package/dist/client/assets/commerce-onboarding-C0r_RGc5.js +0 -1
- package/dist/client/assets/page-seo-sheet-CL3gCFpf.js +0 -1
- package/dist/client/assets/project-app-view-y5DH-I8K.js +0 -1
- package/dist/client/assets/record-editor-CvDeMQ2G.js +0 -1
- package/dist/client/assets/registry-BaFm0L19.js +0 -2
- package/dist/client/assets/sortable.esm-DHLm3dqa.js +0 -5
- package/dist/client/assets/store-registry-3H_xbQFv.js +0 -2
- package/dist/client/assets/useInfiniteQuery-QT7BExxx.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-CVusVKT2.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as z,r as K,l as oe,j as n,B as G,m as Ze,d as we,K as Z,o as $e,s as be,n as De,p as Fe,i as Xe,k as et,t as yt,q as ye,v as te,Q as bt,E as vt,a as Me,u as jt,w as Gt,b as Ct,x as Qt,y as St,L as Wt}from"./index-BlbGtC1U.js";import{A as Yt}from"./auth-entry-BNBDxAD5.js";import{A as Jt}from"./auth-split-layout-TVpnUfp8.js";import{O as ft}from"./organization-choice-ClD6fu3y.js";import{f as Zt}from"./tab-id-BptcWVWa.js";import{I as Te}from"./input-DHDgjmX0.js";import{u as qe,W as _t,S as Nt,g as Xt,C as en}from"./use-mcp-client-BYcrk6lz.js";import{i as Et}from"./XCircle-IAOWYKKA.js";import{I as tt}from"./integration-icon-m4V5ew5R.js";import{D as Ke,a as wt,b as It,c as Tt,d as Ot,e as At}from"./dialog-Dj81EdMo.js";import{T as kt,a as Rt,b as Ut}from"./tooltip-oPF11xOc.js";import{i as nt}from"./CheckCircle-p5tYLXMg.js";import{i as tn,t as Pt}from"./agent-icon-C1dYfmgT.js";import{g as nn,c as sn,e as on}from"./extract-connection-data-DumI9Ge5.js";import{F as ve,a as Ve,b as je,c as ze,d as Ce,e as Se,f as rn}from"./form--KUjsjlO.js";import{i as an}from"./ChevronUp-uk87fvlM.js";import{s as ln,a as zt}from"./Eye-BHPT57Tm.js";import{i as cn}from"./Settings02-C-qi4-Q_.js";import{u as dn}from"./useSuspenseQueries-DO4LObMF.js";import{a as mn}from"./authenticate-and-persist-oauth-BgoQZkYE.js";import{i as Lt}from"./ArrowUpRight-CA22UP6Q.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./avatar-VZM5i0Ki.js";import"./User01-Cykpl4hh.js";import"./auth-CPEoqZ5f.js";import"./X-DEdLuuqP.js";import"./AlertCircle-BJzQ1lVJ.js";import"./Tool01-D4LA61If.js";import"./SwitchHorizontal01-DkcNGyLK.js";import"./ZapSquare-hkjSQWO8.js";import"./Users03-BkBCkWQn.js";import"./ChevronDown-DM7Zg7z0.js";import"./ChevronLeft-lcwdftXp.js";import"./ChevronRight-CKc4NZet.js";import"./DotsVertical-DXDm8Xzs.js";import"./Stars02-DC4cG_dc.js";import"./ZoomOut-DoQt1wdd.js";import"./Globe01-DD63JJzL.js";import"./FilterLines-HsRbW4y-.js";import"./Star01-D2l7-L0I.js";import"./Globe04-CokcJjWp.js";import"./HardDrive-xu95HLc0.js";import"./Key01-V7SPr6j-.js";import"./LayoutLeft-y1fOcQ0I.js";import"./LinkExternal01-DCed5R2c.js";import"./Monitor01-BKqFs8Gp.js";import"./Sun-ubimVQVz.js";import"./Palette-DkcZCW1n.js";import"./Play-CKPBuURg.js";import"./Plus-Bi8BbQwT.js";import"./SearchLg-D0nJXyNY.js";import"./SearchMd-BkXN-Kzx.js";import"./Shield01-BaBnwolv.js";import"./Stars01-CBpnmt-0.js";import"./Trash01-CbqEHpx0.js";import"./Upload01-C_kFf8l0.js";import"./Users01-fhFCwrP8.js";import"./XClose-ChjX78ei.js";import"./Zap-DE8YfoLa.js";import"./label-PsbKXPB5.js";import"./mcp-oauth-D8vUJRgp.js";const un=/^[a-zA-Z][a-zA-Z\d+.-]*:/,fn=/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//,pn=/^[^\s/:?#]+\.[^\s/:?#]+:\d+(?:[/?#]|$)/,gn=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;function Ne(o){const e=o.trim();if(!e)return{ok:!1,error:"Enter a website URL."};const t=un.test(e),s=fn.test(e),i=pn.test(e);if(t&&!s&&!i)return{ok:!1,error:"Use an HTTP or HTTPS website URL."};const c=s?e:`https://${e}`;let r;try{r=new URL(c)}catch{return{ok:!1,error:"Enter a valid website URL."}}if(r.protocol!=="http:"&&r.protocol!=="https:")return{ok:!1,error:"Use an HTTP or HTTPS website URL."};const a=r.hostname.split(".");return a.length<2||a.some(l=>!l||!gn.test(l))?{ok:!1,error:"Enter a valid website URL."}:(r.protocol="https:",{ok:!0,value:r.origin})}function Ye(o){const e=z.c(14),{children:t,className:s,wrapperClassName:i}=o,[c,r]=K.useState(!0);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=j=>{if(!j)return;const v=()=>{const f=j.scrollHeight-j.scrollTop-j.clientHeight<8;r(f)};v(),j.addEventListener("scroll",v,{passive:!0});const g=new ResizeObserver(v);g.observe(j);for(const f of Array.from(j.children))g.observe(f);return()=>{j.removeEventListener("scroll",v),g.disconnect()}},e[0]=a):a=e[0];const l=a;let m;e[1]!==i?(m=oe("relative",i),e[1]=i,e[2]=m):m=e[2];let u;e[3]!==t||e[4]!==s?(u=n.jsx("div",{ref:l,className:s,children:t}),e[3]=t,e[4]=s,e[5]=u):u=e[5];const p=c?"opacity-0":"opacity-100";let d;e[6]!==p?(d=oe("pointer-events-none absolute inset-x-0 -bottom-px h-[72px]","bg-gradient-to-t from-sidebar from-[6px] to-transparent","backdrop-blur-[1px] [mask-image:linear-gradient(to_top,black_6px,transparent)]","transition-opacity duration-200",p),e[6]=p,e[7]=d):d=e[7];let x;e[8]!==d?(x=n.jsx("div",{"aria-hidden":!0,className:d}),e[8]=d,e[9]=x):x=e[9];let y;return e[10]!==m||e[11]!==u||e[12]!==x?(y=n.jsxs("div",{className:m,children:[u,x]}),e[10]=m,e[11]=u,e[12]=x,e[13]=y):y=e[13],y}function hn(o){const e=o.properties;if(!e)return[];const t=[];for(const[s,i]of Object.entries(e)){const a=i?.properties?.__type?.const;typeof a=="string"&&a.length>0&&t.push({fieldKey:s,bindingType:a})}return t}function xn(o,e){const t=[];if(o.length&&t.push({field:["id"],operator:"in",value:o}),e.length&&t.push({field:["name"],operator:"in",value:e}),t.length!==0)return t.length===1?t[0]:{operator:"or",conditions:t}}function se(o){const e=o;if(e.isError)throw new Error(e.content?.find(t=>t.text)?.text??"Tool call failed");return e.structuredContent??o}function yn(o,e,t,s){return{...o??{},[e]:{__type:t,value:s}}}function Je(o){return o==null?!1:typeof o=="string"?o.trim().length>0:typeof o=="number"||typeof o=="boolean"?!0:Array.isArray(o)?o.some(Je):typeof o=="object"?Object.entries(o).some(([e,t])=>!e.startsWith("__")&&Je(t)):!1}function bn(o){const e={accountName:"Nome da conta",appKey:"App Key",appToken:"App Token",propertyId:"Propriedade",siteUrl:"Site"};return e[o]?e[o]:o.replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/\b\w/g,t=>t.toUpperCase())}function vn(o){return Je(o)?typeof o=="string"?o.trim():typeof o=="number"||typeof o=="boolean"?String(o):JSON.stringify(o):null}function jn(o){return o?Object.entries(o).flatMap(([e,t])=>{if(e.startsWith("__"))return[];const s=vn(t);return s?[{key:e,label:bn(e),value:s}]:[]}):[]}function Cn({autoOpenFieldKey:o,card:e}){return o===e.fieldKey&&e.satisfied&&!!e.linkedConnectionId}function Sn(o,e,t){const s=o.filter(i=>i.app_name===e||!!t&&i.app_id===t);return s.length===0?null:(s.sort((i,c)=>{const r=a=>a.status==="active"?0:1;return r(i)!==r(c)?r(i)-r(c):(c.updated_at??"").localeCompare(i.updated_at??"")}),s[0].id)}function _n(o){return o.server?.icons?.[0]?.src??nn(o.server?.repository)??null}function Nn(o,e){const t=o._meta?.["mcp.mesh"];return t?.friendlyName||t?.friendly_name||o.title||o.server?.title||o.server?.name||e}function En(o){const e=[],t=new Map(o.connections.map(s=>[s.id,s]));for(const s of o.requirements){const i=o.curated[s.bindingType],c=i?o.itemsById[i.registryAppId]:o.itemsByName[s.bindingType];if(!c)continue;const r=o.configurationState?.[s.fieldKey]?.value,a=r?t.get(r):void 0,l=r&&a?r:null,m=l?o.connectionReadiness?.[l]!==!1:!1,u=!!l&&m,p=u?void 0:o.saBindings?.[s.bindingType],d=u||!!p,x=u?"oauth":p?"sa":null;e.push({fieldKey:s.fieldKey,bindingType:s.bindingType,registryItem:c,title:Nn(c,s.bindingType),icon:_n(c),headline:i?.headline??c._meta?.["mcp.mesh"]?.short_description??null,area:i?.area??null,bullets:i?.bullets??[],satisfied:d,candidateConnectionId:d?null:l||Sn(o.connections,s.bindingType,i?.registryAppId),linkedConnectionId:l,configurationState:a?.configuration_state??null,boundVia:x,boundResource:p?.resource??null})}return e}function wn(o,e){if(!o)return null;const t=i=>{if(i.startsWith("sc-domain:"))return i.substring(10);try{let r=new URL(i.startsWith("http")?i:`https://${i}`).hostname||"";return r.startsWith("www.")&&(r=r.substring(4)),r}catch{return i}},s=t(o);for(const i of e)if(t(i.siteUrl)===s)return i.siteUrl;return null}function In(o){return(o?.response?.accountSummaries??[]).map(s=>({account:s.account,options:(s.propertySummaries??[]).map(i=>({value:i.property,label:`${i.displayName} (${s.displayName})`}))}))}function pt(o){const e=z.c(38);let t,s,i,c,r;e[0]!==o?({value:r,onChange:s,placeholder:i,className:t,...c}=o,e[0]=o,e[1]=t,e[2]=s,e[3]=i,e[4]=c,e[5]=r):(t=e[1],s=e[2],i=e[3],c=e[4],r=e[5]);const[a,l]=K.useState(!1),[m,u]=K.useState(!1);let p;e[6]!==r?(p=async()=>{if(r)try{await navigator.clipboard.writeText(r),u(!0),setTimeout(()=>u(!1),2e3)}catch(U){console.error("Failed to copy text: ",U)}},e[6]=r,e[7]=p):p=e[7];const d=p;let x;e[8]!==a?(x=()=>{l(!a)},e[8]=a,e[9]=x):x=e[9];const y=x,j=a?"text":"password";let v;e[10]!==t?(v=oe("pr-20",t),e[10]=t,e[11]=v):v=e[11];let g;e[12]!==s||e[13]!==i||e[14]!==c||e[15]!==j||e[16]!==v||e[17]!==r?(g=n.jsx(Te,{type:j,value:r,onChange:s,placeholder:i,className:v,...c}),e[12]=s,e[13]=i,e[14]=c,e[15]=j,e[16]=v,e[17]=r,e[18]=g):g=e[18];const f=a?"Hide password":"Show password";let h;e[19]!==a?(h=a?n.jsx(cn,{size:16}):n.jsx(ln,{size:16}),e[19]=a,e[20]=h):h=e[20];let b;e[21]!==f||e[22]!==h||e[23]!==y?(b=n.jsx(G,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:y,title:f,children:h}),e[21]=f,e[22]=h,e[23]=y,e[24]=b):b=e[24];const C=!r,w=m?"Copied!":"Copy token";let E;e[25]!==m?(E=m?n.jsx(an,{size:16}):n.jsx(zt,{size:16}),e[25]=m,e[26]=E):E=e[26];let _;e[27]!==d||e[28]!==w||e[29]!==E||e[30]!==C?(_=n.jsx(G,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:d,disabled:C,title:w,children:E}),e[27]=d,e[28]=w,e[29]=E,e[30]=C,e[31]=_):_=e[31];let N;e[32]!==_||e[33]!==b?(N=n.jsxs("div",{className:"absolute right-1 top-1 flex items-center gap-1 h-8",children:[b,_]}),e[32]=_,e[33]=b,e[34]=N):N=e[34];let I;return e[35]!==N||e[36]!==g?(I=n.jsxs("div",{className:"relative",children:[g,N]}),e[35]=N,e[36]=g,e[37]=I):I=e[37],I}function st(o){const e=z.c(19),{card:t,selfClient:s,org:i,onDone:c,onError:r}=o,a=Ze();let l;e[0]!==t||e[1]!==s?(l=async v=>{const g={...t.configurationState??{},...v};await s.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:t.linkedConnectionId||t.candidateConnectionId,data:{configuration_state:g}}})},e[0]=t,e[1]=s,e[2]=l):l=e[2];let m;e[3]!==c||e[4]!==i||e[5]!==a?(m=async()=>{await a.invalidateQueries({queryKey:Z.commerceDiscoveryCompanionConnectionsPrefix(i.id)}),c()},e[3]=c,e[4]=i,e[5]=a,e[6]=m):m=e[6];let u;e[7]!==r?(u=v=>{r?.(v)},e[7]=r,e[8]=u):u=e[8];let p;e[9]!==l||e[10]!==m||e[11]!==u?(p={mutationFn:l,onSuccess:m,onError:u},e[9]=l,e[10]=m,e[11]=u,e[12]=p):p=e[12];const d=we(p);let x;e[13]!==d?(x=v=>d.mutate(v),e[13]=d,e[14]=x):x=e[14];const y=x;let j;return e[15]!==d.error||e[16]!==d.isPending||e[17]!==y?(j={save:y,isPending:d.isPending,error:d.error},e[15]=d.error,e[16]=d.isPending,e[17]=y,e[18]=j):j=e[18],j}const Tn=$e({accountName:be().min(1,"Informe o nome da conta"),appKey:be().optional(),appToken:be().optional()});function On(o){const e=z.c(63),{card:t,selfClient:s,org:i,onDone:c,onIsPendingChange:r}=o;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=De(Tn),e[0]=a):a=e[0];const l=t.configurationState?.accountName||"",m=t.configurationState?.appKey||"",u=t.configurationState?.appToken||"";let p;e[1]!==l||e[2]!==m||e[3]!==u?(p={resolver:a,defaultValues:{accountName:l,appKey:m,appToken:u}},e[1]=l,e[2]=m,e[3]=u,e[4]=p):p=e[4];const d=Fe(p);let x;e[5]!==t.configurationState?.accountName||e[6]!==t.configurationState?.appKey||e[7]!==t.configurationState?.appToken||e[8]!==d?(x=()=>{d.reset({accountName:t.configurationState?.accountName||"",appKey:t.configurationState?.appKey||"",appToken:t.configurationState?.appToken||""})},e[5]=t.configurationState?.accountName,e[6]=t.configurationState?.appKey,e[7]=t.configurationState?.appToken,e[8]=d,e[9]=x):x=e[9];let y;e[10]!==t.configurationState||e[11]!==d?(y=[t.configurationState,d],e[10]=t.configurationState,e[11]=d,e[12]=y):y=e[12],K.useEffect(x,y);let j;e[13]!==t||e[14]!==c||e[15]!==i||e[16]!==s?(j={card:t,selfClient:s,org:i,onDone:c},e[13]=t,e[14]=c,e[15]=i,e[16]=s,e[17]=j):j=e[17];const{save:v,isPending:g,error:f}=st(j);let h,b;e[18]!==g||e[19]!==r?(b=()=>{r?.(g)},h=[g,r],e[18]=g,e[19]=r,e[20]=h,e[21]=b):(h=e[20],b=e[21]),K.useEffect(b,h);let C;if(e[22]!==d||e[23]!==v){let q;e[25]!==v?(q=async S=>{v(S)},e[25]=v,e[26]=q):q=e[26],C=d.handleSubmit(q),e[22]=d,e[23]=v,e[24]=C}else C=e[24];const w=C;let E;e[27]!==g?(E=q=>{const{field:S}=q;return n.jsxs(je,{children:[n.jsx(ze,{children:"Nome da conta"}),n.jsx(Ce,{children:n.jsx(Te,{placeholder:"Nome da sua conta VTEX",...S,disabled:g})}),n.jsx(Se,{})]})},e[27]=g,e[28]=E):E=e[28];let _;e[29]!==d.control||e[30]!==E?(_=n.jsx(ve,{control:d.control,name:"accountName",render:E}),e[29]=d.control,e[30]=E,e[31]=_):_=e[31];let N;e[32]!==g?(N=q=>{const{field:S}=q;return n.jsxs(je,{children:[n.jsx(ze,{children:"App Key (opcional)"}),n.jsx(Ce,{children:n.jsx(pt,{placeholder:"App Key da VTEX",...S,disabled:g})}),n.jsx(Se,{})]})},e[32]=g,e[33]=N):N=e[33];let I;e[34]!==d.control||e[35]!==N?(I=n.jsx(ve,{control:d.control,name:"appKey",render:N}),e[34]=d.control,e[35]=N,e[36]=I):I=e[36];let U;e[37]!==g?(U=q=>{const{field:S}=q;return n.jsxs(je,{children:[n.jsx(ze,{children:"App Token (opcional)"}),n.jsx(Ce,{children:n.jsx(pt,{placeholder:"App Token da VTEX",...S,disabled:g})}),n.jsx(Se,{})]})},e[37]=g,e[38]=U):U=e[38];let T;e[39]!==d.control||e[40]!==U?(T=n.jsx(ve,{control:d.control,name:"appToken",render:U}),e[39]=d.control,e[40]=U,e[41]=T):T=e[41];let O;e[42]!==d||e[43]!==_||e[44]!==I||e[45]!==T?(O=n.jsxs(Ve,{...d,children:[_,I,T]}),e[42]=d,e[43]=_,e[44]=I,e[45]=T,e[46]=O):O=e[46];let k;e[47]!==f?(k=f&&n.jsx("p",{role:"alert",className:"text-sm text-destructive",children:f instanceof Error?f.message:"Não foi possível salvar a configuração"}),e[47]=f,e[48]=k):k=e[48];let R;e[49]!==g||e[50]!==c?(R=n.jsx(G,{type:"button",variant:"outline",onClick:c,disabled:g,children:"Cancelar"}),e[49]=g,e[50]=c,e[51]=R):R=e[51];const $=g?"Salvando...":"Salvar";let M;e[52]!==g||e[53]!==$?(M=n.jsx(G,{type:"submit",disabled:g,children:$}),e[52]=g,e[53]=$,e[54]=M):M=e[54];let L;e[55]!==R||e[56]!==M?(L=n.jsxs(Ke,{className:"pt-4",children:[R,M]}),e[55]=R,e[56]=M,e[57]=L):L=e[57];let F;return e[58]!==w||e[59]!==O||e[60]!==k||e[61]!==L?(F=n.jsxs("form",{onSubmit:w,className:"space-y-4",children:[O,k,L]}),e[58]=w,e[59]=O,e[60]=k,e[61]=L,e[62]=F):F=e[62],F}function $t(o){const e=z.c(30),{options:t,value:s,onChange:i,disabled:c,ariaLabel:r,searchPlaceholder:a}=o,l=a===void 0?"Buscar...":a,[m,u]=K.useState("");let p,d,x;if(e[0]!==t||e[1]!==m||e[2]!==s){const _=m.trim().toLowerCase();p=_?t.filter(N=>N.label.toLowerCase().includes(_)):t,d=p.map(An),x=d.includes(s)?s:d[0]??"",e[0]=t,e[1]=m,e[2]=s,e[3]=p,e[4]=d,e[5]=x}else p=e[3],d=e[4],x=e[5];const y=x;let j;e[6]!==c||e[7]!==d||e[8]!==i?(j=function(N){if(c||!["ArrowDown","ArrowRight","ArrowUp","ArrowLeft","Home","End"].includes(N.key))return;N.preventDefault();const U=N.currentTarget.dataset.value,T=d.indexOf(U),O=d.length;if(O===0)return;let k;N.key==="ArrowDown"||N.key==="ArrowRight"?k=(T+1)%O:N.key==="ArrowUp"||N.key==="ArrowLeft"?k=(T-1+O)%O:N.key==="Home"?k=0:k=O-1;const R=d[k];i(R),N.currentTarget.closest('[role="radiogroup"]')?.querySelector(`[data-value="${CSS.escape(R)}"]`)?.focus()},e[6]=c,e[7]=d,e[8]=i,e[9]=j):j=e[9];const v=j;let g;e[10]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(tn,{size:16,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),e[10]=g):g=e[10];let f;e[11]===Symbol.for("react.memo_cache_sentinel")?(f=_=>u(_.target.value),e[11]=f):f=e[11];const h=`Buscar ${r}`;let b;e[12]!==c||e[13]!==m||e[14]!==l||e[15]!==h?(b=n.jsxs("div",{className:"relative",children:[g,n.jsx(Te,{type:"text",value:m,onChange:f,disabled:c,placeholder:l,"aria-label":h,className:"h-8 pl-8"})]}),e[12]=c,e[13]=m,e[14]=l,e[15]=h,e[16]=b):b=e[16];let C;e[17]!==c||e[18]!==p||e[19]!==v||e[20]!==i||e[21]!==y||e[22]!==s?(C=p.length===0?n.jsx("div",{className:"px-2 py-2 text-sm text-muted-foreground",children:"Nenhum resultado"}):p.map(_=>{const N=_.value===s;return n.jsxs("button",{type:"button",role:"radio","aria-checked":N,disabled:c,"data-value":_.value,tabIndex:_.value===y?0:-1,onClick:()=>i(_.value),onKeyDown:v,className:oe("flex w-full items-center justify-between gap-2 rounded-sm px-2 py-2 text-left text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:pointer-events-none disabled:opacity-50",N?"bg-muted font-medium text-foreground":"text-foreground hover:bg-muted/50"),children:[n.jsx("span",{className:"truncate",children:_.label}),N?n.jsx(nt,{size:16,className:"shrink-0 text-primary"}):null]},_.value)}),e[17]=c,e[18]=p,e[19]=v,e[20]=i,e[21]=y,e[22]=s,e[23]=C):C=e[23];let w;e[24]!==r||e[25]!==C?(w=n.jsx("div",{role:"radiogroup","aria-label":r,className:"max-h-[280px] overflow-y-auto",children:C}),e[24]=r,e[25]=C,e[26]=w):w=e[26];let E;return e[27]!==b||e[28]!==w?(E=n.jsxs("div",{className:"space-y-2",children:[b,w]}),e[27]=b,e[28]=w,e[29]=E):E=e[29],E}function An(o){return o.value}function ot(o){const e=z.c(16),{label:t,iconSize:s,className:i,iconClassName:c,labelClassName:r}=o,a=s===void 0?14:s;let l;e[0]!==i?(l=oe("inline-flex items-center gap-2",i),e[0]=i,e[1]=l):l=e[1];let m;e[2]!==c?(m=oe("shrink-0 animate-spin",c),e[2]=c,e[3]=m):m=e[3];let u;e[4]!==a||e[5]!==m?(u=n.jsx(Xe,{size:a,className:m}),e[4]=a,e[5]=m,e[6]=u):u=e[6];let p;e[7]!==r?(p=oe("text-sm",r),e[7]=r,e[8]=p):p=e[8];let d;e[9]!==t||e[10]!==p?(d=n.jsx("span",{className:p,children:t}),e[9]=t,e[10]=p,e[11]=d):d=e[11];let x;return e[12]!==l||e[13]!==u||e[14]!==d?(x=n.jsxs("span",{className:l,children:[u,d]}),e[12]=l,e[13]=u,e[14]=d,e[15]=x):x=e[15],x}const kn=$e({propertyId:be().min(1,"Selecione uma propriedade")});function Rn(o){const e=z.c(55),{card:t,connectionId:s,companionClient:i,selfClient:c,org:r,onDone:a,onIsPendingChange:l}=o;let m;e[0]!==s||e[1]!==r.id?(m=Z.commerceDiscoveryCompanionGaProperties(r.id,s),e[0]=s,e[1]=r.id,e[2]=m):m=e[2];let u;e[3]!==i?(u=async()=>{const S=await i.callTool({name:"get-account-summaries",arguments:{}}),D=se(S);return In(D)},e[3]=i,e[4]=u):u=e[4];let p;e[5]!==m||e[6]!==u?(p={queryKey:m,queryFn:u},e[5]=m,e[6]=u,e[7]=p):p=e[7];const d=et(p);let x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x=De(kn),e[8]=x):x=e[8];const y=t.configurationState?.propertyId||"";let j;e[9]!==y?(j={resolver:x,defaultValues:{propertyId:y}},e[9]=y,e[10]=j):j=e[10];const v=Fe(j);let g;e[11]!==t||e[12]!==a||e[13]!==r||e[14]!==c?(g={card:t,selfClient:c,org:r,onDone:a},e[11]=t,e[12]=a,e[13]=r,e[14]=c,e[15]=g):g=e[15];const{save:f,isPending:h,error:b}=st(g);let C,w;e[16]!==h||e[17]!==l?(C=()=>{l?.(h)},w=[h,l],e[16]=h,e[17]=l,e[18]=C,e[19]=w):(C=e[18],w=e[19]),K.useEffect(C,w);let E;if(e[20]!==v||e[21]!==f){let S;e[23]!==f?(S=async D=>{f(D)},e[23]=f,e[24]=S):S=e[24],E=v.handleSubmit(S),e[20]=v,e[21]=f,e[22]=E}else E=e[22];const _=E;if(d.isLoading){let S;return e[25]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:n.jsx(ot,{label:"Carregando propriedades..."})}),e[25]=S):S=e[25],S}if(d.isError){let S;return e[26]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx("div",{className:"space-y-4",children:n.jsx("p",{className:"text-sm text-destructive",children:"Não foi possível carregar as propriedades do Google Analytics."})}),e[26]=S):S=e[26],S}let N;e[27]!==d.data?(N=d.data||[],e[27]=d.data,e[28]=N):N=e[28];const I=N;if(I.flatMap(Pn).length===0){let S;return e[29]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx("div",{className:"space-y-4",children:n.jsx("p",{className:"text-sm text-muted-foreground",children:"Nenhuma propriedade do Google Analytics foi encontrada. Conecte uma conta do Google Analytics com propriedades."})}),e[29]=S):S=e[29],S}let T;e[30]!==h||e[31]!==I?(T=S=>{const{field:D}=S;return n.jsxs(je,{children:[n.jsx(Ce,{children:n.jsx($t,{options:I.flatMap(Un),value:D.value,onChange:D.onChange,disabled:h,ariaLabel:"Propriedade do Google Analytics"})}),n.jsx(Se,{})]})},e[30]=h,e[31]=I,e[32]=T):T=e[32];let O;e[33]!==v.control||e[34]!==T?(O=n.jsx(ve,{control:v.control,name:"propertyId",render:T}),e[33]=v.control,e[34]=T,e[35]=O):O=e[35];let k;e[36]!==v||e[37]!==O?(k=n.jsx(Ve,{...v,children:O}),e[36]=v,e[37]=O,e[38]=k):k=e[38];let R;e[39]!==b?(R=b&&n.jsx("p",{role:"alert",className:"text-sm text-destructive",children:b instanceof Error?b.message:"Não foi possível salvar a configuração"}),e[39]=b,e[40]=R):R=e[40];let $;e[41]!==h||e[42]!==a?($=n.jsx(G,{type:"button",variant:"outline",onClick:a,disabled:h,children:"Cancelar"}),e[41]=h,e[42]=a,e[43]=$):$=e[43];const M=h?"Salvando...":"Salvar";let L;e[44]!==h||e[45]!==M?(L=n.jsx(G,{type:"submit",disabled:h,children:M}),e[44]=h,e[45]=M,e[46]=L):L=e[46];let F;e[47]!==$||e[48]!==L?(F=n.jsxs(Ke,{className:"pt-4",children:[$,L]}),e[47]=$,e[48]=L,e[49]=F):F=e[49];let q;return e[50]!==_||e[51]!==k||e[52]!==R||e[53]!==F?(q=n.jsxs("form",{onSubmit:_,className:"space-y-4",children:[k,R,F]}),e[50]=_,e[51]=k,e[52]=R,e[53]=F,e[54]=q):q=e[54],q}function Un(o){return o.options}function Pn(o){return o.options}const zn=$e({siteUrl:be().min(1,"Selecione um site")});function Ln(o){const e=z.c(59),{card:t,connectionId:s,companionClient:i,selfClient:c,org:r,contextSiteUrl:a,onDone:l,onIsPendingChange:m}=o;let u;e[0]!==s||e[1]!==r.id?(u=Z.commerceDiscoveryCompanionGscSites(r.id,s),e[0]=s,e[1]=r.id,e[2]=u):u=e[2];let p;e[3]!==i?(p=async()=>{const S=await i.callTool({name:"list_sites",arguments:{}});return se(S).sites||[]},e[3]=i,e[4]=p):p=e[4];let d;e[5]!==u||e[6]!==p?(d={queryKey:u,queryFn:p},e[5]=u,e[6]=p,e[7]=d):d=e[7];const x=et(d);let y;e[8]===Symbol.for("react.memo_cache_sentinel")?(y=De(zn),e[8]=y):y=e[8];const j=t.configurationState?.siteUrl||"";let v;e[9]!==j?(v={resolver:y,defaultValues:{siteUrl:j}},e[9]=j,e[10]=v):v=e[10];const g=Fe(v);let f;e[11]!==t||e[12]!==l||e[13]!==r||e[14]!==c?(f={card:t,selfClient:c,org:r,onDone:l},e[11]=t,e[12]=l,e[13]=r,e[14]=c,e[15]=f):f=e[15];const{save:h,isPending:b,error:C}=st(f);let w,E;e[16]!==b||e[17]!==m?(w=()=>{m?.(b)},E=[b,m],e[16]=b,e[17]=m,e[18]=w,e[19]=E):(w=e[18],E=e[19]),K.useEffect(w,E);let _;if(e[20]!==g||e[21]!==h){let S;e[23]!==h?(S=async D=>{h(D)},e[23]=h,e[24]=S):S=e[24],_=g.handleSubmit(S),e[20]=g,e[21]=h,e[22]=_}else _=e[22];const N=_;if(x.isLoading){let S;return e[25]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:n.jsx(ot,{label:"Carregando sites..."})}),e[25]=S):S=e[25],S}if(x.isError){let S;return e[26]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx("div",{className:"space-y-4",children:n.jsx("p",{className:"text-sm text-destructive",children:"Não foi possível carregar os sites do Google Search Console."})}),e[26]=S):S=e[26],S}let I,U;if(e[27]!==t.configurationState?.siteUrl||e[28]!==a||e[29]!==g||e[30]!==x.data){U=Symbol.for("react.early_return_sentinel");e:{if(I=x.data||[],I.length===0){let D;e[33]===Symbol.for("react.memo_cache_sentinel")?(D=n.jsx("div",{className:"space-y-4",children:n.jsx("p",{className:"text-sm text-muted-foreground",children:"Nenhum site verificado foi encontrado. Verifique um site no Google Search Console."})}),e[33]=D):D=e[33],U=D;break e}const S=t.configurationState?.siteUrl;if(S&&g.getValues("siteUrl")!==S)g.setValue("siteUrl",S);else if(!S&&!g.getValues("siteUrl")){const D=wn(a,I);D&&g.setValue("siteUrl",D)}}e[27]=t.configurationState?.siteUrl,e[28]=a,e[29]=g,e[30]=x.data,e[31]=I,e[32]=U}else I=e[31],U=e[32];if(U!==Symbol.for("react.early_return_sentinel"))return U;let T;e[34]!==b||e[35]!==I?(T=S=>{const{field:D}=S;return n.jsxs(je,{children:[n.jsx(Ce,{children:n.jsx($t,{options:I.map($n),value:D.value,onChange:D.onChange,disabled:b,ariaLabel:"Site verificado"})}),n.jsx(Se,{})]})},e[34]=b,e[35]=I,e[36]=T):T=e[36];let O;e[37]!==g.control||e[38]!==T?(O=n.jsx(ve,{control:g.control,name:"siteUrl",render:T}),e[37]=g.control,e[38]=T,e[39]=O):O=e[39];let k;e[40]!==g||e[41]!==O?(k=n.jsx(Ve,{...g,children:O}),e[40]=g,e[41]=O,e[42]=k):k=e[42];let R;e[43]!==C?(R=C&&n.jsx("p",{role:"alert",className:"text-sm text-destructive",children:C instanceof Error?C.message:"Não foi possível salvar a configuração"}),e[43]=C,e[44]=R):R=e[44];let $;e[45]!==b||e[46]!==l?($=n.jsx(G,{type:"button",variant:"outline",onClick:l,disabled:b,children:"Cancelar"}),e[45]=b,e[46]=l,e[47]=$):$=e[47];const M=b?"Salvando...":"Salvar";let L;e[48]!==b||e[49]!==M?(L=n.jsx(G,{type:"submit",disabled:b,children:M}),e[48]=b,e[49]=M,e[50]=L):L=e[50];let F;e[51]!==$||e[52]!==L?(F=n.jsxs(Ke,{className:"pt-4",children:[$,L]}),e[51]=$,e[52]=L,e[53]=F):F=e[53];let q;return e[54]!==N||e[55]!==k||e[56]!==R||e[57]!==F?(q=n.jsxs("form",{onSubmit:N,className:"space-y-4",children:[k,R,F]}),e[54]=N,e[55]=k,e[56]=R,e[57]=F,e[58]=q):q=e[58],q}function $n(o){return{value:o.siteUrl,label:o.siteUrl}}const Dn={vtex:On,"google-analytics":Rn,"google-search-console":Ln},_e="deco-reader@decocms.iam.gserviceaccount.com",Dt={"google-analytics":"ga4","google-search-console":"gsc"},Ft={ga4:{label:"Google Analytics",resourceLabel:"ID da propriedade",resourcePlaceholder:"ex: 123456789",resourceHint:"No GA4: Admin → Detalhes da propriedade → ID da propriedade (só números).",connectSteps:["Abra o Google Analytics (GA4) da sua loja.","Vá em Admin → Acesso à propriedade (Gerenciamento de acesso).",`Clique em + → Adicionar usuários, cole ${_e} e conceda o papel Leitor.`,"Copie o ID da propriedade (Admin → Detalhes da propriedade) e cole abaixo."]},gsc:{label:"Google Search Console",resourceLabel:"Site / propriedade",resourcePlaceholder:"ex: sc-domain:sualoja.com.br",resourceHint:"Use o mesmo formato que aparece no Search Console: sc-domain:sualoja.com.br ou https://www.sualoja.com.br/.",connectSteps:["Abra o Google Search Console da sua loja.","Vá em Configurações → Usuários e permissões.",`Clique em Adicionar usuário, cole ${_e} e escolha permissão Completa.`,"Copie o endereço do site como aparece no seletor de propriedades e cole abaixo."]}};function Fn(o,e){const t=Ft[o].label;switch(e){case"no-access":return{title:`Ainda não conseguimos acessar este recurso no ${t}.`,steps:o==="ga4"?[`Confirme que ${_e} foi adicionado em Admin → Acesso à propriedade com o papel Leitor.`,"Confira se o ID da propriedade está correto (só números, sem o prefixo 'properties/').","A concessão de acesso pode levar alguns segundos — tente novamente."]:[`Confirme que ${_e} foi adicionado em Configurações → Usuários e permissões.`,"A permissão precisa ser Completa ou Restrita — 'Não verificado' não funciona.","Confira se o endereço do site está exatamente como aparece no Search Console."]};case"no-web-stream":return{title:"Esta propriedade do GA4 não tem um fluxo de dados da Web (site) configurado.",steps:["No GA4, vá em Admin → Fluxos de dados.","Clique em Adicionar fluxo → Web.","Informe a URL do site da sua loja e salve o fluxo.","Volte aqui e tente vincular de novo. (Propriedades só de app precisam de vínculo manual — fale com o suporte.)"]};case"no-match":return{title:"O recurso informado não corresponde ao domínio desta loja.",steps:o==="ga4"?["Verifique se digitou o ID da propriedade certa — provavelmente é de outro site.","No GA4, o site medido aparece em Admin → Fluxos de dados → (seu fluxo Web) → URL do stream."]:["Verifique se selecionou a propriedade do Search Console referente a esta loja.","O endereço precisa cobrir o mesmo domínio do diagnóstico."]};case"resource_already_bound":return{title:"Este recurso já está vinculado a outra loja.",steps:["Se este recurso é realmente desta loja, fale com o suporte para uma revisão manual.","Caso tenha digitado o id errado, confira e tente novamente."]};default:return{title:"Não foi possível verificar o acesso a este recurso.",steps:["Revise os passos de acesso acima e tente novamente.","Se persistir, fale com o suporte."]}}}function Mn(o){const e=z.c(76),{provider:t,siteUrl:s,selfClient:i,org:c,initialResourceId:r,onDone:a,onIsPendingChange:l,onOAuthInstead:m}=o,u=Ft[t],p=Ze(),[d,x]=K.useState(null);let y,j;if(e[0]!==u.resourceLabel){const A=$e({resourceId:be().trim().min(1,`Informe o ${u.resourceLabel.toLowerCase()}`)});j=Fe,y=De(A),e[0]=u.resourceLabel,e[1]=y,e[2]=j}else y=e[1],j=e[2];const v=r??"";let g;e[3]!==v?(g={resourceId:v},e[3]=v,e[4]=g):g=e[4];let f;e[5]!==y||e[6]!==g?(f={resolver:y,defaultValues:g},e[5]=y,e[6]=g,e[7]=f):f=e[7];const h=j(f);let b;e[8]!==t||e[9]!==i||e[10]!==s?(b=async A=>{if(!s)throw new Error("URL da loja indisponível — recarregue a página.");const V=await i.callTool({name:"COMMERCE_DISCOVERY_BIND",arguments:{siteUrl:s,provider:t,resourceId:A.resourceId}});return se(V)},e[8]=t,e[9]=i,e[10]=s,e[11]=b):b=e[11];let C,w;e[12]!==l?(C=()=>l?.(!0),w=()=>l?.(!1),e[12]=l,e[13]=C,e[14]=w):(C=e[13],w=e[14]);let E;e[15]!==u.label||e[16]!==a||e[17]!==c||e[18]!==t||e[19]!==p||e[20]!==s?(E=async A=>{if(A.ok){x(null),yt.success(`${u.label} conectado`),s&&await p.invalidateQueries({queryKey:Z.commerceDiscoveryConnectionStatus(c.id,s)}),a();return}x({...Fn(t,A.reason??"unknown"),detail:A.detail})},e[15]=u.label,e[16]=a,e[17]=c,e[18]=t,e[19]=p,e[20]=s,e[21]=E):E=e[21];let _;e[22]!==b||e[23]!==C||e[24]!==w||e[25]!==E?(_={mutationFn:b,onMutate:C,onSettled:w,onSuccess:E},e[22]=b,e[23]=C,e[24]=w,e[25]=E,e[26]=_):_=e[26];const N=we(_);let I;if(e[27]!==h||e[28]!==N){let A;e[30]!==N?(A=V=>N.mutate(V),e[30]=N,e[31]=A):A=e[31],I=h.handleSubmit(A),e[27]=h,e[28]=N,e[29]=I}else I=e[29];const U=I,T=N.isPending,O=Vn;let k;e[32]!==u.connectSteps?(k=u.connectSteps.map(Kn),e[32]=u.connectSteps,e[33]=k):k=e[33];let R;e[34]!==k?(R=n.jsx("ol",{className:"space-y-2 text-sm text-muted-foreground",children:k}),e[34]=k,e[35]=R):R=e[35];let $;e[36]===Symbol.for("react.memo_cache_sentinel")?($=n.jsx("code",{className:"min-w-0 flex-1 truncate text-xs text-foreground",children:_e}),e[36]=$):$=e[36];let M;e[37]===Symbol.for("react.memo_cache_sentinel")?(M=n.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border bg-muted/40 p-2",children:[$,n.jsx(G,{type:"button",variant:"ghost",size:"icon-sm",onClick:O,"aria-label":"Copiar e-mail do service account",children:n.jsx(zt,{size:16})})]}),e[37]=M):M=e[37];let L;e[38]!==u.resourceHint||e[39]!==u.resourceLabel||e[40]!==u.resourcePlaceholder||e[41]!==T?(L=A=>{const{field:V}=A;return n.jsxs(je,{children:[n.jsx(ze,{children:u.resourceLabel}),n.jsx(Ce,{children:n.jsx(Te,{...V,placeholder:u.resourcePlaceholder,disabled:T,autoComplete:"off"})}),n.jsx(rn,{children:u.resourceHint}),n.jsx(Se,{})]})},e[38]=u.resourceHint,e[39]=u.resourceLabel,e[40]=u.resourcePlaceholder,e[41]=T,e[42]=L):L=e[42];let F;e[43]!==h.control||e[44]!==L?(F=n.jsx(ve,{control:h.control,name:"resourceId",render:L}),e[43]=h.control,e[44]=L,e[45]=F):F=e[45];let q;e[46]!==h||e[47]!==F?(q=n.jsx(Ve,{...h,children:F}),e[46]=h,e[47]=F,e[48]=q):q=e[48];let S;e[49]!==d?(S=d&&n.jsxs("div",{role:"alert",className:"space-y-2 rounded-lg border border-destructive/40 bg-destructive/5 p-3",children:[n.jsx("p",{className:"text-sm font-medium text-foreground",children:d.title}),n.jsx("ol",{className:"space-y-1 text-sm text-muted-foreground",children:d.steps.map(qn)})]}),e[49]=d,e[50]=S):S=e[50];let D;e[51]!==N.error||e[52]!==N.isError?(D=N.isError&&n.jsx("p",{role:"alert",className:"text-sm text-destructive",children:N.error instanceof Error?N.error.message:"Não foi possível vincular."}),e[51]=N.error,e[52]=N.isError,e[53]=D):D=e[53];let W;e[54]!==T||e[55]!==m?(W=m?n.jsx("button",{type:"button",onClick:m,disabled:T,className:"text-xs text-muted-foreground underline underline-offset-2 hover:text-foreground disabled:opacity-50",children:"autorizar via login do Google"}):n.jsx("span",{}),e[54]=T,e[55]=m,e[56]=W):W=e[56];let Q;e[57]!==T||e[58]!==a?(Q=n.jsx(G,{type:"button",variant:"outline",onClick:a,disabled:T,children:"Cancelar"}),e[57]=T,e[58]=a,e[59]=Q):Q=e[59];const H=T?"Verificando...":"Vincular";let X;e[60]!==T||e[61]!==H?(X=n.jsx(G,{type:"submit",disabled:T,children:H}),e[60]=T,e[61]=H,e[62]=X):X=e[62];let Y;e[63]!==Q||e[64]!==X?(Y=n.jsxs("div",{className:"flex gap-2",children:[Q,X]}),e[63]=Q,e[64]=X,e[65]=Y):Y=e[65];let J;e[66]!==W||e[67]!==Y?(J=n.jsxs(Ke,{className:"flex-col gap-2 pt-2 sm:flex-row sm:items-center sm:justify-between",children:[W,Y]}),e[66]=W,e[67]=Y,e[68]=J):J=e[68];let ee;return e[69]!==U||e[70]!==R||e[71]!==q||e[72]!==S||e[73]!==D||e[74]!==J?(ee=n.jsxs("form",{onSubmit:U,className:"space-y-4",children:[R,M,q,S,D,J]}),e[69]=U,e[70]=R,e[71]=q,e[72]=S,e[73]=D,e[74]=J,e[75]=ee):ee=e[75],ee}function qn(o){return n.jsxs("li",{className:"flex gap-2",children:[n.jsx("span",{"aria-hidden":!0,children:"•"}),n.jsx("span",{children:o})]},o)}function Kn(o,e){return n.jsxs("li",{className:"flex gap-2",children:[n.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center rounded-full bg-muted text-xs font-medium text-foreground",children:e+1}),n.jsx("span",{children:o})]},o)}function Vn(){navigator.clipboard?.writeText(_e),yt.success("E-mail copiado")}function Hn(){const o=z.c(2);let e;o[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"size-9 shrink-0 animate-pulse rounded-lg bg-muted/60"}),o[0]=e):e=o[0];let t;return o[1]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsxs("div",{className:"flex items-center gap-3 rounded-2xl border border-border bg-card p-4 sm:h-full sm:flex-col sm:items-stretch",children:[e,n.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[n.jsx("div",{className:"h-4 w-24 animate-pulse rounded bg-muted/60"}),n.jsx("div",{className:"h-3 w-full animate-pulse rounded bg-muted/60"})]}),n.jsx("div",{className:"h-8 w-20 shrink-0 animate-pulse rounded-lg bg-muted/60 sm:mt-auto sm:w-full"})]}),o[1]=t):t=o[1],t}const gt="rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground";function Bn(o){const e=z.c(37),{card:t,connecting:s,disabled:i,onConnect:c,org:r,selfClient:a,siteUrl:l,autoOpenConfigFieldKey:m,onAutoOpenConfigHandled:u}=o,p=t.linkedConnectionId,d=Dt[t.bindingType],x=!!d&&t.boundVia!=="oauth";let y;e[0]!==m||e[1]!==t||e[2]!==s||e[3]!==i||e[4]!==p||e[5]!==u||e[6]!==c||e[7]!==r||e[8]!==d||e[9]!==a||e[10]!==l||e[11]!==x?(y=x&&d?n.jsx(Gn,{card:t,provider:d,org:r,selfClient:a,siteUrl:l,onOAuthInstead:c,disabled:i,connecting:s}):t.satisfied&&p?n.jsxs("div",{className:"flex items-center justify-end gap-1 sm:justify-start",children:[n.jsxs("span",{className:"flex items-center gap-1.5 text-sm text-muted-foreground",children:[n.jsx(nt,{size:16,className:"text-success"})," Conectado"]}),n.jsx(K.Suspense,{fallback:n.jsx(Qn,{}),children:n.jsx(Wn,{card:t,org:r,selfClient:a,connectionId:p,contextSiteUrl:l,autoOpen:Cn({autoOpenFieldKey:m,card:t}),onAutoOpenHandled:u})})]}):n.jsx(G,{type:"button",variant:"outline",size:"sm",className:"sm:w-full",disabled:i||s,onClick:c,"aria-label":`Conectar ${t.title}`,children:s?n.jsx(Xe,{size:16,className:"animate-spin"}):"Conectar"}),e[0]=m,e[1]=t,e[2]=s,e[3]=i,e[4]=p,e[5]=u,e[6]=c,e[7]=r,e[8]=d,e[9]=a,e[10]=l,e[11]=x,e[12]=y):y=e[12];const j=y;let v;e[13]!==t.icon||e[14]!==t.title?(v=n.jsx(tt,{icon:t.icon,name:t.title,size:"sm",fit:"contain",className:"shrink-0 p-1.5"}),e[13]=t.icon,e[14]=t.title,e[15]=v):v=e[15];let g;e[16]!==t.area?(g=t.area&&n.jsx("span",{className:oe("hidden sm:inline-block",gt),children:t.area}),e[16]=t.area,e[17]=g):g=e[17];let f;e[18]!==v||e[19]!==g?(f=n.jsxs("div",{className:"shrink-0 self-start sm:flex sm:w-full sm:items-center sm:justify-between sm:gap-2",children:[v,g]}),e[18]=v,e[19]=g,e[20]=f):f=e[20];let h;e[21]!==t.area?(h=t.area&&n.jsx("span",{className:oe("mb-1 inline-block sm:hidden",gt),children:t.area}),e[21]=t.area,e[22]=h):h=e[22];let b;e[23]!==t.title?(b=n.jsx("p",{className:"text-sm font-medium text-foreground",children:t.title}),e[23]=t.title,e[24]=b):b=e[24];let C;e[25]!==t.headline?(C=t.headline&&n.jsx("p",{className:"mt-0.5 line-clamp-2 text-sm leading-5 text-muted-foreground",children:t.headline}),e[25]=t.headline,e[26]=C):C=e[26];let w;e[27]!==h||e[28]!==b||e[29]!==C?(w=n.jsxs("div",{className:"min-w-0 flex-1",children:[h,b,C]}),e[27]=h,e[28]=b,e[29]=C,e[30]=w):w=e[30];let E;e[31]!==j?(E=n.jsx("div",{className:"shrink-0 sm:mt-auto sm:w-full sm:pt-1",children:j}),e[31]=j,e[32]=E):E=e[32];let _;return e[33]!==f||e[34]!==w||e[35]!==E?(_=n.jsxs("div",{className:"flex items-center gap-3 rounded-2xl border border-border bg-card p-4 sm:h-full sm:flex-col sm:items-stretch",children:[f,w,E]}),e[33]=f,e[34]=w,e[35]=E,e[36]=_):_=e[36],_}function Gn(o){const e=z.c(39),{card:t,provider:s,org:i,selfClient:c,siteUrl:r,onOAuthInstead:a,disabled:l,connecting:m}=o,[u,p]=K.useState(!1),[d,x]=K.useState(!1);let y;e[0]!==d?(y=O=>{!O&&d||p(O)},e[0]=d,e[1]=y):y=e[1];const j=y;let v;e[2]!==t.satisfied||e[3]!==t.title||e[4]!==m||e[5]!==l?(v=t.satisfied?n.jsxs("div",{className:"flex items-center justify-end gap-1 sm:justify-start",children:[n.jsxs("span",{className:"flex items-center gap-1.5 text-sm text-muted-foreground",children:[n.jsx(nt,{size:16,className:"text-success"})," Conectado"]}),n.jsxs(kt,{children:[n.jsx(Rt,{asChild:!0,children:n.jsx(G,{type:"button",variant:"ghost",size:"icon-sm",className:"shrink-0",onClick:()=>p(!0),"aria-label":`Configurar ${t.title}`,children:n.jsx(Pt,{size:16})})}),n.jsx(Ut,{children:"Editar configuração"})]})]}):n.jsx(G,{type:"button",variant:"outline",size:"sm",className:"sm:w-full",disabled:l||m,onClick:()=>p(!0),"aria-label":`Conectar ${t.title}`,children:m?n.jsx(Xe,{size:16,className:"animate-spin"}):"Conectar"}),e[2]=t.satisfied,e[3]=t.title,e[4]=m,e[5]=l,e[6]=v):v=e[6];let g;e[7]!==t.icon||e[8]!==t.title?(g=n.jsx(tt,{icon:t.icon,name:t.title,size:"md",fit:"contain",className:"p-1.5"}),e[7]=t.icon,e[8]=t.title,e[9]=g):g=e[9];let f;e[10]!==t.title?(f=n.jsx(wt,{children:t.title}),e[10]=t.title,e[11]=f):f=e[11];let h;e[12]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(It,{children:"Conceda acesso ao nosso leitor e informe o identificador"}),e[12]=h):h=e[12];let b;e[13]!==f?(b=n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[f,h]}),e[13]=f,e[14]=b):b=e[14];let C;e[15]!==g||e[16]!==b?(C=n.jsxs(Tt,{className:"flex-row items-center gap-3 space-y-0 text-left",children:[g,b]}),e[15]=g,e[16]=b,e[17]=C):C=e[17];const w=t.boundResource??void 0;let E;e[18]===Symbol.for("react.memo_cache_sentinel")?(E=()=>p(!1),e[18]=E):E=e[18];let _;e[19]!==t.satisfied||e[20]!==a?(_=t.satisfied?void 0:()=>{p(!1),a()},e[19]=t.satisfied,e[20]=a,e[21]=_):_=e[21];let N;e[22]!==i||e[23]!==s||e[24]!==c||e[25]!==r||e[26]!==_||e[27]!==w?(N=n.jsx(Mn,{provider:s,siteUrl:r,selfClient:c,org:i,initialResourceId:w,onDone:E,onIsPendingChange:x,onOAuthInstead:_}),e[22]=i,e[23]=s,e[24]=c,e[25]=r,e[26]=_,e[27]=w,e[28]=N):N=e[28];let I;e[29]!==N||e[30]!==C?(I=n.jsxs(Ot,{className:"sm:max-w-lg",children:[C,N]}),e[29]=N,e[30]=C,e[31]=I):I=e[31];let U;e[32]!==j||e[33]!==u||e[34]!==I?(U=n.jsx(At,{open:u,onOpenChange:j,children:I}),e[32]=j,e[33]=u,e[34]=I,e[35]=U):U=e[35];let T;return e[36]!==U||e[37]!==v?(T=n.jsxs(n.Fragment,{children:[v,U]}),e[36]=U,e[37]=v,e[38]=T):T=e[38],T}function Qn(){const o=z.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"size-8 shrink-0 animate-pulse rounded-lg bg-muted/60"}),o[0]=e):e=o[0],e}function Wn(o){const e=z.c(46),{card:t,org:s,selfClient:i,connectionId:c,contextSiteUrl:r,autoOpen:a,onAutoOpenHandled:l}=o;let m;e[0]!==c||e[1]!==s.id||e[2]!==s.slug?(m={connectionId:c,orgId:s.id,orgSlug:s.slug},e[0]=c,e[1]=s.id,e[2]=s.slug,e[3]=m):m=e[3];const u=qe(m),[p,d]=K.useState(a),[x,y]=K.useState(!1),j=Dn[t.bindingType],v=jn(t.configurationState);let g;e[4]!==a||e[5]!==l?(g=()=>{d(!1),a&&l()},e[4]=a,e[5]=l,e[6]=g):g=e[6];const f=g;let h;e[7]!==f||e[8]!==x?(h=F=>{if(!(!F&&x)){if(!F){f();return}d(!0)}},e[7]=f,e[8]=x,e[9]=h):h=e[9];const b=h;if(!j)return null;let C;e[10]===Symbol.for("react.memo_cache_sentinel")?(C=()=>d(!0),e[10]=C):C=e[10];const w=`Configurar ${t.title}`;let E;e[11]===Symbol.for("react.memo_cache_sentinel")?(E=n.jsx(Pt,{size:16}),e[11]=E):E=e[11];let _;e[12]!==w?(_=n.jsx(Rt,{asChild:!0,children:n.jsx(G,{type:"button",variant:"ghost",size:"icon-sm",className:"shrink-0",onClick:C,"aria-label":w,children:E})}),e[12]=w,e[13]=_):_=e[13];const N=v.length>0?"Editar configuração":"Configurar";let I;e[14]!==N?(I=n.jsx(Ut,{children:N}),e[14]=N,e[15]=I):I=e[15];let U;e[16]!==_||e[17]!==I?(U=n.jsxs(kt,{children:[_,I]}),e[16]=_,e[17]=I,e[18]=U):U=e[18];let T;e[19]!==t.icon||e[20]!==t.title?(T=n.jsx(tt,{icon:t.icon,name:t.title,size:"md",fit:"contain",className:"p-1.5"}),e[19]=t.icon,e[20]=t.title,e[21]=T):T=e[21];let O;e[22]!==t.title?(O=n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[n.jsx(wt,{children:t.title}),n.jsxs(It,{children:["Configure o ",t.title," para enriquecer os dados"]})]}),e[22]=t.title,e[23]=O):O=e[23];let k;e[24]!==T||e[25]!==O?(k=n.jsxs(Tt,{className:"flex-row items-center gap-3 space-y-0 text-left",children:[T,O]}),e[24]=T,e[25]=O,e[26]=k):k=e[26];let R;e[27]!==j||e[28]!==t||e[29]!==f||e[30]!==u||e[31]!==c||e[32]!==r||e[33]!==s||e[34]!==i?(R=n.jsx(j,{card:t,connectionId:c,companionClient:u,selfClient:i,org:s,contextSiteUrl:r,onDone:f,onIsPendingChange:y}),e[27]=j,e[28]=t,e[29]=f,e[30]=u,e[31]=c,e[32]=r,e[33]=s,e[34]=i,e[35]=R):R=e[35];let $;e[36]!==k||e[37]!==R?($=n.jsxs(Ot,{className:"sm:max-w-lg",children:[k,R]}),e[36]=k,e[37]=R,e[38]=$):$=e[38];let M;e[39]!==p||e[40]!==b||e[41]!==$?(M=n.jsx(At,{open:p,onOpenChange:b,children:$}),e[39]=p,e[40]=b,e[41]=$,e[42]=M):M=e[42];let L;return e[43]!==U||e[44]!==M?(L=n.jsxs(n.Fragment,{children:[U,M]}),e[43]=U,e[44]=M,e[45]=L):L=e[45],L}const it={vtex:{registryAppId:"deco/vtex",area:"Catálogo",headline:"Rupturas e PDPs que travam suas vendas."},"google-analytics":{registryAppId:"deco/google-analytics",area:"Funil",headline:"Onde a receita vaza no seu funil."},"google-search-console":{registryAppId:"deco/google-search-console",area:"Busca",headline:"O tráfego de busca que você deixa na mesa."}};function Yn(o){const e=z.c(40),{selfClient:t,org:s,cdConnectionId:i,siteUrl:c}=o;let r;e[0]!==i||e[1]!==s.id||e[2]!==s.slug?(r={connectionId:i,orgId:s.id,orgSlug:s.slug},e[0]=i,e[1]=s.id,e[2]=s.slug,e[3]=r):r=e[3];const a=qe(r);let l;e[4]!==i||e[5]!==s.id?(l=Z.commerceDiscoveryCompanionSchema(s.id,i),e[4]=i,e[5]=s.id,e[6]=l):l=e[6];let m;e[7]!==a?(m=async()=>{const A=await a.callTool({name:"MCP_CONFIGURATION",arguments:{}});return se(A)},e[7]=a,e[8]=m):m=e[8];let u;e[9]!==l||e[10]!==m?(u={queryKey:l,queryFn:m},e[9]=l,e[10]=m,e[11]=u):u=e[11];const p=ye(u),d=hn(p.data?.stateSchema??{properties:{}}),x=d.map(rs),y=d.map(is).filter(os),j=d.filter(ss).map(ns),v=[...y,...j].sort().join(",");let g;e[12]!==i||e[13]!==s.id?(g=Z.commerceDiscoveryConnection(s.id,i),e[12]=i,e[13]=s.id,e[14]=g):g=e[14];let f;e[15]!==i||e[16]!==t?(f=async()=>{const A=await t.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:i}});return se(A)},e[15]=i,e[16]=t,e[17]=f):f=e[17];let h;e[18]!==g||e[19]!==f?(h={queryKey:g,queryFn:f},e[18]=g,e[19]=f,e[20]=h):h=e[20];const C=ye(h).data?.item?.configuration_state??null;let w;e[21]!==C?(w=A=>C?.[A.fieldKey]?.value,e[21]=C,e[22]=w):w=e[22];const E=d.map(w).filter(ts),_=[...x.map(es),...y.map(Xn),...E.map(Zn)].sort().join(","),I=ye({queryKey:Z.commerceDiscoveryCompanionConnections(s.id,_),queryFn:async()=>{if(d.length===0)return{items:[]};const A=[{field:["app_name"],operator:"in",value:x},{field:["app_id"],operator:"in",value:y}];E.length>0&&A.push({field:["id"],operator:"in",value:E});const V=await t.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{operator:"or",conditions:A},limit:1e3}});return se(V)}}).data?.items??[],U=new Set(E),T=I.filter(A=>U.has(A.id)),O=T.filter(Jn);let k;e[23]!==s.id||e[24]!==s.slug?(k=A=>({queryKey:Z.commerceDiscoveryCompanionOAuthStatus(s.id,A.id),queryFn:async()=>{try{const V=await fetch(`/api/${encodeURIComponent(s.slug)}/connections/${encodeURIComponent(A.id)}/oauth-token/status`,{credentials:"include"});return V.ok?{hasToken:(await V.json()).hasToken===!0}:{hasToken:!1}}catch{return{hasToken:!1}}},retry:!1}),e[23]=s.id,e[24]=s.slug,e[25]=k):k=e[25];const R=dn({queries:O.map(k)});let $;e[26]!==R?($=(A,V)=>[A.id,R[V]?.data?.hasToken===!0],e[26]=R,e[27]=$):$=e[27];const M=new Map(O.map($)),L={};for(const A of T)L[A.id]=!A.oauth_config||!!A.connection_token||M.get(A.id)===!0;const F=ye({queryKey:Z.commerceDiscoveryCompanionRegistry(s.id,v),queryFn:async()=>{if(d.length===0)return{items:[]};const A=xn(y,j),V=await sn(_t.REGISTRY(s.id),s.id,s.slug,"COLLECTION_REGISTRY_APP_LIST",{...A?{where:A}:{},limit:1e3});return se(V)}}),q={},S={};for(const A of F.data?.items??[])q[A.id]=A,A.server?.name&&(S[A.server.name]=A);let D;e[28]!==s.id||e[29]!==c?(D=Z.commerceDiscoveryConnectionStatus(s.id,c??""),e[28]=s.id,e[29]=c,e[30]=D):D=e[30];const W=!!c;let Q;e[31]!==t||e[32]!==c?(Q=async()=>{const A=await t.callTool({name:"COMMERCE_DISCOVERY_CONNECTION_STATUS",arguments:{siteUrl:c}});return se(A)},e[31]=t,e[32]=c,e[33]=Q):Q=e[33];let H;e[34]!==D||e[35]!==W||e[36]!==Q?(H={queryKey:D,enabled:W,queryFn:Q},e[34]=D,e[35]=W,e[36]=Q,e[37]=H):H=e[37];const X=et(H),Y={};for(const[A,V]of Object.entries(Dt)){const ie=X.data?.providers?.[V];ie?.connected&&ie.via==="sa"&&(Y[A]={resource:ie.resource??null})}const J=En({requirements:d,itemsById:q,itemsByName:S,connections:I,connectionReadiness:L,configurationState:C,curated:it,saBindings:Y});let ee;return e[38]!==J?(ee={cards:J},e[38]=J,e[39]=ee):ee=e[39],ee}function Jn(o){return o.oauth_config&&!o.connection_token}function Zn(o){return`linked:${o}`}function Xn(o){return`app:${o}`}function es(o){return`binding:${o}`}function ts(o){return typeof o=="string"&&o.length>0}function ns(o){return o.bindingType}function ss(o){return!it[o.bindingType]}function os(o){return!!o}function is(o){return it[o.bindingType]?.registryAppId}function rs(o){return o.bindingType}function as({selfClient:o,org:e,userId:t,cdConnectionId:s}){const i=Ze(),[c,r]=K.useState(null),[a,l]=K.useState(null),m=async(p,d)=>{const x=await o.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:p,data:d}});return se(x)};async function u(p){r(p.fieldKey),l(null);const d={app_name:p.title,field_key:p.fieldKey,organization_id:e.id};te("commerce_onboarding_companion_connect_clicked",d);try{let x=p.candidateConnectionId;if(!x){const h=on(p.registryItem,e.id,t,{remoteIndex:0}),b=h.connection_type==="STDIO",C=!!h.connection_url,w=b&&h.connection_headers&&typeof h.connection_headers=="object"&&"command"in h.connection_headers;if(!C&&!w)return te("commerce_onboarding_companion_connect_failed",{...d,error:"no_connection_method"}),l(`${p.title} cannot be connected: no connection method available`),!1;const E=await o.callTool({name:"COLLECTION_CONNECTIONS_CREATE",arguments:{data:h}});x=se(E).item.id}const y=x,j=await mn({connectionId:y,orgId:e.id,orgSlug:e.slug,persistFallback:h=>m(y,{connection_token:h}).then(()=>{})});if(!j.ok)return te("commerce_onboarding_companion_connect_failed",{...d,error:j.error}),l(`Couldn't sign in to ${p.title}: ${j.error}`),!1;const v=await o.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:s}}),g=se(v).item?.configuration_state??null,f=yn(g,p.fieldKey,p.bindingType,y);return await m(s,{configuration_state:f}),await i.invalidateQueries({queryKey:Z.commerceDiscoveryConnection(e.id,s)}),await i.invalidateQueries({queryKey:Z.commerceDiscoveryCompanionConnectionsPrefix(e.id)}),te("commerce_onboarding_companion_connected",d),!0}catch(x){return te("commerce_onboarding_companion_connect_failed",{...d,error:x instanceof Error?x.message:String(x)}),l(x instanceof Error?x.message:String(x)),!1}finally{r(null)}}return{connect:u,connectingFieldKey:c,error:a}}const rt="flex min-h-0 flex-1 flex-col gap-6 md:grid md:flex-none md:gap-4";function at(){const o=z.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("h1",{className:"text-2xl font-medium leading-8 text-foreground",children:"Conecte suas ferramentas para ver o diagnóstico completo"}),o[0]=e):e=o[0],e}function ls(){const o=z.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[0,1,2,3].map(cs)}),o[0]=e):e=o[0],e}function cs(o){return n.jsx(Hn,{},o)}function lt(){const o=z.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsxs("div",{className:rt,children:[n.jsx(at,{}),n.jsx(ls,{})]}),o[0]=e):e=o[0],e}function ds(o){const e=z.c(5),{onRetry:t}=o;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(at,{}),e[0]=s):s=e[0];let i,c;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx("p",{className:"text-sm text-foreground",children:"Não foi possível carregar as integrações complementares."}),c=n.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Algo deu errado ao carregar suas integrações."}),e[1]=i,e[2]=c):(i=e[1],c=e[2]);let r;return e[3]!==t?(r=n.jsxs("div",{className:rt,children:[s,n.jsxs("div",{role:"alert",className:"rounded-2xl border border-border bg-card p-4",children:[i,c,n.jsx(G,{type:"button",variant:"outline",size:"sm",className:"mt-3",onClick:t,children:"Tentar novamente"})]})]}),e[3]=t,e[4]=r):r=e[4],r}function ms(o){const e=z.c(2);let t;return e[0]!==o?(t=n.jsx(bt,{children:s=>{const{reset:i}=s;return n.jsx(vt,{fallback:c=>{const{resetError:r}=c;return n.jsx(ds,{onRetry:()=>{i(),r()}})},children:n.jsx(K.Suspense,{fallback:n.jsx(lt,{}),children:n.jsx(us,{...o})})})}}),e[0]=o,e[1]=t):t=e[1],t}function us(o){const e=z.c(38),{org:t,cdConnectionId:s,siteUrl:i}=o,{data:c}=Me.useSession(),r=c?.user?.id??"";let a;e[0]!==t.id||e[1]!==t.slug?(a={connectionId:Nt,orgId:t.id,orgSlug:t.slug},e[0]=t.id,e[1]=t.slug,e[2]=a):a=e[2];const l=qe(a);let m;e[3]!==s||e[4]!==t||e[5]!==l||e[6]!==i?(m={selfClient:l,org:t,cdConnectionId:s,siteUrl:i},e[3]=s,e[4]=t,e[5]=l,e[6]=i,e[7]=m):m=e[7];const{cards:u}=Yn(m);let p;e[8]!==s||e[9]!==t||e[10]!==l||e[11]!==r?(p={selfClient:l,org:t,userId:r,cdConnectionId:s},e[8]=s,e[9]=t,e[10]=l,e[11]=r,e[12]=p):p=e[12];const{connect:d,connectingFieldKey:x,error:y}=as(p),[j,v]=K.useState(null);if(u.length===0)return null;const g=x!==null;let f;e[13]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(at,{}),e[13]=f):f=e[13];let h;e[14]!==y?(h=y&&n.jsx("p",{role:"alert",className:"mb-3 text-sm text-destructive",children:y}),e[14]=y,e[15]=h):h=e[15];let b;if(e[16]!==j||e[17]!==g||e[18]!==u||e[19]!==d||e[20]!==x||e[21]!==t||e[22]!==l||e[23]!==i){let E;e[25]!==j||e[26]!==g||e[27]!==d||e[28]!==x||e[29]!==t||e[30]!==l||e[31]!==i?(E=_=>{const N=async()=>{await d(_)&&v(_.fieldKey)};return n.jsx(Bn,{card:_,connecting:x===_.fieldKey,disabled:g&&x!==_.fieldKey,org:t,selfClient:l,siteUrl:i,autoOpenConfigFieldKey:j,onAutoOpenConfigHandled:()=>v(I=>I===_.fieldKey?null:I),onConnect:()=>{N()}},_.fieldKey)},e[25]=j,e[26]=g,e[27]=d,e[28]=x,e[29]=t,e[30]=l,e[31]=i,e[32]=E):E=e[32],b=u.map(E),e[16]=j,e[17]=g,e[18]=u,e[19]=d,e[20]=x,e[21]=t,e[22]=l,e[23]=i,e[24]=b}else b=e[24];let C;e[33]!==b?(C=n.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:b}),e[33]=b,e[34]=C):C=e[34];let w;return e[35]!==h||e[36]!==C?(w=n.jsxs("div",{className:rt,children:[f,n.jsxs(Ye,{wrapperClassName:"flex min-h-0 flex-1 flex-col md:block",className:"-mx-1 min-h-0 flex-1 overflow-y-auto px-1 md:max-h-[min(60vh,calc(100dvh-330px))] md:flex-none",children:[h,C]})]}),e[35]=h,e[36]=C,e[37]=w):w=e[37],w}const ct="https://decocms.com/agendar",fs="Precisa de ajuda? Fale conosco",ps="Agende uma chamada de 20 minutos e rodamos o diagnóstico com você, ao vivo.",Mt={photo:"https://decoims.com/image?src=decocms%2Fb07a1c19-0cd6-49c8-b326-86055ee78605%2Fauthor-1763423987973-baby.jpeg&quality=original&fit=cover&width=200&height=200"},qt="var(--brand-green-dark)";function dt({siteUrl:o,email:e}){const t=new URL(ct);return o&&t.searchParams.set("siteUrl",o),e&&t.searchParams.set("email",e),t.toString()}function gs(o){const e=z.c(12),{href:t,size:s,className:i,orgId:c}=o,r=t===void 0?ct:t,a=s===void 0?"lg":s;let l;e[0]!==i?(l=oe("w-full",i),e[0]=i,e[1]=l):l=e[1];let m;e[2]!==c?(m=()=>te("commerce_onboarding_meeting_cta_clicked",{placement:"visual_card",organization_id:c}),e[2]=c,e[3]=m):m=e[3];let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(Lt,{size:16}),e[4]=u):u=e[4];let p;e[5]!==r||e[6]!==m?(p=n.jsxs("a",{href:r,target:"_blank",rel:"noreferrer",onClick:m,children:["Agendar uma reunião",u]}),e[5]=r,e[6]=m,e[7]=p):p=e[7];let d;return e[8]!==a||e[9]!==l||e[10]!==p?(d=n.jsx(G,{asChild:!0,variant:"outline",size:a,className:l,children:p}),e[8]=a,e[9]=l,e[10]=p,e[11]=d):d=e[11],d}function hs(o){const e=z.c(6),{size:t}=o,s=t===void 0?72:t;let i;e[0]!==s?(i={width:s,height:s},e[0]=s,e[1]=i):i=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx("div",{className:"h-full w-full overflow-hidden rounded-full border-4 border-card bg-muted",children:n.jsx("img",{src:Mt.photo,alt:"Especialista da deco",className:"h-full w-full object-cover",loading:"lazy"})}),e[2]=c):c=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsxs("span",{className:"absolute bottom-1.5 right-1.5 flex h-3.5 w-3.5",children:[n.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-success opacity-60 motion-safe:animate-ping","aria-hidden":!0}),n.jsx("span",{className:"relative inline-flex h-3.5 w-3.5 rounded-full border-2 border-card bg-success"})]}),e[3]=r):r=e[3];let a;return e[4]!==i?(a=n.jsxs("div",{className:"relative shrink-0",style:i,children:[c,r]}),e[4]=i,e[5]=a):a=e[5],a}function mt(o){const e=z.c(6),{href:t,orgId:s}=o;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx("div",{className:"h-20",style:{backgroundColor:qt}}),e[0]=i):i=e[0];let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx("div",{className:"-mt-9 mb-4",children:n.jsx(hs,{})}),e[1]=c):c=e[1];let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx("h2",{className:"text-lg font-medium leading-6 text-foreground",children:fs}),n.jsx("p",{className:"text-sm leading-5 text-muted-foreground",children:ps})]}),e[2]=r):r=e[2];let a;return e[3]!==t||e[4]!==s?(a=n.jsx("div",{className:"relative flex h-full w-full items-center justify-center p-10",children:n.jsxs("div",{className:"w-full max-w-[440px] overflow-hidden rounded-3xl border border-border bg-card card-shadow",children:[i,n.jsxs("div",{className:"px-8 pb-8",children:[c,r,n.jsx(gs,{href:t,size:"lg",className:"mt-6",orgId:s})]})]})}),e[3]=t,e[4]=s,e[5]=a):a=e[5],a}function xs(o){const e=z.c(11),{className:t,href:s,orgId:i}=o,c=s===void 0?ct:s;let r;e[0]!==i?(r=()=>te("commerce_onboarding_meeting_cta_clicked",{placement:"mobile_banner",organization_id:i}),e[0]=i,e[1]=r):r=e[1];let a;e[2]!==t?(a=oe("flex items-center gap-4 rounded-2xl border border-border bg-card p-5 card-shadow transition-colors hover:bg-accent",t),e[2]=t,e[3]=a):a=e[3];let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsxs("span",{className:"relative shrink-0",children:[n.jsx("span",{className:"block h-11 w-11 overflow-hidden rounded-full",style:{boxShadow:`0 0 0 2px ${qt}`},children:n.jsx("img",{src:Mt.photo,alt:"Especialista da deco",className:"h-full w-full object-cover",loading:"lazy"})}),n.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-3 w-3 rounded-full border-2 border-card bg-success","aria-hidden":!0})]}),e[4]=l):l=e[4];let m,u;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsxs("span",{className:"flex-1 text-base font-medium leading-5 text-foreground",children:["Precisa de ajuda?",n.jsx("br",{}),"Fale conosco"]}),u=n.jsx(Lt,{size:18,className:"shrink-0 text-muted-foreground"}),e[5]=m,e[6]=u):(m=e[5],u=e[6]);let p;return e[7]!==c||e[8]!==r||e[9]!==a?(p=n.jsxs("a",{href:c,target:"_blank",rel:"noreferrer",onClick:r,className:a,children:[l,m,u]}),e[7]=c,e[8]=r,e[9]=a,e[10]=p):p=e[10],p}function Kt(o){const e=z.c(10),{host:t}=o,s=`https://www.google.com/s2/favicons?domain=${t}&sz=128`;let i,c,r;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-7 w-7 dark:hidden"}),c=n.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"h-7 w-7 hidden dark:block"}),r=n.jsx("div",{className:"h-6 w-px rotate-12 bg-border","aria-hidden":"true"}),e[0]=i,e[1]=c,e[2]=r):(i=e[0],c=e[1],r=e[2]);let a;e[3]!==s?(a=n.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-border bg-white",children:n.jsx("img",{src:s,alt:"",className:"h-5 w-5",loading:"lazy"})}),e[3]=s,e[4]=a):a=e[4];let l;e[5]!==t?(l=n.jsx("span",{className:"text-lg font-medium text-foreground",children:t}),e[5]=t,e[6]=l):l=e[6];let m;return e[7]!==a||e[8]!==l?(m=n.jsxs("div",{className:"flex items-center gap-3",children:[i,c,r,a,l]}),e[7]=a,e[8]=l,e[9]=m):m=e[9],m}const ys={workspace:"Preparando seu workspace de commerce...",generic:"Preparando..."};function bs(o){return ys[o]}function ut(o){const e=z.c(4),{variant:t}=o;let s;e[0]!==t?(s=bs(t),e[0]=t,e[1]=s):s=e[1];let i;return e[2]!==s?(i=n.jsx("div",{className:"flex justify-center py-4",role:"status","aria-live":"polite",children:n.jsx(ot,{label:s,className:"text-muted-foreground"})}),e[2]=s,e[3]=i):i=e[3],i}function Fo(){const o=z.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(js,{}),o[0]=e):e=o[0],e}const Vt=K.createContext(null),Ht=()=>K.useContext(Vt);function ne(o){const e=z.c(13);let t,s;e[0]!==o?({visual:s,...t}=o,e[0]=o,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i={from:"/commerce-onboarding"},e[3]=i):i=e[3];const c=jt(i),{data:r}=Me.useSession(),a=r?.user?.email;let l;e[4]!==c.siteUrl||e[5]!==a?(l=dt({siteUrl:c.siteUrl,email:a}),e[4]=c.siteUrl,e[5]=a,e[6]=l):l=e[6];const m=l;let u;e[7]!==m||e[8]!==s?(u=s??n.jsx(mt,{href:m}),e[7]=m,e[8]=s,e[9]=u):u=e[9];let p;return e[10]!==t||e[11]!==u?(p=n.jsx(Jt,{...t,visual:u}),e[10]=t,e[11]=u,e[12]=p):p=e[12],p}const vs={signUpFailed:"Falha ao criar conta",signInFailed:"Falha ao entrar",authenticationFailed:"Falha na autenticação",resetEmailFailed:"Não foi possível enviar o e-mail de redefinição",otpSendFailed:"Não foi possível enviar o código",invalidCode:"Código inválido",invalidEmail:"E-mail inválido",invalidEmailOrPassword:"E-mail ou senha inválidos. Tente novamente.",accountExists:"Já existe uma conta com este e-mail. Tente entrar em vez de criar uma nova conta.",networkError:"Erro de rede. Verifique sua conexão e tente novamente.",tooManyAttempts:"Muitas tentativas. Aguarde um momento e tente novamente.",invalidOrExpiredCode:"Código inválido ou expirado. Tente novamente.",genericError:"Algo deu errado. Tente novamente.",resetPasswordTitle:"Redefinir sua senha",verificationCodeTitle:"Informe o código de verificação",welcomeTitle:"Bem-vindo à deco",resetPasswordSubtitle:"Enviaremos um link de redefinição",codeSentTo:o=>`Código enviado para ${o}`,defaultSubtitle:"Entre ou crie uma nova conta",resetEmailSent:"Verifique seu e-mail para redefinir a senha.",continueWith:o=>`Continuar com ${o}`,divider:"ou",emailLabel:"E-mail",emailPlaceholder:"Endereço de e-mail",sending:"Enviando...",sendCode:"Enviar código",verificationCodeLabel:"Código de verificação",enterCodePlaceholder:"Informe o código",verifying:"Verificando...",verify:"Verificar",useDifferentEmail:"Usar outro e-mail",sendResetLink:"Enviar link de redefinição",nameLabel:"Nome",namePlaceholder:"Seu nome",passwordLabel:"Senha",forgotPassword:"Esqueceu a senha?",creatingAccount:"Criando conta...",signingIn:"Entrando...",continue:"Continuar",backToSignIn:"Voltar para entrar",signInWithPassword:"Entrar com senha",alreadyHaveAccount:"Já tem uma conta? ",dontHaveAccount:"Não tem uma conta? ",signIn:"Entrar",signUp:"Criar conta",signInWithEmailCode:"Entrar com código por e-mail"};function Ee(o){if(!o)return null;const e=Ne(o);return e.ok?new URL(e.value).hostname:null}function ht(o){switch(o){case"Enter a website URL.":return"Informe a URL de um site.";case"Use an HTTP or HTTPS website URL.":return"Use uma URL de site HTTP ou HTTPS.";case"Enter a valid website URL.":return"Informe uma URL de site válida.";default:return o}}let xt=!1;function js(){const o=jt({from:"/commerce-onboarding"}),{org:e,siteUrl:t}=o,s=Ee(t);return!xt&&Gt()&&(xt=!0,te("commerce_onboarding_viewed",{site_url:t,domain:s??void 0,...s?{$set:{last_scanned_domain:s}}:{}})),n.jsx(Vt.Provider,{value:s,children:n.jsx(Cs,{requestedOrgSlug:e,siteUrl:t})})}function Cs(o){const e=z.c(8),{requestedOrgSlug:t,siteUrl:s}=o,{data:i,isPending:c}=Me.useSession(),r=Ht();if(c){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(ne,{children:n.jsx(ut,{variant:"generic"})}),e[0]=l):l=e[0],l}if(!i){const l=typeof window>"u"?"/commerce-onboarding":`${window.location.pathname}${window.location.search}`;let m;e[1]!==r?(m=r?n.jsx(Kt,{host:r}):void 0,e[1]=r,e[2]=m):m=e[2];let u;return e[3]!==m?(u=n.jsx(ne,{children:n.jsx(Yt,{callbackUrl:l,allowAutoLogin:!1,title:"Desbloqueie seu diagnóstico completo",subtitle:null,brand:m,copy:vs})}),e[3]=m,e[4]=u):u=e[4],u}let a;return e[5]!==t||e[6]!==s?(a=n.jsx(Ss,{requestedOrgSlug:t,siteUrl:s}),e[5]=t,e[6]=s,e[7]=a):a=e[7],a}function Ss(o){const e=z.c(40),{requestedOrgSlug:t,siteUrl:s}=o,i=Ct(),c=Qt(),[r,a]=K.useState(null),[l,m]=K.useState(null),u=c.data?.map(Ns)??[];let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={mutationFn:_s,retry:!1,onSuccess:f=>{m(f)}},e[0]=p):p=e[0];const d=we(p);if(c.isPending){let f;return e[1]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(ne,{children:n.jsx(ut,{variant:"workspace"})}),e[1]=f):f=e[1],f}if(c.error){let f;return e[2]!==c?(f=n.jsx(Le,{title:"Não foi possível carregar suas organizações",description:"Tente novamente para continuar a configuração de commerce nesta página.",actionLabel:"Tentar novamente",onRetry:()=>c.refetch()}),e[2]=c,e[3]=f):f=e[3],f}const x=t?u.find(f=>f.slug===t):null;if(x){let f;return e[4]!==x||e[5]!==s?(f=n.jsx(Pe,{org:x,initialSiteUrl:s}),e[4]=x,e[5]=s,e[6]=f):f=e[6],f}if(t){let f;return e[7]!==c?(f=n.jsx(Le,{title:"Organização não encontrada",description:"Não conseguimos encontrar essa organização na sua conta.",actionLabel:"Tentar novamente",onRetry:()=>c.refetch()}),e[7]=c,e[8]=f):f=e[8],f}if(r){let f;return e[9]!==r||e[10]!==s?(f=n.jsx(Pe,{org:r,initialSiteUrl:s}),e[9]=r,e[10]=s,e[11]=f):f=e[11],f}if(u.length===1&&u[0]){let f;return e[12]!==u[0]||e[13]!==s?(f=n.jsx(Pe,{org:u[0],initialSiteUrl:s}),e[12]=u[0],e[13]=s,e[14]=f):f=e[14],f}if(u.length>1){let f;e[15]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(re,{title:"Escolha uma organização",description:"Selecione onde o diagnóstico de commerce deve continuar."}),e[15]=f):f=e[15];let h;e[16]===Symbol.for("react.memo_cache_sentinel")?(h=C=>a(C),e[16]=h):h=e[16];let b;return e[17]!==u?(b=n.jsx(ne,{children:n.jsxs("div",{className:"grid gap-10",children:[f,n.jsx(Ye,{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:n.jsx(ft,{organizations:u,selectLabel:"Continuar",onSelected:h})})]})}),e[17]=u,e[18]=b):b=e[18],b}if(!l){let f;e[19]!==d?(f=()=>{d.reset(),d.mutate()},e[19]=d,e[20]=f):f=e[20];let h;return e[21]!==d||e[22]!==f?(h=n.jsx(Es,{mutation:d,onRetry:f}),e[21]=d,e[22]=f,e[23]=h):h=e[23],h}const y=l;if(y?.success&&(y.status==="created"||y.status==="joined"||y.status==="already_has_organization")&&y.organization){let f;return e[24]!==y.organization||e[25]!==s?(f=n.jsx(Pe,{org:y.organization,initialSiteUrl:s}),e[24]=y.organization,e[25]=s,e[26]=f):f=e[26],f}if(y?.status==="ambiguous"&&y.organizations&&y.organizations.length>0){let f;e[27]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(re,{title:"Escolha uma organização",description:"Seu e-mail pode acessar mais de uma organização. Escolha onde a configuração de commerce deve continuar."}),e[27]=f):f=e[27];const h=y.domain??void 0;let b;e[28]!==i||e[29]!==s?(b=(w,E)=>{St(),a({...w,slug:E}),i({to:"/commerce-onboarding",search:{org:E,siteUrl:s}})},e[28]=i,e[29]=s,e[30]=b):b=e[30];let C;return e[31]!==y.organizations||e[32]!==h||e[33]!==b?(C=n.jsx(ne,{children:n.jsxs("div",{className:"grid gap-10",children:[f,n.jsx(Ye,{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:n.jsx(ft,{organizations:y.organizations,domain:h,onJoined:b})})]})}),e[31]=y.organizations,e[32]=h,e[33]=b,e[34]=C):C=e[34],C}const j=y?.error??"Não conseguimos determinar uma organização de commerce para esta conta.";let v;e[35]!==d?(v=()=>{m(null),d.reset()},e[35]=d,e[36]=v):v=e[36];let g;return e[37]!==j||e[38]!==v?(g=n.jsx(Le,{title:"O onboarding de commerce precisa de suporte",description:j,actionLabel:"Tentar novamente",onRetry:v}),e[37]=j,e[38]=v,e[39]=g):g=e[39],g}async function _s(){const e=await(await fetch("/api/auth/custom/ensure-organization",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})).json();return e.success&&(e.status==="created"||e.status==="joined"||e.status==="already_has_organization")&&e.organization&&St(),e}function Ns(o){return{id:o.id,name:o.name,slug:o.slug,logo:o.logo??null}}function Es(o){const e=z.c(7),{mutation:t,onRetry:s}=o,i=K.useRef(!1);let c;e[0]!==t?(c=m=>{!m||i.current||(i.current=!0,t.mutate())},e[0]=t,e[1]=c):c=e[1];const r=c;if(t.error){let m;return e[2]!==s?(m=n.jsx(Le,{title:"Onboarding de commerce indisponível",description:"Não foi possível preparar uma organização para a configuração de commerce. Tente novamente por esta página ou fale com o suporte.",actionLabel:"Tentar novamente",onRetry:s}),e[2]=s,e[3]=m):m=e[3],m}let a;e[4]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(ut,{variant:"generic"}),e[4]=a):a=e[4];let l;return e[5]!==r?(l=n.jsx(ne,{children:n.jsx("div",{ref:r,children:a})}),e[5]=r,e[6]=l):l=e[6],l}function re(o){const e=z.c(8),{title:t,description:s}=o,i=Ht();let c;e[0]!==i?(c=i?n.jsx(Kt,{host:i}):n.jsxs("div",{children:[n.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12 dark:hidden"}),n.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"h-12 w-12 hidden dark:block"})]}),e[0]=i,e[1]=c):c=e[1];let r;e[2]!==s||e[3]!==t?(r=(t||s)&&n.jsxs("div",{className:"space-y-2",children:[t&&n.jsx("h1",{className:"text-2xl font-medium leading-8",children:t}),s&&n.jsx("p",{className:"text-base text-muted-foreground leading-6",children:s})]}),e[2]=s,e[3]=t,e[4]=r):r=e[4];let a;return e[5]!==c||e[6]!==r?(a=n.jsxs("div",{className:"grid gap-10",children:[c,r]}),e[5]=c,e[6]=r,e[7]=a):a=e[7],a}function Le(o){const e=z.c(9),{title:t,description:s,actionLabel:i,onRetry:c}=o;let r;e[0]!==s||e[1]!==t?(r=n.jsx(re,{title:t,description:s}),e[0]=s,e[1]=t,e[2]=r):r=e[2];let a;e[3]!==i||e[4]!==c?(a=n.jsx(G,{type:"button",size:"xl",className:"w-full",onClick:c,children:i}),e[3]=i,e[4]=c,e[5]=a):a=e[5];let l;return e[6]!==r||e[7]!==a?(l=n.jsx(ne,{children:n.jsxs("div",{className:"grid gap-10",children:[r,a]})}),e[6]=r,e[7]=a,e[8]=l):l=e[8],l}function ws(o){return o.content?.find(e=>e.text)?.text??"A configuração do Commerce Discovery falhou."}function Ue(o){const e=o;if(e.isError)throw new Error(ws(e));return e.structuredContent??o}function Pe(o){const e=z.c(11),{org:t,initialSiteUrl:s}=o,{data:i}=Me.useSession(),c=i?.user?.email;let r;e[0]!==s||e[1]!==c?(r=dt({siteUrl:s,email:c}),e[0]=s,e[1]=c,e[2]=r):r=e[2];const a=r;let l;e[3]!==a||e[4]!==t.id?(l=n.jsx(mt,{href:a,orgId:t.id}),e[3]=a,e[4]=t.id,e[5]=l):l=e[5];const m=l;let u;return e[6]!==s||e[7]!==m||e[8]!==t||e[9]!==i?.user?.email?(u=n.jsx(bt,{children:p=>{const{reset:d}=p;return n.jsx(vt,{fallback:x=>{const{error:y,resetError:j}=x;return n.jsx(ne,{visual:m,children:n.jsx(Is,{orgName:t.name,message:y instanceof Error?y.message:"Não foi possível verificar a configuração do Commerce Discovery.",onRetry:()=>{d(),j()}})})},children:n.jsx(K.Suspense,{fallback:n.jsx(Bt,{visual:m}),children:n.jsx(Ts,{org:t,initialSiteUrl:s,sessionEmail:i?.user?.email},`${t.id}:${s??""}`)})})}}),e[6]=s,e[7]=m,e[8]=t,e[9]=i?.user?.email,e[10]=u):u=e[10],u}function Bt(o){const e=z.c(3),{visual:t}=o;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-6 md:grid md:gap-4",children:[n.jsx(re,{}),n.jsx(lt,{})]}),e[0]=s):s=e[0];let i;return e[1]!==t?(i=n.jsx(ne,{align:"fill",visual:t,children:s}),e[1]=t,e[2]=i):i=e[2],i}function Is(o){const e=z.c(10),{orgName:t,message:s,onRetry:i}=o,c=`A configuração de commerce continuará em ${t}.`;let r;e[0]!==c?(r=n.jsx(re,{title:"Diagnóstico de commerce",description:c}),e[0]=c,e[1]=r):r=e[1];let a;e[2]!==s?(a=n.jsx(Ie,{message:s}),e[2]=s,e[3]=a):a=e[3];let l;e[4]!==i?(l=n.jsx(G,{type:"button",size:"xl",className:"w-full",onClick:i,children:"Tentar novamente"}),e[4]=i,e[5]=l):l=e[5];let m;return e[6]!==r||e[7]!==a||e[8]!==l?(m=n.jsxs("div",{className:"grid gap-10",children:[r,a,l]}),e[6]=r,e[7]=a,e[8]=l,e[9]=m):m=e[9],m}function Ts(o){const e=z.c(117),{org:t,initialSiteUrl:s,sessionEmail:i}=o,c=Ct();let r;e[0]!==t.id||e[1]!==t.slug?(r={connectionId:Nt,orgId:t.id,orgSlug:t.slug},e[0]=t.id,e[1]=t.slug,e[2]=r):r=e[2];const a=qe(r),[l,m]=K.useState(s??""),[u,p]=K.useState(null),[d,x]=K.useState(null),y=K.useRef(!1),j=_t.COMMERCE_DISCOVERY(t.id),v=Xt(t.id),g=Z.commerceDiscoveryConnection(t.id,j);let f;e[3]!==j||e[4]!==a?(f=async()=>{const P=await a.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:j}});return Ue(P)},e[3]=j,e[4]=a,e[5]=f):f=e[5];let h;e[6]!==g||e[7]!==f?(h={queryKey:g,queryFn:f,retry:!1},e[6]=g,e[7]=f,e[8]=h):h=e[8];const b=ye(h),C=Z.commerceDiscoveryVirtualMcp(t.id,v);let w;e[9]!==a||e[10]!==v?(w=async()=>{const P=await a.callTool({name:"COLLECTION_VIRTUAL_MCP_GET",arguments:{id:v}});return Ue(P)},e[9]=a,e[10]=v,e[11]=w):w=e[11];let E;e[12]!==C||e[13]!==w?(E={queryKey:C,queryFn:w,retry:!1},e[12]=C,e[13]=w,e[14]=E):E=e[14];const _=ye(E);let N;e[15]!==a?(N=async P=>{const B=await a.callTool({name:"COMMERCE_DISCOVERY_SETUP",arguments:{siteUrl:P}});return Ue(B)},e[15]=a,e[16]=N):N=e[16];let I;e[17]!==b||e[18]!==t.id||e[19]!==_?(I=(P,B)=>{te("commerce_onboarding_setup_succeeded",{domain:Ee(B)??void 0,organization_id:t.id}),p(P),x(null),b.refetch(),_.refetch()},e[17]=b,e[18]=t.id,e[19]=_,e[20]=I):I=e[20];let U;e[21]!==t.id?(U=(P,B)=>{te("commerce_onboarding_setup_failed",{domain:Ee(B)??void 0,organization_id:t.id,error:P instanceof Error?P.message:String(P)}),x(P instanceof Error?P.message:"A configuração do Commerce Discovery falhou.")},e[21]=t.id,e[22]=U):U=e[22];let T;e[23]!==U||e[24]!==N||e[25]!==I?(T={mutationFn:N,retry:!1,onSuccess:I,onError:U},e[23]=U,e[24]=N,e[25]=I,e[26]=T):T=e[26];const O=we(T);let k;e[27]!==a?(k={mutationFn:async P=>{const B=await a.callTool({name:"COMMERCE_DISCOVERY_RUN",arguments:{siteUrl:P}});return Ue(B)},retry:!1},e[27]=a,e[28]=k):k=e[28];const R=we(k),[$,M]=K.useState(null),L=!!b.data.item&&!!_.data.item,F=b.data.item,q=typeof F?.metadata?.siteUrl=="string"?F.metadata.siteUrl:void 0,S=s||l||q||"";let D;e[29]!==S||e[30]!==i?(D=dt({siteUrl:S,email:i}),e[29]=S,e[30]=i,e[31]=D):D=e[31];const W=D;let Q;e[32]!==W||e[33]!==t.id?(Q=n.jsx(mt,{href:W,orgId:t.id}),e[32]=W,e[33]=t.id,e[34]=Q):Q=e[34];const H=Q;let X;e[35]!==O?(X=P=>{const B=Ne(P);if(!B.ok){x(ht(B.error));return}x(null),O.mutate(B.value)},e[35]=O,e[36]=X):X=e[36];const Y=X;let J;e[37]!==s||e[38]!==Y||e[39]!==L?(J=P=>{!P||y.current||L||!s||(y.current=!0,Y(s))},e[37]=s,e[38]=Y,e[39]=L,e[40]=J):J=e[40];const ee=J;let A;e[41]!==t.id||e[42]!==Y||e[43]!==l?(A=P=>{P.preventDefault();const B=Ne(l);B.ok&&te("commerce_onboarding_site_url_submitted",{domain:new URL(B.value).hostname,organization_id:t.id}),Y(l)},e[41]=t.id,e[42]=Y,e[43]=l,e[44]=A):A=e[44];const V=A;let ie;e[45]!==j||e[46]!==u?.reportApp||e[47]!==v?(ie=u?.reportApp??{connectionId:j,virtualMcpId:v,toolName:en},e[45]=j,e[46]=u?.reportApp,e[47]=v,e[48]=ie):ie=e[48];const ae=ie;let Oe;e[49]!==S||e[50]!==c||e[51]!==t.id||e[52]!==t.slug||e[53]!==ae||e[54]!==R?(Oe=async()=>{M(null),te("commerce_onboarding_open_report_clicked",{domain:Ee(S)??void 0,organization_id:t.id});const P=Ne(S);if(P.ok)try{await R.mutateAsync(P.value)}catch(B){const le=B;te("commerce_onboarding_run_failed",{domain:Ee(S)??void 0,organization_id:t.id,error:le instanceof Error?le.message:String(le)}),M("Algo deu errado ao gerar seu relatório. Tente novamente em instantes.");return}localStorage.setItem(Wt.sidebarOpen(),JSON.stringify(!1)),c({to:"/$org/$taskId",params:{org:t.slug,taskId:crypto.randomUUID()},search:{virtualmcpid:ae.virtualMcpId,main:Zt(ae.connectionId,ae.toolName),chat:0}})},e[49]=S,e[50]=c,e[51]=t.id,e[52]=t.slug,e[53]=ae,e[54]=R,e[55]=Oe):Oe=e[55];const He=Oe;if(L){let P;return e[56]!==W||e[57]!==H||e[58]!==S||e[59]!==He||e[60]!==t||e[61]!==ae||e[62]!==$||e[63]!==R.isPending?(P=n.jsx(Os,{org:t,reportApp:ae,onOpenReport:He,isSubmitting:R.isPending,error:$,meetingUrl:W,meetingVisual:H,siteUrl:S}),e[56]=W,e[57]=H,e[58]=S,e[59]=He,e[60]=t,e[61]=ae,e[62]=$,e[63]=R.isPending,e[64]=P):P=e[64],P}if(O.isPending){let P;return e[65]!==H?(P=n.jsx(Bt,{visual:H}),e[65]=H,e[66]=P):P=e[66],P}if(s){let P,B;if(e[67]!==H||e[68]!==V||e[69]!==s||e[70]!==d||e[71]!==t.name||e[72]!==O.isPending||e[73]!==l){B=Symbol.for("react.early_return_sentinel");e:if(P=Ne(s),!P.ok){const Ge=`A configuração de commerce continuará em ${t.name}.`;let ge;e[76]!==Ge?(ge=n.jsx(re,{title:"Diagnóstico de commerce",description:Ge}),e[76]=Ge,e[77]=ge):ge=e[77];const Qe=n.jsx(Ie,{message:ht(P.error)});let he;e[78]!==V||e[79]!==d||e[80]!==O.isPending||e[81]!==l?(he=n.jsx(We,{siteUrl:l,error:d,isSubmitting:O.isPending,onSiteUrlChange:m,onSubmit:V}),e[78]=V,e[79]=d,e[80]=O.isPending,e[81]=l,e[82]=he):he=e[82];let xe;e[83]!==ge||e[84]!==Qe||e[85]!==he?(xe=n.jsxs("div",{className:"grid gap-10",children:[ge,Qe,he]}),e[83]=ge,e[84]=Qe,e[85]=he,e[86]=xe):xe=e[86];let Re;e[87]!==H||e[88]!==xe?(Re=n.jsx(ne,{visual:H,children:xe}),e[87]=H,e[88]=xe,e[89]=Re):Re=e[89],B=Re;break e}e[67]=H,e[68]=V,e[69]=s,e[70]=d,e[71]=t.name,e[72]=O.isPending,e[73]=l,e[74]=P,e[75]=B}else P=e[74],B=e[75];if(B!==Symbol.for("react.early_return_sentinel"))return B;const le=`O Commerce Discovery está sendo preparado para ${P.value}.`;let ue;e[90]!==le?(ue=n.jsx(re,{title:"Diagnóstico de commerce",description:le}),e[90]=le,e[91]=ue):ue=e[91];let fe;e[92]!==V||e[93]!==d||e[94]!==O.isPending||e[95]!==l?(fe=d?n.jsxs(n.Fragment,{children:[n.jsx(Ie,{message:d}),n.jsx(We,{siteUrl:l,error:null,isSubmitting:O.isPending,onSiteUrlChange:m,onSubmit:V})]}):n.jsx(lt,{}),e[92]=V,e[93]=d,e[94]=O.isPending,e[95]=l,e[96]=fe):fe=e[96];let pe;e[97]!==ue||e[98]!==fe||e[99]!==ee?(pe=n.jsxs("div",{ref:ee,className:"grid gap-10",children:[ue,fe]}),e[97]=ue,e[98]=fe,e[99]=ee,e[100]=pe):pe=e[100];let ke;return e[101]!==H||e[102]!==pe?(ke=n.jsx(ne,{visual:H,children:pe}),e[101]=H,e[102]=pe,e[103]=ke):ke=e[103],ke}const Be=`A configuração de commerce continuará em ${t.name}.`;let ce;e[104]!==Be?(ce=n.jsx(re,{title:"Diagnóstico de commerce",description:Be}),e[104]=Be,e[105]=ce):ce=e[105];let de;e[106]!==V||e[107]!==d||e[108]!==O.isPending||e[109]!==l?(de=n.jsx(We,{siteUrl:l,error:d,isSubmitting:O.isPending,onSiteUrlChange:m,onSubmit:V}),e[106]=V,e[107]=d,e[108]=O.isPending,e[109]=l,e[110]=de):de=e[110];let me;e[111]!==ce||e[112]!==de?(me=n.jsxs("div",{className:"grid gap-10",children:[ce,de]}),e[111]=ce,e[112]=de,e[113]=me):me=e[113];let Ae;return e[114]!==H||e[115]!==me?(Ae=n.jsx(ne,{visual:H,children:me}),e[114]=H,e[115]=me,e[116]=Ae):Ae=e[116],Ae}function We(o){const e=z.c(20),{siteUrl:t,error:s,isSubmitting:i,onSiteUrlChange:c,onSubmit:r}=o;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx("label",{className:"text-sm font-medium",htmlFor:"commerce-site-url",children:"URL do site"}),e[0]=a):a=e[0];let l;e[1]!==c?(l=v=>c(v.target.value),e[1]=c,e[2]=l):l=e[2];const m=!!s;let u;e[3]!==i||e[4]!==t||e[5]!==l||e[6]!==m?(u=n.jsx(Te,{id:"commerce-site-url",type:"text",inputMode:"url",value:t,onChange:l,placeholder:"https://example.com","aria-invalid":m,disabled:i}),e[3]=i,e[4]=t,e[5]=l,e[6]=m,e[7]=u):u=e[7];let p;e[8]!==s?(p=s?n.jsx(Ie,{message:s}):null,e[8]=s,e[9]=p):p=e[9];let d;e[10]!==u||e[11]!==p?(d=n.jsxs("div",{className:"grid gap-2",children:[a,u,p]}),e[10]=u,e[11]=p,e[12]=d):d=e[12];let x;e[13]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx(Et,{size:16}),e[13]=x):x=e[13];let y;e[14]!==i?(y=n.jsxs(G,{type:"submit",size:"xl",className:"w-full",disabled:i,children:["Continuar",x]}),e[14]=i,e[15]=y):y=e[15];let j;return e[16]!==r||e[17]!==d||e[18]!==y?(j=n.jsxs("form",{className:"grid gap-4",onSubmit:r,children:[d,y]}),e[16]=r,e[17]=d,e[18]=y,e[19]=j):j=e[19],j}function Os(o){const e=z.c(27),{org:t,reportApp:s,onOpenReport:i,isSubmitting:c,error:r,meetingUrl:a,meetingVisual:l,siteUrl:m}=o;let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(re,{}),e[0]=u):u=e[0];let p;e[1]!==t||e[2]!==s.connectionId||e[3]!==m?(p=n.jsx(ms,{org:t,cdConnectionId:s.connectionId,siteUrl:m}),e[1]=t,e[2]=s.connectionId,e[3]=m,e[4]=p):p=e[4];let d;e[5]!==a||e[6]!==t.id?(d=n.jsx(xs,{className:"md:hidden",href:a,orgId:t.id}),e[5]=a,e[6]=t.id,e[7]=d):d=e[7];let x;e[8]!==r?(x=r?n.jsx(Ie,{message:r}):null,e[8]=r,e[9]=x):x=e[9];const y=c||!s.virtualMcpId,j=c?"Abrindo relatório...":"Ver relatório completo";let v;e[10]!==c?(v=c?null:n.jsx(Et,{size:18}),e[10]=c,e[11]=v):v=e[11];let g;e[12]!==i||e[13]!==y||e[14]!==j||e[15]!==v?(g=n.jsxs(G,{type:"button",size:"xl",className:"w-full rounded-2xl text-base font-medium",onClick:i,disabled:y,children:[j,v]}),e[12]=i,e[13]=y,e[14]=j,e[15]=v,e[16]=g):g=e[16];let f;e[17]!==d||e[18]!==x||e[19]!==g?(f=n.jsxs("div",{className:"flex shrink-0 flex-col gap-3 md:mt-8",children:[d,x,g]}),e[17]=d,e[18]=x,e[19]=g,e[20]=f):f=e[20];let h;e[21]!==p||e[22]!==f?(h=n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-6 md:grid md:gap-4",children:[u,p,f]}),e[21]=p,e[22]=f,e[23]=h):h=e[23];let b;return e[24]!==l||e[25]!==h?(b=n.jsx(ne,{align:"fill",visual:l,children:h}),e[24]=l,e[25]=h,e[26]=b):b=e[26],b}function Ie(o){const e=z.c(2),{message:t}=o;let s;return e[0]!==t?(s=n.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:t}),e[0]=t,e[1]=s):s=e[1],s}export{Fo as default};
|
package/dist/client/assets/{connect-desktop-dialog-Ny2ddpDi.js → connect-desktop-dialog-C7OzpQot.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as b,D as k,K as w,k as z,j as s,r as M,B as T,l as v}from"./index-
|
|
1
|
+
import{c as b,D as k,K as w,k as z,j as s,r as M,B as T,l as v}from"./index-BlbGtC1U.js";import{a as I,b as S,c as D,d as E,e as R}from"./dialog-Dj81EdMo.js";import{S as _}from"./chat-context-DJ9kQ1Gu.js";import{i as $}from"./ChevronUp-uk87fvlM.js";import{a as A}from"./Eye-BHPT57Tm.js";import{u as B}from"./studio-tools-7mZABBZl.js";const L={online:!1,capabilities:[],ready:!1};function F(){const i=b.c(7),{org:e}=k(),l=B();let o;i[0]!==e.id?(o=w.currentLink(e.id),i[0]=e.id,i[1]=o):o=i[1];let t;i[2]!==l?(t=async()=>{const f=await l.call("LINK_CURRENT_GET",{});return f?{...f,ready:!0}:{...L,ready:!0}},i[2]=l,i[3]=t):t=i[3];let n;i[4]!==o||i[5]!==t?(n={queryKey:o,queryFn:t,staleTime:4e3,refetchInterval:5e3,refetchOnWindowFocus:!0},i[4]=o,i[5]=t,i[6]=n):n=i[6];const{data:p}=z(n);return p??L}function K(i){const e=b.c(3),{size:l}=i,o=l===void 0?16:l;let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx("path",{d:"M13 12L18.5 5M7.63965 3L12.5 12L13.6865 3M4.48381 6.71679L11.9872 12M3 12L11.9872 12.473M12.2244 13.177L7 20M4.84194 16.8682L11.2824 12.9758M11.5 21L12.665 13.177M21 14L13.1846 12.668M21 10.5788L13 12.3223M16.779 19.646L12.8876 13.3772M19.3566 18.207L13.313 12.9893"}),e[0]=t):t=e[0];let n;return e[1]!==o?(n=s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:o,height:o,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:t}),e[1]=o,e[2]=n):n=e[2],n}function O(i){const e=b.c(3),{size:l}=i,o=l===void 0?16:l;let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx("path",{clipRule:"evenodd",d:"M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z"}),e[0]=t):t=e[0];let n;return e[1]!==o?(n=s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:o,height:o,fill:"currentColor",fillRule:"evenodd","aria-hidden":"true",children:t}),e[1]=o,e[2]=n):n=e[2],n}const y="bunx decocms@latest link",N=[{capability:"claude-code",label:"Claude Code",description:"Runs through the Claude Code CLI",icon:s.jsx(K,{size:18})},{capability:"codex",label:"Codex",description:"Runs through the Codex CLI",icon:s.jsx(O,{size:18})}];function Q(i){return N.filter(e=>i.includes(e.capability)).map(e=>e.label)}function U(i){const e=b.c(21),{open:l,onOpenChange:o}=i,t=F(),[n,p]=M.useState(!1),f=t.hostname??t.machineId??"Your desktop",j=t.online?`Connected to ${f}`:"Connect your desktop";let a;e[0]!==j?(a=s.jsx(I,{children:j}),e[0]=j,e[1]=a):a=e[1];const C=t.online?"This machine provides the following local agents.":"Run this command in your desktop terminal. The dialog will close once your desktop is online.";let r;e[2]!==C?(r=s.jsx(S,{children:C}),e[2]=C,e[3]=r):r=e[3];let c;e[4]!==a||e[5]!==r?(c=s.jsxs(D,{children:[a,r]}),e[4]=a,e[5]=r,e[6]=c):c=e[6];let d;e[7]!==n||e[8]!==t.online?(d=!t.online&&s.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-muted px-3 py-2 font-mono text-sm",children:[s.jsx("span",{className:"flex-1",children:y}),s.jsx(T,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>{navigator.clipboard.writeText(y),p(!0),setTimeout(()=>p(!1),1500)},children:n?s.jsx($,{size:14}):s.jsx(A,{size:14})})]}),e[7]=n,e[8]=t.online,e[9]=d):d=e[9];let u;e[10]!==t.capabilities||e[11]!==t.online?(u=t.online?s.jsx("div",{className:"flex flex-col gap-3 text-sm",children:s.jsx("div",{className:"flex flex-col gap-2",children:N.map(x=>{const g=t.capabilities.includes(x.capability);return s.jsxs("div",{className:v("flex items-center gap-3 rounded-md border px-3 py-2",g?"border-border bg-background text-foreground":"border-border/60 bg-muted/40 text-muted-foreground"),children:[s.jsx("div",{className:v("flex size-6 items-center justify-center",g?"text-foreground":"text-muted-foreground"),children:x.icon}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"font-medium",children:x.label}),s.jsx("p",{className:"text-xs text-muted-foreground",children:g?x.description:"Not detected"})]}),s.jsx("span",{className:v("size-2 rounded-full",g?"bg-success":"bg-muted-foreground/30")})]},x.capability)})})}):s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(_,{size:"sm"}),"Waiting for desktop…"]}),e[10]=t.capabilities,e[11]=t.online,e[12]=u):u=e[12];let m;e[13]!==c||e[14]!==d||e[15]!==u?(m=s.jsxs(E,{className:"sm:max-w-md",children:[c,d,u]}),e[13]=c,e[14]=d,e[15]=u,e[16]=m):m=e[16];let h;return e[17]!==o||e[18]!==l||e[19]!==m?(h=s.jsx(R,{open:l,onOpenChange:o,children:m}),e[17]=o,e[18]=l,e[19]=m,e[20]=h):h=e[20],h}export{U as C,K as a,O as b,F as u,Q as v};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as _}from"./connection-slug-eyAPH6o3.js";import{c as R,D as $,b1 as k,K as D,l as E,j as x}from"./index-
|
|
1
|
+
import{g as _}from"./connection-slug-eyAPH6o3.js";import{c as R,D as $,b1 as k,K as D,l as E,j as x}from"./index-BlbGtC1U.js";import{u as K}from"./use-registry-connections-Bgebk2mm.js";import{b as Q}from"./use-organization-settings-ClKaDrE7.js";import{S as w,e as F}from"./use-mcp-client-BYcrk6lz.js";import{u as H}from"./useInfiniteQuery-bB2OO4_F.js";import{i as q,f as G}from"./extract-connection-data-DumI9Ge5.js";import{C as U}from"./card-DjLKG66H.js";import{I as V}from"./integration-icon-m4V5ew5R.js";function ae(s){const e=new Map;for(const o of s){const l=_(o),r=e.get(l);r?r.push(o):e.set(l,[o])}const t=[],u=new Set;for(const o of s){const l=_(o);if(u.has(l))continue;u.add(l);const r=e.get(l),m=r[0];r.length===1?t.push({type:"single",connection:m}):t.push({type:"group",key:l,icon:m.icon,title:m.app_name?m.title.replace(/\s*\(\d+\)\s*$/,""):m.title,connections:r})}return t}function ce(){const s=R.c(6),e=K(),t=Q(),u=$().project.enabledPlugins??[];let o;if(s[0]!==u||s[1]!==t||s[2]!==e){let l;s[4]!==t?(l=r=>t(r.id),s[4]=t,s[5]=l):l=s[5],o=e.filter(l).map(X),u.includes("private-registry")&&t(w)&&o.push({id:w,title:"Private Registry",icon:null}),s[0]=u,s[1]=t,s[2]=e,s[3]=o}else o=s[3];return o}function X(s){return{id:s.id,title:s.title,icon:s.icon}}const Y=24,S=3;function A(s){return s.id.includes("community-registry")}function z(s){const e=s?.trim();if(e)return{operator:"or",conditions:[{field:["title"],operator:"contains",value:e},{field:["description"],operator:"contains",value:e},{field:["name"],operator:"contains",value:e},{field:["server","title"],operator:"contains",value:e}]}}function T(s,e,t,u,o){const l=s.map(c=>c.id).sort().join(","),r=z(o),{data:m,fetchNextPage:d,hasNextPage:f,isFetchingNextPage:p,isLoading:b}=H({queryKey:D.storeDiscovery(e,`${l}:${o??""}`),queryFn:async({pageParam:c})=>{const n=c??{};return await Promise.all(s.map(async i=>{const y=n[i.id];if(y==="EXHAUSTED")return{registryId:i.id,registryTitle:i.title,registryIcon:i.icon,items:[]};const j=q(i.id,e);let h;for(let v=0;v<S;v++){let C=null;try{C=await F({connectionId:i.id,orgId:e,orgSlug:t});const I={limit:Y};y&&(I.cursor=y),r&&(I.where=r);const P=await C.callTool({name:j,arguments:I}),N=P.structuredContent??P,M=N.nextCursor||N.cursor||void 0,L=G(N?[N]:[]);return{registryId:i.id,registryTitle:i.title,registryIcon:i.icon,items:L,nextCursor:M}}catch(I){h=I}finally{await C?.close().catch(()=>{})}}return console.warn(`[useMergedStoreDiscovery] Registry "${i.title}" (${i.id}) failed after ${S} attempts:`,h),{registryId:i.id,registryTitle:i.title,registryIcon:i.icon,items:[]}}))},initialPageParam:{},getNextPageParam:c=>{const n={};let a=!1;for(const i of c)i.registryId&&(i.nextCursor?(n[i.registryId]=i.nextCursor,a=!0):n[i.registryId]="EXHAUSTED");return a?n:void 0},staleTime:3600*1e3,placeholderData:k,retry:!1,enabled:s.length>0}),g=[];if(m?.pages)for(const c of m.pages)for(const n of c)for(const a of n.items)g.push({...a,_sourceName:a._sourceName??n.registryTitle,_sourceIcon:a._sourceIcon??n.registryIcon,_registryId:a._registryId??n.registryId});return{items:g,hasMore:f??!1,isLoadingMore:p,isInitialLoading:b,fetchNextPage:()=>{f&&!p&&d()}}}function ue(s,e){const t=R.c(16),{org:u}=$();let o;t[0]!==s?(o=s.filter(Z),t[0]=s,t[1]=o):o=t[1];const l=o;let r;t[2]!==s?(r=s.filter(W),t[2]=s,t[3]=r):r=t[3];const m=r,d=T(l,u.id,u.slug,!0,e),f=T(m,u.id,u.slug,!0,e);let p;if(t[4]!==f.items||t[5]!==d.items){const y=new Set;p=[];const j=[...d.items,...f.items];for(const h of j){const v=`${h._registryId}:${h.id}`;y.has(v)||(y.add(v),p.push(h))}t[4]=f.items,t[5]=d.items,t[6]=p}else p=t[6];const b=d.isInitialLoading||f.isInitialLoading,g=d.isLoadingMore||f.isLoadingMore,c=d.hasMore||f.hasMore;let n;t[7]!==f||t[8]!==d?(n=()=>{d.hasMore&&d.fetchNextPage(),f.hasMore&&f.fetchNextPage()},t[7]=f,t[8]=d,t[9]=n):n=t[9];const a=n;let i;return t[10]!==c||t[11]!==b||t[12]!==g||t[13]!==p||t[14]!==a?(i={items:p,hasMore:c,isLoadingMore:g,isInitialLoading:b,loadMore:a},t[10]=c,t[11]=b,t[12]=g,t[13]=p,t[14]=a,t[15]=i):i=t[15],i}function W(s){return A(s)}function Z(s){return!A(s)}function fe(s){const e=R.c(37),{connection:t,onClick:u,headerActions:o,headerActionsAlwaysVisible:l,body:r,footer:m,className:d,fallbackIcon:f}=s,p=l===void 0?!1:l,b=u&&"hover:bg-muted/50";let g;e[0]!==d||e[1]!==b?(g=E("cursor-pointer transition-colors group overflow-hidden flex flex-col h-full",b,d),e[0]=d,e[1]=b,e[2]=g):g=e[2];let c;e[3]!==t.icon||e[4]!==t.title||e[5]!==f?(c=x.jsx(V,{icon:t.icon,name:t.title,size:"sm",className:"shrink-0 shadow-sm",fallbackIcon:f}),e[3]=t.icon,e[4]=t.title,e[5]=f,e[6]=c):c=e[6];let n;e[7]!==o||e[8]!==p?(n=o&&x.jsx("div",{className:E("transition-opacity",!p&&"sm:opacity-0 sm:group-hover:opacity-100"),onClick:J,children:o}),e[7]=o,e[8]=p,e[9]=n):n=e[9];let a;e[10]!==n?(a=x.jsx("div",{className:"relative",children:n}),e[10]=n,e[11]=a):a=e[11];let i;e[12]!==c||e[13]!==a?(i=x.jsxs("div",{className:"flex items-start justify-between",children:[c,a]}),e[12]=c,e[13]=a,e[14]=i):i=e[14];let y;e[15]!==t.title?(y=x.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:t.title}),e[15]=t.title,e[16]=y):y=e[16];const j=t.description||"No description";let h;e[17]!==j?(h=x.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:j}),e[17]=j,e[18]=h):h=e[18];let v;e[19]!==h||e[20]!==y?(v=x.jsxs("div",{className:"flex flex-col gap-1",children:[y,h]}),e[19]=h,e[20]=y,e[21]=v):v=e[21];let C;e[22]!==r?(C=r&&x.jsx("div",{children:r}),e[22]=r,e[23]=C):C=e[23];let I;e[24]!==v||e[25]!==C||e[26]!==i?(I=x.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[i,v,C]}),e[24]=v,e[25]=C,e[26]=i,e[27]=I):I=e[27];let P;e[28]!==m?(P=m&&x.jsx("div",{className:"border-t border-border mt-auto",children:x.jsx("div",{className:"h-14 flex items-center p-4.5",onClick:B,children:m})}),e[28]=m,e[29]=P):P=e[29];let N;e[30]!==I||e[31]!==P?(N=x.jsxs("div",{className:"flex flex-col flex-1",children:[I,P]}),e[30]=I,e[31]=P,e[32]=N):N=e[32];let M;return e[33]!==u||e[34]!==N||e[35]!==g?(M=x.jsx(U,{className:g,onClick:u,children:N}),e[33]=u,e[34]=N,e[35]=g,e[36]=M):M=e[36],M}function B(s){return s.stopPropagation()}function J(s){return s.stopPropagation()}export{fe as C,ue as a,ae as g,ce as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as fe,aF as Ie,b7 as Ae,s as le,aD as De,c as P,j as t,i as ge,B as E,r as G,l as je,D as J,q as $e,K as ne,b as Y,ab as ce,z as Pe,b8 as Oe,E as ze,e as Me,b9 as Ve,m as Ee,p as Ue,n as Fe,t as q,ba as Re}from"./index-j1EmgqV8.js";import{a as Le}from"./extract-connection-data-DrUVsxqd.js";import{E as ve}from"./empty-state-DQfglbNM.js";import{E as Be,c as He,r as We,b as Xe,d as qe}from"./connection-form-helpers-Cco6Qbpt.js";import{c as Ge,S as Ke,V as Qe}from"./index-DrmUu6Oi.js";import{u as be,T as Je}from"./index-kU0DbGlO.js";import{u as Ye}from"./use-members-BqgoI8LN.js";import{A as Ze}from"./avatar-CdYywjB8.js";import{a as Ne,b as ye,u as et}from"./use-connection-a48WkDyi.js";import{u as _e}from"./use-mcp-client-B1E7Nyjd.js";import{a as tt}from"./use-mcp-tools-CqHv2Xxs.js";import{a as st}from"./use-mcp-prompts-B4idSZTh.js";import{i as nt,a as ot}from"./mcp-oauth-iKgiXli9.js";import{I as oe}from"./integration-icon-Cpv4CIQ_.js";import{s as it}from"./Plus-DrCr8atg.js";import{B as at,D as rt,aj as lt,a8 as ct}from"./agent-icon-SFzfjqT3.js";import{a as Se,s as dt}from"./Settings02-CWsiKyfu.js";import{s as ae}from"./Trash01-C3HJx9Eu.js";import{d as mt,c as ut,b as xt,S as pt,a as ht}from"./sheet-DahuGsa4.js";import{F as L,b as B,c as H,d as V,e as W,f as ft,a as gt}from"./form-CkEHHrgu.js";import{I as X}from"./input-zUoMTUjz.js";import{u as jt,D as vt}from"./use-delete-connection-CKYm7fJS.js";import{c as bt,C as Nt,B as yt,a as _t,b as St,d as Ct,e as wt}from"./monitoring-stats-row-BbY_q-eo.js";import{u as kt}from"./studio-tools-BAmwKCdT.js";import{u as Tt}from"./use-virtual-mcp-BcsK_V5p.js";import{i as Ce}from"./ChevronRight-Cw6r4eF5.js";import{a as we}from"./Users03-BiIAwLFR.js";import{T as ee,a as It,b as te,c as At}from"./tabs-DDAkKuLU.js";import{g as ke}from"./connection-slug-eyAPH6o3.js";import{n as Dt}from"./ZapSquare-C-BUl6mg.js";import{c as $t}from"./Tool01-MvyjXDCb.js";import{g as re,M as Pt}from"./types-DdqgwoF-.js";import{C as Ot}from"./collection-search-Yx1Vcd74.js";import{C as zt}from"./card-Dt5JuJj0.js";import{B as Mt}from"./badge-Dxlv54DZ.js";import{D as Vt,a as Et,b as Ut,c as de}from"./dropdown-menu-OVr8TMr_.js";import{d as me,b as ue,c as xe,S as pe,a as R}from"./select-svPYG6Bw.js";import{i as Ft}from"./CheckCircle-DIxU9fNb.js";import{t as Rt}from"./ChevronDown-D7t2IbgZ.js";import{n as Lt}from"./XCircle-B1aV7AX3.js";import{s as se}from"./Star01-BvLdWUOq.js";import{s as Bt}from"./XClose-9xeu7JIP.js";import"./index-DuwRwNmr.js";import"./sidebar-D5j5gPeI.js";import"./LayoutLeft-B7KWV4nT.js";import"./use-mobile-CWv_pUWp.js";import"./tooltip-D2IcwsrW.js";import"./ZoomOut-DnuKetHD.js";import"./Key01-B-V8oh6M.js";import"./auth-B9AdzGWs.js";import"./use-registry-connections-D2DhXJmA.js";import"./use-organization-settings-8LInvXec.js";import"./index-_iXFFHGt.js";import"./index-D3y2G80O.js";import"./popover-DU5qAOzi.js";import"./ChevronUp-DrHOs0IB.js";import"./SearchMd-C5JuA4Q_.js";import"./use-create-virtual-mcp-BRQVpCUG.js";import"./use-navigate-to-agent-CWpJGmq-.js";import"./Eye-CPb9WDyf.js";import"./use-org-auth-client-C3mEUOcx.js";import"./User01-TldGh0YP.js";import"./use-collections-DOhjyZoW.js";import"./AlertCircle-B7YwjVuv.js";import"./SwitchHorizontal01-fTq_Xj_0.js";import"./ArrowUpRight-DvElag-V.js";import"./ChevronLeft-DnVztwcc.js";import"./DotsVertical-p5cw6bzY.js";import"./Stars02-CZ3C1sQr.js";import"./Globe01-D51Pf1ib.js";import"./FilterLines-2uX2Gf4U.js";import"./Globe04-8CmI5zRW.js";import"./HardDrive-fBNuw9RE.js";import"./LinkExternal01-Cd3gNz9H.js";import"./Monitor01-BzxQo8OV.js";import"./Sun-DPnjEA61.js";import"./Palette-TV4PomkE.js";import"./Play-B9WHtGRe.js";import"./SearchLg-C45t9PQZ.js";import"./Shield01-BP8Krja8.js";import"./Stars01-ledCttL2.js";import"./Upload01-DvSZDpgm.js";import"./Users01-B63UEiqj.js";import"./X-D1lT84o6.js";import"./Zap-C8z5Nmtq.js";import"./label-DIdfff7-.js";import"./alert-dialog-Dv-S36Xs.js";const Ht=fe({scopes:De(le()).describe("List of scopes available"),stateSchema:Ie(le(),Ae()).describe("JSON Schema (draft-07) defining the state structure")}),Wt=[{name:"MCP_CONFIGURATION",inputSchema:fe({}),outputSchema:Ht}];function Xt(s){const e=P.c(46),{instance:n,onConfigure:a,onAuthenticate:r,onDelete:o,onToggleStatus:i}=s;let c;e[0]!==n.id?(c={connectionId:n.id},e[0]=n.id,e[1]=c):c=e[1];const l=be(c),x=!(n.connection_type==="VIRTUAL")&&l.supportsOAuth&&!l.isAuthenticated,p=n.status!=="active",d=x||p?"border-destructive/50 bg-destructive/5":"border-transparent";let f;e[2]!==d?(f=je("flex items-center gap-3 rounded-lg border px-4 py-2.5 transition-colors",d),e[2]=d,e[3]=f):f=e[3];let g;e[4]!==n.icon||e[5]!==n.title?(g=t.jsx(oe,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[4]=n.icon,e[5]=n.title,e[6]=g):g=e[6];let v;e[7]!==n.title?(v=t.jsx("p",{className:"text-sm font-medium truncate",children:n.title}),e[7]=n.title,e[8]=v):v=e[8];let b;e[9]!==n.status||e[10]!==p||e[11]!==x?(b=x?t.jsx("span",{className:"text-xs text-destructive font-medium",children:"Needs authorization"}):p?t.jsx("span",{className:"text-xs text-destructive font-medium",children:n.status==="error"?"Disabled (error)":"Disabled"}):null,e[9]=n.status,e[10]=p,e[11]=x,e[12]=b):b=e[12];let j;e[13]!==v||e[14]!==b?(j=t.jsxs("div",{className:"flex-1 min-w-0",children:[v,b]}),e[13]=v,e[14]=b,e[15]=j):j=e[15];let N;e[16]!==n||e[17]!==x||e[18]!==r?(N=x&&t.jsx(E,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>r(n),children:"Authorize"}),e[16]=n,e[17]=x,e[18]=r,e[19]=N):N=e[19];let T;e[20]!==n||e[21]!==p||e[22]!==i?(T=p?t.jsxs(E,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5",onClick:()=>i(n,"active"),children:[t.jsx(at,{size:13}),"Enable"]}):t.jsx(E,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:()=>i(n,"inactive"),title:"Disable",children:t.jsx(rt,{size:13})}),e[20]=n,e[21]=p,e[22]=i,e[23]=T):T=e[23];let C;e[24]!==n||e[25]!==a?(C=()=>a(n),e[24]=n,e[25]=a,e[26]=C):C=e[26];let y;e[27]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx(Se,{size:13}),e[27]=y):y=e[27];let I;e[28]!==C?(I=t.jsx(E,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:C,title:"Configure",children:y}),e[28]=C,e[29]=I):I=e[29];let _;e[30]!==n||e[31]!==o?(_=()=>o(n),e[30]=n,e[31]=o,e[32]=_):_=e[32];let k;e[33]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(ae,{size:13}),e[33]=k):k=e[33];let S;e[34]!==_?(S=t.jsx(E,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:_,title:"Delete",children:k}),e[34]=_,e[35]=S):S=e[35];let h;e[36]!==I||e[37]!==S||e[38]!==N||e[39]!==T?(h=t.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[N,T,I,S]}),e[36]=I,e[37]=S,e[38]=N,e[39]=T,e[40]=h):h=e[40];let w;return e[41]!==h||e[42]!==f||e[43]!==g||e[44]!==j?(w=t.jsxs("div",{className:f,children:[g,j,h]}),e[41]=h,e[42]=f,e[43]=g,e[44]=j,e[45]=w):w=e[45],w}function qt(s){const e=P.c(15),{instance:n,onConfigure:a}=s;let r;e[0]!==n.icon||e[1]!==n.title?(r=t.jsx(oe,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[0]=n.icon,e[1]=n.title,e[2]=r):r=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 i;e[5]!==n||e[6]!==a?(i=()=>a(n),e[5]=n,e[6]=a,e[7]=i):i=e[7];let c;e[8]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(Se,{size:13}),e[8]=c):c=e[8];let l;e[9]!==i?(l=t.jsx("div",{className:"flex items-center gap-1 shrink-0",children:t.jsx(E,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:i,title:"Configure",children:c})}),e[9]=i,e[10]=l):l=e[10];let u;return e[11]!==r||e[12]!==o||e[13]!==l?(u=t.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-transparent px-4 py-2.5 transition-colors",children:[r,o,l]}),e[11]=r,e[12]=o,e[13]=l,e[14]=u):u=e[14],u}function Gt(s){const e=P.c(27),{instances:n,onConfigure:a,onAuthenticate:r,onDelete:o,onToggleStatus:i,onAdd:c,isAdding:l}=s;if(n.length===0)return null;const u=n.length===1?"Instance":"Instances";let x;e[0]!==u?(x=t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:u}),e[0]=u,e[1]=x):x=e[1];let p;e[2]!==l?(p=l?t.jsx(ge,{size:13,className:"animate-spin"}):t.jsx(it,{size:13}),e[2]=l,e[3]=p):p=e[3];let d;e[4]!==l||e[5]!==c||e[6]!==p?(d=t.jsxs(E,{variant:"default",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:c,disabled:l,children:[p,"Add instance"]}),e[4]=l,e[5]=c,e[6]=p,e[7]=d):d=e[7];let f;e[8]!==x||e[9]!==d?(f=t.jsxs("div",{className:"px-5 py-4 border-b border-border flex items-center justify-between",children:[x,d]}),e[8]=x,e[9]=d,e[10]=f):f=e[10];let g;if(e[11]!==n||e[12]!==r||e[13]!==a||e[14]!==o||e[15]!==i){let j;e[17]!==r||e[18]!==a||e[19]!==o||e[20]!==i?(j=N=>t.jsx(G.Suspense,{fallback:t.jsx(qt,{instance:N,onConfigure:a}),children:t.jsx(Xt,{instance:N,onConfigure:a,onAuthenticate:r,onDelete:o,onToggleStatus:i})},N.id),e[17]=r,e[18]=a,e[19]=o,e[20]=i,e[21]=j):j=e[21],g=n.map(j),e[11]=n,e[12]=r,e[13]=a,e[14]=o,e[15]=i,e[16]=g}else g=e[16];let v;e[22]!==g?(v=t.jsx("div",{className:"p-2 flex flex-col gap-1",children:g}),e[22]=g,e[23]=v):v=e[23];let b;return e[24]!==f||e[25]!==v?(b=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[f,v]}),e[24]=f,e[25]=v,e[26]=b):b=e[26],b}const Kt=[{value:"7d",label:"7d"},{value:"14d",label:"14d"},{value:"30d",label:"30d"}];function Qt(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 Jt={calls:{label:"Tool calls"},errors:{label:"Errors"}};function Yt(s){const e=P.c(1),{connectionId:n,orgId:a,timeframe:r}=s,o=kt(),i=Qt(r),{data:c}=$e({queryKey:ne.connectionActivity(n,r,a),queryFn:async()=>await o.call("MONITORING_LOGS_LIST",{startDate:i.startDate.toISOString(),endDate:i.endDate.toISOString(),connectionId:n,limit:2e3,offset:0}),staleTime:3e5}),l=bt(c?.logs??[],i),u=l.data,x=l.totalCalls>0;let p;return e[0]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Tool calls"}),e[0]=p):p=e[0],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:l.totalCalls.toLocaleString()}),p]}),l.totalErrors>0&&t.jsxs("div",{children:[t.jsx("p",{className:"text-2xl font-semibold text-destructive tabular-nums",children:l.totalErrors.toLocaleString()}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Errors"})]}),l.avgDurationMs>0&&t.jsxs("div",{children:[t.jsxs("p",{className:"text-2xl font-semibold text-foreground tabular-nums",children:[Math.round(l.avgDurationMs),"ms"]}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Avg latency"})]})]}),x?t.jsxs("div",{children:[t.jsx(Nt,{config:Jt,className:"h-16 w-full",children:t.jsxs(yt,{data:u,barCategoryGap:"4%",children:[t.jsx(_t,{content:t.jsx(St,{labelFormatter:es}),cursor:{fill:"var(--muted)"}}),t.jsx(Ct,{dataKey:"calls",radius:[2,2,0,0],minPointSize:1,children:u.map(Zt)})]})}),t.jsxs("div",{className:"flex justify-between px-3 mt-1 pb-3",children:[t.jsx("span",{className:"text-[10px] text-muted-foreground",children:u[0]?.label}),t.jsx("span",{className:"text-[10px] text-muted-foreground",children:u[u.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 Zt(s,e){return t.jsx(wt,{fill:s.errorRate>50?"var(--destructive)":"var(--chart-1)",fillOpacity:s.calls===0?.2:s.errorRate>50?.7:.85},`cell-${e}`)}function es(s,e){const n=Array.isArray(e)?e[0]:void 0;return n&&typeof n=="object"&&"payload"in n?n.payload?.label??"":""}function ts(){const s=P.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 ss(s){const e=P.c(13),{connectionId:n}=s,[a,r]=G.useState("14d"),{org:o}=J();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Activity"})}),e[0]=i):i=e[0];let c;e[1]!==a?(c=Kt.map(d=>t.jsx("button",{type:"button",onClick:()=>r(d.value),className:je("px-2.5 py-1 text-xs font-medium rounded-md transition-colors",a===d.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:d.label},d.value)),e[1]=a,e[2]=c):c=e[2];let l;e[3]!==c?(l=t.jsxs("div",{className:"px-5 py-4 flex items-center justify-between",children:[i,t.jsx("div",{className:"flex items-center gap-0.5 bg-muted rounded-lg p-0.5",children:c})]}),e[3]=c,e[4]=l):l=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(ts,{}),e[5]=u):u=e[5];let x;e[6]!==n||e[7]!==o.id||e[8]!==a?(x=t.jsx(G.Suspense,{fallback:u,children:t.jsx(Yt,{connectionId:n,orgId:o.id,timeframe:a})}),e[6]=n,e[7]=o.id,e[8]=a,e[9]=x):x=e[9];let p;return e[10]!==l||e[11]!==x?(p=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[l,x]}),e[10]=l,e[11]=x,e[12]=p):p=e[12],p}function ns(s){const e=P.c(15),{virtualMcp:n,org:a}=s,r=Y();let o;e[0]!==r||e[1]!==a||e[2]!==n.id?(o=()=>{const p=crypto.randomUUID();r({to:"/$org/$taskId",params:{org:a,taskId:p},search:{virtualmcpid:n.id}})},e[0]=r,e[1]=a,e[2]=n.id,e[3]=o):o=e[3];let i;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(we,{size:16}),e[4]=i):i=e[4];let c;e[5]!==n.icon||e[6]!==n.title?(c=t.jsx(oe,{icon:n.icon,name:n.title,size:"xs",fallbackIcon:i}),e[5]=n.icon,e[6]=n.title,e[7]=c):c=e[7];let l;e[8]!==n.title?(l=t.jsx("span",{className:"flex-1 text-sm font-medium text-foreground truncate",children:n.title}),e[8]=n.title,e[9]=l):l=e[9];let u;e[10]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(Ce,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors shrink-0"}),e[10]=u):u=e[10];let x;return e[11]!==o||e[12]!==c||e[13]!==l?(x=t.jsxs("button",{type:"button",onClick:o,className:"flex items-center gap-3 rounded-lg hover:bg-muted/50 transition-colors group text-left w-full",children:[c,l,u]}),e[11]=o,e[12]=c,e[13]=l,e[14]=x):x=e[14],x}function os(s){const e=P.c(7),{virtualMcps:n,org:a}=s;let r;if(e[0]!==a||e[1]!==n){let i;e[3]!==a?(i=c=>t.jsx(ns,{virtualMcp:c,org:a},c.id),e[3]=a,e[4]=i):i=e[4],r=n.map(i),e[0]=a,e[1]=n,e[2]=r}else r=e[2];let o;return e[5]!==r?(o=t.jsx("div",{className:"flex flex-col gap-3",children:t.jsx("div",{className:"flex flex-col gap-2",children:r})}),e[5]=r,e[6]=o):o=e[6],o}function is(s){const e=P.c(7),{connection:n}=s,{org:a}=J();let r;e[0]!==n.id?(r={filters:[{column:"connection_id",value:n.id}]},e[0]=n.id,e[1]=r):r=e[1];const o=Tt(r);if(!(o.length>0)){let u;return e[2]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(t.Fragment,{}),e[2]=u):u=e[2],u}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 l;return e[4]!==a.slug||e[5]!==o?(l=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(os,{virtualMcps:o,org:a.slug})})]}),e[4]=a.slug,e[5]=o,e[6]=l):l=e[6],l}function as(s){const e=P.c(31),{tools:n,connectionId:a,org:r}=s,o=Y(),{org:i}=J();let c;e[0]!==a||e[1]!==i.id||e[2]!==i.slug?(c={connectionId:a,orgId:i.id,orgSlug:i.slug},e[0]=a,e[1]=i.id,e[2]=i.slug,e[3]=c):c=e[3];const l=_e(c),u=Ne(a);let x;e[4]!==u||e[5]!==a?(x=u?ke(u):a,e[4]=u,e[5]=a,e[6]=x):x=e[6];const p=x,[d,f]=G.useState("");let g,v,b,j;if(e[7]!==p||e[8]!==l||e[9]!==o||e[10]!==r||e[11]!==d||e[12]!==n){const C=(n??[]).filter(rs),y=d.toLowerCase().trim(),I=y?C.filter(h=>h.name.toLowerCase().includes(y)||h.description&&h.description.toLowerCase().includes(y)):C;let _;e[17]!==p||e[18]!==o||e[19]!==r?(_=h=>{o({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:r,appSlug:p,collectionName:"tools",itemId:encodeURIComponent(h.name)}})},e[17]=p,e[18]=o,e[19]=r,e[20]=_):_=e[20];const k=_;b="flex flex-col h-full overflow-hidden";let S;e[21]===Symbol.for("react.memo_cache_sentinel")?(S=h=>{h.key==="Escape"&&(f(""),h.target.blur())},e[21]=S):S=e[21],e[22]!==d?(j=t.jsx(Ot,{value:d,onChange:f,placeholder:"Search apps...",onKeyDown:S}),e[22]=d,e[23]=j):j=e[23],g="flex-1 overflow-auto p-5",v=I.length===0?t.jsx(ve,{image:null,title:d?"No apps found":"No apps available",description:d?"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:I.map(h=>{const w=re(h._meta);return t.jsxs(zt,{className:"cursor-pointer transition-colors overflow-hidden gap-0",onClick:()=>k(h),children:[t.jsx("div",{className:"h-[200px] overflow-hidden border-b border-border",children:t.jsx(Pt,{resourceURI:w,toolInfo:{tool:h},displayMode:"inline",minHeight:200,maxHeight:200,client:l})}),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(Je,{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[7]=p,e[8]=l,e[9]=o,e[10]=r,e[11]=d,e[12]=n,e[13]=g,e[14]=v,e[15]=b,e[16]=j}else g=e[13],v=e[14],b=e[15],j=e[16];let N;e[24]!==g||e[25]!==v?(N=t.jsx("div",{className:g,children:v}),e[24]=g,e[25]=v,e[26]=N):N=e[26];let T;return e[27]!==b||e[28]!==j||e[29]!==N?(T=t.jsxs("div",{className:b,children:[j,N]}),e[27]=b,e[28]=j,e[29]=N,e[30]=T):T=e[30],T}function rs(s){return!!re(s._meta)}function Te(s){const e=s.replace(/[._]/g," ").trim().split(/\s+/),n=i=>i.charAt(0).toUpperCase()+i.slice(1),a=new Set(["list","create","get","update","delete","fetch","search","run","trigger","review","send","check"]),r=e.map(n),o=e[e.length-1];return r.length>=2&&o&&a.has(o)?[r.pop(),...r].join(" "):r.join(" ")}function ie(s){const e=P.c(2),{label:n}=s;let a;return e[0]!==n?(a=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]=a):a=e[1],a}function ls(s){const e=P.c(50),{tools:n,prompts:a,resources:r,connectionId:o,org:i}=s;let c;e[0]!==a?(c=a===void 0?[]:a,e[0]=a,e[1]=c):c=e[1];const l=c;let u;e[2]!==r?(u=r===void 0?[]:r,e[2]=r,e[3]=u):u=e[3];const x=u,p=Y(),d=Ne(o??"");let f;e[4]!==d||e[5]!==o?(f=d?ke(d):o,e[4]=d,e[5]=o,e[6]=f):f=e[6];const g=f;let v;e[7]!==g||e[8]!==o||e[9]!==p||e[10]!==i?(v=function(D){!o||!i||p({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:i,appSlug:g,collectionName:"tools",itemId:encodeURIComponent(D)}})},e[7]=g,e[8]=o,e[9]=p,e[10]=i,e[11]=v):v=e[11];const b=v;let j;e[12]!==o||e[13]!==i||e[14]!==n?(j=o&&i&&n.some(ms),e[12]=o,e[13]=i,e[14]=n,e[15]=j):j=e[15];const N=j;if(n.length+l.length+x.length===0){let m;return e[16]===Symbol.for("react.memo_cache_sentinel")?(m=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]=m):m=e[16],m}let C;e[17]!==n.length?(C=t.jsxs(ee,{value:"tools",variant:"underline",children:["Tools (",n.length,")"]}),e[17]=n.length,e[18]=C):C=e[18];let y;e[19]!==N?(y=N&&t.jsx(ee,{value:"apps",variant:"underline",children:"UI"}),e[19]=N,e[20]=y):y=e[20];let I,_;e[21]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx(ee,{value:"prompts",variant:"underline",children:"Prompts"}),_=t.jsx(ee,{value:"resources",variant:"underline",children:"Resources"}),e[21]=I,e[22]=_):(I=e[21],_=e[22]);let k;e[23]!==C||e[24]!==y?(k=t.jsx("div",{className:"px-5 flex items-center justify-between border-b border-border",children:t.jsxs(It,{variant:"underline",className:"gap-1",children:[C,y,I,_]})}),e[23]=C,e[24]=y,e[25]=k):k=e[25];let S;e[26]!==b||e[27]!==n?(S=n.length>0?n.map(m=>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:()=>b(m.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($t,{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:Te(m.name)}),m.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:m.description})]}),t.jsx(Ce,{size:16,className:"text-muted-foreground shrink-0 mt-0.5"})]},m.name)):t.jsx(ie,{label:"tools"}),e[26]=b,e[27]=n,e[28]=S):S=e[28];let h;e[29]!==S?(h=t.jsx(te,{value:"tools",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:S})}),e[29]=S,e[30]=h):h=e[30];let w;e[31]!==o||e[32]!==N||e[33]!==i||e[34]!==n?(w=N&&t.jsx(te,{value:"apps",className:"h-auto min-h-[200px]",children:t.jsx(as,{tools:n,connectionId:o,org:i})}),e[31]=o,e[32]=N,e[33]=i,e[34]=n,e[35]=w):w=e[35];let z;e[36]!==l?(z=l.length>0?l.map(ds):t.jsx(ie,{label:"prompts"}),e[36]=l,e[37]=z):z=e[37];let O;e[38]!==z?(O=t.jsx(te,{value:"prompts",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:z})}),e[38]=z,e[39]=O):O=e[39];let A;e[40]!==x?(A=x.length>0?x.map(cs):t.jsx(ie,{label:"resources"}),e[40]=x,e[41]=A):A=e[41];let M;e[42]!==A?(M=t.jsx(te,{value:"resources",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:A})}),e[42]=A,e[43]=M):M=e[43];let U;return e[44]!==k||e[45]!==h||e[46]!==w||e[47]!==O||e[48]!==M?(U=t.jsx("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:t.jsxs(At,{defaultValue:"tools",variant:"underline",children:[k,h,w,O,M]})}),e[44]=k,e[45]=h,e[46]=w,e[47]=O,e[48]=M,e[49]=U):U=e[49],U}function cs(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(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: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 ds(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:Te(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 ms(s){return re(s._meta)}function us(s){const e=P.c(13),{connection:n,displayTitle:a}=s,r=a??n.title;let o;e[0]!==n.icon||e[1]!==r?(o=t.jsx(oe,{icon:n.icon,name:r,size:"xl",className:"shrink-0"}),e[0]=n.icon,e[1]=r,e[2]=o):o=e[2];let i;e[3]!==r?(i=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:r})}),e[3]=r,e[4]=i):i=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 l;e[7]!==i||e[8]!==c?(l=t.jsxs("div",{className:"flex-1 min-w-0",children:[i,c]}),e[7]=i,e[8]=c,e[9]=l):l=e[9];let u;return e[10]!==o||e[11]!==l?(u=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,l]}),e[10]=o,e[11]=l,e[12]=u):u=e[12],u}function xs({form:s,connection:e,hasOAuthToken:n,onReauthenticate:a,onRemoveOAuth:r}){const o=ce({control:s.control,name:"ui_type"}),i=ce({control:s.control,name:"connection_url"}),{stdioEnabled:c}=Pe(),l=(()=>{if(typeof i!="string"||!i)return!1;try{const d=new URL(i);return d.hostname==="api.githubcopilot.com"&&d.pathname.replace(/\/+$/,"")==="/mcp"}catch{return!1}})(),u=c||e.connection_type==="STDIO",x=e.connection_type==="VIRTUAL",p=x?Oe(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(we,{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:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{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(me,{value:d.value,onValueChange:d.onChange,children:[t.jsx(V,{children:t.jsxs(ue,{className:"h-full! w-auto min-w-[90px] border-0 rounded-none bg-muted/50 focus:ring-0 focus:ring-offset-0",children:[t.jsx(se,{className:"w-4 h-4 text-muted-foreground shrink-0"}),t.jsx(xe,{})]})}),t.jsxs(pe,{children:[t.jsx(R,{value:"HTTP",children:"HTTP"}),t.jsx(R,{value:"SSE",children:"SSE"}),t.jsx(R,{value:"Websocket",children:"Websocket"}),u&&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(B,{className:"flex-1 min-w-0",children:t.jsx(V,{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(me,{value:d.value,onValueChange:d.onChange,children:[t.jsx(V,{children:t.jsx(ue,{className:"h-10",children:t.jsx(xe,{})})}),t.jsxs(pe,{children:[t.jsx(R,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(R,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(R,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"Websocket"]})}),u&&t.jsxs(t.Fragment,{children:[t.jsx(R,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Lt,{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(ct,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(W,{})]})}),o==="NPX"&&t.jsx(L,{control:s.control,name:"npx_package",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"NPM Package"}),t.jsx(V,{children:t.jsx(X,{placeholder:"@perplexity-ai/mcp-server",...d,value:d.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})}),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:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Command"}),t.jsx(V,{children:t.jsx(X,{placeholder:"node, bun, python...",...d,value:d.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})}),t.jsx(L,{control:s.control,name:"stdio_args",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Arguments"}),t.jsx(V,{children:t.jsx(X,{placeholder:"arg1 arg2 --flag value",...d,value:d.value||"",className:"h-10 rounded-lg"})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Space-separated arguments"}),t.jsx(W,{})]})})]}),t.jsx(L,{control:s.control,name:"stdio_cwd",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Working Directory"}),t.jsx(V,{children:t.jsx(X,{placeholder:"/path/to/project (optional)",...d,value:d.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})})]}),(o==="NPX"||o==="STDIO")&&t.jsx(L,{control:s.control,name:"env_vars",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Environment Variables"}),t.jsx(V,{children:t.jsx(Be,{value:d.value??[],onChange:d.onChange})}),t.jsx(W,{})]})}),o!=="NPX"&&o!=="STDIO"&&t.jsx(L,{control:s.control,name:"connection_token",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:l?"GitHub Personal Access Token":"Token"}),n?t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(Vt,{children:[t.jsx(Et,{asChild:!0,children:t.jsx("button",{type:"button",className:"inline-flex items-center gap-1.5 cursor-pointer",children:t.jsxs(Mt,{variant:"success",className:"gap-1.5",children:[t.jsx(Ft,{size:12}),"Authenticated via OAuth",t.jsx(Rt,{size:12})]})})}),t.jsxs(Ut,{align:"start",children:[t.jsxs(de,{onClick:a,children:[t.jsx(dt,{size:16}),"Re-authenticate"]}),t.jsxs(de,{variant:"destructive",onClick:r,children:[t.jsx(ae,{size:16}),"Remove OAuth"]})]})]})}):e.connection_token&&d.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:()=>d.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(Bt,{size:14,className:"text-muted-foreground"})})]}):t.jsxs(t.Fragment,{children:[t.jsx(V,{children:t.jsx(X,{type:"password",placeholder:l?"Paste your GitHub PAT":"Enter access token...",...d,value:d.value||"",className:"h-10 rounded-lg"})}),l&&t.jsxs(ft,{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(W,{})]})})]})}function ps(s){return s.command==="npx"}function hs(s){return s.args?.find(e=>!e.startsWith("-"))??""}function fs(s){return{command:s.command,args:s.args?.join(" ")??"",cwd:s.cwd??""}}function he(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"&&Re(s.connection_headers)){const a=s.connection_headers,r=We(a.envVars);if(ps(a)){const i=hs(a);return{...n,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:i,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:r}}const o=fs(a);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:r}}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 gs(s){let e,n=null,a=null,r=null;return s.ui_type==="NPX"?(e="STDIO",n="",r=Xe(s.npx_package||"",s.env_vars||[])):s.ui_type==="STDIO"?(e="STDIO",n="",r=qe(s.stdio_command||"",s.stdio_args||"",s.stdio_cwd,s.env_vars||[])):(e=s.ui_type,n=s.connection_url||"",a=s.connection_token||null),{title:s.title,description:s.description||null,icon:s.icon??null,connection_type:e,connection_url:n,...a&&{connection_token:a},...r&&{connection_headers:r},configuration_state:s.configuration_state??null,configuration_scopes:s.configuration_scopes??null}}function js({connection:s,connectionId:e,org:n,isUpdating:a,tools:r,prompts:o,resources:i,siblings:c}){const l=Y({from:"/$org/settings/connections/$appSlug"}),u=Ee(),x=ye(),{org:p}=J(),d=jt({onSuccess:()=>{c.length<=1&&l({to:"/$org/settings/connections",params:{org:n}})}}),[f,g]=G.useState(null),[v,b]=G.useState(!1),j=be({connectionId:e}),{data:N}=Ye(),T=N?.data?.members??[],C=f??s,y=T.find(m=>m.userId===C.created_by),_=s?.connection_type==="VIRTUAL"||j.isAuthenticated,k={...s,tools:r},S=Ge(k,Wt),h=Ue({resolver:Fe(He),values:he(f??s)}),w=h.formState.isDirty,z=async()=>{if(!await h.trigger())return;const D=h.getValues(),$=gs(D),F=f?.id??e;await x.update.mutateAsync({id:F,data:$}),h.reset(D)},O=()=>{h.reset(he(f??s))},A=async m=>{const{token:D,tokenInfo:$,error:F}=await ot({connectionId:m,orgSlug:p.slug,scope:"offline_access"});if(F||!D){q.error(`Authentication failed: ${F}`);return}if($)try{const K=await fetch(`/api/${p.slug}/connections/${m}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:$.accessToken,refreshToken:$.refreshToken,expiresIn:$.expiresIn,scope:$.scope,clientId:$.clientId,clientSecret:$.clientSecret,tokenEndpoint:$.tokenEndpoint})});if(!K.ok)console.error("Failed to save OAuth token:",await K.text()),await x.update.mutateAsync({id:m,data:{connection_token:D}});else try{await x.update.mutateAsync({id:m,data:{}})}catch(Z){console.warn("Failed to refresh connection tools after OAuth:",Z)}}catch(K){console.error("Error saving OAuth token:",K),await x.update.mutateAsync({id:m,data:{connection_token:D}})}else await x.update.mutateAsync({id:m,data:{connection_token:D}});const Q=new URL(`/api/${p.slug}/mcp/${m}`,window.location.origin);await u.invalidateQueries({queryKey:ne.isMCPAuthenticated(Q.href,null)}),await u.invalidateQueries({queryKey:ne.mcpClientPrefix()}),q.success("Authentication successful")},M=()=>A(s.id),U=async()=>{try{const m=await fetch(`/api/${p.slug}/connections/${s.id}/oauth-token`,{method:"DELETE",credentials:"include"});if(!m.ok){const $=await m.text();q.error(`Failed to remove OAuth: ${$}`);return}const D=new URL(`/api/${p.slug}/mcp/${s.id}`,window.location.origin);await u.invalidateQueries({queryKey:ne.isMCPAuthenticated(D.href,null)}),q.success("OAuth removed. You can now re-authenticate with a different account.")}catch(m){console.error("Error removing OAuth token:",m),q.error("Failed to remove OAuth")}};return t.jsxs(t.Fragment,{children:[t.jsx(vt,{...d}),t.jsx(mt,{open:f!==null,onOpenChange:m=>{m||g(null)},children:t.jsxs(ut,{side:"right",className:"sm:max-w-[520px] p-0 flex flex-col gap-0 overflow-hidden",children:[t.jsxs(xt,{className:"px-4 py-3 md:px-6 md:py-4 border-b border-border shrink-0",children:[t.jsx(pt,{className:"text-base",children:f?.title??s.title}),t.jsx(ht,{className:"text-xs",children:"Update URL, authentication, and other settings"}),y&&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(Ze,{url:y.user?.image??void 0,fallback:y.user?.name??y.user?.email??"?",size:"3xs",shape:"circle"}),t.jsx("span",{className:"text-xs font-medium text-foreground",children:y.user?.name||y.user?.email})]})]}),t.jsxs(gt,{...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(B,{children:[t.jsx(H,{children:"Name"}),t.jsx(V,{children:t.jsx(X,{...m})}),t.jsx(W,{})]})}),t.jsx(L,{control:h.control,name:"description",render:({field:m})=>t.jsxs(B,{children:[t.jsx(H,{children:"Description"}),t.jsx(V,{children:t.jsx(X,{...m,value:m.value||""})}),t.jsx(W,{})]})})]}),t.jsx(xs,{form:h,connection:f??s,hasOAuthToken:j.hasOAuthToken,onReauthenticate:M,onRemoveOAuth:U}),t.jsx(Ke,{connection:f??s,form:h,hasMcpBinding:S,isMCPAuthenticated:_,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(E,{onClick:z,disabled:!w||a,className:"flex-1",children:a?"Saving…":"Save changes"}),w&&t.jsx(E,{variant:"outline",onClick:O,children:"Undo"}),t.jsxs(E,{variant:"outline",className:"gap-2 text-muted-foreground hover:text-destructive hover:border-destructive",onClick:()=>{const m=f??s;g(null),d.requestDelete(m)},children:[t.jsx(ae,{size:15}),"Delete"]})]})]},f?.id??s.id)]})}),t.jsx(Qe,{hideHeader:!0,children:t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[t.jsx(us,{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(ss,{connectionId:e}),t.jsxs("div",{className:"flex flex-col gap-5",children:[t.jsx(Gt,{instances:c,onConfigure:m=>g(m),onAuthenticate:m=>A(m.id),onDelete:m=>d.requestDelete(m),onToggleStatus:async(m,D)=>{try{await x.update.mutateAsync({id:m.id,data:{status:D}}),q.success(D==="active"?"Connection enabled":"Connection disabled")}catch{q.error("Failed to update connection")}},isAdding:v,onAdd:async()=>{b(!0);try{const m=c[0]??s,D=m.title.replace(/\s*\(\d+\)\s*$/,""),$=c.length+1,F=`${D} (${$})`,Q=Le("conn");await x.create.mutateAsync({id:Q,title:F,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(`/api/${p.slug}/mcp/${Q}`,window.location.origin),Z=await nt({url:K.href,token:null,orgId:p.id});Z.supportsOAuth&&!Z.isAuthenticated&&await A(Q)}finally{b(!1)}}}),t.jsx(is,{connection:s})]}),t.jsx("div",{className:"@3xl:col-span-2",children:t.jsx(ls,{tools:r,prompts:o,resources:i,connectionId:e,org:n})})]})})]})})]})}function vs(){const s=P.c(39);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/$org/settings/connections/$appSlug"},s[0]=e):e=s[0];const n=Y(e);let a;s[1]===Symbol.for("react.memo_cache_sentinel")?(a={from:"/shell/$org/settings/connections/$appSlug"},s[1]=a):a=s[1];const{appSlug:r,org:o}=Me(a),{org:i}=J(),c=ye();let l;s[2]!==r?(l={slug:r},s[2]=r,s[3]=l):l=s[3];const u=et(l),x=u[0]??null,p=x?.id??"",d=p||null;let f;s[4]!==i.id||s[5]!==i.slug||s[6]!==d?(f={connectionId:d,orgId:i.id,orgSlug:i.slug},s[4]=i.id,s[5]=i.slug,s[6]=d,s[7]=f):f=s[7];const g=_e(f);let v;s[8]!==g?(v={client:g},s[8]=g,s[9]=v):v=s[9];const{data:b}=tt(v);let j;if(s[10]!==x?.tools||s[11]!==p||s[12]!==u||s[13]!==b){const A=b?b.tools.map(Cs):(x?.tools??[]).map(Ss);e:{if(u.length<=1){j=A;break e}const M=new Set,U=[],m=ys;for(const D of u){const $=D.id===p?A:m(D.tools);for(const F of $)M.has(F.name)||(M.add(F.name),U.push(F))}j=U.length>0?U:A}s[10]=x?.tools,s[11]=p,s[12]=u,s[13]=b,s[14]=j}else j=s[14];const N=j;let T;s[15]!==g?(T={client:g},s[15]=g,s[16]=T):T=s[16];const{data:C}=st(T);let y;s[17]!==g?(y={client:g},s[17]=g,s[18]=y):y=s[18];const{data:I}=Ve(y);let _;s[19]!==C?.prompts?(_=C?.prompts??[],s[19]=C?.prompts,s[20]=_):_=s[20];let k;s[21]!==_?(k=_.map(Ns),s[21]=_,s[22]=k):k=s[22];const S=k;let h;s[23]!==I?.resources?(h=I?.resources??[],s[23]=I?.resources,s[24]=h):h=s[24];let w;s[25]!==h?(w=h.map(bs),s[25]=h,s[26]=w):w=s[26];const z=w;if(!x){let A;return s[27]!==n||s[28]!==o?(A=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(ve,{title:"Connection not found",description:"This connection may have been deleted or you may not have access.",actions:t.jsx(E,{variant:"outline",onClick:()=>n({to:"/$org/settings/connections",params:{org:o}}),children:"Back to connections"})})}),s[27]=n,s[28]=o,s[29]=A):A=s[29],A}let O;return s[30]!==c.update.isPending||s[31]!==N||s[32]!==x||s[33]!==p||s[34]!==o||s[35]!==S||s[36]!==z||s[37]!==u?(O=t.jsx(js,{org:o,connection:x,connectionId:p,isUpdating:c.update.isPending,tools:N,prompts:S,resources:z,siblings:u}),s[30]=c.update.isPending,s[31]=N,s[32]=x,s[33]=p,s[34]=o,s[35]=S,s[36]=z,s[37]=u,s[38]=O):O=s[38],O}function bs(s){return{name:s.name,description:s.description,uri:s.uri}}function Ns(s){return{name:s.name,description:s.description}}function ys(s){return(s??[]).map(_s)}function _s(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema??{},outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function Ss(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function Cs(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function ws(){const s=P.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(ze,{children:t.jsx(G.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:t.jsx(ge,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(vs,{})})}),s[0]=e):e=s[0],e}function ro(){const s=P.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(ws,{}),s[0]=e):e=s[0],e}export{ro as default};
|
|
1
|
+
import{o as fe,aF as Ie,b7 as Ae,s as le,aD as De,c as P,j as t,i as ge,B as E,r as G,l as je,D as J,q as $e,K as ne,b as Y,ab as ce,z as Pe,b8 as Oe,E as ze,e as Me,b9 as Ve,m as Ee,p as Ue,n as Fe,t as q,ba as Re}from"./index-BlbGtC1U.js";import{a as Le}from"./extract-connection-data-DumI9Ge5.js";import{E as ve}from"./empty-state-pCesbyUM.js";import{E as Be,c as He,r as We,b as Xe,d as qe}from"./connection-form-helpers-CF-WQyTc.js";import{c as Ge,S as Ke,V as Qe}from"./index-CCANgKdB.js";import{u as be,T as Je}from"./index-CsOdgboE.js";import{u as Ye}from"./use-members-CDV7-ikh.js";import{A as Ze}from"./avatar-VZM5i0Ki.js";import{a as Ne,b as ye,u as et}from"./use-connection-BaK7gZK8.js";import{u as _e}from"./use-mcp-client-BYcrk6lz.js";import{a as tt}from"./use-mcp-tools-DYc-d8kf.js";import{a as st}from"./use-mcp-prompts-BjyIsgXC.js";import{i as nt,a as ot}from"./mcp-oauth-D8vUJRgp.js";import{I as oe}from"./integration-icon-m4V5ew5R.js";import{s as it}from"./Plus-Bi8BbQwT.js";import{B as at,D as rt,aj as lt,a8 as ct}from"./agent-icon-C1dYfmgT.js";import{a as Se,s as dt}from"./Settings02-C-qi4-Q_.js";import{s as ae}from"./Trash01-CbqEHpx0.js";import{d as mt,c as ut,b as xt,S as pt,a as ht}from"./sheet-C2Kfge9r.js";import{F as L,b as B,c as H,d as V,e as W,f as ft,a as gt}from"./form--KUjsjlO.js";import{I as X}from"./input-DHDgjmX0.js";import{u as jt,D as vt}from"./use-delete-connection-IE5Qqa0Q.js";import{c as bt,C as Nt,B as yt,a as _t,b as St,d as Ct,e as wt}from"./monitoring-stats-row-CuYST9yW.js";import{u as kt}from"./studio-tools-7mZABBZl.js";import{u as Tt}from"./use-virtual-mcp-Bkiriz_M.js";import{i as Ce}from"./ChevronRight-CKc4NZet.js";import{a as we}from"./Users03-BkBCkWQn.js";import{T as ee,a as It,b as te,c as At}from"./tabs-nJ0qk72w.js";import{g as ke}from"./connection-slug-eyAPH6o3.js";import{n as Dt}from"./ZapSquare-hkjSQWO8.js";import{c as $t}from"./Tool01-D4LA61If.js";import{g as re,M as Pt}from"./types-DZM3oHCm.js";import{C as Ot}from"./collection-search-C4TcbQ-p.js";import{C as zt}from"./card-DjLKG66H.js";import{B as Mt}from"./badge-BGbD2JMR.js";import{D as Vt,a as Et,b as Ut,c as de}from"./dropdown-menu-UriF3iJ3.js";import{d as me,b as ue,c as xe,S as pe,a as R}from"./select-DxONb3Kt.js";import{i as Ft}from"./CheckCircle-p5tYLXMg.js";import{t as Rt}from"./ChevronDown-DM7Zg7z0.js";import{n as Lt}from"./XCircle-IAOWYKKA.js";import{s as se}from"./Star01-D2l7-L0I.js";import{s as Bt}from"./XClose-ChjX78ei.js";import"./index-BBWislhf.js";import"./sidebar-BjIzPMot.js";import"./LayoutLeft-y1fOcQ0I.js";import"./use-mobile-BKRfr7ic.js";import"./tooltip-oPF11xOc.js";import"./ZoomOut-DoQt1wdd.js";import"./Key01-V7SPr6j-.js";import"./auth-CPEoqZ5f.js";import"./use-registry-connections-Bgebk2mm.js";import"./use-organization-settings-ClKaDrE7.js";import"./index-S2ZDAOoZ.js";import"./index-CSUPQJzr.js";import"./popover-Do5OoBkb.js";import"./ChevronUp-uk87fvlM.js";import"./SearchMd-BkXN-Kzx.js";import"./use-create-virtual-mcp-BzfjXCKR.js";import"./use-navigate-to-agent-D_fgYk51.js";import"./Eye-BHPT57Tm.js";import"./use-org-auth-client-C2F1ILpp.js";import"./User01-Cykpl4hh.js";import"./use-collections-DZi4alPB.js";import"./AlertCircle-BJzQ1lVJ.js";import"./SwitchHorizontal01-DkcNGyLK.js";import"./ArrowUpRight-CA22UP6Q.js";import"./ChevronLeft-lcwdftXp.js";import"./DotsVertical-DXDm8Xzs.js";import"./Stars02-DC4cG_dc.js";import"./Globe01-DD63JJzL.js";import"./FilterLines-HsRbW4y-.js";import"./Globe04-CokcJjWp.js";import"./HardDrive-xu95HLc0.js";import"./LinkExternal01-DCed5R2c.js";import"./Monitor01-BKqFs8Gp.js";import"./Sun-ubimVQVz.js";import"./Palette-DkcZCW1n.js";import"./Play-CKPBuURg.js";import"./SearchLg-D0nJXyNY.js";import"./Shield01-BaBnwolv.js";import"./Stars01-CBpnmt-0.js";import"./Upload01-C_kFf8l0.js";import"./Users01-fhFCwrP8.js";import"./X-DEdLuuqP.js";import"./Zap-DE8YfoLa.js";import"./label-PsbKXPB5.js";import"./alert-dialog-DZvgeli3.js";const Ht=fe({scopes:De(le()).describe("List of scopes available"),stateSchema:Ie(le(),Ae()).describe("JSON Schema (draft-07) defining the state structure")}),Wt=[{name:"MCP_CONFIGURATION",inputSchema:fe({}),outputSchema:Ht}];function Xt(s){const e=P.c(46),{instance:n,onConfigure:a,onAuthenticate:r,onDelete:o,onToggleStatus:i}=s;let c;e[0]!==n.id?(c={connectionId:n.id},e[0]=n.id,e[1]=c):c=e[1];const l=be(c),x=!(n.connection_type==="VIRTUAL")&&l.supportsOAuth&&!l.isAuthenticated,p=n.status!=="active",d=x||p?"border-destructive/50 bg-destructive/5":"border-transparent";let f;e[2]!==d?(f=je("flex items-center gap-3 rounded-lg border px-4 py-2.5 transition-colors",d),e[2]=d,e[3]=f):f=e[3];let g;e[4]!==n.icon||e[5]!==n.title?(g=t.jsx(oe,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[4]=n.icon,e[5]=n.title,e[6]=g):g=e[6];let v;e[7]!==n.title?(v=t.jsx("p",{className:"text-sm font-medium truncate",children:n.title}),e[7]=n.title,e[8]=v):v=e[8];let b;e[9]!==n.status||e[10]!==p||e[11]!==x?(b=x?t.jsx("span",{className:"text-xs text-destructive font-medium",children:"Needs authorization"}):p?t.jsx("span",{className:"text-xs text-destructive font-medium",children:n.status==="error"?"Disabled (error)":"Disabled"}):null,e[9]=n.status,e[10]=p,e[11]=x,e[12]=b):b=e[12];let j;e[13]!==v||e[14]!==b?(j=t.jsxs("div",{className:"flex-1 min-w-0",children:[v,b]}),e[13]=v,e[14]=b,e[15]=j):j=e[15];let N;e[16]!==n||e[17]!==x||e[18]!==r?(N=x&&t.jsx(E,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>r(n),children:"Authorize"}),e[16]=n,e[17]=x,e[18]=r,e[19]=N):N=e[19];let T;e[20]!==n||e[21]!==p||e[22]!==i?(T=p?t.jsxs(E,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5",onClick:()=>i(n,"active"),children:[t.jsx(at,{size:13}),"Enable"]}):t.jsx(E,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:()=>i(n,"inactive"),title:"Disable",children:t.jsx(rt,{size:13})}),e[20]=n,e[21]=p,e[22]=i,e[23]=T):T=e[23];let C;e[24]!==n||e[25]!==a?(C=()=>a(n),e[24]=n,e[25]=a,e[26]=C):C=e[26];let y;e[27]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx(Se,{size:13}),e[27]=y):y=e[27];let I;e[28]!==C?(I=t.jsx(E,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:C,title:"Configure",children:y}),e[28]=C,e[29]=I):I=e[29];let _;e[30]!==n||e[31]!==o?(_=()=>o(n),e[30]=n,e[31]=o,e[32]=_):_=e[32];let k;e[33]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(ae,{size:13}),e[33]=k):k=e[33];let S;e[34]!==_?(S=t.jsx(E,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:_,title:"Delete",children:k}),e[34]=_,e[35]=S):S=e[35];let h;e[36]!==I||e[37]!==S||e[38]!==N||e[39]!==T?(h=t.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[N,T,I,S]}),e[36]=I,e[37]=S,e[38]=N,e[39]=T,e[40]=h):h=e[40];let w;return e[41]!==h||e[42]!==f||e[43]!==g||e[44]!==j?(w=t.jsxs("div",{className:f,children:[g,j,h]}),e[41]=h,e[42]=f,e[43]=g,e[44]=j,e[45]=w):w=e[45],w}function qt(s){const e=P.c(15),{instance:n,onConfigure:a}=s;let r;e[0]!==n.icon||e[1]!==n.title?(r=t.jsx(oe,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[0]=n.icon,e[1]=n.title,e[2]=r):r=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 i;e[5]!==n||e[6]!==a?(i=()=>a(n),e[5]=n,e[6]=a,e[7]=i):i=e[7];let c;e[8]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(Se,{size:13}),e[8]=c):c=e[8];let l;e[9]!==i?(l=t.jsx("div",{className:"flex items-center gap-1 shrink-0",children:t.jsx(E,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:i,title:"Configure",children:c})}),e[9]=i,e[10]=l):l=e[10];let u;return e[11]!==r||e[12]!==o||e[13]!==l?(u=t.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-transparent px-4 py-2.5 transition-colors",children:[r,o,l]}),e[11]=r,e[12]=o,e[13]=l,e[14]=u):u=e[14],u}function Gt(s){const e=P.c(27),{instances:n,onConfigure:a,onAuthenticate:r,onDelete:o,onToggleStatus:i,onAdd:c,isAdding:l}=s;if(n.length===0)return null;const u=n.length===1?"Instance":"Instances";let x;e[0]!==u?(x=t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:u}),e[0]=u,e[1]=x):x=e[1];let p;e[2]!==l?(p=l?t.jsx(ge,{size:13,className:"animate-spin"}):t.jsx(it,{size:13}),e[2]=l,e[3]=p):p=e[3];let d;e[4]!==l||e[5]!==c||e[6]!==p?(d=t.jsxs(E,{variant:"default",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:c,disabled:l,children:[p,"Add instance"]}),e[4]=l,e[5]=c,e[6]=p,e[7]=d):d=e[7];let f;e[8]!==x||e[9]!==d?(f=t.jsxs("div",{className:"px-5 py-4 border-b border-border flex items-center justify-between",children:[x,d]}),e[8]=x,e[9]=d,e[10]=f):f=e[10];let g;if(e[11]!==n||e[12]!==r||e[13]!==a||e[14]!==o||e[15]!==i){let j;e[17]!==r||e[18]!==a||e[19]!==o||e[20]!==i?(j=N=>t.jsx(G.Suspense,{fallback:t.jsx(qt,{instance:N,onConfigure:a}),children:t.jsx(Xt,{instance:N,onConfigure:a,onAuthenticate:r,onDelete:o,onToggleStatus:i})},N.id),e[17]=r,e[18]=a,e[19]=o,e[20]=i,e[21]=j):j=e[21],g=n.map(j),e[11]=n,e[12]=r,e[13]=a,e[14]=o,e[15]=i,e[16]=g}else g=e[16];let v;e[22]!==g?(v=t.jsx("div",{className:"p-2 flex flex-col gap-1",children:g}),e[22]=g,e[23]=v):v=e[23];let b;return e[24]!==f||e[25]!==v?(b=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[f,v]}),e[24]=f,e[25]=v,e[26]=b):b=e[26],b}const Kt=[{value:"7d",label:"7d"},{value:"14d",label:"14d"},{value:"30d",label:"30d"}];function Qt(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 Jt={calls:{label:"Tool calls"},errors:{label:"Errors"}};function Yt(s){const e=P.c(1),{connectionId:n,orgId:a,timeframe:r}=s,o=kt(),i=Qt(r),{data:c}=$e({queryKey:ne.connectionActivity(n,r,a),queryFn:async()=>await o.call("MONITORING_LOGS_LIST",{startDate:i.startDate.toISOString(),endDate:i.endDate.toISOString(),connectionId:n,limit:2e3,offset:0}),staleTime:3e5}),l=bt(c?.logs??[],i),u=l.data,x=l.totalCalls>0;let p;return e[0]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Tool calls"}),e[0]=p):p=e[0],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:l.totalCalls.toLocaleString()}),p]}),l.totalErrors>0&&t.jsxs("div",{children:[t.jsx("p",{className:"text-2xl font-semibold text-destructive tabular-nums",children:l.totalErrors.toLocaleString()}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Errors"})]}),l.avgDurationMs>0&&t.jsxs("div",{children:[t.jsxs("p",{className:"text-2xl font-semibold text-foreground tabular-nums",children:[Math.round(l.avgDurationMs),"ms"]}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Avg latency"})]})]}),x?t.jsxs("div",{children:[t.jsx(Nt,{config:Jt,className:"h-16 w-full",children:t.jsxs(yt,{data:u,barCategoryGap:"4%",children:[t.jsx(_t,{content:t.jsx(St,{labelFormatter:es}),cursor:{fill:"var(--muted)"}}),t.jsx(Ct,{dataKey:"calls",radius:[2,2,0,0],minPointSize:1,children:u.map(Zt)})]})}),t.jsxs("div",{className:"flex justify-between px-3 mt-1 pb-3",children:[t.jsx("span",{className:"text-[10px] text-muted-foreground",children:u[0]?.label}),t.jsx("span",{className:"text-[10px] text-muted-foreground",children:u[u.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 Zt(s,e){return t.jsx(wt,{fill:s.errorRate>50?"var(--destructive)":"var(--chart-1)",fillOpacity:s.calls===0?.2:s.errorRate>50?.7:.85},`cell-${e}`)}function es(s,e){const n=Array.isArray(e)?e[0]:void 0;return n&&typeof n=="object"&&"payload"in n?n.payload?.label??"":""}function ts(){const s=P.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 ss(s){const e=P.c(13),{connectionId:n}=s,[a,r]=G.useState("14d"),{org:o}=J();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Activity"})}),e[0]=i):i=e[0];let c;e[1]!==a?(c=Kt.map(d=>t.jsx("button",{type:"button",onClick:()=>r(d.value),className:je("px-2.5 py-1 text-xs font-medium rounded-md transition-colors",a===d.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:d.label},d.value)),e[1]=a,e[2]=c):c=e[2];let l;e[3]!==c?(l=t.jsxs("div",{className:"px-5 py-4 flex items-center justify-between",children:[i,t.jsx("div",{className:"flex items-center gap-0.5 bg-muted rounded-lg p-0.5",children:c})]}),e[3]=c,e[4]=l):l=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(ts,{}),e[5]=u):u=e[5];let x;e[6]!==n||e[7]!==o.id||e[8]!==a?(x=t.jsx(G.Suspense,{fallback:u,children:t.jsx(Yt,{connectionId:n,orgId:o.id,timeframe:a})}),e[6]=n,e[7]=o.id,e[8]=a,e[9]=x):x=e[9];let p;return e[10]!==l||e[11]!==x?(p=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[l,x]}),e[10]=l,e[11]=x,e[12]=p):p=e[12],p}function ns(s){const e=P.c(15),{virtualMcp:n,org:a}=s,r=Y();let o;e[0]!==r||e[1]!==a||e[2]!==n.id?(o=()=>{const p=crypto.randomUUID();r({to:"/$org/$taskId",params:{org:a,taskId:p},search:{virtualmcpid:n.id}})},e[0]=r,e[1]=a,e[2]=n.id,e[3]=o):o=e[3];let i;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(we,{size:16}),e[4]=i):i=e[4];let c;e[5]!==n.icon||e[6]!==n.title?(c=t.jsx(oe,{icon:n.icon,name:n.title,size:"xs",fallbackIcon:i}),e[5]=n.icon,e[6]=n.title,e[7]=c):c=e[7];let l;e[8]!==n.title?(l=t.jsx("span",{className:"flex-1 text-sm font-medium text-foreground truncate",children:n.title}),e[8]=n.title,e[9]=l):l=e[9];let u;e[10]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(Ce,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors shrink-0"}),e[10]=u):u=e[10];let x;return e[11]!==o||e[12]!==c||e[13]!==l?(x=t.jsxs("button",{type:"button",onClick:o,className:"flex items-center gap-3 rounded-lg hover:bg-muted/50 transition-colors group text-left w-full",children:[c,l,u]}),e[11]=o,e[12]=c,e[13]=l,e[14]=x):x=e[14],x}function os(s){const e=P.c(7),{virtualMcps:n,org:a}=s;let r;if(e[0]!==a||e[1]!==n){let i;e[3]!==a?(i=c=>t.jsx(ns,{virtualMcp:c,org:a},c.id),e[3]=a,e[4]=i):i=e[4],r=n.map(i),e[0]=a,e[1]=n,e[2]=r}else r=e[2];let o;return e[5]!==r?(o=t.jsx("div",{className:"flex flex-col gap-3",children:t.jsx("div",{className:"flex flex-col gap-2",children:r})}),e[5]=r,e[6]=o):o=e[6],o}function is(s){const e=P.c(7),{connection:n}=s,{org:a}=J();let r;e[0]!==n.id?(r={filters:[{column:"connection_id",value:n.id}]},e[0]=n.id,e[1]=r):r=e[1];const o=Tt(r);if(!(o.length>0)){let u;return e[2]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(t.Fragment,{}),e[2]=u):u=e[2],u}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 l;return e[4]!==a.slug||e[5]!==o?(l=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(os,{virtualMcps:o,org:a.slug})})]}),e[4]=a.slug,e[5]=o,e[6]=l):l=e[6],l}function as(s){const e=P.c(31),{tools:n,connectionId:a,org:r}=s,o=Y(),{org:i}=J();let c;e[0]!==a||e[1]!==i.id||e[2]!==i.slug?(c={connectionId:a,orgId:i.id,orgSlug:i.slug},e[0]=a,e[1]=i.id,e[2]=i.slug,e[3]=c):c=e[3];const l=_e(c),u=Ne(a);let x;e[4]!==u||e[5]!==a?(x=u?ke(u):a,e[4]=u,e[5]=a,e[6]=x):x=e[6];const p=x,[d,f]=G.useState("");let g,v,b,j;if(e[7]!==p||e[8]!==l||e[9]!==o||e[10]!==r||e[11]!==d||e[12]!==n){const C=(n??[]).filter(rs),y=d.toLowerCase().trim(),I=y?C.filter(h=>h.name.toLowerCase().includes(y)||h.description&&h.description.toLowerCase().includes(y)):C;let _;e[17]!==p||e[18]!==o||e[19]!==r?(_=h=>{o({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:r,appSlug:p,collectionName:"tools",itemId:encodeURIComponent(h.name)}})},e[17]=p,e[18]=o,e[19]=r,e[20]=_):_=e[20];const k=_;b="flex flex-col h-full overflow-hidden";let S;e[21]===Symbol.for("react.memo_cache_sentinel")?(S=h=>{h.key==="Escape"&&(f(""),h.target.blur())},e[21]=S):S=e[21],e[22]!==d?(j=t.jsx(Ot,{value:d,onChange:f,placeholder:"Search apps...",onKeyDown:S}),e[22]=d,e[23]=j):j=e[23],g="flex-1 overflow-auto p-5",v=I.length===0?t.jsx(ve,{image:null,title:d?"No apps found":"No apps available",description:d?"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:I.map(h=>{const w=re(h._meta);return t.jsxs(zt,{className:"cursor-pointer transition-colors overflow-hidden gap-0",onClick:()=>k(h),children:[t.jsx("div",{className:"h-[200px] overflow-hidden border-b border-border",children:t.jsx(Pt,{resourceURI:w,toolInfo:{tool:h},displayMode:"inline",minHeight:200,maxHeight:200,client:l})}),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(Je,{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[7]=p,e[8]=l,e[9]=o,e[10]=r,e[11]=d,e[12]=n,e[13]=g,e[14]=v,e[15]=b,e[16]=j}else g=e[13],v=e[14],b=e[15],j=e[16];let N;e[24]!==g||e[25]!==v?(N=t.jsx("div",{className:g,children:v}),e[24]=g,e[25]=v,e[26]=N):N=e[26];let T;return e[27]!==b||e[28]!==j||e[29]!==N?(T=t.jsxs("div",{className:b,children:[j,N]}),e[27]=b,e[28]=j,e[29]=N,e[30]=T):T=e[30],T}function rs(s){return!!re(s._meta)}function Te(s){const e=s.replace(/[._]/g," ").trim().split(/\s+/),n=i=>i.charAt(0).toUpperCase()+i.slice(1),a=new Set(["list","create","get","update","delete","fetch","search","run","trigger","review","send","check"]),r=e.map(n),o=e[e.length-1];return r.length>=2&&o&&a.has(o)?[r.pop(),...r].join(" "):r.join(" ")}function ie(s){const e=P.c(2),{label:n}=s;let a;return e[0]!==n?(a=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]=a):a=e[1],a}function ls(s){const e=P.c(50),{tools:n,prompts:a,resources:r,connectionId:o,org:i}=s;let c;e[0]!==a?(c=a===void 0?[]:a,e[0]=a,e[1]=c):c=e[1];const l=c;let u;e[2]!==r?(u=r===void 0?[]:r,e[2]=r,e[3]=u):u=e[3];const x=u,p=Y(),d=Ne(o??"");let f;e[4]!==d||e[5]!==o?(f=d?ke(d):o,e[4]=d,e[5]=o,e[6]=f):f=e[6];const g=f;let v;e[7]!==g||e[8]!==o||e[9]!==p||e[10]!==i?(v=function(D){!o||!i||p({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:i,appSlug:g,collectionName:"tools",itemId:encodeURIComponent(D)}})},e[7]=g,e[8]=o,e[9]=p,e[10]=i,e[11]=v):v=e[11];const b=v;let j;e[12]!==o||e[13]!==i||e[14]!==n?(j=o&&i&&n.some(ms),e[12]=o,e[13]=i,e[14]=n,e[15]=j):j=e[15];const N=j;if(n.length+l.length+x.length===0){let m;return e[16]===Symbol.for("react.memo_cache_sentinel")?(m=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]=m):m=e[16],m}let C;e[17]!==n.length?(C=t.jsxs(ee,{value:"tools",variant:"underline",children:["Tools (",n.length,")"]}),e[17]=n.length,e[18]=C):C=e[18];let y;e[19]!==N?(y=N&&t.jsx(ee,{value:"apps",variant:"underline",children:"UI"}),e[19]=N,e[20]=y):y=e[20];let I,_;e[21]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx(ee,{value:"prompts",variant:"underline",children:"Prompts"}),_=t.jsx(ee,{value:"resources",variant:"underline",children:"Resources"}),e[21]=I,e[22]=_):(I=e[21],_=e[22]);let k;e[23]!==C||e[24]!==y?(k=t.jsx("div",{className:"px-5 flex items-center justify-between border-b border-border",children:t.jsxs(It,{variant:"underline",className:"gap-1",children:[C,y,I,_]})}),e[23]=C,e[24]=y,e[25]=k):k=e[25];let S;e[26]!==b||e[27]!==n?(S=n.length>0?n.map(m=>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:()=>b(m.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($t,{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:Te(m.name)}),m.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:m.description})]}),t.jsx(Ce,{size:16,className:"text-muted-foreground shrink-0 mt-0.5"})]},m.name)):t.jsx(ie,{label:"tools"}),e[26]=b,e[27]=n,e[28]=S):S=e[28];let h;e[29]!==S?(h=t.jsx(te,{value:"tools",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:S})}),e[29]=S,e[30]=h):h=e[30];let w;e[31]!==o||e[32]!==N||e[33]!==i||e[34]!==n?(w=N&&t.jsx(te,{value:"apps",className:"h-auto min-h-[200px]",children:t.jsx(as,{tools:n,connectionId:o,org:i})}),e[31]=o,e[32]=N,e[33]=i,e[34]=n,e[35]=w):w=e[35];let z;e[36]!==l?(z=l.length>0?l.map(ds):t.jsx(ie,{label:"prompts"}),e[36]=l,e[37]=z):z=e[37];let O;e[38]!==z?(O=t.jsx(te,{value:"prompts",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:z})}),e[38]=z,e[39]=O):O=e[39];let A;e[40]!==x?(A=x.length>0?x.map(cs):t.jsx(ie,{label:"resources"}),e[40]=x,e[41]=A):A=e[41];let M;e[42]!==A?(M=t.jsx(te,{value:"resources",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:A})}),e[42]=A,e[43]=M):M=e[43];let U;return e[44]!==k||e[45]!==h||e[46]!==w||e[47]!==O||e[48]!==M?(U=t.jsx("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:t.jsxs(At,{defaultValue:"tools",variant:"underline",children:[k,h,w,O,M]})}),e[44]=k,e[45]=h,e[46]=w,e[47]=O,e[48]=M,e[49]=U):U=e[49],U}function cs(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(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: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 ds(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:Te(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 ms(s){return re(s._meta)}function us(s){const e=P.c(13),{connection:n,displayTitle:a}=s,r=a??n.title;let o;e[0]!==n.icon||e[1]!==r?(o=t.jsx(oe,{icon:n.icon,name:r,size:"xl",className:"shrink-0"}),e[0]=n.icon,e[1]=r,e[2]=o):o=e[2];let i;e[3]!==r?(i=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:r})}),e[3]=r,e[4]=i):i=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 l;e[7]!==i||e[8]!==c?(l=t.jsxs("div",{className:"flex-1 min-w-0",children:[i,c]}),e[7]=i,e[8]=c,e[9]=l):l=e[9];let u;return e[10]!==o||e[11]!==l?(u=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,l]}),e[10]=o,e[11]=l,e[12]=u):u=e[12],u}function xs({form:s,connection:e,hasOAuthToken:n,onReauthenticate:a,onRemoveOAuth:r}){const o=ce({control:s.control,name:"ui_type"}),i=ce({control:s.control,name:"connection_url"}),{stdioEnabled:c}=Pe(),l=(()=>{if(typeof i!="string"||!i)return!1;try{const d=new URL(i);return d.hostname==="api.githubcopilot.com"&&d.pathname.replace(/\/+$/,"")==="/mcp"}catch{return!1}})(),u=c||e.connection_type==="STDIO",x=e.connection_type==="VIRTUAL",p=x?Oe(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(we,{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:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{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(me,{value:d.value,onValueChange:d.onChange,children:[t.jsx(V,{children:t.jsxs(ue,{className:"h-full! w-auto min-w-[90px] border-0 rounded-none bg-muted/50 focus:ring-0 focus:ring-offset-0",children:[t.jsx(se,{className:"w-4 h-4 text-muted-foreground shrink-0"}),t.jsx(xe,{})]})}),t.jsxs(pe,{children:[t.jsx(R,{value:"HTTP",children:"HTTP"}),t.jsx(R,{value:"SSE",children:"SSE"}),t.jsx(R,{value:"Websocket",children:"Websocket"}),u&&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(B,{className:"flex-1 min-w-0",children:t.jsx(V,{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(me,{value:d.value,onValueChange:d.onChange,children:[t.jsx(V,{children:t.jsx(ue,{className:"h-10",children:t.jsx(xe,{})})}),t.jsxs(pe,{children:[t.jsx(R,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(R,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(R,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"Websocket"]})}),u&&t.jsxs(t.Fragment,{children:[t.jsx(R,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Lt,{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(ct,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(W,{})]})}),o==="NPX"&&t.jsx(L,{control:s.control,name:"npx_package",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"NPM Package"}),t.jsx(V,{children:t.jsx(X,{placeholder:"@perplexity-ai/mcp-server",...d,value:d.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})}),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:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Command"}),t.jsx(V,{children:t.jsx(X,{placeholder:"node, bun, python...",...d,value:d.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})}),t.jsx(L,{control:s.control,name:"stdio_args",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Arguments"}),t.jsx(V,{children:t.jsx(X,{placeholder:"arg1 arg2 --flag value",...d,value:d.value||"",className:"h-10 rounded-lg"})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Space-separated arguments"}),t.jsx(W,{})]})})]}),t.jsx(L,{control:s.control,name:"stdio_cwd",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Working Directory"}),t.jsx(V,{children:t.jsx(X,{placeholder:"/path/to/project (optional)",...d,value:d.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})})]}),(o==="NPX"||o==="STDIO")&&t.jsx(L,{control:s.control,name:"env_vars",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Environment Variables"}),t.jsx(V,{children:t.jsx(Be,{value:d.value??[],onChange:d.onChange})}),t.jsx(W,{})]})}),o!=="NPX"&&o!=="STDIO"&&t.jsx(L,{control:s.control,name:"connection_token",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:l?"GitHub Personal Access Token":"Token"}),n?t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(Vt,{children:[t.jsx(Et,{asChild:!0,children:t.jsx("button",{type:"button",className:"inline-flex items-center gap-1.5 cursor-pointer",children:t.jsxs(Mt,{variant:"success",className:"gap-1.5",children:[t.jsx(Ft,{size:12}),"Authenticated via OAuth",t.jsx(Rt,{size:12})]})})}),t.jsxs(Ut,{align:"start",children:[t.jsxs(de,{onClick:a,children:[t.jsx(dt,{size:16}),"Re-authenticate"]}),t.jsxs(de,{variant:"destructive",onClick:r,children:[t.jsx(ae,{size:16}),"Remove OAuth"]})]})]})}):e.connection_token&&d.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:()=>d.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(Bt,{size:14,className:"text-muted-foreground"})})]}):t.jsxs(t.Fragment,{children:[t.jsx(V,{children:t.jsx(X,{type:"password",placeholder:l?"Paste your GitHub PAT":"Enter access token...",...d,value:d.value||"",className:"h-10 rounded-lg"})}),l&&t.jsxs(ft,{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(W,{})]})})]})}function ps(s){return s.command==="npx"}function hs(s){return s.args?.find(e=>!e.startsWith("-"))??""}function fs(s){return{command:s.command,args:s.args?.join(" ")??"",cwd:s.cwd??""}}function he(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"&&Re(s.connection_headers)){const a=s.connection_headers,r=We(a.envVars);if(ps(a)){const i=hs(a);return{...n,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:i,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:r}}const o=fs(a);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:r}}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 gs(s){let e,n=null,a=null,r=null;return s.ui_type==="NPX"?(e="STDIO",n="",r=Xe(s.npx_package||"",s.env_vars||[])):s.ui_type==="STDIO"?(e="STDIO",n="",r=qe(s.stdio_command||"",s.stdio_args||"",s.stdio_cwd,s.env_vars||[])):(e=s.ui_type,n=s.connection_url||"",a=s.connection_token||null),{title:s.title,description:s.description||null,icon:s.icon??null,connection_type:e,connection_url:n,...a&&{connection_token:a},...r&&{connection_headers:r},configuration_state:s.configuration_state??null,configuration_scopes:s.configuration_scopes??null}}function js({connection:s,connectionId:e,org:n,isUpdating:a,tools:r,prompts:o,resources:i,siblings:c}){const l=Y({from:"/$org/settings/connections/$appSlug"}),u=Ee(),x=ye(),{org:p}=J(),d=jt({onSuccess:()=>{c.length<=1&&l({to:"/$org/settings/connections",params:{org:n}})}}),[f,g]=G.useState(null),[v,b]=G.useState(!1),j=be({connectionId:e}),{data:N}=Ye(),T=N?.data?.members??[],C=f??s,y=T.find(m=>m.userId===C.created_by),_=s?.connection_type==="VIRTUAL"||j.isAuthenticated,k={...s,tools:r},S=Ge(k,Wt),h=Ue({resolver:Fe(He),values:he(f??s)}),w=h.formState.isDirty,z=async()=>{if(!await h.trigger())return;const D=h.getValues(),$=gs(D),F=f?.id??e;await x.update.mutateAsync({id:F,data:$}),h.reset(D)},O=()=>{h.reset(he(f??s))},A=async m=>{const{token:D,tokenInfo:$,error:F}=await ot({connectionId:m,orgSlug:p.slug,scope:"offline_access"});if(F||!D){q.error(`Authentication failed: ${F}`);return}if($)try{const K=await fetch(`/api/${p.slug}/connections/${m}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:$.accessToken,refreshToken:$.refreshToken,expiresIn:$.expiresIn,scope:$.scope,clientId:$.clientId,clientSecret:$.clientSecret,tokenEndpoint:$.tokenEndpoint})});if(!K.ok)console.error("Failed to save OAuth token:",await K.text()),await x.update.mutateAsync({id:m,data:{connection_token:D}});else try{await x.update.mutateAsync({id:m,data:{}})}catch(Z){console.warn("Failed to refresh connection tools after OAuth:",Z)}}catch(K){console.error("Error saving OAuth token:",K),await x.update.mutateAsync({id:m,data:{connection_token:D}})}else await x.update.mutateAsync({id:m,data:{connection_token:D}});const Q=new URL(`/api/${p.slug}/mcp/${m}`,window.location.origin);await u.invalidateQueries({queryKey:ne.isMCPAuthenticated(Q.href,null)}),await u.invalidateQueries({queryKey:ne.mcpClientPrefix()}),q.success("Authentication successful")},M=()=>A(s.id),U=async()=>{try{const m=await fetch(`/api/${p.slug}/connections/${s.id}/oauth-token`,{method:"DELETE",credentials:"include"});if(!m.ok){const $=await m.text();q.error(`Failed to remove OAuth: ${$}`);return}const D=new URL(`/api/${p.slug}/mcp/${s.id}`,window.location.origin);await u.invalidateQueries({queryKey:ne.isMCPAuthenticated(D.href,null)}),q.success("OAuth removed. You can now re-authenticate with a different account.")}catch(m){console.error("Error removing OAuth token:",m),q.error("Failed to remove OAuth")}};return t.jsxs(t.Fragment,{children:[t.jsx(vt,{...d}),t.jsx(mt,{open:f!==null,onOpenChange:m=>{m||g(null)},children:t.jsxs(ut,{side:"right",className:"sm:max-w-[520px] p-0 flex flex-col gap-0 overflow-hidden",children:[t.jsxs(xt,{className:"px-4 py-3 md:px-6 md:py-4 border-b border-border shrink-0",children:[t.jsx(pt,{className:"text-base",children:f?.title??s.title}),t.jsx(ht,{className:"text-xs",children:"Update URL, authentication, and other settings"}),y&&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(Ze,{url:y.user?.image??void 0,fallback:y.user?.name??y.user?.email??"?",size:"3xs",shape:"circle"}),t.jsx("span",{className:"text-xs font-medium text-foreground",children:y.user?.name||y.user?.email})]})]}),t.jsxs(gt,{...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(B,{children:[t.jsx(H,{children:"Name"}),t.jsx(V,{children:t.jsx(X,{...m})}),t.jsx(W,{})]})}),t.jsx(L,{control:h.control,name:"description",render:({field:m})=>t.jsxs(B,{children:[t.jsx(H,{children:"Description"}),t.jsx(V,{children:t.jsx(X,{...m,value:m.value||""})}),t.jsx(W,{})]})})]}),t.jsx(xs,{form:h,connection:f??s,hasOAuthToken:j.hasOAuthToken,onReauthenticate:M,onRemoveOAuth:U}),t.jsx(Ke,{connection:f??s,form:h,hasMcpBinding:S,isMCPAuthenticated:_,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(E,{onClick:z,disabled:!w||a,className:"flex-1",children:a?"Saving…":"Save changes"}),w&&t.jsx(E,{variant:"outline",onClick:O,children:"Undo"}),t.jsxs(E,{variant:"outline",className:"gap-2 text-muted-foreground hover:text-destructive hover:border-destructive",onClick:()=>{const m=f??s;g(null),d.requestDelete(m)},children:[t.jsx(ae,{size:15}),"Delete"]})]})]},f?.id??s.id)]})}),t.jsx(Qe,{hideHeader:!0,children:t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[t.jsx(us,{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(ss,{connectionId:e}),t.jsxs("div",{className:"flex flex-col gap-5",children:[t.jsx(Gt,{instances:c,onConfigure:m=>g(m),onAuthenticate:m=>A(m.id),onDelete:m=>d.requestDelete(m),onToggleStatus:async(m,D)=>{try{await x.update.mutateAsync({id:m.id,data:{status:D}}),q.success(D==="active"?"Connection enabled":"Connection disabled")}catch{q.error("Failed to update connection")}},isAdding:v,onAdd:async()=>{b(!0);try{const m=c[0]??s,D=m.title.replace(/\s*\(\d+\)\s*$/,""),$=c.length+1,F=`${D} (${$})`,Q=Le("conn");await x.create.mutateAsync({id:Q,title:F,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(`/api/${p.slug}/mcp/${Q}`,window.location.origin),Z=await nt({url:K.href,token:null,orgId:p.id});Z.supportsOAuth&&!Z.isAuthenticated&&await A(Q)}finally{b(!1)}}}),t.jsx(is,{connection:s})]}),t.jsx("div",{className:"@3xl:col-span-2",children:t.jsx(ls,{tools:r,prompts:o,resources:i,connectionId:e,org:n})})]})})]})})]})}function vs(){const s=P.c(39);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/$org/settings/connections/$appSlug"},s[0]=e):e=s[0];const n=Y(e);let a;s[1]===Symbol.for("react.memo_cache_sentinel")?(a={from:"/shell/$org/settings/connections/$appSlug"},s[1]=a):a=s[1];const{appSlug:r,org:o}=Me(a),{org:i}=J(),c=ye();let l;s[2]!==r?(l={slug:r},s[2]=r,s[3]=l):l=s[3];const u=et(l),x=u[0]??null,p=x?.id??"",d=p||null;let f;s[4]!==i.id||s[5]!==i.slug||s[6]!==d?(f={connectionId:d,orgId:i.id,orgSlug:i.slug},s[4]=i.id,s[5]=i.slug,s[6]=d,s[7]=f):f=s[7];const g=_e(f);let v;s[8]!==g?(v={client:g},s[8]=g,s[9]=v):v=s[9];const{data:b}=tt(v);let j;if(s[10]!==x?.tools||s[11]!==p||s[12]!==u||s[13]!==b){const A=b?b.tools.map(Cs):(x?.tools??[]).map(Ss);e:{if(u.length<=1){j=A;break e}const M=new Set,U=[],m=ys;for(const D of u){const $=D.id===p?A:m(D.tools);for(const F of $)M.has(F.name)||(M.add(F.name),U.push(F))}j=U.length>0?U:A}s[10]=x?.tools,s[11]=p,s[12]=u,s[13]=b,s[14]=j}else j=s[14];const N=j;let T;s[15]!==g?(T={client:g},s[15]=g,s[16]=T):T=s[16];const{data:C}=st(T);let y;s[17]!==g?(y={client:g},s[17]=g,s[18]=y):y=s[18];const{data:I}=Ve(y);let _;s[19]!==C?.prompts?(_=C?.prompts??[],s[19]=C?.prompts,s[20]=_):_=s[20];let k;s[21]!==_?(k=_.map(Ns),s[21]=_,s[22]=k):k=s[22];const S=k;let h;s[23]!==I?.resources?(h=I?.resources??[],s[23]=I?.resources,s[24]=h):h=s[24];let w;s[25]!==h?(w=h.map(bs),s[25]=h,s[26]=w):w=s[26];const z=w;if(!x){let A;return s[27]!==n||s[28]!==o?(A=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(ve,{title:"Connection not found",description:"This connection may have been deleted or you may not have access.",actions:t.jsx(E,{variant:"outline",onClick:()=>n({to:"/$org/settings/connections",params:{org:o}}),children:"Back to connections"})})}),s[27]=n,s[28]=o,s[29]=A):A=s[29],A}let O;return s[30]!==c.update.isPending||s[31]!==N||s[32]!==x||s[33]!==p||s[34]!==o||s[35]!==S||s[36]!==z||s[37]!==u?(O=t.jsx(js,{org:o,connection:x,connectionId:p,isUpdating:c.update.isPending,tools:N,prompts:S,resources:z,siblings:u}),s[30]=c.update.isPending,s[31]=N,s[32]=x,s[33]=p,s[34]=o,s[35]=S,s[36]=z,s[37]=u,s[38]=O):O=s[38],O}function bs(s){return{name:s.name,description:s.description,uri:s.uri}}function Ns(s){return{name:s.name,description:s.description}}function ys(s){return(s??[]).map(_s)}function _s(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema??{},outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function Ss(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function Cs(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function ws(){const s=P.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(ze,{children:t.jsx(G.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:t.jsx(ge,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(vs,{})})}),s[0]=e):e=s[0],e}function ro(){const s=P.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(ws,{}),s[0]=e):e=s[0],e}export{ro as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as R,aF as A,b7 as I,s as a,aD as j,aE as z,c as L,j as u,B as C}from"./index-
|
|
1
|
+
import{o as R,aF as A,b7 as I,s as a,aD as j,aE as z,c as L,j as u,B as C}from"./index-BlbGtC1U.js";import{I as H}from"./input-DHDgjmX0.js";import{s as W}from"./Plus-Bi8BbQwT.js";import{s as q}from"./Trash01-CbqEHpx0.js";const K=R({key:a().min(1,"Key is required"),value:a()}),M=R({title:a().min(1,"Name is required"),description:a().nullable().optional(),icon:a().nullable().optional(),ui_type:z(["HTTP","SSE","Websocket","NPX","STDIO"]),connection_url:a().optional(),connection_token:a().nullable().optional(),npx_package:a().optional(),stdio_command:a().optional(),stdio_args:a().optional(),stdio_cwd:a().optional(),env_vars:j(K).optional(),configuration_scopes:j(a()).nullable().optional(),configuration_state:A(a(),I()).nullable().optional()}).refine(n=>n.ui_type==="NPX"?!!n.npx_package?.trim():!0,{message:"NPM package is required",path:["npx_package"]}).refine(n=>n.ui_type==="STDIO"?!!n.stdio_command?.trim():!0,{message:"Command is required",path:["stdio_command"]}).refine(n=>n.ui_type==="HTTP"||n.ui_type==="SSE"||n.ui_type==="Websocket"?!!n.connection_url?.trim():!0,{message:"URL is required",path:["connection_url"]});function $(n){const e=n.toLowerCase();return!!(["secret","password","passwd","credential","private","token","bearer","jwt","refresh","session","api_key","apikey","auth_key","access_key","secret_key","private_key","service_key","encryption_key","signing_key","license_key","auth","oauth","client_secret","app_secret","webhook","signing","signature","database_url","db_url","mongo_uri","redis_url","postgres_url","mysql_url","connection_string","dsn","service_role","anon_key","supabase_key","openai","anthropic","stripe","twilio","sendgrid","resend","firebase","sentry","datadog","newrelic","new_relic","pplx","replicate","pinecone","cohere","hugging","hf_token","gh_token","npm_token","certificate","cert","ssl","tls","encryption","salt","hash","hmac","personal_access","github_pat","gitlab_pat","bitbucket_pat"].some(s=>e.includes(s))||["sk_","rk_","whsec_","pk_live","sk_live"].some(s=>e.startsWith(s))||["_key","_secret","_token","_password","_auth","_pat"].some(s=>e.endsWith(s)))}function X(n){const e=L.c(34),{value:t,onChange:r,keyPlaceholder:o,valuePlaceholder:s,className:v}=n,m=o===void 0?"VARIABLE_NAME":o,_=s===void 0?"value...":s;let b;e[0]!==r||e[1]!==t?(b=()=>{r([...t,{key:"",value:""}])},e[0]=r,e[1]=t,e[2]=b):b=e[2];const S=b;let x;e[3]!==r||e[4]!==t?(x=l=>{r(t.filter((p,i)=>i!==l))},e[3]=r,e[4]=t,e[5]=x):x=e[5];const g=x;let P;e[6]!==r||e[7]!==t?(P=(l,p)=>{const i=[...t],c=i[l];c&&(i[l]={key:p,value:c.value},r(i))},e[6]=r,e[7]=t,e[8]=P):P=e[8];const y=P;let w;e[9]!==r||e[10]!==t?(w=(l,p)=>{const i=[...t],c=i[l];c&&(i[l]={key:c.key,value:p},r(i))},e[9]=r,e[10]=t,e[11]=w):w=e[11];const k=w;let d;if(e[12]!==y||e[13]!==g||e[14]!==k||e[15]!==m||e[16]!==t||e[17]!==_){let l;e[19]!==y||e[20]!==g||e[21]!==k||e[22]!==m||e[23]!==_?(l=(p,i)=>u.jsxs("div",{className:"flex gap-2 items-center",children:[u.jsx(H,{placeholder:m,value:p.key,onChange:c=>y(i,c.target.value),className:"h-10 rounded-lg flex-1 font-mono text-sm"}),u.jsx(H,{type:$(p.key)?"password":"text",placeholder:_,value:p.value,onChange:c=>k(i,c.target.value),className:"h-10 rounded-lg flex-1"}),u.jsx(C,{type:"button",variant:"ghost",size:"icon",className:"h-10 w-10 shrink-0 text-muted-foreground hover:text-destructive",onClick:()=>g(i),children:u.jsx(q,{size:16})})]},i),e[19]=y,e[20]=g,e[21]=k,e[22]=m,e[23]=_,e[24]=l):l=e[24],d=t.map(l),e[12]=y,e[13]=g,e[14]=k,e[15]=m,e[16]=t,e[17]=_,e[18]=d}else d=e[18];let T;e[25]===Symbol.for("react.memo_cache_sentinel")?(T=u.jsx(W,{size:16,className:"mr-1"}),e[25]=T):T=e[25];let f;e[26]!==S?(f=u.jsxs(C,{type:"button",variant:"outline",size:"sm",className:"w-full h-9 text-muted-foreground",onClick:S,children:[T,"Add Environment Variable"]}),e[26]=S,e[27]=f):f=e[27];let h;e[28]!==d||e[29]!==f?(h=u.jsxs("div",{className:"flex flex-col gap-2",children:[d,f]}),e[28]=d,e[29]=f,e[30]=h):h=e[30];let E;return e[31]!==v||e[32]!==h?(E=u.jsx("div",{className:v,children:h}),e[31]=v,e[32]=h,e[33]=E):E=e[33],E}function V(n){const e={};for(const{key:t,value:r}of n)t.trim()&&(e[t.trim()]=r);return e}function D(n){return n?Object.entries(n).map(([e,t])=>({key:e,value:t})):[]}function N(n){const e=n.trim();if(!e)return"";try{const t=new URL(e),r=t.pathname.length>1?t.pathname.replace(/\/+$/,""):t.pathname;return`${t.origin}${r}`}catch{return e.replace(/\/+$/,"")}}function F(n){const e=n.trim().split(/\s+/).filter(Boolean);if(e.length<2)return null;const t=e[0]?.toLowerCase();if(t!=="npx"&&t!=="bunx")return null;const o=e.slice(1).find(s=>!s.startsWith("-"));return o?{packageName:o}:null}function Y(n){const{uiType:e}=n,t=N(n.connectionUrl??"");if((e==="HTTP"||e==="SSE"||e==="Websocket")&&t===N("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 r=(n.npxPackage??"").trim();return e==="NPX"&&r==="@perplexity-ai/mcp-server"?{id:"perplexity",title:"Perplexity",description:"Perplexity MCP Server",envVarKeys:["PERPLEXITY_API_KEY"]}:null}function J(n){if(n.registryItems.length===0||n.uiType!=="HTTP"&&n.uiType!=="SSE"&&n.uiType!=="Websocket")return null;const e=N(n.connectionUrl??"");if(!e)return null;const t=n.registryItems.find(s=>(s.server?.remotes??[]).some(m=>N(m.url??"")===e));if(!t)return null;const r=t.title||t.name||t.server?.title||t.server?.name||"",o=t.server?.description||t.description||t.summary||null;return r?{id:"registry",title:r,description:o}:null}function Q(n,e){const t={command:"npx",args:["-y",n]},r=V(e);return Object.keys(r).length>0&&(t.envVars=r),t}function Z(n,e,t,r){const o={command:n};e.trim()&&(o.args=e.trim().split(/\s+/)),t?.trim()&&(o.cwd=t.trim());const s=V(r);return Object.keys(s).length>0&&(o.envVars=s),o}export{X as E,J as a,Q as b,M as c,Z as d,Y as i,F as p,D as r};
|