decocms 4.186.2 → 4.186.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{AlertCircle-CzHAhrr6.js → AlertCircle-BM2arXAG.js} +1 -1
- package/dist/client/assets/{AreaChart-DfvsG2lG.js → AreaChart-DAXzCJFT.js} +1 -1
- package/dist/client/assets/{ArrowUp-DBrHtvfE.js → ArrowUp-Boc-905Z.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-Difm6SBR.js → ArrowUpRight-B3CxAPJj.js} +1 -1
- package/dist/client/assets/{Check-BMwhITGN.js → Check-D0s6wH1X.js} +1 -1
- package/dist/client/assets/{CheckCircle-CBXbZPqe.js → CheckCircle-BGu0rmUQ.js} +1 -1
- package/dist/client/assets/{ChevronDown-BLutYvIR.js → ChevronDown-CsqU07CB.js} +1 -1
- package/dist/client/assets/{ChevronRight-DcTM74Nx.js → ChevronRight-DzEO4WOO.js} +1 -1
- package/dist/client/assets/{ChevronUp-CnX0DUPn.js → ChevronUp-CLKFL_od.js} +1 -1
- package/dist/client/assets/{Copy01-0FQhJRTl.js → Copy01-Bu4T-_yj.js} +1 -1
- package/dist/client/assets/{CpuChip01-CQ_lGCKe.js → CpuChip01-C3l-ayM0.js} +1 -1
- package/dist/client/assets/{CreditCard01-CIVjejYO.js → CreditCard01-UMOdY0Uv.js} +1 -1
- package/dist/client/assets/{DotsVertical-Bi2Pj2Rx.js → DotsVertical-C4U-eO1-.js} +1 -1
- package/dist/client/assets/{Eye-CNJVROK8.js → Eye-BtghZBaq.js} +1 -1
- package/dist/client/assets/{FilterLines-C-MayH4t.js → FilterLines-BMQz2giZ.js} +1 -1
- package/dist/client/assets/{HardDrive-fDvzj4Z4.js → HardDrive-CrMH19j9.js} +1 -1
- package/dist/client/assets/{Key01-DA8DOmXm.js → Key01-_U8PdKT-.js} +1 -1
- package/dist/client/assets/{LayoutLeft-DwCyodVh.js → LayoutLeft-DhqFICkJ.js} +1 -1
- package/dist/client/assets/{LinkExternal01-ZqumszDD.js → LinkExternal01-D1rq1_uq.js} +1 -1
- package/dist/client/assets/{LogOut01-oRQwceas.js → LogOut01--8dqoEbi.js} +1 -1
- package/dist/client/assets/{Monitor01-BRfBPH_W.js → Monitor01-Cjz_FTaX.js} +1 -1
- package/dist/client/assets/{Palette-R1zicu_8.js → Palette-dgaramLA.js} +1 -1
- package/dist/client/assets/{Play-CmYL2KsO.js → Play-CEjkQJmT.js} +1 -1
- package/dist/client/assets/{Plus-Ro_Rugpt.js → Plus-C-ooojQ-.js} +1 -1
- package/dist/client/assets/{SearchLg-CI4x084k.js → SearchLg-BsbCGElD.js} +1 -1
- package/dist/client/assets/{SearchMd-BbbEhgez.js → SearchMd-DJxFGUte.js} +1 -1
- package/dist/client/assets/{Settings02-BQ_6W_JU.js → Settings02-Dd6wiqD1.js} +1 -1
- package/dist/client/assets/{Shield01-C3qOqW-P.js → Shield01-C-gfca5T.js} +1 -1
- package/dist/client/assets/{Star01-DdMpc2WM.js → Star01-COab1bwH.js} +1 -1
- package/dist/client/assets/{Stars01-CJD9WdTJ.js → Stars01-CrqdYStA.js} +1 -1
- package/dist/client/assets/{Stars02-5ngV3USt.js → Stars02-6dK01kpk.js} +1 -1
- package/dist/client/assets/{Sun-DWxD9K8n.js → Sun-SP_cSydQ.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-DBQaK4CG.js → SwitchHorizontal01-ddUhxlHz.js} +1 -1
- package/dist/client/assets/{Tool01-CCM-RK9J.js → Tool01-n_pcUGI4.js} +1 -1
- package/dist/client/assets/{Tool02-DoDg-nMh.js → Tool02-CM2QQuSk.js} +1 -1
- package/dist/client/assets/{Trash01-Dv4YTeiI.js → Trash01-4ciIHO0v.js} +1 -1
- package/dist/client/assets/{TrendUp01-BR_L8L93.js → TrendUp01-ok3-xVRP.js} +1 -1
- package/dist/client/assets/{Upload01-BNGUctEI.js → Upload01-BN6NYqWG.js} +1 -1
- package/dist/client/assets/{User01-Dy3rZ0aR.js → User01-ZyVKonG8.js} +1 -1
- package/dist/client/assets/{Users01-Dv8D_P-8.js → Users01-Chm4EuVC.js} +1 -1
- package/dist/client/assets/{Users03-BFLEPfzp.js → Users03-CAfxXxrx.js} +1 -1
- package/dist/client/assets/{X-BfG7pUZd.js → X-C9CNUxMc.js} +1 -1
- package/dist/client/assets/{XCircle-BAGVWBr6.js → XCircle-CgmQaEpw.js} +1 -1
- package/dist/client/assets/{XClose-BGriJSCO.js → XClose-Ir2v6njF.js} +1 -1
- package/dist/client/assets/{Zap-CuquuuMb.js → Zap-DMOaYDez.js} +1 -1
- package/dist/client/assets/{ZapSquare-eoAx0e5s.js → ZapSquare-DJ6Cr-Gd.js} +1 -1
- package/dist/client/assets/{access-gate-D_qQ3O5w.js → access-gate-CJbiw1ui.js} +1 -1
- package/dist/client/assets/{add-section-modal-wxLjrdi1.js → add-section-modal-CPDfAg6v.js} +1 -1
- package/dist/client/assets/{agent-icon-5i6OCL5F.js → agent-icon-DZlxuF49.js} +1 -1
- package/dist/client/assets/{agents-list-CkVnW9_s.js → agents-list-yd5LMd0m.js} +1 -1
- package/dist/client/assets/{ai-providers-Di--d8ZD.js → ai-providers-BYQ_-U47.js} +1 -1
- package/dist/client/assets/{alert-w_ycSzvU.js → alert-BUeQIcZG.js} +1 -1
- package/dist/client/assets/{alert-dialog-WfWDyyhH.js → alert-dialog-xIkA8j5x.js} +2 -2
- package/dist/client/assets/app-editor-DOobewvH.js +1 -0
- package/dist/client/assets/{auth-B-H82oVn.js → auth-BS9hvljB.js} +1 -1
- package/dist/client/assets/{auth-catchall-__oUb7VD.js → auth-catchall-BQkJx0Q9.js} +1 -1
- package/dist/client/assets/{auth-entry-BjA_M-t_.js → auth-entry-COeA_b06.js} +1 -1
- package/dist/client/assets/{auth-split-layout-R7Cxbaqe.js → auth-split-layout-D3vaJt1T.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-j7JC5dgx.js → authenticate-and-persist-oauth-BpEFvvfk.js} +1 -1
- package/dist/client/assets/{automation-list-row-DYdMB6iS.js → automation-list-row-BeYIheNk.js} +1 -1
- package/dist/client/assets/automation-runs-DJDyx8Ab.js +281 -0
- package/dist/client/assets/{automations-Cm8WmhnT.js → automations-Dc8V9snr.js} +1 -1
- package/dist/client/assets/{avatar-B4WZZi9O.js → avatar-TMC1sUqM.js} +1 -1
- package/dist/client/assets/{badge-CO3kByaZ.js → badge-Cw8NAtiW.js} +1 -1
- package/dist/client/assets/{billing-Dc6_mmjP.js → billing-C0B7lv24.js} +1 -1
- package/dist/client/assets/{block-document-CVqPMrIE.js → block-document-BAeei5ic.js} +3 -3
- package/dist/client/assets/{brand-context-GAWNcchS.js → brand-context-B8Z3AOB1.js} +1 -1
- package/dist/client/assets/{buckets-DV19hkuZ.js → buckets-BUDz0wYB.js} +1 -1
- package/dist/client/assets/bulk-category-panel-Bp_iUjkm.js +1 -0
- package/dist/client/assets/{capability-load-error-CDL0nVSP.js → capability-load-error-DlPlQyTu.js} +1 -1
- package/dist/client/assets/{card-CdJSU8vr.js → card-f7IIAQow.js} +1 -1
- package/dist/client/assets/category-editor-Q4jhDglC.js +1 -0
- package/dist/client/assets/{chat-context-BRG2mTLS.js → chat-context-lZafrisH.js} +4 -4
- package/dist/client/assets/{checkbox-VRqoAnNP.js → checkbox-DRvNUH73.js} +1 -1
- package/dist/client/assets/{cli-auth-success-DOj7bhhA.js → cli-auth-success-C8NhW6ZX.js} +1 -1
- package/dist/client/assets/{collection-detail-DOFmzk0Q.js → collection-detail-Cw8pxVYF.js} +1 -1
- package/dist/client/assets/{collection-display-button-DIwMt19t.js → collection-display-button-Bt8fcXAU.js} +1 -1
- package/dist/client/assets/{collection-search-Ttix_hvO.js → collection-search-BcJG8MRL.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-DatbUTtn.js → collection-table-wrapper-KcuXHMSk.js} +1 -1
- package/dist/client/assets/{collection-tabs-DCuuZvcU.js → collection-tabs-DdOwtj6b.js} +1 -1
- package/dist/client/assets/{command-DzYbwMY0.js → command-DGcauViI.js} +1 -1
- package/dist/client/assets/commerce-onboarding-CfDDDw6y.js +1 -0
- package/dist/client/assets/{connect-BlS6fDvq.js → connect-BOHbND-E.js} +1 -1
- package/dist/client/assets/{connection-DeKOyYCe.js → connection-D6HFEYzq.js} +1 -1
- package/dist/client/assets/{connection-card-D9ACpI6n.js → connection-card-BVHwhA2v.js} +1 -1
- package/dist/client/assets/{connection-detail-YoMnwCGB.js → connection-detail-DNk_cneF.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-B2do0MQh.js → connection-form-helpers-4kXFEJvh.js} +1 -1
- package/dist/client/assets/{connections-54YkSDnq.js → connections-BtTLDoE9.js} +1 -1
- package/dist/client/assets/{decopilot-sse-pool-B4lV_pkT.js → decopilot-sse-pool-DIaaeHkx.js} +1 -1
- package/dist/client/assets/{dialog-DQWMOcko.js → dialog-CM96GyMN.js} +1 -1
- package/dist/client/assets/{domain-settings-U4W1yTMA.js → domain-settings-B-8BrNH4.js} +1 -1
- package/dist/client/assets/{drawer-CaAWxgE_.js → drawer-Dn3JbFxM.js} +1 -1
- package/dist/client/assets/{dropdown-menu-BrspSm3T.js → dropdown-menu-CuE5oWLS.js} +1 -1
- package/dist/client/assets/{empty-state-Di4I9IOD.js → empty-state-B-rbOsZt.js} +1 -1
- package/dist/client/assets/{extract-connection-data-hkN_mOmy.js → extract-connection-data-D78MPGm0.js} +1 -1
- package/dist/client/assets/file-explorer-BNEWK43O.js +2 -0
- package/dist/client/assets/{form-CyEJbmjQ.js → form-DJREymz4.js} +1 -1
- package/dist/client/assets/{general-Beu18HTM.js → general-Bvib2mwc.js} +1 -1
- package/dist/client/assets/{github-repo-picker-CKJmsZJv.js → github-repo-picker-DnRkLuCY.js} +1 -1
- package/dist/client/assets/{hooks-DHFul8ca.js → hooks-DzdIDE_S.js} +5 -5
- package/dist/client/assets/{index-Cuug8jd7.js → index-B0fkC9lT.js} +27 -27
- package/dist/client/assets/{index-CYVUgbiC.js → index-BKQvMWY3.js} +2 -2
- package/dist/client/assets/index-BLe-kRg3.js +1 -0
- package/dist/client/assets/index-C9Hb4-0H.js +1 -0
- package/dist/client/assets/index-CFru9TWd.js +738 -0
- package/dist/client/assets/{index-CT5lSHsd.js → index-Cbb91-P4.js} +1 -1
- package/dist/client/assets/{index-hERXLT2s.js → index-Ccnv49_z.js} +1 -1
- package/dist/client/assets/{index-DL8v59CJ.js → index-ClVafn5Q.js} +1 -1
- package/dist/client/assets/{index-DjfX2K1C.js → index-D3hIc5HE.js} +1 -1
- package/dist/client/assets/index-DHCkR8xR.css +1 -0
- package/dist/client/assets/{index-C65_levZ.js → index-Dytal4UA.js} +1 -1
- package/dist/client/assets/{index-Cxhypuyo.js → index-Uyw3lO4W.js} +4 -4
- package/dist/client/assets/{index-redirect-BAqq5-dr.js → index-redirect-C63Ka-dC.js} +1 -1
- package/dist/client/assets/{input-DXhpVfJR.js → input-BLYKaojw.js} +1 -1
- package/dist/client/assets/{integration-icon-CDNH_447.js → integration-icon-y2a679m_.js} +1 -1
- package/dist/client/assets/{invite-member-dialog-C6UChNCn.js → invite-member-dialog-pvdnivHT.js} +1 -1
- package/dist/client/assets/{label-BQAPYpl9.js → label-CpR3NhLK.js} +1 -1
- package/dist/client/assets/{layout-DaqEbepG.js → layout-DkAn-olq.js} +1 -1
- package/dist/client/assets/{login-BUXngS89.js → login-uBznkVFV.js} +1 -1
- package/dist/client/assets/{mcp-oauth-YbTKUbfv.js → mcp-oauth-Cbz6v_pp.js} +1 -1
- package/dist/client/assets/{members-D6JCoUOa.js → members-CYoo4I8Y.js} +1 -1
- package/dist/client/assets/{monaco-editor-CkHuDiB4.js → monaco-editor-ChN-uCZ5.js} +4 -4
- package/dist/client/assets/{monitoring-stats-row-Bw2V65FM.js → monitoring-stats-row-CaWJELM4.js} +1 -1
- package/dist/client/assets/{multi-select-D4Z78k2n.js → multi-select-HsDIiU9u.js} +1 -1
- package/dist/client/assets/{oauth-callback-wYnJpAVM.js → oauth-callback-D4B9fvV3.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-Dn0DBncC.js → oauth-callback-ai-provider-D8wbGI6A.js} +1 -1
- package/dist/client/assets/{onboarding-BeWN2rdF.js → onboarding-Ds1l48aO.js} +1 -1
- package/dist/client/assets/{org-layout-BM4IxkKa.js → org-layout-D5C_xL5_.js} +1 -1
- package/dist/client/assets/{organization-choice-CIidmFuH.js → organization-choice-DAqtf8QJ.js} +1 -1
- package/dist/client/assets/{orgs-DeoWjAXr.js → orgs-D62MZerx.js} +1 -1
- package/dist/client/assets/{page-seo-form-D8dMsdHr.js → page-seo-form-C4SkFKsY.js} +1 -1
- package/dist/client/assets/{popover-DYdwyBTg.js → popover-BbhyOPS3.js} +1 -1
- package/dist/client/assets/post-editor-Bpk6It1u.js +1 -0
- package/dist/client/assets/{primitives-8LRj2IuU.js → primitives-Bt3tuGeo.js} +1 -1
- package/dist/client/assets/{profile-9Mx2DBRz.js → profile-BctbNEfJ.js} +1 -1
- package/dist/client/assets/project-app-view-BKQjXNca.js +1 -0
- package/dist/client/assets/{provision-repo-scoped-github-connection-B2s3ApVy.js → provision-repo-scoped-github-connection-ufuvpGD9.js} +1 -1
- package/dist/client/assets/record-editor-QqrTdXL4.js +1 -0
- package/dist/client/assets/redirect-editor-D8jJ6iR_.js +1 -0
- package/dist/client/assets/registry-DhILOcmJ.js +2 -0
- package/dist/client/assets/{registry-layout-CdR4k8dc.js → registry-layout-CQMbkd7b.js} +1 -1
- package/dist/client/assets/{reports-Dqghkvg0.js → reports-rEO41B-T.js} +1 -1
- package/dist/client/assets/{require-capability-B_1QWSj5.js → require-capability-CZ-yYBiA.js} +1 -1
- package/dist/client/assets/{required-auth-layout-Do4z8fey.js → required-auth-layout-DtQVJg-L.js} +1 -1
- package/dist/client/assets/{reset-password-Bbz5yR7K.js → reset-password-xaU8NkAt.js} +1 -1
- package/dist/client/assets/{roles-CvBgQaaU.js → roles-CaPOmG9k.js} +1 -1
- package/dist/client/assets/{search-input-BQlH8Ixe.js → search-input-CZdp52yV.js} +1 -1
- package/dist/client/assets/{secrets-CGw3MbTg.js → secrets-DizdSJgN.js} +1 -1
- package/dist/client/assets/sections-editor-B4E9k2Dl.js +2 -0
- package/dist/client/assets/{select-B5znG0Y1.js → select-BudfwrnS.js} +1 -1
- package/dist/client/assets/{select-model-BkPkSQNk.js → select-model-C7aX0FnY.js} +1 -1
- package/dist/client/assets/self-tool-result-Cj3FZK_q.js +1 -0
- package/dist/client/assets/seo-editor-Dgknhqwj.js +1 -0
- package/dist/client/assets/{settings-layout-BNo2qt6b.js → settings-layout-CU-4TAUD.js} +1 -1
- package/dist/client/assets/{settings-section-BI76S-ZK.js → settings-section-BE7oCApW.js} +1 -1
- package/dist/client/assets/{shell-controls-DsJFVhA4.js → shell-controls-crL6wfUO.js} +1 -1
- package/dist/client/assets/{shell-layout-DZReMwJ6.js → shell-layout-GtI-8lBm.js} +1 -1
- package/dist/client/assets/sidebar-D3IIq4Vk.js +1 -0
- package/dist/client/assets/{skeleton-D0WX-Zws.js → skeleton-GgH9QFOh.js} +1 -1
- package/dist/client/assets/{spinner-pPCTrTnr.js → spinner-DFReXmvo.js} +1 -1
- package/dist/client/assets/{sso-ChAfsvMM.js → sso-BWPSV72o.js} +1 -1
- package/dist/client/assets/{store-bPz4hvdF.js → store-BhZZOuCy.js} +1 -1
- package/dist/client/assets/store-registry-DJSlp72K.js +2 -0
- package/dist/client/assets/{studio-tools-C08UjHsr.js → studio-tools-BaJrIiyZ.js} +1 -1
- package/dist/client/assets/{switch-DYWfZ4oI.js → switch-tQg0oUQP.js} +1 -1
- package/dist/client/assets/{tab-id-DFGnzFYn.js → tab-id-7eVkCyFd.js} +1 -1
- package/dist/client/assets/{table-CAhOdKdH.js → table-C1MCilFh.js} +1 -1
- package/dist/client/assets/{tabs-DsPtL2iD.js → tabs-DX3EM3Ee.js} +1 -1
- package/dist/client/assets/{textarea-9vzfIjDG.js → textarea-mkvWFVEl.js} +1 -1
- package/dist/client/assets/{toggle-group-DY0VwFSy.js → toggle-group-F8qf1aho.js} +1 -1
- package/dist/client/assets/{toolbar-BBy3sR0H.js → toolbar-Cf542s4U.js} +1 -1
- package/dist/client/assets/{tooltip-D09V-b-D.js → tooltip-CD1UqZ9B.js} +1 -1
- package/dist/client/assets/{use-ai-providers-Cg8eqOhK.js → use-ai-providers-D16FGHJt.js} +1 -1
- package/dist/client/assets/{use-automations-CjCcOCBs.js → use-automations-D8H19XtT.js} +1 -1
- package/dist/client/assets/{use-autosave-CzDpaxid.js → use-autosave-DL6SLVUG.js} +1 -1
- package/dist/client/assets/{use-capability-BZtV5fjq.js → use-capability-CE9es946.js} +1 -1
- package/dist/client/assets/{use-clock-tick-j7al6WgB.js → use-clock-tick-B_PZSxjQ.js} +1 -1
- package/dist/client/assets/{use-connection-DLCNMhT_.js → use-connection-C9xGzeZ0.js} +1 -1
- package/dist/client/assets/{use-copy-K8bJ1Pv1.js → use-copy-Biga7DQq.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-mSYhJKd_.js → use-create-virtual-mcp-C5b_hYeV.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-DyyWFfWP.js → use-debounced-autosave-oSeifFUO.js} +1 -1
- package/dist/client/assets/{use-debounced-value-f6dEbPtS.js → use-debounced-value-B6d-EEaH.js} +1 -1
- package/dist/client/assets/{use-deco-credits-B0sL3XCm.js → use-deco-credits-DEFWEFHy.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-C2Oegu9x.js → use-decopilot-events-DPOdIyZW.js} +1 -1
- package/dist/client/assets/{use-delete-connection-V5PIhb7n.js → use-delete-connection-B83lgoSz.js} +1 -1
- package/dist/client/assets/{use-deployment-admin-2G5IDOTX.js → use-deployment-admin-BQjxPpS5.js} +1 -1
- package/dist/client/assets/{use-file-configs-ZOIFLESr.js → use-file-configs-lWDULD1a.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-BOup92L2.js → use-infinite-scroll-BuArBLl_.js} +1 -1
- package/dist/client/assets/{use-join-requests-DJLV4CSV.js → use-join-requests-CeBrzND0.js} +1 -1
- package/dist/client/assets/use-mcp-client-D8jVoojU.js +10 -0
- package/dist/client/assets/{use-mcp-tools-JePK22Oi.js → use-mcp-tools-CxNi4RsV.js} +1 -1
- package/dist/client/assets/{use-members-B28NMHu7.js → use-members-DYQSbhV-.js} +1 -1
- package/dist/client/assets/{use-mobile-DFoMyuD6.js → use-mobile-C76oZZ_y.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-CP2_58b3.js → use-navigate-to-agent-B7ku0JC8.js} +1 -1
- package/dist/client/assets/{use-open-billing-url-DefE1f9-.js → use-open-billing-url-DquSLGrh.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-BUZkHhRH.js → use-org-auth-client-CLw_zaJR.js} +1 -1
- package/dist/client/assets/{use-org-sso-B1fpUBuH.js → use-org-sso-DQRelBUr.js} +1 -1
- package/dist/client/assets/{use-organization-roles-DwJh3T-9.js → use-organization-roles-B7ZCQVse.js} +1 -1
- package/dist/client/assets/{use-organization-settings-DtUf52ZO.js → use-organization-settings-DAWGh7rb.js} +1 -1
- package/dist/client/assets/{use-registry-connections-DTbTMRqC.js → use-registry-connections-4HrWpBE2.js} +1 -1
- package/dist/client/assets/{use-secrets-B8PKKgDf.js → use-secrets-CV1UNts7.js} +1 -1
- package/dist/client/assets/{use-status-sounds--E_CrJ-R.js → use-status-sounds-Dxu-GZwE.js} +1 -1
- package/dist/client/assets/{use-tags-y6Q0JJyB.js → use-tags-CF2jWoFP.js} +1 -1
- package/dist/client/assets/{use-view-mode-DRR58QSp.js → use-view-mode-8obytCVP.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-PtirDXqx.js → use-virtual-mcp-BRfZj2ng.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-CuXI7a9b.js +1 -0
- package/dist/client/assets/{useRouterState-DwCLyiBJ.js → useRouterState-CIMkbMOV.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-FYAwQiAK.js +1 -0
- package/dist/client/assets/{users-B-7FmAt0.js → users-l3buiqkJ.js} +1 -1
- package/dist/client/assets/variant-calendar-CufrhFsD.js +1 -0
- package/dist/client/assets/{view-mode-toggle-lJepTQIW.js → view-mode-toggle-CErBMjrv.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/app-editor-mYQBEhVt.js +0 -1
- package/dist/client/assets/automation-runs-CQwGBeB-.js +0 -47
- package/dist/client/assets/bulk-category-panel-Dm0XLl8t.js +0 -1
- package/dist/client/assets/calendar-CoGJ_oVh.js +0 -235
- package/dist/client/assets/category-editor-W6tm7Ykr.js +0 -1
- package/dist/client/assets/commerce-onboarding-GT_73BPE.js +0 -1
- package/dist/client/assets/companions-core-PKrSbaze.js +0 -1
- package/dist/client/assets/file-explorer-Bk6wbb2K.js +0 -2
- package/dist/client/assets/index-B8kihcrU.js +0 -663
- package/dist/client/assets/index-CUIiLem4.css +0 -1
- package/dist/client/assets/index-CnssvP1E.js +0 -77
- package/dist/client/assets/index-CoapyGFA.js +0 -1
- package/dist/client/assets/index-KYX7LuWR.js +0 -1
- package/dist/client/assets/post-editor-BdDdpNQu.js +0 -1
- package/dist/client/assets/project-app-view-CGqpRmN-.js +0 -1
- package/dist/client/assets/record-editor-Kz5MxvVB.js +0 -1
- package/dist/client/assets/redirect-editor-oaFF-keF.js +0 -1
- package/dist/client/assets/registry-D41BL0Zp.js +0 -2
- package/dist/client/assets/sections-editor-BShs3A-H.js +0 -2
- package/dist/client/assets/self-tool-result-CR63nIK5.js +0 -1
- package/dist/client/assets/seo-editor-Cb0Y9AY1.js +0 -1
- package/dist/client/assets/sidebar-BIAbDN30.js +0 -1
- package/dist/client/assets/store-registry-D4rRXf4e.js +0 -2
- package/dist/client/assets/use-mcp-client-BDN-FEcc.js +0 -10
- package/dist/client/assets/useInfiniteQuery-DD0TdbWx.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-Dx_jU7Uo.js +0 -1
- package/dist/client/assets/variant-calendar-CPb-l2DG.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{aJ as dt,Y as Te,aK as ut,X as mt,aL as Ge,o as be,aM as ft,aN as pt,r as G,aO as gt,aP as ht,aQ as xt,aR as bt,aS as Ue,aT as yt,aU as Ct,aV as vt,c as W,m as me,j as n,b as te,k as Ie,B as Z,e as _e,K as J,Z as ye,$ as re,a2 as Ce,a1 as ve,n as he,ar as jt,t as Se,u as St,x as Ee,p as ue,Q as Ot,E as _t,a as Nt}from"./index-Cuug8jd7.js";import{W as He,g as Et,u as Re,S as Tt}from"./use-mcp-client-BDN-FEcc.js";import{I as ke}from"./integration-icon-CDNH_447.js";import{c as pe,b as We,h as Ye,a as Ze,d as Je,e as Xe}from"./dialog-DQWMOcko.js";import{c as Fe,T as Le,a as Ae}from"./tooltip-D09V-b-D.js";import{m as et,e as tt,T as wt}from"./agent-icon-5i6OCL5F.js";import{u as ee,t as It,m as Rt,s as Be,g as kt,p as Ft,F as Lt,b as At,a as Dt,c as Pt}from"./companions-core-PKrSbaze.js";import{i as nt}from"./CheckCircle-CBXbZPqe.js";import{d as ae,F as je,a as le,e as fe,b as ce,c as de,f as qt}from"./form-CyEJbmjQ.js";import{I as ge}from"./input-DXhpVfJR.js";import{i as $t}from"./Check-BMwhITGN.js";import{a as ot}from"./Copy01-0FQhJRTl.js";import{b as Kt}from"./Settings02-BQ_6W_JU.js";import{s as Ut}from"./Eye-CNJVROK8.js";import{u as Bt}from"./use-debounced-value-f6dEbPtS.js";import{f as st,a as Qt,p as Mt,i as zt}from"./provision-repo-scoped-github-connection-B2s3ApVy.js";import{c as Vt,e as Gt}from"./extract-connection-data-hkN_mOmy.js";import{a as Ht}from"./authenticate-and-persist-oauth-j7JC5dgx.js";function Qe(s,e){const t=new Set(e);return s.filter(o=>!t.has(o))}function Wt(s,e,t){const o=s.slice(0);return o[e]=t,o}var Yt=class extends dt{#s;#e;#i;#o;#t;#n;#r;#a;#l;#c=[];constructor(s,e,t){super(),this.#s=s,this.#o=t,this.#i=[],this.#t=[],this.#e=[],this.setQueries(e)}onSubscribe(){this.listeners.size===1&&this.#t.forEach(s=>{s.subscribe(e=>{this.#f(s,e)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#t.forEach(s=>{s.destroy()})}setQueries(s,e){this.#i=s,this.#o=e,Te.batch(()=>{const t=this.#t,o=this.#m(this.#i);o.forEach(i=>i.observer.setOptions(i.defaultedQueryOptions));const l=o.map(i=>i.observer),c=l.map(i=>i.getCurrentResult()),a=t.length!==l.length,r=l.some((i,d)=>i!==t[d]),m=a||r,p=m?!0:c.some((i,d)=>{const g=this.#e[d];return!g||!ut(i,g)});!m&&!p||(m&&(this.#c=o,this.#t=l),this.#e=c,this.hasListeners()&&(m&&(Qe(t,l).forEach(i=>{i.destroy()}),Qe(l,t).forEach(i=>{i.subscribe(d=>{this.#f(i,d)})})),this.#p()))})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map(s=>s.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(s,e){const t=this.#m(s),o=t.map(c=>c.observer.getOptimisticResult(c.defaultedQueryOptions)),l=t.map(c=>c.defaultedQueryOptions.queryHash);return[o,c=>this.#u(c??o,e,l),()=>this.#d(o,t)]}#d(s,e){return e.map((t,o)=>{const l=s[o];return t.defaultedQueryOptions.notifyOnChangeProps?l:t.observer.trackResult(l,c=>{e.forEach(a=>{a.observer.trackProp(c)})})})}#u(s,e,t){if(e){const o=this.#l,l=t!==void 0&&o!==void 0&&(o.length!==t.length||t.some((c,a)=>c!==o[a]));return(!this.#n||this.#e!==this.#a||l||e!==this.#r)&&(this.#r=e,this.#a=this.#e,t!==void 0&&(this.#l=t),this.#n=mt(this.#n,e(s))),this.#n}return s}#g(){return this.#o?.combine!==void 0&&this.#t.some((s,e)=>s.options.suspense&&this.#e[e]?.data===void 0)}#m(s){const e=new Map;this.#t.forEach(o=>{const l=o.options.queryHash;if(!l)return;const c=e.get(l);c?c.push(o):e.set(l,[o])});const t=[];return s.forEach(o=>{const l=this.#s.defaultQueryOptions(o),a=e.get(l.queryHash)?.shift()??new Ge(this.#s,l);t.push({defaultedQueryOptions:l,observer:a})}),t}#f(s,e){const t=this.#t.indexOf(s);t!==-1&&(this.#e=Wt(this.#e,t,e),this.#p())}#p(){if(this.hasListeners()){const s=this.#d(this.#e,this.#c),e=this.#g(),t=this.#n,o=e?t:this.#u(s,this.#o?.combine);(e||t!==o)&&Te.batch(()=>{this.listeners.forEach(l=>{l(this.#e)})})}}};function Zt({queries:s,...e},t){const o=be(t),l=ft(),c=pt(),a=G.useMemo(()=>s.map(b=>{const h=o.defaultQueryOptions(b);return h._optimisticResults=l?"isRestoring":"optimistic",h}),[s,o,l]);a.forEach(b=>{gt(b);const h=o.getQueryCache().get(b.queryHash);ht(b,c,h)}),xt(c);const[r]=G.useState(()=>new Yt(o,a,e)),[m,p,i]=r.getOptimisticResult(a,e.combine),d=!l&&e.subscribed!==!1;G.useSyncExternalStore(G.useCallback(b=>d?r.subscribe(Te.batchCalls(b)):bt,[r,d]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),G.useEffect(()=>{r.setQueries(a,e)},[a,e,r]);const u=m.some((b,h)=>Ue(a[h],b))?m.flatMap((b,h)=>{const x=a[h];if(x&&Ue(x,b)){const f=new Ge(o,x);return yt(x,f,c)}return[]}):[];if(u.length>0)throw Promise.all(u);const y=m.find((b,h)=>{const x=a[h];return x&&Ct({result:b,errorResetBoundary:c,throwOnError:x.throwOnError,query:o.getQueryCache().get(x.queryHash),suspense:x.suspense})});if(y?.error)throw y.error;return p(i())}function Jt(s,e){return Zt({...s,queries:s.queries.map(t=>({...t,suspense:!0,throwOnError:vt,enabled:!0,placeholderData:void 0}))},e)}const Xt=/^[a-zA-Z][a-zA-Z\d+.-]*:/,en=/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//,tn=/^[^\s/:?#]+\.[^\s/:?#]+:\d+(?:[/?#]|$)/,nn=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;function Oe(s){const e=s.trim();if(!e)return{ok:!1,error:"Enter a website URL."};const t=Xt.test(e),o=en.test(e),l=tn.test(e);if(t&&!o&&!l)return{ok:!1,error:"Use an HTTP or HTTPS website URL."};const c=o?e:`https://${e}`;let a;try{a=new URL(c)}catch{return{ok:!1,error:"Enter a valid website URL."}}if(a.protocol!=="http:"&&a.protocol!=="https:")return{ok:!1,error:"Use an HTTP or HTTPS website URL."};const r=a.hostname.split(".");return r.length<2||r.some(m=>!m||!nn.test(m))?{ok:!1,error:"Enter a valid website URL."}:(a.protocol="https:",{ok:!0,value:a.origin})}function jo(s,e){if(!s.trim())return!0;const t=Oe(s);if(!t.ok||!e)return!1;const o=Oe(e);return o.ok&&o.value===t.value}function So(s){if(!s)return null;const e=Oe(s);return e.ok?new URL(e.value).hostname:null}function on(s){const e=W.c(14),{children:t,className:o,wrapperClassName:l}=s,[c,a]=G.useState(!0);let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=b=>{if(!b)return;const h=()=>{const f=b.scrollHeight-b.scrollTop-b.clientHeight<8;a(f)};h(),b.addEventListener("scroll",h,{passive:!0});const x=new ResizeObserver(h);x.observe(b);for(const f of Array.from(b.children))x.observe(f);return()=>{b.removeEventListener("scroll",h),x.disconnect()}},e[0]=r):r=e[0];const m=r;let p;e[1]!==l?(p=me("relative",l),e[1]=l,e[2]=p):p=e[2];let i;e[3]!==t||e[4]!==o?(i=n.jsx("div",{ref:m,className:o,children:t}),e[3]=t,e[4]=o,e[5]=i):i=e[5];const d=c?"opacity-0":"opacity-100";let g;e[6]!==d?(g=me("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",d),e[6]=d,e[7]=g):g=e[7];let u;e[8]!==g?(u=n.jsx("div",{"aria-hidden":!0,className:g}),e[8]=g,e[9]=u):u=e[9];let y;return e[10]!==p||e[11]!==i||e[12]!==u?(y=n.jsxs("div",{className:p,children:[i,u]}),e[10]=p,e[11]=i,e[12]=u,e[13]=y):y=e[13],y}function sn(s){const e=W.c(25),{icon:t,title:o,headline:l,required:c,attention:a,action:r}=s,m=te(),p=a?"border-warning/50 bg-warning/[0.04]":"border-border";let i;e[0]!==p?(i=me("relative flex items-center justify-between gap-3 rounded-lg border bg-card p-3.5 sm:gap-4 sm:p-4",p),e[0]=p,e[1]=i):i=e[1];let d;e[2]!==c||e[3]!==m?(d=c&&n.jsx("span",{className:"absolute -top-3 right-4 rounded-full border border-input bg-background px-3 py-1 text-xs font-medium text-foreground",children:m("commerceOnboarding.companionCard.required")}),e[2]=c,e[3]=m,e[4]=d):d=e[4];let g;e[5]!==t||e[6]!==o?(g=n.jsx(ke,{icon:t,name:o,size:"sm",fit:"contain",className:"size-[30px] shrink-0 p-1"}),e[5]=t,e[6]=o,e[7]=g):g=e[7];let u;e[8]!==o?(u=n.jsx("span",{className:"text-sm font-medium text-foreground",children:o}),e[8]=o,e[9]=u):u=e[9];let y;e[10]!==l?(y=l&&n.jsx("p",{className:"hidden text-sm leading-5 text-muted-foreground sm:block",children:l}),e[10]=l,e[11]=y):y=e[11];let b;e[12]!==u||e[13]!==y?(b=n.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[u,y]}),e[12]=u,e[13]=y,e[14]=b):b=e[14];let h;e[15]!==g||e[16]!==b?(h=n.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3 sm:items-start",children:[g,b]}),e[15]=g,e[16]=b,e[17]=h):h=e[17];let x;e[18]!==r?(x=n.jsx("div",{className:"shrink-0",children:r}),e[18]=r,e[19]=x):x=e[19];let f;return e[20]!==i||e[21]!==d||e[22]!==h||e[23]!==x?(f=n.jsxs("div",{className:i,children:[d,h,x]}),e[20]=i,e[21]=d,e[22]=h,e[23]=x,e[24]=f):f=e[24],f}function it(s){const e=W.c(12),{connecting:t,disabled:o,title:l,primary:c,onConnect:a}=s,r=te(),m=c?"default":"outline",p=o||t;let i;e[0]!==r||e[1]!==l?(i=r("commerceOnboarding.companionCard.connectAriaLabel",{title:l}),e[0]=r,e[1]=l,e[2]=i):i=e[2];let d;e[3]!==t||e[4]!==r?(d=t?n.jsx(Ie,{size:16,className:"animate-spin"}):r("commerceOnboarding.companionCard.connect"),e[3]=t,e[4]=r,e[5]=d):d=e[5];let g;return e[6]!==a||e[7]!==m||e[8]!==p||e[9]!==i||e[10]!==d?(g=n.jsx(Z,{type:"button",variant:m,size:"sm",disabled:p,onClick:a,"aria-label":i,children:d}),e[6]=a,e[7]=m,e[8]=p,e[9]=i,e[10]=d,e[11]=g):g=e[11],g}function rn(s){const e=W.c(11),{disabled:t,title:o,onConfigure:l}=s,c=te();let a;e[0]!==c||e[1]!==o?(a=c("commerceOnboarding.companionCard.configureAriaLabel",{title:o}),e[0]=c,e[1]=o,e[2]=a):a=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx(et,{size:16}),e[3]=r):r=e[3];let m;e[4]!==c?(m=c("commerceOnboarding.companionCard.finishSetup"),e[4]=c,e[5]=m):m=e[5];let p;return e[6]!==t||e[7]!==l||e[8]!==a||e[9]!==m?(p=n.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"border-warning/60 text-warning hover:bg-warning/10 hover:text-warning",disabled:t,onClick:l,"aria-label":a,children:[r,m]}),e[6]=t,e[7]=l,e[8]=a,e[9]=m,e[10]=p):p=e[10],p}function rt(s){const e=W.c(9),{detail:t,controls:o}=s,l=te();let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(nt,{size:16,className:"text-success"}),e[0]=c):c=e[0];let a;e[1]!==t||e[2]!==l?(a=t?n.jsx("span",{className:"max-w-40 truncate text-foreground",children:t}):l("commerceOnboarding.companionCard.connected"),e[1]=t,e[2]=l,e[3]=a):a=e[3];let r;e[4]!==a?(r=n.jsxs("span",{className:"flex items-center gap-1.5 text-sm text-muted-foreground",children:[c," ",a]}),e[4]=a,e[5]=r):r=e[5];let m;return e[6]!==o||e[7]!==r?(m=n.jsxs("div",{className:"flex items-center gap-1",children:[r,o]}),e[6]=o,e[7]=r,e[8]=m):m=e[8],m}function at(s){const e=W.c(4),{ariaLabel:t,onClick:o}=s;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(et,{size:16}),e[0]=l):l=e[0];let c;return e[1]!==t||e[2]!==o?(c=n.jsx(Z,{type:"button",variant:"ghost",size:"icon-sm",className:"shrink-0",onClick:o,"aria-label":t,children:l}),e[1]=t,e[2]=o,e[3]=c):c=e[3],c}function we(s){const e=W.c(38);let t,o,l,c,a;e[0]!==s?({value:a,onChange:o,placeholder:l,className:t,...c}=s,e[0]=s,e[1]=t,e[2]=o,e[3]=l,e[4]=c,e[5]=a):(t=e[1],o=e[2],l=e[3],c=e[4],a=e[5]);const[r,m]=G.useState(!1),[p,i]=G.useState(!1);let d;e[6]!==a?(d=async()=>{if(a)try{await navigator.clipboard.writeText(a),i(!0),setTimeout(()=>i(!1),2e3)}catch(_){console.error("Failed to copy text: ",_)}},e[6]=a,e[7]=d):d=e[7];const g=d;let u;e[8]!==r?(u=()=>{m(!r)},e[8]=r,e[9]=u):u=e[9];const y=u,b=r?"text":"password";let h;e[10]!==t?(h=me("pr-20",t),e[10]=t,e[11]=h):h=e[11];let x;e[12]!==o||e[13]!==l||e[14]!==c||e[15]!==b||e[16]!==h||e[17]!==a?(x=n.jsx(ge,{type:b,value:a,onChange:o,placeholder:l,className:h,...c}),e[12]=o,e[13]=l,e[14]=c,e[15]=b,e[16]=h,e[17]=a,e[18]=x):x=e[18];const f=r?"Hide password":"Show password";let S;e[19]!==r?(S=r?n.jsx(Kt,{size:16}):n.jsx(Ut,{size:16}),e[19]=r,e[20]=S):S=e[20];let v;e[21]!==f||e[22]!==S||e[23]!==y?(v=n.jsx(Z,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:y,title:f,children:S}),e[21]=f,e[22]=S,e[23]=y,e[24]=v):v=e[24];const E=!a,O=p?"Copied!":"Copy token";let j;e[25]!==p?(j=p?n.jsx($t,{size:16}):n.jsx(ot,{size:16}),e[25]=p,e[26]=j):j=e[26];let C;e[27]!==g||e[28]!==O||e[29]!==j||e[30]!==E?(C=n.jsx(Z,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:g,disabled:E,title:O,children:j}),e[27]=g,e[28]=O,e[29]=j,e[30]=E,e[31]=C):C=e[31];let w;e[32]!==C||e[33]!==v?(w=n.jsxs("div",{className:"absolute right-1 top-1 flex items-center gap-1 h-8",children:[v,C]}),e[32]=C,e[33]=v,e[34]=w):w=e[34];let N;return e[35]!==w||e[36]!==x?(N=n.jsxs("div",{className:"relative",children:[x,w]}),e[35]=w,e[36]=x,e[37]=N):N=e[37],N}function Ne(s){const e=W.c(19),{card:t,selfClient:o,org:l,onDone:c,onError:a}=s,r=be();let m;e[0]!==t||e[1]!==o?(m=async h=>{const{values:x,connectionToken:f}=h,v={configuration_state:{...t.configurationState??{},...x}};f!==void 0&&(v.connection_token=f),await o.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:t.linkedConnectionId||t.candidateConnectionId,data:v}})},e[0]=t,e[1]=o,e[2]=m):m=e[2];let p;e[3]!==c||e[4]!==l||e[5]!==r?(p=async()=>{await r.invalidateQueries({queryKey:J.commerceDiscoveryCompanionConnectionsPrefix(l.id)}),c()},e[3]=c,e[4]=l,e[5]=r,e[6]=p):p=e[6];let i;e[7]!==a?(i=h=>{a?.(h)},e[7]=a,e[8]=i):i=e[8];let d;e[9]!==m||e[10]!==p||e[11]!==i?(d={mutationFn:m,onSuccess:p,onError:i},e[9]=m,e[10]=p,e[11]=i,e[12]=d):d=e[12];const g=_e(d);let u;e[13]!==g?(u=(h,x)=>g.mutate({values:h,connectionToken:x?.connectionToken}),e[13]=g,e[14]=u):u=e[14];const y=u;let b;return e[15]!==g.error||e[16]!==g.isPending||e[17]!==y?(b={save:y,isPending:g.isPending,error:g.error},e[15]=g.error,e[16]=g.isPending,e[17]=y,e[18]=b):b=e[18],b}const an=ye({accountName:re().min(1,"Informe o nome da conta"),appKey:re().optional(),appToken:re().optional()});function ln(s){const e=W.c(73),{card:t,selfClient:o,org:l,onDone:c,onIsPendingChange:a}=s,r=te();let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=Ce(an),e[0]=m):m=e[0];const p=t.configurationState?.accountName||"",i=t.configurationState?.appKey||"",d=t.configurationState?.appToken||"";let g;e[1]!==p||e[2]!==i||e[3]!==d?(g={resolver:m,defaultValues:{accountName:p,appKey:i,appToken:d}},e[1]=p,e[2]=i,e[3]=d,e[4]=g):g=e[4];const u=ve(g);let y;e[5]!==t.configurationState?.accountName||e[6]!==t.configurationState?.appKey||e[7]!==t.configurationState?.appToken||e[8]!==u?(y=()=>{u.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]=u,e[9]=y):y=e[9];let b;e[10]!==t.configurationState||e[11]!==u?(b=[t.configurationState,u],e[10]=t.configurationState,e[11]=u,e[12]=b):b=e[12],G.useEffect(y,b);let h;e[13]!==t||e[14]!==c||e[15]!==l||e[16]!==o?(h={card:t,selfClient:o,org:l,onDone:c},e[13]=t,e[14]=c,e[15]=l,e[16]=o,e[17]=h):h=e[17];const{save:x,isPending:f,error:S}=Ne(h);let v,E;e[18]!==f||e[19]!==a?(E=()=>{a?.(f)},v=[f,a],e[18]=f,e[19]=a,e[20]=v,e[21]=E):(v=e[20],E=e[21]),G.useEffect(E,v);let O;if(e[22]!==u||e[23]!==x){let R;e[25]!==x?(R=async q=>{x(q)},e[25]=x,e[26]=R):R=e[26],O=u.handleSubmit(R),e[22]=u,e[23]=x,e[24]=O}else O=e[24];const j=O;let C;e[27]!==f||e[28]!==r?(C=R=>{const{field:q}=R;return n.jsxs(le,{children:[n.jsx(fe,{children:r("commerceOnboarding.vtexConfigForm.accountNameLabel")}),n.jsx(ce,{children:n.jsx(ge,{placeholder:r("commerceOnboarding.vtexConfigForm.accountNamePlaceholder"),...q,disabled:f})}),n.jsx(de,{})]})},e[27]=f,e[28]=r,e[29]=C):C=e[29];let w;e[30]!==u.control||e[31]!==C?(w=n.jsx(ae,{control:u.control,name:"accountName",render:C}),e[30]=u.control,e[31]=C,e[32]=w):w=e[32];let N;e[33]!==f||e[34]!==r?(N=R=>{const{field:q}=R;return n.jsxs(le,{children:[n.jsx(fe,{children:r("commerceOnboarding.vtexConfigForm.appKeyLabel")}),n.jsx(ce,{children:n.jsx(we,{placeholder:r("commerceOnboarding.vtexConfigForm.appKeyPlaceholder"),...q,disabled:f})}),n.jsx(de,{})]})},e[33]=f,e[34]=r,e[35]=N):N=e[35];let _;e[36]!==u.control||e[37]!==N?(_=n.jsx(ae,{control:u.control,name:"appKey",render:N}),e[36]=u.control,e[37]=N,e[38]=_):_=e[38];let I;e[39]!==f||e[40]!==r?(I=R=>{const{field:q}=R;return n.jsxs(le,{children:[n.jsx(fe,{children:r("commerceOnboarding.vtexConfigForm.appTokenLabel")}),n.jsx(ce,{children:n.jsx(we,{placeholder:r("commerceOnboarding.vtexConfigForm.appTokenPlaceholder"),...q,disabled:f})}),n.jsx(de,{})]})},e[39]=f,e[40]=r,e[41]=I):I=e[41];let T;e[42]!==u.control||e[43]!==I?(T=n.jsx(ae,{control:u.control,name:"appToken",render:I}),e[42]=u.control,e[43]=I,e[44]=T):T=e[44];let k;e[45]!==u||e[46]!==w||e[47]!==_||e[48]!==T?(k=n.jsxs(je,{...u,children:[w,_,T]}),e[45]=u,e[46]=w,e[47]=_,e[48]=T,e[49]=k):k=e[49];let $;e[50]!==S||e[51]!==r?($=S&&n.jsx("p",{role:"alert",className:"text-sm text-destructive",children:S instanceof Error?S.message:r("commerceOnboarding.vtexConfigForm.savingError")}),e[50]=S,e[51]=r,e[52]=$):$=e[52];let F;e[53]!==r?(F=r("commerceOnboarding.vtexConfigForm.cancelButton"),e[53]=r,e[54]=F):F=e[54];let A;e[55]!==f||e[56]!==c||e[57]!==F?(A=n.jsx(Z,{type:"button",variant:"outline",onClick:c,disabled:f,children:F}),e[55]=f,e[56]=c,e[57]=F,e[58]=A):A=e[58];let K;e[59]!==f||e[60]!==r?(K=r(f?"commerceOnboarding.vtexConfigForm.savingButton":"commerceOnboarding.vtexConfigForm.saveButton"),e[59]=f,e[60]=r,e[61]=K):K=e[61];let U;e[62]!==f||e[63]!==K?(U=n.jsx(Z,{type:"submit",disabled:f,children:K}),e[62]=f,e[63]=K,e[64]=U):U=e[64];let B;e[65]!==A||e[66]!==U?(B=n.jsxs(pe,{className:"pt-4",children:[A,U]}),e[65]=A,e[66]=U,e[67]=B):B=e[67];let Q;return e[68]!==j||e[69]!==k||e[70]!==$||e[71]!==B?(Q=n.jsxs("form",{onSubmit:j,className:"space-y-4",children:[k,$,B]}),e[68]=j,e[69]=k,e[70]=$,e[71]=B,e[72]=Q):Q=e[72],Q}const cn=(s,e)=>ye({storeDomain:re().min(1,e("commerceOnboarding.shopifyConfigForm.storeDomainRequired")),accessToken:re().optional(),apiVersion:re().optional()}).refine(t=>s||!!t.accessToken?.trim(),{path:["accessToken"],message:e("commerceOnboarding.shopifyConfigForm.accessTokenRequired")});function dn(s){const e=W.c(76),{card:t,selfClient:o,org:l,onDone:c,onIsPendingChange:a}=s,r=te();let m;e[0]!==t.configured||e[1]!==r?(m=Ce(cn(t.configured,r)),e[0]=t.configured,e[1]=r,e[2]=m):m=e[2];const p=t.configurationState?.storeDomain||"",i=t.configurationState?.apiVersion||"";let d;e[3]!==p||e[4]!==i?(d={storeDomain:p,accessToken:"",apiVersion:i},e[3]=p,e[4]=i,e[5]=d):d=e[5];let g;e[6]!==m||e[7]!==d?(g={resolver:m,defaultValues:d},e[6]=m,e[7]=d,e[8]=g):g=e[8];const u=ve(g);let y;e[9]!==t.configurationState?.apiVersion||e[10]!==t.configurationState?.storeDomain||e[11]!==u?(y=()=>{u.reset({storeDomain:t.configurationState?.storeDomain||"",accessToken:"",apiVersion:t.configurationState?.apiVersion||""})},e[9]=t.configurationState?.apiVersion,e[10]=t.configurationState?.storeDomain,e[11]=u,e[12]=y):y=e[12];let b;e[13]!==t.configurationState||e[14]!==u?(b=[t.configurationState,u],e[13]=t.configurationState,e[14]=u,e[15]=b):b=e[15],G.useEffect(y,b);let h;e[16]!==t||e[17]!==c||e[18]!==l||e[19]!==o?(h={card:t,selfClient:o,org:l,onDone:c},e[16]=t,e[17]=c,e[18]=l,e[19]=o,e[20]=h):h=e[20];const{save:x,isPending:f,error:S}=Ne(h);let v,E;e[21]!==f||e[22]!==a?(E=()=>{a?.(f)},v=[f,a],e[21]=f,e[22]=a,e[23]=v,e[24]=E):(v=e[23],E=e[24]),G.useEffect(E,v);let O;if(e[25]!==u||e[26]!==x){let R;e[28]!==x?(R=async q=>{const D=q.apiVersion?.trim(),L=q.accessToken?.trim();x({storeDomain:q.storeDomain.trim(),...D?{apiVersion:D}:{}},L?{connectionToken:L}:void 0)},e[28]=x,e[29]=R):R=e[29],O=u.handleSubmit(R),e[25]=u,e[26]=x,e[27]=O}else O=e[27];const j=O;let C;e[30]!==f||e[31]!==r?(C=R=>{const{field:q}=R;return n.jsxs(le,{children:[n.jsx(fe,{children:r("commerceOnboarding.shopifyConfigForm.storeDomainLabel")}),n.jsx(ce,{children:n.jsx(ge,{placeholder:r("commerceOnboarding.shopifyConfigForm.storeDomainPlaceholder"),...q,disabled:f})}),n.jsx(de,{})]})},e[30]=f,e[31]=r,e[32]=C):C=e[32];let w;e[33]!==u.control||e[34]!==C?(w=n.jsx(ae,{control:u.control,name:"storeDomain",render:C}),e[33]=u.control,e[34]=C,e[35]=w):w=e[35];let N;e[36]!==f||e[37]!==r?(N=R=>{const{field:q}=R;return n.jsxs(le,{children:[n.jsx(fe,{children:r("commerceOnboarding.shopifyConfigForm.accessTokenLabel")}),n.jsx(ce,{children:n.jsx(we,{placeholder:r("commerceOnboarding.shopifyConfigForm.accessTokenPlaceholder"),...q,disabled:f})}),n.jsx(de,{})]})},e[36]=f,e[37]=r,e[38]=N):N=e[38];let _;e[39]!==u.control||e[40]!==N?(_=n.jsx(ae,{control:u.control,name:"accessToken",render:N}),e[39]=u.control,e[40]=N,e[41]=_):_=e[41];let I;e[42]!==f||e[43]!==r?(I=R=>{const{field:q}=R;return n.jsxs(le,{children:[n.jsx(fe,{children:r("commerceOnboarding.shopifyConfigForm.apiVersionLabel")}),n.jsx(ce,{children:n.jsx(ge,{placeholder:r("commerceOnboarding.shopifyConfigForm.apiVersionPlaceholder"),...q,disabled:f})}),n.jsx(de,{})]})},e[42]=f,e[43]=r,e[44]=I):I=e[44];let T;e[45]!==u.control||e[46]!==I?(T=n.jsx(ae,{control:u.control,name:"apiVersion",render:I}),e[45]=u.control,e[46]=I,e[47]=T):T=e[47];let k;e[48]!==u||e[49]!==w||e[50]!==_||e[51]!==T?(k=n.jsxs(je,{...u,children:[w,_,T]}),e[48]=u,e[49]=w,e[50]=_,e[51]=T,e[52]=k):k=e[52];let $;e[53]!==S||e[54]!==r?($=S&&n.jsx("p",{role:"alert",className:"text-sm text-destructive",children:S instanceof Error?S.message:r("commerceOnboarding.shopifyConfigForm.savingError")}),e[53]=S,e[54]=r,e[55]=$):$=e[55];let F;e[56]!==r?(F=r("commerceOnboarding.shopifyConfigForm.cancelButton"),e[56]=r,e[57]=F):F=e[57];let A;e[58]!==f||e[59]!==c||e[60]!==F?(A=n.jsx(Z,{type:"button",variant:"outline",onClick:c,disabled:f,children:F}),e[58]=f,e[59]=c,e[60]=F,e[61]=A):A=e[61];let K;e[62]!==f||e[63]!==r?(K=r(f?"commerceOnboarding.shopifyConfigForm.savingButton":"commerceOnboarding.shopifyConfigForm.saveButton"),e[62]=f,e[63]=r,e[64]=K):K=e[64];let U;e[65]!==f||e[66]!==K?(U=n.jsx(Z,{type:"submit",disabled:f,children:K}),e[65]=f,e[66]=K,e[67]=U):U=e[67];let B;e[68]!==A||e[69]!==U?(B=n.jsxs(pe,{className:"pt-4",children:[A,U]}),e[68]=A,e[69]=U,e[70]=B):B=e[70];let Q;return e[71]!==j||e[72]!==k||e[73]!==$||e[74]!==B?(Q=n.jsxs("form",{onSubmit:j,className:"space-y-4",children:[k,$,B]}),e[71]=j,e[72]=k,e[73]=$,e[74]=B,e[75]=Q):Q=e[75],Q}function De(s){const e=W.c(31),{options:t,value:o,onChange:l,disabled:c,ariaLabel:a,searchPlaceholder:r,hideSearch:m}=s,p=m===void 0?!1:m,i=te(),[d,g]=G.useState("");let u,y,b;if(e[0]!==t||e[1]!==d||e[2]!==o){const j=d.trim().toLowerCase();u=j?t.filter(C=>C.label.toLowerCase().includes(j)):t,y=u.map(un),b=y.includes(o)?o:y[0]??"",e[0]=t,e[1]=d,e[2]=o,e[3]=u,e[4]=y,e[5]=b}else u=e[3],y=e[4],b=e[5];const h=b;let x;e[6]!==c||e[7]!==y||e[8]!==l?(x=function(C){if(c||!["ArrowDown","ArrowRight","ArrowUp","ArrowLeft","Home","End"].includes(C.key))return;C.preventDefault();const N=C.currentTarget.dataset.value,_=y.indexOf(N),I=y.length;if(I===0)return;let T;C.key==="ArrowDown"||C.key==="ArrowRight"?T=(_+1)%I:C.key==="ArrowUp"||C.key==="ArrowLeft"?T=(_-1+I)%I:C.key==="Home"?T=0:T=I-1;const k=y[T];l(k),C.currentTarget.closest('[role="radiogroup"]')?.querySelector(`[data-value="${CSS.escape(k)}"]`)?.focus()},e[6]=c,e[7]=y,e[8]=l,e[9]=x):x=e[9];const f=x;let S;e[10]!==a||e[11]!==c||e[12]!==p||e[13]!==d||e[14]!==r||e[15]!==i?(S=p?null:n.jsxs("div",{className:"relative",children:[n.jsx(tt,{size:16,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),n.jsx(ge,{type:"text",value:d,onChange:j=>g(j.target.value),disabled:c,placeholder:r??i("commerceOnboarding.selectableList.searchPlaceholder"),"aria-label":i("commerceOnboarding.selectableList.searchAriaLabel",{label:a}),className:"h-8 pl-8"})]}),e[10]=a,e[11]=c,e[12]=p,e[13]=d,e[14]=r,e[15]=i,e[16]=S):S=e[16];let v;e[17]!==c||e[18]!==u||e[19]!==f||e[20]!==l||e[21]!==i||e[22]!==h||e[23]!==o?(v=u.length===0?n.jsx("div",{className:"px-2 py-2 text-sm text-muted-foreground",children:i("commerceOnboarding.selectableList.noResults")}):u.map(j=>{const C=j.value===o;return n.jsxs("button",{type:"button",role:"radio","aria-checked":C,disabled:c,"data-value":j.value,tabIndex:j.value===h?0:-1,onClick:()=>l(j.value),onKeyDown:f,className:me("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",C?"bg-muted font-medium text-foreground":"text-foreground hover:bg-muted/50"),children:[n.jsx("span",{className:"truncate",children:j.label}),C?n.jsx(nt,{size:16,className:"shrink-0 text-primary"}):null]},j.value)}),e[17]=c,e[18]=u,e[19]=f,e[20]=l,e[21]=i,e[22]=h,e[23]=o,e[24]=v):v=e[24];let E;e[25]!==a||e[26]!==v?(E=n.jsx("div",{role:"radiogroup","aria-label":a,className:"max-h-[280px] overflow-y-auto",children:v}),e[25]=a,e[26]=v,e[27]=E):E=e[27];let O;return e[28]!==S||e[29]!==E?(O=n.jsxs("div",{className:"space-y-2",children:[S,E]}),e[28]=S,e[29]=E,e[30]=O):O=e[30],O}function un(s){return s.value}function Pe(s){const e=W.c(16),{label:t,iconSize:o,className:l,iconClassName:c,labelClassName:a}=s,r=o===void 0?14:o;let m;e[0]!==l?(m=me("inline-flex items-center gap-2",l),e[0]=l,e[1]=m):m=e[1];let p;e[2]!==c?(p=me("shrink-0 animate-spin",c),e[2]=c,e[3]=p):p=e[3];let i;e[4]!==r||e[5]!==p?(i=n.jsx(Ie,{size:r,className:p}),e[4]=r,e[5]=p,e[6]=i):i=e[6];let d;e[7]!==a?(d=me("text-sm",a),e[7]=a,e[8]=d):d=e[8];let g;e[9]!==t||e[10]!==d?(g=n.jsx("span",{className:d,children:t}),e[9]=t,e[10]=d,e[11]=g):g=e[11];let u;return e[12]!==m||e[13]!==i||e[14]!==g?(u=n.jsxs("span",{className:m,children:[i,g]}),e[12]=m,e[13]=i,e[14]=g,e[15]=u):u=e[15],u}const mn=ye({propertyId:re().min(1,"Selecione uma propriedade")});function fn(s){const e=W.c(68),{card:t,connectionId:o,companionClient:l,selfClient:c,org:a,onDone:r,onDisconnect:m,onIsPendingChange:p}=s;let i;e[0]!==o||e[1]!==a.id?(i=J.commerceDiscoveryCompanionGaProperties(a.id,o),e[0]=o,e[1]=a.id,e[2]=i):i=e[2];let d;e[3]!==l?(d=async()=>{const D=await l.callTool({name:"get-account-summaries",arguments:{}}),L=ee(D);return It(L)},e[3]=l,e[4]=d):d=e[4];let g;e[5]!==i||e[6]!==d?(g={queryKey:i,queryFn:d},e[5]=i,e[6]=d,e[7]=g):g=e[7];const u=he(g);let y;e[8]===Symbol.for("react.memo_cache_sentinel")?(y=Ce(mn),e[8]=y):y=e[8];const b=t.configurationState?.propertyId||"";let h;e[9]!==b?(h={resolver:y,defaultValues:{propertyId:b}},e[9]=b,e[10]=h):h=e[10];const x=ve(h);let f;e[11]!==t||e[12]!==r||e[13]!==a||e[14]!==c?(f={card:t,selfClient:c,org:a,onDone:r},e[11]=t,e[12]=r,e[13]=a,e[14]=c,e[15]=f):f=e[15];const{save:S,isPending:v,error:E}=Ne(f);let O,j;e[16]!==v||e[17]!==p?(O=()=>{p?.(v)},j=[v,p],e[16]=v,e[17]=p,e[18]=O,e[19]=j):(O=e[18],j=e[19]),G.useEffect(O,j);let C;if(e[20]!==x||e[21]!==S){let D;e[23]!==S?(D=async L=>{S(L)},e[23]=S,e[24]=D):D=e[24],C=x.handleSubmit(D),e[20]=x,e[21]=S,e[22]=C}else C=e[22];const w=C;if(u.isLoading){let D;return e[25]===Symbol.for("react.memo_cache_sentinel")?(D=n.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:n.jsx(Pe,{label:"Carregando propriedades..."})}),e[25]=D):D=e[25],D}if(u.isError){let D;return e[26]===Symbol.for("react.memo_cache_sentinel")?(D=n.jsx("div",{className:"space-y-4",children:n.jsx("p",{className:"text-sm text-destructive",children:"Não foi possível carregar as propriedades do Google Analytics."})}),e[26]=D):D=e[26],D}let N;e[27]!==u.data?(N=u.data||[],e[27]=u.data,e[28]=N):N=e[28];const _=N;if(_.flatMap(gn).length===0){let D;e[29]===Symbol.for("react.memo_cache_sentinel")?(D=n.jsx("p",{className:"text-sm text-muted-foreground",children:"Nenhuma propriedade do Google Analytics foi encontrada. Conecte uma conta do Google Analytics com propriedades."}),e[29]=D):D=e[29];let L;e[30]!==m?(L=m?n.jsx("button",{type:"button",onClick:m,className:"text-xs text-muted-foreground underline underline-offset-2 hover:text-destructive",children:"Desconectar conta"}):n.jsx("span",{}),e[30]=m,e[31]=L):L=e[31];let M;e[32]!==r?(M=n.jsx(Z,{type:"button",variant:"outline",onClick:r,children:"Fechar"}),e[32]=r,e[33]=M):M=e[33];let H;return e[34]!==L||e[35]!==M?(H=n.jsxs("div",{className:"space-y-4",children:[D,n.jsxs(pe,{className:"flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[L,M]})]}),e[34]=L,e[35]=M,e[36]=H):H=e[36],H}let T;e[37]!==v||e[38]!==_?(T=D=>{const{field:L}=D;return n.jsxs(le,{children:[n.jsx(ce,{children:n.jsx(De,{options:_.flatMap(pn),value:L.value,onChange:L.onChange,disabled:v,ariaLabel:"Propriedade do Google Analytics"})}),n.jsx(de,{})]})},e[37]=v,e[38]=_,e[39]=T):T=e[39];let k;e[40]!==x.control||e[41]!==T?(k=n.jsx(ae,{control:x.control,name:"propertyId",render:T}),e[40]=x.control,e[41]=T,e[42]=k):k=e[42];let $;e[43]!==x||e[44]!==k?($=n.jsx(je,{...x,children:k}),e[43]=x,e[44]=k,e[45]=$):$=e[45];let F;e[46]!==E?(F=E&&n.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]=F):F=e[47];let A;e[48]!==v||e[49]!==m?(A=m?n.jsx("button",{type:"button",onClick:m,disabled:v,className:"text-xs text-muted-foreground underline underline-offset-2 hover:text-destructive disabled:opacity-50",children:"Desconectar conta"}):n.jsx("span",{}),e[48]=v,e[49]=m,e[50]=A):A=e[50];let K;e[51]!==v||e[52]!==r?(K=n.jsx(Z,{type:"button",variant:"outline",onClick:r,disabled:v,children:"Cancelar"}),e[51]=v,e[52]=r,e[53]=K):K=e[53];const U=v?"Salvando...":"Salvar";let B;e[54]!==v||e[55]!==U?(B=n.jsx(Z,{type:"submit",disabled:v,children:U}),e[54]=v,e[55]=U,e[56]=B):B=e[56];let Q;e[57]!==K||e[58]!==B?(Q=n.jsxs("div",{className:"flex gap-2",children:[K,B]}),e[57]=K,e[58]=B,e[59]=Q):Q=e[59];let R;e[60]!==A||e[61]!==Q?(R=n.jsxs(pe,{className:"flex-col gap-2 pt-4 sm:flex-row sm:items-center sm:justify-between",children:[A,Q]}),e[60]=A,e[61]=Q,e[62]=R):R=e[62];let q;return e[63]!==w||e[64]!==$||e[65]!==F||e[66]!==R?(q=n.jsxs("form",{onSubmit:w,className:"space-y-4",children:[$,F,R]}),e[63]=w,e[64]=$,e[65]=F,e[66]=R,e[67]=q):q=e[67],q}function pn(s){return s.options}function gn(s){return s.options}const hn=s=>ye({siteUrl:re().min(1,s("commerceOnboarding.googleSearchConsoleConfigForm.siteRequired"))});function xn(s){const e=W.c(83),{card:t,connectionId:o,companionClient:l,selfClient:c,org:a,contextSiteUrl:r,onDone:m,onIsPendingChange:p}=s,i=te();let d;e[0]!==o||e[1]!==a.id?(d=J.commerceDiscoveryCompanionGscSites(a.id,o),e[0]=o,e[1]=a.id,e[2]=d):d=e[2];let g;e[3]!==l?(g=async()=>{const P=await l.callTool({name:"list_sites",arguments:{}});return ee(P).sites||[]},e[3]=l,e[4]=g):g=e[4];let u;e[5]!==d||e[6]!==g?(u={queryKey:d,queryFn:g},e[5]=d,e[6]=g,e[7]=u):u=e[7];const y=he(u);let b;e[8]!==i?(b=Ce(hn(i)),e[8]=i,e[9]=b):b=e[9];const h=t.configurationState?.siteUrl||"";let x;e[10]!==h?(x={siteUrl:h},e[10]=h,e[11]=x):x=e[11];let f;e[12]!==b||e[13]!==x?(f={resolver:b,defaultValues:x},e[12]=b,e[13]=x,e[14]=f):f=e[14];const S=ve(f);let v;e[15]!==t||e[16]!==m||e[17]!==a||e[18]!==c?(v={card:t,selfClient:c,org:a,onDone:m},e[15]=t,e[16]=m,e[17]=a,e[18]=c,e[19]=v):v=e[19];const{save:E,isPending:O,error:j}=Ne(v),C=G.useRef(!1),w=t.configurationState?.siteUrl;let N,_;e[20]!==O||e[21]!==p?(_=()=>{p?.(O)},N=[O,p],e[20]=O,e[21]=p,e[22]=N,e[23]=_):(N=e[22],_=e[23]),G.useEffect(_,N);let I,T;e[24]!==r||e[25]!==S||e[26]!==w||e[27]!==y.data||e[28]!==y.isSuccess?(I=()=>{if(!(C.current||!y.isSuccess)){if(C.current=!0,w){S.getValues("siteUrl")!==w&&S.setValue("siteUrl",w);return}if(!S.getValues("siteUrl")){const P=Rt(r,y.data??[]);P&&S.setValue("siteUrl",P)}}},T=[y.isSuccess,y.data,w,r,S],e[24]=r,e[25]=S,e[26]=w,e[27]=y.data,e[28]=y.isSuccess,e[29]=I,e[30]=T):(I=e[29],T=e[30]),G.useEffect(I,T);let k;if(e[31]!==S||e[32]!==E){let P;e[34]!==E?(P=async V=>{E(V)},e[34]=E,e[35]=P):P=e[35],k=S.handleSubmit(P),e[31]=S,e[32]=E,e[33]=k}else k=e[33];const $=k;if(y.isLoading){let P;e[36]!==i?(P=i("commerceOnboarding.googleSearchConsoleConfigForm.loadingSites"),e[36]=i,e[37]=P):P=e[37];let V;return e[38]!==P?(V=n.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:n.jsx(Pe,{label:P})}),e[38]=P,e[39]=V):V=e[39],V}if(y.isError){let P;e[40]!==i?(P=i("commerceOnboarding.googleSearchConsoleConfigForm.loadSitesError"),e[40]=i,e[41]=P):P=e[41];let V;return e[42]!==P?(V=n.jsx("div",{className:"space-y-4",children:n.jsx("p",{className:"text-sm text-destructive",children:P})}),e[42]=P,e[43]=V):V=e[43],V}let F;e[44]!==y.data?(F=y.data||[],e[44]=y.data,e[45]=F):F=e[45];const A=F;if(A.length===0){let P;e[46]!==i?(P=i("commerceOnboarding.googleSearchConsoleConfigForm.noSitesFound"),e[46]=i,e[47]=P):P=e[47];let V;return e[48]!==P?(V=n.jsx("div",{className:"space-y-4",children:n.jsx("p",{className:"text-sm text-muted-foreground",children:P})}),e[48]=P,e[49]=V):V=e[49],V}let K;e[50]!==O||e[51]!==A||e[52]!==i?(K=P=>{const{field:V}=P;return n.jsxs(le,{children:[n.jsx(ce,{children:n.jsx(De,{options:A.map(bn),value:V.value,onChange:V.onChange,disabled:O,ariaLabel:i("commerceOnboarding.googleSearchConsoleConfigForm.siteAriaLabel")})}),n.jsx(de,{})]})},e[50]=O,e[51]=A,e[52]=i,e[53]=K):K=e[53];let U;e[54]!==S.control||e[55]!==K?(U=n.jsx(ae,{control:S.control,name:"siteUrl",render:K}),e[54]=S.control,e[55]=K,e[56]=U):U=e[56];let B;e[57]!==S||e[58]!==U?(B=n.jsx(je,{...S,children:U}),e[57]=S,e[58]=U,e[59]=B):B=e[59];let Q;e[60]!==j||e[61]!==i?(Q=j&&n.jsx("p",{role:"alert",className:"text-sm text-destructive",children:j instanceof Error?j.message:i("commerceOnboarding.googleSearchConsoleConfigForm.savingError")}),e[60]=j,e[61]=i,e[62]=Q):Q=e[62];let R;e[63]!==i?(R=i("commerceOnboarding.googleSearchConsoleConfigForm.cancelButton"),e[63]=i,e[64]=R):R=e[64];let q;e[65]!==O||e[66]!==m||e[67]!==R?(q=n.jsx(Z,{type:"button",variant:"outline",onClick:m,disabled:O,children:R}),e[65]=O,e[66]=m,e[67]=R,e[68]=q):q=e[68];let D;e[69]!==O||e[70]!==i?(D=i(O?"commerceOnboarding.googleSearchConsoleConfigForm.savingButton":"commerceOnboarding.googleSearchConsoleConfigForm.saveButton"),e[69]=O,e[70]=i,e[71]=D):D=e[71];let L;e[72]!==O||e[73]!==D?(L=n.jsx(Z,{type:"submit",disabled:O,children:D}),e[72]=O,e[73]=D,e[74]=L):L=e[74];let M;e[75]!==q||e[76]!==L?(M=n.jsxs(pe,{className:"pt-4",children:[q,L]}),e[75]=q,e[76]=L,e[77]=M):M=e[77];let H;return e[78]!==$||e[79]!==B||e[80]!==Q||e[81]!==M?(H=n.jsxs("form",{onSubmit:$,className:"space-y-4",children:[B,Q,M]}),e[78]=$,e[79]=B,e[80]=Q,e[81]=M,e[82]=H):H=e[82],H}function bn(s){return{value:s.siteUrl,label:s.siteUrl}}function yn(s){const[e,t]=s.split("/");return!e||!t?null:{owner:e,name:t}}function Cn(s){const{existingRepo:e,owner:t,name:o}=s;return e?.connectionId&&e.owner.toLowerCase()===t.toLowerCase()&&e.name.toLowerCase()===o.toLowerCase()?{connectionId:e.connectionId,installationId:e.installationId}:null}function vn(s){const{existingRepo:e,existingConnections:t,repoConnectionId:o}=s,l=e?.connectionId&&e.connectionId!==o?e.connectionId:void 0,c=[...t.filter(a=>a.connection_id!==o&&a.connection_id!==l),{connection_id:o,selected_tools:[]}];return{staleConnectionId:l,mergedConnections:c}}const jn=ye({githubRepo:re().min(1,"commerceOnboarding.githubConfigForm.selectRepository")}),Sn=15e3,On=/^[\w.-]+\/[\w.-]+$/;async function _n(s,e,t,o){const{installations:l}=await st(s,t),c=o.trim(),a=await Promise.allSettled(l.map(async i=>{const d=i.type==="User"?"user":"org",g=c?`${d}:${i.login} ${c} in:name`:`${d}:${i.login}`,y=await e.callTool({name:"search_repositories",arguments:{query:g,page:1,perPage:50}},void 0,{signal:AbortSignal.timeout(Sn)}),b=y.content?.[0]?.text;if(y.isError)throw new Error(b??"search_repositories failed");if(!b)throw new Error("empty search_repositories response");return JSON.parse(b).items??[]})),r=new Map;let m=0;for(const i of a){if(i.status==="rejected"){m+=1;continue}for(const d of i.value)d.full_name&&!r.has(d.full_name)&&r.set(d.full_name,d)}return{repos:Array.from(r.values()).sort((i,d)=>(d.updated_at??"").localeCompare(i.updated_at??"")).map(i=>i.full_name),failed:m,total:l.length}}function Nn({connectionId:s,companionClient:e,selfClient:t,org:o,onDone:l,onIsPendingChange:c}){const a=te(),r=be(),m=He.COMMERCE_DISCOVERY(o.id),[p,i]=G.useState(""),d=Bt(p,300),g=G.useRef(!1),u=he({queryKey:J.commerceDiscoveryCompanionGithubSelected(o.id,s),queryFn:async()=>{const _=await t.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:m}}),I=ee(_).item?.configuration_state??null;return typeof I?.github_repo=="string"?I.github_repo:""}}),y=he({queryKey:J.commerceDiscoveryCompanionGithubRepos(o.id,s,d.trim()),queryFn:()=>_n(_=>t.callTool(_),e,s,d)}),b=ve({resolver:Ce(jn),defaultValues:{githubRepo:""}}),h=_e({mutationFn:async _=>{const I=await t.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:m}}),k={...ee(I).item?.configuration_state??null??{},github_repo:_};await t.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:m,data:{configuration_state:k}}});const $=yn(_);if(!$)throw new Error(a("commerceOnboarding.githubConfigForm.invalidRepository",{repo:_}));const{owner:F,name:A}=$,K=Et(o.id),U=ee(await t.callTool({name:"COLLECTION_VIRTUAL_MCP_GET",arguments:{id:K}})).item,B=U?.metadata?.githubRepo,Q=U?.connections??[],R=Cn({existingRepo:B,owner:F,name:A});let q=R?.connectionId,D=R?.installationId,L;if(!q){const{installations:P}=await st(X=>t.callTool(X),s),V=Qt(P,F);if(!V)throw new Error(a("commerceOnboarding.githubConfigForm.noGithubInstallation",{owner:F}));D=V.installationId;const se=ee(await t.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:s}})).item;if(!se)throw new Error(a("commerceOnboarding.githubConfigForm.githubConnectionNotFound"));const{childConnectionId:ne,reused:oe}=await Mt({orgSlug:o.slug,sourceConnection:se,installationId:D,owner:F,repo:A,githubCallTool:X=>e.callTool(X),selfCallTool:X=>t.callTool(X)});q=ne,L=oe?void 0:ne}const{staleConnectionId:M,mergedConnections:H}=vn({existingRepo:B,existingConnections:Q,repoConnectionId:q});try{if(await t.callTool({name:"COLLECTION_VIRTUAL_MCP_UPDATE",arguments:{id:K,data:{connections:H,metadata:{githubRepo:{owner:F,name:A,url:`https://github.com/${_}`,installationId:D,connectionId:q}}}}}),M){const P=ee(await t.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:M}})).item;P&&!zt(P)&&await t.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:M,force:!0}}).catch(()=>{})}}catch(P){throw L&&await t.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:L,force:!0}}).catch(()=>{}),P}},onSuccess:async()=>{await r.invalidateQueries({queryKey:J.commerceDiscoveryConnection(o.id,m)}),await r.invalidateQueries({queryKey:J.commerceDiscoveryCompanionConnectionsPrefix(o.id)}),jt(r,o.id),l()}}),x=h.isPending;G.useEffect(()=>{c?.(x)},[x,c]);const f=u.data??"";G.useEffect(()=>{!u.isSuccess||g.current||(g.current=!0,u.data&&b.setValue("githubRepo",u.data))},[u.isSuccess,u.data,b]);const S=b.handleSubmit(async _=>{h.mutate(_.githubRepo)}),v=y.data?.repos??[],E=y.data?.failed??0,O=y.data?.total??0,j=d.trim(),C=[...v];j&&On.test(j)&&!C.includes(j)&&C.unshift(j),f&&!C.includes(f)&&C.push(f);const w=O>0&&E===O,N=y.isError||w?a("commerceOnboarding.githubConfigForm.searchFailedTotal"):E>0?a("commerceOnboarding.githubConfigForm.searchFailedPartial"):null;return n.jsxs("form",{onSubmit:S,className:"space-y-4",children:[n.jsxs("div",{className:"relative",children:[n.jsx(tt,{size:16,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),n.jsx(ge,{type:"text",value:p,onChange:_=>i(_.target.value),disabled:x,placeholder:a("commerceOnboarding.githubConfigForm.searchRepositoryPlaceholder"),"aria-label":a("commerceOnboarding.githubConfigForm.searchRepositoryLabel"),className:"h-8 pl-8"})]}),y.isLoading?n.jsx("div",{className:"flex min-h-[160px] items-center justify-center",children:n.jsx(Pe,{label:a("commerceOnboarding.githubConfigForm.loadingRepositories")})}):n.jsxs(n.Fragment,{children:[N&&n.jsx("p",{role:"alert",className:"text-sm text-destructive",children:N}),C.length===0?!N&&n.jsx("p",{className:"text-sm text-muted-foreground",children:a("commerceOnboarding.githubConfigForm.noRepositoriesFound")}):n.jsx(je,{...b,children:n.jsx(ae,{control:b.control,name:"githubRepo",render:({field:_})=>n.jsxs(le,{children:[n.jsx(ce,{children:n.jsx(De,{options:C.map(I=>({value:I,label:I})),value:_.value,onChange:_.onChange,disabled:x,ariaLabel:"Repositório",hideSearch:!0})}),n.jsx(de,{})]})})})]}),h.error&&n.jsx("p",{role:"alert",className:"text-sm text-destructive",children:h.error instanceof Error?h.error.message:a("commerceOnboarding.githubConfigForm.failedToSave")}),n.jsxs(pe,{className:"pt-4",children:[n.jsx(Z,{type:"button",variant:"outline",onClick:l,disabled:x,children:a("commerceOnboarding.githubConfigForm.cancel")}),n.jsx(Z,{type:"submit",disabled:x,children:a(x?"commerceOnboarding.githubConfigForm.saving":"commerceOnboarding.githubConfigForm.save")})]})]})}const En={vtex:ln,shopify:dn,"google-analytics":fn,"google-search-console":xn,github:Nn},xe="deco-reader@decocms.iam.gserviceaccount.com",lt={"google-analytics":"ga4","google-search-console":"gsc"},ct={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 ${xe} 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 ${xe} e escolha permissão Completa.`,"Copie o endereço do site como aparece no seletor de propriedades e cole abaixo."]}};function Tn(s,e){const t=ct[s].label;switch(e){case"no-access":return{title:`Ainda não conseguimos acessar este recurso no ${t}.`,steps:s==="ga4"?[`Confirme que ${xe} 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 ${xe} 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:s==="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 wn(s){const e=W.c(95),{provider:t,siteUrl:o,selfClient:l,org:c,initialResourceId:a,onDone:r,onIsPendingChange:m,onOAuthInstead:p}=s,i=te(),d=ct[t],g=be(),[u,y]=G.useState(null);let b,h;if(e[0]!==d.resourceLabel||e[1]!==i){const Y=ye({resourceId:re().trim().min(1,i("commerceOnboarding.saBindingForm.resourceIdRequired",{resourceLabel:d.resourceLabel.toLowerCase()}))});h=ve,b=Ce(Y),e[0]=d.resourceLabel,e[1]=i,e[2]=b,e[3]=h}else b=e[2],h=e[3];const x=a??"";let f;e[4]!==x?(f={resourceId:x},e[4]=x,e[5]=f):f=e[5];let S;e[6]!==b||e[7]!==f?(S={resolver:b,defaultValues:f},e[6]=b,e[7]=f,e[8]=S):S=e[8];const v=h(S);let E;e[9]!==t||e[10]!==l||e[11]!==o||e[12]!==i?(E=async Y=>{if(!o)throw new Error(i("commerceOnboarding.saBindingForm.storeUrlUnavailable"));const ie=await l.callTool({name:"COMMERCE_DISCOVERY_BIND",arguments:{siteUrl:o,provider:t,resourceId:Y.resourceId}});return ee(ie)},e[9]=t,e[10]=l,e[11]=o,e[12]=i,e[13]=E):E=e[13];let O,j;e[14]!==m?(O=()=>m?.(!0),j=()=>m?.(!1),e[14]=m,e[15]=O,e[16]=j):(O=e[15],j=e[16]);let C;e[17]!==d.label||e[18]!==r||e[19]!==c||e[20]!==t||e[21]!==g||e[22]!==o||e[23]!==i?(C=async Y=>{if(Y.ok){y(null),Se.success(i("commerceOnboarding.saBindingForm.connectedSuccess",{label:d.label})),o&&await g.invalidateQueries({queryKey:J.commerceDiscoveryConnectionStatus(c.id,o)}),r();return}y({...Tn(t,Y.reason??"unknown"),detail:Y.detail})},e[17]=d.label,e[18]=r,e[19]=c,e[20]=t,e[21]=g,e[22]=o,e[23]=i,e[24]=C):C=e[24];let w;e[25]!==E||e[26]!==O||e[27]!==j||e[28]!==C?(w={mutationFn:E,onMutate:O,onSettled:j,onSuccess:C},e[25]=E,e[26]=O,e[27]=j,e[28]=C,e[29]=w):w=e[29];const N=_e(w);let _;if(e[30]!==v||e[31]!==N){let Y;e[33]!==N?(Y=ie=>N.mutate(ie),e[33]=N,e[34]=Y):Y=e[34],_=v.handleSubmit(Y),e[30]=v,e[31]=N,e[32]=_}else _=e[32];const I=_,T=N.isPending;let k;e[35]!==i?(k=()=>{navigator.clipboard?.writeText(xe),Se.success(i("commerceOnboarding.saBindingForm.emailCopied"))},e[35]=i,e[36]=k):k=e[36];const $=k;let F;e[37]!==d.connectSteps?(F=d.connectSteps.map(Rn),e[37]=d.connectSteps,e[38]=F):F=e[38];let A;e[39]!==F?(A=n.jsx("ol",{className:"space-y-2 text-sm text-muted-foreground",children:F}),e[39]=F,e[40]=A):A=e[40];let K;e[41]===Symbol.for("react.memo_cache_sentinel")?(K=n.jsx("code",{className:"min-w-0 flex-1 truncate text-xs text-foreground",children:xe}),e[41]=K):K=e[41];let U;e[42]!==i?(U=i("commerceOnboarding.saBindingForm.copyEmailLabel"),e[42]=i,e[43]=U):U=e[43];let B;e[44]===Symbol.for("react.memo_cache_sentinel")?(B=n.jsx(ot,{size:16}),e[44]=B):B=e[44];let Q;e[45]!==$||e[46]!==U?(Q=n.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border bg-muted/40 p-2",children:[K,n.jsx(Z,{type:"button",variant:"ghost",size:"icon-sm",onClick:$,"aria-label":U,children:B})]}),e[45]=$,e[46]=U,e[47]=Q):Q=e[47];let R;e[48]!==d.resourceHint||e[49]!==d.resourceLabel||e[50]!==d.resourcePlaceholder||e[51]!==T?(R=Y=>{const{field:ie}=Y;return n.jsxs(le,{children:[n.jsx(fe,{children:d.resourceLabel}),n.jsx(ce,{children:n.jsx(ge,{...ie,placeholder:d.resourcePlaceholder,disabled:T,autoComplete:"off"})}),n.jsx(qt,{children:d.resourceHint}),n.jsx(de,{})]})},e[48]=d.resourceHint,e[49]=d.resourceLabel,e[50]=d.resourcePlaceholder,e[51]=T,e[52]=R):R=e[52];let q;e[53]!==v.control||e[54]!==R?(q=n.jsx(ae,{control:v.control,name:"resourceId",render:R}),e[53]=v.control,e[54]=R,e[55]=q):q=e[55];let D;e[56]!==v||e[57]!==q?(D=n.jsx(je,{...v,children:q}),e[56]=v,e[57]=q,e[58]=D):D=e[58];let L;e[59]!==u?(L=u&&n.jsxs("div",{role:"alert",className:"space-y-2 rounded-lg border border-destructive/40 bg-destructive/5 p-3",children:[n.jsx("p",{className:"text-sm font-medium text-foreground",children:u.title}),n.jsx("ol",{className:"space-y-1 text-sm text-muted-foreground",children:u.steps.map(In)})]}),e[59]=u,e[60]=L):L=e[60];let M;e[61]!==N.error||e[62]!==N.isError||e[63]!==i?(M=N.isError&&n.jsx("p",{role:"alert",className:"text-sm text-destructive",children:N.error instanceof Error?N.error.message:i("commerceOnboarding.saBindingForm.bindError")}),e[61]=N.error,e[62]=N.isError,e[63]=i,e[64]=M):M=e[64];let H;e[65]!==T||e[66]!==p||e[67]!==i?(H=p?n.jsx("button",{type:"button",onClick:p,disabled:T,className:"text-xs text-muted-foreground underline underline-offset-2 hover:text-foreground disabled:opacity-50",children:i("commerceOnboarding.saBindingForm.googleLoginAlternative")}):n.jsx("span",{}),e[65]=T,e[66]=p,e[67]=i,e[68]=H):H=e[68];let P;e[69]!==i?(P=i("commerceOnboarding.saBindingForm.cancel"),e[69]=i,e[70]=P):P=e[70];let V;e[71]!==T||e[72]!==r||e[73]!==P?(V=n.jsx(Z,{type:"button",variant:"outline",onClick:r,disabled:T,children:P}),e[71]=T,e[72]=r,e[73]=P,e[74]=V):V=e[74];let se;e[75]!==T||e[76]!==i?(se=i(T?"commerceOnboarding.saBindingForm.verifying":"commerceOnboarding.saBindingForm.bind"),e[75]=T,e[76]=i,e[77]=se):se=e[77];let ne;e[78]!==T||e[79]!==se?(ne=n.jsx(Z,{type:"submit",disabled:T,children:se}),e[78]=T,e[79]=se,e[80]=ne):ne=e[80];let oe;e[81]!==V||e[82]!==ne?(oe=n.jsxs("div",{className:"flex gap-2",children:[V,ne]}),e[81]=V,e[82]=ne,e[83]=oe):oe=e[83];let X;e[84]!==H||e[85]!==oe?(X=n.jsxs(pe,{className:"flex-col gap-2 pt-2 sm:flex-row sm:items-center sm:justify-between",children:[H,oe]}),e[84]=H,e[85]=oe,e[86]=X):X=e[86];let z;return e[87]!==I||e[88]!==A||e[89]!==Q||e[90]!==D||e[91]!==L||e[92]!==M||e[93]!==X?(z=n.jsxs("form",{onSubmit:I,className:"space-y-4",children:[A,Q,D,L,M,X]}),e[87]=I,e[88]=A,e[89]=Q,e[90]=D,e[91]=L,e[92]=M,e[93]=X,e[94]=z):z=e[94],z}function In(s){return n.jsxs("li",{className:"flex gap-2",children:[n.jsx("span",{"aria-hidden":!0,children:"•"}),n.jsx("span",{children:s})]},s)}function Rn(s,e){return n.jsxs("li",{className:"flex gap-2",children:[n.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center rounded-full bg-muted text-xs font-medium text-foreground",children:e+1}),n.jsx("span",{children:s})]},s)}function kn(){const s=W.c(2);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"size-9 shrink-0 animate-pulse rounded-lg bg-muted/60"}),s[0]=e):e=s[0];let t;return s[1]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsxs("div",{className:"flex items-center gap-3 rounded-2xl border border-border bg-card p-3 sm:h-full sm:flex-col sm:items-stretch sm:p-4",children:[e,n.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[n.jsx("div",{className:"h-4 w-24 animate-pulse rounded bg-muted/60"}),n.jsx("div",{className:"hidden h-3 w-full animate-pulse rounded bg-muted/60 sm:block"})]}),n.jsx("div",{className:"h-8 w-20 shrink-0 animate-pulse rounded-lg bg-muted/60 sm:mt-auto sm:w-full"})]}),s[1]=t):t=s[1],t}function Me(s){const e=W.c(17),{title:t,disconnecting:o,disabled:l,onDisconnect:c}=s,a=te(),r=l||o;let m;e[0]!==a||e[1]!==t?(m=a("commerceOnboarding.companionCard.disconnectAriaLabel",{title:t}),e[0]=a,e[1]=t,e[2]=m):m=e[2];let p;e[3]!==o?(p=o?n.jsx(Ie,{size:16,className:"animate-spin"}):n.jsx(wt,{size:16}),e[3]=o,e[4]=p):p=e[4];let i;e[5]!==c||e[6]!==r||e[7]!==m||e[8]!==p?(i=n.jsx(Le,{asChild:!0,children:n.jsx(Z,{type:"button",variant:"ghost",size:"icon-sm",className:"shrink-0 text-muted-foreground hover:text-destructive",disabled:r,onClick:c,"aria-label":m,children:p})}),e[5]=c,e[6]=r,e[7]=m,e[8]=p,e[9]=i):i=e[9];let d;e[10]!==a?(d=a("commerceOnboarding.companionCard.disconnect"),e[10]=a,e[11]=d):d=e[11];let g;e[12]!==d?(g=n.jsx(Ae,{children:d}),e[12]=d,e[13]=g):g=e[13];let u;return e[14]!==i||e[15]!==g?(u=n.jsxs(Fe,{children:[i,g]}),e[14]=i,e[15]=g,e[16]=u):u=e[16],u}function Fn(s){const{onConnect:e}=s,[t,o]=G.useState(!1);return t||(o(!0),queueMicrotask(e)),null}function Ln(s){const e=W.c(30),{card:t,connecting:o,disconnecting:l,disabled:c,onConnect:a,onDisconnect:r,org:m,selfClient:p,siteUrl:i,autoOpenConfigFieldKey:d,onAutoOpenConfigHandled:g,autoOpen:u}=s,y=t.linkedConnectionId,b=lt[t.bindingType],h=!!b&&t.boundVia!=="oauth",x=t.satisfied&&!t.configured,f=u&&!h&&!t.satisfied;let S;e[0]!==u||e[1]!==d||e[2]!==t||e[3]!==o||e[4]!==c||e[5]!==l||e[6]!==y||e[7]!==x||e[8]!==g||e[9]!==a||e[10]!==r||e[11]!==m||e[12]!==b||e[13]!==p||e[14]!==i||e[15]!==h?(S=h&&b?n.jsx(An,{card:t,provider:b,org:m,selfClient:p,siteUrl:i,onOAuthInstead:a,disabled:c,connecting:o,primary:t.required,autoOpen:u&&!t.satisfied}):t.satisfied&&y?x?n.jsxs("div",{className:"flex items-center justify-end gap-1 sm:justify-start",children:[n.jsx(G.Suspense,{fallback:n.jsx(ze,{}),children:n.jsx(Ve,{card:t,org:m,selfClient:p,connectionId:y,contextSiteUrl:i,variant:"configure",disabled:c,autoOpen:u||Be({autoOpenFieldKey:d,card:t}),onAutoOpenHandled:g})}),n.jsx(Me,{title:t.title,disconnecting:l,disabled:c,onDisconnect:r})]}):n.jsx(rt,{detail:t.connectedDetail,controls:n.jsxs(n.Fragment,{children:[n.jsx(G.Suspense,{fallback:n.jsx(ze,{}),children:n.jsx(Ve,{card:t,org:m,selfClient:p,connectionId:y,contextSiteUrl:i,variant:"gear",disabled:c,autoOpen:Be({autoOpenFieldKey:d,card:t}),onAutoOpenHandled:g})}),n.jsx(Me,{title:t.title,disconnecting:l,disabled:c,onDisconnect:r})]})}):n.jsx(it,{connecting:o,disabled:c,title:t.title,primary:t.required,onConnect:a}),e[0]=u,e[1]=d,e[2]=t,e[3]=o,e[4]=c,e[5]=l,e[6]=y,e[7]=x,e[8]=g,e[9]=a,e[10]=r,e[11]=m,e[12]=b,e[13]=p,e[14]=i,e[15]=h,e[16]=S):S=e[16];const v=S;let E;e[17]!==a||e[18]!==f?(E=f&&n.jsx(Fn,{onConnect:a}),e[17]=a,e[18]=f,e[19]=E):E=e[19];const O=t.required&&!t.satisfied;let j;e[20]!==v||e[21]!==t.headline||e[22]!==t.icon||e[23]!==t.title||e[24]!==x||e[25]!==O?(j=n.jsx(sn,{icon:t.icon,title:t.title,headline:t.headline,required:O,attention:x,action:v}),e[20]=v,e[21]=t.headline,e[22]=t.icon,e[23]=t.title,e[24]=x,e[25]=O,e[26]=j):j=e[26];let C;return e[27]!==E||e[28]!==j?(C=n.jsxs(n.Fragment,{children:[E,j]}),e[27]=E,e[28]=j,e[29]=C):C=e[29],C}function An(s){const e=W.c(46),{card:t,provider:o,org:l,selfClient:c,siteUrl:a,onOAuthInstead:r,disabled:m,connecting:p,primary:i,autoOpen:d}=s,g=te(),[u,y]=G.useState(d??!1),[b,h]=G.useState(!1);let x;e[0]!==b?(x=A=>{!A&&b||y(A)},e[0]=b,e[1]=x):x=e[1];const f=x;let S;e[2]!==t.connectedDetail||e[3]!==t.satisfied||e[4]!==t.title||e[5]!==p||e[6]!==m||e[7]!==i||e[8]!==g?(S=t.satisfied?n.jsx(rt,{detail:t.connectedDetail,controls:n.jsxs(Fe,{children:[n.jsx(Le,{asChild:!0,children:n.jsx(at,{ariaLabel:g("commerceOnboarding.companionCard.configureAriaLabel",{title:t.title}),onClick:()=>y(!0)})}),n.jsx(Ae,{children:g("commerceOnboarding.companionCard.editConfiguration")})]})}):n.jsx(it,{connecting:p,disabled:m,title:t.title,primary:i,onConnect:()=>y(!0)}),e[2]=t.connectedDetail,e[3]=t.satisfied,e[4]=t.title,e[5]=p,e[6]=m,e[7]=i,e[8]=g,e[9]=S):S=e[9];let v;e[10]!==t.icon||e[11]!==t.title?(v=n.jsx(ke,{icon:t.icon,name:t.title,size:"md",fit:"contain",className:"p-1.5"}),e[10]=t.icon,e[11]=t.title,e[12]=v):v=e[12];let E;e[13]!==t.title?(E=n.jsx(We,{children:t.title}),e[13]=t.title,e[14]=E):E=e[14];let O;e[15]!==g?(O=g("commerceOnboarding.companionCard.grantAccessDescription"),e[15]=g,e[16]=O):O=e[16];let j;e[17]!==O?(j=n.jsx(Ye,{children:O}),e[17]=O,e[18]=j):j=e[18];let C;e[19]!==E||e[20]!==j?(C=n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[E,j]}),e[19]=E,e[20]=j,e[21]=C):C=e[21];let w;e[22]!==v||e[23]!==C?(w=n.jsxs(Ze,{className:"flex-row items-center gap-3 space-y-0 text-left",children:[v,C]}),e[22]=v,e[23]=C,e[24]=w):w=e[24];const N=t.boundResource??void 0;let _;e[25]===Symbol.for("react.memo_cache_sentinel")?(_=()=>y(!1),e[25]=_):_=e[25];let I;e[26]!==t.satisfied||e[27]!==r?(I=t.satisfied?void 0:()=>{y(!1),r()},e[26]=t.satisfied,e[27]=r,e[28]=I):I=e[28];let T;e[29]!==l||e[30]!==o||e[31]!==c||e[32]!==a||e[33]!==I||e[34]!==N?(T=n.jsx(wn,{provider:o,siteUrl:a,selfClient:c,org:l,initialResourceId:N,onDone:_,onIsPendingChange:h,onOAuthInstead:I}),e[29]=l,e[30]=o,e[31]=c,e[32]=a,e[33]=I,e[34]=N,e[35]=T):T=e[35];let k;e[36]!==T||e[37]!==w?(k=n.jsxs(Je,{className:"sm:max-w-lg",children:[w,T]}),e[36]=T,e[37]=w,e[38]=k):k=e[38];let $;e[39]!==f||e[40]!==u||e[41]!==k?($=n.jsx(Xe,{open:u,onOpenChange:f,children:k}),e[39]=f,e[40]=u,e[41]=k,e[42]=$):$=e[42];let F;return e[43]!==$||e[44]!==S?(F=n.jsxs(n.Fragment,{children:[S,$]}),e[43]=$,e[44]=S,e[45]=F):F=e[45],F}function ze(){const s=W.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"size-8 shrink-0 animate-pulse rounded-lg bg-muted/60"}),s[0]=e):e=s[0],e}function Ve(s){const e=W.c(71),{card:t,org:o,selfClient:l,connectionId:c,contextSiteUrl:a,variant:r,disabled:m,autoOpen:p,onAutoOpenHandled:i}=s,d=te();let g;e[0]!==c||e[1]!==o.id||e[2]!==o.slug?(g={connectionId:c,orgId:o.id,orgSlug:o.slug},e[0]=c,e[1]=o.id,e[2]=o.slug,e[3]=g):g=e[3];const u=Re(g),[y,b]=G.useState(p),[h,x]=G.useState(!1),f=be(),S=En[t.bindingType];let v;e[4]!==t.configurationState?(v=kt(t.configurationState),e[4]=t.configurationState,e[5]=v):v=e[5];const E=v;let O;e[6]!==p||e[7]!==i?(O=()=>{b(!1),p&&i()},e[6]=p,e[7]=i,e[8]=O):O=e[8];const j=O;let C;e[9]!==j||e[10]!==h?(C=P=>{if(!(!P&&h)){if(!P){j();return}b(!0)}},e[9]=j,e[10]=h,e[11]=C):C=e[11];const w=C;let N;e[12]!==c||e[13]!==l?(N=async()=>{await l.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:c,force:!0}})},e[12]=c,e[13]=l,e[14]=N):N=e[14];let _;e[15]!==t.title||e[16]!==j||e[17]!==o.id||e[18]!==f||e[19]!==d?(_=async()=>{await f.invalidateQueries({queryKey:J.commerceDiscoveryCompanionConnectionsPrefix(o.id)}),Se.success(d("commerceOnboarding.companionCard.disconnectedSuccess",{title:t.title})),j()},e[15]=t.title,e[16]=j,e[17]=o.id,e[18]=f,e[19]=d,e[20]=_):_=e[20];let I;e[21]!==d?(I=()=>{Se.error(d("commerceOnboarding.companionCard.disconnectError"))},e[21]=d,e[22]=I):I=e[22];let T;e[23]!==N||e[24]!==_||e[25]!==I?(T={mutationFn:N,onSuccess:_,onError:I},e[23]=N,e[24]=_,e[25]=I,e[26]=T):T=e[26];const k=_e(T);if(!S)return null;let $;e[27]!==t.title||e[28]!==m||e[29]!==E||e[30]!==d||e[31]!==r?($=r==="configure"?n.jsx(rn,{disabled:m,title:t.title,onConfigure:()=>b(!0)}):n.jsxs(Fe,{children:[n.jsx(Le,{asChild:!0,children:n.jsx(at,{ariaLabel:d("commerceOnboarding.companionCard.configureAriaLabel",{title:t.title}),onClick:()=>b(!0)})}),n.jsx(Ae,{children:E.length>0?d("commerceOnboarding.companionCard.editConfiguration"):d("commerceOnboarding.companionCard.configure")})]}),e[27]=t.title,e[28]=m,e[29]=E,e[30]=d,e[31]=r,e[32]=$):$=e[32];const F=$;let A;e[33]!==t.icon||e[34]!==t.title?(A=n.jsx(ke,{icon:t.icon,name:t.title,size:"md",fit:"contain",className:"p-1.5"}),e[33]=t.icon,e[34]=t.title,e[35]=A):A=e[35];let K;e[36]!==t.title?(K=n.jsx(We,{children:t.title}),e[36]=t.title,e[37]=K):K=e[37];let U;e[38]!==t.title||e[39]!==d?(U=d("commerceOnboarding.companionCard.configureDescription",{title:t.title}),e[38]=t.title,e[39]=d,e[40]=U):U=e[40];let B;e[41]!==U?(B=n.jsx(Ye,{children:U}),e[41]=U,e[42]=B):B=e[42];let Q;e[43]!==K||e[44]!==B?(Q=n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[K,B]}),e[43]=K,e[44]=B,e[45]=Q):Q=e[45];let R;e[46]!==A||e[47]!==Q?(R=n.jsxs(Ze,{className:"flex-row items-center gap-3 space-y-0 text-left",children:[A,Q]}),e[46]=A,e[47]=Q,e[48]=R):R=e[48];let q;e[49]!==k?(q=()=>k.mutate(),e[49]=k,e[50]=q):q=e[50];let D;e[51]!==S||e[52]!==t||e[53]!==j||e[54]!==u||e[55]!==c||e[56]!==a||e[57]!==o||e[58]!==l||e[59]!==q?(D=n.jsx(S,{card:t,connectionId:c,companionClient:u,selfClient:l,org:o,contextSiteUrl:a,onDone:j,onDisconnect:q,onIsPendingChange:x}),e[51]=S,e[52]=t,e[53]=j,e[54]=u,e[55]=c,e[56]=a,e[57]=o,e[58]=l,e[59]=q,e[60]=D):D=e[60];let L;e[61]!==R||e[62]!==D?(L=n.jsxs(Je,{className:"sm:max-w-lg",children:[R,D]}),e[61]=R,e[62]=D,e[63]=L):L=e[63];let M;e[64]!==y||e[65]!==w||e[66]!==L?(M=n.jsx(Xe,{open:y,onOpenChange:w,children:L}),e[64]=y,e[65]=w,e[66]=L,e[67]=M):M=e[67];let H;return e[68]!==M||e[69]!==F?(H=n.jsxs(n.Fragment,{children:[F,M]}),e[68]=M,e[69]=F,e[70]=H):H=e[70],H}const qe={vtex:{registryAppId:"deco/vtex",area:"Catálogo",headline:"Rupturas e PDPs que travam suas vendas."},shopify:{registryAppId:"deco/shopify",area:"Catálogo",headline:"Pedidos, estoque e catálogo direto da sua Shopify."},"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 Dn(s){const e=W.c(43),{selfClient:t,org:o,cdConnectionId:l,siteUrl:c}=s;let a;e[0]!==l||e[1]!==o.id||e[2]!==o.slug?(a={connectionId:l,orgId:o.id,orgSlug:o.slug},e[0]=l,e[1]=o.id,e[2]=o.slug,e[3]=a):a=e[3];const r=Re(a);let m;e[4]!==l||e[5]!==o.id?(m=J.commerceDiscoveryCompanionSchema(o.id,l),e[4]=l,e[5]=o.id,e[6]=m):m=e[6];let p;e[7]!==r?(p=async()=>{const z=await r.callTool({name:"MCP_CONFIGURATION",arguments:{}});return ee(z)},e[7]=r,e[8]=p):p=e[8];let i;e[9]!==m||e[10]!==p?(i={queryKey:m,queryFn:p,retry:!1},e[9]=m,e[10]=p,e[11]=i):i=e[11];const d=he(i),g=d.data?.stateSchema?Ft(d.data.stateSchema):null;let u;e[12]===Symbol.for("react.memo_cache_sentinel")?(u={strict:!1},e[12]=u):u=e[12];const{shopify:y}=St(u);let b;e[13]!==y?(b=z=>z.bindingType!=="shopify"||y!=null,e[13]=y,e[14]=b):b=e[14];const h=(g&&g.length>0?g:Lt).filter(b),x=h.map(Vn),f=h.map(zn).filter(Mn),S=h.filter(Qn).map(Bn),v=[...f,...S].sort().join(",");let E;e[15]!==l||e[16]!==o.id?(E=J.commerceDiscoveryConnection(o.id,l),e[15]=l,e[16]=o.id,e[17]=E):E=e[17];let O;e[18]!==l||e[19]!==t?(O=async()=>{const z=await t.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:l}});return ee(z)},e[18]=l,e[19]=t,e[20]=O):O=e[20];let j;e[21]!==E||e[22]!==O?(j={queryKey:E,queryFn:O},e[21]=E,e[22]=O,e[23]=j):j=e[23];const w=Ee(j).data?.item?.configuration_state??null;let N;e[24]!==w?(N=z=>w?.[z.fieldKey]?.value,e[24]=w,e[25]=N):N=e[25];const _=h.map(N).filter(Un),I=[...x.map(Kn),...f.map($n),..._.map(qn)].sort().join(","),k=Ee({queryKey:J.commerceDiscoveryCompanionConnections(o.id,I),queryFn:async()=>{if(h.length===0)return{items:[]};const z=[{field:["app_name"],operator:"in",value:x},{field:["app_id"],operator:"in",value:f}];_.length>0&&z.push({field:["id"],operator:"in",value:_});const Y=await t.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{operator:"or",conditions:z},limit:1e3}});return ee(Y)}}).data?.items??[],$=new Set(_),F=k.filter(z=>$.has(z.id)),A=F.filter(Pn);let K;e[26]!==o.id||e[27]!==o.slug?(K=z=>({queryKey:J.commerceDiscoveryCompanionOAuthStatus(o.id,z.id),queryFn:async()=>{try{const Y=await fetch(`/api/${encodeURIComponent(o.slug)}/connections/${encodeURIComponent(z.id)}/oauth-token/status`,{credentials:"include"});return Y.ok?{hasToken:(await Y.json()).hasToken===!0}:{hasToken:!1}}catch{return{hasToken:!1}}},retry:!1}),e[26]=o.id,e[27]=o.slug,e[28]=K):K=e[28];const U=Jt({queries:A.map(K)});let B;e[29]!==U?(B=(z,Y)=>[z.id,U[Y]?.data?.hasToken===!0],e[29]=U,e[30]=B):B=e[30];const Q=new Map(A.map(B)),R={};for(const z of F)R[z.id]=!z.oauth_config||!!z.connection_token||Q.get(z.id)===!0;const q=Ee({queryKey:J.commerceDiscoveryCompanionRegistry(o.id,v),queryFn:async()=>{if(h.length===0)return{items:[]};const z=At(f,S),Y=await Vt(He.REGISTRY(o.id),o.id,o.slug,"COLLECTION_REGISTRY_APP_LIST",{...z?{where:z}:{},limit:1e3});return ee(Y)}}),D={},L={};for(const z of q.data?.items??[])D[z.id]=z,z.server?.name&&(L[z.server.name]=z);let M;e[31]!==o.id||e[32]!==c?(M=J.commerceDiscoveryConnectionStatus(o.id,c??""),e[31]=o.id,e[32]=c,e[33]=M):M=e[33];const H=!!c;let P;e[34]!==t||e[35]!==c?(P=async()=>{const z=await t.callTool({name:"COMMERCE_DISCOVERY_CONNECTION_STATUS",arguments:{siteUrl:c}});return ee(z)},e[34]=t,e[35]=c,e[36]=P):P=e[36];let V;e[37]!==M||e[38]!==H||e[39]!==P?(V={queryKey:M,enabled:H,queryFn:P},e[37]=M,e[38]=H,e[39]=P,e[40]=V):V=e[40];const se=he(V),ne={};for(const[z,Y]of Object.entries(lt)){const ie=se.data?.providers?.[Y];ie?.connected&&ie.via==="sa"&&(ne[z]={resource:ie.resource??null})}const oe=Dt({requirements:h,itemsById:D,itemsByName:L,connections:k,connectionReadiness:R,configurationState:w,curated:qe,saBindings:ne});let X;return e[41]!==oe?(X={cards:oe},e[41]=oe,e[42]=X):X=e[42],X}function Pn(s){return s.oauth_config&&!s.connection_token}function qn(s){return`linked:${s}`}function $n(s){return`app:${s}`}function Kn(s){return`binding:${s}`}function Un(s){return typeof s=="string"&&s.length>0}function Bn(s){return s.bindingType}function Qn(s){return!qe[s.bindingType]}function Mn(s){return!!s}function zn(s){return qe[s.bindingType]?.registryAppId}function Vn(s){return s.bindingType}function Gn({selfClient:s,org:e,userId:t,cdConnectionId:o,domain:l,siteUrl:c}){const a=be(),[r,m]=G.useState(null),[p,i]=G.useState(null),[d,g]=G.useState(null),u=async(h,x)=>{const f=await s.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:h,data:x}});return ee(f)};async function y(h){m(h.fieldKey),g(null);const x={app_name:h.title,field_key:h.fieldKey,organization_id:e.id,domain:l,site_url:c};ue("commerce_onboarding_companion_connect_clicked",x);try{let f=h.candidateConnectionId;if(!f){const C=Gt(h.registryItem,e.id,t,{remoteIndex:0}),w=C.connection_type==="STDIO",N=!!C.connection_url,_=w&&C.connection_headers&&typeof C.connection_headers=="object"&&"command"in C.connection_headers;if(!N&&!_)return ue("commerce_onboarding_companion_connect_failed",{...x,error:"no_connection_method"}),g(`${h.title} cannot be connected: no connection method available`),!1;const I=await s.callTool({name:"COLLECTION_CONNECTIONS_CREATE",arguments:{data:C}});f=ee(I).item.id}const S=f,v=await Ht({connectionId:S,orgId:e.id,orgSlug:e.slug,persistFallback:C=>u(S,{connection_token:C}).then(()=>{})});if(!v.ok)return ue("commerce_onboarding_companion_connect_failed",{...x,error:v.error}),g(`Couldn't sign in to ${h.title}: ${v.error}`),!1;const E=await s.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:o}}),O=ee(E).item?.configuration_state??null,j=Pt(O,h.fieldKey,h.bindingType,S);return h.bindingType==="github"&&delete j.github_repo,await u(o,{configuration_state:j}),await a.invalidateQueries({queryKey:J.commerceDiscoveryConnection(e.id,o)}),await a.invalidateQueries({queryKey:J.commerceDiscoveryCompanionConnectionsPrefix(e.id)}),ue("commerce_onboarding_companion_connected",x),!0}catch(f){return ue("commerce_onboarding_companion_connect_failed",{...x,error:f instanceof Error?f.message:String(f)}),g(f instanceof Error?f.message:String(f)),!1}finally{m(null)}}async function b(h){i(h.fieldKey),g(null);const x={app_name:h.title,field_key:h.fieldKey,organization_id:e.id,domain:l,site_url:c};ue("commerce_onboarding_companion_disconnect_clicked",x);try{const f=await s.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:o}}),v={...ee(f).item?.configuration_state??null??{}};return delete v[h.fieldKey],h.bindingType==="github"&&delete v.github_repo,await u(o,{configuration_state:v}),await a.invalidateQueries({queryKey:J.commerceDiscoveryConnection(e.id,o)}),await a.invalidateQueries({queryKey:J.commerceDiscoveryCompanionConnectionsPrefix(e.id)}),ue("commerce_onboarding_companion_disconnected",x),!0}catch(f){return ue("commerce_onboarding_companion_disconnect_failed",{...x,error:f instanceof Error?f.message:String(f)}),g(f instanceof Error?f.message:String(f)),!1}finally{i(null)}}return{connect:y,connectingFieldKey:r,disconnect:b,disconnectingFieldKey:p,error:d}}const $e="flex min-h-0 flex-1 flex-col gap-6 md:grid md:flex-none md:gap-6";function Ke(){const s=W.c(4),e=te();let t;s[0]!==e?(t=e("routes.commerceOnboarding.companionSection.title"),s[0]=e,s[1]=t):t=s[1];let o;return s[2]!==t?(o=n.jsx("h1",{className:"text-lg font-medium leading-6 text-foreground lg:text-xl lg:leading-7",children:t}),s[2]=t,s[3]=o):o=s[3],o}function Hn(){const s=W.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"flex flex-col gap-4",children:[0,1,2,3].map(Wn)}),s[0]=e):e=s[0],e}function Wn(s){return n.jsx(kn,{},s)}function Yn(){const s=W.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsxs("div",{className:$e,children:[n.jsx(Ke,{}),n.jsx(Hn,{})]}),s[0]=e):e=s[0],e}function Zn(s){const e=W.c(18),{onRetry:t}=s,o=te();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(Ke,{}),e[0]=l):l=e[0];let c;e[1]!==o?(c=o("routes.commerceOnboarding.companionSection.loadError"),e[1]=o,e[2]=c):c=e[2];let a;e[3]!==c?(a=n.jsx("p",{className:"text-sm text-foreground",children:c}),e[3]=c,e[4]=a):a=e[4];let r;e[5]!==o?(r=o("routes.commerceOnboarding.companionSection.loadErrorDescription"),e[5]=o,e[6]=r):r=e[6];let m;e[7]!==r?(m=n.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:r}),e[7]=r,e[8]=m):m=e[8];let p;e[9]!==o?(p=o("routes.commerceOnboarding.companionSection.retry"),e[9]=o,e[10]=p):p=e[10];let i;e[11]!==t||e[12]!==p?(i=n.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"mt-3",onClick:t,children:p}),e[11]=t,e[12]=p,e[13]=i):i=e[13];let d;return e[14]!==a||e[15]!==m||e[16]!==i?(d=n.jsxs("div",{className:$e,children:[l,n.jsxs("div",{role:"alert",className:"rounded-2xl border border-border bg-card p-4",children:[a,m,i]})]}),e[14]=a,e[15]=m,e[16]=i,e[17]=d):d=e[17],d}function Oo(s){const e=W.c(2);let t;return e[0]!==s?(t=n.jsx(Ot,{children:o=>{const{reset:l}=o;return n.jsx(_t,{fallback:c=>{const{resetError:a}=c;return n.jsx(Zn,{onRetry:()=>{l(),a()}})},children:n.jsx(G.Suspense,{fallback:n.jsx(Yn,{}),children:n.jsx(Jn,{...s})})})}}),e[0]=s,e[1]=t):t=e[1],t}function Jn(s){const e=W.c(65),{org:t,cdConnectionId:o,siteUrl:l,onReadinessChange:c,focusFieldKey:a}=s,{data:r}=Nt.useSession(),m=r?.user?.id??"";let p;if(e[0]!==l){const U=l?Oe(l):null;if(U?.ok)try{p=new URL(U.value).hostname}catch{p=void 0}e[0]=l,e[1]=p}else p=e[1];let i;e[2]!==t.id||e[3]!==t.slug?(i={connectionId:Tt,orgId:t.id,orgSlug:t.slug},e[2]=t.id,e[3]=t.slug,e[4]=i):i=e[4];const d=Re(i);let g;e[5]!==o||e[6]!==t||e[7]!==d||e[8]!==l?(g={selfClient:d,org:t,cdConnectionId:o,siteUrl:l},e[5]=o,e[6]=t,e[7]=d,e[8]=l,e[9]=g):g=e[9];const{cards:u}=Dn(g);let y;e[10]!==o||e[11]!==t||e[12]!==d||e[13]!==p||e[14]!==l||e[15]!==m?(y={selfClient:d,org:t,userId:m,cdConnectionId:o,domain:p,siteUrl:l},e[10]=o,e[11]=t,e[12]=d,e[13]=p,e[14]=l,e[15]=m,e[16]=y):y=e[16];const{connect:b,connectingFieldKey:h,disconnect:x,disconnectingFieldKey:f,error:S}=Gn(y),[v,E]=G.useState(null),O=to;let j,C,w,N,_,I,T,k,$;if(e[17]!==v||e[18]!==u||e[19]!==b||e[20]!==S||e[21]!==h||e[22]!==x||e[23]!==f||e[24]!==a||e[25]!==c||e[26]!==t||e[27]!==d||e[28]!==l){w=Symbol.for("react.early_return_sentinel");e:{const U=u.filter(eo),B=u.filter(Xn),Q=U.length>0?U.every(O):u.length===0||u.some(O);if(c?.(Q),u.length===0){w=null;break e}const R=h!==null||f!==null;let q;e[38]!==v||e[39]!==R||e[40]!==b||e[41]!==h||e[42]!==x||e[43]!==f||e[44]!==a||e[45]!==t||e[46]!==d||e[47]!==l?(q=L=>{const M=async()=>{await b(L)&&E(L.fieldKey)};return n.jsx(Ln,{card:L,connecting:h===L.fieldKey,disconnecting:f===L.fieldKey,disabled:R&&h!==L.fieldKey&&f!==L.fieldKey,org:t,selfClient:d,siteUrl:l,autoOpenConfigFieldKey:v,onAutoOpenConfigHandled:()=>E(H=>H===L.fieldKey?null:H),autoOpen:a===L.fieldKey,onConnect:()=>{M()},onDisconnect:()=>{x(L)}},L.fieldKey)},e[38]=v,e[39]=R,e[40]=b,e[41]=h,e[42]=x,e[43]=f,e[44]=a,e[45]=t,e[46]=d,e[47]=l,e[48]=q):q=e[48];const D=q;$=$e,e[49]===Symbol.for("react.memo_cache_sentinel")?(C=n.jsx(Ke,{}),e[49]=C):C=e[49],j=on,I="flex min-h-0 flex-1 flex-col md:block",T="-mx-1 min-h-0 flex-1 overflow-y-auto px-1 md:max-h-[min(60vh,calc(100dvh-330px))] md:flex-none",e[50]!==S?(k=S&&n.jsx("p",{role:"alert",className:"mb-3 text-sm text-destructive",children:S}),e[50]=S,e[51]=k):k=e[51],N="flex flex-col gap-4 pt-3",_=(a?u.filter(L=>L.fieldKey===a):[...U,...B]).map(D)}e[17]=v,e[18]=u,e[19]=b,e[20]=S,e[21]=h,e[22]=x,e[23]=f,e[24]=a,e[25]=c,e[26]=t,e[27]=d,e[28]=l,e[29]=j,e[30]=C,e[31]=w,e[32]=N,e[33]=_,e[34]=I,e[35]=T,e[36]=k,e[37]=$}else j=e[29],C=e[30],w=e[31],N=e[32],_=e[33],I=e[34],T=e[35],k=e[36],$=e[37];if(w!==Symbol.for("react.early_return_sentinel"))return w;let F;e[52]!==N||e[53]!==_?(F=n.jsx("div",{className:N,children:_}),e[52]=N,e[53]=_,e[54]=F):F=e[54];let A;e[55]!==j||e[56]!==F||e[57]!==I||e[58]!==T||e[59]!==k?(A=n.jsxs(j,{wrapperClassName:I,className:T,children:[k,F]}),e[55]=j,e[56]=F,e[57]=I,e[58]=T,e[59]=k,e[60]=A):A=e[60];let K;return e[61]!==C||e[62]!==A||e[63]!==$?(K=n.jsxs("div",{className:$,children:[C,A]}),e[61]=C,e[62]=A,e[63]=$,e[64]=K):K=e[64],K}function Xn(s){return!s.required}function eo(s){return s.required}function to(s){return s.satisfied&&s.configured}function no(s){return s.content?.find(e=>e.text)?.text??"A configuração do Commerce Discovery falhou."}function _o(s){const e=s;if(e.isError)throw new Error(no(e));return e.structuredContent??s}export{Yn as C,Pe as L,on as S,Oo as a,jo as i,Oe as n,_o as p,So as s,Zt as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as T,b as ve,j as o,r as ee,B as je,k as Se}from"./index-Cuug8jd7.js";import{i as ke}from"./ChevronRight-DcTM74Nx.js";import{a4 as fe}from"./agent-icon-5i6OCL5F.js";import{l as xe}from"./automation-runs-CQwGBeB-.js";import{r as Ne,c as we,u as _e,a as Ee,i as Pe,d as Te,f as Fe,P as Re,S as Ce}from"./page-seo-form-D8dMsdHr.js";import{a8 as ue,a0 as Ke}from"./index-B8kihcrU.js";import{a as ye}from"./Tool01-CCM-RK9J.js";import"./AlertCircle-CzHAhrr6.js";import"./ArrowUp-DBrHtvfE.js";import"./Settings02-BQ_6W_JU.js";import"./Tool02-DoDg-nMh.js";import"./XCircle-BAGVWBr6.js";import"./ArrowUpRight-Difm6SBR.js";import"./TrendUp01-BR_L8L93.js";import"./ZapSquare-eoAx0e5s.js";import"./Users03-BFLEPfzp.js";import"./CheckCircle-CBXbZPqe.js";import"./Check-BMwhITGN.js";import"./ChevronDown-BLutYvIR.js";import"./ChevronUp-CnX0DUPn.js";import"./DotsVertical-Bi2Pj2Rx.js";import"./Stars02-5ngV3USt.js";import"./Copy01-0FQhJRTl.js";import"./CpuChip01-CQ_lGCKe.js";import"./CreditCard01-CIVjejYO.js";import"./Eye-CNJVROK8.js";import"./FilterLines-C-MayH4t.js";import"./Star01-DdMpc2WM.js";import"./Palette-R1zicu_8.js";import"./SwitchHorizontal01-DBQaK4CG.js";import"./HardDrive-fDvzj4Z4.js";import"./Key01-DA8DOmXm.js";import"./LayoutLeft-DwCyodVh.js";import"./LinkExternal01-ZqumszDD.js";import"./LogOut01-oRQwceas.js";import"./Monitor01-BRfBPH_W.js";import"./Sun-DWxD9K8n.js";import"./Play-CmYL2KsO.js";import"./Plus-Ro_Rugpt.js";import"./SearchLg-CI4x084k.js";import"./SearchMd-BbbEhgez.js";import"./Shield01-C3qOqW-P.js";import"./Stars01-CJD9WdTJ.js";import"./Trash01-Dv4YTeiI.js";import"./Upload01-BNGUctEI.js";import"./User01-Dy3rZ0aR.js";import"./Users01-Dv8D_P-8.js";import"./XClose-BGriJSCO.js";import"./X-BfG7pUZd.js";import"./Zap-CuquuuMb.js";import"./select-B5znG0Y1.js";import"./tooltip-D09V-b-D.js";import"./useInfiniteQuery-DD0TdbWx.js";import"./use-infinite-scroll-BOup92L2.js";import"./use-connection-DLCNMhT_.js";import"./use-mcp-client-BDN-FEcc.js";import"./auth-B-H82oVn.js";import"./use-virtual-mcp-PtirDXqx.js";import"./card-CdJSU8vr.js";import"./sidebar-BIAbDN30.js";import"./use-mobile-DFoMyuD6.js";import"./table-CAhOdKdH.js";import"./empty-state-Di4I9IOD.js";import"./use-members-B28NMHu7.js";import"./use-org-auth-client-BUZkHhRH.js";import"./use-clock-tick-j7al6WgB.js";import"./use-automations-CjCcOCBs.js";import"./studio-tools-C08UjHsr.js";import"./useSuspenseInfiniteQuery-Dx_jU7Uo.js";import"./avatar-B4WZZi9O.js";import"./format-time-BnbuEtat.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-K8bJ1Pv1.js";import"./calendar-CoGJ_oVh.js";import"./dialog-DQWMOcko.js";import"./tab-id-DFGnzFYn.js";import"./hooks-DHFul8ca.js";import"./decopilot-sse-pool-B4lV_pkT.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./chat-context-BRG2mTLS.js";import"./use-is-desktop-app-BNujXJc_.js";import"./use-ai-providers-Cg8eqOhK.js";import"./use-decopilot-events-C2Oegu9x.js";import"./use-organization-settings-DtUf52ZO.js";import"./monaco-editor-CkHuDiB4.js";import"./spinner-pPCTrTnr.js";import"./index-Cxhypuyo.js";import"./shell-layout-DZReMwJ6.js";import"./required-auth-layout-Do4z8fey.js";import"./use-org-sso-B1fpUBuH.js";import"./integration-icon-CDNH_447.js";import"./use-navigate-to-agent-CP2_58b3.js";import"./reusable-new-chat-CouMjkYR.js";import"./AreaChart-DfvsG2lG.js";import"./form-CyEJbmjQ.js";import"./label-BQAPYpl9.js";import"./input-DXhpVfJR.js";import"./switch-DYWfZ4oI.js";import"./drawer-CaAWxgE_.js";import"./collection-search-Ttix_hvO.js";import"./index-CnssvP1E.js";import"./get-initials-D-f_fDFw.js";import"./popover-DYdwyBTg.js";import"./dropdown-menu-BrspSm3T.js";import"./github-repo-picker-CKJmsZJv.js";import"./use-debounced-value-f6dEbPtS.js";import"./authenticate-and-persist-oauth-j7JC5dgx.js";import"./mcp-oauth-YbTKUbfv.js";import"./use-mcp-tools-JePK22Oi.js";import"./extract-connection-data-hkN_mOmy.js";import"./metadata-dUsYcpuu.js";import"./provision-repo-scoped-github-connection-B2s3ApVy.js";import"./use-tags-y6Q0JJyB.js";import"./skeleton-D0WX-Zws.js";import"./command-DzYbwMY0.js";import"./index-DjfX2K1C.js";import"./use-open-billing-url-DefE1f9-.js";import"./companions-core-PKrSbaze.js";import"./tabs-DsPtL2iD.js";import"./toggle-group-DY0VwFSy.js";import"./use-deco-credits-B0sL3XCm.js";import"./alert-dialog-WfWDyyhH.js";import"./toolbar-BBy3sR0H.js";import"./agent-capabilities-cXfbMfjV.js";import"./connection-card-D9ACpI6n.js";import"./use-registry-connections-DTbTMRqC.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./textarea-9vzfIjDG.js";import"./connection-form-helpers-B2do0MQh.js";import"./collection-tabs-DCuuZvcU.js";import"./badge-CO3kByaZ.js";import"./select-model-BkPkSQNk.js";import"./checkbox-VRqoAnNP.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-BI76S-ZK.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds--E_CrJ-R.js";import"./deco-site-production-url-CaKZ7xBn.js";import"./use-capability-BZtV5fjq.js";import"./pt-BR-CLy76QW2.js";import"./use-debounced-autosave-DyyWFfWP.js";import"./index-C65_levZ.js";import"./search-input-BQlH8Ixe.js";import"./index-DL8v59CJ.js";import"./use-secrets-B8PKKgDf.js";import"./self-tool-result-CR63nIK5.js";import"./use-file-configs-ZOIFLESr.js";import"./automation-list-row-DYdMB6iS.js";function A(d){return typeof d=="string"&&d.trim()?d:void 0}function he(d,e){if(d){if(e)try{const t=new URL(d,e).href;return ue(t)}catch{return}return ue(d)}}function ze(d){if(!d)return{};const e=A(d.title),t=A(d.titleTemplate);return{title:e&&t?.includes("%s")?t.replace(/%s/g,e):e,description:A(d.description),image:A(d.image),favicon:A(d.favicon)}}function De(d){if(!d)return"example.com";try{return new URL(d).host}catch{return"example.com"}}const $e=[{id:"google",labelKey:"sectionsEditor.seoPreview.platformGoogle",color:"#4285F4",layout:"search"},{id:"facebook",labelKey:"sectionsEditor.seoPreview.platformFacebook",color:"#1877F2",layout:"card"},{id:"twitter",labelKey:"sectionsEditor.seoPreview.platformTwitter",color:"#0f1419",layout:"card"},{id:"linkedin",labelKey:"sectionsEditor.seoPreview.platformLinkedin",color:"#0A66C2",layout:"card"},{id:"whatsapp",labelKey:"sectionsEditor.seoPreview.platformWhatsapp",color:"#25D366",layout:"chat"},{id:"telegram",labelKey:"sectionsEditor.seoPreview.platformTelegram",color:"#229ED9",layout:"chat"},{id:"slack",labelKey:"sectionsEditor.seoPreview.platformSlack",color:"#611f69",layout:"attachment"},{id:"discord",labelKey:"sectionsEditor.seoPreview.platformDiscord",color:"#5865F2",layout:"attachment"}];function de(d){const e=T.c(10),{src:t,className:n,iconSize:v}=d,r=v===void 0?20:v;if(t){let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m={objectFit:"cover"},e[0]=m):m=e[0];let p;return e[1]!==n||e[2]!==t?(p=o.jsx("img",{src:t,alt:"",referrerPolicy:"no-referrer",className:n,style:m}),e[1]=n,e[2]=t,e[3]=p):p=e[3],p}let s;e[4]===Symbol.for("react.memo_cache_sentinel")?(s={display:"flex",alignItems:"center",justifyContent:"center",background:"#e5e7eb",color:"#9ca3af"},e[4]=s):s=e[4];let i;e[5]!==r?(i=o.jsx(ye,{size:r}),e[5]=r,e[6]=i):i=e[6];let a;return e[7]!==n||e[8]!==i?(a=o.jsx("div",{className:n,style:s,children:i}),e[7]=n,e[8]=i,e[9]=a):a=e[9],a}function Ie(d){const e=T.c(33),{seo:t,host:n,path:v,t:r}=d;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={background:"#fff",border:"1px solid #dadce0"},e[0]=s):s=e[0];let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i={background:"#f1f3f4"},e[1]=i):i=e[1];let a;e[2]!==t.favicon?(a=o.jsx("div",{className:"flex size-6 shrink-0 items-center justify-center overflow-hidden rounded-full",style:i,children:t.favicon?o.jsx("img",{src:t.favicon,alt:"",className:"size-full object-cover"}):o.jsx(ye,{size:12,color:"#9aa0a6"})}),e[2]=t.favicon,e[3]=a):a=e[3];let m;e[4]===Symbol.for("react.memo_cache_sentinel")?(m={color:"#202124"},e[4]=m):m=e[4];let p;e[5]!==n?(p=o.jsx("div",{className:"truncate text-[13px] leading-tight",style:m,children:n}),e[5]=n,e[6]=p):p=e[6];let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f={color:"#4d5156"},e[7]=f):f=e[7];let l;e[8]!==n||e[9]!==v?(l=o.jsxs("div",{className:"truncate text-[12px] leading-tight",style:f,children:[n,v]}),e[8]=n,e[9]=v,e[10]=l):l=e[10];let c;e[11]!==p||e[12]!==l?(c=o.jsxs("div",{className:"min-w-0",children:[p,l]}),e[11]=p,e[12]=l,e[13]=c):c=e[13];let h;e[14]!==a||e[15]!==c?(h=o.jsxs("div",{className:"flex items-center gap-2",children:[a,c]}),e[14]=a,e[15]=c,e[16]=h):h=e[16];let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x={color:"#1a0dab"},e[17]=x):x=e[17];let y;e[18]!==t.title||e[19]!==r?(y=t.title??r("sectionsEditor.seoPreview.fallbackTitle"),e[18]=t.title,e[19]=r,e[20]=y):y=e[20];let u;e[21]!==y?(u=o.jsx("div",{className:"mt-1.5 truncate text-[18px] leading-snug",style:x,children:y}),e[21]=y,e[22]=u):u=e[22];let S;e[23]===Symbol.for("react.memo_cache_sentinel")?(S={color:"#4d5156"},e[23]=S):S=e[23];let g;e[24]!==t.description||e[25]!==r?(g=t.description??r("sectionsEditor.seoPreview.fallbackDescription"),e[24]=t.description,e[25]=r,e[26]=g):g=e[26];let b;e[27]!==g?(b=o.jsx("div",{className:"mt-0.5 line-clamp-2 text-[13px] leading-snug",style:S,children:g}),e[27]=g,e[28]=b):b=e[28];let j;return e[29]!==u||e[30]!==b||e[31]!==h?(j=o.jsxs("div",{className:"rounded-lg p-3 text-left",style:s,children:[h,u,b]}),e[29]=u,e[30]=b,e[31]=h,e[32]=j):j=e[32],j}function Le(d){const e=T.c(26),{seo:t,host:n,t:v}=d;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={background:"#fff",border:"1px solid #e2e8f0"},e[0]=r):r=e[0];let s;e[1]!==t.image?(s=o.jsx(de,{src:t.image,className:"h-40 w-full"}),e[1]=t.image,e[2]=s):s=e[2];let i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i={borderTop:"1px solid #e2e8f0"},e[3]=i):i=e[3];let a;e[4]===Symbol.for("react.memo_cache_sentinel")?(a={color:"#8a9099"},e[4]=a):a=e[4];let m;e[5]!==n?(m=o.jsx("div",{className:"truncate text-[11px]",style:a,children:n}),e[5]=n,e[6]=m):m=e[6];let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p={color:"#1c2024"},e[7]=p):p=e[7];let f;e[8]!==t.title||e[9]!==v?(f=t.title??v("sectionsEditor.seoPreview.fallbackTitle"),e[8]=t.title,e[9]=v,e[10]=f):f=e[10];let l;e[11]!==f?(l=o.jsx("div",{className:"line-clamp-1 text-[14px] font-semibold",style:p,children:f}),e[11]=f,e[12]=l):l=e[12];let c;e[13]===Symbol.for("react.memo_cache_sentinel")?(c={color:"#60666c"},e[13]=c):c=e[13];let h;e[14]!==t.description||e[15]!==v?(h=t.description??v("sectionsEditor.seoPreview.fallbackDescription"),e[14]=t.description,e[15]=v,e[16]=h):h=e[16];let x;e[17]!==h?(x=o.jsx("div",{className:"line-clamp-2 text-[12px]",style:c,children:h}),e[17]=h,e[18]=x):x=e[18];let y;e[19]!==x||e[20]!==m||e[21]!==l?(y=o.jsxs("div",{className:"px-3 py-2",style:i,children:[m,l,x]}),e[19]=x,e[20]=m,e[21]=l,e[22]=y):y=e[22];let u;return e[23]!==y||e[24]!==s?(u=o.jsxs("div",{className:"overflow-hidden rounded-lg text-left",style:r,children:[s,y]}),e[23]=y,e[24]=s,e[25]=u):u=e[25],u}function Be(d){const e=T.c(36),{seo:t,host:n,accent:v,t:r}=d;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={background:"#f0f2f5"},e[0]=s):s=e[0];let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i={color:"#3b4045"},e[1]=i):i=e[1];let a;e[2]!==r?(a=r("sectionsEditor.seoPreview.chatCardHint"),e[2]=r,e[3]=a):a=e[3];let m;e[4]!==a?(m=o.jsx("p",{className:"px-1 pb-1.5 text-[12px]",style:i,children:a}),e[4]=a,e[5]=m):m=e[5];const p=`3px solid ${v}`;let f;e[6]!==p?(f={background:"#fff",borderLeft:p},e[6]=p,e[7]=f):f=e[7];let l;e[8]!==t.image?(l=o.jsx(de,{src:t.image,className:"h-28 w-full",iconSize:18}),e[8]=t.image,e[9]=l):l=e[9];let c;e[10]===Symbol.for("react.memo_cache_sentinel")?(c={color:"#1c2024"},e[10]=c):c=e[10];let h;e[11]!==t.title||e[12]!==r?(h=t.title??r("sectionsEditor.seoPreview.fallbackTitle"),e[11]=t.title,e[12]=r,e[13]=h):h=e[13];let x;e[14]!==h?(x=o.jsx("div",{className:"line-clamp-1 text-[12px] font-semibold",style:c,children:h}),e[14]=h,e[15]=x):x=e[15];let y;e[16]===Symbol.for("react.memo_cache_sentinel")?(y={color:"#60666c"},e[16]=y):y=e[16];let u;e[17]!==t.description||e[18]!==r?(u=t.description??r("sectionsEditor.seoPreview.fallbackDescription"),e[17]=t.description,e[18]=r,e[19]=u):u=e[19];let S;e[20]!==u?(S=o.jsx("div",{className:"line-clamp-2 text-[11px]",style:y,children:u}),e[20]=u,e[21]=S):S=e[21];let g;e[22]===Symbol.for("react.memo_cache_sentinel")?(g={color:"#8a9099"},e[22]=g):g=e[22];let b;e[23]!==n?(b=o.jsx("div",{className:"mt-0.5 text-[10px]",style:g,children:n}),e[23]=n,e[24]=b):b=e[24];let j;e[25]!==x||e[26]!==S||e[27]!==b?(j=o.jsxs("div",{className:"px-2.5 py-1.5",children:[x,S,b]}),e[25]=x,e[26]=S,e[27]=b,e[28]=j):j=e[28];let k;e[29]!==j||e[30]!==f||e[31]!==l?(k=o.jsxs("div",{className:"overflow-hidden rounded-md",style:f,children:[l,j]}),e[29]=j,e[30]=f,e[31]=l,e[32]=k):k=e[32];let N;return e[33]!==k||e[34]!==m?(N=o.jsxs("div",{className:"rounded-lg p-2 text-left",style:s,children:[m,k]}),e[33]=k,e[34]=m,e[35]=N):N=e[35],N}function Oe(d){const e=T.c(39),{seo:t,host:n,accent:v,dark:r,t:s}=d,i=r?"#2b2d31":"#fff",a=r?"#00a8fc":"#1264a3",m=r?"#dbdee1":"#3b4045",p=r?"#949ba4":"#8a9099",f=r?"none":"1px solid #e2e8f0";let l;e[0]!==i||e[1]!==f?(l={background:i,border:f},e[0]=i,e[1]=f,e[2]=l):l=e[2];const c=`3px solid ${v}`;let h;e[3]!==c?(h={borderLeft:c,borderRadius:2},e[3]=c,e[4]=h):h=e[4];let x;e[5]!==p?(x={color:p},e[5]=p,e[6]=x):x=e[6];let y;e[7]!==n||e[8]!==x?(y=o.jsx("div",{className:"text-[10px]",style:x,children:n}),e[7]=n,e[8]=x,e[9]=y):y=e[9];let u;e[10]!==a?(u={color:a},e[10]=a,e[11]=u):u=e[11];let S;e[12]!==t.title||e[13]!==s?(S=t.title??s("sectionsEditor.seoPreview.fallbackTitle"),e[12]=t.title,e[13]=s,e[14]=S):S=e[14];let g;e[15]!==u||e[16]!==S?(g=o.jsx("div",{className:"line-clamp-1 text-[13px] font-semibold",style:u,children:S}),e[15]=u,e[16]=S,e[17]=g):g=e[17];let b;e[18]!==m?(b={color:m},e[18]=m,e[19]=b):b=e[19];let j;e[20]!==t.description||e[21]!==s?(j=t.description??s("sectionsEditor.seoPreview.fallbackDescription"),e[20]=t.description,e[21]=s,e[22]=j):j=e[22];let k;e[23]!==b||e[24]!==j?(k=o.jsx("div",{className:"line-clamp-2 text-[12px]",style:b,children:j}),e[23]=b,e[24]=j,e[25]=k):k=e[25];let N;e[26]!==k||e[27]!==y||e[28]!==g?(N=o.jsxs("div",{className:"min-w-0 flex-1",children:[y,g,k]}),e[26]=k,e[27]=y,e[28]=g,e[29]=N):N=e[29];let w;e[30]!==t.image?(w=o.jsx(de,{src:t.image,className:"size-14 shrink-0 rounded",iconSize:16}),e[30]=t.image,e[31]=w):w=e[31];let _;e[32]!==N||e[33]!==w||e[34]!==h?(_=o.jsxs("div",{className:"flex gap-2.5 pl-2.5",style:h,children:[N,w]}),e[32]=N,e[33]=w,e[34]=h,e[35]=_):_=e[35];let P;return e[36]!==_||e[37]!==l?(P=o.jsx("div",{className:"rounded-lg p-2.5 text-left",style:l,children:_}),e[36]=_,e[37]=l,e[38]=P):P=e[38],P}function Ue(d){const e=T.c(21),{platform:t,seo:n,host:v,path:r,t:s}=d;let i;e[0]!==v||e[1]!==r||e[2]!==t.color||e[3]!==t.id||e[4]!==t.layout||e[5]!==n||e[6]!==s?(i=t.layout==="search"?o.jsx(Ie,{seo:n,host:v,path:r,t:s}):t.layout==="card"?o.jsx(Le,{seo:n,host:v,path:r,t:s}):t.layout==="chat"?o.jsx(Be,{seo:n,host:v,path:r,accent:t.color,t:s}):o.jsx(Oe,{seo:n,host:v,path:r,accent:t.color,dark:t.id==="discord",t:s}),e[0]=v,e[1]=r,e[2]=t.color,e[3]=t.id,e[4]=t.layout,e[5]=n,e[6]=s,e[7]=i):i=e[7];const a=i;let m;e[8]!==t.color?(m=o.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{background:t.color}}),e[8]=t.color,e[9]=m):m=e[9];let p;e[10]!==t.labelKey||e[11]!==s?(p=s(t.labelKey),e[10]=t.labelKey,e[11]=s,e[12]=p):p=e[12];let f;e[13]!==p?(f=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:p}),e[13]=p,e[14]=f):f=e[14];let l;e[15]!==m||e[16]!==f?(l=o.jsxs("div",{className:"mb-1.5 flex items-center gap-1.5",children:[m,f]}),e[15]=m,e[16]=f,e[17]=l):l=e[17];let c;return e[18]!==a||e[19]!==l?(c=o.jsxs("div",{children:[l,a]}),e[18]=a,e[19]=l,e[20]=c):c=e[20],c}function Ae(d){const e=T.c(18),{seo:t,url:n,path:v}=d,r=v===void 0?"/":v,s=ve();let i,a,m;if(e[0]!==t||e[1]!==n){const u=ze(t);i=u,a=he(u.image,n),m=he(u.favicon,n),e[0]=t,e[1]=n,e[2]=i,e[3]=a,e[4]=m}else i=e[2],a=e[3],m=e[4];let p;e[5]!==i||e[6]!==a||e[7]!==m?(p={...i,image:a,favicon:m},e[5]=i,e[6]=a,e[7]=m,e[8]=p):p=e[8];const f=p;let l;e[9]!==n?(l=De(n),e[9]=n,e[10]=l):l=e[10];const c=l,h=r==="/"?"":r;let x;e[11]!==h||e[12]!==c||e[13]!==s||e[14]!==f?(x=$e.map(u=>o.jsx(Ue,{platform:u,seo:f,host:c,path:h,t:s},u.id)),e[11]=h,e[12]=c,e[13]=s,e[14]=f,e[15]=x):x=e[15];let y;return e[16]!==x?(y=o.jsx("div",{className:"grid grid-cols-1 gap-4 @2xl:grid-cols-2",children:x}),e[16]=x,e[17]=y):y=e[17],y}function $i(d){const e=T.c(70),{orgSlug:t,virtualMcpId:n,branch:v,decofile:r,meta:s,target:i,previewBaseUrl:a,onSaved:m,onEditDefaultSeo:p,onBack:f}=d,l=ve(),c=Ne(r,i,s),h=c?.seoData,x=i.kind==="site"?"site":i.pageKey,[y,u]=ee.useState(x),[S,g]=ee.useState(null),[b,j]=ee.useState(0),[k,N]=ee.useState(void 0);y!==x&&(u(x),g(null),N(void 0),j(Ge));const{persistSeo:w,persistRawSeo:_,flush:P,isPending:te}=we({orgSlug:t,virtualMcpId:n,branch:v,target:i,resolved:c,onSaved:m}),M=i.kind==="page",ge=M?c?.rawSeoData:void 0,U=k!==void 0?k:ge,be=M?_e(U)??void 0:void 0,E=S??be??h??{},F=c?Ee(E,c):null,K=F&&(!M||Pe(U))?Ke(F,s):null;let G;e[0]!==s?(G=Te(s),e[0]=s,e[1]=G):G=e[1];const oe=G;let R,H;e[2]!==r||e[3]!==E||e[4]!==s||e[5]!==i.kind?(R=i.kind==="page"?Fe(r,s)?.seoData??{}:{},H=i.kind==="page"?Ve(R,E):E,e[2]=r,e[3]=E,e[4]=s,e[5]=i.kind,e[6]=R,e[7]=H):(R=e[6],H=e[7]);const ie=H;let V;e[8]!==w||e[9]!==c||e[10]!==g?(V=C=>{if(!c)return;const pe=C;g(pe),w(pe)},e[8]=w,e[9]=c,e[10]=g,e[11]=V):V=e[11];const se=V;let W;e[12]!==g?(W=()=>g(null),e[12]=g,e[13]=W):W=e[13];const le=W;let q;e[14]!==j?(q=()=>j(Me),e[14]=j,e[15]=q):q=e[15];const re=q;let J;e[16]!==P||e[17]!==f?(J=()=>{P(),f?.()},e[16]=P,e[17]=f,e[18]=J):J=e[18];const ce=J,z=i.kind==="page"?i.path:"/";let Q;e[19]!==z||e[20]!==a||e[21]!==i.kind?(Q=i.kind==="page"&&a?He(z,a):a??null,e[19]=z,e[20]=a,e[21]=i.kind,e[22]=Q):Q=e[22];const ne=Q;let X;e[23]!==c||e[24]!==l||e[25]!==i.kind?(X=i.kind==="site"?l("sectionsEditor.seoEditor.noSiteSeoBlock"):l(c?"sectionsEditor.seoEditor.noSeoSchema":"sectionsEditor.seoEditor.couldNotLoadSeo"),e[23]=c,e[24]=l,e[25]=i.kind,e[26]=X):X=e[26];const ae=X,Y=M&&c,me=i.kind==="site"&&c&&K;let D;e[27]!==ce||e[28]!==l||e[29]!==i.kind||e[30]!==i.pageName?(D=i.kind==="page"?o.jsxs("nav",{className:"flex min-w-0 items-center gap-1 text-sm",children:[o.jsx("button",{type:"button",onClick:ce,title:i.pageName,className:"min-w-0 truncate rounded-md px-1 py-0.5 text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground",children:i.pageName}),o.jsx(ke,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("span",{className:"px-1 py-0.5 font-medium text-foreground",children:"SEO"})]}):o.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[o.jsx(fe,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"text-sm font-medium",children:l("sectionsEditor.seoEditor.defaultSeoLabel")}),o.jsxs("span",{className:"hidden truncate text-xs text-muted-foreground sm:inline",children:["· ",l("sectionsEditor.seoEditor.appliedToEveryPage")]})]}),e[27]=ce,e[28]=l,e[29]=i.kind,e[30]=i.pageName,e[31]=D):D=e[31];let $;e[32]!==te?($=te&&o.jsx(Se,{size:14,className:"animate-spin text-muted-foreground"}),e[32]=te,e[33]=$):$=e[33];let I;e[34]!==p||e[35]!==l||e[36]!==i.kind?(I=i.kind==="page"&&p&&o.jsxs(je,{type:"button",variant:"outline",size:"sm",onClick:p,children:[o.jsx(fe,{size:14}),l("sectionsEditor.seoEditor.editDefaultSeoButton")]}),e[34]=p,e[35]=l,e[36]=i.kind,e[37]=I):I=e[37];let L;e[38]!==$||e[39]!==I?(L=o.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-2",children:[$,I]}),e[38]=$,e[39]=I,e[40]=L):L=e[40];let B;e[41]!==L||e[42]!==D?(B=o.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-2 border-b px-4",children:[D,L]}),e[41]=L,e[42]=D,e[43]=B):B=e[43];let O;e[44]!==F||e[45]!==re||e[46]!==le||e[47]!==oe||e[48]!==U||e[49]!==E||e[50]!==ae||e[51]!==b||e[52]!==se||e[53]!==z||e[54]!==_||e[55]!==w||e[56]!==ie||e[57]!==ne||e[58]!==c||e[59]!==K||e[60]!==g||e[61]!==N||e[62]!==Y||e[63]!==me||e[64]!==R||e[65]!==l?(O=!c||!Y&&!me?o.jsx("div",{className:"flex flex-1 items-center justify-center px-6 text-center text-sm text-muted-foreground",children:ae}):o.jsxs("div",{className:"flex min-h-0 flex-1",children:[o.jsx(xe,{className:"w-full max-w-md shrink-0 border-r [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"px-5 py-4",children:Y?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"mb-3 text-xs text-muted-foreground",children:l("sectionsEditor.seoEditor.emptyFieldsHint")}),o.jsx(Re,{rawSeo:U,innerSeo:E,defaultResolveType:oe,seoSchema:K,activeResolveType:F,seoTypeOptions:c.seoTypeOptions,formResetKey:b,siteDefaultSeo:R,onPersistRaw:C=>{N(C),_(C)},onInnerChange:C=>{g(C),w(C)},onClearForm:le,onBumpFormKey:re})]}):K&&F&&o.jsx(Ce,{schema:K,resolveType:F,value:E,formResetKey:b,onChange:se})})}),o.jsx(xe,{className:"min-w-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"@container px-5 py-4",children:o.jsx(Ae,{seo:ie,url:ne,path:z})})})]}),e[44]=F,e[45]=re,e[46]=le,e[47]=oe,e[48]=U,e[49]=E,e[50]=ae,e[51]=b,e[52]=se,e[53]=z,e[54]=_,e[55]=w,e[56]=ie,e[57]=ne,e[58]=c,e[59]=K,e[60]=g,e[61]=N,e[62]=Y,e[63]=me,e[64]=R,e[65]=l,e[66]=O):O=e[66];let Z;return e[67]!==B||e[68]!==O?(Z=o.jsxs("div",{className:"flex h-full w-full flex-col",children:[B,O]}),e[67]=B,e[68]=O,e[69]=Z):Z=e[69],Z}function Me(d){return d+1}function Ge(d){return d+1}function He(d,e){try{return new URL(d,e).href}catch{return e}}function Ve(d,e){const t=e.__resolveType,n=d.__resolveType;if(typeof t=="string"&&typeof n=="string"&&t!==n)return{...e};const v={...d};for(const[r,s]of Object.entries(e))r!=="__resolveType"&&s!=null&&(typeof s=="string"&&s.trim()===""||(v[r]=s));return v}export{$i as SeoEditor};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as b,m as g,j as o,cS as P,cT as H,H as R,cU as A,cV as V,cW as W,cX as q,r as O,B as G,be as L,bC as F}from"./index-Cuug8jd7.js";import{i as U}from"./LayoutLeft-DwCyodVh.js";import{u as X}from"./use-mobile-DFoMyuD6.js";import{i as J}from"./X-BfG7pUZd.js";import{b as z,T as B,a as D,c as k}from"./tooltip-D09V-b-D.js";function K(i){const e=b.c(4);let t;e[0]!==i?({...t}=i,e[0]=i,e[1]=t):t=e[1];let s;return e[2]!==t?(s=o.jsx(H,{"data-slot":"sheet",...t}),e[2]=t,e[3]=s):s=e[3],s}function Q(i){const e=b.c(4);let t;e[0]!==i?({...t}=i,e[0]=i,e[1]=t):t=e[1];let s;return e[2]!==t?(s=o.jsx(V,{"data-slot":"sheet-portal",...t}),e[2]=t,e[3]=s):s=e[3],s}function Y(i){const e=b.c(8);let t,s;e[0]!==i?({className:t,...s}=i,e[0]=i,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=g("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),e[3]=t,e[4]=a):a=e[4];let l;return e[5]!==s||e[6]!==a?(l=o.jsx(q,{"data-slot":"sheet-overlay",className:a,...s}),e[5]=s,e[6]=a,e[7]=l):l=e[7],l}function Z(i){const e=b.c(20);let t,s,a,l,d;e[0]!==i?({className:s,children:t,side:l,hideCloseButton:d,...a}=i,e[0]=i,e[1]=t,e[2]=s,e[3]=a,e[4]=l,e[5]=d):(t=e[1],s=e[2],a=e[3],l=e[4],d=e[5]);const n=l===void 0?"right":l,r=d===void 0?!1:d;let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(Y,{}),e[6]=m):m=e[6];const u=n==="right"&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",h=n==="left"&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",f=n==="top"&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",p=n==="bottom"&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t";let x;e[7]!==s||e[8]!==u||e[9]!==h||e[10]!==f||e[11]!==p?(x=g("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-200 data-[state=open]:duration-200",u,h,f,p,s),e[7]=s,e[8]=u,e[9]=h,e[10]=f,e[11]=p,e[12]=x):x=e[12];let c;e[13]!==r?(c=!r&&o.jsxs(W,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[o.jsx(J,{className:"size-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]}),e[13]=r,e[14]=c):c=e[14];let v;return e[15]!==t||e[16]!==a||e[17]!==x||e[18]!==c?(v=o.jsxs(Q,{children:[m,o.jsxs(R,{"data-slot":"sheet-content",className:x,...a,children:[t,c]})]}),e[15]=t,e[16]=a,e[17]=x,e[18]=c,e[19]=v):v=e[19],v}function ee(i){const e=b.c(8);let t,s;e[0]!==i?({className:t,...s}=i,e[0]=i,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=g("flex flex-col gap-1.5 p-4",t),e[3]=t,e[4]=a):a=e[4];let l;return e[5]!==s||e[6]!==a?(l=o.jsx("div",{"data-slot":"sheet-header",className:a,...s}),e[5]=s,e[6]=a,e[7]=l):l=e[7],l}function te(i){const e=b.c(8);let t,s;e[0]!==i?({className:t,...s}=i,e[0]=i,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=g("text-foreground font-semibold",t),e[3]=t,e[4]=a):a=e[4];let l;return e[5]!==s||e[6]!==a?(l=o.jsx(P,{"data-slot":"sheet-title",className:a,...s}),e[5]=s,e[6]=a,e[7]=l):l=e[7],l}function se(i){const e=b.c(8);let t,s;e[0]!==i?({className:t,...s}=i,e[0]=i,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=g("text-muted-foreground text-sm",t),e[3]=t,e[4]=a):a=e[4];let l;return e[5]!==s||e[6]!==a?(l=o.jsx(A,{"data-slot":"sheet-description",className:a,...s}),e[5]=s,e[6]=a,e[7]=l):l=e[7],l}const ae="15rem",le="18rem",ie="4.5rem",E=O.createContext(null);function I(){const i=O.useContext(E);if(!i)throw new Error("useSidebar must be used within a SidebarProvider.");return i}function be(i){const e=b.c(19),{children:t,defaultOpen:s,open:a,onOpenChange:l}=i,d=s===void 0?!1:s,n=X(),[r,m]=O.useState(d),[u,h]=O.useState(!1),f=a!==void 0,p=f?a:r;let x;e[0]!==f||e[1]!==l?(x=$=>{f||m($),l?.($)},e[0]=f,e[1]=l,e[2]=x):x=e[2];const c=x;let v;e[3]!==n||e[4]!==p||e[5]!==c?(v=()=>{n?h(oe):c(!p)},e[3]=n,e[4]=p,e[5]=c,e[6]=v):v=e[6];const y=v,w=p?"expanded":"collapsed";let j;e[7]!==n||e[8]!==p||e[9]!==u||e[10]!==c||e[11]!==w||e[12]!==y?(j={state:w,open:p,setOpen:c,isMobile:n,openMobile:u,setOpenMobile:h,toggleSidebar:y},e[7]=n,e[8]=p,e[9]=u,e[10]=c,e[11]=w,e[12]=y,e[13]=j):j=e[13];const S=j;let N;e[14]!==t?(N=o.jsx(z,{delayDuration:0,children:t}),e[14]=t,e[15]=N):N=e[15];let C;return e[16]!==S||e[17]!==N?(C=o.jsx(E.Provider,{value:S,children:N}),e[16]=S,e[17]=N,e[18]=C):C=e[18],C}function oe(i){return!i}function me(i){const e=b.c(14);let t,s,a,l;e[0]!==i?({className:s,style:l,children:t,...a}=i,e[0]=i,e[1]=t,e[2]=s,e[3]=a,e[4]=l):(t=e[1],s=e[2],a=e[3],l=e[4]);let d;e[5]!==l?(d={"--sidebar-width":ae,"--sidebar-width-icon":ie,...l},e[5]=l,e[6]=d):d=e[6];const n=d;let r;e[7]!==s?(r=g("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex h-full w-full",s),e[7]=s,e[8]=r):r=e[8];let m;return e[9]!==t||e[10]!==a||e[11]!==n||e[12]!==r?(m=o.jsx("div",{"data-slot":"sidebar-wrapper",style:n,className:r,...a,children:t}),e[9]=t,e[10]=a,e[11]=n,e[12]=r,e[13]=m):m=e[13],m}function he(i){const e=b.c(36);let t,s,a,l,d;e[0]!==i?({side:l,variant:d,className:s,children:t,...a}=i,e[0]=i,e[1]=t,e[2]=s,e[3]=a,e[4]=l,e[5]=d):(t=e[1],s=e[2],a=e[3],l=e[4],d=e[5]);const n=l===void 0?"left":l,r=d===void 0?"sidebar":d,{isMobile:m,state:u,openMobile:h,setOpenMobile:f}=I();if(m){let C;e[6]===Symbol.for("react.memo_cache_sentinel")?(C={"--sidebar-width":le},e[6]=C):C=e[6];let $;e[7]===Symbol.for("react.memo_cache_sentinel")?($=o.jsxs(ee,{className:"sr-only",children:[o.jsx(te,{children:"Sidebar"}),o.jsx(se,{children:"Displays the mobile sidebar."})]}),e[7]=$):$=e[7];let _;e[8]!==t?(_=o.jsx("div",{className:"flex h-full w-full flex-col",children:t}),e[8]=t,e[9]=_):_=e[9];let T;e[10]!==n||e[11]!==_?(T=o.jsxs(Z,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",style:C,side:n,children:[$,_]}),e[10]=n,e[11]=_,e[12]=T):T=e[12];let M;return e[13]!==h||e[14]!==a||e[15]!==f||e[16]!==T?(M=o.jsx(K,{open:h,onOpenChange:f,...a,children:T}),e[13]=h,e[14]=a,e[15]=f,e[16]=T,e[17]=M):M=e[17],M}const p=u==="expanded",x=p?"w-(--sidebar-width)":"w-(--sidebar-width-icon)";let c;e[18]!==x?(c=g("group/sidebar peer text-sidebar-foreground hidden md:flex flex-col shrink-0 overflow-hidden","transition-[width] duration-150 ease-out motion-reduce:transition-none",x),e[18]=x,e[19]=c):c=e[19];const v=p?void 0:"icon",y=p?"w-(--sidebar-width)":"w-(--sidebar-width-icon)";let w;e[20]!==s||e[21]!==y?(w=g("flex flex-col h-full transition-[width] duration-150 ease-out motion-reduce:transition-none",y,s),e[20]=s,e[21]=y,e[22]=w):w=e[22];let j;e[23]!==t?(j=o.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"bg-sidebar flex h-full w-full flex-col",children:t}),e[23]=t,e[24]=j):j=e[24];let S;e[25]!==a||e[26]!==w||e[27]!==j?(S=o.jsx("div",{"data-slot":"sidebar-container",className:w,...a,children:j}),e[25]=a,e[26]=w,e[27]=j,e[28]=S):S=e[28];let N;return e[29]!==n||e[30]!==u||e[31]!==c||e[32]!==v||e[33]!==S||e[34]!==r?(N=o.jsx("div",{className:c,"data-state":u,"data-collapsible":v,"data-variant":r,"data-side":n,"data-slot":"sidebar",children:S}),e[29]=n,e[30]=u,e[31]=c,e[32]=v,e[33]=S,e[34]=r,e[35]=N):N=e[35],N}function xe(i){const e=b.c(18);let t,s,a;e[0]!==i?({className:t,onClick:s,...a}=i,e[0]=i,e[1]=t,e[2]=s,e[3]=a):(t=e[1],s=e[2],a=e[3]);const{toggleSidebar:l}=I();let d;e[4]!==t?(d=g("size-7",t),e[4]=t,e[5]=d):d=e[5];let n;e[6]!==s||e[7]!==l?(n=p=>{s?.(p),l()},e[6]=s,e[7]=l,e[8]=n):n=e[8];let r,m;e[9]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(U,{}),m=o.jsx("span",{className:"sr-only",children:"Toggle Sidebar"}),e[9]=r,e[10]=m):(r=e[9],m=e[10]);let u;e[11]!==a||e[12]!==d||e[13]!==n?(u=o.jsx(B,{asChild:!0,children:o.jsxs(G,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon",className:d,onClick:n,...a,children:[r,m]})}),e[11]=a,e[12]=d,e[13]=n,e[14]=u):u=e[14];let h;e[15]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsxs(D,{side:"bottom",className:"flex items-center gap-1.5",children:["Collapse sidebar",o.jsx("span",{className:"flex items-center gap-0.5",children:["⌘","B"].map(ne)})]}),e[15]=h):h=e[15];let f;return e[16]!==u?(f=o.jsx(z,{delayDuration:300,children:o.jsxs(k,{children:[u,h]})}),e[16]=u,e[17]=f):f=e[17],f}function ne(i){return o.jsx("kbd",{className:"inline-flex items-center justify-center min-w-5 h-5 px-1 rounded-sm border border-white/20 bg-white/10 text-white/70 text-xs font-mono",children:i},i)}function ge(i){const e=b.c(8);let t,s;e[0]!==i?({className:t,...s}=i,e[0]=i,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=g("bg-background relative flex w-full flex-1 flex-col min-w-0","md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",t),e[3]=t,e[4]=a):a=e[4];let l;return e[5]!==s||e[6]!==a?(l=o.jsx("main",{"data-slot":"sidebar-inset",className:a,...s}),e[5]=s,e[6]=a,e[7]=l):l=e[7],l}function ve(i){const e=b.c(8);let t,s;e[0]!==i?({className:t,...s}=i,e[0]=i,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=g("flex flex-col gap-2 p-2",t),e[3]=t,e[4]=a):a=e[4];let l;return e[5]!==s||e[6]!==a?(l=o.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:a,...s}),e[5]=s,e[6]=a,e[7]=l):l=e[7],l}function je(i){const e=b.c(8);let t,s;e[0]!==i?({className:t,...s}=i,e[0]=i,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=g("flex flex-col gap-2 p-2",t),e[3]=t,e[4]=a):a=e[4];let l;return e[5]!==s||e[6]!==a?(l=o.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:a,...s}),e[5]=s,e[6]=a,e[7]=l):l=e[7],l}function we(i){const e=b.c(8);let t,s;e[0]!==i?({className:t,...s}=i,e[0]=i,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=g("h-4 m-0! w-full",t),e[3]=t,e[4]=a):a=e[4];let l;return e[5]!==s||e[6]!==a?(l=o.jsx("div",{"data-sidebar":"separator",className:a,...s}),e[5]=s,e[6]=a,e[7]=l):l=e[7],l}function Ne(i){const e=b.c(8);let t,s;e[0]!==i?({className:t,...s}=i,e[0]=i,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=g("flex min-h-0 flex-1 flex-col gap-2",t),e[3]=t,e[4]=a):a=e[4];let l;return e[5]!==s||e[6]!==a?(l=o.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:a,...s}),e[5]=s,e[6]=a,e[7]=l):l=e[7],l}function Se(i){const e=b.c(8);let t,s;e[0]!==i?({className:t,...s}=i,e[0]=i,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=g("relative flex w-full min-w-0 flex-col px-2 py-2 md:py-0",t),e[3]=t,e[4]=a):a=e[4];let l;return e[5]!==s||e[6]!==a?(l=o.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:a,...s}),e[5]=s,e[6]=a,e[7]=l):l=e[7],l}function ye(i){const e=b.c(8);let t,s;e[0]!==i?({className:t,...s}=i,e[0]=i,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=g("w-full text-sm overflow-visible",t),e[3]=t,e[4]=a):a=e[4];let l;return e[5]!==s||e[6]!==a?(l=o.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:a,...s}),e[5]=s,e[6]=a,e[7]=l):l=e[7],l}function Ce(i){const e=b.c(8);let t,s;e[0]!==i?({className:t,...s}=i,e[0]=i,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=g("flex w-full min-w-0 list-none flex-col gap-1 group-data-[state=collapsed]/sidebar:items-center",t),e[3]=t,e[4]=a):a=e[4];let l;return e[5]!==s||e[6]!==a?(l=o.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:a,...s}),e[5]=s,e[6]=a,e[7]=l):l=e[7],l}function $e(i){const e=b.c(8);let t,s;e[0]!==i?({className:t,...s}=i,e[0]=i,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=g("group/menu-item relative w-full list-none",t),e[3]=t,e[4]=a):a=e[4];let l;return e[5]!==s||e[6]!==a?(l=o.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:a,...s}),e[5]=s,e[6]=a,e[7]=l):l=e[7],l}const re=F("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-lg py-0 pr-0.5 pl-1.5 text-left text-sm outline-0 outline-sidebar-ring transition-[width,height,padding] duration-150 ease-out motion-reduce:transition-none focus-visible:outline-2 focus-visible:-outline-offset-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground [&>span:last-child]:truncate group-data-[state=collapsed]/sidebar:[&>span:last-child]:hidden [&>svg]:size-4 [&>svg]:shrink-0 [&_svg]:opacity-60 hover:[&_svg]:opacity-100",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background ring-1 ring-sidebar-border hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:ring-sidebar-accent"},size:{default:"group-data-[state=expanded]/sidebar:h-8 group-data-[state=expanded]/sidebar:px-2 group-data-[state=collapsed]/sidebar:w-full! group-data-[state=collapsed]/sidebar:aspect-square! group-data-[state=collapsed]/sidebar:max-w-[calc(var(--sidebar-width-icon)-1rem)]! group-data-[state=collapsed]/sidebar:h-auto! group-data-[state=collapsed]/sidebar:p-0! group-data-[state=collapsed]/sidebar:mx-auto group-data-[state=collapsed]/sidebar:justify-center text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm p-0!"}},defaultVariants:{variant:"default",size:"default"}});function _e(i){const e=b.c(28);let t,s,a,l,d,n,r;e[0]!==i?({asChild:a,isActive:l,variant:d,size:n,tooltip:r,className:t,...s}=i,e[0]=i,e[1]=t,e[2]=s,e[3]=a,e[4]=l,e[5]=d,e[6]=n,e[7]=r):(t=e[1],s=e[2],a=e[3],l=e[4],d=e[5],n=e[6],r=e[7]);const m=a===void 0?!1:a,u=l===void 0?!1:l,h=d===void 0?"default":d,f=n===void 0?"default":n,p=m?L:"button",{isMobile:x}=I();let c;e[8]!==t||e[9]!==f||e[10]!==h?(c=g(re({variant:h,size:f}),t),e[8]=t,e[9]=f,e[10]=h,e[11]=c):c=e[11];let v;e[12]!==p||e[13]!==u||e[14]!==s||e[15]!==f||e[16]!==c?(v=o.jsx(p,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":f,"data-active":u,className:c,...s}),e[12]=p,e[13]=u,e[14]=s,e[15]=f,e[16]=c,e[17]=v):v=e[17];const y=v;if(!r)return y;if(typeof r=="string"){let N;e[18]!==r?(N={children:r},e[18]=r,e[19]=N):N=e[19],r=N}let w;e[20]!==y?(w=o.jsx(B,{asChild:!0,children:y}),e[20]=y,e[21]=w):w=e[21];let j;e[22]!==x||e[23]!==r?(j=o.jsx(D,{side:"right",align:"center",hidden:x,...r}),e[22]=x,e[23]=r,e[24]=j):j=e[24];let S;return e[25]!==w||e[26]!==j?(S=o.jsxs(k,{children:[w,j]}),e[25]=w,e[26]=j,e[27]=S):S=e[27],S}export{Se as S,ye as a,Ce as b,_e as c,$e as d,we as e,ve as f,Ne as g,he as h,je as i,ge as j,me as k,be as l,te as m,se as n,ee as o,Z as p,K as q,xe as r,I as u};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/registry-layout-CdR4k8dc.js","assets/index-Cuug8jd7.js","assets/index-CUIiLem4.css","assets/Tool02-DoDg-nMh.js","assets/CheckCircle-CBXbZPqe.js","assets/Settings02-BQ_6W_JU.js","assets/use-mcp-client-BDN-FEcc.js","assets/auth-B-H82oVn.js","assets/useInfiniteQuery-DD0TdbWx.js","assets/use-infinite-scroll-BOup92L2.js","assets/studio-tools-C08UjHsr.js","assets/badge-CO3kByaZ.js","assets/input-DXhpVfJR.js","assets/dropdown-menu-BrspSm3T.js","assets/Check-BMwhITGN.js","assets/ChevronRight-DcTM74Nx.js","assets/DotsVertical-Bi2Pj2Rx.js","assets/table-CAhOdKdH.js","assets/toggle-group-DY0VwFSy.js","assets/use-view-mode-DRR58QSp.js","assets/use-mobile-DFoMyuD6.js","assets/FilterLines-C-MayH4t.js","assets/SearchMd-BbbEhgez.js","assets/dialog-DQWMOcko.js","assets/X-BfG7pUZd.js","assets/AlertCircle-CzHAhrr6.js","assets/Upload01-BNGUctEI.js","assets/metadata-dUsYcpuu.js","assets/alert-dialog-WfWDyyhH.js","assets/card-CdJSU8vr.js","assets/Trash01-Dv4YTeiI.js","assets/label-BQAPYpl9.js","assets/select-B5znG0Y1.js","assets/tooltip-D09V-b-D.js","assets/ChevronDown-BLutYvIR.js","assets/ChevronUp-CnX0DUPn.js","assets/switch-DYWfZ4oI.js","assets/textarea-9vzfIjDG.js","assets/XCircle-BAGVWBr6.js","assets/checkbox-VRqoAnNP.js","assets/Eye-CNJVROK8.js","assets/LinkExternal01-ZqumszDD.js","assets/use-copy-K8bJ1Pv1.js","assets/Copy01-0FQhJRTl.js","assets/Key01-DA8DOmXm.js","assets/Plus-Ro_Rugpt.js","assets/mcp-oauth-YbTKUbfv.js","assets/Play-CmYL2KsO.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{c as m,d as n,f as c,j as t,k as f,r as l,aF as p}from"./index-Cuug8jd7.js";import{R as u}from"./require-capability-B_1QWSj5.js";import"./use-capability-BZtV5fjq.js";import"./access-gate-D_qQ3O5w.js";import"./capability-load-error-CDL0nVSP.js";const g=l.lazy(()=>p(()=>import("./registry-layout-CdR4k8dc.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47])));function j(){const e=m.c(5),i=n();let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={from:"/shell/$org"},e[0]=s):s=e[0];const{org:o}=c(s);let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("div",{className:"h-full flex items-center justify-center",children:t.jsx(f,{size:20,className:"animate-spin text-muted-foreground"})}),e[1]=r):r=e[1];let a;return e[2]!==i||e[3]!==o?(a=t.jsx(u,{capability:"registry:manage",area:"the registry",children:t.jsx(l.Suspense,{fallback:r,children:t.jsx(g,{onBack:()=>i({to:"/$org/settings/store",params:{org:o}})})})}),e[2]=i,e[3]=o,e[4]=a):a=e[4],a}export{j as default};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import{da as fe,db as pe,dc as me,cf as _e,dd as ge,bU as _,bV as w,de as we,df as Te,dg as ye,dh as $,di as ve,dj as V,dk as ke,dl as M,dm as Se,dn as G,dp as Re,dq as Ce,dr as Ee,ds as W,bx as be,bz as Ie,bu as Ae,ca as re,cm as qe,cs as Me,cq as Pe,cD as Oe,dt as $e,du as Ne,dv as N,dw as He,dx as Ue,cr as De,cn as xe,co as je,cp as Le,bv as Fe,dy as Ve,dz as Ge,dA as ze,ch as Qe,dB as Ke,dC as We,cz as D,dD as Je,bt as j,c as oe,x as ae,K as Q}from"./index-Cuug8jd7.js";import{U as P,a as H,e as J}from"./auth-B-H82oVn.js";const It={SELF:a=>`${a}_self`,REGISTRY:a=>`${a}_registry`,COMMUNITY_REGISTRY:a=>`${a}_community-registry`,DEV_ASSETS:a=>`${a}_dev-assets`,SITE_DIAGNOSTICS:a=>`site-diagnostics_${a}`,COMMERCE_DISCOVERY:a=>`${a}_commerce-discovery`},At="get_my_diagnostic",qt="https://github.com/decocms.png",Ye="self";function R(a){return{is(e){return!e||!e.startsWith(a)?null:e.slice(a.length)||null},get(e){return`${a}${e}`}}}function Be(a){return{id:a.id,organization_id:a.organizationId,title:a.title,description:a.description,icon:a.icon,status:"active",created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:"system",updated_by:void 0,metadata:{instructions:a.instructions??null,...a.ui?{ui:a.ui}:{}},pinned:!1,connections:[]}}const ne=R("decopilot_"),Mt=ne.is,Ze=ne.get,ie=R("dev_"),Pt=ie.get,Ot=ie.is,Xe="https://assets.decocache.com/decocms/fd07a578-6b1c-40f1-bc05-88a3b981695d/f7fc4ffa81aec04e37ae670c3cd4936643a7b269.png",$t="https://api.iconify.design/lucide:shield-check.svg?color=%2316a34a",Nt="https://api.iconify.design/lucide:file-search.svg?color=%236366f1";function Ht(a){return Be({id:Ze(a),organizationId:a,title:"Super Agent",description:"Default agent that aggregates all organization connections",icon:Xe,ui:{layout:{defaultMainView:{type:"overview"},chatDefaultOpen:!0}}})}const et=R("commerce-discovery_"),Ut=et.get,C={AGENT_MANAGER:R("studio-agent-manager_"),AUTOMATION_MANAGER:R("studio-automation-manager_"),CONNECTION_MANAGER:R("studio-connection-manager_"),API_KEY_MANAGER:R("studio-api-key-manager_"),STORE_MANAGER:R("studio-store-manager_"),BRAND_MANAGER:R("studio-brand-manager_"),TASK_MANAGER:R("studio-task-manager_"),USAGE_MANAGER:R("studio-usage-manager_")},Dt={AGENT_MANAGER:C.AGENT_MANAGER.get,AUTOMATION_MANAGER:C.AUTOMATION_MANAGER.get,CONNECTION_MANAGER:C.CONNECTION_MANAGER.get,API_KEY_MANAGER:C.API_KEY_MANAGER.get,STORE_MANAGER:C.STORE_MANAGER.get,BRAND_MANAGER:C.BRAND_MANAGER.get,TASK_MANAGER:C.TASK_MANAGER.get,USAGE_MANAGER:C.USAGE_MANAGER.get};function xt(a){return a?Object.values(C).some(e=>e.is(a)!==null):!1}function x(a){return!!a._zod}function b(a,e){return x(a)?fe(a,e):a.safeParse(e)}function ce(a){if(!a)return;let e;if(x(a)?e=a._zod?.def?.shape:e=a.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function tt(a){if(x(a)){const o=a._zod?.def;if(o){if(o.value!==void 0)return o.value;if(Array.isArray(o.values)&&o.values.length>0)return o.values[0]}}const t=a._def;if(t){if(t.value!==void 0)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}const s=a.value;if(s!==void 0)return s}function I(a){return a==="completed"||a==="failed"||a==="cancelled"}function Y(a){const t=ce(a)?.method;if(!t)throw new Error("Schema is missing a method literal");const s=tt(t);if(typeof s!="string")throw new Error("Schema method literal must be a string");return s}function B(a,e){const t=b(a,e);if(!t.success)throw t.error;return t.data}const st=6e4;class rt{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(pe,t=>{this._oncancel(t)}),this.setNotificationHandler(me,t=>{this._onprogress(t)}),this.setRequestHandler(_e,t=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(ge,async(t,s)=>{const r=await this._taskStore.getTask(t.params.taskId,s.sessionId);if(!r)throw new _(w.InvalidParams,"Failed to retrieve task: Task not found");return{...r}}),this.setRequestHandler(we,async(t,s)=>{const r=async()=>{const o=t.params.taskId;if(this._taskMessageQueue){let i;for(;i=await this._taskMessageQueue.dequeue(o,s.sessionId);){if(i.type==="response"||i.type==="error"){const u=i.message,p=u.id,l=this._requestResolvers.get(p);if(l)if(this._requestResolvers.delete(p),i.type==="response")l(u);else{const d=u,f=new _(d.error.code,d.error.message,d.error.data);l(f)}else{const d=i.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${p}`))}continue}await this._transport?.send(i.message,{relatedRequestId:s.requestId})}}const n=await this._taskStore.getTask(o,s.sessionId);if(!n)throw new _(w.InvalidParams,`Task not found: ${o}`);if(!I(n.status))return await this._waitForTaskUpdate(o,s.signal),await r();if(I(n.status)){const i=await this._taskStore.getTaskResult(o,s.sessionId);return this._clearTaskQueue(o),{...i,_meta:{...i._meta,[M]:{taskId:o}}}}return await r()};return await r()}),this.setRequestHandler(Te,async(t,s)=>{try{const{tasks:r,nextCursor:o}=await this._taskStore.listTasks(t.params?.cursor,s.sessionId);return{tasks:r,nextCursor:o,_meta:{}}}catch(r){throw new _(w.InvalidParams,`Failed to list tasks: ${r instanceof Error?r.message:String(r)}`)}}),this.setRequestHandler(ye,async(t,s)=>{try{const r=await this._taskStore.getTask(t.params.taskId,s.sessionId);if(!r)throw new _(w.InvalidParams,`Task not found: ${t.params.taskId}`);if(I(r.status))throw new _(w.InvalidParams,`Cannot cancel task in terminal status: ${r.status}`);await this._taskStore.updateTaskStatus(t.params.taskId,"cancelled","Client cancelled task execution.",s.sessionId),this._clearTaskQueue(t.params.taskId);const o=await this._taskStore.getTask(t.params.taskId,s.sessionId);if(!o)throw new _(w.InvalidParams,`Task not found after cancellation: ${t.params.taskId}`);return{_meta:{},...o}}catch(r){throw r instanceof _?r:new _(w.InvalidRequest,`Failed to cancel task: ${r instanceof Error?r.message:String(r)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,s,r,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:s,resetTimeoutOnProgress:o,onTimeout:r})}_resetTimeout(e){const t=this._timeoutInfo.get(e);if(!t)return!1;const s=Date.now()-t.startTime;if(t.maxTotalTimeout&&s>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),_.fromError(w.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:s});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){const t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;const t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};const s=this.transport?.onerror;this._transport.onerror=o=>{s?.(o),this._onerror(o)};const r=this._transport?.onmessage;this._transport.onmessage=(o,n)=>{r?.(o,n),$(o)||ve(o)?this._onresponse(o):V(o)?this._onrequest(o,n):ke(o)?this._onnotification(o):this._onerror(new Error(`Unknown message type: ${JSON.stringify(o)}`))},await this._transport.start()}_onclose(){const e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(const s of this._timeoutInfo.values())clearTimeout(s.timeoutId);this._timeoutInfo.clear();for(const s of this._requestHandlerAbortControllers.values())s.abort();this._requestHandlerAbortControllers.clear();const t=_.fromError(w.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(const s of e.values())s(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){const t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;t!==void 0&&Promise.resolve().then(()=>t(e)).catch(s=>this._onerror(new Error(`Uncaught error in notification handler: ${s}`)))}_onrequest(e,t){const s=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,r=this._transport,o=e.params?._meta?.[M]?.taskId;if(s===void 0){const l={jsonrpc:"2.0",id:e.id,error:{code:w.MethodNotFound,message:"Method not found"}};o&&this._taskMessageQueue?this._enqueueTaskMessage(o,{type:"error",message:l,timestamp:Date.now()},r?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):r?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}const n=new AbortController;this._requestHandlerAbortControllers.set(e.id,n);const i=Se(e.params)?e.params.task:void 0,u=this._taskStore?this.requestTaskStore(e,r?.sessionId):void 0,p={signal:n.signal,sessionId:r?.sessionId,_meta:e.params?._meta,sendNotification:async l=>{if(n.signal.aborted)return;const d={relatedRequestId:e.id};o&&(d.relatedTask={taskId:o}),await this.notification(l,d)},sendRequest:async(l,d,f)=>{if(n.signal.aborted)throw new _(w.ConnectionClosed,"Request was cancelled");const m={...f,relatedRequestId:e.id};o&&!m.relatedTask&&(m.relatedTask={taskId:o});const T=m.relatedTask?.taskId??o;return T&&u&&await u.updateTaskStatus(T,"input_required"),await this.request(l,d,m)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:o,taskStore:u,taskRequestedTtl:i?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{i&&this.assertTaskHandlerCapability(e.method)}).then(()=>s(e,p)).then(async l=>{if(n.signal.aborted)return;const d={result:l,jsonrpc:"2.0",id:e.id};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"response",message:d,timestamp:Date.now()},r?.sessionId):await r?.send(d)},async l=>{if(n.signal.aborted)return;const d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:w.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"error",message:d,timestamp:Date.now()},r?.sessionId):await r?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===n&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){const{progressToken:t,...s}=e.params,r=Number(t),o=this._progressHandlers.get(r);if(!o){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}const n=this._responseHandlers.get(r),i=this._timeoutInfo.get(r);if(i&&n&&i.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(u){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),n(u);return}o(s)}_onresponse(e){const t=Number(e.id),s=this._requestResolvers.get(t);if(s){if(this._requestResolvers.delete(t),$(e))s(e);else{const n=new _(e.error.code,e.error.message,e.error.data);s(n)}return}const r=this._responseHandlers.get(t);if(r===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t);let o=!1;if($(e)&&e.result&&typeof e.result=="object"){const n=e.result;if(n.task&&typeof n.task=="object"){const i=n.task;typeof i.taskId=="string"&&(o=!0,this._taskProgressTokens.set(i.taskId,t))}}if(o||this._progressHandlers.delete(t),$(e))r(e);else{const n=_.fromError(e.error.code,e.error.message,e.error.data);r(n)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,s){const{task:r}=s??{};if(!r){try{yield{type:"result",result:await this.request(e,t,s)}}catch(n){yield{type:"error",error:n instanceof _?n:new _(w.InternalError,String(n))}}return}let o;try{const n=await this.request(e,G,s);if(n.task)o=n.task.taskId,yield{type:"taskCreated",task:n.task};else throw new _(w.InternalError,"Task creation did not return a task");for(;;){const i=await this.getTask({taskId:o},s);if(yield{type:"taskStatus",task:i},I(i.status)){i.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:o},t,s)}:i.status==="failed"?yield{type:"error",error:new _(w.InternalError,`Task ${o} failed`)}:i.status==="cancelled"&&(yield{type:"error",error:new _(w.InternalError,`Task ${o} was cancelled`)});return}if(i.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:o},t,s)};return}const u=i.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(p=>setTimeout(p,u)),s?.signal?.throwIfAborted()}}catch(n){yield{type:"error",error:n instanceof _?n:new _(w.InternalError,String(n))}}}request(e,t,s){const{relatedRequestId:r,resumptionToken:o,onresumptiontoken:n,task:i,relatedTask:u}=s??{};return new Promise((p,l)=>{const d=c=>{l(c)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),i&&this.assertTaskCapability(e.method)}catch(c){d(c);return}s?.signal?.throwIfAborted();const f=this._requestMessageId++,m={...e,jsonrpc:"2.0",id:f};s?.onprogress&&(this._progressHandlers.set(f,s.onprogress),m.params={...e.params,_meta:{...e.params?._meta||{},progressToken:f}}),i&&(m.params={...m.params,task:i}),u&&(m.params={...m.params,_meta:{...m.params?._meta||{},[M]:u}});const T=c=>{this._responseHandlers.delete(f),this._progressHandlers.delete(f),this._cleanupTimeout(f),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:f,reason:String(c)}},{relatedRequestId:r,resumptionToken:o,onresumptiontoken:n}).catch(k=>this._onerror(new Error(`Failed to send cancellation: ${k}`)));const g=c instanceof _?c:new _(w.RequestTimeout,String(c));l(g)};this._responseHandlers.set(f,c=>{if(!s?.signal?.aborted){if(c instanceof Error)return l(c);try{const g=b(t,c.result);g.success?p(g.data):l(g.error)}catch(g){l(g)}}}),s?.signal?.addEventListener("abort",()=>{T(s?.signal?.reason)});const y=s?.timeout??st,v=()=>T(_.fromError(w.RequestTimeout,"Request timed out",{timeout:y}));this._setupTimeout(f,y,s?.maxTotalTimeout,v,s?.resetTimeoutOnProgress??!1);const h=u?.taskId;if(h){const c=g=>{const k=this._responseHandlers.get(f);k?k(g):this._onerror(new Error(`Response handler missing for side-channeled request ${f}`))};this._requestResolvers.set(f,c),this._enqueueTaskMessage(h,{type:"request",message:m,timestamp:Date.now()}).catch(g=>{this._cleanupTimeout(f),l(g)})}else this._transport.send(m,{relatedRequestId:r,resumptionToken:o,onresumptiontoken:n}).catch(c=>{this._cleanupTimeout(f),l(c)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},Re,t)}async getTaskResult(e,t,s){return this.request({method:"tasks/result",params:e},t,s)}async listTasks(e,t){return this.request({method:"tasks/list",params:e},Ce,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},Ee,t)}async notification(e,t){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);const s=t?.relatedTask?.taskId;if(s){const i={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[M]:t.relatedTask}}};await this._enqueueTaskMessage(s,{type:"notification",message:i,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let i={...e,jsonrpc:"2.0"};t?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[M]:t.relatedTask}}}),this._transport?.send(i,t).catch(u=>this._onerror(u))});return}let n={...e,jsonrpc:"2.0"};t?.relatedTask&&(n={...n,params:{...n.params,_meta:{...n.params?._meta||{},[M]:t.relatedTask}}}),await this._transport.send(n,t)}setRequestHandler(e,t){const s=Y(e);this.assertRequestHandlerCapability(s),this._requestHandlers.set(s,(r,o)=>{const n=B(e,r);return Promise.resolve(t(n,o))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){const s=Y(e);this._notificationHandlers.set(s,r=>{const o=B(e,r);return Promise.resolve(t(o))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){const t=this._taskProgressTokens.get(e);t!==void 0&&(this._progressHandlers.delete(t),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,t,s){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const r=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,s,r)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){const s=await this._taskMessageQueue.dequeueAll(e,t);for(const r of s)if(r.type==="request"&&V(r.message)){const o=r.message.id,n=this._requestResolvers.get(o);n?(n(new _(w.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(o)):this._onerror(new Error(`Resolver missing for request ${o} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let s=this._options?.defaultTaskPollInterval??1e3;try{const r=await this._taskStore?.getTask(e);r?.pollInterval&&(s=r.pollInterval)}catch{}return new Promise((r,o)=>{if(t.aborted){o(new _(w.InvalidRequest,"Request cancelled"));return}const n=setTimeout(r,s);t.addEventListener("abort",()=>{clearTimeout(n),o(new _(w.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){const s=this._taskStore;if(!s)throw new Error("No task store configured");return{createTask:async r=>{if(!e)throw new Error("No request provided");return await s.createTask(r,e.id,{method:e.method,params:e.params},t)},getTask:async r=>{const o=await s.getTask(r,t);if(!o)throw new _(w.InvalidParams,"Failed to retrieve task: Task not found");return o},storeTaskResult:async(r,o,n)=>{await s.storeTaskResult(r,o,n,t);const i=await s.getTask(r,t);if(i){const u=W.parse({method:"notifications/tasks/status",params:i});await this.notification(u),I(i.status)&&this._cleanupTaskProgressHandler(r)}},getTaskResult:r=>s.getTaskResult(r,t),updateTaskStatus:async(r,o,n)=>{const i=await s.getTask(r,t);if(!i)throw new _(w.InvalidParams,`Task "${r}" not found - it may have been cleaned up`);if(I(i.status))throw new _(w.InvalidParams,`Cannot update task "${r}" from terminal status "${i.status}" to "${o}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await s.updateTaskStatus(r,o,n,t);const u=await s.getTask(r,t);if(u){const p=W.parse({method:"notifications/tasks/status",params:u});await this.notification(p),I(u.status)&&this._cleanupTaskProgressHandler(r)}},listTasks:r=>s.listTasks(r,t)}}}function Z(a){return a!==null&&typeof a=="object"&&!Array.isArray(a)}function ot(a,e){const t={...a};for(const s in e){const r=s,o=e[r];if(o===void 0)continue;const n=t[r];Z(n)&&Z(o)?t[r]={...n,...o}:t[r]=o}return t}var at=Ie();const nt=be(at);function it(){const a=new nt({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return Ae(a),a}class ct{constructor(e){this._ajv=e??it()}getValidator(e){const t="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return s=>t(s)?{valid:!0,data:s,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}}class lt{constructor(e){this._client=e}async*callToolStream(e,t=re,s){const r=this._client,o={...s,task:s?.task??(r.isToolTask(e.name)?{}:void 0)},n=r.requestStream({method:"tools/call",params:e},t,o),i=r.getToolOutputValidator(e.name);for await(const u of n){if(u.type==="result"&&i){const p=u.result;if(!p.structuredContent&&!p.isError){yield{type:"error",error:new _(w.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(p.structuredContent)try{const l=i(p.structuredContent);if(!l.valid){yield{type:"error",error:new _(w.InvalidParams,`Structured content does not match the tool's output schema: ${l.errorMessage}`)};return}}catch(l){if(l instanceof _){yield{type:"error",error:l};return}yield{type:"error",error:new _(w.InvalidParams,`Failed to validate structured content: ${l instanceof Error?l.message:String(l)}`)};return}}yield u}}async getTask(e,t){return this._client.getTask({taskId:e},t)}async getTaskResult(e,t,s){return this._client.getTaskResult({taskId:e},t,s)}async listTasks(e,t){return this._client.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._client.cancelTask({taskId:e},t)}requestStream(e,t,s){return this._client.requestStream(e,t,s)}}function ut(a,e,t){if(!a)throw new Error(`${t} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!a.tools?.call)throw new Error(`${t} does not support task creation for tools/call (required for ${e})`);break}}function dt(a,e,t){if(!a)throw new Error(`${t} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!a.sampling?.createMessage)throw new Error(`${t} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!a.elicitation?.create)throw new Error(`${t} does not support task creation for elicitation/create (required for ${e})`);break}}function U(a,e){if(!(!a||e===null||typeof e!="object")){if(a.type==="object"&&a.properties&&typeof a.properties=="object"){const t=e,s=a.properties;for(const r of Object.keys(s)){const o=s[r];t[r]===void 0&&Object.prototype.hasOwnProperty.call(o,"default")&&(t[r]=o.default),t[r]!==void 0&&U(o,t[r])}}if(Array.isArray(a.anyOf))for(const t of a.anyOf)typeof t!="boolean"&&U(t,e);if(Array.isArray(a.oneOf))for(const t of a.oneOf)typeof t!="boolean"&&U(t,e)}}function ht(a){if(!a)return{supportsFormMode:!1,supportsUrlMode:!1};const e=a.form!==void 0,t=a.url!==void 0;return{supportsFormMode:e||!e&&!t,supportsUrlMode:t}}let ft=class extends rt{constructor(e,t){super(t),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=t?.capabilities??{},this._jsonSchemaValidator=t?.jsonSchemaValidator??new ct,t?.listChanged&&(this._pendingListChangedConfig=t.listChanged)}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",qe,e.tools,async()=>(await this.listTools()).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",Me,e.prompts,async()=>(await this.listPrompts()).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",Pe,e.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new lt(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=ot(this._capabilities,e)}setRequestHandler(e,t){const r=ce(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let o;if(x(r)){const i=r;o=i._zod?.def?.value??i.value}else{const i=r;o=i._def?.value??i.value}if(typeof o!="string")throw new Error("Schema method literal must be a string");const n=o;if(n==="elicitation/create"){const i=async(u,p)=>{const l=b(Ge,u);if(!l.success){const c=l.error instanceof Error?l.error.message:String(l.error);throw new _(w.InvalidParams,`Invalid elicitation request: ${c}`)}const{params:d}=l.data;d.mode=d.mode??"form";const{supportsFormMode:f,supportsUrlMode:m}=ht(this._capabilities.elicitation);if(d.mode==="form"&&!f)throw new _(w.InvalidParams,"Client does not support form-mode elicitation requests");if(d.mode==="url"&&!m)throw new _(w.InvalidParams,"Client does not support URL-mode elicitation requests");const T=await Promise.resolve(t(u,p));if(d.task){const c=b(G,T);if(!c.success){const g=c.error instanceof Error?c.error.message:String(c.error);throw new _(w.InvalidParams,`Invalid task creation result: ${g}`)}return c.data}const y=b(ze,T);if(!y.success){const c=y.error instanceof Error?y.error.message:String(y.error);throw new _(w.InvalidParams,`Invalid elicitation result: ${c}`)}const v=y.data,h=d.mode==="form"?d.requestedSchema:void 0;if(d.mode==="form"&&v.action==="accept"&&v.content&&h&&this._capabilities.elicitation?.form?.applyDefaults)try{U(h,v.content)}catch{}return v};return super.setRequestHandler(e,i)}if(n==="sampling/createMessage"){const i=async(u,p)=>{const l=b(Qe,u);if(!l.success){const v=l.error instanceof Error?l.error.message:String(l.error);throw new _(w.InvalidParams,`Invalid sampling request: ${v}`)}const{params:d}=l.data,f=await Promise.resolve(t(u,p));if(d.task){const v=b(G,f);if(!v.success){const h=v.error instanceof Error?v.error.message:String(v.error);throw new _(w.InvalidParams,`Invalid task creation result: ${h}`)}return v.data}const T=d.tools||d.toolChoice?Ke:We,y=b(T,f);if(!y.success){const v=y.error instanceof Error?y.error.message:String(y.error);throw new _(w.InvalidParams,`Invalid sampling result: ${v}`)}return y.data};return super.setRequestHandler(e,i)}return super.setRequestHandler(e,t)}assertCapability(e,t){if(!this._serverCapabilities?.[e])throw new Error(`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(await super.connect(e),e.sessionId===void 0)try{const s=await this.request({method:"initialize",params:{protocolVersion:Oe,capabilities:this._capabilities,clientInfo:this._clientInfo}},$e,t);if(s===void 0)throw new Error(`Server sent invalid initialize result: ${s}`);if(!Ne.includes(s.protocolVersion))throw new Error(`Server's protocol version is not supported: ${s.protocolVersion}`);this._serverCapabilities=s.capabilities,this._serverVersion=s.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(s.protocolVersion),this._instructions=s.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(s){throw this.close(),s}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new Error(`Server does not support completions (required for ${e})`);break}}assertNotificationCapability(e){switch(e){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${e})`);break}}assertTaskCapability(e){ut(this._serverCapabilities?.tasks?.requests,e,"Server")}assertTaskHandlerCapability(e){this._capabilities&&dt(this._capabilities.tasks?.requests,e,"Client")}async ping(e){return this.request({method:"ping"},N,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},He,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},N,t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},Ue,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},De,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},xe,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},je,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},Le,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},N,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},N,t)}async callTool(e,t=re,s){if(this.isToolTaskRequired(e.name))throw new _(w.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);const r=await this.request({method:"tools/call",params:e},t,s),o=this.getToolOutputValidator(e.name);if(o){if(!r.structuredContent&&!r.isError)throw new _(w.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(r.structuredContent)try{const n=o(r.structuredContent);if(!n.valid)throw new _(w.InvalidParams,`Structured content does not match the tool's output schema: ${n.errorMessage}`)}catch(n){throw n instanceof _?n:new _(w.InvalidParams,`Failed to validate structured content: ${n instanceof Error?n.message:String(n)}`)}}return r}isToolTask(e){return this._serverCapabilities?.tasks?.requests?.tools?.call?this._cachedKnownTaskTools.has(e):!1}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(const t of e){if(t.outputSchema){const r=this._jsonSchemaValidator.getValidator(t.outputSchema);this._cachedToolOutputValidators.set(t.name,r)}const s=t.execution?.taskSupport;(s==="required"||s==="optional")&&this._cachedKnownTaskTools.add(t.name),s==="required"&&this._cachedRequiredTaskTools.add(t.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,t){const s=await this.request({method:"tools/list",params:e},Fe,t);return this.cacheToolMetadata(s.tools),s}_setupListChangedHandler(e,t,s,r){const o=Ve.safeParse(s);if(!o.success)throw new Error(`Invalid ${e} listChanged options: ${o.error.message}`);if(typeof s.onChanged!="function")throw new Error(`Invalid ${e} listChanged options: onChanged must be a function`);const{autoRefresh:n,debounceMs:i}=o.data,{onChanged:u}=s,p=async()=>{if(!n){u(null,null);return}try{const d=await r();u(null,d)}catch(d){const f=d instanceof Error?d:new Error(String(d));u(f,null)}},l=()=>{if(i){const d=this._listChangedDebounceTimers.get(e);d&&clearTimeout(d);const f=setTimeout(p,i);this._listChangedDebounceTimers.set(e,f)}else p()};this.setNotificationHandler(t,l)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};const L=a=>[{type:"text",text:a}];function pt(a){const e=D(a,typeof window<"u"?window.location.origin:void 0);if(!e)throw new Error("RestSelfClient requires either studioUrl or a browser environment.");const t={"Content-Type":"application/json",Accept:"application/json",...a.token?{Authorization:`Bearer ${a.token}`}:{}},s=u=>new URL(`/api/${encodeURIComponent(a.orgSlug)}${u}`,e).href,r=async u=>{let p;try{p=await fetch(s(`/tools/${encodeURIComponent(u.name)}`),{method:"POST",headers:t,credentials:"include",body:JSON.stringify(u.arguments??{})})}catch(d){const f=d instanceof Error?d.message:"Network error";return{content:L(f),isError:!0}}if(!p.ok){let d=`${u.name} failed (${p.status})`;try{const f=await p.json();f?.error&&(d=f.error)}catch{}return{content:L(d),isError:!0}}const l=await p.json().catch(()=>({}));return{content:L(typeof l=="string"?l:JSON.stringify(l)),structuredContent:l}},o=async()=>{const u=await fetch(s("/tools"),{method:"GET",headers:t,credentials:"include"});return u.ok?await u.json():{tools:[]}},n=u=>()=>Promise.reject(new Error(`RestSelfClient: ${u} is not supported over REST for the self connection`));return{callTool:r,listTools:o,listPrompts:n("listPrompts"),getPrompt:n("getPrompt"),listResources:n("listResources"),readResource:n("readResource"),listResourceTemplates:n("listResourceTemplates"),close:()=>Promise.resolve(),toJSON:()=>a.toJSONString}}function z(a){return a?a instanceof Headers?Object.fromEntries(a.entries()):Array.isArray(a)?Object.fromEntries(a):{...a}:{}}function mt(a=fetch,e){return e?async(t,s)=>{const r={...e,...s,headers:s?.headers?{...z(e.headers),...z(s.headers)}:e.headers};return a(t,r)}:a}class X extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}const ee=10,_t=13,A=32;function F(a){}function gt(a){if(typeof a=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:e=F,onError:t=F,onRetry:s=F,onComment:r}=a,o=[];let n=!0,i,u="",p=0,l;function d(h){if(n&&(n=!1,h.charCodeAt(0)===239&&h.charCodeAt(1)===187&&h.charCodeAt(2)===191&&(h=h.slice(3))),o.length===0){const k=f(h);k!==""&&o.push(k);return}if(h.indexOf(`
|
|
2
|
-
`)===-1&&h.indexOf("\r")===-1){o.push(h);return}o.push(h);const c=o.join("");o.length=0;const g=f(c);g!==""&&o.push(g)}function f(h){let c=0;if(h.indexOf("\r")===-1){let g=h.indexOf(`
|
|
3
|
-
`,c);for(;g!==-1;){if(c===g){p>0&&e({id:i,event:l,data:u}),i=void 0,u="",p=0,l=void 0,c=g+1,g=h.indexOf(`
|
|
4
|
-
`,c);continue}const k=h.charCodeAt(c);if(te(h,c,k)){const S=h.charCodeAt(c+5)===A?c+6:c+5,E=h.slice(S,g);if(p===0&&h.charCodeAt(g+1)===ee){e({id:i,event:l,data:E}),i=void 0,u="",l=void 0,c=g+2,g=h.indexOf(`
|
|
5
|
-
`,c);continue}u=p===0?E:`${u}
|
|
6
|
-
${E}`,p++}else se(h,c,k)?l=h.slice(h.charCodeAt(c+6)===A?c+7:c+6,g)||void 0:m(h,c,g);c=g+1,g=h.indexOf(`
|
|
7
|
-
`,c)}return h.slice(c)}for(;c<h.length;){const g=h.indexOf("\r",c),k=h.indexOf(`
|
|
8
|
-
`,c);let S=-1;if(g!==-1&&k!==-1?S=g<k?g:k:g!==-1?g===h.length-1?S=-1:S=g:k!==-1&&(S=k),S===-1)break;m(h,c,S),c=S+1,h.charCodeAt(c-1)===_t&&h.charCodeAt(c)===ee&&c++}return h.slice(c)}function m(h,c,g){if(c===g){y();return}const k=h.charCodeAt(c);if(te(h,c,k)){const q=h.charCodeAt(c+5)===A?c+6:c+5,K=h.slice(q,g);u=p===0?K:`${u}
|
|
9
|
-
${K}`,p++;return}if(se(h,c,k)){l=h.slice(h.charCodeAt(c+6)===A?c+7:c+6,g)||void 0;return}if(k===105&&h.charCodeAt(c+1)===100&&h.charCodeAt(c+2)===58){const q=h.slice(h.charCodeAt(c+3)===A?c+4:c+3,g);i=q.includes("\0")?void 0:q;return}if(k===58){if(r){const q=h.slice(c,g);r(q.slice(h.charCodeAt(c+1)===A?2:1))}return}const S=h.slice(c,g),E=S.indexOf(":");if(E===-1){T(S,"",S);return}const ue=S.slice(0,E),de=S.charCodeAt(E+1)===A?2:1,he=S.slice(E+de);T(ue,he,S)}function T(h,c,g){switch(h){case"event":l=c||void 0;break;case"data":u=p===0?c:`${u}
|
|
10
|
-
${c}`,p++;break;case"id":i=c.includes("\0")?void 0:c;break;case"retry":/^\d+$/.test(c)?s(parseInt(c,10)):t(new X(`Invalid \`retry\` value: "${c}"`,{type:"invalid-retry",value:c,line:g}));break;default:t(new X(`Unknown field "${h.length>20?`${h.slice(0,20)}…`:h}"`,{type:"unknown-field",field:h,value:c,line:g}));break}}function y(){p>0&&e({id:i,event:l,data:u}),i=void 0,u="",p=0,l=void 0}function v(h={}){if(h.consume&&o.length>0){const c=o.join("");m(c,0,c.length)}n=!0,i=void 0,u="",p=0,l=void 0,o.length=0}return{feed:d,reset:v}}function te(a,e,t){return t===100&&a.charCodeAt(e+1)===97&&a.charCodeAt(e+2)===116&&a.charCodeAt(e+3)===97&&a.charCodeAt(e+4)===58}function se(a,e,t){return t===101&&a.charCodeAt(e+1)===118&&a.charCodeAt(e+2)===101&&a.charCodeAt(e+3)===110&&a.charCodeAt(e+4)===116&&a.charCodeAt(e+5)===58}class wt extends TransformStream{constructor({onError:e,onRetry:t,onComment:s}={}){let r;super({start(o){r=gt({onEvent:n=>{o.enqueue(n)},onError(n){e==="terminate"?o.error(n):typeof e=="function"&&e(n)},onRetry:t,onComment:s})},transform(o){r.feed(o)}})}}const Tt={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class O extends Error{constructor(e,t){super(`Streamable HTTP error: ${t}`),this.code=e}}let yt=class{constructor(e,t){this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=t?.requestInit,this._authProvider=t?.authProvider,this._fetch=t?.fetch,this._fetchWithInit=mt(t?.fetch,t?.requestInit),this._sessionId=t?.sessionId,this._reconnectionOptions=t?.reconnectionOptions??Tt}async _authThenStart(){if(!this._authProvider)throw new P("No auth provider");let e;try{e=await H(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(t){throw this.onerror?.(t),t}if(e!=="AUTHORIZED")throw new P;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){const e={};if(this._authProvider){const s=await this._authProvider.tokens();s&&(e.Authorization=`Bearer ${s.access_token}`)}this._sessionId&&(e["mcp-session-id"]=this._sessionId),this._protocolVersion&&(e["mcp-protocol-version"]=this._protocolVersion);const t=z(this._requestInit?.headers);return new Headers({...e,...t})}async _startOrAuthSse(e){const{resumptionToken:t}=e;try{const s=await this._commonHeaders();s.set("Accept","text/event-stream"),t&&s.set("last-event-id",t);const r=await(this._fetch??fetch)(this._url,{method:"GET",headers:s,signal:this._abortController?.signal});if(!r.ok){if(await r.body?.cancel(),r.status===401&&this._authProvider)return await this._authThenStart();if(r.status===405)return;throw new O(r.status,`Failed to open SSE stream: ${r.statusText}`)}this._handleSseStream(r.body,e,!0)}catch(s){throw this.onerror?.(s),s}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;const t=this._reconnectionOptions.initialReconnectionDelay,s=this._reconnectionOptions.reconnectionDelayGrowFactor,r=this._reconnectionOptions.maxReconnectionDelay;return Math.min(t*Math.pow(s,e),r)}_scheduleReconnection(e,t=0){const s=this._reconnectionOptions.maxRetries;if(t>=s){this.onerror?.(new Error(`Maximum reconnection attempts (${s}) exceeded.`));return}const r=this._getNextReconnectionDelay(t);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch(o=>{this.onerror?.(new Error(`Failed to reconnect SSE stream: ${o instanceof Error?o.message:String(o)}`)),this._scheduleReconnection(e,t+1)})},r)}_handleSseStream(e,t,s){if(!e)return;const{onresumptiontoken:r,replayMessageId:o}=t;let n,i=!1,u=!1;(async()=>{try{const l=e.pipeThrough(new TextDecoderStream).pipeThrough(new wt({onRetry:m=>{this._serverRetryMs=m}})).getReader();for(;;){const{value:m,done:T}=await l.read();if(T)break;if(m.id&&(n=m.id,i=!0,r?.(m.id)),!!m.data&&(!m.event||m.event==="message"))try{const y=j.parse(JSON.parse(m.data));$(y)&&(u=!0,o!==void 0&&(y.id=o)),this.onmessage?.(y)}catch(y){this.onerror?.(y)}}(s||i)&&!u&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:n,onresumptiontoken:r,replayMessageId:o},0)}catch(l){if(this.onerror?.(new Error(`SSE stream disconnected: ${l}`)),(s||i)&&!u&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:n,onresumptiontoken:r,replayMessageId:o},0)}catch(m){this.onerror?.(new Error(`Failed to reconnect: ${m instanceof Error?m.message:String(m)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new P("No auth provider");if(await H(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new P("Failed to authorize")}async close(){this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),this._abortController?.abort(),this.onclose?.()}async send(e,t){try{const{resumptionToken:s,onresumptiontoken:r}=t||{};if(s){this._startOrAuthSse({resumptionToken:s,replayMessageId:V(e)?e.id:void 0}).catch(f=>this.onerror?.(f));return}const o=await this._commonHeaders();o.set("content-type","application/json"),o.set("accept","application/json, text/event-stream");const n={...this._requestInit,method:"POST",headers:o,body:JSON.stringify(e),signal:this._abortController?.signal},i=await(this._fetch??fetch)(this._url,n),u=i.headers.get("mcp-session-id");if(u&&(this._sessionId=u),!i.ok){const f=await i.text().catch(()=>null);if(i.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new O(401,"Server returned 401 after successful authentication");const{resourceMetadataUrl:m,scope:T}=J(i);if(this._resourceMetadataUrl=m,this._scope=T,await H(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new P;return this._hasCompletedAuthFlow=!0,this.send(e)}if(i.status===403&&this._authProvider){const{resourceMetadataUrl:m,scope:T,error:y}=J(i);if(y==="insufficient_scope"){const v=i.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===v)throw new O(403,"Server returned 403 after trying upscoping");if(T&&(this._scope=T),m&&(this._resourceMetadataUrl=m),this._lastUpscopingHeader=v??void 0,await H(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new P;return this.send(e)}}throw new O(i.status,`Error POSTing to endpoint: ${f}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,i.status===202){await i.body?.cancel(),Je(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(f=>this.onerror?.(f));return}const l=(Array.isArray(e)?e:[e]).filter(f=>"method"in f&&"id"in f&&f.id!==void 0).length>0,d=i.headers.get("content-type");if(l)if(d?.includes("text/event-stream"))this._handleSseStream(i.body,{onresumptiontoken:r},!1);else if(d?.includes("application/json")){const f=await i.json(),m=Array.isArray(f)?f.map(T=>j.parse(T)):[j.parse(f)];for(const T of m)this.onmessage?.(T)}else throw await i.body?.cancel(),new O(-1,`Unexpected content type: ${d}`);else await i.body?.cancel()}catch(s){throw this.onerror?.(s),s}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{const e=await this._commonHeaders(),t={...this._requestInit,method:"DELETE",headers:e,signal:this._abortController?.signal},s=await(this._fetch??fetch)(this._url,t);if(await s.body?.cancel(),!s.ok&&s.status!==405)throw new O(s.status,`Failed to terminate session: ${s.statusText}`);this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,t){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:t?.onresumptiontoken})}};class vt extends yt{constructor(e,t){super(e,t)}send(e,t){const s=kt(e);return s?.type==="emit"?(this.onmessage?.(s.message),Promise.resolve()):s?.type==="suppress"?Promise.resolve():super.send(e,t)}}function kt(a){const e=a;if(!e||typeof e!="object"||!("method"in e))return null;switch(e.method){case"initialize":{const t=e?.params?.protocolVersion;return t?{type:"emit",message:{result:{protocolVersion:t,capabilities:{tools:{},resources:{},prompts:{},tasks:{list:{},cancel:{},requests:{tool:{call:{}}}}},serverInfo:{name:"studio-virtual-mcp",version:"1.0.0"}},jsonrpc:e.jsonrpc??"2.0",id:e.id}}:null}case"notifications/roots/list_changed":case"notifications/initialized":case"notifications/cancelled":case"notifications/progress":return{type:"suppress"};default:return null}}const St={name:"studio-sdk",version:"1.0.0"};function Rt(a,e,t){const s=t??(typeof window<"u"?window.location.origin:void 0);if(!s)throw new Error("MCP client requires either studioUrl or a browser environment.");const r=`/api/${encodeURIComponent(e)}`,o=a?`${r}/mcp/${a}`:`${r}/mcp`;return new URL(o,s).href}async function le({connectionId:a,orgId:e,orgSlug:t,token:s,studioUrl:r,meshUrl:o,mcpUrl:n}){const i=D({studioUrl:r,meshUrl:o}),u=Q.mcpClient(e,a??"self",s??"",n??i??"");if(!n&&(!a||a===Ye))return pt({orgSlug:t,token:s,studioUrl:i,toJSONString:`mcp-client:${u.join(":")}`});const p=n??Rt(a,t,i),l=new ft(St,{capabilities:{tasks:{list:{},cancel:{},requests:{tool:{call:{}}}}}}),d=new vt(new URL(p),{requestInit:{headers:{"Content-Type":"application/json",Accept:"application/json, text/event-stream",...s?{Authorization:`Bearer ${s}`}:{}}}});return await l.connect(d),l.toJSON=()=>`mcp-client:${u.join(":")}`,l}function Ct(a){const{connectionId:e,token:t,studioUrl:s,meshUrl:r,mcpUrl:o,orgId:n}=a,i=D({studioUrl:s,meshUrl:r});return{queryKey:Q.mcpClient(n,e??"self",t??"",o??i??""),queryFn:()=>le(a),staleTime:1/0,gcTime:6e4}}function Ft(a){const e=oe.c(2);let t;e[0]!==a?(t=Ct(a),e[0]=a,e[1]=t):t=e[1];const{data:s}=ae(t);return s}function Vt(a){const e=oe.c(19),{connectionId:t,orgId:s,orgSlug:r,token:o,studioUrl:n,meshUrl:i,mcpUrl:u}=a;let p;e[0]!==i||e[1]!==n?(p=D({studioUrl:n,meshUrl:i}),e[0]=i,e[1]=n,e[2]=p):p=e[2];const l=p;let d;e[3]!==t||e[4]!==u||e[5]!==s||e[6]!==l||e[7]!==o?(d=t!==void 0?Q.mcpClient(s,t??"self",o??"",u??l??""):["mcp","client","skip",s],e[3]=t,e[4]=u,e[5]=s,e[6]=l,e[7]=o,e[8]=d):d=e[8];const f=d;let m;e[9]!==t||e[10]!==u||e[11]!==s||e[12]!==r||e[13]!==l||e[14]!==o?(m=async()=>t===void 0?null:le({connectionId:t,orgId:s,orgSlug:r,token:o,studioUrl:l,mcpUrl:u}),e[9]=t,e[10]=u,e[11]=s,e[12]=r,e[13]=l,e[14]=o,e[15]=m):m=e[15];let T;e[16]!==f||e[17]!==m?(T={queryKey:f,queryFn:m,staleTime:1/0,gcTime:6e4},e[16]=f,e[17]=m,e[18]=T):T=e[18];const{data:y}=ae(T);return y??null}export{nt as A,At as C,rt as P,$t as Q,Ye as S,It as W,Ht as a,Pt as b,Vt as c,qt as d,Dt as e,xt as f,Ut as g,Xe as h,Mt as i,Nt as j,le as k,gt as l,Ct as m,mt as n,z as o,yt as p,ft as q,Ze as r,Ot as s,Ft as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{I as u}from"./use-infinite-scroll-BOup92L2.js";import{e4 as i}from"./index-Cuug8jd7.js";function t(e,r){return i(e,u,r)}export{t as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{I as s}from"./use-infinite-scroll-BOup92L2.js";import{e4 as u,aV as n}from"./index-Cuug8jd7.js";function a(e,r){return u({...e,enabled:!0,suspense:!0,throwOnError:n},s,r)}export{a as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as K,b as tt,r as et,j as s,m as ot,B as nt}from"./index-Cuug8jd7.js";import{u as vt,Z as dt,f as yt}from"./agent-icon-5i6OCL5F.js";import{i as Tt}from"./ChevronRight-DcTM74Nx.js";import{L as jt}from"./label-BQAPYpl9.js";import{l as ft}from"./automation-runs-CQwGBeB-.js";import{S as Nt}from"./switch-DYWfZ4oI.js";import{T as wt,c as kt,a as Mt}from"./tooltip-D09V-b-D.js";import{V as _t}from"./view-mode-toggle-lJepTQIW.js";import"./AlertCircle-CzHAhrr6.js";import"./Tool01-CCM-RK9J.js";import"./ArrowUp-DBrHtvfE.js";import"./Settings02-BQ_6W_JU.js";import"./Tool02-DoDg-nMh.js";import"./XCircle-BAGVWBr6.js";import"./ArrowUpRight-Difm6SBR.js";import"./TrendUp01-BR_L8L93.js";import"./ZapSquare-eoAx0e5s.js";import"./Users03-BFLEPfzp.js";import"./CheckCircle-CBXbZPqe.js";import"./Check-BMwhITGN.js";import"./ChevronDown-BLutYvIR.js";import"./ChevronUp-CnX0DUPn.js";import"./DotsVertical-Bi2Pj2Rx.js";import"./Stars02-5ngV3USt.js";import"./Copy01-0FQhJRTl.js";import"./CpuChip01-CQ_lGCKe.js";import"./CreditCard01-CIVjejYO.js";import"./Eye-CNJVROK8.js";import"./FilterLines-C-MayH4t.js";import"./Star01-DdMpc2WM.js";import"./Palette-R1zicu_8.js";import"./SwitchHorizontal01-DBQaK4CG.js";import"./HardDrive-fDvzj4Z4.js";import"./Key01-DA8DOmXm.js";import"./LayoutLeft-DwCyodVh.js";import"./LinkExternal01-ZqumszDD.js";import"./LogOut01-oRQwceas.js";import"./Monitor01-BRfBPH_W.js";import"./Sun-DWxD9K8n.js";import"./Play-CmYL2KsO.js";import"./Plus-Ro_Rugpt.js";import"./SearchLg-CI4x084k.js";import"./SearchMd-BbbEhgez.js";import"./Shield01-C3qOqW-P.js";import"./Stars01-CJD9WdTJ.js";import"./Trash01-Dv4YTeiI.js";import"./Upload01-BNGUctEI.js";import"./User01-Dy3rZ0aR.js";import"./Users01-Dv8D_P-8.js";import"./XClose-BGriJSCO.js";import"./X-BfG7pUZd.js";import"./Zap-CuquuuMb.js";import"./select-B5znG0Y1.js";import"./useInfiniteQuery-DD0TdbWx.js";import"./use-infinite-scroll-BOup92L2.js";import"./use-connection-DLCNMhT_.js";import"./use-mcp-client-BDN-FEcc.js";import"./auth-B-H82oVn.js";import"./use-virtual-mcp-PtirDXqx.js";import"./card-CdJSU8vr.js";import"./sidebar-BIAbDN30.js";import"./use-mobile-DFoMyuD6.js";import"./table-CAhOdKdH.js";import"./empty-state-Di4I9IOD.js";import"./use-members-B28NMHu7.js";import"./use-org-auth-client-BUZkHhRH.js";import"./use-clock-tick-j7al6WgB.js";import"./use-automations-CjCcOCBs.js";import"./studio-tools-C08UjHsr.js";import"./useSuspenseInfiniteQuery-Dx_jU7Uo.js";import"./avatar-B4WZZi9O.js";import"./format-time-BnbuEtat.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-K8bJ1Pv1.js";import"./calendar-CoGJ_oVh.js";import"./dialog-DQWMOcko.js";import"./tab-id-DFGnzFYn.js";import"./hooks-DHFul8ca.js";import"./decopilot-sse-pool-B4lV_pkT.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./chat-context-BRG2mTLS.js";import"./use-is-desktop-app-BNujXJc_.js";import"./use-ai-providers-Cg8eqOhK.js";import"./use-decopilot-events-C2Oegu9x.js";import"./use-organization-settings-DtUf52ZO.js";import"./monaco-editor-CkHuDiB4.js";import"./spinner-pPCTrTnr.js";import"./index-Cxhypuyo.js";import"./shell-layout-DZReMwJ6.js";import"./required-auth-layout-Do4z8fey.js";import"./use-org-sso-B1fpUBuH.js";import"./integration-icon-CDNH_447.js";import"./use-navigate-to-agent-CP2_58b3.js";import"./reusable-new-chat-CouMjkYR.js";import"./AreaChart-DfvsG2lG.js";import"./form-CyEJbmjQ.js";import"./input-DXhpVfJR.js";const Et=new Set(["website/matchers/date.ts","$live/matchers/MatchDate.ts"]),St=new Set(["website/matchers/multi.ts","$live/matchers/MatchMulti.ts"]),Ct=new Date(-864e13),Dt=new Date(864e13),At=/\/flags\/multivariate(?:\/[^/]+)?\.ts$/,$t=/\/flags\/multivariate\.ts$/;function Lt(e){let t=e;t.startsWith("pages-")&&(t=t.slice(6).replace(/-\d+$/,""));try{t=decodeURIComponent(t)}catch{}return t}function Rt(e){if(!e||typeof e!="object")return null;const{start:t,end:n}=e,r=typeof t=="string",i=typeof n=="string";if(!r&&!i)return null;const o=r?new Date(t):Ct,a=i?new Date(n):Dt;return Number.isNaN(o.getTime())||Number.isNaN(a.getTime())||r&&i&&a.getTime()<=o.getTime()?null:{start:o,end:a,openStart:!r,openEnd:!i}}function pt(e,t){if(!e||typeof e!="object")return;const n=e.__resolveType;if(typeof n=="string"){if(Et.has(n)){const r=Rt(e);r&&t.push(r);return}if(St.has(n)){const r=e.matchers;if(Array.isArray(r))for(const i of r)pt(i,t)}}}function Ot(e){if(!e||typeof e!="object")return!1;const t=e.__resolveType;if(typeof t!="string"||!At.test(t))return!1;const n=e.variants;return Array.isArray(n)}function It(e){if(typeof e=="string"){const m=e.trim();if(m.length===0)return null;try{const c=new URL(m).pathname.split("/").filter(Boolean),d=c[c.length-1];if(d)return decodeURIComponent(d)}catch{}return m.length>80?`${m.slice(0,77)}…`:m}if(!e||typeof e!="object")return null;const t=e,n=t.config,i=t.desktop?.media,o=[t.title,t.name,t.label,t.alt,n?.title,n?.name,n?.typeAlert?.message,i?.alt,Array.isArray(t.matcher)?t.matcher[0]:void 0];for(const m of o)if(typeof m=="string"&&m.trim().length>0)return m.trim();const a=t.__resolveType;if(typeof a=="string"){const l=(a.split("/").pop()??a).replace(/\.(tsx?|jsx?)$/i,"");if(l.length>0)return l}return null}function Pt(e){const t=[];for(let n=0;n<e.length;n++){const r=e[n];typeof r=="number"?t.length>0?t[t.length-1]+=`[${r}]`:t.push(`[${r}]`):t.push(r)}return t.join(" · ")}function Q(e,t,n,r,i){if(Ot(e)){const o=e.variants,a=e.__resolveType,m=$t.test(a)?"":Pt(r);o.forEach((l,c)=>{if(!l||typeof l!="object")return;const d=l,p=[];if(pt(d.rule,p),p.length===0)return;const x=It(d.value)??(m||n);for(const h of p)i.push({blockKey:t,blockLabel:n,innerPath:m,variantIndex:c,start:h.start,end:h.end,openStart:h.openStart,openEnd:h.openEnd,label:x,flagResolveType:a})});for(let l=0;l<o.length;l++){const c=o[l];c&&typeof c=="object"&&Q(c.value,t,n,[...r,"variants",l,"value"],i)}return}if(Array.isArray(e)){for(let o=0;o<e.length;o++)Q(e[o],t,n,[...r,o],i);return}if(e&&typeof e=="object")for(const[o,a]of Object.entries(e))o!=="__resolveType"&&Q(a,t,n,[...r,o],i)}function Ft(e){if(!e)return[];const t=[];for(const[n,r]of Object.entries(e))Q(r,n,Lt(n),[],t);return t.sort((n,r)=>n.start.getTime()-r.start.getTime())}function Vt(e){const t=[...new Set(e)].sort(),n=new Map;return t.forEach((r,i)=>{const o=i*137.508%360;n.set(r,{bg:`oklch(0.62 0.14 ${o})`,text:"white",border:`oklch(0.50 0.14 ${o})`})}),n}const Ht={bg:"oklch(0.62 0.14 0)",text:"white",border:"oklch(0.50 0.14 0)"};function ut(e,t){return e.get(t)??Ht}const Bt=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ht=["January","February","March","April","May","June","July","August","September","October","November","December"],gt=1440*60*1e3;function B(e){const t=new Date(e);return t.setHours(0,0,0,0),t}function xt(e){return new Date(e.getFullYear(),e.getMonth(),1)}function G(e,t){return new Date(e.getFullYear(),e.getMonth()+t,1)}function X(e,t){const n=new Date(e);return n.setDate(n.getDate()+t),n}function st(e,t){return Math.round((B(e).getTime()-B(t).getTime())/gt)}function Wt(e){const t=(e.getTime()-B(e).getTime())/gt;return Math.min(Math.max(t,0),1)}function it(e,t){return st(e,t)+Wt(e)}function zt(e){const t=X(e,-e.getDay()),n=[];for(let r=0;r<6;r++){const i=[];for(let o=0;o<7;o++)i.push(X(t,r*7+o));n.push(i)}for(;n.length>0&&n[n.length-1].every(r=>r.getMonth()!==e.getMonth());)n.pop();return n}function Ut(e,t){const n=B(e[0]),r=X(n,7),i=n.getTime(),o=r.getTime(),a=[];for(const c of t){const d=B(c.start),p=B(c.end);if(p.getTime()<n.getTime()||d.getTime()>=r.getTime())continue;const u=d.getTime()<n.getTime()?n:d,x=p.getTime()>=r.getTime()?X(r,-1):p,h=st(u,n),g=st(x,u)+1;if(g<=0)continue;const b=Math.max(c.start.getTime(),i),j=Math.min(c.end.getTime(),o),v=it(new Date(b),n),f=Math.max(it(new Date(j),n)-v,0);f<=0||a.push({variant:c,startCol:h,span:g,leftUnits:v,widthUnits:f})}a.sort((c,d)=>c.startCol-d.startCol||d.span-c.span||c.variant.blockKey.localeCompare(d.variant.blockKey));const m=[],l=[];for(const c of a){let d=m.findIndex(p=>p<=c.startCol);d===-1&&(d=m.length,m.push(0)),m[d]=c.startCol+c.span,l.push({...c,lane:d})}return l}const at=new Intl.DateTimeFormat("en",{dateStyle:"medium",timeStyle:"short"});function Yt(e,t){const n=e.openStart?t("sandbox.variantCalendar.always"):at.format(e.start),r=e.openEnd?t("sandbox.variantCalendar.ongoing"):at.format(e.end);return`${n} → ${r}`}function Gt(e){const t=K.c(18),{variant:n}=e,r=tt();let i;t[0]!==n.blockLabel?(i=s.jsx("div",{className:"font-semibold",children:n.blockLabel}),t[0]=n.blockLabel,t[1]=i):i=t[1];let o;t[2]!==n.innerPath?(o=n.innerPath&&s.jsx("div",{className:"text-muted-foreground",children:n.innerPath}),t[2]=n.innerPath,t[3]=o):o=t[3];let a;t[4]!==n.blockLabel||t[5]!==n.innerPath||t[6]!==n.label?(a=n.label!==n.blockLabel&&n.label!==n.innerPath&&s.jsx("div",{className:"text-muted-foreground",children:n.label}),t[4]=n.blockLabel,t[5]=n.innerPath,t[6]=n.label,t[7]=a):a=t[7];let m;t[8]!==r||t[9]!==n?(m=Yt(n,r),t[8]=r,t[9]=n,t[10]=m):m=t[10];let l;t[11]!==m?(l=s.jsx("div",{className:"mt-1",children:m}),t[11]=m,t[12]=l):l=t[12];let c;return t[13]!==i||t[14]!==o||t[15]!==a||t[16]!==l?(c=s.jsx(Mt,{children:s.jsxs("div",{className:"text-xs",children:[i,o,a,l]})}),t[13]=i,t[14]=o,t[15]=a,t[16]=l,t[17]=c):c=t[17],c}const lt=16;function Kt(e,t){const n=e?"transparent":"#000 0",r=t?"transparent":"#000 100%";if(!(!e&&!t))return`linear-gradient(to right, ${n}, #000 ${lt}px, #000 calc(100% - ${lt}px), ${r})`}function bt(e){const t=K.c(26),{variant:n,color:r,style:i,children:o,fadeStart:a,fadeEnd:m}=e,l=a===void 0?!1:a,c=m===void 0?!1:m;let d;t[0]!==c||t[1]!==l?(d=Kt(l,c),t[0]=c,t[1]=l,t[2]=d):d=t[2];const p=d;let u;t[3]!==l?(u=l&&{borderTopLeftRadius:0,borderBottomLeftRadius:0},t[3]=l,t[4]=u):u=t[4];let x;t[5]!==c?(x=c&&{borderTopRightRadius:0,borderBottomRightRadius:0},t[5]=c,t[6]=x):x=t[6];let h;t[7]!==p?(h=p&&{maskImage:p,WebkitMaskImage:p},t[7]=p,t[8]=h):h=t[8];let g;t[9]!==r.bg||t[10]!==r.text||t[11]!==i||t[12]!==u||t[13]!==x||t[14]!==h?(g={background:r.bg,color:r.text,borderRadius:4,...u,...x,...h,...i},t[9]=r.bg,t[10]=r.text,t[11]=i,t[12]=u,t[13]=x,t[14]=h,t[15]=g):g=t[15];let b;t[16]!==o?(b=s.jsx("span",{className:"truncate",children:o}),t[16]=o,t[17]=b):b=t[17];let j;t[18]!==g||t[19]!==b?(j=s.jsx(wt,{asChild:!0,children:s.jsx("div",{className:"absolute flex items-center px-2 text-[11px] font-medium truncate cursor-default",style:g,children:b})}),t[18]=g,t[19]=b,t[20]=j):j=t[20];let v;t[21]!==n?(v=s.jsx(Gt,{variant:n}),t[21]=n,t[22]=v):v=t[22];let f;return t[23]!==v||t[24]!==j?(f=s.jsxs(kt,{children:[j,v]}),t[23]=v,t[24]=j,t[25]=f):f=t[25],f}function tr(e){const t=K.c(72),{decofile:n}=e,r=tt(),[i,o]=et.useState("calendar"),[a,m]=et.useState(Qt),[l,c]=et.useState(!1);let d,p,u;if(t[0]!==n||t[1]!==l){const P=Ft(n);d=P.filter(qt).length,u=l?P:P.filter(Zt),p=Vt(u.map(Jt)),t[0]=n,t[1]=l,t[2]=d,t[3]=p,t[4]=u}else d=t[2],p=t[3],u=t[4];const x=p;let h;t[5]===Symbol.for("react.memo_cache_sentinel")?(h=()=>m(xt(new Date)),t[5]=h):h=t[5];const g=h;let b;t[6]!==i?(b=()=>m(P=>i==="calendar"?G(P,-1):G(P,-3)),t[6]=i,t[7]=b):b=t[7];const j=b;let v;t[8]!==i?(v=()=>m(P=>i==="calendar"?G(P,1):G(P,3)),t[8]=i,t[9]=v):v=t[9];const f=v;let y;t[10]!==r?(y=r("sandbox.variantCalendar.today"),t[10]=r,t[11]=y):y=t[11];let T;t[12]!==y?(T=s.jsx(nt,{variant:"outline",size:"sm",onClick:g,children:y}),t[12]=y,t[13]=T):T=t[13];let w;t[14]!==r?(w=r("sandbox.variantCalendar.previous"),t[14]=r,t[15]=w):w=t[15];let D;t[16]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsx(vt,{size:16}),t[16]=D):D=t[16];let k;t[17]!==j||t[18]!==w?(k=s.jsx(nt,{variant:"ghost",size:"icon",className:"size-8",onClick:j,"aria-label":w,children:D}),t[17]=j,t[18]=w,t[19]=k):k=t[19];let M;t[20]!==r?(M=r("sandbox.variantCalendar.next"),t[20]=r,t[21]=M):M=t[21];let S;t[22]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(Tt,{size:16}),t[22]=S):S=t[22];let A;t[23]!==f||t[24]!==M?(A=s.jsx(nt,{variant:"ghost",size:"icon",className:"size-8",onClick:f,"aria-label":M,children:S}),t[23]=f,t[24]=M,t[25]=A):A=t[25];const $=ht[a.getMonth()];let C;t[26]!==a?(C=a.getFullYear(),t[26]=a,t[27]=C):C=t[27];let _;t[28]!==$||t[29]!==C?(_=s.jsxs("h2",{className:"ml-2 text-base font-semibold",children:[$," ",C]}),t[28]=$,t[29]=C,t[30]=_):_=t[30];let N;t[31]!==A||t[32]!==_||t[33]!==T||t[34]!==k?(N=s.jsxs("div",{className:"flex items-center gap-2",children:[T,k,A,_]}),t[31]=A,t[32]=_,t[33]=T,t[34]=k,t[35]=N):N=t[35];let L;t[36]!==d||t[37]!==l||t[38]!==r?(L=d>0&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Nt,{id:"show-ongoing",checked:l,onCheckedChange:c}),s.jsx(jt,{htmlFor:"show-ongoing",className:"text-xs text-muted-foreground cursor-pointer",children:r("sandbox.variantCalendar.showOngoing",{count:d})})]}),t[36]=d,t[37]=l,t[38]=r,t[39]=L):L=t[39];let H;t[40]===Symbol.for("react.memo_cache_sentinel")?(H=s.jsx(dt,{}),t[40]=H):H=t[40];let F;t[41]!==r?(F=r("sandbox.variantCalendar.calendarMode"),t[41]=r,t[42]=F):F=t[42];let E;t[43]!==F?(E={value:"calendar",icon:H,label:F},t[43]=F,t[44]=E):E=t[44];let W;t[45]===Symbol.for("react.memo_cache_sentinel")?(W=s.jsx(yt,{}),t[45]=W):W=t[45];let R;t[46]!==r?(R=r("sandbox.variantCalendar.timelineMode"),t[46]=r,t[47]=R):R=t[47];let O;t[48]!==R?(O={value:"timeline",icon:W,label:R},t[48]=R,t[49]=O):O=t[49];let I;t[50]!==E||t[51]!==O?(I=[E,O],t[50]=E,t[51]=O,t[52]=I):I=t[52];let V;t[53]!==I||t[54]!==i?(V=s.jsx(_t,{value:i,onValueChange:o,options:I}),t[53]=I,t[54]=i,t[55]=V):V=t[55];let z;t[56]!==L||t[57]!==V?(z=s.jsxs("div",{className:"flex items-center gap-4",children:[L,V]}),t[56]=L,t[57]=V,t[58]=z):z=t[58];let U;t[59]!==N||t[60]!==z?(U=s.jsxs("div",{className:"flex items-center justify-between px-4 h-12 border-b shrink-0",children:[N,z]}),t[59]=N,t[60]=z,t[61]=U):U=t[61];let Y;t[62]!==x||t[63]!==a||t[64]!==d||t[65]!==l||t[66]!==u||t[67]!==i?(Y=u.length===0?s.jsx(Xt,{hiddenOngoing:l?0:d}):i==="calendar"?s.jsx(ee,{monthStart:a,variants:u,colorMap:x}):s.jsx(oe,{monthStart:a,variants:u,colorMap:x}),t[62]=x,t[63]=a,t[64]=d,t[65]=l,t[66]=u,t[67]=i,t[68]=Y):Y=t[68];let Z;return t[69]!==U||t[70]!==Y?(Z=s.jsxs("div",{className:"flex h-full w-full flex-col",children:[U,Y]}),t[69]=U,t[70]=Y,t[71]=Z):Z=t[71],Z}function Jt(e){return e.blockKey}function Zt(e){return!e.openEnd}function qt(e){return e.openEnd}function Qt(){return xt(new Date)}function Xt(e){const t=K.c(4),{hiddenOngoing:n}=e,r=n===void 0?0:n,i=tt();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(dt,{size:24,className:"text-muted-foreground/60"}),t[0]=o):o=t[0];let a;return t[1]!==r||t[2]!==i?(a=s.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 text-center text-sm text-muted-foreground p-6",children:[o,r>0?s.jsxs(s.Fragment,{children:[s.jsx("div",{children:i("sandbox.variantCalendar.noDatedVariants")}),s.jsx("div",{className:"text-xs text-muted-foreground/80",children:i("sandbox.variantCalendar.hiddenOngoingVariants",{count:r})})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{children:i("sandbox.variantCalendar.noScheduledVariants")}),s.jsx("div",{className:"text-xs text-muted-foreground/80",children:i("sandbox.variantCalendar.dateMatcherInfo")})]})]}),t[1]=r,t[2]=i,t[3]=a):a=t[3],a}const rt=20,ct=2,mt=28,te=6;function ee(e){const t=K.c(17),{monthStart:n,variants:r,colorMap:i}=e;let o,a,m,l,c;if(t[0]!==i||t[1]!==n||t[2]!==r){const u=zt(n),x=B(new Date);o=ft,c="flex-1 min-h-0",a="min-w-[840px]",t[8]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx("div",{className:"grid grid-cols-7 border-b text-xs text-muted-foreground sticky top-0 bg-background z-10",children:Bt.map(re)}),t[8]=m):m=t[8],l=u.map((h,g)=>{const b=Ut(h,r),j=b.reduce(ne,0),v=mt+j*(rt+ct)+8;return s.jsxs("div",{className:"grid grid-cols-7 relative border-b",style:{height:v},children:[h.map((f,y)=>{const T=f.getMonth()===n.getMonth(),w=f.getTime()===x.getTime();return s.jsx("div",{className:ot("border-r last:border-r-0 px-2 pt-1.5 text-xs",T?"bg-background":"bg-muted/30 text-muted-foreground"),children:s.jsx("span",{className:ot("inline-flex h-5 min-w-5 items-center justify-center rounded-full px-1",w&&"bg-primary text-primary-foreground font-semibold"),children:f.getDate()})},y)}),b.map((f,y)=>{const T=ut(i,f.variant.blockKey),w=mt+f.lane*(rt+ct),D=f.leftUnits/7*100,k=f.widthUnits/7*100,M=f.variant.openStart&&g===0,S=f.variant.openEnd&&g===u.length-1;return s.jsxs(bt,{variant:f.variant,color:T,fadeStart:M,fadeEnd:S,style:{top:w,left:`calc(${D}% + 2px)`,width:`calc(${k}% - 4px)`,minWidth:te,height:rt},children:[f.variant.blockLabel,f.variant.label!==f.variant.blockLabel&&s.jsxs("span",{className:"opacity-70",children:[" · ",f.variant.label]})]},`${g}-${y}`)})]},g)}),t[0]=i,t[1]=n,t[2]=r,t[3]=o,t[4]=a,t[5]=m,t[6]=l,t[7]=c}else o=t[3],a=t[4],m=t[5],l=t[6],c=t[7];let d;t[9]!==a||t[10]!==m||t[11]!==l?(d=s.jsxs("div",{className:a,children:[m,l]}),t[9]=a,t[10]=m,t[11]=l,t[12]=d):d=t[12];let p;return t[13]!==o||t[14]!==c||t[15]!==d?(p=s.jsx(o,{className:c,children:d}),t[13]=o,t[14]=c,t[15]=d,t[16]=p):p=t[16],p}function ne(e,t){return Math.max(e,t.lane+1)}function re(e){return s.jsx("div",{className:"px-2 py-2 text-center uppercase tracking-wide",children:e},e)}const q=4,se=32,J=240;function oe(e){const t=K.c(23),{monthStart:n,variants:r,colorMap:i}=e,o=n,a=G(n,q),m=new Date,l=new Map;for(const _ of r){const N=l.get(_.blockKey)??[];N.push(_),l.set(_.blockKey,N)}const c=Array.from(l.entries()).sort(le),d=a.getTime()-o.getTime(),p=_=>(Math.max(o.getTime(),Math.min(a.getTime(),_.getTime()))-o.getTime())/d*100;let u;t[0]!==o?(u=(_,N)=>G(o,N),t[0]=o,t[1]=u):u=t[1];const x=Array.from({length:q},u),h=m.getTime()>=o.getTime()&&m.getTime()<=a.getTime()?p(m):null,g=tt(),b=ft,j="flex-1 min-h-0",v="min-w-[900px] relative";let f;t[2]===Symbol.for("react.memo_cache_sentinel")?(f={width:J},t[2]=f):f=t[2];let y;t[3]!==g?(y=g("sandbox.variantCalendar.variantBlock"),t[3]=g,t[4]=y):y=t[4];let T;t[5]!==y?(T=s.jsx("div",{className:"shrink-0 px-3 py-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground border-r",style:f,children:y}),t[5]=y,t[6]=T):T=t[6];let w;t[7]===Symbol.for("react.memo_cache_sentinel")?(w={gridTemplateColumns:`repeat(${q}, minmax(0, 1fr))`},t[7]=w):w=t[7];const D=x.map(ae);let k;t[8]!==D?(k=s.jsx("div",{className:"flex-1 grid",style:w,children:D}),t[8]=D,t[9]=k):k=t[9];let M;t[10]!==T||t[11]!==k?(M=s.jsxs("div",{className:"flex border-b sticky top-0 bg-background z-10",children:[T,k]}),t[10]=T,t[11]=k,t[12]=M):M=t[12];let S;t[13]!==g||t[14]!==h?(S=h!==null&&s.jsx("div",{className:"pointer-events-none absolute top-0 bottom-0 w-px bg-primary/70 z-[5]",style:{left:`calc(${J}px + (100% - ${J}px) * ${h} / 100)`},children:s.jsx("span",{className:"absolute -top-0.5 -translate-x-1/2 rounded-sm bg-primary px-1.5 py-px text-[10px] font-medium text-primary-foreground",children:g("sandbox.variantCalendar.todayLabel")})}),t[13]=g,t[14]=h,t[15]=S):S=t[15];const A=c.map(_=>{const[N,L]=_,H=ut(i,N),F=L[0]?.blockLabel??N;return s.jsxs("div",{children:[s.jsx("div",{className:"flex items-center bg-muted/40 border-b text-xs font-semibold uppercase tracking-wide text-muted-foreground",style:{height:28},children:s.jsx("div",{className:"px-3 truncate",style:{width:J},children:F})}),L.map((E,W)=>s.jsxs("div",{className:"flex border-b items-center",style:{height:se},children:[s.jsxs("div",{className:"flex items-center gap-2 px-3 text-sm border-r shrink-0",style:{width:J},children:[s.jsx("span",{className:"inline-block h-2 w-2 rounded-full shrink-0",style:{background:H.bg}}),s.jsx("span",{className:"truncate text-foreground/80",children:E.label})]}),s.jsxs("div",{className:"relative flex-1 h-full",children:[s.jsx("div",{className:"absolute inset-0 grid",style:{gridTemplateColumns:`repeat(${q}, minmax(0, 1fr))`},children:x.map(ie)}),(()=>{const R=Math.max(E.start.getTime(),o.getTime()),O=Math.min(E.end.getTime(),a.getTime());if(O<=R)return null;const I=p(new Date(R)),V=p(new Date(O))-I;return s.jsx(bt,{variant:E,color:H,fadeStart:E.openStart,fadeEnd:E.openEnd,style:{top:"50%",transform:"translateY(-50%)",left:`${I}%`,width:`calc(${V}% - 2px)`,height:22},children:E.label})})()]})]},W))]},N)});let $;t[16]!==M||t[17]!==S||t[18]!==A?($=s.jsxs("div",{className:v,children:[M,S,A]}),t[16]=M,t[17]=S,t[18]=A,t[19]=$):$=t[19];let C;return t[20]!==b||t[21]!==$?(C=s.jsx(b,{className:j,children:$}),t[20]=b,t[21]=$,t[22]=C):C=t[22],C}function ie(e,t){return s.jsx("div",{className:"border-r last:border-r-0 border-border/40"},t)}function ae(e,t){return s.jsxs("div",{className:"px-2 py-2 text-xs uppercase tracking-wide text-muted-foreground border-r last:border-r-0",children:[ht[e.getMonth()]?.slice(0,3)," ",e.getFullYear()]},t)}function le(e,t){return e[0].localeCompare(t[0])}export{tr as VariantCalendar};
|