decocms 4.0.6 → 4.2.0
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-Dio95INd.js → AlertCircle-HztvGgEK.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-Dkv5fLL0.js → ArrowUpRight-CD45Pqa3.js} +1 -1
- package/dist/client/assets/{CheckCircle-pzf-q17S.js → CheckCircle-B93tZkib.js} +1 -1
- package/dist/client/assets/{ChevronDown-B6sLE2xR.js → ChevronDown-BHp2n33E.js} +1 -1
- package/dist/client/assets/{ChevronLeft-BQ_yXy4h.js → ChevronLeft-CkLGnzyI.js} +1 -1
- package/dist/client/assets/{ChevronRight-DK82xziN.js → ChevronRight-HkVZWjVD.js} +1 -1
- package/dist/client/assets/{ChevronUp-CI58apRt.js → ChevronUp-DLoyITzq.js} +1 -1
- package/dist/client/assets/{DotsVertical-CCj2JF9I.js → DotsVertical-DBVnta3o.js} +1 -1
- package/dist/client/assets/{Eye-DrIIwH0a.js → Eye-BuXBYPNx.js} +1 -1
- package/dist/client/assets/{FilterLines-GbfpFZU3.js → FilterLines-JdWf41nd.js} +1 -1
- package/dist/client/assets/{Globe01-i7PaDcFe.js → Globe01-DbyYsbkQ.js} +1 -1
- package/dist/client/assets/{Globe04-DwLIzRqi.js → Globe04-ht6-fzwU.js} +1 -1
- package/dist/client/assets/{HardDrive-B4oYS36K.js → HardDrive-QsbiOkra.js} +1 -1
- package/dist/client/assets/{Key01-D8nD65UB.js → Key01-B-rzooWI.js} +1 -1
- package/dist/client/assets/{LayoutLeft-CtPD4GHv.js → LayoutLeft-CvZZnjM_.js} +1 -1
- package/dist/client/assets/{LinkExternal01-BAv-tJ-n.js → LinkExternal01-C75h4nTA.js} +1 -1
- package/dist/client/assets/{Monitor01-DcULUfdd.js → Monitor01-C751a6VH.js} +1 -1
- package/dist/client/assets/{Palette-D-hau-3h.js → Palette-Cw4TmFXF.js} +1 -1
- package/dist/client/assets/{Play-D1sgqYSM.js → Play-BaPiITj6.js} +1 -1
- package/dist/client/assets/{Plus-C6B9usat.js → Plus-cqzweyhV.js} +1 -1
- package/dist/client/assets/{SearchLg-pYm4vmKf.js → SearchLg-BgcbIGrG.js} +1 -1
- package/dist/client/assets/{SearchMd-B4MY5w0a.js → SearchMd-B_E38g9S.js} +1 -1
- package/dist/client/assets/{Settings02-B3jhFlnY.js → Settings02-HJQMPAnK.js} +1 -1
- package/dist/client/assets/{Shield01-Cmee6fI0.js → Shield01-CYOeouzJ.js} +1 -1
- package/dist/client/assets/{Star01-cDTm87ar.js → Star01-BLuwEqBm.js} +1 -1
- package/dist/client/assets/{Stars01-Cp2MniF9.js → Stars01-bmKEIBXR.js} +1 -1
- package/dist/client/assets/{Stars02-DeYxW3ax.js → Stars02-CO1akjaP.js} +1 -1
- package/dist/client/assets/{Sun-MpUDOSI6.js → Sun-DGf33qzc.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-BzIaGAE4.js → SwitchHorizontal01-CtPAye2M.js} +1 -1
- package/dist/client/assets/{Tool01-B9ENuxHB.js → Tool01-Dc5WA1H4.js} +1 -1
- package/dist/client/assets/{Trash01-CB3z-7dC.js → Trash01-Dn19EDIc.js} +1 -1
- package/dist/client/assets/{Upload01-C6NdFiaS.js → Upload01-AmIm4zQN.js} +1 -1
- package/dist/client/assets/{User01-DmH6DXKh.js → User01-CYnD1B0h.js} +1 -1
- package/dist/client/assets/{Users01-DxmfiQX8.js → Users01-B3f8K1I8.js} +1 -1
- package/dist/client/assets/{Users03-BJwd0RYw.js → Users03-B7auzTEh.js} +1 -1
- package/dist/client/assets/{X-cfbREiE9.js → X-BJ5AK9_B.js} +1 -1
- package/dist/client/assets/{XCircle-BxrxGshe.js → XCircle-BEhXc7sQ.js} +1 -1
- package/dist/client/assets/{XClose-lpbFBumt.js → XClose-BaODJMh0.js} +1 -1
- package/dist/client/assets/{Zap-DuMrWPPZ.js → Zap-CDSogr5w.js} +1 -1
- package/dist/client/assets/{ZapSquare-BYxAEf78.js → ZapSquare-CmmJkOPb.js} +1 -1
- package/dist/client/assets/{ZoomOut-DgW92_SE.js → ZoomOut-9WiOjKDc.js} +1 -1
- package/dist/client/assets/{access-gate-Dbe8cdtw.js → access-gate-Bwf2CoM1.js} +1 -1
- package/dist/client/assets/{add-section-modal-D5TSTOmj.js → add-section-modal-CmQEBOgZ.js} +1 -1
- package/dist/client/assets/{agent-icon-JEYszNv_.js → agent-icon-Ba-0ZYgG.js} +1 -1
- package/dist/client/assets/agents-list-D5VkOHIG.js +1 -0
- package/dist/client/assets/{ai-providers-DjcO46iz.js → ai-providers-CZ5SMOKO.js} +1 -1
- package/dist/client/assets/{alert-dialog-Dp137axs.js → alert-dialog-Bqe6OAIL.js} +1 -1
- package/dist/client/assets/{alert-DaWrv2r4.js → alert-nxT5lZho.js} +1 -1
- package/dist/client/assets/app-editor-Cfln2sHr.js +1 -0
- package/dist/client/assets/{auth-B1T8pbnO.js → auth-CqOhN4mO.js} +1 -1
- package/dist/client/assets/{auth-catchall-B2cq36fc.js → auth-catchall-CNFrjBAq.js} +1 -1
- package/dist/client/assets/{auth-entry-1pea5jlq.js → auth-entry-DPV3aDXY.js} +1 -1
- package/dist/client/assets/{auth-split-layout-DxZYPw1r.js → auth-split-layout-Dp0-2xO6.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-B5YALq2v.js → authenticate-and-persist-oauth-BkWGH7gY.js} +1 -1
- package/dist/client/assets/{automation-list-row-CFFDN4lq.js → automation-list-row-CjVzmIPj.js} +1 -1
- package/dist/client/assets/{automation-runs-BcMS6CpQ.js → automation-runs-DIDLqvYF.js} +1 -1
- package/dist/client/assets/{automations-BTWYBSRC.js → automations-DEtrS6hH.js} +1 -1
- package/dist/client/assets/{avatar-DuIniPKR.js → avatar-DUFWGs9Z.js} +1 -1
- package/dist/client/assets/{badge-B6rmuxMV.js → badge-ULvYE549.js} +1 -1
- package/dist/client/assets/{block-document-DOf_Sdlf.js → block-document-Cl3urvMb.js} +1 -1
- package/dist/client/assets/{brand-context-CwKz05pn.js → brand-context-DU7I0d5o.js} +1 -1
- package/dist/client/assets/{buckets-BIC21nTe.js → buckets-4u7bKclV.js} +1 -1
- package/dist/client/assets/{bulk-category-panel-CVq9iFc4.js → bulk-category-panel-Bqpqm_Qj.js} +1 -1
- package/dist/client/assets/{capability-load-error-CdEx7ku5.js → capability-load-error-Xikv63T6.js} +1 -1
- package/dist/client/assets/{card-D_tTFSOo.js → card-DuZccs_2.js} +1 -1
- package/dist/client/assets/category-editor-BT4Cxoo3.js +1 -0
- package/dist/client/assets/{chat-context-B9cX9pqL.js → chat-context-Ba1J4Wbr.js} +1 -1
- package/dist/client/assets/{checkbox-CMlypndK.js → checkbox-CZumSc8B.js} +1 -1
- package/dist/client/assets/{cli-auth-success-kZiN0eE8.js → cli-auth-success-Ca86Sm5z.js} +1 -1
- package/dist/client/assets/{collection-detail-D94y3LFH.js → collection-detail-2DizOat2.js} +1 -1
- package/dist/client/assets/{collection-display-button-C5hCggKh.js → collection-display-button-DTaFqStv.js} +1 -1
- package/dist/client/assets/{collection-search-CKvajahs.js → collection-search-D2jsOcE8.js} +1 -1
- package/dist/client/assets/{collection-tabs-BJlB666Z.js → collection-tabs-BlI5WHJs.js} +1 -1
- package/dist/client/assets/{command-BqoeUfcd.js → command-ClUS1KMM.js} +1 -1
- package/dist/client/assets/commerce-onboarding-C9kK24Mf.js +1 -0
- package/dist/client/assets/{connect-desktop-dialog-Cluga9K_.js → connect-desktop-dialog-DPJKYCn-.js} +1 -1
- package/dist/client/assets/{connection-card-_tH4wROb.js → connection-card-CEtBve6r.js} +1 -1
- package/dist/client/assets/{connection-detail-DH8t2clL.js → connection-detail-dUoqAHFY.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-BITqGJc6.js → connection-form-helpers-DtWH2w6r.js} +1 -1
- package/dist/client/assets/{connections-Dr6ySl3K.js → connections-SZjaegFI.js} +1 -1
- package/dist/client/assets/{context-menu-CePpv_1d.js → context-menu-VSlW1NY7.js} +1 -1
- package/dist/client/assets/{decopilot-CD2vHDS0.js → decopilot-Y0nnLngo.js} +1 -1
- package/dist/client/assets/{decopilot-sse-pool-AUwBmjSL.js → decopilot-sse-pool-BR9ewfWR.js} +1 -1
- package/dist/client/assets/{dialog-DusnkLeX.js → dialog-onqVrhoh.js} +1 -1
- package/dist/client/assets/{domain-settings-rmL85W6Y.js → domain-settings-D6CfPi24.js} +1 -1
- package/dist/client/assets/{drawer-CKZsljPV.js → drawer-D6-83PZ_.js} +1 -1
- package/dist/client/assets/{dropdown-menu-BzkXPAU_.js → dropdown-menu-D9g8Sl4X.js} +1 -1
- package/dist/client/assets/{empty-state-oY4rli47.js → empty-state-0bsCiepl.js} +1 -1
- package/dist/client/assets/{extract-connection-data-gQ20kjhu.js → extract-connection-data-Dk45baha.js} +1 -1
- package/dist/client/assets/file-explorer-BtYpNmrX.js +2 -0
- package/dist/client/assets/{file-type-icon-CUqgllpd.js → file-type-icon-B1XEm_9k.js} +1 -1
- package/dist/client/assets/{files-COvN21aw.js → files-BvKHt3eY.js} +1 -1
- package/dist/client/assets/{form-Cnnlq12A.js → form-Dvd73W2C.js} +1 -1
- package/dist/client/assets/{general-nwoIPDNu.js → general-DrBGUycq.js} +1 -1
- package/dist/client/assets/github-installations-DzN1UQ4x.js +1 -0
- package/dist/client/assets/github-repo-picker-CB-ypGEp.js +1 -0
- package/dist/client/assets/{hooks-CmPpYlX_.js → hooks-tDbCB3C5.js} +1 -1
- package/dist/client/assets/{import-from-deco-dialog-DdKqKsGk.js → import-from-deco-dialog-wTIFbH1Y.js} +2 -2
- package/dist/client/assets/{index-BweBKOmQ.js → index--njjOK24.js} +1 -1
- package/dist/client/assets/{index-DwB1A79I.js → index-1nPke5TY.js} +1 -1
- package/dist/client/assets/{index-vgIM3ng9.js → index-BFlpjafk.js} +1 -1
- package/dist/client/assets/{index-oQ3tZ64P.js → index-BTZwvNmT.js} +1 -1
- package/dist/client/assets/{index-C0ajpxG1.js → index-B_kMLuGG.js} +1 -1
- package/dist/client/assets/{index-DitMkfVX.js → index-D3WaYPH4.js} +1 -1
- package/dist/client/assets/{index-BfEKx597.js → index-D3mRtkEB.js} +1 -1
- package/dist/client/assets/{index-B0K_XJu-.js → index-DL5xoOQh.js} +5 -5
- package/dist/client/assets/{index-DxT2kgMT.js → index-DeiWC-uz.js} +1 -1
- package/dist/client/assets/{index-Cf4zXsPJ.js → index-DkjetCaY.js} +1 -1
- package/dist/client/assets/{index-CZbxUADj.js → index-DmjWDqcd.js} +4 -4
- package/dist/client/assets/{index-wSgegl9c.js → index-DrUwfEHA.js} +1 -1
- package/dist/client/assets/{index-NuSjRgyn.js → index-Ftnw_1Xy.js} +1 -1
- package/dist/client/assets/index-PHpiDror.js +1 -0
- package/dist/client/assets/{index-redirect-dfKVlCop.js → index-redirect-B6SIDrdt.js} +1 -1
- package/dist/client/assets/{input-OOLypNKG.js → input-BlaLo4Ee.js} +1 -1
- package/dist/client/assets/{integration-icon-1rQakDyj.js → integration-icon-BF4ETuj8.js} +1 -1
- package/dist/client/assets/{label-D-uQU30d.js → label-GEC2UjFS.js} +1 -1
- package/dist/client/assets/{login-CeZYnJXS.js → login-DiR83Uim.js} +1 -1
- package/dist/client/assets/{mcp-oauth-CGEKoHUR.js → mcp-oauth-sGspCuYg.js} +1 -1
- package/dist/client/assets/{members-CcykGu_F.js → members-BDtCBiR9.js} +1 -1
- package/dist/client/assets/{monaco-editor-Da2HMuUr.js → monaco-editor-BKh1966p.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-BTGoaik-.js → monitoring-stats-row-Bdo8nd6T.js} +1 -1
- package/dist/client/assets/{oauth-callback-D4kppjBb.js → oauth-callback-BexQI-2W.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-cHoiq3Av.js → oauth-callback-ai-provider-1VSCaYAB.js} +1 -1
- package/dist/client/assets/{onboarding-p7c7aPqi.js → onboarding-CZfsqsuP.js} +1 -1
- package/dist/client/assets/{org-install-DId0j-AO.js → org-install-BCHSGKR9.js} +1 -1
- package/dist/client/assets/{org-layout-Bi1wXBWX.js → org-layout-D5zV7CtT.js} +1 -1
- package/dist/client/assets/{organization-choice-TjGJWTW1.js → organization-choice-B_qzGE3r.js} +1 -1
- package/dist/client/assets/{page-seo-form-DTe6HgSg.js → page-seo-form-Cg3EP0Kg.js} +1 -1
- package/dist/client/assets/page-seo-sheet-fP6EiExR.js +1 -0
- package/dist/client/assets/{popover-keNQSGqd.js → popover-BxWSrnHV.js} +1 -1
- package/dist/client/assets/post-editor-CpIwB3m_.js +1 -0
- package/dist/client/assets/{preview-dialog-BKNiQWET.js → preview-dialog-B6mTIXuI.js} +1 -1
- package/dist/client/assets/{primitives-B9INoLy1.js → primitives-DikyHxBV.js} +1 -1
- package/dist/client/assets/{profile-Bni8tqU4.js → profile-CR2pTbhO.js} +1 -1
- package/dist/client/assets/project-app-view-AkqKN49v.js +1 -0
- package/dist/client/assets/record-editor-Dm0nCNn9.js +1 -0
- package/dist/client/assets/registry-DhcyXlrd.js +2 -0
- package/dist/client/assets/{registry-layout-BHgeffkx.js → registry-layout-BQTxWcaj.js} +1 -1
- package/dist/client/assets/{require-capability-BTYPEDWZ.js → require-capability-B1UdIHXr.js} +1 -1
- package/dist/client/assets/{required-auth-layout-BObYAkHJ.js → required-auth-layout-CykGSzYq.js} +1 -1
- package/dist/client/assets/{reset-password-Cc-XE3QX.js → reset-password-BKTSF6vw.js} +1 -1
- package/dist/client/assets/{roles-ChcahCsR.js → roles-tVsESxlL.js} +1 -1
- package/dist/client/assets/{scroll-area-B34ocznc.js → scroll-area-B8CDvPWi.js} +1 -1
- package/dist/client/assets/{search-input-DcO2Ye3j.js → search-input-L82tU3Bd.js} +1 -1
- package/dist/client/assets/{secrets-BTyZzWOf.js → secrets-BPwXng2k.js} +1 -1
- package/dist/client/assets/{sections-editor-C9vQxffC.js → sections-editor-CuKTooG7.js} +2 -2
- package/dist/client/assets/{select-model-oQ7GNN5h.js → select-model-DdjL4UVJ.js} +1 -1
- package/dist/client/assets/{select-B0PHNa-r.js → select-ySr8WoR1.js} +1 -1
- package/dist/client/assets/seo-editor-BXwxtymi.js +1 -0
- package/dist/client/assets/{settings-layout-BKw4AivD.js → settings-layout-BBsWbAB4.js} +1 -1
- package/dist/client/assets/{settings-section-CsmwukIF.js → settings-section-ysOtzM09.js} +1 -1
- package/dist/client/assets/{sheet-Cenikbh0.js → sheet-X3VztLnq.js} +1 -1
- package/dist/client/assets/{shell-controls-BWTn1n_J.js → shell-controls-DTY4r0Sw.js} +1 -1
- package/dist/client/assets/{shell-layout-Cq_lzUpC.js → shell-layout-CdseotG7.js} +1 -1
- package/dist/client/assets/{shell-route-loading-BggkjeNi.js → shell-route-loading-DNSXVK6N.js} +1 -1
- package/dist/client/assets/{sidebar-B6Bc15Ll.js → sidebar-H8VlLCcE.js} +1 -1
- package/dist/client/assets/{skeleton-Dz0KaZHB.js → skeleton-DknPHMRJ.js} +1 -1
- package/dist/client/assets/{sortable.esm-TIFkXoZE.js → sortable.esm-Ctxa79RM.js} +1 -1
- package/dist/client/assets/{sso-Gw7T8MKT.js → sso-WkG_Ya3-.js} +1 -1
- package/dist/client/assets/{store-Q8YH-XhM.js → store-BisoAFLO.js} +1 -1
- package/dist/client/assets/store-registry-DKSrdFtG.js +2 -0
- package/dist/client/assets/{studio-tools-CoYqV6oY.js → studio-tools-BWRE75AX.js} +1 -1
- package/dist/client/assets/{switch-bOfplgn6.js → switch-DR4CkZQD.js} +1 -1
- package/dist/client/assets/{table-DQ6wSSYP.js → table-C4Cy5HHY.js} +1 -1
- package/dist/client/assets/{tabs-BFLKd-Fg.js → tabs-C77-FnFK.js} +1 -1
- package/dist/client/assets/{task-status-D6O_-A2L.js → task-status-DIimAguz.js} +1 -1
- package/dist/client/assets/{textarea-BvEvW0x2.js → textarea-DzC7ppsf.js} +1 -1
- package/dist/client/assets/{toggle-group-D69LxBwK.js → toggle-group-DUz2fIQy.js} +1 -1
- package/dist/client/assets/{toolbar-C_M9JPnc.js → toolbar-1nBak56S.js} +1 -1
- package/dist/client/assets/{tools-list-CbmZIzyR.js → tools-list-CTCIGteU.js} +1 -1
- package/dist/client/assets/{tooltip-BIkqUL7P.js → tooltip-Cr9AJTu1.js} +1 -1
- package/dist/client/assets/{types-BUxyMAUc.js → types-DIYYFrZY.js} +1 -1
- package/dist/client/assets/{use-ai-providers-Pn2gmaRt.js → use-ai-providers-DnoPML_E.js} +1 -1
- package/dist/client/assets/{use-automations-CFAPuCta.js → use-automations-B4dRXrYb.js} +1 -1
- package/dist/client/assets/{use-capability-C515Wh55.js → use-capability-CDOjpxJe.js} +1 -1
- package/dist/client/assets/{use-clock-tick-CsjHr6YI.js → use-clock-tick-DfB4yM8e.js} +1 -1
- package/dist/client/assets/{use-collections-CRpX6O3B.js → use-collections-C6o5d0Mn.js} +1 -1
- package/dist/client/assets/{use-connection-BtvYZVZj.js → use-connection-RPVug9uL.js} +1 -1
- package/dist/client/assets/{use-copy-DocWgb9C.js → use-copy-DByELpSB.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-8jViOFwz.js → use-create-virtual-mcp-DYyOoMN3.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-BrwGH0--.js → use-debounced-autosave-D9laFBFB.js} +1 -1
- package/dist/client/assets/{use-debounced-value-BvoHVGV4.js → use-debounced-value-Bs78etny.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-iJrJCUNi.js → use-decopilot-events-DavYF-aF.js} +1 -1
- package/dist/client/assets/{use-delete-connection-Ce5q0nKA.js → use-delete-connection-9x3-oXog.js} +1 -1
- package/dist/client/assets/{use-file-configs-ZWV6NAjd.js → use-file-configs-YQp2GWKp.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-DzCCXaoU.js → use-infinite-scroll-BmnUwDlC.js} +1 -1
- package/dist/client/assets/{use-join-requests-vqUkws7R.js → use-join-requests-wdTUrAXP.js} +1 -1
- package/dist/client/assets/{use-mcp-client-x8x64TSz.js → use-mcp-client-NDJy9UEP.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-QN0_2c09.js → use-mcp-prompts-ziW0oQXD.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-9T5nm0Q5.js → use-mcp-tools-ByN1fg_5.js} +1 -1
- package/dist/client/assets/{use-members-BFXkl0g2.js → use-members-CqCv95kS.js} +1 -1
- package/dist/client/assets/{use-mobile-xaWWq617.js → use-mobile-C1ok2Oda.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-CpELvU_F.js → use-navigate-to-agent-GB89TSmS.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-BIR7FL5o.js → use-org-auth-client-a0tV0I4a.js} +1 -1
- package/dist/client/assets/{use-org-fs-DCGS381R.js → use-org-fs-C4An_fXX.js} +1 -1
- package/dist/client/assets/{use-org-sso-BoaF2hTA.js → use-org-sso-DXOaOrbn.js} +1 -1
- package/dist/client/assets/{use-organization-roles-B5iKIkD7.js → use-organization-roles-CsUVzen8.js} +1 -1
- package/dist/client/assets/{use-organization-settings-B_G4Ejp_.js → use-organization-settings-rqcqUUeR.js} +1 -1
- package/dist/client/assets/{use-registry-connections-DNz9gvvs.js → use-registry-connections-BHtQ89zr.js} +1 -1
- package/dist/client/assets/{use-secrets-bhmOP2SP.js → use-secrets-CQoqzufN.js} +1 -1
- package/dist/client/assets/{use-status-sounds-R_QWPjXo.js → use-status-sounds-yeVUNOcg.js} +1 -1
- package/dist/client/assets/{use-view-mode-B87ZJI_e.js → use-view-mode-D7GDuIV9.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-DCcYk587.js → use-virtual-mcp-DQxIBquV.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-BiSAb_zK.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-9J-jWStM.js +1 -0
- package/dist/client/assets/{useSuspenseQueries-o6e7uDmk.js → useSuspenseQueries-DM2UC-1d.js} +1 -1
- package/dist/client/assets/{variant-calendar-B6ZbL0uc.js → variant-calendar-Dkf9XIru.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-162vFjPm.js → view-mode-toggle-1VKSbXaL.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +1 -1
- package/package.json +1 -1
- package/dist/client/assets/agents-list-Bs6PDiye.js +0 -1
- package/dist/client/assets/app-editor-Cs23fVdJ.js +0 -1
- package/dist/client/assets/category-editor-DAV1JiMh.js +0 -1
- package/dist/client/assets/commerce-onboarding-t0mGhL_f.js +0 -1
- package/dist/client/assets/file-explorer-C8PS1ht6.js +0 -2
- package/dist/client/assets/github-repo-picker-DSqWq_Dx.js +0 -1
- package/dist/client/assets/index-B8Sa0XLD.js +0 -1
- package/dist/client/assets/page-seo-sheet-kLMDb6L9.js +0 -1
- package/dist/client/assets/post-editor-CbWTpMhy.js +0 -1
- package/dist/client/assets/project-app-view-EWOWcGuk.js +0 -1
- package/dist/client/assets/record-editor-c-nI_YJs.js +0 -1
- package/dist/client/assets/registry-ZWnWY_l-.js +0 -2
- package/dist/client/assets/seo-editor-DYFogy6b.js +0 -1
- package/dist/client/assets/store-registry-B0mLOiu-.js +0 -2
- package/dist/client/assets/useInfiniteQuery-nhHcm16X.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-DEVNYJtE.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as M,r as B,l as oe,j as n,B as W,m as Fe,d as _e,K as X,o as Me,s as be,n as qe,p as Ke,i as tt,k as nt,t as Ve,q as ye,v as te,Q as vt,E as jt,a as He,u as Ct,w as Bt,b as St,x as Gt,y as _t,L as Qt}from"./index-CZbxUADj.js";import{A as Wt}from"./auth-entry-1pea5jlq.js";import{A as Yt}from"./auth-split-layout-DxZYPw1r.js";import{O as gt}from"./organization-choice-TjGJWTW1.js";import{f as Jt}from"./tab-id-BptcWVWa.js";import{I as ke}from"./input-OOLypNKG.js";import{u as Be,W as Nt,S as Et,g as Zt,C as Xt}from"./use-mcp-client-x8x64TSz.js";import{i as wt}from"./XCircle-BxrxGshe.js";import{I as st}from"./integration-icon-1rQakDyj.js";import{D as Ie,a as It,b as Tt,c as Ot,d as kt,e as At}from"./dialog-DusnkLeX.js";import{T as Rt,a as Pt,b as Ut}from"./tooltip-BIkqUL7P.js";import{i as ot}from"./CheckCircle-pzf-q17S.js";import{i as en,t as zt}from"./agent-icon-JEYszNv_.js";import{g as tn,c as nn,e as sn}from"./extract-connection-data-gQ20kjhu.js";import{F as ve,a as Ge,b as je,c as $e,d as Ce,e as Se,f as on}from"./form-Cnnlq12A.js";import{i as rn}from"./ChevronUp-CI58apRt.js";import{s as an,a as Lt}from"./Eye-DrIIwH0a.js";import{i as ln}from"./Settings02-B3jhFlnY.js";import{u as cn}from"./useSuspenseQueries-o6e7uDmk.js";import{a as dn}from"./authenticate-and-persist-oauth-B5YALq2v.js";import{i as $t}from"./ArrowUpRight-Dkv5fLL0.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./avatar-DuIniPKR.js";import"./User01-DmH6DXKh.js";import"./auth-B1T8pbnO.js";import"./X-cfbREiE9.js";import"./AlertCircle-Dio95INd.js";import"./Tool01-B9ENuxHB.js";import"./SwitchHorizontal01-BzIaGAE4.js";import"./ZapSquare-BYxAEf78.js";import"./Users03-BJwd0RYw.js";import"./ChevronDown-B6sLE2xR.js";import"./ChevronLeft-BQ_yXy4h.js";import"./ChevronRight-DK82xziN.js";import"./DotsVertical-CCj2JF9I.js";import"./Stars02-DeYxW3ax.js";import"./ZoomOut-DgW92_SE.js";import"./Globe01-i7PaDcFe.js";import"./FilterLines-GbfpFZU3.js";import"./Star01-cDTm87ar.js";import"./Globe04-DwLIzRqi.js";import"./HardDrive-B4oYS36K.js";import"./Key01-D8nD65UB.js";import"./LayoutLeft-CtPD4GHv.js";import"./LinkExternal01-BAv-tJ-n.js";import"./Monitor01-DcULUfdd.js";import"./Sun-MpUDOSI6.js";import"./Palette-D-hau-3h.js";import"./Play-D1sgqYSM.js";import"./Plus-C6B9usat.js";import"./SearchLg-pYm4vmKf.js";import"./SearchMd-B4MY5w0a.js";import"./Shield01-Cmee6fI0.js";import"./Stars01-Cp2MniF9.js";import"./Trash01-CB3z-7dC.js";import"./Upload01-C6NdFiaS.js";import"./Users01-DxmfiQX8.js";import"./XClose-lpbFBumt.js";import"./Zap-DuMrWPPZ.js";import"./label-D-uQU30d.js";import"./mcp-oauth-CGEKoHUR.js";const mn=/^[a-zA-Z][a-zA-Z\d+.-]*:/,un=/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//,fn=/^[^\s/:?#]+\.[^\s/:?#]+:\d+(?:[/?#]|$)/,pn=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;function Ee(o){const e=o.trim();if(!e)return{ok:!1,error:"Enter a website URL."};const t=mn.test(e),s=un.test(e),i=fn.test(e);if(t&&!s&&!i)return{ok:!1,error:"Use an HTTP or HTTPS website URL."};const c=s?e:`https://${e}`;let r;try{r=new URL(c)}catch{return{ok:!1,error:"Enter a valid website URL."}}if(r.protocol!=="http:"&&r.protocol!=="https:")return{ok:!1,error:"Use an HTTP or HTTPS website URL."};const l=r.hostname.split(".");return l.length<2||l.some(a=>!a||!pn.test(a))?{ok:!1,error:"Enter a valid website URL."}:(r.protocol="https:",{ok:!0,value:r.origin})}function Xe(o){const e=M.c(14),{children:t,className:s,wrapperClassName:i}=o,[c,r]=B.useState(!0);let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=j=>{if(!j)return;const v=()=>{const f=j.scrollHeight-j.scrollTop-j.clientHeight<8;r(f)};v(),j.addEventListener("scroll",v,{passive:!0});const g=new ResizeObserver(v);g.observe(j);for(const f of Array.from(j.children))g.observe(f);return()=>{j.removeEventListener("scroll",v),g.disconnect()}},e[0]=l):l=e[0];const a=l;let u;e[1]!==i?(u=oe("relative",i),e[1]=i,e[2]=u):u=e[2];let m;e[3]!==t||e[4]!==s?(m=n.jsx("div",{ref:a,className:s,children:t}),e[3]=t,e[4]=s,e[5]=m):m=e[5];const p=c?"opacity-0":"opacity-100";let d;e[6]!==p?(d=oe("pointer-events-none absolute inset-x-0 -bottom-px h-[72px]","bg-gradient-to-t from-sidebar from-[6px] to-transparent","backdrop-blur-[1px] [mask-image:linear-gradient(to_top,black_6px,transparent)]","transition-opacity duration-200",p),e[6]=p,e[7]=d):d=e[7];let h;e[8]!==d?(h=n.jsx("div",{"aria-hidden":!0,className:d}),e[8]=d,e[9]=h):h=e[9];let b;return e[10]!==u||e[11]!==m||e[12]!==h?(b=n.jsxs("div",{className:u,children:[m,h]}),e[10]=u,e[11]=m,e[12]=h,e[13]=b):b=e[13],b}function gn(o){const e=o.properties;if(!e)return[];const t=[];for(const[s,i]of Object.entries(e)){const l=i?.properties?.__type?.const;typeof l=="string"&&l.length>0&&t.push({fieldKey:s,bindingType:l})}return t}function hn(o,e){const t=[];if(o.length&&t.push({field:["id"],operator:"in",value:o}),e.length&&t.push({field:["name"],operator:"in",value:e}),t.length!==0)return t.length===1?t[0]:{operator:"or",conditions:t}}function se(o){const e=o;if(e.isError)throw new Error(e.content?.find(t=>t.text)?.text??"Tool call failed");return e.structuredContent??o}function xn(o,e,t,s){return{...o??{},[e]:{__type:t,value:s}}}function et(o){return o==null?!1:typeof o=="string"?o.trim().length>0:typeof o=="number"||typeof o=="boolean"?!0:Array.isArray(o)?o.some(et):typeof o=="object"?Object.entries(o).some(([e,t])=>!e.startsWith("__")&&et(t)):!1}function yn(o){const e={accountName:"Nome da conta",appKey:"App Key",appToken:"App Token",propertyId:"Propriedade",siteUrl:"Site"};return e[o]?e[o]:o.replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/\b\w/g,t=>t.toUpperCase())}function bn(o){return et(o)?typeof o=="string"?o.trim():typeof o=="number"||typeof o=="boolean"?String(o):JSON.stringify(o):null}function vn(o){return o?Object.entries(o).flatMap(([e,t])=>{if(e.startsWith("__"))return[];const s=bn(t);return s?[{key:e,label:yn(e),value:s}]:[]}):[]}function jn({autoOpenFieldKey:o,card:e}){return o===e.fieldKey&&e.satisfied&&!!e.linkedConnectionId}function Cn(o,e,t){const s=o.filter(i=>i.app_name===e||!!t&&i.app_id===t);return s.length===0?null:(s.sort((i,c)=>{const r=l=>l.status==="active"?0:1;return r(i)!==r(c)?r(i)-r(c):(c.updated_at??"").localeCompare(i.updated_at??"")}),s[0].id)}function Sn(o){return o.server?.icons?.[0]?.src??tn(o.server?.repository)??null}function _n(o,e){const t=o._meta?.["mcp.mesh"];return t?.friendlyName||t?.friendly_name||o.title||o.server?.title||o.server?.name||e}function Nn(o){const e=[],t=new Map(o.connections.map(s=>[s.id,s]));for(const s of o.requirements){const i=o.curated[s.bindingType],c=i?o.itemsById[i.registryAppId]:o.itemsByName[s.bindingType];if(!c)continue;const r=o.configurationState?.[s.fieldKey]?.value,l=r?t.get(r):void 0,a=r&&l?r:null,u=a?o.connectionReadiness?.[a]!==!1:!1,m=!!a&&u,p=m?void 0:o.saBindings?.[s.bindingType],d=m||!!p,h=m?"oauth":p?"sa":null;e.push({fieldKey:s.fieldKey,bindingType:s.bindingType,registryItem:c,title:_n(c,s.bindingType),icon:Sn(c),headline:i?.headline??c._meta?.["mcp.mesh"]?.short_description??null,area:i?.area??null,bullets:i?.bullets??[],satisfied:d,candidateConnectionId:d?null:a||Cn(o.connections,s.bindingType,i?.registryAppId),linkedConnectionId:a,configurationState:l?.configuration_state??null,boundVia:h,boundResource:p?.resource??null})}return e}function En(o,e){if(!o)return null;const t=i=>{if(i.startsWith("sc-domain:"))return i.substring(10);try{let r=new URL(i.startsWith("http")?i:`https://${i}`).hostname||"";return r.startsWith("www.")&&(r=r.substring(4)),r}catch{return i}},s=t(o);for(const i of e)if(t(i.siteUrl)===s)return i.siteUrl;return null}function wn(o){return(o?.response?.accountSummaries??[]).map(s=>({account:s.account,options:(s.propertySummaries??[]).map(i=>({value:i.property,label:`${i.displayName} (${s.displayName})`}))}))}function ht(o){const e=M.c(38);let t,s,i,c,r;e[0]!==o?({value:r,onChange:s,placeholder:i,className:t,...c}=o,e[0]=o,e[1]=t,e[2]=s,e[3]=i,e[4]=c,e[5]=r):(t=e[1],s=e[2],i=e[3],c=e[4],r=e[5]);const[l,a]=B.useState(!1),[u,m]=B.useState(!1);let p;e[6]!==r?(p=async()=>{if(r)try{await navigator.clipboard.writeText(r),m(!0),setTimeout(()=>m(!1),2e3)}catch(U){console.error("Failed to copy text: ",U)}},e[6]=r,e[7]=p):p=e[7];const d=p;let h;e[8]!==l?(h=()=>{a(!l)},e[8]=l,e[9]=h):h=e[9];const b=h,j=l?"text":"password";let v;e[10]!==t?(v=oe("pr-20",t),e[10]=t,e[11]=v):v=e[11];let g;e[12]!==s||e[13]!==i||e[14]!==c||e[15]!==j||e[16]!==v||e[17]!==r?(g=n.jsx(ke,{type:j,value:r,onChange:s,placeholder:i,className:v,...c}),e[12]=s,e[13]=i,e[14]=c,e[15]=j,e[16]=v,e[17]=r,e[18]=g):g=e[18];const f=l?"Hide password":"Show password";let y;e[19]!==l?(y=l?n.jsx(ln,{size:16}):n.jsx(an,{size:16}),e[19]=l,e[20]=y):y=e[20];let x;e[21]!==f||e[22]!==y||e[23]!==b?(x=n.jsx(W,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:b,title:f,children:y}),e[21]=f,e[22]=y,e[23]=b,e[24]=x):x=e[24];const C=!r,E=u?"Copied!":"Copy token";let S;e[25]!==u?(S=u?n.jsx(rn,{size:16}):n.jsx(Lt,{size:16}),e[25]=u,e[26]=S):S=e[26];let _;e[27]!==d||e[28]!==E||e[29]!==S||e[30]!==C?(_=n.jsx(W,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:d,disabled:C,title:E,children:S}),e[27]=d,e[28]=E,e[29]=S,e[30]=C,e[31]=_):_=e[31];let N;e[32]!==_||e[33]!==x?(N=n.jsxs("div",{className:"absolute right-1 top-1 flex items-center gap-1 h-8",children:[x,_]}),e[32]=_,e[33]=x,e[34]=N):N=e[34];let I;return e[35]!==N||e[36]!==g?(I=n.jsxs("div",{className:"relative",children:[g,N]}),e[35]=N,e[36]=g,e[37]=I):I=e[37],I}function it(o){const e=M.c(19),{card:t,selfClient:s,org:i,onDone:c,onError:r}=o,l=Fe();let a;e[0]!==t||e[1]!==s?(a=async v=>{const g={...t.configurationState??{},...v};await s.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:t.linkedConnectionId||t.candidateConnectionId,data:{configuration_state:g}}})},e[0]=t,e[1]=s,e[2]=a):a=e[2];let u;e[3]!==c||e[4]!==i||e[5]!==l?(u=async()=>{await l.invalidateQueries({queryKey:X.commerceDiscoveryCompanionConnectionsPrefix(i.id)}),c()},e[3]=c,e[4]=i,e[5]=l,e[6]=u):u=e[6];let m;e[7]!==r?(m=v=>{r?.(v)},e[7]=r,e[8]=m):m=e[8];let p;e[9]!==a||e[10]!==u||e[11]!==m?(p={mutationFn:a,onSuccess:u,onError:m},e[9]=a,e[10]=u,e[11]=m,e[12]=p):p=e[12];const d=_e(p);let h;e[13]!==d?(h=v=>d.mutate(v),e[13]=d,e[14]=h):h=e[14];const b=h;let j;return e[15]!==d.error||e[16]!==d.isPending||e[17]!==b?(j={save:b,isPending:d.isPending,error:d.error},e[15]=d.error,e[16]=d.isPending,e[17]=b,e[18]=j):j=e[18],j}const In=Me({accountName:be().min(1,"Informe o nome da conta"),appKey:be().optional(),appToken:be().optional()});function Tn(o){const e=M.c(63),{card:t,selfClient:s,org:i,onDone:c,onIsPendingChange:r}=o;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=qe(In),e[0]=l):l=e[0];const a=t.configurationState?.accountName||"",u=t.configurationState?.appKey||"",m=t.configurationState?.appToken||"";let p;e[1]!==a||e[2]!==u||e[3]!==m?(p={resolver:l,defaultValues:{accountName:a,appKey:u,appToken:m}},e[1]=a,e[2]=u,e[3]=m,e[4]=p):p=e[4];const d=Ke(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 b;e[10]!==t.configurationState||e[11]!==d?(b=[t.configurationState,d],e[10]=t.configurationState,e[11]=d,e[12]=b):b=e[12],B.useEffect(h,b);let j;e[13]!==t||e[14]!==c||e[15]!==i||e[16]!==s?(j={card:t,selfClient:s,org:i,onDone:c},e[13]=t,e[14]=c,e[15]=i,e[16]=s,e[17]=j):j=e[17];const{save:v,isPending:g,error:f}=it(j);let y,x;e[18]!==g||e[19]!==r?(x=()=>{r?.(g)},y=[g,r],e[18]=g,e[19]=r,e[20]=y,e[21]=x):(y=e[20],x=e[21]),B.useEffect(x,y);let C;if(e[22]!==d||e[23]!==v){let D;e[25]!==v?(D=async w=>{v(w)},e[25]=v,e[26]=D):D=e[26],C=d.handleSubmit(D),e[22]=d,e[23]=v,e[24]=C}else C=e[24];const E=C;let S;e[27]!==g?(S=D=>{const{field:w}=D;return n.jsxs(je,{children:[n.jsx($e,{children:"Nome da conta"}),n.jsx(Ce,{children:n.jsx(ke,{placeholder:"Nome da sua conta VTEX",...w,disabled:g})}),n.jsx(Se,{})]})},e[27]=g,e[28]=S):S=e[28];let _;e[29]!==d.control||e[30]!==S?(_=n.jsx(ve,{control:d.control,name:"accountName",render:S}),e[29]=d.control,e[30]=S,e[31]=_):_=e[31];let N;e[32]!==g?(N=D=>{const{field:w}=D;return n.jsxs(je,{children:[n.jsx($e,{children:"App Key (opcional)"}),n.jsx(Ce,{children:n.jsx(ht,{placeholder:"App Key da VTEX",...w,disabled:g})}),n.jsx(Se,{})]})},e[32]=g,e[33]=N):N=e[33];let I;e[34]!==d.control||e[35]!==N?(I=n.jsx(ve,{control:d.control,name:"appKey",render:N}),e[34]=d.control,e[35]=N,e[36]=I):I=e[36];let U;e[37]!==g?(U=D=>{const{field:w}=D;return n.jsxs(je,{children:[n.jsx($e,{children:"App Token (opcional)"}),n.jsx(Ce,{children:n.jsx(ht,{placeholder:"App Token da VTEX",...w,disabled:g})}),n.jsx(Se,{})]})},e[37]=g,e[38]=U):U=e[38];let k;e[39]!==d.control||e[40]!==U?(k=n.jsx(ve,{control:d.control,name:"appToken",render:U}),e[39]=d.control,e[40]=U,e[41]=k):k=e[41];let T;e[42]!==d||e[43]!==_||e[44]!==I||e[45]!==k?(T=n.jsxs(Ge,{...d,children:[_,I,k]}),e[42]=d,e[43]=_,e[44]=I,e[45]=k,e[46]=T):T=e[46];let R;e[47]!==f?(R=f&&n.jsx("p",{role:"alert",className:"text-sm text-destructive",children:f instanceof Error?f.message:"Não foi possível salvar a configuração"}),e[47]=f,e[48]=R):R=e[48];let A;e[49]!==g||e[50]!==c?(A=n.jsx(W,{type:"button",variant:"outline",onClick:c,disabled:g,children:"Cancelar"}),e[49]=g,e[50]=c,e[51]=A):A=e[51];const q=g?"Salvando...":"Salvar";let K;e[52]!==g||e[53]!==q?(K=n.jsx(W,{type:"submit",disabled:g,children:q}),e[52]=g,e[53]=q,e[54]=K):K=e[54];let $;e[55]!==A||e[56]!==K?($=n.jsxs(Ie,{className:"pt-4",children:[A,K]}),e[55]=A,e[56]=K,e[57]=$):$=e[57];let V;return e[58]!==E||e[59]!==T||e[60]!==R||e[61]!==$?(V=n.jsxs("form",{onSubmit:E,className:"space-y-4",children:[T,R,$]}),e[58]=E,e[59]=T,e[60]=R,e[61]=$,e[62]=V):V=e[62],V}function Dt(o){const e=M.c(30),{options:t,value:s,onChange:i,disabled:c,ariaLabel:r,searchPlaceholder:l}=o,a=l===void 0?"Buscar...":l,[u,m]=B.useState("");let p,d,h;if(e[0]!==t||e[1]!==u||e[2]!==s){const _=u.trim().toLowerCase();p=_?t.filter(N=>N.label.toLowerCase().includes(_)):t,d=p.map(On),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 b=h;let j;e[6]!==c||e[7]!==d||e[8]!==i?(j=function(N){if(c||!["ArrowDown","ArrowRight","ArrowUp","ArrowLeft","Home","End"].includes(N.key))return;N.preventDefault();const U=N.currentTarget.dataset.value,k=d.indexOf(U),T=d.length;if(T===0)return;let R;N.key==="ArrowDown"||N.key==="ArrowRight"?R=(k+1)%T:N.key==="ArrowUp"||N.key==="ArrowLeft"?R=(k-1+T)%T:N.key==="Home"?R=0:R=T-1;const A=d[R];i(A),N.currentTarget.closest('[role="radiogroup"]')?.querySelector(`[data-value="${CSS.escape(A)}"]`)?.focus()},e[6]=c,e[7]=d,e[8]=i,e[9]=j):j=e[9];const v=j;let g;e[10]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(en,{size:16,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),e[10]=g):g=e[10];let f;e[11]===Symbol.for("react.memo_cache_sentinel")?(f=_=>m(_.target.value),e[11]=f):f=e[11];const y=`Buscar ${r}`;let x;e[12]!==c||e[13]!==u||e[14]!==a||e[15]!==y?(x=n.jsxs("div",{className:"relative",children:[g,n.jsx(ke,{type:"text",value:u,onChange:f,disabled:c,placeholder:a,"aria-label":y,className:"h-8 pl-8"})]}),e[12]=c,e[13]=u,e[14]=a,e[15]=y,e[16]=x):x=e[16];let C;e[17]!==c||e[18]!==p||e[19]!==v||e[20]!==i||e[21]!==b||e[22]!==s?(C=p.length===0?n.jsx("div",{className:"px-2 py-2 text-sm text-muted-foreground",children:"Nenhum resultado"}):p.map(_=>{const N=_.value===s;return n.jsxs("button",{type:"button",role:"radio","aria-checked":N,disabled:c,"data-value":_.value,tabIndex:_.value===b?0:-1,onClick:()=>i(_.value),onKeyDown:v,className:oe("flex w-full items-center justify-between gap-2 rounded-sm px-2 py-2 text-left text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:pointer-events-none disabled:opacity-50",N?"bg-muted font-medium text-foreground":"text-foreground hover:bg-muted/50"),children:[n.jsx("span",{className:"truncate",children:_.label}),N?n.jsx(ot,{size:16,className:"shrink-0 text-primary"}):null]},_.value)}),e[17]=c,e[18]=p,e[19]=v,e[20]=i,e[21]=b,e[22]=s,e[23]=C):C=e[23];let E;e[24]!==r||e[25]!==C?(E=n.jsx("div",{role:"radiogroup","aria-label":r,className:"max-h-[280px] overflow-y-auto",children:C}),e[24]=r,e[25]=C,e[26]=E):E=e[26];let S;return e[27]!==x||e[28]!==E?(S=n.jsxs("div",{className:"space-y-2",children:[x,E]}),e[27]=x,e[28]=E,e[29]=S):S=e[29],S}function On(o){return o.value}function rt(o){const e=M.c(16),{label:t,iconSize:s,className:i,iconClassName:c,labelClassName:r}=o,l=s===void 0?14:s;let a;e[0]!==i?(a=oe("inline-flex items-center gap-2",i),e[0]=i,e[1]=a):a=e[1];let u;e[2]!==c?(u=oe("shrink-0 animate-spin",c),e[2]=c,e[3]=u):u=e[3];let m;e[4]!==l||e[5]!==u?(m=n.jsx(tt,{size:l,className:u}),e[4]=l,e[5]=u,e[6]=m):m=e[6];let p;e[7]!==r?(p=oe("text-sm",r),e[7]=r,e[8]=p):p=e[8];let d;e[9]!==t||e[10]!==p?(d=n.jsx("span",{className:p,children:t}),e[9]=t,e[10]=p,e[11]=d):d=e[11];let h;return e[12]!==a||e[13]!==m||e[14]!==d?(h=n.jsxs("span",{className:a,children:[m,d]}),e[12]=a,e[13]=m,e[14]=d,e[15]=h):h=e[15],h}const kn=Me({propertyId:be().min(1,"Selecione uma propriedade")});function An(o){const e=M.c(68),{card:t,connectionId:s,companionClient:i,selfClient:c,org:r,onDone:l,onDisconnect:a,onIsPendingChange:u}=o;let m;e[0]!==s||e[1]!==r.id?(m=X.commerceDiscoveryCompanionGaProperties(r.id,s),e[0]=s,e[1]=r.id,e[2]=m):m=e[2];let p;e[3]!==i?(p=async()=>{const P=await i.callTool({name:"get-account-summaries",arguments:{}}),L=se(P);return wn(L)},e[3]=i,e[4]=p):p=e[4];let d;e[5]!==m||e[6]!==p?(d={queryKey:m,queryFn:p},e[5]=m,e[6]=p,e[7]=d):d=e[7];const h=nt(d);let b;e[8]===Symbol.for("react.memo_cache_sentinel")?(b=qe(kn),e[8]=b):b=e[8];const j=t.configurationState?.propertyId||"";let v;e[9]!==j?(v={resolver:b,defaultValues:{propertyId:j}},e[9]=j,e[10]=v):v=e[10];const g=Ke(v);let f;e[11]!==t||e[12]!==l||e[13]!==r||e[14]!==c?(f={card:t,selfClient:c,org:r,onDone:l},e[11]=t,e[12]=l,e[13]=r,e[14]=c,e[15]=f):f=e[15];const{save:y,isPending:x,error:C}=it(f);let E,S;e[16]!==x||e[17]!==u?(E=()=>{u?.(x)},S=[x,u],e[16]=x,e[17]=u,e[18]=E,e[19]=S):(E=e[18],S=e[19]),B.useEffect(E,S);let _;if(e[20]!==g||e[21]!==y){let P;e[23]!==y?(P=async L=>{y(L)},e[23]=y,e[24]=P):P=e[24],_=g.handleSubmit(P),e[20]=g,e[21]=y,e[22]=_}else _=e[22];const N=_;if(h.isLoading){let P;return e[25]===Symbol.for("react.memo_cache_sentinel")?(P=n.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:n.jsx(rt,{label:"Carregando propriedades..."})}),e[25]=P):P=e[25],P}if(h.isError){let P;return e[26]===Symbol.for("react.memo_cache_sentinel")?(P=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]=P):P=e[26],P}let I;e[27]!==h.data?(I=h.data||[],e[27]=h.data,e[28]=I):I=e[28];const U=I;if(U.flatMap(Pn).length===0){let P;e[29]===Symbol.for("react.memo_cache_sentinel")?(P=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]=P):P=e[29];let L;e[30]!==a?(L=a?n.jsx("button",{type:"button",onClick:a,className:"text-xs text-muted-foreground underline underline-offset-2 hover:text-destructive",children:"Desconectar conta"}):n.jsx("span",{}),e[30]=a,e[31]=L):L=e[31];let J;e[32]!==l?(J=n.jsx(W,{type:"button",variant:"outline",onClick:l,children:"Fechar"}),e[32]=l,e[33]=J):J=e[33];let Y;return e[34]!==L||e[35]!==J?(Y=n.jsxs("div",{className:"space-y-4",children:[P,n.jsxs(Ie,{className:"flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[L,J]})]}),e[34]=L,e[35]=J,e[36]=Y):Y=e[36],Y}let T;e[37]!==x||e[38]!==U?(T=P=>{const{field:L}=P;return n.jsxs(je,{children:[n.jsx(Ce,{children:n.jsx(Dt,{options:U.flatMap(Rn),value:L.value,onChange:L.onChange,disabled:x,ariaLabel:"Propriedade do Google Analytics"})}),n.jsx(Se,{})]})},e[37]=x,e[38]=U,e[39]=T):T=e[39];let R;e[40]!==g.control||e[41]!==T?(R=n.jsx(ve,{control:g.control,name:"propertyId",render:T}),e[40]=g.control,e[41]=T,e[42]=R):R=e[42];let A;e[43]!==g||e[44]!==R?(A=n.jsx(Ge,{...g,children:R}),e[43]=g,e[44]=R,e[45]=A):A=e[45];let q;e[46]!==C?(q=C&&n.jsx("p",{role:"alert",className:"text-sm text-destructive",children:C instanceof Error?C.message:"Não foi possível salvar a configuração"}),e[46]=C,e[47]=q):q=e[47];let K;e[48]!==x||e[49]!==a?(K=a?n.jsx("button",{type:"button",onClick:a,disabled:x,className:"text-xs text-muted-foreground underline underline-offset-2 hover:text-destructive disabled:opacity-50",children:"Desconectar conta"}):n.jsx("span",{}),e[48]=x,e[49]=a,e[50]=K):K=e[50];let $;e[51]!==x||e[52]!==l?($=n.jsx(W,{type:"button",variant:"outline",onClick:l,disabled:x,children:"Cancelar"}),e[51]=x,e[52]=l,e[53]=$):$=e[53];const V=x?"Salvando...":"Salvar";let D;e[54]!==x||e[55]!==V?(D=n.jsx(W,{type:"submit",disabled:x,children:V}),e[54]=x,e[55]=V,e[56]=D):D=e[56];let w;e[57]!==$||e[58]!==D?(w=n.jsxs("div",{className:"flex gap-2",children:[$,D]}),e[57]=$,e[58]=D,e[59]=w):w=e[59];let z;e[60]!==K||e[61]!==w?(z=n.jsxs(Ie,{className:"flex-col gap-2 pt-4 sm:flex-row sm:items-center sm:justify-between",children:[K,w]}),e[60]=K,e[61]=w,e[62]=z):z=e[62];let H;return e[63]!==N||e[64]!==A||e[65]!==q||e[66]!==z?(H=n.jsxs("form",{onSubmit:N,className:"space-y-4",children:[A,q,z]}),e[63]=N,e[64]=A,e[65]=q,e[66]=z,e[67]=H):H=e[67],H}function Rn(o){return o.options}function Pn(o){return o.options}const Un=Me({siteUrl:be().min(1,"Selecione um site")});function zn(o){const e=M.c(59),{card:t,connectionId:s,companionClient:i,selfClient:c,org:r,contextSiteUrl:l,onDone:a,onIsPendingChange:u}=o;let m;e[0]!==s||e[1]!==r.id?(m=X.commerceDiscoveryCompanionGscSites(r.id,s),e[0]=s,e[1]=r.id,e[2]=m):m=e[2];let p;e[3]!==i?(p=async()=>{const w=await i.callTool({name:"list_sites",arguments:{}});return se(w).sites||[]},e[3]=i,e[4]=p):p=e[4];let d;e[5]!==m||e[6]!==p?(d={queryKey:m,queryFn:p},e[5]=m,e[6]=p,e[7]=d):d=e[7];const h=nt(d);let b;e[8]===Symbol.for("react.memo_cache_sentinel")?(b=qe(Un),e[8]=b):b=e[8];const j=t.configurationState?.siteUrl||"";let v;e[9]!==j?(v={resolver:b,defaultValues:{siteUrl:j}},e[9]=j,e[10]=v):v=e[10];const g=Ke(v);let f;e[11]!==t||e[12]!==a||e[13]!==r||e[14]!==c?(f={card:t,selfClient:c,org:r,onDone:a},e[11]=t,e[12]=a,e[13]=r,e[14]=c,e[15]=f):f=e[15];const{save:y,isPending:x,error:C}=it(f);let E,S;e[16]!==x||e[17]!==u?(E=()=>{u?.(x)},S=[x,u],e[16]=x,e[17]=u,e[18]=E,e[19]=S):(E=e[18],S=e[19]),B.useEffect(E,S);let _;if(e[20]!==g||e[21]!==y){let w;e[23]!==y?(w=async z=>{y(z)},e[23]=y,e[24]=w):w=e[24],_=g.handleSubmit(w),e[20]=g,e[21]=y,e[22]=_}else _=e[22];const N=_;if(h.isLoading){let w;return e[25]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:n.jsx(rt,{label:"Carregando sites..."})}),e[25]=w):w=e[25],w}if(h.isError){let w;return e[26]===Symbol.for("react.memo_cache_sentinel")?(w=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]=w):w=e[26],w}let I,U;if(e[27]!==t.configurationState?.siteUrl||e[28]!==l||e[29]!==g||e[30]!==h.data){U=Symbol.for("react.early_return_sentinel");e:{if(I=h.data||[],I.length===0){let z;e[33]===Symbol.for("react.memo_cache_sentinel")?(z=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]=z):z=e[33],U=z;break e}const w=t.configurationState?.siteUrl;if(w&&g.getValues("siteUrl")!==w)g.setValue("siteUrl",w);else if(!w&&!g.getValues("siteUrl")){const z=En(l,I);z&&g.setValue("siteUrl",z)}}e[27]=t.configurationState?.siteUrl,e[28]=l,e[29]=g,e[30]=h.data,e[31]=I,e[32]=U}else I=e[31],U=e[32];if(U!==Symbol.for("react.early_return_sentinel"))return U;let k;e[34]!==x||e[35]!==I?(k=w=>{const{field:z}=w;return n.jsxs(je,{children:[n.jsx(Ce,{children:n.jsx(Dt,{options:I.map(Ln),value:z.value,onChange:z.onChange,disabled:x,ariaLabel:"Site verificado"})}),n.jsx(Se,{})]})},e[34]=x,e[35]=I,e[36]=k):k=e[36];let T;e[37]!==g.control||e[38]!==k?(T=n.jsx(ve,{control:g.control,name:"siteUrl",render:k}),e[37]=g.control,e[38]=k,e[39]=T):T=e[39];let R;e[40]!==g||e[41]!==T?(R=n.jsx(Ge,{...g,children:T}),e[40]=g,e[41]=T,e[42]=R):R=e[42];let A;e[43]!==C?(A=C&&n.jsx("p",{role:"alert",className:"text-sm text-destructive",children:C instanceof Error?C.message:"Não foi possível salvar a configuração"}),e[43]=C,e[44]=A):A=e[44];let q;e[45]!==x||e[46]!==a?(q=n.jsx(W,{type:"button",variant:"outline",onClick:a,disabled:x,children:"Cancelar"}),e[45]=x,e[46]=a,e[47]=q):q=e[47];const K=x?"Salvando...":"Salvar";let $;e[48]!==x||e[49]!==K?($=n.jsx(W,{type:"submit",disabled:x,children:K}),e[48]=x,e[49]=K,e[50]=$):$=e[50];let V;e[51]!==q||e[52]!==$?(V=n.jsxs(Ie,{className:"pt-4",children:[q,$]}),e[51]=q,e[52]=$,e[53]=V):V=e[53];let D;return e[54]!==N||e[55]!==R||e[56]!==A||e[57]!==V?(D=n.jsxs("form",{onSubmit:N,className:"space-y-4",children:[R,A,V]}),e[54]=N,e[55]=R,e[56]=A,e[57]=V,e[58]=D):D=e[58],D}function Ln(o){return{value:o.siteUrl,label:o.siteUrl}}const $n={vtex:Tn,"google-analytics":An,"google-search-console":zn},Ne="deco-reader@decocms.iam.gserviceaccount.com",Ft={"google-analytics":"ga4","google-search-console":"gsc"},Mt={ga4:{label:"Google Analytics",resourceLabel:"ID da propriedade",resourcePlaceholder:"ex: 123456789",resourceHint:"No GA4: Admin → Detalhes da propriedade → ID da propriedade (só números).",connectSteps:["Abra o Google Analytics (GA4) da sua loja.","Vá em Admin → Acesso à propriedade (Gerenciamento de acesso).",`Clique em + → Adicionar usuários, cole ${Ne} e conceda o papel Leitor.`,"Copie o ID da propriedade (Admin → Detalhes da propriedade) e cole abaixo."]},gsc:{label:"Google Search Console",resourceLabel:"Site / propriedade",resourcePlaceholder:"ex: sc-domain:sualoja.com.br",resourceHint:"Use o mesmo formato que aparece no Search Console: sc-domain:sualoja.com.br ou https://www.sualoja.com.br/.",connectSteps:["Abra o Google Search Console da sua loja.","Vá em Configurações → Usuários e permissões.",`Clique em Adicionar usuário, cole ${Ne} e escolha permissão Completa.`,"Copie o endereço do site como aparece no seletor de propriedades e cole abaixo."]}};function Dn(o,e){const t=Mt[o].label;switch(e){case"no-access":return{title:`Ainda não conseguimos acessar este recurso no ${t}.`,steps:o==="ga4"?[`Confirme que ${Ne} foi adicionado em Admin → Acesso à propriedade com o papel Leitor.`,"Confira se o ID da propriedade está correto (só números, sem o prefixo 'properties/').","A concessão de acesso pode levar alguns segundos — tente novamente."]:[`Confirme que ${Ne} foi adicionado em Configurações → Usuários e permissões.`,"A permissão precisa ser Completa ou Restrita — 'Não verificado' não funciona.","Confira se o endereço do site está exatamente como aparece no Search Console."]};case"no-web-stream":return{title:"Esta propriedade do GA4 não tem um fluxo de dados da Web (site) configurado.",steps:["No GA4, vá em Admin → Fluxos de dados.","Clique em Adicionar fluxo → Web.","Informe a URL do site da sua loja e salve o fluxo.","Volte aqui e tente vincular de novo. (Propriedades só de app precisam de vínculo manual — fale com o suporte.)"]};case"no-match":return{title:"O recurso informado não corresponde ao domínio desta loja.",steps:o==="ga4"?["Verifique se digitou o ID da propriedade certa — provavelmente é de outro site.","No GA4, o site medido aparece em Admin → Fluxos de dados → (seu fluxo Web) → URL do stream."]:["Verifique se selecionou a propriedade do Search Console referente a esta loja.","O endereço precisa cobrir o mesmo domínio do diagnóstico."]};case"resource_already_bound":return{title:"Este recurso já está vinculado a outra loja.",steps:["Se este recurso é realmente desta loja, fale com o suporte para uma revisão manual.","Caso tenha digitado o id errado, confira e tente novamente."]};default:return{title:"Não foi possível verificar o acesso a este recurso.",steps:["Revise os passos de acesso acima e tente novamente.","Se persistir, fale com o suporte."]}}}function Fn(o){const e=M.c(76),{provider:t,siteUrl:s,selfClient:i,org:c,initialResourceId:r,onDone:l,onIsPendingChange:a,onOAuthInstead:u}=o,m=Mt[t],p=Fe(),[d,h]=B.useState(null);let b,j;if(e[0]!==m.resourceLabel){const O=Me({resourceId:be().trim().min(1,`Informe o ${m.resourceLabel.toLowerCase()}`)});j=Ke,b=qe(O),e[0]=m.resourceLabel,e[1]=b,e[2]=j}else b=e[1],j=e[2];const v=r??"";let g;e[3]!==v?(g={resourceId:v},e[3]=v,e[4]=g):g=e[4];let f;e[5]!==b||e[6]!==g?(f={resolver:b,defaultValues:g},e[5]=b,e[6]=g,e[7]=f):f=e[7];const y=j(f);let x;e[8]!==t||e[9]!==i||e[10]!==s?(x=async O=>{if(!s)throw new Error("URL da loja indisponível — recarregue a página.");const G=await i.callTool({name:"COMMERCE_DISCOVERY_BIND",arguments:{siteUrl:s,provider:t,resourceId:O.resourceId}});return se(G)},e[8]=t,e[9]=i,e[10]=s,e[11]=x):x=e[11];let C,E;e[12]!==a?(C=()=>a?.(!0),E=()=>a?.(!1),e[12]=a,e[13]=C,e[14]=E):(C=e[13],E=e[14]);let S;e[15]!==m.label||e[16]!==l||e[17]!==c||e[18]!==t||e[19]!==p||e[20]!==s?(S=async O=>{if(O.ok){h(null),Ve.success(`${m.label} conectado`),s&&await p.invalidateQueries({queryKey:X.commerceDiscoveryConnectionStatus(c.id,s)}),l();return}h({...Dn(t,O.reason??"unknown"),detail:O.detail})},e[15]=m.label,e[16]=l,e[17]=c,e[18]=t,e[19]=p,e[20]=s,e[21]=S):S=e[21];let _;e[22]!==x||e[23]!==C||e[24]!==E||e[25]!==S?(_={mutationFn:x,onMutate:C,onSettled:E,onSuccess:S},e[22]=x,e[23]=C,e[24]=E,e[25]=S,e[26]=_):_=e[26];const N=_e(_);let I;if(e[27]!==y||e[28]!==N){let O;e[30]!==N?(O=G=>N.mutate(G),e[30]=N,e[31]=O):O=e[31],I=y.handleSubmit(O),e[27]=y,e[28]=N,e[29]=I}else I=e[29];const U=I,k=N.isPending,T=Kn;let R;e[32]!==m.connectSteps?(R=m.connectSteps.map(qn),e[32]=m.connectSteps,e[33]=R):R=e[33];let A;e[34]!==R?(A=n.jsx("ol",{className:"space-y-2 text-sm text-muted-foreground",children:R}),e[34]=R,e[35]=A):A=e[35];let q;e[36]===Symbol.for("react.memo_cache_sentinel")?(q=n.jsx("code",{className:"min-w-0 flex-1 truncate text-xs text-foreground",children:Ne}),e[36]=q):q=e[36];let K;e[37]===Symbol.for("react.memo_cache_sentinel")?(K=n.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border bg-muted/40 p-2",children:[q,n.jsx(W,{type:"button",variant:"ghost",size:"icon-sm",onClick:T,"aria-label":"Copiar e-mail do service account",children:n.jsx(Lt,{size:16})})]}),e[37]=K):K=e[37];let $;e[38]!==m.resourceHint||e[39]!==m.resourceLabel||e[40]!==m.resourcePlaceholder||e[41]!==k?($=O=>{const{field:G}=O;return n.jsxs(je,{children:[n.jsx($e,{children:m.resourceLabel}),n.jsx(Ce,{children:n.jsx(ke,{...G,placeholder:m.resourcePlaceholder,disabled:k,autoComplete:"off"})}),n.jsx(on,{children:m.resourceHint}),n.jsx(Se,{})]})},e[38]=m.resourceHint,e[39]=m.resourceLabel,e[40]=m.resourcePlaceholder,e[41]=k,e[42]=$):$=e[42];let V;e[43]!==y.control||e[44]!==$?(V=n.jsx(ve,{control:y.control,name:"resourceId",render:$}),e[43]=y.control,e[44]=$,e[45]=V):V=e[45];let D;e[46]!==y||e[47]!==V?(D=n.jsx(Ge,{...y,children:V}),e[46]=y,e[47]=V,e[48]=D):D=e[48];let w;e[49]!==d?(w=d&&n.jsxs("div",{role:"alert",className:"space-y-2 rounded-lg border border-destructive/40 bg-destructive/5 p-3",children:[n.jsx("p",{className:"text-sm font-medium text-foreground",children:d.title}),n.jsx("ol",{className:"space-y-1 text-sm text-muted-foreground",children:d.steps.map(Mn)})]}),e[49]=d,e[50]=w):w=e[50];let z;e[51]!==N.error||e[52]!==N.isError?(z=N.isError&&n.jsx("p",{role:"alert",className:"text-sm text-destructive",children:N.error instanceof Error?N.error.message:"Não foi possível vincular."}),e[51]=N.error,e[52]=N.isError,e[53]=z):z=e[53];let H;e[54]!==k||e[55]!==u?(H=u?n.jsx("button",{type:"button",onClick:u,disabled:k,className:"text-xs text-muted-foreground underline underline-offset-2 hover:text-foreground disabled:opacity-50",children:"autorizar via login do Google"}):n.jsx("span",{}),e[54]=k,e[55]=u,e[56]=H):H=e[56];let P;e[57]!==k||e[58]!==l?(P=n.jsx(W,{type:"button",variant:"outline",onClick:l,disabled:k,children:"Cancelar"}),e[57]=k,e[58]=l,e[59]=P):P=e[59];const L=k?"Verificando...":"Vincular";let J;e[60]!==k||e[61]!==L?(J=n.jsx(W,{type:"submit",disabled:k,children:L}),e[60]=k,e[61]=L,e[62]=J):J=e[62];let Y;e[63]!==P||e[64]!==J?(Y=n.jsxs("div",{className:"flex gap-2",children:[P,J]}),e[63]=P,e[64]=J,e[65]=Y):Y=e[65];let Z;e[66]!==H||e[67]!==Y?(Z=n.jsxs(Ie,{className:"flex-col gap-2 pt-2 sm:flex-row sm:items-center sm:justify-between",children:[H,Y]}),e[66]=H,e[67]=Y,e[68]=Z):Z=e[68];let ee;return e[69]!==U||e[70]!==A||e[71]!==D||e[72]!==w||e[73]!==z||e[74]!==Z?(ee=n.jsxs("form",{onSubmit:U,className:"space-y-4",children:[A,K,D,w,z,Z]}),e[69]=U,e[70]=A,e[71]=D,e[72]=w,e[73]=z,e[74]=Z,e[75]=ee):ee=e[75],ee}function Mn(o){return n.jsxs("li",{className:"flex gap-2",children:[n.jsx("span",{"aria-hidden":!0,children:"•"}),n.jsx("span",{children:o})]},o)}function qn(o,e){return n.jsxs("li",{className:"flex gap-2",children:[n.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center rounded-full bg-muted text-xs font-medium text-foreground",children:e+1}),n.jsx("span",{children:o})]},o)}function Kn(){navigator.clipboard?.writeText(Ne),Ve.success("E-mail copiado")}function Vn(){const o=M.c(2);let e;o[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"size-9 shrink-0 animate-pulse rounded-lg bg-muted/60"}),o[0]=e):e=o[0];let t;return o[1]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsxs("div",{className:"flex items-center gap-3 rounded-2xl border border-border bg-card p-4 sm:h-full sm:flex-col sm:items-stretch",children:[e,n.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[n.jsx("div",{className:"h-4 w-24 animate-pulse rounded bg-muted/60"}),n.jsx("div",{className:"h-3 w-full animate-pulse rounded bg-muted/60"})]}),n.jsx("div",{className:"h-8 w-20 shrink-0 animate-pulse rounded-lg bg-muted/60 sm:mt-auto sm:w-full"})]}),o[1]=t):t=o[1],t}const xt="rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground";function Hn(o){const e=M.c(37),{card:t,connecting:s,disabled:i,onConnect:c,org:r,selfClient:l,siteUrl:a,autoOpenConfigFieldKey:u,onAutoOpenConfigHandled:m}=o,p=t.linkedConnectionId,d=Ft[t.bindingType],h=!!d&&t.boundVia!=="oauth";let b;e[0]!==u||e[1]!==t||e[2]!==s||e[3]!==i||e[4]!==p||e[5]!==m||e[6]!==c||e[7]!==r||e[8]!==d||e[9]!==l||e[10]!==a||e[11]!==h?(b=h&&d?n.jsx(Bn,{card:t,provider:d,org:r,selfClient:l,siteUrl:a,onOAuthInstead:c,disabled:i,connecting:s}):t.satisfied&&p?n.jsxs("div",{className:"flex items-center justify-end gap-1 sm:justify-start",children:[n.jsxs("span",{className:"flex items-center gap-1.5 text-sm text-muted-foreground",children:[n.jsx(ot,{size:16,className:"text-success"})," Conectado"]}),n.jsx(B.Suspense,{fallback:n.jsx(Gn,{}),children:n.jsx(Qn,{card:t,org:r,selfClient:l,connectionId:p,contextSiteUrl:a,autoOpen:jn({autoOpenFieldKey:u,card:t}),onAutoOpenHandled:m})})]}):n.jsx(W,{type:"button",variant:"outline",size:"sm",className:"sm:w-full",disabled:i||s,onClick:c,"aria-label":`Conectar ${t.title}`,children:s?n.jsx(tt,{size:16,className:"animate-spin"}):"Conectar"}),e[0]=u,e[1]=t,e[2]=s,e[3]=i,e[4]=p,e[5]=m,e[6]=c,e[7]=r,e[8]=d,e[9]=l,e[10]=a,e[11]=h,e[12]=b):b=e[12];const j=b;let v;e[13]!==t.icon||e[14]!==t.title?(v=n.jsx(st,{icon:t.icon,name:t.title,size:"sm",fit:"contain",className:"shrink-0 p-1.5"}),e[13]=t.icon,e[14]=t.title,e[15]=v):v=e[15];let g;e[16]!==t.area?(g=t.area&&n.jsx("span",{className:oe("hidden sm:inline-block",xt),children:t.area}),e[16]=t.area,e[17]=g):g=e[17];let f;e[18]!==v||e[19]!==g?(f=n.jsxs("div",{className:"shrink-0 self-start sm:flex sm:w-full sm:items-center sm:justify-between sm:gap-2",children:[v,g]}),e[18]=v,e[19]=g,e[20]=f):f=e[20];let y;e[21]!==t.area?(y=t.area&&n.jsx("span",{className:oe("mb-1 inline-block sm:hidden",xt),children:t.area}),e[21]=t.area,e[22]=y):y=e[22];let x;e[23]!==t.title?(x=n.jsx("p",{className:"text-sm font-medium text-foreground",children:t.title}),e[23]=t.title,e[24]=x):x=e[24];let C;e[25]!==t.headline?(C=t.headline&&n.jsx("p",{className:"mt-0.5 line-clamp-2 text-sm leading-5 text-muted-foreground",children:t.headline}),e[25]=t.headline,e[26]=C):C=e[26];let E;e[27]!==y||e[28]!==x||e[29]!==C?(E=n.jsxs("div",{className:"min-w-0 flex-1",children:[y,x,C]}),e[27]=y,e[28]=x,e[29]=C,e[30]=E):E=e[30];let S;e[31]!==j?(S=n.jsx("div",{className:"shrink-0 sm:mt-auto sm:w-full sm:pt-1",children:j}),e[31]=j,e[32]=S):S=e[32];let _;return e[33]!==f||e[34]!==E||e[35]!==S?(_=n.jsxs("div",{className:"flex items-center gap-3 rounded-2xl border border-border bg-card p-4 sm:h-full sm:flex-col sm:items-stretch",children:[f,E,S]}),e[33]=f,e[34]=E,e[35]=S,e[36]=_):_=e[36],_}function Bn(o){const e=M.c(39),{card:t,provider:s,org:i,selfClient:c,siteUrl:r,onOAuthInstead:l,disabled:a,connecting:u}=o,[m,p]=B.useState(!1),[d,h]=B.useState(!1);let b;e[0]!==d?(b=T=>{!T&&d||p(T)},e[0]=d,e[1]=b):b=e[1];const j=b;let v;e[2]!==t.satisfied||e[3]!==t.title||e[4]!==u||e[5]!==a?(v=t.satisfied?n.jsxs("div",{className:"flex items-center justify-end gap-1 sm:justify-start",children:[n.jsxs("span",{className:"flex items-center gap-1.5 text-sm text-muted-foreground",children:[n.jsx(ot,{size:16,className:"text-success"})," Conectado"]}),n.jsxs(Rt,{children:[n.jsx(Pt,{asChild:!0,children:n.jsx(W,{type:"button",variant:"ghost",size:"icon-sm",className:"shrink-0",onClick:()=>p(!0),"aria-label":`Configurar ${t.title}`,children:n.jsx(zt,{size:16})})}),n.jsx(Ut,{children:"Editar configuração"})]})]}):n.jsx(W,{type:"button",variant:"outline",size:"sm",className:"sm:w-full",disabled:a||u,onClick:()=>p(!0),"aria-label":`Conectar ${t.title}`,children:u?n.jsx(tt,{size:16,className:"animate-spin"}):"Conectar"}),e[2]=t.satisfied,e[3]=t.title,e[4]=u,e[5]=a,e[6]=v):v=e[6];let g;e[7]!==t.icon||e[8]!==t.title?(g=n.jsx(st,{icon:t.icon,name:t.title,size:"md",fit:"contain",className:"p-1.5"}),e[7]=t.icon,e[8]=t.title,e[9]=g):g=e[9];let f;e[10]!==t.title?(f=n.jsx(It,{children:t.title}),e[10]=t.title,e[11]=f):f=e[11];let y;e[12]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(Tt,{children:"Conceda acesso ao nosso leitor e informe o identificador"}),e[12]=y):y=e[12];let x;e[13]!==f?(x=n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[f,y]}),e[13]=f,e[14]=x):x=e[14];let C;e[15]!==g||e[16]!==x?(C=n.jsxs(Ot,{className:"flex-row items-center gap-3 space-y-0 text-left",children:[g,x]}),e[15]=g,e[16]=x,e[17]=C):C=e[17];const E=t.boundResource??void 0;let S;e[18]===Symbol.for("react.memo_cache_sentinel")?(S=()=>p(!1),e[18]=S):S=e[18];let _;e[19]!==t.satisfied||e[20]!==l?(_=t.satisfied?void 0:()=>{p(!1),l()},e[19]=t.satisfied,e[20]=l,e[21]=_):_=e[21];let N;e[22]!==i||e[23]!==s||e[24]!==c||e[25]!==r||e[26]!==_||e[27]!==E?(N=n.jsx(Fn,{provider:s,siteUrl:r,selfClient:c,org:i,initialResourceId:E,onDone:S,onIsPendingChange:h,onOAuthInstead:_}),e[22]=i,e[23]=s,e[24]=c,e[25]=r,e[26]=_,e[27]=E,e[28]=N):N=e[28];let I;e[29]!==N||e[30]!==C?(I=n.jsxs(kt,{className:"sm:max-w-lg",children:[C,N]}),e[29]=N,e[30]=C,e[31]=I):I=e[31];let U;e[32]!==j||e[33]!==m||e[34]!==I?(U=n.jsx(At,{open:m,onOpenChange:j,children:I}),e[32]=j,e[33]=m,e[34]=I,e[35]=U):U=e[35];let k;return e[36]!==U||e[37]!==v?(k=n.jsxs(n.Fragment,{children:[v,U]}),e[36]=U,e[37]=v,e[38]=k):k=e[38],k}function Gn(){const o=M.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"size-8 shrink-0 animate-pulse rounded-lg bg-muted/60"}),o[0]=e):e=o[0],e}function Qn(o){const e=M.c(60),{card:t,org:s,selfClient:i,connectionId:c,contextSiteUrl:r,autoOpen:l,onAutoOpenHandled:a}=o;let u;e[0]!==c||e[1]!==s.id||e[2]!==s.slug?(u={connectionId:c,orgId:s.id,orgSlug:s.slug},e[0]=c,e[1]=s.id,e[2]=s.slug,e[3]=u):u=e[3];const m=Be(u),[p,d]=B.useState(l),[h,b]=B.useState(!1),j=Fe(),v=$n[t.bindingType],g=vn(t.configurationState);let f;e[4]!==l||e[5]!==a?(f=()=>{d(!1),l&&a()},e[4]=l,e[5]=a,e[6]=f):f=e[6];const y=f;let x;e[7]!==y||e[8]!==h?(x=L=>{if(!(!L&&h)){if(!L){y();return}d(!0)}},e[7]=y,e[8]=h,e[9]=x):x=e[9];const C=x;let E;e[10]!==c||e[11]!==i?(E=async()=>{await i.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:c,force:!0}})},e[10]=c,e[11]=i,e[12]=E):E=e[12];let S;e[13]!==t.title||e[14]!==y||e[15]!==s.id||e[16]!==j?(S=async()=>{await j.invalidateQueries({queryKey:X.commerceDiscoveryCompanionConnectionsPrefix(s.id)}),Ve.success(`${t.title} desconectado`),y()},e[13]=t.title,e[14]=y,e[15]=s.id,e[16]=j,e[17]=S):S=e[17];let _;e[18]!==E||e[19]!==S?(_={mutationFn:E,onSuccess:S,onError:Wn},e[18]=E,e[19]=S,e[20]=_):_=e[20];const N=_e(_);if(!v)return null;let I;e[21]===Symbol.for("react.memo_cache_sentinel")?(I=()=>d(!0),e[21]=I):I=e[21];const U=`Configurar ${t.title}`;let k;e[22]===Symbol.for("react.memo_cache_sentinel")?(k=n.jsx(zt,{size:16}),e[22]=k):k=e[22];let T;e[23]!==U?(T=n.jsx(Pt,{asChild:!0,children:n.jsx(W,{type:"button",variant:"ghost",size:"icon-sm",className:"shrink-0",onClick:I,"aria-label":U,children:k})}),e[23]=U,e[24]=T):T=e[24];const R=g.length>0?"Editar configuração":"Configurar";let A;e[25]!==R?(A=n.jsx(Ut,{children:R}),e[25]=R,e[26]=A):A=e[26];let q;e[27]!==T||e[28]!==A?(q=n.jsxs(Rt,{children:[T,A]}),e[27]=T,e[28]=A,e[29]=q):q=e[29];let K;e[30]!==t.icon||e[31]!==t.title?(K=n.jsx(st,{icon:t.icon,name:t.title,size:"md",fit:"contain",className:"p-1.5"}),e[30]=t.icon,e[31]=t.title,e[32]=K):K=e[32];let $;e[33]!==t.title?($=n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[n.jsx(It,{children:t.title}),n.jsxs(Tt,{children:["Configure o ",t.title," para enriquecer os dados"]})]}),e[33]=t.title,e[34]=$):$=e[34];let V;e[35]!==K||e[36]!==$?(V=n.jsxs(Ot,{className:"flex-row items-center gap-3 space-y-0 text-left",children:[K,$]}),e[35]=K,e[36]=$,e[37]=V):V=e[37];let D;e[38]!==N?(D=()=>N.mutate(),e[38]=N,e[39]=D):D=e[39];let w;e[40]!==v||e[41]!==t||e[42]!==y||e[43]!==m||e[44]!==c||e[45]!==r||e[46]!==s||e[47]!==i||e[48]!==D?(w=n.jsx(v,{card:t,connectionId:c,companionClient:m,selfClient:i,org:s,contextSiteUrl:r,onDone:y,onDisconnect:D,onIsPendingChange:b}),e[40]=v,e[41]=t,e[42]=y,e[43]=m,e[44]=c,e[45]=r,e[46]=s,e[47]=i,e[48]=D,e[49]=w):w=e[49];let z;e[50]!==V||e[51]!==w?(z=n.jsxs(kt,{className:"sm:max-w-lg",children:[V,w]}),e[50]=V,e[51]=w,e[52]=z):z=e[52];let H;e[53]!==p||e[54]!==C||e[55]!==z?(H=n.jsx(At,{open:p,onOpenChange:C,children:z}),e[53]=p,e[54]=C,e[55]=z,e[56]=H):H=e[56];let P;return e[57]!==q||e[58]!==H?(P=n.jsxs(n.Fragment,{children:[q,H]}),e[57]=q,e[58]=H,e[59]=P):P=e[59],P}function Wn(){Ve.error("Não foi possível desconectar. Tente novamente.")}const at={vtex:{registryAppId:"deco/vtex",area:"Catálogo",headline:"Rupturas e PDPs que travam suas vendas."},"google-analytics":{registryAppId:"deco/google-analytics",area:"Funil",headline:"Onde a receita vaza no seu funil."},"google-search-console":{registryAppId:"deco/google-search-console",area:"Busca",headline:"O tráfego de busca que você deixa na mesa."}};function Yn(o){const e=M.c(40),{selfClient:t,org:s,cdConnectionId:i,siteUrl:c}=o;let r;e[0]!==i||e[1]!==s.id||e[2]!==s.slug?(r={connectionId:i,orgId:s.id,orgSlug:s.slug},e[0]=i,e[1]=s.id,e[2]=s.slug,e[3]=r):r=e[3];const l=Be(r);let a;e[4]!==i||e[5]!==s.id?(a=X.commerceDiscoveryCompanionSchema(s.id,i),e[4]=i,e[5]=s.id,e[6]=a):a=e[6];let u;e[7]!==l?(u=async()=>{const O=await l.callTool({name:"MCP_CONFIGURATION",arguments:{}});return se(O)},e[7]=l,e[8]=u):u=e[8];let m;e[9]!==a||e[10]!==u?(m={queryKey:a,queryFn:u},e[9]=a,e[10]=u,e[11]=m):m=e[11];const p=ye(m),d=gn(p.data?.stateSchema??{properties:{}}),h=d.map(rs),b=d.map(is).filter(os),j=d.filter(ss).map(ns),v=[...b,...j].sort().join(",");let g;e[12]!==i||e[13]!==s.id?(g=X.commerceDiscoveryConnection(s.id,i),e[12]=i,e[13]=s.id,e[14]=g):g=e[14];let f;e[15]!==i||e[16]!==t?(f=async()=>{const O=await t.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:i}});return se(O)},e[15]=i,e[16]=t,e[17]=f):f=e[17];let y;e[18]!==g||e[19]!==f?(y={queryKey:g,queryFn:f},e[18]=g,e[19]=f,e[20]=y):y=e[20];const C=ye(y).data?.item?.configuration_state??null;let E;e[21]!==C?(E=O=>C?.[O.fieldKey]?.value,e[21]=C,e[22]=E):E=e[22];const S=d.map(E).filter(ts),_=[...h.map(es),...b.map(Xn),...S.map(Zn)].sort().join(","),I=ye({queryKey:X.commerceDiscoveryCompanionConnections(s.id,_),queryFn:async()=>{if(d.length===0)return{items:[]};const O=[{field:["app_name"],operator:"in",value:h},{field:["app_id"],operator:"in",value:b}];S.length>0&&O.push({field:["id"],operator:"in",value:S});const G=await t.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{operator:"or",conditions:O},limit:1e3}});return se(G)}}).data?.items??[],U=new Set(S),k=I.filter(O=>U.has(O.id)),T=k.filter(Jn);let R;e[23]!==s.id||e[24]!==s.slug?(R=O=>({queryKey:X.commerceDiscoveryCompanionOAuthStatus(s.id,O.id),queryFn:async()=>{try{const G=await fetch(`/api/${encodeURIComponent(s.slug)}/connections/${encodeURIComponent(O.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]=R):R=e[25];const A=cn({queries:T.map(R)});let q;e[26]!==A?(q=(O,G)=>[O.id,A[G]?.data?.hasToken===!0],e[26]=A,e[27]=q):q=e[27];const K=new Map(T.map(q)),$={};for(const O of k)$[O.id]=!O.oauth_config||!!O.connection_token||K.get(O.id)===!0;const V=ye({queryKey:X.commerceDiscoveryCompanionRegistry(s.id,v),queryFn:async()=>{if(d.length===0)return{items:[]};const O=hn(b,j),G=await nn(Nt.REGISTRY(s.id),s.id,s.slug,"COLLECTION_REGISTRY_APP_LIST",{...O?{where:O}:{},limit:1e3});return se(G)}}),D={},w={};for(const O of V.data?.items??[])D[O.id]=O,O.server?.name&&(w[O.server.name]=O);let z;e[28]!==s.id||e[29]!==c?(z=X.commerceDiscoveryConnectionStatus(s.id,c??""),e[28]=s.id,e[29]=c,e[30]=z):z=e[30];const H=!!c;let P;e[31]!==t||e[32]!==c?(P=async()=>{const O=await t.callTool({name:"COMMERCE_DISCOVERY_CONNECTION_STATUS",arguments:{siteUrl:c}});return se(O)},e[31]=t,e[32]=c,e[33]=P):P=e[33];let L;e[34]!==z||e[35]!==H||e[36]!==P?(L={queryKey:z,enabled:H,queryFn:P},e[34]=z,e[35]=H,e[36]=P,e[37]=L):L=e[37];const J=nt(L),Y={};for(const[O,G]of Object.entries(Ft)){const ie=J.data?.providers?.[G];ie?.connected&&ie.via==="sa"&&(Y[O]={resource:ie.resource??null})}const Z=Nn({requirements:d,itemsById:D,itemsByName:w,connections:I,connectionReadiness:$,configurationState:C,curated:at,saBindings:Y});let ee;return e[38]!==Z?(ee={cards:Z},e[38]=Z,e[39]=ee):ee=e[39],ee}function Jn(o){return o.oauth_config&&!o.connection_token}function Zn(o){return`linked:${o}`}function Xn(o){return`app:${o}`}function es(o){return`binding:${o}`}function ts(o){return typeof o=="string"&&o.length>0}function ns(o){return o.bindingType}function ss(o){return!at[o.bindingType]}function os(o){return!!o}function is(o){return at[o.bindingType]?.registryAppId}function rs(o){return o.bindingType}function as({selfClient:o,org:e,userId:t,cdConnectionId:s}){const i=Fe(),[c,r]=B.useState(null),[l,a]=B.useState(null),u=async(p,d)=>{const h=await o.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:p,data:d}});return se(h)};async function m(p){r(p.fieldKey),a(null);const d={app_name:p.title,field_key:p.fieldKey,organization_id:e.id};te("commerce_onboarding_companion_connect_clicked",d);try{let h=p.candidateConnectionId;if(!h){const y=sn(p.registryItem,e.id,t,{remoteIndex:0}),x=y.connection_type==="STDIO",C=!!y.connection_url,E=x&&y.connection_headers&&typeof y.connection_headers=="object"&&"command"in y.connection_headers;if(!C&&!E)return te("commerce_onboarding_companion_connect_failed",{...d,error:"no_connection_method"}),a(`${p.title} cannot be connected: no connection method available`),!1;const S=await o.callTool({name:"COLLECTION_CONNECTIONS_CREATE",arguments:{data:y}});h=se(S).item.id}const b=h,j=await dn({connectionId:b,orgId:e.id,orgSlug:e.slug,persistFallback:y=>u(b,{connection_token:y}).then(()=>{})});if(!j.ok)return te("commerce_onboarding_companion_connect_failed",{...d,error:j.error}),a(`Couldn't sign in to ${p.title}: ${j.error}`),!1;const v=await o.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:s}}),g=se(v).item?.configuration_state??null,f=xn(g,p.fieldKey,p.bindingType,b);return await u(s,{configuration_state:f}),await i.invalidateQueries({queryKey:X.commerceDiscoveryConnection(e.id,s)}),await i.invalidateQueries({queryKey:X.commerceDiscoveryCompanionConnectionsPrefix(e.id)}),te("commerce_onboarding_companion_connected",d),!0}catch(h){return te("commerce_onboarding_companion_connect_failed",{...d,error:h instanceof Error?h.message:String(h)}),a(h instanceof Error?h.message:String(h)),!1}finally{r(null)}}return{connect:m,connectingFieldKey:c,error:l}}const lt="flex min-h-0 flex-1 flex-col gap-6 md:grid md:flex-none md:gap-4";function ct(){const o=M.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("h1",{className:"text-2xl font-medium leading-8 text-foreground",children:"Conecte suas ferramentas para ver o diagnóstico completo"}),o[0]=e):e=o[0],e}function ls(){const o=M.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[0,1,2,3].map(cs)}),o[0]=e):e=o[0],e}function cs(o){return n.jsx(Vn,{},o)}function dt(){const o=M.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsxs("div",{className:lt,children:[n.jsx(ct,{}),n.jsx(ls,{})]}),o[0]=e):e=o[0],e}function ds(o){const e=M.c(5),{onRetry:t}=o;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(ct,{}),e[0]=s):s=e[0];let i,c;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx("p",{className:"text-sm text-foreground",children:"Não foi possível carregar as integrações complementares."}),c=n.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Algo deu errado ao carregar suas integrações."}),e[1]=i,e[2]=c):(i=e[1],c=e[2]);let r;return e[3]!==t?(r=n.jsxs("div",{className:lt,children:[s,n.jsxs("div",{role:"alert",className:"rounded-2xl border border-border bg-card p-4",children:[i,c,n.jsx(W,{type:"button",variant:"outline",size:"sm",className:"mt-3",onClick:t,children:"Tentar novamente"})]})]}),e[3]=t,e[4]=r):r=e[4],r}function ms(o){const e=M.c(2);let t;return e[0]!==o?(t=n.jsx(vt,{children:s=>{const{reset:i}=s;return n.jsx(jt,{fallback:c=>{const{resetError:r}=c;return n.jsx(ds,{onRetry:()=>{i(),r()}})},children:n.jsx(B.Suspense,{fallback:n.jsx(dt,{}),children:n.jsx(us,{...o})})})}}),e[0]=o,e[1]=t):t=e[1],t}function us(o){const e=M.c(38),{org:t,cdConnectionId:s,siteUrl:i}=o,{data:c}=He.useSession(),r=c?.user?.id??"";let l;e[0]!==t.id||e[1]!==t.slug?(l={connectionId:Et,orgId:t.id,orgSlug:t.slug},e[0]=t.id,e[1]=t.slug,e[2]=l):l=e[2];const a=Be(l);let u;e[3]!==s||e[4]!==t||e[5]!==a||e[6]!==i?(u={selfClient:a,org:t,cdConnectionId:s,siteUrl:i},e[3]=s,e[4]=t,e[5]=a,e[6]=i,e[7]=u):u=e[7];const{cards:m}=Yn(u);let p;e[8]!==s||e[9]!==t||e[10]!==a||e[11]!==r?(p={selfClient:a,org:t,userId:r,cdConnectionId:s},e[8]=s,e[9]=t,e[10]=a,e[11]=r,e[12]=p):p=e[12];const{connect:d,connectingFieldKey:h,error:b}=as(p),[j,v]=B.useState(null);if(m.length===0)return null;const g=h!==null;let f;e[13]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(ct,{}),e[13]=f):f=e[13];let y;e[14]!==b?(y=b&&n.jsx("p",{role:"alert",className:"mb-3 text-sm text-destructive",children:b}),e[14]=b,e[15]=y):y=e[15];let x;if(e[16]!==j||e[17]!==g||e[18]!==m||e[19]!==d||e[20]!==h||e[21]!==t||e[22]!==a||e[23]!==i){let S;e[25]!==j||e[26]!==g||e[27]!==d||e[28]!==h||e[29]!==t||e[30]!==a||e[31]!==i?(S=_=>{const N=async()=>{await d(_)&&v(_.fieldKey)};return n.jsx(Hn,{card:_,connecting:h===_.fieldKey,disabled:g&&h!==_.fieldKey,org:t,selfClient:a,siteUrl:i,autoOpenConfigFieldKey:j,onAutoOpenConfigHandled:()=>v(I=>I===_.fieldKey?null:I),onConnect:()=>{N()}},_.fieldKey)},e[25]=j,e[26]=g,e[27]=d,e[28]=h,e[29]=t,e[30]=a,e[31]=i,e[32]=S):S=e[32],x=m.map(S),e[16]=j,e[17]=g,e[18]=m,e[19]=d,e[20]=h,e[21]=t,e[22]=a,e[23]=i,e[24]=x}else x=e[24];let C;e[33]!==x?(C=n.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:x}),e[33]=x,e[34]=C):C=e[34];let E;return e[35]!==y||e[36]!==C?(E=n.jsxs("div",{className:lt,children:[f,n.jsxs(Xe,{wrapperClassName:"flex min-h-0 flex-1 flex-col md:block",className:"-mx-1 min-h-0 flex-1 overflow-y-auto px-1 md:max-h-[min(60vh,calc(100dvh-330px))] md:flex-none",children:[y,C]})]}),e[35]=y,e[36]=C,e[37]=E):E=e[37],E}const mt="https://decocms.com/agendar",fs="Precisa de ajuda? Fale conosco",ps="Agende uma chamada de 20 minutos e rodamos o diagnóstico com você, ao vivo.",Te=[{photo:"https://decoims.com/image?src=decocms%2Fb07a1c19-0cd6-49c8-b326-86055ee78605%2Fauthor-1763423987973-baby.jpeg&quality=original&fit=cover&width=200&height=200",alt:"Especialista da deco"},{photo:"https://decoims.com/decocms/07c2daf4-a3c2-485e-a1a8-341585a06e3b/cecilia.png",alt:"Especialista da deco"},{photo:"https://decoims.com/decocms/48013ca2-3277-464b-b0f1-dd5f1f08d986/tavano.png",alt:"Especialista da deco"}],gs="var(--brand-green-dark)";function ut({siteUrl:o,email:e}){const t=new URL(mt);return o&&t.searchParams.set("siteUrl",o),e&&t.searchParams.set("email",e),t.toString()}function hs(o){const e=M.c(12),{href:t,size:s,className:i,orgId:c}=o,r=t===void 0?mt:t,l=s===void 0?"lg":s;let a;e[0]!==i?(a=oe("w-full",i),e[0]=i,e[1]=a):a=e[1];let u;e[2]!==c?(u=()=>te("commerce_onboarding_meeting_cta_clicked",{placement:"visual_card",organization_id:c}),e[2]=c,e[3]=u):u=e[3];let m;e[4]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx($t,{size:16}),e[4]=m):m=e[4];let p;e[5]!==r||e[6]!==u?(p=n.jsxs("a",{href:r,target:"_blank",rel:"noreferrer",onClick:u,children:["Agendar uma reunião",m]}),e[5]=r,e[6]=u,e[7]=p):p=e[7];let d;return e[8]!==l||e[9]!==a||e[10]!==p?(d=n.jsx(W,{asChild:!0,variant:"outline",size:l,className:a,children:p}),e[8]=l,e[9]=a,e[10]=p,e[11]=d):d=e[11],d}function xs(o){const e=M.c(10),{size:t}=o,s=t===void 0?72:t;let i;e[0]!==s?(i=Math.round(s*.3),e[0]=s,e[1]=i):i=e[1];const c=i;let r;e[2]!==s?(r={height:s},e[2]=s,e[3]=r):r=e[3];let l;e[4]!==c||e[5]!==s?(l=Te.map((u,m)=>n.jsxs("div",{className:"relative shrink-0",style:{width:s,height:s,marginLeft:m===0?0:-c,zIndex:Te.length-m},children:[n.jsx("div",{className:"h-full w-full overflow-hidden rounded-full border-4 border-card bg-muted",children:n.jsx("img",{src:u.photo,alt:u.alt,className:"h-full w-full object-cover",loading:"lazy"})}),m===0&&n.jsxs("span",{className:"absolute bottom-1.5 right-1.5 flex h-3.5 w-3.5",children:[n.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-success opacity-60 motion-safe:animate-ping","aria-hidden":!0}),n.jsx("span",{className:"relative inline-flex h-3.5 w-3.5 rounded-full border-2 border-card bg-success"})]})]},u.photo)),e[4]=c,e[5]=s,e[6]=l):l=e[6];let a;return e[7]!==r||e[8]!==l?(a=n.jsx("div",{className:"flex items-end",style:r,children:l}),e[7]=r,e[8]=l,e[9]=a):a=e[9],a}function ft(o){const e=M.c(6),{href:t,orgId:s}=o;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx("div",{className:"h-20",style:{backgroundColor:gs}}),e[0]=i):i=e[0];let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx("div",{className:"-mt-9 mb-4",children:n.jsx(xs,{})}),e[1]=c):c=e[1];let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx("h2",{className:"text-lg font-medium leading-6 text-foreground",children:fs}),n.jsx("p",{className:"text-sm leading-5 text-muted-foreground",children:ps})]}),e[2]=r):r=e[2];let l;return e[3]!==t||e[4]!==s?(l=n.jsx("div",{className:"relative flex h-full w-full items-center justify-center p-10",children:n.jsxs("div",{className:"w-full max-w-[440px] overflow-hidden rounded-3xl border border-border bg-card card-shadow",children:[i,n.jsxs("div",{className:"px-8 pb-8",children:[c,r,n.jsx(hs,{href:t,size:"lg",className:"mt-6",orgId:s})]})]})}),e[3]=t,e[4]=s,e[5]=l):l=e[5],l}function ys(o){const e=M.c(13),{className:t,href:s,orgId:i}=o,c=s===void 0?mt:s;let r;e[0]!==i?(r=()=>te("commerce_onboarding_meeting_cta_clicked",{placement:"mobile_banner",organization_id:i}),e[0]=i,e[1]=r):r=e[1];let l;e[2]!==t?(l=oe("flex items-center gap-4 rounded-2xl border border-border bg-card p-5 card-shadow transition-colors hover:bg-accent",t),e[2]=t,e[3]=l):l=e[3];let a,u;e[4]===Symbol.for("react.memo_cache_sentinel")?(a={height:44,width:44+2*Math.round(30.799999999999997)},u=Te.map(bs),e[4]=a,e[5]=u):(a=e[4],u=e[5]);let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsxs("span",{className:"relative flex shrink-0 items-center",style:a,children:[u,n.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-3 w-3 rounded-full border-2 border-card bg-success","aria-hidden":!0,style:{zIndex:Te.length+1}})]}),e[6]=m):m=e[6];let p,d;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsxs("span",{className:"flex-1 text-base font-medium leading-5 text-foreground",children:["Precisa de ajuda?",n.jsx("br",{}),"Fale conosco"]}),d=n.jsx($t,{size:18,className:"shrink-0 text-muted-foreground"}),e[7]=p,e[8]=d):(p=e[7],d=e[8]);let h;return e[9]!==c||e[10]!==r||e[11]!==l?(h=n.jsxs("a",{href:c,target:"_blank",rel:"noreferrer",onClick:r,className:l,children:[m,p,d]}),e[9]=c,e[10]=r,e[11]=l,e[12]=h):h=e[12],h}function bs(o,e){return n.jsx("span",{className:"absolute block h-11 w-11 overflow-hidden rounded-full border-2 border-card",style:{left:e*Math.round(30.799999999999997),zIndex:Te.length-e},children:n.jsx("img",{src:o.photo,alt:o.alt,className:"h-full w-full object-cover",loading:"lazy"})},o.photo)}function qt(o){const e=M.c(10),{host:t}=o,s=`https://www.google.com/s2/favicons?domain=${t}&sz=128`;let i,c,r;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-7 w-7 dark:hidden"}),c=n.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"h-7 w-7 hidden dark:block"}),r=n.jsx("div",{className:"h-6 w-px rotate-12 bg-border","aria-hidden":"true"}),e[0]=i,e[1]=c,e[2]=r):(i=e[0],c=e[1],r=e[2]);let l;e[3]!==s?(l=n.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-border bg-white",children:n.jsx("img",{src:s,alt:"",className:"h-5 w-5",loading:"lazy"})}),e[3]=s,e[4]=l):l=e[4];let 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]!==l||e[8]!==a?(u=n.jsxs("div",{className:"flex items-center gap-3",children:[i,c,r,l,a]}),e[7]=l,e[8]=a,e[9]=u):u=e[9],u}const vs={workspace:"Preparando seu workspace de commerce...",generic:"Preparando..."};function js(o){return vs[o]}function pt(o){const e=M.c(4),{variant:t}=o;let s;e[0]!==t?(s=js(t),e[0]=t,e[1]=s):s=e[1];let i;return e[2]!==s?(i=n.jsx("div",{className:"flex justify-center py-4",role:"status","aria-live":"polite",children:n.jsx(rt,{label:s,className:"text-muted-foreground"})}),e[2]=s,e[3]=i):i=e[3],i}function qo(){const o=M.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(Ss,{}),o[0]=e):e=o[0],e}const Kt=B.createContext(null),Vt=()=>B.useContext(Kt);function ne(o){const e=M.c(13);let t,s;e[0]!==o?({visual:s,...t}=o,e[0]=o,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i={from:"/commerce-onboarding"},e[3]=i):i=e[3];const c=Ct(i),{data:r}=He.useSession(),l=r?.user?.email;let a;e[4]!==c.siteUrl||e[5]!==l?(a=ut({siteUrl:c.siteUrl,email:l}),e[4]=c.siteUrl,e[5]=l,e[6]=a):a=e[6];const u=a;let m;e[7]!==u||e[8]!==s?(m=s??n.jsx(ft,{href:u}),e[7]=u,e[8]=s,e[9]=m):m=e[9];let p;return e[10]!==t||e[11]!==m?(p=n.jsx(Yt,{...t,visual:m}),e[10]=t,e[11]=m,e[12]=p):p=e[12],p}const Cs={signUpFailed:"Falha ao criar conta",signInFailed:"Falha ao entrar",authenticationFailed:"Falha na autenticação",resetEmailFailed:"Não foi possível enviar o e-mail de redefinição",otpSendFailed:"Não foi possível enviar o código",invalidCode:"Código inválido",invalidEmail:"E-mail inválido",invalidEmailOrPassword:"E-mail ou senha inválidos. Tente novamente.",accountExists:"Já existe uma conta com este e-mail. Tente entrar em vez de criar uma nova conta.",networkError:"Erro de rede. Verifique sua conexão e tente novamente.",tooManyAttempts:"Muitas tentativas. Aguarde um momento e tente novamente.",invalidOrExpiredCode:"Código inválido ou expirado. Tente novamente.",genericError:"Algo deu errado. Tente novamente.",resetPasswordTitle:"Redefinir sua senha",verificationCodeTitle:"Informe o código de verificação",welcomeTitle:"Bem-vindo à deco",resetPasswordSubtitle:"Enviaremos um link de redefinição",codeSentTo:o=>`Código enviado para ${o}`,defaultSubtitle:"Entre ou crie uma nova conta",resetEmailSent:"Verifique seu e-mail para redefinir a senha.",continueWith:o=>`Continuar com ${o}`,divider:"ou",emailLabel:"E-mail",emailPlaceholder:"Endereço de e-mail",sending:"Enviando...",sendCode:"Enviar código",verificationCodeLabel:"Código de verificação",enterCodePlaceholder:"Informe o código",verifying:"Verificando...",verify:"Verificar",useDifferentEmail:"Usar outro e-mail",sendResetLink:"Enviar link de redefinição",nameLabel:"Nome",namePlaceholder:"Seu nome",passwordLabel:"Senha",forgotPassword:"Esqueceu a senha?",creatingAccount:"Criando conta...",signingIn:"Entrando...",continue:"Continuar",backToSignIn:"Voltar para entrar",signInWithPassword:"Entrar com senha",alreadyHaveAccount:"Já tem uma conta? ",dontHaveAccount:"Não tem uma conta? ",signIn:"Entrar",signUp:"Criar conta",signInWithEmailCode:"Entrar com código por e-mail"};function we(o){if(!o)return null;const e=Ee(o);return e.ok?new URL(e.value).hostname:null}function yt(o){switch(o){case"Enter a website URL.":return"Informe a URL de um site.";case"Use an HTTP or HTTPS website URL.":return"Use uma URL de site HTTP ou HTTPS.";case"Enter a valid website URL.":return"Informe uma URL de site válida.";default:return o}}let bt=!1;function Ss(){const o=Ct({from:"/commerce-onboarding"}),{org:e,siteUrl:t}=o,s=we(t);return!bt&&Bt()&&(bt=!0,te("commerce_onboarding_viewed",{site_url:t,domain:s??void 0,...s?{$set:{last_scanned_domain:s}}:{}})),n.jsx(Kt.Provider,{value:s,children:n.jsx(_s,{requestedOrgSlug:e,siteUrl:t})})}function _s(o){const e=M.c(8),{requestedOrgSlug:t,siteUrl:s}=o,{data:i,isPending:c}=He.useSession(),r=Vt();if(c){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(ne,{children:n.jsx(pt,{variant:"generic"})}),e[0]=a):a=e[0],a}if(!i){const a=typeof window>"u"?"/commerce-onboarding":`${window.location.pathname}${window.location.search}`;let u;e[1]!==r?(u=r?n.jsx(qt,{host:r}):void 0,e[1]=r,e[2]=u):u=e[2];let m;return e[3]!==u?(m=n.jsx(ne,{children:n.jsx(Wt,{callbackUrl:a,allowAutoLogin:!1,title:"Desbloqueie seu diagnóstico completo",subtitle:null,brand:u,copy:Cs})}),e[3]=u,e[4]=m):m=e[4],m}let l;return e[5]!==t||e[6]!==s?(l=n.jsx(Ns,{requestedOrgSlug:t,siteUrl:s}),e[5]=t,e[6]=s,e[7]=l):l=e[7],l}function Ns(o){const e=M.c(40),{requestedOrgSlug:t,siteUrl:s}=o,i=St(),c=Gt(),[r,l]=B.useState(null),[a,u]=B.useState(null),m=c.data?.map(ws)??[];let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={mutationFn:Es,retry:!1,onSuccess:f=>{u(f)}},e[0]=p):p=e[0];const d=_e(p);if(c.isPending){let f;return e[1]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(ne,{children:n.jsx(pt,{variant:"workspace"})}),e[1]=f):f=e[1],f}if(c.error){let f;return e[2]!==c?(f=n.jsx(De,{title:"Não foi possível carregar suas organizações",description:"Tente novamente para continuar a configuração de commerce nesta página.",actionLabel:"Tentar novamente",onRetry:()=>c.refetch()}),e[2]=c,e[3]=f):f=e[3],f}const h=t?m.find(f=>f.slug===t):null;if(h){let f;return e[4]!==h||e[5]!==s?(f=n.jsx(Le,{org:h,initialSiteUrl:s}),e[4]=h,e[5]=s,e[6]=f):f=e[6],f}if(t){let f;return e[7]!==c?(f=n.jsx(De,{title:"Organização não encontrada",description:"Não conseguimos encontrar essa organização na sua conta.",actionLabel:"Tentar novamente",onRetry:()=>c.refetch()}),e[7]=c,e[8]=f):f=e[8],f}if(r){let f;return e[9]!==r||e[10]!==s?(f=n.jsx(Le,{org:r,initialSiteUrl:s}),e[9]=r,e[10]=s,e[11]=f):f=e[11],f}if(m.length===1&&m[0]){let f;return e[12]!==m[0]||e[13]!==s?(f=n.jsx(Le,{org:m[0],initialSiteUrl:s}),e[12]=m[0],e[13]=s,e[14]=f):f=e[14],f}if(m.length>1){let f;e[15]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(re,{title:"Escolha uma organização",description:"Selecione onde o diagnóstico de commerce deve continuar."}),e[15]=f):f=e[15];let y;e[16]===Symbol.for("react.memo_cache_sentinel")?(y=C=>l(C),e[16]=y):y=e[16];let x;return e[17]!==m?(x=n.jsx(ne,{children:n.jsxs("div",{className:"grid gap-10",children:[f,n.jsx(Xe,{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:n.jsx(gt,{organizations:m,selectLabel:"Continuar",onSelected:y})})]})}),e[17]=m,e[18]=x):x=e[18],x}if(!a){let f;e[19]!==d?(f=()=>{d.reset(),d.mutate()},e[19]=d,e[20]=f):f=e[20];let y;return e[21]!==d||e[22]!==f?(y=n.jsx(Is,{mutation:d,onRetry:f}),e[21]=d,e[22]=f,e[23]=y):y=e[23],y}const b=a;if(b?.success&&(b.status==="created"||b.status==="joined"||b.status==="already_has_organization")&&b.organization){let f;return e[24]!==b.organization||e[25]!==s?(f=n.jsx(Le,{org:b.organization,initialSiteUrl:s}),e[24]=b.organization,e[25]=s,e[26]=f):f=e[26],f}if(b?.status==="ambiguous"&&b.organizations&&b.organizations.length>0){let f;e[27]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(re,{title:"Escolha uma organização",description:"Seu e-mail pode acessar mais de uma organização. Escolha onde a configuração de commerce deve continuar."}),e[27]=f):f=e[27];const y=b.domain??void 0;let x;e[28]!==i||e[29]!==s?(x=(E,S)=>{_t(),l({...E,slug:S}),i({to:"/commerce-onboarding",search:{org:S,siteUrl:s}})},e[28]=i,e[29]=s,e[30]=x):x=e[30];let C;return e[31]!==b.organizations||e[32]!==y||e[33]!==x?(C=n.jsx(ne,{children:n.jsxs("div",{className:"grid gap-10",children:[f,n.jsx(Xe,{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:n.jsx(gt,{organizations:b.organizations,domain:y,onJoined:x})})]})}),e[31]=b.organizations,e[32]=y,e[33]=x,e[34]=C):C=e[34],C}const j=b?.error??"Não conseguimos determinar uma organização de commerce para esta conta.";let v;e[35]!==d?(v=()=>{u(null),d.reset()},e[35]=d,e[36]=v):v=e[36];let g;return e[37]!==j||e[38]!==v?(g=n.jsx(De,{title:"O onboarding de commerce precisa de suporte",description:j,actionLabel:"Tentar novamente",onRetry:v}),e[37]=j,e[38]=v,e[39]=g):g=e[39],g}async function Es(){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&&_t(),e}function ws(o){return{id:o.id,name:o.name,slug:o.slug,logo:o.logo??null}}function Is(o){const e=M.c(7),{mutation:t,onRetry:s}=o,i=B.useRef(!1);let c;e[0]!==t?(c=u=>{!u||i.current||(i.current=!0,t.mutate())},e[0]=t,e[1]=c):c=e[1];const r=c;if(t.error){let u;return e[2]!==s?(u=n.jsx(De,{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 l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(pt,{variant:"generic"}),e[4]=l):l=e[4];let a;return e[5]!==r?(a=n.jsx(ne,{children:n.jsx("div",{ref:r,children:l})}),e[5]=r,e[6]=a):a=e[6],a}function re(o){const e=M.c(8),{title:t,description:s}=o,i=Vt();let c;e[0]!==i?(c=i?n.jsx(qt,{host:i}):n.jsxs("div",{children:[n.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12 dark:hidden"}),n.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"h-12 w-12 hidden dark:block"})]}),e[0]=i,e[1]=c):c=e[1];let r;e[2]!==s||e[3]!==t?(r=(t||s)&&n.jsxs("div",{className:"space-y-2",children:[t&&n.jsx("h1",{className:"text-2xl font-medium leading-8",children:t}),s&&n.jsx("p",{className:"text-base text-muted-foreground leading-6",children:s})]}),e[2]=s,e[3]=t,e[4]=r):r=e[4];let l;return e[5]!==c||e[6]!==r?(l=n.jsxs("div",{className:"grid gap-10",children:[c,r]}),e[5]=c,e[6]=r,e[7]=l):l=e[7],l}function De(o){const e=M.c(9),{title:t,description:s,actionLabel:i,onRetry:c}=o;let r;e[0]!==s||e[1]!==t?(r=n.jsx(re,{title:t,description:s}),e[0]=s,e[1]=t,e[2]=r):r=e[2];let l;e[3]!==i||e[4]!==c?(l=n.jsx(W,{type:"button",size:"xl",className:"w-full",onClick:c,children:i}),e[3]=i,e[4]=c,e[5]=l):l=e[5];let a;return e[6]!==r||e[7]!==l?(a=n.jsx(ne,{children:n.jsxs("div",{className:"grid gap-10",children:[r,l]})}),e[6]=r,e[7]=l,e[8]=a):a=e[8],a}function Ts(o){return o.content?.find(e=>e.text)?.text??"A configuração do Commerce Discovery falhou."}function ze(o){const e=o;if(e.isError)throw new Error(Ts(e));return e.structuredContent??o}function Le(o){const e=M.c(11),{org:t,initialSiteUrl:s}=o,{data:i}=He.useSession(),c=i?.user?.email;let r;e[0]!==s||e[1]!==c?(r=ut({siteUrl:s,email:c}),e[0]=s,e[1]=c,e[2]=r):r=e[2];const l=r;let a;e[3]!==l||e[4]!==t.id?(a=n.jsx(ft,{href:l,orgId:t.id}),e[3]=l,e[4]=t.id,e[5]=a):a=e[5];const u=a;let m;return e[6]!==s||e[7]!==u||e[8]!==t||e[9]!==i?.user?.email?(m=n.jsx(vt,{children:p=>{const{reset:d}=p;return n.jsx(jt,{fallback:h=>{const{error:b,resetError:j}=h;return n.jsx(ne,{visual:u,children:n.jsx(Os,{orgName:t.name,message:b instanceof Error?b.message:"Não foi possível verificar a configuração do Commerce Discovery.",onRetry:()=>{d(),j()}})})},children:n.jsx(B.Suspense,{fallback:n.jsx(Ht,{visual:u}),children:n.jsx(ks,{org:t,initialSiteUrl:s,sessionEmail:i?.user?.email},`${t.id}:${s??""}`)})})}}),e[6]=s,e[7]=u,e[8]=t,e[9]=i?.user?.email,e[10]=m):m=e[10],m}function Ht(o){const e=M.c(3),{visual:t}=o;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-6 md:grid md:gap-4",children:[n.jsx(re,{}),n.jsx(dt,{})]}),e[0]=s):s=e[0];let i;return e[1]!==t?(i=n.jsx(ne,{align:"fill",visual:t,children:s}),e[1]=t,e[2]=i):i=e[2],i}function Os(o){const e=M.c(10),{orgName:t,message:s,onRetry:i}=o,c=`A configuração de commerce continuará em ${t}.`;let r;e[0]!==c?(r=n.jsx(re,{title:"Diagnóstico de commerce",description:c}),e[0]=c,e[1]=r):r=e[1];let l;e[2]!==s?(l=n.jsx(Oe,{message:s}),e[2]=s,e[3]=l):l=e[3];let a;e[4]!==i?(a=n.jsx(W,{type:"button",size:"xl",className:"w-full",onClick:i,children:"Tentar novamente"}),e[4]=i,e[5]=a):a=e[5];let u;return e[6]!==r||e[7]!==l||e[8]!==a?(u=n.jsxs("div",{className:"grid gap-10",children:[r,l,a]}),e[6]=r,e[7]=l,e[8]=a,e[9]=u):u=e[9],u}function ks(o){const e=M.c(117),{org:t,initialSiteUrl:s,sessionEmail:i}=o,c=St();let r;e[0]!==t.id||e[1]!==t.slug?(r={connectionId:Et,orgId:t.id,orgSlug:t.slug},e[0]=t.id,e[1]=t.slug,e[2]=r):r=e[2];const l=Be(r),[a,u]=B.useState(s??""),[m,p]=B.useState(null),[d,h]=B.useState(null),b=B.useRef(!1),j=Nt.COMMERCE_DISCOVERY(t.id),v=Zt(t.id),g=X.commerceDiscoveryConnection(t.id,j);let f;e[3]!==j||e[4]!==l?(f=async()=>{const F=await l.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:j}});return ze(F)},e[3]=j,e[4]=l,e[5]=f):f=e[5];let y;e[6]!==g||e[7]!==f?(y={queryKey:g,queryFn:f,retry:!1},e[6]=g,e[7]=f,e[8]=y):y=e[8];const x=ye(y),C=X.commerceDiscoveryVirtualMcp(t.id,v);let E;e[9]!==l||e[10]!==v?(E=async()=>{const F=await l.callTool({name:"COLLECTION_VIRTUAL_MCP_GET",arguments:{id:v}});return ze(F)},e[9]=l,e[10]=v,e[11]=E):E=e[11];let S;e[12]!==C||e[13]!==E?(S={queryKey:C,queryFn:E,retry:!1},e[12]=C,e[13]=E,e[14]=S):S=e[14];const _=ye(S);let N;e[15]!==l?(N=async F=>{const Q=await l.callTool({name:"COMMERCE_DISCOVERY_SETUP",arguments:{siteUrl:F}});return ze(Q)},e[15]=l,e[16]=N):N=e[16];let I;e[17]!==x||e[18]!==t.id||e[19]!==_?(I=(F,Q)=>{te("commerce_onboarding_setup_succeeded",{domain:we(Q)??void 0,organization_id:t.id}),p(F),h(null),x.refetch(),_.refetch()},e[17]=x,e[18]=t.id,e[19]=_,e[20]=I):I=e[20];let U;e[21]!==t.id?(U=(F,Q)=>{te("commerce_onboarding_setup_failed",{domain:we(Q)??void 0,organization_id:t.id,error:F instanceof Error?F.message:String(F)}),h(F instanceof Error?F.message:"A configuração do Commerce Discovery falhou.")},e[21]=t.id,e[22]=U):U=e[22];let k;e[23]!==U||e[24]!==N||e[25]!==I?(k={mutationFn:N,retry:!1,onSuccess:I,onError:U},e[23]=U,e[24]=N,e[25]=I,e[26]=k):k=e[26];const T=_e(k);let R;e[27]!==l?(R={mutationFn:async F=>{const Q=await l.callTool({name:"COMMERCE_DISCOVERY_RUN",arguments:{siteUrl:F}});return ze(Q)},retry:!1},e[27]=l,e[28]=R):R=e[28];const A=_e(R),[q,K]=B.useState(null),$=!!x.data.item&&!!_.data.item,V=x.data.item,D=typeof V?.metadata?.siteUrl=="string"?V.metadata.siteUrl:void 0,w=s||a||D||"";let z;e[29]!==w||e[30]!==i?(z=ut({siteUrl:w,email:i}),e[29]=w,e[30]=i,e[31]=z):z=e[31];const H=z;let P;e[32]!==H||e[33]!==t.id?(P=n.jsx(ft,{href:H,orgId:t.id}),e[32]=H,e[33]=t.id,e[34]=P):P=e[34];const L=P;let J;e[35]!==T?(J=F=>{const Q=Ee(F);if(!Q.ok){h(yt(Q.error));return}h(null),T.mutate(Q.value)},e[35]=T,e[36]=J):J=e[36];const Y=J;let Z;e[37]!==s||e[38]!==Y||e[39]!==$?(Z=F=>{!F||b.current||$||!s||(b.current=!0,Y(s))},e[37]=s,e[38]=Y,e[39]=$,e[40]=Z):Z=e[40];const ee=Z;let O;e[41]!==t.id||e[42]!==Y||e[43]!==a?(O=F=>{F.preventDefault();const Q=Ee(a);Q.ok&&te("commerce_onboarding_site_url_submitted",{domain:new URL(Q.value).hostname,organization_id:t.id}),Y(a)},e[41]=t.id,e[42]=Y,e[43]=a,e[44]=O):O=e[44];const G=O;let ie;e[45]!==j||e[46]!==m?.reportApp||e[47]!==v?(ie=m?.reportApp??{connectionId:j,virtualMcpId:v,toolName:Xt},e[45]=j,e[46]=m?.reportApp,e[47]=v,e[48]=ie):ie=e[48];const ae=ie;let Ae;e[49]!==w||e[50]!==c||e[51]!==t.id||e[52]!==t.slug||e[53]!==ae||e[54]!==A?(Ae=async()=>{K(null),te("commerce_onboarding_open_report_clicked",{domain:we(w)??void 0,organization_id:t.id});const F=Ee(w);if(F.ok)try{await A.mutateAsync(F.value)}catch(Q){const le=Q;te("commerce_onboarding_run_failed",{domain:we(w)??void 0,organization_id:t.id,error:le instanceof Error?le.message:String(le)}),K("Algo deu errado ao gerar seu relatório. Tente novamente em instantes.");return}localStorage.setItem(Qt.sidebarOpen(),JSON.stringify(!1)),c({to:"/$org/$taskId",params:{org:t.slug,taskId:crypto.randomUUID()},search:{virtualmcpid:ae.virtualMcpId,main:Jt(ae.connectionId,ae.toolName),chat:0}})},e[49]=w,e[50]=c,e[51]=t.id,e[52]=t.slug,e[53]=ae,e[54]=A,e[55]=Ae):Ae=e[55];const Qe=Ae;if($){let F;return e[56]!==H||e[57]!==L||e[58]!==w||e[59]!==Qe||e[60]!==t||e[61]!==ae||e[62]!==q||e[63]!==A.isPending?(F=n.jsx(As,{org:t,reportApp:ae,onOpenReport:Qe,isSubmitting:A.isPending,error:q,meetingUrl:H,meetingVisual:L,siteUrl:w}),e[56]=H,e[57]=L,e[58]=w,e[59]=Qe,e[60]=t,e[61]=ae,e[62]=q,e[63]=A.isPending,e[64]=F):F=e[64],F}if(T.isPending){let F;return e[65]!==L?(F=n.jsx(Ht,{visual:L}),e[65]=L,e[66]=F):F=e[66],F}if(s){let F,Q;if(e[67]!==L||e[68]!==G||e[69]!==s||e[70]!==d||e[71]!==t.name||e[72]!==T.isPending||e[73]!==a){Q=Symbol.for("react.early_return_sentinel");e:if(F=Ee(s),!F.ok){const Ye=`A configuração de commerce continuará em ${t.name}.`;let ge;e[76]!==Ye?(ge=n.jsx(re,{title:"Diagnóstico de commerce",description:Ye}),e[76]=Ye,e[77]=ge):ge=e[77];const Je=n.jsx(Oe,{message:yt(F.error)});let he;e[78]!==G||e[79]!==d||e[80]!==T.isPending||e[81]!==a?(he=n.jsx(Ze,{siteUrl:a,error:d,isSubmitting:T.isPending,onSiteUrlChange:u,onSubmit:G}),e[78]=G,e[79]=d,e[80]=T.isPending,e[81]=a,e[82]=he):he=e[82];let xe;e[83]!==ge||e[84]!==Je||e[85]!==he?(xe=n.jsxs("div",{className:"grid gap-10",children:[ge,Je,he]}),e[83]=ge,e[84]=Je,e[85]=he,e[86]=xe):xe=e[86];let Ue;e[87]!==L||e[88]!==xe?(Ue=n.jsx(ne,{visual:L,children:xe}),e[87]=L,e[88]=xe,e[89]=Ue):Ue=e[89],Q=Ue;break e}e[67]=L,e[68]=G,e[69]=s,e[70]=d,e[71]=t.name,e[72]=T.isPending,e[73]=a,e[74]=F,e[75]=Q}else F=e[74],Q=e[75];if(Q!==Symbol.for("react.early_return_sentinel"))return Q;const le=`O Commerce Discovery está sendo preparado para ${F.value}.`;let ue;e[90]!==le?(ue=n.jsx(re,{title:"Diagnóstico de commerce",description:le}),e[90]=le,e[91]=ue):ue=e[91];let fe;e[92]!==G||e[93]!==d||e[94]!==T.isPending||e[95]!==a?(fe=d?n.jsxs(n.Fragment,{children:[n.jsx(Oe,{message:d}),n.jsx(Ze,{siteUrl:a,error:null,isSubmitting:T.isPending,onSiteUrlChange:u,onSubmit:G})]}):n.jsx(dt,{}),e[92]=G,e[93]=d,e[94]=T.isPending,e[95]=a,e[96]=fe):fe=e[96];let pe;e[97]!==ue||e[98]!==fe||e[99]!==ee?(pe=n.jsxs("div",{ref:ee,className:"grid gap-10",children:[ue,fe]}),e[97]=ue,e[98]=fe,e[99]=ee,e[100]=pe):pe=e[100];let Pe;return e[101]!==L||e[102]!==pe?(Pe=n.jsx(ne,{visual:L,children:pe}),e[101]=L,e[102]=pe,e[103]=Pe):Pe=e[103],Pe}const We=`A configuração de commerce continuará em ${t.name}.`;let ce;e[104]!==We?(ce=n.jsx(re,{title:"Diagnóstico de commerce",description:We}),e[104]=We,e[105]=ce):ce=e[105];let de;e[106]!==G||e[107]!==d||e[108]!==T.isPending||e[109]!==a?(de=n.jsx(Ze,{siteUrl:a,error:d,isSubmitting:T.isPending,onSiteUrlChange:u,onSubmit:G}),e[106]=G,e[107]=d,e[108]=T.isPending,e[109]=a,e[110]=de):de=e[110];let me;e[111]!==ce||e[112]!==de?(me=n.jsxs("div",{className:"grid gap-10",children:[ce,de]}),e[111]=ce,e[112]=de,e[113]=me):me=e[113];let Re;return e[114]!==L||e[115]!==me?(Re=n.jsx(ne,{visual:L,children:me}),e[114]=L,e[115]=me,e[116]=Re):Re=e[116],Re}function Ze(o){const e=M.c(20),{siteUrl:t,error:s,isSubmitting:i,onSiteUrlChange:c,onSubmit:r}=o;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx("label",{className:"text-sm font-medium",htmlFor:"commerce-site-url",children:"URL do site"}),e[0]=l):l=e[0];let a;e[1]!==c?(a=v=>c(v.target.value),e[1]=c,e[2]=a):a=e[2];const u=!!s;let m;e[3]!==i||e[4]!==t||e[5]!==a||e[6]!==u?(m=n.jsx(ke,{id:"commerce-site-url",type:"text",inputMode:"url",value:t,onChange:a,placeholder:"https://example.com","aria-invalid":u,disabled:i}),e[3]=i,e[4]=t,e[5]=a,e[6]=u,e[7]=m):m=e[7];let p;e[8]!==s?(p=s?n.jsx(Oe,{message:s}):null,e[8]=s,e[9]=p):p=e[9];let d;e[10]!==m||e[11]!==p?(d=n.jsxs("div",{className:"grid gap-2",children:[l,m,p]}),e[10]=m,e[11]=p,e[12]=d):d=e[12];let h;e[13]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(wt,{size:16}),e[13]=h):h=e[13];let b;e[14]!==i?(b=n.jsxs(W,{type:"submit",size:"xl",className:"w-full",disabled:i,children:["Continuar",h]}),e[14]=i,e[15]=b):b=e[15];let j;return e[16]!==r||e[17]!==d||e[18]!==b?(j=n.jsxs("form",{className:"grid gap-4",onSubmit:r,children:[d,b]}),e[16]=r,e[17]=d,e[18]=b,e[19]=j):j=e[19],j}function As(o){const e=M.c(27),{org:t,reportApp:s,onOpenReport:i,isSubmitting:c,error:r,meetingUrl:l,meetingVisual:a,siteUrl:u}=o;let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(re,{}),e[0]=m):m=e[0];let p;e[1]!==t||e[2]!==s.connectionId||e[3]!==u?(p=n.jsx(ms,{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]!==l||e[6]!==t.id?(d=n.jsx(ys,{className:"md:hidden",href:l,orgId:t.id}),e[5]=l,e[6]=t.id,e[7]=d):d=e[7];let h;e[8]!==r?(h=r?n.jsx(Oe,{message:r}):null,e[8]=r,e[9]=h):h=e[9];const b=c||!s.virtualMcpId,j=c?"Abrindo relatório...":"Ver relatório completo";let v;e[10]!==c?(v=c?null:n.jsx(wt,{size:18}),e[10]=c,e[11]=v):v=e[11];let g;e[12]!==i||e[13]!==b||e[14]!==j||e[15]!==v?(g=n.jsxs(W,{type:"button",size:"xl",className:"w-full rounded-2xl text-base font-medium",onClick:i,disabled:b,children:[j,v]}),e[12]=i,e[13]=b,e[14]=j,e[15]=v,e[16]=g):g=e[16];let f;e[17]!==d||e[18]!==h||e[19]!==g?(f=n.jsxs("div",{className:"flex shrink-0 flex-col gap-3 md:mt-8",children:[d,h,g]}),e[17]=d,e[18]=h,e[19]=g,e[20]=f):f=e[20];let y;e[21]!==p||e[22]!==f?(y=n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-6 md:grid md:gap-4",children:[m,p,f]}),e[21]=p,e[22]=f,e[23]=y):y=e[23];let x;return e[24]!==a||e[25]!==y?(x=n.jsx(ne,{align:"fill",visual:a,children:y}),e[24]=a,e[25]=y,e[26]=x):x=e[26],x}function Oe(o){const e=M.c(2),{message:t}=o;let s;return e[0]!==t?(s=n.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:t}),e[0]=t,e[1]=s):s=e[1],s}export{qo as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{c as Ke,r as l,j as i,i as re,B as fe,l as Be,m as ut,t as $,K as Te}from"./index-CZbxUADj.js";import{F as mt,l as pt}from"./index-DwB1A79I.js";import{i as ht,ay as xt,az as gt,aA as ae,aB as yt,W as $e}from"./agent-icon-JEYszNv_.js";import{a as wt}from"./Tool01-B9ENuxHB.js";import{s as jt}from"./XClose-lpbFBumt.js";import{S as bt}from"./scroll-area-B34ocznc.js";import{T as Re,a as Oe,b as ze}from"./tooltip-BIkqUL7P.js";import{f as vt,a as Ct,b as Nt,c as St,d as Dt,e as kt,A as Ft,g as Lt}from"./alert-dialog-Dp137axs.js";import{u as Et}from"./chat-context-B9cX9pqL.js";import{b as Pt}from"./shell-layout-Cq_lzUpC.js";import{am as le,an as Ae,ao as Tt}from"./index-B0K_XJu-.js";import{a as $t,b as Rt,c as Ot,D as zt,d as At,e as Wt}from"./dialog-DusnkLeX.js";import{I as We}from"./input-OOLypNKG.js";import{b as It,C as _,a as Ie,c as Mt,d as Kt}from"./context-menu-CePpv_1d.js";import{t as Bt}from"./ChevronDown-B6sLE2xR.js";import{i as Vt}from"./ChevronRight-DK82xziN.js";import{a as Gt}from"./ZoomOut-DgW92_SE.js";import{E as qt,q as Me,r as he,s as Qt,t as Ut,u as Ht,v as M,w as ce,g as xe,x as ge,y as Jt,z as Xt,A as ye,B as de,C as we,D as Yt,G as Zt}from"./preview-dialog-BKNiQWET.js";import"./AlertCircle-Dio95INd.js";import"./SwitchHorizontal01-BzIaGAE4.js";import"./Settings02-B3jhFlnY.js";import"./XCircle-BxrxGshe.js";import"./ArrowUpRight-Dkv5fLL0.js";import"./ZapSquare-BYxAEf78.js";import"./Users03-BJwd0RYw.js";import"./CheckCircle-pzf-q17S.js";import"./ChevronUp-CI58apRt.js";import"./ChevronLeft-BQ_yXy4h.js";import"./DotsVertical-CCj2JF9I.js";import"./Stars02-DeYxW3ax.js";import"./Eye-DrIIwH0a.js";import"./Globe01-i7PaDcFe.js";import"./FilterLines-GbfpFZU3.js";import"./Star01-cDTm87ar.js";import"./Globe04-DwLIzRqi.js";import"./HardDrive-B4oYS36K.js";import"./Key01-D8nD65UB.js";import"./LayoutLeft-CtPD4GHv.js";import"./LinkExternal01-BAv-tJ-n.js";import"./Monitor01-DcULUfdd.js";import"./Sun-MpUDOSI6.js";import"./Palette-D-hau-3h.js";import"./Play-D1sgqYSM.js";import"./Plus-C6B9usat.js";import"./SearchLg-pYm4vmKf.js";import"./SearchMd-B4MY5w0a.js";import"./Shield01-Cmee6fI0.js";import"./Stars01-Cp2MniF9.js";import"./Trash01-CB3z-7dC.js";import"./Upload01-C6NdFiaS.js";import"./User01-DmH6DXKh.js";import"./Users01-DxmfiQX8.js";import"./X-cfbREiE9.js";import"./Zap-DuMrWPPZ.js";import"./use-clock-tick-CsjHr6YI.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-DocWgb9C.js";import"./file-type-icon-CUqgllpd.js";import"./use-mobile-xaWWq617.js";import"./tab-id-BptcWVWa.js";import"./content-blocks-o63cs2vh.js";import"./types-BUxyMAUc.js";import"./use-mcp-client-x8x64TSz.js";import"./auth-B1T8pbnO.js";import"./hooks-CmPpYlX_.js";import"./decopilot-sse-pool-AUwBmjSL.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./studio-tools-CoYqV6oY.js";import"./sheet-Cenikbh0.js";import"./integration-icon-1rQakDyj.js";import"./use-virtual-mcp-DCcYk587.js";import"./use-collections-CRpX6O3B.js";import"./use-navigate-to-agent-CpELvU_F.js";import"./use-connection-BtvYZVZj.js";import"./use-mcp-prompts-QN0_2c09.js";import"./form-Cnnlq12A.js";import"./label-D-uQU30d.js";import"./select-B0PHNa-r.js";import"./use-ai-providers-Pn2gmaRt.js";import"./use-decopilot-events-iJrJCUNi.js";import"./use-organization-settings-B_G4Ejp_.js";import"./avatar-DuIniPKR.js";import"./required-auth-layout-BObYAkHJ.js";import"./use-org-sso-BoaF2hTA.js";import"./index-BfEKx597.js";import"./drawer-CKZsljPV.js";import"./collection-search-CKvajahs.js";import"./tabs-BFLKd-Fg.js";import"./toggle-group-D69LxBwK.js";import"./sortable.esm-TIFkXoZE.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-_tH4wROb.js";import"./use-registry-connections-DNz9gvvs.js";import"./useInfiniteQuery-nhHcm16X.js";import"./use-infinite-scroll-DzCCXaoU.js";import"./extract-connection-data-gQ20kjhu.js";import"./card-D_tTFSOo.js";import"./collection-tabs-BJlB666Z.js";import"./badge-B6rmuxMV.js";import"./textarea-BvEvW0x2.js";import"./connection-form-helpers-BITqGJc6.js";import"./authenticate-and-persist-oauth-B5YALq2v.js";import"./mcp-oauth-CGEKoHUR.js";import"./useSuspenseInfiniteQuery-DEVNYJtE.js";import"./connect-desktop-dialog-Cluga9K_.js";import"./decopilot-CD2vHDS0.js";import"./checkbox-CMlypndK.js";import"./skeleton-Dz0KaZHB.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-CsmwukIF.js";import"./popover-keNQSGqd.js";import"./command-BqoeUfcd.js";import"./index-BweBKOmQ.js";import"./use-org-fs-DCGS381R.js";import"./dropdown-menu-BzkXPAU_.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-R_QWPjXo.js";import"./empty-state-oY4rli47.js";import"./toolbar-C_M9JPnc.js";import"./use-mcp-tools-9T5nm0Q5.js";import"./use-capability-C515Wh55.js";import"./shell-route-loading-BggkjeNi.js";import"./tools-list-CbmZIzyR.js";import"./switch-bOfplgn6.js";import"./use-debounced-autosave-BrwGH0--.js";import"./index-wSgegl9c.js";import"./sidebar-B6Bc15Ll.js";import"./search-input-DcO2Ye3j.js";import"./github-repo-picker-DSqWq_Dx.js";import"./use-debounced-value-BvoHVGV4.js";import"./use-secrets-bhmOP2SP.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./view-mode-toggle-162vFjPm.js";import"./automation-runs-BcMS6CpQ.js";import"./table-DQ6wSSYP.js";import"./use-members-BFXkl0g2.js";import"./use-org-auth-client-BIR7FL5o.js";import"./task-status-D6O_-A2L.js";import"./use-automations-CFAPuCta.js";import"./use-file-configs-ZWV6NAjd.js";import"./monaco-editor-Da2HMuUr.js";import"./select-model-oQ7GNN5h.js";import"./automation-list-row-CFFDN4lq.js";const _t={"new-file":{title:"New File",description:"Enter a name for the new file.",submit:"Create",placeholder:"filename.ts"},"new-folder":{title:"New Folder",description:"Enter a name for the new folder.",submit:"Create",placeholder:"folder-name"},rename:{title:"Rename",description:"Enter a new name for this item.",submit:"Rename",placeholder:"new-name"}};function en(y){const e=Ke.c(51),{open:c,mode:K,initialName:X,parentLabel:Q,isPending:A,onSubmit:B,onOpenChange:P}=y,W=X===void 0?"":X,o=A===void 0?!1:A,[p,R]=l.useState(W),[I,V]=l.useState(c),f=_t[K];c!==I&&(V(c),c&&R(W));let F;e[0]!==o||e[1]!==P?(F=E=>{!E&&!o&&P(!1)},e[0]=o,e[1]=P,e[2]=F):F=e[2];const U=F;let G;e[3]!==o||e[4]!==p||e[5]!==B?(G=async E=>{E.preventDefault();const z=p.trim();!z||o||await B(z)},e[3]=o,e[4]=p,e[5]=B,e[6]=G):G=e[6];const q=G;let L;e[7]!==f.title?(L=i.jsx($t,{children:f.title}),e[7]=f.title,e[8]=L):L=e[8];let N;e[9]!==f.description?(N=i.jsx(Rt,{children:f.description}),e[9]=f.description,e[10]=N):N=e[10];let O;e[11]!==L||e[12]!==N?(O=i.jsxs(Ot,{children:[L,N]}),e[11]=L,e[12]=N,e[13]=O):O=e[13];let S;e[14]!==Q?(S=Q&&i.jsxs("div",{className:"space-y-1.5",children:[i.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Location"}),i.jsx(We,{value:Q,readOnly:!0,disabled:!0,className:"font-mono text-xs"})]}),e[14]=Q,e[15]=S):S=e[15];let D;e[16]===Symbol.for("react.memo_cache_sentinel")?(D=i.jsx("label",{htmlFor:"file-explorer-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[16]=D):D=e[16];let j;e[17]===Symbol.for("react.memo_cache_sentinel")?(j=E=>R(E.target.value),e[17]=j):j=e[17];let b;e[18]!==f.placeholder||e[19]!==o||e[20]!==p?(b=i.jsxs("div",{className:"space-y-1.5",children:[D,i.jsx(We,{id:"file-explorer-name",value:p,onChange:j,placeholder:f.placeholder,autoFocus:!0,disabled:o})]}),e[18]=f.placeholder,e[19]=o,e[20]=p,e[21]=b):b=e[21];let h;e[22]!==b||e[23]!==S?(h=i.jsxs("div",{className:"space-y-4 py-4",children:[S,b]}),e[22]=b,e[23]=S,e[24]=h):h=e[24];let x;e[25]!==P?(x=()=>P(!1),e[25]=P,e[26]=x):x=e[26];let v;e[27]!==o||e[28]!==x?(v=i.jsx(fe,{type:"button",variant:"outline",onClick:x,disabled:o,children:"Cancel"}),e[27]=o,e[28]=x,e[29]=v):v=e[29];let C;e[30]!==o||e[31]!==p?(C=!p.trim()||o,e[30]=o,e[31]=p,e[32]=C):C=e[32];let u;e[33]!==f.submit||e[34]!==o?(u=o?i.jsxs(i.Fragment,{children:[i.jsx(re,{size:14,className:"animate-spin"}),"Saving…"]}):f.submit,e[33]=f.submit,e[34]=o,e[35]=u):u=e[35];let k;e[36]!==C||e[37]!==u?(k=i.jsx(fe,{type:"submit",disabled:C,children:u}),e[36]=C,e[37]=u,e[38]=k):k=e[38];let m;e[39]!==v||e[40]!==k?(m=i.jsxs(zt,{children:[v,k]}),e[39]=v,e[40]=k,e[41]=m):m=e[41];let g;e[42]!==q||e[43]!==h||e[44]!==m||e[45]!==O?(g=i.jsx(At,{className:"sm:max-w-md",children:i.jsxs("form",{onSubmit:q,children:[O,h,m]})}),e[42]=q,e[43]=h,e[44]=m,e[45]=O,e[46]=g):g=e[46];let T;return e[47]!==U||e[48]!==c||e[49]!==g?(T=i.jsx(Wt,{open:c,onOpenChange:U,children:g}),e[47]=U,e[48]=c,e[49]=g,e[50]=T):T=e[50],T}const tn="#d9a441";function nn(y){const e=Ke.c(45),{node:c,depth:K,isExpanded:X,isSelected:Q,isLoading:A,fileVisual:B,onOpen:P,onSelect:W,onNewFile:o,onNewFolder:p,onCopyPath:R,onCopyRelativePath:I,onRename:V,onDelete:f}=y,F=A===void 0?!1:A,U=c.kind==="directory",{Icon:G,color:q}=B,L=Q&&"bg-accent";let N;e[0]!==L?(N=Be("flex w-full items-center gap-1.5 px-2 py-1.5 text-left text-[13px] hover:bg-accent transition-colors",L),e[0]=L,e[1]=N):N=e[1];const O=`${K*14+8}px`;let S;e[2]!==O?(S={paddingLeft:O},e[2]=O,e[3]=S):S=e[3];let D;e[4]!==P||e[5]!==W?(D=()=>{W(),P()},e[4]=P,e[5]=W,e[6]=D):D=e[6];let j;e[7]!==G||e[8]!==q||e[9]!==U||e[10]!==X||e[11]!==F?(j=U?i.jsxs(i.Fragment,{children:[F?i.jsx(re,{size:14,className:"shrink-0 animate-spin text-muted-foreground"}):X?i.jsx(Bt,{size:14,className:"shrink-0 text-muted-foreground"}):i.jsx(Vt,{size:14,className:"shrink-0 text-muted-foreground"}),i.jsx(Gt,{size:16,className:"shrink-0",style:{color:tn}})]}):i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"w-3.5 shrink-0"}),i.jsx(G,{size:16,className:"shrink-0",style:{color:q}})]}),e[7]=G,e[8]=q,e[9]=U,e[10]=X,e[11]=F,e[12]=j):j=e[12];let b;e[13]!==c.name?(b=i.jsx("span",{className:"truncate",children:c.name}),e[13]=c.name,e[14]=b):b=e[14];let h;e[15]!==N||e[16]!==S||e[17]!==D||e[18]!==j||e[19]!==b?(h=i.jsx(It,{asChild:!0,children:i.jsxs("button",{type:"button",className:N,style:S,onClick:D,children:[j,b]})}),e[15]=N,e[16]=S,e[17]=D,e[18]=j,e[19]=b,e[20]=h):h=e[20];let x;e[21]!==o?(x=i.jsx(_,{onSelect:o,children:"New File"}),e[21]=o,e[22]=x):x=e[22];let v;e[23]!==p?(v=i.jsx(_,{onSelect:p,children:"New Folder"}),e[23]=p,e[24]=v):v=e[24];let C;e[25]===Symbol.for("react.memo_cache_sentinel")?(C=i.jsx(Ie,{}),e[25]=C):C=e[25];let u;e[26]!==R?(u=i.jsx(_,{onSelect:R,children:"Copy Path"}),e[26]=R,e[27]=u):u=e[27];let k;e[28]!==I?(k=i.jsx(_,{onSelect:I,children:"Copy Relative Path"}),e[28]=I,e[29]=k):k=e[29];let m;e[30]===Symbol.for("react.memo_cache_sentinel")?(m=i.jsx(Ie,{}),e[30]=m):m=e[30];let g;e[31]!==V?(g=i.jsx(_,{onSelect:V,children:"Rename"}),e[31]=V,e[32]=g):g=e[32];let T;e[33]!==f?(T=i.jsx(_,{variant:"destructive",onSelect:f,children:"Delete"}),e[33]=f,e[34]=T):T=e[34];let E;e[35]!==x||e[36]!==v||e[37]!==u||e[38]!==k||e[39]!==g||e[40]!==T?(E=i.jsxs(Mt,{className:"w-52",children:[x,v,C,u,k,m,g,T]}),e[35]=x,e[36]=v,e[37]=u,e[38]=k,e[39]=g,e[40]=T,e[41]=E):E=e[41];let z;return e[42]!==E||e[43]!==h?(z=i.jsxs(Kt,{children:[h,E]}),e[42]=E,e[43]=h,e[44]=z):z=e[44],z}pt.config({paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.0/min/vs"}});function je(y,e,c,K){return`/api/${y}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(c)}/${K}`}function rn(y){const e=M(y);return!e||e.includes("..")||e.includes("\\")?!1:e.startsWith(".deco/blocks/")||!e.startsWith("/")&&!e.includes("://")}const sn="#94a3b8";function on(y){const e=y.toLowerCase();return e.endsWith(".tsx")||e.endsWith(".ts")?{Icon:ae,color:"#3b82f6"}:e.endsWith(".jsx")||e.endsWith(".js")||e.endsWith(".mjs")||e.endsWith(".cjs")?{Icon:ae,color:"#d9a441"}:e.endsWith(".json")?{Icon:yt,color:"#cb9b3f"}:e.endsWith(".css")||e.endsWith(".scss")?{Icon:ae,color:"#06b6d4"}:e.endsWith(".html")||e.endsWith(".xml")?{Icon:ae,color:"#f97316"}:/\.(png|jpe?g|gif|webp|avif|ico|svg)$/.test(e)?{Icon:wt,color:"#a855f7"}:e.endsWith(".md")||e.endsWith(".mdx")?{Icon:$e,color:"#64748b"}:{Icon:$e,color:sn}}function Vi({orgSlug:y,virtualMcpId:e,branch:c,openPath:K}){const[X,Q]=l.useState({files:[],directories:[],truncated:!1}),{files:A,directories:B}=X,[P,W]=l.useState(new Set),[o,p]=l.useState(null),[R,I]=l.useState(null),[V,f]=l.useState([]),[F,U]=l.useState(""),[G,q]=l.useState(!1),[L,N]=l.useState(!1),[,O]=l.useState(new Set),[S,D]=l.useState(new Set),j=l.useRef(0),b=l.useRef(null),h=l.useRef(new Set),x=l.useRef(new Map);function v(t){O(n=>{const r=typeof t=="function"?t(n):t;return h.current=r,r})}const[C,u]=l.useState(new Map),k=l.useRef(null),[m,g]=l.useState(null),{sendMessage:T}=Et(),{setChatOpen:E}=Pt(),z=ut(),[w,H]=l.useState(null),[J,ue]=l.useState(null),[ee,ie]=l.useState(!1);async function te(t,n){const r=await fetch(je(y,e,c,t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n)});if(!r.ok){const s=await r.json().catch(()=>({}));throw new Error(s.error??`Request failed (${r.status})`)}return r.json()}async function se(){z.invalidateQueries({queryKey:Ae(y,e,c)})}function be(t,n){navigator.clipboard.writeText(n).then(()=>$.success(`${t} copied`),()=>$.error(`Failed to copy ${t.toLowerCase()}`))}function Ve(t){const n=Yt(t);if(!n)return;const r=`${y}/${e}/${c}`;z.setQueryData(Te.decofile(r),s=>{if(!s)return s;const{[n]:a,...d}=s;return d}),z.invalidateQueries({queryKey:Te.liveMeta(r)})}function Ge(t){const n=t.kind==="file"?[t.path]:A.filter(r=>r.startsWith(".deco/blocks/")).map(r=>ce(r)).filter(r=>r===t.path||r.startsWith(`${t.path}/`));for(const r of n)Ve(r)}function qe(t){const n=ce(t);return V.filter(r=>{if(r!==n&&!r.startsWith(`${n}/`))return!1;const s=C.get(r);return!!(s?.loaded&&s.editorValue!==s.savedContent)})}function ve(t){f(n=>n.map(r=>t(r)).filter(r=>r!==null)),p(n=>n&&t(n)),u(n=>{const r=new Map;for(const[s,a]of n){const d=t(s);d&&r.set(d,a)}return r}),I(n=>{if(!n)return n;const r=t(n.path);return r?r===n.path?n:{...n,path:r,name:r.split("/").pop()??r}:null})}function Qe(t){const n=ce(t);I(r=>r&&(r.path===n||r.path.startsWith(`${n}/`)?null:r)),ve(r=>r===n||r.startsWith(`${n}/`)?null:r)}async function Ue(t){if(!w)return;const n=de(w.parentDir,t);if(we(n,A,B))throw new Error(`"${t}" already exists`);await te("write",{path:M(n),content:""}),await ne(),await se(),H(null),me(n)}async function He(t){if(!w)return;const n=de(w.parentDir,t);if(we(n,A,B))throw new Error(`"${t}" already exists`);const r=M(n);await te("mkdir",{path:r}),Q(s=>({...s,directories:s.directories.includes(r)?s.directories:[...s.directories,r]})),await ne(),await se(),H(null),W(s=>{const a=new Set(s);for(const d of he(n))a.add(d);return a.add(n),a}),I({name:t,path:n,kind:"directory",children:[]})}async function Je(t){if(!w)return;const n=w.node.path,r=ye(n),s=de(r,t);if(s===n){H(null);return}if(we(s,A,B))throw new Error(`"${t}" already exists`);await te("rename",{from:M(n),to:M(s)}),ve(a=>a===n?s:a.startsWith(`${n}/`)?de(s,a.slice(n.length+1)):a),await ne(),await se(),H(null)}async function Xe(t){ie(!0);try{await te("unlink",{path:M(t.path),recursive:t.kind==="directory"}),Ge(t),Qe(t.path),await ne(),await se(),ue(null),$.success(`Deleted "${t.name}"`)}catch(n){$.error(n instanceof Error?n.message:"Delete failed")}finally{ie(!1)}}async function Ye(t){const n=Xt(t);if(n){$.error(n);return}ie(!0);try{w?.mode==="new-file"?(await Ue(t),$.success(`Created "${t}"`)):w?.mode==="new-folder"?(await He(t),$.success(`Created folder "${t}"`)):w?.mode==="rename"&&(await Je(t),$.success(`Renamed to "${t}"`))}catch(r){$.error(r instanceof Error?r.message:"Operation failed")}finally{ie(!1)}}const Ce=l.useRef(!1);Ce.current||(Ce.current=!0,b.current=ne());const[Ze,_e]=l.useState(null);if(K&&K!==Ze){_e(K);const t=K;queueMicrotask(()=>{rn(t)&&me(t).catch(n=>{$.error(n instanceof Error?n.message:"Failed to open file")})})}async function Ne(t){const n=await te("glob",t);return{files:n.files??[],directories:n.directories??[],truncated:n.truncated}}function Se(t,n,r){if(r!==j.current)return!1;let s=!1;return Q(a=>{const d=n?Zt(a.files,a.directories,t,a.truncated):{files:t.files,directories:t.directories??[],truncated:!!t.truncated};return s=!!d.truncated,{files:d.files,directories:d.directories,truncated:s}}),s&&$.warning("File list truncated — some files may be hidden"),s}async function et(t){const n=x.current.get(t);if(n)return n;const r=j.current,s=(async()=>{const a=await Ne({pattern:"**/*",path:M(t),limit:Me}),d=Se(a,!0,r);return!d&&r===j.current&&v(Y=>{const oe=new Set(Y);return oe.add(t),oe}),d})();x.current.set(t,s);try{return await s}finally{x.current.delete(t)}}async function De(t){if(!ge(t,h.current))return!1;D(n=>new Set(n).add(t));try{return await et(t)}finally{D(n=>{const r=new Set(n);return r.delete(t),r})}}async function tt(t){const n=new Set(h.current);for(const r of he(t)){if(!ge(r,n))continue;if(await De(r))throw new Error("Folder listing truncated — expand again to load more");n.add(r)}}async function ne(){const t=++j.current;x.current.clear(),q(!0),v(new Set),W(new Set),D(new Set);try{const n=await Ne({pattern:"**/*",limit:Me,maxDepth:qt});Se(n,!1,t),N(!0)}catch{L&&$.error("Failed to refresh file tree")}finally{q(!1)}}async function ke(t){if(!C.get(t)?.loaded){u(r=>{const s=new Map(r);return s.set(t,{savedContent:"",editorValue:"",loaded:!1}),s});try{const r=await fetch(je(y,e,c,"read"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:M(t),full:!0})});if(!r.ok)return;const s=await r.json(),a=Jt(s.content??"");u(d=>{const Y=new Map(d);return Y.set(t,{savedContent:a,editorValue:a,loaded:!0}),Y})}catch{}}}async function nt(t,n){try{const r=await fetch(je(y,e,c,"write"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:M(t),content:n})});if(!r.ok){le("file save failed",{path:t,status:r.status});return}le("file saved via sandbox /write",{path:t}),z.invalidateQueries({queryKey:Ae(y,e,c)});try{const s=await Tt(y,e,c);le("git status after save",s)}catch(s){le("git status after save failed",{path:t,error:s instanceof Error?s.message:String(s)})}u(s=>{const a=new Map(s),d=a.get(t);return d&&a.set(t,{...d,savedContent:n}),a})}catch{}}function rt(t){p(t),I({name:t.split("/").pop()??t,path:t,kind:"file",children:[]}),g(null),V.includes(t)||f(n=>[...n,t]),ke(t)}function it(t){f(n=>{const r=n.filter(s=>s!==t);return o===t&&p(r[r.length-1]??null),r}),u(n=>{const r=new Map(n);return r.delete(t),r})}function Fe(t){W(n=>{const r=new Set(n);return r.has(t)?r.delete(t):r.add(t),r})}async function st(t){if(ge(t,h.current))try{if(await De(t))return}catch(n){$.error(n instanceof Error?n.message:"Failed to load folder");return}Fe(t)}async function ot(t,n){if(n){Fe(t);return}await st(t)}async function me(t){await b.current,await tt(t);const n=he(t);W(r=>{const s=new Set(r);for(const a of n)s.add(a);return s}),rt(t)}function at(){return R?.kind==="directory"?R.path:R?.kind==="file"?ye(R.path):o?ye(o):"/"}function Le(t){const n=at();H({mode:t,parentDir:n,node:{name:"",path:n,kind:"directory",children:[]}})}const lt=Qt(A,B),Ee=Ut(lt,P),Pe=F?Ee.filter(t=>t.node.name.toLowerCase().includes(F.toLowerCase())):Ee,Z=o?C.get(o):null,ct=Z?.loaded&&Z.editorValue!==Z.savedContent,pe=J?qe(J.path):[],dt=(t,n)=>{k.current=t,t.addCommand(n.KeyMod.CtrlCmd|n.KeyCode.KeyS,async()=>{if(!o)return;const r=t.getValue();await nt(o,r)}),t.addCommand(n.KeyMod.CtrlCmd|n.KeyCode.KeyK,()=>{const r=t.getSelection(),s=t.getModel();if(!r||!s||!o)return;const a=s.getValueInRange(r);g({filePath:o,lineStart:r.startLineNumber,lineEnd:r.endLineNumber,selectedCode:a})})};function ft(t){if(!m)return;const n=[`The user selected code in the file explorer and asked: **"${t.trim()}"**`,"",`**File:** \`${m.filePath}\``,`**Lines:** ${m.lineStart}–${m.lineEnd}`];if(m.selectedCode){const r=xe(m.filePath),s=m.selectedCode.replace(/```/g,"`` `");n.push("","**Selected code:**","```"+r,s,"```")}n.push("","Please read the source file, locate the code, and apply the requested change."),E(!0),T({parts:[{type:"text",text:n.join(`
|
|
2
|
-
`)}]}),g(null)}return G&&!L?i.jsx("div",{className:"flex items-center justify-center h-full w-full",children:i.jsx(re,{size:20,className:"animate-spin text-muted-foreground"})}):i.jsxs("div",{className:"flex h-full w-full overflow-hidden",children:[i.jsxs("div",{className:"w-64 shrink-0 border-r flex flex-col overflow-hidden",children:[i.jsxs("div",{className:"flex items-center gap-1 p-2 border-b",children:[i.jsxs("div",{className:"relative min-w-0 flex-1",children:[i.jsx(ht,{size:14,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground"}),i.jsx("input",{type:"text",value:F,onChange:t=>U(t.target.value),placeholder:"Search files...","aria-label":"Search files",className:"w-full rounded-md border border-input bg-transparent pl-7 pr-2 py-1.5 text-xs outline-none placeholder:text-muted-foreground focus:ring-1 focus:ring-ring"})]}),i.jsxs(Re,{children:[i.jsx(Oe,{asChild:!0,children:i.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0","aria-label":"New file",onClick:()=>Le("new-file"),children:i.jsx(xt,{size:14})})}),i.jsx(ze,{side:"bottom",children:"New file"})]}),i.jsxs(Re,{children:[i.jsx(Oe,{asChild:!0,children:i.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0","aria-label":"New folder",onClick:()=>Le("new-folder"),children:i.jsx(gt,{size:14})})}),i.jsx(ze,{side:"bottom",children:"New folder"})]})]}),i.jsx(bt,{className:"flex-1",children:i.jsxs("div",{className:"py-1",children:[Pe.map(t=>{const{node:n,depth:r}=t,s=n.kind==="directory",a=P.has(n.path),d=R?.path===n.path,Y=Ht(n.path,n.kind),oe=s&&S.has(n.path);return i.jsx(nn,{node:n,depth:r,isExpanded:a,isSelected:d,isLoading:oe,fileVisual:on(n.name),onSelect:()=>I(n),onOpen:()=>{s?ot(n.path,a):me(n.path)},onNewFile:()=>H({mode:"new-file",node:n,parentDir:Y}),onNewFolder:()=>H({mode:"new-folder",node:n,parentDir:Y}),onCopyPath:()=>be("Path",ce(n.path)),onCopyRelativePath:()=>be("Relative path",M(n.path)),onRename:()=>H({mode:"rename",node:n,parentDir:Y}),onDelete:()=>ue(n)},n.path)}),L&&Pe.length===0&&i.jsx("div",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:F?`No files match "${F}"`:"No files found"})]})})]}),i.jsxs("div",{className:"relative flex-1 flex flex-col overflow-hidden",children:[V.length>0&&i.jsx("div",{className:"flex items-center border-b overflow-x-auto shrink-0",children:V.map(t=>{const n=C.get(t),r=n?.loaded&&n.editorValue!==n.savedContent,s=o===t,a=t.split("/").pop()??t;return i.jsxs("div",{className:Be("flex items-center gap-1 px-3 py-1.5 text-xs border-r cursor-pointer transition-colors",s?"bg-background text-foreground":"bg-muted/50 text-muted-foreground hover:bg-accent"),onClick:()=>{p(t),ke(t)},onKeyDown:()=>{},role:"tab",tabIndex:0,"aria-selected":s,children:[i.jsx("span",{className:"truncate max-w-32",children:a}),r&&i.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-foreground/60 shrink-0"}),i.jsx("button",{type:"button",className:"ml-1 rounded p-0.5 hover:bg-accent-foreground/10",onClick:d=>{d.stopPropagation(),it(t)},children:i.jsx(jt,{size:12})})]},t)})}),m&&i.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 z-20 mt-2",style:{width:"360px"},children:i.jsxs("form",{className:"flex w-full items-center gap-1.5 rounded-xl border border-border bg-background/95 px-3 py-1.5 shadow-lg backdrop-blur",onSubmit:t=>{t.preventDefault();const r=t.currentTarget.elements.namedItem("askAiInput");r.value.trim()&&ft(r.value)},children:[i.jsx("input",{name:"askAiInput",autoFocus:!0,type:"text",placeholder:"Ask the AI...",className:"min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground",onKeyDown:t=>{t.stopPropagation(),t.key==="Escape"&&g(null)}}),i.jsx("button",{type:"submit",className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-foreground text-background transition-opacity",title:"Send",children:i.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none","aria-hidden":"true",children:[i.jsx("title",{children:"Send"}),i.jsx("path",{d:"M5 9V1M1 5l4-4 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})}),i.jsx("div",{className:"flex-1 overflow-hidden",children:o&&Z?.loaded?i.jsx(mt,{language:xe(o),theme:document.documentElement.classList.contains("dark")?"vs-dark":"light",value:Z.editorValue,path:o,onChange:t=>{const n=o;n&&u(r=>{const s=new Map(r),a=s.get(n);return a&&s.set(n,{...a,editorValue:t??""}),s})},onMount:dt,loading:i.jsx("div",{className:"flex items-center justify-center h-full w-full",children:i.jsx(re,{size:20,className:"animate-spin text-muted-foreground"})}),options:{fontSize:13,scrollBeyondLastLine:!1,automaticLayout:!0,lineNumbersMinChars:2,wordWrap:"on",minimap:{enabled:!1},padding:{top:12,bottom:12},scrollbar:{vertical:"auto",horizontal:"auto",verticalScrollbarSize:8,horizontalScrollbarSize:8}}},o):o&&!Z?.loaded?i.jsx("div",{className:"flex items-center justify-center h-full w-full",children:i.jsx(re,{size:20,className:"animate-spin text-muted-foreground"})}):i.jsx("div",{className:"flex items-center justify-center h-full w-full text-sm text-muted-foreground",children:"Select a file to edit"})}),o&&i.jsxs("div",{className:"flex items-center justify-between px-3 py-1 border-t text-[11px] text-muted-foreground shrink-0",children:[i.jsx("span",{className:"truncate",children:o}),i.jsxs("span",{children:[ct?"Modified":"Saved"," ·"," ",xe(o)]})]})]}),i.jsx(en,{open:w!==null,mode:w?.mode??"new-file",initialName:w?.mode==="rename"?w.node.name:"",parentLabel:w&&w.mode!=="rename"?w.parentDir==="/"?"/":M(w.parentDir):void 0,isPending:ee,onSubmit:Ye,onOpenChange:t=>{!t&&!ee&&H(null)}}),i.jsx(vt,{open:J!==null,onOpenChange:t=>{!t&&!ee&&ue(null)},children:i.jsxs(Ct,{children:[i.jsxs(Nt,{children:[i.jsxs(St,{children:["Delete ",J?.kind==="directory"?"folder":"file","?"]}),i.jsxs(Dt,{children:["This will permanently delete"," ",i.jsx("span",{className:"font-mono",children:J?.name}),J?.kind==="directory"?" and everything inside it.":".",pe.length>0&&i.jsxs(i.Fragment,{children:[" ",pe.length===1?"One open file has unsaved changes that will be lost.":`${pe.length} open files have unsaved changes that will be lost.`]})]})]}),i.jsxs(kt,{children:[i.jsx(Ft,{disabled:ee,children:"Cancel"}),i.jsx(Lt,{disabled:ee||!J,onClick:t=>{t.preventDefault(),J&&Xe(J)},children:"Delete"})]})]})})]})}export{Vi as FileExplorer};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as L,j as t,D as Q,a as te,m as W,r as G,a7 as B,i as D,d as ne,t as U,K as V,k as se,l as K,q as oe,ag as re}from"./index-CZbxUADj.js";import{c as ie,a as ae,d as le,e as ce}from"./dialog-DusnkLeX.js";import{C as J}from"./checkbox-CMlypndK.js";import{C as ue}from"./collection-search-CKvajahs.js";import{u as de}from"./use-debounced-value-BvoHVGV4.js";import{b as me,u as fe}from"./use-connection-BtvYZVZj.js";import{W as pe,u as H,S as X}from"./use-mcp-client-x8x64TSz.js";import{b as Z}from"./Settings02-B3jhFlnY.js";import{w as ge}from"./agent-icon-JEYszNv_.js";import{a as xe}from"./authenticate-and-persist-oauth-B5YALq2v.js";import{u as he}from"./use-mcp-tools-9T5nm0Q5.js";import{e as ye}from"./extract-connection-data-gQ20kjhu.js";import{m as be}from"./use-navigate-to-agent-CpELvU_F.js";function M(s){const e=L.c(4),{size:n,className:o}=s;let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0016 8c0-4.42-3.58-8-8-8z"}),e[0]=u):u=e[0];let l;return e[1]!==o||e[2]!==n?(l=t.jsx("svg",{width:n,height:n,viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",className:o,children:u}),e[1]=o,e[2]=n,e[3]=l):l=e[3],l}function we(s,e){const n=L.c(12),{org:o}=Q();let u;n[0]!==o.id?(u=pe.REGISTRY(o.id),n[0]=o.id,n[1]=u):u=n[1];const l=u;let i;n[2]!==o.id||n[3]!==o.slug||n[4]!==l?(i={connectionId:l,orgId:o.id,orgSlug:o.slug},n[2]=o.id,n[3]=o.slug,n[4]=l,n[5]=i):i=n[5];const x=H(i);let m;n[6]!==s?(m={name:s},n[6]=s,n[7]=m):m=n[7];const r=e?.enabled??!0;let h;return n[8]!==x||n[9]!==m||n[10]!==r?(h={client:x,toolName:"COLLECTION_REGISTRY_APP_GET",toolArguments:m,enabled:r,staleTime:3e5,select:Ne},n[8]=x,n[9]=m,n[10]=r,n[11]=h):h=n[11],he(h)}function Ne(s){return s.structuredContent?.item??null}const Ie="deco/mcp-github";function je(s){const{org:e}=Q(),{data:n}=te.useSession(),o=me(),u=W(),[l,i]=G.useState("idle"),[x,m]=G.useState(null),[r,h]=G.useState(null),{data:g,isLoading:a}=we(Ie,{enabled:s.enabled}),w=G.useRef(!1);s.enabled&&g&&!a&&!w.current&&n?.user?.id&&l==="idle"&&(w.current=!0,b());async function b(){if(!(!g||!n?.user?.id||!e))try{i("installing"),m(null);const y=ye(g,e.id,n.user.id,{remoteIndex:0});if(!y.connection_url)throw new Error("Registry item is missing a remote URL for mcp-github");const{id:j}=await o.create.mutateAsync(y);i("authenticating");const f=await xe({connectionId:j,orgId:e.id,orgSlug:e.slug,persistFallback:d=>o.update.mutateAsync({id:j,data:{connection_token:d}}).then(()=>{})});if(f.ran&&!f.ok){try{await o.delete.mutateAsync(j)}catch{}throw new Error(f.error&&f.error!=="no token received"?f.error:"No token received from GitHub")}B(u,e.id),h(y),i("ready")}catch(y){m(y instanceof Error?y.message:String(y)),i("error")}}function N(){i("idle"),m(null),h(null),w.current=!1}return s.enabled&&a&&l==="idle"?{status:"installing",error:null,connection:null,retry:N}:{status:l,error:x,connection:r,retry:N}}const z={contents:"write",metadata:"read",pull_requests:"write",issues:"write"};function Se(s){if(!s||typeof s!="object"||Array.isArray(s))return z;const e=s;return Object.values(e).some(n=>typeof n!="string")?z:e}function Ce(s){if(!(typeof s!="number"||!Number.isFinite(s)||!Number.isInteger(s)||s<=0))return s}function ve(s){const e=s.metadata?.repoScope;if(!e||typeof e.installationId!="number"||!Number.isFinite(e.installationId)||!Number.isInteger(e.installationId)||e.installationId<=0||typeof e.owner!="string"||typeof e.repo!="string"||e.owner.length===0||e.repo.length===0)return null;const n=Ce(e.repositoryId);return{sourceConnectionId:typeof e.sourceConnectionId=="string"?e.sourceConnectionId:void 0,installationId:e.installationId,repositoryId:n,owner:e.owner,repo:e.repo,permissions:Se(e.permissions),grantProvider:e.grantProvider==="github-mcp"?"github-mcp":void 0}}function Ee(s){return(s??[]).filter(e=>ve(e)===null)}async function Te(s,e){const o=(await s({name:"GITHUB_LIST_USER_ORGS",arguments:{connectionId:e}})).content?.[0]?.text;if(!o)throw new Error("No response from GITHUB_LIST_USER_ORGS");try{return JSON.parse(o)}catch{throw new Error("Invalid response from GITHUB_LIST_USER_ORGS")}}function Xe(s,e){const n=e.toLowerCase();return s.find(o=>o.login.toLowerCase()===n)}const Y="GitHub MCP did not return refreshable repo grant metadata";function $(s){if(typeof s!="string")return null;const e=s.trim();return e.length>0?e:null}function _e(s){try{const e=new URL(s);return(e.protocol==="http:"||e.protocol==="https:")&&!e.username&&!e.password}catch{return!1}}function ke(s){return typeof s=="number"&&Number.isFinite(s)&&Number.isInteger(s)&&s>0?s:void 0}async function Re(s){const{orgSlug:e,sourceConnection:n,installationId:o,owner:u,repo:l,githubCallTool:i,selfCallTool:x}=s,m=await i({name:"MINT_REPO_TOKEN",arguments:{installationId:o,owner:u,repo:l,permissions:z}}),r=m.structuredContent;if(m.isError||!r?.token){const T=m.content?.find(v=>v.type==="text")?.text;throw new Error(T?`Failed to mint a repo-scoped GitHub token: ${T}`:"Failed to mint a repo-scoped GitHub token")}const h=$(r.refreshToken),g=$(r.tokenEndpoint),a=$(r.clientId);if(!h||!g||!a)throw new Error(Y);if(!_e(g))throw new Error(Y);const w=$(r.repository?.owner),b=$(r.repository?.name),N="GitHub MCP returned refresh metadata for a different repository";if(r.repository?.owner!==void 0&&(!w||w.toLowerCase()!==u.toLowerCase()))throw new Error(N);if(r.repository?.name!==void 0&&(!b||b.toLowerCase()!==l.toLowerCase()))throw new Error(N);const y=ke(r.repository?.id),I=r.expiresAt?Date.parse(r.expiresAt):NaN,j=Number.isFinite(I)?Math.max(0,Math.floor((I-Date.now())/1e3)):null,d=(typeof r.expiresIn=="number"&&Number.isFinite(r.expiresIn)&&Number.isInteger(r.expiresIn)&&r.expiresIn>0?r.expiresIn:null)??j,S=await x({name:"COLLECTION_CONNECTIONS_CREATE",arguments:{data:{title:`GitHub: ${u}/${l}`,description:`Repo-scoped GitHub access for ${u}/${l}`,icon:n.icon,app_name:n.app_name,app_id:n.app_id,connection_type:n.connection_type,connection_url:n.connection_url,metadata:{repoScope:{installationId:o,repositoryId:y,owner:u,repo:l,permissions:z,grantProvider:"github-mcp"}}}}}),p=S.structuredContent??S,C=p.item?.id??p.id;if(!C)throw new Error("Failed to create the repo-scoped GitHub connection");if(!(await fetch(`/api/${e}/connections/${C}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:r.token,refreshToken:h,expiresIn:d,scope:r.scope??null,clientId:a,tokenEndpoint:g})})).ok)throw await x({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:C,force:!0}}).catch(()=>{}),new Error("Failed to persist the repo-scoped token");return{childConnectionId:C}}const F=[{key:"auto-respond-to-issues",triggerType:"github.issues.opened",nameSuffix:"auto-respond to issues",label:"Auto-respond to new issues",defaultEnabled:!0,instructions:({owner:s,name:e})=>`A new GitHub issue has been opened in ${s}/${e}. Read the issue, explore relevant code, create a branch, implement the fix, and open a PR referencing the issue number.`},{key:"review-incoming-prs",triggerType:"github.pull_request.opened",nameSuffix:"review incoming PRs",label:"Review incoming pull requests",defaultEnabled:!0,instructions:({owner:s,name:e})=>`A pull request was opened in ${s}/${e}. Read the diff, summarize what changed, flag risks (security, perf, breaking changes), and leave a review comment.`},{key:"note-merged-prs",triggerType:"github.pull_request.closed",nameSuffix:"note merged/closed PRs",label:"Note merged or closed PRs",defaultEnabled:!1,instructions:({owner:s,name:e})=>`A pull request was closed in ${s}/${e}. If it was merged, update changelog/release notes as appropriate.`}];function Ae(s,e){const n=new Set;if(s.paramsSchema)for(const u of Object.keys(s.paramsSchema))n.add(u);if(Array.isArray(s.params))for(const u of s.params)n.add(u.name);else if(s.params&&typeof s.params=="object")for(const u of Object.keys(s.params))n.add(u);if(n.has("repo"))return{repo:`${e.owner}/${e.name}`};const o={};return n.has("owner")&&(o.owner=e.owner),n.has("name")&&(o.name=e.name),n.has("repository")&&(o.repository=`${e.owner}/${e.name}`),o}async function Oe({githubCallTool:s,selfCallTool:e,virtualMcpId:n,repo:o,connectionId:u,selectedKeys:l}){const i=await s({name:"TRIGGER_LIST",arguments:{}}),x=i.structuredContent??i,m=new Map((x.triggers??[]).map(a=>[a.type,a])),r=F.filter(a=>l.has(a.key)),h=await Promise.allSettled(r.map(async a=>{const w=m.get(a.triggerType);if(!w)throw new Error(`Trigger ${a.triggerType} not exposed`);const b=await e({name:"AUTOMATION_CREATE",arguments:{name:`${o.name}: ${a.nameSuffix}`,virtual_mcp_id:n,messages:a.instructions(o),active:!0}}),N=(b.structuredContent??b).id;if(!N)throw new Error(`AUTOMATION_CREATE returned no id for ${a.key}`);await e({name:"AUTOMATION_TRIGGER_ADD",arguments:{automation_id:N,type:"event",connection_id:u,event_type:a.triggerType,params:Ae(w,o)}})})),g=h.filter(a=>a.status==="rejected").length;return g>0&&console.error("Some GitHub automations failed to set up:",h.filter(a=>a.status==="rejected")),{total:h.length,failed:g}}function Ze(s){const e=L.c(22),{open:n,onOpenChange:o,title:u,hideAutoRespondCheckbox:l,onImportComplete:i}=s,x=u===void 0?"Import from GitHub":u,m=l===void 0?!1:l,[r,h]=G.useState(null);let g;e[0]!==x?(g=t.jsx(ie,{className:"sr-only",children:t.jsx(ae,{children:x})}),e[0]=x,e[1]=g):g=e[1];let a;e[2]!==r||e[3]!==x?(a=t.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3 shrink-0",children:r?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:()=>h(null),className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors shrink-0","aria-label":"Back to accounts",children:t.jsx(Z,{size:16})}),t.jsx("img",{src:r.avatarUrl,alt:r.login,className:"size-5 rounded-full ring-1 ring-border shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-foreground",children:r.login})]}):t.jsxs(t.Fragment,{children:[t.jsx(M,{className:"size-4 text-foreground shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-foreground",children:x})]})}),e[2]=r,e[3]=x,e[4]=a):a=e[4];let w;e[5]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(D,{size:18,className:"animate-spin text-muted-foreground"})}),e[5]=w):w=e[5];let b;e[6]!==o?(b=()=>o(!1),e[6]=o,e[7]=b):b=e[7];let N;e[8]!==m||e[9]!==i||e[10]!==n||e[11]!==r||e[12]!==b?(N=t.jsx("div",{className:"flex-1 overflow-hidden flex flex-col min-w-0",children:t.jsx(G.Suspense,{fallback:w,children:t.jsx(Ge,{open:n,onComplete:b,selectedInstallation:r,onSelectInstallation:h,hideAutoRespondCheckbox:m,onImportComplete:i})})}),e[8]=m,e[9]=i,e[10]=n,e[11]=r,e[12]=b,e[13]=N):N=e[13];let y;e[14]!==g||e[15]!==a||e[16]!==N?(y=t.jsxs(le,{className:"sm:max-w-[560px] h-[85svh] sm:h-[520px] p-0 gap-0 overflow-hidden flex flex-col",children:[g,a,N]}),e[14]=g,e[15]=a,e[16]=N,e[17]=y):y=e[17];let I;return e[18]!==o||e[19]!==n||e[20]!==y?(I=t.jsx(ce,{open:n,onOpenChange:o,children:y}),e[18]=o,e[19]=n,e[20]=y,e[21]=I):I=e[21],I}function Ge({open:s,onComplete:e,selectedInstallation:n,onSelectInstallation:o,hideAutoRespondCheckbox:u,onImportComplete:l}){const{org:i}=Q(),x=W(),m=be(),[r,h]=G.useState(null),[g,a]=G.useState(!0),[w,b]=G.useState(()=>new Set(F.filter(c=>c.defaultEnabled).map(c=>c.key))),N=F.filter(c=>c.defaultEnabled).map(c=>c.key),y=u?new Set(N):g?w:new Set,I=fe({slug:"mcp-github"}),j=Ee(I),f=je({enabled:s&&j.length===0}),d=j.length===1?j[0]??null:r,S=H({connectionId:d?.id??"",orgId:i.id,orgSlug:i.slug}),p=H({connectionId:X,orgId:i.id,orgSlug:i.slug}),C=async(c,E)=>{try{const O=await S.callTool({name:"get_file_contents",arguments:{owner:c.owner,repo:c.name,path:E}});if(O.isError)return null;const P=O.content?.find(R=>R.type==="resource")?.resource?.text;if(!P)return null;try{const R=JSON.parse(P);return typeof R=="string"?R:JSON.stringify(R)}catch{return P}}catch{return null}},A=(c,E)=>{Promise.all([C(E,"AGENTS.md"),C(E,"CLAUDE.md")]).then(async([k,O])=>{const _=k??O??null;_&&(await p.callTool({name:"COLLECTION_VIRTUAL_MCP_UPDATE",arguments:{id:c,data:{metadata:{instructions:_}}}}),B(x,i.id))}).catch(k=>{console.error("GitHub instructions fetch failed:",k)})},T=async({virtualMcpId:c,repo:E,connectionId:k,selectedKeys:O})=>{const{total:_,failed:P}=await Oe({githubCallTool:R=>S.callTool(R),selfCallTool:R=>p.callTool(R),virtualMcpId:c,repo:E,connectionId:k,selectedKeys:O});P>0&&U.warning(`Set up ${_-P}/${_} GitHub automations. Add the rest from the automations view.`)},v=ne({mutationFn:async c=>{if(!d||!n)throw new Error("No GitHub connection or installation");const E=n.installationId,{childConnectionId:k}=await Re({orgSlug:i.slug,sourceConnection:d,installationId:E,owner:c.owner,repo:c.name,githubCallTool:_=>S.callTool(_),selfCallTool:_=>p.callTool(_)});let O=null;try{const _=await p.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:c.name,description:c.description||"Imported from GitHub",pinned:!1,icon:null,metadata:{githubRepo:{owner:c.owner,name:c.name,url:c.url,installationId:E,connectionId:k},instructions:null,ui:{pinnedViews:null,layout:{defaultMainView:{type:"preview"},chatDefaultOpen:!0}}},connections:[{connection_id:k}]}}}),P=_.structuredContent??_,R=P.item?.id;if(!P.item||!R)throw new Error("Failed to create the imported agent");return O=R,y.size>0&&await T({virtualMcpId:R,repo:c,connectionId:k,selectedKeys:y}).catch(ee=>{console.error("Failed to set up GitHub automations:",ee),U.warning("Imported repo, but failed to set up GitHub automations. You can add triggers manually from the automations view.")}),{virtualMcpId:R,repo:c,connectionId:k,item:P.item}}catch(_){throw O&&await p.callTool({name:"COLLECTION_VIRTUAL_MCP_DELETE",arguments:{id:O}}).catch(()=>{}),await p.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:k,force:!0}}).catch(()=>{}),_}},onSuccess:({virtualMcpId:c,repo:E,connectionId:k,item:O})=>{if(x.setQueryData(V.collectionItem(p,i.id,"","VIRTUAL_MCP",c),{item:O}),B(x,i.id),A(c,E),l){l({virtualMcpId:c,repo:E,connectionId:k});return}U.success(`Imported ${E.name} from GitHub`),e(),localStorage.setItem("mesh:sidebar-open",JSON.stringify(!1)),m(c)},onError:c=>{U.error("Failed to import repo: "+(c instanceof Error?c.message:"Unknown error"))}});return f.status==="installing"||f.status==="authenticating"?t.jsx(q,{status:f.status,error:null,retry:f.retry}):f.status==="error"?t.jsx(q,{status:"error",error:f.error,retry:f.retry}):j.length===0&&f.status==="idle"?t.jsx(q,{status:"installing",error:null,retry:f.retry}):j.length>1&&!d?t.jsxs("div",{className:"flex flex-col py-2",children:[t.jsx("div",{className:"px-4 py-2",children:t.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Select a connection"})}),j.map(c=>t.jsxs("button",{type:"button",onClick:()=>h(c),className:"flex items-center gap-3 px-4 py-3 hover:bg-accent transition-colors text-left",children:[c.icon?t.jsx("img",{src:c.icon,alt:c.title,className:"size-7 rounded-full shrink-0"}):t.jsx("div",{className:"size-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:t.jsx(M,{className:"size-3.5 text-muted-foreground"})}),t.jsx("span",{className:"text-sm font-medium",children:c.title})]},c.id))]}):d?n?t.jsx(Le,{connectionId:d.id,orgId:i.id,orgSlug:i.slug,installation:n,onSelectRepo:c=>v.mutate(c),isSaving:v.isPending,autoRespondEnabled:g,onAutoRespondChange:a,selectedAutomationKeys:w,onAutomationKeysChange:b,hideAutoRespondCheckbox:u}):t.jsx(Pe,{connectionId:d.id,orgId:i.id,orgSlug:i.slug,onSelect:o,showBackButton:j.length>1,onBack:()=>h(null)}):null}function Pe(s){const e=L.c(31),{connectionId:n,orgId:o,orgSlug:u,onSelect:l,showBackButton:i,onBack:x}=s;let m;e[0]!==o||e[1]!==u?(m={connectionId:X,orgId:o,orgSlug:u},e[0]=o,e[1]=u,e[2]=m):m=e[2];const r=H(m);let h;e[3]!==n||e[4]!==o?(h=V.githubUserOrgs(o,n),e[3]=n,e[4]=o,e[5]=h):h=e[5];let g;e[6]!==n||e[7]!==r?(g=()=>Te(p=>r.callTool(p),n),e[6]=n,e[7]=r,e[8]=g):g=e[8];let a;e[9]!==h||e[10]!==g?(a={queryKey:h,queryFn:g},e[9]=h,e[10]=g,e[11]=a):a=e[11];const w=se(a);if(w.isLoading){let p;return e[12]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(D,{size:18,className:"animate-spin text-muted-foreground"})}),e[12]=p):p=e[12],p}if(w.isError){let p;return e[13]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("p",{className:"text-sm text-destructive",children:"Failed to load GitHub accounts"})}),e[13]=p):p=e[13],p}const b=w.data;if(!b)return null;let N;e[14]!==x||e[15]!==i?(N=i&&t.jsx("div",{className:"flex items-center gap-1 px-4 pt-3 pb-1 shrink-0",children:t.jsxs("button",{type:"button",onClick:x,className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx(Z,{size:12}),"Change connection"]})}),e[14]=x,e[15]=i,e[16]=N):N=e[16];let y;if(e[17]!==b.installations||e[18]!==l){let p;e[20]!==l?(p=C=>t.jsxs("button",{type:"button",onClick:()=>l(C),className:"w-full flex items-center gap-3 px-4 py-3 hover:bg-accent transition-colors text-left group",children:[t.jsx("img",{src:C.avatarUrl,alt:C.login,className:"size-7 rounded-full shrink-0 ring-1 ring-border"}),t.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[t.jsx("span",{className:"text-sm font-medium leading-none",children:C.login}),C.type==="User"&&t.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"Personal account"})]}),t.jsx("span",{className:"text-xs text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:"Select →"})]},C.installationId),e[20]=l,e[21]=p):p=e[21],y=b.installations.map(p),e[17]=b.installations,e[18]=l,e[19]=y}else y=e[19];let I;e[22]!==y?(I=t.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden [scrollbar-gutter:stable]",children:y}),e[22]=y,e[23]=I):I=e[23];const j=b.appSlug?`https://github.com/apps/${b.appSlug}/installations/new`:"https://github.com/settings/installations";let f;e[24]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx("span",{className:"underline underline-offset-2",children:"Install the GitHub App"}),e[24]=f):f=e[24];let d;e[25]!==j?(d=t.jsx("div",{className:"px-4 py-3 border-t border-border shrink-0",children:t.jsxs("a",{href:j,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:["Account not listed?"," ",f]})}),e[25]=j,e[26]=d):d=e[26];let S;return e[27]!==d||e[28]!==N||e[29]!==I?(S=t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[N,I,d]}),e[27]=d,e[28]=N,e[29]=I,e[30]=S):S=e[30],S}function Le(s){const e=L.c(27),{connectionId:n,orgId:o,orgSlug:u,installation:l,onSelectRepo:i,isSaving:x,autoRespondEnabled:m,onAutoRespondChange:r,selectedAutomationKeys:h,onAutomationKeysChange:g,hideAutoRespondCheckbox:a}=s,[w,b]=G.useState(""),N=de(w,300),y=G.useDeferredValue(N),I=w!==y;let j;e[0]!==I||e[1]!==w?(j=t.jsx(ue,{placeholder:"Search repositories...",value:w,onChange:b,isSearching:I}),e[0]=I,e[1]=w,e[2]=j):j=e[2];const f=I?"opacity-40":"opacity-100";let d;e[3]!==f?(d=K("flex-1 overflow-hidden flex flex-col transition-opacity duration-150",f),e[3]=f,e[4]=d):d=e[4];let S;e[5]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(D,{size:18,className:"animate-spin text-muted-foreground"})}),e[5]=S):S=e[5];let p;e[6]!==n||e[7]!==y||e[8]!==l||e[9]!==x||e[10]!==i||e[11]!==o||e[12]!==u?(p=t.jsx(G.Suspense,{fallback:S,children:t.jsx($e,{connectionId:n,orgId:o,orgSlug:u,installation:l,query:y,onSelectRepo:i,isSaving:x})}),e[6]=n,e[7]=y,e[8]=l,e[9]=x,e[10]=i,e[11]=o,e[12]=u,e[13]=p):p=e[13];let C;e[14]!==d||e[15]!==p?(C=t.jsx("div",{className:d,children:p}),e[14]=d,e[15]=p,e[16]=C):C=e[16];let A;e[17]!==m||e[18]!==a||e[19]!==r||e[20]!==g||e[21]!==h?(A=!a&&t.jsxs("div",{className:"border-t border-border shrink-0",children:[t.jsxs("label",{className:"flex items-center gap-2 px-4 py-3 cursor-pointer select-none",children:[t.jsx(J,{checked:m,onCheckedChange:v=>r(v===!0)}),t.jsx("span",{className:"text-xs text-foreground",children:"Set up GitHub automations for this repo"})]}),m&&t.jsx("div",{className:"px-4 pb-3 pl-9 flex flex-col gap-1.5",children:F.map(v=>t.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[t.jsx(J,{checked:h.has(v.key),onCheckedChange:c=>{const E=new Set(h);c===!0?E.add(v.key):E.delete(v.key),g(E)}}),t.jsx("span",{className:"text-xs text-muted-foreground",children:v.label})]},v.key))})]}),e[17]=m,e[18]=a,e[19]=r,e[20]=g,e[21]=h,e[22]=A):A=e[22];let T;return e[23]!==j||e[24]!==C||e[25]!==A?(T=t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[j,C,A]}),e[23]=j,e[24]=C,e[25]=A,e[26]=T):T=e[26],T}function $e(s){const e=L.c(29),{connectionId:n,orgId:o,orgSlug:u,installation:l,query:i,onSelectRepo:x,isSaving:m}=s;let r;e[0]!==n||e[1]!==o||e[2]!==u?(r={connectionId:n,orgId:o,orgSlug:u},e[0]=n,e[1]=o,e[2]=u,e[3]=r):r=e[3];const h=H(r),g=l.type==="User"?"user":"org",a=i?`${g}:${l.login} ${i} in:name`:`${g}:${l.login}`;let w;e[4]!==n||e[5]!==l.login||e[6]!==o||e[7]!==i?(w=V.githubOrgRepos(o,n,l.login,i),e[4]=n,e[5]=l.login,e[6]=o,e[7]=i,e[8]=w):w=e[8];let b;e[9]!==h||e[10]!==a?(b=async f=>{const{signal:d}=f,p=(await h.callTool({name:"search_repositories",arguments:{query:a,page:1,perPage:30}},void 0,{signal:d})).content?.[0]?.text;if(!p)throw new Error("No response from search_repositories");return(JSON.parse(p).items??[]).map(He)},e[9]=h,e[10]=a,e[11]=b):b=e[11];let N;e[12]!==w||e[13]!==b?(N={queryKey:w,queryFn:b},e[12]=w,e[13]=b,e[14]=N):N=e[14];const{data:y}=oe(N);if(y.length===0){let f;e[15]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx("p",{className:"text-sm text-muted-foreground",children:"No repositories found"}),e[15]=f):f=e[15];let d;e[16]!==i?(d=i&&t.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Try a different search term"}),e[16]=i,e[17]=d):d=e[17];let S;return e[18]!==d?(S=t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-1",children:[f,d]}),e[18]=d,e[19]=S):S=e[19],S}let I;if(e[20]!==m||e[21]!==x||e[22]!==y){let f;e[24]!==m||e[25]!==x?(f=d=>t.jsxs("button",{type:"button",onClick:()=>x(d),disabled:m,className:"flex items-start gap-3 px-4 py-3 hover:bg-accent transition-colors text-left disabled:opacity-50 disabled:cursor-not-allowed",children:[t.jsx(M,{className:"size-4 text-muted-foreground mt-0.5 shrink-0"}),t.jsx("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:t.jsx("span",{className:"text-sm font-medium truncate",children:d.name})}),t.jsxs("span",{className:"flex items-center gap-1 text-xs font-medium text-muted-foreground border border-border rounded px-1.5 py-0.5 shrink-0 leading-none",children:[d.private?t.jsx(re,{size:10}):t.jsx(ge,{size:10}),d.private?"Private":"Public"]})]},d.fullName),e[24]=m,e[25]=x,e[26]=f):f=e[26],I=y.map(f),e[20]=m,e[21]=x,e[22]=y,e[23]=I}else I=e[23];let j;return e[27]!==I?(j=t.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden flex flex-col [scrollbar-gutter:stable]",children:I}),e[27]=I,e[28]=j):j=e[28],j}function He(s){return{name:s.name,fullName:s.full_name,owner:s.full_name.split("/")[0]??"",url:s.html_url,private:s.private,description:s.description,updatedAt:s.updated_at}}function q(s){const e=L.c(33),{status:n,error:o,retry:u}=s;if(n==="error"){let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("div",{className:"size-10 rounded-full bg-destructive/10 flex items-center justify-center",children:t.jsx(M,{className:"size-5 text-destructive"})}),e[0]=p):p=e[0];let C;e[1]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx("p",{className:"text-sm font-medium",children:"Connection failed"}),e[1]=C):C=e[1];const A=o??"Something went wrong while connecting to GitHub.";let T;e[2]!==A?(T=t.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[C,t.jsx("p",{className:"text-xs text-muted-foreground max-w-[260px] leading-relaxed",children:A})]}),e[2]=A,e[3]=T):T=e[3];let v;e[4]!==u?(v=t.jsx("button",{type:"button",onClick:u,className:"text-xs font-medium text-foreground border border-border rounded-md px-3 py-1.5 hover:bg-accent transition-colors",children:"Try again"}),e[4]=u,e[5]=v):v=e[5];let c;return e[6]!==T||e[7]!==v?(c=t.jsxs("div",{className:"flex flex-col items-center gap-4 px-6 py-10",children:[p,T,v]}),e[6]=T,e[7]=v,e[8]=c):c=e[8],c}const l=n==="authenticating";let i;e[9]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{className:"size-10 rounded-full bg-muted flex items-center justify-center",children:t.jsx(M,{className:"size-5 text-foreground"})}),e[9]=i):i=e[9];let x;e[10]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsxs("div",{className:"relative size-10",children:[i,t.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 size-4 rounded-full bg-background flex items-center justify-center",children:t.jsx(D,{size:12,className:"animate-spin text-muted-foreground"})})]}),e[10]=x):x=e[10];const m=l?"Authenticating with GitHub":"Setting up GitHub";let r;e[11]!==m?(r=t.jsx("p",{className:"text-sm font-medium",children:m}),e[11]=m,e[12]=r):r=e[12];const h=l?"Complete the OAuth flow in your browser":"Installing the GitHub connection...";let g;e[13]!==h?(g=t.jsx("p",{className:"text-xs text-muted-foreground",children:h}),e[13]=h,e[14]=g):g=e[14];let a;e[15]!==r||e[16]!==g?(a=t.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[r,g]}),e[15]=r,e[16]=g,e[17]=a):a=e[17];const w=l?"bg-muted-foreground/30":"bg-foreground animate-pulse";let b;e[18]!==w?(b=K("size-1.5 rounded-full",w),e[18]=w,e[19]=b):b=e[19];let N;e[20]!==b?(N=t.jsx("span",{className:b}),e[20]=b,e[21]=N):N=e[21];const y=l?"bg-foreground animate-pulse":"bg-muted-foreground/30";let I;e[22]!==y?(I=K("size-1.5 rounded-full",y),e[22]=y,e[23]=I):I=e[23];let j;e[24]!==I?(j=t.jsx("span",{className:I}),e[24]=I,e[25]=j):j=e[25];let f;e[26]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx("span",{className:"size-1.5 rounded-full bg-muted-foreground/30"}),e[26]=f):f=e[26];let d;e[27]!==N||e[28]!==j?(d=t.jsxs("div",{className:"flex items-center gap-1.5",children:[N,j,f]}),e[27]=N,e[28]=j,e[29]=d):d=e[29];let S;return e[30]!==d||e[31]!==a?(S=t.jsxs("div",{className:"flex flex-col items-center gap-4 px-6 py-10",children:[x,a,d]}),e[30]=d,e[31]=a,e[32]=S):S=e[32],S}export{Ze as G,M as a,Xe as b,Te as f,Ee as g,Re as p,je as u};
|