decocms 4.513.4 → 4.513.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{ActiveShapeUtils-CAxkWTE7.js → ActiveShapeUtils-BD1rvm75.js} +1 -1
- package/dist/client/assets/{AlertCircle-iwRSZJFi.js → AlertCircle-DGyqrcs1.js} +1 -1
- package/dist/client/assets/{AreaChart-BCUK2U_v.js → AreaChart-DXZzRQIg.js} +1 -1
- package/dist/client/assets/{ArrowLeft-_QxYwR3P.js → ArrowLeft-eYPah7GY.js} +1 -1
- package/dist/client/assets/{ArrowUp-CWx4kMsV.js → ArrowUp-D5AH9Pcx.js} +1 -1
- package/dist/client/assets/{BarChart-BFfaTlE7.js → BarChart-CIrIL-8i.js} +1 -1
- package/dist/client/assets/{Building02-Dcs_HLaa.js → Building02-DYC0suyK.js} +1 -1
- package/dist/client/assets/{CartesianChart-DxoYDxJN.js → CartesianChart-DI2rF1vs.js} +1 -1
- package/dist/client/assets/{CategoricalChart-BWxwmOFO.js → CategoricalChart-C37JtV-R.js} +1 -1
- package/dist/client/assets/{CheckCircle-X3D4eq-V.js → CheckCircle-CqYnJPRs.js} +1 -1
- package/dist/client/assets/{ChevronSelectorVertical-7X_EL11G.js → ChevronSelectorVertical-DdGE8kvW.js} +1 -1
- package/dist/client/assets/{ChevronUp-BlFhjumO.js → ChevronUp-COqs90Hs.js} +1 -1
- package/dist/client/assets/{Copy01-CsyaL0tc.js → Copy01-CgH6S_M4.js} +1 -1
- package/dist/client/assets/{CreditCard01-DZn9m-o1.js → CreditCard01-D9MXYjlv.js} +1 -1
- package/dist/client/assets/{DotsVertical-H16dBinG.js → DotsVertical-Cb3iOarq.js} +1 -1
- package/dist/client/assets/{ErrorBarContext-IXpluzmX.js → ErrorBarContext-Bm6BBMsf.js} +1 -1
- package/dist/client/assets/{Globe04-B5AbE2NG.js → Globe04-CzPjgHLa.js} +1 -1
- package/dist/client/assets/{Image01-C-r__mWH.js → Image01-DRhv7dXw.js} +1 -1
- package/dist/client/assets/{Key01-D8PhPz3k.js → Key01-BDIGM7UK.js} +1 -1
- package/dist/client/assets/{Link01-BZlTJYwG.js → Link01-D-kjAU9F.js} +1 -1
- package/dist/client/assets/{LinkBroken01-y64X2SC-.js → LinkBroken01-XQhOMQAy.js} +1 -1
- package/dist/client/assets/{Monitor01-Ccoz_3RV.js → Monitor01-BVPal7YC.js} +1 -1
- package/dist/client/assets/{Play-B8dkIMIB.js → Play-d8pW2_Wo.js} +1 -1
- package/dist/client/assets/{Plus-D_siv_aA.js → Plus-BqeqBPMZ.js} +1 -1
- package/dist/client/assets/{ReferenceLine-DBHRjJZR.js → ReferenceLine-BR8YoYbZ.js} +1 -1
- package/dist/client/assets/{SearchMd-KKuAy3kv.js → SearchMd-pSkC4ygW.js} +1 -1
- package/dist/client/assets/{Sector-BpwYW3Qx.js → Sector-Dq8AGG4_.js} +1 -1
- package/dist/client/assets/{ShoppingBag01-COYAkOJY.js → ShoppingBag01-DZQO7QtG.js} +1 -1
- package/dist/client/assets/{Sun-s_f7cajm.js → Sun-BCgybCT7.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-ZjaXGph0.js → SwitchHorizontal01-CeUNJpHb.js} +1 -1
- package/dist/client/assets/{Tool01-Bsd9MAXv.js → Tool01-BgkFSAcX.js} +1 -1
- package/dist/client/assets/{Trash01-CqbCnp4Y.js → Trash01-DeYkLyg0.js} +1 -1
- package/dist/client/assets/{Upload01-BuL02EP8.js → Upload01-zDvi7WnN.js} +1 -1
- package/dist/client/assets/{User01-DOqRt8wn.js → User01-DBX94Vod.js} +1 -1
- package/dist/client/assets/{UserSquare-CEX9DbWl.js → UserSquare-4I8cSrJU.js} +1 -1
- package/dist/client/assets/{Users01-n5qz8jdG.js → Users01-BNiwpGyg.js} +1 -1
- package/dist/client/assets/{XClose-BQ9Dlu1I.js → XClose-DFp85o1X.js} +1 -1
- package/dist/client/assets/{ZoomOut-CYcrWaFo.js → ZoomOut-Clz13c-y.js} +1 -1
- package/dist/client/assets/{access-gate-CCU3Jeds.js → access-gate-hn6vo27o.js} +1 -1
- package/dist/client/assets/{add-connection-dialog-CJKZey2r.js → add-connection-dialog-B8d5rNLA.js} +1 -1
- package/dist/client/assets/{agent-analytics-BpgXx7qA.js → agent-analytics-oR-UJrdu.js} +1 -1
- package/dist/client/assets/agent-app-BpE-oLAW.js +1 -0
- package/dist/client/assets/{agent-assets-BsicbZIc.js → agent-assets-BAJSaOwb.js} +1 -1
- package/dist/client/assets/{agent-automation-BSqPTL3r.js → agent-automation-BFa_aFcv.js} +1 -1
- package/dist/client/assets/{agent-automations-CORWjDg5.js → agent-automations-BqpWj5js.js} +1 -1
- package/dist/client/assets/{agent-connect-sources-nNFgzgd5.js → agent-connect-sources-DLbP8QgT.js} +1 -1
- package/dist/client/assets/agent-deck-BLI_AFXm.js +1 -0
- package/dist/client/assets/{agent-e2e-Q2mMYbFI.js → agent-e2e-CZm4tSr4.js} +1 -1
- package/dist/client/assets/{agent-experiments-GpUhBLmP.js → agent-experiments-B-6D2jQi.js} +1 -1
- package/dist/client/assets/agent-file-Cdh_qco_.js +1 -0
- package/dist/client/assets/{agent-hosting-B2Nl1zb-.js → agent-hosting-CdENGPus.js} +1 -1
- package/dist/client/assets/{agent-icon-DMH8Ftve.js → agent-icon-DtUVrwO-.js} +1 -1
- package/dist/client/assets/agent-library--bem7YGi.js +1 -0
- package/dist/client/assets/agent-library-file-CkXwnu9_.js +1 -0
- package/dist/client/assets/{agent-monitor-CvRpbef5.js → agent-monitor-Bs7IFe5F.js} +1 -1
- package/dist/client/assets/{agent-overview-CIwIxcfm.js → agent-overview-BM6-btAT.js} +1 -1
- package/dist/client/assets/{agent-releases-BX6W8KKx.js → agent-releases-Cg_1lF6D.js} +1 -1
- package/dist/client/assets/agent-settings-Dd_ntOEj.js +1 -0
- package/dist/client/assets/{agent-site-editor-0D-T7ieN.js → agent-site-editor-Duykn_pL.js} +1 -1
- package/dist/client/assets/agent-site-editor-code-CNBje50_.js +2 -0
- package/dist/client/assets/agent-site-editor-content-ClbNQtwa.js +1 -0
- package/dist/client/assets/agent-site-editor-preview-DwLqOSDR.js +1 -0
- package/dist/client/assets/agent-view-AVtmtnDB.js +1 -0
- package/dist/client/assets/{agent-view-guard-DG6ZTgu0.js → agent-view-guard-hqisp_aZ.js} +1 -1
- package/dist/client/assets/{agents-list-DJAFMczy.js → agents-list-Be9D6Efa.js} +1 -1
- package/dist/client/assets/{ai-providers-CkTtAKoL.js → ai-providers-Bcx4_XEI.js} +1 -1
- package/dist/client/assets/{alert-BpKmtk7d.js → alert-DV4VVYX_.js} +1 -1
- package/dist/client/assets/{alert-dialog-CgRaXWeG.js → alert-dialog-C884MJiU.js} +1 -1
- package/dist/client/assets/{analytics-sections-DmbiPFV0.js → analytics-sections-BRVAxDPl.js} +1 -1
- package/dist/client/assets/{api-keys-B8qmKYTS.js → api-keys-77z_zTHe.js} +1 -1
- package/dist/client/assets/api-keys-Bl6Bc96G.js +1 -0
- package/dist/client/assets/{app-editor-BQE1NaFI.js → app-editor-D1Yz0-KZ.js} +1 -1
- package/dist/client/assets/{asset-utils-CW4a0Tss.js → asset-utils-Bgywf85e.js} +1 -1
- package/dist/client/assets/{auth-Bjnc521y.js → auth-BWk8-zOv.js} +1 -1
- package/dist/client/assets/{auth-catchall-CJDXycwe.js → auth-catchall-Ba5IqUJT.js} +1 -1
- package/dist/client/assets/{auth-entry-DKyMW2UQ.js → auth-entry-DtA-KX4U.js} +1 -1
- package/dist/client/assets/{auth-split-layout-BJfKUnO6.js → auth-split-layout-DlRuMXq_.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-DK-E6e3Z.js → authenticate-and-persist-oauth-IsdfY2Pl.js} +1 -1
- package/dist/client/assets/{automation-list-row-DybT-MIG.js → automation-list-row-BLQDRByW.js} +1 -1
- package/dist/client/assets/{automation-runs-DvbgOsZD.js → automation-runs-CfNYuBTf.js} +1 -1
- package/dist/client/assets/{automations-DEtpbM4Z.js → automations-ClBeWsXG.js} +1 -1
- package/dist/client/assets/{autosend-D1RPfsoi.js → autosend-00EmkCtt.js} +1 -1
- package/dist/client/assets/{avatar-B2nFfSHv.js → avatar-DKDZgWFa.js} +1 -1
- package/dist/client/assets/{badge-CRNAVwfV.js → badge-Bmk8ti5E.js} +1 -1
- package/dist/client/assets/{block-document-9nzhTDhY.js → block-document-DM_YLluw.js} +1 -1
- package/dist/client/assets/{blocks-preview-workspace-context-BGEsHkZW.js → blocks-preview-workspace-context-DbDIw_fH.js} +1 -1
- package/dist/client/assets/{blocks-tab-states-7xd0L-RH.js → blocks-tab-states-CbP4bRnZ.js} +3 -3
- package/dist/client/assets/{blog-schema-CPbtg-YY.js → blog-schema-CUk-sbP9.js} +1 -1
- package/dist/client/assets/{board-analytics-DfcXMGIx.js → board-analytics-QLChF2Fg.js} +1 -1
- package/dist/client/assets/{buckets-CmybaOoN.js → buckets-CNsJAB6o.js} +1 -1
- package/dist/client/assets/{build-improve-prompt-doc-C4jIZJDS.js → build-improve-prompt-doc-DJN4jxYS.js} +1 -1
- package/dist/client/assets/{calendar-CBcRt8Oe.js → calendar-GjUu2S3w.js} +1 -1
- package/dist/client/assets/{capability-load-error-CKIgKs8S.js → capability-load-error-BVmBezr5.js} +1 -1
- package/dist/client/assets/{category-editor-WcaRs-tk.js → category-editor-BbN07orU.js} +1 -1
- package/dist/client/assets/{chart-k_AUhfu2.js → chart-Batu-asC.js} +1 -1
- package/dist/client/assets/{chat-context-70xHoaxp.js → chat-context-0V74JN43.js} +1 -1
- package/dist/client/assets/{chat-draft-Nb1SIeYI.js → chat-draft-b20iPSzq.js} +1 -1
- package/dist/client/assets/{checkbox-CwspTWv-.js → checkbox-FJR9GBSz.js} +1 -1
- package/dist/client/assets/{choose-editor-B_p_lpqj.js → choose-editor-B4AQNoUW.js} +1 -1
- package/dist/client/assets/{cli-auth-success-DWqeUnva.js → cli-auth-success-B7oLHBHH.js} +1 -1
- package/dist/client/assets/{client-icons-DYkySYk1.js → client-icons-Db2DsGLl.js} +1 -1
- package/dist/client/assets/cms-settings-editor-bH28Cwco.js +1 -0
- package/dist/client/assets/{collapsible-CKlYJ7JC.js → collapsible-BaAUa-uq.js} +1 -1
- package/dist/client/assets/{collection-detail-FEHQdrUM.js → collection-detail-BpTqwPQh.js} +1 -1
- package/dist/client/assets/{collection-display-button-CEiwIbk0.js → collection-display-button-qOjw_9dn.js} +1 -1
- package/dist/client/assets/{collection-search-ZGgli3wR.js → collection-search-BvClByDx.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-BJKQfvlr.js → collection-table-wrapper-DRrT-L4P.js} +1 -1
- package/dist/client/assets/{collection-tabs-C331r2n4.js → collection-tabs-yyL7thvn.js} +1 -1
- package/dist/client/assets/{column-rules-CoEiTMWe.js → column-rules-oi7XUNCk.js} +1 -1
- package/dist/client/assets/{combobox-D7TXxp7o.js → combobox-DMjnN_aL.js} +1 -1
- package/dist/client/assets/{coming-soon-page-CUty8r32.js → coming-soon-page-B0mfPnqP.js} +1 -1
- package/dist/client/assets/{command-CAYMLhJL.js → command-HQXCvIc1.js} +1 -1
- package/dist/client/assets/{companion-mcps-section-BHQ5YIJi.js → companion-mcps-section-BE_rdnSM.js} +1 -1
- package/dist/client/assets/{config-B5hUFPIX.js → config-BPYy0PCN.js} +1 -1
- package/dist/client/assets/{connect-Cj4-EZJC.js → connect-DOJcei6R.js} +1 -1
- package/dist/client/assets/{connect-layout-CmN5RxRi.js → connect-layout-Cf6GuLdj.js} +1 -1
- package/dist/client/assets/{connection-CEjWhO8M.js → connection-BpKydrrq.js} +1 -1
- package/dist/client/assets/{connection-card-Qtm3n_hS.js → connection-card-IwdFS34P.js} +1 -1
- package/dist/client/assets/{connection-detail-Du-3dW0g.js → connection-detail-C2DKmrpZ.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-C8PcIQLm.js → connection-form-helpers-BvKR417-.js} +1 -1
- package/dist/client/assets/{connections-CrNA73Wo.js → connections-BXBz-7gT.js} +1 -1
- package/dist/client/assets/{content-tab-CRvcTJJ2.js → content-tab-D9fcn3Hp.js} +3 -3
- package/dist/client/assets/{context-BqWdy054.js → context-C-E2WXON.js} +1 -1
- package/dist/client/assets/{context-menu-CdwmTDFy.js → context-menu-TYrOMe5c.js} +1 -1
- package/dist/client/assets/{context-shell-CwudT8OH.js → context-shell-On92TM5F.js} +3 -3
- package/dist/client/assets/{core.esm-uZtRM3l4.js → core.esm-CpQIzrUC.js} +1 -1
- package/dist/client/assets/{create-organization-dialog-CJin8Jxw.js → create-organization-dialog-DgF1IFc_.js} +1 -1
- package/dist/client/assets/{daily-pulse-DTkBeVsw.js → daily-pulse-BOC5UzEe.js} +1 -1
- package/dist/client/assets/{discover-DGpiIGQv.js → discover-BlLiIBf4.js} +1 -1
- package/dist/client/assets/{domain-settings-BmE4V_Yd.js → domain-settings-BDcWjcTo.js} +1 -1
- package/dist/client/assets/{drawer-CkgkUBCk.js → drawer-DDevbGRy.js} +1 -1
- package/dist/client/assets/{editor-B2CFLfaQ.js → editor-DlDOOY_4.js} +1 -1
- package/dist/client/assets/{editor-classes-DcYQ4Aap.js → editor-classes-BA-XOPn9.js} +1 -1
- package/dist/client/assets/{empty-state-BZa0U-xG.js → empty-state-D0xYsV2u.js} +1 -1
- package/dist/client/assets/{empty-state-DAdNQg6Y.js → empty-state-t0TjoYVp.js} +1 -1
- package/dist/client/assets/{extract-connection-data-BpdUae_j.js → extract-connection-data-dh3iYmVg.js} +1 -1
- package/dist/client/assets/{feature-gate-DKD0xNwQ.js → feature-gate-BqkgE7TM.js} +1 -1
- package/dist/client/assets/{feature-paywall-BqNVafLn.js → feature-paywall-BeChu0JL.js} +1 -1
- package/dist/client/assets/{file-explorer-BrcXVEUy.js → file-explorer-DbsjbKj4.js} +1 -1
- package/dist/client/assets/{file-preview-pejw4DEs.js → file-preview-BPilYeri.js} +1 -1
- package/dist/client/assets/{file-share-button-AFuoJHS8.js → file-share-button-tFfE-sDm.js} +1 -1
- package/dist/client/assets/{file-type-icon-2Asg9IKB.js → file-type-icon-CqiTsqkN.js} +1 -1
- package/dist/client/assets/flat-project-B8clA1X9.js +1 -0
- package/dist/client/assets/{folder-icon-DqT7qo5j.js → folder-icon-CqdHG3Ev.js} +1 -1
- package/dist/client/assets/{form-DidHa5sD.js → form-C2a6JNu4.js} +1 -1
- package/dist/client/assets/{general-BF4C2ZJb.js → general-B_qz-x25.js} +1 -1
- package/dist/client/assets/{home-fSRcvGJQ.js → home-Ctm57HqD.js} +1 -1
- package/dist/client/assets/{hosted-publish-feedback-DbuE45Er.js → hosted-publish-feedback-CtVznVdZ.js} +1 -1
- package/dist/client/assets/{icon-button-iwZ3O0_B.js → icon-button-C9jD2Hx3.js} +1 -1
- package/dist/client/assets/{index-DNlGRld6.js → index-6Ue7sPGM.js} +1 -1
- package/dist/client/assets/{index-Cmhl3zNb.js → index-8f_vFFVa.js} +2 -2
- package/dist/client/assets/{index-BpuRA4Yb.js → index-B6SVRi7N.js} +1 -1
- package/dist/client/assets/{index-D2R52OCR.js → index-BDybMsIS.js} +1 -1
- package/dist/client/assets/{index-BdqfOdIE.js → index-BjKnuEDd.js} +1 -1
- package/dist/client/assets/{index-Cex7aoHx.js → index-C5H0Wt50.js} +1 -1
- package/dist/client/assets/{index-D69M9S-D.js → index-CEuerbGa.js} +1 -1
- package/dist/client/assets/{index-DVqdGkOX.js → index-CYl6IUJL.js} +1 -1
- package/dist/client/assets/{index-DL_AHT72.js → index-CZ5aoytF.js} +1 -1
- package/dist/client/assets/{index-D-4AgGmD.js → index-CaC0mBls.js} +1 -1
- package/dist/client/assets/{index-lwornGU3.js → index-CvDeki2h.js} +1 -1
- package/dist/client/assets/{index-BjUY_TPp.js → index-D4devard.js} +1 -1
- package/dist/client/assets/{index-CzrtR5Z7.js → index-DH5YV3Rc.js} +1 -1
- package/dist/client/assets/{index-CUOlm63w.js → index-DKA5Ly4T.js} +3 -3
- package/dist/client/assets/{index-DhA7J1aJ.js → index-DZi1rH7e.js} +1 -1
- package/dist/client/assets/{index-B2vL4Txo.js → index-F1Fq1aIw.js} +1 -1
- package/dist/client/assets/{index-redirect-CZXJxQAy.js → index-redirect-DJJ4lwhG.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-978TY1hh.js → infiniteQueryObserver-DUxIIdhP.js} +1 -1
- package/dist/client/assets/{infra-billing-C59D5YaM.js → infra-billing-kH_OZb0R.js} +1 -1
- package/dist/client/assets/{input-DVPmZILt.js → input-BhCR1Dvt.js} +3 -3
- package/dist/client/assets/{input-CbMPZsxE.js → input-CTTf6mSe.js} +1 -1
- package/dist/client/assets/{integration-icon-CktagpLu.js → integration-icon-CjUkpUFA.js} +1 -1
- package/dist/client/assets/{jira-icon-eYd_xfOx.js → jira-icon-BV6Nhy1J.js} +1 -1
- package/dist/client/assets/{label-COA0amPU.js → label-DTdw4ToM.js} +1 -1
- package/dist/client/assets/{layout-C-tE3imG.js → layout-CRHpNA-L.js} +1 -1
- package/dist/client/assets/{legacy-agents-deep-CPmss93q.js → legacy-agents-deep-WWlJLiCC.js} +1 -1
- package/dist/client/assets/{legacy-main-redirect-B8hjRkjB.js → legacy-main-redirect-xsE3RuJ6.js} +1 -1
- package/dist/client/assets/library-DKPNWFrQ.js +1 -0
- package/dist/client/assets/{library-tab-CHu062C1.js → library-tab-BHuSO7Qk.js} +1 -1
- package/dist/client/assets/{login-BN5lalgG.js → login-B1XLhTh8.js} +1 -1
- package/dist/client/assets/{markdown-DntfPEgK.js → markdown-gIWrkm71.js} +1 -1
- package/dist/client/assets/{mcp-app-renderer-CFqAYLtv.js → mcp-app-renderer-Cx5_Cgu7.js} +1 -1
- package/dist/client/assets/{mcp-oauth-jIbhs8wE.js → mcp-oauth-BCVDfjxS.js} +1 -1
- package/dist/client/assets/{mcp-oauth-DqjrYGbv.js → mcp-oauth-DJLJ4jjk.js} +1 -1
- package/dist/client/assets/{members-CikLEMEO.js → members-IeYYyp52.js} +1 -1
- package/dist/client/assets/{memory-CTulcnPs.js → memory-8PEu9ts-.js} +1 -1
- package/dist/client/assets/{mini-report-page-C4z6zUee.js → mini-report-page-zQ3aWwnQ.js} +1 -1
- package/dist/client/assets/{mock-board-C-bx3LOx.js → mock-board-BCunCtVN.js} +1 -1
- package/dist/client/assets/{monaco-editor-94ag9h78.js → monaco-editor-DKn4Wqed.js} +1 -1
- package/dist/client/assets/monitoring-COl6Otnm.js +1 -0
- package/dist/client/assets/{monitoring-stats-row-BiBXmqEX.js → monitoring-stats-row-3Jmtoo1S.js} +1 -1
- package/dist/client/assets/{multi-select-CknX6tqH.js → multi-select-CGJa6-FA.js} +1 -1
- package/dist/client/assets/{mustache-CHjvX4mG.js → mustache-4NqYiukY.js} +1 -1
- package/dist/client/assets/{new-project-dialog-Y_XjAxS_.js → new-project-dialog-7fKdzYQ0.js} +1 -1
- package/dist/client/assets/{oauth-callback-CuyXteK1.js → oauth-callback-Ux7KLfo6.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-mmuJSvU9.js → oauth-callback-ai-provider-BHpLfzCW.js} +1 -1
- package/dist/client/assets/{onboarding-rJV8oAVf.js → onboarding-Bxi7_FIG.js} +1 -1
- package/dist/client/assets/{openai-conversation-DMiHuV_M.js → openai-conversation-_BlnoTN9.js} +1 -1
- package/dist/client/assets/{optimistic-project-sidebar-views-CGSVQMMQ.js → optimistic-project-sidebar-views-Bq6xThGH.js} +1 -1
- package/dist/client/assets/{order-monitor-day-BYmFkC3g.js → order-monitor-day-B-gorx4b.js} +1 -1
- package/dist/client/assets/{organization-choice-uNKN81tq.js → organization-choice-u2ufM7LR.js} +1 -1
- package/dist/client/assets/{orgs-DsslXidX.js → orgs-Q_88vgEa.js} +1 -1
- package/dist/client/assets/{page-seo-form-ysYceart.js → page-seo-form-CUUspMT0.js} +1 -1
- package/dist/client/assets/{pair-CCzeqHVB.js → pair-Da1JuUQW.js} +1 -1
- package/dist/client/assets/plan-DTu4f1lM.js +1 -0
- package/dist/client/assets/{plan-ladder-DYIZDWtc.js → plan-ladder--KlfKV0O.js} +1 -1
- package/dist/client/assets/{popover-YaXt6bOC.js → popover-DkjgCDyk.js} +1 -1
- package/dist/client/assets/{post-calendar-BT_Rw0Q6.js → post-calendar-CzWgDY6o.js} +1 -1
- package/dist/client/assets/{post-editor-COleSFOD.js → post-editor-uOMVUWIp.js} +1 -1
- package/dist/client/assets/{preview-content-C1Rk597M.js → preview-content-D6DnhkDr.js} +1 -1
- package/dist/client/assets/{preview-dialog-BTsQwEhu.js → preview-dialog-Cz0QjPnU.js} +1 -1
- package/dist/client/assets/{preview-panel-HJZsRhmr.js → preview-panel-D860QFoB.js} +1 -1
- package/dist/client/assets/{preview-tab-DVJzXKEK.js → preview-tab-BqXweaop.js} +3 -3
- package/dist/client/assets/{product-picker-dialog-B0S08IE6.js → product-picker-dialog-BzRtZ0Xh.js} +1 -1
- package/dist/client/assets/{profile-BAcwiajI.js → profile-CaSyUNvq.js} +1 -1
- package/dist/client/assets/{project-app-view-e6WdBuWR.js → project-app-view-DSjmraQa.js} +1 -1
- package/dist/client/assets/{project-apps-bT8vigK2.js → project-apps-BNzfntH4.js} +1 -1
- package/dist/client/assets/{project-feed-qY5aN-GD.js → project-feed-sOra10wH.js} +1 -1
- package/dist/client/assets/{project-icon-CIzqFWaQ.js → project-icon-DDLQLFHN.js} +1 -1
- package/dist/client/assets/project-reports-BRXQTs8U.js +1 -0
- package/dist/client/assets/project-tasks-C1jXBWPU.js +1 -0
- package/dist/client/assets/{projects-BsK-2g1X.js → projects-DSQkMTlh.js} +1 -1
- package/dist/client/assets/{projects-empty-state-Bw7Hl-T4.js → projects-empty-state-CgcVDMN1.js} +1 -1
- package/dist/client/assets/{prompts-BN3p2ELV.js → prompts-LsFvKrUX.js} +1 -1
- package/dist/client/assets/record-editor-DNnWgGZk.js +1 -0
- package/dist/client/assets/{redirect-editor-CVdnjBHw.js → redirect-editor-js4vnIyF.js} +1 -1
- package/dist/client/assets/reports-BRc7lcn2.js +1 -0
- package/dist/client/assets/{reports-DB2vUJ0m.js → reports-YZ_jyIpk.js} +1 -1
- package/dist/client/assets/{reports-onboarding-DG16InmK.js → reports-onboarding-CD-oYnDP.js} +1 -1
- package/dist/client/assets/{reports-tab-CiJ9MhGs.js → reports-tab-BQ5w_NLe.js} +2 -2
- package/dist/client/assets/{repositories-DVlGH0wi.js → repositories-AUaQi6Lg.js} +1 -1
- package/dist/client/assets/repositories-BeYoVJCK.js +1 -0
- package/dist/client/assets/{repository-binding-X3TRktCN.js → repository-binding-DbCSIQ25.js} +1 -1
- package/dist/client/assets/{repository-import-picker-DVf3Vnm6.js → repository-import-picker-BNXAK2-d.js} +1 -1
- package/dist/client/assets/{repository-picker-B8x2K0Wa.js → repository-picker-DdXZfSFi.js} +1 -1
- package/dist/client/assets/{require-capability-sXOC3J02.js → require-capability-KC9Pz6jZ.js} +1 -1
- package/dist/client/assets/{required-auth-layout-Dxnpn4YU.js → required-auth-layout-yR_GLYbd.js} +1 -1
- package/dist/client/assets/{reset-password-CZ33ExeQ.js → reset-password-BdTHHMoh.js} +1 -1
- package/dist/client/assets/{resizable-DKp6vSsG.js → resizable-CZG2RiqM.js} +1 -1
- package/dist/client/assets/{resolve-tab-icon-SxG6TPRU.js → resolve-tab-icon-CjkK_zYj.js} +1 -1
- package/dist/client/assets/{review-settings-g25PFo2o.js → review-settings-DqAJTW90.js} +1 -1
- package/dist/client/assets/{roles-C_YmoM1c.js → roles-sjKQ_yFr.js} +1 -1
- package/dist/client/assets/{route-DKuH8vLv.js → route-02oV_rQq.js} +1 -1
- package/dist/client/assets/{route-DeOeP4Wq.js → route-BFrqyY7M.js} +1 -1
- package/dist/client/assets/route-BQjTTZG2.js +1 -0
- package/dist/client/assets/{sandbox-lifecycle-context-CrtkjvLt.js → sandbox-lifecycle-context-DR_2NQXy.js} +1 -1
- package/dist/client/assets/{schema-nN2fVtd3.js → schema-B0rKeG_L.js} +1 -1
- package/dist/client/assets/{schema-ChwlN9B2.js → schema-DqvEKlh8.js} +1 -1
- package/dist/client/assets/{scroll-area-DDy8s3Ss.js → scroll-area-CxMQI3lN.js} +1 -1
- package/dist/client/assets/{search-input-DBKGcZuw.js → search-input-CUDMkzW3.js} +1 -1
- package/dist/client/assets/{search-toggle-CLG4gmKJ.js → search-toggle-DQNLDkeN.js} +1 -1
- package/dist/client/assets/{secret-ciphertext-COE-QTj7.js → secret-ciphertext-Cwn7ogUH.js} +1 -1
- package/dist/client/assets/{secret-picker-DHJiW7t8.js → secret-picker-DB8u6Egh.js} +1 -1
- package/dist/client/assets/{secrets-Br2wfWxI.js → secrets-5Kc02H3G.js} +1 -1
- package/dist/client/assets/{sections-DeEHL6VG.js → sections-DrN4NbyG.js} +1 -1
- package/dist/client/assets/{sections-editor-A_RH8q6f.js → sections-editor-DNUBhdzI.js} +1 -1
- package/dist/client/assets/{select-BFXL8R1G.js → select-CD39mfCB.js} +1 -1
- package/dist/client/assets/{select-model-BEL7Tbo9.js → select-model-nIvZx6mv.js} +1 -1
- package/dist/client/assets/{seo-editor--98cMxSm.js → seo-editor-DJq3zWnQ.js} +1 -1
- package/dist/client/assets/{separator-gsO2sYby.js → separator-G8XO4ZVv.js} +1 -1
- package/dist/client/assets/settings-tab-CjHjlnds.js +1 -0
- package/dist/client/assets/{sheet-CYoLylxA.js → sheet-EnE9wqRk.js} +1 -1
- package/dist/client/assets/{shell-layout-CtdsDlSz.js → shell-layout-BPP608jE.js} +1 -1
- package/dist/client/assets/site-editor-CDy9Dqbl.js +1 -0
- package/dist/client/assets/{site-editor-toast-g-4xfmJ4.js → site-editor-toast-D3wQqSbx.js} +1 -1
- package/dist/client/assets/{skills-BRiGDde6.js → skills-CiOFCiY2.js} +1 -1
- package/dist/client/assets/{slider-CpXtUVDi.js → slider-CUo-tkVk.js} +1 -1
- package/dist/client/assets/{sortable.esm-CwAjqrb2.js → sortable.esm-CVfxAykx.js} +1 -1
- package/dist/client/assets/{sso-D0IDI51o.js → sso-D5Sp0hWe.js} +1 -1
- package/dist/client/assets/{suggestion-Bv3b6MxU.js → suggestion-DoQ2WmJO.js} +1 -1
- package/dist/client/assets/{switch-CvZlxlV0.js → switch-CnVsSUQF.js} +1 -1
- package/dist/client/assets/{symbol-BmpW8_Es.js → symbol-DoarKbx_.js} +1 -1
- package/dist/client/assets/{synced-repos-_e-rYrNS.js → synced-repos-Cg3chrWr.js} +1 -1
- package/dist/client/assets/{tab-icon-glyph-CHxD5oom.js → tab-icon-glyph-Bo6d63je.js} +1 -1
- package/dist/client/assets/{table-B26a0ePo.js → table-BRoMxHYw.js} +1 -1
- package/dist/client/assets/{tabs-BEPPtBqO.js → tabs-DRVG225q.js} +1 -1
- package/dist/client/assets/{task-assignee-avatar-BUQ0pMCX.js → task-assignee-avatar-CQcT6saR.js} +1 -1
- package/dist/client/assets/{task-board-C1s59vKR.js → task-board-CYLfSrEW.js} +1 -1
- package/dist/client/assets/{task-route-BzBoe3sC.js → task-route-vO53W0Ko.js} +1 -1
- package/dist/client/assets/{task-status-CErsPlHV.js → task-status-F4H3Ga9G.js} +1 -1
- package/dist/client/assets/taskboard-analytics-B2r791B3.js +1 -0
- package/dist/client/assets/{tasks-tr_d8SW4.js → tasks-Bt9wXPlt.js} +1 -1
- package/dist/client/assets/tasks-DOI54OO2.js +1 -0
- package/dist/client/assets/{textarea-CMJRBl6x.js → textarea-CKgIiSeB.js} +1 -1
- package/dist/client/assets/{thread-analytics-CeNaBD4e.js → thread-analytics-or-g-yCI.js} +1 -1
- package/dist/client/assets/{thread-intent-CCu0BEYJ.js → thread-intent-pizqUsAw.js} +1 -1
- package/dist/client/assets/{thread-route--bdvrJML.js → thread-route-RN7dQnhv.js} +1 -1
- package/dist/client/assets/{thread-route-C2rii--a.js → thread-route-qt3bqNNd.js} +1 -1
- package/dist/client/assets/{thread-sheet-body-BVs76jnQ.js → thread-sheet-body-CNNUBoOL.js} +1 -1
- package/dist/client/assets/{time-range-picker-CMbmxxqv.js → time-range-picker-Do6bf1fb.js} +1 -1
- package/dist/client/assets/{toggle-group-a7j08s-f.js → toggle-group-BflgkGO4.js} +1 -1
- package/dist/client/assets/{tool-namespace-CRTO9xOA.js → tool-namespace-C8V5CWK9.js} +1 -1
- package/dist/client/assets/{toolbar-icon-button-BsOv6rvJ.js → toolbar-icon-button-BKf8C7rk.js} +1 -1
- package/dist/client/assets/{tooltip-kZk2wAMk.js → tooltip-UP0IE2Tr.js} +1 -1
- package/dist/client/assets/{tooltipContext-DIsnCXpc.js → tooltipContext-Cp5fQVar.js} +1 -1
- package/dist/client/assets/{track-C_ZVQYs-.js → track-B3_MOgCa.js} +1 -1
- package/dist/client/assets/{types-CD9jRVDk.js → types-ODqpEiLj.js} +1 -1
- package/dist/client/assets/{url-slug-CXYaPIEX.js → url-slug-D457Gzas.js} +1 -1
- package/dist/client/assets/{usage-stats-B3aY2c0l.js → usage-stats-BJ2G_LxU.js} +1 -1
- package/dist/client/assets/{use-ai-providers-D84PtMSN.js → use-ai-providers-CNozmlYS.js} +1 -1
- package/dist/client/assets/{use-automations-CAJcdhxV.js → use-automations-SYapFBvC.js} +1 -1
- package/dist/client/assets/{use-autosave-Cve7LmNN.js → use-autosave-7cTC6S23.js} +1 -1
- package/dist/client/assets/{use-chat-layout-state-4I8rtQwF.js → use-chat-layout-state-CS60364s.js} +1 -1
- package/dist/client/assets/{use-clock-tick-CgUj6u2i.js → use-clock-tick-Bn5JCPrV.js} +1 -1
- package/dist/client/assets/{use-connect-companion-CCaa-yxn.js → use-connect-companion-Bpzill-_.js} +1 -1
- package/dist/client/assets/{use-connection-CikB9KcW.js → use-connection-Dbx4XQH4.js} +1 -1
- package/dist/client/assets/{use-content-sync-DX7UAl_W.js → use-content-sync-CXWC9odL.js} +1 -1
- package/dist/client/assets/{use-copy-DzgBkNLT.js → use-copy-BcbcC4Wz.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-BCKaQYpl.js → use-create-virtual-mcp-XIxu-PVm.js} +1 -1
- package/dist/client/assets/{use-date-fns-locale-Dy4Oeqx-.js → use-date-fns-locale-BPuP1KRV.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-DR5Ahrkc.js → use-debounced-autosave-DJFJgv7S.js} +1 -1
- package/dist/client/assets/{use-debounced-value-C7Ih1llI.js → use-debounced-value-BcnQYbv8.js} +1 -1
- package/dist/client/assets/{use-deco-credits-ByP4Of99.js → use-deco-credits-sH8JcXii.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-CBhHAjRY.js → use-decopilot-events-DnweVhcO.js} +1 -1
- package/dist/client/assets/{use-delete-connection-CjpOj4k7.js → use-delete-connection-DkV3GtTv.js} +1 -1
- package/dist/client/assets/{use-deployment-admin-CqgXaT_z.js → use-deployment-admin-CeuCnmzX.js} +1 -1
- package/dist/client/assets/{use-ensure-project-folder-BzFrwFoN.js → use-ensure-project-folder-DCSsD6mp.js} +1 -1
- package/dist/client/assets/{use-fast-preview-draft-url-R7ofHb_D.js → use-fast-preview-draft-url-Bm81iT9U.js} +1 -1
- package/dist/client/assets/{use-file-configs-DhEp4msd.js → use-file-configs-DBaPVWpT.js} +1 -1
- package/dist/client/assets/{use-inbox-feed-CZjjQk7K.js → use-inbox-feed-BpXgn0oj.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-DQl4a0Bs.js → use-infinite-scroll-C3Owd_r6.js} +1 -1
- package/dist/client/assets/{use-join-requests-BIuh8dt2.js → use-join-requests-mMEcdIqR.js} +1 -1
- package/dist/client/assets/{use-main-panel-tabs-BS-Dp3CX.js → use-main-panel-tabs-BPcXXbeG.js} +1 -1
- package/dist/client/assets/{use-main-schema-v8-DmthzehD.js → use-main-schema-v8-DQ3Tp7hb.js} +1 -1
- package/dist/client/assets/{use-mcp-auth-status-BQFxszTc.js → use-mcp-auth-status-HN52RbO4.js} +1 -1
- package/dist/client/assets/{use-mcp-client-CedU4dWV.js → use-mcp-client-GXi3d-TN.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-CdDNTlaE.js → use-mcp-prompts-DYr_PMFD.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-CcHLNRd3.js → use-mcp-tools-1_L9lL6N.js} +1 -1
- package/dist/client/assets/{use-members-BI_Z9G2i.js → use-members-C4hziWH9.js} +1 -1
- package/dist/client/assets/{use-mobile-CY0Djv_M.js → use-mobile-7XbQJiX0.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-cdHnGUXB.js → use-navigate-to-agent-Bh1luKWv.js} +1 -1
- package/dist/client/assets/{use-open-billing-url-C9VcD5z_.js → use-open-billing-url-CbfiZ6nK.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-Cy7UT2_Z.js → use-org-auth-client-CXEz66O9.js} +1 -1
- package/dist/client/assets/{use-org-fs-BzlMLYdA.js → use-org-fs-BdAqd8Rv.js} +1 -1
- package/dist/client/assets/{use-org-repo-syncs-Bbiq7vxl.js → use-org-repo-syncs-uQXeH0Jz.js} +1 -1
- package/dist/client/assets/{use-org-sso-Dz08CIcx.js → use-org-sso-CAhUTOPh.js} +1 -1
- package/dist/client/assets/{use-organization-roles-D5QmscBE.js → use-organization-roles-BuYemyb5.js} +1 -1
- package/dist/client/assets/{use-organization-settings-BhbyABaR.js → use-organization-settings-Toq_f_Mz.js} +1 -1
- package/dist/client/assets/{use-panel-navigate-Cs4na-V_.js → use-panel-navigate-CLNhl3ki.js} +1 -1
- package/dist/client/assets/{use-project-native-view-presence-F2BIVVKN.js → use-project-native-view-presence-B7KEsCj_.js} +1 -1
- package/dist/client/assets/{use-project-scope-COiEpk7r.js → use-project-scope-IOK1T5p5.js} +1 -1
- package/dist/client/assets/{use-recent-apps-CQPv5LK_.js → use-recent-apps-DyohzVX8.js} +1 -1
- package/dist/client/assets/{use-releases-CYsXvho_.js → use-releases-yUP6RI_5.js} +1 -1
- package/dist/client/assets/{use-reports-diagnostic-D9AFmVnx.js → use-reports-diagnostic-Dx09lDp9.js} +1 -1
- package/dist/client/assets/{use-secrets-C4QpZA2A.js → use-secrets-CwVJb7xf.js} +1 -1
- package/dist/client/assets/{use-section-preview-base-Dp3nLlkj.js → use-section-preview-base-C21P5QN6.js} +1 -1
- package/dist/client/assets/{use-sidebar-collapsed-BdewWuhH.js → use-sidebar-collapsed-CA2jDAa-.js} +1 -1
- package/dist/client/assets/{use-tags-B1Z7-48J.js → use-tags-B6X9pJd5.js} +1 -1
- package/dist/client/assets/{use-task-board-analytics-G6UBxSrP.js → use-task-board-analytics-RsYdGMIC.js} +1 -1
- package/dist/client/assets/{use-task-board-events-CQVfQw81.js → use-task-board-events-DphBWYih.js} +1 -1
- package/dist/client/assets/{use-task-board-item-prs-CTNtD0OU.js → use-task-board-item-prs-wBGqnWKt.js} +1 -1
- package/dist/client/assets/{use-task-metadata-2qdE9S5L.js → use-task-metadata-BKurahZz.js} +1 -1
- package/dist/client/assets/{use-thread-analytics-C0QELsJp.js → use-thread-analytics-DCrr7FKS.js} +1 -1
- package/dist/client/assets/{use-thread-outputs-BRiZLmB3.js → use-thread-outputs-CIGWCWtQ.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-Z2Fpq8_2.js +1 -0
- package/dist/client/assets/{useQueries-BaTjPT3P.js → useQueries-CSpn2OpV.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-BK8FDRCQ.js +1 -0
- package/dist/client/assets/{users-hzXXTZtN.js → users-CEoww2_1.js} +1 -1
- package/dist/client/assets/{utils-D_iIHZov.js → utils-2rl9BEeu.js} +1 -1
- package/dist/client/assets/{variant-calendar-BsY2CF48.js → variant-calendar-D-cEXz9T.js} +1 -1
- package/dist/client/assets/{variant-draft-pointer-Di3PGFGj.js → variant-draft-pointer-yGSVhJlH.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-dGCnwIOo.js → view-mode-toggle-UGzYIEFg.js} +1 -1
- package/dist/client/assets/{virtual-mcp-Cm_JxjLS.js → virtual-mcp-DJrUra0R.js} +1 -1
- package/dist/client/assets/{watch-sse-pool-DnJO6AZk.js → watch-sse-pool-BF6OquCU.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/server.js +196 -196
- package/package.json +1 -1
- package/dist/client/assets/agent-app-DDRmQd75.js +0 -1
- package/dist/client/assets/agent-deck-sUBVFl57.js +0 -1
- package/dist/client/assets/agent-file-Ay2rdSNY.js +0 -1
- package/dist/client/assets/agent-library-DQTTsoBq.js +0 -1
- package/dist/client/assets/agent-library-file-CoPN3Dl5.js +0 -1
- package/dist/client/assets/agent-settings-Da0_9JGD.js +0 -1
- package/dist/client/assets/agent-site-editor-code-B98Bnadv.js +0 -2
- package/dist/client/assets/agent-site-editor-content-87ZLW9rs.js +0 -1
- package/dist/client/assets/agent-site-editor-preview-DD0qYhLr.js +0 -1
- package/dist/client/assets/agent-view-BPSlOxjt.js +0 -1
- package/dist/client/assets/api-keys-CigsOsqY.js +0 -1
- package/dist/client/assets/cms-settings-editor-BGIEXOlq.js +0 -1
- package/dist/client/assets/flat-project-COKm-_lB.js +0 -1
- package/dist/client/assets/library-OhQHeeUu.js +0 -1
- package/dist/client/assets/monitoring-zFjmyWaK.js +0 -1
- package/dist/client/assets/plan-DirWo8wP.js +0 -1
- package/dist/client/assets/project-reports-DQGUzueG.js +0 -1
- package/dist/client/assets/project-tasks-B1VrMiAq.js +0 -1
- package/dist/client/assets/record-editor-DD50VfEv.js +0 -1
- package/dist/client/assets/reports-DCFnios-.js +0 -1
- package/dist/client/assets/repositories-CuvgQNAy.js +0 -1
- package/dist/client/assets/route-BsG_rQz2.js +0 -1
- package/dist/client/assets/settings-tab-BXdif76g.js +0 -1
- package/dist/client/assets/site-editor-BojLUeGp.js +0 -1
- package/dist/client/assets/taskboard-analytics-h_2DA62k.js +0 -1
- package/dist/client/assets/tasks-BkgOKiT9.js +0 -1
- package/dist/client/assets/useInfiniteQuery-BLA_teXl.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-Cu40gYv3.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as P,o as q,m as F,K as m,aV as Ye,aF as Nt,aG as _t,r as U,a as Dt,aw as ce,a2 as xt,au as Rt,b7 as Pt,t as z,j as V}from"./index-Cmhl3zNb.js";import{a as We}from"./input-DVPmZILt.js";import{k as $t,M as At,l as le,s as Re}from"./thread-intent-CCu0BEYJ.js";import{u as pe,c as Lt}from"./use-main-schema-v8-DmthzehD.js";import{b as te}from"./sandbox-url-D3mC8qhT.js";import{s as Ft}from"./utils-D_iIHZov.js";import{a as Ut}from"./repository-binding-X3TRktCN.js";import{u as Mt}from"./chat-context-70xHoaxp.js";import{i as jt,u as Bt}from"./index-DNlGRld6.js";import{v as Qt}from"./sandbox-git-api-CRxdlhrN.js";import{e as Vt}from"./backoff-CrEUbyZT.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 T 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 T(t.code,t.message,t.data)}}const K="deco-content",ue={major:1},ze=1;async function Ht(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 de={major:ue.major,minor:ze},Xe=`the endpoint speaks an older ${K} than this client needs (${de.major}.${de.minor} or newer): update @decocms/blocks in the site (8.2.0 or newer) and start deco serve again`;function W(e,t,n){const o={reason:t,required:{...de}};if(n){o.actual={protocol:n.protocol,major:n.version?.major,minor:n.version?.minor};const r=n.server;typeof r?.name=="string"&&typeof r.version=="string"&&(o.server={name:r.name,version:r.version})}return new T(p.Unsupported,e,o)}function Ze(e){const t=e??{},{protocol:n,version:o}=t;if(n!==K)throw W(`the endpoint speaks ${JSON.stringify(n)}, not ${K}`,"protocol",t);if(o?.major!==ue.major)throw W(`the endpoint speaks ${K} ${String(o?.major)}.x; this client speaks ${ue.major}.x`,"major",t);if(typeof o.minor!="number"||o.minor<ze)throw W(Xe,"outdated",t);return e}function Pe(e,t){return t.code===p.MethodNotFound&&e.startsWith("changes.")?W(Xe,"outdated"):T.from(t)}function ye(e){const t=e.fetch??(s=>fetch(s));let n=1;async function o(s){const i={"content-type":"application/json",accept:"application/json",...e.headers},a=await t(new Request(e.endpoint,{method:"POST",headers:i,body:JSON.stringify(s)}));let c;try{c=await Ht(a)}catch{throw new T(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?T.from(l):new T(p.Unavailable,`the endpoint answered HTTP ${a.status}`)}return c}const r=async(s,i)=>{const a=n++,c=await o({jsonrpc:"2.0",id:a,method:s,params:i??{}});if(c.error)throw Pe(s,c.error);return c.result};return{call:r,describe:async()=>Ze(await r("describe")),schemaGet:s=>r("schema.get",s),blocksList:s=>r("blocks.list",s),blocksApply:s=>r("blocks.apply",s),changesList:s=>r("changes.list",s),changesGet:s=>r("changes.get",s),changesDiscard:s=>r("changes.discard",s),async batch(s){const i=s.map(()=>n++),a=await o(s.map((l,d)=>({jsonrpc:"2.0",id:i[d],method:l.method,params:l.params??{}}))),c=new Map(a.map(l=>[l.id,l]));return i.map((l,d)=>{const u=c.get(l);return u?u.error?{ok:!1,error:Pe(s[d].method,u.error)}:{ok:!0,result:u.result}:{ok:!1,error:new T(p.InternalError,"no response for this call")}})}}}const fe=".json";[...Array.from({length:9},(e,t)=>`COM${t+1}`),...Array.from({length:9},(e,t)=>`LPT${t+1}`)];new TextEncoder;function Gt(e){return`${encodeURIComponent(e)}${fe}`}function et(e){return e.endsWith(fe)?e.slice(0,-fe.length):e}function Eo(e){const t=et(e);try{return decodeURIComponent(t)}catch{return t}}function Kt(e){let t=et(e),n=0;for(;t.includes("%");){let o;try{o=decodeURIComponent(t)}catch{break}if(o===t)break;t=o,n++}return{name:t,passes:n}}function ko(e){return Kt(Gt(e)).name}const $e=20,Ae=5,Le=500;function Se(e){return e instanceof T?e.code===p.MethodNotFound?!0:e.code===p.Unsupported&&e.data?.reason==="outdated":!1}function he(e,t){return t.notModified?e?{...e,base:t.base}:null:{revision:t.revision,base:t.base,changes:t.changes}}async function qt(e,t,n){const o=m.contentChanges(n),r=e.getQueryData(o),s=await t.changesList(r?{ifNoneMatch:r.revision}:{}),i=he(r,s);if(i)return i;const a=await t.changesList({});return he(void 0,a)}async function Jt(e,t){const n=[];for(let s=0;s<t.length;s+=$e)n.push(t.slice(s,s+$e));const o=Object.create(null),r=[];for(let s=0;s<n.length;s+=Ae){const i=await e.batch(n.slice(s,s+Ae).map(a=>({method:"changes.get",params:{names:a}})));for(const a of i){if(!a.ok)throw a.error;const c=a.result;Object.assign(o,c.entries),r.push(...c.diagnostics)}}return{entries:o,diagnostics:r}}async function Co(e,t){let n={revision:"",versions:{}};for(let o=0;o<t.length;o+=Le){const r=t.slice(o,o+Le),s=await e.changesDiscard({names:r.map(i=>i.name),ifMatch:Object.fromEntries(r.map(i=>[i.name,i.version]))});n={revision:s.revision,versions:{...n.versions,...s.versions}}}return n}function Io(e){return e instanceof T&&e.code===p.Conflict}function tt(e){return e?.kind==="protocol"?e:null}function Oo(e,t,n){const o=P.c(14);let r;o[0]!==n?(r={},o[0]=n,o[1]=r):r=o[1];const s=r,i=q();let a;o[2]!==e?(a=tt(e),o[2]=e,o[3]=a):a=o[3];const c=a,l=!!c&&!!t&&s.enabled!==!1;let d;o[4]!==t?(d=m.contentChanges(t??""),o[4]=t,o[5]=d):d=o[5];let u;o[6]!==t||o[7]!==l||o[8]!==c||o[9]!==i?(u=l?()=>qt(i,c.client,t):Ye,o[6]=t,o[7]=l,o[8]=c,o[9]=i,o[10]=u):u=o[10];let h;return o[11]!==d||o[12]!==u?(h={queryKey:d,queryFn:u,staleTime:0},o[11]=d,o[12]=u,o[13]=h):h=o[13],F(h)}function To(e,t,n){const o=P.c(14);let r;o[0]!==e?(r=tt(e),o[0]=e,o[1]=r):r=o[1];const s=r;let i;o[2]!==n?(i=n?Object.keys(n.changes):[],o[2]=n,o[3]=i):i=o[3];const a=i,c=!!s&&!!t&&!!n&&a.length>0;let l;o[4]!==t||o[5]!==n?.revision?(l=m.contentChangeSides(t??"",n?.revision??""),o[4]=t,o[5]=n?.revision,o[6]=l):l=o[6];let d;o[7]!==c||o[8]!==a||o[9]!==s?(d=c?()=>Jt(s.client,a):Ye,o[7]=c,o[8]=a,o[9]=s,o[10]=d):d=o[10];let u;return o[11]!==l||o[12]!==d?(u={queryKey:l,queryFn:d,staleTime:Number.POSITIVE_INFINITY},o[11]=l,o[12]=d,o[13]=u):u=o[13],F(u)}function nt(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 X(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 ot=Nt({endpoint:_t().max(2048).refine(e=>nt(e)&&new URL(e).pathname==="/rpc").transform(X)});function No(e){const t=new URLSearchParams(e.replace(/^#/,"")),n=ot.safeParse({endpoint:t.get("endpoint")??""});return n.success?n.data:null}function rt(e){const t=ot.safeParse(e);return t.success?t.data:null}const st="studio:deco-serve-last";function _o(e){try{localStorage.setItem(st,JSON.stringify(e))}catch{}}function Do(){try{const e=localStorage.getItem(st);return e?rt(JSON.parse(e)):null}catch{return null}}function xo(e){try{return new URL(X(e)).host}catch{return e}}function Yt(e,t=1e4){return Math.min(1e3*2**Math.max(0,e-1),t)}const Wt="http://localhost:4545/rpc",Ro="npx @decocms/blocks serve",Po="npx @decocms/blocks schema";class Ee extends Error{constructor(t="the endpoint isn't deco serve"){super(t),this.name="NotDecoServeError"}}function zt(e){if(e instanceof Ee)return{reason:"not-deco-serve"};if(!(e instanceof T))return{reason:"not-answering"};switch(e.code){case p.Unauthorized:case p.MethodNotFound:return{reason:"outdated"};case p.Unsupported:return Se(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 $o(e,t){if(e)return[X(e.endpoint)];const n=[t?.endpoint,Wt].filter(o=>!!o).map(X);return[...new Set(n)]}const it=U.createContext(null);function Xt(e){const t=P.c(27),n=U.useContext(it),o=pe(n?null:e),{data:r}=Dt.useSession(),s=r?.user?.id??"",i=!!e&&!!s;let a;t[0]!==i||t[1]!==s||t[2]!==e?(a=i?ce.decoServeConnection(s,e):null,t[0]=i,t[1]=s,t[2]=e,t[3]=a):a=t[3];const[c,l]=Ue(a);let d;t[4]!==i||t[5]!==s||t[6]!==e?(d=i?ce.decoServeEndpoint(s,e):null,t[4]=i,t[5]=s,t[6]=e,t[7]=d):d=t[7];const[u,h]=Ue(d);if(n)return n;let b;t[8]!==c||t[9]!==i?(b=i?rt(c):null,t[8]=c,t[9]=i,t[10]=b):b=t[10];const g=b,k=!!g;let C;t[11]!==o||t[12]!==k?(C=Zt(o,k),t[11]=o,t[12]=k,t[13]=C):C=t[13];const{applies:x,undecided:N}=C,_=x?g:null,I=i&&o==="v8"&&typeof u=="string"?u:null;let O;t[14]!==h||t[15]!==l||t[16]!==i?(O=S=>{i&&(l(S),h(S.endpoint))},t[14]=h,t[15]=l,t[16]=i,t[17]=O):O=t[17];let w;t[18]!==l||t[19]!==i?(w=()=>{i&&l(null)},t[18]=l,t[19]=i,t[20]=w):w=t[20];let y;return t[21]!==_||t[22]!==I||t[23]!==O||t[24]!==w||t[25]!==N?(y={connection:_,undecided:N,lastEndpoint:I,set:O,clear:w},t[21]=_,t[22]=I,t[23]=O,t[24]=w,t[25]=N,t[26]=y):y=t[26],y}function Zt(e,t){return t?e==="loading"?{applies:!1,undecided:!0}:{applies:e==="v8"||e==="error",undecided:!1}:{applies:!1,undecided:!1}}function Fe(e){try{const t=localStorage.getItem(e);return t===null?null:JSON.parse(t)}catch{return null}}function Ue(e){const t=P.c(17),n=q(),o=e??"";let r;t[0]!==o?(r=["localStorage",o],t[0]=o,t[1]=r):r=t[1];const s=r;let i,a;t[2]!==e?(i=()=>e?Fe(e):null,a=()=>e?Fe(e):null,t[2]=e,t[3]=i,t[4]=a):(i=t[3],a=t[4]);const c=!!e;let l;t[5]!==s||t[6]!==i||t[7]!==a||t[8]!==c?(l={queryKey:s,queryFn:i,initialData:a,enabled:c,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[5]=s,t[6]=i,t[7]=a,t[8]=c,t[9]=l):l=t[9];const{data:d}=F(l);let u;t[10]!==e||t[11]!==n||t[12]!==s?(u=k=>{if(e){try{k===null?localStorage.removeItem(e):localStorage.setItem(e,JSON.stringify(k))}catch{}n.setQueryData(s,k)}},t[10]=e,t[11]=n,t[12]=s,t[13]=u):u=t[13];const h=u,b=e?d??null:null;let g;return t[14]!==h||t[15]!==b?(g=[b,h],t[14]=h,t[15]=b,t[16]=g):g=t[16],g}function Ao(e){return e.kind==="protocol"||e.kind==="unavailable"}function Lo(e){const t=e.hasOrg?e.orgFlag:!1,{backend:n}=e;return n==="protocol"||n==="unavailable"?!0:n==="pending"?t===!0?!0:void 0:t}function Fo(e,t,n){return t!=="github"||n!=="v8"?!1:e.kind==="pending"?!0:e.kind==="unavailable"&&e.siteNotOwned?!1:(e.kind==="protocol"||e.kind==="unavailable")&&e.source==="github"}function Uo(e){if(e.kind!=="protocol"||e.source!=="local")return null;const t=e.describe.preview?.url;return t&&nt(t)?t:null}function Mo(e,t){return e.kind!=="protocol"||e.source!=="local"||!e.describe.assets||!t?null:new URL(t.endpoint).origin}function at(e){return e.hasServeConnection?"local":e.runtime==="sandbox"?"sandbox":"github"}function en(e){if(!e.hasProject)return"legacy";const t=at(e);if(t==="local")return"protocol-local";if(e.serveConnectionUndecided)return"pending";if(t==="sandbox"){const o=e.sandboxSite;return o==="v8"?"protocol-sandbox":o==="v7"?"legacy":o==="error"?e.markedV8?"retrying-sandbox":"legacy":"pending"}if(e.mainSchema==="loading")return"pending";if(e.mainSchema==="error")return"retrying-github";if(e.mainSchema==="v7")return"legacy";const n=e.githubSite;return n==="v8"?"protocol-github":n==="not-owned"?"site-not-owned-github":n==="error"?"unavailable-github":n==="v7"?"legacy":"pending"}function tn(e){return{github:e.mode==="github"&&e.mainSchema==="v8",sandbox:e.mode==="sandbox"&&e.workingTreeReady}}function Me(e){return e.isError||e.errorUpdateCount>0}function nn(e,t,n){if(!t||n.size===0)return e;const o={...e};for(const r of n)Object.hasOwn(t,r)?o[r]=t[r]:delete o[r];return o}function on(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}function ne(e){return{[$t]:e}}class ke extends Error{status=409;constructor(){super("main's schema changed")}}async function Ce(e){return e.status!==409?!1:(await e.clone().json().catch(()=>null))?.code===At}function Ie(e,t,n){e.resetQueries({predicate:o=>{const r=o.queryKey;return r[1]!==t||r[2]!==n?!1:r[0]===m.mainSchemaV8(t,n)[0]||r[0]===m.contentBackend()[0]&&r[4]==="github"}})}function ct(e,t,n){return e.getQueryData(m.mainSchemaV8(t,n))}const lt="__noSchema";function rn(){return{manifest:{blocks:{}},schema:{definitions:{},root:{}},[lt]:!0}}function jo(e){return!!e&&e[lt]===!0}function ut(e){if(!e.ok)return e.error.code===p.NotFound;const t=e.result;return t.notModified===!1&&t.schema===null}function sn(e,t){return(typeof t.name=="string"?t.name.trim():"")||e}const an=(e,t)=>e.label.localeCompare(t.label)||e.key.localeCompare(t.key);function Bo(e){const t=new Map;for(const[n,o]of Object.entries(e)){const r=o&&typeof o=="object"&&!Array.isArray(o)?o:{},s=typeof r.__resolveType=="string"?r.__resolveType:null,i=t.get(s)??[];i.push({key:n,label:sn(n,r)}),t.set(s,i)}return[...t.entries()].map(([n,o])=>({resolveType:n,blocks:o.sort(an)})).sort((n,o)=>n.resolveType===null?1:o.resolveType===null?-1:je(n.resolveType).localeCompare(je(o.resolveType))||n.resolveType.localeCompare(o.resolveType))}function je(e){return(e.split("/").filter(Boolean).at(-1)??e).replace(/\.(tsx?|jsx?)$/,"")||e}function Be(e,t,n){if(t.length===0)return n;const[o,...r]=t;if(Array.isArray(e)&&typeof o=="number"){const s=e.slice();return s[o]=Be(e[o],r,n),s}if(e&&typeof e=="object"&&typeof o=="string"){const s=e,i={};for(const a of Object.keys(s))i[a]=a===o?Be(s[a],r,n):s[a];return i}return e}function Qo(e){if(e.trim()==="")return null;const t=Number(e);return Number.isFinite(t)?t:null}class Qe extends Error{}class Ve extends Error{}const dt="site-not-owned";async function cn(e){return e.status!==409?!1:(await e.clone().json().catch(()=>null))?.code==="site_not_owned"}async function ln(e,t=r=>fetch(r),n,o){const r=ye({endpoint:e,fetch:async s=>{const i=new Request(s);for(const[c,l]of Object.entries(ne("v8")))i.headers.set(c,l);const a=await t(i);if(await cn(a))throw new Ve;if(await Ce(a))throw n?.(),new ke;return a}});try{const s=await Te(r,le(o)?{schema:o}:void 0);return s.v8Schema?s:null}catch(s){if(s instanceof Ve)return dt;throw s}}const Oe=5e3;function un(e){return new URL(`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}/rpc`,window.location.origin).href}function dn(e){return new URL(te(e,"rpc"),window.location.origin).href}async function Te(e,t){const[n,o]=await e.batch(t?[{method:"describe"}]:[{method:"describe"},{method:"schema.get"}]);if(!n?.ok)throw n?.error??new Error("no describe");if(n.result?.protocol!==K)throw new Ee;const s=Ze(n.result);if(t)return{client:e,describe:s,hasSchema:t.schema!=null,v8Schema:le(t.schema)};if(!o)throw new Error("no schema.get");if(ut(o))return{client:e,describe:s,hasSchema:!1,v8Schema:!1};if(o.ok){const i=o.result;return{client:e,describe:s,hasSchema:!0,v8Schema:le(i?.schema)}}throw o.error}async function fn(e,t=n=>fetch(n)){const n=ye({endpoint:e,fetch:async o=>{const r=await t(o);if(r.status===404)throw new Qe;return r}});try{const o=await Te(n);return o.v8Schema?o:null}catch(o){if(o instanceof Qe)return null;throw o}}function ft(e,t){const n=P.c(53),{org:o}=xt(),{connection:r,undecided:s}=Xt(e),{runtime:i}=We(e),a=U.useContext(it),c=pe(a?null:e),l=Lt(e),d=at({hasServeConnection:!!r,runtime:i}),u=Mt()?.taskId??null,h=jt(Bt().lifecycle.phase),b=q(),g=tn({mode:d,mainSchema:c,workingTreeReady:h}),k=g.github&&!!o.slug&&!!e&&!!t;let C;n[0]!==t||n[1]!==o.slug||n[2]!==b||n[3]!==e?(C=()=>ln(un({orgSlug:o.slug,virtualMcpId:e,branch:t}),void 0,()=>Ie(b,o.slug,e),ct(b,o.slug,e)?.schema),n[0]=t,n[1]=o.slug,n[2]=b,n[3]=e,n[4]=C):C=n[4];const x=F({queryKey:m.contentBackend(o.slug,e??"",t??"","github"),queryFn:C,enabled:k,staleTime:Number.POSITIVE_INFINITY,...He}),N=g.sandbox&&!!o.slug&&!!e&&!!t;let _;n[5]!==t||n[6]!==o.slug||n[7]!==u||n[8]!==e?(_=async()=>fn(dn({orgSlug:o.slug,virtualMcpId:e,branch:t,threadId:u})),n[5]=t,n[6]=o.slug,n[7]=u,n[8]=e,n[9]=_):_=n[9];const I=F({queryKey:m.contentBackend(o.slug,e??"",t??"","sandbox",u??""),queryFn:_,enabled:N,staleTime:Number.POSITIVE_INFINITY,...He}),O=!!r;let w;n[10]!==r?.endpoint||n[11]!==o.slug||n[12]!==e?(w=m.contentBackend(o.slug,e??"","local",r?.endpoint??""),n[10]=r?.endpoint,n[11]=o.slug,n[12]=e,n[13]=w):w=n[13];let y;n[14]!==r?(y=()=>Te(ye({endpoint:r.endpoint})),n[14]=r,n[15]=y):y=n[15];let S;n[16]!==O||n[17]!==w||n[18]!==y?(S={queryKey:w,queryFn:y,enabled:O,staleTime:Number.POSITIVE_INFINITY,retry:mn,retryDelay:gn,refetchInterval:hn},n[16]=O,n[17]=w,n[18]=y,n[19]=S):S=n[19];const v=F(S);let $;n[20]!==r?.endpoint||n[21]!==o.slug||n[22]!==e?($=m.contentBackend(o.slug,e??"","local",r?.endpoint??""),n[20]=r?.endpoint,n[21]=o.slug,n[22]=e,n[23]=$):$=n[23];const A=$;let E;n[24]!==r?.endpoint||n[25]!==o.slug||n[26]!==e?(E=m.contentBackend(o.slug,e??"","local-describe",r?.endpoint??""),n[24]=r?.endpoint,n[25]=o.slug,n[26]=e,n[27]=E):E=n[27];let D;n[28]!==v.data||n[29]!==A||n[30]!==b?(D=async()=>{try{return await v.data.client.describe()}catch(f){const G=f;throw b.invalidateQueries({queryKey:A,exact:!0},{cancelRefetch:!1}),G}},n[28]=v.data,n[29]=A,n[30]=b,n[31]=D):D=n[31];const R=!!v.data&&!a;let M;n[32]!==E||n[33]!==D||n[34]!==R?(M={queryKey:E,queryFn:D,enabled:R,refetchInterval:Oe,retry:!1},n[32]=E,n[33]=D,n[34]=R,n[35]=M):M=n[35];const Q=F(M).data??v.data?.describe,L=en({hasProject:!!e,hasServeConnection:!!r,serveConnectionUndecided:s,runtime:i,mainSchema:c,githubSite:x.data===dt?"not-owned":x.data?"v8":x.data===null?"v7":Me(x)?"error":"loading",sandboxSite:vn({data:I.data,isError:Me(I),workingTreeReady:h}),markedV8:l});if(L==="pending"){let f;return n[36]===Symbol.for("react.memo_cache_sentinel")?(f={kind:"pending"},n[36]=f):f=n[36],f}if(L==="retrying-github"){let f;return n[37]===Symbol.for("react.memo_cache_sentinel")?(f={kind:"pending",retrying:"github"},n[37]=f):f=n[37],f}if(L==="retrying-sandbox"){let f;return n[38]===Symbol.for("react.memo_cache_sentinel")?(f={kind:"pending",retrying:"sandbox"},n[38]=f):f=n[38],f}if(L==="legacy"){let f;return n[39]===Symbol.for("react.memo_cache_sentinel")?(f={kind:"legacy"},n[39]=f):f=n[39],f}if(L==="protocol-github"){const f=x.data;let G;return n[40]!==f?(G=ge("github",f,""),n[40]=f,n[41]=G):G=n[41],G}if(L==="site-not-owned-github"){let f;return n[42]===Symbol.for("react.memo_cache_sentinel")?(f={kind:"unavailable",source:"github",siteNotOwned:!0},n[42]=f):f=n[42],f}if(L==="protocol-sandbox"){let f;return n[43]!==I.data?(f=ge("sandbox",I.data,":sandbox"),n[43]=I.data,n[44]=f):f=n[44],f}if(L==="unavailable-github"){let f;return n[45]===Symbol.for("react.memo_cache_sentinel")?(f={kind:"unavailable",source:"github"},n[45]=f):f=n[45],f}const se=v.error??v.failureReason,ie=r?.endpoint??"";let Y;return n[46]!==Q||n[47]!==v.data||n[48]!==v.failureCount||n[49]!==v.isError||n[50]!==se||n[51]!==ie?(Y=wn({probed:v.data,isError:v.isError,failureCount:v.failureCount,failure:se,describe:Q,endpoint:ie}),n[46]=Q,n[47]=v.data,n[48]=v.failureCount,n[49]=v.isError,n[50]=se,n[51]=ie,n[52]=Y):Y=n[52],Y}function hn(e){return e.state.status==="error"||e.state.data?.v8Schema===!1?Oe:!1}function gn(e){return Yt(e+1)}function mn(e,t){return!(t instanceof T)&&!(t instanceof Ee)}function vn(e){return e.data!==void 0?e.data?"v8":"v7":e.workingTreeReady?e.isError?"error":"loading":"unavailable"}const bn=3;function wn(e){if(e.probed?.hasSchema&&!e.probed.v8Schema)return{kind:"unavailable",source:"local",problem:{reason:"not-v8"}};const t=e.probed?ge("local",{...e.probed,describe:e.describe??e.probed.describe},`:serve:${e.endpoint}`):null;return e.isError||e.failureCount>0?t?.kind==="protocol"&&!e.isError&&e.failureCount<bn?t:{kind:"unavailable",source:"local",problem:zt(e.failure)}:t??{kind:"pending"}}const He={retry:2,refetchInterval:e=>e.state.status==="error"?Oe:!1};function ge(e,t,n){return{kind:"protocol",source:e,client:t.client,describe:t.describe,cacheKeySuffix:n,hasSchema:t.hasSchema}}function ht(e){const t=P.c(13);let n;t[0]!==e?(n=ce.localPreviewUrl(e??""),t[0]=e,t[1]=n):n=t[1];const o=n,[r,s]=Rt(o,null),i=pe(e);let a;if(t[2]!==i||t[3]!==r||t[4]!==e){const h=e?Re(r):null;a=pn({saved:h,main:i}),t[2]=i,t[3]=r,t[4]=e,t[5]=a}else a=t[5];const c=a;let l,d;t[6]!==s?(l=h=>s(Re(h)),d=()=>s(null),t[6]=s,t[7]=l,t[8]=d):(l=t[7],d=t[8]);let u;return t[9]!==c||t[10]!==l||t[11]!==d?(u={...c,setUrl:l,clear:d},t[9]=c,t[10]=l,t[11]=d,t[12]=u):u=t[12],u}function pn(e){return e.saved?e.main==="v7"?{url:e.saved,undecided:!1}:e.main==="v8"?{url:null,undecided:!1}:{url:null,undecided:!0}:{url:null,undecided:!1}}function yn(e,t){const n=(e??"").trim().replace(/^[/\\]+|[/\\]+$/g,"");return n?`${n}/${t}`:t}function Ge(e){let t;try{t=JSON.parse(e)}catch{return null}return typeof t!="object"||t===null||Array.isArray(t)?null:t}class Ne extends Error{constructor(t,n,o=[]){super(n),this.blocks=t,this.fields=o,this.name="BlockConflictError"}blocks;fields}function _e(e){return`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`}function oe(e,t,n){return["decofile-write",e,t,n]}function Sn(e,t,n){return{id:oe(e,t,n).join(":")}}function De(e){return`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}`}async function En(e,t){const n=await e.json().catch(()=>({}));throw new Error(n.error??`${t} failed (${e.status})`)}function kn(e,t,n){e.setQueryData(m.decofileDraft(_e(t)),n)}function Cn(e,t){return e.getQueryData(m.decofileDraft(_e(t)))??null}async function In(e,t){const n=await fetch(De(e),{cache:"no-store",headers:{...ne("v7"),"if-none-match":`"${t}"`}}).catch(()=>null);return n?.status===200||n?.status===409}function Vo(e){const t=P.c(4);let n;t[0]!==e?(n=m.decofileDraft(e?_e(e):""),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:On,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:r}=F(o);return r??null}async function On(){throw new Error("decofileDraft is populated by reads/writes, not fetched")}async function Tn(e,t){const n=await fetch(De(t),{cache:"no-store",headers:ne("v7")});if(await Ce(n))throw Ie(e,t.orgSlug,t.virtualMcpId),new ke;if(!n.ok){const r=new Error(`Failed to fetch decofile: ${n.status}`);throw r.status=n.status,r}const o=await n.json();return o.token&&kn(e,t,{version:o.version,token:o.token,apiHost:o.apiHost??window.location.host}),o.decofile}async function Ho(e,t){const n=await fetch(De(e),{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(n.status===409){const r=await n.json().catch(()=>({}));throw r.code==="block-conflict"?new Ne(r.blocks??[],r.error??"Block changed"):new Error(r.error??`Save failed (${n.status})`)}if(!n.ok)return En(n,"Save");const o=await n.json();return{...o,apiHost:o.apiHost??window.location.host}}const gt=3e3,Nn=15e3,_n=2*6e4,mt={now:()=>Date.now(),setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),hidden:()=>typeof document<"u"&&document.visibilityState==="hidden"};function Dn(e){return e<_n?gt:Nn}function xn(e,t=mt){const n=t.now();let o=!1,r=!1,s=null;const i=()=>{o||(s=t.setTimeout(a,Dn(t.now()-n)))},a=()=>{if(s=null,o)return;const{read:c,skip:l}=e();if(r||t.hidden()||l?.()){i();return}r=!0;let d;try{d=c()}catch{d=void 0}Promise.resolve(d).catch(()=>{}).finally(()=>{r=!1}),i()};return i(),()=>{o=!0,s!==null&&t.clearTimeout(s)}}const Ke=()=>0;function Rn(e,t,n=mt){const o=U.useRef(t);o.current=t;const[r]=U.useState(()=>({polling:()=>xn(()=>o.current,n),idle:()=>()=>{}}));U.useSyncExternalStore(e?r.polling:r.idle,Ke,Ke)}function vt(e,t){return te(e,t)}function Pn(e,t){return te(e,"preview-fetch",{path:t})}function Go(e){return vt(e,"preview-invoke")}function Ko(e){return vt(e,"catalog-invoke")}function bt(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 $n(){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&&bt(n))return n}return null}function An(e,t){const n=e.previewUrl??e.getFallbackPreviewUrl?.()??$n();return n&&bt(n)?new URL(t,n).toString():Pn(e,t)}function Ln(e){return An(e,"/.decofile")}function Fn(e){return e===400?"absent":e===404?"unavailable":e>=200&&e<300?"ok":"error"}function qe(e){return e.liveOk||e.committedAbsent?404:e.liveStatus??502}async function Un(e,t){const n=te(e,"read"),o=await fetch(n,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:t,full:!0})}),r=Fn(o.status);if(r==="absent")return{kind:"absent"};if(r==="unavailable")return{kind:"unavailable"};if(r==="error"){const i=new Error(`Failed to read ${t}: ${o.status}`);throw i.status=o.status,i}const s=await o.json();return typeof s.content!="string"?{kind:"unavailable"}:{kind:"data",data:Ft(s.content)}}async function Mn(e,t){const n=await Un(e,t);if(n.kind!=="data")return n;try{return{kind:"data",data:JSON.parse(n.data)}}catch{return{kind:"unavailable"}}}async function qo(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 jn(e){return Ut(e)?.metadata?.runtime?.path??null}class wt extends Error{constructor(t){super(t instanceof Error?t.message:String(t),{cause:t}),this.name="ServeLostError"}}function Jo(e){return e instanceof T&&e.code===p.Conflict}function pt(e){const t=e.data?.violations;return!Array.isArray(t)||t.length===0?e.message:t.slice(0,3).map(n=>n.message).join("; ")}function Bn(e,t,n){if(t instanceof Ne)return t.message;if(n==="local")return Vn(e,t);if(t instanceof T)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 Qn(e,t){if(t==="local"||e instanceof Ne)return null;if(e instanceof T){const n=e.code===p.InvalidBlock||e.code===p.InvalidParams?pt(e):e.message;return n?`${e.code}: ${n}`:null}return e.message||null}function Vn(e,t){if(t instanceof wt)return e("decoServe.save.serverGone");if(t instanceof T)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:pt(t)});case p.LimitExceeded:return e("decoServe.save.tooLarge")}return e("sectionsEditor.sectionsEditor.saveFailed",{error:t.message})}function Hn(e,t,n){return e===null?0:Math.max(0,n-Math.max(0,t-e))}function Gn(e,t){const[n,o]=U.useState(e),r=U.useRef(null);return e&&!n&&o(!0),U.useEffect(()=>{if(e){r.current??=Date.now();return}if(!n)return;const s=()=>{r.current=null,o(!1)},i=Hn(r.current,Date.now(),t);if(i===0){s();return}const a=setTimeout(s,i);return()=>clearTimeout(a)},[e,n,t]),n}const yt={phase:"idle",inFlight:0,reload:{seq:0,navigates:!1},epoch:0},Kn=15e3,Z=new Map;function H(e,t){return`${e}/${t}`}function j(e){let t=Z.get(e);return t||(t={state:yt,listeners:new Set,previews:0,timer:null,discardListeners:new Set},Z.set(e,t)),t}function B(e,t){const n=j(e);n.state={...n.state,...t};for(const o of n.listeners)o()}function re(e){e.timer&&clearTimeout(e.timer),e.timer=null}function xe(e){return Z.get(e)?.state??yt}function qn(e,t){const n=j(e);return n.listeners.add(t),()=>{n.listeners.delete(t)}}function Yo(e){const t=j(e);return t.previews++,()=>{t.previews--,t.previews===0&&t.state.phase==="reloading"&&(re(t),B(e,{phase:"idle"}))}}function Wo(e){const t=Z.get(e);!t||t.state.phase!=="reloading"||(re(t),B(e,{phase:"idle"}))}function St(e){const t=j(e);re(t),B(e,{phase:"saving",inFlight:t.state.inFlight+1})}function me(e,t){const n=j(e),o=Math.max(0,n.state.inFlight-1);if(o>0){B(e,{inFlight:o});return}if(!t.ok||n.previews===0){B(e,{phase:"idle",inFlight:o});return}Et(e,t.navigates,o)}function Et(e,t,n=0){const o=j(e);re(o),o.timer=setTimeout(()=>{o.timer=null,o.state.phase==="reloading"&&B(e,{phase:"idle"})},Kn),B(e,{phase:"reloading",inFlight:n,reload:{seq:o.state.reload.seq+1,navigates:t}})}function Jn(e){return e?.kind==="protocol"&&e.source==="github"}async function ve(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:r,branch:s,backend:i,cacheKey:a}=e,c=t.kind==="publish"||t.kind==="reapply"?n.invalidateQueries({queryKey:m.hostedReleases(o,r)}):null;if(i?.kind!=="protocol")return await c,{navigates:!1};const l=s?m.protocolDraftRead(o,r,s):null,d=l?JSON.stringify(n.getQueryData(l)??null):null,u=c?[c]:[];if(a&&t.reread&&u.push(n.invalidateQueries({queryKey:m.decofile(a)})),a&&u.push(n.invalidateQueries({queryKey:m.contentChanges(a)})),s&&i.source==="sandbox"&&u.push(n.invalidateQueries({queryKey:Qt(o,r,s)})),Jn(i)&&l&&u.push(n.invalidateQueries({queryKey:l})),await Promise.all(u),t.kind!=="edit"){const g=H(o,r);B(g,{epoch:xe(g).epoch+1})}const h=l?JSON.stringify(n.getQueryData(l)??null):null,b=d!==h;return b&&await new Promise(g=>Pt.schedule(g)),{navigates:b}}async function Yn(e,t){return St(H(e.orgSlug,e.virtualMcpId)),kt(e,t)}async function kt(e,t){const n=H(e.orgSlug,e.virtualMcpId);let o;try{o=await t.write()}catch(s){throw me(n,{ok:!1,navigates:!1}),t.refreshOnError&&ve(e,{kind:t.kind,reread:!0}).catch(()=>{}),s}let r=!1;try{({navigates:r}=await ve(e,t))}catch{}finally{me(n,{ok:!0,navigates:r})}return o}function zo(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:r,branch:s}=e,i=H(o,r),a=new Set(t.blockKeys);for(const d of[...j(i).discardListeners])d(a);St(i);let c=!1;const l=()=>(c=!0,kt(e,{kind:"discard",reread:!0,write:t.write}));return s?n.getMutationCache().build(n,{mutationKey:oe(o,r,s),scope:Sn(o,r,s),mutationFn:l}).execute(void 0).catch(d=>{throw c||me(i,{ok:!1,navigates:!1}),d}):l()}function Xo(e,t,n){const o=P.c(8);let r;o[0]!==e||o[1]!==t?(r=H(e,t),o[0]=e,o[1]=t,o[2]=r):r=o[2];const s=r;let i;o[3]!==n||o[4]!==s?(i=()=>{const c=j(s).discardListeners;return c.add(n),()=>{c.delete(n)}},o[3]=n,o[4]=s,o[5]=i):i=o[5];let a;o[6]!==s?(a=[s],o[6]=s,o[7]=a):a=o[7],U.useEffect(i,a)}function Wn(e){const t=H(e.orgSlug,e.virtualMcpId);xe(t).inFlight>0||ve(e,{kind:"external"}).then(({navigates:n})=>{const o=j(t);o.previews>0&&o.state.inFlight===0&&Et(t,n)}).catch(()=>{})}function zn(e,t){const n=P.c(7);let o;n[0]!==e||n[1]!==t?(o=H(e,t),n[0]=e,n[1]=t,n[2]=o):o=n[2];const r=o;let s;n[3]!==r?(s=l=>qn(r,l),n[3]=r,n[4]=s):s=n[4];const i=s;let a;n[5]!==r?(a=()=>xe(r),n[5]=r,n[6]=a):a=n[6];const c=a;return U.useSyncExternalStore(i,c,c)}const Xn=500;function Zo(e,t){const{phase:n}=zn(e,t);return Gn(n!=="idle",Xn)}function Zn(e){const t=new Error(`${e} unavailable (content server unreachable)`);return t.status=502,t}function eo(e,t){return m.liveMeta(e.orgSlug,e.virtualMcpId,e.branch,`protocol${t.cacheKeySuffix}`,"")}function er(e,t,n){const o=e.getQueryData(m.contentVersions(t));if(!o)return;if(Object.hasOwn(o,n))return o[n];const r=e.getQueryData(m.decofile(t));return r&&Object.hasOwn(r,n)?void 0:null}function Ct(e,t,n){e.setQueryData(m.contentVersions(t),o=>{const r={...o};for(const[s,i]of Object.entries(n))i===null?delete r[s]:r[s]=i;return r})}function to(e,t){const n=e.getMutationCache().findAll({mutationKey:oe(t.orgSlug,t.virtualMcpId,t.branch),status:"pending"});return new Set(n.flatMap(o=>on(o.state.variables)))}function be(e,t){e.resetQueries({queryKey:m.contentBackend(t.orgSlug,t.virtualMcpId,"local")})}async function ee(e,t,n,o){try{return await o()}catch(r){const s=!(r instanceof T);throw t.source==="local"&&s?(be(e,n),new wt(r)):(t.source==="local"&&Se(r)&&be(e,n),r)}}const ae=new Map;function no(e,t,n,o){const r=ae.get(o);if(r)return r;const s=It(e,t,n,o,!0);return ae.set(o,s),s.finally(()=>ae.delete(o))}async function It(e,t,n,o,r){const s=m.decofile(o),i=eo(n,t),a=m.contentRevision(o),c=e.getQueryData(s),l=e.getQueryData(i),d=e.getQueryData(a)??void 0,u=t.source==="github"&&!l?ct(e,n.orgSlug,n.virtualMcpId):void 0,h=u?.isV8&&u.schema&&u.version?u:void 0,b=l??h?.schema,g=h?{...d,schemaVersion:h.version}:d,k=r&&c?g?.revision:void 0,C=r&&b?g?.schemaVersion:void 0,x=m.contentChanges(o),N=e.getQueryData(x),[_,I,O]=await ee(e,t,n,()=>t.client.batch([{method:"blocks.list",params:k?{ifNoneMatch:k}:{}},{method:"schema.get",params:C?{ifNoneMatch:C}:{}},{method:"changes.list",params:N?{ifNoneMatch:N.revision}:{}}]));if(O?.ok){const R=he(N,O.result);R&&e.setQueryData(x,R)}else O&&t.source==="local"&&Se(O.error)&&be(e,n);if(!_?.ok)throw _?.error??new Error("no blocks.list");if(!I)throw new Error("no schema.get");const w=_.result,y=ut(I),S=I.ok&&!y?I.result:null;if(w.notModified&&!c||S?.notModified&&!b)return It(e,t,n,o,!1);const v=w.notModified?new Set:to(e,n),$=w.notModified?c:nn(w.blocks,c,v),A=y?rn():S?S.notModified?b:S.schema:I.error,E=e.getQueryData(a)?.revision,D=E!==void 0&&E!==g?.revision;if(e.setQueryData(a,{revision:D?E:w.notModified?g?.revision:w.revision,schemaVersion:S?S.notModified?g?.schemaVersion:S.version??void 0:void 0}),e.setQueryData(s,$),!w.notModified){const R=m.contentVersions(o),M=e.getQueryData(R),J={...w.versions};for(const Q of v){const L=M?.[Q];L!==void 0?J[Q]=L:delete J[Q]}e.setQueryData(R,J)}return A instanceof T||e.setQueryData(i,A),!D&&!w.notModified&&c&&g?.revision&&w.revision!==g.revision&&Wn({queryClient:e,orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,backend:t,cacheKey:o}),{blocks:$,meta:A}}async function tr(e,t,n,o,r,s){return Yn({queryClient:e,orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,backend:t,cacheKey:o},{kind:"edit",write:async()=>{const i=await ee(e,t,n,()=>t.client.blocksApply({set:r.set,delete:r.delete,...s?{ifMatch:s}:{}}));e.setQueryData(m.contentRevision(o),c=>({...c,revision:i.revision}));const a=i.versions??{};return Ct(e,o,a),{revision:i.revision,versions:a}}})}async function nr(e,t,n,o,r){await e.invalidateQueries({queryKey:m.decofile(o)});let s;try{const a=(await ee(e,t,n,()=>t.client.changesGet({names:[r]}))).entries[r];if(a&&a.after===null&&a.version!==null)return;s={value:a?.after??null,version:a?.version??null}}catch{const i=await ee(e,t,n,()=>t.client.blocksList({}));if(i.notModified)return;s={value:i.blocks[r]??null,version:i.versions[r]??null}}e.setQueryData(m.decofile(o),i=>{const a={...i};return s.value===null?delete a[r]:a[r]=s.value,a}),Ct(e,o,{[r]:s.version})}function or(e){const t=P.c(11),n=q();let o;t[0]!==e?.branch||t[1]!==e?.orgSlug||t[2]!==e?.virtualMcpId?(o=m.protocolDraftRead(e?.orgSlug??"",e?.virtualMcpId??"",e?.branch??""),t[0]=e?.branch,t[1]=e?.orgSlug,t[2]=e?.virtualMcpId,t[3]=o):o=t[3];let r;t[4]!==e||t[5]!==n?(r=async()=>{const c=await fetch(`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}`,{cache:"no-store",headers:ne("v8")});if(await Ce(c))throw Ie(n,e.orgSlug,e.virtualMcpId),new ke;if(!c.ok)throw new Error(`draft pointer read failed: ${c.status}`);return await c.json()},t[4]=e,t[5]=n,t[6]=r):r=t[6];const s=!!e;let i;t[7]!==o||t[8]!==r||t[9]!==s?(i={queryKey:o,queryFn:r,enabled:s,staleTime:Number.POSITIVE_INFINITY},t[7]=o,t[8]=r,t[9]=s,t[10]=i):i=t[10];const{data:a}=F(i);return!e||!a?.draft||!a.version?null:`${a.draft}@${a.version}`}function rr(e){const t=P.c(4);let n;t[0]!==e?(n=m.contentRevision(e),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:oo,staleTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:r}=F(o);return r?.revision}async function oo(){throw new Error("content revisions are set by reads and writes")}function Je(e){const t=`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`;return e.protocolSuffix?`${t}${e.protocolSuffix}`:e.localPreviewUrl?`${t}:local:${e.localPreviewUrl}`:t}function ro(e,t){const n=P.c(6),{url:o}=ht(e?.virtualMcpId),r=ft(e?.virtualMcpId,e?.branch);if(!e)return"";let s;return n[0]!==r.cacheKeySuffix||n[1]!==r.kind||n[2]!==o||n[3]!==t?.tunnel||n[4]!==e?(s=r.kind==="protocol"?Je({...e,protocolSuffix:r.cacheKeySuffix}):Je({...e,localPreviewUrl:t?.tunnel===!1?null:o}),n[0]=r.cacheKeySuffix,n[1]=r.kind,n[2]=o,n[3]=t?.tunnel,n[4]=e,n[5]=s):s=n[5],s}function sr(e,t){const n=P.c(39),{url:o,undecided:r}=ht(e?.virtualMcpId),s=!!o,i=ft(e?.virtualMcpId,e?.branch),a=i.kind==="protocol"?i:null,c=ro(e),l=t?.fetchEnabled??!0,d=jn(e?.virtualMcpId),u=We(e?.virtualMcpId).runtime==="cms",h=q();let b;n[0]!==c?(b=m.decofile(c),n[0]=c,n[1]=b):b=n[1];const g=b;let k;n[2]!==e||n[3]!==h||n[4]!==g?(k=()=>{if(!e||h.isMutating({mutationKey:oe(e.orgSlug,e.virtualMcpId,e.branch)})>0)return!0;const v=h.getQueryState(g);return v?.fetchStatus==="fetching"||Date.now()-(v?.dataUpdatedAt??0)<gt/2},n[2]=e,n[3]=h,n[4]=g,n[5]=k):k=n[5];let C;n[6]!==u||n[7]!==s||n[8]!==e||n[9]!==a||n[10]!==h||n[11]!==g?(C=async()=>{if(e){if(!a&&u&&!s){const v=Cn(h,e)?.version;if(v&&!await In(e,v))return}await h.refetchQueries({queryKey:g,exact:!0},{cancelRefetch:!1})}},n[6]=u,n[7]=s,n[8]=e,n[9]=a,n[10]=h,n[11]=g,n[12]=C):C=n[12];let x;n[13]!==k||n[14]!==C?(x={skip:k,read:C},n[13]=k,n[14]=C,n[15]=x):x=n[15],Rn(!!t?.pollWhile&&!!e,x);let N;n[16]!==i.kind||n[17]!==u||n[18]!==l||n[19]!==c||n[20]!==s||n[21]!==o||n[22]!==d||n[23]!==e||n[24]!==a||n[25]!==h?(N=async()=>{if(a)return(await no(h,a,e,c)).blocks;if(i.kind==="unavailable")throw Zn("decofile");if(s){const E=await fetch(new URL("/.decofile",o).toString(),{cache:"no-store"}).catch(ao),D=E?.ok?Ge(await E.text()):null;if(D)return D;const R=new Error("decofile unavailable (local tunnel unreachable)");throw R.status=502,R}if(u)return Tn(h,e);const v=()=>Mn(e,yn(d,".deco/blocks.gen.json"));if(l){const E=await fetch(Ln(e),{cache:"no-store"}).catch(io);if(E?.ok){const M=Ge(await E.text());if(M)return M}const D=await v();if(D.kind==="data")return D.data;const R=new Error(`Failed to fetch decofile: ${E?.status??"network error"}`);throw R.status=qe({liveOk:!!E?.ok,liveStatus:E?.status,committedAbsent:D.kind==="absent"}),R}const $=await v();if($.kind==="data")return $.data;const A=new Error("decofile unavailable (preview down, no committed snapshot)");throw A.status=qe({liveOk:!1,committedAbsent:$.kind==="absent"}),A},n[16]=i.kind,n[17]=u,n[18]=l,n[19]=c,n[20]=s,n[21]=o,n[22]=d,n[23]=e,n[24]=a,n[25]=h,n[26]=N):N=n[26];const _=!!e&&i.kind!=="pending"&&!r,I=a?0:3e4,O=a?.describe.pollIntervalMs,w=a?"always":void 0;let y;n[27]!==u||n[28]!==s||n[29]!==a?(y=(v,$)=>{if(a||u||s)return v<3;const A=$.status;return A!==502&&A!==404&&v<2},n[27]=u,n[28]=s,n[29]=a,n[30]=y):y=n[30];let S;return n[31]!==g||n[32]!==N||n[33]!==_||n[34]!==I||n[35]!==O||n[36]!==w||n[37]!==y?(S={queryKey:g,queryFn:N,enabled:_,staleTime:I,refetchInterval:O,refetchIntervalInBackground:!1,refetchOnWindowFocus:w,retry:y,retryDelay:so},n[31]=g,n[32]=N,n[33]=_,n[34]=I,n[35]=O,n[36]=w,n[37]=y,n[38]=S):S=n[38],F(S)}function so(e){return Vt(5e3,1e3,e,2,0)}function io(){return null}function ao(){return null}const co="site-editor-save",we="site-editor-publish";function lo(e){const t=P.c(7),{label:n,detail:o}=e;let r;t[0]!==n?(r=V.jsx("summary",{className:"cursor-pointer select-none text-muted-foreground",children:n}),t[0]=n,t[1]=r):r=t[1];let s;t[2]!==o?(s=V.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words font-mono text-muted-foreground",children:o}),t[2]=o,t[3]=s):s=t[3];let i;return t[4]!==r||t[5]!==s?(i=V.jsxs("details",{className:"mt-1 text-xs",children:[r,s]}),t[4]=r,t[5]=s,t[6]=i):i=t[6],i}function Ot(e,t){return t?V.jsx(lo,{label:e("siteEditor.details"),detail:t}):void 0}function ir(e,t,n){z.error(Bn(e,t,n),{id:co,description:Ot(e,Qn(t,n))})}const Tt={action:void 0,duration:void 0};function ar(e,t){z.success(t?e("siteEditor.publish.publishedOn",{host:t}):e("siteEditor.publish.published"),{...Tt,id:we,description:void 0})}function cr(e,{headline:t,body:n,detail:o,retry:r,pending:s,tone:i="error"}){const a=Ot(e,o??null);z[i](t,{id:we,description:n&&a?V.jsxs(V.Fragment,{children:[V.jsx("p",{children:n}),a]}):n??a,action:r?{label:e("siteEditor.tryAgain"),onClick:c=>{c.preventDefault(),z.loading(s??e("thread.publishPopover.publishing"),{...Tt,id:we,description:void 0}),r()}}:void 0,duration:r?Number.POSITIVE_INFINITY:void 0})}function lr(e){return e instanceof Error?e.message||null:e==null?null:String(e)}export{Ho as $,Yt as A,zt as B,nt as C,Wt as D,lo as E,Te as F,ye as G,Go as H,Pn as I,sr as J,Ao as K,jo as L,jn as M,yn as N,at as O,Uo as P,Fo as Q,H as R,Ro as S,it as T,Yo as U,Wo as V,rr as W,Sn as X,oe as Y,Un as Z,En as _,$o as a,kn as a0,tr as a1,eo as a2,no as a3,Zn as a4,qo as a5,Mn as a6,Ne as a7,Jo as a8,nr as a9,ir as aa,Xo as ab,Lo as ac,Bo as ad,je as ae,Be as af,Qo as ag,Po as ah,An as ai,Mo as aj,Vo as ak,or as al,ne as am,we as an,Tt as ao,cr as ap,Ko as aq,er as ar,Xt as b,ht as c,Ot as d,xo as e,lr as f,ko as g,Eo as h,Gt as i,Yn as j,Ie as k,zo as l,Co as m,Io as n,Se as o,No as p,To as q,Do as r,_o as s,ar as t,ft as u,qt as v,ro as w,zn as x,Oo as y,Zo as z};
|
|
1
|
+
import{c as P,o as q,m as F,K as m,aV as Ye,aF as Nt,aG as _t,r as U,a as Dt,aw as ce,a2 as xt,au as Rt,b7 as Pt,t as z,j as V}from"./index-8f_vFFVa.js";import{a as We}from"./input-BhCR1Dvt.js";import{k as $t,M as At,l as le,s as Re}from"./thread-intent-pizqUsAw.js";import{u as pe,c as Lt}from"./use-main-schema-v8-DQ3Tp7hb.js";import{b as te}from"./sandbox-url-D3mC8qhT.js";import{s as Ft}from"./utils-2rl9BEeu.js";import{a as Ut}from"./repository-binding-DbCSIQ25.js";import{u as Mt}from"./chat-context-0V74JN43.js";import{i as jt,u as Bt}from"./index-6Ue7sPGM.js";import{v as Qt}from"./sandbox-git-api-CRxdlhrN.js";import{e as Vt}from"./backoff-CrEUbyZT.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 T 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 T(t.code,t.message,t.data)}}const K="deco-content",ue={major:1},ze=1;async function Ht(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 de={major:ue.major,minor:ze},Xe=`the endpoint speaks an older ${K} than this client needs (${de.major}.${de.minor} or newer): update @decocms/blocks in the site (8.2.0 or newer) and start deco serve again`;function W(e,t,n){const o={reason:t,required:{...de}};if(n){o.actual={protocol:n.protocol,major:n.version?.major,minor:n.version?.minor};const r=n.server;typeof r?.name=="string"&&typeof r.version=="string"&&(o.server={name:r.name,version:r.version})}return new T(p.Unsupported,e,o)}function Ze(e){const t=e??{},{protocol:n,version:o}=t;if(n!==K)throw W(`the endpoint speaks ${JSON.stringify(n)}, not ${K}`,"protocol",t);if(o?.major!==ue.major)throw W(`the endpoint speaks ${K} ${String(o?.major)}.x; this client speaks ${ue.major}.x`,"major",t);if(typeof o.minor!="number"||o.minor<ze)throw W(Xe,"outdated",t);return e}function Pe(e,t){return t.code===p.MethodNotFound&&e.startsWith("changes.")?W(Xe,"outdated"):T.from(t)}function ye(e){const t=e.fetch??(s=>fetch(s));let n=1;async function o(s){const i={"content-type":"application/json",accept:"application/json",...e.headers},a=await t(new Request(e.endpoint,{method:"POST",headers:i,body:JSON.stringify(s)}));let c;try{c=await Ht(a)}catch{throw new T(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?T.from(l):new T(p.Unavailable,`the endpoint answered HTTP ${a.status}`)}return c}const r=async(s,i)=>{const a=n++,c=await o({jsonrpc:"2.0",id:a,method:s,params:i??{}});if(c.error)throw Pe(s,c.error);return c.result};return{call:r,describe:async()=>Ze(await r("describe")),schemaGet:s=>r("schema.get",s),blocksList:s=>r("blocks.list",s),blocksApply:s=>r("blocks.apply",s),changesList:s=>r("changes.list",s),changesGet:s=>r("changes.get",s),changesDiscard:s=>r("changes.discard",s),async batch(s){const i=s.map(()=>n++),a=await o(s.map((l,d)=>({jsonrpc:"2.0",id:i[d],method:l.method,params:l.params??{}}))),c=new Map(a.map(l=>[l.id,l]));return i.map((l,d)=>{const u=c.get(l);return u?u.error?{ok:!1,error:Pe(s[d].method,u.error)}:{ok:!0,result:u.result}:{ok:!1,error:new T(p.InternalError,"no response for this call")}})}}}const fe=".json";[...Array.from({length:9},(e,t)=>`COM${t+1}`),...Array.from({length:9},(e,t)=>`LPT${t+1}`)];new TextEncoder;function Gt(e){return`${encodeURIComponent(e)}${fe}`}function et(e){return e.endsWith(fe)?e.slice(0,-fe.length):e}function Eo(e){const t=et(e);try{return decodeURIComponent(t)}catch{return t}}function Kt(e){let t=et(e),n=0;for(;t.includes("%");){let o;try{o=decodeURIComponent(t)}catch{break}if(o===t)break;t=o,n++}return{name:t,passes:n}}function ko(e){return Kt(Gt(e)).name}const $e=20,Ae=5,Le=500;function Se(e){return e instanceof T?e.code===p.MethodNotFound?!0:e.code===p.Unsupported&&e.data?.reason==="outdated":!1}function he(e,t){return t.notModified?e?{...e,base:t.base}:null:{revision:t.revision,base:t.base,changes:t.changes}}async function qt(e,t,n){const o=m.contentChanges(n),r=e.getQueryData(o),s=await t.changesList(r?{ifNoneMatch:r.revision}:{}),i=he(r,s);if(i)return i;const a=await t.changesList({});return he(void 0,a)}async function Jt(e,t){const n=[];for(let s=0;s<t.length;s+=$e)n.push(t.slice(s,s+$e));const o=Object.create(null),r=[];for(let s=0;s<n.length;s+=Ae){const i=await e.batch(n.slice(s,s+Ae).map(a=>({method:"changes.get",params:{names:a}})));for(const a of i){if(!a.ok)throw a.error;const c=a.result;Object.assign(o,c.entries),r.push(...c.diagnostics)}}return{entries:o,diagnostics:r}}async function Co(e,t){let n={revision:"",versions:{}};for(let o=0;o<t.length;o+=Le){const r=t.slice(o,o+Le),s=await e.changesDiscard({names:r.map(i=>i.name),ifMatch:Object.fromEntries(r.map(i=>[i.name,i.version]))});n={revision:s.revision,versions:{...n.versions,...s.versions}}}return n}function Io(e){return e instanceof T&&e.code===p.Conflict}function tt(e){return e?.kind==="protocol"?e:null}function Oo(e,t,n){const o=P.c(14);let r;o[0]!==n?(r={},o[0]=n,o[1]=r):r=o[1];const s=r,i=q();let a;o[2]!==e?(a=tt(e),o[2]=e,o[3]=a):a=o[3];const c=a,l=!!c&&!!t&&s.enabled!==!1;let d;o[4]!==t?(d=m.contentChanges(t??""),o[4]=t,o[5]=d):d=o[5];let u;o[6]!==t||o[7]!==l||o[8]!==c||o[9]!==i?(u=l?()=>qt(i,c.client,t):Ye,o[6]=t,o[7]=l,o[8]=c,o[9]=i,o[10]=u):u=o[10];let h;return o[11]!==d||o[12]!==u?(h={queryKey:d,queryFn:u,staleTime:0},o[11]=d,o[12]=u,o[13]=h):h=o[13],F(h)}function To(e,t,n){const o=P.c(14);let r;o[0]!==e?(r=tt(e),o[0]=e,o[1]=r):r=o[1];const s=r;let i;o[2]!==n?(i=n?Object.keys(n.changes):[],o[2]=n,o[3]=i):i=o[3];const a=i,c=!!s&&!!t&&!!n&&a.length>0;let l;o[4]!==t||o[5]!==n?.revision?(l=m.contentChangeSides(t??"",n?.revision??""),o[4]=t,o[5]=n?.revision,o[6]=l):l=o[6];let d;o[7]!==c||o[8]!==a||o[9]!==s?(d=c?()=>Jt(s.client,a):Ye,o[7]=c,o[8]=a,o[9]=s,o[10]=d):d=o[10];let u;return o[11]!==l||o[12]!==d?(u={queryKey:l,queryFn:d,staleTime:Number.POSITIVE_INFINITY},o[11]=l,o[12]=d,o[13]=u):u=o[13],F(u)}function nt(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 X(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 ot=Nt({endpoint:_t().max(2048).refine(e=>nt(e)&&new URL(e).pathname==="/rpc").transform(X)});function No(e){const t=new URLSearchParams(e.replace(/^#/,"")),n=ot.safeParse({endpoint:t.get("endpoint")??""});return n.success?n.data:null}function rt(e){const t=ot.safeParse(e);return t.success?t.data:null}const st="studio:deco-serve-last";function _o(e){try{localStorage.setItem(st,JSON.stringify(e))}catch{}}function Do(){try{const e=localStorage.getItem(st);return e?rt(JSON.parse(e)):null}catch{return null}}function xo(e){try{return new URL(X(e)).host}catch{return e}}function Yt(e,t=1e4){return Math.min(1e3*2**Math.max(0,e-1),t)}const Wt="http://localhost:4545/rpc",Ro="npx @decocms/blocks serve",Po="npx @decocms/blocks schema";class Ee extends Error{constructor(t="the endpoint isn't deco serve"){super(t),this.name="NotDecoServeError"}}function zt(e){if(e instanceof Ee)return{reason:"not-deco-serve"};if(!(e instanceof T))return{reason:"not-answering"};switch(e.code){case p.Unauthorized:case p.MethodNotFound:return{reason:"outdated"};case p.Unsupported:return Se(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 $o(e,t){if(e)return[X(e.endpoint)];const n=[t?.endpoint,Wt].filter(o=>!!o).map(X);return[...new Set(n)]}const it=U.createContext(null);function Xt(e){const t=P.c(27),n=U.useContext(it),o=pe(n?null:e),{data:r}=Dt.useSession(),s=r?.user?.id??"",i=!!e&&!!s;let a;t[0]!==i||t[1]!==s||t[2]!==e?(a=i?ce.decoServeConnection(s,e):null,t[0]=i,t[1]=s,t[2]=e,t[3]=a):a=t[3];const[c,l]=Ue(a);let d;t[4]!==i||t[5]!==s||t[6]!==e?(d=i?ce.decoServeEndpoint(s,e):null,t[4]=i,t[5]=s,t[6]=e,t[7]=d):d=t[7];const[u,h]=Ue(d);if(n)return n;let b;t[8]!==c||t[9]!==i?(b=i?rt(c):null,t[8]=c,t[9]=i,t[10]=b):b=t[10];const g=b,k=!!g;let C;t[11]!==o||t[12]!==k?(C=Zt(o,k),t[11]=o,t[12]=k,t[13]=C):C=t[13];const{applies:x,undecided:N}=C,_=x?g:null,I=i&&o==="v8"&&typeof u=="string"?u:null;let O;t[14]!==h||t[15]!==l||t[16]!==i?(O=S=>{i&&(l(S),h(S.endpoint))},t[14]=h,t[15]=l,t[16]=i,t[17]=O):O=t[17];let w;t[18]!==l||t[19]!==i?(w=()=>{i&&l(null)},t[18]=l,t[19]=i,t[20]=w):w=t[20];let y;return t[21]!==_||t[22]!==I||t[23]!==O||t[24]!==w||t[25]!==N?(y={connection:_,undecided:N,lastEndpoint:I,set:O,clear:w},t[21]=_,t[22]=I,t[23]=O,t[24]=w,t[25]=N,t[26]=y):y=t[26],y}function Zt(e,t){return t?e==="loading"?{applies:!1,undecided:!0}:{applies:e==="v8"||e==="error",undecided:!1}:{applies:!1,undecided:!1}}function Fe(e){try{const t=localStorage.getItem(e);return t===null?null:JSON.parse(t)}catch{return null}}function Ue(e){const t=P.c(17),n=q(),o=e??"";let r;t[0]!==o?(r=["localStorage",o],t[0]=o,t[1]=r):r=t[1];const s=r;let i,a;t[2]!==e?(i=()=>e?Fe(e):null,a=()=>e?Fe(e):null,t[2]=e,t[3]=i,t[4]=a):(i=t[3],a=t[4]);const c=!!e;let l;t[5]!==s||t[6]!==i||t[7]!==a||t[8]!==c?(l={queryKey:s,queryFn:i,initialData:a,enabled:c,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[5]=s,t[6]=i,t[7]=a,t[8]=c,t[9]=l):l=t[9];const{data:d}=F(l);let u;t[10]!==e||t[11]!==n||t[12]!==s?(u=k=>{if(e){try{k===null?localStorage.removeItem(e):localStorage.setItem(e,JSON.stringify(k))}catch{}n.setQueryData(s,k)}},t[10]=e,t[11]=n,t[12]=s,t[13]=u):u=t[13];const h=u,b=e?d??null:null;let g;return t[14]!==h||t[15]!==b?(g=[b,h],t[14]=h,t[15]=b,t[16]=g):g=t[16],g}function Ao(e){return e.kind==="protocol"||e.kind==="unavailable"}function Lo(e){const t=e.hasOrg?e.orgFlag:!1,{backend:n}=e;return n==="protocol"||n==="unavailable"?!0:n==="pending"?t===!0?!0:void 0:t}function Fo(e,t,n){return t!=="github"||n!=="v8"?!1:e.kind==="pending"?!0:e.kind==="unavailable"&&e.siteNotOwned?!1:(e.kind==="protocol"||e.kind==="unavailable")&&e.source==="github"}function Uo(e){if(e.kind!=="protocol"||e.source!=="local")return null;const t=e.describe.preview?.url;return t&&nt(t)?t:null}function Mo(e,t){return e.kind!=="protocol"||e.source!=="local"||!e.describe.assets||!t?null:new URL(t.endpoint).origin}function at(e){return e.hasServeConnection?"local":e.runtime==="sandbox"?"sandbox":"github"}function en(e){if(!e.hasProject)return"legacy";const t=at(e);if(t==="local")return"protocol-local";if(e.serveConnectionUndecided)return"pending";if(t==="sandbox"){const o=e.sandboxSite;return o==="v8"?"protocol-sandbox":o==="v7"?"legacy":o==="error"?e.markedV8?"retrying-sandbox":"legacy":"pending"}if(e.mainSchema==="loading")return"pending";if(e.mainSchema==="error")return"retrying-github";if(e.mainSchema==="v7")return"legacy";const n=e.githubSite;return n==="v8"?"protocol-github":n==="not-owned"?"site-not-owned-github":n==="error"?"unavailable-github":n==="v7"?"legacy":"pending"}function tn(e){return{github:e.mode==="github"&&e.mainSchema==="v8",sandbox:e.mode==="sandbox"&&e.workingTreeReady}}function Me(e){return e.isError||e.errorUpdateCount>0}function nn(e,t,n){if(!t||n.size===0)return e;const o={...e};for(const r of n)Object.hasOwn(t,r)?o[r]=t[r]:delete o[r];return o}function on(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}function ne(e){return{[$t]:e}}class ke extends Error{status=409;constructor(){super("main's schema changed")}}async function Ce(e){return e.status!==409?!1:(await e.clone().json().catch(()=>null))?.code===At}function Ie(e,t,n){e.resetQueries({predicate:o=>{const r=o.queryKey;return r[1]!==t||r[2]!==n?!1:r[0]===m.mainSchemaV8(t,n)[0]||r[0]===m.contentBackend()[0]&&r[4]==="github"}})}function ct(e,t,n){return e.getQueryData(m.mainSchemaV8(t,n))}const lt="__noSchema";function rn(){return{manifest:{blocks:{}},schema:{definitions:{},root:{}},[lt]:!0}}function jo(e){return!!e&&e[lt]===!0}function ut(e){if(!e.ok)return e.error.code===p.NotFound;const t=e.result;return t.notModified===!1&&t.schema===null}function sn(e,t){return(typeof t.name=="string"?t.name.trim():"")||e}const an=(e,t)=>e.label.localeCompare(t.label)||e.key.localeCompare(t.key);function Bo(e){const t=new Map;for(const[n,o]of Object.entries(e)){const r=o&&typeof o=="object"&&!Array.isArray(o)?o:{},s=typeof r.__resolveType=="string"?r.__resolveType:null,i=t.get(s)??[];i.push({key:n,label:sn(n,r)}),t.set(s,i)}return[...t.entries()].map(([n,o])=>({resolveType:n,blocks:o.sort(an)})).sort((n,o)=>n.resolveType===null?1:o.resolveType===null?-1:je(n.resolveType).localeCompare(je(o.resolveType))||n.resolveType.localeCompare(o.resolveType))}function je(e){return(e.split("/").filter(Boolean).at(-1)??e).replace(/\.(tsx?|jsx?)$/,"")||e}function Be(e,t,n){if(t.length===0)return n;const[o,...r]=t;if(Array.isArray(e)&&typeof o=="number"){const s=e.slice();return s[o]=Be(e[o],r,n),s}if(e&&typeof e=="object"&&typeof o=="string"){const s=e,i={};for(const a of Object.keys(s))i[a]=a===o?Be(s[a],r,n):s[a];return i}return e}function Qo(e){if(e.trim()==="")return null;const t=Number(e);return Number.isFinite(t)?t:null}class Qe extends Error{}class Ve extends Error{}const dt="site-not-owned";async function cn(e){return e.status!==409?!1:(await e.clone().json().catch(()=>null))?.code==="site_not_owned"}async function ln(e,t=r=>fetch(r),n,o){const r=ye({endpoint:e,fetch:async s=>{const i=new Request(s);for(const[c,l]of Object.entries(ne("v8")))i.headers.set(c,l);const a=await t(i);if(await cn(a))throw new Ve;if(await Ce(a))throw n?.(),new ke;return a}});try{const s=await Te(r,le(o)?{schema:o}:void 0);return s.v8Schema?s:null}catch(s){if(s instanceof Ve)return dt;throw s}}const Oe=5e3;function un(e){return new URL(`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}/rpc`,window.location.origin).href}function dn(e){return new URL(te(e,"rpc"),window.location.origin).href}async function Te(e,t){const[n,o]=await e.batch(t?[{method:"describe"}]:[{method:"describe"},{method:"schema.get"}]);if(!n?.ok)throw n?.error??new Error("no describe");if(n.result?.protocol!==K)throw new Ee;const s=Ze(n.result);if(t)return{client:e,describe:s,hasSchema:t.schema!=null,v8Schema:le(t.schema)};if(!o)throw new Error("no schema.get");if(ut(o))return{client:e,describe:s,hasSchema:!1,v8Schema:!1};if(o.ok){const i=o.result;return{client:e,describe:s,hasSchema:!0,v8Schema:le(i?.schema)}}throw o.error}async function fn(e,t=n=>fetch(n)){const n=ye({endpoint:e,fetch:async o=>{const r=await t(o);if(r.status===404)throw new Qe;return r}});try{const o=await Te(n);return o.v8Schema?o:null}catch(o){if(o instanceof Qe)return null;throw o}}function ft(e,t){const n=P.c(53),{org:o}=xt(),{connection:r,undecided:s}=Xt(e),{runtime:i}=We(e),a=U.useContext(it),c=pe(a?null:e),l=Lt(e),d=at({hasServeConnection:!!r,runtime:i}),u=Mt()?.taskId??null,h=jt(Bt().lifecycle.phase),b=q(),g=tn({mode:d,mainSchema:c,workingTreeReady:h}),k=g.github&&!!o.slug&&!!e&&!!t;let C;n[0]!==t||n[1]!==o.slug||n[2]!==b||n[3]!==e?(C=()=>ln(un({orgSlug:o.slug,virtualMcpId:e,branch:t}),void 0,()=>Ie(b,o.slug,e),ct(b,o.slug,e)?.schema),n[0]=t,n[1]=o.slug,n[2]=b,n[3]=e,n[4]=C):C=n[4];const x=F({queryKey:m.contentBackend(o.slug,e??"",t??"","github"),queryFn:C,enabled:k,staleTime:Number.POSITIVE_INFINITY,...He}),N=g.sandbox&&!!o.slug&&!!e&&!!t;let _;n[5]!==t||n[6]!==o.slug||n[7]!==u||n[8]!==e?(_=async()=>fn(dn({orgSlug:o.slug,virtualMcpId:e,branch:t,threadId:u})),n[5]=t,n[6]=o.slug,n[7]=u,n[8]=e,n[9]=_):_=n[9];const I=F({queryKey:m.contentBackend(o.slug,e??"",t??"","sandbox",u??""),queryFn:_,enabled:N,staleTime:Number.POSITIVE_INFINITY,...He}),O=!!r;let w;n[10]!==r?.endpoint||n[11]!==o.slug||n[12]!==e?(w=m.contentBackend(o.slug,e??"","local",r?.endpoint??""),n[10]=r?.endpoint,n[11]=o.slug,n[12]=e,n[13]=w):w=n[13];let y;n[14]!==r?(y=()=>Te(ye({endpoint:r.endpoint})),n[14]=r,n[15]=y):y=n[15];let S;n[16]!==O||n[17]!==w||n[18]!==y?(S={queryKey:w,queryFn:y,enabled:O,staleTime:Number.POSITIVE_INFINITY,retry:mn,retryDelay:gn,refetchInterval:hn},n[16]=O,n[17]=w,n[18]=y,n[19]=S):S=n[19];const v=F(S);let $;n[20]!==r?.endpoint||n[21]!==o.slug||n[22]!==e?($=m.contentBackend(o.slug,e??"","local",r?.endpoint??""),n[20]=r?.endpoint,n[21]=o.slug,n[22]=e,n[23]=$):$=n[23];const A=$;let E;n[24]!==r?.endpoint||n[25]!==o.slug||n[26]!==e?(E=m.contentBackend(o.slug,e??"","local-describe",r?.endpoint??""),n[24]=r?.endpoint,n[25]=o.slug,n[26]=e,n[27]=E):E=n[27];let D;n[28]!==v.data||n[29]!==A||n[30]!==b?(D=async()=>{try{return await v.data.client.describe()}catch(f){const G=f;throw b.invalidateQueries({queryKey:A,exact:!0},{cancelRefetch:!1}),G}},n[28]=v.data,n[29]=A,n[30]=b,n[31]=D):D=n[31];const R=!!v.data&&!a;let M;n[32]!==E||n[33]!==D||n[34]!==R?(M={queryKey:E,queryFn:D,enabled:R,refetchInterval:Oe,retry:!1},n[32]=E,n[33]=D,n[34]=R,n[35]=M):M=n[35];const Q=F(M).data??v.data?.describe,L=en({hasProject:!!e,hasServeConnection:!!r,serveConnectionUndecided:s,runtime:i,mainSchema:c,githubSite:x.data===dt?"not-owned":x.data?"v8":x.data===null?"v7":Me(x)?"error":"loading",sandboxSite:vn({data:I.data,isError:Me(I),workingTreeReady:h}),markedV8:l});if(L==="pending"){let f;return n[36]===Symbol.for("react.memo_cache_sentinel")?(f={kind:"pending"},n[36]=f):f=n[36],f}if(L==="retrying-github"){let f;return n[37]===Symbol.for("react.memo_cache_sentinel")?(f={kind:"pending",retrying:"github"},n[37]=f):f=n[37],f}if(L==="retrying-sandbox"){let f;return n[38]===Symbol.for("react.memo_cache_sentinel")?(f={kind:"pending",retrying:"sandbox"},n[38]=f):f=n[38],f}if(L==="legacy"){let f;return n[39]===Symbol.for("react.memo_cache_sentinel")?(f={kind:"legacy"},n[39]=f):f=n[39],f}if(L==="protocol-github"){const f=x.data;let G;return n[40]!==f?(G=ge("github",f,""),n[40]=f,n[41]=G):G=n[41],G}if(L==="site-not-owned-github"){let f;return n[42]===Symbol.for("react.memo_cache_sentinel")?(f={kind:"unavailable",source:"github",siteNotOwned:!0},n[42]=f):f=n[42],f}if(L==="protocol-sandbox"){let f;return n[43]!==I.data?(f=ge("sandbox",I.data,":sandbox"),n[43]=I.data,n[44]=f):f=n[44],f}if(L==="unavailable-github"){let f;return n[45]===Symbol.for("react.memo_cache_sentinel")?(f={kind:"unavailable",source:"github"},n[45]=f):f=n[45],f}const se=v.error??v.failureReason,ie=r?.endpoint??"";let Y;return n[46]!==Q||n[47]!==v.data||n[48]!==v.failureCount||n[49]!==v.isError||n[50]!==se||n[51]!==ie?(Y=wn({probed:v.data,isError:v.isError,failureCount:v.failureCount,failure:se,describe:Q,endpoint:ie}),n[46]=Q,n[47]=v.data,n[48]=v.failureCount,n[49]=v.isError,n[50]=se,n[51]=ie,n[52]=Y):Y=n[52],Y}function hn(e){return e.state.status==="error"||e.state.data?.v8Schema===!1?Oe:!1}function gn(e){return Yt(e+1)}function mn(e,t){return!(t instanceof T)&&!(t instanceof Ee)}function vn(e){return e.data!==void 0?e.data?"v8":"v7":e.workingTreeReady?e.isError?"error":"loading":"unavailable"}const bn=3;function wn(e){if(e.probed?.hasSchema&&!e.probed.v8Schema)return{kind:"unavailable",source:"local",problem:{reason:"not-v8"}};const t=e.probed?ge("local",{...e.probed,describe:e.describe??e.probed.describe},`:serve:${e.endpoint}`):null;return e.isError||e.failureCount>0?t?.kind==="protocol"&&!e.isError&&e.failureCount<bn?t:{kind:"unavailable",source:"local",problem:zt(e.failure)}:t??{kind:"pending"}}const He={retry:2,refetchInterval:e=>e.state.status==="error"?Oe:!1};function ge(e,t,n){return{kind:"protocol",source:e,client:t.client,describe:t.describe,cacheKeySuffix:n,hasSchema:t.hasSchema}}function ht(e){const t=P.c(13);let n;t[0]!==e?(n=ce.localPreviewUrl(e??""),t[0]=e,t[1]=n):n=t[1];const o=n,[r,s]=Rt(o,null),i=pe(e);let a;if(t[2]!==i||t[3]!==r||t[4]!==e){const h=e?Re(r):null;a=pn({saved:h,main:i}),t[2]=i,t[3]=r,t[4]=e,t[5]=a}else a=t[5];const c=a;let l,d;t[6]!==s?(l=h=>s(Re(h)),d=()=>s(null),t[6]=s,t[7]=l,t[8]=d):(l=t[7],d=t[8]);let u;return t[9]!==c||t[10]!==l||t[11]!==d?(u={...c,setUrl:l,clear:d},t[9]=c,t[10]=l,t[11]=d,t[12]=u):u=t[12],u}function pn(e){return e.saved?e.main==="v7"?{url:e.saved,undecided:!1}:e.main==="v8"?{url:null,undecided:!1}:{url:null,undecided:!0}:{url:null,undecided:!1}}function yn(e,t){const n=(e??"").trim().replace(/^[/\\]+|[/\\]+$/g,"");return n?`${n}/${t}`:t}function Ge(e){let t;try{t=JSON.parse(e)}catch{return null}return typeof t!="object"||t===null||Array.isArray(t)?null:t}class Ne extends Error{constructor(t,n,o=[]){super(n),this.blocks=t,this.fields=o,this.name="BlockConflictError"}blocks;fields}function _e(e){return`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`}function oe(e,t,n){return["decofile-write",e,t,n]}function Sn(e,t,n){return{id:oe(e,t,n).join(":")}}function De(e){return`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}`}async function En(e,t){const n=await e.json().catch(()=>({}));throw new Error(n.error??`${t} failed (${e.status})`)}function kn(e,t,n){e.setQueryData(m.decofileDraft(_e(t)),n)}function Cn(e,t){return e.getQueryData(m.decofileDraft(_e(t)))??null}async function In(e,t){const n=await fetch(De(e),{cache:"no-store",headers:{...ne("v7"),"if-none-match":`"${t}"`}}).catch(()=>null);return n?.status===200||n?.status===409}function Vo(e){const t=P.c(4);let n;t[0]!==e?(n=m.decofileDraft(e?_e(e):""),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:On,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:r}=F(o);return r??null}async function On(){throw new Error("decofileDraft is populated by reads/writes, not fetched")}async function Tn(e,t){const n=await fetch(De(t),{cache:"no-store",headers:ne("v7")});if(await Ce(n))throw Ie(e,t.orgSlug,t.virtualMcpId),new ke;if(!n.ok){const r=new Error(`Failed to fetch decofile: ${n.status}`);throw r.status=n.status,r}const o=await n.json();return o.token&&kn(e,t,{version:o.version,token:o.token,apiHost:o.apiHost??window.location.host}),o.decofile}async function Ho(e,t){const n=await fetch(De(e),{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(n.status===409){const r=await n.json().catch(()=>({}));throw r.code==="block-conflict"?new Ne(r.blocks??[],r.error??"Block changed"):new Error(r.error??`Save failed (${n.status})`)}if(!n.ok)return En(n,"Save");const o=await n.json();return{...o,apiHost:o.apiHost??window.location.host}}const gt=3e3,Nn=15e3,_n=2*6e4,mt={now:()=>Date.now(),setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),hidden:()=>typeof document<"u"&&document.visibilityState==="hidden"};function Dn(e){return e<_n?gt:Nn}function xn(e,t=mt){const n=t.now();let o=!1,r=!1,s=null;const i=()=>{o||(s=t.setTimeout(a,Dn(t.now()-n)))},a=()=>{if(s=null,o)return;const{read:c,skip:l}=e();if(r||t.hidden()||l?.()){i();return}r=!0;let d;try{d=c()}catch{d=void 0}Promise.resolve(d).catch(()=>{}).finally(()=>{r=!1}),i()};return i(),()=>{o=!0,s!==null&&t.clearTimeout(s)}}const Ke=()=>0;function Rn(e,t,n=mt){const o=U.useRef(t);o.current=t;const[r]=U.useState(()=>({polling:()=>xn(()=>o.current,n),idle:()=>()=>{}}));U.useSyncExternalStore(e?r.polling:r.idle,Ke,Ke)}function vt(e,t){return te(e,t)}function Pn(e,t){return te(e,"preview-fetch",{path:t})}function Go(e){return vt(e,"preview-invoke")}function Ko(e){return vt(e,"catalog-invoke")}function bt(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 $n(){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&&bt(n))return n}return null}function An(e,t){const n=e.previewUrl??e.getFallbackPreviewUrl?.()??$n();return n&&bt(n)?new URL(t,n).toString():Pn(e,t)}function Ln(e){return An(e,"/.decofile")}function Fn(e){return e===400?"absent":e===404?"unavailable":e>=200&&e<300?"ok":"error"}function qe(e){return e.liveOk||e.committedAbsent?404:e.liveStatus??502}async function Un(e,t){const n=te(e,"read"),o=await fetch(n,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:t,full:!0})}),r=Fn(o.status);if(r==="absent")return{kind:"absent"};if(r==="unavailable")return{kind:"unavailable"};if(r==="error"){const i=new Error(`Failed to read ${t}: ${o.status}`);throw i.status=o.status,i}const s=await o.json();return typeof s.content!="string"?{kind:"unavailable"}:{kind:"data",data:Ft(s.content)}}async function Mn(e,t){const n=await Un(e,t);if(n.kind!=="data")return n;try{return{kind:"data",data:JSON.parse(n.data)}}catch{return{kind:"unavailable"}}}async function qo(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 jn(e){return Ut(e)?.metadata?.runtime?.path??null}class wt extends Error{constructor(t){super(t instanceof Error?t.message:String(t),{cause:t}),this.name="ServeLostError"}}function Jo(e){return e instanceof T&&e.code===p.Conflict}function pt(e){const t=e.data?.violations;return!Array.isArray(t)||t.length===0?e.message:t.slice(0,3).map(n=>n.message).join("; ")}function Bn(e,t,n){if(t instanceof Ne)return t.message;if(n==="local")return Vn(e,t);if(t instanceof T)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 Qn(e,t){if(t==="local"||e instanceof Ne)return null;if(e instanceof T){const n=e.code===p.InvalidBlock||e.code===p.InvalidParams?pt(e):e.message;return n?`${e.code}: ${n}`:null}return e.message||null}function Vn(e,t){if(t instanceof wt)return e("decoServe.save.serverGone");if(t instanceof T)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:pt(t)});case p.LimitExceeded:return e("decoServe.save.tooLarge")}return e("sectionsEditor.sectionsEditor.saveFailed",{error:t.message})}function Hn(e,t,n){return e===null?0:Math.max(0,n-Math.max(0,t-e))}function Gn(e,t){const[n,o]=U.useState(e),r=U.useRef(null);return e&&!n&&o(!0),U.useEffect(()=>{if(e){r.current??=Date.now();return}if(!n)return;const s=()=>{r.current=null,o(!1)},i=Hn(r.current,Date.now(),t);if(i===0){s();return}const a=setTimeout(s,i);return()=>clearTimeout(a)},[e,n,t]),n}const yt={phase:"idle",inFlight:0,reload:{seq:0,navigates:!1},epoch:0},Kn=15e3,Z=new Map;function H(e,t){return`${e}/${t}`}function j(e){let t=Z.get(e);return t||(t={state:yt,listeners:new Set,previews:0,timer:null,discardListeners:new Set},Z.set(e,t)),t}function B(e,t){const n=j(e);n.state={...n.state,...t};for(const o of n.listeners)o()}function re(e){e.timer&&clearTimeout(e.timer),e.timer=null}function xe(e){return Z.get(e)?.state??yt}function qn(e,t){const n=j(e);return n.listeners.add(t),()=>{n.listeners.delete(t)}}function Yo(e){const t=j(e);return t.previews++,()=>{t.previews--,t.previews===0&&t.state.phase==="reloading"&&(re(t),B(e,{phase:"idle"}))}}function Wo(e){const t=Z.get(e);!t||t.state.phase!=="reloading"||(re(t),B(e,{phase:"idle"}))}function St(e){const t=j(e);re(t),B(e,{phase:"saving",inFlight:t.state.inFlight+1})}function me(e,t){const n=j(e),o=Math.max(0,n.state.inFlight-1);if(o>0){B(e,{inFlight:o});return}if(!t.ok||n.previews===0){B(e,{phase:"idle",inFlight:o});return}Et(e,t.navigates,o)}function Et(e,t,n=0){const o=j(e);re(o),o.timer=setTimeout(()=>{o.timer=null,o.state.phase==="reloading"&&B(e,{phase:"idle"})},Kn),B(e,{phase:"reloading",inFlight:n,reload:{seq:o.state.reload.seq+1,navigates:t}})}function Jn(e){return e?.kind==="protocol"&&e.source==="github"}async function ve(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:r,branch:s,backend:i,cacheKey:a}=e,c=t.kind==="publish"||t.kind==="reapply"?n.invalidateQueries({queryKey:m.hostedReleases(o,r)}):null;if(i?.kind!=="protocol")return await c,{navigates:!1};const l=s?m.protocolDraftRead(o,r,s):null,d=l?JSON.stringify(n.getQueryData(l)??null):null,u=c?[c]:[];if(a&&t.reread&&u.push(n.invalidateQueries({queryKey:m.decofile(a)})),a&&u.push(n.invalidateQueries({queryKey:m.contentChanges(a)})),s&&i.source==="sandbox"&&u.push(n.invalidateQueries({queryKey:Qt(o,r,s)})),Jn(i)&&l&&u.push(n.invalidateQueries({queryKey:l})),await Promise.all(u),t.kind!=="edit"){const g=H(o,r);B(g,{epoch:xe(g).epoch+1})}const h=l?JSON.stringify(n.getQueryData(l)??null):null,b=d!==h;return b&&await new Promise(g=>Pt.schedule(g)),{navigates:b}}async function Yn(e,t){return St(H(e.orgSlug,e.virtualMcpId)),kt(e,t)}async function kt(e,t){const n=H(e.orgSlug,e.virtualMcpId);let o;try{o=await t.write()}catch(s){throw me(n,{ok:!1,navigates:!1}),t.refreshOnError&&ve(e,{kind:t.kind,reread:!0}).catch(()=>{}),s}let r=!1;try{({navigates:r}=await ve(e,t))}catch{}finally{me(n,{ok:!0,navigates:r})}return o}function zo(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:r,branch:s}=e,i=H(o,r),a=new Set(t.blockKeys);for(const d of[...j(i).discardListeners])d(a);St(i);let c=!1;const l=()=>(c=!0,kt(e,{kind:"discard",reread:!0,write:t.write}));return s?n.getMutationCache().build(n,{mutationKey:oe(o,r,s),scope:Sn(o,r,s),mutationFn:l}).execute(void 0).catch(d=>{throw c||me(i,{ok:!1,navigates:!1}),d}):l()}function Xo(e,t,n){const o=P.c(8);let r;o[0]!==e||o[1]!==t?(r=H(e,t),o[0]=e,o[1]=t,o[2]=r):r=o[2];const s=r;let i;o[3]!==n||o[4]!==s?(i=()=>{const c=j(s).discardListeners;return c.add(n),()=>{c.delete(n)}},o[3]=n,o[4]=s,o[5]=i):i=o[5];let a;o[6]!==s?(a=[s],o[6]=s,o[7]=a):a=o[7],U.useEffect(i,a)}function Wn(e){const t=H(e.orgSlug,e.virtualMcpId);xe(t).inFlight>0||ve(e,{kind:"external"}).then(({navigates:n})=>{const o=j(t);o.previews>0&&o.state.inFlight===0&&Et(t,n)}).catch(()=>{})}function zn(e,t){const n=P.c(7);let o;n[0]!==e||n[1]!==t?(o=H(e,t),n[0]=e,n[1]=t,n[2]=o):o=n[2];const r=o;let s;n[3]!==r?(s=l=>qn(r,l),n[3]=r,n[4]=s):s=n[4];const i=s;let a;n[5]!==r?(a=()=>xe(r),n[5]=r,n[6]=a):a=n[6];const c=a;return U.useSyncExternalStore(i,c,c)}const Xn=500;function Zo(e,t){const{phase:n}=zn(e,t);return Gn(n!=="idle",Xn)}function Zn(e){const t=new Error(`${e} unavailable (content server unreachable)`);return t.status=502,t}function eo(e,t){return m.liveMeta(e.orgSlug,e.virtualMcpId,e.branch,`protocol${t.cacheKeySuffix}`,"")}function er(e,t,n){const o=e.getQueryData(m.contentVersions(t));if(!o)return;if(Object.hasOwn(o,n))return o[n];const r=e.getQueryData(m.decofile(t));return r&&Object.hasOwn(r,n)?void 0:null}function Ct(e,t,n){e.setQueryData(m.contentVersions(t),o=>{const r={...o};for(const[s,i]of Object.entries(n))i===null?delete r[s]:r[s]=i;return r})}function to(e,t){const n=e.getMutationCache().findAll({mutationKey:oe(t.orgSlug,t.virtualMcpId,t.branch),status:"pending"});return new Set(n.flatMap(o=>on(o.state.variables)))}function be(e,t){e.resetQueries({queryKey:m.contentBackend(t.orgSlug,t.virtualMcpId,"local")})}async function ee(e,t,n,o){try{return await o()}catch(r){const s=!(r instanceof T);throw t.source==="local"&&s?(be(e,n),new wt(r)):(t.source==="local"&&Se(r)&&be(e,n),r)}}const ae=new Map;function no(e,t,n,o){const r=ae.get(o);if(r)return r;const s=It(e,t,n,o,!0);return ae.set(o,s),s.finally(()=>ae.delete(o))}async function It(e,t,n,o,r){const s=m.decofile(o),i=eo(n,t),a=m.contentRevision(o),c=e.getQueryData(s),l=e.getQueryData(i),d=e.getQueryData(a)??void 0,u=t.source==="github"&&!l?ct(e,n.orgSlug,n.virtualMcpId):void 0,h=u?.isV8&&u.schema&&u.version?u:void 0,b=l??h?.schema,g=h?{...d,schemaVersion:h.version}:d,k=r&&c?g?.revision:void 0,C=r&&b?g?.schemaVersion:void 0,x=m.contentChanges(o),N=e.getQueryData(x),[_,I,O]=await ee(e,t,n,()=>t.client.batch([{method:"blocks.list",params:k?{ifNoneMatch:k}:{}},{method:"schema.get",params:C?{ifNoneMatch:C}:{}},{method:"changes.list",params:N?{ifNoneMatch:N.revision}:{}}]));if(O?.ok){const R=he(N,O.result);R&&e.setQueryData(x,R)}else O&&t.source==="local"&&Se(O.error)&&be(e,n);if(!_?.ok)throw _?.error??new Error("no blocks.list");if(!I)throw new Error("no schema.get");const w=_.result,y=ut(I),S=I.ok&&!y?I.result:null;if(w.notModified&&!c||S?.notModified&&!b)return It(e,t,n,o,!1);const v=w.notModified?new Set:to(e,n),$=w.notModified?c:nn(w.blocks,c,v),A=y?rn():S?S.notModified?b:S.schema:I.error,E=e.getQueryData(a)?.revision,D=E!==void 0&&E!==g?.revision;if(e.setQueryData(a,{revision:D?E:w.notModified?g?.revision:w.revision,schemaVersion:S?S.notModified?g?.schemaVersion:S.version??void 0:void 0}),e.setQueryData(s,$),!w.notModified){const R=m.contentVersions(o),M=e.getQueryData(R),J={...w.versions};for(const Q of v){const L=M?.[Q];L!==void 0?J[Q]=L:delete J[Q]}e.setQueryData(R,J)}return A instanceof T||e.setQueryData(i,A),!D&&!w.notModified&&c&&g?.revision&&w.revision!==g.revision&&Wn({queryClient:e,orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,backend:t,cacheKey:o}),{blocks:$,meta:A}}async function tr(e,t,n,o,r,s){return Yn({queryClient:e,orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,backend:t,cacheKey:o},{kind:"edit",write:async()=>{const i=await ee(e,t,n,()=>t.client.blocksApply({set:r.set,delete:r.delete,...s?{ifMatch:s}:{}}));e.setQueryData(m.contentRevision(o),c=>({...c,revision:i.revision}));const a=i.versions??{};return Ct(e,o,a),{revision:i.revision,versions:a}}})}async function nr(e,t,n,o,r){await e.invalidateQueries({queryKey:m.decofile(o)});let s;try{const a=(await ee(e,t,n,()=>t.client.changesGet({names:[r]}))).entries[r];if(a&&a.after===null&&a.version!==null)return;s={value:a?.after??null,version:a?.version??null}}catch{const i=await ee(e,t,n,()=>t.client.blocksList({}));if(i.notModified)return;s={value:i.blocks[r]??null,version:i.versions[r]??null}}e.setQueryData(m.decofile(o),i=>{const a={...i};return s.value===null?delete a[r]:a[r]=s.value,a}),Ct(e,o,{[r]:s.version})}function or(e){const t=P.c(11),n=q();let o;t[0]!==e?.branch||t[1]!==e?.orgSlug||t[2]!==e?.virtualMcpId?(o=m.protocolDraftRead(e?.orgSlug??"",e?.virtualMcpId??"",e?.branch??""),t[0]=e?.branch,t[1]=e?.orgSlug,t[2]=e?.virtualMcpId,t[3]=o):o=t[3];let r;t[4]!==e||t[5]!==n?(r=async()=>{const c=await fetch(`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}`,{cache:"no-store",headers:ne("v8")});if(await Ce(c))throw Ie(n,e.orgSlug,e.virtualMcpId),new ke;if(!c.ok)throw new Error(`draft pointer read failed: ${c.status}`);return await c.json()},t[4]=e,t[5]=n,t[6]=r):r=t[6];const s=!!e;let i;t[7]!==o||t[8]!==r||t[9]!==s?(i={queryKey:o,queryFn:r,enabled:s,staleTime:Number.POSITIVE_INFINITY},t[7]=o,t[8]=r,t[9]=s,t[10]=i):i=t[10];const{data:a}=F(i);return!e||!a?.draft||!a.version?null:`${a.draft}@${a.version}`}function rr(e){const t=P.c(4);let n;t[0]!==e?(n=m.contentRevision(e),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:oo,staleTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:r}=F(o);return r?.revision}async function oo(){throw new Error("content revisions are set by reads and writes")}function Je(e){const t=`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`;return e.protocolSuffix?`${t}${e.protocolSuffix}`:e.localPreviewUrl?`${t}:local:${e.localPreviewUrl}`:t}function ro(e,t){const n=P.c(6),{url:o}=ht(e?.virtualMcpId),r=ft(e?.virtualMcpId,e?.branch);if(!e)return"";let s;return n[0]!==r.cacheKeySuffix||n[1]!==r.kind||n[2]!==o||n[3]!==t?.tunnel||n[4]!==e?(s=r.kind==="protocol"?Je({...e,protocolSuffix:r.cacheKeySuffix}):Je({...e,localPreviewUrl:t?.tunnel===!1?null:o}),n[0]=r.cacheKeySuffix,n[1]=r.kind,n[2]=o,n[3]=t?.tunnel,n[4]=e,n[5]=s):s=n[5],s}function sr(e,t){const n=P.c(39),{url:o,undecided:r}=ht(e?.virtualMcpId),s=!!o,i=ft(e?.virtualMcpId,e?.branch),a=i.kind==="protocol"?i:null,c=ro(e),l=t?.fetchEnabled??!0,d=jn(e?.virtualMcpId),u=We(e?.virtualMcpId).runtime==="cms",h=q();let b;n[0]!==c?(b=m.decofile(c),n[0]=c,n[1]=b):b=n[1];const g=b;let k;n[2]!==e||n[3]!==h||n[4]!==g?(k=()=>{if(!e||h.isMutating({mutationKey:oe(e.orgSlug,e.virtualMcpId,e.branch)})>0)return!0;const v=h.getQueryState(g);return v?.fetchStatus==="fetching"||Date.now()-(v?.dataUpdatedAt??0)<gt/2},n[2]=e,n[3]=h,n[4]=g,n[5]=k):k=n[5];let C;n[6]!==u||n[7]!==s||n[8]!==e||n[9]!==a||n[10]!==h||n[11]!==g?(C=async()=>{if(e){if(!a&&u&&!s){const v=Cn(h,e)?.version;if(v&&!await In(e,v))return}await h.refetchQueries({queryKey:g,exact:!0},{cancelRefetch:!1})}},n[6]=u,n[7]=s,n[8]=e,n[9]=a,n[10]=h,n[11]=g,n[12]=C):C=n[12];let x;n[13]!==k||n[14]!==C?(x={skip:k,read:C},n[13]=k,n[14]=C,n[15]=x):x=n[15],Rn(!!t?.pollWhile&&!!e,x);let N;n[16]!==i.kind||n[17]!==u||n[18]!==l||n[19]!==c||n[20]!==s||n[21]!==o||n[22]!==d||n[23]!==e||n[24]!==a||n[25]!==h?(N=async()=>{if(a)return(await no(h,a,e,c)).blocks;if(i.kind==="unavailable")throw Zn("decofile");if(s){const E=await fetch(new URL("/.decofile",o).toString(),{cache:"no-store"}).catch(ao),D=E?.ok?Ge(await E.text()):null;if(D)return D;const R=new Error("decofile unavailable (local tunnel unreachable)");throw R.status=502,R}if(u)return Tn(h,e);const v=()=>Mn(e,yn(d,".deco/blocks.gen.json"));if(l){const E=await fetch(Ln(e),{cache:"no-store"}).catch(io);if(E?.ok){const M=Ge(await E.text());if(M)return M}const D=await v();if(D.kind==="data")return D.data;const R=new Error(`Failed to fetch decofile: ${E?.status??"network error"}`);throw R.status=qe({liveOk:!!E?.ok,liveStatus:E?.status,committedAbsent:D.kind==="absent"}),R}const $=await v();if($.kind==="data")return $.data;const A=new Error("decofile unavailable (preview down, no committed snapshot)");throw A.status=qe({liveOk:!1,committedAbsent:$.kind==="absent"}),A},n[16]=i.kind,n[17]=u,n[18]=l,n[19]=c,n[20]=s,n[21]=o,n[22]=d,n[23]=e,n[24]=a,n[25]=h,n[26]=N):N=n[26];const _=!!e&&i.kind!=="pending"&&!r,I=a?0:3e4,O=a?.describe.pollIntervalMs,w=a?"always":void 0;let y;n[27]!==u||n[28]!==s||n[29]!==a?(y=(v,$)=>{if(a||u||s)return v<3;const A=$.status;return A!==502&&A!==404&&v<2},n[27]=u,n[28]=s,n[29]=a,n[30]=y):y=n[30];let S;return n[31]!==g||n[32]!==N||n[33]!==_||n[34]!==I||n[35]!==O||n[36]!==w||n[37]!==y?(S={queryKey:g,queryFn:N,enabled:_,staleTime:I,refetchInterval:O,refetchIntervalInBackground:!1,refetchOnWindowFocus:w,retry:y,retryDelay:so},n[31]=g,n[32]=N,n[33]=_,n[34]=I,n[35]=O,n[36]=w,n[37]=y,n[38]=S):S=n[38],F(S)}function so(e){return Vt(5e3,1e3,e,2,0)}function io(){return null}function ao(){return null}const co="site-editor-save",we="site-editor-publish";function lo(e){const t=P.c(7),{label:n,detail:o}=e;let r;t[0]!==n?(r=V.jsx("summary",{className:"cursor-pointer select-none text-muted-foreground",children:n}),t[0]=n,t[1]=r):r=t[1];let s;t[2]!==o?(s=V.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words font-mono text-muted-foreground",children:o}),t[2]=o,t[3]=s):s=t[3];let i;return t[4]!==r||t[5]!==s?(i=V.jsxs("details",{className:"mt-1 text-xs",children:[r,s]}),t[4]=r,t[5]=s,t[6]=i):i=t[6],i}function Ot(e,t){return t?V.jsx(lo,{label:e("siteEditor.details"),detail:t}):void 0}function ir(e,t,n){z.error(Bn(e,t,n),{id:co,description:Ot(e,Qn(t,n))})}const Tt={action:void 0,duration:void 0};function ar(e,t){z.success(t?e("siteEditor.publish.publishedOn",{host:t}):e("siteEditor.publish.published"),{...Tt,id:we,description:void 0})}function cr(e,{headline:t,body:n,detail:o,retry:r,pending:s,tone:i="error"}){const a=Ot(e,o??null);z[i](t,{id:we,description:n&&a?V.jsxs(V.Fragment,{children:[V.jsx("p",{children:n}),a]}):n??a,action:r?{label:e("siteEditor.tryAgain"),onClick:c=>{c.preventDefault(),z.loading(s??e("thread.publishPopover.publishing"),{...Tt,id:we,description:void 0}),r()}}:void 0,duration:r?Number.POSITIVE_INFINITY:void 0})}function lr(e){return e instanceof Error?e.message||null:e==null?null:String(e)}export{Ho as $,Yt as A,zt as B,nt as C,Wt as D,lo as E,Te as F,ye as G,Go as H,Pn as I,sr as J,Ao as K,jo as L,jn as M,yn as N,at as O,Uo as P,Fo as Q,H as R,Ro as S,it as T,Yo as U,Wo as V,rr as W,Sn as X,oe as Y,Un as Z,En as _,$o as a,kn as a0,tr as a1,eo as a2,no as a3,Zn as a4,qo as a5,Mn as a6,Ne as a7,Jo as a8,nr as a9,ir as aa,Xo as ab,Lo as ac,Bo as ad,je as ae,Be as af,Qo as ag,Po as ah,An as ai,Mo as aj,Vo as ak,or as al,ne as am,we as an,Tt as ao,cr as ap,Ko as aq,er as ar,Xt as b,ht as c,Ot as d,xo as e,lr as f,ko as g,Eo as h,Gt as i,Yn as j,Ie as k,zo as l,Co as m,Io as n,Se as o,No as p,To as q,Do as r,_o as s,ar as t,ft as u,qt as v,ro as w,zn as x,Oo as y,Zo as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as te,a2 as se,o as ae,r as T,aa as ce,j as t,B as U,n as $,b1 as de,a3 as me,t as C,az as ue,c as ie,l as pe,X as ge,T as fe,V as he,U as xe,K as Q,eW as je}from"./index-Cmhl3zNb.js";import{i as ke}from"./DotsVertical-H16dBinG.js";import{i as le,a as ve}from"./ZoomOut-CYcrWaFo.js";import{s as ye}from"./Trash01-CqbCnp4Y.js";import{i as Se}from"./Upload01-BuL02EP8.js";import{S as be}from"./search-input-DBKGcZuw.js";import{S as we}from"./search-toggle-CLG4gmKJ.js";import{f as Ne,e as Ce,b as De,A as Pe,a as Ae,d as Ee,c as Te,g as Me}from"./alert-dialog-CgRaXWeG.js";import{E as Y}from"./empty-state-BZa0U-xG.js";import{C as Oe}from"./collection-tabs-C331r2n4.js";import{p as Ie,S as ze,F as Fe}from"./folder-icon-DqT7qo5j.js";import{p as Re,j as $e,r as _e}from"./use-org-fs-BzlMLYdA.js";import{S as Le,H as J,d as Be}from"./location-BjlyegC2.js";import"./SearchMd-KKuAy3kv.js";import"./icon-button-iwZ3O0_B.js";import"./tooltip-kZk2wAMk.js";import"./index-D69M9S-D.js";import"./badge-CRNAVwfV.js";import"./markdown-DntfPEgK.js";import"./use-copy-DzgBkNLT.js";import"./Copy01-CsyaL0tc.js";import"./use-mobile-CY0Djv_M.js";import"./use-panel-navigate-Cs4na-V_.js";import"./thread-route-C2rii--a.js";import"./use-project-scope-COiEpk7r.js";import"./repository-binding-X3TRktCN.js";import"./use-mcp-client-CedU4dWV.js";import"./auth-Bjnc521y.js";import"./file-preview-pejw4DEs.js";import"./utils-D_iIHZov.js";import"./Image01-C-r__mWH.js";import"./editor-B2CFLfaQ.js";import"./file-type-icon-2Asg9IKB.js";import"./useInfiniteQuery-BLA_teXl.js";import"./infiniteQueryObserver-978TY1hh.js";const Z=200,Ke=new Set(["node_modules","__pycache__"]);function q(s){const[,...e]=s.webkitRelativePath.split("/");return e.length>0?e.join("/"):s.name}function He(s){return q(s).split("/").every(e=>!e.startsWith(".")&&!Ke.has(e))}function Qe(s){return s.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"skill"}function Ue(s,e){const l=new Map;for(const r of s){const c=q(r).split("/");c.pop();const a=["skills",e,...c].join("/");l.set(a,[...l.get(a)??[],r])}return l}async function qe(s,e){const r=(await Promise.allSettled([...s].map(([c,a])=>e({dir:c,files:a})))).find(c=>c.status==="rejected");if(r)throw r.reason}function Ge(s,e){const l=Ie(e),r=`skills/${s}`;return{id:`home/${r}`,name:l.name??s,description:l.description,disableModelInvocation:l.disableModelInvocation,source:"home",volume:J,path:r,sandboxPath:`${Le}/${J}/${r}`}}const L="*";function B(s){return s.volume==="home"}function re(s,e){const l=s.indexOf(":");return l===-1?{label:e,glyph:le}:{label:s.slice(l+1),glyph:s.startsWith("repo:")?ue:ve}}function We(s){const e=ie.c(48),{entry:l,pending:r,onOpen:c,onDelete:a}=s,o=te(),{org:m}=se();let S;e[0]!==l.source||e[1]!==m.name?(S=re(l.source,m.name),e[0]=l.source,e[1]=m.name,e[2]=S):S=e[2];const{label:M,glyph:O}=S;let I;e[3]!==l?(I=B(l),e[3]=l,e[4]=I):I=e[4];const F=I,z=r?"opacity-60":"hover:bg-muted/50";let u;e[5]!==z?(u=pe("relative transition-colors group overflow-hidden flex flex-col h-full",z),e[5]=z,e[6]=u):u=e[6];let f;e[7]!==l.name||e[8]!==c||e[9]!==r?(f=!r&&t.jsx("button",{type:"button",onClick:c,className:"absolute inset-0 z-0","aria-label":l.name}),e[7]=l.name,e[8]=c,e[9]=r,e[10]=f):f=e[10];const b=F?"default":"system",D=!F;let w;e[11]!==O||e[12]!==b||e[13]!==D?(w=t.jsx(Fe,{glyph:O,tone:b,readOnly:D,className:"size-8 shrink-0"}),e[11]=O,e[12]=b,e[13]=D,e[14]=w):w=e[14];let h;e[15]!==a||e[16]!==o?(h=a&&t.jsx("div",{className:"relative z-10 pointer-events-auto transition-opacity sm:opacity-0 sm:group-hover:opacity-100",children:t.jsxs(ge,{children:[t.jsx(fe,{asChild:!0,children:t.jsx(U,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:t.jsx(ke,{size:16})})}),t.jsx(he,{align:"end",children:t.jsxs(xe,{variant:"destructive",onClick:K=>{K.stopPropagation(),a()},children:[t.jsx(ye,{size:16}),o("settings.skills.deleteButton")]})})]})}),e[15]=a,e[16]=o,e[17]=h):h=e[17];let x;e[18]!==w||e[19]!==h?(x=t.jsxs("div",{className:"flex items-start justify-between",children:[w,h]}),e[18]=w,e[19]=h,e[20]=x):x=e[20];let j;e[21]!==l.name?(j=t.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:l.name}),e[21]=l.name,e[22]=j):j=e[22];let N;e[23]!==l.description||e[24]!==o?(N=l.description||o("settings.skills.noDescription"),e[23]=l.description,e[24]=o,e[25]=N):N=e[25];let k;e[26]!==N?(k=t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:N}),e[26]=N,e[27]=k):k=e[27];let d;e[28]!==j||e[29]!==k?(d=t.jsxs("div",{className:"flex flex-col gap-1",children:[j,k]}),e[28]=j,e[29]=k,e[30]=d):d=e[30];let v;e[31]!==x||e[32]!==d?(v=t.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[x,d]}),e[31]=x,e[32]=d,e[33]=v):v=e[33];let p;e[34]!==M||e[35]!==r||e[36]!==o?(p=r?o("settings.skills.importing"):M,e[34]=M,e[35]=r,e[36]=o,e[37]=p):p=e[37];let y;e[38]!==p?(y=t.jsx("div",{className:"border-t border-border mt-auto",children:t.jsx("div",{className:"h-10 flex items-center px-4.5",children:t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:p})})}),e[38]=p,e[39]=y):y=e[39];let g;e[40]!==v||e[41]!==y?(g=t.jsxs("div",{className:"flex flex-col flex-1 pointer-events-none",children:[v,y]}),e[40]=v,e[41]=y,e[42]=g):g=e[42];let P;return e[43]!==r||e[44]!==g||e[45]!==u||e[46]!==f?(P=t.jsxs(je,{"aria-busy":r,className:u,children:[f,g]}),e[43]=r,e[44]=g,e[45]=u,e[46]=f,e[47]=P):P=e[47],P}function ee(s){const e=ie.c(2),{children:l}=s;let r;return e[0]!==l?(r=t.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:l}),e[0]=l,e[1]=r):r=e[1],r}function Et(){const s=te(),{org:e}=se(),l=Re(),{remove:r,upload:c}=$e("home"),a=ae(),o=T.useRef(null),[m,S]=T.useState(""),M=ce(),[O,I]=T.useState(L),[F,z]=T.useState(!1),[u,f]=T.useState(null),[b,D]=T.useState(null),[w,h]=T.useState(null),x=()=>{a.invalidateQueries({queryKey:Q.slashSkills(e.id)}),a.invalidateQueries({queryKey:Q.orgFsSkills(e.id)})},j=i=>a.setQueryData(Q.slashSkills(e.id),n=>i(n??[]));async function N(i){const n=[...i??[]];if(o.current&&(o.current.value=""),n.length===0)return;const A=n[0]?.webkitRelativePath??"";if(!A){C.error(s("settings.skills.importNeedsFolder"));return}const H=A.split("/")[0]??"",_=n.filter(He),W=_.find(E=>q(E)==="SKILL.md");if(!W){C.error(s("settings.skills.importMissingSkillMd"));return}if(_.length>Z){C.error(s("settings.skills.importTooManyFiles",{count:String(_.length),max:String(Z)}));return}const R=Qe(H),X=`skills/${R}`;let V=!1;z(!0);try{if(await _e(e.slug,"home",X)){C.error(s("settings.skills.importSlugTaken",{slug:R}));return}V=!0;const E=Ge(R,await W.text());j(oe=>[E,...oe]),h(E.id),await qe(Ue(_,R),c.mutateAsync),C.success(s("settings.skills.importSuccess",{name:R}))}catch(E){V&&await r.mutateAsync(X).catch(()=>{}),C.error(E instanceof Error?E.message:s("settings.skills.importError"))}finally{h(null),x(),z(!1)}}const k=m.toLowerCase(),d=(l.data??[]).filter(i=>i.name.toLowerCase().includes(k)||(i.description??"").toLowerCase().includes(k)).sort((i,n)=>Number(B(n))-Number(B(i))||i.name.localeCompare(n.name)),v=new Set((l.data??[]).map(i=>i.source)),p=new Map;for(const i of d)p.set(i.source,(p.get(i.source)??0)+1);const y=[{id:L,label:s("settings.skills.filterAll"),count:d.length},...[...v].map(i=>({id:i,label:re(i,e.name).label,count:p.get(i)??0}))],g=v.has(O)?O:L,P=g===L?d:d.filter(i=>i.source===g),K=i=>f(Be(i.volume,i.path)),ne=async()=>{if(!b)return;const{id:i,path:n}=b;D(null),j(A=>A.filter(H=>H.id!==i));try{await r.mutateAsync(n),C.success(s("settings.skills.deleteSuccess"))}catch(A){C.error(A instanceof Error?A.message:s("settings.skills.deleteError"))}finally{x()}},G=t.jsxs(U,{size:"sm",disabled:F,onClick:()=>o.current?.click(),children:[t.jsx(Se,{size:14}),s(F?"settings.skills.importing":"settings.skills.importButton")]});return t.jsxs($,{children:[t.jsx($.Content,{children:t.jsx($.Container,{children:t.jsxs("div",{className:"flex flex-col gap-6",children:[M?t.jsx($.Actions,{secondary:t.jsx(we,{value:m,onChange:S,label:s("library.context.search"),placeholder:s("settings.skills.searchPlaceholder"),clearLabel:s("library.library.clearSearch")}),children:G}):t.jsx($.Title,{actions:G,children:s("settings.skills.pageTitle")}),t.jsx("div",{className:"flex flex-wrap items-center justify-between gap-3 empty:hidden",children:!M&&t.jsx(be,{value:m,onChange:S,placeholder:s("settings.skills.searchPlaceholder"),className:"w-full md:w-[375px]",onKeyDown:i=>{i.key==="Escape"&&(S(""),i.target.blur())}})}),t.jsx("input",{ref:o,type:"file",multiple:!0,webkitdirectory:"",className:"hidden",onChange:i=>{N(i.target.files)}}),y.length>2&&t.jsx(Oe,{placement:"page",tabs:y,activeTab:g,onTabChange:I}),l.isPending?t.jsx("div",{className:"@container",children:t.jsx(ee,{children:Array.from({length:8},(i,n)=>t.jsx(de,{className:"h-[168px] rounded-xl"},n))})}):l.isError?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx(Y,{image:t.jsx(me,{size:48,className:"text-muted-foreground"}),title:s("settings.skills.errorTitle"),description:l.error instanceof Error?l.error.message:s("settings.skills.errorDescription"),actions:t.jsx(U,{size:"sm",variant:"outline",onClick:()=>{l.refetch()},children:s("settings.skills.retry")})})}):P.length===0?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx(Y,{image:t.jsx(le,{size:48,className:"text-muted-foreground"}),title:s(m?"settings.skills.noResultsTitle":"settings.skills.emptyTitle"),description:m?s("settings.skills.noResultsDescription",{search:m}):s("settings.skills.emptyDescription"),actions:!1})}):t.jsx("div",{className:"@container",children:t.jsx(ee,{children:P.map(i=>{const n=i.id===w;return t.jsx(We,{entry:i,pending:n,onOpen:()=>K(i),onDelete:B(i)&&!n?()=>D(i):void 0},i.id)})})})]})})}),u&&t.jsx(ze,{skillPath:u,onClose:()=>f(null)},u),t.jsx(Ne,{open:b!==null,onOpenChange:i=>!i&&D(null),children:t.jsxs(Ce,{children:[t.jsxs(De,{children:[t.jsx(Pe,{children:s("settings.skills.deleteDialogTitle")}),t.jsx(Ae,{children:s("settings.skills.deleteDialogDescription",{name:b?.name??""})})]}),t.jsxs(Ee,{children:[t.jsx(Te,{children:s("settings.skills.cancel")}),t.jsx(Me,{onClick:ne,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:s("settings.skills.deleteButton")})]})]})})]})}export{Et as default};
|
|
1
|
+
import{b as te,a2 as se,o as ae,r as T,aa as ce,j as t,B as U,n as $,b1 as de,a3 as me,t as C,az as ue,c as ie,l as pe,X as ge,T as fe,V as he,U as xe,K as Q,eW as je}from"./index-8f_vFFVa.js";import{i as ke}from"./DotsVertical-Cb3iOarq.js";import{i as le,a as ve}from"./ZoomOut-Clz13c-y.js";import{s as ye}from"./Trash01-DeYkLyg0.js";import{i as Se}from"./Upload01-zDvi7WnN.js";import{S as be}from"./search-input-CUDMkzW3.js";import{S as we}from"./search-toggle-DQNLDkeN.js";import{f as Ne,e as Ce,b as De,A as Pe,a as Ae,d as Ee,c as Te,g as Me}from"./alert-dialog-C884MJiU.js";import{E as Y}from"./empty-state-D0xYsV2u.js";import{C as Oe}from"./collection-tabs-yyL7thvn.js";import{p as Ie,S as ze,F as Fe}from"./folder-icon-CqdHG3Ev.js";import{p as Re,j as $e,r as _e}from"./use-org-fs-BdAqd8Rv.js";import{S as Le,H as J,d as Be}from"./location-BjlyegC2.js";import"./SearchMd-pSkC4ygW.js";import"./icon-button-C9jD2Hx3.js";import"./tooltip-UP0IE2Tr.js";import"./index-CEuerbGa.js";import"./badge-Bmk8ti5E.js";import"./markdown-gIWrkm71.js";import"./use-copy-BcbcC4Wz.js";import"./Copy01-CgH6S_M4.js";import"./use-mobile-7XbQJiX0.js";import"./use-panel-navigate-CLNhl3ki.js";import"./thread-route-qt3bqNNd.js";import"./use-project-scope-IOK1T5p5.js";import"./repository-binding-DbCSIQ25.js";import"./use-mcp-client-GXi3d-TN.js";import"./auth-BWk8-zOv.js";import"./file-preview-BPilYeri.js";import"./utils-2rl9BEeu.js";import"./Image01-DRhv7dXw.js";import"./editor-DlDOOY_4.js";import"./file-type-icon-CqiTsqkN.js";import"./useInfiniteQuery-Z2Fpq8_2.js";import"./infiniteQueryObserver-DUxIIdhP.js";const Z=200,Ke=new Set(["node_modules","__pycache__"]);function q(s){const[,...e]=s.webkitRelativePath.split("/");return e.length>0?e.join("/"):s.name}function He(s){return q(s).split("/").every(e=>!e.startsWith(".")&&!Ke.has(e))}function Qe(s){return s.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"skill"}function Ue(s,e){const l=new Map;for(const r of s){const c=q(r).split("/");c.pop();const a=["skills",e,...c].join("/");l.set(a,[...l.get(a)??[],r])}return l}async function qe(s,e){const r=(await Promise.allSettled([...s].map(([c,a])=>e({dir:c,files:a})))).find(c=>c.status==="rejected");if(r)throw r.reason}function Ge(s,e){const l=Ie(e),r=`skills/${s}`;return{id:`home/${r}`,name:l.name??s,description:l.description,disableModelInvocation:l.disableModelInvocation,source:"home",volume:J,path:r,sandboxPath:`${Le}/${J}/${r}`}}const L="*";function B(s){return s.volume==="home"}function re(s,e){const l=s.indexOf(":");return l===-1?{label:e,glyph:le}:{label:s.slice(l+1),glyph:s.startsWith("repo:")?ue:ve}}function We(s){const e=ie.c(48),{entry:l,pending:r,onOpen:c,onDelete:a}=s,o=te(),{org:m}=se();let S;e[0]!==l.source||e[1]!==m.name?(S=re(l.source,m.name),e[0]=l.source,e[1]=m.name,e[2]=S):S=e[2];const{label:M,glyph:O}=S;let I;e[3]!==l?(I=B(l),e[3]=l,e[4]=I):I=e[4];const F=I,z=r?"opacity-60":"hover:bg-muted/50";let u;e[5]!==z?(u=pe("relative transition-colors group overflow-hidden flex flex-col h-full",z),e[5]=z,e[6]=u):u=e[6];let f;e[7]!==l.name||e[8]!==c||e[9]!==r?(f=!r&&t.jsx("button",{type:"button",onClick:c,className:"absolute inset-0 z-0","aria-label":l.name}),e[7]=l.name,e[8]=c,e[9]=r,e[10]=f):f=e[10];const b=F?"default":"system",D=!F;let w;e[11]!==O||e[12]!==b||e[13]!==D?(w=t.jsx(Fe,{glyph:O,tone:b,readOnly:D,className:"size-8 shrink-0"}),e[11]=O,e[12]=b,e[13]=D,e[14]=w):w=e[14];let h;e[15]!==a||e[16]!==o?(h=a&&t.jsx("div",{className:"relative z-10 pointer-events-auto transition-opacity sm:opacity-0 sm:group-hover:opacity-100",children:t.jsxs(ge,{children:[t.jsx(fe,{asChild:!0,children:t.jsx(U,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:t.jsx(ke,{size:16})})}),t.jsx(he,{align:"end",children:t.jsxs(xe,{variant:"destructive",onClick:K=>{K.stopPropagation(),a()},children:[t.jsx(ye,{size:16}),o("settings.skills.deleteButton")]})})]})}),e[15]=a,e[16]=o,e[17]=h):h=e[17];let x;e[18]!==w||e[19]!==h?(x=t.jsxs("div",{className:"flex items-start justify-between",children:[w,h]}),e[18]=w,e[19]=h,e[20]=x):x=e[20];let j;e[21]!==l.name?(j=t.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:l.name}),e[21]=l.name,e[22]=j):j=e[22];let N;e[23]!==l.description||e[24]!==o?(N=l.description||o("settings.skills.noDescription"),e[23]=l.description,e[24]=o,e[25]=N):N=e[25];let k;e[26]!==N?(k=t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:N}),e[26]=N,e[27]=k):k=e[27];let d;e[28]!==j||e[29]!==k?(d=t.jsxs("div",{className:"flex flex-col gap-1",children:[j,k]}),e[28]=j,e[29]=k,e[30]=d):d=e[30];let v;e[31]!==x||e[32]!==d?(v=t.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[x,d]}),e[31]=x,e[32]=d,e[33]=v):v=e[33];let p;e[34]!==M||e[35]!==r||e[36]!==o?(p=r?o("settings.skills.importing"):M,e[34]=M,e[35]=r,e[36]=o,e[37]=p):p=e[37];let y;e[38]!==p?(y=t.jsx("div",{className:"border-t border-border mt-auto",children:t.jsx("div",{className:"h-10 flex items-center px-4.5",children:t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:p})})}),e[38]=p,e[39]=y):y=e[39];let g;e[40]!==v||e[41]!==y?(g=t.jsxs("div",{className:"flex flex-col flex-1 pointer-events-none",children:[v,y]}),e[40]=v,e[41]=y,e[42]=g):g=e[42];let P;return e[43]!==r||e[44]!==g||e[45]!==u||e[46]!==f?(P=t.jsxs(je,{"aria-busy":r,className:u,children:[f,g]}),e[43]=r,e[44]=g,e[45]=u,e[46]=f,e[47]=P):P=e[47],P}function ee(s){const e=ie.c(2),{children:l}=s;let r;return e[0]!==l?(r=t.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:l}),e[0]=l,e[1]=r):r=e[1],r}function Et(){const s=te(),{org:e}=se(),l=Re(),{remove:r,upload:c}=$e("home"),a=ae(),o=T.useRef(null),[m,S]=T.useState(""),M=ce(),[O,I]=T.useState(L),[F,z]=T.useState(!1),[u,f]=T.useState(null),[b,D]=T.useState(null),[w,h]=T.useState(null),x=()=>{a.invalidateQueries({queryKey:Q.slashSkills(e.id)}),a.invalidateQueries({queryKey:Q.orgFsSkills(e.id)})},j=i=>a.setQueryData(Q.slashSkills(e.id),n=>i(n??[]));async function N(i){const n=[...i??[]];if(o.current&&(o.current.value=""),n.length===0)return;const A=n[0]?.webkitRelativePath??"";if(!A){C.error(s("settings.skills.importNeedsFolder"));return}const H=A.split("/")[0]??"",_=n.filter(He),W=_.find(E=>q(E)==="SKILL.md");if(!W){C.error(s("settings.skills.importMissingSkillMd"));return}if(_.length>Z){C.error(s("settings.skills.importTooManyFiles",{count:String(_.length),max:String(Z)}));return}const R=Qe(H),X=`skills/${R}`;let V=!1;z(!0);try{if(await _e(e.slug,"home",X)){C.error(s("settings.skills.importSlugTaken",{slug:R}));return}V=!0;const E=Ge(R,await W.text());j(oe=>[E,...oe]),h(E.id),await qe(Ue(_,R),c.mutateAsync),C.success(s("settings.skills.importSuccess",{name:R}))}catch(E){V&&await r.mutateAsync(X).catch(()=>{}),C.error(E instanceof Error?E.message:s("settings.skills.importError"))}finally{h(null),x(),z(!1)}}const k=m.toLowerCase(),d=(l.data??[]).filter(i=>i.name.toLowerCase().includes(k)||(i.description??"").toLowerCase().includes(k)).sort((i,n)=>Number(B(n))-Number(B(i))||i.name.localeCompare(n.name)),v=new Set((l.data??[]).map(i=>i.source)),p=new Map;for(const i of d)p.set(i.source,(p.get(i.source)??0)+1);const y=[{id:L,label:s("settings.skills.filterAll"),count:d.length},...[...v].map(i=>({id:i,label:re(i,e.name).label,count:p.get(i)??0}))],g=v.has(O)?O:L,P=g===L?d:d.filter(i=>i.source===g),K=i=>f(Be(i.volume,i.path)),ne=async()=>{if(!b)return;const{id:i,path:n}=b;D(null),j(A=>A.filter(H=>H.id!==i));try{await r.mutateAsync(n),C.success(s("settings.skills.deleteSuccess"))}catch(A){C.error(A instanceof Error?A.message:s("settings.skills.deleteError"))}finally{x()}},G=t.jsxs(U,{size:"sm",disabled:F,onClick:()=>o.current?.click(),children:[t.jsx(Se,{size:14}),s(F?"settings.skills.importing":"settings.skills.importButton")]});return t.jsxs($,{children:[t.jsx($.Content,{children:t.jsx($.Container,{children:t.jsxs("div",{className:"flex flex-col gap-6",children:[M?t.jsx($.Actions,{secondary:t.jsx(we,{value:m,onChange:S,label:s("library.context.search"),placeholder:s("settings.skills.searchPlaceholder"),clearLabel:s("library.library.clearSearch")}),children:G}):t.jsx($.Title,{actions:G,children:s("settings.skills.pageTitle")}),t.jsx("div",{className:"flex flex-wrap items-center justify-between gap-3 empty:hidden",children:!M&&t.jsx(be,{value:m,onChange:S,placeholder:s("settings.skills.searchPlaceholder"),className:"w-full md:w-[375px]",onKeyDown:i=>{i.key==="Escape"&&(S(""),i.target.blur())}})}),t.jsx("input",{ref:o,type:"file",multiple:!0,webkitdirectory:"",className:"hidden",onChange:i=>{N(i.target.files)}}),y.length>2&&t.jsx(Oe,{placement:"page",tabs:y,activeTab:g,onTabChange:I}),l.isPending?t.jsx("div",{className:"@container",children:t.jsx(ee,{children:Array.from({length:8},(i,n)=>t.jsx(de,{className:"h-[168px] rounded-xl"},n))})}):l.isError?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx(Y,{image:t.jsx(me,{size:48,className:"text-muted-foreground"}),title:s("settings.skills.errorTitle"),description:l.error instanceof Error?l.error.message:s("settings.skills.errorDescription"),actions:t.jsx(U,{size:"sm",variant:"outline",onClick:()=>{l.refetch()},children:s("settings.skills.retry")})})}):P.length===0?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx(Y,{image:t.jsx(le,{size:48,className:"text-muted-foreground"}),title:s(m?"settings.skills.noResultsTitle":"settings.skills.emptyTitle"),description:m?s("settings.skills.noResultsDescription",{search:m}):s("settings.skills.emptyDescription"),actions:!1})}):t.jsx("div",{className:"@container",children:t.jsx(ee,{children:P.map(i=>{const n=i.id===w;return t.jsx(We,{entry:i,pending:n,onOpen:()=>K(i),onDelete:B(i)&&!n?()=>D(i):void 0},i.id)})})})]})})}),u&&t.jsx(ze,{skillPath:u,onClose:()=>f(null)},u),t.jsx(Ne,{open:b!==null,onOpenChange:i=>!i&&D(null),children:t.jsxs(Ce,{children:[t.jsxs(De,{children:[t.jsx(Pe,{children:s("settings.skills.deleteDialogTitle")}),t.jsx(Ae,{children:s("settings.skills.deleteDialogDescription",{name:b?.name??""})})]}),t.jsxs(Ee,{children:[t.jsx(Te,{children:s("settings.skills.cancel")}),t.jsx(Me,{onClick:ne,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:s("settings.skills.deleteButton")})]})]})})]})}export{Et as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as x,l as p,j as v}from"./index-
|
|
1
|
+
import{c as x,l as p,j as v}from"./index-8f_vFFVa.js";import{T as y,R as w,a as _,b as j}from"./index-DZi1rH7e.js";function R(m){const e=x.c(26);let l,t,i,d,c,a;e[0]!==m?({className:l,defaultValue:t,value:a,min:d,max:c,...i}=m,e[0]=m,e[1]=l,e[2]=t,e[3]=i,e[4]=d,e[5]=c,e[6]=a):(l=e[1],t=e[2],i=e[3],d=e[4],c=e[5],a=e[6]);const o=d===void 0?0:d,r=c===void 0?100:c;let u;e[7]!==t||e[8]!==r||e[9]!==o||e[10]!==a?(u=Array.isArray(a)?a:Array.isArray(t)?t:[o,r],e[7]=t,e[8]=r,e[9]=o,e[10]=a,e[11]=u):u=e[11];const g=u;let n;e[12]!==l?(n=p("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",l),e[12]=l,e[13]=n):n=e[13];let f;e[14]===Symbol.for("react.memo_cache_sentinel")?(f=p("bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"),e[14]=f):f=e[14];let h;e[15]===Symbol.for("react.memo_cache_sentinel")?(h=v.jsx(y,{"data-slot":"slider-track",className:f,children:v.jsx(w,{"data-slot":"slider-range",className:p("bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full")})}),e[15]=h):h=e[15];let s;e[16]!==g.length?(s=Array.from({length:g.length},k),e[16]=g.length,e[17]=s):s=e[17];let b;return e[18]!==t||e[19]!==r||e[20]!==o||e[21]!==i||e[22]!==n||e[23]!==s||e[24]!==a?(b=v.jsxs(_,{"data-slot":"slider",defaultValue:t,value:a,min:o,max:r,className:n,...i,children:[h,s]}),e[18]=t,e[19]=r,e[20]=o,e[21]=i,e[22]=n,e[23]=s,e[24]=a,e[25]=b):b=e[25],b}function k(m,e){return v.jsx(j,{"data-slot":"slider-thumb",className:"border-primary bg-background ring-ring/50 block size-4 shrink-0 rounded-full border shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"},e)}export{R as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as v,d$ as K}from"./index-
|
|
1
|
+
import{r as v,d$ as K}from"./index-8f_vFFVa.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-CpQIzrUC.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 B,a2 as L,r as v,j as e,n as x,fK as k,eo as y,ep as E,eq as a,g6 as D,B as m,I as d,y as C,t as c,c as z}from"./index-
|
|
1
|
+
import{b as B,a2 as L,r as v,j as e,n as x,fK as k,eo as y,ep as E,eq as a,g6 as D,B as m,I as d,y as C,t as c,c as z}from"./index-8f_vFFVa.js";import{D as T}from"./domain-settings-BDcWjcTo.js";import{f as O,e as R,b as q,A as F,d as M,c as U,g as $}from"./alert-dialog-C884MJiU.js";import{S as H}from"./switch-CnVsSUQF.js";import{a as K,b as G,c as J,d as Q}from"./use-org-sso-CAhUTOPh.js";import{s as V}from"./Trash01-DeYkLyg0.js";import{R as W}from"./require-capability-KC9Pz6jZ.js";import"./badge-Bmk8ti5E.js";import"./select-CD39mfCB.js";import"./index-BdQq_4o_.js";import"./index-CEuerbGa.js";import"./ChevronUp-COqs90Hs.js";import"./access-gate-hn6vo27o.js";import"./capability-load-error-BVmBezr5.js";function X(){const s=B(),{org:o}=L(),{data:h,isLoading:I}=K(o.id,o.slug),f=G(o.id,o.slug),S=J(o.id,o.slug),b=Q(o.id,o.slug),[i,l]=v.useState({issuer:"",clientId:"",clientSecret:"",discoveryEndpoint:"",domain:"",scopes:"openid email profile"}),[g,p]=v.useState(!1),[P,j]=v.useState(!1),u=h?.configured&&h.config,n=h?.config,N=()=>{n&&l({issuer:n.issuer,clientId:n.clientId,clientSecret:"",discoveryEndpoint:n.discoveryEndpoint??"",domain:n.domain,scopes:n.scopes.join(" ")}),p(!0)},_=async()=>{if(!i.issuer||!i.clientId||!i.domain){c.error(s("settings.orgSso.requiredFieldsError"));return}if(!u&&!i.clientSecret){c.error(s("settings.orgSso.clientSecretRequiredError"));return}try{await f.mutateAsync({issuer:i.issuer,clientId:i.clientId,clientSecret:i.clientSecret,discoveryEndpoint:i.discoveryEndpoint||void 0,scopes:i.scopes.split(/\s+/).filter(Boolean),domain:i.domain,enforced:n?.enforced??!1}),C(u?"sso_config_updated":"sso_configured",{organization_id:o.id,email_domain:i.domain}),c.success(s("settings.orgSso.configurationSavedSuccess")),p(!1)}catch(t){c.error(t instanceof Error?t.message:s("settings.orgSso.saveSsoConfigError"))}},w=async()=>{try{await S.mutateAsync(),C("sso_config_removed",{organization_id:o.id}),c.success(s("settings.orgSso.configurationRemovedSuccess")),p(!1),j(!1)}catch{c.error(s("settings.orgSso.removeSsoConfigError"))}},A=async t=>{try{await b.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(T,{}),I?e.jsx("div",{className:"text-sm text-muted-foreground",children:s("settings.orgSso.loading")}):e.jsxs(e.Fragment,{children:[u&&!g&&e.jsx(y,{title:s("settings.orgSso.sectionTitle"),children:e.jsxs(E,{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(H,{checked:n.enforced,onCheckedChange:A,disabled:b.isPending})}),e.jsxs(D,{children:[e.jsxs(m,{variant:"ghost",size:"sm",onClick:()=>j(!0),disabled:S.isPending,className:"text-destructive hover:text-destructive mr-auto",children:[e.jsx(V,{size:14}),s("settings.orgSso.removeButton")]}),e.jsx(m,{variant:"outline",size:"sm",onClick:()=>{window.open(`/api/${o.slug}/sso/authorize`,"_blank")},children:s("settings.orgSso.testSsoButton")}),e.jsx(m,{variant:"outline",size:"sm",onClick:N,children:s("settings.orgSso.editConfigButton")})]})]})}),(!u||g)&&e.jsx(y,{title:s("settings.orgSso.sectionTitle"),children:e.jsxs(E,{children:[e.jsx(a,{title:s("settings.orgSso.issuerUrlLabel"),description:s("settings.orgSso.issuerUrlDescription"),action:e.jsx(d,{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(d,{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:g&&u?s("settings.orgSso.clientSecretEditDescription"):void 0,action:e.jsx(d,{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(d,{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(d,{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(d,{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:[g&&e.jsx(m,{variant:"outline",size:"sm",onClick:()=>p(!1),children:s("settings.orgSso.cancelButton")}),e.jsx(m,{onClick:_,disabled:f.isPending,size:"sm",children:f.isPending?s("settings.orgSso.savingButton"):s(g?"settings.orgSso.updateButton":"settings.orgSso.configureSsoButton")})]})]})})]})]})})}),e.jsx(O,{open:P,onOpenChange:j,children:e.jsxs(R,{children:[e.jsx(q,{children:e.jsx(F,{children:s("settings.orgSso.removeConfirmation")})}),e.jsxs(M,{children:[e.jsx(U,{disabled:S.isPending,children:s("settings.orgSso.cancelButton")}),e.jsx($,{onClick:w,disabled:S.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:s("settings.orgSso.removeButton")})]})]})})]})}function ue(){const s=z.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{ue as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as Ye,n as ie,o as Ge,D as Qe,v as ze,w as Ze}from"./usage-stats-B3aY2c0l.js";import{r as p,eE as Je,eF as we,eG as et,eH as j,eI as te,j as I,b4 as tt,eJ as nt,eK as ne,eL as ot,eM as rt,eN as st,eO as it,eP as at,eQ as lt,eR as Ce,eS as ct,c as H,R as ut,K as dt,eT as ft,eU as gt,eV as mt,b as pt,l as vt,h as ht}from"./index-Cmhl3zNb.js";import{g as bt,d as xt}from"./tool-namespace-CRTO9xOA.js";import{A as yt}from"./agent-icon-DMH8Ftve.js";var Hn=Ye;var Rt=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],ae=Rt.join(","),Ie=typeof Element>"u",Q=Ie?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,J=!Ie&&Element.prototype.getRootNode?function(n){var e;return n==null||(e=n.getRootNode)===null||e===void 0?void 0:e.call(n)}:function(n){return n?.ownerDocument},ee=function(e,t){var o;t===void 0&&(t=!0);var r=e==null||(o=e.getAttribute)===null||o===void 0?void 0:o.call(e,"inert"),s=r===""||r==="true",i=s||t&&e&&(typeof e.closest=="function"?e.closest("[inert]"):ee(e.parentNode));return i},St=function(e){var t,o=e==null||(t=e.getAttribute)===null||t===void 0?void 0:t.call(e,"contenteditable");return o===""||o==="true"},Et=function(e,t,o){if(ee(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(ae));return t&&Q.call(e,ae)&&r.unshift(e),r=r.filter(o),r},le=function(e,t,o){for(var r=[],s=Array.from(e);s.length;){var i=s.shift();if(!ee(i,!1))if(i.tagName==="SLOT"){var a=i.assignedElements(),l=a.length?a:i.children,c=le(l,!0,o);o.flatten?r.push.apply(r,c):r.push({scopeParent:i,candidates:c})}else{var d=Q.call(i,ae);d&&o.filter(i)&&(t||!e.includes(i))&&r.push(i);var u=i.shadowRoot||typeof o.getShadowRoot=="function"&&o.getShadowRoot(i),g=!ee(u,!1)&&(!o.shadowRootFilter||o.shadowRootFilter(i));if(u&&g){var h=le(u===!0?i.children:u.children,!0,o);o.flatten?r.push.apply(r,h):r.push({scopeParent:i,candidates:h})}else s.unshift.apply(s,i.children)}}return r},Te=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Pe=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||St(e))&&!Te(e)?0:e.tabIndex},wt=function(e,t){var o=Pe(e);return o<0&&t&&!Te(e)?0:o},Ct=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Ae=function(e){return e.tagName==="INPUT"},It=function(e){return Ae(e)&&e.type==="hidden"},Tt=function(e){var t=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(o){return o.tagName==="SUMMARY"});return t},Pt=function(e,t){for(var o=0;o<e.length;o++)if(e[o].checked&&e[o].form===t)return e[o]},At=function(e){if(!e.name)return!0;var t=e.form||J(e),o=function(a){return t.querySelectorAll('input[type="radio"][name="'+a+'"]')},r;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")r=o(window.CSS.escape(e.name));else try{r=o(e.name)}catch(i){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",i.message),!1}var s=Pt(r,e.form);return!s||s===e},Nt=function(e){return Ae(e)&&e.type==="radio"},Dt=function(e){return Nt(e)&&!At(e)},Mt=function(e){var t,o=e&&J(e),r=(t=o)===null||t===void 0?void 0:t.host,s=!1;if(o&&o!==e){var i,a,l;for(s=!!((i=r)!==null&&i!==void 0&&(a=i.ownerDocument)!==null&&a!==void 0&&a.contains(r)||e!=null&&(l=e.ownerDocument)!==null&&l!==void 0&&l.contains(e));!s&&r;){var c,d,u;o=J(r),r=(c=o)===null||c===void 0?void 0:c.host,s=!!((d=r)!==null&&d!==void 0&&(u=d.ownerDocument)!==null&&u!==void 0&&u.contains(r))}}return s},ge=function(e){var t=e.getBoundingClientRect(),o=t.width,r=t.height;return o===0&&r===0},Ot=function(e,t){var o=t.displayCheck,r=t.getShadowRoot;if(o==="full-native"&&"checkVisibility"in e){var s=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!s}if(getComputedStyle(e).visibility==="hidden")return!0;var i=Q.call(e,"details>summary:first-of-type"),a=i?e.parentElement:e;if(Q.call(a,"details:not([open]) *"))return!0;if(!o||o==="full"||o==="full-native"||o==="legacy-full"){if(typeof r=="function"){for(var l=e;e;){var c=e.parentElement,d=J(e);if(c&&!c.shadowRoot&&r(c)===!0)return ge(e);e.assignedSlot?e=e.assignedSlot:!c&&d!==e.ownerDocument?e=d.host:e=c}e=l}if(Mt(e))return!e.getClientRects().length;if(o!=="legacy-full")return!0}else if(o==="non-zero-area")return ge(e);return!1},Ft=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName==="FIELDSET"&&t.disabled){for(var o=0;o<t.children.length;o++){var r=t.children.item(o);if(r.tagName==="LEGEND")return Q.call(t,"fieldset[disabled] *")?!0:!r.contains(e)}return!0}t=t.parentElement}return!1},qt=function(e,t){return!(t.disabled||It(t)||Ot(t,e)||Tt(t)||Ft(t))},me=function(e,t){return!(Dt(t)||Pe(t)<0||!qt(e,t))},$t=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Ne=function(e){var t=[],o=[];return e.forEach(function(r,s){var i=!!r.scopeParent,a=i?r.scopeParent:r,l=wt(a,i),c=i?Ne(r.candidates):a;l===0?i?t.push.apply(t,c):t.push(a):o.push({documentOrder:s,tabIndex:l,item:r,isScope:i,content:c})}),o.sort(Ct).reduce(function(r,s){return s.isScope?r.push.apply(r,s.content):r.push(s.content),r},[]).concat(t)},De=function(e,t){t=t||{};var o;return t.getShadowRoot?o=le([e],t.includeContainer,{filter:me.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:$t}):o=Et(e,t.includeContainer,me.bind(null,t)),Ne(o)};function kt(){return/apple/i.test(navigator.vendor)}const pe="data-floating-ui-focusable";function _t(n){let e=n.activeElement;for(;((t=e)==null||(t=t.shadowRoot)==null?void 0:t.activeElement)!=null;){var t;e=e.shadowRoot.activeElement}return e}function ce(n,e){if(!n||!e)return!1;const t=e.getRootNode==null?void 0:e.getRootNode();if(n.contains(e))return!0;if(t&&Je(t)){let o=e;for(;o;){if(n===o)return!0;o=o.parentNode||o.host}}return!1}function G(n){return"composedPath"in n?n.composedPath()[0]:n.target}function oe(n,e){if(e==null)return!1;if("composedPath"in n)return n.composedPath().includes(e);const t=n;return t.target!=null&&e.contains(t.target)}function Lt(n){return n.matches("html,body")}function z(n){return n?.ownerDocument||document}function jt(n){return n?n.hasAttribute(pe)?n:n.querySelector("["+pe+"]")||n:null}function Z(n,e,t){return t===void 0&&(t=!0),n.filter(r=>{var s;return r.parentId===e&&(!t||((s=r.context)==null?void 0:s.open))}).flatMap(r=>[r,...Z(n,r.id,t)])}function Kt(n){return"nativeEvent"in n}var Bt=typeof document<"u",Ut=function(){},V=Bt?p.useLayoutEffect:Ut;const Vt={...we},Wt=Vt.useInsertionEffect,Ht=Wt||(n=>n());function W(n){const e=p.useRef(()=>{});return Ht(()=>{e.current=n}),p.useCallback(function(){for(var t=arguments.length,o=new Array(t),r=0;r<t;r++)o[r]=arguments[r];return e.current==null?void 0:e.current(...o)},[])}const Me=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Oe(n,e){const t=De(n,Me()),o=t.length;if(o===0)return;const r=_t(z(n)),s=t.indexOf(r),i=s===-1?e===1?0:o-1:s+e;return t[i]}function Xt(n){return Oe(z(n).body,1)||n}function Yt(n){return Oe(z(n).body,-1)||n}function re(n,e){const t=e||n.currentTarget,o=n.relatedTarget;return!o||!ce(t,o)}function Gt(n){De(n,Me()).forEach(t=>{t.dataset.tabindex=t.getAttribute("tabindex")||"",t.setAttribute("tabindex","-1")})}function ve(n){n.querySelectorAll("[data-tabindex]").forEach(t=>{const o=t.dataset.tabindex;delete t.dataset.tabindex,o?t.setAttribute("tabindex",o):t.removeAttribute("tabindex")})}const Qt="data-floating-ui-focusable",he="active",be="selected",zt={...we};let xe=!1,Zt=0;const ye=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Zt++;function Jt(){const[n,e]=p.useState(()=>xe?ye():void 0);return V(()=>{n==null&&e(ye())},[]),p.useEffect(()=>{xe=!0},[]),n}const en=zt.useId,ue=en||Jt;function tn(){const n=new Map;return{emit(e,t){var o;(o=n.get(e))==null||o.forEach(r=>r(t))},on(e,t){n.has(e)||n.set(e,new Set),n.get(e).add(t)},off(e,t){var o;(o=n.get(e))==null||o.delete(t)}}}const nn=p.createContext(null),on=p.createContext(null),Fe=()=>{var n;return((n=p.useContext(nn))==null?void 0:n.id)||null},qe=()=>p.useContext(on);function de(n){return"data-floating-ui-"+n}const rn={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},Re=p.forwardRef(function(e,t){const[o,r]=p.useState();V(()=>{kt()&&r("button")},[]);const s={ref:t,tabIndex:0,role:o,"aria-hidden":o?void 0:!0,[de("focus-guard")]:"",style:rn};return I.jsx("span",{...e,...s})}),sn={clipPath:"inset(50%)",position:"fixed",top:0,left:0},$e=p.createContext(null),Se=de("portal");function an(n){n===void 0&&(n={});const{id:e,root:t}=n,o=ue(),r=cn(),[s,i]=p.useState(null),a=p.useRef(null);return V(()=>()=>{s?.remove(),queueMicrotask(()=>{a.current=null})},[s]),V(()=>{if(!o||a.current)return;const l=e?document.getElementById(e):null;if(!l)return;const c=document.createElement("div");c.id=o,c.setAttribute(Se,""),l.appendChild(c),a.current=c,i(c)},[e,o]),V(()=>{if(t===null||!o||a.current)return;let l=t||r?.portalNode;l&&!it(l)&&(l=l.current),l=l||document.body;let c=null;e&&(c=document.createElement("div"),c.id=e,l.appendChild(c));const d=document.createElement("div");d.id=o,d.setAttribute(Se,""),l=c||l,l.appendChild(d),a.current=d,i(d)},[e,t,o,r]),s}function ln(n){const{children:e,id:t,root:o,preserveTabOrder:r=!0}=n,s=an({id:t,root:o}),[i,a]=p.useState(null),l=p.useRef(null),c=p.useRef(null),d=p.useRef(null),u=p.useRef(null),g=i?.modal,h=i?.open,y=!!i&&!i.modal&&i.open&&r&&!!(o||s);return p.useEffect(()=>{if(!s||!r||g)return;function m(f){s&&re(f)&&(f.type==="focusin"?ve:Gt)(s)}return s.addEventListener("focusin",m,!0),s.addEventListener("focusout",m,!0),()=>{s.removeEventListener("focusin",m,!0),s.removeEventListener("focusout",m,!0)}},[s,r,g]),p.useEffect(()=>{s&&(h||ve(s))},[h,s]),I.jsxs($e.Provider,{value:p.useMemo(()=>({preserveTabOrder:r,beforeOutsideRef:l,afterOutsideRef:c,beforeInsideRef:d,afterInsideRef:u,portalNode:s,setFocusManagerState:a}),[r,s]),children:[y&&s&&I.jsx(Re,{"data-type":"outside",ref:l,onFocus:m=>{if(re(m,s)){var f;(f=d.current)==null||f.focus()}else{const x=i?i.domReference:null,b=Yt(x);b?.focus()}}}),y&&s&&I.jsx("span",{"aria-owns":s.id,style:sn}),s&&tt.createPortal(e,s),y&&s&&I.jsx(Re,{"data-type":"outside",ref:c,onFocus:m=>{if(re(m,s)){var f;(f=u.current)==null||f.focus()}else{const x=i?i.domReference:null,b=Xt(x);b?.focus(),i?.closeOnFocusOut&&i?.onOpenChange(!1,m.nativeEvent,"focus-out")}}})]})}const cn=()=>p.useContext($e),un={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},dn={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Ee=n=>{var e,t;return{escapeKey:typeof n=="boolean"?n:(e=n?.escapeKey)!=null?e:!1,outsidePress:typeof n=="boolean"?n:(t=n?.outsidePress)!=null?t:!0}};function fn(n,e){e===void 0&&(e={});const{open:t,onOpenChange:o,elements:r,dataRef:s}=n,{enabled:i=!0,escapeKey:a=!0,outsidePress:l=!0,outsidePressEvent:c="pointerdown",referencePress:d=!1,referencePressEvent:u="pointerdown",ancestorScroll:g=!1,bubbles:h,capture:y}=e,m=qe(),f=W(typeof l=="function"?l:()=>!1),x=typeof l=="function"?f:l,b=p.useRef(!1),{escapeKey:R,outsidePress:v}=Ee(h),{escapeKey:D,outsidePress:C}=Ee(y),O=p.useRef(!1),A=W(S=>{var E;if(!t||!i||!a||S.key!=="Escape"||O.current)return;const P=(E=s.current.floatingContext)==null?void 0:E.nodeId,M=m?Z(m.nodesRef.current,P):[];if(!R&&(S.stopPropagation(),M.length>0)){let w=!0;if(M.forEach(N=>{var q;if((q=N.context)!=null&&q.open&&!N.context.dataRef.current.__escapeKeyBubbles){w=!1;return}}),!w)return}o(!1,Kt(S)?S.nativeEvent:S,"escape-key")}),F=W(S=>{var E;const P=()=>{var M;A(S),(M=G(S))==null||M.removeEventListener("keydown",P)};(E=G(S))==null||E.addEventListener("keydown",P)}),T=W(S=>{var E;const P=s.current.insideReactTree;s.current.insideReactTree=!1;const M=b.current;if(b.current=!1,c==="click"&&M||P||typeof x=="function"&&!x(S))return;const w=G(S),N="["+de("inert")+"]",q=z(r.floating).querySelectorAll(N);let L=j(w)?w:null;for(;L&&!ne(L);){const k=ot(L);if(ne(k)||!j(k))break;L=k}if(q.length&&j(w)&&!Lt(w)&&!ce(w,r.floating)&&Array.from(q).every(k=>!ce(L,k)))return;if(rt(w)&&K){const k=ne(w),B=st(w),Y=/auto|scroll/,Ke=k||Y.test(B.overflowX),Be=k||Y.test(B.overflowY),Ue=Ke&&w.clientWidth>0&&w.scrollWidth>w.clientWidth,Ve=Be&&w.clientHeight>0&&w.scrollHeight>w.clientHeight,We=B.direction==="rtl",He=Ve&&(We?S.offsetX<=w.offsetWidth-w.clientWidth:S.offsetX>w.clientWidth),Xe=Ue&&S.offsetY>w.clientHeight;if(He||Xe)return}const U=(E=s.current.floatingContext)==null?void 0:E.nodeId,X=m&&Z(m.nodesRef.current,U).some(k=>{var B;return oe(S,(B=k.context)==null?void 0:B.elements.floating)});if(oe(S,r.floating)||oe(S,r.domReference)||X)return;const fe=m?Z(m.nodesRef.current,U):[];if(fe.length>0){let k=!0;if(fe.forEach(B=>{var Y;if((Y=B.context)!=null&&Y.open&&!B.context.dataRef.current.__outsidePressBubbles){k=!1;return}}),!k)return}o(!1,S,"outside-press")}),$=W(S=>{var E;const P=()=>{var M;T(S),(M=G(S))==null||M.removeEventListener(c,P)};(E=G(S))==null||E.addEventListener(c,P)});p.useEffect(()=>{if(!t||!i)return;s.current.__escapeKeyBubbles=R,s.current.__outsidePressBubbles=v;let S=-1;function E(q){o(!1,q,"ancestor-scroll")}function P(){window.clearTimeout(S),O.current=!0}function M(){S=window.setTimeout(()=>{O.current=!1},nt()?5:0)}const w=z(r.floating);a&&(w.addEventListener("keydown",D?F:A,D),w.addEventListener("compositionstart",P),w.addEventListener("compositionend",M)),x&&w.addEventListener(c,C?$:T,C);let N=[];return g&&(j(r.domReference)&&(N=te(r.domReference)),j(r.floating)&&(N=N.concat(te(r.floating))),!j(r.reference)&&r.reference&&r.reference.contextElement&&(N=N.concat(te(r.reference.contextElement)))),N=N.filter(q=>{var L;return q!==((L=w.defaultView)==null?void 0:L.visualViewport)}),N.forEach(q=>{q.addEventListener("scroll",E,{passive:!0})}),()=>{a&&(w.removeEventListener("keydown",D?F:A,D),w.removeEventListener("compositionstart",P),w.removeEventListener("compositionend",M)),x&&w.removeEventListener(c,C?$:T,C),N.forEach(q=>{q.removeEventListener("scroll",E)}),window.clearTimeout(S)}},[s,r,a,x,c,t,o,g,i,R,v,A,D,F,T,C,$]),p.useEffect(()=>{s.current.insideReactTree=!1},[s,x,c]);const _=p.useMemo(()=>({onKeyDown:A,...d&&{[un[u]]:S=>{o(!1,S.nativeEvent,"reference-press")},...u!=="click"&&{onClick(S){o(!1,S.nativeEvent,"reference-press")}}}}),[A,o,d,u]),K=p.useMemo(()=>{function S(E){E.button===0&&(b.current=!0)}return{onKeyDown:A,onMouseDown:S,onMouseUp:S,[dn[c]]:()=>{s.current.insideReactTree=!0}}},[A,c,s]);return p.useMemo(()=>i?{reference:_,floating:K}:{},[i,_,K])}function gn(n){const{open:e=!1,onOpenChange:t,elements:o}=n,r=ue(),s=p.useRef({}),[i]=p.useState(()=>tn()),a=Fe()!=null,[l,c]=p.useState(o.reference),d=W((h,y,m)=>{s.current.openEvent=h?y:void 0,i.emit("openchange",{open:h,event:y,reason:m,nested:a}),t?.(h,y,m)}),u=p.useMemo(()=>({setPositionReference:c}),[]),g=p.useMemo(()=>({reference:l||o.reference||null,floating:o.floating||null,domReference:o.reference}),[l,o.reference,o.floating]);return p.useMemo(()=>({dataRef:s,open:e,onOpenChange:d,elements:g,events:i,floatingId:r,refs:u}),[e,d,g,i,r,u])}function mn(n){n===void 0&&(n={});const{nodeId:e}=n,t=gn({...n,elements:{reference:null,floating:null,...n.elements}}),o=n.rootContext||t,r=o.elements,[s,i]=p.useState(null),[a,l]=p.useState(null),d=r?.domReference||s,u=p.useRef(null),g=qe();V(()=>{d&&(u.current=d)},[d]);const h=et({...n,elements:{...r,...a&&{reference:a}}}),y=p.useCallback(R=>{const v=j(R)?{getBoundingClientRect:()=>R.getBoundingClientRect(),getClientRects:()=>R.getClientRects(),contextElement:R}:R;l(v),h.refs.setReference(v)},[h.refs]),m=p.useCallback(R=>{(j(R)||R===null)&&(u.current=R,i(R)),(j(h.refs.reference.current)||h.refs.reference.current===null||R!==null&&!j(R))&&h.refs.setReference(R)},[h.refs]),f=p.useMemo(()=>({...h.refs,setReference:m,setPositionReference:y,domReference:u}),[h.refs,m,y]),x=p.useMemo(()=>({...h.elements,domReference:d}),[h.elements,d]),b=p.useMemo(()=>({...h,...o,refs:f,elements:x,nodeId:e}),[h,f,x,e,o]);return V(()=>{o.dataRef.current.floatingContext=b;const R=g?.nodesRef.current.find(v=>v.id===e);R&&(R.context=b)}),p.useMemo(()=>({...h,context:b,refs:f,elements:x}),[h,f,x,b])}function se(n,e,t){const o=new Map,r=t==="item";let s=n;if(r&&n){const{[he]:i,[be]:a,...l}=n;s=l}return{...t==="floating"&&{tabIndex:-1,[Qt]:""},...s,...e.map(i=>{const a=i?i[t]:null;return typeof a=="function"?n?a(n):null:a}).concat(n).reduce((i,a)=>(a&&Object.entries(a).forEach(l=>{let[c,d]=l;if(!(r&&[he,be].includes(c)))if(c.indexOf("on")===0){if(o.has(c)||o.set(c,[]),typeof d=="function"){var u;(u=o.get(c))==null||u.push(d),i[c]=function(){for(var g,h=arguments.length,y=new Array(h),m=0;m<h;m++)y[m]=arguments[m];return(g=o.get(c))==null?void 0:g.map(f=>f(...y)).find(f=>f!==void 0)}}}else i[c]=d}),i),{})}}function pn(n){n===void 0&&(n=[]);const e=n.map(a=>a?.reference),t=n.map(a=>a?.floating),o=n.map(a=>a?.item),r=p.useCallback(a=>se(a,n,"reference"),e),s=p.useCallback(a=>se(a,n,"floating"),t),i=p.useCallback(a=>se(a,n,"item"),o);return p.useMemo(()=>({getReferenceProps:r,getFloatingProps:s,getItemProps:i}),[r,s,i])}const vn=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function hn(n,e){var t,o;e===void 0&&(e={});const{open:r,elements:s,floatingId:i}=n,{enabled:a=!0,role:l="dialog"}=e,c=ue(),d=((t=s.domReference)==null?void 0:t.id)||c,u=p.useMemo(()=>{var b;return((b=jt(s.floating))==null?void 0:b.id)||i},[s.floating,i]),g=(o=vn.get(l))!=null?o:l,y=Fe()!=null,m=p.useMemo(()=>g==="tooltip"||l==="label"?{["aria-"+(l==="label"?"labelledby":"describedby")]:r?u:void 0}:{"aria-expanded":r?"true":"false","aria-haspopup":g==="alertdialog"?"dialog":g,"aria-controls":r?u:void 0,...g==="listbox"&&{role:"combobox"},...g==="menu"&&{id:d},...g==="menu"&&y&&{role:"menuitem"},...l==="select"&&{"aria-autocomplete":"none"},...l==="combobox"&&{"aria-autocomplete":"list"}},[g,u,y,r,d,l]),f=p.useMemo(()=>{const b={id:u,...g&&{role:g}};return g==="tooltip"||l==="label"?b:{...b,...g==="menu"&&{"aria-labelledby":d}}},[g,u,d,l]),x=p.useCallback(b=>{let{active:R,selected:v}=b;const D={role:"option",...R&&{id:u+"-fui-option"}};switch(l){case"select":case"combobox":return{...D,"aria-selected":v}}return{}},[u,l]);return p.useMemo(()=>a?{reference:m,floating:f,item:x}:{},[a,m,f,x])}function bn(n){var e;const{char:t,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:s,startOfLine:i,$position:a}=n,l=o&&!r,c=Ze(t),d=new RegExp(`\\s${c}$`),u=i?"^":"",g=r?"":c,h=l?new RegExp(`${u}${c}.*?(?=\\s${g}|$)`,"gm"):new RegExp(`${u}(?:^)?${c}[^\\s${g}]*`,"gm"),y=((e=a.nodeBefore)===null||e===void 0?void 0:e.isText)&&a.nodeBefore.text;if(!y)return null;const m=a.pos-y.length,f=Array.from(y.matchAll(h)).pop();if(!f||f.input===void 0||f.index===void 0)return null;const x=f.input.slice(Math.max(0,f.index-1),f.index),b=new RegExp(`^[${s?.join("")}\0]?$`).test(x);if(s!==null&&!b)return null;const R=m+f.index;let v=R+f[0].length;return l&&d.test(y.slice(v-1,v+1))&&(f[0]+=" ",v+=1),R<a.pos&&v>=a.pos?{range:{from:R,to:v},query:f[0].slice(t.length),text:f[0]}:null}function xn(n){return n.docChanged?n.steps.some(e=>{const t=e.slice;if(!t?.content)return!1;const o=t.content.textBetween(0,t.content.size,`
|
|
1
|
+
import{t as Ye,n as ie,o as Ge,D as Qe,v as ze,w as Ze}from"./usage-stats-BJ2G_LxU.js";import{r as p,eE as Je,eF as we,eG as et,eH as j,eI as te,j as I,b4 as tt,eJ as nt,eK as ne,eL as ot,eM as rt,eN as st,eO as it,eP as at,eQ as lt,eR as Ce,eS as ct,c as H,R as ut,K as dt,eT as ft,eU as gt,eV as mt,b as pt,l as vt,h as ht}from"./index-8f_vFFVa.js";import{g as bt,d as xt}from"./tool-namespace-C8V5CWK9.js";import{A as yt}from"./agent-icon-DtUVrwO-.js";var Hn=Ye;var Rt=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],ae=Rt.join(","),Ie=typeof Element>"u",Q=Ie?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,J=!Ie&&Element.prototype.getRootNode?function(n){var e;return n==null||(e=n.getRootNode)===null||e===void 0?void 0:e.call(n)}:function(n){return n?.ownerDocument},ee=function(e,t){var o;t===void 0&&(t=!0);var r=e==null||(o=e.getAttribute)===null||o===void 0?void 0:o.call(e,"inert"),s=r===""||r==="true",i=s||t&&e&&(typeof e.closest=="function"?e.closest("[inert]"):ee(e.parentNode));return i},St=function(e){var t,o=e==null||(t=e.getAttribute)===null||t===void 0?void 0:t.call(e,"contenteditable");return o===""||o==="true"},Et=function(e,t,o){if(ee(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(ae));return t&&Q.call(e,ae)&&r.unshift(e),r=r.filter(o),r},le=function(e,t,o){for(var r=[],s=Array.from(e);s.length;){var i=s.shift();if(!ee(i,!1))if(i.tagName==="SLOT"){var a=i.assignedElements(),l=a.length?a:i.children,c=le(l,!0,o);o.flatten?r.push.apply(r,c):r.push({scopeParent:i,candidates:c})}else{var d=Q.call(i,ae);d&&o.filter(i)&&(t||!e.includes(i))&&r.push(i);var u=i.shadowRoot||typeof o.getShadowRoot=="function"&&o.getShadowRoot(i),g=!ee(u,!1)&&(!o.shadowRootFilter||o.shadowRootFilter(i));if(u&&g){var h=le(u===!0?i.children:u.children,!0,o);o.flatten?r.push.apply(r,h):r.push({scopeParent:i,candidates:h})}else s.unshift.apply(s,i.children)}}return r},Te=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Pe=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||St(e))&&!Te(e)?0:e.tabIndex},wt=function(e,t){var o=Pe(e);return o<0&&t&&!Te(e)?0:o},Ct=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Ae=function(e){return e.tagName==="INPUT"},It=function(e){return Ae(e)&&e.type==="hidden"},Tt=function(e){var t=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(o){return o.tagName==="SUMMARY"});return t},Pt=function(e,t){for(var o=0;o<e.length;o++)if(e[o].checked&&e[o].form===t)return e[o]},At=function(e){if(!e.name)return!0;var t=e.form||J(e),o=function(a){return t.querySelectorAll('input[type="radio"][name="'+a+'"]')},r;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")r=o(window.CSS.escape(e.name));else try{r=o(e.name)}catch(i){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",i.message),!1}var s=Pt(r,e.form);return!s||s===e},Nt=function(e){return Ae(e)&&e.type==="radio"},Dt=function(e){return Nt(e)&&!At(e)},Mt=function(e){var t,o=e&&J(e),r=(t=o)===null||t===void 0?void 0:t.host,s=!1;if(o&&o!==e){var i,a,l;for(s=!!((i=r)!==null&&i!==void 0&&(a=i.ownerDocument)!==null&&a!==void 0&&a.contains(r)||e!=null&&(l=e.ownerDocument)!==null&&l!==void 0&&l.contains(e));!s&&r;){var c,d,u;o=J(r),r=(c=o)===null||c===void 0?void 0:c.host,s=!!((d=r)!==null&&d!==void 0&&(u=d.ownerDocument)!==null&&u!==void 0&&u.contains(r))}}return s},ge=function(e){var t=e.getBoundingClientRect(),o=t.width,r=t.height;return o===0&&r===0},Ot=function(e,t){var o=t.displayCheck,r=t.getShadowRoot;if(o==="full-native"&&"checkVisibility"in e){var s=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!s}if(getComputedStyle(e).visibility==="hidden")return!0;var i=Q.call(e,"details>summary:first-of-type"),a=i?e.parentElement:e;if(Q.call(a,"details:not([open]) *"))return!0;if(!o||o==="full"||o==="full-native"||o==="legacy-full"){if(typeof r=="function"){for(var l=e;e;){var c=e.parentElement,d=J(e);if(c&&!c.shadowRoot&&r(c)===!0)return ge(e);e.assignedSlot?e=e.assignedSlot:!c&&d!==e.ownerDocument?e=d.host:e=c}e=l}if(Mt(e))return!e.getClientRects().length;if(o!=="legacy-full")return!0}else if(o==="non-zero-area")return ge(e);return!1},Ft=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName==="FIELDSET"&&t.disabled){for(var o=0;o<t.children.length;o++){var r=t.children.item(o);if(r.tagName==="LEGEND")return Q.call(t,"fieldset[disabled] *")?!0:!r.contains(e)}return!0}t=t.parentElement}return!1},qt=function(e,t){return!(t.disabled||It(t)||Ot(t,e)||Tt(t)||Ft(t))},me=function(e,t){return!(Dt(t)||Pe(t)<0||!qt(e,t))},$t=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Ne=function(e){var t=[],o=[];return e.forEach(function(r,s){var i=!!r.scopeParent,a=i?r.scopeParent:r,l=wt(a,i),c=i?Ne(r.candidates):a;l===0?i?t.push.apply(t,c):t.push(a):o.push({documentOrder:s,tabIndex:l,item:r,isScope:i,content:c})}),o.sort(Ct).reduce(function(r,s){return s.isScope?r.push.apply(r,s.content):r.push(s.content),r},[]).concat(t)},De=function(e,t){t=t||{};var o;return t.getShadowRoot?o=le([e],t.includeContainer,{filter:me.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:$t}):o=Et(e,t.includeContainer,me.bind(null,t)),Ne(o)};function kt(){return/apple/i.test(navigator.vendor)}const pe="data-floating-ui-focusable";function _t(n){let e=n.activeElement;for(;((t=e)==null||(t=t.shadowRoot)==null?void 0:t.activeElement)!=null;){var t;e=e.shadowRoot.activeElement}return e}function ce(n,e){if(!n||!e)return!1;const t=e.getRootNode==null?void 0:e.getRootNode();if(n.contains(e))return!0;if(t&&Je(t)){let o=e;for(;o;){if(n===o)return!0;o=o.parentNode||o.host}}return!1}function G(n){return"composedPath"in n?n.composedPath()[0]:n.target}function oe(n,e){if(e==null)return!1;if("composedPath"in n)return n.composedPath().includes(e);const t=n;return t.target!=null&&e.contains(t.target)}function Lt(n){return n.matches("html,body")}function z(n){return n?.ownerDocument||document}function jt(n){return n?n.hasAttribute(pe)?n:n.querySelector("["+pe+"]")||n:null}function Z(n,e,t){return t===void 0&&(t=!0),n.filter(r=>{var s;return r.parentId===e&&(!t||((s=r.context)==null?void 0:s.open))}).flatMap(r=>[r,...Z(n,r.id,t)])}function Kt(n){return"nativeEvent"in n}var Bt=typeof document<"u",Ut=function(){},V=Bt?p.useLayoutEffect:Ut;const Vt={...we},Wt=Vt.useInsertionEffect,Ht=Wt||(n=>n());function W(n){const e=p.useRef(()=>{});return Ht(()=>{e.current=n}),p.useCallback(function(){for(var t=arguments.length,o=new Array(t),r=0;r<t;r++)o[r]=arguments[r];return e.current==null?void 0:e.current(...o)},[])}const Me=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Oe(n,e){const t=De(n,Me()),o=t.length;if(o===0)return;const r=_t(z(n)),s=t.indexOf(r),i=s===-1?e===1?0:o-1:s+e;return t[i]}function Xt(n){return Oe(z(n).body,1)||n}function Yt(n){return Oe(z(n).body,-1)||n}function re(n,e){const t=e||n.currentTarget,o=n.relatedTarget;return!o||!ce(t,o)}function Gt(n){De(n,Me()).forEach(t=>{t.dataset.tabindex=t.getAttribute("tabindex")||"",t.setAttribute("tabindex","-1")})}function ve(n){n.querySelectorAll("[data-tabindex]").forEach(t=>{const o=t.dataset.tabindex;delete t.dataset.tabindex,o?t.setAttribute("tabindex",o):t.removeAttribute("tabindex")})}const Qt="data-floating-ui-focusable",he="active",be="selected",zt={...we};let xe=!1,Zt=0;const ye=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Zt++;function Jt(){const[n,e]=p.useState(()=>xe?ye():void 0);return V(()=>{n==null&&e(ye())},[]),p.useEffect(()=>{xe=!0},[]),n}const en=zt.useId,ue=en||Jt;function tn(){const n=new Map;return{emit(e,t){var o;(o=n.get(e))==null||o.forEach(r=>r(t))},on(e,t){n.has(e)||n.set(e,new Set),n.get(e).add(t)},off(e,t){var o;(o=n.get(e))==null||o.delete(t)}}}const nn=p.createContext(null),on=p.createContext(null),Fe=()=>{var n;return((n=p.useContext(nn))==null?void 0:n.id)||null},qe=()=>p.useContext(on);function de(n){return"data-floating-ui-"+n}const rn={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},Re=p.forwardRef(function(e,t){const[o,r]=p.useState();V(()=>{kt()&&r("button")},[]);const s={ref:t,tabIndex:0,role:o,"aria-hidden":o?void 0:!0,[de("focus-guard")]:"",style:rn};return I.jsx("span",{...e,...s})}),sn={clipPath:"inset(50%)",position:"fixed",top:0,left:0},$e=p.createContext(null),Se=de("portal");function an(n){n===void 0&&(n={});const{id:e,root:t}=n,o=ue(),r=cn(),[s,i]=p.useState(null),a=p.useRef(null);return V(()=>()=>{s?.remove(),queueMicrotask(()=>{a.current=null})},[s]),V(()=>{if(!o||a.current)return;const l=e?document.getElementById(e):null;if(!l)return;const c=document.createElement("div");c.id=o,c.setAttribute(Se,""),l.appendChild(c),a.current=c,i(c)},[e,o]),V(()=>{if(t===null||!o||a.current)return;let l=t||r?.portalNode;l&&!it(l)&&(l=l.current),l=l||document.body;let c=null;e&&(c=document.createElement("div"),c.id=e,l.appendChild(c));const d=document.createElement("div");d.id=o,d.setAttribute(Se,""),l=c||l,l.appendChild(d),a.current=d,i(d)},[e,t,o,r]),s}function ln(n){const{children:e,id:t,root:o,preserveTabOrder:r=!0}=n,s=an({id:t,root:o}),[i,a]=p.useState(null),l=p.useRef(null),c=p.useRef(null),d=p.useRef(null),u=p.useRef(null),g=i?.modal,h=i?.open,y=!!i&&!i.modal&&i.open&&r&&!!(o||s);return p.useEffect(()=>{if(!s||!r||g)return;function m(f){s&&re(f)&&(f.type==="focusin"?ve:Gt)(s)}return s.addEventListener("focusin",m,!0),s.addEventListener("focusout",m,!0),()=>{s.removeEventListener("focusin",m,!0),s.removeEventListener("focusout",m,!0)}},[s,r,g]),p.useEffect(()=>{s&&(h||ve(s))},[h,s]),I.jsxs($e.Provider,{value:p.useMemo(()=>({preserveTabOrder:r,beforeOutsideRef:l,afterOutsideRef:c,beforeInsideRef:d,afterInsideRef:u,portalNode:s,setFocusManagerState:a}),[r,s]),children:[y&&s&&I.jsx(Re,{"data-type":"outside",ref:l,onFocus:m=>{if(re(m,s)){var f;(f=d.current)==null||f.focus()}else{const x=i?i.domReference:null,b=Yt(x);b?.focus()}}}),y&&s&&I.jsx("span",{"aria-owns":s.id,style:sn}),s&&tt.createPortal(e,s),y&&s&&I.jsx(Re,{"data-type":"outside",ref:c,onFocus:m=>{if(re(m,s)){var f;(f=u.current)==null||f.focus()}else{const x=i?i.domReference:null,b=Xt(x);b?.focus(),i?.closeOnFocusOut&&i?.onOpenChange(!1,m.nativeEvent,"focus-out")}}})]})}const cn=()=>p.useContext($e),un={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},dn={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Ee=n=>{var e,t;return{escapeKey:typeof n=="boolean"?n:(e=n?.escapeKey)!=null?e:!1,outsidePress:typeof n=="boolean"?n:(t=n?.outsidePress)!=null?t:!0}};function fn(n,e){e===void 0&&(e={});const{open:t,onOpenChange:o,elements:r,dataRef:s}=n,{enabled:i=!0,escapeKey:a=!0,outsidePress:l=!0,outsidePressEvent:c="pointerdown",referencePress:d=!1,referencePressEvent:u="pointerdown",ancestorScroll:g=!1,bubbles:h,capture:y}=e,m=qe(),f=W(typeof l=="function"?l:()=>!1),x=typeof l=="function"?f:l,b=p.useRef(!1),{escapeKey:R,outsidePress:v}=Ee(h),{escapeKey:D,outsidePress:C}=Ee(y),O=p.useRef(!1),A=W(S=>{var E;if(!t||!i||!a||S.key!=="Escape"||O.current)return;const P=(E=s.current.floatingContext)==null?void 0:E.nodeId,M=m?Z(m.nodesRef.current,P):[];if(!R&&(S.stopPropagation(),M.length>0)){let w=!0;if(M.forEach(N=>{var q;if((q=N.context)!=null&&q.open&&!N.context.dataRef.current.__escapeKeyBubbles){w=!1;return}}),!w)return}o(!1,Kt(S)?S.nativeEvent:S,"escape-key")}),F=W(S=>{var E;const P=()=>{var M;A(S),(M=G(S))==null||M.removeEventListener("keydown",P)};(E=G(S))==null||E.addEventListener("keydown",P)}),T=W(S=>{var E;const P=s.current.insideReactTree;s.current.insideReactTree=!1;const M=b.current;if(b.current=!1,c==="click"&&M||P||typeof x=="function"&&!x(S))return;const w=G(S),N="["+de("inert")+"]",q=z(r.floating).querySelectorAll(N);let L=j(w)?w:null;for(;L&&!ne(L);){const k=ot(L);if(ne(k)||!j(k))break;L=k}if(q.length&&j(w)&&!Lt(w)&&!ce(w,r.floating)&&Array.from(q).every(k=>!ce(L,k)))return;if(rt(w)&&K){const k=ne(w),B=st(w),Y=/auto|scroll/,Ke=k||Y.test(B.overflowX),Be=k||Y.test(B.overflowY),Ue=Ke&&w.clientWidth>0&&w.scrollWidth>w.clientWidth,Ve=Be&&w.clientHeight>0&&w.scrollHeight>w.clientHeight,We=B.direction==="rtl",He=Ve&&(We?S.offsetX<=w.offsetWidth-w.clientWidth:S.offsetX>w.clientWidth),Xe=Ue&&S.offsetY>w.clientHeight;if(He||Xe)return}const U=(E=s.current.floatingContext)==null?void 0:E.nodeId,X=m&&Z(m.nodesRef.current,U).some(k=>{var B;return oe(S,(B=k.context)==null?void 0:B.elements.floating)});if(oe(S,r.floating)||oe(S,r.domReference)||X)return;const fe=m?Z(m.nodesRef.current,U):[];if(fe.length>0){let k=!0;if(fe.forEach(B=>{var Y;if((Y=B.context)!=null&&Y.open&&!B.context.dataRef.current.__outsidePressBubbles){k=!1;return}}),!k)return}o(!1,S,"outside-press")}),$=W(S=>{var E;const P=()=>{var M;T(S),(M=G(S))==null||M.removeEventListener(c,P)};(E=G(S))==null||E.addEventListener(c,P)});p.useEffect(()=>{if(!t||!i)return;s.current.__escapeKeyBubbles=R,s.current.__outsidePressBubbles=v;let S=-1;function E(q){o(!1,q,"ancestor-scroll")}function P(){window.clearTimeout(S),O.current=!0}function M(){S=window.setTimeout(()=>{O.current=!1},nt()?5:0)}const w=z(r.floating);a&&(w.addEventListener("keydown",D?F:A,D),w.addEventListener("compositionstart",P),w.addEventListener("compositionend",M)),x&&w.addEventListener(c,C?$:T,C);let N=[];return g&&(j(r.domReference)&&(N=te(r.domReference)),j(r.floating)&&(N=N.concat(te(r.floating))),!j(r.reference)&&r.reference&&r.reference.contextElement&&(N=N.concat(te(r.reference.contextElement)))),N=N.filter(q=>{var L;return q!==((L=w.defaultView)==null?void 0:L.visualViewport)}),N.forEach(q=>{q.addEventListener("scroll",E,{passive:!0})}),()=>{a&&(w.removeEventListener("keydown",D?F:A,D),w.removeEventListener("compositionstart",P),w.removeEventListener("compositionend",M)),x&&w.removeEventListener(c,C?$:T,C),N.forEach(q=>{q.removeEventListener("scroll",E)}),window.clearTimeout(S)}},[s,r,a,x,c,t,o,g,i,R,v,A,D,F,T,C,$]),p.useEffect(()=>{s.current.insideReactTree=!1},[s,x,c]);const _=p.useMemo(()=>({onKeyDown:A,...d&&{[un[u]]:S=>{o(!1,S.nativeEvent,"reference-press")},...u!=="click"&&{onClick(S){o(!1,S.nativeEvent,"reference-press")}}}}),[A,o,d,u]),K=p.useMemo(()=>{function S(E){E.button===0&&(b.current=!0)}return{onKeyDown:A,onMouseDown:S,onMouseUp:S,[dn[c]]:()=>{s.current.insideReactTree=!0}}},[A,c,s]);return p.useMemo(()=>i?{reference:_,floating:K}:{},[i,_,K])}function gn(n){const{open:e=!1,onOpenChange:t,elements:o}=n,r=ue(),s=p.useRef({}),[i]=p.useState(()=>tn()),a=Fe()!=null,[l,c]=p.useState(o.reference),d=W((h,y,m)=>{s.current.openEvent=h?y:void 0,i.emit("openchange",{open:h,event:y,reason:m,nested:a}),t?.(h,y,m)}),u=p.useMemo(()=>({setPositionReference:c}),[]),g=p.useMemo(()=>({reference:l||o.reference||null,floating:o.floating||null,domReference:o.reference}),[l,o.reference,o.floating]);return p.useMemo(()=>({dataRef:s,open:e,onOpenChange:d,elements:g,events:i,floatingId:r,refs:u}),[e,d,g,i,r,u])}function mn(n){n===void 0&&(n={});const{nodeId:e}=n,t=gn({...n,elements:{reference:null,floating:null,...n.elements}}),o=n.rootContext||t,r=o.elements,[s,i]=p.useState(null),[a,l]=p.useState(null),d=r?.domReference||s,u=p.useRef(null),g=qe();V(()=>{d&&(u.current=d)},[d]);const h=et({...n,elements:{...r,...a&&{reference:a}}}),y=p.useCallback(R=>{const v=j(R)?{getBoundingClientRect:()=>R.getBoundingClientRect(),getClientRects:()=>R.getClientRects(),contextElement:R}:R;l(v),h.refs.setReference(v)},[h.refs]),m=p.useCallback(R=>{(j(R)||R===null)&&(u.current=R,i(R)),(j(h.refs.reference.current)||h.refs.reference.current===null||R!==null&&!j(R))&&h.refs.setReference(R)},[h.refs]),f=p.useMemo(()=>({...h.refs,setReference:m,setPositionReference:y,domReference:u}),[h.refs,m,y]),x=p.useMemo(()=>({...h.elements,domReference:d}),[h.elements,d]),b=p.useMemo(()=>({...h,...o,refs:f,elements:x,nodeId:e}),[h,f,x,e,o]);return V(()=>{o.dataRef.current.floatingContext=b;const R=g?.nodesRef.current.find(v=>v.id===e);R&&(R.context=b)}),p.useMemo(()=>({...h,context:b,refs:f,elements:x}),[h,f,x,b])}function se(n,e,t){const o=new Map,r=t==="item";let s=n;if(r&&n){const{[he]:i,[be]:a,...l}=n;s=l}return{...t==="floating"&&{tabIndex:-1,[Qt]:""},...s,...e.map(i=>{const a=i?i[t]:null;return typeof a=="function"?n?a(n):null:a}).concat(n).reduce((i,a)=>(a&&Object.entries(a).forEach(l=>{let[c,d]=l;if(!(r&&[he,be].includes(c)))if(c.indexOf("on")===0){if(o.has(c)||o.set(c,[]),typeof d=="function"){var u;(u=o.get(c))==null||u.push(d),i[c]=function(){for(var g,h=arguments.length,y=new Array(h),m=0;m<h;m++)y[m]=arguments[m];return(g=o.get(c))==null?void 0:g.map(f=>f(...y)).find(f=>f!==void 0)}}}else i[c]=d}),i),{})}}function pn(n){n===void 0&&(n=[]);const e=n.map(a=>a?.reference),t=n.map(a=>a?.floating),o=n.map(a=>a?.item),r=p.useCallback(a=>se(a,n,"reference"),e),s=p.useCallback(a=>se(a,n,"floating"),t),i=p.useCallback(a=>se(a,n,"item"),o);return p.useMemo(()=>({getReferenceProps:r,getFloatingProps:s,getItemProps:i}),[r,s,i])}const vn=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function hn(n,e){var t,o;e===void 0&&(e={});const{open:r,elements:s,floatingId:i}=n,{enabled:a=!0,role:l="dialog"}=e,c=ue(),d=((t=s.domReference)==null?void 0:t.id)||c,u=p.useMemo(()=>{var b;return((b=jt(s.floating))==null?void 0:b.id)||i},[s.floating,i]),g=(o=vn.get(l))!=null?o:l,y=Fe()!=null,m=p.useMemo(()=>g==="tooltip"||l==="label"?{["aria-"+(l==="label"?"labelledby":"describedby")]:r?u:void 0}:{"aria-expanded":r?"true":"false","aria-haspopup":g==="alertdialog"?"dialog":g,"aria-controls":r?u:void 0,...g==="listbox"&&{role:"combobox"},...g==="menu"&&{id:d},...g==="menu"&&y&&{role:"menuitem"},...l==="select"&&{"aria-autocomplete":"none"},...l==="combobox"&&{"aria-autocomplete":"list"}},[g,u,y,r,d,l]),f=p.useMemo(()=>{const b={id:u,...g&&{role:g}};return g==="tooltip"||l==="label"?b:{...b,...g==="menu"&&{"aria-labelledby":d}}},[g,u,d,l]),x=p.useCallback(b=>{let{active:R,selected:v}=b;const D={role:"option",...R&&{id:u+"-fui-option"}};switch(l){case"select":case"combobox":return{...D,"aria-selected":v}}return{}},[u,l]);return p.useMemo(()=>a?{reference:m,floating:f,item:x}:{},[a,m,f,x])}function bn(n){var e;const{char:t,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:s,startOfLine:i,$position:a}=n,l=o&&!r,c=Ze(t),d=new RegExp(`\\s${c}$`),u=i?"^":"",g=r?"":c,h=l?new RegExp(`${u}${c}.*?(?=\\s${g}|$)`,"gm"):new RegExp(`${u}(?:^)?${c}[^\\s${g}]*`,"gm"),y=((e=a.nodeBefore)===null||e===void 0?void 0:e.isText)&&a.nodeBefore.text;if(!y)return null;const m=a.pos-y.length,f=Array.from(y.matchAll(h)).pop();if(!f||f.input===void 0||f.index===void 0)return null;const x=f.input.slice(Math.max(0,f.index-1),f.index),b=new RegExp(`^[${s?.join("")}\0]?$`).test(x);if(s!==null&&!b)return null;const R=m+f.index;let v=R+f[0].length;return l&&d.test(y.slice(v-1,v+1))&&(f[0]+=" ",v+=1),R<a.pos&&v>=a.pos?{range:{from:R,to:v},query:f[0].slice(t.length),text:f[0]}:null}function xn(n){return n.docChanged?n.steps.some(e=>{const t=e.slice;if(!t?.content)return!1;const o=t.content.textBetween(0,t.content.size,`
|
|
2
2
|
`);return/\s/.test(o)}):!1}function yn(n){return()=>{const e=n.state.selection.$anchor.pos,{top:t,right:o,bottom:r,left:s}=n.view.coordsAtPos(e);try{return new DOMRect(s,t,o-s,r-t)}catch{return null}}}function Rn(n,e,t,o){return t?()=>{const r=o.getState(n.state),s=r?.decorationId,i=e.dom.querySelector(`[data-decoration-id="${s}"]`);return i?.getBoundingClientRect()||null}:yn(n)}function Sn({match:n,dismissedRange:e,state:t,transaction:o,editor:r,shouldResetDismissed:s,effectiveAllowSpaces:i}){return s?.({editor:r,state:t,range:e,match:n,transaction:o,allowSpaces:i})?!1:i?n.range.from===e.from:n.range.from===e.from&&!xn(o)}function En({view:n,pluginKeyRef:e}){const t=n.state.tr.setMeta(e,{exit:!0});n.dispatch(t)}function wn({pluginKey:n,decorationTag:e,decorationClass:t,decorationContent:o,decorationEmptyClass:r,renderer:s,dispatchExit:i}){return{handleKeyDown(a,l){var c;const d=n.getState(a.state);if(!d.active)return!1;if(l.key==="Escape"||l.key==="Esc"){var u;return s==null||(u=s.onKeyDown)===null||u===void 0||u.call(s,{view:a,event:l,range:d.range}),i(a),!0}return(s==null||(c=s.onKeyDown)===null||c===void 0?void 0:c.call(s,{view:a,event:l,range:d.range}))||!1},decorations(a){const{active:l,range:c,decorationId:d,query:u}=n.getState(a);if(!l)return null;const g=!u?.length,h=[t];return g&&h.push(r),Qe.create(a.doc,[ze.inline(c.from,c.to,{nodeName:e,class:h.join(" "),"data-decoration-id":d||void 0,"data-decoration-content":o})])}}}function Cn({editor:n,char:e,effectiveAllowSpaces:t,allowToIncludeChar:o,allowedPrefixes:r,startOfLine:s,findSuggestionMatch:i,allow:a,shouldShow:l,shouldKeepDismissed:c,pluginKey:d}){return{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}},apply(u,g,h,y){const{isEditable:m}=n,{composing:f}=n.view,{selection:x}=u,{empty:b,from:R}=x,v={...g},D=u.getMeta(d);if(D&&D.exit)return v.active=!1,v.decorationId=null,v.range={from:0,to:0},v.query=null,v.text=null,v.dismissedRange=g.active?{...g.range}:g.dismissedRange,v;if(v.composing=f,u.docChanged&&v.dismissedRange!==null&&(v.dismissedRange={from:u.mapping.map(v.dismissedRange.from),to:u.mapping.map(v.dismissedRange.to)}),m&&(b||n.view.composing)){(R<g.range.from||R>g.range.to)&&!f&&!g.composing&&(v.active=!1);const C=i({char:e,allowSpaces:t,allowToIncludeChar:o,allowedPrefixes:r,startOfLine:s,$position:x.$from}),O=`id_${Math.floor(Math.random()*4294967295)}`;C&&a({editor:n,state:y,range:C.range,isActive:g.active})&&(!l||l({editor:n,range:C.range,query:C.query,text:C.text,transaction:u}))?(v.dismissedRange!==null&&!c({match:C,dismissedRange:v.dismissedRange,state:y,transaction:u})&&(v.dismissedRange=null),v.dismissedRange===null?(v.active=!0,v.decorationId=g.decorationId||O,v.range=C.range,v.query=C.query,v.text=C.text):v.active=!1):(C||(v.dismissedRange=null),v.active=!1)}else v.active=!1;return v.active||(v.decorationId=null,v.range={from:0,to:0},v.query=null,v.text=null),v}}}function In({editor:n,items:e}){let t=null,o=null,r=null;const s=()=>{o!==null&&(clearTimeout(o),o=null),r?.(),r=null},i=c=>new Promise(d=>{r=d,o=setTimeout(()=>{o=null;const u=r;r=null,u?.()},c)}),a=()=>{t?.abort(),s(),t=null};return{abort:a,fetch:async(c,d)=>{a(),t=new AbortController;const u=t;if(d>0&&await i(d),t!==u||u.signal.aborted)return{status:"aborted"};try{const g=await e({editor:n,query:c,signal:u.signal});return t!==u||u.signal.aborted?{status:"aborted"}:{status:"resolved",items:g}}catch{return t!==u||u.signal.aborted?{status:"aborted"}:{status:"error"}}}}}function Tn({placement:n,offset:e,flip:t,floatingUi:o}){var r,s,i,a;const l=[at({mainAxis:(r=e.mainAxis)!==null&&r!==void 0?r:4,crossAxis:(s=e.crossAxis)!==null&&s!==void 0?s:0})];return t&&l.push(lt()),!(o==null||(i=o.middleware)===null||i===void 0)&&i.length&&l.push(...o.middleware),{placement:n,strategy:(a=o?.strategy)!==null&&a!==void 0?a:"absolute",middleware:l}}function Pn(n){if(n instanceof HTMLElement)return n;if(typeof n=="string")try{const e=document.querySelector(n);if(e)return e}catch{return document.body}return document.body}function An({getReferenceRect:n,contextElement:e,config:t,container:o,dismissOnOutsideClick:r,dismiss:s}){return(i,a={})=>{const l={getBoundingClientRect:()=>{var y;return(y=n())!==null&&y!==void 0?y:new DOMRect},contextElement:e};let c=!1;const d=!i.isConnected;d&&Pn(o).appendChild(i),a.onPosition||(i.style.visibility="hidden",i.style.width="max-content");const g=Ce(l,i,()=>{ct(l,i,{placement:t.placement,strategy:t.strategy,middleware:t.middleware}).then(({x:y,y:m,placement:f,strategy:x})=>{if(a.onPosition){a.onPosition({x:y,y:m,placement:f,strategy:x});return}Object.assign(i.style,{position:x,left:`${y}px`,top:`${m}px`}),c||(c=!0,i.style.visibility="")})},a.autoUpdate);let h;return r&&(h=y=>{const m=y.target;!(m instanceof Node)||i.contains(m)||e.contains(m)||s()},document.addEventListener("pointerdown",h,!0)),()=>{g(),h&&document.removeEventListener("pointerdown",h,!0),d&&i.remove()}}}function Nn({editor:n,pluginKey:e,items:t,renderer:o,minQueryLength:r,debounce:s,initialItems:i,placement:a,offset:l,container:c,flip:d,floatingUi:u,dismissOnOutsideClick:g,command:h,clientRectFor:y,dispatchExit:m}){let f;const x=In({editor:n,items:t}),b=Tn({placement:a,offset:l,flip:d,floatingUi:u});function R(v,D){switch(v){case"started":var C;o==null||(C=o.onStart)===null||C===void 0||C.call(o,D);break;case"updated":var O;o==null||(O=o.onUpdate)===null||O===void 0||O.call(o,D);break;case"stopped":var A;o==null||(A=o.onExit)===null||A===void 0||A.call(o,D)}}return{update:async(v,D)=>{var C,O;const A=e.getState(D),F=e.getState(v.state);if(!A||!F)return;let T=null;const $=A.query!==F.query,_=A.text!==F.text,K=A.range.from!==F.range.from||A.range.to!==F.range.to,S=$||_||K;if(!A.active&&F.active)T="started";else if(A.active&&!F.active)T="stopped";else if(F.active&&S)T="updated";else return;const E=T==="stopped"?A:F,P=v.dom.querySelector(`[data-decoration-id="${E.decorationId}"]`),M=y(v,P),w=r===0||(E.query?E.query.length>=r:!1),N=(T==="started"||T==="updated")&&w;if(f={editor:n,range:E.range,query:E.query||"",text:E.text||"",items:i??[],command:U=>h({editor:n,range:E.range,props:U}),decorationNode:P,clientRect:M,loading:N,placement:a,offset:{mainAxis:(C=l.mainAxis)!==null&&C!==void 0?C:4,crossAxis:(O=l.crossAxis)!==null&&O!==void 0?O:0},container:c,flip:d,floatingUi:b,mount:An({getReferenceRect:M,contextElement:v.dom,config:b,container:c,dismissOnOutsideClick:g,dismiss:()=>m(n.view)})},T==="started"){var q;o==null||(q=o.onBeforeStart)===null||q===void 0||q.call(o,f)}if(T==="updated"){var L;o==null||(L=o.onBeforeUpdate)===null||L===void 0||L.call(o,f)}if(T==="started"&&R(T,f),T==="started"||T==="updated")if(!N)x.abort(),f={...f,items:i??[],loading:!1};else{f={...f,items:i??[],loading:!0},T="updated",R(T,f);const U=await x.fetch(E.query||"",s);if(U.status==="aborted")return;const X=e.getState(v.state);if(!X?.active){x.abort();return}f=U.status==="resolved"?{...f,items:U.items,loading:!1}:{...f,loading:!1}}if(T==="stopped"){x.abort(),R(T,f),f=void 0;return}T==="updated"&&R(T,f)},destroy:()=>{var v;x.abort(),f&&(o==null||(v=o.onExit)===null||v===void 0||v.call(o,f))}}}const ke=new ie("suggestion");function _e({pluginKey:n=ke,editor:e,char:t="@",allowSpaces:o=!1,allowToIncludeChar:r=!1,allowedPrefixes:s=[" "],startOfLine:i=!1,decorationTag:a="span",decorationClass:l="suggestion",decorationContent:c="",decorationEmptyClass:d="is-empty",command:u=()=>null,items:g=()=>[],minQueryLength:h=0,debounce:y=0,initialItems:m,placement:f="bottom-start",offset:x={},container:b,flip:R=!0,floatingUi:v,dismissOnOutsideClick:D=!0,render:C=()=>({}),allow:O=()=>!0,findSuggestionMatch:A=bn,shouldShow:F,shouldResetDismissed:T}){const $=C?.(),_=o&&!r,K=(P,M)=>Rn(e,P,M,n);function S(P){return Sn({...P,editor:e,shouldResetDismissed:T,effectiveAllowSpaces:_})}const E=P=>En({view:P,pluginKeyRef:n});return new Ge({key:n,view:()=>Nn({editor:e,pluginKey:n,items:g,renderer:$,minQueryLength:h,debounce:y,initialItems:m,placement:f,offset:x,container:b,flip:R,floatingUi:v,dismissOnOutsideClick:D,command:u,clientRectFor:K,dispatchExit:E}),state:Cn({editor:e,char:t,effectiveAllowSpaces:_,allowToIncludeChar:r,allowedPrefixes:s,startOfLine:i,findSuggestionMatch:A,allow:O,shouldShow:F,shouldKeepDismissed:S,pluginKey:n}),props:wn({pluginKey:n,decorationTag:a,decorationClass:l,decorationContent:c,decorationEmptyClass:d,renderer:$,dispatchExit:E})})}function Xn(n,e=ke){const t=n.state.tr.setMeta(e,{exit:!0});n.dispatch(t)}var Yn=_e;function Dn(n){const e=H.c(17),{editor:t,query:o,items:r,onSelect:s,onClose:i}=n,[a,l]=p.useState(0),c=p.useRef(r),d=p.useRef(a),u=p.useRef(s),g=p.useRef(i),h=p.useDeferredValue(o),[y,m]=p.useState(h);y!==h&&(m(h),l(0)),a>=r.length&&r.length>0&&l(0);let f,x;e[0]!==r?(f=()=>{c.current=r},x=[r],e[0]=r,e[1]=f,e[2]=x):(f=e[1],x=e[2]),p.useEffect(f,x);let b,R;e[3]!==a?(b=()=>{d.current=a},R=[a],e[3]=a,e[4]=b,e[5]=R):(b=e[4],R=e[5]),p.useEffect(b,R);let v,D;e[6]!==s?(v=()=>{u.current=s},D=[s],e[6]=s,e[7]=v,e[8]=D):(v=e[7],D=e[8]),p.useEffect(v,D);let C,O;e[9]!==i?(C=()=>{g.current=i},O=[i],e[9]=i,e[10]=C,e[11]=O):(C=e[10],O=e[11]),p.useEffect(C,O);let A,F;e[12]!==t?(F=()=>{if(t?.isDestroyed)return;let _;try{_=t.view.dom}catch{return}if(!_)return;const K=E=>{const P=c.current;if(!P.length)return!1;const M=()=>l(N=>(N+1)%P.length),w=()=>l(N=>(N-1+P.length)%P.length);switch(E.key){case"ArrowUp":return E.preventDefault(),w(),!0;case"ArrowDown":return E.preventDefault(),M(),!0;case"Tab":return E.preventDefault(),E.shiftKey?w():M(),!0;case"Home":return E.preventDefault(),l(0),!0;case"End":return E.preventDefault(),l(P.length-1),!0;case"Enter":{if(E.isComposing)return!1;E.preventDefault();const N=d.current;return N!==-1&&P[N]&&u.current?.(P[N],N),!0}case"Escape":return E.preventDefault(),g.current?.(),!0;default:return!1}},S=E=>{K(E)};return _.addEventListener("keydown",S,!0),()=>{_?.removeEventListener("keydown",S,!0)}},A=[t],e[12]=t,e[13]=A,e[14]=F):(A=e[13],F=e[14]),p.useEffect(F,A);const T=r.length?a:void 0;let $;return e[15]!==T?($={selectedIndex:T,setSelectedIndex:l},e[15]=T,e[16]=$):$=e[16],$}function Mn(n,e){switch(e.type){case"SET_SELECTED_ITEM":return{...n,selectedItem:e.payload};case"ON_START":return{...n,open:!0,selectedItem:null,element:e.payload.element,query:e.payload.query,range:e.payload.range};case"ON_UPDATE":return{...n,element:e.payload.element,query:e.payload.query,range:e.payload.range};case"ON_EXIT":return{open:!1,element:null,query:"",range:null,selectedItem:null};default:return n}}const Le=p.createContext(void 0);function je(){const n=p.useContext(Le);if(!n)throw new Error("useSuggestionContext must be used within a SuggestionContext.Provider");return n}function On(n){const e=H.c(16),{editor:t,char:o,pluginKey:r,allow:s,onOpenChange:i}=n;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={open:!1,element:null,query:"",range:null,selectedItem:null},e[0]=a):a=e[0];const[l,c]=p.useReducer(Mn,a);let d;e[1]!==i?(d=m=>{i?.(m)},e[1]=i,e[2]=d):d=e[2];const u=p.useEffectEvent(d);let g;e[3]!==o||e[4]!==s||e[5]!==t||e[6]!==u||e[7]!==r?(g=()=>{if(t?.isDestroyed)return;const m=r instanceof ie?r:new ie(r);t.state.plugins.find(b=>b.spec.key===m)&&t.unregisterPlugin(m);const x=_e({pluginKey:m,editor:t,char:o,allow(b){const R=t.state.doc.resolve(b.range.from);for(let v=R.depth;v>0;v--)if(R.node(v).type.name==="image")return!1;return!(s&&!s(b))},command(){},render:()=>({onStart:b=>{c({type:"ON_START",payload:{element:b.decorationNode??null,query:b.query,range:b.range}}),u(!0)},onUpdate:b=>{c({type:"ON_UPDATE",payload:{element:b.decorationNode??null,query:b.query,range:b.range}})},onKeyDown:b=>b.event.key==="Escape"?(c({type:"ON_EXIT"}),!0):!1,onExit:()=>{c({type:"ON_EXIT"}),u(!1)}}),items:Fn});return t.registerPlugin(x),()=>{t?.isDestroyed||t.unregisterPlugin(m)}},e[3]=o,e[4]=s,e[5]=t,e[6]=u,e[7]=r,e[8]=g):g=e[8];let h;e[9]!==o||e[10]!==s||e[11]!==t||e[12]!==r?(h=[t,r,o,c,s],e[9]=o,e[10]=s,e[11]=t,e[12]=r,e[13]=h):h=e[13],p.useEffect(g,h);let y;return e[14]!==l?(y={state:l,dispatch:c},e[14]=l,e[15]=y):y=e[15],y}function Fn(){return[]}function qn({editor:n,queryKey:e,queryFn:t,onSelect:o}){const{state:r,dispatch:s}=je(),i=p.useDeferredValue(r.query),{data:a}=ut({queryKey:dt.suggestionItems(e,r.open,i),queryFn:()=>r.open?t({query:i}):[]}),l=()=>{s({type:"ON_EXIT"})},c=async(u,g)=>{if(!(r.selectedItem!==null||!r.range)){s({type:"SET_SELECTED_ITEM",payload:u});try{const{view:h}=n,m=h.state.selection.$to.nodeAfter?.text?.startsWith(" "),f=r.range?{...r.range}:{from:0,to:0};m&&r.range&&(f.to+=1),await o({range:f,item:u})===!1?s({type:"SET_SELECTED_ITEM",payload:null}):l()}catch{l()}}},{selectedIndex:d}=Dn({editor:n,query:i,items:a,onSelect:c,onClose:l});return{selectedItem:r.selectedItem,items:a,selectedIndex:d,close:l,onSelect:c}}function $n({children:n}){const{state:e,dispatch:t}=je(),{open:o,element:r}=e,s=()=>{t({type:"ON_EXIT"})},{refs:i,floatingStyles:a,context:l}=mn({placement:"bottom-start",open:o,onOpenChange:g=>{g||s()},elements:{reference:r},middleware:[ft(10),gt(),mt()],whileElementsMounted:Ce}),c=fn(l,{outsidePress:g=>!(g.target instanceof Element&&g.target.closest(".ProseMirror"))}),d=hn(l,{role:"listbox"}),{getFloatingProps:u}=pn([c,d]);return o?I.jsx(ln,{children:I.jsx("div",{ref:i.setFloating,style:a,...u(),className:"z-50 w-auto min-w-[360px] max-w-[520px] rounded-lg border bg-popover p-0 text-popover-foreground shadow-md outline-hidden overflow-hidden",children:n})}):null}const kn=n=>{const e=H.c(17),{item:t,isSelected:o,onSelect:r,isLoading:s,ref:i,renderItem:a}=n;let l;if(e[0]!==t){const x=bt(t._meta);l=t.title||xt(t.name,x),e[0]=t,e[1]=l}else l=e[1];const c=l,d=t.description||null,u=t.icon,g=o&&"bg-accent text-accent-foreground",h=s&&"pointer-events-none opacity-50";let y;e[2]!==g||e[3]!==h?(y=vt("relative flex w-full cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors","hover:bg-accent hover:text-accent-foreground","focus:bg-accent focus:text-accent-foreground",g,h),e[2]=g,e[3]=h,e[4]=y):y=e[4];let m;e[5]!==d||e[6]!==u||e[7]!==s||e[8]!==t||e[9]!==c||e[10]!==a?(m=a?a(t):I.jsxs(I.Fragment,{children:[u!==void 0&&I.jsx(yt,{icon:u,name:c,size:"xs",className:"mr-2"}),I.jsxs("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[I.jsxs("div",{className:"flex items-center justify-between gap-2",children:[I.jsx("span",{className:"font-medium flex items-center truncate capitalize",children:c}),s&&I.jsx(ht,{size:"xs"})]}),d&&I.jsx("div",{className:"text-xs text-muted-foreground line-clamp-1",children:d})]}),t.drillable&&I.jsx("kbd",{className:"shrink-0 ml-2 px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground bg-muted border border-border rounded",children:"↵"})]}),e[5]=d,e[6]=u,e[7]=s,e[8]=t,e[9]=c,e[10]=a,e[11]=m):m=e[11];let f;return e[12]!==r||e[13]!==i||e[14]!==y||e[15]!==m?(f=I.jsx("div",{ref:i,onClick:r,className:y,children:m}),e[12]=r,e[13]=i,e[14]=y,e[15]=m,e[16]=f):f=e[16],f},_n=n=>{const e=H.c(24),{editor:t,queryKey:o,queryFn:r,onSelect:s,renderItem:i,emptyLabel:a}=n,l=pt();let c;e[0]!==t||e[1]!==s||e[2]!==r||e[3]!==o?(c={editor:t,queryKey:o,queryFn:r,onSelect:s},e[0]=t,e[1]=s,e[2]=r,e[3]=o,e[4]=c):c=e[4];const{items:d,selectedIndex:u,onSelect:g,selectedItem:h}=qn(c);if(!d.length){let x;e[5]!==a||e[6]!==l?(x=a??l("chat.mention.noItemsFound"),e[5]=a,e[6]=l,e[7]=x):x=e[7];let b;return e[8]!==x?(b=I.jsx("div",{className:"min-w-[360px] max-w-[520px] bg-popover text-popover-foreground rounded-md border shadow-md p-3 text-sm",children:x}),e[8]=x,e[9]=b):b=e[9],b}let y;e[10]===Symbol.for("react.memo_cache_sentinel")?(y={maxHeight:"min(320px, var(--radix-popover-content-available-height, 320px))"},e[10]=y):y=e[10];let m;if(e[11]!==g||e[12]!==d||e[13]!==i||e[14]!==u||e[15]!==h?.name){let x;e[17]!==g||e[18]!==i||e[19]!==u||e[20]!==h?.name?(x=(b,R)=>I.jsx(kn,{item:b,isSelected:R===u,ref:R===u?Kn:void 0,onSelect:()=>g(b,R),isLoading:h?.name===b.name,renderItem:i},`${b.kind??"item"}:${b.name}`),e[17]=g,e[18]=i,e[19]=u,e[20]=h?.name,e[21]=x):x=e[21],m=d.map(x),e[11]=g,e[12]=d,e[13]=i,e[14]=u,e[15]=h?.name,e[16]=m}else m=e[16];let f;return e[22]!==m?(f=I.jsx("div",{className:"min-w-[360px] max-w-[520px] bg-popover text-popover-foreground rounded-md overflow-y-auto",style:y,children:I.jsx("div",{className:"p-1",children:m})}),e[22]=m,e[23]=f):f=e[23],f};function Ln(){const n=H.c(1);let e;return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=I.jsx("div",{className:"p-1",children:[...Array(3)].map(jn)}),n[0]=e):e=n[0],e}function jn(n,e){return I.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1.5 animate-pulse",children:[I.jsx("div",{className:"h-4 w-24 bg-muted rounded"}),I.jsx("div",{className:"h-3 w-32 bg-muted rounded"})]},e)}function Gn(n){const e=H.c(20),{editor:t,char:o,pluginKey:r,queryKey:s,queryFn:i,onSelect:a,allow:l,onOpenChange:c,renderItem:d,emptyLabel:u}=n;let g;e[0]!==l||e[1]!==o||e[2]!==t||e[3]!==c||e[4]!==r?(g={editor:t,char:o,pluginKey:r,allow:l,onOpenChange:c},e[0]=l,e[1]=o,e[2]=t,e[3]=c,e[4]=r,e[5]=g):g=e[5];const{state:h,dispatch:y}=On(g);let m;e[6]!==y||e[7]!==h?(m={state:h,dispatch:y},e[6]=y,e[7]=h,e[8]=m):m=e[8];let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f=I.jsx(Ln,{}),e[9]=f):f=e[9];let x;e[10]!==t||e[11]!==u||e[12]!==a||e[13]!==i||e[14]!==s||e[15]!==d?(x=I.jsx($n,{children:I.jsx(p.Suspense,{fallback:f,children:I.jsx(_n,{editor:t,queryKey:s,queryFn:i,onSelect:a,renderItem:d,emptyLabel:u})})}),e[10]=t,e[11]=u,e[12]=a,e[13]=i,e[14]=s,e[15]=d,e[16]=x):x=e[16];let b;return e[17]!==m||e[18]!==x?(b=I.jsx(Le.Provider,{value:m,children:x}),e[17]=m,e[18]=x,e[19]=b):b=e[19],b}function Kn(n){n&&n.scrollIntoView({block:"center",behavior:"smooth"})}export{Gn as S,Yn as a,Xn as e,Hn as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,j as i,bC as C,bA as y,bx as B,bD as I,bI as M,bT as A,bP as H,c as z,l as g}from"./index-
|
|
1
|
+
import{r as c,j as i,bC as C,bA as y,bx as B,bD as I,bI as M,bT as A,bP as H,c as z,l as g}from"./index-8f_vFFVa.js";var m="Switch",[U]=H(m),[q,D]=U(m),P=c.forwardRef((a,e)=>{const{__scopeSwitch:t,name:r,checked:s,defaultChecked:n,required:o,disabled:d,value:u="on",onCheckedChange:k,form:l,...w}=a,[p,h]=c.useState(null),v=y(e,b=>h(b)),x=c.useRef(!1),S=p?l||!!p.closest("form"):!0,[f,N]=B({prop:s,defaultProp:n??!1,onChange:k,caller:m});return i.jsxs(q,{scope:t,checked:f,disabled:d,children:[i.jsx(C.button,{type:"button",role:"switch","aria-checked":f,"aria-required":o,"data-state":j(f),"data-disabled":d?"":void 0,disabled:d,value:u,...w,ref:v,onClick:I(a.onClick,b=>{N(T=>!T),S&&(x.current=b.isPropagationStopped(),x.current||b.stopPropagation())})}),S&&i.jsx(_,{control:p,bubbles:!x.current,name:r,value:u,checked:f,required:o,disabled:d,form:l,style:{transform:"translateX(-100%)"}})]})});P.displayName=m;var E="SwitchThumb",R=c.forwardRef((a,e)=>{const{__scopeSwitch:t,...r}=a,s=D(E,t);return i.jsx(C.span,{"data-state":j(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:e})});R.displayName=E;var L="SwitchBubbleInput",_=c.forwardRef(({__scopeSwitch:a,control:e,checked:t,bubbles:r=!0,...s},n)=>{const o=c.useRef(null),d=y(o,n),u=M(t),k=A(e);return c.useEffect(()=>{const l=o.current;if(!l)return;const w=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(w,"checked").set;if(u!==t&&h){const v=new Event("click",{bubbles:r});h.call(l,t),l.dispatchEvent(v)}},[u,t,r]),i.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:t,...s,tabIndex:-1,ref:d,style:{...s.style,...k,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});_.displayName=L;function j(a){return a?"checked":"unchecked"}var O=P,$=R;function W(a){const e=z.c(9);let t,r;e[0]!==a?({className:t,...r}=a,e[0]=a,e[1]=t,e[2]=r):(t=e[1],r=e[2]);let s;e[3]!==t?(s=g("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/20 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[2px] disabled:opacity-50",t),e[3]=t,e[4]=s):s=e[4];let n;e[5]===Symbol.for("react.memo_cache_sentinel")?(n=i.jsx($,{"data-slot":"switch-thumb",className:g("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")}),e[5]=n):n=e[5];let o;return e[6]!==r||e[7]!==s?(o=i.jsx(O,{"data-slot":"switch",className:s,...r,children:n}),e[6]=r,e[7]=s,e[8]=o):o=e[8],o}export{W as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b2 as P,b3 as m}from"./CategoricalChart-
|
|
1
|
+
import{b2 as P,b3 as m}from"./CategoricalChart-C37JtV-R.js";const w=Math.cos,f=Math.sin,c=Math.sqrt,y=Math.PI,h=2*y,v={draw(n,l){const o=c(l/y);n.moveTo(o,0),n.arc(0,0,o,0,h)}},I={draw(n,l){const o=c(l/5)/2;n.moveTo(-3*o,-o),n.lineTo(-o,-o),n.lineTo(-o,-3*o),n.lineTo(o,-3*o),n.lineTo(o,-o),n.lineTo(3*o,-o),n.lineTo(3*o,o),n.lineTo(o,o),n.lineTo(o,3*o),n.lineTo(-o,3*o),n.lineTo(-o,o),n.lineTo(-3*o,o),n.closePath()}},g=c(1/3),k=g*2,W={draw(n,l){const o=c(l/k),a=o*g;n.moveTo(0,-o),n.lineTo(a,0),n.lineTo(0,o),n.lineTo(-a,0),n.closePath()}},$={draw(n,l){const o=c(l),a=-o/2;n.rect(a,a,o,o)}},q=.8908130915292852,p=f(y/10)/f(7*y/10),M=f(h/10)*p,S=-w(h/10)*p,j={draw(n,l){const o=c(l*q),a=M*o,i=S*o;n.moveTo(0,-o),n.lineTo(a,i);for(let s=1;s<5;++s){const t=h*s/5,u=w(t),e=f(t);n.lineTo(e*o,-u*o),n.lineTo(u*a-e*i,e*a+u*i)}n.closePath()}},b=c(3),A={draw(n,l){const o=-c(l/(b*3));n.moveTo(0,o*2),n.lineTo(-b*o,-o),n.lineTo(b*o,-o),n.closePath()}},r=-.5,T=c(3)/2,d=1/c(12),C=(d/2+1)*3,B={draw(n,l){const o=c(l/C),a=o/2,i=o*d,s=a,t=o*d+o,u=-s,e=t;n.moveTo(a,i),n.lineTo(s,t),n.lineTo(u,e),n.lineTo(r*a-T*i,T*a+r*i),n.lineTo(r*s-T*t,T*s+r*t),n.lineTo(r*u-T*e,T*u+r*e),n.lineTo(r*a+T*i,r*i-T*a),n.lineTo(r*s+T*t,r*t-T*s),n.lineTo(r*u+T*e,r*e-T*u),n.closePath()}};function E(n,l){let o=null,a=P(i);n=typeof n=="function"?n:m(n||v),l=typeof l=="function"?l:m(l===void 0?64:+l);function i(){let s;if(o||(o=s=a()),n.apply(this,arguments).draw(o,+l.apply(this,arguments)),s)return o=null,s+""||null}return i.type=function(s){return arguments.length?(n=typeof s=="function"?s:m(s),i):n},i.size=function(s){return arguments.length?(l=typeof s=="function"?s:m(+s),i):l},i.context=function(s){return arguments.length?(o=s??null,i):o},i}export{E as S,A as a,j as b,$ as c,W as d,I as e,v as f,B as s};
|