decocms 4.82.13 → 4.82.14
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-B6AELEdc.js → AlertCircle-DvPByT3s.js} +1 -1
- package/dist/client/assets/{AreaChart-fCNs67j_.js → AreaChart-BtYig8Ye.js} +1 -1
- package/dist/client/assets/{ArrowUp-YK2fJPgi.js → ArrowUp-Dh74oxmM.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-BKVLcZTe.js → ArrowUpRight-DC6Yb9Jn.js} +1 -1
- package/dist/client/assets/{CheckCircle-BfxYbuVE.js → CheckCircle-Be2POQuF.js} +1 -1
- package/dist/client/assets/{ChevronDown-CQLSXgt3.js → ChevronDown-BE7JvSpD.js} +1 -1
- package/dist/client/assets/{ChevronRight-Fgy0rUS_.js → ChevronRight-4-DNv2jL.js} +1 -1
- package/dist/client/assets/ChevronUp-Bwx_DvAp.js +1 -0
- package/dist/client/assets/{Copy01-B0CQRE_5.js → Copy01-CaaZXEMR.js} +1 -1
- package/dist/client/assets/DotsVertical-hH1ie9LK.js +1 -0
- package/dist/client/assets/{Eye-CLtdCpUf.js → Eye-s3MCo34O.js} +1 -1
- package/dist/client/assets/{FilterLines-DeiGsRZY.js → FilterLines-B8M_kRrg.js} +1 -1
- package/dist/client/assets/{Globe01-B52VKYy7.js → Globe01-BNvAFZ7t.js} +1 -1
- package/dist/client/assets/{Globe04-B0las6Jv.js → Globe04-B8fLlHyp.js} +1 -1
- package/dist/client/assets/{HardDrive-CU-vvmKE.js → HardDrive-DDRUuRUd.js} +1 -1
- package/dist/client/assets/{Image01-B-FQwXx8.js → Image01-DxLV4xvs.js} +1 -1
- package/dist/client/assets/{Key01-myvTSA8u.js → Key01-Cq8uChmI.js} +1 -1
- package/dist/client/assets/{LayoutLeft-C0g0LezP.js → LayoutLeft-riUBpORF.js} +1 -1
- package/dist/client/assets/{LinkExternal01-d9EixhiS.js → LinkExternal01-DU3CPyqq.js} +1 -1
- package/dist/client/assets/{Monitor01-BkDBzdlH.js → Monitor01-0ngeB4wd.js} +1 -1
- package/dist/client/assets/{Package-eNacrLmv.js → Package-BrNfAbz_.js} +1 -1
- package/dist/client/assets/{Palette-BiKqXWvc.js → Palette-CtgW-PAY.js} +1 -1
- package/dist/client/assets/{Play-CdkPhmTs.js → Play-CdZJWvJx.js} +1 -1
- package/dist/client/assets/{Plus-DWjKZ2wj.js → Plus-Ca4hMAKt.js} +1 -1
- package/dist/client/assets/{SearchLg-DBOWvxyl.js → SearchLg-BGyV5Bz4.js} +1 -1
- package/dist/client/assets/{SearchMd-CKteZWzZ.js → SearchMd-CFTyyPmA.js} +1 -1
- package/dist/client/assets/{Settings02-CM0Uzs0U.js → Settings02-BIuCsH3l.js} +1 -1
- package/dist/client/assets/{Shield01-aDvWVv5Z.js → Shield01-DdJSxLoT.js} +1 -1
- package/dist/client/assets/{Star01-B-8espqJ.js → Star01-Dg6BZrlI.js} +1 -1
- package/dist/client/assets/{Stars01-DsfblQf3.js → Stars01-wVvTShj4.js} +1 -1
- package/dist/client/assets/{Stars02-DBH33Ez2.js → Stars02-BF8YOJhr.js} +1 -1
- package/dist/client/assets/{Sun-MvOAGgKN.js → Sun-Cd6pfpZ3.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-DUrn8gXV.js → SwitchHorizontal01-T7cYMNoP.js} +1 -1
- package/dist/client/assets/{Tool01-4pit7qOS.js → Tool01-BDwVCBnM.js} +1 -1
- package/dist/client/assets/{Tool02-tJKj7JcW.js → Tool02-DjIBln53.js} +1 -1
- package/dist/client/assets/{Trash01-DEWgFvvg.js → Trash01-CxvmthNE.js} +1 -1
- package/dist/client/assets/TrendUp01-DdL0oR_B.js +1 -0
- package/dist/client/assets/{Upload01-C8RP0Fvq.js → Upload01-w4HjmReL.js} +1 -1
- package/dist/client/assets/{User01-v0Bqr3nA.js → User01-0Zd0134v.js} +1 -1
- package/dist/client/assets/{Users01-CPNZ7uMu.js → Users01-j-t-q-sR.js} +1 -1
- package/dist/client/assets/{Users03-WVYBBENu.js → Users03-BpRSYTYN.js} +1 -1
- package/dist/client/assets/{X-Dm6kY_ek.js → X--0kJVtau.js} +1 -1
- package/dist/client/assets/{XCircle-cwYbcP7y.js → XCircle-CWZBOndb.js} +1 -1
- package/dist/client/assets/{XClose-DnNyN9T-.js → XClose-CFj_hbve.js} +1 -1
- package/dist/client/assets/{Zap-CNRURtEh.js → Zap-BfGgAuT1.js} +1 -1
- package/dist/client/assets/{ZapSquare-Dj8pa8Fg.js → ZapSquare-CS1YImRf.js} +1 -1
- package/dist/client/assets/{ZoomOut-_psBJlXD.js → ZoomOut-DBunTdui.js} +1 -1
- package/dist/client/assets/{access-gate-CPecvlS5.js → access-gate-C3Jf69ZD.js} +1 -1
- package/dist/client/assets/{add-section-modal-CcLBxmBX.js → add-section-modal-Ca2kfOel.js} +1 -1
- package/dist/client/assets/agent-icon-BdMdPyH8.js +1 -0
- package/dist/client/assets/agents-list-s5b3COYS.js +1 -0
- package/dist/client/assets/ai-providers-DAXq9GNP.js +1 -0
- package/dist/client/assets/{alert-dialog-3VMQ65hF.js → alert-dialog-BjP2s6Nc.js} +1 -1
- package/dist/client/assets/{alert-XkDwazoe.js → alert-sYi6c8L0.js} +1 -1
- package/dist/client/assets/app-editor-lqTV057s.js +1 -0
- package/dist/client/assets/{auth-dSVlMQ86.js → auth-DWUY37QO.js} +1 -1
- package/dist/client/assets/{auth-catchall-BVp4zpOf.js → auth-catchall-4BdHIsfs.js} +1 -1
- package/dist/client/assets/{auth-entry-C48ylSC_.js → auth-entry-CbO-WTGZ.js} +1 -1
- package/dist/client/assets/{auth-split-layout-dbrXw6Uq.js → auth-split-layout-Cunbbv7Y.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-BHT9Kp62.js → authenticate-and-persist-oauth-tVxGkZPI.js} +1 -1
- package/dist/client/assets/{automation-list-row-PkSpkeID.js → automation-list-row-Bx2czjnJ.js} +1 -1
- package/dist/client/assets/automation-runs-CvOQZBIo.js +87 -0
- package/dist/client/assets/automations-ZGK89zV_.js +1 -0
- package/dist/client/assets/{autosend-D_-616qs.js → autosend-BLRimjZ_.js} +1 -1
- package/dist/client/assets/{avatar-UXZ4R5Yb.js → avatar-BVfPlbpm.js} +1 -1
- package/dist/client/assets/{badge-CfAmvo-h.js → badge-DNxr1fi7.js} +1 -1
- package/dist/client/assets/{block-document-DbCz5f9N.js → block-document-z1ZnryZ2.js} +2 -2
- package/dist/client/assets/{brand-context-G_6bLd5F.js → brand-context-CLHvlJV7.js} +1 -1
- package/dist/client/assets/buckets-BTIuBcJT.js +1 -0
- package/dist/client/assets/bulk-category-panel-BgK98tsF.js +1 -0
- package/dist/client/assets/calendar-VVDY0smi.js +102 -0
- package/dist/client/assets/{capability-load-error-B9xkkNBq.js → capability-load-error-2OJTaAO-.js} +1 -1
- package/dist/client/assets/{card-dLLzWD0r.js → card-CRilZAuB.js} +1 -1
- package/dist/client/assets/category-editor-D_whkLw0.js +1 -0
- package/dist/client/assets/{chat-context-CyCuyn4t.js → chat-context-BI8_Nmou.js} +13 -11
- package/dist/client/assets/checkbox-CcBhppQn.js +1 -0
- package/dist/client/assets/{cli-auth-success-zoB4TWhQ.js → cli-auth-success-DEIP-V25.js} +1 -1
- package/dist/client/assets/collection-detail-1c1ACTcR.js +1 -0
- package/dist/client/assets/collection-display-button-DXJEmTV8.js +1 -0
- package/dist/client/assets/{collection-search-C4jDpdZf.js → collection-search-COKgSE9f.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-DIkftYUF.js → collection-table-wrapper-Bkw9b8hk.js} +1 -1
- package/dist/client/assets/{collection-tabs-DvvibY6H.js → collection-tabs-ttDF8X2o.js} +1 -1
- package/dist/client/assets/{command-EQNrbniG.js → command-vkOcTid-.js} +1 -1
- package/dist/client/assets/commerce-onboarding-bjzg6F_h.js +1 -0
- package/dist/client/assets/{companions-core-fc2Z_sCB.js → companions-core-B9YYDQ4A.js} +1 -1
- package/dist/client/assets/connect-desktop-dialog-D7YkwfUU.js +1 -0
- package/dist/client/assets/{connection-card-CtY9PRIw.js → connection-card-DU81gKdu.js} +1 -1
- package/dist/client/assets/connection-detail-DABVCpPE.js +1 -0
- package/dist/client/assets/{connection-form-helpers-TGmycj7X.js → connection-form-helpers-Dyl58fX0.js} +1 -1
- package/dist/client/assets/connections-bXxskjsO.js +1 -0
- package/dist/client/assets/{decopilot-sse-pool-DHojW3EC.js → decopilot-sse-pool-B7Q1Pjne.js} +1 -1
- package/dist/client/assets/{dialog-CmXDzme5.js → dialog-B1V0iUXV.js} +1 -1
- package/dist/client/assets/{domain-settings-GxKzcerZ.js → domain-settings-B1ZyfdYW.js} +1 -1
- package/dist/client/assets/{drawer-Ds-r7525.js → drawer-9Bvsh1k7.js} +1 -1
- package/dist/client/assets/dropdown-menu-Bel6DI3v.js +1 -0
- package/dist/client/assets/{empty-state-CdKwtMyP.js → empty-state-BHQtYUSO.js} +1 -1
- package/dist/client/assets/{extract-connection-data-CK9iLAoG.js → extract-connection-data-BZuABMOr.js} +1 -1
- package/dist/client/assets/file-explorer-PgVeGy2E.js +2 -0
- package/dist/client/assets/{file-type-icon-DjNFZnTs.js → file-type-icon-CGkU8X5K.js} +1 -1
- package/dist/client/assets/{files-CQYyuV1E.js → files-DZ3SJjR-.js} +1 -1
- package/dist/client/assets/{form-x0k-kdB2.js → form-C9jBxN8G.js} +1 -1
- package/dist/client/assets/general-CuHItqTO.js +1 -0
- package/dist/client/assets/{github-repo-picker-C-tZ-Bba.js → github-repo-picker-DPwCOiEB.js} +1 -1
- package/dist/client/assets/{hooks-QHrmNjJQ.js → hooks-DtDviOax.js} +1 -1
- package/dist/client/assets/index-B3GkLwEh.js +2 -0
- package/dist/client/assets/{index-cG8paP3z.js → index-BRH7yHcF.js} +1 -1
- package/dist/client/assets/{index-Czi2ZhJ5.js → index-BcgykEG5.js} +1 -1
- package/dist/client/assets/{index-C-B6S6Q9.js → index-CHJYXQSS.js} +1 -1
- package/dist/client/assets/{index-DF3zg-P1.js → index-CMuj1duV.js} +3 -3
- package/dist/client/assets/{index-T-oY3h3t.js → index-Clopj9KU.js} +1 -1
- package/dist/client/assets/{index-CUVgjm02.js → index-CwggL_PJ.js} +1 -1
- package/dist/client/assets/{index-CeqD0RVV.js → index-DVJqB6A6.js} +1 -1
- package/dist/client/assets/{index-BcWQMJI4.js → index-Df10o6gn.js} +3 -3
- package/dist/client/assets/index-Dj5WILcq.css +1 -0
- package/dist/client/assets/{index-DonY639O.js → index-Dp8SB-ud.js} +29 -29
- package/dist/client/assets/index-DxeK__BQ.js +1 -0
- package/dist/client/assets/{index-BCiDnhhX.js → index-gAU-Arvb.js} +4 -4
- package/dist/client/assets/{index-BjO8A-VO.js → index-jm5YycYM.js} +1 -1
- package/dist/client/assets/{index-redirect-_hpy7g8S.js → index-redirect-CecfnhiM.js} +1 -1
- package/dist/client/assets/{index-CzMEWsZX.js → index-z2UBv_6H.js} +1 -1
- package/dist/client/assets/{input-BZTiU0ds.js → input-qdMTAJH4.js} +1 -1
- package/dist/client/assets/{integration-icon-BfKWLZT4.js → integration-icon-ByqyfRpT.js} +1 -1
- package/dist/client/assets/{invite-member-dialog-fPpySKy7.js → invite-member-dialog-cnQXBieX.js} +1 -1
- package/dist/client/assets/{label-B1OfKy2N.js → label-CnEhHuVP.js} +1 -1
- package/dist/client/assets/{layout-BzlkAZij.js → layout-ofNqb8rV.js} +1 -1
- package/dist/client/assets/{login-CfYNPvDo.js → login-knndhvVF.js} +1 -1
- package/dist/client/assets/{mcp-oauth-CoKzxQiz.js → mcp-oauth-CAUkOKji.js} +1 -1
- package/dist/client/assets/members-Bb6cqv3N.js +1 -0
- package/dist/client/assets/{monaco-editor-BzdwB2U8.js → monaco-editor-4EWxCivt.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-C0-lT8X-.js → monitoring-stats-row-CYRhMPF6.js} +1 -1
- package/dist/client/assets/{multi-select-BYFsBcLx.js → multi-select-DGg7VcY7.js} +1 -1
- package/dist/client/assets/{oauth-callback-D6L6RroV.js → oauth-callback-Txh_HZU1.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-NS24Yhk_.js → oauth-callback-ai-provider-gZcF7GFt.js} +1 -1
- package/dist/client/assets/{onboarding-CXfWXP3L.js → onboarding-BNd98v9F.js} +1 -1
- package/dist/client/assets/{org-install-CFASOU4_.js → org-install-s29fSk6T.js} +1 -1
- package/dist/client/assets/{org-layout-gngtZKVa.js → org-layout-pC6WuH2d.js} +1 -1
- package/dist/client/assets/{organization-choice-DB-AR__E.js → organization-choice-Cvpg9cyR.js} +1 -1
- package/dist/client/assets/orgs-BH4zqSW4.js +1 -0
- package/dist/client/assets/{page-seo-form-DsaBxdUW.js → page-seo-form-DpJbL5qC.js} +1 -1
- package/dist/client/assets/page-seo-sheet-BViE3vmf.js +1 -0
- package/dist/client/assets/{popover-BzHpXFL_.js → popover-BXXrlEXA.js} +1 -1
- package/dist/client/assets/post-editor-DgVq5HAq.js +1 -0
- package/dist/client/assets/{primitives-BxBoeZTE.js → primitives-C0YiE9Dl.js} +1 -1
- package/dist/client/assets/profile-CdQoqyRv.js +1 -0
- package/dist/client/assets/project-app-view-DORLMZaj.js +1 -0
- package/dist/client/assets/record-editor-D2PAFmR-.js +1 -0
- package/dist/client/assets/redirect-editor-ClaSMwyP.js +1 -0
- package/dist/client/assets/registry-DqKNpXHC.js +2 -0
- package/dist/client/assets/{registry-layout-B8iHO94t.js → registry-layout-CFETb4kQ.js} +2 -2
- package/dist/client/assets/{reports-DFt5o5JU.js → reports-Bd4Konjf.js} +2 -2
- package/dist/client/assets/{require-capability-CEBGt_Ot.js → require-capability-D0uXhAfv.js} +1 -1
- package/dist/client/assets/{required-auth-layout-vPZ2d-Yx.js → required-auth-layout-uUQ9Dfyr.js} +1 -1
- package/dist/client/assets/{reset-password-l6ffdCqx.js → reset-password-InhP_QJS.js} +1 -1
- package/dist/client/assets/roles-C8MjshKP.js +1 -0
- package/dist/client/assets/{search-input-ByuB0YyC.js → search-input-Bhg65axQ.js} +1 -1
- package/dist/client/assets/secrets-CoTCTnY9.js +1 -0
- package/dist/client/assets/sections-editor-P9NnL9uS.js +2 -0
- package/dist/client/assets/select-Bhj7LCuD.js +1 -0
- package/dist/client/assets/{select-model-CebmAt-C.js → select-model-BkLoUhWB.js} +1 -1
- package/dist/client/assets/self-tool-result-DdS1heyV.js +1 -0
- package/dist/client/assets/seo-editor-5nf9jCaQ.js +1 -0
- package/dist/client/assets/{settings-layout-DUpflFya.js → settings-layout-Ct-vBxnm.js} +1 -1
- package/dist/client/assets/{settings-section-DS6otYn7.js → settings-section-D-A3Bfgf.js} +1 -1
- package/dist/client/assets/{shell-controls-B9xMPAfw.js → shell-controls-DCy9Peje.js} +1 -1
- package/dist/client/assets/{shell-layout-Bo6QxW8m.js → shell-layout-DDCV5qM0.js} +1 -1
- package/dist/client/assets/{sidebar-BFdShy9x.js → sidebar-DeWKCtxp.js} +1 -1
- package/dist/client/assets/{skeleton-BGZh750P.js → skeleton-BbGF1H7-.js} +1 -1
- package/dist/client/assets/sso-D7TxlrMn.js +1 -0
- package/dist/client/assets/{store-ioH_J-rE.js → store-0pluQIHD.js} +1 -1
- package/dist/client/assets/store-registry-CO9GrEkA.js +2 -0
- package/dist/client/assets/{studio-tools-bThaob6p.js → studio-tools-CE7lpCkl.js} +1 -1
- package/dist/client/assets/{switch-C2KH_TaK.js → switch-BNLG1jmU.js} +1 -1
- package/dist/client/assets/{table-XKbQ5Wjx.js → table-ByQcTCqP.js} +1 -1
- package/dist/client/assets/{tabs-D-6eQ0wE.js → tabs-CXMTix3U.js} +1 -1
- package/dist/client/assets/{textarea-PYu4eHQV.js → textarea-BPWk2Ywn.js} +1 -1
- package/dist/client/assets/{toggle-group-BcxqPGrf.js → toggle-group-DPBmxHrX.js} +1 -1
- package/dist/client/assets/{toolbar-D90MFc80.js → toolbar-CpK88Wot.js} +1 -1
- package/dist/client/assets/{toolbar-icon-button-D3m9VnTI.js → toolbar-icon-button--NaDqMEF.js} +1 -1
- package/dist/client/assets/{tooltip-O3iHy7-o.js → tooltip-B8wnTm17.js} +1 -1
- package/dist/client/assets/{use-ai-providers-B4nhSJlr.js → use-ai-providers-BO2D28v4.js} +1 -1
- package/dist/client/assets/{use-automations-C01orYPa.js → use-automations-CvhBPwX5.js} +1 -1
- package/dist/client/assets/{use-autosave-BhfvFfoI.js → use-autosave-DUdpa8zB.js} +1 -1
- package/dist/client/assets/{use-capability--WeMT0KP.js → use-capability-B2zRKwHf.js} +1 -1
- package/dist/client/assets/use-clock-tick-BfNa5AcO.js +1 -0
- package/dist/client/assets/{use-collections-K1HyCAfG.js → use-collections-tP6FM68N.js} +1 -1
- package/dist/client/assets/{use-connection-twfWXxwG.js → use-connection-Bubfkk8k.js} +1 -1
- package/dist/client/assets/{use-copy-DQ4y4418.js → use-copy-3Mpuxl0p.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-NwJ9x5Kd.js → use-create-virtual-mcp-BhfqxX9Z.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-BdWGMbok.js → use-debounced-autosave-B1u8xEPK.js} +1 -1
- package/dist/client/assets/{use-debounced-value-xN0eyoO9.js → use-debounced-value-ToigCZRD.js} +1 -1
- package/dist/client/assets/use-deco-credits-We_pqPUY.js +1 -0
- package/dist/client/assets/{use-decopilot-events-BEOY-_n2.js → use-decopilot-events-DDSe_K7D.js} +1 -1
- package/dist/client/assets/{use-delete-connection-BlzYSB_f.js → use-delete-connection-veOzeP_-.js} +1 -1
- package/dist/client/assets/{use-deployment-admin-DYO-CLsy.js → use-deployment-admin-uwYQkYfr.js} +1 -1
- package/dist/client/assets/{use-file-configs-Bs9N4w-Z.js → use-file-configs-DxQ_uwCG.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-Dt7gLdpr.js → use-infinite-scroll-0uWHf52y.js} +1 -1
- package/dist/client/assets/{use-join-requests-D0z99IAk.js → use-join-requests-FGCBDSYD.js} +1 -1
- package/dist/client/assets/{use-mcp-auth-status-C7G9bAkb.js → use-mcp-auth-status-CFgkpOhb.js} +1 -1
- package/dist/client/assets/{use-mcp-client-DrROXOcH.js → use-mcp-client-D2BCR1MH.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-D28ox9dJ.js → use-mcp-tools-DadUkegG.js} +1 -1
- package/dist/client/assets/{use-members-mvfsRjey.js → use-members-X6Ssb-cK.js} +1 -1
- package/dist/client/assets/{use-mobile-nauPjzo2.js → use-mobile-Cd6_A-wv.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-BJC_x779.js → use-navigate-to-agent-rb-KJLb8.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-jU0nDPT-.js → use-org-auth-client-Bw3VIyYp.js} +1 -1
- package/dist/client/assets/{use-org-sso-j8hZyqdO.js → use-org-sso-DBoYR181.js} +1 -1
- package/dist/client/assets/{use-organization-roles-thqey2Pm.js → use-organization-roles-B2nz6Y2V.js} +1 -1
- package/dist/client/assets/{use-organization-settings-BJ1bjHsL.js → use-organization-settings-B7BUH-ed.js} +1 -1
- package/dist/client/assets/{use-registry-app-CeyrXTI4.js → use-registry-app-DnzAi61_.js} +1 -1
- package/dist/client/assets/{use-registry-connections-D94L7VqK.js → use-registry-connections-dW2A6Cn6.js} +1 -1
- package/dist/client/assets/{use-secrets-C1Fme0Ya.js → use-secrets-BDm4jx5-.js} +1 -1
- package/dist/client/assets/{use-status-sounds-B1YKt2sD.js → use-status-sounds-Bf8VuMQs.js} +1 -1
- package/dist/client/assets/{use-view-mode-gP4n4GFH.js → use-view-mode-Rpx9lr2S.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-C964oRwj.js → use-virtual-mcp-BIj51zng.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-B2tGgvl5.js +1 -0
- package/dist/client/assets/{useRouterState-Bi7YKwTw.js → useRouterState-DPwhq9G0.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-BYVVsI1f.js +1 -0
- package/dist/client/assets/{users-BiDYlXA2.js → users-DAp0zXfL.js} +1 -1
- package/dist/client/assets/variant-calendar-ByIjiAPe.js +1 -0
- package/dist/client/assets/{view-mode-toggle-kFlOpvCC.js → view-mode-toggle-BbtMRSS5.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/server/cli.js +1 -1
- package/dist/server/server.js +1 -1
- package/package.json +1 -1
- package/dist/client/assets/Check-BF3t7WWi.js +0 -1
- package/dist/client/assets/ChevronUp-Y-IpPAUR.js +0 -1
- package/dist/client/assets/Circle-0HId1SV6.js +0 -1
- package/dist/client/assets/DotsVertical-CYU3Mae1.js +0 -1
- package/dist/client/assets/Flag01-B_AKNFoc.js +0 -1
- package/dist/client/assets/List-DZAsltZv.js +0 -1
- package/dist/client/assets/TrendUp01-7N_6K3-X.js +0 -1
- package/dist/client/assets/UserPlus01-D2pAl0t2.js +0 -1
- package/dist/client/assets/agent-icon-DmIJ53uv.js +0 -1
- package/dist/client/assets/agents-list-GFWV8fSw.js +0 -1
- package/dist/client/assets/ai-providers-C93Uux8H.js +0 -1
- package/dist/client/assets/app-editor-GnwEYs2F.js +0 -1
- package/dist/client/assets/automation-runs-yMzfgCqo.js +0 -188
- package/dist/client/assets/automations-Db9v_2wu.js +0 -1
- package/dist/client/assets/buckets-Bkz3itxJ.js +0 -1
- package/dist/client/assets/bulk-category-panel-EjjgUKdU.js +0 -1
- package/dist/client/assets/calendar-BdMqQsTv.js +0 -1
- package/dist/client/assets/category-editor-l1ImzDA-.js +0 -1
- package/dist/client/assets/checkbox-CxV2vfbv.js +0 -1
- package/dist/client/assets/collection-detail-ByPPxvaR.js +0 -1
- package/dist/client/assets/collection-display-button-BBHublq2.js +0 -1
- package/dist/client/assets/commerce-onboarding-Dgs4FWfH.js +0 -1
- package/dist/client/assets/connect-desktop-dialog-CPSwwSyz.js +0 -1
- package/dist/client/assets/connection-detail-DuvF3pbE.js +0 -1
- package/dist/client/assets/connections-CE66Octw.js +0 -1
- package/dist/client/assets/dropdown-menu-BgNr7tM1.js +0 -1
- package/dist/client/assets/file-explorer-nG37TAVQ.js +0 -2
- package/dist/client/assets/general-c3hgsq_x.js +0 -1
- package/dist/client/assets/index-DKadkG06.js +0 -4
- package/dist/client/assets/index-DpLPq5a_.css +0 -1
- package/dist/client/assets/index-bj26_8KX.js +0 -1
- package/dist/client/assets/members-CrKGCoFu.js +0 -1
- package/dist/client/assets/orgs-jcqywdGM.js +0 -1
- package/dist/client/assets/page-seo-sheet-BF2mpJ0B.js +0 -1
- package/dist/client/assets/post-editor-JD3fSSO7.js +0 -1
- package/dist/client/assets/profile-CZ9vM3_S.js +0 -1
- package/dist/client/assets/project-app-view-40EQ9ogm.js +0 -1
- package/dist/client/assets/record-editor-BmGDR-eB.js +0 -1
- package/dist/client/assets/redirect-editor-0M8-Neu7.js +0 -1
- package/dist/client/assets/registry-CwTOcwuV.js +0 -2
- package/dist/client/assets/roles-Bo-eSbrf.js +0 -1
- package/dist/client/assets/secrets-C_1Jcs02.js +0 -1
- package/dist/client/assets/sections-editor-gaZ0BvyI.js +0 -2
- package/dist/client/assets/select-B6GE4jHJ.js +0 -1
- package/dist/client/assets/self-tool-result-DJIiUu6Z.js +0 -1
- package/dist/client/assets/seo-editor-DNUmLmzw.js +0 -1
- package/dist/client/assets/sso-D7EYt-G3.js +0 -1
- package/dist/client/assets/store-registry-s8bkhEBH.js +0 -2
- package/dist/client/assets/use-clock-tick-DboEo7Cc.js +0 -1
- package/dist/client/assets/use-deco-credits-Bm-VH5Hm.js +0 -1
- package/dist/client/assets/useInfiniteQuery-DKhJHTs2.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-DAAXTkZt.js +0 -1
- package/dist/client/assets/variant-calendar-m6XjJ2dx.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as F,C as Ne,K as re,b4 as ct,m as Ce,j as s,l as K,i as fe,B as le,c as H,H as we,ad as be,I as se,af as Le,ag as Pe,n as ze,M as dt,J as mt,d as Ye,t as he,p as Ae,w as Fe,x as ut,E as ft,b as ht,u as xt}from"./index-DF3zg-P1.js";import{u as pt}from"./use-organization-roles-thqey2Pm.js";import{u as Re}from"./use-org-auth-client-jU0nDPT-.js";import{g as $e,a as gt}from"./role-color-Dn2tXDDF.js";import{B as xe}from"./badge-CfAmvo-h.js";import{f as Ke,a as Qe,b as He,c as qe,d as Ze,A as Je,e as Xe,g as We}from"./alert-dialog-3VMQ65hF.js";import{D as Tt,a as Et,c as _t,d as It}from"./dropdown-menu-BgNr7tM1.js";import{i as bt}from"./DotsVertical-CYU3Mae1.js";import{s as Se}from"./Plus-DWjKZ2wj.js";import{s as Nt}from"./Trash01-DEWgFvvg.js";import{C as St}from"./collection-table-wrapper-DIkftYUF.js";import{P as te}from"./index-CeqD0RVV.js";import{E as De}from"./empty-state-CdKwtMyP.js";import{S as Oe}from"./search-input-ByuB0YyC.js";import{P as et,D as tt}from"./ai-providers-logos-DD3qZ33J.js";import{I as je}from"./integration-icon-BfKWLZT4.js";import{u as Ct}from"./use-infinite-scroll-Dt7gLdpr.js";import{C as ve}from"./checkbox-CxV2vfbv.js";import{b as At}from"./Settings02-CM0Uzs0U.js";import{u as Rt}from"./useSuspenseInfiniteQuery-DAAXTkZt.js";import{u as Ot}from"./use-mcp-client-DrROXOcH.js";import{S as jt}from"./constants-BHDe7bIw.js";import{C as vt}from"./collection-search-C4jDpdZf.js";import{u as st}from"./use-members-mvfsRjey.js";import{g as lt}from"./get-initials-D-f_fDFw.js";import{u as yt}from"./use-connection-twfWXxwG.js";import{u as Mt,c as wt}from"./use-ai-providers-B4nhSJlr.js";import{A as nt}from"./avatar-UXZ4R5Yb.js";import{S as pe}from"./switch-C2KH_TaK.js";import{c as ge,b as Te,T as Ee,a as _e}from"./tooltip-O3iHy7-o.js";import{S as ke,a as Ge,b as Ue}from"./settings-section-DS6otYn7.js";import{t as Lt}from"./ChevronDown-CQLSXgt3.js";import{i as Pt}from"./ChevronRight-Fgy0rUS_.js";import{i as Be}from"./X-Dm6kY_ek.js";import{a as Dt}from"./use-capability--WeMT0KP.js";import{A as kt}from"./access-gate-CPecvlS5.js";import"./Check-BF3t7WWi.js";import"./Circle-0HId1SV6.js";import"./table-XKbQ5Wjx.js";import"./ArrowUp-YK2fJPgi.js";import"./sidebar-BFdShy9x.js";import"./LayoutLeft-C0g0LezP.js";import"./use-mobile-nauPjzo2.js";import"./SearchMd-CKteZWzZ.js";import"./Tool02-tJKj7JcW.js";import"./agent-icon-DmIJ53uv.js";import"./AlertCircle-B6AELEdc.js";import"./UserPlus01-D2pAl0t2.js";import"./Tool01-4pit7qOS.js";import"./XCircle-cwYbcP7y.js";import"./ArrowUpRight-BKVLcZTe.js";import"./TrendUp01-7N_6K3-X.js";import"./ZapSquare-Dj8pa8Fg.js";import"./ZoomOut-_psBJlXD.js";import"./Users03-WVYBBENu.js";import"./CheckCircle-BfxYbuVE.js";import"./ChevronUp-Y-IpPAUR.js";import"./Stars02-DBH33Ez2.js";import"./Copy01-B0CQRE_5.js";import"./Globe01-B52VKYy7.js";import"./Eye-CLtdCpUf.js";import"./FilterLines-DeiGsRZY.js";import"./Flag01-B_AKNFoc.js";import"./Star01-B-8espqJ.js";import"./Globe04-B0las6Jv.js";import"./SwitchHorizontal01-DUrn8gXV.js";import"./HardDrive-CU-vvmKE.js";import"./Image01-B-FQwXx8.js";import"./Key01-myvTSA8u.js";import"./LinkExternal01-d9EixhiS.js";import"./List-DZAsltZv.js";import"./Monitor01-BkDBzdlH.js";import"./Sun-MvOAGgKN.js";import"./Package-eNacrLmv.js";import"./Palette-BiKqXWvc.js";import"./Play-CdkPhmTs.js";import"./SearchLg-DBOWvxyl.js";import"./Shield01-aDvWVv5Z.js";import"./Stars01-DsfblQf3.js";import"./Upload01-C8RP0Fvq.js";import"./User01-v0Bqr3nA.js";import"./Users01-CPNZ7uMu.js";import"./XClose-DnNyN9T-.js";import"./Zap-CNRURtEh.js";import"./auth-dSVlMQ86.js";import"./use-collections-K1HyCAfG.js";import"./studio-tools-bThaob6p.js";import"./card-dLLzWD0r.js";import"./capability-load-error-B9xkkNBq.js";const ye="basic-usage",Me=[{id:ye,label:"Basic Usage",description:"Tools all org members can access by default",section:"Basic Usage",tools:["COLLECTION_CONNECTIONS_LIST","COLLECTION_CONNECTIONS_GET","CONNECTION_TEST","COLLECTION_VIRTUAL_MCP_LIST","COLLECTION_VIRTUAL_MCP_GET","VIRTUAL_MCP_PLUGIN_CONFIG_GET","VIRTUAL_MCP_LAST_USED_LIST","AUTOMATION_GET","AUTOMATION_LIST","AUTOMATION_RUN_STATS","AI_PROVIDERS_LIST","AI_PROVIDERS_LIST_MODELS","AI_PROVIDERS_ACTIVE","AI_PROVIDER_KEY_LIST","AI_PROVIDER_CREDITS","AI_PROVIDER_TOPUP_URL","LIST_OBJECTS","GET_OBJECT_METADATA","GET_PRESIGNED_URL","PUT_PRESIGNED_URL","FILE_OBJECTS_LIST","SANDBOX_START","SANDBOX_DELETE","GLOBAL_SEARCH","ORGANIZATION_SETTINGS_GET","USER_GET","LINK_CURRENT_GET","LINK_DISCONNECT","BRAND_CONTEXT_LIST","COLLECTION_THREADS_CREATE","COLLECTION_THREADS_LIST","COLLECTION_THREADS_GET","COLLECTION_THREADS_UPDATE","COLLECTION_THREADS_DELETE","COLLECTION_THREAD_MESSAGES_LIST","THREAD_BACKGROUND_TOOL_START","THREAD_SUBTASK_DELIVER","TASK_BOARD_ITEM_CREATE","TASK_BOARD_ITEM_LIST","TASK_BOARD_ITEM_UPDATE","TASK_BOARD_ITEM_DELETE","TASK_BOARD_ITEM_PRS_GET"]},{id:"org:manage",label:"Manage organization",description:"Edit organization settings, brand context, and domain configuration",section:"Organization",tools:["ORGANIZATION_GET","ORGANIZATION_LIST","ORGANIZATION_UPDATE","ORGANIZATION_SETTINGS_GET","ORGANIZATION_SETTINGS_UPDATE","BRAND_CONTEXT_LIST","BRAND_CONTEXT_GET","BRAND_CONTEXT_CREATE","BRAND_CONTEXT_UPDATE","BRAND_CONTEXT_DELETE","BRAND_CONTEXT_EXTRACT","BRAND_GET","BRAND_LIST","ORGANIZATION_DOMAIN_LIST","ORGANIZATION_DOMAIN_ADD","ORGANIZATION_DOMAIN_UPDATE","ORGANIZATION_DOMAIN_VERIFY","ORGANIZATION_DOMAIN_REMOVE"]},{id:"members:manage",label:"Manage members",description:"Invite members, remove them, and change their roles",section:"Organization",tools:["ORGANIZATION_MEMBER_LIST","ORGANIZATION_MEMBER_ADD","ORGANIZATION_MEMBER_REMOVE","ORGANIZATION_MEMBER_UPDATE_ROLE","ORGANIZATION_JOIN_REQUEST_LIST","ORGANIZATION_JOIN_REQUEST_APPROVE","ORGANIZATION_JOIN_REQUEST_DENY"],dangerous:!0},{id:"connections:manage",label:"Manage connections",description:"Create, update, and delete connections",section:"Connections & Agents",tools:["COLLECTION_CONNECTIONS_CREATE","COLLECTION_CONNECTIONS_UPDATE","COLLECTION_CONNECTIONS_DELETE","COMMERCE_DISCOVERY_SETUP","COMMERCE_DISCOVERY_RUN","COMMERCE_DISCOVERY_BIND","COMMERCE_DISCOVERY_CONNECTION_STATUS"],dangerous:!0},{id:"agents:manage",label:"Manage agents",description:"Create, configure, and delete agents",section:"Connections & Agents",tools:["COLLECTION_VIRTUAL_MCP_CREATE","COLLECTION_VIRTUAL_MCP_UPDATE","COLLECTION_VIRTUAL_MCP_DELETE","VIRTUAL_MCP_PLUGIN_CONFIG_UPDATE","VIRTUAL_MCP_PINNED_VIEWS_UPDATE"],dangerous:!0},{id:"automations:manage",label:"Manage automations",description:"Create, update, run, and delete automations",section:"Automations",tools:["AUTOMATION_CREATE","AUTOMATION_UPDATE","AUTOMATION_DELETE","AUTOMATION_TRIGGER_ADD","AUTOMATION_TRIGGER_REMOVE","AUTOMATION_TRIGGER_ROTATE_TOKEN","AUTOMATION_RUN"],dangerous:!0},{id:"monitoring:view",label:"View monitoring",description:"Access logs and usage statistics",section:"Monitoring",tools:["MONITORING_LOG_GET","MONITORING_LOGS_LIST","MONITORING_STATS","MONITORING_THREAD_USAGE"]},{id:"secrets:manage",label:"Manage secrets",description:"Create and list secrets stored in the credential vault",section:"Organization",tools:["SECRET_CREATE","SECRET_LIST"]},{id:"file-configs:manage",label:"Manage file configs",description:"Create, list, update and delete S3 bucket configurations",section:"Organization",tools:["FILE_CONFIG_CREATE","FILE_CONFIG_LIST","FILE_CONFIG_UPDATE","FILE_CONFIG_DELETE","FILE_OBJECTS_LIST"]},{id:"ai-providers:manage",label:"Manage AI providers",description:"Add or remove API keys and provision provider credentials",section:"AI Providers",tools:["AI_PROVIDER_KEY_CREATE","AI_PROVIDER_KEY_LIST","AI_PROVIDER_KEY_DELETE","AI_PROVIDER_KEY_UPDATE","AI_PROVIDER_KEY_PREVIEW","AI_PROVIDER_OAUTH_URL","AI_PROVIDER_OAUTH_EXCHANGE","AI_PROVIDER_PROVISION_KEY","AI_PROVIDER_TOPUP_URL","AI_PROVIDER_CREDITS"]},{id:"tags:manage",label:"Manage tags",description:"Create, assign, and delete organization tags",section:"Organization",tools:["TAGS_LIST","TAGS_CREATE","TAGS_DELETE","MEMBER_TAGS_GET","MEMBER_TAGS_SET"]},{id:"registry:manage",label:"Manage registry",description:"Browse, publish, and manage items in the registry",section:"Store & Registry",tools:["COLLECTION_REGISTRY_APP_LIST","COLLECTION_REGISTRY_APP_GET","COLLECTION_REGISTRY_APP_VERSIONS","COLLECTION_REGISTRY_APP_FILTERS","REGISTRY_ITEM_LIST","REGISTRY_ITEM_SEARCH","REGISTRY_ITEM_GET","REGISTRY_ITEM_VERSIONS","REGISTRY_ITEM_FILTERS","REGISTRY_DISCOVER_TOOLS","REGISTRY_ITEM_CREATE","REGISTRY_ITEM_BULK_CREATE","REGISTRY_ITEM_UPDATE","REGISTRY_ITEM_DELETE","REGISTRY_AI_GENERATE","REGISTRY_PUBLISH_REQUEST_LIST","REGISTRY_PUBLISH_REQUEST_REVIEW","REGISTRY_PUBLISH_REQUEST_COUNT","REGISTRY_PUBLISH_REQUEST_DELETE","REGISTRY_PUBLISH_API_KEY_GENERATE","REGISTRY_PUBLISH_API_KEY_LIST","REGISTRY_PUBLISH_API_KEY_REVOKE"],dangerous:!0},{id:"registry:monitor",label:"Monitor registry health",description:"Run health checks on registry connections and view results",section:"Store & Registry",tools:["REGISTRY_MONITOR_RUN_START","REGISTRY_MONITOR_RUN_LIST","REGISTRY_MONITOR_RUN_GET","REGISTRY_MONITOR_RUN_CANCEL","REGISTRY_MONITOR_RESULT_LIST","REGISTRY_MONITOR_CONNECTION_LIST","REGISTRY_MONITOR_CONNECTION_SYNC","REGISTRY_MONITOR_CONNECTION_UPDATE_AUTH"]},{id:"api-keys:manage",label:"Manage API keys",description:"Create, update, and revoke API keys",section:"Developer",tools:["API_KEY_CREATE","API_KEY_LIST","API_KEY_UPDATE","API_KEY_DELETE"]},{id:"storage:delete",label:"Delete from storage",description:"Permanently delete files from object storage",section:"Developer",tools:["DELETE_OBJECT","DELETE_OBJECTS"],dangerous:!0},{id:"connections:sql",label:"Run SQL queries",description:"Execute raw SQL against connected databases",section:"Developer",tools:["DATABASES_RUN_SQL"],dangerous:!0}];[...Me.find(t=>t.id===ye)?.tools??[]];const Gt=["agents:manage","connections:manage"];new Set(Me.filter(t=>Gt.includes(t.id)).flatMap(t=>t.tools));function Ut(){const t=new Map;for(const e of Me){if(e.id===ye)continue;const l=t.get(e.section)??[];l.push(e),t.set(e.section,l)}return Array.from(t.entries()).map(([e,l])=>({section:e,capabilities:l}))}function Bt(t,e,l){return l?!0:t.tools.every(n=>e.includes(n))}function Vt(t,e,l){if(l){const i=new Set(e);for(const r of t.tools)i.add(r);return Array.from(i)}const n=new Set(e);for(const i of t.tools)n.delete(i);return Array.from(n)}function zt(t){const e=H.c(21),{connection:l,isSelected:n,hasToolsEnabled:i,activeToolsCount:r,totalToolsCount:d,onSelect:h,onToggle:c}=t,x=n?"bg-accent/50":"hover:bg-muted/50";let f;e[0]!==x?(f=K("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",x),e[0]=x,e[1]=f):f=e[1];let a;e[2]!==l.icon||e[3]!==l.title?(a=s.jsx(je,{icon:l.icon,name:l.title,size:"xs"}),e[2]=l.icon,e[3]=l.title,e[4]=a):a=e[4];let p;e[5]!==l.title?(p=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:l.title})}),e[5]=l.title,e[6]=p):p=e[6];let o;e[7]!==h||e[8]!==a||e[9]!==p?(o=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:h,children:[a,p]}),e[7]=h,e[8]=a,e[9]=p,e[10]=o):o=e[10];let m;e[11]!==r||e[12]!==l.tools||e[13]!==i||e[14]!==c||e[15]!==d?(m=l.tools&&l.tools.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[r,"/",d]}),s.jsx(ve,{checked:i,onCheckedChange:c,onClick:Yt})]}),e[11]=r,e[12]=l.tools,e[13]=i,e[14]=c,e[15]=d,e[16]=m):m=e[16];let N;return e[17]!==f||e[18]!==o||e[19]!==m?(N=s.jsxs("div",{className:f,children:[o,m]}),e[17]=f,e[18]=o,e[19]=m,e[20]=N):N=e[20],N}function Yt(t){return t.stopPropagation()}function Ft(t){const e=H.c(18),{connectionId:l,tool:n,isSelected:i,onToggle:r}=t,d=`tool-${l}-${n.name}`,h=i?"text-foreground":"text-muted-foreground";let c;e[0]!==h?(c=K("text-sm font-medium",h),e[0]=h,e[1]=c):c=e[1];let x;e[2]!==c||e[3]!==n.name?(x=s.jsx("div",{className:"flex items-center gap-2 mb-1",children:s.jsx("span",{className:c,children:n.name})}),e[2]=c,e[3]=n.name,e[4]=x):x=e[4];let f;e[5]!==n.description?(f=n.description&&s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:n.description}),e[5]=n.description,e[6]=f):f=e[6];let a;e[7]!==x||e[8]!==f?(a=s.jsxs("div",{className:"flex-1 min-w-0",children:[x,f]}),e[7]=x,e[8]=f,e[9]=a):a=e[9];const p=`tool-${l}-${n.name}`;let o;e[10]!==i||e[11]!==r||e[12]!==p?(o=s.jsx("div",{className:"flex items-center shrink-0",children:s.jsx(ve,{id:p,checked:i,onCheckedChange:r,onClick:$t})}),e[10]=i,e[11]=r,e[12]=p,e[13]=o):o=e[13];let m;return e[14]!==d||e[15]!==a||e[16]!==o?(m=s.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:d,children:[a,o]}),e[14]=d,e[15]=a,e[16]=o,e[17]=m):m=e[17],m}function $t(t){return t.stopPropagation()}function Kt({toolSet:t,onToolSetChange:e,excludeVirtualMcpId:l,searchQuery:n}){const[i,r]=F.useState(""),d=n!==void 0?n:i,h=F.useDeferredValue(d),[c,x]=F.useState("all"),[f,a]=F.useState(!1),p=F.useRef(new Set(Object.keys(t))),{org:o}=Ne(),m=Ot({connectionId:jt,orgId:o.id,orgSlug:o.slug}),N=100,_=h.trim(),E=_?{operator:"or",conditions:[{field:["title"],operator:"contains",value:_},{field:["description"],operator:"contains",value:_}]}:void 0,S=!!l,C={...E&&{where:E},orderBy:[{field:["updated_at"],direction:"asc"}],limit:N,offset:0,...S&&{include_virtual:!0}},v=JSON.stringify(C),{data:I,fetchNextPage:R,hasNextPage:g,isFetchingNextPage:O}=Rt({queryKey:re.collectionListInfinite(m,o.id,"","CONNECTIONS",v),queryFn:async({pageParam:T=0})=>(await m.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...E&&{where:E},orderBy:[{field:["updated_at"],direction:"asc"}],limit:N,offset:T,...S&&{include_virtual:!0}}})).structuredContent,initialPageParam:0,getNextPageParam:(T,D)=>{if(T?.hasMore)return D.reduce((Q,q)=>Q+(q?.items?.length??0),0)},staleTime:3e4}),b=I?.pages.flatMap(T=>T?.items??[])??[],j=Ct(R,g??!1,O),u=l?b.filter(T=>T.connection_type!=="VIRTUAL"?!0:ct(T.connection_url)!==l):b,M=p.current,A=[...M.values()].map(T=>u.find(D=>D.id===T)).filter(T=>T!==void 0),k=u.filter(T=>!M.has(T.id)),G=[...A,...k],U=T=>{const D=t[T];return D!==void 0&&D.length>0},B=G.filter(T=>{if(c==="all")return!0;const D=U(T.id);return c==="selected"?D:c==="unselected"?!D:!0}),[w,z]=F.useState(G[0]?.id??null),y=w?G.find(T=>T.id===w)??null:null,{data:L,isFetching:Y}=Ce({queryKey:re.collectionItem(m,o.id,"","CONNECTIONS",w??""),queryFn:async()=>w?(await m.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:w}})).structuredContent?.item??null:null,enabled:!!w,staleTime:3e4}),$=L?.tools??[],J=(T,D)=>t[T]?.includes(D)??!1,X=(T,D)=>{const Q=t[T]??[],q=Q.includes(D),W={...t};if(q){const Z=Q.filter(ee=>ee!==D);Z.length===0?delete W[T]:W[T]=Z}else W[T]=[...Q,D];e(W)},ne=T=>{const D=T===w?$:[];if(!D.length)return;const Q=t[T]??[],q=D.map(ee=>ee.name),W=Q.length>0&&q.every(ee=>Q.includes(ee)),Z={...t};W?delete Z[T]:(Z[T]=q,z(T)),e(Z)},oe=T=>{z(T),a(!0)},ie=()=>{a(!1)};return s.jsxs("div",{className:"flex h-full",children:[s.jsxs("div",{className:K("w-full md:w-80 border-r border-border flex flex-col",f&&"hidden md:flex"),children:[n===void 0&&s.jsx(vt,{value:i,onChange:r,placeholder:"Search MCP Servers..."}),s.jsxs("div",{className:"flex gap-1 p-2 border-b border-border",children:[s.jsx("button",{onClick:()=>x("all"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),s.jsx("button",{onClick:()=>x("selected"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),s.jsx("button",{onClick:()=>x("unselected"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),s.jsx("div",{className:"flex-1 overflow-auto",children:B.length===0?s.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:d?"No connections found":c==="selected"?"No servers selected":c==="unselected"?"No unselected servers":"No connections available"}):s.jsxs("div",{className:"p-2 space-y-1",children:[B.map(T=>{const D=w===T.id,Q=D?$.length:0,q=t[T.id]?.length??0;return s.jsx(zt,{connection:{...T,tools:D?$:T.tools},isSelected:D,hasToolsEnabled:U(T.id),activeToolsCount:q,totalToolsCount:Q,onSelect:()=>oe(T.id),onToggle:()=>ne(T.id)},T.id)}),s.jsx("div",{ref:j,className:"h-4"}),O&&s.jsx("div",{className:"flex justify-center py-3",children:s.jsx(fe,{size:18,className:"animate-spin text-muted-foreground"})})]})})]}),s.jsx("div",{className:K("flex-1 flex-col",f?"flex":"hidden md:flex"),children:y?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"md:hidden border-b border-border p-4 flex items-center gap-3",children:[s.jsx(le,{variant:"ghost",size:"sm",onClick:ie,className:"h-8 w-8 p-0 shrink-0",children:s.jsx(At,{size:20})}),s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[s.jsx(je,{icon:y.icon,name:y.title,size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:y.title}),y.description&&s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:y.description})]})]})]}),s.jsx("div",{className:"flex-1 overflow-auto p-4",children:Y?s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(fe,{size:18,className:"animate-spin text-muted-foreground"})}):$.length===0?s.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"This connection has no tools available"}):s.jsx("div",{className:"space-y-2",children:$.map(T=>s.jsx(Ft,{connectionId:y.id,tool:T,isSelected:J(y.id,T.name),onToggle:()=>X(y.id,T.name)},T.name))})})]}):s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx("div",{className:"text-sm text-muted-foreground text-center",children:"Select a connection to view its tools"})})})]})}const Qt=we({role:we({id:se().optional(),slug:se().optional(),label:se()}),allowAllStaticPermissions:Pe(),staticPermissions:be(se()),toolSet:Le(se(),be(se())),allowAllModels:Pe(),modelSet:Le(se(),be(se())),memberIds:be(se())});function Ve(t,e,l){const n=s.jsx(pe,{checked:t,disabled:e,onCheckedChange:l});return e?s.jsx(ge,{children:s.jsxs(Te,{children:[s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:n})}),s.jsx(_e,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):n}function Ht(t){const e=H.c(28),{allowAllStaticPermissions:l,staticPermissions:n,onAllowAllChange:i,onPermissionsChange:r,readOnly:d,searchQuery:h}=t,c=d===void 0?!1:d;let x;e[0]!==h?(x=h.trim().toLowerCase(),e[0]=h,e[1]=x):x=e[1];const f=F.useDeferredValue(x);let a;if(e[2]!==l||e[3]!==f||e[4]!==i||e[5]!==r||e[6]!==c||e[7]!==h||e[8]!==n){const p=Ut(),o=(v,I)=>{if(!c){if(l&&I){const R=p.flatMap(Jt).flatMap(Zt);i(!1),r(R.filter(g=>!v.tools.includes(g)));return}l||r(Vt(v,n,!I))}};let m;e[10]!==f?(m=v=>{const{section:I,capabilities:R}=v;return{section:I,capabilities:R.filter(g=>!f||g.label.toLowerCase().includes(f)||g.description.toLowerCase().includes(f))}},e[10]=f,e[11]=m):m=e[11];const N=p.map(m).filter(qt);let _;e[12]!==l||e[13]!==i||e[14]!==r?(_=()=>{i(!l),r([])},e[12]=l,e[13]=i,e[14]=r,e[15]=_):_=e[15];let E;e[16]!==l||e[17]!==c||e[18]!==_?(E=Ve(l,c,_),e[16]=l,e[17]=c,e[18]=_,e[19]=E):E=e[19];let S;e[20]!==l||e[21]!==i||e[22]!==r||e[23]!==c?(S=c?void 0:()=>{i(!l),r([])},e[20]=l,e[21]=i,e[22]=r,e[23]=c,e[24]=S):S=e[24];let C;e[25]!==E||e[26]!==S?(C=s.jsx(ke,{title:"General",children:s.jsx(Ge,{children:s.jsx(Ue,{title:"All organization permissions",description:"Grant full access to all features below",action:E,onClick:S})})}),e[25]=E,e[26]=S,e[27]=C):C=e[27],a=s.jsx("div",{children:s.jsxs("div",{className:"flex flex-col gap-10 py-4",children:[C,N.length===0&&f?s.jsxs("p",{className:"text-sm text-muted-foreground py-4",children:["No permissions match “",h,"”"]}):N.map(v=>{const{section:I,capabilities:R}=v;return s.jsx(ke,{title:I,children:s.jsx(Ge,{children:R.map(g=>{const O=Bt(g,n,l);return s.jsx(Ue,{title:s.jsxs("span",{className:"flex items-center gap-1.5",children:[g.label,g.dangerous&&s.jsx(ut,{size:12,className:"text-warning shrink-0"})]}),description:g.description,action:Ve(O,c,()=>o(g,O)),onClick:c?void 0:()=>o(g,O)},g.id)})})},I)})]})}),e[2]=l,e[3]=f,e[4]=i,e[5]=r,e[6]=c,e[7]=h,e[8]=n,e[9]=a}else a=e[9];return a}function qt(t){return t.capabilities.length>0}function Zt(t){return t.tools}function Jt(t){return t.capabilities}const ot={anthropic:"Anthropic",openrouter:"OpenRouter"},Xt={openai:"OpenAI",anthropic:"Anthropic",google:"Google","meta-llama":"Meta",mistralai:"Mistral","x-ai":"xAI",deepseek:"DeepSeek",qwen:"Qwen",moonshotai:"MoonshotAI",nvidia:"NVIDIA",perplexity:"Perplexity",cohere:"Cohere",amazon:"Amazon",microsoft:"Microsoft","z-ai":"Z.ai","ibm-granite":"IBM Granite",alibaba:"Alibaba",baidu:"Baidu",bytedance:"ByteDance",tencent:"Tencent",minimax:"MiniMax",nousresearch:"Nous Research",allenai:"Allen AI",inception:"Inception"};function Wt(t,e){const l=t.indexOf("/"),n=l>0?t.slice(0,l):e;return n.startsWith("~")?n.slice(1):n}function es(t){return Xt[t]??ot[t]??t}function ts(t){const e=t.indexOf(": ");return e>0&&e<32?t.slice(e+2):t}const it=30;function ss(t){const e=H.c(44),{connectionId:l,subProviderId:n,subProviderName:i,groupLogo:r,models:d,allConnectionModelIds:h,selectedModels:c,allowAllModels:x,allConnectionModelsSelected:f,onToggleModel:a,onExitAllowAll:p,readOnly:o,defaultExpanded:m}=t,[N,_]=F.useState(m),E=m||N,S=_,[C,v]=F.useState(it);let I;e[0]!==f||e[1]!==x||e[2]!==c?(I=j=>x||f||c.includes("*")||c.includes(j),e[0]=f,e[1]=x,e[2]=c,e[3]=I):I=e[3];const R=I;let g;if(e[4]!==R||e[5]!==d){let j;e[7]!==R?(j=u=>R(u.id),e[7]=R,e[8]=j):j=e[8],g=d.filter(j),e[4]=R,e[5]=d,e[6]=g}else g=e[6];const O=g.length;let b;if(e[9]!==h||e[10]!==x||e[11]!==l||e[12]!==O||e[13]!==E||e[14]!==r||e[15]!==R||e[16]!==d||e[17]!==p||e[18]!==a||e[19]!==o||e[20]!==n||e[21]!==i||e[22]!==C){const j=d.slice(0,C),u=d.length>C;let M;e[24]===Symbol.for("react.memo_cache_sentinel")?(M=()=>S(is),e[24]=M):M=e[24];const A=r??et[n]??tt;let k;e[25]!==i||e[26]!==A?(k=s.jsx(je,{icon:A,name:i,size:"sm"}),e[25]=i,e[26]=A,e[27]=k):k=e[27];let G;e[28]!==i?(G=s.jsx("span",{className:"text-sm font-medium truncate",children:i}),e[28]=i,e[29]=G):G=e[29];let U;e[30]!==k||e[31]!==G?(U=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[k,G]}),e[30]=k,e[31]=G,e[32]=U):U=e[32];let B;e[33]!==O||e[34]!==d.length?(B=s.jsxs(xe,{variant:"secondary",className:"text-xs text-muted-foreground",children:[O,"/",d.length," enabled"]}),e[33]=O,e[34]=d.length,e[35]=B):B=e[35];let w;e[36]!==E?(w=E?s.jsx(Lt,{size:16,className:"text-muted-foreground shrink-0"}):s.jsx(Pt,{size:16,className:"text-muted-foreground shrink-0"}),e[36]=E,e[37]=w):w=e[37];let z;e[38]!==w||e[39]!==B?(z=s.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[B,w]}),e[38]=w,e[39]=B,e[40]=z):z=e[40];let y;e[41]!==z||e[42]!==U?(y=s.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-3 hover:bg-muted/50 cursor-pointer",onClick:M,children:[U,z]}),e[41]=z,e[42]=U,e[43]=y):y=e[43],b=s.jsxs("div",{className:"border border-border rounded-lg overflow-hidden bg-card",children:[y,E&&s.jsxs("div",{className:"border-t border-border bg-muted/20",children:[j.map(L=>{const Y=R(L.id),$=()=>{if(!o){if(x){p(l,h,L.id);return}a(l,L.id)}};return s.jsxs("div",{className:K("flex items-center justify-between gap-3 px-4 py-3 border-b border-border last:border-b-0",!o&&"hover:bg-muted/50 cursor-pointer"),onClick:$,children:[s.jsx("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:s.jsx("span",{className:"text-sm truncate",children:L.title})}),s.jsx("div",{onClick:os,children:o?s.jsx(ge,{children:s.jsxs(Te,{children:[s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsx(pe,{checked:Y,disabled:!0,onCheckedChange:ns})})}),s.jsx(_e,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(pe,{checked:Y,onCheckedChange:$})})]},L.id)}),u&&s.jsxs("button",{type:"button",className:"w-full px-4 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors",onClick:()=>v(ls),children:["Show more (",d.length-C," remaining)"]})]})]}),e[9]=h,e[10]=x,e[11]=l,e[12]=O,e[13]=E,e[14]=r,e[15]=R,e[16]=d,e[17]=p,e[18]=a,e[19]=o,e[20]=n,e[21]=i,e[22]=C,e[23]=b}else b=e[23];return b}function ls(t){return t+it}function ns(){}function os(t){return t.stopPropagation()}function is(t){return!t}function rs(t){const e=H.c(33),{connection:l,selectedModels:n,allowAllModels:i,onToggleModel:r,onExitAllowAll:d,allConnectionModelsSelected:h,searchQuery:c,readOnly:x}=t,f=wt(l.id);let a,p,o,m,N;if(e[0]!==h||e[1]!==i||e[2]!==l.id||e[3]!==l.label||e[4]!==l.providerId||e[5]!==d||e[6]!==r||e[7]!==f||e[8]!==x||e[9]!==c||e[10]!==n){N=Symbol.for("react.early_return_sentinel");e:{let S;e[16]!==l.label?(S=A=>({...A,id:A.modelId,provider:l.label}),e[16]=l.label,e[17]=S):S=e[17];const C=f.filter(ms).map(S),v=c.trim().toLowerCase(),I=v?C.filter(A=>A.title.toLowerCase().includes(v)||A.id.toLowerCase().includes(v)||A.provider?.toLowerCase().includes(v)):C;if(I.length===0){N=null;break e}const R=new Map;for(const A of I){const k=Wt(A.id,l.providerId),G=R.get(k)??{models:[],logo:null};G.models.push({id:A.id,title:ts(A.title),logo:A.logo}),!G.logo&&A.logo&&(G.logo=A.logo),R.set(k,G)}const g=Array.from(R.entries()).map(ds).sort(cs),O=g.length===1||v.length>0;o="flex flex-col gap-3";const b=et[l.providerId]??tt;let j;e[18]!==l.providerId||e[19]!==b?(j=s.jsx("img",{src:b,alt:l.providerId,className:"w-4 h-4 rounded-sm dark:bg-white dark:rounded-sm dark:p-px"}),e[18]=l.providerId,e[19]=b,e[20]=j):j=e[20];const u=ot[l.providerId]??l.providerId;let M;e[21]!==u?(M=s.jsx("h4",{className:"text-sm font-medium",children:u}),e[21]=u,e[22]=M):M=e[22],e[23]!==M||e[24]!==j?(m=s.jsxs("div",{className:"flex items-center gap-2",children:[j,M]}),e[23]=M,e[24]=j,e[25]=m):m=e[25],a="flex flex-col gap-3",p=g.map(A=>s.jsx(ss,{connectionId:l.id,subProviderId:A.id,subProviderName:A.name,groupLogo:A.logo,models:A.models,allConnectionModelIds:C.map(as),selectedModels:n,allowAllModels:i,allConnectionModelsSelected:h,onToggleModel:r,onExitAllowAll:d,readOnly:x,defaultExpanded:O},A.id))}e[0]=h,e[1]=i,e[2]=l.id,e[3]=l.label,e[4]=l.providerId,e[5]=d,e[6]=r,e[7]=f,e[8]=x,e[9]=c,e[10]=n,e[11]=a,e[12]=p,e[13]=o,e[14]=m,e[15]=N}else a=e[11],p=e[12],o=e[13],m=e[14],N=e[15];if(N!==Symbol.for("react.early_return_sentinel"))return N;let _;e[26]!==a||e[27]!==p?(_=s.jsx("div",{className:a,children:p}),e[26]=a,e[27]=p,e[28]=_):_=e[28];let E;return e[29]!==o||e[30]!==m||e[31]!==_?(E=s.jsxs("div",{className:o,children:[m,_]}),e[29]=o,e[30]=m,e[31]=_,e[32]=E):E=e[32],E}function as(t){return t.id}function cs(t,e){return t.name.localeCompare(e.name)}function ds(t){const[e,l]=t;return{id:e,name:es(e),logo:l.logo,models:l.models}}function ms(t,e,l){return l.findIndex(n=>n.modelId===t.modelId)===e}function us(t){const e=H.c(35),{allowAllModels:l,modelSet:n,onAllowAllChange:i,onModelSetChange:r,readOnly:d,searchQuery:h}=t,c=d===void 0?!1:d,x=F.useDeferredValue(h),f=Mt();let a;e[0]!==n||e[1]!==r?(a=(g,O)=>{const b=n[g]??[],j={...n};if(b.includes(O)){const u=b.filter(M=>M!==O);u.length===0?delete j[g]:j[g]=u}else j[g]=[...b,O];r(j)},e[0]=n,e[1]=r,e[2]=a):a=e[2];const p=a;let o;e[3]!==n||e[4]!==i||e[5]!==r?(o=(g,O,b)=>{i(!1),r({...n,[g]:O.filter(j=>j!==b)})},e[3]=n,e[4]=i,e[5]=r,e[6]=o):o=e[6];const m=o,N=!c&&"hover:bg-muted/50 cursor-pointer";let _;e[7]!==N?(_=K("flex items-center justify-between px-4 py-3 rounded-lg border border-border bg-card",N),e[7]=N,e[8]=_):_=e[8];let E;e[9]!==l||e[10]!==i||e[11]!==r||e[12]!==c?(E=()=>{if(c)return;const g=!l;i(g),g&&r({})},e[9]=l,e[10]=i,e[11]=r,e[12]=c,e[13]=E):E=e[13];let S;e[14]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx("span",{className:"text-sm font-medium",children:"All models"}),e[14]=S):S=e[14];let C;e[15]!==l||e[16]!==i||e[17]!==r||e[18]!==c?(C=s.jsx("div",{onClick:hs,children:c?s.jsx(ge,{children:s.jsxs(Te,{children:[s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsx(pe,{checked:l,disabled:!0,onCheckedChange:fs})})}),s.jsx(_e,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(pe,{checked:l,onCheckedChange:g=>{i(g),g&&r({})}})}),e[15]=l,e[16]=i,e[17]=r,e[18]=c,e[19]=C):C=e[19];let v;e[20]!==_||e[21]!==E||e[22]!==C?(v=s.jsxs("div",{className:_,onClick:E,children:[S,C]}),e[20]=_,e[21]=E,e[22]=C,e[23]=v):v=e[23];let I;e[24]!==f||e[25]!==l||e[26]!==x||e[27]!==m||e[28]!==n||e[29]!==c||e[30]!==p?(I=f.length===0?s.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No LLM connections configured"}):f.map(g=>s.jsx(F.Suspense,{fallback:s.jsxs("div",{className:"px-4 py-3 flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(fe,{className:"size-4 animate-spin"}),"Loading models..."]}),children:s.jsx(rs,{connection:g,selectedModels:n[g.id]??[],allowAllModels:l,onToggleModel:p,onExitAllowAll:m,allConnectionModelsSelected:(n[g.id]??[]).includes("*"),searchQuery:x,readOnly:c})},g.id)),e[24]=f,e[25]=l,e[26]=x,e[27]=m,e[28]=n,e[29]=c,e[30]=p,e[31]=I):I=e[31];let R;return e[32]!==I||e[33]!==v?(R=s.jsxs("div",{className:"flex flex-col h-full overflow-auto gap-6 pb-6",children:[v,I]}),e[32]=I,e[33]=v,e[34]=R):R=e[34],R}function fs(){}function hs(t){return t.stopPropagation()}function xs(t){const e=H.c(52),{open:l,onOpenChange:n,selectedMemberIds:i,onAddMembers:r}=t,[d,h]=F.useState(""),c=F.useDeferredValue(d);let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=[],e[0]=x):x=e[0];const[f,a]=F.useState(x),{data:p}=st();let o,m,N,_,E,S,C,v,I,R,g;if(e[1]!==p?.data?.members||e[2]!==c||e[3]!==r||e[4]!==n||e[5]!==l||e[6]!==f||e[7]!==d||e[8]!==i){const U=p?.data?.members??[];let B;e[20]!==c?(B=y=>{const L=c.toLowerCase();return y.user?.name?.toLowerCase().includes(L)||y.user?.email?.toLowerCase().includes(L)},e[20]=c,e[21]=B):B=e[21];const w=U.filter(B);let z;e[22]!==r||e[23]!==n||e[24]!==f?(z=()=>{r(f),a([]),n(!1)},e[22]=r,e[23]=n,e[24]=f,e[25]=z):z=e[25],N=z,m=Ke,R=l,g=n,o=Qe,v="sm:max-w-md p-0",e[26]===Symbol.for("react.memo_cache_sentinel")?(I=s.jsxs(He,{className:"px-6 pt-6",children:[s.jsx(qe,{children:"Add Members to Role"}),s.jsx(Ze,{children:"Select members to add to this role."})]}),e[26]=I):I=e[26],S="flex flex-col h-80",e[27]!==d?(C=s.jsx("div",{className:"border-b border-border px-4 py-3",children:s.jsx(Oe,{value:d,onChange:h,placeholder:"Search members...",className:"w-full"})}),e[27]=d,e[28]=C):C=e[28],_="flex-1 overflow-auto",E=w.length===0?s.jsx("div",{className:"flex items-center justify-center h-full px-6",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:d?"No members found":"No members available"})}):s.jsx("div",{className:"px-6 py-2 space-y-1",children:w.map(y=>{const L=y.role!=="owner",Y=i.includes(y.id),$=f.includes(y.id);return s.jsxs("label",{className:K("flex items-center gap-3 p-2 rounded-lg",!L||Y?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-muted/50"),children:[s.jsx(ve,{checked:$||Y,onCheckedChange:()=>{!L||Y||a(J=>J.includes(y.id)?J.filter(X=>X!==y.id):[...J,y.id])},disabled:!L||Y}),s.jsx(nt,{url:y.user?.image??void 0,fallback:lt(y.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:y.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:y.user?.email})]}),!L&&s.jsx(xe,{variant:"secondary",className:"shrink-0",children:"Owner"}),Y&&L&&s.jsx(xe,{variant:"outline",className:"shrink-0",children:"Added"})]},y.id)})}),e[1]=p?.data?.members,e[2]=c,e[3]=r,e[4]=n,e[5]=l,e[6]=f,e[7]=d,e[8]=i,e[9]=o,e[10]=m,e[11]=N,e[12]=_,e[13]=E,e[14]=S,e[15]=C,e[16]=v,e[17]=I,e[18]=R,e[19]=g}else o=e[9],m=e[10],N=e[11],_=e[12],E=e[13],S=e[14],C=e[15],v=e[16],I=e[17],R=e[18],g=e[19];let O;e[29]!==_||e[30]!==E?(O=s.jsx("div",{className:_,children:E}),e[29]=_,e[30]=E,e[31]=O):O=e[31];let b;e[32]!==O||e[33]!==S||e[34]!==C?(b=s.jsxs("div",{className:S,children:[C,O]}),e[32]=O,e[33]=S,e[34]=C,e[35]=b):b=e[35];let j;e[36]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(Je,{children:"Cancel"}),e[36]=j):j=e[36];const u=f.length===0,M=f.length>0&&`(${f.length})`;let A;e[37]!==N||e[38]!==u||e[39]!==M?(A=s.jsxs(Xe,{className:"px-6 pb-6",children:[j,s.jsxs(We,{onClick:N,disabled:u,children:["Add ",M]})]}),e[37]=N,e[38]=u,e[39]=M,e[40]=A):A=e[40];let k;e[41]!==o||e[42]!==b||e[43]!==A||e[44]!==v||e[45]!==I?(k=s.jsxs(o,{className:v,children:[I,b,A]}),e[41]=o,e[42]=b,e[43]=A,e[44]=v,e[45]=I,e[46]=k):k=e[46];let G;return e[47]!==m||e[48]!==k||e[49]!==R||e[50]!==g?(G=s.jsx(m,{open:R,onOpenChange:g,children:k}),e[47]=m,e[48]=k,e[49]=R,e[50]=g,e[51]=G):G=e[51],G}function ps(t){const e=H.c(29),{memberIds:l,onMemberIdsChange:n,readOnly:i,readOnlyMessage:r,searchQuery:d,addMemberDialogOpen:h,onAddMemberDialogOpenChange:c}=t,x=i===void 0?!1:i,f=r===void 0?"Owner membership cannot be changed":r,a=F.useDeferredValue(d),{data:p}=st();let o,m,N;if(e[0]!==p?.data?.members||e[1]!==a||e[2]!==l||e[3]!==n||e[4]!==x||e[5]!==f||e[6]!==d){const v=p?.data?.members??[];let I;e[10]!==l?(I=b=>l.includes(b.id),e[10]=l,e[11]=I):I=e[11];const R=v.filter(I);let g;e[12]!==a?(g=b=>{const j=a.toLowerCase();return b.user?.name?.toLowerCase().includes(j)||b.user?.email?.toLowerCase().includes(j)},e[12]=a,e[13]=g):g=e[13];const O=R.filter(g);N="flex flex-col h-full",o="flex-1 overflow-auto",m=R.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h3",{className:"text-base font-medium mb-1",children:"No members"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Add members to grant them the configured permissions."})]})}):O.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("p",{className:"text-sm text-muted-foreground",children:['No members match "',d,'"']})}):s.jsx("div",{className:"p-4 space-y-2",children:O.map(b=>s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/30",children:[s.jsx(nt,{url:b.user?.image??void 0,fallback:lt(b.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:b.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:b.user?.email})]}),x?s.jsx(ge,{children:s.jsxs(Te,{children:[s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsx(le,{variant:"ghost",size:"sm",disabled:!0,children:s.jsx(Be,{size:16})})})}),s.jsx(_e,{children:s.jsx("p",{children:f})})]})}):s.jsx(le,{variant:"ghost",size:"sm",onClick:()=>n(l.filter(j=>j!==b.id)),children:s.jsx(Be,{size:16})})]},b.id))}),e[0]=p?.data?.members,e[1]=a,e[2]=l,e[3]=n,e[4]=x,e[5]=f,e[6]=d,e[7]=o,e[8]=m,e[9]=N}else o=e[7],m=e[8],N=e[9];let _;e[14]!==o||e[15]!==m?(_=s.jsx("div",{className:o,children:m}),e[14]=o,e[15]=m,e[16]=_):_=e[16];let E;e[17]!==l||e[18]!==n?(E=v=>n([...l,...v]),e[17]=l,e[18]=n,e[19]=E):E=e[19];let S;e[20]!==h||e[21]!==l||e[22]!==c||e[23]!==E?(S=s.jsx(xs,{open:h,onOpenChange:c,selectedMemberIds:l,onAddMembers:E}),e[20]=h,e[21]=l,e[22]=c,e[23]=E,e[24]=S):S=e[24];let C;return e[25]!==N||e[26]!==_||e[27]!==S?(C=s.jsxs("div",{className:N,children:[_,S]}),e[25]=N,e[26]=_,e[27]=S,e[28]=C):C=e[28],C}function gs(t){const e=H.c(3);let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(fe,{size:24,className:"animate-spin text-muted-foreground"})}),e[0]=l):l=e[0];let n;return e[1]!==t?(n=s.jsx(F.Suspense,{fallback:l,children:s.jsx(ps,{...t})}),e[1]=t,e[2]=n):n=e[2],n}const Ts={owner:[],admin:[],user:[]};function Es(t,e,l,n){const i=t==="owner"||t==="admin";return{role:{id:l?.id,slug:t,label:t.charAt(0).toUpperCase()+t.slice(1)},allowAllStaticPermissions:i,staticPermissions:Ts[t],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:e.filter(r=>r.role===t).map(r=>r.id)}}function _s(t,e,l){const n=t.permission||{},i=n.self||[],r=i.includes("*"),d=r?[]:i.filter(a=>a!=="*"),h={};for(const[a,p]of Object.entries(n))if(!(a==="self"||a==="models"))if(a==="*")for(const o of l)h[o.id]=p.includes("*")?o.tools?.map(m=>m.name)??[]:p;else{const o=l.find(m=>m.id===a);o&&(h[a]=p.includes("*")?o.tools?.map(m=>m.name)??[]:p)}const c=n.models||[],x=c.length===0||c.includes("*:*"),f={};if(!x)for(const a of c){const p=a.indexOf(":");if(p===-1)continue;const o=a.slice(0,p),m=a.slice(p+1);f[o]||(f[o]=[]),f[o].push(m)}return{role:{id:t.id,slug:t.role,label:t.label},allowAllStaticPermissions:r,staticPermissions:d,toolSet:h,allowAllModels:x,modelSet:f,memberIds:e.filter(a=>a.role===t.role).map(a=>a.id)}}function Is(t,e){const l={};t.allowAllStaticPermissions?l.self=["*"]:t.staticPermissions.length>0&&(l.self=t.staticPermissions);for(const[n,i]of Object.entries(t.toolSet))if(i.length>0){const d=e.find(h=>h.id===n)?.tools?.map(h=>h.name)??[];l[n]=d.length>0&&d.every(h=>i.includes(h))?["*"]:i}if(t.allowAllModels)l.models=["*:*"];else{const n=[];for(const[i,r]of Object.entries(t.modelSet))for(const d of r)n.push(`${i}:${d}`);n.length>0&&(l.models=n)}return l}function bs(t,e,l){return t.kind==="builtin"?Es(t.role,e,void 0):t.kind==="custom"?_s(t.role,e,l):{role:{id:void 0,slug:void 0,label:""},allowAllStaticPermissions:!1,staticPermissions:[],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:[]}}function Ns(t){const e=H.c(6),{readOnly:l,readOnlyMessage:n,onOpen:i}=t,r=n===void 0?"Owner membership cannot be changed":n;if(l){let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsxs(le,{variant:"outline",size:"sm",disabled:!0,children:[s.jsx(Se,{size:16}),"Add Member"]})})}),e[0]=c):c=e[0];let x;return e[1]!==r?(x=s.jsx(ge,{children:s.jsxs(Te,{children:[c,s.jsx(_e,{children:s.jsx("p",{children:r})})]})}),e[1]=r,e[2]=x):x=e[2],x}let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Se,{size:16}),e[3]=d):d=e[3];let h;return e[4]!==i?(h=s.jsxs(le,{variant:"outline",size:"sm",onClick:i,children:[d,"Add Member"]}),e[4]=i,e[5]=h):h=e[5],h}function Ss(t){const e=H.c(14),{locator:l}=Ne(),n=Re(),i=yt();let r;e[0]!==l?(r=re.members(l),e[0]=l,e[1]=r):r=e[1];let d;e[2]!==n?(d=()=>n.organization.listMembers(),e[2]=n,e[3]=d):d=e[3];let h;e[4]!==r||e[5]!==d?(h={queryKey:r,queryFn:d},e[4]=r,e[5]=d,e[6]=h):h=e[6];const{data:c,isPending:x}=Ce(h);if(x||!i){let o;return e[7]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(fe,{size:32,className:"animate-spin text-muted-foreground"})})}),e[7]=o):o=e[7],o}let f;e[8]!==c?.data?.members?(f=c?.data?.members??[],e[8]=c?.data?.members,e[9]=f):f=e[9];const a=f;let p;return e[10]!==i||e[11]!==a||e[12]!==t?(p=s.jsx(Cs,{...t,members:a,connections:i}),e[10]=i,e[11]=a,e[12]=t,e[13]=p):p=e[13],p}function Cs({target:t,onBack:e,onSaved:l,members:n,connections:i}){const{locator:r}=Ne(),d=Re(),h=ze(),c=t.kind==="builtin",x=t.kind==="builtin"&&t.role==="owner",f=t.kind==="new",[a,p]=F.useState(c?"org":"mcp"),o=dt({resolver:mt(Qt),defaultValues:bs(t,n,i)}),m=o.formState.isValid,N=o.formState.isDirty,_=Ye({mutationFn:async u=>{const M=Is(u,i),A=u.role.slug||u.role.label.toLowerCase().replace(/\s+/g,"-"),k=(u.role.slug==="owner"||u.role.slug==="admin"||u.role.slug==="user")&&!u.role.id,G=async(U,B)=>{const w=n.filter(L=>L.role===(B??U)).map(L=>L.id),z=u.memberIds.filter(L=>!w.includes(L)),y=w.filter(L=>!u.memberIds.includes(L));for(const L of z){const Y=await d.organization.updateMemberRole({memberId:L,role:[U]});if(Y?.error)throw new Error(Y.error.message??"Something went wrong")}for(const L of y){const Y=await d.organization.updateMemberRole({memberId:L,role:["user"]});if(Y?.error)throw new Error(Y.error.message??"Something went wrong")}};if(k)return await G(u.role.slug),u;if(u.role.id){const U=u.role.label.toLowerCase().replace(/\s+/g,"-"),B=u.role.slug,w=U!==B,z=await d.organization.updateRole({roleId:u.role.id,data:{permission:M,...w?{roleName:U}:{}}});if(z?.error)throw new Error(z.error.message??"Something went wrong");return await G(w?U:B,w?B:void 0),w?{...u,role:{...u.role,slug:U}}:u}else{const U=await d.organization.createRole({role:A,permission:M});if(U?.error)throw new Error(U.error.message??"Something went wrong");for(const B of u.memberIds){const w=await d.organization.updateMemberRole({memberId:B,role:[A]});if(w?.error)throw new Error(w.error.message)}return{...u,role:{...u.role,id:U.data?.roleData?.id,slug:A}}}},onSuccess:(u,M)=>{h.invalidateQueries({queryKey:re.members(r)}),h.invalidateQueries({queryKey:re.organizationRoles(r)});const A=!M.role.id&&!M.role.slug,k=M.role.slug==="owner"&&!M.role.id;Ae(k?"role_members_updated":A?"role_created":"role_updated",{role_slug:M.role.slug??null}),he.success(k?"Members updated successfully!":A?"Role created successfully!":"Role updated successfully!"),o.reset(u),l(u.role.id)},onError:u=>{he.error(u instanceof Error?u.message:"Failed to save role")}}),E=o.handleSubmit(u=>{if(!u.role.label.trim()){he.error("Role name is required"),o.setFocus("role.label");return}_.mutate(u)}),S=!x,C=t.kind==="builtin"?t.role.charAt(0).toUpperCase()+t.role.slice(1):t.kind==="custom"?t.role.label:"",v=[...x?[]:[{id:"mcp",label:"MCP Permissions"}],{id:"org",label:"Organization Permissions"},{id:"models",label:"Models"},{id:"members",label:"Members"}],[I,R]=F.useState(""),[g,O]=F.useState(!1),b=u=>{p(u),R("")},j={mcp:"Search MCP servers...",org:"Search permissions...",models:"Search models...",members:"Search members..."};return s.jsx(te,{children:s.jsxs(te.Content,{className:K("flex flex-col",a!=="org"&&"overflow-hidden"),children:[s.jsx("div",{className:"shrink-0 mx-auto w-full max-w-[1200px] px-4 md:px-10 pt-8 md:pt-12 pb-4",children:s.jsxs("div",{className:"flex flex-col gap-5",children:[s.jsx(te.Title,{actions:S&&s.jsxs(s.Fragment,{children:[s.jsx(le,{variant:"outline",size:"sm",onClick:e,disabled:_.isPending,children:"Cancel"}),s.jsx(le,{size:"sm",onClick:E,disabled:_.isPending||!m||!N,children:_.isPending?"Saving...":f?"Create Role":"Save Changes"})]}),children:s.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[s.jsx("div",{className:K("size-2.5 rounded-full shrink-0",t.kind==="builtin"?$e(t.role,!0):gt(o.watch("role.label")))}),x&&s.jsx(Fe,{size:16,className:"text-muted-foreground shrink-0"}),f||t.kind==="custom"?s.jsx("input",{...o.register("role.label"),placeholder:"Role name",className:"leading-tight text-foreground bg-transparent border-none outline-none px-1 -mx-1 rounded hover:bg-input/25 focus:bg-input/25 transition-colors w-64 placeholder:text-muted-foreground/50",autoFocus:f}):s.jsx("span",{className:"truncate",children:C})]})}),s.jsx("div",{className:"flex items-center gap-2",children:v.map(u=>s.jsx("button",{type:"button",onClick:()=>b(u.id),className:K("h-7 px-2 text-sm rounded-lg border border-input transition-colors inline-flex items-center",a===u.id?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:u.label},u.id))}),s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx(Oe,{value:I,onChange:R,placeholder:j[a]??"Search...",className:"w-full md:w-[375px]"}),a==="members"&&s.jsx(Ns,{readOnly:t.kind==="builtin"&&t.role==="owner",onOpen:()=>O(!0)})]})]})}),s.jsx("div",{className:K("mx-auto w-full max-w-[1200px] px-4 md:px-10 pb-6",a!=="org"&&"flex-1 min-h-0"),children:s.jsxs("div",{className:K(a!=="org"&&"h-full overflow-hidden",a!=="models"&&a!=="org"&&"border border-border rounded-xl bg-card"),children:[a==="mcp"&&!x&&s.jsx(Kt,{toolSet:o.watch("toolSet"),onToolSetChange:u=>o.setValue("toolSet",u,{shouldDirty:!0}),searchQuery:I}),a==="org"&&s.jsx(Ht,{allowAllStaticPermissions:o.watch("allowAllStaticPermissions"),staticPermissions:o.watch("staticPermissions"),onAllowAllChange:u=>o.setValue("allowAllStaticPermissions",u,{shouldDirty:!0}),onPermissionsChange:u=>o.setValue("staticPermissions",u,{shouldDirty:!0}),readOnly:x,searchQuery:I}),a==="models"&&s.jsx(us,{allowAllModels:o.watch("allowAllModels"),modelSet:o.watch("modelSet"),onAllowAllChange:u=>o.setValue("allowAllModels",u,{shouldDirty:!0}),onModelSetChange:u=>o.setValue("modelSet",u,{shouldDirty:!0}),readOnly:x,searchQuery:I}),a==="members"&&s.jsx(gs,{memberIds:o.watch("memberIds"),onMemberIdsChange:u=>o.setValue("memberIds",u,{shouldDirty:!0}),readOnly:t.kind==="builtin"&&(t.role==="owner"||t.role==="user"),readOnlyMessage:t.kind==="builtin"&&t.role==="user"?"User is the default role — members can't be removed from it; assign another role to change their access":"Owner membership cannot be changed",searchQuery:I,addMemberDialogOpen:g,onAddMemberDialogOpenChange:O})]})})]})})}function As(t){return t.kind==="builtin"?`builtin-${t.role}`:t.kind==="custom"?`custom-${t.role.id}`:"new"}function Rs(t){const e=H.c(6),{area:l,children:n}=t,{isPrivileged:i,loading:r,error:d}=Dt();let h;return e[0]!==l||e[1]!==n||e[2]!==d||e[3]!==i||e[4]!==r?(h=s.jsx(kt,{granted:i,loading:r,error:d,area:l,children:n}),e[0]=l,e[1]=n,e[2]=d,e[3]=i,e[4]=r,e[5]=h):h=e[5],h}const Os=[{role:"owner",label:"Owner"},{role:"admin",label:"Admin"},{role:"user",label:"User"}];function js(){const t=H.c(77),[e,l]=F.useState(""),[n,i]=F.useState(null),r=ht();let d;t[0]===Symbol.for("react.memo_cache_sentinel")?(d={strict:!1},t[0]=d):d=t[0];const{role:h}=xt(d),{locator:c}=Ne(),x=Re(),f=ze(),{customRoles:a,refetch:p}=pt();let o;t[1]!==r?(o=P=>r({to:".",search:V=>({...V,role:P})}),t[1]=r,t[2]=o):o=t[2];const m=o;let N;e:{if(!h){N=null;break e}if(h==="new"){N={kind:"new"};break e}if(h.startsWith("builtin-")){N={kind:"builtin",role:h.slice(8)};break e}let P;t[3]!==h?(P=ae=>ae.id===h,t[3]=h,t[4]=P):P=t[4];const V=a.find(P);N=V?{kind:"custom",role:V}:null}const _=N;let E;t[5]!==c?(E=re.members(c),t[5]=c,t[6]=E):E=t[6];let S;t[7]!==x?(S=()=>x.organization.listMembers(),t[7]=x,t[8]=S):S=t[8];let C;t[9]!==E||t[10]!==S?(C={queryKey:E,queryFn:S},t[9]=E,t[10]=S,t[11]=C):C=t[11];const{data:v}=Ce(C);let I;t[12]!==v?.data?.members?(I=v?.data?.members??[],t[12]=v?.data?.members,t[13]=I):I=t[13];const R=I;let g;t[14]!==R?(g=P=>R.filter(V=>V.role===P).length,t[14]=R,t[15]=g):g=t[15];const O=g;let b;if(t[16]!==a||t[17]!==O||t[18]!==e){let P;t[20]!==O?(P=ce=>({kind:"builtin",role:{...ce,memberCount:O(ce.role)}}),t[20]=O,t[21]=P):P=t[21];const V=Os.map(P);let ae;t[22]!==O?(ae=ce=>({kind:"custom",role:{...ce,memberCount:O(ce.role)}}),t[22]=O,t[23]=ae):ae=t[23];const rt=a.map(ae);if(b=[...V,...rt],e){const ce=e.toLowerCase();b=b.filter(at=>at.role.label.toLowerCase().includes(ce))}t[16]=a,t[17]=O,t[18]=e,t[19]=b}else b=t[19];let j;t[24]!==x?(j=async P=>{const V=await x.organization.deleteRole({roleId:P});if(V?.error)throw new Error(V.error.message);return V?.data},t[24]=x,t[25]=j):j=t[25];const u=Ye({mutationFn:j,onSuccess:(P,V)=>{Ae("role_deleted",{role_id:V}),f.invalidateQueries({queryKey:re.members(c)}),f.invalidateQueries({queryKey:re.organizationRoles(c)}),he.success("Role deleted successfully!"),p(),_?.kind==="custom"&&_.role.id===V&&m(void 0)},onError:Ds});let M,A,k,G;t[26]===Symbol.for("react.memo_cache_sentinel")?(G={id:"role",header:"Role",render:Ps,cellClassName:"flex-1 min-w-0",sortable:!0},M={id:"type",header:"Type",render:Ls,cellClassName:"w-28 shrink-0"},A={id:"permissions",header:"Permissions",render:ws,cellClassName:"flex-1 min-w-0"},k={id:"members",header:"Members",render:Ms,cellClassName:"w-24 shrink-0"},t[26]=M,t[27]=A,t[28]=k,t[29]=G):(M=t[26],A=t[27],k=t[28],G=t[29]);let U;t[30]===Symbol.for("react.memo_cache_sentinel")?(U=[G,M,A,k,{id:"actions",header:"",render:P=>P.kind==="builtin"?null:s.jsxs(Tt,{children:[s.jsx(Et,{asChild:!0,children:s.jsx(le,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:ys,children:s.jsx(bt,{size:16})})}),s.jsx(_t,{align:"end",onClick:vs,children:s.jsxs(It,{variant:"destructive",onClick:()=>{const V=P.role;V.id&&i({id:V.id,label:V.label})},children:[s.jsx(Nt,{size:16}),"Delete"]})})]}),cellClassName:"w-12 shrink-0"}],t[30]=U):U=t[30];const B=U;let w;t[31]!==m?(w=P=>{if(P.kind==="builtin")m(`builtin-${P.role.role}`);else{const V=P.role;m(V.id)}},t[31]=m,t[32]=w):w=t[32];const z=w;if(_){let P;t[33]!==m?(P=()=>m(void 0),t[33]=m,t[34]=P):P=t[34];let V;return t[35]!==p||t[36]!==m?(V=()=>{p(),m(void 0)},t[35]=p,t[36]=m,t[37]=V):V=t[37],s.jsx(Ss,{target:_,onBack:P,onSaved:V},As(_))}let y;t[38]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(te.Title,{children:"Roles"}),t[38]=y):y=t[38];let L;t[39]===Symbol.for("react.memo_cache_sentinel")?(L=P=>{P.key==="Escape"&&(l(""),P.target.blur())},t[39]=L):L=t[39];let Y;t[40]!==e?(Y=s.jsx(Oe,{value:e,onChange:l,placeholder:"Search roles...",className:"w-full md:w-[375px]",onKeyDown:L}),t[40]=e,t[41]=Y):Y=t[41];let $;t[42]!==m?($=()=>m("new"),t[42]=m,t[43]=$):$=t[43];let J;t[44]===Symbol.for("react.memo_cache_sentinel")?(J=s.jsx(Se,{size:16}),t[44]=J):J=t[44];let X;t[45]!==$?(X=s.jsxs(le,{onClick:$,children:[J,"Create Role"]}),t[45]=$,t[46]=X):X=t[46];let ne;t[47]!==Y||t[48]!==X?(ne=s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[Y,X]}),t[47]=Y,t[48]=X,t[49]=ne):ne=t[49];let oe;t[50]!==e?(oe=e?s.jsx(De,{title:"No roles found",description:`No roles match "${e}"`}):s.jsx(De,{title:"No roles",description:"Create a role to get started."}),t[50]=e,t[51]=oe):oe=t[51];let ie;t[52]!==b||t[53]!==B||t[54]!==z||t[55]!==oe?(ie=s.jsx(St,{columns:B,data:b,isLoading:!1,onRowClick:z,emptyState:oe}),t[52]=b,t[53]=B,t[54]=z,t[55]=oe,t[56]=ie):ie=t[56];let T;t[57]!==ne||t[58]!==ie?(T=s.jsx(te.Content,{children:s.jsx(te.Body,{children:s.jsxs("div",{className:"flex flex-col gap-6",children:[y,ne,ie]})})}),t[57]=ne,t[58]=ie,t[59]=T):T=t[59];const D=n!==null;let Q;t[60]===Symbol.for("react.memo_cache_sentinel")?(Q=P=>!P&&i(null),t[60]=Q):Q=t[60];let q;t[61]===Symbol.for("react.memo_cache_sentinel")?(q=s.jsx(qe,{children:"Delete Role"}),t[61]=q):q=t[61];const W=n?.label;let Z;t[62]!==W?(Z=s.jsxs(He,{children:[q,s.jsxs(Ze,{children:['Are you sure you want to delete the "',W,'" role? This action cannot be undone.']})]}),t[62]=W,t[63]=Z):Z=t[63];let ee;t[64]===Symbol.for("react.memo_cache_sentinel")?(ee=s.jsx(Je,{children:"Cancel"}),t[64]=ee):ee=t[64];let de;t[65]!==u||t[66]!==n?(de=s.jsxs(Xe,{children:[ee,s.jsx(We,{onClick:()=>{n?.id&&u.mutate(n.id),i(null)},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[65]=u,t[66]=n,t[67]=de):de=t[67];let me;t[68]!==Z||t[69]!==de?(me=s.jsxs(Qe,{children:[Z,de]}),t[68]=Z,t[69]=de,t[70]=me):me=t[70];let ue;t[71]!==D||t[72]!==me?(ue=s.jsx(Ke,{open:D,onOpenChange:Q,children:me}),t[71]=D,t[72]=me,t[73]=ue):ue=t[73];let Ie;return t[74]!==T||t[75]!==ue?(Ie=s.jsxs(te,{children:[T,ue]}),t[74]=T,t[75]=ue,t[76]=Ie):Ie=t[76],Ie}function vs(t){return t.stopPropagation()}function ys(t){return t.stopPropagation()}function Ms(t){return s.jsx("span",{className:"text-sm text-foreground",children:t.role.memberCount})}function ws(t){if(t.kind==="builtin")return t.role.role==="owner"||t.role.role==="admin"?s.jsx("span",{className:"text-sm text-muted-foreground",children:"Full access"}):s.jsx("span",{className:"text-sm text-muted-foreground",children:"Basic access"});const e=t.role,l=[];return e.allowsAllStaticPermissions?l.push("Full org access"):e.staticPermissionCount&&e.staticPermissionCount>0&&l.push(`${e.staticPermissionCount} org perm${e.staticPermissionCount!==1?"s":""}`),e.allowsAllConnections?l.push("All connections"):e.connectionCount&&e.connectionCount>0&&l.push(`${e.connectionCount} connection${e.connectionCount!==1?"s":""}`),s.jsx("span",{className:"text-sm text-muted-foreground truncate",children:l.length>0?l.join(", "):"No permissions"})}function Ls(t){return t.kind==="builtin"?s.jsx(xe,{variant:"secondary",className:"text-xs",children:"Built-in"}):s.jsx(xe,{variant:"outline",className:"text-xs",children:"Custom"})}function Ps(t){return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:K("size-2.5 rounded-full shrink-0",$e(t.role.role,t.kind==="builtin"))}),s.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:t.role.label}),t.kind==="builtin"&&s.jsx(Fe,{size:12,className:"text-muted-foreground shrink-0"})]})}function Ds(t,e){Ae("role_delete_failed",{role_id:e,error:t instanceof Error?t.message:String(t)}),he.error(t instanceof Error?t.message:"Failed to delete role")}function ks(){const t=H.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx("div",{className:"text-sm text-muted-foreground",children:"Failed to load roles"})})}),t[0]=e):e=t[0];let l;return t[1]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(ft,{fallback:e,children:s.jsx(F.Suspense,{fallback:s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(fe,{size:32,className:"animate-spin text-muted-foreground"})})}),children:s.jsx(js,{})})}),t[1]=l):l=t[1],l}function _n(){const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(Rs,{area:"roles",children:s.jsx(ks,{})}),t[0]=e):e=t[0],e}export{_n as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as p,j as t,E as P,r as j,w,B as S,t as y}from"./index-DF3zg-P1.js";import{i as k}from"./AlertCircle-B6AELEdc.js";import{s as z}from"./Plus-DWjKZ2wj.js";import{s as E}from"./User01-v0Bqr3nA.js";import{t as F}from"./Users01-CPNZ7uMu.js";import{e as $,d as I,D as O,a as A,h as R,c as T}from"./dialog-CmXDzme5.js";import{I as N}from"./input-BZTiU0ds.js";import{L as g}from"./label-B1OfKy2N.js";import{S as B,a as V,b as L,c as q,d as C}from"./select-B6GE4jHJ.js";import{S as H}from"./skeleton-BGZh750P.js";import{T as K}from"./textarea-PYu4eHQV.js";import{P as b}from"./index-CeqD0RVV.js";import{c as W}from"./settings-section-DS6otYn7.js";import{u as Y,a as G}from"./use-secrets-C1Fme0Ya.js";import{R as J}from"./require-capability-CEBGt_Ot.js";import"./X-Dm6kY_ek.js";import"./tooltip-O3iHy7-o.js";import"./Check-BF3t7WWi.js";import"./ChevronDown-CQLSXgt3.js";import"./ChevronUp-Y-IpPAUR.js";import"./sidebar-BFdShy9x.js";import"./LayoutLeft-C0g0LezP.js";import"./use-mobile-nauPjzo2.js";import"./card-dLLzWD0r.js";import"./ArrowUpRight-BKVLcZTe.js";import"./studio-tools-bThaob6p.js";import"./use-capability--WeMT0KP.js";import"./access-gate-CPecvlS5.js";import"./capability-load-error-B9xkkNBq.js";function M(s){const e=p.c(3),{error:r}=s;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(k,{size:16}),e[0]=c):c=e[0];let n;return e[1]!==r.message?(n=t.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[c,t.jsxs("span",{className:"text-sm font-medium",children:["Failed to load secrets: ",r.message]})]}),e[1]=r.message,e[2]=n):n=e[2],n}function Q(s){const e=p.c(5),{scope:r}=s,c=r==="user"?E:F,n=r==="user"?"Private":"Organization";let i;e[0]!==c?(i=t.jsx(c,{size:12}),e[0]=c,e[1]=i):i=e[1];let a;return e[2]!==n||e[3]!==i?(a=t.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-md bg-muted text-muted-foreground text-xs",children:[i,n]}),e[2]=n,e[3]=i,e[4]=a):a=e[4],a}function D(s){const e=p.c(20),{secret:r}=s;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"size-9 rounded-md bg-muted flex items-center justify-center shrink-0",children:t.jsx(w,{size:16,className:"text-muted-foreground"})}),e[0]=c):c=e[0];let n;e[1]!==r.name?(n=t.jsx("span",{className:"font-medium text-sm truncate",children:r.name}),e[1]=r.name,e[2]=n):n=e[2];let i;e[3]!==r.scope?(i=t.jsx(Q,{scope:r.scope}),e[3]=r.scope,e[4]=i):i=e[4];let a;e[5]!==n||e[6]!==i?(a=t.jsxs("div",{className:"flex items-center gap-2",children:[n,i]}),e[5]=n,e[6]=i,e[7]=a):a=e[7];let d;e[8]!==r.description?(d=r.description?t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:r.description}):null,e[8]=r.description,e[9]=d):d=e[9];let u;e[10]!==a||e[11]!==d?(u=t.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[c,t.jsxs("div",{className:"min-w-0",children:[a,d]})]}),e[10]=a,e[11]=d,e[12]=u):u=e[12];let l;e[13]!==r.createdAt?(l=new Date(r.createdAt).toLocaleDateString(),e[13]=r.createdAt,e[14]=l):l=e[14];let o;e[15]!==l?(o=t.jsx("div",{className:"text-xs text-muted-foreground shrink-0",children:l}),e[15]=l,e[16]=o):o=e[16];let x;return e[17]!==u||e[18]!==o?(x=t.jsxs("div",{className:"flex items-start justify-between gap-4 py-3 border-b border-border/60 last:border-b-0",children:[u,o]}),e[17]=u,e[18]=o,e[19]=x):x=e[19],x}function U(s){const e=p.c(5),{onCreate:r}=s;let c,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"size-12 rounded-full bg-muted flex items-center justify-center",children:t.jsx(w,{size:20,className:"text-muted-foreground"})}),n=t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-sm",children:"No secrets yet"}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:"Store API keys, tokens, and other sensitive values. Values are encrypted at rest and never returned over the API."})]}),e[0]=c,e[1]=n):(c=e[0],n=e[1]);let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(z,{size:14}),e[2]=i):i=e[2];let a;return e[3]!==r?(a=t.jsxs("div",{className:"rounded-2xl border border-dashed border-border/60 p-10 flex flex-col items-center justify-center text-center gap-3",children:[c,n,t.jsxs(S,{onClick:r,size:"sm",className:"mt-2",children:[i,"New secret"]})]}),e[3]=r,e[4]=a):a=e[4],a}function _({open:s,onOpenChange:e}){const[r,c]=j.useState("organization"),[n,i]=j.useState(""),[a,d]=j.useState(""),[u,l]=j.useState(""),o=G();function x(){c("organization"),i(""),d(""),l("")}function f(){x(),e(!1)}async function h(m){if(m.preventDefault(),!(!n.trim()||!a))try{await o.mutateAsync({scope:r,name:n.trim(),value:a,description:u.trim()||void 0}),y.success(`Secret "${n.trim()}" created`),f()}catch(v){y.error(v instanceof Error?v.message:"Failed to create secret")}}return t.jsx($,{open:s,onOpenChange:m=>{m?e(m):f()},children:t.jsxs(I,{className:"sm:max-w-lg",children:[t.jsxs(O,{children:[t.jsx(A,{children:"New secret"}),t.jsx(R,{children:"Stored encrypted in the credential vault. Choose who can read it."})]}),t.jsxs("form",{onSubmit:h,className:"space-y-4",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-scope",children:"Scope"}),t.jsxs(B,{value:r,onValueChange:m=>c(m),children:[t.jsx(V,{id:"secret-scope",children:t.jsx(L,{})}),t.jsxs(q,{children:[t.jsx(C,{value:"organization",children:"Organization — visible to all members"}),t.jsx(C,{value:"user",children:"Private — only visible to me"})]})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-name",children:"Name"}),t.jsx(N,{id:"secret-name",value:n,onChange:m=>i(m.target.value),placeholder:"STRIPE_API_KEY",autoComplete:"off",required:!0}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Letters, digits, underscore, dot, hyphen. Case-insensitive within its scope."})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-value",children:"Value"}),t.jsx(N,{id:"secret-value",type:"password",value:a,onChange:m=>d(m.target.value),autoComplete:"new-password",required:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-description",children:"Description (optional)"}),t.jsx(K,{id:"secret-description",value:u,onChange:m=>l(m.target.value),rows:2,placeholder:"What is this secret used for?"})]}),t.jsxs(T,{children:[t.jsx(S,{type:"button",variant:"outline",onClick:f,disabled:o.isPending,children:"Cancel"}),t.jsx(S,{type:"submit",disabled:o.isPending||!n.trim()||!a,children:o.isPending?"Creating…":"Create secret"})]})]})]})})}function X(){const s=p.c(21),e=Y(),[r,c]=j.useState(!1);if(e.length===0){let l;s[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(U,{onCreate:()=>c(!0)}),s[0]=l):l=s[0];let o;return s[1]!==r?(o=t.jsxs(t.Fragment,{children:[l,t.jsx(_,{open:r,onOpenChange:c})]}),s[1]=r,s[2]=o):o=s[2],o}let n,i,a;if(s[3]!==e){const l=e.filter(se),o=e.filter(te),x=e.length===1?"":"s";let f;s[7]!==e.length||s[8]!==x?(f=t.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.length," secret",x," stored"]}),s[7]=e.length,s[8]=x,s[9]=f):f=s[9];let h;s[10]===Symbol.for("react.memo_cache_sentinel")?(h=()=>c(!0),s[10]=h):h=s[10];let m;s[11]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs(S,{onClick:h,size:"sm",children:[t.jsx(z,{size:14}),"New secret"]}),s[11]=m):m=s[11],s[12]!==f?(n=t.jsxs("div",{className:"flex items-center justify-between",children:[f,m]}),s[12]=f,s[13]=n):n=s[13],i=l.length>0?t.jsxs("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:[t.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Organization"}),t.jsx("div",{children:l.map(ee)})]}):null,a=o.length>0?t.jsxs("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:[t.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Private to me"}),t.jsx("div",{children:o.map(Z)})]}):null,s[3]=e,s[4]=n,s[5]=i,s[6]=a}else n=s[4],i=s[5],a=s[6];let d;s[14]!==r?(d=t.jsx(_,{open:r,onOpenChange:c}),s[14]=r,s[15]=d):d=s[15];let u;return s[16]!==n||s[17]!==i||s[18]!==a||s[19]!==d?(u=t.jsxs(t.Fragment,{children:[n,i,a,d]}),s[16]=n,s[17]=i,s[18]=a,s[19]=d,s[20]=u):u=s[20],u}function Z(s){return t.jsx(D,{secret:s},s.id)}function ee(s){return t.jsx(D,{secret:s},s.id)}function te(s){return s.scope==="user"}function se(s){return s.scope==="organization"}function re(){const s=p.c(2);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(b.Title,{children:"Secrets"}),s[0]=e):e=s[0];let r;return s[1]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(b,{children:t.jsx(b.Content,{children:t.jsx(b.Body,{children:t.jsxs(W,{children:[e,t.jsx(P,{fallback:ne,children:t.jsx(j.Suspense,{fallback:t.jsx(H,{className:"h-32 w-full"}),children:t.jsx(X,{})})})]})})})}),s[1]=r):r=s[1],r}function ne(s){const{error:e}=s;return t.jsx(M,{error:e??new Error("Failed to load secrets")})}function Ie(){const s=p.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(J,{capability:"secrets:manage",area:"secrets",children:t.jsx(re,{})}),s[0]=e):e=s[0],e}export{Ie as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{c as He,r as w,l as Ee,j as n,B as We,i as Hn,n as Ss,t as G,K as xs}from"./index-DF3zg-P1.js";import{X as bs,Y as ys,Z as _s,K as Un,L as zt,M as Gn,P as Wn,i as qn,_ as js,F as Yn,H as Jn,$ as ks,G as ws,a0 as Rs,N as Qn,O as Rt,T as Xn,U as Zn,Q as ea,R as ta,a1 as na,a2 as Ns,a3 as Nt,a4 as Ds,S as aa,a5 as tt,a6 as Cs,a7 as Vs,a8 as Ts,e as Ps,k as As,a9 as Ms,aa as Es,ab as Ks,ac as $s,r as Ot,ad as Bt,ae as Os,af as ut,ag as jt,ah as Bs,ai as Ls,aj as Je,ak as Vn,al as Fs,am as Tn,an as kt,ao as Lt,ap as Is,aq as sn,ar as zs,as as xt,at as Hs,au as Us,av as Gs,aw as Ws,ax as qs,ay as dt,az as Ys,aA as Js,aB as Qs,aC as Pn,aD as wt,m as Xs,aE as Zs,aF as er,aG as tr,aH as nr,aI as rn,aJ as An,aK as Mn,aL as bt,aM as Ft,aN as En,aO as ar,aP as sr,aQ as on,aR as rr,aS as or,aT as Kn,aU as ir}from"./index-DonY639O.js";import{t as lr}from"./ChevronDown-CQLSXgt3.js";import{b as sa,n as ra}from"./UserPlus01-D2pAl0t2.js";import{i as oa}from"./ChevronRight-Fgy0rUS_.js";import{n as cr}from"./ChevronUp-Y-IpPAUR.js";import{R as cn,x as ur,S as dr,T as mr}from"./agent-icon-DmIJ53uv.js";import{i as fr}from"./Globe01-B52VKYy7.js";import{A as It}from"./automation-runs-yMzfgCqo.js";import{b as mt,T as ft,a as pt}from"./tooltip-O3iHy7-o.js";import{a as pr,D as hr,h as gr,c as vr,d as Sr,e as xr}from"./dialog-CmXDzme5.js";import{I as br}from"./input-BZTiU0ds.js";import{a as ia}from"./Copy01-B0CQRE_5.js";import{b as yr}from"./ZoomOut-_psBJlXD.js";import{i as _r}from"./Settings02-CM0Uzs0U.js";import{s as jr}from"./Eye-CLtdCpUf.js";import{s as la}from"./Flag01-B_AKNFoc.js";import{s as un}from"./Plus-DWjKZ2wj.js";import{s as ca}from"./Trash01-DEWgFvvg.js";import{i as kr}from"./Zap-CNRURtEh.js";import{d as it,a as ua,D as da,c as ma,j as wr}from"./dropdown-menu-BgNr7tM1.js";import{S as Rr,r as $n,a as Nr,d as Dr,b as Cr,i as Vr,f as Tr,P as Pr,c as Ar}from"./page-seo-form-DsaBxdUW.js";import{b as Mr}from"./Tool01-4pit7qOS.js";import{A as Er}from"./add-section-modal-CcLBxmBX.js";import"./ArrowUp-YK2fJPgi.js";import"./chat-context-CyCuyn4t.js";import"./autosend-D_-616qs.js";import"./hooks-QHrmNjJQ.js";import"./use-mcp-client-DrROXOcH.js";import"./constants-BHDe7bIw.js";import"./auth-dSVlMQ86.js";import"./decopilot-sse-pool-DHojW3EC.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./studio-tools-bThaob6p.js";import"./use-virtual-mcp-C964oRwj.js";import"./use-collections-K1HyCAfG.js";import"./use-ai-providers-B4nhSJlr.js";import"./location-BpLtHjTZ.js";import"./tab-id-BijBBRwE.js";import"./use-decopilot-events-BEOY-_n2.js";import"./use-organization-settings-BJ1bjHsL.js";import"./drawer-Ds-r7525.js";import"./collection-search-C4jDpdZf.js";import"./SearchMd-CKteZWzZ.js";import"./use-mobile-nauPjzo2.js";import"./AreaChart-fCNs67j_.js";import"./index-BjO8A-VO.js";import"./X-Dm6kY_ek.js";import"./shell-layout-Bo6QxW8m.js";import"./avatar-UXZ4R5Yb.js";import"./User01-v0Bqr3nA.js";import"./Users03-WVYBBENu.js";import"./SearchLg-DBOWvxyl.js";import"./Stars02-DBH33Ez2.js";import"./XClose-DnNyN9T-.js";import"./CheckCircle-BfxYbuVE.js";import"./FilterLines-DeiGsRZY.js";import"./required-auth-layout-vPZ2d-Yx.js";import"./use-org-sso-j8hZyqdO.js";import"./ZapSquare-Dj8pa8Fg.js";import"./Check-BF3t7WWi.js";import"./Star01-B-8espqJ.js";import"./Image01-B-FQwXx8.js";import"./Upload01-C8RP0Fvq.js";import"./AlertCircle-B6AELEdc.js";import"./form-x0k-kdB2.js";import"./label-B1OfKy2N.js";import"./select-B6GE4jHJ.js";import"./XCircle-cwYbcP7y.js";import"./tabs-D-6eQ0wE.js";import"./Tool02-tJKj7JcW.js";import"./toggle-group-BcxqPGrf.js";import"./use-deco-credits-Bm-VH5Hm.js";import"./extract-connection-data-CK9iLAoG.js";import"./connection-card-CtY9PRIw.js";import"./use-registry-connections-D94L7VqK.js";import"./use-connection-twfWXxwG.js";import"./useInfiniteQuery-DKhJHTs2.js";import"./use-infinite-scroll-Dt7gLdpr.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./card-dLLzWD0r.js";import"./integration-icon-BfKWLZT4.js";import"./textarea-PYu4eHQV.js";import"./connection-form-helpers-TGmycj7X.js";import"./authenticate-and-persist-oauth-BHT9Kp62.js";import"./mcp-oauth-CoKzxQiz.js";import"./collection-tabs-DvvibY6H.js";import"./badge-CfAmvo-h.js";import"./useSuspenseInfiniteQuery-DAAXTkZt.js";import"./Monitor01-BkDBzdlH.js";import"./connect-desktop-dialog-CPSwwSyz.js";import"./select-model-CebmAt-C.js";import"./checkbox-CxV2vfbv.js";import"./skeleton-BGZh750P.js";import"./Key01-myvTSA8u.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-DS6otYn7.js";import"./ArrowUpRight-BKVLcZTe.js";import"./Stars01-DsfblQf3.js";import"./command-EQNrbniG.js";import"./index-CUVgjm02.js";import"./popover-BzHpXFL_.js";import"./index-BCiDnhhX.js";import"./Palette-BiKqXWvc.js";import"./alert-dialog-3VMQ65hF.js";import"./file-type-icon-DjNFZnTs.js";import"./toolbar-D90MFc80.js";import"./Package-eNacrLmv.js";import"./use-debounced-value-xN0eyoO9.js";import"./LinkExternal01-d9EixhiS.js";import"./index-cG8paP3z.js";import"./LayoutLeft-C0g0LezP.js";import"./DotsVertical-CYU3Mae1.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-B1YKt2sD.js";import"./empty-state-CdKwtMyP.js";import"./use-mcp-tools-D28ox9dJ.js";import"./use-capability--WeMT0KP.js";import"./toolbar-icon-button-D3m9VnTI.js";import"./Play-CdkPhmTs.js";import"./use-debounced-autosave-BdWGMbok.js";import"./index-CeqD0RVV.js";import"./sidebar-BFdShy9x.js";import"./search-input-ByuB0YyC.js";import"./use-mcp-auth-status-C7G9bAkb.js";import"./switch-C2KH_TaK.js";import"./use-registry-app-CeyrXTI4.js";import"./github-repo-picker-C-tZ-Bba.js";import"./use-navigate-to-agent-BJC_x779.js";import"./reusable-new-chat-CouMjkYR.js";import"./provision-repo-scoped-github-connection-2iDn-wQ1.js";import"./github-repo-scope-DjMZbiKa.js";import"./Users01-CPNZ7uMu.js";import"./use-secrets-C1Fme0Ya.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./companions-core-fc2Z_sCB.js";import"./format-time-BnbuEtat.js";import"./TrendUp01-7N_6K3-X.js";import"./index-DKadkG06.js";import"./get-initials-D-f_fDFw.js";import"./List-DZAsltZv.js";import"./use-members-mvfsRjey.js";import"./use-org-auth-client-jU0nDPT-.js";import"./Circle-0HId1SV6.js";import"./calendar-BdMqQsTv.js";import"./use-copy-DQ4y4418.js";import"./SwitchHorizontal01-DUrn8gXV.js";import"./monaco-editor-BzdwB2U8.js";import"./use-file-configs-Bs9N4w-Z.js";import"./use-automations-C01orYPa.js";import"./automation-list-row-PkSpkeID.js";import"./Globe04-B0las6Jv.js";import"./HardDrive-CU-vvmKE.js";import"./Sun-MvOAGgKN.js";import"./Shield01-aDvWVv5Z.js";import"./table-XKbQ5Wjx.js";import"./use-clock-tick-DboEo7Cc.js";function Kr(m){return m.schema?.definitions??m.schema?.$defs??{}}function $r(m,e){const r=Kr(e),c=r[btoa(m)];if(!c)return;let d=typeof c.image=="string"?c.image:void 0;if(!d&&Array.isArray(c.allOf)){const h=c.allOf.find(S=>typeof S.$ref=="string")?.$ref;if(typeof h=="string"){const S=h.replace("#/definitions/",""),p=r[S];d=typeof p?.image=="string"?p.image:void 0}}if(d?.includes("{{{"))return d}function Or(m,e){if(!e)return;const r=bs(m);if(!r)return;const c=$r(r.resolveType,e);if(!c)return;const d=ys(c,r.data);if(d)return _s(d)}const Br="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",Lr="text-global-section-fg focus:bg-global-section/12 focus:text-global-section-fg dark:text-global-section-fg-dark dark:focus:bg-global-section/15 dark:focus:text-global-section-fg-dark [&_svg]:!text-global-section";function On(m){return Array.from({length:m},(e,r)=>({id:crypto.randomUUID(),index:r}))}function fa(m){return m.map((e,r)=>({...e,index:r}))}function Fr(m,e){if(e===m.length)return m;if(e<m.length)return fa(m.slice(0,e));const r=Array.from({length:e-m.length},(c,d)=>({id:crypto.randomUUID(),index:m.length+d}));return[...m,...r]}function pa(m){const e=He.c(20),{section:r,raw:c,meta:d}=m,h=r.isSavedBlock===!0,S=r.isMultivariate===!0;let p;e[0]!==d||e[1]!==c?(p=c&&d?Or(c,d):void 0,e[0]=d,e[1]=c,e[2]=p):p=e[2];const v=p;let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(yr,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[3]=g):g=e[3];let y;e[4]!==v?(y=v&&n.jsx("img",{src:v,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[4]=v,e[5]=y):y=e[5];let V;e[6]!==S||e[7]!==h?(V=h?{color:ws}:S?{color:"oklch(0.65 0.15 160)"}:void 0,e[6]=S,e[7]=h,e[8]=V):V=e[8];let R;e[9]!==V?(R=n.jsx(cn,{className:"h-4 w-4 shrink-0",style:V}),e[9]=V,e[10]=R):R=e[10];const _=r.isHidden&&"line-through opacity-50";let k;e[11]!==_?(k=Ee("min-w-0 flex-1 truncate text-sm font-medium",_),e[11]=_,e[12]=k):k=e[12];let o;e[13]!==r.label||e[14]!==k?(o=n.jsx("span",{className:k,children:r.label}),e[13]=r.label,e[14]=k,e[15]=o):o=e[15];let N;return e[16]!==y||e[17]!==R||e[18]!==o?(N=n.jsxs(n.Fragment,{children:[g,y,R,o]}),e[16]=y,e[17]=R,e[18]=o,e[19]=N):N=e[19],N}function ha(m,e){const r=m.isSavedBlock===!0,c=m.isMultivariate===!0;return Ee("group flex select-none items-center gap-2 rounded-md px-2 py-2.5",e?"bg-accent text-accent-foreground":r?Br:c?"text-[oklch(0.45_0.15_160)] hover:bg-[oklch(0.65_0.15_160/0.12)] dark:text-[oklch(0.78_0.15_160)] dark:hover:bg-[oklch(0.65_0.15_160/0.15)]":"text-foreground/80 hover:bg-accent hover:text-accent-foreground")}function Ir(m){const e=He.c(64),{section:r,raw:c,meta:d,sortableId:h,selected:S,onSelect:p,onDelete:v,onDuplicate:g,onMakeReusable:y,onToggleHidden:V,onToggleLazy:R,onAddVariant:_,onDetach:k}=m,o=c?qn(c.__resolveType??""):!1;let N;e[0]!==r?(N=js(r),e[0]=r,e[1]=N):N=e[1];const l=N;let J;e[2]!==h?(J={id:h,animateLayoutChanges:Wr},e[2]=h,e[3]=J):J=e[3];const{attributes:H,listeners:K,setNodeRef:u,transform:T,isDragging:se}=Yn(J);let P;e[4]!==T?(P=Jn.Transform.toString(T?{...T,x:0}:null),e[4]=T,e[5]=P):P=e[5];const pe=se?0:void 0;let D;e[6]!==P||e[7]!==pe?(D={transform:P,opacity:pe},e[6]=P,e[7]=pe,e[8]=D):D=e[8];const ce=D;let B;e[9]!==r?(B=ks(r),e[9]=r,e[10]=B):B=e[10];const te=B,oe="button",Ve=0;let E;e[11]!==p?(E=$=>{($.key==="Enter"||$.key===" ")&&($.preventDefault(),p())},e[11]=p,e[12]=E):E=e[12];const ue=se?"cursor-grabbing":"cursor-pointer";let ie;e[13]!==r||e[14]!==S||e[15]!==ue?(ie=Ee("touch-none transition-colors",ue,ha(r,S)),e[13]=r,e[14]=S,e[15]=ue,e[16]=ie):ie=e[16];let je;e[17]!==d||e[18]!==c||e[19]!==r?(je=n.jsx(pa,{section:r,raw:c,meta:d}),e[17]=d,e[18]=c,e[19]=r,e[20]=je):je=e[20];const M=!r.isMultivariate&&n.jsxs(mt,{children:[n.jsx(ft,{asChild:!0,children:n.jsx(We,{type:"button",variant:"ghost",size:"icon","aria-label":o?"Disable async render":"Enable async render",className:Ee("h-7 w-7 shrink-0",o?"":"opacity-0 group-hover:opacity-100"),onClick:$=>{$.stopPropagation(),R()},onPointerDown:Gr,children:n.jsx(kr,{className:Ee("h-3.5 w-3.5",o&&"text-yellow-500")})})}),n.jsx(pt,{side:"bottom",children:o?"Disable async render":"Enable async render"})]});let Ae;e[21]!==V||e[22]!==r.isHidden||e[23]!==r.isMultivariate?(Ae=!r.isMultivariate&&n.jsxs(mt,{children:[n.jsx(ft,{asChild:!0,children:n.jsx(We,{type:"button",variant:"ghost",size:"icon","aria-label":r.isHidden?"Show section":"Hide section",className:Ee("h-7 w-7 shrink-0",r.isHidden?"opacity-100":"opacity-0 group-hover:opacity-100"),onClick:$=>{$.stopPropagation(),V()},onPointerDown:Ur,children:r.isHidden?n.jsx(_r,{className:"h-3.5 w-3.5"}):n.jsx(jr,{className:"h-3.5 w-3.5"})})}),n.jsx(pt,{side:"bottom",children:r.isHidden?"Show section":"Hide section"})]}),e[21]=V,e[22]=r.isHidden,e[23]=r.isMultivariate,e[24]=Ae):Ae=e[24];let X;e[25]===Symbol.for("react.memo_cache_sentinel")?(X=n.jsx(ua,{asChild:!0,children:n.jsx(We,{type:"button",variant:"ghost",size:"icon","aria-label":"Section actions",className:"h-7 w-7 shrink-0 opacity-0 group-hover:opacity-100",onClick:Hr,onPointerDown:zr,children:n.jsx(sa,{className:"h-3.5 w-3.5"})})}),e[25]=X):X=e[25];let De;e[26]!==g?(De=$=>{$.stopPropagation(),g()},e[26]=g,e[27]=De):De=e[27];let ve;e[28]===Symbol.for("react.memo_cache_sentinel")?(ve=n.jsx(ia,{className:"h-4 w-4"}),e[28]=ve):ve=e[28];let re;e[29]!==De?(re=n.jsxs(it,{onClick:De,children:[ve,"Duplicate"]}),e[29]=De,e[30]=re):re=e[30];let W;e[31]!==l||e[32]!==_?(W=l&&n.jsxs(it,{className:Rs,onClick:$=>{$.stopPropagation(),_()},children:[n.jsx(la,{className:"h-4 w-4"}),"Add variant"]}),e[31]=l,e[32]=_,e[33]=W):W=e[33];let q;e[34]!==te||e[35]!==y?(q=te&&n.jsxs(it,{className:Lr,onClick:$=>{$.stopPropagation(),y()},children:[n.jsx(cn,{className:"h-4 w-4"}),"Make reusable"]}),e[34]=te,e[35]=y,e[36]=q):q=e[36];let ne;e[37]!==k||e[38]!==r.isMultivariate||e[39]!==r.isSavedBlock?(ne=r.isSavedBlock===!0&&!r.isMultivariate&&n.jsxs(it,{onClick:$=>{$.stopPropagation(),k()},children:[n.jsx(cn,{className:"h-4 w-4"}),"Detach"]}),e[37]=k,e[38]=r.isMultivariate,e[39]=r.isSavedBlock,e[40]=ne):ne=e[40];let le;e[41]!==v?(le=$=>{$.stopPropagation(),v()},e[41]=v,e[42]=le):le=e[42];let ke;e[43]===Symbol.for("react.memo_cache_sentinel")?(ke=n.jsx(ca,{className:"h-4 w-4"}),e[43]=ke):ke=e[43];let Se;e[44]!==le?(Se=n.jsxs(it,{className:"text-destructive focus:text-destructive",onClick:le,children:[ke,"Delete"]}),e[44]=le,e[45]=Se):Se=e[45];let de;e[46]!==re||e[47]!==W||e[48]!==q||e[49]!==ne||e[50]!==Se?(de=n.jsxs(da,{children:[X,n.jsxs(ma,{align:"end",className:"w-44",children:[re,W,q,ne,Se]})]}),e[46]=re,e[47]=W,e[48]=q,e[49]=ne,e[50]=Se,e[51]=de):de=e[51];let ye;return e[52]!==H||e[53]!==K||e[54]!==p||e[55]!==u||e[56]!==ce||e[57]!==ie||e[58]!==je||e[59]!==M||e[60]!==Ae||e[61]!==de||e[62]!==E?(ye=n.jsxs("div",{ref:u,style:ce,...H,...K,role:oe,tabIndex:Ve,onClick:p,onKeyDown:E,className:ie,children:[je,M,Ae,de]}),e[52]=H,e[53]=K,e[54]=p,e[55]=u,e[56]=ce,e[57]=ie,e[58]=je,e[59]=M,e[60]=Ae,e[61]=de,e[62]=E,e[63]=ye):ye=e[63],ye}function zr(m){return m.stopPropagation()}function Hr(m){return m.stopPropagation()}function Ur(m){return m.stopPropagation()}function Gr(m){return m.stopPropagation()}function Wr(){return!1}function qr(m){const e=He.c(90),{listKey:r,rawSections:c,sections:d,meta:h,selectedIndex:S,onSelect:p,onReorder:v,onDelete:g,onDuplicate:y,onMakeReusable:V,onToggleHidden:R,onToggleLazy:_,onAddVariant:k,onDetach:o,onAddSection:N,canAddSection:l}=m,J=l===void 0?!0:l;let H;e[0]!==d.length?(H=()=>On(d.length),e[0]=d.length,e[1]=H):H=e[1];const[K,u]=w.useState(H),[T,se]=w.useState(null),[P,pe]=w.useState(r),[D,ce]=w.useState(d.length),B=w.useRef(!1);P!==r?(pe(r),ce(d.length),u(On(d.length))):D!==d.length&&(ce(d.length),u(L=>Fr(L,d.length)));let te;e[2]===Symbol.for("react.memo_cache_sentinel")?(te={activationConstraint:{distance:8}},e[2]=te):te=e[2];let oe;e[3]===Symbol.for("react.memo_cache_sentinel")?(oe={coordinateGetter:Qn},e[3]=oe):oe=e[3];const Ve=Un(zt(Wn,te),zt(Gn,oe));let E;e[4]!==K?(E=K.map(Yr),e[4]=K,e[5]=E):E=e[5];const ue=E;let ie;e[6]===Symbol.for("react.memo_cache_sentinel")?(ie=L=>{se(String(L.active.id))},e[6]=ie):ie=e[6];const je=ie;let M;e[7]!==ue||e[8]!==v?(M=L=>{se(null);const{active:ae,over:Q}=L;if(!Q||ae.id===Q.id)return;const Ie=ue.indexOf(String(ae.id)),he=ue.indexOf(String(Q.id));Ie===-1||he===-1||(u(Qe=>fa(Rt([...Qe],Ie,he))),B.current=!0,requestAnimationFrame(()=>{B.current=!1}),v?.(Ie,he))},e[7]=ue,e[8]=v,e[9]=M):M=e[9];const Ae=M;let X;e[10]===Symbol.for("react.memo_cache_sentinel")?(X=()=>{se(null)},e[10]=X):X=e[10];const De=X;let ve,re,W,q,ne,le,ke,Se,de,ye,$,Z,we,Ke,$e;if(e[11]!==T||e[12]!==J||e[13]!==K||e[14]!==ue||e[15]!==Ae||e[16]!==h||e[17]!==N||e[18]!==k||e[19]!==g||e[20]!==o||e[21]!==y||e[22]!==V||e[23]!==p||e[24]!==R||e[25]!==_||e[26]!==c||e[27]!==d||e[28]!==S||e[29]!==Ve){Ke=Symbol.for("react.early_return_sentinel");e:{const L=ae=>{B.current||p(ae)};if(e[45]!==T||e[46]!==J||e[47]!==K||e[48]!==N||e[49]!==c||e[50]!==d){const ae=T?K.find(Q=>Q.id===T):null;if(q=ae!=null?d[ae.index]:null,W=ae!=null?c[ae.index]:void 0,K.length===0){let Q;e[54]===Symbol.for("react.memo_cache_sentinel")?(Q=n.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:"No sections in this page."}),e[54]=Q):Q=e[54];const Ie=!J;let he;e[55]===Symbol.for("react.memo_cache_sentinel")?(he=n.jsx(un,{size:14}),e[55]=he):he=e[55];let Qe;e[56]!==N||e[57]!==Ie?(Qe=n.jsxs("div",{className:"space-y-2",children:[Q,n.jsxs(We,{type:"button",variant:"outline",size:"sm",className:"w-full",disabled:Ie,onClick:N,children:[he,"Add section"]})]}),e[56]=N,e[57]=Ie,e[58]=Qe):Qe=e[58],Ke=Qe;break e}we=Ee(ae&&"cursor-grabbing"),e[45]=T,e[46]=J,e[47]=K,e[48]=N,e[49]=c,e[50]=d,e[51]=W,e[52]=q,e[53]=we}else W=e[51],q=e[52],we=e[53];re=Xn,Se=Ve,de=Zn,ye=je,$=Ae,Z=De,ve=ea,le=ue,ke=ta,$e="space-y-1",ne=K.map(ae=>{const Q=d[ae.index];return Q?n.jsx(Ir,{sortableId:ae.id,section:Q,raw:c[ae.index],meta:h,selected:S===ae.index,onSelect:()=>L(ae.index),onDelete:()=>g(ae.index),onDuplicate:()=>y(ae.index),onMakeReusable:()=>V(ae.index),onToggleHidden:()=>R(ae.index),onToggleLazy:()=>_(ae.index),onAddVariant:()=>k(ae.index),onDetach:()=>o(ae.index)},ae.id):null})}e[11]=T,e[12]=J,e[13]=K,e[14]=ue,e[15]=Ae,e[16]=h,e[17]=N,e[18]=k,e[19]=g,e[20]=o,e[21]=y,e[22]=V,e[23]=p,e[24]=R,e[25]=_,e[26]=c,e[27]=d,e[28]=S,e[29]=Ve,e[30]=ve,e[31]=re,e[32]=W,e[33]=q,e[34]=ne,e[35]=le,e[36]=ke,e[37]=Se,e[38]=de,e[39]=ye,e[40]=$,e[41]=Z,e[42]=we,e[43]=Ke,e[44]=$e}else ve=e[30],re=e[31],W=e[32],q=e[33],ne=e[34],le=e[35],ke=e[36],Se=e[37],de=e[38],ye=e[39],$=e[40],Z=e[41],we=e[42],Ke=e[43],$e=e[44];if(Ke!==Symbol.for("react.early_return_sentinel"))return Ke;let Le;e[59]!==ne||e[60]!==$e?(Le=n.jsx("div",{className:$e,children:ne}),e[59]=ne,e[60]=$e,e[61]=Le):Le=e[61];let Te;e[62]!==ve||e[63]!==le||e[64]!==ke||e[65]!==Le?(Te=n.jsx(ve,{items:le,strategy:ke,children:Le}),e[62]=ve,e[63]=le,e[64]=ke,e[65]=Le,e[66]=Te):Te=e[66];let Oe;e[67]!==W||e[68]!==q||e[69]!==h?(Oe=q?n.jsx("div",{className:Ee("cursor-grabbing shadow-lg ring-1 ring-border/60",ha(q,!1)),children:n.jsx(pa,{section:q,raw:W,meta:h})}):null,e[67]=W,e[68]=q,e[69]=h,e[70]=Oe):Oe=e[70];let Fe;e[71]!==Oe?(Fe=n.jsx(na,{dropAnimation:null,children:Oe}),e[71]=Oe,e[72]=Fe):Fe=e[72];let Me;e[73]!==re||e[74]!==Se||e[75]!==de||e[76]!==ye||e[77]!==$||e[78]!==Z||e[79]!==Te||e[80]!==Fe?(Me=n.jsxs(re,{sensors:Se,collisionDetection:de,onDragStart:ye,onDragEnd:$,onDragCancel:Z,children:[Te,Fe]}),e[73]=re,e[74]=Se,e[75]=de,e[76]=ye,e[77]=$,e[78]=Z,e[79]=Te,e[80]=Fe,e[81]=Me):Me=e[81];const xe=!J;let Re;e[82]===Symbol.for("react.memo_cache_sentinel")?(Re=n.jsx(un,{size:14}),e[82]=Re):Re=e[82];let me;e[83]!==N||e[84]!==xe?(me=n.jsxs(We,{type:"button",variant:"outline",size:"sm",className:"mt-2 w-full",disabled:xe,onClick:N,children:[Re,"Add section"]}),e[83]=N,e[84]=xe,e[85]=me):me=e[85];let ee;return e[86]!==we||e[87]!==Me||e[88]!==me?(ee=n.jsxs("div",{className:we,children:[Me,me]}),e[86]=we,e[87]=Me,e[88]=me,e[89]=ee):ee=e[89],ee}function Yr(m){return m.id}function Bn(m){const e=He.c(38),{open:r,initialName:c,autoLabel:d,isPending:h,onSubmit:S,onOpenChange:p}=m,v=h===void 0?!1:h,[g,y]=w.useState(c),[V,R]=w.useState(r);r!==V&&(R(r),r&&y(c));let _;e[0]!==v||e[1]!==p?(_=oe=>{!oe&&!v&&p(!1)},e[0]=v,e[1]=p,e[2]=_):_=e[2];const k=_;let o;e[3]!==v||e[4]!==g||e[5]!==S?(o=async oe=>{oe.preventDefault(),!v&&await S(g.trim())},e[3]=v,e[4]=g,e[5]=S,e[6]=o):o=e[6];const N=o;let l;e[7]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(pr,{children:"Rename variant"}),e[7]=l):l=e[7];const J=d||"the rule";let H;e[8]!==J?(H=n.jsxs(hr,{children:[l,n.jsxs(gr,{children:["Save this matcher as a global block with a custom label. Leave empty to inline the matcher again and fall back to"," ",n.jsx("span",{className:"font-medium",children:J}),"."]})]}),e[8]=J,e[9]=H):H=e[9];let K;e[10]===Symbol.for("react.memo_cache_sentinel")?(K=n.jsx("label",{htmlFor:"variant-rename-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[10]=K):K=e[10];let u;e[11]===Symbol.for("react.memo_cache_sentinel")?(u=oe=>y(oe.target.value),e[11]=u):u=e[11];let T;e[12]!==d||e[13]!==v||e[14]!==g?(T=n.jsxs("div",{className:"space-y-1.5 py-4",children:[K,n.jsx(br,{id:"variant-rename-name",value:g,onChange:u,placeholder:d,autoFocus:!0,disabled:v})]}),e[12]=d,e[13]=v,e[14]=g,e[15]=T):T=e[15];let se;e[16]!==p?(se=()=>p(!1),e[16]=p,e[17]=se):se=e[17];let P;e[18]!==v||e[19]!==se?(P=n.jsx(We,{type:"button",variant:"outline",onClick:se,disabled:v,children:"Cancel"}),e[18]=v,e[19]=se,e[20]=P):P=e[20];let pe;e[21]!==v?(pe=v?n.jsxs(n.Fragment,{children:[n.jsx(Hn,{size:14,className:"animate-spin"}),"Saving…"]}):"Save",e[21]=v,e[22]=pe):pe=e[22];let D;e[23]!==v||e[24]!==pe?(D=n.jsx(We,{type:"submit",disabled:v,children:pe}),e[23]=v,e[24]=pe,e[25]=D):D=e[25];let ce;e[26]!==P||e[27]!==D?(ce=n.jsxs(vr,{children:[P,D]}),e[26]=P,e[27]=D,e[28]=ce):ce=e[28];let B;e[29]!==N||e[30]!==ce||e[31]!==H||e[32]!==T?(B=n.jsx(Sr,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:N,children:[H,T,ce]})}),e[29]=N,e[30]=ce,e[31]=H,e[32]=T,e[33]=B):B=e[33];let te;return e[34]!==k||e[35]!==r||e[36]!==B?(te=n.jsx(xr,{open:r,onOpenChange:k,children:B}),e[34]=k,e[35]=r,e[36]=B,e[37]=te):te=e[37],te}const Jr="text-[oklch(0.45_0.15_160)] hover:bg-[oklch(0.65_0.15_160/0.12)] dark:text-[oklch(0.78_0.15_160)] dark:hover:bg-[oklch(0.65_0.15_160/0.15)]",ga="text-[oklch(0.45_0.15_160)] bg-[oklch(0.65_0.15_160/0.18)] dark:text-[oklch(0.78_0.15_160)] dark:bg-[oklch(0.65_0.15_160/0.2)]";function va(m){const e=He.c(5),{rule:r,matchers:c}=m,d=r?.__resolveType??"";let h;if(e[0]!==c||e[1]!==d){const g=c.find(y=>y.resolveType===d)?.iconName??Ns(d);h=ur(g),e[0]=c,e[1]=d,e[2]=h}else h=e[2];const S=h;if(!S)return null;let p;return e[3]!==S?(p=n.jsx(S,{size:14,className:"shrink-0"}),e[3]=S,e[4]=p):p=e[4],p}function Ln(m){return m.map(e=>`${e.label}|${e.rule?.__resolveType??""}`).join(`
|
|
2
|
-
`)}function ln(m){return m.map((e,r)=>({id:crypto.randomUUID(),index:r,variant:e}))}function Qr(m){return m.map((e,r)=>({...e,index:r}))}function Sa(m){const e=He.c(16),{label:r,effectiveRule:c,matchers:d,canDelete:h,dragging:S,onRename:p,onDuplicate:v,onDelete:g}=m;let y;e[0]!==c||e[1]!==d?(y=n.jsx(va,{rule:c,matchers:d}),e[0]=c,e[1]=d,e[2]=y):y=e[2];let V;e[3]!==r?(V=n.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:r}),e[3]=r,e[4]=V):V=e[4];let R;e[5]!==h||e[6]!==S||e[7]!==r||e[8]!==g||e[9]!==v||e[10]!==p?(R=!S&&n.jsxs(da,{children:[n.jsx(ua,{asChild:!0,children:n.jsx(We,{type:"button",variant:"ghost",size:"icon","aria-label":`Actions for ${r}`,className:"size-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100 data-[state=open]:opacity-100",onClick:Zr,onPointerDown:Xr,children:n.jsx(sa,{size:14})})}),n.jsxs(ma,{align:"end",className:"w-36",children:[n.jsxs(it,{onClick:k=>{k.stopPropagation(),p?.()},children:[n.jsx(Mr,{size:14}),"Rename"]}),n.jsxs(it,{onClick:k=>{k.stopPropagation(),v?.()},children:[n.jsx(ia,{size:14}),"Duplicate"]}),n.jsx(wr,{}),n.jsxs(it,{variant:"destructive",disabled:!h,onClick:k=>{k.stopPropagation(),g?.()},children:[n.jsx(ca,{size:14}),"Delete"]})]})]}),e[5]=h,e[6]=S,e[7]=r,e[8]=g,e[9]=v,e[10]=p,e[11]=R):R=e[11];let _;return e[12]!==y||e[13]!==V||e[14]!==R?(_=n.jsxs(n.Fragment,{children:[y,V,R]}),e[12]=y,e[13]=V,e[14]=R,e[15]=_):_=e[15],_}function Xr(m){return m.stopPropagation()}function Zr(m){return m.stopPropagation()}function eo(m){const e=He.c(33),{entry:r,sortableId:c,isActive:d,canDelete:h,decofile:S,meta:p,matchers:v,onSelect:g,onRename:y,onDuplicate:V,onDelete:R}=m;let _;e[0]!==c?(_={id:c,animateLayoutChanges:to},e[0]=c,e[1]=_):_=e[1];const{attributes:k,listeners:o,setNodeRef:N,transform:l,isDragging:J}=Yn(_);let H;e[2]!==l?(H=Jn.Transform.toString(l?{...l,x:0}:null),e[2]=l,e[3]=H):H=e[3];const K=J?0:void 0;let u;e[4]!==H||e[5]!==K?(u={transform:H,opacity:K},e[4]=H,e[5]=K,e[6]=u):u=e[6];const T=u,se=p??void 0;let P;e[7]!==S||e[8]!==r.variant.rule||e[9]!==se?(P=Nt(r.variant.rule,S,se),e[7]=S,e[8]=r.variant.rule,e[9]=se,e[10]=P):P=e[10];const pe=P;let D;e[11]!==g?(D=E=>{E.target===E.currentTarget&&(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),g())},e[11]=g,e[12]=D):D=e[12];const ce=J?"cursor-grabbing":"cursor-pointer active:cursor-grabbing",B=d?ga:Jr;let te;e[13]!==ce||e[14]!==B?(te=Ee("group flex select-none items-center gap-2 rounded-md px-2 py-2.5 transition-colors touch-none",ce,B),e[13]=ce,e[14]=B,e[15]=te):te=e[15];let oe;e[16]!==h||e[17]!==pe||e[18]!==r.variant.label||e[19]!==v||e[20]!==R||e[21]!==V||e[22]!==y?(oe=n.jsx(Sa,{label:r.variant.label,effectiveRule:pe,matchers:v,canDelete:h,onRename:y,onDuplicate:V,onDelete:R}),e[16]=h,e[17]=pe,e[18]=r.variant.label,e[19]=v,e[20]=R,e[21]=V,e[22]=y,e[23]=oe):oe=e[23];let Ve;return e[24]!==k||e[25]!==o||e[26]!==g||e[27]!==N||e[28]!==T||e[29]!==te||e[30]!==oe||e[31]!==D?(Ve=n.jsx("div",{ref:N,style:T,...k,...o,onClick:g,onKeyDown:D,className:te,children:oe}),e[24]=k,e[25]=o,e[26]=g,e[27]=N,e[28]=T,e[29]=te,e[30]=oe,e[31]=D,e[32]=Ve):Ve=e[32],Ve}function to(){return!1}function no(m){const e=He.c(9),{variant:r,decofile:c,meta:d,matchers:h}=m,S=d??void 0;let p;e[0]!==c||e[1]!==S||e[2]!==r.rule?(p=Nt(r.rule,c,S),e[0]=c,e[1]=S,e[2]=r.rule,e[3]=p):p=e[3];const v=p;let g;e[4]===Symbol.for("react.memo_cache_sentinel")?(g=Ee("flex items-center gap-2 rounded-md px-2 py-2.5 shadow-lg ring-1 ring-border/60 cursor-grabbing",ga),e[4]=g):g=e[4];let y;return e[5]!==v||e[6]!==h||e[7]!==r.label?(y=n.jsx("div",{className:g,children:n.jsx(Sa,{label:r.label,effectiveRule:v,matchers:h,canDelete:!1,dragging:!0})}),e[5]=v,e[6]=h,e[7]=r.label,e[8]=y):y=e[8],y}function ao(m){const e=He.c(77),{listKey:r,variants:c,activeIndex:d,decofile:h,meta:S,matchers:p,onSelect:v,onReorder:g,onRename:y,onDuplicate:V,onDelete:R,onAdd:_}=m;let k;e[0]!==c?(k=()=>ln(c),e[0]=c,e[1]=k):k=e[1];const[o,N]=w.useState(k),[l,J]=w.useState(null),[H,K]=w.useState(r),[u,T]=w.useState(c.length);let se;e[2]!==c?(se=()=>Ln(c),e[2]=c,e[3]=se):se=e[3];const[P,pe]=w.useState(se),D=w.useRef(!1),ce=Ln(c);H!==r?(K(r),T(c.length),pe(ce),N(ln(c))):u!==c.length?(T(c.length),pe(ce),N(ln(c))):P!==ce&&(pe(ce),N(Me=>c.map((xe,Re)=>({id:Me[Re]?.id??crypto.randomUUID(),index:Re,variant:xe}))));let B;e[4]===Symbol.for("react.memo_cache_sentinel")?(B={activationConstraint:{distance:8}},e[4]=B):B=e[4];let te;e[5]===Symbol.for("react.memo_cache_sentinel")?(te={coordinateGetter:Qn},e[5]=te):te=e[5];const oe=Un(zt(Wn,B),zt(Gn,te));let Ve;e[6]!==o?(Ve=o.map(so),e[6]=o,e[7]=Ve):Ve=e[7];const E=Ve,ue=c.length>1;let ie;e[8]!==o?(ie=Me=>{const xe=String(Me.active.id);J(o.find(Re=>Re.id===xe)??null)},e[8]=o,e[9]=ie):ie=e[9];const je=ie;let M;e[10]!==E||e[11]!==g?(M=Me=>{J(null);const{active:xe,over:Re}=Me;if(!Re||xe.id===Re.id)return;const me=E.indexOf(String(xe.id)),ee=E.indexOf(String(Re.id));me===-1||ee===-1||(N(L=>Qr(Rt([...L],me,ee))),D.current=!0,requestAnimationFrame(()=>{D.current=!1}),g(me,ee))},e[10]=E,e[11]=g,e[12]=M):M=e[12];const Ae=M;let X;e[13]===Symbol.for("react.memo_cache_sentinel")?(X=()=>{J(null)},e[13]=X):X=e[13];const De=X;let ve,re,W,q,ne,le,ke,Se,de,ye,$,Z,we;if(e[14]!==d||e[15]!==ue||e[16]!==h||e[17]!==o||e[18]!==E||e[19]!==Ae||e[20]!==je||e[21]!==p||e[22]!==S||e[23]!==_||e[24]!==R||e[25]!==V||e[26]!==y||e[27]!==v||e[28]!==oe){const Me=L=>{D.current||v(L)};$="space-y-1 border-b p-2";let xe;e[42]===Symbol.for("react.memo_cache_sentinel")?(xe=n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Variants"}),e[42]=xe):xe=e[42];let Re;e[43]===Symbol.for("react.memo_cache_sentinel")?(Re=n.jsx(un,{size:14}),e[43]=Re):Re=e[43];let me;e[44]!==_?(me=n.jsx(ft,{asChild:!0,children:n.jsx(We,{type:"button",variant:"ghost",size:"icon","aria-label":"Add variant",className:"size-6",onClick:_,children:Re})}),e[44]=_,e[45]=me):me=e[45];let ee;e[46]===Symbol.for("react.memo_cache_sentinel")?(ee=n.jsx(pt,{children:"Add variant"}),e[46]=ee):ee=e[46],e[47]!==me?(Z=n.jsxs("div",{className:"flex items-center justify-between",children:[xe,n.jsxs(mt,{children:[me,ee]})]}),e[47]=me,e[48]=Z):Z=e[48],re=Xn,le=oe,ke=Zn,Se=je,de=Ae,ye=De,ve=ea,q=E,ne=ta,we="space-y-0.5",W=o.map(L=>n.jsx(eo,{sortableId:L.id,entry:L,isActive:L.index===d,canDelete:ue,decofile:h,meta:S,matchers:p,onSelect:()=>Me(L.index),onRename:()=>y(L.index),onDuplicate:()=>V(L.index),onDelete:()=>R(L.index)},L.id)),e[14]=d,e[15]=ue,e[16]=h,e[17]=o,e[18]=E,e[19]=Ae,e[20]=je,e[21]=p,e[22]=S,e[23]=_,e[24]=R,e[25]=V,e[26]=y,e[27]=v,e[28]=oe,e[29]=ve,e[30]=re,e[31]=W,e[32]=q,e[33]=ne,e[34]=le,e[35]=ke,e[36]=Se,e[37]=de,e[38]=ye,e[39]=$,e[40]=Z,e[41]=we}else ve=e[29],re=e[30],W=e[31],q=e[32],ne=e[33],le=e[34],ke=e[35],Se=e[36],de=e[37],ye=e[38],$=e[39],Z=e[40],we=e[41];let Ke;e[49]!==W||e[50]!==we?(Ke=n.jsx("div",{className:we,children:W}),e[49]=W,e[50]=we,e[51]=Ke):Ke=e[51];let $e;e[52]!==ve||e[53]!==q||e[54]!==ne||e[55]!==Ke?($e=n.jsx(ve,{items:q,strategy:ne,children:Ke}),e[52]=ve,e[53]=q,e[54]=ne,e[55]=Ke,e[56]=$e):$e=e[56];let Le;e[57]!==l||e[58]!==h||e[59]!==p||e[60]!==S?(Le=l?n.jsx(no,{variant:l.variant,decofile:h,meta:S,matchers:p}):null,e[57]=l,e[58]=h,e[59]=p,e[60]=S,e[61]=Le):Le=e[61];let Te;e[62]!==Le?(Te=n.jsx(na,{dropAnimation:null,children:Le}),e[62]=Le,e[63]=Te):Te=e[63];let Oe;e[64]!==re||e[65]!==le||e[66]!==ke||e[67]!==Se||e[68]!==de||e[69]!==ye||e[70]!==$e||e[71]!==Te?(Oe=n.jsxs(re,{sensors:le,collisionDetection:ke,onDragStart:Se,onDragEnd:de,onDragCancel:ye,children:[$e,Te]}),e[64]=re,e[65]=le,e[66]=ke,e[67]=Se,e[68]=de,e[69]=ye,e[70]=$e,e[71]=Te,e[72]=Oe):Oe=e[72];let Fe;return e[73]!==$||e[74]!==Z||e[75]!==Oe?(Fe=n.jsxs("div",{className:$,children:[Z,Oe]}),e[73]=$,e[74]=Z,e[75]=Oe,e[76]=Fe):Fe=e[76],Fe}function so(m){return m.id}function Fn(m){const e=He.c(15),{schema:r,value:c,onChange:d,meta:h,decofile:S,onSaveReferencedBlock:p,sandbox:v}=m;let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=[],e[0]=g):g=e[0];const[y,V]=w.useState(g);let R;e[1]!==y?(R=y.length>0&&n.jsxs("nav",{"aria-label":"Variant rule breadcrumb",className:"flex min-w-0 items-center gap-1 overflow-hidden text-xs",children:[n.jsx("button",{type:"button",onClick:()=>V([]),className:"flex shrink-0 items-center gap-0.5 rounded-md px-1 py-0.5 text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground",title:"Back to rule",children:n.jsx(ra,{className:"size-3.5"})}),y.map((o,N)=>{const l=N===y.length-1;return n.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[N>0&&n.jsx(oa,{className:"size-3 shrink-0 text-muted-foreground/60"}),n.jsx("button",{type:"button",onClick:()=>V(y.slice(0,N+1)),title:o,className:Ee("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",l?"font-medium text-foreground":"text-muted-foreground"),children:o})]},`${o}-${N}`)})]}),e[1]=y,e[2]=R):R=e[2];let _;e[3]!==y||e[4]!==S||e[5]!==h||e[6]!==d||e[7]!==p||e[8]!==v||e[9]!==r||e[10]!==c?(_=n.jsx(aa,{schema:r,value:c,onChange:d,basePath:"",breadcrumbPath:y,onBreadcrumbChange:V,meta:h,decofile:S,onSaveReferencedBlock:p,sandbox:v}),e[3]=y,e[4]=S,e[5]=h,e[6]=d,e[7]=p,e[8]=v,e[9]=r,e[10]=c,e[11]=_):_=e[11];let k;return e[12]!==R||e[13]!==_?(k=n.jsxs("div",{className:"space-y-2",children:[R,_]}),e[12]=R,e[13]=_,e[14]=k):k=e[14],k}function In(m){const e=He.c(21),{activeSchema:r,formValue:c,formResetKey:d,onFormChange:h,onBreadcrumbChange:S,breadcrumbPath:p,emptyMessage:v,beforeForm:g,seoResolveType:y,siteDefaultSeo:V,meta:R,decofile:_,onSaveReferencedBlock:k,sandbox:o}=m;let N;e[0]!==p?(N=p===void 0?[]:p,e[0]=p,e[1]=N):N=e[1];const l=N;let J;e[2]!==r||e[3]!==l||e[4]!==_||e[5]!==d||e[6]!==c||e[7]!==R||e[8]!==S||e[9]!==h||e[10]!==k||e[11]!==o||e[12]!==y||e[13]!==V?(J=r&&c?y?n.jsx(Rr,{schema:r,resolveType:y,value:c,formResetKey:d,onChange:h,onBreadcrumbChange:S,siteDefaultSeo:V}):n.jsx(aa,{schema:r,value:c,onChange:h,basePath:"",breadcrumbPath:l,onBreadcrumbChange:S,meta:R,decofile:_,onSaveReferencedBlock:k,sandbox:o},d):null,e[2]=r,e[3]=l,e[4]=_,e[5]=d,e[6]=c,e[7]=R,e[8]=S,e[9]=h,e[10]=k,e[11]=o,e[12]=y,e[13]=V,e[14]=J):J=e[14];const H=J;let K;e[15]!==v||e[16]!==H?(K=H??n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:v}),e[15]=v,e[16]=H,e[17]=K):K=e[17];let u;return e[18]!==g||e[19]!==K?(u=n.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:n.jsxs("div",{className:"mx-auto max-w-2xl",children:[g,K]})}),e[18]=g,e[19]=K,e[20]=u):u=e[20],u}const ro="text-[oklch(0.45_0.15_160)] bg-[oklch(0.65_0.15_160/0.18)] dark:text-[oklch(0.78_0.15_160)] dark:bg-[oklch(0.65_0.15_160/0.22)]";function oo(m,e){return Ds(m,e,tt)}function io(m){const e=He.c(13),{pageKey:r,initialName:c,initialPath:d,onFieldChange:h}=m,[S,p]=w.useState(c),[v,g]=w.useState(d),[y,V]=w.useState(r);y!==r&&(V(r),p(c),g(d));let R;e[0]!==h?(R=l=>{p(l.target.value),h("name",l.target.value)},e[0]=h,e[1]=R):R=e[1];let _;e[2]!==S||e[3]!==R?(_=n.jsx("input",{type:"text",value:S,onChange:R,className:"w-full bg-transparent text-sm font-semibold truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:"Page name"}),e[2]=S,e[3]=R,e[4]=_):_=e[4];let k;e[5]!==h?(k=l=>{g(l.target.value),h("path",l.target.value)},e[5]=h,e[6]=k):k=e[6];let o;e[7]!==v||e[8]!==k?(o=n.jsx("input",{type:"text",value:v,onChange:k,className:"w-full bg-transparent text-xs text-muted-foreground truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:"/path"}),e[7]=v,e[8]=k,e[9]=o):o=e[9];let N;return e[10]!==_||e[11]!==o?(N=n.jsxs("div",{className:"space-y-1",children:[_,o]}),e[10]=_,e[11]=o,e[12]=N):N=e[12],N}function zn(m){const e=He.c(6),{onClick:r}=m;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(la,{size:14}),e[0]=c):c=e[0];let d;e[1]!==r?(d=n.jsx(ft,{asChild:!0,children:n.jsx(We,{type:"button",variant:"ghost",size:"icon","aria-label":"Add variant",className:"size-7 shrink-0 text-[oklch(0.65_0.15_160)]",onClick:r,children:c})}),e[1]=r,e[2]=d):d=e[2];let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(pt,{side:"bottom",children:"Add variant"}),e[3]=h):h=e[3];let S;return e[4]!==d?(S=n.jsxs(mt,{children:[d,h]}),e[4]=d,e[5]=S):S=e[5],S}function ic({orgSlug:m,virtualMcpId:e,branch:r,previewReady:c=!0,previewUrl:d,currentPath:h,activePageBlockKey:S=null,activeGlobalBlockKey:p=null,externalSelectedIndex:v,onSaved:g,initialEditSeo:y=!1,onExitSeo:V,onViewJsonFile:R,onVariantPreviewOverride:_}){const k=c?{orgSlug:m,virtualMcpId:e,branch:r,previewUrl:d}:null,{data:o,isLoading:N}=Cs(k),{data:l,isLoading:J}=Vs(k),H=Ts(),K=H?.entity?.id===e?H.entity.metadata?.siteSlug??null:null,[u,T]=w.useState(null),[se,P]=w.useState(null),[pe,D]=w.useState(null),[ce,B]=w.useState(0),[te,oe]=w.useState(void 0),[Ve,E]=w.useState(null),[ue,ie]=w.useState(null),[je,M]=w.useState([]),[Ae,X]=w.useState(0),[De,ve]=w.useState(null),[re,W]=w.useState(null),[q,ne]=w.useState(null),[le,ke]=w.useState(!0),[Se,de]=w.useState(!1),[ye,$]=w.useState(!1),[Z,we]=w.useState(y),[Ke,$e]=w.useState(y);y&&!Ke&&($e(!0),we(!0),T(null),P(null),D(null),M([])),!y&&Ke&&$e(!1);const[Le,Te]=w.useState(null),[Oe,Fe]=w.useState(void 0),[Me,xe]=w.useState([]),[Re,me]=w.useState(0),[ee,L]=w.useState(0),[ae,Q]=w.useState(null),[Ie,he]=w.useState(null),[Qe,dn]=w.useState(null),xa=Ss(),ba=`${m}/${e}/${r}`,Ht=Ps({orgSlug:m,virtualMcpId:e,branch:r}),[ya,_a]=w.useState(h),[ja,ka]=w.useState(S),[wa,Ra]=w.useState(p);(ya!==h||ja!==S||wa!==p)&&(queueMicrotask(()=>Ht.flush()),_a(h),ka(S),Ra(p),T(null),P(null),D(null),B(0),E(null),ie(null),L(0),Q(null),he(null),M([]),X(t=>t+1),we(!1),Te(null),Fe(void 0),xe([]),me(t=>t+1));const be=As({orgSlug:m,virtualMcpId:e,branch:r}),Dt=Xs((t,a)=>{be.mutate({blockKey:t,data:a},{onSuccess:()=>g?.(),onError:s=>G.error(`Save failed: ${s.message}`)})}),Ut=Ms({orgSlug:m,virtualMcpId:e,branch:r}),[yt,Ct]=w.useState(!1),Gt=w.useRef(null),ht=w.useRef(null),gt=w.useRef(null),Wt=w.useRef({}),qe=w.useRef({rawSections:[],parsedSections:[],decofile:{},activePageKey:null,pageVariants:[],variantIndex:0,sectionVariantIndex:0,selectedSectionIndex:null});if(!c||N||J)return n.jsx("div",{className:"h-full w-full flex items-center justify-center",children:n.jsx(Hn,{size:20,className:"animate-spin text-muted-foreground"})});if(!o||!l)return n.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:"Could not load site data."});const Na=Es(o),_e=!!p,ze=_e?null:Ks(Na,h,S),j=_e?p:ze?.key??null,qt=_e&&p?o[p]:void 0,mn=_e&&p&&qt?$s(p,qt):_e&&p?p:"",Vt=!_e&&j&&o[j]?o[j]:null,Yt=Z&&o&&l&&j&&ze?$n(o,{kind:"page",pageKey:j,pageName:String(ze.name??""),path:String(ze.path??"")},l):null,Da=Z?Vt?.seo:void 0,Jt=Oe!==void 0?Oe:Da,Ca=Z?Nr(Jt):void 0,Va=Yt?.seoTypeOptions??[],Ta=Z&&l?Dr(l):"",fn=Le??Ca??{},Qt=Z&&Yt?Cr(fn,Yt):null,Pa=Z&&Qt&&Vr(Jt)?Ot(Qt,l):null,Aa=Z?Tr(o,l)?.seoData:void 0,Be=_e?[{label:"Default",sections:[{__resolveType:p}]}]:oo(Vt?.sections,o??{}),Tt=Be.length>1,Ce=Math.min(ce,Be.length-1),nt=Be[Ce],I=nt?.sections??[],Pe=Bt(I,o),pn=!_e&&Os(Vt?.sections);if(_e&&p&&Qe!==p){dn(p);const t=I[0],a=Pe[0];if(t&&a){T(0),L(0),M([]);const s=ut(t,a,o);s&&(P(s.data),D(s.resolveType),he(null),Q(null))}}!_e&&Qe!==null&&dn(null),qe.current={rawSections:I,parsedSections:Pe,decofile:o??{},activePageKey:j,pageVariants:Be,variantIndex:Ce,sectionVariantIndex:ee,selectedSectionIndex:u};const Ma=()=>({multivariate:pn,index:Ce,variants:Be.map(t=>({rule:t.rule}))}),hn=(t,a)=>{if(!_)return;if(!j||!pn||t.length<=1){_(null);return}const s=En(j,{multivariate:!0,index:a,variants:t},o,l);_(s.length>0?s:null)},vt=(t,a,s)=>{if(!_)return;if(!j){_(null);return}const i=Ma(),f=En(j,i,o,l);if(!t||a<0){_(f.length>0?f:null);return}const b=ar({pageKey:j,page:i,sectionIndex:a,sectionLazy:Pe[a]?.isLazy??!1,mvObj:t,selectedVariantIndex:s,decofile:o,meta:l}),x=[...f,...b];_(x.length>0?x:null)},at=(t,a,s,i=u??-1,f=!1)=>{const b=Je(t,a);if(!b){P(null),D(null),he(null),Q(null),f&&vt(null,i,s);return}const C=Vn(b,tt)[s];if(!C){P(null),D(null),he(null),Q(null),f&&vt(null,i,s);return}const Y=Hs(C.value,o);P(Y?.data??null),D(Y?.resolveType??null);const{resolveType:A,formValue:O}=jt(C.rule,o,l??void 0);he(A),Q(O),f&&vt(b,i,s)};if(v!==void 0&&v!==te&&(oe(v??null),typeof v=="number")){const t=I[v],a=Pe[v];if(t&&a)if(T(v),L(0),M([]),X(s=>s+1),a.isMultivariate)at(t,a,0,v);else{const s=ut(t,a,o);s?(P(s.data),D(s.resolveType)):(P(null),D(null)),he(null),Q(null)}}const Pt={orgSlug:m,virtualMcpId:e,branch:r,previewUrl:d??void 0,siteSlug:K},Xt=pe&&l?Ot(pe,l):null,Ue=(t,a)=>{if(!j)return;const s=wt(o,j,t,Ce,Be);be.mutate({blockKey:j,data:s},{onSuccess:()=>a?.onSuccess?.()??g?.(),onError:i=>G.error(`Save failed: ${i.message}`)})},St=()=>{T(null),P(null),D(null),L(0),Q(null),he(null),M([]),X(t=>t+1)},Ea=(t,a)=>{Gt.current&&clearTimeout(Gt.current);const s=qe.current.sectionVariantIndex;Gt.current=setTimeout(()=>{const{rawSections:i,parsedSections:f,decofile:b,activePageKey:x,pageVariants:C,variantIndex:Y}=qe.current,A=i[a];if(!A)return;const O=f[a];if(!O)return;if(O.isSavedBlock){const z=O.isLazy?A.section?.__resolveType??A.__resolveType:A.__resolveType;be.mutate({blockKey:z,data:t},{onSuccess:()=>g?.(),onError:U=>G.error(`Save failed: ${U.message}`)});return}if(!x)return;const F={...b[x]},ge=[...i];if(O.isMultivariate){const z=Je(A,O);if(!z||!x)return;const U=rr(z,s,t);ge[a]=dt(A,O,U)}else if(O.isHidden){const z=qn(A.__resolveType),U=z?{...A.section}:{...A},Ne=Array.isArray(U.variants)?[...U.variants]:[];Ne[0]&&(Ne[0]={...Ne[0],value:t}),U.variants=Ne,z?ge[a]={...A,section:U}:ge[a]=U}else O.isLazy?ge[a]={...A,section:t}:ge[a]=t;if(C.length>1){const z=F.sections,U=[...z?.variants??[]];U[Y]&&(U[Y]={...U[Y],value:ge}),F.sections={...z,variants:U}}else F.sections=ge;be.mutate({blockKey:x,data:F},{onSuccess:()=>g?.(),onError:z=>G.error(`Save failed: ${z.message}`)})},on)},Ka=t=>{T(t),L(0),M([]),X(f=>f+1);const a=I[t],s=Pe[t];if(!a||!s)return;if(s.isMultivariate){at(a,s,0,t);return}const i=ut(a,s,o);if(!i){P(null),D(null),he(null),Q(null),vt(null,t,0);return}P(i.data),D(i.resolveType),he(null),Q(null),vt(null,t,0)},gn=t=>{const a=t;P(a),u!==null&&Ea(a,u)},Zt=t=>{if(!j||!o||!l||!ze)return;const a={kind:"page",pageKey:j,pageName:String(ze.name??""),path:String(ze.path??"")},s=$n(o,a,l);s&&Ht.save(j,()=>{const i=xa.getQueryData(xs.decofile(ba))?.[j];if(!i||typeof i!="object"||i===null||Array.isArray(i))return null;const f={...i,...Wt.current};return Wt.current={},t?.raw!==void 0?{...f,seo:t.raw}:t?.inner!==void 0?Ar(a,s,f,t.inner):f})},$a=(t,a)=>{j&&(Wt.current[t]=a,Zt())},Oa=(t,a)=>{if(!j)return;const s=Rt([...I],t,a);u!==null&&(u===t?T(a):t<u&&a>=u?T(u-1):t>u&&a<=u&&T(u+1)),Ue(s)},Ba=t=>{if(!j)return;const a=I.filter((s,i)=>i!==t);u===t?St():u!==null&&u>t&&T(u-1),Ue(a)},La=t=>{if(!j)return;const a=I[t];if(!a)return;const s=[...I];s.splice(t+1,0,nr(a)),u!==null&&u>t&&T(u+1),Ue(s)},Fa=t=>{if(!j)return;const a=I[t],s=Pe[t];if(!a||!s||s.isMultivariate)return;const i=s.isHidden?er(a):tr(a);if(!i)return;const f=[...I];f[t]=i,u===t&&St(),Ue(f)},Ia=t=>{if(!j)return;const a=I[t],s=Pe[t];if(!a||!s||s.isMultivariate)return;const i=Zs(a);if(!i)return;const f=[...I];f[t]=i,u===t&&St(),Ue(f)},za=t=>{if(!j)return;const a=I[t],s=Pe[t];if(!a||!s?.isSavedBlock)return;const i=ut(a,s,o);if(!i?.data)return;const{name:f,...b}=i.data,x=[...I];s.isLazy?x[t]={...a,section:b}:x[t]=b,u===t&&St(),Ue(x)},Ha=t=>{if(!j)return;const a=[...I,{__resolveType:t.resolveType}],s=a.length-1;Ue(a,{onSuccess:()=>{de(!1),T(s),L(0),M([]),X(x=>x+1);const i=a[s],f=Bt(a,o)[s];if(!i||!f)return;if(f.isMultivariate){at(i,f,0);return}const b=ut(i,f,o);if(!b){P(null),D(null),he(null),Q(null);return}P(b.data),D(b.resolveType),he(null),Q(null)}})},Ua=t=>{if(u===null)return;const a=I[u],s=Pe[u];!a||!s?.isMultivariate||(L(t),M([]),X(i=>i+1),at(a,s,t,u,!0))},Ga=t=>{if(u===null||!j)return;const a=I[u],s=Pe[u];if(!a||!s?.isMultivariate)return;const i=Je(a,s);if(!i)return;const f=Js(i,t);if(!f){G.error("Cannot delete the only variant.");return}const b=[...I];b[u]=dt(a,s,f);const x=f.variants;let C=ee;t===ee?C=Math.min(t,x.length-1):t<ee&&(C=ee-1),L(C),M([]),X(Y=>Y+1),at(b[u],s,C),Ue(b)},Wa=t=>{if(u===null||!j)return;const a=I[u],s=Pe[u];if(!a||!s?.isMultivariate)return;const i=Je(a,s);if(!i)return;const f=Qs(i,t),b=[...I];b[u]=dt(a,s,f);const x=t+1;L(x),M([]),X(C=>C+1),at(b[u],s,x),Ue(b)},qa=(t,a)=>{if(u===null||!j||t===a)return;const s=I[u],i=Pe[u];if(!s||!i?.isMultivariate)return;const f=Je(s,i);if(!f)return;const b=qs(f,t,a),x=[...I];x[u]=dt(s,i,b);let C=ee;ee===t?C=a:t<ee&&a>=ee?C=ee-1:t>ee&&a<=ee&&(C=ee+1),L(C),at(x[u],i,C),Ue(x)},en=t=>{const a=t??u;if(a===null||!j)return;const s=I[a],i=Pe[a];if(!s||!i)return;const f=Us(s,i);if(!f){G.error("This section cannot have variants.");return}const b=[...I];b[a]=f.section;const x=Bt(b,o)[a];if(!x?.isMultivariate){G.error("Could not add variant.");return}T(a),L(f.newVariantIndex),M([]),X(C=>C+1),at(f.section,x,f.newVariantIndex,a),Ue(b)},Ya=()=>{if(u===null||!j)return;const t=I[u],a=Pe[u];if(!t||!a?.isMultivariate)return;const s=Je(t,a);if(!s)return;const i=Ys(t,a,s);if(!i){G.error("Could not remove variants.");return}const f=[...I];f[u]=i;const b=Bt(f,o)[u];if(!b)return;L(0),he(null),Q(null),M([]),X(C=>C+1);const x=ut(i,b,o);x?(P(x.data),D(x.resolveType)):(P(null),D(null)),vt(null,u,0),Ue(f)},Ja=async t=>{if(De===null||!j)return;const a=rn(t,o);if(a){G.error(a);return}const s=I[De],i=Pe[De];if(!s||!i)return;const f=ut(s,i,o);if(!f){G.error("This section cannot be saved as global.");return}const b={...f.data,name:t};try{await be.mutateAsync({blockKey:t,data:b});const x=[...I];x[De]={__resolveType:t},await be.mutateAsync({blockKey:j,data:wt(o,j,x,Ce,Be)}),u===De&&St(),ve(null),G.success(`Saved global block "${t}"`),g?.()}catch(x){G.error(x instanceof Error?x.message:"Failed to save global block")}},vn=nt?.rule;if(Tt&&u===null&&ue===null&&vn){const{resolveType:t,formValue:a}=jt(vn,o??{},l??void 0);ie(t),E(a)}const At=l?Bs(l):[],Sn=l&&o?Ls(l,o):[],Qa=!_e&&!!(d&&l&&o),xn=ue&&l?Ot(ue,l):null,Mt=()=>{ht.current&&(clearTimeout(ht.current),ht.current=null),gt.current&&(clearTimeout(gt.current),gt.current=null)},_t=async(t,a)=>{if(!(sr(a,t,l)>0))try{await Ut.mutateAsync({blockKey:t})}catch(s){G.error(s instanceof Error?s.message:"Could not delete matcher block")}},bn=t=>{ht.current&&clearTimeout(ht.current),ht.current=setTimeout(()=>{const{activePageKey:a,decofile:s,variantIndex:i}=qe.current;if(!a)return;const f={...s[a]},b={...f.sections},x=[...b.variants??[]],C=x[i],Y=C?.rule;if(xt(Y,s,l)){const A=Y?.__resolveType??"",O=s[A],F=typeof O?.name=="string"?O.name:A,{__resolveType:ge,...z}=t;be.mutate({blockKey:A,data:bt(ge??"",z,F)},{onSuccess:()=>g?.(),onError:U=>G.error(`Save failed: ${U.message}`)});return}C&&(x[i]={...C,rule:t}),f.sections={...b,variants:x},be.mutate({blockKey:a,data:f},{onSuccess:()=>g?.(),onError:A=>G.error(`Save failed: ${A.message}`)})},on)},Xa=t=>{ie(t);const a=t?{__resolveType:t}:{__resolveType:Kn};E({}),bn(a)},Za=t=>{const a=t;E(a);const s=ue?{__resolveType:ue,...a}:{...a};bn(s)},es=async t=>{Mt();const{activePageKey:a,decofile:s,variantIndex:i}=qe.current;if(!a)return;const f=s[a],b=f?.sections;if(!b||typeof b!="object"||Array.isArray(b))return;const x=b;if(!Array.isArray(x.variants))return;const C=[...x.variants],Y=C[i];if(!Y)return;const A=kt(Y.rule,s,l),O=Ft(t);C[i]={...Y,rule:O};const F={...s,[a]:{...f,sections:{...x,variants:C}}},{resolveType:ge,formValue:z}=jt(O,F,l??void 0);ie(ge),E(z);try{await be.mutateAsync({blockKey:a,data:F[a]}),A&&A!==t&&await _t(A,F),g?.()}catch(U){G.error(U instanceof Error?U.message:"Could not apply saved rule")}},yn=t=>{gt.current&&clearTimeout(gt.current);const{selectedSectionIndex:a,sectionVariantIndex:s}=qe.current;a!==null&&(gt.current=setTimeout(()=>{const{rawSections:i,parsedSections:f,decofile:b,activePageKey:x,pageVariants:C,variantIndex:Y}=qe.current;if(!x)return;const A=i[a],O=f[a];if(!A||!O?.isMultivariate)return;const F=Je(A,O);if(!F)return;const z=(F.variants??[])[s]?.rule;if(xt(z,b,l)){const fe=z?.__resolveType??"",Ge=b[fe],Ze=typeof Ge?.name=="string"?Ge.name:fe,{__resolveType:rt,...et}=t;be.mutate({blockKey:fe,data:bt(rt??"",et,Ze)},{onSuccess:()=>g?.(),onError:ot=>G.error(`Save failed: ${ot.message}`)});return}const U=Pn(F,s,t),Ne=[...i];Ne[a]=dt(A,O,U);const Ye=wt(b,x,Ne,Y,C);be.mutate({blockKey:x,data:Ye},{onSuccess:()=>g?.(),onError:fe=>G.error(`Save failed: ${fe.message}`)})},on))},ts=t=>{he(t),Q({}),yn(t?{__resolveType:t}:{__resolveType:Kn})},ns=t=>{const a=t;Q(a);const s=Ie?{__resolveType:Ie,...a}:{...a};yn(s)},as=async t=>{Mt();const{selectedSectionIndex:a,sectionVariantIndex:s,rawSections:i,parsedSections:f,decofile:b,activePageKey:x,pageVariants:C,variantIndex:Y}=qe.current;if(a===null||!x)return;const A=i[a],O=f[a];if(!A||!O?.isMultivariate)return;const F=Je(A,O);if(!F)return;const ge=F.variants??[],z=kt(ge[s]?.rule,b,l),U=Ft(t),Ne=Pn(F,s,U),Ye=[...i];Ye[a]=dt(A,O,Ne);const fe=wt(b,x,Ye,Y,C),Ge={...b,[x]:fe},{resolveType:Ze,formValue:rt}=jt(U,Ge,l??void 0);he(Ze),Q(rt);try{await be.mutateAsync({blockKey:x,data:fe}),z&&z!==t&&await _t(z,Ge),g?.()}catch(et){G.error(et instanceof Error?et.message:"Could not apply saved rule")}};if(!_e&&!ze)return n.jsxs("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:["No page found for ",h]});if(_e&&!qt)return n.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:"Global block not found"});const st=u!==null?Pe[u]??null:null,_n=u!==null?I[u]:null,jn=_n&&st?.isMultivariate?Je(_n,st):null,lt=jn?Vn(jn,tt):[],tn=Math.min(ee,Math.max(lt.length-1,0)),Et=lt[tn]??null,ct=st?.isMultivariate===!0,kn=u!==null&&st!==null,Kt=kn&&(ct||!!(Xt&&se)),ss=Kt&&!_e&&st?.isSavedBlock===!0,Xe=_e||ss,rs=_e?mn:st?.label??"",wn=Ie&&l?Ot(Ie,l):null,nn=Kt&&(!_e||je.length>0)?_e?[mn,...je]:[ze.name,st.label,...ct&&Et?[Et.label]:[],...je]:[],os=Z&&ze?[ze.name,"SEO",...Me]:[],$t=Z?os:Xe?nn.length>0?nn:[rs]:nn,Rn=()=>{if(!j)return;const t=o[j],a=Gs(t.sections,I);if(!a)return;const s=Ws(a);be.mutate({blockKey:j,data:{...t,sections:a}},{onSuccess:()=>{B(s),T(null),P(null),D(null),M([]),E(null),ie(null)},onError:i=>G.error(`Save failed: ${i.message}`)})},an=(t,a,s)=>{if(!j)return;const i=o[j],f=i.sections;if(!f||typeof f!="object"||Array.isArray(f))return;const b=f;if(!Array.isArray(b.variants))return;const x=t([...b.variants]);if(!x)return;const C=or(b,x),Y={...o,[j]:{...i,sections:C}};be.mutate({blockKey:j,data:Y[j]},{onSuccess:()=>{a?.(),s&&_t(s,Y)},onError:A=>G.error(`Save failed: ${A.message}`)})},is=t=>{W(null),B(t),T(null),P(null),D(null),M([]);const a=Be[t]?.rule,{resolveType:s,formValue:i}=jt(a,o??{},l??void 0);ie(s),E(i),hn(Be.map(f=>({rule:f.rule})),t)},ls=(t,a)=>{if(t===a)return;let s=Ce;Ce===t?s=a:t<Ce&&a>=Ce?s=Ce-1:t>Ce&&a<=Ce&&(s=Ce+1),B(s);const i=Rt(Be.map(f=>({rule:f.rule})),t,a);hn(i,s),an(f=>Rt(f,t,a))},cs=t=>{const a=Be[t]?.rule,s=kt(a,o??{},l??void 0);an(i=>i.length<=1?null:(i.splice(t,1),i),()=>{Be.length-1===1?B(0):t<Ce?B(Ce-1):t===Ce&&B(Math.max(0,t-1)),T(null),P(null),D(null),M([]),E(null),ie(null)},s)},us=t=>{an(a=>ir(a,t),()=>{B(t+1),T(null),P(null),D(null),M([]),E(null),ie(null)})},ds=async(t,a)=>{Mt();const s=qe.current.activePageKey,i=qe.current.decofile;if(!s)return;const f=i[s],b=f.sections;if(!b||typeof b!="object"||Array.isArray(b))return;const x=b;if(!Array.isArray(x.variants))return;const C=[...x.variants],Y=C[t];if(!Y?.rule||typeof Y.rule!="object"){G.error("This variant has no matcher rule to rename.");return}const A=Y.rule,O=a.trim();Ct(!0);try{if(!O){if(!xt(A,i,l)){W(null);return}const Ye=A.__resolveType??"";C[t]={...Y,rule:An(A,i,l)};const fe={...i,[s]:{...f,sections:{...x,variants:C}}};await be.mutateAsync({blockKey:s,data:fe[s]}),await _t(Ye,fe),W(null),g?.();return}const F=Mn(A,i,l);if(!F){G.error("Could not read this variant's matcher rule.");return}if(F.blockKey){await be.mutateAsync({blockKey:F.blockKey,data:bt(F.resolveType,F.data,O)}),W(null),g?.();return}const ge=sn(O),z=rn(ge,i);if(z){G.error(z);return}const U=bt(F.resolveType,F.data,O);let Ne=null;try{await be.mutateAsync({blockKey:ge,data:U}),Ne=ge,C[t]={...Y,rule:Ft(ge)},await be.mutateAsync({blockKey:s,data:{...f,sections:{...x,variants:C}}}),Ne=null}catch(Ye){throw Ne&&await Ut.mutateAsync({blockKey:Ne}).catch(()=>{}),Ye}W(null),G.success(`Saved matcher as global block "${O}"`),g?.()}catch(F){G.error(F instanceof Error?F.message:"Failed to rename variant")}finally{Ct(!1)}},ms=async(t,a)=>{Mt();const{selectedSectionIndex:s,rawSections:i,parsedSections:f,decofile:b,activePageKey:x,pageVariants:C,variantIndex:Y}=qe.current;if(s===null||!x)return;const A=i[s],O=f[s];if(!A||!O?.isMultivariate)return;const F=Je(A,O);if(!F)return;const ge=F.variants??[],z=ge[t];if(!z?.rule||typeof z.rule!="object"){G.error("This variant has no matcher rule to rename.");return}const U=z.rule,Ne=a.trim();Ct(!0);const Ye=async fe=>{const Ge={...F,variants:fe},Ze=[...i];Ze[s]=dt(A,O,Ge);const rt=wt(b,x,Ze,Y,C);return await be.mutateAsync({blockKey:x,data:rt}),{...b,[x]:rt}};try{if(!Ne){if(!xt(U,b,l)){ne(null);return}const ot=U.__resolveType??"",Cn=[...ge];Cn[t]={...z,rule:An(U,b,l)};const vs=await Ye(Cn);await _t(ot,vs),ne(null),g?.();return}const fe=Mn(U,b,l);if(!fe){G.error("Could not read this variant's matcher rule.");return}if(fe.blockKey){await be.mutateAsync({blockKey:fe.blockKey,data:bt(fe.resolveType,fe.data,Ne)}),ne(null),g?.();return}const Ge=sn(Ne),Ze=rn(Ge,b);if(Ze){G.error(Ze);return}const rt=bt(fe.resolveType,fe.data,Ne);let et=null;try{await be.mutateAsync({blockKey:Ge,data:rt}),et=Ge;const ot=[...ge];ot[t]={...z,rule:Ft(Ge)},await Ye(ot),et=null}catch(ot){throw et&&await Ut.mutateAsync({blockKey:et}).catch(()=>{}),ot}ne(null),G.success(`Saved matcher as global block "${Ne}"`),g?.()}catch(fe){G.error(fe instanceof Error?fe.message:"Failed to rename variant")}finally{Ct(!1)}},Nn=()=>{St()},fs=t=>{Te(t),Zt({inner:t})},ps=t=>{Fe(t),Zt({raw:t})},hs=()=>{Te(null),xe([])},gs=()=>me(t=>t+1),Dn=t=>{if(Z){if(t===0){Ht.flush(),we(!1),Te(null),Fe(void 0),xe([]),me(s=>s+1),V?.();return}if(t===1){xe([]),me(s=>s+1);return}xe(Me.slice(0,t-1)),me(s=>s+1);return}if(_e){M(je.slice(0,t)),X(s=>s+1);return}if(t===0){Nn();return}if(t===1){M([]),X(s=>s+1);return}if(ct&&t===2){M([]),X(s=>s+1);return}const a=ct?2:1;M(je.slice(0,t-a))};return n.jsxs("div",{className:"flex h-full min-w-0 w-full flex-col",children:[n.jsx("div",{className:"shrink-0",children:Xe||Kt||Z?n.jsxs("div",{className:Ee("border-b px-3 py-2.5",Xe&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[$t.length>1&&n.jsx("button",{type:"button",onClick:()=>Dn($t.length-2),title:"Back","aria-label":"Back",className:Ee("shrink-0 inline-flex size-6 items-center justify-center rounded-md transition-colors",Xe?"text-foreground/80 hover:bg-global-section/15":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:n.jsx(ra,{className:"size-4"})}),!_e&&Tt&&nt&&n.jsxs("button",{type:"button",onClick:Nn,title:`Editing in variant: ${nt.label}`,className:Ee("shrink-0 inline-flex items-center gap-1 rounded-md h-6 px-1.5 text-xs font-medium cursor-pointer transition-opacity hover:opacity-80",ro),children:[n.jsx(va,{rule:Nt(nt.rule,o??{},l??void 0),matchers:At}),n.jsx("span",{className:"max-w-[160px] truncate",children:nt.label})]}),n.jsx("nav",{"aria-label":"Editing breadcrumb",className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:$t.map((t,a)=>{const s=a===$t.length-1;return n.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[a>0&&n.jsx(oa,{className:"size-3 shrink-0 text-muted-foreground/60"}),n.jsx("button",{type:"button",onClick:()=>Dn(a),title:t,className:Ee("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors",s?Xe?"font-semibold text-global-section-fg dark:text-global-section-fg-dark":"font-medium text-foreground":Xe?"text-foreground/80":"text-muted-foreground",Xe?"hover:bg-global-section/15":"hover:bg-accent hover:text-accent-foreground"),children:t})]},`${t}-${a}`)})}),Xe&&n.jsxs(mt,{children:[n.jsx(ft,{asChild:!0,children:n.jsx("span",{className:"shrink-0 cursor-help",children:n.jsx(fr,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),n.jsx(pt,{side:"bottom",className:"max-w-[260px]",children:"A global section is a reusable block shared across your site. Editing it here updates it everywhere it's used."})]}),kn&&!ct&&!st?.isHidden&&j&&n.jsx(zn,{onClick:()=>en()})]}),Xe&&n.jsx("p",{className:"mt-1.5 py-1.5 pl-1 text-sm leading-snug text-foreground",children:"This is a global section. Changes apply everywhere this section is used across your site."})]}):n.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2.5",children:[n.jsx("div",{className:"flex-1 min-w-0",children:n.jsx(io,{pageKey:j,initialName:ze.name,initialPath:ze.path,onFieldChange:$a})}),n.jsxs(mt,{children:[n.jsx(ft,{asChild:!0,children:n.jsx(We,{type:"button",variant:"ghost",size:"icon","aria-label":"Edit SEO",className:"size-7 shrink-0",onClick:()=>we(!0),children:n.jsx(dr,{size:14})})}),n.jsx(pt,{side:"bottom",children:"Edit SEO"})]}),n.jsxs(mt,{children:[n.jsx(ft,{asChild:!0,children:n.jsx(We,{type:"button",variant:"ghost",size:"icon","aria-label":"View JSON",className:"size-7 shrink-0",onClick:()=>R&&j?R(j):$(!0),children:n.jsx(mr,{size:14})})}),n.jsx(pt,{side:"bottom",children:"View JSON"})]}),n.jsx(zn,{onClick:Rn})]})}),Z?n.jsx(It,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:n.jsx("div",{className:"mx-auto max-w-2xl",children:Vt&&j?n.jsx(Pr,{rawSeo:Jt,innerSeo:fn,defaultResolveType:Ta,seoSchema:Pa,activeResolveType:Qt,seoTypeOptions:Va,formResetKey:Re,siteDefaultSeo:Aa,onBreadcrumbChange:xe,onPersistRaw:ps,onInnerChange:fs,onClearForm:hs,onBumpFormKey:gs}):n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"SEO schema not found for this site."})})})}):Kt?n.jsxs(It,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[ct&<.length>0&&n.jsxs(n.Fragment,{children:[n.jsx(Fs,{listKey:`${j??""}:${u??""}`,variants:lt.map((t,a)=>({index:a,label:t.label})),selectedIndex:tn,onSelect:Ua,onRename:ne,onDuplicate:Wa,onDelete:Ga,onRemoveAll:Ya,onReorder:qa,onAdd:()=>en()}),ct&&n.jsxs("div",{className:"px-3 py-3 border-b space-y-2",children:[n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Variant rule"}),n.jsx(Tn,{currentRt:Ie??"",currentLabel:Lt(Et?.rule,o??{},tt,l??void 0),currentGlobalKey:kt(Et?.rule,o??{},l??void 0)??void 0,matchers:At,globals:Sn,onSelect:ts,onSelectGlobal:as}),wn&&ae&&n.jsx("div",{className:"pt-1",children:n.jsx(Fn,{schema:wn,value:ae,onChange:ns,meta:l??void 0,decofile:o,onSaveReferencedBlock:Dt,sandbox:Pt},`${u??"none"}:${tn}:${Ie??""}`)})]})]}),n.jsx(In,{activeSchema:Xt,formValue:se,formResetKey:Ae,onFormChange:gn,onBreadcrumbChange:M,breadcrumbPath:je,emptyMessage:"No editable fields for this variant.",meta:l,decofile:o,onSaveReferencedBlock:Dt,sandbox:Pt})]}):_e?n.jsx(It,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx(In,{activeSchema:Xt,formValue:se,formResetKey:Ae,onFormChange:gn,onBreadcrumbChange:M,breadcrumbPath:je,emptyMessage:"No editable fields for this global block.",meta:l,decofile:o,onSaveReferencedBlock:Dt,sandbox:Pt})}):n.jsxs(It,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[Tt&&j&&n.jsx(ao,{listKey:j,variants:Be,activeIndex:Ce,decofile:o??{},meta:l,matchers:At,onSelect:is,onReorder:ls,onRename:W,onDuplicate:us,onDelete:cs,onAdd:Rn}),Tt&&ue!==null&&n.jsxs("div",{className:Ee("px-3 border-b",le?"pt-3 pb-5 space-y-3":"py-2"),children:[n.jsxs("button",{type:"button",onClick:()=>ke(t=>!t),className:"flex w-full items-center justify-between gap-2 text-left cursor-pointer rounded-sm py-0.5 hover:bg-muted/40","aria-expanded":le,children:[n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Variant rule"}),le?n.jsx(cr,{className:"size-3.5 shrink-0 text-muted-foreground"}):n.jsx(lr,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),le&&n.jsxs("div",{className:Ee("space-y-3",yt&&"pointer-events-none opacity-50"),children:[n.jsx(Tn,{currentRt:ue,currentLabel:Lt(nt?.rule,o??{},tt,l??void 0),currentGlobalKey:kt(nt?.rule,o??{},l??void 0)??void 0,matchers:At,globals:Sn,onSelect:Xa,onSelectGlobal:es}),xn&&Ve&&n.jsx("div",{className:"space-y-3",children:n.jsx(Fn,{schema:xn,value:Ve,onChange:Za,meta:l??void 0,decofile:o,onSaveReferencedBlock:Dt,sandbox:Pt},`${Ce}:${ue??""}`)})]})]}),n.jsx("div",{className:"p-2 pt-3",children:n.jsx(qr,{listKey:`${j??""}-${Ce}`,rawSections:I,sections:Pe,meta:l,selectedIndex:u,onSelect:Ka,onReorder:Oa,onDelete:Ba,onDuplicate:La,onMakeReusable:ve,onToggleHidden:Fa,onToggleLazy:Ia,onAddVariant:en,onDetach:za,onAddSection:()=>de(!0),canAddSection:Qa})})]}),n.jsx(Is,{open:De!==null,onOpenChange:t=>{t||ve(null)},defaultBlockId:De!==null?sn(Pe[De]?.label??""):"",isPending:be.isPending,onSubmit:Ja}),d&&n.jsx(Er,{open:Se,onOpenChange:de,meta:l,decofile:o,previewBaseUrl:d,onSelect:Ha}),ye&&j&&o&&n.jsx(zs,{open:ye,onOpenChange:$,pageKey:j,decofile:o}),re!==null&&n.jsx(Bn,{open:!0,initialName:xt(Be[re]?.rule,o??{},l??void 0)?Lt(Be[re]?.rule,o??{},tt,l??void 0):"",autoLabel:tt(Nt(Be[re]?.rule,o??{},l??void 0)),isPending:yt,onSubmit:async t=>{await ds(re,t)},onOpenChange:t=>{!t&&!yt&&W(null)}}),q!==null&&n.jsx(Bn,{open:!0,initialName:xt(lt[q]?.rule,o??{},l??void 0)?Lt(lt[q]?.rule,o??{},tt,l??void 0):"",autoLabel:tt(Nt(lt[q]?.rule,o??{},l??void 0)),isPending:yt,onSubmit:async t=>{await ms(q,t)},onOpenChange:t=>{!t&&!yt&&ne(null)}})]})}export{ic as SectionsEditor};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as i,aT as nt,aR as Pe,j as d,cR as rt,aV as be,aS as k,cS as st,aO as j,aU as _,bM as $,cT as lt,at as Ne,cU as Ee,aP as at,bI as ct,bO as it,c_ as dt,c$ as ut,d0 as pt,d1 as ft,cV as mt,aQ as ht,d2 as vt,cW as gt,cY as xt,c as ee,l as oe}from"./index-DF3zg-P1.js";import{V as St}from"./tooltip-O3iHy7-o.js";import{i as wt}from"./Check-BF3t7WWi.js";import{t as Re}from"./ChevronDown-CQLSXgt3.js";import{n as Ct}from"./ChevronUp-Y-IpPAUR.js";function _e(r,[e,t]){return Math.min(t,Math.max(e,r))}var yt=[" ","Enter","ArrowUp","ArrowDown"],It=[" ","Enter"],Q="Select",[de,ue,bt]=at(Q),[ne]=ht(Q,[bt,Ee]),pe=Ee(),[Tt,G]=ne(Q),[Pt,_t]=ne(Q),je=r=>{const{__scopeSelect:e,children:t,open:o,defaultOpen:n,onOpenChange:c,value:s,defaultValue:l,onValueChange:a,dir:u,name:h,autoComplete:g,disabled:b,required:w,form:S}=r,p=pe(e),[v,C]=i.useState(null),[m,x]=i.useState(null),[U,M]=i.useState(!1),re=nt(u),[N,O]=Pe({prop:o,defaultProp:n??!1,onChange:c,caller:Q}),[F,q]=Pe({prop:s,defaultProp:l,onChange:a,caller:Q}),L=i.useRef(null),B=v?S||!!v.closest("form"):!0,[W,V]=i.useState(new Set),H=Array.from(W).map(E=>E.props.value).join(";");return d.jsx(rt,{...p,children:d.jsxs(Tt,{required:w,scope:e,trigger:v,onTriggerChange:C,valueNode:m,onValueNodeChange:x,valueNodeHasChildren:U,onValueNodeHasChildrenChange:M,contentId:be(),value:F,onValueChange:q,open:N,onOpenChange:O,dir:re,triggerPointerDownPosRef:L,disabled:b,children:[d.jsx(de.Provider,{scope:e,children:d.jsx(Pt,{scope:r.__scopeSelect,onNativeOptionAdd:i.useCallback(E=>{V(D=>new Set(D).add(E))},[]),onNativeOptionRemove:i.useCallback(E=>{V(D=>{const z=new Set(D);return z.delete(E),z})},[]),children:t})}),B?d.jsxs(Je,{"aria-hidden":!0,required:w,tabIndex:-1,name:h,autoComplete:g,value:F,onChange:E=>q(E.target.value),disabled:b,form:S,children:[F===void 0?d.jsx("option",{value:""}):null,Array.from(W)]},H):null]})})};je.displayName=Q;var Me="SelectTrigger",Ae=i.forwardRef((r,e)=>{const{__scopeSelect:t,disabled:o=!1,...n}=r,c=pe(t),s=G(Me,t),l=s.disabled||o,a=k(e,s.onTriggerChange),u=ue(t),h=i.useRef("touch"),[g,b,w]=tt(p=>{const v=u().filter(x=>!x.disabled),C=v.find(x=>x.value===s.value),m=ot(v,p,C);m!==void 0&&s.onValueChange(m.value)}),S=p=>{l||(s.onOpenChange(!0),w()),p&&(s.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return d.jsx(st,{asChild:!0,...c,children:d.jsx(j.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":et(s.value)?"":void 0,...n,ref:a,onClick:_(n.onClick,p=>{p.currentTarget.focus(),h.current!=="mouse"&&S(p)}),onPointerDown:_(n.onPointerDown,p=>{h.current=p.pointerType;const v=p.target;v.hasPointerCapture(p.pointerId)&&v.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(S(p),p.preventDefault())}),onKeyDown:_(n.onKeyDown,p=>{const v=g.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&b(p.key),!(v&&p.key===" ")&&yt.includes(p.key)&&(S(),p.preventDefault())})})})});Ae.displayName=Me;var Oe="SelectValue",De=i.forwardRef((r,e)=>{const{__scopeSelect:t,className:o,style:n,children:c,placeholder:s="",...l}=r,a=G(Oe,t),{onValueNodeHasChildrenChange:u}=a,h=c!==void 0,g=k(e,a.onValueNodeChange);return $(()=>{u(h)},[u,h]),d.jsx(j.span,{...l,ref:g,style:{pointerEvents:"none"},children:et(a.value)?d.jsx(d.Fragment,{children:s}):c})});De.displayName=Oe;var Nt="SelectIcon",ke=i.forwardRef((r,e)=>{const{__scopeSelect:t,children:o,...n}=r;return d.jsx(j.span,{"aria-hidden":!0,...n,ref:e,children:o||"▼"})});ke.displayName=Nt;var Et="SelectPortal",Le=r=>d.jsx(lt,{asChild:!0,...r});Le.displayName=Et;var J="SelectContent",Be=i.forwardRef((r,e)=>{const t=G(J,r.__scopeSelect),[o,n]=i.useState();if($(()=>{n(new DocumentFragment)},[]),!t.open){const c=o;return c?Ne.createPortal(d.jsx(Ve,{scope:r.__scopeSelect,children:d.jsx(de.Slot,{scope:r.__scopeSelect,children:d.jsx("div",{children:r.children})})}),c):null}return d.jsx(He,{...r,ref:e})});Be.displayName=J;var A=10,[Ve,Y]=ne(J),Rt="SelectContentImpl",jt=vt("SelectContent.RemoveScroll"),He=i.forwardRef((r,e)=>{const{__scopeSelect:t,position:o="item-aligned",onCloseAutoFocus:n,onEscapeKeyDown:c,onPointerDownOutside:s,side:l,sideOffset:a,align:u,alignOffset:h,arrowPadding:g,collisionBoundary:b,collisionPadding:w,sticky:S,hideWhenDetached:p,avoidCollisions:v,...C}=r,m=G(J,t),[x,U]=i.useState(null),[M,re]=i.useState(null),N=k(e,f=>U(f)),[O,F]=i.useState(null),[q,L]=i.useState(null),B=ue(t),[W,V]=i.useState(!1),H=i.useRef(!1);i.useEffect(()=>{if(x)return dt(x)},[x]),ut();const E=i.useCallback(f=>{const[T,...R]=B().map(P=>P.ref.current),[y]=R.slice(-1),I=document.activeElement;for(const P of f)if(P===I||(P?.scrollIntoView({block:"nearest"}),P===T&&M&&(M.scrollTop=0),P===y&&M&&(M.scrollTop=M.scrollHeight),P?.focus(),document.activeElement!==I))return},[B,M]),D=i.useCallback(()=>E([O,x]),[E,O,x]);i.useEffect(()=>{W&&D()},[W,D]);const{onOpenChange:z,triggerPointerDownPosRef:K}=m;i.useEffect(()=>{if(x){let f={x:0,y:0};const T=y=>{f={x:Math.abs(Math.round(y.pageX)-(K.current?.x??0)),y:Math.abs(Math.round(y.pageY)-(K.current?.y??0))}},R=y=>{f.x<=10&&f.y<=10?y.preventDefault():x.contains(y.target)||z(!1),document.removeEventListener("pointermove",T),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",T),document.addEventListener("pointerup",R,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",T),document.removeEventListener("pointerup",R,{capture:!0})}}},[x,z,K]),i.useEffect(()=>{const f=()=>z(!1);return window.addEventListener("blur",f),window.addEventListener("resize",f),()=>{window.removeEventListener("blur",f),window.removeEventListener("resize",f)}},[z]);const[fe,ae]=tt(f=>{const T=B().filter(I=>!I.disabled),R=T.find(I=>I.ref.current===document.activeElement),y=ot(T,f,R);y&&setTimeout(()=>y.ref.current.focus())}),me=i.useCallback((f,T,R)=>{const y=!H.current&&!R;(m.value!==void 0&&m.value===T||y)&&(F(f),y&&(H.current=!0))},[m.value]),he=i.useCallback(()=>x?.focus(),[x]),te=i.useCallback((f,T,R)=>{const y=!H.current&&!R;(m.value!==void 0&&m.value===T||y)&&L(f)},[m.value]),ce=o==="popper"?Se:ze,se=ce===Se?{side:l,sideOffset:a,align:u,alignOffset:h,arrowPadding:g,collisionBoundary:b,collisionPadding:w,sticky:S,hideWhenDetached:p,avoidCollisions:v}:{};return d.jsx(Ve,{scope:t,content:x,viewport:M,onViewportChange:re,itemRefCallback:me,selectedItem:O,onItemLeave:he,itemTextRefCallback:te,focusSelectedItem:D,selectedItemText:q,position:o,isPositioned:W,searchRef:fe,children:d.jsx(pt,{as:jt,allowPinchZoom:!0,children:d.jsx(ft,{asChild:!0,trapped:m.open,onMountAutoFocus:f=>{f.preventDefault()},onUnmountAutoFocus:_(n,f=>{m.trigger?.focus({preventScroll:!0}),f.preventDefault()}),children:d.jsx(mt,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:()=>m.onOpenChange(!1),children:d.jsx(ce,{role:"listbox",id:m.contentId,"data-state":m.open?"open":"closed",dir:m.dir,onContextMenu:f=>f.preventDefault(),...C,...se,onPlaced:()=>V(!0),ref:N,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:_(C.onKeyDown,f=>{const T=f.ctrlKey||f.altKey||f.metaKey;if(f.key==="Tab"&&f.preventDefault(),!T&&f.key.length===1&&ae(f.key),["ArrowUp","ArrowDown","Home","End"].includes(f.key)){let y=B().filter(I=>!I.disabled).map(I=>I.ref.current);if(["ArrowUp","End"].includes(f.key)&&(y=y.slice().reverse()),["ArrowUp","ArrowDown"].includes(f.key)){const I=f.target,P=y.indexOf(I);y=y.slice(P+1)}setTimeout(()=>E(y)),f.preventDefault()}})})})})})})});He.displayName=Rt;var Mt="SelectItemAlignedPosition",ze=i.forwardRef((r,e)=>{const{__scopeSelect:t,onPlaced:o,...n}=r,c=G(J,t),s=Y(J,t),[l,a]=i.useState(null),[u,h]=i.useState(null),g=k(e,N=>h(N)),b=ue(t),w=i.useRef(!1),S=i.useRef(!0),{viewport:p,selectedItem:v,selectedItemText:C,focusSelectedItem:m}=s,x=i.useCallback(()=>{if(c.trigger&&c.valueNode&&l&&u&&p&&v&&C){const N=c.trigger.getBoundingClientRect(),O=u.getBoundingClientRect(),F=c.valueNode.getBoundingClientRect(),q=C.getBoundingClientRect();if(c.dir!=="rtl"){const I=q.left-O.left,P=F.left-I,X=N.left-P,Z=N.width+X,ve=Math.max(Z,O.width),ge=window.innerWidth-A,xe=_e(P,[A,Math.max(A,ge-ve)]);l.style.minWidth=Z+"px",l.style.left=xe+"px"}else{const I=O.right-q.right,P=window.innerWidth-F.right-I,X=window.innerWidth-N.right-P,Z=N.width+X,ve=Math.max(Z,O.width),ge=window.innerWidth-A,xe=_e(P,[A,Math.max(A,ge-ve)]);l.style.minWidth=Z+"px",l.style.right=xe+"px"}const L=b(),B=window.innerHeight-A*2,W=p.scrollHeight,V=window.getComputedStyle(u),H=parseInt(V.borderTopWidth,10),E=parseInt(V.paddingTop,10),D=parseInt(V.borderBottomWidth,10),z=parseInt(V.paddingBottom,10),K=H+E+W+z+D,fe=Math.min(v.offsetHeight*5,K),ae=window.getComputedStyle(p),me=parseInt(ae.paddingTop,10),he=parseInt(ae.paddingBottom,10),te=N.top+N.height/2-A,ce=B-te,se=v.offsetHeight/2,f=v.offsetTop+se,T=H+E+f,R=K-T;if(T<=te){const I=L.length>0&&v===L[L.length-1].ref.current;l.style.bottom="0px";const P=u.clientHeight-p.offsetTop-p.offsetHeight,X=Math.max(ce,se+(I?he:0)+P+D),Z=T+X;l.style.height=Z+"px"}else{const I=L.length>0&&v===L[0].ref.current;l.style.top="0px";const X=Math.max(te,H+p.offsetTop+(I?me:0)+se)+R;l.style.height=X+"px",p.scrollTop=T-te+p.offsetTop}l.style.margin=`${A}px 0`,l.style.minHeight=fe+"px",l.style.maxHeight=B+"px",o?.(),requestAnimationFrame(()=>w.current=!0)}},[b,c.trigger,c.valueNode,l,u,p,v,C,c.dir,o]);$(()=>x(),[x]);const[U,M]=i.useState();$(()=>{u&&M(window.getComputedStyle(u).zIndex)},[u]);const re=i.useCallback(N=>{N&&S.current===!0&&(x(),m?.(),S.current=!1)},[x,m]);return d.jsx(Ot,{scope:t,contentWrapper:l,shouldExpandOnScrollRef:w,onScrollButtonChange:re,children:d.jsx("div",{ref:a,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:U},children:d.jsx(j.div,{...n,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...n.style}})})})});ze.displayName=Mt;var At="SelectPopperPosition",Se=i.forwardRef((r,e)=>{const{__scopeSelect:t,align:o="start",collisionPadding:n=A,...c}=r,s=pe(t);return d.jsx(gt,{...s,...c,ref:e,align:o,collisionPadding:n,style:{boxSizing:"border-box",...c.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Se.displayName=At;var[Ot,Te]=ne(J,{}),we="SelectViewport",Ue=i.forwardRef((r,e)=>{const{__scopeSelect:t,nonce:o,...n}=r,c=Y(we,t),s=Te(we,t),l=k(e,c.onViewportChange),a=i.useRef(0);return d.jsxs(d.Fragment,{children:[d.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),d.jsx(de.Slot,{scope:t,children:d.jsx(j.div,{"data-radix-select-viewport":"",role:"presentation",...n,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...n.style},onScroll:_(n.onScroll,u=>{const h=u.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:b}=s;if(b?.current&&g){const w=Math.abs(a.current-h.scrollTop);if(w>0){const S=window.innerHeight-A*2,p=parseFloat(g.style.minHeight),v=parseFloat(g.style.height),C=Math.max(p,v);if(C<S){const m=C+w,x=Math.min(S,m),U=m-x;g.style.height=x+"px",g.style.bottom==="0px"&&(h.scrollTop=U>0?U:0,g.style.justifyContent="flex-end")}}}a.current=h.scrollTop})})})]})});Ue.displayName=we;var Fe="SelectGroup",[Dt,kt]=ne(Fe),Lt=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r,n=be();return d.jsx(Dt,{scope:t,id:n,children:d.jsx(j.div,{role:"group","aria-labelledby":n,...o,ref:e})})});Lt.displayName=Fe;var We="SelectLabel",Bt=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r,n=kt(We,t);return d.jsx(j.div,{id:n.id,...o,ref:e})});Bt.displayName=We;var ie="SelectItem",[Vt,Ke]=ne(ie),$e=i.forwardRef((r,e)=>{const{__scopeSelect:t,value:o,disabled:n=!1,textValue:c,...s}=r,l=G(ie,t),a=Y(ie,t),u=l.value===o,[h,g]=i.useState(c??""),[b,w]=i.useState(!1),S=k(e,m=>a.itemRefCallback?.(m,o,n)),p=be(),v=i.useRef("touch"),C=()=>{n||(l.onValueChange(o),l.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return d.jsx(Vt,{scope:t,value:o,disabled:n,textId:p,isSelected:u,onItemTextChange:i.useCallback(m=>{g(x=>x||(m?.textContent??"").trim())},[]),children:d.jsx(de.ItemSlot,{scope:t,value:o,disabled:n,textValue:h,children:d.jsx(j.div,{role:"option","aria-labelledby":p,"data-highlighted":b?"":void 0,"aria-selected":u&&b,"data-state":u?"checked":"unchecked","aria-disabled":n||void 0,"data-disabled":n?"":void 0,tabIndex:n?void 0:-1,...s,ref:S,onFocus:_(s.onFocus,()=>w(!0)),onBlur:_(s.onBlur,()=>w(!1)),onClick:_(s.onClick,()=>{v.current!=="mouse"&&C()}),onPointerUp:_(s.onPointerUp,()=>{v.current==="mouse"&&C()}),onPointerDown:_(s.onPointerDown,m=>{v.current=m.pointerType}),onPointerMove:_(s.onPointerMove,m=>{v.current=m.pointerType,n?a.onItemLeave?.():v.current==="mouse"&&m.currentTarget.focus({preventScroll:!0})}),onPointerLeave:_(s.onPointerLeave,m=>{m.currentTarget===document.activeElement&&a.onItemLeave?.()}),onKeyDown:_(s.onKeyDown,m=>{a.searchRef?.current!==""&&m.key===" "||(It.includes(m.key)&&C(),m.key===" "&&m.preventDefault())})})})})});$e.displayName=ie;var le="SelectItemText",Ge=i.forwardRef((r,e)=>{const{__scopeSelect:t,className:o,style:n,...c}=r,s=G(le,t),l=Y(le,t),a=Ke(le,t),u=_t(le,t),[h,g]=i.useState(null),b=k(e,C=>g(C),a.onItemTextChange,C=>l.itemTextRefCallback?.(C,a.value,a.disabled)),w=h?.textContent,S=i.useMemo(()=>d.jsx("option",{value:a.value,disabled:a.disabled,children:w},a.value),[a.disabled,a.value,w]),{onNativeOptionAdd:p,onNativeOptionRemove:v}=u;return $(()=>(p(S),()=>v(S)),[p,v,S]),d.jsxs(d.Fragment,{children:[d.jsx(j.span,{id:a.textId,...c,ref:b}),a.isSelected&&s.valueNode&&!s.valueNodeHasChildren?Ne.createPortal(c.children,s.valueNode):null]})});Ge.displayName=le;var Ye="SelectItemIndicator",qe=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r;return Ke(Ye,t).isSelected?d.jsx(j.span,{"aria-hidden":!0,...o,ref:e}):null});qe.displayName=Ye;var Ce="SelectScrollUpButton",Xe=i.forwardRef((r,e)=>{const t=Y(Ce,r.__scopeSelect),o=Te(Ce,r.__scopeSelect),[n,c]=i.useState(!1),s=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=a.scrollTop>0;c(u)};const a=t.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),n?d.jsx(Qe,{...r,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:a}=t;l&&a&&(l.scrollTop=l.scrollTop-a.offsetHeight)}}):null});Xe.displayName=Ce;var ye="SelectScrollDownButton",Ze=i.forwardRef((r,e)=>{const t=Y(ye,r.__scopeSelect),o=Te(ye,r.__scopeSelect),[n,c]=i.useState(!1),s=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=a.scrollHeight-a.clientHeight,h=Math.ceil(a.scrollTop)<u;c(h)};const a=t.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),n?d.jsx(Qe,{...r,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:a}=t;l&&a&&(l.scrollTop=l.scrollTop+a.offsetHeight)}}):null});Ze.displayName=ye;var Qe=i.forwardRef((r,e)=>{const{__scopeSelect:t,onAutoScroll:o,...n}=r,c=Y("SelectScrollButton",t),s=i.useRef(null),l=ue(t),a=i.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return i.useEffect(()=>()=>a(),[a]),$(()=>{l().find(h=>h.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[l]),d.jsx(j.div,{"aria-hidden":!0,...n,ref:e,style:{flexShrink:0,...n.style},onPointerDown:_(n.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(o,50))}),onPointerMove:_(n.onPointerMove,()=>{c.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(o,50))}),onPointerLeave:_(n.onPointerLeave,()=>{a()})})}),Ht="SelectSeparator",zt=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r;return d.jsx(j.div,{"aria-hidden":!0,...o,ref:e})});zt.displayName=Ht;var Ie="SelectArrow",Ut=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r,n=pe(t),c=G(Ie,t),s=Y(Ie,t);return c.open&&s.position==="popper"?d.jsx(xt,{...n,...o,ref:e}):null});Ut.displayName=Ie;var Ft="SelectBubbleInput",Je=i.forwardRef(({__scopeSelect:r,value:e,...t},o)=>{const n=i.useRef(null),c=k(o,n),s=ct(e);return i.useEffect(()=>{const l=n.current;if(!l)return;const a=window.HTMLSelectElement.prototype,h=Object.getOwnPropertyDescriptor(a,"value").set;if(s!==e&&h){const g=new Event("change",{bubbles:!0});h.call(l,e),l.dispatchEvent(g)}},[s,e]),d.jsx(j.select,{...t,style:{...St,...t.style},ref:c,defaultValue:e})});Je.displayName=Ft;function et(r){return r===""||r===void 0}function tt(r){const e=it(r),t=i.useRef(""),o=i.useRef(0),n=i.useCallback(s=>{const l=t.current+s;e(l),(function a(u){t.current=u,window.clearTimeout(o.current),u!==""&&(o.current=window.setTimeout(()=>a(""),1e3))})(l)},[e]),c=i.useCallback(()=>{t.current="",window.clearTimeout(o.current)},[]);return i.useEffect(()=>()=>window.clearTimeout(o.current),[]),[t,n,c]}function ot(r,e,t){const n=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,c=t?r.indexOf(t):-1;let s=Wt(r,Math.max(c,0));n.length===1&&(s=s.filter(u=>u!==t));const a=s.find(u=>u.textValue.toLowerCase().startsWith(n.toLowerCase()));return a!==t?a:void 0}function Wt(r,e){return r.map((t,o)=>r[(e+o)%r.length])}var Kt=je,$t=Ae,Gt=De,Yt=ke,qt=Le,Xt=Be,Zt=Ue,Qt=$e,Jt=Ge,eo=qe,to=Xe,oo=Ze;function uo(r){const e=ee.c(4);let t;e[0]!==r?({...t}=r,e[0]=r,e[1]=t):t=e[1];let o;return e[2]!==t?(o=d.jsx(Kt,{"data-slot":"select",...t}),e[2]=t,e[3]=o):o=e[3],o}function po(r){const e=ee.c(4);let t;e[0]!==r?({...t}=r,e[0]=r,e[1]=t):t=e[1];let o;return e[2]!==t?(o=d.jsx(Gt,{"data-slot":"select-value",...t}),e[2]=t,e[3]=o):o=e[3],o}function fo(r){const e=ee.c(13);let t,o,n,c;e[0]!==r?({className:o,size:c,children:t,...n}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=n,e[4]=c):(t=e[1],o=e[2],n=e[3],c=e[4]);const s=c===void 0?"default":c;let l;e[5]!==o?(l=oe("data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/20 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 hover:bg-accent hover:text-accent-foreground dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-lg bg-background px-3 py-2 text-sm whitespace-nowrap transition-[color,box-shadow] outline-none focus-visible:ring-[2px] card-shadow disabled:opacity-50 data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=xs]:h-6 data-[size=xs]:px-2.5 data-[size=xs]:py-1.5 data-[size=xs]:rounded-lg *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",o),e[5]=o,e[6]=l):l=e[6];let a;e[7]===Symbol.for("react.memo_cache_sentinel")?(a=d.jsx(Yt,{asChild:!0,children:d.jsx(Re,{className:"size-4 opacity-50"})}),e[7]=a):a=e[7];let u;return e[8]!==t||e[9]!==n||e[10]!==s||e[11]!==l?(u=d.jsxs($t,{"data-slot":"select-trigger","data-size":s,className:l,...n,children:[t,a]}),e[8]=t,e[9]=n,e[10]=s,e[11]=l,e[12]=u):u=e[12],u}function mo(r){const e=ee.c(25);let t,o,n,c,s;e[0]!==r?({className:o,children:t,position:c,hideScrollButtons:s,...n}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=n,e[4]=c,e[5]=s):(t=e[1],o=e[2],n=e[3],c=e[4],s=e[5]);const l=c===void 0?"popper":c,a=s===void 0?!1:s,u=l==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1";let h;e[6]!==o||e[7]!==u?(h=oe("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border shadow-md",u,o),e[6]=o,e[7]=u,e[8]=h):h=e[8];let g;e[9]!==a?(g=!a&&d.jsx(no,{}),e[9]=a,e[10]=g):g=e[10];const b=l==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1";let w;e[11]!==b?(w=oe("p-1",b),e[11]=b,e[12]=w):w=e[12];let S;e[13]!==t||e[14]!==w?(S=d.jsx(Zt,{className:w,children:t}),e[13]=t,e[14]=w,e[15]=S):S=e[15];let p;e[16]!==a?(p=!a&&d.jsx(ro,{}),e[16]=a,e[17]=p):p=e[17];let v;return e[18]!==l||e[19]!==n||e[20]!==h||e[21]!==g||e[22]!==S||e[23]!==p?(v=d.jsx(qt,{children:d.jsxs(Xt,{"data-slot":"select-content",className:h,position:l,...n,children:[g,S,p]})}),e[18]=l,e[19]=n,e[20]=h,e[21]=g,e[22]=S,e[23]=p,e[24]=v):v=e[24],v}function ho(r){const e=ee.c(16);let t,o,n,c;e[0]!==r?({className:o,children:t,hideCheck:c,...n}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=n,e[4]=c):(t=e[1],o=e[2],n=e[3],c=e[4]);const s=c===void 0?!1:c;let l;e[5]!==o?(l=oe("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-lg py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",o),e[5]=o,e[6]=l):l=e[6];let a;e[7]!==s?(a=!s&&d.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:d.jsx(eo,{children:d.jsx(wt,{className:"size-4"})})}),e[7]=s,e[8]=a):a=e[8];let u;e[9]!==t?(u=d.jsx(Jt,{children:t}),e[9]=t,e[10]=u):u=e[10];let h;return e[11]!==n||e[12]!==l||e[13]!==a||e[14]!==u?(h=d.jsxs(Qt,{"data-slot":"select-item",className:l,...n,children:[a,u]}),e[11]=n,e[12]=l,e[13]=a,e[14]=u,e[15]=h):h=e[15],h}function no(r){const e=ee.c(9);let t,o;e[0]!==r?({className:t,...o}=r,e[0]=r,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let n;e[3]!==t?(n=oe("flex cursor-default items-center justify-center py-1",t),e[3]=t,e[4]=n):n=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(Ct,{className:"size-4"}),e[5]=c):c=e[5];let s;return e[6]!==o||e[7]!==n?(s=d.jsx(to,{"data-slot":"select-scroll-up-button",className:n,...o,children:c}),e[6]=o,e[7]=n,e[8]=s):s=e[8],s}function ro(r){const e=ee.c(9);let t,o;e[0]!==r?({className:t,...o}=r,e[0]=r,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let n;e[3]!==t?(n=oe("flex cursor-default items-center justify-center py-1",t),e[3]=t,e[4]=n):n=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(Re,{className:"size-4"}),e[5]=c):c=e[5];let s;return e[6]!==o||e[7]!==n?(s=d.jsx(oo,{"data-slot":"select-scroll-down-button",className:n,...o,children:c}),e[6]=o,e[7]=n,e[8]=s):s=e[8],s}export{uo as S,fo as a,po as b,mo as c,ho as d,_e as e};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Z as Nt,_ as $e,$ as wt,a0 as Et,a1 as lt,n as he,a2 as It,a3 as Tt,r as Q,a4 as Ot,a5 as Rt,a6 as kt,a7 as At,a8 as it,a9 as Lt,aa as Dt,ab as Pt,c as H,l as ie,j as s,B,d as Oe,K as Y,H as be,I as ae,J as Ce,M as ve,i as Ie,m as me,ac as $t,t as Re,v as Pe,p as oe,Q as zt,E as qt,a as Ft}from"./index-DF3zg-P1.js";import{u as ze}from"./use-mcp-client-DrROXOcH.js";import{W as ct,g as Kt,S as Ut}from"./constants-BHDe7bIw.js";import{I as qe}from"./integration-icon-BfKWLZT4.js";import{c as fe,a as dt,h as ut,D as mt,d as ft,e as pt}from"./dialog-CmXDzme5.js";import{b as Fe,T as Ke,a as Ue}from"./tooltip-O3iHy7-o.js";import{i as Me}from"./CheckCircle-BfxYbuVE.js";import{c as ht,e as Mt,f as gt}from"./agent-icon-DmIJ53uv.js";import{u as J,t as Qt,m as Gt,s as Ht,g as Vt,p as Bt,F as Wt,b as Yt,a as Zt,c as Xt}from"./companions-core-fc2Z_sCB.js";import{F as re,a as je,b as le,c as Ee,d as ce,f as de,e as Jt}from"./form-x0k-kdB2.js";import{I as _e}from"./input-BZTiU0ds.js";import{i as es}from"./Check-BF3t7WWi.js";import{a as xt}from"./Copy01-B0CQRE_5.js";import{i as ts}from"./Settings02-CM0Uzs0U.js";import{s as ss}from"./Eye-CLtdCpUf.js";import{u as ns}from"./use-debounced-value-xN0eyoO9.js";import{f as yt,a as os,p as is}from"./provision-repo-scoped-github-connection-2iDn-wQ1.js";import{c as as,e as rs}from"./extract-connection-data-CK9iLAoG.js";import{a as ls}from"./authenticate-and-persist-oauth-BHT9Kp62.js";import{i as bt}from"./ArrowUpRight-BKVLcZTe.js";function at(o,e){const t=new Set(e);return o.filter(n=>!t.has(n))}function cs(o,e,t){const n=o.slice(0);return n[e]=t,n}var ds=class extends Nt{#o;#e;#i;#n;#t;#s;#a;#r;#l;#c=[];constructor(o,e,t){super(),this.#o=o,this.#n=t,this.#i=[],this.#t=[],this.#e=[],this.setQueries(e)}onSubscribe(){this.listeners.size===1&&this.#t.forEach(o=>{o.subscribe(e=>{this.#f(o,e)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#t.forEach(o=>{o.destroy()})}setQueries(o,e){this.#i=o,this.#n=e,$e.batch(()=>{const t=this.#t,n=this.#m(this.#i);n.forEach(r=>r.observer.setOptions(r.defaultedQueryOptions));const i=n.map(r=>r.observer),a=i.map(r=>r.getCurrentResult()),l=t.length!==i.length,c=i.some((r,f)=>r!==t[f]),u=l||c,p=u?!0:a.some((r,f)=>{const m=this.#e[f];return!m||!wt(r,m)});!u&&!p||(u&&(this.#c=n,this.#t=i),this.#e=a,this.hasListeners()&&(u&&(at(t,i).forEach(r=>{r.destroy()}),at(i,t).forEach(r=>{r.subscribe(f=>{this.#f(r,f)})})),this.#p()))})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map(o=>o.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(o,e){const t=this.#m(o),n=t.map(a=>a.observer.getOptimisticResult(a.defaultedQueryOptions)),i=t.map(a=>a.defaultedQueryOptions.queryHash);return[n,a=>this.#u(a??n,e,i),()=>this.#d(n,t)]}#d(o,e){return e.map((t,n)=>{const i=o[n];return t.defaultedQueryOptions.notifyOnChangeProps?i:t.observer.trackResult(i,a=>{e.forEach(l=>{l.observer.trackProp(a)})})})}#u(o,e,t){if(e){const n=this.#l,i=t!==void 0&&n!==void 0&&(n.length!==t.length||t.some((a,l)=>a!==n[l]));return(!this.#s||this.#e!==this.#r||i||e!==this.#a)&&(this.#a=e,this.#r=this.#e,t!==void 0&&(this.#l=t),this.#s=Et(this.#s,e(o))),this.#s}return o}#h(){return this.#n?.combine!==void 0&&this.#t.some((o,e)=>o.options.suspense&&this.#e[e]?.data===void 0)}#m(o){const e=new Map;this.#t.forEach(n=>{const i=n.options.queryHash;if(!i)return;const a=e.get(i);a?a.push(n):e.set(i,[n])});const t=[];return o.forEach(n=>{const i=this.#o.defaultQueryOptions(n),l=e.get(i.queryHash)?.shift()??new lt(this.#o,i);t.push({defaultedQueryOptions:i,observer:l})}),t}#f(o,e){const t=this.#t.indexOf(o);t!==-1&&(this.#e=cs(this.#e,t,e),this.#p())}#p(){if(this.hasListeners()){const o=this.#d(this.#e,this.#c),e=this.#h(),t=this.#s,n=e?t:this.#u(o,this.#n?.combine);(e||t!==n)&&$e.batch(()=>{this.listeners.forEach(i=>{i(this.#e)})})}}};function us({queries:o,...e},t){const n=he(t),i=It(),a=Tt(),l=Q.useMemo(()=>o.map(C=>{const g=n.defaultQueryOptions(C);return g._optimisticResults=i?"isRestoring":"optimistic",g}),[o,n,i]);l.forEach(C=>{Ot(C);const g=n.getQueryCache().get(C.queryHash);Rt(C,a,g)}),kt(a);const[c]=Q.useState(()=>new ds(n,l,e)),[u,p,r]=c.getOptimisticResult(l,e.combine),f=!i&&e.subscribed!==!1;Q.useSyncExternalStore(Q.useCallback(C=>f?c.subscribe($e.batchCalls(C)):At,[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),Q.useEffect(()=>{c.setQueries(l,e)},[l,e,c]);const h=u.some((C,g)=>it(l[g],C))?u.flatMap((C,g)=>{const d=l[g];if(d&&it(d,C)){const y=new lt(n,d);return Lt(d,y,a)}return[]}):[];if(h.length>0)throw Promise.all(h);const _=u.find((C,g)=>{const d=l[g];return d&&Dt({result:C,errorResetBoundary:a,throwOnError:d.throwOnError,query:n.getQueryCache().get(d.queryHash),suspense:d.suspense})});if(_?.error)throw _.error;return p(r())}function ms(o,e){return us({...o,queries:o.queries.map(t=>({...t,suspense:!0,throwOnError:Pt,enabled:!0,placeholderData:void 0}))},e)}const fs=/^[a-zA-Z][a-zA-Z\d+.-]*:/,ps=/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//,hs=/^[^\s/:?#]+\.[^\s/:?#]+:\d+(?:[/?#]|$)/,gs=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;function Te(o){const e=o.trim();if(!e)return{ok:!1,error:"Enter a website URL."};const t=fs.test(e),n=ps.test(e),i=hs.test(e);if(t&&!n&&!i)return{ok:!1,error:"Use an HTTP or HTTPS website URL."};const a=n?e:`https://${e}`;let l;try{l=new URL(a)}catch{return{ok:!1,error:"Enter a valid website URL."}}if(l.protocol!=="http:"&&l.protocol!=="https:")return{ok:!1,error:"Use an HTTP or HTTPS website URL."};const c=l.hostname.split(".");return c.length<2||c.some(u=>!u||!gs.test(u))?{ok:!1,error:"Enter a valid website URL."}:(l.protocol="https:",{ok:!0,value:l.origin})}function Gn(o,e){if(!o.trim())return!0;const t=Te(o);if(!t.ok||!e)return!1;const n=Te(e);return n.ok&&n.value===t.value}function Hn(o){if(!o)return null;const e=Te(o);return e.ok?new URL(e.value).hostname:null}function xs(o){const e=H.c(14),{children:t,className:n,wrapperClassName:i}=o,[a,l]=Q.useState(!0);let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=C=>{if(!C)return;const g=()=>{const y=C.scrollHeight-C.scrollTop-C.clientHeight<8;l(y)};g(),C.addEventListener("scroll",g,{passive:!0});const d=new ResizeObserver(g);d.observe(C);for(const y of Array.from(C.children))d.observe(y);return()=>{C.removeEventListener("scroll",g),d.disconnect()}},e[0]=c):c=e[0];const u=c;let p;e[1]!==i?(p=ie("relative",i),e[1]=i,e[2]=p):p=e[2];let r;e[3]!==t||e[4]!==n?(r=s.jsx("div",{ref:u,className:n,children:t}),e[3]=t,e[4]=n,e[5]=r):r=e[5];const f=a?"opacity-0":"opacity-100";let m;e[6]!==f?(m=ie("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",f),e[6]=f,e[7]=m):m=e[7];let h;e[8]!==m?(h=s.jsx("div",{"aria-hidden":!0,className:m}),e[8]=m,e[9]=h):h=e[9];let _;return e[10]!==p||e[11]!==r||e[12]!==h?(_=s.jsxs("div",{className:p,children:[r,h]}),e[10]=p,e[11]=r,e[12]=h,e[13]=_):_=e[13],_}function rt(o){const e=H.c(38);let t,n,i,a,l;e[0]!==o?({value:l,onChange:n,placeholder:i,className:t,...a}=o,e[0]=o,e[1]=t,e[2]=n,e[3]=i,e[4]=a,e[5]=l):(t=e[1],n=e[2],i=e[3],a=e[4],l=e[5]);const[c,u]=Q.useState(!1),[p,r]=Q.useState(!1);let f;e[6]!==l?(f=async()=>{if(l)try{await navigator.clipboard.writeText(l),r(!0),setTimeout(()=>r(!1),2e3)}catch(R){console.error("Failed to copy text: ",R)}},e[6]=l,e[7]=f):f=e[7];const m=f;let h;e[8]!==c?(h=()=>{u(!c)},e[8]=c,e[9]=h):h=e[9];const _=h,C=c?"text":"password";let g;e[10]!==t?(g=ie("pr-20",t),e[10]=t,e[11]=g):g=e[11];let d;e[12]!==n||e[13]!==i||e[14]!==a||e[15]!==C||e[16]!==g||e[17]!==l?(d=s.jsx(_e,{type:C,value:l,onChange:n,placeholder:i,className:g,...a}),e[12]=n,e[13]=i,e[14]=a,e[15]=C,e[16]=g,e[17]=l,e[18]=d):d=e[18];const y=c?"Hide password":"Show password";let v;e[19]!==c?(v=c?s.jsx(ts,{size:16}):s.jsx(ss,{size:16}),e[19]=c,e[20]=v):v=e[20];let x;e[21]!==y||e[22]!==v||e[23]!==_?(x=s.jsx(B,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:_,title:y,children:v}),e[21]=y,e[22]=v,e[23]=_,e[24]=x):x=e[24];const E=!l,S=p?"Copied!":"Copy token";let j;e[25]!==p?(j=p?s.jsx(es,{size:16}):s.jsx(xt,{size:16}),e[25]=p,e[26]=j):j=e[26];let b;e[27]!==m||e[28]!==S||e[29]!==j||e[30]!==E?(b=s.jsx(B,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:m,disabled:E,title:S,children:j}),e[27]=m,e[28]=S,e[29]=j,e[30]=E,e[31]=b):b=e[31];let N;e[32]!==b||e[33]!==x?(N=s.jsxs("div",{className:"absolute right-1 top-1 flex items-center gap-1 h-8",children:[x,b]}),e[32]=b,e[33]=x,e[34]=N):N=e[34];let O;return e[35]!==N||e[36]!==d?(O=s.jsxs("div",{className:"relative",children:[d,N]}),e[35]=N,e[36]=d,e[37]=O):O=e[37],O}function Qe(o){const e=H.c(19),{card:t,selfClient:n,org:i,onDone:a,onError:l}=o,c=he();let u;e[0]!==t||e[1]!==n?(u=async g=>{const d={...t.configurationState??{},...g};await n.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:t.linkedConnectionId||t.candidateConnectionId,data:{configuration_state:d}}})},e[0]=t,e[1]=n,e[2]=u):u=e[2];let p;e[3]!==a||e[4]!==i||e[5]!==c?(p=async()=>{await c.invalidateQueries({queryKey:Y.commerceDiscoveryCompanionConnectionsPrefix(i.id)}),a()},e[3]=a,e[4]=i,e[5]=c,e[6]=p):p=e[6];let r;e[7]!==l?(r=g=>{l?.(g)},e[7]=l,e[8]=r):r=e[8];let f;e[9]!==u||e[10]!==p||e[11]!==r?(f={mutationFn:u,onSuccess:p,onError:r},e[9]=u,e[10]=p,e[11]=r,e[12]=f):f=e[12];const m=Oe(f);let h;e[13]!==m?(h=g=>m.mutate(g),e[13]=m,e[14]=h):h=e[14];const _=h;let C;return e[15]!==m.error||e[16]!==m.isPending||e[17]!==_?(C={save:_,isPending:m.isPending,error:m.error},e[15]=m.error,e[16]=m.isPending,e[17]=_,e[18]=C):C=e[18],C}const ys=be({accountName:ae().min(1,"Informe o nome da conta"),appKey:ae().optional(),appToken:ae().optional()});function bs(o){const e=H.c(63),{card:t,selfClient:n,org:i,onDone:a,onIsPendingChange:l}=o;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=Ce(ys),e[0]=c):c=e[0];const u=t.configurationState?.accountName||"",p=t.configurationState?.appKey||"",r=t.configurationState?.appToken||"";let f;e[1]!==u||e[2]!==p||e[3]!==r?(f={resolver:c,defaultValues:{accountName:u,appKey:p,appToken:r}},e[1]=u,e[2]=p,e[3]=r,e[4]=f):f=e[4];const m=ve(f);let h;e[5]!==t.configurationState?.accountName||e[6]!==t.configurationState?.appKey||e[7]!==t.configurationState?.appToken||e[8]!==m?(h=()=>{m.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]=m,e[9]=h):h=e[9];let _;e[10]!==t.configurationState||e[11]!==m?(_=[t.configurationState,m],e[10]=t.configurationState,e[11]=m,e[12]=_):_=e[12],Q.useEffect(h,_);let C;e[13]!==t||e[14]!==a||e[15]!==i||e[16]!==n?(C={card:t,selfClient:n,org:i,onDone:a},e[13]=t,e[14]=a,e[15]=i,e[16]=n,e[17]=C):C=e[17];const{save:g,isPending:d,error:y}=Qe(C);let v,x;e[18]!==d||e[19]!==l?(x=()=>{l?.(d)},v=[d,l],e[18]=d,e[19]=l,e[20]=v,e[21]=x):(v=e[20],x=e[21]),Q.useEffect(x,v);let E;if(e[22]!==m||e[23]!==g){let D;e[25]!==g?(D=async F=>{g(F)},e[25]=g,e[26]=D):D=e[26],E=m.handleSubmit(D),e[22]=m,e[23]=g,e[24]=E}else E=e[24];const S=E;let j;e[27]!==d?(j=D=>{const{field:F}=D;return s.jsxs(le,{children:[s.jsx(Ee,{children:"Nome da conta"}),s.jsx(ce,{children:s.jsx(_e,{placeholder:"Nome da sua conta VTEX",...F,disabled:d})}),s.jsx(de,{})]})},e[27]=d,e[28]=j):j=e[28];let b;e[29]!==m.control||e[30]!==j?(b=s.jsx(re,{control:m.control,name:"accountName",render:j}),e[29]=m.control,e[30]=j,e[31]=b):b=e[31];let N;e[32]!==d?(N=D=>{const{field:F}=D;return s.jsxs(le,{children:[s.jsx(Ee,{children:"App Key (opcional)"}),s.jsx(ce,{children:s.jsx(rt,{placeholder:"App Key da VTEX",...F,disabled:d})}),s.jsx(de,{})]})},e[32]=d,e[33]=N):N=e[33];let O;e[34]!==m.control||e[35]!==N?(O=s.jsx(re,{control:m.control,name:"appKey",render:N}),e[34]=m.control,e[35]=N,e[36]=O):O=e[36];let R;e[37]!==d?(R=D=>{const{field:F}=D;return s.jsxs(le,{children:[s.jsx(Ee,{children:"App Token (opcional)"}),s.jsx(ce,{children:s.jsx(rt,{placeholder:"App Token da VTEX",...F,disabled:d})}),s.jsx(de,{})]})},e[37]=d,e[38]=R):R=e[38];let w;e[39]!==m.control||e[40]!==R?(w=s.jsx(re,{control:m.control,name:"appToken",render:R}),e[39]=m.control,e[40]=R,e[41]=w):w=e[41];let T;e[42]!==m||e[43]!==b||e[44]!==O||e[45]!==w?(T=s.jsxs(je,{...m,children:[b,O,w]}),e[42]=m,e[43]=b,e[44]=O,e[45]=w,e[46]=T):T=e[46];let L;e[47]!==y?(L=y&&s.jsx("p",{role:"alert",className:"text-sm text-destructive",children:y instanceof Error?y.message:"Não foi possível salvar a configuração"}),e[47]=y,e[48]=L):L=e[48];let P;e[49]!==d||e[50]!==a?(P=s.jsx(B,{type:"button",variant:"outline",onClick:a,disabled:d,children:"Cancelar"}),e[49]=d,e[50]=a,e[51]=P):P=e[51];const K=d?"Salvando...":"Salvar";let $;e[52]!==d||e[53]!==K?($=s.jsx(B,{type:"submit",disabled:d,children:K}),e[52]=d,e[53]=K,e[54]=$):$=e[54];let q;e[55]!==P||e[56]!==$?(q=s.jsxs(fe,{className:"pt-4",children:[P,$]}),e[55]=P,e[56]=$,e[57]=q):q=e[57];let M;return e[58]!==S||e[59]!==T||e[60]!==L||e[61]!==q?(M=s.jsxs("form",{onSubmit:S,className:"space-y-4",children:[T,L,q]}),e[58]=S,e[59]=T,e[60]=L,e[61]=q,e[62]=M):M=e[62],M}function Ge(o){const e=H.c(29),{options:t,value:n,onChange:i,disabled:a,ariaLabel:l,searchPlaceholder:c,hideSearch:u}=o,p=c===void 0?"Buscar...":c,r=u===void 0?!1:u,[f,m]=Q.useState("");let h,_,C;if(e[0]!==t||e[1]!==f||e[2]!==n){const j=f.trim().toLowerCase();h=j?t.filter(b=>b.label.toLowerCase().includes(j)):t,_=h.map(Cs),C=_.includes(n)?n:_[0]??"",e[0]=t,e[1]=f,e[2]=n,e[3]=h,e[4]=_,e[5]=C}else h=e[3],_=e[4],C=e[5];const g=C;let d;e[6]!==a||e[7]!==_||e[8]!==i?(d=function(b){if(a||!["ArrowDown","ArrowRight","ArrowUp","ArrowLeft","Home","End"].includes(b.key))return;b.preventDefault();const O=b.currentTarget.dataset.value,R=_.indexOf(O),w=_.length;if(w===0)return;let T;b.key==="ArrowDown"||b.key==="ArrowRight"?T=(R+1)%w:b.key==="ArrowUp"||b.key==="ArrowLeft"?T=(R-1+w)%w:b.key==="Home"?T=0:T=w-1;const L=_[T];i(L),b.currentTarget.closest('[role="radiogroup"]')?.querySelector(`[data-value="${CSS.escape(L)}"]`)?.focus()},e[6]=a,e[7]=_,e[8]=i,e[9]=d):d=e[9];const y=d;let v;e[10]!==l||e[11]!==a||e[12]!==r||e[13]!==f||e[14]!==p?(v=r?null:s.jsxs("div",{className:"relative",children:[s.jsx(ht,{size:16,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),s.jsx(_e,{type:"text",value:f,onChange:j=>m(j.target.value),disabled:a,placeholder:p,"aria-label":`Buscar ${l}`,className:"h-8 pl-8"})]}),e[10]=l,e[11]=a,e[12]=r,e[13]=f,e[14]=p,e[15]=v):v=e[15];let x;e[16]!==a||e[17]!==h||e[18]!==y||e[19]!==i||e[20]!==g||e[21]!==n?(x=h.length===0?s.jsx("div",{className:"px-2 py-2 text-sm text-muted-foreground",children:"Nenhum resultado"}):h.map(j=>{const b=j.value===n;return s.jsxs("button",{type:"button",role:"radio","aria-checked":b,disabled:a,"data-value":j.value,tabIndex:j.value===g?0:-1,onClick:()=>i(j.value),onKeyDown:y,className:ie("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",b?"bg-muted font-medium text-foreground":"text-foreground hover:bg-muted/50"),children:[s.jsx("span",{className:"truncate",children:j.label}),b?s.jsx(Me,{size:16,className:"shrink-0 text-primary"}):null]},j.value)}),e[16]=a,e[17]=h,e[18]=y,e[19]=i,e[20]=g,e[21]=n,e[22]=x):x=e[22];let E;e[23]!==l||e[24]!==x?(E=s.jsx("div",{role:"radiogroup","aria-label":l,className:"max-h-[280px] overflow-y-auto",children:x}),e[23]=l,e[24]=x,e[25]=E):E=e[25];let S;return e[26]!==v||e[27]!==E?(S=s.jsxs("div",{className:"space-y-2",children:[v,E]}),e[26]=v,e[27]=E,e[28]=S):S=e[28],S}function Cs(o){return o.value}function He(o){const e=H.c(16),{label:t,iconSize:n,className:i,iconClassName:a,labelClassName:l}=o,c=n===void 0?14:n;let u;e[0]!==i?(u=ie("inline-flex items-center gap-2",i),e[0]=i,e[1]=u):u=e[1];let p;e[2]!==a?(p=ie("shrink-0 animate-spin",a),e[2]=a,e[3]=p):p=e[3];let r;e[4]!==c||e[5]!==p?(r=s.jsx(Ie,{size:c,className:p}),e[4]=c,e[5]=p,e[6]=r):r=e[6];let f;e[7]!==l?(f=ie("text-sm",l),e[7]=l,e[8]=f):f=e[8];let m;e[9]!==t||e[10]!==f?(m=s.jsx("span",{className:f,children:t}),e[9]=t,e[10]=f,e[11]=m):m=e[11];let h;return e[12]!==u||e[13]!==r||e[14]!==m?(h=s.jsxs("span",{className:u,children:[r,m]}),e[12]=u,e[13]=r,e[14]=m,e[15]=h):h=e[15],h}const vs=be({propertyId:ae().min(1,"Selecione uma propriedade")});function js(o){const e=H.c(68),{card:t,connectionId:n,companionClient:i,selfClient:a,org:l,onDone:c,onDisconnect:u,onIsPendingChange:p}=o;let r;e[0]!==n||e[1]!==l.id?(r=Y.commerceDiscoveryCompanionGaProperties(l.id,n),e[0]=n,e[1]=l.id,e[2]=r):r=e[2];let f;e[3]!==i?(f=async()=>{const k=await i.callTool({name:"get-account-summaries",arguments:{}}),I=J(k);return Qt(I)},e[3]=i,e[4]=f):f=e[4];let m;e[5]!==r||e[6]!==f?(m={queryKey:r,queryFn:f},e[5]=r,e[6]=f,e[7]=m):m=e[7];const h=me(m);let _;e[8]===Symbol.for("react.memo_cache_sentinel")?(_=Ce(vs),e[8]=_):_=e[8];const C=t.configurationState?.propertyId||"";let g;e[9]!==C?(g={resolver:_,defaultValues:{propertyId:C}},e[9]=C,e[10]=g):g=e[10];const d=ve(g);let y;e[11]!==t||e[12]!==c||e[13]!==l||e[14]!==a?(y={card:t,selfClient:a,org:l,onDone:c},e[11]=t,e[12]=c,e[13]=l,e[14]=a,e[15]=y):y=e[15];const{save:v,isPending:x,error:E}=Qe(y);let S,j;e[16]!==x||e[17]!==p?(S=()=>{p?.(x)},j=[x,p],e[16]=x,e[17]=p,e[18]=S,e[19]=j):(S=e[18],j=e[19]),Q.useEffect(S,j);let b;if(e[20]!==d||e[21]!==v){let k;e[23]!==v?(k=async I=>{v(I)},e[23]=v,e[24]=k):k=e[24],b=d.handleSubmit(k),e[20]=d,e[21]=v,e[22]=b}else b=e[22];const N=b;if(h.isLoading){let k;return e[25]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:s.jsx(He,{label:"Carregando propriedades..."})}),e[25]=k):k=e[25],k}if(h.isError){let k;return e[26]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx("div",{className:"space-y-4",children:s.jsx("p",{className:"text-sm text-destructive",children:"Não foi possível carregar as propriedades do Google Analytics."})}),e[26]=k):k=e[26],k}let O;e[27]!==h.data?(O=h.data||[],e[27]=h.data,e[28]=O):O=e[28];const R=O;if(R.flatMap(Ss).length===0){let k;e[29]===Symbol.for("react.memo_cache_sentinel")?(k=s.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]=k):k=e[29];let I;e[30]!==u?(I=u?s.jsx("button",{type:"button",onClick:u,className:"text-xs text-muted-foreground underline underline-offset-2 hover:text-destructive",children:"Desconectar conta"}):s.jsx("span",{}),e[30]=u,e[31]=I):I=e[31];let G;e[32]!==c?(G=s.jsx(B,{type:"button",variant:"outline",onClick:c,children:"Fechar"}),e[32]=c,e[33]=G):G=e[33];let Z;return e[34]!==I||e[35]!==G?(Z=s.jsxs("div",{className:"space-y-4",children:[k,s.jsxs(fe,{className:"flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[I,G]})]}),e[34]=I,e[35]=G,e[36]=Z):Z=e[36],Z}let T;e[37]!==x||e[38]!==R?(T=k=>{const{field:I}=k;return s.jsxs(le,{children:[s.jsx(ce,{children:s.jsx(Ge,{options:R.flatMap(_s),value:I.value,onChange:I.onChange,disabled:x,ariaLabel:"Propriedade do Google Analytics"})}),s.jsx(de,{})]})},e[37]=x,e[38]=R,e[39]=T):T=e[39];let L;e[40]!==d.control||e[41]!==T?(L=s.jsx(re,{control:d.control,name:"propertyId",render:T}),e[40]=d.control,e[41]=T,e[42]=L):L=e[42];let P;e[43]!==d||e[44]!==L?(P=s.jsx(je,{...d,children:L}),e[43]=d,e[44]=L,e[45]=P):P=e[45];let K;e[46]!==E?(K=E&&s.jsx("p",{role:"alert",className:"text-sm text-destructive",children:E instanceof Error?E.message:"Não foi possível salvar a configuração"}),e[46]=E,e[47]=K):K=e[47];let $;e[48]!==x||e[49]!==u?($=u?s.jsx("button",{type:"button",onClick:u,disabled:x,className:"text-xs text-muted-foreground underline underline-offset-2 hover:text-destructive disabled:opacity-50",children:"Desconectar conta"}):s.jsx("span",{}),e[48]=x,e[49]=u,e[50]=$):$=e[50];let q;e[51]!==x||e[52]!==c?(q=s.jsx(B,{type:"button",variant:"outline",onClick:c,disabled:x,children:"Cancelar"}),e[51]=x,e[52]=c,e[53]=q):q=e[53];const M=x?"Salvando...":"Salvar";let D;e[54]!==x||e[55]!==M?(D=s.jsx(B,{type:"submit",disabled:x,children:M}),e[54]=x,e[55]=M,e[56]=D):D=e[56];let F;e[57]!==q||e[58]!==D?(F=s.jsxs("div",{className:"flex gap-2",children:[q,D]}),e[57]=q,e[58]=D,e[59]=F):F=e[59];let z;e[60]!==$||e[61]!==F?(z=s.jsxs(fe,{className:"flex-col gap-2 pt-4 sm:flex-row sm:items-center sm:justify-between",children:[$,F]}),e[60]=$,e[61]=F,e[62]=z):z=e[62];let U;return e[63]!==N||e[64]!==P||e[65]!==K||e[66]!==z?(U=s.jsxs("form",{onSubmit:N,className:"space-y-4",children:[P,K,z]}),e[63]=N,e[64]=P,e[65]=K,e[66]=z,e[67]=U):U=e[67],U}function _s(o){return o.options}function Ss(o){return o.options}const Ns=be({siteUrl:ae().min(1,"Selecione um site")});function ws(o){const e=H.c(62),{card:t,connectionId:n,companionClient:i,selfClient:a,org:l,contextSiteUrl:c,onDone:u,onIsPendingChange:p}=o;let r;e[0]!==n||e[1]!==l.id?(r=Y.commerceDiscoveryCompanionGscSites(l.id,n),e[0]=n,e[1]=l.id,e[2]=r):r=e[2];let f;e[3]!==i?(f=async()=>{const I=await i.callTool({name:"list_sites",arguments:{}});return J(I).sites||[]},e[3]=i,e[4]=f):f=e[4];let m;e[5]!==r||e[6]!==f?(m={queryKey:r,queryFn:f},e[5]=r,e[6]=f,e[7]=m):m=e[7];const h=me(m);let _;e[8]===Symbol.for("react.memo_cache_sentinel")?(_=Ce(Ns),e[8]=_):_=e[8];const C=t.configurationState?.siteUrl||"";let g;e[9]!==C?(g={resolver:_,defaultValues:{siteUrl:C}},e[9]=C,e[10]=g):g=e[10];const d=ve(g);let y;e[11]!==t||e[12]!==u||e[13]!==l||e[14]!==a?(y={card:t,selfClient:a,org:l,onDone:u},e[11]=t,e[12]=u,e[13]=l,e[14]=a,e[15]=y):y=e[15];const{save:v,isPending:x,error:E}=Qe(y),S=Q.useRef(!1),j=t.configurationState?.siteUrl;let b,N;e[16]!==x||e[17]!==p?(b=()=>{p?.(x)},N=[x,p],e[16]=x,e[17]=p,e[18]=b,e[19]=N):(b=e[18],N=e[19]),Q.useEffect(b,N);let O,R;e[20]!==c||e[21]!==d||e[22]!==j||e[23]!==h.data||e[24]!==h.isSuccess?(O=()=>{if(!(S.current||!h.isSuccess)){if(S.current=!0,j){d.getValues("siteUrl")!==j&&d.setValue("siteUrl",j);return}if(!d.getValues("siteUrl")){const I=Gt(c,h.data??[]);I&&d.setValue("siteUrl",I)}}},R=[h.isSuccess,h.data,j,c,d],e[20]=c,e[21]=d,e[22]=j,e[23]=h.data,e[24]=h.isSuccess,e[25]=O,e[26]=R):(O=e[25],R=e[26]),Q.useEffect(O,R);let w;if(e[27]!==d||e[28]!==v){let I;e[30]!==v?(I=async G=>{v(G)},e[30]=v,e[31]=I):I=e[31],w=d.handleSubmit(I),e[27]=d,e[28]=v,e[29]=w}else w=e[29];const T=w;if(h.isLoading){let I;return e[32]===Symbol.for("react.memo_cache_sentinel")?(I=s.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:s.jsx(He,{label:"Carregando sites..."})}),e[32]=I):I=e[32],I}if(h.isError){let I;return e[33]===Symbol.for("react.memo_cache_sentinel")?(I=s.jsx("div",{className:"space-y-4",children:s.jsx("p",{className:"text-sm text-destructive",children:"Não foi possível carregar os sites do Google Search Console."})}),e[33]=I):I=e[33],I}let L;e[34]!==h.data?(L=h.data||[],e[34]=h.data,e[35]=L):L=e[35];const P=L;if(P.length===0){let I;return e[36]===Symbol.for("react.memo_cache_sentinel")?(I=s.jsx("div",{className:"space-y-4",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"Nenhum site verificado foi encontrado. Verifique um site no Google Search Console."})}),e[36]=I):I=e[36],I}let K;e[37]!==x||e[38]!==P?(K=I=>{const{field:G}=I;return s.jsxs(le,{children:[s.jsx(ce,{children:s.jsx(Ge,{options:P.map(Es),value:G.value,onChange:G.onChange,disabled:x,ariaLabel:"Site verificado"})}),s.jsx(de,{})]})},e[37]=x,e[38]=P,e[39]=K):K=e[39];let $;e[40]!==d.control||e[41]!==K?($=s.jsx(re,{control:d.control,name:"siteUrl",render:K}),e[40]=d.control,e[41]=K,e[42]=$):$=e[42];let q;e[43]!==d||e[44]!==$?(q=s.jsx(je,{...d,children:$}),e[43]=d,e[44]=$,e[45]=q):q=e[45];let M;e[46]!==E?(M=E&&s.jsx("p",{role:"alert",className:"text-sm text-destructive",children:E instanceof Error?E.message:"Não foi possível salvar a configuração"}),e[46]=E,e[47]=M):M=e[47];let D;e[48]!==x||e[49]!==u?(D=s.jsx(B,{type:"button",variant:"outline",onClick:u,disabled:x,children:"Cancelar"}),e[48]=x,e[49]=u,e[50]=D):D=e[50];const F=x?"Salvando...":"Salvar";let z;e[51]!==x||e[52]!==F?(z=s.jsx(B,{type:"submit",disabled:x,children:F}),e[51]=x,e[52]=F,e[53]=z):z=e[53];let U;e[54]!==D||e[55]!==z?(U=s.jsxs(fe,{className:"pt-4",children:[D,z]}),e[54]=D,e[55]=z,e[56]=U):U=e[56];let k;return e[57]!==T||e[58]!==q||e[59]!==M||e[60]!==U?(k=s.jsxs("form",{onSubmit:T,className:"space-y-4",children:[q,M,U]}),e[57]=T,e[58]=q,e[59]=M,e[60]=U,e[61]=k):k=e[61],k}function Es(o){return{value:o.siteUrl,label:o.siteUrl}}function Is(o){const[e,t]=o.split("/");return!e||!t?null:{owner:e,name:t}}function Ts(o){const{existingRepo:e,owner:t,name:n}=o;return e?.connectionId&&e.owner.toLowerCase()===t.toLowerCase()&&e.name.toLowerCase()===n.toLowerCase()?{connectionId:e.connectionId,installationId:e.installationId}:null}function Os(o){const{existingRepo:e,existingConnections:t,repoConnectionId:n}=o,i=e?.connectionId&&e.connectionId!==n?e.connectionId:void 0,a=[...t.filter(l=>l.connection_id!==n&&l.connection_id!==i),{connection_id:n,selected_tools:[]}];return{staleConnectionId:i,mergedConnections:a}}const Rs=be({githubRepo:ae().min(1,"Selecione um repositório")}),ks=15e3,As=/^[\w.-]+\/[\w.-]+$/;async function Ls(o,e,t,n){const{installations:i}=await yt(o,t),a=n.trim(),l=await Promise.allSettled(i.map(async r=>{const f=r.type==="User"?"user":"org",m=a?`${f}:${r.login} ${a} in:name`:`${f}:${r.login}`,_=await e.callTool({name:"search_repositories",arguments:{query:m,page:1,perPage:50}},void 0,{signal:AbortSignal.timeout(ks)}),C=_.content?.[0]?.text;if(_.isError)throw new Error(C??"search_repositories failed");if(!C)throw new Error("empty search_repositories response");return JSON.parse(C).items??[]})),c=new Map;let u=0;for(const r of l){if(r.status==="rejected"){u+=1;continue}for(const f of r.value)f.full_name&&!c.has(f.full_name)&&c.set(f.full_name,f)}return{repos:Array.from(c.values()).sort((r,f)=>(f.updated_at??"").localeCompare(r.updated_at??"")).map(r=>r.full_name),failed:u,total:i.length}}function Ds(o){const e=H.c(89),{connectionId:t,companionClient:n,selfClient:i,org:a,onDone:l,onIsPendingChange:c}=o,u=he();let p;e[0]!==a.id?(p=ct.COMMERCE_DISCOVERY(a.id),e[0]=a.id,e[1]=p):p=e[1];const r=p,[f,m]=Q.useState(""),h=ns(f,300),_=Q.useRef(!1);let C;e[2]!==t||e[3]!==a.id?(C=Y.commerceDiscoveryCompanionGithubSelected(a.id,t),e[2]=t,e[3]=a.id,e[4]=C):C=e[4];let g;e[5]!==r||e[6]!==i?(g=async()=>{const W=await i.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:r}}),se=J(W).item?.configuration_state??null;return typeof se?.github_repo=="string"?se.github_repo:""},e[5]=r,e[6]=i,e[7]=g):g=e[7];let d;e[8]!==C||e[9]!==g?(d={queryKey:C,queryFn:g},e[8]=C,e[9]=g,e[10]=d):d=e[10];const y=me(d);let v;e[11]!==t||e[12]!==h||e[13]!==a.id?(v=Y.commerceDiscoveryCompanionGithubRepos(a.id,t,h.trim()),e[11]=t,e[12]=h,e[13]=a.id,e[14]=v):v=e[14];let x;e[15]!==n||e[16]!==t||e[17]!==h||e[18]!==i?(x=()=>Ls(W=>i.callTool(W),n,t,h),e[15]=n,e[16]=t,e[17]=h,e[18]=i,e[19]=x):x=e[19];let E;e[20]!==v||e[21]!==x?(E={queryKey:v,queryFn:x},e[20]=v,e[21]=x,e[22]=E):E=e[22];const S=me(E);let j;e[23]===Symbol.for("react.memo_cache_sentinel")?(j={resolver:Ce(Rs),defaultValues:{githubRepo:""}},e[23]=j):j=e[23];const b=ve(j);let N;e[24]!==r||e[25]!==n||e[26]!==t||e[27]!==a.id||e[28]!==a.slug||e[29]!==i?(N=async W=>{const se=await i.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:r}}),jt={...J(se).item?.configuration_state??null??{},github_repo:W};await i.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:r,data:{configuration_state:jt}}});const Ze=Is(W);if(!Ze)throw new Error(`Repositório inválido: "${W}". Use o formato owner/nome.`);const{owner:ge,name:ke}=Ze,Xe=Kt(a.id),Je=J(await i.callTool({name:"COLLECTION_VIRTUAL_MCP_GET",arguments:{id:Xe}})).item,et=Je?.metadata?.githubRepo,_t=Je?.connections??[],tt=Ts({existingRepo:et,owner:ge,name:ke});let Ne=tt?.connectionId,Ae=tt?.installationId,Le;if(!Ne){const{installations:De}=await yt(xe=>i.callTool(xe),t),we=os(De,ge);if(!we)throw new Error(`Nenhuma instalação do GitHub encontrada para "${ge}".`);Ae=we.installationId;const nt=J(await i.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:t}})).item;if(!nt)throw new Error("Conexão do GitHub não encontrada.");const{childConnectionId:ot}=await is({orgSlug:a.slug,sourceConnection:nt,installationId:Ae,owner:ge,repo:ke,githubCallTool:xe=>n.callTool(xe),selfCallTool:xe=>i.callTool(xe)});Ne=ot,Le=ot}const{staleConnectionId:st,mergedConnections:St}=Os({existingRepo:et,existingConnections:_t,repoConnectionId:Ne});try{await i.callTool({name:"COLLECTION_VIRTUAL_MCP_UPDATE",arguments:{id:Xe,data:{connections:St,metadata:{githubRepo:{owner:ge,name:ke,url:`https://github.com/${W}`,installationId:Ae,connectionId:Ne}}}}}),st&&await i.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:st,force:!0}}).catch(zs)}catch(De){const we=De;throw Le&&await i.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:Le,force:!0}}).catch($s),we}},e[24]=r,e[25]=n,e[26]=t,e[27]=a.id,e[28]=a.slug,e[29]=i,e[30]=N):N=e[30];let O;e[31]!==r||e[32]!==l||e[33]!==a.id||e[34]!==u?(O=async()=>{await u.invalidateQueries({queryKey:Y.commerceDiscoveryConnection(a.id,r)}),await u.invalidateQueries({queryKey:Y.commerceDiscoveryCompanionConnectionsPrefix(a.id)}),$t(u,a.id),l()},e[31]=r,e[32]=l,e[33]=a.id,e[34]=u,e[35]=O):O=e[35];let R;e[36]!==O||e[37]!==N?(R={mutationFn:N,onSuccess:O},e[36]=O,e[37]=N,e[38]=R):R=e[38];const w=Oe(R),T=w.isPending;let L,P;e[39]!==T||e[40]!==c?(L=()=>{c?.(T)},P=[T,c],e[39]=T,e[40]=c,e[41]=L,e[42]=P):(L=e[41],P=e[42]),Q.useEffect(L,P);const K=y.data??"";let $,q;e[43]!==b||e[44]!==y.data||e[45]!==y.isSuccess?($=()=>{!y.isSuccess||_.current||(_.current=!0,y.data&&b.setValue("githubRepo",y.data))},q=[y.isSuccess,y.data,b],e[43]=b,e[44]=y.data,e[45]=y.isSuccess,e[46]=$,e[47]=q):($=e[46],q=e[47]),Q.useEffect($,q);let M;if(e[48]!==b||e[49]!==w){let W;e[51]!==w?(W=async se=>{w.mutate(se.githubRepo)},e[51]=w,e[52]=W):W=e[52],M=b.handleSubmit(W),e[48]=b,e[49]=w,e[50]=M}else M=e[50];const D=M;let F,z,U;if(e[53]!==h||e[54]!==S.data?.failed||e[55]!==S.data?.repos||e[56]!==S.data?.total||e[57]!==K){const W=S.data?.repos??[];F=S.data?.failed??0,U=S.data?.total??0;const se=h.trim();z=[...W],se&&As.test(se)&&!z.includes(se)&&z.unshift(se),K&&!z.includes(K)&&z.push(K),e[53]=h,e[54]=S.data?.failed,e[55]=S.data?.repos,e[56]=S.data?.total,e[57]=K,e[58]=F,e[59]=z,e[60]=U}else F=e[58],z=e[59],U=e[60];const k=U>0&&F===U,I=S.isError||k?"Não foi possível buscar os repositórios (erro ou tempo esgotado). Tente novamente ou digite o repositório no formato owner/nome.":F>0?"Parte da busca falhou — alguns repositórios podem não ter aparecido. Tente novamente ou digite owner/nome.":null;let G;e[61]===Symbol.for("react.memo_cache_sentinel")?(G=s.jsx(ht,{size:16,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),e[61]=G):G=e[61];let Z;e[62]===Symbol.for("react.memo_cache_sentinel")?(Z=W=>m(W.target.value),e[62]=Z):Z=e[62];let X;e[63]!==T||e[64]!==f?(X=s.jsxs("div",{className:"relative",children:[G,s.jsx(_e,{type:"text",value:f,onChange:Z,disabled:T,placeholder:"Buscar repositório","aria-label":"Buscar repositório",className:"h-8 pl-8"})]}),e[63]=T,e[64]=f,e[65]=X):X=e[65];let ee;e[66]!==b||e[67]!==T||e[68]!==z||e[69]!==S.isLoading||e[70]!==I?(ee=S.isLoading?s.jsx("div",{className:"flex min-h-[160px] items-center justify-center",children:s.jsx(He,{label:"Carregando repositórios..."})}):s.jsxs(s.Fragment,{children:[I&&s.jsx("p",{role:"alert",className:"text-sm text-destructive",children:I}),z.length===0?!I&&s.jsx("p",{className:"text-sm text-muted-foreground",children:"Nenhum repositório encontrado. Digite o nome do repositório (owner/nome) para buscar."}):s.jsx(je,{...b,children:s.jsx(re,{control:b.control,name:"githubRepo",render:W=>{const{field:se}=W;return s.jsxs(le,{children:[s.jsx(ce,{children:s.jsx(Ge,{options:z.map(Ps),value:se.value,onChange:se.onChange,disabled:T,ariaLabel:"Repositório",hideSearch:!0})}),s.jsx(de,{})]})}})})]}),e[66]=b,e[67]=T,e[68]=z,e[69]=S.isLoading,e[70]=I,e[71]=ee):ee=e[71];let V;e[72]!==w.error?(V=w.error&&s.jsx("p",{role:"alert",className:"text-sm text-destructive",children:w.error instanceof Error?w.error.message:"Não foi possível salvar a configuração"}),e[72]=w.error,e[73]=V):V=e[73];let A;e[74]!==T||e[75]!==l?(A=s.jsx(B,{type:"button",variant:"outline",onClick:l,disabled:T,children:"Cancelar"}),e[74]=T,e[75]=l,e[76]=A):A=e[76];const te=T?"Salvando...":"Salvar";let ne;e[77]!==T||e[78]!==te?(ne=s.jsx(B,{type:"submit",disabled:T,children:te}),e[77]=T,e[78]=te,e[79]=ne):ne=e[79];let ue;e[80]!==A||e[81]!==ne?(ue=s.jsxs(fe,{className:"pt-4",children:[A,ne]}),e[80]=A,e[81]=ne,e[82]=ue):ue=e[82];let Se;return e[83]!==D||e[84]!==X||e[85]!==ee||e[86]!==V||e[87]!==ue?(Se=s.jsxs("form",{onSubmit:D,className:"space-y-4",children:[X,ee,V,ue]}),e[83]=D,e[84]=X,e[85]=ee,e[86]=V,e[87]=ue,e[88]=Se):Se=e[88],Se}function Ps(o){return{value:o,label:o}}function $s(){}function zs(){}const qs={vtex:bs,"google-analytics":js,"google-search-console":ws,github:Ds},pe="deco-reader@decocms.iam.gserviceaccount.com",Ct={"google-analytics":"ga4","google-search-console":"gsc"},vt={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 ${pe} 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 ${pe} e escolha permissão Completa.`,"Copie o endereço do site como aparece no seletor de propriedades e cole abaixo."]}};function Fs(o,e){const t=vt[o].label;switch(e){case"no-access":return{title:`Ainda não conseguimos acessar este recurso no ${t}.`,steps:o==="ga4"?[`Confirme que ${pe} 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 ${pe} 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 Ks(o){const e=H.c(76),{provider:t,siteUrl:n,selfClient:i,org:a,initialResourceId:l,onDone:c,onIsPendingChange:u,onOAuthInstead:p}=o,r=vt[t],f=he(),[m,h]=Q.useState(null);let _,C;if(e[0]!==r.resourceLabel){const V=be({resourceId:ae().trim().min(1,`Informe o ${r.resourceLabel.toLowerCase()}`)});C=ve,_=Ce(V),e[0]=r.resourceLabel,e[1]=_,e[2]=C}else _=e[1],C=e[2];const g=l??"";let d;e[3]!==g?(d={resourceId:g},e[3]=g,e[4]=d):d=e[4];let y;e[5]!==_||e[6]!==d?(y={resolver:_,defaultValues:d},e[5]=_,e[6]=d,e[7]=y):y=e[7];const v=C(y);let x;e[8]!==t||e[9]!==i||e[10]!==n?(x=async V=>{if(!n)throw new Error("URL da loja indisponível — recarregue a página.");const A=await i.callTool({name:"COMMERCE_DISCOVERY_BIND",arguments:{siteUrl:n,provider:t,resourceId:V.resourceId}});return J(A)},e[8]=t,e[9]=i,e[10]=n,e[11]=x):x=e[11];let E,S;e[12]!==u?(E=()=>u?.(!0),S=()=>u?.(!1),e[12]=u,e[13]=E,e[14]=S):(E=e[13],S=e[14]);let j;e[15]!==r.label||e[16]!==c||e[17]!==a||e[18]!==t||e[19]!==f||e[20]!==n?(j=async V=>{if(V.ok){h(null),Re.success(`${r.label} conectado`),n&&await f.invalidateQueries({queryKey:Y.commerceDiscoveryConnectionStatus(a.id,n)}),c();return}h({...Fs(t,V.reason??"unknown"),detail:V.detail})},e[15]=r.label,e[16]=c,e[17]=a,e[18]=t,e[19]=f,e[20]=n,e[21]=j):j=e[21];let b;e[22]!==x||e[23]!==E||e[24]!==S||e[25]!==j?(b={mutationFn:x,onMutate:E,onSettled:S,onSuccess:j},e[22]=x,e[23]=E,e[24]=S,e[25]=j,e[26]=b):b=e[26];const N=Oe(b);let O;if(e[27]!==v||e[28]!==N){let V;e[30]!==N?(V=A=>N.mutate(A),e[30]=N,e[31]=V):V=e[31],O=v.handleSubmit(V),e[27]=v,e[28]=N,e[29]=O}else O=e[29];const R=O,w=N.isPending,T=Qs;let L;e[32]!==r.connectSteps?(L=r.connectSteps.map(Ms),e[32]=r.connectSteps,e[33]=L):L=e[33];let P;e[34]!==L?(P=s.jsx("ol",{className:"space-y-2 text-sm text-muted-foreground",children:L}),e[34]=L,e[35]=P):P=e[35];let K;e[36]===Symbol.for("react.memo_cache_sentinel")?(K=s.jsx("code",{className:"min-w-0 flex-1 truncate text-xs text-foreground",children:pe}),e[36]=K):K=e[36];let $;e[37]===Symbol.for("react.memo_cache_sentinel")?($=s.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border bg-muted/40 p-2",children:[K,s.jsx(B,{type:"button",variant:"ghost",size:"icon-sm",onClick:T,"aria-label":"Copiar e-mail do service account",children:s.jsx(xt,{size:16})})]}),e[37]=$):$=e[37];let q;e[38]!==r.resourceHint||e[39]!==r.resourceLabel||e[40]!==r.resourcePlaceholder||e[41]!==w?(q=V=>{const{field:A}=V;return s.jsxs(le,{children:[s.jsx(Ee,{children:r.resourceLabel}),s.jsx(ce,{children:s.jsx(_e,{...A,placeholder:r.resourcePlaceholder,disabled:w,autoComplete:"off"})}),s.jsx(Jt,{children:r.resourceHint}),s.jsx(de,{})]})},e[38]=r.resourceHint,e[39]=r.resourceLabel,e[40]=r.resourcePlaceholder,e[41]=w,e[42]=q):q=e[42];let M;e[43]!==v.control||e[44]!==q?(M=s.jsx(re,{control:v.control,name:"resourceId",render:q}),e[43]=v.control,e[44]=q,e[45]=M):M=e[45];let D;e[46]!==v||e[47]!==M?(D=s.jsx(je,{...v,children:M}),e[46]=v,e[47]=M,e[48]=D):D=e[48];let F;e[49]!==m?(F=m&&s.jsxs("div",{role:"alert",className:"space-y-2 rounded-lg border border-destructive/40 bg-destructive/5 p-3",children:[s.jsx("p",{className:"text-sm font-medium text-foreground",children:m.title}),s.jsx("ol",{className:"space-y-1 text-sm text-muted-foreground",children:m.steps.map(Us)})]}),e[49]=m,e[50]=F):F=e[50];let z;e[51]!==N.error||e[52]!==N.isError?(z=N.isError&&s.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 U;e[54]!==w||e[55]!==p?(U=p?s.jsx("button",{type:"button",onClick:p,disabled:w,className:"text-xs text-muted-foreground underline underline-offset-2 hover:text-foreground disabled:opacity-50",children:"autorizar via login do Google"}):s.jsx("span",{}),e[54]=w,e[55]=p,e[56]=U):U=e[56];let k;e[57]!==w||e[58]!==c?(k=s.jsx(B,{type:"button",variant:"outline",onClick:c,disabled:w,children:"Cancelar"}),e[57]=w,e[58]=c,e[59]=k):k=e[59];const I=w?"Verificando...":"Vincular";let G;e[60]!==w||e[61]!==I?(G=s.jsx(B,{type:"submit",disabled:w,children:I}),e[60]=w,e[61]=I,e[62]=G):G=e[62];let Z;e[63]!==k||e[64]!==G?(Z=s.jsxs("div",{className:"flex gap-2",children:[k,G]}),e[63]=k,e[64]=G,e[65]=Z):Z=e[65];let X;e[66]!==U||e[67]!==Z?(X=s.jsxs(fe,{className:"flex-col gap-2 pt-2 sm:flex-row sm:items-center sm:justify-between",children:[U,Z]}),e[66]=U,e[67]=Z,e[68]=X):X=e[68];let ee;return e[69]!==R||e[70]!==P||e[71]!==D||e[72]!==F||e[73]!==z||e[74]!==X?(ee=s.jsxs("form",{onSubmit:R,className:"space-y-4",children:[P,$,D,F,z,X]}),e[69]=R,e[70]=P,e[71]=D,e[72]=F,e[73]=z,e[74]=X,e[75]=ee):ee=e[75],ee}function Us(o){return s.jsxs("li",{className:"flex gap-2",children:[s.jsx("span",{"aria-hidden":!0,children:"•"}),s.jsx("span",{children:o})]},o)}function Ms(o,e){return s.jsxs("li",{className:"flex gap-2",children:[s.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}),s.jsx("span",{children:o})]},o)}function Qs(){navigator.clipboard?.writeText(pe),Re.success("E-mail copiado")}function Gs(){const o=H.c(2);let e;o[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.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=s.jsxs("div",{className:"flex items-center gap-3 rounded-2xl border border-border bg-card p-3 sm:h-full sm:flex-col sm:items-stretch sm:p-4",children:[e,s.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[s.jsx("div",{className:"h-4 w-24 animate-pulse rounded bg-muted/60"}),s.jsx("div",{className:"hidden h-3 w-full animate-pulse rounded bg-muted/60 sm:block"})]}),s.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 Hs="rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground";function Vs(o){const e=H.c(36),{card:t,connecting:n,disconnecting:i,disabled:a,onConnect:l,onDisconnect:c,org:u,selfClient:p,siteUrl:r,autoOpenConfigFieldKey:f,onAutoOpenConfigHandled:m}=o,h=t.linkedConnectionId,_=Ct[t.bindingType],C=!!_&&t.boundVia!=="oauth";let g;e[0]!==f||e[1]!==t||e[2]!==n||e[3]!==a||e[4]!==i||e[5]!==h||e[6]!==m||e[7]!==l||e[8]!==c||e[9]!==u||e[10]!==_||e[11]!==p||e[12]!==r||e[13]!==C?(g=C&&_?s.jsx(Bs,{card:t,provider:_,org:u,selfClient:p,siteUrl:r,onOAuthInstead:l,disabled:a,connecting:n}):t.satisfied&&h?s.jsxs("div",{className:"flex items-center justify-end gap-1 sm:justify-start",children:[s.jsxs("span",{className:"flex items-center gap-1.5 text-sm text-muted-foreground",children:[s.jsx(Me,{size:16,className:"text-success"})," Conectado"]}),s.jsx(Q.Suspense,{fallback:s.jsx(Ws,{}),children:s.jsx(Ys,{card:t,org:u,selfClient:p,connectionId:h,contextSiteUrl:r,autoOpen:Ht({autoOpenFieldKey:f,card:t}),onAutoOpenHandled:m})}),s.jsxs(Fe,{children:[s.jsx(Ke,{asChild:!0,children:s.jsx(B,{type:"button",variant:"ghost",size:"icon-sm",className:"shrink-0 text-muted-foreground hover:text-destructive",disabled:a||i,onClick:c,"aria-label":`Desconectar ${t.title}`,children:i?s.jsx(Ie,{size:16,className:"animate-spin"}):s.jsx(Mt,{size:16})})}),s.jsx(Ue,{children:"Desconectar"})]})]}):s.jsx(B,{type:"button",variant:"outline",size:"sm",className:"sm:w-full",disabled:a||n,onClick:l,"aria-label":`Conectar ${t.title}`,children:n?s.jsx(Ie,{size:16,className:"animate-spin"}):"Conectar"}),e[0]=f,e[1]=t,e[2]=n,e[3]=a,e[4]=i,e[5]=h,e[6]=m,e[7]=l,e[8]=c,e[9]=u,e[10]=_,e[11]=p,e[12]=r,e[13]=C,e[14]=g):g=e[14];const d=g;let y;e[15]!==t.icon||e[16]!==t.title?(y=s.jsx(qe,{icon:t.icon,name:t.title,size:"sm",fit:"contain",className:"shrink-0 p-1.5"}),e[15]=t.icon,e[16]=t.title,e[17]=y):y=e[17];let v;e[18]!==t.area?(v=t.area&&s.jsx("span",{className:ie("hidden sm:inline-block",Hs),children:t.area}),e[18]=t.area,e[19]=v):v=e[19];let x;e[20]!==y||e[21]!==v?(x=s.jsxs("div",{className:"shrink-0 sm:flex sm:w-full sm:items-center sm:justify-between sm:gap-2",children:[y,v]}),e[20]=y,e[21]=v,e[22]=x):x=e[22];let E;e[23]!==t.title?(E=s.jsx("p",{className:"text-sm font-medium text-foreground",children:t.title}),e[23]=t.title,e[24]=E):E=e[24];let S;e[25]!==t.headline?(S=t.headline&&s.jsx("p",{className:"hidden text-sm leading-5 text-muted-foreground sm:mt-0.5 sm:line-clamp-2 sm:block",children:t.headline}),e[25]=t.headline,e[26]=S):S=e[26];let j;e[27]!==E||e[28]!==S?(j=s.jsxs("div",{className:"min-w-0 flex-1",children:[E,S]}),e[27]=E,e[28]=S,e[29]=j):j=e[29];let b;e[30]!==d?(b=s.jsx("div",{className:"shrink-0 sm:mt-auto sm:w-full sm:pt-1",children:d}),e[30]=d,e[31]=b):b=e[31];let N;return e[32]!==x||e[33]!==j||e[34]!==b?(N=s.jsxs("div",{className:"flex items-center gap-3 rounded-2xl border border-border bg-card p-3 sm:h-full sm:flex-col sm:items-stretch sm:p-4",children:[x,j,b]}),e[32]=x,e[33]=j,e[34]=b,e[35]=N):N=e[35],N}function Bs(o){const e=H.c(39),{card:t,provider:n,org:i,selfClient:a,siteUrl:l,onOAuthInstead:c,disabled:u,connecting:p}=o,[r,f]=Q.useState(!1),[m,h]=Q.useState(!1);let _;e[0]!==m?(_=T=>{!T&&m||f(T)},e[0]=m,e[1]=_):_=e[1];const C=_;let g;e[2]!==t.satisfied||e[3]!==t.title||e[4]!==p||e[5]!==u?(g=t.satisfied?s.jsxs("div",{className:"flex items-center justify-end gap-1 sm:justify-start",children:[s.jsxs("span",{className:"flex items-center gap-1.5 text-sm text-muted-foreground",children:[s.jsx(Me,{size:16,className:"text-success"})," Conectado"]}),s.jsxs(Fe,{children:[s.jsx(Ke,{asChild:!0,children:s.jsx(B,{type:"button",variant:"ghost",size:"icon-sm",className:"shrink-0",onClick:()=>f(!0),"aria-label":`Configurar ${t.title}`,children:s.jsx(gt,{size:16})})}),s.jsx(Ue,{children:"Editar configuração"})]})]}):s.jsx(B,{type:"button",variant:"outline",size:"sm",className:"sm:w-full",disabled:u||p,onClick:()=>f(!0),"aria-label":`Conectar ${t.title}`,children:p?s.jsx(Ie,{size:16,className:"animate-spin"}):"Conectar"}),e[2]=t.satisfied,e[3]=t.title,e[4]=p,e[5]=u,e[6]=g):g=e[6];let d;e[7]!==t.icon||e[8]!==t.title?(d=s.jsx(qe,{icon:t.icon,name:t.title,size:"md",fit:"contain",className:"p-1.5"}),e[7]=t.icon,e[8]=t.title,e[9]=d):d=e[9];let y;e[10]!==t.title?(y=s.jsx(dt,{children:t.title}),e[10]=t.title,e[11]=y):y=e[11];let v;e[12]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx(ut,{children:"Conceda acesso ao nosso leitor e informe o identificador"}),e[12]=v):v=e[12];let x;e[13]!==y?(x=s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[y,v]}),e[13]=y,e[14]=x):x=e[14];let E;e[15]!==d||e[16]!==x?(E=s.jsxs(mt,{className:"flex-row items-center gap-3 space-y-0 text-left",children:[d,x]}),e[15]=d,e[16]=x,e[17]=E):E=e[17];const S=t.boundResource??void 0;let j;e[18]===Symbol.for("react.memo_cache_sentinel")?(j=()=>f(!1),e[18]=j):j=e[18];let b;e[19]!==t.satisfied||e[20]!==c?(b=t.satisfied?void 0:()=>{f(!1),c()},e[19]=t.satisfied,e[20]=c,e[21]=b):b=e[21];let N;e[22]!==i||e[23]!==n||e[24]!==a||e[25]!==l||e[26]!==b||e[27]!==S?(N=s.jsx(Ks,{provider:n,siteUrl:l,selfClient:a,org:i,initialResourceId:S,onDone:j,onIsPendingChange:h,onOAuthInstead:b}),e[22]=i,e[23]=n,e[24]=a,e[25]=l,e[26]=b,e[27]=S,e[28]=N):N=e[28];let O;e[29]!==N||e[30]!==E?(O=s.jsxs(ft,{className:"sm:max-w-lg",children:[E,N]}),e[29]=N,e[30]=E,e[31]=O):O=e[31];let R;e[32]!==C||e[33]!==r||e[34]!==O?(R=s.jsx(pt,{open:r,onOpenChange:C,children:O}),e[32]=C,e[33]=r,e[34]=O,e[35]=R):R=e[35];let w;return e[36]!==R||e[37]!==g?(w=s.jsxs(s.Fragment,{children:[g,R]}),e[36]=R,e[37]=g,e[38]=w):w=e[38],w}function Ws(){const o=H.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"size-8 shrink-0 animate-pulse rounded-lg bg-muted/60"}),o[0]=e):e=o[0],e}function Ys(o){const e=H.c(60),{card:t,org:n,selfClient:i,connectionId:a,contextSiteUrl:l,autoOpen:c,onAutoOpenHandled:u}=o;let p;e[0]!==a||e[1]!==n.id||e[2]!==n.slug?(p={connectionId:a,orgId:n.id,orgSlug:n.slug},e[0]=a,e[1]=n.id,e[2]=n.slug,e[3]=p):p=e[3];const r=ze(p),[f,m]=Q.useState(c),[h,_]=Q.useState(!1),C=he(),g=qs[t.bindingType],d=Vt(t.configurationState);let y;e[4]!==c||e[5]!==u?(y=()=>{m(!1),c&&u()},e[4]=c,e[5]=u,e[6]=y):y=e[6];const v=y;let x;e[7]!==v||e[8]!==h?(x=I=>{if(!(!I&&h)){if(!I){v();return}m(!0)}},e[7]=v,e[8]=h,e[9]=x):x=e[9];const E=x;let S;e[10]!==a||e[11]!==i?(S=async()=>{await i.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:a,force:!0}})},e[10]=a,e[11]=i,e[12]=S):S=e[12];let j;e[13]!==t.title||e[14]!==v||e[15]!==n.id||e[16]!==C?(j=async()=>{await C.invalidateQueries({queryKey:Y.commerceDiscoveryCompanionConnectionsPrefix(n.id)}),Re.success(`${t.title} desconectado`),v()},e[13]=t.title,e[14]=v,e[15]=n.id,e[16]=C,e[17]=j):j=e[17];let b;e[18]!==S||e[19]!==j?(b={mutationFn:S,onSuccess:j,onError:Zs},e[18]=S,e[19]=j,e[20]=b):b=e[20];const N=Oe(b);if(!g)return null;let O;e[21]===Symbol.for("react.memo_cache_sentinel")?(O=()=>m(!0),e[21]=O):O=e[21];const R=`Configurar ${t.title}`;let w;e[22]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(gt,{size:16}),e[22]=w):w=e[22];let T;e[23]!==R?(T=s.jsx(Ke,{asChild:!0,children:s.jsx(B,{type:"button",variant:"ghost",size:"icon-sm",className:"shrink-0",onClick:O,"aria-label":R,children:w})}),e[23]=R,e[24]=T):T=e[24];const L=d.length>0?"Editar configuração":"Configurar";let P;e[25]!==L?(P=s.jsx(Ue,{children:L}),e[25]=L,e[26]=P):P=e[26];let K;e[27]!==T||e[28]!==P?(K=s.jsxs(Fe,{children:[T,P]}),e[27]=T,e[28]=P,e[29]=K):K=e[29];let $;e[30]!==t.icon||e[31]!==t.title?($=s.jsx(qe,{icon:t.icon,name:t.title,size:"md",fit:"contain",className:"p-1.5"}),e[30]=t.icon,e[31]=t.title,e[32]=$):$=e[32];let q;e[33]!==t.title?(q=s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[s.jsx(dt,{children:t.title}),s.jsxs(ut,{children:["Configure o ",t.title," para enriquecer os dados"]})]}),e[33]=t.title,e[34]=q):q=e[34];let M;e[35]!==$||e[36]!==q?(M=s.jsxs(mt,{className:"flex-row items-center gap-3 space-y-0 text-left",children:[$,q]}),e[35]=$,e[36]=q,e[37]=M):M=e[37];let D;e[38]!==N?(D=()=>N.mutate(),e[38]=N,e[39]=D):D=e[39];let F;e[40]!==g||e[41]!==t||e[42]!==v||e[43]!==r||e[44]!==a||e[45]!==l||e[46]!==n||e[47]!==i||e[48]!==D?(F=s.jsx(g,{card:t,connectionId:a,companionClient:r,selfClient:i,org:n,contextSiteUrl:l,onDone:v,onDisconnect:D,onIsPendingChange:_}),e[40]=g,e[41]=t,e[42]=v,e[43]=r,e[44]=a,e[45]=l,e[46]=n,e[47]=i,e[48]=D,e[49]=F):F=e[49];let z;e[50]!==M||e[51]!==F?(z=s.jsxs(ft,{className:"sm:max-w-lg",children:[M,F]}),e[50]=M,e[51]=F,e[52]=z):z=e[52];let U;e[53]!==f||e[54]!==E||e[55]!==z?(U=s.jsx(pt,{open:f,onOpenChange:E,children:z}),e[53]=f,e[54]=E,e[55]=z,e[56]=U):U=e[56];let k;return e[57]!==K||e[58]!==U?(k=s.jsxs(s.Fragment,{children:[K,U]}),e[57]=K,e[58]=U,e[59]=k):k=e[59],k}function Zs(){Re.error("Não foi possível desconectar. Tente novamente.")}const Ve={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."},github:{registryAppId:"deco/mcp-github",area:"Engenharia",headline:"A saúde da entrega de código por trás da sua loja."}};function Xs(o){const e=H.c(40),{selfClient:t,org:n,cdConnectionId:i,siteUrl:a}=o;let l;e[0]!==i||e[1]!==n.id||e[2]!==n.slug?(l={connectionId:i,orgId:n.id,orgSlug:n.slug},e[0]=i,e[1]=n.id,e[2]=n.slug,e[3]=l):l=e[3];const c=ze(l);let u;e[4]!==i||e[5]!==n.id?(u=Y.commerceDiscoveryCompanionSchema(n.id,i),e[4]=i,e[5]=n.id,e[6]=u):u=e[6];let p;e[7]!==c?(p=async()=>{const A=await c.callTool({name:"MCP_CONFIGURATION",arguments:{}});return J(A)},e[7]=c,e[8]=p):p=e[8];let r;e[9]!==u||e[10]!==p?(r={queryKey:u,queryFn:p,retry:!1},e[9]=u,e[10]=p,e[11]=r):r=e[11];const f=me(r),m=f.data?.stateSchema?Bt(f.data.stateSchema):null,h=m&&m.length>0?m:Wt,_=h.map(cn),C=h.map(ln).filter(rn),g=h.filter(an).map(on),d=[...C,...g].sort().join(",");let y;e[12]!==i||e[13]!==n.id?(y=Y.commerceDiscoveryConnection(n.id,i),e[12]=i,e[13]=n.id,e[14]=y):y=e[14];let v;e[15]!==i||e[16]!==t?(v=async()=>{const A=await t.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:i}});return J(A)},e[15]=i,e[16]=t,e[17]=v):v=e[17];let x;e[18]!==y||e[19]!==v?(x={queryKey:y,queryFn:v},e[18]=y,e[19]=v,e[20]=x):x=e[20];const S=Pe(x).data?.item?.configuration_state??null;let j;e[21]!==S?(j=A=>S?.[A.fieldKey]?.value,e[21]=S,e[22]=j):j=e[22];const b=h.map(j).filter(nn),N=[..._.map(sn),...C.map(tn),...b.map(en)].sort().join(","),R=Pe({queryKey:Y.commerceDiscoveryCompanionConnections(n.id,N),queryFn:async()=>{if(h.length===0)return{items:[]};const A=[{field:["app_name"],operator:"in",value:_},{field:["app_id"],operator:"in",value:C}];b.length>0&&A.push({field:["id"],operator:"in",value:b});const te=await t.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{operator:"or",conditions:A},limit:1e3}});return J(te)}}).data?.items??[],w=new Set(b),T=R.filter(A=>w.has(A.id)),L=T.filter(Js);let P;e[23]!==n.id||e[24]!==n.slug?(P=A=>({queryKey:Y.commerceDiscoveryCompanionOAuthStatus(n.id,A.id),queryFn:async()=>{try{const te=await fetch(`/api/${encodeURIComponent(n.slug)}/connections/${encodeURIComponent(A.id)}/oauth-token/status`,{credentials:"include"});return te.ok?{hasToken:(await te.json()).hasToken===!0}:{hasToken:!1}}catch{return{hasToken:!1}}},retry:!1}),e[23]=n.id,e[24]=n.slug,e[25]=P):P=e[25];const K=ms({queries:L.map(P)});let $;e[26]!==K?($=(A,te)=>[A.id,K[te]?.data?.hasToken===!0],e[26]=K,e[27]=$):$=e[27];const q=new Map(L.map($)),M={};for(const A of T)M[A.id]=!A.oauth_config||!!A.connection_token||q.get(A.id)===!0;const D=Pe({queryKey:Y.commerceDiscoveryCompanionRegistry(n.id,d),queryFn:async()=>{if(h.length===0)return{items:[]};const A=Yt(C,g),te=await as(ct.REGISTRY(n.id),n.id,n.slug,"COLLECTION_REGISTRY_APP_LIST",{...A?{where:A}:{},limit:1e3});return J(te)}}),F={},z={};for(const A of D.data?.items??[])F[A.id]=A,A.server?.name&&(z[A.server.name]=A);let U;e[28]!==n.id||e[29]!==a?(U=Y.commerceDiscoveryConnectionStatus(n.id,a??""),e[28]=n.id,e[29]=a,e[30]=U):U=e[30];const k=!!a;let I;e[31]!==t||e[32]!==a?(I=async()=>{const A=await t.callTool({name:"COMMERCE_DISCOVERY_CONNECTION_STATUS",arguments:{siteUrl:a}});return J(A)},e[31]=t,e[32]=a,e[33]=I):I=e[33];let G;e[34]!==U||e[35]!==k||e[36]!==I?(G={queryKey:U,enabled:k,queryFn:I},e[34]=U,e[35]=k,e[36]=I,e[37]=G):G=e[37];const Z=me(G),X={};for(const[A,te]of Object.entries(Ct)){const ne=Z.data?.providers?.[te];ne?.connected&&ne.via==="sa"&&(X[A]={resource:ne.resource??null})}const ee=Zt({requirements:h,itemsById:F,itemsByName:z,connections:R,connectionReadiness:M,configurationState:S,curated:Ve,saBindings:X});let V;return e[38]!==ee?(V={cards:ee},e[38]=ee,e[39]=V):V=e[39],V}function Js(o){return o.oauth_config&&!o.connection_token}function en(o){return`linked:${o}`}function tn(o){return`app:${o}`}function sn(o){return`binding:${o}`}function nn(o){return typeof o=="string"&&o.length>0}function on(o){return o.bindingType}function an(o){return!Ve[o.bindingType]}function rn(o){return!!o}function ln(o){return Ve[o.bindingType]?.registryAppId}function cn(o){return o.bindingType}function dn({selfClient:o,org:e,userId:t,cdConnectionId:n,domain:i,siteUrl:a}){const l=he(),[c,u]=Q.useState(null),[p,r]=Q.useState(null),[f,m]=Q.useState(null),h=async(g,d)=>{const y=await o.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:g,data:d}});return J(y)};async function _(g){u(g.fieldKey),m(null);const d={app_name:g.title,field_key:g.fieldKey,organization_id:e.id,domain:i,site_url:a};oe("commerce_onboarding_companion_connect_clicked",d);try{let y=g.candidateConnectionId;if(!y){const b=rs(g.registryItem,e.id,t,{remoteIndex:0}),N=b.connection_type==="STDIO",O=!!b.connection_url,R=N&&b.connection_headers&&typeof b.connection_headers=="object"&&"command"in b.connection_headers;if(!O&&!R)return oe("commerce_onboarding_companion_connect_failed",{...d,error:"no_connection_method"}),m(`${g.title} cannot be connected: no connection method available`),!1;const w=await o.callTool({name:"COLLECTION_CONNECTIONS_CREATE",arguments:{data:b}});y=J(w).item.id}const v=y,x=await ls({connectionId:v,orgId:e.id,orgSlug:e.slug,persistFallback:b=>h(v,{connection_token:b}).then(()=>{})});if(!x.ok)return oe("commerce_onboarding_companion_connect_failed",{...d,error:x.error}),m(`Couldn't sign in to ${g.title}: ${x.error}`),!1;const E=await o.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:n}}),S=J(E).item?.configuration_state??null,j=Xt(S,g.fieldKey,g.bindingType,v);return g.bindingType==="github"&&delete j.github_repo,await h(n,{configuration_state:j}),await l.invalidateQueries({queryKey:Y.commerceDiscoveryConnection(e.id,n)}),await l.invalidateQueries({queryKey:Y.commerceDiscoveryCompanionConnectionsPrefix(e.id)}),oe("commerce_onboarding_companion_connected",d),!0}catch(y){return oe("commerce_onboarding_companion_connect_failed",{...d,error:y instanceof Error?y.message:String(y)}),m(y instanceof Error?y.message:String(y)),!1}finally{u(null)}}async function C(g){r(g.fieldKey),m(null);const d={app_name:g.title,field_key:g.fieldKey,organization_id:e.id,domain:i,site_url:a};oe("commerce_onboarding_companion_disconnect_clicked",d);try{const y=await o.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:n}}),x={...J(y).item?.configuration_state??null??{}};return delete x[g.fieldKey],g.bindingType==="github"&&delete x.github_repo,await h(n,{configuration_state:x}),await l.invalidateQueries({queryKey:Y.commerceDiscoveryConnection(e.id,n)}),await l.invalidateQueries({queryKey:Y.commerceDiscoveryCompanionConnectionsPrefix(e.id)}),oe("commerce_onboarding_companion_disconnected",d),!0}catch(y){return oe("commerce_onboarding_companion_disconnect_failed",{...d,error:y instanceof Error?y.message:String(y)}),m(y instanceof Error?y.message:String(y)),!1}finally{r(null)}}return{connect:_,connectingFieldKey:c,disconnect:C,disconnectingFieldKey:p,error:f}}const Be="flex min-h-0 flex-1 flex-col gap-4 md:grid md:flex-none md:gap-4";function We(){const o=H.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("h1",{className:"text-lg font-medium leading-6 text-foreground lg:text-2xl lg:leading-8",children:"Conecte suas ferramentas para ver o diagnóstico completo"}),o[0]=e):e=o[0],e}function un(){const o=H.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[0,1,2,3].map(mn)}),o[0]=e):e=o[0],e}function mn(o){return s.jsx(Gs,{},o)}function fn(){const o=H.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:Be,children:[s.jsx(We,{}),s.jsx(un,{})]}),o[0]=e):e=o[0],e}function pn(o){const e=H.c(5),{onRetry:t}=o;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(We,{}),e[0]=n):n=e[0];let i,a;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("p",{className:"text-sm text-foreground",children:"Não foi possível carregar as integrações complementares."}),a=s.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Algo deu errado ao carregar suas integrações."}),e[1]=i,e[2]=a):(i=e[1],a=e[2]);let l;return e[3]!==t?(l=s.jsxs("div",{className:Be,children:[n,s.jsxs("div",{role:"alert",className:"rounded-2xl border border-border bg-card p-4",children:[i,a,s.jsx(B,{type:"button",variant:"outline",size:"sm",className:"mt-3",onClick:t,children:"Tentar novamente"})]})]}),e[3]=t,e[4]=l):l=e[4],l}function Vn(o){const e=H.c(2);let t;return e[0]!==o?(t=s.jsx(zt,{children:n=>{const{reset:i}=n;return s.jsx(qt,{fallback:a=>{const{resetError:l}=a;return s.jsx(pn,{onRetry:()=>{i(),l()}})},children:s.jsx(Q.Suspense,{fallback:s.jsx(fn,{}),children:s.jsx(hn,{...o})})})}}),e[0]=o,e[1]=t):t=e[1],t}function hn(o){const e=H.c(46),{org:t,cdConnectionId:n,siteUrl:i,onReadinessChange:a}=o,{data:l}=Ft.useSession(),c=l?.user?.id??"";let u;if(e[0]!==i){const R=i?Te(i):null;if(R?.ok)try{u=new URL(R.value).hostname}catch{u=void 0}e[0]=i,e[1]=u}else u=e[1];let p;e[2]!==t.id||e[3]!==t.slug?(p={connectionId:Ut,orgId:t.id,orgSlug:t.slug},e[2]=t.id,e[3]=t.slug,e[4]=p):p=e[4];const r=ze(p);let f;e[5]!==n||e[6]!==t||e[7]!==r||e[8]!==i?(f={selfClient:r,org:t,cdConnectionId:n,siteUrl:i},e[5]=n,e[6]=t,e[7]=r,e[8]=i,e[9]=f):f=e[9];const{cards:m}=Xs(f);let h;e[10]!==n||e[11]!==t||e[12]!==r||e[13]!==u||e[14]!==i||e[15]!==c?(h={selfClient:r,org:t,userId:c,cdConnectionId:n,domain:u,siteUrl:i},e[10]=n,e[11]=t,e[12]=r,e[13]=u,e[14]=i,e[15]=c,e[16]=h):h=e[16];const{connect:_,connectingFieldKey:C,disconnect:g,disconnectingFieldKey:d,error:y}=dn(h),[v,x]=Q.useState(null);if(a?.(m.length===0||m.some(gn)),m.length===0)return null;const E=C!==null||d!==null;let S;e[17]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(We,{}),e[17]=S):S=e[17];let j;e[18]!==y?(j=y&&s.jsx("p",{role:"alert",className:"mb-3 text-sm text-destructive",children:y}),e[18]=y,e[19]=j):j=e[19];let b;if(e[20]!==v||e[21]!==E||e[22]!==m||e[23]!==_||e[24]!==C||e[25]!==g||e[26]!==d||e[27]!==t||e[28]!==r||e[29]!==i){let R;e[31]!==v||e[32]!==E||e[33]!==_||e[34]!==C||e[35]!==g||e[36]!==d||e[37]!==t||e[38]!==r||e[39]!==i?(R=w=>{const T=async()=>{await _(w)&&x(w.fieldKey)};return s.jsx(Vs,{card:w,connecting:C===w.fieldKey,disconnecting:d===w.fieldKey,disabled:E&&C!==w.fieldKey&&d!==w.fieldKey,org:t,selfClient:r,siteUrl:i,autoOpenConfigFieldKey:v,onAutoOpenConfigHandled:()=>x(L=>L===w.fieldKey?null:L),onConnect:()=>{T()},onDisconnect:()=>{g(w)}},w.fieldKey)},e[31]=v,e[32]=E,e[33]=_,e[34]=C,e[35]=g,e[36]=d,e[37]=t,e[38]=r,e[39]=i,e[40]=R):R=e[40],b=m.map(R),e[20]=v,e[21]=E,e[22]=m,e[23]=_,e[24]=C,e[25]=g,e[26]=d,e[27]=t,e[28]=r,e[29]=i,e[30]=b}else b=e[30];let N;e[41]!==b?(N=s.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:b}),e[41]=b,e[42]=N):N=e[42];let O;return e[43]!==j||e[44]!==N?(O=s.jsxs("div",{className:Be,children:[S,s.jsxs(xs,{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:[j,N]})]}),e[43]=j,e[44]=N,e[45]=O):O=e[45],O}function gn(o){return o.satisfied}const Ye="https://decocms.com/agendar",xn="Precisa de ajuda? Fale conosco",yn="Agende uma chamada e ajudamos você a conectar suas ferramentas.",ye=[{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"}],bn="var(--brand-green-dark)";function Bn({siteUrl:o,email:e}){const t=new URL(Ye);return o&&t.searchParams.set("siteUrl",o),e&&t.searchParams.set("email",e),t.toString()}function Cn(o){const e=H.c(12),{href:t,size:n,className:i,orgId:a}=o,l=t===void 0?Ye:t,c=n===void 0?"lg":n;let u;e[0]!==i?(u=ie("w-full",i),e[0]=i,e[1]=u):u=e[1];let p;e[2]!==a?(p=()=>oe("commerce_onboarding_meeting_cta_clicked",{placement:"visual_card",organization_id:a}),e[2]=a,e[3]=p):p=e[3];let r;e[4]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(bt,{size:16}),e[4]=r):r=e[4];let f;e[5]!==l||e[6]!==p?(f=s.jsxs("a",{href:l,target:"_blank",rel:"noreferrer",onClick:p,children:["Agendar uma reunião",r]}),e[5]=l,e[6]=p,e[7]=f):f=e[7];let m;return e[8]!==c||e[9]!==u||e[10]!==f?(m=s.jsx(B,{asChild:!0,variant:"outline",size:c,className:u,children:f}),e[8]=c,e[9]=u,e[10]=f,e[11]=m):m=e[11],m}function vn(o){const e=H.c(10),{size:t}=o,n=t===void 0?72:t;let i;e[0]!==n?(i=Math.round(n*.3),e[0]=n,e[1]=i):i=e[1];const a=i;let l;e[2]!==n?(l={height:n},e[2]=n,e[3]=l):l=e[3];let c;e[4]!==a||e[5]!==n?(c=ye.map((p,r)=>s.jsxs("div",{className:"relative shrink-0",style:{width:n,height:n,marginLeft:r===0?0:-a,zIndex:ye.length-r},children:[s.jsx("div",{className:"h-full w-full overflow-hidden rounded-full border-4 border-card bg-muted",children:s.jsx("img",{src:p.photo,alt:p.alt,className:"h-full w-full object-cover",loading:"lazy"})}),r===0&&s.jsxs("span",{className:"absolute bottom-1.5 right-1.5 flex h-3.5 w-3.5",children:[s.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-success opacity-60 motion-safe:animate-ping","aria-hidden":!0}),s.jsx("span",{className:"relative inline-flex h-3.5 w-3.5 rounded-full border-2 border-card bg-success"})]})]},p.photo)),e[4]=a,e[5]=n,e[6]=c):c=e[6];let u;return e[7]!==l||e[8]!==c?(u=s.jsx("div",{className:"flex items-end",style:l,children:c}),e[7]=l,e[8]=c,e[9]=u):u=e[9],u}function Wn(o){const e=H.c(6),{href:t,orgId:n}=o;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("div",{className:"h-20",style:{backgroundColor:bn}}),e[0]=i):i=e[0];let a;e[1]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("div",{className:"-mt-9 mb-4",children:s.jsx(vn,{})}),e[1]=a):a=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx("h2",{className:"text-lg font-medium leading-6 text-foreground",children:xn}),s.jsx("p",{className:"text-sm leading-5 text-muted-foreground",children:yn})]}),e[2]=l):l=e[2];let c;return e[3]!==t||e[4]!==n?(c=s.jsx("div",{className:"relative flex h-full w-full items-center justify-center p-10",children:s.jsxs("div",{className:"w-full max-w-[440px] overflow-hidden rounded-3xl border border-border bg-card card-shadow",children:[i,s.jsxs("div",{className:"px-8 pb-8",children:[a,l,s.jsx(Cn,{href:t,size:"lg",className:"mt-6",orgId:n})]})]})}),e[3]=t,e[4]=n,e[5]=c):c=e[5],c}function Yn(o){const e=H.c(13),{className:t,href:n,orgId:i}=o,a=n===void 0?Ye:n;let l;e[0]!==i?(l=()=>oe("commerce_onboarding_meeting_cta_clicked",{placement:"mobile_banner",organization_id:i}),e[0]=i,e[1]=l):l=e[1];let c;e[2]!==t?(c=ie("flex items-center gap-3 rounded-xl border border-border bg-card p-3 card-shadow transition-colors hover:bg-accent",t),e[2]=t,e[3]=c):c=e[3];let u,p;e[4]===Symbol.for("react.memo_cache_sentinel")?(u={height:32,width:32+2*Math.round(22.4)},p=ye.map(jn),e[4]=u,e[5]=p):(u=e[4],p=e[5]);let r,f,m;e[6]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs("span",{className:"relative flex shrink-0 items-center",style:u,children:[p,s.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-2.5 w-2.5 rounded-full border-2 border-card bg-success","aria-hidden":!0,style:{zIndex:ye.length+1}})]}),f=s.jsx("span",{className:"flex-1 text-sm font-medium leading-tight text-foreground",children:"Precisa de ajuda? Fale conosco"}),m=s.jsx(bt,{size:16,className:"shrink-0 text-muted-foreground"}),e[6]=r,e[7]=f,e[8]=m):(r=e[6],f=e[7],m=e[8]);let h;return e[9]!==a||e[10]!==l||e[11]!==c?(h=s.jsxs("a",{href:a,target:"_blank",rel:"noreferrer",onClick:l,className:c,children:[r,f,m]}),e[9]=a,e[10]=l,e[11]=c,e[12]=h):h=e[12],h}function jn(o,e){return s.jsx("span",{className:"absolute block h-8 w-8 overflow-hidden rounded-full border-2 border-card",style:{left:e*Math.round(22.4),zIndex:ye.length-e},children:s.jsx("img",{src:o.photo,alt:o.alt,className:"h-full w-full object-cover",loading:"lazy"})},o.photo)}function Zn(o){const e=H.c(10),{host:t}=o,n=`https://www.google.com/s2/favicons?domain=${t}&sz=128`;let i,a,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-7 w-7 dark:hidden"}),a=s.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"h-7 w-7 hidden dark:block"}),l=s.jsx("div",{className:"h-6 w-px rotate-12 bg-border","aria-hidden":"true"}),e[0]=i,e[1]=a,e[2]=l):(i=e[0],a=e[1],l=e[2]);let c;e[3]!==n?(c=s.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-border bg-white",children:s.jsx("img",{src:n,alt:"",className:"h-5 w-5",loading:"lazy"})}),e[3]=n,e[4]=c):c=e[4];let u;e[5]!==t?(u=s.jsx("span",{className:"text-lg font-medium text-foreground",children:t}),e[5]=t,e[6]=u):u=e[6];let p;return e[7]!==c||e[8]!==u?(p=s.jsxs("div",{className:"flex items-center gap-3",children:[i,a,l,c,u]}),e[7]=c,e[8]=u,e[9]=p):p=e[9],p}function _n(o){return o.content?.find(e=>e.text)?.text??"A configuração do Commerce Discovery falhou."}function Xn(o){const e=o;if(e.isError)throw new Error(_n(e));return e.structuredContent??o}export{fn as C,He as L,Zn as S,xs as a,Bn as b,Wn as c,Vn as d,Yn as e,Gn as i,Te as n,Xn as p,Hn as s};
|