decocms 4.533.1 → 4.533.3
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/{ActiveShapeUtils-BZzgQ5LK.js → ActiveShapeUtils-CdXsV3S7.js} +1 -1
- package/dist/client/assets/{AlertCircle-z_mH1AoL.js → AlertCircle-3zlHk1bR.js} +1 -1
- package/dist/client/assets/{AreaChart-B9Drqw7P.js → AreaChart-abAlkUS3.js} +1 -1
- package/dist/client/assets/{ArrowLeft-CMDDtfl3.js → ArrowLeft-DmLRalOz.js} +1 -1
- package/dist/client/assets/{ArrowUp-9eveOGWa.js → ArrowUp-DYpVM4EW.js} +1 -1
- package/dist/client/assets/{BarChart-CwXvHdxB.js → BarChart-QA5Y4_eS.js} +1 -1
- package/dist/client/assets/{Building02-cRMkGEox.js → Building02-BfF63iaY.js} +1 -1
- package/dist/client/assets/{CartesianChart-CJtUx1j9.js → CartesianChart-C7RhMZbm.js} +1 -1
- package/dist/client/assets/{CategoricalChart-kMcDpyTW.js → CategoricalChart-VnQ3lkHZ.js} +1 -1
- package/dist/client/assets/{CheckCircle-Dz66dooy.js → CheckCircle-DFCQG4PZ.js} +1 -1
- package/dist/client/assets/{ChevronSelectorVertical-CdCX2lzO.js → ChevronSelectorVertical-BQnuYb4d.js} +1 -1
- package/dist/client/assets/{ChevronUp-Ck4gJDQM.js → ChevronUp-BADsHIlZ.js} +1 -1
- package/dist/client/assets/{Copy01-CsO5K9L8.js → Copy01-BuXPB74z.js} +1 -1
- package/dist/client/assets/{CreditCard01-DqJc3xOs.js → CreditCard01-3pgS1FBj.js} +1 -1
- package/dist/client/assets/{DotsVertical-j299MAac.js → DotsVertical-DGPGhZOp.js} +1 -1
- package/dist/client/assets/{ErrorBarContext-CtpzieWQ.js → ErrorBarContext-DjbsBuIQ.js} +1 -1
- package/dist/client/assets/{Globe04-D0kB3Bfd.js → Globe04-h_nDPacm.js} +1 -1
- package/dist/client/assets/{Image01-Cx8xJ-HQ.js → Image01-C3eHO4JB.js} +1 -1
- package/dist/client/assets/{Key01-BkZvoNrn.js → Key01-BHDBC0Ty.js} +1 -1
- package/dist/client/assets/{Link01-BlzslLu4.js → Link01-CWRvYa94.js} +1 -1
- package/dist/client/assets/{LinkBroken01-Dib9MsGd.js → LinkBroken01-D8s-Aoli.js} +1 -1
- package/dist/client/assets/{Minus-CA7klx1C.js → Minus-BDVlfQ1F.js} +1 -1
- package/dist/client/assets/{Monitor01-77Ajhbrg.js → Monitor01-DufxSkfE.js} +1 -1
- package/dist/client/assets/{Play-CKAXzw4k.js → Play-B4Nce4IV.js} +1 -1
- package/dist/client/assets/{Plus-CiR90AEy.js → Plus-DjulKDZN.js} +1 -1
- package/dist/client/assets/{ReferenceLine-DhjJCa9Q.js → ReferenceLine-BcRJIMrO.js} +1 -1
- package/dist/client/assets/{SearchMd-BioGEdMf.js → SearchMd-LiFx-NKw.js} +1 -1
- package/dist/client/assets/{Sector-Dir7p2np.js → Sector-Vy_DZ6Ya.js} +1 -1
- package/dist/client/assets/{ShoppingBag01-BxcGy8BZ.js → ShoppingBag01-Diu_6vhS.js} +1 -1
- package/dist/client/assets/{Sun-CVUKYMek.js → Sun-DwpHFeTI.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-BjXiqiqf.js → SwitchHorizontal01-DSVF0HAp.js} +1 -1
- package/dist/client/assets/{Tool01-B3Z5zXuO.js → Tool01-NhBuMmUV.js} +1 -1
- package/dist/client/assets/{Trash01-9LW3o9Od.js → Trash01-6fKruzF0.js} +1 -1
- package/dist/client/assets/{Upload01-SFFN95fc.js → Upload01-XEi-StK2.js} +1 -1
- package/dist/client/assets/{UserSquare-omvaCaRb.js → UserSquare-eFGH-oUL.js} +1 -1
- package/dist/client/assets/{Users01-CdXvoJrM.js → Users01-BsuShWDn.js} +1 -1
- package/dist/client/assets/{XClose-CTJuylIr.js → XClose-CmswVBOn.js} +1 -1
- package/dist/client/assets/{ZoomOut-DTZMq4ec.js → ZoomOut-DZO-NyFl.js} +1 -1
- package/dist/client/assets/{access-gate-BLYxEj_V.js → access-gate-mZiv8FOt.js} +1 -1
- package/dist/client/assets/{add-connection-dialog-BZE1KQl7.js → add-connection-dialog-Bs11uRPt.js} +1 -1
- package/dist/client/assets/{agent-analytics-CykFX6yl.js → agent-analytics-CSaBErHP.js} +1 -1
- package/dist/client/assets/agent-app-CpchlFDM.js +1 -0
- package/dist/client/assets/{agent-assets-DpayC1wr.js → agent-assets-DFlbYpaG.js} +1 -1
- package/dist/client/assets/{agent-automation-ByP0Wt2_.js → agent-automation-CQUF61n4.js} +1 -1
- package/dist/client/assets/{agent-automations-Bhv3wpmi.js → agent-automations-LxAQfaS1.js} +1 -1
- package/dist/client/assets/{agent-calendar-DvgIN3Ci.js → agent-calendar-BOffXUuz.js} +1 -1
- package/dist/client/assets/{agent-connect-sources-tNGKmg1r.js → agent-connect-sources-Bo6TPGly.js} +1 -1
- package/dist/client/assets/agent-deck-BsttewCw.js +1 -0
- package/dist/client/assets/{agent-e2e-DjiNzVdW.js → agent-e2e-Dxeiz6Hg.js} +1 -1
- package/dist/client/assets/agent-experiments-DgwnRVuo.js +1 -0
- package/dist/client/assets/{agent-file-CA5qF5y3.js → agent-file-Btt92on1.js} +1 -1
- package/dist/client/assets/{agent-hosting-BtPLR8Et.js → agent-hosting-58n6tbGl.js} +1 -1
- package/dist/client/assets/{agent-icon-Dd2i5bPd.js → agent-icon-D2O6Ysxj.js} +1 -1
- package/dist/client/assets/agent-library-C6xhflxa.js +1 -0
- package/dist/client/assets/agent-library-file-Lh5pI681.js +1 -0
- package/dist/client/assets/agent-monitor-B7Pvzm4h.js +1 -0
- package/dist/client/assets/{agent-overview-BWCnp5uX.js → agent-overview--3R-F01i.js} +1 -1
- package/dist/client/assets/{agent-releases-COhBa2Pd.js → agent-releases-CiTUBkUu.js} +1 -1
- package/dist/client/assets/agent-settings-DkY2WG9h.js +1 -0
- package/dist/client/assets/{agent-site-editor-f4uh78gt.js → agent-site-editor-Cyp35eBO.js} +1 -1
- package/dist/client/assets/agent-site-editor-code-Ck6tXuvy.js +2 -0
- package/dist/client/assets/agent-site-editor-content-TPfojHsu.js +1 -0
- package/dist/client/assets/agent-site-editor-preview-Bv1qplXm.js +1 -0
- package/dist/client/assets/agent-view-Dy5CpY1v.js +1 -0
- package/dist/client/assets/{agent-view-guard-BgZmHY4h.js → agent-view-guard-DITCswoZ.js} +1 -1
- package/dist/client/assets/{agents-list-BPoesHBJ.js → agents-list-vpifaSDW.js} +1 -1
- package/dist/client/assets/{ai-providers-D3sw70cH.js → ai-providers-Dph9V-S2.js} +1 -1
- package/dist/client/assets/{alert-C08nNADR.js → alert-BIVSlp4X.js} +1 -1
- package/dist/client/assets/{analytics-sections-8mAVVeRC.js → analytics-sections-C9r_Id8f.js} +1 -1
- package/dist/client/assets/{api-keys-UxHFG6Ls.js → api-keys-OLI6lFDy.js} +1 -1
- package/dist/client/assets/api-keys-bAkry4Sk.js +1 -0
- package/dist/client/assets/{app-editor-DJ_IMUhy.js → app-editor-BYMnhTet.js} +1 -1
- package/dist/client/assets/{asset-utils-DpDYxcv1.js → asset-utils-s-rRWLDR.js} +1 -1
- package/dist/client/assets/{auth-catchall-BYLys7_t.js → auth-catchall-C_KiXSY-.js} +1 -1
- package/dist/client/assets/{auth-entry-DY2p0u7Y.js → auth-entry-C1SLfq5y.js} +1 -1
- package/dist/client/assets/{auth-B3EKpfKg.js → auth-mUy8P9mz.js} +1 -1
- package/dist/client/assets/{auth-split-layout-R-1z_o2g.js → auth-split-layout-C_joRAuD.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-zOq601ab.js → authenticate-and-persist-oauth-Br6pb9qL.js} +1 -1
- package/dist/client/assets/{automation-list-row-B7_Gj0ka.js → automation-list-row-BG7LwDup.js} +1 -1
- package/dist/client/assets/{automation-runs-CNPU9mAe.js → automation-runs-D5ib3rJJ.js} +1 -1
- package/dist/client/assets/{automations-D2ZR3Gj2.js → automations-pErLtBmM.js} +1 -1
- package/dist/client/assets/{autosend-zQEfHbKE.js → autosend-fmyzxlgv.js} +1 -1
- package/dist/client/assets/{badge-Dr5W7Jnh.js → badge-D_XaqFCD.js} +1 -1
- package/dist/client/assets/{block-document-DAKai9Ju.js → block-document-BbeKhIjN.js} +1 -1
- package/dist/client/assets/{blocks-preview-workspace-context-TaWqpY6X.js → blocks-preview-workspace-context-BkWHKGnG.js} +1 -1
- package/dist/client/assets/{blocks-tab-states-C5B0YT1H.js → blocks-tab-states-C7qCSetR.js} +1 -1
- package/dist/client/assets/{blog-schema-CuWYc0Ro.js → blog-schema-BfUeFqnA.js} +1 -1
- package/dist/client/assets/{buckets-tpbg6Xqa.js → buckets-CvEidzt4.js} +1 -1
- package/dist/client/assets/{build-improve-prompt-doc-DiBLhaX1.js → build-improve-prompt-doc-DWVQcr8S.js} +1 -1
- package/dist/client/assets/{calendar-SZLAVIES.js → calendar-D5qyPmPe.js} +1 -1
- package/dist/client/assets/{capability-load-error-fltTTsiW.js → capability-load-error-Cadq9Tfk.js} +1 -1
- package/dist/client/assets/{category-editor-J7ruxbVN.js → category-editor-Dhi0w6mp.js} +1 -1
- package/dist/client/assets/{cdn-tab-vg8pGJ_q.js → cdn-tab-D5vyoNZe.js} +1 -1
- package/dist/client/assets/{chart-B7t4jQPQ.js → chart-BCmVS-sn.js} +1 -1
- package/dist/client/assets/{chat-context-Bm9Y-wQH.js → chat-context-DQIwjTah.js} +1 -1
- package/dist/client/assets/{chat-draft-72kNiqvm.js → chat-draft-D_5rgFXD.js} +1 -1
- package/dist/client/assets/{checkbox-BO3jloZV.js → checkbox-B1LwoLFy.js} +1 -1
- package/dist/client/assets/{choose-editor-Cn17qWcs.js → choose-editor-B-PLdH8j.js} +1 -1
- package/dist/client/assets/{cli-auth-success-BEkYh9ke.js → cli-auth-success-CbU133Cr.js} +1 -1
- package/dist/client/assets/{client-icons-BwyizTSB.js → client-icons-Yic2XONz.js} +1 -1
- package/dist/client/assets/{cms-settings-editor-LyASOEXW.js → cms-settings-editor-TqgyrL8V.js} +1 -1
- package/dist/client/assets/{collapsible-Btn68dCS.js → collapsible-CVxiAnD0.js} +1 -1
- package/dist/client/assets/{collection-detail-DB7jFnd7.js → collection-detail-DcUQ1g_5.js} +1 -1
- package/dist/client/assets/{collection-display-button-DQ86NXOj.js → collection-display-button-BwvT5j3N.js} +1 -1
- package/dist/client/assets/{collection-search-5b2k_N-K.js → collection-search-C7AC5mzN.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-BxnyoNff.js → collection-table-wrapper-BkW0lNmQ.js} +1 -1
- package/dist/client/assets/{collection-tabs-CKwBxfD2.js → collection-tabs-DysuRzTT.js} +1 -1
- package/dist/client/assets/{column-rules-DaETzvZA.js → column-rules-DrQ3zKVW.js} +1 -1
- package/dist/client/assets/{combobox-6NFm0iV0.js → combobox-DIlCtv4m.js} +1 -1
- package/dist/client/assets/{command-IIPi5hYm.js → command-CmSy_63D.js} +1 -1
- package/dist/client/assets/{companion-mcps-section-B4fhZ27X.js → companion-mcps-section-BJVxRFbR.js} +1 -1
- package/dist/client/assets/{config-CeqQdApb.js → config-k6eupn0H.js} +1 -1
- package/dist/client/assets/{connect-DUhJGSNx.js → connect-1IzEMu95.js} +1 -1
- package/dist/client/assets/{connect-layout-D3ZIyaNz.js → connect-layout-B9EK05eh.js} +1 -1
- package/dist/client/assets/{connect-source-dialog-BdYA0cmb.js → connect-source-dialog-B9kwZ1qm.js} +1 -1
- package/dist/client/assets/{connection-CdFqFmc6.js → connection-8s94grp4.js} +1 -1
- package/dist/client/assets/{connection-card--Epyz_mu.js → connection-card-6_vGNwe6.js} +1 -1
- package/dist/client/assets/{connection-detail-BXhbyNRf.js → connection-detail-06L9lcjS.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-Dl9BKKhL.js → connection-form-helpers-B7-YxvfS.js} +1 -1
- package/dist/client/assets/{connections-xOofTeWw.js → connections-B67BU6-u.js} +1 -1
- package/dist/client/assets/{content-tab-EvmAyEHn.js → content-tab-C8kwNsNv.js} +3 -3
- package/dist/client/assets/{context-Zpw5wkK5.js → context-BJ4DUI4o.js} +1 -1
- package/dist/client/assets/{context-menu-Dtrh2j2i.js → context-menu-DrJNCXai.js} +1 -1
- package/dist/client/assets/{context-shell-Dhj5dakd.js → context-shell-Cf8JU1_N.js} +3 -3
- package/dist/client/assets/{core.esm-Ce9RDC88.js → core.esm-8ysL4nmy.js} +1 -1
- package/dist/client/assets/{create-organization-dialog-DLedOU4g.js → create-organization-dialog-CRVy32Y2.js} +1 -1
- package/dist/client/assets/daily-pulse-oZsmQ576.js +1 -0
- package/dist/client/assets/{discover-CdbRHkB1.js → discover-CBj9Ot9k.js} +1 -1
- package/dist/client/assets/{domain-settings-jT9vl6Jy.js → domain-settings-Cuj3cb68.js} +1 -1
- package/dist/client/assets/{drawer-DDVEU1ni.js → drawer-DoWw3X-U.js} +1 -1
- package/dist/client/assets/{editor-BnmY3rvS.js → editor-D54k8w6W.js} +1 -1
- package/dist/client/assets/{editor-classes-Cr8VSL8m.js → editor-classes-DvaDe0n2.js} +1 -1
- package/dist/client/assets/{empty-state-BDE1jhRo.js → empty-state-B1U3dIOI.js} +1 -1
- package/dist/client/assets/{empty-state-pIEWUjEB.js → empty-state-B6ZF6z6U.js} +1 -1
- package/dist/client/assets/experiments-tab-Bf-4FZ8A.js +1 -0
- package/dist/client/assets/{experiments-tab-choice-BJEgQx3g.js → experiments-tab-choice-CSZHqOVL.js} +1 -1
- package/dist/client/assets/{extract-connection-data-yTB1z5rH.js → extract-connection-data-dVntHSWe.js} +1 -1
- package/dist/client/assets/{feature-gate-B_FNDL4M.js → feature-gate-CGLZlvT1.js} +1 -1
- package/dist/client/assets/{feature-paywall-CC1JWV3T.js → feature-paywall-YRUC3hnv.js} +1 -1
- package/dist/client/assets/{file-explorer-BwuDCCec.js → file-explorer-CnB8AqiD.js} +1 -1
- package/dist/client/assets/{file-preview-DS0klTmz.js → file-preview-B3fPhoS1.js} +1 -1
- package/dist/client/assets/{file-share-button-BvSB1bRi.js → file-share-button--vHcbynF.js} +1 -1
- package/dist/client/assets/{file-type-icon-D8ckqM0u.js → file-type-icon-BSvWJ_yJ.js} +1 -1
- package/dist/client/assets/{folder-icon-C3Wn1vYh.js → folder-icon-D9KEEKgD.js} +1 -1
- package/dist/client/assets/{form-CasPlPmR.js → form-DkJLMDiZ.js} +1 -1
- package/dist/client/assets/{general-rB_jmOcN.js → general-yzYHBZqk.js} +1 -1
- package/dist/client/assets/{held-block-view-CaoSYaLl.js → held-block-view-Bcr038cE.js} +3 -3
- package/dist/client/assets/{home-C7vkjB0I.js → home-CdpLVlWp.js} +1 -1
- package/dist/client/assets/{hosted-publish-feedback-Va-JB40p.js → hosted-publish-feedback-CpvmWvo8.js} +1 -1
- package/dist/client/assets/{icon-button-ClJD0L3L.js → icon-button-NEW9CrVR.js} +1 -1
- package/dist/client/assets/{index-DzBeA9nw.js → index-69Wn6Yn2.js} +1 -1
- package/dist/client/assets/{index-nSN37ngC.js → index-Bah4YwbV.js} +1 -1
- package/dist/client/assets/{index-DKCZVBlu.js → index-Bk4q9Kta.js} +1 -1
- package/dist/client/assets/{index-CRIrbRoC.js → index-C1xdxqY4.js} +1 -1
- package/dist/client/assets/{index-BtoUhWZE.js → index-C1zQxIQC.js} +1 -1
- package/dist/client/assets/{index-bvttx5gM.js → index-DCpCimmv.js} +1 -1
- package/dist/client/assets/{index-CdAYmGy-.js → index-DHKvbX-F.js} +1 -1
- package/dist/client/assets/{index-DXBV6vdw.js → index-DV0IMvuF.js} +1 -1
- package/dist/client/assets/{index-n1lVwnPU.js → index-Da57lEgV.js} +1 -1
- package/dist/client/assets/{index-CF3uLTq7.js → index-Dj2q9Kk6.js} +1 -1
- package/dist/client/assets/{index-DPkNYKa5.js → index-DlBqAQ8N.js} +3 -3
- package/dist/client/assets/{index-DGsSWbJr.js → index-fPzpoiMb.js} +1 -1
- package/dist/client/assets/{index-DBDgFroG.js → index-hXfcnGlM.js} +1 -1
- package/dist/client/assets/{index-lVHy2j6s.js → index-iHeHzM9q.js} +1 -1
- package/dist/client/assets/{index-redirect-CuhTOT1s.js → index-redirect-BTQYAvyK.js} +1 -1
- package/dist/client/assets/{index-C_R5zERo.js → index-y2MV63Fm.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-CmDZfni1.js → infiniteQueryObserver-B1X7cH_h.js} +1 -1
- package/dist/client/assets/{infra-billing-Cz4WqXM6.js → infra-billing-I23Yzx7q.js} +1 -1
- package/dist/client/assets/{input-BakKuV82.js → input-BM4k5AWI.js} +1 -1
- package/dist/client/assets/{input-qv0R9jIw.js → input-C1vi2y8a.js} +3 -3
- package/dist/client/assets/{integration-icon-0HpTfBCp.js → integration-icon-DffiYnsw.js} +1 -1
- package/dist/client/assets/{jira-icon-DDlBF5up.js → jira-icon-CDq47JPG.js} +1 -1
- package/dist/client/assets/{label-BwtethZ4.js → label-CI9_CFR6.js} +1 -1
- package/dist/client/assets/{layout-DSa71uZT.js → layout-86e7th4n.js} +1 -1
- package/dist/client/assets/{legacy-agents-deep-BAeqCW4z.js → legacy-agents-deep-DrwenQap.js} +1 -1
- package/dist/client/assets/{legacy-main-redirect-DE8PzFcI.js → legacy-main-redirect-BMDUgvXe.js} +1 -1
- package/dist/client/assets/library-3tOBnuzW.js +1 -0
- package/dist/client/assets/{login-CHeRbo9i.js → login-Q6QzHe98.js} +1 -1
- package/dist/client/assets/{markdown-D3LhMX0Q.js → markdown-DtVTVyIC.js} +1 -1
- package/dist/client/assets/{mcp-app-renderer-C8IQBKi4.js → mcp-app-renderer-B0DJyUaD.js} +1 -1
- package/dist/client/assets/{mcp-oauth-D_sjJkdM.js → mcp-oauth-BgZxPic2.js} +1 -1
- package/dist/client/assets/{mcp-oauth-BrEETLKS.js → mcp-oauth-C2iU61yB.js} +1 -1
- package/dist/client/assets/{members-DiYvqDA2.js → members-Bk_T8psV.js} +1 -1
- package/dist/client/assets/{memory-PXpIrE_g.js → memory-BGQEqAyY.js} +1 -1
- package/dist/client/assets/{mini-report-page-BlzWGBYp.js → mini-report-page-CIdyHIZJ.js} +1 -1
- package/dist/client/assets/mock-board-Djd1BZ6E.js +81 -0
- package/dist/client/assets/{monaco-editor-CWcZI8AU.js → monaco-editor-D_Oeav_Z.js} +1 -1
- package/dist/client/assets/monitoring-D1EdmxtK.js +1 -0
- package/dist/client/assets/{monitoring-stats-row-DNgdNfyy.js → monitoring-stats-row-DdlyqvJE.js} +1 -1
- package/dist/client/assets/{multi-select-Bc0tx4od.js → multi-select-DY9yJzQs.js} +1 -1
- package/dist/client/assets/{mustache-CtV95bow.js → mustache-D61fFDb3.js} +1 -1
- package/dist/client/assets/{named-rule-uses-BgPWcGiF.js → named-rule-uses-DImccIYP.js} +1 -1
- package/dist/client/assets/{new-project-dialog-Ba3YR-3e.js → new-project-dialog-kzuu4Dyf.js} +1 -1
- package/dist/client/assets/{oauth-callback-CdZC7TUt.js → oauth-callback-DcDcp9ht.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-C97iWUFX.js → oauth-callback-ai-provider-Bjee7W5B.js} +1 -1
- package/dist/client/assets/{onboarding-DOQOiW73.js → onboarding-DvIF4FSK.js} +1 -1
- package/dist/client/assets/{openai-conversation-BWjOVsHO.js → openai-conversation-CjhycVDX.js} +1 -1
- package/dist/client/assets/{optimistic-project-sidebar-views-B7i9zgdK.js → optimistic-project-sidebar-views-QrUaUcI4.js} +1 -1
- package/dist/client/assets/{order-monitor-day-BQjIvl-6.js → order-monitor-day-BKjwxjjy.js} +1 -1
- package/dist/client/assets/{organization-choice-DM_Fr8GZ.js → organization-choice-BKIz2sU3.js} +1 -1
- package/dist/client/assets/{orgs-DtWCJUmC.js → orgs-Cm95p7RP.js} +1 -1
- package/dist/client/assets/{page-seo-form-CGMSzx7V.js → page-seo-form-CL0dKYhs.js} +1 -1
- package/dist/client/assets/{pair-BdJJZR42.js → pair-BiKkCxaG.js} +1 -1
- package/dist/client/assets/{parse-sections-CbKGYaeI.js → parse-sections-jfUka-ew.js} +1 -1
- package/dist/client/assets/{plan-CXp6yjHU.js → plan-Bha3pvLg.js} +1 -1
- package/dist/client/assets/{plan-ladder-BvBVSdCp.js → plan-ladder-BCwguLCI.js} +1 -1
- package/dist/client/assets/{popover-DCez27Mm.js → popover-DClIX5lD.js} +1 -1
- package/dist/client/assets/{post-calendar-B86bhZhd.js → post-calendar-kalt2MD0.js} +1 -1
- package/dist/client/assets/{post-editor-CYdc9ac4.js → post-editor-Imtzd9hl.js} +1 -1
- package/dist/client/assets/{preview-content-Nxs52Re0.js → preview-content-OZjgSgMZ.js} +1 -1
- package/dist/client/assets/{preview-dialog-BKFZ0NUo.js → preview-dialog-CBkdchfP.js} +1 -1
- package/dist/client/assets/{preview-panel-Hlo5u5Nk.js → preview-panel-BbgJC3B_.js} +1 -1
- package/dist/client/assets/{preview-tab-D5viTHTm.js → preview-tab-qtdXsUO8.js} +3 -3
- package/dist/client/assets/{product-picker-dialog-grLn9Sru.js → product-picker-dialog-Dgg0Alt7.js} +1 -1
- package/dist/client/assets/{profile-FSXxGWB3.js → profile-Cmb0Uq9T.js} +1 -1
- package/dist/client/assets/{project-app-view-CMM_d5r-.js → project-app-view-C9SIUrEh.js} +1 -1
- package/dist/client/assets/{project-apps-Bxtx5saR.js → project-apps-CWp3jzPS.js} +1 -1
- package/dist/client/assets/{project-feed-tu3Abel-.js → project-feed-DIYZgm5v.js} +1 -1
- package/dist/client/assets/{project-icon-WzkO10Yn.js → project-icon-C5kNnOFq.js} +1 -1
- package/dist/client/assets/project-reports-DJhPJTRc.js +1 -0
- package/dist/client/assets/project-tasks-ItwqddIw.js +1 -0
- package/dist/client/assets/{projects-BotZaWpH.js → projects-D4v4Oq64.js} +1 -1
- package/dist/client/assets/{projects-empty-state-Ke2hcMuN.js → projects-empty-state-D4fHv0Vx.js} +1 -1
- package/dist/client/assets/{prompts-CHuKUPDG.js → prompts-CYI2Ca4j.js} +1 -1
- package/dist/client/assets/record-editor-B7uavues.js +1 -0
- package/dist/client/assets/{redirect-editor-CB9d57eN.js → redirect-editor-CmRN_0xc.js} +1 -1
- package/dist/client/assets/{releases-api-HPZVLe3I.js → releases-api-DxEm_izB.js} +1 -1
- package/dist/client/assets/reports-CSjngTEz.js +1 -0
- package/dist/client/assets/{reports-Cda6FFrs.js → reports-CbNZsWyp.js} +1 -1
- package/dist/client/assets/{reports-onboarding-DgNNOl-j.js → reports-onboarding-6K8tJ5J_.js} +1 -1
- package/dist/client/assets/{reports-tab-9ToHiv9Q.js → reports-tab-DZE0kToJ.js} +2 -2
- package/dist/client/assets/repositories-CC9x9vTF.js +1 -0
- package/dist/client/assets/{repositories-EDO0amJj.js → repositories-Cv3p6t_W.js} +1 -1
- package/dist/client/assets/{repository-binding-OOS1ijlF.js → repository-binding-CcdmL6ag.js} +1 -1
- package/dist/client/assets/{repository-import-picker-mbfP0CeV.js → repository-import-picker-DuNS63Y0.js} +1 -1
- package/dist/client/assets/{repository-picker-CukUIjZ6.js → repository-picker-D37YtUW-.js} +1 -1
- package/dist/client/assets/{require-capability-CMu4ljvo.js → require-capability-wqNUtYQV.js} +1 -1
- package/dist/client/assets/{required-auth-layout-BaIEe5nK.js → required-auth-layout-Cj_D5aeR.js} +1 -1
- package/dist/client/assets/{reset-password-BP5-JNw0.js → reset-password-qin72Rw_.js} +1 -1
- package/dist/client/assets/{resizable-BpY4cxF4.js → resizable-DkWxmtNv.js} +1 -1
- package/dist/client/assets/{resolve-tab-icon-RfRovgfx.js → resolve-tab-icon-Bbn4K7a-.js} +1 -1
- package/dist/client/assets/{review-settings-Eo1xyI5z.js → review-settings-DvOOayH7.js} +1 -1
- package/dist/client/assets/{roles-BfskMCRo.js → roles-_9O3_in0.js} +1 -1
- package/dist/client/assets/{route-Dg0Vh_VX.js → route-3yxLu2NB.js} +1 -1
- package/dist/client/assets/{route-DgVZs7mt.js → route-CgAwr8_y.js} +1 -1
- package/dist/client/assets/route-t6Vm8Ywp.js +1 -0
- package/dist/client/assets/{sandbox-lifecycle-context-C637kaj8.js → sandbox-lifecycle-context-4NgrDeJq.js} +1 -1
- package/dist/client/assets/schema-BI1J5KjU.js +1 -0
- package/dist/client/assets/{schema-DB38clQL.js → schema-XnSsI13A.js} +1 -1
- package/dist/client/assets/{scroll-area-_NEHGZPR.js → scroll-area-DyDtaNCg.js} +1 -1
- package/dist/client/assets/{search-input-7E-QO74Y.js → search-input-JrdzMOm_.js} +1 -1
- package/dist/client/assets/{search-toggle-hEtKUndC.js → search-toggle-wYGVtvVW.js} +1 -1
- package/dist/client/assets/{secret-picker-B7FUd5HC.js → secret-picker-DWXnDb0U.js} +1 -1
- package/dist/client/assets/{secrets-Dm3nK30m.js → secrets-Cg7YmK1o.js} +1 -1
- package/dist/client/assets/{section-array-field-Baw439J3.js → section-array-field-CfCCudbI.js} +1 -1
- package/dist/client/assets/{sections-C43VCmiN.js → sections-DxQyJ7Yy.js} +1 -1
- package/dist/client/assets/{sections-editor-CcWJI-YI.js → sections-editor-2qsFcYQx.js} +1 -1
- package/dist/client/assets/{select-D-8KOsK5.js → select-RAX0QYEC.js} +1 -1
- package/dist/client/assets/{select-model-DXPeh_hv.js → select-model-DpOOiTD1.js} +1 -1
- package/dist/client/assets/{seo-editor-4N-JLj5l.js → seo-editor-9wU3TQPz.js} +1 -1
- package/dist/client/assets/{separator-DbGLOpgi.js → separator-B0GmpR9Y.js} +1 -1
- package/dist/client/assets/settings-tab-B6r8sKLk.js +1 -0
- package/dist/client/assets/{sheet-Dp8UpVMh.js → sheet-7o24rLAF.js} +1 -1
- package/dist/client/assets/{shell-layout-DRwjpTSB.js → shell-layout-Br0nQ-w1.js} +1 -1
- package/dist/client/assets/{site-draft-actions-DGvBBIBR.js → site-draft-actions-CPsRPxRa.js} +1 -1
- package/dist/client/assets/{site-draft-view-DuedZLCu.js → site-draft-view-BY9yW2Ej.js} +2 -2
- package/dist/client/assets/site-editor-CUxt9aeG.js +1 -0
- package/dist/client/assets/{site-editor-toast-CAEEsPu9.js → site-editor-toast-BV71DbMY.js} +1 -1
- package/dist/client/assets/{skills-FG9xk-Sr.js → skills-Nw1X0lYG.js} +1 -1
- package/dist/client/assets/{slider-DdGTiGAs.js → slider-C7FCoMPq.js} +1 -1
- package/dist/client/assets/{sortable.esm-CMAU9M28.js → sortable.esm-3LT8rMWS.js} +1 -1
- package/dist/client/assets/{sso-C82W9c1-.js → sso-CuV4SaSb.js} +1 -1
- package/dist/client/assets/{suggestion-Bs_RNLwx.js → suggestion-B8EqJCT2.js} +1 -1
- package/dist/client/assets/{switch-Cd9ObhwM.js → switch-DRoHA0RB.js} +1 -1
- package/dist/client/assets/{symbol-Bf81YAZ3.js → symbol-An2Zb2zQ.js} +1 -1
- package/dist/client/assets/{synced-repos-DtHUjGIf.js → synced-repos-BVfSxB1w.js} +1 -1
- package/dist/client/assets/{tab-icon-glyph-28_AJOZx.js → tab-icon-glyph-B34XQCM3.js} +1 -1
- package/dist/client/assets/{table-BNILyybd.js → table-D6WmilUC.js} +1 -1
- package/dist/client/assets/{tabs-Ma6HKXi9.js → tabs-qk95ql5a.js} +1 -1
- package/dist/client/assets/{task-assignee-avatar-opURq8DZ.js → task-assignee-avatar-8cgor_AG.js} +1 -1
- package/dist/client/assets/{task-board-Bu6ck66J.js → task-board-C3fHBdG2.js} +1 -1
- package/dist/client/assets/{task-route-W0LxBd_0.js → task-route-rNofa-46.js} +1 -1
- package/dist/client/assets/{task-status-CPDbtPWd.js → task-status-B6-9cIIP.js} +1 -1
- package/dist/client/assets/{taskboard-analytics-B9xBgDuJ.js → taskboard-analytics-CdD0QR2a.js} +1 -1
- package/dist/client/assets/{tasks-BPRXGqy0.js → tasks-CdTDj0OK.js} +1 -1
- package/dist/client/assets/tasks-q9Lrl5hM.js +1 -0
- package/dist/client/assets/{textarea-7_065ARs.js → textarea-Ibxo_cU5.js} +1 -1
- package/dist/client/assets/{thread-analytics-CPbe5TLo.js → thread-analytics-CUDgOcLF.js} +1 -1
- package/dist/client/assets/{thread-intent-DhvlejaR.js → thread-intent-Bcm8nkb-.js} +1 -1
- package/dist/client/assets/{thread-route-BH-lovA8.js → thread-route-Bd56Ws2e.js} +1 -1
- package/dist/client/assets/{thread-route-DknVUK1X.js → thread-route-DytMtQhr.js} +1 -1
- package/dist/client/assets/{thread-sheet-body-Dou1w5oO.js → thread-sheet-body-DbsdUgzJ.js} +1 -1
- package/dist/client/assets/{time-range-picker-D_79K4LE.js → time-range-picker-BjaZu1pB.js} +1 -1
- package/dist/client/assets/{toggle-group-BW4WPusF.js → toggle-group--gd2dZNu.js} +1 -1
- package/dist/client/assets/{tool-namespace-DclqFB6s.js → tool-namespace-Czhk4de_.js} +1 -1
- package/dist/client/assets/{toolbar-icon-button-pjnmOmIK.js → toolbar-icon-button-Doqx7uIl.js} +1 -1
- package/dist/client/assets/{tooltip-BfYoKqk0.js → tooltip-CGDwEKla.js} +1 -1
- package/dist/client/assets/{tooltipContext-BwhagJw3.js → tooltipContext-BjbnVzdB.js} +1 -1
- package/dist/client/assets/{track-BPJVr6tU.js → track-o53s7HUT.js} +1 -1
- package/dist/client/assets/{types-Bh3enbdL.js → types-BlSD9MKW.js} +1 -1
- package/dist/client/assets/{url-slug-DZKjobHH.js → url-slug-BC1hwMbV.js} +1 -1
- package/dist/client/assets/{usage-stats-DWcfUEJz.js → usage-stats-DFdXpSTz.js} +1 -1
- package/dist/client/assets/{use-ai-providers-BGW19fsp.js → use-ai-providers-YeO0Kt-T.js} +1 -1
- package/dist/client/assets/{use-apply-named-rule-qhVXyJAR.js → use-apply-named-rule-B8Wdybx9.js} +1 -1
- package/dist/client/assets/{use-automations-CDFADna3.js → use-automations-3TnrfuwX.js} +1 -1
- package/dist/client/assets/{use-autosave-C58uf8aO.js → use-autosave-DKMWP7df.js} +1 -1
- package/dist/client/assets/{use-chat-layout-state-W21k6Oyl.js → use-chat-layout-state-BYFrwE0Z.js} +1 -1
- package/dist/client/assets/{use-clock-tick-BoQqQbKV.js → use-clock-tick-CoJMln1I.js} +1 -1
- package/dist/client/assets/{use-cms-publish-actions-BY2XG-ZF.js → use-cms-publish-actions-BJbCRSe5.js} +1 -1
- package/dist/client/assets/{use-connect-companion-CD6eef1N.js → use-connect-companion-C0IB4u5H.js} +1 -1
- package/dist/client/assets/{use-connection-FgEFfPgN.js → use-connection-CPJ2t_wt.js} +1 -1
- package/dist/client/assets/{use-copy-Cej_IYzW.js → use-copy-pG3Nq4mQ.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-B2uccjXc.js → use-create-virtual-mcp-BJ9mL4g_.js} +1 -1
- package/dist/client/assets/{use-date-fns-locale-ChcH2V0b.js → use-date-fns-locale-aiAkCLG4.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-C2ohNGVN.js → use-debounced-autosave-GnvmIFmT.js} +1 -1
- package/dist/client/assets/{use-debounced-value-CEM_FrpF.js → use-debounced-value-HL4NH2l1.js} +1 -1
- package/dist/client/assets/{use-deco-credits-zfH-bhLZ.js → use-deco-credits-C7mrv7jI.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-CBZ_hltq.js → use-decopilot-events-Bo1C0-vc.js} +1 -1
- package/dist/client/assets/{use-delete-connection-D50gjJ2g.js → use-delete-connection-Cbj0xjTC.js} +1 -1
- package/dist/client/assets/{use-deployment-admin-CXv4-s9G.js → use-deployment-admin-DqPz0gQF.js} +1 -1
- package/dist/client/assets/{use-fast-preview-draft-url-CJVhqM-F.js → use-fast-preview-draft-url-HidTF3Ak.js} +1 -1
- package/dist/client/assets/{use-file-configs-DF-WRZPt.js → use-file-configs-DjM7limQ.js} +1 -1
- package/dist/client/assets/{use-inbox-feed-BVMy5pWU.js → use-inbox-feed-BawImjzR.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-BQiTGHoF.js → use-infinite-scroll-BWXYJIGE.js} +1 -1
- package/dist/client/assets/{use-join-requests-CcrVpoqm.js → use-join-requests-CkUHU_ck.js} +1 -1
- package/dist/client/assets/{use-main-panel-tabs-2VMrBVNs.js → use-main-panel-tabs-BkwtKsEq.js} +1 -1
- package/dist/client/assets/{use-mcp-auth-status-B408AW7m.js → use-mcp-auth-status-Diru6v5l.js} +1 -1
- package/dist/client/assets/{use-mcp-client-CHpaZaBV.js → use-mcp-client-BTazWDn_.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-BmOIicXO.js → use-mcp-prompts-BtAR7liM.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-DDSRwDT8.js → use-mcp-tools-CnDXz04m.js} +1 -1
- package/dist/client/assets/{use-mobile-ay2r1OWx.js → use-mobile-Ba8cwCW_.js} +1 -1
- package/dist/client/assets/{use-move-blocks-B60ajR78.js → use-move-blocks-CE7PC8Dn.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-bdU7GSsU.js → use-navigate-to-agent-ClMAT78e.js} +1 -1
- package/dist/client/assets/{use-org-fs-D0VDD62p.js → use-org-fs-is3Nb4bW.js} +1 -1
- package/dist/client/assets/{use-org-repo-syncs-CRBTSVSF.js → use-org-repo-syncs-rMxQhmIY.js} +1 -1
- package/dist/client/assets/{use-org-sso-CFTK09CO.js → use-org-sso-Br-zUY8K.js} +1 -1
- package/dist/client/assets/{use-organization-roles-jWWMOxjh.js → use-organization-roles-CMSlaFcG.js} +1 -1
- package/dist/client/assets/{use-organization-settings-CyBheUn1.js → use-organization-settings-CQDxv_1k.js} +1 -1
- package/dist/client/assets/{use-panel-navigate-DdFaM_vQ.js → use-panel-navigate-CXnDtexh.js} +1 -1
- package/dist/client/assets/{use-project-native-view-presence-BYNQfEh2.js → use-project-native-view-presence-YGN4D-su.js} +1 -1
- package/dist/client/assets/{use-project-scope-wzIulhuH.js → use-project-scope-B0GTyJmy.js} +1 -1
- package/dist/client/assets/{use-recent-apps-D-kl6pKN.js → use-recent-apps-Dpk0kWXv.js} +1 -1
- package/dist/client/assets/{use-releases-DjmnBIqb.js → use-releases-BOl4DpnA.js} +1 -1
- package/dist/client/assets/{use-reports-diagnostic-Dq3qoFka.js → use-reports-diagnostic-CkiLcbuT.js} +1 -1
- package/dist/client/assets/{use-sandbox-events-BPvMQ9bx.js → use-sandbox-events-0ezZYS9_.js} +1 -1
- package/dist/client/assets/{use-secrets-CWjgNxlY.js → use-secrets-Df_YMttt.js} +1 -1
- package/dist/client/assets/{use-section-preview-base-DSWKcSGY.js → use-section-preview-base-3xGhEYUn.js} +1 -1
- package/dist/client/assets/{use-session-runtime-BJW7tkkF.js → use-session-runtime-Bpm2BYEZ.js} +1 -1
- package/dist/client/assets/{use-sidebar-collapsed-BHnqpCPN.js → use-sidebar-collapsed-BnhavbaD.js} +1 -1
- package/dist/client/assets/{use-tags-9S9uNUhV.js → use-tags-DZKcwnSP.js} +1 -1
- package/dist/client/assets/{use-task-board-analytics-CPBpBVry.js → use-task-board-analytics-Bv9Zee7f.js} +1 -1
- package/dist/client/assets/{use-task-board-events-DHH9r4Zq.js → use-task-board-events-Cc9iZtjE.js} +1 -1
- package/dist/client/assets/{use-task-board-item-prs-BxX9fBTx.js → use-task-board-item-prs-BWsy70r-.js} +1 -1
- package/dist/client/assets/{use-task-metadata-DKc7Jobt.js → use-task-metadata-Zdotw36E.js} +1 -1
- package/dist/client/assets/{use-thread-analytics-DQ8tSvq_.js → use-thread-analytics-D2GeKxmA.js} +1 -1
- package/dist/client/assets/{use-thread-outputs-BJTeQd3u.js → use-thread-outputs-D4Ri80KS.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-ID7ntuLj.js +1 -0
- package/dist/client/assets/{useQueries-C3q3rd14.js → useQueries-MdybfDim.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-BM00SstB.js +1 -0
- package/dist/client/assets/{users-_o_ERwmc.js → users-CLTHtY95.js} +1 -1
- package/dist/client/assets/{utils-CcMIxuv4.js → utils-Cvz7JLdG.js} +1 -1
- package/dist/client/assets/{variant-calendar-BpIs--8X.js → variant-calendar-D9qfBM7M.js} +1 -1
- package/dist/client/assets/{variant-matcher-override-Dbq-HuiS.js → variant-matcher-override-0q1jVuDF.js} +1 -1
- package/dist/client/assets/{view-header-Bkf9tq32.js → view-header-DNRg1UwP.js} +1 -1
- package/dist/client/assets/{virtual-mcp-DCaWnGp2.js → virtual-mcp-Bz0i6iLp.js} +1 -1
- package/dist/client/assets/{watch-sse-pool-D4Plu-mb.js → watch-sse-pool-Vinolgve.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/server.js +81 -81
- package/package.json +1 -1
- package/dist/client/assets/agent-app-j31lNvdT.js +0 -1
- package/dist/client/assets/agent-deck-COqyVrg6.js +0 -1
- package/dist/client/assets/agent-experiments-DmI8Twfx.js +0 -1
- package/dist/client/assets/agent-library-CypYRiDq.js +0 -1
- package/dist/client/assets/agent-library-file-4BIa4MpY.js +0 -1
- package/dist/client/assets/agent-monitor-BftMMITS.js +0 -1
- package/dist/client/assets/agent-settings-CPffYYxc.js +0 -1
- package/dist/client/assets/agent-site-editor-code-CU6iOhdK.js +0 -2
- package/dist/client/assets/agent-site-editor-content-Cn0JYnPW.js +0 -1
- package/dist/client/assets/agent-site-editor-preview-DrG3GEb8.js +0 -1
- package/dist/client/assets/agent-view-Dbb1PvmX.js +0 -1
- package/dist/client/assets/api-keys-B2nNqdVo.js +0 -1
- package/dist/client/assets/daily-pulse-ZWovVLrI.js +0 -1
- package/dist/client/assets/experiments-tab-BHK5qx38.js +0 -1
- package/dist/client/assets/library-DOGNGY5N.js +0 -1
- package/dist/client/assets/mock-board-CQ44C6iV.js +0 -81
- package/dist/client/assets/monitoring-DfUd1480.js +0 -1
- package/dist/client/assets/project-reports-D9Z5MK8K.js +0 -1
- package/dist/client/assets/project-tasks-CFcEmcuS.js +0 -1
- package/dist/client/assets/record-editor-B2XFZ2rO.js +0 -1
- package/dist/client/assets/reports-Bo81sBJH.js +0 -1
- package/dist/client/assets/repositories-XxbaNAuM.js +0 -1
- package/dist/client/assets/route-BX4RtQC4.js +0 -1
- package/dist/client/assets/schema-DoqN5Hfn.js +0 -1
- package/dist/client/assets/settings-tab-CyOfSnAv.js +0 -1
- package/dist/client/assets/site-editor-K4x21pcY.js +0 -1
- package/dist/client/assets/tasks-0wjdzUxh.js +0 -1
- package/dist/client/assets/useInfiniteQuery-CzD_itiC.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-CW7uOMpa.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/agent-site-editor-
|
|
2
|
-
import{c as y,b as E,j as m,l as oe,B as q,E as ie,r as M,t as F,x as re,I as G,v as ce,D as de,be as J,a4 as me,bk as ue,n as V}from"./index-DPkNYKa5.js";import{B as K}from"./badge-Dr5W7Jnh.js";import{L as fe}from"./label-BwtethZ4.js";import{s as pe}from"./Trash01-9LW3o9Od.js";import{a as xe,n as ge,c as he,d as ve,e as Re,f as be,g as X,h as Ne}from"./named-rule-uses-BgPWcGiF.js";import{ai as C,ak as Q,an as ee,at as je,d as ye,au as Ce,av as we,aw as Ee}from"./parse-sections-CbKGYaeI.js";import{N as te,ax as Se,ay as L,u as ne,D as ke,L as Ue,ae as De,l as Oe}from"./site-editor-toast-CAEEsPu9.js";import{y as se,L as ae,p as Te,i as He,u as Ie,S as _e}from"./blocks-tab-states-C5B0YT1H.js";import{b as Be}from"./ZoomOut-DTZMq4ec.js";import{a as Fe}from"./UserSquare-omvaCaRb.js";import{u as Pe}from"./use-apply-named-rule-qhVXyJAR.js";import{E as $e}from"./empty-state-BDE1jhRo.js";import{u as Me}from"./chat-context-Bm9Y-wQH.js";import{a as Ke}from"./use-panel-navigate-DdFaM_vQ.js";function Le(n,e,t,s){const a=C(n,e);return a.kind==="conflict"?null:{writes:{[Q(e).blockKey]:ee(a.block,e,t,s)}}}function Ve(n,e,t,s){const a=C(n,e);if(a.kind==="conflict")return{problem:"conflict"};const o=se(t,Object.keys(a.values));return o?{problem:o}:{change:Le(n,e,t.trim(),s)}}function Ae(n,e,t){const s=C(n,e);return s.kind!=="saved"||!Object.hasOwn(s.block,t)?null:{writes:{[Q(e).blockKey]:je(s.block,t)}}}function ze(n,e,t,s){if(s===void 0)return null;const a=C(n,e);return a.kind==="conflict"||Object.hasOwn(a.block,t)?null:{writes:{[Q(e).blockKey]:ee(a.block,e,t,s)}}}function We(n,e,t,s){if(!n)return null;const a=C(n,e);return a.kind!=="saved"||!Object.hasOwn(a.values,t)?"new":Ge(a.values[t],s)?"published":"changed"}function qe(n,e,t){if(!n)return;const s=C(n,e);if(s.kind==="saved")return s.values[t]}function Qe(n,e,t){if(!e)return[];const s=C(e,t);if(s.kind!=="saved")return[];const a=C(n,t),o=a.kind==="conflict"?{}:a.values;return Object.keys(s.values).filter(r=>!Object.hasOwn(o,r))}function Ge(n,e){return typeof n=="number"||typeof e=="number"?n===e:Y(n.start,e.start)&&Y(n.end,e.end)}function Y(n,e){return n===void 0||e===void 0?n===e:n===e||new Date(n).getTime()===new Date(e).getTime()}function bt(n){const e=y.c(21),{kind:t,rows:s,wholeRows:a,loading:o,marked:r,onOpen:i}=n,l=E(),c=t==="experiments";let d;e[0]!==l?(d=l("sectionsEditor.namedRuleUses.title"),e[0]=l,e[1]=d):d=e[1];let u;e[2]!==d?(u=m.jsx("h3",{className:"text-sm font-medium",children:d}),e[2]=d,e[3]=u):u=e[3];let f;e[4]!==o||e[5]!==r||e[6]!==i||e[7]!==s||e[8]!==l||e[9]!==c?(f=o?m.jsx("p",{className:"text-sm text-muted-foreground",children:l("sectionsEditor.namedRuleUses.loading")}):s.length===0?m.jsx("p",{className:"text-sm text-muted-foreground",children:l(c?"sectionsEditor.namedRuleUses.emptyTests":"sectionsEditor.namedRuleUses.emptyCampaigns")}):m.jsx(z,{rows:s,marked:r,onOpen:i}),e[4]=o,e[5]=r,e[6]=i,e[7]=s,e[8]=l,e[9]=c,e[10]=f):f=e[10];let x;e[11]!==r||e[12]!==i||e[13]!==l||e[14]!==c||e[15]!==a?(x=a.length>0&&m.jsxs("div",{className:"mt-3 flex flex-col gap-1",children:[m.jsx("h4",{className:"text-xs font-medium text-muted-foreground",children:l(c?"sectionsEditor.namedRuleUses.wholeTests":"sectionsEditor.namedRuleUses.wholeCampaigns")}),m.jsx("p",{className:"text-xs text-muted-foreground",children:l(c?"sectionsEditor.namedRuleUses.wholeTestsHint":"sectionsEditor.namedRuleUses.wholeCampaignsHint")}),m.jsx(z,{rows:a,marked:r,onOpen:i})]}),e[11]=r,e[12]=i,e[13]=l,e[14]=c,e[15]=a,e[16]=x):x=e[16];let g;return e[17]!==u||e[18]!==f||e[19]!==x?(g=m.jsxs("section",{className:"flex flex-col gap-2","data-testid":"named-rule-used-by",children:[u,f,x]}),e[17]=u,e[18]=f,e[19]=x,e[20]=g):g=e[20],g}function z(n){const e=y.c(11),{rows:t,marked:s,onOpen:a}=n,o=E();let r;if(e[0]!==s||e[1]!==a||e[2]!==t||e[3]!==o){let l;e[5]!==s||e[6]!==a||e[7]!==o?(l=c=>{const d=c.blockKind==="page"?Fe:Be,u=c.state==="removed-in-draft";return m.jsxs("li",{className:"flex items-center gap-3 px-3 py-2","data-use-state":c.state,children:[m.jsx(d,{size:14,className:"shrink-0 text-muted-foreground"}),m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("p",{className:oe("truncate text-sm",u&&"text-muted-foreground line-through"),children:c.title}),m.jsx("p",{className:"truncate text-xs text-muted-foreground",children:[c.path,c.section,c.variant?o("sectionsEditor.namedRuleUses.variant",{index:String(c.variant)}):null].filter(Boolean).join(" · ")})]}),s&&c.state==="draft-only"&&m.jsx(K,{variant:"muted",children:o("sectionsEditor.namedRuleUses.draftOnly")}),s&&u&&m.jsx(K,{variant:"muted",children:o("sectionsEditor.namedRuleUses.removed")}),a&&!u&&m.jsxs(q,{type:"button",variant:"ghost",size:"sm",onClick:()=>a(c),children:[o("sectionsEditor.namedRuleUses.open"),m.jsx(ie,{size:14})]})]},xe(c))},e[5]=s,e[6]=a,e[7]=o,e[8]=l):l=e[8],r=t.map(l),e[0]=s,e[1]=a,e[2]=t,e[3]=o,e[4]=r}else r=e[4];let i;return e[9]!==r?(i=m.jsx("ul",{className:"divide-y divide-border/60 rounded-md border border-border/60",children:r}),e[9]=r,e[10]=i):i=e[10],i}function Je(n){const e=y.c(12),{kind:t,rows:s,names:a,onOpen:o}=n,r=E();if(s.length===0)return null;let i;e[0]!==t||e[1]!==a||e[2]!==r?(i=r(t==="experiments"?a===1?"sectionsEditor.namedRuleUses.missingTestOne":"sectionsEditor.namedRuleUses.missingTests":a===1?"sectionsEditor.namedRuleUses.missingCampaignOne":"sectionsEditor.namedRuleUses.missingCampaigns"),e[0]=t,e[1]=a,e[2]=r,e[3]=i):i=e[3];let l;e[4]!==i?(l=m.jsx("p",{className:"text-sm text-muted-foreground",children:i}),e[4]=i,e[5]=l):l=e[5];let c;e[6]!==o||e[7]!==s?(c=m.jsx(z,{rows:s,marked:!1,onOpen:o}),e[6]=o,e[7]=s,e[8]=c):c=e[8];let d;return e[9]!==l||e[10]!==c?(d=m.jsxs("section",{className:"flex flex-col gap-2","data-testid":"named-rule-missing-uses",children:[l,c]}),e[9]=l,e[10]=c,e[11]=d):d=e[11],d}function Xe({kind:n,name:e,meta:t,pending:s,apply:a,reread:o,onDeleted:r,onUndo:i}){const l=E(),c=n==="experiments",[d,u]=M.useState(!1),f=async()=>{const p=await o();return p||F.info(l("sectionsEditor.namedRules.unavailable"),{...L,description:l("sectionsEditor.namedRules.unavailableHint")}),p},x=async p=>{const R=await f();if(!R)return;const h=ze(R,n,e,p);if(h){i(h);return}const b=C(R,n).kind==="conflict";F.info(l(b?"sectionsEditor.namedRules.changedMeanwhile":"sectionsEditor.namedRules.alreadyBack"),{...L,description:l(b?"sectionsEditor.namedRules.changedMeanwhileHint":"sectionsEditor.namedRules.alreadyBackHint")})},g=async()=>{u(!0);let p;try{p=await f()}finally{u(!1)}if(!p)return;const R=Ae(p,n,e);if(!R)return;const h=C(p,n),b=h.kind==="saved"?h.block[e]:void 0,v=ge(l,he(p,t,n,e)),j=await a(R);if(j.ok){if(j.keptTheirs){te(l,!1);return}r(),F.success(c?l("experiments.v8.deleted",{name:e}):l("sandbox.dateCampaigns.deleted",{name:e}),{id:Se,description:v?.one?l("sectionsEditor.namedRuleDelete.stillUsedOne",{places:v.places}):v?l("sectionsEditor.namedRuleDelete.stillUsed",{places:v.places}):l(c?"experiments.v8.deletedHint":"sandbox.dateCampaigns.deletedHint"),action:{label:l("sectionsEditor.namedRules.undo"),onClick:()=>{x(b)}}})}};return m.jsxs(q,{type:"button",variant:"ghost",size:"sm",disabled:s||d,onClick:()=>{g()},children:[m.jsx(pe,{size:16}),l(c?"experiments.v8.delete":"sandbox.dateCampaigns.delete")]})}function Ye(n){const e=y.c(11);let t;e[0]!==n.branch||e[1]!==n.orgSlug||e[2]!==n.virtualMcpId?(t={orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch},e[0]=n.branch,e[1]=n.orgSlug,e[2]=n.virtualMcpId,e[3]=t):t=e[3];const s=t,a=ne(n.virtualMcpId,n.branch),o=ke(s),r=Ue(a,o||null),i=De(a,o||null,r.data);if(!n.decofile)return null;let l;e[4]!==r.data?(l=r.data?Object.keys(r.data.changes).length:void 0,e[4]=r.data,e[5]=l):l=e[5];const c=i.data?.entries;let d;return e[6]!==n.decofile||e[7]!==n.meta||e[8]!==l||e[9]!==c?(d=ve({decofile:n.decofile,meta:n.meta,changeCount:l,sides:c}),e[6]=n.decofile,e[7]=n.meta,e[8]=l,e[9]=c,e[10]=d):d=e[10],d}function T(n,e){return e==="experiments"?{new:n("experiments.v8.new"),usedBy:t=>n("experiments.v8.usedBy",{count:String(t)}),notUsed:n("experiments.v8.notUsed"),stateNew:n("experiments.v8.state.new"),stateChanged:n("experiments.v8.state.changed"),removedTitle:n("experiments.v8.removedTitle"),removedHint:n("experiments.v8.removedHint"),created:t=>n("sectionsEditor.namedRulePicker.createdTest",{name:t}),renamed:t=>n("experiments.v8.renamed",{name:t}),renameHint:n("experiments.v8.renameHint"),renameWholeHint:n("experiments.v8.renameWholeHint")}:{new:n("sandbox.dateCampaigns.new"),usedBy:t=>n("sandbox.dateCampaigns.usedBy",{count:String(t)}),notUsed:n("sandbox.dateCampaigns.notUsed"),stateNew:n("sandbox.dateCampaigns.state.new"),stateChanged:n("sandbox.dateCampaigns.state.changed"),removedTitle:n("sandbox.dateCampaigns.removedTitle"),removedHint:n("sandbox.dateCampaigns.removedHint"),created:t=>n("sectionsEditor.namedRulePicker.createdCampaign",{name:t}),renamed:t=>n("sandbox.dateCampaigns.renamed",{name:t}),renameHint:n("sandbox.dateCampaigns.renameHint"),renameWholeHint:n("sandbox.dateCampaigns.renameWholeHint")}}function Ze(n,e,t){const s=ye(e,t);return s!=="available"?s:C(n,t).kind==="conflict"?"conflict":null}function Nt(n,e){const t=y.c(49),s=E(),{orgSlug:a,virtualMcpId:o,branch:r,decofile:i,meta:l}=e;let c;t[0]!==r||t[1]!==i||t[2]!==l||t[3]!==a||t[4]!==o?(c={orgSlug:a,virtualMcpId:o,branch:r,decofile:i,meta:l},t[0]=r,t[1]=i,t[2]=l,t[3]=a,t[4]=o,t[5]=c):c=t[5];const d=Ye(c);let u;t[6]!==r||t[7]!==a||t[8]!==o?(u={orgSlug:a,virtualMcpId:o,branch:r},t[6]=r,t[7]=a,t[8]=o,t[9]=u):u=t[9];const{apply:f,reread:x,planStored:g,isPending:p,holdsCopy:R}=Pe(u),[h,b]=M.useState(null),[v,j]=M.useState(!1);let D;t[10]!==f||t[11]!==s?(D=async(w,$)=>{const B=$===void 0?s("sectionsEditor.namedRules.saved"):$;if(!w)return!1;const O=await f(w);return O.ok&&O.keptTheirs?te(s,!1):O.ok&&F.success(B,{...L,description:s("sectionsEditor.namedRules.savedHint")}),O.ok},t[10]=f,t[11]=s,t[12]=D):D=t[12];const N=D;let S;t[13]!==i||t[14]!==n||t[15]!==N||t[16]!==s?(S=w=>{if(w.kind!==n||!w.create)return;const $=w.kind==="experiments"?w.create.share:w.create.window,B=Ve(i,n,w.name,$);if(!("change"in B)){F.info(B.problem==="conflict"?s("sectionsEditor.namedRules.changedMeanwhile"):ae(s,B.problem),L);return}const O=w.name.trim();N(B.change,T(s,n).created(O)).then(le=>{le&&(j(!1),b(O))})},t[13]=i,t[14]=n,t[15]=N,t[16]=s,t[17]=S):S=t[17];const U=S;let k;t[18]!==i||t[19]!==n||t[20]!==l?(k=Ze(i,l,n),t[18]=i,t[19]=n,t[20]=l,t[21]=k):k=t[21];let H;t[22]!==i||t[23]!==n||t[24]!==l||t[25]!==d?(H=d?Re(d,n,i,l):[],t[22]=i,t[23]=n,t[24]=l,t[25]=d,t[26]=H):H=t[26];let I;t[27]!==i||t[28]!==n||t[29]!==l||t[30]!==d?(I=d?be(d,n,i,l):0,t[27]=i,t[28]=n,t[29]=l,t[30]=d,t[31]=I):I=t[31];let _;t[32]!==N?(_=w=>{N(w)},t[32]=N,t[33]=_):_=t[33];let P;return t[34]!==f||t[35]!==U||t[36]!==v||t[37]!==R||t[38]!==p||t[39]!==h||t[40]!==g||t[41]!==x||t[42]!==N||t[43]!==k||t[44]!==H||t[45]!==I||t[46]!==_||t[47]!==d?(P={uses:d,apply:f,reread:x,planStored:g,isPending:p,holdsCopy:R,openName:h,setOpenName:b,creating:v,setCreating:j,blocked:k,missing:H,missingNames:I,save:N,create:U,undo:_},t[34]=f,t[35]=U,t[36]=v,t[37]=R,t[38]=p,t[39]=h,t[40]=g,t[41]=x,t[42]=N,t[43]=k,t[44]=H,t[45]=I,t[46]=_,t[47]=d,t[48]=P):P=t[48],P}function jt(n){const e=y.c(23),{kind:t,open:s,onOpenChange:a,existingNames:o,pending:r,onCreate:i}=n,l=E();let c;e[0]!==t||e[1]!==l?(c=T(l,t),e[0]=t,e[1]=l,e[2]=c):c=e[2];let d;e[3]!==c.new?(d=m.jsx(re,{className:"sr-only",children:c.new}),e[3]=c.new,e[4]=d):d=e[4];let u;e[5]!==l?(u=l("sectionsEditor.namedRules.create"),e[5]=l,e[6]=u):u=e[6];let f;e[7]!==a?(f=()=>a(!1),e[7]=a,e[8]=f):f=e[8];let x;e[9]!==o||e[10]!==t||e[11]!==i||e[12]!==r||e[13]!==u||e[14]!==f?(x=m.jsx(Te,{kind:t,initialName:"",existingNames:o,pending:r,submitLabel:u,dismiss:"cancel",standalone:!0,onBack:f,onSubmit:i}),e[9]=o,e[10]=t,e[11]=i,e[12]=r,e[13]=u,e[14]=f,e[15]=x):x=e[15];let g;e[16]!==d||e[17]!==x?(g=m.jsxs(ce,{className:"p-0 sm:max-w-md",children:[d,x]}),e[16]=d,e[17]=x,e[18]=g):g=e[18];let p;return e[19]!==a||e[20]!==s||e[21]!==g?(p=m.jsx(de,{open:s,onOpenChange:a,children:g}),e[19]=a,e[20]=s,e[21]=g,e[22]=p):p=e[22],p}function yt(n){const e=y.c(14),{kind:t,missing:s,missingNames:a,removed:o,onOpenUse:r}=n,i=E();let l;e[0]!==t||e[1]!==i?(l=T(i,t),e[0]=t,e[1]=i,e[2]=l):l=e[2];const c=l;let d;e[3]!==t||e[4]!==s||e[5]!==a||e[6]!==r?(d=m.jsx(Je,{kind:t,rows:s,names:a,onOpen:r}),e[3]=t,e[4]=s,e[5]=a,e[6]=r,e[7]=d):d=e[7];let u;e[8]!==c||e[9]!==o?(u=o.length>0&&m.jsxs("div",{className:"flex flex-col gap-1",children:[m.jsx("h3",{className:"text-sm font-medium",children:c.removedTitle}),m.jsx("p",{className:"text-xs text-muted-foreground",children:c.removedHint}),m.jsx("ul",{className:"text-sm text-muted-foreground",children:o.map(et)})]}),e[8]=c,e[9]=o,e[10]=u):u=e[10];let f;return e[11]!==d||e[12]!==u?(f=m.jsxs(m.Fragment,{children:[d,u]}),e[11]=d,e[12]=u,e[13]=f):f=e[13],f}function et(n){return m.jsx("li",{className:"line-through",children:n},n)}function Ct(n,e,t){const s=T(n,e);return t>0?s.usedBy(t):s.notUsed}function tt(n){const e=y.c(7),{kind:t,state:s,changed:a}=n,o=a===void 0?!0:a,r=E();let i;e[0]!==t||e[1]!==r?(i=T(r,t),e[0]=t,e[1]=r,e[2]=i):i=e[2];const l=i;if(s==="new"){let c;return e[3]!==l.stateNew?(c=m.jsx(K,{variant:"muted",children:l.stateNew}),e[3]=l.stateNew,e[4]=c):c=e[4],c}if(s==="changed"&&o){let c;return e[5]!==l.stateChanged?(c=m.jsx(K,{variant:"muted",children:l.stateChanged}),e[5]=l.stateChanged,e[6]=c):c=e[6],c}return null}function wt(n){const e=y.c(9),{kind:t,name:s,status:a,entryState:o}=n;let r;e[0]!==s?(r=m.jsx("h2",{className:"text-lg font-semibold",children:s}),e[0]=s,e[1]=r):r=e[1];let i;e[2]!==o||e[3]!==t?(i=m.jsx(tt,{kind:t,state:o,changed:!1}),e[2]=o,e[3]=t,e[4]=i):i=e[4];let l;return e[5]!==a||e[6]!==r||e[7]!==i?(l=m.jsxs("div",{className:"flex items-center gap-3",children:[r,a,i]}),e[5]=a,e[6]=r,e[7]=i,e[8]=l):l=e[8],l}function Et(n){const e=y.c(9),{kind:t,detail:s}=n;let a;return e[0]!==s.apply||e[1]!==s.meta||e[2]!==s.onDeleted||e[3]!==s.onUndo||e[4]!==s.pending||e[5]!==s.reread||e[6]!==s.row.name||e[7]!==t?(a=m.jsx(Xe,{kind:t,name:s.row.name,meta:s.meta,pending:s.pending,apply:s.apply,reread:s.reread,onDeleted:s.onDeleted,onUndo:s.onUndo}),e[0]=s.apply,e[1]=s.meta,e[2]=s.onDeleted,e[3]=s.onUndo,e[4]=s.pending,e[5]=s.reread,e[6]=s.row.name,e[7]=t,e[8]=a):a=e[8],a}function St(n,e,t){return{row:e,decofile:t.decofile,meta:t.meta,uses:n.uses,pending:n.isPending,holdsCopy:n.holdsCopy,onBack:()=>n.setOpenName(null),onOpenUse:t.onOpenUse,onSave:n.save,onRenamed:n.setOpenName,apply:n.apply,reread:n.reread,planStored:n.planStored,onDeleted:()=>n.setOpenName(null),onUndo:n.undo}}function kt(n,e,t,s,a){return{useRows:t?X(t,n,e,s,a):[],wholeRows:t?X(t,n,null,s,a):[]}}function Ut(n,e){const t=y.c(23),s=E(),a=e.row.name,[o,r]=M.useState(a);let i;t[0]!==o?(i=o.trim(),t[0]=o,t[1]=i):i=t[1];const l=i===a;let c,d,u,f,x,g;if(t[2]!==a||t[3]!==n||t[4]!==o||t[5]!==e||t[6]!==s||t[7]!==l){let h;t[14]!==a?(h=v=>v!==a,t[14]=a,t[15]=h):h=t[15];const b=Ce(C(e.decofile,n)).filter(h);c=l?null:se(o,b),d=async()=>{const v=o.trim();if(c||v===a)return;const j=await e.planStored(D=>we(D,n,a,v,e.meta));j&&await e.onSave(j,T(s,n).renamed(v))&&e.onRenamed(v)},u=a,f=o,x=r,g=c?ae(s,c):null,t[2]=a,t[3]=n,t[4]=o,t[5]=e,t[6]=s,t[7]=l,t[8]=c,t[9]=d,t[10]=u,t[11]=f,t[12]=x,t[13]=g}else c=t[8],d=t[9],u=t[10],f=t[11],x=t[12],g=t[13];const p=!!c||l;let R;return t[16]!==d||t[17]!==u||t[18]!==f||t[19]!==x||t[20]!==g||t[21]!==p?(R={savedName:u,name:f,setName:x,message:g,blocked:p,rename:d},t[16]=d,t[17]=u,t[18]=f,t[19]=x,t[20]=g,t[21]=p,t[22]=R):R=t[22],R}function Dt(n){const e=y.c(19),{kind:t,id:s,rename:a,pending:o,wholeUses:r,locked:i}=n,l=E();let c;e[0]!==t||e[1]!==l?(c=T(l,t),e[0]=t,e[1]=l,e[2]=c):c=e[2];const d=c;let u;e[3]!==l?(u=l("sectionsEditor.namedRules.nameLabel"),e[3]=l,e[4]=u):u=e[4];let f;e[5]!==s||e[6]!==u?(f=m.jsx(fe,{htmlFor:s,children:u}),e[5]=s,e[6]=u,e[7]=f):f=e[7];let x;e[8]!==d||e[9]!==s||e[10]!==i||e[11]!==o||e[12]!==a||e[13]!==l||e[14]!==r?(x=i?m.jsxs(m.Fragment,{children:[m.jsx(G,{id:s,className:"max-w-xs",value:a.savedName,readOnly:!0,disabled:!0}),i]}):m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(G,{id:s,className:"max-w-xs",value:a.name,onChange:p=>a.setName(p.target.value)}),m.jsx(q,{size:"sm",variant:"outline",disabled:o||a.blocked,onClick:()=>{a.rename()},children:l("sectionsEditor.namedRules.rename")})]}),a.message&&m.jsx("p",{className:"text-xs text-destructive",children:a.message}),m.jsx("p",{className:"text-xs text-muted-foreground",children:d.renameHint}),r>0&&m.jsx("p",{className:"text-xs text-muted-foreground",children:d.renameWholeHint})]}),e[8]=d,e[9]=s,e[10]=i,e[11]=o,e[12]=a,e[13]=l,e[14]=r,e[15]=x):x=e[15];let g;return e[16]!==f||e[17]!==x?(g=m.jsxs("section",{className:"flex flex-col gap-2",children:[f,x]}),e[16]=f,e[17]=x,e[18]=g):g=e[18],g}const Z={running:0,everyone:1,off:2};function Ot(n,e){const t=C(n,"experiments");if(t.kind==="conflict")return[];const s=e?.published??null;return Object.entries(t.values).map(([o,r],i)=>{const l=We(s,"experiments",o,r),c=l==="changed"?qe(s,"experiments",o):void 0;return{order:i,row:{name:o,share:r,status:Ee(r),uses:e?Ne(e,"experiments",o):0,entryState:l,...c!==void 0?{publishedShare:c}:{}}}}).sort((o,r)=>Z[o.row.status]-Z[r.row.status]||o.order-r.order).map(o=>o.row)}function Tt(n,e){return Qe(n,e?.published??null,"experiments")}function Ht(n){const e={contentPageVariant:n.focus?.pageVariant,contentSection:n.focus?.section,contentVariant:n.focus?.variant};return n.blockKind==="page"?{contentPageId:n.blockKey,contentCollection:void 0,contentItem:void 0,...e}:{contentPageId:void 0,contentCollection:"sections",contentItem:n.blockKey,...e}}let A=null;function nt(){return A??=Promise.all([J(()=>import("./agent-site-editor-f4uh78gt.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,156,157,158,159,160,161,162,163,164,165,166])),J(()=>import("./agent-site-editor-content-Cn0JYnPW.js"),__vite__mapDeps([167,1,2,168,169,142,5,4,6,7,8,9,11,12,13,14,15,16,17,38,39,40,41,42,43,44,29,34,45,46,47,35,48,49,50,30,51,52,53,54,55,56,57,58,59,60,61,62,63,64,131,170,148,104,26,97,3,10,18,19,20,21,98,75,76,99,79,100,101,102,103,71,105,106,107,108,109,110,25,111,112,86,87,113,114,115,116,117,85,118,119,120,77,78,121,122,123,124,125,126,127,91,128,129,68,130,132,133,134,135,136,137,138,139,140,141,143,144,145,65,146,147,149,33,36,37,66,67,69,70,72,73,74,80,81,82,83,150,151,31,27,171,172,173,174,175,176,177,90,178,179,180,181,182,183,184,185,186,187,188,96,24,28,32,189,190,162,157,158,191,192,193,156,194,195,196,197,198,199,200,201,153,152,202,161,203,204,205,206,207]))]).catch(n=>{throw A=null,n}),A}function st(n){return e=>{if(!e)return;const t=()=>{n().catch(()=>{})};if(typeof requestIdleCallback=="function"){const a=requestIdleCallback(t,{timeout:2e3});return()=>cancelIdleCallback(a)}const s=setTimeout(t,200);return()=>clearTimeout(s)}}const at=st(nt);function W(n){const e=y.c(7),{icon:t,title:s,description:a,action:o}=n;let r;e[0]!==o?(r=o?{children:o.label,onClick:o.onClick}:void 0,e[0]=o,e[1]=r):r=e[1];let i;return e[2]!==a||e[3]!==t||e[4]!==r||e[5]!==s?(i=m.jsx(V,{children:m.jsx(V.Content,{children:m.jsx(V.Container,{children:m.jsx($e,{icon:t,title:s,description:a,buttonProps:r})})})}),e[2]=a,e[3]=t,e[4]=r,e[5]=s,e[6]=i):i=e[6],i}function It(n){const e=y.c(28),{virtualMcpId:t,icon:s,copy:a,skeleton:o,children:r}=n,i=E(),{org:l}=me(),c=Me(),d=c?.currentBranch??null,u=ne(t,d);ue(u.kind==="protocol"&&u.source==="github");const{openPanel:f}=Ke();if(!d){const p=a.noDraftTitle,R=a.noDraftDesc;let h;e[0]!==i?(h=i("sectionsEditor.namedRules.openEditor"),e[0]=i,e[1]=h):h=e[1];let b;e[2]!==f?(b=()=>f("content"),e[2]=f,e[3]=b):b=e[3];let v;e[4]!==h||e[5]!==b?(v={label:h,onClick:b},e[4]=h,e[5]=b,e[6]=v):v=e[6];let j;return e[7]!==a.noDraftDesc||e[8]!==a.noDraftTitle||e[9]!==s||e[10]!==v?(j=m.jsx(W,{icon:s,title:p,description:R,action:v}),e[7]=a.noDraftDesc,e[8]=a.noDraftTitle,e[9]=s,e[10]=v,e[11]=j):j=e[11],j}if(He(u)){let p;return e[12]===Symbol.for("react.memo_cache_sentinel")?(p=m.jsx(_e,{}),e[12]=p):p=e[12],p}if(u.kind==="pending"){let p;return e[13]!==o?(p=m.jsx(m.Fragment,{children:o}),e[13]=o,e[14]=p):p=e[14],p}if(u.kind!=="protocol"){let p;return e[15]!==a.loadFailed||e[16]!==a.loadFailedHint||e[17]!==s?(p=m.jsx(W,{icon:s,title:a.loadFailed,description:a.loadFailedHint}),e[15]=a.loadFailed,e[16]=a.loadFailedHint,e[17]=s,e[18]=p):p=e[18],p}const x=c?.taskId??null;let g;return e[19]!==d||e[20]!==r||e[21]!==a||e[22]!==s||e[23]!==l.slug||e[24]!==o||e[25]!==x||e[26]!==t?(g=m.jsx(lt,{orgSlug:l.slug,virtualMcpId:t,branch:d,threadId:x,icon:s,copy:a,skeleton:o,children:r},d),e[19]=d,e[20]=r,e[21]=a,e[22]=s,e[23]=l.slug,e[24]=o,e[25]=x,e[26]=t,e[27]=g):g=e[27],g}function lt(n){const e=y.c(30),{orgSlug:t,virtualMcpId:s,branch:a,threadId:o,icon:r,copy:i,skeleton:l,children:c}=n,d=E();let u;e[0]!==a||e[1]!==t||e[2]!==o||e[3]!==s?(u={orgSlug:t,virtualMcpId:s,branch:a,threadId:o,previewUrl:null},e[0]=a,e[1]=t,e[2]=o,e[3]=s,e[4]=u):u=e[4];const f=u,x=Oe(f),g=Ie(f),p=x.data,R=g.data;if(!p||!R){if(x.isError||g.isError){const j=i.loadFailed,D=i.loadFailedHint;let N;e[5]!==d?(N=d("sectionsEditor.namedRules.tryAgain"),e[5]=d,e[6]=N):N=e[6];let S;e[7]!==x||e[8]!==g?(S=()=>{x.refetch(),g.refetch()},e[7]=x,e[8]=g,e[9]=S):S=e[9];let U;e[10]!==N||e[11]!==S?(U={label:N,onClick:S},e[10]=N,e[11]=S,e[12]=U):U=e[12];let k;return e[13]!==i.loadFailed||e[14]!==i.loadFailedHint||e[15]!==r||e[16]!==U?(k=m.jsx(W,{icon:r,title:j,description:D,action:U}),e[13]=i.loadFailed,e[14]=i.loadFailedHint,e[15]=r,e[16]=U,e[17]=k):k=e[17],k}let v;return e[18]!==l?(v=m.jsx(m.Fragment,{children:l}),e[18]=l,e[19]=v):v=e[19],v}let h;e[20]!==a||e[21]!==c||e[22]!==p||e[23]!==R||e[24]!==t||e[25]!==o||e[26]!==s?(h=c({orgSlug:t,virtualMcpId:s,branch:a,threadId:o,decofile:p,meta:R}),e[20]=a,e[21]=c,e[22]=p,e[23]=R,e[24]=t,e[25]=o,e[26]=s,e[27]=h):h=e[27];let b;return e[28]!==h?(b=m.jsx("div",{className:"contents",ref:at,children:h}),e[28]=h,e[29]=b):b=e[29],b}export{yt as N,It as S,Ct as a,tt as b,Ut as c,kt as d,Ot as e,wt as f,Dt as g,Ht as h,jt as i,Et as j,bt as k,W as l,We as m,St as n,qe as o,Le as p,Qe as q,Tt as r,Nt as u};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/agent-site-editor-Cyp35eBO.js","assets/index-DlBqAQ8N.js","assets/index-CDXVQ_TQ.css","assets/chat-context-DQIwjTah.js","assets/use-panel-navigate-CXnDtexh.js","assets/thread-route-Bd56Ws2e.js","assets/use-project-scope-B0GTyJmy.js","assets/repository-binding-CcdmL6ag.js","assets/use-mcp-client-BTazWDn_.js","assets/auth-mUy8P9mz.js","assets/autosend-fmyzxlgv.js","assets/thread-intent-Bcm8nkb-.js","assets/delay-CnY5UFtP.js","assets/backoff-CrEUbyZT.js","assets/watch-sse-pool-Vinolgve.js","assets/task-board-C3fHBdG2.js","assets/schema-BI1J5KjU.js","assets/slugify-CEUa2lfQ.js","assets/use-decopilot-events-Bo1C0-vc.js","assets/use-ai-providers-YeO0Kt-T.js","assets/location-V0VwTJTt.js","assets/use-organization-settings-CQDxv_1k.js","assets/site-draft-actions-CPsRPxRa.js","assets/separator-B0GmpR9Y.js","assets/site-editor-toast-BV71DbMY.js","assets/use-session-runtime-Bpm2BYEZ.js","assets/experiments-tab-choice-CSZHqOVL.js","assets/sandbox-url-D3mC8qhT.js","assets/utils-Cvz7JLdG.js","assets/ZoomOut-DZO-NyFl.js","assets/Image01-C3eHO4JB.js","assets/use-sandbox-events-0ezZYS9_.js","assets/sandbox-git-api-DcqI6XE4.js","assets/shell-layout-Br0nQ-w1.js","assets/Building02-BfF63iaY.js","assets/UserSquare-eFGH-oUL.js","assets/use-deployment-admin-DqPz0gQF.js","assets/admin-fetch-BhTJlAsX.js","assets/agent-icon-D2O6Ysxj.js","assets/AlertCircle-3zlHk1bR.js","assets/Tool01-NhBuMmUV.js","assets/ArrowUp-DYpVM4EW.js","assets/ArrowLeft-DmLRalOz.js","assets/LinkBroken01-D8s-Aoli.js","assets/ShoppingBag01-Diu_6vhS.js","assets/CheckCircle-DFCQG4PZ.js","assets/ChevronUp-BADsHIlZ.js","assets/ChevronSelectorVertical-BQnuYb4d.js","assets/Copy01-BuXPB74z.js","assets/CreditCard01-3pgS1FBj.js","assets/DotsVertical-DGPGhZOp.js","assets/Globe04-h_nDPacm.js","assets/SwitchHorizontal01-DSVF0HAp.js","assets/Key01-BHDBC0Ty.js","assets/Link01-CWRvYa94.js","assets/Minus-BDVlfQ1F.js","assets/Monitor01-DufxSkfE.js","assets/Sun-DwpHFeTI.js","assets/Play-B4Nce4IV.js","assets/Plus-DjulKDZN.js","assets/SearchMd-LiFx-NKw.js","assets/Trash01-6fKruzF0.js","assets/Upload01-XEi-StK2.js","assets/Users01-BsuShWDn.js","assets/XClose-CmswVBOn.js","assets/use-clock-tick-CoJMln1I.js","assets/command-CmSy_63D.js","assets/index-fPzpoiMb.js","assets/integration-icon-DffiYnsw.js","assets/project-icon-C5kNnOFq.js","assets/new-project-dialog-kzuu4Dyf.js","assets/label-CI9_CFR6.js","assets/repository-import-picker-DuNS63Y0.js","assets/use-navigate-to-agent-ClMAT78e.js","assets/repository-picker-D37YtUW-.js","assets/tooltip-CGDwEKla.js","assets/index-y2MV63Fm.js","assets/useInfiniteQuery-ID7ntuLj.js","assets/infiniteQueryObserver-B1X7cH_h.js","assets/collection-search-C7AC5mzN.js","assets/use-debounced-value-HL4NH2l1.js","assets/required-auth-layout-Cj_D5aeR.js","assets/use-org-sso-Br-zUY8K.js","assets/shell-layout-CE2Eihra.css","assets/toolbar-icon-button-Doqx7uIl.js","assets/popover-DClIX5lD.js","assets/tabs-qk95ql5a.js","assets/active-indicator-CCMhAsc_.js","assets/use-releases-BOl4DpnA.js","assets/serial-task-queue-CGOeQgpr.js","assets/virtual-mcp-Bz0i6iLp.js","assets/url-slug-BC1hwMbV.js","assets/use-fast-preview-draft-url-HidTF3Ak.js","assets/section-preview-url-7zfngvgW.js","assets/preview-link-C762yHOt.js","assets/variant-draft-pointer-BeAKcq_c.js","assets/parse-sections-jfUka-ew.js","assets/index-DCpCimmv.js","assets/tool-namespace-Czhk4de_.js","assets/drawer-DoWw3X-U.js","assets/use-mobile-Ba8cwCW_.js","assets/use-mcp-prompts-BtAR7liM.js","assets/usage-stats-DFdXpSTz.js","assets/form-DkJLMDiZ.js","assets/utils-CVEq3hMx.js","assets/markdown-DtVTVyIC.js","assets/use-copy-pG3Nq4mQ.js","assets/input-C1vi2y8a.js","assets/icon-button-NEW9CrVR.js","assets/file-type-icon-BSvWJ_yJ.js","assets/chat-draft-D_5rgFXD.js","assets/select-RAX0QYEC.js","assets/index-BdQq_4o_.js","assets/use-deco-credits-C7mrv7jI.js","assets/toggle-group--gd2dZNu.js","assets/index-Dj2q9Kk6.js","assets/checkbox-B1LwoLFy.js","assets/ai-providers-logos-DD3qZ33J.js","assets/input-BM4k5AWI.js","assets/suggestion-B8EqJCT2.js","assets/use-org-fs-is3Nb4bW.js","assets/question-004-sINsf4GQ.js","assets/feature-paywall-YRUC3hnv.js","assets/plan-ladder-BCwguLCI.js","assets/add-connection-dialog-Bs11uRPt.js","assets/extract-connection-data-dVntHSWe.js","assets/metadata-D72DunRR.js","assets/connection-8s94grp4.js","assets/connection-card-6_vGNwe6.js","assets/connection-slug-CITJ0kGN.js","assets/textarea-Ibxo_cU5.js","assets/use-connection-CPJ2t_wt.js","assets/schema-XnSsI13A.js","assets/connection-form-helpers-B7-YxvfS.js","assets/authenticate-and-persist-oauth-Br6pb9qL.js","assets/mcp-oauth-C2iU61yB.js","assets/mcp-oauth-BgZxPic2.js","assets/collection-tabs-DysuRzTT.js","assets/badge-D_XaqFCD.js","assets/use-infinite-scroll-BWXYJIGE.js","assets/useSuspenseInfiniteQuery-BM00SstB.js","assets/use-task-board-events-Cc9iZtjE.js","assets/use-chat-layout-state-BYFrwE0Z.js","assets/input-Bwd_JSM8.css","assets/pair-BiKkCxaG.js","assets/collapsible-CVxiAnD0.js","assets/content-blocks-o63cs2vh.js","assets/mcp-app-renderer-B0DJyUaD.js","assets/types-BlSD9MKW.js","assets/omit-sandbox-map-jj4lCB2U.js","assets/sheet-7o24rLAF.js","assets/use-thread-outputs-D4Ri80KS.js","assets/hosted-publish-feedback-CpvmWvo8.js","assets/use-cms-publish-actions-BJbCRSe5.js","assets/named-rule-uses-DImccIYP.js","assets/device-hint-SeLRi17j.js","assets/editor-D54k8w6W.js","assets/section-array-field-CfCCudbI.js","assets/alert-BIVSlp4X.js","assets/save-changes-debug-nBi-n9eV.js","assets/releases-api-DxEm_izB.js","assets/sandbox-lifecycle-context-4NgrDeJq.js","assets/sandbox-start-errors-BK_aDCyt.js","assets/index-DHKvbX-F.js","assets/use-sidebar-collapsed-BnhavbaD.js","assets/resizable-DkWxmtNv.js","assets/agent-site-editor-DDGTF8rc.css","assets/agent-site-editor-content-TPfojHsu.js","assets/agent-view-guard-DITCswoZ.js","assets/use-main-panel-tabs-BkwtKsEq.js","assets/use-mcp-tools-CnDXz04m.js","assets/resolve-tab-icon-Bbn4K7a-.js","assets/use-task-metadata-Zdotw36E.js","assets/preview-source-BsRLGWUP.js","assets/use-project-native-view-presence-YGN4D-su.js","assets/match-site-slug-config-D3fUJ6vX.js","assets/use-file-configs-DjM7limQ.js","assets/site-slug-DebpOoQq.js","assets/feature-gate-CGLZlvT1.js","assets/content-tab-C8kwNsNv.js","assets/blocks-tab-states-C7qCSetR.js","assets/slider-C7FCoMPq.js","assets/index-Bah4YwbV.js","assets/tooltipContext-BjbnVzdB.js","assets/CategoricalChart-VnQ3lkHZ.js","assets/index-iHeHzM9q.js","assets/ActiveShapeUtils-CdXsV3S7.js","assets/Sector-Vy_DZ6Ya.js","assets/symbol-An2Zb2zQ.js","assets/empty-state-B6ZF6z6U.js","assets/held-block-view-Bcr038cE.js","assets/switch-DRoHA0RB.js","assets/scroll-area-DyDtaNCg.js","assets/monaco-editor-D_Oeav_Z.js","assets/calendar-D5qyPmPe.js","assets/editor-classes-DvaDe0n2.js","assets/core.esm-8ysL4nmy.js","assets/sortable.esm-3LT8rMWS.js","assets/combobox-DIlCtv4m.js","assets/search-input-JrdzMOm_.js","assets/asset-utils-s-rRWLDR.js","assets/view-header-DNRg1UwP.js","assets/mustache-D61fFDb3.js","assets/date-utils-CrvIKg-s.js","assets/use-move-blocks-CE7PC8Dn.js","assets/empty-state-B1U3dIOI.js","assets/collection-table-wrapper-BkW0lNmQ.js","assets/table-D6WmilUC.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{c as y,b as E,j as m,l as oe,B as q,E as ie,r as M,t as F,x as re,I as G,v as ce,D as de,be as J,a4 as me,bk as ue,n as V}from"./index-DlBqAQ8N.js";import{B as K}from"./badge-D_XaqFCD.js";import{L as fe}from"./label-CI9_CFR6.js";import{s as pe}from"./Trash01-6fKruzF0.js";import{a as xe,n as ge,c as he,d as ve,e as Re,f as be,g as X,h as Ne}from"./named-rule-uses-DImccIYP.js";import{ai as C,ak as Q,an as ee,at as je,d as ye,au as Ce,av as we,aw as Ee}from"./parse-sections-jfUka-ew.js";import{N as te,ax as Se,ay as L,u as ne,D as ke,L as Ue,ae as De,l as Oe}from"./site-editor-toast-BV71DbMY.js";import{y as se,L as ae,p as Te,i as He,u as Ie,S as _e}from"./blocks-tab-states-C7qCSetR.js";import{b as Be}from"./ZoomOut-DZO-NyFl.js";import{a as Fe}from"./UserSquare-eFGH-oUL.js";import{u as Pe}from"./use-apply-named-rule-B8Wdybx9.js";import{E as $e}from"./empty-state-B1U3dIOI.js";import{u as Me}from"./chat-context-DQIwjTah.js";import{a as Ke}from"./use-panel-navigate-CXnDtexh.js";function Le(n,e,t,s){const a=C(n,e);return a.kind==="conflict"?null:{writes:{[Q(e).blockKey]:ee(a.block,e,t,s)}}}function Ve(n,e,t,s){const a=C(n,e);if(a.kind==="conflict")return{problem:"conflict"};const o=se(t,Object.keys(a.values));return o?{problem:o}:{change:Le(n,e,t.trim(),s)}}function Ae(n,e,t){const s=C(n,e);return s.kind!=="saved"||!Object.hasOwn(s.block,t)?null:{writes:{[Q(e).blockKey]:je(s.block,t)}}}function ze(n,e,t,s){if(s===void 0)return null;const a=C(n,e);return a.kind==="conflict"||Object.hasOwn(a.block,t)?null:{writes:{[Q(e).blockKey]:ee(a.block,e,t,s)}}}function We(n,e,t,s){if(!n)return null;const a=C(n,e);return a.kind!=="saved"||!Object.hasOwn(a.values,t)?"new":Ge(a.values[t],s)?"published":"changed"}function qe(n,e,t){if(!n)return;const s=C(n,e);if(s.kind==="saved")return s.values[t]}function Qe(n,e,t){if(!e)return[];const s=C(e,t);if(s.kind!=="saved")return[];const a=C(n,t),o=a.kind==="conflict"?{}:a.values;return Object.keys(s.values).filter(r=>!Object.hasOwn(o,r))}function Ge(n,e){return typeof n=="number"||typeof e=="number"?n===e:Y(n.start,e.start)&&Y(n.end,e.end)}function Y(n,e){return n===void 0||e===void 0?n===e:n===e||new Date(n).getTime()===new Date(e).getTime()}function bt(n){const e=y.c(21),{kind:t,rows:s,wholeRows:a,loading:o,marked:r,onOpen:i}=n,l=E(),c=t==="experiments";let d;e[0]!==l?(d=l("sectionsEditor.namedRuleUses.title"),e[0]=l,e[1]=d):d=e[1];let u;e[2]!==d?(u=m.jsx("h3",{className:"text-sm font-medium",children:d}),e[2]=d,e[3]=u):u=e[3];let f;e[4]!==o||e[5]!==r||e[6]!==i||e[7]!==s||e[8]!==l||e[9]!==c?(f=o?m.jsx("p",{className:"text-sm text-muted-foreground",children:l("sectionsEditor.namedRuleUses.loading")}):s.length===0?m.jsx("p",{className:"text-sm text-muted-foreground",children:l(c?"sectionsEditor.namedRuleUses.emptyTests":"sectionsEditor.namedRuleUses.emptyCampaigns")}):m.jsx(z,{rows:s,marked:r,onOpen:i}),e[4]=o,e[5]=r,e[6]=i,e[7]=s,e[8]=l,e[9]=c,e[10]=f):f=e[10];let x;e[11]!==r||e[12]!==i||e[13]!==l||e[14]!==c||e[15]!==a?(x=a.length>0&&m.jsxs("div",{className:"mt-3 flex flex-col gap-1",children:[m.jsx("h4",{className:"text-xs font-medium text-muted-foreground",children:l(c?"sectionsEditor.namedRuleUses.wholeTests":"sectionsEditor.namedRuleUses.wholeCampaigns")}),m.jsx("p",{className:"text-xs text-muted-foreground",children:l(c?"sectionsEditor.namedRuleUses.wholeTestsHint":"sectionsEditor.namedRuleUses.wholeCampaignsHint")}),m.jsx(z,{rows:a,marked:r,onOpen:i})]}),e[11]=r,e[12]=i,e[13]=l,e[14]=c,e[15]=a,e[16]=x):x=e[16];let g;return e[17]!==u||e[18]!==f||e[19]!==x?(g=m.jsxs("section",{className:"flex flex-col gap-2","data-testid":"named-rule-used-by",children:[u,f,x]}),e[17]=u,e[18]=f,e[19]=x,e[20]=g):g=e[20],g}function z(n){const e=y.c(11),{rows:t,marked:s,onOpen:a}=n,o=E();let r;if(e[0]!==s||e[1]!==a||e[2]!==t||e[3]!==o){let l;e[5]!==s||e[6]!==a||e[7]!==o?(l=c=>{const d=c.blockKind==="page"?Fe:Be,u=c.state==="removed-in-draft";return m.jsxs("li",{className:"flex items-center gap-3 px-3 py-2","data-use-state":c.state,children:[m.jsx(d,{size:14,className:"shrink-0 text-muted-foreground"}),m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("p",{className:oe("truncate text-sm",u&&"text-muted-foreground line-through"),children:c.title}),m.jsx("p",{className:"truncate text-xs text-muted-foreground",children:[c.path,c.section,c.variant?o("sectionsEditor.namedRuleUses.variant",{index:String(c.variant)}):null].filter(Boolean).join(" · ")})]}),s&&c.state==="draft-only"&&m.jsx(K,{variant:"muted",children:o("sectionsEditor.namedRuleUses.draftOnly")}),s&&u&&m.jsx(K,{variant:"muted",children:o("sectionsEditor.namedRuleUses.removed")}),a&&!u&&m.jsxs(q,{type:"button",variant:"ghost",size:"sm",onClick:()=>a(c),children:[o("sectionsEditor.namedRuleUses.open"),m.jsx(ie,{size:14})]})]},xe(c))},e[5]=s,e[6]=a,e[7]=o,e[8]=l):l=e[8],r=t.map(l),e[0]=s,e[1]=a,e[2]=t,e[3]=o,e[4]=r}else r=e[4];let i;return e[9]!==r?(i=m.jsx("ul",{className:"divide-y divide-border/60 rounded-md border border-border/60",children:r}),e[9]=r,e[10]=i):i=e[10],i}function Je(n){const e=y.c(12),{kind:t,rows:s,names:a,onOpen:o}=n,r=E();if(s.length===0)return null;let i;e[0]!==t||e[1]!==a||e[2]!==r?(i=r(t==="experiments"?a===1?"sectionsEditor.namedRuleUses.missingTestOne":"sectionsEditor.namedRuleUses.missingTests":a===1?"sectionsEditor.namedRuleUses.missingCampaignOne":"sectionsEditor.namedRuleUses.missingCampaigns"),e[0]=t,e[1]=a,e[2]=r,e[3]=i):i=e[3];let l;e[4]!==i?(l=m.jsx("p",{className:"text-sm text-muted-foreground",children:i}),e[4]=i,e[5]=l):l=e[5];let c;e[6]!==o||e[7]!==s?(c=m.jsx(z,{rows:s,marked:!1,onOpen:o}),e[6]=o,e[7]=s,e[8]=c):c=e[8];let d;return e[9]!==l||e[10]!==c?(d=m.jsxs("section",{className:"flex flex-col gap-2","data-testid":"named-rule-missing-uses",children:[l,c]}),e[9]=l,e[10]=c,e[11]=d):d=e[11],d}function Xe({kind:n,name:e,meta:t,pending:s,apply:a,reread:o,onDeleted:r,onUndo:i}){const l=E(),c=n==="experiments",[d,u]=M.useState(!1),f=async()=>{const p=await o();return p||F.info(l("sectionsEditor.namedRules.unavailable"),{...L,description:l("sectionsEditor.namedRules.unavailableHint")}),p},x=async p=>{const R=await f();if(!R)return;const h=ze(R,n,e,p);if(h){i(h);return}const b=C(R,n).kind==="conflict";F.info(l(b?"sectionsEditor.namedRules.changedMeanwhile":"sectionsEditor.namedRules.alreadyBack"),{...L,description:l(b?"sectionsEditor.namedRules.changedMeanwhileHint":"sectionsEditor.namedRules.alreadyBackHint")})},g=async()=>{u(!0);let p;try{p=await f()}finally{u(!1)}if(!p)return;const R=Ae(p,n,e);if(!R)return;const h=C(p,n),b=h.kind==="saved"?h.block[e]:void 0,v=ge(l,he(p,t,n,e)),j=await a(R);if(j.ok){if(j.keptTheirs){te(l,!1);return}r(),F.success(c?l("experiments.v8.deleted",{name:e}):l("sandbox.dateCampaigns.deleted",{name:e}),{id:Se,description:v?.one?l("sectionsEditor.namedRuleDelete.stillUsedOne",{places:v.places}):v?l("sectionsEditor.namedRuleDelete.stillUsed",{places:v.places}):l(c?"experiments.v8.deletedHint":"sandbox.dateCampaigns.deletedHint"),action:{label:l("sectionsEditor.namedRules.undo"),onClick:()=>{x(b)}}})}};return m.jsxs(q,{type:"button",variant:"ghost",size:"sm",disabled:s||d,onClick:()=>{g()},children:[m.jsx(pe,{size:16}),l(c?"experiments.v8.delete":"sandbox.dateCampaigns.delete")]})}function Ye(n){const e=y.c(11);let t;e[0]!==n.branch||e[1]!==n.orgSlug||e[2]!==n.virtualMcpId?(t={orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch},e[0]=n.branch,e[1]=n.orgSlug,e[2]=n.virtualMcpId,e[3]=t):t=e[3];const s=t,a=ne(n.virtualMcpId,n.branch),o=ke(s),r=Ue(a,o||null),i=De(a,o||null,r.data);if(!n.decofile)return null;let l;e[4]!==r.data?(l=r.data?Object.keys(r.data.changes).length:void 0,e[4]=r.data,e[5]=l):l=e[5];const c=i.data?.entries;let d;return e[6]!==n.decofile||e[7]!==n.meta||e[8]!==l||e[9]!==c?(d=ve({decofile:n.decofile,meta:n.meta,changeCount:l,sides:c}),e[6]=n.decofile,e[7]=n.meta,e[8]=l,e[9]=c,e[10]=d):d=e[10],d}function T(n,e){return e==="experiments"?{new:n("experiments.v8.new"),usedBy:t=>n("experiments.v8.usedBy",{count:String(t)}),notUsed:n("experiments.v8.notUsed"),stateNew:n("experiments.v8.state.new"),stateChanged:n("experiments.v8.state.changed"),removedTitle:n("experiments.v8.removedTitle"),removedHint:n("experiments.v8.removedHint"),created:t=>n("sectionsEditor.namedRulePicker.createdTest",{name:t}),renamed:t=>n("experiments.v8.renamed",{name:t}),renameHint:n("experiments.v8.renameHint"),renameWholeHint:n("experiments.v8.renameWholeHint")}:{new:n("sandbox.dateCampaigns.new"),usedBy:t=>n("sandbox.dateCampaigns.usedBy",{count:String(t)}),notUsed:n("sandbox.dateCampaigns.notUsed"),stateNew:n("sandbox.dateCampaigns.state.new"),stateChanged:n("sandbox.dateCampaigns.state.changed"),removedTitle:n("sandbox.dateCampaigns.removedTitle"),removedHint:n("sandbox.dateCampaigns.removedHint"),created:t=>n("sectionsEditor.namedRulePicker.createdCampaign",{name:t}),renamed:t=>n("sandbox.dateCampaigns.renamed",{name:t}),renameHint:n("sandbox.dateCampaigns.renameHint"),renameWholeHint:n("sandbox.dateCampaigns.renameWholeHint")}}function Ze(n,e,t){const s=ye(e,t);return s!=="available"?s:C(n,t).kind==="conflict"?"conflict":null}function Nt(n,e){const t=y.c(49),s=E(),{orgSlug:a,virtualMcpId:o,branch:r,decofile:i,meta:l}=e;let c;t[0]!==r||t[1]!==i||t[2]!==l||t[3]!==a||t[4]!==o?(c={orgSlug:a,virtualMcpId:o,branch:r,decofile:i,meta:l},t[0]=r,t[1]=i,t[2]=l,t[3]=a,t[4]=o,t[5]=c):c=t[5];const d=Ye(c);let u;t[6]!==r||t[7]!==a||t[8]!==o?(u={orgSlug:a,virtualMcpId:o,branch:r},t[6]=r,t[7]=a,t[8]=o,t[9]=u):u=t[9];const{apply:f,reread:x,planStored:g,isPending:p,holdsCopy:R}=Pe(u),[h,b]=M.useState(null),[v,j]=M.useState(!1);let D;t[10]!==f||t[11]!==s?(D=async(w,$)=>{const B=$===void 0?s("sectionsEditor.namedRules.saved"):$;if(!w)return!1;const O=await f(w);return O.ok&&O.keptTheirs?te(s,!1):O.ok&&F.success(B,{...L,description:s("sectionsEditor.namedRules.savedHint")}),O.ok},t[10]=f,t[11]=s,t[12]=D):D=t[12];const N=D;let S;t[13]!==i||t[14]!==n||t[15]!==N||t[16]!==s?(S=w=>{if(w.kind!==n||!w.create)return;const $=w.kind==="experiments"?w.create.share:w.create.window,B=Ve(i,n,w.name,$);if(!("change"in B)){F.info(B.problem==="conflict"?s("sectionsEditor.namedRules.changedMeanwhile"):ae(s,B.problem),L);return}const O=w.name.trim();N(B.change,T(s,n).created(O)).then(le=>{le&&(j(!1),b(O))})},t[13]=i,t[14]=n,t[15]=N,t[16]=s,t[17]=S):S=t[17];const U=S;let k;t[18]!==i||t[19]!==n||t[20]!==l?(k=Ze(i,l,n),t[18]=i,t[19]=n,t[20]=l,t[21]=k):k=t[21];let H;t[22]!==i||t[23]!==n||t[24]!==l||t[25]!==d?(H=d?Re(d,n,i,l):[],t[22]=i,t[23]=n,t[24]=l,t[25]=d,t[26]=H):H=t[26];let I;t[27]!==i||t[28]!==n||t[29]!==l||t[30]!==d?(I=d?be(d,n,i,l):0,t[27]=i,t[28]=n,t[29]=l,t[30]=d,t[31]=I):I=t[31];let _;t[32]!==N?(_=w=>{N(w)},t[32]=N,t[33]=_):_=t[33];let P;return t[34]!==f||t[35]!==U||t[36]!==v||t[37]!==R||t[38]!==p||t[39]!==h||t[40]!==g||t[41]!==x||t[42]!==N||t[43]!==k||t[44]!==H||t[45]!==I||t[46]!==_||t[47]!==d?(P={uses:d,apply:f,reread:x,planStored:g,isPending:p,holdsCopy:R,openName:h,setOpenName:b,creating:v,setCreating:j,blocked:k,missing:H,missingNames:I,save:N,create:U,undo:_},t[34]=f,t[35]=U,t[36]=v,t[37]=R,t[38]=p,t[39]=h,t[40]=g,t[41]=x,t[42]=N,t[43]=k,t[44]=H,t[45]=I,t[46]=_,t[47]=d,t[48]=P):P=t[48],P}function jt(n){const e=y.c(23),{kind:t,open:s,onOpenChange:a,existingNames:o,pending:r,onCreate:i}=n,l=E();let c;e[0]!==t||e[1]!==l?(c=T(l,t),e[0]=t,e[1]=l,e[2]=c):c=e[2];let d;e[3]!==c.new?(d=m.jsx(re,{className:"sr-only",children:c.new}),e[3]=c.new,e[4]=d):d=e[4];let u;e[5]!==l?(u=l("sectionsEditor.namedRules.create"),e[5]=l,e[6]=u):u=e[6];let f;e[7]!==a?(f=()=>a(!1),e[7]=a,e[8]=f):f=e[8];let x;e[9]!==o||e[10]!==t||e[11]!==i||e[12]!==r||e[13]!==u||e[14]!==f?(x=m.jsx(Te,{kind:t,initialName:"",existingNames:o,pending:r,submitLabel:u,dismiss:"cancel",standalone:!0,onBack:f,onSubmit:i}),e[9]=o,e[10]=t,e[11]=i,e[12]=r,e[13]=u,e[14]=f,e[15]=x):x=e[15];let g;e[16]!==d||e[17]!==x?(g=m.jsxs(ce,{className:"p-0 sm:max-w-md",children:[d,x]}),e[16]=d,e[17]=x,e[18]=g):g=e[18];let p;return e[19]!==a||e[20]!==s||e[21]!==g?(p=m.jsx(de,{open:s,onOpenChange:a,children:g}),e[19]=a,e[20]=s,e[21]=g,e[22]=p):p=e[22],p}function yt(n){const e=y.c(14),{kind:t,missing:s,missingNames:a,removed:o,onOpenUse:r}=n,i=E();let l;e[0]!==t||e[1]!==i?(l=T(i,t),e[0]=t,e[1]=i,e[2]=l):l=e[2];const c=l;let d;e[3]!==t||e[4]!==s||e[5]!==a||e[6]!==r?(d=m.jsx(Je,{kind:t,rows:s,names:a,onOpen:r}),e[3]=t,e[4]=s,e[5]=a,e[6]=r,e[7]=d):d=e[7];let u;e[8]!==c||e[9]!==o?(u=o.length>0&&m.jsxs("div",{className:"flex flex-col gap-1",children:[m.jsx("h3",{className:"text-sm font-medium",children:c.removedTitle}),m.jsx("p",{className:"text-xs text-muted-foreground",children:c.removedHint}),m.jsx("ul",{className:"text-sm text-muted-foreground",children:o.map(et)})]}),e[8]=c,e[9]=o,e[10]=u):u=e[10];let f;return e[11]!==d||e[12]!==u?(f=m.jsxs(m.Fragment,{children:[d,u]}),e[11]=d,e[12]=u,e[13]=f):f=e[13],f}function et(n){return m.jsx("li",{className:"line-through",children:n},n)}function Ct(n,e,t){const s=T(n,e);return t>0?s.usedBy(t):s.notUsed}function tt(n){const e=y.c(7),{kind:t,state:s,changed:a}=n,o=a===void 0?!0:a,r=E();let i;e[0]!==t||e[1]!==r?(i=T(r,t),e[0]=t,e[1]=r,e[2]=i):i=e[2];const l=i;if(s==="new"){let c;return e[3]!==l.stateNew?(c=m.jsx(K,{variant:"muted",children:l.stateNew}),e[3]=l.stateNew,e[4]=c):c=e[4],c}if(s==="changed"&&o){let c;return e[5]!==l.stateChanged?(c=m.jsx(K,{variant:"muted",children:l.stateChanged}),e[5]=l.stateChanged,e[6]=c):c=e[6],c}return null}function wt(n){const e=y.c(9),{kind:t,name:s,status:a,entryState:o}=n;let r;e[0]!==s?(r=m.jsx("h2",{className:"text-lg font-semibold",children:s}),e[0]=s,e[1]=r):r=e[1];let i;e[2]!==o||e[3]!==t?(i=m.jsx(tt,{kind:t,state:o,changed:!1}),e[2]=o,e[3]=t,e[4]=i):i=e[4];let l;return e[5]!==a||e[6]!==r||e[7]!==i?(l=m.jsxs("div",{className:"flex items-center gap-3",children:[r,a,i]}),e[5]=a,e[6]=r,e[7]=i,e[8]=l):l=e[8],l}function Et(n){const e=y.c(9),{kind:t,detail:s}=n;let a;return e[0]!==s.apply||e[1]!==s.meta||e[2]!==s.onDeleted||e[3]!==s.onUndo||e[4]!==s.pending||e[5]!==s.reread||e[6]!==s.row.name||e[7]!==t?(a=m.jsx(Xe,{kind:t,name:s.row.name,meta:s.meta,pending:s.pending,apply:s.apply,reread:s.reread,onDeleted:s.onDeleted,onUndo:s.onUndo}),e[0]=s.apply,e[1]=s.meta,e[2]=s.onDeleted,e[3]=s.onUndo,e[4]=s.pending,e[5]=s.reread,e[6]=s.row.name,e[7]=t,e[8]=a):a=e[8],a}function St(n,e,t){return{row:e,decofile:t.decofile,meta:t.meta,uses:n.uses,pending:n.isPending,holdsCopy:n.holdsCopy,onBack:()=>n.setOpenName(null),onOpenUse:t.onOpenUse,onSave:n.save,onRenamed:n.setOpenName,apply:n.apply,reread:n.reread,planStored:n.planStored,onDeleted:()=>n.setOpenName(null),onUndo:n.undo}}function kt(n,e,t,s,a){return{useRows:t?X(t,n,e,s,a):[],wholeRows:t?X(t,n,null,s,a):[]}}function Ut(n,e){const t=y.c(23),s=E(),a=e.row.name,[o,r]=M.useState(a);let i;t[0]!==o?(i=o.trim(),t[0]=o,t[1]=i):i=t[1];const l=i===a;let c,d,u,f,x,g;if(t[2]!==a||t[3]!==n||t[4]!==o||t[5]!==e||t[6]!==s||t[7]!==l){let h;t[14]!==a?(h=v=>v!==a,t[14]=a,t[15]=h):h=t[15];const b=Ce(C(e.decofile,n)).filter(h);c=l?null:se(o,b),d=async()=>{const v=o.trim();if(c||v===a)return;const j=await e.planStored(D=>we(D,n,a,v,e.meta));j&&await e.onSave(j,T(s,n).renamed(v))&&e.onRenamed(v)},u=a,f=o,x=r,g=c?ae(s,c):null,t[2]=a,t[3]=n,t[4]=o,t[5]=e,t[6]=s,t[7]=l,t[8]=c,t[9]=d,t[10]=u,t[11]=f,t[12]=x,t[13]=g}else c=t[8],d=t[9],u=t[10],f=t[11],x=t[12],g=t[13];const p=!!c||l;let R;return t[16]!==d||t[17]!==u||t[18]!==f||t[19]!==x||t[20]!==g||t[21]!==p?(R={savedName:u,name:f,setName:x,message:g,blocked:p,rename:d},t[16]=d,t[17]=u,t[18]=f,t[19]=x,t[20]=g,t[21]=p,t[22]=R):R=t[22],R}function Dt(n){const e=y.c(19),{kind:t,id:s,rename:a,pending:o,wholeUses:r,locked:i}=n,l=E();let c;e[0]!==t||e[1]!==l?(c=T(l,t),e[0]=t,e[1]=l,e[2]=c):c=e[2];const d=c;let u;e[3]!==l?(u=l("sectionsEditor.namedRules.nameLabel"),e[3]=l,e[4]=u):u=e[4];let f;e[5]!==s||e[6]!==u?(f=m.jsx(fe,{htmlFor:s,children:u}),e[5]=s,e[6]=u,e[7]=f):f=e[7];let x;e[8]!==d||e[9]!==s||e[10]!==i||e[11]!==o||e[12]!==a||e[13]!==l||e[14]!==r?(x=i?m.jsxs(m.Fragment,{children:[m.jsx(G,{id:s,className:"max-w-xs",value:a.savedName,readOnly:!0,disabled:!0}),i]}):m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(G,{id:s,className:"max-w-xs",value:a.name,onChange:p=>a.setName(p.target.value)}),m.jsx(q,{size:"sm",variant:"outline",disabled:o||a.blocked,onClick:()=>{a.rename()},children:l("sectionsEditor.namedRules.rename")})]}),a.message&&m.jsx("p",{className:"text-xs text-destructive",children:a.message}),m.jsx("p",{className:"text-xs text-muted-foreground",children:d.renameHint}),r>0&&m.jsx("p",{className:"text-xs text-muted-foreground",children:d.renameWholeHint})]}),e[8]=d,e[9]=s,e[10]=i,e[11]=o,e[12]=a,e[13]=l,e[14]=r,e[15]=x):x=e[15];let g;return e[16]!==f||e[17]!==x?(g=m.jsxs("section",{className:"flex flex-col gap-2",children:[f,x]}),e[16]=f,e[17]=x,e[18]=g):g=e[18],g}const Z={running:0,everyone:1,off:2};function Ot(n,e){const t=C(n,"experiments");if(t.kind==="conflict")return[];const s=e?.published??null;return Object.entries(t.values).map(([o,r],i)=>{const l=We(s,"experiments",o,r),c=l==="changed"?qe(s,"experiments",o):void 0;return{order:i,row:{name:o,share:r,status:Ee(r),uses:e?Ne(e,"experiments",o):0,entryState:l,...c!==void 0?{publishedShare:c}:{}}}}).sort((o,r)=>Z[o.row.status]-Z[r.row.status]||o.order-r.order).map(o=>o.row)}function Tt(n,e){return Qe(n,e?.published??null,"experiments")}function Ht(n){const e={contentPageVariant:n.focus?.pageVariant,contentSection:n.focus?.section,contentVariant:n.focus?.variant};return n.blockKind==="page"?{contentPageId:n.blockKey,contentCollection:void 0,contentItem:void 0,...e}:{contentPageId:void 0,contentCollection:"sections",contentItem:n.blockKey,...e}}let A=null;function nt(){return A??=Promise.all([J(()=>import("./agent-site-editor-Cyp35eBO.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,156,157,158,159,160,161,162,163,164,165,166])),J(()=>import("./agent-site-editor-content-TPfojHsu.js"),__vite__mapDeps([167,1,2,168,169,142,5,4,6,7,8,9,11,12,13,14,15,16,17,38,39,40,41,42,43,44,29,34,45,46,47,35,48,49,50,30,51,52,53,54,55,56,57,58,59,60,61,62,63,64,131,170,148,104,26,97,3,10,18,19,20,21,98,75,76,99,79,100,101,102,103,71,105,106,107,108,109,110,25,111,112,86,87,113,114,115,116,117,85,118,119,120,77,78,121,122,123,124,125,126,127,91,128,129,68,130,132,133,134,135,136,137,138,139,140,141,143,144,145,65,146,147,149,33,36,37,66,67,69,70,72,73,74,80,81,82,83,150,151,31,27,171,172,173,174,175,176,177,90,178,179,180,181,182,183,184,185,186,187,188,96,24,28,32,189,190,162,157,158,191,192,193,156,194,195,196,197,198,199,200,201,153,152,202,161,203,204,205,206,207]))]).catch(n=>{throw A=null,n}),A}function st(n){return e=>{if(!e)return;const t=()=>{n().catch(()=>{})};if(typeof requestIdleCallback=="function"){const a=requestIdleCallback(t,{timeout:2e3});return()=>cancelIdleCallback(a)}const s=setTimeout(t,200);return()=>clearTimeout(s)}}const at=st(nt);function W(n){const e=y.c(7),{icon:t,title:s,description:a,action:o}=n;let r;e[0]!==o?(r=o?{children:o.label,onClick:o.onClick}:void 0,e[0]=o,e[1]=r):r=e[1];let i;return e[2]!==a||e[3]!==t||e[4]!==r||e[5]!==s?(i=m.jsx(V,{children:m.jsx(V.Content,{children:m.jsx(V.Container,{children:m.jsx($e,{icon:t,title:s,description:a,buttonProps:r})})})}),e[2]=a,e[3]=t,e[4]=r,e[5]=s,e[6]=i):i=e[6],i}function It(n){const e=y.c(28),{virtualMcpId:t,icon:s,copy:a,skeleton:o,children:r}=n,i=E(),{org:l}=me(),c=Me(),d=c?.currentBranch??null,u=ne(t,d);ue(u.kind==="protocol"&&u.source==="github");const{openPanel:f}=Ke();if(!d){const p=a.noDraftTitle,R=a.noDraftDesc;let h;e[0]!==i?(h=i("sectionsEditor.namedRules.openEditor"),e[0]=i,e[1]=h):h=e[1];let b;e[2]!==f?(b=()=>f("content"),e[2]=f,e[3]=b):b=e[3];let v;e[4]!==h||e[5]!==b?(v={label:h,onClick:b},e[4]=h,e[5]=b,e[6]=v):v=e[6];let j;return e[7]!==a.noDraftDesc||e[8]!==a.noDraftTitle||e[9]!==s||e[10]!==v?(j=m.jsx(W,{icon:s,title:p,description:R,action:v}),e[7]=a.noDraftDesc,e[8]=a.noDraftTitle,e[9]=s,e[10]=v,e[11]=j):j=e[11],j}if(He(u)){let p;return e[12]===Symbol.for("react.memo_cache_sentinel")?(p=m.jsx(_e,{}),e[12]=p):p=e[12],p}if(u.kind==="pending"){let p;return e[13]!==o?(p=m.jsx(m.Fragment,{children:o}),e[13]=o,e[14]=p):p=e[14],p}if(u.kind!=="protocol"){let p;return e[15]!==a.loadFailed||e[16]!==a.loadFailedHint||e[17]!==s?(p=m.jsx(W,{icon:s,title:a.loadFailed,description:a.loadFailedHint}),e[15]=a.loadFailed,e[16]=a.loadFailedHint,e[17]=s,e[18]=p):p=e[18],p}const x=c?.taskId??null;let g;return e[19]!==d||e[20]!==r||e[21]!==a||e[22]!==s||e[23]!==l.slug||e[24]!==o||e[25]!==x||e[26]!==t?(g=m.jsx(lt,{orgSlug:l.slug,virtualMcpId:t,branch:d,threadId:x,icon:s,copy:a,skeleton:o,children:r},d),e[19]=d,e[20]=r,e[21]=a,e[22]=s,e[23]=l.slug,e[24]=o,e[25]=x,e[26]=t,e[27]=g):g=e[27],g}function lt(n){const e=y.c(30),{orgSlug:t,virtualMcpId:s,branch:a,threadId:o,icon:r,copy:i,skeleton:l,children:c}=n,d=E();let u;e[0]!==a||e[1]!==t||e[2]!==o||e[3]!==s?(u={orgSlug:t,virtualMcpId:s,branch:a,threadId:o,previewUrl:null},e[0]=a,e[1]=t,e[2]=o,e[3]=s,e[4]=u):u=e[4];const f=u,x=Oe(f),g=Ie(f),p=x.data,R=g.data;if(!p||!R){if(x.isError||g.isError){const j=i.loadFailed,D=i.loadFailedHint;let N;e[5]!==d?(N=d("sectionsEditor.namedRules.tryAgain"),e[5]=d,e[6]=N):N=e[6];let S;e[7]!==x||e[8]!==g?(S=()=>{x.refetch(),g.refetch()},e[7]=x,e[8]=g,e[9]=S):S=e[9];let U;e[10]!==N||e[11]!==S?(U={label:N,onClick:S},e[10]=N,e[11]=S,e[12]=U):U=e[12];let k;return e[13]!==i.loadFailed||e[14]!==i.loadFailedHint||e[15]!==r||e[16]!==U?(k=m.jsx(W,{icon:r,title:j,description:D,action:U}),e[13]=i.loadFailed,e[14]=i.loadFailedHint,e[15]=r,e[16]=U,e[17]=k):k=e[17],k}let v;return e[18]!==l?(v=m.jsx(m.Fragment,{children:l}),e[18]=l,e[19]=v):v=e[19],v}let h;e[20]!==a||e[21]!==c||e[22]!==p||e[23]!==R||e[24]!==t||e[25]!==o||e[26]!==s?(h=c({orgSlug:t,virtualMcpId:s,branch:a,threadId:o,decofile:p,meta:R}),e[20]=a,e[21]=c,e[22]=p,e[23]=R,e[24]=t,e[25]=o,e[26]=s,e[27]=h):h=e[27];let b;return e[28]!==h?(b=m.jsx("div",{className:"contents",ref:at,children:h}),e[28]=h,e[29]=b):b=e[29],b}export{yt as N,It as S,Ct as a,tt as b,Ut as c,kt as d,Ot as e,wt as f,Dt as g,Ht as h,jt as i,Et as j,bt as k,W as l,We as m,St as n,qe as o,Le as p,Qe as q,Tt as r,Nt as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as u,r as g,j as n,H as F,$ as G,a0 as H,a as E,k as P,b as O,n as y,L as M}from"./index-DlBqAQ8N.js";import{C as V}from"./chat-context-DQIwjTah.js";import{C as x}from"./index-DHKvbX-F.js";import{L}from"./index-C1xdxqY4.js";import{B as K}from"./blocks-preview-workspace-context-BkWHKGnG.js";import{e as T,p as W,s as J,a as U,r as z,T as $,u as R,b as q}from"./site-editor-toast-BV71DbMY.js";import{u as Q,L as B,P as X,S as Y}from"./preview-tab-qtdXsUO8.js";import{C as Z}from"./content-tab-C8kwNsNv.js";import{T as tt}from"./tab-icon-glyph-B34XQCM3.js";import{r as et}from"./resolve-tab-icon-Bbn4K7a-.js";import ot from"./agent-site-editor-Cyp35eBO.js";import"./use-panel-navigate-CXnDtexh.js";import"./thread-route-Bd56Ws2e.js";import"./use-project-scope-B0GTyJmy.js";import"./repository-binding-CcdmL6ag.js";import"./use-mcp-client-BTazWDn_.js";import"./auth-mUy8P9mz.js";import"./autosend-fmyzxlgv.js";import"./thread-intent-Bcm8nkb-.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./watch-sse-pool-Vinolgve.js";import"./task-board-C3fHBdG2.js";import"./schema-BI1J5KjU.js";import"./slugify-CEUa2lfQ.js";import"./use-decopilot-events-Bo1C0-vc.js";import"./use-ai-providers-YeO0Kt-T.js";import"./location-V0VwTJTt.js";import"./use-organization-settings-CQDxv_1k.js";import"./use-mobile-Ba8cwCW_.js";import"./use-sidebar-collapsed-BnhavbaD.js";import"./use-chat-layout-state-BYFrwE0Z.js";import"./agent-icon-D2O6Ysxj.js";import"./AlertCircle-3zlHk1bR.js";import"./Tool01-NhBuMmUV.js";import"./ArrowUp-DYpVM4EW.js";import"./ArrowLeft-DmLRalOz.js";import"./LinkBroken01-D8s-Aoli.js";import"./ShoppingBag01-Diu_6vhS.js";import"./ZoomOut-DZO-NyFl.js";import"./Building02-BfF63iaY.js";import"./CheckCircle-DFCQG4PZ.js";import"./ChevronUp-BADsHIlZ.js";import"./ChevronSelectorVertical-BQnuYb4d.js";import"./UserSquare-eFGH-oUL.js";import"./Copy01-BuXPB74z.js";import"./CreditCard01-3pgS1FBj.js";import"./DotsVertical-DGPGhZOp.js";import"./Image01-C3eHO4JB.js";import"./Globe04-h_nDPacm.js";import"./SwitchHorizontal01-DSVF0HAp.js";import"./Key01-BHDBC0Ty.js";import"./Link01-CWRvYa94.js";import"./Minus-BDVlfQ1F.js";import"./Monitor01-DufxSkfE.js";import"./Sun-DwpHFeTI.js";import"./Play-B4Nce4IV.js";import"./Plus-DjulKDZN.js";import"./SearchMd-LiFx-NKw.js";import"./Trash01-6fKruzF0.js";import"./Upload01-XEi-StK2.js";import"./Users01-BsuShWDn.js";import"./XClose-CmswVBOn.js";import"./tooltip-CGDwEKla.js";import"./index-y2MV63Fm.js";import"./toolbar-icon-button-Doqx7uIl.js";import"./shell-layout-Br0nQ-w1.js";import"./use-deployment-admin-DqPz0gQF.js";import"./admin-fetch-BhTJlAsX.js";import"./use-clock-tick-CoJMln1I.js";import"./command-CmSy_63D.js";import"./index-fPzpoiMb.js";import"./integration-icon-DffiYnsw.js";import"./project-icon-C5kNnOFq.js";import"./new-project-dialog-kzuu4Dyf.js";import"./label-CI9_CFR6.js";import"./repository-import-picker-DuNS63Y0.js";import"./use-navigate-to-agent-ClMAT78e.js";import"./repository-picker-D37YtUW-.js";import"./useInfiniteQuery-ID7ntuLj.js";import"./infiniteQueryObserver-B1X7cH_h.js";import"./collection-search-C7AC5mzN.js";import"./use-debounced-value-HL4NH2l1.js";import"./required-auth-layout-Cj_D5aeR.js";import"./use-org-sso-Br-zUY8K.js";import"./sheet-7o24rLAF.js";import"./resizable-DkWxmtNv.js";import"./core.esm-8ysL4nmy.js";import"./sortable.esm-3LT8rMWS.js";import"./context-menu-DrJNCXai.js";import"./create-organization-dialog-CRVy32Y2.js";import"./form-DkJLMDiZ.js";import"./project-apps-CWp3jzPS.js";import"./use-recent-apps-Dpk0kWXv.js";import"./use-session-runtime-Bpm2BYEZ.js";import"./experiments-tab-choice-CSZHqOVL.js";import"./sandbox-url-D3mC8qhT.js";import"./utils-Cvz7JLdG.js";import"./use-sandbox-events-0ezZYS9_.js";import"./sandbox-git-api-DcqI6XE4.js";import"./held-block-view-Bcr038cE.js";import"./sandbox-start-errors-BK_aDCyt.js";import"./pair-BiKkCxaG.js";import"./collapsible-CVxiAnD0.js";import"./use-copy-pG3Nq4mQ.js";import"./usage-stats-DFdXpSTz.js";import"./tool-namespace-Czhk4de_.js";import"./utils-CVEq3hMx.js";import"./markdown-DtVTVyIC.js";import"./content-blocks-o63cs2vh.js";import"./mcp-app-renderer-B0DJyUaD.js";import"./types-BlSD9MKW.js";import"./omit-sandbox-map-jj4lCB2U.js";import"./use-connection-CPJ2t_wt.js";import"./use-mcp-prompts-BtAR7liM.js";import"./use-thread-outputs-D4Ri80KS.js";import"./file-type-icon-BSvWJ_yJ.js";import"./section-array-field-CfCCudbI.js";import"./alert-BIVSlp4X.js";import"./parse-sections-jfUka-ew.js";import"./blocks-tab-states-C7qCSetR.js";import"./slider-C7FCoMPq.js";import"./index-Bah4YwbV.js";import"./index-BdQq_4o_.js";import"./tooltipContext-BjbnVzdB.js";import"./CategoricalChart-VnQ3lkHZ.js";import"./index-iHeHzM9q.js";import"./ActiveShapeUtils-CdXsV3S7.js";import"./Sector-Vy_DZ6Ya.js";import"./symbol-An2Zb2zQ.js";import"./empty-state-B6ZF6z6U.js";import"./switch-DRoHA0RB.js";import"./textarea-Ibxo_cU5.js";import"./popover-DClIX5lD.js";import"./scroll-area-DyDtaNCg.js";import"./monaco-editor-D_Oeav_Z.js";import"./editor-D54k8w6W.js";import"./calendar-D5qyPmPe.js";import"./select-RAX0QYEC.js";import"./editor-classes-DvaDe0n2.js";import"./toggle-group--gd2dZNu.js";import"./active-indicator-CCMhAsc_.js";import"./combobox-DIlCtv4m.js";import"./search-input-JrdzMOm_.js";import"./tabs-qk95ql5a.js";import"./use-file-configs-DjM7limQ.js";import"./asset-utils-s-rRWLDR.js";import"./match-site-slug-config-D3fUJ6vX.js";import"./sandbox-lifecycle-context-4NgrDeJq.js";import"./variant-matcher-override-0q1jVuDF.js";import"./variant-draft-pointer-BeAKcq_c.js";import"./section-preview-url-7zfngvgW.js";import"./use-fast-preview-draft-url-HidTF3Ak.js";import"./preview-link-C762yHOt.js";import"./useQueries-MdybfDim.js";import"./device-hint-SeLRi17j.js";import"./virtual-mcp-Bz0i6iLp.js";import"./url-slug-BC1hwMbV.js";import"./app-preview-url-9Od4s8Sz.js";import"./preview-source-BsRLGWUP.js";import"./use-task-metadata-Zdotw36E.js";import"./view-header-DNRg1UwP.js";import"./use-cms-publish-actions-BJbCRSe5.js";import"./hosted-publish-feedback-CpvmWvo8.js";import"./mustache-D61fFDb3.js";import"./checkbox-B1LwoLFy.js";import"./date-utils-CrvIKg-s.js";import"./use-move-blocks-CE7PC8Dn.js";import"./badge-D_XaqFCD.js";import"./empty-state-B1U3dIOI.js";import"./collection-table-wrapper-BkW0lNmQ.js";import"./table-D6WmilUC.js";import"./site-draft-actions-CPsRPxRa.js";import"./separator-B0GmpR9Y.js";import"./use-releases-BOl4DpnA.js";import"./serial-task-queue-CGOeQgpr.js";import"./index-DCpCimmv.js";import"./drawer-DoWw3X-U.js";import"./input-C1vi2y8a.js";import"./icon-button-NEW9CrVR.js";import"./chat-draft-D_5rgFXD.js";import"./use-deco-credits-C7mrv7jI.js";import"./index-Dj2q9Kk6.js";import"./ai-providers-logos-DD3qZ33J.js";import"./input-BM4k5AWI.js";import"./suggestion-B8EqJCT2.js";import"./use-org-fs-is3Nb4bW.js";import"./question-004-sINsf4GQ.js";import"./feature-paywall-YRUC3hnv.js";import"./plan-ladder-BCwguLCI.js";import"./add-connection-dialog-Bs11uRPt.js";import"./extract-connection-data-dVntHSWe.js";import"./metadata-D72DunRR.js";import"./connection-8s94grp4.js";import"./connection-card-6_vGNwe6.js";import"./connection-slug-CITJ0kGN.js";import"./schema-XnSsI13A.js";import"./connection-form-helpers-B7-YxvfS.js";import"./authenticate-and-persist-oauth-Br6pb9qL.js";import"./mcp-oauth-C2iU61yB.js";import"./mcp-oauth-BgZxPic2.js";import"./collection-tabs-DysuRzTT.js";import"./use-infinite-scroll-BWXYJIGE.js";import"./useSuspenseInfiniteQuery-BM00SstB.js";import"./use-task-board-events-Cc9iZtjE.js";import"./named-rule-uses-DImccIYP.js";import"./save-changes-debug-nBi-n9eV.js";import"./releases-api-DxEm_izB.js";function I(e){return e.kind==="unavailable"&&e.source==="local"&&(e.problem?.reason??"not-answering")==="not-answering"}const it=e=>e;function rt(e){const t=u.c(10),{candidates:o,invalidLink:c,shell:m,editor:i}=e,r=c===void 0?!1:c,s=m===void 0?it:m,[p,l]=g.useState(null);if(p){let f;t[0]===Symbol.for("react.memo_cache_sentinel")?(f=()=>l(null),t[0]=f):f=t[0];let h;return t[1]!==p||t[2]!==i?(h=i(p,f),t[1]=p,t[2]=i,t[3]=h):h=t[3],h}let a;t[4]!==o||t[5]!==r?(a=n.jsx(nt,{candidates:o,invalidLink:r,onConnect:l}),t[4]=o,t[5]=r,t[6]=a):a=t[6];let d;return t[7]!==s||t[8]!==a?(d=s(a),t[7]=s,t[8]=a,t[9]=d):d=t[9],d}function nt(e){const t=u.c(17),{candidates:o,invalidLink:c,onConnect:m}=e,i=c===void 0?!1:c,[r]=F(),{language:s}=r;let p;t[0]!==m?(p=D=>m({endpoint:D}),t[0]=m,t[1]=p):p=t[1];let l;t[2]!==o||t[3]!==p?(l={candidates:o,onFound:p},t[2]=o,t[3]=p,t[4]=l):l=t[4];const a=Q(l),{state:d,access:f,needsGesture:h}=a;let k;t[5]!==o||t[6]!==s?(k=new Intl.ListFormat(s,{style:"long",type:"conjunction"}).format(o.map(T)),t[5]=o,t[6]=s,t[7]=k):k=t[7];const C=k;let j;t[8]!==f||t[9]!==a.start||t[10]!==h||t[11]!==d?(j=f==="denied"?{kind:"denied"}:h?{kind:"needs-gesture",onStart:a.start}:d.problem?{kind:"problem",problem:d.problem,host:T(d.problem.endpoint)}:{kind:"looking",paused:d.status==="paused"},t[8]=f,t[9]=a.start,t[10]=h,t[11]=d,t[12]=j):j=t[12];const _=j;let S;return t[13]!==C||t[14]!==i||t[15]!==_?(S=n.jsx(B,{wait:_,hosts:C,invalidLink:i}),t[13]=C,t[14]=i,t[15]=_,t[16]=S):S=t[16],S}const v="deco-serve",w="working-tree",st={id:"",slug:"",name:"",logo:null},mt={id:v,slug:v},pt={virtualMcpId:v,taskId:null,openTask:()=>{},createTask:()=>"",createTaskWithMessage:()=>{},activeTask:null,isThreadLocked:!1,lockedHarness:null,lockedBranch:null,currentBranch:w,setCurrentTaskBranch:()=>{}};function at(){const e=window.location.hash,t=new URLSearchParams(e.replace(/^#/,"")).has("endpoint"),o=t?W(e):null;return t&&window.history.replaceState(null,"",window.location.pathname+window.location.search),o&&J(o),{candidates:U(o,z()),invalidLink:t&&!o}}const ct=[{id:"site-editor",to:"/site-editor",label:"preview"},{id:"content",to:"/site-editor/content",label:"content"}];function lt(){const e=u.c(6),t=O();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={select:dt},e[0]=o):o=e[0];const c=P(o);let m;e[1]!==t||e[2]!==c?(m=ct.map(r=>n.jsx(y.Tab,{asChild:!0,active:c==="content"==(r.id==="content"),children:n.jsxs(M,{to:r.to,activeOptions:{exact:!0},children:[n.jsx("span",{"aria-hidden":"true",className:"flex size-4 shrink-0 items-center justify-center",children:n.jsx(tt,{icon:et({tabId:r.id,kind:"system",connections:[]})})}),t(`common.mainPanelTabs.${r.label}`)]})},r.id)),e[1]=t,e[2]=c,e[3]=m):m=e[3];let i;return e[4]!==m?(i=n.jsx(y.Tabs,{children:m}),e[4]=m,e[5]=i):i=e[5],i}function dt(e){return e.matches.at(-1)?.staticData.siteEditorView}function N(e){const t=u.c(14),{children:o}=e,c=O(),{connection:m}=q(v),i=R(v,w);let r,s;if(t[0]!==i||t[1]!==o||t[2]!==m||t[3]!==c){s=Symbol.for("react.early_return_sentinel");t:{if(r=m?T(m.endpoint):"",i.kind==="protocol"){s=o;break t}if(i.kind!=="unavailable"||I(i)){s=n.jsx(Y,{headingLevel:2,waiting:!0,title:c("decoServe.connect.reaching",{host:r})});break t}}t[0]=i,t[1]=o,t[2]=m,t[3]=c,t[4]=r,t[5]=s}else r=t[4],s=t[5];if(s!==Symbol.for("react.early_return_sentinel"))return s;let p;t[6]!==i.problem?(p=i.problem??{reason:"not-answering"},t[6]=i.problem,t[7]=p):p=t[7];let l;t[8]!==r||t[9]!==p?(l={kind:"problem",problem:p,host:r},t[8]=r,t[9]=p,t[10]=l):l=t[10];let a;return t[11]!==r||t[12]!==l?(a=n.jsx(B,{wait:l,hosts:r}),t[11]=r,t[12]=l,t[13]=a):a=t[13],a}function ut(e){const t=u.c(6),{onLost:o}=e,c=R(v,w);let m;t[0]!==c?(m=I(c),t[0]=c,t[1]=m):m=t[1];const i=m;let r,s;return t[2]!==i||t[3]!==o?(r=()=>{i&&o()},s=[i,o],t[2]=i,t[3]=o,t[4]=r,t[5]=s):(r=t[4],s=t[5]),g.useEffect(r,s),null}const A={threadOpen:!1,contentOpen:!0,threadVisibilityExplicit:!1,toggleThread:()=>{},toggleContent:()=>{}};function ft(){const e=u.c(11),{data:t}=E.useSession();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={select:ht},e[0]=o):o=e[0];const c=P(o),m=!!t?.user;let i;e[1]!==m?(i={rail:m},e[1]=m,e[2]=i):i=e[2];const r=c??"preview";let s,p,l;e[3]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(lt,{}),p=n.jsx(x.Thread,{children:null}),l=n.jsx(ot,{}),e[3]=s,e[4]=p,e[5]=l):(s=e[3],p=e[4],l=e[5]);let a;e[6]!==r?(a=n.jsx(L.Content,{children:n.jsxs(x,{...A,threadless:!0,contentKey:r,contentNavigation:s,children:[p,l]})}),e[6]=r,e[7]=a):a=e[7];let d;return e[8]!==i||e[9]!==a?(d=n.jsx(L,{outsideOrg:i,children:a}),e[8]=i,e[9]=a,e[10]=d):d=e[10],d}function ht(e){return e.matches.at(-1)?.staticData.siteEditorView}function vt(e){const t=u.c(8),{children:o}=e,{data:c}=E.useSession(),m=!!c?.user;let i;t[0]!==m?(i={rail:m},t[0]=m,t[1]=i):i=t[1];let r;t[2]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx(x.Thread,{children:null}),t[2]=r):r=t[2];let s;t[3]!==o?(s=n.jsx(L.Content,{children:n.jsxs(x,{...A,threadless:!0,contentKey:"guide",children:[r,n.jsx(x.Content,{children:o})]})}),t[3]=o,t[4]=s):s=t[4];let p;return t[5]!==i||t[6]!==s?(p=n.jsx(L,{outsideOrg:i,children:s}),t[5]=i,t[6]=s,t[7]=p):p=t[7],p}const b=()=>{},xt={connection:null,set:b,clear:b};function ur(){const e=u.c(3),[t]=g.useState(at);let o;return e[0]!==t.candidates||e[1]!==t.invalidLink?(o=n.jsx(G,{value:!0,children:n.jsx(H,{org:st,project:mt,children:n.jsx(rt,{candidates:t.candidates,invalidLink:t.invalidLink,shell:jt,editor:kt})})}),e[0]=t.candidates,e[1]=t.invalidLink,e[2]=o):o=e[2],o}function kt(e,t){return n.jsxs($.Provider,{value:{connection:e,set:b,clear:b},children:[n.jsx(ut,{onLost:t}),n.jsx(V,{value:pt,children:n.jsx(K,{children:n.jsx(ft,{})})})]})}function jt(e){return n.jsx($.Provider,{value:xt,children:n.jsx(vt,{children:e})})}function fr(){const e=u.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx(N,{children:n.jsx(X,{virtualMcpId:v})}),e[0]=t):t=e[0],t}function hr(){const e=u.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx(N,{children:n.jsx(Z,{virtualMcpId:v})}),e[0]=t):t=e[0],t}export{hr as SiteEditorContent,fr as SiteEditorPreview,ur as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as P,q as z,m as L,K as h,eQ as _e,ah as Xt,aK as Zt,aL as qt,r as U,a as Kt,az as pe,a4 as en,eR as ut,eS as Ce,bh as be,eT as ue,eU as Ne,eV as Re,ax as tn,br as ft,bj as F,eW as ee,eX as we,eY as Ge,eZ as nn,t as q,j as J}from"./index-DPkNYKa5.js";import{u as dt}from"./use-session-runtime-BJW7tkkF.js";import{s as We}from"./thread-intent-DhvlejaR.js";import{u as Pe,b as on}from"./experiments-tab-choice-BJEgQx3g.js";import{b as fe}from"./sandbox-url-D3mC8qhT.js";import{s as rn}from"./utils-CcMIxuv4.js";import{a as sn}from"./repository-binding-OOS1ijlF.js";import{u as an}from"./chat-context-Bm9Y-wQH.js";import{i as cn,u as ln}from"./use-sandbox-events-BPvMQ9bx.js";import{a as un}from"./sandbox-git-api-DcqI6XE4.js";import{e as fn}from"./backoff-CrEUbyZT.js";const S={MethodNotFound:-32601,InvalidParams:-32602,InternalError:-32603,NotFound:-32001,Conflict:-32002,InvalidBlock:-32003,ReadOnly:-32005,Unsupported:-32006,LimitExceeded:-32007,Unavailable:-32008,Unauthorized:-32010};class D extends Error{code;data;constructor(t,n,o){super(n),this.name="ContentProtocolError",this.code=t,this.data=o}toJSON(){return this.data===void 0?{code:this.code,message:this.message}:{code:this.code,message:this.message,data:this.data}}static from(t){return new D(t.code,t.message,t.data)}}const Z="deco-content",Se={major:1},ht=1;async function dn(e){let t=new Uint8Array(await e.arrayBuffer());if(t[0]===31&&t[1]===139){const n=new Blob([t]).stream().pipeThrough(new DecompressionStream("gzip"));t=new Uint8Array(await new Response(n).arrayBuffer())}return JSON.parse(new TextDecoder().decode(t))}const ye={major:Se.major,minor:ht},gt=`the endpoint speaks an older ${Z} than this client needs (${ye.major}.${ye.minor} or newer): update @decocms/blocks in the site (8.2.0 or newer) and start deco serve again`;function ne(e,t,n){const o={reason:t,required:{...ye}};if(n){o.actual={protocol:n.protocol,major:n.version?.major,minor:n.version?.minor};const r=n.server;typeof r?.name=="string"&&typeof r.version=="string"&&(o.server={name:r.name,version:r.version})}return new D(S.Unsupported,e,o)}function vt(e){const t=e??{},{protocol:n,version:o}=t;if(n!==Z)throw ne(`the endpoint speaks ${JSON.stringify(n)}, not ${Z}`,"protocol",t);if(o?.major!==Se.major)throw ne(`the endpoint speaks ${Z} ${String(o?.major)}.x; this client speaks ${Se.major}.x`,"major",t);if(typeof o.minor!="number"||o.minor<ht)throw ne(gt,"outdated",t);return e}function Ye(e,t){return t.code===S.MethodNotFound&&e.startsWith("changes.")?ne(gt,"outdated"):D.from(t)}function xe(e){const t=e.fetch??(s=>fetch(s));let n=1;async function o(s){const i={"content-type":"application/json",accept:"application/json",...e.headers},a=await t(new Request(e.endpoint,{method:"POST",headers:i,body:JSON.stringify(s)}));let c;try{c=await dn(a)}catch{throw new D(S.Unavailable,`the endpoint answered HTTP ${a.status} without a JSON-RPC body`)}if(!a.ok||!Array.isArray(c)&&c?.id===null){const l=c?.error;throw l?D.from(l):new D(S.Unavailable,`the endpoint answered HTTP ${a.status}`)}return c}const r=async(s,i)=>{const a=n++,c=await o({jsonrpc:"2.0",id:a,method:s,params:i??{}});if(c.error)throw Ye(s,c.error);return c.result};return{call:r,describe:async()=>vt(await r("describe")),schemaGet:s=>r("schema.get",s),blocksList:s=>r("blocks.list",s),blocksApply:s=>r("blocks.apply",s),changesList:s=>r("changes.list",s),changesGet:s=>r("changes.get",s),changesDiscard:s=>r("changes.discard",s),async batch(s){const i=s.map(()=>n++),a=await o(s.map((l,u)=>({jsonrpc:"2.0",id:i[u],method:l.method,params:l.params??{}}))),c=new Map(a.map(l=>[l.id,l]));return i.map((l,u)=>{const f=c.get(l);return f?f.error?{ok:!1,error:Ye(s[u].method,f.error)}:{ok:!0,result:f.result}:{ok:!1,error:new D(S.InternalError,"no response for this call")}})}}}function mt(e){return e&&!e.edited?{ifNoneMatch:e.revision}:{}}const ze=20,Xe=5,Ze=500;function $e(e){return e instanceof D?e.code===S.MethodNotFound?!0:e.code===S.Unsupported&&e.data?.reason==="outdated":!1}function Ee(e,t){return t.notModified?e?{...e,base:t.base}:null:{revision:t.revision,base:t.base,changes:t.changes}}async function hn(e,t,n){const o=h.contentChanges(n),r=e.getQueryData(o),s=await t.changesList(mt(r)),i=Ee(r,s);if(i)return i;const a=await t.changesList({});return Ee(void 0,a)}async function pt(e,t){const n=[];for(let s=0;s<t.length;s+=ze)n.push(t.slice(s,s+ze));const o=Object.create(null),r=[];for(let s=0;s<n.length;s+=Xe){const i=await e.batch(n.slice(s,s+Xe).map(a=>({method:"changes.get",params:{names:a}})));for(const a of i){if(!a.ok)throw a.error;const c=a.result;Object.assign(o,c.entries),r.push(...c.diagnostics)}}return{entries:o,diagnostics:r}}async function qo(e,t){let n={revision:"",versions:{}};for(let o=0;o<t.length;o+=Ze){const r=t.slice(o,o+Ze),s=await e.changesDiscard({names:r.map(i=>i.name),ifMatch:Object.fromEntries(r.map(i=>[i.name,i.version]))});n={revision:s.revision,versions:{...n.versions,...s.versions}}}return n}function Ko(e){return e instanceof D&&e.code===S.Conflict}function je(e){return e?.kind==="protocol"?e:null}function er(e,t,n){const o=P.c(14);let r;o[0]!==n?(r={},o[0]=n,o[1]=r):r=o[1];const s=r,i=z();let a;o[2]!==e?(a=je(e),o[2]=e,o[3]=a):a=o[3];const c=a,l=!!c&&!!t&&s.enabled!==!1;let u;o[4]!==t?(u=h.contentChanges(t??""),o[4]=t,o[5]=u):u=o[5];let f;o[6]!==t||o[7]!==l||o[8]!==c||o[9]!==i?(f=l?()=>hn(i,c.client,t):_e,o[6]=t,o[7]=l,o[8]=c,o[9]=i,o[10]=f):f=o[10];let g;return o[11]!==u||o[12]!==f?(g={queryKey:u,queryFn:f,staleTime:0},o[11]=u,o[12]=f,o[13]=g):g=o[13],L(g)}function tr(e,t,n){const o=P.c(14);let r;o[0]!==e?(r=je(e),o[0]=e,o[1]=r):r=o[1];const s=r;let i;o[2]!==n?(i=n?Object.keys(n.changes):[],o[2]=n,o[3]=i):i=o[3];const a=i,c=!!s&&!!t&&!!n&&a.length>0;let l;o[4]!==t||o[5]!==n?.revision?(l=h.contentChangeSides(t??"",n?.revision??""),o[4]=t,o[5]=n?.revision,o[6]=l):l=o[6];let u;o[7]!==c||o[8]!==a||o[9]!==s?(u=c?()=>pt(s.client,a):_e,o[7]=c,o[8]=a,o[9]=s,o[10]=u):u=o[10];let f;return o[11]!==l||o[12]!==u?(f={queryKey:l,queryFn:u,staleTime:Number.POSITIVE_INFINITY},o[11]=l,o[12]=u,o[13]=f):f=o[13],L(f)}function nr(e,t,n){const o=P.c(16);let r;o[0]!==e?(r=je(e),o[0]=e,o[1]=r):r=o[1];const s=r;let i,a,c,l;if(o[2]!==t||o[3]!==n?.changes||o[4]!==s){const g=Object.entries(n?.changes??{}).filter(bn).map(pn).sort(mn);a=g.map(vn);const d=JSON.stringify(g.map(gn));i=!!s&&!!t&&a.length>0,l=L,c=h.contentDeletedCopies(t??"",d),o[2]=t,o[3]=n?.changes,o[4]=s,o[5]=i,o[6]=a,o[7]=c,o[8]=l}else i=o[5],a=o[6],c=o[7],l=o[8];let u;o[9]!==i||o[10]!==a||o[11]!==s?(u=i?async()=>{const g=await pt(s.client,a),d=Object.create(null);for(const[v,b]of Object.entries(g.entries))d[v]=b.before&&typeof b.before=="object"?b.before:null;return d}:_e,o[9]=i,o[10]=a,o[11]=s,o[12]=u):u=o[12];let f;return o[13]!==c||o[14]!==u?(f={queryKey:c,queryFn:u,staleTime:Number.POSITIVE_INFINITY,placeholderData:Xt},o[13]=c,o[14]=u,o[15]=f):f=o[15],l(f)}function gn(e){return[e.name,e.base]}function vn(e){return e.name}function mn(e,t){return e.name<t.name?-1:e.name>t.name?1:0}function pn(e){const[t,n]=e;return{name:t,base:n.baseVersion??""}}function bn(e){const[,t]=e;return t.kind==="delete"}function bt(e){try{const t=new URL(e);if(t.protocol!=="http:"&&t.protocol!=="https:")return!1;const n=t.hostname.toLowerCase();return n==="127.0.0.1"||n==="[::1]"||n==="localhost"}catch{return!1}}function ie(e){try{const t=new URL(e);return(t.hostname==="127.0.0.1"||t.hostname==="[::1]")&&(t.hostname="localhost"),t.href}catch{return e}}const wt=Zt({endpoint:qt().max(2048).refine(e=>bt(e)&&new URL(e).pathname==="/rpc").transform(ie)});function or(e){const t=new URLSearchParams(e.replace(/^#/,"")),n=wt.safeParse({endpoint:t.get("endpoint")??""});return n.success?n.data:null}function St(e){const t=wt.safeParse(e);return t.success?t.data:null}const yt="studio:deco-serve-last";function rr(e){try{localStorage.setItem(yt,JSON.stringify(e))}catch{}}function sr(){try{const e=localStorage.getItem(yt);return e?St(JSON.parse(e)):null}catch{return null}}function ir(e){try{return new URL(ie(e)).host}catch{return e}}function wn(e,t=1e4){return Math.min(1e3*2**Math.max(0,e-1),t)}const Sn="http://localhost:4545/rpc",ar="npx @decocms/blocks serve",cr="npx @decocms/blocks schema";class Ae extends Error{constructor(t="the endpoint isn't deco serve"){super(t),this.name="NotDecoServeError"}}function yn(e){if(e instanceof Ae)return{reason:"not-deco-serve"};if(!(e instanceof D))return{reason:"not-answering"};switch(e.code){case S.Unauthorized:case S.MethodNotFound:return{reason:"outdated"};case S.Unsupported:return $e(e)?{reason:"outdated"}:{reason:"version-mismatch"};case S.Unavailable:return/^the endpoint answered HTTP/.test(e.message)?{reason:"not-deco-serve"}:{reason:"error",detail:e.message};default:return{reason:"error",detail:e.message}}}function lr(e,t){if(e)return[ie(e.endpoint)];const n=[t?.endpoint,Sn].filter(o=>!!o).map(ie);return[...new Set(n)]}const Et=U.createContext(null);function En(e){const t=P.c(27),n=U.useContext(Et),o=Pe(n?null:e),{data:r}=Kt.useSession(),s=r?.user?.id??"",i=!!e&&!!s;let a;t[0]!==i||t[1]!==s||t[2]!==e?(a=i?pe.decoServeConnection(s,e):null,t[0]=i,t[1]=s,t[2]=e,t[3]=a):a=t[3];const[c,l]=Ke(a);let u;t[4]!==i||t[5]!==s||t[6]!==e?(u=i?pe.decoServeEndpoint(s,e):null,t[4]=i,t[5]=s,t[6]=e,t[7]=u):u=t[7];const[f,g]=Ke(u);if(n)return n;let d;t[8]!==c||t[9]!==i?(d=i?St(c):null,t[8]=c,t[9]=i,t[10]=d):d=t[10];const v=d,b=!!v;let w;t[11]!==o||t[12]!==b?(w=kn(o,b),t[11]=o,t[12]=b,t[13]=w):w=t[13];const{applies:I,undecided:T}=w,x=I?v:null,C=i&&o==="v8"&&typeof f=="string"?f:null;let _;t[14]!==g||t[15]!==l||t[16]!==i?(_=N=>{i&&(l(N),g(N.endpoint))},t[14]=g,t[15]=l,t[16]=i,t[17]=_):_=t[17];let E;t[18]!==l||t[19]!==i?(E=()=>{i&&l(null)},t[18]=l,t[19]=i,t[20]=E):E=t[20];let k;return t[21]!==x||t[22]!==C||t[23]!==_||t[24]!==E||t[25]!==T?(k={connection:x,undecided:T,lastEndpoint:C,set:_,clear:E},t[21]=x,t[22]=C,t[23]=_,t[24]=E,t[25]=T,t[26]=k):k=t[26],k}function kn(e,t){return t?e==="loading"?{applies:!1,undecided:!0}:{applies:e==="v8"||e==="error",undecided:!1}:{applies:!1,undecided:!1}}function qe(e){try{const t=localStorage.getItem(e);return t===null?null:JSON.parse(t)}catch{return null}}function Ke(e){const t=P.c(17),n=z(),o=e??"";let r;t[0]!==o?(r=["localStorage",o],t[0]=o,t[1]=r):r=t[1];const s=r;let i,a;t[2]!==e?(i=()=>e?qe(e):null,a=()=>e?qe(e):null,t[2]=e,t[3]=i,t[4]=a):(i=t[3],a=t[4]);const c=!!e;let l;t[5]!==s||t[6]!==i||t[7]!==a||t[8]!==c?(l={queryKey:s,queryFn:i,initialData:a,enabled:c,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[5]=s,t[6]=i,t[7]=a,t[8]=c,t[9]=l):l=t[9];const{data:u}=L(l);let f;t[10]!==e||t[11]!==n||t[12]!==s?(f=b=>{if(e){try{b===null?localStorage.removeItem(e):localStorage.setItem(e,JSON.stringify(b))}catch{}n.setQueryData(s,b)}},t[10]=e,t[11]=n,t[12]=s,t[13]=f):f=t[13];const g=f,d=e?u??null:null;let v;return t[14]!==g||t[15]!==d?(v=[d,g],t[14]=g,t[15]=d,t[16]=v):v=t[16],v}function ur(e){return e.kind==="protocol"||e.kind==="unavailable"}function fr(e){const t=e.hasOrg?e.orgFlag:!1,{backend:n}=e;return n==="protocol"||n==="unavailable"?!0:n==="pending"?t===!0?!0:void 0:t}function dr(e,t,n){return t!=="github"||n!=="v8"?!1:e.kind==="pending"?!0:e.kind==="unavailable"&&e.siteNotOwned?!1:(e.kind==="protocol"||e.kind==="unavailable")&&e.source==="github"}function hr(e){if(e.kind!=="protocol"||e.source!=="local")return null;const t=e.describe.preview?.url;return t&&bt(t)?t:null}function gr(e,t){return e.kind!=="protocol"||e.source!=="local"||!e.describe.assets||!t?null:new URL(t.endpoint).origin}function kt(e){return e.hasServeConnection?"local":e.runtime==="sandbox"?"sandbox":"github"}function On(e){if(!e.hasProject)return"legacy";const t=kt(e);if(t==="local")return"protocol-local";if(e.serveConnectionUndecided)return"pending";if(t==="sandbox"){const o=e.sandboxSite;return o==="v8"?"protocol-sandbox":o==="v7"?"legacy":o==="error"?e.markedV8?"retrying-sandbox":"legacy":"pending"}if(e.mainSchema==="loading")return"pending";if(e.mainSchema==="error")return"retrying-github";if(e.mainSchema==="v7")return"legacy";const n=e.githubSite;return n==="v8"?"protocol-github":n==="not-owned"?"site-not-owned-github":n==="error"?"unavailable-github":n==="v7"?"legacy":"pending"}function Dn(e){return{github:e.mode==="github"&&e.mainSchema==="v8",sandbox:e.mode==="sandbox"&&e.workingTreeReady}}function et(e){return e.isError||e.errorUpdateCount>0}function Tn(e,t,n){if(!t||n.size===0)return e;const o={...e};for(const r of n)Object.hasOwn(t,r)?o[r]=t[r]:delete o[r];return o}function In(e){if(!e||typeof e!="object")return[];const t=e,n=[];return typeof t.blockKey=="string"&&n.push(t.blockKey),t.writes&&typeof t.writes=="object"&&n.push(...Object.keys(t.writes)),Array.isArray(t.deletes)&&n.push(...t.deletes.filter(o=>typeof o=="string")),n}const Ot="__noSchema";function _n(){return{manifest:{blocks:{}},schema:{definitions:{},root:{}},[Ot]:!0}}function vr(e){return!!e&&e[Ot]===!0}function Dt(e){if(!e.ok)return e.error.code===S.NotFound;const t=e.result;return t.notModified===!1&&t.schema===null}function Cn(e,t){return(typeof t.name=="string"?t.name.trim():"")||e}const Nn=(e,t)=>e.label.localeCompare(t.label)||e.key.localeCompare(t.key);function mr(e){const t=new Map;for(const[n,o]of Object.entries(e)){const r=o&&typeof o=="object"&&!Array.isArray(o)?o:{},s=typeof r.__resolveType=="string"?r.__resolveType:null,i=t.get(s)??[];i.push({key:n,label:Cn(n,r)}),t.set(s,i)}return[...t.entries()].map(([n,o])=>({resolveType:n,blocks:o.sort(Nn)})).sort((n,o)=>n.resolveType===null?1:o.resolveType===null?-1:tt(n.resolveType).localeCompare(tt(o.resolveType))||n.resolveType.localeCompare(o.resolveType))}function tt(e){return(e.split("/").filter(Boolean).at(-1)??e).replace(/\.(tsx?|jsx?)$/,"")||e}function nt(e,t,n){if(t.length===0)return n;const[o,...r]=t;if(Array.isArray(e)&&typeof o=="number"){const s=e.slice();return s[o]=nt(e[o],r,n),s}if(e&&typeof e=="object"&&typeof o=="string"){const s=e,i={};for(const a of Object.keys(s))i[a]=a===o?nt(s[a],r,n):s[a];return i}return e}function pr(e){if(e.trim()==="")return null;const t=Number(e);return Number.isFinite(t)?t:null}class ot extends Error{}class rt extends Error{}const Tt="site-not-owned";async function Rn(e){return e.status!==409?!1:(await e.clone().json().catch(()=>null))?.code==="site_not_owned"}async function Pn(e,t=r=>fetch(r),n,o){const r=xe({endpoint:e,fetch:async s=>{const i=new Request(s);for(const[c,l]of Object.entries(ue("v8")))i.headers.set(c,l);const a=await t(i);if(await Rn(a))throw new rt;if(await Ne(a))throw n?.(),new Re;return a}});try{const s=await Ue(r,be(o)?{schema:o}:void 0);return s.v8Schema?s:null}catch(s){if(s instanceof rt)return Tt;throw s}}const Le=5e3;function xn(e){return new URL(`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}/rpc`,window.location.origin).href}function $n(e){return new URL(fe(e,"rpc"),window.location.origin).href}async function Ue(e,t){const[n,o]=await e.batch(t?[{method:"describe"}]:[{method:"describe"},{method:"schema.get"}]);if(!n?.ok)throw n?.error??new Error("no describe");if(n.result?.protocol!==Z)throw new Ae;const s=vt(n.result);if(t)return{client:e,describe:s,hasSchema:t.schema!=null,v8Schema:be(t.schema)};if(!o)throw new Error("no schema.get");if(Dt(o))return{client:e,describe:s,hasSchema:!1,v8Schema:!1};if(o.ok){const i=o.result;return{client:e,describe:s,hasSchema:!0,v8Schema:be(i?.schema)}}throw o.error}async function jn(e,t=n=>fetch(n)){const n=xe({endpoint:e,fetch:async o=>{const r=await t(o);if(r.status===404)throw new ot;return r}});try{const o=await Ue(n);return o.v8Schema?o:null}catch(o){if(o instanceof ot)return null;throw o}}function It(e,t){const n=P.c(53),{org:o}=en(),{connection:r,undecided:s}=En(e),{runtime:i}=dt(e),a=U.useContext(Et),c=Pe(a?null:e),l=on(e),u=kt({hasServeConnection:!!r,runtime:i}),f=an()?.taskId??null,g=cn(ln().lifecycle.phase),d=z(),v=Dn({mode:u,mainSchema:c,workingTreeReady:g}),b=v.github&&!!o.slug&&!!e&&!!t;let w;n[0]!==t||n[1]!==o.slug||n[2]!==d||n[3]!==e?(w=()=>Pn(xn({orgSlug:o.slug,virtualMcpId:e,branch:t}),void 0,()=>Ce(d,o.slug,e),ut(d,o.slug,e)?.schema),n[0]=t,n[1]=o.slug,n[2]=d,n[3]=e,n[4]=w):w=n[4];const I=L({queryKey:h.contentBackend(o.slug,e??"",t??"","github"),queryFn:w,enabled:b,staleTime:Number.POSITIVE_INFINITY,...st}),T=v.sandbox&&!!o.slug&&!!e&&!!t;let x;n[5]!==t||n[6]!==o.slug||n[7]!==f||n[8]!==e?(x=async()=>jn($n({orgSlug:o.slug,virtualMcpId:e,branch:t,threadId:f})),n[5]=t,n[6]=o.slug,n[7]=f,n[8]=e,n[9]=x):x=n[9];const C=L({queryKey:h.contentBackend(o.slug,e??"",t??"","sandbox",f??""),queryFn:x,enabled:T,staleTime:Number.POSITIVE_INFINITY,...st}),_=!!r;let E;n[10]!==r?.endpoint||n[11]!==o.slug||n[12]!==e?(E=h.contentBackend(o.slug,e??"","local",r?.endpoint??""),n[10]=r?.endpoint,n[11]=o.slug,n[12]=e,n[13]=E):E=n[13];let k;n[14]!==r?(k=()=>Ue(xe({endpoint:r.endpoint})),n[14]=r,n[15]=k):k=n[15];let N;n[16]!==_||n[17]!==E||n[18]!==k?(N={queryKey:E,queryFn:k,enabled:_,staleTime:Number.POSITIVE_INFINITY,retry:Un,retryDelay:Ln,refetchInterval:An},n[16]=_,n[17]=E,n[18]=k,n[19]=N):N=n[19];const p=L(N);let O;n[20]!==r?.endpoint||n[21]!==o.slug||n[22]!==e?(O=h.contentBackend(o.slug,e??"","local",r?.endpoint??""),n[20]=r?.endpoint,n[21]=o.slug,n[22]=e,n[23]=O):O=n[23];const $=O;let y;n[24]!==r?.endpoint||n[25]!==o.slug||n[26]!==e?(y=h.contentBackend(o.slug,e??"","local-describe",r?.endpoint??""),n[24]=r?.endpoint,n[25]=o.slug,n[26]=e,n[27]=y):y=n[27];let R;n[28]!==p.data||n[29]!==$||n[30]!==d?(R=async()=>{try{return await p.data.client.describe()}catch(m){const Y=m;throw d.invalidateQueries({queryKey:$,exact:!0},{cancelRefetch:!1}),Y}},n[28]=p.data,n[29]=$,n[30]=d,n[31]=R):R=n[31];const j=!!p.data&&!a;let M;n[32]!==y||n[33]!==R||n[34]!==j?(M={queryKey:y,queryFn:R,enabled:j,refetchInterval:Le,retry:!1},n[32]=y,n[33]=R,n[34]=j,n[35]=M):M=n[35];const B=L(M).data??p.data?.describe,A=On({hasProject:!!e,hasServeConnection:!!r,serveConnectionUndecided:s,runtime:i,mainSchema:c,githubSite:I.data===Tt?"not-owned":I.data?"v8":I.data===null?"v7":et(I)?"error":"loading",sandboxSite:Mn({data:C.data,isError:et(C),workingTreeReady:g}),markedV8:l});if(A==="pending"){let m;return n[36]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"pending"},n[36]=m):m=n[36],m}if(A==="retrying-github"){let m;return n[37]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"pending",retrying:"github"},n[37]=m):m=n[37],m}if(A==="retrying-sandbox"){let m;return n[38]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"pending",retrying:"sandbox"},n[38]=m):m=n[38],m}if(A==="legacy"){let m;return n[39]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"legacy"},n[39]=m):m=n[39],m}if(A==="protocol-github"){const m=I.data;let Y;return n[40]!==m?(Y=ke("github",m,""),n[40]=m,n[41]=Y):Y=n[41],Y}if(A==="site-not-owned-github"){let m;return n[42]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"unavailable",source:"github",siteNotOwned:!0},n[42]=m):m=n[42],m}if(A==="protocol-sandbox"){let m;return n[43]!==C.data?(m=ke("sandbox",C.data,":sandbox"),n[43]=C.data,n[44]=m):m=n[44],m}if(A==="unavailable-github"){let m;return n[45]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"unavailable",source:"github"},n[45]=m):m=n[45],m}const W=p.error??p.failureReason,ve=r?.endpoint??"";let te;return n[46]!==B||n[47]!==p.data||n[48]!==p.failureCount||n[49]!==p.isError||n[50]!==W||n[51]!==ve?(te=Qn({probed:p.data,isError:p.isError,failureCount:p.failureCount,failure:W,describe:B,endpoint:ve}),n[46]=B,n[47]=p.data,n[48]=p.failureCount,n[49]=p.isError,n[50]=W,n[51]=ve,n[52]=te):te=n[52],te}function An(e){return e.state.status==="error"||e.state.data?.v8Schema===!1?Le:!1}function Ln(e){return wn(e+1)}function Un(e,t){return!(t instanceof D)&&!(t instanceof Ae)}function Mn(e){return e.data!==void 0?e.data?"v8":"v7":e.workingTreeReady?e.isError?"error":"loading":"unavailable"}const Fn=3;function Qn(e){if(e.probed?.hasSchema&&!e.probed.v8Schema)return{kind:"unavailable",source:"local",problem:{reason:"not-v8"}};const t=e.probed?ke("local",{...e.probed,describe:e.describe??e.probed.describe},`:serve:${e.endpoint}`):null;return e.isError||e.failureCount>0?t?.kind==="protocol"&&!e.isError&&e.failureCount<Fn?t:{kind:"unavailable",source:"local",problem:yn(e.failure)}:t??{kind:"pending"}}const st={retry:2,refetchInterval:e=>e.state.status==="error"?Le:!1};function ke(e,t,n){return{kind:"protocol",source:e,client:t.client,describe:t.describe,cacheKeySuffix:n,hasSchema:t.hasSchema}}function _t(e){const t=P.c(13);let n;t[0]!==e?(n=pe.localPreviewUrl(e??""),t[0]=e,t[1]=n):n=t[1];const o=n,[r,s]=tn(o,null),i=Pe(e);let a;if(t[2]!==i||t[3]!==r||t[4]!==e){const g=e?We(r):null;a=Vn({saved:g,main:i}),t[2]=i,t[3]=r,t[4]=e,t[5]=a}else a=t[5];const c=a;let l,u;t[6]!==s?(l=g=>s(We(g)),u=()=>s(null),t[6]=s,t[7]=l,t[8]=u):(l=t[7],u=t[8]);let f;return t[9]!==c||t[10]!==l||t[11]!==u?(f={...c,setUrl:l,clear:u},t[9]=c,t[10]=l,t[11]=u,t[12]=f):f=t[12],f}function Vn(e){return e.saved?e.main==="v7"?{url:e.saved,undecided:!1}:e.main==="v8"?{url:null,undecided:!1}:{url:null,undecided:!0}:{url:null,undecided:!1}}function Bn(e,t){const n=(e??"").trim().replace(/^[/\\]+|[/\\]+$/g,"");return n?`${n}/${t}`:t}function it(e){let t;try{t=JSON.parse(e)}catch{return null}return typeof t!="object"||t===null||Array.isArray(t)?null:t}class Me extends Error{constructor(t,n,o=[],r=!1){super(n),this.blocks=t,this.fields=o,this.carriedStored=r,this.name="BlockConflictError"}blocks;fields;carriedStored}function Fe(e){return`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`}function de(e,t,n){return["decofile-write",e,t,n]}function Hn(e,t,n){return{id:de(e,t,n).join(":")}}function Qe(e){return`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}`}async function Jn(e,t){const n=await e.json().catch(()=>({}));throw new Error(n.error??`${t} failed (${e.status})`)}function Gn(e,t,n){e.setQueryData(h.decofileDraft(Fe(t)),n)}function Wn(e,t){return e.getQueryData(h.decofileDraft(Fe(t)))??null}async function Yn(e,t){const n=await fetch(Qe(e),{cache:"no-store",headers:{...ue("v7"),"if-none-match":`"${t}"`}}).catch(()=>null);return n?.status===200||n?.status===409}function br(e){const t=P.c(4);let n;t[0]!==e?(n=h.decofileDraft(e?Fe(e):""),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:zn,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:r}=L(o);return r??null}async function zn(){throw new Error("decofileDraft is populated by reads/writes, not fetched")}async function Xn(e,t){const n=await fetch(Qe(t),{cache:"no-store",headers:ue("v7")});if(await Ne(n))throw Ce(e,t.orgSlug,t.virtualMcpId),new Re;if(!n.ok){const r=new Error(`Failed to fetch decofile: ${n.status}`);throw r.status=n.status,r}const o=await n.json();return o.token&&Gn(e,t,{version:o.version,token:o.token,apiHost:o.apiHost??window.location.host}),o.decofile}async function wr(e,t){const n=await fetch(Qe(e),{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(n.status===409){const r=await n.json().catch(()=>({}));throw r.code==="block-conflict"?new Me(r.blocks??[],r.error??"Block changed"):new Error(r.error??`Save failed (${n.status})`)}if(!n.ok)return Jn(n,"Save");const o=await n.json();return{...o,apiHost:o.apiHost??window.location.host}}const Ct=3e3,Zn=15e3,qn=2*6e4,Nt={now:()=>Date.now(),setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),hidden:()=>typeof document<"u"&&document.visibilityState==="hidden"};function Kn(e){return e<qn?Ct:Zn}function eo(e,t=Nt){const n=t.now();let o=!1,r=!1,s=null;const i=()=>{o||(s=t.setTimeout(a,Kn(t.now()-n)))},a=()=>{if(s=null,o)return;const{read:c,skip:l}=e();if(r||t.hidden()||l?.()){i();return}r=!0;let u;try{u=c()}catch{u=void 0}Promise.resolve(u).catch(()=>{}).finally(()=>{r=!1}),i()};return i(),()=>{o=!0,s!==null&&t.clearTimeout(s)}}const at=()=>0;function to(e,t,n=Nt){const o=U.useRef(t);o.current=t;const[r]=U.useState(()=>({polling:()=>eo(()=>o.current,n),idle:()=>()=>{}}));U.useSyncExternalStore(e?r.polling:r.idle,at,at)}function Rt(e,t){return fe(e,t)}function no(e,t){return fe(e,"preview-fetch",{path:t})}function Sr(e){return Rt(e,"preview-invoke")}function yr(e){return Rt(e,"catalog-invoke")}function Pt(e){try{const{hostname:t}=new URL(e);return t==="localhost"||t.endsWith(".localhost")||t==="127.0.0.1"||t==="::1"}catch{return!1}}function oo(){if(typeof document>"u")return null;const e=Array.from(document.querySelectorAll("iframe"));for(const t of e){const n=t.getAttribute("src");if(n&&Pt(n))return n}return null}function ro(e,t){const n=e.previewUrl??e.getFallbackPreviewUrl?.()??oo();return n&&Pt(n)?new URL(t,n).toString():no(e,t)}function so(e){return ro(e,"/.decofile")}function io(e){return e===400?"absent":e===404?"unavailable":e>=200&&e<300?"ok":"error"}function ct(e){return e.liveOk||e.committedAbsent?404:e.liveStatus??502}async function ao(e,t){const n=fe(e,"read"),o=await fetch(n,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:t,full:!0})}),r=io(o.status);if(r==="absent")return{kind:"absent"};if(r==="unavailable")return{kind:"unavailable"};if(r==="error"){const i=new Error(`Failed to read ${t}: ${o.status}`);throw i.status=o.status,i}const s=await o.json();return typeof s.content!="string"?{kind:"unavailable"}:{kind:"data",data:rn(s.content)}}async function co(e,t){const n=await ao(e,t);if(n.kind!=="data")return n;try{return{kind:"data",data:JSON.parse(n.data)}}catch{return{kind:"unavailable"}}}async function Er(e){const t=`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}/meta`,n=await fetch(t,{cache:"no-store"});if(n.status===404)return{kind:"absent"};if(!n.ok){const o=new Error(`Failed to read committed meta: ${n.status}`);throw o.status=n.status,o}try{return{kind:"data",data:await n.json()}}catch{return{kind:"unavailable"}}}function lo(e){return sn(e)?.metadata?.runtime?.path??null}class xt extends Error{constructor(t){super(t instanceof Error?t.message:String(t),{cause:t}),this.name="ServeLostError"}}function kr(e){return e instanceof D&&e.code===S.Conflict}function $t(e){const t=e.data?.violations;return!Array.isArray(t)||t.length===0?e.message:t.slice(0,3).map(n=>n.message).join("; ")}class Ve extends Error{constructor(){super("The draft's changes couldn't be read"),this.name="HostedDraftUnreadError"}}class Be extends Error{constructor(){super("The blocks kept changing while the change was saved"),this.name="HostedKeptChangingError"}}function Or(e,t){return(t instanceof Ve||t instanceof Be)&&(t.message=jt(e,t,"github")),t}function jt(e,t,n){if(t instanceof Ve)return e("siteEditor.save.draftUnread");if(t instanceof Be)return e("siteEditor.save.keptChanging");if(t instanceof Me)return t.message;if(n==="local")return fo(e,t);if(t instanceof D)switch(t.code){case S.Conflict:return e("siteEditor.save.conflict");case S.ReadOnly:return e("siteEditor.save.readOnly");case S.InvalidBlock:case S.InvalidParams:return e("siteEditor.save.invalid");case S.LimitExceeded:return e("siteEditor.save.tooLarge")}return e("siteEditor.save.failed")}function uo(e,t){if(t==="local"||e instanceof Me||e instanceof Ve||e instanceof Be)return null;if(e instanceof D){const n=e.code===S.InvalidBlock||e.code===S.InvalidParams?$t(e):e.message;return n?`${e.code}: ${n}`:null}return e.message||null}function fo(e,t){if(t instanceof xt)return e("decoServe.save.serverGone");if(t instanceof D)switch(t.code){case S.Conflict:return e("decoServe.save.conflict");case S.ReadOnly:return e("decoServe.save.readOnly");case S.InvalidBlock:case S.InvalidParams:return e("decoServe.save.invalid",{detail:$t(t)});case S.LimitExceeded:return e("decoServe.save.tooLarge")}return e("sectionsEditor.sectionsEditor.saveFailed",{error:t.message})}function ho(e,t,n){return e===null?0:Math.max(0,n-Math.max(0,t-e))}function go(e,t){const[n,o]=U.useState(e),r=U.useRef(null);return e&&!n&&o(!0),U.useEffect(()=>{if(e){r.current??=Date.now();return}if(!n)return;const s=()=>{r.current=null,o(!1)},i=ho(r.current,Date.now(),t);if(i===0){s();return}const a=setTimeout(s,i);return()=>clearTimeout(a)},[e,n,t]),n}const vo="decocms:content-writes",Oe=new Set;let H;function At(){if(H!==void 0)return H;H=null;try{typeof BroadcastChannel=="function"&&(H=new BroadcastChannel(vo),H.addEventListener("message",e=>{const t=e.data?.cacheKey;if(typeof t=="string")for(const n of[...Oe])n(t)}))}catch{H=null}return H}function mo(e){try{At()?.postMessage({cacheKey:e})}catch{}}function po(e){return At(),Oe.add(e),()=>{Oe.delete(e)}}const Lt={phase:"idle",inFlight:0,reload:{seq:0,navigates:!1},epoch:0},bo=15e3,ae=new Map;function G(e,t){return`${e}/${t}`}function Q(e){let t=ae.get(e);return t||(t={state:Lt,listeners:new Set,previews:0,timer:null,discardListeners:new Set},ae.set(e,t)),t}function V(e,t){const n=Q(e);n.state={...n.state,...t};for(const o of n.listeners)o()}function he(e){e.timer&&clearTimeout(e.timer),e.timer=null}function He(e){return ae.get(e)?.state??Lt}function wo(e,t){const n=Q(e);return n.listeners.add(t),()=>{n.listeners.delete(t)}}function Dr(e){const t=Q(e);return t.previews++,()=>{t.previews--,t.previews===0&&t.state.phase==="reloading"&&(he(t),V(e,{phase:"idle"}))}}function Tr(e){const t=ae.get(e);!t||t.state.phase!=="reloading"||(he(t),V(e,{phase:"idle"}))}function Ut(e){const t=Q(e);he(t),V(e,{phase:"saving",inFlight:t.state.inFlight+1})}function oe(e,t){const n=Q(e),o=Math.max(0,n.state.inFlight-1);if(o>0){V(e,{inFlight:o});return}if(!t.ok||n.previews===0){V(e,{phase:"idle",inFlight:o});return}Mt(e,t.navigates,o)}function Mt(e,t,n=0){const o=Q(e);he(o),o.timer=setTimeout(()=>{o.timer=null,o.state.phase==="reloading"&&V(e,{phase:"idle"})},bo),V(e,{phase:"reloading",inFlight:n,reload:{seq:o.state.reload.seq+1,navigates:t}})}function So(e){return e?.kind==="protocol"&&e.source==="github"}async function re(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:r,branch:s,backend:i,cacheKey:a}=e,c=t.kind==="publish"||t.kind==="reapply"?n.invalidateQueries({queryKey:h.hostedReleases(o,r)}):null;if(i?.kind!=="protocol")return await c,{navigates:!1};const l=s?h.protocolDraftRead(o,r,s):null,u=l?JSON.stringify(n.getQueryData(l)??null):null,f=c?[c]:[];if(a&&t.reread&&f.push(n.invalidateQueries({queryKey:h.decofile(a)})),a&&!t.adopted&&f.push(n.invalidateQueries({queryKey:h.contentChanges(a)})),s&&i.source==="sandbox"&&f.push(n.invalidateQueries({queryKey:un(o,r,s)})),So(i)&&l&&!t.adopted&&f.push(n.invalidateQueries({queryKey:l})),await Promise.all(f),t.kind!=="edit"){const v=G(o,r);V(v,{epoch:He(v).epoch+1})}const g=l?JSON.stringify(n.getQueryData(l)??null):null,d=u!==g;return d&&await new Promise(v=>ft.schedule(v)),{navigates:d}}async function yo(e,t){return Ut(G(e.orgSlug,e.virtualMcpId)),Ft(e,t)}function lt(e){return e.branch?JSON.stringify(e.queryClient.getQueryData(h.protocolDraftRead(e.orgSlug,e.virtualMcpId,e.branch))??null):null}async function Ft(e,t){const n=G(e.orgSlug,e.virtualMcpId),o=t.adopted?lt(e):null;let r;try{r=await t.write()}catch(i){throw oe(n,{ok:!1,navigates:!1}),t.refreshOnError&&re(e,{kind:t.kind,reread:!0}).catch(()=>{}),i}if(e.backend?.kind==="protocol"&&e.cacheKey&&mo(e.cacheKey),t.adopted){const i=lt(e)!==o;return i&&await new Promise(a=>ft.schedule(a)),oe(n,{ok:!0,navigates:i}),t.reread&&re(e,t).catch(()=>{}),r}let s=!1;try{({navigates:s}=await re(e,t))}catch{}finally{oe(n,{ok:!0,navigates:s})}return r}function Ir(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:r,branch:s}=e,i=G(o,r),a=new Set(t.blockKeys);for(const u of[...Q(i).discardListeners])u(a);Ut(i);let c=!1;const l=()=>(c=!0,Ft(e,{kind:"discard",reread:!0,write:t.write}));return s?n.getMutationCache().build(n,{mutationKey:de(o,r,s),scope:Hn(o,r,s),mutationFn:l}).execute(void 0).catch(u=>{throw c||oe(i,{ok:!1,navigates:!1}),u}):l()}function _r(e,t,n){const o=P.c(8);let r;o[0]!==e||o[1]!==t?(r=G(e,t),o[0]=e,o[1]=t,o[2]=r):r=o[2];const s=r;let i;o[3]!==n||o[4]!==s?(i=()=>{const c=Q(s).discardListeners;return c.add(n),()=>{c.delete(n)}},o[3]=n,o[4]=s,o[5]=i):i=o[5];let a;o[6]!==s?(a=[s],o[6]=s,o[7]=a):a=o[7],U.useEffect(i,a)}function Eo(e){const t=G(e.orgSlug,e.virtualMcpId);He(t).inFlight>0||re(e,{kind:"external"}).then(({navigates:n})=>{const o=Q(t);o.previews>0&&o.state.inFlight===0&&Mt(t,n)}).catch(()=>{})}function ko(e,t){const n=P.c(7);let o;n[0]!==e||n[1]!==t?(o=G(e,t),n[0]=e,n[1]=t,n[2]=o):o=n[2];const r=o;let s;n[3]!==r?(s=l=>wo(r,l),n[3]=r,n[4]=s):s=n[4];const i=s;let a;n[5]!==r?(a=()=>He(r),n[5]=r,n[6]=a):a=n[6];const c=a;return U.useSyncExternalStore(i,c,c)}const Oo=500;function Cr(e,t){const{phase:n}=ko(e,t);return go(n!=="idle",Oo)}function Do(e){const t=new Error(`${e} unavailable (content server unreachable)`);return t.status=502,t}function To(e,t){return h.liveMeta(e.orgSlug,e.virtualMcpId,e.branch,`protocol${t.cacheKeySuffix}`,"")}function Nr(e,t,n,o){if(o?.source==="github")return Io(e,t,n);const r=e.getQueryData(h.contentVersions(t));if(!r)return;if(Object.hasOwn(r,n))return r[n];const s=e.getQueryData(h.decofile(t));return s&&Object.hasOwn(s,n)?void 0:null}function K(e,t){if(Object.hasOwn(e.changes,t))return e.changes[t];const n=F(t),o=Object.keys(e.changes).find(r=>F(r)===n);return o===void 0?void 0:e.changes[o]}function Io(e,t,n){const o=e.getQueryData(h.contentChanges(t));if(o)return Qt(o,ge(e,t),n)}function Qt(e,t,n){const o=K(e,n);return o?.kind==="delete"?o.version??we:o?o.version:t.has(F(n))?we:null}function Rr(e,t,n){const o=e.getQueryData(h.contentChanges(t));if(!o)return!1;const r=K(o,n);return r?r.kind==="set"&&r.baseVersion===null:ge(e,t).has(F(n))}function Pr(e,t){const n=e.getQueryData(h.decofile(t)),o=e.getQueryData(h.contentChanges(t));if(!n||!o)return null;const r=ge(e,t);return{blocks:n,versionOf:s=>Qt(o,r,s)}}function ge(e,t){return new Set(e.getQueryData(h.contentDraftTombstones(t)))}function ce(e,t,n,o){const r=F(n),s=ge(e,t);s.has(r)!==o&&(o?s.add(r):s.delete(r),ee(e),e.setQueryData(h.contentDraftTombstones(t),[...s]))}function _o(e,t,n,o){const r=Ge(o.revision),s=e.getQueryData(h.contentRevision(n))?.revision,i=s?Ge(s):null,a=r&&!r.main&&i?nn(i.main,r.draft):o.revision,c=e.getQueryData(h.contentVersions(n)),l=Object.entries(o.versions??{}).map(([d,v])=>[d,v===we?null:v]),u=e.getQueryData(h.contentChanges(n)),f=new Set(l.flatMap(([d])=>{const v=u?K(u,d):void 0;return(v?v.baseVersion:c?.[d]??null)===null?[d]:[]})),g=new Set(l.flatMap(([d,v])=>v===null?[]:[F(d)]));e.setQueryData(h.contentChanges(n),d=>{if(!d)return d;const v={...d.changes};for(const[b,w]of l){const I=K(d,b),T=I?I.baseVersion:c?.[b]??null;w!==null?v[b]={kind:"set",version:w,baseVersion:T}:T!==null?v[b]={kind:"delete",version:null,baseVersion:T}:delete v[b]}return{...d,changes:v,edited:!0}});for(const[d,v]of l)v!==null?ce(e,n,d,!1):!g.has(F(d))&&f.has(d)&&ce(e,n,d,!0);return r&&r.draft!=="none"&&e.setQueryData(h.protocolDraftRead(t.orgSlug,t.virtualMcpId,t.branch),d=>d&&{...d,version:r.draft}),a}function Je(e,t,n){ee(e),e.setQueryData(h.contentVersions(t),o=>{const r={...o};for(const[s,i]of Object.entries(n))i===null?delete r[s]:r[s]=i;return r})}function Co(e,t){const n=e.getMutationCache().findAll({mutationKey:de(t.orgSlug,t.virtualMcpId,t.branch),status:"pending"});return new Set(n.flatMap(o=>In(o.state.variables)))}function De(e,t){e.resetQueries({queryKey:h.contentBackend(t.orgSlug,t.virtualMcpId,"local")})}async function le(e,t,n,o){try{return await o()}catch(r){const s=!(r instanceof D);throw t.source==="local"&&s?(De(e,n),new xt(r)):(t.source==="local"&&$e(r)&&De(e,n),r)}}const se=new Map;function Vt(e,t,n,o){const r=se.get(o);if(r)return r;const s=Bt(e,t,n,o,!0);return se.set(o,s),s.finally(()=>se.delete(o))}const me=new Set;function No(e,t,n){const o=P.c(8),r=z(),s=t?.orgSlug,i=t?.virtualMcpId,a=t?.branch;let c,l;o[0]!==e||o[1]!==a||o[2]!==n||o[3]!==s||o[4]!==r||o[5]!==i?(c=()=>{if(!e||!s||!i||!a)return;const u={orgSlug:s,virtualMcpId:i,branch:a};return po(f=>{f===n&&(me.has(n)||(me.add(n),Po(r,e,u,n).catch(Ro).finally(()=>me.delete(n))))})},l=[r,e,s,i,a,n],o[0]=e,o[1]=a,o[2]=n,o[3]=s,o[4]=r,o[5]=i,o[6]=c,o[7]=l):(c=o[6],l=o[7]),U.useEffect(c,l)}function Ro(){}async function Po(e,t,n,o){const r=se.get(o);return r&&await r.catch(()=>{}),Vt(e,t,n,o)}async function Bt(e,t,n,o,r){ee(e);const s=h.decofile(o),i=To(n,t),a=h.contentRevision(o),c=h.contentVersions(o),l=e.getQueryData(s),u=e.getQueryData(c),f=e.getQueryData(i),g=e.getQueryData(a)??void 0,d=t.source==="github"&&!f?ut(e,n.orgSlug,n.virtualMcpId):void 0,v=d?.isV8&&d.schema&&d.version?d:void 0,b=f??v?.schema,w=v?{...g,schemaVersion:v.version}:g,I=r&&l&&u?w?.revision:void 0,T=r&&b?w?.schemaVersion:void 0,x=h.contentChanges(o),C=e.getQueryData(x),[_,E,k]=await le(e,t,n,()=>t.client.batch([{method:"blocks.list",params:I?{ifNoneMatch:I}:{}},{method:"schema.get",params:T?{ifNoneMatch:T}:{}},{method:"changes.list",params:mt(C)}])),N=e.getQueryData(a)?.revision,p=N!==void 0&&N!==w?.revision;if(k?.ok){const X=p?null:Ee(C,k.result);X&&e.setQueryData(x,X)}else k&&t.source==="local"&&$e(k.error)&&De(e,n);if(!_?.ok)throw _?.error??new Error("no blocks.list");if(!E)throw new Error("no schema.get");const O=_.result,$=Dt(E),y=E.ok&&!$?E.result:null;if(O.notModified&&(!l||!u)||y?.notModified&&!b)return Bt(e,t,n,o,!1);const R=O.notModified?new Set:Co(e,n),j=O.notModified?l:Tn(O.blocks,l,R),M=$?_n():y?y.notModified?b:y.schema:E.error;if(e.setQueryData(a,{revision:p?N:O.notModified?w?.revision:O.revision,schemaVersion:y?y.notModified?w?.schemaVersion:y.version??void 0:void 0}),e.setQueryData(s,j),!O.notModified){const X=e.getQueryData(c),B={...O.versions};for(const A of R){const W=X?.[A];W!==void 0?B[A]=W:delete B[A]}e.setQueryData(c,B)}return M instanceof D||e.setQueryData(i,M),!p&&!O.notModified&&l&&w?.revision&&O.revision!==w.revision&&Eo({queryClient:e,orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,backend:t,cacheKey:o}),{blocks:j,meta:M}}async function xr(e,t,n,o,r,s){if(t.source==="github"){const a=[...Object.keys(r.set??{}),...r.delete??[]].filter(c=>!s||!Object.hasOwn(s,c));if(a.length>0)throw new Error(`A hosted save needs a precondition for every block it touches (missing: ${a.join(", ")})`)}return yo({queryClient:e,orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,backend:t,cacheKey:o},{kind:"edit",adopted:t.source==="github",write:async()=>{const i=await le(e,t,n,()=>t.client.blocksApply({set:r.set,delete:r.delete,...s?{ifMatch:s}:{}}));ee(e);const a=t.source==="github"?_o(e,n,o,i):i.revision;e.setQueryData(h.contentRevision(o),l=>({...l,revision:a}));const c=i.versions??{};return Je(e,o,c),{revision:a,versions:c}}})}function Ht(e,t){if(!(e instanceof D))return;const n=e.data?.draft;if(!n||typeof n!="object"||!Object.hasOwn(n,t))return;const o=n[t];return o&&typeof o.version=="string"?o:void 0}function Jt(e,t,n){if(!(n instanceof D))return;const o=n.data?.draft;if(!(!o||typeof o!="object"))for(const[r,s]of Object.entries(o))s===null&&ce(e,t,r,!1)}function Gt(e,t,n,o){ee(e);const r=o.block===null,s=e.getQueryData(h.contentVersions(t)),i=e.getQueryData(h.contentChanges(t)),a=i?K(i,n):void 0,c=a?a.baseVersion:s?.[n]??null;if(i){const l=F(n),u=Object.fromEntries(Object.entries(i.changes).filter(([f])=>F(f)!==l));r?c!==null&&(u[n]={kind:"delete",version:null,baseVersion:c}):u[n]={kind:"set",version:o.version,baseVersion:c},e.setQueryData(h.contentChanges(t),{...i,changes:u,edited:!0})}ce(e,t,n,r&&c===null),e.setQueryData(h.decofile(t),l=>{const u={...l};return r?delete u[n]:u[n]=o.block,u}),Je(e,t,{[n]:r?null:o.version})}function $r(e,t,n,o){if(t.source!=="github"||!(o instanceof D))return!1;Jt(e,n,o);const r=o.data?.draft;if(!r||typeof r!="object")return!1;const s=Object.keys(r),i=s.map(a=>Ht(o,a));return s.length===0||i.some(a=>a===void 0)?!1:(e.cancelQueries({queryKey:h.decofile(n)}),s.forEach((a,c)=>{Gt(e,n,a,i[c])}),!0)}async function jr(e,t,n,o,r,s){t.source==="github"&&Jt(e,o,s);const i=t.source==="github"?Ht(s,r):void 0;if(i)return e.cancelQueries({queryKey:h.decofile(o)}),Gt(e,o,r,i),!0;await e.invalidateQueries({queryKey:h.decofile(o)});let a;try{const l=(await le(e,t,n,()=>t.client.changesGet({names:[r]}))).entries[r];if(l&&l.after===null&&l.version!==null)return!1;a={value:l?.after??null,version:l?.version??null},t.source==="github"&&e.setQueryData(h.contentChanges(o),u=>{if(!u)return u;const f={...u.changes};return l?.kind?f[r]={kind:l.kind,version:l.version,baseVersion:l.baseVersion}:delete f[r],{...u,changes:f,edited:!0}})}catch{const c=await le(e,t,n,()=>t.client.blocksList({}));if(c.notModified)return!1;a={value:c.blocks[r]??null,version:c.versions[r]??null}}return e.setQueryData(h.decofile(o),c=>{const l={...c};return a.value===null?delete l[r]:l[r]=a.value,l}),Je(e,o,{[r]:a.version}),!1}function xo(e){const t=P.c(15),n=z();let o;t[0]!==e?.branch||t[1]!==e?.orgSlug||t[2]!==e?.virtualMcpId?(o=h.protocolDraftRead(e?.orgSlug??"",e?.virtualMcpId??"",e?.branch??""),t[0]=e?.branch,t[1]=e?.orgSlug,t[2]=e?.virtualMcpId,t[3]=o):o=t[3];let r;t[4]!==e||t[5]!==n?(r=async()=>{const d=await fetch(`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}`,{cache:"no-store",headers:ue("v8")});if(await Ne(d))throw Ce(n,e.orgSlug,e.virtualMcpId),new Re;if(!d.ok)throw new Error(`draft pointer read failed: ${d.status}`);return await d.json()},t[4]=e,t[5]=n,t[6]=r):r=t[6];const s=!!e;let i;t[7]!==o||t[8]!==r||t[9]!==s?(i={queryKey:o,queryFn:r,enabled:s,staleTime:Number.POSITIVE_INFINITY},t[7]=o,t[8]=r,t[9]=s,t[10]=i):i=t[10];const{data:a,isPending:c,isError:l}=L(i),u=!!e&&c&&!l;if(!e||!a?.draft||!a.version){let d;return t[11]!==u?(d={pointer:null,pending:u},t[11]=u,t[12]=d):d=t[12],d}const f=`${a.draft}@${a.version}`;let g;return t[13]!==f?(g={pointer:f,pending:!1},t[13]=f,t[14]=g):g=t[14],g}function Ar(e){return xo(e).pointer}function Lr(e){const t=P.c(4);let n;t[0]!==e?(n=h.contentRevision(e),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:$o,staleTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:r}=L(o);return r?.revision}async function $o(){throw new Error("content revisions are set by reads and writes")}function Te(e){const t=`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`;return e.protocolSuffix?`${t}${e.protocolSuffix}`:e.localPreviewUrl?`${t}:local:${e.localPreviewUrl}`:t}function Ur(e,t){return Te({...e,protocolSuffix:t.cacheKeySuffix})}function jo(e,t){const n=P.c(6),{url:o}=_t(e?.virtualMcpId),r=It(e?.virtualMcpId,e?.branch);if(!e)return"";let s;return n[0]!==r.cacheKeySuffix||n[1]!==r.kind||n[2]!==o||n[3]!==t?.tunnel||n[4]!==e?(s=r.kind==="protocol"?Te({...e,protocolSuffix:r.cacheKeySuffix}):Te({...e,localPreviewUrl:t?.tunnel===!1?null:o}),n[0]=r.cacheKeySuffix,n[1]=r.kind,n[2]=o,n[3]=t?.tunnel,n[4]=e,n[5]=s):s=n[5],s}function Mr(e,t){const n=P.c(39),{url:o,undecided:r}=_t(e?.virtualMcpId),s=!!o,i=It(e?.virtualMcpId,e?.branch),a=i.kind==="protocol"?i:null,c=jo(e),l=t?.fetchEnabled??!0,u=lo(e?.virtualMcpId),f=dt(e?.virtualMcpId).runtime==="cms",g=z();let d;n[0]!==c?(d=h.decofile(c),n[0]=c,n[1]=d):d=n[1];const v=d;No(a,a&&e?e:null,c);let b;n[2]!==e||n[3]!==g||n[4]!==v?(b=()=>{if(!e||g.isMutating({mutationKey:de(e.orgSlug,e.virtualMcpId,e.branch)})>0)return!0;const p=g.getQueryState(v);return p?.fetchStatus==="fetching"||Date.now()-(p?.dataUpdatedAt??0)<Ct/2},n[2]=e,n[3]=g,n[4]=v,n[5]=b):b=n[5];let w;n[6]!==f||n[7]!==s||n[8]!==e||n[9]!==a||n[10]!==g||n[11]!==v?(w=async()=>{if(e){if(!a&&f&&!s){const p=Wn(g,e)?.version;if(p&&!await Yn(e,p))return}await g.refetchQueries({queryKey:v,exact:!0},{cancelRefetch:!1})}},n[6]=f,n[7]=s,n[8]=e,n[9]=a,n[10]=g,n[11]=v,n[12]=w):w=n[12];let I;n[13]!==b||n[14]!==w?(I={skip:b,read:w},n[13]=b,n[14]=w,n[15]=I):I=n[15],to(!!t?.pollWhile&&!!e,I);let T;n[16]!==i.kind||n[17]!==f||n[18]!==l||n[19]!==c||n[20]!==s||n[21]!==o||n[22]!==u||n[23]!==e||n[24]!==a||n[25]!==g?(T=async()=>{if(a)return(await Vt(g,a,e,c)).blocks;if(i.kind==="unavailable")throw Do("decofile");if(s){const y=await fetch(new URL("/.decofile",o).toString(),{cache:"no-store"}).catch(Uo),R=y?.ok?it(await y.text()):null;if(R)return R;const j=new Error("decofile unavailable (local tunnel unreachable)");throw j.status=502,j}if(f)return Xn(g,e);const p=()=>co(e,Bn(u,".deco/blocks.gen.json"));if(l){const y=await fetch(so(e),{cache:"no-store"}).catch(Lo);if(y?.ok){const M=it(await y.text());if(M)return M}const R=await p();if(R.kind==="data")return R.data;const j=new Error(`Failed to fetch decofile: ${y?.status??"network error"}`);throw j.status=ct({liveOk:!!y?.ok,liveStatus:y?.status,committedAbsent:R.kind==="absent"}),j}const O=await p();if(O.kind==="data")return O.data;const $=new Error("decofile unavailable (preview down, no committed snapshot)");throw $.status=ct({liveOk:!1,committedAbsent:O.kind==="absent"}),$},n[16]=i.kind,n[17]=f,n[18]=l,n[19]=c,n[20]=s,n[21]=o,n[22]=u,n[23]=e,n[24]=a,n[25]=g,n[26]=T):T=n[26];const x=!!e&&i.kind!=="pending"&&!r,C=a?0:3e4,_=a?.describe.pollIntervalMs,E=a?"always":void 0;let k;n[27]!==f||n[28]!==s||n[29]!==a?(k=(p,O)=>{if(a||f||s)return p<3;const $=O.status;return $!==502&&$!==404&&p<2},n[27]=f,n[28]=s,n[29]=a,n[30]=k):k=n[30];let N;return n[31]!==v||n[32]!==T||n[33]!==x||n[34]!==C||n[35]!==_||n[36]!==E||n[37]!==k?(N={queryKey:v,queryFn:T,enabled:x,staleTime:C,refetchInterval:_,refetchIntervalInBackground:!1,refetchOnWindowFocus:E,retry:k,retryDelay:Ao},n[31]=v,n[32]=T,n[33]=x,n[34]=C,n[35]=_,n[36]=E,n[37]=k,n[38]=N):N=n[38],L(N)}function Ao(e){return fn(5e3,1e3,e,2,0)}function Lo(){return null}function Uo(){return null}const Mo="site-editor-save",Wt={id:Mo,description:void 0,action:void 0,cancel:void 0},Fr="site-editor-undo",Ie="site-editor-publish";function Fo(e){const t=P.c(7),{label:n,detail:o}=e;let r;t[0]!==n?(r=J.jsx("summary",{className:"cursor-pointer select-none text-muted-foreground",children:n}),t[0]=n,t[1]=r):r=t[1];let s;t[2]!==o?(s=J.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words font-mono text-muted-foreground",children:o}),t[2]=o,t[3]=s):s=t[3];let i;return t[4]!==r||t[5]!==s?(i=J.jsxs("details",{className:"mt-1 text-xs",children:[r,s]}),t[4]=r,t[5]=s,t[6]=i):i=t[6],i}function Yt(e,t){return t?J.jsx(Fo,{label:e("siteEditor.details"),detail:t}):void 0}function Qr(e,t,n){q.error(jt(e,t,n),{...Wt,description:Yt(e,uo(t,n))})}function Vr(e,t,n=!1){q.info(e(t?"sectionsEditor.reconcile.leftDeleted":"sectionsEditor.reconcile.keptTheirs"),{...Wt,description:e(t?n?"sectionsEditor.reconcile.leftDeletedNeverPublishedHint":"sectionsEditor.reconcile.leftDeletedHint":"sectionsEditor.reconcile.keptTheirsHint")})}const zt={action:void 0,duration:void 0};function Br(e,t){q.success(t?e("siteEditor.publish.publishedOn",{host:t}):e("siteEditor.publish.published"),{...zt,id:Ie,description:void 0})}function Hr(e,{headline:t,body:n,detail:o,retry:r,pending:s,tone:i="error"}){const a=Yt(e,o??null);q[i](t,{id:Ie,description:n&&a?J.jsxs(J.Fragment,{children:[J.jsx("p",{children:n}),a]}):n??a,action:r?{label:e("siteEditor.tryAgain"),onClick:c=>{c.preventDefault(),q.loading(s??e("thread.publishPopover.publishing"),{...zt,id:Ie,description:void 0}),r()}}:void 0,duration:r?Number.POSITIVE_INFINITY:void 0})}function Jr(e){return e instanceof Error?e.message||null:e==null?null:String(e)}export{Gn as $,Dr as A,ko as B,Tr as C,jo as D,Lr as E,Hn as F,de as G,yo as H,ao as I,Jn as J,Ur as K,er as L,nr as M,Vr as N,Rr as O,Or as P,Me as Q,kr as R,ar as S,Et as T,Po as U,Ve as V,xr as W,jr as X,Qr as Y,Nr as Z,To as _,lr as a,wr as a0,_r as a1,Pr as a2,fr as a3,mr as a4,tt as a5,nt as a6,pr as a7,cr as a8,ro as a9,D as aA,S as aB,yr as aC,gr as aa,Sn as ab,Yt as ac,Jr as ad,tr as ae,hn as af,Fo as ag,Vt as ah,Do as ai,Er as aj,co as ak,Be as al,$r as am,Ir as an,qo as ao,Ko as ap,$e as aq,Br as ar,br as as,Ar as at,Hr as au,Ie as av,zt as aw,Fr as ax,Wt as ay,Co as az,En as b,_t as c,wn as d,ir as e,yn as f,Ue as g,xe as h,bt as i,Sr as j,no as k,Mr as l,ur as m,vr as n,lo as o,or as p,Bn as q,sr as r,rr as s,kt as t,It as u,hr as v,Cr as w,dr as x,xo as y,G as z};
|
|
1
|
+
import{c as P,q as z,m as L,K as h,eQ as _e,ah as Xt,aK as Zt,aL as qt,r as U,a as Kt,az as pe,a4 as en,eR as ut,eS as Ce,bh as be,eT as ue,eU as Ne,eV as Re,ax as tn,br as ft,bj as F,eW as ee,eX as we,eY as Ge,eZ as nn,t as q,j as J}from"./index-DlBqAQ8N.js";import{u as dt}from"./use-session-runtime-Bpm2BYEZ.js";import{s as We}from"./thread-intent-Bcm8nkb-.js";import{u as Pe,b as on}from"./experiments-tab-choice-CSZHqOVL.js";import{b as fe}from"./sandbox-url-D3mC8qhT.js";import{s as rn}from"./utils-Cvz7JLdG.js";import{a as sn}from"./repository-binding-CcdmL6ag.js";import{u as an}from"./chat-context-DQIwjTah.js";import{i as cn,u as ln}from"./use-sandbox-events-0ezZYS9_.js";import{a as un}from"./sandbox-git-api-DcqI6XE4.js";import{e as fn}from"./backoff-CrEUbyZT.js";const S={MethodNotFound:-32601,InvalidParams:-32602,InternalError:-32603,NotFound:-32001,Conflict:-32002,InvalidBlock:-32003,ReadOnly:-32005,Unsupported:-32006,LimitExceeded:-32007,Unavailable:-32008,Unauthorized:-32010};class D extends Error{code;data;constructor(t,n,o){super(n),this.name="ContentProtocolError",this.code=t,this.data=o}toJSON(){return this.data===void 0?{code:this.code,message:this.message}:{code:this.code,message:this.message,data:this.data}}static from(t){return new D(t.code,t.message,t.data)}}const Z="deco-content",Se={major:1},ht=1;async function dn(e){let t=new Uint8Array(await e.arrayBuffer());if(t[0]===31&&t[1]===139){const n=new Blob([t]).stream().pipeThrough(new DecompressionStream("gzip"));t=new Uint8Array(await new Response(n).arrayBuffer())}return JSON.parse(new TextDecoder().decode(t))}const ye={major:Se.major,minor:ht},gt=`the endpoint speaks an older ${Z} than this client needs (${ye.major}.${ye.minor} or newer): update @decocms/blocks in the site (8.2.0 or newer) and start deco serve again`;function ne(e,t,n){const o={reason:t,required:{...ye}};if(n){o.actual={protocol:n.protocol,major:n.version?.major,minor:n.version?.minor};const r=n.server;typeof r?.name=="string"&&typeof r.version=="string"&&(o.server={name:r.name,version:r.version})}return new D(S.Unsupported,e,o)}function vt(e){const t=e??{},{protocol:n,version:o}=t;if(n!==Z)throw ne(`the endpoint speaks ${JSON.stringify(n)}, not ${Z}`,"protocol",t);if(o?.major!==Se.major)throw ne(`the endpoint speaks ${Z} ${String(o?.major)}.x; this client speaks ${Se.major}.x`,"major",t);if(typeof o.minor!="number"||o.minor<ht)throw ne(gt,"outdated",t);return e}function Ye(e,t){return t.code===S.MethodNotFound&&e.startsWith("changes.")?ne(gt,"outdated"):D.from(t)}function xe(e){const t=e.fetch??(s=>fetch(s));let n=1;async function o(s){const i={"content-type":"application/json",accept:"application/json",...e.headers},a=await t(new Request(e.endpoint,{method:"POST",headers:i,body:JSON.stringify(s)}));let c;try{c=await dn(a)}catch{throw new D(S.Unavailable,`the endpoint answered HTTP ${a.status} without a JSON-RPC body`)}if(!a.ok||!Array.isArray(c)&&c?.id===null){const l=c?.error;throw l?D.from(l):new D(S.Unavailable,`the endpoint answered HTTP ${a.status}`)}return c}const r=async(s,i)=>{const a=n++,c=await o({jsonrpc:"2.0",id:a,method:s,params:i??{}});if(c.error)throw Ye(s,c.error);return c.result};return{call:r,describe:async()=>vt(await r("describe")),schemaGet:s=>r("schema.get",s),blocksList:s=>r("blocks.list",s),blocksApply:s=>r("blocks.apply",s),changesList:s=>r("changes.list",s),changesGet:s=>r("changes.get",s),changesDiscard:s=>r("changes.discard",s),async batch(s){const i=s.map(()=>n++),a=await o(s.map((l,u)=>({jsonrpc:"2.0",id:i[u],method:l.method,params:l.params??{}}))),c=new Map(a.map(l=>[l.id,l]));return i.map((l,u)=>{const f=c.get(l);return f?f.error?{ok:!1,error:Ye(s[u].method,f.error)}:{ok:!0,result:f.result}:{ok:!1,error:new D(S.InternalError,"no response for this call")}})}}}function mt(e){return e&&!e.edited?{ifNoneMatch:e.revision}:{}}const ze=20,Xe=5,Ze=500;function $e(e){return e instanceof D?e.code===S.MethodNotFound?!0:e.code===S.Unsupported&&e.data?.reason==="outdated":!1}function Ee(e,t){return t.notModified?e?{...e,base:t.base}:null:{revision:t.revision,base:t.base,changes:t.changes}}async function hn(e,t,n){const o=h.contentChanges(n),r=e.getQueryData(o),s=await t.changesList(mt(r)),i=Ee(r,s);if(i)return i;const a=await t.changesList({});return Ee(void 0,a)}async function pt(e,t){const n=[];for(let s=0;s<t.length;s+=ze)n.push(t.slice(s,s+ze));const o=Object.create(null),r=[];for(let s=0;s<n.length;s+=Xe){const i=await e.batch(n.slice(s,s+Xe).map(a=>({method:"changes.get",params:{names:a}})));for(const a of i){if(!a.ok)throw a.error;const c=a.result;Object.assign(o,c.entries),r.push(...c.diagnostics)}}return{entries:o,diagnostics:r}}async function qo(e,t){let n={revision:"",versions:{}};for(let o=0;o<t.length;o+=Ze){const r=t.slice(o,o+Ze),s=await e.changesDiscard({names:r.map(i=>i.name),ifMatch:Object.fromEntries(r.map(i=>[i.name,i.version]))});n={revision:s.revision,versions:{...n.versions,...s.versions}}}return n}function Ko(e){return e instanceof D&&e.code===S.Conflict}function je(e){return e?.kind==="protocol"?e:null}function er(e,t,n){const o=P.c(14);let r;o[0]!==n?(r={},o[0]=n,o[1]=r):r=o[1];const s=r,i=z();let a;o[2]!==e?(a=je(e),o[2]=e,o[3]=a):a=o[3];const c=a,l=!!c&&!!t&&s.enabled!==!1;let u;o[4]!==t?(u=h.contentChanges(t??""),o[4]=t,o[5]=u):u=o[5];let f;o[6]!==t||o[7]!==l||o[8]!==c||o[9]!==i?(f=l?()=>hn(i,c.client,t):_e,o[6]=t,o[7]=l,o[8]=c,o[9]=i,o[10]=f):f=o[10];let g;return o[11]!==u||o[12]!==f?(g={queryKey:u,queryFn:f,staleTime:0},o[11]=u,o[12]=f,o[13]=g):g=o[13],L(g)}function tr(e,t,n){const o=P.c(14);let r;o[0]!==e?(r=je(e),o[0]=e,o[1]=r):r=o[1];const s=r;let i;o[2]!==n?(i=n?Object.keys(n.changes):[],o[2]=n,o[3]=i):i=o[3];const a=i,c=!!s&&!!t&&!!n&&a.length>0;let l;o[4]!==t||o[5]!==n?.revision?(l=h.contentChangeSides(t??"",n?.revision??""),o[4]=t,o[5]=n?.revision,o[6]=l):l=o[6];let u;o[7]!==c||o[8]!==a||o[9]!==s?(u=c?()=>pt(s.client,a):_e,o[7]=c,o[8]=a,o[9]=s,o[10]=u):u=o[10];let f;return o[11]!==l||o[12]!==u?(f={queryKey:l,queryFn:u,staleTime:Number.POSITIVE_INFINITY},o[11]=l,o[12]=u,o[13]=f):f=o[13],L(f)}function nr(e,t,n){const o=P.c(16);let r;o[0]!==e?(r=je(e),o[0]=e,o[1]=r):r=o[1];const s=r;let i,a,c,l;if(o[2]!==t||o[3]!==n?.changes||o[4]!==s){const g=Object.entries(n?.changes??{}).filter(bn).map(pn).sort(mn);a=g.map(vn);const d=JSON.stringify(g.map(gn));i=!!s&&!!t&&a.length>0,l=L,c=h.contentDeletedCopies(t??"",d),o[2]=t,o[3]=n?.changes,o[4]=s,o[5]=i,o[6]=a,o[7]=c,o[8]=l}else i=o[5],a=o[6],c=o[7],l=o[8];let u;o[9]!==i||o[10]!==a||o[11]!==s?(u=i?async()=>{const g=await pt(s.client,a),d=Object.create(null);for(const[v,b]of Object.entries(g.entries))d[v]=b.before&&typeof b.before=="object"?b.before:null;return d}:_e,o[9]=i,o[10]=a,o[11]=s,o[12]=u):u=o[12];let f;return o[13]!==c||o[14]!==u?(f={queryKey:c,queryFn:u,staleTime:Number.POSITIVE_INFINITY,placeholderData:Xt},o[13]=c,o[14]=u,o[15]=f):f=o[15],l(f)}function gn(e){return[e.name,e.base]}function vn(e){return e.name}function mn(e,t){return e.name<t.name?-1:e.name>t.name?1:0}function pn(e){const[t,n]=e;return{name:t,base:n.baseVersion??""}}function bn(e){const[,t]=e;return t.kind==="delete"}function bt(e){try{const t=new URL(e);if(t.protocol!=="http:"&&t.protocol!=="https:")return!1;const n=t.hostname.toLowerCase();return n==="127.0.0.1"||n==="[::1]"||n==="localhost"}catch{return!1}}function ie(e){try{const t=new URL(e);return(t.hostname==="127.0.0.1"||t.hostname==="[::1]")&&(t.hostname="localhost"),t.href}catch{return e}}const wt=Zt({endpoint:qt().max(2048).refine(e=>bt(e)&&new URL(e).pathname==="/rpc").transform(ie)});function or(e){const t=new URLSearchParams(e.replace(/^#/,"")),n=wt.safeParse({endpoint:t.get("endpoint")??""});return n.success?n.data:null}function St(e){const t=wt.safeParse(e);return t.success?t.data:null}const yt="studio:deco-serve-last";function rr(e){try{localStorage.setItem(yt,JSON.stringify(e))}catch{}}function sr(){try{const e=localStorage.getItem(yt);return e?St(JSON.parse(e)):null}catch{return null}}function ir(e){try{return new URL(ie(e)).host}catch{return e}}function wn(e,t=1e4){return Math.min(1e3*2**Math.max(0,e-1),t)}const Sn="http://localhost:4545/rpc",ar="npx @decocms/blocks serve",cr="npx @decocms/blocks schema";class Ae extends Error{constructor(t="the endpoint isn't deco serve"){super(t),this.name="NotDecoServeError"}}function yn(e){if(e instanceof Ae)return{reason:"not-deco-serve"};if(!(e instanceof D))return{reason:"not-answering"};switch(e.code){case S.Unauthorized:case S.MethodNotFound:return{reason:"outdated"};case S.Unsupported:return $e(e)?{reason:"outdated"}:{reason:"version-mismatch"};case S.Unavailable:return/^the endpoint answered HTTP/.test(e.message)?{reason:"not-deco-serve"}:{reason:"error",detail:e.message};default:return{reason:"error",detail:e.message}}}function lr(e,t){if(e)return[ie(e.endpoint)];const n=[t?.endpoint,Sn].filter(o=>!!o).map(ie);return[...new Set(n)]}const Et=U.createContext(null);function En(e){const t=P.c(27),n=U.useContext(Et),o=Pe(n?null:e),{data:r}=Kt.useSession(),s=r?.user?.id??"",i=!!e&&!!s;let a;t[0]!==i||t[1]!==s||t[2]!==e?(a=i?pe.decoServeConnection(s,e):null,t[0]=i,t[1]=s,t[2]=e,t[3]=a):a=t[3];const[c,l]=Ke(a);let u;t[4]!==i||t[5]!==s||t[6]!==e?(u=i?pe.decoServeEndpoint(s,e):null,t[4]=i,t[5]=s,t[6]=e,t[7]=u):u=t[7];const[f,g]=Ke(u);if(n)return n;let d;t[8]!==c||t[9]!==i?(d=i?St(c):null,t[8]=c,t[9]=i,t[10]=d):d=t[10];const v=d,b=!!v;let w;t[11]!==o||t[12]!==b?(w=kn(o,b),t[11]=o,t[12]=b,t[13]=w):w=t[13];const{applies:I,undecided:T}=w,x=I?v:null,C=i&&o==="v8"&&typeof f=="string"?f:null;let _;t[14]!==g||t[15]!==l||t[16]!==i?(_=N=>{i&&(l(N),g(N.endpoint))},t[14]=g,t[15]=l,t[16]=i,t[17]=_):_=t[17];let E;t[18]!==l||t[19]!==i?(E=()=>{i&&l(null)},t[18]=l,t[19]=i,t[20]=E):E=t[20];let k;return t[21]!==x||t[22]!==C||t[23]!==_||t[24]!==E||t[25]!==T?(k={connection:x,undecided:T,lastEndpoint:C,set:_,clear:E},t[21]=x,t[22]=C,t[23]=_,t[24]=E,t[25]=T,t[26]=k):k=t[26],k}function kn(e,t){return t?e==="loading"?{applies:!1,undecided:!0}:{applies:e==="v8"||e==="error",undecided:!1}:{applies:!1,undecided:!1}}function qe(e){try{const t=localStorage.getItem(e);return t===null?null:JSON.parse(t)}catch{return null}}function Ke(e){const t=P.c(17),n=z(),o=e??"";let r;t[0]!==o?(r=["localStorage",o],t[0]=o,t[1]=r):r=t[1];const s=r;let i,a;t[2]!==e?(i=()=>e?qe(e):null,a=()=>e?qe(e):null,t[2]=e,t[3]=i,t[4]=a):(i=t[3],a=t[4]);const c=!!e;let l;t[5]!==s||t[6]!==i||t[7]!==a||t[8]!==c?(l={queryKey:s,queryFn:i,initialData:a,enabled:c,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[5]=s,t[6]=i,t[7]=a,t[8]=c,t[9]=l):l=t[9];const{data:u}=L(l);let f;t[10]!==e||t[11]!==n||t[12]!==s?(f=b=>{if(e){try{b===null?localStorage.removeItem(e):localStorage.setItem(e,JSON.stringify(b))}catch{}n.setQueryData(s,b)}},t[10]=e,t[11]=n,t[12]=s,t[13]=f):f=t[13];const g=f,d=e?u??null:null;let v;return t[14]!==g||t[15]!==d?(v=[d,g],t[14]=g,t[15]=d,t[16]=v):v=t[16],v}function ur(e){return e.kind==="protocol"||e.kind==="unavailable"}function fr(e){const t=e.hasOrg?e.orgFlag:!1,{backend:n}=e;return n==="protocol"||n==="unavailable"?!0:n==="pending"?t===!0?!0:void 0:t}function dr(e,t,n){return t!=="github"||n!=="v8"?!1:e.kind==="pending"?!0:e.kind==="unavailable"&&e.siteNotOwned?!1:(e.kind==="protocol"||e.kind==="unavailable")&&e.source==="github"}function hr(e){if(e.kind!=="protocol"||e.source!=="local")return null;const t=e.describe.preview?.url;return t&&bt(t)?t:null}function gr(e,t){return e.kind!=="protocol"||e.source!=="local"||!e.describe.assets||!t?null:new URL(t.endpoint).origin}function kt(e){return e.hasServeConnection?"local":e.runtime==="sandbox"?"sandbox":"github"}function On(e){if(!e.hasProject)return"legacy";const t=kt(e);if(t==="local")return"protocol-local";if(e.serveConnectionUndecided)return"pending";if(t==="sandbox"){const o=e.sandboxSite;return o==="v8"?"protocol-sandbox":o==="v7"?"legacy":o==="error"?e.markedV8?"retrying-sandbox":"legacy":"pending"}if(e.mainSchema==="loading")return"pending";if(e.mainSchema==="error")return"retrying-github";if(e.mainSchema==="v7")return"legacy";const n=e.githubSite;return n==="v8"?"protocol-github":n==="not-owned"?"site-not-owned-github":n==="error"?"unavailable-github":n==="v7"?"legacy":"pending"}function Dn(e){return{github:e.mode==="github"&&e.mainSchema==="v8",sandbox:e.mode==="sandbox"&&e.workingTreeReady}}function et(e){return e.isError||e.errorUpdateCount>0}function Tn(e,t,n){if(!t||n.size===0)return e;const o={...e};for(const r of n)Object.hasOwn(t,r)?o[r]=t[r]:delete o[r];return o}function In(e){if(!e||typeof e!="object")return[];const t=e,n=[];return typeof t.blockKey=="string"&&n.push(t.blockKey),t.writes&&typeof t.writes=="object"&&n.push(...Object.keys(t.writes)),Array.isArray(t.deletes)&&n.push(...t.deletes.filter(o=>typeof o=="string")),n}const Ot="__noSchema";function _n(){return{manifest:{blocks:{}},schema:{definitions:{},root:{}},[Ot]:!0}}function vr(e){return!!e&&e[Ot]===!0}function Dt(e){if(!e.ok)return e.error.code===S.NotFound;const t=e.result;return t.notModified===!1&&t.schema===null}function Cn(e,t){return(typeof t.name=="string"?t.name.trim():"")||e}const Nn=(e,t)=>e.label.localeCompare(t.label)||e.key.localeCompare(t.key);function mr(e){const t=new Map;for(const[n,o]of Object.entries(e)){const r=o&&typeof o=="object"&&!Array.isArray(o)?o:{},s=typeof r.__resolveType=="string"?r.__resolveType:null,i=t.get(s)??[];i.push({key:n,label:Cn(n,r)}),t.set(s,i)}return[...t.entries()].map(([n,o])=>({resolveType:n,blocks:o.sort(Nn)})).sort((n,o)=>n.resolveType===null?1:o.resolveType===null?-1:tt(n.resolveType).localeCompare(tt(o.resolveType))||n.resolveType.localeCompare(o.resolveType))}function tt(e){return(e.split("/").filter(Boolean).at(-1)??e).replace(/\.(tsx?|jsx?)$/,"")||e}function nt(e,t,n){if(t.length===0)return n;const[o,...r]=t;if(Array.isArray(e)&&typeof o=="number"){const s=e.slice();return s[o]=nt(e[o],r,n),s}if(e&&typeof e=="object"&&typeof o=="string"){const s=e,i={};for(const a of Object.keys(s))i[a]=a===o?nt(s[a],r,n):s[a];return i}return e}function pr(e){if(e.trim()==="")return null;const t=Number(e);return Number.isFinite(t)?t:null}class ot extends Error{}class rt extends Error{}const Tt="site-not-owned";async function Rn(e){return e.status!==409?!1:(await e.clone().json().catch(()=>null))?.code==="site_not_owned"}async function Pn(e,t=r=>fetch(r),n,o){const r=xe({endpoint:e,fetch:async s=>{const i=new Request(s);for(const[c,l]of Object.entries(ue("v8")))i.headers.set(c,l);const a=await t(i);if(await Rn(a))throw new rt;if(await Ne(a))throw n?.(),new Re;return a}});try{const s=await Ue(r,be(o)?{schema:o}:void 0);return s.v8Schema?s:null}catch(s){if(s instanceof rt)return Tt;throw s}}const Le=5e3;function xn(e){return new URL(`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}/rpc`,window.location.origin).href}function $n(e){return new URL(fe(e,"rpc"),window.location.origin).href}async function Ue(e,t){const[n,o]=await e.batch(t?[{method:"describe"}]:[{method:"describe"},{method:"schema.get"}]);if(!n?.ok)throw n?.error??new Error("no describe");if(n.result?.protocol!==Z)throw new Ae;const s=vt(n.result);if(t)return{client:e,describe:s,hasSchema:t.schema!=null,v8Schema:be(t.schema)};if(!o)throw new Error("no schema.get");if(Dt(o))return{client:e,describe:s,hasSchema:!1,v8Schema:!1};if(o.ok){const i=o.result;return{client:e,describe:s,hasSchema:!0,v8Schema:be(i?.schema)}}throw o.error}async function jn(e,t=n=>fetch(n)){const n=xe({endpoint:e,fetch:async o=>{const r=await t(o);if(r.status===404)throw new ot;return r}});try{const o=await Ue(n);return o.v8Schema?o:null}catch(o){if(o instanceof ot)return null;throw o}}function It(e,t){const n=P.c(53),{org:o}=en(),{connection:r,undecided:s}=En(e),{runtime:i}=dt(e),a=U.useContext(Et),c=Pe(a?null:e),l=on(e),u=kt({hasServeConnection:!!r,runtime:i}),f=an()?.taskId??null,g=cn(ln().lifecycle.phase),d=z(),v=Dn({mode:u,mainSchema:c,workingTreeReady:g}),b=v.github&&!!o.slug&&!!e&&!!t;let w;n[0]!==t||n[1]!==o.slug||n[2]!==d||n[3]!==e?(w=()=>Pn(xn({orgSlug:o.slug,virtualMcpId:e,branch:t}),void 0,()=>Ce(d,o.slug,e),ut(d,o.slug,e)?.schema),n[0]=t,n[1]=o.slug,n[2]=d,n[3]=e,n[4]=w):w=n[4];const I=L({queryKey:h.contentBackend(o.slug,e??"",t??"","github"),queryFn:w,enabled:b,staleTime:Number.POSITIVE_INFINITY,...st}),T=v.sandbox&&!!o.slug&&!!e&&!!t;let x;n[5]!==t||n[6]!==o.slug||n[7]!==f||n[8]!==e?(x=async()=>jn($n({orgSlug:o.slug,virtualMcpId:e,branch:t,threadId:f})),n[5]=t,n[6]=o.slug,n[7]=f,n[8]=e,n[9]=x):x=n[9];const C=L({queryKey:h.contentBackend(o.slug,e??"",t??"","sandbox",f??""),queryFn:x,enabled:T,staleTime:Number.POSITIVE_INFINITY,...st}),_=!!r;let E;n[10]!==r?.endpoint||n[11]!==o.slug||n[12]!==e?(E=h.contentBackend(o.slug,e??"","local",r?.endpoint??""),n[10]=r?.endpoint,n[11]=o.slug,n[12]=e,n[13]=E):E=n[13];let k;n[14]!==r?(k=()=>Ue(xe({endpoint:r.endpoint})),n[14]=r,n[15]=k):k=n[15];let N;n[16]!==_||n[17]!==E||n[18]!==k?(N={queryKey:E,queryFn:k,enabled:_,staleTime:Number.POSITIVE_INFINITY,retry:Un,retryDelay:Ln,refetchInterval:An},n[16]=_,n[17]=E,n[18]=k,n[19]=N):N=n[19];const p=L(N);let O;n[20]!==r?.endpoint||n[21]!==o.slug||n[22]!==e?(O=h.contentBackend(o.slug,e??"","local",r?.endpoint??""),n[20]=r?.endpoint,n[21]=o.slug,n[22]=e,n[23]=O):O=n[23];const $=O;let y;n[24]!==r?.endpoint||n[25]!==o.slug||n[26]!==e?(y=h.contentBackend(o.slug,e??"","local-describe",r?.endpoint??""),n[24]=r?.endpoint,n[25]=o.slug,n[26]=e,n[27]=y):y=n[27];let R;n[28]!==p.data||n[29]!==$||n[30]!==d?(R=async()=>{try{return await p.data.client.describe()}catch(m){const Y=m;throw d.invalidateQueries({queryKey:$,exact:!0},{cancelRefetch:!1}),Y}},n[28]=p.data,n[29]=$,n[30]=d,n[31]=R):R=n[31];const j=!!p.data&&!a;let M;n[32]!==y||n[33]!==R||n[34]!==j?(M={queryKey:y,queryFn:R,enabled:j,refetchInterval:Le,retry:!1},n[32]=y,n[33]=R,n[34]=j,n[35]=M):M=n[35];const B=L(M).data??p.data?.describe,A=On({hasProject:!!e,hasServeConnection:!!r,serveConnectionUndecided:s,runtime:i,mainSchema:c,githubSite:I.data===Tt?"not-owned":I.data?"v8":I.data===null?"v7":et(I)?"error":"loading",sandboxSite:Mn({data:C.data,isError:et(C),workingTreeReady:g}),markedV8:l});if(A==="pending"){let m;return n[36]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"pending"},n[36]=m):m=n[36],m}if(A==="retrying-github"){let m;return n[37]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"pending",retrying:"github"},n[37]=m):m=n[37],m}if(A==="retrying-sandbox"){let m;return n[38]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"pending",retrying:"sandbox"},n[38]=m):m=n[38],m}if(A==="legacy"){let m;return n[39]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"legacy"},n[39]=m):m=n[39],m}if(A==="protocol-github"){const m=I.data;let Y;return n[40]!==m?(Y=ke("github",m,""),n[40]=m,n[41]=Y):Y=n[41],Y}if(A==="site-not-owned-github"){let m;return n[42]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"unavailable",source:"github",siteNotOwned:!0},n[42]=m):m=n[42],m}if(A==="protocol-sandbox"){let m;return n[43]!==C.data?(m=ke("sandbox",C.data,":sandbox"),n[43]=C.data,n[44]=m):m=n[44],m}if(A==="unavailable-github"){let m;return n[45]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"unavailable",source:"github"},n[45]=m):m=n[45],m}const W=p.error??p.failureReason,ve=r?.endpoint??"";let te;return n[46]!==B||n[47]!==p.data||n[48]!==p.failureCount||n[49]!==p.isError||n[50]!==W||n[51]!==ve?(te=Qn({probed:p.data,isError:p.isError,failureCount:p.failureCount,failure:W,describe:B,endpoint:ve}),n[46]=B,n[47]=p.data,n[48]=p.failureCount,n[49]=p.isError,n[50]=W,n[51]=ve,n[52]=te):te=n[52],te}function An(e){return e.state.status==="error"||e.state.data?.v8Schema===!1?Le:!1}function Ln(e){return wn(e+1)}function Un(e,t){return!(t instanceof D)&&!(t instanceof Ae)}function Mn(e){return e.data!==void 0?e.data?"v8":"v7":e.workingTreeReady?e.isError?"error":"loading":"unavailable"}const Fn=3;function Qn(e){if(e.probed?.hasSchema&&!e.probed.v8Schema)return{kind:"unavailable",source:"local",problem:{reason:"not-v8"}};const t=e.probed?ke("local",{...e.probed,describe:e.describe??e.probed.describe},`:serve:${e.endpoint}`):null;return e.isError||e.failureCount>0?t?.kind==="protocol"&&!e.isError&&e.failureCount<Fn?t:{kind:"unavailable",source:"local",problem:yn(e.failure)}:t??{kind:"pending"}}const st={retry:2,refetchInterval:e=>e.state.status==="error"?Le:!1};function ke(e,t,n){return{kind:"protocol",source:e,client:t.client,describe:t.describe,cacheKeySuffix:n,hasSchema:t.hasSchema}}function _t(e){const t=P.c(13);let n;t[0]!==e?(n=pe.localPreviewUrl(e??""),t[0]=e,t[1]=n):n=t[1];const o=n,[r,s]=tn(o,null),i=Pe(e);let a;if(t[2]!==i||t[3]!==r||t[4]!==e){const g=e?We(r):null;a=Vn({saved:g,main:i}),t[2]=i,t[3]=r,t[4]=e,t[5]=a}else a=t[5];const c=a;let l,u;t[6]!==s?(l=g=>s(We(g)),u=()=>s(null),t[6]=s,t[7]=l,t[8]=u):(l=t[7],u=t[8]);let f;return t[9]!==c||t[10]!==l||t[11]!==u?(f={...c,setUrl:l,clear:u},t[9]=c,t[10]=l,t[11]=u,t[12]=f):f=t[12],f}function Vn(e){return e.saved?e.main==="v7"?{url:e.saved,undecided:!1}:e.main==="v8"?{url:null,undecided:!1}:{url:null,undecided:!0}:{url:null,undecided:!1}}function Bn(e,t){const n=(e??"").trim().replace(/^[/\\]+|[/\\]+$/g,"");return n?`${n}/${t}`:t}function it(e){let t;try{t=JSON.parse(e)}catch{return null}return typeof t!="object"||t===null||Array.isArray(t)?null:t}class Me extends Error{constructor(t,n,o=[],r=!1){super(n),this.blocks=t,this.fields=o,this.carriedStored=r,this.name="BlockConflictError"}blocks;fields;carriedStored}function Fe(e){return`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`}function de(e,t,n){return["decofile-write",e,t,n]}function Hn(e,t,n){return{id:de(e,t,n).join(":")}}function Qe(e){return`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}`}async function Jn(e,t){const n=await e.json().catch(()=>({}));throw new Error(n.error??`${t} failed (${e.status})`)}function Gn(e,t,n){e.setQueryData(h.decofileDraft(Fe(t)),n)}function Wn(e,t){return e.getQueryData(h.decofileDraft(Fe(t)))??null}async function Yn(e,t){const n=await fetch(Qe(e),{cache:"no-store",headers:{...ue("v7"),"if-none-match":`"${t}"`}}).catch(()=>null);return n?.status===200||n?.status===409}function br(e){const t=P.c(4);let n;t[0]!==e?(n=h.decofileDraft(e?Fe(e):""),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:zn,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:r}=L(o);return r??null}async function zn(){throw new Error("decofileDraft is populated by reads/writes, not fetched")}async function Xn(e,t){const n=await fetch(Qe(t),{cache:"no-store",headers:ue("v7")});if(await Ne(n))throw Ce(e,t.orgSlug,t.virtualMcpId),new Re;if(!n.ok){const r=new Error(`Failed to fetch decofile: ${n.status}`);throw r.status=n.status,r}const o=await n.json();return o.token&&Gn(e,t,{version:o.version,token:o.token,apiHost:o.apiHost??window.location.host}),o.decofile}async function wr(e,t){const n=await fetch(Qe(e),{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(n.status===409){const r=await n.json().catch(()=>({}));throw r.code==="block-conflict"?new Me(r.blocks??[],r.error??"Block changed"):new Error(r.error??`Save failed (${n.status})`)}if(!n.ok)return Jn(n,"Save");const o=await n.json();return{...o,apiHost:o.apiHost??window.location.host}}const Ct=3e3,Zn=15e3,qn=2*6e4,Nt={now:()=>Date.now(),setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),hidden:()=>typeof document<"u"&&document.visibilityState==="hidden"};function Kn(e){return e<qn?Ct:Zn}function eo(e,t=Nt){const n=t.now();let o=!1,r=!1,s=null;const i=()=>{o||(s=t.setTimeout(a,Kn(t.now()-n)))},a=()=>{if(s=null,o)return;const{read:c,skip:l}=e();if(r||t.hidden()||l?.()){i();return}r=!0;let u;try{u=c()}catch{u=void 0}Promise.resolve(u).catch(()=>{}).finally(()=>{r=!1}),i()};return i(),()=>{o=!0,s!==null&&t.clearTimeout(s)}}const at=()=>0;function to(e,t,n=Nt){const o=U.useRef(t);o.current=t;const[r]=U.useState(()=>({polling:()=>eo(()=>o.current,n),idle:()=>()=>{}}));U.useSyncExternalStore(e?r.polling:r.idle,at,at)}function Rt(e,t){return fe(e,t)}function no(e,t){return fe(e,"preview-fetch",{path:t})}function Sr(e){return Rt(e,"preview-invoke")}function yr(e){return Rt(e,"catalog-invoke")}function Pt(e){try{const{hostname:t}=new URL(e);return t==="localhost"||t.endsWith(".localhost")||t==="127.0.0.1"||t==="::1"}catch{return!1}}function oo(){if(typeof document>"u")return null;const e=Array.from(document.querySelectorAll("iframe"));for(const t of e){const n=t.getAttribute("src");if(n&&Pt(n))return n}return null}function ro(e,t){const n=e.previewUrl??e.getFallbackPreviewUrl?.()??oo();return n&&Pt(n)?new URL(t,n).toString():no(e,t)}function so(e){return ro(e,"/.decofile")}function io(e){return e===400?"absent":e===404?"unavailable":e>=200&&e<300?"ok":"error"}function ct(e){return e.liveOk||e.committedAbsent?404:e.liveStatus??502}async function ao(e,t){const n=fe(e,"read"),o=await fetch(n,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:t,full:!0})}),r=io(o.status);if(r==="absent")return{kind:"absent"};if(r==="unavailable")return{kind:"unavailable"};if(r==="error"){const i=new Error(`Failed to read ${t}: ${o.status}`);throw i.status=o.status,i}const s=await o.json();return typeof s.content!="string"?{kind:"unavailable"}:{kind:"data",data:rn(s.content)}}async function co(e,t){const n=await ao(e,t);if(n.kind!=="data")return n;try{return{kind:"data",data:JSON.parse(n.data)}}catch{return{kind:"unavailable"}}}async function Er(e){const t=`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}/meta`,n=await fetch(t,{cache:"no-store"});if(n.status===404)return{kind:"absent"};if(!n.ok){const o=new Error(`Failed to read committed meta: ${n.status}`);throw o.status=n.status,o}try{return{kind:"data",data:await n.json()}}catch{return{kind:"unavailable"}}}function lo(e){return sn(e)?.metadata?.runtime?.path??null}class xt extends Error{constructor(t){super(t instanceof Error?t.message:String(t),{cause:t}),this.name="ServeLostError"}}function kr(e){return e instanceof D&&e.code===S.Conflict}function $t(e){const t=e.data?.violations;return!Array.isArray(t)||t.length===0?e.message:t.slice(0,3).map(n=>n.message).join("; ")}class Ve extends Error{constructor(){super("The draft's changes couldn't be read"),this.name="HostedDraftUnreadError"}}class Be extends Error{constructor(){super("The blocks kept changing while the change was saved"),this.name="HostedKeptChangingError"}}function Or(e,t){return(t instanceof Ve||t instanceof Be)&&(t.message=jt(e,t,"github")),t}function jt(e,t,n){if(t instanceof Ve)return e("siteEditor.save.draftUnread");if(t instanceof Be)return e("siteEditor.save.keptChanging");if(t instanceof Me)return t.message;if(n==="local")return fo(e,t);if(t instanceof D)switch(t.code){case S.Conflict:return e("siteEditor.save.conflict");case S.ReadOnly:return e("siteEditor.save.readOnly");case S.InvalidBlock:case S.InvalidParams:return e("siteEditor.save.invalid");case S.LimitExceeded:return e("siteEditor.save.tooLarge")}return e("siteEditor.save.failed")}function uo(e,t){if(t==="local"||e instanceof Me||e instanceof Ve||e instanceof Be)return null;if(e instanceof D){const n=e.code===S.InvalidBlock||e.code===S.InvalidParams?$t(e):e.message;return n?`${e.code}: ${n}`:null}return e.message||null}function fo(e,t){if(t instanceof xt)return e("decoServe.save.serverGone");if(t instanceof D)switch(t.code){case S.Conflict:return e("decoServe.save.conflict");case S.ReadOnly:return e("decoServe.save.readOnly");case S.InvalidBlock:case S.InvalidParams:return e("decoServe.save.invalid",{detail:$t(t)});case S.LimitExceeded:return e("decoServe.save.tooLarge")}return e("sectionsEditor.sectionsEditor.saveFailed",{error:t.message})}function ho(e,t,n){return e===null?0:Math.max(0,n-Math.max(0,t-e))}function go(e,t){const[n,o]=U.useState(e),r=U.useRef(null);return e&&!n&&o(!0),U.useEffect(()=>{if(e){r.current??=Date.now();return}if(!n)return;const s=()=>{r.current=null,o(!1)},i=ho(r.current,Date.now(),t);if(i===0){s();return}const a=setTimeout(s,i);return()=>clearTimeout(a)},[e,n,t]),n}const vo="decocms:content-writes",Oe=new Set;let H;function At(){if(H!==void 0)return H;H=null;try{typeof BroadcastChannel=="function"&&(H=new BroadcastChannel(vo),H.addEventListener("message",e=>{const t=e.data?.cacheKey;if(typeof t=="string")for(const n of[...Oe])n(t)}))}catch{H=null}return H}function mo(e){try{At()?.postMessage({cacheKey:e})}catch{}}function po(e){return At(),Oe.add(e),()=>{Oe.delete(e)}}const Lt={phase:"idle",inFlight:0,reload:{seq:0,navigates:!1},epoch:0},bo=15e3,ae=new Map;function G(e,t){return`${e}/${t}`}function Q(e){let t=ae.get(e);return t||(t={state:Lt,listeners:new Set,previews:0,timer:null,discardListeners:new Set},ae.set(e,t)),t}function V(e,t){const n=Q(e);n.state={...n.state,...t};for(const o of n.listeners)o()}function he(e){e.timer&&clearTimeout(e.timer),e.timer=null}function He(e){return ae.get(e)?.state??Lt}function wo(e,t){const n=Q(e);return n.listeners.add(t),()=>{n.listeners.delete(t)}}function Dr(e){const t=Q(e);return t.previews++,()=>{t.previews--,t.previews===0&&t.state.phase==="reloading"&&(he(t),V(e,{phase:"idle"}))}}function Tr(e){const t=ae.get(e);!t||t.state.phase!=="reloading"||(he(t),V(e,{phase:"idle"}))}function Ut(e){const t=Q(e);he(t),V(e,{phase:"saving",inFlight:t.state.inFlight+1})}function oe(e,t){const n=Q(e),o=Math.max(0,n.state.inFlight-1);if(o>0){V(e,{inFlight:o});return}if(!t.ok||n.previews===0){V(e,{phase:"idle",inFlight:o});return}Mt(e,t.navigates,o)}function Mt(e,t,n=0){const o=Q(e);he(o),o.timer=setTimeout(()=>{o.timer=null,o.state.phase==="reloading"&&V(e,{phase:"idle"})},bo),V(e,{phase:"reloading",inFlight:n,reload:{seq:o.state.reload.seq+1,navigates:t}})}function So(e){return e?.kind==="protocol"&&e.source==="github"}async function re(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:r,branch:s,backend:i,cacheKey:a}=e,c=t.kind==="publish"||t.kind==="reapply"?n.invalidateQueries({queryKey:h.hostedReleases(o,r)}):null;if(i?.kind!=="protocol")return await c,{navigates:!1};const l=s?h.protocolDraftRead(o,r,s):null,u=l?JSON.stringify(n.getQueryData(l)??null):null,f=c?[c]:[];if(a&&t.reread&&f.push(n.invalidateQueries({queryKey:h.decofile(a)})),a&&!t.adopted&&f.push(n.invalidateQueries({queryKey:h.contentChanges(a)})),s&&i.source==="sandbox"&&f.push(n.invalidateQueries({queryKey:un(o,r,s)})),So(i)&&l&&!t.adopted&&f.push(n.invalidateQueries({queryKey:l})),await Promise.all(f),t.kind!=="edit"){const v=G(o,r);V(v,{epoch:He(v).epoch+1})}const g=l?JSON.stringify(n.getQueryData(l)??null):null,d=u!==g;return d&&await new Promise(v=>ft.schedule(v)),{navigates:d}}async function yo(e,t){return Ut(G(e.orgSlug,e.virtualMcpId)),Ft(e,t)}function lt(e){return e.branch?JSON.stringify(e.queryClient.getQueryData(h.protocolDraftRead(e.orgSlug,e.virtualMcpId,e.branch))??null):null}async function Ft(e,t){const n=G(e.orgSlug,e.virtualMcpId),o=t.adopted?lt(e):null;let r;try{r=await t.write()}catch(i){throw oe(n,{ok:!1,navigates:!1}),t.refreshOnError&&re(e,{kind:t.kind,reread:!0}).catch(()=>{}),i}if(e.backend?.kind==="protocol"&&e.cacheKey&&mo(e.cacheKey),t.adopted){const i=lt(e)!==o;return i&&await new Promise(a=>ft.schedule(a)),oe(n,{ok:!0,navigates:i}),t.reread&&re(e,t).catch(()=>{}),r}let s=!1;try{({navigates:s}=await re(e,t))}catch{}finally{oe(n,{ok:!0,navigates:s})}return r}function Ir(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:r,branch:s}=e,i=G(o,r),a=new Set(t.blockKeys);for(const u of[...Q(i).discardListeners])u(a);Ut(i);let c=!1;const l=()=>(c=!0,Ft(e,{kind:"discard",reread:!0,write:t.write}));return s?n.getMutationCache().build(n,{mutationKey:de(o,r,s),scope:Hn(o,r,s),mutationFn:l}).execute(void 0).catch(u=>{throw c||oe(i,{ok:!1,navigates:!1}),u}):l()}function _r(e,t,n){const o=P.c(8);let r;o[0]!==e||o[1]!==t?(r=G(e,t),o[0]=e,o[1]=t,o[2]=r):r=o[2];const s=r;let i;o[3]!==n||o[4]!==s?(i=()=>{const c=Q(s).discardListeners;return c.add(n),()=>{c.delete(n)}},o[3]=n,o[4]=s,o[5]=i):i=o[5];let a;o[6]!==s?(a=[s],o[6]=s,o[7]=a):a=o[7],U.useEffect(i,a)}function Eo(e){const t=G(e.orgSlug,e.virtualMcpId);He(t).inFlight>0||re(e,{kind:"external"}).then(({navigates:n})=>{const o=Q(t);o.previews>0&&o.state.inFlight===0&&Mt(t,n)}).catch(()=>{})}function ko(e,t){const n=P.c(7);let o;n[0]!==e||n[1]!==t?(o=G(e,t),n[0]=e,n[1]=t,n[2]=o):o=n[2];const r=o;let s;n[3]!==r?(s=l=>wo(r,l),n[3]=r,n[4]=s):s=n[4];const i=s;let a;n[5]!==r?(a=()=>He(r),n[5]=r,n[6]=a):a=n[6];const c=a;return U.useSyncExternalStore(i,c,c)}const Oo=500;function Cr(e,t){const{phase:n}=ko(e,t);return go(n!=="idle",Oo)}function Do(e){const t=new Error(`${e} unavailable (content server unreachable)`);return t.status=502,t}function To(e,t){return h.liveMeta(e.orgSlug,e.virtualMcpId,e.branch,`protocol${t.cacheKeySuffix}`,"")}function Nr(e,t,n,o){if(o?.source==="github")return Io(e,t,n);const r=e.getQueryData(h.contentVersions(t));if(!r)return;if(Object.hasOwn(r,n))return r[n];const s=e.getQueryData(h.decofile(t));return s&&Object.hasOwn(s,n)?void 0:null}function K(e,t){if(Object.hasOwn(e.changes,t))return e.changes[t];const n=F(t),o=Object.keys(e.changes).find(r=>F(r)===n);return o===void 0?void 0:e.changes[o]}function Io(e,t,n){const o=e.getQueryData(h.contentChanges(t));if(o)return Qt(o,ge(e,t),n)}function Qt(e,t,n){const o=K(e,n);return o?.kind==="delete"?o.version??we:o?o.version:t.has(F(n))?we:null}function Rr(e,t,n){const o=e.getQueryData(h.contentChanges(t));if(!o)return!1;const r=K(o,n);return r?r.kind==="set"&&r.baseVersion===null:ge(e,t).has(F(n))}function Pr(e,t){const n=e.getQueryData(h.decofile(t)),o=e.getQueryData(h.contentChanges(t));if(!n||!o)return null;const r=ge(e,t);return{blocks:n,versionOf:s=>Qt(o,r,s)}}function ge(e,t){return new Set(e.getQueryData(h.contentDraftTombstones(t)))}function ce(e,t,n,o){const r=F(n),s=ge(e,t);s.has(r)!==o&&(o?s.add(r):s.delete(r),ee(e),e.setQueryData(h.contentDraftTombstones(t),[...s]))}function _o(e,t,n,o){const r=Ge(o.revision),s=e.getQueryData(h.contentRevision(n))?.revision,i=s?Ge(s):null,a=r&&!r.main&&i?nn(i.main,r.draft):o.revision,c=e.getQueryData(h.contentVersions(n)),l=Object.entries(o.versions??{}).map(([d,v])=>[d,v===we?null:v]),u=e.getQueryData(h.contentChanges(n)),f=new Set(l.flatMap(([d])=>{const v=u?K(u,d):void 0;return(v?v.baseVersion:c?.[d]??null)===null?[d]:[]})),g=new Set(l.flatMap(([d,v])=>v===null?[]:[F(d)]));e.setQueryData(h.contentChanges(n),d=>{if(!d)return d;const v={...d.changes};for(const[b,w]of l){const I=K(d,b),T=I?I.baseVersion:c?.[b]??null;w!==null?v[b]={kind:"set",version:w,baseVersion:T}:T!==null?v[b]={kind:"delete",version:null,baseVersion:T}:delete v[b]}return{...d,changes:v,edited:!0}});for(const[d,v]of l)v!==null?ce(e,n,d,!1):!g.has(F(d))&&f.has(d)&&ce(e,n,d,!0);return r&&r.draft!=="none"&&e.setQueryData(h.protocolDraftRead(t.orgSlug,t.virtualMcpId,t.branch),d=>d&&{...d,version:r.draft}),a}function Je(e,t,n){ee(e),e.setQueryData(h.contentVersions(t),o=>{const r={...o};for(const[s,i]of Object.entries(n))i===null?delete r[s]:r[s]=i;return r})}function Co(e,t){const n=e.getMutationCache().findAll({mutationKey:de(t.orgSlug,t.virtualMcpId,t.branch),status:"pending"});return new Set(n.flatMap(o=>In(o.state.variables)))}function De(e,t){e.resetQueries({queryKey:h.contentBackend(t.orgSlug,t.virtualMcpId,"local")})}async function le(e,t,n,o){try{return await o()}catch(r){const s=!(r instanceof D);throw t.source==="local"&&s?(De(e,n),new xt(r)):(t.source==="local"&&$e(r)&&De(e,n),r)}}const se=new Map;function Vt(e,t,n,o){const r=se.get(o);if(r)return r;const s=Bt(e,t,n,o,!0);return se.set(o,s),s.finally(()=>se.delete(o))}const me=new Set;function No(e,t,n){const o=P.c(8),r=z(),s=t?.orgSlug,i=t?.virtualMcpId,a=t?.branch;let c,l;o[0]!==e||o[1]!==a||o[2]!==n||o[3]!==s||o[4]!==r||o[5]!==i?(c=()=>{if(!e||!s||!i||!a)return;const u={orgSlug:s,virtualMcpId:i,branch:a};return po(f=>{f===n&&(me.has(n)||(me.add(n),Po(r,e,u,n).catch(Ro).finally(()=>me.delete(n))))})},l=[r,e,s,i,a,n],o[0]=e,o[1]=a,o[2]=n,o[3]=s,o[4]=r,o[5]=i,o[6]=c,o[7]=l):(c=o[6],l=o[7]),U.useEffect(c,l)}function Ro(){}async function Po(e,t,n,o){const r=se.get(o);return r&&await r.catch(()=>{}),Vt(e,t,n,o)}async function Bt(e,t,n,o,r){ee(e);const s=h.decofile(o),i=To(n,t),a=h.contentRevision(o),c=h.contentVersions(o),l=e.getQueryData(s),u=e.getQueryData(c),f=e.getQueryData(i),g=e.getQueryData(a)??void 0,d=t.source==="github"&&!f?ut(e,n.orgSlug,n.virtualMcpId):void 0,v=d?.isV8&&d.schema&&d.version?d:void 0,b=f??v?.schema,w=v?{...g,schemaVersion:v.version}:g,I=r&&l&&u?w?.revision:void 0,T=r&&b?w?.schemaVersion:void 0,x=h.contentChanges(o),C=e.getQueryData(x),[_,E,k]=await le(e,t,n,()=>t.client.batch([{method:"blocks.list",params:I?{ifNoneMatch:I}:{}},{method:"schema.get",params:T?{ifNoneMatch:T}:{}},{method:"changes.list",params:mt(C)}])),N=e.getQueryData(a)?.revision,p=N!==void 0&&N!==w?.revision;if(k?.ok){const X=p?null:Ee(C,k.result);X&&e.setQueryData(x,X)}else k&&t.source==="local"&&$e(k.error)&&De(e,n);if(!_?.ok)throw _?.error??new Error("no blocks.list");if(!E)throw new Error("no schema.get");const O=_.result,$=Dt(E),y=E.ok&&!$?E.result:null;if(O.notModified&&(!l||!u)||y?.notModified&&!b)return Bt(e,t,n,o,!1);const R=O.notModified?new Set:Co(e,n),j=O.notModified?l:Tn(O.blocks,l,R),M=$?_n():y?y.notModified?b:y.schema:E.error;if(e.setQueryData(a,{revision:p?N:O.notModified?w?.revision:O.revision,schemaVersion:y?y.notModified?w?.schemaVersion:y.version??void 0:void 0}),e.setQueryData(s,j),!O.notModified){const X=e.getQueryData(c),B={...O.versions};for(const A of R){const W=X?.[A];W!==void 0?B[A]=W:delete B[A]}e.setQueryData(c,B)}return M instanceof D||e.setQueryData(i,M),!p&&!O.notModified&&l&&w?.revision&&O.revision!==w.revision&&Eo({queryClient:e,orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,backend:t,cacheKey:o}),{blocks:j,meta:M}}async function xr(e,t,n,o,r,s){if(t.source==="github"){const a=[...Object.keys(r.set??{}),...r.delete??[]].filter(c=>!s||!Object.hasOwn(s,c));if(a.length>0)throw new Error(`A hosted save needs a precondition for every block it touches (missing: ${a.join(", ")})`)}return yo({queryClient:e,orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,backend:t,cacheKey:o},{kind:"edit",adopted:t.source==="github",write:async()=>{const i=await le(e,t,n,()=>t.client.blocksApply({set:r.set,delete:r.delete,...s?{ifMatch:s}:{}}));ee(e);const a=t.source==="github"?_o(e,n,o,i):i.revision;e.setQueryData(h.contentRevision(o),l=>({...l,revision:a}));const c=i.versions??{};return Je(e,o,c),{revision:a,versions:c}}})}function Ht(e,t){if(!(e instanceof D))return;const n=e.data?.draft;if(!n||typeof n!="object"||!Object.hasOwn(n,t))return;const o=n[t];return o&&typeof o.version=="string"?o:void 0}function Jt(e,t,n){if(!(n instanceof D))return;const o=n.data?.draft;if(!(!o||typeof o!="object"))for(const[r,s]of Object.entries(o))s===null&&ce(e,t,r,!1)}function Gt(e,t,n,o){ee(e);const r=o.block===null,s=e.getQueryData(h.contentVersions(t)),i=e.getQueryData(h.contentChanges(t)),a=i?K(i,n):void 0,c=a?a.baseVersion:s?.[n]??null;if(i){const l=F(n),u=Object.fromEntries(Object.entries(i.changes).filter(([f])=>F(f)!==l));r?c!==null&&(u[n]={kind:"delete",version:null,baseVersion:c}):u[n]={kind:"set",version:o.version,baseVersion:c},e.setQueryData(h.contentChanges(t),{...i,changes:u,edited:!0})}ce(e,t,n,r&&c===null),e.setQueryData(h.decofile(t),l=>{const u={...l};return r?delete u[n]:u[n]=o.block,u}),Je(e,t,{[n]:r?null:o.version})}function $r(e,t,n,o){if(t.source!=="github"||!(o instanceof D))return!1;Jt(e,n,o);const r=o.data?.draft;if(!r||typeof r!="object")return!1;const s=Object.keys(r),i=s.map(a=>Ht(o,a));return s.length===0||i.some(a=>a===void 0)?!1:(e.cancelQueries({queryKey:h.decofile(n)}),s.forEach((a,c)=>{Gt(e,n,a,i[c])}),!0)}async function jr(e,t,n,o,r,s){t.source==="github"&&Jt(e,o,s);const i=t.source==="github"?Ht(s,r):void 0;if(i)return e.cancelQueries({queryKey:h.decofile(o)}),Gt(e,o,r,i),!0;await e.invalidateQueries({queryKey:h.decofile(o)});let a;try{const l=(await le(e,t,n,()=>t.client.changesGet({names:[r]}))).entries[r];if(l&&l.after===null&&l.version!==null)return!1;a={value:l?.after??null,version:l?.version??null},t.source==="github"&&e.setQueryData(h.contentChanges(o),u=>{if(!u)return u;const f={...u.changes};return l?.kind?f[r]={kind:l.kind,version:l.version,baseVersion:l.baseVersion}:delete f[r],{...u,changes:f,edited:!0}})}catch{const c=await le(e,t,n,()=>t.client.blocksList({}));if(c.notModified)return!1;a={value:c.blocks[r]??null,version:c.versions[r]??null}}return e.setQueryData(h.decofile(o),c=>{const l={...c};return a.value===null?delete l[r]:l[r]=a.value,l}),Je(e,o,{[r]:a.version}),!1}function xo(e){const t=P.c(15),n=z();let o;t[0]!==e?.branch||t[1]!==e?.orgSlug||t[2]!==e?.virtualMcpId?(o=h.protocolDraftRead(e?.orgSlug??"",e?.virtualMcpId??"",e?.branch??""),t[0]=e?.branch,t[1]=e?.orgSlug,t[2]=e?.virtualMcpId,t[3]=o):o=t[3];let r;t[4]!==e||t[5]!==n?(r=async()=>{const d=await fetch(`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}`,{cache:"no-store",headers:ue("v8")});if(await Ne(d))throw Ce(n,e.orgSlug,e.virtualMcpId),new Re;if(!d.ok)throw new Error(`draft pointer read failed: ${d.status}`);return await d.json()},t[4]=e,t[5]=n,t[6]=r):r=t[6];const s=!!e;let i;t[7]!==o||t[8]!==r||t[9]!==s?(i={queryKey:o,queryFn:r,enabled:s,staleTime:Number.POSITIVE_INFINITY},t[7]=o,t[8]=r,t[9]=s,t[10]=i):i=t[10];const{data:a,isPending:c,isError:l}=L(i),u=!!e&&c&&!l;if(!e||!a?.draft||!a.version){let d;return t[11]!==u?(d={pointer:null,pending:u},t[11]=u,t[12]=d):d=t[12],d}const f=`${a.draft}@${a.version}`;let g;return t[13]!==f?(g={pointer:f,pending:!1},t[13]=f,t[14]=g):g=t[14],g}function Ar(e){return xo(e).pointer}function Lr(e){const t=P.c(4);let n;t[0]!==e?(n=h.contentRevision(e),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:$o,staleTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:r}=L(o);return r?.revision}async function $o(){throw new Error("content revisions are set by reads and writes")}function Te(e){const t=`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`;return e.protocolSuffix?`${t}${e.protocolSuffix}`:e.localPreviewUrl?`${t}:local:${e.localPreviewUrl}`:t}function Ur(e,t){return Te({...e,protocolSuffix:t.cacheKeySuffix})}function jo(e,t){const n=P.c(6),{url:o}=_t(e?.virtualMcpId),r=It(e?.virtualMcpId,e?.branch);if(!e)return"";let s;return n[0]!==r.cacheKeySuffix||n[1]!==r.kind||n[2]!==o||n[3]!==t?.tunnel||n[4]!==e?(s=r.kind==="protocol"?Te({...e,protocolSuffix:r.cacheKeySuffix}):Te({...e,localPreviewUrl:t?.tunnel===!1?null:o}),n[0]=r.cacheKeySuffix,n[1]=r.kind,n[2]=o,n[3]=t?.tunnel,n[4]=e,n[5]=s):s=n[5],s}function Mr(e,t){const n=P.c(39),{url:o,undecided:r}=_t(e?.virtualMcpId),s=!!o,i=It(e?.virtualMcpId,e?.branch),a=i.kind==="protocol"?i:null,c=jo(e),l=t?.fetchEnabled??!0,u=lo(e?.virtualMcpId),f=dt(e?.virtualMcpId).runtime==="cms",g=z();let d;n[0]!==c?(d=h.decofile(c),n[0]=c,n[1]=d):d=n[1];const v=d;No(a,a&&e?e:null,c);let b;n[2]!==e||n[3]!==g||n[4]!==v?(b=()=>{if(!e||g.isMutating({mutationKey:de(e.orgSlug,e.virtualMcpId,e.branch)})>0)return!0;const p=g.getQueryState(v);return p?.fetchStatus==="fetching"||Date.now()-(p?.dataUpdatedAt??0)<Ct/2},n[2]=e,n[3]=g,n[4]=v,n[5]=b):b=n[5];let w;n[6]!==f||n[7]!==s||n[8]!==e||n[9]!==a||n[10]!==g||n[11]!==v?(w=async()=>{if(e){if(!a&&f&&!s){const p=Wn(g,e)?.version;if(p&&!await Yn(e,p))return}await g.refetchQueries({queryKey:v,exact:!0},{cancelRefetch:!1})}},n[6]=f,n[7]=s,n[8]=e,n[9]=a,n[10]=g,n[11]=v,n[12]=w):w=n[12];let I;n[13]!==b||n[14]!==w?(I={skip:b,read:w},n[13]=b,n[14]=w,n[15]=I):I=n[15],to(!!t?.pollWhile&&!!e,I);let T;n[16]!==i.kind||n[17]!==f||n[18]!==l||n[19]!==c||n[20]!==s||n[21]!==o||n[22]!==u||n[23]!==e||n[24]!==a||n[25]!==g?(T=async()=>{if(a)return(await Vt(g,a,e,c)).blocks;if(i.kind==="unavailable")throw Do("decofile");if(s){const y=await fetch(new URL("/.decofile",o).toString(),{cache:"no-store"}).catch(Uo),R=y?.ok?it(await y.text()):null;if(R)return R;const j=new Error("decofile unavailable (local tunnel unreachable)");throw j.status=502,j}if(f)return Xn(g,e);const p=()=>co(e,Bn(u,".deco/blocks.gen.json"));if(l){const y=await fetch(so(e),{cache:"no-store"}).catch(Lo);if(y?.ok){const M=it(await y.text());if(M)return M}const R=await p();if(R.kind==="data")return R.data;const j=new Error(`Failed to fetch decofile: ${y?.status??"network error"}`);throw j.status=ct({liveOk:!!y?.ok,liveStatus:y?.status,committedAbsent:R.kind==="absent"}),j}const O=await p();if(O.kind==="data")return O.data;const $=new Error("decofile unavailable (preview down, no committed snapshot)");throw $.status=ct({liveOk:!1,committedAbsent:O.kind==="absent"}),$},n[16]=i.kind,n[17]=f,n[18]=l,n[19]=c,n[20]=s,n[21]=o,n[22]=u,n[23]=e,n[24]=a,n[25]=g,n[26]=T):T=n[26];const x=!!e&&i.kind!=="pending"&&!r,C=a?0:3e4,_=a?.describe.pollIntervalMs,E=a?"always":void 0;let k;n[27]!==f||n[28]!==s||n[29]!==a?(k=(p,O)=>{if(a||f||s)return p<3;const $=O.status;return $!==502&&$!==404&&p<2},n[27]=f,n[28]=s,n[29]=a,n[30]=k):k=n[30];let N;return n[31]!==v||n[32]!==T||n[33]!==x||n[34]!==C||n[35]!==_||n[36]!==E||n[37]!==k?(N={queryKey:v,queryFn:T,enabled:x,staleTime:C,refetchInterval:_,refetchIntervalInBackground:!1,refetchOnWindowFocus:E,retry:k,retryDelay:Ao},n[31]=v,n[32]=T,n[33]=x,n[34]=C,n[35]=_,n[36]=E,n[37]=k,n[38]=N):N=n[38],L(N)}function Ao(e){return fn(5e3,1e3,e,2,0)}function Lo(){return null}function Uo(){return null}const Mo="site-editor-save",Wt={id:Mo,description:void 0,action:void 0,cancel:void 0},Fr="site-editor-undo",Ie="site-editor-publish";function Fo(e){const t=P.c(7),{label:n,detail:o}=e;let r;t[0]!==n?(r=J.jsx("summary",{className:"cursor-pointer select-none text-muted-foreground",children:n}),t[0]=n,t[1]=r):r=t[1];let s;t[2]!==o?(s=J.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words font-mono text-muted-foreground",children:o}),t[2]=o,t[3]=s):s=t[3];let i;return t[4]!==r||t[5]!==s?(i=J.jsxs("details",{className:"mt-1 text-xs",children:[r,s]}),t[4]=r,t[5]=s,t[6]=i):i=t[6],i}function Yt(e,t){return t?J.jsx(Fo,{label:e("siteEditor.details"),detail:t}):void 0}function Qr(e,t,n){q.error(jt(e,t,n),{...Wt,description:Yt(e,uo(t,n))})}function Vr(e,t,n=!1){q.info(e(t?"sectionsEditor.reconcile.leftDeleted":"sectionsEditor.reconcile.keptTheirs"),{...Wt,description:e(t?n?"sectionsEditor.reconcile.leftDeletedNeverPublishedHint":"sectionsEditor.reconcile.leftDeletedHint":"sectionsEditor.reconcile.keptTheirsHint")})}const zt={action:void 0,duration:void 0};function Br(e,t){q.success(t?e("siteEditor.publish.publishedOn",{host:t}):e("siteEditor.publish.published"),{...zt,id:Ie,description:void 0})}function Hr(e,{headline:t,body:n,detail:o,retry:r,pending:s,tone:i="error"}){const a=Yt(e,o??null);q[i](t,{id:Ie,description:n&&a?J.jsxs(J.Fragment,{children:[J.jsx("p",{children:n}),a]}):n??a,action:r?{label:e("siteEditor.tryAgain"),onClick:c=>{c.preventDefault(),q.loading(s??e("thread.publishPopover.publishing"),{...zt,id:Ie,description:void 0}),r()}}:void 0,duration:r?Number.POSITIVE_INFINITY:void 0})}function Jr(e){return e instanceof Error?e.message||null:e==null?null:String(e)}export{Gn as $,Dr as A,ko as B,Tr as C,jo as D,Lr as E,Hn as F,de as G,yo as H,ao as I,Jn as J,Ur as K,er as L,nr as M,Vr as N,Rr as O,Or as P,Me as Q,kr as R,ar as S,Et as T,Po as U,Ve as V,xr as W,jr as X,Qr as Y,Nr as Z,To as _,lr as a,wr as a0,_r as a1,Pr as a2,fr as a3,mr as a4,tt as a5,nt as a6,pr as a7,cr as a8,ro as a9,D as aA,S as aB,yr as aC,gr as aa,Sn as ab,Yt as ac,Jr as ad,tr as ae,hn as af,Fo as ag,Vt as ah,Do as ai,Er as aj,co as ak,Be as al,$r as am,Ir as an,qo as ao,Ko as ap,$e as aq,Br as ar,br as as,Ar as at,Hr as au,Ie as av,zt as aw,Fr as ax,Wt as ay,Co as az,En as b,_t as c,wn as d,ir as e,yn as f,Ue as g,xe as h,bt as i,Sr as j,no as k,Mr as l,ur as m,vr as n,lo as o,or as p,Bn as q,sr as r,rr as s,kt as t,It as u,hr as v,Cr as w,dr as x,xo as y,G as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as te,a4 as se,q as ae,r as M,ad as ce,j as t,B as H,n as $,bB as de,a5 as me,aS as ue,aR as pe,aO as ge,aM as fe,aN as he,aQ as xe,aP as je,bm as ke,t as D,aD as ve,c as ie,l as ye,Z as Se,V as be,Y as we,X as Ce,K as q,gn as De}from"./index-DPkNYKa5.js";import{i as Ne}from"./DotsVertical-j299MAac.js";import{i as le,a as Pe}from"./ZoomOut-DTZMq4ec.js";import{s as Ae}from"./Trash01-9LW3o9Od.js";import{i as Ee}from"./Upload01-SFFN95fc.js";import{S as Me}from"./search-input-7E-QO74Y.js";import{S as Te}from"./search-toggle-hEtKUndC.js";import{E as V}from"./empty-state-pIEWUjEB.js";import{C as Oe}from"./collection-tabs-CKwBxfD2.js";import{p as Ie,S as Re,F as ze}from"./folder-icon-C3Wn1vYh.js";import{h as Fe,i as $e,r as _e}from"./use-org-fs-D0VDD62p.js";import{S as Le,H as Z,f as Be}from"./location-V0VwTJTt.js";import"./SearchMd-BioGEdMf.js";import"./icon-button-ClJD0L3L.js";import"./tooltip-BfYoKqk0.js";import"./index-C_R5zERo.js";import"./badge-Dr5W7Jnh.js";import"./markdown-D3LhMX0Q.js";import"./use-copy-Cej_IYzW.js";import"./Copy01-CsO5K9L8.js";import"./use-mobile-ay2r1OWx.js";import"./use-panel-navigate-DdFaM_vQ.js";import"./thread-route-BH-lovA8.js";import"./use-project-scope-wzIulhuH.js";import"./repository-binding-OOS1ijlF.js";import"./use-mcp-client-CHpaZaBV.js";import"./auth-B3EKpfKg.js";import"./file-preview-DS0klTmz.js";import"./utils-CcMIxuv4.js";import"./Image01-Cx8xJ-HQ.js";import"./editor-BnmY3rvS.js";import"./file-type-icon-D8ckqM0u.js";import"./useInfiniteQuery-CzD_itiC.js";import"./infiniteQueryObserver-CmDZfni1.js";const J=200,Ke=new Set(["node_modules","__pycache__"]);function G(s){const[,...e]=s.webkitRelativePath.split("/");return e.length>0?e.join("/"):s.name}function Qe(s){return G(s).split("/").every(e=>!e.startsWith(".")&&!Ke.has(e))}function qe(s){return s.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"skill"}function He(s,e){const l=new Map;for(const r of s){const c=G(r).split("/");c.pop();const a=["skills",e,...c].join("/");l.set(a,[...l.get(a)??[],r])}return l}async function Ge(s,e){const r=(await Promise.allSettled([...s].map(([c,a])=>e({dir:c,files:a})))).find(c=>c.status==="rejected");if(r)throw r.reason}function Ue(s,e){const l=Ie(e),r=`skills/${s}`;return{id:`home/${r}`,name:l.name??s,description:l.description,disableModelInvocation:l.disableModelInvocation,source:"home",volume:Z,path:r,sandboxPath:`${Le}/${Z}/${r}`}}const L="*";function B(s){return s.volume==="home"}function re(s,e){const l=s.indexOf(":");return l===-1?{label:e,glyph:le}:{label:s.slice(l+1),glyph:s.startsWith("repo:")?ve:Pe}}function Xe(s){const e=ie.c(48),{entry:l,pending:r,onOpen:c,onDelete:a}=s,o=te(),{org:m}=se();let S;e[0]!==l.source||e[1]!==m.name?(S=re(l.source,m.name),e[0]=l.source,e[1]=m.name,e[2]=S):S=e[2];const{label:T,glyph:O}=S;let I;e[3]!==l?(I=B(l),e[3]=l,e[4]=I):I=e[4];const z=I,R=r?"opacity-60":"hover:bg-accent";let u;e[5]!==R?(u=ye("relative transition-colors group overflow-hidden flex flex-col h-full",R),e[5]=R,e[6]=u):u=e[6];let f;e[7]!==l.name||e[8]!==c||e[9]!==r?(f=!r&&t.jsx("button",{type:"button",onClick:c,className:"absolute inset-0 z-0","aria-label":l.name}),e[7]=l.name,e[8]=c,e[9]=r,e[10]=f):f=e[10];const b=z?"default":"system",N=!z;let w;e[11]!==O||e[12]!==b||e[13]!==N?(w=t.jsx(ze,{glyph:O,tone:b,readOnly:N,className:"size-8 shrink-0"}),e[11]=O,e[12]=b,e[13]=N,e[14]=w):w=e[14];let h;e[15]!==a||e[16]!==o?(h=a&&t.jsx("div",{className:"relative z-10 pointer-events-auto transition-opacity sm:opacity-0 sm:group-hover:opacity-100",children:t.jsxs(Se,{children:[t.jsx(be,{asChild:!0,children:t.jsx(H,{variant:"ghost",size:"icon",children:t.jsx(Ne,{size:16})})}),t.jsx(we,{align:"end",children:t.jsxs(Ce,{variant:"destructive",onClick:K=>{K.stopPropagation(),a()},children:[t.jsx(Ae,{size:16}),o("settings.skills.deleteButton")]})})]})}),e[15]=a,e[16]=o,e[17]=h):h=e[17];let x;e[18]!==w||e[19]!==h?(x=t.jsxs("div",{className:"flex items-start justify-between",children:[w,h]}),e[18]=w,e[19]=h,e[20]=x):x=e[20];let j;e[21]!==l.name?(j=t.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:l.name}),e[21]=l.name,e[22]=j):j=e[22];let C;e[23]!==l.description||e[24]!==o?(C=l.description||o("settings.skills.noDescription"),e[23]=l.description,e[24]=o,e[25]=C):C=e[25];let k;e[26]!==C?(k=t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:C}),e[26]=C,e[27]=k):k=e[27];let d;e[28]!==j||e[29]!==k?(d=t.jsxs("div",{className:"flex flex-col gap-1",children:[j,k]}),e[28]=j,e[29]=k,e[30]=d):d=e[30];let v;e[31]!==x||e[32]!==d?(v=t.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[x,d]}),e[31]=x,e[32]=d,e[33]=v):v=e[33];let p;e[34]!==T||e[35]!==r||e[36]!==o?(p=r?o("settings.skills.importing"):T,e[34]=T,e[35]=r,e[36]=o,e[37]=p):p=e[37];let y;e[38]!==p?(y=t.jsx("div",{className:"border-t border-border mt-auto",children:t.jsx("div",{className:"h-10 flex items-center px-4.5",children:t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:p})})}),e[38]=p,e[39]=y):y=e[39];let g;e[40]!==v||e[41]!==y?(g=t.jsxs("div",{className:"flex flex-col flex-1 pointer-events-none",children:[v,y]}),e[40]=v,e[41]=y,e[42]=g):g=e[42];let P;return e[43]!==r||e[44]!==g||e[45]!==u||e[46]!==f?(P=t.jsxs(De,{size:"flush","aria-busy":r,className:u,children:[f,g]}),e[43]=r,e[44]=g,e[45]=u,e[46]=f,e[47]=P):P=e[47],P}function ee(s){const e=ie.c(2),{children:l}=s;let r;return e[0]!==l?(r=t.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:l}),e[0]=l,e[1]=r):r=e[1],r}function At(){const s=te(),{org:e}=se(),l=Fe(),{remove:r,upload:c}=$e("home"),a=ae(),o=M.useRef(null),[m,S]=M.useState(""),T=ce(),[O,I]=M.useState(L),[z,R]=M.useState(!1),[u,f]=M.useState(null),[b,N]=M.useState(null),[w,h]=M.useState(null),x=()=>{a.invalidateQueries({queryKey:q.slashSkills(e.id)}),a.invalidateQueries({queryKey:q.orgFsSkills(e.id)})},j=i=>a.setQueryData(q.slashSkills(e.id),n=>i(n??[]));async function C(i){const n=[...i??[]];if(o.current&&(o.current.value=""),n.length===0)return;const A=n[0]?.webkitRelativePath??"";if(!A){D.error(s("settings.skills.importNeedsFolder"));return}const Q=A.split("/")[0]??"",_=n.filter(Qe),X=_.find(E=>G(E)==="SKILL.md");if(!X){D.error(s("settings.skills.importMissingSkillMd"));return}if(_.length>J){D.error(s("settings.skills.importTooManyFiles",{count:String(_.length),max:String(J)}));return}const F=qe(Q),W=`skills/${F}`;let Y=!1;R(!0);try{if(await _e(e.slug,"home",W)){D.error(s("settings.skills.importSlugTaken",{slug:F}));return}Y=!0;const E=Ue(F,await X.text());j(oe=>[E,...oe]),h(E.id),await Ge(He(_,F),c.mutateAsync),D.success(s("settings.skills.importSuccess",{name:F}))}catch(E){Y&&await r.mutateAsync(W).catch(()=>{}),D.error(E instanceof Error?E.message:s("settings.skills.importError"))}finally{h(null),x(),R(!1)}}const k=m.toLowerCase(),d=(l.data??[]).filter(i=>i.name.toLowerCase().includes(k)||(i.description??"").toLowerCase().includes(k)).sort((i,n)=>Number(B(n))-Number(B(i))||i.name.localeCompare(n.name)),v=new Set((l.data??[]).map(i=>i.source)),p=new Map;for(const i of d)p.set(i.source,(p.get(i.source)??0)+1);const y=[{id:L,label:s("settings.skills.filterAll"),count:d.length},...[...v].map(i=>({id:i,label:re(i,e.name).label,count:p.get(i)??0}))],g=v.has(O)?O:L,P=g===L?d:d.filter(i=>i.source===g),K=i=>f(Be(i.volume,i.path)),ne=async()=>{if(!b)return;const{id:i,path:n}=b;N(null),j(A=>A.filter(Q=>Q.id!==i));try{await r.mutateAsync(n),D.success(s("settings.skills.deleteSuccess"))}catch(A){D.error(A instanceof Error?A.message:s("settings.skills.deleteError"))}finally{x()}},U=t.jsxs(H,{size:"sm",disabled:z,onClick:()=>o.current?.click(),children:[t.jsx(Ee,{size:14}),s(z?"settings.skills.importing":"settings.skills.importButton")]});return t.jsxs($,{children:[t.jsx($.Content,{children:t.jsx($.Container,{children:t.jsxs("div",{className:"flex flex-col gap-6",children:[T?t.jsx($.Actions,{secondary:t.jsx(Te,{value:m,onChange:S,label:s("library.context.search"),placeholder:s("settings.skills.searchPlaceholder"),clearLabel:s("library.library.clearSearch")}),children:U}):t.jsx($.Title,{actions:U,children:s("settings.skills.pageTitle")}),t.jsx("div",{className:"flex flex-wrap items-center justify-between gap-3 empty:hidden",children:!T&&t.jsx(Me,{value:m,onChange:S,placeholder:s("settings.skills.searchPlaceholder"),className:"w-full md:w-[375px]",onKeyDown:i=>{i.key==="Escape"&&(S(""),i.target.blur())}})}),t.jsx("input",{ref:o,type:"file",multiple:!0,webkitdirectory:"",className:"hidden",onChange:i=>{C(i.target.files)}}),y.length>2&&t.jsx(Oe,{placement:"page",tabs:y,activeTab:g,onTabChange:I}),l.isPending?t.jsx("div",{className:"@container",children:t.jsx(ee,{children:Array.from({length:8},(i,n)=>t.jsx(de,{className:"h-[168px] rounded-xl"},n))})}):l.isError?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx(V,{image:t.jsx(me,{size:48,className:"text-muted-foreground"}),title:s("settings.skills.errorTitle"),description:l.error instanceof Error?l.error.message:s("settings.skills.errorDescription"),actions:t.jsx(H,{size:"sm",variant:"outline",onClick:()=>{l.refetch()},children:s("settings.skills.retry")})})}):P.length===0?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx(V,{image:t.jsx(le,{size:48,className:"text-muted-foreground"}),title:s(m?"settings.skills.noResultsTitle":"settings.skills.emptyTitle"),description:m?s("settings.skills.noResultsDescription",{search:m}):s("settings.skills.emptyDescription"),actions:!1})}):t.jsx("div",{className:"@container",children:t.jsx(ee,{children:P.map(i=>{const n=i.id===w;return t.jsx(Xe,{entry:i,pending:n,onOpen:()=>K(i),onDelete:B(i)&&!n?()=>N(i):void 0},i.id)})})})]})})}),u&&t.jsx(Re,{skillPath:u,onClose:()=>f(null)},u),t.jsx(ue,{open:b!==null,onOpenChange:i=>!i&&N(null),children:t.jsxs(pe,{children:[t.jsxs(ge,{children:[t.jsx(fe,{children:s("settings.skills.deleteDialogTitle")}),t.jsx(he,{children:s("settings.skills.deleteDialogDescription",{name:b?.name??""})})]}),t.jsxs(xe,{children:[t.jsx(je,{children:s("settings.skills.cancel")}),t.jsx(ke,{onClick:ne,variant:"destructive",children:s("settings.skills.deleteButton")})]})]})})]})}export{At as default};
|
|
1
|
+
import{b as te,a4 as se,q as ae,r as M,ad as ce,j as t,B as H,n as $,bB as de,a5 as me,aS as ue,aR as pe,aO as ge,aM as fe,aN as he,aQ as xe,aP as je,bm as ke,t as D,aD as ve,c as ie,l as ye,Z as Se,V as be,Y as we,X as Ce,K as q,gn as De}from"./index-DlBqAQ8N.js";import{i as Ne}from"./DotsVertical-DGPGhZOp.js";import{i as le,a as Pe}from"./ZoomOut-DZO-NyFl.js";import{s as Ae}from"./Trash01-6fKruzF0.js";import{i as Ee}from"./Upload01-XEi-StK2.js";import{S as Me}from"./search-input-JrdzMOm_.js";import{S as Te}from"./search-toggle-wYGVtvVW.js";import{E as V}from"./empty-state-B6ZF6z6U.js";import{C as Oe}from"./collection-tabs-DysuRzTT.js";import{p as Ie,S as Re,F as ze}from"./folder-icon-D9KEEKgD.js";import{h as Fe,i as $e,r as _e}from"./use-org-fs-is3Nb4bW.js";import{S as Le,H as Z,f as Be}from"./location-V0VwTJTt.js";import"./SearchMd-LiFx-NKw.js";import"./icon-button-NEW9CrVR.js";import"./tooltip-CGDwEKla.js";import"./index-y2MV63Fm.js";import"./badge-D_XaqFCD.js";import"./markdown-DtVTVyIC.js";import"./use-copy-pG3Nq4mQ.js";import"./Copy01-BuXPB74z.js";import"./use-mobile-Ba8cwCW_.js";import"./use-panel-navigate-CXnDtexh.js";import"./thread-route-Bd56Ws2e.js";import"./use-project-scope-B0GTyJmy.js";import"./repository-binding-CcdmL6ag.js";import"./use-mcp-client-BTazWDn_.js";import"./auth-mUy8P9mz.js";import"./file-preview-B3fPhoS1.js";import"./utils-Cvz7JLdG.js";import"./Image01-C3eHO4JB.js";import"./editor-D54k8w6W.js";import"./file-type-icon-BSvWJ_yJ.js";import"./useInfiniteQuery-ID7ntuLj.js";import"./infiniteQueryObserver-B1X7cH_h.js";const J=200,Ke=new Set(["node_modules","__pycache__"]);function G(s){const[,...e]=s.webkitRelativePath.split("/");return e.length>0?e.join("/"):s.name}function Qe(s){return G(s).split("/").every(e=>!e.startsWith(".")&&!Ke.has(e))}function qe(s){return s.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"skill"}function He(s,e){const l=new Map;for(const r of s){const c=G(r).split("/");c.pop();const a=["skills",e,...c].join("/");l.set(a,[...l.get(a)??[],r])}return l}async function Ge(s,e){const r=(await Promise.allSettled([...s].map(([c,a])=>e({dir:c,files:a})))).find(c=>c.status==="rejected");if(r)throw r.reason}function Ue(s,e){const l=Ie(e),r=`skills/${s}`;return{id:`home/${r}`,name:l.name??s,description:l.description,disableModelInvocation:l.disableModelInvocation,source:"home",volume:Z,path:r,sandboxPath:`${Le}/${Z}/${r}`}}const L="*";function B(s){return s.volume==="home"}function re(s,e){const l=s.indexOf(":");return l===-1?{label:e,glyph:le}:{label:s.slice(l+1),glyph:s.startsWith("repo:")?ve:Pe}}function Xe(s){const e=ie.c(48),{entry:l,pending:r,onOpen:c,onDelete:a}=s,o=te(),{org:m}=se();let S;e[0]!==l.source||e[1]!==m.name?(S=re(l.source,m.name),e[0]=l.source,e[1]=m.name,e[2]=S):S=e[2];const{label:T,glyph:O}=S;let I;e[3]!==l?(I=B(l),e[3]=l,e[4]=I):I=e[4];const z=I,R=r?"opacity-60":"hover:bg-accent";let u;e[5]!==R?(u=ye("relative transition-colors group overflow-hidden flex flex-col h-full",R),e[5]=R,e[6]=u):u=e[6];let f;e[7]!==l.name||e[8]!==c||e[9]!==r?(f=!r&&t.jsx("button",{type:"button",onClick:c,className:"absolute inset-0 z-0","aria-label":l.name}),e[7]=l.name,e[8]=c,e[9]=r,e[10]=f):f=e[10];const b=z?"default":"system",N=!z;let w;e[11]!==O||e[12]!==b||e[13]!==N?(w=t.jsx(ze,{glyph:O,tone:b,readOnly:N,className:"size-8 shrink-0"}),e[11]=O,e[12]=b,e[13]=N,e[14]=w):w=e[14];let h;e[15]!==a||e[16]!==o?(h=a&&t.jsx("div",{className:"relative z-10 pointer-events-auto transition-opacity sm:opacity-0 sm:group-hover:opacity-100",children:t.jsxs(Se,{children:[t.jsx(be,{asChild:!0,children:t.jsx(H,{variant:"ghost",size:"icon",children:t.jsx(Ne,{size:16})})}),t.jsx(we,{align:"end",children:t.jsxs(Ce,{variant:"destructive",onClick:K=>{K.stopPropagation(),a()},children:[t.jsx(Ae,{size:16}),o("settings.skills.deleteButton")]})})]})}),e[15]=a,e[16]=o,e[17]=h):h=e[17];let x;e[18]!==w||e[19]!==h?(x=t.jsxs("div",{className:"flex items-start justify-between",children:[w,h]}),e[18]=w,e[19]=h,e[20]=x):x=e[20];let j;e[21]!==l.name?(j=t.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:l.name}),e[21]=l.name,e[22]=j):j=e[22];let C;e[23]!==l.description||e[24]!==o?(C=l.description||o("settings.skills.noDescription"),e[23]=l.description,e[24]=o,e[25]=C):C=e[25];let k;e[26]!==C?(k=t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:C}),e[26]=C,e[27]=k):k=e[27];let d;e[28]!==j||e[29]!==k?(d=t.jsxs("div",{className:"flex flex-col gap-1",children:[j,k]}),e[28]=j,e[29]=k,e[30]=d):d=e[30];let v;e[31]!==x||e[32]!==d?(v=t.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[x,d]}),e[31]=x,e[32]=d,e[33]=v):v=e[33];let p;e[34]!==T||e[35]!==r||e[36]!==o?(p=r?o("settings.skills.importing"):T,e[34]=T,e[35]=r,e[36]=o,e[37]=p):p=e[37];let y;e[38]!==p?(y=t.jsx("div",{className:"border-t border-border mt-auto",children:t.jsx("div",{className:"h-10 flex items-center px-4.5",children:t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:p})})}),e[38]=p,e[39]=y):y=e[39];let g;e[40]!==v||e[41]!==y?(g=t.jsxs("div",{className:"flex flex-col flex-1 pointer-events-none",children:[v,y]}),e[40]=v,e[41]=y,e[42]=g):g=e[42];let P;return e[43]!==r||e[44]!==g||e[45]!==u||e[46]!==f?(P=t.jsxs(De,{size:"flush","aria-busy":r,className:u,children:[f,g]}),e[43]=r,e[44]=g,e[45]=u,e[46]=f,e[47]=P):P=e[47],P}function ee(s){const e=ie.c(2),{children:l}=s;let r;return e[0]!==l?(r=t.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:l}),e[0]=l,e[1]=r):r=e[1],r}function At(){const s=te(),{org:e}=se(),l=Fe(),{remove:r,upload:c}=$e("home"),a=ae(),o=M.useRef(null),[m,S]=M.useState(""),T=ce(),[O,I]=M.useState(L),[z,R]=M.useState(!1),[u,f]=M.useState(null),[b,N]=M.useState(null),[w,h]=M.useState(null),x=()=>{a.invalidateQueries({queryKey:q.slashSkills(e.id)}),a.invalidateQueries({queryKey:q.orgFsSkills(e.id)})},j=i=>a.setQueryData(q.slashSkills(e.id),n=>i(n??[]));async function C(i){const n=[...i??[]];if(o.current&&(o.current.value=""),n.length===0)return;const A=n[0]?.webkitRelativePath??"";if(!A){D.error(s("settings.skills.importNeedsFolder"));return}const Q=A.split("/")[0]??"",_=n.filter(Qe),X=_.find(E=>G(E)==="SKILL.md");if(!X){D.error(s("settings.skills.importMissingSkillMd"));return}if(_.length>J){D.error(s("settings.skills.importTooManyFiles",{count:String(_.length),max:String(J)}));return}const F=qe(Q),W=`skills/${F}`;let Y=!1;R(!0);try{if(await _e(e.slug,"home",W)){D.error(s("settings.skills.importSlugTaken",{slug:F}));return}Y=!0;const E=Ue(F,await X.text());j(oe=>[E,...oe]),h(E.id),await Ge(He(_,F),c.mutateAsync),D.success(s("settings.skills.importSuccess",{name:F}))}catch(E){Y&&await r.mutateAsync(W).catch(()=>{}),D.error(E instanceof Error?E.message:s("settings.skills.importError"))}finally{h(null),x(),R(!1)}}const k=m.toLowerCase(),d=(l.data??[]).filter(i=>i.name.toLowerCase().includes(k)||(i.description??"").toLowerCase().includes(k)).sort((i,n)=>Number(B(n))-Number(B(i))||i.name.localeCompare(n.name)),v=new Set((l.data??[]).map(i=>i.source)),p=new Map;for(const i of d)p.set(i.source,(p.get(i.source)??0)+1);const y=[{id:L,label:s("settings.skills.filterAll"),count:d.length},...[...v].map(i=>({id:i,label:re(i,e.name).label,count:p.get(i)??0}))],g=v.has(O)?O:L,P=g===L?d:d.filter(i=>i.source===g),K=i=>f(Be(i.volume,i.path)),ne=async()=>{if(!b)return;const{id:i,path:n}=b;N(null),j(A=>A.filter(Q=>Q.id!==i));try{await r.mutateAsync(n),D.success(s("settings.skills.deleteSuccess"))}catch(A){D.error(A instanceof Error?A.message:s("settings.skills.deleteError"))}finally{x()}},U=t.jsxs(H,{size:"sm",disabled:z,onClick:()=>o.current?.click(),children:[t.jsx(Ee,{size:14}),s(z?"settings.skills.importing":"settings.skills.importButton")]});return t.jsxs($,{children:[t.jsx($.Content,{children:t.jsx($.Container,{children:t.jsxs("div",{className:"flex flex-col gap-6",children:[T?t.jsx($.Actions,{secondary:t.jsx(Te,{value:m,onChange:S,label:s("library.context.search"),placeholder:s("settings.skills.searchPlaceholder"),clearLabel:s("library.library.clearSearch")}),children:U}):t.jsx($.Title,{actions:U,children:s("settings.skills.pageTitle")}),t.jsx("div",{className:"flex flex-wrap items-center justify-between gap-3 empty:hidden",children:!T&&t.jsx(Me,{value:m,onChange:S,placeholder:s("settings.skills.searchPlaceholder"),className:"w-full md:w-[375px]",onKeyDown:i=>{i.key==="Escape"&&(S(""),i.target.blur())}})}),t.jsx("input",{ref:o,type:"file",multiple:!0,webkitdirectory:"",className:"hidden",onChange:i=>{C(i.target.files)}}),y.length>2&&t.jsx(Oe,{placement:"page",tabs:y,activeTab:g,onTabChange:I}),l.isPending?t.jsx("div",{className:"@container",children:t.jsx(ee,{children:Array.from({length:8},(i,n)=>t.jsx(de,{className:"h-[168px] rounded-xl"},n))})}):l.isError?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx(V,{image:t.jsx(me,{size:48,className:"text-muted-foreground"}),title:s("settings.skills.errorTitle"),description:l.error instanceof Error?l.error.message:s("settings.skills.errorDescription"),actions:t.jsx(H,{size:"sm",variant:"outline",onClick:()=>{l.refetch()},children:s("settings.skills.retry")})})}):P.length===0?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx(V,{image:t.jsx(le,{size:48,className:"text-muted-foreground"}),title:s(m?"settings.skills.noResultsTitle":"settings.skills.emptyTitle"),description:m?s("settings.skills.noResultsDescription",{search:m}):s("settings.skills.emptyDescription"),actions:!1})}):t.jsx("div",{className:"@container",children:t.jsx(ee,{children:P.map(i=>{const n=i.id===w;return t.jsx(Xe,{entry:i,pending:n,onOpen:()=>K(i),onDelete:B(i)&&!n?()=>N(i):void 0},i.id)})})})]})})}),u&&t.jsx(Re,{skillPath:u,onClose:()=>f(null)},u),t.jsx(ue,{open:b!==null,onOpenChange:i=>!i&&N(null),children:t.jsxs(pe,{children:[t.jsxs(ge,{children:[t.jsx(fe,{children:s("settings.skills.deleteDialogTitle")}),t.jsx(he,{children:s("settings.skills.deleteDialogDescription",{name:b?.name??""})})]}),t.jsxs(xe,{children:[t.jsx(je,{children:s("settings.skills.cancel")}),t.jsx(ke,{onClick:ne,variant:"destructive",children:s("settings.skills.deleteButton")})]})]})})]})}export{At as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as _,l as N,j}from"./index-
|
|
1
|
+
import{c as _,l as N,j}from"./index-DlBqAQ8N.js";import{T as k,R as z,a as D,b as S}from"./index-Bah4YwbV.js";function V(T){const e=_.c(41);let i,t,n,s,c,b,g,o,r,a;e[0]!==T?({className:i,defaultValue:t,value:a,min:b,max:g,onPointerDown:s,onKeyDown:n,thumbLabel:o,thumbValueText:r,...c}=T,e[0]=T,e[1]=i,e[2]=t,e[3]=n,e[4]=s,e[5]=c,e[6]=b,e[7]=g,e[8]=o,e[9]=r,e[10]=a):(i=e[1],t=e[2],n=e[3],s=e[4],c=e[5],b=e[6],g=e[7],o=e[8],r=e[9],a=e[10]);const d=b===void 0?0:b,u=g===void 0?100:g;let p;e[11]!==t||e[12]!==u||e[13]!==d||e[14]!==a?(p=Array.isArray(a)?a:Array.isArray(t)?t:[d,u],e[11]=t,e[12]=u,e[13]=d,e[14]=a,e[15]=p):p=e[15];const A=p;let f;e[16]!==i?(f=N("relative flex w-full touch-none items-center py-2 select-none data-[disabled]:opacity-50 data-[orientation=vertical]:px-2 data-[orientation=vertical]:py-0 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",i),e[16]=i,e[17]=f):f=e[17];let m;e[18]!==s?(m=l=>{l.currentTarget.dataset.pointer="",s?.(l)},e[18]=s,e[19]=m):m=e[19];let h;e[20]!==n?(h=l=>{delete l.currentTarget.dataset.pointer,n?.(l)},e[20]=n,e[21]=h):h=e[21];let x;e[22]===Symbol.for("react.memo_cache_sentinel")?(x=N("bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1"),e[22]=x):x=e[22];let w;e[23]===Symbol.for("react.memo_cache_sentinel")?(w=j.jsx(k,{"data-slot":"slider-track",className:x,children:j.jsx(z,{"data-slot":"slider-range",className:N("bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full")})}),e[23]=w):w=e[23];let v;if(e[24]!==A.length||e[25]!==o||e[26]!==r){let l;e[28]!==o||e[29]!==r?(l=(E,R)=>j.jsx(S,{"data-slot":"slider-thumb",...o!==void 0?{"aria-label":o}:{},...r!==void 0?{"aria-valuetext":r}:{},className:"relative block size-4 shrink-0 cursor-grab rounded-full bg-white shadow-edge transition-transform duration-150 after:absolute after:-inset-3 after:rounded-full after:content-[''] hover:scale-110 focus-ring in-data-pointer:outline-none! active:scale-110 active:cursor-grabbing disabled:pointer-events-none motion-reduce:transition-none"},R),e[28]=o,e[29]=r,e[30]=l):l=e[30],v=Array.from({length:A.length},l),e[24]=A.length,e[25]=o,e[26]=r,e[27]=v}else v=e[27];let y;return e[31]!==t||e[32]!==u||e[33]!==d||e[34]!==c||e[35]!==f||e[36]!==m||e[37]!==h||e[38]!==v||e[39]!==a?(y=j.jsxs(D,{"data-slot":"slider",defaultValue:t,value:a,min:d,max:u,className:f,...c,onPointerDown:m,onKeyDown:h,children:[w,v]}),e[31]=t,e[32]=u,e[33]=d,e[34]=c,e[35]=f,e[36]=m,e[37]=h,e[38]=v,e[39]=a,e[40]=y):y=e[40],y}export{V as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as v,fc as K}from"./index-
|
|
1
|
+
import{r as v,fc as K}from"./index-DlBqAQ8N.js";import{d as de,e as fe,f as U,g as ge,h as pe,i as be,j as ve,C as Y,k as he,l as y,m as me,n as xe,o as Ie,s as ye}from"./core.esm-8ysL4nmy.js";function q(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Re(e,t){return e.reduce((n,r,s)=>{const a=t.get(r);return a&&(n[s]=a),n},Array(e.length))}function O(e){return e!==null&&e>=0}function Ce(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function we(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const B=e=>{let{rects:t,activeIndex:n,overIndex:r,index:s}=e;const a=q(t,r,n),o=t[s],c=a[s];return!c||!o?null:{x:c.left-o.left,y:c.top-o.top,scaleX:c.width/o.width,scaleY:c.height/o.height}},L={scaleX:1,scaleY:1},Xe=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:s,rects:a,overIndex:o}=e;const c=(t=a[n])!=null?t:r;if(!c)return null;if(s===n){const u=a[o];return u?{x:0,y:n<o?u.top+u.height-(c.top+c.height):u.top-c.top,...L}:null}const f=De(a,s,n);return s>n&&s<=o?{x:0,y:-c.height-f,...L}:s<n&&s>=o?{x:0,y:c.height+f,...L}:{x:0,y:0,...L}};function De(e,t,n){const r=e[t],s=e[t-1],a=e[t+1];return r?n<t?s?r.top-(s.top+s.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):s?r.top-(s.top+s.height):0:0}const H="Sortable",V=K.createContext({activeIndex:-1,containerId:H,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:B,disabled:{draggable:!1,droppable:!1}});function _e(e){let{children:t,id:n,items:r,strategy:s=B,disabled:a=!1}=e;const{active:o,dragOverlay:c,droppableRects:f,over:u,measureDroppableContainers:i}=de(),l=fe(H,n),d=c.rect!==null,g=v.useMemo(()=>r.map(I=>typeof I=="object"&&"id"in I?I.id:I),[r]),R=o!=null,C=o?g.indexOf(o.id):-1,h=u?g.indexOf(u.id):-1,w=v.useRef(g),x=!Ce(g,w.current),m=h!==-1&&C===-1||x,b=we(a);U(()=>{x&&R&&i(g)},[x,g,R,i]),v.useEffect(()=>{w.current=g},[g]);const D=v.useMemo(()=>({activeIndex:C,containerId:l,disabled:b,disableTransforms:m,items:g,overIndex:h,useDragOverlay:d,sortedRects:Re(g,f),strategy:s}),[C,l,b.draggable,b.droppable,m,g,h,f,d,s]);return K.createElement(V.Provider,{value:D},t)}const Se=e=>{let{id:t,items:n,activeIndex:r,overIndex:s}=e;return q(n,r,s).indexOf(t)},Ae=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:s,items:a,newIndex:o,previousItems:c,previousContainerId:f,transition:u}=e;return!u||!r||c!==a&&s===o?!1:n?!0:o!==s&&t===f},Te={duration:200,easing:"ease"},J="transform",Ee=Y.Transition.toString({property:J,duration:0,easing:"linear"}),Ne={roleDescription:"sortable"};function Oe(e){let{disabled:t,index:n,node:r,rect:s}=e;const[a,o]=v.useState(null),c=v.useRef(n);return U(()=>{if(!t&&n!==c.current&&r.current){const f=s.current;if(f){const u=he(r.current,{ignoreTransform:!0}),i={x:f.left-u.left,y:f.top-u.top,scaleX:f.width/u.width,scaleY:f.height/u.height};(i.x||i.y)&&o(i)}}n!==c.current&&(c.current=n)},[t,n,r,s]),v.useEffect(()=>{a&&o(null)},[a]),a}function je(e){let{animateLayoutChanges:t=Ae,attributes:n,disabled:r,data:s,getNewIndex:a=Se,id:o,strategy:c,resizeObserverConfig:f,transition:u=Te}=e;const{items:i,containerId:l,activeIndex:d,disabled:g,disableTransforms:R,sortedRects:C,overIndex:h,useDragOverlay:w,strategy:x}=v.useContext(V),m=Le(r,g),b=i.indexOf(o),D=v.useMemo(()=>({sortable:{containerId:l,index:b,items:i},...s}),[l,s,b,i]),I=v.useMemo(()=>i.slice(i.indexOf(o)),[i,o]),{rect:N,node:z,isOver:W,setNodeRef:P}=ge({id:o,data:D,disabled:m.droppable,resizeObserverConfig:{updateMeasurementsFor:I,...f}}),{active:T,activatorEvent:Z,activeNodeRect:ee,attributes:te,setNodeRef:X,listeners:re,isDragging:M,over:ne,setActivatorNodeRef:se,transform:oe}=pe({id:o,data:D,attributes:{...Ne,...n},disabled:m.draggable}),ae=be(P,X),S=!!T,_=S&&!R&&O(d)&&O(h),j=!w&&M,F=j&&_?oe:null,ie=_?F??(c??x)({rects:C,activeNodeRect:ee,activeIndex:d,overIndex:h,index:b}):null,E=O(d)&&O(h)?a({id:o,items:i,activeIndex:d,overIndex:h}):b,A=T?.id,p=v.useRef({activeId:A,items:i,newIndex:E,containerId:l}),ce=i!==p.current.items,G=t({active:T,containerId:l,isDragging:M,isSorting:S,id:o,index:b,items:i,newIndex:p.current.newIndex,previousItems:p.current.items,previousContainerId:p.current.containerId,transition:u,wasDragging:p.current.activeId!=null}),$=Oe({disabled:!G,index:b,node:z,rect:N});return v.useEffect(()=>{S&&p.current.newIndex!==E&&(p.current.newIndex=E),l!==p.current.containerId&&(p.current.containerId=l),i!==p.current.items&&(p.current.items=i)},[S,E,l,i]),v.useEffect(()=>{if(A===p.current.activeId)return;if(A!=null&&p.current.activeId==null){p.current.activeId=A;return}const ue=setTimeout(()=>{p.current.activeId=A},50);return()=>clearTimeout(ue)},[A]),{active:T,activeIndex:d,attributes:te,data:D,rect:N,index:b,newIndex:E,items:i,isOver:W,isSorting:S,isDragging:M,listeners:re,node:z,overIndex:h,over:ne,setNodeRef:ae,setActivatorNodeRef:se,setDroppableNodeRef:P,setDraggableNodeRef:X,transform:$??ie,transition:le()};function le(){if($||ce&&p.current.newIndex===b)return Ee;if(!(j&&!ve(Z)||!u)&&(S||G))return Y.Transition.toString({...u,property:J})}}function Le(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}function k(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const ke=[y.Down,y.Right,y.Up,y.Left],Fe=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:s,droppableContainers:a,over:o,scrollableAncestors:c}}=t;if(ke.includes(e.code)){if(e.preventDefault(),!n||!r)return;const f=[];a.getEnabled().forEach(l=>{if(!l||l!=null&&l.disabled)return;const d=s.get(l.id);if(d)switch(e.code){case y.Down:r.top<d.top&&f.push(l);break;case y.Up:r.top>d.top&&f.push(l);break;case y.Left:r.left>d.left&&f.push(l);break;case y.Right:r.left<d.left&&f.push(l);break}});const u=me({collisionRect:r,droppableRects:s,droppableContainers:f});let i=xe(u,"id");if(i===o?.id&&u.length>1&&(i=u[1].id),i!=null){const l=a.get(n.id),d=a.get(i),g=d?s.get(d.id):null,R=d?.node.current;if(R&&g&&l&&d){const h=Ie(R).some((I,N)=>c[N]!==I),w=Q(l,d),x=Me(l,d),m=h||!w?{x:0,y:0}:{x:x?r.width-g.width:0,y:x?r.height-g.height:0},b={x:g.left,y:g.top};return m.x&&m.y?b:ye(b,m)}}}};function Q(e,t){return!k(e)||!k(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Me(e,t){return!k(e)||!k(t)||!Q(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}export{_e as S,q as a,B as r,Fe as s,je as u,Xe as v};
|