decocms 4.580.1 → 4.581.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{AlertCircle-DuMz-jFi.js → AlertCircle-BNgT9H-9.js} +1 -1
- package/dist/client/assets/{AreaChart-BqIC3e-u.js → AreaChart-CizTxrut.js} +1 -1
- package/dist/client/assets/{ArrowLeft-5NT3k46C.js → ArrowLeft-CzuIgcZK.js} +1 -1
- package/dist/client/assets/{ArrowUp-D5JWz7Yq.js → ArrowUp-DX0Oa8sk.js} +1 -1
- package/dist/client/assets/{BookOpen01-m1uNXDEc.js → BookOpen01-BDEDqARy.js} +1 -1
- package/dist/client/assets/{CartesianChart-D9oScPZv.js → CartesianChart-D3UU8n4G.js} +1 -1
- package/dist/client/assets/{CategoricalChart-BR_4thmy.js → CategoricalChart-BXx_yOPa.js} +1 -1
- package/dist/client/assets/{CheckCircle-DAPdRkcW.js → CheckCircle-DGPVeuCJ.js} +1 -1
- package/dist/client/assets/{ChevronSelectorVertical-5fTMRN5v.js → ChevronSelectorVertical-CI140ew9.js} +1 -1
- package/dist/client/assets/{ChevronUp-BaKxA_AU.js → ChevronUp-B9DaDvS3.js} +1 -1
- package/dist/client/assets/{CreditCard01-BU3Icpfr.js → CreditCard01-BmpzvB5e.js} +1 -1
- package/dist/client/assets/{Globe04-KZ-J2ZUi.js → Globe04-BpbOo7AZ.js} +1 -1
- package/dist/client/assets/{Key01-RIzbDsEi.js → Key01-Cpl2DWV2.js} +1 -1
- package/dist/client/assets/{LinkBroken01-IVC8feVZ.js → LinkBroken01-l43AWgbv.js} +1 -1
- package/dist/client/assets/{Minus-Dw050KAn.js → Minus-DyKaWISs.js} +1 -1
- package/dist/client/assets/{Monitor01-D7QUQToM.js → Monitor01-BdFmkSiY.js} +1 -1
- package/dist/client/assets/{Play-BDSDyO5E.js → Play-BDaEp7vE.js} +1 -1
- package/dist/client/assets/{Plus-CRqz0c82.js → Plus-Dxw22W7_.js} +1 -1
- package/dist/client/assets/{ReferenceLine-DKoY4fDh.js → ReferenceLine-CdPtulni.js} +1 -1
- package/dist/client/assets/{SearchMd-CcAFkP0F.js → SearchMd-DuFQ9UgF.js} +1 -1
- package/dist/client/assets/{ShoppingBag01-CspfAlNO.js → ShoppingBag01-Bf_3Yh5l.js} +1 -1
- package/dist/client/assets/{Sun-DRT9bMW5.js → Sun-vurMVi6G.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-D3zx9VNf.js → SwitchHorizontal01-C-rlzvYe.js} +1 -1
- package/dist/client/assets/{Tool01-D9-ePNaJ.js → Tool01-D4x0RZqM.js} +1 -1
- package/dist/client/assets/{Tooltip-DZ7sGrNE.js → Tooltip-BKPDgiqg.js} +1 -1
- package/dist/client/assets/{Trash01-BTZDkUzq.js → Trash01-CGrA2ON1.js} +1 -1
- package/dist/client/assets/{Upload01-BRP1bAMs.js → Upload01-6kkhuzxl.js} +1 -1
- package/dist/client/assets/{UserSquare-Dv0YcmkC.js → UserSquare-nHYvjai8.js} +1 -1
- package/dist/client/assets/{Users01-DKwguy8Z.js → Users01-e2r7hqMU.js} +1 -1
- package/dist/client/assets/{XClose-CyHahh4m.js → XClose-CBDYK_AJ.js} +1 -1
- package/dist/client/assets/{Zap-Dja9fdMf.js → Zap-DfRMi_rk.js} +1 -1
- package/dist/client/assets/{access-gate-VlWUv9j2.js → access-gate-3uWjt152.js} +1 -1
- package/dist/client/assets/{add-connection-dialog-DJ5sN8e_.js → add-connection-dialog-CsWthpZ9.js} +1 -1
- package/dist/client/assets/agent-app-i42F64Tf.js +1 -0
- package/dist/client/assets/{agent-assets-n0l0tFBN.js → agent-assets-yhsnLz6V.js} +1 -1
- package/dist/client/assets/{agent-automation-DETSj7J9.js → agent-automation-B9u566HN.js} +1 -1
- package/dist/client/assets/{agent-automations-DeXM-DYA.js → agent-automations-C6qoE6-c.js} +1 -1
- package/dist/client/assets/{agent-blog-Dw89uwrE.js → agent-blog-BANd-DOA.js} +2 -2
- package/dist/client/assets/{agent-blog-post-BBh6a8oA.js → agent-blog-post-D4VabN4w.js} +2 -2
- package/dist/client/assets/{agent-calendar-CMtYd4vL.js → agent-calendar-B1gsu6Ys.js} +1 -1
- package/dist/client/assets/{agent-capabilities-BtnZBraK.js → agent-capabilities-BobB8G3S.js} +1 -1
- package/dist/client/assets/{agent-connect-sources-CIDxepQB.js → agent-connect-sources-D7PAwbiu.js} +1 -1
- package/dist/client/assets/agent-deck-CJ6F_9XA.js +1 -0
- package/dist/client/assets/{agent-e2e-CjpTFQWV.js → agent-e2e-BqPOwNTz.js} +1 -1
- package/dist/client/assets/agent-experiments-JXbeMR67.js +1 -0
- package/dist/client/assets/{agent-file-Cd74xgom.js → agent-file-Ctv4ydWn.js} +1 -1
- package/dist/client/assets/{agent-hosting-Dv13VH72.js → agent-hosting-BwGgYisC.js} +1 -1
- package/dist/client/assets/{agent-icon-DvD5kv_K.js → agent-icon-7pgGOyab.js} +1 -1
- package/dist/client/assets/agent-library-CgajOXjC.js +1 -0
- package/dist/client/assets/agent-library-file-ROPjoIiT.js +1 -0
- package/dist/client/assets/agent-overview-CRECfM0R.js +1 -0
- package/dist/client/assets/{agent-releases-BNRiLrFJ.js → agent-releases-nWFHpAct.js} +1 -1
- package/dist/client/assets/agent-settings-CQz4H--G.js +1 -0
- package/dist/client/assets/{agent-site-editor-87vQ9ufh.js → agent-site-editor-Beg3HEIb.js} +1 -1
- package/dist/client/assets/agent-site-editor-code-BmJC3uHD.js +2 -0
- package/dist/client/assets/agent-site-editor-content-COiXn4LP.js +1 -0
- package/dist/client/assets/agent-site-editor-preview-DdkTHBKn.js +1 -0
- package/dist/client/assets/agent-view-DP-yHMET.js +1 -0
- package/dist/client/assets/{agent-view-guard-H1xbnpPJ.js → agent-view-guard-Cke4S3ir.js} +1 -1
- package/dist/client/assets/{ai-providers-B9LfkD2O.js → ai-providers-ZTS5TR34.js} +1 -1
- package/dist/client/assets/{alert-NGt4-O3B.js → alert-CwJgunZE.js} +1 -1
- package/dist/client/assets/{analytics-sections-LriChYtf.js → analytics-sections-D0V5jY1C.js} +1 -1
- package/dist/client/assets/{api-keys-Dsk0h5qe.js → api-keys-Buv3-6nf.js} +1 -1
- package/dist/client/assets/api-keys-CA73zf8R.js +1 -0
- package/dist/client/assets/{app-editor-CdNfOH0q.js → app-editor-DalU60Mc.js} +1 -1
- package/dist/client/assets/{asset-utils-CZ4gg2Dc.js → asset-utils-DwPuRMbV.js} +1 -1
- package/dist/client/assets/{auth-ygmhxR7o.js → auth-DNlWgaIH.js} +1 -1
- package/dist/client/assets/{auth-catchall-o-VGmahb.js → auth-catchall-CmRd1j4n.js} +1 -1
- package/dist/client/assets/{auth-entry-CvNRh315.js → auth-entry-4GYbBxwp.js} +1 -1
- package/dist/client/assets/{auth-split-layout-Dy80rL_w.js → auth-split-layout-6Kr3YCmt.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-Di92Hz1m.js → authenticate-and-persist-oauth-DpD35C_P.js} +1 -1
- package/dist/client/assets/{automation-list-row-BtDcNrc_.js → automation-list-row-_Hy4DAtc.js} +1 -1
- package/dist/client/assets/{automation-runs-dkRISa5B.js → automation-runs-D3xh6rqy.js} +1 -1
- package/dist/client/assets/{automations-Be95spA2.js → automations-TJ3lg--K.js} +1 -1
- package/dist/client/assets/{badge-DzB3sqoD.js → badge-DJzADYLN.js} +1 -1
- package/dist/client/assets/{block-document-DrJlmgeQ.js → block-document-CLlHaiqy.js} +1 -1
- package/dist/client/assets/{blocks-preview-workspace-context-ClN63sTc.js → blocks-preview-workspace-context-CLkDzb1Y.js} +1 -1
- package/dist/client/assets/{blocks-tab-states-DQr9dBZQ.js → blocks-tab-states-Dos-yNvu.js} +1 -1
- package/dist/client/assets/{blog-preview-url-BNeiu40F.js → blog-preview-url-B9WnCIII.js} +1 -1
- package/dist/client/assets/{blog-schema-BSQdtgIY.js → blog-schema-BNmzJDEb.js} +1 -1
- package/dist/client/assets/{blog-source-gate-WL-fQwzo.js → blog-source-gate-DKGtTR_Q.js} +1 -1
- package/dist/client/assets/{blog-view-gate-EO5JR8Eq.js → blog-view-gate-CQ9aPosu.js} +1 -1
- package/dist/client/assets/{buckets-g82zij8V.js → buckets-Bi-uiwLZ.js} +1 -1
- package/dist/client/assets/{build-improve-prompt-doc-BdkcM1jX.js → build-improve-prompt-doc-D2ZrR4ET.js} +1 -1
- package/dist/client/assets/{calendar-RWRp4FJU.js → calendar-DVn2WJPG.js} +1 -1
- package/dist/client/assets/{capability-load-error-KmDfOtoP.js → capability-load-error-BQYVgnjq.js} +1 -1
- package/dist/client/assets/{category-editor-C9uuMYru.js → category-editor-BiRVC1cc.js} +1 -1
- package/dist/client/assets/{category-tree-DJrnPSNg.js → category-tree-jh72wtxu.js} +1 -1
- package/dist/client/assets/{chart-B9PgP-e_.js → chart-Ddie86U1.js} +1 -1
- package/dist/client/assets/{chat-context--RKzWa6k.js → chat-context-ChgzPsES.js} +1 -1
- package/dist/client/assets/{chat-draft-BGQDbeF5.js → chat-draft-B2tS32RP.js} +1 -1
- package/dist/client/assets/{checkbox-H8QR9D0_.js → checkbox-CQfIpQ5a.js} +1 -1
- package/dist/client/assets/{choose-editor-WBWd1WOu.js → choose-editor-Bwogocbp.js} +1 -1
- package/dist/client/assets/{cli-auth-success-C9vCBK1d.js → cli-auth-success-DbSIbWbL.js} +1 -1
- package/dist/client/assets/{client-icons-BKCD3ufp.js → client-icons-yH-3z7dy.js} +1 -1
- package/dist/client/assets/{cms-settings-editor-BbDRN695.js → cms-settings-editor-DuNBWNJd.js} +1 -1
- package/dist/client/assets/{cms-store-drafts-BejfL8Fe.js → cms-store-drafts-DGLCde3H.js} +1 -1
- package/dist/client/assets/{collapsible-DbCvR955.js → collapsible-fuf-L_qO.js} +1 -1
- package/dist/client/assets/{collection-detail-C2j-WZ3j.js → collection-detail-CJvo4hBg.js} +1 -1
- package/dist/client/assets/{collection-display-button-1DK_MMnx.js → collection-display-button-zHygXgth.js} +1 -1
- package/dist/client/assets/{collection-search-DvsK7hSv.js → collection-search-DIXRttD3.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-bm-LalTq.js → collection-table-wrapper-Bp116wWk.js} +1 -1
- package/dist/client/assets/{collection-tabs-6iiAOwW9.js → collection-tabs-nxDU_6IX.js} +1 -1
- package/dist/client/assets/{combobox-6gjOOlze.js → combobox-BOO1GhW0.js} +1 -1
- package/dist/client/assets/{command-DQleocFC.js → command-BBpufUKx.js} +1 -1
- package/dist/client/assets/{companion-mcps-section-CeIGkazX.js → companion-mcps-section-Cw9eOzvy.js} +1 -1
- package/dist/client/assets/{config-C2ncmLTD.js → config-DZ1AmUim.js} +1 -1
- package/dist/client/assets/{connect-DlXzYtCQ.js → connect-QNbrI0M1.js} +1 -1
- package/dist/client/assets/{connect-layout-Boxkt-tt.js → connect-layout-CmTu9QhZ.js} +1 -1
- package/dist/client/assets/{connect-source-dialog-DYJ40IKC.js → connect-source-dialog-DgL9lhtn.js} +1 -1
- package/dist/client/assets/{connection-CJZ6RQ2g.js → connection-CP9XigF8.js} +1 -1
- package/dist/client/assets/{connection-card-qoqR63NP.js → connection-card-C84CXoEt.js} +1 -1
- package/dist/client/assets/{connection-detail-BTXE_HXc.js → connection-detail-3J7QgUsN.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-B9JY5oaH.js → connection-form-helpers-vw6gzBiD.js} +1 -1
- package/dist/client/assets/{connection-slug-CP70si3t.js → connection-slug-CI3A8_ee.js} +1 -1
- package/dist/client/assets/{connections-D8py3O3a.js → connections-BHsWCRN2.js} +1 -1
- package/dist/client/assets/{content-tab-lkbVE2xf.js → content-tab-UCeaV9ZK.js} +3 -3
- package/dist/client/assets/{context-DH-yMERA.js → context-CqcUfuqw.js} +1 -1
- package/dist/client/assets/{context-menu-Da3prNKL.js → context-menu-DTU6qOVz.js} +1 -1
- package/dist/client/assets/{context-shell--6NpIOhl.js → context-shell-DqR6-S0A.js} +3 -3
- package/dist/client/assets/{core.esm-DJRh9rDF.js → core.esm-DCJ7aKR3.js} +1 -1
- package/dist/client/assets/{create-organization-dialog-BJJn8Tn9.js → create-organization-dialog-DKxaQrfF.js} +1 -1
- package/dist/client/assets/{delete-copy-p7sDnlSk.js → delete-copy-sYXKk3Pf.js} +1 -1
- package/dist/client/assets/{device-hint-Dz-Lgu6D.js → device-hint-D11AIkCQ.js} +1 -1
- package/dist/client/assets/{discover-DnaaaTAL.js → discover-DOTkM1SJ.js} +1 -1
- package/dist/client/assets/{domain-settings-rt-urBCE.js → domain-settings-DBmeAU8w.js} +1 -1
- package/dist/client/assets/{drawer-CSA_YXe9.js → drawer-DyYc7c6p.js} +1 -1
- package/dist/client/assets/{editor-BDmwWZXW.js → editor-Cx1cLsfT.js} +1 -1
- package/dist/client/assets/{editor-classes-BflxT3Em.js → editor-classes-5OQkwYAb.js} +1 -1
- package/dist/client/assets/{empty-message-CqeY7z6M.js → empty-message-BxCQf5X6.js} +1 -1
- package/dist/client/assets/{empty-state-BBFh_11d.js → empty-state-A6nZ3Khe.js} +1 -1
- package/dist/client/assets/{empty-state-Wyw1gzAU.js → empty-state-COfoPZ3l.js} +1 -1
- package/dist/client/assets/{experiments-tab-choice-D-e89e6v.js → experiments-tab-choice-DaaymsEH.js} +1 -1
- package/dist/client/assets/{extract-connection-data-Dcbv_gVC.js → extract-connection-data-Cfb1bv3l.js} +1 -1
- package/dist/client/assets/{feature-gate-Z7tVIxLA.js → feature-gate-CESZ0bbT.js} +1 -1
- package/dist/client/assets/{feature-paywall-DtbDRafp.js → feature-paywall-D4s9Ps36.js} +1 -1
- package/dist/client/assets/{file-explorer-CfNNkZY3.js → file-explorer-syldxbM0.js} +1 -1
- package/dist/client/assets/{file-preview-BIcXPFXf.js → file-preview-B5GYsNzx.js} +1 -1
- package/dist/client/assets/{file-share-button-CRptWZ51.js → file-share-button-O89-cSWp.js} +1 -1
- package/dist/client/assets/{file-type-icon-B8w_B6Ur.js → file-type-icon-CK3whZmM.js} +1 -1
- package/dist/client/assets/{folder-icon-DLenjLsE.js → folder-icon-B0bQ9NL4.js} +1 -1
- package/dist/client/assets/{form-fep7EsZM.js → form-CKh2Qm-8.js} +1 -1
- package/dist/client/assets/{frame-navigation-DuQkTvmc.js → frame-navigation-c9xPkylV.js} +1 -1
- package/dist/client/assets/{general-CXgCOcj0.js → general-4YbTEBSJ.js} +1 -1
- package/dist/client/assets/{github-icon-BmJmIA35.js → github-icon-D3u8oGuo.js} +1 -1
- package/dist/client/assets/{held-block-view-L4ScXyc0.js → held-block-view-9GD7sW5O.js} +1 -1
- package/dist/client/assets/{home-B8uWiLZ8.js → home-7FPOWVs4.js} +1 -1
- package/dist/client/assets/{home-overview-B4YOi7ww.js → home-overview-D_b45WGe.js} +1 -1
- package/dist/client/assets/{hosted-reconcile-TIWxrhyM.js → hosted-reconcile-j0Z_Am5O.js} +1 -1
- package/dist/client/assets/{icon-button-y7e4XAeL.js → icon-button-Bd1QIQSI.js} +1 -1
- package/dist/client/assets/{index-CNwv7lrZ.js → index-B1ZkAVAg.js} +1 -1
- package/dist/client/assets/{index-DVZtQRVw.js → index-BK7R90SQ.js} +1 -1
- package/dist/client/assets/{index-ChH0sLX7.js → index-BUdfGMTq.js} +1 -1
- package/dist/client/assets/{index-CWyPzcrL.js → index-BqA84bKQ.js} +5 -5
- package/dist/client/assets/{index-CmAlUJfb.js → index-BtpIwkuJ.js} +1 -1
- package/dist/client/assets/{index-CVAn8xNL.js → index-Bx5tjmDd.js} +1 -1
- package/dist/client/assets/{index-ixp03eW8.js → index-BzeTLGQv.js} +1 -1
- package/dist/client/assets/{index-CMsvPj3a.js → index-CB2dsreI.js} +1 -1
- package/dist/client/assets/{index-Bvx7roR3.js → index-CC3v5-e4.js} +1 -1
- package/dist/client/assets/{index-CMmFyekL.js → index-ClzeL0fX.js} +1 -1
- package/dist/client/assets/{index-C2ij8p-x.js → index-Ctd-FMgv.js} +1 -1
- package/dist/client/assets/{index-D19_uhum.js → index-D1SFZrX0.js} +1 -1
- package/dist/client/assets/{index-CHutq_y1.js → index-DdNgZUci.js} +1 -1
- package/dist/client/assets/{index-DvJkVFQT.js → index-Dnajt-Ss.js} +1 -1
- package/dist/client/assets/{index-Dj0a2kN-.js → index-HLnjLjm4.js} +1 -1
- package/dist/client/assets/{index-6bDgVJQF.js → index-RtIgAXvS.js} +1 -1
- package/dist/client/assets/{index-pvUDeJng.js → index-mWjBJsbL.js} +1 -1
- package/dist/client/assets/{index-redirect-D4F9QPKL.js → index-redirect-DqohMHdx.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-OShuiwgE.js → infiniteQueryObserver-amUGbo-h.js} +1 -1
- package/dist/client/assets/{infra-billing-CWpsn-Rt.js → infra-billing-aV_8QlC0.js} +1 -1
- package/dist/client/assets/{input-BgfY5gpb.js → input-CfL5_z7D.js} +3 -3
- package/dist/client/assets/{input-DTQsyDJB.js → input-D3jDgHNU.js} +1 -1
- package/dist/client/assets/{integration-icon-C_WzTScv.js → integration-icon-C9sCBDDr.js} +1 -1
- package/dist/client/assets/{item-actions-DXH2d6Fe.js → item-actions-DxYkkZP8.js} +1 -1
- package/dist/client/assets/{jira-icon-D56pw7mD.js → jira-icon-CcSFFwnZ.js} +1 -1
- package/dist/client/assets/{label-Cf_dlQhi.js → label-Ducx0j9M.js} +1 -1
- package/dist/client/assets/{layout-CtDg9WFK.js → layout-DCetvNif.js} +1 -1
- package/dist/client/assets/{legacy-admin-welcome-dialog-Bh63ptd4.js → legacy-admin-welcome-dialog-C1mvlaj8.js} +1 -1
- package/dist/client/assets/{legacy-agents-deep-j_eDHMz_.js → legacy-agents-deep-BrG2c50d.js} +1 -1
- package/dist/client/assets/{legacy-main-redirect-C9oF56pC.js → legacy-main-redirect-B0LLa-b2.js} +1 -1
- package/dist/client/assets/library-D0Nyw5vF.js +1 -0
- package/dist/client/assets/{library-tab-B0xPdiji.js → library-tab-y1C-Q300.js} +1 -1
- package/dist/client/assets/{login-XaVtTkis.js → login-DnAhZq8E.js} +1 -1
- package/dist/client/assets/{markdown-DCvPsl1N.js → markdown-DTS1cwWT.js} +1 -1
- package/dist/client/assets/{mcp-app-renderer-DBs207iT.js → mcp-app-renderer-DEXD8Qqv.js} +1 -1
- package/dist/client/assets/{mcp-oauth-DOQO_m1D.js → mcp-oauth-C8CUMukq.js} +1 -1
- package/dist/client/assets/{mcp-oauth-CciCTLp9.js → mcp-oauth-CMXtLqpM.js} +1 -1
- package/dist/client/assets/{members-CL8zrENK.js → members-CUn6ovIa.js} +1 -1
- package/dist/client/assets/{memory-C0eybouW.js → memory-DEndhGVA.js} +1 -1
- package/dist/client/assets/{mock-board-iZzwB0Ec.js → mock-board-hNoqXmUR.js} +3 -3
- package/dist/client/assets/{monaco-editor-BjOCHD6R.js → monaco-editor-BKbGnxf4.js} +1 -1
- package/dist/client/assets/{monitoring-auJHCqSG.js → monitoring-T940h_oR.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-D-1eXI4W.js → monitoring-stats-row-2tRkF4-m.js} +1 -1
- package/dist/client/assets/{multi-select-C7KaI7rL.js → multi-select-GBdcv1ph.js} +1 -1
- package/dist/client/assets/{mustache-Dm8yyGpD.js → mustache-CNh4n0Td.js} +1 -1
- package/dist/client/assets/{named-rule-step-DLS79yYb.js → named-rule-step-7q8hws5D.js} +1 -1
- package/dist/client/assets/{named-rule-view-Bgyvi0X-.js → named-rule-view-cnpqxYzZ.js} +1 -1
- package/dist/client/assets/{new-project-dialog-uK1Ixj7a.js → new-project-dialog-BOtGKQPA.js} +1 -1
- package/dist/client/assets/{oauth-callback-xd-D45xF.js → oauth-callback-DG0XUetw.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-xMCIdlQV.js → oauth-callback-ai-provider-DeIO_gxm.js} +1 -1
- package/dist/client/assets/{oauth-consent-BH8-t4eI.js → oauth-consent-D-6r1X7a.js} +1 -1
- package/dist/client/assets/{onboarding-C46p79BL.js → onboarding-CWuOwe9b.js} +1 -1
- package/dist/client/assets/{openai-conversation-LX4vhoSF.js → openai-conversation-DLhmBPPN.js} +1 -1
- package/dist/client/assets/{optimistic-project-sidebar-views-CQDM5Smz.js → optimistic-project-sidebar-views-CvZPbOqN.js} +1 -1
- package/dist/client/assets/{order-monitor-day-CdZki-hX.js → order-monitor-day-CyPFX5Di.js} +1 -1
- package/dist/client/assets/{organization-choice-C2R9F9mc.js → organization-choice-Cw-WUBNy.js} +1 -1
- package/dist/client/assets/{orgs-HpCUPqLm.js → orgs-BiS6luDN.js} +1 -1
- package/dist/client/assets/{own-accounts-section-Bj2ZQcZp.js → own-accounts-section-BqkowOV8.js} +1 -1
- package/dist/client/assets/{pair-CZjLWCpF.js → pair-NNIqbXGE.js} +1 -1
- package/dist/client/assets/{parse-sections-C-6WrwoU.js → parse-sections-D5t3BRqc.js} +3 -3
- package/dist/client/assets/{plan-z7jyUflE.js → plan-D05Kl9P6.js} +1 -1
- package/dist/client/assets/{plan-ladder-K1-uMNFn.js → plan-ladder-CiVpDo1G.js} +1 -1
- package/dist/client/assets/{plan-usage-card-ByfsqyV3.js → plan-usage-card-DRsDd5Ch.js} +1 -1
- package/dist/client/assets/{popover-L7EmpGzG.js → popover-fDNjdHxM.js} +1 -1
- package/dist/client/assets/{post-calendar-CrzSJ4wO.js → post-calendar-CgP7AZe7.js} +1 -1
- package/dist/client/assets/{post-editor-D6PvmOkx.js → post-editor-fRXyfFpy.js} +1 -1
- package/dist/client/assets/{preview-content-BdQavgtT.js → preview-content-DkAXLl1L.js} +1 -1
- package/dist/client/assets/{preview-dialog-DRt8NRQg.js → preview-dialog-N7_y9qxA.js} +1 -1
- package/dist/client/assets/{preview-panel-C7R9FzB7.js → preview-panel-oVdKWth1.js} +1 -1
- package/dist/client/assets/{preview-tab-DE998jcM.js → preview-tab-BWI7aVoc.js} +3 -3
- package/dist/client/assets/{product-picker-dialog-CasJjhcc.js → product-picker-dialog-Dr51YJVY.js} +1 -1
- package/dist/client/assets/{profile-DaVD3rXx.js → profile-BXOGbnau.js} +1 -1
- package/dist/client/assets/{project-app-view-BgNgayQ9.js → project-app-view-Dn9IxbKG.js} +1 -1
- package/dist/client/assets/{project-apps-9RUwCLHJ.js → project-apps-DN56tnxe.js} +1 -1
- package/dist/client/assets/{project-icon-DCOepmMu.js → project-icon-C60MdZm4.js} +1 -1
- package/dist/client/assets/{project-index-kHTy1V43.js → project-index-Dv-ZwV38.js} +1 -1
- package/dist/client/assets/project-reports-yBeAoZj_.js +1 -0
- package/dist/client/assets/project-tasks-Da304fiF.js +1 -0
- package/dist/client/assets/{projects-Cfrtdtxw.js → projects-By-y5Jp6.js} +1 -1
- package/dist/client/assets/{projects-empty-state-BOqzKLFM.js → projects-empty-state-N3hmoiH1.js} +1 -1
- package/dist/client/assets/{prompts-CeNm4O78.js → prompts-DTm9aAYf.js} +1 -1
- package/dist/client/assets/{record-editor-BDc47aTz.js → record-editor-PaaqLZHk.js} +1 -1
- package/dist/client/assets/{redirect-editor-B5YbT02W.js → redirect-editor-B2Eu0M_z.js} +1 -1
- package/dist/client/assets/reports-D1vOcKYh.js +1 -0
- package/dist/client/assets/{reports-onboarding-BF3nb40S.js → reports-onboarding-i6k1gG6Q.js} +1 -1
- package/dist/client/assets/{reports-yqXMJIxG.js → reports-sOqJNuXD.js} +1 -1
- package/dist/client/assets/{reports-tab-CGHZrbkt.js → reports-tab-DSRN7hVk.js} +2 -2
- package/dist/client/assets/repositories-BeyQS9t-.js +1 -0
- package/dist/client/assets/{repositories-Dxg6NBM0.js → repositories-BrLF1Aq0.js} +1 -1
- package/dist/client/assets/{repository-binding-SYfLLQPp.js → repository-binding-CekCSlJ1.js} +1 -1
- package/dist/client/assets/{repository-picker-CbFl2YYE.js → repository-picker-UWrxu6_V.js} +1 -1
- package/dist/client/assets/{require-capability-BiwpdxIn.js → require-capability-C5tMOw5q.js} +1 -1
- package/dist/client/assets/{required-auth-layout-DFuLVB75.js → required-auth-layout-Cpnwi031.js} +1 -1
- package/dist/client/assets/{reset-password-HUKzr46F.js → reset-password-BYIakrjI.js} +1 -1
- package/dist/client/assets/{resizable-CmCl4ei7.js → resizable-Czy-co3c.js} +1 -1
- package/dist/client/assets/{resolve-tab-icon-BjnMFr70.js → resolve-tab-icon-C3kFsoiU.js} +1 -1
- package/dist/client/assets/{review-settings-CA-nqHST.js → review-settings-frbemaNj.js} +1 -1
- package/dist/client/assets/{role-color-boYo8Hxk.js → role-color-BjM31aAV.js} +1 -1
- package/dist/client/assets/{roles-B5mCkh61.js → roles-BSFp9Lh1.js} +1 -1
- package/dist/client/assets/{route-_4HjzOd2.js → route-BiurJAiU.js} +1 -1
- package/dist/client/assets/{route-B6oRH5TC.js → route-DCjkGlFk.js} +1 -1
- package/dist/client/assets/route-Dghp6bLe.js +1 -0
- package/dist/client/assets/sandbox-git-api-WjmMCJsj.js +1 -0
- package/dist/client/assets/{sandbox-lifecycle-context-Dz7l9f2x.js → sandbox-lifecycle-context-Ba3XN5SW.js} +1 -1
- package/dist/client/assets/{save-status-C-e1JPTQ.js → save-status-CaR8n7_Z.js} +1 -1
- package/dist/client/assets/{schema-821-vfww.js → schema-CXcca4Yf.js} +1 -1
- package/dist/client/assets/{schema-CLtIHsoR.js → schema-CZJq0dLP.js} +1 -1
- package/dist/client/assets/{scroll-area-Jht8lpyk.js → scroll-area-CFXsBb2M.js} +1 -1
- package/dist/client/assets/{search-input-B93QU4Dy.js → search-input-SNpnMeEh.js} +1 -1
- package/dist/client/assets/{search-toggle-tlJ3SbIE.js → search-toggle-cAgGYPjr.js} +1 -1
- package/dist/client/assets/{secret-picker-CAALtPpd.js → secret-picker-CoNx1OUZ.js} +1 -1
- package/dist/client/assets/{secrets-C80xJsHQ.js → secrets-7PqmB5m-.js} +1 -1
- package/dist/client/assets/{section-array-field-CBZsskhA.js → section-array-field-BPHe_2nS.js} +1 -1
- package/dist/client/assets/{sections-B_HR2jtY.js → sections-DIGnapH7.js} +1 -1
- package/dist/client/assets/sections-editor-BPeB4JuU.js +1 -0
- package/dist/client/assets/{select-e2tvI61e.js → select-DKwtgT2c.js} +1 -1
- package/dist/client/assets/{select-model-M3nxcPkm.js → select-model-bK-HmI0T.js} +1 -1
- package/dist/client/assets/{seo-editor-DEOahzw6.js → seo-editor-B8a-ygHx.js} +1 -1
- package/dist/client/assets/{separator-BI2slX_5.js → separator-BvEs4sKx.js} +1 -1
- package/dist/client/assets/settings-tab-V10cXQt_.js +1 -0
- package/dist/client/assets/{sheet-DvkksJq0.js → sheet-Cn6zqTHK.js} +1 -1
- package/dist/client/assets/{shell-layout-BCfYpYFh.js → shell-layout-CMWsc7Ga.js} +1 -1
- package/dist/client/assets/site-draft-actions-Dqjp6JXE.js +5 -0
- package/dist/client/assets/{site-draft-view-DVJ5_AAD.js → site-draft-view-DMbuCO3k.js} +1 -1
- package/dist/client/assets/site-editor-BhMaxdEz.js +1 -0
- package/dist/client/assets/{site-editor-toast-B030LZGc.js → site-editor-toast-BTadFdcN.js} +1 -1
- package/dist/client/assets/{skills-DU3JvR9H.js → skills-BO2UAT-k.js} +1 -1
- package/dist/client/assets/{slider-BqNz0Q_x.js → slider-C8eFjzSI.js} +1 -1
- package/dist/client/assets/{sortable.esm-Dgvk_55x.js → sortable.esm-C-oiWjvx.js} +1 -1
- package/dist/client/assets/{sso-B36MJWf3.js → sso-CajDON15.js} +1 -1
- package/dist/client/assets/{suggestion-DjTd4iW-.js → suggestion-SovccGL1.js} +1 -1
- package/dist/client/assets/{super-agent-icon-BFe-gjNi.js → super-agent-icon-BPwu34XK.js} +1 -1
- package/dist/client/assets/{switch-CVqJR3dk.js → switch-CaR5PIVi.js} +1 -1
- package/dist/client/assets/{synced-repos-CdEL5OLa.js → synced-repos-DVx1NnZs.js} +1 -1
- package/dist/client/assets/{tab-icon-glyph-we-DMaKk.js → tab-icon-glyph-BWlOwicm.js} +1 -1
- package/dist/client/assets/{table-DyAbyTkr.js → table-GheKU3yj.js} +1 -1
- package/dist/client/assets/{tabs-RDxPTimY.js → tabs-1aecnZxz.js} +1 -1
- package/dist/client/assets/{task-board-CNxFcEEU.js → task-board-DYqWLLmQ.js} +1 -1
- package/dist/client/assets/{task-route-BY8SQPrf.js → task-route-lZI9xEQu.js} +1 -1
- package/dist/client/assets/{task-status-BQ9l-imv.js → task-status-sKuwZfC5.js} +1 -1
- package/dist/client/assets/{taskboard-analytics-D-fKcUTx.js → taskboard-analytics-CC44Sfeb.js} +1 -1
- package/dist/client/assets/tasks-ChIHxZhb.js +1 -0
- package/dist/client/assets/{tasks-H_163psh.js → tasks-QuF-w60s.js} +1 -1
- package/dist/client/assets/{textarea-D8L9nIm0.js → textarea-BC5J6m5c.js} +1 -1
- package/dist/client/assets/{thread-analytics-B6wRhPTZ.js → thread-analytics--cpXNe0v.js} +1 -1
- package/dist/client/assets/{thread-intent-BoKpDkXm.js → thread-intent-DWdkWFbM.js} +1 -1
- package/dist/client/assets/{thread-route-D-qV5LOQ.js → thread-route-TkYSs_wZ.js} +1 -1
- package/dist/client/assets/{thread-route-CjhH3Hve.js → thread-route-zZ-NhxUn.js} +1 -1
- package/dist/client/assets/{thread-sheet-body-BmxCKr5-.js → thread-sheet-body-BYVjGhFL.js} +1 -1
- package/dist/client/assets/{time-range-picker-BI1bqfR0.js → time-range-picker-DMCZWDg9.js} +1 -1
- package/dist/client/assets/{toggle-group-C9F5Qvi7.js → toggle-group-BGTfs-aX.js} +1 -1
- package/dist/client/assets/{tool-namespace-Cwe3IZ6z.js → tool-namespace-D1tEk-rn.js} +1 -1
- package/dist/client/assets/{tool-set-selector-BIHpKu9L.js → tool-set-selector-E3d0uIwk.js} +1 -1
- package/dist/client/assets/{toolbar-icon-button-C4QFd50C.js → toolbar-icon-button-utT3ySvv.js} +1 -1
- package/dist/client/assets/{tooltip-C-0kDxkl.js → tooltip-TH6OTMa1.js} +1 -1
- package/dist/client/assets/{tooltipContext-DjUViqx9.js → tooltipContext-DvIDN2Xh.js} +1 -1
- package/dist/client/assets/{track-DWFP8jCm.js → track-BgU3Gaat.js} +1 -1
- package/dist/client/assets/{types-DrwTBhGr.js → types-CUaVQ6GM.js} +1 -1
- package/dist/client/assets/{url-slug-xvxPIesW.js → url-slug-U3fC_LSu.js} +1 -1
- package/dist/client/assets/{usage-stats-BFAUXiEn.js → usage-stats-BgRx8ojv.js} +1 -1
- package/dist/client/assets/{use-ai-providers-Drq9rd-R.js → use-ai-providers-BQ4cXHYk.js} +1 -1
- package/dist/client/assets/{use-apply-named-rule-BqLt_ETT.js → use-apply-named-rule-BkzR-L_k.js} +1 -1
- package/dist/client/assets/use-ask-in-chat-D9_rhHLE.js +1 -0
- package/dist/client/assets/{use-automations-DnYKYkJG.js → use-automations-D73FKpK0.js} +1 -1
- package/dist/client/assets/{use-autosave-BxcdTX-O.js → use-autosave-DnSqypPy.js} +1 -1
- package/dist/client/assets/use-blocks-v8-project-DVyeNJpE.js +1 -0
- package/dist/client/assets/{use-chat-layout-state-CIpS2ixg.js → use-chat-layout-state-DhWMeYGY.js} +1 -1
- package/dist/client/assets/use-cms-publish-actions-DYW-ZBMI.js +10 -0
- package/dist/client/assets/{use-connect-companion-ortXPeJY.js → use-connect-companion-DSAJf4aL.js} +1 -1
- package/dist/client/assets/{use-connection-CoSLklxV.js → use-connection-Cm2NxfjB.js} +1 -1
- package/dist/client/assets/{use-content-sync-BvIburw3.js → use-content-sync-BYfkK2UQ.js} +1 -1
- package/dist/client/assets/{use-copy-ChDt5LN5.js → use-copy-D19rl06v.js} +1 -1
- package/dist/client/assets/{use-date-fns-locale-6TxnLgf0.js → use-date-fns-locale-DRwJQrtP.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-DuzJ4VFK.js → use-debounced-autosave-ByXvCGtw.js} +1 -1
- package/dist/client/assets/{use-debounced-value-CPC4qMn_.js → use-debounced-value-CbRaNTJb.js} +1 -1
- package/dist/client/assets/{use-deco-credits-Cct8YuxZ.js → use-deco-credits-BzZax3AU.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-DrQkcg1u.js → use-decopilot-events-DjBmVlF5.js} +1 -1
- package/dist/client/assets/{use-delete-block-CZz_ptBE.js → use-delete-block-Bmw2DEn_.js} +1 -1
- package/dist/client/assets/{use-delete-connection-CpvyLSMF.js → use-delete-connection-XfH3saNO.js} +1 -1
- package/dist/client/assets/{use-deployment-admin-DqLzMbx4.js → use-deployment-admin-E8whHqZV.js} +1 -1
- package/dist/client/assets/{use-entitlements-BTXwUzEe.js → use-entitlements-CrqU38x1.js} +1 -1
- package/dist/client/assets/{use-fast-preview-draft-url-BpU8VWnC.js → use-fast-preview-draft-url-Br8m5G_K.js} +1 -1
- package/dist/client/assets/{use-file-configs-DlI3360C.js → use-file-configs-Cb7TGwCU.js} +1 -1
- package/dist/client/assets/{use-id-selection-q64VX8pH.js → use-id-selection-BKmrVwI0.js} +1 -1
- package/dist/client/assets/{use-inbox-feed-BXQf8xik.js → use-inbox-feed-pHAZt3_K.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-DToG_mXG.js → use-infinite-scroll-BkFOSUvv.js} +1 -1
- package/dist/client/assets/{use-join-requests-BkEJmRDc.js → use-join-requests-CJn0V1s3.js} +1 -1
- package/dist/client/assets/{use-main-panel-tabs-dGK32Zdd.js → use-main-panel-tabs-BmFZ-_OL.js} +1 -1
- package/dist/client/assets/{use-mcp-auth-status-CMiOMa1q.js → use-mcp-auth-status-4GKPMGKk.js} +1 -1
- package/dist/client/assets/{use-mcp-client-BJYqkCGO.js → use-mcp-client-d3hjTGOk.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-L17hBbZI.js → use-mcp-prompts-D9iX-pNG.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-BmsHVJ_e.js → use-mcp-tools-4sj0IJhc.js} +1 -1
- package/dist/client/assets/{use-mobile-BZxtzMj7.js → use-mobile-BSwhKw5s.js} +1 -1
- package/dist/client/assets/{use-move-blocks-BhC8Ou_b.js → use-move-blocks-DUZO8kls.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-v5tv9KVo.js → use-navigate-to-agent-ClknH49I.js} +1 -1
- package/dist/client/assets/{use-never-published-ftzoQCEb.js → use-never-published-Ct02Nsux.js} +1 -1
- package/dist/client/assets/{use-org-fs-DwXaWmOv.js → use-org-fs-Tz3YgtJ1.js} +1 -1
- package/dist/client/assets/{use-org-repo-syncs-C9CNVJm1.js → use-org-repo-syncs-BzT6K1ie.js} +1 -1
- package/dist/client/assets/{use-org-sso-BxQ8a0VK.js → use-org-sso-DKQA9PvY.js} +1 -1
- package/dist/client/assets/{use-organization-settings-DNlKPHFq.js → use-organization-settings-O_jt8YRI.js} +1 -1
- package/dist/client/assets/{use-project-native-view-presence-AFSL4S75.js → use-project-native-view-presence-DFdZfmUA.js} +1 -1
- package/dist/client/assets/{use-project-scope-Fr7Egb1F.js → use-project-scope-CDU7oHZd.js} +1 -1
- package/dist/client/assets/{use-recent-apps-BEYnfhfp.js → use-recent-apps-SulI7knF.js} +1 -1
- package/dist/client/assets/{use-reports-diagnostic-2pn_94P0.js → use-reports-diagnostic-DvKdZxC0.js} +1 -1
- package/dist/client/assets/{use-sandbox-events-jMtZqiMa.js → use-sandbox-events-f-PdmD_K.js} +1 -1
- package/dist/client/assets/{use-secrets-CBdbQcuQ.js → use-secrets-iJZc87R8.js} +1 -1
- package/dist/client/assets/{use-section-preview-base-J9b63pbx.js → use-section-preview-base-DlVsTPHR.js} +1 -1
- package/dist/client/assets/{use-sidebar-collapsed-BfQVGyVT.js → use-sidebar-collapsed-BXzuI2Yh.js} +1 -1
- package/dist/client/assets/{use-tags-BEbkxwEv.js → use-tags-szK0WGVw.js} +1 -1
- package/dist/client/assets/{use-task-board-analytics-CjF5lq2A.js → use-task-board-analytics-Dsx3ztNk.js} +1 -1
- package/dist/client/assets/{use-task-board-events-ube60SA0.js → use-task-board-events-bOYbxitP.js} +1 -1
- package/dist/client/assets/{use-task-board-item-prs-nU2PcUzp.js → use-task-board-item-prs-DXBDSC_j.js} +1 -1
- package/dist/client/assets/{use-task-board-items-Di-1rSrZ.js → use-task-board-items-2NnjAMJe.js} +1 -1
- package/dist/client/assets/{use-task-board-prompts-BDQ8kbX2.js → use-task-board-prompts-BnnaRxj0.js} +1 -1
- package/dist/client/assets/{use-task-metadata-DrDAhZTp.js → use-task-metadata-GAS3u4HU.js} +1 -1
- package/dist/client/assets/{use-thread-outputs-Ch3NEbJD.js → use-thread-outputs-D6gtHOkS.js} +1 -1
- package/dist/client/assets/{use-view-draft-kind-C5ojzKhH.js → use-view-draft-kind-vGVmYJM5.js} +1 -1
- package/dist/client/assets/{use-voice-input-DHuYIV5W.js → use-voice-input-B4K2dw_4.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-DAPRIetj.js +1 -0
- package/dist/client/assets/{useQueries-PCnHBPMW.js → useQueries-CkzTLDl3.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-D1yN9E9_.js +1 -0
- package/dist/client/assets/{users-y7gdQpb2.js → users-BAENndTE.js} +1 -1
- package/dist/client/assets/{utils-DZ4Tq9_F.js → utils-GS2Z_6Er.js} +1 -1
- package/dist/client/assets/{variant-calendar-Jezxzb2B.js → variant-calendar-DhSlXJST.js} +1 -1
- package/dist/client/assets/{variant-matcher-override-R9Ip3akP.js → variant-matcher-override-DBCe5xDS.js} +1 -1
- package/dist/client/assets/{view-header-DQwHRwa3.js → view-header-BkLkYp5J.js} +1 -1
- package/dist/client/assets/{virtual-mcp-BMNTjIAW.js → virtual-mcp-D-X8xp1B.js} +1 -1
- package/dist/client/assets/{watch-sse-pool-CR6i9l-S.js → watch-sse-pool-BhRvBapO.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/server.js +693 -693
- package/package.json +1 -1
- package/dist/client/assets/agent-app-C3awWskd.js +0 -1
- package/dist/client/assets/agent-deck-CQmtmyYp.js +0 -1
- package/dist/client/assets/agent-experiments-BNt-4I9S.js +0 -1
- package/dist/client/assets/agent-library-Ggp4u0Nt.js +0 -1
- package/dist/client/assets/agent-library-file--sN5r5DJ.js +0 -1
- package/dist/client/assets/agent-overview-4OlQ8oKX.js +0 -1
- package/dist/client/assets/agent-settings-CVXhUEvS.js +0 -1
- package/dist/client/assets/agent-site-editor-code-DmCPSKgw.js +0 -2
- package/dist/client/assets/agent-site-editor-content-cBVAi7GZ.js +0 -1
- package/dist/client/assets/agent-site-editor-preview-kwoTpAUq.js +0 -1
- package/dist/client/assets/agent-view-BLlyMWQJ.js +0 -1
- package/dist/client/assets/api-keys-CN81fd1q.js +0 -1
- package/dist/client/assets/library-Bl-LzTcJ.js +0 -1
- package/dist/client/assets/project-reports-SFE87SXv.js +0 -1
- package/dist/client/assets/project-tasks-CZgEt2Vy.js +0 -1
- package/dist/client/assets/reports-CGHHsIAg.js +0 -1
- package/dist/client/assets/repositories-CXahUI4R.js +0 -1
- package/dist/client/assets/route-BGFrmL98.js +0 -1
- package/dist/client/assets/sandbox-git-api-DcqI6XE4.js +0 -1
- package/dist/client/assets/sections-editor-EHDr6zm_.js +0 -1
- package/dist/client/assets/settings-tab-CU7bs3DW.js +0 -1
- package/dist/client/assets/site-draft-actions-qfCZ-0Ms.js +0 -3
- package/dist/client/assets/site-editor-Cm6TtNkp.js +0 -1
- package/dist/client/assets/tasks-CWBTMAuG.js +0 -1
- package/dist/client/assets/use-ask-in-chat-DRRgH5qP.js +0 -1
- package/dist/client/assets/use-blocks-v8-project-Ce_mrKLc.js +0 -1
- package/dist/client/assets/use-cms-publish-actions-CFC3bJmB.js +0 -10
- package/dist/client/assets/useInfiniteQuery--BgI5-DV.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-B_FBCJuI.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as N,q as G,i as C,K as g,er as Qe,cs as Bn,aF as Lt,aG as K,bl as Ce,bt as Fn,dA as Ie,dy as Vn,es as ye,et as Hn,eu as Jn,r as L,ev as Wn,ew as Y,ex as Z,bz as Gn,a as Yn,at as Te,a4 as zn,bv as Ut,ey as Xn,ez as Qt,ar as Zn,bp as B,ea as Ct,eA as qn,eB as Kn,eC as eo,t as ne,j as X}from"./index-CWyPzcrL.js";import{u as Be}from"./repository-binding-SYfLLQPp.js";import{e as Bt}from"./backoff-CrEUbyZT.js";import{b as Se}from"./sandbox-url-D3mC8qhT.js";import{u as to}from"./chat-context--RKzWa6k.js";import{i as no,u as oo}from"./use-sandbox-events-jMtZqiMa.js";import{u as Fe}from"./use-blocks-v8-project-Ce_mrKLc.js";import{u as Ft}from"./use-voice-input-DHuYIV5W.js";import{s as ft}from"./thread-intent-BoKpDkXm.js";import{s as so}from"./utils-DZ4Tq9_F.js";import{a as ro}from"./sandbox-git-api-DcqI6XE4.js";const w={MethodNotFound:-32601,InvalidParams:-32602,InternalError:-32603,NotFound:-32001,Conflict:-32002,InvalidBlock:-32003,ReadOnly:-32005,Unsupported:-32006,LimitExceeded:-32007,Unavailable:-32008,Unauthorized:-32010};class y 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 y(t.code,t.message,t.data)}}const te="deco-content",Re={major:1},Vt=1;async function io(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 xe={major:Re.major,minor:Vt},Ht=`the endpoint speaks an older ${te} than this client needs (${xe.major}.${xe.minor} or newer): update @decocms/blocks in the site (8.2.0 or newer) and start deco serve again`;function ae(e,t,n){const o={reason:t,required:{...xe}};if(n){o.actual={protocol:n.protocol,major:n.version?.major,minor:n.version?.minor};const s=n.server;typeof s?.name=="string"&&typeof s.version=="string"&&(o.server={name:s.name,version:s.version})}return new y(w.Unsupported,e,o)}function Jt(e){const t=e??{},{protocol:n,version:o}=t;if(n!==te)throw ae(`the endpoint speaks ${JSON.stringify(n)}, not ${te}`,"protocol",t);if(o?.major!==Re.major)throw ae(`the endpoint speaks ${te} ${String(o?.major)}.x; this client speaks ${Re.major}.x`,"major",t);if(typeof o.minor!="number"||o.minor<Vt)throw ae(Ht,"outdated",t);return e}function dt(e,t){return t.code===w.MethodNotFound&&e.startsWith("changes.")?ae(Ht,"outdated"):y.from(t)}function Ve(e){const t=e.fetch??(r=>fetch(r));let n=1;async function o(r){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(r)}));let c;try{c=await io(a)}catch{throw new y(w.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?y.from(l):new y(w.Unavailable,`the endpoint answered HTTP ${a.status}`)}return c}const s=async(r,i)=>{const a=n++,c=await o({jsonrpc:"2.0",id:a,method:r,params:i??{}});if(c.error)throw dt(r,c.error);return c.result};return{call:s,describe:async()=>Jt(await s("describe")),schemaGet:r=>s("schema.get",r),blocksList:r=>s("blocks.list",r),blocksApply:r=>s("blocks.apply",r),changesList:r=>s("changes.list",r),changesGet:r=>s("changes.get",r),changesDiscard:r=>s("changes.discard",r),async batch(r){const i=r.map(()=>n++),a=await o(r.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 d=c.get(l);return d?d.error?{ok:!1,error:dt(r[u].method,d.error)}:{ok:!0,result:d.result}:{ok:!1,error:new y(w.InternalError,"no response for this call")}})}}}function He(e){return e&&!e.edited?{ifNoneMatch:e.revision}:{}}const ht=20,gt=5,vt=500;function Je(e){return e instanceof y?e.code===w.MethodNotFound?!0:e.code===w.Unsupported&&e.data?.reason==="outdated":!1}function de(e,t,n=e){return n&&n!==e?n:t.notModified?e?{...e,base:t.base}:null:{revision:t.revision,base:t.base,changes:t.changes}}async function ao(e,t,n){const o=g.contentChanges(n),s=e.getQueryData(o),r=await t.changesList(He(s)),i=de(s,r,e.getQueryData(o));if(i)return i;const a=await t.changesList({}),c=de(void 0,a,e.getQueryData(o));if(!c)throw new y(w.InternalError,"changes.list returned notModified without a cached list");return c}async function Wt(e,t){const n=[];for(let r=0;r<t.length;r+=ht)n.push(t.slice(r,r+ht));const o=Object.create(null),s=[];for(let r=0;r<n.length;r+=gt){const i=await e.batch(n.slice(r,r+gt).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),s.push(...c.diagnostics)}}return{entries:o,diagnostics:s}}async function Ar(e,t){let n={revision:"",versions:{}};for(let o=0;o<t.length;o+=vt){const s=t.slice(o,o+vt),r=await e.changesDiscard({names:s.map(i=>i.name),ifMatch:Object.fromEntries(s.map(i=>[i.name,i.version]))});n={revision:r.revision,versions:{...n.versions,...r.versions}}}return n}function Mr(e){return e instanceof y&&e.code===w.Conflict}function We(e){return e?.kind==="protocol"?e:null}function Lr(e,t,n){const o=N.c(14);let s;o[0]!==n?(s={},o[0]=n,o[1]=s):s=o[1];const r=s,i=G();let a;o[2]!==e?(a=We(e),o[2]=e,o[3]=a):a=o[3];const c=a,l=!!c&&!!t&&r.enabled!==!1;let u;o[4]!==t?(u=g.contentChanges(t??""),o[4]=t,o[5]=u):u=o[5];let d;o[6]!==t||o[7]!==l||o[8]!==c||o[9]!==i?(d=l?()=>ao(i,c.client,t):Qe,o[6]=t,o[7]=l,o[8]=c,o[9]=i,o[10]=d):d=o[10];let f;return o[11]!==u||o[12]!==d?(f={queryKey:u,queryFn:d,staleTime:0},o[11]=u,o[12]=d,o[13]=f):f=o[13],C(f)}function co(e){if(!e)return"";const t=Object.entries(e.changes).sort(([n],[o])=>n<o?-1:n>o?1:0).map(([n,o])=>[n,o.kind,o.version,o.baseVersion]);return JSON.stringify([e.revision,e.base.revision,e.base.resolvedRef,t])}function Ur(e,t,n){const o=N.c(14);let s;o[0]!==e?(s=We(e),o[0]=e,o[1]=s):s=o[1];const r=s;let i;o[2]!==n?(i=n?Object.keys(n.changes):[],o[2]=n,o[3]=i):i=o[3];const a=i,c=!!r&&!!t&&!!n&&a.length>0;let l;o[4]!==t||o[5]!==n?(l=g.contentChangeSides(t??"",co(n)),o[4]=t,o[5]=n,o[6]=l):l=o[6];let u;o[7]!==c||o[8]!==a||o[9]!==r?(u=c?()=>Wt(r.client,a):Qe,o[7]=c,o[8]=a,o[9]=r,o[10]=u):u=o[10];let d;return o[11]!==l||o[12]!==u?(d={queryKey:l,queryFn:u,staleTime:Number.POSITIVE_INFINITY},o[11]=l,o[12]=u,o[13]=d):d=o[13],C(d)}function Qr(e,t,n){const o=N.c(16);let s;o[0]!==e?(s=We(e),o[0]=e,o[1]=s):s=o[1];const r=s;let i,a,c,l;if(o[2]!==t||o[3]!==n?.changes||o[4]!==r){const f=Object.entries(n?.changes??{}).filter(go).map(ho).sort(fo);a=f.map(uo);const h=JSON.stringify(f.map(lo));i=!!r&&!!t&&a.length>0,l=C,c=g.contentDeletedCopies(t??"",h),o[2]=t,o[3]=n?.changes,o[4]=r,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]!==r?(u=i?async()=>{const f=await Wt(r.client,a),h=Object.create(null);for(const[v,b]of Object.entries(f.entries))h[v]=b.before&&typeof b.before=="object"?b.before:null;return h}:Qe,o[9]=i,o[10]=a,o[11]=r,o[12]=u):u=o[12];let d;return o[13]!==c||o[14]!==u?(d={queryKey:c,queryFn:u,staleTime:Number.POSITIVE_INFINITY,placeholderData:Bn},o[13]=c,o[14]=u,o[15]=d):d=o[15],l(d)}function lo(e){return[e.name,e.base]}function uo(e){return e.name}function fo(e,t){return e.name<t.name?-1:e.name>t.name?1:0}function ho(e){const[t,n]=e;return{name:t,base:n.baseVersion??""}}function go(e){const[,t]=e;return t.kind==="delete"}function Gt(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 he(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 Yt=Lt({endpoint:K().max(2048).refine(e=>Gt(e)&&new URL(e).pathname==="/rpc").transform(he)});function Cr(e){const t=new URLSearchParams(e.replace(/^#/,"")),n=Yt.safeParse({endpoint:t.get("endpoint")??""});return n.success?n.data:null}function zt(e){const t=Yt.safeParse(e);return t.success?t.data:null}const Xt="studio:deco-serve-last";function Br(e){try{localStorage.setItem(Xt,JSON.stringify(e))}catch{}}function Fr(){try{const e=localStorage.getItem(Xt);return e?zt(JSON.parse(e)):null}catch{return null}}function Vr(e){try{return new URL(he(e)).host}catch{return e}}function vo(e,t=1e4){return Math.min(1e3*2**Math.max(0,e-1),t)}const bo="http://localhost:4545/rpc";class Ge extends Error{constructor(t="the endpoint isn't deco serve"){super(t),this.name="NotDecoServeError"}}function po(e){if(e instanceof Ge)return{reason:"not-deco-serve"};if(!(e instanceof y))return{reason:"not-answering"};switch(e.code){case w.Unauthorized:case w.MethodNotFound:return{reason:"outdated"};case w.Unsupported:return Je(e)?{reason:"outdated"}:{reason:"version-mismatch"};case w.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 Hr(e,t){if(e)return[he(e.endpoint)];const n=[t?.endpoint,bo].filter(o=>!!o).map(he);return[...new Set(n)]}const mo=Lt({blocks:Ie(K(),Ie(K(),Vn()).refine(Ce)),versions:Ie(K(),K().min(1)),missing:Fn(K())});function wo(e,t){const n=mo.parse(e),o=Object.keys(n.blocks),s=Object.keys(n.versions),r=[...o,...n.missing],i=new Set(t);if(s.length!==o.length||o.some(a=>!Object.hasOwn(n.versions,a))||r.length!==i.size||new Set(r).size!==r.length||r.some(a=>!i.has(a)))throw new Error("The CMS block response did not account for the requested names");return n}function oe(e,t){const n=e.index?.entries[t];return!!n&&Ce(e.blocks[t])&&e.versions[t]===n.version}function yo(e,t,n){const o=new Map;let s=!1;for(const[r,i]of Object.entries(n.blocks)){const a=t.index?.entries[r];if(a){if(n.versions[r]!==a.version){s||=a.version===e.index?.entries[r]?.version;continue}t.blocks[r]!==e.blocks[r]||t.versions[r]!==e.versions[r]||o.set(r,i)}}return s||=n.missing.some(r=>!!t.index?.entries[r]),{blocks:o.size?{...t.blocks,...Object.fromEntries(o)}:t.blocks,versions:o.size?{...t.versions,...Object.fromEntries([...o.keys()].map(r=>[r,n.versions[r]]))}:t.versions,refreshIndex:s}}function So(e,t,n){return!!e.index&&t.every(o=>e.index?.entries[o]?oe(e,o)&&(!n||n[o]===e.blocks[o]):!n||n[o]===void 0)}const bt=50,pt=10;function ko(e,t=n=>fetch(n)){let n=1;return{async batch(o){const s=o.map(()=>n++),r=await t(new Request(e,{method:"POST",headers:{"content-type":"application/json"},credentials:"include",signal:ye(),body:JSON.stringify(o.map((c,l)=>({jsonrpc:"2.0",id:s[l],method:c.method,params:c.params??{}})))}));if(!r.ok)throw new y(w.Unavailable,`the hosted CMS answered ${r.status}`);const i=await r.json(),a=new Map((Array.isArray(i)?i:[]).map(c=>[c.id,c]));return s.map(c=>{const l=a.get(c);return l?l.error?{ok:!1,error:y.from(l.error)}:{ok:!0,result:l.result}:{ok:!1,error:new y(w.InternalError,"no response for this call")}})}}}function Oo(e,t){if(!e)return t??{};const n={};for(const[o,s]of Object.entries(e.entries)){if(t&&Object.hasOwn(t,o)){n[o]=t[o];continue}n[o]={[Jn]:!0,...s.meta?.type?{__resolveType:s.meta.type}:{},...s.meta?.path!==void 0?{path:s.meta.path}:{},...s.meta?.refs?.length?{[Hn]:s.meta.refs}:{}}}for(const[o,s]of Object.entries(t??{}))Object.hasOwn(n,o)||(n[o]=s);return n}function Eo(e,t){return e?.entries[t]?.meta?.refs??[]}function Do(e,t){return Object.hasOwn(e.draft,t)?e.draft[t]?.version??null:null}function Ye(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Pe(e,t){if(Array.isArray(e)){for(const n of e)Pe(n,t);return}if(Ye(e))for(const[n,o]of Object.entries(e))n==="__resolveType"&&typeof o=="string"?t.add(o):Pe(o,t)}function Zt(e,t){if(!Ye(e))return;const n={};typeof e.__resolveType=="string"&&(n.type=e.__resolveType),typeof e.path=="string"&&(n.path=e.path);const o=new Set;Pe(e,o);const s=[...o].filter(r=>t.has(r)).sort();return s.length>0&&(n.refs=s),Object.keys(n).length>0?n:void 0}function qt(e,t,n,o){Y(e),e.setQueryData(g.contentIndex(t),s=>{if(!s)return s;const r={...s.entries},i={...s.draft},a=new Set([...Object.keys(r),...Object.keys(o)]);for(const[c,l]of Object.entries(n)){const u=i[c]?.editor??null;if(l===null||l===Z){delete r[c],i[c]={operation:"delete",version:Z,editor:u};continue}const d=Zt(o[c],a);r[c]={version:l,...d?{meta:d}:{}},i[c]={operation:"set",version:l,editor:u}}return{...s,entries:r,draft:i}})}function Io(e,t,n,o){e.setQueryData(g.contentIndex(t),s=>{if(!s)return s;const r={...s.draft},i={...s.entries};if(o===null)delete r[n];else if(r[n]={operation:o.block===null?"delete":"set",version:o.version,editor:r[n]?.editor??null},o.block===null)delete i[n];else{const a=new Set([...Object.keys(i),n]),c=Zt(o.block,a);i[n]={version:o.version,...c?{meta:c}:{}}}return{...s,entries:i,draft:r}})}const mt=new WeakMap;async function ze(e,t,n,o,s=new Set){const r=e.getQueryData(g.contentIndex(n));if(!r)throw new y(w.Unavailable,"The CMS index is not loaded yet");let i=mt.get(e);i||(i=new Map,mt.set(e,i));const a=e.getQueryData(g.decofile(n))??{},c=e.getQueryData(g.contentVersions(n))??{},l=[],u=[];for(const f of new Set(o)){const h=r.entries[f];if(!h||s.has(f)||Ce(a[f])&&c[f]===h.version)continue;const v=i.get(`${n}\0${f}`);v?l.push(v):u.push(f)}if(u.length>0){const f=To(e,t,n,u);for(const h of u){const v=`${n}\0${h}`;i.set(v,f),f.catch(()=>{}).finally(()=>{i.get(v)===f&&i.delete(v)})}l.push(f)}await Promise.all(l);const d=ge(e,n);if(o.some(f=>d.index?.entries[f]&&!s.has(f)&&!oe(d,f)))throw new y(w.Unavailable,"A CMS block changed while loading; try again")}async function _o(e,t,n,o,s){if(!t){const i=o?.[s];return Ye(i)&&!Gn(i)?i:void 0}await ze(e,t,n,[s]);const r=ge(e,n);return r.index?.entries[s]&&oe(r,s)?r.blocks[s]:void 0}function ge(e,t){return{index:e.getQueryData(g.contentIndex(t)),blocks:e.getQueryData(g.decofile(t))??{},versions:e.getQueryData(g.contentVersions(t))??{}}}async function To(e,t,n,o){const s=ge(e,n),r=[];for(let i=0;i<o.length;i+=bt)r.push(o.slice(i,i+bt));for(let i=0;i<r.length;i+=pt){const a=r.slice(i,i+pt),c=await t.batch(a.map(l=>({method:"cms.blocks",params:{names:l}})));if(c.length!==a.length)throw new y(w.InternalError,"Incomplete CMS batch response");for(const[l,u]of c.entries()){if(!u.ok)throw u.error;const d=wo(u.result,a[l]),f=ge(e,n),h=yo(s,f,d);if(Y(e),h.blocks!==f.blocks&&e.setQueryData(g.decofile(n),h.blocks),h.versions!==f.versions&&e.setQueryData(g.contentVersions(n),h.versions),h.refreshIndex)throw e.invalidateQueries({queryKey:g.decofile(n),exact:!0},{cancelRefetch:!1}),new y(w.Unavailable,"The CMS index changed while loading blocks; try again")}}}function Xe(e){const t=N.c(4);let n;t[0]!==e?(n=g.contentIndex(e),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:Ro,staleTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:s}=C(o);return s}async function Ro(){throw new Error("the content index is set by the poll")}function wt(e,t){const n=N.c(8);let o;n[0]!==t?(o=Wn(t),n[0]=t,n[1]=o):o=n[1];const s=o;let r;n[2]!==e||n[3]!==s?(r=a=>e.getQueryCache().subscribe(c=>{c.query.queryHash===s&&a()}),n[2]=e,n[3]=s,n[4]=r):r=n[4];let i;return n[5]!==e||n[6]!==t?(i=()=>e.getQueryData(t),n[5]=e,n[6]=t,n[7]=i):i=n[7],L.useSyncExternalStore(r,i)}const yt=3e4;function xo(e){if(!(e instanceof y))return;const t=e.data?.retryAfterMs;return typeof t=="number"&&t>0?t:void 0}function Po(e,t,n,o){const s=N.c(15),r=G(),i=Xe(t);let a;s[0]!==t?(a=g.decofile(t),s[0]=t,s[1]=a):a=s[1];const c=wt(r,a);let l;s[2]!==t?(l=g.contentVersions(t),s[2]=t,s[3]=l):l=s[3];const u=wt(r,l),d=o?.withRefs??!1,f=new Set(n);if(d)for(const m of n)for(const E of Eo(i,m))f.add(E);const h=[...f].filter(m=>!!i?.entries[m]).sort(),v={index:i,blocks:c??{},versions:u??{}},b=h.some(m=>!oe(v,m)),p=JSON.stringify(h.map(m=>[m,i?.entries[m]?.version,oe(v,m)])),[R,k]=L.useState(null),[$,I]=L.useState(0),_=R?.key===p?R:null;L.useEffect(()=>{if(!e||!p)return;let m=!0;const E=JSON.parse(p).map($o);return ze(r,e,t,E).then(()=>{m&&k(j=>j?.key===p?null:j)},j=>{m&&k(U=>({key:p,count:(U?.key===p?U.count:0)+1,retryAfterMs:xo(j)}))}),()=>{m=!1}},[e,r,t,p,$]);let T;s[4]!==_||s[5]!==I?(T=()=>{if(!_)return;const m=Math.min(yt,_.retryAfterMs??Bt(yt,1e3,_.count-1,2,.5)),E=setTimeout(()=>I(jo),m);return()=>clearTimeout(E)},s[4]=_,s[5]=I,s[6]=T):T=s[6];let S;s[7]!==_?(S=[_],s[7]=_,s[8]=S):S=s[8],L.useEffect(T,S);const O=!e||So(v,[...f],o?.listing),D=!!e&&b&&_!==null;let x;s[9]!==I?(x=()=>I(No),s[9]=I,s[10]=x):x=s[10];let A;return s[11]!==O||s[12]!==D||s[13]!==x?(A={ready:O,failed:D,retry:x},s[11]=O,s[12]=D,s[13]=x,s[14]=A):A=s[14],A}function No(e){return e+1}function jo(e){return e+1}function $o(e){const[t]=e;return t}const Kt=L.createContext(null);function Ao(e){const t=N.c(24),n=L.useContext(Kt),o=Fe(n?null:e),{data:s}=Yn.useSession(),r=s?.user?.id??"",i=!!e&&!!r;let a;t[0]!==i||t[1]!==r||t[2]!==e?(a=i?Te.decoServeConnection(r,e):null,t[0]=i,t[1]=r,t[2]=e,t[3]=a):a=t[3];const[c,l]=kt(a);let u;t[4]!==i||t[5]!==r||t[6]!==e?(u=i?Te.decoServeEndpoint(r,e):null,t[4]=i,t[5]=r,t[6]=e,t[7]=u):u=t[7];const[d,f]=kt(u);if(n)return n;let h;t[8]!==c||t[9]!==i||t[10]!==o?(h=i&&o?zt(c):null,t[8]=c,t[9]=i,t[10]=o,t[11]=h):h=t[11];const v=h,b=i&&o&&typeof d=="string"?d:null;let p;t[12]!==f||t[13]!==l||t[14]!==i?(p=$=>{i&&(l($),f($.endpoint))},t[12]=f,t[13]=l,t[14]=i,t[15]=p):p=t[15];let R;t[16]!==l||t[17]!==i?(R=()=>{i&&l(null)},t[16]=l,t[17]=i,t[18]=R):R=t[18];let k;return t[19]!==v||t[20]!==b||t[21]!==p||t[22]!==R?(k={connection:v,lastEndpoint:b,set:p,clear:R},t[19]=v,t[20]=b,t[21]=p,t[22]=R,t[23]=k):k=t[23],k}function St(e){try{const t=localStorage.getItem(e);return t===null?null:JSON.parse(t)}catch{return null}}function kt(e){const t=N.c(17),n=G(),o=e??"";let s;t[0]!==o?(s=["localStorage",o],t[0]=o,t[1]=s):s=t[1];const r=s;let i,a;t[2]!==e?(i=()=>e?St(e):null,a=()=>e?St(e):null,t[2]=e,t[3]=i,t[4]=a):(i=t[3],a=t[4]);const c=!!e;let l;t[5]!==r||t[6]!==i||t[7]!==a||t[8]!==c?(l={queryKey:r,queryFn:i,initialData:a,enabled:c,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[5]=r,t[6]=i,t[7]=a,t[8]=c,t[9]=l):l=t[9];const{data:u}=C(l);let d;t[10]!==e||t[11]!==n||t[12]!==r?(d=b=>{if(e){try{b===null?localStorage.removeItem(e):localStorage.setItem(e,JSON.stringify(b))}catch{}n.setQueryData(r,b)}},t[10]=e,t[11]=n,t[12]=r,t[13]=d):d=t[13];const f=d,h=e?u??null:null;let v;return t[14]!==f||t[15]!==h?(v=[h,f],t[14]=f,t[15]=h,t[16]=v):v=t[16],v}function en(e,t=""){return{source:e,cacheKeySuffix:e==="github"?"":e==="sandbox"?":sandbox":`:serve:${t}`}}function Mo(e){return JSON.stringify([e.kind==="legacy"?"legacy":"protocol",e.source,e.cacheKeySuffix])}function Jr(e){return e.kind==="protocol"||e.kind==="unavailable"}function Wr(e){const t=e.hasOrg?e.orgFlag:!1,{backend:n}=e;return n===null||n==="legacy"?t:!0}function Gr(e,t,n){return t!=="github"||!n?!1:e.kind==="pending"?!0:e.kind==="unavailable"&&e.siteNotOwned?!1:(e.kind==="protocol"||e.kind==="unavailable")&&e.source==="github"}function Yr(e){if(e.kind!=="protocol"||e.source!=="local")return null;const t=e.describe.preview?.url;return t&&Gt(t)?t:null}function zr(e,t){return e.kind!=="protocol"||e.source!=="local"||!e.describe.assets||!t?null:new URL(t.endpoint).origin}function tn(e){return e.hasServeConnection?"local":e.runtime==="sandbox"?"sandbox":"github"}function Lo(e){if(!e.hasProject)return"legacy";const t=tn(e);if(t==="local")return"protocol-local";if(!e.v8)return"legacy";if(t==="sandbox"){const o=e.sandboxSite;return o==="ready"?"protocol-sandbox":o==="error"?"retrying-sandbox":"pending"}const n=e.githubSite;return n==="ready"?"protocol-github":n==="not-owned"?"site-not-owned-github":n==="error"?"unavailable-github":"pending"}function Uo(e){return{github:e.v8&&e.mode==="github",sandbox:e.v8&&e.mode==="sandbox"&&e.workingTreeReady}}function Ot(e){return e.isError||e.errorUpdateCount>0}function Qo(e,t,n){if(!t||n.size===0)return e;const o={...e};for(const s of n)Object.hasOwn(t,s)?o[s]=t[s]:delete o[s];return o}function Co(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 nn="__noSchema";function on(){return{manifest:{blocks:{}},schema:{definitions:{},root:{}},[nn]:!0}}function Xr(e){return!!e&&e[nn]===!0}function Ze(e){if(!e.ok)return e.error.code===w.NotFound;const t=e.result;return t.notModified===!1&&t.schema===null}function Bo(e,t){return(typeof t.name=="string"?t.name.trim():"")||e}const Fo=(e,t)=>e.label.localeCompare(t.label)||e.key.localeCompare(t.key);function Zr(e){const t=new Map;for(const[n,o]of Object.entries(e)){const s=o&&typeof o=="object"&&!Array.isArray(o)?o:{},r=typeof s.__resolveType=="string"?s.__resolveType:null,i=t.get(r)??[];i.push({key:n,label:Bo(n,s)}),t.set(r,i)}return[...t.entries()].map(([n,o])=>({resolveType:n,blocks:o.sort(Fo)})).sort((n,o)=>n.resolveType===null?1:o.resolveType===null?-1:Et(n.resolveType).localeCompare(Et(o.resolveType))||n.resolveType.localeCompare(o.resolveType))}function Et(e){return(e.split("/").filter(Boolean).at(-1)??e).replace(/\.(tsx?|jsx?)$/,"")||e}function Dt(e,t,n){if(t.length===0)return n;const[o,...s]=t;if(Array.isArray(e)&&typeof o=="number"){const r=e.slice();return r[o]=Dt(e[o],s,n),r}if(e&&typeof e=="object"&&typeof o=="string"){const r=e,i={};for(const a of Object.keys(r))i[a]=a===o?Dt(r[a],s,n):r[a];return i}return e}function qr(e){if(e.trim()==="")return null;const t=Number(e);return Number.isFinite(t)?t:null}class It extends Error{}const qe="site-not-owned";async function Vo(e){return e.status!==409?!1:(await e.clone().json().catch(()=>null))?.code==="site_not_owned"}async function Ho(e,t=n=>fetch(n)){const n=Ve({endpoint:e,fetch:async o=>{const s=await t(new Request(o,{signal:ye(o.signal)}));if(await Vo(s))throw new It;return s}});try{return await et(n)}catch(o){if(o instanceof It)return qe;throw o}}async function Jo(e,t,n){await t();const o=await Ho(e,n);return o===qe?o:{...o,hosted:ko(e,n)}}const Ke=5e3;function Wo(e){if(!e.site)throw new Error("this project names no site");return Xn(e.site,e.branch)}function Go(e){return new URL(Se(e,"rpc"),window.location.origin).href}async function et(e){const[t,n]=await e.batch([{method:"describe"},{method:"schema.get"}]);if(!t?.ok)throw t?.error??new Error("no describe");if(t.result?.protocol!==te)throw new Ge;const s=Jt(t.result);if(!n)throw new Error("no schema.get");if(Ze(n))return{client:e,describe:s,hasSchema:!1};if(n.ok)return{client:e,describe:s,hasSchema:!0};throw n.error}function Yo(e,t=n=>fetch(n)){return et(Ve({endpoint:e,fetch:n=>t(new Request(n,{signal:ye(n.signal)}))}))}function re(e,t){const n=N.c(40),{org:o}=zn(),{connection:s}=Ao(e),{runtime:r}=Ft(e),i=L.useContext(Kt),a=Fe(e),c=Ut(Be(e)?.metadata),l=tn({hasServeConnection:!!s,runtime:r}),u=en(l,s?.endpoint??""),d=to()?.taskId??null,f=no(oo().lifecycle.phase),h=G(),v=Uo({mode:l,v8:a,workingTreeReady:f}),b=v.github&&!!o.slug&&!!e&&!!t,p=C({queryKey:g.contentBackend(o.slug,e??"",t??"","github"),queryFn:()=>Jo(Wo({orgSlug:o.slug,site:c,branch:t}),()=>Qt(c,t)),enabled:b,staleTime:Number.POSITIVE_INFINITY,..._t}),R=v.sandbox&&!!o.slug&&!!e&&!!t;let k;n[0]!==t||n[1]!==o.slug||n[2]!==d||n[3]!==e?(k=()=>Yo(Go({orgSlug:o.slug,virtualMcpId:e,branch:t,threadId:d})),n[0]=t,n[1]=o.slug,n[2]=d,n[3]=e,n[4]=k):k=n[4];const $=C({queryKey:g.contentBackend(o.slug,e??"",t??"","sandbox",d??""),queryFn:k,enabled:R,staleTime:Number.POSITIVE_INFINITY,..._t}),I=!!s;let _;n[5]!==s?.endpoint||n[6]!==o.slug||n[7]!==e?(_=g.contentBackend(o.slug,e??"","local",s?.endpoint??""),n[5]=s?.endpoint,n[6]=o.slug,n[7]=e,n[8]=_):_=n[8];let T;n[9]!==s?(T=()=>ts(s.endpoint),n[9]=s,n[10]=T):T=n[10];let S;n[11]!==I||n[12]!==_||n[13]!==T?(S={queryKey:_,queryFn:T,enabled:I,staleTime:Number.POSITIVE_INFINITY,retry:Zo,retryDelay:Xo,refetchInterval:zo},n[11]=I,n[12]=_,n[13]=T,n[14]=S):S=n[14];const O=C(S);let D;n[15]!==s?.endpoint||n[16]!==o.slug||n[17]!==e?(D=g.contentBackend(o.slug,e??"","local",s?.endpoint??""),n[15]=s?.endpoint,n[16]=o.slug,n[17]=e,n[18]=D):D=n[18];const x=D;let A;n[19]!==s?.endpoint||n[20]!==o.slug||n[21]!==e?(A=g.contentBackend(o.slug,e??"","local-describe",s?.endpoint??""),n[19]=s?.endpoint,n[20]=o.slug,n[21]=e,n[22]=A):A=n[22];let m;n[23]!==O.data||n[24]!==x||n[25]!==h?(m=async()=>{try{return await O.data.client.describe()}catch(q){const Cn=q;throw h.invalidateQueries({queryKey:x,exact:!0},{cancelRefetch:!1}),Cn}},n[23]=O.data,n[24]=x,n[25]=h,n[26]=m):m=n[26];const E=!!O.data&&!i;let j;n[27]!==A||n[28]!==m||n[29]!==E?(j={queryKey:A,queryFn:m,enabled:E,refetchInterval:Ke,retry:!1},n[27]=A,n[28]=m,n[29]=E,n[30]=j):j=n[30];const M=C(j).data??O.data?.describe,Q=Lo({hasProject:!!e,hasServeConnection:!!s,runtime:r,v8:a,githubSite:p.data===qe?"not-owned":p.data?"ready":Ot(p)?"error":"loading",sandboxSite:qo({data:$.data,isError:Ot($),workingTreeReady:f})});if(Q==="pending")return{kind:"pending",...u};if(Q==="retrying-sandbox")return{kind:"pending",retrying:"sandbox",...u};if(Q==="legacy")return{kind:"legacy"};if(Q==="protocol-github")return{...Ne(u,p.data),site:c};if(Q==="site-not-owned-github")return{kind:"unavailable",...u,siteNotOwned:!0};if(Q==="protocol-sandbox")return Ne(u,$.data);if(Q==="unavailable-github"){let q;return n[31]!==u?(q={kind:"unavailable",...u},n[31]=u,n[32]=q):q=n[32],q}const P=O.error??O.failureReason,H=s?.endpoint??"";let J;return n[33]!==M||n[34]!==O.data||n[35]!==O.failureCount||n[36]!==O.isError||n[37]!==H||n[38]!==P?(J=es({probed:O.data,isError:O.isError,failureCount:O.failureCount,failure:P,describe:M,endpoint:H}),n[33]=M,n[34]=O.data,n[35]=O.failureCount,n[36]=O.isError,n[37]=H,n[38]=P,n[39]=J):J=n[39],J}function zo(e){return e.state.status==="error"||e.state.data?.hasSchema===!1?Ke:!1}function Xo(e){return vo(e+1)}function Zo(e,t){return!(t instanceof y)&&!(t instanceof Ge)}function qo(e){return e.data!==void 0?"ready":e.workingTreeReady?e.isError?"error":"loading":"unavailable"}const Ko=3;function es(e){const t=en("local",e.endpoint),n=e.probed?Ne(t,{...e.probed,describe:e.describe??e.probed.describe}):null;return e.isError||e.failureCount>0?n?.kind==="protocol"&&!e.isError&&e.failureCount<Ko?n:{kind:"unavailable",...t,problem:po(e.failure)}:n??{kind:"pending",...t}}const _t={retry:2,refetchInterval:e=>e.state.status==="error"?Ke:!1};function Ne(e,t){return{kind:"protocol",...e,client:t.client,describe:t.describe,hasSchema:t.hasSchema,...t.hosted?{hosted:t.hosted}:{}}}function ts(e,t){return et(Ve({endpoint:e,fetch:n=>fetch(n,{signal:ye(t?AbortSignal.any([t,n.signal]):n.signal)})}))}function je(e){const t=`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`;return e.protocolSuffix?`${t}${e.protocolSuffix}`:e.localPreviewUrl?`${t}:local:${e.localPreviewUrl}`:t}function ns(e,t){return je({...e,protocolSuffix:t.cacheKeySuffix})}function os(e,t,n){return e?t==="pending"?{ready:!1,failed:!1}:t==="unavailable"?{ready:!1,failed:!0}:n:{ready:!0,failed:!1}}function ss(e,t){return JSON.stringify([e?.orgSlug,e?.virtualMcpId,e?.branch,Mo(t)])}function rs(e,t,n){const o=N.c(21),s=G(),r=re(e?.virtualMcpId,e?.branch),i=e&&r.kind==="protocol"&&r.hosted?r:null;let a;o[0]!==i||o[1]!==e?(a=i&&e?ns(e,i):"",o[0]=i,o[1]=e,o[2]=a):a=o[2];const c=Po(i?.hosted,a,t,n),l=e!==null;let u;o[3]!==r.kind||o[4]!==c||o[5]!==l?(u=os(l,r.kind,c),o[3]=r.kind,o[4]=c,o[5]=l,o[6]=u):u=o[6];const d=u,f=r.kind!=="legacy";let h;o[7]!==r||o[8]!==e?(h=ss(e,r),o[7]=r,o[8]=e,o[9]=h):h=o[9];let v;o[10]!==r.kind||o[11]!==r.source||o[12]!==c||o[13]!==s||o[14]!==e?(v=()=>{if(c.retry(),!e||r.kind!=="unavailable")return;const p=r.source;s.resetQueries({queryKey:g.contentBackend(e.orgSlug,e.virtualMcpId,...p==="local"?["local"]:[e.branch,p])})},o[10]=r.kind,o[11]=r.source,o[12]=c,o[13]=s,o[14]=e,o[15]=v):v=o[15];let b;return o[16]!==d||o[17]!==f||o[18]!==h||o[19]!==v?(b={...d,v8:f,scopeKey:h,retry:v},o[16]=d,o[17]=f,o[18]=h,o[19]=v,o[20]=b):b=o[20],b}function sn(e){const t=N.c(12);let n;t[0]!==e?(n=Te.localPreviewUrl(e??""),t[0]=e,t[1]=n):n=t[1];const o=n,[s,r]=Zn(o,null),i=Fe(e);let a;t[2]!==s||t[3]!==e?(a=e?ft(s):null,t[2]=s,t[3]=e,t[4]=a):a=t[4];const l=i?null:a;let u,d;t[5]!==r?(u=h=>r(ft(h)),d=()=>r(null),t[5]=r,t[6]=u,t[7]=d):(u=t[6],d=t[7]);let f;return t[8]!==l||t[9]!==u||t[10]!==d?(f={url:l,setUrl:u,clear:d},t[8]=l,t[9]=u,t[10]=d,t[11]=f):f=t[11],f}const Tt=6e4,is=2147483647;function as(e,t){if(e===null||e.trim()==="")return Tt;const n=e.trim(),o=/^\d+(?:\.\d+)?$/.test(n)?Number(n)*1e3:/^[A-Za-z]{3}, /.test(n)?Math.max(0,Date.parse(n)-t):Number.NaN;return Number.isFinite(o)&&o>=0&&o<=is?o:Tt}class rn extends Error{constructor(t,n,o,s=Date.now()){super(t),this.status=n,this.name="ContentResponseError",this.retryAt=n===429?s+as(o,s):null}status;retryAt}function cs(e,t,n=Date.now()){const o=Bt(5e3,1e3,e,2,0);return t instanceof rn&&t.retryAt!==null?Math.max(o,t.retryAt-n):o}async function tt(e,t){const n=await e.json().catch(()=>null),o=n!==null&&typeof n=="object"&&"error"in n&&typeof n.error=="string"?n.error:`${t} failed (${e.status})`;throw new rn(o,e.status,e.headers.get("retry-after"))}function ls(e,t){const n=(e??"").trim().replace(/^[/\\]+|[/\\]+$/g,"");return n?`${n}/${t}`:t}function Rt(e){let t;try{t=JSON.parse(e)}catch{return null}return typeof t!="object"||t===null||Array.isArray(t)?null:t}function ke(e,t,n){return["decofile-write",e,t,n]}function us(e,t,n){return{id:ke(e,t,n).join(":")}}class nt extends Error{constructor(t,n,o=[],s=!1){super(n),this.blocks=t,this.fields=o,this.carriedStored=s,this.name="BlockConflictError"}blocks;fields;carriedStored}function ot(e){return`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`}function st(e){return`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}`}async function fs(e,t){return tt(e,t)}function ds(e,t,n){e.setQueryData(g.decofileDraft(ot(t)),n)}function hs(e,t){return e.getQueryData(g.decofileDraft(ot(t)))??null}async function gs(e,t){return(await fetch(st(e),{cache:"no-store",headers:{"if-none-match":`"${t}"`}}).catch(()=>null))?.status===200}function Kr(e){const t=N.c(4);let n;t[0]!==e?(n=g.decofileDraft(e?ot(e):""),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:vs,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:s}=C(o);return s??null}async function vs(){throw new Error("decofileDraft is populated by reads/writes, not fetched")}async function bs(e,t){const n=await fetch(st(t),{cache:"no-store"});if(!n.ok)return tt(n,"Read decofile");const o=await n.json();return o.token&&ds(e,t,{version:o.version,token:o.token,apiHost:o.apiHost??window.location.host}),o.decofile}async function ei(e,t){const n=await fetch(st(e),{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(n.status===409){const s=await n.json().catch(()=>({}));throw s.code==="block-conflict"?new nt(s.blocks??[],s.error??"Block changed"):new Error(s.error??`Save failed (${n.status})`)}if(!n.ok)return fs(n,"Save");const o=await n.json();return{...o,apiHost:o.apiHost??window.location.host}}const an=3e3,ps=15e3,ms=2*6e4,cn={now:()=>Date.now(),setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),hidden:()=>typeof document<"u"&&document.visibilityState==="hidden"};function ws(e){return e<ms?an:ps}function ys(e,t=cn){const n=t.now();let o=!1,s=!1,r=null;const i=()=>{o||(r=t.setTimeout(a,ws(t.now()-n)))},a=()=>{if(r=null,o)return;const{read:c,skip:l}=e();if(s||t.hidden()||l?.()){i();return}s=!0;let u;try{u=c()}catch{u=void 0}Promise.resolve(u).catch(()=>{}).finally(()=>{s=!1}),i()};return i(),()=>{o=!0,r!==null&&t.clearTimeout(r)}}const xt=()=>0;function Ss(e,t,n=cn){const o=L.useRef(t);o.current=t;const[s]=L.useState(()=>({polling:()=>ys(()=>o.current,n),idle:()=>()=>{}}));L.useSyncExternalStore(e?s.polling:s.idle,xt,xt)}function ln(e,t){return Se(e,t)}function ks(e,t){return Se(e,"preview-fetch",{path:t})}function ti(e){return ln(e,"preview-invoke")}function ni(e){return ln(e,"catalog-invoke")}function un(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 Os(){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&&un(n))return n}return null}function Es(e,t){const n=e.previewUrl??e.getFallbackPreviewUrl?.()??Os();return n&&un(n)?new URL(t,n).toString():ks(e,t)}function Ds(e){return Es(e,"/.decofile")}function Is(e){return e===400?"absent":e===404?"unavailable":e>=200&&e<300?"ok":"error"}function Pt(e){return e.liveOk||e.committedAbsent?404:e.liveStatus??502}async function _s(e,t){const n=Se(e,"read"),o=await fetch(n,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:t,full:!0})}),s=Is(o.status);if(s==="absent")return{kind:"absent"};if(s==="unavailable")return{kind:"unavailable"};if(s==="error"){const i=new Error(`Failed to read ${t}: ${o.status}`);throw i.status=o.status,i}const r=await o.json();return typeof r.content!="string"?{kind:"unavailable"}:{kind:"data",data:so(r.content)}}async function Ts(e,t){const n=await _s(e,t);if(n.kind!=="data")return n;try{return{kind:"data",data:JSON.parse(n.data)}}catch{return{kind:"unavailable"}}}async function oi(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)return tt(n,"Read committed meta");try{return{kind:"data",data:await n.json()}}catch{return{kind:"unavailable"}}}function Rs(e){return Be(e)?.metadata?.runtime?.path??null}function $e(e,t,n,o){const s=B(e),r=Object.keys(n?.changes??{}).find(a=>B(a)===s);if(r!==void 0&&n)return n.changes[r].baseVersion;const i=Object.keys(t?.draft??{}).some(a=>B(a)===s);if(t&&!i){const a=Object.keys(t.entries).find(c=>B(c)===s);return a===void 0?null:t.entries[a].version}return o?.[e]??null}class fn extends Error{constructor(t){super(t instanceof Error?t.message:String(t),{cause:t}),this.name="ServeLostError"}}function si(e){return e instanceof y&&e.code===w.Conflict}function dn(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 rt extends Error{constructor(){super("The draft's changes couldn't be read"),this.name="HostedDraftUnreadError"}}class it extends Error{constructor(){super("The blocks kept changing while the change was saved"),this.name="HostedKeptChangingError"}}function ri(e,t){return(t instanceof rt||t instanceof it)&&(t.message=hn(e,t,"github")),t}function hn(e,t,n){if(t instanceof rt)return e("siteEditor.save.draftUnread");if(t instanceof it)return e("siteEditor.save.keptChanging");if(t instanceof nt)return t.message;if(n==="local")return Ps(e,t);if(t instanceof y)switch(t.code){case w.Conflict:return e("siteEditor.save.conflict");case w.ReadOnly:return e("siteEditor.save.readOnly");case w.InvalidBlock:case w.InvalidParams:return e("siteEditor.save.invalid");case w.LimitExceeded:return e("siteEditor.save.tooLarge")}return e("siteEditor.save.failed")}function xs(e,t){if(t==="local"||e instanceof nt||e instanceof rt||e instanceof it)return null;if(e instanceof y){const n=e.code===w.InvalidBlock||e.code===w.InvalidParams?dn(e):e.message;return n?`${e.code}: ${n}`:null}return e.message||null}function Ps(e,t){if(t instanceof fn)return e("decoServe.save.serverGone");if(t instanceof y)switch(t.code){case w.Conflict:return e("decoServe.save.conflict");case w.ReadOnly:return e("decoServe.save.readOnly");case w.InvalidBlock:case w.InvalidParams:return e("decoServe.save.invalid",{detail:dn(t)});case w.LimitExceeded:return e("decoServe.save.tooLarge")}return e("sectionsEditor.sectionsEditor.saveFailed",{error:t.message})}function Ns(e,t,n){return e===null?0:Math.max(0,n-Math.max(0,t-e))}function js(e,t){const[n,o]=L.useState(e),s=L.useRef(null);return e&&!n&&o(!0),L.useEffect(()=>{if(e){s.current??=Date.now();return}if(!n)return;const r=()=>{s.current=null,o(!1)},i=Ns(s.current,Date.now(),t);if(i===0){r();return}const a=setTimeout(r,i);return()=>clearTimeout(a)},[e,n,t]),n}const $s="decocms:content-writes",Ae=new Set;let z;function gn(){if(z!==void 0)return z;z=null;try{typeof BroadcastChannel=="function"&&(z=new BroadcastChannel($s),z.addEventListener("message",e=>{const t=e.data?.cacheKey;if(typeof t=="string")for(const n of[...Ae])n(t)}))}catch{z=null}return z}function As(e){try{gn()?.postMessage({cacheKey:e})}catch{}}function Ms(e){return gn(),Ae.add(e),()=>{Ae.delete(e)}}const vn="__at=",bn="__test=",Ls=/^[0-9a-f]{12}-[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;function Us(e){return e.at!==void 0||Object.keys(e.tests??{}).length>0}function ee(e){return typeof e=="string"&&Ls.test(e)}function Nt(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)}function Qs(e){const t=e.tests??{};return[...e.at!==void 0?[vn+Nt(e.at)]:[],...Object.keys(t).map(n=>bn+Nt(`${n}=${t[n]?"on":"off"}`))]}function jt(e,t){const o=[...e.split("&").filter(s=>s&&!s.startsWith(vn)&&!s.startsWith(bn)),...t];return o.length>0?`?${o.join("&")}`:""}function ve(e,t){const n=Qs(t),o=e.indexOf("?"),s=o===-1?e:e.slice(0,o);if(ee(s))return s+jt(o===-1?"":e.slice(o+1),n);const r=e.lastIndexOf("@");if(r<=0)return e;const i=e.slice(0,r),a=i.indexOf("?"),c=a===-1?i:i.slice(0,a),l=a===-1?"":i.slice(a+1);return`${c}${jt(l,n)}${e.slice(r)}`}function ii(e,t,n){if(!Us(t))return e;try{const o=new URL(e),s=o.searchParams.get("__draft");return s&&s!=="off"?(o.searchParams.set("__draft",ve(s,t)),o.toString()):ee(n)?(o.searchParams.set("__draft",ve(n,t)),o.toString()):e}catch{return e}}function ai(e,t,n="/"){if(!e||!ee(t))return null;try{const o=new URL(n,e);return o.searchParams.set("__draft",t),o.toString()}catch{return null}}function pn(e){return btoa(encodeURIComponent(e))}function ci(e,t,n){const o=Cs(e,t,n);return o.searchParams.set("__cb",crypto.randomUUID()),o.toString()}function Cs(e,t,n){const o=new URL(e).origin,s=new URL(`/live/previews/${encodeURIComponent(t)}`,o);return s.searchParams.set("path","/"),s.searchParams.set("pathTemplate","/"),s.searchParams.set("props",pn(JSON.stringify({path:"/",sections:[{__resolveType:n}]}))),s}const Bs="__draft";function li(e){return`${`${e.apiHost}/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}?token=${e.token}`}@${e.version}`}const Fs="off";function Vs(e,t){if(!t)return e;const n=new URL(e);return n.searchParams.set(Bs,t),n.toString()}function ui(e){const t=e.pageBlock.__resolveType;if(typeof t!="string"||!t)return null;const n=new URL(e.previewBaseUrl).origin,o=new URL(`/live/previews/${encodeURIComponent(t)}`,n);o.searchParams.set("__decoFBT","0"),o.searchParams.set("__d",""),o.searchParams.set("path",e.path),o.searchParams.set("pathTemplate",e.pathTemplate);const{__resolveType:s,...r}=e.pageBlock,i=JSON.stringify({__props:r,__decofile:e.decofile});return{src:o.toString(),body:i}}function fi(e,t,n,o){const s=new URL(e).origin,r=new URL(`/live/previews/${encodeURIComponent(t)}`,s);r.searchParams.set("__d","");const i=[{__resolveType:"preview",block:n}];return o&&i.push(o),r.searchParams.set("props",pn(JSON.stringify({sections:i}))),r.toString()}function di(e){return e.fastPreviewActive&&e.previewServerUrl?e.previewServerUrl:e.sandboxUrl??null}const $t="__variant=";function mn(e,t,n){return`${e}@${t}=${n}`}function hi(e,t){return!e||!t.multivariate||t.variants.length<=1?[]:t.index<0||t.index>=t.variants.length?[]:[mn(e,"sections",t.index)]}function gi(e){const t=Array.isArray(e.mvObj.variants)?e.mvObj.variants:[];if(!e.pageKey||e.sectionIndex<0)return[];if(e.selectedVariantIndex<0||e.selectedVariantIndex>=t.length)return[];const o=`${e.page.multivariate?`sections.variants.${e.page.index}.value${e.page.lazyValues?".value":""}`:"sections"}.${e.sectionIndex}${e.sectionLazy?".section":""}`;return[mn(e.pageKey,o,e.selectedVariantIndex)]}function vi(e,t){return[...t,...e]}function Hs(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)}function at(e,t){const n=e.lastIndexOf("@");if(n<=0)return e;const o=e.slice(0,n),s=o.indexOf("?"),r=s===-1?o:o.slice(0,s),a=[...s===-1?[]:o.slice(s+1).split("&").filter(l=>l&&!l.startsWith($t)),...t.map(l=>$t+Hs(l))],c=a.length>0?`?${a.join("&")}`:"";return`${r}${c}${e.slice(n)}`}function bi(e,t,n=!1){if(t.length===0&&!n)return null;try{const o=new URL(e),s=o.hostname==="[::1]"?`localhost${o.port?`:${o.port}`:""}`:o.host;return at(`${s}${o.pathname}@local`,t)}catch{return null}}function pi(e,t){if(t.length===0)return e;try{const n=new URL(e),o=n.searchParams.get("__draft");return!o||o==="off"?e:(n.searchParams.set("__draft",at(o,t)),n.toString())}catch{return e}}function Js(e){const{pointer:t}=e;if(!t||t===Fs)return null;const n=t.indexOf("?");return ee(n===-1?t:t.slice(0,n))||t.lastIndexOf("@")<=0?null:ee(e.heldRevision)&&e.forcedVariants.length===0?ve(e.heldRevision,e.previewOptions):ve(at(t,e.forcedVariants),e.previewOptions)}function Ws(e,t){if(!e||!t)return null;try{return Vs(e,t)}catch{return null}}function mi(e,t,n){if(!e||!n)return null;try{return Ws(new URL(t,e).toString(),n)}catch{return null}}const be={forcedVariants:[],previewOptions:{}},ce=new Map,le=new Map,Me=new Map;function wn(e){for(const t of Me.get(e)??[])t()}function yn(e,t){const n=ee(t)?t:null;(le.get(e)??null)!==n&&(n?le.set(e,n):le.delete(e),wn(e))}function Gs(e){return le.get(e)??null}function Ys(e,t){return JSON.stringify(e)===JSON.stringify(t)}function wi(e,t){const n=ce.get(e)??be,o=t??be;Ys(n,o)||(t?ce.set(e,o):ce.delete(e),wn(e))}function zs(e){return ce.get(e)??be}function Sn(e,t){let n=Me.get(e);return n||(n=new Set,Me.set(e,n)),n.add(t),()=>{n.delete(t)}}function Xs(e){const t=N.c(3);let n,o;return t[0]!==e?(n=s=>Sn(e,s),o=()=>zs(e),t[0]=e,t[1]=n,t[2]=o):(n=t[1],o=t[2]),L.useSyncExternalStore(n,o,Zs)}function Zs(){return be}function qs(e){const t=N.c(3);let n,o;return t[0]!==e?(n=s=>e?Sn(e,s):er,o=()=>e?Gs(e):null,t[0]=e,t[1]=n,t[2]=o):(n=t[1],o=t[2]),L.useSyncExternalStore(n,o,Ks)}function Ks(){return null}function er(){}function yi(e,t){const n=N.c(4),o=Xs(e),s=qs(e);let r;return n[0]!==o||n[1]!==s||n[2]!==t?(r=Js({pointer:t,heldRevision:s,...o}),n[0]=o,n[1]=s,n[2]=t,n[3]=r):r=n[3],r}const kn={phase:"idle",inFlight:0,reload:{seq:0,navigates:!1},epoch:0},tr=15e3,pe=new Map;function W(e,t){return`${e}/${t}`}function V(e){let t=pe.get(e);return t||(t={state:kn,listeners:new Set,previews:0,timer:null,discardListeners:new Set},pe.set(e,t)),t}function F(e,t){const n=V(e);n.state={...n.state,...t};for(const o of n.listeners)o()}function Oe(e){e.timer&&clearTimeout(e.timer),e.timer=null}function me(e){return pe.get(e)?.state??kn}function nr(e,t){const n=V(e);return n.listeners.add(t),()=>{n.listeners.delete(t)}}function Si(e){const t=V(e);return t.previews++,()=>{t.previews--,t.previews===0&&t.state.phase==="reloading"&&(Oe(t),F(e,{phase:"idle"}))}}function ki(e){const t=pe.get(e);!t||t.state.phase!=="reloading"||(Oe(t),F(e,{phase:"idle"}))}function On(e){const t=V(e);Oe(t),F(e,{phase:"saving",inFlight:t.state.inFlight+1})}function ue(e,t){const n=V(e),o=Math.max(0,n.state.inFlight-1);if(o>0){F(e,{inFlight:o});return}if(!t.ok||n.previews===0){F(e,{phase:"idle",inFlight:o});return}En(e,t.navigates,o)}function En(e,t,n=0){const o=V(e);Oe(o),o.timer=setTimeout(()=>{o.timer=null,o.state.phase==="reloading"&&F(e,{phase:"idle"})},tr),F(e,{phase:"reloading",inFlight:n,reload:{seq:o.state.reload.seq+1,navigates:t}})}function or(e){return e?.kind==="protocol"&&e.source==="github"}async function fe(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:s,branch:r,backend:i,cacheKey:a}=e,c=t.kind==="publish"||t.kind==="reapply"?n.invalidateQueries({queryKey:g.hostedReleases(o,s)}):null;if(i?.kind!=="protocol"){const v=a&&t.reread?n.invalidateQueries({queryKey:g.decofile(a)}):null;if(await Promise.all([c,v]),v&&t.kind!=="edit"){const b=W(o,s);F(b,{epoch:me(b).epoch+1})}return{navigates:!1}}const l=r?g.protocolDraftRead(o,s,r):null,u=l?JSON.stringify(n.getQueryData(l)??null):null,d=c?[c]:[];if(a&&t.reread&&d.push(n.invalidateQueries({queryKey:g.decofile(a)})),a&&!t.adopted&&d.push(n.invalidateQueries({queryKey:g.contentChanges(a)})),r&&i.source==="sandbox"&&d.push(n.invalidateQueries({queryKey:ro(o,s,r)})),or(i)&&l&&!t.adopted&&d.push(n.invalidateQueries({queryKey:l})),await Promise.all(d),t.kind!=="edit"){const v=W(o,s);F(v,{epoch:me(v).epoch+1})}const f=l?JSON.stringify(n.getQueryData(l)??null):null,h=u!==f;return h&&await new Promise(v=>Ct.schedule(v)),{navigates:h}}async function sr(e,t){return On(W(e.orgSlug,e.virtualMcpId)),Dn(e,t)}function At(e){return e.branch?JSON.stringify(e.queryClient.getQueryData(g.protocolDraftRead(e.orgSlug,e.virtualMcpId,e.branch))??null):null}async function Dn(e,t){const n=W(e.orgSlug,e.virtualMcpId),o=t.adopted?At(e):null;let s;try{s=await t.write()}catch(i){throw ue(n,{ok:!1,navigates:!1}),t.refreshOnError&&fe(e,{kind:t.kind,reread:!0}).catch(()=>{}),i}if(e.backend?.kind==="protocol"&&e.cacheKey&&As(e.cacheKey),yn(n,t.shownRevision?.(s)??null),t.adopted){const i=At(e)!==o;return i&&await new Promise(a=>Ct.schedule(a)),ue(n,{ok:!0,navigates:i}),t.reread&&fe(e,t).catch(()=>{}),s}let r=!1;try{({navigates:r}=await fe(e,t))}catch{}finally{ue(n,{ok:!0,navigates:r})}return s}function Oi(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:s,branch:r}=e,i=W(o,s),a=new Set(t.blockKeys);for(const u of[...V(i).discardListeners])u(a);On(i);let c=!1;const l=()=>(c=!0,Dn(e,{kind:"discard",reread:!0,write:t.write}));return r?n.getMutationCache().build(n,{mutationKey:ke(o,s,r),scope:us(o,s,r),mutationFn:l}).execute(void 0).catch(u=>{throw c||ue(i,{ok:!1,navigates:!1}),u}):l()}function Ei(e,t,n){const o=N.c(8);let s;o[0]!==e||o[1]!==t?(s=W(e,t),o[0]=e,o[1]=t,o[2]=s):s=o[2];const r=s;let i;o[3]!==n||o[4]!==r?(i=()=>{const c=V(r).discardListeners;return c.add(n),()=>{c.delete(n)}},o[3]=n,o[4]=r,o[5]=i):i=o[5];let a;o[6]!==r?(a=[r],o[6]=r,o[7]=a):a=o[7],L.useEffect(i,a)}function In(e){const t=W(e.orgSlug,e.virtualMcpId);me(t).inFlight>0||(yn(t,null),fe(e,{kind:"external"}).then(({navigates:n})=>{const o=V(t);o.previews>0&&o.state.inFlight===0&&En(t,n)}).catch(()=>{}))}function rr(e,t){const n=N.c(7);let o;n[0]!==e||n[1]!==t?(o=W(e,t),n[0]=e,n[1]=t,n[2]=o):o=n[2];const s=o;let r;n[3]!==s?(r=l=>nr(s,l),n[3]=s,n[4]=r):r=n[4];const i=r;let a;n[5]!==s?(a=()=>me(s),n[5]=s,n[6]=a):a=n[6];const c=a;return L.useSyncExternalStore(i,c,c)}const ir=500;function Di(e,t){const{phase:n}=rr(e,t);return js(n!=="idle",ir)}function ar(e){const t=new Error(`${e} unavailable (content server unreachable)`);return t.status=502,t}function _n(e,t){return g.liveMeta(e.orgSlug,e.virtualMcpId,e.branch,`protocol${t.cacheKeySuffix}`,"")}function Ii(e,t,n,o){if(o?.source==="github"){const i=e.getQueryData(g.contentIndex(t));return i?Do(i,n):cr(e,t,n)}const s=e.getQueryData(g.contentVersions(t));if(!s)return;if(Object.hasOwn(s,n))return s[n];const r=e.getQueryData(g.decofile(t));return r&&Object.hasOwn(r,n)?void 0:null}function Tn(e,t){if(Object.hasOwn(e.changes,t))return e.changes[t];const n=B(t),o=Object.keys(e.changes).find(s=>B(s)===n);return o===void 0?void 0:e.changes[o]}function cr(e,t,n){const o=e.getQueryData(g.contentChanges(t));if(o)return Rn(o,Ee(e,t),n)}function Rn(e,t,n){const o=Tn(e,n);return o?.kind==="delete"?o.version??Z:o?o.version:t.has(B(n))?Z:null}function _i(e,t,n){const o=e.getQueryData(g.contentChanges(t));if(!o)return!1;const s=Tn(o,n);return s?s.kind==="set"&&s.baseVersion===null:Ee(e,t).has(B(n))}function Ti(e,t){const n=e.getQueryData(g.decofile(t)),o=e.getQueryData(g.contentChanges(t));if(!n||!o)return null;const s=Ee(e,t);return{blocks:n,versionOf:r=>Rn(o,s,r)}}function Ee(e,t){return new Set(e.getQueryData(g.contentDraftTombstones(t)))}function we(e,t,n,o){const s=B(n),r=Ee(e,t);r.has(s)!==o&&(o?r.add(s):r.delete(s),Y(e),e.setQueryData(g.contentDraftTombstones(t),[...r]))}function xn(e,t,n,o){const s=o.revision,r=e.getQueryData(g.contentVersions(n)),i=Object.entries(o.versions??{}).map(([f,h])=>[f,h===Z?null:h]),a=e.getQueryData(g.contentChanges(n)),c=e.getQueryData(g.contentIndex(n)),l=new Set(i.flatMap(([f])=>$e(f,c,a,r)===null?[f]:[])),u=new Set(i.flatMap(([f,h])=>h===null?[]:[B(f)]));e.setQueryData(g.contentChanges(n),f=>{if(!f)return f;const h={...f.changes};for(const[v,b]of i){const p=$e(v,c,f,r);b!==null?h[v]={kind:"set",version:b,baseVersion:p}:p!==null?h[v]={kind:"delete",version:null,baseVersion:p}:delete h[v]}return{...f,changes:h,edited:!0}});for(const[f,h]of i)h!==null?we(e,n,f,!1):!u.has(B(f))&&l.has(f)&&we(e,n,f,!0);const d=o.revision;return d&&d!=="none"&&e.setQueryData(g.protocolDraftRead(t.orgSlug,t.virtualMcpId,t.branch),f=>f&&{...f,version:d}),s}function De(e,t,n){Y(e),e.setQueryData(g.contentVersions(t),o=>{const s={...o};for(const[r,i]of Object.entries(n))i===null?delete s[r]:s[r]=i;return s})}function Pn(e,t){const n=e.getMutationCache().findAll({mutationKey:ke(t.orgSlug,t.virtualMcpId,t.branch),status:"pending"});return new Set(n.flatMap(o=>Co(o.state.variables)))}function Le(e,t){e.resetQueries({queryKey:g.contentBackend(t.orgSlug,t.virtualMcpId,"local")})}async function se(e,t,n,o){try{return await o()}catch(s){const r=!(s instanceof y);throw t.source==="local"&&r?(Le(e,n),new fn(s)):(t.source==="local"&&Je(s)&&Le(e,n),s)}}const Mt=new WeakMap;function ct(e){let t=Mt.get(e);return t||(t={inFlight:new Map,rereading:new Set},Mt.set(e,t)),t}function Nn(e,t,n,o){const{inFlight:s}=ct(e),r=s.get(o);if(r)return r;const i=lt(e,t,n,o,!0);return s.set(o,i),i.finally(()=>{s.get(o)===i&&s.delete(o)})}function lr(e,t,n){const o=N.c(8),s=G(),r=t?.orgSlug,i=t?.virtualMcpId,a=t?.branch;let c,l;o[0]!==e||o[1]!==a||o[2]!==n||o[3]!==r||o[4]!==s||o[5]!==i?(c=()=>{if(!e||!r||!i||!a)return;const u={orgSlug:r,virtualMcpId:i,branch:a},{rereading:d}=ct(s);return Ms(f=>{f===n&&(d.has(n)||(d.add(n),fr(s,e,u,n).catch(ur).finally(()=>d.delete(n))))})},l=[s,e,r,i,a,n],o[0]=e,o[1]=a,o[2]=n,o[3]=r,o[4]=s,o[5]=i,o[6]=c,o[7]=l):(c=o[6],l=o[7]),L.useEffect(c,l)}function ur(){}async function fr(e,t,n,o){const s=ct(e).inFlight.get(o);return s&&await s.catch(()=>{}),Nn(e,t,n,o)}async function lt(e,t,n,o,s){Y(e);const r=g.decofile(o),i=_n(n,t),a=g.contentRevision(o),c=g.contentVersions(o),l=e.getQueryData(r),u=e.getQueryData(c),f=e.getQueryData(i),h=e.getQueryData(a)??void 0,v=s&&l&&u?h?.revision:void 0,b=s&&f?h?.schemaVersion:void 0,p=g.contentChanges(o),R=e.getQueryData(p);if(t.source==="github"&&t.hosted)return dr(e,t,t.hosted,n,o,{conditional:s,seen:h,currentMeta:f,schemaIfNoneMatch:b,seenChanges:R});const[k,$,I]=await se(e,t,n,()=>t.client.batch([{method:"blocks.list",params:v?{ifNoneMatch:v}:{}},{method:"schema.get",params:b?{ifNoneMatch:b}:{}},{method:"changes.list",params:He(R)}])),_=e.getQueryData(a)?.revision,T=_!==void 0&&_!==h?.revision;if(I?.ok){const E=T?null:de(R,I.result);E&&e.setQueryData(p,E)}else I&&t.source==="local"&&Je(I.error)&&Le(e,n);if(!k?.ok)throw k?.error??new Error("no blocks.list");if(!$)throw new Error("no schema.get");const S=k.result,O=Ze($),D=$.ok&&!O?$.result:null;if(S.notModified&&(!l||!u)||D?.notModified&&!f)return lt(e,t,n,o,!1);const x=S.notModified?new Set:Pn(e,n),A=S.notModified?l:Qo(S.blocks,l,x),m=O?on():D?D.notModified?f:D.schema:$.error;if(e.setQueryData(a,{revision:T?_:S.notModified?h?.revision:S.revision,schemaVersion:D?D.notModified?h?.schemaVersion:D.version??void 0:void 0}),e.setQueryData(r,A),!S.notModified){const E=e.getQueryData(c),j={...S.versions};for(const U of x){const M=E?.[U];M!==void 0?j[U]=M:delete j[U]}e.setQueryData(c,j)}return m instanceof y||e.setQueryData(i,m),!T&&!S.notModified&&l&&h?.revision&&S.revision!==h.revision&&In({queryClient:e,orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,backend:t,cacheKey:o}),{blocks:A,meta:m}}async function dr(e,t,n,o,s,r){const i=g.decofile(s),a=g.contentIndex(s),c=g.contentRevision(s),l=g.contentVersions(s),u=_n(o,t),d=g.contentChanges(s),f=e.getQueryData(a),h=r.conditional&&f?r.seen?.revision:void 0,[v,b,p]=await se(e,t,o,()=>n.batch([{method:"cms.index",params:h?{ifNoneMatch:h}:{}},{method:"schema.get",params:r.schemaIfNoneMatch?{ifNoneMatch:r.schemaIfNoneMatch}:{}},{method:"changes.list",params:He(r.seenChanges)}])),R=e.getQueryData(a)??f,k=e.getQueryData(c)?.revision,$=k!==void 0&&k!==r.seen?.revision;if(p?.ok&&!$){const P=de(r.seenChanges,p.result);P&&e.setQueryData(d,P)}if(!v?.ok)throw v?.error??new Error("no cms.index");if(!b)throw new Error("no schema.get");const I=v.result,_=Ze(b),T=b.ok&&!_?b.result:null;if(I.notModified&&!f||T?.notModified&&!r.currentMeta)return lt(e,t,o,s,!1);const S=_?on():T?T.notModified?r.currentMeta:T.schema:b.error;S instanceof y||e.setQueryData(u,S);const O=T?T.notModified?r.seen?.schemaVersion:T.version??void 0:void 0,D=e.getQueryData(i)??{};if(I.notModified||$)return e.setQueryData(c,{revision:$?k:r.seen?.revision,schemaVersion:O}),e.setQueryData(i,D),{blocks:D,meta:S};const x={revision:I.revision,resolvedRef:I.resolvedRef,sequence:I.sequence,entries:I.entries,draft:I.draft};e.setQueryData(a,x);const A=!!r.seen?.revision&&x.revision!==r.seen.revision&&(!r.seen.revision.startsWith("s-")||!!f&&jn(f.draft,x.draft));A&&e.setQueryData(g.protocolDraftRead(o.orgSlug,o.virtualMcpId,o.branch),P=>P&&{...P,version:x.revision}),e.setQueryData(c,{revision:x.revision,schemaVersion:O});const m=Pn(e,o),E=e.getQueryData(l)??{},j={},U={},M=[];for(const[P,H]of Object.entries(D)){const J=x.entries[P];!J&&!m.has(P)||(j[P]=H,E[P]!==void 0&&(U[P]=E[P]),J&&!m.has(P)&&E[P]!==J.version&&M.push(P))}return e.setQueryData(i,j),e.setQueryData(l,U),M.length>0&&await ze(e,n,s,M,m),R&&A&&hr(R,x)&&In({queryClient:e,orgSlug:o.orgSlug,virtualMcpId:o.virtualMcpId,branch:o.branch,backend:t,cacheKey:s}),{blocks:e.getQueryData(i)??j,meta:S}}function hr(e,t){if(jn(e.draft,t.draft))return!0;const n=Object.keys(t.entries);return n.length!==Object.keys(e.entries).length?!0:n.some(o=>!Object.hasOwn(e.entries,o)||e.entries[o]?.version!==t.entries[o]?.version)}function jn(e,t){const n=Object.keys(t);return n.length!==Object.keys(e).length?!0:n.some(o=>!Object.hasOwn(e,o)||e[o]?.version!==t[o]?.version)}function gr(e,t){const n=[...Object.keys(t.set??{}),...t.delete??[]];return Object.fromEntries(n.filter(o=>Object.hasOwn(e,o)).map(o=>[o,e[o]]))}function _e(e){if(!(e instanceof y)||e.code!==w.Unavailable)return;const t=e.data?.landed;if(!(!t||typeof t!="object"||Array.isArray(t)))return Object.fromEntries(Object.entries(t).filter(n=>typeof n[1]=="string"))}async function vr(e,t){if(!(e instanceof y)||e.code!==w.Conflict)return;const n=e.data?.entries;if(!n||typeof n!="object")return;const o=Object.entries(n);if(o.length===0)return;const s=t.set??{},r=new Set(t.delete??[]),i={};for(const[a,c]of o){const l=c?.actual;if(typeof l!="string"||(Object.hasOwn(s,a)?await eo(s[a]):r.has(a)?Z:void 0)!==l)return;i[a]=l}return i}function br(e,t){const n=Object.fromEntries(Object.entries(e.set??{}).filter(([s])=>!Object.hasOwn(t,s))),o=(e.delete??[]).filter(s=>!Object.hasOwn(t,s));return{...Object.keys(n).length>0?{set:n}:{},...o.length>0?{delete:o}:{}}}function ie(e,t,n,o,s){Y(e),xn(e,t,n,{revision:e.getQueryData(g.contentRevision(n))?.revision??"",versions:s}),De(e,n,Object.fromEntries(Object.entries(s).map(([r,i])=>[r,i===Z?null:i]))),qt(e,n,s,o.set??{})}async function Ri(e,t,n,o,s,r){if(t.source==="github"){const a=[...Object.keys(s.set??{}),...s.delete??[]].filter(l=>!r||!Object.hasOwn(r,l));if(a.length>0)throw new Error(`A hosted save needs a precondition for every block it touches (missing: ${a.join(", ")})`);const c=qn(s.set);if(c.length>0)throw new Error(`A hosted save can't write a block that isn't loaded (${c.join(", ")})`)}return sr({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=(u,d=r)=>se(e,t,n,()=>t.client.blocksApply({set:u.set,delete:u.delete,...d?{ifMatch:gr(d,u)}:{}}));let a;try{a=await i(s)}catch(u){const d=t.source==="github"?_e(u):void 0;if(!d)throw u;const f=br(s,d);Object.keys(d).length>0&&ie(e,n,o,s,d);let h;try{h=await i(f)}catch(v){const b=_e(v);b&&Object.keys(b).length>0&&ie(e,n,o,f,b);const p=await vr(v,f);if(!p)throw v;ie(e,n,o,f,p);try{h=await i(f,{...r,...p})}catch(R){const k=_e(R);throw k&&Object.keys(k).length>0&&ie(e,n,o,f,k),R}}a={...h,versions:{...d,...h.versions}}}Y(e);const c=t.source==="github"?xn(e,n,o,a):a.revision;t.source==="github"&&qt(e,o,a.versions??{},s.set??{}),e.setQueryData(g.contentRevision(o),u=>({...u,revision:c}));const l=a.versions??{};return De(e,o,l),{revision:c,versions:l}}})}function $n(e,t){if(!(e instanceof y))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 An(e,t,n){if(!(n instanceof y))return;const o=n.data?.draft;if(!(!o||typeof o!="object"))for(const[s,r]of Object.entries(o))r===null&&we(e,t,s,!1)}function Mn(e,t,n,o){Y(e),Kn(e,n,o);const s=o.block===null,r=e.getQueryData(g.contentVersions(t)),i=e.getQueryData(g.contentChanges(t)),a=$e(n,e.getQueryData(g.contentIndex(t)),i,r);if(i){const c=B(n),l=Object.fromEntries(Object.entries(i.changes).filter(([u])=>B(u)!==c));s?a!==null&&(l[n]={kind:"delete",version:null,baseVersion:a}):l[n]={kind:"set",version:o.version,baseVersion:a},e.setQueryData(g.contentChanges(t),{...i,changes:l,edited:!0})}we(e,t,n,s&&a===null),e.setQueryData(g.decofile(t),c=>{const l={...c};return s?delete l[n]:l[n]=o.block,l}),De(e,t,{[n]:s?null:o.version}),Io(e,t,n,o)}function xi(e,t,n,o){if(t.source!=="github"||!(o instanceof y))return!1;An(e,n,o);const s=o.data?.draft;if(!s||typeof s!="object")return!1;const r=Object.keys(s),i=r.map(a=>$n(o,a));return r.length===0||i.some(a=>a===void 0)?!1:(e.cancelQueries({queryKey:g.decofile(n)}),r.forEach((a,c)=>{Mn(e,n,a,i[c])}),!0)}async function Pi(e,t,n,o,s,r){t.source==="github"&&An(e,o,r);const i=t.source==="github"?$n(r,s):void 0;if(i)return e.cancelQueries({queryKey:g.decofile(o)}),Mn(e,o,s,i),!0;await e.invalidateQueries({queryKey:g.decofile(o)});let a;try{const l=(await se(e,t,n,()=>t.client.changesGet({names:[s]}))).entries[s];if(l&&l.after===null&&l.version!==null)return!1;a={value:l?.after??null,version:l?.version??null},t.source==="github"&&e.setQueryData(g.contentChanges(o),u=>{if(!u)return u;const d={...u.changes};return l?.kind?d[s]={kind:l.kind,version:l.version,baseVersion:l.baseVersion}:delete d[s],{...u,changes:d,edited:!0}})}catch{const c=await se(e,t,n,()=>t.client.blocksList({}));if(c.notModified)return!1;a={value:c.blocks[s]??null,version:c.versions[s]??null}}return e.setQueryData(g.decofile(o),c=>{const l={...c};return a.value===null?delete l[s]:l[s]=a.value,l}),De(e,o,{[s]:a.version}),!1}function pr(e){const t=N.c(17),n=Be(e?.virtualMcpId)?.metadata;let o;t[0]!==n?(o=Ut(n),t[0]=n,t[1]=o):o=t[1];const s=o;let r;t[2]!==e?.branch||t[3]!==e?.orgSlug||t[4]!==e?.virtualMcpId?(r=g.protocolDraftRead(e?.orgSlug??"",e?.virtualMcpId??"",e?.branch??""),t[2]=e?.branch,t[3]=e?.orgSlug,t[4]=e?.virtualMcpId,t[5]=r):r=t[5];let i;t[6]!==e||t[7]!==s?(i=async()=>{const b=await Qt(s,e.branch),p=b.pointer?.lastIndexOf("@")??-1;return{draft:b.pointer&&p>0?b.pointer.slice(0,p):null,version:b.pointer&&p>0?b.pointer.slice(p+1):b.etag}},t[6]=e,t[7]=s,t[8]=i):i=t[8];const a=!!e&&!!s;let c;t[9]!==r||t[10]!==i||t[11]!==a?(c={queryKey:r,queryFn:i,enabled:a,staleTime:Number.POSITIVE_INFINITY},t[9]=r,t[10]=i,t[11]=a,t[12]=c):c=t[12];const{data:l,isPending:u,isError:d}=C(c),f=!!e&&!!s&&u&&!d;if(!e||!l?.draft||!l.version){let b;return t[13]!==f?(b={pointer:null,pending:f},t[13]=f,t[14]=b):b=t[14],b}const h=`${l.draft}@${l.version}`;let v;return t[15]!==h?(v={pointer:h,pending:!1},t[15]=h,t[16]=v):v=t[16],v}function Ni(e){return pr(e).pointer}function ji(e){const t=N.c(4);let n;t[0]!==e?(n=g.contentRevision(e),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:mr,staleTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:s}=C(o);return s?.revision}async function mr(){throw new Error("content revisions are set by reads and writes")}function ut(e,t){const n=N.c(6),{url:o}=sn(e?.virtualMcpId),s=re(e?.virtualMcpId,e?.branch);if(!e)return"";let r;return n[0]!==s.cacheKeySuffix||n[1]!==s.kind||n[2]!==o||n[3]!==t?.tunnel||n[4]!==e?(r=s.kind!=="legacy"&&s.cacheKeySuffix!==void 0?je({...e,protocolSuffix:s.cacheKeySuffix}):je({...e,localPreviewUrl:t?.tunnel===!1?null:o}),n[0]=s.cacheKeySuffix,n[1]=s.kind,n[2]=o,n[3]=t?.tunnel,n[4]=e,n[5]=r):r=n[5],r}function $i(e,t){const n=N.c(46),{url:o}=sn(e?.virtualMcpId),s=!!o,r=re(e?.virtualMcpId,e?.branch),i=r.kind==="protocol"?r:null,a=ut(e),c=t?.fetchEnabled??!0,l=Rs(e?.virtualMcpId),u=Ft(e?.virtualMcpId).runtime==="cms",d=G();let f;n[0]!==a?(f=g.decofile(a),n[0]=a,n[1]=f):f=n[1];const h=f;lr(i,i&&e?e:null,a);let v;n[2]!==e||n[3]!==d||n[4]!==h?(v=()=>{if(!e||d.isMutating({mutationKey:ke(e.orgSlug,e.virtualMcpId,e.branch)})>0)return!0;const E=d.getQueryState(h);return E?.fetchStatus==="fetching"||Date.now()-(E?.dataUpdatedAt??0)<an/2},n[2]=e,n[3]=d,n[4]=h,n[5]=v):v=n[5];let b;n[6]!==u||n[7]!==s||n[8]!==e||n[9]!==i||n[10]!==d||n[11]!==h?(b=async()=>{if(e){if(!i&&u&&!s){const E=hs(d,e)?.version;if(E&&!await gs(e,E))return}await d.refetchQueries({queryKey:h,exact:!0},{cancelRefetch:!1})}},n[6]=u,n[7]=s,n[8]=e,n[9]=i,n[10]=d,n[11]=h,n[12]=b):b=n[12];let p;n[13]!==v||n[14]!==b?(p={skip:v,read:b},n[13]=v,n[14]=b,n[15]=p):p=n[15],Ss(!!t?.pollWhile&&!!e,p);const R=Xe(i?.hosted?a:"");let k;n[16]!==r.kind||n[17]!==u||n[18]!==c||n[19]!==a||n[20]!==s||n[21]!==o||n[22]!==l||n[23]!==e||n[24]!==i||n[25]!==d?(k=async()=>{if(i)return(await Nn(d,i,e,a)).blocks;if(r.kind==="unavailable")throw ar("decofile");if(s){const M=await fetch(new URL("/.decofile",o).toString(),{cache:"no-store"}).catch(yr),Q=M?.ok?Rt(await M.text()):null;if(Q)return Q;const P=new Error("decofile unavailable (local tunnel unreachable)");throw P.status=502,P}if(u)return bs(d,e);const E=()=>Ts(e,ls(l,".deco/blocks.gen.json"));if(c){const M=await fetch(Ds(e),{cache:"no-store"}).catch(wr);if(M?.ok){const H=Rt(await M.text());if(H)return H}const Q=await E();if(Q.kind==="data")return Q.data;const P=new Error(`Failed to fetch decofile: ${M?.status??"network error"}`);throw P.status=Pt({liveOk:!!M?.ok,liveStatus:M?.status,committedAbsent:Q.kind==="absent"}),P}const j=await E();if(j.kind==="data")return j.data;const U=new Error("decofile unavailable (preview down, no committed snapshot)");throw U.status=Pt({liveOk:!1,committedAbsent:j.kind==="absent"}),U},n[16]=r.kind,n[17]=u,n[18]=c,n[19]=a,n[20]=s,n[21]=o,n[22]=l,n[23]=e,n[24]=i,n[25]=d,n[26]=k):k=n[26];const $=!!e&&r.kind!=="pending",I=i?0:3e4,_=i?.describe.pollIntervalMs,T=i?"always":void 0;let S;n[27]!==u||n[28]!==s||n[29]!==i?(S=(E,j)=>{if(i||u||s)return E<3;const U=j.status;return U!==502&&U!==404&&E<2},n[27]=u,n[28]=s,n[29]=i,n[30]=S):S=n[30];let O;n[31]!==h||n[32]!==k||n[33]!==$||n[34]!==I||n[35]!==_||n[36]!==T||n[37]!==S?(O={queryKey:h,queryFn:k,enabled:$,staleTime:I,refetchInterval:_,refetchIntervalInBackground:!1,refetchOnWindowFocus:T,retry:S,retryDelay:cs},n[31]=h,n[32]=k,n[33]=$,n[34]=I,n[35]=_,n[36]=T,n[37]=S,n[38]=O):O=n[38];const D=C(O);let x;n[39]!==R||n[40]!==D?(x=R&&D.data?Oo(R,D.data):void 0,n[39]=R,n[40]=D,n[41]=x):x=n[41];const A=x;let m;return n[42]!==A||n[43]!==i?.hosted||n[44]!==D?(m=i?.hosted&&A?{...D,data:A}:D,n[42]=A,n[43]=i?.hosted,n[44]=D,n[45]=m):m=n[45],m}function wr(){return null}function yr(){return null}function Ai(e,t,n){return rs(e,t,n)}function Mi(e){const t=N.c(4),n=G(),o=re(e?.virtualMcpId,e?.branch),s=ut(e),r=o.kind==="protocol"?o.hosted:void 0;let i;return t[0]!==s||t[1]!==n||t[2]!==r?(i=(a,c)=>_o(n,r,s,a,c),t[0]=s,t[1]=n,t[2]=r,t[3]=i):i=t[3],i}function Li(e,t){const n=N.c(3),o=re(e?.virtualMcpId,e?.branch),s=ut(e),r=Xe(o.kind==="protocol"&&o.hosted?s:"");let i;return n[0]!==r?.entries||n[1]!==t?(i=Object.entries(r?.entries??{}).filter(a=>{const[,c]=a;return t(c.meta?.type??"")}).map(Sr),n[0]=r?.entries,n[1]=t,n[2]=i):i=n[2],i}function Sr(e){const[t]=e;return t}const kr="site-editor-save",Ln={id:kr,description:void 0,action:void 0,cancel:void 0},Ui="site-editor-undo",Ue="site-editor-publish";function Or(e){const t=N.c(7),{label:n,detail:o}=e;let s;t[0]!==n?(s=X.jsx("summary",{className:"cursor-pointer select-none text-muted-foreground",children:n}),t[0]=n,t[1]=s):s=t[1];let r;t[2]!==o?(r=X.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words font-mono text-muted-foreground",children:o}),t[2]=o,t[3]=r):r=t[3];let i;return t[4]!==s||t[5]!==r?(i=X.jsxs("details",{className:"mt-1 text-xs",children:[s,r]}),t[4]=s,t[5]=r,t[6]=i):i=t[6],i}function Un(e,t){return t?X.jsx(Or,{label:e("siteEditor.details"),detail:t}):void 0}function Qi(e,t,n){ne.error(hn(e,t,n),{...Ln,description:Un(e,xs(t,n))})}function Ci(e,t,n=!1){ne.info(e(t?"sectionsEditor.reconcile.leftDeleted":"sectionsEditor.reconcile.keptTheirs"),{...Ln,description:e(t?n?"sectionsEditor.reconcile.leftDeletedNeverPublishedHint":"sectionsEditor.reconcile.leftDeletedHint":"sectionsEditor.reconcile.keptTheirsHint")})}const Qn={action:void 0,duration:void 0};function Bi(e,t){ne.success(t?e("siteEditor.publish.publishedOn",{host:t}):e("siteEditor.publish.published"),{...Qn,id:Ue,description:void 0})}function Fi(e,{headline:t,body:n,detail:o,retry:s,pending:r,tone:i="error"}){const a=Un(e,o??null);ne[i](t,{id:Ue,description:n&&a?X.jsxs(X.Fragment,{children:[X.jsx("p",{children:n}),a]}):n??a,action:s?{label:e("siteEditor.tryAgain"),onClick:c=>{c.preventDefault(),ne.loading(r??e("thread.publishPopover.publishing"),{...Qn,id:Ue,description:void 0}),s()}}:void 0,duration:s?Number.POSITIVE_INFINITY:void 0})}function Vi(e){return e instanceof Error?e.message||null:e==null?null:String(e)}export{fs as $,Ws as A,Us as B,Ts as C,tn as D,di as E,Gr as F,pr as G,W as H,qs as I,wi as J,bi as K,ve as L,Fs as M,Vs as N,ii as O,pi as P,ci as Q,ki as R,Si as S,Kt as T,rr as U,ji as V,ui as W,us as X,ke as Y,sr as Z,_s as _,Hr as a,fi as a$,Mo as a0,ns as a1,Lr as a2,Qr as a3,Zr as a4,Et as a5,Dt as a6,qr as a7,Wr as a8,zr as a9,nt as aA,si as aB,fr as aC,rt as aD,Ri as aE,Pi as aF,Qi as aG,Ii as aH,ds as aI,ei as aJ,Ei as aK,Ti as aL,it as aM,Kr as aN,Ni as aO,li as aP,xi as aQ,ee as aR,ai as aS,Fi as aT,Ui as aU,Ln as aV,y as aW,w as aX,ze as aY,Pn as aZ,Oo as a_,bo as aa,Un as ab,Vi as ac,Cs as ad,Ur as ae,_n as af,ao as ag,Or as ah,yi as ai,mi as aj,rs as ak,Es as al,Nn as am,ar as an,cs as ao,oi as ap,Ue as aq,Qn as ar,Bi as as,Oi as at,Ar as au,Mr as av,Je as aw,Ci as ax,_i as ay,ri as az,Ao as b,ni as b0,hi as b1,gi as b2,vi as b3,sn as c,Mi as d,Vr as e,Li as f,Di as g,Yr as h,Jr as i,$i as j,Ai as k,vo as l,po as m,Gt as n,ts as o,Cr as p,ti as q,Fr as r,Br as s,ks as t,re as u,ut as v,Xr as w,Rs as x,ls as y,Js as z};
|
|
1
|
+
import{c as N,q as G,i as C,K as g,er as Qe,cs as Bn,aF as Lt,aG as K,bl as Ce,bt as Fn,dA as Ie,dy as Vn,es as ye,et as Hn,eu as Jn,r as L,ev as Wn,ew as Y,ex as Z,bz as Gn,a as Yn,at as Te,a4 as zn,bv as Ut,ey as Xn,ez as Qt,ar as Zn,bp as B,ea as Ct,eA as qn,eB as Kn,eC as eo,t as ne,j as X}from"./index-BqA84bKQ.js";import{u as Be}from"./repository-binding-CekCSlJ1.js";import{e as Bt}from"./backoff-CrEUbyZT.js";import{b as Se}from"./sandbox-url-D3mC8qhT.js";import{u as to}from"./chat-context-ChgzPsES.js";import{i as no,u as oo}from"./use-sandbox-events-f-PdmD_K.js";import{u as Fe}from"./use-blocks-v8-project-DVyeNJpE.js";import{u as Ft}from"./use-voice-input-B4K2dw_4.js";import{s as ft}from"./thread-intent-DWdkWFbM.js";import{s as so}from"./utils-GS2Z_6Er.js";import{a as ro}from"./sandbox-git-api-WjmMCJsj.js";const w={MethodNotFound:-32601,InvalidParams:-32602,InternalError:-32603,NotFound:-32001,Conflict:-32002,InvalidBlock:-32003,ReadOnly:-32005,Unsupported:-32006,LimitExceeded:-32007,Unavailable:-32008,Unauthorized:-32010};class y 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 y(t.code,t.message,t.data)}}const te="deco-content",Re={major:1},Vt=1;async function io(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 xe={major:Re.major,minor:Vt},Ht=`the endpoint speaks an older ${te} than this client needs (${xe.major}.${xe.minor} or newer): update @decocms/blocks in the site (8.2.0 or newer) and start deco serve again`;function ae(e,t,n){const o={reason:t,required:{...xe}};if(n){o.actual={protocol:n.protocol,major:n.version?.major,minor:n.version?.minor};const s=n.server;typeof s?.name=="string"&&typeof s.version=="string"&&(o.server={name:s.name,version:s.version})}return new y(w.Unsupported,e,o)}function Jt(e){const t=e??{},{protocol:n,version:o}=t;if(n!==te)throw ae(`the endpoint speaks ${JSON.stringify(n)}, not ${te}`,"protocol",t);if(o?.major!==Re.major)throw ae(`the endpoint speaks ${te} ${String(o?.major)}.x; this client speaks ${Re.major}.x`,"major",t);if(typeof o.minor!="number"||o.minor<Vt)throw ae(Ht,"outdated",t);return e}function dt(e,t){return t.code===w.MethodNotFound&&e.startsWith("changes.")?ae(Ht,"outdated"):y.from(t)}function Ve(e){const t=e.fetch??(r=>fetch(r));let n=1;async function o(r){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(r)}));let c;try{c=await io(a)}catch{throw new y(w.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?y.from(l):new y(w.Unavailable,`the endpoint answered HTTP ${a.status}`)}return c}const s=async(r,i)=>{const a=n++,c=await o({jsonrpc:"2.0",id:a,method:r,params:i??{}});if(c.error)throw dt(r,c.error);return c.result};return{call:s,describe:async()=>Jt(await s("describe")),schemaGet:r=>s("schema.get",r),blocksList:r=>s("blocks.list",r),blocksApply:r=>s("blocks.apply",r),changesList:r=>s("changes.list",r),changesGet:r=>s("changes.get",r),changesDiscard:r=>s("changes.discard",r),async batch(r){const i=r.map(()=>n++),a=await o(r.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 d=c.get(l);return d?d.error?{ok:!1,error:dt(r[u].method,d.error)}:{ok:!0,result:d.result}:{ok:!1,error:new y(w.InternalError,"no response for this call")}})}}}function He(e){return e&&!e.edited?{ifNoneMatch:e.revision}:{}}const ht=20,gt=5,vt=500;function Je(e){return e instanceof y?e.code===w.MethodNotFound?!0:e.code===w.Unsupported&&e.data?.reason==="outdated":!1}function de(e,t,n=e){return n&&n!==e?n:t.notModified?e?{...e,base:t.base}:null:{revision:t.revision,base:t.base,changes:t.changes}}async function ao(e,t,n){const o=g.contentChanges(n),s=e.getQueryData(o),r=await t.changesList(He(s)),i=de(s,r,e.getQueryData(o));if(i)return i;const a=await t.changesList({}),c=de(void 0,a,e.getQueryData(o));if(!c)throw new y(w.InternalError,"changes.list returned notModified without a cached list");return c}async function Wt(e,t){const n=[];for(let r=0;r<t.length;r+=ht)n.push(t.slice(r,r+ht));const o=Object.create(null),s=[];for(let r=0;r<n.length;r+=gt){const i=await e.batch(n.slice(r,r+gt).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),s.push(...c.diagnostics)}}return{entries:o,diagnostics:s}}async function Ar(e,t){let n={revision:"",versions:{}};for(let o=0;o<t.length;o+=vt){const s=t.slice(o,o+vt),r=await e.changesDiscard({names:s.map(i=>i.name),ifMatch:Object.fromEntries(s.map(i=>[i.name,i.version]))});n={revision:r.revision,versions:{...n.versions,...r.versions}}}return n}function Mr(e){return e instanceof y&&e.code===w.Conflict}function We(e){return e?.kind==="protocol"?e:null}function Lr(e,t,n){const o=N.c(14);let s;o[0]!==n?(s={},o[0]=n,o[1]=s):s=o[1];const r=s,i=G();let a;o[2]!==e?(a=We(e),o[2]=e,o[3]=a):a=o[3];const c=a,l=!!c&&!!t&&r.enabled!==!1;let u;o[4]!==t?(u=g.contentChanges(t??""),o[4]=t,o[5]=u):u=o[5];let d;o[6]!==t||o[7]!==l||o[8]!==c||o[9]!==i?(d=l?()=>ao(i,c.client,t):Qe,o[6]=t,o[7]=l,o[8]=c,o[9]=i,o[10]=d):d=o[10];let f;return o[11]!==u||o[12]!==d?(f={queryKey:u,queryFn:d,staleTime:0},o[11]=u,o[12]=d,o[13]=f):f=o[13],C(f)}function co(e){if(!e)return"";const t=Object.entries(e.changes).sort(([n],[o])=>n<o?-1:n>o?1:0).map(([n,o])=>[n,o.kind,o.version,o.baseVersion]);return JSON.stringify([e.revision,e.base.revision,e.base.resolvedRef,t])}function Ur(e,t,n){const o=N.c(14);let s;o[0]!==e?(s=We(e),o[0]=e,o[1]=s):s=o[1];const r=s;let i;o[2]!==n?(i=n?Object.keys(n.changes):[],o[2]=n,o[3]=i):i=o[3];const a=i,c=!!r&&!!t&&!!n&&a.length>0;let l;o[4]!==t||o[5]!==n?(l=g.contentChangeSides(t??"",co(n)),o[4]=t,o[5]=n,o[6]=l):l=o[6];let u;o[7]!==c||o[8]!==a||o[9]!==r?(u=c?()=>Wt(r.client,a):Qe,o[7]=c,o[8]=a,o[9]=r,o[10]=u):u=o[10];let d;return o[11]!==l||o[12]!==u?(d={queryKey:l,queryFn:u,staleTime:Number.POSITIVE_INFINITY},o[11]=l,o[12]=u,o[13]=d):d=o[13],C(d)}function Qr(e,t,n){const o=N.c(16);let s;o[0]!==e?(s=We(e),o[0]=e,o[1]=s):s=o[1];const r=s;let i,a,c,l;if(o[2]!==t||o[3]!==n?.changes||o[4]!==r){const f=Object.entries(n?.changes??{}).filter(go).map(ho).sort(fo);a=f.map(uo);const h=JSON.stringify(f.map(lo));i=!!r&&!!t&&a.length>0,l=C,c=g.contentDeletedCopies(t??"",h),o[2]=t,o[3]=n?.changes,o[4]=r,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]!==r?(u=i?async()=>{const f=await Wt(r.client,a),h=Object.create(null);for(const[v,b]of Object.entries(f.entries))h[v]=b.before&&typeof b.before=="object"?b.before:null;return h}:Qe,o[9]=i,o[10]=a,o[11]=r,o[12]=u):u=o[12];let d;return o[13]!==c||o[14]!==u?(d={queryKey:c,queryFn:u,staleTime:Number.POSITIVE_INFINITY,placeholderData:Bn},o[13]=c,o[14]=u,o[15]=d):d=o[15],l(d)}function lo(e){return[e.name,e.base]}function uo(e){return e.name}function fo(e,t){return e.name<t.name?-1:e.name>t.name?1:0}function ho(e){const[t,n]=e;return{name:t,base:n.baseVersion??""}}function go(e){const[,t]=e;return t.kind==="delete"}function Gt(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 he(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 Yt=Lt({endpoint:K().max(2048).refine(e=>Gt(e)&&new URL(e).pathname==="/rpc").transform(he)});function Cr(e){const t=new URLSearchParams(e.replace(/^#/,"")),n=Yt.safeParse({endpoint:t.get("endpoint")??""});return n.success?n.data:null}function zt(e){const t=Yt.safeParse(e);return t.success?t.data:null}const Xt="studio:deco-serve-last";function Br(e){try{localStorage.setItem(Xt,JSON.stringify(e))}catch{}}function Fr(){try{const e=localStorage.getItem(Xt);return e?zt(JSON.parse(e)):null}catch{return null}}function Vr(e){try{return new URL(he(e)).host}catch{return e}}function vo(e,t=1e4){return Math.min(1e3*2**Math.max(0,e-1),t)}const bo="http://localhost:4545/rpc";class Ge extends Error{constructor(t="the endpoint isn't deco serve"){super(t),this.name="NotDecoServeError"}}function po(e){if(e instanceof Ge)return{reason:"not-deco-serve"};if(!(e instanceof y))return{reason:"not-answering"};switch(e.code){case w.Unauthorized:case w.MethodNotFound:return{reason:"outdated"};case w.Unsupported:return Je(e)?{reason:"outdated"}:{reason:"version-mismatch"};case w.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 Hr(e,t){if(e)return[he(e.endpoint)];const n=[t?.endpoint,bo].filter(o=>!!o).map(he);return[...new Set(n)]}const mo=Lt({blocks:Ie(K(),Ie(K(),Vn()).refine(Ce)),versions:Ie(K(),K().min(1)),missing:Fn(K())});function wo(e,t){const n=mo.parse(e),o=Object.keys(n.blocks),s=Object.keys(n.versions),r=[...o,...n.missing],i=new Set(t);if(s.length!==o.length||o.some(a=>!Object.hasOwn(n.versions,a))||r.length!==i.size||new Set(r).size!==r.length||r.some(a=>!i.has(a)))throw new Error("The CMS block response did not account for the requested names");return n}function oe(e,t){const n=e.index?.entries[t];return!!n&&Ce(e.blocks[t])&&e.versions[t]===n.version}function yo(e,t,n){const o=new Map;let s=!1;for(const[r,i]of Object.entries(n.blocks)){const a=t.index?.entries[r];if(a){if(n.versions[r]!==a.version){s||=a.version===e.index?.entries[r]?.version;continue}t.blocks[r]!==e.blocks[r]||t.versions[r]!==e.versions[r]||o.set(r,i)}}return s||=n.missing.some(r=>!!t.index?.entries[r]),{blocks:o.size?{...t.blocks,...Object.fromEntries(o)}:t.blocks,versions:o.size?{...t.versions,...Object.fromEntries([...o.keys()].map(r=>[r,n.versions[r]]))}:t.versions,refreshIndex:s}}function So(e,t,n){return!!e.index&&t.every(o=>e.index?.entries[o]?oe(e,o)&&(!n||n[o]===e.blocks[o]):!n||n[o]===void 0)}const bt=50,pt=10;function ko(e,t=n=>fetch(n)){let n=1;return{async batch(o){const s=o.map(()=>n++),r=await t(new Request(e,{method:"POST",headers:{"content-type":"application/json"},credentials:"include",signal:ye(),body:JSON.stringify(o.map((c,l)=>({jsonrpc:"2.0",id:s[l],method:c.method,params:c.params??{}})))}));if(!r.ok)throw new y(w.Unavailable,`the hosted CMS answered ${r.status}`);const i=await r.json(),a=new Map((Array.isArray(i)?i:[]).map(c=>[c.id,c]));return s.map(c=>{const l=a.get(c);return l?l.error?{ok:!1,error:y.from(l.error)}:{ok:!0,result:l.result}:{ok:!1,error:new y(w.InternalError,"no response for this call")}})}}}function Oo(e,t){if(!e)return t??{};const n={};for(const[o,s]of Object.entries(e.entries)){if(t&&Object.hasOwn(t,o)){n[o]=t[o];continue}n[o]={[Jn]:!0,...s.meta?.type?{__resolveType:s.meta.type}:{},...s.meta?.path!==void 0?{path:s.meta.path}:{},...s.meta?.refs?.length?{[Hn]:s.meta.refs}:{}}}for(const[o,s]of Object.entries(t??{}))Object.hasOwn(n,o)||(n[o]=s);return n}function Eo(e,t){return e?.entries[t]?.meta?.refs??[]}function Do(e,t){return Object.hasOwn(e.draft,t)?e.draft[t]?.version??null:null}function Ye(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Pe(e,t){if(Array.isArray(e)){for(const n of e)Pe(n,t);return}if(Ye(e))for(const[n,o]of Object.entries(e))n==="__resolveType"&&typeof o=="string"?t.add(o):Pe(o,t)}function Zt(e,t){if(!Ye(e))return;const n={};typeof e.__resolveType=="string"&&(n.type=e.__resolveType),typeof e.path=="string"&&(n.path=e.path);const o=new Set;Pe(e,o);const s=[...o].filter(r=>t.has(r)).sort();return s.length>0&&(n.refs=s),Object.keys(n).length>0?n:void 0}function qt(e,t,n,o){Y(e),e.setQueryData(g.contentIndex(t),s=>{if(!s)return s;const r={...s.entries},i={...s.draft},a=new Set([...Object.keys(r),...Object.keys(o)]);for(const[c,l]of Object.entries(n)){const u=i[c]?.editor??null;if(l===null||l===Z){delete r[c],i[c]={operation:"delete",version:Z,editor:u};continue}const d=Zt(o[c],a);r[c]={version:l,...d?{meta:d}:{}},i[c]={operation:"set",version:l,editor:u}}return{...s,entries:r,draft:i}})}function Io(e,t,n,o){e.setQueryData(g.contentIndex(t),s=>{if(!s)return s;const r={...s.draft},i={...s.entries};if(o===null)delete r[n];else if(r[n]={operation:o.block===null?"delete":"set",version:o.version,editor:r[n]?.editor??null},o.block===null)delete i[n];else{const a=new Set([...Object.keys(i),n]),c=Zt(o.block,a);i[n]={version:o.version,...c?{meta:c}:{}}}return{...s,entries:i,draft:r}})}const mt=new WeakMap;async function ze(e,t,n,o,s=new Set){const r=e.getQueryData(g.contentIndex(n));if(!r)throw new y(w.Unavailable,"The CMS index is not loaded yet");let i=mt.get(e);i||(i=new Map,mt.set(e,i));const a=e.getQueryData(g.decofile(n))??{},c=e.getQueryData(g.contentVersions(n))??{},l=[],u=[];for(const f of new Set(o)){const h=r.entries[f];if(!h||s.has(f)||Ce(a[f])&&c[f]===h.version)continue;const v=i.get(`${n}\0${f}`);v?l.push(v):u.push(f)}if(u.length>0){const f=To(e,t,n,u);for(const h of u){const v=`${n}\0${h}`;i.set(v,f),f.catch(()=>{}).finally(()=>{i.get(v)===f&&i.delete(v)})}l.push(f)}await Promise.all(l);const d=ge(e,n);if(o.some(f=>d.index?.entries[f]&&!s.has(f)&&!oe(d,f)))throw new y(w.Unavailable,"A CMS block changed while loading; try again")}async function _o(e,t,n,o,s){if(!t){const i=o?.[s];return Ye(i)&&!Gn(i)?i:void 0}await ze(e,t,n,[s]);const r=ge(e,n);return r.index?.entries[s]&&oe(r,s)?r.blocks[s]:void 0}function ge(e,t){return{index:e.getQueryData(g.contentIndex(t)),blocks:e.getQueryData(g.decofile(t))??{},versions:e.getQueryData(g.contentVersions(t))??{}}}async function To(e,t,n,o){const s=ge(e,n),r=[];for(let i=0;i<o.length;i+=bt)r.push(o.slice(i,i+bt));for(let i=0;i<r.length;i+=pt){const a=r.slice(i,i+pt),c=await t.batch(a.map(l=>({method:"cms.blocks",params:{names:l}})));if(c.length!==a.length)throw new y(w.InternalError,"Incomplete CMS batch response");for(const[l,u]of c.entries()){if(!u.ok)throw u.error;const d=wo(u.result,a[l]),f=ge(e,n),h=yo(s,f,d);if(Y(e),h.blocks!==f.blocks&&e.setQueryData(g.decofile(n),h.blocks),h.versions!==f.versions&&e.setQueryData(g.contentVersions(n),h.versions),h.refreshIndex)throw e.invalidateQueries({queryKey:g.decofile(n),exact:!0},{cancelRefetch:!1}),new y(w.Unavailable,"The CMS index changed while loading blocks; try again")}}}function Xe(e){const t=N.c(4);let n;t[0]!==e?(n=g.contentIndex(e),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:Ro,staleTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:s}=C(o);return s}async function Ro(){throw new Error("the content index is set by the poll")}function wt(e,t){const n=N.c(8);let o;n[0]!==t?(o=Wn(t),n[0]=t,n[1]=o):o=n[1];const s=o;let r;n[2]!==e||n[3]!==s?(r=a=>e.getQueryCache().subscribe(c=>{c.query.queryHash===s&&a()}),n[2]=e,n[3]=s,n[4]=r):r=n[4];let i;return n[5]!==e||n[6]!==t?(i=()=>e.getQueryData(t),n[5]=e,n[6]=t,n[7]=i):i=n[7],L.useSyncExternalStore(r,i)}const yt=3e4;function xo(e){if(!(e instanceof y))return;const t=e.data?.retryAfterMs;return typeof t=="number"&&t>0?t:void 0}function Po(e,t,n,o){const s=N.c(15),r=G(),i=Xe(t);let a;s[0]!==t?(a=g.decofile(t),s[0]=t,s[1]=a):a=s[1];const c=wt(r,a);let l;s[2]!==t?(l=g.contentVersions(t),s[2]=t,s[3]=l):l=s[3];const u=wt(r,l),d=o?.withRefs??!1,f=new Set(n);if(d)for(const m of n)for(const E of Eo(i,m))f.add(E);const h=[...f].filter(m=>!!i?.entries[m]).sort(),v={index:i,blocks:c??{},versions:u??{}},b=h.some(m=>!oe(v,m)),p=JSON.stringify(h.map(m=>[m,i?.entries[m]?.version,oe(v,m)])),[R,k]=L.useState(null),[$,I]=L.useState(0),_=R?.key===p?R:null;L.useEffect(()=>{if(!e||!p)return;let m=!0;const E=JSON.parse(p).map($o);return ze(r,e,t,E).then(()=>{m&&k(j=>j?.key===p?null:j)},j=>{m&&k(U=>({key:p,count:(U?.key===p?U.count:0)+1,retryAfterMs:xo(j)}))}),()=>{m=!1}},[e,r,t,p,$]);let T;s[4]!==_||s[5]!==I?(T=()=>{if(!_)return;const m=Math.min(yt,_.retryAfterMs??Bt(yt,1e3,_.count-1,2,.5)),E=setTimeout(()=>I(jo),m);return()=>clearTimeout(E)},s[4]=_,s[5]=I,s[6]=T):T=s[6];let S;s[7]!==_?(S=[_],s[7]=_,s[8]=S):S=s[8],L.useEffect(T,S);const O=!e||So(v,[...f],o?.listing),D=!!e&&b&&_!==null;let x;s[9]!==I?(x=()=>I(No),s[9]=I,s[10]=x):x=s[10];let A;return s[11]!==O||s[12]!==D||s[13]!==x?(A={ready:O,failed:D,retry:x},s[11]=O,s[12]=D,s[13]=x,s[14]=A):A=s[14],A}function No(e){return e+1}function jo(e){return e+1}function $o(e){const[t]=e;return t}const Kt=L.createContext(null);function Ao(e){const t=N.c(24),n=L.useContext(Kt),o=Fe(n?null:e),{data:s}=Yn.useSession(),r=s?.user?.id??"",i=!!e&&!!r;let a;t[0]!==i||t[1]!==r||t[2]!==e?(a=i?Te.decoServeConnection(r,e):null,t[0]=i,t[1]=r,t[2]=e,t[3]=a):a=t[3];const[c,l]=kt(a);let u;t[4]!==i||t[5]!==r||t[6]!==e?(u=i?Te.decoServeEndpoint(r,e):null,t[4]=i,t[5]=r,t[6]=e,t[7]=u):u=t[7];const[d,f]=kt(u);if(n)return n;let h;t[8]!==c||t[9]!==i||t[10]!==o?(h=i&&o?zt(c):null,t[8]=c,t[9]=i,t[10]=o,t[11]=h):h=t[11];const v=h,b=i&&o&&typeof d=="string"?d:null;let p;t[12]!==f||t[13]!==l||t[14]!==i?(p=$=>{i&&(l($),f($.endpoint))},t[12]=f,t[13]=l,t[14]=i,t[15]=p):p=t[15];let R;t[16]!==l||t[17]!==i?(R=()=>{i&&l(null)},t[16]=l,t[17]=i,t[18]=R):R=t[18];let k;return t[19]!==v||t[20]!==b||t[21]!==p||t[22]!==R?(k={connection:v,lastEndpoint:b,set:p,clear:R},t[19]=v,t[20]=b,t[21]=p,t[22]=R,t[23]=k):k=t[23],k}function St(e){try{const t=localStorage.getItem(e);return t===null?null:JSON.parse(t)}catch{return null}}function kt(e){const t=N.c(17),n=G(),o=e??"";let s;t[0]!==o?(s=["localStorage",o],t[0]=o,t[1]=s):s=t[1];const r=s;let i,a;t[2]!==e?(i=()=>e?St(e):null,a=()=>e?St(e):null,t[2]=e,t[3]=i,t[4]=a):(i=t[3],a=t[4]);const c=!!e;let l;t[5]!==r||t[6]!==i||t[7]!==a||t[8]!==c?(l={queryKey:r,queryFn:i,initialData:a,enabled:c,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[5]=r,t[6]=i,t[7]=a,t[8]=c,t[9]=l):l=t[9];const{data:u}=C(l);let d;t[10]!==e||t[11]!==n||t[12]!==r?(d=b=>{if(e){try{b===null?localStorage.removeItem(e):localStorage.setItem(e,JSON.stringify(b))}catch{}n.setQueryData(r,b)}},t[10]=e,t[11]=n,t[12]=r,t[13]=d):d=t[13];const f=d,h=e?u??null:null;let v;return t[14]!==f||t[15]!==h?(v=[h,f],t[14]=f,t[15]=h,t[16]=v):v=t[16],v}function en(e,t=""){return{source:e,cacheKeySuffix:e==="github"?"":e==="sandbox"?":sandbox":`:serve:${t}`}}function Mo(e){return JSON.stringify([e.kind==="legacy"?"legacy":"protocol",e.source,e.cacheKeySuffix])}function Jr(e){return e.kind==="protocol"||e.kind==="unavailable"}function Wr(e){const t=e.hasOrg?e.orgFlag:!1,{backend:n}=e;return n===null||n==="legacy"?t:!0}function Gr(e,t,n){return t!=="github"||!n?!1:e.kind==="pending"?!0:e.kind==="unavailable"&&e.siteNotOwned?!1:(e.kind==="protocol"||e.kind==="unavailable")&&e.source==="github"}function Yr(e){if(e.kind!=="protocol"||e.source!=="local")return null;const t=e.describe.preview?.url;return t&&Gt(t)?t:null}function zr(e,t){return e.kind!=="protocol"||e.source!=="local"||!e.describe.assets||!t?null:new URL(t.endpoint).origin}function tn(e){return e.hasServeConnection?"local":e.runtime==="sandbox"?"sandbox":"github"}function Lo(e){if(!e.hasProject)return"legacy";const t=tn(e);if(t==="local")return"protocol-local";if(!e.v8)return"legacy";if(t==="sandbox"){const o=e.sandboxSite;return o==="ready"?"protocol-sandbox":o==="error"?"retrying-sandbox":"pending"}const n=e.githubSite;return n==="ready"?"protocol-github":n==="not-owned"?"site-not-owned-github":n==="error"?"unavailable-github":"pending"}function Uo(e){return{github:e.v8&&e.mode==="github",sandbox:e.v8&&e.mode==="sandbox"&&e.workingTreeReady}}function Ot(e){return e.isError||e.errorUpdateCount>0}function Qo(e,t,n){if(!t||n.size===0)return e;const o={...e};for(const s of n)Object.hasOwn(t,s)?o[s]=t[s]:delete o[s];return o}function Co(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 nn="__noSchema";function on(){return{manifest:{blocks:{}},schema:{definitions:{},root:{}},[nn]:!0}}function Xr(e){return!!e&&e[nn]===!0}function Ze(e){if(!e.ok)return e.error.code===w.NotFound;const t=e.result;return t.notModified===!1&&t.schema===null}function Bo(e,t){return(typeof t.name=="string"?t.name.trim():"")||e}const Fo=(e,t)=>e.label.localeCompare(t.label)||e.key.localeCompare(t.key);function Zr(e){const t=new Map;for(const[n,o]of Object.entries(e)){const s=o&&typeof o=="object"&&!Array.isArray(o)?o:{},r=typeof s.__resolveType=="string"?s.__resolveType:null,i=t.get(r)??[];i.push({key:n,label:Bo(n,s)}),t.set(r,i)}return[...t.entries()].map(([n,o])=>({resolveType:n,blocks:o.sort(Fo)})).sort((n,o)=>n.resolveType===null?1:o.resolveType===null?-1:Et(n.resolveType).localeCompare(Et(o.resolveType))||n.resolveType.localeCompare(o.resolveType))}function Et(e){return(e.split("/").filter(Boolean).at(-1)??e).replace(/\.(tsx?|jsx?)$/,"")||e}function Dt(e,t,n){if(t.length===0)return n;const[o,...s]=t;if(Array.isArray(e)&&typeof o=="number"){const r=e.slice();return r[o]=Dt(e[o],s,n),r}if(e&&typeof e=="object"&&typeof o=="string"){const r=e,i={};for(const a of Object.keys(r))i[a]=a===o?Dt(r[a],s,n):r[a];return i}return e}function qr(e){if(e.trim()==="")return null;const t=Number(e);return Number.isFinite(t)?t:null}class It extends Error{}const qe="site-not-owned";async function Vo(e){return e.status!==409?!1:(await e.clone().json().catch(()=>null))?.code==="site_not_owned"}async function Ho(e,t=n=>fetch(n)){const n=Ve({endpoint:e,fetch:async o=>{const s=await t(new Request(o,{signal:ye(o.signal)}));if(await Vo(s))throw new It;return s}});try{return await et(n)}catch(o){if(o instanceof It)return qe;throw o}}async function Jo(e,t,n){await t();const o=await Ho(e,n);return o===qe?o:{...o,hosted:ko(e,n)}}const Ke=5e3;function Wo(e){if(!e.site)throw new Error("this project names no site");return Xn(e.site,e.branch)}function Go(e){return new URL(Se(e,"rpc"),window.location.origin).href}async function et(e){const[t,n]=await e.batch([{method:"describe"},{method:"schema.get"}]);if(!t?.ok)throw t?.error??new Error("no describe");if(t.result?.protocol!==te)throw new Ge;const s=Jt(t.result);if(!n)throw new Error("no schema.get");if(Ze(n))return{client:e,describe:s,hasSchema:!1};if(n.ok)return{client:e,describe:s,hasSchema:!0};throw n.error}function Yo(e,t=n=>fetch(n)){return et(Ve({endpoint:e,fetch:n=>t(new Request(n,{signal:ye(n.signal)}))}))}function re(e,t){const n=N.c(40),{org:o}=zn(),{connection:s}=Ao(e),{runtime:r}=Ft(e),i=L.useContext(Kt),a=Fe(e),c=Ut(Be(e)?.metadata),l=tn({hasServeConnection:!!s,runtime:r}),u=en(l,s?.endpoint??""),d=to()?.taskId??null,f=no(oo().lifecycle.phase),h=G(),v=Uo({mode:l,v8:a,workingTreeReady:f}),b=v.github&&!!o.slug&&!!e&&!!t,p=C({queryKey:g.contentBackend(o.slug,e??"",t??"","github"),queryFn:()=>Jo(Wo({orgSlug:o.slug,site:c,branch:t}),()=>Qt(c,t)),enabled:b,staleTime:Number.POSITIVE_INFINITY,..._t}),R=v.sandbox&&!!o.slug&&!!e&&!!t;let k;n[0]!==t||n[1]!==o.slug||n[2]!==d||n[3]!==e?(k=()=>Yo(Go({orgSlug:o.slug,virtualMcpId:e,branch:t,threadId:d})),n[0]=t,n[1]=o.slug,n[2]=d,n[3]=e,n[4]=k):k=n[4];const $=C({queryKey:g.contentBackend(o.slug,e??"",t??"","sandbox",d??""),queryFn:k,enabled:R,staleTime:Number.POSITIVE_INFINITY,..._t}),I=!!s;let _;n[5]!==s?.endpoint||n[6]!==o.slug||n[7]!==e?(_=g.contentBackend(o.slug,e??"","local",s?.endpoint??""),n[5]=s?.endpoint,n[6]=o.slug,n[7]=e,n[8]=_):_=n[8];let T;n[9]!==s?(T=()=>ts(s.endpoint),n[9]=s,n[10]=T):T=n[10];let S;n[11]!==I||n[12]!==_||n[13]!==T?(S={queryKey:_,queryFn:T,enabled:I,staleTime:Number.POSITIVE_INFINITY,retry:Zo,retryDelay:Xo,refetchInterval:zo},n[11]=I,n[12]=_,n[13]=T,n[14]=S):S=n[14];const O=C(S);let D;n[15]!==s?.endpoint||n[16]!==o.slug||n[17]!==e?(D=g.contentBackend(o.slug,e??"","local",s?.endpoint??""),n[15]=s?.endpoint,n[16]=o.slug,n[17]=e,n[18]=D):D=n[18];const x=D;let A;n[19]!==s?.endpoint||n[20]!==o.slug||n[21]!==e?(A=g.contentBackend(o.slug,e??"","local-describe",s?.endpoint??""),n[19]=s?.endpoint,n[20]=o.slug,n[21]=e,n[22]=A):A=n[22];let m;n[23]!==O.data||n[24]!==x||n[25]!==h?(m=async()=>{try{return await O.data.client.describe()}catch(q){const Cn=q;throw h.invalidateQueries({queryKey:x,exact:!0},{cancelRefetch:!1}),Cn}},n[23]=O.data,n[24]=x,n[25]=h,n[26]=m):m=n[26];const E=!!O.data&&!i;let j;n[27]!==A||n[28]!==m||n[29]!==E?(j={queryKey:A,queryFn:m,enabled:E,refetchInterval:Ke,retry:!1},n[27]=A,n[28]=m,n[29]=E,n[30]=j):j=n[30];const M=C(j).data??O.data?.describe,Q=Lo({hasProject:!!e,hasServeConnection:!!s,runtime:r,v8:a,githubSite:p.data===qe?"not-owned":p.data?"ready":Ot(p)?"error":"loading",sandboxSite:qo({data:$.data,isError:Ot($),workingTreeReady:f})});if(Q==="pending")return{kind:"pending",...u};if(Q==="retrying-sandbox")return{kind:"pending",retrying:"sandbox",...u};if(Q==="legacy")return{kind:"legacy"};if(Q==="protocol-github")return{...Ne(u,p.data),site:c};if(Q==="site-not-owned-github")return{kind:"unavailable",...u,siteNotOwned:!0};if(Q==="protocol-sandbox")return Ne(u,$.data);if(Q==="unavailable-github"){let q;return n[31]!==u?(q={kind:"unavailable",...u},n[31]=u,n[32]=q):q=n[32],q}const P=O.error??O.failureReason,H=s?.endpoint??"";let J;return n[33]!==M||n[34]!==O.data||n[35]!==O.failureCount||n[36]!==O.isError||n[37]!==H||n[38]!==P?(J=es({probed:O.data,isError:O.isError,failureCount:O.failureCount,failure:P,describe:M,endpoint:H}),n[33]=M,n[34]=O.data,n[35]=O.failureCount,n[36]=O.isError,n[37]=H,n[38]=P,n[39]=J):J=n[39],J}function zo(e){return e.state.status==="error"||e.state.data?.hasSchema===!1?Ke:!1}function Xo(e){return vo(e+1)}function Zo(e,t){return!(t instanceof y)&&!(t instanceof Ge)}function qo(e){return e.data!==void 0?"ready":e.workingTreeReady?e.isError?"error":"loading":"unavailable"}const Ko=3;function es(e){const t=en("local",e.endpoint),n=e.probed?Ne(t,{...e.probed,describe:e.describe??e.probed.describe}):null;return e.isError||e.failureCount>0?n?.kind==="protocol"&&!e.isError&&e.failureCount<Ko?n:{kind:"unavailable",...t,problem:po(e.failure)}:n??{kind:"pending",...t}}const _t={retry:2,refetchInterval:e=>e.state.status==="error"?Ke:!1};function Ne(e,t){return{kind:"protocol",...e,client:t.client,describe:t.describe,hasSchema:t.hasSchema,...t.hosted?{hosted:t.hosted}:{}}}function ts(e,t){return et(Ve({endpoint:e,fetch:n=>fetch(n,{signal:ye(t?AbortSignal.any([t,n.signal]):n.signal)})}))}function je(e){const t=`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`;return e.protocolSuffix?`${t}${e.protocolSuffix}`:e.localPreviewUrl?`${t}:local:${e.localPreviewUrl}`:t}function ns(e,t){return je({...e,protocolSuffix:t.cacheKeySuffix})}function os(e,t,n){return e?t==="pending"?{ready:!1,failed:!1}:t==="unavailable"?{ready:!1,failed:!0}:n:{ready:!0,failed:!1}}function ss(e,t){return JSON.stringify([e?.orgSlug,e?.virtualMcpId,e?.branch,Mo(t)])}function rs(e,t,n){const o=N.c(21),s=G(),r=re(e?.virtualMcpId,e?.branch),i=e&&r.kind==="protocol"&&r.hosted?r:null;let a;o[0]!==i||o[1]!==e?(a=i&&e?ns(e,i):"",o[0]=i,o[1]=e,o[2]=a):a=o[2];const c=Po(i?.hosted,a,t,n),l=e!==null;let u;o[3]!==r.kind||o[4]!==c||o[5]!==l?(u=os(l,r.kind,c),o[3]=r.kind,o[4]=c,o[5]=l,o[6]=u):u=o[6];const d=u,f=r.kind!=="legacy";let h;o[7]!==r||o[8]!==e?(h=ss(e,r),o[7]=r,o[8]=e,o[9]=h):h=o[9];let v;o[10]!==r.kind||o[11]!==r.source||o[12]!==c||o[13]!==s||o[14]!==e?(v=()=>{if(c.retry(),!e||r.kind!=="unavailable")return;const p=r.source;s.resetQueries({queryKey:g.contentBackend(e.orgSlug,e.virtualMcpId,...p==="local"?["local"]:[e.branch,p])})},o[10]=r.kind,o[11]=r.source,o[12]=c,o[13]=s,o[14]=e,o[15]=v):v=o[15];let b;return o[16]!==d||o[17]!==f||o[18]!==h||o[19]!==v?(b={...d,v8:f,scopeKey:h,retry:v},o[16]=d,o[17]=f,o[18]=h,o[19]=v,o[20]=b):b=o[20],b}function sn(e){const t=N.c(12);let n;t[0]!==e?(n=Te.localPreviewUrl(e??""),t[0]=e,t[1]=n):n=t[1];const o=n,[s,r]=Zn(o,null),i=Fe(e);let a;t[2]!==s||t[3]!==e?(a=e?ft(s):null,t[2]=s,t[3]=e,t[4]=a):a=t[4];const l=i?null:a;let u,d;t[5]!==r?(u=h=>r(ft(h)),d=()=>r(null),t[5]=r,t[6]=u,t[7]=d):(u=t[6],d=t[7]);let f;return t[8]!==l||t[9]!==u||t[10]!==d?(f={url:l,setUrl:u,clear:d},t[8]=l,t[9]=u,t[10]=d,t[11]=f):f=t[11],f}const Tt=6e4,is=2147483647;function as(e,t){if(e===null||e.trim()==="")return Tt;const n=e.trim(),o=/^\d+(?:\.\d+)?$/.test(n)?Number(n)*1e3:/^[A-Za-z]{3}, /.test(n)?Math.max(0,Date.parse(n)-t):Number.NaN;return Number.isFinite(o)&&o>=0&&o<=is?o:Tt}class rn extends Error{constructor(t,n,o,s=Date.now()){super(t),this.status=n,this.name="ContentResponseError",this.retryAt=n===429?s+as(o,s):null}status;retryAt}function cs(e,t,n=Date.now()){const o=Bt(5e3,1e3,e,2,0);return t instanceof rn&&t.retryAt!==null?Math.max(o,t.retryAt-n):o}async function tt(e,t){const n=await e.json().catch(()=>null),o=n!==null&&typeof n=="object"&&"error"in n&&typeof n.error=="string"?n.error:`${t} failed (${e.status})`;throw new rn(o,e.status,e.headers.get("retry-after"))}function ls(e,t){const n=(e??"").trim().replace(/^[/\\]+|[/\\]+$/g,"");return n?`${n}/${t}`:t}function Rt(e){let t;try{t=JSON.parse(e)}catch{return null}return typeof t!="object"||t===null||Array.isArray(t)?null:t}function ke(e,t,n){return["decofile-write",e,t,n]}function us(e,t,n){return{id:ke(e,t,n).join(":")}}class nt extends Error{constructor(t,n,o=[],s=!1){super(n),this.blocks=t,this.fields=o,this.carriedStored=s,this.name="BlockConflictError"}blocks;fields;carriedStored}function ot(e){return`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`}function st(e){return`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}`}async function fs(e,t){return tt(e,t)}function ds(e,t,n){e.setQueryData(g.decofileDraft(ot(t)),n)}function hs(e,t){return e.getQueryData(g.decofileDraft(ot(t)))??null}async function gs(e,t){return(await fetch(st(e),{cache:"no-store",headers:{"if-none-match":`"${t}"`}}).catch(()=>null))?.status===200}function Kr(e){const t=N.c(4);let n;t[0]!==e?(n=g.decofileDraft(e?ot(e):""),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:vs,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:s}=C(o);return s??null}async function vs(){throw new Error("decofileDraft is populated by reads/writes, not fetched")}async function bs(e,t){const n=await fetch(st(t),{cache:"no-store"});if(!n.ok)return tt(n,"Read decofile");const o=await n.json();return o.token&&ds(e,t,{version:o.version,token:o.token,apiHost:o.apiHost??window.location.host}),o.decofile}async function ei(e,t){const n=await fetch(st(e),{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(n.status===409){const s=await n.json().catch(()=>({}));throw s.code==="block-conflict"?new nt(s.blocks??[],s.error??"Block changed"):new Error(s.error??`Save failed (${n.status})`)}if(!n.ok)return fs(n,"Save");const o=await n.json();return{...o,apiHost:o.apiHost??window.location.host}}const an=3e3,ps=15e3,ms=2*6e4,cn={now:()=>Date.now(),setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),hidden:()=>typeof document<"u"&&document.visibilityState==="hidden"};function ws(e){return e<ms?an:ps}function ys(e,t=cn){const n=t.now();let o=!1,s=!1,r=null;const i=()=>{o||(r=t.setTimeout(a,ws(t.now()-n)))},a=()=>{if(r=null,o)return;const{read:c,skip:l}=e();if(s||t.hidden()||l?.()){i();return}s=!0;let u;try{u=c()}catch{u=void 0}Promise.resolve(u).catch(()=>{}).finally(()=>{s=!1}),i()};return i(),()=>{o=!0,r!==null&&t.clearTimeout(r)}}const xt=()=>0;function Ss(e,t,n=cn){const o=L.useRef(t);o.current=t;const[s]=L.useState(()=>({polling:()=>ys(()=>o.current,n),idle:()=>()=>{}}));L.useSyncExternalStore(e?s.polling:s.idle,xt,xt)}function ln(e,t){return Se(e,t)}function ks(e,t){return Se(e,"preview-fetch",{path:t})}function ti(e){return ln(e,"preview-invoke")}function ni(e){return ln(e,"catalog-invoke")}function un(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 Os(){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&&un(n))return n}return null}function Es(e,t){const n=e.previewUrl??e.getFallbackPreviewUrl?.()??Os();return n&&un(n)?new URL(t,n).toString():ks(e,t)}function Ds(e){return Es(e,"/.decofile")}function Is(e){return e===400?"absent":e===404?"unavailable":e>=200&&e<300?"ok":"error"}function Pt(e){return e.liveOk||e.committedAbsent?404:e.liveStatus??502}async function _s(e,t){const n=Se(e,"read"),o=await fetch(n,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:t,full:!0})}),s=Is(o.status);if(s==="absent")return{kind:"absent"};if(s==="unavailable")return{kind:"unavailable"};if(s==="error"){const i=new Error(`Failed to read ${t}: ${o.status}`);throw i.status=o.status,i}const r=await o.json();return typeof r.content!="string"?{kind:"unavailable"}:{kind:"data",data:so(r.content)}}async function Ts(e,t){const n=await _s(e,t);if(n.kind!=="data")return n;try{return{kind:"data",data:JSON.parse(n.data)}}catch{return{kind:"unavailable"}}}async function oi(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)return tt(n,"Read committed meta");try{return{kind:"data",data:await n.json()}}catch{return{kind:"unavailable"}}}function Rs(e){return Be(e)?.metadata?.runtime?.path??null}function $e(e,t,n,o){const s=B(e),r=Object.keys(n?.changes??{}).find(a=>B(a)===s);if(r!==void 0&&n)return n.changes[r].baseVersion;const i=Object.keys(t?.draft??{}).some(a=>B(a)===s);if(t&&!i){const a=Object.keys(t.entries).find(c=>B(c)===s);return a===void 0?null:t.entries[a].version}return o?.[e]??null}class fn extends Error{constructor(t){super(t instanceof Error?t.message:String(t),{cause:t}),this.name="ServeLostError"}}function si(e){return e instanceof y&&e.code===w.Conflict}function dn(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 rt extends Error{constructor(){super("The draft's changes couldn't be read"),this.name="HostedDraftUnreadError"}}class it extends Error{constructor(){super("The blocks kept changing while the change was saved"),this.name="HostedKeptChangingError"}}function ri(e,t){return(t instanceof rt||t instanceof it)&&(t.message=hn(e,t,"github")),t}function hn(e,t,n){if(t instanceof rt)return e("siteEditor.save.draftUnread");if(t instanceof it)return e("siteEditor.save.keptChanging");if(t instanceof nt)return t.message;if(n==="local")return Ps(e,t);if(t instanceof y)switch(t.code){case w.Conflict:return e("siteEditor.save.conflict");case w.ReadOnly:return e("siteEditor.save.readOnly");case w.InvalidBlock:case w.InvalidParams:return e("siteEditor.save.invalid");case w.LimitExceeded:return e("siteEditor.save.tooLarge")}return e("siteEditor.save.failed")}function xs(e,t){if(t==="local"||e instanceof nt||e instanceof rt||e instanceof it)return null;if(e instanceof y){const n=e.code===w.InvalidBlock||e.code===w.InvalidParams?dn(e):e.message;return n?`${e.code}: ${n}`:null}return e.message||null}function Ps(e,t){if(t instanceof fn)return e("decoServe.save.serverGone");if(t instanceof y)switch(t.code){case w.Conflict:return e("decoServe.save.conflict");case w.ReadOnly:return e("decoServe.save.readOnly");case w.InvalidBlock:case w.InvalidParams:return e("decoServe.save.invalid",{detail:dn(t)});case w.LimitExceeded:return e("decoServe.save.tooLarge")}return e("sectionsEditor.sectionsEditor.saveFailed",{error:t.message})}function Ns(e,t,n){return e===null?0:Math.max(0,n-Math.max(0,t-e))}function js(e,t){const[n,o]=L.useState(e),s=L.useRef(null);return e&&!n&&o(!0),L.useEffect(()=>{if(e){s.current??=Date.now();return}if(!n)return;const r=()=>{s.current=null,o(!1)},i=Ns(s.current,Date.now(),t);if(i===0){r();return}const a=setTimeout(r,i);return()=>clearTimeout(a)},[e,n,t]),n}const $s="decocms:content-writes",Ae=new Set;let z;function gn(){if(z!==void 0)return z;z=null;try{typeof BroadcastChannel=="function"&&(z=new BroadcastChannel($s),z.addEventListener("message",e=>{const t=e.data?.cacheKey;if(typeof t=="string")for(const n of[...Ae])n(t)}))}catch{z=null}return z}function As(e){try{gn()?.postMessage({cacheKey:e})}catch{}}function Ms(e){return gn(),Ae.add(e),()=>{Ae.delete(e)}}const vn="__at=",bn="__test=",Ls=/^[0-9a-f]{12}-[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;function Us(e){return e.at!==void 0||Object.keys(e.tests??{}).length>0}function ee(e){return typeof e=="string"&&Ls.test(e)}function Nt(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)}function Qs(e){const t=e.tests??{};return[...e.at!==void 0?[vn+Nt(e.at)]:[],...Object.keys(t).map(n=>bn+Nt(`${n}=${t[n]?"on":"off"}`))]}function jt(e,t){const o=[...e.split("&").filter(s=>s&&!s.startsWith(vn)&&!s.startsWith(bn)),...t];return o.length>0?`?${o.join("&")}`:""}function ve(e,t){const n=Qs(t),o=e.indexOf("?"),s=o===-1?e:e.slice(0,o);if(ee(s))return s+jt(o===-1?"":e.slice(o+1),n);const r=e.lastIndexOf("@");if(r<=0)return e;const i=e.slice(0,r),a=i.indexOf("?"),c=a===-1?i:i.slice(0,a),l=a===-1?"":i.slice(a+1);return`${c}${jt(l,n)}${e.slice(r)}`}function ii(e,t,n){if(!Us(t))return e;try{const o=new URL(e),s=o.searchParams.get("__draft");return s&&s!=="off"?(o.searchParams.set("__draft",ve(s,t)),o.toString()):ee(n)?(o.searchParams.set("__draft",ve(n,t)),o.toString()):e}catch{return e}}function ai(e,t,n="/"){if(!e||!ee(t))return null;try{const o=new URL(n,e);return o.searchParams.set("__draft",t),o.toString()}catch{return null}}function pn(e){return btoa(encodeURIComponent(e))}function ci(e,t,n){const o=Cs(e,t,n);return o.searchParams.set("__cb",crypto.randomUUID()),o.toString()}function Cs(e,t,n){const o=new URL(e).origin,s=new URL(`/live/previews/${encodeURIComponent(t)}`,o);return s.searchParams.set("path","/"),s.searchParams.set("pathTemplate","/"),s.searchParams.set("props",pn(JSON.stringify({path:"/",sections:[{__resolveType:n}]}))),s}const Bs="__draft";function li(e){return`${`${e.apiHost}/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}?token=${e.token}`}@${e.version}`}const Fs="off";function Vs(e,t){if(!t)return e;const n=new URL(e);return n.searchParams.set(Bs,t),n.toString()}function ui(e){const t=e.pageBlock.__resolveType;if(typeof t!="string"||!t)return null;const n=new URL(e.previewBaseUrl).origin,o=new URL(`/live/previews/${encodeURIComponent(t)}`,n);o.searchParams.set("__decoFBT","0"),o.searchParams.set("__d",""),o.searchParams.set("path",e.path),o.searchParams.set("pathTemplate",e.pathTemplate);const{__resolveType:s,...r}=e.pageBlock,i=JSON.stringify({__props:r,__decofile:e.decofile});return{src:o.toString(),body:i}}function fi(e,t,n,o){const s=new URL(e).origin,r=new URL(`/live/previews/${encodeURIComponent(t)}`,s);r.searchParams.set("__d","");const i=[{__resolveType:"preview",block:n}];return o&&i.push(o),r.searchParams.set("props",pn(JSON.stringify({sections:i}))),r.toString()}function di(e){return e.fastPreviewActive&&e.previewServerUrl?e.previewServerUrl:e.sandboxUrl??null}const $t="__variant=";function mn(e,t,n){return`${e}@${t}=${n}`}function hi(e,t){return!e||!t.multivariate||t.variants.length<=1?[]:t.index<0||t.index>=t.variants.length?[]:[mn(e,"sections",t.index)]}function gi(e){const t=Array.isArray(e.mvObj.variants)?e.mvObj.variants:[];if(!e.pageKey||e.sectionIndex<0)return[];if(e.selectedVariantIndex<0||e.selectedVariantIndex>=t.length)return[];const o=`${e.page.multivariate?`sections.variants.${e.page.index}.value${e.page.lazyValues?".value":""}`:"sections"}.${e.sectionIndex}${e.sectionLazy?".section":""}`;return[mn(e.pageKey,o,e.selectedVariantIndex)]}function vi(e,t){return[...t,...e]}function Hs(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)}function at(e,t){const n=e.lastIndexOf("@");if(n<=0)return e;const o=e.slice(0,n),s=o.indexOf("?"),r=s===-1?o:o.slice(0,s),a=[...s===-1?[]:o.slice(s+1).split("&").filter(l=>l&&!l.startsWith($t)),...t.map(l=>$t+Hs(l))],c=a.length>0?`?${a.join("&")}`:"";return`${r}${c}${e.slice(n)}`}function bi(e,t,n=!1){if(t.length===0&&!n)return null;try{const o=new URL(e),s=o.hostname==="[::1]"?`localhost${o.port?`:${o.port}`:""}`:o.host;return at(`${s}${o.pathname}@local`,t)}catch{return null}}function pi(e,t){if(t.length===0)return e;try{const n=new URL(e),o=n.searchParams.get("__draft");return!o||o==="off"?e:(n.searchParams.set("__draft",at(o,t)),n.toString())}catch{return e}}function Js(e){const{pointer:t}=e;if(!t||t===Fs)return null;const n=t.indexOf("?");return ee(n===-1?t:t.slice(0,n))||t.lastIndexOf("@")<=0?null:ee(e.heldRevision)&&e.forcedVariants.length===0?ve(e.heldRevision,e.previewOptions):ve(at(t,e.forcedVariants),e.previewOptions)}function Ws(e,t){if(!e||!t)return null;try{return Vs(e,t)}catch{return null}}function mi(e,t,n){if(!e||!n)return null;try{return Ws(new URL(t,e).toString(),n)}catch{return null}}const be={forcedVariants:[],previewOptions:{}},ce=new Map,le=new Map,Me=new Map;function wn(e){for(const t of Me.get(e)??[])t()}function yn(e,t){const n=ee(t)?t:null;(le.get(e)??null)!==n&&(n?le.set(e,n):le.delete(e),wn(e))}function Gs(e){return le.get(e)??null}function Ys(e,t){return JSON.stringify(e)===JSON.stringify(t)}function wi(e,t){const n=ce.get(e)??be,o=t??be;Ys(n,o)||(t?ce.set(e,o):ce.delete(e),wn(e))}function zs(e){return ce.get(e)??be}function Sn(e,t){let n=Me.get(e);return n||(n=new Set,Me.set(e,n)),n.add(t),()=>{n.delete(t)}}function Xs(e){const t=N.c(3);let n,o;return t[0]!==e?(n=s=>Sn(e,s),o=()=>zs(e),t[0]=e,t[1]=n,t[2]=o):(n=t[1],o=t[2]),L.useSyncExternalStore(n,o,Zs)}function Zs(){return be}function qs(e){const t=N.c(3);let n,o;return t[0]!==e?(n=s=>e?Sn(e,s):er,o=()=>e?Gs(e):null,t[0]=e,t[1]=n,t[2]=o):(n=t[1],o=t[2]),L.useSyncExternalStore(n,o,Ks)}function Ks(){return null}function er(){}function yi(e,t){const n=N.c(4),o=Xs(e),s=qs(e);let r;return n[0]!==o||n[1]!==s||n[2]!==t?(r=Js({pointer:t,heldRevision:s,...o}),n[0]=o,n[1]=s,n[2]=t,n[3]=r):r=n[3],r}const kn={phase:"idle",inFlight:0,reload:{seq:0,navigates:!1},epoch:0},tr=15e3,pe=new Map;function W(e,t){return`${e}/${t}`}function V(e){let t=pe.get(e);return t||(t={state:kn,listeners:new Set,previews:0,timer:null,discardListeners:new Set},pe.set(e,t)),t}function F(e,t){const n=V(e);n.state={...n.state,...t};for(const o of n.listeners)o()}function Oe(e){e.timer&&clearTimeout(e.timer),e.timer=null}function me(e){return pe.get(e)?.state??kn}function nr(e,t){const n=V(e);return n.listeners.add(t),()=>{n.listeners.delete(t)}}function Si(e){const t=V(e);return t.previews++,()=>{t.previews--,t.previews===0&&t.state.phase==="reloading"&&(Oe(t),F(e,{phase:"idle"}))}}function ki(e){const t=pe.get(e);!t||t.state.phase!=="reloading"||(Oe(t),F(e,{phase:"idle"}))}function On(e){const t=V(e);Oe(t),F(e,{phase:"saving",inFlight:t.state.inFlight+1})}function ue(e,t){const n=V(e),o=Math.max(0,n.state.inFlight-1);if(o>0){F(e,{inFlight:o});return}if(!t.ok||n.previews===0){F(e,{phase:"idle",inFlight:o});return}En(e,t.navigates,o)}function En(e,t,n=0){const o=V(e);Oe(o),o.timer=setTimeout(()=>{o.timer=null,o.state.phase==="reloading"&&F(e,{phase:"idle"})},tr),F(e,{phase:"reloading",inFlight:n,reload:{seq:o.state.reload.seq+1,navigates:t}})}function or(e){return e?.kind==="protocol"&&e.source==="github"}async function fe(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:s,branch:r,backend:i,cacheKey:a}=e,c=t.kind==="publish"||t.kind==="reapply"?n.invalidateQueries({queryKey:g.hostedReleases(o,s)}):null;if(i?.kind!=="protocol"){const v=a&&t.reread?n.invalidateQueries({queryKey:g.decofile(a)}):null;if(await Promise.all([c,v]),v&&t.kind!=="edit"){const b=W(o,s);F(b,{epoch:me(b).epoch+1})}return{navigates:!1}}const l=r?g.protocolDraftRead(o,s,r):null,u=l?JSON.stringify(n.getQueryData(l)??null):null,d=c?[c]:[];if(a&&t.reread&&d.push(n.invalidateQueries({queryKey:g.decofile(a)})),a&&!t.adopted&&d.push(n.invalidateQueries({queryKey:g.contentChanges(a)})),r&&i.source==="sandbox"&&d.push(n.invalidateQueries({queryKey:ro(o,s,r)})),or(i)&&l&&!t.adopted&&d.push(n.invalidateQueries({queryKey:l})),await Promise.all(d),t.kind!=="edit"){const v=W(o,s);F(v,{epoch:me(v).epoch+1})}const f=l?JSON.stringify(n.getQueryData(l)??null):null,h=u!==f;return h&&await new Promise(v=>Ct.schedule(v)),{navigates:h}}async function sr(e,t){return On(W(e.orgSlug,e.virtualMcpId)),Dn(e,t)}function At(e){return e.branch?JSON.stringify(e.queryClient.getQueryData(g.protocolDraftRead(e.orgSlug,e.virtualMcpId,e.branch))??null):null}async function Dn(e,t){const n=W(e.orgSlug,e.virtualMcpId),o=t.adopted?At(e):null;let s;try{s=await t.write()}catch(i){throw ue(n,{ok:!1,navigates:!1}),t.refreshOnError&&fe(e,{kind:t.kind,reread:!0}).catch(()=>{}),i}if(e.backend?.kind==="protocol"&&e.cacheKey&&As(e.cacheKey),yn(n,t.shownRevision?.(s)??null),t.adopted){const i=At(e)!==o;return i&&await new Promise(a=>Ct.schedule(a)),ue(n,{ok:!0,navigates:i}),t.reread&&fe(e,t).catch(()=>{}),s}let r=!1;try{({navigates:r}=await fe(e,t))}catch{}finally{ue(n,{ok:!0,navigates:r})}return s}function Oi(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:s,branch:r}=e,i=W(o,s),a=new Set(t.blockKeys);for(const u of[...V(i).discardListeners])u(a);On(i);let c=!1;const l=()=>(c=!0,Dn(e,{kind:"discard",reread:!0,write:t.write}));return r?n.getMutationCache().build(n,{mutationKey:ke(o,s,r),scope:us(o,s,r),mutationFn:l}).execute(void 0).catch(u=>{throw c||ue(i,{ok:!1,navigates:!1}),u}):l()}function Ei(e,t,n){const o=N.c(8);let s;o[0]!==e||o[1]!==t?(s=W(e,t),o[0]=e,o[1]=t,o[2]=s):s=o[2];const r=s;let i;o[3]!==n||o[4]!==r?(i=()=>{const c=V(r).discardListeners;return c.add(n),()=>{c.delete(n)}},o[3]=n,o[4]=r,o[5]=i):i=o[5];let a;o[6]!==r?(a=[r],o[6]=r,o[7]=a):a=o[7],L.useEffect(i,a)}function In(e){const t=W(e.orgSlug,e.virtualMcpId);me(t).inFlight>0||(yn(t,null),fe(e,{kind:"external"}).then(({navigates:n})=>{const o=V(t);o.previews>0&&o.state.inFlight===0&&En(t,n)}).catch(()=>{}))}function rr(e,t){const n=N.c(7);let o;n[0]!==e||n[1]!==t?(o=W(e,t),n[0]=e,n[1]=t,n[2]=o):o=n[2];const s=o;let r;n[3]!==s?(r=l=>nr(s,l),n[3]=s,n[4]=r):r=n[4];const i=r;let a;n[5]!==s?(a=()=>me(s),n[5]=s,n[6]=a):a=n[6];const c=a;return L.useSyncExternalStore(i,c,c)}const ir=500;function Di(e,t){const{phase:n}=rr(e,t);return js(n!=="idle",ir)}function ar(e){const t=new Error(`${e} unavailable (content server unreachable)`);return t.status=502,t}function _n(e,t){return g.liveMeta(e.orgSlug,e.virtualMcpId,e.branch,`protocol${t.cacheKeySuffix}`,"")}function Ii(e,t,n,o){if(o?.source==="github"){const i=e.getQueryData(g.contentIndex(t));return i?Do(i,n):cr(e,t,n)}const s=e.getQueryData(g.contentVersions(t));if(!s)return;if(Object.hasOwn(s,n))return s[n];const r=e.getQueryData(g.decofile(t));return r&&Object.hasOwn(r,n)?void 0:null}function Tn(e,t){if(Object.hasOwn(e.changes,t))return e.changes[t];const n=B(t),o=Object.keys(e.changes).find(s=>B(s)===n);return o===void 0?void 0:e.changes[o]}function cr(e,t,n){const o=e.getQueryData(g.contentChanges(t));if(o)return Rn(o,Ee(e,t),n)}function Rn(e,t,n){const o=Tn(e,n);return o?.kind==="delete"?o.version??Z:o?o.version:t.has(B(n))?Z:null}function _i(e,t,n){const o=e.getQueryData(g.contentChanges(t));if(!o)return!1;const s=Tn(o,n);return s?s.kind==="set"&&s.baseVersion===null:Ee(e,t).has(B(n))}function Ti(e,t){const n=e.getQueryData(g.decofile(t)),o=e.getQueryData(g.contentChanges(t));if(!n||!o)return null;const s=Ee(e,t);return{blocks:n,versionOf:r=>Rn(o,s,r)}}function Ee(e,t){return new Set(e.getQueryData(g.contentDraftTombstones(t)))}function we(e,t,n,o){const s=B(n),r=Ee(e,t);r.has(s)!==o&&(o?r.add(s):r.delete(s),Y(e),e.setQueryData(g.contentDraftTombstones(t),[...r]))}function xn(e,t,n,o){const s=o.revision,r=e.getQueryData(g.contentVersions(n)),i=Object.entries(o.versions??{}).map(([f,h])=>[f,h===Z?null:h]),a=e.getQueryData(g.contentChanges(n)),c=e.getQueryData(g.contentIndex(n)),l=new Set(i.flatMap(([f])=>$e(f,c,a,r)===null?[f]:[])),u=new Set(i.flatMap(([f,h])=>h===null?[]:[B(f)]));e.setQueryData(g.contentChanges(n),f=>{if(!f)return f;const h={...f.changes};for(const[v,b]of i){const p=$e(v,c,f,r);b!==null?h[v]={kind:"set",version:b,baseVersion:p}:p!==null?h[v]={kind:"delete",version:null,baseVersion:p}:delete h[v]}return{...f,changes:h,edited:!0}});for(const[f,h]of i)h!==null?we(e,n,f,!1):!u.has(B(f))&&l.has(f)&&we(e,n,f,!0);const d=o.revision;return d&&d!=="none"&&e.setQueryData(g.protocolDraftRead(t.orgSlug,t.virtualMcpId,t.branch),f=>f&&{...f,version:d}),s}function De(e,t,n){Y(e),e.setQueryData(g.contentVersions(t),o=>{const s={...o};for(const[r,i]of Object.entries(n))i===null?delete s[r]:s[r]=i;return s})}function Pn(e,t){const n=e.getMutationCache().findAll({mutationKey:ke(t.orgSlug,t.virtualMcpId,t.branch),status:"pending"});return new Set(n.flatMap(o=>Co(o.state.variables)))}function Le(e,t){e.resetQueries({queryKey:g.contentBackend(t.orgSlug,t.virtualMcpId,"local")})}async function se(e,t,n,o){try{return await o()}catch(s){const r=!(s instanceof y);throw t.source==="local"&&r?(Le(e,n),new fn(s)):(t.source==="local"&&Je(s)&&Le(e,n),s)}}const Mt=new WeakMap;function ct(e){let t=Mt.get(e);return t||(t={inFlight:new Map,rereading:new Set},Mt.set(e,t)),t}function Nn(e,t,n,o){const{inFlight:s}=ct(e),r=s.get(o);if(r)return r;const i=lt(e,t,n,o,!0);return s.set(o,i),i.finally(()=>{s.get(o)===i&&s.delete(o)})}function lr(e,t,n){const o=N.c(8),s=G(),r=t?.orgSlug,i=t?.virtualMcpId,a=t?.branch;let c,l;o[0]!==e||o[1]!==a||o[2]!==n||o[3]!==r||o[4]!==s||o[5]!==i?(c=()=>{if(!e||!r||!i||!a)return;const u={orgSlug:r,virtualMcpId:i,branch:a},{rereading:d}=ct(s);return Ms(f=>{f===n&&(d.has(n)||(d.add(n),fr(s,e,u,n).catch(ur).finally(()=>d.delete(n))))})},l=[s,e,r,i,a,n],o[0]=e,o[1]=a,o[2]=n,o[3]=r,o[4]=s,o[5]=i,o[6]=c,o[7]=l):(c=o[6],l=o[7]),L.useEffect(c,l)}function ur(){}async function fr(e,t,n,o){const s=ct(e).inFlight.get(o);return s&&await s.catch(()=>{}),Nn(e,t,n,o)}async function lt(e,t,n,o,s){Y(e);const r=g.decofile(o),i=_n(n,t),a=g.contentRevision(o),c=g.contentVersions(o),l=e.getQueryData(r),u=e.getQueryData(c),f=e.getQueryData(i),h=e.getQueryData(a)??void 0,v=s&&l&&u?h?.revision:void 0,b=s&&f?h?.schemaVersion:void 0,p=g.contentChanges(o),R=e.getQueryData(p);if(t.source==="github"&&t.hosted)return dr(e,t,t.hosted,n,o,{conditional:s,seen:h,currentMeta:f,schemaIfNoneMatch:b,seenChanges:R});const[k,$,I]=await se(e,t,n,()=>t.client.batch([{method:"blocks.list",params:v?{ifNoneMatch:v}:{}},{method:"schema.get",params:b?{ifNoneMatch:b}:{}},{method:"changes.list",params:He(R)}])),_=e.getQueryData(a)?.revision,T=_!==void 0&&_!==h?.revision;if(I?.ok){const E=T?null:de(R,I.result);E&&e.setQueryData(p,E)}else I&&t.source==="local"&&Je(I.error)&&Le(e,n);if(!k?.ok)throw k?.error??new Error("no blocks.list");if(!$)throw new Error("no schema.get");const S=k.result,O=Ze($),D=$.ok&&!O?$.result:null;if(S.notModified&&(!l||!u)||D?.notModified&&!f)return lt(e,t,n,o,!1);const x=S.notModified?new Set:Pn(e,n),A=S.notModified?l:Qo(S.blocks,l,x),m=O?on():D?D.notModified?f:D.schema:$.error;if(e.setQueryData(a,{revision:T?_:S.notModified?h?.revision:S.revision,schemaVersion:D?D.notModified?h?.schemaVersion:D.version??void 0:void 0}),e.setQueryData(r,A),!S.notModified){const E=e.getQueryData(c),j={...S.versions};for(const U of x){const M=E?.[U];M!==void 0?j[U]=M:delete j[U]}e.setQueryData(c,j)}return m instanceof y||e.setQueryData(i,m),!T&&!S.notModified&&l&&h?.revision&&S.revision!==h.revision&&In({queryClient:e,orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,backend:t,cacheKey:o}),{blocks:A,meta:m}}async function dr(e,t,n,o,s,r){const i=g.decofile(s),a=g.contentIndex(s),c=g.contentRevision(s),l=g.contentVersions(s),u=_n(o,t),d=g.contentChanges(s),f=e.getQueryData(a),h=r.conditional&&f?r.seen?.revision:void 0,[v,b,p]=await se(e,t,o,()=>n.batch([{method:"cms.index",params:h?{ifNoneMatch:h}:{}},{method:"schema.get",params:r.schemaIfNoneMatch?{ifNoneMatch:r.schemaIfNoneMatch}:{}},{method:"changes.list",params:He(r.seenChanges)}])),R=e.getQueryData(a)??f,k=e.getQueryData(c)?.revision,$=k!==void 0&&k!==r.seen?.revision;if(p?.ok&&!$){const P=de(r.seenChanges,p.result);P&&e.setQueryData(d,P)}if(!v?.ok)throw v?.error??new Error("no cms.index");if(!b)throw new Error("no schema.get");const I=v.result,_=Ze(b),T=b.ok&&!_?b.result:null;if(I.notModified&&!f||T?.notModified&&!r.currentMeta)return lt(e,t,o,s,!1);const S=_?on():T?T.notModified?r.currentMeta:T.schema:b.error;S instanceof y||e.setQueryData(u,S);const O=T?T.notModified?r.seen?.schemaVersion:T.version??void 0:void 0,D=e.getQueryData(i)??{};if(I.notModified||$)return e.setQueryData(c,{revision:$?k:r.seen?.revision,schemaVersion:O}),e.setQueryData(i,D),{blocks:D,meta:S};const x={revision:I.revision,resolvedRef:I.resolvedRef,sequence:I.sequence,entries:I.entries,draft:I.draft};e.setQueryData(a,x);const A=!!r.seen?.revision&&x.revision!==r.seen.revision&&(!r.seen.revision.startsWith("s-")||!!f&&jn(f.draft,x.draft));A&&e.setQueryData(g.protocolDraftRead(o.orgSlug,o.virtualMcpId,o.branch),P=>P&&{...P,version:x.revision}),e.setQueryData(c,{revision:x.revision,schemaVersion:O});const m=Pn(e,o),E=e.getQueryData(l)??{},j={},U={},M=[];for(const[P,H]of Object.entries(D)){const J=x.entries[P];!J&&!m.has(P)||(j[P]=H,E[P]!==void 0&&(U[P]=E[P]),J&&!m.has(P)&&E[P]!==J.version&&M.push(P))}return e.setQueryData(i,j),e.setQueryData(l,U),M.length>0&&await ze(e,n,s,M,m),R&&A&&hr(R,x)&&In({queryClient:e,orgSlug:o.orgSlug,virtualMcpId:o.virtualMcpId,branch:o.branch,backend:t,cacheKey:s}),{blocks:e.getQueryData(i)??j,meta:S}}function hr(e,t){if(jn(e.draft,t.draft))return!0;const n=Object.keys(t.entries);return n.length!==Object.keys(e.entries).length?!0:n.some(o=>!Object.hasOwn(e.entries,o)||e.entries[o]?.version!==t.entries[o]?.version)}function jn(e,t){const n=Object.keys(t);return n.length!==Object.keys(e).length?!0:n.some(o=>!Object.hasOwn(e,o)||e[o]?.version!==t[o]?.version)}function gr(e,t){const n=[...Object.keys(t.set??{}),...t.delete??[]];return Object.fromEntries(n.filter(o=>Object.hasOwn(e,o)).map(o=>[o,e[o]]))}function _e(e){if(!(e instanceof y)||e.code!==w.Unavailable)return;const t=e.data?.landed;if(!(!t||typeof t!="object"||Array.isArray(t)))return Object.fromEntries(Object.entries(t).filter(n=>typeof n[1]=="string"))}async function vr(e,t){if(!(e instanceof y)||e.code!==w.Conflict)return;const n=e.data?.entries;if(!n||typeof n!="object")return;const o=Object.entries(n);if(o.length===0)return;const s=t.set??{},r=new Set(t.delete??[]),i={};for(const[a,c]of o){const l=c?.actual;if(typeof l!="string"||(Object.hasOwn(s,a)?await eo(s[a]):r.has(a)?Z:void 0)!==l)return;i[a]=l}return i}function br(e,t){const n=Object.fromEntries(Object.entries(e.set??{}).filter(([s])=>!Object.hasOwn(t,s))),o=(e.delete??[]).filter(s=>!Object.hasOwn(t,s));return{...Object.keys(n).length>0?{set:n}:{},...o.length>0?{delete:o}:{}}}function ie(e,t,n,o,s){Y(e),xn(e,t,n,{revision:e.getQueryData(g.contentRevision(n))?.revision??"",versions:s}),De(e,n,Object.fromEntries(Object.entries(s).map(([r,i])=>[r,i===Z?null:i]))),qt(e,n,s,o.set??{})}async function Ri(e,t,n,o,s,r){if(t.source==="github"){const a=[...Object.keys(s.set??{}),...s.delete??[]].filter(l=>!r||!Object.hasOwn(r,l));if(a.length>0)throw new Error(`A hosted save needs a precondition for every block it touches (missing: ${a.join(", ")})`);const c=qn(s.set);if(c.length>0)throw new Error(`A hosted save can't write a block that isn't loaded (${c.join(", ")})`)}return sr({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=(u,d=r)=>se(e,t,n,()=>t.client.blocksApply({set:u.set,delete:u.delete,...d?{ifMatch:gr(d,u)}:{}}));let a;try{a=await i(s)}catch(u){const d=t.source==="github"?_e(u):void 0;if(!d)throw u;const f=br(s,d);Object.keys(d).length>0&&ie(e,n,o,s,d);let h;try{h=await i(f)}catch(v){const b=_e(v);b&&Object.keys(b).length>0&&ie(e,n,o,f,b);const p=await vr(v,f);if(!p)throw v;ie(e,n,o,f,p);try{h=await i(f,{...r,...p})}catch(R){const k=_e(R);throw k&&Object.keys(k).length>0&&ie(e,n,o,f,k),R}}a={...h,versions:{...d,...h.versions}}}Y(e);const c=t.source==="github"?xn(e,n,o,a):a.revision;t.source==="github"&&qt(e,o,a.versions??{},s.set??{}),e.setQueryData(g.contentRevision(o),u=>({...u,revision:c}));const l=a.versions??{};return De(e,o,l),{revision:c,versions:l}}})}function $n(e,t){if(!(e instanceof y))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 An(e,t,n){if(!(n instanceof y))return;const o=n.data?.draft;if(!(!o||typeof o!="object"))for(const[s,r]of Object.entries(o))r===null&&we(e,t,s,!1)}function Mn(e,t,n,o){Y(e),Kn(e,n,o);const s=o.block===null,r=e.getQueryData(g.contentVersions(t)),i=e.getQueryData(g.contentChanges(t)),a=$e(n,e.getQueryData(g.contentIndex(t)),i,r);if(i){const c=B(n),l=Object.fromEntries(Object.entries(i.changes).filter(([u])=>B(u)!==c));s?a!==null&&(l[n]={kind:"delete",version:null,baseVersion:a}):l[n]={kind:"set",version:o.version,baseVersion:a},e.setQueryData(g.contentChanges(t),{...i,changes:l,edited:!0})}we(e,t,n,s&&a===null),e.setQueryData(g.decofile(t),c=>{const l={...c};return s?delete l[n]:l[n]=o.block,l}),De(e,t,{[n]:s?null:o.version}),Io(e,t,n,o)}function xi(e,t,n,o){if(t.source!=="github"||!(o instanceof y))return!1;An(e,n,o);const s=o.data?.draft;if(!s||typeof s!="object")return!1;const r=Object.keys(s),i=r.map(a=>$n(o,a));return r.length===0||i.some(a=>a===void 0)?!1:(e.cancelQueries({queryKey:g.decofile(n)}),r.forEach((a,c)=>{Mn(e,n,a,i[c])}),!0)}async function Pi(e,t,n,o,s,r){t.source==="github"&&An(e,o,r);const i=t.source==="github"?$n(r,s):void 0;if(i)return e.cancelQueries({queryKey:g.decofile(o)}),Mn(e,o,s,i),!0;await e.invalidateQueries({queryKey:g.decofile(o)});let a;try{const l=(await se(e,t,n,()=>t.client.changesGet({names:[s]}))).entries[s];if(l&&l.after===null&&l.version!==null)return!1;a={value:l?.after??null,version:l?.version??null},t.source==="github"&&e.setQueryData(g.contentChanges(o),u=>{if(!u)return u;const d={...u.changes};return l?.kind?d[s]={kind:l.kind,version:l.version,baseVersion:l.baseVersion}:delete d[s],{...u,changes:d,edited:!0}})}catch{const c=await se(e,t,n,()=>t.client.blocksList({}));if(c.notModified)return!1;a={value:c.blocks[s]??null,version:c.versions[s]??null}}return e.setQueryData(g.decofile(o),c=>{const l={...c};return a.value===null?delete l[s]:l[s]=a.value,l}),De(e,o,{[s]:a.version}),!1}function pr(e){const t=N.c(17),n=Be(e?.virtualMcpId)?.metadata;let o;t[0]!==n?(o=Ut(n),t[0]=n,t[1]=o):o=t[1];const s=o;let r;t[2]!==e?.branch||t[3]!==e?.orgSlug||t[4]!==e?.virtualMcpId?(r=g.protocolDraftRead(e?.orgSlug??"",e?.virtualMcpId??"",e?.branch??""),t[2]=e?.branch,t[3]=e?.orgSlug,t[4]=e?.virtualMcpId,t[5]=r):r=t[5];let i;t[6]!==e||t[7]!==s?(i=async()=>{const b=await Qt(s,e.branch),p=b.pointer?.lastIndexOf("@")??-1;return{draft:b.pointer&&p>0?b.pointer.slice(0,p):null,version:b.pointer&&p>0?b.pointer.slice(p+1):b.etag}},t[6]=e,t[7]=s,t[8]=i):i=t[8];const a=!!e&&!!s;let c;t[9]!==r||t[10]!==i||t[11]!==a?(c={queryKey:r,queryFn:i,enabled:a,staleTime:Number.POSITIVE_INFINITY},t[9]=r,t[10]=i,t[11]=a,t[12]=c):c=t[12];const{data:l,isPending:u,isError:d}=C(c),f=!!e&&!!s&&u&&!d;if(!e||!l?.draft||!l.version){let b;return t[13]!==f?(b={pointer:null,pending:f},t[13]=f,t[14]=b):b=t[14],b}const h=`${l.draft}@${l.version}`;let v;return t[15]!==h?(v={pointer:h,pending:!1},t[15]=h,t[16]=v):v=t[16],v}function Ni(e){return pr(e).pointer}function ji(e){const t=N.c(4);let n;t[0]!==e?(n=g.contentRevision(e),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:mr,staleTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:s}=C(o);return s?.revision}async function mr(){throw new Error("content revisions are set by reads and writes")}function ut(e,t){const n=N.c(6),{url:o}=sn(e?.virtualMcpId),s=re(e?.virtualMcpId,e?.branch);if(!e)return"";let r;return n[0]!==s.cacheKeySuffix||n[1]!==s.kind||n[2]!==o||n[3]!==t?.tunnel||n[4]!==e?(r=s.kind!=="legacy"&&s.cacheKeySuffix!==void 0?je({...e,protocolSuffix:s.cacheKeySuffix}):je({...e,localPreviewUrl:t?.tunnel===!1?null:o}),n[0]=s.cacheKeySuffix,n[1]=s.kind,n[2]=o,n[3]=t?.tunnel,n[4]=e,n[5]=r):r=n[5],r}function $i(e,t){const n=N.c(46),{url:o}=sn(e?.virtualMcpId),s=!!o,r=re(e?.virtualMcpId,e?.branch),i=r.kind==="protocol"?r:null,a=ut(e),c=t?.fetchEnabled??!0,l=Rs(e?.virtualMcpId),u=Ft(e?.virtualMcpId).runtime==="cms",d=G();let f;n[0]!==a?(f=g.decofile(a),n[0]=a,n[1]=f):f=n[1];const h=f;lr(i,i&&e?e:null,a);let v;n[2]!==e||n[3]!==d||n[4]!==h?(v=()=>{if(!e||d.isMutating({mutationKey:ke(e.orgSlug,e.virtualMcpId,e.branch)})>0)return!0;const E=d.getQueryState(h);return E?.fetchStatus==="fetching"||Date.now()-(E?.dataUpdatedAt??0)<an/2},n[2]=e,n[3]=d,n[4]=h,n[5]=v):v=n[5];let b;n[6]!==u||n[7]!==s||n[8]!==e||n[9]!==i||n[10]!==d||n[11]!==h?(b=async()=>{if(e){if(!i&&u&&!s){const E=hs(d,e)?.version;if(E&&!await gs(e,E))return}await d.refetchQueries({queryKey:h,exact:!0},{cancelRefetch:!1})}},n[6]=u,n[7]=s,n[8]=e,n[9]=i,n[10]=d,n[11]=h,n[12]=b):b=n[12];let p;n[13]!==v||n[14]!==b?(p={skip:v,read:b},n[13]=v,n[14]=b,n[15]=p):p=n[15],Ss(!!t?.pollWhile&&!!e,p);const R=Xe(i?.hosted?a:"");let k;n[16]!==r.kind||n[17]!==u||n[18]!==c||n[19]!==a||n[20]!==s||n[21]!==o||n[22]!==l||n[23]!==e||n[24]!==i||n[25]!==d?(k=async()=>{if(i)return(await Nn(d,i,e,a)).blocks;if(r.kind==="unavailable")throw ar("decofile");if(s){const M=await fetch(new URL("/.decofile",o).toString(),{cache:"no-store"}).catch(yr),Q=M?.ok?Rt(await M.text()):null;if(Q)return Q;const P=new Error("decofile unavailable (local tunnel unreachable)");throw P.status=502,P}if(u)return bs(d,e);const E=()=>Ts(e,ls(l,".deco/blocks.gen.json"));if(c){const M=await fetch(Ds(e),{cache:"no-store"}).catch(wr);if(M?.ok){const H=Rt(await M.text());if(H)return H}const Q=await E();if(Q.kind==="data")return Q.data;const P=new Error(`Failed to fetch decofile: ${M?.status??"network error"}`);throw P.status=Pt({liveOk:!!M?.ok,liveStatus:M?.status,committedAbsent:Q.kind==="absent"}),P}const j=await E();if(j.kind==="data")return j.data;const U=new Error("decofile unavailable (preview down, no committed snapshot)");throw U.status=Pt({liveOk:!1,committedAbsent:j.kind==="absent"}),U},n[16]=r.kind,n[17]=u,n[18]=c,n[19]=a,n[20]=s,n[21]=o,n[22]=l,n[23]=e,n[24]=i,n[25]=d,n[26]=k):k=n[26];const $=!!e&&r.kind!=="pending",I=i?0:3e4,_=i?.describe.pollIntervalMs,T=i?"always":void 0;let S;n[27]!==u||n[28]!==s||n[29]!==i?(S=(E,j)=>{if(i||u||s)return E<3;const U=j.status;return U!==502&&U!==404&&E<2},n[27]=u,n[28]=s,n[29]=i,n[30]=S):S=n[30];let O;n[31]!==h||n[32]!==k||n[33]!==$||n[34]!==I||n[35]!==_||n[36]!==T||n[37]!==S?(O={queryKey:h,queryFn:k,enabled:$,staleTime:I,refetchInterval:_,refetchIntervalInBackground:!1,refetchOnWindowFocus:T,retry:S,retryDelay:cs},n[31]=h,n[32]=k,n[33]=$,n[34]=I,n[35]=_,n[36]=T,n[37]=S,n[38]=O):O=n[38];const D=C(O);let x;n[39]!==R||n[40]!==D?(x=R&&D.data?Oo(R,D.data):void 0,n[39]=R,n[40]=D,n[41]=x):x=n[41];const A=x;let m;return n[42]!==A||n[43]!==i?.hosted||n[44]!==D?(m=i?.hosted&&A?{...D,data:A}:D,n[42]=A,n[43]=i?.hosted,n[44]=D,n[45]=m):m=n[45],m}function wr(){return null}function yr(){return null}function Ai(e,t,n){return rs(e,t,n)}function Mi(e){const t=N.c(4),n=G(),o=re(e?.virtualMcpId,e?.branch),s=ut(e),r=o.kind==="protocol"?o.hosted:void 0;let i;return t[0]!==s||t[1]!==n||t[2]!==r?(i=(a,c)=>_o(n,r,s,a,c),t[0]=s,t[1]=n,t[2]=r,t[3]=i):i=t[3],i}function Li(e,t){const n=N.c(3),o=re(e?.virtualMcpId,e?.branch),s=ut(e),r=Xe(o.kind==="protocol"&&o.hosted?s:"");let i;return n[0]!==r?.entries||n[1]!==t?(i=Object.entries(r?.entries??{}).filter(a=>{const[,c]=a;return t(c.meta?.type??"")}).map(Sr),n[0]=r?.entries,n[1]=t,n[2]=i):i=n[2],i}function Sr(e){const[t]=e;return t}const kr="site-editor-save",Ln={id:kr,description:void 0,action:void 0,cancel:void 0},Ui="site-editor-undo",Ue="site-editor-publish";function Or(e){const t=N.c(7),{label:n,detail:o}=e;let s;t[0]!==n?(s=X.jsx("summary",{className:"cursor-pointer select-none text-muted-foreground",children:n}),t[0]=n,t[1]=s):s=t[1];let r;t[2]!==o?(r=X.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words font-mono text-muted-foreground",children:o}),t[2]=o,t[3]=r):r=t[3];let i;return t[4]!==s||t[5]!==r?(i=X.jsxs("details",{className:"mt-1 text-xs",children:[s,r]}),t[4]=s,t[5]=r,t[6]=i):i=t[6],i}function Un(e,t){return t?X.jsx(Or,{label:e("siteEditor.details"),detail:t}):void 0}function Qi(e,t,n){ne.error(hn(e,t,n),{...Ln,description:Un(e,xs(t,n))})}function Ci(e,t,n=!1){ne.info(e(t?"sectionsEditor.reconcile.leftDeleted":"sectionsEditor.reconcile.keptTheirs"),{...Ln,description:e(t?n?"sectionsEditor.reconcile.leftDeletedNeverPublishedHint":"sectionsEditor.reconcile.leftDeletedHint":"sectionsEditor.reconcile.keptTheirsHint")})}const Qn={action:void 0,duration:void 0};function Bi(e,t){ne.success(t?e("siteEditor.publish.publishedOn",{host:t}):e("siteEditor.publish.published"),{...Qn,id:Ue,description:void 0})}function Fi(e,{headline:t,body:n,detail:o,retry:s,pending:r,tone:i="error"}){const a=Un(e,o??null);ne[i](t,{id:Ue,description:n&&a?X.jsxs(X.Fragment,{children:[X.jsx("p",{children:n}),a]}):n??a,action:s?{label:e("siteEditor.tryAgain"),onClick:c=>{c.preventDefault(),ne.loading(r??e("thread.publishPopover.publishing"),{...Qn,id:Ue,description:void 0}),s()}}:void 0,duration:s?Number.POSITIVE_INFINITY:void 0})}function Vi(e){return e instanceof Error?e.message||null:e==null?null:String(e)}export{fs as $,Ws as A,Us as B,Ts as C,tn as D,di as E,Gr as F,pr as G,W as H,qs as I,wi as J,bi as K,ve as L,Fs as M,Vs as N,ii as O,pi as P,ci as Q,ki as R,Si as S,Kt as T,rr as U,ji as V,ui as W,us as X,ke as Y,sr as Z,_s as _,Hr as a,fi as a$,Mo as a0,ns as a1,Lr as a2,Qr as a3,Zr as a4,Et as a5,Dt as a6,qr as a7,Wr as a8,zr as a9,nt as aA,si as aB,fr as aC,rt as aD,Ri as aE,Pi as aF,Qi as aG,Ii as aH,ds as aI,ei as aJ,Ei as aK,Ti as aL,it as aM,Kr as aN,Ni as aO,li as aP,xi as aQ,ee as aR,ai as aS,Fi as aT,Ui as aU,Ln as aV,y as aW,w as aX,ze as aY,Pn as aZ,Oo as a_,bo as aa,Un as ab,Vi as ac,Cs as ad,Ur as ae,_n as af,ao as ag,Or as ah,yi as ai,mi as aj,rs as ak,Es as al,Nn as am,ar as an,cs as ao,oi as ap,Ue as aq,Qn as ar,Bi as as,Oi as at,Ar as au,Mr as av,Je as aw,Ci as ax,_i as ay,ri as az,Ao as b,ni as b0,hi as b1,gi as b2,vi as b3,sn as c,Mi as d,Vr as e,Li as f,Di as g,Yr as h,Jr as i,$i as j,Ai as k,vo as l,po as m,Gt as n,ts as o,Cr as p,ti as q,Fr as r,Br as s,ks as t,re as u,ut as v,Xr as w,Rs as x,ls as y,Js as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as ee,a4 as te,q as ne,r as E,j as t,B as Q,n as _,dY as ae,a5 as ce,aN as me,aM as pe,aJ as de,aH as ue,aI as ge,aL as fe,aK as he,b5 as xe,t as C,dL as je,c as se,m as ke,_ as ve,X as ye,Z as Se,Y as be,K as H,gD as Ce}from"./index-CWyPzcrL.js";import{a as De}from"./SwitchHorizontal01-D3zx9VNf.js";import{N as we}from"./agent-icon-DvD5kv_K.js";import{s as Ne}from"./Trash01-BTZDkUzq.js";import{i as Pe}from"./Upload01-BRP1bAMs.js";import{i as ie}from"./Zap-Dja9fdMf.js";import{S as Ae}from"./search-toggle-tlJ3SbIE.js";import{E as W}from"./empty-state-BBFh_11d.js";import{C as Ee}from"./collection-tabs-6iiAOwW9.js";import{S as Me,F as Oe}from"./folder-icon-DLenjLsE.js";import{j as Te,k as Ie,n as Re}from"./use-org-fs-DwXaWmOv.js";import{a7 as ze,R as Z,Z as $e}from"./chat-context--RKzWa6k.js";import{c as Le}from"./context-shell--6NpIOhl.js";import"./AlertCircle-DuMz-jFi.js";import"./Tool01-D9-ePNaJ.js";import"./ArrowUp-D5JWz7Yq.js";import"./ArrowLeft-5NT3k46C.js";import"./LinkBroken01-IVC8feVZ.js";import"./BookOpen01-m1uNXDEc.js";import"./Globe04-KZ-J2ZUi.js";import"./CheckCircle-DAPdRkcW.js";import"./ChevronUp-BaKxA_AU.js";import"./ChevronSelectorVertical-5fTMRN5v.js";import"./UserSquare-Dv0YcmkC.js";import"./CreditCard01-BU3Icpfr.js";import"./Key01-RIzbDsEi.js";import"./Minus-Dw050KAn.js";import"./Monitor01-D7QUQToM.js";import"./Sun-DRT9bMW5.js";import"./Play-BDSDyO5E.js";import"./Plus-CRqz0c82.js";import"./SearchMd-CcAFkP0F.js";import"./ShoppingBag01-CspfAlNO.js";import"./Users01-DKwguy8Z.js";import"./XClose-CyHahh4m.js";import"./icon-button-y7e4XAeL.js";import"./tooltip-C-0kDxkl.js";import"./index-ixp03eW8.js";import"./badge-DzB3sqoD.js";import"./markdown-DCvPsl1N.js";import"./use-copy-ChDt5LN5.js";import"./use-mobile-BZxtzMj7.js";import"./use-view-draft-kind-C5ojzKhH.js";import"./thread-route-D-qV5LOQ.js";import"./use-project-scope-Fr7Egb1F.js";import"./repository-binding-SYfLLQPp.js";import"./use-mcp-client-BJYqkCGO.js";import"./auth-ygmhxR7o.js";import"./use-organization-settings-DNlKPHFq.js";import"./schema-CLtIHsoR.js";import"./task-board-CNxFcEEU.js";import"./thread-intent-BoKpDkXm.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./watch-sse-pool-CR6i9l-S.js";import"./file-preview-BIcXPFXf.js";import"./utils-DZ4Tq9_F.js";import"./editor-BDmwWZXW.js";import"./file-type-icon-B8w_B6Ur.js";import"./useInfiniteQuery--BgI5-DV.js";import"./infiniteQueryObserver-OShuiwgE.js";import"./use-entitlements-BTXwUzEe.js";import"./use-ai-providers-Drq9rd-R.js";import"./use-decopilot-events-DrQkcg1u.js";import"./require-capability-BiwpdxIn.js";import"./access-gate-VlWUv9j2.js";import"./capability-load-error-KmDfOtoP.js";import"./sections-B_HR2jtY.js";import"./textarea-D8L9nIm0.js";import"./use-ask-in-chat-DRRgH5qP.js";import"./shell-layout-BCfYpYFh.js";import"./use-deployment-admin-DqLzMbx4.js";import"./admin-fetch-BhTJlAsX.js";import"./command-DQleocFC.js";import"./index-CVAn8xNL.js";import"./integration-icon-C_WzTScv.js";import"./project-icon-DCOepmMu.js";import"./use-navigate-to-agent-v5tv9KVo.js";import"./use-debounced-value-CPC4qMn_.js";import"./new-project-dialog-uK1Ixj7a.js";import"./label-Cf_dlQhi.js";import"./repository-picker-CbFl2YYE.js";import"./github-icon-BmJmIA35.js";import"./collection-search-DvsK7hSv.js";import"./legacy-admin-welcome-dialog-Bh63ptd4.js";import"./drawer-CSA_YXe9.js";import"./required-auth-layout-DFuLVB75.js";import"./use-org-sso-BxQ8a0VK.js";const J=200,_e=new Set(["node_modules","__pycache__"]);function G(s){const[,...e]=s.webkitRelativePath.split("/");return e.length>0?e.join("/"):s.name}function Fe(s){return G(s).split("/").every(e=>!e.startsWith(".")&&!_e.has(e))}function Be(s){return s.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"skill"}function Ke(s,e){const i=new Map;for(const o of s){const c=G(o).split("/");c.pop();const a=["skills",e,...c].join("/");i.set(a,[...i.get(a)??[],o])}return i}async function qe(s,e){const o=(await Promise.allSettled([...s].map(([c,a])=>e({dir:c,files:a})))).find(c=>c.status==="rejected");if(o)throw o.reason}function He(s,e){const i=Le(e),o=`skills/${s}`;return{id:`home/${o}`,name:i.name??s,description:i.description,disableModelInvocation:i.disableModelInvocation,source:"home",volume:Z,path:o,sandboxPath:`${ze}/${Z}/${o}`}}const F="*";function B(s){return s.volume==="home"}function re(s,e){const i=s.indexOf(":");return i===-1?{label:e,glyph:ie}:{label:s.slice(i+1),glyph:s.startsWith("repo:")?je:we}}function Qe(s){const e=se.c(48),{entry:i,pending:o,onOpen:c,onDelete:a}=s,n=ee(),{org:g}=te();let M;e[0]!==i.source||e[1]!==g.name?(M=re(i.source,g.name),e[0]=i.source,e[1]=g.name,e[2]=M):M=e[2];const{label:O,glyph:I}=M;let D;e[3]!==i?(D=B(i),e[3]=i,e[4]=D):D=e[4];const R=D,w=o?"opacity-60":"hover:bg-accent";let f;e[5]!==w?(f=ke("relative transition-colors group overflow-hidden flex flex-col h-full",w),e[5]=w,e[6]=f):f=e[6];let m;e[7]!==i.name||e[8]!==c||e[9]!==o?(m=!o&&t.jsx("button",{type:"button",onClick:c,className:"absolute inset-0 z-0","aria-label":i.name}),e[7]=i.name,e[8]=c,e[9]=o,e[10]=m):m=e[10];const N=R?"default":"system",z=!R;let h;e[11]!==I||e[12]!==N||e[13]!==z?(h=t.jsx(Oe,{glyph:I,tone:N,readOnly:z,className:"size-8 shrink-0"}),e[11]=I,e[12]=N,e[13]=z,e[14]=h):h=e[14];let x;e[15]!==a||e[16]!==n?(x=a&&t.jsx("div",{className:"relative z-10 pointer-events-auto transition-opacity sm:opacity-0 sm:group-hover:opacity-100",children:t.jsxs(ve,{children:[t.jsx(ye,{asChild:!0,children:t.jsx(Q,{variant:"ghost",size:"icon",children:t.jsx(De,{size:16})})}),t.jsx(Se,{align:"end",children:t.jsxs(be,{variant:"destructive",onClick:K=>{K.stopPropagation(),a()},children:[t.jsx(Ne,{size:16}),n("settings.skills.deleteButton")]})})]})}),e[15]=a,e[16]=n,e[17]=x):x=e[17];let j;e[18]!==h||e[19]!==x?(j=t.jsxs("div",{className:"flex items-start justify-between",children:[h,x]}),e[18]=h,e[19]=x,e[20]=j):j=e[20];let b;e[21]!==i.name?(b=t.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:i.name}),e[21]=i.name,e[22]=b):b=e[22];let k;e[23]!==i.description||e[24]!==n?(k=i.description||n("settings.skills.noDescription"),e[23]=i.description,e[24]=n,e[25]=k):k=e[25];let p;e[26]!==k?(p=t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:k}),e[26]=k,e[27]=p):p=e[27];let v;e[28]!==b||e[29]!==p?(v=t.jsxs("div",{className:"flex flex-col gap-1",children:[b,p]}),e[28]=b,e[29]=p,e[30]=v):v=e[30];let d;e[31]!==j||e[32]!==v?(d=t.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[j,v]}),e[31]=j,e[32]=v,e[33]=d):d=e[33];let y;e[34]!==O||e[35]!==o||e[36]!==n?(y=o?n("settings.skills.importing"):O,e[34]=O,e[35]=o,e[36]=n,e[37]=y):y=e[37];let u;e[38]!==y?(u=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:y})})}),e[38]=y,e[39]=u):u=e[39];let S;e[40]!==d||e[41]!==u?(S=t.jsxs("div",{className:"flex flex-col flex-1 pointer-events-none",children:[d,u]}),e[40]=d,e[41]=u,e[42]=S):S=e[42];let T;return e[43]!==o||e[44]!==S||e[45]!==f||e[46]!==m?(T=t.jsxs(Ce,{size:"flush","aria-busy":o,className:f,children:[m,S]}),e[43]=o,e[44]=S,e[45]=f,e[46]=m,e[47]=T):T=e[47],T}function V(s){const e=se.c(2),{children:i}=s;let o;return e[0]!==i?(o=t.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:i}),e[0]=i,e[1]=o):o=e[1],o}function ws(){const s=ee(),{org:e}=te(),i=Te(),{remove:o,upload:c}=Ie("home"),a=ne(),n=E.useRef(null),[g,M]=E.useState(""),[O,I]=E.useState(F),[D,R]=E.useState(!1),[w,f]=E.useState(null),[m,N]=E.useState(null),[z,h]=E.useState(null),x=()=>{a.invalidateQueries({queryKey:H.slashSkills(e.id)}),a.invalidateQueries({queryKey:H.orgFsSkills(e.id)})},j=r=>a.setQueryData(H.slashSkills(e.id),l=>r(l??[]));async function b(r){const l=[...r??[]];if(n.current&&(n.current.value=""),l.length===0)return;const P=l[0]?.webkitRelativePath??"";if(!P){C.error(s("settings.skills.importNeedsFolder"));return}const q=P.split("/")[0]??"",L=l.filter(Fe),U=L.find(A=>G(A)==="SKILL.md");if(!U){C.error(s("settings.skills.importMissingSkillMd"));return}if(L.length>J){C.error(s("settings.skills.importTooManyFiles",{count:String(L.length),max:String(J)}));return}const $=Be(q),X=`skills/${$}`;let Y=!1;R(!0);try{if(await Re(e.slug,"home",X)){C.error(s("settings.skills.importSlugTaken",{slug:$}));return}Y=!0;const A=He($,await U.text());j(le=>[A,...le]),h(A.id),await qe(Ke(L,$),c.mutateAsync),C.success(s("settings.skills.importSuccess",{name:$}))}catch(A){Y&&await o.mutateAsync(X).catch(()=>{}),C.error(A instanceof Error?A.message:s("settings.skills.importError"))}finally{h(null),x(),R(!1)}}const k=g.toLowerCase(),p=(i.data??[]).filter(r=>r.name.toLowerCase().includes(k)||(r.description??"").toLowerCase().includes(k)).sort((r,l)=>Number(B(l))-Number(B(r))||r.name.localeCompare(l.name)),v=new Set((i.data??[]).map(r=>r.source)),d=new Map;for(const r of p)d.set(r.source,(d.get(r.source)??0)+1);const y=[{id:F,label:s("settings.skills.filterAll"),count:p.length},...[...v].map(r=>({id:r,label:re(r,e.name).label,count:d.get(r)??0}))],u=v.has(O)?O:F,S=u===F?p:p.filter(r=>r.source===u),T=r=>f($e(r.volume,r.path)),K=async()=>{if(!m)return;const{id:r,path:l}=m;N(null),j(P=>P.filter(q=>q.id!==r));try{await o.mutateAsync(l),C.success(s("settings.skills.deleteSuccess"))}catch(P){C.error(P instanceof Error?P.message:s("settings.skills.deleteError"))}finally{x()}},oe=t.jsxs(Q,{size:"sm",disabled:D,onClick:()=>n.current?.click(),children:[t.jsx(Pe,{size:14}),s(D?"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.jsx(_.Actions,{secondary:t.jsx(Ae,{value:g,onChange:M,label:s("library.context.search"),placeholder:s("settings.skills.searchPlaceholder"),clearLabel:s("library.library.clearSearch")}),children:oe}),t.jsx("input",{ref:n,type:"file",multiple:!0,webkitdirectory:"",className:"hidden",onChange:r=>{b(r.target.files)}}),y.length>2&&t.jsx(Ee,{placement:"page",tabs:y,activeTab:u,onTabChange:I}),i.isPending?t.jsx("div",{className:"@container",children:t.jsx(V,{children:Array.from({length:8},(r,l)=>t.jsx(ae,{className:"h-[168px] rounded-xl"},l))})}):i.isError?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx(W,{image:t.jsx(ce,{size:48,className:"text-muted-foreground"}),title:s("settings.skills.errorTitle"),description:i.error instanceof Error?i.error.message:s("settings.skills.errorDescription"),actions:t.jsx(Q,{size:"sm",variant:"outline",onClick:()=>{i.refetch()},children:s("settings.skills.retry")})})}):S.length===0?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx(W,{image:t.jsx(ie,{size:48,className:"text-muted-foreground"}),title:s(g?"settings.skills.noResultsTitle":"settings.skills.emptyTitle"),description:g?s("settings.skills.noResultsDescription",{search:g}):s("settings.skills.emptyDescription"),actions:!1})}):t.jsx("div",{className:"@container",children:t.jsx(V,{children:S.map(r=>{const l=r.id===z;return t.jsx(Qe,{entry:r,pending:l,onOpen:()=>T(r),onDelete:B(r)&&!l?()=>N(r):void 0},r.id)})})})]})})}),w&&t.jsx(Me,{skillPath:w,onClose:()=>f(null)},w),t.jsx(me,{open:m!==null,onOpenChange:r=>!r&&N(null),children:t.jsxs(pe,{children:[t.jsxs(de,{children:[t.jsx(ue,{children:s("settings.skills.deleteDialogTitle")}),t.jsx(ge,{children:s("settings.skills.deleteDialogDescription",{name:m?.name??""})})]}),t.jsxs(fe,{children:[t.jsx(he,{children:s("settings.skills.cancel")}),t.jsx(xe,{onClick:K,variant:"destructive",children:s("settings.skills.deleteButton")})]})]})})]})}export{ws as default};
|
|
1
|
+
import{b as ee,a4 as te,q as ne,r as E,j as t,B as Q,n as _,dY as ae,a5 as ce,aN as me,aM as pe,aJ as de,aH as ue,aI as ge,aL as fe,aK as he,b5 as xe,t as C,dL as je,c as se,m as ke,_ as ve,X as ye,Z as Se,Y as be,K as H,gD as Ce}from"./index-BqA84bKQ.js";import{a as De}from"./SwitchHorizontal01-C-rlzvYe.js";import{N as we}from"./agent-icon-7pgGOyab.js";import{s as Ne}from"./Trash01-CGrA2ON1.js";import{i as Pe}from"./Upload01-6kkhuzxl.js";import{i as ie}from"./Zap-DfRMi_rk.js";import{S as Ae}from"./search-toggle-cAgGYPjr.js";import{E as W}from"./empty-state-A6nZ3Khe.js";import{C as Ee}from"./collection-tabs-nxDU_6IX.js";import{S as Me,F as Oe}from"./folder-icon-B0bQ9NL4.js";import{j as Te,k as Ie,n as Re}from"./use-org-fs-Tz3YgtJ1.js";import{a7 as ze,R as Z,Z as $e}from"./chat-context-ChgzPsES.js";import{c as Le}from"./context-shell-DqR6-S0A.js";import"./AlertCircle-BNgT9H-9.js";import"./Tool01-D4x0RZqM.js";import"./ArrowUp-DX0Oa8sk.js";import"./ArrowLeft-CzuIgcZK.js";import"./LinkBroken01-l43AWgbv.js";import"./BookOpen01-BDEDqARy.js";import"./Globe04-BpbOo7AZ.js";import"./CheckCircle-DGPVeuCJ.js";import"./ChevronUp-B9DaDvS3.js";import"./ChevronSelectorVertical-CI140ew9.js";import"./UserSquare-nHYvjai8.js";import"./CreditCard01-BmpzvB5e.js";import"./Key01-Cpl2DWV2.js";import"./Minus-DyKaWISs.js";import"./Monitor01-BdFmkSiY.js";import"./Sun-vurMVi6G.js";import"./Play-BDaEp7vE.js";import"./Plus-Dxw22W7_.js";import"./SearchMd-DuFQ9UgF.js";import"./ShoppingBag01-Bf_3Yh5l.js";import"./Users01-e2r7hqMU.js";import"./XClose-CBDYK_AJ.js";import"./icon-button-Bd1QIQSI.js";import"./tooltip-TH6OTMa1.js";import"./index-BzeTLGQv.js";import"./badge-DJzADYLN.js";import"./markdown-DTS1cwWT.js";import"./use-copy-D19rl06v.js";import"./use-mobile-BSwhKw5s.js";import"./use-view-draft-kind-vGVmYJM5.js";import"./thread-route-TkYSs_wZ.js";import"./use-project-scope-CDU7oHZd.js";import"./repository-binding-CekCSlJ1.js";import"./use-mcp-client-d3hjTGOk.js";import"./auth-DNlWgaIH.js";import"./use-organization-settings-O_jt8YRI.js";import"./schema-CZJq0dLP.js";import"./task-board-DYqWLLmQ.js";import"./thread-intent-DWdkWFbM.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./watch-sse-pool-BhRvBapO.js";import"./file-preview-B5GYsNzx.js";import"./utils-GS2Z_6Er.js";import"./editor-Cx1cLsfT.js";import"./file-type-icon-CK3whZmM.js";import"./useInfiniteQuery-DAPRIetj.js";import"./infiniteQueryObserver-amUGbo-h.js";import"./use-entitlements-CrqU38x1.js";import"./use-ai-providers-BQ4cXHYk.js";import"./use-decopilot-events-DjBmVlF5.js";import"./require-capability-C5tMOw5q.js";import"./access-gate-3uWjt152.js";import"./capability-load-error-BQYVgnjq.js";import"./sections-DIGnapH7.js";import"./textarea-BC5J6m5c.js";import"./use-ask-in-chat-D9_rhHLE.js";import"./shell-layout-CMWsc7Ga.js";import"./use-deployment-admin-E8whHqZV.js";import"./admin-fetch-BhTJlAsX.js";import"./command-BBpufUKx.js";import"./index-Bx5tjmDd.js";import"./integration-icon-C9sCBDDr.js";import"./project-icon-C60MdZm4.js";import"./use-navigate-to-agent-ClknH49I.js";import"./use-debounced-value-CbRaNTJb.js";import"./new-project-dialog-BOtGKQPA.js";import"./label-Ducx0j9M.js";import"./repository-picker-UWrxu6_V.js";import"./github-icon-D3u8oGuo.js";import"./collection-search-DIXRttD3.js";import"./legacy-admin-welcome-dialog-C1mvlaj8.js";import"./drawer-DyYc7c6p.js";import"./required-auth-layout-Cpnwi031.js";import"./use-org-sso-DKQA9PvY.js";const J=200,_e=new Set(["node_modules","__pycache__"]);function G(s){const[,...e]=s.webkitRelativePath.split("/");return e.length>0?e.join("/"):s.name}function Fe(s){return G(s).split("/").every(e=>!e.startsWith(".")&&!_e.has(e))}function Be(s){return s.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"skill"}function Ke(s,e){const i=new Map;for(const o of s){const c=G(o).split("/");c.pop();const a=["skills",e,...c].join("/");i.set(a,[...i.get(a)??[],o])}return i}async function qe(s,e){const o=(await Promise.allSettled([...s].map(([c,a])=>e({dir:c,files:a})))).find(c=>c.status==="rejected");if(o)throw o.reason}function He(s,e){const i=Le(e),o=`skills/${s}`;return{id:`home/${o}`,name:i.name??s,description:i.description,disableModelInvocation:i.disableModelInvocation,source:"home",volume:Z,path:o,sandboxPath:`${ze}/${Z}/${o}`}}const F="*";function B(s){return s.volume==="home"}function re(s,e){const i=s.indexOf(":");return i===-1?{label:e,glyph:ie}:{label:s.slice(i+1),glyph:s.startsWith("repo:")?je:we}}function Qe(s){const e=se.c(48),{entry:i,pending:o,onOpen:c,onDelete:a}=s,n=ee(),{org:g}=te();let M;e[0]!==i.source||e[1]!==g.name?(M=re(i.source,g.name),e[0]=i.source,e[1]=g.name,e[2]=M):M=e[2];const{label:O,glyph:I}=M;let D;e[3]!==i?(D=B(i),e[3]=i,e[4]=D):D=e[4];const R=D,w=o?"opacity-60":"hover:bg-accent";let f;e[5]!==w?(f=ke("relative transition-colors group overflow-hidden flex flex-col h-full",w),e[5]=w,e[6]=f):f=e[6];let m;e[7]!==i.name||e[8]!==c||e[9]!==o?(m=!o&&t.jsx("button",{type:"button",onClick:c,className:"absolute inset-0 z-0","aria-label":i.name}),e[7]=i.name,e[8]=c,e[9]=o,e[10]=m):m=e[10];const N=R?"default":"system",z=!R;let h;e[11]!==I||e[12]!==N||e[13]!==z?(h=t.jsx(Oe,{glyph:I,tone:N,readOnly:z,className:"size-8 shrink-0"}),e[11]=I,e[12]=N,e[13]=z,e[14]=h):h=e[14];let x;e[15]!==a||e[16]!==n?(x=a&&t.jsx("div",{className:"relative z-10 pointer-events-auto transition-opacity sm:opacity-0 sm:group-hover:opacity-100",children:t.jsxs(ve,{children:[t.jsx(ye,{asChild:!0,children:t.jsx(Q,{variant:"ghost",size:"icon",children:t.jsx(De,{size:16})})}),t.jsx(Se,{align:"end",children:t.jsxs(be,{variant:"destructive",onClick:K=>{K.stopPropagation(),a()},children:[t.jsx(Ne,{size:16}),n("settings.skills.deleteButton")]})})]})}),e[15]=a,e[16]=n,e[17]=x):x=e[17];let j;e[18]!==h||e[19]!==x?(j=t.jsxs("div",{className:"flex items-start justify-between",children:[h,x]}),e[18]=h,e[19]=x,e[20]=j):j=e[20];let b;e[21]!==i.name?(b=t.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:i.name}),e[21]=i.name,e[22]=b):b=e[22];let k;e[23]!==i.description||e[24]!==n?(k=i.description||n("settings.skills.noDescription"),e[23]=i.description,e[24]=n,e[25]=k):k=e[25];let p;e[26]!==k?(p=t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:k}),e[26]=k,e[27]=p):p=e[27];let v;e[28]!==b||e[29]!==p?(v=t.jsxs("div",{className:"flex flex-col gap-1",children:[b,p]}),e[28]=b,e[29]=p,e[30]=v):v=e[30];let d;e[31]!==j||e[32]!==v?(d=t.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[j,v]}),e[31]=j,e[32]=v,e[33]=d):d=e[33];let y;e[34]!==O||e[35]!==o||e[36]!==n?(y=o?n("settings.skills.importing"):O,e[34]=O,e[35]=o,e[36]=n,e[37]=y):y=e[37];let u;e[38]!==y?(u=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:y})})}),e[38]=y,e[39]=u):u=e[39];let S;e[40]!==d||e[41]!==u?(S=t.jsxs("div",{className:"flex flex-col flex-1 pointer-events-none",children:[d,u]}),e[40]=d,e[41]=u,e[42]=S):S=e[42];let T;return e[43]!==o||e[44]!==S||e[45]!==f||e[46]!==m?(T=t.jsxs(Ce,{size:"flush","aria-busy":o,className:f,children:[m,S]}),e[43]=o,e[44]=S,e[45]=f,e[46]=m,e[47]=T):T=e[47],T}function V(s){const e=se.c(2),{children:i}=s;let o;return e[0]!==i?(o=t.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:i}),e[0]=i,e[1]=o):o=e[1],o}function ws(){const s=ee(),{org:e}=te(),i=Te(),{remove:o,upload:c}=Ie("home"),a=ne(),n=E.useRef(null),[g,M]=E.useState(""),[O,I]=E.useState(F),[D,R]=E.useState(!1),[w,f]=E.useState(null),[m,N]=E.useState(null),[z,h]=E.useState(null),x=()=>{a.invalidateQueries({queryKey:H.slashSkills(e.id)}),a.invalidateQueries({queryKey:H.orgFsSkills(e.id)})},j=r=>a.setQueryData(H.slashSkills(e.id),l=>r(l??[]));async function b(r){const l=[...r??[]];if(n.current&&(n.current.value=""),l.length===0)return;const P=l[0]?.webkitRelativePath??"";if(!P){C.error(s("settings.skills.importNeedsFolder"));return}const q=P.split("/")[0]??"",L=l.filter(Fe),U=L.find(A=>G(A)==="SKILL.md");if(!U){C.error(s("settings.skills.importMissingSkillMd"));return}if(L.length>J){C.error(s("settings.skills.importTooManyFiles",{count:String(L.length),max:String(J)}));return}const $=Be(q),X=`skills/${$}`;let Y=!1;R(!0);try{if(await Re(e.slug,"home",X)){C.error(s("settings.skills.importSlugTaken",{slug:$}));return}Y=!0;const A=He($,await U.text());j(le=>[A,...le]),h(A.id),await qe(Ke(L,$),c.mutateAsync),C.success(s("settings.skills.importSuccess",{name:$}))}catch(A){Y&&await o.mutateAsync(X).catch(()=>{}),C.error(A instanceof Error?A.message:s("settings.skills.importError"))}finally{h(null),x(),R(!1)}}const k=g.toLowerCase(),p=(i.data??[]).filter(r=>r.name.toLowerCase().includes(k)||(r.description??"").toLowerCase().includes(k)).sort((r,l)=>Number(B(l))-Number(B(r))||r.name.localeCompare(l.name)),v=new Set((i.data??[]).map(r=>r.source)),d=new Map;for(const r of p)d.set(r.source,(d.get(r.source)??0)+1);const y=[{id:F,label:s("settings.skills.filterAll"),count:p.length},...[...v].map(r=>({id:r,label:re(r,e.name).label,count:d.get(r)??0}))],u=v.has(O)?O:F,S=u===F?p:p.filter(r=>r.source===u),T=r=>f($e(r.volume,r.path)),K=async()=>{if(!m)return;const{id:r,path:l}=m;N(null),j(P=>P.filter(q=>q.id!==r));try{await o.mutateAsync(l),C.success(s("settings.skills.deleteSuccess"))}catch(P){C.error(P instanceof Error?P.message:s("settings.skills.deleteError"))}finally{x()}},oe=t.jsxs(Q,{size:"sm",disabled:D,onClick:()=>n.current?.click(),children:[t.jsx(Pe,{size:14}),s(D?"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.jsx(_.Actions,{secondary:t.jsx(Ae,{value:g,onChange:M,label:s("library.context.search"),placeholder:s("settings.skills.searchPlaceholder"),clearLabel:s("library.library.clearSearch")}),children:oe}),t.jsx("input",{ref:n,type:"file",multiple:!0,webkitdirectory:"",className:"hidden",onChange:r=>{b(r.target.files)}}),y.length>2&&t.jsx(Ee,{placement:"page",tabs:y,activeTab:u,onTabChange:I}),i.isPending?t.jsx("div",{className:"@container",children:t.jsx(V,{children:Array.from({length:8},(r,l)=>t.jsx(ae,{className:"h-[168px] rounded-xl"},l))})}):i.isError?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx(W,{image:t.jsx(ce,{size:48,className:"text-muted-foreground"}),title:s("settings.skills.errorTitle"),description:i.error instanceof Error?i.error.message:s("settings.skills.errorDescription"),actions:t.jsx(Q,{size:"sm",variant:"outline",onClick:()=>{i.refetch()},children:s("settings.skills.retry")})})}):S.length===0?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx(W,{image:t.jsx(ie,{size:48,className:"text-muted-foreground"}),title:s(g?"settings.skills.noResultsTitle":"settings.skills.emptyTitle"),description:g?s("settings.skills.noResultsDescription",{search:g}):s("settings.skills.emptyDescription"),actions:!1})}):t.jsx("div",{className:"@container",children:t.jsx(V,{children:S.map(r=>{const l=r.id===z;return t.jsx(Qe,{entry:r,pending:l,onOpen:()=>T(r),onDelete:B(r)&&!l?()=>N(r):void 0},r.id)})})})]})})}),w&&t.jsx(Me,{skillPath:w,onClose:()=>f(null)},w),t.jsx(me,{open:m!==null,onOpenChange:r=>!r&&N(null),children:t.jsxs(pe,{children:[t.jsxs(de,{children:[t.jsx(ue,{children:s("settings.skills.deleteDialogTitle")}),t.jsx(ge,{children:s("settings.skills.deleteDialogDescription",{name:m?.name??""})})]}),t.jsxs(fe,{children:[t.jsx(he,{children:s("settings.skills.cancel")}),t.jsx(xe,{onClick:K,variant:"destructive",children:s("settings.skills.deleteButton")})]})]})})]})}export{ws as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as _,m as N,j}from"./index-
|
|
1
|
+
import{c as _,m as N,j}from"./index-BqA84bKQ.js";import{T as k,R as z,a as D,b as S}from"./index-DdNgZUci.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,eQ as G}from"./index-
|
|
1
|
+
import{r as v,eQ as G}from"./index-BqA84bKQ.js";import{b as de,d as fe,e as U,f as ge,g as pe,h as be,i as ve,C as Y,j as he,K as y,k as me,l as xe,m as Ie,s as ye}from"./core.esm-DCJ7aKR3.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},Pe=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=G.createContext({activeIndex:-1,containerId:H,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:B,disabled:{draggable:!1,droppable:!1}});function Xe(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 G.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"},Q="transform",Ee=Y.Transition.toString({property:Q,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 _e(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:K}=ge({id:o,data:D,disabled:m.droppable,resizeObserverConfig:{updateMeasurementsFor:I,...f}}),{active:T,activatorEvent:Z,activeNodeRect:ee,attributes:te,setNodeRef:P,listeners:re,isDragging:M,over:ne,setActivatorNodeRef:se,transform:oe}=pe({id:o,data:D,attributes:{...Ne,...n},disabled:m.draggable}),ae=be(K,P),S=!!T,X=S&&!R&&O(d)&&O(h),_=!w&&M,j=_&&X?oe:null,ie=X?j??(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,F=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:!F,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:K,setDraggableNodeRef:P,transform:$??ie,transition:le()};function le(){if($||ce&&p.current.newIndex===b)return Ee;if(!(_&&!ve(Z)||!u)&&(S||F))return Y.Transition.toString({...u,property:Q})}}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],je=(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=J(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 J(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)||!J(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}export{Xe as S,q as a,B as r,je as s,_e as u,Pe as v};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as A,a4 as B,r as v,j as e,n as x,hr as k,gT as b,ge as y,gf as a,i7 as D,B as m,I as g,aN as z,aM as T,aJ as O,aH as R,aL as F,aK as M,b5 as q,E as C,t as c,c as U}from"./index-
|
|
1
|
+
import{b as A,a4 as B,r as v,j as e,n as x,hr as k,gT as b,ge as y,gf as a,i7 as D,B as m,I as g,aN as z,aM as T,aJ as O,aH as R,aL as F,aK as M,b5 as q,E as C,t as c,c as U}from"./index-BqA84bKQ.js";import{D as H}from"./domain-settings-DBmeAU8w.js";import{S as $}from"./switch-CaR5PIVi.js";import{a as J,b as K,c as G,d as Q}from"./use-org-sso-DKQA9PvY.js";import{s as V}from"./Trash01-CGrA2ON1.js";import{R as W}from"./require-capability-C5tMOw5q.js";import"./badge-DJzADYLN.js";import"./select-DKwtgT2c.js";import"./index-BdQq_4o_.js";import"./index-BzeTLGQv.js";import"./ChevronUp-B9DaDvS3.js";import"./access-gate-3uWjt152.js";import"./capability-load-error-BQYVgnjq.js";function X(){const s=A(),{org:o}=B(),{data:h,isLoading:I}=J(o.id,o.slug),f=K(o.id,o.slug),S=G(o.id,o.slug),E=Q(o.id,o.slug),[i,l]=v.useState({issuer:"",clientId:"",clientSecret:"",discoveryEndpoint:"",domain:"",scopes:"openid email profile"}),[d,p]=v.useState(!1),[P,j]=v.useState(!1),u=h?.configured&&h.config,n=h?.config,N=()=>{n&&l({issuer:n.issuer,clientId:n.clientId,clientSecret:"",discoveryEndpoint:n.discoveryEndpoint??"",domain:n.domain,scopes:n.scopes.join(" ")}),p(!0)},_=async()=>{if(!i.issuer||!i.clientId||!i.domain){c.error(s("settings.orgSso.requiredFieldsError"));return}if(!u&&!i.clientSecret){c.error(s("settings.orgSso.clientSecretRequiredError"));return}try{await f.mutateAsync({issuer:i.issuer,clientId:i.clientId,clientSecret:i.clientSecret,discoveryEndpoint:i.discoveryEndpoint||void 0,scopes:i.scopes.split(/\s+/).filter(Boolean),domain:i.domain,enforced:n?.enforced??!1}),C(u?"sso_config_updated":"sso_configured",{organization_id:o.id,email_domain:i.domain}),c.success(s("settings.orgSso.configurationSavedSuccess")),p(!1)}catch(t){c.error(t instanceof Error?t.message:s("settings.orgSso.saveSsoConfigError"))}},w=async()=>{try{await S.mutateAsync(),C("sso_config_removed",{organization_id:o.id}),c.success(s("settings.orgSso.configurationRemovedSuccess")),p(!1),j(!1)}catch{c.error(s("settings.orgSso.removeSsoConfigError"))}},L=async t=>{try{await E.mutateAsync(t),C("sso_enforcement_toggled",{organization_id:o.id,enforced:t}),c.success(s(t?"settings.orgSso.enforcementEnabledSuccess":"settings.orgSso.enforcementDisabledSuccess"))}catch{c.error(s("settings.orgSso.toggleEnforcementError"))}};return e.jsxs(x,{children:[e.jsx(x.Content,{children:e.jsx(x.Container,{children:e.jsxs(k,{children:[e.jsx(x.Title,{children:s("settings.orgSso.securityTitle")}),e.jsx(H,{}),I?e.jsx("div",{className:"text-sm text-muted-foreground",children:s("settings.orgSso.loading")}):e.jsxs(e.Fragment,{children:[u&&!d&&e.jsx(b,{title:s("settings.orgSso.sectionTitle"),children:e.jsxs(y,{children:[e.jsx(a,{title:s("settings.orgSso.providerLabel"),action:e.jsx("span",{className:"font-medium",children:n.issuer})}),e.jsx(a,{title:s("settings.orgSso.clientIdLabel"),action:e.jsx("span",{className:"font-mono text-xs",children:n.clientId})}),e.jsx(a,{title:s("settings.orgSso.domainLabel"),action:e.jsx("span",{className:"font-medium",children:n.domain})}),e.jsx(a,{title:s("settings.orgSso.scopesLabel"),action:e.jsx("span",{className:"font-mono text-xs",children:n.scopes.join(" ")})}),e.jsx("div",{className:"h-px bg-border mx-5"}),e.jsx(a,{title:s("settings.orgSso.enforceSsoLabel"),description:s("settings.orgSso.enforceSsoDescription"),action:e.jsx($,{checked:n.enforced,onCheckedChange:L,disabled:E.isPending})}),e.jsxs(D,{children:[e.jsxs(m,{variant:"ghost",size:"sm",onClick:()=>j(!0),disabled:S.isPending,className:"text-destructive hover:text-destructive mr-auto",children:[e.jsx(V,{size:14}),s("settings.orgSso.removeButton")]}),e.jsx(m,{variant:"outline",size:"sm",onClick:()=>{window.open(`/api/${o.slug}/sso/authorize`,"_blank")},children:s("settings.orgSso.testSsoButton")}),e.jsx(m,{variant:"outline",size:"sm",onClick:N,children:s("settings.orgSso.editConfigButton")})]})]})}),(!u||d)&&e.jsx(b,{title:s("settings.orgSso.sectionTitle"),children:e.jsxs(y,{children:[e.jsx(a,{title:s("settings.orgSso.issuerUrlLabel"),description:s("settings.orgSso.issuerUrlDescription"),action:e.jsx(g,{id:"sso-issuer",placeholder:s("settings.orgSso.issuerUrlPlaceholder"),value:i.issuer,onChange:t=>l(r=>({...r,issuer:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.clientIdLabel"),action:e.jsx(g,{id:"sso-client-id",placeholder:s("settings.orgSso.clientIdPlaceholder"),value:i.clientId,onChange:t=>l(r=>({...r,clientId:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.clientSecretLabel"),description:d&&u?s("settings.orgSso.clientSecretEditDescription"):void 0,action:e.jsx(g,{id:"sso-client-secret",type:"password",placeholder:s("settings.orgSso.clientSecretPlaceholder"),value:i.clientSecret,onChange:t=>l(r=>({...r,clientSecret:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.emailDomainLabel"),description:s("settings.orgSso.emailDomainDescription"),action:e.jsx(g,{id:"sso-domain",placeholder:s("settings.orgSso.emailDomainPlaceholder"),value:i.domain,onChange:t=>l(r=>({...r,domain:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.scopesLabel"),action:e.jsx(g,{id:"sso-scopes",placeholder:s("settings.orgSso.scopesPlaceholder"),value:i.scopes,onChange:t=>l(r=>({...r,scopes:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.discoveryEndpointLabel"),description:s("settings.orgSso.discoveryEndpointDescription"),action:e.jsx(g,{id:"sso-discovery",placeholder:s("settings.orgSso.discoveryEndpointPlaceholder"),value:i.discoveryEndpoint,onChange:t=>l(r=>({...r,discoveryEndpoint:t.target.value})),className:"w-[280px]"})}),e.jsxs(D,{children:[d&&e.jsx(m,{variant:"outline",size:"sm",onClick:()=>p(!1),children:s("settings.orgSso.cancelButton")}),e.jsx(m,{onClick:_,disabled:f.isPending,size:"sm",children:f.isPending?s("settings.orgSso.savingButton"):s(d?"settings.orgSso.updateButton":"settings.orgSso.configureSsoButton")})]})]})})]})]})})}),e.jsx(z,{open:P,onOpenChange:j,children:e.jsxs(T,{children:[e.jsx(O,{children:e.jsx(R,{children:s("settings.orgSso.removeConfirmation")})}),e.jsxs(F,{children:[e.jsx(M,{disabled:S.isPending,children:s("settings.orgSso.cancelButton")}),e.jsx(q,{onClick:w,disabled:S.isPending,variant:"destructive",children:s("settings.orgSso.removeButton")})]})]})})]})}function de(){const s=U.c(1);let o;return s[0]===Symbol.for("react.memo_cache_sentinel")?(o=e.jsx(W,{capability:"org:manage",area:"security",children:e.jsx(X,{})}),s[0]=o):o=s[0],o}export{de as default};
|