decocms 3.98.0 → 3.99.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{AlertCircle-kcMUHNYP.js → AlertCircle-VcwplCRi.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-KPaHD_ZU.js → ArrowUpRight-CAv7CUnJ.js} +1 -1
- package/dist/client/assets/{CheckCircle-Do934x7B.js → CheckCircle-V30FMM2D.js} +1 -1
- package/dist/client/assets/{ChevronDown-DJ5SHmhN.js → ChevronDown-URo4LveF.js} +1 -1
- package/dist/client/assets/{ChevronLeft-QZNH5ck-.js → ChevronLeft-aMkPes9N.js} +1 -1
- package/dist/client/assets/{ChevronRight-BXEszS6k.js → ChevronRight-oz8o6WPV.js} +1 -1
- package/dist/client/assets/{ChevronUp-CUesWqmK.js → ChevronUp-HJUE3-BD.js} +1 -1
- package/dist/client/assets/{DotsVertical-F-o-_a2z.js → DotsVertical-QF46dzdi.js} +1 -1
- package/dist/client/assets/{Eye-FmUDnTHn.js → Eye-BSiFxHQB.js} +1 -1
- package/dist/client/assets/{FilterLines-eS3dI9hB.js → FilterLines-CEzORaPw.js} +1 -1
- package/dist/client/assets/{Globe01-Ckwe4UHh.js → Globe01-wGomueqV.js} +1 -1
- package/dist/client/assets/{Globe04-iXhOnFjr.js → Globe04-CsKOsQ4z.js} +1 -1
- package/dist/client/assets/{HardDrive-CNIST2bR.js → HardDrive-BuI4Q48l.js} +1 -1
- package/dist/client/assets/{Key01-wlyPB5nN.js → Key01-r6MDYdDw.js} +1 -1
- package/dist/client/assets/{LayoutLeft-C_wbh4sE.js → LayoutLeft-BFxGsVdk.js} +1 -1
- package/dist/client/assets/{LinkExternal01-BoVxtqR2.js → LinkExternal01-BWnRnxGs.js} +1 -1
- package/dist/client/assets/{Monitor01-DNvJhnf-.js → Monitor01-SEZLDRFN.js} +1 -1
- package/dist/client/assets/{Palette-Bf6p_3g1.js → Palette-CEjENuG4.js} +1 -1
- package/dist/client/assets/{Play-D6BtU9Uh.js → Play-BDoh8EAp.js} +1 -1
- package/dist/client/assets/{Plus-8zBKSNee.js → Plus-Bw9lc6SR.js} +1 -1
- package/dist/client/assets/{SearchMd-57vTBUjU.js → SearchMd-BMfw7gZ4.js} +1 -1
- package/dist/client/assets/{Settings02-k7X7M16V.js → Settings02-DbH9OAzT.js} +1 -1
- package/dist/client/assets/{Shield01-6X9Jy9--.js → Shield01-C1R4fpvK.js} +1 -1
- package/dist/client/assets/{Star01-BUumId75.js → Star01-BwAv907s.js} +1 -1
- package/dist/client/assets/{Stars01-BvvUaY8d.js → Stars01-D1icdaCh.js} +1 -1
- package/dist/client/assets/{Stars02-f3tbtjbB.js → Stars02-PPXsboxW.js} +1 -1
- package/dist/client/assets/{Sun-42Xfv_Dc.js → Sun-Dw86eVev.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-BeteqXsq.js → SwitchHorizontal01-F_1MjTR3.js} +1 -1
- package/dist/client/assets/{Tool01-DKUGTxge.js → Tool01-DvTGD1Yt.js} +1 -1
- package/dist/client/assets/{Trash01-DDwxWuR_.js → Trash01-d58N8w5a.js} +1 -1
- package/dist/client/assets/{Upload01-CvwE1uG-.js → Upload01-C_hHbDSF.js} +1 -1
- package/dist/client/assets/{User01-KLLrp_Cb.js → User01-BDtU1dk1.js} +1 -1
- package/dist/client/assets/{Users01-BoxxsDP9.js → Users01-PX3eYoC8.js} +1 -1
- package/dist/client/assets/{Users03-Cnldjgk9.js → Users03-CL71IAQ8.js} +1 -1
- package/dist/client/assets/{X-D5odjFOj.js → X-D7X7Z50V.js} +1 -1
- package/dist/client/assets/{XCircle-CkFuQ7IG.js → XCircle-PlbEvjyp.js} +1 -1
- package/dist/client/assets/{XClose-CQQFXdbB.js → XClose-BbuWQhNb.js} +1 -1
- package/dist/client/assets/{Zap-D2QyQXL2.js → Zap-BQKeuD4l.js} +1 -1
- package/dist/client/assets/{ZapSquare-DWfiiAgK.js → ZapSquare-CvkoTQDM.js} +1 -1
- package/dist/client/assets/{ZoomOut-CGeRz2Xe.js → ZoomOut-DxqRFWA_.js} +1 -1
- package/dist/client/assets/{access-gate-B1FO8IUq.js → access-gate-6AWas-Ss.js} +1 -1
- package/dist/client/assets/{add-section-modal-C4vE7N12.js → add-section-modal-jgpkoBcW.js} +1 -1
- package/dist/client/assets/{agent-icon-AqXPfJak.js → agent-icon-B2N3zGQH.js} +1 -1
- package/dist/client/assets/{agents-list-D_wYa6fb.js → agents-list-Cd9i8250.js} +1 -1
- package/dist/client/assets/{ai-providers-T-u5bvaJ.js → ai-providers-CG207wTX.js} +1 -1
- package/dist/client/assets/{alert-BbYDxfTx.js → alert-Cg3WXwSx.js} +1 -1
- package/dist/client/assets/{alert-dialog-C-zjIGep.js → alert-dialog-DvWgcmQI.js} +1 -1
- package/dist/client/assets/{app-editor-B1BV7cVP.js → app-editor-tLSi5KV_.js} +1 -1
- package/dist/client/assets/{auth-DhQO5_HB.js → auth-DZDiXt1m.js} +1 -1
- package/dist/client/assets/{auth-catchall-Di4BNeJO.js → auth-catchall-kuEh1_rd.js} +1 -1
- package/dist/client/assets/{auth-entry-_k3gk7s2.js → auth-entry-CavsOUDq.js} +1 -1
- package/dist/client/assets/{auth-split-layout-bCFbyvYe.js → auth-split-layout-dFpcxyJe.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-DBMlTO0L.js → authenticate-and-persist-oauth-CGYbK6H8.js} +1 -1
- package/dist/client/assets/{automation-list-row-Bs5UJwPA.js → automation-list-row-CAUoBpVq.js} +1 -1
- package/dist/client/assets/{automation-runs-BZimcr-h.js → automation-runs-DyKvgj21.js} +1 -1
- package/dist/client/assets/{automations-X1kqWMvM.js → automations-wXAz-GXj.js} +1 -1
- package/dist/client/assets/{avatar-BVLQzOkg.js → avatar-Dv3IrttI.js} +1 -1
- package/dist/client/assets/{badge-DySIiC0W.js → badge-toKsUzoB.js} +1 -1
- package/dist/client/assets/{block-document-DAnpzS1z.js → block-document-DRbnuwCo.js} +1 -1
- package/dist/client/assets/{brand-context-Dw4JnvNB.js → brand-context-BaVxi4M4.js} +1 -1
- package/dist/client/assets/{buckets-B3emByFY.js → buckets-BKwGKvkZ.js} +1 -1
- package/dist/client/assets/{capability-load-error-dMfRi5Lm.js → capability-load-error-BRyHg_Rt.js} +1 -1
- package/dist/client/assets/{card-Dcgr1F8G.js → card-Chq65iX4.js} +1 -1
- package/dist/client/assets/{category-editor-DxkVuATo.js → category-editor-LeiO5-YX.js} +1 -1
- package/dist/client/assets/{chat-context-Bw2XBdCM.js → chat-context-Bspy4m-d.js} +1 -1
- package/dist/client/assets/{checkbox-DtAK_uVJ.js → checkbox-KUrNOBQk.js} +1 -1
- package/dist/client/assets/{cli-auth-success-C1VkvMBP.js → cli-auth-success-B36KwAFt.js} +1 -1
- package/dist/client/assets/{collection-detail-CwmHQu2v.js → collection-detail-CbhoYXmP.js} +1 -1
- package/dist/client/assets/{collection-display-button-CwlHCCWA.js → collection-display-button-DNbt3d2y.js} +1 -1
- package/dist/client/assets/{collection-search-ChsfwSm5.js → collection-search-BPoBI_I5.js} +1 -1
- package/dist/client/assets/{collection-tabs-BKP4OHUr.js → collection-tabs-FH3-RtUV.js} +1 -1
- package/dist/client/assets/{command-BxulIERM.js → command-DMsCjDdA.js} +1 -1
- package/dist/client/assets/{commerce-onboarding-Dg7vjIhZ.js → commerce-onboarding-Cv30K_3D.js} +1 -1
- package/dist/client/assets/{connect-desktop-dialog-CRTSitBm.js → connect-desktop-dialog-G37q3fkg.js} +1 -1
- package/dist/client/assets/{connection-card-DHEsTOvl.js → connection-card-BG_Nwlzj.js} +1 -1
- package/dist/client/assets/{connection-detail-Dug72TML.js → connection-detail-oU0C71F8.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-DydZsosn.js → connection-form-helpers-DLOiycDJ.js} +1 -1
- package/dist/client/assets/{connections-D1302Qtf.js → connections-BgFAjnb1.js} +1 -1
- package/dist/client/assets/{context-menu-CIuP6HS5.js → context-menu-BRDnNrnF.js} +1 -1
- package/dist/client/assets/{decopilot-CTSJKb4z.js → decopilot-DfFzELja.js} +1 -1
- package/dist/client/assets/{decopilot-sse-pool-BiYcCf8O.js → decopilot-sse-pool-TIer_srZ.js} +1 -1
- package/dist/client/assets/{dialog-CbpDnZu8.js → dialog-CxQBoX40.js} +1 -1
- package/dist/client/assets/{domain-settings-CoN7-60k.js → domain-settings-gFWo85oP.js} +1 -1
- package/dist/client/assets/{drawer-UU4w29Dz.js → drawer-CoRZTii0.js} +1 -1
- package/dist/client/assets/{dropdown-menu-QpPxe1tm.js → dropdown-menu-5CWPgj7f.js} +1 -1
- package/dist/client/assets/{empty-state-Do7xKqQm.js → empty-state-B-ezQrZT.js} +1 -1
- package/dist/client/assets/{extract-connection-data-DVGeC9AU.js → extract-connection-data-BaXkJtVr.js} +1 -1
- package/dist/client/assets/{file-explorer-D2afeXPb.js → file-explorer-CwlDpz6e.js} +1 -1
- package/dist/client/assets/{file-type-icon-Cs_SK9tU.js → file-type-icon-Cd8oKt-R.js} +1 -1
- package/dist/client/assets/{files-5aenLfPW.js → files-CkNnfKPK.js} +1 -1
- package/dist/client/assets/{form-HH5S6Yti.js → form-CpFt_4sy.js} +1 -1
- package/dist/client/assets/{general-BnR0HO7J.js → general-9kWrBaDN.js} +1 -1
- package/dist/client/assets/{github-repo-picker-DvVBXFrQ.js → github-repo-picker-CvyWRbaM.js} +1 -1
- package/dist/client/assets/{hooks-fHAHvlgy.js → hooks-BAG9TZjZ.js} +1 -1
- package/dist/client/assets/{import-from-deco-dialog-gGGcEtn9.js → import-from-deco-dialog-ga5lUGZx.js} +1 -1
- package/dist/client/assets/{index--YoOFH0C.js → index-ALZP0-mx.js} +1 -1
- package/dist/client/assets/{index-BMiO2DRK.js → index-BAfXUZ9K.js} +1 -1
- package/dist/client/assets/{index-Dm5Wtwak.js → index-BLMNER8l.js} +1 -1
- package/dist/client/assets/{index-1K74hihp.js → index-BU8Nad-n.js} +1 -1
- package/dist/client/assets/{index-GSJQ2HSb.js → index-BeB2S664.js} +1 -1
- package/dist/client/assets/{index-BlCwbTgh.js → index-BwC0cAdP.js} +1 -1
- package/dist/client/assets/{index-Cnw7T0fh.js → index-C_Ih0jtP.js} +1 -1
- package/dist/client/assets/{index-DEuymgXg.js → index-CiVkOVzW.js} +26 -26
- package/dist/client/assets/{index-DUxlPTha.js → index-DPI_0XE-.js} +1 -1
- package/dist/client/assets/{index-CJHqjy38.js → index-DS2I5JM3.js} +1 -1
- package/dist/client/assets/{index-CutM526i.js → index-DUdLsOJu.js} +1 -1
- package/dist/client/assets/{index-uyO8STkD.js → index-DZCgQXLz.js} +1 -1
- package/dist/client/assets/{index-DVyj5fuq.js → index-I8Uum3Jx.js} +4 -4
- package/dist/client/assets/{index-Cr1XkGY8.js → index-JhgoGL0k.js} +1 -1
- package/dist/client/assets/{index-redirect-B3cwEJb7.js → index-redirect-CP9ATXDl.js} +1 -1
- package/dist/client/assets/{input-GyW6rRcJ.js → input-CutcETvq.js} +1 -1
- package/dist/client/assets/{integration-icon-BtlW6ioP.js → integration-icon-D3W1euXX.js} +1 -1
- package/dist/client/assets/{label-DZS4CYvt.js → label-DtGUWURu.js} +1 -1
- package/dist/client/assets/{login-8FZgzert.js → login-DUTSfri0.js} +1 -1
- package/dist/client/assets/{mcp-oauth-BKEDlyVy.js → mcp-oauth-CSZ5TVrK.js} +1 -1
- package/dist/client/assets/{members-BJYRHZsS.js → members-Dq59tJj1.js} +1 -1
- package/dist/client/assets/{monaco-editor-CGqqNDfH.js → monaco-editor-x5JEAvo5.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-D3Ly6cXH.js → monitoring-stats-row-BsPY2-bU.js} +1 -1
- package/dist/client/assets/{oauth-callback-Dwd806qn.js → oauth-callback-BXF1WEWL.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-CC85HfxS.js → oauth-callback-ai-provider-MpQ7zAqW.js} +1 -1
- package/dist/client/assets/{onboarding-D0JBHrcc.js → onboarding-CKZFzjtY.js} +1 -1
- package/dist/client/assets/{org-install-DQyhSRpe.js → org-install-DVysq6Hz.js} +1 -1
- package/dist/client/assets/{org-layout-Cr-WH3RD.js → org-layout-hE5dYTZz.js} +1 -1
- package/dist/client/assets/{organization-choice-CoeFbp4N.js → organization-choice-y8WYOYM0.js} +1 -1
- package/dist/client/assets/{page-seo-form-B7y574iK.js → page-seo-form-gPXTm6pw.js} +1 -1
- package/dist/client/assets/page-seo-sheet-CpMq28JR.js +1 -0
- package/dist/client/assets/{popover-DCt-yH34.js → popover-C8AJAJSa.js} +1 -1
- package/dist/client/assets/{post-editor-BZKlC439.js → post-editor-DrZmKifS.js} +1 -1
- package/dist/client/assets/{preview-dialog-CvZ5HrrM.js → preview-dialog-D1-LAakL.js} +1 -1
- package/dist/client/assets/{primitives-DU5cdK_v.js → primitives-D7qGIw1V.js} +1 -1
- package/dist/client/assets/{profile-VCalx_au.js → profile-DwtHhCaD.js} +1 -1
- package/dist/client/assets/project-app-view-H9YA_3uu.js +1 -0
- package/dist/client/assets/record-editor-C64a4aNL.js +1 -0
- package/dist/client/assets/registry-CxYUBbU6.js +2 -0
- package/dist/client/assets/{registry-layout-UOOnsAxo.js → registry-layout-CZALtE-Q.js} +1 -1
- package/dist/client/assets/{require-capability-B3soU3U-.js → require-capability-DAovjPYR.js} +1 -1
- package/dist/client/assets/{required-auth-layout-DJ9sUOZj.js → required-auth-layout-BFGUeccA.js} +1 -1
- package/dist/client/assets/{reset-password-Cbn69hRw.js → reset-password-CrnrgmIx.js} +1 -1
- package/dist/client/assets/{roles-BUk_bsvO.js → roles-DRg1cyfq.js} +1 -1
- package/dist/client/assets/{save-status-CV3d48oi.js → save-status-BmnvufMt.js} +1 -1
- package/dist/client/assets/{scroll-area-BOzFl7qs.js → scroll-area-DnauLcxE.js} +1 -1
- package/dist/client/assets/{search-input-Bkwrx7tI.js → search-input-BVF4N9EW.js} +1 -1
- package/dist/client/assets/{secrets-BaUhAjXu.js → secrets-DPqx_gXC.js} +1 -1
- package/dist/client/assets/{sections-editor-B1yHaLKY.js → sections-editor-BLU0buUC.js} +1 -1
- package/dist/client/assets/{select-C3uZV2A_.js → select-CeO9pIG_.js} +1 -1
- package/dist/client/assets/{select-model-Q-rnyaMQ.js → select-model-mprfSN1i.js} +1 -1
- package/dist/client/assets/{seo-editor-tIrWl6nj.js → seo-editor-Dyh0ncgL.js} +1 -1
- package/dist/client/assets/{settings-layout-DTBcjBLr.js → settings-layout-BcPbOkgS.js} +1 -1
- package/dist/client/assets/{settings-section-BLfkvtRw.js → settings-section-B3kXnqLg.js} +1 -1
- package/dist/client/assets/{sheet-n3UWOPEl.js → sheet-CaSXRGPU.js} +1 -1
- package/dist/client/assets/{shell-controls-DhJC4c0p.js → shell-controls-D2Qn9uVj.js} +1 -1
- package/dist/client/assets/{shell-layout-xNLL_s4g.js → shell-layout-BgovnITR.js} +1 -1
- package/dist/client/assets/{shell-route-loading-Cpya0EwH.js → shell-route-loading-w2qYEgt-.js} +1 -1
- package/dist/client/assets/{sidebar-B5rVQTnV.js → sidebar-BNKGZwsk.js} +1 -1
- package/dist/client/assets/{skeleton-D20LVfuJ.js → skeleton-1BUBAFib.js} +1 -1
- package/dist/client/assets/{sortable.esm-bhnYhglv.js → sortable.esm-BQBGtGRV.js} +1 -1
- package/dist/client/assets/{sso-1G-Lrcz1.js → sso-B5RA5Egt.js} +1 -1
- package/dist/client/assets/{store-B2Ao3pPp.js → store-Ni3ANns9.js} +1 -1
- package/dist/client/assets/store-registry-kIHn_jDR.js +2 -0
- package/dist/client/assets/{studio-tools-BvOjHliA.js → studio-tools-bjPFQfXc.js} +1 -1
- package/dist/client/assets/{switch-aFiGEpQz.js → switch-B9PlH85E.js} +1 -1
- package/dist/client/assets/{table-DerXyAj5.js → table-Bh38Wtyx.js} +1 -1
- package/dist/client/assets/{tabs-C2oZPeQe.js → tabs-C0RM8s7M.js} +1 -1
- package/dist/client/assets/{task-status-D2kMSoyM.js → task-status-sw3Y4pwg.js} +1 -1
- package/dist/client/assets/{textarea-C8t5NRp5.js → textarea-CvR7iHW3.js} +1 -1
- package/dist/client/assets/{toggle-group-DJ8r0lkn.js → toggle-group-qpErv2AC.js} +1 -1
- package/dist/client/assets/{toolbar-CH6VbS3Q.js → toolbar-CB27CeHy.js} +1 -1
- package/dist/client/assets/{tooltip-3uKRhKGc.js → tooltip-Cs84Kx7a.js} +1 -1
- package/dist/client/assets/{types-pwajyff_.js → types-pQkRXbdZ.js} +1 -1
- package/dist/client/assets/{use-ai-providers-CWY8hivp.js → use-ai-providers-BgadC07_.js} +1 -1
- package/dist/client/assets/{use-automations-D3-t22-_.js → use-automations-P1MHR3DS.js} +1 -1
- package/dist/client/assets/{use-capability-BjlflkMO.js → use-capability-BUm2GwYJ.js} +1 -1
- package/dist/client/assets/{use-clock-tick-CzIilxCh.js → use-clock-tick-DNfOIVGO.js} +1 -1
- package/dist/client/assets/{use-collections-DCQeHkgD.js → use-collections-KLUYE1x1.js} +1 -1
- package/dist/client/assets/{use-connection-CzcC522C.js → use-connection-BcZ8SPdu.js} +1 -1
- package/dist/client/assets/{use-copy-DwazvcnZ.js → use-copy-3_Rhxcs5.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-Bd6NX9e2.js → use-create-virtual-mcp-BUg1GOjA.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-7QeHZ0an.js → use-debounced-autosave-CSkDAooO.js} +1 -1
- package/dist/client/assets/{use-delete-connection-BuL4NUvH.js → use-delete-connection-CRtYZbhZ.js} +1 -1
- package/dist/client/assets/{use-file-configs-CElizRPA.js → use-file-configs-YBpYKsXP.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-BXMBgtt1.js → use-infinite-scroll-BJoUj4tJ.js} +1 -1
- package/dist/client/assets/{use-join-requests-BNKnZPHN.js → use-join-requests-7lEKJyAD.js} +1 -1
- package/dist/client/assets/{use-mcp-client-fdcDDNuq.js → use-mcp-client-Bq9g8m5J.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-D-HAq_yv.js → use-mcp-prompts-B5FIxmOZ.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-B6s0E39X.js → use-mcp-tools-LraQQ1bu.js} +1 -1
- package/dist/client/assets/{use-members-GGq7DYTP.js → use-members-D283HZiN.js} +1 -1
- package/dist/client/assets/{use-mobile-CvxOtGtu.js → use-mobile-C0mpADhR.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-DwfR9Suw.js → use-navigate-to-agent-CRQ9sIAj.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-DXTnBB9n.js → use-org-auth-client-WATciLg3.js} +1 -1
- package/dist/client/assets/{use-org-sso-B6LnDpoK.js → use-org-sso-HWNvOeDC.js} +1 -1
- package/dist/client/assets/{use-organization-roles-tYXE1Sad.js → use-organization-roles-Cyp5dthQ.js} +1 -1
- package/dist/client/assets/{use-organization-settings-BnxEz1nn.js → use-organization-settings-oh1iUWuA.js} +1 -1
- package/dist/client/assets/{use-registry-connections-B-i9Sftv.js → use-registry-connections-d6Abj3O4.js} +1 -1
- package/dist/client/assets/{use-secrets-DS1SrxPb.js → use-secrets-CkVHtz_G.js} +1 -1
- package/dist/client/assets/{use-status-sounds-9_fdEsNO.js → use-status-sounds-MBoAiBsc.js} +1 -1
- package/dist/client/assets/{use-view-mode-DFO97l4B.js → use-view-mode-Dhn_wt1k.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-ufrd8iJJ.js → use-virtual-mcp-C5aoCVVQ.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-RfoATJAI.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-DBiSYggu.js +1 -0
- package/dist/client/assets/{useSuspenseQueries-CKrSo39Z.js → useSuspenseQueries-C6KWJru5.js} +1 -1
- package/dist/client/assets/{variant-calendar-DotXoiJr.js → variant-calendar-krPIZ_Rp.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-C9lZfxMp.js → view-mode-toggle-DTMt6lCZ.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +361 -361
- package/dist/server/server.js +255 -255
- package/package.json +1 -1
- package/dist/client/assets/page-seo-sheet-C7aYjteJ.js +0 -1
- package/dist/client/assets/project-app-view-DY9V3RKN.js +0 -1
- package/dist/client/assets/record-editor-Iup_3GZW.js +0 -1
- package/dist/client/assets/registry-C1pjl2mg.js +0 -2
- package/dist/client/assets/store-registry-CnLvGy-0.js +0 -2
- package/dist/client/assets/useInfiniteQuery-D6zHLjhR.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-BEAkaT6v.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as D,r as M,o as bc,n as ch,p as uh,j as p,B as lr,s as Il,bM as kc,bN as dh,aQ as fh,ah as rn,bO as hh,l as Z,w as ph,V as $t,W as Ot,Z as kr,a3 as mh,ak as gh,_ as hn,bP as Sc,Y as vc,D as zt,m as yh,d as xh,K as Kt,t as zi,k as Co,b as Ln,E as bh,ae as wc,bQ as To,aj as kh,bR as Ut}from"./index-DVyj5fuq.js";import{f as Sh,M as vh,e as wh,am as Ch,a2 as Th,a1 as Nh,a0 as Mh,aj as Cc,an as Eh,ao as Ah,A as Tc,ap as it,aq as Oh,ar as Ih,as as Rh,j as jh}from"./agent-icon-AqXPfJak.js";import{t as Fs}from"./Stars01-BvvUaY8d.js";import{i as Nc,t as Dh,d as Mc,b as Er}from"./XCircle-CkFuQ7IG.js";import{i as No}from"./ChevronUp-CUesWqmK.js";import{i as Rl}from"./ChevronRight-BXEszS6k.js";import{a as Ec,s as Ph}from"./Eye-FmUDnTHn.js";import{a as Pt,t as Mo,u as Ac,c as jl}from"./use-clock-tick-CzIilxCh.js";import{u as Oc}from"./use-copy-DwazvcnZ.js";import{a as sn,b as on,T as ln}from"./tooltip-3uKRhKGc.js";import{M as Eo,I as Ic,F as Lh}from"./file-type-icon-Cs_SK9tU.js";import{c as _h}from"./content-blocks-o63cs2vh.js";import{g as Rc,M as $h}from"./types-pwajyff_.js";import{S as zh,f as _n,h as Bh,c as Ao,a as Fh,u as Hh}from"./chat-context-Bw2XBdCM.js";import{c as Vh,r as Wh,R as Uh}from"./hooks-fHAHvlgy.js";import{u as qh}from"./studio-tools-BvOjHliA.js";import{f as Kh,k as Jh,l as Gh}from"./tab-id-BptcWVWa.js";import{e as Yh,u as jc,l as Xh}from"./use-mcp-client-fdcDDNuq.js";import{i as Dc}from"./AlertCircle-kcMUHNYP.js";import{s as Jr,t as Pc}from"./Star01-BUumId75.js";import{s as Qh}from"./XClose-CQQFXdbB.js";import{n as Bi}from"./ZapSquare-DWfiiAgK.js";import{n as Lc,i as Zh}from"./Globe01-Ckwe4UHh.js";import{c as ep,b as tp,a as Ar}from"./Tool01-DKUGTxge.js";import{c as Dl,b as np}from"./ZoomOut-CGeRz2Xe.js";import{i as Gn}from"./Monitor01-DNvJhnf-.js";import{i as rp}from"./SearchMd-57vTBUjU.js";import{i as sp}from"./Upload01-CvwE1uG-.js";import{b as ip,c as op}from"./shell-layout-xNLL_s4g.js";import{n as _c}from"./LinkExternal01-BoVxtqR2.js";import{b as lp,S as ap,c as cp,d as up}from"./sheet-n3UWOPEl.js";import{I as Sr}from"./integration-icon-BtlW6ioP.js";import{a as dp}from"./use-virtual-mcp-ufrd8iJJ.js";import{i as fp}from"./ArrowUpRight-KPaHD_ZU.js";import{a as Oo}from"./Users03-Cnldjgk9.js";import{a as ot}from"./Palette-Bf6p_3g1.js";import{m as $c}from"./use-navigate-to-agent-DwfR9Suw.js";import{a as hp}from"./use-connection-CzcC522C.js";import{a as pp}from"./Stars02-f3tbtjbB.js";import{g as mp}from"./use-mcp-prompts-D-HAq_yv.js";import{d as gp,c as yp,D as xp,b as bp,a as kp}from"./dialog-CbpDnZu8.js";import{a as Sp,F as vp,b as wp,c as Cp,d as Tp,e as Np}from"./form-HH5S6Yti.js";import{I as Mp}from"./input-GyW6rRcJ.js";import{t as Ep}from"./ChevronDown-DJ5SHmhN.js";import{e as Ap}from"./select-C3uZV2A_.js";const Op={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(Op)){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 yw(n){return n.reduce((e,t)=>Fc(e,t.metadata?.usage),Bc())}function Ip(n){return n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function Io(n){if(n&&typeof n=="object"&&"gatewayClientId"in n&&typeof n.gatewayClientId=="string")return n.gatewayClientId}function Ro(n,e){if(!e)return n;const t=`${Ip(e)}_`;return n.startsWith(t)?n.slice(t.length):n}function Rp(n,e){return Ro(n,e).replace(/[_-]/g," ").toLowerCase()}function jp(n){const e={};for(const t of n.arguments??[])e[t.name]=t.required?Il().min(1,"Required"):Il();return bc(e)}function Dp(n,e){const t={};for(const r of n.arguments??[])t[r.name]=e?.[r.name]??"";return t}function Pp(n){const e=D.c(66),{prompt:t,setPrompt:r,onSubmit:s,defaultValues:i}=n,o=M.useId();let l;if(e[0]!==t){const $=t?jp(t):bc({});l=ch($),e[0]=t,e[1]=l}else l=e[1];const c=l;let u;e[2]!==i||e[3]!==t?(u=t?Dp(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=uh(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||Rp(t.name,Io(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(gp,{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(yp,{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?($=F=>p.jsx(vp,{control:f.control,name:F.name,render:J=>{const{field:X}=J;return p.jsxs(wp,{children:[p.jsxs(Cp,{className:"text-xs",children:[F.name,F.required?null:p.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),p.jsx(Tp,{children:p.jsx(Mp,{...X,value:X.value??"",required:F.required,placeholder:F.description??"",className:"h-9",disabled:f.formState.isSubmitting})}),p.jsx(Np,{})]})}},F.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(zh,{size:"xs"}),"Loading..."]}):"Use prompt",e[43]=f.formState.isSubmitting,e[44]=j):j=e[44];let P;e[45]!==f.formState.isSubmitting||e[46]!==o||e[47]!==j?(P=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]=P):P=e[48];let R;e[49]!==E||e[50]!==P?(R=p.jsxs(xp,{children:[E,P]}),e[49]=E,e[50]=P,e[51]=R):R=e[51];let L;e[52]!==o||e[53]!==w||e[54]!==T||e[55]!==R?(L=p.jsxs("form",{id:o,className:"space-y-4 py-4",autoComplete:"off",onSubmit:w,children:[T,R]}),e[52]=o,e[53]=w,e[54]=T,e[55]=R,e[56]=L):L=e[56];let I;e[57]!==f||e[58]!==L?(I=p.jsx(Sp,{...f,children:L}),e[57]=f,e[58]=L,e[59]=I):I=e[59];let z;e[60]!==C||e[61]!==I?(z=p.jsxs(bp,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[C,I]}),e[60]=C,e[61]=I,e[62]=z):z=e[62];let B;return e[63]!==b||e[64]!==z?(B=p.jsx(kp,{open:!0,onOpenChange:b,children:z}),e[63]=b,e[64]=z,e[65]=B):B=e[65],B}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 Yr 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 Lp(n,e,t){if(t.openStart>n.depth)throw new Yr("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Yr("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}=_p(t,n);return Zt(i,Gc(n,o,l,e,r))}else return Zt(i,Xr(n,e,r))}function Jc(n,e){if(!e.type.compatibleContent(n.type))throw new Yr("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 Yn(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 Yn(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,Xr(n,e,s+1)),l),Yn(e,t,s,l),o&&Qt(Zt(o,Xr(t,r,s+1)),l)),Yn(r,null,s,l),new A(l)}function Xr(n,e,t){let r=[];if(Yn(null,n,t,r),n.depth>t){let s=Hi(n,e,t+1);Qt(Zt(s,Xr(n,e,t+1)),r)}return Yn(e,null,t,r),new A(r)}function _p(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=Pl.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 Pl.set(e,r=new $p);let s=r.elts[r.i]=ar.resolve(e,t);return r.i=(r.i+1)%zp,s}}class $p{constructor(){this.elts=[],this.i=0}}const zp=12,Pl=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 Bp=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||Bp)&&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 Lp(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()+")"),Yc(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):Yc(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 Yc(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 Fp(e,t);if(r.next==null)return an.empty;let s=Xc(r);r.next&&r.err("Unexpected trailing text");let i=Jp(Kp(s));return Gp(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{c as D,r as M,o as bc,n as ch,p as uh,j as p,B as lr,s as Il,bM as kc,bN as dh,aQ as fh,ah as rn,bO as hh,l as Z,w as ph,V as $t,W as Ot,Z as kr,a3 as mh,ak as gh,_ as hn,bP as Sc,Y as vc,D as zt,m as yh,d as xh,K as Kt,t as zi,k as Co,b as Ln,E as bh,ae as wc,bQ as To,aj as kh,bR as Ut}from"./index-I8Uum3Jx.js";import{f as Sh,M as vh,e as wh,am as Ch,a2 as Th,a1 as Nh,a0 as Mh,aj as Cc,an as Eh,ao as Ah,A as Tc,ap as it,aq as Oh,ar as Ih,as as Rh,j as jh}from"./agent-icon-B2N3zGQH.js";import{t as Fs}from"./Stars01-D1icdaCh.js";import{i as Nc,t as Dh,d as Mc,b as Er}from"./XCircle-PlbEvjyp.js";import{i as No}from"./ChevronUp-HJUE3-BD.js";import{i as Rl}from"./ChevronRight-oz8o6WPV.js";import{a as Ec,s as Ph}from"./Eye-BSiFxHQB.js";import{a as Pt,t as Mo,u as Ac,c as jl}from"./use-clock-tick-DNfOIVGO.js";import{u as Oc}from"./use-copy-3_Rhxcs5.js";import{a as sn,b as on,T as ln}from"./tooltip-Cs84Kx7a.js";import{M as Eo,I as Ic,F as Lh}from"./file-type-icon-Cd8oKt-R.js";import{c as _h}from"./content-blocks-o63cs2vh.js";import{g as Rc,M as $h}from"./types-pQkRXbdZ.js";import{S as zh,f as _n,h as Bh,c as Ao,a as Fh,u as Hh}from"./chat-context-Bspy4m-d.js";import{c as Vh,r as Wh,R as Uh}from"./hooks-BAG9TZjZ.js";import{u as qh}from"./studio-tools-bjPFQfXc.js";import{f as Kh,k as Jh,l as Gh}from"./tab-id-BptcWVWa.js";import{e as Yh,u as jc,l as Xh}from"./use-mcp-client-Bq9g8m5J.js";import{i as Dc}from"./AlertCircle-VcwplCRi.js";import{s as Jr,t as Pc}from"./Star01-BwAv907s.js";import{s as Qh}from"./XClose-BbuWQhNb.js";import{n as Bi}from"./ZapSquare-CvkoTQDM.js";import{n as Lc,i as Zh}from"./Globe01-wGomueqV.js";import{c as ep,b as tp,a as Ar}from"./Tool01-DvTGD1Yt.js";import{c as Dl,b as np}from"./ZoomOut-DxqRFWA_.js";import{i as Gn}from"./Monitor01-SEZLDRFN.js";import{i as rp}from"./SearchMd-BMfw7gZ4.js";import{i as sp}from"./Upload01-C_hHbDSF.js";import{b as ip,c as op}from"./shell-layout-BgovnITR.js";import{n as _c}from"./LinkExternal01-BWnRnxGs.js";import{b as lp,S as ap,c as cp,d as up}from"./sheet-CaSXRGPU.js";import{I as Sr}from"./integration-icon-D3W1euXX.js";import{a as dp}from"./use-virtual-mcp-C5aoCVVQ.js";import{i as fp}from"./ArrowUpRight-CAv7CUnJ.js";import{a as Oo}from"./Users03-CL71IAQ8.js";import{a as ot}from"./Palette-CEjENuG4.js";import{m as $c}from"./use-navigate-to-agent-CRQ9sIAj.js";import{a as hp}from"./use-connection-BcZ8SPdu.js";import{a as pp}from"./Stars02-PPXsboxW.js";import{g as mp}from"./use-mcp-prompts-B5FIxmOZ.js";import{d as gp,c as yp,D as xp,b as bp,a as kp}from"./dialog-CxQBoX40.js";import{a as Sp,F as vp,b as wp,c as Cp,d as Tp,e as Np}from"./form-CpFt_4sy.js";import{I as Mp}from"./input-CutcETvq.js";import{t as Ep}from"./ChevronDown-URo4LveF.js";import{e as Ap}from"./select-CeO9pIG_.js";const Op={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(Op)){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 yw(n){return n.reduce((e,t)=>Fc(e,t.metadata?.usage),Bc())}function Ip(n){return n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function Io(n){if(n&&typeof n=="object"&&"gatewayClientId"in n&&typeof n.gatewayClientId=="string")return n.gatewayClientId}function Ro(n,e){if(!e)return n;const t=`${Ip(e)}_`;return n.startsWith(t)?n.slice(t.length):n}function Rp(n,e){return Ro(n,e).replace(/[_-]/g," ").toLowerCase()}function jp(n){const e={};for(const t of n.arguments??[])e[t.name]=t.required?Il().min(1,"Required"):Il();return bc(e)}function Dp(n,e){const t={};for(const r of n.arguments??[])t[r.name]=e?.[r.name]??"";return t}function Pp(n){const e=D.c(66),{prompt:t,setPrompt:r,onSubmit:s,defaultValues:i}=n,o=M.useId();let l;if(e[0]!==t){const $=t?jp(t):bc({});l=ch($),e[0]=t,e[1]=l}else l=e[1];const c=l;let u;e[2]!==i||e[3]!==t?(u=t?Dp(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=uh(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||Rp(t.name,Io(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(gp,{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(yp,{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?($=F=>p.jsx(vp,{control:f.control,name:F.name,render:J=>{const{field:X}=J;return p.jsxs(wp,{children:[p.jsxs(Cp,{className:"text-xs",children:[F.name,F.required?null:p.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),p.jsx(Tp,{children:p.jsx(Mp,{...X,value:X.value??"",required:F.required,placeholder:F.description??"",className:"h-9",disabled:f.formState.isSubmitting})}),p.jsx(Np,{})]})}},F.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(zh,{size:"xs"}),"Loading..."]}):"Use prompt",e[43]=f.formState.isSubmitting,e[44]=j):j=e[44];let P;e[45]!==f.formState.isSubmitting||e[46]!==o||e[47]!==j?(P=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]=P):P=e[48];let R;e[49]!==E||e[50]!==P?(R=p.jsxs(xp,{children:[E,P]}),e[49]=E,e[50]=P,e[51]=R):R=e[51];let L;e[52]!==o||e[53]!==w||e[54]!==T||e[55]!==R?(L=p.jsxs("form",{id:o,className:"space-y-4 py-4",autoComplete:"off",onSubmit:w,children:[T,R]}),e[52]=o,e[53]=w,e[54]=T,e[55]=R,e[56]=L):L=e[56];let I;e[57]!==f||e[58]!==L?(I=p.jsx(Sp,{...f,children:L}),e[57]=f,e[58]=L,e[59]=I):I=e[59];let z;e[60]!==C||e[61]!==I?(z=p.jsxs(bp,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[C,I]}),e[60]=C,e[61]=I,e[62]=z):z=e[62];let B;return e[63]!==b||e[64]!==z?(B=p.jsx(kp,{open:!0,onOpenChange:b,children:z}),e[63]=b,e[64]=z,e[65]=B):B=e[65],B}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 Yr 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 Lp(n,e,t){if(t.openStart>n.depth)throw new Yr("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Yr("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}=_p(t,n);return Zt(i,Gc(n,o,l,e,r))}else return Zt(i,Xr(n,e,r))}function Jc(n,e){if(!e.type.compatibleContent(n.type))throw new Yr("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 Yn(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 Yn(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,Xr(n,e,s+1)),l),Yn(e,t,s,l),o&&Qt(Zt(o,Xr(t,r,s+1)),l)),Yn(r,null,s,l),new A(l)}function Xr(n,e,t){let r=[];if(Yn(null,n,t,r),n.depth>t){let s=Hi(n,e,t+1);Qt(Zt(s,Xr(n,e,t+1)),r)}return Yn(e,null,t,r),new A(r)}function _p(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=Pl.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 Pl.set(e,r=new $p);let s=r.elts[r.i]=ar.resolve(e,t);return r.i=(r.i+1)%zp,s}}class $p{constructor(){this.elts=[],this.i=0}}const zp=12,Pl=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 Bp=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||Bp)&&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 Lp(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()+")"),Yc(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):Yc(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 Yc(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 Fp(e,t);if(r.next==null)return an.empty;let s=Xc(r);r.next&&r.err("Unexpected trailing text");let i=Jp(Kp(s));return Gp(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 Fp{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 Xc(n){let e=[];do e.push(Hp(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Hp(n){let e=[];do e.push(Vp(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Vp(n){let e=qp(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=Wp(n,e);else break;return e}function Ll(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Wp(n,e){let t=Ll(n),r=t;return n.eat(",")&&(n.next!="}"?r=Ll(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Up(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 qp(n){if(n.eat("(")){let e=Xc(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=Up(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 Kp(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 _l(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 Jp(n){let e=Object.create(null);return t(_l(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]);_l(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 Gp(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 Yp(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"?Yp(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?zl(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==""?[]:zl(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 zl(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 Qp(n){return n.tag!=null}function Zp(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(Qp(s))this.tags.push(s);else if(Zp(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 Fl(this,t,!1);return r.addAll(e,ne.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Fl(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(nm(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=Hl(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=Hl(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},em={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ou={ol:!0,ul:!0},cr=1,Vi=2,Xn=4;function Bl(n,e,t){return e!=null?(e?cr:0)|(e==="full"?Vi:0):n&&n.whitespace=="pre"?cr|Vi:t&~Xn}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&Xn?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 Fl{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=Bl(null,t.preserveWhitespace,0)|(r?Xn: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&&tm(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:em.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):Vl(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=Bl(e,i,o.options);o.options&Xn&&o.content.length==0&&(l|=Xn);let a=ne.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):Vl(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 tm(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 nm(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Hl(n){let e={};for(let t in n)e[t]=n[t];return e}function Vl(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=Wl(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Wl(e.marks)}}function Wl(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 Ul=new WeakMap;function rm(n){let e=Ul.get(n);return e===void 0&&Ul.set(n,e=sm(n)),e}function sm(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=rm(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 im(n,e){return n+e*au}function ql(n){return n&lu}function om(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=ql(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+om(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:im(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=ql(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 Yr)return me.fail(i.message);throw i}}}function jo(n,e,t){let r=[];for(let s=0;s<n.childCount;s++){let i=n.child(s);i.content.size&&(i=i.copy(jo(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 _(jo(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 _(jo(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 lm(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 am(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 Do(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 cm(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||!cm(o,l,a))break;l&&(s=1),a<o.childCount&&(i=1)}return null}function um(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 Po(n,e,t=null,r=n){let s=dm(n,e),i=s&&fm(r,e);return i?s.map(Kl).concat({type:e,attrs:t}).concat(i.map(Kl)):null}function Kl(n){return{type:n,attrs:null}}function dm(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 fm(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 hm(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 pm(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)&&mm(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),Do(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{c as b,l as w,j as a,i as j}from"./index-
|
|
1
|
+
import{c as b,l as w,j as a,i as j}from"./index-I8Uum3Jx.js";import{i as N}from"./SearchMd-BMfw7gZ4.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{c as p,j as t,E as P,r as j,ag as w,B as S,t as y}from"./index-
|
|
1
|
+
import{c as p,j as t,E as P,r as j,ag as w,B as S,t as y}from"./index-I8Uum3Jx.js";import{i as k}from"./AlertCircle-VcwplCRi.js";import{s as z}from"./Plus-Bw9lc6SR.js";import{s as E}from"./User01-BDtU1dk1.js";import{t as F}from"./Users01-PX3eYoC8.js";import{a as $,b as I,c as O,d as A,e as R,D as T}from"./dialog-CxQBoX40.js";import{I as N}from"./input-CutcETvq.js";import{L as g}from"./label-DtGUWURu.js";import{d as B,b as V,c as L,S as q,a as C}from"./select-CeO9pIG_.js";import{S as H}from"./skeleton-1BUBAFib.js";import{T as K}from"./textarea-CvR7iHW3.js";import{P as b}from"./index-BU8Nad-n.js";import{c as W}from"./settings-section-B3kXnqLg.js";import{u as Y,a as G}from"./use-secrets-CkVHtz_G.js";import{R as J}from"./require-capability-DAovjPYR.js";import"./X-D7X7Z50V.js";import"./tooltip-Cs84Kx7a.js";import"./ChevronUp-HJUE3-BD.js";import"./ChevronDown-URo4LveF.js";import"./sidebar-BNKGZwsk.js";import"./LayoutLeft-BFxGsVdk.js";import"./use-mobile-C0mpADhR.js";import"./sheet-CaSXRGPU.js";import"./card-Chq65iX4.js";import"./ArrowUpRight-CAv7CUnJ.js";import"./studio-tools-bjPFQfXc.js";import"./use-capability-BUm2GwYJ.js";import"./access-gate-6AWas-Ss.js";import"./capability-load-error-BRyHg_Rt.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"?E:F,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 Ie(){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{Ie as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as Ie,r as w,l as Re,j as n,B as Ue,i as Dn,m as Qs,t as pe,K as Xs}from"./index-DVyj5fuq.js";import{r as Zs,a as Gs,s as ea,i as Tn,c as ta,b as na,G as sa,V as aa,d as ra,e as jt,f as oa,g as ia,h as la,j as ca,k as ua,l as da,m as ma,n as fa,o as pa,p as xt,q as bt,t as ha,v as tt,w as Bt,x as ga,y as Xe,z as gn,S as va,M as vn,A as nt,B as Sn,C as Sa,D as xn,P as xa,E as Ft,F as ba,H as ya,I as ja,J as _a,K as ka,L as wa,N as Na,O as dt,Q as Ra,R as Ca,T as Da,U as Ta,W as Pa,X as Va,Y as Aa,Z as Ma,_ as bn,$ as zt,a0 as Ea,a1 as $a,a2 as It,a3 as Ka,a4 as yn,a5 as Oa,a6 as La,a7 as Ba,a8 as Ht,a9 as Fa,aa as za,ab as Pn,ac as jn,ad as Ia}from"./index-DEuymgXg.js";import{t as Ha}from"./ChevronDown-DJ5SHmhN.js";import{n as Ua}from"./ChevronLeft-QZNH5ck-.js";import{i as Vn}from"./ChevronRight-BXEszS6k.js";import{n as Wa}from"./ChevronUp-CUesWqmK.js";import{K as Wt,D as An,W as Mn,l as qa,L as Ya,M as Ja}from"./agent-icon-AqXPfJak.js";import{i as Qa}from"./Globe01-Ckwe4UHh.js";import{S as yt}from"./scroll-area-BOzFl7qs.js";import{T as st,a as at,b as rt}from"./tooltip-3uKRhKGc.js";import{d as Xa,c as Za,e as Ga,D as er,b as tr,a as nr}from"./dialog-CbpDnZu8.js";import{I as sr}from"./input-GyW6rRcJ.js";import{s as ar,a as En}from"./Eye-FmUDnTHn.js";import{d as rr}from"./ZoomOut-CGeRz2Xe.js";import{i as or}from"./Settings02-k7X7M16V.js";import{s as qt}from"./Plus-8zBKSNee.js";import{s as $n}from"./Trash01-DDwxWuR_.js";import{i as ir}from"./Zap-D2QyQXL2.js";import{c as Ze,a as Kn,D as On,b as Ln,g as lr}from"./dropdown-menu-QpPxe1tm.js";import{b as Bn,c as _t,K as Fn,P as zn,e as In,C as Hn,s as Un,l as mt,D as Wn,d as qn,S as Yn,v as cr,k as Jn,p as ur}from"./sortable.esm-bhnYhglv.js";import{r as _n,u as dr,d as mr,a as fr,i as pr,f as hr,P as gr,b as vr,S as Sr}from"./page-seo-form-B7y574iK.js";import{b as xr}from"./Tool01-DKUGTxge.js";import{A as br}from"./add-section-modal-C4vE7N12.js";import"./index-Cnw7T0fh.js";import"./chat-context-Bw2XBdCM.js";import"./hooks-fHAHvlgy.js";import"./use-mcp-client-fdcDDNuq.js";import"./auth-DhQO5_HB.js";import"./decopilot-sse-pool-BiYcCf8O.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-virtual-mcp-ufrd8iJJ.js";import"./use-collections-DCQeHkgD.js";import"./use-ai-providers-CWY8hivp.js";import"./studio-tools-BvOjHliA.js";import"./tab-id-BptcWVWa.js";import"./use-organization-settings-BnxEz1nn.js";import"./drawer-UU4w29Dz.js";import"./collection-search-ChsfwSm5.js";import"./SearchMd-57vTBUjU.js";import"./use-mobile-CvxOtGtu.js";import"./use-mcp-prompts-D-HAq_yv.js";import"./X-D5odjFOj.js";import"./shell-layout-xNLL_s4g.js";import"./avatar-BVLQzOkg.js";import"./User01-KLLrp_Cb.js";import"./Users03-Cnldjgk9.js";import"./Stars02-f3tbtjbB.js";import"./XClose-CQQFXdbB.js";import"./CheckCircle-Do934x7B.js";import"./FilterLines-eS3dI9hB.js";import"./required-auth-layout-DJ9sUOZj.js";import"./use-org-sso-B6LnDpoK.js";import"./SwitchHorizontal01-BeteqXsq.js";import"./ZapSquare-DWfiiAgK.js";import"./Star01-BUumId75.js";import"./Upload01-CvwE1uG-.js";import"./AlertCircle-kcMUHNYP.js";import"./form-HH5S6Yti.js";import"./label-DZS4CYvt.js";import"./select-C3uZV2A_.js";import"./XCircle-CkFuQ7IG.js";import"./tabs-C2oZPeQe.js";import"./toggle-group-DJ8r0lkn.js";import"./Monitor01-DNvJhnf-.js";import"./connect-desktop-dialog-CRTSitBm.js";import"./decopilot-CTSJKb4z.js";import"./checkbox-DtAK_uVJ.js";import"./skeleton-D20LVfuJ.js";import"./Key01-wlyPB5nN.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-BLfkvtRw.js";import"./card-Dcgr1F8G.js";import"./ArrowUpRight-KPaHD_ZU.js";import"./Stars01-BvvUaY8d.js";import"./popover-DCt-yH34.js";import"./command-BxulIERM.js";import"./index-Dm5Wtwak.js";import"./useInfiniteQuery-D6zHLjhR.js";import"./use-infinite-scroll-BXMBgtt1.js";import"./question-004-sINsf4GQ.js";import"./integration-icon-BtlW6ioP.js";import"./use-status-sounds-9_fdEsNO.js";import"./empty-state-Do7xKqQm.js";import"./toolbar-CH6VbS3Q.js";import"./preview-dialog-CvZ5HrrM.js";import"./LinkExternal01-BoVxtqR2.js";import"./index-DUxlPTha.js";import"./file-type-icon-Cs_SK9tU.js";import"./LayoutLeft-C_wbh4sE.js";import"./use-connection-CzcC522C.js";import"./use-mcp-tools-B6s0E39X.js";import"./types-pwajyff_.js";import"./use-capability-BjlflkMO.js";import"./textarea-C8t5NRp5.js";import"./shell-route-loading-Cpya0EwH.js";import"./extract-connection-data-DVGeC9AU.js";import"./index-Cr1XkGY8.js";import"./mcp-oauth-BKEDlyVy.js";import"./badge-DySIiC0W.js";import"./connection-slug-eyAPH6o3.js";import"./alert-dialog-C-zjIGep.js";import"./switch-aFiGEpQz.js";import"./Play-D6BtU9Uh.js";import"./use-debounced-autosave-7QeHZ0an.js";import"./index-1K74hihp.js";import"./sidebar-B5rVQTnV.js";import"./sheet-n3UWOPEl.js";import"./search-input-Bkwrx7tI.js";import"./collection-tabs-BKP4OHUr.js";import"./github-repo-picker-DvVBXFrQ.js";import"./authenticate-and-persist-oauth-DBMlTO0L.js";import"./use-navigate-to-agent-DwfR9Suw.js";import"./Users01-BoxxsDP9.js";import"./use-secrets-DS1SrxPb.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./view-mode-toggle-C9lZfxMp.js";import"./DotsVertical-F-o-_a2z.js";import"./automation-runs-BZimcr-h.js";import"./table-DerXyAj5.js";import"./use-members-GGq7DYTP.js";import"./use-org-auth-client-DXTnBB9n.js";import"./task-status-D2kMSoyM.js";import"./use-automations-D3-t22-_.js";import"./useSuspenseInfiniteQuery-BEAkaT6v.js";import"./use-file-configs-CElizRPA.js";import"./monaco-editor-CGqqNDfH.js";import"./select-model-Q-rnyaMQ.js";import"./automation-list-row-Bs5UJwPA.js";import"./Globe04-iXhOnFjr.js";import"./HardDrive-CNIST2bR.js";import"./Sun-42Xfv_Dc.js";import"./Palette-Bf6p_3g1.js";import"./Shield01-6X9Jy9--.js";import"./use-clock-tick-CzIilxCh.js";import"./use-copy-DwazvcnZ.js";import"./content-blocks-o63cs2vh.js";import"./connection-card-DHEsTOvl.js";import"./use-registry-connections-B-i9Sftv.js";import"./connection-form-helpers-DydZsosn.js";function yr(m){return m.schema?.definitions??m.schema?.$defs??{}}function jr(m,e){const r=yr(e),c=r[btoa(m)];if(!c)return;let d=typeof c.image=="string"?c.image:void 0;if(!d&&Array.isArray(c.allOf)){const h=c.allOf.find(v=>typeof v.$ref=="string")?.$ref;if(typeof h=="string"){const v=h.replace("#/definitions/",""),f=r[v];d=typeof f?.image=="string"?f.image:void 0}}if(d?.includes("{{{"))return d}function _r(m,e){if(!e)return;const r=Zs(m);if(!r)return;const c=jr(r.resolveType,e);if(!c)return;const d=Gs(c,r.data);if(d)return ea(d)}const kr="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",wr="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 kn(m){return Array.from({length:m},(e,r)=>({id:crypto.randomUUID(),index:r}))}function Qn(m){return m.map((e,r)=>({...e,index:r}))}function Nr(m,e){if(e===m.length)return m;if(e<m.length)return Qn(m.slice(0,e));const r=Array.from({length:e-m.length},(c,d)=>({id:crypto.randomUUID(),index:m.length+d}));return[...m,...r]}function Xn(m){const e=Ie.c(20),{section:r,raw:c,meta:d}=m,h=r.isSavedBlock===!0,v=r.isMultivariate===!0;let f;e[0]!==d||e[1]!==c?(f=c&&d?_r(c,d):void 0,e[0]=d,e[1]=c,e[2]=f):f=e[2];const g=f;let S;e[3]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(rr,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[3]=S):S=e[3];let x;e[4]!==g?(x=g&&n.jsx("img",{src:g,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[4]=g,e[5]=x):x=e[5];let D;e[6]!==v||e[7]!==h?(D=h?{color:sa}:v?{color:"oklch(0.65 0.15 160)"}:void 0,e[6]=v,e[7]=h,e[8]=D):D=e[8];let N;e[9]!==D?(N=n.jsx(Wt,{className:"h-4 w-4 shrink-0",style:D}),e[9]=D,e[10]=N):N=e[10];const j=r.isHidden&&"line-through opacity-50";let C;e[11]!==j?(C=Re("min-w-0 flex-1 truncate text-sm font-medium",j),e[11]=j,e[12]=C):C=e[12];let o;e[13]!==r.label||e[14]!==C?(o=n.jsx("span",{className:C,children:r.label}),e[13]=r.label,e[14]=C,e[15]=o):o=e[15];let k;return e[16]!==x||e[17]!==N||e[18]!==o?(k=n.jsxs(n.Fragment,{children:[S,x,N,o]}),e[16]=x,e[17]=N,e[18]=o,e[19]=k):k=e[19],k}function Zn(m,e){const r=m.isSavedBlock===!0,c=m.isMultivariate===!0;return Re("group flex select-none items-center gap-2 rounded-md px-2 py-2.5",e?"bg-accent text-accent-foreground":r?kr: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 Rr(m){const e=Ie.c(64),{section:r,raw:c,meta:d,sortableId:h,selected:v,onSelect:f,onDelete:g,onDuplicate:S,onMakeReusable:x,onToggleHidden:D,onToggleLazy:N,onAddVariant:j,onDetach:C}=m,o=c?Tn(c.__resolveType??""):!1;let k;e[0]!==r?(k=ta(r),e[0]=r,e[1]=k):k=e[1];const u=k;let Q;e[2]!==h?(Q={id:h,animateLayoutChanges:Vr},e[2]=h,e[3]=Q):Q=e[3];const{attributes:W,listeners:O,setNodeRef:l,transform:T,isDragging:ae}=In(Q);let P;e[4]!==T?(P=Hn.Transform.toString(T?{...T,x:0}:null),e[4]=T,e[5]=P):P=e[5];const de=ae?0:void 0;let A;e[6]!==P||e[7]!==de?(A={transform:P,opacity:de},e[6]=P,e[7]=de,e[8]=A):A=e[8];const le=A;let M;e[9]!==r?(M=na(r),e[9]=r,e[10]=M):M=e[10];const se=M,oe="button",Se=0;let I;e[11]!==f?(I=E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),f())},e[11]=f,e[12]=I):I=e[12];const te=ae?"cursor-grabbing":"cursor-pointer";let q;e[13]!==r||e[14]!==v||e[15]!==te?(q=Re("touch-none transition-colors",te,Zn(r,v)),e[13]=r,e[14]=v,e[15]=te,e[16]=q):q=e[16];let ie;e[17]!==d||e[18]!==c||e[19]!==r?(ie=n.jsx(Xn,{section:r,raw:c,meta:d}),e[17]=d,e[18]=c,e[19]=r,e[20]=ie):ie=e[20];const V=!r.isMultivariate&&n.jsxs(st,{children:[n.jsx(at,{asChild:!0,children:n.jsx(Ue,{type:"button",variant:"ghost",size:"icon","aria-label":o?"Disable async render":"Enable async render",className:Re("h-7 w-7 shrink-0",o?"":"opacity-0 group-hover:opacity-100"),onClick:E=>{E.stopPropagation(),N()},onPointerDown:Pr,children:n.jsx(ir,{className:Re("h-3.5 w-3.5",o&&"text-yellow-500")})})}),n.jsx(rt,{side:"bottom",children:o?"Disable async render":"Enable async render"})]});let he;e[21]!==D||e[22]!==r.isHidden||e[23]!==r.isMultivariate?(he=!r.isMultivariate&&n.jsxs(st,{children:[n.jsx(at,{asChild:!0,children:n.jsx(Ue,{type:"button",variant:"ghost",size:"icon","aria-label":r.isHidden?"Show section":"Hide section",className:Re("h-7 w-7 shrink-0",r.isHidden?"opacity-100":"opacity-0 group-hover:opacity-100"),onClick:E=>{E.stopPropagation(),D()},onPointerDown:Tr,children:r.isHidden?n.jsx(or,{className:"h-3.5 w-3.5"}):n.jsx(ar,{className:"h-3.5 w-3.5"})})}),n.jsx(rt,{side:"bottom",children:r.isHidden?"Show section":"Hide section"})]}),e[21]=D,e[22]=r.isHidden,e[23]=r.isMultivariate,e[24]=he):he=e[24];let K;e[25]===Symbol.for("react.memo_cache_sentinel")?(K=n.jsx(Kn,{asChild:!0,children:n.jsx(Ue,{type:"button",variant:"ghost",size:"icon","aria-label":"Section actions",className:"h-7 w-7 shrink-0 opacity-0 group-hover:opacity-100",onClick:Dr,onPointerDown:Cr,children:n.jsx(An,{className:"h-3.5 w-3.5"})})}),e[25]=K):K=e[25];let ce;e[26]!==S?(ce=E=>{E.stopPropagation(),S()},e[26]=S,e[27]=ce):ce=e[27];let X;e[28]===Symbol.for("react.memo_cache_sentinel")?(X=n.jsx(En,{className:"h-4 w-4"}),e[28]=X):X=e[28];let Y;e[29]!==ce?(Y=n.jsxs(Ze,{onClick:ce,children:[X,"Duplicate"]}),e[29]=ce,e[30]=Y):Y=e[30];let L;e[31]!==u||e[32]!==j?(L=u&&n.jsxs(Ze,{className:aa,onClick:E=>{E.stopPropagation(),j()},children:[n.jsx(Mn,{className:"h-4 w-4"}),"Add variant"]}),e[31]=u,e[32]=j,e[33]=L):L=e[33];let B;e[34]!==se||e[35]!==x?(B=se&&n.jsxs(Ze,{className:wr,onClick:E=>{E.stopPropagation(),x()},children:[n.jsx(Wt,{className:"h-4 w-4"}),"Make reusable"]}),e[34]=se,e[35]=x,e[36]=B):B=e[36];let Z;e[37]!==C||e[38]!==r.isMultivariate||e[39]!==r.isSavedBlock?(Z=r.isSavedBlock===!0&&!r.isMultivariate&&n.jsxs(Ze,{onClick:E=>{E.stopPropagation(),C()},children:[n.jsx(Wt,{className:"h-4 w-4"}),"Detach"]}),e[37]=C,e[38]=r.isMultivariate,e[39]=r.isSavedBlock,e[40]=Z):Z=e[40];let G;e[41]!==g?(G=E=>{E.stopPropagation(),g()},e[41]=g,e[42]=G):G=e[42];let ee;e[43]===Symbol.for("react.memo_cache_sentinel")?(ee=n.jsx($n,{className:"h-4 w-4"}),e[43]=ee):ee=e[43];let ne;e[44]!==G?(ne=n.jsxs(Ze,{className:"text-destructive focus:text-destructive",onClick:G,children:[ee,"Delete"]}),e[44]=G,e[45]=ne):ne=e[45];let me;e[46]!==Y||e[47]!==L||e[48]!==B||e[49]!==Z||e[50]!==ne?(me=n.jsxs(On,{children:[K,n.jsxs(Ln,{align:"end",className:"w-44",children:[Y,L,B,Z,ne]})]}),e[46]=Y,e[47]=L,e[48]=B,e[49]=Z,e[50]=ne,e[51]=me):me=e[51];let F;return e[52]!==W||e[53]!==O||e[54]!==f||e[55]!==l||e[56]!==le||e[57]!==q||e[58]!==ie||e[59]!==V||e[60]!==he||e[61]!==me||e[62]!==I?(F=n.jsxs("div",{ref:l,style:le,...W,...O,role:oe,tabIndex:Se,onClick:f,onKeyDown:I,className:q,children:[ie,V,he,me]}),e[52]=W,e[53]=O,e[54]=f,e[55]=l,e[56]=le,e[57]=q,e[58]=ie,e[59]=V,e[60]=he,e[61]=me,e[62]=I,e[63]=F):F=e[63],F}function Cr(m){return m.stopPropagation()}function Dr(m){return m.stopPropagation()}function Tr(m){return m.stopPropagation()}function Pr(m){return m.stopPropagation()}function Vr(){return!1}function Ar(m){const e=Ie.c(90),{listKey:r,rawSections:c,sections:d,meta:h,selectedIndex:v,onSelect:f,onReorder:g,onDelete:S,onDuplicate:x,onMakeReusable:D,onToggleHidden:N,onToggleLazy:j,onAddVariant:C,onDetach:o,onAddSection:k,canAddSection:u}=m,Q=u===void 0?!0:u;let W;e[0]!==d.length?(W=()=>kn(d.length),e[0]=d.length,e[1]=W):W=e[1];const[O,l]=w.useState(W),[T,ae]=w.useState(null),[P,de]=w.useState(r),[A,le]=w.useState(d.length),M=w.useRef(!1);P!==r?(de(r),le(d.length),l(kn(d.length))):A!==d.length&&(le(d.length),l(z=>Nr(z,d.length)));let se;e[2]===Symbol.for("react.memo_cache_sentinel")?(se={activationConstraint:{distance:8}},e[2]=se):se=e[2];let oe;e[3]===Symbol.for("react.memo_cache_sentinel")?(oe={coordinateGetter:Un},e[3]=oe):oe=e[3];const Se=Bn(_t(zn,se),_t(Fn,oe));let I;e[4]!==O?(I=O.map(Mr),e[4]=O,e[5]=I):I=e[5];const te=I;let q;e[6]===Symbol.for("react.memo_cache_sentinel")?(q=z=>{ae(String(z.active.id))},e[6]=q):q=e[6];const ie=q;let V;e[7]!==te||e[8]!==g?(V=z=>{ae(null);const{active:_,over:H}=z;if(!H||_.id===H.id)return;const Le=te.indexOf(String(_.id)),Be=te.indexOf(String(H.id));Le===-1||Be===-1||(l(We=>Qn(mt([...We],Le,Be))),M.current=!0,requestAnimationFrame(()=>{M.current=!1}),g?.(Le,Be))},e[7]=te,e[8]=g,e[9]=V):V=e[9];const he=V;let K;e[10]===Symbol.for("react.memo_cache_sentinel")?(K=()=>{ae(null)},e[10]=K):K=e[10];const ce=K;let X,Y,L,B,Z,G,ee,ne,me,F,E,De,_e,Me,ke;if(e[11]!==T||e[12]!==Q||e[13]!==O||e[14]!==te||e[15]!==he||e[16]!==h||e[17]!==k||e[18]!==C||e[19]!==S||e[20]!==o||e[21]!==x||e[22]!==D||e[23]!==f||e[24]!==N||e[25]!==j||e[26]!==c||e[27]!==d||e[28]!==v||e[29]!==Se){Me=Symbol.for("react.early_return_sentinel");e:{const z=_=>{M.current||f(_)};if(e[45]!==T||e[46]!==Q||e[47]!==O||e[48]!==k||e[49]!==c||e[50]!==d){const _=T?O.find(H=>H.id===T):null;if(B=_!=null?d[_.index]:null,L=_!=null?c[_.index]:void 0,O.length===0){let H;e[54]===Symbol.for("react.memo_cache_sentinel")?(H=n.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:"No sections in this page."}),e[54]=H):H=e[54];const Le=!Q;let Be;e[55]===Symbol.for("react.memo_cache_sentinel")?(Be=n.jsx(qt,{size:14}),e[55]=Be):Be=e[55];let We;e[56]!==k||e[57]!==Le?(We=n.jsxs("div",{className:"space-y-2",children:[H,n.jsxs(Ue,{type:"button",variant:"outline",size:"sm",className:"w-full",disabled:Le,onClick:k,children:[Be,"Add section"]})]}),e[56]=k,e[57]=Le,e[58]=We):We=e[58],Me=We;break e}_e=Re(_&&"cursor-grabbing"),e[45]=T,e[46]=Q,e[47]=O,e[48]=k,e[49]=c,e[50]=d,e[51]=L,e[52]=B,e[53]=_e}else L=e[51],B=e[52],_e=e[53];Y=Wn,ne=Se,me=qn,F=ie,E=he,De=ce,X=Yn,G=te,ee=cr,ke="space-y-1",Z=O.map(_=>{const H=d[_.index];return H?n.jsx(Rr,{sortableId:_.id,section:H,raw:c[_.index],meta:h,selected:v===_.index,onSelect:()=>z(_.index),onDelete:()=>S(_.index),onDuplicate:()=>x(_.index),onMakeReusable:()=>D(_.index),onToggleHidden:()=>N(_.index),onToggleLazy:()=>j(_.index),onAddVariant:()=>C(_.index),onDetach:()=>o(_.index)},_.id):null})}e[11]=T,e[12]=Q,e[13]=O,e[14]=te,e[15]=he,e[16]=h,e[17]=k,e[18]=C,e[19]=S,e[20]=o,e[21]=x,e[22]=D,e[23]=f,e[24]=N,e[25]=j,e[26]=c,e[27]=d,e[28]=v,e[29]=Se,e[30]=X,e[31]=Y,e[32]=L,e[33]=B,e[34]=Z,e[35]=G,e[36]=ee,e[37]=ne,e[38]=me,e[39]=F,e[40]=E,e[41]=De,e[42]=_e,e[43]=Me,e[44]=ke}else X=e[30],Y=e[31],L=e[32],B=e[33],Z=e[34],G=e[35],ee=e[36],ne=e[37],me=e[38],F=e[39],E=e[40],De=e[41],_e=e[42],Me=e[43],ke=e[44];if(Me!==Symbol.for("react.early_return_sentinel"))return Me;let Te;e[59]!==Z||e[60]!==ke?(Te=n.jsx("div",{className:ke,children:Z}),e[59]=Z,e[60]=ke,e[61]=Te):Te=e[61];let Ce;e[62]!==X||e[63]!==G||e[64]!==ee||e[65]!==Te?(Ce=n.jsx(X,{items:G,strategy:ee,children:Te}),e[62]=X,e[63]=G,e[64]=ee,e[65]=Te,e[66]=Ce):Ce=e[66];let Ke;e[67]!==L||e[68]!==B||e[69]!==h?(Ke=B?n.jsx("div",{className:Re("cursor-grabbing shadow-lg ring-1 ring-border/60",Zn(B,!1)),children:n.jsx(Xn,{section:B,raw:L,meta:h})}):null,e[67]=L,e[68]=B,e[69]=h,e[70]=Ke):Ke=e[70];let we;e[71]!==Ke?(we=n.jsx(Jn,{dropAnimation:null,children:Ke}),e[71]=Ke,e[72]=we):we=e[72];let Ee;e[73]!==Y||e[74]!==ne||e[75]!==me||e[76]!==F||e[77]!==E||e[78]!==De||e[79]!==Ce||e[80]!==we?(Ee=n.jsxs(Y,{sensors:ne,collisionDetection:me,onDragStart:F,onDragEnd:E,onDragCancel:De,children:[Ce,we]}),e[73]=Y,e[74]=ne,e[75]=me,e[76]=F,e[77]=E,e[78]=De,e[79]=Ce,e[80]=we,e[81]=Ee):Ee=e[81];const Oe=!Q;let re;e[82]===Symbol.for("react.memo_cache_sentinel")?(re=n.jsx(qt,{size:14}),e[82]=re):re=e[82];let ue;e[83]!==k||e[84]!==Oe?(ue=n.jsxs(Ue,{type:"button",variant:"outline",size:"sm",className:"mt-2 w-full",disabled:Oe,onClick:k,children:[re,"Add section"]}),e[83]=k,e[84]=Oe,e[85]=ue):ue=e[85];let $e;return e[86]!==_e||e[87]!==Ee||e[88]!==ue?($e=n.jsxs("div",{className:_e,children:[Ee,ue]}),e[86]=_e,e[87]=Ee,e[88]=ue,e[89]=$e):$e=e[89],$e}function Mr(m){return m.id}function Er(m){const e=Ie.c(38),{open:r,initialName:c,autoLabel:d,isPending:h,onSubmit:v,onOpenChange:f}=m,g=h===void 0?!1:h,[S,x]=w.useState(c),[D,N]=w.useState(r);r!==D&&(N(r),r&&x(c));let j;e[0]!==g||e[1]!==f?(j=oe=>{!oe&&!g&&f(!1)},e[0]=g,e[1]=f,e[2]=j):j=e[2];const C=j;let o;e[3]!==g||e[4]!==S||e[5]!==v?(o=async oe=>{oe.preventDefault(),!g&&await v(S.trim())},e[3]=g,e[4]=S,e[5]=v,e[6]=o):o=e[6];const k=o;let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(Xa,{children:"Rename variant"}),e[7]=u):u=e[7];const Q=d||"the rule";let W;e[8]!==Q?(W=n.jsxs(Za,{children:[u,n.jsxs(Ga,{children:["Save this matcher as a global block with a custom label. Leave empty to inline the matcher again and fall back to"," ",n.jsx("span",{className:"font-medium",children:Q}),"."]})]}),e[8]=Q,e[9]=W):W=e[9];let O;e[10]===Symbol.for("react.memo_cache_sentinel")?(O=n.jsx("label",{htmlFor:"variant-rename-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[10]=O):O=e[10];let l;e[11]===Symbol.for("react.memo_cache_sentinel")?(l=oe=>x(oe.target.value),e[11]=l):l=e[11];let T;e[12]!==d||e[13]!==g||e[14]!==S?(T=n.jsxs("div",{className:"space-y-1.5 py-4",children:[O,n.jsx(sr,{id:"variant-rename-name",value:S,onChange:l,placeholder:d,autoFocus:!0,disabled:g})]}),e[12]=d,e[13]=g,e[14]=S,e[15]=T):T=e[15];let ae;e[16]!==f?(ae=()=>f(!1),e[16]=f,e[17]=ae):ae=e[17];let P;e[18]!==g||e[19]!==ae?(P=n.jsx(Ue,{type:"button",variant:"outline",onClick:ae,disabled:g,children:"Cancel"}),e[18]=g,e[19]=ae,e[20]=P):P=e[20];let de;e[21]!==g?(de=g?n.jsxs(n.Fragment,{children:[n.jsx(Dn,{size:14,className:"animate-spin"}),"Saving…"]}):"Save",e[21]=g,e[22]=de):de=e[22];let A;e[23]!==g||e[24]!==de?(A=n.jsx(Ue,{type:"submit",disabled:g,children:de}),e[23]=g,e[24]=de,e[25]=A):A=e[25];let le;e[26]!==P||e[27]!==A?(le=n.jsxs(er,{children:[P,A]}),e[26]=P,e[27]=A,e[28]=le):le=e[28];let M;e[29]!==k||e[30]!==le||e[31]!==W||e[32]!==T?(M=n.jsx(tr,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:k,children:[W,T,le]})}),e[29]=k,e[30]=le,e[31]=W,e[32]=T,e[33]=M):M=e[33];let se;return e[34]!==C||e[35]!==r||e[36]!==M?(se=n.jsx(nr,{open:r,onOpenChange:C,children:M}),e[34]=C,e[35]=r,e[36]=M,e[37]=se):se=e[37],se}const $r="oklch(0.65 0.15 160)",Gn="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 Yt(m){const e=Ie.c(5),{rule:r,matchers:c}=m,d=r?.__resolveType??"";let h;if(e[0]!==c||e[1]!==d){const S=c.find(x=>x.resolveType===d)?.iconName??ra(d);h=qa(S),e[0]=c,e[1]=d,e[2]=h}else h=e[2];const v=h;if(!v)return null;let f;return e[3]!==v?(f=n.jsx(v,{size:14,className:"shrink-0"}),e[3]=v,e[4]=f):f=e[4],f}function wn(m){return m.map(e=>`${e.label}|${e.rule?.__resolveType??""}`).join(`
|
|
1
|
+
import{c as Ie,r as w,l as Re,j as n,B as Ue,i as Dn,m as Qs,t as pe,K as Xs}from"./index-I8Uum3Jx.js";import{r as Zs,a as Gs,s as ea,i as Tn,c as ta,b as na,G as sa,V as aa,d as ra,e as jt,f as oa,g as ia,h as la,j as ca,k as ua,l as da,m as ma,n as fa,o as pa,p as xt,q as bt,t as ha,v as tt,w as Bt,x as ga,y as Xe,z as gn,S as va,M as vn,A as nt,B as Sn,C as Sa,D as xn,P as xa,E as Ft,F as ba,H as ya,I as ja,J as _a,K as ka,L as wa,N as Na,O as dt,Q as Ra,R as Ca,T as Da,U as Ta,W as Pa,X as Va,Y as Aa,Z as Ma,_ as bn,$ as zt,a0 as Ea,a1 as $a,a2 as It,a3 as Ka,a4 as yn,a5 as Oa,a6 as La,a7 as Ba,a8 as Ht,a9 as Fa,aa as za,ab as Pn,ac as jn,ad as Ia}from"./index-CiVkOVzW.js";import{t as Ha}from"./ChevronDown-URo4LveF.js";import{n as Ua}from"./ChevronLeft-aMkPes9N.js";import{i as Vn}from"./ChevronRight-oz8o6WPV.js";import{n as Wa}from"./ChevronUp-HJUE3-BD.js";import{K as Wt,D as An,W as Mn,l as qa,L as Ya,M as Ja}from"./agent-icon-B2N3zGQH.js";import{i as Qa}from"./Globe01-wGomueqV.js";import{S as yt}from"./scroll-area-DnauLcxE.js";import{T as st,a as at,b as rt}from"./tooltip-Cs84Kx7a.js";import{d as Xa,c as Za,e as Ga,D as er,b as tr,a as nr}from"./dialog-CxQBoX40.js";import{I as sr}from"./input-CutcETvq.js";import{s as ar,a as En}from"./Eye-BSiFxHQB.js";import{d as rr}from"./ZoomOut-DxqRFWA_.js";import{i as or}from"./Settings02-DbH9OAzT.js";import{s as qt}from"./Plus-Bw9lc6SR.js";import{s as $n}from"./Trash01-d58N8w5a.js";import{i as ir}from"./Zap-BQKeuD4l.js";import{c as Ze,a as Kn,D as On,b as Ln,g as lr}from"./dropdown-menu-5CWPgj7f.js";import{b as Bn,c as _t,K as Fn,P as zn,e as In,C as Hn,s as Un,l as mt,D as Wn,d as qn,S as Yn,v as cr,k as Jn,p as ur}from"./sortable.esm-BQBGtGRV.js";import{r as _n,u as dr,d as mr,a as fr,i as pr,f as hr,P as gr,b as vr,S as Sr}from"./page-seo-form-gPXTm6pw.js";import{b as xr}from"./Tool01-DvTGD1Yt.js";import{A as br}from"./add-section-modal-jgpkoBcW.js";import"./index-C_Ih0jtP.js";import"./chat-context-Bspy4m-d.js";import"./hooks-BAG9TZjZ.js";import"./use-mcp-client-Bq9g8m5J.js";import"./auth-DZDiXt1m.js";import"./decopilot-sse-pool-TIer_srZ.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-virtual-mcp-C5aoCVVQ.js";import"./use-collections-KLUYE1x1.js";import"./use-ai-providers-BgadC07_.js";import"./studio-tools-bjPFQfXc.js";import"./tab-id-BptcWVWa.js";import"./use-organization-settings-oh1iUWuA.js";import"./drawer-CoRZTii0.js";import"./collection-search-BPoBI_I5.js";import"./SearchMd-BMfw7gZ4.js";import"./use-mobile-C0mpADhR.js";import"./use-mcp-prompts-B5FIxmOZ.js";import"./X-D7X7Z50V.js";import"./shell-layout-BgovnITR.js";import"./avatar-Dv3IrttI.js";import"./User01-BDtU1dk1.js";import"./Users03-CL71IAQ8.js";import"./Stars02-PPXsboxW.js";import"./XClose-BbuWQhNb.js";import"./CheckCircle-V30FMM2D.js";import"./FilterLines-CEzORaPw.js";import"./required-auth-layout-BFGUeccA.js";import"./use-org-sso-HWNvOeDC.js";import"./SwitchHorizontal01-F_1MjTR3.js";import"./ZapSquare-CvkoTQDM.js";import"./Star01-BwAv907s.js";import"./Upload01-C_hHbDSF.js";import"./AlertCircle-VcwplCRi.js";import"./form-CpFt_4sy.js";import"./label-DtGUWURu.js";import"./select-CeO9pIG_.js";import"./XCircle-PlbEvjyp.js";import"./tabs-C0RM8s7M.js";import"./toggle-group-qpErv2AC.js";import"./Monitor01-SEZLDRFN.js";import"./connect-desktop-dialog-G37q3fkg.js";import"./decopilot-DfFzELja.js";import"./checkbox-KUrNOBQk.js";import"./skeleton-1BUBAFib.js";import"./Key01-r6MDYdDw.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-B3kXnqLg.js";import"./card-Chq65iX4.js";import"./ArrowUpRight-CAv7CUnJ.js";import"./Stars01-D1icdaCh.js";import"./popover-C8AJAJSa.js";import"./command-DMsCjDdA.js";import"./index-BLMNER8l.js";import"./useInfiniteQuery-RfoATJAI.js";import"./use-infinite-scroll-BJoUj4tJ.js";import"./question-004-sINsf4GQ.js";import"./integration-icon-D3W1euXX.js";import"./use-status-sounds-MBoAiBsc.js";import"./empty-state-B-ezQrZT.js";import"./toolbar-CB27CeHy.js";import"./preview-dialog-D1-LAakL.js";import"./LinkExternal01-BWnRnxGs.js";import"./index-DPI_0XE-.js";import"./file-type-icon-Cd8oKt-R.js";import"./LayoutLeft-BFxGsVdk.js";import"./use-connection-BcZ8SPdu.js";import"./use-mcp-tools-LraQQ1bu.js";import"./types-pQkRXbdZ.js";import"./use-capability-BUm2GwYJ.js";import"./textarea-CvR7iHW3.js";import"./shell-route-loading-w2qYEgt-.js";import"./extract-connection-data-BaXkJtVr.js";import"./index-JhgoGL0k.js";import"./mcp-oauth-CSZ5TVrK.js";import"./badge-toKsUzoB.js";import"./connection-slug-eyAPH6o3.js";import"./alert-dialog-DvWgcmQI.js";import"./switch-B9PlH85E.js";import"./Play-BDoh8EAp.js";import"./use-debounced-autosave-CSkDAooO.js";import"./index-BU8Nad-n.js";import"./sidebar-BNKGZwsk.js";import"./sheet-CaSXRGPU.js";import"./search-input-BVF4N9EW.js";import"./collection-tabs-FH3-RtUV.js";import"./github-repo-picker-CvyWRbaM.js";import"./authenticate-and-persist-oauth-CGYbK6H8.js";import"./use-navigate-to-agent-CRQ9sIAj.js";import"./Users01-PX3eYoC8.js";import"./use-secrets-CkVHtz_G.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./view-mode-toggle-DTMt6lCZ.js";import"./DotsVertical-QF46dzdi.js";import"./automation-runs-DyKvgj21.js";import"./table-Bh38Wtyx.js";import"./use-members-D283HZiN.js";import"./use-org-auth-client-WATciLg3.js";import"./task-status-sw3Y4pwg.js";import"./use-automations-P1MHR3DS.js";import"./useSuspenseInfiniteQuery-DBiSYggu.js";import"./use-file-configs-YBpYKsXP.js";import"./monaco-editor-x5JEAvo5.js";import"./select-model-mprfSN1i.js";import"./automation-list-row-CAUoBpVq.js";import"./Globe04-CsKOsQ4z.js";import"./HardDrive-BuI4Q48l.js";import"./Sun-Dw86eVev.js";import"./Palette-CEjENuG4.js";import"./Shield01-C1R4fpvK.js";import"./use-clock-tick-DNfOIVGO.js";import"./use-copy-3_Rhxcs5.js";import"./content-blocks-o63cs2vh.js";import"./connection-card-BG_Nwlzj.js";import"./use-registry-connections-d6Abj3O4.js";import"./connection-form-helpers-DLOiycDJ.js";function yr(m){return m.schema?.definitions??m.schema?.$defs??{}}function jr(m,e){const r=yr(e),c=r[btoa(m)];if(!c)return;let d=typeof c.image=="string"?c.image:void 0;if(!d&&Array.isArray(c.allOf)){const h=c.allOf.find(v=>typeof v.$ref=="string")?.$ref;if(typeof h=="string"){const v=h.replace("#/definitions/",""),f=r[v];d=typeof f?.image=="string"?f.image:void 0}}if(d?.includes("{{{"))return d}function _r(m,e){if(!e)return;const r=Zs(m);if(!r)return;const c=jr(r.resolveType,e);if(!c)return;const d=Gs(c,r.data);if(d)return ea(d)}const kr="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",wr="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 kn(m){return Array.from({length:m},(e,r)=>({id:crypto.randomUUID(),index:r}))}function Qn(m){return m.map((e,r)=>({...e,index:r}))}function Nr(m,e){if(e===m.length)return m;if(e<m.length)return Qn(m.slice(0,e));const r=Array.from({length:e-m.length},(c,d)=>({id:crypto.randomUUID(),index:m.length+d}));return[...m,...r]}function Xn(m){const e=Ie.c(20),{section:r,raw:c,meta:d}=m,h=r.isSavedBlock===!0,v=r.isMultivariate===!0;let f;e[0]!==d||e[1]!==c?(f=c&&d?_r(c,d):void 0,e[0]=d,e[1]=c,e[2]=f):f=e[2];const g=f;let S;e[3]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(rr,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[3]=S):S=e[3];let x;e[4]!==g?(x=g&&n.jsx("img",{src:g,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[4]=g,e[5]=x):x=e[5];let D;e[6]!==v||e[7]!==h?(D=h?{color:sa}:v?{color:"oklch(0.65 0.15 160)"}:void 0,e[6]=v,e[7]=h,e[8]=D):D=e[8];let N;e[9]!==D?(N=n.jsx(Wt,{className:"h-4 w-4 shrink-0",style:D}),e[9]=D,e[10]=N):N=e[10];const j=r.isHidden&&"line-through opacity-50";let C;e[11]!==j?(C=Re("min-w-0 flex-1 truncate text-sm font-medium",j),e[11]=j,e[12]=C):C=e[12];let o;e[13]!==r.label||e[14]!==C?(o=n.jsx("span",{className:C,children:r.label}),e[13]=r.label,e[14]=C,e[15]=o):o=e[15];let k;return e[16]!==x||e[17]!==N||e[18]!==o?(k=n.jsxs(n.Fragment,{children:[S,x,N,o]}),e[16]=x,e[17]=N,e[18]=o,e[19]=k):k=e[19],k}function Zn(m,e){const r=m.isSavedBlock===!0,c=m.isMultivariate===!0;return Re("group flex select-none items-center gap-2 rounded-md px-2 py-2.5",e?"bg-accent text-accent-foreground":r?kr: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 Rr(m){const e=Ie.c(64),{section:r,raw:c,meta:d,sortableId:h,selected:v,onSelect:f,onDelete:g,onDuplicate:S,onMakeReusable:x,onToggleHidden:D,onToggleLazy:N,onAddVariant:j,onDetach:C}=m,o=c?Tn(c.__resolveType??""):!1;let k;e[0]!==r?(k=ta(r),e[0]=r,e[1]=k):k=e[1];const u=k;let Q;e[2]!==h?(Q={id:h,animateLayoutChanges:Vr},e[2]=h,e[3]=Q):Q=e[3];const{attributes:W,listeners:O,setNodeRef:l,transform:T,isDragging:ae}=In(Q);let P;e[4]!==T?(P=Hn.Transform.toString(T?{...T,x:0}:null),e[4]=T,e[5]=P):P=e[5];const de=ae?0:void 0;let A;e[6]!==P||e[7]!==de?(A={transform:P,opacity:de},e[6]=P,e[7]=de,e[8]=A):A=e[8];const le=A;let M;e[9]!==r?(M=na(r),e[9]=r,e[10]=M):M=e[10];const se=M,oe="button",Se=0;let I;e[11]!==f?(I=E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),f())},e[11]=f,e[12]=I):I=e[12];const te=ae?"cursor-grabbing":"cursor-pointer";let q;e[13]!==r||e[14]!==v||e[15]!==te?(q=Re("touch-none transition-colors",te,Zn(r,v)),e[13]=r,e[14]=v,e[15]=te,e[16]=q):q=e[16];let ie;e[17]!==d||e[18]!==c||e[19]!==r?(ie=n.jsx(Xn,{section:r,raw:c,meta:d}),e[17]=d,e[18]=c,e[19]=r,e[20]=ie):ie=e[20];const V=!r.isMultivariate&&n.jsxs(st,{children:[n.jsx(at,{asChild:!0,children:n.jsx(Ue,{type:"button",variant:"ghost",size:"icon","aria-label":o?"Disable async render":"Enable async render",className:Re("h-7 w-7 shrink-0",o?"":"opacity-0 group-hover:opacity-100"),onClick:E=>{E.stopPropagation(),N()},onPointerDown:Pr,children:n.jsx(ir,{className:Re("h-3.5 w-3.5",o&&"text-yellow-500")})})}),n.jsx(rt,{side:"bottom",children:o?"Disable async render":"Enable async render"})]});let he;e[21]!==D||e[22]!==r.isHidden||e[23]!==r.isMultivariate?(he=!r.isMultivariate&&n.jsxs(st,{children:[n.jsx(at,{asChild:!0,children:n.jsx(Ue,{type:"button",variant:"ghost",size:"icon","aria-label":r.isHidden?"Show section":"Hide section",className:Re("h-7 w-7 shrink-0",r.isHidden?"opacity-100":"opacity-0 group-hover:opacity-100"),onClick:E=>{E.stopPropagation(),D()},onPointerDown:Tr,children:r.isHidden?n.jsx(or,{className:"h-3.5 w-3.5"}):n.jsx(ar,{className:"h-3.5 w-3.5"})})}),n.jsx(rt,{side:"bottom",children:r.isHidden?"Show section":"Hide section"})]}),e[21]=D,e[22]=r.isHidden,e[23]=r.isMultivariate,e[24]=he):he=e[24];let K;e[25]===Symbol.for("react.memo_cache_sentinel")?(K=n.jsx(Kn,{asChild:!0,children:n.jsx(Ue,{type:"button",variant:"ghost",size:"icon","aria-label":"Section actions",className:"h-7 w-7 shrink-0 opacity-0 group-hover:opacity-100",onClick:Dr,onPointerDown:Cr,children:n.jsx(An,{className:"h-3.5 w-3.5"})})}),e[25]=K):K=e[25];let ce;e[26]!==S?(ce=E=>{E.stopPropagation(),S()},e[26]=S,e[27]=ce):ce=e[27];let X;e[28]===Symbol.for("react.memo_cache_sentinel")?(X=n.jsx(En,{className:"h-4 w-4"}),e[28]=X):X=e[28];let Y;e[29]!==ce?(Y=n.jsxs(Ze,{onClick:ce,children:[X,"Duplicate"]}),e[29]=ce,e[30]=Y):Y=e[30];let L;e[31]!==u||e[32]!==j?(L=u&&n.jsxs(Ze,{className:aa,onClick:E=>{E.stopPropagation(),j()},children:[n.jsx(Mn,{className:"h-4 w-4"}),"Add variant"]}),e[31]=u,e[32]=j,e[33]=L):L=e[33];let B;e[34]!==se||e[35]!==x?(B=se&&n.jsxs(Ze,{className:wr,onClick:E=>{E.stopPropagation(),x()},children:[n.jsx(Wt,{className:"h-4 w-4"}),"Make reusable"]}),e[34]=se,e[35]=x,e[36]=B):B=e[36];let Z;e[37]!==C||e[38]!==r.isMultivariate||e[39]!==r.isSavedBlock?(Z=r.isSavedBlock===!0&&!r.isMultivariate&&n.jsxs(Ze,{onClick:E=>{E.stopPropagation(),C()},children:[n.jsx(Wt,{className:"h-4 w-4"}),"Detach"]}),e[37]=C,e[38]=r.isMultivariate,e[39]=r.isSavedBlock,e[40]=Z):Z=e[40];let G;e[41]!==g?(G=E=>{E.stopPropagation(),g()},e[41]=g,e[42]=G):G=e[42];let ee;e[43]===Symbol.for("react.memo_cache_sentinel")?(ee=n.jsx($n,{className:"h-4 w-4"}),e[43]=ee):ee=e[43];let ne;e[44]!==G?(ne=n.jsxs(Ze,{className:"text-destructive focus:text-destructive",onClick:G,children:[ee,"Delete"]}),e[44]=G,e[45]=ne):ne=e[45];let me;e[46]!==Y||e[47]!==L||e[48]!==B||e[49]!==Z||e[50]!==ne?(me=n.jsxs(On,{children:[K,n.jsxs(Ln,{align:"end",className:"w-44",children:[Y,L,B,Z,ne]})]}),e[46]=Y,e[47]=L,e[48]=B,e[49]=Z,e[50]=ne,e[51]=me):me=e[51];let F;return e[52]!==W||e[53]!==O||e[54]!==f||e[55]!==l||e[56]!==le||e[57]!==q||e[58]!==ie||e[59]!==V||e[60]!==he||e[61]!==me||e[62]!==I?(F=n.jsxs("div",{ref:l,style:le,...W,...O,role:oe,tabIndex:Se,onClick:f,onKeyDown:I,className:q,children:[ie,V,he,me]}),e[52]=W,e[53]=O,e[54]=f,e[55]=l,e[56]=le,e[57]=q,e[58]=ie,e[59]=V,e[60]=he,e[61]=me,e[62]=I,e[63]=F):F=e[63],F}function Cr(m){return m.stopPropagation()}function Dr(m){return m.stopPropagation()}function Tr(m){return m.stopPropagation()}function Pr(m){return m.stopPropagation()}function Vr(){return!1}function Ar(m){const e=Ie.c(90),{listKey:r,rawSections:c,sections:d,meta:h,selectedIndex:v,onSelect:f,onReorder:g,onDelete:S,onDuplicate:x,onMakeReusable:D,onToggleHidden:N,onToggleLazy:j,onAddVariant:C,onDetach:o,onAddSection:k,canAddSection:u}=m,Q=u===void 0?!0:u;let W;e[0]!==d.length?(W=()=>kn(d.length),e[0]=d.length,e[1]=W):W=e[1];const[O,l]=w.useState(W),[T,ae]=w.useState(null),[P,de]=w.useState(r),[A,le]=w.useState(d.length),M=w.useRef(!1);P!==r?(de(r),le(d.length),l(kn(d.length))):A!==d.length&&(le(d.length),l(z=>Nr(z,d.length)));let se;e[2]===Symbol.for("react.memo_cache_sentinel")?(se={activationConstraint:{distance:8}},e[2]=se):se=e[2];let oe;e[3]===Symbol.for("react.memo_cache_sentinel")?(oe={coordinateGetter:Un},e[3]=oe):oe=e[3];const Se=Bn(_t(zn,se),_t(Fn,oe));let I;e[4]!==O?(I=O.map(Mr),e[4]=O,e[5]=I):I=e[5];const te=I;let q;e[6]===Symbol.for("react.memo_cache_sentinel")?(q=z=>{ae(String(z.active.id))},e[6]=q):q=e[6];const ie=q;let V;e[7]!==te||e[8]!==g?(V=z=>{ae(null);const{active:_,over:H}=z;if(!H||_.id===H.id)return;const Le=te.indexOf(String(_.id)),Be=te.indexOf(String(H.id));Le===-1||Be===-1||(l(We=>Qn(mt([...We],Le,Be))),M.current=!0,requestAnimationFrame(()=>{M.current=!1}),g?.(Le,Be))},e[7]=te,e[8]=g,e[9]=V):V=e[9];const he=V;let K;e[10]===Symbol.for("react.memo_cache_sentinel")?(K=()=>{ae(null)},e[10]=K):K=e[10];const ce=K;let X,Y,L,B,Z,G,ee,ne,me,F,E,De,_e,Me,ke;if(e[11]!==T||e[12]!==Q||e[13]!==O||e[14]!==te||e[15]!==he||e[16]!==h||e[17]!==k||e[18]!==C||e[19]!==S||e[20]!==o||e[21]!==x||e[22]!==D||e[23]!==f||e[24]!==N||e[25]!==j||e[26]!==c||e[27]!==d||e[28]!==v||e[29]!==Se){Me=Symbol.for("react.early_return_sentinel");e:{const z=_=>{M.current||f(_)};if(e[45]!==T||e[46]!==Q||e[47]!==O||e[48]!==k||e[49]!==c||e[50]!==d){const _=T?O.find(H=>H.id===T):null;if(B=_!=null?d[_.index]:null,L=_!=null?c[_.index]:void 0,O.length===0){let H;e[54]===Symbol.for("react.memo_cache_sentinel")?(H=n.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:"No sections in this page."}),e[54]=H):H=e[54];const Le=!Q;let Be;e[55]===Symbol.for("react.memo_cache_sentinel")?(Be=n.jsx(qt,{size:14}),e[55]=Be):Be=e[55];let We;e[56]!==k||e[57]!==Le?(We=n.jsxs("div",{className:"space-y-2",children:[H,n.jsxs(Ue,{type:"button",variant:"outline",size:"sm",className:"w-full",disabled:Le,onClick:k,children:[Be,"Add section"]})]}),e[56]=k,e[57]=Le,e[58]=We):We=e[58],Me=We;break e}_e=Re(_&&"cursor-grabbing"),e[45]=T,e[46]=Q,e[47]=O,e[48]=k,e[49]=c,e[50]=d,e[51]=L,e[52]=B,e[53]=_e}else L=e[51],B=e[52],_e=e[53];Y=Wn,ne=Se,me=qn,F=ie,E=he,De=ce,X=Yn,G=te,ee=cr,ke="space-y-1",Z=O.map(_=>{const H=d[_.index];return H?n.jsx(Rr,{sortableId:_.id,section:H,raw:c[_.index],meta:h,selected:v===_.index,onSelect:()=>z(_.index),onDelete:()=>S(_.index),onDuplicate:()=>x(_.index),onMakeReusable:()=>D(_.index),onToggleHidden:()=>N(_.index),onToggleLazy:()=>j(_.index),onAddVariant:()=>C(_.index),onDetach:()=>o(_.index)},_.id):null})}e[11]=T,e[12]=Q,e[13]=O,e[14]=te,e[15]=he,e[16]=h,e[17]=k,e[18]=C,e[19]=S,e[20]=o,e[21]=x,e[22]=D,e[23]=f,e[24]=N,e[25]=j,e[26]=c,e[27]=d,e[28]=v,e[29]=Se,e[30]=X,e[31]=Y,e[32]=L,e[33]=B,e[34]=Z,e[35]=G,e[36]=ee,e[37]=ne,e[38]=me,e[39]=F,e[40]=E,e[41]=De,e[42]=_e,e[43]=Me,e[44]=ke}else X=e[30],Y=e[31],L=e[32],B=e[33],Z=e[34],G=e[35],ee=e[36],ne=e[37],me=e[38],F=e[39],E=e[40],De=e[41],_e=e[42],Me=e[43],ke=e[44];if(Me!==Symbol.for("react.early_return_sentinel"))return Me;let Te;e[59]!==Z||e[60]!==ke?(Te=n.jsx("div",{className:ke,children:Z}),e[59]=Z,e[60]=ke,e[61]=Te):Te=e[61];let Ce;e[62]!==X||e[63]!==G||e[64]!==ee||e[65]!==Te?(Ce=n.jsx(X,{items:G,strategy:ee,children:Te}),e[62]=X,e[63]=G,e[64]=ee,e[65]=Te,e[66]=Ce):Ce=e[66];let Ke;e[67]!==L||e[68]!==B||e[69]!==h?(Ke=B?n.jsx("div",{className:Re("cursor-grabbing shadow-lg ring-1 ring-border/60",Zn(B,!1)),children:n.jsx(Xn,{section:B,raw:L,meta:h})}):null,e[67]=L,e[68]=B,e[69]=h,e[70]=Ke):Ke=e[70];let we;e[71]!==Ke?(we=n.jsx(Jn,{dropAnimation:null,children:Ke}),e[71]=Ke,e[72]=we):we=e[72];let Ee;e[73]!==Y||e[74]!==ne||e[75]!==me||e[76]!==F||e[77]!==E||e[78]!==De||e[79]!==Ce||e[80]!==we?(Ee=n.jsxs(Y,{sensors:ne,collisionDetection:me,onDragStart:F,onDragEnd:E,onDragCancel:De,children:[Ce,we]}),e[73]=Y,e[74]=ne,e[75]=me,e[76]=F,e[77]=E,e[78]=De,e[79]=Ce,e[80]=we,e[81]=Ee):Ee=e[81];const Oe=!Q;let re;e[82]===Symbol.for("react.memo_cache_sentinel")?(re=n.jsx(qt,{size:14}),e[82]=re):re=e[82];let ue;e[83]!==k||e[84]!==Oe?(ue=n.jsxs(Ue,{type:"button",variant:"outline",size:"sm",className:"mt-2 w-full",disabled:Oe,onClick:k,children:[re,"Add section"]}),e[83]=k,e[84]=Oe,e[85]=ue):ue=e[85];let $e;return e[86]!==_e||e[87]!==Ee||e[88]!==ue?($e=n.jsxs("div",{className:_e,children:[Ee,ue]}),e[86]=_e,e[87]=Ee,e[88]=ue,e[89]=$e):$e=e[89],$e}function Mr(m){return m.id}function Er(m){const e=Ie.c(38),{open:r,initialName:c,autoLabel:d,isPending:h,onSubmit:v,onOpenChange:f}=m,g=h===void 0?!1:h,[S,x]=w.useState(c),[D,N]=w.useState(r);r!==D&&(N(r),r&&x(c));let j;e[0]!==g||e[1]!==f?(j=oe=>{!oe&&!g&&f(!1)},e[0]=g,e[1]=f,e[2]=j):j=e[2];const C=j;let o;e[3]!==g||e[4]!==S||e[5]!==v?(o=async oe=>{oe.preventDefault(),!g&&await v(S.trim())},e[3]=g,e[4]=S,e[5]=v,e[6]=o):o=e[6];const k=o;let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(Xa,{children:"Rename variant"}),e[7]=u):u=e[7];const Q=d||"the rule";let W;e[8]!==Q?(W=n.jsxs(Za,{children:[u,n.jsxs(Ga,{children:["Save this matcher as a global block with a custom label. Leave empty to inline the matcher again and fall back to"," ",n.jsx("span",{className:"font-medium",children:Q}),"."]})]}),e[8]=Q,e[9]=W):W=e[9];let O;e[10]===Symbol.for("react.memo_cache_sentinel")?(O=n.jsx("label",{htmlFor:"variant-rename-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[10]=O):O=e[10];let l;e[11]===Symbol.for("react.memo_cache_sentinel")?(l=oe=>x(oe.target.value),e[11]=l):l=e[11];let T;e[12]!==d||e[13]!==g||e[14]!==S?(T=n.jsxs("div",{className:"space-y-1.5 py-4",children:[O,n.jsx(sr,{id:"variant-rename-name",value:S,onChange:l,placeholder:d,autoFocus:!0,disabled:g})]}),e[12]=d,e[13]=g,e[14]=S,e[15]=T):T=e[15];let ae;e[16]!==f?(ae=()=>f(!1),e[16]=f,e[17]=ae):ae=e[17];let P;e[18]!==g||e[19]!==ae?(P=n.jsx(Ue,{type:"button",variant:"outline",onClick:ae,disabled:g,children:"Cancel"}),e[18]=g,e[19]=ae,e[20]=P):P=e[20];let de;e[21]!==g?(de=g?n.jsxs(n.Fragment,{children:[n.jsx(Dn,{size:14,className:"animate-spin"}),"Saving…"]}):"Save",e[21]=g,e[22]=de):de=e[22];let A;e[23]!==g||e[24]!==de?(A=n.jsx(Ue,{type:"submit",disabled:g,children:de}),e[23]=g,e[24]=de,e[25]=A):A=e[25];let le;e[26]!==P||e[27]!==A?(le=n.jsxs(er,{children:[P,A]}),e[26]=P,e[27]=A,e[28]=le):le=e[28];let M;e[29]!==k||e[30]!==le||e[31]!==W||e[32]!==T?(M=n.jsx(tr,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:k,children:[W,T,le]})}),e[29]=k,e[30]=le,e[31]=W,e[32]=T,e[33]=M):M=e[33];let se;return e[34]!==C||e[35]!==r||e[36]!==M?(se=n.jsx(nr,{open:r,onOpenChange:C,children:M}),e[34]=C,e[35]=r,e[36]=M,e[37]=se):se=e[37],se}const $r="oklch(0.65 0.15 160)",Gn="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 Yt(m){const e=Ie.c(5),{rule:r,matchers:c}=m,d=r?.__resolveType??"";let h;if(e[0]!==c||e[1]!==d){const S=c.find(x=>x.resolveType===d)?.iconName??ra(d);h=qa(S),e[0]=c,e[1]=d,e[2]=h}else h=e[2];const v=h;if(!v)return null;let f;return e[3]!==v?(f=n.jsx(v,{size:14,className:"shrink-0"}),e[3]=v,e[4]=f):f=e[4],f}function wn(m){return m.map(e=>`${e.label}|${e.rule?.__resolveType??""}`).join(`
|
|
2
2
|
`)}function Ut(m){return m.map((e,r)=>({id:crypto.randomUUID(),index:r,variant:e}))}function Kr(m){return m.map((e,r)=>({...e,index:r}))}function Or(m){const e=Ie.c(55),{entry:r,sortableId:c,isActive:d,canDelete:h,decofile:v,meta:f,matchers:g,onSelect:S,onRename:x,onDuplicate:D,onDelete:N}=m;let j;e[0]!==c?(j={id:c,animateLayoutChanges:Fr},e[0]=c,e[1]=j):j=e[1];const{attributes:C,listeners:o,setNodeRef:k,transform:u,isDragging:Q}=In(j);let W;e[2]!==u?(W=Hn.Transform.toString(u?{...u,y:0}:null),e[2]=u,e[3]=W):W=e[3];const O=Q?0:void 0;let l;e[4]!==W||e[5]!==O?(l={transform:W,opacity:O},e[4]=W,e[5]=O,e[6]=l):l=e[6];const T=l,ae=f??void 0;let P;e[7]!==v||e[8]!==r.variant.rule||e[9]!==ae?(P=jt(r.variant.rule,v,ae),e[7]=v,e[8]=r.variant.rule,e[9]=ae,e[10]=P):P=e[10];const de=P,A=d?Gn:"text-muted-foreground hover:bg-muted hover:text-foreground",le=Q?"cursor-grabbing":"cursor-grab";let M;e[11]!==A||e[12]!==le?(M=Re("group shrink-0 inline-flex items-center rounded-md transition-colors touch-none",A,le),e[11]=A,e[12]=le,e[13]=M):M=e[13];let se;e[14]!==de||e[15]!==g?(se=n.jsx(Yt,{rule:de,matchers:g}),e[14]=de,e[15]=g,e[16]=se):se=e[16];let oe;e[17]!==r.variant.label?(oe=n.jsx("span",{className:"truncate",children:r.variant.label}),e[17]=r.variant.label,e[18]=oe):oe=e[18];let Se;e[19]!==C||e[20]!==o||e[21]!==S||e[22]!==se||e[23]!==oe?(Se=n.jsxs("button",{type:"button",...C,...o,onClick:S,className:"inline-flex items-center gap-1.5 h-8 pl-3 pr-1.5 text-sm font-medium cursor-[inherit]",children:[se,oe]}),e[19]=C,e[20]=o,e[21]=S,e[22]=se,e[23]=oe,e[24]=Se):Se=e[24];const I=`Actions for ${r.variant.label}`,te=d&&"opacity-100";let q;e[25]!==te?(q=Re("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",te),e[25]=te,e[26]=q):q=e[26];let ie;e[27]===Symbol.for("react.memo_cache_sentinel")?(ie=n.jsx(An,{size:12}),e[27]=ie):ie=e[27];let V;e[28]!==I||e[29]!==q?(V=n.jsx(Kn,{asChild:!0,children:n.jsx("button",{type:"button","aria-label":I,onClick:Br,onPointerDown:Lr,className:q,children:ie})}),e[28]=I,e[29]=q,e[30]=V):V=e[30];let he;e[31]===Symbol.for("react.memo_cache_sentinel")?(he=n.jsx(xr,{size:14}),e[31]=he):he=e[31];let K;e[32]!==x?(K=n.jsxs(Ze,{onClick:x,children:[he,"Rename"]}),e[32]=x,e[33]=K):K=e[33];let ce;e[34]===Symbol.for("react.memo_cache_sentinel")?(ce=n.jsx(En,{size:14}),e[34]=ce):ce=e[34];let X;e[35]!==D?(X=n.jsxs(Ze,{onClick:D,children:[ce,"Duplicate"]}),e[35]=D,e[36]=X):X=e[36];let Y;e[37]===Symbol.for("react.memo_cache_sentinel")?(Y=n.jsx(lr,{}),e[37]=Y):Y=e[37];const L=!h;let B;e[38]===Symbol.for("react.memo_cache_sentinel")?(B=n.jsx($n,{size:14}),e[38]=B):B=e[38];let Z;e[39]!==N||e[40]!==L?(Z=n.jsxs(Ze,{variant:"destructive",disabled:L,onClick:N,children:[B,"Delete"]}),e[39]=N,e[40]=L,e[41]=Z):Z=e[41];let G;e[42]!==K||e[43]!==X||e[44]!==Z?(G=n.jsxs(Ln,{align:"start",className:"w-36",children:[K,X,Y,Z]}),e[42]=K,e[43]=X,e[44]=Z,e[45]=G):G=e[45];let ee;e[46]!==V||e[47]!==G?(ee=n.jsxs(On,{children:[V,G]}),e[46]=V,e[47]=G,e[48]=ee):ee=e[48];let ne;return e[49]!==k||e[50]!==T||e[51]!==Se||e[52]!==ee||e[53]!==M?(ne=n.jsxs("div",{ref:k,style:T,className:M,children:[Se,ee]}),e[49]=k,e[50]=T,e[51]=Se,e[52]=ee,e[53]=M,e[54]=ne):ne=e[54],ne}function Lr(m){return m.stopPropagation()}function Br(m){return m.stopPropagation()}function Fr(){return!1}function zr(m){const e=Ie.c(13),{variant:r,decofile:c,meta:d,matchers:h}=m,v=d??void 0;let f;e[0]!==c||e[1]!==v||e[2]!==r.rule?(f=jt(r.rule,c,v),e[0]=c,e[1]=v,e[2]=r.rule,e[3]=f):f=e[3];const g=f;let S;e[4]===Symbol.for("react.memo_cache_sentinel")?(S=Re("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",Gn),e[4]=S):S=e[4];let x;e[5]!==g||e[6]!==h?(x=n.jsx(Yt,{rule:g,matchers:h}),e[5]=g,e[6]=h,e[7]=x):x=e[7];let D;e[8]!==r.label?(D=n.jsx("span",{className:"truncate",children:r.label}),e[8]=r.label,e[9]=D):D=e[9];let N;return e[10]!==x||e[11]!==D?(N=n.jsxs("div",{className:S,children:[x,D]}),e[10]=x,e[11]=D,e[12]=N):N=e[12],N}function Ir(m){const e=Ie.c(78),{listKey:r,variants:c,activeIndex:d,decofile:h,meta:v,matchers:f,onSelect:g,onReorder:S,onRename:x,onDuplicate:D,onDelete:N,onAdd:j}=m;let C;e[0]!==c?(C=()=>Ut(c),e[0]=c,e[1]=C):C=e[1];const[o,k]=w.useState(C),[u,Q]=w.useState(null),[W,O]=w.useState(r),[l,T]=w.useState(c.length);let ae;e[2]!==c?(ae=()=>wn(c),e[2]=c,e[3]=ae):ae=e[3];const[P,de]=w.useState(ae),A=w.useRef(!1),le=wn(c);W!==r?(O(r),T(c.length),de(le),k(Ut(c))):l!==c.length?(T(c.length),de(le),k(Ut(c))):P!==le&&(de(le),k($e=>c.map((z,_)=>({id:$e[_]?.id??crypto.randomUUID(),index:_,variant:z}))));let M;e[4]===Symbol.for("react.memo_cache_sentinel")?(M={activationConstraint:{distance:8}},e[4]=M):M=e[4];let se;e[5]===Symbol.for("react.memo_cache_sentinel")?(se={coordinateGetter:Un},e[5]=se):se=e[5];const oe=Bn(_t(zn,M),_t(Fn,se));let Se;e[6]!==o?(Se=o.map(Hr),e[6]=o,e[7]=Se):Se=e[7];const I=Se,te=c.length>1;let q;e[8]!==o?(q=$e=>{const z=String($e.active.id);Q(o.find(_=>_.id===z)??null)},e[8]=o,e[9]=q):q=e[9];const ie=q;let V;e[10]!==I||e[11]!==S?(V=$e=>{Q(null);const{active:z,over:_}=$e;if(!_||z.id===_.id)return;const H=I.indexOf(String(z.id)),Le=I.indexOf(String(_.id));H===-1||Le===-1||(k(Be=>Kr(mt([...Be],H,Le))),A.current=!0,requestAnimationFrame(()=>{A.current=!1}),S(H,Le))},e[10]=I,e[11]=S,e[12]=V):V=e[12];const he=V;let K;e[13]===Symbol.for("react.memo_cache_sentinel")?(K=()=>{Q(null)},e[13]=K):K=e[13];const ce=K;let X,Y,L,B,Z,G,ee,ne,me,F,E,De;if(e[14]!==u||e[15]!==d||e[16]!==te||e[17]!==h||e[18]!==o||e[19]!==I||e[20]!==he||e[21]!==ie||e[22]!==f||e[23]!==v||e[24]!==N||e[25]!==D||e[26]!==x||e[27]!==g||e[28]!==oe){const $e=_=>{A.current||g(_)};E="flex items-center border-b shrink-0";const z=u&&"cursor-grabbing";e[41]!==z?(F=Re("flex flex-1 min-w-0 items-center gap-1.5 pl-3 pr-2 py-2 overflow-x-auto",z),e[41]=z,e[42]=F):F=e[42],Y=Wn,Z=oe,G=qn,ee=ie,ne=he,me=ce,X=Yn,De=I,L=ur,B=o.map(_=>n.jsx(Or,{sortableId:_.id,entry:_,isActive:_.index===d,canDelete:te,decofile:h,meta:v,matchers:f,onSelect:()=>$e(_.index),onRename:()=>x(_.index),onDuplicate:()=>D(_.index),onDelete:()=>N(_.index)},_.id)),e[14]=u,e[15]=d,e[16]=te,e[17]=h,e[18]=o,e[19]=I,e[20]=he,e[21]=ie,e[22]=f,e[23]=v,e[24]=N,e[25]=D,e[26]=x,e[27]=g,e[28]=oe,e[29]=X,e[30]=Y,e[31]=L,e[32]=B,e[33]=Z,e[34]=G,e[35]=ee,e[36]=ne,e[37]=me,e[38]=F,e[39]=E,e[40]=De}else X=e[29],Y=e[30],L=e[31],B=e[32],Z=e[33],G=e[34],ee=e[35],ne=e[36],me=e[37],F=e[38],E=e[39],De=e[40];let _e;e[43]!==X||e[44]!==L||e[45]!==B||e[46]!==De?(_e=n.jsx(X,{items:De,strategy:L,children:B}),e[43]=X,e[44]=L,e[45]=B,e[46]=De,e[47]=_e):_e=e[47];let Me;e[48]!==u||e[49]!==h||e[50]!==f||e[51]!==v?(Me=u?n.jsx(zr,{variant:u.variant,decofile:h,meta:v,matchers:f}):null,e[48]=u,e[49]=h,e[50]=f,e[51]=v,e[52]=Me):Me=e[52];let ke;e[53]!==Me?(ke=n.jsx(Jn,{dropAnimation:null,children:Me}),e[53]=Me,e[54]=ke):ke=e[54];let Te;e[55]!==Y||e[56]!==Z||e[57]!==G||e[58]!==ee||e[59]!==ne||e[60]!==me||e[61]!==_e||e[62]!==ke?(Te=n.jsxs(Y,{sensors:Z,collisionDetection:G,onDragStart:ee,onDragEnd:ne,onDragCancel:me,children:[_e,ke]}),e[55]=Y,e[56]=Z,e[57]=G,e[58]=ee,e[59]=ne,e[60]=me,e[61]=_e,e[62]=ke,e[63]=Te):Te=e[63];let Ce;e[64]!==F||e[65]!==Te?(Ce=n.jsx("div",{className:F,children:Te}),e[64]=F,e[65]=Te,e[66]=Ce):Ce=e[66];let Ke;e[67]===Symbol.for("react.memo_cache_sentinel")?(Ke={color:$r},e[67]=Ke):Ke=e[67];let we;e[68]===Symbol.for("react.memo_cache_sentinel")?(we=n.jsx(qt,{size:14}),e[68]=we):we=e[68];let Ee;e[69]!==j?(Ee=n.jsx(at,{asChild:!0,children:n.jsx(Ue,{type:"button",variant:"ghost",size:"icon","aria-label":"Add variant",className:"size-8 shrink-0 cursor-pointer",style:Ke,onClick:j,children:we})}),e[69]=j,e[70]=Ee):Ee=e[70];let Oe;e[71]===Symbol.for("react.memo_cache_sentinel")?(Oe=n.jsx(rt,{side:"bottom",children:"Add variant"}),e[71]=Oe):Oe=e[71];let re;e[72]!==Ee?(re=n.jsx("div",{className:"shrink-0 pr-3 pl-1 py-2",children:n.jsxs(st,{children:[Ee,Oe]})}),e[72]=Ee,e[73]=re):re=e[73];let ue;return e[74]!==E||e[75]!==Ce||e[76]!==re?(ue=n.jsxs("div",{className:E,children:[Ce,re]}),e[74]=E,e[75]=Ce,e[76]=re,e[77]=ue):ue=e[77],ue}function Hr(m){return m.id}function Nn(m){const e=Ie.c(15),{schema:r,value:c,onChange:d,meta:h,decofile:v,onSaveReferencedBlock:f,sandbox:g}=m;let S;e[0]===Symbol.for("react.memo_cache_sentinel")?(S=[],e[0]=S):S=e[0];const[x,D]=w.useState(S);let N;e[1]!==x?(N=x.length>0&&n.jsxs("nav",{"aria-label":"Variant rule breadcrumb",className:"flex min-w-0 items-center gap-1 overflow-hidden text-xs",children:[n.jsx("button",{type:"button",onClick:()=>D([]),className:"flex shrink-0 items-center gap-0.5 rounded-md px-1 py-0.5 text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground",title:"Back to rule",children:n.jsx(Ua,{className:"size-3.5"})}),x.map((o,k)=>{const u=k===x.length-1;return n.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[k>0&&n.jsx(Vn,{className:"size-3 shrink-0 text-muted-foreground/60"}),n.jsx("button",{type:"button",onClick:()=>D(x.slice(0,k+1)),title:o,className:Re("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",u?"font-medium text-foreground":"text-muted-foreground"),children:o})]},`${o}-${k}`)})]}),e[1]=x,e[2]=N):N=e[2];let j;e[3]!==x||e[4]!==v||e[5]!==h||e[6]!==d||e[7]!==f||e[8]!==g||e[9]!==r||e[10]!==c?(j=n.jsx(Pn,{schema:r,value:c,onChange:d,basePath:"",breadcrumbPath:x,onBreadcrumbChange:D,meta:h,decofile:v,onSaveReferencedBlock:f,sandbox:g}),e[3]=x,e[4]=v,e[5]=h,e[6]=d,e[7]=f,e[8]=g,e[9]=r,e[10]=c,e[11]=j):j=e[11];let C;return e[12]!==N||e[13]!==j?(C=n.jsxs("div",{className:"space-y-2",children:[N,j]}),e[12]=N,e[13]=j,e[14]=C):C=e[14],C}function Rn(m){const e=Ie.c(21),{activeSchema:r,formValue:c,formResetKey:d,onFormChange:h,onBreadcrumbChange:v,breadcrumbPath:f,emptyMessage:g,beforeForm:S,seoResolveType:x,siteDefaultSeo:D,meta:N,decofile:j,onSaveReferencedBlock:C,sandbox:o}=m;let k;e[0]!==f?(k=f===void 0?[]:f,e[0]=f,e[1]=k):k=e[1];const u=k;let Q;e[2]!==r||e[3]!==u||e[4]!==j||e[5]!==d||e[6]!==c||e[7]!==N||e[8]!==v||e[9]!==h||e[10]!==C||e[11]!==o||e[12]!==x||e[13]!==D?(Q=r&&c?x?n.jsx(Sr,{schema:r,resolveType:x,value:c,formResetKey:d,onChange:h,onBreadcrumbChange:v,siteDefaultSeo:D}):n.jsx(Pn,{schema:r,value:c,onChange:h,basePath:"",breadcrumbPath:u,onBreadcrumbChange:v,meta:N,decofile:j,onSaveReferencedBlock:C,sandbox:o},d):null,e[2]=r,e[3]=u,e[4]=j,e[5]=d,e[6]=c,e[7]=N,e[8]=v,e[9]=h,e[10]=C,e[11]=o,e[12]=x,e[13]=D,e[14]=Q):Q=e[14];const W=Q;let O;e[15]!==g||e[16]!==W?(O=W??n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:g}),e[15]=g,e[16]=W,e[17]=O):O=e[17];let l;return e[18]!==S||e[19]!==O?(l=n.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:n.jsxs("div",{className:"mx-auto max-w-2xl",children:[S,O]})}),e[18]=S,e[19]=O,e[20]=l):l=e[20],l}const Ur="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 Wr(m,e){return ba(m,e,nt)}function qr(m){const e=Ie.c(13),{pageKey:r,initialName:c,initialPath:d,onFieldChange:h}=m,[v,f]=w.useState(c),[g,S]=w.useState(d),[x,D]=w.useState(r);x!==r&&(D(r),f(c),S(d));let N;e[0]!==h?(N=u=>{f(u.target.value),h("name",u.target.value)},e[0]=h,e[1]=N):N=e[1];let j;e[2]!==v||e[3]!==N?(j=n.jsx("input",{type:"text",value:v,onChange:N,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]=N,e[4]=j):j=e[4];let C;e[5]!==h?(C=u=>{S(u.target.value),h("path",u.target.value)},e[5]=h,e[6]=C):C=e[6];let o;e[7]!==g||e[8]!==C?(o=n.jsx("input",{type:"text",value:g,onChange:C,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]=g,e[8]=C,e[9]=o):o=e[9];let k;return e[10]!==j||e[11]!==o?(k=n.jsxs("div",{className:"space-y-1",children:[j,o]}),e[10]=j,e[11]=o,e[12]=k):k=e[12],k}function Cn(m){const e=Ie.c(6),{onClick:r}=m;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(Mn,{size:14}),e[0]=c):c=e[0];let d;e[1]!==r?(d=n.jsx(at,{asChild:!0,children:n.jsx(Ue,{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]=d):d=e[2];let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(rt,{side:"bottom",children:"Add variant"}),e[3]=h):h=e[3];let v;return e[4]!==d?(v=n.jsxs(st,{children:[d,h]}),e[4]=d,e[5]=v):v=e[5],v}function Cl({orgSlug:m,virtualMcpId:e,branch:r,previewReady:c=!0,previewUrl:d,currentPath:h,activePageBlockKey:v=null,activeGlobalBlockKey:f=null,externalSelectedIndex:g,onSaved:S,initialEditSeo:x=!1,onExitSeo:D,onViewJsonFile:N,onVariantPreviewOverride:j}){const C=c?{orgSlug:m,virtualMcpId:e,branch:r,previewUrl:d}:null,{data:o,isLoading:k}=oa(C),{data:u,isLoading:Q}=ia(C),W=la(),O=W?.entity?.id===e?W.entity.metadata?.siteSlug??null:null,[l,T]=w.useState(null),[ae,P]=w.useState(null),[de,A]=w.useState(null),[le,M]=w.useState(0),[se,oe]=w.useState(void 0),[Se,I]=w.useState(null),[te,q]=w.useState(null),[ie,V]=w.useState([]),[he,K]=w.useState(0),[ce,X]=w.useState(null),[Y,L]=w.useState(null),[B,Z]=w.useState(!0),[G,ee]=w.useState(!1),[ne,me]=w.useState(!1),[F,E]=w.useState(x),[De,_e]=w.useState(x);x&&!De&&(_e(!0),E(!0),T(null),P(null),A(null),V([])),!x&&De&&_e(!1);const[Me,ke]=w.useState(null),[Te,Ce]=w.useState(void 0),[Ke,we]=w.useState([]),[Ee,Oe]=w.useState(0),[re,ue]=w.useState(0),[$e,z]=w.useState(null),[_,H]=w.useState(null),[Le,Be]=w.useState(null),We=Qs(),es=`${m}/${e}/${r}`,kt=ca({orgSlug:m,virtualMcpId:e,branch:r}),[ts,ns]=w.useState(h),[ss,as]=w.useState(v),[rs,os]=w.useState(f);(ts!==h||ss!==v||rs!==f)&&(queueMicrotask(()=>kt.flush()),ns(h),as(v),os(f),T(null),P(null),A(null),M(0),I(null),q(null),ue(0),z(null),H(null),V([]),K(t=>t+1),E(!1),ke(null),Ce(void 0),we([]),Oe(t=>t+1));const Pe=ua({orgSlug:m,virtualMcpId:e,branch:r}),ft=Ta((t,s)=>{Pe.mutate({blockKey:t,data:s},{onSuccess:()=>S?.(),onError:a=>pe.error(`Save failed: ${a.message}`)})}),Jt=da({orgSlug:m,virtualMcpId:e,branch:r}),[wt,Qt]=w.useState(!1),Nt=w.useRef(null),ot=w.useRef(null),it=w.useRef(null),Rt=w.useRef({}),qe=w.useRef({rawSections:[],parsedSections:[],decofile:{},activePageKey:null,pageVariants:[],variantIndex:0,sectionVariantIndex:0,selectedSectionIndex:null});if(!c||k||Q)return n.jsx("div",{className:"h-full w-full flex items-center justify-center",children:n.jsx(Dn,{size:20,className:"animate-spin text-muted-foreground"})});if(!o||!u)return n.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:"Could not load site data."});const is=ma(o),ve=!!f,Fe=ve?null:fa(is,h,v),b=ve?f:Fe?.key??null,Ct=ve&&f?o[f]:void 0,Xt=ve&&f&&Ct?pa(f,Ct):ve&&f?f:"",pt=!ve&&b&&o[b]?o[b]:null,Dt=F&&o&&u&&b&&Fe?_n(o,{kind:"page",pageKey:b,pageName:String(Fe.name??""),path:String(Fe.path??"")},u):null,ls=F?pt?.seo:void 0,Tt=Te!==void 0?Te:ls,cs=F?dr(Tt):void 0,us=Dt?.seoTypeOptions??[],ds=F&&u?mr(u):"",Zt=Me??cs??{},Pt=F&&Dt?fr(Zt,Dt):null,ms=F&&Pt&&pr(Tt)?xt(Pt,u):null,fs=F?hr(o,u)?.seoData:void 0,Ve=ve?[{label:"Default",sections:[{__resolveType:f}]}]:Wr(pt?.sections,o??{}),ht=Ve.length>1,je=Math.min(le,Ve.length-1),Ge=Ve[je],U=Ge?.sections??[],Ne=bt(U,o),Gt=!ve&&ha(pt?.sections);if(ve&&f&&Le!==f){Be(f);const t=U[0],s=Ne[0];if(t&&s){T(0),ue(0),V([]);const a=tt(t,s,o);a&&(P(a.data),A(a.resolveType),H(null),z(null))}}!ve&&Le!==null&&Be(null),qe.current={rawSections:U,parsedSections:Ne,decofile:o??{},activePageKey:b,pageVariants:Ve,variantIndex:je,sectionVariantIndex:re,selectedSectionIndex:l};const ps=()=>({multivariate:Gt,index:je,variants:Ve.map(t=>({rule:t.rule}))}),en=(t,s)=>{if(!j)return;if(!b||!Gt||t.length<=1){j(null);return}const a=yn(b,{multivariate:!0,index:s,variants:t},o,u);j(a.length>0?a:null)},lt=(t,s,a)=>{if(!j)return;if(!b){j(null);return}const i=ps(),p=yn(b,i,o,u);if(!t||s<0){j(p.length>0?p:null);return}const R=Oa({pageKey:b,page:i,sectionIndex:s,sectionLazy:Ne[s]?.isLazy??!1,mvObj:t,selectedVariantIndex:a,decofile:o,meta:u}),y=[...p,...R];j(y.length>0?y:null)},Ye=(t,s,a,i=l??-1,p=!1)=>{const R=Xe(t,s);if(!R){P(null),A(null),H(null),z(null),p&<(null,i,a);return}const $=gn(R,nt)[a];if(!$){P(null),A(null),H(null),z(null),p&<(null,i,a);return}const ge=ya($.value,o);P(ge?.data??null),A(ge?.resolveType??null);const{resolveType:J,formValue:fe}=Bt($.rule,o,u??void 0);H(J),z(fe),p&<(R,i,a)};if(g!==void 0&&g!==se&&(oe(g??null),typeof g=="number")){const t=U[g],s=Ne[g];if(t&&s)if(T(g),ue(0),V([]),K(a=>a+1),s.isMultivariate)Ye(t,s,0,g);else{const a=tt(t,s,o);a?(P(a.data),A(a.resolveType)):(P(null),A(null)),H(null),z(null)}}const gt={orgSlug:m,virtualMcpId:e,branch:r,previewUrl:d??void 0,siteSlug:O},Vt=de&&u?xt(de,u):null,ze=(t,s)=>{if(!b)return;const a=zt(o,b,t,je,Ve);Pe.mutate({blockKey:b,data:a},{onSuccess:()=>s?.onSuccess?.()??S?.(),onError:i=>pe.error(`Save failed: ${i.message}`)})},ct=()=>{T(null),P(null),A(null),ue(0),z(null),H(null),V([]),K(t=>t+1)},hs=(t,s)=>{Nt.current&&clearTimeout(Nt.current);const a=qe.current.sectionVariantIndex;Nt.current=setTimeout(()=>{const{rawSections:i,parsedSections:p,decofile:R,activePageKey:y,pageVariants:$,variantIndex:ge}=qe.current,J=i[s];if(!J)return;const fe=p[s];if(!fe)return;if(fe.isSavedBlock){const be=fe.isLazy?J.section?.__resolveType??J.__resolveType:J.__resolveType;Pe.mutate({blockKey:be,data:t},{onSuccess:()=>S?.(),onError:ye=>pe.error(`Save failed: ${ye.message}`)});return}if(!y)return;const xe={...R[y]},Ae=[...i];if(fe.isMultivariate){const be=Xe(J,fe);if(!be||!y)return;const ye=Fa(be,a,t);Ae[s]=dt(J,fe,ye)}else if(fe.isHidden){const be=Tn(J.__resolveType),ye=be?{...J.section}:{...J},He=Array.isArray(ye.variants)?[...ye.variants]:[];He[0]&&(He[0]={...He[0],value:t}),ye.variants=He,be?Ae[s]={...J,section:ye}:Ae[s]=ye}else fe.isLazy?Ae[s]={...J,section:t}:Ae[s]=t;if($.length>1){const be=xe.sections,ye=[...be?.variants??[]];ye[ge]&&(ye[ge]={...ye[ge],value:Ae}),xe.sections={...be,variants:ye}}else xe.sections=Ae;Pe.mutate({blockKey:y,data:xe},{onSuccess:()=>S?.(),onError:be=>pe.error(`Save failed: ${be.message}`)})},Ht)},gs=t=>{T(t),ue(0),V([]),K(p=>p+1);const s=U[t],a=Ne[t];if(!s||!a)return;if(a.isMultivariate){Ye(s,a,0,t);return}const i=tt(s,a,o);if(!i){P(null),A(null),H(null),z(null),lt(null,t,0);return}P(i.data),A(i.resolveType),H(null),z(null),lt(null,t,0)},tn=t=>{const s=t;P(s),l!==null&&hs(s,l)},At=t=>{if(!b||!o||!u||!Fe)return;const s={kind:"page",pageKey:b,pageName:String(Fe.name??""),path:String(Fe.path??"")},a=_n(o,s,u);a&&kt.save(b,()=>{const i=We.getQueryData(Xs.decofile(es))?.[b];if(!i||typeof i!="object"||i===null||Array.isArray(i))return null;const p={...i,...Rt.current};return Rt.current={},t?.raw!==void 0?{...p,seo:t.raw}:t?.inner!==void 0?vr(s,a,p,t.inner):p})},vs=(t,s)=>{b&&(Rt.current[t]=s,At())},Ss=(t,s)=>{if(!b)return;const a=mt([...U],t,s);l!==null&&(l===t?T(s):t<l&&s>=l?T(l-1):t>l&&s<=l&&T(l+1)),ze(a)},xs=t=>{if(!b)return;const s=U.filter((a,i)=>i!==t);l===t?ct():l!==null&&l>t&&T(l-1),ze(s)},bs=t=>{if(!b)return;const s=U[t];if(!s)return;const a=[...U];a.splice(t+1,0,Ma(s)),l!==null&&l>t&&T(l+1),ze(a)},ys=t=>{if(!b)return;const s=U[t],a=Ne[t];if(!s||!a||a.isMultivariate)return;const i=a.isHidden?Va(s):Aa(s);if(!i)return;const p=[...U];p[t]=i,l===t&&ct(),ze(p)},js=t=>{if(!b)return;const s=U[t],a=Ne[t];if(!s||!a||a.isMultivariate)return;const i=Pa(s);if(!i)return;const p=[...U];p[t]=i,l===t&&ct(),ze(p)},_s=t=>{if(!b)return;const s=U[t],a=Ne[t];if(!s||!a?.isSavedBlock)return;const i=tt(s,a,o);if(!i?.data)return;const{name:p,...R}=i.data,y=[...U];a.isLazy?y[t]={...s,section:R}:y[t]=R,l===t&&ct(),ze(y)},ks=t=>{if(!b)return;const s=[...U,{__resolveType:t.resolveType}],a=s.length-1;ze(s,{onSuccess:()=>{ee(!1),T(a),ue(0),V([]),K(y=>y+1);const i=s[a],p=bt(s,o)[a];if(!i||!p)return;if(p.isMultivariate){Ye(i,p,0);return}const R=tt(i,p,o);if(!R){P(null),A(null),H(null),z(null);return}P(R.data),A(R.resolveType),H(null),z(null)}})},ws=t=>{if(l===null)return;const s=U[l],a=Ne[l];!s||!a?.isMultivariate||(ue(t),V([]),K(i=>i+1),Ye(s,a,t,l,!0))},Ns=t=>{if(l===null||!b)return;const s=U[l],a=Ne[l];if(!s||!a?.isMultivariate)return;const i=Xe(s,a);if(!i)return;const p=Ca(i,t);if(!p){pe.error("Cannot delete the only variant.");return}const R=[...U];R[l]=dt(s,a,p);const y=p.variants;let $=re;t===re?$=Math.min(t,y.length-1):t<re&&($=re-1),ue($),V([]),K(ge=>ge+1),Ye(R[l],a,$),ze(R)},Rs=t=>{if(l===null||!b)return;const s=U[l],a=Ne[l];if(!s||!a?.isMultivariate)return;const i=Xe(s,a);if(!i)return;const p=Da(i,t),R=[...U];R[l]=dt(s,a,p);const y=t+1;ue(y),V([]),K($=>$+1),Ye(R[l],a,y),ze(R)},Cs=(t,s)=>{if(l===null||!b||t===s)return;const a=U[l],i=Ne[l];if(!a||!i?.isMultivariate)return;const p=Xe(a,i);if(!p)return;const R=Na(p,t,s),y=[...U];y[l]=dt(a,i,R);let $=re;re===t?$=s:t<re&&s>=re?$=re-1:t>re&&s<=re&&($=re+1),ue($),Ye(y[l],i,$),ze(y)},Mt=t=>{const s=t??l;if(s===null||!b)return;const a=U[s],i=Ne[s];if(!a||!i)return;const p=ja(a,i);if(!p){pe.error("This section cannot have variants.");return}const R=[...U];R[s]=p.section;const y=bt(R,o)[s];if(!y?.isMultivariate){pe.error("Could not add variant.");return}T(s),ue(p.newVariantIndex),V([]),K($=>$+1),Ye(p.section,y,p.newVariantIndex,s),ze(R)},Ds=()=>{if(l===null||!b)return;const t=U[l],s=Ne[l];if(!t||!s?.isMultivariate)return;const a=Xe(t,s);if(!a)return;const i=Ra(t,s,a);if(!i){pe.error("Could not remove variants.");return}const p=[...U];p[l]=i;const R=bt(p,o)[l];if(!R)return;ue(0),H(null),z(null),V([]),K($=>$+1);const y=tt(i,R,o);y?(P(y.data),A(y.resolveType)):(P(null),A(null)),lt(null,l,0),ze(p)},Ts=async t=>{if(ce===null||!b)return;const s=bn(t,o);if(s){pe.error(s);return}const a=U[ce],i=Ne[ce];if(!a||!i)return;const p=tt(a,i,o);if(!p){pe.error("This section cannot be saved as global.");return}const R={...p.data,name:t};try{await Pe.mutateAsync({blockKey:t,data:R});const y=[...U];y[ce]={__resolveType:t},await Pe.mutateAsync({blockKey:b,data:zt(o,b,y,je,Ve)}),l===ce&&ct(),X(null),pe.success(`Saved global block "${t}"`),S?.()}catch(y){pe.error(y instanceof Error?y.message:"Failed to save global block")}},nn=Ge?.rule;if(ht&&l===null&&te===null&&nn){const{resolveType:t,formValue:s}=Bt(nn,o??{},u??void 0);q(t),I(s)}const vt=u?ga(u):[],Ps=!ve&&!!(d&&u&&o),sn=te&&u?xt(te,u):null,Vs=()=>{ot.current&&(clearTimeout(ot.current),ot.current=null),it.current&&(clearTimeout(it.current),it.current=null)},an=async(t,s)=>{if(!(za(s,t,u)>0))try{await Jt.mutateAsync({blockKey:t})}catch(a){pe.error(a instanceof Error?a.message:"Could not delete matcher block")}},rn=t=>{ot.current&&clearTimeout(ot.current),ot.current=setTimeout(()=>{const{activePageKey:s,decofile:a,variantIndex:i}=qe.current;if(!s)return;const p={...a[s]},R={...p.sections},y=[...R.variants??[]],$=y[i],ge=$?.rule;if(Ft(ge,a,u)){const J=ge?.__resolveType??"",fe=a[J],xe=typeof fe?.name=="string"?fe.name:J,{__resolveType:Ae,...be}=t;Pe.mutate({blockKey:J,data:It(Ae??"",be,xe)},{onSuccess:()=>S?.(),onError:ye=>pe.error(`Save failed: ${ye.message}`)});return}$&&(y[i]={...$,rule:t}),p.sections={...R,variants:y},Pe.mutate({blockKey:s,data:p},{onSuccess:()=>S?.(),onError:J=>pe.error(`Save failed: ${J.message}`)})},Ht)},As=t=>{q(t);const s=t?{__resolveType:t}:{__resolveType:jn};I({}),rn(s)},Ms=t=>{const s=t;I(s);const a=te?{__resolveType:te,...s}:{...s};rn(a)},on=t=>{it.current&&clearTimeout(it.current);const{selectedSectionIndex:s,sectionVariantIndex:a}=qe.current;s!==null&&(it.current=setTimeout(()=>{const{rawSections:i,parsedSections:p,decofile:R,activePageKey:y,pageVariants:$,variantIndex:ge}=qe.current;if(!y)return;const J=i[s],fe=p[s];if(!J||!fe?.isMultivariate)return;const xe=Xe(J,fe);if(!xe)return;const Ae=Ba(xe,a,t),be=[...i];be[s]=dt(J,fe,Ae);const ye=zt(R,y,be,ge,$);Pe.mutate({blockKey:y,data:ye},{onSuccess:()=>S?.(),onError:He=>pe.error(`Save failed: ${He.message}`)})},Ht))},Es=t=>{H(t),z({}),on(t?{__resolveType:t}:{__resolveType:jn})},$s=t=>{const s=t;z(s);const a=_?{__resolveType:_,...s}:{...s};on(a)};if(!ve&&!Fe)return n.jsxs("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:["No page found for ",h]});if(ve&&!Ct)return n.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:"Global block not found"});const Je=l!==null?Ne[l]??null:null,ln=l!==null?U[l]:null,cn=ln&&Je?.isMultivariate?Xe(ln,Je):null,St=cn?gn(cn,nt):[],Et=Math.min(re,Math.max(St.length-1,0)),$t=St[Et]??null,et=Je?.isMultivariate===!0,un=l!==null&&Je!==null,ut=un&&(et||!!(Vt&&ae)),Ks=ut&&!ve&&Je?.isSavedBlock===!0,Qe=ve||Ks,Os=ve?Xt:Je?.label??"",dn=_&&u?xt(_,u):null,Kt=ut&&(!ve||ie.length>0)?ve?[Xt,...ie]:[Fe.name,Je.label,...et&&$t?[$t.label]:[],...ie]:[],Ls=F&&Fe?[Fe.name,"SEO",...Ke]:[],mn=F?Ls:Qe?Kt.length>0?Kt:[Os]:Kt,fn=()=>{if(!b)return;const t=o[b],s=_a(t.sections,U);if(!s)return;const a=ka(s);Pe.mutate({blockKey:b,data:{...t,sections:s}},{onSuccess:()=>{M(a),T(null),P(null),A(null),V([]),I(null),q(null)},onError:i=>pe.error(`Save failed: ${i.message}`)})},Ot=(t,s,a)=>{if(!b)return;const i=o[b],p=i.sections;if(!p||typeof p!="object"||Array.isArray(p))return;const R=p;if(!Array.isArray(R.variants))return;const y=t([...R.variants]);if(!y)return;const $=La(R,y),ge={...o,[b]:{...i,sections:$}};Pe.mutate({blockKey:b,data:ge[b]},{onSuccess:()=>{s?.(),a&&an(a,ge)},onError:J=>pe.error(`Save failed: ${J.message}`)})},Bs=t=>{L(null),M(t),T(null),P(null),A(null),V([]);const s=Ve[t]?.rule,{resolveType:a,formValue:i}=Bt(s,o??{},u??void 0);q(a),I(i),en(Ve.map(p=>({rule:p.rule})),t)},Fs=(t,s)=>{if(t===s)return;let a=je;je===t?a=s:t<je&&s>=je?a=je-1:t>je&&s<=je&&(a=je+1),M(a);const i=mt(Ve.map(p=>({rule:p.rule})),t,s);en(i,a),Ot(p=>mt(p,t,s))},zs=t=>{const s=Ve[t]?.rule,a=wa(s,o??{},u??void 0);Ot(i=>i.length<=1?null:(i.splice(t,1),i),()=>{Ve.length-1===1?M(0):t<je?M(je-1):t===je&&M(Math.max(0,t-1)),T(null),P(null),A(null),V([]),I(null),q(null)},a)},Is=t=>{Ot(s=>Ia(s,t),()=>{M(t+1),T(null),P(null),A(null),V([]),I(null),q(null)})},Hs=async(t,s)=>{Vs();const a=qe.current.activePageKey,i=qe.current.decofile;if(!a)return;const p=i[a],R=p.sections;if(!R||typeof R!="object"||Array.isArray(R))return;const y=R;if(!Array.isArray(y.variants))return;const $=[...y.variants],ge=$[t];if(!ge?.rule||typeof ge.rule!="object"){pe.error("This variant has no matcher rule to rename.");return}const J=ge.rule,fe=s.trim();Qt(!0);try{if(!fe){if(!Ft(J,i,u)){L(null);return}const Lt=J.__resolveType??"";$[t]={...ge,rule:Ea(J,i,u)};const hn={...i,[a]:{...p,sections:{...y,variants:$}}};await Pe.mutateAsync({blockKey:a,data:hn[a]}),await an(Lt,hn),L(null),S?.();return}const xe=$a(J,i,u);if(!xe){pe.error("Could not read this variant's matcher rule.");return}if(xe.blockKey){await Pe.mutateAsync({blockKey:xe.blockKey,data:It(xe.resolveType,xe.data,fe)}),L(null),S?.();return}const Ae=xn(fe),be=bn(Ae,i);if(be){pe.error(be);return}const ye=It(xe.resolveType,xe.data,fe);let He=null;try{await Pe.mutateAsync({blockKey:Ae,data:ye}),He=Ae,$[t]={...ge,rule:Ka(Ae)},await Pe.mutateAsync({blockKey:a,data:{...p,sections:{...y,variants:$}}}),He=null}catch(Lt){throw He&&await Jt.mutateAsync({blockKey:He}).catch(()=>{}),Lt}L(null),pe.success(`Saved matcher as global block "${fe}"`),S?.()}catch(xe){pe.error(xe instanceof Error?xe.message:"Failed to rename variant")}finally{Qt(!1)}},pn=()=>{ct()},Us=t=>{ke(t),At({inner:t})},Ws=t=>{Ce(t),At({raw:t})},qs=()=>{ke(null),we([])},Ys=()=>Oe(t=>t+1),Js=t=>{if(F){if(t===0){kt.flush(),E(!1),ke(null),Ce(void 0),we([]),Oe(a=>a+1),D?.();return}if(t===1){we([]),Oe(a=>a+1);return}we(Ke.slice(0,t-1)),Oe(a=>a+1);return}if(ve){V(ie.slice(0,t)),K(a=>a+1);return}if(t===0){pn();return}if(t===1){V([]),K(a=>a+1);return}if(et&&t===2){V([]),K(a=>a+1);return}const s=et?2:1;V(ie.slice(0,t-s))};return n.jsxs("div",{className:"flex h-full min-w-0 w-full flex-col",children:[n.jsx("div",{className:"shrink-0",children:Qe||ut||F?n.jsxs("div",{className:Re("border-b px-3 py-2.5",Qe&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[!ve&&ht&&Ge&&n.jsxs("button",{type:"button",onClick:pn,title:`Editing in variant: ${Ge.label}`,className:Re("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",Ur),children:[n.jsx(Yt,{rule:jt(Ge.rule,o??{},u??void 0),matchers:vt}),n.jsx("span",{className:"max-w-[160px] truncate",children:Ge.label})]}),n.jsx("nav",{"aria-label":"Editing breadcrumb",className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:mn.map((t,s)=>{const a=s===mn.length-1;return n.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[s>0&&n.jsx(Vn,{className:"size-3 shrink-0 text-muted-foreground/60"}),n.jsx("button",{type:"button",onClick:()=>Js(s),title:t,className:Re("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors",a?Qe?"font-semibold text-global-section-fg dark:text-global-section-fg-dark":"font-medium text-foreground":Qe?"text-foreground/80":"text-muted-foreground",Qe?"hover:bg-global-section/15":"hover:bg-accent hover:text-accent-foreground"),children:t})]},`${t}-${s}`)})}),Qe&&n.jsxs(st,{children:[n.jsx(at,{asChild:!0,children:n.jsx("span",{className:"shrink-0 cursor-help",children:n.jsx(Qa,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),n.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."})]}),un&&!et&&!Je?.isHidden&&b&&n.jsx(Cn,{onClick:()=>Mt()})]}),Qe&&n.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."})]}):n.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2.5",children:[n.jsx("div",{className:"flex-1 min-w-0",children:n.jsx(qr,{pageKey:b,initialName:Fe.name,initialPath:Fe.path,onFieldChange:vs})}),n.jsxs(st,{children:[n.jsx(at,{asChild:!0,children:n.jsx(Ue,{type:"button",variant:"ghost",size:"icon","aria-label":"Edit SEO",className:"size-7 shrink-0",onClick:()=>E(!0),children:n.jsx(Ya,{size:14})})}),n.jsx(rt,{side:"bottom",children:"Edit SEO"})]}),n.jsxs(st,{children:[n.jsx(at,{asChild:!0,children:n.jsx(Ue,{type:"button",variant:"ghost",size:"icon","aria-label":"View JSON",className:"size-7 shrink-0",onClick:()=>N&&b?N(b):me(!0),children:n.jsx(Ja,{size:14})})}),n.jsx(rt,{side:"bottom",children:"View JSON"})]}),n.jsx(Cn,{onClick:fn})]})}),ht&&!ut&&!F&&b&&n.jsx(Ir,{listKey:b,variants:Ve,activeIndex:je,decofile:o??{},meta:u,matchers:vt,onSelect:Bs,onReorder:Fs,onRename:L,onDuplicate:Is,onDelete:zs,onAdd:fn}),F?n.jsx(yt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:n.jsx("div",{className:"mx-auto max-w-2xl",children:pt&&b?n.jsx(gr,{rawSeo:Tt,innerSeo:Zt,defaultResolveType:ds,seoSchema:ms,activeResolveType:Pt,seoTypeOptions:us,formResetKey:Ee,siteDefaultSeo:fs,onBreadcrumbChange:we,onPersistRaw:Ws,onInnerChange:Us,onClearForm:qs,onBumpFormKey:Ys}):n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"SEO schema not found for this site."})})})}):ut?n.jsxs(yt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[et&&St.length>0&&n.jsxs(n.Fragment,{children:[n.jsx(va,{listKey:`${b??""}:${l??""}`,variants:St.map((t,s)=>({index:s,label:t.label})),selectedIndex:Et,onSelect:ws,onDuplicate:Rs,onDelete:Ns,onRemoveAll:Ds,onReorder:Cs,onAdd:()=>Mt()}),et&&n.jsxs("div",{className:"px-3 py-3 border-b space-y-2",children:[n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Variant rule"}),n.jsx(vn,{currentRt:_??"",currentLabel:nt($t?.rule),matchers:vt,onSelect:Es}),dn&&$e&&n.jsx("div",{className:"pt-1",children:n.jsx(Nn,{schema:dn,value:$e,onChange:$s,meta:u??void 0,decofile:o,onSaveReferencedBlock:ft,sandbox:gt},`${l??"none"}:${Et}:${_??""}`)})]})]}),n.jsx(Rn,{activeSchema:Vt,formValue:ae,formResetKey:he,onFormChange:tn,onBreadcrumbChange:V,breadcrumbPath:ie,emptyMessage:"No editable fields for this variant.",meta:u,decofile:o,onSaveReferencedBlock:ft,sandbox:gt})]}):ve?n.jsx(yt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx(Rn,{activeSchema:Vt,formValue:ae,formResetKey:he,onFormChange:tn,onBreadcrumbChange:V,breadcrumbPath:ie,emptyMessage:"No editable fields for this global block.",meta:u,decofile:o,onSaveReferencedBlock:ft,sandbox:gt})}):n.jsxs(yt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[ht&&te!==null&&n.jsxs("div",{className:Re("px-3 border-b",B?"pt-3 pb-5 space-y-3":"py-2"),children:[n.jsxs("button",{type:"button",onClick:()=>Z(t=>!t),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":B,children:[n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Variant rule"}),B?n.jsx(Wa,{className:"size-3.5 shrink-0 text-muted-foreground"}):n.jsx(Ha,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),B&&n.jsxs("div",{className:Re("space-y-3",wt&&"pointer-events-none opacity-50"),children:[n.jsx(vn,{currentRt:te,currentLabel:Sn(Ge?.rule,o??{},nt,u??void 0),matchers:vt,onSelect:As}),sn&&Se&&n.jsx("div",{className:"space-y-3",children:n.jsx(Nn,{schema:sn,value:Se,onChange:Ms,meta:u??void 0,decofile:o,onSaveReferencedBlock:ft,sandbox:gt},`${je}:${te??""}`)})]})]}),n.jsx("div",{className:"p-2 pt-3",children:n.jsx(Ar,{listKey:`${b??""}-${je}`,rawSections:U,sections:Ne,meta:u,selectedIndex:l,onSelect:gs,onReorder:Ss,onDelete:xs,onDuplicate:bs,onMakeReusable:X,onToggleHidden:ys,onToggleLazy:js,onAddVariant:Mt,onDetach:_s,onAddSection:()=>ee(!0),canAddSection:Ps})})]}),n.jsx(Sa,{open:ce!==null,onOpenChange:t=>{t||X(null)},defaultBlockId:ce!==null?xn(Ne[ce]?.label??""):"",isPending:Pe.isPending,onSubmit:Ts}),d&&n.jsx(br,{open:G,onOpenChange:ee,meta:u,decofile:o,previewBaseUrl:d,onSelect:ks}),ne&&b&&o&&n.jsx(xa,{open:ne,onOpenChange:me,pageKey:b,decofile:o}),Y!==null&&n.jsx(Er,{open:!0,initialName:Ft(Ve[Y]?.rule,o??{},u??void 0)?Sn(Ve[Y]?.rule,o??{},nt,u??void 0):"",autoLabel:nt(jt(Ve[Y]?.rule,o??{},u??void 0)),isPending:wt,onSubmit:async t=>{await Hs(Y,t)},onOpenChange:t=>{!t&&!wt&&L(null)}})]})}export{Cl as SectionsEditor};
|