decocms 3.36.4 → 3.36.6
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-DU4Czymb.js → AlertCircle-Dq_aRrSW.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-jvt9_jPs.js → ArrowUpRight-DqDRBuPq.js} +1 -1
- package/dist/client/assets/{Check-CFZ7jofS.js → Check-CPgB6rV-.js} +1 -1
- package/dist/client/assets/{CheckCircle-B7_GaGqy.js → CheckCircle-Dig2QFEV.js} +1 -1
- package/dist/client/assets/{ChevronDown-CMnvnfNH.js → ChevronDown-DSfDv5bM.js} +1 -1
- package/dist/client/assets/{ChevronLeft-BLmY09V7.js → ChevronLeft-BMz9RJK0.js} +1 -1
- package/dist/client/assets/{ChevronRight-DtVYtVbK.js → ChevronRight-DUK5EG42.js} +1 -1
- package/dist/client/assets/{ChevronUp-BYxSfj4f.js → ChevronUp-B2AOL-eB.js} +1 -1
- package/dist/client/assets/{Container-CQcCiGBy.js → Container-DYSoO3DG.js} +1 -1
- package/dist/client/assets/{DotsVertical-7ebFkKLD.js → DotsVertical-fPJfllxd.js} +1 -1
- package/dist/client/assets/{Eye-CYtfD-C-.js → Eye-DeGxYDuW.js} +1 -1
- package/dist/client/assets/{FilterLines-BtiGzXwl.js → FilterLines-aqXCKU8G.js} +1 -1
- package/dist/client/assets/{Globe01-bYDzICLJ.js → Globe01-fLDIUsna.js} +1 -1
- package/dist/client/assets/{HardDrive-gxQ66xi3.js → HardDrive-BltsYt6F.js} +1 -1
- package/dist/client/assets/{Key01-CDcV65YU.js → Key01-CmnuMzLg.js} +1 -1
- package/dist/client/assets/{LayoutLeft-Cy-bGbAH.js → LayoutLeft-B_tQQStj.js} +1 -1
- package/dist/client/assets/{LinkExternal01-BDXPmxri.js → LinkExternal01-D6r75PNf.js} +1 -1
- package/dist/client/assets/{Monitor01-6PVrucyX.js → Monitor01-BU_pw8u6.js} +1 -1
- package/dist/client/assets/{Palette-8PqtgYqw.js → Palette-B5LxNhpC.js} +1 -1
- package/dist/client/assets/{Play-B0CTz7-g.js → Play-DTdPdnB9.js} +1 -1
- package/dist/client/assets/{Plus-DW_pro4F.js → Plus-D6sxLshv.js} +1 -1
- package/dist/client/assets/{RefreshCcw01-B9XxpyTk.js → RefreshCcw01-BTpOd3eq.js} +1 -1
- package/dist/client/assets/{SearchMd-BnZZ5mEU.js → SearchMd-DknOSDEF.js} +1 -1
- package/dist/client/assets/{Settings02-BzBPnOVl.js → Settings02-p7bikFh4.js} +1 -1
- package/dist/client/assets/{Shield01-CUegYioy.js → Shield01-B5ClLi5x.js} +1 -1
- package/dist/client/assets/{Star01-CjQzvxTy.js → Star01-BgW1n4hv.js} +1 -1
- package/dist/client/assets/{Stars01-BBldOY4r.js → Stars01-D1djCaFC.js} +1 -1
- package/dist/client/assets/{Stars02-COgJsT25.js → Stars02-Bqx_7EIE.js} +1 -1
- package/dist/client/assets/{Sun-BFeAvEQf.js → Sun-DtftEkuO.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-BQBOH6Au.js → SwitchHorizontal01-Bx586qSV.js} +1 -1
- package/dist/client/assets/{Tool01-BKl-GVq3.js → Tool01-Ral5MrGT.js} +1 -1
- package/dist/client/assets/{Trash01-BfygLm6s.js → Trash01-B7WGJ2nw.js} +1 -1
- package/dist/client/assets/{Upload01-ClElEXYw.js → Upload01-AmfCgYbd.js} +1 -1
- package/dist/client/assets/{User01-Bi6i4zOy.js → User01-D89IeLeJ.js} +1 -1
- package/dist/client/assets/{Users01-BXIkeJej.js → Users01-xnT12U--.js} +1 -1
- package/dist/client/assets/{Users03-DH-6SNzV.js → Users03-CVMsW27x.js} +1 -1
- package/dist/client/assets/{X-BUzk9ZuQ.js → X-dT525xXh.js} +1 -1
- package/dist/client/assets/{XCircle-8_cOsjUY.js → XCircle-BtsHL-zm.js} +1 -1
- package/dist/client/assets/{XClose-CCKAliKU.js → XClose-Dm6CEeSb.js} +1 -1
- package/dist/client/assets/{Zap-DMSK7ZyR.js → Zap-C3pKoqKe.js} +1 -1
- package/dist/client/assets/{ZapSquare-Dj9sWt3u.js → ZapSquare-CC2nvo3M.js} +1 -1
- package/dist/client/assets/{ZoomOut-DfX9NmNO.js → ZoomOut-qMWF_U2b.js} +1 -1
- package/dist/client/assets/{access-gate-DuwCoW9u.js → access-gate-D_KBPKdw.js} +1 -1
- package/dist/client/assets/{accordion-x86xWE4B.js → accordion-22OFyBCO.js} +1 -1
- package/dist/client/assets/{add-section-modal-CtMZ_X5l.js → add-section-modal-D5ohv1eA.js} +1 -1
- package/dist/client/assets/{agent-capabilities-C3MTl0Im.js → agent-capabilities-DiDonrOV.js} +1 -1
- package/dist/client/assets/{agent-icon-CV7VKepg.js → agent-icon-EkftJS22.js} +1 -1
- package/dist/client/assets/{agents-list-BT8i9CxI.js → agents-list-B08Wcy94.js} +1 -1
- package/dist/client/assets/{ai-providers-CAzPDdFJ.js → ai-providers-qgLslF2I.js} +1 -1
- package/dist/client/assets/{alert-Bi903p4n.js → alert-BgXOx46i.js} +1 -1
- package/dist/client/assets/{alert-dialog-CjyXYSQZ.js → alert-dialog-rzEJnGe3.js} +1 -1
- package/dist/client/assets/app-editor-BUZUhvgy.js +1 -0
- package/dist/client/assets/{auth-StjmYjna.js → auth-B-1Rly8q.js} +1 -1
- package/dist/client/assets/{auth-catchall-D86Q5OiL.js → auth-catchall-BAg0ovwy.js} +1 -1
- package/dist/client/assets/{auth-split-layout-BqxtOd31.js → auth-split-layout-D1kixFbi.js} +1 -1
- package/dist/client/assets/{automation-list-row-ZsMhYjFo.js → automation-list-row-CGwWirnd.js} +1 -1
- package/dist/client/assets/{automation-runs-CAE5s4jH.js → automation-runs-D6-iTDTB.js} +1 -1
- package/dist/client/assets/{automations-DzhdRc4f.js → automations-BNxkR4Ru.js} +1 -1
- package/dist/client/assets/{avatar-ItW7yKah.js → avatar-CBOuLXvr.js} +1 -1
- package/dist/client/assets/{badge-Bw9vN6fg.js → badge-aMsRW7zr.js} +1 -1
- package/dist/client/assets/{brand-context-BCx3pSLc.js → brand-context-oA9lt0HF.js} +1 -1
- package/dist/client/assets/{buckets-C-Dq8Vrb.js → buckets-Bf0uAS49.js} +1 -1
- package/dist/client/assets/{calendar-D0RqU72a.js → calendar-NDohjEqi.js} +1 -1
- package/dist/client/assets/{capability-load-error-B4z1cdIN.js → capability-load-error-ACG3_GvU.js} +1 -1
- package/dist/client/assets/{card-B0-N4bpb.js → card-ClQPDYHu.js} +1 -1
- package/dist/client/assets/{chat-context-BG_brbim.js → chat-context-TGvyfVIv.js} +1 -1
- package/dist/client/assets/{checkbox-BjUgAWJu.js → checkbox-CVg5TV-K.js} +1 -1
- package/dist/client/assets/{cli-auth-success-Cb5-OjdP.js → cli-auth-success-DqDulVMb.js} +1 -1
- package/dist/client/assets/{collection-detail-DONQnGGW.js → collection-detail-Blb_aikL.js} +1 -1
- package/dist/client/assets/{collection-display-button-BpdgmXkn.js → collection-display-button-Bs7CYw3P.js} +1 -1
- package/dist/client/assets/{collection-search-BEvxyUp1.js → collection-search-CvzbdpDU.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-CeQ3Kj1L.js → collection-table-wrapper-i94GI5hA.js} +1 -1
- package/dist/client/assets/{collection-tabs-DM_bzUmO.js → collection-tabs-BIfSZj8G.js} +1 -1
- package/dist/client/assets/{collections-DGui_rw4.js → collections-b1mKioA2.js} +1 -1
- package/dist/client/assets/{command-CSF0stL5.js → command-CWMX2Bpj.js} +1 -1
- package/dist/client/assets/{connect-desktop-dialog-BHttcPxA.js → connect-desktop-dialog-4lXqvbrN.js} +1 -1
- package/dist/client/assets/{connection-card-DNd6JwtE.js → connection-card-ZvdtkJJd.js} +1 -1
- package/dist/client/assets/{connection-detail-DBBp6dEO.js → connection-detail-5qrp_2N5.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-C-CDw2oQ.js → connection-form-helpers-Dp2dO8-Q.js} +1 -1
- package/dist/client/assets/{connections-BUntGfpQ.js → connections-CPRcmL2x.js} +1 -1
- package/dist/client/assets/{decopilot-kQEGsQqO.js → decopilot-TdiWgZdM.js} +1 -1
- package/dist/client/assets/decopilot-sse-pool-ClIo9zhJ.js +1 -0
- package/dist/client/assets/{dialog-FBdtBd0W.js → dialog-D-P_WrCO.js} +1 -1
- package/dist/client/assets/{domain-settings-DmSveh8r.js → domain-settings-zVDlbNM-.js} +1 -1
- package/dist/client/assets/{drawer-CSp117Rg.js → drawer-BrWBKjeq.js} +1 -1
- package/dist/client/assets/{dropdown-menu-BUlN28jb.js → dropdown-menu-BryIJ5hv.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-BxmZPwUZ.js → dynamic-plugin-layout-CcdqbIYM.js} +1 -1
- package/dist/client/assets/{empty-state-ByuwXjRC.js → empty-state-BtMig7h4.js} +1 -1
- package/dist/client/assets/{empty-state-DZZ4TCiB.js → empty-state-CJQL64Iv.js} +1 -1
- package/dist/client/assets/{extract-connection-data-D9Xe4stq.js → extract-connection-data-DO4BrJRm.js} +1 -1
- package/dist/client/assets/{features-DV5J5-hq.js → features-CvAaj5aU.js} +1 -1
- package/dist/client/assets/{file-explorer-CkhSBrMW.js → file-explorer-D5ZtuxHx.js} +1 -1
- package/dist/client/assets/{file-type-icon-BAmjNPBc.js → file-type-icon-BsYj2eA6.js} +1 -1
- package/dist/client/assets/{files-6d_tX66b.js → files-C6HRjbSm.js} +1 -1
- package/dist/client/assets/{form-BKRU3_f0.js → form-CpPpKCx-.js} +1 -1
- package/dist/client/assets/{general-Co2ymhtz.js → general-BUEq4kke.js} +1 -1
- package/dist/client/assets/{generate-id-CKNg3Kb_.js → generate-id-DOqX7377.js} +1 -1
- package/dist/client/assets/{github-repo-picker-BXMy0hpf.js → github-repo-picker-Cv2hJHIg.js} +1 -1
- package/dist/client/assets/{header-tab-button-CRRaGYWH.js → header-tab-button-KhZtaQXJ.js} +1 -1
- package/dist/client/assets/{hover-card-dEUH7y9z.js → hover-card-KVY26bmB.js} +1 -1
- package/dist/client/assets/{image-field-CgZHn_on.js → image-field-eyvwCWO2.js} +1 -1
- package/dist/client/assets/{index-C_iXtMNn.js → index-9oCDxqwk.js} +1 -1
- package/dist/client/assets/{index-C8c4nZI1.js → index-B2cuFH7l.js} +1 -1
- package/dist/client/assets/{index-CwjMi0Lt.js → index-BOsBvH8j.js} +1 -1
- package/dist/client/assets/{index-B6pSigm3.js → index-B_vlfh4p.js} +1 -1
- package/dist/client/assets/{index-DwVG2P9Q.js → index-BgsJ03EJ.js} +1 -1
- package/dist/client/assets/{index-CTVMK9LC.js → index-BlU04-gE.js} +1 -1
- package/dist/client/assets/{index-CiklrCzm.js → index-C4ADrWoA.js} +1 -1
- package/dist/client/assets/{index-Ckn2ukzq.js → index-C6-PybKM.js} +1 -1
- package/dist/client/assets/{index-wos7zFLb.js → index-CDQHOM5R.js} +1 -1
- package/dist/client/assets/{index-CsGon0kW.js → index-Cj8NCkzV.js} +1 -1
- package/dist/client/assets/{index-CEk0yA7A.js → index-DPGCKsxF.js} +4 -4
- package/dist/client/assets/{index-DEUVODq9.js → index-DY3w09IO.js} +3 -3
- package/dist/client/assets/{index-D5VHt2uj.js → index-Dx1vanKY.js} +1 -1
- package/dist/client/assets/{index-DGguhABr.js → index-hfiyru1l.js} +1 -1
- package/dist/client/assets/{index-redirect-FjuWd7yb.js → index-redirect-CC7C4n1P.js} +1 -1
- package/dist/client/assets/{index-DpgH-puy.js → index-vz32luVm.js} +1 -1
- package/dist/client/assets/{input-CkGEzOB_.js → input-B0CkwMLk.js} +1 -1
- package/dist/client/assets/{integration-icon-D3LrOIav.js → integration-icon-BeXMpMNo.js} +1 -1
- package/dist/client/assets/{label-CxhkSBar.js → label-PMquEo0-.js} +1 -1
- package/dist/client/assets/{layout-Bt0QDLtr.js → layout-DAzteRe6.js} +1 -1
- package/dist/client/assets/{login-IwWNwbY4.js → login-CdIJnUW3.js} +1 -1
- package/dist/client/assets/{mcp-oauth-ClRecFEf.js → mcp-oauth-BLYgYIFp.js} +1 -1
- package/dist/client/assets/{members-s0QyCnyJ.js → members-BbGJ8L95.js} +1 -1
- package/dist/client/assets/{monaco-editor-CiwloXdm.js → monaco-editor-Dtzak2uP.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-TXNzfIxp.js → monitoring-stats-row-BoXX8NQi.js} +1 -1
- package/dist/client/assets/{oauth-callback-DlXFbr-f.js → oauth-callback-DBIDSCw1.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-p8gLjM7e.js → oauth-callback-ai-provider-DQ6J8wjt.js} +1 -1
- package/dist/client/assets/{onboarding-8moQC7Cm.js → onboarding-oLZvTpsU.js} +1 -1
- package/dist/client/assets/{org-install-C_oKg9PC.js → org-install-Dhyj8KkE.js} +1 -1
- package/dist/client/assets/{org-layout-B8BfjaU4.js → org-layout-DKOEWMKb.js} +1 -1
- package/dist/client/assets/{org-plugin-layout-DdUf_5AW.js → org-plugin-layout-CtcdXN9i.js} +1 -1
- package/dist/client/assets/{page-seo-form-B-I81VJI.js → page-seo-form-D9Rrhk6O.js} +1 -1
- package/dist/client/assets/page-seo-sheet-g9EKqmR_.js +1 -0
- package/dist/client/assets/{pair-BGqqCdXk.js → pair-D_DFqq5L.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-DoGTEgJq.js → plugin-empty-state-BUXl80cF.js} +1 -1
- package/dist/client/assets/{plugin-header-DkXNWjlz.js → plugin-header-ov_Hw-qh.js} +1 -1
- package/dist/client/assets/{plugin-layout-Dp7j6oj5.js → plugin-layout-DLxkIzls.js} +1 -1
- package/dist/client/assets/{popover-D6gDvvex.js → popover-rsSc4pjV.js} +1 -1
- package/dist/client/assets/{post-editor-HrWJufNf.js → post-editor-DIXAxF5l.js} +1 -1
- package/dist/client/assets/{primitives-BSpEXmPv.js → primitives-D5ActPZG.js} +1 -1
- package/dist/client/assets/{profile-DOJoyq1_.js → profile-DBqCEc4E.js} +1 -1
- package/dist/client/assets/project-app-view-DRmpbQZp.js +1 -0
- package/dist/client/assets/record-editor-CdXt0BJy.js +1 -0
- package/dist/client/assets/registry-2alezFUQ.js +2 -0
- package/dist/client/assets/{registry-layout-_dcZP0XL.js → registry-layout-CCwf7h1t.js} +1 -1
- package/dist/client/assets/{require-capability-CqCUzyTW.js → require-capability-DfH_Sqed.js} +1 -1
- package/dist/client/assets/{required-auth-layout-9YYeY0t9.js → required-auth-layout-DeD5TVah.js} +1 -1
- package/dist/client/assets/{reset-password-BECGeSUl.js → reset-password-Cgzr7qyT.js} +1 -1
- package/dist/client/assets/{resizable-DV0pCXfQ.js → resizable-D8RQo_5S.js} +1 -1
- package/dist/client/assets/{roles-D14mg7KI.js → roles-KXE4eLWq.js} +1 -1
- package/dist/client/assets/save-referenced-block-DY8yL5ub.js +1 -0
- package/dist/client/assets/{save-status-DfBuYJH7.js → save-status-RyAPUThs.js} +1 -1
- package/dist/client/assets/{schema-form-CKIpZkBj.js → schema-form-BBBCMCDT.js} +1 -1
- package/dist/client/assets/{scroll-area-CHs0jTz4.js → scroll-area-BA3CfjMX.js} +1 -1
- package/dist/client/assets/{search-input-DLDVTOcp.js → search-input-CxSBjWxv.js} +1 -1
- package/dist/client/assets/{secrets-B1ZULRnd.js → secrets-zi7L-WhU.js} +1 -1
- package/dist/client/assets/{sections-editor-0pqboVrH.js → sections-editor-DbBhsr7i.js} +1 -1
- package/dist/client/assets/{select-Dyn5eJ76.js → select-CJfXW58o.js} +1 -1
- package/dist/client/assets/{select-model-BNZKyxON.js → select-model-BaCRsY81.js} +1 -1
- package/dist/client/assets/{seo-editor-7yhk21tn.js → seo-editor-GccXSXxy.js} +1 -1
- package/dist/client/assets/{settings-layout-CCjX3a3N.js → settings-layout-BtQV6KXg.js} +1 -1
- package/dist/client/assets/{settings-section-BsU7NnTR.js → settings-section-BdfBdt9H.js} +1 -1
- package/dist/client/assets/{sheet-C2l8o7Li.js → sheet-DovmEFQe.js} +1 -1
- package/dist/client/assets/{shell-controls-Da9F6Uwi.js → shell-controls-DcYtfhL-.js} +1 -1
- package/dist/client/assets/{shell-layout-D-knukkt.js → shell-layout-IynSY8E5.js} +1 -1
- package/dist/client/assets/{shell-route-loading-BQnWeFBU.js → shell-route-loading-Cmr_pTbg.js} +1 -1
- package/dist/client/assets/{sidebar-DMarnfZA.js → sidebar-BFnxxrth.js} +1 -1
- package/dist/client/assets/{skeleton-CBG5UooE.js → skeleton-dy-S0Sln.js} +1 -1
- package/dist/client/assets/{sortable.esm-B6mcz4jC.js → sortable.esm-Ce_JeqCX.js} +1 -1
- package/dist/client/assets/{spinner-CZkJwfre.js → spinner-sPXohOHa.js} +1 -1
- package/dist/client/assets/{sso-DlGhVe9T.js → sso-C9Wmjx6E.js} +1 -1
- package/dist/client/assets/{store-3PV6elmz.js → store-DtiXyAWt.js} +1 -1
- package/dist/client/assets/store-registry-DqmCqoJZ.js +2 -0
- package/dist/client/assets/{studio-tools-DnIG9YV2.js → studio-tools-Cf7jviAo.js} +1 -1
- package/dist/client/assets/{switch-DZavAgGZ.js → switch-BC30tIvN.js} +1 -1
- package/dist/client/assets/{tab-id-BxH9ETDC.js → tab-id-l7bxIuE5.js} +1 -1
- package/dist/client/assets/{table-C6yf7crt.js → table-BkTI3GAj.js} +1 -1
- package/dist/client/assets/{tabs-Kstg5esT.js → tabs-DUhx-8IF.js} +1 -1
- package/dist/client/assets/{task-status-Z_8flBXc.js → task-status-DFEmNn74.js} +1 -1
- package/dist/client/assets/{textarea-D_FY-WF9.js → textarea-BPGbVVMl.js} +1 -1
- package/dist/client/assets/{toggle-group-TV66K5Bs.js → toggle-group-BfG9xkbE.js} +1 -1
- package/dist/client/assets/{toolbar-CCbum7s0.js → toolbar-BPieulY0.js} +1 -1
- package/dist/client/assets/{tools-list-De2JTKaU.js → tools-list-CIW2H0pK.js} +1 -1
- package/dist/client/assets/{tooltip-CnO8IxhJ.js → tooltip-CP-z2SMr.js} +1 -1
- package/dist/client/assets/{types-yqsHoQS8.js → types-BJ-5cxEn.js} +1 -1
- package/dist/client/assets/{use-ai-providers-D41Ncdap.js → use-ai-providers-DVIU4P_O.js} +1 -1
- package/dist/client/assets/{use-automations-Cjo8cUaV.js → use-automations-Bk9hBchQ.js} +1 -1
- package/dist/client/assets/{use-capability-km64e2ng.js → use-capability-B3WgU_BM.js} +1 -1
- package/dist/client/assets/{use-clock-tick-C5MmRZ_O.js → use-clock-tick-BE1ti_P6.js} +1 -1
- package/dist/client/assets/{use-collections-Boao6GlT.js → use-collections-C6K7HiKC.js} +1 -1
- package/dist/client/assets/{use-connection-D0BF0adZ.js → use-connection-CdNtREc0.js} +1 -1
- package/dist/client/assets/{use-copy-94yZW0qP.js → use-copy-C7ldw35i.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-qtUnoDxA.js → use-create-virtual-mcp-BMS7n6cR.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-Dj71wv9y.js → use-debounced-autosave-HbVrHLRr.js} +1 -1
- package/dist/client/assets/{use-delete-connection-C5suM6o1.js → use-delete-connection-Duc7McKG.js} +1 -1
- package/dist/client/assets/{use-file-configs-CwuLM8jQ.js → use-file-configs-CI3erTmG.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-WoD-e-vZ.js → use-infinite-scroll-lE5DyB4V.js} +1 -1
- package/dist/client/assets/{use-list-state-D--hQu1j.js → use-list-state-CMFnd3Oy.js} +1 -1
- package/dist/client/assets/{use-mcp-client-DnHVNKKy.js → use-mcp-client-DwO1EFjM.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-B7lJiQ-b.js → use-mcp-prompts-BN2gexTA.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-Dduxk9LO.js → use-mcp-tools-_vJ0O06D.js} +1 -1
- package/dist/client/assets/{use-members-YdskzoCL.js → use-members-D1_PBuic.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-VVlSVZf7.js → use-navigate-to-agent-BzfDvCxF.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-5GIyjJUc.js → use-org-auth-client-C1QanCOM.js} +1 -1
- package/dist/client/assets/{use-org-sso-DQRRc4kX.js → use-org-sso-DlN_ovBM.js} +1 -1
- package/dist/client/assets/{use-organization-roles-BJhlkkyb.js → use-organization-roles-BLETLE0M.js} +1 -1
- package/dist/client/assets/{use-organization-settings-BRHmZDz1.js → use-organization-settings-Dj_dvXX7.js} +1 -1
- package/dist/client/assets/{use-registry-connections-bQBnbYjF.js → use-registry-connections-D6i0DUa4.js} +1 -1
- package/dist/client/assets/{use-secrets-BYUtrbRD.js → use-secrets-CCAdfHn3.js} +1 -1
- package/dist/client/assets/{use-status-sounds-Biot_m4f.js → use-status-sounds-jo50KXQn.js} +1 -1
- package/dist/client/assets/{use-view-mode-B-vBbI_P.js → use-view-mode-B1zw1a7h.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-kNQ4Vk7l.js → use-virtual-mcp-ByGSSo67.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-BkdWYvsC.js +1 -0
- package/dist/client/assets/{useRouterState-Clwac4xr.js → useRouterState-B2rlub2j.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-BtkoWce7.js +1 -0
- package/dist/client/assets/{user-D2dH1j5H.js → user-DFA5bLwB.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-BVJSd33i.js → view-mode-toggle-Da9r5sm2.js} +1 -1
- package/dist/client/assets/{watch-sse-pool-D12zGFzz.js → watch-sse-pool-E8Fmdoce.js} +1 -1
- package/dist/client/assets/{workflow-B3YzgEYC.js → workflow-BoryK4Hw.js} +1 -1
- package/dist/client/assets/workflow-detail-CohIXsi_.js +1 -0
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +345 -344
- package/dist/server/server.js +228 -228
- package/package.json +1 -1
- package/dist/client/assets/app-editor-CCjHHUIp.js +0 -1
- package/dist/client/assets/decopilot-sse-pool-yovdq4PK.js +0 -1
- package/dist/client/assets/page-seo-sheet-BTkQDLYa.js +0 -1
- package/dist/client/assets/project-app-view-DfsCN7aU.js +0 -1
- package/dist/client/assets/record-editor-5_5cQlbY.js +0 -1
- package/dist/client/assets/registry-BjxgsC2E.js +0 -2
- package/dist/client/assets/save-referenced-block-0RMjuyn4.js +0 -1
- package/dist/client/assets/store-registry-JGeWcmph.js +0 -2
- package/dist/client/assets/useInfiniteQuery-DG9NlZam.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-D1V_0Wrc.js +0 -1
- package/dist/client/assets/workflow-detail-CXTSi8aj.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sections-editor-
|
|
2
|
-
import{e as K,r as E,c as he,j as n,l as Ce,p as Pe,b as Js,E as Ut,f as ts,d as zo,g as Dc,o as $u,L as zu,m as Zs,K as Bt,q as Fu,n as le,B as re,s as Ic,v as Hu,V as Wu,t as Ae,w as Bc,x as Uu,y as Zr,z as Mi,C as vt,D as Ku,F as Qs,G as Mc,H as Vu,I as qu,J as Qr,M as Gu,a as ei,P as gr,Q as Si,R as Tt,_ as qt}from"./index-DEUVODq9.js";import{C as Oe,a as Yu,b as ti,h as Xu,w as Ju,c as Lc,u as Fo,s as Hn,T as Zu,d as Qu,g as ef,e as tf,f as sf}from"./agent-capabilities-C3MTl0Im.js";import{a as Ns,b as ss,c as en,d as Oc,u as rf,t as nf,e as of}from"./chat-context-BG_brbim.js";import{g as Ho,u as ft,S as $c,a as Wo}from"./use-mcp-client-DnHVNKKy.js";import{u as Mt,a as af,b as lf,c as cf}from"./use-virtual-mcp-kNQ4Vk7l.js";import{i as Ki}from"./AlertCircle-DU4Czymb.js";import{i as zc}from"./CheckCircle-B7_GaGqy.js";import{n as Ha}from"./ChevronLeft-BLmY09V7.js";import{i as hf,a as df}from"./XCircle-8_cOsjUY.js";import{s as ps}from"./XClose-CCKAliKU.js";import{c as uf,u as ff,a as Fc,O as mf,t as Wa,G as pf,g as _f,s as gf,C as vf,b as xf,d as bf}from"./pair-BGqqCdXk.js";import{I as Gt}from"./integration-icon-D3LrOIav.js";import{a as yf}from"./Users03-DH-6SNzV.js";import{t as Es}from"./ChevronDown-CMnvnfNH.js";import{u as Hc}from"./use-ai-providers-D41Ncdap.js";import{u as Sf,g as Vi,A as wf}from"./sortable.esm-B6mcz4jC.js";import{r as Cf,u as Uo,i as kf}from"./shell-layout-D-knukkt.js";import{b as jf,a as Nf}from"./shell-route-loading-BQnWeFBU.js";import{u as Ef}from"./sidebar-DMarnfZA.js";import{S as Tf,a as Rf,b as Pf}from"./sheet-C2l8o7Li.js";import{u as Wc,T as Ee,a as Te,b as Re,c as Uc}from"./tooltip-CnO8IxhJ.js";import{i as Li,a as tn,b as Kc,c as Af,p as sn,g as rn,d as Ko,e as Vc,h as Wn,f as _n,j as Ua,A as Ka,k as Df,l as If,m as Bf,n as Mf,o as Lf,q as Of,t as $f,r as zf,s as Ff,u as Hf,v as nn,w as Wf,x as Va,y as qa,z as Uf,B as Kf,C as Vf,D as qf,E as Vo,F as Nr,G as qo,H as qc,I as Gc,J as Gf,K as Yf,L as Xf,M as Jf,N as Zf,O as Ga,P as Qf,Q as em,R as Ri,S as tm,T as Yc,U as Xc,V as sm}from"./agent-icon-CV7VKepg.js";import{u as im}from"./use-status-sounds-Biot_m4f.js";import{E as Er}from"./empty-state-DZZ4TCiB.js";import{u as rm,r as Un,a as nm,p as Jc,f as Ya,b as Zc,c as Qc,d as eh,e as om,F as am,i as lm,g as cm,h as hm,j as dm}from"./tab-id-BxH9ETDC.js";import{T as Xa,a as Kn}from"./toolbar-CCbum7s0.js";import{R as th,a as um,b as fm}from"./resizable-DV0pCXfQ.js";import{i as qi,n as mm}from"./Globe01-bYDzICLJ.js";import{i as sh}from"./Monitor01-6PVrucyX.js";import{u as Gi,a as Go,b as ih}from"./use-connection-D0BF0adZ.js";import{u as Yi}from"./studio-tools-DnIG9YV2.js";import{u as on,a as pm,b as _m}from"./use-mcp-tools-Dduxk9LO.js";import{u as gm}from"./use-capability-km64e2ng.js";import{F as Oi,M as Yo}from"./file-type-icon-BAmjNPBc.js";import{u as vm,a as xm,b as bm,c as ym,g as Sm,d as rh,e as Ja,F as wm,f as Cm,h as km,i as jm,j as Nm,k as Em,H as Tm,l as Rm}from"./header-tab-button-CRRaGYWH.js";import{i as Vn,a as nh,b as Pm}from"./ZoomOut-DfX9NmNO.js";import{P as Ts,a as Rs,b as Ps}from"./popover-D6gDvvex.js";import{S as Xo}from"./spinner-CZkJwfre.js";import{D as As,a as Ds,b as Is,c as He,d as qn,e as Gn,f as Yn,g as vr}from"./dropdown-menu-BUlN28jb.js";import{D as Lt,a as Ot,b as is,c as rs,d as si,e as Jo}from"./dialog-FBdtBd0W.js";import{I as qe}from"./input-CkGEzOB_.js";import{T as ys,a as Zo,b as Pi,c as Qo}from"./tabs-Kstg5esT.js";import{T as Tr}from"./textarea-D_FY-WF9.js";import{a as Qt,s as Am}from"./Eye-CYtfD-C-.js";import{t as Ss}from"./Stars01-BBldOY4r.js";import{l as Dm,w as Im}from"./index-CwjMi0Lt.js";import{i as Bm}from"./ChevronRight-DtVYtVbK.js";import{g as Mm}from"./generate-id-CKNg3Kb_.js";import{g as Lm}from"./types-yqsHoQS8.js";import{U as oh}from"./user-D2dH1j5H.js";import{T as Om,u as ah}from"./tools-list-De2JTKaU.js";import{a as $m,i as Za}from"./mcp-oauth-ClRecFEf.js";import{s as lh,g as zm}from"./connection-slug-eyAPH6o3.js";import{A as Rr,a as Pr,b as Ar,c as Dr,d as Ir,e as Br,f as Mr,g as Lr}from"./alert-dialog-CjyXYSQZ.js";import{C as ch,a as Xn}from"./card-B0-N4bpb.js";import{L as jt}from"./label-CxhkSBar.js";import{S as Pt,a as At,b as Dt,c as nt,d as It}from"./select-Dyn5eJ76.js";import{S as Or}from"./switch-DZavAgGZ.js";import{i as Vs}from"./Play-B0CTz7-g.js";import{s as xt}from"./Plus-DW_pro4F.js";import{a as Fm}from"./Settings02-BzBPnOVl.js";import{s as qs}from"./Trash01-BfygLm6s.js";import{u as $r}from"./use-debounced-autosave-Dj71wv9y.js";import{S as an}from"./scroll-area-CHs0jTz4.js";import{i as $i}from"./SearchMd-BnZZ5mEU.js";import{i as Hm}from"./Upload01-ClElEXYw.js";import{i as Wm}from"./LayoutLeft-Cy-bGbAH.js";import{P as Rt}from"./index-CiklrCzm.js";import{C as ln}from"./checkbox-BjUgAWJu.js";import{S as hh}from"./search-input-DLDVTOcp.js";import{C as dh}from"./collection-tabs-DM_bzUmO.js";import{u as Um}from"./use-mcp-prompts-B7lJiQ-b.js";import{D as Km,a as Vm,b as qm}from"./drawer-CSp117Rg.js";import{i as ii}from"./Check-CFZ7jofS.js";import{i as ea}from"./Key01-CDcV65YU.js";import{S as uh}from"./skeleton-CBG5UooE.js";import{s as Gm}from"./User01-Bi6i4zOy.js";import{t as ta}from"./Users01-BXIkeJej.js";import{u as Ym,a as Xm}from"./use-secrets-BYUtrbRD.js";import{G as Jm}from"./github-repo-picker-BXMy0hpf.js";import{f as Zm}from"./formatDistanceToNow-Cb2QZZJn.js";import{n as ri}from"./LinkExternal01-BDXPmxri.js";import{A as Qm,a as ep,b as tp,c as sp}from"./accordion-x86xWE4B.js";import{s as Gs}from"./Star01-CjQzvxTy.js";import{i as fh}from"./Stars02-COgJsT25.js";import{V as ip}from"./view-mode-toggle-BVJSd33i.js";import{n as mh}from"./ZapSquare-Dj9sWt3u.js";import{i as sa,a as rp,b as ia}from"./Tool01-BKl-GVq3.js";import{c as ph,i as np}from"./SwitchHorizontal01-BQBOH6Au.js";import{B as op}from"./badge-Bw9vN6fg.js";import{C as ap,a as Qa,b as lp,c as cp,d as hp,e as dp}from"./command-CSF0stL5.js";import{M as up}from"./select-model-BNZKyxON.js";import{u as Xi,a as fp,b as mp,c as pp,d as _p}from"./use-automations-Cjo8cUaV.js";import{i as _h}from"./RefreshCcw01-B9XxpyTk.js";import{i as zi}from"./Zap-DMSK7ZyR.js";import{M as gp}from"./monaco-editor-CiwloXdm.js";import{A as vp}from"./automation-runs-CAE5s4jH.js";import{A as xp}from"./automation-list-row-ZsMhYjFo.js";import{i as bp}from"./X-BUzk9ZuQ.js";function ui(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function el(t){if(!t)return"—";const e=typeof t=="string"?new Date(t):t;return isNaN(e.getTime())?"—":e.toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function yp(t){return t?t.replace(/-\d{8}(?:-[a-z0-9]+)*$/i,"").replace(/-/g," "):"—"}function Sp(t){const e=K.c(4),{items:s}=t;let i;e[0]!==s?(i=s.map(wp),e[0]=s,e[1]=i):i=e[1];let r;return e[2]!==i?(r=n.jsx("div",{className:"grid grid-cols-2 gap-x-8 gap-y-6",children:i}),e[2]=i,e[3]=r):r=e[3],r}function wp(t){return n.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[n.jsx("span",{className:"text-xs text-muted-foreground truncate",children:t.label}),n.jsx("span",{className:"text-sm text-foreground tabular-nums truncate",children:t.value})]},t.label)}function Cp(t){const e=K.c(30),{userTokens:s,assistantTokens:i,otherTokens:r}=t,o=s+i+r,a=o>0?s/o*100:0,l=o>0?i/o*100:0,h=o>0?r/o*100:0;let c;e[0]!==a?(c=a>0&&n.jsx("div",{className:"h-full bg-chart-1",style:{width:`${a}%`}}),e[0]=a,e[1]=c):c=e[1];let d;e[2]!==l?(d=l>0&&n.jsx("div",{className:"h-full bg-chart-2",style:{width:`${l}%`}}),e[2]=l,e[3]=d):d=e[3];let u;e[4]!==h?(u=h>0&&n.jsx("div",{className:"h-full bg-muted-foreground/30",style:{width:`${h}%`}}),e[4]=h,e[5]=u):u=e[5];let f;e[6]!==c||e[7]!==d||e[8]!==u?(f=n.jsxs("div",{className:"flex h-2 w-full overflow-hidden rounded-full bg-muted",children:[c,d,u]}),e[6]=c,e[7]=d,e[8]=u,e[9]=f):f=e[9];let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-1 shrink-0"}),e[10]=m):m=e[10];let p;e[11]!==a?(p=a.toFixed(1),e[11]=a,e[12]=p):p=e[12];let _;e[13]!==p?(_=n.jsxs("div",{className:"flex items-center gap-1.5",children:[m,n.jsxs("span",{className:"text-xs text-muted-foreground",children:["User ",p,"%"]})]}),e[13]=p,e[14]=_):_=e[14];let g;e[15]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-2 shrink-0"}),e[15]=g):g=e[15];let v;e[16]!==l?(v=l.toFixed(1),e[16]=l,e[17]=v):v=e[17];let b;e[18]!==v?(b=n.jsxs("div",{className:"flex items-center gap-1.5",children:[g,n.jsxs("span",{className:"text-xs text-muted-foreground",children:["Assistant ",v,"%"]})]}),e[18]=v,e[19]=b):b=e[19];let x;e[20]!==h||e[21]!==r?(x=r>0&&n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-muted-foreground/30 shrink-0"}),n.jsxs("span",{className:"text-xs text-muted-foreground",children:["Other ",h.toFixed(1),"%"]})]}),e[20]=h,e[21]=r,e[22]=x):x=e[22];let y;e[23]!==b||e[24]!==x||e[25]!==_?(y=n.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:[_,b,x]}),e[23]=b,e[24]=x,e[25]=_,e[26]=y):y=e[26];let w;return e[27]!==y||e[28]!==f?(w=n.jsxs("div",{className:"flex flex-col gap-2",children:[f,y]}),e[27]=y,e[28]=f,e[29]=w):w=e[29],w}function kp(t){const e=K.c(11),{agentId:s,isError:i}=t,r=Mt(s),o=r?.title??"Subtask",a=r?.icon??null;let l;e[0]!==a||e[1]!==o?(l=n.jsx(Gt,{icon:a,name:o,size:"xs",className:"size-6 rounded-md shrink-0"}),e[0]=a,e[1]=o,e[2]=l):l=e[2];const h=i?"text-destructive":"text-foreground";let c;e[3]!==h?(c=he("shrink-0 font-medium",h),e[3]=h,e[4]=c):c=e[4];let d;e[5]!==o||e[6]!==c?(d=n.jsx("span",{className:c,children:o}),e[5]=o,e[6]=c,e[7]=d):d=e[7];let u;return e[8]!==l||e[9]!==d?(u=n.jsxs(n.Fragment,{children:[l,d]}),e[8]=l,e[9]=d,e[10]=u):u=e[10],u}function jp(t){const e=K.c(5),{isError:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(Gt,{icon:null,name:"Subtask",size:"xs",className:"size-6 rounded-md shrink-0"}),e[0]=i):i=e[0];const r=s?"text-destructive":"text-foreground";let o;e[1]!==r?(o=he("shrink-0 font-medium",r),e[1]=r,e[2]=o):o=e[2];let a;return e[3]!==o?(a=n.jsxs(n.Fragment,{children:[i,n.jsx("span",{className:o,children:"Subtask"})]}),e[3]=o,e[4]=a):a=e[4],a}function Np(t){const e=K.c(18),{part:s}=t,i=s.input?.agent_id,r=s.state==="input-streaming"||s.state==="input-available"||s.state==="output-available"&&s.preliminary===!0,o=s.state==="output-error",a=s.state==="approval-requested";let l;e[0]!==o?(l=n.jsx(jp,{isError:o}),e[0]=o,e[1]=l):l=e[1];let h;e[2]!==i||e[3]!==o?(h=n.jsx(kp,{agentId:i,isError:o}),e[2]=i,e[3]=o,e[4]=h):h=e[4];let c;e[5]!==l||e[6]!==h?(c=n.jsx(E.Suspense,{fallback:l,children:h}),e[5]=l,e[6]=h,e[7]=c):c=e[7];let d;e[8]!==s.input?(d=s.input?.prompt&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-muted-foreground/50",children:"·"}),n.jsx("span",{className:"truncate text-muted-foreground",children:s.input.prompt})]}),e[8]=s.input,e[9]=d):d=e[9];let u;e[10]!==a||e[11]!==o||e[12]!==r?(u=n.jsx("span",{className:"ml-auto shrink-0",children:r?n.jsx(Ce,{size:12,className:"animate-spin text-muted-foreground"}):o?n.jsx(hf,{size:12,className:"text-destructive"}):a?n.jsx(Ki,{size:12,className:"text-warning"}):n.jsx(zc,{size:12,className:"text-emerald-500"})}),e[10]=a,e[11]=o,e[12]=r,e[13]=u):u=e[13];let f;return e[14]!==c||e[15]!==d||e[16]!==u?(f=n.jsxs("div",{className:"flex items-center gap-2 text-xs min-w-0",children:[c,d,u]}),e[14]=c,e[15]=d,e[16]=u,e[17]=f):f=e[17],f}function Ep(t){const e=K.c(55),{onClose:s,back:i,className:r}=t,[o,a]=E.useState(null),{messages:l}=Ns(),{activeTask:h}=ss(),{selectedModel:c,selectedVirtualMcp:d}=en();let u,f,m,p,_,g,v,b;if(e[0]!==h||e[1]!==i||e[2]!==r||e[3]!==l||e[4]!==s||e[5]!==o?.id||e[6]!==c||e[7]!==d?.title){b=Symbol.for("react.early_return_sentinel");e:{const w=uf(l),k=[...l].reverse().find($p),j=k?.metadata?.usage,R=k?.metadata?.modelLimits?.contextWindow??c?.limits?.contextWindow??null,I=j?.contextTokens??0,P=R&&R>0?(I/R*100).toFixed(1):null,T=l;let S;e[16]!==T?(S=T.filter(Op).reduce(Lp,0),e[16]=T,e[17]=S):S=e[17];const C=S,D=l;let N;e[18]!==D?(N=D.filter(Mp).reduce(Bp,0),e[18]=D,e[19]=N):N=e[19];const A=N,M=Math.max(0,w.totalTokens-C-A),B=l[0],L=l.at(-1),O=B?.metadata?.created_at??h?.created_at,W=L?.metadata?.created_at??h?.updated_at,F=l.filter(Ip),V=l.flatMap(Ap),J=c?.modelId?yp(c.modelId):"—",G=d?.title??"Decopilot",U=[{label:"Session",value:h?.title??"New chat"},{label:"Messages",value:F.length},{label:"Agent",value:G},{label:"Model",value:J},{label:"Context Limit",value:R?ui(R):"—"},{label:"Session Tokens (billed)",value:w.totalTokens>0?ui(w.totalTokens):"0"},{label:"Usage",value:P!==null?`${P}%`:"—"},{label:"Input Tokens",value:w.inputTokens>0?ui(w.inputTokens):"0"},{label:"Output Tokens",value:w.outputTokens>0?ui(w.outputTokens):"0"},{label:"Reasoning Tokens",value:w.reasoningTokens>0?ui(w.reasoningTokens):"0"},{label:"Cost",value:w.cost>0?`$${w.cost<.001?w.cost.toFixed(6):w.cost.toFixed(4)}`:"$0.00"},{label:"Session Created",value:el(O)},{label:"Last Activity",value:el(W)}];if(!h&&F.length===0){let $;e[20]!==r?($=he("flex flex-col h-full w-full border-l border-border bg-background",r),e[20]=r,e[21]=$):$=e[21];let se;e[22]===Symbol.for("react.memo_cache_sentinel")?(se=n.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[22]=se):se=e[22];let ee;e[23]!==i?(ee=i?n.jsx(Ha,{size:14,className:"text-muted-foreground"}):n.jsx(ps,{size:14,className:"text-muted-foreground"}),e[23]=i,e[24]=ee):ee=e[24];let Q;e[25]!==s||e[26]!==ee?(Q=n.jsxs("div",{className:"h-11 px-4 flex items-center justify-between shrink-0 border-b border-border/50",children:[se,n.jsx("button",{type:"button",onClick:s,className:"flex size-6 items-center justify-center rounded hover:bg-accent transition-colors",children:ee})]}),e[25]=s,e[26]=ee,e[27]=Q):Q=e[27];let z;e[28]===Symbol.for("react.memo_cache_sentinel")?(z=n.jsx("div",{className:"flex-1 flex items-center justify-center px-4 text-center",children:n.jsx("p",{className:"text-xs text-muted-foreground",children:"Start a conversation to see context"})}),e[28]=z):z=e[28];let ce;e[29]!==$||e[30]!==Q?(ce=n.jsxs("div",{className:$,children:[Q,z]}),e[29]=$,e[30]=Q,e[31]=ce):ce=e[31],b=ce;break e}e[32]!==r?(g=he("flex flex-col h-full w-full border-l border-border bg-background overflow-y-auto",r),e[32]=r,e[33]=g):g=e[33];let H;e[34]===Symbol.for("react.memo_cache_sentinel")?(H=n.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[34]=H):H=e[34];let X;e[35]!==i?(X=i?n.jsx(Ha,{size:14}):n.jsx(ps,{size:14}),e[35]=i,e[36]=X):X=e[36],e[37]!==s||e[38]!==X?(v=n.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between border-b border-border/50 px-4",children:[H,n.jsx("button",{type:"button",onClick:s,className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:X})]}),e[37]=s,e[38]=X,e[39]=v):v=e[39],u="flex flex-col gap-8 p-6",f=V.length>0&&n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("span",{className:"text-xs text-muted-foreground",children:"Subtasks"}),n.jsx("div",{className:"flex flex-col gap-1",children:V.map(Pp)})]}),m=n.jsx(Sp,{items:U});let oe;e[40]===Symbol.for("react.memo_cache_sentinel")?(oe=n.jsx("span",{className:"text-xs text-muted-foreground",children:"Context Breakdown"}),e[40]=oe):oe=e[40],e[41]!==A||e[42]!==M||e[43]!==C?(p=n.jsxs("div",{className:"flex flex-col gap-3",children:[oe,n.jsx(Cp,{userTokens:C,assistantTokens:A,otherTokens:M})]}),e[41]=A,e[42]=M,e[43]=C,e[44]=p):p=e[44],_=F.length>0&&n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("span",{className:"text-xs text-muted-foreground",children:"Raw messages"}),n.jsx("div",{className:"flex flex-col gap-1",children:F.map($=>{const se=$.metadata?.created_at,ee=o?.id===$.id;return n.jsxs("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[n.jsxs("button",{type:"button",onClick:()=>a(ee?null:$),className:"flex items-center justify-between gap-2 px-3 py-2 text-xs hover:bg-accent/50 w-full text-left cursor-pointer",children:[n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx("span",{className:he("shrink-0 font-medium",$.role==="user"?"text-chart-1":"text-chart-2"),children:$.role}),n.jsx("span",{className:"text-muted-foreground",children:"•"}),n.jsx("span",{className:"truncate text-muted-foreground font-mono",children:$.id})]}),se&&n.jsx("span",{className:"shrink-0 text-muted-foreground tabular-nums",children:new Date(se).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})})]}),ee&&n.jsxs(n.Fragment,{children:[$.role==="assistant"&&(()=>{const Q=$.metadata?._request;if(!Q)return null;const z=Q.systemSections??[],ce=Math.max(1,...z.map(Rp)),ue=z.reduce(Tp,0);return n.jsxs("div",{className:"border-t border-border/50 px-3 py-2.5 text-xs space-y-2.5",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"font-medium text-foreground",children:"Request"}),n.jsxs("span",{className:"text-muted-foreground tabular-nums",children:[Q.activeTools??0," / ",Q.tools??0," ","tools active"]})]}),z.length>0&&n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("div",{className:"text-muted-foreground",children:["System prompt"," ",n.jsxs("span",{className:"tabular-nums",children:["~",Math.round(ue/4).toLocaleString()," ","tok"]})]}),z.map((fe,q)=>{const te=fe.preview.match(/^<([a-z-]+)/i)?.[1]??`section ${q}`,me=fe.chars/ce*100,ne=Math.round(fe.chars/4);return n.jsxs("div",{className:"space-y-0.5",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsx("span",{className:"font-mono text-foreground truncate",children:te}),n.jsxs("span",{className:"text-muted-foreground tabular-nums shrink-0",children:["~",ne.toLocaleString()," tok"]})]}),n.jsx("div",{className:"h-1 w-full rounded-full bg-muted overflow-hidden",children:n.jsx("div",{className:"h-full rounded-full bg-chart-3",style:{width:`${me}%`}})})]},q)})]})]})})(),n.jsx("pre",{className:"text-xs font-mono bg-muted px-3 py-2 overflow-auto whitespace-pre-wrap break-all border-t border-border/50 max-h-64",children:JSON.stringify($,null,2)})]})]},$.id)})})]})}e[0]=h,e[1]=i,e[2]=r,e[3]=l,e[4]=s,e[5]=o?.id,e[6]=c,e[7]=d?.title,e[8]=u,e[9]=f,e[10]=m,e[11]=p,e[12]=_,e[13]=g,e[14]=v,e[15]=b}else u=e[8],f=e[9],m=e[10],p=e[11],_=e[12],g=e[13],v=e[14],b=e[15];if(b!==Symbol.for("react.early_return_sentinel"))return b;let x;e[45]!==u||e[46]!==f||e[47]!==m||e[48]!==p||e[49]!==_?(x=n.jsxs("div",{className:u,children:[f,m,p,_]}),e[45]=u,e[46]=f,e[47]=m,e[48]=p,e[49]=_,e[50]=x):x=e[50];let y;return e[51]!==g||e[52]!==v||e[53]!==x?(y=n.jsxs("div",{className:g,children:[v,x]}),e[51]=g,e[52]=v,e[53]=x,e[54]=y):y=e[54],y}function Tp(t,e){return t+e.chars}function Rp(t){return t.chars}function Pp(t,e){return n.jsx(Np,{part:t},e)}function Ap(t){return(t.parts??[]).filter(Dp)}function Dp(t){return t.type==="tool-subtask"}function Ip(t){return t.role!=="system"}function Bp(t,e){const s=e.metadata?.usage;return t+(s?.outputTokens??0)}function Mp(t){return t.role==="assistant"}function Lp(t,e){const s=e.metadata?.usage;return t+(s?.inputTokens??0)}function Op(t){return t.role==="user"}function $p(t){return t.role==="assistant"&&t.metadata?.usage}function zp(t){const e=K.c(13),{readOnly:s,identity:i,aboveRow:r,input:o,iceBreakers:a}=t,l=!s&&i?i:null;let h;e[0]!==r||e[1]!==s?(h=!s&&r?n.jsx("div",{"data-chat-above-row":"true",className:"@container/chat-bottom flex justify-start gap-1",children:r}):null,e[0]=r,e[1]=s,e[2]=h):h=e[2];let c;e[3]!==o||e[4]!==h?(c=n.jsxs("div",{className:"flex flex-col gap-2",children:[h,o]}),e[3]=o,e[4]=h,e[5]=c):c=e[5];let d;e[6]!==a||e[7]!==s?(d=!s&&a?n.jsx("div",{className:"w-full",children:a}):null,e[6]=a,e[7]=s,e[8]=d):d=e[8];let u;return e[9]!==l||e[10]!==c||e[11]!==d?(u=n.jsx("div",{"data-chat-centered":"true",className:"h-full w-full flex flex-col items-center justify-center px-4 gap-6",children:n.jsxs("div",{className:"w-full max-w-3xl flex flex-col gap-6",children:[l,c,d]})}),e[9]=l,e[10]=c,e[11]=d,e[12]=u):u=e[12],u}function Fp(t){const e=K.c(25),{onOpenContextPanel:s}=t,{org:i}=Pe(),{selectedVirtualMcp:r}=en();let o;e[0]!==i.id?(o=Ho(i.id),e[0]=i.id,e[1]=o):o=e[1];const l=r??o,h=Mt(l.id),c=Oc(),{data:d}=Js.useSession(),u=d?.user?.id,f=c?.activeTask??null,m=!!(u&&f?.created_by&&f.created_by!==u);let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx(yf,{size:32}),e[2]=p):p=e[2];let _;e[3]!==l.icon||e[4]!==l.title?(_=n.jsx(Gt,{icon:l.icon,name:l.title,size:"lg",fallbackIcon:p,className:"size-10 min-w-10 md:size-[60px]! md:min-w-[60px] rounded-xl md:rounded-[18px]!"}),e[3]=l.icon,e[4]=l.title,e[5]=_):_=e[5];let g;e[6]!==l.title?(g=n.jsx("h3",{className:"text-base md:text-xl font-medium text-foreground",children:l.title}),e[6]=l.title,e[7]=g):g=e[7];const v=l.description??"Ask anything about configuring model providers or using MCP Mesh.";let b;e[8]!==v?(b=n.jsx("div",{className:"text-muted-foreground text-center text-base max-w-md line-clamp-2",children:v}),e[8]=v,e[9]=b):b=e[9];let x;e[10]!==_||e[11]!==g||e[12]!==b?(x=n.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 md:gap-4 text-center",children:[_,g,b]}),e[10]=_,e[11]=g,e[12]=b,e[13]=x):x=e[13];const y=c?.currentBranch??null;let w;e[14]!==h||e[15]!==y?(w=n.jsx(Yu,{virtualMcp:h,currentBranch:y}),e[14]=h,e[15]=y,e[16]=w):w=e[16];let k;e[17]!==s?(k=n.jsx(Oe.Input,{onOpenContextPanel:s}),e[17]=s,e[18]=k):k=e[18];let j;e[19]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx(Oe.IceBreakers,{}),e[19]=j):j=e[19];let R;return e[20]!==m||e[21]!==k||e[22]!==x||e[23]!==w?(R=n.jsx(zp,{readOnly:m,identity:x,aboveRow:w,input:k,iceBreakers:j}),e[20]=m,e[21]=k,e[22]=x,e[23]=w,e[24]=R):R=e[24],R}function tl(t){const e=K.c(17),{outputs:s,collapsed:i,onToggle:r,variant:o}=t,a=o==="card"?"rounded-xl border border-border bg-muted/95 shadow-sm backdrop-blur-sm":"border-b border-border bg-background";let l;e[0]!==a?(l=he(a),e[0]=a,e[1]=l):l=e[1];let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx("span",{className:"text-sm font-medium text-foreground",children:"Files in this task"}),e[2]=h):h=e[2];const c=i&&"-rotate-90";let d;e[3]!==c?(d=he("size-4 text-muted-foreground transition-transform",c),e[3]=c,e[4]=d):d=e[4];let u;e[5]!==d?(u=n.jsx(Es,{className:d}),e[5]=d,e[6]=u):u=e[6];let f;e[7]!==r||e[8]!==u?(f=n.jsxs("button",{type:"button",onClick:r,className:"flex w-full items-center justify-between px-3 py-2.5 text-left",children:[h,u]}),e[7]=r,e[8]=u,e[9]=f):f=e[9];let m;e[10]!==i||e[11]!==s?(m=!i&&n.jsx("div",{className:"flex max-h-72 flex-col gap-1.5 overflow-y-auto px-2 pb-2",children:s.map(Hp)}),e[10]=i,e[11]=s,e[12]=m):m=e[12];let p;return e[13]!==l||e[14]!==f||e[15]!==m?(p=n.jsxs("div",{className:l,children:[f,m]}),e[13]=l,e[14]=f,e[15]=m,e[16]=p):p=e[16],p}function Hp(t){return n.jsx(mf,{file:t},t.key)}function Wp(){const t=K.c(13),e=Oc()?.taskId??null,s=ff();let i;t[0]!==s?(i={enabled:s},t[0]=s,t[1]=i):i=t[1];const{data:r}=Fc(e,i),[o,a]=E.useState(!1),[l,h]=E.useState(!0);if(!e||!r||r.length===0)return null;let c;t[2]===Symbol.for("react.memo_cache_sentinel")?(c=()=>a(Kp),t[2]=c):c=t[2];let d;t[3]!==o||t[4]!==r?(d=n.jsx("div",{className:"absolute top-2 right-2 z-10 hidden w-72 @[1280px]:block",children:n.jsx(tl,{variant:"card",outputs:r,collapsed:o,onToggle:c})}),t[3]=o,t[4]=r,t[5]=d):d=t[5];let u;t[6]===Symbol.for("react.memo_cache_sentinel")?(u=()=>h(Up),t[6]=u):u=t[6];let f;t[7]!==l||t[8]!==r?(f=n.jsx("div",{className:"shrink-0 @[1280px]:hidden",children:n.jsx(tl,{variant:"bar",outputs:r,collapsed:l,onToggle:u})}),t[7]=l,t[8]=r,t[9]=f):f=t[9];let m;return t[10]!==d||t[11]!==f?(m=n.jsxs(n.Fragment,{children:[d,f]}),t[10]=d,t[11]=f,t[12]=m):m=t[12],m}function Up(t){return!t}function Kp(t){return!t}function Vp(){const t=K.c(28),{org:e}=Pe(),s=Hc(),{isChatEmpty:i}=Ns(),[r,o]=E.useState("chat"),a=Sf(),{selectedVirtualMcp:l}=en();let h;t[0]!==e.id?(h=Ho(e.id),t[0]=e.id,t[1]=h):h=t[1];const u=Mt((l??h).id),f=rf(),m=ti(u?.metadata);if(s.length===0&&!(m&&Xu(f))){let T;return t[2]===Symbol.for("react.memo_cache_sentinel")?(T=n.jsx(Oe,{className:"animate-in fade-in-0 duration-200",children:n.jsx(Oe.Main,{className:"flex flex-col items-center",children:n.jsx(Oe.EmptyState,{children:n.jsx(Oe.NoAiProviderEmptyState,{})})})}),t[2]=T):T=t[2],T}let _;t[3]!==a.hasDecoKey||t[4]!==a.hasOnlyDecoProvider||t[5]!==a.isLoading||t[6]!==a.isZeroBalance||t[7]!==i||t[8]!==e.id?(_=a.hasDecoKey&&a.isZeroBalance&&a.hasOnlyDecoProvider&&!a.isLoading&&i&&!Ju(e.id),t[3]=a.hasDecoKey,t[4]=a.hasOnlyDecoProvider,t[5]=a.isLoading,t[6]=a.isZeroBalance,t[7]=i,t[8]=e.id,t[9]=_):_=t[9];const g=_;let v;t[10]!==g?(v=g&&n.jsx(Oe.CreditsEmptyState,{}),t[10]=g,t[11]=v):v=t[11];const b=r!=="chat"?"opacity-0 pointer-events-none":"opacity-100";let x;t[12]!==b?(x=he("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",b),t[12]=b,t[13]=x):x=t[13];let y;t[14]!==i?(y=i?n.jsx(Oe.Main,{children:n.jsx(Fp,{onOpenContextPanel:()=>o("context")})}):n.jsxs(n.Fragment,{children:[n.jsxs(Oe.Main,{className:"relative flex flex-col overflow-hidden @container",children:[n.jsx(Wp,{}),n.jsx("div",{className:"min-h-0 flex-1",children:n.jsx(Oe.Messages,{})})]}),n.jsx(Oe.Footer,{children:n.jsx(Oe.Input,{onOpenContextPanel:()=>o("context")})})]}),t[14]=i,t[15]=y):y=t[15];let w;t[16]!==x||t[17]!==y?(w=n.jsx("div",{className:x,children:y}),t[16]=x,t[17]=y,t[18]=w):w=t[18];const k=r==="context"?"opacity-100":"opacity-0 pointer-events-none";let j;t[19]!==k?(j=he("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",k),t[19]=k,t[20]=j):j=t[20];let R;t[21]===Symbol.for("react.memo_cache_sentinel")?(R=n.jsx(Ep,{back:!0,onClose:()=>o("chat")}),t[21]=R):R=t[21];let I;t[22]!==j?(I=n.jsx("div",{className:j,children:R}),t[22]=j,t[23]=I):I=t[23];let P;return t[24]!==I||t[25]!==v||t[26]!==w?(P=n.jsxs(Oe,{className:"relative overflow-hidden animate-in fade-in-0 duration-200",children:[v,w,I]}),t[24]=I,t[25]=v,t[26]=w,t[27]=P):P=t[27],P}function gh(){const t=K.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(Oe.Skeleton,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(Ut,{fallback:e,children:n.jsx(E.Suspense,{fallback:n.jsx(Oe.Skeleton,{}),children:n.jsx(Vp,{})})}),t[1]=s):s=t[1],s}function qp(t){const e=t.entityMetadata?.defaultMainView??null,s=e==null||e.type==="chat",i=t.mainParamPresent?t.mainParamValue!=="0":!s,r=s?!0:t.entityMetadata?.chatDefaultOpen??!1;return{mainOpen:i,chatOpen:r}}function sl(t,e){return t&&e?{chat:45,main:55}:t&&!e?{chat:100,main:0}:!t&&e?{chat:0,main:100}:{chat:0,main:0}}function Gp(t,e){return t===1?!0:t===0?!1:e}function Yp(t,e){const s=ts(),i=zo({strict:!1}),r=Dc({strict:!1}),{create:o}=rm(),{locator:a}=Pe(),{virtualMcpId:l,orgSlug:h,isAgentRoute:c}=e,d=qp({entityMetadata:t,mainParamPresent:i.main!==void 0,mainParamValue:i.main}),u=Gp(i.chat,d.chatOpen),f=d.mainOpen,m=E.useRef(crypto.randomUUID()),p=r.taskId??m.current,_="/$org/$taskId",g=I=>({org:h,taskId:I}),v=c?{virtualmcpid:l}:{},b=(I,P)=>{s({to:_,params:g(p),search:T=>({...T,...I}),replace:P?.replace??!1})},x=(I,P)=>{s({to:_,params:g(I),search:T=>{const S={};return P?S.virtualmcpid=P:c&&(S.virtualmcpid=l),S}})},y=()=>{f?b({main:"0"},{replace:!0}):b({main:Un(t)},{replace:!0})},w=()=>{b({chat:u?0:1},{replace:!0})},k=()=>{u||b({chat:1},{replace:!0})},j=async()=>{const I=crypto.randomUUID(),P=Cf(h,a,p);try{await o({id:I,virtual_mcp_id:l,...P?{branch:P}:{}})}catch{}s({to:_,params:g(I),search:T=>({...v,chat:1})})},R=I=>{b({main:I},{replace:!0})};return{taskId:p,mainOpen:f,chatOpen:u,mainParam:i.main,setTaskId:x,toggleMain:y,toggleChat:w,openChat:k,createNewTask:j,openTab:R}}const ra=45;function vh(t,e=ra){const s=typeof t=="number"?t:Number(t);return!Number.isFinite(s)||s<=0||s>=100?e:s}function Xp(t){return vh(t,ra)}function Jp(){const t=K.c(6);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=zu.decoChatPanelWidth(),t[0]=e):e=t[0];const[s,i]=$u(e,Xp);let r;t[1]!==s?(r=vh(s,ra),t[1]=s,t[2]=r):r=t[2];const o=r;let a;return t[3]!==i||t[4]!==o?(a=[o,i],t[3]=i,t[4]=o,t[5]=a):a=t[5],a}function Zp(t){try{return JSON.parse(t)}catch{return null}}function Qp(t){if(!t||typeof t!="object")return null;const e=t,s=e.content?.find(o=>o.type==="text")?.text,i=s?Zp(s):null,r=e.structuredContent;return r==null?i:typeof r=="object"&&!Array.isArray(r)&&Object.keys(r).length===0?i??r:r}function Bs(t){const e=Qp(t);return e===null?null:e}function na(t){if(!t)return null;const e=t.match(/\/pull\/(\d+)\b/);if(!e)return null;const s=Number(e[1]);return Number.isFinite(s)&&s>0?s:null}function e_(t){if(!t||typeof t!="object")return null;const e=t.content?.find(r=>r.type==="text")?.text;if(!e)return null;const s=e.match(/https:\/\/github\.com\/[^\s"]+\/pull\/\d+/)?.[0],i=na(s);return!i||!s?null:{number:i,htmlUrl:s}}const il=/[\r\n<>]/,t_=/^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/;function Ji(t){const e=t?.userName?.trim();if(!e||il.test(e))return null;const s=t?.userEmail?.trim();return!s||il.test(s)?{userName:e}:t_.test(s)?{userName:e,userEmail:s}:{userName:e}}function s_(t){return t.split(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sections-editor-DbBhsr7i.js","assets/index-DY3w09IO.js","assets/index-DfYyH4IW.css","assets/ChevronDown-DSfDv5bM.js","assets/ChevronRight-DUK5EG42.js","assets/ChevronUp-B2AOL-eB.js","assets/agent-icon-EkftJS22.js","assets/AlertCircle-Dq_aRrSW.js","assets/Tool01-Ral5MrGT.js","assets/SwitchHorizontal01-Bx586qSV.js","assets/RefreshCcw01-BTpOd3eq.js","assets/XCircle-BtsHL-zm.js","assets/ArrowUpRight-DqDRBuPq.js","assets/ZapSquare-CC2nvo3M.js","assets/Users03-CVMsW27x.js","assets/CheckCircle-Dig2QFEV.js","assets/Check-CPgB6rV-.js","assets/ChevronLeft-BMz9RJK0.js","assets/DotsVertical-fPJfllxd.js","assets/Container-DYSoO3DG.js","assets/Eye-DeGxYDuW.js","assets/ZoomOut-qMWF_U2b.js","assets/Globe01-fLDIUsna.js","assets/FilterLines-aqXCKU8G.js","assets/Star01-BgW1n4hv.js","assets/Palette-B5LxNhpC.js","assets/HardDrive-BltsYt6F.js","assets/Stars02-Bqx_7EIE.js","assets/Key01-CmnuMzLg.js","assets/LayoutLeft-B_tQQStj.js","assets/LinkExternal01-D6r75PNf.js","assets/Monitor01-BU_pw8u6.js","assets/Sun-DtftEkuO.js","assets/Play-DTdPdnB9.js","assets/Plus-D6sxLshv.js","assets/SearchMd-DknOSDEF.js","assets/Settings02-p7bikFh4.js","assets/Shield01-B5ClLi5x.js","assets/Stars01-D1djCaFC.js","assets/Trash01-B7WGJ2nw.js","assets/Upload01-AmfCgYbd.js","assets/User01-D89IeLeJ.js","assets/Users01-xnT12U--.js","assets/XClose-Dm6CEeSb.js","assets/X-dT525xXh.js","assets/Zap-C3pKoqKe.js","assets/scroll-area-BA3CfjMX.js","assets/select-CJfXW58o.js","assets/tooltip-CP-z2SMr.js","assets/dialog-D-P_WrCO.js","assets/input-B0CkwMLk.js","assets/dropdown-menu-BryIJ5hv.js","assets/sortable.esm-Ce_JeqCX.js","assets/connection-slug-eyAPH6o3.js","assets/connection-card-ZvdtkJJd.js","assets/use-registry-connections-D6i0DUa4.js","assets/use-connection-CdNtREc0.js","assets/use-collections-C6K7HiKC.js","assets/use-mcp-client-DwO1EFjM.js","assets/auth-B-1Rly8q.js","assets/use-organization-settings-Dj_dvXX7.js","assets/useInfiniteQuery-BkdWYvsC.js","assets/use-infinite-scroll-lE5DyB4V.js","assets/extract-connection-data-DO4BrJRm.js","assets/generate-id-DOqX7377.js","assets/collections-b1mKioA2.js","assets/card-ClQPDYHu.js","assets/integration-icon-BeXMpMNo.js","assets/collection-search-CvzbdpDU.js","assets/collection-tabs-BIfSZj8G.js","assets/badge-aMsRW7zr.js","assets/drawer-BrWBKjeq.js","assets/form-CpPpKCx-.js","assets/label-PMquEo0-.js","assets/textarea-BPGbVVMl.js","assets/connection-form-helpers-Dp2dO8-Q.js","assets/useSuspenseInfiniteQuery-BtkoWce7.js","assets/mcp-oauth-BLYgYIFp.js","assets/studio-tools-Cf7jviAo.js","assets/use-ai-providers-DVIU4P_O.js","assets/schema-form-BBBCMCDT.js","assets/calendar-NDohjEqi.js","assets/popover-rsSc4pjV.js","assets/switch-BC30tIvN.js","assets/image-field-eyvwCWO2.js","assets/skeleton-dy-S0Sln.js","assets/tabs-DUhx-8IF.js","assets/use-file-configs-CI3erTmG.js","assets/page-seo-form-D9Rrhk6O.js","assets/command-CWMX2Bpj.js","assets/index-CDQHOM5R.js","assets/add-section-modal-D5ohv1eA.js","assets/agent-capabilities-DiDonrOV.js","assets/chat-context-TGvyfVIv.js","assets/tab-id-l7bxIuE5.js","assets/watch-sse-pool-E8Fmdoce.js","assets/decopilot-sse-pool-ClIo9zhJ.js","assets/use-virtual-mcp-ByGSSo67.js","assets/pair-D_DFqq5L.js","assets/use-clock-tick-BE1ti_P6.js","assets/differenceInSeconds-NQ4PDo0z.js","assets/use-copy-C7ldw35i.js","assets/file-type-icon-BsYj2eA6.js","assets/content-blocks-o63cs2vh.js","assets/types-BJ-5cxEn.js","assets/shell-layout-IynSY8E5.js","assets/avatar-CBOuLXvr.js","assets/required-auth-layout-DeD5TVah.js","assets/useRouterState-B2rlub2j.js","assets/use-org-sso-DlN_ovBM.js","assets/use-navigate-to-agent-BzfDvCxF.js","assets/use-mcp-prompts-BN2gexTA.js","assets/spinner-sPXohOHa.js","assets/toggle-group-BfG9xkbE.js","assets/connect-desktop-dialog-4lXqvbrN.js","assets/decopilot-TdiWgZdM.js","assets/checkbox-CVg5TV-K.js","assets/ai-providers-logos-DD3qZ33J.js","assets/settings-section-BdfBdt9H.js","assets/index-B_vlfh4p.js","assets/question-004-sINsf4GQ.js","assets/shell-route-loading-Cmr_pTbg.js","assets/sidebar-BFnxxrth.js","assets/sheet-DovmEFQe.js","assets/toolbar-BPieulY0.js","assets/use-create-virtual-mcp-BMS7n6cR.js","assets/github-repo-picker-Cv2hJHIg.js","assets/use-mcp-tools-_vJ0O06D.js","assets/alert-dialog-rzEJnGe3.js","assets/index-hfiyru1l.js","assets/use-org-auth-client-C1QanCOM.js","assets/hover-card-KVY26bmB.js","assets/task-status-DFEmNn74.js","assets/use-status-sounds-jo50KXQn.js","assets/empty-state-CJQL64Iv.js","assets/resizable-D8RQo_5S.js","assets/use-capability-B3WgU_BM.js","assets/header-tab-button-KhZtaQXJ.js","assets/index-BOsBvH8j.js","assets/user-DFA5bLwB.js","assets/tools-list-CIW2H0pK.js","assets/use-debounced-autosave-HbVrHLRr.js","assets/index-C4ADrWoA.js","assets/search-input-CxSBjWxv.js","assets/use-secrets-CCAdfHn3.js","assets/formatDistanceToNow-Cb2QZZJn.js","assets/accordion-22OFyBCO.js","assets/view-mode-toggle-Da9r5sm2.js","assets/select-model-BaCRsY81.js","assets/use-automations-Bk9hBchQ.js","assets/monaco-editor-Dtzak2uP.js","assets/automation-runs-D6-iTDTB.js","assets/table-BkTI3GAj.js","assets/use-members-D1_PBuic.js","assets/automation-list-row-CGwWirnd.js","assets/save-referenced-block-DY8yL5ub.js","assets/page-seo-sheet-g9EKqmR_.js","assets/file-explorer-D5ZtuxHx.js","assets/app-editor-BUZUhvgy.js","assets/save-status-RyAPUThs.js","assets/post-editor-DIXAxF5l.js","assets/primitives-D5ActPZG.js","assets/record-editor-CdXt0BJy.js","assets/seo-editor-GccXSXxy.js","assets/project-app-view-DRmpbQZp.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{e as K,r as E,c as he,j as n,l as Ce,p as Pe,b as Js,E as Ut,f as ts,d as zo,g as Dc,o as $u,L as zu,m as Zs,K as Bt,q as Fu,n as le,B as re,s as Ic,v as Hu,V as Wu,t as Ae,w as Bc,x as Uu,y as Zr,z as Mi,C as vt,D as Ku,F as Qs,G as Mc,H as Vu,I as qu,J as Qr,M as Gu,a as ei,P as gr,Q as Si,R as Tt,_ as qt}from"./index-DY3w09IO.js";import{C as Oe,a as Yu,b as ti,h as Xu,w as Ju,c as Lc,u as Fo,s as Hn,T as Zu,d as Qu,g as ef,e as tf,f as sf}from"./agent-capabilities-DiDonrOV.js";import{a as Ns,b as ss,c as en,d as Oc,u as rf,t as nf,e as of}from"./chat-context-TGvyfVIv.js";import{g as Ho,u as ft,S as $c,a as Wo}from"./use-mcp-client-DwO1EFjM.js";import{u as Mt,a as af,b as lf,c as cf}from"./use-virtual-mcp-ByGSSo67.js";import{i as Ki}from"./AlertCircle-Dq_aRrSW.js";import{i as zc}from"./CheckCircle-Dig2QFEV.js";import{n as Ha}from"./ChevronLeft-BMz9RJK0.js";import{i as hf,a as df}from"./XCircle-BtsHL-zm.js";import{s as ps}from"./XClose-Dm6CEeSb.js";import{c as uf,u as ff,a as Fc,O as mf,t as Wa,G as pf,g as _f,s as gf,C as vf,b as xf,d as bf}from"./pair-D_DFqq5L.js";import{I as Gt}from"./integration-icon-BeXMpMNo.js";import{a as yf}from"./Users03-CVMsW27x.js";import{t as Es}from"./ChevronDown-DSfDv5bM.js";import{u as Hc}from"./use-ai-providers-DVIU4P_O.js";import{u as Sf,g as Vi,A as wf}from"./sortable.esm-Ce_JeqCX.js";import{r as Cf,u as Uo,i as kf}from"./shell-layout-IynSY8E5.js";import{b as jf,a as Nf}from"./shell-route-loading-Cmr_pTbg.js";import{u as Ef}from"./sidebar-BFnxxrth.js";import{S as Tf,a as Rf,b as Pf}from"./sheet-DovmEFQe.js";import{u as Wc,T as Ee,a as Te,b as Re,c as Uc}from"./tooltip-CP-z2SMr.js";import{i as Li,a as tn,b as Kc,c as Af,p as sn,g as rn,d as Ko,e as Vc,h as Wn,f as _n,j as Ua,A as Ka,k as Df,l as If,m as Bf,n as Mf,o as Lf,q as Of,t as $f,r as zf,s as Ff,u as Hf,v as nn,w as Wf,x as Va,y as qa,z as Uf,B as Kf,C as Vf,D as qf,E as Vo,F as Nr,G as qo,H as qc,I as Gc,J as Gf,K as Yf,L as Xf,M as Jf,N as Zf,O as Ga,P as Qf,Q as em,R as Ri,S as tm,T as Yc,U as Xc,V as sm}from"./agent-icon-EkftJS22.js";import{u as im}from"./use-status-sounds-jo50KXQn.js";import{E as Er}from"./empty-state-CJQL64Iv.js";import{u as rm,r as Un,a as nm,p as Jc,f as Ya,b as Zc,c as Qc,d as eh,e as om,F as am,i as lm,g as cm,h as hm,j as dm}from"./tab-id-l7bxIuE5.js";import{T as Xa,a as Kn}from"./toolbar-BPieulY0.js";import{R as th,a as um,b as fm}from"./resizable-D8RQo_5S.js";import{i as qi,n as mm}from"./Globe01-fLDIUsna.js";import{i as sh}from"./Monitor01-BU_pw8u6.js";import{u as Gi,a as Go,b as ih}from"./use-connection-CdNtREc0.js";import{u as Yi}from"./studio-tools-Cf7jviAo.js";import{u as on,a as pm,b as _m}from"./use-mcp-tools-_vJ0O06D.js";import{u as gm}from"./use-capability-B3WgU_BM.js";import{F as Oi,M as Yo}from"./file-type-icon-BsYj2eA6.js";import{u as vm,a as xm,b as bm,c as ym,g as Sm,d as rh,e as Ja,F as wm,f as Cm,h as km,i as jm,j as Nm,k as Em,H as Tm,l as Rm}from"./header-tab-button-KhZtaQXJ.js";import{i as Vn,a as nh,b as Pm}from"./ZoomOut-qMWF_U2b.js";import{P as Ts,a as Rs,b as Ps}from"./popover-rsSc4pjV.js";import{S as Xo}from"./spinner-sPXohOHa.js";import{D as As,a as Ds,b as Is,c as He,d as qn,e as Gn,f as Yn,g as vr}from"./dropdown-menu-BryIJ5hv.js";import{D as Lt,a as Ot,b as is,c as rs,d as si,e as Jo}from"./dialog-D-P_WrCO.js";import{I as qe}from"./input-B0CkwMLk.js";import{T as ys,a as Zo,b as Pi,c as Qo}from"./tabs-DUhx-8IF.js";import{T as Tr}from"./textarea-BPGbVVMl.js";import{a as Qt,s as Am}from"./Eye-DeGxYDuW.js";import{t as Ss}from"./Stars01-D1djCaFC.js";import{l as Dm,w as Im}from"./index-BOsBvH8j.js";import{i as Bm}from"./ChevronRight-DUK5EG42.js";import{g as Mm}from"./generate-id-DOqX7377.js";import{g as Lm}from"./types-BJ-5cxEn.js";import{U as oh}from"./user-DFA5bLwB.js";import{T as Om,u as ah}from"./tools-list-CIW2H0pK.js";import{a as $m,i as Za}from"./mcp-oauth-BLYgYIFp.js";import{s as lh,g as zm}from"./connection-slug-eyAPH6o3.js";import{A as Rr,a as Pr,b as Ar,c as Dr,d as Ir,e as Br,f as Mr,g as Lr}from"./alert-dialog-rzEJnGe3.js";import{C as ch,a as Xn}from"./card-ClQPDYHu.js";import{L as jt}from"./label-PMquEo0-.js";import{S as Pt,a as At,b as Dt,c as nt,d as It}from"./select-CJfXW58o.js";import{S as Or}from"./switch-BC30tIvN.js";import{i as Vs}from"./Play-DTdPdnB9.js";import{s as xt}from"./Plus-D6sxLshv.js";import{a as Fm}from"./Settings02-p7bikFh4.js";import{s as qs}from"./Trash01-B7WGJ2nw.js";import{u as $r}from"./use-debounced-autosave-HbVrHLRr.js";import{S as an}from"./scroll-area-BA3CfjMX.js";import{i as $i}from"./SearchMd-DknOSDEF.js";import{i as Hm}from"./Upload01-AmfCgYbd.js";import{i as Wm}from"./LayoutLeft-B_tQQStj.js";import{P as Rt}from"./index-C4ADrWoA.js";import{C as ln}from"./checkbox-CVg5TV-K.js";import{S as hh}from"./search-input-CxSBjWxv.js";import{C as dh}from"./collection-tabs-BIfSZj8G.js";import{u as Um}from"./use-mcp-prompts-BN2gexTA.js";import{D as Km,a as Vm,b as qm}from"./drawer-BrWBKjeq.js";import{i as ii}from"./Check-CPgB6rV-.js";import{i as ea}from"./Key01-CmnuMzLg.js";import{S as uh}from"./skeleton-dy-S0Sln.js";import{s as Gm}from"./User01-D89IeLeJ.js";import{t as ta}from"./Users01-xnT12U--.js";import{u as Ym,a as Xm}from"./use-secrets-CCAdfHn3.js";import{G as Jm}from"./github-repo-picker-Cv2hJHIg.js";import{f as Zm}from"./formatDistanceToNow-Cb2QZZJn.js";import{n as ri}from"./LinkExternal01-D6r75PNf.js";import{A as Qm,a as ep,b as tp,c as sp}from"./accordion-22OFyBCO.js";import{s as Gs}from"./Star01-BgW1n4hv.js";import{i as fh}from"./Stars02-Bqx_7EIE.js";import{V as ip}from"./view-mode-toggle-Da9r5sm2.js";import{n as mh}from"./ZapSquare-CC2nvo3M.js";import{i as sa,a as rp,b as ia}from"./Tool01-Ral5MrGT.js";import{c as ph,i as np}from"./SwitchHorizontal01-Bx586qSV.js";import{B as op}from"./badge-aMsRW7zr.js";import{C as ap,a as Qa,b as lp,c as cp,d as hp,e as dp}from"./command-CWMX2Bpj.js";import{M as up}from"./select-model-BaCRsY81.js";import{u as Xi,a as fp,b as mp,c as pp,d as _p}from"./use-automations-Bk9hBchQ.js";import{i as _h}from"./RefreshCcw01-BTpOd3eq.js";import{i as zi}from"./Zap-C3pKoqKe.js";import{M as gp}from"./monaco-editor-Dtzak2uP.js";import{A as vp}from"./automation-runs-D6-iTDTB.js";import{A as xp}from"./automation-list-row-CGwWirnd.js";import{i as bp}from"./X-dT525xXh.js";function ui(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function el(t){if(!t)return"—";const e=typeof t=="string"?new Date(t):t;return isNaN(e.getTime())?"—":e.toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function yp(t){return t?t.replace(/-\d{8}(?:-[a-z0-9]+)*$/i,"").replace(/-/g," "):"—"}function Sp(t){const e=K.c(4),{items:s}=t;let i;e[0]!==s?(i=s.map(wp),e[0]=s,e[1]=i):i=e[1];let r;return e[2]!==i?(r=n.jsx("div",{className:"grid grid-cols-2 gap-x-8 gap-y-6",children:i}),e[2]=i,e[3]=r):r=e[3],r}function wp(t){return n.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[n.jsx("span",{className:"text-xs text-muted-foreground truncate",children:t.label}),n.jsx("span",{className:"text-sm text-foreground tabular-nums truncate",children:t.value})]},t.label)}function Cp(t){const e=K.c(30),{userTokens:s,assistantTokens:i,otherTokens:r}=t,o=s+i+r,a=o>0?s/o*100:0,l=o>0?i/o*100:0,h=o>0?r/o*100:0;let c;e[0]!==a?(c=a>0&&n.jsx("div",{className:"h-full bg-chart-1",style:{width:`${a}%`}}),e[0]=a,e[1]=c):c=e[1];let d;e[2]!==l?(d=l>0&&n.jsx("div",{className:"h-full bg-chart-2",style:{width:`${l}%`}}),e[2]=l,e[3]=d):d=e[3];let u;e[4]!==h?(u=h>0&&n.jsx("div",{className:"h-full bg-muted-foreground/30",style:{width:`${h}%`}}),e[4]=h,e[5]=u):u=e[5];let f;e[6]!==c||e[7]!==d||e[8]!==u?(f=n.jsxs("div",{className:"flex h-2 w-full overflow-hidden rounded-full bg-muted",children:[c,d,u]}),e[6]=c,e[7]=d,e[8]=u,e[9]=f):f=e[9];let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-1 shrink-0"}),e[10]=m):m=e[10];let p;e[11]!==a?(p=a.toFixed(1),e[11]=a,e[12]=p):p=e[12];let _;e[13]!==p?(_=n.jsxs("div",{className:"flex items-center gap-1.5",children:[m,n.jsxs("span",{className:"text-xs text-muted-foreground",children:["User ",p,"%"]})]}),e[13]=p,e[14]=_):_=e[14];let g;e[15]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-2 shrink-0"}),e[15]=g):g=e[15];let v;e[16]!==l?(v=l.toFixed(1),e[16]=l,e[17]=v):v=e[17];let b;e[18]!==v?(b=n.jsxs("div",{className:"flex items-center gap-1.5",children:[g,n.jsxs("span",{className:"text-xs text-muted-foreground",children:["Assistant ",v,"%"]})]}),e[18]=v,e[19]=b):b=e[19];let x;e[20]!==h||e[21]!==r?(x=r>0&&n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-muted-foreground/30 shrink-0"}),n.jsxs("span",{className:"text-xs text-muted-foreground",children:["Other ",h.toFixed(1),"%"]})]}),e[20]=h,e[21]=r,e[22]=x):x=e[22];let y;e[23]!==b||e[24]!==x||e[25]!==_?(y=n.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:[_,b,x]}),e[23]=b,e[24]=x,e[25]=_,e[26]=y):y=e[26];let w;return e[27]!==y||e[28]!==f?(w=n.jsxs("div",{className:"flex flex-col gap-2",children:[f,y]}),e[27]=y,e[28]=f,e[29]=w):w=e[29],w}function kp(t){const e=K.c(11),{agentId:s,isError:i}=t,r=Mt(s),o=r?.title??"Subtask",a=r?.icon??null;let l;e[0]!==a||e[1]!==o?(l=n.jsx(Gt,{icon:a,name:o,size:"xs",className:"size-6 rounded-md shrink-0"}),e[0]=a,e[1]=o,e[2]=l):l=e[2];const h=i?"text-destructive":"text-foreground";let c;e[3]!==h?(c=he("shrink-0 font-medium",h),e[3]=h,e[4]=c):c=e[4];let d;e[5]!==o||e[6]!==c?(d=n.jsx("span",{className:c,children:o}),e[5]=o,e[6]=c,e[7]=d):d=e[7];let u;return e[8]!==l||e[9]!==d?(u=n.jsxs(n.Fragment,{children:[l,d]}),e[8]=l,e[9]=d,e[10]=u):u=e[10],u}function jp(t){const e=K.c(5),{isError:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(Gt,{icon:null,name:"Subtask",size:"xs",className:"size-6 rounded-md shrink-0"}),e[0]=i):i=e[0];const r=s?"text-destructive":"text-foreground";let o;e[1]!==r?(o=he("shrink-0 font-medium",r),e[1]=r,e[2]=o):o=e[2];let a;return e[3]!==o?(a=n.jsxs(n.Fragment,{children:[i,n.jsx("span",{className:o,children:"Subtask"})]}),e[3]=o,e[4]=a):a=e[4],a}function Np(t){const e=K.c(18),{part:s}=t,i=s.input?.agent_id,r=s.state==="input-streaming"||s.state==="input-available"||s.state==="output-available"&&s.preliminary===!0,o=s.state==="output-error",a=s.state==="approval-requested";let l;e[0]!==o?(l=n.jsx(jp,{isError:o}),e[0]=o,e[1]=l):l=e[1];let h;e[2]!==i||e[3]!==o?(h=n.jsx(kp,{agentId:i,isError:o}),e[2]=i,e[3]=o,e[4]=h):h=e[4];let c;e[5]!==l||e[6]!==h?(c=n.jsx(E.Suspense,{fallback:l,children:h}),e[5]=l,e[6]=h,e[7]=c):c=e[7];let d;e[8]!==s.input?(d=s.input?.prompt&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-muted-foreground/50",children:"·"}),n.jsx("span",{className:"truncate text-muted-foreground",children:s.input.prompt})]}),e[8]=s.input,e[9]=d):d=e[9];let u;e[10]!==a||e[11]!==o||e[12]!==r?(u=n.jsx("span",{className:"ml-auto shrink-0",children:r?n.jsx(Ce,{size:12,className:"animate-spin text-muted-foreground"}):o?n.jsx(hf,{size:12,className:"text-destructive"}):a?n.jsx(Ki,{size:12,className:"text-warning"}):n.jsx(zc,{size:12,className:"text-emerald-500"})}),e[10]=a,e[11]=o,e[12]=r,e[13]=u):u=e[13];let f;return e[14]!==c||e[15]!==d||e[16]!==u?(f=n.jsxs("div",{className:"flex items-center gap-2 text-xs min-w-0",children:[c,d,u]}),e[14]=c,e[15]=d,e[16]=u,e[17]=f):f=e[17],f}function Ep(t){const e=K.c(55),{onClose:s,back:i,className:r}=t,[o,a]=E.useState(null),{messages:l}=Ns(),{activeTask:h}=ss(),{selectedModel:c,selectedVirtualMcp:d}=en();let u,f,m,p,_,g,v,b;if(e[0]!==h||e[1]!==i||e[2]!==r||e[3]!==l||e[4]!==s||e[5]!==o?.id||e[6]!==c||e[7]!==d?.title){b=Symbol.for("react.early_return_sentinel");e:{const w=uf(l),k=[...l].reverse().find($p),j=k?.metadata?.usage,R=k?.metadata?.modelLimits?.contextWindow??c?.limits?.contextWindow??null,I=j?.contextTokens??0,P=R&&R>0?(I/R*100).toFixed(1):null,T=l;let S;e[16]!==T?(S=T.filter(Op).reduce(Lp,0),e[16]=T,e[17]=S):S=e[17];const C=S,D=l;let N;e[18]!==D?(N=D.filter(Mp).reduce(Bp,0),e[18]=D,e[19]=N):N=e[19];const A=N,M=Math.max(0,w.totalTokens-C-A),B=l[0],L=l.at(-1),O=B?.metadata?.created_at??h?.created_at,W=L?.metadata?.created_at??h?.updated_at,F=l.filter(Ip),V=l.flatMap(Ap),J=c?.modelId?yp(c.modelId):"—",G=d?.title??"Decopilot",U=[{label:"Session",value:h?.title??"New chat"},{label:"Messages",value:F.length},{label:"Agent",value:G},{label:"Model",value:J},{label:"Context Limit",value:R?ui(R):"—"},{label:"Session Tokens (billed)",value:w.totalTokens>0?ui(w.totalTokens):"0"},{label:"Usage",value:P!==null?`${P}%`:"—"},{label:"Input Tokens",value:w.inputTokens>0?ui(w.inputTokens):"0"},{label:"Output Tokens",value:w.outputTokens>0?ui(w.outputTokens):"0"},{label:"Reasoning Tokens",value:w.reasoningTokens>0?ui(w.reasoningTokens):"0"},{label:"Cost",value:w.cost>0?`$${w.cost<.001?w.cost.toFixed(6):w.cost.toFixed(4)}`:"$0.00"},{label:"Session Created",value:el(O)},{label:"Last Activity",value:el(W)}];if(!h&&F.length===0){let $;e[20]!==r?($=he("flex flex-col h-full w-full border-l border-border bg-background",r),e[20]=r,e[21]=$):$=e[21];let se;e[22]===Symbol.for("react.memo_cache_sentinel")?(se=n.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[22]=se):se=e[22];let ee;e[23]!==i?(ee=i?n.jsx(Ha,{size:14,className:"text-muted-foreground"}):n.jsx(ps,{size:14,className:"text-muted-foreground"}),e[23]=i,e[24]=ee):ee=e[24];let Q;e[25]!==s||e[26]!==ee?(Q=n.jsxs("div",{className:"h-11 px-4 flex items-center justify-between shrink-0 border-b border-border/50",children:[se,n.jsx("button",{type:"button",onClick:s,className:"flex size-6 items-center justify-center rounded hover:bg-accent transition-colors",children:ee})]}),e[25]=s,e[26]=ee,e[27]=Q):Q=e[27];let z;e[28]===Symbol.for("react.memo_cache_sentinel")?(z=n.jsx("div",{className:"flex-1 flex items-center justify-center px-4 text-center",children:n.jsx("p",{className:"text-xs text-muted-foreground",children:"Start a conversation to see context"})}),e[28]=z):z=e[28];let ce;e[29]!==$||e[30]!==Q?(ce=n.jsxs("div",{className:$,children:[Q,z]}),e[29]=$,e[30]=Q,e[31]=ce):ce=e[31],b=ce;break e}e[32]!==r?(g=he("flex flex-col h-full w-full border-l border-border bg-background overflow-y-auto",r),e[32]=r,e[33]=g):g=e[33];let H;e[34]===Symbol.for("react.memo_cache_sentinel")?(H=n.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[34]=H):H=e[34];let X;e[35]!==i?(X=i?n.jsx(Ha,{size:14}):n.jsx(ps,{size:14}),e[35]=i,e[36]=X):X=e[36],e[37]!==s||e[38]!==X?(v=n.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between border-b border-border/50 px-4",children:[H,n.jsx("button",{type:"button",onClick:s,className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:X})]}),e[37]=s,e[38]=X,e[39]=v):v=e[39],u="flex flex-col gap-8 p-6",f=V.length>0&&n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("span",{className:"text-xs text-muted-foreground",children:"Subtasks"}),n.jsx("div",{className:"flex flex-col gap-1",children:V.map(Pp)})]}),m=n.jsx(Sp,{items:U});let oe;e[40]===Symbol.for("react.memo_cache_sentinel")?(oe=n.jsx("span",{className:"text-xs text-muted-foreground",children:"Context Breakdown"}),e[40]=oe):oe=e[40],e[41]!==A||e[42]!==M||e[43]!==C?(p=n.jsxs("div",{className:"flex flex-col gap-3",children:[oe,n.jsx(Cp,{userTokens:C,assistantTokens:A,otherTokens:M})]}),e[41]=A,e[42]=M,e[43]=C,e[44]=p):p=e[44],_=F.length>0&&n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("span",{className:"text-xs text-muted-foreground",children:"Raw messages"}),n.jsx("div",{className:"flex flex-col gap-1",children:F.map($=>{const se=$.metadata?.created_at,ee=o?.id===$.id;return n.jsxs("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[n.jsxs("button",{type:"button",onClick:()=>a(ee?null:$),className:"flex items-center justify-between gap-2 px-3 py-2 text-xs hover:bg-accent/50 w-full text-left cursor-pointer",children:[n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx("span",{className:he("shrink-0 font-medium",$.role==="user"?"text-chart-1":"text-chart-2"),children:$.role}),n.jsx("span",{className:"text-muted-foreground",children:"•"}),n.jsx("span",{className:"truncate text-muted-foreground font-mono",children:$.id})]}),se&&n.jsx("span",{className:"shrink-0 text-muted-foreground tabular-nums",children:new Date(se).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})})]}),ee&&n.jsxs(n.Fragment,{children:[$.role==="assistant"&&(()=>{const Q=$.metadata?._request;if(!Q)return null;const z=Q.systemSections??[],ce=Math.max(1,...z.map(Rp)),ue=z.reduce(Tp,0);return n.jsxs("div",{className:"border-t border-border/50 px-3 py-2.5 text-xs space-y-2.5",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"font-medium text-foreground",children:"Request"}),n.jsxs("span",{className:"text-muted-foreground tabular-nums",children:[Q.activeTools??0," / ",Q.tools??0," ","tools active"]})]}),z.length>0&&n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("div",{className:"text-muted-foreground",children:["System prompt"," ",n.jsxs("span",{className:"tabular-nums",children:["~",Math.round(ue/4).toLocaleString()," ","tok"]})]}),z.map((fe,q)=>{const te=fe.preview.match(/^<([a-z-]+)/i)?.[1]??`section ${q}`,me=fe.chars/ce*100,ne=Math.round(fe.chars/4);return n.jsxs("div",{className:"space-y-0.5",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsx("span",{className:"font-mono text-foreground truncate",children:te}),n.jsxs("span",{className:"text-muted-foreground tabular-nums shrink-0",children:["~",ne.toLocaleString()," tok"]})]}),n.jsx("div",{className:"h-1 w-full rounded-full bg-muted overflow-hidden",children:n.jsx("div",{className:"h-full rounded-full bg-chart-3",style:{width:`${me}%`}})})]},q)})]})]})})(),n.jsx("pre",{className:"text-xs font-mono bg-muted px-3 py-2 overflow-auto whitespace-pre-wrap break-all border-t border-border/50 max-h-64",children:JSON.stringify($,null,2)})]})]},$.id)})})]})}e[0]=h,e[1]=i,e[2]=r,e[3]=l,e[4]=s,e[5]=o?.id,e[6]=c,e[7]=d?.title,e[8]=u,e[9]=f,e[10]=m,e[11]=p,e[12]=_,e[13]=g,e[14]=v,e[15]=b}else u=e[8],f=e[9],m=e[10],p=e[11],_=e[12],g=e[13],v=e[14],b=e[15];if(b!==Symbol.for("react.early_return_sentinel"))return b;let x;e[45]!==u||e[46]!==f||e[47]!==m||e[48]!==p||e[49]!==_?(x=n.jsxs("div",{className:u,children:[f,m,p,_]}),e[45]=u,e[46]=f,e[47]=m,e[48]=p,e[49]=_,e[50]=x):x=e[50];let y;return e[51]!==g||e[52]!==v||e[53]!==x?(y=n.jsxs("div",{className:g,children:[v,x]}),e[51]=g,e[52]=v,e[53]=x,e[54]=y):y=e[54],y}function Tp(t,e){return t+e.chars}function Rp(t){return t.chars}function Pp(t,e){return n.jsx(Np,{part:t},e)}function Ap(t){return(t.parts??[]).filter(Dp)}function Dp(t){return t.type==="tool-subtask"}function Ip(t){return t.role!=="system"}function Bp(t,e){const s=e.metadata?.usage;return t+(s?.outputTokens??0)}function Mp(t){return t.role==="assistant"}function Lp(t,e){const s=e.metadata?.usage;return t+(s?.inputTokens??0)}function Op(t){return t.role==="user"}function $p(t){return t.role==="assistant"&&t.metadata?.usage}function zp(t){const e=K.c(13),{readOnly:s,identity:i,aboveRow:r,input:o,iceBreakers:a}=t,l=!s&&i?i:null;let h;e[0]!==r||e[1]!==s?(h=!s&&r?n.jsx("div",{"data-chat-above-row":"true",className:"@container/chat-bottom flex justify-start gap-1",children:r}):null,e[0]=r,e[1]=s,e[2]=h):h=e[2];let c;e[3]!==o||e[4]!==h?(c=n.jsxs("div",{className:"flex flex-col gap-2",children:[h,o]}),e[3]=o,e[4]=h,e[5]=c):c=e[5];let d;e[6]!==a||e[7]!==s?(d=!s&&a?n.jsx("div",{className:"w-full",children:a}):null,e[6]=a,e[7]=s,e[8]=d):d=e[8];let u;return e[9]!==l||e[10]!==c||e[11]!==d?(u=n.jsx("div",{"data-chat-centered":"true",className:"h-full w-full flex flex-col items-center justify-center px-4 gap-6",children:n.jsxs("div",{className:"w-full max-w-3xl flex flex-col gap-6",children:[l,c,d]})}),e[9]=l,e[10]=c,e[11]=d,e[12]=u):u=e[12],u}function Fp(t){const e=K.c(25),{onOpenContextPanel:s}=t,{org:i}=Pe(),{selectedVirtualMcp:r}=en();let o;e[0]!==i.id?(o=Ho(i.id),e[0]=i.id,e[1]=o):o=e[1];const l=r??o,h=Mt(l.id),c=Oc(),{data:d}=Js.useSession(),u=d?.user?.id,f=c?.activeTask??null,m=!!(u&&f?.created_by&&f.created_by!==u);let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx(yf,{size:32}),e[2]=p):p=e[2];let _;e[3]!==l.icon||e[4]!==l.title?(_=n.jsx(Gt,{icon:l.icon,name:l.title,size:"lg",fallbackIcon:p,className:"size-10 min-w-10 md:size-[60px]! md:min-w-[60px] rounded-xl md:rounded-[18px]!"}),e[3]=l.icon,e[4]=l.title,e[5]=_):_=e[5];let g;e[6]!==l.title?(g=n.jsx("h3",{className:"text-base md:text-xl font-medium text-foreground",children:l.title}),e[6]=l.title,e[7]=g):g=e[7];const v=l.description??"Ask anything about configuring model providers or using MCP Mesh.";let b;e[8]!==v?(b=n.jsx("div",{className:"text-muted-foreground text-center text-base max-w-md line-clamp-2",children:v}),e[8]=v,e[9]=b):b=e[9];let x;e[10]!==_||e[11]!==g||e[12]!==b?(x=n.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 md:gap-4 text-center",children:[_,g,b]}),e[10]=_,e[11]=g,e[12]=b,e[13]=x):x=e[13];const y=c?.currentBranch??null;let w;e[14]!==h||e[15]!==y?(w=n.jsx(Yu,{virtualMcp:h,currentBranch:y}),e[14]=h,e[15]=y,e[16]=w):w=e[16];let k;e[17]!==s?(k=n.jsx(Oe.Input,{onOpenContextPanel:s}),e[17]=s,e[18]=k):k=e[18];let j;e[19]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx(Oe.IceBreakers,{}),e[19]=j):j=e[19];let R;return e[20]!==m||e[21]!==k||e[22]!==x||e[23]!==w?(R=n.jsx(zp,{readOnly:m,identity:x,aboveRow:w,input:k,iceBreakers:j}),e[20]=m,e[21]=k,e[22]=x,e[23]=w,e[24]=R):R=e[24],R}function tl(t){const e=K.c(17),{outputs:s,collapsed:i,onToggle:r,variant:o}=t,a=o==="card"?"rounded-xl border border-border bg-muted/95 shadow-sm backdrop-blur-sm":"border-b border-border bg-background";let l;e[0]!==a?(l=he(a),e[0]=a,e[1]=l):l=e[1];let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx("span",{className:"text-sm font-medium text-foreground",children:"Files in this task"}),e[2]=h):h=e[2];const c=i&&"-rotate-90";let d;e[3]!==c?(d=he("size-4 text-muted-foreground transition-transform",c),e[3]=c,e[4]=d):d=e[4];let u;e[5]!==d?(u=n.jsx(Es,{className:d}),e[5]=d,e[6]=u):u=e[6];let f;e[7]!==r||e[8]!==u?(f=n.jsxs("button",{type:"button",onClick:r,className:"flex w-full items-center justify-between px-3 py-2.5 text-left",children:[h,u]}),e[7]=r,e[8]=u,e[9]=f):f=e[9];let m;e[10]!==i||e[11]!==s?(m=!i&&n.jsx("div",{className:"flex max-h-72 flex-col gap-1.5 overflow-y-auto px-2 pb-2",children:s.map(Hp)}),e[10]=i,e[11]=s,e[12]=m):m=e[12];let p;return e[13]!==l||e[14]!==f||e[15]!==m?(p=n.jsxs("div",{className:l,children:[f,m]}),e[13]=l,e[14]=f,e[15]=m,e[16]=p):p=e[16],p}function Hp(t){return n.jsx(mf,{file:t},t.key)}function Wp(){const t=K.c(13),e=Oc()?.taskId??null,s=ff();let i;t[0]!==s?(i={enabled:s},t[0]=s,t[1]=i):i=t[1];const{data:r}=Fc(e,i),[o,a]=E.useState(!1),[l,h]=E.useState(!0);if(!e||!r||r.length===0)return null;let c;t[2]===Symbol.for("react.memo_cache_sentinel")?(c=()=>a(Kp),t[2]=c):c=t[2];let d;t[3]!==o||t[4]!==r?(d=n.jsx("div",{className:"absolute top-2 right-2 z-10 hidden w-72 @[1280px]:block",children:n.jsx(tl,{variant:"card",outputs:r,collapsed:o,onToggle:c})}),t[3]=o,t[4]=r,t[5]=d):d=t[5];let u;t[6]===Symbol.for("react.memo_cache_sentinel")?(u=()=>h(Up),t[6]=u):u=t[6];let f;t[7]!==l||t[8]!==r?(f=n.jsx("div",{className:"shrink-0 @[1280px]:hidden",children:n.jsx(tl,{variant:"bar",outputs:r,collapsed:l,onToggle:u})}),t[7]=l,t[8]=r,t[9]=f):f=t[9];let m;return t[10]!==d||t[11]!==f?(m=n.jsxs(n.Fragment,{children:[d,f]}),t[10]=d,t[11]=f,t[12]=m):m=t[12],m}function Up(t){return!t}function Kp(t){return!t}function Vp(){const t=K.c(28),{org:e}=Pe(),s=Hc(),{isChatEmpty:i}=Ns(),[r,o]=E.useState("chat"),a=Sf(),{selectedVirtualMcp:l}=en();let h;t[0]!==e.id?(h=Ho(e.id),t[0]=e.id,t[1]=h):h=t[1];const u=Mt((l??h).id),f=rf(),m=ti(u?.metadata);if(s.length===0&&!(m&&Xu(f))){let T;return t[2]===Symbol.for("react.memo_cache_sentinel")?(T=n.jsx(Oe,{className:"animate-in fade-in-0 duration-200",children:n.jsx(Oe.Main,{className:"flex flex-col items-center",children:n.jsx(Oe.EmptyState,{children:n.jsx(Oe.NoAiProviderEmptyState,{})})})}),t[2]=T):T=t[2],T}let _;t[3]!==a.hasDecoKey||t[4]!==a.hasOnlyDecoProvider||t[5]!==a.isLoading||t[6]!==a.isZeroBalance||t[7]!==i||t[8]!==e.id?(_=a.hasDecoKey&&a.isZeroBalance&&a.hasOnlyDecoProvider&&!a.isLoading&&i&&!Ju(e.id),t[3]=a.hasDecoKey,t[4]=a.hasOnlyDecoProvider,t[5]=a.isLoading,t[6]=a.isZeroBalance,t[7]=i,t[8]=e.id,t[9]=_):_=t[9];const g=_;let v;t[10]!==g?(v=g&&n.jsx(Oe.CreditsEmptyState,{}),t[10]=g,t[11]=v):v=t[11];const b=r!=="chat"?"opacity-0 pointer-events-none":"opacity-100";let x;t[12]!==b?(x=he("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",b),t[12]=b,t[13]=x):x=t[13];let y;t[14]!==i?(y=i?n.jsx(Oe.Main,{children:n.jsx(Fp,{onOpenContextPanel:()=>o("context")})}):n.jsxs(n.Fragment,{children:[n.jsxs(Oe.Main,{className:"relative flex flex-col overflow-hidden @container",children:[n.jsx(Wp,{}),n.jsx("div",{className:"min-h-0 flex-1",children:n.jsx(Oe.Messages,{})})]}),n.jsx(Oe.Footer,{children:n.jsx(Oe.Input,{onOpenContextPanel:()=>o("context")})})]}),t[14]=i,t[15]=y):y=t[15];let w;t[16]!==x||t[17]!==y?(w=n.jsx("div",{className:x,children:y}),t[16]=x,t[17]=y,t[18]=w):w=t[18];const k=r==="context"?"opacity-100":"opacity-0 pointer-events-none";let j;t[19]!==k?(j=he("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",k),t[19]=k,t[20]=j):j=t[20];let R;t[21]===Symbol.for("react.memo_cache_sentinel")?(R=n.jsx(Ep,{back:!0,onClose:()=>o("chat")}),t[21]=R):R=t[21];let I;t[22]!==j?(I=n.jsx("div",{className:j,children:R}),t[22]=j,t[23]=I):I=t[23];let P;return t[24]!==I||t[25]!==v||t[26]!==w?(P=n.jsxs(Oe,{className:"relative overflow-hidden animate-in fade-in-0 duration-200",children:[v,w,I]}),t[24]=I,t[25]=v,t[26]=w,t[27]=P):P=t[27],P}function gh(){const t=K.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(Oe.Skeleton,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(Ut,{fallback:e,children:n.jsx(E.Suspense,{fallback:n.jsx(Oe.Skeleton,{}),children:n.jsx(Vp,{})})}),t[1]=s):s=t[1],s}function qp(t){const e=t.entityMetadata?.defaultMainView??null,s=e==null||e.type==="chat",i=t.mainParamPresent?t.mainParamValue!=="0":!s,r=s?!0:t.entityMetadata?.chatDefaultOpen??!1;return{mainOpen:i,chatOpen:r}}function sl(t,e){return t&&e?{chat:45,main:55}:t&&!e?{chat:100,main:0}:!t&&e?{chat:0,main:100}:{chat:0,main:0}}function Gp(t,e){return t===1?!0:t===0?!1:e}function Yp(t,e){const s=ts(),i=zo({strict:!1}),r=Dc({strict:!1}),{create:o}=rm(),{locator:a}=Pe(),{virtualMcpId:l,orgSlug:h,isAgentRoute:c}=e,d=qp({entityMetadata:t,mainParamPresent:i.main!==void 0,mainParamValue:i.main}),u=Gp(i.chat,d.chatOpen),f=d.mainOpen,m=E.useRef(crypto.randomUUID()),p=r.taskId??m.current,_="/$org/$taskId",g=I=>({org:h,taskId:I}),v=c?{virtualmcpid:l}:{},b=(I,P)=>{s({to:_,params:g(p),search:T=>({...T,...I}),replace:P?.replace??!1})},x=(I,P)=>{s({to:_,params:g(I),search:T=>{const S={};return P?S.virtualmcpid=P:c&&(S.virtualmcpid=l),S}})},y=()=>{f?b({main:"0"},{replace:!0}):b({main:Un(t)},{replace:!0})},w=()=>{b({chat:u?0:1},{replace:!0})},k=()=>{u||b({chat:1},{replace:!0})},j=async()=>{const I=crypto.randomUUID(),P=Cf(h,a,p);try{await o({id:I,virtual_mcp_id:l,...P?{branch:P}:{}})}catch{}s({to:_,params:g(I),search:T=>({...v,chat:1})})},R=I=>{b({main:I},{replace:!0})};return{taskId:p,mainOpen:f,chatOpen:u,mainParam:i.main,setTaskId:x,toggleMain:y,toggleChat:w,openChat:k,createNewTask:j,openTab:R}}const ra=45;function vh(t,e=ra){const s=typeof t=="number"?t:Number(t);return!Number.isFinite(s)||s<=0||s>=100?e:s}function Xp(t){return vh(t,ra)}function Jp(){const t=K.c(6);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=zu.decoChatPanelWidth(),t[0]=e):e=t[0];const[s,i]=$u(e,Xp);let r;t[1]!==s?(r=vh(s,ra),t[1]=s,t[2]=r):r=t[2];const o=r;let a;return t[3]!==i||t[4]!==o?(a=[o,i],t[3]=i,t[4]=o,t[5]=a):a=t[5],a}function Zp(t){try{return JSON.parse(t)}catch{return null}}function Qp(t){if(!t||typeof t!="object")return null;const e=t,s=e.content?.find(o=>o.type==="text")?.text,i=s?Zp(s):null,r=e.structuredContent;return r==null?i:typeof r=="object"&&!Array.isArray(r)&&Object.keys(r).length===0?i??r:r}function Bs(t){const e=Qp(t);return e===null?null:e}function na(t){if(!t)return null;const e=t.match(/\/pull\/(\d+)\b/);if(!e)return null;const s=Number(e[1]);return Number.isFinite(s)&&s>0?s:null}function e_(t){if(!t||typeof t!="object")return null;const e=t.content?.find(r=>r.type==="text")?.text;if(!e)return null;const s=e.match(/https:\/\/github\.com\/[^\s"]+\/pull\/\d+/)?.[0],i=na(s);return!i||!s?null:{number:i,htmlUrl:s}}const il=/[\r\n<>]/,t_=/^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/;function Ji(t){const e=t?.userName?.trim();if(!e||il.test(e))return null;const s=t?.userEmail?.trim();return!s||il.test(s)?{userName:e}:t_.test(s)?{userName:e,userEmail:s}:{userName:e}}function s_(t){return t.split(`
|
|
3
3
|
`).filter(e=>!/^Co-authored-by:\s/i.test(e)).join(`
|
|
4
4
|
`).trimEnd()}function i_(t){const e=t.userName.trim(),s=t.userEmail?.trim();return s?`Co-authored-by: ${e} <${s}>`:`Co-authored-by: ${e}`}function xh(t,e){const s=Ji(e);if(!s)return t;const i=s_(t),r=i_(s);if(i.includes(r))return i;const o=i.trimEnd();return o.length>0?`${o}
|
|
5
5
|
|
|
@@ -272,7 +272,7 @@ ${se}`:se;c.setValue("metadata.instructions",ee,{shouldDirty:!0})},G=new Set(d.m
|
|
|
272
272
|
8% { opacity: 1; }
|
|
273
273
|
22% { opacity: 0; }
|
|
274
274
|
}
|
|
275
|
-
`}),e[26]=y):y=e[26];let w;return e[27]!==x||e[28]!==d?(w=n.jsxs("div",{className:"relative flex w-full flex-col items-center justify-center gap-12 select-none [clip-path:inset(-24px_0_-200px_0)]",children:[d,x,y]}),e[27]=x,e[28]=d,e[29]=w):w=e[29],w}function ar(t){const e=K.c(10),{phase:s,current:i,children:r}=t,o=s-i,a=o<0,l=o===0,h=a?90:o*-22,c=a?.94:1-Math.max(o,0)*.04,d=a?0:l?1:o===1?.8:.55,u=a?10:30-o,f=!l;let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=he("absolute inset-0 overflow-hidden rounded-xl border border-foreground/10 bg-background shadow-[0_20px_60px_-20px_rgb(0_0_0_/_0.35)] transition-all ease-[cubic-bezier(0.22,1,0.36,1)]"),e[0]=m):m=e[0];const p=`translateY(${h}px) scale(${c})`,_=l?"auto":"none";let g;e[1]!==d||e[2]!==p||e[3]!==_||e[4]!==u?(g={transform:p,opacity:d,zIndex:u,transitionDuration:"1000ms",pointerEvents:_},e[1]=d,e[2]=p,e[3]=_,e[4]=u,e[5]=g):g=e[5];let v;return e[6]!==r||e[7]!==f||e[8]!==g?(v=n.jsx("div",{"aria-hidden":f,className:m,style:g,children:r}),e[6]=r,e[7]=f,e[8]=g,e[9]=v):v=e[9],v}function hn(t){const e=K.c(7),{showUrl:s}=t,i=s===void 0?!1:s;let r,o,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx("div",{className:he("size-2.5 rounded-full",Ct)}),o=n.jsx("div",{className:he("size-2.5 rounded-full",Ct)}),a=n.jsx("div",{className:he("size-2.5 rounded-full",Ct)}),e[0]=r,e[1]=o,e[2]=a):(r=e[0],o=e[1],a=e[2]);let l;e[3]!==i?(l=i&&n.jsx("div",{className:he("ml-3 h-3.5 max-w-[220px] flex-1 rounded-sm",Ht)}),e[3]=i,e[4]=l):l=e[4];let h;return e[5]!==l?(h=n.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-1.5 px-3",children:[r,o,a,l]}),e[5]=l,e[6]=h):h=e[6],h}function I1(){const t=K.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(hn,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsxs("div",{className:"flex h-full flex-col",children:[e,n.jsx("div",{className:"flex flex-1 px-8 py-5",children:n.jsx("div",{className:"grid h-full w-full grid-cols-8 grid-rows-6 gap-2",children:E1.map(B1)})})]}),t[1]=s):s=t[1],s}function B1(t,e){if(e===cd)return n.jsx("div",{className:"rounded-md bg-chart-1/[0.55]",style:{animation:"vm-breathe 2.4s ease-in-out infinite"}},e);const s=t;return n.jsx("div",{className:he("relative rounded-md",Ct),children:n.jsx("div",{className:"absolute inset-0 rounded-md bg-chart-1/40 opacity-0",style:{animation:`vm-rack-scan ${hd}s ease-in-out infinite`,animationDelay:`${s}s`}})},e)}function M1(){const t=K.c(5);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(hn,{}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx("div",{className:he("w-[18%] rounded-md",Ht),style:{animation:"vm-breathe 3s ease-in-out infinite"}}),t[1]=s):s=t[1];let i;t[2]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx("div",{className:"h-[42%] shrink-0 rounded-md bg-chart-3/[0.12]",style:{animation:"vm-breathe 3s ease-in-out 0.4s infinite"}}),t[2]=i):i=t[2];let r;t[3]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx("div",{className:"col-span-3 rounded-md bg-chart-3/[0.12]",style:{animation:"vm-breathe 3s ease-in-out 0.8s infinite"}}),t[3]=r):r=t[3];let o;return t[4]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsxs("div",{className:"flex h-full flex-col",children:[e,n.jsxs("div",{className:"flex min-h-0 flex-1 gap-1.5 p-3",children:[s,n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[i,n.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-5 gap-1.5",children:[r,n.jsxs("div",{className:"col-span-2 grid grid-rows-2 gap-1.5",children:[n.jsx("div",{className:he("rounded-md",Ht),style:{animation:"vm-breathe 3s ease-in-out 1.2s infinite"}}),n.jsx("div",{className:he("rounded-md",Ht),style:{animation:"vm-breathe 3s ease-in-out 1.6s infinite"}})]})]})]})]})]}),t[4]=o):o=t[4],o}function L1(){const t=K.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(hn,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsxs("div",{className:"flex h-full flex-col",children:[e,n.jsx("div",{className:"relative flex flex-1 items-center justify-center px-8 py-5",children:n.jsx("div",{className:"grid w-full gap-2",style:{gridTemplateColumns:"repeat(7, minmax(0, 1fr))"},children:P1.map(O1)})})]}),t[1]=s):s=t[1],s}function O1(t,e){return n.jsx("div",{className:he("aspect-square rounded-md",A1[e]?"bg-chart-2/70":Ct),style:{animation:`vm-pulse-soft 2.2s ease-in-out ${t}s infinite`}},e)}function $1(){const t=K.c(11);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(hn,{showUrl:!0}),t[0]=e):e=t[0];let s,i,r,o,a;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx("div",{className:"mb-2 h-5 rounded-md bg-chart-1/[0.10]"}),i=n.jsx("div",{className:he("h-1.5 w-[70%] rounded-sm",Ct)}),r=n.jsx("div",{className:he("h-1.5 w-[55%] rounded-sm",Ct)}),o=n.jsx("div",{className:he("h-1.5 w-[80%] rounded-sm",Ct)}),a=n.jsx("div",{className:he("h-1.5 w-[50%] rounded-sm",Ct)}),t[1]=s,t[2]=i,t[3]=r,t[4]=o,t[5]=a):(s=t[1],i=t[2],r=t[3],o=t[4],a=t[5]);let l;t[6]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsxs("div",{className:"flex w-[18%] shrink-0 flex-col gap-1.5 bg-chart-1/[0.05] p-2.5",children:[s,i,r,o,a,n.jsx("div",{className:"mt-auto",children:n.jsx("div",{className:he("h-4 rounded-md",Ct)})})]}),t[6]=l):l=t[6];let h;t[7]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx("div",{className:"relative h-[42%] shrink-0 overflow-hidden bg-chart-1/[0.10]",children:n.jsxs("div",{className:"absolute right-3 bottom-3 left-3 space-y-1.5",children:[n.jsx("div",{className:"h-3 w-[35%] rounded-sm bg-chart-1/[0.15]"}),n.jsx("div",{className:he("h-1.5 w-[55%] rounded-sm",Ht)})]})}),t[7]=h):h=t[7];let c;t[8]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsxs("div",{className:"flex shrink-0 gap-1.5",children:[n.jsx("div",{className:"h-4 w-12 rounded-full bg-chart-1/[0.12]"}),n.jsx("div",{className:he("h-4 w-10 rounded-full",Ht)}),n.jsx("div",{className:he("h-4 w-14 rounded-full",Ht)})]}),t[8]=c):c=t[8];let d;t[9]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsxs("div",{className:he("col-span-3 flex flex-col justify-end gap-1 rounded-md p-2",Ht),children:[n.jsx("div",{className:he("h-1.5 w-[50%] rounded-sm",Ct)}),n.jsx("div",{className:he("h-1 w-[75%] rounded-sm",Ct)})]}),t[9]=d):d=t[9];let u;return t[10]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsxs("div",{className:"flex h-full flex-col",children:[e,n.jsxs("div",{className:"flex min-h-0 flex-1",children:[l,n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[h,n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-2.5 p-3",children:[c,n.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-5 gap-2",children:[d,n.jsxs("div",{className:"col-span-2 grid grid-rows-2 gap-2",children:[n.jsx("div",{className:he("rounded-md",Ht)}),n.jsx("div",{className:he("rounded-md",Ht)})]})]})]})]})]})]}),t[10]=u):u=t[10],u}function Wr(t){const e=K.c(9);if(t.kind==="starting"){let l;return e[0]!==t.claimPhase||e[1]!==t.progress?(l=n.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:n.jsx(D1,{progress:t.progress,claimPhase:t.claimPhase})}),e[0]=t.claimPhase,e[1]=t.progress,e[2]=l):l=e[2],l}let s;e[3]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(Wf,{className:"size-12 text-blue-500"}),e[3]=s):s=e[3];let i,r;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx("h3",{className:"text-lg font-medium",children:j1("suspended")}),r=n.jsx("p",{className:"max-w-sm text-sm text-muted-foreground",children:"Resume to continue."}),e[4]=i,e[5]=r):(i=e[4],r=e[5]);let o;e[6]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(Vs,{className:"size-4"}),e[6]=o):o=e[6];let a;return e[7]!==t.onResume?(a=n.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:n.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-4 text-center",children:[s,i,r,n.jsxs(re,{onClick:t.onResume,className:"mt-2",children:[o," Resume"]})]})}),e[7]=t.onResume,e[8]=a):a=e[8],a}const z1=E.lazy(()=>qt(()=>import("./sections-editor-0pqboVrH.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,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155])).then(t=>({default:t.SectionsEditor}))),F1=E.lazy(()=>qt(()=>import("./page-seo-sheet-BTkQDLYa.js"),__vite__mapDeps([156,1,2,123,44,46,47,48,16,3,5,88,73,83,80,6,7,8,9,10,11,12,13,14,15,17,4,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,45,81,50,82,74,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,49,71,72,75,76,77,78,79,51,84,85,86,87,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,89,90,119,120,121,122,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154])).then(t=>({default:t.SeoSheet}))),H1=E.lazy(()=>qt(()=>import("./file-explorer-CkhSBrMW.js"),__vite__mapDeps([157,1,2,138,6,7,8,9,10,11,12,13,14,15,16,3,17,4,5,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,48,128,93,94,58,59,95,96,97,57,79,60,105,106,49,107,108,109,50,121,122,123,124,85,82,71,125,110,126,56,68,116,77,127,63,64,65,72,73,112,129,52,53,54,55,61,62,66,67,69,70,74,75,76,78,89,90,130,131,132,99,100,137,102,51,92,98,101,103,104,111,86,113,114,115,117,118,119,120,133,134,135,136,139,140,83,141,142,143,144,145,146,147,148,149,150,151,152,153,154])).then(t=>({default:t.FileExplorer}))),Cn=500,W1={mobile:375,tablet:768,desktop:null},kn=["desktop","mobile","tablet"],U1={mobile:"Mobile (375px)",tablet:"Tablet (768px)",desktop:"Desktop"};function K1(t,e){const s=new URL(t,window.location.href);return s.searchParams.set("deviceHint",e),s.href}function V1(){const t=ir(),{currentBranch:e}=ss(),[s,i]=E.useState("preview"),[r,o]=E.useState("desktop"),[a,l]=E.useState(null),h=E.useRef(null),c=s==="cms",[d,u]=E.useState(null),[f,m]=E.useState(384),p=E.useRef(!1),_=E.useRef(0),g=E.useRef(0),v=E.useRef(null),[b,x]=E.useState(!1),[y,w]=E.useState(""),k=E.useRef(null),[j,R]=E.useState(!1),[I,P]=E.useState(),[T,S]=E.useState(null),[C,D]=E.useState(null),[N,A]=E.useState("/"),[M,B]=E.useState(null),[L,O]=E.useState(!1),[W,F]=E.useState(!1),[V,J]=E.useState(null),G=t?.entity?.id??null,{org:U}=Pe(),H=Yt(),X=rd(),oe=X.vmEntry,$=X.previewUrl,se=H.lifecycle.phase,ee=se==="running",Q=G&&e&&ee?{orgSlug:U.slug,virtualMcpId:G,branch:e}:null,{data:z}=ha(Q,{fetchEnabled:ee}),{data:ce}=da(Q,{fetchEnabled:ee}),ue=G&&e?{orgSlug:U.slug,virtualMcpId:G,branch:e}:null,fe=_1(ue),q=z?ya(z).sort((ie,ve)=>ie.name.localeCompare(ve.name)):[],te=z&&ce?Sa(z,ce):[],me=Us,ne=q.filter(ie=>{if(!y)return!0;const ve=y.toLowerCase();return ie.name.toLowerCase().includes(ve)||ie.path.toLowerCase().includes(ve)}),ke=te.filter(ie=>{if(!y)return!0;const ve=y.toLowerCase();return ie.name.toLowerCase().includes(ve)||ie.key.toLowerCase().includes(ve)||ie.resolveType.toLowerCase().includes(ve)}),ot=T?null:O_(q,N,M),Be=T?T.name:ot?.name,mt=ot?.key??null,as=E.useRef(null),Y=E.useRef(null);Y_(()=>{const ie=h.current,ve=as.current;!ie||!ve||(ie.src=ve)});const _e=H.status.state==="paused",xe=H.phase,Se=ld({claimPhase:xe,lifecycle:H.lifecycle}),we=X.previewState,dt=X.userStopped,bt=we.kind==="iframe"?K1(C??new URL(N,we.previewUrl).href,r):null,[rr,nr]=E.useState(null);if(we.kind==="iframe"&&rr!==we.previewUrl){const ie=rr!==null;nr(we.previewUrl),ie&&(Y.current=null,A("/"),D(null),B(null),S(null))}as.current=bt;const ge=!!G&&!!e&&!H.notFound&&!dt&&!_e&&(xe?.kind==="ready"||se!=="idle"),je=we.kind!=="iframe"&&(s==="visual"||s==="cms")?"preview":s;E.useEffect(()=>{if(!$)return;let ie;try{ie=new URL($,window.location.href).origin}catch{return}const ve=st=>{if(st.origin===ie){if(st.data?.type==="visual-editor::element-clicked"){const it=v1.safeParse(st.data.payload);it.success&&l(it.data)}else if(st.data?.type==="cms-editor::section-clicked"){const it=b1.safeParse(st.data.payload);it.success&&u(it.data.sectionIndex)}}};return window.addEventListener("message",ve),()=>window.removeEventListener("message",ve)},[$]),E.useEffect(()=>{if(!b)return;const ie=ve=>{k.current?.contains(ve.target)||(x(!1),w(""))};return document.addEventListener("pointerdown",ie),()=>document.removeEventListener("pointerdown",ie)},[b]),E.useEffect(()=>{if(!c)return;const ie=st=>{const it=st.target;it&&it!==h.current&&(v.current=it)},ve=()=>{requestAnimationFrame(()=>{const st=document.activeElement;(st===document.body||st===h.current)&&v.current&&v.current.focus()})};return document.addEventListener("focusin",ie),document.addEventListener("blur",ve,!0),()=>{document.removeEventListener("focusin",ie),document.removeEventListener("blur",ve,!0)}},[c]);const et=()=>{const ie=h.current?.contentWindow;ie&&ie.postMessage({type:"visual-editor::activate",script:x1},"*")},yt=()=>{const ie=h.current?.contentWindow;ie&&ie.postMessage({type:"visual-editor::deactivate"},"*")},tt=()=>{const ie=h.current?.contentWindow;ie&&ie.postMessage({type:"visual-editor::activate",script:y1},"*")},Tu=()=>{const ie=h.current?.contentWindow;ie&&ie.postMessage({type:"cms-editor::deactivate"},"*")},di=ie=>{const ve=s;i(ie),l(null),ie!=="code"&&J(null),ie!=="cms"&&u(null),ve==="visual"&&yt(),ve==="cms"&&Tu(),ie==="visual"&&et(),ie==="cms"&&tt()},Ru=()=>{if(!h.current||!bt)return;const ie=h.current;ie.src=bt},Pu=()=>{if(!h.current||!bt)return;const ie=bt.includes("?")?"&":"?";h.current.src=`${bt}${ie}_r=${Date.now()}`},Au=()=>{const ie=kn.indexOf(r);o(kn[(ie+1)%kn.length])},Du=()=>{const ie=h.current?.contentWindow?.location?.href??bt??$;ie&&navigator.clipboard.writeText(ie)},Iu=(()=>{if(!$)return"No server running";if(T)return T.name;try{const ie=new URL($),ve=N==="/"?"":N;return`${ie.host}${ve}`}catch{return $}})(),Fa=ie=>{Y.current=ie.path,S(null),D(null),B(ie.key),A(ie.path),u(null),O(!1)},Bu=ie=>{if(!$||!ce){le.error("Preview metadata not ready yet");return}Y.current=null;const ve=Oh(ce),st=u1($,ve,ie.key);S(ie),D(st),u(null)},Mu=async({name:ie,path:ve})=>{if(!G||!e)return;const st=ga(ve);if(st){P(st);return}const it=ve.trim().startsWith("/")?ve.trim():`/${ve.trim()}`;if(q.some(Et=>me(Et.path)===me(it))){P(`A page with path "${it}" already exists.`);return}P(void 0);try{const Et=await fe.mutateAsync({name:ie,path:it});R(!1),le.success(`Page "${ie}" created`),await new Promise(Ou=>setTimeout(Ou,Cn)),Fa({key:Et.key,name:Et.name,path:Et.path}),di("cms")}catch(Et){P(Et instanceof Error?Et.message:"Failed to create page")}},Lu=[{value:"preview",icon:n.jsx(Va,{size:14}),tooltip:"Interactive"},...we.kind==="iframe"?[{value:"visual",icon:n.jsx(qa,{size:14}),tooltip:"Visual editor"}]:[],...we.kind==="iframe"&&ba(z,ce)?[{value:"cms",icon:n.jsx(Uf,{size:14}),tooltip:"Sections editor"}]:[],{value:"code",icon:n.jsx(Kf,{size:14}),tooltip:"Code editor"}];return n.jsxs("div",{className:"flex flex-col w-full h-full",children:[ge&&n.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-4 border-b border-border/60 px-3 md:px-4",children:[n.jsx("div",{className:"flex shrink-0 items-center gap-1",children:n.jsx(ip,{value:je,onValueChange:di,options:Lu,size:"sm",className:"shrink-0 bg-foreground/4.5"})}),we.kind==="iframe"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:he("flex min-w-0 flex-1 items-center gap-0.5 ml-2",s==="code"&&"hidden"),children:[n.jsxs(Re,{children:[n.jsx(Ee,{asChild:!0,children:n.jsx(re,{variant:"ghost",size:"icon",onClick:Ru,children:n.jsx(Mi,{size:14})})}),n.jsx(Te,{side:"bottom",children:"Refresh"})]}),n.jsxs(Re,{children:[n.jsx(Ee,{asChild:!0,children:n.jsx(re,{variant:"ghost",size:"icon",onClick:Au,children:n.jsxs("span",{className:"flex items-center justify-center animate-device-icon-pop",children:[r==="mobile"&&n.jsx(Vf,{size:14}),r==="tablet"&&n.jsx(qf,{size:14}),r==="desktop"&&n.jsx(Va,{size:14})]},r)})}),n.jsx(Te,{side:"bottom",children:U1[r]})]}),n.jsxs("div",{ref:k,className:"relative min-w-0 flex-1",children:[n.jsxs("button",{type:"button",className:"flex h-8 w-full min-w-0 items-center gap-1 rounded-md bg-background px-2 transition-colors duration-200 hover:bg-accent",onClick:()=>x(ie=>!ie),children:[T&&n.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 rounded bg-global-section/14 px-1.5 py-0.5 text-[11px] font-medium text-global-section-fg dark:text-global-section-fg-dark",children:[n.jsx(Gs,{size:11}),"Global"]}),n.jsx("span",{className:"min-w-0 flex-1 truncate text-left text-[12px] text-foreground/88",children:Iu}),Be&&!T&&n.jsx("span",{className:"shrink-0 text-[12px] text-muted-foreground",children:Be}),n.jsx(Es,{size:12,className:he("shrink-0 text-muted-foreground transition-transform",b&&"rotate-180")})]}),b&&n.jsxs("div",{className:"absolute left-0 right-0 top-full z-50 mt-1.5 overflow-hidden rounded-lg border bg-popover shadow-lg",children:[n.jsxs("div",{className:"px-2 h-10 flex items-center gap-2 border-b",children:[n.jsx(fh,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),n.jsx("input",{type:"text",value:y,onChange:ie=>w(ie.target.value),placeholder:"Search pages and components...",className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",autoFocus:!0})]}),n.jsx("div",{className:"p-1.5 border-b",children:n.jsxs("button",{type:"button",className:"flex w-full items-center gap-2.5 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:ie=>{ie.preventDefault(),x(!1),w(""),P(void 0),R(!0)},children:[n.jsx(xt,{size:16,className:"shrink-0 text-muted-foreground"}),n.jsx("span",{className:"flex-1 font-medium",children:"Create new page"})]})}),ne.length===0&&ke.length===0?n.jsx("div",{className:"px-4 py-5 text-center text-xs text-muted-foreground",children:q.length===0&&te.length===0?"No pages found in this site.":"No results match your search."}):n.jsxs("div",{className:"max-h-80 overflow-y-auto overscroll-contain",children:[ne.length>0&&n.jsx("div",{className:"p-1.5",children:ne.map(ie=>n.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:ve=>{ve.preventDefault(),x(!1),w(""),Fa(ie)},children:[n.jsx(Vo,{size:16,className:"shrink-0 text-muted-foreground"}),n.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:ie.name}),n.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:ie.path})]},ie.key))}),ke.length>0&&n.jsxs("div",{className:he("p-1.5",ne.length>0&&"border-t"),children:[n.jsx("div",{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"Global components"}),ke.map(ie=>n.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:ve=>{ve.preventDefault(),x(!1),w(""),Bu(ie)},children:[n.jsx(Gs,{size:16,className:"shrink-0 text-muted-foreground"}),n.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:ie.name}),n.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:ie.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},ie.key))]})]})]})]})]}),n.jsxs("div",{className:he("flex shrink-0 items-center gap-0.5",s==="code"&&"hidden"),children:[n.jsxs(Re,{children:[n.jsx(Ee,{asChild:!0,children:n.jsx(re,{variant:"ghost",size:"icon",onClick:()=>{const ie=bt??we.previewUrl;ie&&window.open(ie,"_blank","noopener")},children:n.jsx(ri,{size:14})})}),n.jsx(Te,{side:"bottom",children:"Open in new tab"})]}),n.jsxs(As,{children:[n.jsx(Ds,{asChild:!0,children:n.jsx(re,{variant:"ghost",size:"icon",children:n.jsx(nn,{size:14})})}),n.jsxs(Is,{align:"end",className:"w-44",children:[n.jsx(He,{onClick:Pu,children:"Hard Reload"}),n.jsx(He,{onClick:Du,children:"Copy Current URL"}),z&&ce&&n.jsxs(n.Fragment,{children:[n.jsx(vr,{}),mt&&n.jsxs(He,{onClick:()=>{O(!0),di("cms")},children:[n.jsx(Nr,{size:14}),"Edit SEO"]}),mt&&n.jsxs(He,{onClick:()=>{try{J(Ja(mt)),di("code")}catch{le.error("Invalid page block key")}},children:[n.jsx(qo,{size:14}),"View JSON"]}),n.jsxs(He,{onClick:()=>F(!0),children:[n.jsx(Nr,{size:14}),"Site SEO"]})]})]})]})]})]})]}),n.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[c&&$&&e&&G&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"shrink-0 border-r overflow-hidden",style:{width:f},children:n.jsx(E.Suspense,{fallback:n.jsx("div",{className:"h-full flex items-center justify-center",children:n.jsx(Ce,{size:20,className:"animate-spin text-muted-foreground"})}),children:n.jsx(z1,{orgSlug:U.slug,virtualMcpId:G,branch:e,previewReady:ee,previewUrl:$,currentPath:N,activePageBlockKey:mt,activeGlobalBlockKey:T?.key??null,externalSelectedIndex:T?null:d,onSaved:()=>{setTimeout(()=>{const ie=h.current;if(!ie)return;const ve=document.activeElement,st=ie.tabIndex;ie.tabIndex=-1,ie.style.pointerEvents="none",ie.blur();try{ie.contentWindow?.location.reload()}catch{const Et=as.current;Et&&(ie.src=Et)}const it=()=>{ie.tabIndex=st,ie.style.pointerEvents="",ve?.focus(),ie.removeEventListener("load",it)};ie.addEventListener("load",it),setTimeout(it,3e3)},Cn)},initialEditSeo:L,onExitSeo:()=>O(!1),onViewJsonFile:ie=>{try{J(Ja(ie)),di("code")}catch{le.error("Invalid page block key")}}})})}),n.jsx("div",{className:"w-1 shrink-0 cursor-col-resize bg-transparent hover:bg-border transition-colors",onPointerDown:ie=>{p.current=!0,_.current=ie.clientX,g.current=f,ie.currentTarget.setPointerCapture(ie.pointerId)},onPointerMove:ie=>{if(!p.current)return;const ve=ie.clientX-_.current;m(Math.max(240,Math.min(640,g.current+ve)))},onPointerUp:()=>{p.current=!1}})]}),n.jsxs("div",{className:he("flex-1 relative overflow-hidden",r!=="desktop"&&we.kind==="iframe"&&s!=="code"&&"flex justify-center bg-muted/30"),children:[we.kind==="starting"&&n.jsx("div",{className:"absolute inset-0 z-30",children:n.jsx(Wr,{kind:"starting",progress:Se,claimPhase:xe})}),we.kind==="suspended"&&n.jsx("div",{className:"absolute inset-0 z-30",children:n.jsx(Wr,{kind:"suspended",onResume:X.resume})}),je==="visual"&&!a&&n.jsxs("div",{className:"absolute top-2 left-1/2 -translate-x-1/2 z-20 flex items-center gap-1.5 rounded-full border border-violet-400/40 bg-violet-500/90 px-3 py-1 text-xs font-medium text-white shadow-md backdrop-blur-sm pointer-events-none select-none",children:[n.jsx(qa,{size:12}),"Click any element to ask the AI"]}),je==="visual"&&a&&n.jsx(C1,{element:a,onDismiss:()=>l(null)}),s==="code"&&ge&&G&&e&&n.jsx("div",{className:"absolute inset-0 z-10 bg-background",children:n.jsx(E.Suspense,{fallback:n.jsx("div",{className:"h-full flex items-center justify-center",children:n.jsx(Ce,{size:20,className:"animate-spin text-muted-foreground"})}),children:n.jsx(H1,{orgSlug:U.slug,virtualMcpId:G,branch:e,openPath:V})})}),we.kind==="iframe"&&bt&&n.jsx("div",{className:he("h-full transition-[width] duration-250 [transition-timing-function:var(--ease-in-out-cubic)]",r!=="desktop"&&s!=="code"&&"w-full max-w-full border-x border-border bg-background shadow-sm"),style:{width:r==="desktop"||s==="code"?"100%":`${W1[r]}px`},children:n.jsx("iframe",{ref:h,src:bt,className:he("w-full h-full border-0",s==="code"&&"invisible"),title:"Dev Server Preview",tabIndex:c?-1:void 0,onLoad:()=>{if(Ae("vm_preview_loaded",{view_mode:s,vm_id:oe?.sandboxHandle??null}),!T)try{const ie=h.current?.contentWindow?.location?.pathname;if(!ie)return;const ve=Y.current;if(ve!==null){Y.current=null,me(ie)===me(ve)&&A(ie);return}A(ie)}catch{}s==="visual"&&et(),s==="cms"&&tt()}},we.previewUrl)})]})]}),n.jsx(g1,{open:j,onOpenChange:R,isPending:fe.isPending,error:I,onSubmit:Mu}),W&&z&&ce&&n.jsx(E.Suspense,{fallback:null,children:n.jsx(F1,{open:W,onOpenChange:F,orgSlug:U.slug,virtualMcpId:G??"",branch:e??"",decofile:z,meta:ce,onSaved:()=>{setTimeout(()=>{const ie=h.current;if(ie)try{ie.contentWindow?.location.reload()}catch{const ve=as.current;ve&&(ie.src=ve)}},Cn)},target:{kind:"site"}})})]})}function q1(t){const e=K.c(2),{virtualMcpId:s}=t,i=Mt(s);if(!ti(i?.metadata)){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 text-center text-sm text-muted-foreground p-6",children:[n.jsx(Ki,{size:24,className:"text-muted-foreground/60"}),n.jsx("div",{children:"No source to preview."}),n.jsx("div",{className:"text-xs text-muted-foreground/80",children:"Connect a GitHub repository from the Connections tab to enable Preview."})]}),e[0]=a):a=e[0],a}let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(V1,{}),e[1]=o):o=e[1],o}function G1(t,e){if(!t||!e?.length)return t;const s=Object.fromEntries(Object.entries(t.properties??{}).filter(([i])=>!e.includes(i)));return Object.keys(s).length>0?{...t,properties:s}:t}function Y1(t,e,s){return typeof t!="string"?null:G1(Bh(t,e),s)}function dd(t,e,s){if(!e||typeof t!="string")return!1;const i=Y1(t,e,s);return!!i&&Object.keys(i.properties??{}).length>0}function X1({orgSlug:t,virtualMcpId:e,branch:s}){const i=Qs();return ei({mutationFn:async({blockKey:r})=>{const o=rh(r),a=await fetch(`/api/${t}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(s)}/unlink`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:o})});if(!a.ok){const l=await a.json().catch(()=>({}));throw new Error(l.error??`Delete failed (${a.status})`)}return a.json()},onMutate:async({blockKey:r})=>{const o=`${t}/${e}/${s}`,a=Bt.decofile(o);await i.cancelQueries({queryKey:a});const l=i.getQueryData(a);return i.setQueryData(a,h=>{if(!h)return h;const{[r]:c,...d}=h;return d}),{previous:l,queryKey:a}},onError:(r,o,a)=>{a?.queryKey&&i.setQueryData(a.queryKey,a.previous)},onSuccess:()=>{const r=`${t}/${e}/${s}`;i.invalidateQueries({queryKey:Bt.liveMeta(r)})}})}function dn(t,e){return`${t}-${e}`}function ud(t,e){return`site/apps/${t}/${e}.ts`}function fd(t){const e=t.match(/^site\/apps\/([^/]+)\/([^/.]+)\.tsx?$/);if(e)return{vendor:e[1],app:e[2]};const s=t.match(/^([^/]+)\/apps\/([^/.]+)\.tsx?$/);return s?{vendor:s[1],app:s[2]}:null}function J1(t){const e=t.match(/^([^-]+)-(.+)$/);return e?{vendor:e[1],app:e[2]}:null}function Z1(t){return t==="local"?"Custom":"Installed"}function md(t,e,s){const i=new Set([dn(t,e),e].map(o=>o.toLowerCase())),r=ud(t,e);for(const[o,a]of Object.entries(s)){if(o.includes("/")||!a||typeof a!="object"||Array.isArray(a))continue;const l=a;if(i.has(o.toLowerCase())||l.__resolveType===r)return o}return null}function Q1(t,e){const s=t.vendor.alias,i=t.name,r=md(s,i,e);return{id:dn(s,i),app:i,vendor:s,title:t.title||t.name,description:t.description,category:t.category??"Other",logo:t.logo||void 0,resolveType:ud(s,i),blockKey:r,installed:r!==null}}function ex(t,e,s){if(t===xa)return null;const i=fd(t);if(!i)return null;const{vendor:r,app:o}=i,a=md(r,o,s),l=ni(t,e);return{id:dn(r,o),app:o,vendor:r,title:l.title??o,description:l.description??"",category:"Others",logo:l.logo??l.icon,resolveType:t,blockKey:a,installed:a!==null}}function tx(t,e,s){const i=e.__resolveType;if(typeof i!="string"||Fr(t,e)||!Ih(i))return null;const r=fd(i)??J1(t);if(!r)return null;const o=ni(i,s),{vendor:a,app:l}=r;return{id:dn(a,l),app:l,vendor:a,title:o.title??Hr(t,e,s),description:o.description??"",category:Z1(a),logo:o.logo??o.icon,resolveType:i,blockKey:t,installed:!0}}function sx(t,e,s){const i=new Map;for(const o of t){const a=Q1(o,s);i.set(a.id,a)}const r=e.manifest?.blocks?.apps??{};for(const o of Object.keys(r)){const a=ex(o,e,s);!a||i.has(a.id)||i.set(a.id,a)}for(const[o,a]of Object.entries(s)){if(o.includes("/")||!a||typeof a!="object"||Array.isArray(a))continue;const l=tx(o,a,e);!l||i.has(l.id)||i.set(l.id,l)}return[...i.values()].sort(ix)}function ix(t,e){return t.installed!==e.installed?t.installed?-1:1:t.title.localeCompare(e.title)}async function rx(){const t=await fetch("/api/deco-apps");if(!t.ok)throw new Error(`Failed to fetch deco apps: ${t.status}`);return(await t.json()).apps??[]}function nx(t,e,s){const i=K.c(12),r=s?.enabled??!0;let o;i[0]===Symbol.for("react.memo_cache_sentinel")?(o=Bt.decoApps(),i[0]=o):o=i[0];let a;i[1]!==r?(a={queryKey:o,queryFn:rx,staleTime:3e5,retry:1,enabled:r},i[1]=r,i[2]=a):a=i[2];const l=Zs(a);let h;i[3]!==e||i[4]!==t||i[5]!==l.data?(h=t&&e?sx(l.data??[],t,e):[],i[3]=e,i[4]=t,i[5]=l.data,i[6]=h):h=i[6];const c=h,d=l.isLoading&&!l.isError;let u;return i[7]!==c||i[8]!==l.isError||i[9]!==l.refetch||i[10]!==d?(u={catalog:c,isLoading:d,isError:l.isError,refetch:l.refetch},i[7]=c,i[8]=l.isError,i[9]=l.refetch,i[10]=d,i[11]=u):u=i[11],u}const ox=new Set(["website/pages/Page.tsx","$live/pages/LivePage.tsx"]);function ax(t){return t.includes("matchers")||t.includes("Match")}function lx(t,e){const s=t.__resolveType;return typeof s!="string"||!s||ox.has(s)?!1:e?j_(e,s):ax(s)}function Zi(t,e,s){if(!t)return!1;const i=t.__resolveType;if(typeof i!="string"||!fa(i)||!Object.hasOwn(e,i))return!1;const r=e[i];return!r||typeof r!="object"||Array.isArray(r)?!1:lx(r,s)}function ek(t,e,s){return Zi(t,e,s)?t?.__resolveType??null:null}function pd(t,e,s){if(!t)return null;const i=t.__resolveType??"";if(!i)return null;if(Zi(t,e,s)){const a=e[i]??{},l=a.__resolveType??i,{__resolveType:h,name:c,...d}=a;return{resolveType:l,data:d,blockKey:i}}const{__resolveType:r,...o}=t;return{resolveType:i,data:o}}function cx(t,e,s){const i=pd(t,e,s);return i?{__resolveType:i.resolveType,...i.data}:{__resolveType:""}}function tk(t,e,s){if(t)return Zi(t,e,s)?cx(t,e,s):t}function hx(t,e,s,i){if(!t)return"Default";if(Zi(t,e,i)){const r=t.__resolveType??"",o=e[r];return Fh(r,o)}return s(t)}function sk(t,e,s){return{__resolveType:t,...e,name:s}}function ik(t){return{__resolveType:t}}function rk(t,e,s){const i=pd(t,e,s);return i?{resolveType:i.resolveType,formValue:i.data}:{resolveType:"",formValue:{}}}function _d(t){const e=t.__resolveType??"";return es(e)?t.section??t:t}function Ur(t){const r=(es(t.__resolveType??"")?t.section:t)?.variants?.[0];return r?.rule?.__resolveType!==Eh?null:r?.value??null}function nk(t){const e=_d(t);return{__resolveType:Th,variants:[{value:e,rule:{__resolveType:Eh}}]}}function ok(t){const e=t.__resolveType??"";if(!e)return null;if(es(e))return t.section??null;const s=Ur(t);return s?es(s.__resolveType??"")?s:{__resolveType:al,section:_d(s)}:{__resolveType:al,section:t}}function lr(t){const e=t.__resolveType??"";if(!e)return null;if(es(e)){const s=t.section,i=s?.__resolveType??"";return!i||!s?null:{resolveType:i,data:s}}return{resolveType:e,data:t}}function ak(t){const e=Ur(t);if(e)return lr(e);if(es(t.__resolveType??"")){const i=t.section;if(!i)return null;const r=Ur(i);return lr(r||i)}return lr(t)}function lk(t){return Ur(t)}const dx=["website/matchers/always.ts","$live/matchers/MatchAlways.ts"];function gd(t){if(!t)return!1;const e=t.__resolveType??"";return e===""?Object.keys(t).length===0:dx.includes(e)||e.includes("always")}function ux(t){const e=t.variants??[];if(e.length===0)return-1;const s=e.findIndex(i=>gd(i.rule));return s!==-1?s:e.length-1}function ck(t,e,s){const i=s.variants??[];if(i.length===0)return null;const r=ux(s),o=i[r]?.value;if(!o)return null;const a=structuredClone(o);return e.isLazy?{...t,section:a}:a}function vd(t,e){return e.isMultivariate?e.isLazy?t.section??null:t:null}function hk(t,e){return Array.isArray(t.variants)?t.variants.map((s,i)=>({label:e(s.rule)||`Variant ${i+1}`,value:s.value??{},rule:s.rule})):[]}function dk(t,e){const s=t.__resolveType??"";if(!s)return null;if(es(s)){const i=t.section??t,r=i.__resolveType??s;if(!r.includes("/")&&r in e){const o=e[r]??{};return{data:{...o},resolveType:o.__resolveType??r}}return{data:{...i},resolveType:r}}if(!s.includes("/")&&s in e){const i=e[s]??{};return{data:{...i},resolveType:i.__resolveType??s}}return{data:{...t},resolveType:s}}function fx(t,e){const s=t.__resolveType??"";return es(s)?{...t,section:e}:e}function mx(t,e,s){return e.isLazy?{...t,section:s}:s}function uk(t,e,s){const i=[...t.variants??[]],r=i[e];if(!r)return t;const o=r.value??{};return i[e]={...r,value:fx(o,s)},{...t,variants:i}}function fk(t,e,s){const i=[...t.variants??[]];return i[e]?(i[e]={...i[e],rule:s},{...t,variants:i}):t}function mk(t,e){const s=[...t.variants??[]],i=s[e];return i?(s.splice(e+1,0,structuredClone(i)),{...t,variants:s}):t}function pk(t,e){const s=[...t.variants??[]];return s.length<=1?null:(s.splice(e,1),{...t,variants:s})}function Qn(t){return{rule:ma(),value:structuredClone(t)}}function xd(t,e){return{...e,__resolveType:Th,variants:t}}function _k(t){return t.isHidden!==!0&&t.isSavedBlock!==!0}function px(t,e){if(e.isHidden)return null;if(e.isMultivariate){const i=vd(t,e)?.variants??[],r=i[i.length-1]?.value;return r?structuredClone(r):null}if(e.isLazy){const s=t.section;return s?structuredClone(s):null}return structuredClone(t)}function _x(t,e,s){if(e.isMultivariate||e.isHidden)return null;const i=px(t,e);if(!i)return null;const r=xd([Qn(i),Qn(i)]);return e.isLazy?{...t,section:r}:r}function gk(t,e,s){if(e.isHidden||e.isSavedBlock)return null;if(e.isMultivariate){const r=vd(t,e);if(!r)return null;const o=r.variants??[],a=o[o.length-1]?.value;if(!a)return null;const l=xd([...o,Qn(a)],r);return{section:mx(t,e,l),newVariantIndex:o.length}}const i=_x(t,e);return i?{section:i,newVariantIndex:1}:null}const gx=new Set(["website/pages/Page.tsx","$live/pages/LivePage.tsx"]);function vk(t){return t.anyOfRefs?.some(e=>e.resolveType!==cn?!1:e.schema?.properties?.variants?.items?.properties?.value?.type==="array")??!1}function bd(t){return!t||typeof t!="object"||Array.isArray(t)?!1:t.__resolveType===cn}function xk(t){if(!bd(t))return null;const e=t.variants;if(!Array.isArray(e))return null;const s=e[0]?.value;return Array.isArray(s)?s:null}function bk(t,e){if(!bd(t))return e;const s=structuredClone(t),i=[...s.variants??[]];return i.length===0?i.push({rule:ma(),value:e}):i[0]={...i[0],value:e},{...s,variants:i}}function vx(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;const e=t;return typeof e.__resolveType=="string"&&gx.has(e.__resolveType)&&typeof e.path=="string"}function yd(t,e){const i=t[e]?.sections;if(!i||Array.isArray(i))return 1;const r=i;return Array.isArray(r.variants)?r.variants.length:1}function xx(t,e,s){const r=t[e]?.sections;if(Array.isArray(r))return s===0?r:[];if(r&&typeof r=="object"){const o=r.variants;if(Array.isArray(o)){const a=o[s];return Array.isArray(a?.value)?a.value:[]}}return[]}function yk(t,e,s){if(Array.isArray(t))return[{label:"Default",sections:t}];if(t&&typeof t=="object"){const i=t;if(Array.isArray(i.variants)){const r=i.variants,o=r.map(h=>hx(h.rule,e,s)),a=o.reduce((h,c)=>(h[c]=(h[c]??0)+1,h),{}),l={};return r.map((h,c)=>{const d=o[c]??`Variant ${c+1}`,u=a[d]??1;let f=d;return u>1&&(l[d]=(l[d]??0)+1,f=`${d} ${l[d]}`),{label:f||`Variant ${c+1}`,sections:Array.isArray(h.value)?h.value:[],rule:h.rule}})}}return[]}function mi(t){return{rule:ma(),value:t}}function Ks(t,e){return{...e,__resolveType:cn,variants:t}}function bx(t,e){const s=structuredClone(e);if(Array.isArray(t))return Ks([mi(t),mi(s)]);if(t&&typeof t=="object"){const i=t;return Array.isArray(i.variants)?Ks([...i.variants,mi(s)],i):null}return Ks([mi([]),mi(s)])}function Sk(t){const e=t.variants;return Array.isArray(e)?e.length-1:1}function wk(t,e){if(e.length===0)return Ks([],t);if(e.length===1){const s=e[0],i=s?.rule;if(!gd(i))return Ks(e,t);if(Array.isArray(s?.value))return s.value}return Ks(e,t)}function yx(t,e){for(const[s,i]of Object.entries(t)){if(!vx(i))continue;const r=i.sections;if(Array.isArray(r)){e(void 0,s,0);continue}if(!r||typeof r!="object")continue;const o=r.variants;if(Array.isArray(o))for(let a=0;a<o.length;a++){const l=o[a];e(l?.rule,s,a)}}}function Ck(t,e,s){let i=0;return yx(t,r=>{if(!r)return;(r.__resolveType??"")===e&&Zi(r,t,s)&&i++}),i}function Cl(t,e){const s=e.replace(/\s*\(copy(?:\s+\d+)?\)\s*$/,"").trim(),i=`${s} (copy)`;if(!t.has(i))return i;for(let r=2;r<1e3;r++){const o=`${s} (copy ${r})`;if(!t.has(o))return o}return`${s} (copy ${Date.now()})`}function Sx(t,e){const s=Us,i=e.replace(/-copy(?:-\d+)?$/,""),r=`${i}-copy`;if(!t.has(s(r)))return r;for(let o=2;o<1e3;o++){const a=`${i}-copy-${o}`;if(!t.has(s(a)))return a}return`${i}-copy-${Date.now()}`}function Sd(t,e){const s=e.replace(/_copy(?:_\d+)?$/,""),i=`${s}_copy`;if(!Object.hasOwn(t,i))return i;for(let r=2;r<1e3;r++){const o=`${s}_copy_${r}`;if(!Object.hasOwn(t,o))return o}return`${s}_copy_${Date.now()}`}function wx(t){const e=ja(t.newName),s={...t.source,name:t.newName,path:t.newPath};return{key:e,data:s}}function Cx(t,e){return od(t,e)}const kx=1e3;function jx(t,e){for(let s=0;s<kx;s++){const i=ja(e);if(!Object.hasOwn(t,i))return i}throw new Error("Could not generate a unique page block key")}function Nx(t,e){const s=(t.title||t.resolveType.split("/").pop()||"").replace(/\.(tsx?|jsx?)$/,"").replace(/[^A-Za-z0-9_-]/g,""),i=/^[A-Za-z]/.test(s)&&s.length>0?s:"Section",r=Sd(e,i);return{blockKey:r,data:{__resolveType:t.resolveType,name:r}}}const Ex={create:"Create new page",duplicate:"Duplicate page",rename:"Rename page"},Tx={create:"Create",duplicate:"Duplicate",rename:"Save"},Rx={create:"Creating…",duplicate:"Duplicating…",rename:"Saving…"};function Px(t){const e=K.c(54),{open:s,mode:i,initialName:r,initialPath:o,isPending:a,error:l,validate:h,onSubmit:c,onOpenChange:d}=t,u=a===void 0?!1:a,[f,m]=E.useState(r),[p,_]=E.useState(o),[g,v]=E.useState(null),[b,x]=E.useState(s);s!==b&&(x(s),s&&(m(r),_(o),v(null)));let y;e[0]!==u||e[1]!==d?(y=H=>{!H&&!u&&(v(null),d(!1))},e[0]=u,e[1]=d,e[2]=y):y=e[2];const w=y;let k;e[3]!==u||e[4]!==f||e[5]!==c||e[6]!==p||e[7]!==h?(k=async H=>{H.preventDefault();const X=f.trim(),oe=p.trim();if(!X||!oe||u)return;const $=ga(oe);if($){v($);return}const se=h?.({name:X,path:oe});if(se){v(se);return}v(null),await c({name:X,path:oe})},e[3]=u,e[4]=f,e[5]=c,e[6]=p,e[7]=h,e[8]=k):k=e[8];const j=k,R=g??l,I=Ex[i];let P;e[9]!==I?(P=n.jsx(is,{children:n.jsx(rs,{children:I})}),e[9]=I,e[10]=P):P=e[10];let T;e[11]===Symbol.for("react.memo_cache_sentinel")?(T=n.jsx("label",{htmlFor:"page-form-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[11]=T):T=e[11];let S;e[12]===Symbol.for("react.memo_cache_sentinel")?(S=H=>m(H.target.value),e[12]=S):S=e[12];let C;e[13]!==u||e[14]!==f?(C=n.jsxs("div",{className:"space-y-1.5",children:[T,n.jsx(qe,{id:"page-form-name",value:f,onChange:S,placeholder:"My page",autoFocus:!0,disabled:u})]}),e[13]=u,e[14]=f,e[15]=C):C=e[15];let D;e[16]===Symbol.for("react.memo_cache_sentinel")?(D=n.jsx("label",{htmlFor:"page-form-path",className:"text-xs font-medium text-muted-foreground",children:"Path"}),e[16]=D):D=e[16];let N;e[17]===Symbol.for("react.memo_cache_sentinel")?(N=H=>_(H.target.value),e[17]=N):N=e[17];let A;e[18]!==u||e[19]!==p?(A=n.jsxs("div",{className:"space-y-1.5",children:[D,n.jsx(qe,{id:"page-form-path",value:p,onChange:N,placeholder:"/example",disabled:u})]}),e[18]=u,e[19]=p,e[20]=A):A=e[20];let M;e[21]!==R?(M=R&&n.jsx("p",{className:"text-xs text-destructive",children:R}),e[21]=R,e[22]=M):M=e[22];let B;e[23]!==A||e[24]!==M||e[25]!==C?(B=n.jsxs("div",{className:"space-y-4 py-4",children:[C,A,M]}),e[23]=A,e[24]=M,e[25]=C,e[26]=B):B=e[26];let L;e[27]!==d?(L=()=>d(!1),e[27]=d,e[28]=L):L=e[28];let O;e[29]!==u||e[30]!==L?(O=n.jsx(re,{type:"button",variant:"outline",onClick:L,disabled:u,children:"Cancel"}),e[29]=u,e[30]=L,e[31]=O):O=e[31];let W;e[32]!==u||e[33]!==f||e[34]!==p?(W=!f.trim()||!p.trim()||u,e[32]=u,e[33]=f,e[34]=p,e[35]=W):W=e[35];let F;e[36]!==u||e[37]!==i?(F=u?n.jsxs(n.Fragment,{children:[n.jsx(Ce,{size:14,className:"animate-spin"}),Rx[i]]}):Tx[i],e[36]=u,e[37]=i,e[38]=F):F=e[38];let V;e[39]!==W||e[40]!==F?(V=n.jsx(re,{type:"submit",disabled:W,children:F}),e[39]=W,e[40]=F,e[41]=V):V=e[41];let J;e[42]!==O||e[43]!==V?(J=n.jsxs(si,{children:[O,V]}),e[42]=O,e[43]=V,e[44]=J):J=e[44];let G;e[45]!==j||e[46]!==B||e[47]!==J||e[48]!==P?(G=n.jsx(Ot,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:j,children:[P,B,J]})}),e[45]=j,e[46]=B,e[47]=J,e[48]=P,e[49]=G):G=e[49];let U;return e[50]!==w||e[51]!==s||e[52]!==G?(U=n.jsx(Lt,{open:s,onOpenChange:w,children:G}),e[50]=w,e[51]=s,e[52]=G,e[53]=U):U=e[53],U}function Ax(t){const e=K.c(43),{open:s,blockKey:i,initialName:r,isPending:o,onSubmit:a,onOpenChange:l}=t,h=o===void 0?!1:o,[c,d]=E.useState(r),[u,f]=E.useState(s);s!==u&&(f(s),s&&d(r));let m;e[0]!==h||e[1]!==l?(m=A=>{!A&&!h&&l(!1)},e[0]=h,e[1]=l,e[2]=m):m=e[2];const p=m;let _;e[3]!==h||e[4]!==c||e[5]!==a?(_=async A=>{A.preventDefault();const M=c.trim();!M||h||await a(M)},e[3]=h,e[4]=c,e[5]=a,e[6]=_):_=e[6];const g=_;let v;e[7]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsxs(is,{children:[n.jsx(rs,{children:"Rename section"}),n.jsx(Jo,{children:"Updates the display name. The internal key stays the same so pages referencing this section keep working."})]}),e[7]=v):v=e[7];let b;e[8]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx("label",{htmlFor:"section-rename-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[8]=b):b=e[8];let x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=A=>d(A.target.value),e[9]=x):x=e[9];let y;e[10]!==h||e[11]!==c?(y=n.jsxs("div",{className:"space-y-1.5",children:[b,n.jsx(qe,{id:"section-rename-name",value:c,onChange:x,autoFocus:!0,disabled:h})]}),e[10]=h,e[11]=c,e[12]=y):y=e[12];let w;e[13]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Key"}),e[13]=w):w=e[13];let k;e[14]!==i?(k=n.jsxs("div",{className:"space-y-1.5",children:[w,n.jsx(qe,{value:i,readOnly:!0,disabled:!0,className:"font-mono"})]}),e[14]=i,e[15]=k):k=e[15];let j;e[16]!==y||e[17]!==k?(j=n.jsxs("div",{className:"space-y-4 py-4",children:[y,k]}),e[16]=y,e[17]=k,e[18]=j):j=e[18];let R;e[19]!==l?(R=()=>l(!1),e[19]=l,e[20]=R):R=e[20];let I;e[21]!==h||e[22]!==R?(I=n.jsx(re,{type:"button",variant:"outline",onClick:R,disabled:h,children:"Cancel"}),e[21]=h,e[22]=R,e[23]=I):I=e[23];let P;e[24]!==h||e[25]!==c?(P=!c.trim()||h,e[24]=h,e[25]=c,e[26]=P):P=e[26];let T;e[27]!==h?(T=h?n.jsxs(n.Fragment,{children:[n.jsx(Ce,{size:14,className:"animate-spin"}),"Saving…"]}):"Save",e[27]=h,e[28]=T):T=e[28];let S;e[29]!==P||e[30]!==T?(S=n.jsx(re,{type:"submit",disabled:P,children:T}),e[29]=P,e[30]=T,e[31]=S):S=e[31];let C;e[32]!==I||e[33]!==S?(C=n.jsxs(si,{children:[I,S]}),e[32]=I,e[33]=S,e[34]=C):C=e[34];let D;e[35]!==g||e[36]!==j||e[37]!==C?(D=n.jsx(Ot,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:g,children:[v,j,C]})}),e[35]=g,e[36]=j,e[37]=C,e[38]=D):D=e[38];let N;return e[39]!==p||e[40]!==s||e[41]!==D?(N=n.jsx(Lt,{open:s,onOpenChange:p,children:D}),e[39]=p,e[40]=s,e[41]=D,e[42]=N):N=e[42],N}const jn={post:"blog/loaders/Blogpost.ts",author:"blog/loaders/Author.ts",category:"blog/loaders/Category.ts"},Dx="blog/sections/blocks/",Ea=["posts","authors","categories"],Ai={posts:"post",authors:"author",categories:"category"};function Di(t){return Ea.includes(t)}const Ta={posts:"post",authors:"author",categories:"category"},wd={posts:jn.post,authors:jn.author,categories:jn.category},Ix=Object.fromEntries(Object.entries(wd).map(([t,e])=>[e,t]));function Bx(t){return typeof t=="string"?Ix[t]??null:null}function Kr(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function $s(t){return typeof t=="string"?t:""}function Mx(t,e){switch(t){case"posts":return{label:$s(e.title)||"Untitled post",subtitle:$s(e.slug)};case"authors":return{label:$s(e.name)||"Unnamed author",subtitle:$s(e.email)};case"categories":return{label:$s(e.name)||"Unnamed category",subtitle:$s(e.slug)};default:{const s=t;throw new Error(`Unhandled blog kind: ${String(s)}`)}}}function Cd(t){const e={posts:[],authors:[],categories:[]};for(const[s,i]of Object.entries(t)){const r=Kr(i);if(!r)continue;const o=Bx(r.__resolveType);if(!o)continue;const a=Kr(r[Ta[o]])??{},{label:l,subtitle:h}=Mx(o,a);e[o].push({key:s,kind:o,label:l,subtitle:h})}for(const s of Ea)e[s].sort((i,r)=>i.label.localeCompare(r.label));return e}function Lx(t,e){return Cd(t)[e]}function kk(t,e){return Lx(t,e).map(s=>({key:s.key,payload:kd(Kr(t[s.key])??void 0,e)}))}function kd(t,e){return t?Kr(t[Ta[e]])??{}:{}}function kl(t,e,s){return{name:t,__resolveType:wd[e],[Ta[e]]:s}}function jd(t){return`.deco/blocks/${encodeURIComponent(t)}.json`}function eo(t){const e=new Uint8Array(Math.ceil(t/2));return crypto.getRandomValues(e),Array.from(e,s=>s.toString(16).padStart(2,"0")).join("").slice(0,t)}function jl(t,e){const s=`collections/blog/${e}/${eo(12)}`;if(!Object.hasOwn(t,s))return s;throw new Error("Could not generate a unique blog block key")}function Ox(t){switch(t){case"posts":return{title:"Untitled post",excerpt:"",slug:`untitled-${eo(8)}`,date:new Date().toISOString().slice(0,10),image:"",authors:[],categories:[],sections:[]};case"authors":return{name:"New author",email:"",jobTitle:"",company:"",avatar:""};case"categories":return{name:"New category",slug:`category-${eo(8)}`};default:{const e=t;throw new Error(`Unhandled blog kind: ${String(e)}`)}}}function jk(t){const e=new Set,s=[],i=t.manifest?.blocks??{};for(const r of Object.values(i))for(const o of Object.keys(r)){if(!o.startsWith(Dx)||e.has(o))continue;e.add(o);const a=ni(o,t);s.push({resolveType:o,title:a.title??$x(o),description:a.description,icon:a.icon})}return s.sort((r,o)=>r.title.localeCompare(o.title))}function $x(t){return(t.split("/").pop()??t).replace(/\.(tsx?|jsx?)$/,"")}const zx=["blog/sections/blocks/","site/sections/Blog/Post/"];function Nk(t){return zx.some(e=>t.startsWith(e))}function Nd({orgSlug:t,virtualMcpId:e,branch:s}){return Bt.decofile(`${t}/${e}/${s}`)}function Ed({orgSlug:t,virtualMcpId:e,branch:s},i){return`/api/${t}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(s)}/${i}`}function Fx(t){const e=K.c(11),s=Qs();let i;e[0]!==t?(i=async l=>{const{blockKey:h,data:c}=l,d=await fetch(Ed(t,"write"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:jd(h),content:JSON.stringify(c,null,2)})});if(!d.ok){const u=await d.json().catch(Hx);throw new Error(u.error??`Write failed (${d.status})`)}return d.json()},e[0]=t,e[1]=i):i=e[1];let r;e[2]!==t||e[3]!==s?(r=async l=>{const{blockKey:h,data:c}=l,d=Nd(t);await s.cancelQueries({queryKey:d});const u=s.getQueryData(d);return s.setQueryData(d,f=>({...f??{},[h]:c})),{previous:u,queryKey:d}},e[2]=t,e[3]=s,e[4]=r):r=e[4];let o;e[5]!==s?(o=(l,h,c)=>{c?.queryKey&&s.setQueryData(c.queryKey,c.previous)},e[5]=s,e[6]=o):o=e[6];let a;return e[7]!==i||e[8]!==r||e[9]!==o?(a={mutationFn:i,onMutate:r,onError:o},e[7]=i,e[8]=r,e[9]=o,e[10]=a):a=e[10],ei(a)}function Hx(){return{}}function Wx(t){const e=Qs();return ei({mutationFn:async({blockKey:s})=>{const i=await fetch(Ed(t,"unlink"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:jd(s)})});if(!i.ok){const r=await i.json().catch(()=>({}));throw new Error(r.error??`Delete failed (${i.status})`)}return i.json()},onMutate:async({blockKey:s})=>{const i=Nd(t);await e.cancelQueries({queryKey:i});const r=e.getQueryData(i);return e.setQueryData(i,o=>{if(!o)return o;const{[s]:a,...l}=o;return l}),{previous:r,queryKey:i}},onError:(s,i,r)=>{r?.queryKey&&e.setQueryData(r.queryKey,r.previous)}})}function Ux(t){const e=K.c(20),{open:s,onOpenChange:i,pageKey:r,decofile:o}=t,[a,l]=E.useState(!1),h=o[r];let c;e[0]!==h?(c=h===void 0?"// Page not found.":JSON.stringify(h,null,2),e[0]=h,e[1]=c):c=e[1];const d=c;let u;e[2]!==d?(u=()=>{navigator.clipboard.writeText(d).then(()=>{l(!0),setTimeout(()=>l(!1),2e3)})},e[2]=d,e[3]=u):u=e[3];const f=u;let m;e[4]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(rs,{className:"text-sm font-semibold",children:"Page JSON"}),e[4]=m):m=e[4];let p;e[5]!==a?(p=a?n.jsx(zc,{size:12}):n.jsx(Qt,{size:12}),e[5]=a,e[6]=p):p=e[6];const _=a?"Copied":"Copy";let g;e[7]!==f||e[8]!==p||e[9]!==_?(g=n.jsxs(is,{className:"px-4 py-3 border-b flex-row items-center justify-between space-y-0",children:[m,n.jsxs(re,{variant:"ghost",size:"sm",onClick:f,className:"h-7 gap-1.5 text-xs",children:[p,_]})]}),e[7]=f,e[8]=p,e[9]=_,e[10]=g):g=e[10];let v;e[11]!==d?(v=n.jsx(an,{className:"max-h-[70vh]",children:n.jsx("pre",{className:"p-4 text-xs font-mono text-foreground/90 whitespace-pre overflow-auto",children:d})}),e[11]=d,e[12]=v):v=e[12];let b;e[13]!==g||e[14]!==v?(b=n.jsxs(Ot,{className:"max-w-2xl p-0 gap-0",children:[g,v]}),e[13]=g,e[14]=v,e[15]=b):b=e[15];let x;return e[16]!==i||e[17]!==s||e[18]!==b?(x=n.jsx(Lt,{open:s,onOpenChange:i,children:b}),e[16]=i,e[17]=s,e[18]=b,e[19]=x):x=e[19],x}const Nl=E.lazy(()=>qt(()=>import("./app-editor-CCjHHUIp.js"),__vite__mapDeps([158,1,2,4,46,47,48,16,3,5,91,6,7,8,9,10,11,12,13,14,15,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,49,50,92,93,94,58,59,95,96,97,57,79,60,98,99,100,101,102,103,104,78,105,106,107,108,109,67,110,56,111,72,73,112,71,68,86,113,52,53,54,55,61,62,63,64,65,66,69,70,74,75,76,77,114,115,116,85,117,118,82,89,90,119,51,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,83,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,80,81,84,87,159])).then(t=>({default:t.AppEditor}))),Kx=E.lazy(()=>qt(()=>import("./post-editor-HrWJufNf.js"),__vite__mapDeps([160,1,2,3,6,7,8,9,10,11,12,13,14,15,16,17,4,5,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,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,49,71,48,72,73,50,47,74,75,76,77,78,79,98,99,100,46,101,102,103,104,93,94,95,96,97,105,106,107,108,109,110,111,112,151,123,152,134,153,130,132,149,116,89,90,82,84,51,85,86,87,80,81,83,161,159,92,113,114,115,117,118,119,120,121,122,124,125,126,127,128,129,131,133,135,136,137,138,139,140,141,142,143,144,145,146,147,148,150,154])).then(t=>({default:t.PostEditor}))),Vx=E.lazy(()=>qt(()=>import("./record-editor-5_5cQlbY.js"),__vite__mapDeps([162,1,2,50,73,74,84,8,39,40,7,16,20,18,6,9,10,11,12,13,14,15,3,17,4,5,19,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,41,42,43,44,45,49,51,85,86,87,78,61,62,161,159,92,93,94,58,59,95,96,97,57,79,60,98,99,100,46,47,48,101,102,103,104,105,106,107,108,109,67,110,56,111,72,112,71,68,113,52,53,54,55,63,64,65,66,69,70,75,76,77,114,115,116,117,118,82,89,90,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,83,141,142,143,144,145,146,147,148,149,150,151,152,153,154])).then(t=>({default:t.RecordEditor}))),qx=E.lazy(()=>qt(()=>import("./sections-editor-0pqboVrH.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,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155])).then(t=>({default:t.SectionsEditor}))),Gx=E.lazy(()=>qt(()=>import("./seo-editor-7yhk21tn.js"),__vite__mapDeps([163,1,2,4,6,7,8,9,10,11,12,13,14,15,16,3,17,5,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,48,88,73,83,80,81,50,82,74,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,49,71,72,75,76,77,78,79,51,84,85,86,87,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,89,90,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154])).then(t=>({default:t.SeoEditor}))),Yx=E.lazy(()=>qt(()=>import("./add-section-modal-CtMZ_X5l.js"),__vite__mapDeps([91,1,2,6,7,8,9,10,11,12,13,14,15,16,3,17,4,5,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,49,50,92,93,94,58,59,95,96,97,57,79,60,98,99,100,46,47,48,101,102,103,104,78,105,106,107,108,109,67,110,56,111,72,73,112,71,68,86,113,52,53,54,55,61,62,63,64,65,66,69,70,74,75,76,77,114,115,116,85,117,118,82,89,90,119,51,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,83,141,142,143,144,145,146,147,148,149,150,151,152,153,154])).then(t=>({default:t.AddSectionModal}))),to="oklch(0.65 0.15 160)";function Xx(){const t=K.c(18),e=ir(),{data:s}=Js.useSession(),{currentBranch:i}=ss(),{org:r}=Pe(),o=e?.entity?.id??null,a=s?.user?.id,l=e?.entity?.metadata,h=a&&i?Qr(l?.sandboxMap?.[a]?.[i]):{},c=Object.values(h),u=(c.find(Jx)??c[0])?.previewUrl??null,f=Yt(),m=e?.entity?.organization_id??"";let p;t[0]!==r.slug||t[1]!==m?(p={connectionId:Wo,orgId:m,orgSlug:r.slug},t[0]=r.slug,t[1]=m,t[2]=p):p=t[2];const _=ft(p),g=Fo(_);let v;t[3]!==i||t[4]!==g||t[5]!==o?(v=()=>{if(!o)return;const k={virtualMcpId:o};i&&(k.branch=i),g.mutate(k)},t[3]=i,t[4]=g,t[5]=o,t[6]=v):v=t[6];const b=v,x=!!o&&!!i&&Hn.isStopped(o,i),y=td({previewUrl:u,appPaused:f.status.state==="paused",userStopped:x});if(y.kind!=="iframe"){let k;return t[7]!==y||t[8]!==b||t[9]!==f.lifecycle||t[10]!==f.phase?(k=n.jsx(ib,{state:y,claimPhase:f.phase,lifecycle:f.lifecycle,onStart:b}),t[7]=y,t[8]=b,t[9]=f.lifecycle,t[10]=f.phase,t[11]=k):k=t[11],k}if(!o||!i){let k;return t[12]===Symbol.for("react.memo_cache_sentinel")?(k=n.jsx(Ci,{title:"Waiting for sandbox context…"}),t[12]=k):k=t[12],k}let w;return t[13]!==i||t[14]!==r.slug||t[15]!==u||t[16]!==o?(w=n.jsx(Qx,{orgSlug:r.slug,virtualMcpId:o,branch:i,previewUrl:u}),t[13]=i,t[14]=r.slug,t[15]=u,t[16]=o,t[17]=w):w=t[17],w}function Jx(t){return t.sandboxProviderKind!=="user-desktop"}const El=2e3,Zx=15;function Tl(t,e,s,i){return typeof e!="string"||s&&(dd(e,s,i)||t.state.dataUpdateCount>=Zx)?!1:El}function Qx({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:i}){const r={orgSlug:t,virtualMcpId:e,branch:s},{data:o,isLoading:a}=ha(r),[l,h]=E.useState("pages"),[c,d]=E.useState(null),[u,f]=E.useState(null),[m,p]=E.useState(""),[_,g]=E.useState(l);_!==l&&(g(l),p(""));const{data:v,isLoading:b,isFetching:x}=da(r,{refetchInterval:Y=>{const _e=Y.state.data;if(l==="apps"&&c&&c.collection==="apps"){const xe=o?.[c.key];return Tl(Y,typeof xe?.__resolveType=="string"?xe.__resolveType:void 0,_e)}if(l==="site"&&o){const xe=_e?Zn(o,_e):null,Se=o.site,we=xe?.resolveType??(typeof Se?.__resolveType=="string"?Se.__resolveType:void 0);return Tl(Y,we,_e,["seo"])}return!1}}),y=(Y,_e)=>!dd(Y,v,_e)&&(b||x),{catalog:w,isLoading:k}=nx(v??void 0,o??void 0,{enabled:l==="apps"}),j=Na(r),R=X1(r),I=Fx(r),P=Wx(r),[T,S]=E.useState(null),[C,D]=E.useState(),[N,A]=E.useState(!1),[M,B]=E.useState(null),[L,O]=E.useState(null),[W,F]=E.useState(null);if(a||b)return n.jsx("div",{className:"h-full w-full flex items-center justify-center",children:n.jsx(Ce,{size:20,className:"animate-spin text-muted-foreground"})});if(!o||!v)return n.jsx(Ci,{title:"Could not load site data."});const V=ya(o).sort((Y,_e)=>Y.name.localeCompare(_e.name)),J=Sa(o,v),G=Zn(o,v),U=Cd(o),H=Ea.some(Y=>U[Y].length>0),X=Di(l)?U[l]:[];if(!ba(o,v)&&!H)return n.jsx(Ci,{icon:Ki,title:"No editable content",description:"This project doesn't expose any Deco pages, sections, or apps."});const oe={pages:V.length,sections:J.length,apps:w.length,posts:U.posts.length,authors:U.authors.length,categories:U.categories.length},$=new Set(V.map(Y=>Us(Y.path))),se=new Set(V.map(Y=>Y.name)),ee=new Set(J.map(Y=>Y.name)),Q=async Y=>{const _e=o[Y.key];if(!_e)return;const xe=yd(o,Y.key),Se=xx(o,Y.key,Math.max(0,xe-1)),we=bx(_e.sections,Se);if(we)try{await j.mutateAsync({blockKey:Y.key,data:{..._e,sections:we}}),le.success(`Variant added to "${Y.name}"`),d({collection:"pages",key:Y.key,path:Y.path})}catch(dt){le.error(dt instanceof Error?dt.message:"Could not add variant")}},z=()=>{D(void 0),S({mode:"create",sourceKey:null,initialName:"My new page",initialPath:"/example"})},ce=Y=>{D(void 0),S({mode:"duplicate",sourceKey:Y.key,initialName:Cl(se,Y.name),initialPath:Sx($,Y.path)})},ue=Y=>{D(void 0),S({mode:"rename",sourceKey:Y.key,initialName:Y.name,initialPath:Y.path})},fe=async Y=>{if(!T)return;const{mode:_e,sourceKey:xe}=T;try{if(_e==="create"){const Se=Cx(Y.name,Y.path),we=jx(o,Y.name);await j.mutateAsync({blockKey:we,data:Se}),le.success(`Created "${Y.name}"`),d({collection:"pages",key:we,path:Y.path})}else if(_e==="duplicate"&&xe){const Se=o[xe];if(!Se)throw new Error("Source page not found");const{key:we,data:dt}=wx({source:Se,pages:V,newName:Y.name,newPath:Y.path});await j.mutateAsync({blockKey:we,data:dt}),le.success(`Duplicated as "${Y.name}"`),d({collection:"pages",key:we,path:Y.path})}else if(_e==="rename"&&xe){const Se=o[xe];if(!Se)throw new Error("Page not found");const we={...Se,name:Y.name,path:Y.path};await j.mutateAsync({blockKey:xe,data:we}),le.success("Page updated"),c?.collection==="pages"&&c.key===xe&&d({collection:"pages",key:xe,path:Y.path})}S(null)}catch(Se){D(Se instanceof Error?Se.message:"Save failed")}},q=({path:Y})=>{if(!T)return null;const _e=Us(Y);return(T.mode==="rename"?Us(T.initialPath):null)!==_e&&$.has(_e)?`A page with path "${Y}" already exists.`:null},te=async Y=>{const{blockKey:_e,data:xe}=Nx(Y,o);try{await j.mutateAsync({blockKey:_e,data:xe}),le.success(`Created section "${_e}"`),A(!1),d({collection:"sections",key:_e})}catch(Se){le.error(Se instanceof Error?Se.message:"Could not create section")}},me=async Y=>{const _e=o[Y.key];if(!_e){le.error("Section not found.");return}const xe=Sd(o,Y.key),Se=Cl(ee,Y.name),we={..._e,name:Se};try{await j.mutateAsync({blockKey:xe,data:we}),le.success(`Duplicated "${Y.name}"`),d({collection:"sections",key:xe})}catch(dt){le.error(dt instanceof Error?dt.message:"Duplicate failed")}},ne=async Y=>{if(!M)return;const _e=o[M];if(!_e){le.error("Section not found.");return}try{await j.mutateAsync({blockKey:M,data:{..._e,name:Y}}),le.success("Section renamed"),B(null)}catch(xe){le.error(xe instanceof Error?xe.message:"Rename failed")}},ke=async Y=>{const _e=jl(o,Y),xe=kl(_e,Y,Ox(Y));try{await I.mutateAsync({blockKey:_e,data:xe}),le.success(`Created ${Ai[Y]}`),d({collection:Y,key:_e})}catch(Se){le.error(Se instanceof Error?Se.message:"Could not create")}},ot=async Y=>{const _e=o[Y.key];if(!_e){le.error("Record not found.");return}const xe=jl(o,Y.kind),Se=Y.kind==="posts"?"title":"name",we={...structuredClone(kd(_e,Y.kind)),[Se]:`${Y.label} (copy)`};try{await I.mutateAsync({blockKey:xe,data:kl(xe,Y.kind,we)}),le.success(`Duplicated "${Y.label}"`),d({collection:Y.kind,key:xe})}catch(dt){le.error(dt instanceof Error?dt.message:"Duplicate failed")}},Be=async()=>{if(!L)return;const{kind:Y,key:_e,label:xe}=L;try{Y==="blog"?await P.mutateAsync({blockKey:_e}):await R.mutateAsync({blockKey:_e}),le.success(`Deleted "${xe}"`),c&&c.key===_e&&d(null),O(null)}catch(Se){le.error(Se instanceof Error?Se.message:"Delete failed")}},mt=R.isPending||P.isPending,as=L?.kind==="blog"?Ai[L.blogKind]:L?.kind??"item";return n.jsxs("div",{className:"flex h-full w-full",children:[n.jsx(eb,{active:l,counts:oe,showBlog:H,onSelect:Y=>{h(Y),d(null),f(null)}}),l!=="seo"&&l!=="site"&&n.jsx(tb,{activeCollection:l,pages:V,sections:J,appCatalog:w,appCatalogLoading:k,blogEntries:X,decofile:o,searchQuery:m,onSearchChange:p,selection:c,onSelect:Y=>{d(Y),f(null)},previewUrl:i,onCreate:()=>{l==="pages"?z():Di(l)?ke(l):i?A(!0):le.error("Start the preview dev server to add sections.")},onDuplicatePage:ce,onRenamePage:ue,onAddPageVariant:Q,onDeletePage:Y=>O({kind:"page",key:Y.key,label:Y.name}),onEditPageSeo:Y=>{d({collection:"pages",key:Y.key,path:Y.path}),f(Y.key)},onViewPageJson:Y=>F(Y.key),onDuplicateSection:me,onRenameSection:Y=>B(Y.key),onDeleteSection:Y=>O({kind:"section",key:Y.key,label:Y.name}),onDuplicateBlog:ot,onDeleteBlog:Y=>O({kind:"blog",blogKind:Y.kind,key:Y.key,label:Y.label})}),n.jsx("div",{className:"flex-1 min-w-0",children:n.jsx(E.Suspense,{fallback:n.jsx("div",{className:"h-full flex items-center justify-center",children:n.jsx(Ce,{size:20,className:"animate-spin text-muted-foreground"})}),children:l==="site"?G?n.jsx(Nl,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:G.key,block:o[G.key],decofile:o,meta:v,title:"Site",excludeFields:["seo"],schemaPending:y(G.resolveType,["seo"]),previewBaseUrl:i},`site:${G.key}`):n.jsx(Ci,{title:"Site settings not found",description:"This project doesn't have a site app block (site/apps/site.ts)."}):l==="seo"?n.jsx(Gx,{orgSlug:t,virtualMcpId:e,branch:s,decofile:o,meta:v,target:{kind:"site"},previewBaseUrl:i}):c?c.collection==="apps"?n.jsx(Nl,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:c.key,block:o[c.key],decofile:o,meta:v,previewBaseUrl:i,schemaPending:y(typeof o[c.key]?.__resolveType=="string"?String(o[c.key].__resolveType):void 0)},`app:${c.key}`):c.collection==="posts"?n.jsx(Kx,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:c.key,block:o[c.key],decofile:o,meta:v},`post:${c.key}`):c.collection==="authors"||c.collection==="categories"?n.jsx(Vx,{orgSlug:t,virtualMcpId:e,branch:s,kind:c.collection,blockKey:c.key,block:o[c.key]},`${c.collection}:${c.key}`):n.jsx(qx,{orgSlug:t,virtualMcpId:e,branch:s,previewReady:!0,previewUrl:i??void 0,currentPath:c.collection==="pages"?c.path:"/",activePageBlockKey:c.collection==="pages"?c.key:null,activeGlobalBlockKey:c.collection==="sections"?c.key:null,initialEditSeo:c.collection==="pages"&&u===c.key,onExitSeo:()=>f(null)},c.collection==="pages"?`page:${c.key}`:`section:${c.key}`):n.jsx(Ci,{title:`Select ${Di(l)?`a ${Ai[l]}`:l==="pages"?"a page":l==="apps"?"an app":"a section"} to edit`,description:l==="apps"?"Browse all apps and select an installed one to edit its settings.":'Pick an item from the list, or click "+" to create one.'})})}),T&&n.jsx(Px,{open:!!T,mode:T.mode,initialName:T.initialName,initialPath:T.initialPath,isPending:j.isPending,error:C,validate:q,onSubmit:fe,onOpenChange:Y=>{Y||(S(null),D(void 0))}}),M&&n.jsx(Ax,{open:!!M,blockKey:M,initialName:J.find(Y=>Y.key===M)?.name??M,isPending:j.isPending,onSubmit:ne,onOpenChange:Y=>{Y||B(null)}}),N&&i&&n.jsx(E.Suspense,{fallback:null,children:n.jsx(Yx,{open:N,onOpenChange:A,meta:v,decofile:o,previewBaseUrl:i,onSelect:te})}),W&&n.jsx(Ux,{open:!!W,onOpenChange:Y=>{Y||F(null)},pageKey:W,decofile:o}),n.jsx(Rr,{open:!!L,onOpenChange:Y=>{!Y&&!mt&&O(null)},children:n.jsxs(Pr,{children:[n.jsxs(Ar,{children:[n.jsx(Dr,{children:`Delete ${as}?`}),n.jsx(Ir,{children:L?.kind==="section"?`"${L.label}" will be removed. Pages that still reference it will lose this section.`:L?`"${L.label}" will be removed permanently. This can't be undone.`:null})]}),n.jsxs(Br,{children:[n.jsx(Mr,{disabled:mt,children:"Cancel"}),n.jsx(Lr,{onClick:Y=>{Y.preventDefault(),Be()},disabled:mt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:mt?n.jsxs(n.Fragment,{children:[n.jsx(Ce,{size:14,className:"animate-spin"}),"Deleting…"]}):"Delete"})]})]})})]})}function eb(t){const e=K.c(33),{active:s,counts:i,showBlog:r,onSelect:o}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx("div",{className:"px-3 h-12 flex items-center border-b shrink-0",children:n.jsx("span",{className:"text-sm font-medium",children:"Content"})}),e[0]=a):a=e[0];const l=s==="pages";let h;e[1]!==i.pages||e[2]!==o||e[3]!==l?(h=n.jsx(ls,{id:"pages",icon:Vo,label:"Pages",count:i.pages,active:l,onSelect:o}),e[1]=i.pages,e[2]=o,e[3]=l,e[4]=h):h=e[4];const c=s==="sections";let d;e[5]!==i.sections||e[6]!==o||e[7]!==c?(d=n.jsx(ls,{id:"sections",icon:Gs,label:"Sections",count:i.sections,active:c,onSelect:o}),e[5]=i.sections,e[6]=o,e[7]=c,e[8]=d):d=e[8];const u=s==="apps";let f;e[9]!==i.apps||e[10]!==o||e[11]!==u?(f=n.jsx(ls,{id:"apps",icon:ph,label:"Apps",count:i.apps,active:u,onSelect:o}),e[9]=i.apps,e[10]=o,e[11]=u,e[12]=f):f=e[12];let m;e[13]!==s||e[14]!==i.authors||e[15]!==i.categories||e[16]!==i.posts||e[17]!==o||e[18]!==r?(m=r&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"mt-3 flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-medium text-muted-foreground/70",children:[n.jsx(mh,{size:13,className:"shrink-0"}),"Blog"]}),n.jsx(ls,{id:"posts",icon:qc,label:"Posts",count:i.posts,active:s==="posts",onSelect:o}),n.jsx(ls,{id:"authors",icon:ta,label:"Authors",count:i.authors,active:s==="authors",onSelect:o}),n.jsx(ls,{id:"categories",icon:Gc,label:"Categories",count:i.categories,active:s==="categories",onSelect:o})]}),e[13]=s,e[14]=i.authors,e[15]=i.categories,e[16]=i.posts,e[17]=o,e[18]=r,e[19]=m):m=e[19];const p=s==="site";let _;e[20]!==o||e[21]!==p?(_=n.jsx(ls,{id:"site",icon:Gf,label:"Site",active:p,onSelect:o}),e[20]=o,e[21]=p,e[22]=_):_=e[22];const g=s==="seo";let v;e[23]!==o||e[24]!==g?(v=n.jsx(ls,{id:"seo",icon:Nr,label:"SEO",active:g,onSelect:o}),e[23]=o,e[24]=g,e[25]=v):v=e[25];let b;return e[26]!==_||e[27]!==v||e[28]!==h||e[29]!==d||e[30]!==f||e[31]!==m?(b=n.jsxs("div",{className:"w-[208px] shrink-0 border-r flex flex-col",children:[a,n.jsxs("nav",{className:"flex flex-col p-1.5 gap-0.5",children:[h,d,f,m,_,v]})]}),e[26]=_,e[27]=v,e[28]=h,e[29]=d,e[30]=f,e[31]=m,e[32]=b):b=e[32],b}function ls(t){const e=K.c(18),{id:s,icon:i,label:r,count:o,active:a,onSelect:l}=t;let h;e[0]!==s||e[1]!==l?(h=()=>l(s),e[0]=s,e[1]=l,e[2]=h):h=e[2];const c=a?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground";let d;e[3]!==c?(d=he("flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm transition-colors cursor-pointer",c),e[3]=c,e[4]=d):d=e[4];let u;e[5]!==i?(u=n.jsx(i,{size:16,className:"shrink-0"}),e[5]=i,e[6]=u):u=e[6];let f;e[7]!==r?(f=n.jsx("span",{className:"flex-1 truncate",children:r}),e[7]=r,e[8]=f):f=e[8];let m;e[9]!==a||e[10]!==o?(m=o!==void 0&&n.jsx("span",{className:he("shrink-0 text-xs tabular-nums",a?"text-accent-foreground/70":"text-muted-foreground/70"),children:o}),e[9]=a,e[10]=o,e[11]=m):m=e[11];let p;return e[12]!==h||e[13]!==d||e[14]!==u||e[15]!==f||e[16]!==m?(p=n.jsxs("button",{type:"button",onClick:h,className:d,children:[u,f,m]}),e[12]=h,e[13]=d,e[14]=u,e[15]=f,e[16]=m,e[17]=p):p=e[17],p}function tb(t){const e=K.c(57),{activeCollection:s,pages:i,sections:r,appCatalog:o,appCatalogLoading:a,blogEntries:l,decofile:h,previewUrl:c,searchQuery:d,onSearchChange:u,selection:f,onSelect:m,onCreate:p,onDuplicatePage:_,onRenamePage:g,onAddPageVariant:v,onDeletePage:b,onEditPageSeo:x,onViewPageJson:y,onDuplicateSection:w,onRenameSection:k,onDeleteSection:j,onDuplicateBlog:R,onDeleteBlog:I}=t;let P,T,S,C,D,N;if(e[0]!==s||e[1]!==o||e[2]!==a||e[3]!==l||e[4]!==h||e[5]!==v||e[6]!==p||e[7]!==I||e[8]!==b||e[9]!==j||e[10]!==R||e[11]!==_||e[12]!==w||e[13]!==x||e[14]!==g||e[15]!==k||e[16]!==u||e[17]!==m||e[18]!==y||e[19]!==i||e[20]!==c||e[21]!==d||e[22]!==r||e[23]!==f){const L=d.toLowerCase(),O=i.filter(z=>!L||z.name.toLowerCase().includes(L)||z.path.toLowerCase().includes(L)),W=r.filter(z=>!L||z.name.toLowerCase().includes(L)||z.key.toLowerCase().includes(L)||z.resolveType.toLowerCase().includes(L)),F=o.filter(z=>!L||z.title.toLowerCase().includes(L)||z.app.toLowerCase().includes(L)||z.vendor.toLowerCase().includes(L)||z.category.toLowerCase().includes(L)),V=l.filter(z=>!L||z.label.toLowerCase().includes(L)||z.subtitle.toLowerCase().includes(L)),J=`Search ${s}…`,G=Di(s)?`Create new ${Ai[s]}`:s==="pages"?"Create new page":"Create new section",U=s==="sections"&&!c,H=s!=="apps",X=U,oe=U?"Start the preview dev server to add sections":void 0;D="w-[300px] shrink-0 border-r flex flex-col min-h-0";let $;e[30]===Symbol.for("react.memo_cache_sentinel")?($=n.jsx(fh,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[30]=$):$=e[30];let se;e[31]!==u?(se=z=>u(z.target.value),e[31]=u,e[32]=se):se=e[32];let ee;e[33]!==J||e[34]!==d||e[35]!==se?(ee=n.jsxs("div",{className:"flex flex-1 items-center gap-2 pl-1",children:[$,n.jsx("input",{type:"text",value:d,onChange:se,placeholder:J,"aria-label":J,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[33]=J,e[34]=d,e[35]=se,e[36]=ee):ee=e[36];let Q;e[37]!==X||e[38]!==oe||e[39]!==G||e[40]!==p||e[41]!==H?(Q=H&&n.jsxs(Re,{children:[n.jsx(Ee,{asChild:!0,children:n.jsx(re,{variant:"ghost",size:"icon",onClick:p,disabled:X,"aria-label":G,"aria-disabled":X,children:n.jsx(xt,{size:14})})}),n.jsx(Te,{side:"bottom",children:oe??G})]}),e[37]=X,e[38]=oe,e[39]=G,e[40]=p,e[41]=H,e[42]=Q):Q=e[42],e[43]!==ee||e[44]!==Q?(N=n.jsxs("div",{className:"px-2 h-12 flex items-center gap-1 border-b shrink-0",children:[ee,Q]}),e[43]=ee,e[44]=Q,e[45]=N):N=e[45],P=an,C="flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",T="flex flex-col gap-1 p-1.5",S=s==="pages"?O.length===0?n.jsx(hr,{hasItems:i.length>0,emptyLabel:"No pages yet.",emptyHint:'Click "+" to create your first page.'}):O.map(z=>{const ce=f?.collection==="pages"&&f.key===z.key,ue=yd(h,z.key);return n.jsx(cr,{icon:Vo,title:z.name,subtitle:z.path,active:ce,variantCount:ue,onClick:()=>m({collection:"pages",key:z.key,path:z.path}),menu:n.jsx(Nn,{onDuplicate:()=>_(z),onRename:()=>g(z),onAddVariant:()=>v(z),onEditSeo:()=>x(z),onViewJson:()=>y(z),onDelete:()=>b(z)})},z.key)}):s==="sections"?W.length===0?n.jsx(hr,{hasItems:r.length>0,emptyLabel:"No saved sections yet.",emptyHint:'Click "+" to create one, or save a section from a page.'}):W.map(z=>{const ce=f?.collection==="sections"&&f.key===z.key,ue=z.resolveType.split("/").pop()?.replace(/\.tsx?$/,"");return n.jsx(cr,{icon:Gs,title:z.name,subtitle:ue??z.resolveType,active:ce,onClick:()=>m({collection:"sections",key:z.key}),menu:n.jsx(Nn,{onDuplicate:()=>w(z),onRename:()=>k(z),onDelete:()=>j(z)})},z.key)}):s==="apps"?a?n.jsx("div",{className:"flex items-center justify-center py-8",children:n.jsx(Ce,{size:18,className:"animate-spin text-muted-foreground"})}):F.length===0?n.jsx(hr,{hasItems:o.length>0,emptyLabel:"No apps found.",emptyHint:"Try a different search term."}):F.map(z=>{const ce=f?.collection==="apps"&&z.blockKey!==null&&f.key===z.blockKey;return n.jsx(cr,{icon:ph,logoUrl:z.logo,title:z.title,subtitle:z.category,active:ce,trailing:z.installed?n.jsx("span",{className:"shrink-0 rounded-full bg-emerald-500/15 px-1.5 py-0.5 text-[10px] font-medium text-emerald-700 dark:text-emerald-400",children:"Installed"}):void 0,onClick:()=>{if(!z.installed||!z.blockKey){le.message(`${z.title} is not installed on this site.`);return}m({collection:"apps",key:z.blockKey})}},z.id)}):V.length===0?n.jsx(hr,{hasItems:l.length>0,emptyLabel:`No ${s} yet.`,emptyHint:`Click "+" to create your first ${Di(s)?Ai[s]:"item"}.`}):V.map(z=>{const ce=f?.collection===z.kind&&f.key===z.key;return n.jsx(cr,{icon:z.kind==="posts"?qc:z.kind==="authors"?ta:Gc,title:z.label,subtitle:z.subtitle,active:ce,onClick:()=>m({collection:z.kind,key:z.key}),menu:n.jsx(Nn,{onDuplicate:()=>R(z),onDelete:()=>I(z)})},z.key)}),e[0]=s,e[1]=o,e[2]=a,e[3]=l,e[4]=h,e[5]=v,e[6]=p,e[7]=I,e[8]=b,e[9]=j,e[10]=R,e[11]=_,e[12]=w,e[13]=x,e[14]=g,e[15]=k,e[16]=u,e[17]=m,e[18]=y,e[19]=i,e[20]=c,e[21]=d,e[22]=r,e[23]=f,e[24]=P,e[25]=T,e[26]=S,e[27]=C,e[28]=D,e[29]=N}else P=e[24],T=e[25],S=e[26],C=e[27],D=e[28],N=e[29];let A;e[46]!==T||e[47]!==S?(A=n.jsx("div",{className:T,children:S}),e[46]=T,e[47]=S,e[48]=A):A=e[48];let M;e[49]!==P||e[50]!==C||e[51]!==A?(M=n.jsx(P,{className:C,children:A}),e[49]=P,e[50]=C,e[51]=A,e[52]=M):M=e[52];let B;return e[53]!==D||e[54]!==N||e[55]!==M?(B=n.jsxs("div",{className:D,children:[N,M]}),e[53]=D,e[54]=N,e[55]=M,e[56]=B):B=e[56],B}function cr(t){const e=K.c(29),{icon:s,logoUrl:i,title:r,subtitle:o,active:a,variantCount:l,trailing:h,onClick:c,menu:d}=t;let u;e[0]!==s||e[1]!==a||e[2]!==i||e[3]!==l?(u=l&&l>1?n.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center",children:n.jsxs(Re,{children:[n.jsx(Ee,{asChild:!0,children:n.jsx(s,{size:16,className:"shrink-0",style:{color:to}})}),n.jsxs(Te,{side:"right",children:[l," variants"]})]})}):i?n.jsx("img",{src:i,alt:"",className:"size-8 shrink-0 rounded-lg object-cover bg-muted"}):n.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted",children:n.jsx(s,{size:16,className:he("shrink-0",a?"text-accent-foreground":"text-muted-foreground")})}),e[0]=s,e[1]=a,e[2]=i,e[3]=l,e[4]=u):u=e[4];const f=u,m=a?"bg-accent text-accent-foreground":"hover:bg-muted";let p;e[5]!==m?(p=he("group relative flex min-w-0 items-center rounded-md transition-colors",m),e[5]=m,e[6]=p):p=e[6];let _;e[7]!==r?(_=n.jsx("span",{className:"block truncate text-sm font-medium",children:r}),e[7]=r,e[8]=_):_=e[8];const g=a?"text-accent-foreground/70":"text-muted-foreground";let v;e[9]!==g?(v=he("block truncate text-xs",g),e[9]=g,e[10]=v):v=e[10];let b;e[11]!==o||e[12]!==v?(b=n.jsx("span",{className:v,children:o}),e[11]=o,e[12]=v,e[13]=b):b=e[13];let x;e[14]!==_||e[15]!==b?(x=n.jsxs("span",{className:"min-w-0 flex-1",children:[_,b]}),e[14]=_,e[15]=b,e[16]=x):x=e[16];let y;e[17]!==c||e[18]!==f||e[19]!==x||e[20]!==h?(y=n.jsxs("button",{type:"button",onClick:c,className:"flex min-w-0 flex-1 items-center gap-2.5 rounded-md px-2.5 py-2 text-left cursor-pointer",children:[f,x,h]}),e[17]=c,e[18]=f,e[19]=x,e[20]=h,e[21]=y):y=e[21];let w;e[22]!==a||e[23]!==d?(w=d&&n.jsx("div",{className:he("pr-1 opacity-0 transition-opacity group-hover:opacity-100",a&&"opacity-100"),children:d}),e[22]=a,e[23]=d,e[24]=w):w=e[24];let k;return e[25]!==w||e[26]!==p||e[27]!==y?(k=n.jsxs("div",{className:p,children:[y,w]}),e[25]=w,e[26]=p,e[27]=y,e[28]=k):k=e[28],k}function Nn(t){const e=K.c(21),{onDuplicate:s,onRename:i,onAddVariant:r,onEditSeo:o,onViewJson:a,onDelete:l}=t;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(Ds,{asChild:!0,children:n.jsx("button",{type:"button","aria-label":"More actions",className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-background hover:text-foreground cursor-pointer",onClick:sb,children:n.jsx(nn,{size:14})})}),e[0]=h):h=e[0];let c;e[1]!==i?(c=i&&n.jsxs(He,{onClick:i,children:[n.jsx(sa,{size:14}),"Rename"]}),e[1]=i,e[2]=c):c=e[2];let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(Qt,{size:14}),e[3]=d):d=e[3];let u;e[4]!==s?(u=n.jsxs(He,{onClick:s,children:[d,"Duplicate"]}),e[4]=s,e[5]=u):u=e[5];let f;e[6]!==r?(f=r&&n.jsxs(n.Fragment,{children:[n.jsx(vr,{}),n.jsxs(He,{onClick:r,className:"cursor-pointer",style:{color:to},children:[n.jsx(Yf,{size:14,style:{color:to}}),"Add variant"]})]}),e[6]=r,e[7]=f):f=e[7];let m;e[8]!==o||e[9]!==a?(m=(o||a)&&n.jsxs(n.Fragment,{children:[n.jsx(vr,{}),o&&n.jsxs(He,{onClick:o,children:[n.jsx(Nr,{size:14}),"Edit SEO"]}),a&&n.jsxs(He,{onClick:a,children:[n.jsx(qo,{size:14}),"View JSON"]})]}),e[8]=o,e[9]=a,e[10]=m):m=e[10];let p;e[11]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx(vr,{}),e[11]=p):p=e[11];let _;e[12]===Symbol.for("react.memo_cache_sentinel")?(_=n.jsx(qs,{size:14}),e[12]=_):_=e[12];let g;e[13]!==l?(g=n.jsxs(He,{onClick:l,className:"text-destructive focus:text-destructive",children:[_,"Delete"]}),e[13]=l,e[14]=g):g=e[14];let v;return e[15]!==c||e[16]!==u||e[17]!==f||e[18]!==m||e[19]!==g?(v=n.jsxs(As,{children:[h,n.jsxs(Is,{align:"end",className:"w-44",children:[c,u,f,m,p,g]})]}),e[15]=c,e[16]=u,e[17]=f,e[18]=m,e[19]=g,e[20]=v):v=e[20],v}function sb(t){return t.stopPropagation()}function hr(t){const e=K.c(6),{hasItems:s,emptyLabel:i,emptyHint:r}=t;let o;e[0]!==r||e[1]!==i||e[2]!==s?(o=s?"No results match your search.":n.jsxs(n.Fragment,{children:[n.jsx("div",{children:i}),n.jsx("div",{className:"mt-1 text-muted-foreground/80",children:r})]}),e[0]=r,e[1]=i,e[2]=s,e[3]=o):o=e[3];let a;return e[4]!==o?(a=n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:o}),e[4]=o,e[5]=a):a=e[5],a}function ib(t){const e=K.c(8),{state:s,claimPhase:i,lifecycle:r,onStart:o}=t;switch(s.kind){case"starting":{let a;e[0]!==i||e[1]!==r?(a=ld({claimPhase:i,lifecycle:r}),e[0]=i,e[1]=r,e[2]=a):a=e[2];let l;return e[3]!==i||e[4]!==a?(l=n.jsx(Wr,{kind:"starting",progress:a,claimPhase:i}),e[3]=i,e[4]=a,e[5]=l):l=e[5],l}case"suspended":{let a;return e[6]!==o?(a=n.jsx(Wr,{kind:"suspended",onResume:o}),e[6]=o,e[7]=a):a=e[7],a}}}function Ci(t){const e=K.c(10),{icon:s,title:i,description:r}=t;let o;e[0]!==s?(o=s&&n.jsx(s,{size:24,className:"text-muted-foreground/60"}),e[0]=s,e[1]=o):o=e[1];let a;e[2]!==i?(a=n.jsx("div",{children:i}),e[2]=i,e[3]=a):a=e[3];let l;e[4]!==r?(l=r&&n.jsx("div",{className:"text-xs text-muted-foreground/80 max-w-sm",children:r}),e[4]=r,e[5]=l):l=e[5];let h;return e[6]!==o||e[7]!==a||e[8]!==l?(h=n.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 p-6 text-center text-sm text-muted-foreground",children:[o,a,l]}),e[6]=o,e[7]=a,e[8]=l,e[9]=h):h=e[9],h}function rb(t){const e=K.c(2),{virtualMcpId:s}=t,i=Mt(s);if(!ti(i?.metadata)){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 text-center text-sm text-muted-foreground p-6",children:[n.jsx(Ki,{size:24,className:"text-muted-foreground/60"}),n.jsx("div",{children:"No content to edit."}),n.jsx("div",{className:"text-xs text-muted-foreground/80",children:"Connect a GitHub repository from the Settings tab to enable Content."})]}),e[0]=a):a=e[0],a}let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(Xx,{}),e[1]=o):o=e[1],o}const En={fast:{label:"Fast",subtitle:"Quick responses for simple tasks",icon:Kc},smart:{label:"Smart",subtitle:"Balanced quality and speed",icon:Ss},thinking:{label:"Thinking",subtitle:"Deeper reasoning for hard tasks",icon:Qf}},nb=["fast","smart","thinking"];function ob(t){const e=K.c(15),{tier:s,onSelect:i}=t,[r,o]=E.useState(!1),a=En[s].icon;let l;e[0]!==a?(l=n.jsx(a,{size:14,className:"text-muted-foreground"}),e[0]=a,e[1]=l):l=e[1];const h=En[s];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(Es,{size:14,className:"text-muted-foreground"}),e[2]=c):c=e[2];let d;e[3]!==l||e[4]!==h.label?(d=n.jsx(Rs,{asChild:!0,children:n.jsxs(re,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[l,h.label,c]})}),e[3]=l,e[4]=h.label,e[5]=d):d=e[5];let u;e[6]!==i||e[7]!==s?(u=nb.map(p=>{const _=En[p],g=_.icon;return n.jsxs("button",{type:"button",onClick:()=>{i(p),o(!1)},className:he("flex items-start gap-2 px-2 py-1.5 rounded-md text-left hover:bg-muted"),children:[n.jsx(g,{size:16,className:"shrink-0 text-muted-foreground mt-0.5"}),n.jsxs("div",{className:"flex-1",children:[n.jsx("div",{className:"text-sm",children:_.label}),n.jsx("div",{className:"text-xs text-muted-foreground",children:_.subtitle})]}),p===s&&n.jsx(ii,{size:14,className:"text-foreground mt-0.5"})]},p)}),e[6]=i,e[7]=s,e[8]=u):u=e[8];let f;e[9]!==u?(f=n.jsx(Ps,{align:"start",className:"p-1 w-64",children:n.jsx("div",{className:"flex flex-col",children:u})}),e[9]=u,e[10]=f):f=e[10];let m;return e[11]!==r||e[12]!==d||e[13]!==f?(m=n.jsxs(Ts,{open:r,onOpenChange:o,children:[d,f]}),e[11]=r,e[12]=d,e[13]=f,e[14]=m):m=e[14],m}function ab(t){const e=K.c(15),{tier:s,onTierChange:i,override:r,onOverrideChange:o}=t,[a,l]=E.useState(r!==null);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Model"}),e[0]=h):h=e[0];let c;e[1]!==o||e[2]!==i||e[3]!==r||e[4]!==s||e[5]!==a?(c=a?n.jsx(E.Suspense,{fallback:n.jsx(re,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:"Loading models…"}),children:n.jsx(lb,{override:r,onOverrideChange:o})}):n.jsx(ob,{tier:s,onSelect:i}),e[1]=o,e[2]=i,e[3]=r,e[4]=s,e[5]=a,e[6]=c):c=e[6];let d;e[7]!==o?(d=m=>{l(m),m||o(null)},e[7]=o,e[8]=d):d=e[8];let u;e[9]!==d||e[10]!==a?(u=n.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground cursor-pointer select-none",children:[n.jsx(Or,{checked:a,onCheckedChange:d,className:"cursor-pointer"}),"Specific model"]}),e[9]=d,e[10]=a,e[11]=u):u=e[11];let f;return e[12]!==c||e[13]!==u?(f=n.jsxs("div",{className:"flex flex-col gap-2",children:[h,n.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[c,u]})]}),e[12]=c,e[13]=u,e[14]=f):f=e[14],f}function lb(t){const e=K.c(10),{override:s,onOverrideChange:i}=t,r=Hc(),o=r[0]?.id??null,[a,l]=E.useState(s?.credentialId??o);let h;e[0]!==s?(h=s?{modelId:s.modelId,title:s.title||s.modelId,keyId:s.credentialId,providerId:"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,e[0]=s,e[1]=h):h=e[1];const c=h;if(r.length===0){let f;return e[2]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx("span",{className:"text-xs text-muted-foreground italic",children:"Connect an AI provider in settings to pick a specific model."}),e[2]=f):f=e[2],f}let d;e[3]!==a||e[4]!==i?(d=f=>{const m=f.keyId??a??"";l(m),i({modelId:f.modelId,credentialId:m,title:f.title??f.modelId})},e[3]=a,e[4]=i,e[5]=d):d=e[5];let u;return e[6]!==a||e[7]!==c||e[8]!==d?(u=n.jsx("div",{className:"w-fit max-w-full [&_button]:rounded-md",children:n.jsx(up,{variant:"bordered",placeholder:"Pick a model",model:c,credentialId:a,onCredentialChange:l,onModelChange:d})}),e[6]=a,e[7]=c,e[8]=d,e[9]=u):u=e[9],u}const Td=[{key:"capabilities",heading:"Built-in capabilities",icon:ia,tools:[{name:"web_search",title:"Web search",description:"Look up current information on the web",icon:qi},{name:"generate_image",title:"Generate image",description:"Create images from a text prompt",icon:rp},{name:"subtask",title:"Subtask",description:"Spawn a focused sub-agent to handle part of the work",icon:Li},{name:"user_ask",title:"Ask the user",description:"Pause to ask the user a clarifying question",icon:Xf}]},{key:"files",heading:"Files & code",icon:Vn,tools:[{name:"read",title:"Read File",description:"Read a file from the workspace",icon:nh},{name:"write",title:"Write File",description:"Create or overwrite a file",icon:sa},{name:"edit",title:"Edit File",description:"Make targeted edits to an existing file",icon:Jf},{name:"grep",title:"Search Content",description:"Search file contents by pattern",icon:$i},{name:"glob",title:"Find Files",description:"Find files by name pattern",icon:Vn},{name:"bash",title:"Run Command",description:"Run shell commands in the sandbox",icon:Zf}]},{key:"context",heading:"Context",icon:Ga,tools:[{name:"read_resource",title:"Read Resource",description:"Read an MCP resource by URI",icon:Ga},{name:"read_prompt",title:"Read Prompt",description:"Read an MCP prompt definition",icon:mh}]},{key:"browser",heading:"Browser",icon:Gs,tools:[{name:"take_screenshot",title:"Take Screenshot",description:"Capture a screenshot of a web page",icon:sh},{name:"scrape_url",title:"Scrape URL",description:"Fetch and extract content from a URL",icon:Gs},{name:"inspect_page",title:"Inspect Page",description:"Inspect a web page's structure",icon:qo}]}],cb=Td.flatMap(t=>t.tools.map(e=>e.name));function hb(t){const e=t.replace(/[_-]+/g," ").trim();return e?e.toLowerCase().replace(/\b\w/g,s=>s.toUpperCase()):t}function db(t){const e=K.c(5),{agentId:s,value:i,onChange:r}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Tools"}),e[0]=o):o=e[0];let a;return e[1]!==s||e[2]!==r||e[3]!==i?(a=n.jsxs("div",{className:"flex flex-col gap-2",children:[o,s?n.jsx(E.Suspense,{fallback:n.jsxs(re,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:[n.jsx(ia,{size:14}),"Loading tools…"]}),children:n.jsx(ub,{agentId:s,value:i,onChange:r})}):n.jsx("span",{className:"text-xs text-muted-foreground italic",children:"Pick an agent first"})]}),e[1]=s,e[2]=r,e[3]=i,e[4]=a):a=e[4],a}function Rl(t){const e=K.c(17),{value:s,checked:i,onToggle:r,title:o,description:a,leading:l}=t;let h;e[0]!==i?(h=n.jsx(ln,{checked:i,className:"pointer-events-none mt-0.5"}),e[0]=i,e[1]=h):h=e[1];let c;e[2]!==l?(c=l&&n.jsx("span",{className:"mt-px shrink-0",children:l}),e[2]=l,e[3]=c):c=e[3];let d;e[4]!==o?(d=n.jsx("span",{className:"truncate text-sm leading-tight",children:o}),e[4]=o,e[5]=d):d=e[5];let u;e[6]!==a?(u=a&&n.jsx("span",{className:"line-clamp-2 text-xs leading-snug text-muted-foreground",children:a}),e[6]=a,e[7]=u):u=e[7];let f;e[8]!==d||e[9]!==u?(f=n.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[d,u]}),e[8]=d,e[9]=u,e[10]=f):f=e[10];let m;return e[11]!==r||e[12]!==h||e[13]!==c||e[14]!==f||e[15]!==s?(m=n.jsxs(dp,{value:s,onSelect:r,className:"items-start gap-2.5 py-2",children:[h,c,f]}),e[11]=r,e[12]=h,e[13]=c,e[14]=f,e[15]=s,e[16]=m):m=e[16],m}function Pl(t){const e=K.c(20),{conn:s,label:i,icon:r,on:o,total:a,onToggle:l}=t,h=o===a;let c;e[0]!==r||e[1]!==s?(c=s?n.jsx(Gt,{icon:s.icon,name:s.title,size:"2xs"}):r?n.jsx(r,{size:14,className:"text-muted-foreground"}):n.jsx(em,{size:14,className:"text-muted-foreground"}),e[0]=r,e[1]=s,e[2]=c):c=e[2];const d=s?.title??i??"Other tools";let u;e[3]!==d?(u=n.jsx("span",{className:"truncate",children:d}),e[3]=d,e[4]=u):u=e[4];let f;e[5]!==o||e[6]!==a?(f=n.jsxs("span",{className:"text-[11px] font-normal tabular-nums text-muted-foreground/70",children:[o,"/",a]}),e[5]=o,e[6]=a,e[7]=f):f=e[7];let m;e[8]!==l?(m=b=>{b.stopPropagation(),l()},e[8]=l,e[9]=m):m=e[9];const p=h?"None":"All";let _;e[10]!==m||e[11]!==p?(_=n.jsx("button",{type:"button",onClick:m,className:"text-[11px] font-medium text-primary hover:underline",children:p}),e[10]=m,e[11]=p,e[12]=_):_=e[12];let g;e[13]!==f||e[14]!==_?(g=n.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[f,_]}),e[13]=f,e[14]=_,e[15]=g):g=e[15];let v;return e[16]!==c||e[17]!==u||e[18]!==g?(v=n.jsxs("div",{className:"flex items-center gap-2",children:[c,u,g]}),e[16]=c,e[17]=u,e[18]=g,e[19]=v):v=e[19],v}function ub(t){const e=K.c(70),{agentId:s,value:i,onChange:r}=t,{org:o}=Pe(),[a,l]=E.useState(!1);let h;e[0]!==s||e[1]!==o.id||e[2]!==o.slug?(h={connectionId:s,orgId:o.id,orgSlug:o.slug},e[0]=s,e[1]=o.id,e[2]=o.slug,e[3]=h):h=e[3];const c=ft(h);let d;e[4]!==c?(d={client:c},e[4]=c,e[5]=d):d=e[5];const{data:u,isLoading:f}=_m(d),m=Gi();let p,_,g,v,b,x,y,w,k,j,R,I,P;if(e[6]!==m||e[7]!==u?.tools||e[8]!==f||e[9]!==r||e[10]!==a||e[11]!==i){const N=new Map(m.map(gb)),A=new Map;for(const q of u?.tools??[]){const te=_f(q._meta)??"__other__",me=gf(q.name,te==="__other__"?void 0:te),ne=q.title,ke=ne&&ne!==q.name?ne:hb(me);A.has(te)||A.set(te,{clientId:te,conn:N.get(te),tools:[]}),A.get(te).tools.push({name:q.name,display:ke,description:q.description})}const M=[...A.values()].sort(_b),B=(u?.tools??[]).map(pb),L=[...cb,...B],O=i===null?new Set(L):new Set(i),W=L.every(q=>O.has(q)),F=q=>r(L.every(te=>q.has(te))?null:[...q]),V=q=>{const te=new Set(O);te.has(q)?te.delete(q):te.add(q),F(te)},J=(q,te)=>{const me=new Set(O);for(const ne of q)te?me.add(ne):me.delete(ne);F(me)};v=Ts,P=a,b=l;let G;e[25]===Symbol.for("react.memo_cache_sentinel")?(G=n.jsx(ia,{size:14,className:"text-muted-foreground"}),e[25]=G):G=e[25];const U=W?"All tools":"Tools",H=!W&&n.jsxs(op,{variant:"secondary",className:"ml-0.5 h-5 px-1.5 text-[11px] tabular-nums",children:[O.size,"/",L.length]});let X;e[26]===Symbol.for("react.memo_cache_sentinel")?(X=n.jsx(Es,{size:14,className:"text-muted-foreground"}),e[26]=X):X=e[26],e[27]!==U||e[28]!==H?(x=n.jsx(Rs,{asChild:!0,children:n.jsxs(re,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[G,U,H,X]})}),e[27]=U,e[28]=H,e[29]=x):x=e[29],g=Ps,R="p-0 w-80",I="start",_=lp,e[30]===Symbol.for("react.memo_cache_sentinel")?(k=n.jsx(cp,{placeholder:"Search tools..."}),e[30]=k):k=e[30];const oe=W?`All ${L.length} tools enabled`:`${O.size} of ${L.length} enabled`;let $;e[31]!==oe?($=n.jsx("span",{className:"text-xs text-muted-foreground",children:oe}),e[31]=oe,e[32]=$):$=e[32];let se;e[33]!==r?(se=()=>r(null),e[33]=r,e[34]=se):se=e[34];let ee;e[35]!==W||e[36]!==se?(ee=n.jsx("button",{type:"button",onClick:se,disabled:W,className:"text-xs font-medium text-primary hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:"Select all"}),e[35]=W,e[36]=se,e[37]=ee):ee=e[37];let Q;e[38]===Symbol.for("react.memo_cache_sentinel")?(Q=n.jsx("span",{className:"text-muted-foreground/30",children:"·"}),e[38]=Q):Q=e[38];let z;e[39]!==r?(z=()=>r([]),e[39]=r,e[40]=z):z=e[40];const ce=O.size===0;let ue;e[41]!==z||e[42]!==ce?(ue=n.jsx("button",{type:"button",onClick:z,disabled:ce,className:"text-xs font-medium text-muted-foreground hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:"Clear"}),e[41]=z,e[42]=ce,e[43]=ue):ue=e[43];let fe;e[44]!==ee||e[45]!==ue?(fe=n.jsxs("div",{className:"flex items-center gap-2",children:[ee,Q,ue]}),e[44]=ee,e[45]=ue,e[46]=fe):fe=e[46],e[47]!==$||e[48]!==fe?(j=n.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[$,fe]}),e[47]=$,e[48]=fe,e[49]=j):j=e[49],p=hp,y="max-h-80",w=f?n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"Loading tools…"}):n.jsxs(n.Fragment,{children:[n.jsx(ap,{children:"No tools found"}),Td.map(q=>{const te=q.tools.map(mb),me=te.filter(ne=>O.has(ne)).length;return n.jsx(Qa,{heading:n.jsx(Pl,{label:q.heading,icon:q.icon,on:me,total:te.length,onToggle:()=>J(te,me!==te.length)}),children:q.tools.map(ne=>n.jsx(Rl,{value:`${ne.title} ${ne.name}`,checked:O.has(ne.name),onToggle:()=>V(ne.name),title:ne.title,description:ne.description,leading:n.jsx(ne.icon,{size:16,className:"text-muted-foreground"})},ne.name))},q.key)}),M.map(q=>{const te=q.tools.map(fb),me=te.filter(ne=>O.has(ne)).length;return n.jsx(Qa,{heading:n.jsx(Pl,{conn:q.conn,on:me,total:te.length,onToggle:()=>J(te,me!==te.length)}),children:q.tools.map(ne=>n.jsx(Rl,{value:`${ne.display} ${ne.name} ${q.conn?.title??""}`,checked:O.has(ne.name),onToggle:()=>V(ne.name),title:ne.display,description:ne.description},ne.name))},q.clientId)})]}),e[6]=m,e[7]=u?.tools,e[8]=f,e[9]=r,e[10]=a,e[11]=i,e[12]=p,e[13]=_,e[14]=g,e[15]=v,e[16]=b,e[17]=x,e[18]=y,e[19]=w,e[20]=k,e[21]=j,e[22]=R,e[23]=I,e[24]=P}else p=e[12],_=e[13],g=e[14],v=e[15],b=e[16],x=e[17],y=e[18],w=e[19],k=e[20],j=e[21],R=e[22],I=e[23],P=e[24];let T;e[50]!==p||e[51]!==y||e[52]!==w?(T=n.jsx(p,{className:y,children:w}),e[50]=p,e[51]=y,e[52]=w,e[53]=T):T=e[53];let S;e[54]!==_||e[55]!==T||e[56]!==k||e[57]!==j?(S=n.jsxs(_,{children:[k,j,T]}),e[54]=_,e[55]=T,e[56]=k,e[57]=j,e[58]=S):S=e[58];let C;e[59]!==g||e[60]!==S||e[61]!==R||e[62]!==I?(C=n.jsx(g,{className:R,align:I,children:S}),e[59]=g,e[60]=S,e[61]=R,e[62]=I,e[63]=C):C=e[63];let D;return e[64]!==v||e[65]!==b||e[66]!==x||e[67]!==C||e[68]!==P?(D=n.jsxs(v,{open:P,onOpenChange:b,children:[x,C]}),e[64]=v,e[65]=b,e[66]=x,e[67]=C,e[68]=P,e[69]=D):D=e[69],D}function fb(t){return t.name}function mb(t){return t.name}function pb(t){return t.name}function _b(t,e){return(t.conn?.title??t.clientId).localeCompare(e.conn?.title??e.clientId)}function gb(t){return[t.id,t]}function Ii(t){const e=t.trim().split(/\s+/);return e.length!==5?!1:e.every(s=>/^[\d*/,-]+$/.test(s))}function vb(t){if(!t)return"Unknown schedule";const e=t.trim();if(e==="* * * * *")return"Every minute";if(e==="0 * * * *")return"Every hour";if(e==="0 0 * * *")return"Every day";if(e==="0 0 * * 1")return"Every week";const s=e.match(/^\*\/(\d+)\s+\*\s+\*\s+\*\s+\*$/);if(s)return`Every ${s[1]} minutes`;const i=e.match(/^0\s+\*\/(\d+)\s+\*\s+\*\s+\*$/);if(i)return`Every ${i[1]} hours`;const r=e.match(/^0\s+0\s+\*\/(\d+)\s+\*\s+\*$/);if(r){const l=parseInt(r[1]??"1");return l%7===0?`Every ${l/7} weeks`:`Every ${l} days`}const o=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+\*$/);if(o){const l=(o[2]??"0").padStart(2,"0"),h=(o[1]??"0").padStart(2,"0");return`Every day at ${l}:${h} UTC`}const a=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+(\d)$/);if(a){const h=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][parseInt(a[3]??"0")]??"day",c=(a[2]??"0").padStart(2,"0"),d=(a[1]??"0").padStart(2,"0");return`Every ${h} at ${c}:${d} UTC`}return t}function xb(t,e){const s=Math.max(1,t);switch(e){case"minutes":return s===1?"* * * * *":`*/${s} * * * *`;case"hours":return s===1?"0 * * * *":`0 */${s} * * *`;case"days":return s===1?"0 0 * * *":`0 0 */${s} * *`;case"weeks":return s===1?"0 0 * * 1":`0 0 */${s*7} * *`}}function bb(t){const e=t.trim();if(e==="* * * * *")return{count:1,unit:"minutes"};if(e==="0 * * * *")return{count:1,unit:"hours"};if(e==="0 0 * * *")return{count:1,unit:"days"};if(e==="0 0 * * 1")return{count:1,unit:"weeks"};const s=e.match(/^\*\/(\d+)\s+\*\s+\*\s+\*\s+\*$/);if(s)return{count:parseInt(s[1]),unit:"minutes"};const i=e.match(/^0\s+\*\/(\d+)\s+\*\s+\*\s+\*$/);if(i)return{count:parseInt(i[1]),unit:"hours"};const r=e.match(/^0\s+0\s+\*\/(\d+)\s+\*\s+\*$/);if(r){const o=parseInt(r[1]);return o%7===0?{count:o/7,unit:"weeks"}:{count:o,unit:"days"}}return null}function yb(t,e){return e===1?{minutes:"minute",hours:"hour",days:"day",weeks:"week"}[t]??t:t}const Sb=[{label:"5 minutes",cron:"*/5 * * * *"},{label:"Hour",cron:"0 * * * *"},{label:"Day",cron:"0 0 * * *"},{label:"Week",cron:"0 0 * * 1"}];function wb({automationId:t,open:e,onOpenChange:s,onCustomSelect:i,onEventSelect:r,onWebhookCreated:o}){const{triggerAdd:a}=Xi(),[l,h]=E.useState(!1),c=e??l,d=m=>{s?s(m):h(m)},u=async m=>{try{await a.mutateAsync({automation_id:t,type:"cron",cron_expression:m}),le.success("Starter added"),d(!1)}catch(p){const _=p instanceof Error?p.message:"Failed to add starter";le.error(_)}},f=async()=>{try{const m=await a.mutateAsync({automation_id:t,type:"webhook"});d(!1),m.webhook?o?.(m.webhook):le.success("Webhook starter added")}catch(m){const p=m instanceof Error?m.message:"Failed to add webhook starter";le.error(p)}};return n.jsxs(As,{open:c,onOpenChange:d,children:[n.jsx(Ds,{asChild:!0,children:n.jsxs(re,{variant:"outline",size:"sm",children:[n.jsx(xt,{size:14}),"Add Starter"]})}),n.jsxs(Is,{align:"end",className:"w-[200px]",children:[n.jsxs(qn,{children:[n.jsxs(Gn,{className:"gap-2.5",children:[n.jsx(Ri,{size:14,className:"text-muted-foreground shrink-0"}),"Every..."]}),n.jsx(Yn,{className:"w-[160px]",children:Sb.map(m=>n.jsxs(He,{className:"gap-2.5",onSelect:()=>u(m.cron),disabled:a.isPending,children:[n.jsx(Ri,{size:14,className:"text-muted-foreground shrink-0"}),"Every ",m.label]},m.cron))})]}),n.jsxs(He,{className:"gap-2.5",onSelect:()=>{d(!1),i?.()},children:[n.jsx(Ri,{size:14,className:"text-muted-foreground shrink-0"}),"Custom (cron)"]}),n.jsxs(He,{className:"gap-2.5",onSelect:()=>{d(!1),r?.()},children:[n.jsx(zi,{size:14,className:"text-muted-foreground shrink-0"}),"Event"]}),n.jsxs(He,{className:"gap-2.5",onSelect:()=>{f()},disabled:a.isPending,children:[n.jsx(qi,{size:14,className:"text-muted-foreground shrink-0"}),"Webhook"]})]})]})}function Rd(t){const e=K.c(31),{open:s,onOpenChange:i,url:r,token:o,title:a,description:l}=t,h=a===void 0?"Webhook ready":a,c=l===void 0?"Send a POST to this URL with the bearer token to fire the automation. The token is shown once — copy it now.":l,[d,u]=E.useState(null),[f,m]=E.useState("curl"),[p,_]=E.useState("header"),g=E.useId();let v;e[0]===Symbol.for("react.memo_cache_sentinel")?(v=async(N,A)=>{try{await navigator.clipboard.writeText(N),u(A),le.success("Copied"),setTimeout(()=>u(null),1500)}catch{le.error("Failed to copy")}},e[0]=v):v=e[0];const b=v;let x;e[1]!==p||e[2]!==o||e[3]!==r?(x=r&&o&&p==="url"?`${r.replace(/\/$/,"")}/${o}`:r??"",e[1]=p,e[2]=o,e[3]=r,e[4]=x):x=e[4];const y=x,w=r&&o?p==="header"?`curl -X POST "${y}" \\
|
|
275
|
+
`}),e[26]=y):y=e[26];let w;return e[27]!==x||e[28]!==d?(w=n.jsxs("div",{className:"relative flex w-full flex-col items-center justify-center gap-12 select-none [clip-path:inset(-24px_0_-200px_0)]",children:[d,x,y]}),e[27]=x,e[28]=d,e[29]=w):w=e[29],w}function ar(t){const e=K.c(10),{phase:s,current:i,children:r}=t,o=s-i,a=o<0,l=o===0,h=a?90:o*-22,c=a?.94:1-Math.max(o,0)*.04,d=a?0:l?1:o===1?.8:.55,u=a?10:30-o,f=!l;let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=he("absolute inset-0 overflow-hidden rounded-xl border border-foreground/10 bg-background shadow-[0_20px_60px_-20px_rgb(0_0_0_/_0.35)] transition-all ease-[cubic-bezier(0.22,1,0.36,1)]"),e[0]=m):m=e[0];const p=`translateY(${h}px) scale(${c})`,_=l?"auto":"none";let g;e[1]!==d||e[2]!==p||e[3]!==_||e[4]!==u?(g={transform:p,opacity:d,zIndex:u,transitionDuration:"1000ms",pointerEvents:_},e[1]=d,e[2]=p,e[3]=_,e[4]=u,e[5]=g):g=e[5];let v;return e[6]!==r||e[7]!==f||e[8]!==g?(v=n.jsx("div",{"aria-hidden":f,className:m,style:g,children:r}),e[6]=r,e[7]=f,e[8]=g,e[9]=v):v=e[9],v}function hn(t){const e=K.c(7),{showUrl:s}=t,i=s===void 0?!1:s;let r,o,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx("div",{className:he("size-2.5 rounded-full",Ct)}),o=n.jsx("div",{className:he("size-2.5 rounded-full",Ct)}),a=n.jsx("div",{className:he("size-2.5 rounded-full",Ct)}),e[0]=r,e[1]=o,e[2]=a):(r=e[0],o=e[1],a=e[2]);let l;e[3]!==i?(l=i&&n.jsx("div",{className:he("ml-3 h-3.5 max-w-[220px] flex-1 rounded-sm",Ht)}),e[3]=i,e[4]=l):l=e[4];let h;return e[5]!==l?(h=n.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-1.5 px-3",children:[r,o,a,l]}),e[5]=l,e[6]=h):h=e[6],h}function I1(){const t=K.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(hn,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsxs("div",{className:"flex h-full flex-col",children:[e,n.jsx("div",{className:"flex flex-1 px-8 py-5",children:n.jsx("div",{className:"grid h-full w-full grid-cols-8 grid-rows-6 gap-2",children:E1.map(B1)})})]}),t[1]=s):s=t[1],s}function B1(t,e){if(e===cd)return n.jsx("div",{className:"rounded-md bg-chart-1/[0.55]",style:{animation:"vm-breathe 2.4s ease-in-out infinite"}},e);const s=t;return n.jsx("div",{className:he("relative rounded-md",Ct),children:n.jsx("div",{className:"absolute inset-0 rounded-md bg-chart-1/40 opacity-0",style:{animation:`vm-rack-scan ${hd}s ease-in-out infinite`,animationDelay:`${s}s`}})},e)}function M1(){const t=K.c(5);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(hn,{}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx("div",{className:he("w-[18%] rounded-md",Ht),style:{animation:"vm-breathe 3s ease-in-out infinite"}}),t[1]=s):s=t[1];let i;t[2]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx("div",{className:"h-[42%] shrink-0 rounded-md bg-chart-3/[0.12]",style:{animation:"vm-breathe 3s ease-in-out 0.4s infinite"}}),t[2]=i):i=t[2];let r;t[3]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx("div",{className:"col-span-3 rounded-md bg-chart-3/[0.12]",style:{animation:"vm-breathe 3s ease-in-out 0.8s infinite"}}),t[3]=r):r=t[3];let o;return t[4]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsxs("div",{className:"flex h-full flex-col",children:[e,n.jsxs("div",{className:"flex min-h-0 flex-1 gap-1.5 p-3",children:[s,n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[i,n.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-5 gap-1.5",children:[r,n.jsxs("div",{className:"col-span-2 grid grid-rows-2 gap-1.5",children:[n.jsx("div",{className:he("rounded-md",Ht),style:{animation:"vm-breathe 3s ease-in-out 1.2s infinite"}}),n.jsx("div",{className:he("rounded-md",Ht),style:{animation:"vm-breathe 3s ease-in-out 1.6s infinite"}})]})]})]})]})]}),t[4]=o):o=t[4],o}function L1(){const t=K.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(hn,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsxs("div",{className:"flex h-full flex-col",children:[e,n.jsx("div",{className:"relative flex flex-1 items-center justify-center px-8 py-5",children:n.jsx("div",{className:"grid w-full gap-2",style:{gridTemplateColumns:"repeat(7, minmax(0, 1fr))"},children:P1.map(O1)})})]}),t[1]=s):s=t[1],s}function O1(t,e){return n.jsx("div",{className:he("aspect-square rounded-md",A1[e]?"bg-chart-2/70":Ct),style:{animation:`vm-pulse-soft 2.2s ease-in-out ${t}s infinite`}},e)}function $1(){const t=K.c(11);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(hn,{showUrl:!0}),t[0]=e):e=t[0];let s,i,r,o,a;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx("div",{className:"mb-2 h-5 rounded-md bg-chart-1/[0.10]"}),i=n.jsx("div",{className:he("h-1.5 w-[70%] rounded-sm",Ct)}),r=n.jsx("div",{className:he("h-1.5 w-[55%] rounded-sm",Ct)}),o=n.jsx("div",{className:he("h-1.5 w-[80%] rounded-sm",Ct)}),a=n.jsx("div",{className:he("h-1.5 w-[50%] rounded-sm",Ct)}),t[1]=s,t[2]=i,t[3]=r,t[4]=o,t[5]=a):(s=t[1],i=t[2],r=t[3],o=t[4],a=t[5]);let l;t[6]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsxs("div",{className:"flex w-[18%] shrink-0 flex-col gap-1.5 bg-chart-1/[0.05] p-2.5",children:[s,i,r,o,a,n.jsx("div",{className:"mt-auto",children:n.jsx("div",{className:he("h-4 rounded-md",Ct)})})]}),t[6]=l):l=t[6];let h;t[7]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx("div",{className:"relative h-[42%] shrink-0 overflow-hidden bg-chart-1/[0.10]",children:n.jsxs("div",{className:"absolute right-3 bottom-3 left-3 space-y-1.5",children:[n.jsx("div",{className:"h-3 w-[35%] rounded-sm bg-chart-1/[0.15]"}),n.jsx("div",{className:he("h-1.5 w-[55%] rounded-sm",Ht)})]})}),t[7]=h):h=t[7];let c;t[8]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsxs("div",{className:"flex shrink-0 gap-1.5",children:[n.jsx("div",{className:"h-4 w-12 rounded-full bg-chart-1/[0.12]"}),n.jsx("div",{className:he("h-4 w-10 rounded-full",Ht)}),n.jsx("div",{className:he("h-4 w-14 rounded-full",Ht)})]}),t[8]=c):c=t[8];let d;t[9]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsxs("div",{className:he("col-span-3 flex flex-col justify-end gap-1 rounded-md p-2",Ht),children:[n.jsx("div",{className:he("h-1.5 w-[50%] rounded-sm",Ct)}),n.jsx("div",{className:he("h-1 w-[75%] rounded-sm",Ct)})]}),t[9]=d):d=t[9];let u;return t[10]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsxs("div",{className:"flex h-full flex-col",children:[e,n.jsxs("div",{className:"flex min-h-0 flex-1",children:[l,n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[h,n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-2.5 p-3",children:[c,n.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-5 gap-2",children:[d,n.jsxs("div",{className:"col-span-2 grid grid-rows-2 gap-2",children:[n.jsx("div",{className:he("rounded-md",Ht)}),n.jsx("div",{className:he("rounded-md",Ht)})]})]})]})]})]})]}),t[10]=u):u=t[10],u}function Wr(t){const e=K.c(9);if(t.kind==="starting"){let l;return e[0]!==t.claimPhase||e[1]!==t.progress?(l=n.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:n.jsx(D1,{progress:t.progress,claimPhase:t.claimPhase})}),e[0]=t.claimPhase,e[1]=t.progress,e[2]=l):l=e[2],l}let s;e[3]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(Wf,{className:"size-12 text-blue-500"}),e[3]=s):s=e[3];let i,r;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx("h3",{className:"text-lg font-medium",children:j1("suspended")}),r=n.jsx("p",{className:"max-w-sm text-sm text-muted-foreground",children:"Resume to continue."}),e[4]=i,e[5]=r):(i=e[4],r=e[5]);let o;e[6]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(Vs,{className:"size-4"}),e[6]=o):o=e[6];let a;return e[7]!==t.onResume?(a=n.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:n.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-4 text-center",children:[s,i,r,n.jsxs(re,{onClick:t.onResume,className:"mt-2",children:[o," Resume"]})]})}),e[7]=t.onResume,e[8]=a):a=e[8],a}const z1=E.lazy(()=>qt(()=>import("./sections-editor-DbBhsr7i.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,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155])).then(t=>({default:t.SectionsEditor}))),F1=E.lazy(()=>qt(()=>import("./page-seo-sheet-g9EKqmR_.js"),__vite__mapDeps([156,1,2,123,44,46,47,48,16,3,5,88,73,83,80,6,7,8,9,10,11,12,13,14,15,17,4,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,45,81,50,82,74,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,49,71,72,75,76,77,78,79,51,84,85,86,87,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,89,90,119,120,121,122,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154])).then(t=>({default:t.SeoSheet}))),H1=E.lazy(()=>qt(()=>import("./file-explorer-D5ZtuxHx.js"),__vite__mapDeps([157,1,2,138,6,7,8,9,10,11,12,13,14,15,16,3,17,4,5,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,48,128,93,94,58,59,95,96,97,57,79,60,105,106,49,107,108,109,50,121,122,123,124,85,82,71,125,110,126,56,68,116,77,127,63,64,65,72,73,112,129,52,53,54,55,61,62,66,67,69,70,74,75,76,78,89,90,130,131,132,99,100,137,102,51,92,98,101,103,104,111,86,113,114,115,117,118,119,120,133,134,135,136,139,140,83,141,142,143,144,145,146,147,148,149,150,151,152,153,154])).then(t=>({default:t.FileExplorer}))),Cn=500,W1={mobile:375,tablet:768,desktop:null},kn=["desktop","mobile","tablet"],U1={mobile:"Mobile (375px)",tablet:"Tablet (768px)",desktop:"Desktop"};function K1(t,e){const s=new URL(t,window.location.href);return s.searchParams.set("deviceHint",e),s.href}function V1(){const t=ir(),{currentBranch:e}=ss(),[s,i]=E.useState("preview"),[r,o]=E.useState("desktop"),[a,l]=E.useState(null),h=E.useRef(null),c=s==="cms",[d,u]=E.useState(null),[f,m]=E.useState(384),p=E.useRef(!1),_=E.useRef(0),g=E.useRef(0),v=E.useRef(null),[b,x]=E.useState(!1),[y,w]=E.useState(""),k=E.useRef(null),[j,R]=E.useState(!1),[I,P]=E.useState(),[T,S]=E.useState(null),[C,D]=E.useState(null),[N,A]=E.useState("/"),[M,B]=E.useState(null),[L,O]=E.useState(!1),[W,F]=E.useState(!1),[V,J]=E.useState(null),G=t?.entity?.id??null,{org:U}=Pe(),H=Yt(),X=rd(),oe=X.vmEntry,$=X.previewUrl,se=H.lifecycle.phase,ee=se==="running",Q=G&&e&&ee?{orgSlug:U.slug,virtualMcpId:G,branch:e}:null,{data:z}=ha(Q,{fetchEnabled:ee}),{data:ce}=da(Q,{fetchEnabled:ee}),ue=G&&e?{orgSlug:U.slug,virtualMcpId:G,branch:e}:null,fe=_1(ue),q=z?ya(z).sort((ie,ve)=>ie.name.localeCompare(ve.name)):[],te=z&&ce?Sa(z,ce):[],me=Us,ne=q.filter(ie=>{if(!y)return!0;const ve=y.toLowerCase();return ie.name.toLowerCase().includes(ve)||ie.path.toLowerCase().includes(ve)}),ke=te.filter(ie=>{if(!y)return!0;const ve=y.toLowerCase();return ie.name.toLowerCase().includes(ve)||ie.key.toLowerCase().includes(ve)||ie.resolveType.toLowerCase().includes(ve)}),ot=T?null:O_(q,N,M),Be=T?T.name:ot?.name,mt=ot?.key??null,as=E.useRef(null),Y=E.useRef(null);Y_(()=>{const ie=h.current,ve=as.current;!ie||!ve||(ie.src=ve)});const _e=H.status.state==="paused",xe=H.phase,Se=ld({claimPhase:xe,lifecycle:H.lifecycle}),we=X.previewState,dt=X.userStopped,bt=we.kind==="iframe"?K1(C??new URL(N,we.previewUrl).href,r):null,[rr,nr]=E.useState(null);if(we.kind==="iframe"&&rr!==we.previewUrl){const ie=rr!==null;nr(we.previewUrl),ie&&(Y.current=null,A("/"),D(null),B(null),S(null))}as.current=bt;const ge=!!G&&!!e&&!H.notFound&&!dt&&!_e&&(xe?.kind==="ready"||se!=="idle"),je=we.kind!=="iframe"&&(s==="visual"||s==="cms")?"preview":s;E.useEffect(()=>{if(!$)return;let ie;try{ie=new URL($,window.location.href).origin}catch{return}const ve=st=>{if(st.origin===ie){if(st.data?.type==="visual-editor::element-clicked"){const it=v1.safeParse(st.data.payload);it.success&&l(it.data)}else if(st.data?.type==="cms-editor::section-clicked"){const it=b1.safeParse(st.data.payload);it.success&&u(it.data.sectionIndex)}}};return window.addEventListener("message",ve),()=>window.removeEventListener("message",ve)},[$]),E.useEffect(()=>{if(!b)return;const ie=ve=>{k.current?.contains(ve.target)||(x(!1),w(""))};return document.addEventListener("pointerdown",ie),()=>document.removeEventListener("pointerdown",ie)},[b]),E.useEffect(()=>{if(!c)return;const ie=st=>{const it=st.target;it&&it!==h.current&&(v.current=it)},ve=()=>{requestAnimationFrame(()=>{const st=document.activeElement;(st===document.body||st===h.current)&&v.current&&v.current.focus()})};return document.addEventListener("focusin",ie),document.addEventListener("blur",ve,!0),()=>{document.removeEventListener("focusin",ie),document.removeEventListener("blur",ve,!0)}},[c]);const et=()=>{const ie=h.current?.contentWindow;ie&&ie.postMessage({type:"visual-editor::activate",script:x1},"*")},yt=()=>{const ie=h.current?.contentWindow;ie&&ie.postMessage({type:"visual-editor::deactivate"},"*")},tt=()=>{const ie=h.current?.contentWindow;ie&&ie.postMessage({type:"visual-editor::activate",script:y1},"*")},Tu=()=>{const ie=h.current?.contentWindow;ie&&ie.postMessage({type:"cms-editor::deactivate"},"*")},di=ie=>{const ve=s;i(ie),l(null),ie!=="code"&&J(null),ie!=="cms"&&u(null),ve==="visual"&&yt(),ve==="cms"&&Tu(),ie==="visual"&&et(),ie==="cms"&&tt()},Ru=()=>{if(!h.current||!bt)return;const ie=h.current;ie.src=bt},Pu=()=>{if(!h.current||!bt)return;const ie=bt.includes("?")?"&":"?";h.current.src=`${bt}${ie}_r=${Date.now()}`},Au=()=>{const ie=kn.indexOf(r);o(kn[(ie+1)%kn.length])},Du=()=>{const ie=h.current?.contentWindow?.location?.href??bt??$;ie&&navigator.clipboard.writeText(ie)},Iu=(()=>{if(!$)return"No server running";if(T)return T.name;try{const ie=new URL($),ve=N==="/"?"":N;return`${ie.host}${ve}`}catch{return $}})(),Fa=ie=>{Y.current=ie.path,S(null),D(null),B(ie.key),A(ie.path),u(null),O(!1)},Bu=ie=>{if(!$||!ce){le.error("Preview metadata not ready yet");return}Y.current=null;const ve=Oh(ce),st=u1($,ve,ie.key);S(ie),D(st),u(null)},Mu=async({name:ie,path:ve})=>{if(!G||!e)return;const st=ga(ve);if(st){P(st);return}const it=ve.trim().startsWith("/")?ve.trim():`/${ve.trim()}`;if(q.some(Et=>me(Et.path)===me(it))){P(`A page with path "${it}" already exists.`);return}P(void 0);try{const Et=await fe.mutateAsync({name:ie,path:it});R(!1),le.success(`Page "${ie}" created`),await new Promise(Ou=>setTimeout(Ou,Cn)),Fa({key:Et.key,name:Et.name,path:Et.path}),di("cms")}catch(Et){P(Et instanceof Error?Et.message:"Failed to create page")}},Lu=[{value:"preview",icon:n.jsx(Va,{size:14}),tooltip:"Interactive"},...we.kind==="iframe"?[{value:"visual",icon:n.jsx(qa,{size:14}),tooltip:"Visual editor"}]:[],...we.kind==="iframe"&&ba(z,ce)?[{value:"cms",icon:n.jsx(Uf,{size:14}),tooltip:"Sections editor"}]:[],{value:"code",icon:n.jsx(Kf,{size:14}),tooltip:"Code editor"}];return n.jsxs("div",{className:"flex flex-col w-full h-full",children:[ge&&n.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-4 border-b border-border/60 px-3 md:px-4",children:[n.jsx("div",{className:"flex shrink-0 items-center gap-1",children:n.jsx(ip,{value:je,onValueChange:di,options:Lu,size:"sm",className:"shrink-0 bg-foreground/4.5"})}),we.kind==="iframe"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:he("flex min-w-0 flex-1 items-center gap-0.5 ml-2",s==="code"&&"hidden"),children:[n.jsxs(Re,{children:[n.jsx(Ee,{asChild:!0,children:n.jsx(re,{variant:"ghost",size:"icon",onClick:Ru,children:n.jsx(Mi,{size:14})})}),n.jsx(Te,{side:"bottom",children:"Refresh"})]}),n.jsxs(Re,{children:[n.jsx(Ee,{asChild:!0,children:n.jsx(re,{variant:"ghost",size:"icon",onClick:Au,children:n.jsxs("span",{className:"flex items-center justify-center animate-device-icon-pop",children:[r==="mobile"&&n.jsx(Vf,{size:14}),r==="tablet"&&n.jsx(qf,{size:14}),r==="desktop"&&n.jsx(Va,{size:14})]},r)})}),n.jsx(Te,{side:"bottom",children:U1[r]})]}),n.jsxs("div",{ref:k,className:"relative min-w-0 flex-1",children:[n.jsxs("button",{type:"button",className:"flex h-8 w-full min-w-0 items-center gap-1 rounded-md bg-background px-2 transition-colors duration-200 hover:bg-accent",onClick:()=>x(ie=>!ie),children:[T&&n.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 rounded bg-global-section/14 px-1.5 py-0.5 text-[11px] font-medium text-global-section-fg dark:text-global-section-fg-dark",children:[n.jsx(Gs,{size:11}),"Global"]}),n.jsx("span",{className:"min-w-0 flex-1 truncate text-left text-[12px] text-foreground/88",children:Iu}),Be&&!T&&n.jsx("span",{className:"shrink-0 text-[12px] text-muted-foreground",children:Be}),n.jsx(Es,{size:12,className:he("shrink-0 text-muted-foreground transition-transform",b&&"rotate-180")})]}),b&&n.jsxs("div",{className:"absolute left-0 right-0 top-full z-50 mt-1.5 overflow-hidden rounded-lg border bg-popover shadow-lg",children:[n.jsxs("div",{className:"px-2 h-10 flex items-center gap-2 border-b",children:[n.jsx(fh,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),n.jsx("input",{type:"text",value:y,onChange:ie=>w(ie.target.value),placeholder:"Search pages and components...",className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",autoFocus:!0})]}),n.jsx("div",{className:"p-1.5 border-b",children:n.jsxs("button",{type:"button",className:"flex w-full items-center gap-2.5 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:ie=>{ie.preventDefault(),x(!1),w(""),P(void 0),R(!0)},children:[n.jsx(xt,{size:16,className:"shrink-0 text-muted-foreground"}),n.jsx("span",{className:"flex-1 font-medium",children:"Create new page"})]})}),ne.length===0&&ke.length===0?n.jsx("div",{className:"px-4 py-5 text-center text-xs text-muted-foreground",children:q.length===0&&te.length===0?"No pages found in this site.":"No results match your search."}):n.jsxs("div",{className:"max-h-80 overflow-y-auto overscroll-contain",children:[ne.length>0&&n.jsx("div",{className:"p-1.5",children:ne.map(ie=>n.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:ve=>{ve.preventDefault(),x(!1),w(""),Fa(ie)},children:[n.jsx(Vo,{size:16,className:"shrink-0 text-muted-foreground"}),n.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:ie.name}),n.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:ie.path})]},ie.key))}),ke.length>0&&n.jsxs("div",{className:he("p-1.5",ne.length>0&&"border-t"),children:[n.jsx("div",{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"Global components"}),ke.map(ie=>n.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:ve=>{ve.preventDefault(),x(!1),w(""),Bu(ie)},children:[n.jsx(Gs,{size:16,className:"shrink-0 text-muted-foreground"}),n.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:ie.name}),n.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:ie.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},ie.key))]})]})]})]})]}),n.jsxs("div",{className:he("flex shrink-0 items-center gap-0.5",s==="code"&&"hidden"),children:[n.jsxs(Re,{children:[n.jsx(Ee,{asChild:!0,children:n.jsx(re,{variant:"ghost",size:"icon",onClick:()=>{const ie=bt??we.previewUrl;ie&&window.open(ie,"_blank","noopener")},children:n.jsx(ri,{size:14})})}),n.jsx(Te,{side:"bottom",children:"Open in new tab"})]}),n.jsxs(As,{children:[n.jsx(Ds,{asChild:!0,children:n.jsx(re,{variant:"ghost",size:"icon",children:n.jsx(nn,{size:14})})}),n.jsxs(Is,{align:"end",className:"w-44",children:[n.jsx(He,{onClick:Pu,children:"Hard Reload"}),n.jsx(He,{onClick:Du,children:"Copy Current URL"}),z&&ce&&n.jsxs(n.Fragment,{children:[n.jsx(vr,{}),mt&&n.jsxs(He,{onClick:()=>{O(!0),di("cms")},children:[n.jsx(Nr,{size:14}),"Edit SEO"]}),mt&&n.jsxs(He,{onClick:()=>{try{J(Ja(mt)),di("code")}catch{le.error("Invalid page block key")}},children:[n.jsx(qo,{size:14}),"View JSON"]}),n.jsxs(He,{onClick:()=>F(!0),children:[n.jsx(Nr,{size:14}),"Site SEO"]})]})]})]})]})]})]}),n.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[c&&$&&e&&G&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"shrink-0 border-r overflow-hidden",style:{width:f},children:n.jsx(E.Suspense,{fallback:n.jsx("div",{className:"h-full flex items-center justify-center",children:n.jsx(Ce,{size:20,className:"animate-spin text-muted-foreground"})}),children:n.jsx(z1,{orgSlug:U.slug,virtualMcpId:G,branch:e,previewReady:ee,previewUrl:$,currentPath:N,activePageBlockKey:mt,activeGlobalBlockKey:T?.key??null,externalSelectedIndex:T?null:d,onSaved:()=>{setTimeout(()=>{const ie=h.current;if(!ie)return;const ve=document.activeElement,st=ie.tabIndex;ie.tabIndex=-1,ie.style.pointerEvents="none",ie.blur();try{ie.contentWindow?.location.reload()}catch{const Et=as.current;Et&&(ie.src=Et)}const it=()=>{ie.tabIndex=st,ie.style.pointerEvents="",ve?.focus(),ie.removeEventListener("load",it)};ie.addEventListener("load",it),setTimeout(it,3e3)},Cn)},initialEditSeo:L,onExitSeo:()=>O(!1),onViewJsonFile:ie=>{try{J(Ja(ie)),di("code")}catch{le.error("Invalid page block key")}}})})}),n.jsx("div",{className:"w-1 shrink-0 cursor-col-resize bg-transparent hover:bg-border transition-colors",onPointerDown:ie=>{p.current=!0,_.current=ie.clientX,g.current=f,ie.currentTarget.setPointerCapture(ie.pointerId)},onPointerMove:ie=>{if(!p.current)return;const ve=ie.clientX-_.current;m(Math.max(240,Math.min(640,g.current+ve)))},onPointerUp:()=>{p.current=!1}})]}),n.jsxs("div",{className:he("flex-1 relative overflow-hidden",r!=="desktop"&&we.kind==="iframe"&&s!=="code"&&"flex justify-center bg-muted/30"),children:[we.kind==="starting"&&n.jsx("div",{className:"absolute inset-0 z-30",children:n.jsx(Wr,{kind:"starting",progress:Se,claimPhase:xe})}),we.kind==="suspended"&&n.jsx("div",{className:"absolute inset-0 z-30",children:n.jsx(Wr,{kind:"suspended",onResume:X.resume})}),je==="visual"&&!a&&n.jsxs("div",{className:"absolute top-2 left-1/2 -translate-x-1/2 z-20 flex items-center gap-1.5 rounded-full border border-violet-400/40 bg-violet-500/90 px-3 py-1 text-xs font-medium text-white shadow-md backdrop-blur-sm pointer-events-none select-none",children:[n.jsx(qa,{size:12}),"Click any element to ask the AI"]}),je==="visual"&&a&&n.jsx(C1,{element:a,onDismiss:()=>l(null)}),s==="code"&&ge&&G&&e&&n.jsx("div",{className:"absolute inset-0 z-10 bg-background",children:n.jsx(E.Suspense,{fallback:n.jsx("div",{className:"h-full flex items-center justify-center",children:n.jsx(Ce,{size:20,className:"animate-spin text-muted-foreground"})}),children:n.jsx(H1,{orgSlug:U.slug,virtualMcpId:G,branch:e,openPath:V})})}),we.kind==="iframe"&&bt&&n.jsx("div",{className:he("h-full transition-[width] duration-250 [transition-timing-function:var(--ease-in-out-cubic)]",r!=="desktop"&&s!=="code"&&"w-full max-w-full border-x border-border bg-background shadow-sm"),style:{width:r==="desktop"||s==="code"?"100%":`${W1[r]}px`},children:n.jsx("iframe",{ref:h,src:bt,className:he("w-full h-full border-0",s==="code"&&"invisible"),title:"Dev Server Preview",tabIndex:c?-1:void 0,onLoad:()=>{if(Ae("vm_preview_loaded",{view_mode:s,vm_id:oe?.sandboxHandle??null}),!T)try{const ie=h.current?.contentWindow?.location?.pathname;if(!ie)return;const ve=Y.current;if(ve!==null){Y.current=null,me(ie)===me(ve)&&A(ie);return}A(ie)}catch{}s==="visual"&&et(),s==="cms"&&tt()}},we.previewUrl)})]})]}),n.jsx(g1,{open:j,onOpenChange:R,isPending:fe.isPending,error:I,onSubmit:Mu}),W&&z&&ce&&n.jsx(E.Suspense,{fallback:null,children:n.jsx(F1,{open:W,onOpenChange:F,orgSlug:U.slug,virtualMcpId:G??"",branch:e??"",decofile:z,meta:ce,onSaved:()=>{setTimeout(()=>{const ie=h.current;if(ie)try{ie.contentWindow?.location.reload()}catch{const ve=as.current;ve&&(ie.src=ve)}},Cn)},target:{kind:"site"}})})]})}function q1(t){const e=K.c(2),{virtualMcpId:s}=t,i=Mt(s);if(!ti(i?.metadata)){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 text-center text-sm text-muted-foreground p-6",children:[n.jsx(Ki,{size:24,className:"text-muted-foreground/60"}),n.jsx("div",{children:"No source to preview."}),n.jsx("div",{className:"text-xs text-muted-foreground/80",children:"Connect a GitHub repository from the Connections tab to enable Preview."})]}),e[0]=a):a=e[0],a}let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(V1,{}),e[1]=o):o=e[1],o}function G1(t,e){if(!t||!e?.length)return t;const s=Object.fromEntries(Object.entries(t.properties??{}).filter(([i])=>!e.includes(i)));return Object.keys(s).length>0?{...t,properties:s}:t}function Y1(t,e,s){return typeof t!="string"?null:G1(Bh(t,e),s)}function dd(t,e,s){if(!e||typeof t!="string")return!1;const i=Y1(t,e,s);return!!i&&Object.keys(i.properties??{}).length>0}function X1({orgSlug:t,virtualMcpId:e,branch:s}){const i=Qs();return ei({mutationFn:async({blockKey:r})=>{const o=rh(r),a=await fetch(`/api/${t}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(s)}/unlink`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:o})});if(!a.ok){const l=await a.json().catch(()=>({}));throw new Error(l.error??`Delete failed (${a.status})`)}return a.json()},onMutate:async({blockKey:r})=>{const o=`${t}/${e}/${s}`,a=Bt.decofile(o);await i.cancelQueries({queryKey:a});const l=i.getQueryData(a);return i.setQueryData(a,h=>{if(!h)return h;const{[r]:c,...d}=h;return d}),{previous:l,queryKey:a}},onError:(r,o,a)=>{a?.queryKey&&i.setQueryData(a.queryKey,a.previous)},onSuccess:()=>{const r=`${t}/${e}/${s}`;i.invalidateQueries({queryKey:Bt.liveMeta(r)})}})}function dn(t,e){return`${t}-${e}`}function ud(t,e){return`site/apps/${t}/${e}.ts`}function fd(t){const e=t.match(/^site\/apps\/([^/]+)\/([^/.]+)\.tsx?$/);if(e)return{vendor:e[1],app:e[2]};const s=t.match(/^([^/]+)\/apps\/([^/.]+)\.tsx?$/);return s?{vendor:s[1],app:s[2]}:null}function J1(t){const e=t.match(/^([^-]+)-(.+)$/);return e?{vendor:e[1],app:e[2]}:null}function Z1(t){return t==="local"?"Custom":"Installed"}function md(t,e,s){const i=new Set([dn(t,e),e].map(o=>o.toLowerCase())),r=ud(t,e);for(const[o,a]of Object.entries(s)){if(o.includes("/")||!a||typeof a!="object"||Array.isArray(a))continue;const l=a;if(i.has(o.toLowerCase())||l.__resolveType===r)return o}return null}function Q1(t,e){const s=t.vendor.alias,i=t.name,r=md(s,i,e);return{id:dn(s,i),app:i,vendor:s,title:t.title||t.name,description:t.description,category:t.category??"Other",logo:t.logo||void 0,resolveType:ud(s,i),blockKey:r,installed:r!==null}}function ex(t,e,s){if(t===xa)return null;const i=fd(t);if(!i)return null;const{vendor:r,app:o}=i,a=md(r,o,s),l=ni(t,e);return{id:dn(r,o),app:o,vendor:r,title:l.title??o,description:l.description??"",category:"Others",logo:l.logo??l.icon,resolveType:t,blockKey:a,installed:a!==null}}function tx(t,e,s){const i=e.__resolveType;if(typeof i!="string"||Fr(t,e)||!Ih(i))return null;const r=fd(i)??J1(t);if(!r)return null;const o=ni(i,s),{vendor:a,app:l}=r;return{id:dn(a,l),app:l,vendor:a,title:o.title??Hr(t,e,s),description:o.description??"",category:Z1(a),logo:o.logo??o.icon,resolveType:i,blockKey:t,installed:!0}}function sx(t,e,s){const i=new Map;for(const o of t){const a=Q1(o,s);i.set(a.id,a)}const r=e.manifest?.blocks?.apps??{};for(const o of Object.keys(r)){const a=ex(o,e,s);!a||i.has(a.id)||i.set(a.id,a)}for(const[o,a]of Object.entries(s)){if(o.includes("/")||!a||typeof a!="object"||Array.isArray(a))continue;const l=tx(o,a,e);!l||i.has(l.id)||i.set(l.id,l)}return[...i.values()].sort(ix)}function ix(t,e){return t.installed!==e.installed?t.installed?-1:1:t.title.localeCompare(e.title)}async function rx(){const t=await fetch("/api/deco-apps");if(!t.ok)throw new Error(`Failed to fetch deco apps: ${t.status}`);return(await t.json()).apps??[]}function nx(t,e,s){const i=K.c(12),r=s?.enabled??!0;let o;i[0]===Symbol.for("react.memo_cache_sentinel")?(o=Bt.decoApps(),i[0]=o):o=i[0];let a;i[1]!==r?(a={queryKey:o,queryFn:rx,staleTime:3e5,retry:1,enabled:r},i[1]=r,i[2]=a):a=i[2];const l=Zs(a);let h;i[3]!==e||i[4]!==t||i[5]!==l.data?(h=t&&e?sx(l.data??[],t,e):[],i[3]=e,i[4]=t,i[5]=l.data,i[6]=h):h=i[6];const c=h,d=l.isLoading&&!l.isError;let u;return i[7]!==c||i[8]!==l.isError||i[9]!==l.refetch||i[10]!==d?(u={catalog:c,isLoading:d,isError:l.isError,refetch:l.refetch},i[7]=c,i[8]=l.isError,i[9]=l.refetch,i[10]=d,i[11]=u):u=i[11],u}const ox=new Set(["website/pages/Page.tsx","$live/pages/LivePage.tsx"]);function ax(t){return t.includes("matchers")||t.includes("Match")}function lx(t,e){const s=t.__resolveType;return typeof s!="string"||!s||ox.has(s)?!1:e?j_(e,s):ax(s)}function Zi(t,e,s){if(!t)return!1;const i=t.__resolveType;if(typeof i!="string"||!fa(i)||!Object.hasOwn(e,i))return!1;const r=e[i];return!r||typeof r!="object"||Array.isArray(r)?!1:lx(r,s)}function ek(t,e,s){return Zi(t,e,s)?t?.__resolveType??null:null}function pd(t,e,s){if(!t)return null;const i=t.__resolveType??"";if(!i)return null;if(Zi(t,e,s)){const a=e[i]??{},l=a.__resolveType??i,{__resolveType:h,name:c,...d}=a;return{resolveType:l,data:d,blockKey:i}}const{__resolveType:r,...o}=t;return{resolveType:i,data:o}}function cx(t,e,s){const i=pd(t,e,s);return i?{__resolveType:i.resolveType,...i.data}:{__resolveType:""}}function tk(t,e,s){if(t)return Zi(t,e,s)?cx(t,e,s):t}function hx(t,e,s,i){if(!t)return"Default";if(Zi(t,e,i)){const r=t.__resolveType??"",o=e[r];return Fh(r,o)}return s(t)}function sk(t,e,s){return{__resolveType:t,...e,name:s}}function ik(t){return{__resolveType:t}}function rk(t,e,s){const i=pd(t,e,s);return i?{resolveType:i.resolveType,formValue:i.data}:{resolveType:"",formValue:{}}}function _d(t){const e=t.__resolveType??"";return es(e)?t.section??t:t}function Ur(t){const r=(es(t.__resolveType??"")?t.section:t)?.variants?.[0];return r?.rule?.__resolveType!==Eh?null:r?.value??null}function nk(t){const e=_d(t);return{__resolveType:Th,variants:[{value:e,rule:{__resolveType:Eh}}]}}function ok(t){const e=t.__resolveType??"";if(!e)return null;if(es(e))return t.section??null;const s=Ur(t);return s?es(s.__resolveType??"")?s:{__resolveType:al,section:_d(s)}:{__resolveType:al,section:t}}function lr(t){const e=t.__resolveType??"";if(!e)return null;if(es(e)){const s=t.section,i=s?.__resolveType??"";return!i||!s?null:{resolveType:i,data:s}}return{resolveType:e,data:t}}function ak(t){const e=Ur(t);if(e)return lr(e);if(es(t.__resolveType??"")){const i=t.section;if(!i)return null;const r=Ur(i);return lr(r||i)}return lr(t)}function lk(t){return Ur(t)}const dx=["website/matchers/always.ts","$live/matchers/MatchAlways.ts"];function gd(t){if(!t)return!1;const e=t.__resolveType??"";return e===""?Object.keys(t).length===0:dx.includes(e)||e.includes("always")}function ux(t){const e=t.variants??[];if(e.length===0)return-1;const s=e.findIndex(i=>gd(i.rule));return s!==-1?s:e.length-1}function ck(t,e,s){const i=s.variants??[];if(i.length===0)return null;const r=ux(s),o=i[r]?.value;if(!o)return null;const a=structuredClone(o);return e.isLazy?{...t,section:a}:a}function vd(t,e){return e.isMultivariate?e.isLazy?t.section??null:t:null}function hk(t,e){return Array.isArray(t.variants)?t.variants.map((s,i)=>({label:e(s.rule)||`Variant ${i+1}`,value:s.value??{},rule:s.rule})):[]}function dk(t,e){const s=t.__resolveType??"";if(!s)return null;if(es(s)){const i=t.section??t,r=i.__resolveType??s;if(!r.includes("/")&&r in e){const o=e[r]??{};return{data:{...o},resolveType:o.__resolveType??r}}return{data:{...i},resolveType:r}}if(!s.includes("/")&&s in e){const i=e[s]??{};return{data:{...i},resolveType:i.__resolveType??s}}return{data:{...t},resolveType:s}}function fx(t,e){const s=t.__resolveType??"";return es(s)?{...t,section:e}:e}function mx(t,e,s){return e.isLazy?{...t,section:s}:s}function uk(t,e,s){const i=[...t.variants??[]],r=i[e];if(!r)return t;const o=r.value??{};return i[e]={...r,value:fx(o,s)},{...t,variants:i}}function fk(t,e,s){const i=[...t.variants??[]];return i[e]?(i[e]={...i[e],rule:s},{...t,variants:i}):t}function mk(t,e){const s=[...t.variants??[]],i=s[e];return i?(s.splice(e+1,0,structuredClone(i)),{...t,variants:s}):t}function pk(t,e){const s=[...t.variants??[]];return s.length<=1?null:(s.splice(e,1),{...t,variants:s})}function Qn(t){return{rule:ma(),value:structuredClone(t)}}function xd(t,e){return{...e,__resolveType:Th,variants:t}}function _k(t){return t.isHidden!==!0&&t.isSavedBlock!==!0}function px(t,e){if(e.isHidden)return null;if(e.isMultivariate){const i=vd(t,e)?.variants??[],r=i[i.length-1]?.value;return r?structuredClone(r):null}if(e.isLazy){const s=t.section;return s?structuredClone(s):null}return structuredClone(t)}function _x(t,e,s){if(e.isMultivariate||e.isHidden)return null;const i=px(t,e);if(!i)return null;const r=xd([Qn(i),Qn(i)]);return e.isLazy?{...t,section:r}:r}function gk(t,e,s){if(e.isHidden||e.isSavedBlock)return null;if(e.isMultivariate){const r=vd(t,e);if(!r)return null;const o=r.variants??[],a=o[o.length-1]?.value;if(!a)return null;const l=xd([...o,Qn(a)],r);return{section:mx(t,e,l),newVariantIndex:o.length}}const i=_x(t,e);return i?{section:i,newVariantIndex:1}:null}const gx=new Set(["website/pages/Page.tsx","$live/pages/LivePage.tsx"]);function vk(t){return t.anyOfRefs?.some(e=>e.resolveType!==cn?!1:e.schema?.properties?.variants?.items?.properties?.value?.type==="array")??!1}function bd(t){return!t||typeof t!="object"||Array.isArray(t)?!1:t.__resolveType===cn}function xk(t){if(!bd(t))return null;const e=t.variants;if(!Array.isArray(e))return null;const s=e[0]?.value;return Array.isArray(s)?s:null}function bk(t,e){if(!bd(t))return e;const s=structuredClone(t),i=[...s.variants??[]];return i.length===0?i.push({rule:ma(),value:e}):i[0]={...i[0],value:e},{...s,variants:i}}function vx(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;const e=t;return typeof e.__resolveType=="string"&&gx.has(e.__resolveType)&&typeof e.path=="string"}function yd(t,e){const i=t[e]?.sections;if(!i||Array.isArray(i))return 1;const r=i;return Array.isArray(r.variants)?r.variants.length:1}function xx(t,e,s){const r=t[e]?.sections;if(Array.isArray(r))return s===0?r:[];if(r&&typeof r=="object"){const o=r.variants;if(Array.isArray(o)){const a=o[s];return Array.isArray(a?.value)?a.value:[]}}return[]}function yk(t,e,s){if(Array.isArray(t))return[{label:"Default",sections:t}];if(t&&typeof t=="object"){const i=t;if(Array.isArray(i.variants)){const r=i.variants,o=r.map(h=>hx(h.rule,e,s)),a=o.reduce((h,c)=>(h[c]=(h[c]??0)+1,h),{}),l={};return r.map((h,c)=>{const d=o[c]??`Variant ${c+1}`,u=a[d]??1;let f=d;return u>1&&(l[d]=(l[d]??0)+1,f=`${d} ${l[d]}`),{label:f||`Variant ${c+1}`,sections:Array.isArray(h.value)?h.value:[],rule:h.rule}})}}return[]}function mi(t){return{rule:ma(),value:t}}function Ks(t,e){return{...e,__resolveType:cn,variants:t}}function bx(t,e){const s=structuredClone(e);if(Array.isArray(t))return Ks([mi(t),mi(s)]);if(t&&typeof t=="object"){const i=t;return Array.isArray(i.variants)?Ks([...i.variants,mi(s)],i):null}return Ks([mi([]),mi(s)])}function Sk(t){const e=t.variants;return Array.isArray(e)?e.length-1:1}function wk(t,e){if(e.length===0)return Ks([],t);if(e.length===1){const s=e[0],i=s?.rule;if(!gd(i))return Ks(e,t);if(Array.isArray(s?.value))return s.value}return Ks(e,t)}function yx(t,e){for(const[s,i]of Object.entries(t)){if(!vx(i))continue;const r=i.sections;if(Array.isArray(r)){e(void 0,s,0);continue}if(!r||typeof r!="object")continue;const o=r.variants;if(Array.isArray(o))for(let a=0;a<o.length;a++){const l=o[a];e(l?.rule,s,a)}}}function Ck(t,e,s){let i=0;return yx(t,r=>{if(!r)return;(r.__resolveType??"")===e&&Zi(r,t,s)&&i++}),i}function Cl(t,e){const s=e.replace(/\s*\(copy(?:\s+\d+)?\)\s*$/,"").trim(),i=`${s} (copy)`;if(!t.has(i))return i;for(let r=2;r<1e3;r++){const o=`${s} (copy ${r})`;if(!t.has(o))return o}return`${s} (copy ${Date.now()})`}function Sx(t,e){const s=Us,i=e.replace(/-copy(?:-\d+)?$/,""),r=`${i}-copy`;if(!t.has(s(r)))return r;for(let o=2;o<1e3;o++){const a=`${i}-copy-${o}`;if(!t.has(s(a)))return a}return`${i}-copy-${Date.now()}`}function Sd(t,e){const s=e.replace(/_copy(?:_\d+)?$/,""),i=`${s}_copy`;if(!Object.hasOwn(t,i))return i;for(let r=2;r<1e3;r++){const o=`${s}_copy_${r}`;if(!Object.hasOwn(t,o))return o}return`${s}_copy_${Date.now()}`}function wx(t){const e=ja(t.newName),s={...t.source,name:t.newName,path:t.newPath};return{key:e,data:s}}function Cx(t,e){return od(t,e)}const kx=1e3;function jx(t,e){for(let s=0;s<kx;s++){const i=ja(e);if(!Object.hasOwn(t,i))return i}throw new Error("Could not generate a unique page block key")}function Nx(t,e){const s=(t.title||t.resolveType.split("/").pop()||"").replace(/\.(tsx?|jsx?)$/,"").replace(/[^A-Za-z0-9_-]/g,""),i=/^[A-Za-z]/.test(s)&&s.length>0?s:"Section",r=Sd(e,i);return{blockKey:r,data:{__resolveType:t.resolveType,name:r}}}const Ex={create:"Create new page",duplicate:"Duplicate page",rename:"Rename page"},Tx={create:"Create",duplicate:"Duplicate",rename:"Save"},Rx={create:"Creating…",duplicate:"Duplicating…",rename:"Saving…"};function Px(t){const e=K.c(54),{open:s,mode:i,initialName:r,initialPath:o,isPending:a,error:l,validate:h,onSubmit:c,onOpenChange:d}=t,u=a===void 0?!1:a,[f,m]=E.useState(r),[p,_]=E.useState(o),[g,v]=E.useState(null),[b,x]=E.useState(s);s!==b&&(x(s),s&&(m(r),_(o),v(null)));let y;e[0]!==u||e[1]!==d?(y=H=>{!H&&!u&&(v(null),d(!1))},e[0]=u,e[1]=d,e[2]=y):y=e[2];const w=y;let k;e[3]!==u||e[4]!==f||e[5]!==c||e[6]!==p||e[7]!==h?(k=async H=>{H.preventDefault();const X=f.trim(),oe=p.trim();if(!X||!oe||u)return;const $=ga(oe);if($){v($);return}const se=h?.({name:X,path:oe});if(se){v(se);return}v(null),await c({name:X,path:oe})},e[3]=u,e[4]=f,e[5]=c,e[6]=p,e[7]=h,e[8]=k):k=e[8];const j=k,R=g??l,I=Ex[i];let P;e[9]!==I?(P=n.jsx(is,{children:n.jsx(rs,{children:I})}),e[9]=I,e[10]=P):P=e[10];let T;e[11]===Symbol.for("react.memo_cache_sentinel")?(T=n.jsx("label",{htmlFor:"page-form-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[11]=T):T=e[11];let S;e[12]===Symbol.for("react.memo_cache_sentinel")?(S=H=>m(H.target.value),e[12]=S):S=e[12];let C;e[13]!==u||e[14]!==f?(C=n.jsxs("div",{className:"space-y-1.5",children:[T,n.jsx(qe,{id:"page-form-name",value:f,onChange:S,placeholder:"My page",autoFocus:!0,disabled:u})]}),e[13]=u,e[14]=f,e[15]=C):C=e[15];let D;e[16]===Symbol.for("react.memo_cache_sentinel")?(D=n.jsx("label",{htmlFor:"page-form-path",className:"text-xs font-medium text-muted-foreground",children:"Path"}),e[16]=D):D=e[16];let N;e[17]===Symbol.for("react.memo_cache_sentinel")?(N=H=>_(H.target.value),e[17]=N):N=e[17];let A;e[18]!==u||e[19]!==p?(A=n.jsxs("div",{className:"space-y-1.5",children:[D,n.jsx(qe,{id:"page-form-path",value:p,onChange:N,placeholder:"/example",disabled:u})]}),e[18]=u,e[19]=p,e[20]=A):A=e[20];let M;e[21]!==R?(M=R&&n.jsx("p",{className:"text-xs text-destructive",children:R}),e[21]=R,e[22]=M):M=e[22];let B;e[23]!==A||e[24]!==M||e[25]!==C?(B=n.jsxs("div",{className:"space-y-4 py-4",children:[C,A,M]}),e[23]=A,e[24]=M,e[25]=C,e[26]=B):B=e[26];let L;e[27]!==d?(L=()=>d(!1),e[27]=d,e[28]=L):L=e[28];let O;e[29]!==u||e[30]!==L?(O=n.jsx(re,{type:"button",variant:"outline",onClick:L,disabled:u,children:"Cancel"}),e[29]=u,e[30]=L,e[31]=O):O=e[31];let W;e[32]!==u||e[33]!==f||e[34]!==p?(W=!f.trim()||!p.trim()||u,e[32]=u,e[33]=f,e[34]=p,e[35]=W):W=e[35];let F;e[36]!==u||e[37]!==i?(F=u?n.jsxs(n.Fragment,{children:[n.jsx(Ce,{size:14,className:"animate-spin"}),Rx[i]]}):Tx[i],e[36]=u,e[37]=i,e[38]=F):F=e[38];let V;e[39]!==W||e[40]!==F?(V=n.jsx(re,{type:"submit",disabled:W,children:F}),e[39]=W,e[40]=F,e[41]=V):V=e[41];let J;e[42]!==O||e[43]!==V?(J=n.jsxs(si,{children:[O,V]}),e[42]=O,e[43]=V,e[44]=J):J=e[44];let G;e[45]!==j||e[46]!==B||e[47]!==J||e[48]!==P?(G=n.jsx(Ot,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:j,children:[P,B,J]})}),e[45]=j,e[46]=B,e[47]=J,e[48]=P,e[49]=G):G=e[49];let U;return e[50]!==w||e[51]!==s||e[52]!==G?(U=n.jsx(Lt,{open:s,onOpenChange:w,children:G}),e[50]=w,e[51]=s,e[52]=G,e[53]=U):U=e[53],U}function Ax(t){const e=K.c(43),{open:s,blockKey:i,initialName:r,isPending:o,onSubmit:a,onOpenChange:l}=t,h=o===void 0?!1:o,[c,d]=E.useState(r),[u,f]=E.useState(s);s!==u&&(f(s),s&&d(r));let m;e[0]!==h||e[1]!==l?(m=A=>{!A&&!h&&l(!1)},e[0]=h,e[1]=l,e[2]=m):m=e[2];const p=m;let _;e[3]!==h||e[4]!==c||e[5]!==a?(_=async A=>{A.preventDefault();const M=c.trim();!M||h||await a(M)},e[3]=h,e[4]=c,e[5]=a,e[6]=_):_=e[6];const g=_;let v;e[7]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsxs(is,{children:[n.jsx(rs,{children:"Rename section"}),n.jsx(Jo,{children:"Updates the display name. The internal key stays the same so pages referencing this section keep working."})]}),e[7]=v):v=e[7];let b;e[8]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx("label",{htmlFor:"section-rename-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[8]=b):b=e[8];let x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=A=>d(A.target.value),e[9]=x):x=e[9];let y;e[10]!==h||e[11]!==c?(y=n.jsxs("div",{className:"space-y-1.5",children:[b,n.jsx(qe,{id:"section-rename-name",value:c,onChange:x,autoFocus:!0,disabled:h})]}),e[10]=h,e[11]=c,e[12]=y):y=e[12];let w;e[13]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Key"}),e[13]=w):w=e[13];let k;e[14]!==i?(k=n.jsxs("div",{className:"space-y-1.5",children:[w,n.jsx(qe,{value:i,readOnly:!0,disabled:!0,className:"font-mono"})]}),e[14]=i,e[15]=k):k=e[15];let j;e[16]!==y||e[17]!==k?(j=n.jsxs("div",{className:"space-y-4 py-4",children:[y,k]}),e[16]=y,e[17]=k,e[18]=j):j=e[18];let R;e[19]!==l?(R=()=>l(!1),e[19]=l,e[20]=R):R=e[20];let I;e[21]!==h||e[22]!==R?(I=n.jsx(re,{type:"button",variant:"outline",onClick:R,disabled:h,children:"Cancel"}),e[21]=h,e[22]=R,e[23]=I):I=e[23];let P;e[24]!==h||e[25]!==c?(P=!c.trim()||h,e[24]=h,e[25]=c,e[26]=P):P=e[26];let T;e[27]!==h?(T=h?n.jsxs(n.Fragment,{children:[n.jsx(Ce,{size:14,className:"animate-spin"}),"Saving…"]}):"Save",e[27]=h,e[28]=T):T=e[28];let S;e[29]!==P||e[30]!==T?(S=n.jsx(re,{type:"submit",disabled:P,children:T}),e[29]=P,e[30]=T,e[31]=S):S=e[31];let C;e[32]!==I||e[33]!==S?(C=n.jsxs(si,{children:[I,S]}),e[32]=I,e[33]=S,e[34]=C):C=e[34];let D;e[35]!==g||e[36]!==j||e[37]!==C?(D=n.jsx(Ot,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:g,children:[v,j,C]})}),e[35]=g,e[36]=j,e[37]=C,e[38]=D):D=e[38];let N;return e[39]!==p||e[40]!==s||e[41]!==D?(N=n.jsx(Lt,{open:s,onOpenChange:p,children:D}),e[39]=p,e[40]=s,e[41]=D,e[42]=N):N=e[42],N}const jn={post:"blog/loaders/Blogpost.ts",author:"blog/loaders/Author.ts",category:"blog/loaders/Category.ts"},Dx="blog/sections/blocks/",Ea=["posts","authors","categories"],Ai={posts:"post",authors:"author",categories:"category"};function Di(t){return Ea.includes(t)}const Ta={posts:"post",authors:"author",categories:"category"},wd={posts:jn.post,authors:jn.author,categories:jn.category},Ix=Object.fromEntries(Object.entries(wd).map(([t,e])=>[e,t]));function Bx(t){return typeof t=="string"?Ix[t]??null:null}function Kr(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function $s(t){return typeof t=="string"?t:""}function Mx(t,e){switch(t){case"posts":return{label:$s(e.title)||"Untitled post",subtitle:$s(e.slug)};case"authors":return{label:$s(e.name)||"Unnamed author",subtitle:$s(e.email)};case"categories":return{label:$s(e.name)||"Unnamed category",subtitle:$s(e.slug)};default:{const s=t;throw new Error(`Unhandled blog kind: ${String(s)}`)}}}function Cd(t){const e={posts:[],authors:[],categories:[]};for(const[s,i]of Object.entries(t)){const r=Kr(i);if(!r)continue;const o=Bx(r.__resolveType);if(!o)continue;const a=Kr(r[Ta[o]])??{},{label:l,subtitle:h}=Mx(o,a);e[o].push({key:s,kind:o,label:l,subtitle:h})}for(const s of Ea)e[s].sort((i,r)=>i.label.localeCompare(r.label));return e}function Lx(t,e){return Cd(t)[e]}function kk(t,e){return Lx(t,e).map(s=>({key:s.key,payload:kd(Kr(t[s.key])??void 0,e)}))}function kd(t,e){return t?Kr(t[Ta[e]])??{}:{}}function kl(t,e,s){return{name:t,__resolveType:wd[e],[Ta[e]]:s}}function jd(t){return`.deco/blocks/${encodeURIComponent(t)}.json`}function eo(t){const e=new Uint8Array(Math.ceil(t/2));return crypto.getRandomValues(e),Array.from(e,s=>s.toString(16).padStart(2,"0")).join("").slice(0,t)}function jl(t,e){const s=`collections/blog/${e}/${eo(12)}`;if(!Object.hasOwn(t,s))return s;throw new Error("Could not generate a unique blog block key")}function Ox(t){switch(t){case"posts":return{title:"Untitled post",excerpt:"",slug:`untitled-${eo(8)}`,date:new Date().toISOString().slice(0,10),image:"",authors:[],categories:[],sections:[]};case"authors":return{name:"New author",email:"",jobTitle:"",company:"",avatar:""};case"categories":return{name:"New category",slug:`category-${eo(8)}`};default:{const e=t;throw new Error(`Unhandled blog kind: ${String(e)}`)}}}function jk(t){const e=new Set,s=[],i=t.manifest?.blocks??{};for(const r of Object.values(i))for(const o of Object.keys(r)){if(!o.startsWith(Dx)||e.has(o))continue;e.add(o);const a=ni(o,t);s.push({resolveType:o,title:a.title??$x(o),description:a.description,icon:a.icon})}return s.sort((r,o)=>r.title.localeCompare(o.title))}function $x(t){return(t.split("/").pop()??t).replace(/\.(tsx?|jsx?)$/,"")}const zx=["blog/sections/blocks/","site/sections/Blog/Post/"];function Nk(t){return zx.some(e=>t.startsWith(e))}function Nd({orgSlug:t,virtualMcpId:e,branch:s}){return Bt.decofile(`${t}/${e}/${s}`)}function Ed({orgSlug:t,virtualMcpId:e,branch:s},i){return`/api/${t}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(s)}/${i}`}function Fx(t){const e=K.c(11),s=Qs();let i;e[0]!==t?(i=async l=>{const{blockKey:h,data:c}=l,d=await fetch(Ed(t,"write"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:jd(h),content:JSON.stringify(c,null,2)})});if(!d.ok){const u=await d.json().catch(Hx);throw new Error(u.error??`Write failed (${d.status})`)}return d.json()},e[0]=t,e[1]=i):i=e[1];let r;e[2]!==t||e[3]!==s?(r=async l=>{const{blockKey:h,data:c}=l,d=Nd(t);await s.cancelQueries({queryKey:d});const u=s.getQueryData(d);return s.setQueryData(d,f=>({...f??{},[h]:c})),{previous:u,queryKey:d}},e[2]=t,e[3]=s,e[4]=r):r=e[4];let o;e[5]!==s?(o=(l,h,c)=>{c?.queryKey&&s.setQueryData(c.queryKey,c.previous)},e[5]=s,e[6]=o):o=e[6];let a;return e[7]!==i||e[8]!==r||e[9]!==o?(a={mutationFn:i,onMutate:r,onError:o},e[7]=i,e[8]=r,e[9]=o,e[10]=a):a=e[10],ei(a)}function Hx(){return{}}function Wx(t){const e=Qs();return ei({mutationFn:async({blockKey:s})=>{const i=await fetch(Ed(t,"unlink"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:jd(s)})});if(!i.ok){const r=await i.json().catch(()=>({}));throw new Error(r.error??`Delete failed (${i.status})`)}return i.json()},onMutate:async({blockKey:s})=>{const i=Nd(t);await e.cancelQueries({queryKey:i});const r=e.getQueryData(i);return e.setQueryData(i,o=>{if(!o)return o;const{[s]:a,...l}=o;return l}),{previous:r,queryKey:i}},onError:(s,i,r)=>{r?.queryKey&&e.setQueryData(r.queryKey,r.previous)}})}function Ux(t){const e=K.c(20),{open:s,onOpenChange:i,pageKey:r,decofile:o}=t,[a,l]=E.useState(!1),h=o[r];let c;e[0]!==h?(c=h===void 0?"// Page not found.":JSON.stringify(h,null,2),e[0]=h,e[1]=c):c=e[1];const d=c;let u;e[2]!==d?(u=()=>{navigator.clipboard.writeText(d).then(()=>{l(!0),setTimeout(()=>l(!1),2e3)})},e[2]=d,e[3]=u):u=e[3];const f=u;let m;e[4]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(rs,{className:"text-sm font-semibold",children:"Page JSON"}),e[4]=m):m=e[4];let p;e[5]!==a?(p=a?n.jsx(zc,{size:12}):n.jsx(Qt,{size:12}),e[5]=a,e[6]=p):p=e[6];const _=a?"Copied":"Copy";let g;e[7]!==f||e[8]!==p||e[9]!==_?(g=n.jsxs(is,{className:"px-4 py-3 border-b flex-row items-center justify-between space-y-0",children:[m,n.jsxs(re,{variant:"ghost",size:"sm",onClick:f,className:"h-7 gap-1.5 text-xs",children:[p,_]})]}),e[7]=f,e[8]=p,e[9]=_,e[10]=g):g=e[10];let v;e[11]!==d?(v=n.jsx(an,{className:"max-h-[70vh]",children:n.jsx("pre",{className:"p-4 text-xs font-mono text-foreground/90 whitespace-pre overflow-auto",children:d})}),e[11]=d,e[12]=v):v=e[12];let b;e[13]!==g||e[14]!==v?(b=n.jsxs(Ot,{className:"max-w-2xl p-0 gap-0",children:[g,v]}),e[13]=g,e[14]=v,e[15]=b):b=e[15];let x;return e[16]!==i||e[17]!==s||e[18]!==b?(x=n.jsx(Lt,{open:s,onOpenChange:i,children:b}),e[16]=i,e[17]=s,e[18]=b,e[19]=x):x=e[19],x}const Nl=E.lazy(()=>qt(()=>import("./app-editor-BUZUhvgy.js"),__vite__mapDeps([158,1,2,4,46,47,48,16,3,5,91,6,7,8,9,10,11,12,13,14,15,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,49,50,92,93,94,58,59,95,96,97,57,79,60,98,99,100,101,102,103,104,78,105,106,107,108,109,67,110,56,111,72,73,112,71,68,86,113,52,53,54,55,61,62,63,64,65,66,69,70,74,75,76,77,114,115,116,85,117,118,82,89,90,119,51,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,83,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,80,81,84,87,159])).then(t=>({default:t.AppEditor}))),Kx=E.lazy(()=>qt(()=>import("./post-editor-DIXAxF5l.js"),__vite__mapDeps([160,1,2,3,6,7,8,9,10,11,12,13,14,15,16,17,4,5,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,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,49,71,48,72,73,50,47,74,75,76,77,78,79,98,99,100,46,101,102,103,104,93,94,95,96,97,105,106,107,108,109,110,111,112,151,123,152,134,153,130,132,149,116,89,90,82,84,51,85,86,87,80,81,83,161,159,92,113,114,115,117,118,119,120,121,122,124,125,126,127,128,129,131,133,135,136,137,138,139,140,141,142,143,144,145,146,147,148,150,154])).then(t=>({default:t.PostEditor}))),Vx=E.lazy(()=>qt(()=>import("./record-editor-CdXt0BJy.js"),__vite__mapDeps([162,1,2,50,73,74,84,8,39,40,7,16,20,18,6,9,10,11,12,13,14,15,3,17,4,5,19,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,41,42,43,44,45,49,51,85,86,87,78,61,62,161,159,92,93,94,58,59,95,96,97,57,79,60,98,99,100,46,47,48,101,102,103,104,105,106,107,108,109,67,110,56,111,72,112,71,68,113,52,53,54,55,63,64,65,66,69,70,75,76,77,114,115,116,117,118,82,89,90,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,83,141,142,143,144,145,146,147,148,149,150,151,152,153,154])).then(t=>({default:t.RecordEditor}))),qx=E.lazy(()=>qt(()=>import("./sections-editor-DbBhsr7i.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,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155])).then(t=>({default:t.SectionsEditor}))),Gx=E.lazy(()=>qt(()=>import("./seo-editor-GccXSXxy.js"),__vite__mapDeps([163,1,2,4,6,7,8,9,10,11,12,13,14,15,16,3,17,5,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,48,88,73,83,80,81,50,82,74,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,49,71,72,75,76,77,78,79,51,84,85,86,87,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,89,90,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154])).then(t=>({default:t.SeoEditor}))),Yx=E.lazy(()=>qt(()=>import("./add-section-modal-D5ohv1eA.js"),__vite__mapDeps([91,1,2,6,7,8,9,10,11,12,13,14,15,16,3,17,4,5,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,49,50,92,93,94,58,59,95,96,97,57,79,60,98,99,100,46,47,48,101,102,103,104,78,105,106,107,108,109,67,110,56,111,72,73,112,71,68,86,113,52,53,54,55,61,62,63,64,65,66,69,70,74,75,76,77,114,115,116,85,117,118,82,89,90,119,51,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,83,141,142,143,144,145,146,147,148,149,150,151,152,153,154])).then(t=>({default:t.AddSectionModal}))),to="oklch(0.65 0.15 160)";function Xx(){const t=K.c(18),e=ir(),{data:s}=Js.useSession(),{currentBranch:i}=ss(),{org:r}=Pe(),o=e?.entity?.id??null,a=s?.user?.id,l=e?.entity?.metadata,h=a&&i?Qr(l?.sandboxMap?.[a]?.[i]):{},c=Object.values(h),u=(c.find(Jx)??c[0])?.previewUrl??null,f=Yt(),m=e?.entity?.organization_id??"";let p;t[0]!==r.slug||t[1]!==m?(p={connectionId:Wo,orgId:m,orgSlug:r.slug},t[0]=r.slug,t[1]=m,t[2]=p):p=t[2];const _=ft(p),g=Fo(_);let v;t[3]!==i||t[4]!==g||t[5]!==o?(v=()=>{if(!o)return;const k={virtualMcpId:o};i&&(k.branch=i),g.mutate(k)},t[3]=i,t[4]=g,t[5]=o,t[6]=v):v=t[6];const b=v,x=!!o&&!!i&&Hn.isStopped(o,i),y=td({previewUrl:u,appPaused:f.status.state==="paused",userStopped:x});if(y.kind!=="iframe"){let k;return t[7]!==y||t[8]!==b||t[9]!==f.lifecycle||t[10]!==f.phase?(k=n.jsx(ib,{state:y,claimPhase:f.phase,lifecycle:f.lifecycle,onStart:b}),t[7]=y,t[8]=b,t[9]=f.lifecycle,t[10]=f.phase,t[11]=k):k=t[11],k}if(!o||!i){let k;return t[12]===Symbol.for("react.memo_cache_sentinel")?(k=n.jsx(Ci,{title:"Waiting for sandbox context…"}),t[12]=k):k=t[12],k}let w;return t[13]!==i||t[14]!==r.slug||t[15]!==u||t[16]!==o?(w=n.jsx(Qx,{orgSlug:r.slug,virtualMcpId:o,branch:i,previewUrl:u}),t[13]=i,t[14]=r.slug,t[15]=u,t[16]=o,t[17]=w):w=t[17],w}function Jx(t){return t.sandboxProviderKind!=="user-desktop"}const El=2e3,Zx=15;function Tl(t,e,s,i){return typeof e!="string"||s&&(dd(e,s,i)||t.state.dataUpdateCount>=Zx)?!1:El}function Qx({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:i}){const r={orgSlug:t,virtualMcpId:e,branch:s},{data:o,isLoading:a}=ha(r),[l,h]=E.useState("pages"),[c,d]=E.useState(null),[u,f]=E.useState(null),[m,p]=E.useState(""),[_,g]=E.useState(l);_!==l&&(g(l),p(""));const{data:v,isLoading:b,isFetching:x}=da(r,{refetchInterval:Y=>{const _e=Y.state.data;if(l==="apps"&&c&&c.collection==="apps"){const xe=o?.[c.key];return Tl(Y,typeof xe?.__resolveType=="string"?xe.__resolveType:void 0,_e)}if(l==="site"&&o){const xe=_e?Zn(o,_e):null,Se=o.site,we=xe?.resolveType??(typeof Se?.__resolveType=="string"?Se.__resolveType:void 0);return Tl(Y,we,_e,["seo"])}return!1}}),y=(Y,_e)=>!dd(Y,v,_e)&&(b||x),{catalog:w,isLoading:k}=nx(v??void 0,o??void 0,{enabled:l==="apps"}),j=Na(r),R=X1(r),I=Fx(r),P=Wx(r),[T,S]=E.useState(null),[C,D]=E.useState(),[N,A]=E.useState(!1),[M,B]=E.useState(null),[L,O]=E.useState(null),[W,F]=E.useState(null);if(a||b)return n.jsx("div",{className:"h-full w-full flex items-center justify-center",children:n.jsx(Ce,{size:20,className:"animate-spin text-muted-foreground"})});if(!o||!v)return n.jsx(Ci,{title:"Could not load site data."});const V=ya(o).sort((Y,_e)=>Y.name.localeCompare(_e.name)),J=Sa(o,v),G=Zn(o,v),U=Cd(o),H=Ea.some(Y=>U[Y].length>0),X=Di(l)?U[l]:[];if(!ba(o,v)&&!H)return n.jsx(Ci,{icon:Ki,title:"No editable content",description:"This project doesn't expose any Deco pages, sections, or apps."});const oe={pages:V.length,sections:J.length,apps:w.length,posts:U.posts.length,authors:U.authors.length,categories:U.categories.length},$=new Set(V.map(Y=>Us(Y.path))),se=new Set(V.map(Y=>Y.name)),ee=new Set(J.map(Y=>Y.name)),Q=async Y=>{const _e=o[Y.key];if(!_e)return;const xe=yd(o,Y.key),Se=xx(o,Y.key,Math.max(0,xe-1)),we=bx(_e.sections,Se);if(we)try{await j.mutateAsync({blockKey:Y.key,data:{..._e,sections:we}}),le.success(`Variant added to "${Y.name}"`),d({collection:"pages",key:Y.key,path:Y.path})}catch(dt){le.error(dt instanceof Error?dt.message:"Could not add variant")}},z=()=>{D(void 0),S({mode:"create",sourceKey:null,initialName:"My new page",initialPath:"/example"})},ce=Y=>{D(void 0),S({mode:"duplicate",sourceKey:Y.key,initialName:Cl(se,Y.name),initialPath:Sx($,Y.path)})},ue=Y=>{D(void 0),S({mode:"rename",sourceKey:Y.key,initialName:Y.name,initialPath:Y.path})},fe=async Y=>{if(!T)return;const{mode:_e,sourceKey:xe}=T;try{if(_e==="create"){const Se=Cx(Y.name,Y.path),we=jx(o,Y.name);await j.mutateAsync({blockKey:we,data:Se}),le.success(`Created "${Y.name}"`),d({collection:"pages",key:we,path:Y.path})}else if(_e==="duplicate"&&xe){const Se=o[xe];if(!Se)throw new Error("Source page not found");const{key:we,data:dt}=wx({source:Se,pages:V,newName:Y.name,newPath:Y.path});await j.mutateAsync({blockKey:we,data:dt}),le.success(`Duplicated as "${Y.name}"`),d({collection:"pages",key:we,path:Y.path})}else if(_e==="rename"&&xe){const Se=o[xe];if(!Se)throw new Error("Page not found");const we={...Se,name:Y.name,path:Y.path};await j.mutateAsync({blockKey:xe,data:we}),le.success("Page updated"),c?.collection==="pages"&&c.key===xe&&d({collection:"pages",key:xe,path:Y.path})}S(null)}catch(Se){D(Se instanceof Error?Se.message:"Save failed")}},q=({path:Y})=>{if(!T)return null;const _e=Us(Y);return(T.mode==="rename"?Us(T.initialPath):null)!==_e&&$.has(_e)?`A page with path "${Y}" already exists.`:null},te=async Y=>{const{blockKey:_e,data:xe}=Nx(Y,o);try{await j.mutateAsync({blockKey:_e,data:xe}),le.success(`Created section "${_e}"`),A(!1),d({collection:"sections",key:_e})}catch(Se){le.error(Se instanceof Error?Se.message:"Could not create section")}},me=async Y=>{const _e=o[Y.key];if(!_e){le.error("Section not found.");return}const xe=Sd(o,Y.key),Se=Cl(ee,Y.name),we={..._e,name:Se};try{await j.mutateAsync({blockKey:xe,data:we}),le.success(`Duplicated "${Y.name}"`),d({collection:"sections",key:xe})}catch(dt){le.error(dt instanceof Error?dt.message:"Duplicate failed")}},ne=async Y=>{if(!M)return;const _e=o[M];if(!_e){le.error("Section not found.");return}try{await j.mutateAsync({blockKey:M,data:{..._e,name:Y}}),le.success("Section renamed"),B(null)}catch(xe){le.error(xe instanceof Error?xe.message:"Rename failed")}},ke=async Y=>{const _e=jl(o,Y),xe=kl(_e,Y,Ox(Y));try{await I.mutateAsync({blockKey:_e,data:xe}),le.success(`Created ${Ai[Y]}`),d({collection:Y,key:_e})}catch(Se){le.error(Se instanceof Error?Se.message:"Could not create")}},ot=async Y=>{const _e=o[Y.key];if(!_e){le.error("Record not found.");return}const xe=jl(o,Y.kind),Se=Y.kind==="posts"?"title":"name",we={...structuredClone(kd(_e,Y.kind)),[Se]:`${Y.label} (copy)`};try{await I.mutateAsync({blockKey:xe,data:kl(xe,Y.kind,we)}),le.success(`Duplicated "${Y.label}"`),d({collection:Y.kind,key:xe})}catch(dt){le.error(dt instanceof Error?dt.message:"Duplicate failed")}},Be=async()=>{if(!L)return;const{kind:Y,key:_e,label:xe}=L;try{Y==="blog"?await P.mutateAsync({blockKey:_e}):await R.mutateAsync({blockKey:_e}),le.success(`Deleted "${xe}"`),c&&c.key===_e&&d(null),O(null)}catch(Se){le.error(Se instanceof Error?Se.message:"Delete failed")}},mt=R.isPending||P.isPending,as=L?.kind==="blog"?Ai[L.blogKind]:L?.kind??"item";return n.jsxs("div",{className:"flex h-full w-full",children:[n.jsx(eb,{active:l,counts:oe,showBlog:H,onSelect:Y=>{h(Y),d(null),f(null)}}),l!=="seo"&&l!=="site"&&n.jsx(tb,{activeCollection:l,pages:V,sections:J,appCatalog:w,appCatalogLoading:k,blogEntries:X,decofile:o,searchQuery:m,onSearchChange:p,selection:c,onSelect:Y=>{d(Y),f(null)},previewUrl:i,onCreate:()=>{l==="pages"?z():Di(l)?ke(l):i?A(!0):le.error("Start the preview dev server to add sections.")},onDuplicatePage:ce,onRenamePage:ue,onAddPageVariant:Q,onDeletePage:Y=>O({kind:"page",key:Y.key,label:Y.name}),onEditPageSeo:Y=>{d({collection:"pages",key:Y.key,path:Y.path}),f(Y.key)},onViewPageJson:Y=>F(Y.key),onDuplicateSection:me,onRenameSection:Y=>B(Y.key),onDeleteSection:Y=>O({kind:"section",key:Y.key,label:Y.name}),onDuplicateBlog:ot,onDeleteBlog:Y=>O({kind:"blog",blogKind:Y.kind,key:Y.key,label:Y.label})}),n.jsx("div",{className:"flex-1 min-w-0",children:n.jsx(E.Suspense,{fallback:n.jsx("div",{className:"h-full flex items-center justify-center",children:n.jsx(Ce,{size:20,className:"animate-spin text-muted-foreground"})}),children:l==="site"?G?n.jsx(Nl,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:G.key,block:o[G.key],decofile:o,meta:v,title:"Site",excludeFields:["seo"],schemaPending:y(G.resolveType,["seo"]),previewBaseUrl:i},`site:${G.key}`):n.jsx(Ci,{title:"Site settings not found",description:"This project doesn't have a site app block (site/apps/site.ts)."}):l==="seo"?n.jsx(Gx,{orgSlug:t,virtualMcpId:e,branch:s,decofile:o,meta:v,target:{kind:"site"},previewBaseUrl:i}):c?c.collection==="apps"?n.jsx(Nl,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:c.key,block:o[c.key],decofile:o,meta:v,previewBaseUrl:i,schemaPending:y(typeof o[c.key]?.__resolveType=="string"?String(o[c.key].__resolveType):void 0)},`app:${c.key}`):c.collection==="posts"?n.jsx(Kx,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:c.key,block:o[c.key],decofile:o,meta:v},`post:${c.key}`):c.collection==="authors"||c.collection==="categories"?n.jsx(Vx,{orgSlug:t,virtualMcpId:e,branch:s,kind:c.collection,blockKey:c.key,block:o[c.key]},`${c.collection}:${c.key}`):n.jsx(qx,{orgSlug:t,virtualMcpId:e,branch:s,previewReady:!0,previewUrl:i??void 0,currentPath:c.collection==="pages"?c.path:"/",activePageBlockKey:c.collection==="pages"?c.key:null,activeGlobalBlockKey:c.collection==="sections"?c.key:null,initialEditSeo:c.collection==="pages"&&u===c.key,onExitSeo:()=>f(null)},c.collection==="pages"?`page:${c.key}`:`section:${c.key}`):n.jsx(Ci,{title:`Select ${Di(l)?`a ${Ai[l]}`:l==="pages"?"a page":l==="apps"?"an app":"a section"} to edit`,description:l==="apps"?"Browse all apps and select an installed one to edit its settings.":'Pick an item from the list, or click "+" to create one.'})})}),T&&n.jsx(Px,{open:!!T,mode:T.mode,initialName:T.initialName,initialPath:T.initialPath,isPending:j.isPending,error:C,validate:q,onSubmit:fe,onOpenChange:Y=>{Y||(S(null),D(void 0))}}),M&&n.jsx(Ax,{open:!!M,blockKey:M,initialName:J.find(Y=>Y.key===M)?.name??M,isPending:j.isPending,onSubmit:ne,onOpenChange:Y=>{Y||B(null)}}),N&&i&&n.jsx(E.Suspense,{fallback:null,children:n.jsx(Yx,{open:N,onOpenChange:A,meta:v,decofile:o,previewBaseUrl:i,onSelect:te})}),W&&n.jsx(Ux,{open:!!W,onOpenChange:Y=>{Y||F(null)},pageKey:W,decofile:o}),n.jsx(Rr,{open:!!L,onOpenChange:Y=>{!Y&&!mt&&O(null)},children:n.jsxs(Pr,{children:[n.jsxs(Ar,{children:[n.jsx(Dr,{children:`Delete ${as}?`}),n.jsx(Ir,{children:L?.kind==="section"?`"${L.label}" will be removed. Pages that still reference it will lose this section.`:L?`"${L.label}" will be removed permanently. This can't be undone.`:null})]}),n.jsxs(Br,{children:[n.jsx(Mr,{disabled:mt,children:"Cancel"}),n.jsx(Lr,{onClick:Y=>{Y.preventDefault(),Be()},disabled:mt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:mt?n.jsxs(n.Fragment,{children:[n.jsx(Ce,{size:14,className:"animate-spin"}),"Deleting…"]}):"Delete"})]})]})})]})}function eb(t){const e=K.c(33),{active:s,counts:i,showBlog:r,onSelect:o}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx("div",{className:"px-3 h-12 flex items-center border-b shrink-0",children:n.jsx("span",{className:"text-sm font-medium",children:"Content"})}),e[0]=a):a=e[0];const l=s==="pages";let h;e[1]!==i.pages||e[2]!==o||e[3]!==l?(h=n.jsx(ls,{id:"pages",icon:Vo,label:"Pages",count:i.pages,active:l,onSelect:o}),e[1]=i.pages,e[2]=o,e[3]=l,e[4]=h):h=e[4];const c=s==="sections";let d;e[5]!==i.sections||e[6]!==o||e[7]!==c?(d=n.jsx(ls,{id:"sections",icon:Gs,label:"Sections",count:i.sections,active:c,onSelect:o}),e[5]=i.sections,e[6]=o,e[7]=c,e[8]=d):d=e[8];const u=s==="apps";let f;e[9]!==i.apps||e[10]!==o||e[11]!==u?(f=n.jsx(ls,{id:"apps",icon:ph,label:"Apps",count:i.apps,active:u,onSelect:o}),e[9]=i.apps,e[10]=o,e[11]=u,e[12]=f):f=e[12];let m;e[13]!==s||e[14]!==i.authors||e[15]!==i.categories||e[16]!==i.posts||e[17]!==o||e[18]!==r?(m=r&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"mt-3 flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-medium text-muted-foreground/70",children:[n.jsx(mh,{size:13,className:"shrink-0"}),"Blog"]}),n.jsx(ls,{id:"posts",icon:qc,label:"Posts",count:i.posts,active:s==="posts",onSelect:o}),n.jsx(ls,{id:"authors",icon:ta,label:"Authors",count:i.authors,active:s==="authors",onSelect:o}),n.jsx(ls,{id:"categories",icon:Gc,label:"Categories",count:i.categories,active:s==="categories",onSelect:o})]}),e[13]=s,e[14]=i.authors,e[15]=i.categories,e[16]=i.posts,e[17]=o,e[18]=r,e[19]=m):m=e[19];const p=s==="site";let _;e[20]!==o||e[21]!==p?(_=n.jsx(ls,{id:"site",icon:Gf,label:"Site",active:p,onSelect:o}),e[20]=o,e[21]=p,e[22]=_):_=e[22];const g=s==="seo";let v;e[23]!==o||e[24]!==g?(v=n.jsx(ls,{id:"seo",icon:Nr,label:"SEO",active:g,onSelect:o}),e[23]=o,e[24]=g,e[25]=v):v=e[25];let b;return e[26]!==_||e[27]!==v||e[28]!==h||e[29]!==d||e[30]!==f||e[31]!==m?(b=n.jsxs("div",{className:"w-[208px] shrink-0 border-r flex flex-col",children:[a,n.jsxs("nav",{className:"flex flex-col p-1.5 gap-0.5",children:[h,d,f,m,_,v]})]}),e[26]=_,e[27]=v,e[28]=h,e[29]=d,e[30]=f,e[31]=m,e[32]=b):b=e[32],b}function ls(t){const e=K.c(18),{id:s,icon:i,label:r,count:o,active:a,onSelect:l}=t;let h;e[0]!==s||e[1]!==l?(h=()=>l(s),e[0]=s,e[1]=l,e[2]=h):h=e[2];const c=a?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground";let d;e[3]!==c?(d=he("flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm transition-colors cursor-pointer",c),e[3]=c,e[4]=d):d=e[4];let u;e[5]!==i?(u=n.jsx(i,{size:16,className:"shrink-0"}),e[5]=i,e[6]=u):u=e[6];let f;e[7]!==r?(f=n.jsx("span",{className:"flex-1 truncate",children:r}),e[7]=r,e[8]=f):f=e[8];let m;e[9]!==a||e[10]!==o?(m=o!==void 0&&n.jsx("span",{className:he("shrink-0 text-xs tabular-nums",a?"text-accent-foreground/70":"text-muted-foreground/70"),children:o}),e[9]=a,e[10]=o,e[11]=m):m=e[11];let p;return e[12]!==h||e[13]!==d||e[14]!==u||e[15]!==f||e[16]!==m?(p=n.jsxs("button",{type:"button",onClick:h,className:d,children:[u,f,m]}),e[12]=h,e[13]=d,e[14]=u,e[15]=f,e[16]=m,e[17]=p):p=e[17],p}function tb(t){const e=K.c(57),{activeCollection:s,pages:i,sections:r,appCatalog:o,appCatalogLoading:a,blogEntries:l,decofile:h,previewUrl:c,searchQuery:d,onSearchChange:u,selection:f,onSelect:m,onCreate:p,onDuplicatePage:_,onRenamePage:g,onAddPageVariant:v,onDeletePage:b,onEditPageSeo:x,onViewPageJson:y,onDuplicateSection:w,onRenameSection:k,onDeleteSection:j,onDuplicateBlog:R,onDeleteBlog:I}=t;let P,T,S,C,D,N;if(e[0]!==s||e[1]!==o||e[2]!==a||e[3]!==l||e[4]!==h||e[5]!==v||e[6]!==p||e[7]!==I||e[8]!==b||e[9]!==j||e[10]!==R||e[11]!==_||e[12]!==w||e[13]!==x||e[14]!==g||e[15]!==k||e[16]!==u||e[17]!==m||e[18]!==y||e[19]!==i||e[20]!==c||e[21]!==d||e[22]!==r||e[23]!==f){const L=d.toLowerCase(),O=i.filter(z=>!L||z.name.toLowerCase().includes(L)||z.path.toLowerCase().includes(L)),W=r.filter(z=>!L||z.name.toLowerCase().includes(L)||z.key.toLowerCase().includes(L)||z.resolveType.toLowerCase().includes(L)),F=o.filter(z=>!L||z.title.toLowerCase().includes(L)||z.app.toLowerCase().includes(L)||z.vendor.toLowerCase().includes(L)||z.category.toLowerCase().includes(L)),V=l.filter(z=>!L||z.label.toLowerCase().includes(L)||z.subtitle.toLowerCase().includes(L)),J=`Search ${s}…`,G=Di(s)?`Create new ${Ai[s]}`:s==="pages"?"Create new page":"Create new section",U=s==="sections"&&!c,H=s!=="apps",X=U,oe=U?"Start the preview dev server to add sections":void 0;D="w-[300px] shrink-0 border-r flex flex-col min-h-0";let $;e[30]===Symbol.for("react.memo_cache_sentinel")?($=n.jsx(fh,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[30]=$):$=e[30];let se;e[31]!==u?(se=z=>u(z.target.value),e[31]=u,e[32]=se):se=e[32];let ee;e[33]!==J||e[34]!==d||e[35]!==se?(ee=n.jsxs("div",{className:"flex flex-1 items-center gap-2 pl-1",children:[$,n.jsx("input",{type:"text",value:d,onChange:se,placeholder:J,"aria-label":J,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[33]=J,e[34]=d,e[35]=se,e[36]=ee):ee=e[36];let Q;e[37]!==X||e[38]!==oe||e[39]!==G||e[40]!==p||e[41]!==H?(Q=H&&n.jsxs(Re,{children:[n.jsx(Ee,{asChild:!0,children:n.jsx(re,{variant:"ghost",size:"icon",onClick:p,disabled:X,"aria-label":G,"aria-disabled":X,children:n.jsx(xt,{size:14})})}),n.jsx(Te,{side:"bottom",children:oe??G})]}),e[37]=X,e[38]=oe,e[39]=G,e[40]=p,e[41]=H,e[42]=Q):Q=e[42],e[43]!==ee||e[44]!==Q?(N=n.jsxs("div",{className:"px-2 h-12 flex items-center gap-1 border-b shrink-0",children:[ee,Q]}),e[43]=ee,e[44]=Q,e[45]=N):N=e[45],P=an,C="flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",T="flex flex-col gap-1 p-1.5",S=s==="pages"?O.length===0?n.jsx(hr,{hasItems:i.length>0,emptyLabel:"No pages yet.",emptyHint:'Click "+" to create your first page.'}):O.map(z=>{const ce=f?.collection==="pages"&&f.key===z.key,ue=yd(h,z.key);return n.jsx(cr,{icon:Vo,title:z.name,subtitle:z.path,active:ce,variantCount:ue,onClick:()=>m({collection:"pages",key:z.key,path:z.path}),menu:n.jsx(Nn,{onDuplicate:()=>_(z),onRename:()=>g(z),onAddVariant:()=>v(z),onEditSeo:()=>x(z),onViewJson:()=>y(z),onDelete:()=>b(z)})},z.key)}):s==="sections"?W.length===0?n.jsx(hr,{hasItems:r.length>0,emptyLabel:"No saved sections yet.",emptyHint:'Click "+" to create one, or save a section from a page.'}):W.map(z=>{const ce=f?.collection==="sections"&&f.key===z.key,ue=z.resolveType.split("/").pop()?.replace(/\.tsx?$/,"");return n.jsx(cr,{icon:Gs,title:z.name,subtitle:ue??z.resolveType,active:ce,onClick:()=>m({collection:"sections",key:z.key}),menu:n.jsx(Nn,{onDuplicate:()=>w(z),onRename:()=>k(z),onDelete:()=>j(z)})},z.key)}):s==="apps"?a?n.jsx("div",{className:"flex items-center justify-center py-8",children:n.jsx(Ce,{size:18,className:"animate-spin text-muted-foreground"})}):F.length===0?n.jsx(hr,{hasItems:o.length>0,emptyLabel:"No apps found.",emptyHint:"Try a different search term."}):F.map(z=>{const ce=f?.collection==="apps"&&z.blockKey!==null&&f.key===z.blockKey;return n.jsx(cr,{icon:ph,logoUrl:z.logo,title:z.title,subtitle:z.category,active:ce,trailing:z.installed?n.jsx("span",{className:"shrink-0 rounded-full bg-emerald-500/15 px-1.5 py-0.5 text-[10px] font-medium text-emerald-700 dark:text-emerald-400",children:"Installed"}):void 0,onClick:()=>{if(!z.installed||!z.blockKey){le.message(`${z.title} is not installed on this site.`);return}m({collection:"apps",key:z.blockKey})}},z.id)}):V.length===0?n.jsx(hr,{hasItems:l.length>0,emptyLabel:`No ${s} yet.`,emptyHint:`Click "+" to create your first ${Di(s)?Ai[s]:"item"}.`}):V.map(z=>{const ce=f?.collection===z.kind&&f.key===z.key;return n.jsx(cr,{icon:z.kind==="posts"?qc:z.kind==="authors"?ta:Gc,title:z.label,subtitle:z.subtitle,active:ce,onClick:()=>m({collection:z.kind,key:z.key}),menu:n.jsx(Nn,{onDuplicate:()=>R(z),onDelete:()=>I(z)})},z.key)}),e[0]=s,e[1]=o,e[2]=a,e[3]=l,e[4]=h,e[5]=v,e[6]=p,e[7]=I,e[8]=b,e[9]=j,e[10]=R,e[11]=_,e[12]=w,e[13]=x,e[14]=g,e[15]=k,e[16]=u,e[17]=m,e[18]=y,e[19]=i,e[20]=c,e[21]=d,e[22]=r,e[23]=f,e[24]=P,e[25]=T,e[26]=S,e[27]=C,e[28]=D,e[29]=N}else P=e[24],T=e[25],S=e[26],C=e[27],D=e[28],N=e[29];let A;e[46]!==T||e[47]!==S?(A=n.jsx("div",{className:T,children:S}),e[46]=T,e[47]=S,e[48]=A):A=e[48];let M;e[49]!==P||e[50]!==C||e[51]!==A?(M=n.jsx(P,{className:C,children:A}),e[49]=P,e[50]=C,e[51]=A,e[52]=M):M=e[52];let B;return e[53]!==D||e[54]!==N||e[55]!==M?(B=n.jsxs("div",{className:D,children:[N,M]}),e[53]=D,e[54]=N,e[55]=M,e[56]=B):B=e[56],B}function cr(t){const e=K.c(29),{icon:s,logoUrl:i,title:r,subtitle:o,active:a,variantCount:l,trailing:h,onClick:c,menu:d}=t;let u;e[0]!==s||e[1]!==a||e[2]!==i||e[3]!==l?(u=l&&l>1?n.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center",children:n.jsxs(Re,{children:[n.jsx(Ee,{asChild:!0,children:n.jsx(s,{size:16,className:"shrink-0",style:{color:to}})}),n.jsxs(Te,{side:"right",children:[l," variants"]})]})}):i?n.jsx("img",{src:i,alt:"",className:"size-8 shrink-0 rounded-lg object-cover bg-muted"}):n.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted",children:n.jsx(s,{size:16,className:he("shrink-0",a?"text-accent-foreground":"text-muted-foreground")})}),e[0]=s,e[1]=a,e[2]=i,e[3]=l,e[4]=u):u=e[4];const f=u,m=a?"bg-accent text-accent-foreground":"hover:bg-muted";let p;e[5]!==m?(p=he("group relative flex min-w-0 items-center rounded-md transition-colors",m),e[5]=m,e[6]=p):p=e[6];let _;e[7]!==r?(_=n.jsx("span",{className:"block truncate text-sm font-medium",children:r}),e[7]=r,e[8]=_):_=e[8];const g=a?"text-accent-foreground/70":"text-muted-foreground";let v;e[9]!==g?(v=he("block truncate text-xs",g),e[9]=g,e[10]=v):v=e[10];let b;e[11]!==o||e[12]!==v?(b=n.jsx("span",{className:v,children:o}),e[11]=o,e[12]=v,e[13]=b):b=e[13];let x;e[14]!==_||e[15]!==b?(x=n.jsxs("span",{className:"min-w-0 flex-1",children:[_,b]}),e[14]=_,e[15]=b,e[16]=x):x=e[16];let y;e[17]!==c||e[18]!==f||e[19]!==x||e[20]!==h?(y=n.jsxs("button",{type:"button",onClick:c,className:"flex min-w-0 flex-1 items-center gap-2.5 rounded-md px-2.5 py-2 text-left cursor-pointer",children:[f,x,h]}),e[17]=c,e[18]=f,e[19]=x,e[20]=h,e[21]=y):y=e[21];let w;e[22]!==a||e[23]!==d?(w=d&&n.jsx("div",{className:he("pr-1 opacity-0 transition-opacity group-hover:opacity-100",a&&"opacity-100"),children:d}),e[22]=a,e[23]=d,e[24]=w):w=e[24];let k;return e[25]!==w||e[26]!==p||e[27]!==y?(k=n.jsxs("div",{className:p,children:[y,w]}),e[25]=w,e[26]=p,e[27]=y,e[28]=k):k=e[28],k}function Nn(t){const e=K.c(21),{onDuplicate:s,onRename:i,onAddVariant:r,onEditSeo:o,onViewJson:a,onDelete:l}=t;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(Ds,{asChild:!0,children:n.jsx("button",{type:"button","aria-label":"More actions",className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-background hover:text-foreground cursor-pointer",onClick:sb,children:n.jsx(nn,{size:14})})}),e[0]=h):h=e[0];let c;e[1]!==i?(c=i&&n.jsxs(He,{onClick:i,children:[n.jsx(sa,{size:14}),"Rename"]}),e[1]=i,e[2]=c):c=e[2];let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(Qt,{size:14}),e[3]=d):d=e[3];let u;e[4]!==s?(u=n.jsxs(He,{onClick:s,children:[d,"Duplicate"]}),e[4]=s,e[5]=u):u=e[5];let f;e[6]!==r?(f=r&&n.jsxs(n.Fragment,{children:[n.jsx(vr,{}),n.jsxs(He,{onClick:r,className:"cursor-pointer",style:{color:to},children:[n.jsx(Yf,{size:14,style:{color:to}}),"Add variant"]})]}),e[6]=r,e[7]=f):f=e[7];let m;e[8]!==o||e[9]!==a?(m=(o||a)&&n.jsxs(n.Fragment,{children:[n.jsx(vr,{}),o&&n.jsxs(He,{onClick:o,children:[n.jsx(Nr,{size:14}),"Edit SEO"]}),a&&n.jsxs(He,{onClick:a,children:[n.jsx(qo,{size:14}),"View JSON"]})]}),e[8]=o,e[9]=a,e[10]=m):m=e[10];let p;e[11]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx(vr,{}),e[11]=p):p=e[11];let _;e[12]===Symbol.for("react.memo_cache_sentinel")?(_=n.jsx(qs,{size:14}),e[12]=_):_=e[12];let g;e[13]!==l?(g=n.jsxs(He,{onClick:l,className:"text-destructive focus:text-destructive",children:[_,"Delete"]}),e[13]=l,e[14]=g):g=e[14];let v;return e[15]!==c||e[16]!==u||e[17]!==f||e[18]!==m||e[19]!==g?(v=n.jsxs(As,{children:[h,n.jsxs(Is,{align:"end",className:"w-44",children:[c,u,f,m,p,g]})]}),e[15]=c,e[16]=u,e[17]=f,e[18]=m,e[19]=g,e[20]=v):v=e[20],v}function sb(t){return t.stopPropagation()}function hr(t){const e=K.c(6),{hasItems:s,emptyLabel:i,emptyHint:r}=t;let o;e[0]!==r||e[1]!==i||e[2]!==s?(o=s?"No results match your search.":n.jsxs(n.Fragment,{children:[n.jsx("div",{children:i}),n.jsx("div",{className:"mt-1 text-muted-foreground/80",children:r})]}),e[0]=r,e[1]=i,e[2]=s,e[3]=o):o=e[3];let a;return e[4]!==o?(a=n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:o}),e[4]=o,e[5]=a):a=e[5],a}function ib(t){const e=K.c(8),{state:s,claimPhase:i,lifecycle:r,onStart:o}=t;switch(s.kind){case"starting":{let a;e[0]!==i||e[1]!==r?(a=ld({claimPhase:i,lifecycle:r}),e[0]=i,e[1]=r,e[2]=a):a=e[2];let l;return e[3]!==i||e[4]!==a?(l=n.jsx(Wr,{kind:"starting",progress:a,claimPhase:i}),e[3]=i,e[4]=a,e[5]=l):l=e[5],l}case"suspended":{let a;return e[6]!==o?(a=n.jsx(Wr,{kind:"suspended",onResume:o}),e[6]=o,e[7]=a):a=e[7],a}}}function Ci(t){const e=K.c(10),{icon:s,title:i,description:r}=t;let o;e[0]!==s?(o=s&&n.jsx(s,{size:24,className:"text-muted-foreground/60"}),e[0]=s,e[1]=o):o=e[1];let a;e[2]!==i?(a=n.jsx("div",{children:i}),e[2]=i,e[3]=a):a=e[3];let l;e[4]!==r?(l=r&&n.jsx("div",{className:"text-xs text-muted-foreground/80 max-w-sm",children:r}),e[4]=r,e[5]=l):l=e[5];let h;return e[6]!==o||e[7]!==a||e[8]!==l?(h=n.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 p-6 text-center text-sm text-muted-foreground",children:[o,a,l]}),e[6]=o,e[7]=a,e[8]=l,e[9]=h):h=e[9],h}function rb(t){const e=K.c(2),{virtualMcpId:s}=t,i=Mt(s);if(!ti(i?.metadata)){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 text-center text-sm text-muted-foreground p-6",children:[n.jsx(Ki,{size:24,className:"text-muted-foreground/60"}),n.jsx("div",{children:"No content to edit."}),n.jsx("div",{className:"text-xs text-muted-foreground/80",children:"Connect a GitHub repository from the Settings tab to enable Content."})]}),e[0]=a):a=e[0],a}let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(Xx,{}),e[1]=o):o=e[1],o}const En={fast:{label:"Fast",subtitle:"Quick responses for simple tasks",icon:Kc},smart:{label:"Smart",subtitle:"Balanced quality and speed",icon:Ss},thinking:{label:"Thinking",subtitle:"Deeper reasoning for hard tasks",icon:Qf}},nb=["fast","smart","thinking"];function ob(t){const e=K.c(15),{tier:s,onSelect:i}=t,[r,o]=E.useState(!1),a=En[s].icon;let l;e[0]!==a?(l=n.jsx(a,{size:14,className:"text-muted-foreground"}),e[0]=a,e[1]=l):l=e[1];const h=En[s];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(Es,{size:14,className:"text-muted-foreground"}),e[2]=c):c=e[2];let d;e[3]!==l||e[4]!==h.label?(d=n.jsx(Rs,{asChild:!0,children:n.jsxs(re,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[l,h.label,c]})}),e[3]=l,e[4]=h.label,e[5]=d):d=e[5];let u;e[6]!==i||e[7]!==s?(u=nb.map(p=>{const _=En[p],g=_.icon;return n.jsxs("button",{type:"button",onClick:()=>{i(p),o(!1)},className:he("flex items-start gap-2 px-2 py-1.5 rounded-md text-left hover:bg-muted"),children:[n.jsx(g,{size:16,className:"shrink-0 text-muted-foreground mt-0.5"}),n.jsxs("div",{className:"flex-1",children:[n.jsx("div",{className:"text-sm",children:_.label}),n.jsx("div",{className:"text-xs text-muted-foreground",children:_.subtitle})]}),p===s&&n.jsx(ii,{size:14,className:"text-foreground mt-0.5"})]},p)}),e[6]=i,e[7]=s,e[8]=u):u=e[8];let f;e[9]!==u?(f=n.jsx(Ps,{align:"start",className:"p-1 w-64",children:n.jsx("div",{className:"flex flex-col",children:u})}),e[9]=u,e[10]=f):f=e[10];let m;return e[11]!==r||e[12]!==d||e[13]!==f?(m=n.jsxs(Ts,{open:r,onOpenChange:o,children:[d,f]}),e[11]=r,e[12]=d,e[13]=f,e[14]=m):m=e[14],m}function ab(t){const e=K.c(15),{tier:s,onTierChange:i,override:r,onOverrideChange:o}=t,[a,l]=E.useState(r!==null);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Model"}),e[0]=h):h=e[0];let c;e[1]!==o||e[2]!==i||e[3]!==r||e[4]!==s||e[5]!==a?(c=a?n.jsx(E.Suspense,{fallback:n.jsx(re,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:"Loading models…"}),children:n.jsx(lb,{override:r,onOverrideChange:o})}):n.jsx(ob,{tier:s,onSelect:i}),e[1]=o,e[2]=i,e[3]=r,e[4]=s,e[5]=a,e[6]=c):c=e[6];let d;e[7]!==o?(d=m=>{l(m),m||o(null)},e[7]=o,e[8]=d):d=e[8];let u;e[9]!==d||e[10]!==a?(u=n.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground cursor-pointer select-none",children:[n.jsx(Or,{checked:a,onCheckedChange:d,className:"cursor-pointer"}),"Specific model"]}),e[9]=d,e[10]=a,e[11]=u):u=e[11];let f;return e[12]!==c||e[13]!==u?(f=n.jsxs("div",{className:"flex flex-col gap-2",children:[h,n.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[c,u]})]}),e[12]=c,e[13]=u,e[14]=f):f=e[14],f}function lb(t){const e=K.c(10),{override:s,onOverrideChange:i}=t,r=Hc(),o=r[0]?.id??null,[a,l]=E.useState(s?.credentialId??o);let h;e[0]!==s?(h=s?{modelId:s.modelId,title:s.title||s.modelId,keyId:s.credentialId,providerId:"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,e[0]=s,e[1]=h):h=e[1];const c=h;if(r.length===0){let f;return e[2]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx("span",{className:"text-xs text-muted-foreground italic",children:"Connect an AI provider in settings to pick a specific model."}),e[2]=f):f=e[2],f}let d;e[3]!==a||e[4]!==i?(d=f=>{const m=f.keyId??a??"";l(m),i({modelId:f.modelId,credentialId:m,title:f.title??f.modelId})},e[3]=a,e[4]=i,e[5]=d):d=e[5];let u;return e[6]!==a||e[7]!==c||e[8]!==d?(u=n.jsx("div",{className:"w-fit max-w-full [&_button]:rounded-md",children:n.jsx(up,{variant:"bordered",placeholder:"Pick a model",model:c,credentialId:a,onCredentialChange:l,onModelChange:d})}),e[6]=a,e[7]=c,e[8]=d,e[9]=u):u=e[9],u}const Td=[{key:"capabilities",heading:"Built-in capabilities",icon:ia,tools:[{name:"web_search",title:"Web search",description:"Look up current information on the web",icon:qi},{name:"generate_image",title:"Generate image",description:"Create images from a text prompt",icon:rp},{name:"subtask",title:"Subtask",description:"Spawn a focused sub-agent to handle part of the work",icon:Li},{name:"user_ask",title:"Ask the user",description:"Pause to ask the user a clarifying question",icon:Xf}]},{key:"files",heading:"Files & code",icon:Vn,tools:[{name:"read",title:"Read File",description:"Read a file from the workspace",icon:nh},{name:"write",title:"Write File",description:"Create or overwrite a file",icon:sa},{name:"edit",title:"Edit File",description:"Make targeted edits to an existing file",icon:Jf},{name:"grep",title:"Search Content",description:"Search file contents by pattern",icon:$i},{name:"glob",title:"Find Files",description:"Find files by name pattern",icon:Vn},{name:"bash",title:"Run Command",description:"Run shell commands in the sandbox",icon:Zf}]},{key:"context",heading:"Context",icon:Ga,tools:[{name:"read_resource",title:"Read Resource",description:"Read an MCP resource by URI",icon:Ga},{name:"read_prompt",title:"Read Prompt",description:"Read an MCP prompt definition",icon:mh}]},{key:"browser",heading:"Browser",icon:Gs,tools:[{name:"take_screenshot",title:"Take Screenshot",description:"Capture a screenshot of a web page",icon:sh},{name:"scrape_url",title:"Scrape URL",description:"Fetch and extract content from a URL",icon:Gs},{name:"inspect_page",title:"Inspect Page",description:"Inspect a web page's structure",icon:qo}]}],cb=Td.flatMap(t=>t.tools.map(e=>e.name));function hb(t){const e=t.replace(/[_-]+/g," ").trim();return e?e.toLowerCase().replace(/\b\w/g,s=>s.toUpperCase()):t}function db(t){const e=K.c(5),{agentId:s,value:i,onChange:r}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Tools"}),e[0]=o):o=e[0];let a;return e[1]!==s||e[2]!==r||e[3]!==i?(a=n.jsxs("div",{className:"flex flex-col gap-2",children:[o,s?n.jsx(E.Suspense,{fallback:n.jsxs(re,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:[n.jsx(ia,{size:14}),"Loading tools…"]}),children:n.jsx(ub,{agentId:s,value:i,onChange:r})}):n.jsx("span",{className:"text-xs text-muted-foreground italic",children:"Pick an agent first"})]}),e[1]=s,e[2]=r,e[3]=i,e[4]=a):a=e[4],a}function Rl(t){const e=K.c(17),{value:s,checked:i,onToggle:r,title:o,description:a,leading:l}=t;let h;e[0]!==i?(h=n.jsx(ln,{checked:i,className:"pointer-events-none mt-0.5"}),e[0]=i,e[1]=h):h=e[1];let c;e[2]!==l?(c=l&&n.jsx("span",{className:"mt-px shrink-0",children:l}),e[2]=l,e[3]=c):c=e[3];let d;e[4]!==o?(d=n.jsx("span",{className:"truncate text-sm leading-tight",children:o}),e[4]=o,e[5]=d):d=e[5];let u;e[6]!==a?(u=a&&n.jsx("span",{className:"line-clamp-2 text-xs leading-snug text-muted-foreground",children:a}),e[6]=a,e[7]=u):u=e[7];let f;e[8]!==d||e[9]!==u?(f=n.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[d,u]}),e[8]=d,e[9]=u,e[10]=f):f=e[10];let m;return e[11]!==r||e[12]!==h||e[13]!==c||e[14]!==f||e[15]!==s?(m=n.jsxs(dp,{value:s,onSelect:r,className:"items-start gap-2.5 py-2",children:[h,c,f]}),e[11]=r,e[12]=h,e[13]=c,e[14]=f,e[15]=s,e[16]=m):m=e[16],m}function Pl(t){const e=K.c(20),{conn:s,label:i,icon:r,on:o,total:a,onToggle:l}=t,h=o===a;let c;e[0]!==r||e[1]!==s?(c=s?n.jsx(Gt,{icon:s.icon,name:s.title,size:"2xs"}):r?n.jsx(r,{size:14,className:"text-muted-foreground"}):n.jsx(em,{size:14,className:"text-muted-foreground"}),e[0]=r,e[1]=s,e[2]=c):c=e[2];const d=s?.title??i??"Other tools";let u;e[3]!==d?(u=n.jsx("span",{className:"truncate",children:d}),e[3]=d,e[4]=u):u=e[4];let f;e[5]!==o||e[6]!==a?(f=n.jsxs("span",{className:"text-[11px] font-normal tabular-nums text-muted-foreground/70",children:[o,"/",a]}),e[5]=o,e[6]=a,e[7]=f):f=e[7];let m;e[8]!==l?(m=b=>{b.stopPropagation(),l()},e[8]=l,e[9]=m):m=e[9];const p=h?"None":"All";let _;e[10]!==m||e[11]!==p?(_=n.jsx("button",{type:"button",onClick:m,className:"text-[11px] font-medium text-primary hover:underline",children:p}),e[10]=m,e[11]=p,e[12]=_):_=e[12];let g;e[13]!==f||e[14]!==_?(g=n.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[f,_]}),e[13]=f,e[14]=_,e[15]=g):g=e[15];let v;return e[16]!==c||e[17]!==u||e[18]!==g?(v=n.jsxs("div",{className:"flex items-center gap-2",children:[c,u,g]}),e[16]=c,e[17]=u,e[18]=g,e[19]=v):v=e[19],v}function ub(t){const e=K.c(70),{agentId:s,value:i,onChange:r}=t,{org:o}=Pe(),[a,l]=E.useState(!1);let h;e[0]!==s||e[1]!==o.id||e[2]!==o.slug?(h={connectionId:s,orgId:o.id,orgSlug:o.slug},e[0]=s,e[1]=o.id,e[2]=o.slug,e[3]=h):h=e[3];const c=ft(h);let d;e[4]!==c?(d={client:c},e[4]=c,e[5]=d):d=e[5];const{data:u,isLoading:f}=_m(d),m=Gi();let p,_,g,v,b,x,y,w,k,j,R,I,P;if(e[6]!==m||e[7]!==u?.tools||e[8]!==f||e[9]!==r||e[10]!==a||e[11]!==i){const N=new Map(m.map(gb)),A=new Map;for(const q of u?.tools??[]){const te=_f(q._meta)??"__other__",me=gf(q.name,te==="__other__"?void 0:te),ne=q.title,ke=ne&&ne!==q.name?ne:hb(me);A.has(te)||A.set(te,{clientId:te,conn:N.get(te),tools:[]}),A.get(te).tools.push({name:q.name,display:ke,description:q.description})}const M=[...A.values()].sort(_b),B=(u?.tools??[]).map(pb),L=[...cb,...B],O=i===null?new Set(L):new Set(i),W=L.every(q=>O.has(q)),F=q=>r(L.every(te=>q.has(te))?null:[...q]),V=q=>{const te=new Set(O);te.has(q)?te.delete(q):te.add(q),F(te)},J=(q,te)=>{const me=new Set(O);for(const ne of q)te?me.add(ne):me.delete(ne);F(me)};v=Ts,P=a,b=l;let G;e[25]===Symbol.for("react.memo_cache_sentinel")?(G=n.jsx(ia,{size:14,className:"text-muted-foreground"}),e[25]=G):G=e[25];const U=W?"All tools":"Tools",H=!W&&n.jsxs(op,{variant:"secondary",className:"ml-0.5 h-5 px-1.5 text-[11px] tabular-nums",children:[O.size,"/",L.length]});let X;e[26]===Symbol.for("react.memo_cache_sentinel")?(X=n.jsx(Es,{size:14,className:"text-muted-foreground"}),e[26]=X):X=e[26],e[27]!==U||e[28]!==H?(x=n.jsx(Rs,{asChild:!0,children:n.jsxs(re,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[G,U,H,X]})}),e[27]=U,e[28]=H,e[29]=x):x=e[29],g=Ps,R="p-0 w-80",I="start",_=lp,e[30]===Symbol.for("react.memo_cache_sentinel")?(k=n.jsx(cp,{placeholder:"Search tools..."}),e[30]=k):k=e[30];const oe=W?`All ${L.length} tools enabled`:`${O.size} of ${L.length} enabled`;let $;e[31]!==oe?($=n.jsx("span",{className:"text-xs text-muted-foreground",children:oe}),e[31]=oe,e[32]=$):$=e[32];let se;e[33]!==r?(se=()=>r(null),e[33]=r,e[34]=se):se=e[34];let ee;e[35]!==W||e[36]!==se?(ee=n.jsx("button",{type:"button",onClick:se,disabled:W,className:"text-xs font-medium text-primary hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:"Select all"}),e[35]=W,e[36]=se,e[37]=ee):ee=e[37];let Q;e[38]===Symbol.for("react.memo_cache_sentinel")?(Q=n.jsx("span",{className:"text-muted-foreground/30",children:"·"}),e[38]=Q):Q=e[38];let z;e[39]!==r?(z=()=>r([]),e[39]=r,e[40]=z):z=e[40];const ce=O.size===0;let ue;e[41]!==z||e[42]!==ce?(ue=n.jsx("button",{type:"button",onClick:z,disabled:ce,className:"text-xs font-medium text-muted-foreground hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:"Clear"}),e[41]=z,e[42]=ce,e[43]=ue):ue=e[43];let fe;e[44]!==ee||e[45]!==ue?(fe=n.jsxs("div",{className:"flex items-center gap-2",children:[ee,Q,ue]}),e[44]=ee,e[45]=ue,e[46]=fe):fe=e[46],e[47]!==$||e[48]!==fe?(j=n.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[$,fe]}),e[47]=$,e[48]=fe,e[49]=j):j=e[49],p=hp,y="max-h-80",w=f?n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"Loading tools…"}):n.jsxs(n.Fragment,{children:[n.jsx(ap,{children:"No tools found"}),Td.map(q=>{const te=q.tools.map(mb),me=te.filter(ne=>O.has(ne)).length;return n.jsx(Qa,{heading:n.jsx(Pl,{label:q.heading,icon:q.icon,on:me,total:te.length,onToggle:()=>J(te,me!==te.length)}),children:q.tools.map(ne=>n.jsx(Rl,{value:`${ne.title} ${ne.name}`,checked:O.has(ne.name),onToggle:()=>V(ne.name),title:ne.title,description:ne.description,leading:n.jsx(ne.icon,{size:16,className:"text-muted-foreground"})},ne.name))},q.key)}),M.map(q=>{const te=q.tools.map(fb),me=te.filter(ne=>O.has(ne)).length;return n.jsx(Qa,{heading:n.jsx(Pl,{conn:q.conn,on:me,total:te.length,onToggle:()=>J(te,me!==te.length)}),children:q.tools.map(ne=>n.jsx(Rl,{value:`${ne.display} ${ne.name} ${q.conn?.title??""}`,checked:O.has(ne.name),onToggle:()=>V(ne.name),title:ne.display,description:ne.description},ne.name))},q.clientId)})]}),e[6]=m,e[7]=u?.tools,e[8]=f,e[9]=r,e[10]=a,e[11]=i,e[12]=p,e[13]=_,e[14]=g,e[15]=v,e[16]=b,e[17]=x,e[18]=y,e[19]=w,e[20]=k,e[21]=j,e[22]=R,e[23]=I,e[24]=P}else p=e[12],_=e[13],g=e[14],v=e[15],b=e[16],x=e[17],y=e[18],w=e[19],k=e[20],j=e[21],R=e[22],I=e[23],P=e[24];let T;e[50]!==p||e[51]!==y||e[52]!==w?(T=n.jsx(p,{className:y,children:w}),e[50]=p,e[51]=y,e[52]=w,e[53]=T):T=e[53];let S;e[54]!==_||e[55]!==T||e[56]!==k||e[57]!==j?(S=n.jsxs(_,{children:[k,j,T]}),e[54]=_,e[55]=T,e[56]=k,e[57]=j,e[58]=S):S=e[58];let C;e[59]!==g||e[60]!==S||e[61]!==R||e[62]!==I?(C=n.jsx(g,{className:R,align:I,children:S}),e[59]=g,e[60]=S,e[61]=R,e[62]=I,e[63]=C):C=e[63];let D;return e[64]!==v||e[65]!==b||e[66]!==x||e[67]!==C||e[68]!==P?(D=n.jsxs(v,{open:P,onOpenChange:b,children:[x,C]}),e[64]=v,e[65]=b,e[66]=x,e[67]=C,e[68]=P,e[69]=D):D=e[69],D}function fb(t){return t.name}function mb(t){return t.name}function pb(t){return t.name}function _b(t,e){return(t.conn?.title??t.clientId).localeCompare(e.conn?.title??e.clientId)}function gb(t){return[t.id,t]}function Ii(t){const e=t.trim().split(/\s+/);return e.length!==5?!1:e.every(s=>/^[\d*/,-]+$/.test(s))}function vb(t){if(!t)return"Unknown schedule";const e=t.trim();if(e==="* * * * *")return"Every minute";if(e==="0 * * * *")return"Every hour";if(e==="0 0 * * *")return"Every day";if(e==="0 0 * * 1")return"Every week";const s=e.match(/^\*\/(\d+)\s+\*\s+\*\s+\*\s+\*$/);if(s)return`Every ${s[1]} minutes`;const i=e.match(/^0\s+\*\/(\d+)\s+\*\s+\*\s+\*$/);if(i)return`Every ${i[1]} hours`;const r=e.match(/^0\s+0\s+\*\/(\d+)\s+\*\s+\*$/);if(r){const l=parseInt(r[1]??"1");return l%7===0?`Every ${l/7} weeks`:`Every ${l} days`}const o=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+\*$/);if(o){const l=(o[2]??"0").padStart(2,"0"),h=(o[1]??"0").padStart(2,"0");return`Every day at ${l}:${h} UTC`}const a=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+(\d)$/);if(a){const h=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][parseInt(a[3]??"0")]??"day",c=(a[2]??"0").padStart(2,"0"),d=(a[1]??"0").padStart(2,"0");return`Every ${h} at ${c}:${d} UTC`}return t}function xb(t,e){const s=Math.max(1,t);switch(e){case"minutes":return s===1?"* * * * *":`*/${s} * * * *`;case"hours":return s===1?"0 * * * *":`0 */${s} * * *`;case"days":return s===1?"0 0 * * *":`0 0 */${s} * *`;case"weeks":return s===1?"0 0 * * 1":`0 0 */${s*7} * *`}}function bb(t){const e=t.trim();if(e==="* * * * *")return{count:1,unit:"minutes"};if(e==="0 * * * *")return{count:1,unit:"hours"};if(e==="0 0 * * *")return{count:1,unit:"days"};if(e==="0 0 * * 1")return{count:1,unit:"weeks"};const s=e.match(/^\*\/(\d+)\s+\*\s+\*\s+\*\s+\*$/);if(s)return{count:parseInt(s[1]),unit:"minutes"};const i=e.match(/^0\s+\*\/(\d+)\s+\*\s+\*\s+\*$/);if(i)return{count:parseInt(i[1]),unit:"hours"};const r=e.match(/^0\s+0\s+\*\/(\d+)\s+\*\s+\*$/);if(r){const o=parseInt(r[1]);return o%7===0?{count:o/7,unit:"weeks"}:{count:o,unit:"days"}}return null}function yb(t,e){return e===1?{minutes:"minute",hours:"hour",days:"day",weeks:"week"}[t]??t:t}const Sb=[{label:"5 minutes",cron:"*/5 * * * *"},{label:"Hour",cron:"0 * * * *"},{label:"Day",cron:"0 0 * * *"},{label:"Week",cron:"0 0 * * 1"}];function wb({automationId:t,open:e,onOpenChange:s,onCustomSelect:i,onEventSelect:r,onWebhookCreated:o}){const{triggerAdd:a}=Xi(),[l,h]=E.useState(!1),c=e??l,d=m=>{s?s(m):h(m)},u=async m=>{try{await a.mutateAsync({automation_id:t,type:"cron",cron_expression:m}),le.success("Starter added"),d(!1)}catch(p){const _=p instanceof Error?p.message:"Failed to add starter";le.error(_)}},f=async()=>{try{const m=await a.mutateAsync({automation_id:t,type:"webhook"});d(!1),m.webhook?o?.(m.webhook):le.success("Webhook starter added")}catch(m){const p=m instanceof Error?m.message:"Failed to add webhook starter";le.error(p)}};return n.jsxs(As,{open:c,onOpenChange:d,children:[n.jsx(Ds,{asChild:!0,children:n.jsxs(re,{variant:"outline",size:"sm",children:[n.jsx(xt,{size:14}),"Add Starter"]})}),n.jsxs(Is,{align:"end",className:"w-[200px]",children:[n.jsxs(qn,{children:[n.jsxs(Gn,{className:"gap-2.5",children:[n.jsx(Ri,{size:14,className:"text-muted-foreground shrink-0"}),"Every..."]}),n.jsx(Yn,{className:"w-[160px]",children:Sb.map(m=>n.jsxs(He,{className:"gap-2.5",onSelect:()=>u(m.cron),disabled:a.isPending,children:[n.jsx(Ri,{size:14,className:"text-muted-foreground shrink-0"}),"Every ",m.label]},m.cron))})]}),n.jsxs(He,{className:"gap-2.5",onSelect:()=>{d(!1),i?.()},children:[n.jsx(Ri,{size:14,className:"text-muted-foreground shrink-0"}),"Custom (cron)"]}),n.jsxs(He,{className:"gap-2.5",onSelect:()=>{d(!1),r?.()},children:[n.jsx(zi,{size:14,className:"text-muted-foreground shrink-0"}),"Event"]}),n.jsxs(He,{className:"gap-2.5",onSelect:()=>{f()},disabled:a.isPending,children:[n.jsx(qi,{size:14,className:"text-muted-foreground shrink-0"}),"Webhook"]})]})]})}function Rd(t){const e=K.c(31),{open:s,onOpenChange:i,url:r,token:o,title:a,description:l}=t,h=a===void 0?"Webhook ready":a,c=l===void 0?"Send a POST to this URL with the bearer token to fire the automation. The token is shown once — copy it now.":l,[d,u]=E.useState(null),[f,m]=E.useState("curl"),[p,_]=E.useState("header"),g=E.useId();let v;e[0]===Symbol.for("react.memo_cache_sentinel")?(v=async(N,A)=>{try{await navigator.clipboard.writeText(N),u(A),le.success("Copied"),setTimeout(()=>u(null),1500)}catch{le.error("Failed to copy")}},e[0]=v):v=e[0];const b=v;let x;e[1]!==p||e[2]!==o||e[3]!==r?(x=r&&o&&p==="url"?`${r.replace(/\/$/,"")}/${o}`:r??"",e[1]=p,e[2]=o,e[3]=r,e[4]=x):x=e[4];const y=x,w=r&&o?p==="header"?`curl -X POST "${y}" \\
|
|
276
276
|
-H "Authorization: Bearer ${o}" \\
|
|
277
277
|
-H "Content-Type: application/json" \\
|
|
278
278
|
-d '{"hello":"world"}'`:`curl -X POST "${y}" \\
|
|
@@ -291,7 +291,7 @@ ${se}`:se;c.setValue("metadata.instructions",ee,{shouldDirty:!0})},G=new Set(d.m
|
|
|
291
291
|
},
|
|
292
292
|
body: JSON.stringify({ hello: "world" }),
|
|
293
293
|
});`:"",j=f==="curl"?w:k;let R;e[5]!==h?(R=n.jsx(rs,{children:h}),e[5]=h,e[6]=R):R=e[6];let I;e[7]!==c?(I=n.jsx(Jo,{children:c}),e[7]=c,e[8]=I):I=e[8];let P;e[9]!==R||e[10]!==I?(P=n.jsxs(is,{children:[R,I]}),e[9]=R,e[10]=I,e[11]=P):P=e[11];let T;e[12]!==p||e[13]!==d||e[14]!==y||e[15]!==f||e[16]!==j||e[17]!==o||e[18]!==g||e[19]!==r?(T=r&&o?n.jsxs("div",{className:"flex flex-col gap-3 min-w-0",children:[n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:"URL"}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("code",{className:"flex-1 min-w-0 text-xs font-mono bg-muted rounded-md px-2 py-1.5 truncate",children:y}),n.jsxs(re,{size:"sm",variant:"outline",onClick:()=>b(y,"url"),children:[n.jsx(Qt,{size:13}),d==="url"?"Copied":"Copy"]})]})]}),n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:"Token (shown once)"}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("code",{className:"flex-1 min-w-0 text-xs font-mono bg-muted rounded-md px-2 py-1.5 truncate",children:o}),n.jsxs(re,{size:"sm",variant:"outline",onClick:()=>b(o,"token"),children:[n.jsx(Qt,{size:13}),d==="token"?"Copied":"Copy"]})]})]}),n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:"Snippet"}),n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Qo,{value:f,onValueChange:N=>m(N),children:n.jsxs(Zo,{className:"h-8 p-[2px]",children:[n.jsx(ys,{value:"curl",className:"h-7 px-2.5 text-xs",children:"curl"}),n.jsx(ys,{value:"fetch",className:"h-7 px-2.5 text-xs",children:"fetch"})]})}),n.jsxs("label",{htmlFor:g,className:"flex items-center gap-1.5 text-xs text-muted-foreground cursor-pointer select-none",children:[n.jsx(ln,{id:g,checked:p==="url",onCheckedChange:N=>_(N?"url":"header")}),"Token in URL"]})]}),n.jsxs(re,{size:"sm",variant:"outline",onClick:()=>b(j,"example"),children:[n.jsx(Qt,{size:13}),d==="example"?"Copied":"Copy"]})]}),n.jsx("div",{className:"rounded-md border overflow-hidden min-w-0",children:n.jsx(gp,{code:j,language:f==="curl"?"shell":"typescript",readOnly:!0,disableDiagnostics:!0,height:180})})]})]}):null,e[12]=p,e[13]=d,e[14]=y,e[15]=f,e[16]=j,e[17]=o,e[18]=g,e[19]=r,e[20]=T):T=e[20];let S;e[21]!==i?(S=n.jsx(si,{children:n.jsx(re,{onClick:()=>i(!1),children:"Done"})}),e[21]=i,e[22]=S):S=e[22];let C;e[23]!==P||e[24]!==T||e[25]!==S?(C=n.jsxs(Ot,{className:"max-w-lg",children:[P,T,S]}),e[23]=P,e[24]=T,e[25]=S,e[26]=C):C=e[26];let D;return e[27]!==i||e[28]!==s||e[29]!==C?(D=n.jsx(Lt,{open:s,onOpenChange:i,children:C}),e[27]=i,e[28]=s,e[29]=C,e[30]=D):D=e[30],D}function Cb(t){const e=K.c(83),{trigger:s,automationId:i,connectionName:r}=t,{triggerAdd:o,triggerRemove:a,triggerRotateToken:l}=Xi(),[h,c]=E.useState(!1),[d,u]=E.useState(!1),[f,m]=E.useState(null);let p;e[0]!==s.cron_expression?(p=s.cron_expression?bb(s.cron_expression):null,e[0]=s.cron_expression,e[1]=p):p=e[1];const _=p,[g,v]=E.useState(_?.count??1),[b,x]=E.useState(!1),[y,w]=E.useState(s.cron_expression??""),k=a.isPending||o.isPending||l.isPending,j=s.type==="cron",R=s.type==="webhook";let I;e[2]!==i||e[3]!==a||e[4]!==s.id?(I=async()=>{try{await a.mutateAsync({trigger_id:s.id,automation_id:i}),le.success("Starter removed")}catch{le.error("Failed to remove starter")}c(!1)},e[2]=i,e[3]=a,e[4]=s.id,e[5]=I):I=e[5];const P=I;let T;e[6]!==o||e[7]!==i||e[8]!==y||e[9]!==a||e[10]!==s.cron_expression||e[11]!==s.id?(T=async()=>{const te=y.trim();if(!te||!Ii(te)||te===s.cron_expression){x(!1),w(s.cron_expression??"");return}try{await o.mutateAsync({automation_id:i,type:"cron",cron_expression:te}),await a.mutateAsync({trigger_id:s.id,automation_id:i}),x(!1)}catch{le.error("Failed to update starter"),w(s.cron_expression??""),x(!1)}},e[6]=o,e[7]=i,e[8]=y,e[9]=a,e[10]=s.cron_expression,e[11]=s.id,e[12]=T):T=e[12];const S=T;let C;e[13]!==i||e[14]!==l||e[15]!==s.id?(C=async()=>{u(!1);try{const te=await l.mutateAsync({trigger_id:s.id,automation_id:i});m({url:te.url,token:te.token})}catch(te){const me=te,ne=me instanceof Error?me.message:"Failed to rotate token";le.error(ne)}},e[13]=i,e[14]=l,e[15]=s.id,e[16]=C):C=e[16];const D=C;let N;e[17]!==o||e[18]!==i||e[19]!==_||e[20]!==a||e[21]!==s.cron_expression||e[22]!==s.id?(N=async te=>{if(!_)return;const me=_.unit==="minutes"?5:1,ne=Math.max(me,te);ne!==te&&v(ne);const ke=xb(ne,_.unit);if(ke!==s.cron_expression)try{await o.mutateAsync({automation_id:i,type:"cron",cron_expression:ke}),await a.mutateAsync({trigger_id:s.id,automation_id:i})}catch{le.error("Failed to update starter"),v(_.count)}},e[17]=o,e[18]=i,e[19]=_,e[20]=a,e[21]=s.cron_expression,e[22]=s.id,e[23]=N):N=e[23];const A=N;let M;e[24]!==j||e[25]!==R?(M=j?n.jsx(Ri,{size:14,className:"text-muted-foreground shrink-0"}):R?n.jsx(qi,{size:14,className:"text-muted-foreground shrink-0"}):n.jsx(zi,{size:14,className:"text-muted-foreground shrink-0"}),e[24]=j,e[25]=R,e[26]=M):M=e[26];let B;e[27]!==r||e[28]!==g||e[29]!==y||e[30]!==A||e[31]!==S||e[32]!==_||e[33]!==j||e[34]!==b||e[35]!==k||e[36]!==R||e[37]!==s.cron_expression||e[38]!==s.event_type||e[39]!==s.params?(B=_&&j?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-sm text-muted-foreground",children:"Every"}),n.jsx("input",{type:"number",min:_.unit==="minutes"?5:1,value:g,onChange:te=>v(parseInt(te.target.value)||1),onBlur:()=>A(g),onKeyDown:te=>{te.key==="Enter"&&te.target.blur(),te.key==="Escape"&&v(_.count)},disabled:k,className:"w-12 text-center text-sm h-7 border border-border rounded-md bg-background px-1 focus:outline-none focus:ring-1 focus:ring-ring"}),n.jsx("span",{className:"text-sm",children:yb(_.unit,g)})]}):j&&b?n.jsxs(n.Fragment,{children:[n.jsx("input",{type:"text",value:y,onChange:te=>w(te.target.value),onBlur:S,onKeyDown:te=>{te.key==="Enter"&&te.target.blur(),te.key==="Escape"&&(x(!1),w(s.cron_expression??""))},className:"flex-1 text-sm font-mono bg-transparent outline-none",autoFocus:!0}),y&&!Ii(y)&&n.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:"invalid"})]}):n.jsxs("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[n.jsx("span",{className:"text-sm font-mono text-xs text-muted-foreground truncate",children:j?vb(s.cron_expression??""):R?"Webhook · POST to fire":`${s.event_type}${r?` · ${r}`:""}`}),!j&&!R&&s.params&&Object.keys(s.params).length>0&&n.jsx("span",{className:"text-xs text-muted-foreground/60 truncate",children:Object.entries(s.params).map(kb).join(", ")})]}),e[27]=r,e[28]=g,e[29]=y,e[30]=A,e[31]=S,e[32]=_,e[33]=j,e[34]=b,e[35]=k,e[36]=R,e[37]=s.cron_expression,e[38]=s.event_type,e[39]=s.params,e[40]=B):B=e[40];let L;e[41]!==k?(L=k&&n.jsx(Ce,{size:13,className:"animate-spin text-muted-foreground"}),e[41]=k,e[42]=L):L=e[42];let O;e[43]!==_||e[44]!==j||e[45]!==b||e[46]!==s.cron_expression?(O=j&&!_&&!b&&n.jsx(re,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>{w(s.cron_expression??""),x(!0)},children:n.jsx(sa,{size:13,className:"text-muted-foreground"})}),e[43]=_,e[44]=j,e[45]=b,e[46]=s.cron_expression,e[47]=O):O=e[47];let W;e[48]!==R?(W=R&&n.jsx(re,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 transition-opacity",title:"Rotate token",onClick:()=>u(!0),children:n.jsx(Mi,{size:13,className:"text-muted-foreground"})}),e[48]=R,e[49]=W):W=e[49];let F;e[50]===Symbol.for("react.memo_cache_sentinel")?(F=n.jsx(re,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>c(!0),children:n.jsx(ps,{size:13,className:"text-muted-foreground"})}),e[50]=F):F=e[50];let V;e[51]!==W||e[52]!==L||e[53]!==O?(V=n.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[L,O,W,F]}),e[51]=W,e[52]=L,e[53]=O,e[54]=V):V=e[54];let J;e[55]!==V||e[56]!==M||e[57]!==B?(J=n.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5 rounded-lg border border-border bg-background group",children:[M,B,V]}),e[55]=V,e[56]=M,e[57]=B,e[58]=J):J=e[58];let G;e[59]===Symbol.for("react.memo_cache_sentinel")?(G=n.jsxs(Ar,{children:[n.jsx(Dr,{children:"Remove Starter"}),n.jsx(Ir,{children:"Are you sure you want to remove this starter?"})]}),e[59]=G):G=e[59];let U;e[60]===Symbol.for("react.memo_cache_sentinel")?(U=n.jsx(Mr,{children:"Cancel"}),e[60]=U):U=e[60];let H;e[61]!==P?(H=n.jsxs(Pr,{children:[G,n.jsxs(Br,{children:[U,n.jsx(Lr,{onClick:P,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]}),e[61]=P,e[62]=H):H=e[62];let X;e[63]!==h||e[64]!==H?(X=n.jsx(Rr,{open:h,onOpenChange:c,children:H}),e[63]=h,e[64]=H,e[65]=X):X=e[65];let oe;e[66]===Symbol.for("react.memo_cache_sentinel")?(oe=n.jsxs(Ar,{children:[n.jsx(Dr,{children:"Rotate webhook token"}),n.jsx(Ir,{children:"A new token will be generated and the current token will stop working. Any senders using the old token must be updated."})]}),e[66]=oe):oe=e[66];let $;e[67]===Symbol.for("react.memo_cache_sentinel")?($=n.jsx(Mr,{children:"Cancel"}),e[67]=$):$=e[67];let se;e[68]!==D?(se=n.jsxs(Pr,{children:[oe,n.jsxs(Br,{children:[$,n.jsx(Lr,{onClick:D,children:"Rotate"})]})]}),e[68]=D,e[69]=se):se=e[69];let ee;e[70]!==d||e[71]!==se?(ee=n.jsx(Rr,{open:d,onOpenChange:u,children:se}),e[70]=d,e[71]=se,e[72]=ee):ee=e[72];const Q=f!==null;let z;e[73]===Symbol.for("react.memo_cache_sentinel")?(z=te=>{te||m(null)},e[73]=z):z=e[73];const ce=f?.url??null,ue=f?.token??null;let fe;e[74]!==Q||e[75]!==ce||e[76]!==ue?(fe=n.jsx(Rd,{open:Q,onOpenChange:z,url:ce,token:ue,title:"New webhook token",description:"The previous token has been revoked. Copy the new token now — it will not be shown again."}),e[74]=Q,e[75]=ce,e[76]=ue,e[77]=fe):fe=e[77];let q;return e[78]!==J||e[79]!==X||e[80]!==ee||e[81]!==fe?(q=n.jsxs(n.Fragment,{children:[J,X,ee,fe]}),e[78]=J,e[79]=X,e[80]=ee,e[81]=fe,e[82]=q):q=e[82],q}function kb(t){const[e,s]=t;return`${e}: ${s}`}const jb=30;function Nb(t,e){switch(e.type){case"accumulate":{const s=t??{start:e.now,fields:new Set,saveCount:0},i=new Set(s.fields);for(const r of e.fields)i.add(r);return{...s,fields:i,saveCount:s.saveCount+1}}case"reset":return null}}function Eb(t){const e=K.c(55),{automationId:s,onDone:i}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={binding:"TRIGGER"},e[0]=r):r=e[0];const o=Gi(r),[a,l]=E.useState(),[h,c]=E.useState();let d;e[1]===Symbol.for("react.memo_cache_sentinel")?(d={},e[1]=d):d=e[1];const[u,f]=E.useState(d),{triggerAdd:m}=Xi(),{data:p,isLoading:_}=fp(a);let g,v,b,x,y,w;if(e[2]!==m||e[3]!==s||e[4]!==a||e[5]!==h||e[6]!==_||e[7]!==i||e[8]!==u||e[9]!==o||e[10]!==p){const R=p?.find(B=>B.type===h);let I;e[17]!==m||e[18]!==s||e[19]!==a||e[20]!==h||e[21]!==i||e[22]!==u?(I=async()=>{if(!(!a||!h))try{await m.mutateAsync({automation_id:s,type:"event",event_type:h,connection_id:a,params:u}),Ae("automation_trigger_added",{automation_id:s,trigger_type:"event",connection_id:a,event_type:h}),le.success("Event trigger added"),i()}catch{le.error("Failed to add event trigger")}},e[17]=m,e[18]=s,e[19]=a,e[20]=h,e[21]=i,e[22]=u,e[23]=I):I=e[23],g=I,v="flex flex-col gap-3 px-3 py-3 rounded-lg border border-border bg-background";let P,T;e[24]===Symbol.for("react.memo_cache_sentinel")?(T=n.jsx(zi,{size:14,className:"text-muted-foreground shrink-0"}),P=n.jsx("span",{className:"text-sm font-medium",children:"Event trigger"}),e[24]=P,e[25]=T):(P=e[24],T=e[25]);let S;e[26]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(ps,{size:13}),e[26]=S):S=e[26],e[27]!==i?(b=n.jsxs("div",{className:"flex items-center gap-2",children:[T,P,n.jsx("button",{type:"button",className:"ml-auto shrink-0 p-0.5 rounded text-muted-foreground hover:text-foreground",onClick:i,children:S})]}),e[27]=i,e[28]=b):b=e[28];const C=a??"";let D;e[29]===Symbol.for("react.memo_cache_sentinel")?(D=B=>{l(B),c(void 0),f({})},e[29]=D):D=e[29];let N;e[30]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(Pt,{className:"w-full",children:n.jsx(At,{placeholder:"Select connection..."})}),e[30]=N):N=e[30];let A;e[31]!==o?(A=o.length===0?n.jsx("div",{className:"px-2 py-3 text-center text-xs text-muted-foreground",children:"No connections with trigger support"}):o.map(Pb),e[31]=o,e[32]=A):A=e[32];let M;e[33]!==A?(M=n.jsx(Dt,{children:A}),e[33]=A,e[34]=M):M=e[34],e[35]!==C||e[36]!==M?(x=n.jsxs(It,{value:C,onValueChange:D,children:[N,M]}),e[35]=C,e[36]=M,e[37]=x):x=e[37],e[38]!==a||e[39]!==h||e[40]!==_||e[41]!==p?(y=a&&n.jsxs(It,{value:h??"",onValueChange:B=>{c(B),f({})},children:[n.jsx(Pt,{className:"w-full",children:_?n.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[n.jsx(Ce,{size:13,className:"animate-spin"}),"Loading events..."]}):n.jsx(At,{placeholder:"Select event type...",children:h??"Select event type..."})}),n.jsx(Dt,{children:p?.map(Rb)})]}),e[38]=a,e[39]=h,e[40]=_,e[41]=p,e[42]=y):y=e[42],w=R?.paramsSchema&&Object.keys(R.paramsSchema).length>0&&n.jsx("div",{className:"flex flex-col gap-2",children:Object.entries(R.paramsSchema).map(B=>{const[L,O]=B;return n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsxs("label",{className:"text-xs text-muted-foreground",children:[L,O.description&&n.jsxs("span",{className:"text-muted-foreground/60",children:[" ","— ",O.description]})]}),O.enum?n.jsxs(It,{value:u[L]??"",onValueChange:W=>f(F=>({...F,[L]:W})),children:[n.jsx(Pt,{className:"w-full",children:n.jsx(At,{placeholder:`Select ${L}...`})}),n.jsx(Dt,{children:O.enum.map(Tb)})]}):n.jsx("input",{type:"text",value:u[L]??"",onChange:W=>f(F=>({...F,[L]:W.target.value})),placeholder:O.description??L,className:"text-sm border border-border rounded-md bg-background px-2 py-1.5 focus:outline-none focus:ring-1 focus:ring-ring"})]},L)})}),e[2]=m,e[3]=s,e[4]=a,e[5]=h,e[6]=_,e[7]=i,e[8]=u,e[9]=o,e[10]=p,e[11]=g,e[12]=v,e[13]=b,e[14]=x,e[15]=y,e[16]=w}else g=e[11],v=e[12],b=e[13],x=e[14],y=e[15],w=e[16];let k;e[43]!==m||e[44]!==a||e[45]!==h||e[46]!==g?(k=a&&h&&n.jsx(re,{size:"sm",onClick:g,disabled:m.isPending,children:m.isPending?n.jsx(Ce,{size:13,className:"animate-spin"}):"Add trigger"}),e[43]=m,e[44]=a,e[45]=h,e[46]=g,e[47]=k):k=e[47];let j;return e[48]!==v||e[49]!==b||e[50]!==x||e[51]!==y||e[52]!==w||e[53]!==k?(j=n.jsxs("div",{className:v,children:[b,x,y,w,k]}),e[48]=v,e[49]=b,e[50]=x,e[51]=y,e[52]=w,e[53]=k,e[54]=j):j=e[54],j}function Tb(t){return n.jsx(nt,{value:t,children:t},t)}function Rb(t){return n.jsx(nt,{value:t.type,children:n.jsxs("div",{className:"flex flex-col",children:[n.jsx("span",{children:t.type}),n.jsx("span",{className:"text-xs text-muted-foreground",children:t.description})]})},t.type)}function Pb(t){return n.jsx(nt,{value:t.id,children:t.title},t.id)}function Ab({automationId:t,automation:e,onBack:s,onDelete:i}){const r=e.virtual_mcp_id,{org:o}=Pe(),{update:a,triggerAdd:l,run:h}=Xi(),c=Gi(),d=new Map(c.map(z=>[z.id,z.title])),{openTask:u}=ss(),{setChatOpen:f}=Uo(),{sendMessage:m}=Ns(),p=e.messages?.[0]?.metadata?.tiptapDoc??void 0,[_,g]=E.useState(p),[v,b]=E.useState(!1),[x,y]=E.useState(!1),[w,k]=E.useState(!1),[j,R]=E.useState(""),[I,P]=E.useState(!1),[T,S]=E.useState(null),[C,D]=E.useState(!1),[N,A]=E.useState(!1),[M,B]=E.useState(!1),L=async()=>{if(C)return;const ce=of(_).filter(ue=>ue.type==="text").map(ue=>ue.text).join(`
|
|
294
|
-
`);if(ce.trim()){D(!0);try{se(),Ae("automation_improve_clicked",{automation_id:t,agent_id:r,instructions_length:ce.length}),f(!0),await m({tiptapDoc:Kh({managerAgentId:$c.AUTOMATION_MANAGER(o.id),managerName:"Automation Manager",kind:"automation",id:t,instructions:ce})})}finally{D(!1)}}},O=e.models?.tier??"smart",W=e.models?.modelId&&e.models?.credentialId?{modelId:e.models.modelId,credentialId:e.models.credentialId,title:e.models.modelTitle??e.models.modelId}:null,F=Mc({defaultValues:{name:e.name,active:e.active,tier:O,modelOverride:W,tools:e.tools??null,maxAgentSteps:e.maxAgentSteps??null}}),V=F.watch("active"),[J,G]=E.useReducer(Nb,null),U=()=>{J!==null&&(Ae("automation_updated",{automation_id:t,agent_id:r,fields:Array.from(J.fields),save_count:J.saveCount,edit_duration_ms:Date.now()-J.start}),G({type:"reset"}))},H=async()=>{const z=F.control._formState.dirtyFields,ce=Object.keys(z);if(ce.length===0&&!M)return!0;const ue=F.getValues(),fe=F.control._defaultValues;F.reset(ue,{keepValues:!0});const q=M;B(!1);const te={tier:ue.tier,...ue.modelOverride?{modelId:ue.modelOverride.modelId,credentialId:ue.modelOverride.credentialId,modelTitle:ue.modelOverride.title}:{}},me={id:t,name:ue.name,active:ue.active,models:te,tools:ue.tools,maxAgentSteps:ue.maxAgentSteps,messages:nf(_),temperature:0};try{await a.mutateAsync(me)}catch{return F.reset(fe,{keepValues:!0}),q&&B(!0),!1}const ne=[...ce];return q&&ne.push("messages"),G({type:"accumulate",now:Date.now(),fields:ne}),$(),!0},{schedule:X,flush:oe}=$r({save:H}),{schedule:$,flush:se}=$r({delayMs:3e4,save:async()=>U()});E.useEffect(()=>{const z=F.watch(()=>X());return()=>z.unsubscribe()},[]);const ee=z=>{if(g(z),!N){A(!0);return}B(!0),X()},Q=async()=>{Ae("automation_test_clicked",{automation_id:t,agent_id:r});const z=await oe();if(se(),!!z){if(!_){le.error("No instructions configured for this automation");return}try{const ce=await h.mutateAsync(t);ce.threadId&&(f(!0),u(ce.threadId))}catch{}}};return n.jsxs(n.Fragment,{children:[s&&n.jsx("div",{className:"flex items-center pb-4 shrink-0",children:n.jsxs(re,{variant:"ghost",size:"sm",onClick:s,children:[n.jsx(_h,{size:14}),"Back to list"]})}),n.jsxs("div",{className:"flex flex-col gap-8",children:[n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsxs("div",{className:"flex items-center justify-between gap-4",children:[n.jsx(vt,{control:F.control,name:"name",render:({field:z})=>n.jsx(qe,{...z,placeholder:"Automation name",className:"border border-transparent shadow-none px-0 text-lg font-medium h-auto focus-visible:ring-0 focus-visible:border-border bg-transparent flex-1",style:{boxShadow:"none"}})}),i&&n.jsx(re,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-destructive shrink-0",onClick:i,children:n.jsx(qs,{size:14})})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(vt,{control:F.control,name:"active",render:({field:z})=>n.jsx(Or,{checked:z.value,onCheckedChange:ce=>{z.onChange(ce),oe()},className:"cursor-pointer"})}),n.jsx("span",{className:"text-sm text-muted-foreground",children:V?"Active":"Inactive"}),n.jsx("span",{className:"text-muted-foreground/50 text-sm",children:"·"}),n.jsx(oh,{id:e.created_by,size:"2xs",className:"text-sm text-muted-foreground"})]})]}),n.jsxs("div",{className:"flex flex-col gap-2.5",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Starter"}),n.jsx(wb,{automationId:t,open:v,onOpenChange:b,onCustomSelect:()=>{k(!0),P(!1),R("")},onEventSelect:()=>{P(!0),k(!1)},onWebhookCreated:z=>{Ae("automation_trigger_added",{automation_id:t,trigger_type:"webhook"}),S(z)}})]}),e.triggers.length===0&&!w?n.jsx("div",{className:"rounded-lg border border-dashed border-border px-4 py-6 text-center",children:n.jsxs("p",{className:"text-sm text-muted-foreground",children:["When should this automation run?"," ",n.jsx("button",{type:"button",className:"text-foreground underline underline-offset-2 cursor-pointer hover:text-foreground/80 transition-colors",onClick:()=>b(!0),children:"Add a starter"})," ","to get going."]})}):n.jsx("div",{className:"flex flex-col gap-2",children:e.triggers.map(z=>n.jsx(Cb,{trigger:z,automationId:t,connectionName:z.connection_id?d.get(z.connection_id):void 0},z.id))}),w&&n.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5 rounded-lg border border-border bg-background group",children:[n.jsx(Ri,{size:14,className:"text-muted-foreground shrink-0"}),n.jsx("input",{type:"text",value:j,onChange:z=>R(z.target.value),onBlur:async()=>{const z=j.trim();if(!(!z||!Ii(z)))try{await l.mutateAsync({automation_id:t,type:"cron",cron_expression:z}),Ae("automation_trigger_added",{automation_id:t,trigger_type:"cron"}),le.success("Starter added"),k(!1),R("")}catch{le.error("Failed to add starter")}},onKeyDown:async z=>{const ce=j.trim();z.key==="Enter"&&ce&&Ii(ce)&&z.target.blur(),z.key==="Escape"&&(k(!1),R(""))},placeholder:"0 9 * * 1-5",className:"flex-1 text-sm font-mono bg-transparent outline-none placeholder:text-muted-foreground/40",autoFocus:!0}),j&&!Ii(j)&&n.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:"invalid"}),l.isPending&&n.jsx(Ce,{size:13,className:"animate-spin text-muted-foreground shrink-0"}),n.jsx("button",{type:"button",className:"shrink-0 p-0.5 rounded text-muted-foreground opacity-0 group-hover:opacity-100 hover:text-foreground transition-opacity",onClick:()=>{k(!1),R("")},children:n.jsx(ps,{size:13})})]}),I&&n.jsx(E.Suspense,{fallback:n.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 rounded-lg border border-border bg-background",children:[n.jsx(Ce,{size:13,className:"animate-spin text-muted-foreground"}),n.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading connections..."})]}),children:n.jsx(Eb,{automationId:t,onDone:()=>P(!1)})}),n.jsx(Rd,{open:T!==null,onOpenChange:z=>{z||S(null)},url:T?.url??null,token:T?.token??null})]}),n.jsxs("div",{className:"flex flex-col gap-2.5",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Instructions"}),n.jsxs(re,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:C||!_,onClick:L,children:[n.jsx(Ss,{size:13}),"Improve"]})]}),n.jsx(Zu,{tiptapDoc:_,setTiptapDoc:ee,placeholder:"What should this automation do?",children:n.jsxs("div",{className:"rounded-xl border border-border min-h-[120px] flex flex-col",children:[n.jsx(Qu,{virtualMcpId:r||null,className:"max-h-[45vh]"}),n.jsx("div",{className:"@container/chat-bottom flex items-center justify-end gap-1.5 p-2.5",children:n.jsxs(Re,{children:[n.jsx(Ee,{asChild:!0,children:n.jsxs(re,{type:"button",variant:"default",className:"h-8 gap-1.5 rounded-md px-3 text-sm font-medium",onClick:Q,disabled:!r,children:[n.jsx(np,{size:16}),"Test"]})}),n.jsx(Te,{children:"Test Automation"})]})})]})})]}),n.jsxs(vf,{open:x,onOpenChange:y,className:"flex flex-col gap-2.5",children:[n.jsxs(xf,{className:"group flex w-fit cursor-pointer items-center gap-1.5",children:[n.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Advanced"}),n.jsx(Es,{size:14,className:"text-muted-foreground/60 transition-transform group-data-[state=open]:rotate-180"})]}),n.jsxs(bf,{className:"flex flex-col gap-5 pt-0.5",children:[n.jsx(ab,{tier:F.watch("tier"),onTierChange:z=>F.setValue("tier",z,{shouldDirty:!0}),override:F.watch("modelOverride"),onOverrideChange:z=>F.setValue("modelOverride",z,{shouldDirty:!0})}),n.jsx(db,{agentId:r||null,value:F.watch("tools"),onChange:z=>F.setValue("tools",z,{shouldDirty:!0})}),n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Max steps"}),n.jsx(qe,{type:"number",min:1,max:100,className:"w-40",placeholder:`${jb} (default)`,value:F.watch("maxAgentSteps")??"",onChange:z=>{const ce=z.target.value.trim(),ue=ce===""?null:Number(ce);F.setValue("maxAgentSteps",ue===null||Number.isNaN(ue)?null:ue,{shouldDirty:!0})}})]})]})]})]})]})}function Ys(){const t=K.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{"data-testid":"main-panel-loading",className:"flex h-full w-full items-center justify-center",children:n.jsx(Ce,{size:20,className:"animate-spin text-muted-foreground"})}),t[0]=e):e=t[0],e}const Pd=[{key:"24h",label:"Last 24 hours",ms:1440*60*1e3},{key:"7d",label:"Last 7 days",ms:10080*60*1e3},{key:"30d",label:"Last 30 days",ms:720*60*60*1e3}];function Ad(t){const e=Pd.find(i=>i.key===t).ms,s=Date.now();return{startDate:new Date(s-e).toISOString(),endDate:new Date(s).toISOString()}}function Db(t){const e=K.c(12),{automationId:s,triggerIds:i}=t,[r,o]=E.useState("30d"),[a,l]=E.useState(Bb);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=p=>{const _=p;o(_),l(Ad(_))},e[0]=h):h=e[0];let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(Pt,{className:"w-44",children:n.jsx(At,{})}),e[1]=c):c=e[1];let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(Dt,{children:Pd.map(Ib)}),e[2]=d):d=e[2];let u;e[3]!==r?(u=n.jsx("div",{className:"flex items-center justify-end",children:n.jsxs(It,{value:r,onValueChange:h,children:[c,d]})}),e[3]=r,e[4]=u):u=e[4];let f;e[5]!==s||e[6]!==a||e[7]!==i?(f=n.jsx(vp,{automationId:s,triggerIds:i,range:a}),e[5]=s,e[6]=a,e[7]=i,e[8]=f):f=e[8];let m;return e[9]!==u||e[10]!==f?(m=n.jsxs("div",{className:"flex flex-col gap-5",children:[u,f]}),e[9]=u,e[10]=f,e[11]=m):m=e[11],m}function Ib(t){return n.jsx(nt,{value:t.key,children:t.label},t.key)}function Bb(){return Ad("30d")}function Mb(t){const e=K.c(5),{tabId:s}=t;let i;e[0]!==s?(i=Jc(s),e[0]=s,e[1]=i):i=e[1];const r=i;if(!r)return null;let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(Ys,{}),e[2]=o):o=e[2];let a;return e[3]!==r.id?(a=n.jsx(E.Suspense,{fallback:o,children:n.jsx(Lb,{id:r.id})}),e[3]=r.id,e[4]=a):a=e[4],a}function Lb(t){const e=K.c(24),{id:s}=t,i=ts(),{data:r,isLoading:o}=mp(s),[a,l]=E.useState("settings");let h;e[0]!==i?(h=()=>{i({to:".",search:$b,replace:!0})},e[0]=i,e[1]=h):h=e[1];const c=h;if(o){let y;return e[2]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(Ys,{}),e[2]=y):y=e[2],y}if(!r){let y;return e[3]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx("div",{className:"flex h-full w-full items-center justify-center text-sm text-muted-foreground",children:"Automation not found"}),e[3]=y):y=e[3],y}let d;e[4]!==r.triggers?(d=r.triggers.map(Ob),e[4]=r.triggers,e[5]=d):d=e[5];const u=d;let f;e[6]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(_h,{size:14}),e[6]=f):f=e[6];let m;e[7]!==c?(m=n.jsxs(re,{variant:"ghost",size:"sm",onClick:c,children:[f,"Back to list"]}),e[7]=c,e[8]=m):m=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=[{id:"settings",label:"Settings"},{id:"runs",label:"Runs"}],e[9]=p):p=e[9];let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=y=>l(y),e[10]=_):_=e[10];let g;e[11]!==a?(g=n.jsx(dh,{tabs:p,activeTab:a,onTabChange:_}),e[11]=a,e[12]=g):g=e[12];let v;e[13]!==m||e[14]!==g?(v=n.jsxs("div",{className:"flex items-center justify-between pb-4 shrink-0",children:[m,g]}),e[13]=m,e[14]=g,e[15]=v):v=e[15];let b;e[16]!==r||e[17]!==s||e[18]!==a||e[19]!==u?(b=a==="settings"?n.jsx(Ab,{automationId:s,automation:r}):n.jsx(Db,{automationId:s,triggerIds:u}),e[16]=r,e[17]=s,e[18]=a,e[19]=u,e[20]=b):b=e[20];let x;return e[21]!==v||e[22]!==b?(x=n.jsx(Rt,{children:n.jsx(Rt.Content,{children:n.jsxs(Rt.Body,{children:[v,b]})})}),e[21]=v,e[22]=b,e[23]=x):x=e[23],x}function Ob(t){return t.id}function $b(t){return{...t,main:"automations"}}function zb(t){const e=K.c(20),{virtualMcpId:s}=t,i=ts(),{data:r}=pp(s),o=r===void 0?[]:r,{create:a}=Xi(),[l,h]=E.useState(""),c=l.toLowerCase(),d=o.filter(T=>T.name.toLowerCase().includes(c));let u;e[0]!==i?(u=T=>i({to:".",search:S=>({...S,main:"automation:"+T}),replace:!0}),e[0]=i,e[1]=u):u=e[1];const f=u,m=async()=>{if(a.isPending)return;Ae("automation_new_clicked",{virtual_mcp_id:s,existing_count:o.length});const T=await a.mutateAsync(_p(s));f(T.id)};let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx(xt,{size:14}),e[2]=p):p=e[2];let _;e[3]!==a.isPending||e[4]!==m?(_=n.jsxs(re,{size:"sm",onClick:m,disabled:a.isPending,children:[p,"New automation"]}),e[3]=a.isPending,e[4]=m,e[5]=_):_=e[5];const g=_,v=Rt,b=Rt,x=Rt;let y;e[6]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(Rt.Title,{children:"Automations"}),e[6]=y):y=e[6];const w=o.length>0&&n.jsx(hh,{value:l,onChange:h,placeholder:"Search automations...",className:"w-full md:w-[375px]"});let k;e[7]!==g||e[8]!==w?(k=n.jsxs("div",{className:"flex flex-col gap-6",children:[y,n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[w,g]})]}),e[7]=g,e[8]=w,e[9]=k):k=e[9];const j=o.length===0?n.jsx("div",{className:"flex items-center justify-center py-20",children:n.jsx(Er,{image:n.jsx(zi,{size:48,className:"text-muted-foreground"}),title:"No automations yet",description:"Create your first automation to run this agent on a schedule or in response to events.",actions:g})}):d.length===0?n.jsx("div",{className:"flex items-center justify-center py-20",children:n.jsx(Er,{image:n.jsx(zi,{size:48,className:"text-muted-foreground"}),title:"No automations found",description:`No automations match "${l}"`})}):n.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:d.map(T=>n.jsx(xp,{automation:T,onClick:()=>f(T.id)},T.id))});let R;e[10]!==j||e[11]!==x.Body||e[12]!==k?(R=n.jsxs(x.Body,{children:[k,j]}),e[10]=j,e[11]=x.Body,e[12]=k,e[13]=R):R=e[13];let I;e[14]!==R||e[15]!==b.Content?(I=n.jsx(b.Content,{children:R}),e[14]=R,e[15]=b.Content,e[16]=I):I=e[16];let P;return e[17]!==v||e[18]!==I?(P=n.jsx(v,{children:I}),e[17]=v,e[18]=I,e[19]=P):P=e[19],P}function Fb(t){const e=K.c(3),{virtualMcpId:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(Ys,{}),e[0]=i):i=e[0];let r;return e[1]!==s?(r=n.jsx(E.Suspense,{fallback:i,children:n.jsx(zb,{virtualMcpId:s})}),e[1]=s,e[2]=r):r=e[2],r}function Hb(t){const e=K.c(37),{file:s,onClose:i}=t;let r,o;e[0]!==s.filename?(r=n.jsx(Oi,{filename:s.filename,className:"h-4.5 w-3.5 shrink-0"}),o=n.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:s.filename}),e[0]=s.filename,e[1]=r,e[2]=o):(r=e[1],o=e[2]);let a;e[3]!==s.size?(a=km(s.size),e[3]=s.size,e[4]=a):a=e[4];let l;e[5]!==a?(l=n.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:a}),e[5]=a,e[6]=l):l=e[6];let h;e[7]!==r||e[8]!==o||e[9]!==l?(h=n.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 px-2",children:[r,o,l]}),e[7]=r,e[8]=o,e[9]=l,e[10]=h):h=e[10];let c;e[11]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(mm,{size:14}),e[11]=c):c=e[11];let d;e[12]!==s.downloadUrl||e[13]!==s.filename?(d=n.jsx(Ee,{asChild:!0,children:n.jsx(re,{variant:"ghost",size:"icon",asChild:!0,children:n.jsx("a",{href:s.downloadUrl,download:s.filename,children:c})})}),e[12]=s.downloadUrl,e[13]=s.filename,e[14]=d):d=e[14];let u;e[15]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(Te,{side:"bottom",children:"Download"}),e[15]=u):u=e[15];let f;e[16]!==d?(f=n.jsxs(Re,{children:[d,u]}),e[16]=d,e[17]=f):f=e[17];let m;e[18]!==s.downloadUrl?(m=()=>window.open(s.downloadUrl,"_blank","noopener"),e[18]=s.downloadUrl,e[19]=m):m=e[19];let p;e[20]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx(ri,{size:14}),e[20]=p):p=e[20];let _;e[21]!==m?(_=n.jsx(Ee,{asChild:!0,children:n.jsx(re,{variant:"ghost",size:"icon",onClick:m,children:p})}),e[21]=m,e[22]=_):_=e[22];let g;e[23]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(Te,{side:"bottom",children:"Open in new tab"}),e[23]=g):g=e[23];let v;e[24]!==_?(v=n.jsxs(Re,{children:[_,g]}),e[24]=_,e[25]=v):v=e[25];let b;e[26]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx(ps,{size:14}),e[26]=b):b=e[26];let x;e[27]!==i?(x=n.jsx(Ee,{asChild:!0,children:n.jsx(re,{variant:"ghost",size:"icon",onClick:i,children:b})}),e[27]=i,e[28]=x):x=e[28];let y;e[29]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(Te,{side:"bottom",children:"Close"}),e[29]=y):y=e[29];let w;e[30]!==x?(w=n.jsxs(Re,{children:[x,y]}),e[30]=x,e[31]=w):w=e[31];let k;return e[32]!==v||e[33]!==w||e[34]!==h||e[35]!==f?(k=n.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-1 border-b border-border/60 px-2",children:[h,f,v,w]}),e[32]=v,e[33]=w,e[34]=h,e[35]=f,e[36]=k):k=e[36],k}function Wb(t){const e=K.c(24),{fileKey:s,taskId:i}=t,r=ts(),{data:o,isPending:a}=Fc(i);let l;e[0]!==s||e[1]!==o?(l=o?.find(p=>p.key===s)??null,e[0]=s,e[1]=o,e[2]=l):l=e[2];const h=l;let c;e[3]!==r?(c=()=>r({to:".",search:Ub,replace:!0}),e[3]=r,e[4]=c):c=e[4];const d=c;if(!h){if(a){let x;return e[5]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx("div",{className:"h-full w-full bg-background",children:n.jsx(wm,{})}),e[5]=x):x=e[5],x}let p;e[6]!==s?(p=s.split("/").pop()??s,e[6]=s,e[7]=p):p=e[7];let _;e[8]!==p?(_=n.jsx(Oi,{filename:p,className:"h-7.5 w-6"}),e[8]=p,e[9]=_):_=e[9];let g;e[10]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx("span",{className:"text-sm text-muted-foreground",children:"This file is no longer available."}),e[10]=g):g=e[10];let v;e[11]!==d?(v=n.jsx(re,{variant:"ghost",size:"sm",onClick:d,children:"Close"}),e[11]=d,e[12]=v):v=e[12];let b;return e[13]!==_||e[14]!==v?(b=n.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 bg-background",children:[_,g,v]}),e[13]=_,e[14]=v,e[15]=b):b=e[15],b}let u;e[16]!==h||e[17]!==d?(u=n.jsx(Hb,{file:h,onClose:d}),e[16]=h,e[17]=d,e[18]=u):u=e[18];let f;e[19]!==h?(f=n.jsx("div",{className:"relative min-h-0 flex-1",children:n.jsx(Cm,{file:h})}),e[19]=h,e[20]=f):f=e[20];let m;return e[21]!==u||e[22]!==f?(m=n.jsxs("div",{className:"flex h-full w-full flex-col bg-background",children:[u,f]}),e[21]=u,e[22]=f,e[23]=m):m=e[23],m}function Ub(t){return{...t,main:"0"}}const Al="home";function Kb(t){const e=K.c(5),{label:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(uh,{className:"aspect-video w-2/3 max-w-xl"}),e[0]=i):i=e[0];let r;e[1]!==s?(r=s&&n.jsx("p",{className:"text-xs text-muted-foreground",children:s}),e[1]=s,e[2]=r):r=e[2];let o;return e[3]!==r?(o=n.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-3 bg-background",children:[i,r]}),e[3]=r,e[4]=o):o=e[4],o}function Vb(t){const e=K.c(12),{path:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={refetchIntervalWhenAbsent:2e3},e[0]=i):i=e[0];const r=jm(Al,s,i),o=Nm(Al);let a;e[1]!==s||e[2]!==o?(a=o(s),e[1]=s,e[2]=o,e[3]=a):a=e[3];const l=a;if(r.isPending||!r.data){const d=!r.isPending&&!r.data?"Waiting for the deck to sync…":void 0;let u;return e[4]!==d?(u=n.jsx(Kb,{label:d}),e[4]=d,e[5]=u):u=e[5],u}let h;e[6]!==r.data?(h=Em(r.data),e[6]=r.data,e[7]=h):h=e[7];let c;return e[8]!==s||e[9]!==l||e[10]!==h?(c=n.jsx(Tm,{readUrl:l,marker:h,title:s,savePath:s}),e[8]=s,e[9]=l,e[10]=h,e[11]=c):c=e[11],c}const Dl=E.lazy(()=>qt(()=>import("./project-app-view-DfsCN7aU.js"),__vite__mapDeps([164,1,2,98,6,7,8,9,10,11,12,13,14,15,16,3,17,4,5,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,99,100,46,47,48,101,102,49,103,104,58,59,93,94,95,96,97,57,79,60,78,105,106,107,108,109,67,110,56,111,72,73,50,112,127])).then(t=>({default:t.AppViewContent})));function qb(t){const e=K.c(49),{activeTab:s,virtualMcpId:i,taskId:r,layoutTabs:o,expandedTools:a,automationTabParsed:l}=t;if(lm(s)){let v;return e[0]!==i?(v=n.jsx(gl,{virtualMcpId:i}),e[0]=i,e[1]=v):v=e[1],v}if(s==="git"){let v;return e[2]!==i?(v=n.jsx(r1,{virtualMcpId:i}),e[2]=i,e[3]=v):v=e[3],v}if(s==="automations"){let v;return e[4]!==i?(v=n.jsx(Fb,{virtualMcpId:i}),e[4]=i,e[5]=v):v=e[5],v}if(s==="preview"){let v;return e[6]!==i?(v=n.jsx(q1,{virtualMcpId:i}),e[6]=i,e[7]=v):v=e[7],v}if(s==="content"){let v;return e[8]!==i?(v=n.jsx(rb,{virtualMcpId:i}),e[8]=i,e[9]=v):v=e[9],v}if(l){let v;return e[10]!==s?(v=n.jsx(Mb,{tabId:s}),e[10]=s,e[11]=v):v=e[11],v}let h;e[12]!==s?(h=Qc(s),e[12]=s,e[13]=h):h=e[13];const c=h;if(c){let v;return e[14]!==c.path?(v=n.jsx(Vb,{path:c.path},c.path),e[14]=c.path,e[15]=v):v=e[15],v}let d;e[16]!==s?(d=Zc(s),e[16]=s,e[17]=d):d=e[17];const u=d;if(u){let v;return e[18]!==u.key||e[19]!==r?(v=n.jsx(Wb,{fileKey:u.key,taskId:r}),e[18]=u.key,e[19]=r,e[20]=v):v=e[20],v}let f;e[21]!==s?(f=cm(s),e[21]=s,e[22]=f):f=e[22];const m=f;if(m){let v;if(e[23]!==a||e[24]!==m.connectionId||e[25]!==m.toolName){let k;e[27]!==m.connectionId||e[28]!==m.toolName?(k=j=>j.appId===m.connectionId&&j.toolName===m.toolName,e[27]=m.connectionId,e[28]=m.toolName,e[29]=k):k=e[29],v=a.find(k),e[23]=a,e[24]=m.connectionId,e[25]=m.toolName,e[26]=v}else v=e[26];const b=v;let x;e[30]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx(Ys,{}),e[30]=x):x=e[30];const y=b?.args;let w;return e[31]!==s||e[32]!==m.connectionId||e[33]!==m.toolName||e[34]!==y?(w=n.jsx(E.Suspense,{fallback:x,children:n.jsx(Dl,{connectionId:m.connectionId,toolName:m.toolName,args:y},s)}),e[31]=s,e[32]=m.connectionId,e[33]=m.toolName,e[34]=y,e[35]=w):w=e[35],w}let p;if(e[36]!==s||e[37]!==o){let v;e[39]!==s?(v=b=>b.id===s,e[39]=s,e[40]=v):v=e[40],p=o.find(v),e[36]=s,e[37]=o,e[38]=p}else p=e[38];const _=p;if(_){let v;e[41]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx(Ys,{}),e[41]=v):v=e[41];let b;return e[42]!==s||e[43]!==_.id||e[44]!==_.view.appId||e[45]!==_.view.args?(b=n.jsx(E.Suspense,{fallback:v,children:n.jsx(Dl,{connectionId:_.view.appId,toolName:_.id,args:_.view.args},s)}),e[42]=s,e[43]=_.id,e[44]=_.view.appId,e[45]=_.view.args,e[46]=b):b=e[46],b}let g;return e[47]!==i?(g=n.jsx(gl,{virtualMcpId:i}),e[47]=i,e[48]=g):g=e[48],g}function Gb(t){const e=K.c(14),{taskId:s,virtualMcpId:i}=t;let r;e[0]!==s||e[1]!==i?(r={virtualMcpId:i,taskId:s},e[0]=s,e[1]=i,e[2]=r):r=e[2];const{activeTab:o,layoutTabs:a,expandedTools:l,automationTabParsed:h}=Uh(r);let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(Ys,{}),e[3]=c):c=e[3];let d;e[4]!==o||e[5]!==h||e[6]!==l||e[7]!==a||e[8]!==s||e[9]!==i?(d=n.jsx(E.Suspense,{fallback:c,children:n.jsx(qb,{activeTab:o,virtualMcpId:i,taskId:s,layoutTabs:a,expandedTools:l,automationTabParsed:h})}),e[4]=o,e[5]=h,e[6]=l,e[7]=a,e[8]=s,e[9]=i,e[10]=d):d=e[10];let u;return e[11]!==o||e[12]!==d?(u=n.jsx(Ut,{children:d},o),e[11]=o,e[12]=d,e[13]=u):u=e[13],u}const ws="setup";function Yb(t){const e=K.c(35);let s;if(e[0]!==t.scriptTabs||e[1]!==t.scripts){let m;e[3]!==t.scriptTabs?(m=p=>!t.scriptTabs.includes(p),e[3]=t.scriptTabs,e[4]=m):m=e[4],s=t.scripts.filter(m),e[0]=t.scriptTabs,e[1]=t.scripts,e[2]=s}else s=e[2];const i=s;let r;e[5]!==t?(r=()=>{t.active===ws?t.onToggle():t.onSelectTab(ws)},e[5]=t,e[6]=r):r=e[6];const o=r,a=t.active===ws;let l;e[7]!==o||e[8]!==t.open||e[9]!==a?(l=n.jsx(Xb,{active:a,open:t.open,onClick:o}),e[7]=o,e[8]=t.open,e[9]=a,e[10]=l):l=e[10];let h;e[11]!==t?(h=t.scriptTabs.map(m=>n.jsx(Zb,{active:t.active===m,onClick:()=>{t.active===m?t.onToggle():t.onSelectTab(m)},onClose:()=>t.onCloseScript(m),children:m},m)),e[11]=t,e[12]=h):h=e[12];let c;e[13]!==i||e[14]!==t.onAddScript?(c=n.jsx(Qb,{scripts:i,onRun:t.onAddScript}),e[13]=i,e[14]=t.onAddScript,e[15]=c):c=e[15];let d;e[16]!==l||e[17]!==h||e[18]!==c?(d=n.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto",children:[l,h,c]}),e[16]=l,e[17]=h,e[18]=c,e[19]=d):d=e[19];let u;e[20]!==t.onRestart||e[21]!==t.onResume||e[22]!==t.onRetry||e[23]!==t.onRunActiveScript||e[24]!==t.onStart||e[25]!==t.onStop||e[26]!==t.onStopActiveScript||e[27]!==t.scriptIsKilling||e[28]!==t.scriptIsRunning||e[29]!==t.showScriptControls||e[30]!==t.status?(u=t.showScriptControls?n.jsx(ey,{isRunning:t.scriptIsRunning,isKilling:t.scriptIsKilling,onRun:t.onRunActiveScript,onStop:t.onStopActiveScript}):n.jsx(Jb,{status:t.status,onStart:t.onStart,onStop:t.onStop,onRestart:t.onRestart,onResume:t.onResume,onRetry:t.onRetry}),e[20]=t.onRestart,e[21]=t.onResume,e[22]=t.onRetry,e[23]=t.onRunActiveScript,e[24]=t.onStart,e[25]=t.onStop,e[26]=t.onStopActiveScript,e[27]=t.scriptIsKilling,e[28]=t.scriptIsRunning,e[29]=t.showScriptControls,e[30]=t.status,e[31]=u):u=e[31];let f;return e[32]!==d||e[33]!==u?(f=n.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-1 border-t border-b border-border bg-muted/60 px-3",children:[d,u]}),e[32]=d,e[33]=u,e[34]=f):f=e[34],f}function Xb(t){const e=K.c(8),{active:s,open:i,onClick:r}=t,o=s&&i,a=s&&i,l=s?"border-border bg-background font-medium text-foreground shadow-sm":"border-transparent text-muted-foreground hover:bg-background/50 hover:text-foreground";let h;e[0]!==l?(h=he("flex h-7 items-center gap-1.5 rounded-md border px-2.5 text-xs",l),e[0]=l,e[1]=h):h=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(tm,{className:"size-3.5"}),e[2]=c):c=e[2];let d;return e[3]!==r||e[4]!==o||e[5]!==a||e[6]!==h?(d=n.jsxs("button",{type:"button","aria-pressed":o,"aria-expanded":a,onClick:r,className:h,children:[c,"sandbox"]}),e[3]=r,e[4]=o,e[5]=a,e[6]=h,e[7]=d):d=e[7],d}function Jb(t){const e=K.c(24),{status:s,onStart:i,onStop:r,onRestart:o,onResume:a,onRetry:l}=t;if(s==="idle"&&i){let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(Vs,{className:"size-3.5"}),e[0]=h):h=e[0];let c;return e[1]!==i?(c=n.jsxs(re,{variant:"outline",size:"sm",onClick:i,children:[h," Start"]}),e[1]=i,e[2]=c):c=e[2],c}if(s==="suspended"&&a){let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(Vs,{className:"size-3.5"}),e[3]=h):h=e[3];let c;return e[4]!==a?(c=n.jsxs(re,{variant:"outline",size:"sm",onClick:a,children:[h," Resume"]}),e[4]=a,e[5]=c):c=e[5],c}if(s==="errored"&&l){let h;e[6]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(Mi,{className:"size-3.5"}),e[6]=h):h=e[6];let c;return e[7]!==l?(c=n.jsxs(re,{variant:"outline",size:"sm",onClick:l,children:[h," Retry"]}),e[7]=l,e[8]=c):c=e[8],c}if(s==="starting"||s==="running"){const h=s==="running"&&!!o,c=h?"rounded-r-none border-r-0":void 0;let d;e[9]!==c?(d=he(c),e[9]=c,e[10]=d):d=e[10];let u;e[11]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(Yc,{className:"size-3.5"}),e[11]=u):u=e[11];let f;e[12]!==r||e[13]!==d?(f=n.jsx(Ee,{asChild:!0,children:n.jsxs(re,{variant:"outline",size:"sm",onClick:r,className:d,children:[u," Stop"]})}),e[12]=r,e[13]=d,e[14]=f):f=e[14];let m;e[15]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(Te,{children:"Stop sandbox"}),e[15]=m):m=e[15];let p;e[16]!==f?(p=n.jsxs(Re,{children:[f,m]}),e[16]=f,e[17]=p):p=e[17];let _;e[18]!==o||e[19]!==h?(_=h&&n.jsxs(As,{children:[n.jsx(Ds,{asChild:!0,children:n.jsx(re,{variant:"outline",size:"sm",className:"rounded-l-none px-1",children:n.jsx(Es,{className:"size-3"})})}),n.jsx(Is,{align:"end",children:n.jsxs(He,{onClick:o,children:[n.jsx(Mi,{className:"size-3.5"})," Restart"]})})]}),e[18]=o,e[19]=h,e[20]=_):_=e[20];let g;return e[21]!==p||e[22]!==_?(g=n.jsxs("div",{className:"flex items-center",children:[p,_]}),e[21]=p,e[22]=_,e[23]=g):g=e[23],g}return null}function Zb(t){const e=K.c(16),{active:s,onClick:i,onClose:r,children:o}=t,a=s?"border-border bg-background shadow-sm":"border-transparent hover:bg-background/50";let l;e[0]!==a?(l=he("flex h-7 items-center rounded-md border text-xs",a),e[0]=a,e[1]=l):l=e[1];const h=r?"pl-2.5 pr-1":"px-2.5",c=s?"font-medium text-foreground":"text-muted-foreground hover:text-foreground";let d;e[2]!==h||e[3]!==c?(d=he("flex h-full items-center",h,c),e[2]=h,e[3]=c,e[4]=d):d=e[4];let u;e[5]!==o||e[6]!==i||e[7]!==d?(u=n.jsx("button",{type:"button",onClick:i,className:d,children:o}),e[5]=o,e[6]=i,e[7]=d,e[8]=u):u=e[8];let f;e[9]!==o||e[10]!==r?(f=r&&n.jsx("button",{type:"button","aria-label":`Close ${o}`,onClick:r,className:"pr-1.5 text-muted-foreground hover:text-foreground",children:n.jsx(bp,{className:"size-3"})}),e[9]=o,e[10]=r,e[11]=f):f=e[11];let m;return e[12]!==l||e[13]!==u||e[14]!==f?(m=n.jsxs("div",{className:l,children:[u,f]}),e[12]=l,e[13]=u,e[14]=f,e[15]=m):m=e[15],m}function Qb(t){const e=K.c(10),{scripts:s,onRun:i}=t,[r,o]=E.useState(!1);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsxs(Re,{children:[n.jsx(Ee,{asChild:!0,children:n.jsx(Rs,{asChild:!0,children:n.jsx(re,{variant:"ghost",size:"sm","aria-label":"Run script",children:n.jsx(xt,{className:"size-3.5"})})})}),n.jsx(Te,{children:"Run script"})]}),e[0]=a):a=e[0];let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx("div",{className:"px-2 py-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:"run a script"}),e[1]=l):l=e[1];let h;e[2]!==i||e[3]!==s?(h=s.length===0?n.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:"No scripts found"}):s.map(u=>n.jsxs("button",{type:"button",onClick:()=>{o(!1),i(u)},className:"w-full rounded-md px-2 py-1.5 text-left text-xs hover:bg-accent",children:["▸ ",u]},u)),e[2]=i,e[3]=s,e[4]=h):h=e[4];let c;e[5]!==h?(c=n.jsxs(Ps,{align:"start",className:"p-1 w-56",children:[l,h]}),e[5]=h,e[6]=c):c=e[6];let d;return e[7]!==r||e[8]!==c?(d=n.jsxs(Ts,{open:r,onOpenChange:o,children:[a,c]}),e[7]=r,e[8]=c,e[9]=d):d=e[9],d}function ey(t){const e=K.c(13),{isRunning:s,isKilling:i,onRun:r,onStop:o}=t;if(i){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsxs(re,{variant:"outline",size:"sm",disabled:!0,children:[n.jsx(Ce,{className:"size-3.5 animate-spin"})," Stopping…"]}),e[0]=d):d=e[0],d}if(!s){let d;e[1]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(Vs,{className:"size-3.5"}),e[1]=d):d=e[1];let u;e[2]!==r?(u=n.jsx(Ee,{asChild:!0,children:n.jsxs(re,{variant:"outline",size:"sm",onClick:r,children:[d," Run"]})}),e[2]=r,e[3]=u):u=e[3];let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(Te,{children:"Start process"}),e[4]=f):f=e[4];let m;return e[5]!==u?(m=n.jsxs(Re,{children:[u,f]}),e[5]=u,e[6]=m):m=e[6],m}let a;e[7]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(Yc,{className:"size-3.5"}),e[7]=a):a=e[7];let l;e[8]!==o?(l=n.jsx(Ee,{asChild:!0,children:n.jsxs(re,{variant:"outline",size:"sm",onClick:o,children:[a," Stop"]})}),e[8]=o,e[9]=l):l=e[9];let h;e[10]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(Te,{children:"Stop process"}),e[10]=h):h=e[10];let c;return e[11]!==l?(c=n.jsxs(Re,{children:[l,h]}),e[11]=l,e[12]=c):c=e[12],c}var Dd=Object.defineProperty,ty=Object.getOwnPropertyDescriptor,sy=(t,e)=>{for(var s in e)Dd(t,s,{get:e[s],enumerable:!0})},ze=(t,e,s,i)=>{for(var r=i>1?void 0:i?ty(e,s):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(i?a(e,s,r):a(r))||r);return i&&r&&Dd(e,s,r),r},de=(t,e)=>(s,i)=>e(s,i,t),Il="Terminal input",so={get:()=>Il,set:t=>Il=t},Bl="Too much output to announce, navigate to rows manually to read",io={get:()=>Bl,set:t=>Bl=t};function iy(t){return t.replace(/\r?\n/g,"\r")}function ry(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function ny(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function oy(t,e,s,i){if(t.stopPropagation(),t.clipboardData){let r=t.clipboardData.getData("text/plain");Id(r,e,s,i)}}function Id(t,e,s,i){t=iy(t),t=ry(t,s.decPrivateModes.bracketedPasteMode&&i.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(t,!0),e.value=""}function Bd(t,e,s){let i=s.getBoundingClientRect(),r=t.clientX-i.left-10,o=t.clientY-i.top-10;e.style.width="20px",e.style.height="20px",e.style.left=`${r}px`,e.style.top=`${o}px`,e.style.zIndex="1000",e.focus()}function Ml(t,e,s,i,r){Bd(t,e,s),r&&i.rightClickSelect(t),e.value=i.selectionText,e.select()}function us(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function un(t,e=0,s=t.length){let i="";for(let r=e;r<s;++r){let o=t[r];o>65535?(o-=65536,i+=String.fromCharCode((o>>10)+55296)+String.fromCharCode(o%1024+56320)):i+=String.fromCharCode(o)}return i}var ay=class{constructor(){this._interim=0}clear(){this._interim=0}decode(t,e){let s=t.length;if(!s)return 0;let i=0,r=0;if(this._interim){let o=t.charCodeAt(r++);56320<=o&&o<=57343?e[i++]=(this._interim-55296)*1024+o-56320+65536:(e[i++]=this._interim,e[i++]=o),this._interim=0}for(let o=r;o<s;++o){let a=t.charCodeAt(o);if(55296<=a&&a<=56319){if(++o>=s)return this._interim=a,i;let l=t.charCodeAt(o);56320<=l&&l<=57343?e[i++]=(a-55296)*1024+l-56320+65536:(e[i++]=a,e[i++]=l);continue}a!==65279&&(e[i++]=a)}return i}},ly=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(t,e){let s=t.length;if(!s)return 0;let i=0,r,o,a,l,h=0,c=0;if(this.interim[0]){let f=!1,m=this.interim[0];m&=(m&224)===192?31:(m&240)===224?15:7;let p=0,_;for(;(_=this.interim[++p]&63)&&p<4;)m<<=6,m|=_;let g=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,v=g-p;for(;c<v;){if(c>=s)return 0;if(_=t[c++],(_&192)!==128){c--,f=!0;break}else this.interim[p++]=_,m<<=6,m|=_&63}f||(g===2?m<128?c--:e[i++]=m:g===3?m<2048||m>=55296&&m<=57343||m===65279||(e[i++]=m):m<65536||m>1114111||(e[i++]=m)),this.interim.fill(0)}let d=s-4,u=c;for(;u<s;){for(;u<d&&!((r=t[u])&128)&&!((o=t[u+1])&128)&&!((a=t[u+2])&128)&&!((l=t[u+3])&128);)e[i++]=r,e[i++]=o,e[i++]=a,e[i++]=l,u+=4;if(r=t[u++],r<128)e[i++]=r;else if((r&224)===192){if(u>=s)return this.interim[0]=r,i;if(o=t[u++],(o&192)!==128){u--;continue}if(h=(r&31)<<6|o&63,h<128){u--;continue}e[i++]=h}else if((r&240)===224){if(u>=s)return this.interim[0]=r,i;if(o=t[u++],(o&192)!==128){u--;continue}if(u>=s)return this.interim[0]=r,this.interim[1]=o,i;if(a=t[u++],(a&192)!==128){u--;continue}if(h=(r&15)<<12|(o&63)<<6|a&63,h<2048||h>=55296&&h<=57343||h===65279)continue;e[i++]=h}else if((r&248)===240){if(u>=s)return this.interim[0]=r,i;if(o=t[u++],(o&192)!==128){u--;continue}if(u>=s)return this.interim[0]=r,this.interim[1]=o,i;if(a=t[u++],(a&192)!==128){u--;continue}if(u>=s)return this.interim[0]=r,this.interim[1]=o,this.interim[2]=a,i;if(l=t[u++],(l&192)!==128){u--;continue}if(h=(r&7)<<18|(o&63)<<12|(a&63)<<6|l&63,h<65536||h>1114111)continue;e[i++]=h}}return i}},Md="",fs=" ",Qi=class Ld{constructor(){this.fg=0,this.bg=0,this.extended=new Vr}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new Ld;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Vr=class Od{constructor(e=0,s=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=s}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new Od(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Nt=class $d extends Qi{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Vr,this.combinedData=""}static fromCharData(e){let s=new $d;return s.setFromCharData(e),s}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?us(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let s=!1;if(e[1].length>2)s=!0;else if(e[1].length===2){let i=e[1].charCodeAt(0);if(55296<=i&&i<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(i-55296)*1024+r-56320+65536|e[2]<<22:s=!0}else s=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;s&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Ll="di$target",ro="di$dependencies",Tn=new Map;function cy(t){return t[ro]||[]}function Qe(t){if(Tn.has(t))return Tn.get(t);let e=function(s,i,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");hy(e,s,r)};return e._id=t,Tn.set(t,e),e}function hy(t,e,s){e[Ll]===e?e[ro].push({id:t,index:s}):(e[ro]=[{id:t,index:s}],e[Ll]=e)}var ct=Qe("BufferService"),zd=Qe("CoreMouseService"),Ls=Qe("CoreService"),dy=Qe("CharsetService"),Ra=Qe("InstantiationService"),Fd=Qe("LogService"),ht=Qe("OptionsService"),Hd=Qe("OscLinkService"),uy=Qe("UnicodeService"),er=Qe("DecorationService"),no=class{constructor(t,e,s){this._bufferService=t,this._optionsService=e,this._oscLinkService=s}provideLinks(t,e){let s=this._bufferService.buffer.lines.get(t-1);if(!s){e(void 0);return}let i=[],r=this._optionsService.rawOptions.linkHandler,o=new Nt,a=s.getTrimmedLength(),l=-1,h=-1,c=!1;for(let d=0;d<a;d++)if(!(h===-1&&!s.hasContent(d))){if(s.loadCell(d,o),o.hasExtendedAttrs()&&o.extended.urlId)if(h===-1){h=d,l=o.extended.urlId;continue}else c=o.extended.urlId!==l;else h!==-1&&(c=!0);if(c||h!==-1&&d===a-1){let u=this._oscLinkService.getLinkData(l)?.uri;if(u){let f={start:{x:h+1,y:t},end:{x:d+(!c&&d===a-1?1:0),y:t}},m=!1;if(!r?.allowNonHttpProtocols)try{let p=new URL(u);["http:","https:"].includes(p.protocol)||(m=!0)}catch{m=!0}m||i.push({text:u,range:f,activate:(p,_)=>r?r.activate(p,_,f):fy(p,_),hover:(p,_)=>r?.hover?.(p,_,f),leave:(p,_)=>r?.leave?.(p,_,f)})}c=!1,o.hasExtendedAttrs()&&o.extended.urlId?(h=d,l=o.extended.urlId):(h=-1,l=-1)}}e(i)}};no=ze([de(0,ct),de(1,ht),de(2,Hd)],no);function fy(t,e){if(confirm(`Do you want to navigate to ${e}?
|
|
294
|
+
`);if(ce.trim()){D(!0);try{se(),Ae("automation_improve_clicked",{automation_id:t,agent_id:r,instructions_length:ce.length}),f(!0),await m({tiptapDoc:Kh({managerAgentId:$c.AUTOMATION_MANAGER(o.id),managerName:"Automation Manager",kind:"automation",id:t,instructions:ce})})}finally{D(!1)}}},O=e.models?.tier??"smart",W=e.models?.modelId&&e.models?.credentialId?{modelId:e.models.modelId,credentialId:e.models.credentialId,title:e.models.modelTitle??e.models.modelId}:null,F=Mc({defaultValues:{name:e.name,active:e.active,tier:O,modelOverride:W,tools:e.tools??null,maxAgentSteps:e.maxAgentSteps??null}}),V=F.watch("active"),[J,G]=E.useReducer(Nb,null),U=()=>{J!==null&&(Ae("automation_updated",{automation_id:t,agent_id:r,fields:Array.from(J.fields),save_count:J.saveCount,edit_duration_ms:Date.now()-J.start}),G({type:"reset"}))},H=async()=>{const z=F.control._formState.dirtyFields,ce=Object.keys(z);if(ce.length===0&&!M)return!0;const ue=F.getValues(),fe=F.control._defaultValues;F.reset(ue,{keepValues:!0});const q=M;B(!1);const te={tier:ue.tier,...ue.modelOverride?{modelId:ue.modelOverride.modelId,credentialId:ue.modelOverride.credentialId,modelTitle:ue.modelOverride.title}:{}},me={id:t,name:ue.name,active:ue.active,models:te,tools:ue.tools,maxAgentSteps:ue.maxAgentSteps,messages:nf(_),temperature:0};try{await a.mutateAsync(me)}catch{return F.reset(fe,{keepValues:!0}),q&&B(!0),!1}const ne=[...ce];return q&&ne.push("messages"),G({type:"accumulate",now:Date.now(),fields:ne}),$(),!0},{schedule:X,flush:oe}=$r({save:H}),{schedule:$,flush:se}=$r({delayMs:3e4,save:async()=>U()});E.useEffect(()=>{const z=F.watch(()=>X());return()=>z.unsubscribe()},[]);const ee=z=>{if(g(z),!N){A(!0);return}B(!0),X()},Q=async()=>{Ae("automation_test_clicked",{automation_id:t,agent_id:r});const z=await oe();if(se(),!!z){if(!_){le.error("No instructions configured for this automation");return}try{const ce=await h.mutateAsync(t);ce.threadId&&(f(!0),u(ce.threadId))}catch{}}};return n.jsxs(n.Fragment,{children:[s&&n.jsx("div",{className:"flex items-center pb-4 shrink-0",children:n.jsxs(re,{variant:"ghost",size:"sm",onClick:s,children:[n.jsx(_h,{size:14}),"Back to list"]})}),n.jsxs("div",{className:"flex flex-col gap-8",children:[n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsxs("div",{className:"flex items-center justify-between gap-4",children:[n.jsx(vt,{control:F.control,name:"name",render:({field:z})=>n.jsx(qe,{...z,placeholder:"Automation name",className:"border border-transparent shadow-none px-0 text-lg font-medium h-auto focus-visible:ring-0 focus-visible:border-border bg-transparent flex-1",style:{boxShadow:"none"}})}),i&&n.jsx(re,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-destructive shrink-0",onClick:i,children:n.jsx(qs,{size:14})})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(vt,{control:F.control,name:"active",render:({field:z})=>n.jsx(Or,{checked:z.value,onCheckedChange:ce=>{z.onChange(ce),oe()},className:"cursor-pointer"})}),n.jsx("span",{className:"text-sm text-muted-foreground",children:V?"Active":"Inactive"}),n.jsx("span",{className:"text-muted-foreground/50 text-sm",children:"·"}),n.jsx(oh,{id:e.created_by,size:"2xs",className:"text-sm text-muted-foreground"})]})]}),n.jsxs("div",{className:"flex flex-col gap-2.5",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Starter"}),n.jsx(wb,{automationId:t,open:v,onOpenChange:b,onCustomSelect:()=>{k(!0),P(!1),R("")},onEventSelect:()=>{P(!0),k(!1)},onWebhookCreated:z=>{Ae("automation_trigger_added",{automation_id:t,trigger_type:"webhook"}),S(z)}})]}),e.triggers.length===0&&!w?n.jsx("div",{className:"rounded-lg border border-dashed border-border px-4 py-6 text-center",children:n.jsxs("p",{className:"text-sm text-muted-foreground",children:["When should this automation run?"," ",n.jsx("button",{type:"button",className:"text-foreground underline underline-offset-2 cursor-pointer hover:text-foreground/80 transition-colors",onClick:()=>b(!0),children:"Add a starter"})," ","to get going."]})}):n.jsx("div",{className:"flex flex-col gap-2",children:e.triggers.map(z=>n.jsx(Cb,{trigger:z,automationId:t,connectionName:z.connection_id?d.get(z.connection_id):void 0},z.id))}),w&&n.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5 rounded-lg border border-border bg-background group",children:[n.jsx(Ri,{size:14,className:"text-muted-foreground shrink-0"}),n.jsx("input",{type:"text",value:j,onChange:z=>R(z.target.value),onBlur:async()=>{const z=j.trim();if(!(!z||!Ii(z)))try{await l.mutateAsync({automation_id:t,type:"cron",cron_expression:z}),Ae("automation_trigger_added",{automation_id:t,trigger_type:"cron"}),le.success("Starter added"),k(!1),R("")}catch{le.error("Failed to add starter")}},onKeyDown:async z=>{const ce=j.trim();z.key==="Enter"&&ce&&Ii(ce)&&z.target.blur(),z.key==="Escape"&&(k(!1),R(""))},placeholder:"0 9 * * 1-5",className:"flex-1 text-sm font-mono bg-transparent outline-none placeholder:text-muted-foreground/40",autoFocus:!0}),j&&!Ii(j)&&n.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:"invalid"}),l.isPending&&n.jsx(Ce,{size:13,className:"animate-spin text-muted-foreground shrink-0"}),n.jsx("button",{type:"button",className:"shrink-0 p-0.5 rounded text-muted-foreground opacity-0 group-hover:opacity-100 hover:text-foreground transition-opacity",onClick:()=>{k(!1),R("")},children:n.jsx(ps,{size:13})})]}),I&&n.jsx(E.Suspense,{fallback:n.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 rounded-lg border border-border bg-background",children:[n.jsx(Ce,{size:13,className:"animate-spin text-muted-foreground"}),n.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading connections..."})]}),children:n.jsx(Eb,{automationId:t,onDone:()=>P(!1)})}),n.jsx(Rd,{open:T!==null,onOpenChange:z=>{z||S(null)},url:T?.url??null,token:T?.token??null})]}),n.jsxs("div",{className:"flex flex-col gap-2.5",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Instructions"}),n.jsxs(re,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:C||!_,onClick:L,children:[n.jsx(Ss,{size:13}),"Improve"]})]}),n.jsx(Zu,{tiptapDoc:_,setTiptapDoc:ee,placeholder:"What should this automation do?",children:n.jsxs("div",{className:"rounded-xl border border-border min-h-[120px] flex flex-col",children:[n.jsx(Qu,{virtualMcpId:r||null,className:"max-h-[45vh]"}),n.jsx("div",{className:"@container/chat-bottom flex items-center justify-end gap-1.5 p-2.5",children:n.jsxs(Re,{children:[n.jsx(Ee,{asChild:!0,children:n.jsxs(re,{type:"button",variant:"default",className:"h-8 gap-1.5 rounded-md px-3 text-sm font-medium",onClick:Q,disabled:!r,children:[n.jsx(np,{size:16}),"Test"]})}),n.jsx(Te,{children:"Test Automation"})]})})]})})]}),n.jsxs(vf,{open:x,onOpenChange:y,className:"flex flex-col gap-2.5",children:[n.jsxs(xf,{className:"group flex w-fit cursor-pointer items-center gap-1.5",children:[n.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Advanced"}),n.jsx(Es,{size:14,className:"text-muted-foreground/60 transition-transform group-data-[state=open]:rotate-180"})]}),n.jsxs(bf,{className:"flex flex-col gap-5 pt-0.5",children:[n.jsx(ab,{tier:F.watch("tier"),onTierChange:z=>F.setValue("tier",z,{shouldDirty:!0}),override:F.watch("modelOverride"),onOverrideChange:z=>F.setValue("modelOverride",z,{shouldDirty:!0})}),n.jsx(db,{agentId:r||null,value:F.watch("tools"),onChange:z=>F.setValue("tools",z,{shouldDirty:!0})}),n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Max steps"}),n.jsx(qe,{type:"number",min:1,max:100,className:"w-40",placeholder:`${jb} (default)`,value:F.watch("maxAgentSteps")??"",onChange:z=>{const ce=z.target.value.trim(),ue=ce===""?null:Number(ce);F.setValue("maxAgentSteps",ue===null||Number.isNaN(ue)?null:ue,{shouldDirty:!0})}})]})]})]})]})]})}function Ys(){const t=K.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{"data-testid":"main-panel-loading",className:"flex h-full w-full items-center justify-center",children:n.jsx(Ce,{size:20,className:"animate-spin text-muted-foreground"})}),t[0]=e):e=t[0],e}const Pd=[{key:"24h",label:"Last 24 hours",ms:1440*60*1e3},{key:"7d",label:"Last 7 days",ms:10080*60*1e3},{key:"30d",label:"Last 30 days",ms:720*60*60*1e3}];function Ad(t){const e=Pd.find(i=>i.key===t).ms,s=Date.now();return{startDate:new Date(s-e).toISOString(),endDate:new Date(s).toISOString()}}function Db(t){const e=K.c(12),{automationId:s,triggerIds:i}=t,[r,o]=E.useState("30d"),[a,l]=E.useState(Bb);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=p=>{const _=p;o(_),l(Ad(_))},e[0]=h):h=e[0];let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(Pt,{className:"w-44",children:n.jsx(At,{})}),e[1]=c):c=e[1];let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(Dt,{children:Pd.map(Ib)}),e[2]=d):d=e[2];let u;e[3]!==r?(u=n.jsx("div",{className:"flex items-center justify-end",children:n.jsxs(It,{value:r,onValueChange:h,children:[c,d]})}),e[3]=r,e[4]=u):u=e[4];let f;e[5]!==s||e[6]!==a||e[7]!==i?(f=n.jsx(vp,{automationId:s,triggerIds:i,range:a}),e[5]=s,e[6]=a,e[7]=i,e[8]=f):f=e[8];let m;return e[9]!==u||e[10]!==f?(m=n.jsxs("div",{className:"flex flex-col gap-5",children:[u,f]}),e[9]=u,e[10]=f,e[11]=m):m=e[11],m}function Ib(t){return n.jsx(nt,{value:t.key,children:t.label},t.key)}function Bb(){return Ad("30d")}function Mb(t){const e=K.c(5),{tabId:s}=t;let i;e[0]!==s?(i=Jc(s),e[0]=s,e[1]=i):i=e[1];const r=i;if(!r)return null;let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(Ys,{}),e[2]=o):o=e[2];let a;return e[3]!==r.id?(a=n.jsx(E.Suspense,{fallback:o,children:n.jsx(Lb,{id:r.id})}),e[3]=r.id,e[4]=a):a=e[4],a}function Lb(t){const e=K.c(24),{id:s}=t,i=ts(),{data:r,isLoading:o}=mp(s),[a,l]=E.useState("settings");let h;e[0]!==i?(h=()=>{i({to:".",search:$b,replace:!0})},e[0]=i,e[1]=h):h=e[1];const c=h;if(o){let y;return e[2]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(Ys,{}),e[2]=y):y=e[2],y}if(!r){let y;return e[3]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx("div",{className:"flex h-full w-full items-center justify-center text-sm text-muted-foreground",children:"Automation not found"}),e[3]=y):y=e[3],y}let d;e[4]!==r.triggers?(d=r.triggers.map(Ob),e[4]=r.triggers,e[5]=d):d=e[5];const u=d;let f;e[6]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(_h,{size:14}),e[6]=f):f=e[6];let m;e[7]!==c?(m=n.jsxs(re,{variant:"ghost",size:"sm",onClick:c,children:[f,"Back to list"]}),e[7]=c,e[8]=m):m=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=[{id:"settings",label:"Settings"},{id:"runs",label:"Runs"}],e[9]=p):p=e[9];let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=y=>l(y),e[10]=_):_=e[10];let g;e[11]!==a?(g=n.jsx(dh,{tabs:p,activeTab:a,onTabChange:_}),e[11]=a,e[12]=g):g=e[12];let v;e[13]!==m||e[14]!==g?(v=n.jsxs("div",{className:"flex items-center justify-between pb-4 shrink-0",children:[m,g]}),e[13]=m,e[14]=g,e[15]=v):v=e[15];let b;e[16]!==r||e[17]!==s||e[18]!==a||e[19]!==u?(b=a==="settings"?n.jsx(Ab,{automationId:s,automation:r}):n.jsx(Db,{automationId:s,triggerIds:u}),e[16]=r,e[17]=s,e[18]=a,e[19]=u,e[20]=b):b=e[20];let x;return e[21]!==v||e[22]!==b?(x=n.jsx(Rt,{children:n.jsx(Rt.Content,{children:n.jsxs(Rt.Body,{children:[v,b]})})}),e[21]=v,e[22]=b,e[23]=x):x=e[23],x}function Ob(t){return t.id}function $b(t){return{...t,main:"automations"}}function zb(t){const e=K.c(20),{virtualMcpId:s}=t,i=ts(),{data:r}=pp(s),o=r===void 0?[]:r,{create:a}=Xi(),[l,h]=E.useState(""),c=l.toLowerCase(),d=o.filter(T=>T.name.toLowerCase().includes(c));let u;e[0]!==i?(u=T=>i({to:".",search:S=>({...S,main:"automation:"+T}),replace:!0}),e[0]=i,e[1]=u):u=e[1];const f=u,m=async()=>{if(a.isPending)return;Ae("automation_new_clicked",{virtual_mcp_id:s,existing_count:o.length});const T=await a.mutateAsync(_p(s));f(T.id)};let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx(xt,{size:14}),e[2]=p):p=e[2];let _;e[3]!==a.isPending||e[4]!==m?(_=n.jsxs(re,{size:"sm",onClick:m,disabled:a.isPending,children:[p,"New automation"]}),e[3]=a.isPending,e[4]=m,e[5]=_):_=e[5];const g=_,v=Rt,b=Rt,x=Rt;let y;e[6]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(Rt.Title,{children:"Automations"}),e[6]=y):y=e[6];const w=o.length>0&&n.jsx(hh,{value:l,onChange:h,placeholder:"Search automations...",className:"w-full md:w-[375px]"});let k;e[7]!==g||e[8]!==w?(k=n.jsxs("div",{className:"flex flex-col gap-6",children:[y,n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[w,g]})]}),e[7]=g,e[8]=w,e[9]=k):k=e[9];const j=o.length===0?n.jsx("div",{className:"flex items-center justify-center py-20",children:n.jsx(Er,{image:n.jsx(zi,{size:48,className:"text-muted-foreground"}),title:"No automations yet",description:"Create your first automation to run this agent on a schedule or in response to events.",actions:g})}):d.length===0?n.jsx("div",{className:"flex items-center justify-center py-20",children:n.jsx(Er,{image:n.jsx(zi,{size:48,className:"text-muted-foreground"}),title:"No automations found",description:`No automations match "${l}"`})}):n.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:d.map(T=>n.jsx(xp,{automation:T,onClick:()=>f(T.id)},T.id))});let R;e[10]!==j||e[11]!==x.Body||e[12]!==k?(R=n.jsxs(x.Body,{children:[k,j]}),e[10]=j,e[11]=x.Body,e[12]=k,e[13]=R):R=e[13];let I;e[14]!==R||e[15]!==b.Content?(I=n.jsx(b.Content,{children:R}),e[14]=R,e[15]=b.Content,e[16]=I):I=e[16];let P;return e[17]!==v||e[18]!==I?(P=n.jsx(v,{children:I}),e[17]=v,e[18]=I,e[19]=P):P=e[19],P}function Fb(t){const e=K.c(3),{virtualMcpId:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(Ys,{}),e[0]=i):i=e[0];let r;return e[1]!==s?(r=n.jsx(E.Suspense,{fallback:i,children:n.jsx(zb,{virtualMcpId:s})}),e[1]=s,e[2]=r):r=e[2],r}function Hb(t){const e=K.c(37),{file:s,onClose:i}=t;let r,o;e[0]!==s.filename?(r=n.jsx(Oi,{filename:s.filename,className:"h-4.5 w-3.5 shrink-0"}),o=n.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:s.filename}),e[0]=s.filename,e[1]=r,e[2]=o):(r=e[1],o=e[2]);let a;e[3]!==s.size?(a=km(s.size),e[3]=s.size,e[4]=a):a=e[4];let l;e[5]!==a?(l=n.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:a}),e[5]=a,e[6]=l):l=e[6];let h;e[7]!==r||e[8]!==o||e[9]!==l?(h=n.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 px-2",children:[r,o,l]}),e[7]=r,e[8]=o,e[9]=l,e[10]=h):h=e[10];let c;e[11]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(mm,{size:14}),e[11]=c):c=e[11];let d;e[12]!==s.downloadUrl||e[13]!==s.filename?(d=n.jsx(Ee,{asChild:!0,children:n.jsx(re,{variant:"ghost",size:"icon",asChild:!0,children:n.jsx("a",{href:s.downloadUrl,download:s.filename,children:c})})}),e[12]=s.downloadUrl,e[13]=s.filename,e[14]=d):d=e[14];let u;e[15]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(Te,{side:"bottom",children:"Download"}),e[15]=u):u=e[15];let f;e[16]!==d?(f=n.jsxs(Re,{children:[d,u]}),e[16]=d,e[17]=f):f=e[17];let m;e[18]!==s.downloadUrl?(m=()=>window.open(s.downloadUrl,"_blank","noopener"),e[18]=s.downloadUrl,e[19]=m):m=e[19];let p;e[20]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx(ri,{size:14}),e[20]=p):p=e[20];let _;e[21]!==m?(_=n.jsx(Ee,{asChild:!0,children:n.jsx(re,{variant:"ghost",size:"icon",onClick:m,children:p})}),e[21]=m,e[22]=_):_=e[22];let g;e[23]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(Te,{side:"bottom",children:"Open in new tab"}),e[23]=g):g=e[23];let v;e[24]!==_?(v=n.jsxs(Re,{children:[_,g]}),e[24]=_,e[25]=v):v=e[25];let b;e[26]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx(ps,{size:14}),e[26]=b):b=e[26];let x;e[27]!==i?(x=n.jsx(Ee,{asChild:!0,children:n.jsx(re,{variant:"ghost",size:"icon",onClick:i,children:b})}),e[27]=i,e[28]=x):x=e[28];let y;e[29]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(Te,{side:"bottom",children:"Close"}),e[29]=y):y=e[29];let w;e[30]!==x?(w=n.jsxs(Re,{children:[x,y]}),e[30]=x,e[31]=w):w=e[31];let k;return e[32]!==v||e[33]!==w||e[34]!==h||e[35]!==f?(k=n.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-1 border-b border-border/60 px-2",children:[h,f,v,w]}),e[32]=v,e[33]=w,e[34]=h,e[35]=f,e[36]=k):k=e[36],k}function Wb(t){const e=K.c(24),{fileKey:s,taskId:i}=t,r=ts(),{data:o,isPending:a}=Fc(i);let l;e[0]!==s||e[1]!==o?(l=o?.find(p=>p.key===s)??null,e[0]=s,e[1]=o,e[2]=l):l=e[2];const h=l;let c;e[3]!==r?(c=()=>r({to:".",search:Ub,replace:!0}),e[3]=r,e[4]=c):c=e[4];const d=c;if(!h){if(a){let x;return e[5]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx("div",{className:"h-full w-full bg-background",children:n.jsx(wm,{})}),e[5]=x):x=e[5],x}let p;e[6]!==s?(p=s.split("/").pop()??s,e[6]=s,e[7]=p):p=e[7];let _;e[8]!==p?(_=n.jsx(Oi,{filename:p,className:"h-7.5 w-6"}),e[8]=p,e[9]=_):_=e[9];let g;e[10]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx("span",{className:"text-sm text-muted-foreground",children:"This file is no longer available."}),e[10]=g):g=e[10];let v;e[11]!==d?(v=n.jsx(re,{variant:"ghost",size:"sm",onClick:d,children:"Close"}),e[11]=d,e[12]=v):v=e[12];let b;return e[13]!==_||e[14]!==v?(b=n.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 bg-background",children:[_,g,v]}),e[13]=_,e[14]=v,e[15]=b):b=e[15],b}let u;e[16]!==h||e[17]!==d?(u=n.jsx(Hb,{file:h,onClose:d}),e[16]=h,e[17]=d,e[18]=u):u=e[18];let f;e[19]!==h?(f=n.jsx("div",{className:"relative min-h-0 flex-1",children:n.jsx(Cm,{file:h})}),e[19]=h,e[20]=f):f=e[20];let m;return e[21]!==u||e[22]!==f?(m=n.jsxs("div",{className:"flex h-full w-full flex-col bg-background",children:[u,f]}),e[21]=u,e[22]=f,e[23]=m):m=e[23],m}function Ub(t){return{...t,main:"0"}}const Al="home";function Kb(t){const e=K.c(5),{label:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(uh,{className:"aspect-video w-2/3 max-w-xl"}),e[0]=i):i=e[0];let r;e[1]!==s?(r=s&&n.jsx("p",{className:"text-xs text-muted-foreground",children:s}),e[1]=s,e[2]=r):r=e[2];let o;return e[3]!==r?(o=n.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-3 bg-background",children:[i,r]}),e[3]=r,e[4]=o):o=e[4],o}function Vb(t){const e=K.c(12),{path:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={refetchIntervalWhenAbsent:2e3},e[0]=i):i=e[0];const r=jm(Al,s,i),o=Nm(Al);let a;e[1]!==s||e[2]!==o?(a=o(s),e[1]=s,e[2]=o,e[3]=a):a=e[3];const l=a;if(r.isPending||!r.data){const d=!r.isPending&&!r.data?"Waiting for the deck to sync…":void 0;let u;return e[4]!==d?(u=n.jsx(Kb,{label:d}),e[4]=d,e[5]=u):u=e[5],u}let h;e[6]!==r.data?(h=Em(r.data),e[6]=r.data,e[7]=h):h=e[7];let c;return e[8]!==s||e[9]!==l||e[10]!==h?(c=n.jsx(Tm,{readUrl:l,marker:h,title:s,savePath:s}),e[8]=s,e[9]=l,e[10]=h,e[11]=c):c=e[11],c}const Dl=E.lazy(()=>qt(()=>import("./project-app-view-DRmpbQZp.js"),__vite__mapDeps([164,1,2,98,6,7,8,9,10,11,12,13,14,15,16,3,17,4,5,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,99,100,46,47,48,101,102,49,103,104,58,59,93,94,95,96,97,57,79,60,78,105,106,107,108,109,67,110,56,111,72,73,50,112,127])).then(t=>({default:t.AppViewContent})));function qb(t){const e=K.c(49),{activeTab:s,virtualMcpId:i,taskId:r,layoutTabs:o,expandedTools:a,automationTabParsed:l}=t;if(lm(s)){let v;return e[0]!==i?(v=n.jsx(gl,{virtualMcpId:i}),e[0]=i,e[1]=v):v=e[1],v}if(s==="git"){let v;return e[2]!==i?(v=n.jsx(r1,{virtualMcpId:i}),e[2]=i,e[3]=v):v=e[3],v}if(s==="automations"){let v;return e[4]!==i?(v=n.jsx(Fb,{virtualMcpId:i}),e[4]=i,e[5]=v):v=e[5],v}if(s==="preview"){let v;return e[6]!==i?(v=n.jsx(q1,{virtualMcpId:i}),e[6]=i,e[7]=v):v=e[7],v}if(s==="content"){let v;return e[8]!==i?(v=n.jsx(rb,{virtualMcpId:i}),e[8]=i,e[9]=v):v=e[9],v}if(l){let v;return e[10]!==s?(v=n.jsx(Mb,{tabId:s}),e[10]=s,e[11]=v):v=e[11],v}let h;e[12]!==s?(h=Qc(s),e[12]=s,e[13]=h):h=e[13];const c=h;if(c){let v;return e[14]!==c.path?(v=n.jsx(Vb,{path:c.path},c.path),e[14]=c.path,e[15]=v):v=e[15],v}let d;e[16]!==s?(d=Zc(s),e[16]=s,e[17]=d):d=e[17];const u=d;if(u){let v;return e[18]!==u.key||e[19]!==r?(v=n.jsx(Wb,{fileKey:u.key,taskId:r}),e[18]=u.key,e[19]=r,e[20]=v):v=e[20],v}let f;e[21]!==s?(f=cm(s),e[21]=s,e[22]=f):f=e[22];const m=f;if(m){let v;if(e[23]!==a||e[24]!==m.connectionId||e[25]!==m.toolName){let k;e[27]!==m.connectionId||e[28]!==m.toolName?(k=j=>j.appId===m.connectionId&&j.toolName===m.toolName,e[27]=m.connectionId,e[28]=m.toolName,e[29]=k):k=e[29],v=a.find(k),e[23]=a,e[24]=m.connectionId,e[25]=m.toolName,e[26]=v}else v=e[26];const b=v;let x;e[30]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx(Ys,{}),e[30]=x):x=e[30];const y=b?.args;let w;return e[31]!==s||e[32]!==m.connectionId||e[33]!==m.toolName||e[34]!==y?(w=n.jsx(E.Suspense,{fallback:x,children:n.jsx(Dl,{connectionId:m.connectionId,toolName:m.toolName,args:y},s)}),e[31]=s,e[32]=m.connectionId,e[33]=m.toolName,e[34]=y,e[35]=w):w=e[35],w}let p;if(e[36]!==s||e[37]!==o){let v;e[39]!==s?(v=b=>b.id===s,e[39]=s,e[40]=v):v=e[40],p=o.find(v),e[36]=s,e[37]=o,e[38]=p}else p=e[38];const _=p;if(_){let v;e[41]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx(Ys,{}),e[41]=v):v=e[41];let b;return e[42]!==s||e[43]!==_.id||e[44]!==_.view.appId||e[45]!==_.view.args?(b=n.jsx(E.Suspense,{fallback:v,children:n.jsx(Dl,{connectionId:_.view.appId,toolName:_.id,args:_.view.args},s)}),e[42]=s,e[43]=_.id,e[44]=_.view.appId,e[45]=_.view.args,e[46]=b):b=e[46],b}let g;return e[47]!==i?(g=n.jsx(gl,{virtualMcpId:i}),e[47]=i,e[48]=g):g=e[48],g}function Gb(t){const e=K.c(14),{taskId:s,virtualMcpId:i}=t;let r;e[0]!==s||e[1]!==i?(r={virtualMcpId:i,taskId:s},e[0]=s,e[1]=i,e[2]=r):r=e[2];const{activeTab:o,layoutTabs:a,expandedTools:l,automationTabParsed:h}=Uh(r);let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(Ys,{}),e[3]=c):c=e[3];let d;e[4]!==o||e[5]!==h||e[6]!==l||e[7]!==a||e[8]!==s||e[9]!==i?(d=n.jsx(E.Suspense,{fallback:c,children:n.jsx(qb,{activeTab:o,virtualMcpId:i,taskId:s,layoutTabs:a,expandedTools:l,automationTabParsed:h})}),e[4]=o,e[5]=h,e[6]=l,e[7]=a,e[8]=s,e[9]=i,e[10]=d):d=e[10];let u;return e[11]!==o||e[12]!==d?(u=n.jsx(Ut,{children:d},o),e[11]=o,e[12]=d,e[13]=u):u=e[13],u}const ws="setup";function Yb(t){const e=K.c(35);let s;if(e[0]!==t.scriptTabs||e[1]!==t.scripts){let m;e[3]!==t.scriptTabs?(m=p=>!t.scriptTabs.includes(p),e[3]=t.scriptTabs,e[4]=m):m=e[4],s=t.scripts.filter(m),e[0]=t.scriptTabs,e[1]=t.scripts,e[2]=s}else s=e[2];const i=s;let r;e[5]!==t?(r=()=>{t.active===ws?t.onToggle():t.onSelectTab(ws)},e[5]=t,e[6]=r):r=e[6];const o=r,a=t.active===ws;let l;e[7]!==o||e[8]!==t.open||e[9]!==a?(l=n.jsx(Xb,{active:a,open:t.open,onClick:o}),e[7]=o,e[8]=t.open,e[9]=a,e[10]=l):l=e[10];let h;e[11]!==t?(h=t.scriptTabs.map(m=>n.jsx(Zb,{active:t.active===m,onClick:()=>{t.active===m?t.onToggle():t.onSelectTab(m)},onClose:()=>t.onCloseScript(m),children:m},m)),e[11]=t,e[12]=h):h=e[12];let c;e[13]!==i||e[14]!==t.onAddScript?(c=n.jsx(Qb,{scripts:i,onRun:t.onAddScript}),e[13]=i,e[14]=t.onAddScript,e[15]=c):c=e[15];let d;e[16]!==l||e[17]!==h||e[18]!==c?(d=n.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto",children:[l,h,c]}),e[16]=l,e[17]=h,e[18]=c,e[19]=d):d=e[19];let u;e[20]!==t.onRestart||e[21]!==t.onResume||e[22]!==t.onRetry||e[23]!==t.onRunActiveScript||e[24]!==t.onStart||e[25]!==t.onStop||e[26]!==t.onStopActiveScript||e[27]!==t.scriptIsKilling||e[28]!==t.scriptIsRunning||e[29]!==t.showScriptControls||e[30]!==t.status?(u=t.showScriptControls?n.jsx(ey,{isRunning:t.scriptIsRunning,isKilling:t.scriptIsKilling,onRun:t.onRunActiveScript,onStop:t.onStopActiveScript}):n.jsx(Jb,{status:t.status,onStart:t.onStart,onStop:t.onStop,onRestart:t.onRestart,onResume:t.onResume,onRetry:t.onRetry}),e[20]=t.onRestart,e[21]=t.onResume,e[22]=t.onRetry,e[23]=t.onRunActiveScript,e[24]=t.onStart,e[25]=t.onStop,e[26]=t.onStopActiveScript,e[27]=t.scriptIsKilling,e[28]=t.scriptIsRunning,e[29]=t.showScriptControls,e[30]=t.status,e[31]=u):u=e[31];let f;return e[32]!==d||e[33]!==u?(f=n.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-1 border-t border-b border-border bg-muted/60 px-3",children:[d,u]}),e[32]=d,e[33]=u,e[34]=f):f=e[34],f}function Xb(t){const e=K.c(8),{active:s,open:i,onClick:r}=t,o=s&&i,a=s&&i,l=s?"border-border bg-background font-medium text-foreground shadow-sm":"border-transparent text-muted-foreground hover:bg-background/50 hover:text-foreground";let h;e[0]!==l?(h=he("flex h-7 items-center gap-1.5 rounded-md border px-2.5 text-xs",l),e[0]=l,e[1]=h):h=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(tm,{className:"size-3.5"}),e[2]=c):c=e[2];let d;return e[3]!==r||e[4]!==o||e[5]!==a||e[6]!==h?(d=n.jsxs("button",{type:"button","aria-pressed":o,"aria-expanded":a,onClick:r,className:h,children:[c,"sandbox"]}),e[3]=r,e[4]=o,e[5]=a,e[6]=h,e[7]=d):d=e[7],d}function Jb(t){const e=K.c(24),{status:s,onStart:i,onStop:r,onRestart:o,onResume:a,onRetry:l}=t;if(s==="idle"&&i){let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(Vs,{className:"size-3.5"}),e[0]=h):h=e[0];let c;return e[1]!==i?(c=n.jsxs(re,{variant:"outline",size:"sm",onClick:i,children:[h," Start"]}),e[1]=i,e[2]=c):c=e[2],c}if(s==="suspended"&&a){let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(Vs,{className:"size-3.5"}),e[3]=h):h=e[3];let c;return e[4]!==a?(c=n.jsxs(re,{variant:"outline",size:"sm",onClick:a,children:[h," Resume"]}),e[4]=a,e[5]=c):c=e[5],c}if(s==="errored"&&l){let h;e[6]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(Mi,{className:"size-3.5"}),e[6]=h):h=e[6];let c;return e[7]!==l?(c=n.jsxs(re,{variant:"outline",size:"sm",onClick:l,children:[h," Retry"]}),e[7]=l,e[8]=c):c=e[8],c}if(s==="starting"||s==="running"){const h=s==="running"&&!!o,c=h?"rounded-r-none border-r-0":void 0;let d;e[9]!==c?(d=he(c),e[9]=c,e[10]=d):d=e[10];let u;e[11]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(Yc,{className:"size-3.5"}),e[11]=u):u=e[11];let f;e[12]!==r||e[13]!==d?(f=n.jsx(Ee,{asChild:!0,children:n.jsxs(re,{variant:"outline",size:"sm",onClick:r,className:d,children:[u," Stop"]})}),e[12]=r,e[13]=d,e[14]=f):f=e[14];let m;e[15]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(Te,{children:"Stop sandbox"}),e[15]=m):m=e[15];let p;e[16]!==f?(p=n.jsxs(Re,{children:[f,m]}),e[16]=f,e[17]=p):p=e[17];let _;e[18]!==o||e[19]!==h?(_=h&&n.jsxs(As,{children:[n.jsx(Ds,{asChild:!0,children:n.jsx(re,{variant:"outline",size:"sm",className:"rounded-l-none px-1",children:n.jsx(Es,{className:"size-3"})})}),n.jsx(Is,{align:"end",children:n.jsxs(He,{onClick:o,children:[n.jsx(Mi,{className:"size-3.5"})," Restart"]})})]}),e[18]=o,e[19]=h,e[20]=_):_=e[20];let g;return e[21]!==p||e[22]!==_?(g=n.jsxs("div",{className:"flex items-center",children:[p,_]}),e[21]=p,e[22]=_,e[23]=g):g=e[23],g}return null}function Zb(t){const e=K.c(16),{active:s,onClick:i,onClose:r,children:o}=t,a=s?"border-border bg-background shadow-sm":"border-transparent hover:bg-background/50";let l;e[0]!==a?(l=he("flex h-7 items-center rounded-md border text-xs",a),e[0]=a,e[1]=l):l=e[1];const h=r?"pl-2.5 pr-1":"px-2.5",c=s?"font-medium text-foreground":"text-muted-foreground hover:text-foreground";let d;e[2]!==h||e[3]!==c?(d=he("flex h-full items-center",h,c),e[2]=h,e[3]=c,e[4]=d):d=e[4];let u;e[5]!==o||e[6]!==i||e[7]!==d?(u=n.jsx("button",{type:"button",onClick:i,className:d,children:o}),e[5]=o,e[6]=i,e[7]=d,e[8]=u):u=e[8];let f;e[9]!==o||e[10]!==r?(f=r&&n.jsx("button",{type:"button","aria-label":`Close ${o}`,onClick:r,className:"pr-1.5 text-muted-foreground hover:text-foreground",children:n.jsx(bp,{className:"size-3"})}),e[9]=o,e[10]=r,e[11]=f):f=e[11];let m;return e[12]!==l||e[13]!==u||e[14]!==f?(m=n.jsxs("div",{className:l,children:[u,f]}),e[12]=l,e[13]=u,e[14]=f,e[15]=m):m=e[15],m}function Qb(t){const e=K.c(10),{scripts:s,onRun:i}=t,[r,o]=E.useState(!1);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsxs(Re,{children:[n.jsx(Ee,{asChild:!0,children:n.jsx(Rs,{asChild:!0,children:n.jsx(re,{variant:"ghost",size:"sm","aria-label":"Run script",children:n.jsx(xt,{className:"size-3.5"})})})}),n.jsx(Te,{children:"Run script"})]}),e[0]=a):a=e[0];let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx("div",{className:"px-2 py-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:"run a script"}),e[1]=l):l=e[1];let h;e[2]!==i||e[3]!==s?(h=s.length===0?n.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:"No scripts found"}):s.map(u=>n.jsxs("button",{type:"button",onClick:()=>{o(!1),i(u)},className:"w-full rounded-md px-2 py-1.5 text-left text-xs hover:bg-accent",children:["▸ ",u]},u)),e[2]=i,e[3]=s,e[4]=h):h=e[4];let c;e[5]!==h?(c=n.jsxs(Ps,{align:"start",className:"p-1 w-56",children:[l,h]}),e[5]=h,e[6]=c):c=e[6];let d;return e[7]!==r||e[8]!==c?(d=n.jsxs(Ts,{open:r,onOpenChange:o,children:[a,c]}),e[7]=r,e[8]=c,e[9]=d):d=e[9],d}function ey(t){const e=K.c(13),{isRunning:s,isKilling:i,onRun:r,onStop:o}=t;if(i){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsxs(re,{variant:"outline",size:"sm",disabled:!0,children:[n.jsx(Ce,{className:"size-3.5 animate-spin"})," Stopping…"]}),e[0]=d):d=e[0],d}if(!s){let d;e[1]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(Vs,{className:"size-3.5"}),e[1]=d):d=e[1];let u;e[2]!==r?(u=n.jsx(Ee,{asChild:!0,children:n.jsxs(re,{variant:"outline",size:"sm",onClick:r,children:[d," Run"]})}),e[2]=r,e[3]=u):u=e[3];let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(Te,{children:"Start process"}),e[4]=f):f=e[4];let m;return e[5]!==u?(m=n.jsxs(Re,{children:[u,f]}),e[5]=u,e[6]=m):m=e[6],m}let a;e[7]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(Yc,{className:"size-3.5"}),e[7]=a):a=e[7];let l;e[8]!==o?(l=n.jsx(Ee,{asChild:!0,children:n.jsxs(re,{variant:"outline",size:"sm",onClick:o,children:[a," Stop"]})}),e[8]=o,e[9]=l):l=e[9];let h;e[10]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(Te,{children:"Stop process"}),e[10]=h):h=e[10];let c;return e[11]!==l?(c=n.jsxs(Re,{children:[l,h]}),e[11]=l,e[12]=c):c=e[12],c}var Dd=Object.defineProperty,ty=Object.getOwnPropertyDescriptor,sy=(t,e)=>{for(var s in e)Dd(t,s,{get:e[s],enumerable:!0})},ze=(t,e,s,i)=>{for(var r=i>1?void 0:i?ty(e,s):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(i?a(e,s,r):a(r))||r);return i&&r&&Dd(e,s,r),r},de=(t,e)=>(s,i)=>e(s,i,t),Il="Terminal input",so={get:()=>Il,set:t=>Il=t},Bl="Too much output to announce, navigate to rows manually to read",io={get:()=>Bl,set:t=>Bl=t};function iy(t){return t.replace(/\r?\n/g,"\r")}function ry(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function ny(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function oy(t,e,s,i){if(t.stopPropagation(),t.clipboardData){let r=t.clipboardData.getData("text/plain");Id(r,e,s,i)}}function Id(t,e,s,i){t=iy(t),t=ry(t,s.decPrivateModes.bracketedPasteMode&&i.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(t,!0),e.value=""}function Bd(t,e,s){let i=s.getBoundingClientRect(),r=t.clientX-i.left-10,o=t.clientY-i.top-10;e.style.width="20px",e.style.height="20px",e.style.left=`${r}px`,e.style.top=`${o}px`,e.style.zIndex="1000",e.focus()}function Ml(t,e,s,i,r){Bd(t,e,s),r&&i.rightClickSelect(t),e.value=i.selectionText,e.select()}function us(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function un(t,e=0,s=t.length){let i="";for(let r=e;r<s;++r){let o=t[r];o>65535?(o-=65536,i+=String.fromCharCode((o>>10)+55296)+String.fromCharCode(o%1024+56320)):i+=String.fromCharCode(o)}return i}var ay=class{constructor(){this._interim=0}clear(){this._interim=0}decode(t,e){let s=t.length;if(!s)return 0;let i=0,r=0;if(this._interim){let o=t.charCodeAt(r++);56320<=o&&o<=57343?e[i++]=(this._interim-55296)*1024+o-56320+65536:(e[i++]=this._interim,e[i++]=o),this._interim=0}for(let o=r;o<s;++o){let a=t.charCodeAt(o);if(55296<=a&&a<=56319){if(++o>=s)return this._interim=a,i;let l=t.charCodeAt(o);56320<=l&&l<=57343?e[i++]=(a-55296)*1024+l-56320+65536:(e[i++]=a,e[i++]=l);continue}a!==65279&&(e[i++]=a)}return i}},ly=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(t,e){let s=t.length;if(!s)return 0;let i=0,r,o,a,l,h=0,c=0;if(this.interim[0]){let f=!1,m=this.interim[0];m&=(m&224)===192?31:(m&240)===224?15:7;let p=0,_;for(;(_=this.interim[++p]&63)&&p<4;)m<<=6,m|=_;let g=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,v=g-p;for(;c<v;){if(c>=s)return 0;if(_=t[c++],(_&192)!==128){c--,f=!0;break}else this.interim[p++]=_,m<<=6,m|=_&63}f||(g===2?m<128?c--:e[i++]=m:g===3?m<2048||m>=55296&&m<=57343||m===65279||(e[i++]=m):m<65536||m>1114111||(e[i++]=m)),this.interim.fill(0)}let d=s-4,u=c;for(;u<s;){for(;u<d&&!((r=t[u])&128)&&!((o=t[u+1])&128)&&!((a=t[u+2])&128)&&!((l=t[u+3])&128);)e[i++]=r,e[i++]=o,e[i++]=a,e[i++]=l,u+=4;if(r=t[u++],r<128)e[i++]=r;else if((r&224)===192){if(u>=s)return this.interim[0]=r,i;if(o=t[u++],(o&192)!==128){u--;continue}if(h=(r&31)<<6|o&63,h<128){u--;continue}e[i++]=h}else if((r&240)===224){if(u>=s)return this.interim[0]=r,i;if(o=t[u++],(o&192)!==128){u--;continue}if(u>=s)return this.interim[0]=r,this.interim[1]=o,i;if(a=t[u++],(a&192)!==128){u--;continue}if(h=(r&15)<<12|(o&63)<<6|a&63,h<2048||h>=55296&&h<=57343||h===65279)continue;e[i++]=h}else if((r&248)===240){if(u>=s)return this.interim[0]=r,i;if(o=t[u++],(o&192)!==128){u--;continue}if(u>=s)return this.interim[0]=r,this.interim[1]=o,i;if(a=t[u++],(a&192)!==128){u--;continue}if(u>=s)return this.interim[0]=r,this.interim[1]=o,this.interim[2]=a,i;if(l=t[u++],(l&192)!==128){u--;continue}if(h=(r&7)<<18|(o&63)<<12|(a&63)<<6|l&63,h<65536||h>1114111)continue;e[i++]=h}}return i}},Md="",fs=" ",Qi=class Ld{constructor(){this.fg=0,this.bg=0,this.extended=new Vr}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new Ld;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Vr=class Od{constructor(e=0,s=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=s}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new Od(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Nt=class $d extends Qi{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Vr,this.combinedData=""}static fromCharData(e){let s=new $d;return s.setFromCharData(e),s}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?us(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let s=!1;if(e[1].length>2)s=!0;else if(e[1].length===2){let i=e[1].charCodeAt(0);if(55296<=i&&i<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(i-55296)*1024+r-56320+65536|e[2]<<22:s=!0}else s=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;s&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Ll="di$target",ro="di$dependencies",Tn=new Map;function cy(t){return t[ro]||[]}function Qe(t){if(Tn.has(t))return Tn.get(t);let e=function(s,i,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");hy(e,s,r)};return e._id=t,Tn.set(t,e),e}function hy(t,e,s){e[Ll]===e?e[ro].push({id:t,index:s}):(e[ro]=[{id:t,index:s}],e[Ll]=e)}var ct=Qe("BufferService"),zd=Qe("CoreMouseService"),Ls=Qe("CoreService"),dy=Qe("CharsetService"),Ra=Qe("InstantiationService"),Fd=Qe("LogService"),ht=Qe("OptionsService"),Hd=Qe("OscLinkService"),uy=Qe("UnicodeService"),er=Qe("DecorationService"),no=class{constructor(t,e,s){this._bufferService=t,this._optionsService=e,this._oscLinkService=s}provideLinks(t,e){let s=this._bufferService.buffer.lines.get(t-1);if(!s){e(void 0);return}let i=[],r=this._optionsService.rawOptions.linkHandler,o=new Nt,a=s.getTrimmedLength(),l=-1,h=-1,c=!1;for(let d=0;d<a;d++)if(!(h===-1&&!s.hasContent(d))){if(s.loadCell(d,o),o.hasExtendedAttrs()&&o.extended.urlId)if(h===-1){h=d,l=o.extended.urlId;continue}else c=o.extended.urlId!==l;else h!==-1&&(c=!0);if(c||h!==-1&&d===a-1){let u=this._oscLinkService.getLinkData(l)?.uri;if(u){let f={start:{x:h+1,y:t},end:{x:d+(!c&&d===a-1?1:0),y:t}},m=!1;if(!r?.allowNonHttpProtocols)try{let p=new URL(u);["http:","https:"].includes(p.protocol)||(m=!0)}catch{m=!0}m||i.push({text:u,range:f,activate:(p,_)=>r?r.activate(p,_,f):fy(p,_),hover:(p,_)=>r?.hover?.(p,_,f),leave:(p,_)=>r?.leave?.(p,_,f)})}c=!1,o.hasExtendedAttrs()&&o.extended.urlId?(h=d,l=o.extended.urlId):(h=-1,l=-1)}}e(i)}};no=ze([de(0,ct),de(1,ht),de(2,Hd)],no);function fy(t,e){if(confirm(`Do you want to navigate to ${e}?
|
|
295
295
|
|
|
296
296
|
WARNING: This link could potentially be dangerous`)){let s=window.open();if(s){try{s.opener=null}catch{}s.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}var fn=Qe("CharSizeService"),ns=Qe("CoreBrowserService"),Pa=Qe("MouseService"),os=Qe("RenderService"),my=Qe("SelectionService"),Wd=Qe("CharacterJoinerService"),ci=Qe("ThemeService"),Ud=Qe("LinkProviderService"),py=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?Ol.isErrorNoTelemetry(t)?new Ol(t.message+`
|
|
297
297
|
|