decocms 3.102.0 → 3.102.1
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-Bsym1ImY.js → AlertCircle-C9EcTRk1.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-OETO6U7k.js → ArrowUpRight-6Dz_XkMa.js} +1 -1
- package/dist/client/assets/{CheckCircle-CLnUTqL3.js → CheckCircle-kwc45JPK.js} +1 -1
- package/dist/client/assets/{ChevronDown-Bx4qDl4c.js → ChevronDown-D7GDZ7wu.js} +1 -1
- package/dist/client/assets/{ChevronLeft-DTd3BCNc.js → ChevronLeft-DimzbDID.js} +1 -1
- package/dist/client/assets/{ChevronRight-_RX2mWgS.js → ChevronRight-CyT2euoR.js} +1 -1
- package/dist/client/assets/{ChevronUp-BL1VVdJH.js → ChevronUp-CxQvq7Kl.js} +1 -1
- package/dist/client/assets/{DotsVertical-CN2QyAt6.js → DotsVertical-BFENe2Dt.js} +1 -1
- package/dist/client/assets/{Eye-DLB3SihR.js → Eye-BXLPt3hG.js} +1 -1
- package/dist/client/assets/{FilterLines-C6-JkzKo.js → FilterLines-C0tlpzHG.js} +1 -1
- package/dist/client/assets/{Globe01-QSXapmlK.js → Globe01-CSh9aag5.js} +1 -1
- package/dist/client/assets/{Globe04-3IZPnvlD.js → Globe04-Do4YAUSY.js} +1 -1
- package/dist/client/assets/{HardDrive-uvvlNfcr.js → HardDrive-DnqhEbjC.js} +1 -1
- package/dist/client/assets/{Key01-CZ1h7fLN.js → Key01-BGS-_-TQ.js} +1 -1
- package/dist/client/assets/{LayoutLeft-i_rhGuA5.js → LayoutLeft-BQaqFKj6.js} +1 -1
- package/dist/client/assets/{LinkExternal01-BCIEZzze.js → LinkExternal01-C_4O-Sjm.js} +1 -1
- package/dist/client/assets/{Monitor01-DPI8nCmu.js → Monitor01-BerC6VZd.js} +1 -1
- package/dist/client/assets/{Palette-UZ6kBEqD.js → Palette-gJqbN1eT.js} +1 -1
- package/dist/client/assets/{Play-qEBiAhod.js → Play-BYLMPWCh.js} +1 -1
- package/dist/client/assets/{Plus-BFXW9Hm0.js → Plus-CSM0Gdnx.js} +1 -1
- package/dist/client/assets/{SearchLg-BM8Dh-8n.js → SearchLg-dtJyWy2t.js} +1 -1
- package/dist/client/assets/{SearchMd-CxnmulF7.js → SearchMd-1gE2e_l6.js} +1 -1
- package/dist/client/assets/{Settings02-DTCnN7hH.js → Settings02-CzuPYYwF.js} +1 -1
- package/dist/client/assets/{Shield01-CaE-d9vS.js → Shield01-CbgaHtai.js} +1 -1
- package/dist/client/assets/{Star01-GR0ov5Sc.js → Star01-DFu1Ny2B.js} +1 -1
- package/dist/client/assets/{Stars01-BlizU8cq.js → Stars01-DkLv1n8B.js} +1 -1
- package/dist/client/assets/{Stars02-BI5loBcY.js → Stars02-BRU8YBIB.js} +1 -1
- package/dist/client/assets/{Sun-C2NDQLw1.js → Sun-BnUHB5Qj.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-PRhNyd-f.js → SwitchHorizontal01-DoI1DhsF.js} +1 -1
- package/dist/client/assets/{Tool01-CL_8Izc9.js → Tool01-0YhkCkB5.js} +1 -1
- package/dist/client/assets/{Trash01-DA6TfyJR.js → Trash01-DnZnIRtK.js} +1 -1
- package/dist/client/assets/{Upload01-DPL58cy-.js → Upload01-q49A0pPe.js} +1 -1
- package/dist/client/assets/{User01-Dc_4BfIo.js → User01-B60sPq_u.js} +1 -1
- package/dist/client/assets/{Users01-C-jKgPln.js → Users01-DwmjwTDW.js} +1 -1
- package/dist/client/assets/{Users03-Cm292zjH.js → Users03-a1897IbE.js} +1 -1
- package/dist/client/assets/{X-E3DyM7UC.js → X-C84T4GrV.js} +1 -1
- package/dist/client/assets/{XCircle-Cuc8nE6i.js → XCircle--tkqwpM7.js} +1 -1
- package/dist/client/assets/{XClose-jXr-Q3Pi.js → XClose-BESokz6G.js} +1 -1
- package/dist/client/assets/{Zap-CLQGhRUa.js → Zap-CfBVsJkz.js} +1 -1
- package/dist/client/assets/{ZapSquare-BZrjsIpc.js → ZapSquare-D1OOZQrN.js} +1 -1
- package/dist/client/assets/{ZoomOut-BRkeO1qu.js → ZoomOut-CuqN1_dw.js} +1 -1
- package/dist/client/assets/{access-gate-C5TzUIXt.js → access-gate-KTlnt7-F.js} +1 -1
- package/dist/client/assets/{add-section-modal-CSRseQoK.js → add-section-modal-Dme415H_.js} +1 -1
- package/dist/client/assets/{agent-icon-D6NO8NQS.js → agent-icon-aTZ0WGYG.js} +1 -1
- package/dist/client/assets/{agents-list-DFNycMEi.js → agents-list-CMbTDT2T.js} +1 -1
- package/dist/client/assets/{ai-providers-COockkrO.js → ai-providers-YzRLepjL.js} +1 -1
- package/dist/client/assets/{alert-C8jUFZtR.js → alert-B0Dp6PoX.js} +1 -1
- package/dist/client/assets/{alert-dialog-BJv2MuMy.js → alert-dialog-BRyOSgy9.js} +1 -1
- package/dist/client/assets/{app-editor-BvxdaHja.js → app-editor-DK-AZsAm.js} +1 -1
- package/dist/client/assets/{auth-qUspkFR_.js → auth-DvtjPuDG.js} +1 -1
- package/dist/client/assets/{auth-catchall-NKD-8ssC.js → auth-catchall-BkLcCfWE.js} +1 -1
- package/dist/client/assets/{auth-entry-BImLugiZ.js → auth-entry-BMqe_NAJ.js} +1 -1
- package/dist/client/assets/{auth-split-layout-D9ShntXk.js → auth-split-layout-RNNT-n_r.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-DV_Syko4.js → authenticate-and-persist-oauth-BoI1Z5Xj.js} +1 -1
- package/dist/client/assets/{automation-list-row-c4QGTwIG.js → automation-list-row-BFMtAMQq.js} +1 -1
- package/dist/client/assets/{automation-runs-Isfsmb2-.js → automation-runs-BdBqeyGM.js} +1 -1
- package/dist/client/assets/{automations-CxVgPsMF.js → automations-BSug9f0H.js} +1 -1
- package/dist/client/assets/{avatar-MHZ63SNd.js → avatar-Bjp6G7so.js} +1 -1
- package/dist/client/assets/{badge-Db7tzVgy.js → badge-BCyg4w-e.js} +1 -1
- package/dist/client/assets/{block-document-CZ4TPdpo.js → block-document-CcQzgtU8.js} +1 -1
- package/dist/client/assets/{brand-context-Ct3UyO-N.js → brand-context-BaRZaudU.js} +1 -1
- package/dist/client/assets/{buckets-D5QSqwEH.js → buckets-Cvo0NbBW.js} +1 -1
- package/dist/client/assets/{capability-load-error-BLGfvkIS.js → capability-load-error-Dm92ZqU1.js} +1 -1
- package/dist/client/assets/{card-CtMXwIVV.js → card-D_ph8XFv.js} +1 -1
- package/dist/client/assets/{category-editor-DMGayMQb.js → category-editor-OOI6cMu_.js} +1 -1
- package/dist/client/assets/{chat-context-DV4Qov4z.js → chat-context-BOt5-jK-.js} +1 -1
- package/dist/client/assets/{checkbox-DgOR-Anq.js → checkbox-CSSDol8-.js} +1 -1
- package/dist/client/assets/{cli-auth-success-C7qA5t50.js → cli-auth-success-D3ZPBXXE.js} +1 -1
- package/dist/client/assets/{collection-detail-DUfRhEhT.js → collection-detail-DijVCdVP.js} +1 -1
- package/dist/client/assets/{collection-display-button-BguHr9YN.js → collection-display-button-DfOakFL6.js} +1 -1
- package/dist/client/assets/{collection-search-Iqzzk8ve.js → collection-search-G1k0nq01.js} +1 -1
- package/dist/client/assets/{collection-tabs-B3190RdE.js → collection-tabs-DpYVSS1L.js} +1 -1
- package/dist/client/assets/{command-CMC_Bp0D.js → command-BtokzzsZ.js} +1 -1
- package/dist/client/assets/{commerce-onboarding-BIH5j4YU.js → commerce-onboarding-D7-PbC8T.js} +1 -1
- package/dist/client/assets/{connect-desktop-dialog-OF1KTSS8.js → connect-desktop-dialog-BAbqvkVa.js} +1 -1
- package/dist/client/assets/{connection-card-CcjZrYh-.js → connection-card-CGpEpP_1.js} +1 -1
- package/dist/client/assets/{connection-detail-Ci6IALnx.js → connection-detail-F0HaF_hL.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-CTjKD9q-.js → connection-form-helpers-CeFjK_lf.js} +1 -1
- package/dist/client/assets/{connections-F_lJecWU.js → connections-DunX6045.js} +1 -1
- package/dist/client/assets/{context-menu-LZTuNKYW.js → context-menu-RXER8geO.js} +1 -1
- package/dist/client/assets/{decopilot-BrxNwwTf.js → decopilot-C_2H17Zg.js} +1 -1
- package/dist/client/assets/{decopilot-sse-pool-CnXnOYzd.js → decopilot-sse-pool-Cz_XAdFl.js} +1 -1
- package/dist/client/assets/{dialog-DZbMHqk-.js → dialog-Bh4QMQdt.js} +1 -1
- package/dist/client/assets/{domain-settings-Dkl7zpl7.js → domain-settings-C3POdr2q.js} +1 -1
- package/dist/client/assets/{drawer-Bj2pFJ5j.js → drawer-DsLTDgt5.js} +1 -1
- package/dist/client/assets/{dropdown-menu-q-nI9CQa.js → dropdown-menu-uJD6Hbs4.js} +1 -1
- package/dist/client/assets/{empty-state-BcFEj5KY.js → empty-state-CV8YB8eL.js} +1 -1
- package/dist/client/assets/{extract-connection-data-KUqDwlNM.js → extract-connection-data-WCh9ShTJ.js} +1 -1
- package/dist/client/assets/{file-explorer-C3p7xN-2.js → file-explorer-DG2pqrud.js} +1 -1
- package/dist/client/assets/{file-type-icon-DaT7kiOY.js → file-type-icon-BXOt8Ou_.js} +1 -1
- package/dist/client/assets/{files-CDGOPJPr.js → files--Hi2aT6z.js} +1 -1
- package/dist/client/assets/{form-CBShGsV7.js → form-B5uVKHZJ.js} +1 -1
- package/dist/client/assets/{general-DufMF5Hx.js → general-FiZZHxMc.js} +1 -1
- package/dist/client/assets/{github-repo-picker-BnXFgvV4.js → github-repo-picker-Tt_W8wv4.js} +1 -1
- package/dist/client/assets/{hooks-CoRBK0Wo.js → hooks-LBSFR4MW.js} +1 -1
- package/dist/client/assets/{import-from-deco-dialog-BQMcGJTE.js → import-from-deco-dialog-CvyW-BqF.js} +1 -1
- package/dist/client/assets/{index-BHi-dF_r.js → index-B7mJQDwu.js} +1 -1
- package/dist/client/assets/{index-Bo1lWNsB.js → index-BQ0VdUzm.js} +1 -1
- package/dist/client/assets/{index-CFJlPpoM.js → index-Ba_weT-5.js} +1 -1
- package/dist/client/assets/{index-D4CKj2wI.js → index-BeeLZolL.js} +3 -3
- package/dist/client/assets/{index-CS2bI8tv.js → index-CBoPTCQ5.js} +1 -1
- package/dist/client/assets/{index-UwFUQNqq.js → index-CNVqZc4R.js} +1 -1
- package/dist/client/assets/{index-ByYK-wGy.js → index-CRjEhu3F.js} +1 -1
- package/dist/client/assets/{index-QzrWddSA.js → index-CYyq7mHg.js} +1 -1
- package/dist/client/assets/{index-CobHumLE.js → index-CwnG-amZ.js} +1 -1
- package/dist/client/assets/{index-Dvt6AveD.js → index-DRcsXRIy.js} +5 -5
- package/dist/client/assets/{index-BVNN3899.js → index-DlEfZWDz.js} +1 -1
- package/dist/client/assets/{index-BFqRiNq4.js → index-DzlhHX6a.js} +1 -1
- package/dist/client/assets/{index-85Y_nPN7.js → index-O5lJgxNT.js} +1 -1
- package/dist/client/assets/{index-redirect-CodHLrum.js → index-redirect-GHUu58uU.js} +1 -1
- package/dist/client/assets/{index-Bib2xJPl.js → index-zGUyVqwo.js} +1 -1
- package/dist/client/assets/{input-Bt9JLSwY.js → input-LkQXvLAa.js} +1 -1
- package/dist/client/assets/{integration-icon-DQlMcsez.js → integration-icon-BFj5Hgg2.js} +1 -1
- package/dist/client/assets/{label-BCF__ROW.js → label-B3e_Uel8.js} +1 -1
- package/dist/client/assets/{login-rjq6U6e6.js → login-DI6Oc9xp.js} +1 -1
- package/dist/client/assets/{mcp-oauth-B7os1fcw.js → mcp-oauth-BtLTrokF.js} +1 -1
- package/dist/client/assets/{members-sQeD1Ltv.js → members-DI26rKJd.js} +1 -1
- package/dist/client/assets/{monaco-editor-arl1r71i.js → monaco-editor-CEpx4sr1.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-B9HQTJug.js → monitoring-stats-row-DRLA2qw2.js} +1 -1
- package/dist/client/assets/{oauth-callback-DZ7KHdmL.js → oauth-callback-BJJEVXqk.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-C_r2pLFn.js → oauth-callback-ai-provider-C59MRopo.js} +1 -1
- package/dist/client/assets/{onboarding-DaZoE_w4.js → onboarding-CCXOEuVI.js} +1 -1
- package/dist/client/assets/{org-install-CSAJP4Gn.js → org-install-DfXBXASV.js} +1 -1
- package/dist/client/assets/{org-layout-Cbu4q90r.js → org-layout-Bhh9Tx7i.js} +1 -1
- package/dist/client/assets/{organization-choice-ChvrohfF.js → organization-choice-wN3p5bHs.js} +1 -1
- package/dist/client/assets/{page-seo-form-C1vNLs7M.js → page-seo-form-CeO_fiCa.js} +1 -1
- package/dist/client/assets/page-seo-sheet-DozBoZ0p.js +1 -0
- package/dist/client/assets/{popover-CH8yy2uh.js → popover-DHxWzxMm.js} +1 -1
- package/dist/client/assets/{post-editor-Czp3m4z6.js → post-editor-DUskP94F.js} +1 -1
- package/dist/client/assets/{preview-dialog-u-TOu-b6.js → preview-dialog-BLhJle2o.js} +1 -1
- package/dist/client/assets/{primitives-Q1x2UAiF.js → primitives-9Fo25Ta-.js} +1 -1
- package/dist/client/assets/{profile-D0OHKrd5.js → profile-BEmdlYSD.js} +1 -1
- package/dist/client/assets/project-app-view-BK1koFcS.js +1 -0
- package/dist/client/assets/record-editor-CFexSC0p.js +1 -0
- package/dist/client/assets/registry-CE3YFt8t.js +2 -0
- package/dist/client/assets/{registry-layout-DHywWBq8.js → registry-layout-C1kKQBFa.js} +1 -1
- package/dist/client/assets/{require-capability-BxhJkMfT.js → require-capability-DpoCEd4r.js} +1 -1
- package/dist/client/assets/{required-auth-layout-CfUZ7qyj.js → required-auth-layout-CEwUwqrL.js} +1 -1
- package/dist/client/assets/{reset-password-B3UdDjZj.js → reset-password-DmoAAy1Z.js} +1 -1
- package/dist/client/assets/{roles-D64J9tYr.js → roles-B5X6Zh2o.js} +1 -1
- package/dist/client/assets/{scroll-area-DnDRpGus.js → scroll-area-B56N_yCO.js} +1 -1
- package/dist/client/assets/{search-input-Hgggsu1n.js → search-input-U_nJ0_0r.js} +1 -1
- package/dist/client/assets/{secrets-kGGr8P1C.js → secrets-Bqam7alS.js} +1 -1
- package/dist/client/assets/{sections-editor-BkPFKV4o.js → sections-editor-BFLxjSmV.js} +1 -1
- package/dist/client/assets/{select-CphsJj8y.js → select-BkOEUkbJ.js} +1 -1
- package/dist/client/assets/{select-model-pLCQ1ukB.js → select-model-BiWJ5jC_.js} +1 -1
- package/dist/client/assets/{seo-editor-cyS8fuF5.js → seo-editor-CfSf3XON.js} +1 -1
- package/dist/client/assets/{settings-layout-Bd7To-XV.js → settings-layout-BY4qhHS-.js} +1 -1
- package/dist/client/assets/{settings-section-BWOQKU4O.js → settings-section-6qCfkym4.js} +1 -1
- package/dist/client/assets/{sheet-B-paP53q.js → sheet-bRkswz3e.js} +1 -1
- package/dist/client/assets/{shell-controls-DUddkw0J.js → shell-controls-Cpmw0px6.js} +1 -1
- package/dist/client/assets/{shell-layout-B70hKdUr.js → shell-layout-BoazOREx.js} +1 -1
- package/dist/client/assets/{shell-route-loading-aSr3T5lK.js → shell-route-loading-BmYc8ofm.js} +1 -1
- package/dist/client/assets/{sidebar-DRF2fDLx.js → sidebar-BdrG3Qa1.js} +1 -1
- package/dist/client/assets/{skeleton-pN40gpj3.js → skeleton-CSCwD1aY.js} +1 -1
- package/dist/client/assets/{sortable.esm-C98yc2pz.js → sortable.esm-BtpUi_Y9.js} +1 -1
- package/dist/client/assets/{sso-CA0zK_i-.js → sso-BqdZk50b.js} +1 -1
- package/dist/client/assets/{store-NmMa-JWZ.js → store-Ba_vCOQ4.js} +1 -1
- package/dist/client/assets/store-registry-Bnz4FM67.js +2 -0
- package/dist/client/assets/{studio-tools-DJSjhq0D.js → studio-tools-CHbEcMpW.js} +1 -1
- package/dist/client/assets/{switch-x4Wyz382.js → switch-Bcdlhkr2.js} +1 -1
- package/dist/client/assets/{table-BiuHIkWm.js → table-BMQiVOn5.js} +1 -1
- package/dist/client/assets/{tabs-CDgzlPBm.js → tabs-mJhamlKf.js} +1 -1
- package/dist/client/assets/{task-status-CwOcEzIm.js → task-status-dSPM4Ep8.js} +1 -1
- package/dist/client/assets/{textarea-CtUbhdeG.js → textarea-C4dYwC8A.js} +1 -1
- package/dist/client/assets/{toggle-group-HoCTXLpC.js → toggle-group-C57_XzXH.js} +1 -1
- package/dist/client/assets/{toolbar-DzaQ_f7H.js → toolbar-BIOVUT-y.js} +1 -1
- package/dist/client/assets/{tooltip-BaneECMt.js → tooltip-Ba5WYryG.js} +1 -1
- package/dist/client/assets/{types-Dto7-GaX.js → types-DKix5qGt.js} +1 -1
- package/dist/client/assets/{use-ai-providers-Dt0kVGXk.js → use-ai-providers-CmTk0nWY.js} +1 -1
- package/dist/client/assets/{use-automations-Clb0hh_1.js → use-automations-Q1RvH021.js} +1 -1
- package/dist/client/assets/{use-capability-BWYVWoLM.js → use-capability-B2XcB-d9.js} +1 -1
- package/dist/client/assets/{use-clock-tick-CZ40pahU.js → use-clock-tick-BaK2hQvq.js} +1 -1
- package/dist/client/assets/{use-collections-DnO2vUDN.js → use-collections-BGIHIeWt.js} +1 -1
- package/dist/client/assets/{use-connection-DMTytEnA.js → use-connection-C1WF2ABg.js} +1 -1
- package/dist/client/assets/{use-copy-CdcjKwcP.js → use-copy-BnrYqgMC.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-W-deafLh.js → use-create-virtual-mcp-C-fyx5fa.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-DH7USjDF.js → use-debounced-autosave-S9L_cA3N.js} +1 -1
- package/dist/client/assets/{use-debounced-value-jFGdne3V.js → use-debounced-value-bqqyokA4.js} +1 -1
- package/dist/client/assets/{use-delete-connection-C62T7WnY.js → use-delete-connection-CHjlHN1-.js} +1 -1
- package/dist/client/assets/{use-file-configs-B_dlGLNK.js → use-file-configs-Bk2fg1se.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-D-oLfc0s.js → use-infinite-scroll-Bu1iRutS.js} +1 -1
- package/dist/client/assets/{use-join-requests-2jKKbF_h.js → use-join-requests-Rzh8e25M.js} +1 -1
- package/dist/client/assets/{use-mcp-client-7IqlZsu6.js → use-mcp-client-iaudT61I.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-qBgfAdeJ.js → use-mcp-prompts-BMHxgWkZ.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-Bdsz5gKc.js → use-mcp-tools-DfcIioGC.js} +1 -1
- package/dist/client/assets/{use-members-CILxxsTB.js → use-members-Bgea4fXv.js} +1 -1
- package/dist/client/assets/{use-mobile-xDuvUN2d.js → use-mobile-CmTsKIc6.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-DOuUJjr4.js → use-navigate-to-agent-Dn1mURgE.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-BkIzu6ME.js → use-org-auth-client-BCbP6INe.js} +1 -1
- package/dist/client/assets/{use-org-sso-DH6y6bni.js → use-org-sso-DLjtx9OU.js} +1 -1
- package/dist/client/assets/{use-organization-roles-RRC9tv5p.js → use-organization-roles-BMhKBNOB.js} +1 -1
- package/dist/client/assets/{use-organization-settings-qUFRQJiW.js → use-organization-settings-Bjm9SZNS.js} +1 -1
- package/dist/client/assets/{use-registry-connections-Ch7Aio17.js → use-registry-connections-ZETZM_i3.js} +1 -1
- package/dist/client/assets/{use-secrets-DBm8esuE.js → use-secrets-DsJnAUYO.js} +1 -1
- package/dist/client/assets/{use-status-sounds-BI3sA1bW.js → use-status-sounds-CNdzOa9H.js} +1 -1
- package/dist/client/assets/{use-view-mode-DJhrP-yV.js → use-view-mode-ezXFyTI5.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-kmppTc07.js → use-virtual-mcp-BcesJFjl.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-DDea8wRo.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-DXb1gGWK.js +1 -0
- package/dist/client/assets/{useSuspenseQueries-CXyIh6vj.js → useSuspenseQueries-Cv-F6NwL.js} +1 -1
- package/dist/client/assets/{variant-calendar-DOrGpHVg.js → variant-calendar-BDpdYL4Y.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-DCQKBOlR.js → view-mode-toggle-BRqm8HSD.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +374 -342
- package/dist/server/server.js +189 -189
- package/package.json +1 -1
- package/dist/client/assets/page-seo-sheet-HzjH0FH9.js +0 -1
- package/dist/client/assets/project-app-view-ECfkY6gJ.js +0 -1
- package/dist/client/assets/record-editor-DHlvEoEX.js +0 -1
- package/dist/client/assets/registry-CmRuPXV3.js +0 -2
- package/dist/client/assets/store-registry-DNdUXSaP.js +0 -2
- package/dist/client/assets/useInfiniteQuery-B3otrimp.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-BRmo39ka.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as y,j as t,B as F,i as Z,o as Ge,s as se,E as Pe,r as T,D as ie,p as Qe,l as V,bg as Ye,u as Ze,G,t as Xe,e as ae,b2 as ke}from"./index-D4CKj2wI.js";import{E as Ee}from"./empty-state-BcFEj5KY.js";import{u as et,a as Ae}from"./use-collections-DnO2vUDN.js";import{u as ce}from"./use-mcp-client-7IqlZsu6.js";import{F as ne,a as tt,b as de,d as me}from"./form-CBShGsV7.js";import{I as ue}from"./input-Bt9JLSwY.js";import{T as re}from"./textarea-CtUbhdeG.js";import{a as st,b as nt,V as xe,O as ot,M as lt}from"./index-ByYK-wGy.js";import{ak as rt,y as it,a9 as at,al as ct,Z as dt,am as mt,N as be}from"./agent-icon-D6NO8NQS.js";import{g as ut,M as xt,a as Ne}from"./types-Dto7-GaX.js";import{A as pt,a as ft,b as ht}from"./alert-C8jUFZtR.js";import{d as ve,b as Se,c as ye,S as we,a as oe}from"./select-CphsJj8y.js";import{c as gt,b as Ce,T as Ie,a as $e}from"./tooltip-BaneECMt.js";import{i as jt}from"./AlertCircle-Bsym1ImY.js";import{s as bt}from"./Stars02-BI5loBcY.js";import{a as Nt}from"./Eye-DLB3SihR.js";import{i as vt}from"./Play-qEBiAhod.js";import{i as St}from"./ChevronRight-_RX2mWgS.js";import{g as yt}from"./connection-slug-eyAPH6o3.js";import{u as wt,T as Ct}from"./index-BHi-dF_r.js";import{a as Oe,u as Re}from"./use-connection-DMTytEnA.js";import{a as It}from"./use-mcp-tools-Bdsz5gKc.js";import{c as $t}from"./content-blocks-o63cs2vh.js";import{I as Te}from"./integration-icon-DQlMcsez.js";import{f as Tt,h as Pt}from"./chat-context-DV4Qov4z.js";import{b as kt}from"./shell-layout-B70hKdUr.js";import{M as Et}from"./monaco-editor-arl1r71i.js";import{n as At}from"./XCircle-Cuc8nE6i.js";import"./auth-qUspkFR_.js";import"./label-BCF__ROW.js";import"./index-UwFUQNqq.js";import"./sidebar-DRF2fDLx.js";import"./LayoutLeft-i_rhGuA5.js";import"./use-mobile-xDuvUN2d.js";import"./sheet-B-paP53q.js";import"./X-E3DyM7UC.js";import"./ZoomOut-BRkeO1qu.js";import"./Key01-CZ1h7fLN.js";import"./extract-connection-data-KUqDwlNM.js";import"./use-registry-connections-Ch7Aio17.js";import"./use-organization-settings-qUFRQJiW.js";import"./studio-tools-DJSjhq0D.js";import"./Plus-BFXW9Hm0.js";import"./index-CS2bI8tv.js";import"./index-CFJlPpoM.js";import"./popover-CH8yy2uh.js";import"./use-virtual-mcp-kmppTc07.js";import"./ChevronUp-BL1VVdJH.js";import"./SearchMd-CxnmulF7.js";import"./Users03-Cm292zjH.js";import"./use-create-virtual-mcp-W-deafLh.js";import"./use-navigate-to-agent-DOuUJjr4.js";import"./Tool01-CL_8Izc9.js";import"./SwitchHorizontal01-PRhNyd-f.js";import"./Settings02-DTCnN7hH.js";import"./ArrowUpRight-OETO6U7k.js";import"./ZapSquare-BZrjsIpc.js";import"./CheckCircle-CLnUTqL3.js";import"./ChevronDown-Bx4qDl4c.js";import"./ChevronLeft-DTd3BCNc.js";import"./DotsVertical-CN2QyAt6.js";import"./Globe01-QSXapmlK.js";import"./FilterLines-C6-JkzKo.js";import"./Star01-GR0ov5Sc.js";import"./Globe04-3IZPnvlD.js";import"./HardDrive-uvvlNfcr.js";import"./LinkExternal01-BCIEZzze.js";import"./Monitor01-DPI8nCmu.js";import"./Sun-C2NDQLw1.js";import"./Palette-UZ6kBEqD.js";import"./SearchLg-BM8Dh-8n.js";import"./Shield01-CaE-d9vS.js";import"./Stars01-BlizU8cq.js";import"./Trash01-DA6TfyJR.js";import"./Upload01-DPL58cy-.js";import"./User01-Dc_4BfIo.js";import"./Users01-C-jKgPln.js";import"./XClose-jXr-Q3Pi.js";import"./Zap-CLQGhRUa.js";import"./mcp-oauth-B7os1fcw.js";import"./badge-Db7tzVgy.js";import"./hooks-CoRBK0Wo.js";import"./decopilot-sse-pool-CnXnOYzd.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-ai-providers-Dt0kVGXk.js";import"./tab-id-BptcWVWa.js";import"./avatar-MHZ63SNd.js";import"./dialog-DZbMHqk-.js";import"./required-auth-layout-CfUZ7qyj.js";import"./use-org-sso-DH6y6bni.js";import"./index-CobHumLE.js";function Ot(s){const e=y.c(15),{onSave:o,onUndo:n,isDirty:l,isSaving:r,saveLabel:a,undoLabel:c}=s,i=a===void 0?"Save":a,u=c===void 0?"Undo":c;if(!l)return null;let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(rt,{size:14}),e[0]=x):x=e[0];let m;e[1]!==r||e[2]!==n||e[3]!==u?(m=t.jsxs(F,{variant:"outline",size:"sm",onClick:n,disabled:r,"aria-label":u,children:[x,u]}),e[1]=r,e[2]=n,e[3]=u,e[4]=m):m=e[4];let p;e[5]!==r?(p=r?t.jsx(Z,{size:14,className:"animate-spin"}):t.jsx(it,{size:14}),e[5]=r,e[6]=p):p=e[6];let f;e[7]!==r||e[8]!==o||e[9]!==i||e[10]!==p?(f=t.jsxs(F,{variant:"default",size:"sm",onClick:o,disabled:r,"aria-label":i,children:[p,i]}),e[7]=r,e[8]=o,e[9]=i,e[10]=p,e[11]=f):f=e[11];let g;return e[12]!==m||e[13]!==f?(g=t.jsxs(t.Fragment,{children:[m,f]}),e[12]=m,e[13]=f,e[14]=g):g=e[14],g}Ge({title:se().min(1),description:se().nullable(),body:se()});function le(s){for(const e of s.messages??[])if(e.role==="user"&&e.content?.type==="text")return e.content.text??"";return""}function Rt(){const s=window.location.pathname.split("/").filter(Boolean),e=s.findIndex(n=>n==="mcps"),o=e>=0?s[e+1]:void 0;return o?decodeURIComponent(o):void 0}function _t(s){const e=y.c(13),{form:o}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx("div",{className:"text-sm font-medium text-foreground",children:"Details"}),e[0]=n):n=e[0];let l;e[1]!==o.control?(l=t.jsxs("div",{className:"flex flex-col gap-4",children:[n,t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsx(ne,{control:o.control,name:"title",render:zt}),t.jsx(ne,{control:o.control,name:"description",render:Mt})]})]}),e[1]=o.control,e[2]=l):l=e[2];let r,a;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("div",{className:"text-sm font-medium text-foreground",children:"Message"}),a=t.jsx("div",{className:"text-xs text-muted-foreground",children:"This becomes the user message in the prompt."}),e[3]=r,e[4]=a):(r=e[3],a=e[4]);let c;e[5]!==o.control?(c=t.jsxs("div",{className:"flex flex-col gap-2",children:[r,a,t.jsx(ne,{control:o.control,name:"body",render:Dt})]}),e[5]=o.control,e[6]=c):c=e[6];let i;e[7]!==l||e[8]!==c?(i=t.jsxs("div",{className:"h-full py-6 flex flex-col max-w-3xl mx-auto w-full min-w-0 gap-8 overflow-y-auto px-4",children:[l,c]}),e[7]=l,e[8]=c,e[9]=i):i=e[9];let u;return e[10]!==o||e[11]!==i?(u=t.jsx(tt,{...o,children:i}),e[10]=o,e[11]=i,e[12]=u):u=e[12],u}function Dt(s){const{field:e}=s;return t.jsx(de,{children:t.jsx(me,{children:t.jsx(re,{...e,value:e.value??"",placeholder:"Write the prompt message…",className:"min-h-[240px] resize-none text-base leading-relaxed font-normal rounded-xl border border-border bg-muted/20 px-4 py-3 shadow-none focus-visible:ring-0"})})})}function Mt(s){const{field:e}=s;return t.jsxs(de,{children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:"Description"}),t.jsx(me,{children:t.jsx(ue,{...e,value:e.value??"",placeholder:"Add a description…",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function zt(s){const{field:e}=s;return t.jsxs(de,{children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:"Title"}),t.jsx(me,{children:t.jsx(ue,{...e,placeholder:"Untitled prompt",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function Lt(s){const e=y.c(36),{providerId:o,promptId:n}=s,{org:l}=ie(),r=o||null;let a;e[0]!==l.id||e[1]!==l.slug||e[2]!==r?(a={connectionId:r,orgId:l.id,orgSlug:l.slug},e[0]=l.id,e[1]=l.slug,e[2]=r,e[3]=a):a=e[3];const c=ce(a),i=et(o,"PROMPT",n,c),u=Ae(o,"PROMPT",c),x=u.update.isPending;let m;e[4]!==i?(m=i?{title:i.title,description:i.description??null,body:le(i)}:void 0,e[4]=i,e[5]=m):m=e[5];let p;e[6]!==m?(p={values:m},e[6]=m,e[7]=p):p=e[7];const f=Qe(p);let g;e[8]!==f||e[9]!==i?(g=()=>{i&&f.reset({title:i.title,description:i.description??null,body:le(i)})},e[8]=f,e[9]=i,e[10]=g):g=e[10];const S=g;let I;e[11]!==u.update||e[12]!==f||e[13]!==n?(I=f.handleSubmit(async N=>{const A=await u.update.mutateAsync({id:n,data:{title:N.title,description:N.description,arguments:[],icons:[],messages:[{role:"user",content:{type:"text",text:N.body}}]}});f.reset({title:A.title,description:A.description??null,body:le(A)})}),e[11]=u.update,e[12]=f,e[13]=n,e[14]=I):I=e[14];const R=I;if(!i){let N;return e[15]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(Ee,{title:"Prompt not found",description:"This prompt may have been deleted or you may not have access to it."})}),e[15]=N):N=e[15],N}let $;e[16]!==i.title?($=t.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:i.title}),e[16]=i.title,e[17]=$):$=e[17];let E;e[18]!==i.description?(E=i.description?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"•"}),t.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0 max-w-[20ch]",children:i.description})]}):null,e[18]=i.description,e[19]=E):E=e[19];let P;e[20]!==$||e[21]!==E?(P=t.jsx(nt,{children:t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[$,E]})}),e[20]=$,e[21]=E,e[22]=P):P=e[22];let b;e[23]!==R?(b=()=>{R()},e[23]=R,e[24]=b):b=e[24];let w;e[25]!==f.formState.isDirty||e[26]!==x||e[27]!==S||e[28]!==b?(w=t.jsx(st,{children:t.jsx(Ot,{onSave:b,onUndo:S,isDirty:f.formState.isDirty,isSaving:x})}),e[25]=f.formState.isDirty,e[26]=x,e[27]=S,e[28]=b,e[29]=w):w=e[29];let C;e[30]!==f?(C=t.jsx("div",{className:"h-full",children:t.jsx(_t,{form:f})}),e[30]=f,e[31]=C):C=e[31];let k;return e[32]!==w||e[33]!==C||e[34]!==P?(k=t.jsxs(xe,{children:[P,w,C]}),e[32]=w,e[33]=C,e[34]=P,e[35]=k):k=e[35],k}function Ut(s){const e=y.c(4),{itemId:o}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=Rt(),e[0]=n):n=e[0];const l=n;if(!l){let a;return e[1]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(Ee,{title:"Prompt not found",description:"Missing connection information in the current route."})}),e[1]=a):a=e[1],a}let r;return e[2]!==o?(r=t.jsx(Pe,{children:t.jsx(T.Suspense,{fallback:null,children:t.jsx(Lt,{providerId:l,promptId:o})})}),e[2]=o,e[3]=r):r=e[3],r}function _e(s){const e=y.c(8);let o,n;e[0]!==s?({className:o,...n}=s,e[0]=s,e[1]=o,e[2]=n):(o=e[1],n=e[2]);let l;e[3]!==o?(l=V("min-w-0 overflow-hidden",o),e[3]=o,e[4]=l):l=e[4];let r;return e[5]!==n||e[6]!==l?(r=t.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",className:l,...n}),e[5]=n,e[6]=l,e[7]=r):r=e[7],r}function De(s){const e=y.c(8);let o,n;e[0]!==s?({className:o,...n}=s,e[0]=s,e[1]=o,e[2]=n):(o=e[1],n=e[2]);let l;e[3]!==o?(l=V("flex items-center gap-1.5 text-sm sm:gap-2 overflow-hidden",o),e[3]=o,e[4]=l):l=e[4];let r;return e[5]!==n||e[6]!==l?(r=t.jsx("ol",{"data-slot":"breadcrumb-list",className:l,...n}),e[5]=n,e[6]=l,e[7]=r):r=e[7],r}function q(s){const e=y.c(8);let o,n;e[0]!==s?({className:o,...n}=s,e[0]=s,e[1]=o,e[2]=n):(o=e[1],n=e[2]);let l;e[3]!==o?(l=V("inline-flex items-center gap-1.5 min-w-0",o),e[3]=o,e[4]=l):l=e[4];let r;return e[5]!==n||e[6]!==l?(r=t.jsx("li",{"data-slot":"breadcrumb-item",className:l,...n}),e[5]=n,e[6]=l,e[7]=r):r=e[7],r}function Q(s){const e=y.c(10);let o,n,l;e[0]!==s?({asChild:o,className:n,...l}=s,e[0]=s,e[1]=o,e[2]=n,e[3]=l):(o=e[1],n=e[2],l=e[3]);const r=o?Ye:"a";let a;e[4]!==n?(a=V("hover:text-foreground transition-colors truncate",n),e[4]=n,e[5]=a):a=e[5];let c;return e[6]!==r||e[7]!==l||e[8]!==a?(c=t.jsx(r,{"data-slot":"breadcrumb-link",className:a,...l}),e[6]=r,e[7]=l,e[8]=a,e[9]=c):c=e[9],c}function Me(s){const e=y.c(8);let o,n;e[0]!==s?({className:o,...n}=s,e[0]=s,e[1]=o,e[2]=n):(o=e[1],n=e[2]);let l;e[3]!==o?(l=V("text-foreground font-medium truncate",o),e[3]=o,e[4]=l):l=e[4];let r;return e[5]!==n||e[6]!==l?(r=t.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:l,...n}),e[5]=n,e[6]=l,e[7]=r):r=e[7],r}function Y(s){const e=y.c(12);let o,n,l;e[0]!==s?({children:o,className:n,...l}=s,e[0]=s,e[1]=o,e[2]=n,e[3]=l):(o=e[1],n=e[2],l=e[3]);let r;e[4]!==n?(r=V("[&>svg]:size-3.5 text-muted-foreground opacity-50 list-none shrink-0",n),e[4]=n,e[5]=r):r=e[5];let a;e[6]!==o?(a=o??t.jsx(St,{}),e[6]=o,e[7]=a):a=e[7];let c;return e[8]!==l||e[9]!==r||e[10]!==a?(c=t.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:r,...l,children:a}),e[8]=l,e[9]=r,e[10]=a,e[11]=c):c=e[11],c}const Bt=s=>s.replace(/_/g," ").replace(/\b\w/g,e=>e.toLocaleLowerCase());function Ft(s){const e=y.c(11),{toolName:o,connectionId:n,siblings:l,onSelectInstance:r,onBack:a}=s;let c;e[0]!==n?(c={connectionId:n},e[0]=n,e[1]=c):c=e[1];const i=wt(c);if(!i.isAuthenticated){let m;return e[2]!==i.supportsOAuth||e[3]!==a?(m=t.jsx("div",{className:"flex h-full items-center justify-center",children:i.supportsOAuth?t.jsx(ot,{onAuthenticate:()=>a(),buttonText:"Go back to authenticate"}):t.jsx(lt,{hasReadme:!1})}),e[2]=i.supportsOAuth,e[3]=a,e[4]=m):m=e[4],m}const u=`${n}:${o}`;let x;return e[5]!==n||e[6]!==r||e[7]!==l||e[8]!==u||e[9]!==o?(x=t.jsx(Vt,{toolName:o,connectionId:n,siblings:l,onSelectInstance:r},u),e[5]=n,e[6]=r,e[7]=l,e[8]=u,e[9]=o,e[10]=x):x=e[10],x}function Vt({toolName:s,connectionId:e,siblings:o,onSelectInstance:n}){const{replayId:l}=Ze({strict:!1}),r=(()=>{if(!l)return null;const d=`replay-${l}`,h=sessionStorage.getItem(d);if(!h)return null;sessionStorage.removeItem(d);try{return JSON.parse(h)}catch{return null}})(),a=(()=>{if(!r)return null;const d={};for(const[h,v]of Object.entries(r))v!==null&&typeof v=="object"?d[h]=JSON.stringify(v,null,2):d[h]=v;return d})(),[c,i]=T.useState(a??{}),[u,x]=T.useState(r?JSON.stringify(r,null,2):"{}"),[m,p]=T.useState(null),[f,g]=T.useState(null),[S,I]=T.useState(null),[R,$]=T.useState(null),[E,P]=T.useState(!1),[b,w]=T.useState(null),{org:C}=ie(),k=Oe(e),N=Tt(),A=Pt(),{setChatOpen:U}=kt(),z=`${e}:${s}`,_=ce({connectionId:e,orgId:C.id,orgSlug:C.slug}),L=It({client:_}),j=L.data?.tools?.find(d=>d.name===s),O=ut(j?._meta),J=d=>{if(!N)return;const h=$t(d.content);h.content.length>0&&(U(!0),N.sendMessage({tiptapDoc:h}))},[D,X]=T.useState("json"),[ze,Le]=T.useState(!1);O&&!ze&&(X("ui"),Le(!0));const pe=j?.inputSchema?.properties,fe=pe?Object.keys(pe):[],H=fe.length>0,K={};if(H&&j?.inputSchema?.properties)for(const d of fe)K[d]=j.inputSchema.required?.includes(d)?"":void 0;const ee=d=>Object.prototype.hasOwnProperty.call(c,d),Ue=async()=>{P(!0),$(null),p(null),g(null),I(null),w(null);const d=performance.now();try{if(!_)throw new Error("MCP client is not available");const h=H?{...K,...c}:(()=>{const M=u.trim();if(!M)return{};const B=JSON.parse(M);if(B&&typeof B=="object")return B;throw new Error("Raw JSON input must be an object.")})();H&&j?.inputSchema?.properties&&Object.entries(j.inputSchema.properties).forEach(([M,B])=>{if((B.type==="object"||B.type==="array")&&typeof h[M]=="string")try{h[M]=JSON.parse(h[M])}catch{}else if((B.type==="number"||B.type==="integer")&&typeof h[M]=="string"&&h[M]!==""){const je=Number(h[M]);Number.isNaN(je)||(h[M]=je)}});const v=await _.callTool({name:s,arguments:h}),W=v.structuredContent??v,He=performance.now(),Ke=Math.round(He-d);p(W),g(v),I(h);const We=JSON.stringify(W),ge=new TextEncoder().encode(We).length;w({duration:`${Ke}ms`,bytes:`${ge} bytes`,tokens:`~${Math.ceil(ge/4)} tokens`,cost:"$0.0000"})}catch(h){const v=h instanceof Error?h.message:String(h);$(v||"Unknown error occurred");const W=performance.now();w({duration:`${Math.round(W-d)}ms`})}finally{P(!1)}},te=(d,h)=>{i(v=>({...v,[d]:h}))},Be=()=>{p(null),g(null),I(null),$(null),w(null)},Fe=j?.name??Bt(s),Ve=t.jsx(_e,{children:t.jsxs(De,{children:[t.jsx(q,{children:t.jsx(Q,{asChild:!0,children:t.jsx(G,{to:"/$org/settings/connections",params:{org:C.slug},children:"Connections"})})}),t.jsx(Y,{}),k&&t.jsxs(t.Fragment,{children:[t.jsx(q,{children:t.jsx(Q,{asChild:!0,children:t.jsx(G,{to:"/$org/settings/connections/$appSlug",params:{org:C.slug,appSlug:yt(k)},search:{tab:"tools"},children:k.title})})}),t.jsx(Y,{})]}),t.jsx(q,{children:t.jsx(Me,{children:Fe})})]})}),he=o.length>1&&t.jsxs(ve,{value:e,onValueChange:n,children:[t.jsx(Se,{className:"h-8 w-auto min-w-[200px]",children:t.jsx(ye,{})}),t.jsx(we,{children:o.map(d=>t.jsx(oe,{value:d.id,children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Te,{icon:d.icon,name:d.title,size:"xs",className:"shrink-0"}),d.title]})},d.id))})]}),Je=t.jsxs("div",{className:"flex flex-col p-6 gap-4 overflow-auto",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h2",{className:"text-sm font-semibold text-foreground uppercase tracking-wide",children:"Parameters"}),j?.inputSchema?.required&&j.inputSchema.required.length>0&&t.jsxs("span",{className:"text-xs text-muted-foreground",children:[t.jsx("span",{className:"text-red-500",children:"*"})," Required"]})]}),t.jsx("div",{className:"space-y-4",children:H&&j?.inputSchema?.properties?Object.entries(j.inputSchema.properties).map(([d,h])=>t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("label",{className:"text-sm font-medium leading-none flex items-center gap-1.5",children:[d,j.inputSchema?.required?.includes(d)&&t.jsx("span",{className:"text-red-500 text-xs",children:"*"})]}),t.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:h.type})]}),h.description&&t.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:h.description}),h.type==="object"||h.type==="array"?t.jsx(re,{className:"font-mono text-xs",value:ee(d)?c[d]??"":K[d]??"",onChange:v=>te(d,v.target.value),placeholder:`Enter ${d} as JSON...`,rows:3}):h.type==="boolean"?t.jsxs(ve,{value:ee(d)?String(c[d]??""):"",onValueChange:v=>te(d,v==="true"),children:[t.jsx(Se,{children:t.jsx(ye,{placeholder:"Select true or false..."})}),t.jsxs(we,{children:[t.jsx(oe,{value:"true",children:"true"}),t.jsx(oe,{value:"false",children:"false"})]})]}):t.jsx(ue,{value:ee(d)?c[d]??"":K[d]??"",onChange:v=>te(d,v.target.value),placeholder:`Enter ${d}...`})]},d)):j?.inputSchema&&!H?t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-sm font-medium",children:"Raw JSON Input"}),t.jsx(re,{className:"font-mono text-xs min-h-[120px]",value:u,onChange:d=>x(d.target.value),placeholder:'e.g. { "foo": "bar" }'})]}):t.jsx("div",{className:"flex items-center justify-center p-8 bg-muted/30 rounded-lg border border-dashed border-border",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:"No parameters required"})})}),t.jsx("div",{className:"flex items-center gap-2 pt-2",children:E?t.jsxs(F,{size:"sm",variant:"destructive",className:"h-8 gap-2",onClick:Be,children:[t.jsx(at,{className:"h-3.5 w-3.5"}),"Cancel"]}):t.jsxs(F,{size:"sm",variant:"default",className:"h-8 gap-2",onClick:Ue,children:[t.jsx(vt,{className:"h-3.5 w-3.5 fill-current"}),"Execute Tool"]})})]}),qe=t.jsxs("div",{className:"flex flex-col @3xl:h-full @3xl:overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 h-14 border-b border-border bg-background",children:[t.jsx("h2",{className:"text-sm font-medium text-foreground uppercase tracking-wide",children:"Result"}),t.jsxs("div",{className:"flex items-center gap-3",children:[b&&t.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(bt,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-foreground",children:b.duration})]}),b.tokens&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(ct,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-foreground",children:b.tokens})]}),b.bytes&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(dt,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-foreground",children:b.bytes})]}),b.cost&&t.jsx("div",{className:"flex items-center gap-1.5",children:t.jsx("span",{className:"font-mono text-foreground",children:b.cost})})]}),O&&t.jsx(gt,{children:t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsxs(Ce,{children:[t.jsx(Ie,{asChild:!0,children:t.jsx(F,{size:"icon",variant:D==="ui"?"secondary":"ghost",className:"h-8 w-8",onClick:()=>X("ui"),children:t.jsx(mt,{size:14})})}),t.jsx($e,{children:"Interactive view"})]}),t.jsxs(Ce,{children:[t.jsx(Ie,{asChild:!0,children:t.jsx(F,{size:"icon",variant:D==="json"?"secondary":"ghost",className:"h-8 w-8",onClick:()=>X("json"),children:t.jsx(be,{size:14})})}),t.jsx($e,{children:"JSON view"})]})]})})]})]}),R&&t.jsx("div",{className:"px-6 py-4 bg-background",children:t.jsx(pt,{variant:"destructive",children:t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(jt,{className:"h-4 w-4"}),t.jsx(ft,{className:"mb-0",children:"Execution Failed"})]}),t.jsx(ht,{className:"text-xs text-destructive",children:R})]})})}),t.jsx("div",{className:"relative flex-1 min-h-[400px] @3xl:min-h-0 @3xl:overflow-auto bg-muted/50",children:O&&D==="ui"&&_?t.jsx(T.Suspense,{fallback:t.jsx("div",{className:"flex items-center justify-center h-48",children:t.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[t.jsx("div",{className:"size-4 border-2 border-current border-t-transparent rounded-full animate-spin"}),t.jsx("span",{className:"text-sm",children:"Loading app..."})]})}),children:t.jsx(xt,{resourceURI:O,toolInfo:j?{tool:j}:void 0,toolInput:S??void 0,toolResult:f??void 0,displayMode:"fullscreen",minHeight:Ne.view.minHeight,maxHeight:Ne.view.maxHeight,client:_,onMessage:J,onUpdateModelContext:d=>A?.setAppContext(z,d),onTeardown:()=>A?.clearAppContext(z),className:"h-full"})}):m?t.jsxs(t.Fragment,{children:[t.jsx(Et,{code:JSON.stringify(m,null,2),language:"json",height:"100%",readOnly:!0}),t.jsx(F,{size:"icon",variant:"ghost",className:"absolute top-4 right-4 h-8 w-8 bg-background/80 hover:bg-background border border-border shadow-sm",onClick:()=>{navigator.clipboard.writeText(JSON.stringify(m,null,2)),Xe.success("Copied to clipboard")},children:t.jsx(Nt,{className:"h-3.5 w-3.5"})})]}):t.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-muted-foreground",children:[t.jsx(be,{className:"h-12 w-12 mb-3 opacity-40"}),t.jsx("p",{className:"text-sm",children:"Run the tool to see results"})]})})]});return t.jsx(xe,{breadcrumb:Ve,children:t.jsxs("div",{className:"flex flex-col h-full overflow-hidden @container",children:[t.jsxs("div",{className:"flex flex-col gap-3 py-7 px-8 bg-background border-b border-border shrink-0",children:[t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx(Te,{icon:k?.icon||null,name:k?.title||s,size:"xl",className:"shrink-0"}),t.jsx("h1",{className:"text-xl font-semibold tracking-tight text-foreground leading-none truncate",children:s}),t.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1 bg-muted/50 rounded-md h-fit shrink-0",children:[L.isSuccess?t.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-green-500 animate-pulse shrink-0"}):L.isLoading?t.jsx(Z,{size:10,className:"animate-spin text-yellow-500 shrink-0"}):t.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-red-500 shrink-0"}),t.jsx("span",{className:"font-mono text-xs capitalize text-muted-foreground leading-none",children:L.isSuccess?"ready":L.isLoading?"connecting":"error"})]}),t.jsx(Ct,{annotations:j?.annotations,_meta:j?._meta}),t.jsx("div",{className:"hidden @3xl:flex items-center ml-auto shrink-0",children:he})]}),t.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:j?.description||"No description available"})]}),o.length>1&&t.jsxs("div",{className:"flex @3xl:hidden items-center gap-3 px-8 py-3 border-b border-border",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground shrink-0",children:"Instance"}),he]}),t.jsx("div",{className:"flex-1 overflow-auto @3xl:overflow-hidden",children:t.jsxs("div",{className:"grid grid-cols-1 @3xl:grid-cols-[minmax(0,2fr)_minmax(0,5fr)] @3xl:h-full @3xl:grid-rows-1",children:[t.jsx("div",{className:"@3xl:border-r border-border @3xl:overflow-auto",children:Je}),qe]})})]})})}function Jt(s){const e=y.c(10),{itemId:o,siblings:n,onBack:l}=s,[r,a]=T.useState(n[0]?.id??"");let c;e[0]!==r||e[1]!==n?(c=n.find(p=>p.id===r)?.id??n[0]?.id??"",e[0]=r,e[1]=n,e[2]=c):c=e[2];const i=c;if(!Oe(i||void 0)||!i){let p;return e[3]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[t.jsx("h3",{className:"text-lg font-semibold",children:"Connection not found"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"This connection may have been deleted or you may not have access."})]})}),e[3]=p):p=e[3],p}let x;e[4]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(Z,{size:32,className:"animate-spin text-muted-foreground"})}),e[4]=x):x=e[4];let m;return e[5]!==i||e[6]!==l||e[7]!==n||e[8]!==o?(m=t.jsx(T.Suspense,{fallback:x,children:t.jsx(Ft,{toolName:o,connectionId:i,siblings:n,onSelectInstance:a,onBack:l})}),e[5]=i,e[6]=l,e[7]=n,e[8]=o,e[9]=m):m=e[9],m}function qt(s){const e=y.c(21),{icon:o,illustration:n,title:l,description:r,buttonProps:a,buttonComponent:c,className:i,children:u}=s;let x;e[0]!==i?(x=V("flex flex-col items-center justify-center py-16 text-center",i),e[0]=i,e[1]=x):x=e[1];let m;e[2]!==o||e[3]!==n?(m=n?t.jsx("div",{className:"mb-4 text-muted-foreground/50",children:n}):o?t.jsx("div",{className:"mb-4 flex h-12 w-12 items-center justify-center rounded-xl bg-muted/50 text-muted-foreground",children:o}):null,e[2]=o,e[3]=n,e[4]=m):m=e[4];let p;e[5]!==l?(p=t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:l}),e[5]=l,e[6]=p):p=e[6];let f;e[7]!==r?(f=r&&t.jsx("div",{className:"text-sm text-muted-foreground",children:r}),e[7]=r,e[8]=f):f=e[8];let g;e[9]!==p||e[10]!==f?(g=t.jsxs("div",{className:"flex flex-col items-center gap-1 max-w-sm",children:[p,f]}),e[9]=p,e[10]=f,e[11]=g):g=e[11];let S;e[12]!==c||e[13]!==a?(S=(c??a)&&t.jsx("div",{className:"mt-4",children:c??(a&&t.jsx(F,{size:"sm",className:V(a?.className),...a}))}),e[12]=c,e[13]=a,e[14]=S):S=e[14];let I;return e[15]!==u||e[16]!==x||e[17]!==m||e[18]!==g||e[19]!==S?(I=t.jsxs("div",{className:x,children:[m,g,S,u]}),e[15]=u,e[16]=x,e[17]=m,e[18]=g,e[19]=S,e[20]=I):I=e[20],I}const Ht={prompt:Ut};function Kt(){const s=y.c(9),e=ke();let o;s[0]===Symbol.for("react.memo_cache_sentinel")?(o={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId"},s[0]=o):o=s[0];const n=ae(o),l=decodeURIComponent(n.itemId);let r;s[1]!==n.appSlug?(r={slug:n.appSlug},s[1]=n.appSlug,s[2]=r):r=s[2];const a=Re(r);let c;s[3]!==e.history?(c=()=>{e.history.back()},s[3]=e.history,s[4]=c):c=s[4];const i=c,u=Wt;let x;return s[5]!==i||s[6]!==l||s[7]!==a?(x=t.jsx(Jt,{itemId:l,siblings:a,onBack:i,onUpdate:u}),s[5]=i,s[6]=l,s[7]=a,s[8]=x):x=s[8],x}async function Wt(s){return Promise.resolve()}function Gt(s){return s.toLowerCase().split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function Qt(){const s=y.c(41),e=ke();let o;s[0]===Symbol.for("react.memo_cache_sentinel")?(o={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId"},s[0]=o):o=s[0];const n=ae(o),l=decodeURIComponent(n.collectionName),r=decodeURIComponent(n.itemId);let a;s[1]!==e.history?(a=()=>{e.history.back()},s[1]=e.history,s[2]=a):a=s[2];const c=a,{org:i}=ie();let u;s[3]!==n.appSlug?(u={slug:n.appSlug},s[3]=n.appSlug,s[4]=u):u=s[4];const m=Re(u)[0]??null,p=m?.id??"",f=p||"no-connection",g=p??null;let S;s[5]!==i.id||s[6]!==i.slug||s[7]!==g?(S={connectionId:g,orgId:i.id,orgSlug:i.slug},s[5]=i.id,s[6]=i.slug,s[7]=g,s[8]=S):S=s[8];const I=ce(S),R=Ae(f,l,I);let $;s[9]!==R||s[10]!==r?($=async D=>{r&&await R.update.mutateAsync({id:r,data:D})},s[9]=R,s[10]=r,s[11]=$):$=s[11];const E=$;let P;s[12]!==l?(P=l?.toLowerCase(),s[12]=l,s[13]=P):P=s[13];const b=P,w=b&&Ht[b];let C;s[14]!==l?(C=Gt(l),s[14]=l,s[15]=C):C=s[15];const k=C;let N;s[16]!==i.slug?(N=t.jsx(q,{children:t.jsx(Q,{asChild:!0,children:t.jsx(G,{to:"/$org/settings/connections",params:{org:i.slug},children:"Connections"})})}),s[16]=i.slug,s[17]=N):N=s[17];let A;s[18]===Symbol.for("react.memo_cache_sentinel")?(A=t.jsx(Y,{}),s[18]=A):A=s[18];let U;s[19]!==l||s[20]!==m||s[21]!==i.slug||s[22]!==n.appSlug?(U=m&&t.jsxs(t.Fragment,{children:[t.jsx(q,{children:t.jsx(Q,{asChild:!0,children:t.jsx(G,{to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:n.appSlug},search:{tab:l},children:m.title})})}),t.jsx(Y,{})]}),s[19]=l,s[20]=m,s[21]=i.slug,s[22]=n.appSlug,s[23]=U):U=s[23];let z;s[24]!==k?(z=t.jsx(q,{children:t.jsx(Me,{children:k})}),s[24]=k,s[25]=z):z=s[25];let _;s[26]!==U||s[27]!==z||s[28]!==N?(_=t.jsx(_e,{children:t.jsxs(De,{children:[N,A,U,z]})}),s[26]=U,s[27]=z,s[28]=N,s[29]=_):_=s[29];const L=_;if(w){let D;return s[30]!==w||s[31]!==c||s[32]!==E||s[33]!==r?(D=t.jsx(w,{itemId:r,onBack:c,onUpdate:E}),s[30]=w,s[31]=c,s[32]=E,s[33]=r,s[34]=D):D=s[34],D}let j;s[35]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx(At,{size:36,className:"text-muted-foreground"}),s[35]=j):j=s[35];let O;s[36]!==c?(O=t.jsx(qt,{icon:j,title:"No component defined",description:"No component for this collection was defined",buttonProps:{onClick:c,children:"Go back"}}),s[36]=c,s[37]=O):O=s[37];let J;return s[38]!==L||s[39]!==O?(J=t.jsx(xe,{breadcrumb:L,children:O}),s[38]=L,s[39]=O,s[40]=J):J=s[40],J}function Yt(){const s=y.c(3);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId"},s[0]=e):e=s[0];const o=ae(e);if(decodeURIComponent(o.collectionName)==="tools"){let a;return s[1]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(Kt,{}),s[1]=a):a=s[1],a}let r;return s[2]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(Qt,{}),s[2]=r):r=s[2],r}function Mn(){const s=y.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Pe,{children:t.jsx(T.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(Z,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(Yt,{})})}),s[0]=e):e=s[0],e}export{Mn as default};
|
|
1
|
+
import{c as y,j as t,B as F,i as Z,o as Ge,s as se,E as Pe,r as T,D as ie,p as Qe,l as V,bg as Ye,u as Ze,G,t as Xe,e as ae,b2 as ke}from"./index-BeeLZolL.js";import{E as Ee}from"./empty-state-CV8YB8eL.js";import{u as et,a as Ae}from"./use-collections-BGIHIeWt.js";import{u as ce}from"./use-mcp-client-iaudT61I.js";import{F as ne,a as tt,b as de,d as me}from"./form-B5uVKHZJ.js";import{I as ue}from"./input-LkQXvLAa.js";import{T as re}from"./textarea-C4dYwC8A.js";import{a as st,b as nt,V as xe,O as ot,M as lt}from"./index-CRjEhu3F.js";import{ak as rt,y as it,a9 as at,al as ct,Z as dt,am as mt,N as be}from"./agent-icon-aTZ0WGYG.js";import{g as ut,M as xt,a as Ne}from"./types-DKix5qGt.js";import{A as pt,a as ft,b as ht}from"./alert-B0Dp6PoX.js";import{d as ve,b as Se,c as ye,S as we,a as oe}from"./select-BkOEUkbJ.js";import{c as gt,b as Ce,T as Ie,a as $e}from"./tooltip-Ba5WYryG.js";import{i as jt}from"./AlertCircle-C9EcTRk1.js";import{s as bt}from"./Stars02-BRU8YBIB.js";import{a as Nt}from"./Eye-BXLPt3hG.js";import{i as vt}from"./Play-BYLMPWCh.js";import{i as St}from"./ChevronRight-CyT2euoR.js";import{g as yt}from"./connection-slug-eyAPH6o3.js";import{u as wt,T as Ct}from"./index-B7mJQDwu.js";import{a as Oe,u as Re}from"./use-connection-C1WF2ABg.js";import{a as It}from"./use-mcp-tools-DfcIioGC.js";import{c as $t}from"./content-blocks-o63cs2vh.js";import{I as Te}from"./integration-icon-BFj5Hgg2.js";import{f as Tt,h as Pt}from"./chat-context-BOt5-jK-.js";import{b as kt}from"./shell-layout-BoazOREx.js";import{M as Et}from"./monaco-editor-CEpx4sr1.js";import{n as At}from"./XCircle--tkqwpM7.js";import"./auth-DvtjPuDG.js";import"./label-B3e_Uel8.js";import"./index-CNVqZc4R.js";import"./sidebar-BdrG3Qa1.js";import"./LayoutLeft-BQaqFKj6.js";import"./use-mobile-CmTsKIc6.js";import"./sheet-bRkswz3e.js";import"./X-C84T4GrV.js";import"./ZoomOut-CuqN1_dw.js";import"./Key01-BGS-_-TQ.js";import"./extract-connection-data-WCh9ShTJ.js";import"./use-registry-connections-ZETZM_i3.js";import"./use-organization-settings-Bjm9SZNS.js";import"./studio-tools-CHbEcMpW.js";import"./Plus-CSM0Gdnx.js";import"./index-CBoPTCQ5.js";import"./index-Ba_weT-5.js";import"./popover-DHxWzxMm.js";import"./use-virtual-mcp-BcesJFjl.js";import"./ChevronUp-CxQvq7Kl.js";import"./SearchMd-1gE2e_l6.js";import"./Users03-a1897IbE.js";import"./use-create-virtual-mcp-C-fyx5fa.js";import"./use-navigate-to-agent-Dn1mURgE.js";import"./Tool01-0YhkCkB5.js";import"./SwitchHorizontal01-DoI1DhsF.js";import"./Settings02-CzuPYYwF.js";import"./ArrowUpRight-6Dz_XkMa.js";import"./ZapSquare-D1OOZQrN.js";import"./CheckCircle-kwc45JPK.js";import"./ChevronDown-D7GDZ7wu.js";import"./ChevronLeft-DimzbDID.js";import"./DotsVertical-BFENe2Dt.js";import"./Globe01-CSh9aag5.js";import"./FilterLines-C0tlpzHG.js";import"./Star01-DFu1Ny2B.js";import"./Globe04-Do4YAUSY.js";import"./HardDrive-DnqhEbjC.js";import"./LinkExternal01-C_4O-Sjm.js";import"./Monitor01-BerC6VZd.js";import"./Sun-BnUHB5Qj.js";import"./Palette-gJqbN1eT.js";import"./SearchLg-dtJyWy2t.js";import"./Shield01-CbgaHtai.js";import"./Stars01-DkLv1n8B.js";import"./Trash01-DnZnIRtK.js";import"./Upload01-q49A0pPe.js";import"./User01-B60sPq_u.js";import"./Users01-DwmjwTDW.js";import"./XClose-BESokz6G.js";import"./Zap-CfBVsJkz.js";import"./mcp-oauth-BtLTrokF.js";import"./badge-BCyg4w-e.js";import"./hooks-LBSFR4MW.js";import"./decopilot-sse-pool-Cz_XAdFl.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-ai-providers-CmTk0nWY.js";import"./tab-id-BptcWVWa.js";import"./avatar-Bjp6G7so.js";import"./dialog-Bh4QMQdt.js";import"./required-auth-layout-CEwUwqrL.js";import"./use-org-sso-DLjtx9OU.js";import"./index-CwnG-amZ.js";function Ot(s){const e=y.c(15),{onSave:o,onUndo:n,isDirty:l,isSaving:r,saveLabel:a,undoLabel:c}=s,i=a===void 0?"Save":a,u=c===void 0?"Undo":c;if(!l)return null;let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(rt,{size:14}),e[0]=x):x=e[0];let m;e[1]!==r||e[2]!==n||e[3]!==u?(m=t.jsxs(F,{variant:"outline",size:"sm",onClick:n,disabled:r,"aria-label":u,children:[x,u]}),e[1]=r,e[2]=n,e[3]=u,e[4]=m):m=e[4];let p;e[5]!==r?(p=r?t.jsx(Z,{size:14,className:"animate-spin"}):t.jsx(it,{size:14}),e[5]=r,e[6]=p):p=e[6];let f;e[7]!==r||e[8]!==o||e[9]!==i||e[10]!==p?(f=t.jsxs(F,{variant:"default",size:"sm",onClick:o,disabled:r,"aria-label":i,children:[p,i]}),e[7]=r,e[8]=o,e[9]=i,e[10]=p,e[11]=f):f=e[11];let g;return e[12]!==m||e[13]!==f?(g=t.jsxs(t.Fragment,{children:[m,f]}),e[12]=m,e[13]=f,e[14]=g):g=e[14],g}Ge({title:se().min(1),description:se().nullable(),body:se()});function le(s){for(const e of s.messages??[])if(e.role==="user"&&e.content?.type==="text")return e.content.text??"";return""}function Rt(){const s=window.location.pathname.split("/").filter(Boolean),e=s.findIndex(n=>n==="mcps"),o=e>=0?s[e+1]:void 0;return o?decodeURIComponent(o):void 0}function _t(s){const e=y.c(13),{form:o}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx("div",{className:"text-sm font-medium text-foreground",children:"Details"}),e[0]=n):n=e[0];let l;e[1]!==o.control?(l=t.jsxs("div",{className:"flex flex-col gap-4",children:[n,t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsx(ne,{control:o.control,name:"title",render:zt}),t.jsx(ne,{control:o.control,name:"description",render:Mt})]})]}),e[1]=o.control,e[2]=l):l=e[2];let r,a;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("div",{className:"text-sm font-medium text-foreground",children:"Message"}),a=t.jsx("div",{className:"text-xs text-muted-foreground",children:"This becomes the user message in the prompt."}),e[3]=r,e[4]=a):(r=e[3],a=e[4]);let c;e[5]!==o.control?(c=t.jsxs("div",{className:"flex flex-col gap-2",children:[r,a,t.jsx(ne,{control:o.control,name:"body",render:Dt})]}),e[5]=o.control,e[6]=c):c=e[6];let i;e[7]!==l||e[8]!==c?(i=t.jsxs("div",{className:"h-full py-6 flex flex-col max-w-3xl mx-auto w-full min-w-0 gap-8 overflow-y-auto px-4",children:[l,c]}),e[7]=l,e[8]=c,e[9]=i):i=e[9];let u;return e[10]!==o||e[11]!==i?(u=t.jsx(tt,{...o,children:i}),e[10]=o,e[11]=i,e[12]=u):u=e[12],u}function Dt(s){const{field:e}=s;return t.jsx(de,{children:t.jsx(me,{children:t.jsx(re,{...e,value:e.value??"",placeholder:"Write the prompt message…",className:"min-h-[240px] resize-none text-base leading-relaxed font-normal rounded-xl border border-border bg-muted/20 px-4 py-3 shadow-none focus-visible:ring-0"})})})}function Mt(s){const{field:e}=s;return t.jsxs(de,{children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:"Description"}),t.jsx(me,{children:t.jsx(ue,{...e,value:e.value??"",placeholder:"Add a description…",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function zt(s){const{field:e}=s;return t.jsxs(de,{children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:"Title"}),t.jsx(me,{children:t.jsx(ue,{...e,placeholder:"Untitled prompt",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function Lt(s){const e=y.c(36),{providerId:o,promptId:n}=s,{org:l}=ie(),r=o||null;let a;e[0]!==l.id||e[1]!==l.slug||e[2]!==r?(a={connectionId:r,orgId:l.id,orgSlug:l.slug},e[0]=l.id,e[1]=l.slug,e[2]=r,e[3]=a):a=e[3];const c=ce(a),i=et(o,"PROMPT",n,c),u=Ae(o,"PROMPT",c),x=u.update.isPending;let m;e[4]!==i?(m=i?{title:i.title,description:i.description??null,body:le(i)}:void 0,e[4]=i,e[5]=m):m=e[5];let p;e[6]!==m?(p={values:m},e[6]=m,e[7]=p):p=e[7];const f=Qe(p);let g;e[8]!==f||e[9]!==i?(g=()=>{i&&f.reset({title:i.title,description:i.description??null,body:le(i)})},e[8]=f,e[9]=i,e[10]=g):g=e[10];const S=g;let I;e[11]!==u.update||e[12]!==f||e[13]!==n?(I=f.handleSubmit(async N=>{const A=await u.update.mutateAsync({id:n,data:{title:N.title,description:N.description,arguments:[],icons:[],messages:[{role:"user",content:{type:"text",text:N.body}}]}});f.reset({title:A.title,description:A.description??null,body:le(A)})}),e[11]=u.update,e[12]=f,e[13]=n,e[14]=I):I=e[14];const R=I;if(!i){let N;return e[15]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(Ee,{title:"Prompt not found",description:"This prompt may have been deleted or you may not have access to it."})}),e[15]=N):N=e[15],N}let $;e[16]!==i.title?($=t.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:i.title}),e[16]=i.title,e[17]=$):$=e[17];let E;e[18]!==i.description?(E=i.description?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"•"}),t.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0 max-w-[20ch]",children:i.description})]}):null,e[18]=i.description,e[19]=E):E=e[19];let P;e[20]!==$||e[21]!==E?(P=t.jsx(nt,{children:t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[$,E]})}),e[20]=$,e[21]=E,e[22]=P):P=e[22];let b;e[23]!==R?(b=()=>{R()},e[23]=R,e[24]=b):b=e[24];let w;e[25]!==f.formState.isDirty||e[26]!==x||e[27]!==S||e[28]!==b?(w=t.jsx(st,{children:t.jsx(Ot,{onSave:b,onUndo:S,isDirty:f.formState.isDirty,isSaving:x})}),e[25]=f.formState.isDirty,e[26]=x,e[27]=S,e[28]=b,e[29]=w):w=e[29];let C;e[30]!==f?(C=t.jsx("div",{className:"h-full",children:t.jsx(_t,{form:f})}),e[30]=f,e[31]=C):C=e[31];let k;return e[32]!==w||e[33]!==C||e[34]!==P?(k=t.jsxs(xe,{children:[P,w,C]}),e[32]=w,e[33]=C,e[34]=P,e[35]=k):k=e[35],k}function Ut(s){const e=y.c(4),{itemId:o}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=Rt(),e[0]=n):n=e[0];const l=n;if(!l){let a;return e[1]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(Ee,{title:"Prompt not found",description:"Missing connection information in the current route."})}),e[1]=a):a=e[1],a}let r;return e[2]!==o?(r=t.jsx(Pe,{children:t.jsx(T.Suspense,{fallback:null,children:t.jsx(Lt,{providerId:l,promptId:o})})}),e[2]=o,e[3]=r):r=e[3],r}function _e(s){const e=y.c(8);let o,n;e[0]!==s?({className:o,...n}=s,e[0]=s,e[1]=o,e[2]=n):(o=e[1],n=e[2]);let l;e[3]!==o?(l=V("min-w-0 overflow-hidden",o),e[3]=o,e[4]=l):l=e[4];let r;return e[5]!==n||e[6]!==l?(r=t.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",className:l,...n}),e[5]=n,e[6]=l,e[7]=r):r=e[7],r}function De(s){const e=y.c(8);let o,n;e[0]!==s?({className:o,...n}=s,e[0]=s,e[1]=o,e[2]=n):(o=e[1],n=e[2]);let l;e[3]!==o?(l=V("flex items-center gap-1.5 text-sm sm:gap-2 overflow-hidden",o),e[3]=o,e[4]=l):l=e[4];let r;return e[5]!==n||e[6]!==l?(r=t.jsx("ol",{"data-slot":"breadcrumb-list",className:l,...n}),e[5]=n,e[6]=l,e[7]=r):r=e[7],r}function q(s){const e=y.c(8);let o,n;e[0]!==s?({className:o,...n}=s,e[0]=s,e[1]=o,e[2]=n):(o=e[1],n=e[2]);let l;e[3]!==o?(l=V("inline-flex items-center gap-1.5 min-w-0",o),e[3]=o,e[4]=l):l=e[4];let r;return e[5]!==n||e[6]!==l?(r=t.jsx("li",{"data-slot":"breadcrumb-item",className:l,...n}),e[5]=n,e[6]=l,e[7]=r):r=e[7],r}function Q(s){const e=y.c(10);let o,n,l;e[0]!==s?({asChild:o,className:n,...l}=s,e[0]=s,e[1]=o,e[2]=n,e[3]=l):(o=e[1],n=e[2],l=e[3]);const r=o?Ye:"a";let a;e[4]!==n?(a=V("hover:text-foreground transition-colors truncate",n),e[4]=n,e[5]=a):a=e[5];let c;return e[6]!==r||e[7]!==l||e[8]!==a?(c=t.jsx(r,{"data-slot":"breadcrumb-link",className:a,...l}),e[6]=r,e[7]=l,e[8]=a,e[9]=c):c=e[9],c}function Me(s){const e=y.c(8);let o,n;e[0]!==s?({className:o,...n}=s,e[0]=s,e[1]=o,e[2]=n):(o=e[1],n=e[2]);let l;e[3]!==o?(l=V("text-foreground font-medium truncate",o),e[3]=o,e[4]=l):l=e[4];let r;return e[5]!==n||e[6]!==l?(r=t.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:l,...n}),e[5]=n,e[6]=l,e[7]=r):r=e[7],r}function Y(s){const e=y.c(12);let o,n,l;e[0]!==s?({children:o,className:n,...l}=s,e[0]=s,e[1]=o,e[2]=n,e[3]=l):(o=e[1],n=e[2],l=e[3]);let r;e[4]!==n?(r=V("[&>svg]:size-3.5 text-muted-foreground opacity-50 list-none shrink-0",n),e[4]=n,e[5]=r):r=e[5];let a;e[6]!==o?(a=o??t.jsx(St,{}),e[6]=o,e[7]=a):a=e[7];let c;return e[8]!==l||e[9]!==r||e[10]!==a?(c=t.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:r,...l,children:a}),e[8]=l,e[9]=r,e[10]=a,e[11]=c):c=e[11],c}const Bt=s=>s.replace(/_/g," ").replace(/\b\w/g,e=>e.toLocaleLowerCase());function Ft(s){const e=y.c(11),{toolName:o,connectionId:n,siblings:l,onSelectInstance:r,onBack:a}=s;let c;e[0]!==n?(c={connectionId:n},e[0]=n,e[1]=c):c=e[1];const i=wt(c);if(!i.isAuthenticated){let m;return e[2]!==i.supportsOAuth||e[3]!==a?(m=t.jsx("div",{className:"flex h-full items-center justify-center",children:i.supportsOAuth?t.jsx(ot,{onAuthenticate:()=>a(),buttonText:"Go back to authenticate"}):t.jsx(lt,{hasReadme:!1})}),e[2]=i.supportsOAuth,e[3]=a,e[4]=m):m=e[4],m}const u=`${n}:${o}`;let x;return e[5]!==n||e[6]!==r||e[7]!==l||e[8]!==u||e[9]!==o?(x=t.jsx(Vt,{toolName:o,connectionId:n,siblings:l,onSelectInstance:r},u),e[5]=n,e[6]=r,e[7]=l,e[8]=u,e[9]=o,e[10]=x):x=e[10],x}function Vt({toolName:s,connectionId:e,siblings:o,onSelectInstance:n}){const{replayId:l}=Ze({strict:!1}),r=(()=>{if(!l)return null;const d=`replay-${l}`,h=sessionStorage.getItem(d);if(!h)return null;sessionStorage.removeItem(d);try{return JSON.parse(h)}catch{return null}})(),a=(()=>{if(!r)return null;const d={};for(const[h,v]of Object.entries(r))v!==null&&typeof v=="object"?d[h]=JSON.stringify(v,null,2):d[h]=v;return d})(),[c,i]=T.useState(a??{}),[u,x]=T.useState(r?JSON.stringify(r,null,2):"{}"),[m,p]=T.useState(null),[f,g]=T.useState(null),[S,I]=T.useState(null),[R,$]=T.useState(null),[E,P]=T.useState(!1),[b,w]=T.useState(null),{org:C}=ie(),k=Oe(e),N=Tt(),A=Pt(),{setChatOpen:U}=kt(),z=`${e}:${s}`,_=ce({connectionId:e,orgId:C.id,orgSlug:C.slug}),L=It({client:_}),j=L.data?.tools?.find(d=>d.name===s),O=ut(j?._meta),J=d=>{if(!N)return;const h=$t(d.content);h.content.length>0&&(U(!0),N.sendMessage({tiptapDoc:h}))},[D,X]=T.useState("json"),[ze,Le]=T.useState(!1);O&&!ze&&(X("ui"),Le(!0));const pe=j?.inputSchema?.properties,fe=pe?Object.keys(pe):[],H=fe.length>0,K={};if(H&&j?.inputSchema?.properties)for(const d of fe)K[d]=j.inputSchema.required?.includes(d)?"":void 0;const ee=d=>Object.prototype.hasOwnProperty.call(c,d),Ue=async()=>{P(!0),$(null),p(null),g(null),I(null),w(null);const d=performance.now();try{if(!_)throw new Error("MCP client is not available");const h=H?{...K,...c}:(()=>{const M=u.trim();if(!M)return{};const B=JSON.parse(M);if(B&&typeof B=="object")return B;throw new Error("Raw JSON input must be an object.")})();H&&j?.inputSchema?.properties&&Object.entries(j.inputSchema.properties).forEach(([M,B])=>{if((B.type==="object"||B.type==="array")&&typeof h[M]=="string")try{h[M]=JSON.parse(h[M])}catch{}else if((B.type==="number"||B.type==="integer")&&typeof h[M]=="string"&&h[M]!==""){const je=Number(h[M]);Number.isNaN(je)||(h[M]=je)}});const v=await _.callTool({name:s,arguments:h}),W=v.structuredContent??v,He=performance.now(),Ke=Math.round(He-d);p(W),g(v),I(h);const We=JSON.stringify(W),ge=new TextEncoder().encode(We).length;w({duration:`${Ke}ms`,bytes:`${ge} bytes`,tokens:`~${Math.ceil(ge/4)} tokens`,cost:"$0.0000"})}catch(h){const v=h instanceof Error?h.message:String(h);$(v||"Unknown error occurred");const W=performance.now();w({duration:`${Math.round(W-d)}ms`})}finally{P(!1)}},te=(d,h)=>{i(v=>({...v,[d]:h}))},Be=()=>{p(null),g(null),I(null),$(null),w(null)},Fe=j?.name??Bt(s),Ve=t.jsx(_e,{children:t.jsxs(De,{children:[t.jsx(q,{children:t.jsx(Q,{asChild:!0,children:t.jsx(G,{to:"/$org/settings/connections",params:{org:C.slug},children:"Connections"})})}),t.jsx(Y,{}),k&&t.jsxs(t.Fragment,{children:[t.jsx(q,{children:t.jsx(Q,{asChild:!0,children:t.jsx(G,{to:"/$org/settings/connections/$appSlug",params:{org:C.slug,appSlug:yt(k)},search:{tab:"tools"},children:k.title})})}),t.jsx(Y,{})]}),t.jsx(q,{children:t.jsx(Me,{children:Fe})})]})}),he=o.length>1&&t.jsxs(ve,{value:e,onValueChange:n,children:[t.jsx(Se,{className:"h-8 w-auto min-w-[200px]",children:t.jsx(ye,{})}),t.jsx(we,{children:o.map(d=>t.jsx(oe,{value:d.id,children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Te,{icon:d.icon,name:d.title,size:"xs",className:"shrink-0"}),d.title]})},d.id))})]}),Je=t.jsxs("div",{className:"flex flex-col p-6 gap-4 overflow-auto",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h2",{className:"text-sm font-semibold text-foreground uppercase tracking-wide",children:"Parameters"}),j?.inputSchema?.required&&j.inputSchema.required.length>0&&t.jsxs("span",{className:"text-xs text-muted-foreground",children:[t.jsx("span",{className:"text-red-500",children:"*"})," Required"]})]}),t.jsx("div",{className:"space-y-4",children:H&&j?.inputSchema?.properties?Object.entries(j.inputSchema.properties).map(([d,h])=>t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("label",{className:"text-sm font-medium leading-none flex items-center gap-1.5",children:[d,j.inputSchema?.required?.includes(d)&&t.jsx("span",{className:"text-red-500 text-xs",children:"*"})]}),t.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:h.type})]}),h.description&&t.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:h.description}),h.type==="object"||h.type==="array"?t.jsx(re,{className:"font-mono text-xs",value:ee(d)?c[d]??"":K[d]??"",onChange:v=>te(d,v.target.value),placeholder:`Enter ${d} as JSON...`,rows:3}):h.type==="boolean"?t.jsxs(ve,{value:ee(d)?String(c[d]??""):"",onValueChange:v=>te(d,v==="true"),children:[t.jsx(Se,{children:t.jsx(ye,{placeholder:"Select true or false..."})}),t.jsxs(we,{children:[t.jsx(oe,{value:"true",children:"true"}),t.jsx(oe,{value:"false",children:"false"})]})]}):t.jsx(ue,{value:ee(d)?c[d]??"":K[d]??"",onChange:v=>te(d,v.target.value),placeholder:`Enter ${d}...`})]},d)):j?.inputSchema&&!H?t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-sm font-medium",children:"Raw JSON Input"}),t.jsx(re,{className:"font-mono text-xs min-h-[120px]",value:u,onChange:d=>x(d.target.value),placeholder:'e.g. { "foo": "bar" }'})]}):t.jsx("div",{className:"flex items-center justify-center p-8 bg-muted/30 rounded-lg border border-dashed border-border",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:"No parameters required"})})}),t.jsx("div",{className:"flex items-center gap-2 pt-2",children:E?t.jsxs(F,{size:"sm",variant:"destructive",className:"h-8 gap-2",onClick:Be,children:[t.jsx(at,{className:"h-3.5 w-3.5"}),"Cancel"]}):t.jsxs(F,{size:"sm",variant:"default",className:"h-8 gap-2",onClick:Ue,children:[t.jsx(vt,{className:"h-3.5 w-3.5 fill-current"}),"Execute Tool"]})})]}),qe=t.jsxs("div",{className:"flex flex-col @3xl:h-full @3xl:overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 h-14 border-b border-border bg-background",children:[t.jsx("h2",{className:"text-sm font-medium text-foreground uppercase tracking-wide",children:"Result"}),t.jsxs("div",{className:"flex items-center gap-3",children:[b&&t.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(bt,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-foreground",children:b.duration})]}),b.tokens&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(ct,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-foreground",children:b.tokens})]}),b.bytes&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(dt,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-foreground",children:b.bytes})]}),b.cost&&t.jsx("div",{className:"flex items-center gap-1.5",children:t.jsx("span",{className:"font-mono text-foreground",children:b.cost})})]}),O&&t.jsx(gt,{children:t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsxs(Ce,{children:[t.jsx(Ie,{asChild:!0,children:t.jsx(F,{size:"icon",variant:D==="ui"?"secondary":"ghost",className:"h-8 w-8",onClick:()=>X("ui"),children:t.jsx(mt,{size:14})})}),t.jsx($e,{children:"Interactive view"})]}),t.jsxs(Ce,{children:[t.jsx(Ie,{asChild:!0,children:t.jsx(F,{size:"icon",variant:D==="json"?"secondary":"ghost",className:"h-8 w-8",onClick:()=>X("json"),children:t.jsx(be,{size:14})})}),t.jsx($e,{children:"JSON view"})]})]})})]})]}),R&&t.jsx("div",{className:"px-6 py-4 bg-background",children:t.jsx(pt,{variant:"destructive",children:t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(jt,{className:"h-4 w-4"}),t.jsx(ft,{className:"mb-0",children:"Execution Failed"})]}),t.jsx(ht,{className:"text-xs text-destructive",children:R})]})})}),t.jsx("div",{className:"relative flex-1 min-h-[400px] @3xl:min-h-0 @3xl:overflow-auto bg-muted/50",children:O&&D==="ui"&&_?t.jsx(T.Suspense,{fallback:t.jsx("div",{className:"flex items-center justify-center h-48",children:t.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[t.jsx("div",{className:"size-4 border-2 border-current border-t-transparent rounded-full animate-spin"}),t.jsx("span",{className:"text-sm",children:"Loading app..."})]})}),children:t.jsx(xt,{resourceURI:O,toolInfo:j?{tool:j}:void 0,toolInput:S??void 0,toolResult:f??void 0,displayMode:"fullscreen",minHeight:Ne.view.minHeight,maxHeight:Ne.view.maxHeight,client:_,onMessage:J,onUpdateModelContext:d=>A?.setAppContext(z,d),onTeardown:()=>A?.clearAppContext(z),className:"h-full"})}):m?t.jsxs(t.Fragment,{children:[t.jsx(Et,{code:JSON.stringify(m,null,2),language:"json",height:"100%",readOnly:!0}),t.jsx(F,{size:"icon",variant:"ghost",className:"absolute top-4 right-4 h-8 w-8 bg-background/80 hover:bg-background border border-border shadow-sm",onClick:()=>{navigator.clipboard.writeText(JSON.stringify(m,null,2)),Xe.success("Copied to clipboard")},children:t.jsx(Nt,{className:"h-3.5 w-3.5"})})]}):t.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-muted-foreground",children:[t.jsx(be,{className:"h-12 w-12 mb-3 opacity-40"}),t.jsx("p",{className:"text-sm",children:"Run the tool to see results"})]})})]});return t.jsx(xe,{breadcrumb:Ve,children:t.jsxs("div",{className:"flex flex-col h-full overflow-hidden @container",children:[t.jsxs("div",{className:"flex flex-col gap-3 py-7 px-8 bg-background border-b border-border shrink-0",children:[t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx(Te,{icon:k?.icon||null,name:k?.title||s,size:"xl",className:"shrink-0"}),t.jsx("h1",{className:"text-xl font-semibold tracking-tight text-foreground leading-none truncate",children:s}),t.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1 bg-muted/50 rounded-md h-fit shrink-0",children:[L.isSuccess?t.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-green-500 animate-pulse shrink-0"}):L.isLoading?t.jsx(Z,{size:10,className:"animate-spin text-yellow-500 shrink-0"}):t.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-red-500 shrink-0"}),t.jsx("span",{className:"font-mono text-xs capitalize text-muted-foreground leading-none",children:L.isSuccess?"ready":L.isLoading?"connecting":"error"})]}),t.jsx(Ct,{annotations:j?.annotations,_meta:j?._meta}),t.jsx("div",{className:"hidden @3xl:flex items-center ml-auto shrink-0",children:he})]}),t.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:j?.description||"No description available"})]}),o.length>1&&t.jsxs("div",{className:"flex @3xl:hidden items-center gap-3 px-8 py-3 border-b border-border",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground shrink-0",children:"Instance"}),he]}),t.jsx("div",{className:"flex-1 overflow-auto @3xl:overflow-hidden",children:t.jsxs("div",{className:"grid grid-cols-1 @3xl:grid-cols-[minmax(0,2fr)_minmax(0,5fr)] @3xl:h-full @3xl:grid-rows-1",children:[t.jsx("div",{className:"@3xl:border-r border-border @3xl:overflow-auto",children:Je}),qe]})})]})})}function Jt(s){const e=y.c(10),{itemId:o,siblings:n,onBack:l}=s,[r,a]=T.useState(n[0]?.id??"");let c;e[0]!==r||e[1]!==n?(c=n.find(p=>p.id===r)?.id??n[0]?.id??"",e[0]=r,e[1]=n,e[2]=c):c=e[2];const i=c;if(!Oe(i||void 0)||!i){let p;return e[3]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[t.jsx("h3",{className:"text-lg font-semibold",children:"Connection not found"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"This connection may have been deleted or you may not have access."})]})}),e[3]=p):p=e[3],p}let x;e[4]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(Z,{size:32,className:"animate-spin text-muted-foreground"})}),e[4]=x):x=e[4];let m;return e[5]!==i||e[6]!==l||e[7]!==n||e[8]!==o?(m=t.jsx(T.Suspense,{fallback:x,children:t.jsx(Ft,{toolName:o,connectionId:i,siblings:n,onSelectInstance:a,onBack:l})}),e[5]=i,e[6]=l,e[7]=n,e[8]=o,e[9]=m):m=e[9],m}function qt(s){const e=y.c(21),{icon:o,illustration:n,title:l,description:r,buttonProps:a,buttonComponent:c,className:i,children:u}=s;let x;e[0]!==i?(x=V("flex flex-col items-center justify-center py-16 text-center",i),e[0]=i,e[1]=x):x=e[1];let m;e[2]!==o||e[3]!==n?(m=n?t.jsx("div",{className:"mb-4 text-muted-foreground/50",children:n}):o?t.jsx("div",{className:"mb-4 flex h-12 w-12 items-center justify-center rounded-xl bg-muted/50 text-muted-foreground",children:o}):null,e[2]=o,e[3]=n,e[4]=m):m=e[4];let p;e[5]!==l?(p=t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:l}),e[5]=l,e[6]=p):p=e[6];let f;e[7]!==r?(f=r&&t.jsx("div",{className:"text-sm text-muted-foreground",children:r}),e[7]=r,e[8]=f):f=e[8];let g;e[9]!==p||e[10]!==f?(g=t.jsxs("div",{className:"flex flex-col items-center gap-1 max-w-sm",children:[p,f]}),e[9]=p,e[10]=f,e[11]=g):g=e[11];let S;e[12]!==c||e[13]!==a?(S=(c??a)&&t.jsx("div",{className:"mt-4",children:c??(a&&t.jsx(F,{size:"sm",className:V(a?.className),...a}))}),e[12]=c,e[13]=a,e[14]=S):S=e[14];let I;return e[15]!==u||e[16]!==x||e[17]!==m||e[18]!==g||e[19]!==S?(I=t.jsxs("div",{className:x,children:[m,g,S,u]}),e[15]=u,e[16]=x,e[17]=m,e[18]=g,e[19]=S,e[20]=I):I=e[20],I}const Ht={prompt:Ut};function Kt(){const s=y.c(9),e=ke();let o;s[0]===Symbol.for("react.memo_cache_sentinel")?(o={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId"},s[0]=o):o=s[0];const n=ae(o),l=decodeURIComponent(n.itemId);let r;s[1]!==n.appSlug?(r={slug:n.appSlug},s[1]=n.appSlug,s[2]=r):r=s[2];const a=Re(r);let c;s[3]!==e.history?(c=()=>{e.history.back()},s[3]=e.history,s[4]=c):c=s[4];const i=c,u=Wt;let x;return s[5]!==i||s[6]!==l||s[7]!==a?(x=t.jsx(Jt,{itemId:l,siblings:a,onBack:i,onUpdate:u}),s[5]=i,s[6]=l,s[7]=a,s[8]=x):x=s[8],x}async function Wt(s){return Promise.resolve()}function Gt(s){return s.toLowerCase().split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function Qt(){const s=y.c(41),e=ke();let o;s[0]===Symbol.for("react.memo_cache_sentinel")?(o={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId"},s[0]=o):o=s[0];const n=ae(o),l=decodeURIComponent(n.collectionName),r=decodeURIComponent(n.itemId);let a;s[1]!==e.history?(a=()=>{e.history.back()},s[1]=e.history,s[2]=a):a=s[2];const c=a,{org:i}=ie();let u;s[3]!==n.appSlug?(u={slug:n.appSlug},s[3]=n.appSlug,s[4]=u):u=s[4];const m=Re(u)[0]??null,p=m?.id??"",f=p||"no-connection",g=p??null;let S;s[5]!==i.id||s[6]!==i.slug||s[7]!==g?(S={connectionId:g,orgId:i.id,orgSlug:i.slug},s[5]=i.id,s[6]=i.slug,s[7]=g,s[8]=S):S=s[8];const I=ce(S),R=Ae(f,l,I);let $;s[9]!==R||s[10]!==r?($=async D=>{r&&await R.update.mutateAsync({id:r,data:D})},s[9]=R,s[10]=r,s[11]=$):$=s[11];const E=$;let P;s[12]!==l?(P=l?.toLowerCase(),s[12]=l,s[13]=P):P=s[13];const b=P,w=b&&Ht[b];let C;s[14]!==l?(C=Gt(l),s[14]=l,s[15]=C):C=s[15];const k=C;let N;s[16]!==i.slug?(N=t.jsx(q,{children:t.jsx(Q,{asChild:!0,children:t.jsx(G,{to:"/$org/settings/connections",params:{org:i.slug},children:"Connections"})})}),s[16]=i.slug,s[17]=N):N=s[17];let A;s[18]===Symbol.for("react.memo_cache_sentinel")?(A=t.jsx(Y,{}),s[18]=A):A=s[18];let U;s[19]!==l||s[20]!==m||s[21]!==i.slug||s[22]!==n.appSlug?(U=m&&t.jsxs(t.Fragment,{children:[t.jsx(q,{children:t.jsx(Q,{asChild:!0,children:t.jsx(G,{to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:n.appSlug},search:{tab:l},children:m.title})})}),t.jsx(Y,{})]}),s[19]=l,s[20]=m,s[21]=i.slug,s[22]=n.appSlug,s[23]=U):U=s[23];let z;s[24]!==k?(z=t.jsx(q,{children:t.jsx(Me,{children:k})}),s[24]=k,s[25]=z):z=s[25];let _;s[26]!==U||s[27]!==z||s[28]!==N?(_=t.jsx(_e,{children:t.jsxs(De,{children:[N,A,U,z]})}),s[26]=U,s[27]=z,s[28]=N,s[29]=_):_=s[29];const L=_;if(w){let D;return s[30]!==w||s[31]!==c||s[32]!==E||s[33]!==r?(D=t.jsx(w,{itemId:r,onBack:c,onUpdate:E}),s[30]=w,s[31]=c,s[32]=E,s[33]=r,s[34]=D):D=s[34],D}let j;s[35]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx(At,{size:36,className:"text-muted-foreground"}),s[35]=j):j=s[35];let O;s[36]!==c?(O=t.jsx(qt,{icon:j,title:"No component defined",description:"No component for this collection was defined",buttonProps:{onClick:c,children:"Go back"}}),s[36]=c,s[37]=O):O=s[37];let J;return s[38]!==L||s[39]!==O?(J=t.jsx(xe,{breadcrumb:L,children:O}),s[38]=L,s[39]=O,s[40]=J):J=s[40],J}function Yt(){const s=y.c(3);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId"},s[0]=e):e=s[0];const o=ae(e);if(decodeURIComponent(o.collectionName)==="tools"){let a;return s[1]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(Kt,{}),s[1]=a):a=s[1],a}let r;return s[2]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(Qt,{}),s[2]=r):r=s[2],r}function Mn(){const s=y.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Pe,{children:t.jsx(T.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(Z,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(Yt,{})})}),s[0]=e):e=s[0],e}export{Mn as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as B,j as s,l as M,B as V}from"./index-
|
|
1
|
+
import{c as B,j as s,l as M,B as V}from"./index-BeeLZolL.js";import{c as z,a as _,b as $,D as E}from"./dropdown-menu-uJD6Hbs4.js";import{a as L,n as O,d as R,i as A,c as F}from"./SwitchHorizontal01-DoI1DhsF.js";import{i as S}from"./ChevronUp-CxQvq7Kl.js";import{T as I,a as K,c as P,b as W}from"./tooltip-Ba5WYryG.js";import{V as q}from"./view-mode-toggle-BRqm8HSD.js";import{B as G}from"./badge-BCyg4w-e.js";function te(t){const e=B.c(31),{viewMode:r,onViewModeChange:m,sortKey:T,sortDirection:p,onSort:f,sortOptions:u,filters:h}=t;let g;e[0]!==u?(g=u===void 0?[]:u,e[0]=u,e[1]=g):g=e[1];const j=g;let b;e[2]!==h?(b=h===void 0?[]:h,e[2]=h,e[3]=b):b=e[3];const l=b;let v;e[4]!==l?(v=l.filter(J),e[4]=l,e[5]=v):v=e[5];const N=v.length;let w;e[6]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(R,{size:16}),e[6]=w):w=e[6];let i;e[7]!==N?(i=N>0&&s.jsx(G,{variant:"default",className:"absolute -top-1.5 -right-1.5 h-4 min-w-4 px-1 text-[10px] leading-none",children:N}),e[7]=N,e[8]=i):i=e[8];let o;e[9]!==i?(o=s.jsx(I,{asChild:!0,children:s.jsx(_,{asChild:!0,children:s.jsxs(V,{variant:"outline",size:"icon",className:"relative",children:[w,i]})})}),e[9]=i,e[10]=o):o=e[10];let C;e[11]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx(K,{children:"Display & filters"}),e[11]=C):C=e[11];let n;e[12]!==o?(n=s.jsx(P,{children:s.jsxs(W,{children:[o,C]})}),e[12]=o,e[13]=n):n=e[13];let a;e[14]!==m||e[15]!==r?(a=m&&r&&s.jsx("div",{className:"p-2 border-b border-border",children:s.jsx(q,{value:r,onValueChange:m,fullWidth:!0,options:[{value:"table",icon:s.jsx(A,{})},{value:"cards",icon:s.jsx(F,{})}]})}),e[14]=m,e[15]=r,e[16]=a):a=e[16];let c;e[17]!==f||e[18]!==p||e[19]!==T||e[20]!==j?(c=j.length>0&&f&&s.jsxs("div",{className:"p-1 flex flex-col gap-0.5 border-b border-border",children:[s.jsx("div",{className:"px-2 py-1.5 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Sort by"}),j.map(y=>{const D=T===y.id;return s.jsx(z,{onClick:()=>f(y.id),className:M("h-8 px-2 py-0 cursor-pointer",D&&"bg-accent"),children:s.jsxs("div",{className:"flex items-center gap-2 w-full",children:[D&&s.jsx(S,{size:16,className:"text-foreground shrink-0"}),!D&&s.jsx("div",{className:"w-4 shrink-0"}),s.jsx("span",{className:"text-sm text-foreground flex-1",children:y.label}),D&&p&&(p==="asc"?s.jsx(L,{size:16,className:"text-foreground shrink-0"}):s.jsx(O,{size:16,className:"text-foreground shrink-0"}))]})},y.id)})]}),e[17]=f,e[18]=p,e[19]=T,e[20]=j,e[21]=c):c=e[21];let d;e[22]!==l?(d=l.map(H),e[22]=l,e[23]=d):d=e[23];let x;e[24]!==a||e[25]!==c||e[26]!==d?(x=s.jsxs($,{align:"end",className:"w-[200px] p-0 gap-0",children:[a,c,d]}),e[24]=a,e[25]=c,e[26]=d,e[27]=x):x=e[27];let k;return e[28]!==n||e[29]!==x?(k=s.jsxs(E,{children:[n,x]}),e[28]=n,e[29]=x,e[30]=k):k=e[30],k}function H(t){return s.jsxs("div",{className:"p-1 flex flex-col gap-0.5 border-b border-border last:border-b-0",children:[s.jsx("div",{className:"px-2 py-1.5 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:t.label}),t.options.map(e=>{const r=t.value===e.id;return s.jsx(z,{onClick:()=>t.onChange(e.id),className:M("h-8 px-2 py-0 cursor-pointer",r&&"bg-accent"),children:s.jsxs("div",{className:"flex items-center gap-2 w-full",children:[r&&s.jsx(S,{size:16,className:"text-foreground shrink-0"}),!r&&s.jsx("div",{className:"w-4 shrink-0"}),s.jsx("span",{className:"text-sm text-foreground flex-1",children:e.label})]})},e.id)})]},t.label)}function J(t){return t.value!=="ALL"}export{te as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as v,l as b,j as a,i as w}from"./index-
|
|
1
|
+
import{c as v,l as b,j as a,i as w}from"./index-BeeLZolL.js";import{i as C}from"./SearchMd-1gE2e_l6.js";function S(j){const e=v.c(21),{value:d,onChange:m,placeholder:g,onKeyDown:x,className:u,isSearching:f,disabled:i}=j,p=g===void 0?"Search...":g;let t;e[0]!==u?(t=b("shrink-0 w-full border-b border-border h-12",u),e[0]=u,e[1]=t):t=e[1];const h=i?"cursor-not-allowed opacity-50":"cursor-text";let s;e[2]!==h?(s=b("flex items-center gap-2.5 h-12 px-4",h),e[2]=h,e[3]=s):s=e[3];let l;e[4]!==f?(l=f?a.jsx(w,{size:16,className:"animate-spin text-muted-foreground shrink-0"}):a.jsx(C,{size:16,className:"text-muted-foreground shrink-0"}),e[4]=f,e[5]=l):l=e[5];let r;e[6]!==m?(r=N=>m(N.target.value),e[6]=m,e[7]=r):r=e[7];let o;e[8]!==i||e[9]!==x||e[10]!==p||e[11]!==r||e[12]!==d?(o=a.jsx("input",{type:"text",value:d,onChange:r,onKeyDown:x,placeholder:p,disabled:i,className:"flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 outline-none"}),e[8]=i,e[9]=x,e[10]=p,e[11]=r,e[12]=d,e[13]=o):o=e[13];let n;e[14]!==s||e[15]!==l||e[16]!==o?(n=a.jsxs("label",{className:s,children:[l,o]}),e[14]=s,e[15]=l,e[16]=o,e[17]=n):n=e[17];let c;return e[18]!==t||e[19]!==n?(c=a.jsx("div",{className:t,children:n}),e[18]=t,e[19]=n,e[20]=c):c=e[20],c}export{S as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as f,l as u,j as m}from"./index-
|
|
1
|
+
import{c as f,l as u,j as m}from"./index-BeeLZolL.js";import{B as g}from"./badge-BCyg4w-e.js";function h(x){const e=f.c(12),{tabs:c,activeTab:n,onTabChange:s,className:a}=x;let t;e[0]!==a?(t=u("flex items-center gap-2 overflow-x-auto no-scrollbar",a),e[0]=a,e[1]=t):t=e[1];let r;if(e[2]!==n||e[3]!==s||e[4]!==c){let l;e[6]!==n||e[7]!==s?(l=o=>{const d=n===o.id;return m.jsxs("button",{type:"button",onClick:()=>s(o.id),className:u("h-7 px-2 text-sm rounded-lg border border-input transition-colors inline-flex gap-1.5 items-center",d&&"bg-accent border-border text-foreground",!d&&"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:[o.label,o.count!==void 0&&m.jsx(g,{variant:"secondary",className:u("h-5 min-w-5 px-1 rounded-full text-[10px] font-mono inline-flex items-center justify-center",d?"bg-background text-foreground":"bg-muted-foreground/10 text-muted-foreground"),children:o.count})]},o.id)},e[6]=n,e[7]=s,e[8]=l):l=e[8],r=c.map(l),e[2]=n,e[3]=s,e[4]=c,e[5]=r}else r=e[5];let i;return e[9]!==t||e[10]!==r?(i=m.jsx("div",{className:t,children:r}),e[9]=t,e[10]=r,e[11]=i):i=e[11],i}export{h as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as d,l as i,j as n}from"./index-
|
|
1
|
+
import{c as d,l as i,j as n}from"./index-BeeLZolL.js";import{_ as m}from"./index-Ba_weT-5.js";import{e as k,a as N,b as j,c as b,d as w}from"./dialog-Bh4QMQdt.js";import{i as y}from"./SearchMd-1gE2e_l6.js";function C(a){const e=d.c(8);let t,s;e[0]!==a?({className:t,...s}=a,e[0]=a,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=i("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",t),e[3]=t,e[4]=o):o=e[4];let l;return e[5]!==s||e[6]!==o?(l=n.jsx(m,{"data-slot":"command",className:o,...s}),e[5]=s,e[6]=o,e[7]=l):l=e[7],l}function S(a){const e=d.c(24);let t,s,o,l,r;e[0]!==a?({title:l,description:r,children:t,className:s,...o}=a,e[0]=a,e[1]=t,e[2]=s,e[3]=o,e[4]=l,e[5]=r):(t=e[1],s=e[2],o=e[3],l=e[4],r=e[5]);const _=l===void 0?"Command Palette":l,v=r===void 0?"Search for a command to run...":r;let c;e[6]!==_?(c=n.jsx(N,{children:_}),e[6]=_,e[7]=c):c=e[7];let p;e[8]!==v?(p=n.jsx(j,{children:v}),e[8]=v,e[9]=p):p=e[9];let u;e[10]!==c||e[11]!==p?(u=n.jsxs(b,{className:"sr-only",children:[c,p]}),e[10]=c,e[11]=p,e[12]=u):u=e[12];let f;e[13]!==s?(f=i("overflow-hidden p-0",s),e[13]=s,e[14]=f):f=e[14];let x;e[15]!==t?(x=n.jsx(C,{className:"[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:t}),e[15]=t,e[16]=x):x=e[16];let g;e[17]!==f||e[18]!==x?(g=n.jsx(w,{className:f,closeButtonClassName:"hidden",children:x}),e[17]=f,e[18]=x,e[19]=g):g=e[19];let h;return e[20]!==o||e[21]!==u||e[22]!==g?(h=n.jsxs(k,{...o,children:[u,g]}),e[20]=o,e[21]=u,e[22]=g,e[23]=h):h=e[23],h}function z(a){const e=d.c(9);let t,s;e[0]!==a?({className:t,...s}=a,e[0]=a,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(y,{className:"size-5 shrink-0 text-foreground"}),e[3]=o):o=e[3];let l;e[4]!==t?(l=i("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",t),e[4]=t,e[5]=l):l=e[5];let r;return e[6]!==s||e[7]!==l?(r=n.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-10 items-center gap-2 border-b px-3",children:[o,n.jsx(m.Input,{"data-slot":"command-input",className:l,...s})]}),e[6]=s,e[7]=l,e[8]=r):r=e[8],r}function G(a){const e=d.c(8);let t,s;e[0]!==a?({className:t,...s}=a,e[0]=a,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=i("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",t),e[3]=t,e[4]=o):o=e[4];let l;return e[5]!==s||e[6]!==o?(l=n.jsx(m.List,{"data-slot":"command-list",className:o,...s}),e[5]=s,e[6]=o,e[7]=l):l=e[7],l}function L(a){const e=d.c(4);let t;e[0]!==a?({...t}=a,e[0]=a,e[1]=t):t=e[1];let s;return e[2]!==t?(s=n.jsx(m.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...t}),e[2]=t,e[3]=s):s=e[3],s}function R(a){const e=d.c(8);let t,s;e[0]!==a?({className:t,...s}=a,e[0]=a,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=i("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",t),e[3]=t,e[4]=o):o=e[4];let l;return e[5]!==s||e[6]!==o?(l=n.jsx(m.Group,{"data-slot":"command-group",className:o,...s}),e[5]=s,e[6]=o,e[7]=l):l=e[7],l}function B(a){const e=d.c(8);let t,s;e[0]!==a?({className:t,...s}=a,e[0]=a,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=i("bg-border -mx-1 h-px",t),e[3]=t,e[4]=o):o=e[4];let l;return e[5]!==s||e[6]!==o?(l=n.jsx(m.Separator,{"data-slot":"command-separator",className:o,...s}),e[5]=s,e[6]=o,e[7]=l):l=e[7],l}function H(a){const e=d.c(8);let t,s;e[0]!==a?({className:t,...s}=a,e[0]=a,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=i("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),e[3]=t,e[4]=o):o=e[4];let l;return e[5]!==s||e[6]!==o?(l=n.jsx(m.Item,{"data-slot":"command-item",className:o,...s}),e[5]=s,e[6]=o,e[7]=l):l=e[7],l}export{L as C,H as a,z as b,G as c,C as d,R as e,S as f,B as g};
|
package/dist/client/assets/{commerce-onboarding-BIH5j4YU.js → commerce-onboarding-D7-PbC8T.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as U,r as K,l as J,j as n,B as V,m as dt,d as Oe,K as W,o as He,s as ue,n as Ve,p as Be,i as mt,k as ut,q as me,Q as ft,E as pt,a as ke,u as gt,v as kt,w as At,b as ht,x as Ut,y as xt,L as Rt}from"./index-D4CKj2wI.js";import{A as Pt}from"./auth-entry-BImLugiZ.js";import{A as $t}from"./auth-split-layout-D9ShntXk.js";import{O as it}from"./organization-choice-ChvrohfF.js";import{f as Lt}from"./tab-id-BptcWVWa.js";import{I as Ae}from"./input-Bt9JLSwY.js";import{u as Ue,W as yt,S as vt,g as zt,C as Dt}from"./use-mcp-client-7IqlZsu6.js";import{i as bt}from"./XCircle-Cuc8nE6i.js";import{I as jt}from"./integration-icon-DQlMcsez.js";import{D as Ge,a as Ft,b as Mt,c as Kt,d as qt,e as Ht}from"./dialog-DZbMHqk-.js";import{T as Vt,a as Bt,b as Gt}from"./tooltip-BaneECMt.js";import{i as St}from"./CheckCircle-CLnUTqL3.js";import{i as Qt,t as Wt}from"./agent-icon-D6NO8NQS.js";import{g as Yt,c as Jt,e as Zt}from"./extract-connection-data-KUqDwlNM.js";import{F as fe,a as Qe,b as pe,c as Fe,d as ge,e as he}from"./form-CBShGsV7.js";import{i as Xt}from"./ChevronUp-BL1VVdJH.js";import{s as en,a as tn}from"./Eye-DLB3SihR.js";import{i as nn}from"./Settings02-DTCnN7hH.js";import{u as sn}from"./useSuspenseQueries-CXyIh6vj.js";import{a as on}from"./authenticate-and-persist-oauth-DV_Syko4.js";import{i as Ct}from"./ArrowUpRight-OETO6U7k.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./avatar-MHZ63SNd.js";import"./User01-Dc_4BfIo.js";import"./auth-qUspkFR_.js";import"./X-E3DyM7UC.js";import"./AlertCircle-Bsym1ImY.js";import"./Tool01-CL_8Izc9.js";import"./SwitchHorizontal01-PRhNyd-f.js";import"./ZapSquare-BZrjsIpc.js";import"./Users03-Cm292zjH.js";import"./ChevronDown-Bx4qDl4c.js";import"./ChevronLeft-DTd3BCNc.js";import"./ChevronRight-_RX2mWgS.js";import"./DotsVertical-CN2QyAt6.js";import"./Stars02-BI5loBcY.js";import"./ZoomOut-BRkeO1qu.js";import"./Globe01-QSXapmlK.js";import"./FilterLines-C6-JkzKo.js";import"./Star01-GR0ov5Sc.js";import"./Globe04-3IZPnvlD.js";import"./HardDrive-uvvlNfcr.js";import"./Key01-CZ1h7fLN.js";import"./LayoutLeft-i_rhGuA5.js";import"./LinkExternal01-BCIEZzze.js";import"./Monitor01-DPI8nCmu.js";import"./Sun-C2NDQLw1.js";import"./Palette-UZ6kBEqD.js";import"./Play-qEBiAhod.js";import"./Plus-BFXW9Hm0.js";import"./SearchLg-BM8Dh-8n.js";import"./SearchMd-CxnmulF7.js";import"./Shield01-CaE-d9vS.js";import"./Stars01-BlizU8cq.js";import"./Trash01-DA6TfyJR.js";import"./Upload01-DPL58cy-.js";import"./Users01-C-jKgPln.js";import"./XClose-jXr-Q3Pi.js";import"./Zap-CLQGhRUa.js";import"./label-BCF__ROW.js";import"./mcp-oauth-B7os1fcw.js";const rn=/^[a-zA-Z][a-zA-Z\d+.-]*:/,an=/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//,ln=/^[^\s/:?#]+\.[^\s/:?#]+:\d+(?:[/?#]|$)/,cn=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;function Te(o){const e=o.trim();if(!e)return{ok:!1,error:"Enter a website URL."};const t=rn.test(e),s=an.test(e),i=ln.test(e);if(t&&!s&&!i)return{ok:!1,error:"Use an HTTP or HTTPS website URL."};const a=s?e:`https://${e}`;let r;try{r=new URL(a)}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 l=r.hostname.split(".");return l.length<2||l.some(c=>!c||!cn.test(c))?{ok:!1,error:"Enter a valid website URL."}:(r.protocol="https:",{ok:!0,value:r.origin})}function Ke(o){const e=U.c(14),{children:t,className:s,wrapperClassName:i}=o,[a,r]=K.useState(!0);let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=j=>{if(!j)return;const x=()=>{const u=j.scrollHeight-j.scrollTop-j.clientHeight<8;r(u)};x(),j.addEventListener("scroll",x,{passive:!0});const g=new ResizeObserver(x);g.observe(j);for(const u of Array.from(j.children))g.observe(u);return()=>{j.removeEventListener("scroll",x),g.disconnect()}},e[0]=l):l=e[0];const c=l;let m;e[1]!==i?(m=J("relative",i),e[1]=i,e[2]=m):m=e[2];let f;e[3]!==t||e[4]!==s?(f=n.jsx("div",{ref:c,className:s,children:t}),e[3]=t,e[4]=s,e[5]=f):f=e[5];const p=a?"opacity-0":"opacity-100";let d;e[6]!==p?(d=J("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 h;e[8]!==d?(h=n.jsx("div",{"aria-hidden":!0,className:d}),e[8]=d,e[9]=h):h=e[9];let v;return e[10]!==m||e[11]!==f||e[12]!==h?(v=n.jsxs("div",{className:m,children:[f,h]}),e[10]=m,e[11]=f,e[12]=h,e[13]=v):v=e[13],v}function dn(o){const e=o.properties;if(!e)return[];const t=[];for(const[s,i]of Object.entries(e)){const l=i?.properties?.__type?.const;typeof l=="string"&&l.length>0&&t.push({fieldKey:s,bindingType:l})}return t}function mn(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 Z(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 un(o,e,t,s){return{...o??{},[e]:{__type:t,value:s}}}function qe(o){return o==null?!1:typeof o=="string"?o.trim().length>0:typeof o=="number"||typeof o=="boolean"?!0:Array.isArray(o)?o.some(qe):typeof o=="object"?Object.entries(o).some(([e,t])=>!e.startsWith("__")&&qe(t)):!1}function fn(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 pn(o){return qe(o)?typeof o=="string"?o.trim():typeof o=="number"||typeof o=="boolean"?String(o):JSON.stringify(o):null}function gn(o){return o?Object.entries(o).flatMap(([e,t])=>{if(e.startsWith("__"))return[];const s=pn(t);return s?[{key:e,label:fn(e),value:s}]:[]}):[]}function hn({autoOpenFieldKey:o,card:e}){return o===e.fieldKey&&e.satisfied&&!!e.linkedConnectionId}function xn(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,a)=>{const r=l=>l.status==="active"?0:1;return r(i)!==r(a)?r(i)-r(a):(a.updated_at??"").localeCompare(i.updated_at??"")}),s[0].id)}function yn(o){return o.server?.icons?.[0]?.src??Yt(o.server?.repository)??null}function vn(o,e){const t=o._meta?.["mcp.mesh"];return t?.friendlyName||t?.friendly_name||o.title||o.server?.title||o.server?.name||e}function bn(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],a=i?o.itemsById[i.registryAppId]:o.itemsByName[s.bindingType];if(!a)continue;const r=o.configurationState?.[s.fieldKey]?.value,l=r?t.get(r):void 0,c=r&&l?r:null,m=c?o.connectionReadiness?.[c]!==!1:!1,f=!!c&&m;e.push({fieldKey:s.fieldKey,bindingType:s.bindingType,registryItem:a,title:vn(a,s.bindingType),icon:yn(a),headline:i?.headline??a._meta?.["mcp.mesh"]?.short_description??null,area:i?.area??null,bullets:i?.bullets??[],satisfied:f,candidateConnectionId:f?null:c||xn(o.connections,s.bindingType,i?.registryAppId),linkedConnectionId:c,configurationState:l?.configuration_state??null})}return e}function jn(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 Sn(o){return(o?.response?.accountSummaries??[]).map(s=>({account:s.account,options:(s.propertySummaries??[]).map(i=>({value:i.property,label:`${i.displayName} (${s.displayName})`}))}))}function rt(o){const e=U.c(38);let t,s,i,a,r;e[0]!==o?({value:r,onChange:s,placeholder:i,className:t,...a}=o,e[0]=o,e[1]=t,e[2]=s,e[3]=i,e[4]=a,e[5]=r):(t=e[1],s=e[2],i=e[3],a=e[4],r=e[5]);const[l,c]=K.useState(!1),[m,f]=K.useState(!1);let p;e[6]!==r?(p=async()=>{if(r)try{await navigator.clipboard.writeText(r),f(!0),setTimeout(()=>f(!1),2e3)}catch($){console.error("Failed to copy text: ",$)}},e[6]=r,e[7]=p):p=e[7];const d=p;let h;e[8]!==l?(h=()=>{c(!l)},e[8]=l,e[9]=h):h=e[9];const v=h,j=l?"text":"password";let x;e[10]!==t?(x=J("pr-20",t),e[10]=t,e[11]=x):x=e[11];let g;e[12]!==s||e[13]!==i||e[14]!==a||e[15]!==j||e[16]!==x||e[17]!==r?(g=n.jsx(Ae,{type:j,value:r,onChange:s,placeholder:i,className:x,...a}),e[12]=s,e[13]=i,e[14]=a,e[15]=j,e[16]=x,e[17]=r,e[18]=g):g=e[18];const u=l?"Hide password":"Show password";let b;e[19]!==l?(b=l?n.jsx(nn,{size:16}):n.jsx(en,{size:16}),e[19]=l,e[20]=b):b=e[20];let y;e[21]!==u||e[22]!==b||e[23]!==v?(y=n.jsx(V,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:v,title:u,children:b}),e[21]=u,e[22]=b,e[23]=v,e[24]=y):y=e[24];const C=!r,_=m?"Copied!":"Copy token";let T;e[25]!==m?(T=m?n.jsx(Xt,{size:16}):n.jsx(tn,{size:16}),e[25]=m,e[26]=T):T=e[26];let N;e[27]!==d||e[28]!==_||e[29]!==T||e[30]!==C?(N=n.jsx(V,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:d,disabled:C,title:_,children:T}),e[27]=d,e[28]=_,e[29]=T,e[30]=C,e[31]=N):N=e[31];let E;e[32]!==N||e[33]!==y?(E=n.jsxs("div",{className:"absolute right-1 top-1 flex items-center gap-1 h-8",children:[y,N]}),e[32]=N,e[33]=y,e[34]=E):E=e[34];let I;return e[35]!==E||e[36]!==g?(I=n.jsxs("div",{className:"relative",children:[g,E]}),e[35]=E,e[36]=g,e[37]=I):I=e[37],I}function We(o){const e=U.c(19),{card:t,selfClient:s,org:i,onDone:a,onError:r}=o,l=dt();let c;e[0]!==t||e[1]!==s?(c=async x=>{const g={...t.configurationState??{},...x};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]=c):c=e[2];let m;e[3]!==a||e[4]!==i||e[5]!==l?(m=async()=>{await l.invalidateQueries({queryKey:W.commerceDiscoveryCompanionConnectionsPrefix(i.id)}),a()},e[3]=a,e[4]=i,e[5]=l,e[6]=m):m=e[6];let f;e[7]!==r?(f=x=>{r?.(x)},e[7]=r,e[8]=f):f=e[8];let p;e[9]!==c||e[10]!==m||e[11]!==f?(p={mutationFn:c,onSuccess:m,onError:f},e[9]=c,e[10]=m,e[11]=f,e[12]=p):p=e[12];const d=Oe(p);let h;e[13]!==d?(h=x=>d.mutate(x),e[13]=d,e[14]=h):h=e[14];const v=h;let j;return e[15]!==d.error||e[16]!==d.isPending||e[17]!==v?(j={save:v,isPending:d.isPending,error:d.error},e[15]=d.error,e[16]=d.isPending,e[17]=v,e[18]=j):j=e[18],j}const Cn=He({accountName:ue().min(1,"Informe o nome da conta"),appKey:ue().optional(),appToken:ue().optional()});function Nn(o){const e=U.c(63),{card:t,selfClient:s,org:i,onDone:a,onIsPendingChange:r}=o;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=Ve(Cn),e[0]=l):l=e[0];const c=t.configurationState?.accountName||"",m=t.configurationState?.appKey||"",f=t.configurationState?.appToken||"";let p;e[1]!==c||e[2]!==m||e[3]!==f?(p={resolver:l,defaultValues:{accountName:c,appKey:m,appToken:f}},e[1]=c,e[2]=m,e[3]=f,e[4]=p):p=e[4];const d=Be(p);let h;e[5]!==t.configurationState?.accountName||e[6]!==t.configurationState?.appKey||e[7]!==t.configurationState?.appToken||e[8]!==d?(h=()=>{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]=h):h=e[9];let v;e[10]!==t.configurationState||e[11]!==d?(v=[t.configurationState,d],e[10]=t.configurationState,e[11]=d,e[12]=v):v=e[12],K.useEffect(h,v);let j;e[13]!==t||e[14]!==a||e[15]!==i||e[16]!==s?(j={card:t,selfClient:s,org:i,onDone:a},e[13]=t,e[14]=a,e[15]=i,e[16]=s,e[17]=j):j=e[17];const{save:x,isPending:g,error:u}=We(j);let b,y;e[18]!==g||e[19]!==r?(y=()=>{r?.(g)},b=[g,r],e[18]=g,e[19]=r,e[20]=b,e[21]=y):(b=e[20],y=e[21]),K.useEffect(y,b);let C;if(e[22]!==d||e[23]!==x){let q;e[25]!==x?(q=async S=>{x(S)},e[25]=x,e[26]=q):q=e[26],C=d.handleSubmit(q),e[22]=d,e[23]=x,e[24]=C}else C=e[24];const _=C;let T;e[27]!==g?(T=q=>{const{field:S}=q;return n.jsxs(pe,{children:[n.jsx(Fe,{children:"Nome da conta"}),n.jsx(ge,{children:n.jsx(Ae,{placeholder:"Nome da sua conta VTEX",...S,disabled:g})}),n.jsx(he,{})]})},e[27]=g,e[28]=T):T=e[28];let N;e[29]!==d.control||e[30]!==T?(N=n.jsx(fe,{control:d.control,name:"accountName",render:T}),e[29]=d.control,e[30]=T,e[31]=N):N=e[31];let E;e[32]!==g?(E=q=>{const{field:S}=q;return n.jsxs(pe,{children:[n.jsx(Fe,{children:"App Key (opcional)"}),n.jsx(ge,{children:n.jsx(rt,{placeholder:"App Key da VTEX",...S,disabled:g})}),n.jsx(he,{})]})},e[32]=g,e[33]=E):E=e[33];let I;e[34]!==d.control||e[35]!==E?(I=n.jsx(fe,{control:d.control,name:"appKey",render:E}),e[34]=d.control,e[35]=E,e[36]=I):I=e[36];let $;e[37]!==g?($=q=>{const{field:S}=q;return n.jsxs(pe,{children:[n.jsx(Fe,{children:"App Token (opcional)"}),n.jsx(ge,{children:n.jsx(rt,{placeholder:"App Token da VTEX",...S,disabled:g})}),n.jsx(he,{})]})},e[37]=g,e[38]=$):$=e[38];let A;e[39]!==d.control||e[40]!==$?(A=n.jsx(fe,{control:d.control,name:"appToken",render:$}),e[39]=d.control,e[40]=$,e[41]=A):A=e[41];let w;e[42]!==d||e[43]!==N||e[44]!==I||e[45]!==A?(w=n.jsxs(Qe,{...d,children:[N,I,A]}),e[42]=d,e[43]=N,e[44]=I,e[45]=A,e[46]=w):w=e[46];let O;e[47]!==u?(O=u&&n.jsx("p",{role:"alert",className:"text-sm text-destructive",children:u instanceof Error?u.message:"Não foi possível salvar a configuração"}),e[47]=u,e[48]=O):O=e[48];let k;e[49]!==g||e[50]!==a?(k=n.jsx(V,{type:"button",variant:"outline",onClick:a,disabled:g,children:"Cancelar"}),e[49]=g,e[50]=a,e[51]=k):k=e[51];const z=g?"Salvando...":"Salvar";let F;e[52]!==g||e[53]!==z?(F=n.jsx(V,{type:"submit",disabled:g,children:z}),e[52]=g,e[53]=z,e[54]=F):F=e[54];let L;e[55]!==k||e[56]!==F?(L=n.jsxs(Ge,{className:"pt-4",children:[k,F]}),e[55]=k,e[56]=F,e[57]=L):L=e[57];let M;return e[58]!==_||e[59]!==w||e[60]!==O||e[61]!==L?(M=n.jsxs("form",{onSubmit:_,className:"space-y-4",children:[w,O,L]}),e[58]=_,e[59]=w,e[60]=O,e[61]=L,e[62]=M):M=e[62],M}function Nt(o){const e=U.c(30),{options:t,value:s,onChange:i,disabled:a,ariaLabel:r,searchPlaceholder:l}=o,c=l===void 0?"Buscar...":l,[m,f]=K.useState("");let p,d,h;if(e[0]!==t||e[1]!==m||e[2]!==s){const N=m.trim().toLowerCase();p=N?t.filter(E=>E.label.toLowerCase().includes(N)):t,d=p.map(_n),h=d.includes(s)?s:d[0]??"",e[0]=t,e[1]=m,e[2]=s,e[3]=p,e[4]=d,e[5]=h}else p=e[3],d=e[4],h=e[5];const v=h;let j;e[6]!==a||e[7]!==d||e[8]!==i?(j=function(E){if(a||!["ArrowDown","ArrowRight","ArrowUp","ArrowLeft","Home","End"].includes(E.key))return;E.preventDefault();const $=E.currentTarget.dataset.value,A=d.indexOf($),w=d.length;if(w===0)return;let O;E.key==="ArrowDown"||E.key==="ArrowRight"?O=(A+1)%w:E.key==="ArrowUp"||E.key==="ArrowLeft"?O=(A-1+w)%w:E.key==="Home"?O=0:O=w-1;const k=d[O];i(k),E.currentTarget.closest('[role="radiogroup"]')?.querySelector(`[data-value="${CSS.escape(k)}"]`)?.focus()},e[6]=a,e[7]=d,e[8]=i,e[9]=j):j=e[9];const x=j;let g;e[10]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(Qt,{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 u;e[11]===Symbol.for("react.memo_cache_sentinel")?(u=N=>f(N.target.value),e[11]=u):u=e[11];const b=`Buscar ${r}`;let y;e[12]!==a||e[13]!==m||e[14]!==c||e[15]!==b?(y=n.jsxs("div",{className:"relative",children:[g,n.jsx(Ae,{type:"text",value:m,onChange:u,disabled:a,placeholder:c,"aria-label":b,className:"h-8 pl-8"})]}),e[12]=a,e[13]=m,e[14]=c,e[15]=b,e[16]=y):y=e[16];let C;e[17]!==a||e[18]!==p||e[19]!==x||e[20]!==i||e[21]!==v||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(N=>{const E=N.value===s;return n.jsxs("button",{type:"button",role:"radio","aria-checked":E,disabled:a,"data-value":N.value,tabIndex:N.value===v?0:-1,onClick:()=>i(N.value),onKeyDown:x,className:J("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",E?"bg-muted font-medium text-foreground":"text-foreground hover:bg-muted/50"),children:[n.jsx("span",{className:"truncate",children:N.label}),E?n.jsx(St,{size:16,className:"shrink-0 text-primary"}):null]},N.value)}),e[17]=a,e[18]=p,e[19]=x,e[20]=i,e[21]=v,e[22]=s,e[23]=C):C=e[23];let _;e[24]!==r||e[25]!==C?(_=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]=_):_=e[26];let T;return e[27]!==y||e[28]!==_?(T=n.jsxs("div",{className:"space-y-2",children:[y,_]}),e[27]=y,e[28]=_,e[29]=T):T=e[29],T}function _n(o){return o.value}function Ye(o){const e=U.c(16),{label:t,iconSize:s,className:i,iconClassName:a,labelClassName:r}=o,l=s===void 0?14:s;let c;e[0]!==i?(c=J("inline-flex items-center gap-2",i),e[0]=i,e[1]=c):c=e[1];let m;e[2]!==a?(m=J("shrink-0 animate-spin",a),e[2]=a,e[3]=m):m=e[3];let f;e[4]!==l||e[5]!==m?(f=n.jsx(mt,{size:l,className:m}),e[4]=l,e[5]=m,e[6]=f):f=e[6];let p;e[7]!==r?(p=J("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 h;return e[12]!==c||e[13]!==f||e[14]!==d?(h=n.jsxs("span",{className:c,children:[f,d]}),e[12]=c,e[13]=f,e[14]=d,e[15]=h):h=e[15],h}const En=He({propertyId:ue().min(1,"Selecione uma propriedade")});function wn(o){const e=U.c(55),{card:t,connectionId:s,companionClient:i,selfClient:a,org:r,onDone:l,onIsPendingChange:c}=o;let m;e[0]!==s||e[1]!==r.id?(m=W.commerceDiscoveryCompanionGaProperties(r.id,s),e[0]=s,e[1]=r.id,e[2]=m):m=e[2];let f;e[3]!==i?(f=async()=>{const S=await i.callTool({name:"get-account-summaries",arguments:{}}),D=Z(S);return Sn(D)},e[3]=i,e[4]=f):f=e[4];let p;e[5]!==m||e[6]!==f?(p={queryKey:m,queryFn:f},e[5]=m,e[6]=f,e[7]=p):p=e[7];const d=ut(p);let h;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=Ve(En),e[8]=h):h=e[8];const v=t.configurationState?.propertyId||"";let j;e[9]!==v?(j={resolver:h,defaultValues:{propertyId:v}},e[9]=v,e[10]=j):j=e[10];const x=Be(j);let g;e[11]!==t||e[12]!==l||e[13]!==r||e[14]!==a?(g={card:t,selfClient:a,org:r,onDone:l},e[11]=t,e[12]=l,e[13]=r,e[14]=a,e[15]=g):g=e[15];const{save:u,isPending:b,error:y}=We(g);let C,_;e[16]!==b||e[17]!==c?(C=()=>{c?.(b)},_=[b,c],e[16]=b,e[17]=c,e[18]=C,e[19]=_):(C=e[18],_=e[19]),K.useEffect(C,_);let T;if(e[20]!==x||e[21]!==u){let S;e[23]!==u?(S=async D=>{u(D)},e[23]=u,e[24]=S):S=e[24],T=x.handleSubmit(S),e[20]=x,e[21]=u,e[22]=T}else T=e[22];const N=T;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(Ye,{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 E;e[27]!==d.data?(E=d.data||[],e[27]=d.data,e[28]=E):E=e[28];const I=E;if(I.flatMap(In).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 A;e[30]!==b||e[31]!==I?(A=S=>{const{field:D}=S;return n.jsxs(pe,{children:[n.jsx(ge,{children:n.jsx(Nt,{options:I.flatMap(Tn),value:D.value,onChange:D.onChange,disabled:b,ariaLabel:"Propriedade do Google Analytics"})}),n.jsx(he,{})]})},e[30]=b,e[31]=I,e[32]=A):A=e[32];let w;e[33]!==x.control||e[34]!==A?(w=n.jsx(fe,{control:x.control,name:"propertyId",render:A}),e[33]=x.control,e[34]=A,e[35]=w):w=e[35];let O;e[36]!==x||e[37]!==w?(O=n.jsx(Qe,{...x,children:w}),e[36]=x,e[37]=w,e[38]=O):O=e[38];let k;e[39]!==y?(k=y&&n.jsx("p",{role:"alert",className:"text-sm text-destructive",children:y instanceof Error?y.message:"Não foi possível salvar a configuração"}),e[39]=y,e[40]=k):k=e[40];let z;e[41]!==b||e[42]!==l?(z=n.jsx(V,{type:"button",variant:"outline",onClick:l,disabled:b,children:"Cancelar"}),e[41]=b,e[42]=l,e[43]=z):z=e[43];const F=b?"Salvando...":"Salvar";let L;e[44]!==b||e[45]!==F?(L=n.jsx(V,{type:"submit",disabled:b,children:F}),e[44]=b,e[45]=F,e[46]=L):L=e[46];let M;e[47]!==z||e[48]!==L?(M=n.jsxs(Ge,{className:"pt-4",children:[z,L]}),e[47]=z,e[48]=L,e[49]=M):M=e[49];let q;return e[50]!==N||e[51]!==O||e[52]!==k||e[53]!==M?(q=n.jsxs("form",{onSubmit:N,className:"space-y-4",children:[O,k,M]}),e[50]=N,e[51]=O,e[52]=k,e[53]=M,e[54]=q):q=e[54],q}function Tn(o){return o.options}function In(o){return o.options}const On=He({siteUrl:ue().min(1,"Selecione um site")});function kn(o){const e=U.c(59),{card:t,connectionId:s,companionClient:i,selfClient:a,org:r,contextSiteUrl:l,onDone:c,onIsPendingChange:m}=o;let f;e[0]!==s||e[1]!==r.id?(f=W.commerceDiscoveryCompanionGscSites(r.id,s),e[0]=s,e[1]=r.id,e[2]=f):f=e[2];let p;e[3]!==i?(p=async()=>{const S=await i.callTool({name:"list_sites",arguments:{}});return Z(S).sites||[]},e[3]=i,e[4]=p):p=e[4];let d;e[5]!==f||e[6]!==p?(d={queryKey:f,queryFn:p},e[5]=f,e[6]=p,e[7]=d):d=e[7];const h=ut(d);let v;e[8]===Symbol.for("react.memo_cache_sentinel")?(v=Ve(On),e[8]=v):v=e[8];const j=t.configurationState?.siteUrl||"";let x;e[9]!==j?(x={resolver:v,defaultValues:{siteUrl:j}},e[9]=j,e[10]=x):x=e[10];const g=Be(x);let u;e[11]!==t||e[12]!==c||e[13]!==r||e[14]!==a?(u={card:t,selfClient:a,org:r,onDone:c},e[11]=t,e[12]=c,e[13]=r,e[14]=a,e[15]=u):u=e[15];const{save:b,isPending:y,error:C}=We(u);let _,T;e[16]!==y||e[17]!==m?(_=()=>{m?.(y)},T=[y,m],e[16]=y,e[17]=m,e[18]=_,e[19]=T):(_=e[18],T=e[19]),K.useEffect(_,T);let N;if(e[20]!==g||e[21]!==b){let S;e[23]!==b?(S=async D=>{b(D)},e[23]=b,e[24]=S):S=e[24],N=g.handleSubmit(S),e[20]=g,e[21]=b,e[22]=N}else N=e[22];const E=N;if(h.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(Ye,{label:"Carregando sites..."})}),e[25]=S):S=e[25],S}if(h.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,$;if(e[27]!==t.configurationState?.siteUrl||e[28]!==l||e[29]!==g||e[30]!==h.data){$=Symbol.for("react.early_return_sentinel");e:{if(I=h.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],$=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=jn(l,I);D&&g.setValue("siteUrl",D)}}e[27]=t.configurationState?.siteUrl,e[28]=l,e[29]=g,e[30]=h.data,e[31]=I,e[32]=$}else I=e[31],$=e[32];if($!==Symbol.for("react.early_return_sentinel"))return $;let A;e[34]!==y||e[35]!==I?(A=S=>{const{field:D}=S;return n.jsxs(pe,{children:[n.jsx(ge,{children:n.jsx(Nt,{options:I.map(An),value:D.value,onChange:D.onChange,disabled:y,ariaLabel:"Site verificado"})}),n.jsx(he,{})]})},e[34]=y,e[35]=I,e[36]=A):A=e[36];let w;e[37]!==g.control||e[38]!==A?(w=n.jsx(fe,{control:g.control,name:"siteUrl",render:A}),e[37]=g.control,e[38]=A,e[39]=w):w=e[39];let O;e[40]!==g||e[41]!==w?(O=n.jsx(Qe,{...g,children:w}),e[40]=g,e[41]=w,e[42]=O):O=e[42];let k;e[43]!==C?(k=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]=k):k=e[44];let z;e[45]!==y||e[46]!==c?(z=n.jsx(V,{type:"button",variant:"outline",onClick:c,disabled:y,children:"Cancelar"}),e[45]=y,e[46]=c,e[47]=z):z=e[47];const F=y?"Salvando...":"Salvar";let L;e[48]!==y||e[49]!==F?(L=n.jsx(V,{type:"submit",disabled:y,children:F}),e[48]=y,e[49]=F,e[50]=L):L=e[50];let M;e[51]!==z||e[52]!==L?(M=n.jsxs(Ge,{className:"pt-4",children:[z,L]}),e[51]=z,e[52]=L,e[53]=M):M=e[53];let q;return e[54]!==E||e[55]!==O||e[56]!==k||e[57]!==M?(q=n.jsxs("form",{onSubmit:E,className:"space-y-4",children:[O,k,M]}),e[54]=E,e[55]=O,e[56]=k,e[57]=M,e[58]=q):q=e[58],q}function An(o){return{value:o.siteUrl,label:o.siteUrl}}const Un={vtex:Nn,"google-analytics":wn,"google-search-console":kn};function Rn(){const o=U.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 at="rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground";function Pn(o){const e=U.c(35),{card:t,connecting:s,disabled:i,onConnect:a,org:r,selfClient:l,siteUrl:c,autoOpenConfigFieldKey:m,onAutoOpenConfigHandled:f}=o,p=t.linkedConnectionId;let d;e[0]!==m||e[1]!==t||e[2]!==s||e[3]!==i||e[4]!==p||e[5]!==f||e[6]!==a||e[7]!==r||e[8]!==l||e[9]!==c?(d=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(St,{size:16,className:"text-success"})," Conectado"]}),n.jsx(K.Suspense,{fallback:n.jsx($n,{}),children:n.jsx(Ln,{card:t,org:r,selfClient:l,connectionId:p,contextSiteUrl:c,autoOpen:hn({autoOpenFieldKey:m,card:t}),onAutoOpenHandled:f})})]}):n.jsx(V,{type:"button",variant:"outline",size:"sm",className:"sm:w-full",disabled:i||s,onClick:a,"aria-label":`Conectar ${t.title}`,children:s?n.jsx(mt,{size:16,className:"animate-spin"}):"Conectar"}),e[0]=m,e[1]=t,e[2]=s,e[3]=i,e[4]=p,e[5]=f,e[6]=a,e[7]=r,e[8]=l,e[9]=c,e[10]=d):d=e[10];const h=d;let v;e[11]!==t.icon||e[12]!==t.title?(v=n.jsx(jt,{icon:t.icon,name:t.title,size:"sm",fit:"contain",className:"shrink-0 p-1.5"}),e[11]=t.icon,e[12]=t.title,e[13]=v):v=e[13];let j;e[14]!==t.area?(j=t.area&&n.jsx("span",{className:J("hidden sm:inline-block",at),children:t.area}),e[14]=t.area,e[15]=j):j=e[15];let x;e[16]!==v||e[17]!==j?(x=n.jsxs("div",{className:"shrink-0 self-start sm:flex sm:w-full sm:items-center sm:justify-between sm:gap-2",children:[v,j]}),e[16]=v,e[17]=j,e[18]=x):x=e[18];let g;e[19]!==t.area?(g=t.area&&n.jsx("span",{className:J("mb-1 inline-block sm:hidden",at),children:t.area}),e[19]=t.area,e[20]=g):g=e[20];let u;e[21]!==t.title?(u=n.jsx("p",{className:"text-sm font-medium text-foreground",children:t.title}),e[21]=t.title,e[22]=u):u=e[22];let b;e[23]!==t.headline?(b=t.headline&&n.jsx("p",{className:"mt-0.5 line-clamp-2 text-sm leading-5 text-muted-foreground",children:t.headline}),e[23]=t.headline,e[24]=b):b=e[24];let y;e[25]!==g||e[26]!==u||e[27]!==b?(y=n.jsxs("div",{className:"min-w-0 flex-1",children:[g,u,b]}),e[25]=g,e[26]=u,e[27]=b,e[28]=y):y=e[28];let C;e[29]!==h?(C=n.jsx("div",{className:"shrink-0 sm:mt-auto sm:w-full sm:pt-1",children:h}),e[29]=h,e[30]=C):C=e[30];let _;return e[31]!==x||e[32]!==y||e[33]!==C?(_=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:[x,y,C]}),e[31]=x,e[32]=y,e[33]=C,e[34]=_):_=e[34],_}function $n(){const o=U.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 Ln(o){const e=U.c(46),{card:t,org:s,selfClient:i,connectionId:a,contextSiteUrl:r,autoOpen:l,onAutoOpenHandled:c}=o;let m;e[0]!==a||e[1]!==s.id||e[2]!==s.slug?(m={connectionId:a,orgId:s.id,orgSlug:s.slug},e[0]=a,e[1]=s.id,e[2]=s.slug,e[3]=m):m=e[3];const f=Ue(m),[p,d]=K.useState(l),[h,v]=K.useState(!1),j=Un[t.bindingType],x=gn(t.configurationState);let g;e[4]!==l||e[5]!==c?(g=()=>{d(!1),l&&c()},e[4]=l,e[5]=c,e[6]=g):g=e[6];const u=g;let b;e[7]!==u||e[8]!==h?(b=M=>{if(!(!M&&h)){if(!M){u();return}d(!0)}},e[7]=u,e[8]=h,e[9]=b):b=e[9];const y=b;if(!j)return null;let C;e[10]===Symbol.for("react.memo_cache_sentinel")?(C=()=>d(!0),e[10]=C):C=e[10];const _=`Configurar ${t.title}`;let T;e[11]===Symbol.for("react.memo_cache_sentinel")?(T=n.jsx(Wt,{size:16}),e[11]=T):T=e[11];let N;e[12]!==_?(N=n.jsx(Vt,{asChild:!0,children:n.jsx(V,{type:"button",variant:"ghost",size:"icon-sm",className:"shrink-0",onClick:C,"aria-label":_,children:T})}),e[12]=_,e[13]=N):N=e[13];const E=x.length>0?"Editar configuração":"Configurar";let I;e[14]!==E?(I=n.jsx(Bt,{children:E}),e[14]=E,e[15]=I):I=e[15];let $;e[16]!==N||e[17]!==I?($=n.jsxs(Gt,{children:[N,I]}),e[16]=N,e[17]=I,e[18]=$):$=e[18];let A;e[19]!==t.icon||e[20]!==t.title?(A=n.jsx(jt,{icon:t.icon,name:t.title,size:"md",fit:"contain",className:"p-1.5"}),e[19]=t.icon,e[20]=t.title,e[21]=A):A=e[21];let w;e[22]!==t.title?(w=n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[n.jsx(Ft,{children:t.title}),n.jsxs(Mt,{children:["Configure o ",t.title," para enriquecer os dados"]})]}),e[22]=t.title,e[23]=w):w=e[23];let O;e[24]!==A||e[25]!==w?(O=n.jsxs(Kt,{className:"flex-row items-center gap-3 space-y-0 text-left",children:[A,w]}),e[24]=A,e[25]=w,e[26]=O):O=e[26];let k;e[27]!==j||e[28]!==t||e[29]!==u||e[30]!==f||e[31]!==a||e[32]!==r||e[33]!==s||e[34]!==i?(k=n.jsx(j,{card:t,connectionId:a,companionClient:f,selfClient:i,org:s,contextSiteUrl:r,onDone:u,onIsPendingChange:v}),e[27]=j,e[28]=t,e[29]=u,e[30]=f,e[31]=a,e[32]=r,e[33]=s,e[34]=i,e[35]=k):k=e[35];let z;e[36]!==O||e[37]!==k?(z=n.jsxs(qt,{className:"sm:max-w-lg",children:[O,k]}),e[36]=O,e[37]=k,e[38]=z):z=e[38];let F;e[39]!==p||e[40]!==y||e[41]!==z?(F=n.jsx(Ht,{open:p,onOpenChange:y,children:z}),e[39]=p,e[40]=y,e[41]=z,e[42]=F):F=e[42];let L;return e[43]!==$||e[44]!==F?(L=n.jsxs(n.Fragment,{children:[$,F]}),e[43]=$,e[44]=F,e[45]=L):L=e[45],L}const Je={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 zn(o){const e=U.c(30),{selfClient:t,org:s,cdConnectionId:i}=o;let a;e[0]!==i||e[1]!==s.id||e[2]!==s.slug?(a={connectionId:i,orgId:s.id,orgSlug:s.slug},e[0]=i,e[1]=s.id,e[2]=s.slug,e[3]=a):a=e[3];const r=Ue(a);let l;e[4]!==i||e[5]!==s.id?(l=W.commerceDiscoveryCompanionSchema(s.id,i),e[4]=i,e[5]=s.id,e[6]=l):l=e[6];let c;e[7]!==r?(c=async()=>{const P=await r.callTool({name:"MCP_CONFIGURATION",arguments:{}});return Z(P)},e[7]=r,e[8]=c):c=e[8];let m;e[9]!==l||e[10]!==c?(m={queryKey:l,queryFn:c},e[9]=l,e[10]=c,e[11]=m):m=e[11];const f=me(m),p=dn(f.data?.stateSchema??{properties:{}}),d=p.map(Qn),h=p.map(Gn).filter(Bn),v=p.filter(Vn).map(Hn),j=[...h,...v].sort().join(",");let x;e[12]!==i||e[13]!==s.id?(x=W.commerceDiscoveryConnection(s.id,i),e[12]=i,e[13]=s.id,e[14]=x):x=e[14];let g;e[15]!==i||e[16]!==t?(g=async()=>{const P=await t.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:i}});return Z(P)},e[15]=i,e[16]=t,e[17]=g):g=e[17];let u;e[18]!==x||e[19]!==g?(u={queryKey:x,queryFn:g},e[18]=x,e[19]=g,e[20]=u):u=e[20];const y=me(u).data?.item?.configuration_state??null;let C;e[21]!==y?(C=P=>y?.[P.fieldKey]?.value,e[21]=y,e[22]=C):C=e[22];const _=p.map(C).filter(qn),T=[...d.map(Kn),...h.map(Mn),..._.map(Fn)].sort().join(","),E=me({queryKey:W.commerceDiscoveryCompanionConnections(s.id,T),queryFn:async()=>{if(p.length===0)return{items:[]};const P=[{field:["app_name"],operator:"in",value:d},{field:["app_id"],operator:"in",value:h}];_.length>0&&P.push({field:["id"],operator:"in",value:_});const G=await t.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{operator:"or",conditions:P},limit:1e3}});return Z(G)}}).data?.items??[],I=new Set(_),$=E.filter(P=>I.has(P.id)),A=$.filter(Dn);let w;e[23]!==s.id||e[24]!==s.slug?(w=P=>({queryKey:W.commerceDiscoveryCompanionOAuthStatus(s.id,P.id),queryFn:async()=>{try{const G=await fetch(`/api/${encodeURIComponent(s.slug)}/connections/${encodeURIComponent(P.id)}/oauth-token/status`,{credentials:"include"});return G.ok?{hasToken:(await G.json()).hasToken===!0}:{hasToken:!1}}catch{return{hasToken:!1}}},retry:!1}),e[23]=s.id,e[24]=s.slug,e[25]=w):w=e[25];const O=sn({queries:A.map(w)});let k;e[26]!==O?(k=(P,G)=>[P.id,O[G]?.data?.hasToken===!0],e[26]=O,e[27]=k):k=e[27];const z=new Map(A.map(k)),F={};for(const P of $)F[P.id]=!P.oauth_config||!!P.connection_token||z.get(P.id)===!0;const L=me({queryKey:W.commerceDiscoveryCompanionRegistry(s.id,j),queryFn:async()=>{if(p.length===0)return{items:[]};const P=mn(h,v),G=await Jt(yt.REGISTRY(s.id),s.id,s.slug,"COLLECTION_REGISTRY_APP_LIST",{...P?{where:P}:{},limit:1e3});return Z(G)}}),M={},q={};for(const P of L.data?.items??[])M[P.id]=P,P.server?.name&&(q[P.server.name]=P);const S=bn({requirements:p,itemsById:M,itemsByName:q,connections:E,connectionReadiness:F,configurationState:y,curated:Je});let D;return e[28]!==S?(D={cards:S},e[28]=S,e[29]=D):D=e[29],D}function Dn(o){return o.oauth_config&&!o.connection_token}function Fn(o){return`linked:${o}`}function Mn(o){return`app:${o}`}function Kn(o){return`binding:${o}`}function qn(o){return typeof o=="string"&&o.length>0}function Hn(o){return o.bindingType}function Vn(o){return!Je[o.bindingType]}function Bn(o){return!!o}function Gn(o){return Je[o.bindingType]?.registryAppId}function Qn(o){return o.bindingType}function Wn({selfClient:o,org:e,userId:t,cdConnectionId:s}){const i=dt(),[a,r]=K.useState(null),[l,c]=K.useState(null),m=async(p,d)=>{const h=await o.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:p,data:d}});return Z(h)};async function f(p){r(p.fieldKey),c(null);try{let d=p.candidateConnectionId;if(!d){const u=Zt(p.registryItem,e.id,t,{remoteIndex:0}),b=u.connection_type==="STDIO",y=!!u.connection_url,C=b&&u.connection_headers&&typeof u.connection_headers=="object"&&"command"in u.connection_headers;if(!y&&!C)return c(`${p.title} cannot be connected: no connection method available`),!1;const _=await o.callTool({name:"COLLECTION_CONNECTIONS_CREATE",arguments:{data:u}});d=Z(_).item.id}const h=d,v=await on({connectionId:h,orgId:e.id,orgSlug:e.slug,persistFallback:u=>m(h,{connection_token:u}).then(()=>{})});if(!v.ok)return c(`Couldn't sign in to ${p.title}: ${v.error}`),!1;const j=await o.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:s}}),x=Z(j).item?.configuration_state??null,g=un(x,p.fieldKey,p.bindingType,h);return await m(s,{configuration_state:g}),await i.invalidateQueries({queryKey:W.commerceDiscoveryConnection(e.id,s)}),await i.invalidateQueries({queryKey:W.commerceDiscoveryCompanionConnectionsPrefix(e.id)}),!0}catch(d){return c(d instanceof Error?d.message:String(d)),!1}finally{r(null)}}return{connect:f,connectingFieldKey:a,error:l}}const Ze="flex min-h-0 flex-1 flex-col gap-6 md:grid md:flex-none md:gap-4";function Xe(){const o=U.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 Yn(){const o=U.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(Jn)}),o[0]=e):e=o[0],e}function Jn(o){return n.jsx(Rn,{},o)}function et(){const o=U.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsxs("div",{className:Ze,children:[n.jsx(Xe,{}),n.jsx(Yn,{})]}),o[0]=e):e=o[0],e}function Zn(o){const e=U.c(5),{onRetry:t}=o;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(Xe,{}),e[0]=s):s=e[0];let i,a;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."}),a=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]=a):(i=e[1],a=e[2]);let r;return e[3]!==t?(r=n.jsxs("div",{className:Ze,children:[s,n.jsxs("div",{role:"alert",className:"rounded-2xl border border-border bg-card p-4",children:[i,a,n.jsx(V,{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 Xn(o){const e=U.c(2);let t;return e[0]!==o?(t=n.jsx(ft,{children:s=>{const{reset:i}=s;return n.jsx(pt,{fallback:a=>{const{resetError:r}=a;return n.jsx(Zn,{onRetry:()=>{i(),r()}})},children:n.jsx(K.Suspense,{fallback:n.jsx(et,{}),children:n.jsx(es,{...o})})})}}),e[0]=o,e[1]=t):t=e[1],t}function es(o){const e=U.c(37),{org:t,cdConnectionId:s,siteUrl:i}=o,{data:a}=ke.useSession(),r=a?.user?.id??"";let l;e[0]!==t.id||e[1]!==t.slug?(l={connectionId:vt,orgId:t.id,orgSlug:t.slug},e[0]=t.id,e[1]=t.slug,e[2]=l):l=e[2];const c=Ue(l);let m;e[3]!==s||e[4]!==t||e[5]!==c?(m={selfClient:c,org:t,cdConnectionId:s},e[3]=s,e[4]=t,e[5]=c,e[6]=m):m=e[6];const{cards:f}=zn(m);let p;e[7]!==s||e[8]!==t||e[9]!==c||e[10]!==r?(p={selfClient:c,org:t,userId:r,cdConnectionId:s},e[7]=s,e[8]=t,e[9]=c,e[10]=r,e[11]=p):p=e[11];const{connect:d,connectingFieldKey:h,error:v}=Wn(p),[j,x]=K.useState(null);if(f.length===0)return null;const g=h!==null;let u;e[12]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(Xe,{}),e[12]=u):u=e[12];let b;e[13]!==v?(b=v&&n.jsx("p",{role:"alert",className:"mb-3 text-sm text-destructive",children:v}),e[13]=v,e[14]=b):b=e[14];let y;if(e[15]!==j||e[16]!==g||e[17]!==f||e[18]!==d||e[19]!==h||e[20]!==t||e[21]!==c||e[22]!==i){let T;e[24]!==j||e[25]!==g||e[26]!==d||e[27]!==h||e[28]!==t||e[29]!==c||e[30]!==i?(T=N=>{const E=async()=>{await d(N)&&x(N.fieldKey)};return n.jsx(Pn,{card:N,connecting:h===N.fieldKey,disabled:g&&h!==N.fieldKey,org:t,selfClient:c,siteUrl:i,autoOpenConfigFieldKey:j,onAutoOpenConfigHandled:()=>x(I=>I===N.fieldKey?null:I),onConnect:()=>{E()}},N.fieldKey)},e[24]=j,e[25]=g,e[26]=d,e[27]=h,e[28]=t,e[29]=c,e[30]=i,e[31]=T):T=e[31],y=f.map(T),e[15]=j,e[16]=g,e[17]=f,e[18]=d,e[19]=h,e[20]=t,e[21]=c,e[22]=i,e[23]=y}else y=e[23];let C;e[32]!==y?(C=n.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:y}),e[32]=y,e[33]=C):C=e[33];let _;return e[34]!==b||e[35]!==C?(_=n.jsxs("div",{className:Ze,children:[u,n.jsxs(Ke,{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:[b,C]})]}),e[34]=b,e[35]=C,e[36]=_):_=e[36],_}const tt="https://decocms.com/agendar",ts="Precisa de ajuda? Fale conosco",ns="Agende uma chamada de 20 minutos e rodamos o diagnóstico com você, ao vivo.",_t={photo:"https://decoims.com/image?src=decocms%2Fb07a1c19-0cd6-49c8-b326-86055ee78605%2Fauthor-1763423987973-baby.jpeg&quality=original&fit=cover&width=200&height=200"},Et="var(--brand-green-dark)";function nt({siteUrl:o,email:e}){const t=new URL(tt);return o&&t.searchParams.set("siteUrl",o),e&&t.searchParams.set("email",e),t.toString()}function ss(o){const e=U.c(9),{href:t,size:s,className:i}=o,a=t===void 0?tt:t,r=s===void 0?"lg":s;let l;e[0]!==i?(l=J("w-full",i),e[0]=i,e[1]=l):l=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(Ct,{size:16}),e[2]=c):c=e[2];let m;e[3]!==a?(m=n.jsxs("a",{href:a,target:"_blank",rel:"noreferrer",children:["Agendar uma reunião",c]}),e[3]=a,e[4]=m):m=e[4];let f;return e[5]!==r||e[6]!==l||e[7]!==m?(f=n.jsx(V,{asChild:!0,variant:"outline",size:r,className:l,children:m}),e[5]=r,e[6]=l,e[7]=m,e[8]=f):f=e[8],f}function os(o){const e=U.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 a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx("div",{className:"h-full w-full overflow-hidden rounded-full border-4 border-card bg-muted",children:n.jsx("img",{src:_t.photo,alt:"Especialista da deco",className:"h-full w-full object-cover",loading:"lazy"})}),e[2]=a):a=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 l;return e[4]!==i?(l=n.jsxs("div",{className:"relative shrink-0",style:i,children:[a,r]}),e[4]=i,e[5]=l):l=e[5],l}function st(o){const e=U.c(5),{href:t}=o;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx("div",{className:"h-20",style:{backgroundColor:Et}}),e[0]=s):s=e[0];let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx("div",{className:"-mt-9 mb-4",children:n.jsx(os,{})}),e[1]=i):i=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx("h2",{className:"text-lg font-medium leading-6 text-foreground",children:ts}),n.jsx("p",{className:"text-sm leading-5 text-muted-foreground",children:ns})]}),e[2]=a):a=e[2];let r;return e[3]!==t?(r=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:[s,n.jsxs("div",{className:"px-8 pb-8",children:[i,a,n.jsx(ss,{href:t,size:"lg",className:"mt-6"})]})]})}),e[3]=t,e[4]=r):r=e[4],r}function is(o){const e=U.c(8),{className:t,href:s}=o,i=s===void 0?tt:s;let a;e[0]!==t?(a=J("flex items-center gap-4 rounded-2xl border border-border bg-card p-5 card-shadow transition-colors hover:bg-accent",t),e[0]=t,e[1]=a):a=e[1];let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=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 ${Et}`},children:n.jsx("img",{src:_t.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[2]=r):r=e[2];let l,c;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsxs("span",{className:"flex-1 text-base font-medium leading-5 text-foreground",children:["Precisa de ajuda?",n.jsx("br",{}),"Fale conosco"]}),c=n.jsx(Ct,{size:18,className:"shrink-0 text-muted-foreground"}),e[3]=l,e[4]=c):(l=e[3],c=e[4]);let m;return e[5]!==i||e[6]!==a?(m=n.jsxs("a",{href:i,target:"_blank",rel:"noreferrer",className:a,children:[r,l,c]}),e[5]=i,e[6]=a,e[7]=m):m=e[7],m}function wt(o){const e=U.c(10),{host:t}=o,s=`https://www.google.com/s2/favicons?domain=${t}&sz=128`;let i,a,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"}),a=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]=a,e[2]=r):(i=e[0],a=e[1],r=e[2]);let l;e[3]!==s?(l=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]=l):l=e[4];let c;e[5]!==t?(c=n.jsx("span",{className:"text-lg font-medium text-foreground",children:t}),e[5]=t,e[6]=c):c=e[6];let m;return e[7]!==l||e[8]!==c?(m=n.jsxs("div",{className:"flex items-center gap-3",children:[i,a,r,l,c]}),e[7]=l,e[8]=c,e[9]=m):m=e[9],m}const rs={workspace:"Preparando seu workspace de commerce...",generic:"Preparando..."};function as(o){return rs[o]}function ot(o){const e=U.c(4),{variant:t}=o;let s;e[0]!==t?(s=as(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(Ye,{label:s,className:"text-muted-foreground"})}),e[2]=s,e[3]=i):i=e[3],i}function Io(){const o=U.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(ds,{}),o[0]=e):e=o[0],e}const Tt=K.createContext(null),It=()=>K.useContext(Tt);function Q(o){const e=U.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 a=gt(i),{data:r}=ke.useSession(),l=r?.user?.email;let c;e[4]!==a.siteUrl||e[5]!==l?(c=nt({siteUrl:a.siteUrl,email:l}),e[4]=a.siteUrl,e[5]=l,e[6]=c):c=e[6];const m=c;let f;e[7]!==m||e[8]!==s?(f=s??n.jsx(st,{href:m}),e[7]=m,e[8]=s,e[9]=f):f=e[9];let p;return e[10]!==t||e[11]!==f?(p=n.jsx($t,{...t,visual:f}),e[10]=t,e[11]=f,e[12]=p):p=e[12],p}const ls={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 cs(o){if(!o)return null;const e=Te(o);return e.ok?new URL(e.value).hostname:null}function lt(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 ct=!1;function ds(){const o=gt({from:"/commerce-onboarding"}),{org:e,siteUrl:t}=o,s=cs(t);return!ct&&kt()&&(ct=!0,At("commerce_onboarding_viewed",{site_url:t,domain:s??void 0,...s?{$set:{last_scanned_domain:s}}:{}})),n.jsx(Tt.Provider,{value:s,children:n.jsx(ms,{requestedOrgSlug:e,siteUrl:t})})}function ms(o){const e=U.c(8),{requestedOrgSlug:t,siteUrl:s}=o,{data:i,isPending:a}=ke.useSession(),r=It();if(a){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(Q,{children:n.jsx(ot,{variant:"generic"})}),e[0]=c):c=e[0],c}if(!i){const c=typeof window>"u"?"/commerce-onboarding":`${window.location.pathname}${window.location.search}`;let m;e[1]!==r?(m=r?n.jsx(wt,{host:r}):void 0,e[1]=r,e[2]=m):m=e[2];let f;return e[3]!==m?(f=n.jsx(Q,{children:n.jsx(Pt,{callbackUrl:c,allowAutoLogin:!1,title:"Desbloqueie seu diagnóstico completo",subtitle:null,brand:m,copy:ls})}),e[3]=m,e[4]=f):f=e[4],f}let l;return e[5]!==t||e[6]!==s?(l=n.jsx(us,{requestedOrgSlug:t,siteUrl:s}),e[5]=t,e[6]=s,e[7]=l):l=e[7],l}function us(o){const e=U.c(40),{requestedOrgSlug:t,siteUrl:s}=o,i=ht(),a=Ut(),[r,l]=K.useState(null),[c,m]=K.useState(null),f=a.data?.map(ps)??[];let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={mutationFn:fs,retry:!1,onSuccess:u=>{m(u)}},e[0]=p):p=e[0];const d=Oe(p);if(a.isPending){let u;return e[1]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(Q,{children:n.jsx(ot,{variant:"workspace"})}),e[1]=u):u=e[1],u}if(a.error){let u;return e[2]!==a?(u=n.jsx(Ie,{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:()=>a.refetch()}),e[2]=a,e[3]=u):u=e[3],u}const h=t?f.find(u=>u.slug===t):null;if(h){let u;return e[4]!==h||e[5]!==s?(u=n.jsx(we,{org:h,initialSiteUrl:s}),e[4]=h,e[5]=s,e[6]=u):u=e[6],u}if(t){let u;return e[7]!==a?(u=n.jsx(Ie,{title:"Organização não encontrada",description:"Não conseguimos encontrar essa organização na sua conta.",actionLabel:"Tentar novamente",onRetry:()=>a.refetch()}),e[7]=a,e[8]=u):u=e[8],u}if(r){let u;return e[9]!==r||e[10]!==s?(u=n.jsx(we,{org:r,initialSiteUrl:s}),e[9]=r,e[10]=s,e[11]=u):u=e[11],u}if(f.length===1&&f[0]){let u;return e[12]!==f[0]||e[13]!==s?(u=n.jsx(we,{org:f[0],initialSiteUrl:s}),e[12]=f[0],e[13]=s,e[14]=u):u=e[14],u}if(f.length>1){let u;e[15]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(X,{title:"Escolha uma organização",description:"Selecione onde o diagnóstico de commerce deve continuar."}),e[15]=u):u=e[15];let b;e[16]===Symbol.for("react.memo_cache_sentinel")?(b=C=>l(C),e[16]=b):b=e[16];let y;return e[17]!==f?(y=n.jsx(Q,{children:n.jsxs("div",{className:"grid gap-10",children:[u,n.jsx(Ke,{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:n.jsx(it,{organizations:f,selectLabel:"Continuar",onSelected:b})})]})}),e[17]=f,e[18]=y):y=e[18],y}if(!c){let u;e[19]!==d?(u=()=>{d.reset(),d.mutate()},e[19]=d,e[20]=u):u=e[20];let b;return e[21]!==d||e[22]!==u?(b=n.jsx(gs,{mutation:d,onRetry:u}),e[21]=d,e[22]=u,e[23]=b):b=e[23],b}const v=c;if(v?.success&&(v.status==="created"||v.status==="joined"||v.status==="already_has_organization")&&v.organization){let u;return e[24]!==v.organization||e[25]!==s?(u=n.jsx(we,{org:v.organization,initialSiteUrl:s}),e[24]=v.organization,e[25]=s,e[26]=u):u=e[26],u}if(v?.status==="ambiguous"&&v.organizations&&v.organizations.length>0){let u;e[27]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(X,{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]=u):u=e[27];const b=v.domain??void 0;let y;e[28]!==i||e[29]!==s?(y=(_,T)=>{xt(),l({..._,slug:T}),i({to:"/commerce-onboarding",search:{org:T,siteUrl:s}})},e[28]=i,e[29]=s,e[30]=y):y=e[30];let C;return e[31]!==v.organizations||e[32]!==b||e[33]!==y?(C=n.jsx(Q,{children:n.jsxs("div",{className:"grid gap-10",children:[u,n.jsx(Ke,{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:n.jsx(it,{organizations:v.organizations,domain:b,onJoined:y})})]})}),e[31]=v.organizations,e[32]=b,e[33]=y,e[34]=C):C=e[34],C}const j=v?.error??"Não conseguimos determinar uma organização de commerce para esta conta.";let x;e[35]!==d?(x=()=>{m(null),d.reset()},e[35]=d,e[36]=x):x=e[36];let g;return e[37]!==j||e[38]!==x?(g=n.jsx(Ie,{title:"O onboarding de commerce precisa de suporte",description:j,actionLabel:"Tentar novamente",onRetry:x}),e[37]=j,e[38]=x,e[39]=g):g=e[39],g}async function fs(){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&&xt(),e}function ps(o){return{id:o.id,name:o.name,slug:o.slug,logo:o.logo??null}}function gs(o){const e=U.c(7),{mutation:t,onRetry:s}=o,i=K.useRef(!1);let a;e[0]!==t?(a=m=>{!m||i.current||(i.current=!0,t.mutate())},e[0]=t,e[1]=a):a=e[1];const r=a;if(t.error){let m;return e[2]!==s?(m=n.jsx(Ie,{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 l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(ot,{variant:"generic"}),e[4]=l):l=e[4];let c;return e[5]!==r?(c=n.jsx(Q,{children:n.jsx("div",{ref:r,children:l})}),e[5]=r,e[6]=c):c=e[6],c}function X(o){const e=U.c(8),{title:t,description:s}=o,i=It();let a;e[0]!==i?(a=i?n.jsx(wt,{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]=a):a=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 l;return e[5]!==a||e[6]!==r?(l=n.jsxs("div",{className:"grid gap-10",children:[a,r]}),e[5]=a,e[6]=r,e[7]=l):l=e[7],l}function Ie(o){const e=U.c(9),{title:t,description:s,actionLabel:i,onRetry:a}=o;let r;e[0]!==s||e[1]!==t?(r=n.jsx(X,{title:t,description:s}),e[0]=s,e[1]=t,e[2]=r):r=e[2];let l;e[3]!==i||e[4]!==a?(l=n.jsx(V,{type:"button",size:"xl",className:"w-full",onClick:a,children:i}),e[3]=i,e[4]=a,e[5]=l):l=e[5];let c;return e[6]!==r||e[7]!==l?(c=n.jsx(Q,{children:n.jsxs("div",{className:"grid gap-10",children:[r,l]})}),e[6]=r,e[7]=l,e[8]=c):c=e[8],c}function hs(o){return o.content?.find(e=>e.text)?.text??"A configuração do Commerce Discovery falhou."}function Ee(o){const e=o;if(e.isError)throw new Error(hs(e));return e.structuredContent??o}function we(o){const e=U.c(10),{org:t,initialSiteUrl:s}=o,{data:i}=ke.useSession(),a=i?.user?.email;let r;e[0]!==s||e[1]!==a?(r=nt({siteUrl:s,email:a}),e[0]=s,e[1]=a,e[2]=r):r=e[2];const l=r;let c;e[3]!==l?(c=n.jsx(st,{href:l}),e[3]=l,e[4]=c):c=e[4];const m=c;let f;return e[5]!==s||e[6]!==m||e[7]!==t||e[8]!==i?.user?.email?(f=n.jsx(ft,{children:p=>{const{reset:d}=p;return n.jsx(pt,{fallback:h=>{const{error:v,resetError:j}=h;return n.jsx(Q,{visual:m,children:n.jsx(xs,{orgName:t.name,message:v instanceof Error?v.message:"Não foi possível verificar a configuração do Commerce Discovery.",onRetry:()=>{d(),j()}})})},children:n.jsx(K.Suspense,{fallback:n.jsx(Ot,{visual:m}),children:n.jsx(ys,{org:t,initialSiteUrl:s,sessionEmail:i?.user?.email},`${t.id}:${s??""}`)})})}}),e[5]=s,e[6]=m,e[7]=t,e[8]=i?.user?.email,e[9]=f):f=e[9],f}function Ot(o){const e=U.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(X,{}),n.jsx(et,{})]}),e[0]=s):s=e[0];let i;return e[1]!==t?(i=n.jsx(Q,{align:"fill",visual:t,children:s}),e[1]=t,e[2]=i):i=e[2],i}function xs(o){const e=U.c(10),{orgName:t,message:s,onRetry:i}=o,a=`A configuração de commerce continuará em ${t}.`;let r;e[0]!==a?(r=n.jsx(X,{title:"Diagnóstico de commerce",description:a}),e[0]=a,e[1]=r):r=e[1];let l;e[2]!==s?(l=n.jsx(xe,{message:s}),e[2]=s,e[3]=l):l=e[3];let c;e[4]!==i?(c=n.jsx(V,{type:"button",size:"xl",className:"w-full",onClick:i,children:"Tentar novamente"}),e[4]=i,e[5]=c):c=e[5];let m;return e[6]!==r||e[7]!==l||e[8]!==c?(m=n.jsxs("div",{className:"grid gap-10",children:[r,l,c]}),e[6]=r,e[7]=l,e[8]=c,e[9]=m):m=e[9],m}function ys(o){const e=U.c(111),{org:t,initialSiteUrl:s,sessionEmail:i}=o,a=ht();let r;e[0]!==t.id||e[1]!==t.slug?(r={connectionId:vt,orgId:t.id,orgSlug:t.slug},e[0]=t.id,e[1]=t.slug,e[2]=r):r=e[2];const l=Ue(r),[c,m]=K.useState(s??""),[f,p]=K.useState(null),[d,h]=K.useState(null),v=K.useRef(!1),j=yt.COMMERCE_DISCOVERY(t.id),x=zt(t.id),g=W.commerceDiscoveryConnection(t.id,j);let u;e[3]!==j||e[4]!==l?(u=async()=>{const R=await l.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:j}});return Ee(R)},e[3]=j,e[4]=l,e[5]=u):u=e[5];let b;e[6]!==g||e[7]!==u?(b={queryKey:g,queryFn:u,retry:!1},e[6]=g,e[7]=u,e[8]=b):b=e[8];const y=me(b),C=W.commerceDiscoveryVirtualMcp(t.id,x);let _;e[9]!==l||e[10]!==x?(_=async()=>{const R=await l.callTool({name:"COLLECTION_VIRTUAL_MCP_GET",arguments:{id:x}});return Ee(R)},e[9]=l,e[10]=x,e[11]=_):_=e[11];let T;e[12]!==C||e[13]!==_?(T={queryKey:C,queryFn:_,retry:!1},e[12]=C,e[13]=_,e[14]=T):T=e[14];const N=me(T);let E;e[15]!==l?(E=async R=>{const B=await l.callTool({name:"COMMERCE_DISCOVERY_SETUP",arguments:{siteUrl:R}});return Ee(B)},e[15]=l,e[16]=E):E=e[16];let I;e[17]!==y||e[18]!==N?(I=R=>{p(R),h(null),y.refetch(),N.refetch()},e[17]=y,e[18]=N,e[19]=I):I=e[19];let $;e[20]===Symbol.for("react.memo_cache_sentinel")?($=R=>{h(R instanceof Error?R.message:"A configuração do Commerce Discovery falhou.")},e[20]=$):$=e[20];let A;e[21]!==E||e[22]!==I?(A={mutationFn:E,retry:!1,onSuccess:I,onError:$},e[21]=E,e[22]=I,e[23]=A):A=e[23];const w=Oe(A);let O;e[24]!==l?(O={mutationFn:async R=>{const B=await l.callTool({name:"COMMERCE_DISCOVERY_RUN",arguments:{siteUrl:R}});return Ee(B)},retry:!1},e[24]=l,e[25]=O):O=e[25];const k=Oe(O),[z,F]=K.useState(null),L=!!y.data.item&&!!N.data.item,M=y.data.item,q=typeof M?.metadata?.siteUrl=="string"?M.metadata.siteUrl:void 0,S=s||c||q||"";let D;e[26]!==S||e[27]!==i?(D=nt({siteUrl:S,email:i}),e[26]=S,e[27]=i,e[28]=D):D=e[28];const P=D;let G;e[29]!==P?(G=n.jsx(st,{href:P}),e[29]=P,e[30]=G):G=e[30];const H=G;let ye;e[31]!==w?(ye=R=>{const B=Te(R);if(!B.ok){h(lt(B.error));return}h(null),w.mutate(B.value)},e[31]=w,e[32]=ye):ye=e[32];const te=ye;let ve;e[33]!==s||e[34]!==te||e[35]!==L?(ve=R=>{!R||v.current||L||!s||(v.current=!0,te(s))},e[33]=s,e[34]=te,e[35]=L,e[36]=ve):ve=e[36];const Re=ve;let be;e[37]!==te||e[38]!==c?(be=R=>{R.preventDefault(),te(c)},e[37]=te,e[38]=c,e[39]=be):be=e[39];const Y=be;let je;e[40]!==j||e[41]!==f?.reportApp||e[42]!==x?(je=f?.reportApp??{connectionId:j,virtualMcpId:x,toolName:Dt},e[40]=j,e[41]=f?.reportApp,e[42]=x,e[43]=je):je=e[43];const ee=je;let Se;e[44]!==S||e[45]!==a||e[46]!==t.slug||e[47]!==ee||e[48]!==k?(Se=async()=>{F(null);const R=Te(S);if(R.ok)try{await k.mutateAsync(R.value)}catch{F("Algo deu errado ao gerar seu relatório. Tente novamente em instantes.");return}localStorage.setItem(Rt.sidebarOpen(),JSON.stringify(!1)),a({to:"/$org/$taskId",params:{org:t.slug,taskId:crypto.randomUUID()},search:{virtualmcpid:ee.virtualMcpId,main:Lt(ee.connectionId,ee.toolName),chat:0}})},e[44]=S,e[45]=a,e[46]=t.slug,e[47]=ee,e[48]=k,e[49]=Se):Se=e[49];const Pe=Se;if(L){let R;return e[50]!==P||e[51]!==H||e[52]!==S||e[53]!==Pe||e[54]!==t||e[55]!==ee||e[56]!==z||e[57]!==k.isPending?(R=n.jsx(vs,{org:t,reportApp:ee,onOpenReport:Pe,isSubmitting:k.isPending,error:z,meetingUrl:P,meetingVisual:H,siteUrl:S}),e[50]=P,e[51]=H,e[52]=S,e[53]=Pe,e[54]=t,e[55]=ee,e[56]=z,e[57]=k.isPending,e[58]=R):R=e[58],R}if(w.isPending){let R;return e[59]!==H?(R=n.jsx(Ot,{visual:H}),e[59]=H,e[60]=R):R=e[60],R}if(s){let R,B;if(e[61]!==H||e[62]!==Y||e[63]!==s||e[64]!==d||e[65]!==t.name||e[66]!==w.isPending||e[67]!==c){B=Symbol.for("react.early_return_sentinel");e:if(R=Te(s),!R.ok){const ze=`A configuração de commerce continuará em ${t.name}.`;let le;e[70]!==ze?(le=n.jsx(X,{title:"Diagnóstico de commerce",description:ze}),e[70]=ze,e[71]=le):le=e[71];const De=n.jsx(xe,{message:lt(R.error)});let ce;e[72]!==Y||e[73]!==d||e[74]!==w.isPending||e[75]!==c?(ce=n.jsx(Me,{siteUrl:c,error:d,isSubmitting:w.isPending,onSiteUrlChange:m,onSubmit:Y}),e[72]=Y,e[73]=d,e[74]=w.isPending,e[75]=c,e[76]=ce):ce=e[76];let de;e[77]!==le||e[78]!==De||e[79]!==ce?(de=n.jsxs("div",{className:"grid gap-10",children:[le,De,ce]}),e[77]=le,e[78]=De,e[79]=ce,e[80]=de):de=e[80];let _e;e[81]!==H||e[82]!==de?(_e=n.jsx(Q,{visual:H,children:de}),e[81]=H,e[82]=de,e[83]=_e):_e=e[83],B=_e;break e}e[61]=H,e[62]=Y,e[63]=s,e[64]=d,e[65]=t.name,e[66]=w.isPending,e[67]=c,e[68]=R,e[69]=B}else R=e[68],B=e[69];if(B!==Symbol.for("react.early_return_sentinel"))return B;const Le=`O Commerce Discovery está sendo preparado para ${R.value}.`;let ie;e[84]!==Le?(ie=n.jsx(X,{title:"Diagnóstico de commerce",description:Le}),e[84]=Le,e[85]=ie):ie=e[85];let re;e[86]!==Y||e[87]!==d||e[88]!==w.isPending||e[89]!==c?(re=d?n.jsxs(n.Fragment,{children:[n.jsx(xe,{message:d}),n.jsx(Me,{siteUrl:c,error:null,isSubmitting:w.isPending,onSiteUrlChange:m,onSubmit:Y})]}):n.jsx(et,{}),e[86]=Y,e[87]=d,e[88]=w.isPending,e[89]=c,e[90]=re):re=e[90];let ae;e[91]!==ie||e[92]!==re||e[93]!==Re?(ae=n.jsxs("div",{ref:Re,className:"grid gap-10",children:[ie,re]}),e[91]=ie,e[92]=re,e[93]=Re,e[94]=ae):ae=e[94];let Ne;return e[95]!==H||e[96]!==ae?(Ne=n.jsx(Q,{visual:H,children:ae}),e[95]=H,e[96]=ae,e[97]=Ne):Ne=e[97],Ne}const $e=`A configuração de commerce continuará em ${t.name}.`;let ne;e[98]!==$e?(ne=n.jsx(X,{title:"Diagnóstico de commerce",description:$e}),e[98]=$e,e[99]=ne):ne=e[99];let se;e[100]!==Y||e[101]!==d||e[102]!==w.isPending||e[103]!==c?(se=n.jsx(Me,{siteUrl:c,error:d,isSubmitting:w.isPending,onSiteUrlChange:m,onSubmit:Y}),e[100]=Y,e[101]=d,e[102]=w.isPending,e[103]=c,e[104]=se):se=e[104];let oe;e[105]!==ne||e[106]!==se?(oe=n.jsxs("div",{className:"grid gap-10",children:[ne,se]}),e[105]=ne,e[106]=se,e[107]=oe):oe=e[107];let Ce;return e[108]!==H||e[109]!==oe?(Ce=n.jsx(Q,{visual:H,children:oe}),e[108]=H,e[109]=oe,e[110]=Ce):Ce=e[110],Ce}function Me(o){const e=U.c(20),{siteUrl:t,error:s,isSubmitting:i,onSiteUrlChange:a,onSubmit:r}=o;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx("label",{className:"text-sm font-medium",htmlFor:"commerce-site-url",children:"URL do site"}),e[0]=l):l=e[0];let c;e[1]!==a?(c=x=>a(x.target.value),e[1]=a,e[2]=c):c=e[2];const m=!!s;let f;e[3]!==i||e[4]!==t||e[5]!==c||e[6]!==m?(f=n.jsx(Ae,{id:"commerce-site-url",type:"text",inputMode:"url",value:t,onChange:c,placeholder:"https://example.com","aria-invalid":m,disabled:i}),e[3]=i,e[4]=t,e[5]=c,e[6]=m,e[7]=f):f=e[7];let p;e[8]!==s?(p=s?n.jsx(xe,{message:s}):null,e[8]=s,e[9]=p):p=e[9];let d;e[10]!==f||e[11]!==p?(d=n.jsxs("div",{className:"grid gap-2",children:[l,f,p]}),e[10]=f,e[11]=p,e[12]=d):d=e[12];let h;e[13]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(bt,{size:16}),e[13]=h):h=e[13];let v;e[14]!==i?(v=n.jsxs(V,{type:"submit",size:"xl",className:"w-full",disabled:i,children:["Continuar",h]}),e[14]=i,e[15]=v):v=e[15];let j;return e[16]!==r||e[17]!==d||e[18]!==v?(j=n.jsxs("form",{className:"grid gap-4",onSubmit:r,children:[d,v]}),e[16]=r,e[17]=d,e[18]=v,e[19]=j):j=e[19],j}function vs(o){const e=U.c(26),{org:t,reportApp:s,onOpenReport:i,isSubmitting:a,error:r,meetingUrl:l,meetingVisual:c,siteUrl:m}=o;let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(X,{}),e[0]=f):f=e[0];let p;e[1]!==t||e[2]!==s.connectionId||e[3]!==m?(p=n.jsx(Xn,{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]!==l?(d=n.jsx(is,{className:"md:hidden",href:l}),e[5]=l,e[6]=d):d=e[6];let h;e[7]!==r?(h=r?n.jsx(xe,{message:r}):null,e[7]=r,e[8]=h):h=e[8];const v=a||!s.virtualMcpId,j=a?"Abrindo relatório...":"Ver relatório completo";let x;e[9]!==a?(x=a?null:n.jsx(bt,{size:18}),e[9]=a,e[10]=x):x=e[10];let g;e[11]!==i||e[12]!==v||e[13]!==j||e[14]!==x?(g=n.jsxs(V,{type:"button",size:"xl",className:"w-full rounded-2xl text-base font-medium",onClick:i,disabled:v,children:[j,x]}),e[11]=i,e[12]=v,e[13]=j,e[14]=x,e[15]=g):g=e[15];let u;e[16]!==d||e[17]!==h||e[18]!==g?(u=n.jsxs("div",{className:"flex shrink-0 flex-col gap-3 md:mt-8",children:[d,h,g]}),e[16]=d,e[17]=h,e[18]=g,e[19]=u):u=e[19];let b;e[20]!==p||e[21]!==u?(b=n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-6 md:grid md:gap-4",children:[f,p,u]}),e[20]=p,e[21]=u,e[22]=b):b=e[22];let y;return e[23]!==c||e[24]!==b?(y=n.jsx(Q,{align:"fill",visual:c,children:b}),e[23]=c,e[24]=b,e[25]=y):y=e[25],y}function xe(o){const e=U.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{Io as default};
|
|
1
|
+
import{c as U,r as K,l as J,j as n,B as V,m as dt,d as Oe,K as W,o as He,s as ue,n as Ve,p as Be,i as mt,k as ut,q as me,Q as ft,E as pt,a as ke,u as gt,v as kt,w as At,b as ht,x as Ut,y as xt,L as Rt}from"./index-BeeLZolL.js";import{A as Pt}from"./auth-entry-BMqe_NAJ.js";import{A as $t}from"./auth-split-layout-RNNT-n_r.js";import{O as it}from"./organization-choice-wN3p5bHs.js";import{f as Lt}from"./tab-id-BptcWVWa.js";import{I as Ae}from"./input-LkQXvLAa.js";import{u as Ue,W as yt,S as vt,g as zt,C as Dt}from"./use-mcp-client-iaudT61I.js";import{i as bt}from"./XCircle--tkqwpM7.js";import{I as jt}from"./integration-icon-BFj5Hgg2.js";import{D as Ge,a as Ft,b as Mt,c as Kt,d as qt,e as Ht}from"./dialog-Bh4QMQdt.js";import{T as Vt,a as Bt,b as Gt}from"./tooltip-Ba5WYryG.js";import{i as St}from"./CheckCircle-kwc45JPK.js";import{i as Qt,t as Wt}from"./agent-icon-aTZ0WGYG.js";import{g as Yt,c as Jt,e as Zt}from"./extract-connection-data-WCh9ShTJ.js";import{F as fe,a as Qe,b as pe,c as Fe,d as ge,e as he}from"./form-B5uVKHZJ.js";import{i as Xt}from"./ChevronUp-CxQvq7Kl.js";import{s as en,a as tn}from"./Eye-BXLPt3hG.js";import{i as nn}from"./Settings02-CzuPYYwF.js";import{u as sn}from"./useSuspenseQueries-Cv-F6NwL.js";import{a as on}from"./authenticate-and-persist-oauth-BoI1Z5Xj.js";import{i as Ct}from"./ArrowUpRight-6Dz_XkMa.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./avatar-Bjp6G7so.js";import"./User01-B60sPq_u.js";import"./auth-DvtjPuDG.js";import"./X-C84T4GrV.js";import"./AlertCircle-C9EcTRk1.js";import"./Tool01-0YhkCkB5.js";import"./SwitchHorizontal01-DoI1DhsF.js";import"./ZapSquare-D1OOZQrN.js";import"./Users03-a1897IbE.js";import"./ChevronDown-D7GDZ7wu.js";import"./ChevronLeft-DimzbDID.js";import"./ChevronRight-CyT2euoR.js";import"./DotsVertical-BFENe2Dt.js";import"./Stars02-BRU8YBIB.js";import"./ZoomOut-CuqN1_dw.js";import"./Globe01-CSh9aag5.js";import"./FilterLines-C0tlpzHG.js";import"./Star01-DFu1Ny2B.js";import"./Globe04-Do4YAUSY.js";import"./HardDrive-DnqhEbjC.js";import"./Key01-BGS-_-TQ.js";import"./LayoutLeft-BQaqFKj6.js";import"./LinkExternal01-C_4O-Sjm.js";import"./Monitor01-BerC6VZd.js";import"./Sun-BnUHB5Qj.js";import"./Palette-gJqbN1eT.js";import"./Play-BYLMPWCh.js";import"./Plus-CSM0Gdnx.js";import"./SearchLg-dtJyWy2t.js";import"./SearchMd-1gE2e_l6.js";import"./Shield01-CbgaHtai.js";import"./Stars01-DkLv1n8B.js";import"./Trash01-DnZnIRtK.js";import"./Upload01-q49A0pPe.js";import"./Users01-DwmjwTDW.js";import"./XClose-BESokz6G.js";import"./Zap-CfBVsJkz.js";import"./label-B3e_Uel8.js";import"./mcp-oauth-BtLTrokF.js";const rn=/^[a-zA-Z][a-zA-Z\d+.-]*:/,an=/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//,ln=/^[^\s/:?#]+\.[^\s/:?#]+:\d+(?:[/?#]|$)/,cn=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;function Te(o){const e=o.trim();if(!e)return{ok:!1,error:"Enter a website URL."};const t=rn.test(e),s=an.test(e),i=ln.test(e);if(t&&!s&&!i)return{ok:!1,error:"Use an HTTP or HTTPS website URL."};const a=s?e:`https://${e}`;let r;try{r=new URL(a)}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 l=r.hostname.split(".");return l.length<2||l.some(c=>!c||!cn.test(c))?{ok:!1,error:"Enter a valid website URL."}:(r.protocol="https:",{ok:!0,value:r.origin})}function Ke(o){const e=U.c(14),{children:t,className:s,wrapperClassName:i}=o,[a,r]=K.useState(!0);let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=j=>{if(!j)return;const x=()=>{const u=j.scrollHeight-j.scrollTop-j.clientHeight<8;r(u)};x(),j.addEventListener("scroll",x,{passive:!0});const g=new ResizeObserver(x);g.observe(j);for(const u of Array.from(j.children))g.observe(u);return()=>{j.removeEventListener("scroll",x),g.disconnect()}},e[0]=l):l=e[0];const c=l;let m;e[1]!==i?(m=J("relative",i),e[1]=i,e[2]=m):m=e[2];let f;e[3]!==t||e[4]!==s?(f=n.jsx("div",{ref:c,className:s,children:t}),e[3]=t,e[4]=s,e[5]=f):f=e[5];const p=a?"opacity-0":"opacity-100";let d;e[6]!==p?(d=J("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 h;e[8]!==d?(h=n.jsx("div",{"aria-hidden":!0,className:d}),e[8]=d,e[9]=h):h=e[9];let v;return e[10]!==m||e[11]!==f||e[12]!==h?(v=n.jsxs("div",{className:m,children:[f,h]}),e[10]=m,e[11]=f,e[12]=h,e[13]=v):v=e[13],v}function dn(o){const e=o.properties;if(!e)return[];const t=[];for(const[s,i]of Object.entries(e)){const l=i?.properties?.__type?.const;typeof l=="string"&&l.length>0&&t.push({fieldKey:s,bindingType:l})}return t}function mn(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 Z(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 un(o,e,t,s){return{...o??{},[e]:{__type:t,value:s}}}function qe(o){return o==null?!1:typeof o=="string"?o.trim().length>0:typeof o=="number"||typeof o=="boolean"?!0:Array.isArray(o)?o.some(qe):typeof o=="object"?Object.entries(o).some(([e,t])=>!e.startsWith("__")&&qe(t)):!1}function fn(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 pn(o){return qe(o)?typeof o=="string"?o.trim():typeof o=="number"||typeof o=="boolean"?String(o):JSON.stringify(o):null}function gn(o){return o?Object.entries(o).flatMap(([e,t])=>{if(e.startsWith("__"))return[];const s=pn(t);return s?[{key:e,label:fn(e),value:s}]:[]}):[]}function hn({autoOpenFieldKey:o,card:e}){return o===e.fieldKey&&e.satisfied&&!!e.linkedConnectionId}function xn(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,a)=>{const r=l=>l.status==="active"?0:1;return r(i)!==r(a)?r(i)-r(a):(a.updated_at??"").localeCompare(i.updated_at??"")}),s[0].id)}function yn(o){return o.server?.icons?.[0]?.src??Yt(o.server?.repository)??null}function vn(o,e){const t=o._meta?.["mcp.mesh"];return t?.friendlyName||t?.friendly_name||o.title||o.server?.title||o.server?.name||e}function bn(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],a=i?o.itemsById[i.registryAppId]:o.itemsByName[s.bindingType];if(!a)continue;const r=o.configurationState?.[s.fieldKey]?.value,l=r?t.get(r):void 0,c=r&&l?r:null,m=c?o.connectionReadiness?.[c]!==!1:!1,f=!!c&&m;e.push({fieldKey:s.fieldKey,bindingType:s.bindingType,registryItem:a,title:vn(a,s.bindingType),icon:yn(a),headline:i?.headline??a._meta?.["mcp.mesh"]?.short_description??null,area:i?.area??null,bullets:i?.bullets??[],satisfied:f,candidateConnectionId:f?null:c||xn(o.connections,s.bindingType,i?.registryAppId),linkedConnectionId:c,configurationState:l?.configuration_state??null})}return e}function jn(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 Sn(o){return(o?.response?.accountSummaries??[]).map(s=>({account:s.account,options:(s.propertySummaries??[]).map(i=>({value:i.property,label:`${i.displayName} (${s.displayName})`}))}))}function rt(o){const e=U.c(38);let t,s,i,a,r;e[0]!==o?({value:r,onChange:s,placeholder:i,className:t,...a}=o,e[0]=o,e[1]=t,e[2]=s,e[3]=i,e[4]=a,e[5]=r):(t=e[1],s=e[2],i=e[3],a=e[4],r=e[5]);const[l,c]=K.useState(!1),[m,f]=K.useState(!1);let p;e[6]!==r?(p=async()=>{if(r)try{await navigator.clipboard.writeText(r),f(!0),setTimeout(()=>f(!1),2e3)}catch($){console.error("Failed to copy text: ",$)}},e[6]=r,e[7]=p):p=e[7];const d=p;let h;e[8]!==l?(h=()=>{c(!l)},e[8]=l,e[9]=h):h=e[9];const v=h,j=l?"text":"password";let x;e[10]!==t?(x=J("pr-20",t),e[10]=t,e[11]=x):x=e[11];let g;e[12]!==s||e[13]!==i||e[14]!==a||e[15]!==j||e[16]!==x||e[17]!==r?(g=n.jsx(Ae,{type:j,value:r,onChange:s,placeholder:i,className:x,...a}),e[12]=s,e[13]=i,e[14]=a,e[15]=j,e[16]=x,e[17]=r,e[18]=g):g=e[18];const u=l?"Hide password":"Show password";let b;e[19]!==l?(b=l?n.jsx(nn,{size:16}):n.jsx(en,{size:16}),e[19]=l,e[20]=b):b=e[20];let y;e[21]!==u||e[22]!==b||e[23]!==v?(y=n.jsx(V,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:v,title:u,children:b}),e[21]=u,e[22]=b,e[23]=v,e[24]=y):y=e[24];const C=!r,_=m?"Copied!":"Copy token";let T;e[25]!==m?(T=m?n.jsx(Xt,{size:16}):n.jsx(tn,{size:16}),e[25]=m,e[26]=T):T=e[26];let N;e[27]!==d||e[28]!==_||e[29]!==T||e[30]!==C?(N=n.jsx(V,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:d,disabled:C,title:_,children:T}),e[27]=d,e[28]=_,e[29]=T,e[30]=C,e[31]=N):N=e[31];let E;e[32]!==N||e[33]!==y?(E=n.jsxs("div",{className:"absolute right-1 top-1 flex items-center gap-1 h-8",children:[y,N]}),e[32]=N,e[33]=y,e[34]=E):E=e[34];let I;return e[35]!==E||e[36]!==g?(I=n.jsxs("div",{className:"relative",children:[g,E]}),e[35]=E,e[36]=g,e[37]=I):I=e[37],I}function We(o){const e=U.c(19),{card:t,selfClient:s,org:i,onDone:a,onError:r}=o,l=dt();let c;e[0]!==t||e[1]!==s?(c=async x=>{const g={...t.configurationState??{},...x};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]=c):c=e[2];let m;e[3]!==a||e[4]!==i||e[5]!==l?(m=async()=>{await l.invalidateQueries({queryKey:W.commerceDiscoveryCompanionConnectionsPrefix(i.id)}),a()},e[3]=a,e[4]=i,e[5]=l,e[6]=m):m=e[6];let f;e[7]!==r?(f=x=>{r?.(x)},e[7]=r,e[8]=f):f=e[8];let p;e[9]!==c||e[10]!==m||e[11]!==f?(p={mutationFn:c,onSuccess:m,onError:f},e[9]=c,e[10]=m,e[11]=f,e[12]=p):p=e[12];const d=Oe(p);let h;e[13]!==d?(h=x=>d.mutate(x),e[13]=d,e[14]=h):h=e[14];const v=h;let j;return e[15]!==d.error||e[16]!==d.isPending||e[17]!==v?(j={save:v,isPending:d.isPending,error:d.error},e[15]=d.error,e[16]=d.isPending,e[17]=v,e[18]=j):j=e[18],j}const Cn=He({accountName:ue().min(1,"Informe o nome da conta"),appKey:ue().optional(),appToken:ue().optional()});function Nn(o){const e=U.c(63),{card:t,selfClient:s,org:i,onDone:a,onIsPendingChange:r}=o;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=Ve(Cn),e[0]=l):l=e[0];const c=t.configurationState?.accountName||"",m=t.configurationState?.appKey||"",f=t.configurationState?.appToken||"";let p;e[1]!==c||e[2]!==m||e[3]!==f?(p={resolver:l,defaultValues:{accountName:c,appKey:m,appToken:f}},e[1]=c,e[2]=m,e[3]=f,e[4]=p):p=e[4];const d=Be(p);let h;e[5]!==t.configurationState?.accountName||e[6]!==t.configurationState?.appKey||e[7]!==t.configurationState?.appToken||e[8]!==d?(h=()=>{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]=h):h=e[9];let v;e[10]!==t.configurationState||e[11]!==d?(v=[t.configurationState,d],e[10]=t.configurationState,e[11]=d,e[12]=v):v=e[12],K.useEffect(h,v);let j;e[13]!==t||e[14]!==a||e[15]!==i||e[16]!==s?(j={card:t,selfClient:s,org:i,onDone:a},e[13]=t,e[14]=a,e[15]=i,e[16]=s,e[17]=j):j=e[17];const{save:x,isPending:g,error:u}=We(j);let b,y;e[18]!==g||e[19]!==r?(y=()=>{r?.(g)},b=[g,r],e[18]=g,e[19]=r,e[20]=b,e[21]=y):(b=e[20],y=e[21]),K.useEffect(y,b);let C;if(e[22]!==d||e[23]!==x){let q;e[25]!==x?(q=async S=>{x(S)},e[25]=x,e[26]=q):q=e[26],C=d.handleSubmit(q),e[22]=d,e[23]=x,e[24]=C}else C=e[24];const _=C;let T;e[27]!==g?(T=q=>{const{field:S}=q;return n.jsxs(pe,{children:[n.jsx(Fe,{children:"Nome da conta"}),n.jsx(ge,{children:n.jsx(Ae,{placeholder:"Nome da sua conta VTEX",...S,disabled:g})}),n.jsx(he,{})]})},e[27]=g,e[28]=T):T=e[28];let N;e[29]!==d.control||e[30]!==T?(N=n.jsx(fe,{control:d.control,name:"accountName",render:T}),e[29]=d.control,e[30]=T,e[31]=N):N=e[31];let E;e[32]!==g?(E=q=>{const{field:S}=q;return n.jsxs(pe,{children:[n.jsx(Fe,{children:"App Key (opcional)"}),n.jsx(ge,{children:n.jsx(rt,{placeholder:"App Key da VTEX",...S,disabled:g})}),n.jsx(he,{})]})},e[32]=g,e[33]=E):E=e[33];let I;e[34]!==d.control||e[35]!==E?(I=n.jsx(fe,{control:d.control,name:"appKey",render:E}),e[34]=d.control,e[35]=E,e[36]=I):I=e[36];let $;e[37]!==g?($=q=>{const{field:S}=q;return n.jsxs(pe,{children:[n.jsx(Fe,{children:"App Token (opcional)"}),n.jsx(ge,{children:n.jsx(rt,{placeholder:"App Token da VTEX",...S,disabled:g})}),n.jsx(he,{})]})},e[37]=g,e[38]=$):$=e[38];let A;e[39]!==d.control||e[40]!==$?(A=n.jsx(fe,{control:d.control,name:"appToken",render:$}),e[39]=d.control,e[40]=$,e[41]=A):A=e[41];let w;e[42]!==d||e[43]!==N||e[44]!==I||e[45]!==A?(w=n.jsxs(Qe,{...d,children:[N,I,A]}),e[42]=d,e[43]=N,e[44]=I,e[45]=A,e[46]=w):w=e[46];let O;e[47]!==u?(O=u&&n.jsx("p",{role:"alert",className:"text-sm text-destructive",children:u instanceof Error?u.message:"Não foi possível salvar a configuração"}),e[47]=u,e[48]=O):O=e[48];let k;e[49]!==g||e[50]!==a?(k=n.jsx(V,{type:"button",variant:"outline",onClick:a,disabled:g,children:"Cancelar"}),e[49]=g,e[50]=a,e[51]=k):k=e[51];const z=g?"Salvando...":"Salvar";let F;e[52]!==g||e[53]!==z?(F=n.jsx(V,{type:"submit",disabled:g,children:z}),e[52]=g,e[53]=z,e[54]=F):F=e[54];let L;e[55]!==k||e[56]!==F?(L=n.jsxs(Ge,{className:"pt-4",children:[k,F]}),e[55]=k,e[56]=F,e[57]=L):L=e[57];let M;return e[58]!==_||e[59]!==w||e[60]!==O||e[61]!==L?(M=n.jsxs("form",{onSubmit:_,className:"space-y-4",children:[w,O,L]}),e[58]=_,e[59]=w,e[60]=O,e[61]=L,e[62]=M):M=e[62],M}function Nt(o){const e=U.c(30),{options:t,value:s,onChange:i,disabled:a,ariaLabel:r,searchPlaceholder:l}=o,c=l===void 0?"Buscar...":l,[m,f]=K.useState("");let p,d,h;if(e[0]!==t||e[1]!==m||e[2]!==s){const N=m.trim().toLowerCase();p=N?t.filter(E=>E.label.toLowerCase().includes(N)):t,d=p.map(_n),h=d.includes(s)?s:d[0]??"",e[0]=t,e[1]=m,e[2]=s,e[3]=p,e[4]=d,e[5]=h}else p=e[3],d=e[4],h=e[5];const v=h;let j;e[6]!==a||e[7]!==d||e[8]!==i?(j=function(E){if(a||!["ArrowDown","ArrowRight","ArrowUp","ArrowLeft","Home","End"].includes(E.key))return;E.preventDefault();const $=E.currentTarget.dataset.value,A=d.indexOf($),w=d.length;if(w===0)return;let O;E.key==="ArrowDown"||E.key==="ArrowRight"?O=(A+1)%w:E.key==="ArrowUp"||E.key==="ArrowLeft"?O=(A-1+w)%w:E.key==="Home"?O=0:O=w-1;const k=d[O];i(k),E.currentTarget.closest('[role="radiogroup"]')?.querySelector(`[data-value="${CSS.escape(k)}"]`)?.focus()},e[6]=a,e[7]=d,e[8]=i,e[9]=j):j=e[9];const x=j;let g;e[10]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(Qt,{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 u;e[11]===Symbol.for("react.memo_cache_sentinel")?(u=N=>f(N.target.value),e[11]=u):u=e[11];const b=`Buscar ${r}`;let y;e[12]!==a||e[13]!==m||e[14]!==c||e[15]!==b?(y=n.jsxs("div",{className:"relative",children:[g,n.jsx(Ae,{type:"text",value:m,onChange:u,disabled:a,placeholder:c,"aria-label":b,className:"h-8 pl-8"})]}),e[12]=a,e[13]=m,e[14]=c,e[15]=b,e[16]=y):y=e[16];let C;e[17]!==a||e[18]!==p||e[19]!==x||e[20]!==i||e[21]!==v||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(N=>{const E=N.value===s;return n.jsxs("button",{type:"button",role:"radio","aria-checked":E,disabled:a,"data-value":N.value,tabIndex:N.value===v?0:-1,onClick:()=>i(N.value),onKeyDown:x,className:J("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",E?"bg-muted font-medium text-foreground":"text-foreground hover:bg-muted/50"),children:[n.jsx("span",{className:"truncate",children:N.label}),E?n.jsx(St,{size:16,className:"shrink-0 text-primary"}):null]},N.value)}),e[17]=a,e[18]=p,e[19]=x,e[20]=i,e[21]=v,e[22]=s,e[23]=C):C=e[23];let _;e[24]!==r||e[25]!==C?(_=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]=_):_=e[26];let T;return e[27]!==y||e[28]!==_?(T=n.jsxs("div",{className:"space-y-2",children:[y,_]}),e[27]=y,e[28]=_,e[29]=T):T=e[29],T}function _n(o){return o.value}function Ye(o){const e=U.c(16),{label:t,iconSize:s,className:i,iconClassName:a,labelClassName:r}=o,l=s===void 0?14:s;let c;e[0]!==i?(c=J("inline-flex items-center gap-2",i),e[0]=i,e[1]=c):c=e[1];let m;e[2]!==a?(m=J("shrink-0 animate-spin",a),e[2]=a,e[3]=m):m=e[3];let f;e[4]!==l||e[5]!==m?(f=n.jsx(mt,{size:l,className:m}),e[4]=l,e[5]=m,e[6]=f):f=e[6];let p;e[7]!==r?(p=J("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 h;return e[12]!==c||e[13]!==f||e[14]!==d?(h=n.jsxs("span",{className:c,children:[f,d]}),e[12]=c,e[13]=f,e[14]=d,e[15]=h):h=e[15],h}const En=He({propertyId:ue().min(1,"Selecione uma propriedade")});function wn(o){const e=U.c(55),{card:t,connectionId:s,companionClient:i,selfClient:a,org:r,onDone:l,onIsPendingChange:c}=o;let m;e[0]!==s||e[1]!==r.id?(m=W.commerceDiscoveryCompanionGaProperties(r.id,s),e[0]=s,e[1]=r.id,e[2]=m):m=e[2];let f;e[3]!==i?(f=async()=>{const S=await i.callTool({name:"get-account-summaries",arguments:{}}),D=Z(S);return Sn(D)},e[3]=i,e[4]=f):f=e[4];let p;e[5]!==m||e[6]!==f?(p={queryKey:m,queryFn:f},e[5]=m,e[6]=f,e[7]=p):p=e[7];const d=ut(p);let h;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=Ve(En),e[8]=h):h=e[8];const v=t.configurationState?.propertyId||"";let j;e[9]!==v?(j={resolver:h,defaultValues:{propertyId:v}},e[9]=v,e[10]=j):j=e[10];const x=Be(j);let g;e[11]!==t||e[12]!==l||e[13]!==r||e[14]!==a?(g={card:t,selfClient:a,org:r,onDone:l},e[11]=t,e[12]=l,e[13]=r,e[14]=a,e[15]=g):g=e[15];const{save:u,isPending:b,error:y}=We(g);let C,_;e[16]!==b||e[17]!==c?(C=()=>{c?.(b)},_=[b,c],e[16]=b,e[17]=c,e[18]=C,e[19]=_):(C=e[18],_=e[19]),K.useEffect(C,_);let T;if(e[20]!==x||e[21]!==u){let S;e[23]!==u?(S=async D=>{u(D)},e[23]=u,e[24]=S):S=e[24],T=x.handleSubmit(S),e[20]=x,e[21]=u,e[22]=T}else T=e[22];const N=T;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(Ye,{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 E;e[27]!==d.data?(E=d.data||[],e[27]=d.data,e[28]=E):E=e[28];const I=E;if(I.flatMap(In).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 A;e[30]!==b||e[31]!==I?(A=S=>{const{field:D}=S;return n.jsxs(pe,{children:[n.jsx(ge,{children:n.jsx(Nt,{options:I.flatMap(Tn),value:D.value,onChange:D.onChange,disabled:b,ariaLabel:"Propriedade do Google Analytics"})}),n.jsx(he,{})]})},e[30]=b,e[31]=I,e[32]=A):A=e[32];let w;e[33]!==x.control||e[34]!==A?(w=n.jsx(fe,{control:x.control,name:"propertyId",render:A}),e[33]=x.control,e[34]=A,e[35]=w):w=e[35];let O;e[36]!==x||e[37]!==w?(O=n.jsx(Qe,{...x,children:w}),e[36]=x,e[37]=w,e[38]=O):O=e[38];let k;e[39]!==y?(k=y&&n.jsx("p",{role:"alert",className:"text-sm text-destructive",children:y instanceof Error?y.message:"Não foi possível salvar a configuração"}),e[39]=y,e[40]=k):k=e[40];let z;e[41]!==b||e[42]!==l?(z=n.jsx(V,{type:"button",variant:"outline",onClick:l,disabled:b,children:"Cancelar"}),e[41]=b,e[42]=l,e[43]=z):z=e[43];const F=b?"Salvando...":"Salvar";let L;e[44]!==b||e[45]!==F?(L=n.jsx(V,{type:"submit",disabled:b,children:F}),e[44]=b,e[45]=F,e[46]=L):L=e[46];let M;e[47]!==z||e[48]!==L?(M=n.jsxs(Ge,{className:"pt-4",children:[z,L]}),e[47]=z,e[48]=L,e[49]=M):M=e[49];let q;return e[50]!==N||e[51]!==O||e[52]!==k||e[53]!==M?(q=n.jsxs("form",{onSubmit:N,className:"space-y-4",children:[O,k,M]}),e[50]=N,e[51]=O,e[52]=k,e[53]=M,e[54]=q):q=e[54],q}function Tn(o){return o.options}function In(o){return o.options}const On=He({siteUrl:ue().min(1,"Selecione um site")});function kn(o){const e=U.c(59),{card:t,connectionId:s,companionClient:i,selfClient:a,org:r,contextSiteUrl:l,onDone:c,onIsPendingChange:m}=o;let f;e[0]!==s||e[1]!==r.id?(f=W.commerceDiscoveryCompanionGscSites(r.id,s),e[0]=s,e[1]=r.id,e[2]=f):f=e[2];let p;e[3]!==i?(p=async()=>{const S=await i.callTool({name:"list_sites",arguments:{}});return Z(S).sites||[]},e[3]=i,e[4]=p):p=e[4];let d;e[5]!==f||e[6]!==p?(d={queryKey:f,queryFn:p},e[5]=f,e[6]=p,e[7]=d):d=e[7];const h=ut(d);let v;e[8]===Symbol.for("react.memo_cache_sentinel")?(v=Ve(On),e[8]=v):v=e[8];const j=t.configurationState?.siteUrl||"";let x;e[9]!==j?(x={resolver:v,defaultValues:{siteUrl:j}},e[9]=j,e[10]=x):x=e[10];const g=Be(x);let u;e[11]!==t||e[12]!==c||e[13]!==r||e[14]!==a?(u={card:t,selfClient:a,org:r,onDone:c},e[11]=t,e[12]=c,e[13]=r,e[14]=a,e[15]=u):u=e[15];const{save:b,isPending:y,error:C}=We(u);let _,T;e[16]!==y||e[17]!==m?(_=()=>{m?.(y)},T=[y,m],e[16]=y,e[17]=m,e[18]=_,e[19]=T):(_=e[18],T=e[19]),K.useEffect(_,T);let N;if(e[20]!==g||e[21]!==b){let S;e[23]!==b?(S=async D=>{b(D)},e[23]=b,e[24]=S):S=e[24],N=g.handleSubmit(S),e[20]=g,e[21]=b,e[22]=N}else N=e[22];const E=N;if(h.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(Ye,{label:"Carregando sites..."})}),e[25]=S):S=e[25],S}if(h.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,$;if(e[27]!==t.configurationState?.siteUrl||e[28]!==l||e[29]!==g||e[30]!==h.data){$=Symbol.for("react.early_return_sentinel");e:{if(I=h.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],$=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=jn(l,I);D&&g.setValue("siteUrl",D)}}e[27]=t.configurationState?.siteUrl,e[28]=l,e[29]=g,e[30]=h.data,e[31]=I,e[32]=$}else I=e[31],$=e[32];if($!==Symbol.for("react.early_return_sentinel"))return $;let A;e[34]!==y||e[35]!==I?(A=S=>{const{field:D}=S;return n.jsxs(pe,{children:[n.jsx(ge,{children:n.jsx(Nt,{options:I.map(An),value:D.value,onChange:D.onChange,disabled:y,ariaLabel:"Site verificado"})}),n.jsx(he,{})]})},e[34]=y,e[35]=I,e[36]=A):A=e[36];let w;e[37]!==g.control||e[38]!==A?(w=n.jsx(fe,{control:g.control,name:"siteUrl",render:A}),e[37]=g.control,e[38]=A,e[39]=w):w=e[39];let O;e[40]!==g||e[41]!==w?(O=n.jsx(Qe,{...g,children:w}),e[40]=g,e[41]=w,e[42]=O):O=e[42];let k;e[43]!==C?(k=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]=k):k=e[44];let z;e[45]!==y||e[46]!==c?(z=n.jsx(V,{type:"button",variant:"outline",onClick:c,disabled:y,children:"Cancelar"}),e[45]=y,e[46]=c,e[47]=z):z=e[47];const F=y?"Salvando...":"Salvar";let L;e[48]!==y||e[49]!==F?(L=n.jsx(V,{type:"submit",disabled:y,children:F}),e[48]=y,e[49]=F,e[50]=L):L=e[50];let M;e[51]!==z||e[52]!==L?(M=n.jsxs(Ge,{className:"pt-4",children:[z,L]}),e[51]=z,e[52]=L,e[53]=M):M=e[53];let q;return e[54]!==E||e[55]!==O||e[56]!==k||e[57]!==M?(q=n.jsxs("form",{onSubmit:E,className:"space-y-4",children:[O,k,M]}),e[54]=E,e[55]=O,e[56]=k,e[57]=M,e[58]=q):q=e[58],q}function An(o){return{value:o.siteUrl,label:o.siteUrl}}const Un={vtex:Nn,"google-analytics":wn,"google-search-console":kn};function Rn(){const o=U.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 at="rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground";function Pn(o){const e=U.c(35),{card:t,connecting:s,disabled:i,onConnect:a,org:r,selfClient:l,siteUrl:c,autoOpenConfigFieldKey:m,onAutoOpenConfigHandled:f}=o,p=t.linkedConnectionId;let d;e[0]!==m||e[1]!==t||e[2]!==s||e[3]!==i||e[4]!==p||e[5]!==f||e[6]!==a||e[7]!==r||e[8]!==l||e[9]!==c?(d=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(St,{size:16,className:"text-success"})," Conectado"]}),n.jsx(K.Suspense,{fallback:n.jsx($n,{}),children:n.jsx(Ln,{card:t,org:r,selfClient:l,connectionId:p,contextSiteUrl:c,autoOpen:hn({autoOpenFieldKey:m,card:t}),onAutoOpenHandled:f})})]}):n.jsx(V,{type:"button",variant:"outline",size:"sm",className:"sm:w-full",disabled:i||s,onClick:a,"aria-label":`Conectar ${t.title}`,children:s?n.jsx(mt,{size:16,className:"animate-spin"}):"Conectar"}),e[0]=m,e[1]=t,e[2]=s,e[3]=i,e[4]=p,e[5]=f,e[6]=a,e[7]=r,e[8]=l,e[9]=c,e[10]=d):d=e[10];const h=d;let v;e[11]!==t.icon||e[12]!==t.title?(v=n.jsx(jt,{icon:t.icon,name:t.title,size:"sm",fit:"contain",className:"shrink-0 p-1.5"}),e[11]=t.icon,e[12]=t.title,e[13]=v):v=e[13];let j;e[14]!==t.area?(j=t.area&&n.jsx("span",{className:J("hidden sm:inline-block",at),children:t.area}),e[14]=t.area,e[15]=j):j=e[15];let x;e[16]!==v||e[17]!==j?(x=n.jsxs("div",{className:"shrink-0 self-start sm:flex sm:w-full sm:items-center sm:justify-between sm:gap-2",children:[v,j]}),e[16]=v,e[17]=j,e[18]=x):x=e[18];let g;e[19]!==t.area?(g=t.area&&n.jsx("span",{className:J("mb-1 inline-block sm:hidden",at),children:t.area}),e[19]=t.area,e[20]=g):g=e[20];let u;e[21]!==t.title?(u=n.jsx("p",{className:"text-sm font-medium text-foreground",children:t.title}),e[21]=t.title,e[22]=u):u=e[22];let b;e[23]!==t.headline?(b=t.headline&&n.jsx("p",{className:"mt-0.5 line-clamp-2 text-sm leading-5 text-muted-foreground",children:t.headline}),e[23]=t.headline,e[24]=b):b=e[24];let y;e[25]!==g||e[26]!==u||e[27]!==b?(y=n.jsxs("div",{className:"min-w-0 flex-1",children:[g,u,b]}),e[25]=g,e[26]=u,e[27]=b,e[28]=y):y=e[28];let C;e[29]!==h?(C=n.jsx("div",{className:"shrink-0 sm:mt-auto sm:w-full sm:pt-1",children:h}),e[29]=h,e[30]=C):C=e[30];let _;return e[31]!==x||e[32]!==y||e[33]!==C?(_=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:[x,y,C]}),e[31]=x,e[32]=y,e[33]=C,e[34]=_):_=e[34],_}function $n(){const o=U.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 Ln(o){const e=U.c(46),{card:t,org:s,selfClient:i,connectionId:a,contextSiteUrl:r,autoOpen:l,onAutoOpenHandled:c}=o;let m;e[0]!==a||e[1]!==s.id||e[2]!==s.slug?(m={connectionId:a,orgId:s.id,orgSlug:s.slug},e[0]=a,e[1]=s.id,e[2]=s.slug,e[3]=m):m=e[3];const f=Ue(m),[p,d]=K.useState(l),[h,v]=K.useState(!1),j=Un[t.bindingType],x=gn(t.configurationState);let g;e[4]!==l||e[5]!==c?(g=()=>{d(!1),l&&c()},e[4]=l,e[5]=c,e[6]=g):g=e[6];const u=g;let b;e[7]!==u||e[8]!==h?(b=M=>{if(!(!M&&h)){if(!M){u();return}d(!0)}},e[7]=u,e[8]=h,e[9]=b):b=e[9];const y=b;if(!j)return null;let C;e[10]===Symbol.for("react.memo_cache_sentinel")?(C=()=>d(!0),e[10]=C):C=e[10];const _=`Configurar ${t.title}`;let T;e[11]===Symbol.for("react.memo_cache_sentinel")?(T=n.jsx(Wt,{size:16}),e[11]=T):T=e[11];let N;e[12]!==_?(N=n.jsx(Vt,{asChild:!0,children:n.jsx(V,{type:"button",variant:"ghost",size:"icon-sm",className:"shrink-0",onClick:C,"aria-label":_,children:T})}),e[12]=_,e[13]=N):N=e[13];const E=x.length>0?"Editar configuração":"Configurar";let I;e[14]!==E?(I=n.jsx(Bt,{children:E}),e[14]=E,e[15]=I):I=e[15];let $;e[16]!==N||e[17]!==I?($=n.jsxs(Gt,{children:[N,I]}),e[16]=N,e[17]=I,e[18]=$):$=e[18];let A;e[19]!==t.icon||e[20]!==t.title?(A=n.jsx(jt,{icon:t.icon,name:t.title,size:"md",fit:"contain",className:"p-1.5"}),e[19]=t.icon,e[20]=t.title,e[21]=A):A=e[21];let w;e[22]!==t.title?(w=n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[n.jsx(Ft,{children:t.title}),n.jsxs(Mt,{children:["Configure o ",t.title," para enriquecer os dados"]})]}),e[22]=t.title,e[23]=w):w=e[23];let O;e[24]!==A||e[25]!==w?(O=n.jsxs(Kt,{className:"flex-row items-center gap-3 space-y-0 text-left",children:[A,w]}),e[24]=A,e[25]=w,e[26]=O):O=e[26];let k;e[27]!==j||e[28]!==t||e[29]!==u||e[30]!==f||e[31]!==a||e[32]!==r||e[33]!==s||e[34]!==i?(k=n.jsx(j,{card:t,connectionId:a,companionClient:f,selfClient:i,org:s,contextSiteUrl:r,onDone:u,onIsPendingChange:v}),e[27]=j,e[28]=t,e[29]=u,e[30]=f,e[31]=a,e[32]=r,e[33]=s,e[34]=i,e[35]=k):k=e[35];let z;e[36]!==O||e[37]!==k?(z=n.jsxs(qt,{className:"sm:max-w-lg",children:[O,k]}),e[36]=O,e[37]=k,e[38]=z):z=e[38];let F;e[39]!==p||e[40]!==y||e[41]!==z?(F=n.jsx(Ht,{open:p,onOpenChange:y,children:z}),e[39]=p,e[40]=y,e[41]=z,e[42]=F):F=e[42];let L;return e[43]!==$||e[44]!==F?(L=n.jsxs(n.Fragment,{children:[$,F]}),e[43]=$,e[44]=F,e[45]=L):L=e[45],L}const Je={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 zn(o){const e=U.c(30),{selfClient:t,org:s,cdConnectionId:i}=o;let a;e[0]!==i||e[1]!==s.id||e[2]!==s.slug?(a={connectionId:i,orgId:s.id,orgSlug:s.slug},e[0]=i,e[1]=s.id,e[2]=s.slug,e[3]=a):a=e[3];const r=Ue(a);let l;e[4]!==i||e[5]!==s.id?(l=W.commerceDiscoveryCompanionSchema(s.id,i),e[4]=i,e[5]=s.id,e[6]=l):l=e[6];let c;e[7]!==r?(c=async()=>{const P=await r.callTool({name:"MCP_CONFIGURATION",arguments:{}});return Z(P)},e[7]=r,e[8]=c):c=e[8];let m;e[9]!==l||e[10]!==c?(m={queryKey:l,queryFn:c},e[9]=l,e[10]=c,e[11]=m):m=e[11];const f=me(m),p=dn(f.data?.stateSchema??{properties:{}}),d=p.map(Qn),h=p.map(Gn).filter(Bn),v=p.filter(Vn).map(Hn),j=[...h,...v].sort().join(",");let x;e[12]!==i||e[13]!==s.id?(x=W.commerceDiscoveryConnection(s.id,i),e[12]=i,e[13]=s.id,e[14]=x):x=e[14];let g;e[15]!==i||e[16]!==t?(g=async()=>{const P=await t.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:i}});return Z(P)},e[15]=i,e[16]=t,e[17]=g):g=e[17];let u;e[18]!==x||e[19]!==g?(u={queryKey:x,queryFn:g},e[18]=x,e[19]=g,e[20]=u):u=e[20];const y=me(u).data?.item?.configuration_state??null;let C;e[21]!==y?(C=P=>y?.[P.fieldKey]?.value,e[21]=y,e[22]=C):C=e[22];const _=p.map(C).filter(qn),T=[...d.map(Kn),...h.map(Mn),..._.map(Fn)].sort().join(","),E=me({queryKey:W.commerceDiscoveryCompanionConnections(s.id,T),queryFn:async()=>{if(p.length===0)return{items:[]};const P=[{field:["app_name"],operator:"in",value:d},{field:["app_id"],operator:"in",value:h}];_.length>0&&P.push({field:["id"],operator:"in",value:_});const G=await t.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{operator:"or",conditions:P},limit:1e3}});return Z(G)}}).data?.items??[],I=new Set(_),$=E.filter(P=>I.has(P.id)),A=$.filter(Dn);let w;e[23]!==s.id||e[24]!==s.slug?(w=P=>({queryKey:W.commerceDiscoveryCompanionOAuthStatus(s.id,P.id),queryFn:async()=>{try{const G=await fetch(`/api/${encodeURIComponent(s.slug)}/connections/${encodeURIComponent(P.id)}/oauth-token/status`,{credentials:"include"});return G.ok?{hasToken:(await G.json()).hasToken===!0}:{hasToken:!1}}catch{return{hasToken:!1}}},retry:!1}),e[23]=s.id,e[24]=s.slug,e[25]=w):w=e[25];const O=sn({queries:A.map(w)});let k;e[26]!==O?(k=(P,G)=>[P.id,O[G]?.data?.hasToken===!0],e[26]=O,e[27]=k):k=e[27];const z=new Map(A.map(k)),F={};for(const P of $)F[P.id]=!P.oauth_config||!!P.connection_token||z.get(P.id)===!0;const L=me({queryKey:W.commerceDiscoveryCompanionRegistry(s.id,j),queryFn:async()=>{if(p.length===0)return{items:[]};const P=mn(h,v),G=await Jt(yt.REGISTRY(s.id),s.id,s.slug,"COLLECTION_REGISTRY_APP_LIST",{...P?{where:P}:{},limit:1e3});return Z(G)}}),M={},q={};for(const P of L.data?.items??[])M[P.id]=P,P.server?.name&&(q[P.server.name]=P);const S=bn({requirements:p,itemsById:M,itemsByName:q,connections:E,connectionReadiness:F,configurationState:y,curated:Je});let D;return e[28]!==S?(D={cards:S},e[28]=S,e[29]=D):D=e[29],D}function Dn(o){return o.oauth_config&&!o.connection_token}function Fn(o){return`linked:${o}`}function Mn(o){return`app:${o}`}function Kn(o){return`binding:${o}`}function qn(o){return typeof o=="string"&&o.length>0}function Hn(o){return o.bindingType}function Vn(o){return!Je[o.bindingType]}function Bn(o){return!!o}function Gn(o){return Je[o.bindingType]?.registryAppId}function Qn(o){return o.bindingType}function Wn({selfClient:o,org:e,userId:t,cdConnectionId:s}){const i=dt(),[a,r]=K.useState(null),[l,c]=K.useState(null),m=async(p,d)=>{const h=await o.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:p,data:d}});return Z(h)};async function f(p){r(p.fieldKey),c(null);try{let d=p.candidateConnectionId;if(!d){const u=Zt(p.registryItem,e.id,t,{remoteIndex:0}),b=u.connection_type==="STDIO",y=!!u.connection_url,C=b&&u.connection_headers&&typeof u.connection_headers=="object"&&"command"in u.connection_headers;if(!y&&!C)return c(`${p.title} cannot be connected: no connection method available`),!1;const _=await o.callTool({name:"COLLECTION_CONNECTIONS_CREATE",arguments:{data:u}});d=Z(_).item.id}const h=d,v=await on({connectionId:h,orgId:e.id,orgSlug:e.slug,persistFallback:u=>m(h,{connection_token:u}).then(()=>{})});if(!v.ok)return c(`Couldn't sign in to ${p.title}: ${v.error}`),!1;const j=await o.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:s}}),x=Z(j).item?.configuration_state??null,g=un(x,p.fieldKey,p.bindingType,h);return await m(s,{configuration_state:g}),await i.invalidateQueries({queryKey:W.commerceDiscoveryConnection(e.id,s)}),await i.invalidateQueries({queryKey:W.commerceDiscoveryCompanionConnectionsPrefix(e.id)}),!0}catch(d){return c(d instanceof Error?d.message:String(d)),!1}finally{r(null)}}return{connect:f,connectingFieldKey:a,error:l}}const Ze="flex min-h-0 flex-1 flex-col gap-6 md:grid md:flex-none md:gap-4";function Xe(){const o=U.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 Yn(){const o=U.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(Jn)}),o[0]=e):e=o[0],e}function Jn(o){return n.jsx(Rn,{},o)}function et(){const o=U.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsxs("div",{className:Ze,children:[n.jsx(Xe,{}),n.jsx(Yn,{})]}),o[0]=e):e=o[0],e}function Zn(o){const e=U.c(5),{onRetry:t}=o;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(Xe,{}),e[0]=s):s=e[0];let i,a;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."}),a=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]=a):(i=e[1],a=e[2]);let r;return e[3]!==t?(r=n.jsxs("div",{className:Ze,children:[s,n.jsxs("div",{role:"alert",className:"rounded-2xl border border-border bg-card p-4",children:[i,a,n.jsx(V,{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 Xn(o){const e=U.c(2);let t;return e[0]!==o?(t=n.jsx(ft,{children:s=>{const{reset:i}=s;return n.jsx(pt,{fallback:a=>{const{resetError:r}=a;return n.jsx(Zn,{onRetry:()=>{i(),r()}})},children:n.jsx(K.Suspense,{fallback:n.jsx(et,{}),children:n.jsx(es,{...o})})})}}),e[0]=o,e[1]=t):t=e[1],t}function es(o){const e=U.c(37),{org:t,cdConnectionId:s,siteUrl:i}=o,{data:a}=ke.useSession(),r=a?.user?.id??"";let l;e[0]!==t.id||e[1]!==t.slug?(l={connectionId:vt,orgId:t.id,orgSlug:t.slug},e[0]=t.id,e[1]=t.slug,e[2]=l):l=e[2];const c=Ue(l);let m;e[3]!==s||e[4]!==t||e[5]!==c?(m={selfClient:c,org:t,cdConnectionId:s},e[3]=s,e[4]=t,e[5]=c,e[6]=m):m=e[6];const{cards:f}=zn(m);let p;e[7]!==s||e[8]!==t||e[9]!==c||e[10]!==r?(p={selfClient:c,org:t,userId:r,cdConnectionId:s},e[7]=s,e[8]=t,e[9]=c,e[10]=r,e[11]=p):p=e[11];const{connect:d,connectingFieldKey:h,error:v}=Wn(p),[j,x]=K.useState(null);if(f.length===0)return null;const g=h!==null;let u;e[12]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(Xe,{}),e[12]=u):u=e[12];let b;e[13]!==v?(b=v&&n.jsx("p",{role:"alert",className:"mb-3 text-sm text-destructive",children:v}),e[13]=v,e[14]=b):b=e[14];let y;if(e[15]!==j||e[16]!==g||e[17]!==f||e[18]!==d||e[19]!==h||e[20]!==t||e[21]!==c||e[22]!==i){let T;e[24]!==j||e[25]!==g||e[26]!==d||e[27]!==h||e[28]!==t||e[29]!==c||e[30]!==i?(T=N=>{const E=async()=>{await d(N)&&x(N.fieldKey)};return n.jsx(Pn,{card:N,connecting:h===N.fieldKey,disabled:g&&h!==N.fieldKey,org:t,selfClient:c,siteUrl:i,autoOpenConfigFieldKey:j,onAutoOpenConfigHandled:()=>x(I=>I===N.fieldKey?null:I),onConnect:()=>{E()}},N.fieldKey)},e[24]=j,e[25]=g,e[26]=d,e[27]=h,e[28]=t,e[29]=c,e[30]=i,e[31]=T):T=e[31],y=f.map(T),e[15]=j,e[16]=g,e[17]=f,e[18]=d,e[19]=h,e[20]=t,e[21]=c,e[22]=i,e[23]=y}else y=e[23];let C;e[32]!==y?(C=n.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:y}),e[32]=y,e[33]=C):C=e[33];let _;return e[34]!==b||e[35]!==C?(_=n.jsxs("div",{className:Ze,children:[u,n.jsxs(Ke,{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:[b,C]})]}),e[34]=b,e[35]=C,e[36]=_):_=e[36],_}const tt="https://decocms.com/agendar",ts="Precisa de ajuda? Fale conosco",ns="Agende uma chamada de 20 minutos e rodamos o diagnóstico com você, ao vivo.",_t={photo:"https://decoims.com/image?src=decocms%2Fb07a1c19-0cd6-49c8-b326-86055ee78605%2Fauthor-1763423987973-baby.jpeg&quality=original&fit=cover&width=200&height=200"},Et="var(--brand-green-dark)";function nt({siteUrl:o,email:e}){const t=new URL(tt);return o&&t.searchParams.set("siteUrl",o),e&&t.searchParams.set("email",e),t.toString()}function ss(o){const e=U.c(9),{href:t,size:s,className:i}=o,a=t===void 0?tt:t,r=s===void 0?"lg":s;let l;e[0]!==i?(l=J("w-full",i),e[0]=i,e[1]=l):l=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(Ct,{size:16}),e[2]=c):c=e[2];let m;e[3]!==a?(m=n.jsxs("a",{href:a,target:"_blank",rel:"noreferrer",children:["Agendar uma reunião",c]}),e[3]=a,e[4]=m):m=e[4];let f;return e[5]!==r||e[6]!==l||e[7]!==m?(f=n.jsx(V,{asChild:!0,variant:"outline",size:r,className:l,children:m}),e[5]=r,e[6]=l,e[7]=m,e[8]=f):f=e[8],f}function os(o){const e=U.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 a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx("div",{className:"h-full w-full overflow-hidden rounded-full border-4 border-card bg-muted",children:n.jsx("img",{src:_t.photo,alt:"Especialista da deco",className:"h-full w-full object-cover",loading:"lazy"})}),e[2]=a):a=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 l;return e[4]!==i?(l=n.jsxs("div",{className:"relative shrink-0",style:i,children:[a,r]}),e[4]=i,e[5]=l):l=e[5],l}function st(o){const e=U.c(5),{href:t}=o;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx("div",{className:"h-20",style:{backgroundColor:Et}}),e[0]=s):s=e[0];let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx("div",{className:"-mt-9 mb-4",children:n.jsx(os,{})}),e[1]=i):i=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx("h2",{className:"text-lg font-medium leading-6 text-foreground",children:ts}),n.jsx("p",{className:"text-sm leading-5 text-muted-foreground",children:ns})]}),e[2]=a):a=e[2];let r;return e[3]!==t?(r=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:[s,n.jsxs("div",{className:"px-8 pb-8",children:[i,a,n.jsx(ss,{href:t,size:"lg",className:"mt-6"})]})]})}),e[3]=t,e[4]=r):r=e[4],r}function is(o){const e=U.c(8),{className:t,href:s}=o,i=s===void 0?tt:s;let a;e[0]!==t?(a=J("flex items-center gap-4 rounded-2xl border border-border bg-card p-5 card-shadow transition-colors hover:bg-accent",t),e[0]=t,e[1]=a):a=e[1];let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=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 ${Et}`},children:n.jsx("img",{src:_t.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[2]=r):r=e[2];let l,c;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsxs("span",{className:"flex-1 text-base font-medium leading-5 text-foreground",children:["Precisa de ajuda?",n.jsx("br",{}),"Fale conosco"]}),c=n.jsx(Ct,{size:18,className:"shrink-0 text-muted-foreground"}),e[3]=l,e[4]=c):(l=e[3],c=e[4]);let m;return e[5]!==i||e[6]!==a?(m=n.jsxs("a",{href:i,target:"_blank",rel:"noreferrer",className:a,children:[r,l,c]}),e[5]=i,e[6]=a,e[7]=m):m=e[7],m}function wt(o){const e=U.c(10),{host:t}=o,s=`https://www.google.com/s2/favicons?domain=${t}&sz=128`;let i,a,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"}),a=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]=a,e[2]=r):(i=e[0],a=e[1],r=e[2]);let l;e[3]!==s?(l=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]=l):l=e[4];let c;e[5]!==t?(c=n.jsx("span",{className:"text-lg font-medium text-foreground",children:t}),e[5]=t,e[6]=c):c=e[6];let m;return e[7]!==l||e[8]!==c?(m=n.jsxs("div",{className:"flex items-center gap-3",children:[i,a,r,l,c]}),e[7]=l,e[8]=c,e[9]=m):m=e[9],m}const rs={workspace:"Preparando seu workspace de commerce...",generic:"Preparando..."};function as(o){return rs[o]}function ot(o){const e=U.c(4),{variant:t}=o;let s;e[0]!==t?(s=as(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(Ye,{label:s,className:"text-muted-foreground"})}),e[2]=s,e[3]=i):i=e[3],i}function Io(){const o=U.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(ds,{}),o[0]=e):e=o[0],e}const Tt=K.createContext(null),It=()=>K.useContext(Tt);function Q(o){const e=U.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 a=gt(i),{data:r}=ke.useSession(),l=r?.user?.email;let c;e[4]!==a.siteUrl||e[5]!==l?(c=nt({siteUrl:a.siteUrl,email:l}),e[4]=a.siteUrl,e[5]=l,e[6]=c):c=e[6];const m=c;let f;e[7]!==m||e[8]!==s?(f=s??n.jsx(st,{href:m}),e[7]=m,e[8]=s,e[9]=f):f=e[9];let p;return e[10]!==t||e[11]!==f?(p=n.jsx($t,{...t,visual:f}),e[10]=t,e[11]=f,e[12]=p):p=e[12],p}const ls={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 cs(o){if(!o)return null;const e=Te(o);return e.ok?new URL(e.value).hostname:null}function lt(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 ct=!1;function ds(){const o=gt({from:"/commerce-onboarding"}),{org:e,siteUrl:t}=o,s=cs(t);return!ct&&kt()&&(ct=!0,At("commerce_onboarding_viewed",{site_url:t,domain:s??void 0,...s?{$set:{last_scanned_domain:s}}:{}})),n.jsx(Tt.Provider,{value:s,children:n.jsx(ms,{requestedOrgSlug:e,siteUrl:t})})}function ms(o){const e=U.c(8),{requestedOrgSlug:t,siteUrl:s}=o,{data:i,isPending:a}=ke.useSession(),r=It();if(a){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(Q,{children:n.jsx(ot,{variant:"generic"})}),e[0]=c):c=e[0],c}if(!i){const c=typeof window>"u"?"/commerce-onboarding":`${window.location.pathname}${window.location.search}`;let m;e[1]!==r?(m=r?n.jsx(wt,{host:r}):void 0,e[1]=r,e[2]=m):m=e[2];let f;return e[3]!==m?(f=n.jsx(Q,{children:n.jsx(Pt,{callbackUrl:c,allowAutoLogin:!1,title:"Desbloqueie seu diagnóstico completo",subtitle:null,brand:m,copy:ls})}),e[3]=m,e[4]=f):f=e[4],f}let l;return e[5]!==t||e[6]!==s?(l=n.jsx(us,{requestedOrgSlug:t,siteUrl:s}),e[5]=t,e[6]=s,e[7]=l):l=e[7],l}function us(o){const e=U.c(40),{requestedOrgSlug:t,siteUrl:s}=o,i=ht(),a=Ut(),[r,l]=K.useState(null),[c,m]=K.useState(null),f=a.data?.map(ps)??[];let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={mutationFn:fs,retry:!1,onSuccess:u=>{m(u)}},e[0]=p):p=e[0];const d=Oe(p);if(a.isPending){let u;return e[1]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(Q,{children:n.jsx(ot,{variant:"workspace"})}),e[1]=u):u=e[1],u}if(a.error){let u;return e[2]!==a?(u=n.jsx(Ie,{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:()=>a.refetch()}),e[2]=a,e[3]=u):u=e[3],u}const h=t?f.find(u=>u.slug===t):null;if(h){let u;return e[4]!==h||e[5]!==s?(u=n.jsx(we,{org:h,initialSiteUrl:s}),e[4]=h,e[5]=s,e[6]=u):u=e[6],u}if(t){let u;return e[7]!==a?(u=n.jsx(Ie,{title:"Organização não encontrada",description:"Não conseguimos encontrar essa organização na sua conta.",actionLabel:"Tentar novamente",onRetry:()=>a.refetch()}),e[7]=a,e[8]=u):u=e[8],u}if(r){let u;return e[9]!==r||e[10]!==s?(u=n.jsx(we,{org:r,initialSiteUrl:s}),e[9]=r,e[10]=s,e[11]=u):u=e[11],u}if(f.length===1&&f[0]){let u;return e[12]!==f[0]||e[13]!==s?(u=n.jsx(we,{org:f[0],initialSiteUrl:s}),e[12]=f[0],e[13]=s,e[14]=u):u=e[14],u}if(f.length>1){let u;e[15]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(X,{title:"Escolha uma organização",description:"Selecione onde o diagnóstico de commerce deve continuar."}),e[15]=u):u=e[15];let b;e[16]===Symbol.for("react.memo_cache_sentinel")?(b=C=>l(C),e[16]=b):b=e[16];let y;return e[17]!==f?(y=n.jsx(Q,{children:n.jsxs("div",{className:"grid gap-10",children:[u,n.jsx(Ke,{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:n.jsx(it,{organizations:f,selectLabel:"Continuar",onSelected:b})})]})}),e[17]=f,e[18]=y):y=e[18],y}if(!c){let u;e[19]!==d?(u=()=>{d.reset(),d.mutate()},e[19]=d,e[20]=u):u=e[20];let b;return e[21]!==d||e[22]!==u?(b=n.jsx(gs,{mutation:d,onRetry:u}),e[21]=d,e[22]=u,e[23]=b):b=e[23],b}const v=c;if(v?.success&&(v.status==="created"||v.status==="joined"||v.status==="already_has_organization")&&v.organization){let u;return e[24]!==v.organization||e[25]!==s?(u=n.jsx(we,{org:v.organization,initialSiteUrl:s}),e[24]=v.organization,e[25]=s,e[26]=u):u=e[26],u}if(v?.status==="ambiguous"&&v.organizations&&v.organizations.length>0){let u;e[27]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(X,{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]=u):u=e[27];const b=v.domain??void 0;let y;e[28]!==i||e[29]!==s?(y=(_,T)=>{xt(),l({..._,slug:T}),i({to:"/commerce-onboarding",search:{org:T,siteUrl:s}})},e[28]=i,e[29]=s,e[30]=y):y=e[30];let C;return e[31]!==v.organizations||e[32]!==b||e[33]!==y?(C=n.jsx(Q,{children:n.jsxs("div",{className:"grid gap-10",children:[u,n.jsx(Ke,{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:n.jsx(it,{organizations:v.organizations,domain:b,onJoined:y})})]})}),e[31]=v.organizations,e[32]=b,e[33]=y,e[34]=C):C=e[34],C}const j=v?.error??"Não conseguimos determinar uma organização de commerce para esta conta.";let x;e[35]!==d?(x=()=>{m(null),d.reset()},e[35]=d,e[36]=x):x=e[36];let g;return e[37]!==j||e[38]!==x?(g=n.jsx(Ie,{title:"O onboarding de commerce precisa de suporte",description:j,actionLabel:"Tentar novamente",onRetry:x}),e[37]=j,e[38]=x,e[39]=g):g=e[39],g}async function fs(){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&&xt(),e}function ps(o){return{id:o.id,name:o.name,slug:o.slug,logo:o.logo??null}}function gs(o){const e=U.c(7),{mutation:t,onRetry:s}=o,i=K.useRef(!1);let a;e[0]!==t?(a=m=>{!m||i.current||(i.current=!0,t.mutate())},e[0]=t,e[1]=a):a=e[1];const r=a;if(t.error){let m;return e[2]!==s?(m=n.jsx(Ie,{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 l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(ot,{variant:"generic"}),e[4]=l):l=e[4];let c;return e[5]!==r?(c=n.jsx(Q,{children:n.jsx("div",{ref:r,children:l})}),e[5]=r,e[6]=c):c=e[6],c}function X(o){const e=U.c(8),{title:t,description:s}=o,i=It();let a;e[0]!==i?(a=i?n.jsx(wt,{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]=a):a=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 l;return e[5]!==a||e[6]!==r?(l=n.jsxs("div",{className:"grid gap-10",children:[a,r]}),e[5]=a,e[6]=r,e[7]=l):l=e[7],l}function Ie(o){const e=U.c(9),{title:t,description:s,actionLabel:i,onRetry:a}=o;let r;e[0]!==s||e[1]!==t?(r=n.jsx(X,{title:t,description:s}),e[0]=s,e[1]=t,e[2]=r):r=e[2];let l;e[3]!==i||e[4]!==a?(l=n.jsx(V,{type:"button",size:"xl",className:"w-full",onClick:a,children:i}),e[3]=i,e[4]=a,e[5]=l):l=e[5];let c;return e[6]!==r||e[7]!==l?(c=n.jsx(Q,{children:n.jsxs("div",{className:"grid gap-10",children:[r,l]})}),e[6]=r,e[7]=l,e[8]=c):c=e[8],c}function hs(o){return o.content?.find(e=>e.text)?.text??"A configuração do Commerce Discovery falhou."}function Ee(o){const e=o;if(e.isError)throw new Error(hs(e));return e.structuredContent??o}function we(o){const e=U.c(10),{org:t,initialSiteUrl:s}=o,{data:i}=ke.useSession(),a=i?.user?.email;let r;e[0]!==s||e[1]!==a?(r=nt({siteUrl:s,email:a}),e[0]=s,e[1]=a,e[2]=r):r=e[2];const l=r;let c;e[3]!==l?(c=n.jsx(st,{href:l}),e[3]=l,e[4]=c):c=e[4];const m=c;let f;return e[5]!==s||e[6]!==m||e[7]!==t||e[8]!==i?.user?.email?(f=n.jsx(ft,{children:p=>{const{reset:d}=p;return n.jsx(pt,{fallback:h=>{const{error:v,resetError:j}=h;return n.jsx(Q,{visual:m,children:n.jsx(xs,{orgName:t.name,message:v instanceof Error?v.message:"Não foi possível verificar a configuração do Commerce Discovery.",onRetry:()=>{d(),j()}})})},children:n.jsx(K.Suspense,{fallback:n.jsx(Ot,{visual:m}),children:n.jsx(ys,{org:t,initialSiteUrl:s,sessionEmail:i?.user?.email},`${t.id}:${s??""}`)})})}}),e[5]=s,e[6]=m,e[7]=t,e[8]=i?.user?.email,e[9]=f):f=e[9],f}function Ot(o){const e=U.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(X,{}),n.jsx(et,{})]}),e[0]=s):s=e[0];let i;return e[1]!==t?(i=n.jsx(Q,{align:"fill",visual:t,children:s}),e[1]=t,e[2]=i):i=e[2],i}function xs(o){const e=U.c(10),{orgName:t,message:s,onRetry:i}=o,a=`A configuração de commerce continuará em ${t}.`;let r;e[0]!==a?(r=n.jsx(X,{title:"Diagnóstico de commerce",description:a}),e[0]=a,e[1]=r):r=e[1];let l;e[2]!==s?(l=n.jsx(xe,{message:s}),e[2]=s,e[3]=l):l=e[3];let c;e[4]!==i?(c=n.jsx(V,{type:"button",size:"xl",className:"w-full",onClick:i,children:"Tentar novamente"}),e[4]=i,e[5]=c):c=e[5];let m;return e[6]!==r||e[7]!==l||e[8]!==c?(m=n.jsxs("div",{className:"grid gap-10",children:[r,l,c]}),e[6]=r,e[7]=l,e[8]=c,e[9]=m):m=e[9],m}function ys(o){const e=U.c(111),{org:t,initialSiteUrl:s,sessionEmail:i}=o,a=ht();let r;e[0]!==t.id||e[1]!==t.slug?(r={connectionId:vt,orgId:t.id,orgSlug:t.slug},e[0]=t.id,e[1]=t.slug,e[2]=r):r=e[2];const l=Ue(r),[c,m]=K.useState(s??""),[f,p]=K.useState(null),[d,h]=K.useState(null),v=K.useRef(!1),j=yt.COMMERCE_DISCOVERY(t.id),x=zt(t.id),g=W.commerceDiscoveryConnection(t.id,j);let u;e[3]!==j||e[4]!==l?(u=async()=>{const R=await l.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:j}});return Ee(R)},e[3]=j,e[4]=l,e[5]=u):u=e[5];let b;e[6]!==g||e[7]!==u?(b={queryKey:g,queryFn:u,retry:!1},e[6]=g,e[7]=u,e[8]=b):b=e[8];const y=me(b),C=W.commerceDiscoveryVirtualMcp(t.id,x);let _;e[9]!==l||e[10]!==x?(_=async()=>{const R=await l.callTool({name:"COLLECTION_VIRTUAL_MCP_GET",arguments:{id:x}});return Ee(R)},e[9]=l,e[10]=x,e[11]=_):_=e[11];let T;e[12]!==C||e[13]!==_?(T={queryKey:C,queryFn:_,retry:!1},e[12]=C,e[13]=_,e[14]=T):T=e[14];const N=me(T);let E;e[15]!==l?(E=async R=>{const B=await l.callTool({name:"COMMERCE_DISCOVERY_SETUP",arguments:{siteUrl:R}});return Ee(B)},e[15]=l,e[16]=E):E=e[16];let I;e[17]!==y||e[18]!==N?(I=R=>{p(R),h(null),y.refetch(),N.refetch()},e[17]=y,e[18]=N,e[19]=I):I=e[19];let $;e[20]===Symbol.for("react.memo_cache_sentinel")?($=R=>{h(R instanceof Error?R.message:"A configuração do Commerce Discovery falhou.")},e[20]=$):$=e[20];let A;e[21]!==E||e[22]!==I?(A={mutationFn:E,retry:!1,onSuccess:I,onError:$},e[21]=E,e[22]=I,e[23]=A):A=e[23];const w=Oe(A);let O;e[24]!==l?(O={mutationFn:async R=>{const B=await l.callTool({name:"COMMERCE_DISCOVERY_RUN",arguments:{siteUrl:R}});return Ee(B)},retry:!1},e[24]=l,e[25]=O):O=e[25];const k=Oe(O),[z,F]=K.useState(null),L=!!y.data.item&&!!N.data.item,M=y.data.item,q=typeof M?.metadata?.siteUrl=="string"?M.metadata.siteUrl:void 0,S=s||c||q||"";let D;e[26]!==S||e[27]!==i?(D=nt({siteUrl:S,email:i}),e[26]=S,e[27]=i,e[28]=D):D=e[28];const P=D;let G;e[29]!==P?(G=n.jsx(st,{href:P}),e[29]=P,e[30]=G):G=e[30];const H=G;let ye;e[31]!==w?(ye=R=>{const B=Te(R);if(!B.ok){h(lt(B.error));return}h(null),w.mutate(B.value)},e[31]=w,e[32]=ye):ye=e[32];const te=ye;let ve;e[33]!==s||e[34]!==te||e[35]!==L?(ve=R=>{!R||v.current||L||!s||(v.current=!0,te(s))},e[33]=s,e[34]=te,e[35]=L,e[36]=ve):ve=e[36];const Re=ve;let be;e[37]!==te||e[38]!==c?(be=R=>{R.preventDefault(),te(c)},e[37]=te,e[38]=c,e[39]=be):be=e[39];const Y=be;let je;e[40]!==j||e[41]!==f?.reportApp||e[42]!==x?(je=f?.reportApp??{connectionId:j,virtualMcpId:x,toolName:Dt},e[40]=j,e[41]=f?.reportApp,e[42]=x,e[43]=je):je=e[43];const ee=je;let Se;e[44]!==S||e[45]!==a||e[46]!==t.slug||e[47]!==ee||e[48]!==k?(Se=async()=>{F(null);const R=Te(S);if(R.ok)try{await k.mutateAsync(R.value)}catch{F("Algo deu errado ao gerar seu relatório. Tente novamente em instantes.");return}localStorage.setItem(Rt.sidebarOpen(),JSON.stringify(!1)),a({to:"/$org/$taskId",params:{org:t.slug,taskId:crypto.randomUUID()},search:{virtualmcpid:ee.virtualMcpId,main:Lt(ee.connectionId,ee.toolName),chat:0}})},e[44]=S,e[45]=a,e[46]=t.slug,e[47]=ee,e[48]=k,e[49]=Se):Se=e[49];const Pe=Se;if(L){let R;return e[50]!==P||e[51]!==H||e[52]!==S||e[53]!==Pe||e[54]!==t||e[55]!==ee||e[56]!==z||e[57]!==k.isPending?(R=n.jsx(vs,{org:t,reportApp:ee,onOpenReport:Pe,isSubmitting:k.isPending,error:z,meetingUrl:P,meetingVisual:H,siteUrl:S}),e[50]=P,e[51]=H,e[52]=S,e[53]=Pe,e[54]=t,e[55]=ee,e[56]=z,e[57]=k.isPending,e[58]=R):R=e[58],R}if(w.isPending){let R;return e[59]!==H?(R=n.jsx(Ot,{visual:H}),e[59]=H,e[60]=R):R=e[60],R}if(s){let R,B;if(e[61]!==H||e[62]!==Y||e[63]!==s||e[64]!==d||e[65]!==t.name||e[66]!==w.isPending||e[67]!==c){B=Symbol.for("react.early_return_sentinel");e:if(R=Te(s),!R.ok){const ze=`A configuração de commerce continuará em ${t.name}.`;let le;e[70]!==ze?(le=n.jsx(X,{title:"Diagnóstico de commerce",description:ze}),e[70]=ze,e[71]=le):le=e[71];const De=n.jsx(xe,{message:lt(R.error)});let ce;e[72]!==Y||e[73]!==d||e[74]!==w.isPending||e[75]!==c?(ce=n.jsx(Me,{siteUrl:c,error:d,isSubmitting:w.isPending,onSiteUrlChange:m,onSubmit:Y}),e[72]=Y,e[73]=d,e[74]=w.isPending,e[75]=c,e[76]=ce):ce=e[76];let de;e[77]!==le||e[78]!==De||e[79]!==ce?(de=n.jsxs("div",{className:"grid gap-10",children:[le,De,ce]}),e[77]=le,e[78]=De,e[79]=ce,e[80]=de):de=e[80];let _e;e[81]!==H||e[82]!==de?(_e=n.jsx(Q,{visual:H,children:de}),e[81]=H,e[82]=de,e[83]=_e):_e=e[83],B=_e;break e}e[61]=H,e[62]=Y,e[63]=s,e[64]=d,e[65]=t.name,e[66]=w.isPending,e[67]=c,e[68]=R,e[69]=B}else R=e[68],B=e[69];if(B!==Symbol.for("react.early_return_sentinel"))return B;const Le=`O Commerce Discovery está sendo preparado para ${R.value}.`;let ie;e[84]!==Le?(ie=n.jsx(X,{title:"Diagnóstico de commerce",description:Le}),e[84]=Le,e[85]=ie):ie=e[85];let re;e[86]!==Y||e[87]!==d||e[88]!==w.isPending||e[89]!==c?(re=d?n.jsxs(n.Fragment,{children:[n.jsx(xe,{message:d}),n.jsx(Me,{siteUrl:c,error:null,isSubmitting:w.isPending,onSiteUrlChange:m,onSubmit:Y})]}):n.jsx(et,{}),e[86]=Y,e[87]=d,e[88]=w.isPending,e[89]=c,e[90]=re):re=e[90];let ae;e[91]!==ie||e[92]!==re||e[93]!==Re?(ae=n.jsxs("div",{ref:Re,className:"grid gap-10",children:[ie,re]}),e[91]=ie,e[92]=re,e[93]=Re,e[94]=ae):ae=e[94];let Ne;return e[95]!==H||e[96]!==ae?(Ne=n.jsx(Q,{visual:H,children:ae}),e[95]=H,e[96]=ae,e[97]=Ne):Ne=e[97],Ne}const $e=`A configuração de commerce continuará em ${t.name}.`;let ne;e[98]!==$e?(ne=n.jsx(X,{title:"Diagnóstico de commerce",description:$e}),e[98]=$e,e[99]=ne):ne=e[99];let se;e[100]!==Y||e[101]!==d||e[102]!==w.isPending||e[103]!==c?(se=n.jsx(Me,{siteUrl:c,error:d,isSubmitting:w.isPending,onSiteUrlChange:m,onSubmit:Y}),e[100]=Y,e[101]=d,e[102]=w.isPending,e[103]=c,e[104]=se):se=e[104];let oe;e[105]!==ne||e[106]!==se?(oe=n.jsxs("div",{className:"grid gap-10",children:[ne,se]}),e[105]=ne,e[106]=se,e[107]=oe):oe=e[107];let Ce;return e[108]!==H||e[109]!==oe?(Ce=n.jsx(Q,{visual:H,children:oe}),e[108]=H,e[109]=oe,e[110]=Ce):Ce=e[110],Ce}function Me(o){const e=U.c(20),{siteUrl:t,error:s,isSubmitting:i,onSiteUrlChange:a,onSubmit:r}=o;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx("label",{className:"text-sm font-medium",htmlFor:"commerce-site-url",children:"URL do site"}),e[0]=l):l=e[0];let c;e[1]!==a?(c=x=>a(x.target.value),e[1]=a,e[2]=c):c=e[2];const m=!!s;let f;e[3]!==i||e[4]!==t||e[5]!==c||e[6]!==m?(f=n.jsx(Ae,{id:"commerce-site-url",type:"text",inputMode:"url",value:t,onChange:c,placeholder:"https://example.com","aria-invalid":m,disabled:i}),e[3]=i,e[4]=t,e[5]=c,e[6]=m,e[7]=f):f=e[7];let p;e[8]!==s?(p=s?n.jsx(xe,{message:s}):null,e[8]=s,e[9]=p):p=e[9];let d;e[10]!==f||e[11]!==p?(d=n.jsxs("div",{className:"grid gap-2",children:[l,f,p]}),e[10]=f,e[11]=p,e[12]=d):d=e[12];let h;e[13]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(bt,{size:16}),e[13]=h):h=e[13];let v;e[14]!==i?(v=n.jsxs(V,{type:"submit",size:"xl",className:"w-full",disabled:i,children:["Continuar",h]}),e[14]=i,e[15]=v):v=e[15];let j;return e[16]!==r||e[17]!==d||e[18]!==v?(j=n.jsxs("form",{className:"grid gap-4",onSubmit:r,children:[d,v]}),e[16]=r,e[17]=d,e[18]=v,e[19]=j):j=e[19],j}function vs(o){const e=U.c(26),{org:t,reportApp:s,onOpenReport:i,isSubmitting:a,error:r,meetingUrl:l,meetingVisual:c,siteUrl:m}=o;let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(X,{}),e[0]=f):f=e[0];let p;e[1]!==t||e[2]!==s.connectionId||e[3]!==m?(p=n.jsx(Xn,{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]!==l?(d=n.jsx(is,{className:"md:hidden",href:l}),e[5]=l,e[6]=d):d=e[6];let h;e[7]!==r?(h=r?n.jsx(xe,{message:r}):null,e[7]=r,e[8]=h):h=e[8];const v=a||!s.virtualMcpId,j=a?"Abrindo relatório...":"Ver relatório completo";let x;e[9]!==a?(x=a?null:n.jsx(bt,{size:18}),e[9]=a,e[10]=x):x=e[10];let g;e[11]!==i||e[12]!==v||e[13]!==j||e[14]!==x?(g=n.jsxs(V,{type:"button",size:"xl",className:"w-full rounded-2xl text-base font-medium",onClick:i,disabled:v,children:[j,x]}),e[11]=i,e[12]=v,e[13]=j,e[14]=x,e[15]=g):g=e[15];let u;e[16]!==d||e[17]!==h||e[18]!==g?(u=n.jsxs("div",{className:"flex shrink-0 flex-col gap-3 md:mt-8",children:[d,h,g]}),e[16]=d,e[17]=h,e[18]=g,e[19]=u):u=e[19];let b;e[20]!==p||e[21]!==u?(b=n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-6 md:grid md:gap-4",children:[f,p,u]}),e[20]=p,e[21]=u,e[22]=b):b=e[22];let y;return e[23]!==c||e[24]!==b?(y=n.jsx(Q,{align:"fill",visual:c,children:b}),e[23]=c,e[24]=b,e[25]=y):y=e[25],y}function xe(o){const e=U.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{Io as default};
|