decocms 4.574.4 → 4.574.5
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-Y_OUILZ3.js → AlertCircle-Dhxv_VvX.js} +1 -1
- package/dist/client/assets/{AreaChart-BS5obASA.js → AreaChart-p06QdUOH.js} +1 -1
- package/dist/client/assets/{ArrowLeft-CB426JlK.js → ArrowLeft-DPiUStmH.js} +1 -1
- package/dist/client/assets/{ArrowUp-Cp2Ml2vf.js → ArrowUp-C5MIVxlv.js} +1 -1
- package/dist/client/assets/{CartesianChart-BwAnmURd.js → CartesianChart-CR71csgM.js} +1 -1
- package/dist/client/assets/{CategoricalChart-DsdW4Q1n.js → CategoricalChart-C7-Bo6NS.js} +1 -1
- package/dist/client/assets/{CheckCircle-CEPNyqYQ.js → CheckCircle-DQiPh0bs.js} +1 -1
- package/dist/client/assets/{ChevronSelectorVertical-DClPI-qU.js → ChevronSelectorVertical-C_LOUUD2.js} +1 -1
- package/dist/client/assets/{ChevronUp-Dsr9gtxU.js → ChevronUp-BusAGBPt.js} +1 -1
- package/dist/client/assets/{CreditCard01-D6m8lGLv.js → CreditCard01-B86ybMWX.js} +1 -1
- package/dist/client/assets/{Globe04-DOLChRWZ.js → Globe04-BgmGeS07.js} +1 -1
- package/dist/client/assets/{Key01-CcC-DNfV.js → Key01-bRc0D6iU.js} +1 -1
- package/dist/client/assets/{LinkBroken01-Bu5CIeMz.js → LinkBroken01-CExBuGlw.js} +1 -1
- package/dist/client/assets/{Minus-cqn26HtL.js → Minus-BuxaQmfP.js} +1 -1
- package/dist/client/assets/{Monitor01-BeH9O99T.js → Monitor01-CWmH5Gyz.js} +1 -1
- package/dist/client/assets/{Play-o5_wqCmk.js → Play-xrfH4Yz5.js} +1 -1
- package/dist/client/assets/{Plus-sBQQfz_j.js → Plus-BRIZEm-m.js} +1 -1
- package/dist/client/assets/{ReferenceLine-DgNwUxHe.js → ReferenceLine-DTFZ8A_b.js} +1 -1
- package/dist/client/assets/{SearchMd-CBPTYB4H.js → SearchMd-CHeeKxSQ.js} +1 -1
- package/dist/client/assets/{ShoppingBag01-C88ytSQP.js → ShoppingBag01-CpRghVvA.js} +1 -1
- package/dist/client/assets/{Sun-9dowJ77Q.js → Sun-fB3zW2OU.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-BXlvEeQ4.js → SwitchHorizontal01-DIK7cKae.js} +1 -1
- package/dist/client/assets/{Tool01-D9z5UHl1.js → Tool01-Bw_Gs9HT.js} +1 -1
- package/dist/client/assets/{Tooltip-C_vqgUhw.js → Tooltip-XKGOcBmc.js} +1 -1
- package/dist/client/assets/{Trash01-C3vHEhEb.js → Trash01-BIlzZ3AH.js} +1 -1
- package/dist/client/assets/{Upload01-RcrRUOsi.js → Upload01-DuNH7edt.js} +1 -1
- package/dist/client/assets/{UserSquare-YXEd-AbI.js → UserSquare-BV7Jqoa-.js} +1 -1
- package/dist/client/assets/{Users01-CC5oUscX.js → Users01-Cy9FwTEl.js} +1 -1
- package/dist/client/assets/{XClose-UU_Qx1D3.js → XClose-DeJhJbxg.js} +1 -1
- package/dist/client/assets/{Zap-CO42SvK0.js → Zap-Bp1s63-N.js} +1 -1
- package/dist/client/assets/{access-gate-DSwIamvO.js → access-gate-BO57Fy6P.js} +1 -1
- package/dist/client/assets/{add-connection-dialog-B5G2C2cs.js → add-connection-dialog-BC7Osx_R.js} +1 -1
- package/dist/client/assets/agent-app-Cj_RWyLT.js +1 -0
- package/dist/client/assets/{agent-assets-BKVS3WSt.js → agent-assets-BUrt3dPh.js} +1 -1
- package/dist/client/assets/{agent-automation-Cl_Mzi6e.js → agent-automation-BNwHO-72.js} +1 -1
- package/dist/client/assets/{agent-automations-C7N7FlhQ.js → agent-automations-BAX6zuIx.js} +1 -1
- package/dist/client/assets/{agent-calendar-6WYiR_eD.js → agent-calendar-vVzb3Jt5.js} +1 -1
- package/dist/client/assets/{agent-capabilities-DLDLILDU.js → agent-capabilities-CpYu5jEI.js} +1 -1
- package/dist/client/assets/{agent-connect-sources-CSCpdzg5.js → agent-connect-sources-BuHIOYH8.js} +1 -1
- package/dist/client/assets/agent-deck-DPIGRh0M.js +1 -0
- package/dist/client/assets/{agent-e2e-D94KjHQG.js → agent-e2e-HxqodN3d.js} +1 -1
- package/dist/client/assets/agent-experiments-CCFPdPhX.js +1 -0
- package/dist/client/assets/{agent-file-BoQHNMP7.js → agent-file-9keGK7G7.js} +1 -1
- package/dist/client/assets/{agent-hosting-BNNjZNQs.js → agent-hosting-Ba3TD5BK.js} +1 -1
- package/dist/client/assets/{agent-icon-DYPj-9S0.js → agent-icon-DbfcsXV4.js} +1 -1
- package/dist/client/assets/agent-library-CziMMPAP.js +1 -0
- package/dist/client/assets/agent-library-file-Bl2JiaxW.js +1 -0
- package/dist/client/assets/agent-overview-CCjalTIF.js +1 -0
- package/dist/client/assets/{agent-releases-CFjOd9p0.js → agent-releases-DUbgEATu.js} +1 -1
- package/dist/client/assets/agent-settings-CLD9LbBl.js +1 -0
- package/dist/client/assets/agent-site-editor-code-CvwSMvs6.js +2 -0
- package/dist/client/assets/agent-site-editor-content-CyqRl7Mo.js +1 -0
- package/dist/client/assets/agent-site-editor-preview-BZ6vFBEq.js +1 -0
- package/dist/client/assets/{agent-site-editor-DS_SOZYh.js → agent-site-editor-uQzxcM8C.js} +1 -1
- package/dist/client/assets/agent-view-0jyw-9ou.js +1 -0
- package/dist/client/assets/{agent-view-guard-DQNO5wut.js → agent-view-guard-W_TpFLj2.js} +1 -1
- package/dist/client/assets/{ai-providers-CB35CJ-r.js → ai-providers-BHXvN3lN.js} +1 -1
- package/dist/client/assets/{alert-BfpOJ3QC.js → alert-DBbkuMuk.js} +1 -1
- package/dist/client/assets/{analytics-sections-DqSJTMHS.js → analytics-sections-B3bcjZGS.js} +1 -1
- package/dist/client/assets/api-keys-BDo54WOl.js +1 -0
- package/dist/client/assets/{api-keys-C9RfpFWT.js → api-keys-BxiY8kcp.js} +1 -1
- package/dist/client/assets/{app-editor-CHqAZ-8c.js → app-editor-r0R62IBH.js} +1 -1
- package/dist/client/assets/{asset-utils-BIz1znAk.js → asset-utils-MeaeLnLx.js} +1 -1
- package/dist/client/assets/{auth-catchall-pVvy0s4e.js → auth-catchall-BT8BEBDX.js} +1 -1
- package/dist/client/assets/{auth-CGSiE6Ch.js → auth-eHRARwQ2.js} +1 -1
- package/dist/client/assets/{auth-entry-TEqh-7ub.js → auth-entry-z3QPpDZU.js} +1 -1
- package/dist/client/assets/{auth-split-layout-R8Bk7IQM.js → auth-split-layout-DfToASYD.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-C3rmsbOR.js → authenticate-and-persist-oauth-CjW_HJT8.js} +1 -1
- package/dist/client/assets/{automation-list-row-_t0nrhFD.js → automation-list-row-DDqzJ6yN.js} +1 -1
- package/dist/client/assets/{automation-runs-Cmm8lebF.js → automation-runs-Ck7meZnh.js} +1 -1
- package/dist/client/assets/{automations-DByyLA6Z.js → automations-Bl1cCncB.js} +1 -1
- package/dist/client/assets/{autosend-ChY4eKzU.js → autosend-YTrROtL8.js} +1 -1
- package/dist/client/assets/{badge-DXTq7juk.js → badge-BLj5oaM_.js} +1 -1
- package/dist/client/assets/{block-document-Dg43t_cN.js → block-document-BISqnz_T.js} +1 -1
- package/dist/client/assets/{blocks-preview-workspace-context-CnFe6MxR.js → blocks-preview-workspace-context-BtXgnaQN.js} +1 -1
- package/dist/client/assets/{blocks-tab-states-7fd3YmUI.js → blocks-tab-states-Bf5o8VNw.js} +1 -1
- package/dist/client/assets/{blog-schema-DLE0PJtr.js → blog-schema-DD6KWf6e.js} +1 -1
- package/dist/client/assets/{buckets-DY1vce0F.js → buckets-BQqb0o4o.js} +1 -1
- package/dist/client/assets/{build-improve-prompt-doc-Df0z7skN.js → build-improve-prompt-doc-80nYNz4Z.js} +1 -1
- package/dist/client/assets/{calendar-BGDDe831.js → calendar-BI3ebszn.js} +1 -1
- package/dist/client/assets/{capability-load-error-CNpbDyX4.js → capability-load-error-D_eJcYHf.js} +1 -1
- package/dist/client/assets/{category-editor-R_XIhJ9S.js → category-editor-I5YxNQQ5.js} +1 -1
- package/dist/client/assets/{chart-vlFPDMF3.js → chart-BtV3lIyv.js} +1 -1
- package/dist/client/assets/{chat-context--sx_tT3a.js → chat-context-DrqBnMGV.js} +1 -1
- package/dist/client/assets/{chat-draft-BAtgCZ3L.js → chat-draft-DSgKm45E.js} +1 -1
- package/dist/client/assets/{checkbox-CZnP9NXa.js → checkbox-CfVXlX4u.js} +1 -1
- package/dist/client/assets/{choose-editor-DYxsXNSd.js → choose-editor-D3_bqd8J.js} +1 -1
- package/dist/client/assets/{cli-auth-success-BN8nYAwK.js → cli-auth-success-CCk5-b6l.js} +1 -1
- package/dist/client/assets/{client-icons-Dnxm_fsV.js → client-icons-DE5s9EhF.js} +1 -1
- package/dist/client/assets/{cms-settings-editor-BZsD4zo_.js → cms-settings-editor-DUGWgHGi.js} +1 -1
- package/dist/client/assets/{cms-store-drafts-usYzPqQo.js → cms-store-drafts-gAOezeiH.js} +1 -1
- package/dist/client/assets/{collapsible-CAWr0Uf-.js → collapsible-DCKPxsPs.js} +1 -1
- package/dist/client/assets/{collection-detail-DTMma4Re.js → collection-detail-99jcqq1O.js} +1 -1
- package/dist/client/assets/{collection-display-button-DPJAc88l.js → collection-display-button-DJquIZj0.js} +1 -1
- package/dist/client/assets/{collection-search-CXkzfc9r.js → collection-search-CcswFoQz.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-Bl8czn0p.js → collection-table-wrapper-u0Q_f-Jr.js} +1 -1
- package/dist/client/assets/{collection-tabs-mu__SPg6.js → collection-tabs-B6DksJOI.js} +1 -1
- package/dist/client/assets/{combobox-DU-BWR6s.js → combobox-f-1LbAQg.js} +1 -1
- package/dist/client/assets/{command-CSPHvNyT.js → command-B13rzls6.js} +1 -1
- package/dist/client/assets/{companion-mcps-section-DFcjkcx9.js → companion-mcps-section-Dhc8wIjl.js} +1 -1
- package/dist/client/assets/{config-NmGpqpBn.js → config-CODdLsbj.js} +1 -1
- package/dist/client/assets/{connect-layout-B6A4FqDB.js → connect-layout-CV6GZLu5.js} +1 -1
- package/dist/client/assets/{connect-C4yS4zXm.js → connect-nqV0IwGn.js} +1 -1
- package/dist/client/assets/{connect-source-dialog-BIqYqxRx.js → connect-source-dialog-CGrEF7EH.js} +1 -1
- package/dist/client/assets/{connection-DgHvsn_X.js → connection-CpcxYbw-.js} +1 -1
- package/dist/client/assets/{connection-card-CrrO3ejB.js → connection-card-DbTrHYwh.js} +1 -1
- package/dist/client/assets/{connection-detail-BMMfs5vK.js → connection-detail-BXwTjfTg.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-Dhos9NR1.js → connection-form-helpers-BFeW48f1.js} +1 -1
- package/dist/client/assets/{connection-slug-BY7_frFV.js → connection-slug-BlCRUE5Z.js} +1 -1
- package/dist/client/assets/{connections-hcM7xUnc.js → connections-C3cZP6N-.js} +1 -1
- package/dist/client/assets/{content-tab-CAhVvpMk.js → content-tab-BZA7n8sL.js} +3 -3
- package/dist/client/assets/{context-C7PxWYJ-.js → context-EiAaoy2D.js} +1 -1
- package/dist/client/assets/{context-menu-DipHTfvq.js → context-menu-CoBBaT-n.js} +1 -1
- package/dist/client/assets/{context-shell-B-eLBue7.js → context-shell-DYEfNRo8.js} +3 -3
- package/dist/client/assets/{core.esm-BcKT6bZa.js → core.esm-CZ_suStd.js} +1 -1
- package/dist/client/assets/{create-organization-dialog-DtUha4Y4.js → create-organization-dialog-CsKJ38nv.js} +1 -1
- package/dist/client/assets/{device-hint-BjjaBI1z.js → device-hint-DlZdZHNJ.js} +1 -1
- package/dist/client/assets/{discover-CQ7cMbu6.js → discover-V8VmtY63.js} +1 -1
- package/dist/client/assets/{domain-settings-DF0qdE25.js → domain-settings-CqMNMzW1.js} +1 -1
- package/dist/client/assets/{drawer-2P1ke0v5.js → drawer-Cgf4oN4m.js} +1 -1
- package/dist/client/assets/{editor-BXgkmrWx.js → editor-Bl3rIcVI.js} +1 -1
- package/dist/client/assets/{editor-classes-CntBx7_T.js → editor-classes-D2R7rw-c.js} +1 -1
- package/dist/client/assets/{empty-state-B1eFFEza.js → empty-state-D5-IJmKF.js} +1 -1
- package/dist/client/assets/{empty-state-CC-oozy8.js → empty-state-aXWI3-Mm.js} +1 -1
- package/dist/client/assets/{experiments-tab-choice-KOKZYAnv.js → experiments-tab-choice-CcWoxHNu.js} +1 -1
- package/dist/client/assets/{extract-connection-data-sd_xyzvc.js → extract-connection-data-D7JZIpe1.js} +1 -1
- package/dist/client/assets/{feature-gate-DcT_fryQ.js → feature-gate-BB1BinIq.js} +1 -1
- package/dist/client/assets/{feature-paywall-BCcQWh7w.js → feature-paywall-DadXALbq.js} +1 -1
- package/dist/client/assets/{file-explorer-B_yB3TRi.js → file-explorer-Dl028uja.js} +1 -1
- package/dist/client/assets/{file-preview-BTZhj6pd.js → file-preview-4Tbf_ub4.js} +1 -1
- package/dist/client/assets/{file-share-button-YeFjmtWG.js → file-share-button-DjQHOi0O.js} +1 -1
- package/dist/client/assets/{file-type-icon-DYMrEOTS.js → file-type-icon-Bdzds_J6.js} +1 -1
- package/dist/client/assets/{folder-icon-CvzICvU-.js → folder-icon-JFUPr6Oa.js} +1 -1
- package/dist/client/assets/{form-BFewkYbP.js → form-BYhtZm8M.js} +1 -1
- package/dist/client/assets/{general-B3PWCa84.js → general-DbKg9blt.js} +1 -1
- package/dist/client/assets/{github-icon-C2RYJxpH.js → github-icon-iZdKbq4s.js} +1 -1
- package/dist/client/assets/{home-DLwvjHsh.js → home-DVdXJNEh.js} +1 -1
- package/dist/client/assets/{home-overview-9Le8NPiW.js → home-overview-8NqH5SXV.js} +1 -1
- package/dist/client/assets/{hosted-reconcile-DBZyiSDy.js → hosted-reconcile-DBUQw0wz.js} +1 -1
- package/dist/client/assets/{icon-button-D5d00wVb.js → icon-button-Bkz9RDzV.js} +1 -1
- package/dist/client/assets/{index-DdpcXjHR.js → index-BV2_mRhH.js} +1 -1
- package/dist/client/assets/{index-h1XTCueR.js → index-BYLma6nR.js} +3 -3
- package/dist/client/assets/{index-B6WkvUi4.js → index-BiJyBzx-.js} +1 -1
- package/dist/client/assets/{index-xLbT0TA8.js → index-CBKPLOSd.js} +1 -1
- package/dist/client/assets/{index-B6nB1oBs.js → index-CorYIdad.js} +1 -1
- package/dist/client/assets/{index-vfReuDCU.js → index-CyB8FMpF.js} +1 -1
- package/dist/client/assets/{index-CP9rTnyG.js → index-D2JCiu4r.js} +1 -1
- package/dist/client/assets/{index-B2c7ptSv.js → index-DENYSVWJ.js} +1 -1
- package/dist/client/assets/{index-BXjAEYmT.js → index-DNAVFVoL.js} +1 -1
- package/dist/client/assets/{index-CCbQRrnr.js → index-DV7H7fST.js} +1 -1
- package/dist/client/assets/{index-6fq9tzTG.js → index-DVzGX6Yk.js} +1 -1
- package/dist/client/assets/{index-Bhb7tUT1.js → index-DXd61UF-.js} +1 -1
- package/dist/client/assets/{index-BhagIWfP.js → index-DatF-lrE.js} +1 -1
- package/dist/client/assets/{index-1J_VjTgY.js → index-I6t84B1M.js} +1 -1
- package/dist/client/assets/{index-DAS_1BE2.js → index-cvR6uZtJ.js} +1 -1
- package/dist/client/assets/{index-BdqM0lZt.js → index-jDgMG-M0.js} +1 -1
- package/dist/client/assets/{index-redirect-BKtHHV2b.js → index-redirect-2Xzyc9Yp.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-CHwNipYb.js → infiniteQueryObserver-deqizdYY.js} +1 -1
- package/dist/client/assets/{infra-billing-kjaxJDtG.js → infra-billing-tyxMYA7K.js} +1 -1
- package/dist/client/assets/{input-DV98ow22.js → input-CZkeDxU4.js} +1 -1
- package/dist/client/assets/{input-C_dtPix5.js → input-ZtRkRndM.js} +3 -3
- package/dist/client/assets/{integration-icon-BX--0-gC.js → integration-icon-CknO8J8O.js} +1 -1
- package/dist/client/assets/{jira-icon-ChmudZ3X.js → jira-icon-MwO2xsZ2.js} +1 -1
- package/dist/client/assets/{label-7Sx3Bd-m.js → label-CjHEjKyC.js} +1 -1
- package/dist/client/assets/{layout-D0p7Bi_M.js → layout-BPQjilkO.js} +1 -1
- package/dist/client/assets/{legacy-admin-welcome-dialog-DP-92Dz3.js → legacy-admin-welcome-dialog-CCJK6F5I.js} +1 -1
- package/dist/client/assets/{legacy-agents-deep-BUFBVFZA.js → legacy-agents-deep-CJaEmbG0.js} +1 -1
- package/dist/client/assets/{legacy-main-redirect-BOVE_v_s.js → legacy-main-redirect-vnkqH-1j.js} +1 -1
- package/dist/client/assets/library-L-o62vZM.js +1 -0
- package/dist/client/assets/{library-tab-BVLYgEIj.js → library-tab-CdWEZxRI.js} +1 -1
- package/dist/client/assets/{login-DmfKqvWA.js → login-DS_iw6N1.js} +1 -1
- package/dist/client/assets/{markdown-C5fMrlG3.js → markdown-Da1uCT0e.js} +1 -1
- package/dist/client/assets/{mcp-app-renderer-BHQzXoMa.js → mcp-app-renderer-mf0rf7E1.js} +1 -1
- package/dist/client/assets/{mcp-oauth-DdsjIog0.js → mcp-oauth-CaiLBqRy.js} +1 -1
- package/dist/client/assets/{mcp-oauth-BPKVuGj7.js → mcp-oauth-HzcRe8g5.js} +1 -1
- package/dist/client/assets/{members-BUgt2v5k.js → members-CMznzVfQ.js} +1 -1
- package/dist/client/assets/{memory-CpIy9WxU.js → memory-DBtEhQbQ.js} +1 -1
- package/dist/client/assets/{mock-board-C8Scb14T.js → mock-board-WAMSCCQz.js} +3 -3
- package/dist/client/assets/{monaco-editor-Dn3JUtr6.js → monaco-editor-DOm9wfYQ.js} +1 -1
- package/dist/client/assets/{monitoring-CSmLuvXL.js → monitoring-DLU9E9jL.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-DnbBc-SM.js → monitoring-stats-row-BZhbxHPL.js} +1 -1
- package/dist/client/assets/{multi-select-D6qN_k_Q.js → multi-select-DrnuD1mN.js} +1 -1
- package/dist/client/assets/{mustache-BGmZfDW9.js → mustache-BrMR8WIh.js} +1 -1
- package/dist/client/assets/{named-rule-view-TVPYWAXx.js → named-rule-view-DFynUe1k.js} +1 -1
- package/dist/client/assets/{new-project-dialog-BU-wxed9.js → new-project-dialog-EugQEueI.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-DOqtXeQE.js → oauth-callback-ai-provider--_rbTYAf.js} +1 -1
- package/dist/client/assets/{oauth-callback-CanlAXdb.js → oauth-callback-qT5-0tMU.js} +1 -1
- package/dist/client/assets/{oauth-consent-NZZACOUo.js → oauth-consent-cQG5I8Ec.js} +1 -1
- package/dist/client/assets/{onboarding-rYSWsG3S.js → onboarding-C7OJySzu.js} +1 -1
- package/dist/client/assets/{openai-conversation-B6DkopEN.js → openai-conversation-Cm9EexiP.js} +1 -1
- package/dist/client/assets/{optimistic-project-sidebar-views-CSzTTT3t.js → optimistic-project-sidebar-views-DQEq-a-n.js} +1 -1
- package/dist/client/assets/{order-monitor-day-BgrYiKjT.js → order-monitor-day-Baz0Q4B-.js} +1 -1
- package/dist/client/assets/{organization-choice-BlHBHiMN.js → organization-choice-BvHaYYrY.js} +1 -1
- package/dist/client/assets/{orgs-BE7PoniG.js → orgs-CO5qg_zx.js} +1 -1
- package/dist/client/assets/{own-accounts-section-gUye1hC4.js → own-accounts-section-sv1QSuWm.js} +1 -1
- package/dist/client/assets/{pair-DclsAW7v.js → pair-BV2vQ0xm.js} +1 -1
- package/dist/client/assets/{parse-sections-ki2R7CT5.js → parse-sections-4T2NkKUg.js} +3 -3
- package/dist/client/assets/{plan--Ofz0lEx.js → plan-CurU7CCP.js} +1 -1
- package/dist/client/assets/{plan-ladder-7wWPqUAB.js → plan-ladder-Bu3Ap_FZ.js} +1 -1
- package/dist/client/assets/{plan-usage-card-CFXb8pkH.js → plan-usage-card-BoXPSn1R.js} +1 -1
- package/dist/client/assets/{popover-CseyhIeF.js → popover-N7uvMIxz.js} +1 -1
- package/dist/client/assets/{post-calendar-CVMGU40q.js → post-calendar-dGcUdPXO.js} +1 -1
- package/dist/client/assets/{post-editor-br_fwHLt.js → post-editor-C7cux0l4.js} +1 -1
- package/dist/client/assets/{preview-content-Bt1TcNSG.js → preview-content-CT2MLe31.js} +1 -1
- package/dist/client/assets/{preview-dialog-QuWbcizM.js → preview-dialog-j29O32-o.js} +1 -1
- package/dist/client/assets/{preview-panel-BHVWqnx5.js → preview-panel-DrbFpZBA.js} +1 -1
- package/dist/client/assets/{preview-tab-tyxCKhqI.js → preview-tab-DXgIeou6.js} +3 -3
- package/dist/client/assets/{product-picker-dialog-2HDu0aVm.js → product-picker-dialog-DQbb069K.js} +1 -1
- package/dist/client/assets/{profile-CyNnrVrl.js → profile-B1D5-rlo.js} +1 -1
- package/dist/client/assets/{project-app-view-unEGL71X.js → project-app-view-J0Hex_YV.js} +1 -1
- package/dist/client/assets/{project-apps-BWReKPEd.js → project-apps-CmXREDt2.js} +1 -1
- package/dist/client/assets/{project-icon-DH181ON5.js → project-icon-BFruPc7B.js} +1 -1
- package/dist/client/assets/{project-index-DJdMbgvn.js → project-index-BZNO31D8.js} +1 -1
- package/dist/client/assets/project-reports-C2YJUhOx.js +1 -0
- package/dist/client/assets/project-tasks-RuOnvKJR.js +1 -0
- package/dist/client/assets/{projects-empty-state-DFMppW3W.js → projects-empty-state-MtIbG9US.js} +1 -1
- package/dist/client/assets/{projects-31i0PwsS.js → projects-iB2V9afU.js} +1 -1
- package/dist/client/assets/{prompts-Ba_ATRu9.js → prompts-BG_4qmzz.js} +1 -1
- package/dist/client/assets/{record-editor-0Tx1_v8I.js → record-editor-8mMyqAq_.js} +1 -1
- package/dist/client/assets/{redirect-editor-BfchOu4t.js → redirect-editor-DODrcHmb.js} +1 -1
- package/dist/client/assets/reports-CpJEGryk.js +1 -0
- package/dist/client/assets/{reports-onboarding-CgJu__YK.js → reports-onboarding-0hyPuCKx.js} +1 -1
- package/dist/client/assets/{reports-tab-b2RlpEFn.js → reports-tab-Bz7eFHcA.js} +2 -2
- package/dist/client/assets/{reports-BE_n3WJk.js → reports-u6Dfo5ym.js} +1 -1
- package/dist/client/assets/repositories-C4iLn-xt.js +1 -0
- package/dist/client/assets/{repositories-tpe2RwmP.js → repositories-CFziQK7w.js} +1 -1
- package/dist/client/assets/{repository-binding-DOWKMbHI.js → repository-binding-BkD30urH.js} +1 -1
- package/dist/client/assets/{repository-picker-TR2KC739.js → repository-picker-CfUR1P6V.js} +1 -1
- package/dist/client/assets/{require-capability-BzHftBt7.js → require-capability-B1_EID-G.js} +1 -1
- package/dist/client/assets/{required-auth-layout-DIKOlnAp.js → required-auth-layout-DFKnKCtp.js} +1 -1
- package/dist/client/assets/{reset-password-Wb7HvzNe.js → reset-password-DjNcJ5K0.js} +1 -1
- package/dist/client/assets/{resizable-DAgqrae3.js → resizable-CSObW6nE.js} +1 -1
- package/dist/client/assets/{resolve-tab-icon-BjuG9u8a.js → resolve-tab-icon-j_0ryOQr.js} +1 -1
- package/dist/client/assets/{review-settings-BOPY1Icl.js → review-settings-WwIoSq9p.js} +1 -1
- package/dist/client/assets/{role-color-HJokgczM.js → role-color-beneWoQ9.js} +1 -1
- package/dist/client/assets/{roles-DAHXDDc8.js → roles-DmQOwh5E.js} +1 -1
- package/dist/client/assets/route-BEz3Pav8.js +1 -0
- package/dist/client/assets/{route-fmNu9Y2e.js → route-Bd0M38TP.js} +1 -1
- package/dist/client/assets/{route-Bo8TfZ0r.js → route-Dnfk_OL6.js} +1 -1
- package/dist/client/assets/{sandbox-lifecycle-context-B6qzzFbP.js → sandbox-lifecycle-context-B7r5ICXq.js} +1 -1
- package/dist/client/assets/{schema-Cr_W3Ejo.js → schema-hGrr4U87.js} +1 -1
- package/dist/client/assets/{schema-D2LQQw_P.js → schema-x3j4FByb.js} +1 -1
- package/dist/client/assets/{scroll-area-C6_sUrpC.js → scroll-area-BUQV_LXH.js} +1 -1
- package/dist/client/assets/{search-input-CkfYzX_4.js → search-input-CuXTJoya.js} +1 -1
- package/dist/client/assets/{search-toggle-SyoEzk7o.js → search-toggle-Dozi3jn4.js} +1 -1
- package/dist/client/assets/{secret-picker-6gfx0PIf.js → secret-picker-BjW_LSzb.js} +1 -1
- package/dist/client/assets/{secrets-CYXbderS.js → secrets-D3c82efw.js} +1 -1
- package/dist/client/assets/{section-array-field-DzN0sOy6.js → section-array-field-DdQmkBVv.js} +1 -1
- package/dist/client/assets/{sections-Cet2GaYS.js → sections-BugzxN3d.js} +1 -1
- package/dist/client/assets/{sections-editor-Cyc1q4ur.js → sections-editor-vn3XqGqZ.js} +1 -1
- package/dist/client/assets/{select-CaCnnAps.js → select-D61WZk1O.js} +1 -1
- package/dist/client/assets/{select-model-B236ukdj.js → select-model-B9-VeM83.js} +1 -1
- package/dist/client/assets/{seo-editor-2r__edg_.js → seo-editor-CHKnAUms.js} +1 -1
- package/dist/client/assets/{separator-Cq1oEAV9.js → separator-BVRCWUXh.js} +1 -1
- package/dist/client/assets/settings-tab-W8DgvzPC.js +1 -0
- package/dist/client/assets/{sheet-CgfMkJkk.js → sheet-DIBHWB2f.js} +1 -1
- package/dist/client/assets/{shell-layout-CkS9YSvj.js → shell-layout-B0sxwrmk.js} +1 -1
- package/dist/client/assets/{site-draft-actions-D7OJNSVO.js → site-draft-actions-CIqEMxV-.js} +1 -1
- package/dist/client/assets/{site-draft-view-CpE6eqx7.js → site-draft-view-CRnAEeje.js} +1 -1
- package/dist/client/assets/site-editor-DNhcEXBI.js +1 -0
- package/dist/client/assets/{site-editor-toast-B1r9KPgS.js → site-editor-toast-GFZxIyjf.js} +1 -1
- package/dist/client/assets/{skills-vzYrLk2q.js → skills-DSWQxTlW.js} +1 -1
- package/dist/client/assets/{slider-BUo3LEh2.js → slider-DRwKc5id.js} +1 -1
- package/dist/client/assets/{sortable.esm-DZUKX3g6.js → sortable.esm-D0_nmGGR.js} +1 -1
- package/dist/client/assets/{sso-Da3BBFEk.js → sso-CzNpdX7R.js} +1 -1
- package/dist/client/assets/{suggestion-CbiVJhLZ.js → suggestion-R4Fq_9Vs.js} +1 -1
- package/dist/client/assets/{super-agent-icon-B9hbG__1.js → super-agent-icon-CqYKR78y.js} +1 -1
- package/dist/client/assets/{switch-CSQfbdA0.js → switch-DqhVUDGb.js} +1 -1
- package/dist/client/assets/{synced-repos-ClWHK5mH.js → synced-repos-bxt0QNXE.js} +1 -1
- package/dist/client/assets/{tab-icon-glyph-DGdRBBFj.js → tab-icon-glyph-isGtQ89b.js} +1 -1
- package/dist/client/assets/{table-Do5Q-ybe.js → table-BjC5y-mI.js} +1 -1
- package/dist/client/assets/{tabs-UY_qfXkT.js → tabs-D47HrxyT.js} +1 -1
- package/dist/client/assets/{task-board-DfdsuuL-.js → task-board-CpInFlas.js} +1 -1
- package/dist/client/assets/{task-route-DLXhcxnL.js → task-route-BlJmoQnB.js} +1 -1
- package/dist/client/assets/{task-status-ORmQL9VH.js → task-status-CtyIOSPd.js} +1 -1
- package/dist/client/assets/{taskboard-analytics-D5YETO-h.js → taskboard-analytics-lEMFRF2F.js} +1 -1
- package/dist/client/assets/tasks-CKan_WUB.js +1 -0
- package/dist/client/assets/{tasks-ZUsku0Sn.js → tasks-iEvVDxme.js} +1 -1
- package/dist/client/assets/{textarea-Bhlc1rhY.js → textarea-CjxhqOyq.js} +1 -1
- package/dist/client/assets/{thread-analytics-CUOQjb-2.js → thread-analytics-Bh5IuMZi.js} +1 -1
- package/dist/client/assets/{thread-intent-D_k-pawu.js → thread-intent-D7K3VC0B.js} +1 -1
- package/dist/client/assets/{thread-route-B8Y5c0rh.js → thread-route-CsxQz3Zx.js} +1 -1
- package/dist/client/assets/{thread-route-BP_rLVAA.js → thread-route-D6poUO7_.js} +1 -1
- package/dist/client/assets/{thread-sheet-body-DDIzp5Vi.js → thread-sheet-body-DYxNtyxr.js} +1 -1
- package/dist/client/assets/{time-range-picker-524ULj1s.js → time-range-picker-CikQym1Z.js} +1 -1
- package/dist/client/assets/{toggle-group-ViM2aXo0.js → toggle-group-CouAljQq.js} +1 -1
- package/dist/client/assets/{tool-namespace-CZhD1QHX.js → tool-namespace-COJtiQ4T.js} +1 -1
- package/dist/client/assets/{tool-set-selector-DDCkNBEl.js → tool-set-selector-D0VA8wi_.js} +1 -1
- package/dist/client/assets/{toolbar-icon-button-BNq-FZTg.js → toolbar-icon-button-BuwmFHmx.js} +1 -1
- package/dist/client/assets/{tooltip-CKmg0cr7.js → tooltip-Bw3qe--M.js} +1 -1
- package/dist/client/assets/{tooltipContext-DJ-bu_AF.js → tooltipContext-6k_VEZRX.js} +1 -1
- package/dist/client/assets/{track-UTndtUbf.js → track-BwadfAZS.js} +1 -1
- package/dist/client/assets/{types-BNoZpJhV.js → types-CbWt7gMo.js} +1 -1
- package/dist/client/assets/{url-slug-DXHd23Qm.js → url-slug-_FVYRYFw.js} +1 -1
- package/dist/client/assets/{usage-stats-Bd_jKdgA.js → usage-stats-DQ3lpFK8.js} +1 -1
- package/dist/client/assets/{use-ai-providers-Dy2qKq-c.js → use-ai-providers-BZwoM77S.js} +1 -1
- package/dist/client/assets/{use-apply-named-rule-D5eT3JPq.js → use-apply-named-rule-DBwwofns.js} +1 -1
- package/dist/client/assets/use-ask-in-chat-DaKY6vDh.js +1 -0
- package/dist/client/assets/{use-automations-D6wZw1e0.js → use-automations-9JK3KVgm.js} +1 -1
- package/dist/client/assets/{use-autosave-Ch2NSpoO.js → use-autosave-CSUjUglY.js} +1 -1
- package/dist/client/assets/use-blocks-v8-project-BM6s65-m.js +1 -0
- package/dist/client/assets/{use-chat-layout-state--45rT-ve.js → use-chat-layout-state-COqGCuVV.js} +1 -1
- package/dist/client/assets/{use-cms-publish-actions-BoOF_-HD.js → use-cms-publish-actions-BwV4F0O9.js} +1 -1
- package/dist/client/assets/{use-connect-companion-CwwZpYTZ.js → use-connect-companion-BhuBsXQo.js} +1 -1
- package/dist/client/assets/{use-connection-CL03pbmH.js → use-connection-D5sijlzo.js} +1 -1
- package/dist/client/assets/{use-content-sync-BqMl-SDk.js → use-content-sync-sIXdICgs.js} +1 -1
- package/dist/client/assets/{use-copy-BH9CGszX.js → use-copy-D-EOd5RI.js} +1 -1
- package/dist/client/assets/{use-date-fns-locale-Ce7nv8OR.js → use-date-fns-locale-DXTlo7HL.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-B_WhYc20.js → use-debounced-autosave-Ah58n7xN.js} +1 -1
- package/dist/client/assets/{use-debounced-value-CvXfSmyn.js → use-debounced-value-8OKqfUuy.js} +1 -1
- package/dist/client/assets/{use-deco-credits-DWjWti03.js → use-deco-credits-DV2KUq3D.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-CDPhmAAN.js → use-decopilot-events-CuinN1iK.js} +1 -1
- package/dist/client/assets/{use-delete-connection-rLQ-bKYo.js → use-delete-connection-B-VzkPwb.js} +1 -1
- package/dist/client/assets/{use-deployment-admin-DXfttv5t.js → use-deployment-admin-CE6RFF-x.js} +1 -1
- package/dist/client/assets/{use-entitlements-BUjouq1Y.js → use-entitlements-BsP1ZFGQ.js} +1 -1
- package/dist/client/assets/{use-fast-preview-draft-url-Cnn72cB6.js → use-fast-preview-draft-url-BfYOm91V.js} +1 -1
- package/dist/client/assets/{use-file-configs-B9qMFEGr.js → use-file-configs-BTHP9YUm.js} +1 -1
- package/dist/client/assets/{use-id-selection-Ddv_u3et.js → use-id-selection-CzcA3Fgb.js} +1 -1
- package/dist/client/assets/{use-inbox-feed-DW13LJyg.js → use-inbox-feed-Bh-qnCwx.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-CxakbxgS.js → use-infinite-scroll-xgBjudJA.js} +1 -1
- package/dist/client/assets/{use-join-requests-DmzhnEci.js → use-join-requests-VyWhRMSX.js} +1 -1
- package/dist/client/assets/{use-main-panel-tabs-CBKdXvqC.js → use-main-panel-tabs-DGfwa0le.js} +1 -1
- package/dist/client/assets/{use-mcp-auth-status-D545uZng.js → use-mcp-auth-status-CCwaj4pF.js} +1 -1
- package/dist/client/assets/{use-mcp-client-CU2L24s0.js → use-mcp-client-Ch_pgKFL.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-DpK2reps.js → use-mcp-prompts-M3rH9N-2.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-DosfGQ8x.js → use-mcp-tools-BAO0S55a.js} +1 -1
- package/dist/client/assets/{use-mobile-8jTJxNX-.js → use-mobile-ye6iRWDK.js} +1 -1
- package/dist/client/assets/{use-move-blocks-DxdFuQ_c.js → use-move-blocks-Gvsecy1g.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-B0fVaV8h.js → use-navigate-to-agent-jetKe7lC.js} +1 -1
- package/dist/client/assets/{use-org-fs-BtQY-xQ8.js → use-org-fs-DKzRfuIW.js} +1 -1
- package/dist/client/assets/{use-org-repo-syncs-BxYtN8jM.js → use-org-repo-syncs-Cj0yTqTx.js} +1 -1
- package/dist/client/assets/{use-org-sso-BDjJrxCz.js → use-org-sso-BxORdMDV.js} +1 -1
- package/dist/client/assets/{use-organization-settings-C32cjrXo.js → use-organization-settings-BQAdDt_y.js} +1 -1
- package/dist/client/assets/{use-project-native-view-presence-WoHGC8IW.js → use-project-native-view-presence-CMhFGTuR.js} +1 -1
- package/dist/client/assets/{use-project-scope-CzvPVO9m.js → use-project-scope-CT4H1KgC.js} +1 -1
- package/dist/client/assets/{use-recent-apps-C70YR4qH.js → use-recent-apps-CbbMz9JX.js} +1 -1
- package/dist/client/assets/{use-reports-diagnostic-Bf3vjylM.js → use-reports-diagnostic-DrVbktZZ.js} +1 -1
- package/dist/client/assets/{use-sandbox-events-7-fLrTMJ.js → use-sandbox-events-DEsMUhZf.js} +1 -1
- package/dist/client/assets/{use-secrets-BlJhGBSI.js → use-secrets-BS4OhqRX.js} +1 -1
- package/dist/client/assets/{use-section-preview-base-BIuAmj_g.js → use-section-preview-base-DRm79v_2.js} +1 -1
- package/dist/client/assets/{use-sidebar-collapsed-DZVmbSWr.js → use-sidebar-collapsed-BJ9DvrgE.js} +1 -1
- package/dist/client/assets/{use-tags-Cnuk2dlj.js → use-tags-CWUQFfwf.js} +1 -1
- package/dist/client/assets/{use-task-board-analytics-DwYWlRcM.js → use-task-board-analytics-DRF7V1gC.js} +1 -1
- package/dist/client/assets/{use-task-board-events-BHvdCTkN.js → use-task-board-events-D_nE-0RI.js} +1 -1
- package/dist/client/assets/{use-task-board-item-prs-CxV10EKA.js → use-task-board-item-prs-CMNSM7NS.js} +1 -1
- package/dist/client/assets/{use-task-board-items-Cgj8_BfM.js → use-task-board-items-BhqAiSTX.js} +1 -1
- package/dist/client/assets/{use-task-board-prompts-BSuuBCmb.js → use-task-board-prompts-r37U5HHf.js} +1 -1
- package/dist/client/assets/{use-task-metadata-Djv9mzpW.js → use-task-metadata-CpdEm_Eq.js} +1 -1
- package/dist/client/assets/{use-thread-outputs-B82qJYY6.js → use-thread-outputs-BCCXEsgi.js} +1 -1
- package/dist/client/assets/{use-voice-input-DNj7vd9z.js → use-voice-input-CaKlieI0.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-DmLlHKe0.js +1 -0
- package/dist/client/assets/{useQueries-DFXnDWAo.js → useQueries-DWMnudrU.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-B6k_dV9w.js +1 -0
- package/dist/client/assets/{users-BT3VCaoh.js → users-Ct8iD2nc.js} +1 -1
- package/dist/client/assets/{utils-CaKh8ISH.js → utils-B4FS_bBy.js} +1 -1
- package/dist/client/assets/{variant-calendar-DQM6WWEC.js → variant-calendar-By_yM7B4.js} +1 -1
- package/dist/client/assets/{variant-matcher-override-DJmy2Bwl.js → variant-matcher-override-DQF4FE1V.js} +1 -1
- package/dist/client/assets/{view-header-Da0TRSut.js → view-header-Cv_9dvGb.js} +1 -1
- package/dist/client/assets/{virtual-mcp-BLhbBj3g.js → virtual-mcp-DzM6ah-n.js} +1 -1
- package/dist/client/assets/{watch-sse-pool-lW9b9_hM.js → watch-sse-pool-DPXy7vY-.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/server.js +2 -2
- package/package.json +1 -1
- package/dist/client/assets/agent-app-tZ7osM--.js +0 -1
- package/dist/client/assets/agent-deck-VahyZcsX.js +0 -1
- package/dist/client/assets/agent-experiments-BSEXxjSj.js +0 -1
- package/dist/client/assets/agent-library-CGg_KWMi.js +0 -1
- package/dist/client/assets/agent-library-file-lYvplSEG.js +0 -1
- package/dist/client/assets/agent-overview-BSloChkB.js +0 -1
- package/dist/client/assets/agent-settings-BcalFi59.js +0 -1
- package/dist/client/assets/agent-site-editor-code-DASkKQTm.js +0 -2
- package/dist/client/assets/agent-site-editor-content-BT3P7Fgk.js +0 -1
- package/dist/client/assets/agent-site-editor-preview-DPHEzCVq.js +0 -1
- package/dist/client/assets/agent-view-BHSLybsi.js +0 -1
- package/dist/client/assets/api-keys-1ftOr4jE.js +0 -1
- package/dist/client/assets/library-J7TYx4da.js +0 -1
- package/dist/client/assets/project-reports-5RjNN5dh.js +0 -1
- package/dist/client/assets/project-tasks-u14l25cn.js +0 -1
- package/dist/client/assets/reports-C-nEVqyN.js +0 -1
- package/dist/client/assets/repositories-Cr4YJltZ.js +0 -1
- package/dist/client/assets/route-CYWUUsoK.js +0 -1
- package/dist/client/assets/settings-tab-BFgPTT8v.js +0 -1
- package/dist/client/assets/site-editor-BliSF1HI.js +0 -1
- package/dist/client/assets/tasks-DUX6R8fb.js +0 -1
- package/dist/client/assets/use-ask-in-chat-Ds_a2eir.js +0 -1
- package/dist/client/assets/use-blocks-v8-project-B7yRGBZv.js +0 -1
- package/dist/client/assets/useInfiniteQuery-8WTGmXox.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-B5sH0yes.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as u,r as g,j as n,J as G,a0 as F,a as E,l as O,b as P,n as y,L as H}from"./index-BYLma6nR.js";import{C as M}from"./chat-context-DrqBnMGV.js";import{C as x}from"./index-jDgMG-M0.js";import{L}from"./index-DVzGX6Yk.js";import{B as V}from"./blocks-preview-workspace-context-BtXgnaQN.js";import{e as T,p as J,s as K,a as W,r as U,T as $,u as R,b as z}from"./site-editor-toast-GFZxIyjf.js";import{u as q,L as B,P as Q,S as X}from"./preview-tab-DXgIeou6.js";import{C as Y}from"./content-tab-BZA7n8sL.js";import{T as Z}from"./tab-icon-glyph-isGtQ89b.js";import{r as tt}from"./resolve-tab-icon-j_0ryOQr.js";import et from"./agent-site-editor-uQzxcM8C.js";import"./autosend-YTrROtL8.js";import"./thread-route-CsxQz3Zx.js";import"./use-project-scope-CT4H1KgC.js";import"./repository-binding-BkD30urH.js";import"./use-mcp-client-Ch_pgKFL.js";import"./auth-eHRARwQ2.js";import"./thread-intent-D7K3VC0B.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./watch-sse-pool-DPXy7vY-.js";import"./task-board-CpInFlas.js";import"./schema-x3j4FByb.js";import"./use-entitlements-BsP1ZFGQ.js";import"./use-ai-providers-BZwoM77S.js";import"./use-decopilot-events-CuinN1iK.js";import"./use-organization-settings-BQAdDt_y.js";import"./use-mobile-ye6iRWDK.js";import"./use-sidebar-collapsed-BJ9DvrgE.js";import"./use-chat-layout-state-COqGCuVV.js";import"./agent-icon-DbfcsXV4.js";import"./AlertCircle-Dhxv_VvX.js";import"./Tool01-Bw_Gs9HT.js";import"./ArrowUp-C5MIVxlv.js";import"./ArrowLeft-DPiUStmH.js";import"./LinkBroken01-CExBuGlw.js";import"./ShoppingBag01-CpRghVvA.js";import"./Globe04-BgmGeS07.js";import"./CheckCircle-DQiPh0bs.js";import"./ChevronUp-BusAGBPt.js";import"./ChevronSelectorVertical-C_LOUUD2.js";import"./UserSquare-BV7Jqoa-.js";import"./CreditCard01-B86ybMWX.js";import"./SwitchHorizontal01-DIK7cKae.js";import"./Key01-bRc0D6iU.js";import"./Minus-BuxaQmfP.js";import"./Monitor01-CWmH5Gyz.js";import"./Sun-fB3zW2OU.js";import"./Play-xrfH4Yz5.js";import"./Plus-BRIZEm-m.js";import"./SearchMd-CHeeKxSQ.js";import"./Trash01-BIlzZ3AH.js";import"./Upload01-DuNH7edt.js";import"./Users01-Cy9FwTEl.js";import"./XClose-DeJhJbxg.js";import"./Zap-Bp1s63-N.js";import"./tooltip-Bw3qe--M.js";import"./index-CorYIdad.js";import"./toolbar-icon-button-BuwmFHmx.js";import"./shell-layout-B0sxwrmk.js";import"./use-deployment-admin-CE6RFF-x.js";import"./admin-fetch-BhTJlAsX.js";import"./command-B13rzls6.js";import"./index-D2JCiu4r.js";import"./integration-icon-CknO8J8O.js";import"./project-icon-BFruPc7B.js";import"./use-navigate-to-agent-jetKe7lC.js";import"./use-debounced-value-8OKqfUuy.js";import"./new-project-dialog-EugQEueI.js";import"./label-CjHEjKyC.js";import"./repository-picker-CfUR1P6V.js";import"./github-icon-iZdKbq4s.js";import"./useInfiniteQuery-DmLlHKe0.js";import"./infiniteQueryObserver-deqizdYY.js";import"./collection-search-CcswFoQz.js";import"./legacy-admin-welcome-dialog-CCJK6F5I.js";import"./drawer-Cgf4oN4m.js";import"./required-auth-layout-DFKnKCtp.js";import"./use-org-sso-BxORdMDV.js";import"./sheet-DIBHWB2f.js";import"./resizable-CSObW6nE.js";import"./core.esm-CZ_suStd.js";import"./sortable.esm-D0_nmGGR.js";import"./context-menu-CoBBaT-n.js";import"./create-organization-dialog-CsKJ38nv.js";import"./form-BYhtZm8M.js";import"./project-apps-CmXREDt2.js";import"./use-recent-apps-CbbMz9JX.js";import"./feedback-BqoIMOg7.js";import"./textarea-CjxhqOyq.js";import"./sandbox-url-D3mC8qhT.js";import"./use-sandbox-events-DEsMUhZf.js";import"./use-blocks-v8-project-BM6s65-m.js";import"./use-voice-input-CaKlieI0.js";import"./popover-N7uvMIxz.js";import"./index-cvR6uZtJ.js";import"./checkbox-CfVXlX4u.js";import"./select-D61WZk1O.js";import"./index-BdQq_4o_.js";import"./ai-providers-logos-DD3qZ33J.js";import"./openai-compatible-presets-BKGfVqEx.js";import"./utils-B4FS_bBy.js";import"./sandbox-git-api-DcqI6XE4.js";import"./parse-sections-4T2NkKUg.js";import"./sandbox-start-errors-BK_aDCyt.js";import"./pair-BV2vQ0xm.js";import"./collapsible-DCKPxsPs.js";import"./use-copy-D-EOd5RI.js";import"./usage-stats-DQ3lpFK8.js";import"./tool-namespace-COJtiQ4T.js";import"./utils-CVEq3hMx.js";import"./markdown-Da1uCT0e.js";import"./content-blocks-o63cs2vh.js";import"./mcp-app-renderer-mf0rf7E1.js";import"./types-CbWt7gMo.js";import"./omit-server-managed-metadata-L5IhjRZB.js";import"./use-connection-D5sijlzo.js";import"./use-mcp-prompts-M3rH9N-2.js";import"./use-thread-outputs-BCCXEsgi.js";import"./file-type-icon-Bdzds_J6.js";import"./section-array-field-DdQmkBVv.js";import"./blocks-tab-states-Bf5o8VNw.js";import"./empty-state-D5-IJmKF.js";import"./hosted-reconcile-DBUQw0wz.js";import"./slider-DRwKc5id.js";import"./index-BiJyBzx-.js";import"./tooltipContext-6k_VEZRX.js";import"./CategoricalChart-C7-Bo6NS.js";import"./index-DNAVFVoL.js";import"./switch-DqhVUDGb.js";import"./scroll-area-BUQV_LXH.js";import"./monaco-editor-DOm9wfYQ.js";import"./editor-Bl3rIcVI.js";import"./calendar-BI3ebszn.js";import"./editor-classes-D2R7rw-c.js";import"./toggle-group-CouAljQq.js";import"./active-indicator-CCMhAsc_.js";import"./combobox-f-1LbAQg.js";import"./search-input-CuXTJoya.js";import"./tabs-D47HrxyT.js";import"./use-file-configs-BTHP9YUm.js";import"./asset-utils-MeaeLnLx.js";import"./match-site-slug-config-D3fUJ6vX.js";import"./sandbox-lifecycle-context-B7r5ICXq.js";import"./variant-matcher-override-DQF4FE1V.js";import"./use-fast-preview-draft-url-BfYOm91V.js";import"./useQueries-DWMnudrU.js";import"./device-hint-DlZdZHNJ.js";import"./alert-DBbkuMuk.js";import"./virtual-mcp-DzM6ah-n.js";import"./url-slug-_FVYRYFw.js";import"./app-preview-url-9Od4s8Sz.js";import"./agent-capabilities-CpYu5jEI.js";import"./preview-source-BsRLGWUP.js";import"./use-task-metadata-CpdEm_Eq.js";import"./view-header-Cv_9dvGb.js";import"./use-cms-publish-actions-BwV4F0O9.js";import"./use-content-sync-sIXdICgs.js";import"./mustache-BrMR8WIh.js";import"./date-utils-CrvIKg-s.js";import"./use-move-blocks-Gvsecy1g.js";import"./badge-BLj5oaM_.js";import"./empty-state-aXWI3-Mm.js";import"./collection-table-wrapper-u0Q_f-Jr.js";import"./table-BjC5y-mI.js";import"./site-draft-actions-CIqEMxV-.js";import"./separator-BVRCWUXh.js";import"./cms-store-drafts-gAOezeiH.js";import"./serial-task-queue-CGOeQgpr.js";import"./index-DXd61UF-.js";import"./input-ZtRkRndM.js";import"./icon-button-Bkz9RDzV.js";import"./chat-draft-DSgKm45E.js";import"./use-deco-credits-DV2KUq3D.js";import"./input-CZkeDxU4.js";import"./suggestion-R4Fq_9Vs.js";import"./use-org-fs-DKzRfuIW.js";import"./question-004-sINsf4GQ.js";import"./feature-paywall-DadXALbq.js";import"./plan-ladder-Bu3Ap_FZ.js";import"./add-connection-dialog-BC7Osx_R.js";import"./extract-connection-data-D7JZIpe1.js";import"./metadata-D72DunRR.js";import"./connection-CpcxYbw-.js";import"./connection-card-DbTrHYwh.js";import"./connection-slug-BlCRUE5Z.js";import"./schema-hGrr4U87.js";import"./connection-form-helpers-BFeW48f1.js";import"./authenticate-and-persist-oauth-CjW_HJT8.js";import"./mcp-oauth-HzcRe8g5.js";import"./mcp-oauth-CaiLBqRy.js";import"./collection-tabs-B6DksJOI.js";import"./use-infinite-scroll-xgBjudJA.js";import"./useSuspenseInfiniteQuery-B6k_dV9w.js";import"./use-task-board-events-D_nE-0RI.js";import"./save-changes-debug-nBi-n9eV.js";import"./site-draft-view-CRnAEeje.js";function I(e){return e.kind==="unavailable"&&e.source==="local"&&(e.problem?.reason??"not-answering")==="not-answering"}const ot=e=>e;function it(e){const t=u.c(10),{candidates:o,invalidLink:c,shell:m,editor:i}=e,r=c===void 0?!1:c,s=m===void 0?ot:m,[p,l]=g.useState(null);if(p){let f;t[0]===Symbol.for("react.memo_cache_sentinel")?(f=()=>l(null),t[0]=f):f=t[0];let h;return t[1]!==p||t[2]!==i?(h=i(p,f),t[1]=p,t[2]=i,t[3]=h):h=t[3],h}let a;t[4]!==o||t[5]!==r?(a=n.jsx(rt,{candidates:o,invalidLink:r,onConnect:l}),t[4]=o,t[5]=r,t[6]=a):a=t[6];let d;return t[7]!==s||t[8]!==a?(d=s(a),t[7]=s,t[8]=a,t[9]=d):d=t[9],d}function rt(e){const t=u.c(17),{candidates:o,invalidLink:c,onConnect:m}=e,i=c===void 0?!1:c,[r]=G(),{language:s}=r;let p;t[0]!==m?(p=N=>m({endpoint:N}),t[0]=m,t[1]=p):p=t[1];let l;t[2]!==o||t[3]!==p?(l={candidates:o,onFound:p},t[2]=o,t[3]=p,t[4]=l):l=t[4];const a=q(l),{state:d,access:f,needsGesture:h}=a;let k;t[5]!==o||t[6]!==s?(k=new Intl.ListFormat(s,{style:"long",type:"conjunction"}).format(o.map(T)),t[5]=o,t[6]=s,t[7]=k):k=t[7];const C=k;let S;t[8]!==f||t[9]!==a.start||t[10]!==h||t[11]!==d?(S=f==="denied"?{kind:"denied"}:h?{kind:"needs-gesture",onStart:a.start}:d.problem?{kind:"problem",problem:d.problem,host:T(d.problem.endpoint)}:{kind:"looking",paused:d.status==="paused"},t[8]=f,t[9]=a.start,t[10]=h,t[11]=d,t[12]=S):S=t[12];const _=S;let j;return t[13]!==C||t[14]!==i||t[15]!==_?(j=n.jsx(B,{wait:_,hosts:C,invalidLink:i}),t[13]=C,t[14]=i,t[15]=_,t[16]=j):j=t[16],j}const v="deco-serve",w="working-tree",nt={id:"",slug:"",name:"",logo:null},st={id:v,slug:v},mt={virtualMcpId:v,taskId:null,openTask:()=>{},createTask:()=>"",createTaskWithMessage:()=>{},activeTask:null,isThreadLocked:!1,lockedHarness:null,lockedBranch:null,currentBranch:w,setCurrentTaskBranch:()=>{}};function pt(){const e=window.location.hash,t=new URLSearchParams(e.replace(/^#/,"")).has("endpoint"),o=t?J(e):null;return t&&window.history.replaceState(null,"",window.location.pathname+window.location.search),o&&K(o),{candidates:W(o,U()),invalidLink:t&&!o}}const at=[{id:"site-editor",to:"/site-editor",label:"preview"},{id:"content",to:"/site-editor/content",label:"content"}];function ct(){const e=u.c(6),t=P();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={select:lt},e[0]=o):o=e[0];const c=O(o);let m;e[1]!==t||e[2]!==c?(m=at.map(r=>n.jsx(y.Tab,{asChild:!0,active:c==="content"==(r.id==="content"),children:n.jsxs(H,{to:r.to,activeOptions:{exact:!0},children:[n.jsx("span",{"aria-hidden":"true",className:"flex size-4 shrink-0 items-center justify-center",children:n.jsx(Z,{icon:tt({tabId:r.id,kind:"system",connections:[]})})}),t(`common.mainPanelTabs.${r.label}`)]})},r.id)),e[1]=t,e[2]=c,e[3]=m):m=e[3];let i;return e[4]!==m?(i=n.jsx(y.Tabs,{children:m}),e[4]=m,e[5]=i):i=e[5],i}function lt(e){return e.matches.at(-1)?.staticData.siteEditorView}function A(e){const t=u.c(14),{children:o}=e,c=P(),{connection:m}=z(v),i=R(v,w);let r,s;if(t[0]!==i||t[1]!==o||t[2]!==m||t[3]!==c){s=Symbol.for("react.early_return_sentinel");t:{if(r=m?T(m.endpoint):"",i.kind==="protocol"){s=o;break t}if(i.kind!=="unavailable"||I(i)){s=n.jsx(X,{headingLevel:2,waiting:!0,title:c("decoServe.connect.reaching",{host:r})});break t}}t[0]=i,t[1]=o,t[2]=m,t[3]=c,t[4]=r,t[5]=s}else r=t[4],s=t[5];if(s!==Symbol.for("react.early_return_sentinel"))return s;let p;t[6]!==i.problem?(p=i.problem??{reason:"not-answering"},t[6]=i.problem,t[7]=p):p=t[7];let l;t[8]!==r||t[9]!==p?(l={kind:"problem",problem:p,host:r},t[8]=r,t[9]=p,t[10]=l):l=t[10];let a;return t[11]!==r||t[12]!==l?(a=n.jsx(B,{wait:l,hosts:r}),t[11]=r,t[12]=l,t[13]=a):a=t[13],a}function dt(e){const t=u.c(6),{onLost:o}=e,c=R(v,w);let m;t[0]!==c?(m=I(c),t[0]=c,t[1]=m):m=t[1];const i=m;let r,s;return t[2]!==i||t[3]!==o?(r=()=>{i&&o()},s=[i,o],t[2]=i,t[3]=o,t[4]=r,t[5]=s):(r=t[4],s=t[5]),g.useEffect(r,s),null}const D={threadOpen:!1,contentOpen:!0,threadVisibilityExplicit:!1,toggleThread:()=>{},toggleContent:()=>{}};function ut(){const e=u.c(11),{data:t}=E.useSession();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={select:ft},e[0]=o):o=e[0];const c=O(o),m=!!t?.user;let i;e[1]!==m?(i={rail:m},e[1]=m,e[2]=i):i=e[2];const r=c??"preview";let s,p,l;e[3]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(ct,{}),p=n.jsx(x.Thread,{children:null}),l=n.jsx(et,{}),e[3]=s,e[4]=p,e[5]=l):(s=e[3],p=e[4],l=e[5]);let a;e[6]!==r?(a=n.jsx(L.Content,{children:n.jsxs(x,{...D,threadless:!0,contentKey:r,contentNavigation:s,children:[p,l]})}),e[6]=r,e[7]=a):a=e[7];let d;return e[8]!==i||e[9]!==a?(d=n.jsx(L,{outsideOrg:i,children:a}),e[8]=i,e[9]=a,e[10]=d):d=e[10],d}function ft(e){return e.matches.at(-1)?.staticData.siteEditorView}function ht(e){const t=u.c(8),{children:o}=e,{data:c}=E.useSession(),m=!!c?.user;let i;t[0]!==m?(i={rail:m},t[0]=m,t[1]=i):i=t[1];let r;t[2]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx(x.Thread,{children:null}),t[2]=r):r=t[2];let s;t[3]!==o?(s=n.jsx(L.Content,{children:n.jsxs(x,{...D,threadless:!0,contentKey:"guide",children:[r,n.jsx(x.Content,{children:o})]})}),t[3]=o,t[4]=s):s=t[4];let p;return t[5]!==i||t[6]!==s?(p=n.jsx(L,{outsideOrg:i,children:s}),t[5]=i,t[6]=s,t[7]=p):p=t[7],p}const b=()=>{},vt={connection:null,set:b,clear:b};function er(){const e=u.c(3),[t]=g.useState(pt);let o;return e[0]!==t.candidates||e[1]!==t.invalidLink?(o=n.jsx(F,{org:nt,project:st,children:n.jsx(it,{candidates:t.candidates,invalidLink:t.invalidLink,shell:kt,editor:xt})}),e[0]=t.candidates,e[1]=t.invalidLink,e[2]=o):o=e[2],o}function xt(e,t){return n.jsxs($.Provider,{value:{connection:e,set:b,clear:b},children:[n.jsx(dt,{onLost:t}),n.jsx(M,{value:mt,children:n.jsx(V,{children:n.jsx(ut,{})})})]})}function kt(e){return n.jsx($.Provider,{value:vt,children:n.jsx(ht,{children:e})})}function or(){const e=u.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx(A,{children:n.jsx(Q,{virtualMcpId:v})}),e[0]=t):t=e[0],t}function ir(){const e=u.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx(A,{children:n.jsx(Y,{virtualMcpId:v})}),e[0]=t):t=e[0],t}export{ir as SiteEditorContent,or as SiteEditorPreview,er as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as $,q as W,i as C,K as g,eX as Ue,d2 as Un,aE as Mt,aF as K,b9 as Qe,ba as Qn,e8 as De,e6 as Cn,bV as pe,eY as Fn,eZ as Bn,r as L,e_ as Vn,e$ as G,f0 as X,bA as Hn,a as Jn,as as _e,a4 as Wn,bz as At,f1 as Gn,f2 as Lt,aq as Yn,bh as F,bo as Ut,f3 as zn,f4 as Xn,f5 as Zn,t as ne,j as z}from"./index-h1XTCueR.js";import{u as Ce}from"./repository-binding-DOWKMbHI.js";import{e as Qt}from"./backoff-CrEUbyZT.js";import{b as Se}from"./sandbox-url-D3mC8qhT.js";import{u as qn}from"./chat-context--sx_tT3a.js";import{i as Kn,u as eo}from"./use-sandbox-events-7-fLrTMJ.js";import{u as Fe}from"./use-blocks-v8-project-B7yRGBZv.js";import{u as Ct}from"./use-voice-input-DNj7vd9z.js";import{s as ut}from"./thread-intent-D_k-pawu.js";import{s as to}from"./utils-CaKh8ISH.js";import{a as no}from"./sandbox-git-api-DcqI6XE4.js";const p={MethodNotFound:-32601,InvalidParams:-32602,InternalError:-32603,NotFound:-32001,Conflict:-32002,InvalidBlock:-32003,ReadOnly:-32005,Unsupported:-32006,LimitExceeded:-32007,Unavailable:-32008,Unauthorized:-32010};class S 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 S(t.code,t.message,t.data)}}const te="deco-content",Te={major:1},Ft=1;async function oo(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 Re={major:Te.major,minor:Ft},Bt=`the endpoint speaks an older ${te} than this client needs (${Re.major}.${Re.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:{...Re}};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 S(p.Unsupported,e,o)}function Vt(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!==Te.major)throw ae(`the endpoint speaks ${te} ${String(o?.major)}.x; this client speaks ${Te.major}.x`,"major",t);if(typeof o.minor!="number"||o.minor<Ft)throw ae(Bt,"outdated",t);return e}function ft(e,t){return t.code===p.MethodNotFound&&e.startsWith("changes.")?ae(Bt,"outdated"):S.from(t)}function Be(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 oo(a)}catch{throw new S(p.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?S.from(l):new S(p.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 ft(r,c.error);return c.result};return{call:s,describe:async()=>Vt(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:ft(r[u].method,d.error)}:{ok:!0,result:d.result}:{ok:!1,error:new S(p.InternalError,"no response for this call")}})}}}function Ve(e){return e&&!e.edited?{ifNoneMatch:e.revision}:{}}const dt=20,ht=5,gt=500;function He(e){return e instanceof S?e.code===p.MethodNotFound?!0:e.code===p.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 so(e,t,n){const o=g.contentChanges(n),s=e.getQueryData(o),r=await t.changesList(Ve(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 S(p.InternalError,"changes.list returned notModified without a cached list");return c}async function Ht(e,t){const n=[];for(let r=0;r<t.length;r+=dt)n.push(t.slice(r,r+dt));const o=Object.create(null),s=[];for(let r=0;r<n.length;r+=ht){const i=await e.batch(n.slice(r,r+ht).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 xr(e,t){let n={revision:"",versions:{}};for(let o=0;o<t.length;o+=gt){const s=t.slice(o,o+gt),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 Pr(e){return e instanceof S&&e.code===p.Conflict}function Je(e){return e?.kind==="protocol"?e:null}function $r(e,t,n){const o=$.c(14);let s;o[0]!==n?(s={},o[0]=n,o[1]=s):s=o[1];const r=s,i=W();let a;o[2]!==e?(a=Je(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?()=>so(i,c.client,t):Ue,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 ro(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 jr(e,t,n){const o=$.c(14);let s;o[0]!==e?(s=Je(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??"",ro(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?()=>Ht(r.client,a):Ue,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 Nr(e,t,n){const o=$.c(16);let s;o[0]!==e?(s=Je(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(uo).map(lo).sort(co);a=f.map(ao);const h=JSON.stringify(f.map(io));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 Ht(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}:Ue,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:Un},o[13]=c,o[14]=u,o[15]=d):d=o[15],l(d)}function io(e){return[e.name,e.base]}function ao(e){return e.name}function co(e,t){return e.name<t.name?-1:e.name>t.name?1:0}function lo(e){const[t,n]=e;return{name:t,base:n.baseVersion??""}}function uo(e){const[,t]=e;return t.kind==="delete"}function Jt(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 Wt=Mt({endpoint:K().max(2048).refine(e=>Jt(e)&&new URL(e).pathname==="/rpc").transform(he)});function Mr(e){const t=new URLSearchParams(e.replace(/^#/,"")),n=Wt.safeParse({endpoint:t.get("endpoint")??""});return n.success?n.data:null}function Gt(e){const t=Wt.safeParse(e);return t.success?t.data:null}const Yt="studio:deco-serve-last";function Ar(e){try{localStorage.setItem(Yt,JSON.stringify(e))}catch{}}function Lr(){try{const e=localStorage.getItem(Yt);return e?Gt(JSON.parse(e)):null}catch{return null}}function Ur(e){try{return new URL(he(e)).host}catch{return e}}function fo(e,t=1e4){return Math.min(1e3*2**Math.max(0,e-1),t)}const ho="http://localhost:4545/rpc";class We extends Error{constructor(t="the endpoint isn't deco serve"){super(t),this.name="NotDecoServeError"}}function go(e){if(e instanceof We)return{reason:"not-deco-serve"};if(!(e instanceof S))return{reason:"not-answering"};switch(e.code){case p.Unauthorized:case p.MethodNotFound:return{reason:"outdated"};case p.Unsupported:return He(e)?{reason:"outdated"}:{reason:"version-mismatch"};case p.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 Qr(e,t){if(e)return[he(e.endpoint)];const n=[t?.endpoint,ho].filter(o=>!!o).map(he);return[...new Set(n)]}const vo=Mt({blocks:De(K(),De(K(),Cn()).refine(Qe)),versions:De(K(),K().min(1)),missing:Qn(K())});function bo(e,t){const n=vo.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&&Qe(e.blocks[t])&&e.versions[t]===n.version}function wo(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 mo(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 vt=50,bt=10;function po(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:pe(),body:JSON.stringify(o.map((c,l)=>({jsonrpc:"2.0",id:s[l],method:c.method,params:c.params??{}})))}));if(!r.ok)throw new S(p.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:S.from(l.error)}:{ok:!0,result:l.result}:{ok:!1,error:new S(p.InternalError,"no response for this call")}})}}}function So(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]={[Bn]:!0,...s.meta?.type?{__resolveType:s.meta.type}:{},...s.meta?.path!==void 0?{path:s.meta.path}:{},...s.meta?.refs?.length?{[Fn]:s.meta.refs}:{}}}for(const[o,s]of Object.entries(t??{}))Object.hasOwn(n,o)||(n[o]=s);return n}function yo(e,t){return e?.entries[t]?.meta?.refs??[]}function ko(e,t){return Object.hasOwn(e.draft,t)?e.draft[t]?.version??null:null}function Ge(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function xe(e,t){if(Array.isArray(e)){for(const n of e)xe(n,t);return}if(Ge(e))for(const[n,o]of Object.entries(e))n==="__resolveType"&&typeof o=="string"?t.add(o):xe(o,t)}function zt(e,t){if(!Ge(e))return;const n={};typeof e.__resolveType=="string"&&(n.type=e.__resolveType),typeof e.path=="string"&&(n.path=e.path);const o=new Set;xe(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 Xt(e,t,n,o){G(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===X){delete r[c],i[c]={operation:"delete",version:X,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 Oo(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 wt=new WeakMap;async function Ye(e,t,n,o,s=new Set){const r=e.getQueryData(g.contentIndex(n));if(!r)throw new S(p.Unavailable,"The CMS index is not loaded yet");let i=wt.get(e);i||(i=new Map,wt.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)||Qe(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=Do(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 S(p.Unavailable,"A CMS block changed while loading; try again")}async function Eo(e,t,n,o,s){if(!t){const i=o?.[s];return Ge(i)&&!Hn(i)?i:void 0}await Ye(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 Do(e,t,n,o){const s=ge(e,n),r=[];for(let i=0;i<o.length;i+=vt)r.push(o.slice(i,i+vt));for(let i=0;i<r.length;i+=bt){const a=r.slice(i,i+bt),c=await t.batch(a.map(l=>({method:"cms.blocks",params:{names:l}})));if(c.length!==a.length)throw new S(p.InternalError,"Incomplete CMS batch response");for(const[l,u]of c.entries()){if(!u.ok)throw u.error;const d=bo(u.result,a[l]),f=ge(e,n),h=wo(s,f,d);if(G(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 S(p.Unavailable,"The CMS index changed while loading blocks; try again")}}}function ze(e){const t=$.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:Io,staleTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:s}=C(o);return s}async function Io(){throw new Error("the content index is set by the poll")}function mt(e,t){const n=$.c(8);let o;n[0]!==t?(o=Vn(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 pt=3e4;function _o(e){if(!(e instanceof S))return;const t=e.data?.retryAfterMs;return typeof t=="number"&&t>0?t:void 0}function To(e,t,n,o){const s=$.c(15),r=W(),i=ze(t);let a;s[0]!==t?(a=g.decofile(t),s[0]=t,s[1]=a):a=s[1];const c=mt(r,a);let l;s[2]!==t?(l=g.contentVersions(t),s[2]=t,s[3]=l):l=s[3];const u=mt(r,l),d=o?.withRefs??!1,f=new Set(n);if(d)for(const m of n)for(const E of yo(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)),w=JSON.stringify(h.map(m=>[m,i?.entries[m]?.version,oe(v,m)])),[R,k]=L.useState(null),[N,I]=L.useState(0),_=R?.key===w?R:null;L.useEffect(()=>{if(!e||!w)return;let m=!0;const E=JSON.parse(w).map(Po);return Ye(r,e,t,E).then(()=>{m&&k(j=>j?.key===w?null:j)},j=>{m&&k(U=>({key:w,count:(U?.key===w?U.count:0)+1,retryAfterMs:_o(j)}))}),()=>{m=!1}},[e,r,t,w,N]);let T;s[4]!==_||s[5]!==I?(T=()=>{if(!_)return;const m=Math.min(pt,_.retryAfterMs??Qt(pt,1e3,_.count-1,2,.5)),E=setTimeout(()=>I(xo),m);return()=>clearTimeout(E)},s[4]=_,s[5]=I,s[6]=T):T=s[6];let y;s[7]!==_?(y=[_],s[7]=_,s[8]=y):y=s[8],L.useEffect(T,y);const O=!e||mo(v,[...f],o?.listing),D=!!e&&b&&_!==null;let x;s[9]!==I?(x=()=>I(Ro),s[9]=I,s[10]=x):x=s[10];let M;return s[11]!==O||s[12]!==D||s[13]!==x?(M={ready:O,failed:D,retry:x},s[11]=O,s[12]=D,s[13]=x,s[14]=M):M=s[14],M}function Ro(e){return e+1}function xo(e){return e+1}function Po(e){const[t]=e;return t}const Zt=L.createContext(null);function $o(e){const t=$.c(24),n=L.useContext(Zt),o=Fe(n?null:e),{data:s}=Jn.useSession(),r=s?.user?.id??"",i=!!e&&!!r;let a;t[0]!==i||t[1]!==r||t[2]!==e?(a=i?_e.decoServeConnection(r,e):null,t[0]=i,t[1]=r,t[2]=e,t[3]=a):a=t[3];const[c,l]=yt(a);let u;t[4]!==i||t[5]!==r||t[6]!==e?(u=i?_e.decoServeEndpoint(r,e):null,t[4]=i,t[5]=r,t[6]=e,t[7]=u):u=t[7];const[d,f]=yt(u);if(n)return n;let h;t[8]!==c||t[9]!==i||t[10]!==o?(h=i&&o?Gt(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 w;t[12]!==f||t[13]!==l||t[14]!==i?(w=N=>{i&&(l(N),f(N.endpoint))},t[12]=f,t[13]=l,t[14]=i,t[15]=w):w=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]!==w||t[22]!==R?(k={connection:v,lastEndpoint:b,set:w,clear:R},t[19]=v,t[20]=b,t[21]=w,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 yt(e){const t=$.c(17),n=W(),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 qt(e,t=""){return{source:e,cacheKeySuffix:e==="github"?"":e==="sandbox"?":sandbox":`:serve:${t}`}}function jo(e){return JSON.stringify([e.kind==="legacy"?"legacy":"protocol",e.source,e.cacheKeySuffix])}function Cr(e){return e.kind==="protocol"||e.kind==="unavailable"}function Fr(e){const t=e.hasOrg?e.orgFlag:!1,{backend:n}=e;return n===null||n==="legacy"?t:!0}function Br(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 Vr(e){if(e.kind!=="protocol"||e.source!=="local")return null;const t=e.describe.preview?.url;return t&&Jt(t)?t:null}function Hr(e,t){return e.kind!=="protocol"||e.source!=="local"||!e.describe.assets||!t?null:new URL(t.endpoint).origin}function Kt(e){return e.hasServeConnection?"local":e.runtime==="sandbox"?"sandbox":"github"}function No(e){if(!e.hasProject)return"legacy";const t=Kt(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 Mo(e){return{github:e.v8&&e.mode==="github",sandbox:e.v8&&e.mode==="sandbox"&&e.workingTreeReady}}function kt(e){return e.isError||e.errorUpdateCount>0}function Ao(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 Lo(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 en="__noSchema";function tn(){return{manifest:{blocks:{}},schema:{definitions:{},root:{}},[en]:!0}}function Jr(e){return!!e&&e[en]===!0}function Xe(e){if(!e.ok)return e.error.code===p.NotFound;const t=e.result;return t.notModified===!1&&t.schema===null}function Uo(e,t){return(typeof t.name=="string"?t.name.trim():"")||e}const Qo=(e,t)=>e.label.localeCompare(t.label)||e.key.localeCompare(t.key);function Wr(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:Uo(n,s)}),t.set(r,i)}return[...t.entries()].map(([n,o])=>({resolveType:n,blocks:o.sort(Qo)})).sort((n,o)=>n.resolveType===null?1:o.resolveType===null?-1:Ot(n.resolveType).localeCompare(Ot(o.resolveType))||n.resolveType.localeCompare(o.resolveType))}function Ot(e){return(e.split("/").filter(Boolean).at(-1)??e).replace(/\.(tsx?|jsx?)$/,"")||e}function Et(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]=Et(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?Et(r[a],s,n):r[a];return i}return e}function Gr(e){if(e.trim()==="")return null;const t=Number(e);return Number.isFinite(t)?t:null}class Dt extends Error{}const Ze="site-not-owned";async function Co(e){return e.status!==409?!1:(await e.clone().json().catch(()=>null))?.code==="site_not_owned"}async function Fo(e,t=n=>fetch(n)){const n=Be({endpoint:e,fetch:async o=>{const s=await t(new Request(o,{signal:pe(o.signal)}));if(await Co(s))throw new Dt;return s}});try{return await Ke(n)}catch(o){if(o instanceof Dt)return Ze;throw o}}async function Bo(e,t,n){await t();const o=await Fo(e,n);return o===Ze?o:{...o,hosted:po(e,n)}}const qe=5e3;function Vo(e){if(!e.site)throw new Error("this project names no site");return Gn(e.site,e.branch)}function Ho(e){return new URL(Se(e,"rpc"),window.location.origin).href}async function Ke(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 We;const s=Vt(t.result);if(!n)throw new Error("no schema.get");if(Xe(n))return{client:e,describe:s,hasSchema:!1};if(n.ok)return{client:e,describe:s,hasSchema:!0};throw n.error}function Jo(e,t=n=>fetch(n)){return Ke(Be({endpoint:e,fetch:n=>t(new Request(n,{signal:pe(n.signal)}))}))}function re(e,t){const n=$.c(40),{org:o}=Wn(),{connection:s}=$o(e),{runtime:r}=Ct(e),i=L.useContext(Zt),a=Fe(e),c=At(Ce(e)?.metadata),l=Kt({hasServeConnection:!!s,runtime:r}),u=qt(l,s?.endpoint??""),d=qn()?.taskId??null,f=Kn(eo().lifecycle.phase),h=W(),v=Mo({mode:l,v8:a,workingTreeReady:f}),b=v.github&&!!o.slug&&!!e&&!!t,w=C({queryKey:g.contentBackend(o.slug,e??"",t??"","github"),queryFn:()=>Bo(Vo({orgSlug:o.slug,site:c,branch:t}),()=>Lt(c,t)),enabled:b,staleTime:Number.POSITIVE_INFINITY,...It}),R=v.sandbox&&!!o.slug&&!!e&&!!t;let k;n[0]!==t||n[1]!==o.slug||n[2]!==d||n[3]!==e?(k=()=>Jo(Ho({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 N=C({queryKey:g.contentBackend(o.slug,e??"",t??"","sandbox",d??""),queryFn:k,enabled:R,staleTime:Number.POSITIVE_INFINITY,...It}),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=()=>qo(s.endpoint),n[9]=s,n[10]=T):T=n[10];let y;n[11]!==I||n[12]!==_||n[13]!==T?(y={queryKey:_,queryFn:T,enabled:I,staleTime:Number.POSITIVE_INFINITY,retry:Yo,retryDelay:Go,refetchInterval:Wo},n[11]=I,n[12]=_,n[13]=T,n[14]=y):y=n[14];const O=C(y);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 M;n[19]!==s?.endpoint||n[20]!==o.slug||n[21]!==e?(M=g.contentBackend(o.slug,e??"","local-describe",s?.endpoint??""),n[19]=s?.endpoint,n[20]=o.slug,n[21]=e,n[22]=M):M=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 Ln=q;throw h.invalidateQueries({queryKey:x,exact:!0},{cancelRefetch:!1}),Ln}},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]!==M||n[28]!==m||n[29]!==E?(j={queryKey:M,queryFn:m,enabled:E,refetchInterval:qe,retry:!1},n[27]=M,n[28]=m,n[29]=E,n[30]=j):j=n[30];const A=C(j).data??O.data?.describe,Q=No({hasProject:!!e,hasServeConnection:!!s,runtime:r,v8:a,githubSite:w.data===Ze?"not-owned":w.data?"ready":kt(w)?"error":"loading",sandboxSite:zo({data:N.data,isError:kt(N),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{...Pe(u,w.data),site:c};if(Q==="site-not-owned-github")return{kind:"unavailable",...u,siteNotOwned:!0};if(Q==="protocol-sandbox")return Pe(u,N.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,V=s?.endpoint??"";let H;return n[33]!==A||n[34]!==O.data||n[35]!==O.failureCount||n[36]!==O.isError||n[37]!==V||n[38]!==P?(H=Zo({probed:O.data,isError:O.isError,failureCount:O.failureCount,failure:P,describe:A,endpoint:V}),n[33]=A,n[34]=O.data,n[35]=O.failureCount,n[36]=O.isError,n[37]=V,n[38]=P,n[39]=H):H=n[39],H}function Wo(e){return e.state.status==="error"||e.state.data?.hasSchema===!1?qe:!1}function Go(e){return fo(e+1)}function Yo(e,t){return!(t instanceof S)&&!(t instanceof We)}function zo(e){return e.data!==void 0?"ready":e.workingTreeReady?e.isError?"error":"loading":"unavailable"}const Xo=3;function Zo(e){const t=qt("local",e.endpoint),n=e.probed?Pe(t,{...e.probed,describe:e.describe??e.probed.describe}):null;return e.isError||e.failureCount>0?n?.kind==="protocol"&&!e.isError&&e.failureCount<Xo?n:{kind:"unavailable",...t,problem:go(e.failure)}:n??{kind:"pending",...t}}const It={retry:2,refetchInterval:e=>e.state.status==="error"?qe:!1};function Pe(e,t){return{kind:"protocol",...e,client:t.client,describe:t.describe,hasSchema:t.hasSchema,...t.hosted?{hosted:t.hosted}:{}}}function qo(e,t){return Ke(Be({endpoint:e,fetch:n=>fetch(n,{signal:pe(t?AbortSignal.any([t,n.signal]):n.signal)})}))}function $e(e){const t=`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`;return e.protocolSuffix?`${t}${e.protocolSuffix}`:e.localPreviewUrl?`${t}:local:${e.localPreviewUrl}`:t}function Ko(e,t){return $e({...e,protocolSuffix:t.cacheKeySuffix})}function es(e,t,n){return e?t==="pending"?{ready:!1,failed:!1}:t==="unavailable"?{ready:!1,failed:!0}:n:{ready:!0,failed:!1}}function ts(e,t){return JSON.stringify([e?.orgSlug,e?.virtualMcpId,e?.branch,jo(t)])}function ns(e,t,n){const o=$.c(21),s=W(),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?Ko(e,i):"",o[0]=i,o[1]=e,o[2]=a):a=o[2];const c=To(i?.hosted,a,t,n),l=e!==null;let u;o[3]!==r.kind||o[4]!==c||o[5]!==l?(u=es(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=ts(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 w=r.source;s.resetQueries({queryKey:g.contentBackend(e.orgSlug,e.virtualMcpId,...w==="local"?["local"]:[e.branch,w])})},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 nn(e){const t=$.c(12);let n;t[0]!==e?(n=_e.localPreviewUrl(e??""),t[0]=e,t[1]=n):n=t[1];const o=n,[s,r]=Yn(o,null),i=Fe(e);let a;t[2]!==s||t[3]!==e?(a=e?ut(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(ut(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}function os(e,t){const n=(e??"").trim().replace(/^[/\\]+|[/\\]+$/g,"");return n?`${n}/${t}`:t}function _t(e){let t;try{t=JSON.parse(e)}catch{return null}return typeof t!="object"||t===null||Array.isArray(t)?null:t}function ye(e,t,n){return["decofile-write",e,t,n]}function ss(e,t,n){return{id:ye(e,t,n).join(":")}}class et 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 tt(e){return`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`}function nt(e){return`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}`}async function rs(e,t){const n=await e.json().catch(()=>({}));throw new Error(n.error??`${t} failed (${e.status})`)}function is(e,t,n){e.setQueryData(g.decofileDraft(tt(t)),n)}function as(e,t){return e.getQueryData(g.decofileDraft(tt(t)))??null}async function cs(e,t){return(await fetch(nt(e),{cache:"no-store",headers:{"if-none-match":`"${t}"`}}).catch(()=>null))?.status===200}function Yr(e){const t=$.c(4);let n;t[0]!==e?(n=g.decofileDraft(e?tt(e):""),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:ls,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 ls(){throw new Error("decofileDraft is populated by reads/writes, not fetched")}async function us(e,t){const n=await fetch(nt(t),{cache:"no-store"});if(!n.ok){const s=new Error(`Failed to fetch decofile: ${n.status}`);throw s.status=n.status,s}const o=await n.json();return o.token&&is(e,t,{version:o.version,token:o.token,apiHost:o.apiHost??window.location.host}),o.decofile}async function zr(e,t){const n=await fetch(nt(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 et(s.blocks??[],s.error??"Block changed"):new Error(s.error??`Save failed (${n.status})`)}if(!n.ok)return rs(n,"Save");const o=await n.json();return{...o,apiHost:o.apiHost??window.location.host}}const on=3e3,fs=15e3,ds=2*6e4,sn={now:()=>Date.now(),setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),hidden:()=>typeof document<"u"&&document.visibilityState==="hidden"};function hs(e){return e<ds?on:fs}function gs(e,t=sn){const n=t.now();let o=!1,s=!1,r=null;const i=()=>{o||(r=t.setTimeout(a,hs(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 Tt=()=>0;function vs(e,t,n=sn){const o=L.useRef(t);o.current=t;const[s]=L.useState(()=>({polling:()=>gs(()=>o.current,n),idle:()=>()=>{}}));L.useSyncExternalStore(e?s.polling:s.idle,Tt,Tt)}function rn(e,t){return Se(e,t)}function bs(e,t){return Se(e,"preview-fetch",{path:t})}function Xr(e){return rn(e,"preview-invoke")}function Zr(e){return rn(e,"catalog-invoke")}function an(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 ws(){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&&an(n))return n}return null}function ms(e,t){const n=e.previewUrl??e.getFallbackPreviewUrl?.()??ws();return n&&an(n)?new URL(t,n).toString():bs(e,t)}function ps(e){return ms(e,"/.decofile")}function Ss(e){return e===400?"absent":e===404?"unavailable":e>=200&&e<300?"ok":"error"}function Rt(e){return e.liveOk||e.committedAbsent?404:e.liveStatus??502}async function ys(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=Ss(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:to(r.content)}}async function ks(e,t){const n=await ys(e,t);if(n.kind!=="data")return n;try{return{kind:"data",data:JSON.parse(n.data)}}catch{return{kind:"unavailable"}}}async function qr(e){const t=`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}/meta`,n=await fetch(t,{cache:"no-store"});if(n.status===404)return{kind:"absent"};if(!n.ok){const o=new Error(`Failed to read committed meta: ${n.status}`);throw o.status=n.status,o}try{return{kind:"data",data:await n.json()}}catch{return{kind:"unavailable"}}}function Os(e){return Ce(e)?.metadata?.runtime?.path??null}function je(e,t,n,o){const s=F(e),r=Object.keys(n?.changes??{}).find(a=>F(a)===s);if(r!==void 0&&n)return n.changes[r].baseVersion;const i=Object.keys(t?.draft??{}).some(a=>F(a)===s);if(t&&!i){const a=Object.keys(t.entries).find(c=>F(c)===s);return a===void 0?null:t.entries[a].version}return o?.[e]??null}class cn extends Error{constructor(t){super(t instanceof Error?t.message:String(t),{cause:t}),this.name="ServeLostError"}}function Kr(e){return e instanceof S&&e.code===p.Conflict}function ln(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 ot extends Error{constructor(){super("The draft's changes couldn't be read"),this.name="HostedDraftUnreadError"}}class st extends Error{constructor(){super("The blocks kept changing while the change was saved"),this.name="HostedKeptChangingError"}}function ei(e,t){return(t instanceof ot||t instanceof st)&&(t.message=un(e,t,"github")),t}function un(e,t,n){if(t instanceof ot)return e("siteEditor.save.draftUnread");if(t instanceof st)return e("siteEditor.save.keptChanging");if(t instanceof et)return t.message;if(n==="local")return Ds(e,t);if(t instanceof S)switch(t.code){case p.Conflict:return e("siteEditor.save.conflict");case p.ReadOnly:return e("siteEditor.save.readOnly");case p.InvalidBlock:case p.InvalidParams:return e("siteEditor.save.invalid");case p.LimitExceeded:return e("siteEditor.save.tooLarge")}return e("siteEditor.save.failed")}function Es(e,t){if(t==="local"||e instanceof et||e instanceof ot||e instanceof st)return null;if(e instanceof S){const n=e.code===p.InvalidBlock||e.code===p.InvalidParams?ln(e):e.message;return n?`${e.code}: ${n}`:null}return e.message||null}function Ds(e,t){if(t instanceof cn)return e("decoServe.save.serverGone");if(t instanceof S)switch(t.code){case p.Conflict:return e("decoServe.save.conflict");case p.ReadOnly:return e("decoServe.save.readOnly");case p.InvalidBlock:case p.InvalidParams:return e("decoServe.save.invalid",{detail:ln(t)});case p.LimitExceeded:return e("decoServe.save.tooLarge")}return e("sectionsEditor.sectionsEditor.saveFailed",{error:t.message})}function Is(e,t,n){return e===null?0:Math.max(0,n-Math.max(0,t-e))}function _s(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=Is(s.current,Date.now(),t);if(i===0){r();return}const a=setTimeout(r,i);return()=>clearTimeout(a)},[e,n,t]),n}const Ts="decocms:content-writes",Ne=new Set;let Y;function fn(){if(Y!==void 0)return Y;Y=null;try{typeof BroadcastChannel=="function"&&(Y=new BroadcastChannel(Ts),Y.addEventListener("message",e=>{const t=e.data?.cacheKey;if(typeof t=="string")for(const n of[...Ne])n(t)}))}catch{Y=null}return Y}function Rs(e){try{fn()?.postMessage({cacheKey:e})}catch{}}function xs(e){return fn(),Ne.add(e),()=>{Ne.delete(e)}}const dn="__at=",hn="__test=",Ps=/^[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 $s(e){return e.at!==void 0||Object.keys(e.tests??{}).length>0}function ee(e){return typeof e=="string"&&Ps.test(e)}function xt(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)}function js(e){const t=e.tests??{};return[...e.at!==void 0?[dn+xt(e.at)]:[],...Object.keys(t).map(n=>hn+xt(`${n}=${t[n]?"on":"off"}`))]}function Pt(e,t){const o=[...e.split("&").filter(s=>s&&!s.startsWith(dn)&&!s.startsWith(hn)),...t];return o.length>0?`?${o.join("&")}`:""}function ve(e,t){const n=js(t),o=e.indexOf("?"),s=o===-1?e:e.slice(0,o);if(ee(s))return s+Pt(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}${Pt(l,n)}${e.slice(r)}`}function ti(e,t,n){if(!$s(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 ni(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 gn(e){return btoa(encodeURIComponent(e))}function oi(e,t,n){const o=Ns(e,t,n);return o.searchParams.set("__cb",crypto.randomUUID()),o.toString()}function Ns(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",gn(JSON.stringify({path:"/",sections:[{__resolveType:n}]}))),s}const Ms="__draft";function si(e){return`${`${e.apiHost}/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}?token=${e.token}`}@${e.version}`}const As="off";function Ls(e,t){if(!t)return e;const n=new URL(e);return n.searchParams.set(Ms,t),n.toString()}function ri(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 ii(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",gn(JSON.stringify({sections:i}))),r.toString()}function ai(e){return e.fastPreviewActive&&e.previewServerUrl?e.previewServerUrl:e.sandboxUrl??null}const $t="__variant=";function vn(e,t,n){return`${e}@${t}=${n}`}function ci(e,t){return!e||!t.multivariate||t.variants.length<=1?[]:t.index<0||t.index>=t.variants.length?[]:[vn(e,"sections",t.index)]}function li(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[vn(e.pageKey,o,e.selectedVariantIndex)]}function ui(e,t){return[...t,...e]}function Us(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)}function rt(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+Us(l))],c=a.length>0?`?${a.join("&")}`:"";return`${r}${c}${e.slice(n)}`}function fi(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 rt(`${s}${o.pathname}@local`,t)}catch{return null}}function di(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",rt(o,t)),n.toString())}catch{return e}}function Qs(e){const{pointer:t}=e;if(!t||t===As)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(rt(t,e.forcedVariants),e.previewOptions)}function Cs(e,t){if(!e||!t)return null;try{return Ls(e,t)}catch{return null}}function hi(e,t,n){if(!e||!n)return null;try{return Cs(new URL(t,e).toString(),n)}catch{return null}}const be={forcedVariants:[],previewOptions:{}},ce=new Map,le=new Map,Me=new Map;function bn(e){for(const t of Me.get(e)??[])t()}function wn(e,t){const n=ee(t)?t:null;(le.get(e)??null)!==n&&(n?le.set(e,n):le.delete(e),bn(e))}function Fs(e){return le.get(e)??null}function Bs(e,t){return JSON.stringify(e)===JSON.stringify(t)}function gi(e,t){const n=ce.get(e)??be,o=t??be;Bs(n,o)||(t?ce.set(e,o):ce.delete(e),bn(e))}function Vs(e){return ce.get(e)??be}function mn(e,t){let n=Me.get(e);return n||(n=new Set,Me.set(e,n)),n.add(t),()=>{n.delete(t)}}function Hs(e){const t=$.c(3);let n,o;return t[0]!==e?(n=s=>mn(e,s),o=()=>Vs(e),t[0]=e,t[1]=n,t[2]=o):(n=t[1],o=t[2]),L.useSyncExternalStore(n,o,Js)}function Js(){return be}function Ws(e){const t=$.c(3);let n,o;return t[0]!==e?(n=s=>e?mn(e,s):Ys,o=()=>e?Fs(e):null,t[0]=e,t[1]=n,t[2]=o):(n=t[1],o=t[2]),L.useSyncExternalStore(n,o,Gs)}function Gs(){return null}function Ys(){}function vi(e,t){const n=$.c(4),o=Hs(e),s=Ws(e);let r;return n[0]!==o||n[1]!==s||n[2]!==t?(r=Qs({pointer:t,heldRevision:s,...o}),n[0]=o,n[1]=s,n[2]=t,n[3]=r):r=n[3],r}const pn={phase:"idle",inFlight:0,reload:{seq:0,navigates:!1},epoch:0},zs=15e3,we=new Map;function Z(e,t){return`${e}/${t}`}function B(e){let t=we.get(e);return t||(t={state:pn,listeners:new Set,previews:0,timer:null,discardListeners:new Set},we.set(e,t)),t}function J(e,t){const n=B(e);n.state={...n.state,...t};for(const o of n.listeners)o()}function ke(e){e.timer&&clearTimeout(e.timer),e.timer=null}function it(e){return we.get(e)?.state??pn}function Xs(e,t){const n=B(e);return n.listeners.add(t),()=>{n.listeners.delete(t)}}function bi(e){const t=B(e);return t.previews++,()=>{t.previews--,t.previews===0&&t.state.phase==="reloading"&&(ke(t),J(e,{phase:"idle"}))}}function wi(e){const t=we.get(e);!t||t.state.phase!=="reloading"||(ke(t),J(e,{phase:"idle"}))}function Sn(e){const t=B(e);ke(t),J(e,{phase:"saving",inFlight:t.state.inFlight+1})}function ue(e,t){const n=B(e),o=Math.max(0,n.state.inFlight-1);if(o>0){J(e,{inFlight:o});return}if(!t.ok||n.previews===0){J(e,{phase:"idle",inFlight:o});return}yn(e,t.navigates,o)}function yn(e,t,n=0){const o=B(e);ke(o),o.timer=setTimeout(()=>{o.timer=null,o.state.phase==="reloading"&&J(e,{phase:"idle"})},zs),J(e,{phase:"reloading",inFlight:n,reload:{seq:o.state.reload.seq+1,navigates:t}})}function Zs(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")return await c,{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:no(o,s,r)})),Zs(i)&&l&&!t.adopted&&d.push(n.invalidateQueries({queryKey:l})),await Promise.all(d),t.kind!=="edit"){const v=Z(o,s);J(v,{epoch:it(v).epoch+1})}const f=l?JSON.stringify(n.getQueryData(l)??null):null,h=u!==f;return h&&await new Promise(v=>Ut.schedule(v)),{navigates:h}}async function qs(e,t){return Sn(Z(e.orgSlug,e.virtualMcpId)),kn(e,t)}function jt(e){return e.branch?JSON.stringify(e.queryClient.getQueryData(g.protocolDraftRead(e.orgSlug,e.virtualMcpId,e.branch))??null):null}async function kn(e,t){const n=Z(e.orgSlug,e.virtualMcpId),o=t.adopted?jt(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&&Rs(e.cacheKey),wn(n,t.shownRevision?.(s)??null),t.adopted){const i=jt(e)!==o;return i&&await new Promise(a=>Ut.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 mi(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:s,branch:r}=e,i=Z(o,s),a=new Set(t.blockKeys);for(const u of[...B(i).discardListeners])u(a);Sn(i);let c=!1;const l=()=>(c=!0,kn(e,{kind:"discard",reread:!0,write:t.write}));return r?n.getMutationCache().build(n,{mutationKey:ye(o,s,r),scope:ss(o,s,r),mutationFn:l}).execute(void 0).catch(u=>{throw c||ue(i,{ok:!1,navigates:!1}),u}):l()}function pi(e,t,n){const o=$.c(8);let s;o[0]!==e||o[1]!==t?(s=Z(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=B(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 On(e){const t=Z(e.orgSlug,e.virtualMcpId);it(t).inFlight>0||(wn(t,null),fe(e,{kind:"external"}).then(({navigates:n})=>{const o=B(t);o.previews>0&&o.state.inFlight===0&&yn(t,n)}).catch(()=>{}))}function Ks(e,t){const n=$.c(7);let o;n[0]!==e||n[1]!==t?(o=Z(e,t),n[0]=e,n[1]=t,n[2]=o):o=n[2];const s=o;let r;n[3]!==s?(r=l=>Xs(s,l),n[3]=s,n[4]=r):r=n[4];const i=r;let a;n[5]!==s?(a=()=>it(s),n[5]=s,n[6]=a):a=n[6];const c=a;return L.useSyncExternalStore(i,c,c)}const er=500;function Si(e,t){const{phase:n}=Ks(e,t);return _s(n!=="idle",er)}function tr(e){const t=new Error(`${e} unavailable (content server unreachable)`);return t.status=502,t}function En(e,t){return g.liveMeta(e.orgSlug,e.virtualMcpId,e.branch,`protocol${t.cacheKeySuffix}`,"")}function yi(e,t,n,o){if(o?.source==="github"){const i=e.getQueryData(g.contentIndex(t));return i?ko(i,n):nr(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 Dn(e,t){if(Object.hasOwn(e.changes,t))return e.changes[t];const n=F(t),o=Object.keys(e.changes).find(s=>F(s)===n);return o===void 0?void 0:e.changes[o]}function nr(e,t,n){const o=e.getQueryData(g.contentChanges(t));if(o)return In(o,Oe(e,t),n)}function In(e,t,n){const o=Dn(e,n);return o?.kind==="delete"?o.version??X:o?o.version:t.has(F(n))?X:null}function ki(e,t,n){const o=e.getQueryData(g.contentChanges(t));if(!o)return!1;const s=Dn(o,n);return s?s.kind==="set"&&s.baseVersion===null:Oe(e,t).has(F(n))}function Oi(e,t){const n=e.getQueryData(g.decofile(t)),o=e.getQueryData(g.contentChanges(t));if(!n||!o)return null;const s=Oe(e,t);return{blocks:n,versionOf:r=>In(o,s,r)}}function Oe(e,t){return new Set(e.getQueryData(g.contentDraftTombstones(t)))}function me(e,t,n,o){const s=F(n),r=Oe(e,t);r.has(s)!==o&&(o?r.add(s):r.delete(s),G(e),e.setQueryData(g.contentDraftTombstones(t),[...r]))}function _n(e,t,n,o){const s=o.revision,r=e.getQueryData(g.contentVersions(n)),i=Object.entries(o.versions??{}).map(([f,h])=>[f,h===X?null:h]),a=e.getQueryData(g.contentChanges(n)),c=e.getQueryData(g.contentIndex(n)),l=new Set(i.flatMap(([f])=>je(f,c,a,r)===null?[f]:[])),u=new Set(i.flatMap(([f,h])=>h===null?[]:[F(f)]));e.setQueryData(g.contentChanges(n),f=>{if(!f)return f;const h={...f.changes};for(const[v,b]of i){const w=je(v,c,f,r);b!==null?h[v]={kind:"set",version:b,baseVersion:w}:w!==null?h[v]={kind:"delete",version:null,baseVersion:w}:delete h[v]}return{...f,changes:h,edited:!0}});for(const[f,h]of i)h!==null?me(e,n,f,!1):!u.has(F(f))&&l.has(f)&&me(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 Ee(e,t,n){G(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 Tn(e,t){const n=e.getMutationCache().findAll({mutationKey:ye(t.orgSlug,t.virtualMcpId,t.branch),status:"pending"});return new Set(n.flatMap(o=>Lo(o.state.variables)))}function Ae(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 S);throw t.source==="local"&&r?(Ae(e,n),new cn(s)):(t.source==="local"&&He(s)&&Ae(e,n),s)}}const Nt=new WeakMap;function at(e){let t=Nt.get(e);return t||(t={inFlight:new Map,rereading:new Set},Nt.set(e,t)),t}function Rn(e,t,n,o){const{inFlight:s}=at(e),r=s.get(o);if(r)return r;const i=ct(e,t,n,o,!0);return s.set(o,i),i.finally(()=>{s.get(o)===i&&s.delete(o)})}function or(e,t,n){const o=$.c(8),s=W(),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}=at(s);return xs(f=>{f===n&&(d.has(n)||(d.add(n),rr(s,e,u,n).catch(sr).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 sr(){}async function rr(e,t,n,o){const s=at(e).inFlight.get(o);return s&&await s.catch(()=>{}),Rn(e,t,n,o)}async function ct(e,t,n,o,s){G(e);const r=g.decofile(o),i=En(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,w=g.contentChanges(o),R=e.getQueryData(w);if(t.source==="github"&&t.hosted)return ir(e,t,t.hosted,n,o,{conditional:s,seen:h,currentMeta:f,schemaIfNoneMatch:b,seenChanges:R});const[k,N,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:Ve(R)}])),_=e.getQueryData(a)?.revision,T=_!==void 0&&_!==h?.revision;if(I?.ok){const E=T?null:de(R,I.result);E&&e.setQueryData(w,E)}else I&&t.source==="local"&&He(I.error)&&Ae(e,n);if(!k?.ok)throw k?.error??new Error("no blocks.list");if(!N)throw new Error("no schema.get");const y=k.result,O=Xe(N),D=N.ok&&!O?N.result:null;if(y.notModified&&(!l||!u)||D?.notModified&&!f)return ct(e,t,n,o,!1);const x=y.notModified?new Set:Tn(e,n),M=y.notModified?l:Ao(y.blocks,l,x),m=O?tn():D?D.notModified?f:D.schema:N.error;if(e.setQueryData(a,{revision:T?_:y.notModified?h?.revision:y.revision,schemaVersion:D?D.notModified?h?.schemaVersion:D.version??void 0:void 0}),e.setQueryData(r,M),!y.notModified){const E=e.getQueryData(c),j={...y.versions};for(const U of x){const A=E?.[U];A!==void 0?j[U]=A:delete j[U]}e.setQueryData(c,j)}return m instanceof S||e.setQueryData(i,m),!T&&!y.notModified&&l&&h?.revision&&y.revision!==h.revision&&On({queryClient:e,orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,backend:t,cacheKey:o}),{blocks:M,meta:m}}async function ir(e,t,n,o,s,r){const i=g.decofile(s),a=g.contentIndex(s),c=g.contentRevision(s),l=g.contentVersions(s),u=En(o,t),d=g.contentChanges(s),f=e.getQueryData(a),h=r.conditional&&f?r.seen?.revision:void 0,[v,b,w]=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:Ve(r.seenChanges)}])),R=e.getQueryData(a)??f,k=e.getQueryData(c)?.revision,N=k!==void 0&&k!==r.seen?.revision;if(w?.ok&&!N){const P=de(r.seenChanges,w.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,_=Xe(b),T=b.ok&&!_?b.result:null;if(I.notModified&&!f||T?.notModified&&!r.currentMeta)return ct(e,t,o,s,!1);const y=_?tn():T?T.notModified?r.currentMeta:T.schema:b.error;y instanceof S||e.setQueryData(u,y);const O=T?T.notModified?r.seen?.schemaVersion:T.version??void 0:void 0,D=e.getQueryData(i)??{};if(I.notModified||N)return e.setQueryData(c,{revision:N?k:r.seen?.revision,schemaVersion:O}),e.setQueryData(i,D),{blocks:D,meta:y};const x={revision:I.revision,resolvedRef:I.resolvedRef,sequence:I.sequence,entries:I.entries,draft:I.draft};e.setQueryData(a,x);const M=!!r.seen?.revision&&x.revision!==r.seen.revision&&(!r.seen.revision.startsWith("s-")||!!f&&xn(f.draft,x.draft));M&&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=Tn(e,o),E=e.getQueryData(l)??{},j={},U={},A=[];for(const[P,V]of Object.entries(D)){const H=x.entries[P];!H&&!m.has(P)||(j[P]=V,E[P]!==void 0&&(U[P]=E[P]),H&&!m.has(P)&&E[P]!==H.version&&A.push(P))}return e.setQueryData(i,j),e.setQueryData(l,U),A.length>0&&await Ye(e,n,s,A,m),R&&M&&ar(R,x)&&On({queryClient:e,orgSlug:o.orgSlug,virtualMcpId:o.virtualMcpId,branch:o.branch,backend:t,cacheKey:s}),{blocks:e.getQueryData(i)??j,meta:y}}function ar(e,t){if(xn(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 xn(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 cr(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 Ie(e){if(!(e instanceof S)||e.code!==p.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 lr(e,t){if(!(e instanceof S)||e.code!==p.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 Zn(s[a]):r.has(a)?X:void 0)!==l)return;i[a]=l}return i}function ur(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){G(e),_n(e,t,n,{revision:e.getQueryData(g.contentRevision(n))?.revision??"",versions:s}),Ee(e,n,Object.fromEntries(Object.entries(s).map(([r,i])=>[r,i===X?null:i]))),Xt(e,n,s,o.set??{})}async function Ei(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=zn(s.set);if(c.length>0)throw new Error(`A hosted save can't write a block that isn't loaded (${c.join(", ")})`)}return qs({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:cr(d,u)}:{}}));let a;try{a=await i(s)}catch(u){const d=t.source==="github"?Ie(u):void 0;if(!d)throw u;const f=ur(s,d);Object.keys(d).length>0&&ie(e,n,o,s,d);let h;try{h=await i(f)}catch(v){const b=Ie(v);b&&Object.keys(b).length>0&&ie(e,n,o,f,b);const w=await lr(v,f);if(!w)throw v;ie(e,n,o,f,w);try{h=await i(f,{...r,...w})}catch(R){const k=Ie(R);throw k&&Object.keys(k).length>0&&ie(e,n,o,f,k),R}}a={...h,versions:{...d,...h.versions}}}G(e);const c=t.source==="github"?_n(e,n,o,a):a.revision;t.source==="github"&&Xt(e,o,a.versions??{},s.set??{}),e.setQueryData(g.contentRevision(o),u=>({...u,revision:c}));const l=a.versions??{};return Ee(e,o,l),{revision:c,versions:l}}})}function Pn(e,t){if(!(e instanceof S))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 $n(e,t,n){if(!(n instanceof S))return;const o=n.data?.draft;if(!(!o||typeof o!="object"))for(const[s,r]of Object.entries(o))r===null&&me(e,t,s,!1)}function jn(e,t,n,o){G(e),Xn(e,n,o);const s=o.block===null,r=e.getQueryData(g.contentVersions(t)),i=e.getQueryData(g.contentChanges(t)),a=je(n,e.getQueryData(g.contentIndex(t)),i,r);if(i){const c=F(n),l=Object.fromEntries(Object.entries(i.changes).filter(([u])=>F(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})}me(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}),Ee(e,t,{[n]:s?null:o.version}),Oo(e,t,n,o)}function Di(e,t,n,o){if(t.source!=="github"||!(o instanceof S))return!1;$n(e,n,o);const s=o.data?.draft;if(!s||typeof s!="object")return!1;const r=Object.keys(s),i=r.map(a=>Pn(o,a));return r.length===0||i.some(a=>a===void 0)?!1:(e.cancelQueries({queryKey:g.decofile(n)}),r.forEach((a,c)=>{jn(e,n,a,i[c])}),!0)}async function Ii(e,t,n,o,s,r){t.source==="github"&&$n(e,o,r);const i=t.source==="github"?Pn(r,s):void 0;if(i)return e.cancelQueries({queryKey:g.decofile(o)}),jn(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}),Ee(e,o,{[s]:a.version}),!1}function fr(e){const t=$.c(17),n=Ce(e?.virtualMcpId)?.metadata;let o;t[0]!==n?(o=At(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 Lt(s,e.branch),w=b.pointer?.lastIndexOf("@")??-1;return{draft:b.pointer&&w>0?b.pointer.slice(0,w):null,version:b.pointer&&w>0?b.pointer.slice(w+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 _i(e){return fr(e).pointer}function Ti(e){const t=$.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:dr,staleTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:s}=C(o);return s?.revision}async function dr(){throw new Error("content revisions are set by reads and writes")}function lt(e,t){const n=$.c(6),{url:o}=nn(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?$e({...e,protocolSuffix:s.cacheKeySuffix}):$e({...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 Ri(e,t){const n=$.c(46),{url:o}=nn(e?.virtualMcpId),s=!!o,r=re(e?.virtualMcpId,e?.branch),i=r.kind==="protocol"?r:null,a=lt(e),c=t?.fetchEnabled??!0,l=Os(e?.virtualMcpId),u=Ct(e?.virtualMcpId).runtime==="cms",d=W();let f;n[0]!==a?(f=g.decofile(a),n[0]=a,n[1]=f):f=n[1];const h=f;or(i,i&&e?e:null,a);let v;n[2]!==e||n[3]!==d||n[4]!==h?(v=()=>{if(!e||d.isMutating({mutationKey:ye(e.orgSlug,e.virtualMcpId,e.branch)})>0)return!0;const E=d.getQueryState(h);return E?.fetchStatus==="fetching"||Date.now()-(E?.dataUpdatedAt??0)<on/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=as(d,e)?.version;if(E&&!await cs(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 w;n[13]!==v||n[14]!==b?(w={skip:v,read:b},n[13]=v,n[14]=b,n[15]=w):w=n[15],vs(!!t?.pollWhile&&!!e,w);const R=ze(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 Rn(d,i,e,a)).blocks;if(r.kind==="unavailable")throw tr("decofile");if(s){const A=await fetch(new URL("/.decofile",o).toString(),{cache:"no-store"}).catch(vr),Q=A?.ok?_t(await A.text()):null;if(Q)return Q;const P=new Error("decofile unavailable (local tunnel unreachable)");throw P.status=502,P}if(u)return us(d,e);const E=()=>ks(e,os(l,".deco/blocks.gen.json"));if(c){const A=await fetch(ps(e),{cache:"no-store"}).catch(gr);if(A?.ok){const V=_t(await A.text());if(V)return V}const Q=await E();if(Q.kind==="data")return Q.data;const P=new Error(`Failed to fetch decofile: ${A?.status??"network error"}`);throw P.status=Rt({liveOk:!!A?.ok,liveStatus:A?.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=Rt({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 N=!!e&&r.kind!=="pending",I=i?0:3e4,_=i?.describe.pollIntervalMs,T=i?"always":void 0;let y;n[27]!==u||n[28]!==s||n[29]!==i?(y=(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]=y):y=n[30];let O;n[31]!==h||n[32]!==k||n[33]!==N||n[34]!==I||n[35]!==_||n[36]!==T||n[37]!==y?(O={queryKey:h,queryFn:k,enabled:N,staleTime:I,refetchInterval:_,refetchIntervalInBackground:!1,refetchOnWindowFocus:T,retry:y,retryDelay:hr},n[31]=h,n[32]=k,n[33]=N,n[34]=I,n[35]=_,n[36]=T,n[37]=y,n[38]=O):O=n[38];const D=C(O);let x;n[39]!==R||n[40]!==D?(x=R&&D.data?So(R,D.data):void 0,n[39]=R,n[40]=D,n[41]=x):x=n[41];const M=x;let m;return n[42]!==M||n[43]!==i?.hosted||n[44]!==D?(m=i?.hosted&&M?{...D,data:M}:D,n[42]=M,n[43]=i?.hosted,n[44]=D,n[45]=m):m=n[45],m}function hr(e){return Qt(5e3,1e3,e,2,0)}function gr(){return null}function vr(){return null}function xi(e,t,n){return ns(e,t,n)}function Pi(e){const t=$.c(4),n=W(),o=re(e?.virtualMcpId,e?.branch),s=lt(e),r=o.kind==="protocol"?o.hosted:void 0;let i;return t[0]!==s||t[1]!==n||t[2]!==r?(i=(a,c)=>Eo(n,r,s,a,c),t[0]=s,t[1]=n,t[2]=r,t[3]=i):i=t[3],i}function $i(e,t){const n=$.c(3),o=re(e?.virtualMcpId,e?.branch),s=lt(e),r=ze(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(br),n[0]=r?.entries,n[1]=t,n[2]=i):i=n[2],i}function br(e){const[t]=e;return t}const wr="site-editor-save",Nn={id:wr,description:void 0,action:void 0,cancel:void 0},ji="site-editor-undo",Le="site-editor-publish";function mr(e){const t=$.c(7),{label:n,detail:o}=e;let s;t[0]!==n?(s=z.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=z.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=z.jsxs("details",{className:"mt-1 text-xs",children:[s,r]}),t[4]=s,t[5]=r,t[6]=i):i=t[6],i}function Mn(e,t){return t?z.jsx(mr,{label:e("siteEditor.details"),detail:t}):void 0}function Ni(e,t,n){ne.error(un(e,t,n),{...Nn,description:Mn(e,Es(t,n))})}function Mi(e,t,n=!1){ne.info(e(t?"sectionsEditor.reconcile.leftDeleted":"sectionsEditor.reconcile.keptTheirs"),{...Nn,description:e(t?n?"sectionsEditor.reconcile.leftDeletedNeverPublishedHint":"sectionsEditor.reconcile.leftDeletedHint":"sectionsEditor.reconcile.keptTheirsHint")})}const An={action:void 0,duration:void 0};function Ai(e,t){ne.success(t?e("siteEditor.publish.publishedOn",{host:t}):e("siteEditor.publish.published"),{...An,id:Le,description:void 0})}function Li(e,{headline:t,body:n,detail:o,retry:s,pending:r,tone:i="error"}){const a=Mn(e,o??null);ne[i](t,{id:Le,description:n&&a?z.jsxs(z.Fragment,{children:[z.jsx("p",{children:n}),a]}):n??a,action:s?{label:e("siteEditor.tryAgain"),onClick:c=>{c.preventDefault(),ne.loading(r??e("thread.publishPopover.publishing"),{...An,id:Le,description:void 0}),s()}}:void 0,duration:s?Number.POSITIVE_INFINITY:void 0})}function Ui(e){return e instanceof Error?e.message||null:e==null?null:String(e)}export{jo as $,Vr as A,ai as B,Pi as C,Si as D,Br as E,fr as F,Z as G,Ws as H,gi as I,fi as J,ve as K,As as L,Ls as M,ti as N,di as O,oi as P,wi as Q,bi as R,Ks as S,Zt as T,Ti as U,ri as V,ss as W,ye as X,qs as Y,ys as Z,rs as _,Qr as a,Zr as a$,Ko as a0,$r as a1,Nr as a2,$i as a3,ns as a4,Mi as a5,ki as a6,ei as a7,et as a8,Kr as a9,vi as aA,hi as aB,st as aC,Di as aD,Rn as aE,qr as aF,Le as aG,An as aH,Ai as aI,mi as aJ,xr as aK,Pr as aL,He as aM,Yr as aN,_i as aO,si as aP,ee as aQ,ni as aR,Li as aS,ji as aT,Nn as aU,S as aV,p as aW,Ye as aX,Tn as aY,So as aZ,ii as a_,tr as aa,rr as ab,ot as ac,Ei as ad,Ii as ae,Ni as af,yi as ag,En as ah,is as ai,zr as aj,pi as ak,Oi as al,Fr as am,Wr as an,Ot as ao,Et as ap,Gr as aq,ms as ar,Hr as as,ho as at,Mn as au,Ui as av,Ns as aw,jr as ax,so as ay,mr as az,$o as b,ci as b0,li as b1,ui as b2,nn as c,fo as d,Ur as e,go as f,qo as g,Xr as h,Jt as i,bs as j,Ri as k,lt as l,Cr as m,Jr as n,Os as o,Mr as p,os as q,Lr as r,Ar as s,xi as t,re as u,Qs as v,Cs as w,$s as x,ks as y,Kt as z};
|
|
1
|
+
import{c as $,q as W,i as C,K as g,eX as Ue,d2 as Un,aE as Mt,aF as K,b9 as Qe,ba as Qn,e8 as De,e6 as Cn,bV as pe,eY as Fn,eZ as Bn,r as L,e_ as Vn,e$ as G,f0 as X,bA as Hn,a as Jn,as as _e,a4 as Wn,bz as At,f1 as Gn,f2 as Lt,aq as Yn,bh as F,bo as Ut,f3 as zn,f4 as Xn,f5 as Zn,t as ne,j as z}from"./index-BYLma6nR.js";import{u as Ce}from"./repository-binding-BkD30urH.js";import{e as Qt}from"./backoff-CrEUbyZT.js";import{b as Se}from"./sandbox-url-D3mC8qhT.js";import{u as qn}from"./chat-context-DrqBnMGV.js";import{i as Kn,u as eo}from"./use-sandbox-events-DEsMUhZf.js";import{u as Fe}from"./use-blocks-v8-project-BM6s65-m.js";import{u as Ct}from"./use-voice-input-CaKlieI0.js";import{s as ut}from"./thread-intent-D7K3VC0B.js";import{s as to}from"./utils-B4FS_bBy.js";import{a as no}from"./sandbox-git-api-DcqI6XE4.js";const p={MethodNotFound:-32601,InvalidParams:-32602,InternalError:-32603,NotFound:-32001,Conflict:-32002,InvalidBlock:-32003,ReadOnly:-32005,Unsupported:-32006,LimitExceeded:-32007,Unavailable:-32008,Unauthorized:-32010};class S 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 S(t.code,t.message,t.data)}}const te="deco-content",Te={major:1},Ft=1;async function oo(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 Re={major:Te.major,minor:Ft},Bt=`the endpoint speaks an older ${te} than this client needs (${Re.major}.${Re.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:{...Re}};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 S(p.Unsupported,e,o)}function Vt(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!==Te.major)throw ae(`the endpoint speaks ${te} ${String(o?.major)}.x; this client speaks ${Te.major}.x`,"major",t);if(typeof o.minor!="number"||o.minor<Ft)throw ae(Bt,"outdated",t);return e}function ft(e,t){return t.code===p.MethodNotFound&&e.startsWith("changes.")?ae(Bt,"outdated"):S.from(t)}function Be(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 oo(a)}catch{throw new S(p.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?S.from(l):new S(p.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 ft(r,c.error);return c.result};return{call:s,describe:async()=>Vt(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:ft(r[u].method,d.error)}:{ok:!0,result:d.result}:{ok:!1,error:new S(p.InternalError,"no response for this call")}})}}}function Ve(e){return e&&!e.edited?{ifNoneMatch:e.revision}:{}}const dt=20,ht=5,gt=500;function He(e){return e instanceof S?e.code===p.MethodNotFound?!0:e.code===p.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 so(e,t,n){const o=g.contentChanges(n),s=e.getQueryData(o),r=await t.changesList(Ve(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 S(p.InternalError,"changes.list returned notModified without a cached list");return c}async function Ht(e,t){const n=[];for(let r=0;r<t.length;r+=dt)n.push(t.slice(r,r+dt));const o=Object.create(null),s=[];for(let r=0;r<n.length;r+=ht){const i=await e.batch(n.slice(r,r+ht).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 xr(e,t){let n={revision:"",versions:{}};for(let o=0;o<t.length;o+=gt){const s=t.slice(o,o+gt),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 Pr(e){return e instanceof S&&e.code===p.Conflict}function Je(e){return e?.kind==="protocol"?e:null}function $r(e,t,n){const o=$.c(14);let s;o[0]!==n?(s={},o[0]=n,o[1]=s):s=o[1];const r=s,i=W();let a;o[2]!==e?(a=Je(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?()=>so(i,c.client,t):Ue,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 ro(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 jr(e,t,n){const o=$.c(14);let s;o[0]!==e?(s=Je(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??"",ro(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?()=>Ht(r.client,a):Ue,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 Nr(e,t,n){const o=$.c(16);let s;o[0]!==e?(s=Je(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(uo).map(lo).sort(co);a=f.map(ao);const h=JSON.stringify(f.map(io));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 Ht(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}:Ue,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:Un},o[13]=c,o[14]=u,o[15]=d):d=o[15],l(d)}function io(e){return[e.name,e.base]}function ao(e){return e.name}function co(e,t){return e.name<t.name?-1:e.name>t.name?1:0}function lo(e){const[t,n]=e;return{name:t,base:n.baseVersion??""}}function uo(e){const[,t]=e;return t.kind==="delete"}function Jt(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 Wt=Mt({endpoint:K().max(2048).refine(e=>Jt(e)&&new URL(e).pathname==="/rpc").transform(he)});function Mr(e){const t=new URLSearchParams(e.replace(/^#/,"")),n=Wt.safeParse({endpoint:t.get("endpoint")??""});return n.success?n.data:null}function Gt(e){const t=Wt.safeParse(e);return t.success?t.data:null}const Yt="studio:deco-serve-last";function Ar(e){try{localStorage.setItem(Yt,JSON.stringify(e))}catch{}}function Lr(){try{const e=localStorage.getItem(Yt);return e?Gt(JSON.parse(e)):null}catch{return null}}function Ur(e){try{return new URL(he(e)).host}catch{return e}}function fo(e,t=1e4){return Math.min(1e3*2**Math.max(0,e-1),t)}const ho="http://localhost:4545/rpc";class We extends Error{constructor(t="the endpoint isn't deco serve"){super(t),this.name="NotDecoServeError"}}function go(e){if(e instanceof We)return{reason:"not-deco-serve"};if(!(e instanceof S))return{reason:"not-answering"};switch(e.code){case p.Unauthorized:case p.MethodNotFound:return{reason:"outdated"};case p.Unsupported:return He(e)?{reason:"outdated"}:{reason:"version-mismatch"};case p.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 Qr(e,t){if(e)return[he(e.endpoint)];const n=[t?.endpoint,ho].filter(o=>!!o).map(he);return[...new Set(n)]}const vo=Mt({blocks:De(K(),De(K(),Cn()).refine(Qe)),versions:De(K(),K().min(1)),missing:Qn(K())});function bo(e,t){const n=vo.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&&Qe(e.blocks[t])&&e.versions[t]===n.version}function wo(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 mo(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 vt=50,bt=10;function po(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:pe(),body:JSON.stringify(o.map((c,l)=>({jsonrpc:"2.0",id:s[l],method:c.method,params:c.params??{}})))}));if(!r.ok)throw new S(p.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:S.from(l.error)}:{ok:!0,result:l.result}:{ok:!1,error:new S(p.InternalError,"no response for this call")}})}}}function So(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]={[Bn]:!0,...s.meta?.type?{__resolveType:s.meta.type}:{},...s.meta?.path!==void 0?{path:s.meta.path}:{},...s.meta?.refs?.length?{[Fn]:s.meta.refs}:{}}}for(const[o,s]of Object.entries(t??{}))Object.hasOwn(n,o)||(n[o]=s);return n}function yo(e,t){return e?.entries[t]?.meta?.refs??[]}function ko(e,t){return Object.hasOwn(e.draft,t)?e.draft[t]?.version??null:null}function Ge(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function xe(e,t){if(Array.isArray(e)){for(const n of e)xe(n,t);return}if(Ge(e))for(const[n,o]of Object.entries(e))n==="__resolveType"&&typeof o=="string"?t.add(o):xe(o,t)}function zt(e,t){if(!Ge(e))return;const n={};typeof e.__resolveType=="string"&&(n.type=e.__resolveType),typeof e.path=="string"&&(n.path=e.path);const o=new Set;xe(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 Xt(e,t,n,o){G(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===X){delete r[c],i[c]={operation:"delete",version:X,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 Oo(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 wt=new WeakMap;async function Ye(e,t,n,o,s=new Set){const r=e.getQueryData(g.contentIndex(n));if(!r)throw new S(p.Unavailable,"The CMS index is not loaded yet");let i=wt.get(e);i||(i=new Map,wt.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)||Qe(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=Do(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 S(p.Unavailable,"A CMS block changed while loading; try again")}async function Eo(e,t,n,o,s){if(!t){const i=o?.[s];return Ge(i)&&!Hn(i)?i:void 0}await Ye(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 Do(e,t,n,o){const s=ge(e,n),r=[];for(let i=0;i<o.length;i+=vt)r.push(o.slice(i,i+vt));for(let i=0;i<r.length;i+=bt){const a=r.slice(i,i+bt),c=await t.batch(a.map(l=>({method:"cms.blocks",params:{names:l}})));if(c.length!==a.length)throw new S(p.InternalError,"Incomplete CMS batch response");for(const[l,u]of c.entries()){if(!u.ok)throw u.error;const d=bo(u.result,a[l]),f=ge(e,n),h=wo(s,f,d);if(G(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 S(p.Unavailable,"The CMS index changed while loading blocks; try again")}}}function ze(e){const t=$.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:Io,staleTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:s}=C(o);return s}async function Io(){throw new Error("the content index is set by the poll")}function mt(e,t){const n=$.c(8);let o;n[0]!==t?(o=Vn(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 pt=3e4;function _o(e){if(!(e instanceof S))return;const t=e.data?.retryAfterMs;return typeof t=="number"&&t>0?t:void 0}function To(e,t,n,o){const s=$.c(15),r=W(),i=ze(t);let a;s[0]!==t?(a=g.decofile(t),s[0]=t,s[1]=a):a=s[1];const c=mt(r,a);let l;s[2]!==t?(l=g.contentVersions(t),s[2]=t,s[3]=l):l=s[3];const u=mt(r,l),d=o?.withRefs??!1,f=new Set(n);if(d)for(const m of n)for(const E of yo(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)),w=JSON.stringify(h.map(m=>[m,i?.entries[m]?.version,oe(v,m)])),[R,k]=L.useState(null),[N,I]=L.useState(0),_=R?.key===w?R:null;L.useEffect(()=>{if(!e||!w)return;let m=!0;const E=JSON.parse(w).map(Po);return Ye(r,e,t,E).then(()=>{m&&k(j=>j?.key===w?null:j)},j=>{m&&k(U=>({key:w,count:(U?.key===w?U.count:0)+1,retryAfterMs:_o(j)}))}),()=>{m=!1}},[e,r,t,w,N]);let T;s[4]!==_||s[5]!==I?(T=()=>{if(!_)return;const m=Math.min(pt,_.retryAfterMs??Qt(pt,1e3,_.count-1,2,.5)),E=setTimeout(()=>I(xo),m);return()=>clearTimeout(E)},s[4]=_,s[5]=I,s[6]=T):T=s[6];let y;s[7]!==_?(y=[_],s[7]=_,s[8]=y):y=s[8],L.useEffect(T,y);const O=!e||mo(v,[...f],o?.listing),D=!!e&&b&&_!==null;let x;s[9]!==I?(x=()=>I(Ro),s[9]=I,s[10]=x):x=s[10];let M;return s[11]!==O||s[12]!==D||s[13]!==x?(M={ready:O,failed:D,retry:x},s[11]=O,s[12]=D,s[13]=x,s[14]=M):M=s[14],M}function Ro(e){return e+1}function xo(e){return e+1}function Po(e){const[t]=e;return t}const Zt=L.createContext(null);function $o(e){const t=$.c(24),n=L.useContext(Zt),o=Fe(n?null:e),{data:s}=Jn.useSession(),r=s?.user?.id??"",i=!!e&&!!r;let a;t[0]!==i||t[1]!==r||t[2]!==e?(a=i?_e.decoServeConnection(r,e):null,t[0]=i,t[1]=r,t[2]=e,t[3]=a):a=t[3];const[c,l]=yt(a);let u;t[4]!==i||t[5]!==r||t[6]!==e?(u=i?_e.decoServeEndpoint(r,e):null,t[4]=i,t[5]=r,t[6]=e,t[7]=u):u=t[7];const[d,f]=yt(u);if(n)return n;let h;t[8]!==c||t[9]!==i||t[10]!==o?(h=i&&o?Gt(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 w;t[12]!==f||t[13]!==l||t[14]!==i?(w=N=>{i&&(l(N),f(N.endpoint))},t[12]=f,t[13]=l,t[14]=i,t[15]=w):w=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]!==w||t[22]!==R?(k={connection:v,lastEndpoint:b,set:w,clear:R},t[19]=v,t[20]=b,t[21]=w,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 yt(e){const t=$.c(17),n=W(),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 qt(e,t=""){return{source:e,cacheKeySuffix:e==="github"?"":e==="sandbox"?":sandbox":`:serve:${t}`}}function jo(e){return JSON.stringify([e.kind==="legacy"?"legacy":"protocol",e.source,e.cacheKeySuffix])}function Cr(e){return e.kind==="protocol"||e.kind==="unavailable"}function Fr(e){const t=e.hasOrg?e.orgFlag:!1,{backend:n}=e;return n===null||n==="legacy"?t:!0}function Br(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 Vr(e){if(e.kind!=="protocol"||e.source!=="local")return null;const t=e.describe.preview?.url;return t&&Jt(t)?t:null}function Hr(e,t){return e.kind!=="protocol"||e.source!=="local"||!e.describe.assets||!t?null:new URL(t.endpoint).origin}function Kt(e){return e.hasServeConnection?"local":e.runtime==="sandbox"?"sandbox":"github"}function No(e){if(!e.hasProject)return"legacy";const t=Kt(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 Mo(e){return{github:e.v8&&e.mode==="github",sandbox:e.v8&&e.mode==="sandbox"&&e.workingTreeReady}}function kt(e){return e.isError||e.errorUpdateCount>0}function Ao(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 Lo(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 en="__noSchema";function tn(){return{manifest:{blocks:{}},schema:{definitions:{},root:{}},[en]:!0}}function Jr(e){return!!e&&e[en]===!0}function Xe(e){if(!e.ok)return e.error.code===p.NotFound;const t=e.result;return t.notModified===!1&&t.schema===null}function Uo(e,t){return(typeof t.name=="string"?t.name.trim():"")||e}const Qo=(e,t)=>e.label.localeCompare(t.label)||e.key.localeCompare(t.key);function Wr(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:Uo(n,s)}),t.set(r,i)}return[...t.entries()].map(([n,o])=>({resolveType:n,blocks:o.sort(Qo)})).sort((n,o)=>n.resolveType===null?1:o.resolveType===null?-1:Ot(n.resolveType).localeCompare(Ot(o.resolveType))||n.resolveType.localeCompare(o.resolveType))}function Ot(e){return(e.split("/").filter(Boolean).at(-1)??e).replace(/\.(tsx?|jsx?)$/,"")||e}function Et(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]=Et(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?Et(r[a],s,n):r[a];return i}return e}function Gr(e){if(e.trim()==="")return null;const t=Number(e);return Number.isFinite(t)?t:null}class Dt extends Error{}const Ze="site-not-owned";async function Co(e){return e.status!==409?!1:(await e.clone().json().catch(()=>null))?.code==="site_not_owned"}async function Fo(e,t=n=>fetch(n)){const n=Be({endpoint:e,fetch:async o=>{const s=await t(new Request(o,{signal:pe(o.signal)}));if(await Co(s))throw new Dt;return s}});try{return await Ke(n)}catch(o){if(o instanceof Dt)return Ze;throw o}}async function Bo(e,t,n){await t();const o=await Fo(e,n);return o===Ze?o:{...o,hosted:po(e,n)}}const qe=5e3;function Vo(e){if(!e.site)throw new Error("this project names no site");return Gn(e.site,e.branch)}function Ho(e){return new URL(Se(e,"rpc"),window.location.origin).href}async function Ke(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 We;const s=Vt(t.result);if(!n)throw new Error("no schema.get");if(Xe(n))return{client:e,describe:s,hasSchema:!1};if(n.ok)return{client:e,describe:s,hasSchema:!0};throw n.error}function Jo(e,t=n=>fetch(n)){return Ke(Be({endpoint:e,fetch:n=>t(new Request(n,{signal:pe(n.signal)}))}))}function re(e,t){const n=$.c(40),{org:o}=Wn(),{connection:s}=$o(e),{runtime:r}=Ct(e),i=L.useContext(Zt),a=Fe(e),c=At(Ce(e)?.metadata),l=Kt({hasServeConnection:!!s,runtime:r}),u=qt(l,s?.endpoint??""),d=qn()?.taskId??null,f=Kn(eo().lifecycle.phase),h=W(),v=Mo({mode:l,v8:a,workingTreeReady:f}),b=v.github&&!!o.slug&&!!e&&!!t,w=C({queryKey:g.contentBackend(o.slug,e??"",t??"","github"),queryFn:()=>Bo(Vo({orgSlug:o.slug,site:c,branch:t}),()=>Lt(c,t)),enabled:b,staleTime:Number.POSITIVE_INFINITY,...It}),R=v.sandbox&&!!o.slug&&!!e&&!!t;let k;n[0]!==t||n[1]!==o.slug||n[2]!==d||n[3]!==e?(k=()=>Jo(Ho({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 N=C({queryKey:g.contentBackend(o.slug,e??"",t??"","sandbox",d??""),queryFn:k,enabled:R,staleTime:Number.POSITIVE_INFINITY,...It}),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=()=>qo(s.endpoint),n[9]=s,n[10]=T):T=n[10];let y;n[11]!==I||n[12]!==_||n[13]!==T?(y={queryKey:_,queryFn:T,enabled:I,staleTime:Number.POSITIVE_INFINITY,retry:Yo,retryDelay:Go,refetchInterval:Wo},n[11]=I,n[12]=_,n[13]=T,n[14]=y):y=n[14];const O=C(y);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 M;n[19]!==s?.endpoint||n[20]!==o.slug||n[21]!==e?(M=g.contentBackend(o.slug,e??"","local-describe",s?.endpoint??""),n[19]=s?.endpoint,n[20]=o.slug,n[21]=e,n[22]=M):M=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 Ln=q;throw h.invalidateQueries({queryKey:x,exact:!0},{cancelRefetch:!1}),Ln}},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]!==M||n[28]!==m||n[29]!==E?(j={queryKey:M,queryFn:m,enabled:E,refetchInterval:qe,retry:!1},n[27]=M,n[28]=m,n[29]=E,n[30]=j):j=n[30];const A=C(j).data??O.data?.describe,Q=No({hasProject:!!e,hasServeConnection:!!s,runtime:r,v8:a,githubSite:w.data===Ze?"not-owned":w.data?"ready":kt(w)?"error":"loading",sandboxSite:zo({data:N.data,isError:kt(N),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{...Pe(u,w.data),site:c};if(Q==="site-not-owned-github")return{kind:"unavailable",...u,siteNotOwned:!0};if(Q==="protocol-sandbox")return Pe(u,N.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,V=s?.endpoint??"";let H;return n[33]!==A||n[34]!==O.data||n[35]!==O.failureCount||n[36]!==O.isError||n[37]!==V||n[38]!==P?(H=Zo({probed:O.data,isError:O.isError,failureCount:O.failureCount,failure:P,describe:A,endpoint:V}),n[33]=A,n[34]=O.data,n[35]=O.failureCount,n[36]=O.isError,n[37]=V,n[38]=P,n[39]=H):H=n[39],H}function Wo(e){return e.state.status==="error"||e.state.data?.hasSchema===!1?qe:!1}function Go(e){return fo(e+1)}function Yo(e,t){return!(t instanceof S)&&!(t instanceof We)}function zo(e){return e.data!==void 0?"ready":e.workingTreeReady?e.isError?"error":"loading":"unavailable"}const Xo=3;function Zo(e){const t=qt("local",e.endpoint),n=e.probed?Pe(t,{...e.probed,describe:e.describe??e.probed.describe}):null;return e.isError||e.failureCount>0?n?.kind==="protocol"&&!e.isError&&e.failureCount<Xo?n:{kind:"unavailable",...t,problem:go(e.failure)}:n??{kind:"pending",...t}}const It={retry:2,refetchInterval:e=>e.state.status==="error"?qe:!1};function Pe(e,t){return{kind:"protocol",...e,client:t.client,describe:t.describe,hasSchema:t.hasSchema,...t.hosted?{hosted:t.hosted}:{}}}function qo(e,t){return Ke(Be({endpoint:e,fetch:n=>fetch(n,{signal:pe(t?AbortSignal.any([t,n.signal]):n.signal)})}))}function $e(e){const t=`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`;return e.protocolSuffix?`${t}${e.protocolSuffix}`:e.localPreviewUrl?`${t}:local:${e.localPreviewUrl}`:t}function Ko(e,t){return $e({...e,protocolSuffix:t.cacheKeySuffix})}function es(e,t,n){return e?t==="pending"?{ready:!1,failed:!1}:t==="unavailable"?{ready:!1,failed:!0}:n:{ready:!0,failed:!1}}function ts(e,t){return JSON.stringify([e?.orgSlug,e?.virtualMcpId,e?.branch,jo(t)])}function ns(e,t,n){const o=$.c(21),s=W(),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?Ko(e,i):"",o[0]=i,o[1]=e,o[2]=a):a=o[2];const c=To(i?.hosted,a,t,n),l=e!==null;let u;o[3]!==r.kind||o[4]!==c||o[5]!==l?(u=es(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=ts(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 w=r.source;s.resetQueries({queryKey:g.contentBackend(e.orgSlug,e.virtualMcpId,...w==="local"?["local"]:[e.branch,w])})},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 nn(e){const t=$.c(12);let n;t[0]!==e?(n=_e.localPreviewUrl(e??""),t[0]=e,t[1]=n):n=t[1];const o=n,[s,r]=Yn(o,null),i=Fe(e);let a;t[2]!==s||t[3]!==e?(a=e?ut(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(ut(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}function os(e,t){const n=(e??"").trim().replace(/^[/\\]+|[/\\]+$/g,"");return n?`${n}/${t}`:t}function _t(e){let t;try{t=JSON.parse(e)}catch{return null}return typeof t!="object"||t===null||Array.isArray(t)?null:t}function ye(e,t,n){return["decofile-write",e,t,n]}function ss(e,t,n){return{id:ye(e,t,n).join(":")}}class et 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 tt(e){return`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`}function nt(e){return`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}`}async function rs(e,t){const n=await e.json().catch(()=>({}));throw new Error(n.error??`${t} failed (${e.status})`)}function is(e,t,n){e.setQueryData(g.decofileDraft(tt(t)),n)}function as(e,t){return e.getQueryData(g.decofileDraft(tt(t)))??null}async function cs(e,t){return(await fetch(nt(e),{cache:"no-store",headers:{"if-none-match":`"${t}"`}}).catch(()=>null))?.status===200}function Yr(e){const t=$.c(4);let n;t[0]!==e?(n=g.decofileDraft(e?tt(e):""),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:ls,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 ls(){throw new Error("decofileDraft is populated by reads/writes, not fetched")}async function us(e,t){const n=await fetch(nt(t),{cache:"no-store"});if(!n.ok){const s=new Error(`Failed to fetch decofile: ${n.status}`);throw s.status=n.status,s}const o=await n.json();return o.token&&is(e,t,{version:o.version,token:o.token,apiHost:o.apiHost??window.location.host}),o.decofile}async function zr(e,t){const n=await fetch(nt(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 et(s.blocks??[],s.error??"Block changed"):new Error(s.error??`Save failed (${n.status})`)}if(!n.ok)return rs(n,"Save");const o=await n.json();return{...o,apiHost:o.apiHost??window.location.host}}const on=3e3,fs=15e3,ds=2*6e4,sn={now:()=>Date.now(),setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),hidden:()=>typeof document<"u"&&document.visibilityState==="hidden"};function hs(e){return e<ds?on:fs}function gs(e,t=sn){const n=t.now();let o=!1,s=!1,r=null;const i=()=>{o||(r=t.setTimeout(a,hs(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 Tt=()=>0;function vs(e,t,n=sn){const o=L.useRef(t);o.current=t;const[s]=L.useState(()=>({polling:()=>gs(()=>o.current,n),idle:()=>()=>{}}));L.useSyncExternalStore(e?s.polling:s.idle,Tt,Tt)}function rn(e,t){return Se(e,t)}function bs(e,t){return Se(e,"preview-fetch",{path:t})}function Xr(e){return rn(e,"preview-invoke")}function Zr(e){return rn(e,"catalog-invoke")}function an(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 ws(){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&&an(n))return n}return null}function ms(e,t){const n=e.previewUrl??e.getFallbackPreviewUrl?.()??ws();return n&&an(n)?new URL(t,n).toString():bs(e,t)}function ps(e){return ms(e,"/.decofile")}function Ss(e){return e===400?"absent":e===404?"unavailable":e>=200&&e<300?"ok":"error"}function Rt(e){return e.liveOk||e.committedAbsent?404:e.liveStatus??502}async function ys(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=Ss(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:to(r.content)}}async function ks(e,t){const n=await ys(e,t);if(n.kind!=="data")return n;try{return{kind:"data",data:JSON.parse(n.data)}}catch{return{kind:"unavailable"}}}async function qr(e){const t=`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}/meta`,n=await fetch(t,{cache:"no-store"});if(n.status===404)return{kind:"absent"};if(!n.ok){const o=new Error(`Failed to read committed meta: ${n.status}`);throw o.status=n.status,o}try{return{kind:"data",data:await n.json()}}catch{return{kind:"unavailable"}}}function Os(e){return Ce(e)?.metadata?.runtime?.path??null}function je(e,t,n,o){const s=F(e),r=Object.keys(n?.changes??{}).find(a=>F(a)===s);if(r!==void 0&&n)return n.changes[r].baseVersion;const i=Object.keys(t?.draft??{}).some(a=>F(a)===s);if(t&&!i){const a=Object.keys(t.entries).find(c=>F(c)===s);return a===void 0?null:t.entries[a].version}return o?.[e]??null}class cn extends Error{constructor(t){super(t instanceof Error?t.message:String(t),{cause:t}),this.name="ServeLostError"}}function Kr(e){return e instanceof S&&e.code===p.Conflict}function ln(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 ot extends Error{constructor(){super("The draft's changes couldn't be read"),this.name="HostedDraftUnreadError"}}class st extends Error{constructor(){super("The blocks kept changing while the change was saved"),this.name="HostedKeptChangingError"}}function ei(e,t){return(t instanceof ot||t instanceof st)&&(t.message=un(e,t,"github")),t}function un(e,t,n){if(t instanceof ot)return e("siteEditor.save.draftUnread");if(t instanceof st)return e("siteEditor.save.keptChanging");if(t instanceof et)return t.message;if(n==="local")return Ds(e,t);if(t instanceof S)switch(t.code){case p.Conflict:return e("siteEditor.save.conflict");case p.ReadOnly:return e("siteEditor.save.readOnly");case p.InvalidBlock:case p.InvalidParams:return e("siteEditor.save.invalid");case p.LimitExceeded:return e("siteEditor.save.tooLarge")}return e("siteEditor.save.failed")}function Es(e,t){if(t==="local"||e instanceof et||e instanceof ot||e instanceof st)return null;if(e instanceof S){const n=e.code===p.InvalidBlock||e.code===p.InvalidParams?ln(e):e.message;return n?`${e.code}: ${n}`:null}return e.message||null}function Ds(e,t){if(t instanceof cn)return e("decoServe.save.serverGone");if(t instanceof S)switch(t.code){case p.Conflict:return e("decoServe.save.conflict");case p.ReadOnly:return e("decoServe.save.readOnly");case p.InvalidBlock:case p.InvalidParams:return e("decoServe.save.invalid",{detail:ln(t)});case p.LimitExceeded:return e("decoServe.save.tooLarge")}return e("sectionsEditor.sectionsEditor.saveFailed",{error:t.message})}function Is(e,t,n){return e===null?0:Math.max(0,n-Math.max(0,t-e))}function _s(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=Is(s.current,Date.now(),t);if(i===0){r();return}const a=setTimeout(r,i);return()=>clearTimeout(a)},[e,n,t]),n}const Ts="decocms:content-writes",Ne=new Set;let Y;function fn(){if(Y!==void 0)return Y;Y=null;try{typeof BroadcastChannel=="function"&&(Y=new BroadcastChannel(Ts),Y.addEventListener("message",e=>{const t=e.data?.cacheKey;if(typeof t=="string")for(const n of[...Ne])n(t)}))}catch{Y=null}return Y}function Rs(e){try{fn()?.postMessage({cacheKey:e})}catch{}}function xs(e){return fn(),Ne.add(e),()=>{Ne.delete(e)}}const dn="__at=",hn="__test=",Ps=/^[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 $s(e){return e.at!==void 0||Object.keys(e.tests??{}).length>0}function ee(e){return typeof e=="string"&&Ps.test(e)}function xt(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)}function js(e){const t=e.tests??{};return[...e.at!==void 0?[dn+xt(e.at)]:[],...Object.keys(t).map(n=>hn+xt(`${n}=${t[n]?"on":"off"}`))]}function Pt(e,t){const o=[...e.split("&").filter(s=>s&&!s.startsWith(dn)&&!s.startsWith(hn)),...t];return o.length>0?`?${o.join("&")}`:""}function ve(e,t){const n=js(t),o=e.indexOf("?"),s=o===-1?e:e.slice(0,o);if(ee(s))return s+Pt(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}${Pt(l,n)}${e.slice(r)}`}function ti(e,t,n){if(!$s(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 ni(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 gn(e){return btoa(encodeURIComponent(e))}function oi(e,t,n){const o=Ns(e,t,n);return o.searchParams.set("__cb",crypto.randomUUID()),o.toString()}function Ns(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",gn(JSON.stringify({path:"/",sections:[{__resolveType:n}]}))),s}const Ms="__draft";function si(e){return`${`${e.apiHost}/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}?token=${e.token}`}@${e.version}`}const As="off";function Ls(e,t){if(!t)return e;const n=new URL(e);return n.searchParams.set(Ms,t),n.toString()}function ri(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 ii(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",gn(JSON.stringify({sections:i}))),r.toString()}function ai(e){return e.fastPreviewActive&&e.previewServerUrl?e.previewServerUrl:e.sandboxUrl??null}const $t="__variant=";function vn(e,t,n){return`${e}@${t}=${n}`}function ci(e,t){return!e||!t.multivariate||t.variants.length<=1?[]:t.index<0||t.index>=t.variants.length?[]:[vn(e,"sections",t.index)]}function li(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[vn(e.pageKey,o,e.selectedVariantIndex)]}function ui(e,t){return[...t,...e]}function Us(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)}function rt(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+Us(l))],c=a.length>0?`?${a.join("&")}`:"";return`${r}${c}${e.slice(n)}`}function fi(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 rt(`${s}${o.pathname}@local`,t)}catch{return null}}function di(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",rt(o,t)),n.toString())}catch{return e}}function Qs(e){const{pointer:t}=e;if(!t||t===As)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(rt(t,e.forcedVariants),e.previewOptions)}function Cs(e,t){if(!e||!t)return null;try{return Ls(e,t)}catch{return null}}function hi(e,t,n){if(!e||!n)return null;try{return Cs(new URL(t,e).toString(),n)}catch{return null}}const be={forcedVariants:[],previewOptions:{}},ce=new Map,le=new Map,Me=new Map;function bn(e){for(const t of Me.get(e)??[])t()}function wn(e,t){const n=ee(t)?t:null;(le.get(e)??null)!==n&&(n?le.set(e,n):le.delete(e),bn(e))}function Fs(e){return le.get(e)??null}function Bs(e,t){return JSON.stringify(e)===JSON.stringify(t)}function gi(e,t){const n=ce.get(e)??be,o=t??be;Bs(n,o)||(t?ce.set(e,o):ce.delete(e),bn(e))}function Vs(e){return ce.get(e)??be}function mn(e,t){let n=Me.get(e);return n||(n=new Set,Me.set(e,n)),n.add(t),()=>{n.delete(t)}}function Hs(e){const t=$.c(3);let n,o;return t[0]!==e?(n=s=>mn(e,s),o=()=>Vs(e),t[0]=e,t[1]=n,t[2]=o):(n=t[1],o=t[2]),L.useSyncExternalStore(n,o,Js)}function Js(){return be}function Ws(e){const t=$.c(3);let n,o;return t[0]!==e?(n=s=>e?mn(e,s):Ys,o=()=>e?Fs(e):null,t[0]=e,t[1]=n,t[2]=o):(n=t[1],o=t[2]),L.useSyncExternalStore(n,o,Gs)}function Gs(){return null}function Ys(){}function vi(e,t){const n=$.c(4),o=Hs(e),s=Ws(e);let r;return n[0]!==o||n[1]!==s||n[2]!==t?(r=Qs({pointer:t,heldRevision:s,...o}),n[0]=o,n[1]=s,n[2]=t,n[3]=r):r=n[3],r}const pn={phase:"idle",inFlight:0,reload:{seq:0,navigates:!1},epoch:0},zs=15e3,we=new Map;function Z(e,t){return`${e}/${t}`}function B(e){let t=we.get(e);return t||(t={state:pn,listeners:new Set,previews:0,timer:null,discardListeners:new Set},we.set(e,t)),t}function J(e,t){const n=B(e);n.state={...n.state,...t};for(const o of n.listeners)o()}function ke(e){e.timer&&clearTimeout(e.timer),e.timer=null}function it(e){return we.get(e)?.state??pn}function Xs(e,t){const n=B(e);return n.listeners.add(t),()=>{n.listeners.delete(t)}}function bi(e){const t=B(e);return t.previews++,()=>{t.previews--,t.previews===0&&t.state.phase==="reloading"&&(ke(t),J(e,{phase:"idle"}))}}function wi(e){const t=we.get(e);!t||t.state.phase!=="reloading"||(ke(t),J(e,{phase:"idle"}))}function Sn(e){const t=B(e);ke(t),J(e,{phase:"saving",inFlight:t.state.inFlight+1})}function ue(e,t){const n=B(e),o=Math.max(0,n.state.inFlight-1);if(o>0){J(e,{inFlight:o});return}if(!t.ok||n.previews===0){J(e,{phase:"idle",inFlight:o});return}yn(e,t.navigates,o)}function yn(e,t,n=0){const o=B(e);ke(o),o.timer=setTimeout(()=>{o.timer=null,o.state.phase==="reloading"&&J(e,{phase:"idle"})},zs),J(e,{phase:"reloading",inFlight:n,reload:{seq:o.state.reload.seq+1,navigates:t}})}function Zs(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")return await c,{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:no(o,s,r)})),Zs(i)&&l&&!t.adopted&&d.push(n.invalidateQueries({queryKey:l})),await Promise.all(d),t.kind!=="edit"){const v=Z(o,s);J(v,{epoch:it(v).epoch+1})}const f=l?JSON.stringify(n.getQueryData(l)??null):null,h=u!==f;return h&&await new Promise(v=>Ut.schedule(v)),{navigates:h}}async function qs(e,t){return Sn(Z(e.orgSlug,e.virtualMcpId)),kn(e,t)}function jt(e){return e.branch?JSON.stringify(e.queryClient.getQueryData(g.protocolDraftRead(e.orgSlug,e.virtualMcpId,e.branch))??null):null}async function kn(e,t){const n=Z(e.orgSlug,e.virtualMcpId),o=t.adopted?jt(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&&Rs(e.cacheKey),wn(n,t.shownRevision?.(s)??null),t.adopted){const i=jt(e)!==o;return i&&await new Promise(a=>Ut.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 mi(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:s,branch:r}=e,i=Z(o,s),a=new Set(t.blockKeys);for(const u of[...B(i).discardListeners])u(a);Sn(i);let c=!1;const l=()=>(c=!0,kn(e,{kind:"discard",reread:!0,write:t.write}));return r?n.getMutationCache().build(n,{mutationKey:ye(o,s,r),scope:ss(o,s,r),mutationFn:l}).execute(void 0).catch(u=>{throw c||ue(i,{ok:!1,navigates:!1}),u}):l()}function pi(e,t,n){const o=$.c(8);let s;o[0]!==e||o[1]!==t?(s=Z(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=B(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 On(e){const t=Z(e.orgSlug,e.virtualMcpId);it(t).inFlight>0||(wn(t,null),fe(e,{kind:"external"}).then(({navigates:n})=>{const o=B(t);o.previews>0&&o.state.inFlight===0&&yn(t,n)}).catch(()=>{}))}function Ks(e,t){const n=$.c(7);let o;n[0]!==e||n[1]!==t?(o=Z(e,t),n[0]=e,n[1]=t,n[2]=o):o=n[2];const s=o;let r;n[3]!==s?(r=l=>Xs(s,l),n[3]=s,n[4]=r):r=n[4];const i=r;let a;n[5]!==s?(a=()=>it(s),n[5]=s,n[6]=a):a=n[6];const c=a;return L.useSyncExternalStore(i,c,c)}const er=500;function Si(e,t){const{phase:n}=Ks(e,t);return _s(n!=="idle",er)}function tr(e){const t=new Error(`${e} unavailable (content server unreachable)`);return t.status=502,t}function En(e,t){return g.liveMeta(e.orgSlug,e.virtualMcpId,e.branch,`protocol${t.cacheKeySuffix}`,"")}function yi(e,t,n,o){if(o?.source==="github"){const i=e.getQueryData(g.contentIndex(t));return i?ko(i,n):nr(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 Dn(e,t){if(Object.hasOwn(e.changes,t))return e.changes[t];const n=F(t),o=Object.keys(e.changes).find(s=>F(s)===n);return o===void 0?void 0:e.changes[o]}function nr(e,t,n){const o=e.getQueryData(g.contentChanges(t));if(o)return In(o,Oe(e,t),n)}function In(e,t,n){const o=Dn(e,n);return o?.kind==="delete"?o.version??X:o?o.version:t.has(F(n))?X:null}function ki(e,t,n){const o=e.getQueryData(g.contentChanges(t));if(!o)return!1;const s=Dn(o,n);return s?s.kind==="set"&&s.baseVersion===null:Oe(e,t).has(F(n))}function Oi(e,t){const n=e.getQueryData(g.decofile(t)),o=e.getQueryData(g.contentChanges(t));if(!n||!o)return null;const s=Oe(e,t);return{blocks:n,versionOf:r=>In(o,s,r)}}function Oe(e,t){return new Set(e.getQueryData(g.contentDraftTombstones(t)))}function me(e,t,n,o){const s=F(n),r=Oe(e,t);r.has(s)!==o&&(o?r.add(s):r.delete(s),G(e),e.setQueryData(g.contentDraftTombstones(t),[...r]))}function _n(e,t,n,o){const s=o.revision,r=e.getQueryData(g.contentVersions(n)),i=Object.entries(o.versions??{}).map(([f,h])=>[f,h===X?null:h]),a=e.getQueryData(g.contentChanges(n)),c=e.getQueryData(g.contentIndex(n)),l=new Set(i.flatMap(([f])=>je(f,c,a,r)===null?[f]:[])),u=new Set(i.flatMap(([f,h])=>h===null?[]:[F(f)]));e.setQueryData(g.contentChanges(n),f=>{if(!f)return f;const h={...f.changes};for(const[v,b]of i){const w=je(v,c,f,r);b!==null?h[v]={kind:"set",version:b,baseVersion:w}:w!==null?h[v]={kind:"delete",version:null,baseVersion:w}:delete h[v]}return{...f,changes:h,edited:!0}});for(const[f,h]of i)h!==null?me(e,n,f,!1):!u.has(F(f))&&l.has(f)&&me(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 Ee(e,t,n){G(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 Tn(e,t){const n=e.getMutationCache().findAll({mutationKey:ye(t.orgSlug,t.virtualMcpId,t.branch),status:"pending"});return new Set(n.flatMap(o=>Lo(o.state.variables)))}function Ae(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 S);throw t.source==="local"&&r?(Ae(e,n),new cn(s)):(t.source==="local"&&He(s)&&Ae(e,n),s)}}const Nt=new WeakMap;function at(e){let t=Nt.get(e);return t||(t={inFlight:new Map,rereading:new Set},Nt.set(e,t)),t}function Rn(e,t,n,o){const{inFlight:s}=at(e),r=s.get(o);if(r)return r;const i=ct(e,t,n,o,!0);return s.set(o,i),i.finally(()=>{s.get(o)===i&&s.delete(o)})}function or(e,t,n){const o=$.c(8),s=W(),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}=at(s);return xs(f=>{f===n&&(d.has(n)||(d.add(n),rr(s,e,u,n).catch(sr).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 sr(){}async function rr(e,t,n,o){const s=at(e).inFlight.get(o);return s&&await s.catch(()=>{}),Rn(e,t,n,o)}async function ct(e,t,n,o,s){G(e);const r=g.decofile(o),i=En(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,w=g.contentChanges(o),R=e.getQueryData(w);if(t.source==="github"&&t.hosted)return ir(e,t,t.hosted,n,o,{conditional:s,seen:h,currentMeta:f,schemaIfNoneMatch:b,seenChanges:R});const[k,N,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:Ve(R)}])),_=e.getQueryData(a)?.revision,T=_!==void 0&&_!==h?.revision;if(I?.ok){const E=T?null:de(R,I.result);E&&e.setQueryData(w,E)}else I&&t.source==="local"&&He(I.error)&&Ae(e,n);if(!k?.ok)throw k?.error??new Error("no blocks.list");if(!N)throw new Error("no schema.get");const y=k.result,O=Xe(N),D=N.ok&&!O?N.result:null;if(y.notModified&&(!l||!u)||D?.notModified&&!f)return ct(e,t,n,o,!1);const x=y.notModified?new Set:Tn(e,n),M=y.notModified?l:Ao(y.blocks,l,x),m=O?tn():D?D.notModified?f:D.schema:N.error;if(e.setQueryData(a,{revision:T?_:y.notModified?h?.revision:y.revision,schemaVersion:D?D.notModified?h?.schemaVersion:D.version??void 0:void 0}),e.setQueryData(r,M),!y.notModified){const E=e.getQueryData(c),j={...y.versions};for(const U of x){const A=E?.[U];A!==void 0?j[U]=A:delete j[U]}e.setQueryData(c,j)}return m instanceof S||e.setQueryData(i,m),!T&&!y.notModified&&l&&h?.revision&&y.revision!==h.revision&&On({queryClient:e,orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,backend:t,cacheKey:o}),{blocks:M,meta:m}}async function ir(e,t,n,o,s,r){const i=g.decofile(s),a=g.contentIndex(s),c=g.contentRevision(s),l=g.contentVersions(s),u=En(o,t),d=g.contentChanges(s),f=e.getQueryData(a),h=r.conditional&&f?r.seen?.revision:void 0,[v,b,w]=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:Ve(r.seenChanges)}])),R=e.getQueryData(a)??f,k=e.getQueryData(c)?.revision,N=k!==void 0&&k!==r.seen?.revision;if(w?.ok&&!N){const P=de(r.seenChanges,w.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,_=Xe(b),T=b.ok&&!_?b.result:null;if(I.notModified&&!f||T?.notModified&&!r.currentMeta)return ct(e,t,o,s,!1);const y=_?tn():T?T.notModified?r.currentMeta:T.schema:b.error;y instanceof S||e.setQueryData(u,y);const O=T?T.notModified?r.seen?.schemaVersion:T.version??void 0:void 0,D=e.getQueryData(i)??{};if(I.notModified||N)return e.setQueryData(c,{revision:N?k:r.seen?.revision,schemaVersion:O}),e.setQueryData(i,D),{blocks:D,meta:y};const x={revision:I.revision,resolvedRef:I.resolvedRef,sequence:I.sequence,entries:I.entries,draft:I.draft};e.setQueryData(a,x);const M=!!r.seen?.revision&&x.revision!==r.seen.revision&&(!r.seen.revision.startsWith("s-")||!!f&&xn(f.draft,x.draft));M&&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=Tn(e,o),E=e.getQueryData(l)??{},j={},U={},A=[];for(const[P,V]of Object.entries(D)){const H=x.entries[P];!H&&!m.has(P)||(j[P]=V,E[P]!==void 0&&(U[P]=E[P]),H&&!m.has(P)&&E[P]!==H.version&&A.push(P))}return e.setQueryData(i,j),e.setQueryData(l,U),A.length>0&&await Ye(e,n,s,A,m),R&&M&&ar(R,x)&&On({queryClient:e,orgSlug:o.orgSlug,virtualMcpId:o.virtualMcpId,branch:o.branch,backend:t,cacheKey:s}),{blocks:e.getQueryData(i)??j,meta:y}}function ar(e,t){if(xn(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 xn(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 cr(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 Ie(e){if(!(e instanceof S)||e.code!==p.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 lr(e,t){if(!(e instanceof S)||e.code!==p.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 Zn(s[a]):r.has(a)?X:void 0)!==l)return;i[a]=l}return i}function ur(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){G(e),_n(e,t,n,{revision:e.getQueryData(g.contentRevision(n))?.revision??"",versions:s}),Ee(e,n,Object.fromEntries(Object.entries(s).map(([r,i])=>[r,i===X?null:i]))),Xt(e,n,s,o.set??{})}async function Ei(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=zn(s.set);if(c.length>0)throw new Error(`A hosted save can't write a block that isn't loaded (${c.join(", ")})`)}return qs({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:cr(d,u)}:{}}));let a;try{a=await i(s)}catch(u){const d=t.source==="github"?Ie(u):void 0;if(!d)throw u;const f=ur(s,d);Object.keys(d).length>0&&ie(e,n,o,s,d);let h;try{h=await i(f)}catch(v){const b=Ie(v);b&&Object.keys(b).length>0&&ie(e,n,o,f,b);const w=await lr(v,f);if(!w)throw v;ie(e,n,o,f,w);try{h=await i(f,{...r,...w})}catch(R){const k=Ie(R);throw k&&Object.keys(k).length>0&&ie(e,n,o,f,k),R}}a={...h,versions:{...d,...h.versions}}}G(e);const c=t.source==="github"?_n(e,n,o,a):a.revision;t.source==="github"&&Xt(e,o,a.versions??{},s.set??{}),e.setQueryData(g.contentRevision(o),u=>({...u,revision:c}));const l=a.versions??{};return Ee(e,o,l),{revision:c,versions:l}}})}function Pn(e,t){if(!(e instanceof S))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 $n(e,t,n){if(!(n instanceof S))return;const o=n.data?.draft;if(!(!o||typeof o!="object"))for(const[s,r]of Object.entries(o))r===null&&me(e,t,s,!1)}function jn(e,t,n,o){G(e),Xn(e,n,o);const s=o.block===null,r=e.getQueryData(g.contentVersions(t)),i=e.getQueryData(g.contentChanges(t)),a=je(n,e.getQueryData(g.contentIndex(t)),i,r);if(i){const c=F(n),l=Object.fromEntries(Object.entries(i.changes).filter(([u])=>F(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})}me(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}),Ee(e,t,{[n]:s?null:o.version}),Oo(e,t,n,o)}function Di(e,t,n,o){if(t.source!=="github"||!(o instanceof S))return!1;$n(e,n,o);const s=o.data?.draft;if(!s||typeof s!="object")return!1;const r=Object.keys(s),i=r.map(a=>Pn(o,a));return r.length===0||i.some(a=>a===void 0)?!1:(e.cancelQueries({queryKey:g.decofile(n)}),r.forEach((a,c)=>{jn(e,n,a,i[c])}),!0)}async function Ii(e,t,n,o,s,r){t.source==="github"&&$n(e,o,r);const i=t.source==="github"?Pn(r,s):void 0;if(i)return e.cancelQueries({queryKey:g.decofile(o)}),jn(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}),Ee(e,o,{[s]:a.version}),!1}function fr(e){const t=$.c(17),n=Ce(e?.virtualMcpId)?.metadata;let o;t[0]!==n?(o=At(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 Lt(s,e.branch),w=b.pointer?.lastIndexOf("@")??-1;return{draft:b.pointer&&w>0?b.pointer.slice(0,w):null,version:b.pointer&&w>0?b.pointer.slice(w+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 _i(e){return fr(e).pointer}function Ti(e){const t=$.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:dr,staleTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:s}=C(o);return s?.revision}async function dr(){throw new Error("content revisions are set by reads and writes")}function lt(e,t){const n=$.c(6),{url:o}=nn(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?$e({...e,protocolSuffix:s.cacheKeySuffix}):$e({...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 Ri(e,t){const n=$.c(46),{url:o}=nn(e?.virtualMcpId),s=!!o,r=re(e?.virtualMcpId,e?.branch),i=r.kind==="protocol"?r:null,a=lt(e),c=t?.fetchEnabled??!0,l=Os(e?.virtualMcpId),u=Ct(e?.virtualMcpId).runtime==="cms",d=W();let f;n[0]!==a?(f=g.decofile(a),n[0]=a,n[1]=f):f=n[1];const h=f;or(i,i&&e?e:null,a);let v;n[2]!==e||n[3]!==d||n[4]!==h?(v=()=>{if(!e||d.isMutating({mutationKey:ye(e.orgSlug,e.virtualMcpId,e.branch)})>0)return!0;const E=d.getQueryState(h);return E?.fetchStatus==="fetching"||Date.now()-(E?.dataUpdatedAt??0)<on/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=as(d,e)?.version;if(E&&!await cs(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 w;n[13]!==v||n[14]!==b?(w={skip:v,read:b},n[13]=v,n[14]=b,n[15]=w):w=n[15],vs(!!t?.pollWhile&&!!e,w);const R=ze(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 Rn(d,i,e,a)).blocks;if(r.kind==="unavailable")throw tr("decofile");if(s){const A=await fetch(new URL("/.decofile",o).toString(),{cache:"no-store"}).catch(vr),Q=A?.ok?_t(await A.text()):null;if(Q)return Q;const P=new Error("decofile unavailable (local tunnel unreachable)");throw P.status=502,P}if(u)return us(d,e);const E=()=>ks(e,os(l,".deco/blocks.gen.json"));if(c){const A=await fetch(ps(e),{cache:"no-store"}).catch(gr);if(A?.ok){const V=_t(await A.text());if(V)return V}const Q=await E();if(Q.kind==="data")return Q.data;const P=new Error(`Failed to fetch decofile: ${A?.status??"network error"}`);throw P.status=Rt({liveOk:!!A?.ok,liveStatus:A?.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=Rt({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 N=!!e&&r.kind!=="pending",I=i?0:3e4,_=i?.describe.pollIntervalMs,T=i?"always":void 0;let y;n[27]!==u||n[28]!==s||n[29]!==i?(y=(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]=y):y=n[30];let O;n[31]!==h||n[32]!==k||n[33]!==N||n[34]!==I||n[35]!==_||n[36]!==T||n[37]!==y?(O={queryKey:h,queryFn:k,enabled:N,staleTime:I,refetchInterval:_,refetchIntervalInBackground:!1,refetchOnWindowFocus:T,retry:y,retryDelay:hr},n[31]=h,n[32]=k,n[33]=N,n[34]=I,n[35]=_,n[36]=T,n[37]=y,n[38]=O):O=n[38];const D=C(O);let x;n[39]!==R||n[40]!==D?(x=R&&D.data?So(R,D.data):void 0,n[39]=R,n[40]=D,n[41]=x):x=n[41];const M=x;let m;return n[42]!==M||n[43]!==i?.hosted||n[44]!==D?(m=i?.hosted&&M?{...D,data:M}:D,n[42]=M,n[43]=i?.hosted,n[44]=D,n[45]=m):m=n[45],m}function hr(e){return Qt(5e3,1e3,e,2,0)}function gr(){return null}function vr(){return null}function xi(e,t,n){return ns(e,t,n)}function Pi(e){const t=$.c(4),n=W(),o=re(e?.virtualMcpId,e?.branch),s=lt(e),r=o.kind==="protocol"?o.hosted:void 0;let i;return t[0]!==s||t[1]!==n||t[2]!==r?(i=(a,c)=>Eo(n,r,s,a,c),t[0]=s,t[1]=n,t[2]=r,t[3]=i):i=t[3],i}function $i(e,t){const n=$.c(3),o=re(e?.virtualMcpId,e?.branch),s=lt(e),r=ze(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(br),n[0]=r?.entries,n[1]=t,n[2]=i):i=n[2],i}function br(e){const[t]=e;return t}const wr="site-editor-save",Nn={id:wr,description:void 0,action:void 0,cancel:void 0},ji="site-editor-undo",Le="site-editor-publish";function mr(e){const t=$.c(7),{label:n,detail:o}=e;let s;t[0]!==n?(s=z.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=z.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=z.jsxs("details",{className:"mt-1 text-xs",children:[s,r]}),t[4]=s,t[5]=r,t[6]=i):i=t[6],i}function Mn(e,t){return t?z.jsx(mr,{label:e("siteEditor.details"),detail:t}):void 0}function Ni(e,t,n){ne.error(un(e,t,n),{...Nn,description:Mn(e,Es(t,n))})}function Mi(e,t,n=!1){ne.info(e(t?"sectionsEditor.reconcile.leftDeleted":"sectionsEditor.reconcile.keptTheirs"),{...Nn,description:e(t?n?"sectionsEditor.reconcile.leftDeletedNeverPublishedHint":"sectionsEditor.reconcile.leftDeletedHint":"sectionsEditor.reconcile.keptTheirsHint")})}const An={action:void 0,duration:void 0};function Ai(e,t){ne.success(t?e("siteEditor.publish.publishedOn",{host:t}):e("siteEditor.publish.published"),{...An,id:Le,description:void 0})}function Li(e,{headline:t,body:n,detail:o,retry:s,pending:r,tone:i="error"}){const a=Mn(e,o??null);ne[i](t,{id:Le,description:n&&a?z.jsxs(z.Fragment,{children:[z.jsx("p",{children:n}),a]}):n??a,action:s?{label:e("siteEditor.tryAgain"),onClick:c=>{c.preventDefault(),ne.loading(r??e("thread.publishPopover.publishing"),{...An,id:Le,description:void 0}),s()}}:void 0,duration:s?Number.POSITIVE_INFINITY:void 0})}function Ui(e){return e instanceof Error?e.message||null:e==null?null:String(e)}export{jo as $,Vr as A,ai as B,Pi as C,Si as D,Br as E,fr as F,Z as G,Ws as H,gi as I,fi as J,ve as K,As as L,Ls as M,ti as N,di as O,oi as P,wi as Q,bi as R,Ks as S,Zt as T,Ti as U,ri as V,ss as W,ye as X,qs as Y,ys as Z,rs as _,Qr as a,Zr as a$,Ko as a0,$r as a1,Nr as a2,$i as a3,ns as a4,Mi as a5,ki as a6,ei as a7,et as a8,Kr as a9,vi as aA,hi as aB,st as aC,Di as aD,Rn as aE,qr as aF,Le as aG,An as aH,Ai as aI,mi as aJ,xr as aK,Pr as aL,He as aM,Yr as aN,_i as aO,si as aP,ee as aQ,ni as aR,Li as aS,ji as aT,Nn as aU,S as aV,p as aW,Ye as aX,Tn as aY,So as aZ,ii as a_,tr as aa,rr as ab,ot as ac,Ei as ad,Ii as ae,Ni as af,yi as ag,En as ah,is as ai,zr as aj,pi as ak,Oi as al,Fr as am,Wr as an,Ot as ao,Et as ap,Gr as aq,ms as ar,Hr as as,ho as at,Mn as au,Ui as av,Ns as aw,jr as ax,so as ay,mr as az,$o as b,ci as b0,li as b1,ui as b2,nn as c,fo as d,Ur as e,go as f,qo as g,Xr as h,Jt as i,bs as j,Ri as k,lt as l,Cr as m,Jr as n,Os as o,Mr as p,os as q,Lr as r,Ar as s,xi as t,re as u,Qs as v,Cs as w,$s as x,ks as y,Kt as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as ee,a4 as te,q as ne,r as E,j as t,B as H,n as F,bC as ae,a5 as ce,aM as me,aL as pe,aI as de,aG as ue,aH as ge,aK as fe,aJ as he,bj as xe,t as C,c8 as je,c as se,m as ke,_ as ve,X as ye,Z as Se,Y as be,K as G,gw as Ce}from"./index-h1XTCueR.js";import{a as we}from"./SwitchHorizontal01-BXlvEeQ4.js";import{N as De}from"./agent-icon-DYPj-9S0.js";import{s as Ne}from"./Trash01-C3vHEhEb.js";import{i as Pe}from"./Upload01-RcrRUOsi.js";import{i as ie}from"./Zap-CO42SvK0.js";import{S as Ae}from"./search-toggle-SyoEzk7o.js";import{E as Y}from"./empty-state-B1eFFEza.js";import{C as Ee}from"./collection-tabs-mu__SPg6.js";import{S as Me,F as Oe}from"./folder-icon-CvzICvU-.js";import{j as Te,k as Ie,n as Re}from"./use-org-fs-BtQY-xQ8.js";import{a7 as ze,R as Z,Z as $e}from"./chat-context--sx_tT3a.js";import{c as _e}from"./context-shell-B-eLBue7.js";import"./AlertCircle-Y_OUILZ3.js";import"./Tool01-D9z5UHl1.js";import"./ArrowUp-Cp2Ml2vf.js";import"./ArrowLeft-CB426JlK.js";import"./LinkBroken01-Bu5CIeMz.js";import"./ShoppingBag01-C88ytSQP.js";import"./Globe04-DOLChRWZ.js";import"./CheckCircle-CEPNyqYQ.js";import"./ChevronUp-Dsr9gtxU.js";import"./ChevronSelectorVertical-DClPI-qU.js";import"./UserSquare-YXEd-AbI.js";import"./CreditCard01-D6m8lGLv.js";import"./Key01-CcC-DNfV.js";import"./Minus-cqn26HtL.js";import"./Monitor01-BeH9O99T.js";import"./Sun-9dowJ77Q.js";import"./Play-o5_wqCmk.js";import"./Plus-sBQQfz_j.js";import"./SearchMd-CBPTYB4H.js";import"./Users01-CC5oUscX.js";import"./XClose-UU_Qx1D3.js";import"./icon-button-D5d00wVb.js";import"./tooltip-CKmg0cr7.js";import"./index-B6nB1oBs.js";import"./badge-DXTq7juk.js";import"./markdown-C5fMrlG3.js";import"./use-copy-BH9CGszX.js";import"./use-mobile-8jTJxNX-.js";import"./autosend-ChY4eKzU.js";import"./thread-route-B8Y5c0rh.js";import"./use-project-scope-CzvPVO9m.js";import"./repository-binding-DOWKMbHI.js";import"./use-mcp-client-CU2L24s0.js";import"./auth-CGSiE6Ch.js";import"./task-board-DfdsuuL-.js";import"./schema-D2LQQw_P.js";import"./file-preview-BTZhj6pd.js";import"./utils-CaKh8ISH.js";import"./editor-BXgkmrWx.js";import"./file-type-icon-DYMrEOTS.js";import"./useInfiniteQuery-8WTGmXox.js";import"./infiniteQueryObserver-CHwNipYb.js";import"./thread-intent-D_k-pawu.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./watch-sse-pool-lW9b9_hM.js";import"./use-entitlements-BUjouq1Y.js";import"./use-ai-providers-Dy2qKq-c.js";import"./use-decopilot-events-CDPhmAAN.js";import"./use-organization-settings-C32cjrXo.js";import"./require-capability-BzHftBt7.js";import"./access-gate-DSwIamvO.js";import"./capability-load-error-CNpbDyX4.js";import"./sections-Cet2GaYS.js";import"./textarea-Bhlc1rhY.js";import"./use-ask-in-chat-Ds_a2eir.js";import"./shell-layout-CkS9YSvj.js";import"./use-deployment-admin-DXfttv5t.js";import"./admin-fetch-BhTJlAsX.js";import"./command-CSPHvNyT.js";import"./index-CP9rTnyG.js";import"./integration-icon-BX--0-gC.js";import"./project-icon-DH181ON5.js";import"./use-navigate-to-agent-B0fVaV8h.js";import"./use-debounced-value-CvXfSmyn.js";import"./new-project-dialog-BU-wxed9.js";import"./label-7Sx3Bd-m.js";import"./repository-picker-TR2KC739.js";import"./github-icon-C2RYJxpH.js";import"./collection-search-CXkzfc9r.js";import"./legacy-admin-welcome-dialog-DP-92Dz3.js";import"./drawer-2P1ke0v5.js";import"./required-auth-layout-DIKOlnAp.js";import"./use-org-sso-BDjJrxCz.js";const J=200,Fe=new Set(["node_modules","__pycache__"]);function Q(s){const[,...e]=s.webkitRelativePath.split("/");return e.length>0?e.join("/"):s.name}function Le(s){return Q(s).split("/").every(e=>!e.startsWith(".")&&!Fe.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=Q(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 Ge(s,e){const i=_e(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 L="*";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:De}}function He(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 w;e[3]!==i?(w=B(i),e[3]=i,e[4]=w):w=e[4];const R=w,D=o?"opacity-60":"hover:bg-accent";let f;e[5]!==D?(f=ke("relative transition-colors group overflow-hidden flex flex-col h-full",D),e[5]=D,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(H,{variant:"ghost",size:"icon",children:t.jsx(we,{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(L),[w,R]=E.useState(!1),[D,f]=E.useState(null),[m,N]=E.useState(null),[z,h]=E.useState(null),x=()=>{a.invalidateQueries({queryKey:G.slashSkills(e.id)}),a.invalidateQueries({queryKey:G.orgFsSkills(e.id)})},j=r=>a.setQueryData(G.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.filter(Le),U=_.find(A=>Q(A)==="SKILL.md");if(!U){C.error(s("settings.skills.importMissingSkillMd"));return}if(_.length>J){C.error(s("settings.skills.importTooManyFiles",{count:String(_.length),max:String(J)}));return}const $=Be(q),X=`skills/${$}`;let W=!1;R(!0);try{if(await Re(e.slug,"home",X)){C.error(s("settings.skills.importSlugTaken",{slug:$}));return}W=!0;const A=Ge($,await U.text());j(le=>[A,...le]),h(A.id),await qe(Ke(_,$),c.mutateAsync),C.success(s("settings.skills.importSuccess",{name:$}))}catch(A){W&&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:L,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:L,S=u===L?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(H,{size:"sm",disabled:w,onClick:()=>n.current?.click(),children:[t.jsx(Pe,{size:14}),s(w?"settings.skills.importing":"settings.skills.importButton")]});return t.jsxs(F,{children:[t.jsx(F.Content,{children:t.jsx(F.Container,{children:t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsx(F.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(Y,{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(H,{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(Y,{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(He,{entry:r,pending:l,onOpen:()=>T(r),onDelete:B(r)&&!l?()=>N(r):void 0},r.id)})})})]})})}),D&&t.jsx(Me,{skillPath:D,onClose:()=>f(null)},D),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 H,n as F,bC as ae,a5 as ce,aM as me,aL as pe,aI as de,aG as ue,aH as ge,aK as fe,aJ as he,bj as xe,t as C,c8 as je,c as se,m as ke,_ as ve,X as ye,Z as Se,Y as be,K as G,gw as Ce}from"./index-BYLma6nR.js";import{a as we}from"./SwitchHorizontal01-DIK7cKae.js";import{N as De}from"./agent-icon-DbfcsXV4.js";import{s as Ne}from"./Trash01-BIlzZ3AH.js";import{i as Pe}from"./Upload01-DuNH7edt.js";import{i as ie}from"./Zap-Bp1s63-N.js";import{S as Ae}from"./search-toggle-Dozi3jn4.js";import{E as Y}from"./empty-state-D5-IJmKF.js";import{C as Ee}from"./collection-tabs-B6DksJOI.js";import{S as Me,F as Oe}from"./folder-icon-JFUPr6Oa.js";import{j as Te,k as Ie,n as Re}from"./use-org-fs-DKzRfuIW.js";import{a7 as ze,R as Z,Z as $e}from"./chat-context-DrqBnMGV.js";import{c as _e}from"./context-shell-DYEfNRo8.js";import"./AlertCircle-Dhxv_VvX.js";import"./Tool01-Bw_Gs9HT.js";import"./ArrowUp-C5MIVxlv.js";import"./ArrowLeft-DPiUStmH.js";import"./LinkBroken01-CExBuGlw.js";import"./ShoppingBag01-CpRghVvA.js";import"./Globe04-BgmGeS07.js";import"./CheckCircle-DQiPh0bs.js";import"./ChevronUp-BusAGBPt.js";import"./ChevronSelectorVertical-C_LOUUD2.js";import"./UserSquare-BV7Jqoa-.js";import"./CreditCard01-B86ybMWX.js";import"./Key01-bRc0D6iU.js";import"./Minus-BuxaQmfP.js";import"./Monitor01-CWmH5Gyz.js";import"./Sun-fB3zW2OU.js";import"./Play-xrfH4Yz5.js";import"./Plus-BRIZEm-m.js";import"./SearchMd-CHeeKxSQ.js";import"./Users01-Cy9FwTEl.js";import"./XClose-DeJhJbxg.js";import"./icon-button-Bkz9RDzV.js";import"./tooltip-Bw3qe--M.js";import"./index-CorYIdad.js";import"./badge-BLj5oaM_.js";import"./markdown-Da1uCT0e.js";import"./use-copy-D-EOd5RI.js";import"./use-mobile-ye6iRWDK.js";import"./autosend-YTrROtL8.js";import"./thread-route-CsxQz3Zx.js";import"./use-project-scope-CT4H1KgC.js";import"./repository-binding-BkD30urH.js";import"./use-mcp-client-Ch_pgKFL.js";import"./auth-eHRARwQ2.js";import"./task-board-CpInFlas.js";import"./schema-x3j4FByb.js";import"./file-preview-4Tbf_ub4.js";import"./utils-B4FS_bBy.js";import"./editor-Bl3rIcVI.js";import"./file-type-icon-Bdzds_J6.js";import"./useInfiniteQuery-DmLlHKe0.js";import"./infiniteQueryObserver-deqizdYY.js";import"./thread-intent-D7K3VC0B.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./watch-sse-pool-DPXy7vY-.js";import"./use-entitlements-BsP1ZFGQ.js";import"./use-ai-providers-BZwoM77S.js";import"./use-decopilot-events-CuinN1iK.js";import"./use-organization-settings-BQAdDt_y.js";import"./require-capability-B1_EID-G.js";import"./access-gate-BO57Fy6P.js";import"./capability-load-error-D_eJcYHf.js";import"./sections-BugzxN3d.js";import"./textarea-CjxhqOyq.js";import"./use-ask-in-chat-DaKY6vDh.js";import"./shell-layout-B0sxwrmk.js";import"./use-deployment-admin-CE6RFF-x.js";import"./admin-fetch-BhTJlAsX.js";import"./command-B13rzls6.js";import"./index-D2JCiu4r.js";import"./integration-icon-CknO8J8O.js";import"./project-icon-BFruPc7B.js";import"./use-navigate-to-agent-jetKe7lC.js";import"./use-debounced-value-8OKqfUuy.js";import"./new-project-dialog-EugQEueI.js";import"./label-CjHEjKyC.js";import"./repository-picker-CfUR1P6V.js";import"./github-icon-iZdKbq4s.js";import"./collection-search-CcswFoQz.js";import"./legacy-admin-welcome-dialog-CCJK6F5I.js";import"./drawer-Cgf4oN4m.js";import"./required-auth-layout-DFKnKCtp.js";import"./use-org-sso-BxORdMDV.js";const J=200,Fe=new Set(["node_modules","__pycache__"]);function Q(s){const[,...e]=s.webkitRelativePath.split("/");return e.length>0?e.join("/"):s.name}function Le(s){return Q(s).split("/").every(e=>!e.startsWith(".")&&!Fe.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=Q(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 Ge(s,e){const i=_e(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 L="*";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:De}}function He(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 w;e[3]!==i?(w=B(i),e[3]=i,e[4]=w):w=e[4];const R=w,D=o?"opacity-60":"hover:bg-accent";let f;e[5]!==D?(f=ke("relative transition-colors group overflow-hidden flex flex-col h-full",D),e[5]=D,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(H,{variant:"ghost",size:"icon",children:t.jsx(we,{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(L),[w,R]=E.useState(!1),[D,f]=E.useState(null),[m,N]=E.useState(null),[z,h]=E.useState(null),x=()=>{a.invalidateQueries({queryKey:G.slashSkills(e.id)}),a.invalidateQueries({queryKey:G.orgFsSkills(e.id)})},j=r=>a.setQueryData(G.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.filter(Le),U=_.find(A=>Q(A)==="SKILL.md");if(!U){C.error(s("settings.skills.importMissingSkillMd"));return}if(_.length>J){C.error(s("settings.skills.importTooManyFiles",{count:String(_.length),max:String(J)}));return}const $=Be(q),X=`skills/${$}`;let W=!1;R(!0);try{if(await Re(e.slug,"home",X)){C.error(s("settings.skills.importSlugTaken",{slug:$}));return}W=!0;const A=Ge($,await U.text());j(le=>[A,...le]),h(A.id),await qe(Ke(_,$),c.mutateAsync),C.success(s("settings.skills.importSuccess",{name:$}))}catch(A){W&&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:L,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:L,S=u===L?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(H,{size:"sm",disabled:w,onClick:()=>n.current?.click(),children:[t.jsx(Pe,{size:14}),s(w?"settings.skills.importing":"settings.skills.importButton")]});return t.jsxs(F,{children:[t.jsx(F.Content,{children:t.jsx(F.Container,{children:t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsx(F.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(Y,{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(H,{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(Y,{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(He,{entry:r,pending:l,onOpen:()=>T(r),onDelete:B(r)&&!l?()=>N(r):void 0},r.id)})})})]})})}),D&&t.jsx(Me,{skillPath:D,onClose:()=>f(null)},D),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-BYLma6nR.js";import{T as k,R as z,a as D,b as S}from"./index-BiJyBzx-.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,fi as K}from"./index-
|
|
1
|
+
import{r as v,fi as K}from"./index-BYLma6nR.js";import{d as de,e as fe,f as U,g as ge,h as pe,i as be,j as ve,C as Y,k as he,l as y,m as me,n as xe,o as Ie,s as ye}from"./core.esm-CZ_suStd.js";function q(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Re(e,t){return e.reduce((n,r,s)=>{const a=t.get(r);return a&&(n[s]=a),n},Array(e.length))}function O(e){return e!==null&&e>=0}function Ce(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function we(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const B=e=>{let{rects:t,activeIndex:n,overIndex:r,index:s}=e;const a=q(t,r,n),o=t[s],c=a[s];return!c||!o?null:{x:c.left-o.left,y:c.top-o.top,scaleX:c.width/o.width,scaleY:c.height/o.height}},L={scaleX:1,scaleY:1},Xe=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:s,rects:a,overIndex:o}=e;const c=(t=a[n])!=null?t:r;if(!c)return null;if(s===n){const u=a[o];return u?{x:0,y:n<o?u.top+u.height-(c.top+c.height):u.top-c.top,...L}:null}const f=De(a,s,n);return s>n&&s<=o?{x:0,y:-c.height-f,...L}:s<n&&s>=o?{x:0,y:c.height+f,...L}:{x:0,y:0,...L}};function De(e,t,n){const r=e[t],s=e[t-1],a=e[t+1];return r?n<t?s?r.top-(s.top+s.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):s?r.top-(s.top+s.height):0:0}const H="Sortable",V=K.createContext({activeIndex:-1,containerId:H,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:B,disabled:{draggable:!1,droppable:!1}});function _e(e){let{children:t,id:n,items:r,strategy:s=B,disabled:a=!1}=e;const{active:o,dragOverlay:c,droppableRects:f,over:u,measureDroppableContainers:i}=de(),l=fe(H,n),d=c.rect!==null,g=v.useMemo(()=>r.map(I=>typeof I=="object"&&"id"in I?I.id:I),[r]),R=o!=null,C=o?g.indexOf(o.id):-1,h=u?g.indexOf(u.id):-1,w=v.useRef(g),x=!Ce(g,w.current),m=h!==-1&&C===-1||x,b=we(a);U(()=>{x&&R&&i(g)},[x,g,R,i]),v.useEffect(()=>{w.current=g},[g]);const D=v.useMemo(()=>({activeIndex:C,containerId:l,disabled:b,disableTransforms:m,items:g,overIndex:h,useDragOverlay:d,sortedRects:Re(g,f),strategy:s}),[C,l,b.draggable,b.droppable,m,g,h,f,d,s]);return K.createElement(V.Provider,{value:D},t)}const Se=e=>{let{id:t,items:n,activeIndex:r,overIndex:s}=e;return q(n,r,s).indexOf(t)},Ae=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:s,items:a,newIndex:o,previousItems:c,previousContainerId:f,transition:u}=e;return!u||!r||c!==a&&s===o?!1:n?!0:o!==s&&t===f},Te={duration:200,easing:"ease"},J="transform",Ee=Y.Transition.toString({property:J,duration:0,easing:"linear"}),Ne={roleDescription:"sortable"};function Oe(e){let{disabled:t,index:n,node:r,rect:s}=e;const[a,o]=v.useState(null),c=v.useRef(n);return U(()=>{if(!t&&n!==c.current&&r.current){const f=s.current;if(f){const u=he(r.current,{ignoreTransform:!0}),i={x:f.left-u.left,y:f.top-u.top,scaleX:f.width/u.width,scaleY:f.height/u.height};(i.x||i.y)&&o(i)}}n!==c.current&&(c.current=n)},[t,n,r,s]),v.useEffect(()=>{a&&o(null)},[a]),a}function je(e){let{animateLayoutChanges:t=Ae,attributes:n,disabled:r,data:s,getNewIndex:a=Se,id:o,strategy:c,resizeObserverConfig:f,transition:u=Te}=e;const{items:i,containerId:l,activeIndex:d,disabled:g,disableTransforms:R,sortedRects:C,overIndex:h,useDragOverlay:w,strategy:x}=v.useContext(V),m=Le(r,g),b=i.indexOf(o),D=v.useMemo(()=>({sortable:{containerId:l,index:b,items:i},...s}),[l,s,b,i]),I=v.useMemo(()=>i.slice(i.indexOf(o)),[i,o]),{rect:N,node:z,isOver:W,setNodeRef:P}=ge({id:o,data:D,disabled:m.droppable,resizeObserverConfig:{updateMeasurementsFor:I,...f}}),{active:T,activatorEvent:Z,activeNodeRect:ee,attributes:te,setNodeRef:X,listeners:re,isDragging:M,over:ne,setActivatorNodeRef:se,transform:oe}=pe({id:o,data:D,attributes:{...Ne,...n},disabled:m.draggable}),ae=be(P,X),S=!!T,_=S&&!R&&O(d)&&O(h),j=!w&&M,F=j&&_?oe:null,ie=_?F??(c??x)({rects:C,activeNodeRect:ee,activeIndex:d,overIndex:h,index:b}):null,E=O(d)&&O(h)?a({id:o,items:i,activeIndex:d,overIndex:h}):b,A=T?.id,p=v.useRef({activeId:A,items:i,newIndex:E,containerId:l}),ce=i!==p.current.items,G=t({active:T,containerId:l,isDragging:M,isSorting:S,id:o,index:b,items:i,newIndex:p.current.newIndex,previousItems:p.current.items,previousContainerId:p.current.containerId,transition:u,wasDragging:p.current.activeId!=null}),$=Oe({disabled:!G,index:b,node:z,rect:N});return v.useEffect(()=>{S&&p.current.newIndex!==E&&(p.current.newIndex=E),l!==p.current.containerId&&(p.current.containerId=l),i!==p.current.items&&(p.current.items=i)},[S,E,l,i]),v.useEffect(()=>{if(A===p.current.activeId)return;if(A!=null&&p.current.activeId==null){p.current.activeId=A;return}const ue=setTimeout(()=>{p.current.activeId=A},50);return()=>clearTimeout(ue)},[A]),{active:T,activeIndex:d,attributes:te,data:D,rect:N,index:b,newIndex:E,items:i,isOver:W,isSorting:S,isDragging:M,listeners:re,node:z,overIndex:h,over:ne,setNodeRef:ae,setActivatorNodeRef:se,setDroppableNodeRef:P,setDraggableNodeRef:X,transform:$??ie,transition:le()};function le(){if($||ce&&p.current.newIndex===b)return Ee;if(!(j&&!ve(Z)||!u)&&(S||G))return Y.Transition.toString({...u,property:J})}}function Le(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}function k(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const ke=[y.Down,y.Right,y.Up,y.Left],Fe=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:s,droppableContainers:a,over:o,scrollableAncestors:c}}=t;if(ke.includes(e.code)){if(e.preventDefault(),!n||!r)return;const f=[];a.getEnabled().forEach(l=>{if(!l||l!=null&&l.disabled)return;const d=s.get(l.id);if(d)switch(e.code){case y.Down:r.top<d.top&&f.push(l);break;case y.Up:r.top>d.top&&f.push(l);break;case y.Left:r.left>d.left&&f.push(l);break;case y.Right:r.left<d.left&&f.push(l);break}});const u=me({collisionRect:r,droppableRects:s,droppableContainers:f});let i=xe(u,"id");if(i===o?.id&&u.length>1&&(i=u[1].id),i!=null){const l=a.get(n.id),d=a.get(i),g=d?s.get(d.id):null,R=d?.node.current;if(R&&g&&l&&d){const h=Ie(R).some((I,N)=>c[N]!==I),w=Q(l,d),x=Me(l,d),m=h||!w?{x:0,y:0}:{x:x?r.width-g.width:0,y:x?r.height-g.height:0},b={x:g.left,y:g.top};return m.x&&m.y?b:ye(b,m)}}}};function Q(e,t){return!k(e)||!k(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Me(e,t){return!k(e)||!k(t)||!Q(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}export{_e as S,q as a,B as r,Fe as s,je as u,Xe as v};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as A,a4 as B,r as v,j as e,n as x,hj as k,gM as b,g2 as y,g3 as a,i0 as D,B as m,I as g,aM as z,aL as T,aI as O,aG as R,aK as M,aJ as F,bj 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,hj as k,gM as b,g2 as y,g3 as a,i0 as D,B as m,I as g,aM as z,aL as T,aI as O,aG as R,aK as M,aJ as F,bj as q,E as C,t as c,c as U}from"./index-BYLma6nR.js";import{D as $}from"./domain-settings-CqMNMzW1.js";import{S as G}from"./switch-DqhVUDGb.js";import{a as H,b as J,c as K,d as Q}from"./use-org-sso-BxORdMDV.js";import{s as V}from"./Trash01-BIlzZ3AH.js";import{R as W}from"./require-capability-B1_EID-G.js";import"./badge-BLj5oaM_.js";import"./select-D61WZk1O.js";import"./index-BdQq_4o_.js";import"./index-CorYIdad.js";import"./ChevronUp-BusAGBPt.js";import"./access-gate-BO57Fy6P.js";import"./capability-load-error-D_eJcYHf.js";function X(){const s=A(),{org:o}=B(),{data:h,isLoading:I}=H(o.id,o.slug),f=J(o.id,o.slug),S=K(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&&l({issuer:n.issuer,clientId:n.clientId,clientSecret:"",discoveryEndpoint:n.discoveryEndpoint??"",domain:n.domain,scopes:n.scopes.join(" ")}),p(!0)},w=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"))}},L=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"))}},N=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($,{}),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(G,{checked:n.enforced,onCheckedChange:N,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:_,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:w,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(M,{children:[e.jsx(F,{disabled:S.isPending,children:s("settings.orgSso.cancelButton")}),e.jsx(q,{onClick:L,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};
|