decocms 3.98.0 → 3.99.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-kcMUHNYP.js → AlertCircle-VcwplCRi.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-KPaHD_ZU.js → ArrowUpRight-CAv7CUnJ.js} +1 -1
- package/dist/client/assets/{CheckCircle-Do934x7B.js → CheckCircle-V30FMM2D.js} +1 -1
- package/dist/client/assets/{ChevronDown-DJ5SHmhN.js → ChevronDown-URo4LveF.js} +1 -1
- package/dist/client/assets/{ChevronLeft-QZNH5ck-.js → ChevronLeft-aMkPes9N.js} +1 -1
- package/dist/client/assets/{ChevronRight-BXEszS6k.js → ChevronRight-oz8o6WPV.js} +1 -1
- package/dist/client/assets/{ChevronUp-CUesWqmK.js → ChevronUp-HJUE3-BD.js} +1 -1
- package/dist/client/assets/{DotsVertical-F-o-_a2z.js → DotsVertical-QF46dzdi.js} +1 -1
- package/dist/client/assets/{Eye-FmUDnTHn.js → Eye-BSiFxHQB.js} +1 -1
- package/dist/client/assets/{FilterLines-eS3dI9hB.js → FilterLines-CEzORaPw.js} +1 -1
- package/dist/client/assets/{Globe01-Ckwe4UHh.js → Globe01-wGomueqV.js} +1 -1
- package/dist/client/assets/{Globe04-iXhOnFjr.js → Globe04-CsKOsQ4z.js} +1 -1
- package/dist/client/assets/{HardDrive-CNIST2bR.js → HardDrive-BuI4Q48l.js} +1 -1
- package/dist/client/assets/{Key01-wlyPB5nN.js → Key01-r6MDYdDw.js} +1 -1
- package/dist/client/assets/{LayoutLeft-C_wbh4sE.js → LayoutLeft-BFxGsVdk.js} +1 -1
- package/dist/client/assets/{LinkExternal01-BoVxtqR2.js → LinkExternal01-BWnRnxGs.js} +1 -1
- package/dist/client/assets/{Monitor01-DNvJhnf-.js → Monitor01-SEZLDRFN.js} +1 -1
- package/dist/client/assets/{Palette-Bf6p_3g1.js → Palette-CEjENuG4.js} +1 -1
- package/dist/client/assets/{Play-D6BtU9Uh.js → Play-BDoh8EAp.js} +1 -1
- package/dist/client/assets/{Plus-8zBKSNee.js → Plus-Bw9lc6SR.js} +1 -1
- package/dist/client/assets/{SearchMd-57vTBUjU.js → SearchMd-BMfw7gZ4.js} +1 -1
- package/dist/client/assets/{Settings02-k7X7M16V.js → Settings02-DbH9OAzT.js} +1 -1
- package/dist/client/assets/{Shield01-6X9Jy9--.js → Shield01-C1R4fpvK.js} +1 -1
- package/dist/client/assets/{Star01-BUumId75.js → Star01-BwAv907s.js} +1 -1
- package/dist/client/assets/{Stars01-BvvUaY8d.js → Stars01-D1icdaCh.js} +1 -1
- package/dist/client/assets/{Stars02-f3tbtjbB.js → Stars02-PPXsboxW.js} +1 -1
- package/dist/client/assets/{Sun-42Xfv_Dc.js → Sun-Dw86eVev.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-BeteqXsq.js → SwitchHorizontal01-F_1MjTR3.js} +1 -1
- package/dist/client/assets/{Tool01-DKUGTxge.js → Tool01-DvTGD1Yt.js} +1 -1
- package/dist/client/assets/{Trash01-DDwxWuR_.js → Trash01-d58N8w5a.js} +1 -1
- package/dist/client/assets/{Upload01-CvwE1uG-.js → Upload01-C_hHbDSF.js} +1 -1
- package/dist/client/assets/{User01-KLLrp_Cb.js → User01-BDtU1dk1.js} +1 -1
- package/dist/client/assets/{Users01-BoxxsDP9.js → Users01-PX3eYoC8.js} +1 -1
- package/dist/client/assets/{Users03-Cnldjgk9.js → Users03-CL71IAQ8.js} +1 -1
- package/dist/client/assets/{X-D5odjFOj.js → X-D7X7Z50V.js} +1 -1
- package/dist/client/assets/{XCircle-CkFuQ7IG.js → XCircle-PlbEvjyp.js} +1 -1
- package/dist/client/assets/{XClose-CQQFXdbB.js → XClose-BbuWQhNb.js} +1 -1
- package/dist/client/assets/{Zap-D2QyQXL2.js → Zap-BQKeuD4l.js} +1 -1
- package/dist/client/assets/{ZapSquare-DWfiiAgK.js → ZapSquare-CvkoTQDM.js} +1 -1
- package/dist/client/assets/{ZoomOut-CGeRz2Xe.js → ZoomOut-DxqRFWA_.js} +1 -1
- package/dist/client/assets/{access-gate-B1FO8IUq.js → access-gate-6AWas-Ss.js} +1 -1
- package/dist/client/assets/{add-section-modal-C4vE7N12.js → add-section-modal-jgpkoBcW.js} +1 -1
- package/dist/client/assets/{agent-icon-AqXPfJak.js → agent-icon-B2N3zGQH.js} +1 -1
- package/dist/client/assets/{agents-list-D_wYa6fb.js → agents-list-Cd9i8250.js} +1 -1
- package/dist/client/assets/{ai-providers-T-u5bvaJ.js → ai-providers-CG207wTX.js} +1 -1
- package/dist/client/assets/{alert-BbYDxfTx.js → alert-Cg3WXwSx.js} +1 -1
- package/dist/client/assets/{alert-dialog-C-zjIGep.js → alert-dialog-DvWgcmQI.js} +1 -1
- package/dist/client/assets/{app-editor-B1BV7cVP.js → app-editor-tLSi5KV_.js} +1 -1
- package/dist/client/assets/{auth-DhQO5_HB.js → auth-DZDiXt1m.js} +1 -1
- package/dist/client/assets/{auth-catchall-Di4BNeJO.js → auth-catchall-kuEh1_rd.js} +1 -1
- package/dist/client/assets/{auth-entry-_k3gk7s2.js → auth-entry-CavsOUDq.js} +1 -1
- package/dist/client/assets/{auth-split-layout-bCFbyvYe.js → auth-split-layout-dFpcxyJe.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-DBMlTO0L.js → authenticate-and-persist-oauth-CGYbK6H8.js} +1 -1
- package/dist/client/assets/{automation-list-row-Bs5UJwPA.js → automation-list-row-CAUoBpVq.js} +1 -1
- package/dist/client/assets/{automation-runs-BZimcr-h.js → automation-runs-DyKvgj21.js} +1 -1
- package/dist/client/assets/{automations-X1kqWMvM.js → automations-wXAz-GXj.js} +1 -1
- package/dist/client/assets/{avatar-BVLQzOkg.js → avatar-Dv3IrttI.js} +1 -1
- package/dist/client/assets/{badge-DySIiC0W.js → badge-toKsUzoB.js} +1 -1
- package/dist/client/assets/{block-document-DAnpzS1z.js → block-document-DRbnuwCo.js} +1 -1
- package/dist/client/assets/{brand-context-Dw4JnvNB.js → brand-context-BaVxi4M4.js} +1 -1
- package/dist/client/assets/{buckets-B3emByFY.js → buckets-BKwGKvkZ.js} +1 -1
- package/dist/client/assets/{capability-load-error-dMfRi5Lm.js → capability-load-error-BRyHg_Rt.js} +1 -1
- package/dist/client/assets/{card-Dcgr1F8G.js → card-Chq65iX4.js} +1 -1
- package/dist/client/assets/{category-editor-DxkVuATo.js → category-editor-LeiO5-YX.js} +1 -1
- package/dist/client/assets/{chat-context-Bw2XBdCM.js → chat-context-Bspy4m-d.js} +1 -1
- package/dist/client/assets/{checkbox-DtAK_uVJ.js → checkbox-KUrNOBQk.js} +1 -1
- package/dist/client/assets/{cli-auth-success-C1VkvMBP.js → cli-auth-success-B36KwAFt.js} +1 -1
- package/dist/client/assets/{collection-detail-CwmHQu2v.js → collection-detail-CbhoYXmP.js} +1 -1
- package/dist/client/assets/{collection-display-button-CwlHCCWA.js → collection-display-button-DNbt3d2y.js} +1 -1
- package/dist/client/assets/{collection-search-ChsfwSm5.js → collection-search-BPoBI_I5.js} +1 -1
- package/dist/client/assets/{collection-tabs-BKP4OHUr.js → collection-tabs-FH3-RtUV.js} +1 -1
- package/dist/client/assets/{command-BxulIERM.js → command-DMsCjDdA.js} +1 -1
- package/dist/client/assets/{commerce-onboarding-Dg7vjIhZ.js → commerce-onboarding-Cv30K_3D.js} +1 -1
- package/dist/client/assets/{connect-desktop-dialog-CRTSitBm.js → connect-desktop-dialog-G37q3fkg.js} +1 -1
- package/dist/client/assets/{connection-card-DHEsTOvl.js → connection-card-BG_Nwlzj.js} +1 -1
- package/dist/client/assets/{connection-detail-Dug72TML.js → connection-detail-oU0C71F8.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-DydZsosn.js → connection-form-helpers-DLOiycDJ.js} +1 -1
- package/dist/client/assets/{connections-D1302Qtf.js → connections-BgFAjnb1.js} +1 -1
- package/dist/client/assets/{context-menu-CIuP6HS5.js → context-menu-BRDnNrnF.js} +1 -1
- package/dist/client/assets/{decopilot-CTSJKb4z.js → decopilot-DfFzELja.js} +1 -1
- package/dist/client/assets/{decopilot-sse-pool-BiYcCf8O.js → decopilot-sse-pool-TIer_srZ.js} +1 -1
- package/dist/client/assets/{dialog-CbpDnZu8.js → dialog-CxQBoX40.js} +1 -1
- package/dist/client/assets/{domain-settings-CoN7-60k.js → domain-settings-gFWo85oP.js} +1 -1
- package/dist/client/assets/{drawer-UU4w29Dz.js → drawer-CoRZTii0.js} +1 -1
- package/dist/client/assets/{dropdown-menu-QpPxe1tm.js → dropdown-menu-5CWPgj7f.js} +1 -1
- package/dist/client/assets/{empty-state-Do7xKqQm.js → empty-state-B-ezQrZT.js} +1 -1
- package/dist/client/assets/{extract-connection-data-DVGeC9AU.js → extract-connection-data-BaXkJtVr.js} +1 -1
- package/dist/client/assets/{file-explorer-D2afeXPb.js → file-explorer-CwlDpz6e.js} +1 -1
- package/dist/client/assets/{file-type-icon-Cs_SK9tU.js → file-type-icon-Cd8oKt-R.js} +1 -1
- package/dist/client/assets/{files-5aenLfPW.js → files-CkNnfKPK.js} +1 -1
- package/dist/client/assets/{form-HH5S6Yti.js → form-CpFt_4sy.js} +1 -1
- package/dist/client/assets/{general-BnR0HO7J.js → general-9kWrBaDN.js} +1 -1
- package/dist/client/assets/{github-repo-picker-DvVBXFrQ.js → github-repo-picker-CvyWRbaM.js} +1 -1
- package/dist/client/assets/{hooks-fHAHvlgy.js → hooks-BAG9TZjZ.js} +1 -1
- package/dist/client/assets/{import-from-deco-dialog-gGGcEtn9.js → import-from-deco-dialog-ga5lUGZx.js} +1 -1
- package/dist/client/assets/{index--YoOFH0C.js → index-ALZP0-mx.js} +1 -1
- package/dist/client/assets/{index-BMiO2DRK.js → index-BAfXUZ9K.js} +1 -1
- package/dist/client/assets/{index-Dm5Wtwak.js → index-BLMNER8l.js} +1 -1
- package/dist/client/assets/{index-1K74hihp.js → index-BU8Nad-n.js} +1 -1
- package/dist/client/assets/{index-GSJQ2HSb.js → index-BeB2S664.js} +1 -1
- package/dist/client/assets/{index-BlCwbTgh.js → index-BwC0cAdP.js} +1 -1
- package/dist/client/assets/{index-Cnw7T0fh.js → index-C_Ih0jtP.js} +1 -1
- package/dist/client/assets/{index-DEuymgXg.js → index-CiVkOVzW.js} +26 -26
- package/dist/client/assets/{index-DUxlPTha.js → index-DPI_0XE-.js} +1 -1
- package/dist/client/assets/{index-CJHqjy38.js → index-DS2I5JM3.js} +1 -1
- package/dist/client/assets/{index-CutM526i.js → index-DUdLsOJu.js} +1 -1
- package/dist/client/assets/{index-uyO8STkD.js → index-DZCgQXLz.js} +1 -1
- package/dist/client/assets/{index-DVyj5fuq.js → index-I8Uum3Jx.js} +4 -4
- package/dist/client/assets/{index-Cr1XkGY8.js → index-JhgoGL0k.js} +1 -1
- package/dist/client/assets/{index-redirect-B3cwEJb7.js → index-redirect-CP9ATXDl.js} +1 -1
- package/dist/client/assets/{input-GyW6rRcJ.js → input-CutcETvq.js} +1 -1
- package/dist/client/assets/{integration-icon-BtlW6ioP.js → integration-icon-D3W1euXX.js} +1 -1
- package/dist/client/assets/{label-DZS4CYvt.js → label-DtGUWURu.js} +1 -1
- package/dist/client/assets/{login-8FZgzert.js → login-DUTSfri0.js} +1 -1
- package/dist/client/assets/{mcp-oauth-BKEDlyVy.js → mcp-oauth-CSZ5TVrK.js} +1 -1
- package/dist/client/assets/{members-BJYRHZsS.js → members-Dq59tJj1.js} +1 -1
- package/dist/client/assets/{monaco-editor-CGqqNDfH.js → monaco-editor-x5JEAvo5.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-D3Ly6cXH.js → monitoring-stats-row-BsPY2-bU.js} +1 -1
- package/dist/client/assets/{oauth-callback-Dwd806qn.js → oauth-callback-BXF1WEWL.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-CC85HfxS.js → oauth-callback-ai-provider-MpQ7zAqW.js} +1 -1
- package/dist/client/assets/{onboarding-D0JBHrcc.js → onboarding-CKZFzjtY.js} +1 -1
- package/dist/client/assets/{org-install-DQyhSRpe.js → org-install-DVysq6Hz.js} +1 -1
- package/dist/client/assets/{org-layout-Cr-WH3RD.js → org-layout-hE5dYTZz.js} +1 -1
- package/dist/client/assets/{organization-choice-CoeFbp4N.js → organization-choice-y8WYOYM0.js} +1 -1
- package/dist/client/assets/{page-seo-form-B7y574iK.js → page-seo-form-gPXTm6pw.js} +1 -1
- package/dist/client/assets/page-seo-sheet-CpMq28JR.js +1 -0
- package/dist/client/assets/{popover-DCt-yH34.js → popover-C8AJAJSa.js} +1 -1
- package/dist/client/assets/{post-editor-BZKlC439.js → post-editor-DrZmKifS.js} +1 -1
- package/dist/client/assets/{preview-dialog-CvZ5HrrM.js → preview-dialog-D1-LAakL.js} +1 -1
- package/dist/client/assets/{primitives-DU5cdK_v.js → primitives-D7qGIw1V.js} +1 -1
- package/dist/client/assets/{profile-VCalx_au.js → profile-DwtHhCaD.js} +1 -1
- package/dist/client/assets/project-app-view-H9YA_3uu.js +1 -0
- package/dist/client/assets/record-editor-C64a4aNL.js +1 -0
- package/dist/client/assets/registry-CxYUBbU6.js +2 -0
- package/dist/client/assets/{registry-layout-UOOnsAxo.js → registry-layout-CZALtE-Q.js} +1 -1
- package/dist/client/assets/{require-capability-B3soU3U-.js → require-capability-DAovjPYR.js} +1 -1
- package/dist/client/assets/{required-auth-layout-DJ9sUOZj.js → required-auth-layout-BFGUeccA.js} +1 -1
- package/dist/client/assets/{reset-password-Cbn69hRw.js → reset-password-CrnrgmIx.js} +1 -1
- package/dist/client/assets/{roles-BUk_bsvO.js → roles-DRg1cyfq.js} +1 -1
- package/dist/client/assets/{save-status-CV3d48oi.js → save-status-BmnvufMt.js} +1 -1
- package/dist/client/assets/{scroll-area-BOzFl7qs.js → scroll-area-DnauLcxE.js} +1 -1
- package/dist/client/assets/{search-input-Bkwrx7tI.js → search-input-BVF4N9EW.js} +1 -1
- package/dist/client/assets/{secrets-BaUhAjXu.js → secrets-DPqx_gXC.js} +1 -1
- package/dist/client/assets/{sections-editor-B1yHaLKY.js → sections-editor-BLU0buUC.js} +1 -1
- package/dist/client/assets/{select-C3uZV2A_.js → select-CeO9pIG_.js} +1 -1
- package/dist/client/assets/{select-model-Q-rnyaMQ.js → select-model-mprfSN1i.js} +1 -1
- package/dist/client/assets/{seo-editor-tIrWl6nj.js → seo-editor-Dyh0ncgL.js} +1 -1
- package/dist/client/assets/{settings-layout-DTBcjBLr.js → settings-layout-BcPbOkgS.js} +1 -1
- package/dist/client/assets/{settings-section-BLfkvtRw.js → settings-section-B3kXnqLg.js} +1 -1
- package/dist/client/assets/{sheet-n3UWOPEl.js → sheet-CaSXRGPU.js} +1 -1
- package/dist/client/assets/{shell-controls-DhJC4c0p.js → shell-controls-D2Qn9uVj.js} +1 -1
- package/dist/client/assets/{shell-layout-xNLL_s4g.js → shell-layout-BgovnITR.js} +1 -1
- package/dist/client/assets/{shell-route-loading-Cpya0EwH.js → shell-route-loading-w2qYEgt-.js} +1 -1
- package/dist/client/assets/{sidebar-B5rVQTnV.js → sidebar-BNKGZwsk.js} +1 -1
- package/dist/client/assets/{skeleton-D20LVfuJ.js → skeleton-1BUBAFib.js} +1 -1
- package/dist/client/assets/{sortable.esm-bhnYhglv.js → sortable.esm-BQBGtGRV.js} +1 -1
- package/dist/client/assets/{sso-1G-Lrcz1.js → sso-B5RA5Egt.js} +1 -1
- package/dist/client/assets/{store-B2Ao3pPp.js → store-Ni3ANns9.js} +1 -1
- package/dist/client/assets/store-registry-kIHn_jDR.js +2 -0
- package/dist/client/assets/{studio-tools-BvOjHliA.js → studio-tools-bjPFQfXc.js} +1 -1
- package/dist/client/assets/{switch-aFiGEpQz.js → switch-B9PlH85E.js} +1 -1
- package/dist/client/assets/{table-DerXyAj5.js → table-Bh38Wtyx.js} +1 -1
- package/dist/client/assets/{tabs-C2oZPeQe.js → tabs-C0RM8s7M.js} +1 -1
- package/dist/client/assets/{task-status-D2kMSoyM.js → task-status-sw3Y4pwg.js} +1 -1
- package/dist/client/assets/{textarea-C8t5NRp5.js → textarea-CvR7iHW3.js} +1 -1
- package/dist/client/assets/{toggle-group-DJ8r0lkn.js → toggle-group-qpErv2AC.js} +1 -1
- package/dist/client/assets/{toolbar-CH6VbS3Q.js → toolbar-CB27CeHy.js} +1 -1
- package/dist/client/assets/{tooltip-3uKRhKGc.js → tooltip-Cs84Kx7a.js} +1 -1
- package/dist/client/assets/{types-pwajyff_.js → types-pQkRXbdZ.js} +1 -1
- package/dist/client/assets/{use-ai-providers-CWY8hivp.js → use-ai-providers-BgadC07_.js} +1 -1
- package/dist/client/assets/{use-automations-D3-t22-_.js → use-automations-P1MHR3DS.js} +1 -1
- package/dist/client/assets/{use-capability-BjlflkMO.js → use-capability-BUm2GwYJ.js} +1 -1
- package/dist/client/assets/{use-clock-tick-CzIilxCh.js → use-clock-tick-DNfOIVGO.js} +1 -1
- package/dist/client/assets/{use-collections-DCQeHkgD.js → use-collections-KLUYE1x1.js} +1 -1
- package/dist/client/assets/{use-connection-CzcC522C.js → use-connection-BcZ8SPdu.js} +1 -1
- package/dist/client/assets/{use-copy-DwazvcnZ.js → use-copy-3_Rhxcs5.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-Bd6NX9e2.js → use-create-virtual-mcp-BUg1GOjA.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-7QeHZ0an.js → use-debounced-autosave-CSkDAooO.js} +1 -1
- package/dist/client/assets/{use-delete-connection-BuL4NUvH.js → use-delete-connection-CRtYZbhZ.js} +1 -1
- package/dist/client/assets/{use-file-configs-CElizRPA.js → use-file-configs-YBpYKsXP.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-BXMBgtt1.js → use-infinite-scroll-BJoUj4tJ.js} +1 -1
- package/dist/client/assets/{use-join-requests-BNKnZPHN.js → use-join-requests-7lEKJyAD.js} +1 -1
- package/dist/client/assets/{use-mcp-client-fdcDDNuq.js → use-mcp-client-Bq9g8m5J.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-D-HAq_yv.js → use-mcp-prompts-B5FIxmOZ.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-B6s0E39X.js → use-mcp-tools-LraQQ1bu.js} +1 -1
- package/dist/client/assets/{use-members-GGq7DYTP.js → use-members-D283HZiN.js} +1 -1
- package/dist/client/assets/{use-mobile-CvxOtGtu.js → use-mobile-C0mpADhR.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-DwfR9Suw.js → use-navigate-to-agent-CRQ9sIAj.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-DXTnBB9n.js → use-org-auth-client-WATciLg3.js} +1 -1
- package/dist/client/assets/{use-org-sso-B6LnDpoK.js → use-org-sso-HWNvOeDC.js} +1 -1
- package/dist/client/assets/{use-organization-roles-tYXE1Sad.js → use-organization-roles-Cyp5dthQ.js} +1 -1
- package/dist/client/assets/{use-organization-settings-BnxEz1nn.js → use-organization-settings-oh1iUWuA.js} +1 -1
- package/dist/client/assets/{use-registry-connections-B-i9Sftv.js → use-registry-connections-d6Abj3O4.js} +1 -1
- package/dist/client/assets/{use-secrets-DS1SrxPb.js → use-secrets-CkVHtz_G.js} +1 -1
- package/dist/client/assets/{use-status-sounds-9_fdEsNO.js → use-status-sounds-MBoAiBsc.js} +1 -1
- package/dist/client/assets/{use-view-mode-DFO97l4B.js → use-view-mode-Dhn_wt1k.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-ufrd8iJJ.js → use-virtual-mcp-C5aoCVVQ.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-RfoATJAI.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-DBiSYggu.js +1 -0
- package/dist/client/assets/{useSuspenseQueries-CKrSo39Z.js → useSuspenseQueries-C6KWJru5.js} +1 -1
- package/dist/client/assets/{variant-calendar-DotXoiJr.js → variant-calendar-krPIZ_Rp.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-C9lZfxMp.js → view-mode-toggle-DTMt6lCZ.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +361 -361
- package/dist/server/server.js +255 -255
- package/package.json +1 -1
- package/dist/client/assets/page-seo-sheet-C7aYjteJ.js +0 -1
- package/dist/client/assets/project-app-view-DY9V3RKN.js +0 -1
- package/dist/client/assets/record-editor-Iup_3GZW.js +0 -1
- package/dist/client/assets/registry-C1pjl2mg.js +0 -2
- package/dist/client/assets/store-registry-CnLvGy-0.js +0 -2
- package/dist/client/assets/useInfiniteQuery-D6zHLjhR.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-BEAkaT6v.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as y,j as t,B as F,i as X,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 Xe,G,t as Ze,e as ae,b2 as ke}from"./index-DVyj5fuq.js";import{E as Ee}from"./empty-state-Do7xKqQm.js";import{u as et,a as Ae}from"./use-collections-DCQeHkgD.js";import{u as ce}from"./use-mcp-client-fdcDDNuq.js";import{F as ne,a as tt,b as de,d as me}from"./form-HH5S6Yti.js";import{I as ue}from"./input-GyW6rRcJ.js";import{T as re}from"./textarea-C8t5NRp5.js";import{a as st,b as nt,V as xe,O as ot,M as lt}from"./index-BlCwbTgh.js";import{ah as rt,x as it,a6 as at,ai as ct,a2 as dt,aj as mt,M as be}from"./agent-icon-AqXPfJak.js";import{g as ut,M as xt,a as Ne}from"./types-pwajyff_.js";import{A as pt,a as ft,b as ht}from"./alert-BbYDxfTx.js";import{d as ve,b as Se,c as ye,S as we,a as oe}from"./select-C3uZV2A_.js";import{c as gt,T as Ce,a as Ie,b as $e}from"./tooltip-3uKRhKGc.js";import{i as jt}from"./AlertCircle-kcMUHNYP.js";import{s as bt}from"./Stars02-f3tbtjbB.js";import{a as Nt}from"./Eye-FmUDnTHn.js";import{i as vt}from"./Play-D6BtU9Uh.js";import{i as St}from"./ChevronRight-BXEszS6k.js";import{g as yt}from"./connection-slug-eyAPH6o3.js";import{u as wt,T as Ct}from"./index-Cr1XkGY8.js";import{a as Oe,u as Re}from"./use-connection-CzcC522C.js";import{a as It}from"./use-mcp-tools-B6s0E39X.js";import{c as $t}from"./content-blocks-o63cs2vh.js";import{I as Te}from"./integration-icon-BtlW6ioP.js";import{f as Tt,h as Pt}from"./chat-context-Bw2XBdCM.js";import{b as kt}from"./shell-layout-xNLL_s4g.js";import{M as Et}from"./monaco-editor-CGqqNDfH.js";import{n as At}from"./XCircle-CkFuQ7IG.js";import"./auth-DhQO5_HB.js";import"./label-DZS4CYvt.js";import"./index-1K74hihp.js";import"./sidebar-B5rVQTnV.js";import"./LayoutLeft-C_wbh4sE.js";import"./use-mobile-CvxOtGtu.js";import"./sheet-n3UWOPEl.js";import"./X-D5odjFOj.js";import"./ZoomOut-CGeRz2Xe.js";import"./Key01-wlyPB5nN.js";import"./extract-connection-data-DVGeC9AU.js";import"./use-registry-connections-B-i9Sftv.js";import"./use-organization-settings-BnxEz1nn.js";import"./studio-tools-BvOjHliA.js";import"./Plus-8zBKSNee.js";import"./index-CutM526i.js";import"./index-Dm5Wtwak.js";import"./popover-DCt-yH34.js";import"./use-virtual-mcp-ufrd8iJJ.js";import"./ChevronUp-CUesWqmK.js";import"./SearchMd-57vTBUjU.js";import"./Users03-Cnldjgk9.js";import"./use-create-virtual-mcp-Bd6NX9e2.js";import"./use-navigate-to-agent-DwfR9Suw.js";import"./Tool01-DKUGTxge.js";import"./SwitchHorizontal01-BeteqXsq.js";import"./Settings02-k7X7M16V.js";import"./ArrowUpRight-KPaHD_ZU.js";import"./ZapSquare-DWfiiAgK.js";import"./CheckCircle-Do934x7B.js";import"./ChevronDown-DJ5SHmhN.js";import"./ChevronLeft-QZNH5ck-.js";import"./DotsVertical-F-o-_a2z.js";import"./Globe01-Ckwe4UHh.js";import"./FilterLines-eS3dI9hB.js";import"./Star01-BUumId75.js";import"./Globe04-iXhOnFjr.js";import"./HardDrive-CNIST2bR.js";import"./LinkExternal01-BoVxtqR2.js";import"./Monitor01-DNvJhnf-.js";import"./Sun-42Xfv_Dc.js";import"./Palette-Bf6p_3g1.js";import"./Shield01-6X9Jy9--.js";import"./Stars01-BvvUaY8d.js";import"./Trash01-DDwxWuR_.js";import"./Upload01-CvwE1uG-.js";import"./User01-KLLrp_Cb.js";import"./Users01-BoxxsDP9.js";import"./XClose-CQQFXdbB.js";import"./Zap-D2QyQXL2.js";import"./mcp-oauth-BKEDlyVy.js";import"./badge-DySIiC0W.js";import"./hooks-fHAHvlgy.js";import"./decopilot-sse-pool-BiYcCf8O.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-ai-providers-CWY8hivp.js";import"./tab-id-BptcWVWa.js";import"./avatar-BVLQzOkg.js";import"./dialog-CbpDnZu8.js";import"./required-auth-layout-DJ9sUOZj.js";import"./use-org-sso-B6LnDpoK.js";import"./index-DUxlPTha.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(X,{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}=Xe({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,Z]=T.useState("json"),[ze,Le]=T.useState(!1);O&&!ze&&(Z("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:()=>Z("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:()=>Z("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)),Ze.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(X,{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(X,{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 Dn(){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(X,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(Yt,{})})}),s[0]=e):e=s[0],e}export{Dn as default};
|
|
1
|
+
import{c as y,j as t,B as F,i as X,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 Xe,G,t as Ze,e as ae,b2 as ke}from"./index-I8Uum3Jx.js";import{E as Ee}from"./empty-state-B-ezQrZT.js";import{u as et,a as Ae}from"./use-collections-KLUYE1x1.js";import{u as ce}from"./use-mcp-client-Bq9g8m5J.js";import{F as ne,a as tt,b as de,d as me}from"./form-CpFt_4sy.js";import{I as ue}from"./input-CutcETvq.js";import{T as re}from"./textarea-CvR7iHW3.js";import{a as st,b as nt,V as xe,O as ot,M as lt}from"./index-BwC0cAdP.js";import{ah as rt,x as it,a6 as at,ai as ct,a2 as dt,aj as mt,M as be}from"./agent-icon-B2N3zGQH.js";import{g as ut,M as xt,a as Ne}from"./types-pQkRXbdZ.js";import{A as pt,a as ft,b as ht}from"./alert-Cg3WXwSx.js";import{d as ve,b as Se,c as ye,S as we,a as oe}from"./select-CeO9pIG_.js";import{c as gt,T as Ce,a as Ie,b as $e}from"./tooltip-Cs84Kx7a.js";import{i as jt}from"./AlertCircle-VcwplCRi.js";import{s as bt}from"./Stars02-PPXsboxW.js";import{a as Nt}from"./Eye-BSiFxHQB.js";import{i as vt}from"./Play-BDoh8EAp.js";import{i as St}from"./ChevronRight-oz8o6WPV.js";import{g as yt}from"./connection-slug-eyAPH6o3.js";import{u as wt,T as Ct}from"./index-JhgoGL0k.js";import{a as Oe,u as Re}from"./use-connection-BcZ8SPdu.js";import{a as It}from"./use-mcp-tools-LraQQ1bu.js";import{c as $t}from"./content-blocks-o63cs2vh.js";import{I as Te}from"./integration-icon-D3W1euXX.js";import{f as Tt,h as Pt}from"./chat-context-Bspy4m-d.js";import{b as kt}from"./shell-layout-BgovnITR.js";import{M as Et}from"./monaco-editor-x5JEAvo5.js";import{n as At}from"./XCircle-PlbEvjyp.js";import"./auth-DZDiXt1m.js";import"./label-DtGUWURu.js";import"./index-BU8Nad-n.js";import"./sidebar-BNKGZwsk.js";import"./LayoutLeft-BFxGsVdk.js";import"./use-mobile-C0mpADhR.js";import"./sheet-CaSXRGPU.js";import"./X-D7X7Z50V.js";import"./ZoomOut-DxqRFWA_.js";import"./Key01-r6MDYdDw.js";import"./extract-connection-data-BaXkJtVr.js";import"./use-registry-connections-d6Abj3O4.js";import"./use-organization-settings-oh1iUWuA.js";import"./studio-tools-bjPFQfXc.js";import"./Plus-Bw9lc6SR.js";import"./index-DUdLsOJu.js";import"./index-BLMNER8l.js";import"./popover-C8AJAJSa.js";import"./use-virtual-mcp-C5aoCVVQ.js";import"./ChevronUp-HJUE3-BD.js";import"./SearchMd-BMfw7gZ4.js";import"./Users03-CL71IAQ8.js";import"./use-create-virtual-mcp-BUg1GOjA.js";import"./use-navigate-to-agent-CRQ9sIAj.js";import"./Tool01-DvTGD1Yt.js";import"./SwitchHorizontal01-F_1MjTR3.js";import"./Settings02-DbH9OAzT.js";import"./ArrowUpRight-CAv7CUnJ.js";import"./ZapSquare-CvkoTQDM.js";import"./CheckCircle-V30FMM2D.js";import"./ChevronDown-URo4LveF.js";import"./ChevronLeft-aMkPes9N.js";import"./DotsVertical-QF46dzdi.js";import"./Globe01-wGomueqV.js";import"./FilterLines-CEzORaPw.js";import"./Star01-BwAv907s.js";import"./Globe04-CsKOsQ4z.js";import"./HardDrive-BuI4Q48l.js";import"./LinkExternal01-BWnRnxGs.js";import"./Monitor01-SEZLDRFN.js";import"./Sun-Dw86eVev.js";import"./Palette-CEjENuG4.js";import"./Shield01-C1R4fpvK.js";import"./Stars01-D1icdaCh.js";import"./Trash01-d58N8w5a.js";import"./Upload01-C_hHbDSF.js";import"./User01-BDtU1dk1.js";import"./Users01-PX3eYoC8.js";import"./XClose-BbuWQhNb.js";import"./Zap-BQKeuD4l.js";import"./mcp-oauth-CSZ5TVrK.js";import"./badge-toKsUzoB.js";import"./hooks-BAG9TZjZ.js";import"./decopilot-sse-pool-TIer_srZ.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-ai-providers-BgadC07_.js";import"./tab-id-BptcWVWa.js";import"./avatar-Dv3IrttI.js";import"./dialog-CxQBoX40.js";import"./required-auth-layout-BFGUeccA.js";import"./use-org-sso-HWNvOeDC.js";import"./index-DPI_0XE-.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(X,{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}=Xe({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,Z]=T.useState("json"),[ze,Le]=T.useState(!1);O&&!ze&&(Z("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:()=>Z("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:()=>Z("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)),Ze.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(X,{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(X,{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 Dn(){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(X,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(Yt,{})})}),s[0]=e):e=s[0],e}export{Dn 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-I8Uum3Jx.js";import{c as z,a as _,b as $,D as E}from"./dropdown-menu-5CWPgj7f.js";import{a as L,n as O,d as R,i as A,c as F}from"./SwitchHorizontal01-F_1MjTR3.js";import{i as S}from"./ChevronUp-HJUE3-BD.js";import{a as I,b as K,c as P,T as W}from"./tooltip-Cs84Kx7a.js";import{V as q}from"./view-mode-toggle-DTMt6lCZ.js";import{B as G}from"./badge-toKsUzoB.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-I8Uum3Jx.js";import{i as C}from"./SearchMd-BMfw7gZ4.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-I8Uum3Jx.js";import{B as g}from"./badge-toKsUzoB.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-I8Uum3Jx.js";import{_ as m}from"./index-BLMNER8l.js";import{a as k,d as N,e as j,c as b,b as w}from"./dialog-CxQBoX40.js";import{i as y}from"./SearchMd-BMfw7gZ4.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-Dg7vjIhZ.js → commerce-onboarding-Cv30K_3D.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as k,r as D,l as Z,j as n,B as H,m as ut,d as ke,K as W,o as He,s as ue,n as Be,p as Ge,i as ft,k as pt,q as me,Q as gt,E as ht,a as Oe,u as xt,v as Ot,w as Ut,b as yt,x as At,y as vt,L as Rt}from"./index-DVyj5fuq.js";import{A as Pt}from"./auth-entry-_k3gk7s2.js";import{A as $t}from"./auth-split-layout-bCFbyvYe.js";import{O as at}from"./organization-choice-CoeFbp4N.js";import{f as Lt}from"./tab-id-BptcWVWa.js";import{I as Ue}from"./input-GyW6rRcJ.js";import{u as Ae,W as bt,S as jt,g as zt,C as Dt}from"./use-mcp-client-fdcDDNuq.js";import{i as Ct}from"./XCircle-CkFuQ7IG.js";import{I as St}from"./integration-icon-BtlW6ioP.js";import{D as Qe,a as Kt,b as Mt,c as Ft,d as qt,e as Vt}from"./dialog-CbpDnZu8.js";import{T as Ht,a as Bt,b as Gt}from"./tooltip-3uKRhKGc.js";import{i as We}from"./CheckCircle-Do934x7B.js";import{i as Qt}from"./ZoomOut-CGeRz2Xe.js";import{g as Wt,c as Yt,e as Jt}from"./extract-connection-data-DVGeC9AU.js";import{F as fe,a as Ye,b as pe,c as Ke,d as ge,e as he}from"./form-HH5S6Yti.js";import{i as Zt}from"./ChevronUp-CUesWqmK.js";import{s as Xt,a as en}from"./Eye-FmUDnTHn.js";import{i as tn}from"./Settings02-k7X7M16V.js";import{i as nn}from"./agent-icon-AqXPfJak.js";import{u as sn}from"./useSuspenseQueries-CKrSo39Z.js";import{a as on}from"./authenticate-and-persist-oauth-DBMlTO0L.js";import{i as Nt}from"./ArrowUpRight-KPaHD_ZU.js";import{s as _t}from"./User01-KLLrp_Cb.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./avatar-BVLQzOkg.js";import"./auth-DhQO5_HB.js";import"./X-D5odjFOj.js";import"./label-DZS4CYvt.js";import"./AlertCircle-kcMUHNYP.js";import"./Tool01-DKUGTxge.js";import"./SwitchHorizontal01-BeteqXsq.js";import"./ZapSquare-DWfiiAgK.js";import"./Users03-Cnldjgk9.js";import"./ChevronDown-DJ5SHmhN.js";import"./ChevronLeft-QZNH5ck-.js";import"./ChevronRight-BXEszS6k.js";import"./DotsVertical-F-o-_a2z.js";import"./Stars02-f3tbtjbB.js";import"./Globe01-Ckwe4UHh.js";import"./FilterLines-eS3dI9hB.js";import"./Star01-BUumId75.js";import"./Globe04-iXhOnFjr.js";import"./HardDrive-CNIST2bR.js";import"./Key01-wlyPB5nN.js";import"./LayoutLeft-C_wbh4sE.js";import"./LinkExternal01-BoVxtqR2.js";import"./Monitor01-DNvJhnf-.js";import"./Sun-42Xfv_Dc.js";import"./Palette-Bf6p_3g1.js";import"./Play-D6BtU9Uh.js";import"./Plus-8zBKSNee.js";import"./SearchMd-57vTBUjU.js";import"./Shield01-6X9Jy9--.js";import"./Stars01-BvvUaY8d.js";import"./Trash01-DDwxWuR_.js";import"./Upload01-CvwE1uG-.js";import"./Users01-BoxxsDP9.js";import"./XClose-CQQFXdbB.js";import"./Zap-D2QyQXL2.js";import"./mcp-oauth-BKEDlyVy.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(i){const e=i.trim();if(!e)return{ok:!1,error:"Enter a website URL."};const t=rn.test(e),s=an.test(e),o=ln.test(e);if(t&&!s&&!o)return{ok:!1,error:"Use an HTTP or HTTPS website URL."};const l=s?e:`https://${e}`;let r;try{r=new URL(l)}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 c=r.hostname.split(".");return c.length<2||c.some(a=>!a||!cn.test(a))?{ok:!1,error:"Enter a valid website URL."}:(r.protocol="https:",{ok:!0,value:r.origin})}function Fe(i){const e=k.c(14),{children:t,className:s,wrapperClassName:o}=i,[l,r]=D.useState(!0);let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=j=>{if(!j)return;const x=()=>{const m=j.scrollHeight-j.scrollTop-j.clientHeight<8;r(m)};x(),j.addEventListener("scroll",x,{passive:!0});const g=new ResizeObserver(x);g.observe(j);for(const m of Array.from(j.children))g.observe(m);return()=>{j.removeEventListener("scroll",x),g.disconnect()}},e[0]=c):c=e[0];const a=c;let u;e[1]!==o?(u=Z("relative",o),e[1]=o,e[2]=u):u=e[2];let f;e[3]!==t||e[4]!==s?(f=n.jsx("div",{ref:a,className:s,children:t}),e[3]=t,e[4]=s,e[5]=f):f=e[5];const p=l?"opacity-0":"opacity-100";let d;e[6]!==p?(d=Z("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]!==u||e[11]!==f||e[12]!==h?(v=n.jsxs("div",{className:u,children:[f,h]}),e[10]=u,e[11]=f,e[12]=h,e[13]=v):v=e[13],v}function dn(i){const e=i.properties;if(!e)return[];const t=[];for(const[s,o]of Object.entries(e)){const c=o?.properties?.__type?.const;typeof c=="string"&&c.length>0&&t.push({fieldKey:s,bindingType:c})}return t}function mn(i,e){const t=[];if(i.length&&t.push({field:["id"],operator:"in",value:i}),e.length&&t.push({field:["name"],operator:"in",value:e}),t.length!==0)return t.length===1?t[0]:{operator:"or",conditions:t}}function J(i){const e=i;if(e.isError)throw new Error(e.content?.find(t=>t.text)?.text??"Tool call failed");return e.structuredContent??i}function un(i,e,t,s){return{...i??{},[e]:{__type:t,value:s}}}function qe(i){return i==null?!1:typeof i=="string"?i.trim().length>0:typeof i=="number"||typeof i=="boolean"?!0:Array.isArray(i)?i.some(qe):typeof i=="object"?Object.entries(i).some(([e,t])=>!e.startsWith("__")&&qe(t)):!1}function fn(i){const e={accountName:"Nome da conta",appKey:"App Key",appToken:"App Token",propertyId:"Propriedade",siteUrl:"Site"};return e[i]?e[i]:i.replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/\b\w/g,t=>t.toUpperCase())}function pn(i){return qe(i)?typeof i=="string"?i.trim():typeof i=="number"||typeof i=="boolean"?String(i):JSON.stringify(i):null}function gn(i){return i?Object.entries(i).flatMap(([e,t])=>{if(e.startsWith("__"))return[];const s=pn(t);return s?[{key:e,label:fn(e),value:s}]:[]}):[]}function hn({autoOpenFieldKey:i,card:e}){return i===e.fieldKey&&e.satisfied&&!!e.linkedConnectionId}function xn(i,e,t){const s=i.filter(o=>o.app_name===e||!!t&&o.app_id===t);return s.length===0?null:(s.sort((o,l)=>{const r=c=>c.status==="active"?0:1;return r(o)!==r(l)?r(o)-r(l):(l.updated_at??"").localeCompare(o.updated_at??"")}),s[0].id)}function yn(i){return i.server?.icons?.[0]?.src??Wt(i.server?.repository)??null}function vn(i,e){const t=i._meta?.["mcp.mesh"];return t?.friendlyName||t?.friendly_name||i.title||i.server?.title||i.server?.name||e}function bn(i){const e=[],t=new Map(i.connections.map(s=>[s.id,s]));for(const s of i.requirements){const o=i.curated[s.bindingType],l=o?i.itemsById[o.registryAppId]:i.itemsByName[s.bindingType];if(!l)continue;const r=i.configurationState?.[s.fieldKey]?.value,c=r?t.get(r):void 0,a=r&&c?r:null,u=a?i.connectionReadiness?.[a]!==!1:!1,f=!!a&&u;e.push({fieldKey:s.fieldKey,bindingType:s.bindingType,registryItem:l,title:vn(l,s.bindingType),icon:yn(l),headline:o?.headline??l._meta?.["mcp.mesh"]?.short_description??null,checks:o?.checks??null,bullets:o?.bullets??[],satisfied:f,candidateConnectionId:f?null:a||xn(i.connections,s.bindingType,o?.registryAppId),linkedConnectionId:a,configurationState:c?.configuration_state??null})}return e}function jn(i,e){if(!i)return null;const t=o=>{if(o.startsWith("sc-domain:"))return o.substring(10);try{let r=new URL(o.startsWith("http")?o:`https://${o}`).hostname||"";return r.startsWith("www.")&&(r=r.substring(4)),r}catch{return o}},s=t(i);for(const o of e)if(t(o.siteUrl)===s)return o.siteUrl;return null}function Cn(i){return(i?.response?.accountSummaries??[]).map(s=>({account:s.account,options:(s.propertySummaries??[]).map(o=>({value:o.property,label:`${o.displayName} (${s.displayName})`}))}))}function lt(i){const e=k.c(38);let t,s,o,l,r;e[0]!==i?({value:r,onChange:s,placeholder:o,className:t,...l}=i,e[0]=i,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[c,a]=D.useState(!1),[u,f]=D.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]!==c?(h=()=>{a(!c)},e[8]=c,e[9]=h):h=e[9];const v=h,j=c?"text":"password";let x;e[10]!==t?(x=Z("pr-20",t),e[10]=t,e[11]=x):x=e[11];let g;e[12]!==s||e[13]!==o||e[14]!==l||e[15]!==j||e[16]!==x||e[17]!==r?(g=n.jsx(Ue,{type:j,value:r,onChange:s,placeholder:o,className:x,...l}),e[12]=s,e[13]=o,e[14]=l,e[15]=j,e[16]=x,e[17]=r,e[18]=g):g=e[18];const m=c?"Hide password":"Show password";let b;e[19]!==c?(b=c?n.jsx(tn,{size:16}):n.jsx(Xt,{size:16}),e[19]=c,e[20]=b):b=e[20];let y;e[21]!==m||e[22]!==b||e[23]!==v?(y=n.jsx(H,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:v,title:m,children:b}),e[21]=m,e[22]=b,e[23]=v,e[24]=y):y=e[24];const S=!r,_=u?"Copied!":"Copy token";let N;e[25]!==u?(N=u?n.jsx(Zt,{size:16}):n.jsx(en,{size:16}),e[25]=u,e[26]=N):N=e[26];let w;e[27]!==d||e[28]!==_||e[29]!==N||e[30]!==S?(w=n.jsx(H,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:d,disabled:S,title:_,children:N}),e[27]=d,e[28]=_,e[29]=N,e[30]=S,e[31]=w):w=e[31];let E;e[32]!==w||e[33]!==y?(E=n.jsxs("div",{className:"absolute right-1 top-1 flex items-center gap-1 h-8",children:[y,w]}),e[32]=w,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 Je(i){const e=k.c(19),{card:t,selfClient:s,org:o,onDone:l,onError:r}=i,c=ut();let a;e[0]!==t||e[1]!==s?(a=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]=a):a=e[2];let u;e[3]!==l||e[4]!==o||e[5]!==c?(u=async()=>{await c.invalidateQueries({queryKey:W.commerceDiscoveryCompanionConnectionsPrefix(o.id)}),l()},e[3]=l,e[4]=o,e[5]=c,e[6]=u):u=e[6];let f;e[7]!==r?(f=x=>{r?.(x)},e[7]=r,e[8]=f):f=e[8];let p;e[9]!==a||e[10]!==u||e[11]!==f?(p={mutationFn:a,onSuccess:u,onError:f},e[9]=a,e[10]=u,e[11]=f,e[12]=p):p=e[12];const d=ke(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 Sn=He({accountName:ue().min(1,"Informe o nome da conta"),appKey:ue().optional(),appToken:ue().optional()});function Nn(i){const e=k.c(63),{card:t,selfClient:s,org:o,onDone:l,onIsPendingChange:r}=i;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=Be(Sn),e[0]=c):c=e[0];const a=t.configurationState?.accountName||"",u=t.configurationState?.appKey||"",f=t.configurationState?.appToken||"";let p;e[1]!==a||e[2]!==u||e[3]!==f?(p={resolver:c,defaultValues:{accountName:a,appKey:u,appToken:f}},e[1]=a,e[2]=u,e[3]=f,e[4]=p):p=e[4];const d=Ge(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],D.useEffect(h,v);let j;e[13]!==t||e[14]!==l||e[15]!==o||e[16]!==s?(j={card:t,selfClient:s,org:o,onDone:l},e[13]=t,e[14]=l,e[15]=o,e[16]=s,e[17]=j):j=e[17];const{save:x,isPending:g,error:m}=Je(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]),D.useEffect(y,b);let S;if(e[22]!==d||e[23]!==x){let K;e[25]!==x?(K=async C=>{x(C)},e[25]=x,e[26]=K):K=e[26],S=d.handleSubmit(K),e[22]=d,e[23]=x,e[24]=S}else S=e[24];const _=S;let N;e[27]!==g?(N=K=>{const{field:C}=K;return n.jsxs(pe,{children:[n.jsx(Ke,{children:"Nome da conta"}),n.jsx(ge,{children:n.jsx(Ue,{placeholder:"Nome da sua conta VTEX",...C,disabled:g})}),n.jsx(he,{})]})},e[27]=g,e[28]=N):N=e[28];let w;e[29]!==d.control||e[30]!==N?(w=n.jsx(fe,{control:d.control,name:"accountName",render:N}),e[29]=d.control,e[30]=N,e[31]=w):w=e[31];let E;e[32]!==g?(E=K=>{const{field:C}=K;return n.jsxs(pe,{children:[n.jsx(Ke,{children:"App Key (opcional)"}),n.jsx(ge,{children:n.jsx(lt,{placeholder:"App Key da VTEX",...C,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?($=K=>{const{field:C}=K;return n.jsxs(pe,{children:[n.jsx(Ke,{children:"App Token (opcional)"}),n.jsx(ge,{children:n.jsx(lt,{placeholder:"App Token da VTEX",...C,disabled:g})}),n.jsx(he,{})]})},e[37]=g,e[38]=$):$=e[38];let O;e[39]!==d.control||e[40]!==$?(O=n.jsx(fe,{control:d.control,name:"appToken",render:$}),e[39]=d.control,e[40]=$,e[41]=O):O=e[41];let T;e[42]!==d||e[43]!==w||e[44]!==I||e[45]!==O?(T=n.jsxs(Ye,{...d,children:[w,I,O]}),e[42]=d,e[43]=w,e[44]=I,e[45]=O,e[46]=T):T=e[46];let U;e[47]!==m?(U=m&&n.jsx("p",{role:"alert",className:"text-sm text-destructive",children:m instanceof Error?m.message:"Não foi possível salvar a configuração"}),e[47]=m,e[48]=U):U=e[48];let P;e[49]!==g||e[50]!==l?(P=n.jsx(H,{type:"button",variant:"outline",onClick:l,disabled:g,children:"Cancelar"}),e[49]=g,e[50]=l,e[51]=P):P=e[51];const M=g?"Salvando...":"Salvar";let q;e[52]!==g||e[53]!==M?(q=n.jsx(H,{type:"submit",disabled:g,children:M}),e[52]=g,e[53]=M,e[54]=q):q=e[54];let z;e[55]!==P||e[56]!==q?(z=n.jsxs(Qe,{className:"pt-4",children:[P,q]}),e[55]=P,e[56]=q,e[57]=z):z=e[57];let F;return e[58]!==_||e[59]!==T||e[60]!==U||e[61]!==z?(F=n.jsxs("form",{onSubmit:_,className:"space-y-4",children:[T,U,z]}),e[58]=_,e[59]=T,e[60]=U,e[61]=z,e[62]=F):F=e[62],F}function Et(i){const e=k.c(30),{options:t,value:s,onChange:o,disabled:l,ariaLabel:r,searchPlaceholder:c}=i,a=c===void 0?"Buscar...":c,[u,f]=D.useState("");let p,d,h;if(e[0]!==t||e[1]!==u||e[2]!==s){const w=u.trim().toLowerCase();p=w?t.filter(E=>E.label.toLowerCase().includes(w)):t,d=p.map(_n),h=d.includes(s)?s:d[0]??"",e[0]=t,e[1]=u,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]!==l||e[7]!==d||e[8]!==o?(j=function(E){if(l||!["ArrowDown","ArrowRight","ArrowUp","ArrowLeft","Home","End"].includes(E.key))return;E.preventDefault();const $=E.currentTarget.dataset.value,O=d.indexOf($),T=d.length;if(T===0)return;let U;E.key==="ArrowDown"||E.key==="ArrowRight"?U=(O+1)%T:E.key==="ArrowUp"||E.key==="ArrowLeft"?U=(O-1+T)%T:E.key==="Home"?U=0:U=T-1;const P=d[U];o(P),E.currentTarget.closest('[role="radiogroup"]')?.querySelector(`[data-value="${CSS.escape(P)}"]`)?.focus()},e[6]=l,e[7]=d,e[8]=o,e[9]=j):j=e[9];const x=j;let g;e[10]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(nn,{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 m;e[11]===Symbol.for("react.memo_cache_sentinel")?(m=w=>f(w.target.value),e[11]=m):m=e[11];const b=`Buscar ${r}`;let y;e[12]!==l||e[13]!==u||e[14]!==a||e[15]!==b?(y=n.jsxs("div",{className:"relative",children:[g,n.jsx(Ue,{type:"text",value:u,onChange:m,disabled:l,placeholder:a,"aria-label":b,className:"h-8 pl-8"})]}),e[12]=l,e[13]=u,e[14]=a,e[15]=b,e[16]=y):y=e[16];let S;e[17]!==l||e[18]!==p||e[19]!==x||e[20]!==o||e[21]!==v||e[22]!==s?(S=p.length===0?n.jsx("div",{className:"px-2 py-2 text-sm text-muted-foreground",children:"Nenhum resultado"}):p.map(w=>{const E=w.value===s;return n.jsxs("button",{type:"button",role:"radio","aria-checked":E,disabled:l,"data-value":w.value,tabIndex:w.value===v?0:-1,onClick:()=>o(w.value),onKeyDown:x,className:Z("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:w.label}),E?n.jsx(We,{size:16,className:"shrink-0 text-primary"}):null]},w.value)}),e[17]=l,e[18]=p,e[19]=x,e[20]=o,e[21]=v,e[22]=s,e[23]=S):S=e[23];let _;e[24]!==r||e[25]!==S?(_=n.jsx("div",{role:"radiogroup","aria-label":r,className:"max-h-[280px] overflow-y-auto",children:S}),e[24]=r,e[25]=S,e[26]=_):_=e[26];let N;return e[27]!==y||e[28]!==_?(N=n.jsxs("div",{className:"space-y-2",children:[y,_]}),e[27]=y,e[28]=_,e[29]=N):N=e[29],N}function _n(i){return i.value}function Ze(i){const e=k.c(16),{label:t,iconSize:s,className:o,iconClassName:l,labelClassName:r}=i,c=s===void 0?14:s;let a;e[0]!==o?(a=Z("inline-flex items-center gap-2",o),e[0]=o,e[1]=a):a=e[1];let u;e[2]!==l?(u=Z("shrink-0 animate-spin",l),e[2]=l,e[3]=u):u=e[3];let f;e[4]!==c||e[5]!==u?(f=n.jsx(ft,{size:c,className:u}),e[4]=c,e[5]=u,e[6]=f):f=e[6];let p;e[7]!==r?(p=Z("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]!==a||e[13]!==f||e[14]!==d?(h=n.jsxs("span",{className:a,children:[f,d]}),e[12]=a,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(i){const e=k.c(55),{card:t,connectionId:s,companionClient:o,selfClient:l,org:r,onDone:c,onIsPendingChange:a}=i;let u;e[0]!==s||e[1]!==r.id?(u=W.commerceDiscoveryCompanionGaProperties(r.id,s),e[0]=s,e[1]=r.id,e[2]=u):u=e[2];let f;e[3]!==o?(f=async()=>{const C=await o.callTool({name:"get-account-summaries",arguments:{}}),L=J(C);return Cn(L)},e[3]=o,e[4]=f):f=e[4];let p;e[5]!==u||e[6]!==f?(p={queryKey:u,queryFn:f},e[5]=u,e[6]=f,e[7]=p):p=e[7];const d=pt(p);let h;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=Be(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=Ge(j);let g;e[11]!==t||e[12]!==c||e[13]!==r||e[14]!==l?(g={card:t,selfClient:l,org:r,onDone:c},e[11]=t,e[12]=c,e[13]=r,e[14]=l,e[15]=g):g=e[15];const{save:m,isPending:b,error:y}=Je(g);let S,_;e[16]!==b||e[17]!==a?(S=()=>{a?.(b)},_=[b,a],e[16]=b,e[17]=a,e[18]=S,e[19]=_):(S=e[18],_=e[19]),D.useEffect(S,_);let N;if(e[20]!==x||e[21]!==m){let C;e[23]!==m?(C=async L=>{m(L)},e[23]=m,e[24]=C):C=e[24],N=x.handleSubmit(C),e[20]=x,e[21]=m,e[22]=N}else N=e[22];const w=N;if(d.isLoading){let C;return e[25]===Symbol.for("react.memo_cache_sentinel")?(C=n.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:n.jsx(Ze,{label:"Carregando propriedades..."})}),e[25]=C):C=e[25],C}if(d.isError){let C;return e[26]===Symbol.for("react.memo_cache_sentinel")?(C=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]=C):C=e[26],C}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 C;return e[29]===Symbol.for("react.memo_cache_sentinel")?(C=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]=C):C=e[29],C}let O;e[30]!==b||e[31]!==I?(O=C=>{const{field:L}=C;return n.jsxs(pe,{children:[n.jsx(ge,{children:n.jsx(Et,{options:I.flatMap(Tn),value:L.value,onChange:L.onChange,disabled:b,ariaLabel:"Propriedade do Google Analytics"})}),n.jsx(he,{})]})},e[30]=b,e[31]=I,e[32]=O):O=e[32];let T;e[33]!==x.control||e[34]!==O?(T=n.jsx(fe,{control:x.control,name:"propertyId",render:O}),e[33]=x.control,e[34]=O,e[35]=T):T=e[35];let U;e[36]!==x||e[37]!==T?(U=n.jsx(Ye,{...x,children:T}),e[36]=x,e[37]=T,e[38]=U):U=e[38];let P;e[39]!==y?(P=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]=P):P=e[40];let M;e[41]!==b||e[42]!==c?(M=n.jsx(H,{type:"button",variant:"outline",onClick:c,disabled:b,children:"Cancelar"}),e[41]=b,e[42]=c,e[43]=M):M=e[43];const q=b?"Salvando...":"Salvar";let z;e[44]!==b||e[45]!==q?(z=n.jsx(H,{type:"submit",disabled:b,children:q}),e[44]=b,e[45]=q,e[46]=z):z=e[46];let F;e[47]!==M||e[48]!==z?(F=n.jsxs(Qe,{className:"pt-4",children:[M,z]}),e[47]=M,e[48]=z,e[49]=F):F=e[49];let K;return e[50]!==w||e[51]!==U||e[52]!==P||e[53]!==F?(K=n.jsxs("form",{onSubmit:w,className:"space-y-4",children:[U,P,F]}),e[50]=w,e[51]=U,e[52]=P,e[53]=F,e[54]=K):K=e[54],K}function Tn(i){return i.options}function In(i){return i.options}const kn=He({siteUrl:ue().min(1,"Selecione um site")});function On(i){const e=k.c(59),{card:t,connectionId:s,companionClient:o,selfClient:l,org:r,contextSiteUrl:c,onDone:a,onIsPendingChange:u}=i;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]!==o?(p=async()=>{const C=await o.callTool({name:"list_sites",arguments:{}});return J(C).sites||[]},e[3]=o,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=pt(d);let v;e[8]===Symbol.for("react.memo_cache_sentinel")?(v=Be(kn),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=Ge(x);let m;e[11]!==t||e[12]!==a||e[13]!==r||e[14]!==l?(m={card:t,selfClient:l,org:r,onDone:a},e[11]=t,e[12]=a,e[13]=r,e[14]=l,e[15]=m):m=e[15];const{save:b,isPending:y,error:S}=Je(m);let _,N;e[16]!==y||e[17]!==u?(_=()=>{u?.(y)},N=[y,u],e[16]=y,e[17]=u,e[18]=_,e[19]=N):(_=e[18],N=e[19]),D.useEffect(_,N);let w;if(e[20]!==g||e[21]!==b){let C;e[23]!==b?(C=async L=>{b(L)},e[23]=b,e[24]=C):C=e[24],w=g.handleSubmit(C),e[20]=g,e[21]=b,e[22]=w}else w=e[22];const E=w;if(h.isLoading){let C;return e[25]===Symbol.for("react.memo_cache_sentinel")?(C=n.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:n.jsx(Ze,{label:"Carregando sites..."})}),e[25]=C):C=e[25],C}if(h.isError){let C;return e[26]===Symbol.for("react.memo_cache_sentinel")?(C=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]=C):C=e[26],C}let I,$;if(e[27]!==t.configurationState?.siteUrl||e[28]!==c||e[29]!==g||e[30]!==h.data){$=Symbol.for("react.early_return_sentinel");e:{if(I=h.data||[],I.length===0){let L;e[33]===Symbol.for("react.memo_cache_sentinel")?(L=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]=L):L=e[33],$=L;break e}const C=t.configurationState?.siteUrl;if(C&&g.getValues("siteUrl")!==C)g.setValue("siteUrl",C);else if(!C&&!g.getValues("siteUrl")){const L=jn(c,I);L&&g.setValue("siteUrl",L)}}e[27]=t.configurationState?.siteUrl,e[28]=c,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 O;e[34]!==y||e[35]!==I?(O=C=>{const{field:L}=C;return n.jsxs(pe,{children:[n.jsx(ge,{children:n.jsx(Et,{options:I.map(Un),value:L.value,onChange:L.onChange,disabled:y,ariaLabel:"Site verificado"})}),n.jsx(he,{})]})},e[34]=y,e[35]=I,e[36]=O):O=e[36];let T;e[37]!==g.control||e[38]!==O?(T=n.jsx(fe,{control:g.control,name:"siteUrl",render:O}),e[37]=g.control,e[38]=O,e[39]=T):T=e[39];let U;e[40]!==g||e[41]!==T?(U=n.jsx(Ye,{...g,children:T}),e[40]=g,e[41]=T,e[42]=U):U=e[42];let P;e[43]!==S?(P=S&&n.jsx("p",{role:"alert",className:"text-sm text-destructive",children:S instanceof Error?S.message:"Não foi possível salvar a configuração"}),e[43]=S,e[44]=P):P=e[44];let M;e[45]!==y||e[46]!==a?(M=n.jsx(H,{type:"button",variant:"outline",onClick:a,disabled:y,children:"Cancelar"}),e[45]=y,e[46]=a,e[47]=M):M=e[47];const q=y?"Salvando...":"Salvar";let z;e[48]!==y||e[49]!==q?(z=n.jsx(H,{type:"submit",disabled:y,children:q}),e[48]=y,e[49]=q,e[50]=z):z=e[50];let F;e[51]!==M||e[52]!==z?(F=n.jsxs(Qe,{className:"pt-4",children:[M,z]}),e[51]=M,e[52]=z,e[53]=F):F=e[53];let K;return e[54]!==E||e[55]!==U||e[56]!==P||e[57]!==F?(K=n.jsxs("form",{onSubmit:E,className:"space-y-4",children:[U,P,F]}),e[54]=E,e[55]=U,e[56]=P,e[57]=F,e[58]=K):K=e[58],K}function Un(i){return{value:i.siteUrl,label:i.siteUrl}}const An={vtex:Nn,"google-analytics":wn,"google-search-console":On};function Rn(){const i=k.c(3);let e;i[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:"size-9 shrink-0 animate-pulse rounded-lg bg-muted/60"}),n.jsx("div",{className:"h-4 w-32 animate-pulse rounded bg-muted/60"}),n.jsx("div",{className:"ml-auto h-8 w-20 animate-pulse rounded-lg bg-muted/60"})]}),i[0]=e):e=i[0];let t;i[1]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx("div",{className:"p-1",children:n.jsx("div",{className:"h-5 w-40 animate-pulse rounded bg-muted/60"})}),i[1]=t):t=i[1];let s;return i[2]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsxs("div",{className:"flex flex-col gap-2 rounded-2xl border border-border bg-card p-4",children:[e,n.jsxs("div",{className:"flex flex-col gap-1 px-1 py-2",children:[t,n.jsx("div",{className:"p-1",children:n.jsx("div",{className:"h-5 w-56 animate-pulse rounded bg-muted/60"})})]})]}),i[2]=s):s=i[2],s}function Ve(i){const e=k.c(3),{children:t}=i;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(We,{size:14,className:"shrink-0 text-blue-500"}),e[0]=s):s=e[0];let o;return e[1]!==t?(o=n.jsxs("div",{className:"flex items-center gap-2 p-1",children:[s,n.jsx("p",{className:"text-sm text-foreground",children:t})]}),e[1]=t,e[2]=o):o=e[2],o}function Pn(i){const e=k.c(45),{card:t,connecting:s,disabled:o,onConnect:l,org:r,selfClient:c,siteUrl:a,autoOpenConfigFieldKey:u,onAutoOpenConfigHandled:f}=i,p=t.linkedConnectionId;let d;e[0]!==t.configurationState?(d=gn(t.configurationState),e[0]=t.configurationState,e[1]=d):d=e[1];const h=d;let v;e[2]!==t.icon||e[3]!==t.title?(v=n.jsx(St,{icon:t.icon,name:t.title,size:"sm",fit:"contain",className:"p-1.5"}),e[2]=t.icon,e[3]=t.title,e[4]=v):v=e[4];let j;e[5]!==t.title?(j=n.jsx("p",{className:"flex-1 text-sm text-foreground",children:t.title}),e[5]=t.title,e[6]=j):j=e[6];let x;e[7]!==t.satisfied||e[8]!==t.title||e[9]!==s||e[10]!==o||e[11]!==l?(x=t.satisfied?n.jsxs("div",{className:"flex h-8 items-center gap-2 px-3 text-sm text-muted-foreground",children:[n.jsx(We,{size:16})," Conectado"]}):n.jsx(H,{type:"button",variant:"outline",size:"sm",disabled:o||s,onClick:l,"aria-label":`Conectar ${t.title}`,children:s?n.jsx(ft,{size:16,className:"animate-spin"}):"Conectar"}),e[7]=t.satisfied,e[8]=t.title,e[9]=s,e[10]=o,e[11]=l,e[12]=x):x=e[12];let g;e[13]!==v||e[14]!==j||e[15]!==x?(g=n.jsxs("div",{className:"flex items-center gap-2",children:[v,j,x]}),e[13]=v,e[14]=j,e[15]=x,e[16]=g):g=e[16];let m;e[17]!==t.checks?(m=t.checks!==null&&n.jsxs(Ve,{children:["+ ",t.checks," verificações"]}),e[17]=t.checks,e[18]=m):m=e[18];let b;e[19]!==t.headline?(b=t.headline&&n.jsx(Ve,{children:t.headline}),e[19]=t.headline,e[20]=b):b=e[20];let y;e[21]!==t.bullets?(y=t.bullets.map($n),e[21]=t.bullets,e[22]=y):y=e[22];let S;e[23]!==t.candidateConnectionId||e[24]!==t.satisfied||e[25]!==t.title?(S=!t.satisfied&&t.candidateConnectionId&&n.jsxs("p",{className:"px-1 text-xs text-muted-foreground",children:["Usando sua conexão existente de ",t.title]}),e[23]=t.candidateConnectionId,e[24]=t.satisfied,e[25]=t.title,e[26]=S):S=e[26];let _;e[27]!==m||e[28]!==b||e[29]!==y||e[30]!==S?(_=n.jsxs("div",{className:"flex flex-col gap-1 px-1 py-2",children:[m,b,y,S]}),e[27]=m,e[28]=b,e[29]=y,e[30]=S,e[31]=_):_=e[31];let N;e[32]!==u||e[33]!==t||e[34]!==p||e[35]!==f||e[36]!==r||e[37]!==h||e[38]!==c||e[39]!==a?(N=t.satisfied&&p&&n.jsx(D.Suspense,{fallback:n.jsx(Dn,{}),children:n.jsx(Kn,{card:t,org:r,selfClient:c,connectionId:p,savedConfigEntries:h,contextSiteUrl:a,autoOpen:hn({autoOpenFieldKey:u,card:t}),onAutoOpenHandled:f})}),e[32]=u,e[33]=t,e[34]=p,e[35]=f,e[36]=r,e[37]=h,e[38]=c,e[39]=a,e[40]=N):N=e[40];let w;return e[41]!==_||e[42]!==N||e[43]!==g?(w=n.jsxs("div",{className:"flex flex-col gap-2 rounded-2xl border border-border bg-card p-4",children:[g,_,N]}),e[41]=_,e[42]=N,e[43]=g,e[44]=w):w=e[44],w}function $n(i){return n.jsx(Ve,{children:i},i)}function Ln(i,e){return/(token|secret|password|appKey|key)$/i.test(i)?"••••••••":e}function zn(i){const e=k.c(2),{title:t}=i;let s;return e[0]!==t?(s=n.jsx("div",{className:"grid gap-3 border-t border-border pt-3",children:n.jsxs("p",{className:"text-xs text-muted-foreground",children:["A configuração ainda não está disponível aqui para ",t,"."]})}),e[0]=t,e[1]=s):s=e[1],s}function Dn(){const i=k.c(1);let e;return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"grid gap-3 border-t border-border pt-3",children:n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsx("div",{className:"h-5 w-24 animate-pulse rounded bg-muted/60"}),n.jsx("div",{className:"h-8 w-20 animate-pulse rounded-lg bg-muted/60"})]})}),i[0]=e):e=i[0],e}function Kn(i){const e=k.c(41),{card:t,org:s,selfClient:o,connectionId:l,savedConfigEntries:r,contextSiteUrl:c,autoOpen:a,onAutoOpenHandled:u}=i;let f;e[0]!==l||e[1]!==s.id||e[2]!==s.slug?(f={connectionId:l,orgId:s.id,orgSlug:s.slug},e[0]=l,e[1]=s.id,e[2]=s.slug,e[3]=f):f=e[3];const p=Ae(f),[d,h]=D.useState(a),[v,j]=D.useState(!1),x=An[t.bindingType];let g;e[4]!==a||e[5]!==u?(g=()=>{h(!1),a&&u()},e[4]=a,e[5]=u,e[6]=g):g=e[6];const m=g;let b;e[7]!==m||e[8]!==v?(b=U=>{if(!(!U&&v)){if(!U){m();return}h(!0)}},e[7]=m,e[8]=v,e[9]=b):b=e[9];const y=b;let S;e[10]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx("p",{className:"text-sm font-medium text-foreground",children:"Configuração"}),e[10]=S):S=e[10];let _;e[11]!==r.length?(_=r.length===0&&n.jsx("p",{className:"text-xs text-muted-foreground",children:"Nenhum valor de configuração foi salvo ainda."}),e[11]=r.length,e[12]=_):_=e[12];let N;e[13]!==_?(N=n.jsxs("div",{className:"grid gap-1",children:[S,_]}),e[13]=_,e[14]=N):N=e[14];let w;e[15]!==x||e[16]!==t.title||e[17]!==r.length?(w=r.length>0?n.jsxs(Ht,{children:[n.jsx(Bt,{asChild:!0,children:n.jsx(H,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>h(!0),"aria-label":`Editar configuração de ${t.title}`,disabled:!x,children:n.jsx(Qt,{size:14})})}),n.jsx(Gt,{children:"Editar configuração"})]}):n.jsx(H,{type:"button",variant:"outline",size:"sm",onClick:()=>h(!0),disabled:!x,children:"Configurar"}),e[15]=x,e[16]=t.title,e[17]=r.length,e[18]=w):w=e[18];let E;e[19]!==N||e[20]!==w?(E=n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[N,w]}),e[19]=N,e[20]=w,e[21]=E):E=e[21];let I;e[22]!==r?(I=r.length>0&&n.jsx("dl",{className:"grid gap-2",children:r.map(Mn)}),e[22]=r,e[23]=I):I=e[23];let $;e[24]!==E||e[25]!==I?($=n.jsxs("div",{className:"grid gap-3 border-t border-border pt-3",children:[E,I]}),e[24]=E,e[25]=I,e[26]=$):$=e[26];let O;e[27]!==x||e[28]!==t||e[29]!==m||e[30]!==p||e[31]!==l||e[32]!==c||e[33]!==d||e[34]!==y||e[35]!==s||e[36]!==o?(O=x?n.jsx(Kt,{open:d,onOpenChange:y,children:n.jsxs(Mt,{className:"sm:max-w-lg",children:[n.jsxs(Ft,{className:"flex-row items-center gap-3 space-y-0 text-left",children:[n.jsx(St,{icon:t.icon,name:t.title,size:"md",fit:"contain",className:"p-1.5"}),n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[n.jsx(qt,{children:t.title}),n.jsxs(Vt,{children:["Configure o ",t.title," para enriquecer os dados"]})]})]}),n.jsx(x,{card:t,connectionId:l,companionClient:p,selfClient:o,org:s,contextSiteUrl:c,onDone:m,onIsPendingChange:j})]})}):n.jsx(zn,{title:t.title}),e[27]=x,e[28]=t,e[29]=m,e[30]=p,e[31]=l,e[32]=c,e[33]=d,e[34]=y,e[35]=s,e[36]=o,e[37]=O):O=e[37];let T;return e[38]!==$||e[39]!==O?(T=n.jsxs(n.Fragment,{children:[$,O]}),e[38]=$,e[39]=O,e[40]=T):T=e[40],T}function Mn(i){return n.jsxs("div",{className:"flex items-center justify-between gap-3 text-sm",children:[n.jsx("dt",{className:"text-muted-foreground",children:i.label}),n.jsx("dd",{className:"truncate text-foreground",children:Ln(i.key,i.value)})]},i.key)}const Xe={vtex:{registryAppId:"deco/vtex",checks:49,headline:"Rupturas, PDPs incompletas e lacunas de atributos em todos os SKUs"},"google-analytics":{registryAppId:"deco/google-analytics",checks:49,headline:"Onde a receita vaza entre a visualização do produto e o checkout"},"google-search-console":{registryAppId:"deco/google-search-console",checks:49,headline:"Lacunas de visibilidade na busca e indexação em todo o seu catálogo"}};function Fn(i){const e=k.c(30),{selfClient:t,org:s,cdConnectionId:o}=i;let l;e[0]!==o||e[1]!==s.id||e[2]!==s.slug?(l={connectionId:o,orgId:s.id,orgSlug:s.slug},e[0]=o,e[1]=s.id,e[2]=s.slug,e[3]=l):l=e[3];const r=Ae(l);let c;e[4]!==o||e[5]!==s.id?(c=W.commerceDiscoveryCompanionSchema(s.id,o),e[4]=o,e[5]=s.id,e[6]=c):c=e[6];let a;e[7]!==r?(a=async()=>{const R=await r.callTool({name:"MCP_CONFIGURATION",arguments:{}});return J(R)},e[7]=r,e[8]=a):a=e[8];let u;e[9]!==c||e[10]!==a?(u={queryKey:c,queryFn:a},e[9]=c,e[10]=a,e[11]=u):u=e[11];const f=me(u),p=dn(f.data?.stateSchema??{properties:{}}),d=p.map(Zn),h=p.map(Jn).filter(Yn),v=p.filter(Wn).map(Qn),j=[...h,...v].sort().join(",");let x;e[12]!==o||e[13]!==s.id?(x=W.commerceDiscoveryConnection(s.id,o),e[12]=o,e[13]=s.id,e[14]=x):x=e[14];let g;e[15]!==o||e[16]!==t?(g=async()=>{const R=await t.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:o}});return J(R)},e[15]=o,e[16]=t,e[17]=g):g=e[17];let m;e[18]!==x||e[19]!==g?(m={queryKey:x,queryFn:g},e[18]=x,e[19]=g,e[20]=m):m=e[20];const y=me(m).data?.item?.configuration_state??null;let S;e[21]!==y?(S=R=>y?.[R.fieldKey]?.value,e[21]=y,e[22]=S):S=e[22];const _=p.map(S).filter(Gn),N=[...d.map(Bn),...h.map(Hn),..._.map(Vn)].sort().join(","),E=me({queryKey:W.commerceDiscoveryCompanionConnections(s.id,N),queryFn:async()=>{if(p.length===0)return{items:[]};const R=[{field:["app_name"],operator:"in",value:d},{field:["app_id"],operator:"in",value:h}];_.length>0&&R.push({field:["id"],operator:"in",value:_});const G=await t.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{operator:"or",conditions:R},limit:1e3}});return J(G)}}).data?.items??[],I=new Set(_),$=E.filter(R=>I.has(R.id)),O=$.filter(qn);let T;e[23]!==s.id||e[24]!==s.slug?(T=R=>({queryKey:W.commerceDiscoveryCompanionOAuthStatus(s.id,R.id),queryFn:async()=>{try{const G=await fetch(`/api/${encodeURIComponent(s.slug)}/connections/${encodeURIComponent(R.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]=T):T=e[25];const U=sn({queries:O.map(T)});let P;e[26]!==U?(P=(R,G)=>[R.id,U[G]?.data?.hasToken===!0],e[26]=U,e[27]=P):P=e[27];const M=new Map(O.map(P)),q={};for(const R of $)q[R.id]=!R.oauth_config||!!R.connection_token||M.get(R.id)===!0;const z=me({queryKey:W.commerceDiscoveryCompanionRegistry(s.id,j),queryFn:async()=>{if(p.length===0)return{items:[]};const R=mn(h,v),G=await Yt(bt.REGISTRY(s.id),s.id,s.slug,"COLLECTION_REGISTRY_APP_LIST",{...R?{where:R}:{},limit:1e3});return J(G)}}),F={},K={};for(const R of z.data?.items??[])F[R.id]=R,R.server?.name&&(K[R.server.name]=R);const C=bn({requirements:p,itemsById:F,itemsByName:K,connections:E,connectionReadiness:q,configurationState:y,curated:Xe});let L;return e[28]!==C?(L={cards:C},e[28]=C,e[29]=L):L=e[29],L}function qn(i){return i.oauth_config&&!i.connection_token}function Vn(i){return`linked:${i}`}function Hn(i){return`app:${i}`}function Bn(i){return`binding:${i}`}function Gn(i){return typeof i=="string"&&i.length>0}function Qn(i){return i.bindingType}function Wn(i){return!Xe[i.bindingType]}function Yn(i){return!!i}function Jn(i){return Xe[i.bindingType]?.registryAppId}function Zn(i){return i.bindingType}function Xn({selfClient:i,org:e,userId:t,cdConnectionId:s}){const o=ut(),[l,r]=D.useState(null),[c,a]=D.useState(null),u=async(p,d)=>{const h=await i.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:p,data:d}});return J(h)};async function f(p){r(p.fieldKey),a(null);try{let d=p.candidateConnectionId;if(!d){const m=Jt(p.registryItem,e.id,t,{remoteIndex:0}),b=m.connection_type==="STDIO",y=!!m.connection_url,S=b&&m.connection_headers&&typeof m.connection_headers=="object"&&"command"in m.connection_headers;if(!y&&!S)return a(`${p.title} cannot be connected: no connection method available`),!1;const _=await i.callTool({name:"COLLECTION_CONNECTIONS_CREATE",arguments:{data:m}});d=J(_).item.id}const h=d,v=await on({connectionId:h,orgId:e.id,orgSlug:e.slug,persistFallback:m=>u(h,{connection_token:m}).then(()=>{})});if(!v.ok)return a(`Couldn't sign in to ${p.title}: ${v.error}`),!1;const j=await i.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:s}}),x=J(j).item?.configuration_state??null,g=un(x,p.fieldKey,p.bindingType,h);return await u(s,{configuration_state:g}),await o.invalidateQueries({queryKey:W.commerceDiscoveryConnection(e.id,s)}),await o.invalidateQueries({queryKey:W.commerceDiscoveryCompanionConnectionsPrefix(e.id)}),!0}catch(d){return a(d instanceof Error?d.message:String(d)),!1}finally{r(null)}}return{connect:f,connectingFieldKey:l,error:c}}const et="flex min-h-0 flex-1 flex-col gap-6 md:grid md:flex-none md:gap-4";function tt(){const i=k.c(1);let e;return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx("p",{className:"text-2xl font-medium text-foreground",children:"Desbloqueie seu diagnóstico completo"}),n.jsx("p",{className:"text-base text-muted-foreground",children:"Conecte suas ferramentas para liberar mais de 100 verificações no seu funil."})]}),i[0]=e):e=i[0],e}function es(){const i=k.c(1);let e;return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"grid gap-4",children:[0,1,2].map(ts)}),i[0]=e):e=i[0],e}function ts(i){return n.jsx(Rn,{},i)}function nt(){const i=k.c(1);let e;return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsxs("div",{className:et,children:[n.jsx(tt,{}),n.jsx(es,{})]}),i[0]=e):e=i[0],e}function ns(i){const e=k.c(5),{onRetry:t}=i;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(tt,{}),e[0]=s):s=e[0];let o,l;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("p",{className:"text-sm text-foreground",children:"Não foi possível carregar as integrações complementares."}),l=n.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Algo deu errado ao carregar suas integrações."}),e[1]=o,e[2]=l):(o=e[1],l=e[2]);let r;return e[3]!==t?(r=n.jsxs("div",{className:et,children:[s,n.jsxs("div",{role:"alert",className:"rounded-2xl border border-border bg-card p-4",children:[o,l,n.jsx(H,{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 ss(i){const e=k.c(2);let t;return e[0]!==i?(t=n.jsx(gt,{children:s=>{const{reset:o}=s;return n.jsx(ht,{fallback:l=>{const{resetError:r}=l;return n.jsx(ns,{onRetry:()=>{o(),r()}})},children:n.jsx(D.Suspense,{fallback:n.jsx(nt,{}),children:n.jsx(is,{...i})})})}}),e[0]=i,e[1]=t):t=e[1],t}function is(i){const e=k.c(35),{org:t,cdConnectionId:s,siteUrl:o}=i,{data:l}=Oe.useSession(),r=l?.user?.id??"";let c;e[0]!==t.id||e[1]!==t.slug?(c={connectionId:jt,orgId:t.id,orgSlug:t.slug},e[0]=t.id,e[1]=t.slug,e[2]=c):c=e[2];const a=Ae(c);let u;e[3]!==s||e[4]!==t||e[5]!==a?(u={selfClient:a,org:t,cdConnectionId:s},e[3]=s,e[4]=t,e[5]=a,e[6]=u):u=e[6];const{cards:f}=Fn(u);let p;e[7]!==s||e[8]!==t||e[9]!==a||e[10]!==r?(p={selfClient:a,org:t,userId:r,cdConnectionId:s},e[7]=s,e[8]=t,e[9]=a,e[10]=r,e[11]=p):p=e[11];const{connect:d,connectingFieldKey:h,error:v}=Xn(p),[j,x]=D.useState(null);if(f.length===0)return null;const g=h!==null;let m;e[12]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(tt,{}),e[12]=m):m=e[12];let b;e[13]!==v?(b=v&&n.jsx("p",{role:"alert",className:"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]!==a||e[22]!==o){let _;e[24]!==j||e[25]!==g||e[26]!==d||e[27]!==h||e[28]!==t||e[29]!==a||e[30]!==o?(_=N=>{const w=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:a,siteUrl:o,autoOpenConfigFieldKey:j,onAutoOpenConfigHandled:()=>x(E=>E===N.fieldKey?null:E),onConnect:()=>{w()}},N.fieldKey)},e[24]=j,e[25]=g,e[26]=d,e[27]=h,e[28]=t,e[29]=a,e[30]=o,e[31]=_):_=e[31],y=f.map(_),e[15]=j,e[16]=g,e[17]=f,e[18]=d,e[19]=h,e[20]=t,e[21]=a,e[22]=o,e[23]=y}else y=e[23];let S;return e[32]!==b||e[33]!==y?(S=n.jsxs("div",{className:et,children:[m,n.jsx(Fe,{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-[60vh] md:flex-none",children:n.jsxs("div",{className:"grid gap-4",children:[b,y]})})]}),e[32]=b,e[33]=y,e[34]=S):S=e[34],S}const st="https://decocms-tanstack.deco-cx.workers.dev/agendar",os="Prefere que a gente acompanhe você?",rs="Agende uma chamada de 20 minutos e rodamos o diagnóstico com você, ao vivo.";function it({siteUrl:i,email:e}){const t=new URL(st);return i&&t.searchParams.set("siteUrl",i),e&&t.searchParams.set("email",e),t.toString()}function as(i){const e=k.c(9),{href:t,size:s,className:o}=i,l=t===void 0?st:t,r=s===void 0?"lg":s;let c;e[0]!==o?(c=Z("w-full",o),e[0]=o,e[1]=c):c=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(Nt,{size:16}),e[2]=a):a=e[2];let u;e[3]!==l?(u=n.jsxs("a",{href:l,target:"_blank",rel:"noreferrer",children:["Agendar uma reunião",a]}),e[3]=l,e[4]=u):u=e[4];let f;return e[5]!==r||e[6]!==c||e[7]!==u?(f=n.jsx(H,{asChild:!0,variant:"outline",size:r,className:c,children:u}),e[5]=r,e[6]=c,e[7]=u,e[8]=f):f=e[8],f}function ct(i){const e=k.c(2),{children:t}=i;let s;return e[0]!==t?(s=n.jsx("div",{className:"relative z-10 flex h-12 w-12 items-center justify-center rounded-full border border-border bg-card card-shadow",children:t}),e[0]=t,e[1]=s):s=e[1],s}function ls(){const i=k.c(4);let e;i[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(ct,{children:n.jsx(_t,{size:20,className:"text-muted-foreground"})}),i[0]=e):e=i[0];let t;i[1]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx("div",{className:"relative mx-4 h-px flex-1 bg-border",children:n.jsx("span",{className:"absolute top-1/2 h-1.5 w-1.5 -translate-x-1/2 -translate-y-1/2 rounded-full bg-foreground animate-connection-travel","aria-hidden":!0})}),i[1]=t):t=i[1];let s;i[2]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx("span",{className:"absolute inset-0 rounded-full border border-foreground/40 animate-connection-arrive","aria-hidden":!0}),i[2]=s):s=i[2];let o;return i[3]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsxs("div",{className:"flex items-center justify-between rounded-2xl border border-border/60 bg-muted/40 px-7 py-7",children:[e,t,n.jsxs("div",{className:"relative",children:[s,n.jsxs(ct,{children:[n.jsx("img",{src:"/logos/deco logo.svg",alt:"deco",className:"h-6 w-6 dark:hidden"}),n.jsx("img",{src:"/logos/deco logo negative.svg",alt:"deco",className:"hidden h-6 w-6 dark:block"})]})]})]}),i[3]=o):o=i[3],o}function ot(i){const e=k.c(4),{href:t}=i;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(ls,{}),e[0]=s):s=e[0];let o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsxs("div",{className:"grid gap-2",children:[n.jsx("h2",{className:"text-xl font-medium leading-7 text-foreground",children:os}),n.jsx("p",{className:"text-base leading-6 text-muted-foreground",children:rs})]}),e[1]=o):o=e[1];let l;return e[2]!==t?(l=n.jsx("div",{className:"relative flex h-full w-full items-center justify-center p-10",children:n.jsxs("div",{className:"flex w-full max-w-[380px] flex-col gap-6 rounded-3xl border border-border bg-card p-8 card-shadow",children:[s,o,n.jsx(as,{href:t,size:"xl"})]})}),e[2]=t,e[3]=l):l=e[3],l}function cs(i){const e=k.c(8),{className:t,href:s}=i,o=s===void 0?st:s;let l;e[0]!==t?(l=Z("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]=l):l=e[1];let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx("span",{className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground",children:n.jsx(_t,{size:20})}),e[2]=r):r=e[2];let c,a;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsxs("span",{className:"flex flex-1 flex-col gap-0.5",children:[n.jsx("span",{className:"text-base font-medium leading-5 text-foreground",children:"Prefere falar com uma pessoa?"}),n.jsx("span",{className:"text-sm leading-5 text-muted-foreground",children:"Agende uma chamada e rodamos o diagnóstico com você."})]}),a=n.jsx(Nt,{size:18,className:"shrink-0 text-muted-foreground"}),e[3]=c,e[4]=a):(c=e[3],a=e[4]);let u;return e[5]!==o||e[6]!==l?(u=n.jsxs("a",{href:o,target:"_blank",rel:"noreferrer",className:l,children:[r,c,a]}),e[5]=o,e[6]=l,e[7]=u):u=e[7],u}function wt(i){const e=k.c(10),{host:t}=i,s=`https://www.google.com/s2/favicons?domain=${t}&sz=128`;let o,l,r;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-7 w-7 dark:hidden"}),l=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]=o,e[1]=l,e[2]=r):(o=e[0],l=e[1],r=e[2]);let c;e[3]!==s?(c=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]=c):c=e[4];let a;e[5]!==t?(a=n.jsx("span",{className:"text-lg font-medium text-foreground",children:t}),e[5]=t,e[6]=a):a=e[6];let u;return e[7]!==c||e[8]!==a?(u=n.jsxs("div",{className:"flex items-center gap-3",children:[o,l,r,c,a]}),e[7]=c,e[8]=a,e[9]=u):u=e[9],u}const ds={workspace:"Preparando seu workspace de commerce...",generic:"Preparando..."};function ms(i){return ds[i]}function rt(i){const e=k.c(4),{variant:t}=i;let s;e[0]!==t?(s=ms(t),e[0]=t,e[1]=s):s=e[1];let o;return e[2]!==s?(o=n.jsx("div",{className:"flex justify-center py-4",role:"status","aria-live":"polite",children:n.jsx(Ze,{label:s,className:"text-muted-foreground"})}),e[2]=s,e[3]=o):o=e[3],o}function Oi(){const i=k.c(1);let e;return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(ps,{}),i[0]=e):e=i[0],e}const Tt=D.createContext(null),It=()=>D.useContext(Tt);function Q(i){const e=k.c(13);let t,s;e[0]!==i?({visual:s,...t}=i,e[0]=i,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o={from:"/commerce-onboarding"},e[3]=o):o=e[3];const l=xt(o),{data:r}=Oe.useSession(),c=r?.user?.email;let a;e[4]!==l.siteUrl||e[5]!==c?(a=it({siteUrl:l.siteUrl,email:c}),e[4]=l.siteUrl,e[5]=c,e[6]=a):a=e[6];const u=a;let f;e[7]!==u||e[8]!==s?(f=s??n.jsx(ot,{href:u}),e[7]=u,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 us={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:i=>`Código enviado para ${i}`,defaultSubtitle:"Entre ou crie uma nova conta",resetEmailSent:"Verifique seu e-mail para redefinir a senha.",continueWith:i=>`Continuar com ${i}`,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 fs(i){if(!i)return null;const e=Te(i);return e.ok?new URL(e.value).hostname:null}function dt(i){switch(i){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 i}}let mt=!1;function ps(){const i=xt({from:"/commerce-onboarding"}),{org:e,siteUrl:t}=i,s=fs(t);return!mt&&Ot()&&(mt=!0,Ut("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(gs,{requestedOrgSlug:e,siteUrl:t})})}function gs(i){const e=k.c(8),{requestedOrgSlug:t,siteUrl:s}=i,{data:o,isPending:l}=Oe.useSession(),r=It();if(l){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(Q,{children:n.jsx(rt,{variant:"generic"})}),e[0]=a):a=e[0],a}if(!o){const a=typeof window>"u"?"/commerce-onboarding":`${window.location.pathname}${window.location.search}`;let u;e[1]!==r?(u=r?n.jsx(wt,{host:r}):void 0,e[1]=r,e[2]=u):u=e[2];let f;return e[3]!==u?(f=n.jsx(Q,{children:n.jsx(Pt,{callbackUrl:a,allowAutoLogin:!1,title:"Desbloqueie seu diagnóstico completo",subtitle:null,brand:u,copy:us})}),e[3]=u,e[4]=f):f=e[4],f}let c;return e[5]!==t||e[6]!==s?(c=n.jsx(hs,{requestedOrgSlug:t,siteUrl:s}),e[5]=t,e[6]=s,e[7]=c):c=e[7],c}function hs(i){const e=k.c(40),{requestedOrgSlug:t,siteUrl:s}=i,o=yt(),l=At(),[r,c]=D.useState(null),[a,u]=D.useState(null),f=l.data?.map(ys)??[];let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={mutationFn:xs,retry:!1,onSuccess:m=>{u(m)}},e[0]=p):p=e[0];const d=ke(p);if(l.isPending){let m;return e[1]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(Q,{children:n.jsx(rt,{variant:"workspace"})}),e[1]=m):m=e[1],m}if(l.error){let m;return e[2]!==l?(m=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:()=>l.refetch()}),e[2]=l,e[3]=m):m=e[3],m}const h=t?f.find(m=>m.slug===t):null;if(h){let m;return e[4]!==h||e[5]!==s?(m=n.jsx(we,{org:h,initialSiteUrl:s}),e[4]=h,e[5]=s,e[6]=m):m=e[6],m}if(t){let m;return e[7]!==l?(m=n.jsx(Ie,{title:"Organização não encontrada",description:"Não conseguimos encontrar essa organização na sua conta.",actionLabel:"Tentar novamente",onRetry:()=>l.refetch()}),e[7]=l,e[8]=m):m=e[8],m}if(r){let m;return e[9]!==r||e[10]!==s?(m=n.jsx(we,{org:r,initialSiteUrl:s}),e[9]=r,e[10]=s,e[11]=m):m=e[11],m}if(f.length===1&&f[0]){let m;return e[12]!==f[0]||e[13]!==s?(m=n.jsx(we,{org:f[0],initialSiteUrl:s}),e[12]=f[0],e[13]=s,e[14]=m):m=e[14],m}if(f.length>1){let m;e[15]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(X,{title:"Escolha uma organização",description:"Selecione onde o diagnóstico de commerce deve continuar."}),e[15]=m):m=e[15];let b;e[16]===Symbol.for("react.memo_cache_sentinel")?(b=S=>c(S),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:[m,n.jsx(Fe,{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:n.jsx(at,{organizations:f,selectLabel:"Continuar",onSelected:b})})]})}),e[17]=f,e[18]=y):y=e[18],y}if(!a){let m;e[19]!==d?(m=()=>{d.reset(),d.mutate()},e[19]=d,e[20]=m):m=e[20];let b;return e[21]!==d||e[22]!==m?(b=n.jsx(vs,{mutation:d,onRetry:m}),e[21]=d,e[22]=m,e[23]=b):b=e[23],b}const v=a;if(v?.success&&(v.status==="created"||v.status==="joined"||v.status==="already_has_organization")&&v.organization){let m;return e[24]!==v.organization||e[25]!==s?(m=n.jsx(we,{org:v.organization,initialSiteUrl:s}),e[24]=v.organization,e[25]=s,e[26]=m):m=e[26],m}if(v?.status==="ambiguous"&&v.organizations&&v.organizations.length>0){let m;e[27]===Symbol.for("react.memo_cache_sentinel")?(m=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]=m):m=e[27];const b=v.domain??void 0;let y;e[28]!==o||e[29]!==s?(y=(_,N)=>{vt(),c({..._,slug:N}),o({to:"/commerce-onboarding",search:{org:N,siteUrl:s}})},e[28]=o,e[29]=s,e[30]=y):y=e[30];let S;return e[31]!==v.organizations||e[32]!==b||e[33]!==y?(S=n.jsx(Q,{children:n.jsxs("div",{className:"grid gap-10",children:[m,n.jsx(Fe,{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:n.jsx(at,{organizations:v.organizations,domain:b,onJoined:y})})]})}),e[31]=v.organizations,e[32]=b,e[33]=y,e[34]=S):S=e[34],S}const j=v?.error??"Não conseguimos determinar uma organização de commerce para esta conta.";let x;e[35]!==d?(x=()=>{u(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 xs(){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&&vt(),e}function ys(i){return{id:i.id,name:i.name,slug:i.slug,logo:i.logo??null}}function vs(i){const e=k.c(7),{mutation:t,onRetry:s}=i,o=D.useRef(!1);let l;e[0]!==t?(l=u=>{!u||o.current||(o.current=!0,t.mutate())},e[0]=t,e[1]=l):l=e[1];const r=l;if(t.error){let u;return e[2]!==s?(u=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]=u):u=e[3],u}let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(rt,{variant:"generic"}),e[4]=c):c=e[4];let a;return e[5]!==r?(a=n.jsx(Q,{children:n.jsx("div",{ref:r,children:c})}),e[5]=r,e[6]=a):a=e[6],a}function X(i){const e=k.c(8),{title:t,description:s}=i,o=It();let l;e[0]!==o?(l=o?n.jsx(wt,{host:o}):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]=o,e[1]=l):l=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 c;return e[5]!==l||e[6]!==r?(c=n.jsxs("div",{className:"grid gap-10",children:[l,r]}),e[5]=l,e[6]=r,e[7]=c):c=e[7],c}function Ie(i){const e=k.c(9),{title:t,description:s,actionLabel:o,onRetry:l}=i;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 c;e[3]!==o||e[4]!==l?(c=n.jsx(H,{type:"button",size:"xl",className:"w-full",onClick:l,children:o}),e[3]=o,e[4]=l,e[5]=c):c=e[5];let a;return e[6]!==r||e[7]!==c?(a=n.jsx(Q,{children:n.jsxs("div",{className:"grid gap-10",children:[r,c]})}),e[6]=r,e[7]=c,e[8]=a):a=e[8],a}function bs(i){return i.content?.find(e=>e.text)?.text??"A configuração do Commerce Discovery falhou."}function Ee(i){const e=i;if(e.isError)throw new Error(bs(e));return e.structuredContent??i}function we(i){const e=k.c(10),{org:t,initialSiteUrl:s}=i,{data:o}=Oe.useSession(),l=o?.user?.email;let r;e[0]!==s||e[1]!==l?(r=it({siteUrl:s,email:l}),e[0]=s,e[1]=l,e[2]=r):r=e[2];const c=r;let a;e[3]!==c?(a=n.jsx(ot,{href:c}),e[3]=c,e[4]=a):a=e[4];const u=a;let f;return e[5]!==s||e[6]!==u||e[7]!==t||e[8]!==o?.user?.email?(f=n.jsx(gt,{children:p=>{const{reset:d}=p;return n.jsx(ht,{fallback:h=>{const{error:v,resetError:j}=h;return n.jsx(Q,{visual:u,children:n.jsx(js,{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(D.Suspense,{fallback:n.jsx(kt,{visual:u}),children:n.jsx(Cs,{org:t,initialSiteUrl:s,sessionEmail:o?.user?.email},`${t.id}:${s??""}`)})})}}),e[5]=s,e[6]=u,e[7]=t,e[8]=o?.user?.email,e[9]=f):f=e[9],f}function kt(i){const e=k.c(3),{visual:t}=i;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(nt,{})]}),e[0]=s):s=e[0];let o;return e[1]!==t?(o=n.jsx(Q,{align:"fill",visual:t,children:s}),e[1]=t,e[2]=o):o=e[2],o}function js(i){const e=k.c(10),{orgName:t,message:s,onRetry:o}=i,l=`A configuração de commerce continuará em ${t}.`;let r;e[0]!==l?(r=n.jsx(X,{title:"Diagnóstico de commerce",description:l}),e[0]=l,e[1]=r):r=e[1];let c;e[2]!==s?(c=n.jsx(xe,{message:s}),e[2]=s,e[3]=c):c=e[3];let a;e[4]!==o?(a=n.jsx(H,{type:"button",size:"xl",className:"w-full",onClick:o,children:"Tentar novamente"}),e[4]=o,e[5]=a):a=e[5];let u;return e[6]!==r||e[7]!==c||e[8]!==a?(u=n.jsxs("div",{className:"grid gap-10",children:[r,c,a]}),e[6]=r,e[7]=c,e[8]=a,e[9]=u):u=e[9],u}function Cs(i){const e=k.c(111),{org:t,initialSiteUrl:s,sessionEmail:o}=i,l=yt();let r;e[0]!==t.id||e[1]!==t.slug?(r={connectionId:jt,orgId:t.id,orgSlug:t.slug},e[0]=t.id,e[1]=t.slug,e[2]=r):r=e[2];const c=Ae(r),[a,u]=D.useState(s??""),[f,p]=D.useState(null),[d,h]=D.useState(null),v=D.useRef(!1),j=bt.COMMERCE_DISCOVERY(t.id),x=zt(t.id),g=W.commerceDiscoveryConnection(t.id,j);let m;e[3]!==j||e[4]!==c?(m=async()=>{const A=await c.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:j}});return Ee(A)},e[3]=j,e[4]=c,e[5]=m):m=e[5];let b;e[6]!==g||e[7]!==m?(b={queryKey:g,queryFn:m,retry:!1},e[6]=g,e[7]=m,e[8]=b):b=e[8];const y=me(b),S=W.commerceDiscoveryVirtualMcp(t.id,x);let _;e[9]!==c||e[10]!==x?(_=async()=>{const A=await c.callTool({name:"COLLECTION_VIRTUAL_MCP_GET",arguments:{id:x}});return Ee(A)},e[9]=c,e[10]=x,e[11]=_):_=e[11];let N;e[12]!==S||e[13]!==_?(N={queryKey:S,queryFn:_,retry:!1},e[12]=S,e[13]=_,e[14]=N):N=e[14];const w=me(N);let E;e[15]!==c?(E=async A=>{const B=await c.callTool({name:"COMMERCE_DISCOVERY_SETUP",arguments:{siteUrl:A}});return Ee(B)},e[15]=c,e[16]=E):E=e[16];let I;e[17]!==y||e[18]!==w?(I=A=>{p(A),h(null),y.refetch(),w.refetch()},e[17]=y,e[18]=w,e[19]=I):I=e[19];let $;e[20]===Symbol.for("react.memo_cache_sentinel")?($=A=>{h(A instanceof Error?A.message:"A configuração do Commerce Discovery falhou.")},e[20]=$):$=e[20];let O;e[21]!==E||e[22]!==I?(O={mutationFn:E,retry:!1,onSuccess:I,onError:$},e[21]=E,e[22]=I,e[23]=O):O=e[23];const T=ke(O);let U;e[24]!==c?(U={mutationFn:async A=>{const B=await c.callTool({name:"COMMERCE_DISCOVERY_RUN",arguments:{siteUrl:A}});return Ee(B)},retry:!1},e[24]=c,e[25]=U):U=e[25];const P=ke(U),[M,q]=D.useState(null),z=!!y.data.item&&!!w.data.item,F=y.data.item,K=typeof F?.metadata?.siteUrl=="string"?F.metadata.siteUrl:void 0,C=s||a||K||"";let L;e[26]!==C||e[27]!==o?(L=it({siteUrl:C,email:o}),e[26]=C,e[27]=o,e[28]=L):L=e[28];const R=L;let G;e[29]!==R?(G=n.jsx(ot,{href:R}),e[29]=R,e[30]=G):G=e[30];const V=G;let ye;e[31]!==T?(ye=A=>{const B=Te(A);if(!B.ok){h(dt(B.error));return}h(null),T.mutate(B.value)},e[31]=T,e[32]=ye):ye=e[32];const te=ye;let ve;e[33]!==s||e[34]!==te||e[35]!==z?(ve=A=>{!A||v.current||z||!s||(v.current=!0,te(s))},e[33]=s,e[34]=te,e[35]=z,e[36]=ve):ve=e[36];const Re=ve;let be;e[37]!==te||e[38]!==a?(be=A=>{A.preventDefault(),te(a)},e[37]=te,e[38]=a,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 Ce;e[44]!==C||e[45]!==l||e[46]!==t.slug||e[47]!==ee||e[48]!==P?(Ce=async()=>{q(null);const A=Te(C);if(A.ok)try{await P.mutateAsync(A.value)}catch{q("Algo deu errado ao gerar seu relatório. Tente novamente em instantes.");return}localStorage.setItem(Rt.sidebarOpen(),JSON.stringify(!1)),l({to:"/$org/$taskId",params:{org:t.slug,taskId:crypto.randomUUID()},search:{virtualmcpid:ee.virtualMcpId,main:Lt(ee.connectionId,ee.toolName),chat:0}})},e[44]=C,e[45]=l,e[46]=t.slug,e[47]=ee,e[48]=P,e[49]=Ce):Ce=e[49];const Pe=Ce;if(z){let A;return e[50]!==R||e[51]!==V||e[52]!==C||e[53]!==Pe||e[54]!==t||e[55]!==ee||e[56]!==M||e[57]!==P.isPending?(A=n.jsx(Ss,{org:t,reportApp:ee,onOpenReport:Pe,isSubmitting:P.isPending,error:M,meetingUrl:R,meetingVisual:V,siteUrl:C}),e[50]=R,e[51]=V,e[52]=C,e[53]=Pe,e[54]=t,e[55]=ee,e[56]=M,e[57]=P.isPending,e[58]=A):A=e[58],A}if(T.isPending){let A;return e[59]!==V?(A=n.jsx(kt,{visual:V}),e[59]=V,e[60]=A):A=e[60],A}if(s){let A,B;if(e[61]!==V||e[62]!==Y||e[63]!==s||e[64]!==d||e[65]!==t.name||e[66]!==T.isPending||e[67]!==a){B=Symbol.for("react.early_return_sentinel");e:if(A=Te(s),!A.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:dt(A.error)});let ce;e[72]!==Y||e[73]!==d||e[74]!==T.isPending||e[75]!==a?(ce=n.jsx(Me,{siteUrl:a,error:d,isSubmitting:T.isPending,onSiteUrlChange:u,onSubmit:Y}),e[72]=Y,e[73]=d,e[74]=T.isPending,e[75]=a,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]!==V||e[82]!==de?(_e=n.jsx(Q,{visual:V,children:de}),e[81]=V,e[82]=de,e[83]=_e):_e=e[83],B=_e;break e}e[61]=V,e[62]=Y,e[63]=s,e[64]=d,e[65]=t.name,e[66]=T.isPending,e[67]=a,e[68]=A,e[69]=B}else A=e[68],B=e[69];if(B!==Symbol.for("react.early_return_sentinel"))return B;const Le=`O Commerce Discovery está sendo preparado para ${A.value}.`;let oe;e[84]!==Le?(oe=n.jsx(X,{title:"Diagnóstico de commerce",description:Le}),e[84]=Le,e[85]=oe):oe=e[85];let re;e[86]!==Y||e[87]!==d||e[88]!==T.isPending||e[89]!==a?(re=d?n.jsxs(n.Fragment,{children:[n.jsx(xe,{message:d}),n.jsx(Me,{siteUrl:a,error:null,isSubmitting:T.isPending,onSiteUrlChange:u,onSubmit:Y})]}):n.jsx(nt,{}),e[86]=Y,e[87]=d,e[88]=T.isPending,e[89]=a,e[90]=re):re=e[90];let ae;e[91]!==oe||e[92]!==re||e[93]!==Re?(ae=n.jsxs("div",{ref:Re,className:"grid gap-10",children:[oe,re]}),e[91]=oe,e[92]=re,e[93]=Re,e[94]=ae):ae=e[94];let Ne;return e[95]!==V||e[96]!==ae?(Ne=n.jsx(Q,{visual:V,children:ae}),e[95]=V,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]!==T.isPending||e[103]!==a?(se=n.jsx(Me,{siteUrl:a,error:d,isSubmitting:T.isPending,onSiteUrlChange:u,onSubmit:Y}),e[100]=Y,e[101]=d,e[102]=T.isPending,e[103]=a,e[104]=se):se=e[104];let ie;e[105]!==ne||e[106]!==se?(ie=n.jsxs("div",{className:"grid gap-10",children:[ne,se]}),e[105]=ne,e[106]=se,e[107]=ie):ie=e[107];let Se;return e[108]!==V||e[109]!==ie?(Se=n.jsx(Q,{visual:V,children:ie}),e[108]=V,e[109]=ie,e[110]=Se):Se=e[110],Se}function Me(i){const e=k.c(20),{siteUrl:t,error:s,isSubmitting:o,onSiteUrlChange:l,onSubmit:r}=i;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx("label",{className:"text-sm font-medium",htmlFor:"commerce-site-url",children:"URL do site"}),e[0]=c):c=e[0];let a;e[1]!==l?(a=x=>l(x.target.value),e[1]=l,e[2]=a):a=e[2];const u=!!s;let f;e[3]!==o||e[4]!==t||e[5]!==a||e[6]!==u?(f=n.jsx(Ue,{id:"commerce-site-url",type:"text",inputMode:"url",value:t,onChange:a,placeholder:"https://example.com","aria-invalid":u,disabled:o}),e[3]=o,e[4]=t,e[5]=a,e[6]=u,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:[c,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(Ct,{size:16}),e[13]=h):h=e[13];let v;e[14]!==o?(v=n.jsxs(H,{type:"submit",size:"xl",className:"w-full",disabled:o,children:["Continuar",h]}),e[14]=o,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 Ss(i){const e=k.c(26),{org:t,reportApp:s,onOpenReport:o,isSubmitting:l,error:r,meetingUrl:c,meetingVisual:a,siteUrl:u}=i;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]!==u?(p=n.jsx(ss,{org:t,cdConnectionId:s.connectionId,siteUrl:u}),e[1]=t,e[2]=s.connectionId,e[3]=u,e[4]=p):p=e[4];let d;e[5]!==c?(d=n.jsx(cs,{className:"md:hidden",href:c}),e[5]=c,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=l||!s.virtualMcpId,j=l?"Abrindo relatório...":"Ver relatório completo";let x;e[9]!==l?(x=l?null:n.jsx(Ct,{size:18}),e[9]=l,e[10]=x):x=e[10];let g;e[11]!==o||e[12]!==v||e[13]!==j||e[14]!==x?(g=n.jsxs(H,{type:"button",size:"xl",className:"w-full rounded-2xl text-base font-medium",onClick:o,disabled:v,children:[j,x]}),e[11]=o,e[12]=v,e[13]=j,e[14]=x,e[15]=g):g=e[15];let m;e[16]!==d||e[17]!==h||e[18]!==g?(m=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]=m):m=e[19];let b;e[20]!==p||e[21]!==m?(b=n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-6 md:grid md:gap-4",children:[f,p,m]}),e[20]=p,e[21]=m,e[22]=b):b=e[22];let y;return e[23]!==a||e[24]!==b?(y=n.jsx(Q,{align:"fill",visual:a,children:b}),e[23]=a,e[24]=b,e[25]=y):y=e[25],y}function xe(i){const e=k.c(2),{message:t}=i;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{Oi as default};
|
|
1
|
+
import{c as k,r as D,l as Z,j as n,B as H,m as ut,d as ke,K as W,o as He,s as ue,n as Be,p as Ge,i as ft,k as pt,q as me,Q as gt,E as ht,a as Oe,u as xt,v as Ot,w as Ut,b as yt,x as At,y as vt,L as Rt}from"./index-I8Uum3Jx.js";import{A as Pt}from"./auth-entry-CavsOUDq.js";import{A as $t}from"./auth-split-layout-dFpcxyJe.js";import{O as at}from"./organization-choice-y8WYOYM0.js";import{f as Lt}from"./tab-id-BptcWVWa.js";import{I as Ue}from"./input-CutcETvq.js";import{u as Ae,W as bt,S as jt,g as zt,C as Dt}from"./use-mcp-client-Bq9g8m5J.js";import{i as Ct}from"./XCircle-PlbEvjyp.js";import{I as St}from"./integration-icon-D3W1euXX.js";import{D as Qe,a as Kt,b as Mt,c as Ft,d as qt,e as Vt}from"./dialog-CxQBoX40.js";import{T as Ht,a as Bt,b as Gt}from"./tooltip-Cs84Kx7a.js";import{i as We}from"./CheckCircle-V30FMM2D.js";import{i as Qt}from"./ZoomOut-DxqRFWA_.js";import{g as Wt,c as Yt,e as Jt}from"./extract-connection-data-BaXkJtVr.js";import{F as fe,a as Ye,b as pe,c as Ke,d as ge,e as he}from"./form-CpFt_4sy.js";import{i as Zt}from"./ChevronUp-HJUE3-BD.js";import{s as Xt,a as en}from"./Eye-BSiFxHQB.js";import{i as tn}from"./Settings02-DbH9OAzT.js";import{i as nn}from"./agent-icon-B2N3zGQH.js";import{u as sn}from"./useSuspenseQueries-C6KWJru5.js";import{a as on}from"./authenticate-and-persist-oauth-CGYbK6H8.js";import{i as Nt}from"./ArrowUpRight-CAv7CUnJ.js";import{s as _t}from"./User01-BDtU1dk1.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./avatar-Dv3IrttI.js";import"./auth-DZDiXt1m.js";import"./X-D7X7Z50V.js";import"./label-DtGUWURu.js";import"./AlertCircle-VcwplCRi.js";import"./Tool01-DvTGD1Yt.js";import"./SwitchHorizontal01-F_1MjTR3.js";import"./ZapSquare-CvkoTQDM.js";import"./Users03-CL71IAQ8.js";import"./ChevronDown-URo4LveF.js";import"./ChevronLeft-aMkPes9N.js";import"./ChevronRight-oz8o6WPV.js";import"./DotsVertical-QF46dzdi.js";import"./Stars02-PPXsboxW.js";import"./Globe01-wGomueqV.js";import"./FilterLines-CEzORaPw.js";import"./Star01-BwAv907s.js";import"./Globe04-CsKOsQ4z.js";import"./HardDrive-BuI4Q48l.js";import"./Key01-r6MDYdDw.js";import"./LayoutLeft-BFxGsVdk.js";import"./LinkExternal01-BWnRnxGs.js";import"./Monitor01-SEZLDRFN.js";import"./Sun-Dw86eVev.js";import"./Palette-CEjENuG4.js";import"./Play-BDoh8EAp.js";import"./Plus-Bw9lc6SR.js";import"./SearchMd-BMfw7gZ4.js";import"./Shield01-C1R4fpvK.js";import"./Stars01-D1icdaCh.js";import"./Trash01-d58N8w5a.js";import"./Upload01-C_hHbDSF.js";import"./Users01-PX3eYoC8.js";import"./XClose-BbuWQhNb.js";import"./Zap-BQKeuD4l.js";import"./mcp-oauth-CSZ5TVrK.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(i){const e=i.trim();if(!e)return{ok:!1,error:"Enter a website URL."};const t=rn.test(e),s=an.test(e),o=ln.test(e);if(t&&!s&&!o)return{ok:!1,error:"Use an HTTP or HTTPS website URL."};const l=s?e:`https://${e}`;let r;try{r=new URL(l)}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 c=r.hostname.split(".");return c.length<2||c.some(a=>!a||!cn.test(a))?{ok:!1,error:"Enter a valid website URL."}:(r.protocol="https:",{ok:!0,value:r.origin})}function Fe(i){const e=k.c(14),{children:t,className:s,wrapperClassName:o}=i,[l,r]=D.useState(!0);let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=j=>{if(!j)return;const x=()=>{const m=j.scrollHeight-j.scrollTop-j.clientHeight<8;r(m)};x(),j.addEventListener("scroll",x,{passive:!0});const g=new ResizeObserver(x);g.observe(j);for(const m of Array.from(j.children))g.observe(m);return()=>{j.removeEventListener("scroll",x),g.disconnect()}},e[0]=c):c=e[0];const a=c;let u;e[1]!==o?(u=Z("relative",o),e[1]=o,e[2]=u):u=e[2];let f;e[3]!==t||e[4]!==s?(f=n.jsx("div",{ref:a,className:s,children:t}),e[3]=t,e[4]=s,e[5]=f):f=e[5];const p=l?"opacity-0":"opacity-100";let d;e[6]!==p?(d=Z("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]!==u||e[11]!==f||e[12]!==h?(v=n.jsxs("div",{className:u,children:[f,h]}),e[10]=u,e[11]=f,e[12]=h,e[13]=v):v=e[13],v}function dn(i){const e=i.properties;if(!e)return[];const t=[];for(const[s,o]of Object.entries(e)){const c=o?.properties?.__type?.const;typeof c=="string"&&c.length>0&&t.push({fieldKey:s,bindingType:c})}return t}function mn(i,e){const t=[];if(i.length&&t.push({field:["id"],operator:"in",value:i}),e.length&&t.push({field:["name"],operator:"in",value:e}),t.length!==0)return t.length===1?t[0]:{operator:"or",conditions:t}}function J(i){const e=i;if(e.isError)throw new Error(e.content?.find(t=>t.text)?.text??"Tool call failed");return e.structuredContent??i}function un(i,e,t,s){return{...i??{},[e]:{__type:t,value:s}}}function qe(i){return i==null?!1:typeof i=="string"?i.trim().length>0:typeof i=="number"||typeof i=="boolean"?!0:Array.isArray(i)?i.some(qe):typeof i=="object"?Object.entries(i).some(([e,t])=>!e.startsWith("__")&&qe(t)):!1}function fn(i){const e={accountName:"Nome da conta",appKey:"App Key",appToken:"App Token",propertyId:"Propriedade",siteUrl:"Site"};return e[i]?e[i]:i.replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/\b\w/g,t=>t.toUpperCase())}function pn(i){return qe(i)?typeof i=="string"?i.trim():typeof i=="number"||typeof i=="boolean"?String(i):JSON.stringify(i):null}function gn(i){return i?Object.entries(i).flatMap(([e,t])=>{if(e.startsWith("__"))return[];const s=pn(t);return s?[{key:e,label:fn(e),value:s}]:[]}):[]}function hn({autoOpenFieldKey:i,card:e}){return i===e.fieldKey&&e.satisfied&&!!e.linkedConnectionId}function xn(i,e,t){const s=i.filter(o=>o.app_name===e||!!t&&o.app_id===t);return s.length===0?null:(s.sort((o,l)=>{const r=c=>c.status==="active"?0:1;return r(o)!==r(l)?r(o)-r(l):(l.updated_at??"").localeCompare(o.updated_at??"")}),s[0].id)}function yn(i){return i.server?.icons?.[0]?.src??Wt(i.server?.repository)??null}function vn(i,e){const t=i._meta?.["mcp.mesh"];return t?.friendlyName||t?.friendly_name||i.title||i.server?.title||i.server?.name||e}function bn(i){const e=[],t=new Map(i.connections.map(s=>[s.id,s]));for(const s of i.requirements){const o=i.curated[s.bindingType],l=o?i.itemsById[o.registryAppId]:i.itemsByName[s.bindingType];if(!l)continue;const r=i.configurationState?.[s.fieldKey]?.value,c=r?t.get(r):void 0,a=r&&c?r:null,u=a?i.connectionReadiness?.[a]!==!1:!1,f=!!a&&u;e.push({fieldKey:s.fieldKey,bindingType:s.bindingType,registryItem:l,title:vn(l,s.bindingType),icon:yn(l),headline:o?.headline??l._meta?.["mcp.mesh"]?.short_description??null,checks:o?.checks??null,bullets:o?.bullets??[],satisfied:f,candidateConnectionId:f?null:a||xn(i.connections,s.bindingType,o?.registryAppId),linkedConnectionId:a,configurationState:c?.configuration_state??null})}return e}function jn(i,e){if(!i)return null;const t=o=>{if(o.startsWith("sc-domain:"))return o.substring(10);try{let r=new URL(o.startsWith("http")?o:`https://${o}`).hostname||"";return r.startsWith("www.")&&(r=r.substring(4)),r}catch{return o}},s=t(i);for(const o of e)if(t(o.siteUrl)===s)return o.siteUrl;return null}function Cn(i){return(i?.response?.accountSummaries??[]).map(s=>({account:s.account,options:(s.propertySummaries??[]).map(o=>({value:o.property,label:`${o.displayName} (${s.displayName})`}))}))}function lt(i){const e=k.c(38);let t,s,o,l,r;e[0]!==i?({value:r,onChange:s,placeholder:o,className:t,...l}=i,e[0]=i,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[c,a]=D.useState(!1),[u,f]=D.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]!==c?(h=()=>{a(!c)},e[8]=c,e[9]=h):h=e[9];const v=h,j=c?"text":"password";let x;e[10]!==t?(x=Z("pr-20",t),e[10]=t,e[11]=x):x=e[11];let g;e[12]!==s||e[13]!==o||e[14]!==l||e[15]!==j||e[16]!==x||e[17]!==r?(g=n.jsx(Ue,{type:j,value:r,onChange:s,placeholder:o,className:x,...l}),e[12]=s,e[13]=o,e[14]=l,e[15]=j,e[16]=x,e[17]=r,e[18]=g):g=e[18];const m=c?"Hide password":"Show password";let b;e[19]!==c?(b=c?n.jsx(tn,{size:16}):n.jsx(Xt,{size:16}),e[19]=c,e[20]=b):b=e[20];let y;e[21]!==m||e[22]!==b||e[23]!==v?(y=n.jsx(H,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:v,title:m,children:b}),e[21]=m,e[22]=b,e[23]=v,e[24]=y):y=e[24];const S=!r,_=u?"Copied!":"Copy token";let N;e[25]!==u?(N=u?n.jsx(Zt,{size:16}):n.jsx(en,{size:16}),e[25]=u,e[26]=N):N=e[26];let w;e[27]!==d||e[28]!==_||e[29]!==N||e[30]!==S?(w=n.jsx(H,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:d,disabled:S,title:_,children:N}),e[27]=d,e[28]=_,e[29]=N,e[30]=S,e[31]=w):w=e[31];let E;e[32]!==w||e[33]!==y?(E=n.jsxs("div",{className:"absolute right-1 top-1 flex items-center gap-1 h-8",children:[y,w]}),e[32]=w,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 Je(i){const e=k.c(19),{card:t,selfClient:s,org:o,onDone:l,onError:r}=i,c=ut();let a;e[0]!==t||e[1]!==s?(a=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]=a):a=e[2];let u;e[3]!==l||e[4]!==o||e[5]!==c?(u=async()=>{await c.invalidateQueries({queryKey:W.commerceDiscoveryCompanionConnectionsPrefix(o.id)}),l()},e[3]=l,e[4]=o,e[5]=c,e[6]=u):u=e[6];let f;e[7]!==r?(f=x=>{r?.(x)},e[7]=r,e[8]=f):f=e[8];let p;e[9]!==a||e[10]!==u||e[11]!==f?(p={mutationFn:a,onSuccess:u,onError:f},e[9]=a,e[10]=u,e[11]=f,e[12]=p):p=e[12];const d=ke(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 Sn=He({accountName:ue().min(1,"Informe o nome da conta"),appKey:ue().optional(),appToken:ue().optional()});function Nn(i){const e=k.c(63),{card:t,selfClient:s,org:o,onDone:l,onIsPendingChange:r}=i;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=Be(Sn),e[0]=c):c=e[0];const a=t.configurationState?.accountName||"",u=t.configurationState?.appKey||"",f=t.configurationState?.appToken||"";let p;e[1]!==a||e[2]!==u||e[3]!==f?(p={resolver:c,defaultValues:{accountName:a,appKey:u,appToken:f}},e[1]=a,e[2]=u,e[3]=f,e[4]=p):p=e[4];const d=Ge(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],D.useEffect(h,v);let j;e[13]!==t||e[14]!==l||e[15]!==o||e[16]!==s?(j={card:t,selfClient:s,org:o,onDone:l},e[13]=t,e[14]=l,e[15]=o,e[16]=s,e[17]=j):j=e[17];const{save:x,isPending:g,error:m}=Je(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]),D.useEffect(y,b);let S;if(e[22]!==d||e[23]!==x){let K;e[25]!==x?(K=async C=>{x(C)},e[25]=x,e[26]=K):K=e[26],S=d.handleSubmit(K),e[22]=d,e[23]=x,e[24]=S}else S=e[24];const _=S;let N;e[27]!==g?(N=K=>{const{field:C}=K;return n.jsxs(pe,{children:[n.jsx(Ke,{children:"Nome da conta"}),n.jsx(ge,{children:n.jsx(Ue,{placeholder:"Nome da sua conta VTEX",...C,disabled:g})}),n.jsx(he,{})]})},e[27]=g,e[28]=N):N=e[28];let w;e[29]!==d.control||e[30]!==N?(w=n.jsx(fe,{control:d.control,name:"accountName",render:N}),e[29]=d.control,e[30]=N,e[31]=w):w=e[31];let E;e[32]!==g?(E=K=>{const{field:C}=K;return n.jsxs(pe,{children:[n.jsx(Ke,{children:"App Key (opcional)"}),n.jsx(ge,{children:n.jsx(lt,{placeholder:"App Key da VTEX",...C,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?($=K=>{const{field:C}=K;return n.jsxs(pe,{children:[n.jsx(Ke,{children:"App Token (opcional)"}),n.jsx(ge,{children:n.jsx(lt,{placeholder:"App Token da VTEX",...C,disabled:g})}),n.jsx(he,{})]})},e[37]=g,e[38]=$):$=e[38];let O;e[39]!==d.control||e[40]!==$?(O=n.jsx(fe,{control:d.control,name:"appToken",render:$}),e[39]=d.control,e[40]=$,e[41]=O):O=e[41];let T;e[42]!==d||e[43]!==w||e[44]!==I||e[45]!==O?(T=n.jsxs(Ye,{...d,children:[w,I,O]}),e[42]=d,e[43]=w,e[44]=I,e[45]=O,e[46]=T):T=e[46];let U;e[47]!==m?(U=m&&n.jsx("p",{role:"alert",className:"text-sm text-destructive",children:m instanceof Error?m.message:"Não foi possível salvar a configuração"}),e[47]=m,e[48]=U):U=e[48];let P;e[49]!==g||e[50]!==l?(P=n.jsx(H,{type:"button",variant:"outline",onClick:l,disabled:g,children:"Cancelar"}),e[49]=g,e[50]=l,e[51]=P):P=e[51];const M=g?"Salvando...":"Salvar";let q;e[52]!==g||e[53]!==M?(q=n.jsx(H,{type:"submit",disabled:g,children:M}),e[52]=g,e[53]=M,e[54]=q):q=e[54];let z;e[55]!==P||e[56]!==q?(z=n.jsxs(Qe,{className:"pt-4",children:[P,q]}),e[55]=P,e[56]=q,e[57]=z):z=e[57];let F;return e[58]!==_||e[59]!==T||e[60]!==U||e[61]!==z?(F=n.jsxs("form",{onSubmit:_,className:"space-y-4",children:[T,U,z]}),e[58]=_,e[59]=T,e[60]=U,e[61]=z,e[62]=F):F=e[62],F}function Et(i){const e=k.c(30),{options:t,value:s,onChange:o,disabled:l,ariaLabel:r,searchPlaceholder:c}=i,a=c===void 0?"Buscar...":c,[u,f]=D.useState("");let p,d,h;if(e[0]!==t||e[1]!==u||e[2]!==s){const w=u.trim().toLowerCase();p=w?t.filter(E=>E.label.toLowerCase().includes(w)):t,d=p.map(_n),h=d.includes(s)?s:d[0]??"",e[0]=t,e[1]=u,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]!==l||e[7]!==d||e[8]!==o?(j=function(E){if(l||!["ArrowDown","ArrowRight","ArrowUp","ArrowLeft","Home","End"].includes(E.key))return;E.preventDefault();const $=E.currentTarget.dataset.value,O=d.indexOf($),T=d.length;if(T===0)return;let U;E.key==="ArrowDown"||E.key==="ArrowRight"?U=(O+1)%T:E.key==="ArrowUp"||E.key==="ArrowLeft"?U=(O-1+T)%T:E.key==="Home"?U=0:U=T-1;const P=d[U];o(P),E.currentTarget.closest('[role="radiogroup"]')?.querySelector(`[data-value="${CSS.escape(P)}"]`)?.focus()},e[6]=l,e[7]=d,e[8]=o,e[9]=j):j=e[9];const x=j;let g;e[10]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(nn,{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 m;e[11]===Symbol.for("react.memo_cache_sentinel")?(m=w=>f(w.target.value),e[11]=m):m=e[11];const b=`Buscar ${r}`;let y;e[12]!==l||e[13]!==u||e[14]!==a||e[15]!==b?(y=n.jsxs("div",{className:"relative",children:[g,n.jsx(Ue,{type:"text",value:u,onChange:m,disabled:l,placeholder:a,"aria-label":b,className:"h-8 pl-8"})]}),e[12]=l,e[13]=u,e[14]=a,e[15]=b,e[16]=y):y=e[16];let S;e[17]!==l||e[18]!==p||e[19]!==x||e[20]!==o||e[21]!==v||e[22]!==s?(S=p.length===0?n.jsx("div",{className:"px-2 py-2 text-sm text-muted-foreground",children:"Nenhum resultado"}):p.map(w=>{const E=w.value===s;return n.jsxs("button",{type:"button",role:"radio","aria-checked":E,disabled:l,"data-value":w.value,tabIndex:w.value===v?0:-1,onClick:()=>o(w.value),onKeyDown:x,className:Z("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:w.label}),E?n.jsx(We,{size:16,className:"shrink-0 text-primary"}):null]},w.value)}),e[17]=l,e[18]=p,e[19]=x,e[20]=o,e[21]=v,e[22]=s,e[23]=S):S=e[23];let _;e[24]!==r||e[25]!==S?(_=n.jsx("div",{role:"radiogroup","aria-label":r,className:"max-h-[280px] overflow-y-auto",children:S}),e[24]=r,e[25]=S,e[26]=_):_=e[26];let N;return e[27]!==y||e[28]!==_?(N=n.jsxs("div",{className:"space-y-2",children:[y,_]}),e[27]=y,e[28]=_,e[29]=N):N=e[29],N}function _n(i){return i.value}function Ze(i){const e=k.c(16),{label:t,iconSize:s,className:o,iconClassName:l,labelClassName:r}=i,c=s===void 0?14:s;let a;e[0]!==o?(a=Z("inline-flex items-center gap-2",o),e[0]=o,e[1]=a):a=e[1];let u;e[2]!==l?(u=Z("shrink-0 animate-spin",l),e[2]=l,e[3]=u):u=e[3];let f;e[4]!==c||e[5]!==u?(f=n.jsx(ft,{size:c,className:u}),e[4]=c,e[5]=u,e[6]=f):f=e[6];let p;e[7]!==r?(p=Z("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]!==a||e[13]!==f||e[14]!==d?(h=n.jsxs("span",{className:a,children:[f,d]}),e[12]=a,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(i){const e=k.c(55),{card:t,connectionId:s,companionClient:o,selfClient:l,org:r,onDone:c,onIsPendingChange:a}=i;let u;e[0]!==s||e[1]!==r.id?(u=W.commerceDiscoveryCompanionGaProperties(r.id,s),e[0]=s,e[1]=r.id,e[2]=u):u=e[2];let f;e[3]!==o?(f=async()=>{const C=await o.callTool({name:"get-account-summaries",arguments:{}}),L=J(C);return Cn(L)},e[3]=o,e[4]=f):f=e[4];let p;e[5]!==u||e[6]!==f?(p={queryKey:u,queryFn:f},e[5]=u,e[6]=f,e[7]=p):p=e[7];const d=pt(p);let h;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=Be(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=Ge(j);let g;e[11]!==t||e[12]!==c||e[13]!==r||e[14]!==l?(g={card:t,selfClient:l,org:r,onDone:c},e[11]=t,e[12]=c,e[13]=r,e[14]=l,e[15]=g):g=e[15];const{save:m,isPending:b,error:y}=Je(g);let S,_;e[16]!==b||e[17]!==a?(S=()=>{a?.(b)},_=[b,a],e[16]=b,e[17]=a,e[18]=S,e[19]=_):(S=e[18],_=e[19]),D.useEffect(S,_);let N;if(e[20]!==x||e[21]!==m){let C;e[23]!==m?(C=async L=>{m(L)},e[23]=m,e[24]=C):C=e[24],N=x.handleSubmit(C),e[20]=x,e[21]=m,e[22]=N}else N=e[22];const w=N;if(d.isLoading){let C;return e[25]===Symbol.for("react.memo_cache_sentinel")?(C=n.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:n.jsx(Ze,{label:"Carregando propriedades..."})}),e[25]=C):C=e[25],C}if(d.isError){let C;return e[26]===Symbol.for("react.memo_cache_sentinel")?(C=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]=C):C=e[26],C}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 C;return e[29]===Symbol.for("react.memo_cache_sentinel")?(C=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]=C):C=e[29],C}let O;e[30]!==b||e[31]!==I?(O=C=>{const{field:L}=C;return n.jsxs(pe,{children:[n.jsx(ge,{children:n.jsx(Et,{options:I.flatMap(Tn),value:L.value,onChange:L.onChange,disabled:b,ariaLabel:"Propriedade do Google Analytics"})}),n.jsx(he,{})]})},e[30]=b,e[31]=I,e[32]=O):O=e[32];let T;e[33]!==x.control||e[34]!==O?(T=n.jsx(fe,{control:x.control,name:"propertyId",render:O}),e[33]=x.control,e[34]=O,e[35]=T):T=e[35];let U;e[36]!==x||e[37]!==T?(U=n.jsx(Ye,{...x,children:T}),e[36]=x,e[37]=T,e[38]=U):U=e[38];let P;e[39]!==y?(P=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]=P):P=e[40];let M;e[41]!==b||e[42]!==c?(M=n.jsx(H,{type:"button",variant:"outline",onClick:c,disabled:b,children:"Cancelar"}),e[41]=b,e[42]=c,e[43]=M):M=e[43];const q=b?"Salvando...":"Salvar";let z;e[44]!==b||e[45]!==q?(z=n.jsx(H,{type:"submit",disabled:b,children:q}),e[44]=b,e[45]=q,e[46]=z):z=e[46];let F;e[47]!==M||e[48]!==z?(F=n.jsxs(Qe,{className:"pt-4",children:[M,z]}),e[47]=M,e[48]=z,e[49]=F):F=e[49];let K;return e[50]!==w||e[51]!==U||e[52]!==P||e[53]!==F?(K=n.jsxs("form",{onSubmit:w,className:"space-y-4",children:[U,P,F]}),e[50]=w,e[51]=U,e[52]=P,e[53]=F,e[54]=K):K=e[54],K}function Tn(i){return i.options}function In(i){return i.options}const kn=He({siteUrl:ue().min(1,"Selecione um site")});function On(i){const e=k.c(59),{card:t,connectionId:s,companionClient:o,selfClient:l,org:r,contextSiteUrl:c,onDone:a,onIsPendingChange:u}=i;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]!==o?(p=async()=>{const C=await o.callTool({name:"list_sites",arguments:{}});return J(C).sites||[]},e[3]=o,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=pt(d);let v;e[8]===Symbol.for("react.memo_cache_sentinel")?(v=Be(kn),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=Ge(x);let m;e[11]!==t||e[12]!==a||e[13]!==r||e[14]!==l?(m={card:t,selfClient:l,org:r,onDone:a},e[11]=t,e[12]=a,e[13]=r,e[14]=l,e[15]=m):m=e[15];const{save:b,isPending:y,error:S}=Je(m);let _,N;e[16]!==y||e[17]!==u?(_=()=>{u?.(y)},N=[y,u],e[16]=y,e[17]=u,e[18]=_,e[19]=N):(_=e[18],N=e[19]),D.useEffect(_,N);let w;if(e[20]!==g||e[21]!==b){let C;e[23]!==b?(C=async L=>{b(L)},e[23]=b,e[24]=C):C=e[24],w=g.handleSubmit(C),e[20]=g,e[21]=b,e[22]=w}else w=e[22];const E=w;if(h.isLoading){let C;return e[25]===Symbol.for("react.memo_cache_sentinel")?(C=n.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:n.jsx(Ze,{label:"Carregando sites..."})}),e[25]=C):C=e[25],C}if(h.isError){let C;return e[26]===Symbol.for("react.memo_cache_sentinel")?(C=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]=C):C=e[26],C}let I,$;if(e[27]!==t.configurationState?.siteUrl||e[28]!==c||e[29]!==g||e[30]!==h.data){$=Symbol.for("react.early_return_sentinel");e:{if(I=h.data||[],I.length===0){let L;e[33]===Symbol.for("react.memo_cache_sentinel")?(L=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]=L):L=e[33],$=L;break e}const C=t.configurationState?.siteUrl;if(C&&g.getValues("siteUrl")!==C)g.setValue("siteUrl",C);else if(!C&&!g.getValues("siteUrl")){const L=jn(c,I);L&&g.setValue("siteUrl",L)}}e[27]=t.configurationState?.siteUrl,e[28]=c,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 O;e[34]!==y||e[35]!==I?(O=C=>{const{field:L}=C;return n.jsxs(pe,{children:[n.jsx(ge,{children:n.jsx(Et,{options:I.map(Un),value:L.value,onChange:L.onChange,disabled:y,ariaLabel:"Site verificado"})}),n.jsx(he,{})]})},e[34]=y,e[35]=I,e[36]=O):O=e[36];let T;e[37]!==g.control||e[38]!==O?(T=n.jsx(fe,{control:g.control,name:"siteUrl",render:O}),e[37]=g.control,e[38]=O,e[39]=T):T=e[39];let U;e[40]!==g||e[41]!==T?(U=n.jsx(Ye,{...g,children:T}),e[40]=g,e[41]=T,e[42]=U):U=e[42];let P;e[43]!==S?(P=S&&n.jsx("p",{role:"alert",className:"text-sm text-destructive",children:S instanceof Error?S.message:"Não foi possível salvar a configuração"}),e[43]=S,e[44]=P):P=e[44];let M;e[45]!==y||e[46]!==a?(M=n.jsx(H,{type:"button",variant:"outline",onClick:a,disabled:y,children:"Cancelar"}),e[45]=y,e[46]=a,e[47]=M):M=e[47];const q=y?"Salvando...":"Salvar";let z;e[48]!==y||e[49]!==q?(z=n.jsx(H,{type:"submit",disabled:y,children:q}),e[48]=y,e[49]=q,e[50]=z):z=e[50];let F;e[51]!==M||e[52]!==z?(F=n.jsxs(Qe,{className:"pt-4",children:[M,z]}),e[51]=M,e[52]=z,e[53]=F):F=e[53];let K;return e[54]!==E||e[55]!==U||e[56]!==P||e[57]!==F?(K=n.jsxs("form",{onSubmit:E,className:"space-y-4",children:[U,P,F]}),e[54]=E,e[55]=U,e[56]=P,e[57]=F,e[58]=K):K=e[58],K}function Un(i){return{value:i.siteUrl,label:i.siteUrl}}const An={vtex:Nn,"google-analytics":wn,"google-search-console":On};function Rn(){const i=k.c(3);let e;i[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:"size-9 shrink-0 animate-pulse rounded-lg bg-muted/60"}),n.jsx("div",{className:"h-4 w-32 animate-pulse rounded bg-muted/60"}),n.jsx("div",{className:"ml-auto h-8 w-20 animate-pulse rounded-lg bg-muted/60"})]}),i[0]=e):e=i[0];let t;i[1]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx("div",{className:"p-1",children:n.jsx("div",{className:"h-5 w-40 animate-pulse rounded bg-muted/60"})}),i[1]=t):t=i[1];let s;return i[2]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsxs("div",{className:"flex flex-col gap-2 rounded-2xl border border-border bg-card p-4",children:[e,n.jsxs("div",{className:"flex flex-col gap-1 px-1 py-2",children:[t,n.jsx("div",{className:"p-1",children:n.jsx("div",{className:"h-5 w-56 animate-pulse rounded bg-muted/60"})})]})]}),i[2]=s):s=i[2],s}function Ve(i){const e=k.c(3),{children:t}=i;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(We,{size:14,className:"shrink-0 text-blue-500"}),e[0]=s):s=e[0];let o;return e[1]!==t?(o=n.jsxs("div",{className:"flex items-center gap-2 p-1",children:[s,n.jsx("p",{className:"text-sm text-foreground",children:t})]}),e[1]=t,e[2]=o):o=e[2],o}function Pn(i){const e=k.c(45),{card:t,connecting:s,disabled:o,onConnect:l,org:r,selfClient:c,siteUrl:a,autoOpenConfigFieldKey:u,onAutoOpenConfigHandled:f}=i,p=t.linkedConnectionId;let d;e[0]!==t.configurationState?(d=gn(t.configurationState),e[0]=t.configurationState,e[1]=d):d=e[1];const h=d;let v;e[2]!==t.icon||e[3]!==t.title?(v=n.jsx(St,{icon:t.icon,name:t.title,size:"sm",fit:"contain",className:"p-1.5"}),e[2]=t.icon,e[3]=t.title,e[4]=v):v=e[4];let j;e[5]!==t.title?(j=n.jsx("p",{className:"flex-1 text-sm text-foreground",children:t.title}),e[5]=t.title,e[6]=j):j=e[6];let x;e[7]!==t.satisfied||e[8]!==t.title||e[9]!==s||e[10]!==o||e[11]!==l?(x=t.satisfied?n.jsxs("div",{className:"flex h-8 items-center gap-2 px-3 text-sm text-muted-foreground",children:[n.jsx(We,{size:16})," Conectado"]}):n.jsx(H,{type:"button",variant:"outline",size:"sm",disabled:o||s,onClick:l,"aria-label":`Conectar ${t.title}`,children:s?n.jsx(ft,{size:16,className:"animate-spin"}):"Conectar"}),e[7]=t.satisfied,e[8]=t.title,e[9]=s,e[10]=o,e[11]=l,e[12]=x):x=e[12];let g;e[13]!==v||e[14]!==j||e[15]!==x?(g=n.jsxs("div",{className:"flex items-center gap-2",children:[v,j,x]}),e[13]=v,e[14]=j,e[15]=x,e[16]=g):g=e[16];let m;e[17]!==t.checks?(m=t.checks!==null&&n.jsxs(Ve,{children:["+ ",t.checks," verificações"]}),e[17]=t.checks,e[18]=m):m=e[18];let b;e[19]!==t.headline?(b=t.headline&&n.jsx(Ve,{children:t.headline}),e[19]=t.headline,e[20]=b):b=e[20];let y;e[21]!==t.bullets?(y=t.bullets.map($n),e[21]=t.bullets,e[22]=y):y=e[22];let S;e[23]!==t.candidateConnectionId||e[24]!==t.satisfied||e[25]!==t.title?(S=!t.satisfied&&t.candidateConnectionId&&n.jsxs("p",{className:"px-1 text-xs text-muted-foreground",children:["Usando sua conexão existente de ",t.title]}),e[23]=t.candidateConnectionId,e[24]=t.satisfied,e[25]=t.title,e[26]=S):S=e[26];let _;e[27]!==m||e[28]!==b||e[29]!==y||e[30]!==S?(_=n.jsxs("div",{className:"flex flex-col gap-1 px-1 py-2",children:[m,b,y,S]}),e[27]=m,e[28]=b,e[29]=y,e[30]=S,e[31]=_):_=e[31];let N;e[32]!==u||e[33]!==t||e[34]!==p||e[35]!==f||e[36]!==r||e[37]!==h||e[38]!==c||e[39]!==a?(N=t.satisfied&&p&&n.jsx(D.Suspense,{fallback:n.jsx(Dn,{}),children:n.jsx(Kn,{card:t,org:r,selfClient:c,connectionId:p,savedConfigEntries:h,contextSiteUrl:a,autoOpen:hn({autoOpenFieldKey:u,card:t}),onAutoOpenHandled:f})}),e[32]=u,e[33]=t,e[34]=p,e[35]=f,e[36]=r,e[37]=h,e[38]=c,e[39]=a,e[40]=N):N=e[40];let w;return e[41]!==_||e[42]!==N||e[43]!==g?(w=n.jsxs("div",{className:"flex flex-col gap-2 rounded-2xl border border-border bg-card p-4",children:[g,_,N]}),e[41]=_,e[42]=N,e[43]=g,e[44]=w):w=e[44],w}function $n(i){return n.jsx(Ve,{children:i},i)}function Ln(i,e){return/(token|secret|password|appKey|key)$/i.test(i)?"••••••••":e}function zn(i){const e=k.c(2),{title:t}=i;let s;return e[0]!==t?(s=n.jsx("div",{className:"grid gap-3 border-t border-border pt-3",children:n.jsxs("p",{className:"text-xs text-muted-foreground",children:["A configuração ainda não está disponível aqui para ",t,"."]})}),e[0]=t,e[1]=s):s=e[1],s}function Dn(){const i=k.c(1);let e;return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"grid gap-3 border-t border-border pt-3",children:n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsx("div",{className:"h-5 w-24 animate-pulse rounded bg-muted/60"}),n.jsx("div",{className:"h-8 w-20 animate-pulse rounded-lg bg-muted/60"})]})}),i[0]=e):e=i[0],e}function Kn(i){const e=k.c(41),{card:t,org:s,selfClient:o,connectionId:l,savedConfigEntries:r,contextSiteUrl:c,autoOpen:a,onAutoOpenHandled:u}=i;let f;e[0]!==l||e[1]!==s.id||e[2]!==s.slug?(f={connectionId:l,orgId:s.id,orgSlug:s.slug},e[0]=l,e[1]=s.id,e[2]=s.slug,e[3]=f):f=e[3];const p=Ae(f),[d,h]=D.useState(a),[v,j]=D.useState(!1),x=An[t.bindingType];let g;e[4]!==a||e[5]!==u?(g=()=>{h(!1),a&&u()},e[4]=a,e[5]=u,e[6]=g):g=e[6];const m=g;let b;e[7]!==m||e[8]!==v?(b=U=>{if(!(!U&&v)){if(!U){m();return}h(!0)}},e[7]=m,e[8]=v,e[9]=b):b=e[9];const y=b;let S;e[10]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx("p",{className:"text-sm font-medium text-foreground",children:"Configuração"}),e[10]=S):S=e[10];let _;e[11]!==r.length?(_=r.length===0&&n.jsx("p",{className:"text-xs text-muted-foreground",children:"Nenhum valor de configuração foi salvo ainda."}),e[11]=r.length,e[12]=_):_=e[12];let N;e[13]!==_?(N=n.jsxs("div",{className:"grid gap-1",children:[S,_]}),e[13]=_,e[14]=N):N=e[14];let w;e[15]!==x||e[16]!==t.title||e[17]!==r.length?(w=r.length>0?n.jsxs(Ht,{children:[n.jsx(Bt,{asChild:!0,children:n.jsx(H,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>h(!0),"aria-label":`Editar configuração de ${t.title}`,disabled:!x,children:n.jsx(Qt,{size:14})})}),n.jsx(Gt,{children:"Editar configuração"})]}):n.jsx(H,{type:"button",variant:"outline",size:"sm",onClick:()=>h(!0),disabled:!x,children:"Configurar"}),e[15]=x,e[16]=t.title,e[17]=r.length,e[18]=w):w=e[18];let E;e[19]!==N||e[20]!==w?(E=n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[N,w]}),e[19]=N,e[20]=w,e[21]=E):E=e[21];let I;e[22]!==r?(I=r.length>0&&n.jsx("dl",{className:"grid gap-2",children:r.map(Mn)}),e[22]=r,e[23]=I):I=e[23];let $;e[24]!==E||e[25]!==I?($=n.jsxs("div",{className:"grid gap-3 border-t border-border pt-3",children:[E,I]}),e[24]=E,e[25]=I,e[26]=$):$=e[26];let O;e[27]!==x||e[28]!==t||e[29]!==m||e[30]!==p||e[31]!==l||e[32]!==c||e[33]!==d||e[34]!==y||e[35]!==s||e[36]!==o?(O=x?n.jsx(Kt,{open:d,onOpenChange:y,children:n.jsxs(Mt,{className:"sm:max-w-lg",children:[n.jsxs(Ft,{className:"flex-row items-center gap-3 space-y-0 text-left",children:[n.jsx(St,{icon:t.icon,name:t.title,size:"md",fit:"contain",className:"p-1.5"}),n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[n.jsx(qt,{children:t.title}),n.jsxs(Vt,{children:["Configure o ",t.title," para enriquecer os dados"]})]})]}),n.jsx(x,{card:t,connectionId:l,companionClient:p,selfClient:o,org:s,contextSiteUrl:c,onDone:m,onIsPendingChange:j})]})}):n.jsx(zn,{title:t.title}),e[27]=x,e[28]=t,e[29]=m,e[30]=p,e[31]=l,e[32]=c,e[33]=d,e[34]=y,e[35]=s,e[36]=o,e[37]=O):O=e[37];let T;return e[38]!==$||e[39]!==O?(T=n.jsxs(n.Fragment,{children:[$,O]}),e[38]=$,e[39]=O,e[40]=T):T=e[40],T}function Mn(i){return n.jsxs("div",{className:"flex items-center justify-between gap-3 text-sm",children:[n.jsx("dt",{className:"text-muted-foreground",children:i.label}),n.jsx("dd",{className:"truncate text-foreground",children:Ln(i.key,i.value)})]},i.key)}const Xe={vtex:{registryAppId:"deco/vtex",checks:49,headline:"Rupturas, PDPs incompletas e lacunas de atributos em todos os SKUs"},"google-analytics":{registryAppId:"deco/google-analytics",checks:49,headline:"Onde a receita vaza entre a visualização do produto e o checkout"},"google-search-console":{registryAppId:"deco/google-search-console",checks:49,headline:"Lacunas de visibilidade na busca e indexação em todo o seu catálogo"}};function Fn(i){const e=k.c(30),{selfClient:t,org:s,cdConnectionId:o}=i;let l;e[0]!==o||e[1]!==s.id||e[2]!==s.slug?(l={connectionId:o,orgId:s.id,orgSlug:s.slug},e[0]=o,e[1]=s.id,e[2]=s.slug,e[3]=l):l=e[3];const r=Ae(l);let c;e[4]!==o||e[5]!==s.id?(c=W.commerceDiscoveryCompanionSchema(s.id,o),e[4]=o,e[5]=s.id,e[6]=c):c=e[6];let a;e[7]!==r?(a=async()=>{const R=await r.callTool({name:"MCP_CONFIGURATION",arguments:{}});return J(R)},e[7]=r,e[8]=a):a=e[8];let u;e[9]!==c||e[10]!==a?(u={queryKey:c,queryFn:a},e[9]=c,e[10]=a,e[11]=u):u=e[11];const f=me(u),p=dn(f.data?.stateSchema??{properties:{}}),d=p.map(Zn),h=p.map(Jn).filter(Yn),v=p.filter(Wn).map(Qn),j=[...h,...v].sort().join(",");let x;e[12]!==o||e[13]!==s.id?(x=W.commerceDiscoveryConnection(s.id,o),e[12]=o,e[13]=s.id,e[14]=x):x=e[14];let g;e[15]!==o||e[16]!==t?(g=async()=>{const R=await t.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:o}});return J(R)},e[15]=o,e[16]=t,e[17]=g):g=e[17];let m;e[18]!==x||e[19]!==g?(m={queryKey:x,queryFn:g},e[18]=x,e[19]=g,e[20]=m):m=e[20];const y=me(m).data?.item?.configuration_state??null;let S;e[21]!==y?(S=R=>y?.[R.fieldKey]?.value,e[21]=y,e[22]=S):S=e[22];const _=p.map(S).filter(Gn),N=[...d.map(Bn),...h.map(Hn),..._.map(Vn)].sort().join(","),E=me({queryKey:W.commerceDiscoveryCompanionConnections(s.id,N),queryFn:async()=>{if(p.length===0)return{items:[]};const R=[{field:["app_name"],operator:"in",value:d},{field:["app_id"],operator:"in",value:h}];_.length>0&&R.push({field:["id"],operator:"in",value:_});const G=await t.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{operator:"or",conditions:R},limit:1e3}});return J(G)}}).data?.items??[],I=new Set(_),$=E.filter(R=>I.has(R.id)),O=$.filter(qn);let T;e[23]!==s.id||e[24]!==s.slug?(T=R=>({queryKey:W.commerceDiscoveryCompanionOAuthStatus(s.id,R.id),queryFn:async()=>{try{const G=await fetch(`/api/${encodeURIComponent(s.slug)}/connections/${encodeURIComponent(R.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]=T):T=e[25];const U=sn({queries:O.map(T)});let P;e[26]!==U?(P=(R,G)=>[R.id,U[G]?.data?.hasToken===!0],e[26]=U,e[27]=P):P=e[27];const M=new Map(O.map(P)),q={};for(const R of $)q[R.id]=!R.oauth_config||!!R.connection_token||M.get(R.id)===!0;const z=me({queryKey:W.commerceDiscoveryCompanionRegistry(s.id,j),queryFn:async()=>{if(p.length===0)return{items:[]};const R=mn(h,v),G=await Yt(bt.REGISTRY(s.id),s.id,s.slug,"COLLECTION_REGISTRY_APP_LIST",{...R?{where:R}:{},limit:1e3});return J(G)}}),F={},K={};for(const R of z.data?.items??[])F[R.id]=R,R.server?.name&&(K[R.server.name]=R);const C=bn({requirements:p,itemsById:F,itemsByName:K,connections:E,connectionReadiness:q,configurationState:y,curated:Xe});let L;return e[28]!==C?(L={cards:C},e[28]=C,e[29]=L):L=e[29],L}function qn(i){return i.oauth_config&&!i.connection_token}function Vn(i){return`linked:${i}`}function Hn(i){return`app:${i}`}function Bn(i){return`binding:${i}`}function Gn(i){return typeof i=="string"&&i.length>0}function Qn(i){return i.bindingType}function Wn(i){return!Xe[i.bindingType]}function Yn(i){return!!i}function Jn(i){return Xe[i.bindingType]?.registryAppId}function Zn(i){return i.bindingType}function Xn({selfClient:i,org:e,userId:t,cdConnectionId:s}){const o=ut(),[l,r]=D.useState(null),[c,a]=D.useState(null),u=async(p,d)=>{const h=await i.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:p,data:d}});return J(h)};async function f(p){r(p.fieldKey),a(null);try{let d=p.candidateConnectionId;if(!d){const m=Jt(p.registryItem,e.id,t,{remoteIndex:0}),b=m.connection_type==="STDIO",y=!!m.connection_url,S=b&&m.connection_headers&&typeof m.connection_headers=="object"&&"command"in m.connection_headers;if(!y&&!S)return a(`${p.title} cannot be connected: no connection method available`),!1;const _=await i.callTool({name:"COLLECTION_CONNECTIONS_CREATE",arguments:{data:m}});d=J(_).item.id}const h=d,v=await on({connectionId:h,orgId:e.id,orgSlug:e.slug,persistFallback:m=>u(h,{connection_token:m}).then(()=>{})});if(!v.ok)return a(`Couldn't sign in to ${p.title}: ${v.error}`),!1;const j=await i.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:s}}),x=J(j).item?.configuration_state??null,g=un(x,p.fieldKey,p.bindingType,h);return await u(s,{configuration_state:g}),await o.invalidateQueries({queryKey:W.commerceDiscoveryConnection(e.id,s)}),await o.invalidateQueries({queryKey:W.commerceDiscoveryCompanionConnectionsPrefix(e.id)}),!0}catch(d){return a(d instanceof Error?d.message:String(d)),!1}finally{r(null)}}return{connect:f,connectingFieldKey:l,error:c}}const et="flex min-h-0 flex-1 flex-col gap-6 md:grid md:flex-none md:gap-4";function tt(){const i=k.c(1);let e;return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx("p",{className:"text-2xl font-medium text-foreground",children:"Desbloqueie seu diagnóstico completo"}),n.jsx("p",{className:"text-base text-muted-foreground",children:"Conecte suas ferramentas para liberar mais de 100 verificações no seu funil."})]}),i[0]=e):e=i[0],e}function es(){const i=k.c(1);let e;return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"grid gap-4",children:[0,1,2].map(ts)}),i[0]=e):e=i[0],e}function ts(i){return n.jsx(Rn,{},i)}function nt(){const i=k.c(1);let e;return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsxs("div",{className:et,children:[n.jsx(tt,{}),n.jsx(es,{})]}),i[0]=e):e=i[0],e}function ns(i){const e=k.c(5),{onRetry:t}=i;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(tt,{}),e[0]=s):s=e[0];let o,l;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("p",{className:"text-sm text-foreground",children:"Não foi possível carregar as integrações complementares."}),l=n.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Algo deu errado ao carregar suas integrações."}),e[1]=o,e[2]=l):(o=e[1],l=e[2]);let r;return e[3]!==t?(r=n.jsxs("div",{className:et,children:[s,n.jsxs("div",{role:"alert",className:"rounded-2xl border border-border bg-card p-4",children:[o,l,n.jsx(H,{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 ss(i){const e=k.c(2);let t;return e[0]!==i?(t=n.jsx(gt,{children:s=>{const{reset:o}=s;return n.jsx(ht,{fallback:l=>{const{resetError:r}=l;return n.jsx(ns,{onRetry:()=>{o(),r()}})},children:n.jsx(D.Suspense,{fallback:n.jsx(nt,{}),children:n.jsx(is,{...i})})})}}),e[0]=i,e[1]=t):t=e[1],t}function is(i){const e=k.c(35),{org:t,cdConnectionId:s,siteUrl:o}=i,{data:l}=Oe.useSession(),r=l?.user?.id??"";let c;e[0]!==t.id||e[1]!==t.slug?(c={connectionId:jt,orgId:t.id,orgSlug:t.slug},e[0]=t.id,e[1]=t.slug,e[2]=c):c=e[2];const a=Ae(c);let u;e[3]!==s||e[4]!==t||e[5]!==a?(u={selfClient:a,org:t,cdConnectionId:s},e[3]=s,e[4]=t,e[5]=a,e[6]=u):u=e[6];const{cards:f}=Fn(u);let p;e[7]!==s||e[8]!==t||e[9]!==a||e[10]!==r?(p={selfClient:a,org:t,userId:r,cdConnectionId:s},e[7]=s,e[8]=t,e[9]=a,e[10]=r,e[11]=p):p=e[11];const{connect:d,connectingFieldKey:h,error:v}=Xn(p),[j,x]=D.useState(null);if(f.length===0)return null;const g=h!==null;let m;e[12]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(tt,{}),e[12]=m):m=e[12];let b;e[13]!==v?(b=v&&n.jsx("p",{role:"alert",className:"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]!==a||e[22]!==o){let _;e[24]!==j||e[25]!==g||e[26]!==d||e[27]!==h||e[28]!==t||e[29]!==a||e[30]!==o?(_=N=>{const w=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:a,siteUrl:o,autoOpenConfigFieldKey:j,onAutoOpenConfigHandled:()=>x(E=>E===N.fieldKey?null:E),onConnect:()=>{w()}},N.fieldKey)},e[24]=j,e[25]=g,e[26]=d,e[27]=h,e[28]=t,e[29]=a,e[30]=o,e[31]=_):_=e[31],y=f.map(_),e[15]=j,e[16]=g,e[17]=f,e[18]=d,e[19]=h,e[20]=t,e[21]=a,e[22]=o,e[23]=y}else y=e[23];let S;return e[32]!==b||e[33]!==y?(S=n.jsxs("div",{className:et,children:[m,n.jsx(Fe,{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-[60vh] md:flex-none",children:n.jsxs("div",{className:"grid gap-4",children:[b,y]})})]}),e[32]=b,e[33]=y,e[34]=S):S=e[34],S}const st="https://decocms-tanstack.deco-cx.workers.dev/agendar",os="Prefere que a gente acompanhe você?",rs="Agende uma chamada de 20 minutos e rodamos o diagnóstico com você, ao vivo.";function it({siteUrl:i,email:e}){const t=new URL(st);return i&&t.searchParams.set("siteUrl",i),e&&t.searchParams.set("email",e),t.toString()}function as(i){const e=k.c(9),{href:t,size:s,className:o}=i,l=t===void 0?st:t,r=s===void 0?"lg":s;let c;e[0]!==o?(c=Z("w-full",o),e[0]=o,e[1]=c):c=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(Nt,{size:16}),e[2]=a):a=e[2];let u;e[3]!==l?(u=n.jsxs("a",{href:l,target:"_blank",rel:"noreferrer",children:["Agendar uma reunião",a]}),e[3]=l,e[4]=u):u=e[4];let f;return e[5]!==r||e[6]!==c||e[7]!==u?(f=n.jsx(H,{asChild:!0,variant:"outline",size:r,className:c,children:u}),e[5]=r,e[6]=c,e[7]=u,e[8]=f):f=e[8],f}function ct(i){const e=k.c(2),{children:t}=i;let s;return e[0]!==t?(s=n.jsx("div",{className:"relative z-10 flex h-12 w-12 items-center justify-center rounded-full border border-border bg-card card-shadow",children:t}),e[0]=t,e[1]=s):s=e[1],s}function ls(){const i=k.c(4);let e;i[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(ct,{children:n.jsx(_t,{size:20,className:"text-muted-foreground"})}),i[0]=e):e=i[0];let t;i[1]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx("div",{className:"relative mx-4 h-px flex-1 bg-border",children:n.jsx("span",{className:"absolute top-1/2 h-1.5 w-1.5 -translate-x-1/2 -translate-y-1/2 rounded-full bg-foreground animate-connection-travel","aria-hidden":!0})}),i[1]=t):t=i[1];let s;i[2]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx("span",{className:"absolute inset-0 rounded-full border border-foreground/40 animate-connection-arrive","aria-hidden":!0}),i[2]=s):s=i[2];let o;return i[3]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsxs("div",{className:"flex items-center justify-between rounded-2xl border border-border/60 bg-muted/40 px-7 py-7",children:[e,t,n.jsxs("div",{className:"relative",children:[s,n.jsxs(ct,{children:[n.jsx("img",{src:"/logos/deco logo.svg",alt:"deco",className:"h-6 w-6 dark:hidden"}),n.jsx("img",{src:"/logos/deco logo negative.svg",alt:"deco",className:"hidden h-6 w-6 dark:block"})]})]})]}),i[3]=o):o=i[3],o}function ot(i){const e=k.c(4),{href:t}=i;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(ls,{}),e[0]=s):s=e[0];let o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsxs("div",{className:"grid gap-2",children:[n.jsx("h2",{className:"text-xl font-medium leading-7 text-foreground",children:os}),n.jsx("p",{className:"text-base leading-6 text-muted-foreground",children:rs})]}),e[1]=o):o=e[1];let l;return e[2]!==t?(l=n.jsx("div",{className:"relative flex h-full w-full items-center justify-center p-10",children:n.jsxs("div",{className:"flex w-full max-w-[380px] flex-col gap-6 rounded-3xl border border-border bg-card p-8 card-shadow",children:[s,o,n.jsx(as,{href:t,size:"xl"})]})}),e[2]=t,e[3]=l):l=e[3],l}function cs(i){const e=k.c(8),{className:t,href:s}=i,o=s===void 0?st:s;let l;e[0]!==t?(l=Z("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]=l):l=e[1];let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx("span",{className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground",children:n.jsx(_t,{size:20})}),e[2]=r):r=e[2];let c,a;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsxs("span",{className:"flex flex-1 flex-col gap-0.5",children:[n.jsx("span",{className:"text-base font-medium leading-5 text-foreground",children:"Prefere falar com uma pessoa?"}),n.jsx("span",{className:"text-sm leading-5 text-muted-foreground",children:"Agende uma chamada e rodamos o diagnóstico com você."})]}),a=n.jsx(Nt,{size:18,className:"shrink-0 text-muted-foreground"}),e[3]=c,e[4]=a):(c=e[3],a=e[4]);let u;return e[5]!==o||e[6]!==l?(u=n.jsxs("a",{href:o,target:"_blank",rel:"noreferrer",className:l,children:[r,c,a]}),e[5]=o,e[6]=l,e[7]=u):u=e[7],u}function wt(i){const e=k.c(10),{host:t}=i,s=`https://www.google.com/s2/favicons?domain=${t}&sz=128`;let o,l,r;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-7 w-7 dark:hidden"}),l=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]=o,e[1]=l,e[2]=r):(o=e[0],l=e[1],r=e[2]);let c;e[3]!==s?(c=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]=c):c=e[4];let a;e[5]!==t?(a=n.jsx("span",{className:"text-lg font-medium text-foreground",children:t}),e[5]=t,e[6]=a):a=e[6];let u;return e[7]!==c||e[8]!==a?(u=n.jsxs("div",{className:"flex items-center gap-3",children:[o,l,r,c,a]}),e[7]=c,e[8]=a,e[9]=u):u=e[9],u}const ds={workspace:"Preparando seu workspace de commerce...",generic:"Preparando..."};function ms(i){return ds[i]}function rt(i){const e=k.c(4),{variant:t}=i;let s;e[0]!==t?(s=ms(t),e[0]=t,e[1]=s):s=e[1];let o;return e[2]!==s?(o=n.jsx("div",{className:"flex justify-center py-4",role:"status","aria-live":"polite",children:n.jsx(Ze,{label:s,className:"text-muted-foreground"})}),e[2]=s,e[3]=o):o=e[3],o}function Oi(){const i=k.c(1);let e;return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(ps,{}),i[0]=e):e=i[0],e}const Tt=D.createContext(null),It=()=>D.useContext(Tt);function Q(i){const e=k.c(13);let t,s;e[0]!==i?({visual:s,...t}=i,e[0]=i,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o={from:"/commerce-onboarding"},e[3]=o):o=e[3];const l=xt(o),{data:r}=Oe.useSession(),c=r?.user?.email;let a;e[4]!==l.siteUrl||e[5]!==c?(a=it({siteUrl:l.siteUrl,email:c}),e[4]=l.siteUrl,e[5]=c,e[6]=a):a=e[6];const u=a;let f;e[7]!==u||e[8]!==s?(f=s??n.jsx(ot,{href:u}),e[7]=u,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 us={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:i=>`Código enviado para ${i}`,defaultSubtitle:"Entre ou crie uma nova conta",resetEmailSent:"Verifique seu e-mail para redefinir a senha.",continueWith:i=>`Continuar com ${i}`,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 fs(i){if(!i)return null;const e=Te(i);return e.ok?new URL(e.value).hostname:null}function dt(i){switch(i){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 i}}let mt=!1;function ps(){const i=xt({from:"/commerce-onboarding"}),{org:e,siteUrl:t}=i,s=fs(t);return!mt&&Ot()&&(mt=!0,Ut("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(gs,{requestedOrgSlug:e,siteUrl:t})})}function gs(i){const e=k.c(8),{requestedOrgSlug:t,siteUrl:s}=i,{data:o,isPending:l}=Oe.useSession(),r=It();if(l){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(Q,{children:n.jsx(rt,{variant:"generic"})}),e[0]=a):a=e[0],a}if(!o){const a=typeof window>"u"?"/commerce-onboarding":`${window.location.pathname}${window.location.search}`;let u;e[1]!==r?(u=r?n.jsx(wt,{host:r}):void 0,e[1]=r,e[2]=u):u=e[2];let f;return e[3]!==u?(f=n.jsx(Q,{children:n.jsx(Pt,{callbackUrl:a,allowAutoLogin:!1,title:"Desbloqueie seu diagnóstico completo",subtitle:null,brand:u,copy:us})}),e[3]=u,e[4]=f):f=e[4],f}let c;return e[5]!==t||e[6]!==s?(c=n.jsx(hs,{requestedOrgSlug:t,siteUrl:s}),e[5]=t,e[6]=s,e[7]=c):c=e[7],c}function hs(i){const e=k.c(40),{requestedOrgSlug:t,siteUrl:s}=i,o=yt(),l=At(),[r,c]=D.useState(null),[a,u]=D.useState(null),f=l.data?.map(ys)??[];let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={mutationFn:xs,retry:!1,onSuccess:m=>{u(m)}},e[0]=p):p=e[0];const d=ke(p);if(l.isPending){let m;return e[1]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(Q,{children:n.jsx(rt,{variant:"workspace"})}),e[1]=m):m=e[1],m}if(l.error){let m;return e[2]!==l?(m=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:()=>l.refetch()}),e[2]=l,e[3]=m):m=e[3],m}const h=t?f.find(m=>m.slug===t):null;if(h){let m;return e[4]!==h||e[5]!==s?(m=n.jsx(we,{org:h,initialSiteUrl:s}),e[4]=h,e[5]=s,e[6]=m):m=e[6],m}if(t){let m;return e[7]!==l?(m=n.jsx(Ie,{title:"Organização não encontrada",description:"Não conseguimos encontrar essa organização na sua conta.",actionLabel:"Tentar novamente",onRetry:()=>l.refetch()}),e[7]=l,e[8]=m):m=e[8],m}if(r){let m;return e[9]!==r||e[10]!==s?(m=n.jsx(we,{org:r,initialSiteUrl:s}),e[9]=r,e[10]=s,e[11]=m):m=e[11],m}if(f.length===1&&f[0]){let m;return e[12]!==f[0]||e[13]!==s?(m=n.jsx(we,{org:f[0],initialSiteUrl:s}),e[12]=f[0],e[13]=s,e[14]=m):m=e[14],m}if(f.length>1){let m;e[15]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(X,{title:"Escolha uma organização",description:"Selecione onde o diagnóstico de commerce deve continuar."}),e[15]=m):m=e[15];let b;e[16]===Symbol.for("react.memo_cache_sentinel")?(b=S=>c(S),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:[m,n.jsx(Fe,{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:n.jsx(at,{organizations:f,selectLabel:"Continuar",onSelected:b})})]})}),e[17]=f,e[18]=y):y=e[18],y}if(!a){let m;e[19]!==d?(m=()=>{d.reset(),d.mutate()},e[19]=d,e[20]=m):m=e[20];let b;return e[21]!==d||e[22]!==m?(b=n.jsx(vs,{mutation:d,onRetry:m}),e[21]=d,e[22]=m,e[23]=b):b=e[23],b}const v=a;if(v?.success&&(v.status==="created"||v.status==="joined"||v.status==="already_has_organization")&&v.organization){let m;return e[24]!==v.organization||e[25]!==s?(m=n.jsx(we,{org:v.organization,initialSiteUrl:s}),e[24]=v.organization,e[25]=s,e[26]=m):m=e[26],m}if(v?.status==="ambiguous"&&v.organizations&&v.organizations.length>0){let m;e[27]===Symbol.for("react.memo_cache_sentinel")?(m=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]=m):m=e[27];const b=v.domain??void 0;let y;e[28]!==o||e[29]!==s?(y=(_,N)=>{vt(),c({..._,slug:N}),o({to:"/commerce-onboarding",search:{org:N,siteUrl:s}})},e[28]=o,e[29]=s,e[30]=y):y=e[30];let S;return e[31]!==v.organizations||e[32]!==b||e[33]!==y?(S=n.jsx(Q,{children:n.jsxs("div",{className:"grid gap-10",children:[m,n.jsx(Fe,{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:n.jsx(at,{organizations:v.organizations,domain:b,onJoined:y})})]})}),e[31]=v.organizations,e[32]=b,e[33]=y,e[34]=S):S=e[34],S}const j=v?.error??"Não conseguimos determinar uma organização de commerce para esta conta.";let x;e[35]!==d?(x=()=>{u(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 xs(){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&&vt(),e}function ys(i){return{id:i.id,name:i.name,slug:i.slug,logo:i.logo??null}}function vs(i){const e=k.c(7),{mutation:t,onRetry:s}=i,o=D.useRef(!1);let l;e[0]!==t?(l=u=>{!u||o.current||(o.current=!0,t.mutate())},e[0]=t,e[1]=l):l=e[1];const r=l;if(t.error){let u;return e[2]!==s?(u=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]=u):u=e[3],u}let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(rt,{variant:"generic"}),e[4]=c):c=e[4];let a;return e[5]!==r?(a=n.jsx(Q,{children:n.jsx("div",{ref:r,children:c})}),e[5]=r,e[6]=a):a=e[6],a}function X(i){const e=k.c(8),{title:t,description:s}=i,o=It();let l;e[0]!==o?(l=o?n.jsx(wt,{host:o}):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]=o,e[1]=l):l=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 c;return e[5]!==l||e[6]!==r?(c=n.jsxs("div",{className:"grid gap-10",children:[l,r]}),e[5]=l,e[6]=r,e[7]=c):c=e[7],c}function Ie(i){const e=k.c(9),{title:t,description:s,actionLabel:o,onRetry:l}=i;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 c;e[3]!==o||e[4]!==l?(c=n.jsx(H,{type:"button",size:"xl",className:"w-full",onClick:l,children:o}),e[3]=o,e[4]=l,e[5]=c):c=e[5];let a;return e[6]!==r||e[7]!==c?(a=n.jsx(Q,{children:n.jsxs("div",{className:"grid gap-10",children:[r,c]})}),e[6]=r,e[7]=c,e[8]=a):a=e[8],a}function bs(i){return i.content?.find(e=>e.text)?.text??"A configuração do Commerce Discovery falhou."}function Ee(i){const e=i;if(e.isError)throw new Error(bs(e));return e.structuredContent??i}function we(i){const e=k.c(10),{org:t,initialSiteUrl:s}=i,{data:o}=Oe.useSession(),l=o?.user?.email;let r;e[0]!==s||e[1]!==l?(r=it({siteUrl:s,email:l}),e[0]=s,e[1]=l,e[2]=r):r=e[2];const c=r;let a;e[3]!==c?(a=n.jsx(ot,{href:c}),e[3]=c,e[4]=a):a=e[4];const u=a;let f;return e[5]!==s||e[6]!==u||e[7]!==t||e[8]!==o?.user?.email?(f=n.jsx(gt,{children:p=>{const{reset:d}=p;return n.jsx(ht,{fallback:h=>{const{error:v,resetError:j}=h;return n.jsx(Q,{visual:u,children:n.jsx(js,{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(D.Suspense,{fallback:n.jsx(kt,{visual:u}),children:n.jsx(Cs,{org:t,initialSiteUrl:s,sessionEmail:o?.user?.email},`${t.id}:${s??""}`)})})}}),e[5]=s,e[6]=u,e[7]=t,e[8]=o?.user?.email,e[9]=f):f=e[9],f}function kt(i){const e=k.c(3),{visual:t}=i;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(nt,{})]}),e[0]=s):s=e[0];let o;return e[1]!==t?(o=n.jsx(Q,{align:"fill",visual:t,children:s}),e[1]=t,e[2]=o):o=e[2],o}function js(i){const e=k.c(10),{orgName:t,message:s,onRetry:o}=i,l=`A configuração de commerce continuará em ${t}.`;let r;e[0]!==l?(r=n.jsx(X,{title:"Diagnóstico de commerce",description:l}),e[0]=l,e[1]=r):r=e[1];let c;e[2]!==s?(c=n.jsx(xe,{message:s}),e[2]=s,e[3]=c):c=e[3];let a;e[4]!==o?(a=n.jsx(H,{type:"button",size:"xl",className:"w-full",onClick:o,children:"Tentar novamente"}),e[4]=o,e[5]=a):a=e[5];let u;return e[6]!==r||e[7]!==c||e[8]!==a?(u=n.jsxs("div",{className:"grid gap-10",children:[r,c,a]}),e[6]=r,e[7]=c,e[8]=a,e[9]=u):u=e[9],u}function Cs(i){const e=k.c(111),{org:t,initialSiteUrl:s,sessionEmail:o}=i,l=yt();let r;e[0]!==t.id||e[1]!==t.slug?(r={connectionId:jt,orgId:t.id,orgSlug:t.slug},e[0]=t.id,e[1]=t.slug,e[2]=r):r=e[2];const c=Ae(r),[a,u]=D.useState(s??""),[f,p]=D.useState(null),[d,h]=D.useState(null),v=D.useRef(!1),j=bt.COMMERCE_DISCOVERY(t.id),x=zt(t.id),g=W.commerceDiscoveryConnection(t.id,j);let m;e[3]!==j||e[4]!==c?(m=async()=>{const A=await c.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:j}});return Ee(A)},e[3]=j,e[4]=c,e[5]=m):m=e[5];let b;e[6]!==g||e[7]!==m?(b={queryKey:g,queryFn:m,retry:!1},e[6]=g,e[7]=m,e[8]=b):b=e[8];const y=me(b),S=W.commerceDiscoveryVirtualMcp(t.id,x);let _;e[9]!==c||e[10]!==x?(_=async()=>{const A=await c.callTool({name:"COLLECTION_VIRTUAL_MCP_GET",arguments:{id:x}});return Ee(A)},e[9]=c,e[10]=x,e[11]=_):_=e[11];let N;e[12]!==S||e[13]!==_?(N={queryKey:S,queryFn:_,retry:!1},e[12]=S,e[13]=_,e[14]=N):N=e[14];const w=me(N);let E;e[15]!==c?(E=async A=>{const B=await c.callTool({name:"COMMERCE_DISCOVERY_SETUP",arguments:{siteUrl:A}});return Ee(B)},e[15]=c,e[16]=E):E=e[16];let I;e[17]!==y||e[18]!==w?(I=A=>{p(A),h(null),y.refetch(),w.refetch()},e[17]=y,e[18]=w,e[19]=I):I=e[19];let $;e[20]===Symbol.for("react.memo_cache_sentinel")?($=A=>{h(A instanceof Error?A.message:"A configuração do Commerce Discovery falhou.")},e[20]=$):$=e[20];let O;e[21]!==E||e[22]!==I?(O={mutationFn:E,retry:!1,onSuccess:I,onError:$},e[21]=E,e[22]=I,e[23]=O):O=e[23];const T=ke(O);let U;e[24]!==c?(U={mutationFn:async A=>{const B=await c.callTool({name:"COMMERCE_DISCOVERY_RUN",arguments:{siteUrl:A}});return Ee(B)},retry:!1},e[24]=c,e[25]=U):U=e[25];const P=ke(U),[M,q]=D.useState(null),z=!!y.data.item&&!!w.data.item,F=y.data.item,K=typeof F?.metadata?.siteUrl=="string"?F.metadata.siteUrl:void 0,C=s||a||K||"";let L;e[26]!==C||e[27]!==o?(L=it({siteUrl:C,email:o}),e[26]=C,e[27]=o,e[28]=L):L=e[28];const R=L;let G;e[29]!==R?(G=n.jsx(ot,{href:R}),e[29]=R,e[30]=G):G=e[30];const V=G;let ye;e[31]!==T?(ye=A=>{const B=Te(A);if(!B.ok){h(dt(B.error));return}h(null),T.mutate(B.value)},e[31]=T,e[32]=ye):ye=e[32];const te=ye;let ve;e[33]!==s||e[34]!==te||e[35]!==z?(ve=A=>{!A||v.current||z||!s||(v.current=!0,te(s))},e[33]=s,e[34]=te,e[35]=z,e[36]=ve):ve=e[36];const Re=ve;let be;e[37]!==te||e[38]!==a?(be=A=>{A.preventDefault(),te(a)},e[37]=te,e[38]=a,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 Ce;e[44]!==C||e[45]!==l||e[46]!==t.slug||e[47]!==ee||e[48]!==P?(Ce=async()=>{q(null);const A=Te(C);if(A.ok)try{await P.mutateAsync(A.value)}catch{q("Algo deu errado ao gerar seu relatório. Tente novamente em instantes.");return}localStorage.setItem(Rt.sidebarOpen(),JSON.stringify(!1)),l({to:"/$org/$taskId",params:{org:t.slug,taskId:crypto.randomUUID()},search:{virtualmcpid:ee.virtualMcpId,main:Lt(ee.connectionId,ee.toolName),chat:0}})},e[44]=C,e[45]=l,e[46]=t.slug,e[47]=ee,e[48]=P,e[49]=Ce):Ce=e[49];const Pe=Ce;if(z){let A;return e[50]!==R||e[51]!==V||e[52]!==C||e[53]!==Pe||e[54]!==t||e[55]!==ee||e[56]!==M||e[57]!==P.isPending?(A=n.jsx(Ss,{org:t,reportApp:ee,onOpenReport:Pe,isSubmitting:P.isPending,error:M,meetingUrl:R,meetingVisual:V,siteUrl:C}),e[50]=R,e[51]=V,e[52]=C,e[53]=Pe,e[54]=t,e[55]=ee,e[56]=M,e[57]=P.isPending,e[58]=A):A=e[58],A}if(T.isPending){let A;return e[59]!==V?(A=n.jsx(kt,{visual:V}),e[59]=V,e[60]=A):A=e[60],A}if(s){let A,B;if(e[61]!==V||e[62]!==Y||e[63]!==s||e[64]!==d||e[65]!==t.name||e[66]!==T.isPending||e[67]!==a){B=Symbol.for("react.early_return_sentinel");e:if(A=Te(s),!A.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:dt(A.error)});let ce;e[72]!==Y||e[73]!==d||e[74]!==T.isPending||e[75]!==a?(ce=n.jsx(Me,{siteUrl:a,error:d,isSubmitting:T.isPending,onSiteUrlChange:u,onSubmit:Y}),e[72]=Y,e[73]=d,e[74]=T.isPending,e[75]=a,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]!==V||e[82]!==de?(_e=n.jsx(Q,{visual:V,children:de}),e[81]=V,e[82]=de,e[83]=_e):_e=e[83],B=_e;break e}e[61]=V,e[62]=Y,e[63]=s,e[64]=d,e[65]=t.name,e[66]=T.isPending,e[67]=a,e[68]=A,e[69]=B}else A=e[68],B=e[69];if(B!==Symbol.for("react.early_return_sentinel"))return B;const Le=`O Commerce Discovery está sendo preparado para ${A.value}.`;let oe;e[84]!==Le?(oe=n.jsx(X,{title:"Diagnóstico de commerce",description:Le}),e[84]=Le,e[85]=oe):oe=e[85];let re;e[86]!==Y||e[87]!==d||e[88]!==T.isPending||e[89]!==a?(re=d?n.jsxs(n.Fragment,{children:[n.jsx(xe,{message:d}),n.jsx(Me,{siteUrl:a,error:null,isSubmitting:T.isPending,onSiteUrlChange:u,onSubmit:Y})]}):n.jsx(nt,{}),e[86]=Y,e[87]=d,e[88]=T.isPending,e[89]=a,e[90]=re):re=e[90];let ae;e[91]!==oe||e[92]!==re||e[93]!==Re?(ae=n.jsxs("div",{ref:Re,className:"grid gap-10",children:[oe,re]}),e[91]=oe,e[92]=re,e[93]=Re,e[94]=ae):ae=e[94];let Ne;return e[95]!==V||e[96]!==ae?(Ne=n.jsx(Q,{visual:V,children:ae}),e[95]=V,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]!==T.isPending||e[103]!==a?(se=n.jsx(Me,{siteUrl:a,error:d,isSubmitting:T.isPending,onSiteUrlChange:u,onSubmit:Y}),e[100]=Y,e[101]=d,e[102]=T.isPending,e[103]=a,e[104]=se):se=e[104];let ie;e[105]!==ne||e[106]!==se?(ie=n.jsxs("div",{className:"grid gap-10",children:[ne,se]}),e[105]=ne,e[106]=se,e[107]=ie):ie=e[107];let Se;return e[108]!==V||e[109]!==ie?(Se=n.jsx(Q,{visual:V,children:ie}),e[108]=V,e[109]=ie,e[110]=Se):Se=e[110],Se}function Me(i){const e=k.c(20),{siteUrl:t,error:s,isSubmitting:o,onSiteUrlChange:l,onSubmit:r}=i;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx("label",{className:"text-sm font-medium",htmlFor:"commerce-site-url",children:"URL do site"}),e[0]=c):c=e[0];let a;e[1]!==l?(a=x=>l(x.target.value),e[1]=l,e[2]=a):a=e[2];const u=!!s;let f;e[3]!==o||e[4]!==t||e[5]!==a||e[6]!==u?(f=n.jsx(Ue,{id:"commerce-site-url",type:"text",inputMode:"url",value:t,onChange:a,placeholder:"https://example.com","aria-invalid":u,disabled:o}),e[3]=o,e[4]=t,e[5]=a,e[6]=u,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:[c,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(Ct,{size:16}),e[13]=h):h=e[13];let v;e[14]!==o?(v=n.jsxs(H,{type:"submit",size:"xl",className:"w-full",disabled:o,children:["Continuar",h]}),e[14]=o,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 Ss(i){const e=k.c(26),{org:t,reportApp:s,onOpenReport:o,isSubmitting:l,error:r,meetingUrl:c,meetingVisual:a,siteUrl:u}=i;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]!==u?(p=n.jsx(ss,{org:t,cdConnectionId:s.connectionId,siteUrl:u}),e[1]=t,e[2]=s.connectionId,e[3]=u,e[4]=p):p=e[4];let d;e[5]!==c?(d=n.jsx(cs,{className:"md:hidden",href:c}),e[5]=c,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=l||!s.virtualMcpId,j=l?"Abrindo relatório...":"Ver relatório completo";let x;e[9]!==l?(x=l?null:n.jsx(Ct,{size:18}),e[9]=l,e[10]=x):x=e[10];let g;e[11]!==o||e[12]!==v||e[13]!==j||e[14]!==x?(g=n.jsxs(H,{type:"button",size:"xl",className:"w-full rounded-2xl text-base font-medium",onClick:o,disabled:v,children:[j,x]}),e[11]=o,e[12]=v,e[13]=j,e[14]=x,e[15]=g):g=e[15];let m;e[16]!==d||e[17]!==h||e[18]!==g?(m=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]=m):m=e[19];let b;e[20]!==p||e[21]!==m?(b=n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-6 md:grid md:gap-4",children:[f,p,m]}),e[20]=p,e[21]=m,e[22]=b):b=e[22];let y;return e[23]!==a||e[24]!==b?(y=n.jsx(Q,{align:"fill",visual:a,children:b}),e[23]=a,e[24]=b,e[25]=y):y=e[25],y}function xe(i){const e=k.c(2),{message:t}=i;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{Oi as default};
|