decocms 4.531.0 → 4.532.1
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-CUGYcOGt.js → ActiveShapeUtils-DnnbFg2w.js} +1 -1
- package/dist/client/assets/{AlertCircle-C0U53qC5.js → AlertCircle-JaYuCWTa.js} +1 -1
- package/dist/client/assets/{AreaChart-vwsYBH1z.js → AreaChart-BztD6Eot.js} +1 -1
- package/dist/client/assets/{ArrowLeft-BVJNIiuT.js → ArrowLeft-BhJEaZ6B.js} +1 -1
- package/dist/client/assets/{ArrowUp-BnowdRj-.js → ArrowUp-YrAe3vgd.js} +1 -1
- package/dist/client/assets/{BarChart-CwsIHr2J.js → BarChart-Dm2oPqJS.js} +1 -1
- package/dist/client/assets/{Building02-CcI-P3yL.js → Building02-CTmcVqQj.js} +1 -1
- package/dist/client/assets/{CartesianChart-Cwfb2Obv.js → CartesianChart-tumrCcCW.js} +1 -1
- package/dist/client/assets/{CategoricalChart-CukPvNkf.js → CategoricalChart-BqKIQcdM.js} +1 -1
- package/dist/client/assets/{CheckCircle-fAPMl2yd.js → CheckCircle-9jHhe24P.js} +1 -1
- package/dist/client/assets/{ChevronSelectorVertical-C-CIIDml.js → ChevronSelectorVertical-CfW1Wzms.js} +1 -1
- package/dist/client/assets/{ChevronUp-BMY88wXt.js → ChevronUp-D-7vQNVy.js} +1 -1
- package/dist/client/assets/{Copy01-DGy0Absz.js → Copy01-DP6tJ3a3.js} +1 -1
- package/dist/client/assets/{CreditCard01-DsjBhiEj.js → CreditCard01-7YXzWPmu.js} +1 -1
- package/dist/client/assets/{DotsVertical-Bfe9a_On.js → DotsVertical-BSeiVg8O.js} +1 -1
- package/dist/client/assets/{ErrorBarContext-hs9d9Up0.js → ErrorBarContext-DeFYEXHx.js} +1 -1
- package/dist/client/assets/{Globe04-B-sNlZxN.js → Globe04-BkUhGI83.js} +1 -1
- package/dist/client/assets/{Image01-DtpDUrwF.js → Image01-DLqdm992.js} +1 -1
- package/dist/client/assets/{Key01-DifqnYu0.js → Key01-o_hEpYwc.js} +1 -1
- package/dist/client/assets/{Link01-oZZyGItc.js → Link01-DDso2VpB.js} +1 -1
- package/dist/client/assets/{LinkBroken01-BZrnscWF.js → LinkBroken01-C29KKpU0.js} +1 -1
- package/dist/client/assets/{Minus-Dc5wow6R.js → Minus-B--8kp5j.js} +1 -1
- package/dist/client/assets/{Monitor01-Bmn1BV5T.js → Monitor01-BtDUnSZq.js} +1 -1
- package/dist/client/assets/{Play-IViIK9Vy.js → Play-jy1YZ7pj.js} +1 -1
- package/dist/client/assets/{Plus-Bh_xMwh7.js → Plus-4tdoOfzh.js} +1 -1
- package/dist/client/assets/{ReferenceLine-DDRDnZWn.js → ReferenceLine-rf71t8Wf.js} +1 -1
- package/dist/client/assets/{SearchMd-DB3np2ti.js → SearchMd-J2Rjic9V.js} +1 -1
- package/dist/client/assets/{Sector-BbL3mZ4i.js → Sector-Bh4QFYl4.js} +1 -1
- package/dist/client/assets/{ShoppingBag01-BaMIB-e_.js → ShoppingBag01-jE2k9Z1o.js} +1 -1
- package/dist/client/assets/{Sun-BZlKwpGn.js → Sun-CGNTymUo.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-fMsLFMs0.js → SwitchHorizontal01-CLXZKY70.js} +1 -1
- package/dist/client/assets/{Tool01-CTKnipD_.js → Tool01-DvOyfmVC.js} +1 -1
- package/dist/client/assets/{Trash01-BqP8uw7k.js → Trash01-CGaWZsc5.js} +1 -1
- package/dist/client/assets/{Upload01-CpPArzNK.js → Upload01-CXqGRfor.js} +1 -1
- package/dist/client/assets/{UserSquare-D4xudMmb.js → UserSquare-DV1XZOY6.js} +1 -1
- package/dist/client/assets/{Users01-buCmBl1X.js → Users01-CpHvZIR7.js} +1 -1
- package/dist/client/assets/{XClose-D48r2tDo.js → XClose-DWQXqdSq.js} +1 -1
- package/dist/client/assets/{ZoomOut-BVuJZ-2t.js → ZoomOut-BMZKrcTE.js} +1 -1
- package/dist/client/assets/{access-gate-DBOVcx9J.js → access-gate-D7ByZ05F.js} +1 -1
- package/dist/client/assets/{add-connection-dialog-o9V9M7_d.js → add-connection-dialog-BAfMm3u3.js} +1 -1
- package/dist/client/assets/agent-analytics-50v2bvbj.js +2 -0
- package/dist/client/assets/agent-app-q2vsC-My.js +1 -0
- package/dist/client/assets/agent-assets-BFfp1GZa.js +1 -0
- package/dist/client/assets/{agent-automation-ChlL7V0d.js → agent-automation-cMZeN9lm.js} +2 -2
- package/dist/client/assets/agent-automations-C1kW6Kjy.js +1 -0
- package/dist/client/assets/agent-calendar-36AOb9o-.js +1 -0
- package/dist/client/assets/agent-connect-sources-DPOLWSPQ.js +1 -0
- package/dist/client/assets/agent-deck-2j6MNhuy.js +1 -0
- package/dist/client/assets/agent-e2e-BAUU5S3t.js +1 -0
- package/dist/client/assets/agent-experiments-DilSMM1e.js +1 -0
- package/dist/client/assets/agent-file-CVc7OTSX.js +1 -0
- package/dist/client/assets/agent-hosting-B3kgszkl.js +1 -0
- package/dist/client/assets/{agent-icon-B7Q7dFXY.js → agent-icon-B6DURSl_.js} +1 -1
- package/dist/client/assets/agent-library-C4-tevIK.js +1 -0
- package/dist/client/assets/agent-library-file-CXzcuEPO.js +1 -0
- package/dist/client/assets/agent-monitor-Bic-xfUm.js +1 -0
- package/dist/client/assets/agent-overview-B-K4tgsN.js +1 -0
- package/dist/client/assets/agent-releases-Cg8gdPI4.js +2 -0
- package/dist/client/assets/agent-settings-BTPWu4VN.js +1 -0
- package/dist/client/assets/agent-site-editor-code-43f6TRaT.js +2 -0
- package/dist/client/assets/agent-site-editor-content-CDIxjk4q.js +1 -0
- package/dist/client/assets/agent-site-editor-preview-DMRQM-LG.js +1 -0
- package/dist/client/assets/{agent-site-editor-C0ubqGd6.js → agent-site-editor-wbhemRqk.js} +2 -2
- package/dist/client/assets/agent-view-CN7cv0Ow.js +1 -0
- package/dist/client/assets/{agent-view-guard-CzZjL776.js → agent-view-guard-B65FxQSG.js} +1 -1
- package/dist/client/assets/{agents-list-ImvzEVvr.js → agents-list-C2lNfvq5.js} +1 -1
- package/dist/client/assets/{ai-providers-Bw8nDtTM.js → ai-providers-yeci77cM.js} +1 -1
- package/dist/client/assets/{alert-CHj-Usrj.js → alert-ByYqnTt4.js} +1 -1
- package/dist/client/assets/{analytics-sections-CGcyhwwe.js → analytics-sections-D6yo_AiZ.js} +1 -1
- package/dist/client/assets/api-keys-DLBTiE6h.js +1 -0
- package/dist/client/assets/{api-keys-DSNlUnpn.js → api-keys-MpEUcu1P.js} +1 -1
- package/dist/client/assets/app-editor-BJbxwtPb.js +1 -0
- package/dist/client/assets/{asset-utils-BvYMWLJK.js → asset-utils-B_sH3eAw.js} +1 -1
- package/dist/client/assets/{auth-fndLm_KR.js → auth-DDIbIEWU.js} +1 -1
- package/dist/client/assets/{auth-catchall-Yn8u2UhP.js → auth-catchall-C0vPJ0YF.js} +1 -1
- package/dist/client/assets/{auth-entry-DF0YJ4h7.js → auth-entry-JIA29m1g.js} +1 -1
- package/dist/client/assets/{auth-split-layout-NNmGhYbT.js → auth-split-layout-C9ufzfNF.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-D7QWYyhR.js → authenticate-and-persist-oauth-Cinc5wU_.js} +1 -1
- package/dist/client/assets/{automation-list-row-CTExE_83.js → automation-list-row-D_MyMSDf.js} +1 -1
- package/dist/client/assets/{automation-runs-BO9rScSe.js → automation-runs-BYeHhogm.js} +1 -1
- package/dist/client/assets/{automations-CHWjvK4W.js → automations-ZXkIniXI.js} +1 -1
- package/dist/client/assets/{autosend-VKc1dW3G.js → autosend-CeHYNB5a.js} +1 -1
- package/dist/client/assets/{badge-AFOqFwvQ.js → badge-DCdHHENd.js} +1 -1
- package/dist/client/assets/{block-document-C22TRUSp.js → block-document-u0VXgZsH.js} +1 -1
- package/dist/client/assets/{blocks-preview-workspace-context-Dd8qSyOR.js → blocks-preview-workspace-context-MSwutMpe.js} +1 -1
- package/dist/client/assets/{blocks-tab-states-BUek9Urr.js → blocks-tab-states-D7FXIYa1.js} +1 -1
- package/dist/client/assets/{blog-schema-DclHtzEx.js → blog-schema-Cj9I5QvS.js} +1 -1
- package/dist/client/assets/{buckets-Dq_X_gmQ.js → buckets-Ebvh16O2.js} +1 -1
- package/dist/client/assets/{build-improve-prompt-doc-Pe8zfELh.js → build-improve-prompt-doc-MHEVAUpp.js} +1 -1
- package/dist/client/assets/{calendar-BZJL1q0i.js → calendar-DGPEnw4y.js} +1 -1
- package/dist/client/assets/{capability-load-error-Bn9e6-bb.js → capability-load-error-xTGz1O0J.js} +1 -1
- package/dist/client/assets/category-editor-iiVXVslv.js +1 -0
- package/dist/client/assets/{cdn-tab-CJ55RYwI.js → cdn-tab-GR3G6uO2.js} +1 -1
- package/dist/client/assets/{chart-bf024hGa.js → chart-DGgWZa8N.js} +1 -1
- package/dist/client/assets/{chat-context-BI1yxU4R.js → chat-context-EryBIl5y.js} +1 -1
- package/dist/client/assets/{chat-draft-B9Sz9SQX.js → chat-draft-C77KukAJ.js} +1 -1
- package/dist/client/assets/{checkbox-BGiVnH_E.js → checkbox-DanWxFDQ.js} +1 -1
- package/dist/client/assets/{choose-editor-BpSB586s.js → choose-editor-DRItQK1g.js} +1 -1
- package/dist/client/assets/{cli-auth-success-CDHZN1Zi.js → cli-auth-success-CbPQDWie.js} +1 -1
- package/dist/client/assets/{client-icons-FDKXeHgM.js → client-icons-DM34aWEC.js} +1 -1
- package/dist/client/assets/cms-settings-editor-CMB6VNMa.js +1 -0
- package/dist/client/assets/{collapsible-B5J2aUd-.js → collapsible-Bxf6Tjj8.js} +1 -1
- package/dist/client/assets/collection-detail-Bh4I2YYV.js +1 -0
- package/dist/client/assets/{collection-display-button-VDPf0fxx.js → collection-display-button-DKZVrqVY.js} +1 -1
- package/dist/client/assets/{collection-search-B_n3Ea8A.js → collection-search-oriFbOeS.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-Dms92TX1.js → collection-table-wrapper-Cx4DeYH2.js} +1 -1
- package/dist/client/assets/{collection-tabs-CRfyt8-K.js → collection-tabs-B-KXu_oD.js} +1 -1
- package/dist/client/assets/{column-rules-C7sxa0a0.js → column-rules-CQFnitOu.js} +1 -1
- package/dist/client/assets/{combobox-BBB78IeP.js → combobox-Cwzc08sq.js} +1 -1
- package/dist/client/assets/{command-jlI8eprh.js → command-BPRmBGhB.js} +1 -1
- package/dist/client/assets/{companion-mcps-section-C8ZRnbHV.js → companion-mcps-section-CXlo7Sbg.js} +1 -1
- package/dist/client/assets/{config-CEPjuV4B.js → config-nwVLBXQV.js} +1 -1
- package/dist/client/assets/{connect-D7sTLKym.js → connect-CybWYqFY.js} +1 -1
- package/dist/client/assets/{connect-layout-DEhdoMeD.js → connect-layout-E0TTDMsw.js} +1 -1
- package/dist/client/assets/{connect-source-dialog-CTDwzNbD.js → connect-source-dialog-2r0XpaoA.js} +1 -1
- package/dist/client/assets/{connection-_BLwZIho.js → connection-DyDIuEks.js} +1 -1
- package/dist/client/assets/{connection-card-DOb0qtir.js → connection-card-vYaDrRUO.js} +1 -1
- package/dist/client/assets/{connection-detail-6FLkb2KJ.js → connection-detail-WxSnF4zc.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-Do-juNEt.js → connection-form-helpers-BQJcmj4C.js} +1 -1
- package/dist/client/assets/{connections-m8uo2l1C.js → connections-DusfKLJp.js} +1 -1
- package/dist/client/assets/{content-tab-CxqGwsRS.js → content-tab-CdSmdOT_.js} +3 -3
- package/dist/client/assets/context-Cz086QIc.js +1 -0
- package/dist/client/assets/{context-menu-Ckmk21Ru.js → context-menu-gpaAOtWJ.js} +1 -1
- package/dist/client/assets/{context-shell-7YO8Ahul.js → context-shell-CPyOecQG.js} +3 -3
- package/dist/client/assets/{core.esm-CfGX-VCE.js → core.esm-XMSb_Uka.js} +1 -1
- package/dist/client/assets/{create-organization-dialog-Byea9wm5.js → create-organization-dialog-B46HiNm0.js} +1 -1
- package/dist/client/assets/{daily-pulse-DWbRk6Tj.js → daily-pulse-D6u_wQB-.js} +1 -1
- package/dist/client/assets/discover-Dwa3grGi.js +1 -0
- package/dist/client/assets/{domain-settings-D4GbzAgH.js → domain-settings-CZcl4K1o.js} +1 -1
- package/dist/client/assets/{drawer-9GcYCTZT.js → drawer-C3PrA-n8.js} +1 -1
- package/dist/client/assets/{editor-CVSwKg6T.js → editor-BI9MEm45.js} +1 -1
- package/dist/client/assets/{editor-classes-Dkk1S2M6.js → editor-classes-Di69nj2G.js} +1 -1
- package/dist/client/assets/{empty-state-CUanQ9Sm.js → empty-state-r_5Rd0dc.js} +1 -1
- package/dist/client/assets/{empty-state-BdJInz6a.js → empty-state-tJsREuj4.js} +1 -1
- package/dist/client/assets/{experiments-tab-NqV4EeCU.js → experiments-tab-D83vgaBk.js} +1 -1
- package/dist/client/assets/{experiments-tab-choice-D5E9lbe8.js → experiments-tab-choice-_FBZoLPZ.js} +1 -1
- package/dist/client/assets/{extract-connection-data-BH85Ecx-.js → extract-connection-data-CAX0s-U5.js} +1 -1
- package/dist/client/assets/{feature-gate-BaIBNMzy.js → feature-gate-CIVRuSL-.js} +1 -1
- package/dist/client/assets/{feature-paywall-BIJDHy8g.js → feature-paywall-B0ICgL5J.js} +1 -1
- package/dist/client/assets/file-explorer-CAwP6yms.js +2 -0
- package/dist/client/assets/{file-preview-DVCjmYnL.js → file-preview-BS2w8KBn.js} +1 -1
- package/dist/client/assets/{file-share-button-B0trNLFa.js → file-share-button-DVQqivw6.js} +1 -1
- package/dist/client/assets/{file-type-icon-CLdhbOMq.js → file-type-icon-D-goE4ev.js} +1 -1
- package/dist/client/assets/{folder-icon-B4yVMgUj.js → folder-icon-Dh0obbUY.js} +1 -1
- package/dist/client/assets/{form-DmKuBQlJ.js → form-BrmBomQx.js} +1 -1
- package/dist/client/assets/{general-CzhpbJkY.js → general-6Gb6L9hc.js} +1 -1
- package/dist/client/assets/{held-block-view-BCUOCB3X.js → held-block-view-ZDteU5Jg.js} +3 -3
- package/dist/client/assets/home-Yx3qRIo8.js +1 -0
- package/dist/client/assets/{hosted-publish-feedback-BX6h3oNP.js → hosted-publish-feedback-D-NyDy_o.js} +1 -1
- package/dist/client/assets/{icon-button-Rp_ZDDhs.js → icon-button-B8gYI46y.js} +1 -1
- package/dist/client/assets/{index-CPu0T3g-.js → index-B_ZSRZ_1.js} +1 -1
- package/dist/client/assets/{index-B-980lL8.js → index-BieOo250.js} +1 -1
- package/dist/client/assets/{index-CzZ16hae.js → index-CVukLLDd.js} +1 -1
- package/dist/client/assets/{index-_MLEN3sq.js → index-CXN_y45N.js} +1 -1
- package/dist/client/assets/{index-C8YP0XfX.js → index-CgM7-Ro8.js} +8 -8
- package/dist/client/assets/{index-DG18LLWo.js → index-DCM5dVSL.js} +1 -1
- package/dist/client/assets/{index-DJmej5q-.js → index-DIKRwX1p.js} +1 -1
- package/dist/client/assets/{index-DJxkEvYw.js → index-DRBnjYGA.js} +1 -1
- package/dist/client/assets/{index-Q6SZwjyp.js → index-DapED80K.js} +2 -2
- package/dist/client/assets/{index-C6KhNCz4.js → index-Dps1wO3D.js} +1 -1
- package/dist/client/assets/{index-CjhVW3Ft.js → index-KTP6c0cL.js} +1 -1
- package/dist/client/assets/{index-Dc2A9bLg.js → index-SVmnnfb6.js} +1 -1
- package/dist/client/assets/{index-EfujrlRm.js → index-_4PHXujT.js} +1 -1
- package/dist/client/assets/{index-B0Rg86vv.js → index-bs2MyHCY.js} +1 -1
- package/dist/client/assets/{index-BM9HifS6.js → index-cvu6NM2y.js} +1 -1
- package/dist/client/assets/{index-redirect-uK6MukHm.js → index-redirect-DS6jhnWT.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-C8Tx1h_G.js → infiniteQueryObserver-DOIcndov.js} +1 -1
- package/dist/client/assets/{infra-billing-XXUCrKTj.js → infra-billing-BvdZetjK.js} +1 -1
- package/dist/client/assets/{input-DRaRHcY2.js → input-Cdb_NhY5.js} +1 -1
- package/dist/client/assets/{input-DjstRX-_.js → input-DVTIG9aC.js} +3 -3
- package/dist/client/assets/{integration-icon-03FWmed-.js → integration-icon-Do2Y8hkm.js} +1 -1
- package/dist/client/assets/{jira-icon-Dwf32Q1t.js → jira-icon-WOhDyJEG.js} +1 -1
- package/dist/client/assets/{label-BZDtWIcv.js → label-DOI4IEwy.js} +1 -1
- package/dist/client/assets/{layout-rILzLvlD.js → layout-Bghhk_lp.js} +1 -1
- package/dist/client/assets/{legacy-agents-deep-BASczG03.js → legacy-agents-deep-DxTjI0nW.js} +1 -1
- package/dist/client/assets/{legacy-main-redirect-BJoW2swu.js → legacy-main-redirect-BNntnJG2.js} +1 -1
- package/dist/client/assets/library-BXV44tew.js +1 -0
- package/dist/client/assets/{login-9fIx9llO.js → login-CCI0hYyU.js} +1 -1
- package/dist/client/assets/{markdown-DuoP9xIE.js → markdown-BwxTuGGG.js} +1 -1
- package/dist/client/assets/{mcp-app-renderer-DWv_y82s.js → mcp-app-renderer-BoiACXPd.js} +1 -1
- package/dist/client/assets/{mcp-oauth-CsfxxKaN.js → mcp-oauth-CZ9GqXPF.js} +1 -1
- package/dist/client/assets/{mcp-oauth-D-fSN__A.js → mcp-oauth-ysipa0ke.js} +1 -1
- package/dist/client/assets/{members-DLnkLpsh.js → members-C7ZgCgdf.js} +1 -1
- package/dist/client/assets/{memory-4CHY9Qs2.js → memory-BJg93AJ_.js} +1 -1
- package/dist/client/assets/{mini-report-page-MBlPP32_.js → mini-report-page-CG2TDLWW.js} +1 -1
- package/dist/client/assets/{mock-board-BtdGtIDb.js → mock-board-6S3zrVza.js} +3 -3
- package/dist/client/assets/{monaco-editor-a3IVCcn2.js → monaco-editor-Bu-nU7NV.js} +1 -1
- package/dist/client/assets/monitoring-CtNDQEFC.js +1 -0
- package/dist/client/assets/{monitoring-stats-row-DBelPaxz.js → monitoring-stats-row-D1_4aDPs.js} +1 -1
- package/dist/client/assets/{multi-select-082YyRUR.js → multi-select-B4032GRo.js} +1 -1
- package/dist/client/assets/{mustache-BBa51FCf.js → mustache-DKd8K2vx.js} +1 -1
- package/dist/client/assets/{named-rule-uses-Yzjx02p5.js → named-rule-uses-BR4TO_up.js} +1 -1
- package/dist/client/assets/{new-project-dialog-BuE_SqTn.js → new-project-dialog-DVfPsfG1.js} +1 -1
- package/dist/client/assets/{oauth-callback-DDoefwF9.js → oauth-callback-N9-z1VuP.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-C9SrnNuM.js → oauth-callback-ai-provider-CNfO_rYc.js} +1 -1
- package/dist/client/assets/{onboarding-DSfiLpX3.js → onboarding-De-qOZCj.js} +1 -1
- package/dist/client/assets/{openai-conversation-sk-C_Dmb.js → openai-conversation-CnC0P3bR.js} +1 -1
- package/dist/client/assets/{optimistic-project-sidebar-views-DJIKQ8kN.js → optimistic-project-sidebar-views-D1QEaYtv.js} +1 -1
- package/dist/client/assets/order-monitor-day-BeeQrZ5U.js +1 -0
- package/dist/client/assets/{organization-choice-BnprMn5W.js → organization-choice-CKs_iAfO.js} +1 -1
- package/dist/client/assets/{orgs-BwLgPyhv.js → orgs-Dxmpwmqc.js} +1 -1
- package/dist/client/assets/{page-seo-form-DcpwPyQd.js → page-seo-form-B6ZA1fPy.js} +1 -1
- package/dist/client/assets/{pair-DEJAc3iG.js → pair-BqbhOYo8.js} +1 -1
- package/dist/client/assets/{parse-sections-B8Xcvgnu.js → parse-sections-D0EeXwVX.js} +1 -1
- package/dist/client/assets/plan-Do0NrPLf.js +1 -0
- package/dist/client/assets/{plan-ladder-B0TVgJ_-.js → plan-ladder-DeIr-j94.js} +1 -1
- package/dist/client/assets/{popover-C0DIKe_3.js → popover-Cdnki_Jg.js} +1 -1
- package/dist/client/assets/post-calendar-BqMsyhtW.js +1 -0
- package/dist/client/assets/{post-editor-BAL8WHQL.js → post-editor-d8_PR6QG.js} +2 -2
- package/dist/client/assets/{preview-content-4PKjfy6d.js → preview-content-Cfp4wBHT.js} +1 -1
- package/dist/client/assets/{preview-dialog-B5Sh6VdD.js → preview-dialog-u-q_Yxod.js} +1 -1
- package/dist/client/assets/{preview-panel-CdgtAcKr.js → preview-panel-4HZDowIC.js} +1 -1
- package/dist/client/assets/{preview-tab-W7cmZoDH.js → preview-tab-DpIMbT0D.js} +3 -3
- package/dist/client/assets/{product-picker-dialog-BMgJeJTt.js → product-picker-dialog-CGoJkeHX.js} +1 -1
- package/dist/client/assets/{profile-BGrTACfK.js → profile-CuY7TVPf.js} +1 -1
- package/dist/client/assets/project-app-view-BgPENTJM.js +1 -0
- package/dist/client/assets/{project-apps-CTDjuD3G.js → project-apps-ZVTNnGHs.js} +1 -1
- package/dist/client/assets/{project-feed-BoWXBRyy.js → project-feed-Cnu5Nxao.js} +1 -1
- package/dist/client/assets/{project-icon-BSrEdWN1.js → project-icon-DEP8iT8r.js} +1 -1
- package/dist/client/assets/project-reports-Btx8fcRg.js +1 -0
- package/dist/client/assets/project-tasks-bvOCC5Gl.js +1 -0
- package/dist/client/assets/{projects-BN2XX-Mk.js → projects-DIeDg7rY.js} +1 -1
- package/dist/client/assets/{projects-empty-state-DE8FaVtJ.js → projects-empty-state-_30UcQ-M.js} +1 -1
- package/dist/client/assets/{prompts-CPwtUzza.js → prompts-C8DmbO-y.js} +1 -1
- package/dist/client/assets/record-editor-DfuGKIDN.js +1 -0
- package/dist/client/assets/redirect-editor-B83cyyW5.js +1 -0
- package/dist/client/assets/{releases-api-DGMi80FZ.js → releases-api-A66gUQIn.js} +1 -1
- package/dist/client/assets/{reports-DqVaZWmt.js → reports-CeKHgkOO.js} +1 -1
- package/dist/client/assets/reports-DeV24_Fp.js +1 -0
- package/dist/client/assets/{reports-onboarding-D7aXc-w2.js → reports-onboarding-rU86pVPG.js} +1 -1
- package/dist/client/assets/reports-tab-bOaRq3nR.js +2 -0
- package/dist/client/assets/{repositories-BdofaJQO.js → repositories-BUtVqCtn.js} +1 -1
- package/dist/client/assets/repositories-DWr_TbLg.js +1 -0
- package/dist/client/assets/{repository-binding-B-4PI1n3.js → repository-binding-8UNd4La0.js} +1 -1
- package/dist/client/assets/{repository-import-picker-BfMMau5M.js → repository-import-picker-OrJw3cIo.js} +1 -1
- package/dist/client/assets/{repository-picker-CbWFb7rK.js → repository-picker-B6a9ep3b.js} +1 -1
- package/dist/client/assets/{require-capability-C7aMGT2m.js → require-capability-Csx90zSZ.js} +1 -1
- package/dist/client/assets/{required-auth-layout-ofmCqqpc.js → required-auth-layout-BZmUgBgt.js} +1 -1
- package/dist/client/assets/{reset-password-VX3IBezM.js → reset-password-C1H9wzkd.js} +1 -1
- package/dist/client/assets/{resizable-KZ7XhVXp.js → resizable-CsaiXEtB.js} +1 -1
- package/dist/client/assets/{resolve-tab-icon-BZyAXpM2.js → resolve-tab-icon-DxDkByKs.js} +1 -1
- package/dist/client/assets/{review-settings-BmkypttR.js → review-settings-CbZWzVpV.js} +1 -1
- package/dist/client/assets/roles-C9WHdgOh.js +1 -0
- package/dist/client/assets/route-DWqde3k7.js +1 -0
- package/dist/client/assets/route-Df2Rj5Mk.js +1 -0
- package/dist/client/assets/route-RNnMRdq9.js +1 -0
- package/dist/client/assets/{sandbox-lifecycle-context-DQ3bjzwr.js → sandbox-lifecycle-context-BmK0O-xa.js} +1 -1
- package/dist/client/assets/{schema-nUWXGpCy.js → schema-BrrH5ge3.js} +1 -1
- package/dist/client/assets/{schema-CFje17_E.js → schema-OwOGrcTc.js} +1 -1
- package/dist/client/assets/{scroll-area-BSd3TrLZ.js → scroll-area-C4hgiBjt.js} +1 -1
- package/dist/client/assets/{search-input-CIT_dMpA.js → search-input-BfxNf6mK.js} +1 -1
- package/dist/client/assets/{search-toggle-BYErJl4G.js → search-toggle-7CRkYA1R.js} +1 -1
- package/dist/client/assets/{secret-picker-CczM3F7L.js → secret-picker-Bo5RqPwz.js} +1 -1
- package/dist/client/assets/{secrets-DGc21qBv.js → secrets-3UTWqvR9.js} +1 -1
- package/dist/client/assets/{section-array-field-CWeYHp0D.js → section-array-field-Osne9SXG.js} +1 -1
- package/dist/client/assets/{sections-f1UrHc1E.js → sections-B7_NO_TB.js} +1 -1
- package/dist/client/assets/sections-editor-DU3Z2daJ.js +1 -0
- package/dist/client/assets/{select-EVDcG5Hl.js → select-CYUfZrWy.js} +1 -1
- package/dist/client/assets/{select-model-CxALqwJ6.js → select-model-BR-Mi2X4.js} +1 -1
- package/dist/client/assets/seo-editor-hcPJdZCF.js +1 -0
- package/dist/client/assets/{separator-Czsq0Xe-.js → separator-D_EWmGgU.js} +1 -1
- package/dist/client/assets/settings-tab-8Q8MqCBu.js +1 -0
- package/dist/client/assets/{sheet-ko7a2Uwq.js → sheet-CSTtais0.js} +1 -1
- package/dist/client/assets/shell-layout-Dt3eq6Qk.js +1 -0
- package/dist/client/assets/{site-draft-actions-PtNrOTTk.js → site-draft-actions-D58qwd26.js} +1 -1
- package/dist/client/assets/{site-draft-view-Bnegh8Bv.js → site-draft-view-Lvj7mU3Q.js} +2 -2
- package/dist/client/assets/site-editor-Bm2O7VhS.js +1 -0
- package/dist/client/assets/{site-editor-toast-D9ddy9a_.js → site-editor-toast-BOx376JN.js} +1 -1
- package/dist/client/assets/{skills-CZmhtPN_.js → skills-BBpw_E_H.js} +1 -1
- package/dist/client/assets/{slider-Bg5y5q23.js → slider-DykoTN1q.js} +1 -1
- package/dist/client/assets/{sortable.esm-Bk2g_Gbz.js → sortable.esm-BcgCBEfW.js} +1 -1
- package/dist/client/assets/{sso-Bb3b2KOU.js → sso-_T_doDYh.js} +1 -1
- package/dist/client/assets/{suggestion-Bl_JrZPN.js → suggestion-B4JccI3N.js} +1 -1
- package/dist/client/assets/{switch-DbWQrL2t.js → switch-gUlNntL4.js} +1 -1
- package/dist/client/assets/{symbol-DLC3ejqz.js → symbol-CFT02IQk.js} +1 -1
- package/dist/client/assets/{synced-repos-CIyIp6th.js → synced-repos-CLGShc-C.js} +1 -1
- package/dist/client/assets/{tab-icon-glyph-D22-rmWX.js → tab-icon-glyph-DkR9ySmC.js} +1 -1
- package/dist/client/assets/{table-CIbHZF2_.js → table-DEOdYXzp.js} +1 -1
- package/dist/client/assets/{tabs-BbA4-8ma.js → tabs-CDXYpFRp.js} +1 -1
- package/dist/client/assets/{task-assignee-avatar-8Sp4Z4mk.js → task-assignee-avatar-DsUwmfw7.js} +1 -1
- package/dist/client/assets/{task-board-u5TablbK.js → task-board-boVYnzry.js} +1 -1
- package/dist/client/assets/{task-route-B7ChywKT.js → task-route-C59ybgrH.js} +1 -1
- package/dist/client/assets/{task-status-Ch8fGpdY.js → task-status-BtlC9VFV.js} +1 -1
- package/dist/client/assets/taskboard-analytics-DcngoptN.js +1 -0
- package/dist/client/assets/{tasks-B-1EpIoB.js → tasks-BNYUWZ7R.js} +1 -1
- package/dist/client/assets/tasks-DpeQyqR3.js +1 -0
- package/dist/client/assets/{textarea-BeCs38v-.js → textarea-CKsCKFLy.js} +1 -1
- package/dist/client/assets/thread-analytics-u7unmd3i.js +1 -0
- package/dist/client/assets/{thread-intent-Cl7xa7dA.js → thread-intent-DRdPtaf2.js} +1 -1
- package/dist/client/assets/{thread-route-BCRCqPZe.js → thread-route-BZRksnHH.js} +1 -1
- package/dist/client/assets/{thread-route-JcxEqRgq.js → thread-route-Dn9lxS6O.js} +1 -1
- package/dist/client/assets/{thread-sheet-body-BZhXd8vN.js → thread-sheet-body-C8RRj0Rt.js} +1 -1
- package/dist/client/assets/{time-range-picker-D99DN923.js → time-range-picker-Dhg4t_pK.js} +1 -1
- package/dist/client/assets/{toggle-group-CWnjwOku.js → toggle-group-DxXcbqbT.js} +1 -1
- package/dist/client/assets/{tool-namespace-ChbHxLTp.js → tool-namespace-B8XtAn-5.js} +1 -1
- package/dist/client/assets/{toolbar-icon-button-BUMG5B6x.js → toolbar-icon-button-BnmGAbB7.js} +1 -1
- package/dist/client/assets/{tooltip-CJHeHoSn.js → tooltip-BFkmafQU.js} +1 -1
- package/dist/client/assets/{tooltipContext-CL92GCVz.js → tooltipContext-CdLg2pG8.js} +1 -1
- package/dist/client/assets/{track-B2jTEYXL.js → track-ClUeJJYD.js} +1 -1
- package/dist/client/assets/{types-Cwtot2FB.js → types-DdyZFVjB.js} +1 -1
- package/dist/client/assets/{url-slug-Dxr7jq0i.js → url-slug-C8ETdBcF.js} +1 -1
- package/dist/client/assets/{usage-stats-CNcWehA3.js → usage-stats-0AsfjkwI.js} +1 -1
- package/dist/client/assets/{use-ai-providers-DzWzPq_c.js → use-ai-providers-3poZythL.js} +1 -1
- package/dist/client/assets/{use-apply-named-rule-QplWW5Pw.js → use-apply-named-rule-CVBNS4ep.js} +1 -1
- package/dist/client/assets/{use-automations-DO79ln3M.js → use-automations-VlRh2Wqi.js} +1 -1
- package/dist/client/assets/{use-autosave-Bz5jGLfF.js → use-autosave-DO1QHpHp.js} +1 -1
- package/dist/client/assets/{use-chat-layout-state-DIXRUqxC.js → use-chat-layout-state-Dw5fxydL.js} +1 -1
- package/dist/client/assets/{use-clock-tick-DxI4Q15z.js → use-clock-tick-DYb0Yqfo.js} +1 -1
- package/dist/client/assets/{use-cms-publish-actions-B4udZvVh.js → use-cms-publish-actions-B9zJNLow.js} +1 -1
- package/dist/client/assets/{use-connect-companion--zaBR_LA.js → use-connect-companion-BsdLzWgT.js} +1 -1
- package/dist/client/assets/{use-connection-ClhLV4Ep.js → use-connection-DF35j1XL.js} +1 -1
- package/dist/client/assets/{use-copy-BCht-61u.js → use-copy-CS6Ta5ka.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-8KmID2cx.js → use-create-virtual-mcp-DqDO6PGs.js} +1 -1
- package/dist/client/assets/{use-date-fns-locale-U4hMTG7h.js → use-date-fns-locale-BW0Kg-s0.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-ffUOSkED.js → use-debounced-autosave-BdsEnVek.js} +1 -1
- package/dist/client/assets/{use-debounced-value-ZtANdTDD.js → use-debounced-value-BwY4UFXK.js} +1 -1
- package/dist/client/assets/{use-deco-credits-D7afhnU-.js → use-deco-credits-D_52syYI.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-hbubA99f.js → use-decopilot-events-pkzCwwKp.js} +1 -1
- package/dist/client/assets/{use-delete-connection-bB2dgA1j.js → use-delete-connection-CSBLVjvy.js} +1 -1
- package/dist/client/assets/{use-deployment-admin-Cjac4tJB.js → use-deployment-admin-MTxNhHb9.js} +1 -1
- package/dist/client/assets/{use-fast-preview-draft-url-CoOfoUO_.js → use-fast-preview-draft-url-gEHohveI.js} +1 -1
- package/dist/client/assets/{use-file-configs-DI3WjDeq.js → use-file-configs-DQ3f-Q5P.js} +1 -1
- package/dist/client/assets/{use-inbox-feed-SND00l1M.js → use-inbox-feed-CACu8jgO.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-CuF9Fnt8.js → use-infinite-scroll-DQ9VVP8_.js} +1 -1
- package/dist/client/assets/{use-join-requests-BwDlu4Gp.js → use-join-requests-v6GW4T6a.js} +1 -1
- package/dist/client/assets/{use-main-panel-tabs-D5k7CyBc.js → use-main-panel-tabs-C3tLSafV.js} +1 -1
- package/dist/client/assets/{use-mcp-auth-status-BwPujbq3.js → use-mcp-auth-status-OhVQpQzs.js} +1 -1
- package/dist/client/assets/{use-mcp-client-CkAT8dMu.js → use-mcp-client-Bl_ZkfjH.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-BoifdA0D.js → use-mcp-prompts-Bvk5GzsH.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-CIUeYaBw.js → use-mcp-tools-CCzyb7_q.js} +1 -1
- package/dist/client/assets/{use-mobile-tv6dKHC3.js → use-mobile-DWwy0G1s.js} +1 -1
- package/dist/client/assets/{use-move-blocks-BaNRn466.js → use-move-blocks-ssPS8eLc.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-BiKQMaG5.js → use-navigate-to-agent-C1cUtbF5.js} +1 -1
- package/dist/client/assets/{use-open-billing-url-6v7Ht1P5.js → use-open-billing-url-BBnKa__h.js} +1 -1
- package/dist/client/assets/{use-org-fs-ao97Epgk.js → use-org-fs-ByPpnYSO.js} +1 -1
- package/dist/client/assets/{use-org-repo-syncs-DOPL9gym.js → use-org-repo-syncs-Dgj11JRA.js} +1 -1
- package/dist/client/assets/{use-org-sso-BK4EESlq.js → use-org-sso-lLtOH9c9.js} +1 -1
- package/dist/client/assets/{use-organization-roles-CohiN23I.js → use-organization-roles-BxqRa1uL.js} +1 -1
- package/dist/client/assets/{use-organization-settings-6EqlUT2Y.js → use-organization-settings-nbIrzOgF.js} +1 -1
- package/dist/client/assets/{use-panel-navigate-CTWNyrxK.js → use-panel-navigate-BzdcqjSS.js} +1 -1
- package/dist/client/assets/{use-project-native-view-presence-B6fZ68Vq.js → use-project-native-view-presence-z6ElNhcQ.js} +1 -1
- package/dist/client/assets/{use-project-scope-BgLQY0Uk.js → use-project-scope-CPYcIvTW.js} +1 -1
- package/dist/client/assets/{use-recent-apps-Bpx38utr.js → use-recent-apps-B1qEqr2V.js} +1 -1
- package/dist/client/assets/{use-releases-t7sfkrxl.js → use-releases-BM0WbDv5.js} +1 -1
- package/dist/client/assets/{use-reports-diagnostic-B3Bb0bBM.js → use-reports-diagnostic-DC431ajk.js} +1 -1
- package/dist/client/assets/{use-sandbox-events-Ccm6tkYH.js → use-sandbox-events-Yfi6UXbb.js} +1 -1
- package/dist/client/assets/{use-secrets-Cu0JnUiZ.js → use-secrets-CFuBmzkS.js} +1 -1
- package/dist/client/assets/{use-section-preview-base-DFCMtdhN.js → use-section-preview-base-CZXn_b0c.js} +1 -1
- package/dist/client/assets/{use-session-runtime-pkeEtIbf.js → use-session-runtime-BQ8nqerw.js} +1 -1
- package/dist/client/assets/{use-sidebar-collapsed-BwFu6Qgg.js → use-sidebar-collapsed-DpVze00L.js} +1 -1
- package/dist/client/assets/{use-tags-M_iZ_HOI.js → use-tags-DAonMHtN.js} +1 -1
- package/dist/client/assets/{use-task-board-analytics-BjOmg5HS.js → use-task-board-analytics-ClDqF56t.js} +1 -1
- package/dist/client/assets/{use-task-board-events-DGIxUFSu.js → use-task-board-events-BZgY7EAa.js} +1 -1
- package/dist/client/assets/{use-task-board-item-prs-BHe2zSmu.js → use-task-board-item-prs-C6S2DydN.js} +1 -1
- package/dist/client/assets/{use-task-metadata-D2I0K9KW.js → use-task-metadata-tY7yqfRb.js} +1 -1
- package/dist/client/assets/{use-thread-analytics-Bq-Ku2nN.js → use-thread-analytics-C7m6ingu.js} +1 -1
- package/dist/client/assets/{use-thread-outputs-am5Vd3rC.js → use-thread-outputs-gO4YyAPs.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-D5ei_KuQ.js +1 -0
- package/dist/client/assets/{useQueries-Chr0IN_s.js → useQueries-BpncSGWZ.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-BzA-SXDa.js +1 -0
- package/dist/client/assets/{users-CfXhQF2t.js → users-CpQ2UVWD.js} +1 -1
- package/dist/client/assets/{utils-Chh_XkCj.js → utils-BKDVVXZB.js} +1 -1
- package/dist/client/assets/{variant-calendar-DXW-UB5g.js → variant-calendar-Je9UX6h9.js} +1 -1
- package/dist/client/assets/{variant-matcher-override-DV7ZKzex.js → variant-matcher-override-CMA8M4Ll.js} +1 -1
- package/dist/client/assets/{view-header-ECu4qrb6.js → view-header-Cq5PRRNl.js} +1 -1
- package/dist/client/assets/{virtual-mcp-2K3oYMwm.js → virtual-mcp-BqhVfWuq.js} +1 -1
- package/dist/client/assets/{watch-sse-pool-B-0VhxE7.js → watch-sse-pool-DfTC9EXk.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/server.js +748 -715
- package/package.json +1 -1
- package/dist/client/assets/agent-analytics-37IFZCDX.js +0 -1
- package/dist/client/assets/agent-app-Br31NfCV.js +0 -1
- package/dist/client/assets/agent-assets-OoRFrJh4.js +0 -1
- package/dist/client/assets/agent-automations-CFZ5G-rN.js +0 -1
- package/dist/client/assets/agent-calendar-C-B6ze0O.js +0 -1
- package/dist/client/assets/agent-connect-sources-tJUoo5_M.js +0 -1
- package/dist/client/assets/agent-deck-W1uVi0Qe.js +0 -1
- package/dist/client/assets/agent-e2e-BJxS0re0.js +0 -1
- package/dist/client/assets/agent-experiments-DOcx29VX.js +0 -1
- package/dist/client/assets/agent-file-C9s_RWk1.js +0 -1
- package/dist/client/assets/agent-hosting-Bn-lQ-QN.js +0 -1
- package/dist/client/assets/agent-library-BSF2E1JT.js +0 -1
- package/dist/client/assets/agent-library-file-auwmTzQK.js +0 -1
- package/dist/client/assets/agent-monitor-DvzxtFAJ.js +0 -1
- package/dist/client/assets/agent-overview-BQZTWcdd.js +0 -1
- package/dist/client/assets/agent-releases-BbYl9Mwf.js +0 -2
- package/dist/client/assets/agent-settings-Uir88FPs.js +0 -1
- package/dist/client/assets/agent-site-editor-code-CMk_fLsh.js +0 -2
- package/dist/client/assets/agent-site-editor-content-DTsWdPHL.js +0 -1
- package/dist/client/assets/agent-site-editor-preview-Br0J113j.js +0 -1
- package/dist/client/assets/agent-view-DSlQoDfx.js +0 -1
- package/dist/client/assets/analytics-tab-DnWN6v6x.js +0 -2
- package/dist/client/assets/api-keys-D17ng_fK.js +0 -1
- package/dist/client/assets/app-editor-BBiKxRJS.js +0 -1
- package/dist/client/assets/category-editor-Cklcuc6l.js +0 -1
- package/dist/client/assets/cms-settings-editor-bw2d5qFj.js +0 -1
- package/dist/client/assets/collection-detail-BRa2jvXK.js +0 -1
- package/dist/client/assets/context-bZenUCWc.js +0 -1
- package/dist/client/assets/discover-DqVrbNaN.js +0 -1
- package/dist/client/assets/file-explorer-B-ye_-97.js +0 -2
- package/dist/client/assets/home-CD9j4UYU.js +0 -1
- package/dist/client/assets/library-PZbd-Doo.js +0 -1
- package/dist/client/assets/monitoring-D6l4I6f5.js +0 -1
- package/dist/client/assets/order-monitor-day-BTTTp937.js +0 -1
- package/dist/client/assets/plan-DWTPbA95.js +0 -1
- package/dist/client/assets/post-calendar-CsYHka8d.js +0 -1
- package/dist/client/assets/project-app-view-BJ5Jx_gM.js +0 -1
- package/dist/client/assets/project-reports-VHT6QaEg.js +0 -1
- package/dist/client/assets/project-tasks-CJNYdN6D.js +0 -1
- package/dist/client/assets/record-editor-DTffX4wj.js +0 -1
- package/dist/client/assets/redirect-editor-BmKYzmzW.js +0 -1
- package/dist/client/assets/reports-Bj3OCHyV.js +0 -1
- package/dist/client/assets/reports-tab-DqVp7xB2.js +0 -2
- package/dist/client/assets/repositories-eo_EMvPJ.js +0 -1
- package/dist/client/assets/roles-DWAAM1uf.js +0 -1
- package/dist/client/assets/route-BFmFTSop.js +0 -1
- package/dist/client/assets/route-BVH9iZ3P.js +0 -1
- package/dist/client/assets/route-D-yMUgac.js +0 -1
- package/dist/client/assets/sections-editor-BxjGUtMX.js +0 -1
- package/dist/client/assets/seo-editor-Pqi1uTMV.js +0 -1
- package/dist/client/assets/settings-tab-CG7k6yYL.js +0 -1
- package/dist/client/assets/shell-layout-uDYSTXA5.js +0 -1
- package/dist/client/assets/site-editor-hILYo6nq.js +0 -1
- package/dist/client/assets/taskboard-analytics-DrH4N_FR.js +0 -1
- package/dist/client/assets/tasks-BJ_C2gVP.js +0 -1
- package/dist/client/assets/thread-analytics-BQ0AO_kH.js +0 -1
- package/dist/client/assets/useInfiniteQuery-LBIaZPt-.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-ClnVveRy.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-C8YP0XfX.js";import{B as K}from"./badge-AFOqFwvQ.js";import{L as fe}from"./label-BZDtWIcv.js";import{s as pe}from"./Trash01-BqP8uw7k.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-Yzjx02p5.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-B8Xcvgnu.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-D9ddy9a_.js";import{y as se,L as ae,p as Te,i as He,u as Ie,S as _e}from"./blocks-tab-states-BUek9Urr.js";import{b as Be}from"./ZoomOut-BVuJZ-2t.js";import{a as Fe}from"./UserSquare-D4xudMmb.js";import{u as Pe}from"./use-apply-named-rule-QplWW5Pw.js";import{E as $e}from"./empty-state-BdJInz6a.js";import{u as Me}from"./chat-context-BI1yxU4R.js";import{a as Ke}from"./use-panel-navigate-CTWNyrxK.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-C0ubqGd6.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])),J(()=>import("./agent-site-editor-content-DTsWdPHL.js"),__vite__mapDeps([166,1,2,167,168,141,5,4,6,7,8,9,11,12,13,14,15,16,17,36,37,38,39,40,41,42,29,34,43,44,45,35,46,47,48,30,49,50,51,52,53,54,55,56,57,58,59,60,61,62,130,169,147,102,26,95,3,10,18,19,20,21,96,73,74,97,77,98,99,100,101,69,103,104,105,106,107,108,25,109,110,84,85,111,112,113,114,115,116,83,117,118,119,75,76,120,121,122,123,124,125,126,89,127,128,66,129,131,132,133,134,135,136,137,138,139,140,142,143,144,63,145,146,148,33,64,65,67,68,70,71,72,78,79,80,81,149,150,31,27,170,171,172,173,174,175,176,88,177,178,179,180,181,182,183,184,185,186,187,94,24,28,32,188,189,161,156,157,190,191,192,155,193,194,195,196,197,198,199,200,152,151,201,160,202,203,204,205,206]))]).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-wbhemRqk.js","assets/index-CgM7-Ro8.js","assets/index-u-z_8GjU.css","assets/chat-context-EryBIl5y.js","assets/use-panel-navigate-BzdcqjSS.js","assets/thread-route-Dn9lxS6O.js","assets/use-project-scope-CPYcIvTW.js","assets/repository-binding-8UNd4La0.js","assets/use-mcp-client-Bl_ZkfjH.js","assets/auth-DDIbIEWU.js","assets/autosend-CeHYNB5a.js","assets/thread-intent-DRdPtaf2.js","assets/delay-CnY5UFtP.js","assets/backoff-CrEUbyZT.js","assets/watch-sse-pool-DfTC9EXk.js","assets/task-board-boVYnzry.js","assets/schema-OwOGrcTc.js","assets/slugify-CEUa2lfQ.js","assets/use-decopilot-events-pkzCwwKp.js","assets/use-ai-providers-3poZythL.js","assets/location-V0VwTJTt.js","assets/use-organization-settings-nbIrzOgF.js","assets/site-draft-actions-D58qwd26.js","assets/separator-D_EWmGgU.js","assets/site-editor-toast-BOx376JN.js","assets/use-session-runtime-BQ8nqerw.js","assets/experiments-tab-choice-_FBZoLPZ.js","assets/sandbox-url-D3mC8qhT.js","assets/utils-BKDVVXZB.js","assets/ZoomOut-BMZKrcTE.js","assets/Image01-DLqdm992.js","assets/use-sandbox-events-Yfi6UXbb.js","assets/sandbox-git-api-DcqI6XE4.js","assets/shell-layout-Dt3eq6Qk.js","assets/Building02-CTmcVqQj.js","assets/UserSquare-DV1XZOY6.js","assets/use-deployment-admin-MTxNhHb9.js","assets/admin-fetch-BhTJlAsX.js","assets/agent-icon-B6DURSl_.js","assets/AlertCircle-JaYuCWTa.js","assets/Tool01-DvOyfmVC.js","assets/ArrowUp-YrAe3vgd.js","assets/ArrowLeft-BhJEaZ6B.js","assets/LinkBroken01-C29KKpU0.js","assets/ShoppingBag01-jE2k9Z1o.js","assets/CheckCircle-9jHhe24P.js","assets/ChevronUp-D-7vQNVy.js","assets/ChevronSelectorVertical-CfW1Wzms.js","assets/Copy01-DP6tJ3a3.js","assets/CreditCard01-7YXzWPmu.js","assets/DotsVertical-BSeiVg8O.js","assets/Globe04-BkUhGI83.js","assets/SwitchHorizontal01-CLXZKY70.js","assets/Key01-o_hEpYwc.js","assets/Link01-DDso2VpB.js","assets/Minus-B--8kp5j.js","assets/Monitor01-BtDUnSZq.js","assets/Sun-CGNTymUo.js","assets/Play-jy1YZ7pj.js","assets/Plus-4tdoOfzh.js","assets/SearchMd-J2Rjic9V.js","assets/Trash01-CGaWZsc5.js","assets/Upload01-CXqGRfor.js","assets/Users01-CpHvZIR7.js","assets/XClose-DWQXqdSq.js","assets/use-clock-tick-DYb0Yqfo.js","assets/command-BPRmBGhB.js","assets/index-cvu6NM2y.js","assets/integration-icon-Do2Y8hkm.js","assets/project-icon-DEP8iT8r.js","assets/new-project-dialog-DVfPsfG1.js","assets/label-DOI4IEwy.js","assets/repository-import-picker-OrJw3cIo.js","assets/use-navigate-to-agent-C1cUtbF5.js","assets/repository-picker-B6a9ep3b.js","assets/tooltip-BFkmafQU.js","assets/index-bs2MyHCY.js","assets/useInfiniteQuery-D5ei_KuQ.js","assets/infiniteQueryObserver-DOIcndov.js","assets/collection-search-oriFbOeS.js","assets/use-debounced-value-BwY4UFXK.js","assets/required-auth-layout-BZmUgBgt.js","assets/use-org-sso-lLtOH9c9.js","assets/shell-layout-CE2Eihra.css","assets/toolbar-icon-button-BnmGAbB7.js","assets/popover-Cdnki_Jg.js","assets/tabs-CDXYpFRp.js","assets/active-indicator-CCMhAsc_.js","assets/use-releases-BM0WbDv5.js","assets/serial-task-queue-CGOeQgpr.js","assets/virtual-mcp-BqhVfWuq.js","assets/url-slug-C8ETdBcF.js","assets/use-fast-preview-draft-url-gEHohveI.js","assets/section-preview-url-7zfngvgW.js","assets/preview-link-C762yHOt.js","assets/variant-draft-pointer-BeAKcq_c.js","assets/parse-sections-D0EeXwVX.js","assets/index-CXN_y45N.js","assets/tool-namespace-B8XtAn-5.js","assets/drawer-C3PrA-n8.js","assets/use-mobile-DWwy0G1s.js","assets/use-mcp-prompts-Bvk5GzsH.js","assets/usage-stats-0AsfjkwI.js","assets/form-BrmBomQx.js","assets/utils-CVEq3hMx.js","assets/markdown-BwxTuGGG.js","assets/use-copy-CS6Ta5ka.js","assets/input-DVTIG9aC.js","assets/icon-button-B8gYI46y.js","assets/file-type-icon-D-goE4ev.js","assets/chat-draft-C77KukAJ.js","assets/select-CYUfZrWy.js","assets/index-BdQq_4o_.js","assets/use-deco-credits-D_52syYI.js","assets/toggle-group-DxXcbqbT.js","assets/use-open-billing-url-BBnKa__h.js","assets/index-B_ZSRZ_1.js","assets/checkbox-DanWxFDQ.js","assets/ai-providers-logos-DD3qZ33J.js","assets/input-Cdb_NhY5.js","assets/suggestion-B4JccI3N.js","assets/use-org-fs-ByPpnYSO.js","assets/question-004-sINsf4GQ.js","assets/feature-paywall-B0ICgL5J.js","assets/plan-ladder-DeIr-j94.js","assets/add-connection-dialog-BAfMm3u3.js","assets/extract-connection-data-CAX0s-U5.js","assets/metadata-D72DunRR.js","assets/connection-DyDIuEks.js","assets/connection-card-vYaDrRUO.js","assets/connection-slug-CITJ0kGN.js","assets/textarea-CKsCKFLy.js","assets/use-connection-DF35j1XL.js","assets/schema-BrrH5ge3.js","assets/connection-form-helpers-BQJcmj4C.js","assets/authenticate-and-persist-oauth-Cinc5wU_.js","assets/mcp-oauth-CZ9GqXPF.js","assets/mcp-oauth-ysipa0ke.js","assets/collection-tabs-B-KXu_oD.js","assets/badge-DCdHHENd.js","assets/use-infinite-scroll-DQ9VVP8_.js","assets/useSuspenseInfiniteQuery-BzA-SXDa.js","assets/use-task-board-events-BZgY7EAa.js","assets/use-chat-layout-state-Dw5fxydL.js","assets/input-Bwd_JSM8.css","assets/pair-BqbhOYo8.js","assets/collapsible-Bxf6Tjj8.js","assets/content-blocks-o63cs2vh.js","assets/mcp-app-renderer-BoiACXPd.js","assets/types-DdyZFVjB.js","assets/omit-sandbox-map-jj4lCB2U.js","assets/sheet-CSTtais0.js","assets/use-thread-outputs-gO4YyAPs.js","assets/hosted-publish-feedback-D-NyDy_o.js","assets/use-cms-publish-actions-B9zJNLow.js","assets/named-rule-uses-BR4TO_up.js","assets/device-hint-SeLRi17j.js","assets/editor-BI9MEm45.js","assets/section-array-field-Osne9SXG.js","assets/alert-ByYqnTt4.js","assets/save-changes-debug-nBi-n9eV.js","assets/releases-api-A66gUQIn.js","assets/sandbox-lifecycle-context-BmK0O-xa.js","assets/sandbox-start-errors-BK_aDCyt.js","assets/index-Dps1wO3D.js","assets/use-sidebar-collapsed-DpVze00L.js","assets/resizable-CsaiXEtB.js","assets/agent-site-editor-DDGTF8rc.css","assets/agent-site-editor-content-CDIxjk4q.js","assets/agent-view-guard-B65FxQSG.js","assets/use-main-panel-tabs-C3tLSafV.js","assets/use-mcp-tools-CCzyb7_q.js","assets/resolve-tab-icon-DxDkByKs.js","assets/use-task-metadata-tY7yqfRb.js","assets/preview-source-BsRLGWUP.js","assets/use-project-native-view-presence-z6ElNhcQ.js","assets/match-site-slug-config-D3fUJ6vX.js","assets/use-file-configs-DQ3f-Q5P.js","assets/site-slug-DebpOoQq.js","assets/feature-gate-CIVRuSL-.js","assets/content-tab-CdSmdOT_.js","assets/blocks-tab-states-D7FXIYa1.js","assets/slider-DykoTN1q.js","assets/index-SVmnnfb6.js","assets/tooltipContext-CdLg2pG8.js","assets/CategoricalChart-BqKIQcdM.js","assets/index-CVukLLDd.js","assets/ActiveShapeUtils-DnnbFg2w.js","assets/Sector-Bh4QFYl4.js","assets/symbol-CFT02IQk.js","assets/empty-state-r_5Rd0dc.js","assets/held-block-view-ZDteU5Jg.js","assets/switch-gUlNntL4.js","assets/scroll-area-C4hgiBjt.js","assets/monaco-editor-Bu-nU7NV.js","assets/calendar-DGPEnw4y.js","assets/editor-classes-Di69nj2G.js","assets/core.esm-XMSb_Uka.js","assets/sortable.esm-BcgCBEfW.js","assets/combobox-Cwzc08sq.js","assets/search-input-BfxNf6mK.js","assets/asset-utils-B_sH3eAw.js","assets/view-header-Cq5PRRNl.js","assets/mustache-DKd8K2vx.js","assets/date-utils-CrvIKg-s.js","assets/use-move-blocks-ssPS8eLc.js","assets/empty-state-tJsREuj4.js","assets/collection-table-wrapper-Cx4DeYH2.js","assets/table-DEOdYXzp.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-CgM7-Ro8.js";import{B as K}from"./badge-DCdHHENd.js";import{L as fe}from"./label-DOI4IEwy.js";import{s as pe}from"./Trash01-CGaWZsc5.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-BR4TO_up.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-D0EeXwVX.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-BOx376JN.js";import{y as se,L as ae,p as Te,i as He,u as Ie,S as _e}from"./blocks-tab-states-D7FXIYa1.js";import{b as Be}from"./ZoomOut-BMZKrcTE.js";import{a as Fe}from"./UserSquare-DV1XZOY6.js";import{u as Pe}from"./use-apply-named-rule-CVBNS4ep.js";import{E as $e}from"./empty-state-tJsREuj4.js";import{u as Me}from"./chat-context-EryBIl5y.js";import{a as Ke}from"./use-panel-navigate-BzdcqjSS.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-wbhemRqk.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,167])),J(()=>import("./agent-site-editor-content-CDIxjk4q.js"),__vite__mapDeps([168,1,2,169,170,143,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,132,171,149,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,118,85,119,120,121,77,78,122,123,124,125,126,127,128,91,129,130,68,131,133,134,135,136,137,138,139,140,141,142,144,145,146,65,147,148,150,33,36,37,66,67,69,70,72,73,74,80,81,82,83,151,152,31,27,172,173,174,175,176,177,178,90,179,180,181,182,183,184,185,186,187,188,189,96,24,28,32,190,191,163,158,159,192,193,194,157,195,196,197,198,199,200,201,202,154,153,203,162,204,205,206,207,208]))]).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-CgM7-Ro8.js";import{C as V}from"./chat-context-EryBIl5y.js";import{C as x}from"./index-Dps1wO3D.js";import{L}from"./index-_4PHXujT.js";import{B as K}from"./blocks-preview-workspace-context-MSwutMpe.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-BOx376JN.js";import{u as Q,L as B,P as X,S as Y}from"./preview-tab-DpIMbT0D.js";import{C as Z}from"./content-tab-CdSmdOT_.js";import{T as tt}from"./tab-icon-glyph-DkR9ySmC.js";import{r as ot}from"./resolve-tab-icon-DxDkByKs.js";import et from"./agent-site-editor-wbhemRqk.js";import"./use-panel-navigate-BzdcqjSS.js";import"./thread-route-Dn9lxS6O.js";import"./use-project-scope-CPYcIvTW.js";import"./repository-binding-8UNd4La0.js";import"./use-mcp-client-Bl_ZkfjH.js";import"./auth-DDIbIEWU.js";import"./autosend-CeHYNB5a.js";import"./thread-intent-DRdPtaf2.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./watch-sse-pool-DfTC9EXk.js";import"./task-board-boVYnzry.js";import"./schema-OwOGrcTc.js";import"./slugify-CEUa2lfQ.js";import"./use-decopilot-events-pkzCwwKp.js";import"./use-ai-providers-3poZythL.js";import"./location-V0VwTJTt.js";import"./use-organization-settings-nbIrzOgF.js";import"./use-mobile-DWwy0G1s.js";import"./use-sidebar-collapsed-DpVze00L.js";import"./use-chat-layout-state-Dw5fxydL.js";import"./agent-icon-B6DURSl_.js";import"./AlertCircle-JaYuCWTa.js";import"./Tool01-DvOyfmVC.js";import"./ArrowUp-YrAe3vgd.js";import"./ArrowLeft-BhJEaZ6B.js";import"./LinkBroken01-C29KKpU0.js";import"./ShoppingBag01-jE2k9Z1o.js";import"./ZoomOut-BMZKrcTE.js";import"./Building02-CTmcVqQj.js";import"./CheckCircle-9jHhe24P.js";import"./ChevronUp-D-7vQNVy.js";import"./ChevronSelectorVertical-CfW1Wzms.js";import"./UserSquare-DV1XZOY6.js";import"./Copy01-DP6tJ3a3.js";import"./CreditCard01-7YXzWPmu.js";import"./DotsVertical-BSeiVg8O.js";import"./Image01-DLqdm992.js";import"./Globe04-BkUhGI83.js";import"./SwitchHorizontal01-CLXZKY70.js";import"./Key01-o_hEpYwc.js";import"./Link01-DDso2VpB.js";import"./Minus-B--8kp5j.js";import"./Monitor01-BtDUnSZq.js";import"./Sun-CGNTymUo.js";import"./Play-jy1YZ7pj.js";import"./Plus-4tdoOfzh.js";import"./SearchMd-J2Rjic9V.js";import"./Trash01-CGaWZsc5.js";import"./Upload01-CXqGRfor.js";import"./Users01-CpHvZIR7.js";import"./XClose-DWQXqdSq.js";import"./tooltip-BFkmafQU.js";import"./index-bs2MyHCY.js";import"./toolbar-icon-button-BnmGAbB7.js";import"./shell-layout-Dt3eq6Qk.js";import"./use-deployment-admin-MTxNhHb9.js";import"./admin-fetch-BhTJlAsX.js";import"./use-clock-tick-DYb0Yqfo.js";import"./command-BPRmBGhB.js";import"./index-cvu6NM2y.js";import"./integration-icon-Do2Y8hkm.js";import"./project-icon-DEP8iT8r.js";import"./new-project-dialog-DVfPsfG1.js";import"./label-DOI4IEwy.js";import"./repository-import-picker-OrJw3cIo.js";import"./use-navigate-to-agent-C1cUtbF5.js";import"./repository-picker-B6a9ep3b.js";import"./useInfiniteQuery-D5ei_KuQ.js";import"./infiniteQueryObserver-DOIcndov.js";import"./collection-search-oriFbOeS.js";import"./use-debounced-value-BwY4UFXK.js";import"./required-auth-layout-BZmUgBgt.js";import"./use-org-sso-lLtOH9c9.js";import"./sheet-CSTtais0.js";import"./resizable-CsaiXEtB.js";import"./core.esm-XMSb_Uka.js";import"./sortable.esm-BcgCBEfW.js";import"./context-menu-gpaAOtWJ.js";import"./create-organization-dialog-B46HiNm0.js";import"./form-BrmBomQx.js";import"./project-apps-ZVTNnGHs.js";import"./use-recent-apps-B1qEqr2V.js";import"./use-session-runtime-BQ8nqerw.js";import"./experiments-tab-choice-_FBZoLPZ.js";import"./sandbox-url-D3mC8qhT.js";import"./utils-BKDVVXZB.js";import"./use-sandbox-events-Yfi6UXbb.js";import"./sandbox-git-api-DcqI6XE4.js";import"./held-block-view-ZDteU5Jg.js";import"./sandbox-start-errors-BK_aDCyt.js";import"./pair-BqbhOYo8.js";import"./collapsible-Bxf6Tjj8.js";import"./use-copy-CS6Ta5ka.js";import"./usage-stats-0AsfjkwI.js";import"./tool-namespace-B8XtAn-5.js";import"./utils-CVEq3hMx.js";import"./markdown-BwxTuGGG.js";import"./content-blocks-o63cs2vh.js";import"./mcp-app-renderer-BoiACXPd.js";import"./types-DdyZFVjB.js";import"./omit-sandbox-map-jj4lCB2U.js";import"./use-connection-DF35j1XL.js";import"./use-mcp-prompts-Bvk5GzsH.js";import"./use-thread-outputs-gO4YyAPs.js";import"./file-type-icon-D-goE4ev.js";import"./section-array-field-Osne9SXG.js";import"./alert-ByYqnTt4.js";import"./parse-sections-D0EeXwVX.js";import"./blocks-tab-states-D7FXIYa1.js";import"./slider-DykoTN1q.js";import"./index-SVmnnfb6.js";import"./index-BdQq_4o_.js";import"./tooltipContext-CdLg2pG8.js";import"./CategoricalChart-BqKIQcdM.js";import"./index-CVukLLDd.js";import"./ActiveShapeUtils-DnnbFg2w.js";import"./Sector-Bh4QFYl4.js";import"./symbol-CFT02IQk.js";import"./empty-state-r_5Rd0dc.js";import"./switch-gUlNntL4.js";import"./textarea-CKsCKFLy.js";import"./popover-Cdnki_Jg.js";import"./scroll-area-C4hgiBjt.js";import"./monaco-editor-Bu-nU7NV.js";import"./editor-BI9MEm45.js";import"./calendar-DGPEnw4y.js";import"./select-CYUfZrWy.js";import"./editor-classes-Di69nj2G.js";import"./toggle-group-DxXcbqbT.js";import"./active-indicator-CCMhAsc_.js";import"./combobox-Cwzc08sq.js";import"./search-input-BfxNf6mK.js";import"./tabs-CDXYpFRp.js";import"./use-file-configs-DQ3f-Q5P.js";import"./asset-utils-B_sH3eAw.js";import"./match-site-slug-config-D3fUJ6vX.js";import"./sandbox-lifecycle-context-BmK0O-xa.js";import"./variant-matcher-override-CMA8M4Ll.js";import"./variant-draft-pointer-BeAKcq_c.js";import"./section-preview-url-7zfngvgW.js";import"./use-fast-preview-draft-url-gEHohveI.js";import"./preview-link-C762yHOt.js";import"./useQueries-BpncSGWZ.js";import"./device-hint-SeLRi17j.js";import"./virtual-mcp-BqhVfWuq.js";import"./url-slug-C8ETdBcF.js";import"./app-preview-url-9Od4s8Sz.js";import"./preview-source-BsRLGWUP.js";import"./use-task-metadata-tY7yqfRb.js";import"./view-header-Cq5PRRNl.js";import"./use-cms-publish-actions-B9zJNLow.js";import"./hosted-publish-feedback-D-NyDy_o.js";import"./mustache-DKd8K2vx.js";import"./checkbox-DanWxFDQ.js";import"./date-utils-CrvIKg-s.js";import"./use-move-blocks-ssPS8eLc.js";import"./badge-DCdHHENd.js";import"./empty-state-tJsREuj4.js";import"./collection-table-wrapper-Cx4DeYH2.js";import"./table-DEOdYXzp.js";import"./site-draft-actions-D58qwd26.js";import"./separator-D_EWmGgU.js";import"./use-releases-BM0WbDv5.js";import"./serial-task-queue-CGOeQgpr.js";import"./index-CXN_y45N.js";import"./drawer-C3PrA-n8.js";import"./input-DVTIG9aC.js";import"./icon-button-B8gYI46y.js";import"./chat-draft-C77KukAJ.js";import"./use-deco-credits-D_52syYI.js";import"./use-open-billing-url-BBnKa__h.js";import"./index-B_ZSRZ_1.js";import"./ai-providers-logos-DD3qZ33J.js";import"./input-Cdb_NhY5.js";import"./suggestion-B4JccI3N.js";import"./use-org-fs-ByPpnYSO.js";import"./question-004-sINsf4GQ.js";import"./feature-paywall-B0ICgL5J.js";import"./plan-ladder-DeIr-j94.js";import"./add-connection-dialog-BAfMm3u3.js";import"./extract-connection-data-CAX0s-U5.js";import"./metadata-D72DunRR.js";import"./connection-DyDIuEks.js";import"./connection-card-vYaDrRUO.js";import"./connection-slug-CITJ0kGN.js";import"./schema-BrrH5ge3.js";import"./connection-form-helpers-BQJcmj4C.js";import"./authenticate-and-persist-oauth-Cinc5wU_.js";import"./mcp-oauth-CZ9GqXPF.js";import"./mcp-oauth-ysipa0ke.js";import"./collection-tabs-B-KXu_oD.js";import"./use-infinite-scroll-DQ9VVP8_.js";import"./useSuspenseInfiniteQuery-BzA-SXDa.js";import"./use-task-board-events-BZgY7EAa.js";import"./named-rule-uses-BR4TO_up.js";import"./save-changes-debug-nBi-n9eV.js";import"./releases-api-A66gUQIn.js";function I(o){return o.kind==="unavailable"&&o.source==="local"&&(o.problem?.reason??"not-answering")==="not-answering"}const it=o=>o;function rt(o){const t=u.c(10),{candidates:e,invalidLink:c,shell:m,editor:i}=o,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]!==e||t[5]!==r?(a=n.jsx(nt,{candidates:e,invalidLink:r,onConnect:l}),t[4]=e,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(o){const t=u.c(17),{candidates:e,invalidLink:c,onConnect:m}=o,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]!==e||t[3]!==p?(l={candidates:e,onFound:p},t[2]=e,t[3]=p,t[4]=l):l=t[4];const a=Q(l),{state:d,access:f,needsGesture:h}=a;let k;t[5]!==e||t[6]!==s?(k=new Intl.ListFormat(s,{style:"long",type:"conjunction"}).format(e.map(T)),t[5]=e,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 o=window.location.hash,t=new URLSearchParams(o.replace(/^#/,"")).has("endpoint"),e=t?W(o):null;return t&&window.history.replaceState(null,"",window.location.pathname+window.location.search),e&&J(e),{candidates:U(e,z()),invalidLink:t&&!e}}const ct=[{id:"site-editor",to:"/site-editor",label:"preview"},{id:"content",to:"/site-editor/content",label:"content"}];function lt(){const o=u.c(6),t=O();let e;o[0]===Symbol.for("react.memo_cache_sentinel")?(e={select:dt},o[0]=e):e=o[0];const c=P(e);let m;o[1]!==t||o[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:ot({tabId:r.id,kind:"system",connections:[]})})}),t(`common.mainPanelTabs.${r.label}`)]})},r.id)),o[1]=t,o[2]=c,o[3]=m):m=o[3];let i;return o[4]!==m?(i=n.jsx(y.Tabs,{children:m}),o[4]=m,o[5]=i):i=o[5],i}function dt(o){return o.matches.at(-1)?.staticData.siteEditorView}function N(o){const t=u.c(14),{children:e}=o,c=O(),{connection:m}=q(v),i=R(v,w);let r,s;if(t[0]!==i||t[1]!==e||t[2]!==m||t[3]!==c){s=Symbol.for("react.early_return_sentinel");t:{if(r=m?T(m.endpoint):"",i.kind==="protocol"){s=e;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]=e,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(o){const t=u.c(6),{onLost:e}=o,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]!==e?(r=()=>{i&&e()},s=[i,e],t[2]=i,t[3]=e,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 o=u.c(11),{data:t}=E.useSession();let e;o[0]===Symbol.for("react.memo_cache_sentinel")?(e={select:ht},o[0]=e):e=o[0];const c=P(e),m=!!t?.user;let i;o[1]!==m?(i={rail:m},o[1]=m,o[2]=i):i=o[2];const r=c??"preview";let s,p,l;o[3]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(lt,{}),p=n.jsx(x.Thread,{children:null}),l=n.jsx(et,{}),o[3]=s,o[4]=p,o[5]=l):(s=o[3],p=o[4],l=o[5]);let a;o[6]!==r?(a=n.jsx(L.Content,{children:n.jsxs(x,{...A,threadless:!0,contentKey:r,contentNavigation:s,children:[p,l]})}),o[6]=r,o[7]=a):a=o[7];let d;return o[8]!==i||o[9]!==a?(d=n.jsx(L,{outsideOrg:i,children:a}),o[8]=i,o[9]=a,o[10]=d):d=o[10],d}function ht(o){return o.matches.at(-1)?.staticData.siteEditorView}function vt(o){const t=u.c(8),{children:e}=o,{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]!==e?(s=n.jsx(L.Content,{children:n.jsxs(x,{...A,threadless:!0,contentKey:"guide",children:[r,n.jsx(x.Content,{children:e})]})}),t[3]=e,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 fr(){const o=u.c(3),[t]=g.useState(at);let e;return o[0]!==t.candidates||o[1]!==t.invalidLink?(e=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})})}),o[0]=t.candidates,o[1]=t.invalidLink,o[2]=e):e=o[2],e}function kt(o,t){return n.jsxs($.Provider,{value:{connection:o,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(o){return n.jsx($.Provider,{value:xt,children:n.jsx(vt,{children:o})})}function hr(){const o=u.c(1);let t;return o[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx(N,{children:n.jsx(X,{virtualMcpId:v})}),o[0]=t):t=o[0],t}function vr(){const o=u.c(1);let t;return o[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx(N,{children:n.jsx(Z,{virtualMcpId:v})}),o[0]=t):t=o[0],t}export{vr as SiteEditorContent,hr as SiteEditorPreview,fr 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-C8YP0XfX.js";import{u as dt}from"./use-session-runtime-pkeEtIbf.js";import{s as We}from"./thread-intent-Cl7xa7dA.js";import{u as Pe,b as on}from"./experiments-tab-choice-D5E9lbe8.js";import{b as fe}from"./sandbox-url-D3mC8qhT.js";import{s as rn}from"./utils-Chh_XkCj.js";import{a as sn}from"./repository-binding-B-4PI1n3.js";import{u as an}from"./chat-context-BI1yxU4R.js";import{i as cn,u as ln}from"./use-sandbox-events-Ccm6tkYH.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-CgM7-Ro8.js";import{u as dt}from"./use-session-runtime-BQ8nqerw.js";import{s as We}from"./thread-intent-DRdPtaf2.js";import{u as Pe,b as on}from"./experiments-tab-choice-_FBZoLPZ.js";import{b as fe}from"./sandbox-url-D3mC8qhT.js";import{s as rn}from"./utils-BKDVVXZB.js";import{a as sn}from"./repository-binding-8UNd4La0.js";import{u as an}from"./chat-context-EryBIl5y.js";import{i as cn,u as ln}from"./use-sandbox-events-Yfi6UXbb.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-C8YP0XfX.js";import{i as Ne}from"./DotsVertical-Bfe9a_On.js";import{i as le,a as Pe}from"./ZoomOut-BVuJZ-2t.js";import{s as Ae}from"./Trash01-BqP8uw7k.js";import{i as Ee}from"./Upload01-CpPArzNK.js";import{S as Me}from"./search-input-CIT_dMpA.js";import{S as Te}from"./search-toggle-BYErJl4G.js";import{E as V}from"./empty-state-CUanQ9Sm.js";import{C as Oe}from"./collection-tabs-CRfyt8-K.js";import{p as Ie,S as Re,F as ze}from"./folder-icon-B4yVMgUj.js";import{h as Fe,i as $e,r as _e}from"./use-org-fs-ao97Epgk.js";import{S as Le,H as Z,f as Be}from"./location-V0VwTJTt.js";import"./SearchMd-DB3np2ti.js";import"./icon-button-Rp_ZDDhs.js";import"./tooltip-CJHeHoSn.js";import"./index-B0Rg86vv.js";import"./badge-AFOqFwvQ.js";import"./markdown-DuoP9xIE.js";import"./use-copy-BCht-61u.js";import"./Copy01-DGy0Absz.js";import"./use-mobile-tv6dKHC3.js";import"./use-panel-navigate-CTWNyrxK.js";import"./thread-route-JcxEqRgq.js";import"./use-project-scope-BgLQY0Uk.js";import"./repository-binding-B-4PI1n3.js";import"./use-mcp-client-CkAT8dMu.js";import"./auth-fndLm_KR.js";import"./file-preview-DVCjmYnL.js";import"./utils-Chh_XkCj.js";import"./Image01-DtpDUrwF.js";import"./editor-CVSwKg6T.js";import"./file-type-icon-CLdhbOMq.js";import"./useInfiniteQuery-LBIaZPt-.js";import"./infiniteQueryObserver-C8Tx1h_G.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-CgM7-Ro8.js";import{i as Ne}from"./DotsVertical-BSeiVg8O.js";import{i as le,a as Pe}from"./ZoomOut-BMZKrcTE.js";import{s as Ae}from"./Trash01-CGaWZsc5.js";import{i as Ee}from"./Upload01-CXqGRfor.js";import{S as Me}from"./search-input-BfxNf6mK.js";import{S as Te}from"./search-toggle-7CRkYA1R.js";import{E as V}from"./empty-state-r_5Rd0dc.js";import{C as Oe}from"./collection-tabs-B-KXu_oD.js";import{p as Ie,S as Re,F as ze}from"./folder-icon-Dh0obbUY.js";import{h as Fe,i as $e,r as _e}from"./use-org-fs-ByPpnYSO.js";import{S as Le,H as Z,f as Be}from"./location-V0VwTJTt.js";import"./SearchMd-J2Rjic9V.js";import"./icon-button-B8gYI46y.js";import"./tooltip-BFkmafQU.js";import"./index-bs2MyHCY.js";import"./badge-DCdHHENd.js";import"./markdown-BwxTuGGG.js";import"./use-copy-CS6Ta5ka.js";import"./Copy01-DP6tJ3a3.js";import"./use-mobile-DWwy0G1s.js";import"./use-panel-navigate-BzdcqjSS.js";import"./thread-route-Dn9lxS6O.js";import"./use-project-scope-CPYcIvTW.js";import"./repository-binding-8UNd4La0.js";import"./use-mcp-client-Bl_ZkfjH.js";import"./auth-DDIbIEWU.js";import"./file-preview-BS2w8KBn.js";import"./utils-BKDVVXZB.js";import"./Image01-DLqdm992.js";import"./editor-BI9MEm45.js";import"./file-type-icon-D-goE4ev.js";import"./useInfiniteQuery-D5ei_KuQ.js";import"./infiniteQueryObserver-DOIcndov.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-CgM7-Ro8.js";import{T as k,R as z,a as D,b as S}from"./index-SVmnnfb6.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-CgM7-Ro8.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-XMSb_Uka.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};
|