decocms 3.71.0 → 3.72.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{AlertCircle-eiDdFdpo.js → AlertCircle-BfI2uSTY.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-C3MnTMc7.js → ArrowUpRight-CvSz9Amp.js} +1 -1
- package/dist/client/assets/{CheckCircle-DXVZzubl.js → CheckCircle-DRm2pwaA.js} +1 -1
- package/dist/client/assets/{ChevronDown-DniEvTjW.js → ChevronDown-C2lrFcn0.js} +1 -1
- package/dist/client/assets/{ChevronLeft-DZ-8LN4r.js → ChevronLeft-D-yhQLP1.js} +1 -1
- package/dist/client/assets/{ChevronRight-CVU8CEAx.js → ChevronRight-CQ9QYca_.js} +1 -1
- package/dist/client/assets/{ChevronUp-lUGooUMN.js → ChevronUp-B3hXWHxa.js} +1 -1
- package/dist/client/assets/{DotsVertical-ClOH4Gg-.js → DotsVertical-CA_v3u_G.js} +1 -1
- package/dist/client/assets/{Eye-Da_GEN8c.js → Eye-D1jbaQ7n.js} +1 -1
- package/dist/client/assets/{FilterLines-7z3fJe--.js → FilterLines-nNO4j83z.js} +1 -1
- package/dist/client/assets/{Globe01-CjtjZc8W.js → Globe01-Dt2zRGYA.js} +1 -1
- package/dist/client/assets/{Globe04-B-0xtF1q.js → Globe04-ClKVSxCF.js} +1 -1
- package/dist/client/assets/{HardDrive-CRjCXSN1.js → HardDrive-D5HAvytg.js} +1 -1
- package/dist/client/assets/{Key01-BH7QR3Q0.js → Key01-B1KOwULG.js} +1 -1
- package/dist/client/assets/{LayoutLeft-C_gVdeVq.js → LayoutLeft-BcwHG1_h.js} +1 -1
- package/dist/client/assets/{LinkExternal01-9FjHpG7X.js → LinkExternal01-CzVttU_W.js} +1 -1
- package/dist/client/assets/{Monitor01-SxcGMGVR.js → Monitor01-BMl8U0hF.js} +1 -1
- package/dist/client/assets/{Palette-BDDXfJRi.js → Palette-Dj5xh4DB.js} +1 -1
- package/dist/client/assets/{Play-Bc7SI6RM.js → Play-CDrfq4i1.js} +1 -1
- package/dist/client/assets/{Plus-C95a6sD7.js → Plus-D1OarKqc.js} +1 -1
- package/dist/client/assets/{SearchMd-BsAsyTF8.js → SearchMd-DkRuJ2gi.js} +1 -1
- package/dist/client/assets/{Settings02-9iZ4Kn5K.js → Settings02-CtgzOHqS.js} +1 -1
- package/dist/client/assets/{Shield01-DyztF96J.js → Shield01-BX5VFQgM.js} +1 -1
- package/dist/client/assets/{Star01-BoCe66s1.js → Star01-C784J1MM.js} +1 -1
- package/dist/client/assets/{Stars01-KhRKHdWL.js → Stars01-4VdPhZCY.js} +1 -1
- package/dist/client/assets/{Stars02-qeumL9NN.js → Stars02-DYfXStsp.js} +1 -1
- package/dist/client/assets/{Sun-D8qj-954.js → Sun-TLWXjMp5.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-CYTzFeBS.js → SwitchHorizontal01-C5k-HENe.js} +1 -1
- package/dist/client/assets/{Tool01-CeM3_qGC.js → Tool01-oQmmJYZR.js} +1 -1
- package/dist/client/assets/{Trash01-Dr7Z-Rtu.js → Trash01-BIZ57nYE.js} +1 -1
- package/dist/client/assets/{Upload01-H0yxEIEj.js → Upload01-gnC5_Ssm.js} +1 -1
- package/dist/client/assets/{User01-Dm5WZ8ZU.js → User01-5m1v97Pd.js} +1 -1
- package/dist/client/assets/{Users01-Bn8juneC.js → Users01-D3elJs6Y.js} +1 -1
- package/dist/client/assets/{Users03-DPz9weBu.js → Users03-DCLVPm8T.js} +1 -1
- package/dist/client/assets/{X-B8VBAesm.js → X-ZEmMP3Rp.js} +1 -1
- package/dist/client/assets/{XCircle-Cqbss1Kp.js → XCircle-BuzRARGa.js} +1 -1
- package/dist/client/assets/{XClose-BGuIHH55.js → XClose-BH3szX7J.js} +1 -1
- package/dist/client/assets/{Zap-CTngI1pZ.js → Zap-CIAspZ-z.js} +1 -1
- package/dist/client/assets/{ZapSquare-B74wvvEK.js → ZapSquare-ZZzC2w-e.js} +1 -1
- package/dist/client/assets/{ZoomOut-D3PYnATq.js → ZoomOut-DajboEJA.js} +1 -1
- package/dist/client/assets/{access-gate-CG8TWb2z.js → access-gate-CDCGTwMX.js} +1 -1
- package/dist/client/assets/{add-section-modal-zMC6VE6E.js → add-section-modal-D87LPJXr.js} +1 -1
- package/dist/client/assets/{agent-icon-DzGGkbHB.js → agent-icon-eDO3_31Q.js} +1 -1
- package/dist/client/assets/{agents-list-B093Kmpm.js → agents-list-Cb-_8Sos.js} +1 -1
- package/dist/client/assets/{ai-providers-CIrb_aA0.js → ai-providers-BJQDGxLt.js} +1 -1
- package/dist/client/assets/{alert-nZjL99ao.js → alert-WwIO0xi4.js} +1 -1
- package/dist/client/assets/{alert-dialog-BmkUWho8.js → alert-dialog-eW7WkIvS.js} +1 -1
- package/dist/client/assets/app-editor-CYD_ZGIQ.js +1 -0
- package/dist/client/assets/{auth-xNmYqmgC.js → auth-DD4_4jA4.js} +1 -1
- package/dist/client/assets/{auth-catchall-C4Y52vRL.js → auth-catchall-DYyKKsO9.js} +1 -1
- package/dist/client/assets/{auth-split-layout-Ce1sPlua.js → auth-split-layout-1j1v9wXX.js} +1 -1
- package/dist/client/assets/{automation-list-row-CZsOtouY.js → automation-list-row-B1AKQ_mc.js} +1 -1
- package/dist/client/assets/{automation-runs-Dg53j0r1.js → automation-runs-CBc9TThB.js} +1 -1
- package/dist/client/assets/{automations-CProB2E_.js → automations-DvUokGho.js} +1 -1
- package/dist/client/assets/{avatar-B7kKIqkG.js → avatar-CAa0APRH.js} +1 -1
- package/dist/client/assets/{badge-B1zUdZu4.js → badge-f0VKW-9Z.js} +1 -1
- package/dist/client/assets/{block-document-D3PWH8Ct.js → block-document-B2Z9lxQW.js} +1 -1
- package/dist/client/assets/{brand-context-H7pTvrxE.js → brand-context-DZDstdpV.js} +1 -1
- package/dist/client/assets/{buckets-DAKgAom0.js → buckets-zgaPzKbq.js} +1 -1
- package/dist/client/assets/{calendar-C0B8UkyJ.js → calendar-DYsvDfUn.js} +1 -1
- package/dist/client/assets/{capability-load-error-Bf51gqq2.js → capability-load-error-BId-7K5n.js} +1 -1
- package/dist/client/assets/{card-BJ97y7iE.js → card-xuJ9Fzgg.js} +1 -1
- package/dist/client/assets/category-editor-Cc_c2Smc.js +1 -0
- package/dist/client/assets/{chat-context-DwuFSNXk.js → chat-context-D1kr0iC0.js} +1 -1
- package/dist/client/assets/{checkbox-CTtEhAwe.js → checkbox-B7cE0lJJ.js} +1 -1
- package/dist/client/assets/{cli-auth-success-D6UQk1Ih.js → cli-auth-success-CA57787c.js} +1 -1
- package/dist/client/assets/{collection-detail-3yHYUZaT.js → collection-detail-CHd3esao.js} +1 -1
- package/dist/client/assets/{collection-display-button-C4BR1DGs.js → collection-display-button-zhsv5x-M.js} +1 -1
- package/dist/client/assets/{collection-search-D49siPrl.js → collection-search-CaMjJF6-.js} +1 -1
- package/dist/client/assets/{collection-tabs-COIIQvGk.js → collection-tabs-CPFECg6-.js} +1 -1
- package/dist/client/assets/{command-Toe5bvPv.js → command-DPlRPlz3.js} +1 -1
- package/dist/client/assets/{connect-desktop-dialog-wAwjOiTz.js → connect-desktop-dialog-BqQ6M6VV.js} +1 -1
- package/dist/client/assets/{connection-card-DALvnRcW.js → connection-card-XQGSkUWc.js} +1 -1
- package/dist/client/assets/{connection-detail-DDyIkE8L.js → connection-detail-DKJc4pZO.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-Bt8rfYZz.js → connection-form-helpers-BEunAzRs.js} +1 -1
- package/dist/client/assets/{connections-C1v4kr3o.js → connections-DUKeSEKY.js} +1 -1
- package/dist/client/assets/{context-menu-Cjv4RLJv.js → context-menu-DVgkGDrK.js} +1 -1
- package/dist/client/assets/{decopilot-Jwqgdbyr.js → decopilot-BgVFUp6y.js} +1 -1
- package/dist/client/assets/{decopilot-sse-pool-tu8rIUid.js → decopilot-sse-pool-CfcCM-5d.js} +1 -1
- package/dist/client/assets/{dialog-ZcUt91qN.js → dialog-B-qEKmGK.js} +1 -1
- package/dist/client/assets/{domain-settings-De7RJmeV.js → domain-settings-DU5w0d-s.js} +1 -1
- package/dist/client/assets/{drawer-Ch5vCDYY.js → drawer-BsKI7ymt.js} +1 -1
- package/dist/client/assets/{dropdown-menu-CanZ1iuF.js → dropdown-menu-BT6aqF06.js} +1 -1
- package/dist/client/assets/{empty-state-DHrDb97g.js → empty-state-Bhl0YdU3.js} +1 -1
- package/dist/client/assets/{extract-connection-data-2Pprwu-z.js → extract-connection-data-CFVR9SzW.js} +1 -1
- package/dist/client/assets/{file-explorer-kcyqbzZo.js → file-explorer-DlXOhuk5.js} +1 -1
- package/dist/client/assets/{file-type-icon-CfmazJxW.js → file-type-icon-Btmj3s_g.js} +1 -1
- package/dist/client/assets/{files-DXxIOKiY.js → files-CCnVBZfT.js} +1 -1
- package/dist/client/assets/{form-BnR92DK8.js → form-CVlSwq3w.js} +1 -1
- package/dist/client/assets/{general-XwSOHaiO.js → general-D_0IXMDp.js} +1 -1
- package/dist/client/assets/{github-repo-picker-CQlmRX03.js → github-repo-picker-DGlex3MX.js} +1 -1
- package/dist/client/assets/{hooks-DVgYis4C.js → hooks-DWV8tZMM.js} +6 -6
- package/dist/client/assets/{image-field-BGYmIBMw.js → image-field-D6uiGDOX.js} +1 -1
- package/dist/client/assets/{import-from-deco-dialog-Dk-lEkfx.js → import-from-deco-dialog-BdZAOr7C.js} +1 -1
- package/dist/client/assets/{index-CioasWLZ.js → index-BW-4wD8s.js} +1 -1
- package/dist/client/assets/{index-CH34hLfH.js → index-CLkGYS1A.js} +1 -1
- package/dist/client/assets/{index-DzSgFVo5.js → index-CN9i-k-7.js} +1 -1
- package/dist/client/assets/{index-CVXOwd6R.js → index-C_vCM6aG.js} +1 -1
- package/dist/client/assets/{index-rm3C3HAe.js → index-D3rW8rSB.js} +3 -3
- package/dist/client/assets/{index-DwquSkYl.js → index-DO2lIrOm.js} +1 -1
- package/dist/client/assets/{index-BxN9R4vT.js → index-DU1cTODu.js} +1 -1
- package/dist/client/assets/{index-hvgJxH8L.js → index-DatC5ukX.js} +1 -1
- package/dist/client/assets/{index-8mI3Tffx.js → index-Ddz4Khr1.js} +1 -1
- package/dist/client/assets/{index-CVYP6LK-.js → index-DmEx1tCe.js} +1 -1
- package/dist/client/assets/{index-Bvg6u01c.js → index-DqFW3OaN.js} +1 -1
- package/dist/client/assets/{index-4hPVVAQd.js → index-DuBKog7q.js} +1 -1
- package/dist/client/assets/{index-BnbBmKCA.js → index-pqNXXDM-.js} +1 -1
- package/dist/client/assets/{index-redirect-DMpNpZGg.js → index-redirect-DWEDsLRV.js} +1 -1
- package/dist/client/assets/{index-Dqht8t56.js → index-te0-qL-i.js} +4 -4
- package/dist/client/assets/{input-YP3xr2b6.js → input-DTeQSVLv.js} +1 -1
- package/dist/client/assets/{integration-icon-DrPIi_Lw.js → integration-icon-CI4vd8FM.js} +1 -1
- package/dist/client/assets/{label-BZO-nx5U.js → label-CQsaTPJ3.js} +1 -1
- package/dist/client/assets/{login-1j5bFdkC.js → login-DqEnX5TX.js} +1 -1
- package/dist/client/assets/{mcp-oauth-C2VCpurV.js → mcp-oauth-BYZQ1Ird.js} +1 -1
- package/dist/client/assets/{members-jnRXqzpa.js → members-NnIzn4KV.js} +1 -1
- package/dist/client/assets/{monaco-editor-DkCRcG9C.js → monaco-editor-CwwtK29R.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-bSvCV5H1.js → monitoring-stats-row-DDxEHepT.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-QYwVi3lj.js → oauth-callback-ai-provider-D--1FgUT.js} +1 -1
- package/dist/client/assets/{oauth-callback-DDWsIx2e.js → oauth-callback-mKXClFTh.js} +1 -1
- package/dist/client/assets/{onboarding-CL25YArc.js → onboarding-DMLBaNEB.js} +1 -1
- package/dist/client/assets/{org-install-PwbKCjFJ.js → org-install-DjY7nNjX.js} +1 -1
- package/dist/client/assets/{org-layout-DYjxNTnA.js → org-layout-EMcev8hT.js} +1 -1
- package/dist/client/assets/{page-seo-form-BPGfCLGr.js → page-seo-form-BdcE_gQo.js} +1 -1
- package/dist/client/assets/page-seo-sheet-BwgpogL2.js +1 -0
- package/dist/client/assets/{popover-CMddDx8S.js → popover-BRgvG_DY.js} +1 -1
- package/dist/client/assets/{post-editor-Ny5AyRES.js → post-editor-CZy405TW.js} +1 -1
- package/dist/client/assets/{preview-dialog-ewcufuZZ.js → preview-dialog-BPhgp4kw.js} +1 -1
- package/dist/client/assets/{primitives-g1tedqpt.js → primitives-CrzpQjhK.js} +1 -1
- package/dist/client/assets/{profile-DdpZNTLe.js → profile-DxbSCYN0.js} +1 -1
- package/dist/client/assets/project-app-view-OuNqyhX4.js +1 -0
- package/dist/client/assets/record-editor-DYzmVKQc.js +1 -0
- package/dist/client/assets/registry-BEPFu6ek.js +2 -0
- package/dist/client/assets/{registry-layout-BGxxCeZs.js → registry-layout-CLnRry77.js} +1 -1
- package/dist/client/assets/{require-capability-BdVtn03N.js → require-capability-D2jcbcRo.js} +1 -1
- package/dist/client/assets/{required-auth-layout-C3Gv1yj3.js → required-auth-layout-BTgmf1Ho.js} +1 -1
- package/dist/client/assets/{reset-password-DA2LsDUk.js → reset-password-B2AYR83g.js} +1 -1
- package/dist/client/assets/{roles-Dh6KGM0U.js → roles-DarHXb1K.js} +1 -1
- package/dist/client/assets/save-referenced-block-sILi1Js0.js +1 -0
- package/dist/client/assets/{save-status-D8Sun7mT.js → save-status-DAuqKDzU.js} +1 -1
- package/dist/client/assets/{schema-form-Mo6wmjwV.js → schema-form-CUfa1Oym.js} +1 -1
- package/dist/client/assets/{scroll-area-HiEpDNZ9.js → scroll-area-YGRrTDU7.js} +1 -1
- package/dist/client/assets/{search-input-CVNzv0kF.js → search-input-hxkxbPXL.js} +1 -1
- package/dist/client/assets/{secrets-ZRzeGgdw.js → secrets-B7saM4Cn.js} +1 -1
- package/dist/client/assets/{sections-editor-DEyShYpj.js → sections-editor-DaVNSE56.js} +1 -1
- package/dist/client/assets/{select-DNJPz4ZI.js → select-B5x2AUrZ.js} +1 -1
- package/dist/client/assets/{select-model-_-YzMT35.js → select-model-DCDYiWUZ.js} +1 -1
- package/dist/client/assets/{seo-editor-B2jQlXXL.js → seo-editor-ILMNyKKG.js} +1 -1
- package/dist/client/assets/{settings-layout-C1x4u3Hj.js → settings-layout-BkCB3n7U.js} +1 -1
- package/dist/client/assets/{settings-section-Dm-722_v.js → settings-section-CNFUQN3R.js} +1 -1
- package/dist/client/assets/{sheet--I615llH.js → sheet-yZUVXUUg.js} +1 -1
- package/dist/client/assets/{shell-controls-BMuyxfdX.js → shell-controls-Dxpr_Qo7.js} +1 -1
- package/dist/client/assets/{shell-layout-D_O9nrWI.js → shell-layout-DHMpOaUJ.js} +1 -1
- package/dist/client/assets/{shell-route-loading-BCODfEXb.js → shell-route-loading-BKTpl941.js} +1 -1
- package/dist/client/assets/{sidebar-CqyV3hvw.js → sidebar-Dmsmn1q4.js} +1 -1
- package/dist/client/assets/{skeleton-Db2IVZSk.js → skeleton-DLJHpAXs.js} +1 -1
- package/dist/client/assets/{sortable.esm-C4XXVlGw.js → sortable.esm-HmrhEw1U.js} +1 -1
- package/dist/client/assets/{sso-BRdOCN4x.js → sso-9jlTwN01.js} +1 -1
- package/dist/client/assets/{store-CJXbc2W2.js → store-Bp20u8lY.js} +1 -1
- package/dist/client/assets/store-registry-BM3MPRJB.js +2 -0
- package/dist/client/assets/{studio-tools-Bs-4h4N6.js → studio-tools-CP8WMfwU.js} +1 -1
- package/dist/client/assets/{switch-CPIofN4u.js → switch-j2wai7YF.js} +1 -1
- package/dist/client/assets/{table-D9vTl4St.js → table-BiPBJ_vK.js} +1 -1
- package/dist/client/assets/{tabs-nSWhKPrq.js → tabs-VvrUTZXI.js} +1 -1
- package/dist/client/assets/{task-status-BT_ofK0L.js → task-status-DHb08gVZ.js} +1 -1
- package/dist/client/assets/{textarea-BYctdmbn.js → textarea-CwJzHeYB.js} +1 -1
- package/dist/client/assets/{toggle-group-DsnLxyxY.js → toggle-group-CVP4NlJk.js} +1 -1
- package/dist/client/assets/{toolbar-C8m_suht.js → toolbar-CM8RQ0c-.js} +1 -1
- package/dist/client/assets/{tooltip-muTAVYsN.js → tooltip-BnbMgAPE.js} +1 -1
- package/dist/client/assets/{types-DcyOlOkr.js → types-DVbz3Se0.js} +1 -1
- package/dist/client/assets/{use-ai-providers-hrShoTNJ.js → use-ai-providers-dF-K_DaJ.js} +1 -1
- package/dist/client/assets/{use-automations-DmxLmx01.js → use-automations-WmY_k1VU.js} +1 -1
- package/dist/client/assets/{use-capability-B928xLn2.js → use-capability-Cc8N2DWQ.js} +1 -1
- package/dist/client/assets/{use-clock-tick-C60lgc5z.js → use-clock-tick-BNwdYLJy.js} +1 -1
- package/dist/client/assets/{use-collections-DZb_dDr5.js → use-collections-xatq9RdX.js} +1 -1
- package/dist/client/assets/{use-connection-B7DWRE37.js → use-connection-D4k9Jnol.js} +1 -1
- package/dist/client/assets/{use-copy-BeM54y_K.js → use-copy-qqj4mjMm.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-Dx7JOtra.js → use-create-virtual-mcp-B9uXNKMX.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-Di0IMVYg.js → use-debounced-autosave-DWyP2FOP.js} +1 -1
- package/dist/client/assets/{use-deco-credits-Db4_aWO7.js → use-deco-credits-iEPKbFsz.js} +1 -1
- package/dist/client/assets/{use-delete-connection-k2LSoHvi.js → use-delete-connection-D-FGyEhr.js} +1 -1
- package/dist/client/assets/{use-file-configs-DtiKgAOA.js → use-file-configs-BI2QJkP7.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-CtiF3fgR.js → use-infinite-scroll-BUY20nUO.js} +1 -1
- package/dist/client/assets/{use-join-requests-CGazznom.js → use-join-requests-l4TQrZiq.js} +1 -1
- package/dist/client/assets/{use-mcp-client-VQUpV2Ii.js → use-mcp-client-CjFb2EJG.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-VMwEXGxN.js → use-mcp-prompts-Ck43hw0S.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-B1aAytZI.js → use-mcp-tools-D4YpHKWB.js} +1 -1
- package/dist/client/assets/{use-members-CjS-AkZB.js → use-members-DBYXCK00.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-C-zszyi1.js → use-navigate-to-agent-DnY8W1Vs.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-C9iPXZoQ.js → use-org-auth-client-BS94IuDi.js} +1 -1
- package/dist/client/assets/{use-org-sso-DxnrDxMD.js → use-org-sso-C5aovsso.js} +1 -1
- package/dist/client/assets/{use-organization-roles-BRmfDzCj.js → use-organization-roles-DWYLx8xN.js} +1 -1
- package/dist/client/assets/{use-organization-settings-C_6Vi920.js → use-organization-settings-B5dOmmF3.js} +1 -1
- package/dist/client/assets/{use-registry-connections-B4n3e5W4.js → use-registry-connections-DEimB7Dw.js} +1 -1
- package/dist/client/assets/{use-secrets-DbaTf5Lx.js → use-secrets-B4zusNgt.js} +1 -1
- package/dist/client/assets/{use-status-sounds-DAQBMvRH.js → use-status-sounds-n3ORlbU0.js} +1 -1
- package/dist/client/assets/{use-view-mode-cVmqgRhQ.js → use-view-mode-ClvFgM5k.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-CA84I6FL.js → use-virtual-mcp-sNnLDxto.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-ByFdiCdF.js +1 -0
- package/dist/client/assets/{useRouterState-Cci41lb_.js → useRouterState-DB2FFYMc.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-C-w91snb.js +1 -0
- package/dist/client/assets/{view-mode-toggle-DPXvgrPU.js → view-mode-toggle-B7K94eRT.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +541 -506
- package/dist/server/server.js +378 -378
- package/package.json +1 -1
- package/dist/client/assets/app-editor-DOgcjNSr.js +0 -1
- package/dist/client/assets/category-editor-sLH8kFth.js +0 -1
- package/dist/client/assets/page-seo-sheet-zOBS4edm.js +0 -1
- package/dist/client/assets/project-app-view-Ds65Vxu_.js +0 -1
- package/dist/client/assets/record-editor-QahHka2W.js +0 -1
- package/dist/client/assets/registry-DIVC_7pR.js +0 -2
- package/dist/client/assets/save-referenced-block-8Q-aWQo9.js +0 -1
- package/dist/client/assets/store-registry-m8sH3-l1.js +0 -2
- package/dist/client/assets/useInfiniteQuery-C8ycMIJZ.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-DEZ-HoPC.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e as P,r as M,s as xc,w as ah,x as ch,j as p,B as lr,v as Ol,bI as bc,bJ as uh,aO as dh,af as rn,bK as fh,c as Z,t as hh,P as $t,M as Ot,U as kr,_ as ph,ai as mh,V as hn,bL as kc,T as Sc,p as zt,F as gh,a as yh,K as Kt,n as zi,m as Co,f as Ln,a1 as xh,ac as vc,bM as To,ah as bh,bN as Ut}from"./index-rm3C3HAe.js";import{f as kh,M as Sh,d as vh,ae as wh,V as Ch,U as Th,T as Nh,aa as wc,af as Mh,ag as Eh,A as Cc,ah as it,ai as Ah,aj as Oh,ak as Ih,j as Rh}from"./agent-icon-DzGGkbHB.js";import{t as Fs}from"./Stars01-KhRKHdWL.js";import{a as Tc,t as jh,d as Nc,b as Er}from"./XCircle-Cqbss1Kp.js";import{i as No}from"./ChevronUp-lUGooUMN.js";import{i as Il}from"./ChevronRight-CVU8CEAx.js";import{a as Mc,s as Dh}from"./Eye-Da_GEN8c.js";import{a as Pt,u as Ec,t as Ac,c as Rl}from"./use-clock-tick-C60lgc5z.js";import{u as Oc}from"./use-copy-BeM54y_K.js";import{T as sn,a as on,b as ln}from"./tooltip-muTAVYsN.js";import{M as Mo,I as Ic,F as Ph}from"./file-type-icon-CfmazJxW.js";import{c as Lh}from"./content-blocks-o63cs2vh.js";import{g as Rc,M as _h}from"./types-DcyOlOkr.js";import{S as $h,f as _n,h as zh,c as Eo,a as Bh,u as Fh}from"./chat-context-DwuFSNXk.js";import{c as Hh,r as Vh,R as Wh}from"./hooks-DVgYis4C.js";import{u as Uh}from"./studio-tools-Bs-4h4N6.js";import{f as qh,k as Kh,l as Jh}from"./tab-id-BptcWVWa.js";import{d as Gh,u as jc,j as Xh}from"./use-mcp-client-VQUpV2Ii.js";import{i as Dc}from"./AlertCircle-eiDdFdpo.js";import{s as Jr,t as Pc}from"./Star01-BoCe66s1.js";import{s as Yh}from"./XClose-BGuIHH55.js";import{n as Bi}from"./ZapSquare-B74wvvEK.js";import{n as Lc,i as Qh}from"./Globe01-CjtjZc8W.js";import{b as Zh,i as ep,a as Ar}from"./Tool01-CeM3_qGC.js";import{b as jl,a as tp}from"./ZoomOut-D3PYnATq.js";import{i as Gn}from"./Monitor01-SxcGMGVR.js";import{i as np}from"./SearchMd-BsAsyTF8.js";import{i as rp}from"./Upload01-H0yxEIEj.js";import{b as sp,c as ip}from"./shell-layout-D_O9nrWI.js";import{n as _c}from"./LinkExternal01-9FjHpG7X.js";import{b as op,S as lp,c as ap,d as cp}from"./sheet--I615llH.js";import{I as Sr}from"./integration-icon-DrPIi_Lw.js";import{a as up}from"./use-virtual-mcp-CA84I6FL.js";import{i as dp}from"./ArrowUpRight-C3MnTMc7.js";import{a as Ao}from"./Users03-DPz9weBu.js";import{a as ot}from"./Palette-BDDXfJRi.js";import{m as $c}from"./use-navigate-to-agent-C-zszyi1.js";import{a as fp}from"./use-connection-B7DWRE37.js";import{a as hp}from"./Stars02-qeumL9NN.js";import{g as pp}from"./use-mcp-prompts-VMwEXGxN.js";import{a as mp,D as gp,e as yp,c as xp,d as bp}from"./dialog-ZcUt91qN.js";import{a as kp,F as Sp,b as vp,c as wp,d as Cp,f as Tp}from"./form-BnR92DK8.js";import{I as Np}from"./input-YP3xr2b6.js";import{t as Mp}from"./ChevronDown-DniEvTjW.js";import{e as Ep}from"./select-DNJPz4ZI.js";const Ap={openrouter:n=>{const e=n?.openrouter;return typeof e=="object"&&e!==null&&"usage"in e&&typeof e.usage=="object"&&e.usage!==null&&"cost"in e.usage&&typeof e.usage.cost=="number"?e.usage.cost:null}};function zc(n){if(!n?.providerMetadata)return 0;for(const e of Object.values(Ap)){const t=e(n.providerMetadata);if(t!==null)return t}return 0}function Bc(){return{inputTokens:0,outputTokens:0,reasoningTokens:0,totalTokens:0,cost:0,cacheReadTokens:0,cacheWriteTokens:0}}function Fc(n,e){if(!e)return n;const t=e.inputTokenDetails?.cacheReadTokens??e.cachedInputTokens??0,r=e.inputTokenDetails?.cacheWriteTokens??0;return{inputTokens:n.inputTokens+(e.inputTokens??0),outputTokens:n.outputTokens+(e.outputTokens??0),reasoningTokens:n.reasoningTokens+(e.reasoningTokens??0),totalTokens:n.totalTokens+(e.totalTokens??0),cost:n.cost+zc(e),cacheReadTokens:n.cacheReadTokens+t,cacheWriteTokens:n.cacheWriteTokens+r}}function gw(n){return n.reduce((e,t)=>Fc(e,t.metadata?.usage),Bc())}function Op(n){return n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function Oo(n){if(n&&typeof n=="object"&&"gatewayClientId"in n&&typeof n.gatewayClientId=="string")return n.gatewayClientId}function Io(n,e){if(!e)return n;const t=`${Op(e)}_`;return n.startsWith(t)?n.slice(t.length):n}function Ip(n,e){return Io(n,e).replace(/[_-]/g," ").toLowerCase()}function Rp(n){const e={};for(const t of n.arguments??[])e[t.name]=t.required?Ol().min(1,"Required"):Ol();return xc(e)}function jp(n,e){const t={};for(const r of n.arguments??[])t[r.name]=e?.[r.name]??"";return t}function Dp(n){const e=P.c(66),{prompt:t,setPrompt:r,onSubmit:s,defaultValues:i}=n,o=M.useId();let l;if(e[0]!==t){const $=t?Rp(t):xc({});l=ah($),e[0]=t,e[1]=l}else l=e[1];const c=l;let u;e[2]!==i||e[3]!==t?(u=t?jp(t,i):{},e[2]=i,e[3]=t,e[4]=u):u=e[4];let d;e[5]!==c||e[6]!==u?(d={resolver:c,defaultValues:u,mode:"onChange"},e[5]=c,e[6]=u,e[7]=d):d=e[7];const f=ch(d);let h;e[8]!==t?.arguments?(h=t?.arguments??[],e[8]=t?.arguments,e[9]=h):h=e[9];const m=h;let g;e[10]!==f||e[11]!==s||e[12]!==r?(g=async $=>{await s($),r(null),f.reset()},e[10]=f,e[11]=s,e[12]=r,e[13]=g):g=e[13];const y=g;let x;e[14]!==f||e[15]!==r?(x=$=>{$||(f.reset(),r(null))},e[14]=f,e[15]=r,e[16]=x):x=e[16];const b=x;if(!t)return null;let S;e[17]!==t._meta||e[18]!==t.name||e[19]!==t.title?(S=t.title||Ip(t.name,Oo(t._meta)),e[17]=t._meta,e[18]=t.name,e[19]=t.title,e[20]=S):S=e[20];let v;e[21]!==S?(v=p.jsx(mp,{children:p.jsx("span",{className:"capitalize",children:S})}),e[21]=S,e[22]=v):v=e[22];let k;e[23]!==t.description?(k=t.description&&p.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),e[23]=t.description,e[24]=k):k=e[24];let C;e[25]!==k||e[26]!==v?(C=p.jsxs(gp,{children:[v,k]}),e[25]=k,e[26]=v,e[27]=C):C=e[27];let w;e[28]!==f||e[29]!==y?(w=$=>{$.stopPropagation(),f.handleSubmit(y)($)},e[28]=f,e[29]=y,e[30]=w):w=e[30];let T;if(e[31]!==m||e[32]!==f.control||e[33]!==f.formState.isSubmitting){let $;e[35]!==f.control||e[36]!==f.formState.isSubmitting?($=B=>p.jsx(Sp,{control:f.control,name:B.name,render:J=>{const{field:Y}=J;return p.jsxs(vp,{children:[p.jsxs(wp,{className:"text-xs",children:[B.name,B.required?null:p.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),p.jsx(Cp,{children:p.jsx(Np,{...Y,value:Y.value??"",required:B.required,placeholder:B.description??"",className:"h-9",disabled:f.formState.isSubmitting})}),p.jsx(Tp,{})]})}},B.name),e[35]=f.control,e[36]=f.formState.isSubmitting,e[37]=$):$=e[37],T=m.map($),e[31]=m,e[32]=f.control,e[33]=f.formState.isSubmitting,e[34]=T}else T=e[34];let N;e[38]!==b?(N=()=>b(!1),e[38]=b,e[39]=N):N=e[39];let E;e[40]!==f.formState.isSubmitting||e[41]!==N?(E=p.jsx(lr,{type:"button",variant:"ghost",onClick:N,disabled:f.formState.isSubmitting,children:"Cancel"}),e[40]=f.formState.isSubmitting,e[41]=N,e[42]=E):E=e[42];let j;e[43]!==f.formState.isSubmitting?(j=f.formState.isSubmitting?p.jsxs("span",{className:"flex items-center gap-2",children:[p.jsx($h,{size:"xs"}),"Loading..."]}):"Use prompt",e[43]=f.formState.isSubmitting,e[44]=j):j=e[44];let L;e[45]!==f.formState.isSubmitting||e[46]!==o||e[47]!==j?(L=p.jsx(lr,{type:"submit",form:o,disabled:f.formState.isSubmitting,children:j}),e[45]=f.formState.isSubmitting,e[46]=o,e[47]=j,e[48]=L):L=e[48];let O;e[49]!==E||e[50]!==L?(O=p.jsxs(yp,{children:[E,L]}),e[49]=E,e[50]=L,e[51]=O):O=e[51];let D;e[52]!==o||e[53]!==w||e[54]!==T||e[55]!==O?(D=p.jsxs("form",{id:o,className:"space-y-4 py-4",autoComplete:"off",onSubmit:w,children:[T,O]}),e[52]=o,e[53]=w,e[54]=T,e[55]=O,e[56]=D):D=e[56];let R;e[57]!==f||e[58]!==D?(R=p.jsx(kp,{...f,children:D}),e[57]=f,e[58]=D,e[59]=R):R=e[59];let F;e[60]!==C||e[61]!==R?(F=p.jsxs(xp,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[C,R]}),e[60]=C,e[61]=R,e[62]=F):F=e[62];let z;return e[63]!==b||e[64]!==F?(z=p.jsx(bp,{open:!0,onOpenChange:b,children:F}),e[63]=b,e[64]=F,e[65]=z):z=e[65],z}function Hc(n){return n?n.replace(/[_-]/g," ").toLowerCase().split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "):""}function tt(n,e){return n==="output-error"||n==="output-denied"?"error":n==="approval-requested"?"approval":n==="input-streaming"||n==="input-available"||n==="output-available"&&e===!0?"loading":"idle"}function $n(n){if(n==null||typeof n!="object")return;const e=n;if(e.structuredContent&&typeof e.structuredContent=="object")return e.structuredContent;if(Array.isArray(e.content)){const t=e.content[0];if(t?.type==="text"&&typeof t.text=="string")try{return JSON.parse(t.text)}catch{return}return}return n}function Te(n){this.content=n}Te.prototype={constructor:Te,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,s=r.find(n),i=r.content.slice();return s==-1?i.push(t||n,e):(i[s+1]=e,t&&(i[s]=t)),new Te(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Te(t)},addToStart:function(n,e){return new Te([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Te(t)},addBefore:function(n,e,t){var r=this.remove(e),s=r.content.slice(),i=r.find(n);return s.splice(i==-1?s.length:i,0,e,t),new Te(s)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Te.from(n),n.size?new Te(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Te.from(n),n.size?new Te(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Te.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};Te.from=function(n){if(n instanceof Te)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Te(e)};function Vc(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),i=e.child(r);if(s==i){t+=s.nodeSize;continue}if(!s.sameMarkup(i))return t;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)t++;return t}if(s.content.size||i.content.size){let o=Vc(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function Wc(n,e,t,r){for(let s=n.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:t,b:r};let o=n.child(--s),l=e.child(--i),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;c<u&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||l.content.size){let c=Wc(o.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class A{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,s=0,i){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,s+l,i||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,s+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let i="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new A(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let i=0,o=0;o<t;i++){let l=this.content[i],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),s+=l.nodeSize),o=a}return new A(r,s)}cutByIndex(e,t){return e==t?A.empty:e==0&&t==this.content.length?this:new A(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new A(s,i)}addToStart(e){return new A([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new A(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return Vc(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Wc(this,e,t,r)}findIndex(e){if(e==0)return Or(0,e);if(e==this.size)return Or(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let s=this.child(t),i=r+s.nodeSize;if(i>=e)return i==e?Or(t+1,i):Or(t,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return A.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new A(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return A.empty;let t,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(t||(t=e.slice(0,s)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new A(t||e,r)}static from(e){if(!e)return A.empty;if(e instanceof A)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new A([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}A.empty=new A([],0);const ci={index:0,offset:0};function Or(n,e){return ci.index=n,ci.offset=e,ci}function Gr(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Gr(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Gr(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let ne=class Fi{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Gr(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let s=r.create(t.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Fi.none;if(e instanceof Fi)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};ne.none=[];class Xr extends Error{}class _{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=qc(this.content,e+this.openStart,t);return r&&new _(r,this.openStart,this.openEnd)}removeBetween(e,t){return new _(Uc(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return _.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new _(A.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)s++;return new _(e,r,s)}}_.empty=new _(A.empty,0,0);function Uc(n,e,t){let{index:r,offset:s}=n.findIndex(e),i=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(s==e||i.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(Uc(i.content,e-s-1,t-s-1)))}function qc(n,e,t,r){let{index:s,offset:i}=n.findIndex(e),o=n.maybeChild(s);if(i==e||o.isText)return r&&!r.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=qc(o.content,e-i-1,t,o);return l&&n.replaceChild(s,o.copy(l))}function Pp(n,e,t){if(t.openStart>n.depth)throw new Xr("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Xr("Inconsistent open depths");return Kc(n,e,t,0)}function Kc(n,e,t,r){let s=n.index(r),i=n.node(r);if(s==e.index(r)&&r<n.depth-t.openStart){let o=Kc(n,e,t,r+1);return i.copy(i.content.replaceChild(s,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,l=o.content;return Zt(o,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=Lp(t,n);return Zt(i,Gc(n,o,l,e,r))}else return Zt(i,Yr(n,e,r))}function Jc(n,e){if(!e.type.compatibleContent(n.type))throw new Xr("Cannot join "+e.type.name+" onto "+n.type.name)}function Hi(n,e,t){let r=n.node(t);return Jc(r,e.node(t)),r}function Qt(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function Xn(n,e,t,r){let s=(e||n).node(t),i=0,o=e?e.index(t):s.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(Qt(n.nodeAfter,r),i++));for(let l=i;l<o;l++)Qt(s.child(l),r);e&&e.depth==t&&e.textOffset&&Qt(e.nodeBefore,r)}function Zt(n,e){return n.type.checkContent(e),n.copy(e)}function Gc(n,e,t,r,s){let i=n.depth>s&&Hi(n,e,s+1),o=r.depth>s&&Hi(t,r,s+1),l=[];return Xn(null,n,s,l),i&&o&&e.index(s)==t.index(s)?(Jc(i,o),Qt(Zt(i,Gc(n,e,t,r,s+1)),l)):(i&&Qt(Zt(i,Yr(n,e,s+1)),l),Xn(e,t,s,l),o&&Qt(Zt(o,Yr(t,r,s+1)),l)),Xn(r,null,s,l),new A(l)}function Yr(n,e,t){let r=[];if(Xn(null,n,t,r),n.depth>t){let s=Hi(n,e,t+1);Qt(Zt(s,Yr(n,e,t+1)),r)}return Xn(e,null,t,r),new A(r)}function Lp(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)s=e.node(i).copy(A.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class ar{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(t);return r?e.child(t).cut(r):s}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],s=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return ne.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),s=e.maybeChild(t);if(!r){let l=r;r=s,s=l}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Qr(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],s=0,i=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(i),c=i-a;if(r.push(o,l,s+a),!c||(o=o.child(l),o.isText))break;i=c-1,s+=a+1}return new ar(t,r,i)}static resolveCached(e,t){let r=Dl.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==t)return o}else Dl.set(e,r=new _p);let s=r.elts[r.i]=ar.resolve(e,t);return r.i=(r.i+1)%$p,s}}class _p{constructor(){this.elts=[],this.i=0}}const $p=12,Dl=new WeakMap;class Qr{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const zp=Object.create(null);class et{constructor(e,t,r,s=ne.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||A.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,s=0){this.content.nodesBetween(e,t,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,s){return this.content.textBetween(e,t,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&Gr(this.attrs,t||e.defaultAttrs||zp)&&ne.sameSet(this.marks,r||ne.none)}copy(e=null){return e==this.content?this:new et(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new et(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return _.empty;let s=this.resolve(e),i=this.resolve(t),o=r?0:s.sharedDepth(t),l=s.start(o),c=s.node(o).content.cut(s.pos-l,i.pos-l);return new _(c,s.depth-o,i.depth-o)}replace(e,t,r){return Pp(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(s==e||t.isText)return t;e-=s+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let s=this.content.child(t-1);return{node:s,index:t-1,offset:r-s.nodeSize}}resolve(e){return ar.resolveCached(this,e)}resolveNoCache(e){return ar.resolve(this,e)}rangeHasMark(e,t,r){let s=!1;return t>e&&this.nodesBetween(e,t,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Xc(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=A.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=s;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=ne.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!ne.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let s=A.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,s,r);return i.type.checkAttrs(i.attrs),i}}et.prototype.text=void 0;class Zr extends et{constructor(e,t,r,s){if(super(e,t,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Xc(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Zr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Zr(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Xc(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class an{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Bp(e,t);if(r.next==null)return an.empty;let s=Yc(r);r.next&&r.err("Unexpected trailing text");let i=Kp(qp(s));return Jp(i,r),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let s=this;for(let i=t;s&&i<r;i++)s=s.matchType(e.child(i).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let s=[this];function i(o,l){let a=o.matchFragment(e,r);if(a&&(!t||a.validEnd))return A.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let f=i(d,l.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let l=s;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:l,next:a}=i.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!s.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&t(r.next[s].next)}return t(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
|
|
1
|
+
import{e as P,r as M,s as xc,w as ah,x as ch,j as p,B as lr,v as Ol,bI as bc,bJ as uh,aO as dh,af as rn,bK as fh,c as Z,t as hh,P as $t,M as Ot,U as kr,_ as ph,ai as mh,V as hn,bL as kc,T as Sc,p as zt,F as gh,a as yh,K as Kt,n as zi,m as Co,f as Ln,a1 as xh,ac as vc,bM as To,ah as bh,bN as Ut}from"./index-D3rW8rSB.js";import{f as kh,M as Sh,d as vh,ae as wh,V as Ch,U as Th,T as Nh,aa as wc,af as Mh,ag as Eh,A as Cc,ah as it,ai as Ah,aj as Oh,ak as Ih,j as Rh}from"./agent-icon-eDO3_31Q.js";import{t as Fs}from"./Stars01-4VdPhZCY.js";import{a as Tc,t as jh,d as Nc,b as Er}from"./XCircle-BuzRARGa.js";import{i as No}from"./ChevronUp-B3hXWHxa.js";import{i as Il}from"./ChevronRight-CQ9QYca_.js";import{a as Mc,s as Dh}from"./Eye-D1jbaQ7n.js";import{a as Pt,u as Ec,t as Ac,c as Rl}from"./use-clock-tick-BNwdYLJy.js";import{u as Oc}from"./use-copy-qqj4mjMm.js";import{T as sn,a as on,b as ln}from"./tooltip-BnbMgAPE.js";import{M as Mo,I as Ic,F as Ph}from"./file-type-icon-Btmj3s_g.js";import{c as Lh}from"./content-blocks-o63cs2vh.js";import{g as Rc,M as _h}from"./types-DVbz3Se0.js";import{S as $h,f as _n,h as zh,c as Eo,a as Bh,u as Fh}from"./chat-context-D1kr0iC0.js";import{c as Hh,r as Vh,R as Wh}from"./hooks-DWV8tZMM.js";import{u as Uh}from"./studio-tools-CP8WMfwU.js";import{f as qh,k as Kh,l as Jh}from"./tab-id-BptcWVWa.js";import{d as Gh,u as jc,j as Xh}from"./use-mcp-client-CjFb2EJG.js";import{i as Dc}from"./AlertCircle-BfI2uSTY.js";import{s as Jr,t as Pc}from"./Star01-C784J1MM.js";import{s as Yh}from"./XClose-BH3szX7J.js";import{n as Bi}from"./ZapSquare-ZZzC2w-e.js";import{n as Lc,i as Qh}from"./Globe01-Dt2zRGYA.js";import{b as Zh,i as ep,a as Ar}from"./Tool01-oQmmJYZR.js";import{b as jl,a as tp}from"./ZoomOut-DajboEJA.js";import{i as Gn}from"./Monitor01-BMl8U0hF.js";import{i as np}from"./SearchMd-DkRuJ2gi.js";import{i as rp}from"./Upload01-gnC5_Ssm.js";import{b as sp,c as ip}from"./shell-layout-DHMpOaUJ.js";import{n as _c}from"./LinkExternal01-CzVttU_W.js";import{b as op,S as lp,c as ap,d as cp}from"./sheet-yZUVXUUg.js";import{I as Sr}from"./integration-icon-CI4vd8FM.js";import{a as up}from"./use-virtual-mcp-sNnLDxto.js";import{i as dp}from"./ArrowUpRight-CvSz9Amp.js";import{a as Ao}from"./Users03-DCLVPm8T.js";import{a as ot}from"./Palette-Dj5xh4DB.js";import{m as $c}from"./use-navigate-to-agent-DnY8W1Vs.js";import{a as fp}from"./use-connection-D4k9Jnol.js";import{a as hp}from"./Stars02-DYfXStsp.js";import{g as pp}from"./use-mcp-prompts-Ck43hw0S.js";import{a as mp,D as gp,e as yp,c as xp,d as bp}from"./dialog-B-qEKmGK.js";import{a as kp,F as Sp,b as vp,c as wp,d as Cp,f as Tp}from"./form-CVlSwq3w.js";import{I as Np}from"./input-DTeQSVLv.js";import{t as Mp}from"./ChevronDown-C2lrFcn0.js";import{e as Ep}from"./select-B5x2AUrZ.js";const Ap={openrouter:n=>{const e=n?.openrouter;return typeof e=="object"&&e!==null&&"usage"in e&&typeof e.usage=="object"&&e.usage!==null&&"cost"in e.usage&&typeof e.usage.cost=="number"?e.usage.cost:null}};function zc(n){if(!n?.providerMetadata)return 0;for(const e of Object.values(Ap)){const t=e(n.providerMetadata);if(t!==null)return t}return 0}function Bc(){return{inputTokens:0,outputTokens:0,reasoningTokens:0,totalTokens:0,cost:0,cacheReadTokens:0,cacheWriteTokens:0}}function Fc(n,e){if(!e)return n;const t=e.inputTokenDetails?.cacheReadTokens??e.cachedInputTokens??0,r=e.inputTokenDetails?.cacheWriteTokens??0;return{inputTokens:n.inputTokens+(e.inputTokens??0),outputTokens:n.outputTokens+(e.outputTokens??0),reasoningTokens:n.reasoningTokens+(e.reasoningTokens??0),totalTokens:n.totalTokens+(e.totalTokens??0),cost:n.cost+zc(e),cacheReadTokens:n.cacheReadTokens+t,cacheWriteTokens:n.cacheWriteTokens+r}}function gw(n){return n.reduce((e,t)=>Fc(e,t.metadata?.usage),Bc())}function Op(n){return n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function Oo(n){if(n&&typeof n=="object"&&"gatewayClientId"in n&&typeof n.gatewayClientId=="string")return n.gatewayClientId}function Io(n,e){if(!e)return n;const t=`${Op(e)}_`;return n.startsWith(t)?n.slice(t.length):n}function Ip(n,e){return Io(n,e).replace(/[_-]/g," ").toLowerCase()}function Rp(n){const e={};for(const t of n.arguments??[])e[t.name]=t.required?Ol().min(1,"Required"):Ol();return xc(e)}function jp(n,e){const t={};for(const r of n.arguments??[])t[r.name]=e?.[r.name]??"";return t}function Dp(n){const e=P.c(66),{prompt:t,setPrompt:r,onSubmit:s,defaultValues:i}=n,o=M.useId();let l;if(e[0]!==t){const $=t?Rp(t):xc({});l=ah($),e[0]=t,e[1]=l}else l=e[1];const c=l;let u;e[2]!==i||e[3]!==t?(u=t?jp(t,i):{},e[2]=i,e[3]=t,e[4]=u):u=e[4];let d;e[5]!==c||e[6]!==u?(d={resolver:c,defaultValues:u,mode:"onChange"},e[5]=c,e[6]=u,e[7]=d):d=e[7];const f=ch(d);let h;e[8]!==t?.arguments?(h=t?.arguments??[],e[8]=t?.arguments,e[9]=h):h=e[9];const m=h;let g;e[10]!==f||e[11]!==s||e[12]!==r?(g=async $=>{await s($),r(null),f.reset()},e[10]=f,e[11]=s,e[12]=r,e[13]=g):g=e[13];const y=g;let x;e[14]!==f||e[15]!==r?(x=$=>{$||(f.reset(),r(null))},e[14]=f,e[15]=r,e[16]=x):x=e[16];const b=x;if(!t)return null;let S;e[17]!==t._meta||e[18]!==t.name||e[19]!==t.title?(S=t.title||Ip(t.name,Oo(t._meta)),e[17]=t._meta,e[18]=t.name,e[19]=t.title,e[20]=S):S=e[20];let v;e[21]!==S?(v=p.jsx(mp,{children:p.jsx("span",{className:"capitalize",children:S})}),e[21]=S,e[22]=v):v=e[22];let k;e[23]!==t.description?(k=t.description&&p.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),e[23]=t.description,e[24]=k):k=e[24];let C;e[25]!==k||e[26]!==v?(C=p.jsxs(gp,{children:[v,k]}),e[25]=k,e[26]=v,e[27]=C):C=e[27];let w;e[28]!==f||e[29]!==y?(w=$=>{$.stopPropagation(),f.handleSubmit(y)($)},e[28]=f,e[29]=y,e[30]=w):w=e[30];let T;if(e[31]!==m||e[32]!==f.control||e[33]!==f.formState.isSubmitting){let $;e[35]!==f.control||e[36]!==f.formState.isSubmitting?($=B=>p.jsx(Sp,{control:f.control,name:B.name,render:J=>{const{field:Y}=J;return p.jsxs(vp,{children:[p.jsxs(wp,{className:"text-xs",children:[B.name,B.required?null:p.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),p.jsx(Cp,{children:p.jsx(Np,{...Y,value:Y.value??"",required:B.required,placeholder:B.description??"",className:"h-9",disabled:f.formState.isSubmitting})}),p.jsx(Tp,{})]})}},B.name),e[35]=f.control,e[36]=f.formState.isSubmitting,e[37]=$):$=e[37],T=m.map($),e[31]=m,e[32]=f.control,e[33]=f.formState.isSubmitting,e[34]=T}else T=e[34];let N;e[38]!==b?(N=()=>b(!1),e[38]=b,e[39]=N):N=e[39];let E;e[40]!==f.formState.isSubmitting||e[41]!==N?(E=p.jsx(lr,{type:"button",variant:"ghost",onClick:N,disabled:f.formState.isSubmitting,children:"Cancel"}),e[40]=f.formState.isSubmitting,e[41]=N,e[42]=E):E=e[42];let j;e[43]!==f.formState.isSubmitting?(j=f.formState.isSubmitting?p.jsxs("span",{className:"flex items-center gap-2",children:[p.jsx($h,{size:"xs"}),"Loading..."]}):"Use prompt",e[43]=f.formState.isSubmitting,e[44]=j):j=e[44];let L;e[45]!==f.formState.isSubmitting||e[46]!==o||e[47]!==j?(L=p.jsx(lr,{type:"submit",form:o,disabled:f.formState.isSubmitting,children:j}),e[45]=f.formState.isSubmitting,e[46]=o,e[47]=j,e[48]=L):L=e[48];let O;e[49]!==E||e[50]!==L?(O=p.jsxs(yp,{children:[E,L]}),e[49]=E,e[50]=L,e[51]=O):O=e[51];let D;e[52]!==o||e[53]!==w||e[54]!==T||e[55]!==O?(D=p.jsxs("form",{id:o,className:"space-y-4 py-4",autoComplete:"off",onSubmit:w,children:[T,O]}),e[52]=o,e[53]=w,e[54]=T,e[55]=O,e[56]=D):D=e[56];let R;e[57]!==f||e[58]!==D?(R=p.jsx(kp,{...f,children:D}),e[57]=f,e[58]=D,e[59]=R):R=e[59];let F;e[60]!==C||e[61]!==R?(F=p.jsxs(xp,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[C,R]}),e[60]=C,e[61]=R,e[62]=F):F=e[62];let z;return e[63]!==b||e[64]!==F?(z=p.jsx(bp,{open:!0,onOpenChange:b,children:F}),e[63]=b,e[64]=F,e[65]=z):z=e[65],z}function Hc(n){return n?n.replace(/[_-]/g," ").toLowerCase().split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "):""}function tt(n,e){return n==="output-error"||n==="output-denied"?"error":n==="approval-requested"?"approval":n==="input-streaming"||n==="input-available"||n==="output-available"&&e===!0?"loading":"idle"}function $n(n){if(n==null||typeof n!="object")return;const e=n;if(e.structuredContent&&typeof e.structuredContent=="object")return e.structuredContent;if(Array.isArray(e.content)){const t=e.content[0];if(t?.type==="text"&&typeof t.text=="string")try{return JSON.parse(t.text)}catch{return}return}return n}function Te(n){this.content=n}Te.prototype={constructor:Te,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,s=r.find(n),i=r.content.slice();return s==-1?i.push(t||n,e):(i[s+1]=e,t&&(i[s]=t)),new Te(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Te(t)},addToStart:function(n,e){return new Te([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Te(t)},addBefore:function(n,e,t){var r=this.remove(e),s=r.content.slice(),i=r.find(n);return s.splice(i==-1?s.length:i,0,e,t),new Te(s)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Te.from(n),n.size?new Te(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Te.from(n),n.size?new Te(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Te.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};Te.from=function(n){if(n instanceof Te)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Te(e)};function Vc(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),i=e.child(r);if(s==i){t+=s.nodeSize;continue}if(!s.sameMarkup(i))return t;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)t++;return t}if(s.content.size||i.content.size){let o=Vc(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function Wc(n,e,t,r){for(let s=n.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:t,b:r};let o=n.child(--s),l=e.child(--i),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;c<u&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||l.content.size){let c=Wc(o.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class A{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,s=0,i){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,s+l,i||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,s+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let i="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new A(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let i=0,o=0;o<t;i++){let l=this.content[i],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),s+=l.nodeSize),o=a}return new A(r,s)}cutByIndex(e,t){return e==t?A.empty:e==0&&t==this.content.length?this:new A(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new A(s,i)}addToStart(e){return new A([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new A(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return Vc(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Wc(this,e,t,r)}findIndex(e){if(e==0)return Or(0,e);if(e==this.size)return Or(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let s=this.child(t),i=r+s.nodeSize;if(i>=e)return i==e?Or(t+1,i):Or(t,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return A.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new A(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return A.empty;let t,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(t||(t=e.slice(0,s)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new A(t||e,r)}static from(e){if(!e)return A.empty;if(e instanceof A)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new A([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}A.empty=new A([],0);const ci={index:0,offset:0};function Or(n,e){return ci.index=n,ci.offset=e,ci}function Gr(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Gr(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Gr(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let ne=class Fi{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Gr(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let s=r.create(t.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Fi.none;if(e instanceof Fi)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};ne.none=[];class Xr extends Error{}class _{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=qc(this.content,e+this.openStart,t);return r&&new _(r,this.openStart,this.openEnd)}removeBetween(e,t){return new _(Uc(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return _.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new _(A.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)s++;return new _(e,r,s)}}_.empty=new _(A.empty,0,0);function Uc(n,e,t){let{index:r,offset:s}=n.findIndex(e),i=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(s==e||i.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(Uc(i.content,e-s-1,t-s-1)))}function qc(n,e,t,r){let{index:s,offset:i}=n.findIndex(e),o=n.maybeChild(s);if(i==e||o.isText)return r&&!r.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=qc(o.content,e-i-1,t,o);return l&&n.replaceChild(s,o.copy(l))}function Pp(n,e,t){if(t.openStart>n.depth)throw new Xr("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Xr("Inconsistent open depths");return Kc(n,e,t,0)}function Kc(n,e,t,r){let s=n.index(r),i=n.node(r);if(s==e.index(r)&&r<n.depth-t.openStart){let o=Kc(n,e,t,r+1);return i.copy(i.content.replaceChild(s,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,l=o.content;return Zt(o,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=Lp(t,n);return Zt(i,Gc(n,o,l,e,r))}else return Zt(i,Yr(n,e,r))}function Jc(n,e){if(!e.type.compatibleContent(n.type))throw new Xr("Cannot join "+e.type.name+" onto "+n.type.name)}function Hi(n,e,t){let r=n.node(t);return Jc(r,e.node(t)),r}function Qt(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function Xn(n,e,t,r){let s=(e||n).node(t),i=0,o=e?e.index(t):s.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(Qt(n.nodeAfter,r),i++));for(let l=i;l<o;l++)Qt(s.child(l),r);e&&e.depth==t&&e.textOffset&&Qt(e.nodeBefore,r)}function Zt(n,e){return n.type.checkContent(e),n.copy(e)}function Gc(n,e,t,r,s){let i=n.depth>s&&Hi(n,e,s+1),o=r.depth>s&&Hi(t,r,s+1),l=[];return Xn(null,n,s,l),i&&o&&e.index(s)==t.index(s)?(Jc(i,o),Qt(Zt(i,Gc(n,e,t,r,s+1)),l)):(i&&Qt(Zt(i,Yr(n,e,s+1)),l),Xn(e,t,s,l),o&&Qt(Zt(o,Yr(t,r,s+1)),l)),Xn(r,null,s,l),new A(l)}function Yr(n,e,t){let r=[];if(Xn(null,n,t,r),n.depth>t){let s=Hi(n,e,t+1);Qt(Zt(s,Yr(n,e,t+1)),r)}return Xn(e,null,t,r),new A(r)}function Lp(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)s=e.node(i).copy(A.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class ar{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(t);return r?e.child(t).cut(r):s}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],s=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return ne.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),s=e.maybeChild(t);if(!r){let l=r;r=s,s=l}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Qr(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],s=0,i=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(i),c=i-a;if(r.push(o,l,s+a),!c||(o=o.child(l),o.isText))break;i=c-1,s+=a+1}return new ar(t,r,i)}static resolveCached(e,t){let r=Dl.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==t)return o}else Dl.set(e,r=new _p);let s=r.elts[r.i]=ar.resolve(e,t);return r.i=(r.i+1)%$p,s}}class _p{constructor(){this.elts=[],this.i=0}}const $p=12,Dl=new WeakMap;class Qr{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const zp=Object.create(null);class et{constructor(e,t,r,s=ne.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||A.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,s=0){this.content.nodesBetween(e,t,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,s){return this.content.textBetween(e,t,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&Gr(this.attrs,t||e.defaultAttrs||zp)&&ne.sameSet(this.marks,r||ne.none)}copy(e=null){return e==this.content?this:new et(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new et(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return _.empty;let s=this.resolve(e),i=this.resolve(t),o=r?0:s.sharedDepth(t),l=s.start(o),c=s.node(o).content.cut(s.pos-l,i.pos-l);return new _(c,s.depth-o,i.depth-o)}replace(e,t,r){return Pp(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(s==e||t.isText)return t;e-=s+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let s=this.content.child(t-1);return{node:s,index:t-1,offset:r-s.nodeSize}}resolve(e){return ar.resolveCached(this,e)}resolveNoCache(e){return ar.resolve(this,e)}rangeHasMark(e,t,r){let s=!1;return t>e&&this.nodesBetween(e,t,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Xc(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=A.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=s;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=ne.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!ne.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let s=A.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,s,r);return i.type.checkAttrs(i.attrs),i}}et.prototype.text=void 0;class Zr extends et{constructor(e,t,r,s){if(super(e,t,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Xc(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Zr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Zr(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Xc(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class an{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Bp(e,t);if(r.next==null)return an.empty;let s=Yc(r);r.next&&r.err("Unexpected trailing text");let i=Kp(qp(s));return Jp(i,r),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let s=this;for(let i=t;s&&i<r;i++)s=s.matchType(e.child(i).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let s=[this];function i(o,l){let a=o.matchFragment(e,r);if(a&&(!t||a.validEnd))return A.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let f=i(d,l.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let l=s;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:l,next:a}=i.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!s.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&t(r.next[s].next)}return t(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
|
|
2
2
|
`)}}an.empty=new an(!0);class Bp{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Yc(n){let e=[];do e.push(Fp(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Fp(n){let e=[];do e.push(Hp(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Hp(n){let e=Up(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=Vp(n,e);else break;return e}function Pl(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Vp(n,e){let t=Pl(n),r=t;return n.eat(",")&&(n.next!="}"?r=Pl(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Wp(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let s=[];for(let i in t){let o=t[i];o.isInGroup(e)&&s.push(o)}return s.length==0&&n.err("No node type or group '"+e+"' found"),s}function Up(n){if(n.eat("(")){let e=Yc(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=Wp(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function qp(n){let e=[[]];return s(i(n,0),t()),e;function t(){return e.push([])-1}function r(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function s(o,l){o.forEach(a=>a.to=l)}function i(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(i(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=i(o.exprs[a],l);if(a==o.exprs.length-1)return c;s(c,l=t())}else if(o.type=="star"){let a=t();return r(l,a),s(i(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=t();return s(i(o.expr,l),a),s(i(o.expr,a),a),[r(a)]}else{if(o.type=="opt")return[r(l)].concat(i(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c<o.min;c++){let u=t();s(i(o.expr,a),u),a=u}if(o.max==-1)s(i(o.expr,a),a);else for(let c=o.min;c<o.max;c++){let u=t();r(a,u),s(i(o.expr,a),u),a=u}return[r(a)]}else{if(o.type=="name")return[r(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function Qc(n,e){return e-n}function Ll(n,e){let t=[];return r(e),t.sort(Qc);function r(s){let i=n[s];if(i.length==1&&!i[0].term)return r(i[0].to);t.push(s);for(let o=0;o<i.length;o++){let{term:l,to:a}=i[o];!l&&t.indexOf(a)==-1&&r(a)}}}function Kp(n){let e=Object.create(null);return t(Ll(n,0));function t(r){let s=[];r.forEach(o=>{n[o].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<s.length;u++)s[u][0]==l&&(c=s[u][1]);Ll(n,a).forEach(u=>{c||s.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new an(r.indexOf(n.length-1)>-1);for(let o=0;o<s.length;o++){let l=s[o][1].sort(Qc);i.next.push({type:s[o][0],next:e[l.join(",")]||t(l)})}return i}}function Jp(n,e){for(let t=0,r=[n];t<r.length;t++){let s=r[t],i=!s.validEnd,o=[];for(let l=0;l<s.next.length;l++){let{type:a,next:c}=s.next[l];o.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Zc(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function eu(n,e){let t=Object.create(null);for(let r in n){let s=e&&e[r];if(s===void 0){let i=n[r];if(i.hasDefault)s=i.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=s}return t}function tu(n,e,t,r){for(let s in e)if(!(s in n))throw new RangeError(`Unsupported attribute ${s} for ${t} of type ${s}`);for(let s in n){let i=n[s];i.validate&&i.validate(e[s])}}function nu(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new Xp(n,r,e[r]);return t}let _l=class ru{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=nu(e,r.attrs),this.defaultAttrs=Zc(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==an.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:eu(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new et(this,this.computeAttrs(e),A.from(t),ne.setFrom(r))}createChecked(e=null,t,r){return t=A.from(t),this.checkContent(t),new et(this,this.computeAttrs(e),t,ne.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=A.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let s=this.contentMatch.matchFragment(t),i=s&&s.fillBefore(A.empty,!0);return i?new et(this,e,t.append(i),ne.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){tu(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:ne.none:e}static compile(e,t){let r=Object.create(null);e.forEach((i,o)=>r[i]=new ru(i,t,o));let s=t.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function Gp(n,e,t){let r=t.split("|");return s=>{let i=s===null?"null":typeof s;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${i}`)}}class Xp{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Gp(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Hs{constructor(e,t,r,s){this.name=e,this.rank=t,this.schema=r,this.spec=s,this.attrs=nu(e,s.attrs),this.excluded=null;let i=Zc(this.attrs);this.instance=i?new ne(this,i):null}create(e=null){return!e&&this.instance?this.instance:new ne(this,eu(this.attrs,e))}static compile(e,t){let r=Object.create(null),s=0;return e.forEach((i,o)=>r[i]=new Hs(i,s++,t,o)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){tu(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class su{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let s in e)t[s]=e[s];t.nodes=Te.from(e.nodes),t.marks=Te.from(e.marks||{}),this.nodes=_l.compile(this.spec.nodes,this),this.marks=Hs.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let i=this.nodes[s],o=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=an.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?$l(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let s in this.marks){let i=this.marks[s],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:$l(this,o.split(" "))}this.nodeFromJSON=s=>et.fromJSON(this,s),this.markFromJSON=s=>ne.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof _l){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,s)}text(e,t){let r=this.nodes.text;return new Zr(r,r.defaultAttrs,e,ne.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function $l(n,e){let t=[];for(let r=0;r<e.length;r++){let s=e[r],i=n.marks[s],o=i;if(i)t.push(i);else for(let l in n.marks){let a=n.marks[l];(s=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(s)>-1)&&t.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function Yp(n){return n.tag!=null}function Qp(n){return n.style!=null}class It{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(s=>{if(Yp(s))this.tags.push(s);else if(Qp(s)){let i=/[^=]*/.exec(s.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let i=e.nodes[s.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let r=new Bl(this,t,!1);return r.addAll(e,ne.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Bl(this,t,!0);return r.addAll(e,ne.none,t.from,t.to),_.maxOpen(r.finish())}matchTag(e,t,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let i=this.tags[s];if(tm(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){let o=i.getAttrs(e);if(o===!1)continue;i.attrs=o||void 0}return i}}}matchStyle(e,t,r,s){for(let i=s?this.styles.indexOf(s)+1:0;i<this.styles.length;i++){let o=this.styles[i],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let t=[];function r(s){let i=s.priority==null?50:s.priority,o=0;for(;o<t.length;o++){let l=t[o];if((l.priority==null?50:l.priority)<i)break}t.splice(o,0,s)}for(let s in e.marks){let i=e.marks[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Fl(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let i=e.nodes[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Fl(o)),o.node||o.ignore||o.mark||(o.node=s)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new It(e,It.schemaRules(e)))}}const iu={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Zp={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ou={ol:!0,ul:!0},cr=1,Vi=2,Yn=4;function zl(n,e,t){return e!=null?(e?cr:0)|(e==="full"?Vi:0):n&&n.whitespace=="pre"?cr|Vi:t&~Yn}class Ir{constructor(e,t,r,s,i,o){this.type=e,this.attrs=t,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=ne.none,this.match=i||(o&Yn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(A.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&cr)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-s[0].length))}}let t=A.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(A.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!iu.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Bl{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=t.topNode,i,o=zl(null,t.preserveWhitespace,0)|(r?Yn:0);s?i=new Ir(s.type,s.attrs,ne.none,!0,t.topMatch||s.type.contentMatch,o):r?i=new Ir(null,null,ne.none,!0,null,o):i=new Ir(e.schema.topNodeType,null,ne.none,!0,null,o),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,s=this.top,i=s.options&Vi?"full":this.localPreserveWS||(s.options&cr)>0,{schema:o}=this.parser;if(i==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
|
|
3
3
|
`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(o.linebreakReplacement.create(),t,!0),l[a]&&this.insertNode(o.text(l[a]),t,!/\S/.test(l[a]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=s.content[s.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let s=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),l;ou.hasOwnProperty(o)&&this.parser.normalizeLists&&em(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:Zp.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,u=this.needsBlock;if(iu.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let d=a&&a.skip?t:this.readStyles(e,t);d&&this.addAll(e,d),c&&this.sync(i),this.needsBlock=u}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=s}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
4
4
|
`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let i=this.parser.matchedStyles[s],o=r.getPropertyValue(i);if(o)for(let l=void 0;;){let a=this.parser.matchStyle(i,o,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(c=>!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,r,s){let i,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(o,t.attrs||null,r,t.preserveWhitespace);a&&(i=!0,r=a)}else{let a=this.parser.schema.marks[t.mark];r=r.concat(a.create(t.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,t,r,s){let i=r||0;for(let o=r?e.childNodes[r]:e.firstChild,l=s==null?null:e.childNodes[s];o!=l;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,t);this.findAtPoint(e,i)}findPlace(e,t,r){let s,i;for(let o=this.open,l=0;o>=0;o--){let a=this.nodes[o],c=a.findWrapping(e);if(c&&(!s||s.length>c.length+l)&&(s=c,i=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!s)return null;this.sync(i);for(let o=0;o<s.length;o++)t=this.enterInner(s[o],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let s=this.findPlace(e,t,r);if(s){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=ne.none;for(let l of s.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):Hl(l.type,e.type))&&(o=l.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,t,r,s){let i=this.findPlace(e.create(t),r,!1);return i&&(i=this.enterInner(e,t,r,!0,s)),i}enterInner(e,t,r,s=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=zl(e,i,o.options);o.options&Yn&&o.content.length==0&&(l|=Yn);let a=ne.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):Hl(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new Ir(e,t,a,s,null,l)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=cr)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&t.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(s?0:1),o=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=i;a--)if(o(l-1,a))return!0;return!1}else{let u=a>0||a==0&&s?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function em(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&ou.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function tm(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Fl(n){let e={};for(let t in n)e[t]=n[t];return e}function Hl(n,e){let t=e.schema.nodes;for(let r in t){let s=t[r];if(!s.allowsMarkType(n))continue;let i=[],o=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||i.indexOf(u)<0&&o(u))return!0}};if(o(s.contentMatch))return!0}}class pn{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=ui(t).createDocumentFragment());let s=r,i=[];return e.forEach(o=>{if(i.length||o.marks.length){let l=0,a=0;for(;l<i.length&&a<o.marks.length;){let c=o.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(i[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)s=i.pop()[1];for(;a<o.marks.length;){let c=o.marks[a++],u=this.serializeMark(c,o.isInline,t);u&&(i.push([c,s]),s.appendChild(u.dom),s=u.contentDOM||u.dom)}}s.appendChild(this.serializeNodeInner(o,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:s}=Vr(ui(t),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,s)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let s=e.marks.length-1;s>=0;s--){let i=this.serializeMark(e.marks[s],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,t,r={}){let s=this.marks[e.type.name];return s&&Vr(ui(r),s(e,t),null,e.attrs)}static renderSpec(e,t,r=null,s){return Vr(e,t,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new pn(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Vl(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Vl(e.marks)}}function Vl(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function ui(n){return n.document||window.document}const Wl=new WeakMap;function nm(n){let e=Wl.get(n);return e===void 0&&Wl.set(n,e=rm(n)),e}function rm(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let s=0;s<r.length;s++)t(r[s]);else for(let s in r)t(r[s])}return t(n),e}function Vr(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let s=e[0],i;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=nm(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=s.indexOf(" ");o>0&&(t=s.slice(0,o),s=s.slice(o+1));let l,a=t?n.createElementNS(t,s):n.createElement(s),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?a.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&a.style?a.style.cssText=c[d]:a.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:m}=Vr(n,f,t,r);if(a.appendChild(h),m){if(l)throw new RangeError("Multiple content holes");l=m}}}return{dom:a,contentDOM:l}}const lu=65535,au=Math.pow(2,16);function sm(n,e){return n+e*au}function Ul(n){return n&lu}function im(n){return(n-(n&lu))/au}const cu=1,uu=2,Wr=4,du=8;class Wi{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&du)>0}get deletedBefore(){return(this.delInfo&(cu|Wr))>0}get deletedAfter(){return(this.delInfo&(uu|Wr))>0}get deletedAcross(){return(this.delInfo&Wr)>0}}class Fe{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Fe.empty)return Fe.empty}recover(e){let t=0,r=Ul(e);if(!this.inverted)for(let s=0;s<r;s++)t+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+t+im(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let s=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?s:0);if(a>e)break;let c=this.ranges[l+i],u=this.ranges[l+o],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:t:t,h=a+s+(f<0?0:u);if(r)return h;let m=e==(t<0?a:d)?null:sm(l/3,e-a),g=e==a?uu:e==d?cu:Wr;return(t<0?e!=a:e!=d)&&(g|=du),new Wi(h,g,m)}s+=u-c}return r?e+s:new Wi(e+s,0,null)}touches(e,t){let r=0,s=Ul(t),i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+i],u=a+c;if(e<=u&&l==s*3)return!0;r+=this.ranges[l+o]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let o=this.ranges[s],l=o-(this.inverted?i:0),a=o+(this.inverted?0:i),c=this.ranges[s+t],u=this.ranges[s+r];e(l,l+c,a,a+u),i+=u-c}}invert(){return new Fe(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Fe.empty:new Fe(e<0?[0,-e,0]:[0,0,e])}}Fe.empty=new Fe([]);class ur{constructor(e,t,r=0,s=e?e.length:0){this.mirror=t,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new ur(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,r=this._maps.length;t<e._maps.length;t++){let s=e.getMirror(t);this.appendMap(e._maps[t],s!=null&&s<t?r+s:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this._maps.length+e._maps.length;t>=0;t--){let s=e.getMirror(t);this.appendMap(e._maps[t].invert(),s!=null&&s>t?r-s-1:void 0)}}invert(){let e=new ur;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let s=0;for(let i=this.from;i<this.to;i++){let o=this._maps[i],l=o.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this._maps[a].recover(l.recover);continue}}s|=l.delInfo,e=l.pos}return r?e:new Wi(e,s,null)}}const di=Object.create(null);class De{getMap(){return Fe.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=di[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in di)throw new RangeError("Duplicate use of step JSON ID "+e);return di[e]=t,t.prototype.jsonID=e,t}}class me{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new me(e,null)}static fail(e){return new me(null,e)}static fromReplace(e,t,r,s){try{return me.ok(e.replace(t,r,s))}catch(i){if(i instanceof Xr)return me.fail(i.message);throw i}}}function Ro(n,e,t){let r=[];for(let s=0;s<n.childCount;s++){let i=n.child(s);i.content.size&&(i=i.copy(Ro(i.content,e,i))),i.isInline&&(i=e(i,t,s)),r.push(i)}return A.fromArray(r)}class Mt extends De{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),i=new _(Ro(t.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),t.openStart,t.openEnd);return me.fromReplace(e,this.from,this.to,i)}invert(){return new Ze(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Mt(t.pos,r.pos,this.mark)}merge(e){return e instanceof Mt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Mt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Mt(t.from,t.to,e.markFromJSON(t.mark))}}De.jsonID("addMark",Mt);class Ze extends De{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new _(Ro(t.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),t.openStart,t.openEnd);return me.fromReplace(e,this.from,this.to,r)}invert(){return new Mt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Ze(t.pos,r.pos,this.mark)}merge(e){return e instanceof Ze&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ze(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Ze(t.from,t.to,e.markFromJSON(t.mark))}}De.jsonID("removeMark",Ze);class Et extends De{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return me.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return me.fromReplace(e,this.pos,this.pos+1,new _(A.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let s=0;s<t.marks.length;s++)if(!t.marks[s].isInSet(r))return new Et(this.pos,t.marks[s]);return new Et(this.pos,this.mark)}}return new cn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Et(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Et(t.pos,e.markFromJSON(t.mark))}}De.jsonID("addNodeMark",Et);class cn extends De{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return me.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return me.fromReplace(e,this.pos,this.pos+1,new _(A.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Et(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new cn(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new cn(t.pos,e.markFromJSON(t.mark))}}De.jsonID("removeNodeMark",cn);class pe extends De{constructor(e,t,r,s=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=s}apply(e){return this.structure&&Ui(e,this.from,this.to)?me.fail("Structure replace would overwrite content"):me.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Fe([this.from,this.to-this.from,this.slice.size])}invert(e){return new pe(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),r=this.from==this.to&&pe.MAP_BIAS<0?t:e.mapResult(this.from,1);return r.deletedAcross&&t.deletedAcross?null:new pe(r.pos,Math.max(r.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof pe)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?_.empty:new _(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new pe(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?_.empty:new _(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new pe(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new pe(t.from,t.to,_.fromJSON(e,t.slice),!!t.structure)}}pe.MAP_BIAS=1;De.jsonID("replace",pe);class ve extends De{constructor(e,t,r,s,i,o,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=l}apply(e){if(this.structure&&(Ui(e,this.from,this.gapFrom)||Ui(e,this.gapTo,this.to)))return me.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return me.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?me.fromReplace(e,this.from,this.to,r):me.fail("Content does not fit in gap")}getMap(){return new Fe([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new ve(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),s=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||s<t.pos||i>r.pos?null:new ve(t.pos,r.pos,s,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ve(t.from,t.to,t.gapFrom,t.gapTo,_.fromJSON(e,t.slice),t.insert,!!t.structure)}}De.jsonID("replaceAround",ve);function Ui(n,e,t){let r=n.resolve(e),s=t-e,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function om(n,e,t,r){let s=[],i=[],o,l;n.doc.nodesBetween(e,t,(a,c,u)=>{if(!a.isInline)return;let d=a.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+a.nodeSize,t),m=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(m)||(o&&o.to==f&&o.mark.eq(d[g])?o.to=h:s.push(o=new Ze(f,h,d[g])));l&&l.to==f?l.to=h:i.push(l=new Mt(f,h,r))}}),s.forEach(a=>n.step(a)),i.forEach(a=>n.step(a))}function lm(n,e,t,r){let s=[],i=0;n.doc.nodesBetween(e,t,(o,l)=>{if(!o.isInline)return;i++;let a=null;if(r instanceof Hs){let c=o.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(a=[r]):a=o.marks;if(a&&a.length){let c=Math.min(l+o.nodeSize,t);for(let u=0;u<a.length;u++){let d=a[u],f;for(let h=0;h<s.length;h++){let m=s[h];m.step==i-1&&d.eq(s[h].style)&&(f=m)}f?(f.to=c,f.step=i):s.push({style:d,from:Math.max(l,e),to:c,step:i})}}}),s.forEach(o=>n.step(new Ze(o.from,o.to,o.style)))}function jo(n,e,t,r=t.contentMatch,s=!0){let i=n.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a<i.childCount;a++){let c=i.child(a),u=l+c.nodeSize,d=r.matchType(c.type);if(!d)o.push(new pe(l,u,_.empty));else{r=d;for(let f=0;f<c.marks.length;f++)t.allowsMarkType(c.marks[f].type)||n.step(new Ze(l,u,c.marks[f]));if(s&&c.isText&&t.whitespace!="pre"){let f,h=/\r?\n|\r/g,m;for(;f=h.exec(c.text);)m||(m=new _(A.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new pe(l+f.index,l+f.index+f[0].length,m))}}l=u}if(!r.validEnd){let a=r.fillBefore(A.empty,!0);n.replace(l,l,new _(a,0,0))}for(let a=o.length-1;a>=0;a--)n.step(o[a])}function am(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function zn(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,s=0,i=0;;--r){let o=n.$from.node(r),l=n.$from.index(r)+s,a=n.$to.indexAfter(r)-i;if(r<n.depth&&o.canReplace(l,a,t))return r;if(r==0||o.type.spec.isolating||!am(o,l,a))break;l&&(s=1),a<o.childCount&&(i=1)}return null}function cm(n,e,t){let{$from:r,$to:s,depth:i}=e,o=r.before(i+1),l=s.after(i+1),a=o,c=l,u=A.empty,d=0;for(let m=i,g=!1;m>t;m--)g||r.index(m)>0?(g=!0,u=A.from(r.node(m).copy(u)),d++):a--;let f=A.empty,h=0;for(let m=i,g=!1;m>t;m--)g||s.after(m+1)<s.end(m)?(g=!0,f=A.from(s.node(m).copy(f)),h++):c++;n.step(new ve(a,c,o,l,new _(u.append(f),d,h),u.size-d,!0))}function Do(n,e,t=null,r=n){let s=um(n,e),i=s&&dm(r,e);return i?s.map(ql).concat({type:e,attrs:t}).concat(i.map(ql)):null}function ql(n){return{type:n,attrs:null}}function um(n,e){let{parent:t,startIndex:r,endIndex:s}=n,i=t.contentMatchAt(r).findWrapping(e);if(!i)return null;let o=i.length?i[0]:e;return t.canReplaceWith(r,s,o)?i:null}function dm(n,e){let{parent:t,startIndex:r,endIndex:s}=n,i=t.child(r),o=e.contentMatch.findWrapping(i.type);if(!o)return null;let a=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;a&&c<s;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:o}function fm(n,e,t){let r=A.empty;for(let o=t.length-1;o>=0;o--){if(r.size){let l=t[o].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=A.from(t[o].type.create(t[o].attrs,r))}let s=e.start,i=e.end;n.step(new ve(s,i,s,i,new _(r,0,0),t.length,!0))}function hm(n,e,t,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(o,l)=>{let a=typeof s=="function"?s(o):s;if(o.isTextblock&&!o.hasMarkup(r,a)&&pm(n.doc,n.mapping.slice(i).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!m?c=!1:!h&&m&&(c=!0)}c===!1&&hu(n,o,l,i),jo(n,n.mapping.slice(i).map(l,1),r,void 0,c===null);let u=n.mapping.slice(i),d=u.map(l,1),f=u.map(l+o.nodeSize,1);return n.step(new ve(d,f,d+1,f-1,new _(A.from(r.create(a,null,o.marks)),0,0),1,!0)),c===!0&&fu(n,o,l,i),!1}})}function fu(n,e,t,r){e.forEach((s,i)=>{if(s.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(s.text);){let a=n.mapping.slice(r).map(t+1+i+o.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function hu(n,e,t,r){e.forEach((s,i)=>{if(s.type==s.type.schema.linebreakReplacement){let o=n.mapping.slice(r).map(t+1+i);n.replaceWith(o,o+1,e.type.schema.text(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as b,c as w,j as a,l as j}from"./index-
|
|
1
|
+
import{e as b,c as w,j as a,l as j}from"./index-D3rW8rSB.js";import{i as N}from"./SearchMd-DkRuJ2gi.js";function S(f){const e=b.c(17),{value:l,onChange:c,placeholder:g,onKeyDown:d,className:u,isSearching:p,disabled:i}=f,m=g===void 0?"Search...":g,x=i&&"pointer-events-none opacity-50";let t;e[0]!==u||e[1]!==x?(t=w("flex items-center gap-4 rounded-lg bg-background dark:bg-input/30 px-3 h-8 card-shadow","focus-within:border-ring focus-within:ring-ring/20 focus-within:ring-[2px]","transition-[color,box-shadow]",x,u),e[0]=u,e[1]=x,e[2]=t):t=e[2];let n;e[3]!==p?(n=p?a.jsx(j,{size:16,className:"animate-spin text-muted-foreground/75 shrink-0"}):a.jsx(N,{size:16,className:"text-muted-foreground/75 shrink-0"}),e[3]=p,e[4]=n):n=e[4];let s;e[5]!==c?(s=h=>c(h.target.value),e[5]=c,e[6]=s):s=e[6];let o;e[7]!==i||e[8]!==d||e[9]!==m||e[10]!==s||e[11]!==l?(o=a.jsx("input",{type:"text",value:l,onChange:s,onKeyDown:d,placeholder:m,disabled:i,className:"flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 outline-none"}),e[7]=i,e[8]=d,e[9]=m,e[10]=s,e[11]=l,e[12]=o):o=e[12];let r;return e[13]!==t||e[14]!==n||e[15]!==o?(r=a.jsxs("label",{className:t,children:[n,o]}),e[13]=t,e[14]=n,e[15]=o,e[16]=r):r=e[16],r}export{S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as p,j as t,a1 as P,r as j,ae as w,B as S,n as y}from"./index-
|
|
1
|
+
import{e as p,j as t,a1 as P,r as j,ae as w,B as S,n as y}from"./index-D3rW8rSB.js";import{i as k}from"./AlertCircle-BfI2uSTY.js";import{s as z}from"./Plus-D1OarKqc.js";import{s as F}from"./User01-5m1v97Pd.js";import{t as E}from"./Users01-D3elJs6Y.js";import{d as $,c as I,D as O,a as A,b as R,e as T}from"./dialog-B-qEKmGK.js";import{I as N}from"./input-DTeQSVLv.js";import{L as g}from"./label-CQsaTPJ3.js";import{d as B,b as V,c as L,S as q,a as C}from"./select-B5x2AUrZ.js";import{S as H}from"./skeleton-DLJHpAXs.js";import{T as K}from"./textarea-CwJzHeYB.js";import{P as b}from"./index-BW-4wD8s.js";import{c as W}from"./settings-section-CNFUQN3R.js";import{u as Y,a as G}from"./use-secrets-B4zusNgt.js";import{R as J}from"./require-capability-D2jcbcRo.js";import"./X-ZEmMP3Rp.js";import"./tooltip-BnbMgAPE.js";import"./ChevronUp-B3hXWHxa.js";import"./ChevronDown-C2lrFcn0.js";import"./sidebar-Dmsmn1q4.js";import"./LayoutLeft-BcwHG1_h.js";import"./sheet-yZUVXUUg.js";import"./card-xuJ9Fzgg.js";import"./ArrowUpRight-CvSz9Amp.js";import"./studio-tools-CP8WMfwU.js";import"./use-capability-Cc8N2DWQ.js";import"./access-gate-CDCGTwMX.js";import"./capability-load-error-BId-7K5n.js";function M(s){const e=p.c(3),{error:r}=s;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(k,{size:16}),e[0]=c):c=e[0];let n;return e[1]!==r.message?(n=t.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[c,t.jsxs("span",{className:"text-sm font-medium",children:["Failed to load secrets: ",r.message]})]}),e[1]=r.message,e[2]=n):n=e[2],n}function Q(s){const e=p.c(5),{scope:r}=s,c=r==="user"?F:E,n=r==="user"?"Private":"Organization";let i;e[0]!==c?(i=t.jsx(c,{size:12}),e[0]=c,e[1]=i):i=e[1];let a;return e[2]!==n||e[3]!==i?(a=t.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-md bg-muted text-muted-foreground text-xs",children:[i,n]}),e[2]=n,e[3]=i,e[4]=a):a=e[4],a}function D(s){const e=p.c(20),{secret:r}=s;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"size-9 rounded-md bg-muted flex items-center justify-center shrink-0",children:t.jsx(w,{size:16,className:"text-muted-foreground"})}),e[0]=c):c=e[0];let n;e[1]!==r.name?(n=t.jsx("span",{className:"font-medium text-sm truncate",children:r.name}),e[1]=r.name,e[2]=n):n=e[2];let i;e[3]!==r.scope?(i=t.jsx(Q,{scope:r.scope}),e[3]=r.scope,e[4]=i):i=e[4];let a;e[5]!==n||e[6]!==i?(a=t.jsxs("div",{className:"flex items-center gap-2",children:[n,i]}),e[5]=n,e[6]=i,e[7]=a):a=e[7];let d;e[8]!==r.description?(d=r.description?t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:r.description}):null,e[8]=r.description,e[9]=d):d=e[9];let u;e[10]!==a||e[11]!==d?(u=t.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[c,t.jsxs("div",{className:"min-w-0",children:[a,d]})]}),e[10]=a,e[11]=d,e[12]=u):u=e[12];let l;e[13]!==r.createdAt?(l=new Date(r.createdAt).toLocaleDateString(),e[13]=r.createdAt,e[14]=l):l=e[14];let o;e[15]!==l?(o=t.jsx("div",{className:"text-xs text-muted-foreground shrink-0",children:l}),e[15]=l,e[16]=o):o=e[16];let x;return e[17]!==u||e[18]!==o?(x=t.jsxs("div",{className:"flex items-start justify-between gap-4 py-3 border-b border-border/60 last:border-b-0",children:[u,o]}),e[17]=u,e[18]=o,e[19]=x):x=e[19],x}function U(s){const e=p.c(5),{onCreate:r}=s;let c,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"size-12 rounded-full bg-muted flex items-center justify-center",children:t.jsx(w,{size:20,className:"text-muted-foreground"})}),n=t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-sm",children:"No secrets yet"}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:"Store API keys, tokens, and other sensitive values. Values are encrypted at rest and never returned over the API."})]}),e[0]=c,e[1]=n):(c=e[0],n=e[1]);let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(z,{size:14}),e[2]=i):i=e[2];let a;return e[3]!==r?(a=t.jsxs("div",{className:"rounded-2xl border border-dashed border-border/60 p-10 flex flex-col items-center justify-center text-center gap-3",children:[c,n,t.jsxs(S,{onClick:r,size:"sm",className:"mt-2",children:[i,"New secret"]})]}),e[3]=r,e[4]=a):a=e[4],a}function _({open:s,onOpenChange:e}){const[r,c]=j.useState("organization"),[n,i]=j.useState(""),[a,d]=j.useState(""),[u,l]=j.useState(""),o=G();function x(){c("organization"),i(""),d(""),l("")}function f(){x(),e(!1)}async function h(m){if(m.preventDefault(),!(!n.trim()||!a))try{await o.mutateAsync({scope:r,name:n.trim(),value:a,description:u.trim()||void 0}),y.success(`Secret "${n.trim()}" created`),f()}catch(v){y.error(v instanceof Error?v.message:"Failed to create secret")}}return t.jsx($,{open:s,onOpenChange:m=>{m?e(m):f()},children:t.jsxs(I,{className:"sm:max-w-lg",children:[t.jsxs(O,{children:[t.jsx(A,{children:"New secret"}),t.jsx(R,{children:"Stored encrypted in the credential vault. Choose who can read it."})]}),t.jsxs("form",{onSubmit:h,className:"space-y-4",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-scope",children:"Scope"}),t.jsxs(B,{value:r,onValueChange:m=>c(m),children:[t.jsx(V,{id:"secret-scope",children:t.jsx(L,{})}),t.jsxs(q,{children:[t.jsx(C,{value:"organization",children:"Organization — visible to all members"}),t.jsx(C,{value:"user",children:"Private — only visible to me"})]})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-name",children:"Name"}),t.jsx(N,{id:"secret-name",value:n,onChange:m=>i(m.target.value),placeholder:"STRIPE_API_KEY",autoComplete:"off",required:!0}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Letters, digits, underscore, dot, hyphen. Case-insensitive within its scope."})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-value",children:"Value"}),t.jsx(N,{id:"secret-value",type:"password",value:a,onChange:m=>d(m.target.value),autoComplete:"new-password",required:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-description",children:"Description (optional)"}),t.jsx(K,{id:"secret-description",value:u,onChange:m=>l(m.target.value),rows:2,placeholder:"What is this secret used for?"})]}),t.jsxs(T,{children:[t.jsx(S,{type:"button",variant:"outline",onClick:f,disabled:o.isPending,children:"Cancel"}),t.jsx(S,{type:"submit",disabled:o.isPending||!n.trim()||!a,children:o.isPending?"Creating…":"Create secret"})]})]})]})})}function X(){const s=p.c(21),e=Y(),[r,c]=j.useState(!1);if(e.length===0){let l;s[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(U,{onCreate:()=>c(!0)}),s[0]=l):l=s[0];let o;return s[1]!==r?(o=t.jsxs(t.Fragment,{children:[l,t.jsx(_,{open:r,onOpenChange:c})]}),s[1]=r,s[2]=o):o=s[2],o}let n,i,a;if(s[3]!==e){const l=e.filter(se),o=e.filter(te),x=e.length===1?"":"s";let f;s[7]!==e.length||s[8]!==x?(f=t.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.length," secret",x," stored"]}),s[7]=e.length,s[8]=x,s[9]=f):f=s[9];let h;s[10]===Symbol.for("react.memo_cache_sentinel")?(h=()=>c(!0),s[10]=h):h=s[10];let m;s[11]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs(S,{onClick:h,size:"sm",children:[t.jsx(z,{size:14}),"New secret"]}),s[11]=m):m=s[11],s[12]!==f?(n=t.jsxs("div",{className:"flex items-center justify-between",children:[f,m]}),s[12]=f,s[13]=n):n=s[13],i=l.length>0?t.jsxs("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:[t.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Organization"}),t.jsx("div",{children:l.map(ee)})]}):null,a=o.length>0?t.jsxs("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:[t.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Private to me"}),t.jsx("div",{children:o.map(Z)})]}):null,s[3]=e,s[4]=n,s[5]=i,s[6]=a}else n=s[4],i=s[5],a=s[6];let d;s[14]!==r?(d=t.jsx(_,{open:r,onOpenChange:c}),s[14]=r,s[15]=d):d=s[15];let u;return s[16]!==n||s[17]!==i||s[18]!==a||s[19]!==d?(u=t.jsxs(t.Fragment,{children:[n,i,a,d]}),s[16]=n,s[17]=i,s[18]=a,s[19]=d,s[20]=u):u=s[20],u}function Z(s){return t.jsx(D,{secret:s},s.id)}function ee(s){return t.jsx(D,{secret:s},s.id)}function te(s){return s.scope==="user"}function se(s){return s.scope==="organization"}function re(){const s=p.c(2);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(b.Title,{children:"Secrets"}),s[0]=e):e=s[0];let r;return s[1]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(b,{children:t.jsx(b.Content,{children:t.jsx(b.Body,{children:t.jsxs(W,{children:[e,t.jsx(P,{fallback:ne,children:t.jsx(j.Suspense,{fallback:t.jsx(H,{className:"h-32 w-full"}),children:t.jsx(X,{})})})]})})})}),s[1]=r):r=s[1],r}function ne(s){const{error:e}=s;return t.jsx(M,{error:e??new Error("Failed to load secrets")})}function $e(){const s=p.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(J,{capability:"secrets:manage",area:"secrets",children:t.jsx(re,{})}),s[0]=e):e=s[0],e}export{$e as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{e as Ie,r as _,j as t,B as Fe,l as Ut,c as Ce,F as Gs,n as fe,K as ea}from"./index-rm3C3HAe.js";import{r as ta,i as Tn,c as na,G as sa,a as xt,b as aa,d as ra,e as ia,f as oa,g as la,h as ca,j as ua,k as da,l as ma,m as vt,p as St,n as fa,o as Ot,q as Qe,s as Sn,t as bn,P as pa,v as $t,w as ha,x as ga,y as va,z as Sa,A as ba,B as xa,C as ya,D as dt,E as ja,F as _a,H as ka,I as wa,J as Na,K as Ra,L as Ca,M as Da,N as Kt,O as Ta,Q as xn,R as Pa,S as Aa,T as Va,U as Bt,V as Ma,W as Ea,X as yn}from"./index-Dqht8t56.js";import{t as Oa}from"./ChevronDown-DniEvTjW.js";import{i as $a}from"./ChevronRight-CVU8CEAx.js";import{n as Ka}from"./ChevronUp-lUGooUMN.js";import{K as zt,D as Pn,R as An,l as Ba,L as Fa,M as La}from"./agent-icon-DzGGkbHB.js";import{i as za}from"./Globe01-CjtjZc8W.js";import{S as bt}from"./scroll-area-HiEpDNZ9.js";import{b as st,T as at,a as rt}from"./tooltip-muTAVYsN.js";import{a as Vn,D as Mn,b as En,e as On,c as $n,d as Kn}from"./dialog-ZcUt91qN.js";import{I as Bn}from"./input-YP3xr2b6.js";import{s as Ia,a as Ha}from"./Eye-Da_GEN8c.js";import{c as Ua}from"./ZoomOut-D3PYnATq.js";import{b as Wa}from"./Settings02-9iZ4Kn5K.js";import{s as It}from"./Plus-C95a6sD7.js";import{s as Fn}from"./Trash01-Dr7Z-Rtu.js";import{i as qa}from"./Zap-CTngI1pZ.js";import{c as nt,a as Ln,D as zn,b as In,g as Ja}from"./dropdown-menu-CanZ1iuF.js";import{u as Hn,a as yt,K as Un,P as Wn,b as qn,C as Jn,s as Yn,d as mt,D as Zn,c as Qn,S as Xn,v as Ya,e as Gn,h as Za}from"./sortable.esm-C4XXVlGw.js";import{r as Qa,s as Xa,V as Ga,a as er,u as et,e as tr,S as nr,M as jn,f as tt,b as Ht}from"./schema-form-Mo6wmjwV.js";import{r as _n,u as sr,d as ar,a as rr,i as ir,f as or,P as lr,b as cr,S as ur}from"./page-seo-form-BPGfCLGr.js";import{i as dr}from"./Tool01-CeM3_qGC.js";import{AddSectionModal as mr}from"./add-section-modal-zMC6VE6E.js";import{c as fr}from"./save-referenced-block-8Q-aWQo9.js";import"./index-CVXOwd6R.js";import"./chat-context-DwuFSNXk.js";import"./hooks-DVgYis4C.js";import"./use-mcp-client-VQUpV2Ii.js";import"./auth-xNmYqmgC.js";import"./decopilot-sse-pool-tu8rIUid.js";import"./use-virtual-mcp-CA84I6FL.js";import"./use-collections-DZb_dDr5.js";import"./use-ai-providers-hrShoTNJ.js";import"./studio-tools-Bs-4h4N6.js";import"./tab-id-BptcWVWa.js";import"./use-organization-settings-C_6Vi920.js";import"./drawer-Ch5vCDYY.js";import"./collection-search-D49siPrl.js";import"./SearchMd-BsAsyTF8.js";import"./use-mcp-prompts-VMwEXGxN.js";import"./X-B8VBAesm.js";import"./shell-layout-D_O9nrWI.js";import"./avatar-B7kKIqkG.js";import"./User01-Dm5WZ8ZU.js";import"./Users03-DPz9weBu.js";import"./Stars02-qeumL9NN.js";import"./XClose-BGuIHH55.js";import"./CheckCircle-DXVZzubl.js";import"./FilterLines-7z3fJe--.js";import"./required-auth-layout-C3Gv1yj3.js";import"./useRouterState-Cci41lb_.js";import"./use-org-sso-DxnrDxMD.js";import"./SwitchHorizontal01-CYTzFeBS.js";import"./ZapSquare-B74wvvEK.js";import"./Star01-BoCe66s1.js";import"./Upload01-H0yxEIEj.js";import"./AlertCircle-eiDdFdpo.js";import"./form-BnR92DK8.js";import"./label-BZO-nx5U.js";import"./select-DNJPz4ZI.js";import"./XCircle-Cqbss1Kp.js";import"./tabs-nSWhKPrq.js";import"./toggle-group-DsnLxyxY.js";import"./use-deco-credits-Db4_aWO7.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-DALvnRcW.js";import"./use-registry-connections-B4n3e5W4.js";import"./use-connection-B7DWRE37.js";import"./useInfiniteQuery-C8ycMIJZ.js";import"./use-infinite-scroll-CtiF3fgR.js";import"./extract-connection-data-2Pprwu-z.js";import"./card-BJ97y7iE.js";import"./integration-icon-DrPIi_Lw.js";import"./collection-tabs-COIIQvGk.js";import"./badge-B1zUdZu4.js";import"./textarea-BYctdmbn.js";import"./connection-form-helpers-Bt8rfYZz.js";import"./useSuspenseInfiniteQuery-DEZ-HoPC.js";import"./mcp-oauth-C2VCpurV.js";import"./Monitor01-SxcGMGVR.js";import"./connect-desktop-dialog-wAwjOiTz.js";import"./decopilot-Jwqgdbyr.js";import"./checkbox-CTtEhAwe.js";import"./skeleton-Db2IVZSk.js";import"./Key01-BH7QR3Q0.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-Dm-722_v.js";import"./ArrowUpRight-C3MnTMc7.js";import"./Stars01-KhRKHdWL.js";import"./popover-CMddDx8S.js";import"./command-Toe5bvPv.js";import"./index-8mI3Tffx.js";import"./question-004-sINsf4GQ.js";import"./ChevronLeft-DZ-8LN4r.js";import"./use-status-sounds-DAQBMvRH.js";import"./empty-state-DHrDb97g.js";import"./toolbar-C8m_suht.js";import"./preview-dialog-ewcufuZZ.js";import"./LinkExternal01-9FjHpG7X.js";import"./index-BxN9R4vT.js";import"./file-type-icon-CfmazJxW.js";import"./LayoutLeft-C_gVdeVq.js";import"./use-mcp-tools-B1aAytZI.js";import"./types-DcyOlOkr.js";import"./use-capability-B928xLn2.js";import"./shell-route-loading-BCODfEXb.js";import"./index-hvgJxH8L.js";import"./alert-dialog-BmkUWho8.js";import"./switch-CPIofN4u.js";import"./Play-Bc7SI6RM.js";import"./use-debounced-autosave-Di0IMVYg.js";import"./index-CioasWLZ.js";import"./sidebar-CqyV3hvw.js";import"./sheet--I615llH.js";import"./search-input-CVNzv0kF.js";import"./github-repo-picker-CQlmRX03.js";import"./use-navigate-to-agent-C-zszyi1.js";import"./Users01-Bn8juneC.js";import"./use-secrets-DbaTf5Lx.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./view-mode-toggle-DPXvgrPU.js";import"./DotsVertical-ClOH4Gg-.js";import"./select-model-_-YzMT35.js";import"./use-automations-DmxLmx01.js";import"./monaco-editor-DkCRcG9C.js";import"./automation-runs-Dg53j0r1.js";import"./table-D9vTl4St.js";import"./use-members-CjS-AkZB.js";import"./use-org-auth-client-C9iPXZoQ.js";import"./task-status-BT_ofK0L.js";import"./automation-list-row-CZsOtouY.js";import"./Globe04-B-0xtF1q.js";import"./HardDrive-CRjCXSN1.js";import"./Sun-D8qj-954.js";import"./Palette-BDDXfJRi.js";import"./Shield01-DyztF96J.js";import"./use-clock-tick-C60lgc5z.js";import"./use-copy-BeM54y_K.js";import"./content-blocks-o63cs2vh.js";import"./calendar-C0B8UkyJ.js";import"./image-field-BGYmIBMw.js";import"./use-file-configs-DtiKgAOA.js";function pr(l){const e=Ie.c(38),{open:r,initialName:c,autoLabel:m,isPending:g,onSubmit:v,onOpenChange:f}=l,d=g===void 0?!1:g,[S,N]=_.useState(c),[A,T]=_.useState(r);r!==A&&(T(r),r&&N(c));let R;e[0]!==d||e[1]!==f?(R=ee=>{!ee&&!d&&f(!1)},e[0]=d,e[1]=f,e[2]=R):R=e[2];const k=R;let i;e[3]!==d||e[4]!==S||e[5]!==v?(i=async ee=>{ee.preventDefault(),!d&&await v(S.trim())},e[3]=d,e[4]=S,e[5]=v,e[6]=i):i=e[6];const b=i;let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(Vn,{children:"Rename variant"}),e[7]=p):p=e[7];const $=m||"the rule";let I;e[8]!==$?(I=t.jsxs(Mn,{children:[p,t.jsxs(En,{children:["Save this matcher as a global block with a custom label. Leave empty to inline the matcher again and fall back to"," ",t.jsx("span",{className:"font-medium",children:$}),"."]})]}),e[8]=$,e[9]=I):I=e[9];let P;e[10]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx("label",{htmlFor:"variant-rename-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[10]=P):P=e[10];let o;e[11]===Symbol.for("react.memo_cache_sentinel")?(o=ee=>N(ee.target.value),e[11]=o):o=e[11];let j;e[12]!==m||e[13]!==d||e[14]!==S?(j=t.jsxs("div",{className:"space-y-1.5 py-4",children:[P,t.jsx(Bn,{id:"variant-rename-name",value:S,onChange:o,placeholder:m,autoFocus:!0,disabled:d})]}),e[12]=m,e[13]=d,e[14]=S,e[15]=j):j=e[15];let J;e[16]!==f?(J=()=>f(!1),e[16]=f,e[17]=J):J=e[17];let w;e[18]!==d||e[19]!==J?(w=t.jsx(Fe,{type:"button",variant:"outline",onClick:J,disabled:d,children:"Cancel"}),e[18]=d,e[19]=J,e[20]=w):w=e[20];let Q;e[21]!==d?(Q=d?t.jsxs(t.Fragment,{children:[t.jsx(Ut,{size:14,className:"animate-spin"}),"Saving…"]}):"Save",e[21]=d,e[22]=Q):Q=e[22];let C;e[23]!==d||e[24]!==Q?(C=t.jsx(Fe,{type:"submit",disabled:d,children:Q}),e[23]=d,e[24]=Q,e[25]=C):C=e[25];let z;e[26]!==w||e[27]!==C?(z=t.jsxs(On,{children:[w,C]}),e[26]=w,e[27]=C,e[28]=z):z=e[28];let M;e[29]!==b||e[30]!==z||e[31]!==I||e[32]!==j?(M=t.jsx($n,{className:"sm:max-w-md",children:t.jsxs("form",{onSubmit:b,children:[I,j,z]})}),e[29]=b,e[30]=z,e[31]=I,e[32]=j,e[33]=M):M=e[33];let U;return e[34]!==k||e[35]!==r||e[36]!==M?(U=t.jsx(Kn,{open:r,onOpenChange:k,children:M}),e[34]=k,e[35]=r,e[36]=M,e[37]=U):U=e[37],U}function Ft(l,e,r,c,m){const g={...l[e]};if(m.length>1){const v=g.sections,f=[...v?.variants??[]];f[c]&&(f[c]={...f[c],value:r}),g.sections={...v,variants:f}}else g.sections=r;return g}function hr(l){return structuredClone(l)}function gr(l){return!l.isSavedBlock&&!l.isMultivariate&&!l.isHidden}function kn(l){const e=l.replace(/[^A-Za-z0-9_-]/g,"");return/^[A-Za-z]/.test(e)?e:e?`Block${e}`:""}function wn(l,e){const r=l.trim();return r?r.includes("/")?"Block name cannot contain slashes.":Object.hasOwn(e,r)?"A block with this name already exists.":/^[A-Za-z][A-Za-z0-9_-]*$/.test(r)?null:"Use letters, numbers, hyphens, or underscores. Must start with a letter.":"Block name is required."}function vr(l){return l.schema?.definitions??l.schema?.$defs??{}}function Sr(l,e){const r=vr(e),c=r[btoa(l)];if(!c)return;let m=typeof c.image=="string"?c.image:void 0;if(!m&&Array.isArray(c.allOf)){const g=c.allOf.find(v=>typeof v.$ref=="string")?.$ref;if(typeof g=="string"){const v=g.replace("#/definitions/",""),f=r[v];m=typeof f?.image=="string"?f.image:void 0}}if(m?.includes("{{{"))return m}function br(l,e){if(!e)return;const r=ta(l);if(!r)return;const c=Sr(r.resolveType,e);if(!c)return;const m=Qa(c,r.data);if(m)return Xa(m)}const xr="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",yr="text-global-section-fg focus:bg-global-section/12 focus:text-global-section-fg dark:text-global-section-fg-dark dark:focus:bg-global-section/15 dark:focus:text-global-section-fg-dark [&_svg]:!text-global-section";function Nn(l){return Array.from({length:l},(e,r)=>({id:crypto.randomUUID(),index:r}))}function es(l){return l.map((e,r)=>({...e,index:r}))}function jr(l,e){if(e===l.length)return l;if(e<l.length)return es(l.slice(0,e));const r=Array.from({length:e-l.length},(c,m)=>({id:crypto.randomUUID(),index:l.length+m}));return[...l,...r]}function ts(l){const e=Ie.c(20),{section:r,raw:c,meta:m}=l,g=r.isSavedBlock===!0,v=r.isMultivariate===!0;let f;e[0]!==m||e[1]!==c?(f=c&&m?br(c,m):void 0,e[0]=m,e[1]=c,e[2]=f):f=e[2];const d=f;let S;e[3]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsx(Ua,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[3]=S):S=e[3];let N;e[4]!==d?(N=d&&t.jsx("img",{src:d,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[4]=d,e[5]=N):N=e[5];let A;e[6]!==v||e[7]!==g?(A=g?{color:sa}:v?{color:"oklch(0.65 0.15 160)"}:void 0,e[6]=v,e[7]=g,e[8]=A):A=e[8];let T;e[9]!==A?(T=t.jsx(zt,{className:"h-4 w-4 shrink-0",style:A}),e[9]=A,e[10]=T):T=e[10];const R=r.isHidden&&"line-through opacity-50";let k;e[11]!==R?(k=Ce("min-w-0 flex-1 truncate text-sm font-medium",R),e[11]=R,e[12]=k):k=e[12];let i;e[13]!==r.label||e[14]!==k?(i=t.jsx("span",{className:k,children:r.label}),e[13]=r.label,e[14]=k,e[15]=i):i=e[15];let b;return e[16]!==N||e[17]!==T||e[18]!==i?(b=t.jsxs(t.Fragment,{children:[S,N,T,i]}),e[16]=N,e[17]=T,e[18]=i,e[19]=b):b=e[19],b}function ns(l,e){const r=l.isSavedBlock===!0,c=l.isMultivariate===!0;return Ce("group flex select-none items-center gap-2 rounded-md px-2 py-2.5",e?"bg-accent text-accent-foreground":r?xr:c?"text-[oklch(0.45_0.15_160)] hover:bg-[oklch(0.65_0.15_160/0.12)] dark:text-[oklch(0.78_0.15_160)] dark:hover:bg-[oklch(0.65_0.15_160/0.15)]":"text-foreground/80 hover:bg-accent hover:text-accent-foreground")}function _r(l){const e=Ie.c(64),{section:r,raw:c,meta:m,sortableId:g,selected:v,onSelect:f,onDelete:d,onDuplicate:S,onMakeReusable:N,onToggleHidden:A,onToggleLazy:T,onAddVariant:R,onDetach:k}=l,i=c?Tn(c.__resolveType??""):!1;let b;e[0]!==r?(b=na(r),e[0]=r,e[1]=b):b=e[1];const p=b;let $;e[2]!==g?($={id:g,animateLayoutChanges:Cr},e[2]=g,e[3]=$):$=e[3];const{attributes:I,listeners:P,setNodeRef:o,transform:j,isDragging:J}=qn($);let w;e[4]!==j?(w=Jn.Transform.toString(j?{...j,x:0}:null),e[4]=j,e[5]=w):w=e[5];const Q=J?0:void 0;let C;e[6]!==w||e[7]!==Q?(C={transform:w,opacity:Q},e[6]=w,e[7]=Q,e[8]=C):C=e[8];const z=C;let M;e[9]!==r?(M=gr(r),e[9]=r,e[10]=M):M=e[10];const U=M,ee="button",Se=0;let se;e[11]!==f?(se=B=>{(B.key==="Enter"||B.key===" ")&&(B.preventDefault(),f())},e[11]=f,e[12]=se):se=e[12];const Y=J?"cursor-grabbing":"cursor-pointer";let ae;e[13]!==r||e[14]!==v||e[15]!==Y?(ae=Ce("touch-none transition-colors",Y,ns(r,v)),e[13]=r,e[14]=v,e[15]=Y,e[16]=ae):ae=e[16];let te;e[17]!==m||e[18]!==c||e[19]!==r?(te=t.jsx(ts,{section:r,raw:c,meta:m}),e[17]=m,e[18]=c,e[19]=r,e[20]=te):te=e[20];const E=!r.isMultivariate&&t.jsxs(st,{children:[t.jsx(at,{asChild:!0,children:t.jsx(Fe,{type:"button",variant:"ghost",size:"icon","aria-label":i?"Disable async render":"Enable async render",className:Ce("h-7 w-7 shrink-0",i?"":"opacity-0 group-hover:opacity-100"),onClick:B=>{B.stopPropagation(),T()},onPointerDown:Rr,children:t.jsx(qa,{className:Ce("h-3.5 w-3.5",i&&"text-yellow-500")})})}),t.jsx(rt,{side:"bottom",children:i?"Disable async render":"Enable async render"})]});let le;e[21]!==A||e[22]!==r.isHidden||e[23]!==r.isMultivariate?(le=!r.isMultivariate&&t.jsxs(st,{children:[t.jsx(at,{asChild:!0,children:t.jsx(Fe,{type:"button",variant:"ghost",size:"icon","aria-label":r.isHidden?"Show section":"Hide section",className:Ce("h-7 w-7 shrink-0",r.isHidden?"opacity-100":"opacity-0 group-hover:opacity-100"),onClick:B=>{B.stopPropagation(),A()},onPointerDown:Nr,children:r.isHidden?t.jsx(Wa,{className:"h-3.5 w-3.5"}):t.jsx(Ia,{className:"h-3.5 w-3.5"})})}),t.jsx(rt,{side:"bottom",children:r.isHidden?"Show section":"Hide section"})]}),e[21]=A,e[22]=r.isHidden,e[23]=r.isMultivariate,e[24]=le):le=e[24];let X;e[25]===Symbol.for("react.memo_cache_sentinel")?(X=t.jsx(Ln,{asChild:!0,children:t.jsx(Fe,{type:"button",variant:"ghost",size:"icon","aria-label":"Section actions",className:"h-7 w-7 shrink-0 opacity-0 group-hover:opacity-100",onClick:wr,onPointerDown:kr,children:t.jsx(Pn,{className:"h-3.5 w-3.5"})})}),e[25]=X):X=e[25];let ne;e[26]!==S?(ne=B=>{B.stopPropagation(),S()},e[26]=S,e[27]=ne):ne=e[27];let re;e[28]===Symbol.for("react.memo_cache_sentinel")?(re=t.jsx(Ha,{className:"h-4 w-4"}),e[28]=re):re=e[28];let H;e[29]!==ne?(H=t.jsxs(nt,{onClick:ne,children:[re,"Duplicate"]}),e[29]=ne,e[30]=H):H=e[30];let O;e[31]!==p||e[32]!==R?(O=p&&t.jsxs(nt,{className:Ga,onClick:B=>{B.stopPropagation(),R()},children:[t.jsx(An,{className:"h-4 w-4"}),"Add variant"]}),e[31]=p,e[32]=R,e[33]=O):O=e[33];let K;e[34]!==U||e[35]!==N?(K=U&&t.jsxs(nt,{className:yr,onClick:B=>{B.stopPropagation(),N()},children:[t.jsx(zt,{className:"h-4 w-4"}),"Make reusable"]}),e[34]=U,e[35]=N,e[36]=K):K=e[36];let ie;e[37]!==k||e[38]!==r.isMultivariate||e[39]!==r.isSavedBlock?(ie=r.isSavedBlock===!0&&!r.isMultivariate&&t.jsxs(nt,{onClick:B=>{B.stopPropagation(),k()},children:[t.jsx(zt,{className:"h-4 w-4"}),"Detach"]}),e[37]=k,e[38]=r.isMultivariate,e[39]=r.isSavedBlock,e[40]=ie):ie=e[40];let pe;e[41]!==d?(pe=B=>{B.stopPropagation(),d()},e[41]=d,e[42]=pe):pe=e[42];let he;e[43]===Symbol.for("react.memo_cache_sentinel")?(he=t.jsx(Fn,{className:"h-4 w-4"}),e[43]=he):he=e[43];let de;e[44]!==pe?(de=t.jsxs(nt,{className:"text-destructive focus:text-destructive",onClick:pe,children:[he,"Delete"]}),e[44]=pe,e[45]=de):de=e[45];let ce;e[46]!==H||e[47]!==O||e[48]!==K||e[49]!==ie||e[50]!==de?(ce=t.jsxs(zn,{children:[X,t.jsxs(In,{align:"end",className:"w-44",children:[H,O,K,ie,de]})]}),e[46]=H,e[47]=O,e[48]=K,e[49]=ie,e[50]=de,e[51]=ce):ce=e[51];let W;return e[52]!==I||e[53]!==P||e[54]!==f||e[55]!==o||e[56]!==z||e[57]!==ae||e[58]!==te||e[59]!==E||e[60]!==le||e[61]!==ce||e[62]!==se?(W=t.jsxs("div",{ref:o,style:z,...I,...P,role:ee,tabIndex:Se,onClick:f,onKeyDown:se,className:ae,children:[te,E,le,ce]}),e[52]=I,e[53]=P,e[54]=f,e[55]=o,e[56]=z,e[57]=ae,e[58]=te,e[59]=E,e[60]=le,e[61]=ce,e[62]=se,e[63]=W):W=e[63],W}function kr(l){return l.stopPropagation()}function wr(l){return l.stopPropagation()}function Nr(l){return l.stopPropagation()}function Rr(l){return l.stopPropagation()}function Cr(){return!1}function Dr(l){const e=Ie.c(90),{listKey:r,rawSections:c,sections:m,meta:g,selectedIndex:v,onSelect:f,onReorder:d,onDelete:S,onDuplicate:N,onMakeReusable:A,onToggleHidden:T,onToggleLazy:R,onAddVariant:k,onDetach:i,onAddSection:b,canAddSection:p}=l,$=p===void 0?!0:p;let I;e[0]!==m.length?(I=()=>Nn(m.length),e[0]=m.length,e[1]=I):I=e[1];const[P,o]=_.useState(I),[j,J]=_.useState(null),[w,Q]=_.useState(r),[C,z]=_.useState(m.length),M=_.useRef(!1);w!==r?(Q(r),z(m.length),o(Nn(m.length))):C!==m.length&&(z(m.length),o(V=>jr(V,m.length)));let U;e[2]===Symbol.for("react.memo_cache_sentinel")?(U={activationConstraint:{distance:8}},e[2]=U):U=e[2];let ee;e[3]===Symbol.for("react.memo_cache_sentinel")?(ee={coordinateGetter:Yn},e[3]=ee):ee=e[3];const Se=Hn(yt(Wn,U),yt(Un,ee));let se;e[4]!==P?(se=P.map(Tr),e[4]=P,e[5]=se):se=e[5];const Y=se;let ae;e[6]===Symbol.for("react.memo_cache_sentinel")?(ae=V=>{J(String(V.active.id))},e[6]=ae):ae=e[6];const te=ae;let E;e[7]!==Y||e[8]!==d?(E=V=>{J(null);const{active:L,over:Z}=V;if(!Z||L.id===Z.id)return;const Le=Y.indexOf(String(L.id)),He=Y.indexOf(String(Z.id));Le===-1||He===-1||(o(We=>es(mt([...We],Le,He))),M.current=!0,requestAnimationFrame(()=>{M.current=!1}),d?.(Le,He))},e[7]=Y,e[8]=d,e[9]=E):E=e[9];const le=E;let X;e[10]===Symbol.for("react.memo_cache_sentinel")?(X=()=>{J(null)},e[10]=X):X=e[10];const ne=X;let re,H,O,K,ie,pe,he,de,ce,W,B,De,_e,Ee,ke;if(e[11]!==j||e[12]!==$||e[13]!==P||e[14]!==Y||e[15]!==le||e[16]!==g||e[17]!==b||e[18]!==k||e[19]!==S||e[20]!==i||e[21]!==N||e[22]!==A||e[23]!==f||e[24]!==T||e[25]!==R||e[26]!==c||e[27]!==m||e[28]!==v||e[29]!==Se){Ee=Symbol.for("react.early_return_sentinel");e:{const V=L=>{M.current||f(L)};if(e[45]!==j||e[46]!==$||e[47]!==P||e[48]!==b||e[49]!==c||e[50]!==m){const L=j?P.find(Z=>Z.id===j):null;if(K=L!=null?m[L.index]:null,O=L!=null?c[L.index]:void 0,P.length===0){let Z;e[54]===Symbol.for("react.memo_cache_sentinel")?(Z=t.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:"No sections in this page."}),e[54]=Z):Z=e[54];const Le=!$;let He;e[55]===Symbol.for("react.memo_cache_sentinel")?(He=t.jsx(It,{size:14}),e[55]=He):He=e[55];let We;e[56]!==b||e[57]!==Le?(We=t.jsxs("div",{className:"space-y-2",children:[Z,t.jsxs(Fe,{type:"button",variant:"outline",size:"sm",className:"w-full",disabled:Le,onClick:b,children:[He,"Add section"]})]}),e[56]=b,e[57]=Le,e[58]=We):We=e[58],Ee=We;break e}_e=Ce(L&&"cursor-grabbing"),e[45]=j,e[46]=$,e[47]=P,e[48]=b,e[49]=c,e[50]=m,e[51]=O,e[52]=K,e[53]=_e}else O=e[51],K=e[52],_e=e[53];H=Zn,de=Se,ce=Qn,W=te,B=le,De=ne,re=Xn,pe=Y,he=Ya,ke="space-y-1",ie=P.map(L=>{const Z=m[L.index];return Z?t.jsx(_r,{sortableId:L.id,section:Z,raw:c[L.index],meta:g,selected:v===L.index,onSelect:()=>V(L.index),onDelete:()=>S(L.index),onDuplicate:()=>N(L.index),onMakeReusable:()=>A(L.index),onToggleHidden:()=>T(L.index),onToggleLazy:()=>R(L.index),onAddVariant:()=>k(L.index),onDetach:()=>i(L.index)},L.id):null})}e[11]=j,e[12]=$,e[13]=P,e[14]=Y,e[15]=le,e[16]=g,e[17]=b,e[18]=k,e[19]=S,e[20]=i,e[21]=N,e[22]=A,e[23]=f,e[24]=T,e[25]=R,e[26]=c,e[27]=m,e[28]=v,e[29]=Se,e[30]=re,e[31]=H,e[32]=O,e[33]=K,e[34]=ie,e[35]=pe,e[36]=he,e[37]=de,e[38]=ce,e[39]=W,e[40]=B,e[41]=De,e[42]=_e,e[43]=Ee,e[44]=ke}else re=e[30],H=e[31],O=e[32],K=e[33],ie=e[34],pe=e[35],he=e[36],de=e[37],ce=e[38],W=e[39],B=e[40],De=e[41],_e=e[42],Ee=e[43],ke=e[44];if(Ee!==Symbol.for("react.early_return_sentinel"))return Ee;let Te;e[59]!==ie||e[60]!==ke?(Te=t.jsx("div",{className:ke,children:ie}),e[59]=ie,e[60]=ke,e[61]=Te):Te=e[61];let Oe;e[62]!==re||e[63]!==pe||e[64]!==he||e[65]!==Te?(Oe=t.jsx(re,{items:pe,strategy:he,children:Te}),e[62]=re,e[63]=pe,e[64]=he,e[65]=Te,e[66]=Oe):Oe=e[66];let $e;e[67]!==O||e[68]!==K||e[69]!==g?($e=K?t.jsx("div",{className:Ce("cursor-grabbing shadow-lg ring-1 ring-border/60",ns(K,!1)),children:t.jsx(ts,{section:K,raw:O,meta:g})}):null,e[67]=O,e[68]=K,e[69]=g,e[70]=$e):$e=e[70];let be;e[71]!==$e?(be=t.jsx(Gn,{dropAnimation:null,children:$e}),e[71]=$e,e[72]=be):be=e[72];let Ke;e[73]!==H||e[74]!==de||e[75]!==ce||e[76]!==W||e[77]!==B||e[78]!==De||e[79]!==Oe||e[80]!==be?(Ke=t.jsxs(H,{sensors:de,collisionDetection:ce,onDragStart:W,onDragEnd:B,onDragCancel:De,children:[Oe,be]}),e[73]=H,e[74]=de,e[75]=ce,e[76]=W,e[77]=B,e[78]=De,e[79]=Oe,e[80]=be,e[81]=Ke):Ke=e[81];const Pe=!$;let ue;e[82]===Symbol.for("react.memo_cache_sentinel")?(ue=t.jsx(It,{size:14}),e[82]=ue):ue=e[82];let oe;e[83]!==b||e[84]!==Pe?(oe=t.jsxs(Fe,{type:"button",variant:"outline",size:"sm",className:"mt-2 w-full",disabled:Pe,onClick:b,children:[ue,"Add section"]}),e[83]=b,e[84]=Pe,e[85]=oe):oe=e[85];let we;return e[86]!==_e||e[87]!==Ke||e[88]!==oe?(we=t.jsxs("div",{className:_e,children:[Ke,oe]}),e[86]=_e,e[87]=Ke,e[88]=oe,e[89]=we):we=e[89],we}function Tr(l){return l.id}const Pr="oklch(0.65 0.15 160)",ss="text-[oklch(0.45_0.15_160)] bg-[oklch(0.65_0.15_160/0.18)] dark:text-[oklch(0.78_0.15_160)] dark:bg-[oklch(0.65_0.15_160/0.22)]";function Wt(l){const e=Ie.c(5),{rule:r,matchers:c}=l,m=r?.__resolveType??"";let g;if(e[0]!==c||e[1]!==m){const S=c.find(N=>N.resolveType===m)?.iconName??er(m);g=Ba(S),e[0]=c,e[1]=m,e[2]=g}else g=e[2];const v=g;if(!v)return null;let f;return e[3]!==v?(f=t.jsx(v,{size:14,className:"shrink-0"}),e[3]=v,e[4]=f):f=e[4],f}function Rn(l){return l.map(e=>`${e.label}|${e.rule?.__resolveType??""}`).join(`
|
|
1
|
+
import{e as Ie,r as _,j as t,B as Fe,l as Ut,c as Ce,F as Gs,n as fe,K as ea}from"./index-D3rW8rSB.js";import{r as ta,i as Tn,c as na,G as sa,a as xt,b as aa,d as ra,e as ia,f as oa,g as la,h as ca,j as ua,k as da,l as ma,m as vt,p as St,n as fa,o as Ot,q as Qe,s as Sn,t as bn,P as pa,v as $t,w as ha,x as ga,y as va,z as Sa,A as ba,B as xa,C as ya,D as dt,E as ja,F as _a,H as ka,I as wa,J as Na,K as Ra,L as Ca,M as Da,N as Kt,O as Ta,Q as xn,R as Pa,S as Aa,T as Va,U as Bt,V as Ma,W as Ea,X as yn}from"./index-te0-qL-i.js";import{t as Oa}from"./ChevronDown-C2lrFcn0.js";import{i as $a}from"./ChevronRight-CQ9QYca_.js";import{n as Ka}from"./ChevronUp-B3hXWHxa.js";import{K as zt,D as Pn,R as An,l as Ba,L as Fa,M as La}from"./agent-icon-eDO3_31Q.js";import{i as za}from"./Globe01-Dt2zRGYA.js";import{S as bt}from"./scroll-area-YGRrTDU7.js";import{b as st,T as at,a as rt}from"./tooltip-BnbMgAPE.js";import{a as Vn,D as Mn,b as En,e as On,c as $n,d as Kn}from"./dialog-B-qEKmGK.js";import{I as Bn}from"./input-DTeQSVLv.js";import{s as Ia,a as Ha}from"./Eye-D1jbaQ7n.js";import{c as Ua}from"./ZoomOut-DajboEJA.js";import{b as Wa}from"./Settings02-CtgzOHqS.js";import{s as It}from"./Plus-D1OarKqc.js";import{s as Fn}from"./Trash01-BIZ57nYE.js";import{i as qa}from"./Zap-CIAspZ-z.js";import{c as nt,a as Ln,D as zn,b as In,g as Ja}from"./dropdown-menu-BT6aqF06.js";import{u as Hn,a as yt,K as Un,P as Wn,b as qn,C as Jn,s as Yn,d as mt,D as Zn,c as Qn,S as Xn,v as Ya,e as Gn,h as Za}from"./sortable.esm-HmrhEw1U.js";import{r as Qa,s as Xa,V as Ga,a as er,u as et,e as tr,S as nr,M as jn,f as tt,b as Ht}from"./schema-form-CUfa1Oym.js";import{r as _n,u as sr,d as ar,a as rr,i as ir,f as or,P as lr,b as cr,S as ur}from"./page-seo-form-BdcE_gQo.js";import{i as dr}from"./Tool01-oQmmJYZR.js";import{AddSectionModal as mr}from"./add-section-modal-D87LPJXr.js";import{c as fr}from"./save-referenced-block-sILi1Js0.js";import"./index-C_vCM6aG.js";import"./chat-context-D1kr0iC0.js";import"./hooks-DWV8tZMM.js";import"./use-mcp-client-CjFb2EJG.js";import"./auth-DD4_4jA4.js";import"./decopilot-sse-pool-CfcCM-5d.js";import"./use-virtual-mcp-sNnLDxto.js";import"./use-collections-xatq9RdX.js";import"./use-ai-providers-dF-K_DaJ.js";import"./studio-tools-CP8WMfwU.js";import"./tab-id-BptcWVWa.js";import"./use-organization-settings-B5dOmmF3.js";import"./drawer-BsKI7ymt.js";import"./collection-search-CaMjJF6-.js";import"./SearchMd-DkRuJ2gi.js";import"./use-mcp-prompts-Ck43hw0S.js";import"./X-ZEmMP3Rp.js";import"./shell-layout-DHMpOaUJ.js";import"./avatar-CAa0APRH.js";import"./User01-5m1v97Pd.js";import"./Users03-DCLVPm8T.js";import"./Stars02-DYfXStsp.js";import"./XClose-BH3szX7J.js";import"./CheckCircle-DRm2pwaA.js";import"./FilterLines-nNO4j83z.js";import"./required-auth-layout-BTgmf1Ho.js";import"./useRouterState-DB2FFYMc.js";import"./use-org-sso-C5aovsso.js";import"./SwitchHorizontal01-C5k-HENe.js";import"./ZapSquare-ZZzC2w-e.js";import"./Star01-C784J1MM.js";import"./Upload01-gnC5_Ssm.js";import"./AlertCircle-BfI2uSTY.js";import"./form-CVlSwq3w.js";import"./label-CQsaTPJ3.js";import"./select-B5x2AUrZ.js";import"./XCircle-BuzRARGa.js";import"./tabs-VvrUTZXI.js";import"./toggle-group-CVP4NlJk.js";import"./use-deco-credits-iEPKbFsz.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-XQGSkUWc.js";import"./use-registry-connections-DEimB7Dw.js";import"./use-connection-D4k9Jnol.js";import"./useInfiniteQuery-ByFdiCdF.js";import"./use-infinite-scroll-BUY20nUO.js";import"./extract-connection-data-CFVR9SzW.js";import"./card-xuJ9Fzgg.js";import"./integration-icon-CI4vd8FM.js";import"./collection-tabs-CPFECg6-.js";import"./badge-f0VKW-9Z.js";import"./textarea-CwJzHeYB.js";import"./connection-form-helpers-BEunAzRs.js";import"./useSuspenseInfiniteQuery-C-w91snb.js";import"./mcp-oauth-BYZQ1Ird.js";import"./Monitor01-BMl8U0hF.js";import"./connect-desktop-dialog-BqQ6M6VV.js";import"./decopilot-BgVFUp6y.js";import"./checkbox-B7cE0lJJ.js";import"./skeleton-DLJHpAXs.js";import"./Key01-B1KOwULG.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-CNFUQN3R.js";import"./ArrowUpRight-CvSz9Amp.js";import"./Stars01-4VdPhZCY.js";import"./popover-BRgvG_DY.js";import"./command-DPlRPlz3.js";import"./index-Ddz4Khr1.js";import"./question-004-sINsf4GQ.js";import"./ChevronLeft-D-yhQLP1.js";import"./use-status-sounds-n3ORlbU0.js";import"./empty-state-Bhl0YdU3.js";import"./toolbar-CM8RQ0c-.js";import"./preview-dialog-BPhgp4kw.js";import"./LinkExternal01-CzVttU_W.js";import"./index-DU1cTODu.js";import"./file-type-icon-Btmj3s_g.js";import"./LayoutLeft-BcwHG1_h.js";import"./use-mcp-tools-D4YpHKWB.js";import"./types-DVbz3Se0.js";import"./use-capability-Cc8N2DWQ.js";import"./shell-route-loading-BKTpl941.js";import"./index-DatC5ukX.js";import"./alert-dialog-eW7WkIvS.js";import"./switch-j2wai7YF.js";import"./Play-CDrfq4i1.js";import"./use-debounced-autosave-DWyP2FOP.js";import"./index-BW-4wD8s.js";import"./sidebar-Dmsmn1q4.js";import"./sheet-yZUVXUUg.js";import"./search-input-hxkxbPXL.js";import"./github-repo-picker-DGlex3MX.js";import"./use-navigate-to-agent-DnY8W1Vs.js";import"./Users01-D3elJs6Y.js";import"./use-secrets-B4zusNgt.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./view-mode-toggle-B7K94eRT.js";import"./DotsVertical-CA_v3u_G.js";import"./select-model-DCDYiWUZ.js";import"./use-automations-WmY_k1VU.js";import"./monaco-editor-CwwtK29R.js";import"./automation-runs-CBc9TThB.js";import"./table-BiPBJ_vK.js";import"./use-members-DBYXCK00.js";import"./use-org-auth-client-BS94IuDi.js";import"./task-status-DHb08gVZ.js";import"./automation-list-row-B1AKQ_mc.js";import"./Globe04-ClKVSxCF.js";import"./HardDrive-D5HAvytg.js";import"./Sun-TLWXjMp5.js";import"./Palette-Dj5xh4DB.js";import"./Shield01-BX5VFQgM.js";import"./use-clock-tick-BNwdYLJy.js";import"./use-copy-qqj4mjMm.js";import"./content-blocks-o63cs2vh.js";import"./calendar-DYsvDfUn.js";import"./image-field-D6uiGDOX.js";import"./use-file-configs-BI2QJkP7.js";function pr(l){const e=Ie.c(38),{open:r,initialName:c,autoLabel:m,isPending:g,onSubmit:v,onOpenChange:f}=l,d=g===void 0?!1:g,[S,N]=_.useState(c),[A,T]=_.useState(r);r!==A&&(T(r),r&&N(c));let R;e[0]!==d||e[1]!==f?(R=ee=>{!ee&&!d&&f(!1)},e[0]=d,e[1]=f,e[2]=R):R=e[2];const k=R;let i;e[3]!==d||e[4]!==S||e[5]!==v?(i=async ee=>{ee.preventDefault(),!d&&await v(S.trim())},e[3]=d,e[4]=S,e[5]=v,e[6]=i):i=e[6];const b=i;let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(Vn,{children:"Rename variant"}),e[7]=p):p=e[7];const $=m||"the rule";let I;e[8]!==$?(I=t.jsxs(Mn,{children:[p,t.jsxs(En,{children:["Save this matcher as a global block with a custom label. Leave empty to inline the matcher again and fall back to"," ",t.jsx("span",{className:"font-medium",children:$}),"."]})]}),e[8]=$,e[9]=I):I=e[9];let P;e[10]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx("label",{htmlFor:"variant-rename-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[10]=P):P=e[10];let o;e[11]===Symbol.for("react.memo_cache_sentinel")?(o=ee=>N(ee.target.value),e[11]=o):o=e[11];let j;e[12]!==m||e[13]!==d||e[14]!==S?(j=t.jsxs("div",{className:"space-y-1.5 py-4",children:[P,t.jsx(Bn,{id:"variant-rename-name",value:S,onChange:o,placeholder:m,autoFocus:!0,disabled:d})]}),e[12]=m,e[13]=d,e[14]=S,e[15]=j):j=e[15];let J;e[16]!==f?(J=()=>f(!1),e[16]=f,e[17]=J):J=e[17];let w;e[18]!==d||e[19]!==J?(w=t.jsx(Fe,{type:"button",variant:"outline",onClick:J,disabled:d,children:"Cancel"}),e[18]=d,e[19]=J,e[20]=w):w=e[20];let Q;e[21]!==d?(Q=d?t.jsxs(t.Fragment,{children:[t.jsx(Ut,{size:14,className:"animate-spin"}),"Saving…"]}):"Save",e[21]=d,e[22]=Q):Q=e[22];let C;e[23]!==d||e[24]!==Q?(C=t.jsx(Fe,{type:"submit",disabled:d,children:Q}),e[23]=d,e[24]=Q,e[25]=C):C=e[25];let z;e[26]!==w||e[27]!==C?(z=t.jsxs(On,{children:[w,C]}),e[26]=w,e[27]=C,e[28]=z):z=e[28];let M;e[29]!==b||e[30]!==z||e[31]!==I||e[32]!==j?(M=t.jsx($n,{className:"sm:max-w-md",children:t.jsxs("form",{onSubmit:b,children:[I,j,z]})}),e[29]=b,e[30]=z,e[31]=I,e[32]=j,e[33]=M):M=e[33];let U;return e[34]!==k||e[35]!==r||e[36]!==M?(U=t.jsx(Kn,{open:r,onOpenChange:k,children:M}),e[34]=k,e[35]=r,e[36]=M,e[37]=U):U=e[37],U}function Ft(l,e,r,c,m){const g={...l[e]};if(m.length>1){const v=g.sections,f=[...v?.variants??[]];f[c]&&(f[c]={...f[c],value:r}),g.sections={...v,variants:f}}else g.sections=r;return g}function hr(l){return structuredClone(l)}function gr(l){return!l.isSavedBlock&&!l.isMultivariate&&!l.isHidden}function kn(l){const e=l.replace(/[^A-Za-z0-9_-]/g,"");return/^[A-Za-z]/.test(e)?e:e?`Block${e}`:""}function wn(l,e){const r=l.trim();return r?r.includes("/")?"Block name cannot contain slashes.":Object.hasOwn(e,r)?"A block with this name already exists.":/^[A-Za-z][A-Za-z0-9_-]*$/.test(r)?null:"Use letters, numbers, hyphens, or underscores. Must start with a letter.":"Block name is required."}function vr(l){return l.schema?.definitions??l.schema?.$defs??{}}function Sr(l,e){const r=vr(e),c=r[btoa(l)];if(!c)return;let m=typeof c.image=="string"?c.image:void 0;if(!m&&Array.isArray(c.allOf)){const g=c.allOf.find(v=>typeof v.$ref=="string")?.$ref;if(typeof g=="string"){const v=g.replace("#/definitions/",""),f=r[v];m=typeof f?.image=="string"?f.image:void 0}}if(m?.includes("{{{"))return m}function br(l,e){if(!e)return;const r=ta(l);if(!r)return;const c=Sr(r.resolveType,e);if(!c)return;const m=Qa(c,r.data);if(m)return Xa(m)}const xr="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",yr="text-global-section-fg focus:bg-global-section/12 focus:text-global-section-fg dark:text-global-section-fg-dark dark:focus:bg-global-section/15 dark:focus:text-global-section-fg-dark [&_svg]:!text-global-section";function Nn(l){return Array.from({length:l},(e,r)=>({id:crypto.randomUUID(),index:r}))}function es(l){return l.map((e,r)=>({...e,index:r}))}function jr(l,e){if(e===l.length)return l;if(e<l.length)return es(l.slice(0,e));const r=Array.from({length:e-l.length},(c,m)=>({id:crypto.randomUUID(),index:l.length+m}));return[...l,...r]}function ts(l){const e=Ie.c(20),{section:r,raw:c,meta:m}=l,g=r.isSavedBlock===!0,v=r.isMultivariate===!0;let f;e[0]!==m||e[1]!==c?(f=c&&m?br(c,m):void 0,e[0]=m,e[1]=c,e[2]=f):f=e[2];const d=f;let S;e[3]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsx(Ua,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[3]=S):S=e[3];let N;e[4]!==d?(N=d&&t.jsx("img",{src:d,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[4]=d,e[5]=N):N=e[5];let A;e[6]!==v||e[7]!==g?(A=g?{color:sa}:v?{color:"oklch(0.65 0.15 160)"}:void 0,e[6]=v,e[7]=g,e[8]=A):A=e[8];let T;e[9]!==A?(T=t.jsx(zt,{className:"h-4 w-4 shrink-0",style:A}),e[9]=A,e[10]=T):T=e[10];const R=r.isHidden&&"line-through opacity-50";let k;e[11]!==R?(k=Ce("min-w-0 flex-1 truncate text-sm font-medium",R),e[11]=R,e[12]=k):k=e[12];let i;e[13]!==r.label||e[14]!==k?(i=t.jsx("span",{className:k,children:r.label}),e[13]=r.label,e[14]=k,e[15]=i):i=e[15];let b;return e[16]!==N||e[17]!==T||e[18]!==i?(b=t.jsxs(t.Fragment,{children:[S,N,T,i]}),e[16]=N,e[17]=T,e[18]=i,e[19]=b):b=e[19],b}function ns(l,e){const r=l.isSavedBlock===!0,c=l.isMultivariate===!0;return Ce("group flex select-none items-center gap-2 rounded-md px-2 py-2.5",e?"bg-accent text-accent-foreground":r?xr:c?"text-[oklch(0.45_0.15_160)] hover:bg-[oklch(0.65_0.15_160/0.12)] dark:text-[oklch(0.78_0.15_160)] dark:hover:bg-[oklch(0.65_0.15_160/0.15)]":"text-foreground/80 hover:bg-accent hover:text-accent-foreground")}function _r(l){const e=Ie.c(64),{section:r,raw:c,meta:m,sortableId:g,selected:v,onSelect:f,onDelete:d,onDuplicate:S,onMakeReusable:N,onToggleHidden:A,onToggleLazy:T,onAddVariant:R,onDetach:k}=l,i=c?Tn(c.__resolveType??""):!1;let b;e[0]!==r?(b=na(r),e[0]=r,e[1]=b):b=e[1];const p=b;let $;e[2]!==g?($={id:g,animateLayoutChanges:Cr},e[2]=g,e[3]=$):$=e[3];const{attributes:I,listeners:P,setNodeRef:o,transform:j,isDragging:J}=qn($);let w;e[4]!==j?(w=Jn.Transform.toString(j?{...j,x:0}:null),e[4]=j,e[5]=w):w=e[5];const Q=J?0:void 0;let C;e[6]!==w||e[7]!==Q?(C={transform:w,opacity:Q},e[6]=w,e[7]=Q,e[8]=C):C=e[8];const z=C;let M;e[9]!==r?(M=gr(r),e[9]=r,e[10]=M):M=e[10];const U=M,ee="button",Se=0;let se;e[11]!==f?(se=B=>{(B.key==="Enter"||B.key===" ")&&(B.preventDefault(),f())},e[11]=f,e[12]=se):se=e[12];const Y=J?"cursor-grabbing":"cursor-pointer";let ae;e[13]!==r||e[14]!==v||e[15]!==Y?(ae=Ce("touch-none transition-colors",Y,ns(r,v)),e[13]=r,e[14]=v,e[15]=Y,e[16]=ae):ae=e[16];let te;e[17]!==m||e[18]!==c||e[19]!==r?(te=t.jsx(ts,{section:r,raw:c,meta:m}),e[17]=m,e[18]=c,e[19]=r,e[20]=te):te=e[20];const E=!r.isMultivariate&&t.jsxs(st,{children:[t.jsx(at,{asChild:!0,children:t.jsx(Fe,{type:"button",variant:"ghost",size:"icon","aria-label":i?"Disable async render":"Enable async render",className:Ce("h-7 w-7 shrink-0",i?"":"opacity-0 group-hover:opacity-100"),onClick:B=>{B.stopPropagation(),T()},onPointerDown:Rr,children:t.jsx(qa,{className:Ce("h-3.5 w-3.5",i&&"text-yellow-500")})})}),t.jsx(rt,{side:"bottom",children:i?"Disable async render":"Enable async render"})]});let le;e[21]!==A||e[22]!==r.isHidden||e[23]!==r.isMultivariate?(le=!r.isMultivariate&&t.jsxs(st,{children:[t.jsx(at,{asChild:!0,children:t.jsx(Fe,{type:"button",variant:"ghost",size:"icon","aria-label":r.isHidden?"Show section":"Hide section",className:Ce("h-7 w-7 shrink-0",r.isHidden?"opacity-100":"opacity-0 group-hover:opacity-100"),onClick:B=>{B.stopPropagation(),A()},onPointerDown:Nr,children:r.isHidden?t.jsx(Wa,{className:"h-3.5 w-3.5"}):t.jsx(Ia,{className:"h-3.5 w-3.5"})})}),t.jsx(rt,{side:"bottom",children:r.isHidden?"Show section":"Hide section"})]}),e[21]=A,e[22]=r.isHidden,e[23]=r.isMultivariate,e[24]=le):le=e[24];let X;e[25]===Symbol.for("react.memo_cache_sentinel")?(X=t.jsx(Ln,{asChild:!0,children:t.jsx(Fe,{type:"button",variant:"ghost",size:"icon","aria-label":"Section actions",className:"h-7 w-7 shrink-0 opacity-0 group-hover:opacity-100",onClick:wr,onPointerDown:kr,children:t.jsx(Pn,{className:"h-3.5 w-3.5"})})}),e[25]=X):X=e[25];let ne;e[26]!==S?(ne=B=>{B.stopPropagation(),S()},e[26]=S,e[27]=ne):ne=e[27];let re;e[28]===Symbol.for("react.memo_cache_sentinel")?(re=t.jsx(Ha,{className:"h-4 w-4"}),e[28]=re):re=e[28];let H;e[29]!==ne?(H=t.jsxs(nt,{onClick:ne,children:[re,"Duplicate"]}),e[29]=ne,e[30]=H):H=e[30];let O;e[31]!==p||e[32]!==R?(O=p&&t.jsxs(nt,{className:Ga,onClick:B=>{B.stopPropagation(),R()},children:[t.jsx(An,{className:"h-4 w-4"}),"Add variant"]}),e[31]=p,e[32]=R,e[33]=O):O=e[33];let K;e[34]!==U||e[35]!==N?(K=U&&t.jsxs(nt,{className:yr,onClick:B=>{B.stopPropagation(),N()},children:[t.jsx(zt,{className:"h-4 w-4"}),"Make reusable"]}),e[34]=U,e[35]=N,e[36]=K):K=e[36];let ie;e[37]!==k||e[38]!==r.isMultivariate||e[39]!==r.isSavedBlock?(ie=r.isSavedBlock===!0&&!r.isMultivariate&&t.jsxs(nt,{onClick:B=>{B.stopPropagation(),k()},children:[t.jsx(zt,{className:"h-4 w-4"}),"Detach"]}),e[37]=k,e[38]=r.isMultivariate,e[39]=r.isSavedBlock,e[40]=ie):ie=e[40];let pe;e[41]!==d?(pe=B=>{B.stopPropagation(),d()},e[41]=d,e[42]=pe):pe=e[42];let he;e[43]===Symbol.for("react.memo_cache_sentinel")?(he=t.jsx(Fn,{className:"h-4 w-4"}),e[43]=he):he=e[43];let de;e[44]!==pe?(de=t.jsxs(nt,{className:"text-destructive focus:text-destructive",onClick:pe,children:[he,"Delete"]}),e[44]=pe,e[45]=de):de=e[45];let ce;e[46]!==H||e[47]!==O||e[48]!==K||e[49]!==ie||e[50]!==de?(ce=t.jsxs(zn,{children:[X,t.jsxs(In,{align:"end",className:"w-44",children:[H,O,K,ie,de]})]}),e[46]=H,e[47]=O,e[48]=K,e[49]=ie,e[50]=de,e[51]=ce):ce=e[51];let W;return e[52]!==I||e[53]!==P||e[54]!==f||e[55]!==o||e[56]!==z||e[57]!==ae||e[58]!==te||e[59]!==E||e[60]!==le||e[61]!==ce||e[62]!==se?(W=t.jsxs("div",{ref:o,style:z,...I,...P,role:ee,tabIndex:Se,onClick:f,onKeyDown:se,className:ae,children:[te,E,le,ce]}),e[52]=I,e[53]=P,e[54]=f,e[55]=o,e[56]=z,e[57]=ae,e[58]=te,e[59]=E,e[60]=le,e[61]=ce,e[62]=se,e[63]=W):W=e[63],W}function kr(l){return l.stopPropagation()}function wr(l){return l.stopPropagation()}function Nr(l){return l.stopPropagation()}function Rr(l){return l.stopPropagation()}function Cr(){return!1}function Dr(l){const e=Ie.c(90),{listKey:r,rawSections:c,sections:m,meta:g,selectedIndex:v,onSelect:f,onReorder:d,onDelete:S,onDuplicate:N,onMakeReusable:A,onToggleHidden:T,onToggleLazy:R,onAddVariant:k,onDetach:i,onAddSection:b,canAddSection:p}=l,$=p===void 0?!0:p;let I;e[0]!==m.length?(I=()=>Nn(m.length),e[0]=m.length,e[1]=I):I=e[1];const[P,o]=_.useState(I),[j,J]=_.useState(null),[w,Q]=_.useState(r),[C,z]=_.useState(m.length),M=_.useRef(!1);w!==r?(Q(r),z(m.length),o(Nn(m.length))):C!==m.length&&(z(m.length),o(V=>jr(V,m.length)));let U;e[2]===Symbol.for("react.memo_cache_sentinel")?(U={activationConstraint:{distance:8}},e[2]=U):U=e[2];let ee;e[3]===Symbol.for("react.memo_cache_sentinel")?(ee={coordinateGetter:Yn},e[3]=ee):ee=e[3];const Se=Hn(yt(Wn,U),yt(Un,ee));let se;e[4]!==P?(se=P.map(Tr),e[4]=P,e[5]=se):se=e[5];const Y=se;let ae;e[6]===Symbol.for("react.memo_cache_sentinel")?(ae=V=>{J(String(V.active.id))},e[6]=ae):ae=e[6];const te=ae;let E;e[7]!==Y||e[8]!==d?(E=V=>{J(null);const{active:L,over:Z}=V;if(!Z||L.id===Z.id)return;const Le=Y.indexOf(String(L.id)),He=Y.indexOf(String(Z.id));Le===-1||He===-1||(o(We=>es(mt([...We],Le,He))),M.current=!0,requestAnimationFrame(()=>{M.current=!1}),d?.(Le,He))},e[7]=Y,e[8]=d,e[9]=E):E=e[9];const le=E;let X;e[10]===Symbol.for("react.memo_cache_sentinel")?(X=()=>{J(null)},e[10]=X):X=e[10];const ne=X;let re,H,O,K,ie,pe,he,de,ce,W,B,De,_e,Ee,ke;if(e[11]!==j||e[12]!==$||e[13]!==P||e[14]!==Y||e[15]!==le||e[16]!==g||e[17]!==b||e[18]!==k||e[19]!==S||e[20]!==i||e[21]!==N||e[22]!==A||e[23]!==f||e[24]!==T||e[25]!==R||e[26]!==c||e[27]!==m||e[28]!==v||e[29]!==Se){Ee=Symbol.for("react.early_return_sentinel");e:{const V=L=>{M.current||f(L)};if(e[45]!==j||e[46]!==$||e[47]!==P||e[48]!==b||e[49]!==c||e[50]!==m){const L=j?P.find(Z=>Z.id===j):null;if(K=L!=null?m[L.index]:null,O=L!=null?c[L.index]:void 0,P.length===0){let Z;e[54]===Symbol.for("react.memo_cache_sentinel")?(Z=t.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:"No sections in this page."}),e[54]=Z):Z=e[54];const Le=!$;let He;e[55]===Symbol.for("react.memo_cache_sentinel")?(He=t.jsx(It,{size:14}),e[55]=He):He=e[55];let We;e[56]!==b||e[57]!==Le?(We=t.jsxs("div",{className:"space-y-2",children:[Z,t.jsxs(Fe,{type:"button",variant:"outline",size:"sm",className:"w-full",disabled:Le,onClick:b,children:[He,"Add section"]})]}),e[56]=b,e[57]=Le,e[58]=We):We=e[58],Ee=We;break e}_e=Ce(L&&"cursor-grabbing"),e[45]=j,e[46]=$,e[47]=P,e[48]=b,e[49]=c,e[50]=m,e[51]=O,e[52]=K,e[53]=_e}else O=e[51],K=e[52],_e=e[53];H=Zn,de=Se,ce=Qn,W=te,B=le,De=ne,re=Xn,pe=Y,he=Ya,ke="space-y-1",ie=P.map(L=>{const Z=m[L.index];return Z?t.jsx(_r,{sortableId:L.id,section:Z,raw:c[L.index],meta:g,selected:v===L.index,onSelect:()=>V(L.index),onDelete:()=>S(L.index),onDuplicate:()=>N(L.index),onMakeReusable:()=>A(L.index),onToggleHidden:()=>T(L.index),onToggleLazy:()=>R(L.index),onAddVariant:()=>k(L.index),onDetach:()=>i(L.index)},L.id):null})}e[11]=j,e[12]=$,e[13]=P,e[14]=Y,e[15]=le,e[16]=g,e[17]=b,e[18]=k,e[19]=S,e[20]=i,e[21]=N,e[22]=A,e[23]=f,e[24]=T,e[25]=R,e[26]=c,e[27]=m,e[28]=v,e[29]=Se,e[30]=re,e[31]=H,e[32]=O,e[33]=K,e[34]=ie,e[35]=pe,e[36]=he,e[37]=de,e[38]=ce,e[39]=W,e[40]=B,e[41]=De,e[42]=_e,e[43]=Ee,e[44]=ke}else re=e[30],H=e[31],O=e[32],K=e[33],ie=e[34],pe=e[35],he=e[36],de=e[37],ce=e[38],W=e[39],B=e[40],De=e[41],_e=e[42],Ee=e[43],ke=e[44];if(Ee!==Symbol.for("react.early_return_sentinel"))return Ee;let Te;e[59]!==ie||e[60]!==ke?(Te=t.jsx("div",{className:ke,children:ie}),e[59]=ie,e[60]=ke,e[61]=Te):Te=e[61];let Oe;e[62]!==re||e[63]!==pe||e[64]!==he||e[65]!==Te?(Oe=t.jsx(re,{items:pe,strategy:he,children:Te}),e[62]=re,e[63]=pe,e[64]=he,e[65]=Te,e[66]=Oe):Oe=e[66];let $e;e[67]!==O||e[68]!==K||e[69]!==g?($e=K?t.jsx("div",{className:Ce("cursor-grabbing shadow-lg ring-1 ring-border/60",ns(K,!1)),children:t.jsx(ts,{section:K,raw:O,meta:g})}):null,e[67]=O,e[68]=K,e[69]=g,e[70]=$e):$e=e[70];let be;e[71]!==$e?(be=t.jsx(Gn,{dropAnimation:null,children:$e}),e[71]=$e,e[72]=be):be=e[72];let Ke;e[73]!==H||e[74]!==de||e[75]!==ce||e[76]!==W||e[77]!==B||e[78]!==De||e[79]!==Oe||e[80]!==be?(Ke=t.jsxs(H,{sensors:de,collisionDetection:ce,onDragStart:W,onDragEnd:B,onDragCancel:De,children:[Oe,be]}),e[73]=H,e[74]=de,e[75]=ce,e[76]=W,e[77]=B,e[78]=De,e[79]=Oe,e[80]=be,e[81]=Ke):Ke=e[81];const Pe=!$;let ue;e[82]===Symbol.for("react.memo_cache_sentinel")?(ue=t.jsx(It,{size:14}),e[82]=ue):ue=e[82];let oe;e[83]!==b||e[84]!==Pe?(oe=t.jsxs(Fe,{type:"button",variant:"outline",size:"sm",className:"mt-2 w-full",disabled:Pe,onClick:b,children:[ue,"Add section"]}),e[83]=b,e[84]=Pe,e[85]=oe):oe=e[85];let we;return e[86]!==_e||e[87]!==Ke||e[88]!==oe?(we=t.jsxs("div",{className:_e,children:[Ke,oe]}),e[86]=_e,e[87]=Ke,e[88]=oe,e[89]=we):we=e[89],we}function Tr(l){return l.id}const Pr="oklch(0.65 0.15 160)",ss="text-[oklch(0.45_0.15_160)] bg-[oklch(0.65_0.15_160/0.18)] dark:text-[oklch(0.78_0.15_160)] dark:bg-[oklch(0.65_0.15_160/0.22)]";function Wt(l){const e=Ie.c(5),{rule:r,matchers:c}=l,m=r?.__resolveType??"";let g;if(e[0]!==c||e[1]!==m){const S=c.find(N=>N.resolveType===m)?.iconName??er(m);g=Ba(S),e[0]=c,e[1]=m,e[2]=g}else g=e[2];const v=g;if(!v)return null;let f;return e[3]!==v?(f=t.jsx(v,{size:14,className:"shrink-0"}),e[3]=v,e[4]=f):f=e[4],f}function Rn(l){return l.map(e=>`${e.label}|${e.rule?.__resolveType??""}`).join(`
|
|
2
2
|
`)}function Lt(l){return l.map((e,r)=>({id:crypto.randomUUID(),index:r,variant:e}))}function Ar(l){return l.map((e,r)=>({...e,index:r}))}function Vr(l){const e=Ie.c(51),{entry:r,sortableId:c,isActive:m,canDelete:g,decofile:v,meta:f,matchers:d,onSelect:S,onRename:N,onDelete:A}=l;let T;e[0]!==c?(T={id:c,animateLayoutChanges:Or},e[0]=c,e[1]=T):T=e[1];const{attributes:R,listeners:k,setNodeRef:i,transform:b,isDragging:p}=qn(T);let $;e[2]!==b?($=Jn.Transform.toString(b?{...b,y:0}:null),e[2]=b,e[3]=$):$=e[3];const I=p?0:void 0;let P;e[4]!==$||e[5]!==I?(P={transform:$,opacity:I},e[4]=$,e[5]=I,e[6]=P):P=e[6];const o=P,j=f??void 0;let J;e[7]!==v||e[8]!==r.variant.rule||e[9]!==j?(J=xt(r.variant.rule,v,j),e[7]=v,e[8]=r.variant.rule,e[9]=j,e[10]=J):J=e[10];const w=J,Q=m?ss:"text-muted-foreground hover:bg-muted hover:text-foreground",C=p?"cursor-grabbing":"cursor-grab";let z;e[11]!==Q||e[12]!==C?(z=Ce("group shrink-0 inline-flex items-center rounded-md transition-colors touch-none",Q,C),e[11]=Q,e[12]=C,e[13]=z):z=e[13];let M;e[14]!==w||e[15]!==d?(M=t.jsx(Wt,{rule:w,matchers:d}),e[14]=w,e[15]=d,e[16]=M):M=e[16];let U;e[17]!==r.variant.label?(U=t.jsx("span",{className:"truncate",children:r.variant.label}),e[17]=r.variant.label,e[18]=U):U=e[18];let ee;e[19]!==R||e[20]!==k||e[21]!==S||e[22]!==M||e[23]!==U?(ee=t.jsxs("button",{type:"button",...R,...k,onClick:S,className:"inline-flex items-center gap-1.5 h-8 pl-3 pr-1.5 text-sm font-medium cursor-[inherit]",children:[M,U]}),e[19]=R,e[20]=k,e[21]=S,e[22]=M,e[23]=U,e[24]=ee):ee=e[24];const Se=`Actions for ${r.variant.label}`,se=m&&"opacity-100";let Y;e[25]!==se?(Y=Ce("inline-flex h-8 w-6 items-center justify-center pr-1 cursor-pointer transition-opacity","opacity-0 group-hover:opacity-100 data-[state=open]:opacity-100",se),e[25]=se,e[26]=Y):Y=e[26];let ae;e[27]===Symbol.for("react.memo_cache_sentinel")?(ae=t.jsx(Pn,{size:12}),e[27]=ae):ae=e[27];let te;e[28]!==Se||e[29]!==Y?(te=t.jsx(Ln,{asChild:!0,children:t.jsx("button",{type:"button","aria-label":Se,onClick:Er,onPointerDown:Mr,className:Y,children:ae})}),e[28]=Se,e[29]=Y,e[30]=te):te=e[30];let E;e[31]===Symbol.for("react.memo_cache_sentinel")?(E=t.jsx(dr,{size:14}),e[31]=E):E=e[31];let le;e[32]!==N?(le=t.jsxs(nt,{onClick:N,children:[E,"Rename"]}),e[32]=N,e[33]=le):le=e[33];let X;e[34]===Symbol.for("react.memo_cache_sentinel")?(X=t.jsx(Ja,{}),e[34]=X):X=e[34];const ne=!g;let re;e[35]===Symbol.for("react.memo_cache_sentinel")?(re=t.jsx(Fn,{size:14}),e[35]=re):re=e[35];let H;e[36]!==A||e[37]!==ne?(H=t.jsxs(nt,{variant:"destructive",disabled:ne,onClick:A,children:[re,"Delete"]}),e[36]=A,e[37]=ne,e[38]=H):H=e[38];let O;e[39]!==le||e[40]!==H?(O=t.jsxs(In,{align:"start",className:"w-36",children:[le,X,H]}),e[39]=le,e[40]=H,e[41]=O):O=e[41];let K;e[42]!==te||e[43]!==O?(K=t.jsxs(zn,{children:[te,O]}),e[42]=te,e[43]=O,e[44]=K):K=e[44];let ie;return e[45]!==i||e[46]!==o||e[47]!==ee||e[48]!==K||e[49]!==z?(ie=t.jsxs("div",{ref:i,style:o,className:z,children:[ee,K]}),e[45]=i,e[46]=o,e[47]=ee,e[48]=K,e[49]=z,e[50]=ie):ie=e[50],ie}function Mr(l){return l.stopPropagation()}function Er(l){return l.stopPropagation()}function Or(){return!1}function $r(l){const e=Ie.c(13),{variant:r,decofile:c,meta:m,matchers:g}=l,v=m??void 0;let f;e[0]!==c||e[1]!==v||e[2]!==r.rule?(f=xt(r.rule,c,v),e[0]=c,e[1]=v,e[2]=r.rule,e[3]=f):f=e[3];const d=f;let S;e[4]===Symbol.for("react.memo_cache_sentinel")?(S=Ce("inline-flex items-center gap-1.5 h-8 pl-3 pr-3 text-sm font-medium rounded-md shadow-lg ring-1 ring-border/60 cursor-grabbing",ss),e[4]=S):S=e[4];let N;e[5]!==d||e[6]!==g?(N=t.jsx(Wt,{rule:d,matchers:g}),e[5]=d,e[6]=g,e[7]=N):N=e[7];let A;e[8]!==r.label?(A=t.jsx("span",{className:"truncate",children:r.label}),e[8]=r.label,e[9]=A):A=e[9];let T;return e[10]!==N||e[11]!==A?(T=t.jsxs("div",{className:S,children:[N,A]}),e[10]=N,e[11]=A,e[12]=T):T=e[12],T}function Kr(l){const e=Ie.c(77),{listKey:r,variants:c,activeIndex:m,decofile:g,meta:v,matchers:f,onSelect:d,onReorder:S,onRename:N,onDelete:A,onAdd:T}=l;let R;e[0]!==c?(R=()=>Lt(c),e[0]=c,e[1]=R):R=e[1];const[k,i]=_.useState(R),[b,p]=_.useState(null),[$,I]=_.useState(r),[P,o]=_.useState(c.length);let j;e[2]!==c?(j=()=>Rn(c),e[2]=c,e[3]=j):j=e[3];const[J,w]=_.useState(j),Q=_.useRef(!1),C=Rn(c);$!==r?(I(r),o(c.length),w(C),i(Lt(c))):P!==c.length?(o(c.length),w(C),i(Lt(c))):J!==C&&(w(C),i(oe=>c.map((we,V)=>({id:oe[V]?.id??crypto.randomUUID(),index:V,variant:we}))));let z;e[4]===Symbol.for("react.memo_cache_sentinel")?(z={activationConstraint:{distance:8}},e[4]=z):z=e[4];let M;e[5]===Symbol.for("react.memo_cache_sentinel")?(M={coordinateGetter:Yn},e[5]=M):M=e[5];const U=Hn(yt(Wn,z),yt(Un,M));let ee;e[6]!==k?(ee=k.map(Br),e[6]=k,e[7]=ee):ee=e[7];const Se=ee,se=c.length>1;let Y;e[8]!==k?(Y=oe=>{const we=String(oe.active.id);p(k.find(V=>V.id===we)??null)},e[8]=k,e[9]=Y):Y=e[9];const ae=Y;let te;e[10]!==Se||e[11]!==S?(te=oe=>{p(null);const{active:we,over:V}=oe;if(!V||we.id===V.id)return;const L=Se.indexOf(String(we.id)),Z=Se.indexOf(String(V.id));L===-1||Z===-1||(i(Le=>Ar(mt([...Le],L,Z))),Q.current=!0,requestAnimationFrame(()=>{Q.current=!1}),S(L,Z))},e[10]=Se,e[11]=S,e[12]=te):te=e[12];const E=te;let le;e[13]===Symbol.for("react.memo_cache_sentinel")?(le=()=>{p(null)},e[13]=le):le=e[13];const X=le;let ne,re,H,O,K,ie,pe,he,de,ce,W,B;if(e[14]!==b||e[15]!==m||e[16]!==se||e[17]!==g||e[18]!==k||e[19]!==Se||e[20]!==E||e[21]!==ae||e[22]!==f||e[23]!==v||e[24]!==A||e[25]!==N||e[26]!==d||e[27]!==U){const oe=V=>{Q.current||d(V)};W="flex items-center border-b shrink-0";const we=b&&"cursor-grabbing";e[40]!==we?(ce=Ce("flex flex-1 min-w-0 items-center gap-1.5 pl-3 pr-2 py-2 overflow-x-auto",we),e[40]=we,e[41]=ce):ce=e[41],re=Zn,K=U,ie=Qn,pe=ae,he=E,de=X,ne=Xn,B=Se,H=Za,O=k.map(V=>t.jsx(Vr,{sortableId:V.id,entry:V,isActive:V.index===m,canDelete:se,decofile:g,meta:v,matchers:f,onSelect:()=>oe(V.index),onRename:()=>N(V.index),onDelete:()=>A(V.index)},V.id)),e[14]=b,e[15]=m,e[16]=se,e[17]=g,e[18]=k,e[19]=Se,e[20]=E,e[21]=ae,e[22]=f,e[23]=v,e[24]=A,e[25]=N,e[26]=d,e[27]=U,e[28]=ne,e[29]=re,e[30]=H,e[31]=O,e[32]=K,e[33]=ie,e[34]=pe,e[35]=he,e[36]=de,e[37]=ce,e[38]=W,e[39]=B}else ne=e[28],re=e[29],H=e[30],O=e[31],K=e[32],ie=e[33],pe=e[34],he=e[35],de=e[36],ce=e[37],W=e[38],B=e[39];let De;e[42]!==ne||e[43]!==H||e[44]!==O||e[45]!==B?(De=t.jsx(ne,{items:B,strategy:H,children:O}),e[42]=ne,e[43]=H,e[44]=O,e[45]=B,e[46]=De):De=e[46];let _e;e[47]!==b||e[48]!==g||e[49]!==f||e[50]!==v?(_e=b?t.jsx($r,{variant:b.variant,decofile:g,meta:v,matchers:f}):null,e[47]=b,e[48]=g,e[49]=f,e[50]=v,e[51]=_e):_e=e[51];let Ee;e[52]!==_e?(Ee=t.jsx(Gn,{dropAnimation:null,children:_e}),e[52]=_e,e[53]=Ee):Ee=e[53];let ke;e[54]!==re||e[55]!==K||e[56]!==ie||e[57]!==pe||e[58]!==he||e[59]!==de||e[60]!==De||e[61]!==Ee?(ke=t.jsxs(re,{sensors:K,collisionDetection:ie,onDragStart:pe,onDragEnd:he,onDragCancel:de,children:[De,Ee]}),e[54]=re,e[55]=K,e[56]=ie,e[57]=pe,e[58]=he,e[59]=de,e[60]=De,e[61]=Ee,e[62]=ke):ke=e[62];let Te;e[63]!==ce||e[64]!==ke?(Te=t.jsx("div",{className:ce,children:ke}),e[63]=ce,e[64]=ke,e[65]=Te):Te=e[65];let Oe;e[66]===Symbol.for("react.memo_cache_sentinel")?(Oe={color:Pr},e[66]=Oe):Oe=e[66];let $e;e[67]===Symbol.for("react.memo_cache_sentinel")?($e=t.jsx(It,{size:14}),e[67]=$e):$e=e[67];let be;e[68]!==T?(be=t.jsx(at,{asChild:!0,children:t.jsx(Fe,{type:"button",variant:"ghost",size:"icon","aria-label":"Add variant",className:"size-8 shrink-0 cursor-pointer",style:Oe,onClick:T,children:$e})}),e[68]=T,e[69]=be):be=e[69];let Ke;e[70]===Symbol.for("react.memo_cache_sentinel")?(Ke=t.jsx(rt,{side:"bottom",children:"Add variant"}),e[70]=Ke):Ke=e[70];let Pe;e[71]!==be?(Pe=t.jsx("div",{className:"shrink-0 pr-3 pl-1 py-2",children:t.jsxs(st,{children:[be,Ke]})}),e[71]=be,e[72]=Pe):Pe=e[72];let ue;return e[73]!==W||e[74]!==Te||e[75]!==Pe?(ue=t.jsxs("div",{className:W,children:[Te,Pe]}),e[73]=W,e[74]=Te,e[75]=Pe,e[76]=ue):ue=e[76],ue}function Br(l){return l.id}function Fr(l){const e=Ie.c(37),{open:r,onOpenChange:c,defaultBlockId:m,isPending:g,onSubmit:v}=l,f=m===void 0?"":m,d=g===void 0?!1:g,[S,N]=_.useState(f),[A,T]=_.useState(r);r!==A&&(T(r),r&&N(f));let R;e[0]!==d||e[1]!==c?(R=U=>{!U&&!d&&c(!1)},e[0]=d,e[1]=c,e[2]=R):R=e[2];const k=R;let i;e[3]!==S||e[4]!==d||e[5]!==v?(i=async U=>{U.preventDefault();const ee=S.trim();!ee||d||await v(ee)},e[3]=S,e[4]=d,e[5]=v,e[6]=i):i=e[6];const b=i;let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsxs(Mn,{children:[t.jsx(Vn,{children:"Save as global"}),t.jsx(En,{children:"Save this section as a global block so it can be reused on other pages."})]}),e[7]=p):p=e[7];let $;e[8]===Symbol.for("react.memo_cache_sentinel")?($=t.jsx("label",{htmlFor:"block-id",className:"text-sm font-medium",children:"Block name"}),e[8]=$):$=e[8];let I;e[9]===Symbol.for("react.memo_cache_sentinel")?(I=U=>N(U.target.value),e[9]=I):I=e[9];let P;e[10]!==S||e[11]!==d?(P=t.jsxs("div",{className:"py-4 space-y-2",children:[$,t.jsx(Bn,{id:"block-id",value:S,onChange:I,placeholder:"MyNewBlock",autoFocus:!0,disabled:d})]}),e[10]=S,e[11]=d,e[12]=P):P=e[12];let o;e[13]!==c?(o=()=>c(!1),e[13]=c,e[14]=o):o=e[14];let j;e[15]!==d||e[16]!==o?(j=t.jsx(Fe,{type:"button",variant:"outline",onClick:o,disabled:d,children:"Cancel"}),e[15]=d,e[16]=o,e[17]=j):j=e[17];let J;e[18]!==S||e[19]!==d?(J=!S.trim()||d,e[18]=S,e[19]=d,e[20]=J):J=e[20];let w;e[21]!==d?(w=d?t.jsxs(t.Fragment,{children:[t.jsx(Ut,{size:14,className:"animate-spin"}),"Saving…"]}):"Save",e[21]=d,e[22]=w):w=e[22];let Q;e[23]!==J||e[24]!==w?(Q=t.jsx(Fe,{type:"submit",disabled:J,children:w}),e[23]=J,e[24]=w,e[25]=Q):Q=e[25];let C;e[26]!==j||e[27]!==Q?(C=t.jsxs(On,{children:[j,Q]}),e[26]=j,e[27]=Q,e[28]=C):C=e[28];let z;e[29]!==b||e[30]!==C||e[31]!==P?(z=t.jsx($n,{className:"sm:max-w-md",children:t.jsxs("form",{onSubmit:b,children:[p,P,C]})}),e[29]=b,e[30]=C,e[31]=P,e[32]=z):z=e[32];let M;return e[33]!==k||e[34]!==r||e[35]!==z?(M=t.jsx(Kn,{open:r,onOpenChange:k,children:z}),e[33]=k,e[34]=r,e[35]=z,e[36]=M):M=e[36],M}function Cn(l){const e=Ie.c(21),{activeSchema:r,formValue:c,formResetKey:m,onFormChange:g,onBreadcrumbChange:v,breadcrumbPath:f,emptyMessage:d,beforeForm:S,seoResolveType:N,siteDefaultSeo:A,meta:T,decofile:R,onSaveReferencedBlock:k,sandbox:i}=l;let b;e[0]!==f?(b=f===void 0?[]:f,e[0]=f,e[1]=b):b=e[1];const p=b;let $;e[2]!==r||e[3]!==p||e[4]!==R||e[5]!==m||e[6]!==c||e[7]!==T||e[8]!==v||e[9]!==g||e[10]!==k||e[11]!==i||e[12]!==N||e[13]!==A?($=r&&c?N?t.jsx(ur,{schema:r,resolveType:N,value:c,formResetKey:m,onChange:g,onBreadcrumbChange:v,siteDefaultSeo:A}):t.jsx(Ht,{schema:r,value:c,onChange:g,basePath:"",breadcrumbPath:p,onBreadcrumbChange:v,meta:T,decofile:R,onSaveReferencedBlock:k,sandbox:i},m):null,e[2]=r,e[3]=p,e[4]=R,e[5]=m,e[6]=c,e[7]=T,e[8]=v,e[9]=g,e[10]=k,e[11]=i,e[12]=N,e[13]=A,e[14]=$):$=e[14];const I=$;let P;e[15]!==d||e[16]!==I?(P=I??t.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:d}),e[15]=d,e[16]=I,e[17]=P):P=e[17];let o;return e[18]!==S||e[19]!==P?(o=t.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:t.jsxs("div",{className:"mx-auto max-w-2xl",children:[S,P]})}),e[18]=S,e[19]=P,e[20]=o):o=e[20],o}const Lr="text-[oklch(0.45_0.15_160)] bg-[oklch(0.65_0.15_160/0.18)] dark:text-[oklch(0.78_0.15_160)] dark:bg-[oklch(0.65_0.15_160/0.22)]";function zr(l,e){return ha(l,e,tt)}function Ir(l){const e=Ie.c(13),{pageKey:r,initialName:c,initialPath:m,onFieldChange:g}=l,[v,f]=_.useState(c),[d,S]=_.useState(m),[N,A]=_.useState(r);N!==r&&(A(r),f(c),S(m));let T;e[0]!==g?(T=p=>{f(p.target.value),g("name",p.target.value)},e[0]=g,e[1]=T):T=e[1];let R;e[2]!==v||e[3]!==T?(R=t.jsx("input",{type:"text",value:v,onChange:T,className:"w-full bg-transparent text-sm font-semibold truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:"Page name"}),e[2]=v,e[3]=T,e[4]=R):R=e[4];let k;e[5]!==g?(k=p=>{S(p.target.value),g("path",p.target.value)},e[5]=g,e[6]=k):k=e[6];let i;e[7]!==d||e[8]!==k?(i=t.jsx("input",{type:"text",value:d,onChange:k,className:"w-full bg-transparent text-xs text-muted-foreground truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:"/path"}),e[7]=d,e[8]=k,e[9]=i):i=e[9];let b;return e[10]!==R||e[11]!==i?(b=t.jsxs("div",{className:"space-y-1",children:[R,i]}),e[10]=R,e[11]=i,e[12]=b):b=e[12],b}function Dn(l){const e=Ie.c(6),{onClick:r}=l;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(An,{size:14}),e[0]=c):c=e[0];let m;e[1]!==r?(m=t.jsx(at,{asChild:!0,children:t.jsx(Fe,{type:"button",variant:"ghost",size:"icon","aria-label":"Add variant",className:"size-7 shrink-0 text-[oklch(0.65_0.15_160)]",onClick:r,children:c})}),e[1]=r,e[2]=m):m=e[2];let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx(rt,{side:"bottom",children:"Add variant"}),e[3]=g):g=e[3];let v;return e[4]!==m?(v=t.jsxs(st,{children:[m,g]}),e[4]=m,e[5]=v):v=e[5],v}function Nl({orgSlug:l,virtualMcpId:e,branch:r,previewReady:c=!0,previewUrl:m,currentPath:g,activePageBlockKey:v=null,activeGlobalBlockKey:f=null,externalSelectedIndex:d,onSaved:S,initialEditSeo:N=!1,onExitSeo:A,onViewJsonFile:T,onVariantPreviewOverride:R}){const k=c?{orgSlug:l,virtualMcpId:e,branch:r,previewUrl:m}:null,{data:i,isLoading:b}=aa(k),{data:p,isLoading:$}=ra(k),I=ia(),P=I?.entity?.id===e?I.entity.metadata?.siteSlug??null:null,[o,j]=_.useState(null),[J,w]=_.useState(null),[Q,C]=_.useState(null),[z,M]=_.useState(0),[U,ee]=_.useState(void 0),[Se,se]=_.useState(null),[Y,ae]=_.useState(null),[te,E]=_.useState([]),[le,X]=_.useState(0),[ne,re]=_.useState(null),[H,O]=_.useState(null),[K,ie]=_.useState(!0),[pe,he]=_.useState(!1),[de,ce]=_.useState(!1),[W,B]=_.useState(N),[De,_e]=_.useState(N);N&&!De&&(_e(!0),B(!0),j(null),w(null),C(null),E([])),!N&&De&&_e(!1);const[Ee,ke]=_.useState(null),[Te,Oe]=_.useState(void 0),[$e,be]=_.useState([]),[Ke,Pe]=_.useState(0),[ue,oe]=_.useState(0),[we,V]=_.useState(null),[L,Z]=_.useState(null),[Le,He]=_.useState(null),We=Gs(),as=`${l}/${e}/${r}`,jt=oa({orgSlug:l,virtualMcpId:e,branch:r}),[rs,is]=_.useState(g),[os,ls]=_.useState(v),[cs,us]=_.useState(f);(rs!==g||os!==v||cs!==f)&&(queueMicrotask(()=>jt.flush()),is(g),ls(v),us(f),j(null),w(null),C(null),M(0),se(null),ae(null),oe(0),V(null),Z(null),E([]),X(n=>n+1),B(!1),ke(null),Oe(void 0),be([]),Pe(n=>n+1));const Ae=la({orgSlug:l,virtualMcpId:e,branch:r}),qt=fr((n,s)=>{Ae.mutate({blockKey:n,data:s},{onSuccess:()=>S?.(),onError:a=>fe.error(`Save failed: ${a.message}`)})}),Jt=ca({orgSlug:l,virtualMcpId:e,branch:r}),[_t,Yt]=_.useState(!1),kt=_.useRef(null),it=_.useRef(null),ot=_.useRef(null),wt=_.useRef({}),qe=_.useRef({rawSections:[],parsedSections:[],decofile:{},activePageKey:null,pageVariants:[],variantIndex:0,sectionVariantIndex:0,selectedSectionIndex:null});if(!c||b||$)return t.jsx("div",{className:"h-full w-full flex items-center justify-center",children:t.jsx(Ut,{size:20,className:"animate-spin text-muted-foreground"})});if(!i||!p)return t.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:"Could not load site data."});const ds=ua(i),ve=!!f,Be=ve?null:da(ds,g,v),x=ve?f:Be?.key??null,Nt=ve&&f?i[f]:void 0,Zt=ve&&f&&Nt?ma(f,Nt):ve&&f?f:"",ft=!ve&&x&&i[x]?i[x]:null,Rt=W&&i&&p&&x&&Be?_n(i,{kind:"page",pageKey:x,pageName:String(Be.name??""),path:String(Be.path??"")},p):null,ms=W?ft?.seo:void 0,Ct=Te!==void 0?Te:ms,fs=W?sr(Ct):void 0,ps=Rt?.seoTypeOptions??[],hs=W&&p?ar(p):"",Qt=Ee??fs??{},Dt=W&&Rt?rr(Qt,Rt):null,gs=W&&Dt&&ir(Ct)?vt(Dt,p):null,vs=W?or(i,p)?.seoData:void 0,Ve=ve?[{label:"Default",sections:[{__resolveType:f}]}]:zr(ft?.sections,i??{}),pt=Ve.length>1,Ne=Math.min(z,Ve.length-1),Xe=Ve[Ne],q=Xe?.sections??[],Re=St(q,i),Xt=!ve&&fa(ft?.sections);if(ve&&f&&Le!==f){He(f);const n=q[0],s=Re[0];if(n&&s){j(0),oe(0),E([]);const a=et(n,s,i);a&&(w(a.data),C(a.resolveType),Z(null),V(null))}}!ve&&Le!==null&&He(null),qe.current={rawSections:q,parsedSections:Re,decofile:i??{},activePageKey:x,pageVariants:Ve,variantIndex:Ne,sectionVariantIndex:ue,selectedSectionIndex:o};const Ss=()=>({multivariate:Xt,index:Ne,variants:Ve.map(n=>({rule:n.rule}))}),Gt=(n,s)=>{if(!R)return;if(!x||!Xt||n.length<=1){R(null);return}const a=xn(x,{multivariate:!0,index:s,variants:n},i,p);R(a.length>0?a:null)},lt=(n,s,a)=>{if(!R)return;if(!x){R(null);return}const u=Ss(),h=xn(x,u,i,p);if(!n||s<0){R(h.length>0?h:null);return}const D=Pa({pageKey:x,page:u,sectionIndex:s,sectionLazy:Re[s]?.isLazy??!1,mvObj:n,selectedVariantIndex:a,decofile:i,meta:p}),y=[...h,...D];R(y.length>0?y:null)},Je=(n,s,a,u=o??-1,h=!1)=>{const D=Qe(n,s);if(!D){w(null),C(null),Z(null),V(null),h&<(null,u,a);return}const F=Sn(D,tt)[a];if(!F){w(null),C(null),Z(null),V(null),h&<(null,u,a);return}const ge=ga(F.value,i);w(ge?.data??null),C(ge?.resolveType??null);const{resolveType:G,formValue:me}=Ot(F.rule,i,p??void 0);Z(G),V(me),h&<(D,u,a)};if(d!==void 0&&d!==U&&(ee(d??null),typeof d=="number")){const n=q[d],s=Re[d];if(n&&s)if(j(d),oe(0),E([]),X(a=>a+1),s.isMultivariate)Je(n,s,0,d);else{const a=et(n,s,i);a?(w(a.data),C(a.resolveType)):(w(null),C(null)),Z(null),V(null)}}const en={orgSlug:l,virtualMcpId:e,branch:r,previewUrl:m??void 0,siteSlug:P},Tt=Q&&p?vt(Q,p):null,ze=(n,s)=>{if(!x)return;const a=Ft(i,x,n,Ne,Ve);Ae.mutate({blockKey:x,data:a},{onSuccess:()=>s?.onSuccess?.()??S?.(),onError:u=>fe.error(`Save failed: ${u.message}`)})},ct=()=>{j(null),w(null),C(null),oe(0),V(null),Z(null),E([]),X(n=>n+1)},bs=(n,s)=>{kt.current&&clearTimeout(kt.current);const a=qe.current.sectionVariantIndex;kt.current=setTimeout(()=>{const{rawSections:u,parsedSections:h,decofile:D,activePageKey:y,pageVariants:F,variantIndex:ge}=qe.current,G=u[s];if(!G)return;const me=h[s];if(!me)return;if(me.isSavedBlock){const ye=me.isLazy?G.section?.__resolveType??G.__resolveType:G.__resolveType;Ae.mutate({blockKey:ye,data:n},{onSuccess:()=>S?.(),onError:je=>fe.error(`Save failed: ${je.message}`)});return}if(!y)return;const xe={...D[y]},Me=[...u];if(me.isMultivariate){const ye=Qe(G,me);if(!ye||!y)return;const je=Ma(ye,a,n);Me[s]=dt(G,me,je)}else if(me.isHidden){const ye=Tn(G.__resolveType),je=ye?{...G.section}:{...G},Ue=Array.isArray(je.variants)?[...je.variants]:[];Ue[0]&&(Ue[0]={...Ue[0],value:n}),je.variants=Ue,ye?Me[s]={...G,section:je}:Me[s]=je}else me.isLazy?Me[s]={...G,section:n}:Me[s]=n;if(F.length>1){const ye=xe.sections,je=[...ye?.variants??[]];je[ge]&&(je[ge]={...je[ge],value:Me}),xe.sections={...ye,variants:je}}else xe.sections=Me;Ae.mutate({blockKey:y,data:xe},{onSuccess:()=>S?.(),onError:ye=>fe.error(`Save failed: ${ye.message}`)})},Bt)},xs=n=>{j(n),oe(0),E([]),X(h=>h+1);const s=q[n],a=Re[n];if(!s||!a)return;if(a.isMultivariate){Je(s,a,0,n);return}const u=et(s,a,i);if(!u){w(null),C(null),Z(null),V(null),lt(null,n,0);return}w(u.data),C(u.resolveType),Z(null),V(null),lt(null,n,0)},tn=n=>{const s=n;w(s),o!==null&&bs(s,o)},Pt=n=>{if(!x||!i||!p||!Be)return;const s={kind:"page",pageKey:x,pageName:String(Be.name??""),path:String(Be.path??"")},a=_n(i,s,p);a&&jt.save(x,()=>{const u=We.getQueryData(ea.decofile(as))?.[x];if(!u||typeof u!="object"||u===null||Array.isArray(u))return null;const h={...u,...wt.current};return wt.current={},n?.raw!==void 0?{...h,seo:n.raw}:n?.inner!==void 0?cr(s,a,h,n.inner):h})},ys=(n,s)=>{x&&(wt.current[n]=s,Pt())},js=(n,s)=>{if(!x)return;const a=mt([...q],n,s);o!==null&&(o===n?j(s):n<o&&s>=o?j(o-1):n>o&&s<=o&&j(o+1)),ze(a)},_s=n=>{if(!x)return;const s=q.filter((a,u)=>u!==n);o===n?ct():o!==null&&o>n&&j(o-1),ze(s)},ks=n=>{if(!x)return;const s=q[n];if(!s)return;const a=[...q];a.splice(n+1,0,hr(s)),o!==null&&o>n&&j(o+1),ze(a)},ws=n=>{if(!x)return;const s=q[n],a=Re[n];if(!s||!a||a.isMultivariate)return;const u=a.isHidden?Na(s):Ra(s);if(!u)return;const h=[...q];h[n]=u,o===n&&ct(),ze(h)},Ns=n=>{if(!x)return;const s=q[n],a=Re[n];if(!s||!a||a.isMultivariate)return;const u=wa(s);if(!u)return;const h=[...q];h[n]=u,o===n&&ct(),ze(h)},Rs=n=>{if(!x)return;const s=q[n],a=Re[n];if(!s||!a?.isSavedBlock)return;const u=et(s,a,i);if(!u?.data)return;const{name:h,...D}=u.data,y=[...q];a.isLazy?y[n]={...s,section:D}:y[n]=D,o===n&&ct(),ze(y)},Cs=n=>{if(!x)return;const s=[...q,{__resolveType:n.resolveType}],a=s.length-1;ze(s,{onSuccess:()=>{he(!1),j(a),oe(0),E([]),X(y=>y+1);const u=s[a],h=St(s,i)[a];if(!u||!h)return;if(h.isMultivariate){Je(u,h,0);return}const D=et(u,h,i);if(!D){w(null),C(null),Z(null),V(null);return}w(D.data),C(D.resolveType),Z(null),V(null)}})},Ds=n=>{if(o===null)return;const s=q[o],a=Re[o];!s||!a?.isMultivariate||(oe(n),E([]),X(u=>u+1),Je(s,a,n,o,!0))},Ts=n=>{if(o===null||!x)return;const s=q[o],a=Re[o];if(!s||!a?.isMultivariate)return;const u=Qe(s,a);if(!u)return;const h=_a(u,n);if(!h){fe.error("Cannot delete the only variant.");return}const D=[...q];D[o]=dt(s,a,h);const y=h.variants;let F=ue;n===ue?F=Math.min(n,y.length-1):n<ue&&(F=ue-1),oe(F),E([]),X(ge=>ge+1),Je(D[o],a,F),ze(D)},Ps=n=>{if(o===null||!x)return;const s=q[o],a=Re[o];if(!s||!a?.isMultivariate)return;const u=Qe(s,a);if(!u)return;const h=ka(u,n),D=[...q];D[o]=dt(s,a,h);const y=n+1;oe(y),E([]),X(F=>F+1),Je(D[o],a,y),ze(D)},As=(n,s)=>{if(o===null||!x||n===s)return;const a=q[o],u=Re[o];if(!a||!u?.isMultivariate)return;const h=Qe(a,u);if(!h)return;const D=ya(h,n,s),y=[...q];y[o]=dt(a,u,D);let F=ue;ue===n?F=s:n<ue&&s>=ue?F=ue-1:n>ue&&s<=ue&&(F=ue+1),oe(F),Je(y[o],u,F),ze(y)},At=n=>{const s=n??o;if(s===null||!x)return;const a=q[s],u=Re[s];if(!a||!u)return;const h=va(a,u);if(!h){fe.error("This section cannot have variants.");return}const D=[...q];D[s]=h.section;const y=St(D,i)[s];if(!y?.isMultivariate){fe.error("Could not add variant.");return}j(s),oe(h.newVariantIndex),E([]),X(F=>F+1),Je(h.section,y,h.newVariantIndex,s),ze(D)},Vs=()=>{if(o===null||!x)return;const n=q[o],s=Re[o];if(!n||!s?.isMultivariate)return;const a=Qe(n,s);if(!a)return;const u=ja(n,s,a);if(!u){fe.error("Could not remove variants.");return}const h=[...q];h[o]=u;const D=St(h,i)[o];if(!D)return;oe(0),Z(null),V(null),E([]),X(F=>F+1);const y=et(u,D,i);y?(w(y.data),C(y.resolveType)):(w(null),C(null)),lt(null,o,0),ze(h)},Ms=async n=>{if(ne===null||!x)return;const s=wn(n,i);if(s){fe.error(s);return}const a=q[ne],u=Re[ne];if(!a||!u)return;const h=et(a,u,i);if(!h){fe.error("This section cannot be saved as global.");return}const D={...h.data,name:n};try{await Ae.mutateAsync({blockKey:n,data:D});const y=[...q];y[ne]={__resolveType:n},await Ae.mutateAsync({blockKey:x,data:Ft(i,x,y,Ne,Ve)}),o===ne&&ct(),re(null),fe.success(`Saved global block "${n}"`),S?.()}catch(y){fe.error(y instanceof Error?y.message:"Failed to save global block")}},nn=Xe?.rule;if(pt&&o===null&&Y===null&&nn){const{resolveType:n,formValue:s}=Ot(nn,i??{},p??void 0);ae(n),se(s)}const ht=p?tr(p):[],Es=!ve&&!!(m&&p&&i),sn=Y&&p?vt(Y,p):null,Os=()=>{it.current&&(clearTimeout(it.current),it.current=null),ot.current&&(clearTimeout(ot.current),ot.current=null)},an=async(n,s)=>{if(!(Ea(s,n,p)>0))try{await Jt.mutateAsync({blockKey:n})}catch(a){fe.error(a instanceof Error?a.message:"Could not delete matcher block")}},rn=n=>{it.current&&clearTimeout(it.current),it.current=setTimeout(()=>{const{activePageKey:s,decofile:a,variantIndex:u}=qe.current;if(!s)return;const h={...a[s]},D={...h.sections},y=[...D.variants??[]],F=y[u],ge=F?.rule;if($t(ge,a,p)){const G=ge?.__resolveType??"",me=a[G],xe=typeof me?.name=="string"?me.name:G,{__resolveType:Me,...ye}=n;Ae.mutate({blockKey:G,data:Kt(Me??"",ye,xe)},{onSuccess:()=>S?.(),onError:je=>fe.error(`Save failed: ${je.message}`)});return}F&&(y[u]={...F,rule:n}),h.sections={...D,variants:y},Ae.mutate({blockKey:s,data:h},{onSuccess:()=>S?.(),onError:G=>fe.error(`Save failed: ${G.message}`)})},Bt)},$s=n=>{ae(n);const s=n?{__resolveType:n}:{__resolveType:yn};se({}),rn(s)},Ks=n=>{const s=n;se(s);const a=Y?{__resolveType:Y,...s}:{...s};rn(a)},on=n=>{ot.current&&clearTimeout(ot.current);const{selectedSectionIndex:s,sectionVariantIndex:a}=qe.current;s!==null&&(ot.current=setTimeout(()=>{const{rawSections:u,parsedSections:h,decofile:D,activePageKey:y,pageVariants:F,variantIndex:ge}=qe.current;if(!y)return;const G=u[s],me=h[s];if(!G||!me?.isMultivariate)return;const xe=Qe(G,me);if(!xe)return;const Me=Va(xe,a,n),ye=[...u];ye[s]=dt(G,me,Me);const je=Ft(D,y,ye,ge,F);Ae.mutate({blockKey:y,data:je},{onSuccess:()=>S?.(),onError:Ue=>fe.error(`Save failed: ${Ue.message}`)})},Bt))},Bs=n=>{Z(n),V({}),on(n?{__resolveType:n}:{__resolveType:yn})},Fs=n=>{const s=n;V(s);const a=L?{__resolveType:L,...s}:{...s};on(a)};if(!ve&&!Be)return t.jsxs("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:["No page found for ",g]});if(ve&&!Nt)return t.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:"Global block not found"});const Ye=o!==null?Re[o]??null:null,ln=o!==null?q[o]:null,cn=ln&&Ye?.isMultivariate?Qe(ln,Ye):null,gt=cn?Sn(cn,tt):[],un=Math.min(ue,Math.max(gt.length-1,0)),Vt=gt[un]??null,Ge=Ye?.isMultivariate===!0,dn=o!==null&&Ye!==null,ut=dn&&(Ge||!!(Tt&&J)),Ls=ut&&!ve&&Ye?.isSavedBlock===!0,Ze=ve||Ls,zs=ve?Zt:Ye?.label??"",mn=L&&p?vt(L,p):null,Mt=ut&&(!ve||te.length>0)?ve?[Zt,...te]:[Be.name,Ye.label,...Ge&&Vt?[Vt.label]:[],...te]:[],Is=W&&Be?[Be.name,"SEO",...$e]:[],fn=W?Is:Ze?Mt.length>0?Mt:[zs]:Mt,pn=()=>{if(!x)return;const n=i[x],s=Sa(n.sections,q);if(!s)return;const a=ba(s);Ae.mutate({blockKey:x,data:{...n,sections:s}},{onSuccess:()=>{M(a),j(null),w(null),C(null),E([]),se(null),ae(null)},onError:u=>fe.error(`Save failed: ${u.message}`)})},hn=(n,s,a)=>{if(!x)return;const u=i[x],h=u.sections;if(!h||typeof h!="object"||Array.isArray(h))return;const D=h;if(!Array.isArray(D.variants))return;const y=n([...D.variants]);if(!y)return;const F=Aa(D,y),ge={...i,[x]:{...u,sections:F}};Ae.mutate({blockKey:x,data:ge[x]},{onSuccess:()=>{s?.(),a&&an(a,ge)},onError:G=>fe.error(`Save failed: ${G.message}`)})},Hs=n=>{O(null),M(n),j(null),w(null),C(null),E([]);const s=Ve[n]?.rule,{resolveType:a,formValue:u}=Ot(s,i??{},p??void 0);ae(a),se(u),Gt(Ve.map(h=>({rule:h.rule})),n)},Us=(n,s)=>{if(n===s)return;let a=Ne;Ne===n?a=s:n<Ne&&s>=Ne?a=Ne-1:n>Ne&&s<=Ne&&(a=Ne+1),M(a);const u=mt(Ve.map(h=>({rule:h.rule})),n,s);Gt(u,a),hn(h=>mt(h,n,s))},Ws=n=>{const s=Ve[n]?.rule,a=xa(s,i??{},p??void 0);hn(u=>u.length<=1?null:(u.splice(n,1),u),()=>{Ve.length-1===1?M(0):n<Ne?M(Ne-1):n===Ne&&M(Math.max(0,n-1)),j(null),w(null),C(null),E([]),se(null),ae(null)},a)},qs=async(n,s)=>{Os();const a=qe.current.activePageKey,u=qe.current.decofile;if(!a)return;const h=u[a],D=h.sections;if(!D||typeof D!="object"||Array.isArray(D))return;const y=D;if(!Array.isArray(y.variants))return;const F=[...y.variants],ge=F[n];if(!ge?.rule||typeof ge.rule!="object"){fe.error("This variant has no matcher rule to rename.");return}const G=ge.rule,me=s.trim();Yt(!0);try{if(!me){if(!$t(G,u,p)){O(null);return}const Et=G.__resolveType??"";F[n]={...ge,rule:Ca(G,u,p)};const vn={...u,[a]:{...h,sections:{...y,variants:F}}};await Ae.mutateAsync({blockKey:a,data:vn[a]}),await an(Et,vn),O(null),S?.();return}const xe=Da(G,u,p);if(!xe){fe.error("Could not read this variant's matcher rule.");return}if(xe.blockKey){await Ae.mutateAsync({blockKey:xe.blockKey,data:Kt(xe.resolveType,xe.data,me)}),O(null),S?.();return}const Me=kn(me),ye=wn(Me,u);if(ye){fe.error(ye);return}const je=Kt(xe.resolveType,xe.data,me);let Ue=null;try{await Ae.mutateAsync({blockKey:Me,data:je}),Ue=Me,F[n]={...ge,rule:Ta(Me)},await Ae.mutateAsync({blockKey:a,data:{...h,sections:{...y,variants:F}}}),Ue=null}catch(Et){throw Ue&&await Jt.mutateAsync({blockKey:Ue}).catch(()=>{}),Et}O(null),fe.success(`Saved matcher as global block "${me}"`),S?.()}catch(xe){fe.error(xe instanceof Error?xe.message:"Failed to rename variant")}finally{Yt(!1)}},gn=()=>{ct()},Js=n=>{ke(n),Pt({inner:n})},Ys=n=>{Oe(n),Pt({raw:n})},Zs=()=>{ke(null),be([])},Qs=()=>Pe(n=>n+1),Xs=n=>{if(W){if(n===0){jt.flush(),B(!1),ke(null),Oe(void 0),be([]),Pe(a=>a+1),A?.();return}if(n===1){be([]),Pe(a=>a+1);return}be($e.slice(0,n-1)),Pe(a=>a+1);return}if(ve){E(te.slice(0,n)),X(a=>a+1);return}if(n===0){gn();return}if(n===1){E([]),X(a=>a+1);return}if(Ge&&n===2){E([]),X(a=>a+1);return}const s=Ge?2:1;E(te.slice(0,n-s))};return t.jsxs("div",{className:"flex h-full min-w-0 w-full flex-col",children:[t.jsx("div",{className:"shrink-0",children:Ze||ut||W?t.jsxs("div",{className:Ce("border-b px-3 py-2.5",Ze&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[!ve&&pt&&Xe&&t.jsxs("button",{type:"button",onClick:gn,title:`Editing in variant: ${Xe.label}`,className:Ce("shrink-0 inline-flex items-center gap-1 rounded-md h-6 px-1.5 text-xs font-medium cursor-pointer transition-opacity hover:opacity-80",Lr),children:[t.jsx(Wt,{rule:xt(Xe.rule,i??{},p??void 0),matchers:ht}),t.jsx("span",{className:"max-w-[160px] truncate",children:Xe.label})]}),t.jsx("nav",{"aria-label":"Editing breadcrumb",className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:fn.map((n,s)=>{const a=s===fn.length-1;return t.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[s>0&&t.jsx($a,{className:"size-3 shrink-0 text-muted-foreground/60"}),t.jsx("button",{type:"button",onClick:()=>Xs(s),title:n,className:Ce("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors",a?Ze?"font-semibold text-global-section-fg dark:text-global-section-fg-dark":"font-medium text-foreground":Ze?"text-foreground/80":"text-muted-foreground",Ze?"hover:bg-global-section/15":"hover:bg-accent hover:text-accent-foreground"),children:n})]},`${n}-${s}`)})}),Ze&&t.jsxs(st,{children:[t.jsx(at,{asChild:!0,children:t.jsx("span",{className:"shrink-0 cursor-help",children:t.jsx(za,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),t.jsx(rt,{side:"bottom",className:"max-w-[260px]",children:"A global section is a reusable block shared across your site. Editing it here updates it everywhere it's used."})]}),dn&&!Ge&&!Ye?.isHidden&&x&&t.jsx(Dn,{onClick:()=>At()})]}),Ze&&t.jsx("p",{className:"mt-1.5 py-1.5 pl-1 text-sm leading-snug text-foreground",children:"This is a global section. Changes apply everywhere this section is used across your site."})]}):t.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2.5",children:[t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx(Ir,{pageKey:x,initialName:Be.name,initialPath:Be.path,onFieldChange:ys})}),t.jsxs(st,{children:[t.jsx(at,{asChild:!0,children:t.jsx(Fe,{type:"button",variant:"ghost",size:"icon","aria-label":"Edit SEO",className:"size-7 shrink-0",onClick:()=>B(!0),children:t.jsx(Fa,{size:14})})}),t.jsx(rt,{side:"bottom",children:"Edit SEO"})]}),t.jsxs(st,{children:[t.jsx(at,{asChild:!0,children:t.jsx(Fe,{type:"button",variant:"ghost",size:"icon","aria-label":"View JSON",className:"size-7 shrink-0",onClick:()=>T&&x?T(x):ce(!0),children:t.jsx(La,{size:14})})}),t.jsx(rt,{side:"bottom",children:"View JSON"})]}),t.jsx(Dn,{onClick:pn})]})}),pt&&!ut&&!W&&x&&t.jsx(Kr,{listKey:x,variants:Ve,activeIndex:Ne,decofile:i??{},meta:p,matchers:ht,onSelect:Hs,onReorder:Us,onRename:O,onDelete:Ws,onAdd:pn}),W?t.jsx(bt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:t.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:t.jsx("div",{className:"mx-auto max-w-2xl",children:ft&&x?t.jsx(lr,{rawSeo:Ct,innerSeo:Qt,defaultResolveType:hs,seoSchema:gs,activeResolveType:Dt,seoTypeOptions:ps,formResetKey:Ke,siteDefaultSeo:vs,onBreadcrumbChange:be,onPersistRaw:Ys,onInnerChange:Js,onClearForm:Zs,onBumpFormKey:Qs}):t.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"SEO schema not found for this site."})})})}):ut?t.jsxs(bt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[Ge&>.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(nr,{listKey:`${x??""}:${o??""}`,variants:gt.map((n,s)=>({index:s,label:n.label})),selectedIndex:un,onSelect:Ds,onDuplicate:Ps,onDelete:Ts,onRemoveAll:Vs,onReorder:As,onAdd:()=>At()}),Ge&&t.jsxs("div",{className:"px-3 py-3 border-b space-y-2",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Variant rule"}),t.jsx(jn,{currentRt:L??"",currentLabel:tt(Vt?.rule),matchers:ht,onSelect:Bs}),mn&&we&&t.jsx("div",{className:"pt-1",children:t.jsx(Ht,{schema:mn,value:we,onChange:Fs,basePath:""})})]})]}),t.jsx(Cn,{activeSchema:Tt,formValue:J,formResetKey:le,onFormChange:tn,onBreadcrumbChange:E,breadcrumbPath:te,emptyMessage:"No editable fields for this variant.",meta:p,decofile:i,onSaveReferencedBlock:qt,sandbox:en})]}):ve?t.jsx(bt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:t.jsx(Cn,{activeSchema:Tt,formValue:J,formResetKey:le,onFormChange:tn,onBreadcrumbChange:E,breadcrumbPath:te,emptyMessage:"No editable fields for this global block.",meta:p,decofile:i,onSaveReferencedBlock:qt,sandbox:en})}):t.jsxs(bt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[pt&&Y!==null&&t.jsxs("div",{className:Ce("px-3 border-b",K?"pt-3 pb-5 space-y-3":"py-2"),children:[t.jsxs("button",{type:"button",onClick:()=>ie(n=>!n),className:"flex w-full items-center justify-between gap-2 text-left cursor-pointer rounded-sm py-0.5 hover:bg-muted/40","aria-expanded":K,children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Variant rule"}),K?t.jsx(Ka,{className:"size-3.5 shrink-0 text-muted-foreground"}):t.jsx(Oa,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),K&&t.jsxs("div",{className:Ce("space-y-3",_t&&"pointer-events-none opacity-50"),children:[t.jsx(jn,{currentRt:Y,currentLabel:bn(Xe?.rule,i??{},tt,p??void 0),matchers:ht,onSelect:$s}),sn&&Se&&t.jsx("div",{className:"space-y-3",children:t.jsx(Ht,{schema:sn,value:Se,onChange:Ks,basePath:""})})]})]}),t.jsx("div",{className:"p-2 pt-3",children:t.jsx(Dr,{listKey:`${x??""}-${Ne}`,rawSections:q,sections:Re,meta:p,selectedIndex:o,onSelect:xs,onReorder:js,onDelete:_s,onDuplicate:ks,onMakeReusable:re,onToggleHidden:ws,onToggleLazy:Ns,onAddVariant:At,onDetach:Rs,onAddSection:()=>he(!0),canAddSection:Es})})]}),t.jsx(Fr,{open:ne!==null,onOpenChange:n=>{n||re(null)},defaultBlockId:ne!==null?kn(Re[ne]?.label??""):"",isPending:Ae.isPending,onSubmit:Ms}),m&&t.jsx(mr,{open:pe,onOpenChange:he,meta:p,decofile:i,previewBaseUrl:m,onSelect:Cs}),de&&x&&i&&t.jsx(pa,{open:de,onOpenChange:ce,pageKey:x,decofile:i}),H!==null&&t.jsx(pr,{open:!0,initialName:$t(Ve[H]?.rule,i??{},p??void 0)?bn(Ve[H]?.rule,i??{},tt,p??void 0):"",autoLabel:tt(xt(Ve[H]?.rule,i??{},p??void 0)),isPending:_t,onSubmit:async n=>{await qs(H,n)},onOpenChange:n=>{!n&&!_t&&O(null)}})]})}export{Nl as SectionsEditor};
|