decocms 4.506.0 → 4.507.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/{ActiveShapeUtils-YBOj2cK0.js → ActiveShapeUtils-BpUYB5M6.js} +1 -1
- package/dist/client/assets/{AlertCircle-SlWthUo-.js → AlertCircle-Bty2uhsk.js} +1 -1
- package/dist/client/assets/{AreaChart-D7jrbsmW.js → AreaChart-DSbx8Pux.js} +1 -1
- package/dist/client/assets/{ArrowLeft-KHwg-gY7.js → ArrowLeft-CGwuLtbU.js} +1 -1
- package/dist/client/assets/{ArrowUp-DcS4NtQu.js → ArrowUp-BYzq623p.js} +1 -1
- package/dist/client/assets/{BarChart-C_clG8Ob.js → BarChart-ws0Z6t_Q.js} +1 -1
- package/dist/client/assets/{Building02-CNZjLCzO.js → Building02-DC1B_tJa.js} +1 -1
- package/dist/client/assets/{CategoricalChart-DlYOL7Yr.js → CategoricalChart-Bhsngimh.js} +1 -1
- package/dist/client/assets/{CheckCircle-BmoiDiMI.js → CheckCircle-DPGL3Hpc.js} +1 -1
- package/dist/client/assets/{ChevronSelectorVertical-DKuBdQt_.js → ChevronSelectorVertical-BwRvUPUM.js} +1 -1
- package/dist/client/assets/{ChevronUp-BZdHrdSa.js → ChevronUp-D5DP9qHs.js} +1 -1
- package/dist/client/assets/{Copy01-CuZQqOx0.js → Copy01-51uCRbSg.js} +1 -1
- package/dist/client/assets/{CreditCard01-Dy-cJWaD.js → CreditCard01-D8QKn2t6.js} +1 -1
- package/dist/client/assets/{DotsVertical-BRx6WGDK.js → DotsVertical-Bhq6_ex6.js} +1 -1
- package/dist/client/assets/{ErrorBarContext-C_eBf_yb.js → ErrorBarContext-C8nCqXCd.js} +1 -1
- package/dist/client/assets/{Globe04-C14EHEAN.js → Globe04-C6aR04Lg.js} +1 -1
- package/dist/client/assets/{Image01-B4ADQjw6.js → Image01-8_YUB9dA.js} +1 -1
- package/dist/client/assets/{Key01-DFRkR5rw.js → Key01-BYJLiX2A.js} +1 -1
- package/dist/client/assets/{Link01-HNlOmSEO.js → Link01-BrX96Lzm.js} +1 -1
- package/dist/client/assets/{LinkBroken01-ZJSQiUDy.js → LinkBroken01-DvM0DBf8.js} +1 -1
- package/dist/client/assets/{Monitor01-D6P0fhgC.js → Monitor01-D0i8fPos.js} +1 -1
- package/dist/client/assets/{Play-BUzibowQ.js → Play-BefGY3fA.js} +1 -1
- package/dist/client/assets/{Plus-DMw0rYpl.js → Plus-Bk_sjqOf.js} +1 -1
- package/dist/client/assets/{SearchMd-5zzeWTKY.js → SearchMd-Cey_qFlh.js} +1 -1
- package/dist/client/assets/{Sector-DhHL2rjm.js → Sector-CtKVpBRQ.js} +1 -1
- package/dist/client/assets/{ShoppingBag01-JCO9eh6X.js → ShoppingBag01-DmYaqF6W.js} +1 -1
- package/dist/client/assets/{Sun-CZj_t7ip.js → Sun-Vjoy_5bv.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-DFdRxYUn.js → SwitchHorizontal01-Cpiuomvl.js} +1 -1
- package/dist/client/assets/{Tool01-BM2irxFF.js → Tool01-BxfOk1kQ.js} +1 -1
- package/dist/client/assets/{Trash01-DCBnmu5P.js → Trash01-CMp64biU.js} +1 -1
- package/dist/client/assets/{Upload01-CGS2ebmt.js → Upload01-Dgeov9JH.js} +1 -1
- package/dist/client/assets/{User01-Cs-eJ-Db.js → User01-hKw9FGQs.js} +1 -1
- package/dist/client/assets/{UserSquare-DwswTgw8.js → UserSquare-J-pPBDsM.js} +1 -1
- package/dist/client/assets/{Users01-B4Uysmrx.js → Users01-D83kTTD4.js} +1 -1
- package/dist/client/assets/{XAxis-Bq2-riEp.js → XAxis-DP4n5Mz1.js} +1 -1
- package/dist/client/assets/{XClose-B6X-WQEL.js → XClose-BnQLG2SG.js} +1 -1
- package/dist/client/assets/{ZoomOut-CPMInjM1.js → ZoomOut-DAA80mSj.js} +1 -1
- package/dist/client/assets/{access-gate-CHtG4vI8.js → access-gate-BPTmRdwJ.js} +1 -1
- package/dist/client/assets/{add-connection-dialog-gHKHol-P.js → add-connection-dialog-DJYTiZdc.js} +1 -1
- package/dist/client/assets/{agent-analytics-DXbNELON.js → agent-analytics-CciBDuVD.js} +1 -1
- package/dist/client/assets/agent-app-DiZwp2A0.js +1 -0
- package/dist/client/assets/{agent-assets-DMv6anfA.js → agent-assets-BtIBrBU2.js} +1 -1
- package/dist/client/assets/{agent-automation-ClB242hY.js → agent-automation-xojgkWpW.js} +3 -3
- package/dist/client/assets/{agent-automations-BfSWMz7r.js → agent-automations-DI9zixMm.js} +1 -1
- package/dist/client/assets/{agent-connect-sources-1y7VsJ7D.js → agent-connect-sources-CTaUDT6P.js} +1 -1
- package/dist/client/assets/agent-deck-jNu9-E3W.js +1 -0
- package/dist/client/assets/{agent-e2e-VfJQEaZF.js → agent-e2e-CMbdmVpE.js} +1 -1
- package/dist/client/assets/{agent-experiments-BIloXgen.js → agent-experiments-BAiMCicr.js} +1 -1
- package/dist/client/assets/{agent-file-DHb7VoiQ.js → agent-file-IVz8YLfb.js} +1 -1
- package/dist/client/assets/{agent-hosting-Dd3LktbV.js → agent-hosting--MjQUCqO.js} +1 -1
- package/dist/client/assets/{agent-icon-DPEjJB4e.js → agent-icon-CdvQWbsW.js} +1 -1
- package/dist/client/assets/agent-library-DuL0qEtT.js +1 -0
- package/dist/client/assets/agent-library-file-Yb6uRPKq.js +1 -0
- package/dist/client/assets/{agent-monitor-Bqq_5OKe.js → agent-monitor-D3m53JTs.js} +1 -1
- package/dist/client/assets/{agent-overview-CzK1M8k2.js → agent-overview-CEg-2iVO.js} +1 -1
- package/dist/client/assets/{agent-releases-CycYtkVh.js → agent-releases-DiaV8DC-.js} +1 -1
- package/dist/client/assets/agent-settings-DdQ64SOh.js +1 -0
- package/dist/client/assets/{agent-site-editor-DHhqBK5P.js → agent-site-editor-C5QM4WzO.js} +1 -1
- package/dist/client/assets/agent-site-editor-code-TvR4NVzG.js +2 -0
- package/dist/client/assets/agent-site-editor-content-D9MSMJlS.js +1 -0
- package/dist/client/assets/agent-site-editor-preview-1BlZLcsH.js +1 -0
- package/dist/client/assets/agent-view-CaYqv_5j.js +1 -0
- package/dist/client/assets/{agent-view-guard-D6GUEcFf.js → agent-view-guard-BUPMHzY7.js} +1 -1
- package/dist/client/assets/{agents-list-BEIvacYR.js → agents-list-CK-X0XMD.js} +1 -1
- package/dist/client/assets/{ai-providers-0X1DCh96.js → ai-providers-BRhxQzWW.js} +1 -1
- package/dist/client/assets/{alert-BpZ59_Gc.js → alert-CpswsOed.js} +1 -1
- package/dist/client/assets/{alert-dialog-DOc9sMK7.js → alert-dialog-C9FvnbJH.js} +1 -1
- package/dist/client/assets/{analytics-sections-ShUUJbGz.js → analytics-sections-CbcIa337.js} +1 -1
- package/dist/client/assets/api-keys-C6QAXUnz.js +1 -0
- package/dist/client/assets/{api-keys-BDfZvFu9.js → api-keys-DlsaE7fm.js} +1 -1
- package/dist/client/assets/{app-editor-BWwoXiez.js → app-editor-BoavkVeY.js} +1 -1
- package/dist/client/assets/{asset-utils-BpRYKiOA.js → asset-utils-D7MF6-R7.js} +1 -1
- package/dist/client/assets/{auth-Bew9bJSh.js → auth-MJlmDrih.js} +1 -1
- package/dist/client/assets/{auth-catchall-BZM_DFXE.js → auth-catchall-BHMd9Ph5.js} +1 -1
- package/dist/client/assets/{auth-entry-C0pPXrpQ.js → auth-entry-DL7EFmi7.js} +1 -1
- package/dist/client/assets/{auth-split-layout-D4mHxU2I.js → auth-split-layout-DW5pckra.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-Bg2qSKP5.js → authenticate-and-persist-oauth-DjLIsCBn.js} +1 -1
- package/dist/client/assets/{automation-list-row-Du_X7bLQ.js → automation-list-row-BjiQRizI.js} +1 -1
- package/dist/client/assets/{automation-runs-K0640sJi.js → automation-runs-80f4mOhg.js} +1 -1
- package/dist/client/assets/{automations-1ZKwiBVj.js → automations-DvVYYa4T.js} +1 -1
- package/dist/client/assets/{autosend-BM8Gkro6.js → autosend-BfqtXC9i.js} +1 -1
- package/dist/client/assets/{avatar-Cf8ensdm.js → avatar-V-6seD4f.js} +1 -1
- package/dist/client/assets/{badge-u-FEcB1F.js → badge-xuppbiJQ.js} +1 -1
- package/dist/client/assets/{block-document-rnpU1D6O.js → block-document-Btuft_G8.js} +1 -1
- package/dist/client/assets/{blocks-preview-workspace-context-Dz4R0igJ.js → blocks-preview-workspace-context-BgDdSp2f.js} +1 -1
- package/dist/client/assets/{blocks-tab-states-Dbou5tyV.js → blocks-tab-states-Db9AzGGz.js} +3 -3
- package/dist/client/assets/{blog-schema-BLwhAB4M.js → blog-schema-COmuQoqg.js} +1 -1
- package/dist/client/assets/{board-analytics-vn1KvhHP.js → board-analytics-DmUIfxqn.js} +1 -1
- package/dist/client/assets/{buckets-CkiliZPf.js → buckets-BUVMZHRM.js} +1 -1
- package/dist/client/assets/{build-improve-prompt-doc-BGKwjyz_.js → build-improve-prompt-doc-LycMDrLL.js} +1 -1
- package/dist/client/assets/{calendar-Cms_t32w.js → calendar-BFQivyIG.js} +1 -1
- package/dist/client/assets/{capability-load-error-Btsxhikd.js → capability-load-error-DT-E9Kqv.js} +1 -1
- package/dist/client/assets/{category-editor-BIFxkSOg.js → category-editor-D7z_VQuj.js} +1 -1
- package/dist/client/assets/{chart-WIORlSk5.js → chart-Bf8aJepc.js} +1 -1
- package/dist/client/assets/{chat-context-CXuTB4t_.js → chat-context-CShbCUNX.js} +1 -1
- package/dist/client/assets/{chat-draft-BfZZImrW.js → chat-draft-D5xPO9J5.js} +1 -1
- package/dist/client/assets/{checkbox-39Y4Yvzb.js → checkbox-CsdxV5F4.js} +1 -1
- package/dist/client/assets/{choose-editor-A6KbDeMD.js → choose-editor-Cob5iDz2.js} +1 -1
- package/dist/client/assets/{cli-auth-success-CBQcY2ti.js → cli-auth-success-BGAGjJYR.js} +1 -1
- package/dist/client/assets/{client-icons-CkJbp7Kf.js → client-icons-C0O_MDmG.js} +1 -1
- package/dist/client/assets/cms-settings-editor-CQKCJYGK.js +1 -0
- package/dist/client/assets/{collapsible-DQScoiBp.js → collapsible-pbpDRVGu.js} +1 -1
- package/dist/client/assets/{collection-detail-CTj1twku.js → collection-detail-QEBGQhqZ.js} +1 -1
- package/dist/client/assets/{collection-display-button-2k7Qd1eY.js → collection-display-button-Bo5uFmZI.js} +1 -1
- package/dist/client/assets/{collection-search-BvWeMsnW.js → collection-search-B8HvNhHx.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-KHKDw1rQ.js → collection-table-wrapper-CME0ZXYS.js} +1 -1
- package/dist/client/assets/{collection-tabs-DMN1FKAg.js → collection-tabs-P32YIIxy.js} +1 -1
- package/dist/client/assets/{column-rules-J5zEqDKI.js → column-rules-DJkbTYf8.js} +1 -1
- package/dist/client/assets/{combobox-BbEIMkIW.js → combobox-95bHdh7B.js} +1 -1
- package/dist/client/assets/{command-bEQWkHWl.js → command-CdQubtgL.js} +1 -1
- package/dist/client/assets/{companion-mcps-section-C9zrMUWG.js → companion-mcps-section-DT-zqSA0.js} +1 -1
- package/dist/client/assets/{config-oRqWYZBw.js → config-CC4U9lyT.js} +1 -1
- package/dist/client/assets/{connect-CpChXP6m.js → connect-D_OdkLzZ.js} +2 -2
- package/dist/client/assets/{connect-layout-7yNDEshW.js → connect-layout-DKUDTFmt.js} +1 -1
- package/dist/client/assets/{connection-DE10KgqA.js → connection-DS2m6_aA.js} +1 -1
- package/dist/client/assets/{connection-card-f5vHryIM.js → connection-card-C1INmiO3.js} +1 -1
- package/dist/client/assets/{connection-detail-BvxmL1lP.js → connection-detail-govoielY.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-iXh508wY.js → connection-form-helpers-Bdbv__5q.js} +1 -1
- package/dist/client/assets/{connections-uyNi3ziJ.js → connections-CS9HbJB3.js} +1 -1
- package/dist/client/assets/{content-tab-DbhBHZG2.js → content-tab-DWizMuHE.js} +3 -3
- package/dist/client/assets/{context-RzldR5hI.js → context-TX95KwtD.js} +1 -1
- package/dist/client/assets/{context-menu-Bu-wDHbx.js → context-menu-CV5Kwy0Y.js} +1 -1
- package/dist/client/assets/{core.esm-BOurIsL2.js → core.esm-DySokeDD.js} +1 -1
- package/dist/client/assets/{create-organization-dialog-BYS8yCkD.js → create-organization-dialog-BKXj66H0.js} +1 -1
- package/dist/client/assets/{daily-pulse-B0nm37Wk.js → daily-pulse-BnWqY20A.js} +1 -1
- package/dist/client/assets/{discover-C3-2Xsml.js → discover-CwLdifKu.js} +1 -1
- package/dist/client/assets/{domain-settings-DJWETZdb.js → domain-settings-bBNFtUzG.js} +1 -1
- package/dist/client/assets/{drawer-SYkf9S3t.js → drawer-CY01gtte.js} +1 -1
- package/dist/client/assets/{editor-50pL9wJq.js → editor-BMsJkpc5.js} +1 -1
- package/dist/client/assets/{editor-classes-tT6DS3c0.js → editor-classes-hvMxYRPw.js} +1 -1
- package/dist/client/assets/{empty-state-BBRtoH8X.js → empty-state-DbF1fVB1.js} +1 -1
- package/dist/client/assets/{empty-state-BEo1idJ2.js → empty-state-lMQw4wDb.js} +1 -1
- package/dist/client/assets/{extract-connection-data-BXwLKN9Y.js → extract-connection-data-CxPHH0g-.js} +1 -1
- package/dist/client/assets/{feature-gate-CmK7hW3c.js → feature-gate-yx1JPdIs.js} +1 -1
- package/dist/client/assets/{feature-paywall-B6WYRGmt.js → feature-paywall-BVtlmh2X.js} +1 -1
- package/dist/client/assets/{file-explorer-BmA6nLXP.js → file-explorer-ibryp6QB.js} +1 -1
- package/dist/client/assets/{file-preview-navJIo3Y.js → file-preview-C0xlzOg8.js} +1 -1
- package/dist/client/assets/{file-share-button-By02TUaE.js → file-share-button-DpvTad7o.js} +1 -1
- package/dist/client/assets/{file-type-icon-CXYODp5S.js → file-type-icon-DuTvDFZv.js} +1 -1
- package/dist/client/assets/flat-project-ZH6vKlez.js +1 -0
- package/dist/client/assets/{folder-icon-CPUJWTIk.js → folder-icon-whk1wgCT.js} +1 -1
- package/dist/client/assets/{form-CSMe0Xu2.js → form-C3-gqoE3.js} +1 -1
- package/dist/client/assets/{general-BCOJVftC.js → general-CWIFD_7I.js} +1 -1
- package/dist/client/assets/{home-rN3gPNj9.js → home-DT5-zQ3E.js} +1 -1
- package/dist/client/assets/{hosted-publish-feedback-cq97qRwz.js → hosted-publish-feedback-D6Ffo0E3.js} +1 -1
- package/dist/client/assets/{icon-button-jj21Pfs7.js → icon-button-BS-JGKQE.js} +1 -1
- package/dist/client/assets/{index-BaYKytFu.js → index-2To0vSEr.js} +1 -1
- package/dist/client/assets/{index-Yt-1DNw6.js → index-3zItT2RS.js} +3 -3
- package/dist/client/assets/{index-Dz84h2Uh.js → index-BfPVLbyp.js} +2 -2
- package/dist/client/assets/{index-DRz4ZqDU.js → index-Bw86rqRb.js} +1 -1
- package/dist/client/assets/{index-DmJJi5Aj.js → index-CTZFCFor.js} +30 -30
- package/dist/client/assets/index-CdXcvK9e.js +1 -0
- package/dist/client/assets/{index-Du7SnZ-C.js → index-CocrhzZC.js} +14 -14
- package/dist/client/assets/{index-BFoj7reh.js → index-CylNQm53.js} +1 -1
- package/dist/client/assets/{index-DEDDgDGK.js → index-D1WhOgDF.js} +1 -1
- package/dist/client/assets/{index-DKVv-34T.js → index-D3Egkv0G.js} +1 -1
- package/dist/client/assets/{index-9Jrp3KlM.js → index-DN6_-RzX.js} +1 -1
- package/dist/client/assets/{index-D_zg5lyX.js → index-DQRAWCM4.js} +1 -1
- package/dist/client/assets/{index-CnqqaukI.js → index-DbWYgc1J.js} +1 -1
- package/dist/client/assets/{index-lvmhjtam.js → index-JOoGKn03.js} +1 -1
- package/dist/client/assets/{index-B7U88B6N.js → index-ONAPJHIb.js} +1 -1
- package/dist/client/assets/{index-redirect-CPDHoWP-.js → index-redirect-B7Nxq720.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-DMUM7SCu.js → infiniteQueryObserver-DjFxX3t4.js} +1 -1
- package/dist/client/assets/{infra-billing-DNOr1seX.js → infra-billing-C91ooPoC.js} +1 -1
- package/dist/client/assets/input-CAuGdxaS.js +1 -0
- package/dist/client/assets/{input-YsTzlSvU.js → input-zzyYgG2z.js} +3 -3
- package/dist/client/assets/{integration-icon-DQxxCK04.js → integration-icon-DedJ1gFL.js} +1 -1
- package/dist/client/assets/{jira-icon-CPUmww9A.js → jira-icon-BH-e3sV4.js} +1 -1
- package/dist/client/assets/{label-DXaPh7Je.js → label-BxQ_dsc6.js} +1 -1
- package/dist/client/assets/{layout-DQ66qmO9.js → layout-C3yBCGKV.js} +1 -1
- package/dist/client/assets/legacy-agents-deep-CPUJGbk4.js +1 -0
- package/dist/client/assets/{legacy-main-redirect-Np53PuYT.js → legacy-main-redirect-Cd5BSaGF.js} +1 -1
- package/dist/client/assets/library-C1JuHwwk.js +1 -0
- package/dist/client/assets/{library-tab-Bq6k_3IG.js → library-tab-DAuCMhST.js} +1 -1
- package/dist/client/assets/{login-DBsx92_o.js → login-DCgWtHlv.js} +1 -1
- package/dist/client/assets/{markdown-CF_EwD8u.js → markdown-B3gUf9fq.js} +1 -1
- package/dist/client/assets/{mcp-app-renderer-SLcpw_GO.js → mcp-app-renderer-4oVWjJbt.js} +1 -1
- package/dist/client/assets/{mcp-oauth-CzbNzM03.js → mcp-oauth-DnmbC1ZC.js} +1 -1
- package/dist/client/assets/{mcp-oauth-BPsTeQb9.js → mcp-oauth-Dx8iOGEt.js} +1 -1
- package/dist/client/assets/{members-BNplg4tN.js → members-PWoNTeHj.js} +1 -1
- package/dist/client/assets/{memory-Be-EH5Kw.js → memory-BEuf8l8C.js} +1 -1
- package/dist/client/assets/{mini-report-page-MmikJINJ.js → mini-report-page-BQGdzpbF.js} +1 -1
- package/dist/client/assets/mock-board-CSuz4opM.js +1 -0
- package/dist/client/assets/{monaco-editor-dPYi6L5q.js → monaco-editor-C1ThyHfg.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-C8PGI7z7.js → monitoring-stats-row-BLfBHvDR.js} +1 -1
- package/dist/client/assets/{multi-select-BzwMWM94.js → multi-select-BGUKy-ie.js} +1 -1
- package/dist/client/assets/{mustache-DhZHK7zV.js → mustache-BopKjK4y.js} +1 -1
- package/dist/client/assets/{new-project-dialog-x3CgBcBd.js → new-project-dialog--6a9GYsY.js} +1 -1
- package/dist/client/assets/{oauth-callback-DwnwB6UW.js → oauth-callback-Dl9UbmC0.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-Cq1iMkGk.js → oauth-callback-ai-provider-MlWlWjGr.js} +1 -1
- package/dist/client/assets/{onboarding-fQG5r2FK.js → onboarding-BvW7_lSm.js} +1 -1
- package/dist/client/assets/{openai-conversation-KVcfBBc6.js → openai-conversation-DV_TyXnN.js} +1 -1
- package/dist/client/assets/{optimistic-project-sidebar-views-DNYS7Cn_.js → optimistic-project-sidebar-views-gZfWr2eJ.js} +1 -1
- package/dist/client/assets/{order-monitor-day-CIjpWX2N.js → order-monitor-day-tqxzccsD.js} +1 -1
- package/dist/client/assets/{organization-choice-CLkvC5Cb.js → organization-choice-qkiDWPrl.js} +1 -1
- package/dist/client/assets/{orgs-CMEfgf3N.js → orgs-Bsdk5WNb.js} +1 -1
- package/dist/client/assets/{page-seo-form-BlD1QdAg.js → page-seo-form-C26iJCis.js} +1 -1
- package/dist/client/assets/{pair-DP5ED0n_.js → pair-BXKJ75t2.js} +1 -1
- package/dist/client/assets/{plan-ladder-zWIPqL-O.js → plan-ladder-D42bnzq6.js} +1 -1
- package/dist/client/assets/{popover-fYvCFbz-.js → popover-DZg3XzK_.js} +1 -1
- package/dist/client/assets/{post-calendar-D1yzYd4M.js → post-calendar-BtiCxjbq.js} +1 -1
- package/dist/client/assets/{post-editor-BXUHohyr.js → post-editor-CimCNunY.js} +1 -1
- package/dist/client/assets/{preview-content-CmfLKt3D.js → preview-content-CxXRowEV.js} +1 -1
- package/dist/client/assets/{preview-dialog-C5CJFtZe.js → preview-dialog-W6xlve7R.js} +1 -1
- package/dist/client/assets/{preview-panel-16KeEdoG.js → preview-panel-Cy7WRuva.js} +1 -1
- package/dist/client/assets/{preview-tab-DhgHL0WN.js → preview-tab-Bo_MmH8N.js} +3 -3
- package/dist/client/assets/{product-picker-dialog-tVZq0CDa.js → product-picker-dialog-DRSW83x9.js} +1 -1
- package/dist/client/assets/{profile-CIMiHvG6.js → profile-CtmE_8xo.js} +1 -1
- package/dist/client/assets/{project-app-view-CWtv42hH.js → project-app-view-8D3fxLxg.js} +1 -1
- package/dist/client/assets/{project-feed-DMV42khD.js → project-feed-B6d9Pblv.js} +1 -1
- package/dist/client/assets/{project-icon-DijKHVuo.js → project-icon-Cd3AxOfl.js} +1 -1
- package/dist/client/assets/project-reports-DhGxN0x2.js +1 -0
- package/dist/client/assets/project-tasks-DppEghsL.js +1 -0
- package/dist/client/assets/{projects-BVF2wGAY.js → projects-B8YVAgec.js} +1 -1
- package/dist/client/assets/{projects-empty-state-CdfFkgo9.js → projects-empty-state-BfkNTDjK.js} +1 -1
- package/dist/client/assets/{prompts-D8lBj64B.js → prompts-2NxN_gnO.js} +1 -1
- package/dist/client/assets/record-editor-DQiQEm3J.js +1 -0
- package/dist/client/assets/{redirect-editor-D6GG3gU8.js → redirect-editor-S1rL9xd1.js} +1 -1
- package/dist/client/assets/{reports-DzFUAAe9.js → reports-BdiHuIUD.js} +1 -1
- package/dist/client/assets/reports-c39OWGSZ.js +1 -0
- package/dist/client/assets/{reports-onboarding-CtCpWMWq.js → reports-onboarding-CzBiKyvA.js} +1 -1
- package/dist/client/assets/{reports-tab-DdjqXd-P.js → reports-tab-fWUABT_U.js} +2 -2
- package/dist/client/assets/{repositories-DvZv22_y.js → repositories-1B0IcoSH.js} +1 -1
- package/dist/client/assets/repository-binding-CbZ7gDPF.js +1 -0
- package/dist/client/assets/{repository-import-picker-DdjluiGQ.js → repository-import-picker-CqejRBEV.js} +1 -1
- package/dist/client/assets/{repository-picker-BHG_Q3_Y.js → repository-picker-lc5PVuph.js} +1 -1
- package/dist/client/assets/{require-capability-DfMvVRIs.js → require-capability-CLiKw7xi.js} +1 -1
- package/dist/client/assets/{required-auth-layout-B4Pt2844.js → required-auth-layout-obZ6miVT.js} +1 -1
- package/dist/client/assets/{reset-password-CoG-TCPT.js → reset-password-C9jR1Ymc.js} +1 -1
- package/dist/client/assets/{resizable-QOT7XwbA.js → resizable-MOzKpsY9.js} +1 -1
- package/dist/client/assets/{resolve-tab-icon-BDl2h0Dq.js → resolve-tab-icon-DXtTUrAj.js} +1 -1
- package/dist/client/assets/{review-settings-CuM9As5T.js → review-settings-DrM5MUBI.js} +1 -1
- package/dist/client/assets/{roles-B6Agdrhz.js → roles-CHt9_vGR.js} +1 -1
- package/dist/client/assets/route-C2SFyXDw.js +1 -0
- package/dist/client/assets/{route-DCzETavQ.js → route-Cd4e3z96.js} +1 -1
- package/dist/client/assets/route-q27BnTUy.js +1 -0
- package/dist/client/assets/{sandbox-lifecycle-context-BcfEFMah.js → sandbox-lifecycle-context-BlCv6a-P.js} +1 -1
- package/dist/client/assets/{schema-C_Twe2CR.js → schema-B3PJAfvC.js} +1 -1
- package/dist/client/assets/schema-BpLx5lXs.js +1 -0
- package/dist/client/assets/{scroll-area-DWfW8PPp.js → scroll-area-CioiKzlv.js} +1 -1
- package/dist/client/assets/{search-input-iONBjTDn.js → search-input-OMtFZb1f.js} +1 -1
- package/dist/client/assets/{search-toggle-DNrxid9T.js → search-toggle-Rm9zqdhj.js} +1 -1
- package/dist/client/assets/{secret-ciphertext-DQJA6LTs.js → secret-ciphertext-FPLrd6Sz.js} +1 -1
- package/dist/client/assets/{secret-picker-RTqlv_mw.js → secret-picker-fddEeqOm.js} +1 -1
- package/dist/client/assets/{secrets-CT-Ix4aE.js → secrets-loUpoyBS.js} +1 -1
- package/dist/client/assets/{sections-editor-BbVsm3CC.js → sections-editor-E9Z18ZDi.js} +2 -2
- package/dist/client/assets/{select-7a9WvaWj.js → select-CMGxS2qh.js} +1 -1
- package/dist/client/assets/{select-model-MsH0R9Xj.js → select-model-CxhDhd-9.js} +1 -1
- package/dist/client/assets/{seo-editor-0ZcLNYXq.js → seo-editor-D8MaiSNi.js} +1 -1
- package/dist/client/assets/{separator-DVSdXQ2O.js → separator-BXc0zPSY.js} +1 -1
- package/dist/client/assets/settings-tab-Dou04qL_.js +4 -0
- package/dist/client/assets/{sheet-C2JlOlpD.js → sheet-BRHzkcNr.js} +1 -1
- package/dist/client/assets/{shell-layout-BDxZg9_K.js → shell-layout-Dhz9Exq4.js} +1 -1
- package/dist/client/assets/site-editor-CN-mBnl3.js +1 -0
- package/dist/client/assets/{site-editor-toast-DISsODHI.js → site-editor-toast-7y5QejdX.js} +1 -1
- package/dist/client/assets/{skills-CWjsrGc5.js → skills-BYVm1yj9.js} +1 -1
- package/dist/client/assets/{slider-04lpm0v_.js → slider-BA5URV4c.js} +1 -1
- package/dist/client/assets/{sortable.esm-BP__-BL2.js → sortable.esm-BOb8_093.js} +1 -1
- package/dist/client/assets/{sso-B5Zn_6ZD.js → sso-BobuOVA-.js} +1 -1
- package/dist/client/assets/{suggestion-DFoIyeE9.js → suggestion-D_2yEjf4.js} +1 -1
- package/dist/client/assets/{switch-CFiGUTOP.js → switch-DGEo5K4-.js} +1 -1
- package/dist/client/assets/{symbol-7m9tSCCw.js → symbol-CjppxhTH.js} +1 -1
- package/dist/client/assets/{synced-repos-C4fTRc_O.js → synced-repos-Dr5VcS9S.js} +1 -1
- package/dist/client/assets/{tab-icon-glyph-DrR3rVhf.js → tab-icon-glyph-DJxM1HMX.js} +1 -1
- package/dist/client/assets/{table-BTn9QLXW.js → table-CM_armOG.js} +1 -1
- package/dist/client/assets/{tabs-gZYZCgK2.js → tabs-D7n9t3lM.js} +1 -1
- package/dist/client/assets/task-board-Cfny2jqU.js +1 -0
- package/dist/client/assets/{task-route-Du0a6oFo.js → task-route-C93dEljG.js} +1 -1
- package/dist/client/assets/{task-status-CZXBctHo.js → task-status-Dc99s_5R.js} +1 -1
- package/dist/client/assets/taskboard-analytics-i6H3Rv1v.js +1 -0
- package/dist/client/assets/tasks-ByuTOhSz.js +1 -0
- package/dist/client/assets/{tasks-DbnjSqj8.js → tasks-Bz8Lz6cJ.js} +3 -3
- package/dist/client/assets/{textarea-Bej_HjJx.js → textarea-D-r53Xtx.js} +1 -1
- package/dist/client/assets/{thread-analytics-DlZSGBPY.js → thread-analytics-xhV1IkYL.js} +1 -1
- package/dist/client/assets/{thread-intent-D56tMIbL.js → thread-intent-b5vpifzT.js} +1 -1
- package/dist/client/assets/{thread-route-BNBBewOp.js → thread-route-BJ_juaVR.js} +1 -1
- package/dist/client/assets/{thread-route-Ch_UFE8H.js → thread-route-dlwv4_1A.js} +1 -1
- package/dist/client/assets/{thread-sheet-body-BGZjdiWy.js → thread-sheet-body-BlfHDz0K.js} +1 -1
- package/dist/client/assets/{time-range-picker-DFRYI5yT.js → time-range-picker-BbFeKJV8.js} +1 -1
- package/dist/client/assets/{toggle-group-DZg8BqTb.js → toggle-group-DHp1u7am.js} +1 -1
- package/dist/client/assets/{tool-namespace-DHnrXl8N.js → tool-namespace-BEzs43Ur.js} +1 -1
- package/dist/client/assets/{toolbar-icon-button-UMKCT0Ua.js → toolbar-icon-button-iqvhc0aD.js} +1 -1
- package/dist/client/assets/{tooltip-yZHJwZ0_.js → tooltip-OCAaNJPG.js} +1 -1
- package/dist/client/assets/{tooltipContext-BYBEDJBX.js → tooltipContext-Di2WNqkv.js} +1 -1
- package/dist/client/assets/{track-Cmqq1NGv.js → track-C14SKSTg.js} +1 -1
- package/dist/client/assets/{types-CfDTYsf_.js → types-DSl6aKYl.js} +1 -1
- package/dist/client/assets/{url-slug-CF34E0UB.js → url-slug-BDqmchWv.js} +1 -1
- package/dist/client/assets/{usage-stats-DK61cAbW.js → usage-stats-k4aXi0cR.js} +1 -1
- package/dist/client/assets/{use-ai-providers-CdtssKYb.js → use-ai-providers-r5JMl3Dn.js} +1 -1
- package/dist/client/assets/{use-app-takeover-D6c6GrNl.js → use-app-takeover-C41Zrny9.js} +1 -1
- package/dist/client/assets/{use-automations-DuQ94ezs.js → use-automations-CAQWvaBW.js} +1 -1
- package/dist/client/assets/{use-autosave-Cw2uAKzO.js → use-autosave-DVsGD-u4.js} +1 -1
- package/dist/client/assets/{use-chat-navigation-DXGdGkgT.js → use-chat-navigation-B7jtkmO9.js} +1 -1
- package/dist/client/assets/{use-clock-tick-BtNyF77k.js → use-clock-tick-CdAPP8z5.js} +1 -1
- package/dist/client/assets/{use-connect-companion-BklKatzN.js → use-connect-companion-XVE2U2A9.js} +1 -1
- package/dist/client/assets/{use-connection-Bdiz2xzR.js → use-connection-Bc66r7WR.js} +1 -1
- package/dist/client/assets/{use-content-sync-gPUq66Q_.js → use-content-sync-Cur_tlcg.js} +1 -1
- package/dist/client/assets/{use-copy-Cy4qf6se.js → use-copy-DIsWFSvt.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-C3RgOrG7.js → use-create-virtual-mcp-CC1Pm7Vq.js} +1 -1
- package/dist/client/assets/{use-date-fns-locale-mq2zvQEQ.js → use-date-fns-locale-BPUEmwqZ.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-69_37K6A.js → use-debounced-autosave-CitZx5FB.js} +1 -1
- package/dist/client/assets/{use-debounced-value-hKuOSnf8.js → use-debounced-value-Cv1nzd8k.js} +1 -1
- package/dist/client/assets/{use-deco-credits-BM65ruxD.js → use-deco-credits-CbC5ZgVr.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-CDGgmpnF.js → use-decopilot-events-BGdkAbxA.js} +1 -1
- package/dist/client/assets/{use-delete-connection-Cf3UUyQ4.js → use-delete-connection-Cgcil9G0.js} +1 -1
- package/dist/client/assets/{use-deployment-admin-BQKTAPvq.js → use-deployment-admin-Bq3PTYyd.js} +1 -1
- package/dist/client/assets/{use-ensure-project-folder-D6FwKelb.js → use-ensure-project-folder-D4n7osah.js} +1 -1
- package/dist/client/assets/{use-fast-preview-draft-url-Dl_wew24.js → use-fast-preview-draft-url-C__pe5ue.js} +1 -1
- package/dist/client/assets/{use-file-configs-DEeSzk9H.js → use-file-configs-Da0V_POi.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-jQz1UxrT.js → use-infinite-scroll-qQBI_BkS.js} +1 -1
- package/dist/client/assets/{use-join-requests-B0uJBWtr.js → use-join-requests-dO2c6Tc2.js} +1 -1
- package/dist/client/assets/{use-main-panel-tabs-BcqmbIv8.js → use-main-panel-tabs-eu6gNvfS.js} +1 -1
- package/dist/client/assets/{use-mcp-auth-status-BSYgNstS.js → use-mcp-auth-status-DciS_iyB.js} +1 -1
- package/dist/client/assets/{use-mcp-client-Cmf3kYdA.js → use-mcp-client-jKOlHdKM.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-Dk9LHUFW.js → use-mcp-prompts-KLIBV_YA.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-DzF7PfOd.js → use-mcp-tools-CWDoMes8.js} +1 -1
- package/dist/client/assets/{use-members-Bq6wseSf.js → use-members-DKFjOBdl.js} +1 -1
- package/dist/client/assets/{use-mobile-C56EQrK9.js → use-mobile-CmswU9_U.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-BdY7K2gs.js → use-navigate-to-agent-DvsN-N9f.js} +1 -1
- package/dist/client/assets/{use-open-billing-url-ctn8rgn5.js → use-open-billing-url-BGaG_eVz.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-BQKXCp53.js → use-org-auth-client-DyhHIXwn.js} +1 -1
- package/dist/client/assets/{use-org-fs-DpBvFsJy.js → use-org-fs-5rCZZYw5.js} +1 -1
- package/dist/client/assets/{use-org-repo-syncs-BGbiDUhK.js → use-org-repo-syncs-jpa15G0h.js} +1 -1
- package/dist/client/assets/{use-org-sso-By1UBOKy.js → use-org-sso-meIc9b7s.js} +1 -1
- package/dist/client/assets/{use-organization-roles-DAM-KEoH.js → use-organization-roles-1dxZeG9R.js} +1 -1
- package/dist/client/assets/{use-organization-settings-BbPuWdeO.js → use-organization-settings-NMl9AK6V.js} +1 -1
- package/dist/client/assets/{use-panel-navigate-DdMcNzfR.js → use-panel-navigate-BhXVoQPa.js} +1 -1
- package/dist/client/assets/use-project-native-view-presence-DgH1oa2Q.js +1 -0
- package/dist/client/assets/{use-project-scope-D1tA1r10.js → use-project-scope-B3s9YTAH.js} +1 -1
- package/dist/client/assets/{use-recent-apps-DQQGGtQF.js → use-recent-apps-B3eA701g.js} +1 -1
- package/dist/client/assets/{use-releases-D_4OhIZK.js → use-releases-B_Ivj-ji.js} +1 -1
- package/dist/client/assets/{use-reports-diagnostic-DmNOWdgE.js → use-reports-diagnostic-Dq1Yd1Vr.js} +1 -1
- package/dist/client/assets/{use-secrets-DVHGHbWn.js → use-secrets-Dg67dBxN.js} +1 -1
- package/dist/client/assets/{use-section-preview-base-EEIQI4Ik.js → use-section-preview-base-CYSL7sBu.js} +1 -1
- package/dist/client/assets/{use-tags-wkF8OlfB.js → use-tags-DRpey5ac.js} +1 -1
- package/dist/client/assets/{use-task-board-analytics-CeChyUNV.js → use-task-board-analytics-CxHs3cah.js} +1 -1
- package/dist/client/assets/{use-task-board-events-HM8tkd7K.js → use-task-board-events-CWFDTGYW.js} +1 -1
- package/dist/client/assets/{use-task-board-item-prs-BrZLlBFN.js → use-task-board-item-prs-D8bcpDjg.js} +1 -1
- package/dist/client/assets/{use-task-board-items-AkUs4SCp.js → use-task-board-items-BbRfksII.js} +1 -1
- package/dist/client/assets/{use-task-metadata-BYWnl_Dc.js → use-task-metadata-4c8a_mNH.js} +1 -1
- package/dist/client/assets/{use-thread-analytics-C-mFzjx5.js → use-thread-analytics-CMJl8EEf.js} +1 -1
- package/dist/client/assets/{use-thread-outputs-B1zzKutX.js → use-thread-outputs-BOAz3j7m.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-DOKZzanu.js +1 -0
- package/dist/client/assets/{useQueries-BlBb4paf.js → useQueries-BiefmIu_.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-gQb4-5BD.js +1 -0
- package/dist/client/assets/{users-C2_RmXbp.js → users-eo_ZMVx2.js} +1 -1
- package/dist/client/assets/{utils-BdpWMmUt.js → utils-DqXf9fJY.js} +1 -1
- package/dist/client/assets/{variant-calendar-CpdfrWzd.js → variant-calendar-1onPlYHl.js} +1 -1
- package/dist/client/assets/{variant-draft-pointer-UfH0PPCK.js → variant-draft-pointer-OJYw4Y1_.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-BuPOaLfD.js → view-mode-toggle-ImzlJONT.js} +1 -1
- package/dist/client/assets/{virtual-mcp-DEzWx_Zp.js → virtual-mcp-BX0PkQ6l.js} +1 -1
- package/dist/client/assets/{watch-sse-pool-DatmHsge.js → watch-sse-pool-CEcxThGW.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/migrate.js +218 -214
- package/dist/server/server.js +703 -703
- package/package.json +1 -1
- package/dist/client/assets/agent-app-Cv__AOVM.js +0 -1
- package/dist/client/assets/agent-deck-Du1mMR-E.js +0 -1
- package/dist/client/assets/agent-library-file-vb-6Hjtp.js +0 -1
- package/dist/client/assets/agent-library-pAGySVEX.js +0 -1
- package/dist/client/assets/agent-settings-6lU0Rtg1.js +0 -1
- package/dist/client/assets/agent-site-editor-code-C0sVCVRO.js +0 -2
- package/dist/client/assets/agent-site-editor-content-DuKM0OyF.js +0 -1
- package/dist/client/assets/agent-site-editor-preview-QBPik_OC.js +0 -1
- package/dist/client/assets/agent-view-DcW4UHjt.js +0 -1
- package/dist/client/assets/api-keys-CX0eTNjr.js +0 -1
- package/dist/client/assets/cms-settings-editor-CCE6WfjP.js +0 -1
- package/dist/client/assets/flat-project-CVEZo8Pd.js +0 -1
- package/dist/client/assets/index-6vyUSmHY.js +0 -1
- package/dist/client/assets/input-BH4Oxr1L.js +0 -1
- package/dist/client/assets/legacy-agents-deep-BNVqjDv8.js +0 -1
- package/dist/client/assets/library-D66pbYEa.js +0 -1
- package/dist/client/assets/mock-board-BaHvboTU.js +0 -1
- package/dist/client/assets/project-reports-BXZYOXjl.js +0 -1
- package/dist/client/assets/project-tasks-JG50DV7s.js +0 -1
- package/dist/client/assets/record-editor-Q4r6DK6y.js +0 -1
- package/dist/client/assets/reports-Dp6RE3Y_.js +0 -1
- package/dist/client/assets/repository-binding-CteZmIva.js +0 -1
- package/dist/client/assets/route-GZy5TvX0.js +0 -1
- package/dist/client/assets/route-t5GwjFKP.js +0 -1
- package/dist/client/assets/schema-B5twZahU.js +0 -1
- package/dist/client/assets/settings-tab-D-_nS2xd.js +0 -4
- package/dist/client/assets/site-editor-C6vYIwH1.js +0 -1
- package/dist/client/assets/task-board-CieGpcMy.js +0 -1
- package/dist/client/assets/taskboard-analytics-C-ASxw6x.js +0 -1
- package/dist/client/assets/tasks-UazvBHEg.js +0 -1
- package/dist/client/assets/use-project-native-view-presence-sPhh7BGC.js +0 -1
- package/dist/client/assets/useInfiniteQuery-Z1h_BzmN.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery--UgGWd1x.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as it,b as Ft,r as R,l as ae,j as i,b4 as Li,B as _t,U as sn,aw as $i,X as zi,V as Hi,a as xo,F as Wi,K as yo,m as qi,o as Gi,h as Ui,t as oe}from"./index-DmJJi5Aj.js";import{u as Yi}from"./chat-context-CXuTB4t_.js";import{a5 as Ji,T as Wn,a6 as Qi,a7 as Xi,a8 as Zi,a9 as ea,aa as ta,ab as na,ac as Br,ad as sa,ae as ra,G as jt,af as wt,ag as ze,ah as oa,H as Fn,E as On,b as ia,j as aa,u as la,ai as Kr,q as ca,aj as ua,s as da,o as fa,ak as So,p as _n,al as ma,am as pa,A as Fr,an as ha,ao as ga,ap as Bn,aq as Or,ar as Lr,as as $r,at as us,au as va,av as xa,F as ya,aw as zr,ax as Sa,ay as Hr,az as Wr,M as ba,aA as qr,a as ja,aB as Sn,aC as wa,aD as _a,aE as bn,aF as ds}from"./blocks-tab-states-Dbou5tyV.js";import{c as ka}from"./repository-binding-CteZmIva.js";import{n as Ea,t as Ra}from"./ChevronUp-BZdHrdSa.js";import{a8 as bo,b as zn,an as Aa,D as Ca,a1 as Gr,L as Ur}from"./agent-icon-DPEjJB4e.js";import{S as rn}from"./scroll-area-DWfW8PPp.js";import{c as kt,T as Et,a as Rt}from"./tooltip-yZHJwZ0_.js";import{am as Na,g as Yr,J as Ta,u as Va,K as Da,w as Ma,ab as Pa,x as Ia,d as Pt,f as It,a7 as Ba,ar as Ka}from"./site-editor-toast-DISsODHI.js";import{m as Fa,u as Oa,P as La}from"./mustache-DhZHK7zV.js";import{az as $a,k as Rs,aB as jo,H as za,aC as xt,aD as vs,aE as wo,aj as Gt,a8 as xs,aF as ys,ak as Kt,a9 as on,q as Ha,t as Wa,g as qa,x as Kn,ar as Ga,ai as jn,aa as fs,ah as Bt,ag as wn,aG as Ua,P as Ya,aH as Ja,al as Jr,a1 as Qr,aI as Qa,aJ as qt,aK as Xa,aL as Za,aM as el,aN as Xr,aO as tl,aP as nl,aQ as sl,af as rl,aR as ol,aS as il,aT as al,aU as ll,ae as cl,aV as ul}from"./secret-ciphertext-DQJA6LTs.js";import{a as dl}from"./Copy01-CuZQqOx0.js";import{a as Ss,e as _o}from"./UserSquare-DwswTgw8.js";import{i as Zr}from"./Tool01-BM2irxFF.js";import{s as eo}from"./Image01-B4ADQjw6.js";import{s as fl}from"./Plus-DMw0rYpl.js";import{s as ml}from"./Trash01-DCBnmu5P.js";import{i as bs}from"./ZoomOut-CPMInjM1.js";import{u as pl,a as to,K as hl,P as gl,b as vl,C as xl,D as yl,c as Sl}from"./core.esm-BOurIsL2.js";import{u as bl,s as jl,a as Ln,S as wl,v as _l}from"./sortable.esm-BP__-BL2.js";import{s as kl,g as El,u as Rl,A as Al}from"./use-section-preview-base-EEIQI4Ik.js";import{A as ms}from"./avatar-Cf8ensdm.js";import{e as Cl,d as no,b as Nl,A as Tl,a as Vl,f as Dl}from"./alert-dialog-DOc9sMK7.js";import{b as Ml}from"./format-time-CAj8AQXM.js";import{d as Pl}from"./shell-layout-BDxZg9_K.js";import{u as Il}from"./use-members-Bq6wseSf.js";import{a as Bl,P as so,b as Kl}from"./page-seo-form-BlD1QdAg.js";import{c as ro,d as oo,e as Fl,f as Ol}from"./variant-draft-pointer-UfH0PPCK.js";import"./use-panel-navigate-DdMcNzfR.js";import"./thread-route-Ch_UFE8H.js";import"./use-project-scope-D1tA1r10.js";import"./autosend-BM8Gkro6.js";import"./thread-intent-D56tMIbL.js";import"./use-mcp-client-Cmf3kYdA.js";import"./auth-Bew9bJSh.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./watch-sse-pool-DatmHsge.js";import"./task-board-CieGpcMy.js";import"./schema-B5twZahU.js";import"./slugify-CEUa2lfQ.js";import"./use-decopilot-events-CDGgmpnF.js";import"./use-ai-providers-CdtssKYb.js";import"./use-chat-navigation-DXGdGkgT.js";import"./location-BjlyegC2.js";import"./use-organization-settings-BbPuWdeO.js";import"./input-YsTzlSvU.js";import"./usage-stats-DK61cAbW.js";import"./tool-namespace-DHnrXl8N.js";import"./form-CSMe0Xu2.js";import"./label-DXaPh7Je.js";import"./utils-CVEq3hMx.js";import"./markdown-CF_EwD8u.js";import"./use-copy-Cy4qf6se.js";import"./use-mobile-C56EQrK9.js";import"./XClose-B6X-WQEL.js";import"./icon-button-jj21Pfs7.js";import"./file-type-icon-CXYODp5S.js";import"./chat-draft-BfZZImrW.js";import"./LinkBroken01-ZJSQiUDy.js";import"./ArrowUp-DcS4NtQu.js";import"./ShoppingBag01-JCO9eh6X.js";import"./Upload01-CGS2ebmt.js";import"./AlertCircle-SlWthUo-.js";import"./select-7a9WvaWj.js";import"./index-BdQq_4o_.js";import"./index-D_zg5lyX.js";import"./ArrowLeft-KHwg-gY7.js";import"./tabs-gZYZCgK2.js";import"./use-deco-credits-BM65ruxD.js";import"./toggle-group-DZg8BqTb.js";import"./use-open-billing-url-ctn8rgn5.js";import"./index-9Jrp3KlM.js";import"./checkbox-39Y4Yvzb.js";import"./ChevronSelectorVertical-DKuBdQt_.js";import"./Key01-DFRkR5rw.js";import"./SearchMd-5zzeWTKY.js";import"./ai-providers-logos-DD3qZ33J.js";import"./Monitor01-D6P0fhgC.js";import"./popover-fYvCFbz-.js";import"./drawer-SYkf9S3t.js";import"./input-BH4Oxr1L.js";import"./suggestion-DFoIyeE9.js";import"./use-project-native-view-presence-sPhh7BGC.js";import"./use-file-configs-DEeSzk9H.js";import"./site-slug-DebpOoQq.js";import"./use-mcp-prompts-Dk9LHUFW.js";import"./use-org-fs-DpBvFsJy.js";import"./useInfiniteQuery-Z1h_BzmN.js";import"./infiniteQueryObserver-DMUM7SCu.js";import"./Link01-HNlOmSEO.js";import"./question-004-sINsf4GQ.js";import"./feature-paywall-B6WYRGmt.js";import"./plan-ladder-zWIPqL-O.js";import"./add-connection-dialog-gHKHol-P.js";import"./collection-search-BvWeMsnW.js";import"./extract-connection-data-BXwLKN9Y.js";import"./metadata-D72DunRR.js";import"./connection-DE10KgqA.js";import"./url-slug-CF34E0UB.js";import"./connection-card-f5vHryIM.js";import"./connection-slug-CITJ0kGN.js";import"./integration-icon-DQxxCK04.js";import"./textarea-Bej_HjJx.js";import"./use-connection-Bdiz2xzR.js";import"./schema-C_Twe2CR.js";import"./connection-form-helpers-iXh508wY.js";import"./authenticate-and-persist-oauth-Bg2qSKP5.js";import"./mcp-oauth-BPsTeQb9.js";import"./mcp-oauth-CzbNzM03.js";import"./collection-tabs-DMN1FKAg.js";import"./badge-u-FEcB1F.js";import"./use-infinite-scroll-jQz1UxrT.js";import"./useSuspenseInfiniteQuery--UgGWd1x.js";import"./use-task-board-events-HM8tkd7K.js";import"./utils-BdpWMmUt.js";import"./Play-BUzibowQ.js";import"./sandbox-start-errors-BK_aDCyt.js";import"./pair-DP5ED0n_.js";import"./collapsible-DQScoiBp.js";import"./use-clock-tick-BtNyF77k.js";import"./content-blocks-o63cs2vh.js";import"./mcp-app-renderer-SLcpw_GO.js";import"./types-CfDTYsf_.js";import"./omit-sandbox-map-jj4lCB2U.js";import"./sheet-C2JlOlpD.js";import"./use-navigate-to-agent-BdY7K2gs.js";import"./use-thread-outputs-B1zzKutX.js";import"./switch-CFiGUTOP.js";import"./command-bEQWkHWl.js";import"./index-lvmhjtam.js";import"./monaco-editor-dPYi6L5q.js";import"./editor-50pL9wJq.js";import"./calendar-Cms_t32w.js";import"./SwitchHorizontal01-DFdRxYUn.js";import"./editor-classes-tT6DS3c0.js";import"./view-mode-toggle-BuPOaLfD.js";import"./combobox-BbEIMkIW.js";import"./DotsVertical-BRx6WGDK.js";import"./search-input-iONBjTDn.js";import"./use-debounced-value-hKuOSnf8.js";import"./asset-utils-BpRYKiOA.js";import"./sandbox-git-api-CRxdlhrN.js";import"./sandbox-url-D3mC8qhT.js";import"./empty-state-BBRtoH8X.js";import"./Building02-CNZjLCzO.js";import"./CheckCircle-BmoiDiMI.js";import"./CreditCard01-Dy-cJWaD.js";import"./Globe04-C14EHEAN.js";import"./Sun-CZj_t7ip.js";import"./User01-Cs-eJ-Db.js";import"./Users01-B4Uysmrx.js";import"./index-BFoj7reh.js";import"./alert-BpZ59_Gc.js";import"./section-preview-url-7zfngvgW.js";import"./differenceInSeconds-C3x8sHUj.js";import"./project-icon-DijKHVuo.js";import"./new-project-dialog-x3CgBcBd.js";import"./repository-import-picker-DdjluiGQ.js";import"./repository-picker-BHG_Q3_Y.js";import"./required-auth-layout-B4Pt2844.js";import"./use-org-sso-By1UBOKy.js";import"./use-org-auth-client-BQKXCp53.js";const Ll={escape:Ji};function $l(n,e){for(const s of kl(n,e)){const o=typeof s.title=="string"?s.title:void 0;if(o?.includes("{{"))return o}}function zl(n,e){if(!e)return;const s=$a(n);if(s)try{const o=$l(s.resolveType,e);return o&&Fa.render(o,s.data,{},Ll).trim()||void 0}catch{return}}function Hl(n){const e=it.c(13),{icon:s,label:o,className:a}=n;let u;e[0]!==a?(u=ae("size-3.5",a),e[0]=a,e[1]=u):u=e[1];let h;e[2]!==s||e[3]!==u?(h=i.jsx(s,{className:u}),e[2]=s,e[3]=u,e[4]=h):h=e[4];let d;e[5]!==o||e[6]!==h?(d=i.jsx(Et,{asChild:!0,children:i.jsx("span",{role:"img","aria-label":o,className:"shrink-0 cursor-help",children:h})}),e[5]=o,e[6]=h,e[7]=d):d=e[7];let v;e[8]!==o?(v=i.jsx(Rt,{className:"max-w-56",children:o}),e[8]=o,e[9]=v):v=e[9];let m;return e[10]!==d||e[11]!==v?(m=i.jsxs(kt,{children:[d,v]}),e[10]=d,e[11]=v,e[12]=m):m=e[12],m}const Wl="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 io(n){return Array.from({length:n},(e,s)=>({id:crypto.randomUUID(),index:s}))}function ko(n){return n.map((e,s)=>({...e,index:s}))}function ql(n,e){if(e===n.length)return n;if(e<n.length)return ko(n.slice(0,e));const s=Array.from({length:e-n.length},(o,a)=>({id:crypto.randomUUID(),index:n.length+a}));return[...n,...s]}function Eo(n){const e=it.c(44),{section:s,raw:o,meta:a,decofile:u}=n,h=Ft(),d=Wn(),v=s.isSavedBlock===!0,m=s.isMultivariate===!0;let j;e[0]!==a||e[1]!==o?(j=o&&a?El(o,a):void 0,e[0]=a,e[1]=o,e[2]=j):j=e[2];const A=j;let $;e[3]!==a||e[4]!==m||e[5]!==o||e[6]!==v?($=o&&a&&!v&&!m?zl(o,a):void 0,e[3]=a,e[4]=m,e[5]=o,e[6]=v,e[7]=$):$=e[7];const z=$;let H;e[8]!==u||e[9]!==a||e[10]!==o||e[11]!==s?(H=na(o,s,u,a),e[8]=u,e[9]=a,e[10]=o,e[11]=s,e[12]=H):H=e[12];const F=H;let f;e[13]!==m||e[14]!==o?.__resolveType?(f=!m&&Rs(o?.__resolveType??""),e[13]=m,e[14]=o?.__resolveType,e[15]=f):f=e[15];const k=f,X=v?zn:m?bo:_o;let w;e[16]!==m||e[17]!==v?(w=v?{color:za}:m?{color:"oklch(0.65 0.15 160)"}:void 0,e[16]=m,e[17]=v,e[18]=w):w=e[18];const I=w;let V;e[19]!==X||e[20]!==d?(V=d?i.jsxs("span",{className:"relative size-4 shrink-0",children:[i.jsx(X,{className:"absolute inset-0 size-4 text-muted-foreground transition-opacity group-hover:opacity-0 group-has-[:focus-visible]:opacity-0"}),i.jsx(ra,{"aria-hidden":!0,className:"absolute inset-0 size-4 opacity-0 transition-opacity group-hover:opacity-100 group-has-[:focus-visible]:opacity-100"})]}):i.jsx(Aa,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[19]=X,e[20]=d,e[21]=V):V=e[21];let y;e[22]!==A?(y=A&&i.jsx("img",{src:A,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded-[var(--studio-control-radius,var(--radius))] object-cover"}),e[22]=A,e[23]=y):y=e[23];let C;e[24]!==d||e[25]!==I?(C=!d&&i.jsx(Ss,{className:"h-4 w-4 shrink-0",style:I}),e[24]=d,e[25]=I,e[26]=C):C=e[26];const x=d?"shrink":"flex-1",Y=s.isHidden&&"line-through opacity-50";let M;e[27]!==Y||e[28]!==x?(M=ae("min-w-0 truncate text-sm font-medium",x,Y),e[27]=Y,e[28]=x,e[29]=M):M=e[29];const ge=z??s.label;let me;e[30]!==M||e[31]!==ge?(me=i.jsx("span",{className:M,children:ge}),e[30]=M,e[31]=ge,e[32]=me):me=e[32];let le;e[33]!==k||e[34]!==d||e[35]!==F||e[36]!==h?(le=d?i.jsxs(i.Fragment,{children:[k&&i.jsx(Hl,{icon:bs,label:h("sectionsEditor.sectionList.asyncBadge"),className:"text-muted-foreground"}),F&&i.jsx(Br,{}),i.jsx("span",{className:"min-w-0 flex-1"})]}):F&&i.jsx(Br,{className:"absolute -right-0.5 -top-0.5"}),e[33]=k,e[34]=d,e[35]=F,e[36]=h,e[37]=le):le=e[37];let ee;return e[38]!==me||e[39]!==le||e[40]!==V||e[41]!==y||e[42]!==C?(ee=i.jsxs(i.Fragment,{children:[V,y,C,me,le]}),e[38]=me,e[39]=le,e[40]=V,e[41]=y,e[42]=C,e[43]=ee):ee=e[43],ee}const Gl="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",Ul="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)]";function Ro(n,e,s){if(s)return sa({selected:e});const o=n.isSavedBlock===!0,a=n.isMultivariate===!0;return ae("group relative flex select-none items-center gap-2 rounded-[var(--studio-control-radius,var(--radius-md))] px-2 py-2.5",e?"bg-accent text-accent-foreground":o?Gl:a?Ul:"text-foreground/80 hover:bg-accent hover:text-accent-foreground")}function ps(n,e){return ae("h-7 shrink-0 overflow-hidden",e?"w-7 ml-0 opacity-100 [transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]":n?"w-7 ml-0 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:opacity-100 group-has-[:focus-visible]:opacity-100":"w-0 -ml-2 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:ml-0 group-hover:w-7 group-hover:opacity-100 group-hover:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms] group-has-[:focus-visible]:ml-0 group-has-[:focus-visible]:w-7 group-has-[:focus-visible]:opacity-100 group-has-[:focus-visible]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]")}function Yl(n){const e=it.c(90),{section:s,raw:o,meta:a,decofile:u,sortableId:h,selected:d,onSelect:v,onDelete:m,onDuplicate:j,onMakeReusable:A,onToggleHidden:$,onToggleLazy:z,onAddVariant:H,onDetach:F}=n,f=Ft(),k=Wn(),X=o?Rs(o.__resolveType??""):!1,w=s.isHidden===!0,I=X||w;let V;e[0]!==s?(V=jo(s),e[0]=s,e[1]=V):V=e[1];const y=V,C=!!z&&!s.isMultivariate;let x;e[2]!==h?(x={id:h,animateLayoutChanges:Xl},e[2]=h,e[3]=x):x=e[3];const{attributes:Y,listeners:M,setNodeRef:ge,transform:me,isDragging:le}=bl(x);let ee;e[4]!==me?(ee=xl.Transform.toString(me?{...me,x:0}:null),e[4]=me,e[5]=ee):ee=e[5];const pe=le?0:void 0;let ce;e[6]!==ee||e[7]!==pe?(ce={transform:ee,opacity:pe},e[6]=ee,e[7]=pe,e[8]=ce):ce=e[8];const he=ce;let ve;e[9]!==s?(ve=Xi(s),e[9]=s,e[10]=ve):ve=e[10];const b=ve,B="button",xe=0;let T;e[11]!==v?(T=re=>{(re.key==="Enter"||re.key===" ")&&(re.preventDefault(),v())},e[11]=v,e[12]=T):T=e[12];const ye=le?"cursor-grabbing":"cursor-pointer";let K;e[13]!==k||e[14]!==s||e[15]!==d||e[16]!==ye?(K=ae("touch-none transition-colors",ye,Ro(s,d,k)),e[13]=k,e[14]=s,e[15]=d,e[16]=ye,e[17]=K):K=e[17];let Se;e[18]!==u||e[19]!==a||e[20]!==o||e[21]!==s?(Se=i.jsx(Eo,{section:s,raw:o,meta:a,decofile:u}),e[18]=u,e[19]=a,e[20]=o,e[21]=s,e[22]=Se):Se=e[22];const ue=!k&&C&&i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"ghost",size:"icon","aria-label":f(X?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender"),className:ae(ps(I,X)),onClick:re=>{re.stopPropagation(),z?.()},onPointerDown:Ql,children:i.jsx(bs,{className:ae("h-3.5 w-3.5",X&&"text-warning")})})}),i.jsx(Rt,{side:"bottom",children:f(X?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")})]}),te=k?i.jsx(Zi,{label:f(w?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),active:w,onToggle:$,children:w?i.jsx(Zr,{className:"h-3.5 w-3.5"}):i.jsx(eo,{className:"h-3.5 w-3.5"})}):i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"ghost",size:"icon","aria-label":f(w?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),className:ae(ps(I,w)),onClick:re=>{re.stopPropagation(),$()},onPointerDown:Jl,children:w?i.jsx(Zr,{className:"h-3.5 w-3.5"}):i.jsx(eo,{className:"h-3.5 w-3.5"})})}),i.jsx(Rt,{side:"bottom",children:f(w?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection")})]}),se=zi,Te=ea;let Z;e[23]!==f?(Z=f("sectionsEditor.sectionList.sectionActionsMenu"),e[23]=f,e[24]=Z):Z=e[24];const _e=ae(ps(I,!1),"data-[state=open]:ml-0 data-[state=open]:w-7 data-[state=open]:opacity-100 data-[state=open]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]");let be;e[25]!==Te||e[26]!==Z||e[27]!==_e?(be=i.jsx(Te,{label:Z,classicClassName:_e}),e[25]=Te,e[26]=Z,e[27]=_e,e[28]=be):be=e[28];let q;e[29]!==k||e[30]!==C||e[31]!==X||e[32]!==z||e[33]!==f?(q=k&&C&&i.jsxs(i.Fragment,{children:[i.jsxs(sn,{onClick:re=>{re.stopPropagation(),z?.()},children:[i.jsx(bs,{className:"h-4 w-4"}),f(X?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")]}),i.jsx($i,{})]}),e[29]=k,e[30]=C,e[31]=X,e[32]=z,e[33]=f,e[34]=q):q=e[34];let O;e[35]!==j?(O=re=>{re.stopPropagation(),j()},e[35]=j,e[36]=O):O=e[36];let Ke;e[37]===Symbol.for("react.memo_cache_sentinel")?(Ke=i.jsx(dl,{className:"h-4 w-4"}),e[37]=Ke):Ke=e[37];let Qe;e[38]!==f?(Qe=f("sectionsEditor.sectionList.duplicateMenuItem"),e[38]=f,e[39]=Qe):Qe=e[39];let Xe;e[40]!==O||e[41]!==Qe?(Xe=i.jsxs(sn,{onClick:O,children:[Ke,Qe]}),e[40]=O,e[41]=Qe,e[42]=Xe):Xe=e[42];let Ye;e[43]!==k||e[44]!==y||e[45]!==H||e[46]!==f?(Ye=y&&i.jsxs(sn,{className:ae(!k&&ta),onClick:re=>{re.stopPropagation(),H()},children:[i.jsx(bo,{className:"h-4 w-4"}),f("sectionsEditor.sectionList.addVariantMenuItem")]}),e[43]=k,e[44]=y,e[45]=H,e[46]=f,e[47]=Ye):Ye=e[47];let Q;e[48]!==k||e[49]!==b||e[50]!==A||e[51]!==f?(Q=b&&i.jsxs(sn,{className:ae(!k&&Wl),onClick:re=>{re.stopPropagation(),A()},children:[k?i.jsx(zn,{className:"h-4 w-4"}):i.jsx(Ss,{className:"h-4 w-4"}),f("sectionsEditor.sectionList.makeReusableMenuItem")]}),e[48]=k,e[49]=b,e[50]=A,e[51]=f,e[52]=Q):Q=e[52];let ke;e[53]!==k||e[54]!==F||e[55]!==s.isMultivariate||e[56]!==s.isSavedBlock||e[57]!==f?(ke=s.isSavedBlock===!0&&!s.isMultivariate&&i.jsxs(sn,{onClick:re=>{re.stopPropagation(),F()},children:[k?i.jsx(_o,{className:"h-4 w-4"}):i.jsx(Ss,{className:"h-4 w-4"}),f("sectionsEditor.sectionList.detachMenuItem")]}),e[53]=k,e[54]=F,e[55]=s.isMultivariate,e[56]=s.isSavedBlock,e[57]=f,e[58]=ke):ke=e[58];let He;e[59]!==m?(He=re=>{re.stopPropagation(),m()},e[59]=m,e[60]=He):He=e[60];let We;e[61]===Symbol.for("react.memo_cache_sentinel")?(We=i.jsx(ml,{className:"h-4 w-4"}),e[61]=We):We=e[61];let Ee;e[62]!==f?(Ee=f("sectionsEditor.sectionList.deleteMenuItem"),e[62]=f,e[63]=Ee):Ee=e[63];let Ie;e[64]!==He||e[65]!==Ee?(Ie=i.jsxs(sn,{variant:"destructive",onClick:He,children:[We,Ee]}),e[64]=He,e[65]=Ee,e[66]=Ie):Ie=e[66];let Ve;e[67]!==q||e[68]!==Xe||e[69]!==Ye||e[70]!==Q||e[71]!==ke||e[72]!==Ie?(Ve=i.jsxs(Hi,{align:"end",className:"w-44",children:[q,Xe,Ye,Q,ke,Ie]}),e[67]=q,e[68]=Xe,e[69]=Ye,e[70]=Q,e[71]=ke,e[72]=Ie,e[73]=Ve):Ve=e[73];let Ze;e[74]!==se||e[75]!==be||e[76]!==Ve?(Ze=i.jsxs(se,{children:[be,Ve]}),e[74]=se,e[75]=be,e[76]=Ve,e[77]=Ze):Ze=e[77];let Fe;return e[78]!==Y||e[79]!==M||e[80]!==v||e[81]!==ge||e[82]!==he||e[83]!==K||e[84]!==Se||e[85]!==ue||e[86]!==te||e[87]!==Ze||e[88]!==T?(Fe=i.jsxs("div",{ref:ge,style:he,...Y,...M,role:B,tabIndex:xe,onClick:v,onKeyDown:T,className:K,children:[Se,ue,te,Ze]}),e[78]=Y,e[79]=M,e[80]=v,e[81]=ge,e[82]=he,e[83]=K,e[84]=Se,e[85]=ue,e[86]=te,e[87]=Ze,e[88]=T,e[89]=Fe):Fe=e[89],Fe}function Jl(n){return n.stopPropagation()}function Ql(n){return n.stopPropagation()}function Xl(){return!1}function js(n){const e=it.c(11),{canAddSection:s,onAddSection:o,className:a,size:u}=n,h=Ft();let d;e[0]!==a?(d=ae("w-full",a),e[0]=a,e[1]=d):d=e[1];const v=!s;let m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=i.jsx(fl,{size:14}),e[2]=m):m=e[2];let j;e[3]!==h?(j=h("sectionsEditor.sectionList.addSectionButton"),e[3]=h,e[4]=j):j=e[4];let A;return e[5]!==o||e[6]!==u||e[7]!==d||e[8]!==v||e[9]!==j?(A=i.jsxs(_t,{type:"button",variant:"outline",size:u,className:d,disabled:v,onClick:o,children:[m,j]}),e[5]=o,e[6]=u,e[7]=d,e[8]=v,e[9]=j,e[10]=A):A=e[10],A}function Zl(n){const e=it.c(101),{listKey:s,rawSections:o,sections:a,meta:u,decofile:h,selectedIndex:d,onSelect:v,onReorder:m,onDelete:j,onDuplicate:A,onMakeReusable:$,onToggleHidden:z,onToggleLazy:H,onAddVariant:F,onDetach:f,onAddSection:k,canAddSection:X}=n,w=X===void 0?!0:X,I=Ft(),V=Wn();let y;e[0]!==a.length?(y=()=>io(a.length),e[0]=a.length,e[1]=y):y=e[1];const[C,x]=R.useState(y),[Y,M]=R.useState(null),[ge,me]=R.useState(s),[le,ee]=R.useState(a.length),pe=R.useRef(!1);ge!==s?(me(s),ee(a.length),x(io(a.length))):le!==a.length&&(ee(a.length),x(dt=>ql(dt,a.length)));let ce;e[2]===Symbol.for("react.memo_cache_sentinel")?(ce={activationConstraint:{distance:8}},e[2]=ce):ce=e[2];let he;e[3]===Symbol.for("react.memo_cache_sentinel")?(he={coordinateGetter:jl},e[3]=he):he=e[3];const ve=pl(to(gl,ce),to(hl,he));let b;e[4]!==C?(b=C.map(ec),e[4]=C,e[5]=b):b=e[5];const B=b;let xe;e[6]===Symbol.for("react.memo_cache_sentinel")?(xe=dt=>{M(String(dt.active.id))},e[6]=xe):xe=e[6];const T=xe;let ye;e[7]!==B||e[8]!==m?(ye=dt=>{M(null);const{active:ne,over:De}=dt;if(!De||ne.id===De.id)return;const yt=B.indexOf(String(ne.id)),et=B.indexOf(String(De.id));yt===-1||et===-1||(x(ft=>ko(Ln([...ft],yt,et))),pe.current=!0,requestAnimationFrame(()=>{pe.current=!1}),m?.(yt,et))},e[7]=B,e[8]=m,e[9]=ye):ye=e[9];const K=ye;let Se;e[10]===Symbol.for("react.memo_cache_sentinel")?(Se=()=>{M(null)},e[10]=Se):Se=e[10];const ue=Se;let te,se,Te,Z,_e,be,q,O,Ke,Qe,Xe,Ye,Q,ke,He;if(e[11]!==Y||e[12]!==w||e[13]!==V||e[14]!==h||e[15]!==C||e[16]!==B||e[17]!==K||e[18]!==u||e[19]!==k||e[20]!==F||e[21]!==j||e[22]!==f||e[23]!==A||e[24]!==$||e[25]!==v||e[26]!==z||e[27]!==H||e[28]!==o||e[29]!==a||e[30]!==d||e[31]!==ve||e[32]!==I){ke=Symbol.for("react.early_return_sentinel");e:{const dt=ne=>{pe.current||v(ne)};if(e[48]!==Y||e[49]!==w||e[50]!==V||e[51]!==C||e[52]!==k||e[53]!==o||e[54]!==a||e[55]!==I){const ne=Y?C.find(De=>De.id===Y):null;if(Z=ne!=null?a[ne.index]:null,Te=ne!=null?o[ne.index]:void 0,C.length===0){let De;e[59]!==I?(De=I("sectionsEditor.sectionList.noSections"),e[59]=I,e[60]=De):De=e[60];let yt;e[61]!==De?(yt=i.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:De}),e[61]=De,e[62]=yt):yt=e[62];const et=yt;let ft;e[63]!==w||e[64]!==V||e[65]!==et||e[66]!==k?(ft=V?et:i.jsxs("div",{className:"space-y-2",children:[et,i.jsx(js,{canAddSection:w,onAddSection:k,size:"sm"})]}),e[63]=w,e[64]=V,e[65]=et,e[66]=k,e[67]=ft):ft=e[67],ke=ft;break e}Q=ae(ne&&"cursor-grabbing"),e[48]=Y,e[49]=w,e[50]=V,e[51]=C,e[52]=k,e[53]=o,e[54]=a,e[55]=I,e[56]=Te,e[57]=Z,e[58]=Q}else Te=e[56],Z=e[57],Q=e[58];se=yl,O=ve,Ke=Sl,Qe=T,Xe=K,Ye=ue,te=wl,be=B,q=_l,He="space-y-1",_e=C.map(ne=>{const De=a[ne.index];return De?i.jsx(Yl,{sortableId:ne.id,section:De,raw:o[ne.index],meta:u,decofile:h,selected:d===ne.index,onSelect:()=>dt(ne.index),onDelete:()=>j(ne.index),onDuplicate:()=>A(ne.index),onMakeReusable:()=>$(ne.index),onToggleHidden:()=>z(ne.index),onToggleLazy:H?()=>H(ne.index):void 0,onAddVariant:()=>F(ne.index),onDetach:()=>f(ne.index)},ne.id):null})}e[11]=Y,e[12]=w,e[13]=V,e[14]=h,e[15]=C,e[16]=B,e[17]=K,e[18]=u,e[19]=k,e[20]=F,e[21]=j,e[22]=f,e[23]=A,e[24]=$,e[25]=v,e[26]=z,e[27]=H,e[28]=o,e[29]=a,e[30]=d,e[31]=ve,e[32]=I,e[33]=te,e[34]=se,e[35]=Te,e[36]=Z,e[37]=_e,e[38]=be,e[39]=q,e[40]=O,e[41]=Ke,e[42]=Qe,e[43]=Xe,e[44]=Ye,e[45]=Q,e[46]=ke,e[47]=He}else te=e[33],se=e[34],Te=e[35],Z=e[36],_e=e[37],be=e[38],q=e[39],O=e[40],Ke=e[41],Qe=e[42],Xe=e[43],Ye=e[44],Q=e[45],ke=e[46],He=e[47];if(ke!==Symbol.for("react.early_return_sentinel"))return ke;let We;e[68]!==_e||e[69]!==He?(We=i.jsx("div",{className:He,children:_e}),e[68]=_e,e[69]=He,e[70]=We):We=e[70];let Ee;e[71]!==te||e[72]!==be||e[73]!==q||e[74]!==We?(Ee=i.jsx(te,{items:be,strategy:q,children:We}),e[71]=te,e[72]=be,e[73]=q,e[74]=We,e[75]=Ee):Ee=e[75];let Ie;e[76]!==Te||e[77]!==Z||e[78]!==V||e[79]!==h||e[80]!==u?(Ie=Z?i.jsx("div",{className:ae("cursor-grabbing shadow-lg ring-1 ring-border/60",Ro(Z,!1,V)),children:i.jsx(Eo,{section:Z,raw:Te,meta:u,decofile:h})}):null,e[76]=Te,e[77]=Z,e[78]=V,e[79]=h,e[80]=u,e[81]=Ie):Ie=e[81];let Ve;e[82]!==Ie?(Ve=Li.createPortal(i.jsx(vl,{dropAnimation:Qi,children:Ie}),document.body),e[82]=Ie,e[83]=Ve):Ve=e[83];let Ze;e[84]!==se||e[85]!==O||e[86]!==Ke||e[87]!==Qe||e[88]!==Xe||e[89]!==Ye||e[90]!==Ee||e[91]!==Ve?(Ze=i.jsxs(se,{sensors:O,collisionDetection:Ke,onDragStart:Qe,onDragEnd:Xe,onDragCancel:Ye,children:[Ee,Ve]}),e[84]=se,e[85]=O,e[86]=Ke,e[87]=Qe,e[88]=Xe,e[89]=Ye,e[90]=Ee,e[91]=Ve,e[92]=Ze):Ze=e[92];let Fe;e[93]!==w||e[94]!==V||e[95]!==k?(Fe=!V&&i.jsx(js,{canAddSection:w,onAddSection:k,size:"sm",className:"mt-2"}),e[93]=w,e[94]=V,e[95]=k,e[96]=Fe):Fe=e[96];let re;return e[97]!==Q||e[98]!==Ze||e[99]!==Fe?(re=i.jsxs("div",{className:Q,children:[Ze,Fe]}),e[97]=Q,e[98]=Ze,e[99]=Fe,e[100]=re):re=e[100],re}function ec(n){return n.id}function hs(n,e,s,o){if(!n||!e)return null;if(!e.isMultivariate)return jt(n,e,o)?.data??null;const a=xt(n,e),u=a?vs(a,wt)[s]:void 0;return u?wo(u.value,o)?.data??null:null}const tc=50;function nc(n,e){n.own.push(ze(e)),n.own.length>tc&&n.own.shift()}function ao(n,e){return n.own.includes(ze(e))}function sc(n,e){const{sectionIndex:s,variantIndex:o,shown:a,next:u,sectionCount:h}=e;return n&&n.sectionIndex===s&&n.variantIndex===o&&n.emitted===a?(n.emitted=u,n):a?{sectionIndex:s,variantIndex:o,base:a,emitted:u,sectionCount:h,own:[ze(a)]}:null}function Ao(n,e){return e!==null&&ze(n)!==ze(e)}function Co(n,e){return n.__resolveType!==e.__resolveType}function rc(n,e,s,o){if(e.length===o)return"here";const a=ze(n),u=e.flatMap((h,d)=>d!==s&&h!==null&&ze(h)===a?[d]:[]);return u.length===1?u[0]:"unknown"}function lo({formBase:n,rebased:e,versionOf:s}){let o=null;return{ifMatch:a=>{o=a,n&&(n.version===void 0||e)&&(n.version=s(a));const u=n?n.version:s(a);return u===void 0?void 0:{[a]:u}},onApplied:a=>{n&&o!==null&&Object.hasOwn(a,o)&&(n.version=a[o])},reloadOnConflict:!0}}function oc({merged:n,tracked:e,current:s,saved:o}){return!!n&&!!e&&s===e&&e.emitted===o}function co(n,e){return!!n&&!!e&&n.contains(e)}function ws(n){const e=[],s=_s("",n.ancestor,n.mine,n.theirs,e);return{...n,merged:s,pointers:e}}function _s(n,e,s,o,a){const u=(h,d)=>ze(h)===ze(d);if(u(s,o)||u(e,o))return s;if(u(e,s))return o;if(gs(s)&&gs(o)){const h=gs(e)?e:{},d={},v=[...Object.keys(s),...Object.keys(o).filter(m=>!(m in s))];for(const m of v){const j=_s(`${n}/${m.replaceAll("~","~0").replaceAll("/","~1")}`,h[m],s[m],o[m],a);j!==void 0&&(d[m]=j)}return d}return Array.isArray(e)&&Array.isArray(s)&&Array.isArray(o)&&s.length===e.length&&o.length===e.length?e.map((h,d)=>_s(`${n}/${d}`,h,s[d],o[d],a)):(a.push(n),o)}function gs(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}function ic(n,e){let s=n.merged;for(const o of n.pointers)e[o]==="mine"&&(s=uc(s,o,Ut(n.mine,o)));return s}function ac(n,e){return Object.fromEntries(n.pointers.map(s=>[s,e]))}function No(n){return ac(n,"mine")}function ks(n,e,s){const o=No(s);for(const a of s.pointers){const u=e[a];if(!u||!n.pointers.includes(a))continue;["mine","theirs"].every(d=>ze(Ut(n[d],a))===ze(Ut(s[d],a)))&&(o[a]=u)}return o}function To(n,e,s={}){const o=e.pointers.filter(a=>!n.pointers.includes(a)||ze(Ut(n.theirs,a))!==ze(Ut(e.theirs,a)));return o.length===0?s:{...s,...Object.fromEntries(o.map(a=>[a,(s[a]??0)+1]))}}function lc(n,e,s){if(!e||Co(n.plan.ancestor,e)||!Ao(n.plan.theirs,e)||s(e))return null;const o=ws({...n.plan,theirs:e});return o.pointers.length===0?null:{plan:o,choices:ks(n.plan,n.choices,o),fresh:To(n.plan,o,n.fresh)}}function cc(n,e){return n.pointers.map(s=>({pointer:s,label:oa(s,e),mine:Ut(n.mine,s),theirs:Ut(n.theirs,s),schema:dc(e??null,s)}))}function As(n){return n.split("/").slice(1).map(e=>e.replaceAll("~1","/").replaceAll("~0","~"))}function Ut(n,e){let s=n;for(const o of As(e))if(Array.isArray(s))s=s[Number(o)];else if(s&&typeof s=="object")s=s[o];else return;return s}function uc(n,e,s){const o=As(e),a=(u,h)=>{if(h===o.length)return s;const d=o[h];if(Array.isArray(u)){const j=[...u];return j[Number(d)]=a(u[Number(d)],h+1),j}const v=u&&typeof u=="object"?{...u}:{},m=a(v[d],h+1);return m===void 0?delete v[d]:v[d]=m,v};return a(n,0)}function dc(n,e){let s=n;for(const o of As(e)){if(!s)return null;s=/^\d+$/.test(o)&&!s.properties?.[o]?s.items:s.properties?.[o]}return s??null}const fc=/\.(png|jpe?g|gif|webp|avif|svg)(\?.*)?$/i,uo=60,mc=3;function Vo(n,e){return e?.format==="image-uri"?!0:n.startsWith("data:image/")||/^(https?:)?\/\//.test(n)&&fc.test(n)}function Es(n,e){if(!(e?.format==="rich-text"||e?.format==="rich-text-inline"||e?.format==="html"||/<\/?[a-z][^>]*>/i.test(n)))return n;const o=n.replace(/<br\s*\/?>/gi,`
|
|
1
|
+
import{c as it,b as Ft,r as R,l as ae,j as i,b4 as Li,B as _t,U as sn,aw as $i,X as zi,V as Hi,a as xo,F as Wi,K as yo,m as qi,o as Gi,h as Ui,t as oe}from"./index-CTZFCFor.js";import{u as Yi}from"./chat-context-CShbCUNX.js";import{a5 as Ji,T as Wn,a6 as Qi,a7 as Zi,a8 as Xi,a9 as ea,aa as ta,ab as na,ac as Br,ad as sa,ae as ra,G as jt,af as wt,ag as ze,ah as oa,H as Fn,E as On,b as ia,j as aa,u as la,ai as Kr,q as ca,aj as ua,s as da,o as fa,ak as So,p as _n,al as ma,am as pa,A as Fr,an as ha,ao as ga,ap as Bn,aq as Or,ar as Lr,as as $r,at as us,au as va,av as xa,F as ya,aw as zr,ax as Sa,ay as Hr,az as Wr,M as ba,aA as qr,a as ja,aB as Sn,aC as wa,aD as _a,aE as bn,aF as ds}from"./blocks-tab-states-Db9AzGGz.js";import{c as ka}from"./repository-binding-CbZ7gDPF.js";import{n as Ea,t as Ra}from"./ChevronUp-D5DP9qHs.js";import{a8 as bo,b as zn,an as Aa,D as Ca,a1 as Gr,Z as Ur}from"./agent-icon-CdvQWbsW.js";import{S as rn}from"./scroll-area-CioiKzlv.js";import{c as kt,T as Et,a as Rt}from"./tooltip-OCAaNJPG.js";import{am as Na,g as Yr,J as Ta,u as Va,K as Da,w as Ma,ab as Pa,x as Ia,d as Pt,f as It,a7 as Ba,ar as Ka}from"./site-editor-toast-7y5QejdX.js";import{m as Fa,u as Oa,P as La}from"./mustache-BopKjK4y.js";import{az as $a,k as Rs,aB as jo,H as za,aC as xt,aD as vs,aE as wo,aj as Gt,a8 as xs,aF as ys,ak as Kt,a9 as on,q as Ha,t as Wa,g as qa,x as Kn,ar as Ga,ai as jn,aa as fs,ah as Bt,ag as wn,aG as Ua,P as Ya,aH as Ja,al as Jr,a1 as Qr,aI as Qa,aJ as qt,aK as Za,aL as Xa,aM as el,aN as Zr,aO as tl,aP as nl,aQ as sl,af as rl,aR as ol,aS as il,aT as al,aU as ll,ae as cl,aV as ul}from"./secret-ciphertext-FPLrd6Sz.js";import{a as dl}from"./Copy01-51uCRbSg.js";import{a as Ss,e as _o}from"./UserSquare-J-pPBDsM.js";import{i as Xr}from"./Tool01-BxfOk1kQ.js";import{s as eo}from"./Image01-8_YUB9dA.js";import{s as fl}from"./Plus-Bk_sjqOf.js";import{s as ml}from"./Trash01-CMp64biU.js";import{i as bs}from"./ZoomOut-DAA80mSj.js";import{u as pl,a as to,K as hl,P as gl,b as vl,C as xl,D as yl,c as Sl}from"./core.esm-DySokeDD.js";import{u as bl,s as jl,a as Ln,S as wl,v as _l}from"./sortable.esm-BOb8_093.js";import{s as kl,g as El,u as Rl,A as Al}from"./use-section-preview-base-CYSL7sBu.js";import{A as ms}from"./avatar-V-6seD4f.js";import{e as Cl,d as no,b as Nl,A as Tl,a as Vl,f as Dl}from"./alert-dialog-C9FvnbJH.js";import{b as Ml}from"./format-time-CAj8AQXM.js";import{d as Pl}from"./shell-layout-Dhz9Exq4.js";import{u as Il}from"./use-members-DKFjOBdl.js";import{a as Bl,P as so,b as Kl}from"./page-seo-form-C26iJCis.js";import{c as ro,d as oo,e as Fl,f as Ol}from"./variant-draft-pointer-OJYw4Y1_.js";import"./use-panel-navigate-BhXVoQPa.js";import"./thread-route-dlwv4_1A.js";import"./use-project-scope-B3s9YTAH.js";import"./autosend-BfqtXC9i.js";import"./thread-intent-b5vpifzT.js";import"./use-mcp-client-jKOlHdKM.js";import"./auth-MJlmDrih.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./watch-sse-pool-CEcxThGW.js";import"./task-board-Cfny2jqU.js";import"./schema-BpLx5lXs.js";import"./slugify-CEUa2lfQ.js";import"./use-decopilot-events-BGdkAbxA.js";import"./use-ai-providers-r5JMl3Dn.js";import"./use-chat-navigation-B7jtkmO9.js";import"./location-BjlyegC2.js";import"./use-organization-settings-NMl9AK6V.js";import"./input-zzyYgG2z.js";import"./usage-stats-k4aXi0cR.js";import"./tool-namespace-BEzs43Ur.js";import"./form-C3-gqoE3.js";import"./label-BxQ_dsc6.js";import"./utils-CVEq3hMx.js";import"./markdown-B3gUf9fq.js";import"./use-copy-DIsWFSvt.js";import"./use-mobile-CmswU9_U.js";import"./XClose-BnQLG2SG.js";import"./icon-button-BS-JGKQE.js";import"./file-type-icon-DuTvDFZv.js";import"./chat-draft-D5xPO9J5.js";import"./LinkBroken01-DvM0DBf8.js";import"./ArrowUp-BYzq623p.js";import"./ShoppingBag01-DmYaqF6W.js";import"./Upload01-Dgeov9JH.js";import"./AlertCircle-Bty2uhsk.js";import"./select-CMGxS2qh.js";import"./index-BdQq_4o_.js";import"./index-DQRAWCM4.js";import"./ArrowLeft-CGwuLtbU.js";import"./tabs-D7n9t3lM.js";import"./use-deco-credits-CbC5ZgVr.js";import"./toggle-group-DHp1u7am.js";import"./use-open-billing-url-BGaG_eVz.js";import"./index-DN6_-RzX.js";import"./checkbox-CsdxV5F4.js";import"./ChevronSelectorVertical-BwRvUPUM.js";import"./Key01-BYJLiX2A.js";import"./SearchMd-Cey_qFlh.js";import"./ai-providers-logos-DD3qZ33J.js";import"./Monitor01-D0i8fPos.js";import"./popover-DZg3XzK_.js";import"./drawer-CY01gtte.js";import"./input-CAuGdxaS.js";import"./suggestion-D_2yEjf4.js";import"./use-mcp-prompts-KLIBV_YA.js";import"./use-org-fs-5rCZZYw5.js";import"./useInfiniteQuery-DOKZzanu.js";import"./infiniteQueryObserver-DjFxX3t4.js";import"./Link01-BrX96Lzm.js";import"./question-004-sINsf4GQ.js";import"./feature-paywall-BVtlmh2X.js";import"./plan-ladder-D42bnzq6.js";import"./add-connection-dialog-DJYTiZdc.js";import"./collection-search-B8HvNhHx.js";import"./extract-connection-data-CxPHH0g-.js";import"./metadata-D72DunRR.js";import"./connection-DS2m6_aA.js";import"./url-slug-BDqmchWv.js";import"./connection-card-C1INmiO3.js";import"./connection-slug-CITJ0kGN.js";import"./integration-icon-DedJ1gFL.js";import"./textarea-D-r53Xtx.js";import"./use-connection-Bc66r7WR.js";import"./schema-B3PJAfvC.js";import"./connection-form-helpers-Bdbv__5q.js";import"./authenticate-and-persist-oauth-DjLIsCBn.js";import"./mcp-oauth-Dx8iOGEt.js";import"./mcp-oauth-DnmbC1ZC.js";import"./collection-tabs-P32YIIxy.js";import"./badge-xuppbiJQ.js";import"./use-infinite-scroll-qQBI_BkS.js";import"./useSuspenseInfiniteQuery-gQb4-5BD.js";import"./use-task-board-events-CWFDTGYW.js";import"./use-project-native-view-presence-DgH1oa2Q.js";import"./use-file-configs-Da0V_POi.js";import"./site-slug-DebpOoQq.js";import"./utils-DqXf9fJY.js";import"./Play-BefGY3fA.js";import"./sandbox-start-errors-BK_aDCyt.js";import"./pair-BXKJ75t2.js";import"./collapsible-pbpDRVGu.js";import"./use-clock-tick-CdAPP8z5.js";import"./content-blocks-o63cs2vh.js";import"./mcp-app-renderer-4oVWjJbt.js";import"./types-DSl6aKYl.js";import"./omit-sandbox-map-jj4lCB2U.js";import"./sheet-BRHzkcNr.js";import"./use-navigate-to-agent-DvsN-N9f.js";import"./use-thread-outputs-BOAz3j7m.js";import"./switch-DGEo5K4-.js";import"./command-CdQubtgL.js";import"./index-JOoGKn03.js";import"./monaco-editor-C1ThyHfg.js";import"./editor-BMsJkpc5.js";import"./calendar-BFQivyIG.js";import"./SwitchHorizontal01-Cpiuomvl.js";import"./editor-classes-hvMxYRPw.js";import"./view-mode-toggle-ImzlJONT.js";import"./combobox-95bHdh7B.js";import"./DotsVertical-Bhq6_ex6.js";import"./search-input-OMtFZb1f.js";import"./use-debounced-value-Cv1nzd8k.js";import"./asset-utils-D7MF6-R7.js";import"./sandbox-git-api-CRxdlhrN.js";import"./sandbox-url-D3mC8qhT.js";import"./empty-state-DbF1fVB1.js";import"./Building02-DC1B_tJa.js";import"./CheckCircle-DPGL3Hpc.js";import"./CreditCard01-D8QKn2t6.js";import"./Globe04-C6aR04Lg.js";import"./Sun-Vjoy_5bv.js";import"./User01-hKw9FGQs.js";import"./Users01-D83kTTD4.js";import"./index-CylNQm53.js";import"./alert-CpswsOed.js";import"./section-preview-url-7zfngvgW.js";import"./differenceInSeconds-C3x8sHUj.js";import"./project-icon-Cd3AxOfl.js";import"./new-project-dialog--6a9GYsY.js";import"./repository-import-picker-CqejRBEV.js";import"./repository-picker-lc5PVuph.js";import"./required-auth-layout-obZ6miVT.js";import"./use-org-sso-meIc9b7s.js";import"./use-org-auth-client-DyhHIXwn.js";const Ll={escape:Ji};function $l(n,e){for(const s of kl(n,e)){const o=typeof s.title=="string"?s.title:void 0;if(o?.includes("{{"))return o}}function zl(n,e){if(!e)return;const s=$a(n);if(s)try{const o=$l(s.resolveType,e);return o&&Fa.render(o,s.data,{},Ll).trim()||void 0}catch{return}}function Hl(n){const e=it.c(13),{icon:s,label:o,className:a}=n;let u;e[0]!==a?(u=ae("size-3.5",a),e[0]=a,e[1]=u):u=e[1];let h;e[2]!==s||e[3]!==u?(h=i.jsx(s,{className:u}),e[2]=s,e[3]=u,e[4]=h):h=e[4];let d;e[5]!==o||e[6]!==h?(d=i.jsx(Et,{asChild:!0,children:i.jsx("span",{role:"img","aria-label":o,className:"shrink-0 cursor-help",children:h})}),e[5]=o,e[6]=h,e[7]=d):d=e[7];let v;e[8]!==o?(v=i.jsx(Rt,{className:"max-w-56",children:o}),e[8]=o,e[9]=v):v=e[9];let m;return e[10]!==d||e[11]!==v?(m=i.jsxs(kt,{children:[d,v]}),e[10]=d,e[11]=v,e[12]=m):m=e[12],m}const Wl="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 io(n){return Array.from({length:n},(e,s)=>({id:crypto.randomUUID(),index:s}))}function ko(n){return n.map((e,s)=>({...e,index:s}))}function ql(n,e){if(e===n.length)return n;if(e<n.length)return ko(n.slice(0,e));const s=Array.from({length:e-n.length},(o,a)=>({id:crypto.randomUUID(),index:n.length+a}));return[...n,...s]}function Eo(n){const e=it.c(44),{section:s,raw:o,meta:a,decofile:u}=n,h=Ft(),d=Wn(),v=s.isSavedBlock===!0,m=s.isMultivariate===!0;let j;e[0]!==a||e[1]!==o?(j=o&&a?El(o,a):void 0,e[0]=a,e[1]=o,e[2]=j):j=e[2];const A=j;let $;e[3]!==a||e[4]!==m||e[5]!==o||e[6]!==v?($=o&&a&&!v&&!m?zl(o,a):void 0,e[3]=a,e[4]=m,e[5]=o,e[6]=v,e[7]=$):$=e[7];const z=$;let H;e[8]!==u||e[9]!==a||e[10]!==o||e[11]!==s?(H=na(o,s,u,a),e[8]=u,e[9]=a,e[10]=o,e[11]=s,e[12]=H):H=e[12];const F=H;let f;e[13]!==m||e[14]!==o?.__resolveType?(f=!m&&Rs(o?.__resolveType??""),e[13]=m,e[14]=o?.__resolveType,e[15]=f):f=e[15];const k=f,Z=v?zn:m?bo:_o;let w;e[16]!==m||e[17]!==v?(w=v?{color:za}:m?{color:"oklch(0.65 0.15 160)"}:void 0,e[16]=m,e[17]=v,e[18]=w):w=e[18];const I=w;let V;e[19]!==Z||e[20]!==d?(V=d?i.jsxs("span",{className:"relative size-4 shrink-0",children:[i.jsx(Z,{className:"absolute inset-0 size-4 text-muted-foreground transition-opacity group-hover:opacity-0 group-has-[:focus-visible]:opacity-0"}),i.jsx(ra,{"aria-hidden":!0,className:"absolute inset-0 size-4 opacity-0 transition-opacity group-hover:opacity-100 group-has-[:focus-visible]:opacity-100"})]}):i.jsx(Aa,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[19]=Z,e[20]=d,e[21]=V):V=e[21];let y;e[22]!==A?(y=A&&i.jsx("img",{src:A,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded-[var(--studio-control-radius,var(--radius))] object-cover"}),e[22]=A,e[23]=y):y=e[23];let C;e[24]!==d||e[25]!==I?(C=!d&&i.jsx(Ss,{className:"h-4 w-4 shrink-0",style:I}),e[24]=d,e[25]=I,e[26]=C):C=e[26];const x=d?"shrink":"flex-1",Y=s.isHidden&&"line-through opacity-50";let M;e[27]!==Y||e[28]!==x?(M=ae("min-w-0 truncate text-sm font-medium",x,Y),e[27]=Y,e[28]=x,e[29]=M):M=e[29];const ge=z??s.label;let me;e[30]!==M||e[31]!==ge?(me=i.jsx("span",{className:M,children:ge}),e[30]=M,e[31]=ge,e[32]=me):me=e[32];let le;e[33]!==k||e[34]!==d||e[35]!==F||e[36]!==h?(le=d?i.jsxs(i.Fragment,{children:[k&&i.jsx(Hl,{icon:bs,label:h("sectionsEditor.sectionList.asyncBadge"),className:"text-muted-foreground"}),F&&i.jsx(Br,{}),i.jsx("span",{className:"min-w-0 flex-1"})]}):F&&i.jsx(Br,{className:"absolute -right-0.5 -top-0.5"}),e[33]=k,e[34]=d,e[35]=F,e[36]=h,e[37]=le):le=e[37];let ee;return e[38]!==me||e[39]!==le||e[40]!==V||e[41]!==y||e[42]!==C?(ee=i.jsxs(i.Fragment,{children:[V,y,C,me,le]}),e[38]=me,e[39]=le,e[40]=V,e[41]=y,e[42]=C,e[43]=ee):ee=e[43],ee}const Gl="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",Ul="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)]";function Ro(n,e,s){if(s)return sa({selected:e});const o=n.isSavedBlock===!0,a=n.isMultivariate===!0;return ae("group relative flex select-none items-center gap-2 rounded-[var(--studio-control-radius,var(--radius-md))] px-2 py-2.5",e?"bg-accent text-accent-foreground":o?Gl:a?Ul:"text-foreground/80 hover:bg-accent hover:text-accent-foreground")}function ps(n,e){return ae("h-7 shrink-0 overflow-hidden",e?"w-7 ml-0 opacity-100 [transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]":n?"w-7 ml-0 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:opacity-100 group-has-[:focus-visible]:opacity-100":"w-0 -ml-2 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:ml-0 group-hover:w-7 group-hover:opacity-100 group-hover:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms] group-has-[:focus-visible]:ml-0 group-has-[:focus-visible]:w-7 group-has-[:focus-visible]:opacity-100 group-has-[:focus-visible]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]")}function Yl(n){const e=it.c(90),{section:s,raw:o,meta:a,decofile:u,sortableId:h,selected:d,onSelect:v,onDelete:m,onDuplicate:j,onMakeReusable:A,onToggleHidden:$,onToggleLazy:z,onAddVariant:H,onDetach:F}=n,f=Ft(),k=Wn(),Z=o?Rs(o.__resolveType??""):!1,w=s.isHidden===!0,I=Z||w;let V;e[0]!==s?(V=jo(s),e[0]=s,e[1]=V):V=e[1];const y=V,C=!!z&&!s.isMultivariate;let x;e[2]!==h?(x={id:h,animateLayoutChanges:Zl},e[2]=h,e[3]=x):x=e[3];const{attributes:Y,listeners:M,setNodeRef:ge,transform:me,isDragging:le}=bl(x);let ee;e[4]!==me?(ee=xl.Transform.toString(me?{...me,x:0}:null),e[4]=me,e[5]=ee):ee=e[5];const pe=le?0:void 0;let ce;e[6]!==ee||e[7]!==pe?(ce={transform:ee,opacity:pe},e[6]=ee,e[7]=pe,e[8]=ce):ce=e[8];const he=ce;let ve;e[9]!==s?(ve=Zi(s),e[9]=s,e[10]=ve):ve=e[10];const b=ve,B="button",xe=0;let T;e[11]!==v?(T=re=>{(re.key==="Enter"||re.key===" ")&&(re.preventDefault(),v())},e[11]=v,e[12]=T):T=e[12];const ye=le?"cursor-grabbing":"cursor-pointer";let K;e[13]!==k||e[14]!==s||e[15]!==d||e[16]!==ye?(K=ae("touch-none transition-colors",ye,Ro(s,d,k)),e[13]=k,e[14]=s,e[15]=d,e[16]=ye,e[17]=K):K=e[17];let Se;e[18]!==u||e[19]!==a||e[20]!==o||e[21]!==s?(Se=i.jsx(Eo,{section:s,raw:o,meta:a,decofile:u}),e[18]=u,e[19]=a,e[20]=o,e[21]=s,e[22]=Se):Se=e[22];const ue=!k&&C&&i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"ghost",size:"icon","aria-label":f(Z?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender"),className:ae(ps(I,Z)),onClick:re=>{re.stopPropagation(),z?.()},onPointerDown:Ql,children:i.jsx(bs,{className:ae("h-3.5 w-3.5",Z&&"text-warning")})})}),i.jsx(Rt,{side:"bottom",children:f(Z?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")})]}),te=k?i.jsx(Xi,{label:f(w?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),active:w,onToggle:$,children:w?i.jsx(Xr,{className:"h-3.5 w-3.5"}):i.jsx(eo,{className:"h-3.5 w-3.5"})}):i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"ghost",size:"icon","aria-label":f(w?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),className:ae(ps(I,w)),onClick:re=>{re.stopPropagation(),$()},onPointerDown:Jl,children:w?i.jsx(Xr,{className:"h-3.5 w-3.5"}):i.jsx(eo,{className:"h-3.5 w-3.5"})})}),i.jsx(Rt,{side:"bottom",children:f(w?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection")})]}),se=zi,Te=ea;let X;e[23]!==f?(X=f("sectionsEditor.sectionList.sectionActionsMenu"),e[23]=f,e[24]=X):X=e[24];const _e=ae(ps(I,!1),"data-[state=open]:ml-0 data-[state=open]:w-7 data-[state=open]:opacity-100 data-[state=open]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]");let be;e[25]!==Te||e[26]!==X||e[27]!==_e?(be=i.jsx(Te,{label:X,classicClassName:_e}),e[25]=Te,e[26]=X,e[27]=_e,e[28]=be):be=e[28];let q;e[29]!==k||e[30]!==C||e[31]!==Z||e[32]!==z||e[33]!==f?(q=k&&C&&i.jsxs(i.Fragment,{children:[i.jsxs(sn,{onClick:re=>{re.stopPropagation(),z?.()},children:[i.jsx(bs,{className:"h-4 w-4"}),f(Z?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")]}),i.jsx($i,{})]}),e[29]=k,e[30]=C,e[31]=Z,e[32]=z,e[33]=f,e[34]=q):q=e[34];let O;e[35]!==j?(O=re=>{re.stopPropagation(),j()},e[35]=j,e[36]=O):O=e[36];let Ke;e[37]===Symbol.for("react.memo_cache_sentinel")?(Ke=i.jsx(dl,{className:"h-4 w-4"}),e[37]=Ke):Ke=e[37];let Qe;e[38]!==f?(Qe=f("sectionsEditor.sectionList.duplicateMenuItem"),e[38]=f,e[39]=Qe):Qe=e[39];let Ze;e[40]!==O||e[41]!==Qe?(Ze=i.jsxs(sn,{onClick:O,children:[Ke,Qe]}),e[40]=O,e[41]=Qe,e[42]=Ze):Ze=e[42];let Ye;e[43]!==k||e[44]!==y||e[45]!==H||e[46]!==f?(Ye=y&&i.jsxs(sn,{className:ae(!k&&ta),onClick:re=>{re.stopPropagation(),H()},children:[i.jsx(bo,{className:"h-4 w-4"}),f("sectionsEditor.sectionList.addVariantMenuItem")]}),e[43]=k,e[44]=y,e[45]=H,e[46]=f,e[47]=Ye):Ye=e[47];let Q;e[48]!==k||e[49]!==b||e[50]!==A||e[51]!==f?(Q=b&&i.jsxs(sn,{className:ae(!k&&Wl),onClick:re=>{re.stopPropagation(),A()},children:[k?i.jsx(zn,{className:"h-4 w-4"}):i.jsx(Ss,{className:"h-4 w-4"}),f("sectionsEditor.sectionList.makeReusableMenuItem")]}),e[48]=k,e[49]=b,e[50]=A,e[51]=f,e[52]=Q):Q=e[52];let ke;e[53]!==k||e[54]!==F||e[55]!==s.isMultivariate||e[56]!==s.isSavedBlock||e[57]!==f?(ke=s.isSavedBlock===!0&&!s.isMultivariate&&i.jsxs(sn,{onClick:re=>{re.stopPropagation(),F()},children:[k?i.jsx(_o,{className:"h-4 w-4"}):i.jsx(Ss,{className:"h-4 w-4"}),f("sectionsEditor.sectionList.detachMenuItem")]}),e[53]=k,e[54]=F,e[55]=s.isMultivariate,e[56]=s.isSavedBlock,e[57]=f,e[58]=ke):ke=e[58];let He;e[59]!==m?(He=re=>{re.stopPropagation(),m()},e[59]=m,e[60]=He):He=e[60];let We;e[61]===Symbol.for("react.memo_cache_sentinel")?(We=i.jsx(ml,{className:"h-4 w-4"}),e[61]=We):We=e[61];let Ee;e[62]!==f?(Ee=f("sectionsEditor.sectionList.deleteMenuItem"),e[62]=f,e[63]=Ee):Ee=e[63];let Ie;e[64]!==He||e[65]!==Ee?(Ie=i.jsxs(sn,{variant:"destructive",onClick:He,children:[We,Ee]}),e[64]=He,e[65]=Ee,e[66]=Ie):Ie=e[66];let Ve;e[67]!==q||e[68]!==Ze||e[69]!==Ye||e[70]!==Q||e[71]!==ke||e[72]!==Ie?(Ve=i.jsxs(Hi,{align:"end",className:"w-44",children:[q,Ze,Ye,Q,ke,Ie]}),e[67]=q,e[68]=Ze,e[69]=Ye,e[70]=Q,e[71]=ke,e[72]=Ie,e[73]=Ve):Ve=e[73];let Xe;e[74]!==se||e[75]!==be||e[76]!==Ve?(Xe=i.jsxs(se,{children:[be,Ve]}),e[74]=se,e[75]=be,e[76]=Ve,e[77]=Xe):Xe=e[77];let Fe;return e[78]!==Y||e[79]!==M||e[80]!==v||e[81]!==ge||e[82]!==he||e[83]!==K||e[84]!==Se||e[85]!==ue||e[86]!==te||e[87]!==Xe||e[88]!==T?(Fe=i.jsxs("div",{ref:ge,style:he,...Y,...M,role:B,tabIndex:xe,onClick:v,onKeyDown:T,className:K,children:[Se,ue,te,Xe]}),e[78]=Y,e[79]=M,e[80]=v,e[81]=ge,e[82]=he,e[83]=K,e[84]=Se,e[85]=ue,e[86]=te,e[87]=Xe,e[88]=T,e[89]=Fe):Fe=e[89],Fe}function Jl(n){return n.stopPropagation()}function Ql(n){return n.stopPropagation()}function Zl(){return!1}function js(n){const e=it.c(11),{canAddSection:s,onAddSection:o,className:a,size:u}=n,h=Ft();let d;e[0]!==a?(d=ae("w-full",a),e[0]=a,e[1]=d):d=e[1];const v=!s;let m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=i.jsx(fl,{size:14}),e[2]=m):m=e[2];let j;e[3]!==h?(j=h("sectionsEditor.sectionList.addSectionButton"),e[3]=h,e[4]=j):j=e[4];let A;return e[5]!==o||e[6]!==u||e[7]!==d||e[8]!==v||e[9]!==j?(A=i.jsxs(_t,{type:"button",variant:"outline",size:u,className:d,disabled:v,onClick:o,children:[m,j]}),e[5]=o,e[6]=u,e[7]=d,e[8]=v,e[9]=j,e[10]=A):A=e[10],A}function Xl(n){const e=it.c(101),{listKey:s,rawSections:o,sections:a,meta:u,decofile:h,selectedIndex:d,onSelect:v,onReorder:m,onDelete:j,onDuplicate:A,onMakeReusable:$,onToggleHidden:z,onToggleLazy:H,onAddVariant:F,onDetach:f,onAddSection:k,canAddSection:Z}=n,w=Z===void 0?!0:Z,I=Ft(),V=Wn();let y;e[0]!==a.length?(y=()=>io(a.length),e[0]=a.length,e[1]=y):y=e[1];const[C,x]=R.useState(y),[Y,M]=R.useState(null),[ge,me]=R.useState(s),[le,ee]=R.useState(a.length),pe=R.useRef(!1);ge!==s?(me(s),ee(a.length),x(io(a.length))):le!==a.length&&(ee(a.length),x(dt=>ql(dt,a.length)));let ce;e[2]===Symbol.for("react.memo_cache_sentinel")?(ce={activationConstraint:{distance:8}},e[2]=ce):ce=e[2];let he;e[3]===Symbol.for("react.memo_cache_sentinel")?(he={coordinateGetter:jl},e[3]=he):he=e[3];const ve=pl(to(gl,ce),to(hl,he));let b;e[4]!==C?(b=C.map(ec),e[4]=C,e[5]=b):b=e[5];const B=b;let xe;e[6]===Symbol.for("react.memo_cache_sentinel")?(xe=dt=>{M(String(dt.active.id))},e[6]=xe):xe=e[6];const T=xe;let ye;e[7]!==B||e[8]!==m?(ye=dt=>{M(null);const{active:ne,over:De}=dt;if(!De||ne.id===De.id)return;const yt=B.indexOf(String(ne.id)),et=B.indexOf(String(De.id));yt===-1||et===-1||(x(ft=>ko(Ln([...ft],yt,et))),pe.current=!0,requestAnimationFrame(()=>{pe.current=!1}),m?.(yt,et))},e[7]=B,e[8]=m,e[9]=ye):ye=e[9];const K=ye;let Se;e[10]===Symbol.for("react.memo_cache_sentinel")?(Se=()=>{M(null)},e[10]=Se):Se=e[10];const ue=Se;let te,se,Te,X,_e,be,q,O,Ke,Qe,Ze,Ye,Q,ke,He;if(e[11]!==Y||e[12]!==w||e[13]!==V||e[14]!==h||e[15]!==C||e[16]!==B||e[17]!==K||e[18]!==u||e[19]!==k||e[20]!==F||e[21]!==j||e[22]!==f||e[23]!==A||e[24]!==$||e[25]!==v||e[26]!==z||e[27]!==H||e[28]!==o||e[29]!==a||e[30]!==d||e[31]!==ve||e[32]!==I){ke=Symbol.for("react.early_return_sentinel");e:{const dt=ne=>{pe.current||v(ne)};if(e[48]!==Y||e[49]!==w||e[50]!==V||e[51]!==C||e[52]!==k||e[53]!==o||e[54]!==a||e[55]!==I){const ne=Y?C.find(De=>De.id===Y):null;if(X=ne!=null?a[ne.index]:null,Te=ne!=null?o[ne.index]:void 0,C.length===0){let De;e[59]!==I?(De=I("sectionsEditor.sectionList.noSections"),e[59]=I,e[60]=De):De=e[60];let yt;e[61]!==De?(yt=i.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:De}),e[61]=De,e[62]=yt):yt=e[62];const et=yt;let ft;e[63]!==w||e[64]!==V||e[65]!==et||e[66]!==k?(ft=V?et:i.jsxs("div",{className:"space-y-2",children:[et,i.jsx(js,{canAddSection:w,onAddSection:k,size:"sm"})]}),e[63]=w,e[64]=V,e[65]=et,e[66]=k,e[67]=ft):ft=e[67],ke=ft;break e}Q=ae(ne&&"cursor-grabbing"),e[48]=Y,e[49]=w,e[50]=V,e[51]=C,e[52]=k,e[53]=o,e[54]=a,e[55]=I,e[56]=Te,e[57]=X,e[58]=Q}else Te=e[56],X=e[57],Q=e[58];se=yl,O=ve,Ke=Sl,Qe=T,Ze=K,Ye=ue,te=wl,be=B,q=_l,He="space-y-1",_e=C.map(ne=>{const De=a[ne.index];return De?i.jsx(Yl,{sortableId:ne.id,section:De,raw:o[ne.index],meta:u,decofile:h,selected:d===ne.index,onSelect:()=>dt(ne.index),onDelete:()=>j(ne.index),onDuplicate:()=>A(ne.index),onMakeReusable:()=>$(ne.index),onToggleHidden:()=>z(ne.index),onToggleLazy:H?()=>H(ne.index):void 0,onAddVariant:()=>F(ne.index),onDetach:()=>f(ne.index)},ne.id):null})}e[11]=Y,e[12]=w,e[13]=V,e[14]=h,e[15]=C,e[16]=B,e[17]=K,e[18]=u,e[19]=k,e[20]=F,e[21]=j,e[22]=f,e[23]=A,e[24]=$,e[25]=v,e[26]=z,e[27]=H,e[28]=o,e[29]=a,e[30]=d,e[31]=ve,e[32]=I,e[33]=te,e[34]=se,e[35]=Te,e[36]=X,e[37]=_e,e[38]=be,e[39]=q,e[40]=O,e[41]=Ke,e[42]=Qe,e[43]=Ze,e[44]=Ye,e[45]=Q,e[46]=ke,e[47]=He}else te=e[33],se=e[34],Te=e[35],X=e[36],_e=e[37],be=e[38],q=e[39],O=e[40],Ke=e[41],Qe=e[42],Ze=e[43],Ye=e[44],Q=e[45],ke=e[46],He=e[47];if(ke!==Symbol.for("react.early_return_sentinel"))return ke;let We;e[68]!==_e||e[69]!==He?(We=i.jsx("div",{className:He,children:_e}),e[68]=_e,e[69]=He,e[70]=We):We=e[70];let Ee;e[71]!==te||e[72]!==be||e[73]!==q||e[74]!==We?(Ee=i.jsx(te,{items:be,strategy:q,children:We}),e[71]=te,e[72]=be,e[73]=q,e[74]=We,e[75]=Ee):Ee=e[75];let Ie;e[76]!==Te||e[77]!==X||e[78]!==V||e[79]!==h||e[80]!==u?(Ie=X?i.jsx("div",{className:ae("cursor-grabbing shadow-lg ring-1 ring-border/60",Ro(X,!1,V)),children:i.jsx(Eo,{section:X,raw:Te,meta:u,decofile:h})}):null,e[76]=Te,e[77]=X,e[78]=V,e[79]=h,e[80]=u,e[81]=Ie):Ie=e[81];let Ve;e[82]!==Ie?(Ve=Li.createPortal(i.jsx(vl,{dropAnimation:Qi,children:Ie}),document.body),e[82]=Ie,e[83]=Ve):Ve=e[83];let Xe;e[84]!==se||e[85]!==O||e[86]!==Ke||e[87]!==Qe||e[88]!==Ze||e[89]!==Ye||e[90]!==Ee||e[91]!==Ve?(Xe=i.jsxs(se,{sensors:O,collisionDetection:Ke,onDragStart:Qe,onDragEnd:Ze,onDragCancel:Ye,children:[Ee,Ve]}),e[84]=se,e[85]=O,e[86]=Ke,e[87]=Qe,e[88]=Ze,e[89]=Ye,e[90]=Ee,e[91]=Ve,e[92]=Xe):Xe=e[92];let Fe;e[93]!==w||e[94]!==V||e[95]!==k?(Fe=!V&&i.jsx(js,{canAddSection:w,onAddSection:k,size:"sm",className:"mt-2"}),e[93]=w,e[94]=V,e[95]=k,e[96]=Fe):Fe=e[96];let re;return e[97]!==Q||e[98]!==Xe||e[99]!==Fe?(re=i.jsxs("div",{className:Q,children:[Xe,Fe]}),e[97]=Q,e[98]=Xe,e[99]=Fe,e[100]=re):re=e[100],re}function ec(n){return n.id}function hs(n,e,s,o){if(!n||!e)return null;if(!e.isMultivariate)return jt(n,e,o)?.data??null;const a=xt(n,e),u=a?vs(a,wt)[s]:void 0;return u?wo(u.value,o)?.data??null:null}const tc=50;function nc(n,e){n.own.push(ze(e)),n.own.length>tc&&n.own.shift()}function ao(n,e){return n.own.includes(ze(e))}function sc(n,e){const{sectionIndex:s,variantIndex:o,shown:a,next:u,sectionCount:h}=e;return n&&n.sectionIndex===s&&n.variantIndex===o&&n.emitted===a?(n.emitted=u,n):a?{sectionIndex:s,variantIndex:o,base:a,emitted:u,sectionCount:h,own:[ze(a)]}:null}function Ao(n,e){return e!==null&&ze(n)!==ze(e)}function Co(n,e){return n.__resolveType!==e.__resolveType}function rc(n,e,s,o){if(e.length===o)return"here";const a=ze(n),u=e.flatMap((h,d)=>d!==s&&h!==null&&ze(h)===a?[d]:[]);return u.length===1?u[0]:"unknown"}function lo({formBase:n,rebased:e,versionOf:s}){let o=null;return{ifMatch:a=>{o=a,n&&(n.version===void 0||e)&&(n.version=s(a));const u=n?n.version:s(a);return u===void 0?void 0:{[a]:u}},onApplied:a=>{n&&o!==null&&Object.hasOwn(a,o)&&(n.version=a[o])},reloadOnConflict:!0}}function oc({merged:n,tracked:e,current:s,saved:o}){return!!n&&!!e&&s===e&&e.emitted===o}function co(n,e){return!!n&&!!e&&n.contains(e)}function ws(n){const e=[],s=_s("",n.ancestor,n.mine,n.theirs,e);return{...n,merged:s,pointers:e}}function _s(n,e,s,o,a){const u=(h,d)=>ze(h)===ze(d);if(u(s,o)||u(e,o))return s;if(u(e,s))return o;if(gs(s)&&gs(o)){const h=gs(e)?e:{},d={},v=[...Object.keys(s),...Object.keys(o).filter(m=>!(m in s))];for(const m of v){const j=_s(`${n}/${m.replaceAll("~","~0").replaceAll("/","~1")}`,h[m],s[m],o[m],a);j!==void 0&&(d[m]=j)}return d}return Array.isArray(e)&&Array.isArray(s)&&Array.isArray(o)&&s.length===e.length&&o.length===e.length?e.map((h,d)=>_s(`${n}/${d}`,h,s[d],o[d],a)):(a.push(n),o)}function gs(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}function ic(n,e){let s=n.merged;for(const o of n.pointers)e[o]==="mine"&&(s=uc(s,o,Ut(n.mine,o)));return s}function ac(n,e){return Object.fromEntries(n.pointers.map(s=>[s,e]))}function No(n){return ac(n,"mine")}function ks(n,e,s){const o=No(s);for(const a of s.pointers){const u=e[a];if(!u||!n.pointers.includes(a))continue;["mine","theirs"].every(d=>ze(Ut(n[d],a))===ze(Ut(s[d],a)))&&(o[a]=u)}return o}function To(n,e,s={}){const o=e.pointers.filter(a=>!n.pointers.includes(a)||ze(Ut(n.theirs,a))!==ze(Ut(e.theirs,a)));return o.length===0?s:{...s,...Object.fromEntries(o.map(a=>[a,(s[a]??0)+1]))}}function lc(n,e,s){if(!e||Co(n.plan.ancestor,e)||!Ao(n.plan.theirs,e)||s(e))return null;const o=ws({...n.plan,theirs:e});return o.pointers.length===0?null:{plan:o,choices:ks(n.plan,n.choices,o),fresh:To(n.plan,o,n.fresh)}}function cc(n,e){return n.pointers.map(s=>({pointer:s,label:oa(s,e),mine:Ut(n.mine,s),theirs:Ut(n.theirs,s),schema:dc(e??null,s)}))}function As(n){return n.split("/").slice(1).map(e=>e.replaceAll("~1","/").replaceAll("~0","~"))}function Ut(n,e){let s=n;for(const o of As(e))if(Array.isArray(s))s=s[Number(o)];else if(s&&typeof s=="object")s=s[o];else return;return s}function uc(n,e,s){const o=As(e),a=(u,h)=>{if(h===o.length)return s;const d=o[h];if(Array.isArray(u)){const j=[...u];return j[Number(d)]=a(u[Number(d)],h+1),j}const v=u&&typeof u=="object"?{...u}:{},m=a(v[d],h+1);return m===void 0?delete v[d]:v[d]=m,v};return a(n,0)}function dc(n,e){let s=n;for(const o of As(e)){if(!s)return null;s=/^\d+$/.test(o)&&!s.properties?.[o]?s.items:s.properties?.[o]}return s??null}const fc=/\.(png|jpe?g|gif|webp|avif|svg)(\?.*)?$/i,uo=60,mc=3;function Vo(n,e){return e?.format==="image-uri"?!0:n.startsWith("data:image/")||/^(https?:)?\/\//.test(n)&&fc.test(n)}function Es(n,e){if(!(e?.format==="rich-text"||e?.format==="rich-text-inline"||e?.format==="html"||/<\/?[a-z][^>]*>/i.test(n)))return n;const o=n.replace(/<br\s*\/?>/gi,`
|
|
2
2
|
`).replace(/<\/(p|div|li|h[1-6])>/gi,`
|
|
3
3
|
`);return hc(o).replace(/\u00a0/g," ").replace(/\n{2,}/g,`
|
|
4
|
-
`).trim()}const pc={" ":" ","&":"&","<":"<",">":">",""":'"',"'":"'"};function hc(n){if(typeof DOMParser<"u")return new DOMParser().parseFromString(n,"text/html").body.textContent??"";let e=n;for(let s="";s!==e;)s=e,e=e.replace(/<[^<>]*>/g,"");return e.replace(/<|>/g,"").replace(/&(nbsp|amp|lt|gt|quot|#39);/g,s=>pc[s]??s)}function $n(n){const e=n.replace(/\s+/g," ").trim();return e.length>uo?`${e.slice(0,uo-1)}…`:e}function gc(n){if(n.startsWith("data:"))return"image";const e=n.split(/[?#]/)[0]??n;return decodeURIComponent(e.split("/").pop()||n)}function Hn(n,e){if(n==null||n==="")return{kind:"empty"};if(typeof n=="string")return Vo(n,e)?{kind:"image",src:n}:{kind:"text",text:Es(n,e)};if(typeof n=="number"||typeof n=="bigint")return{kind:"text",text:String(n)};if(typeof n=="boolean")return{kind:"yesNo",value:n};if(Array.isArray(n)){const s=e?.items??null;return{kind:"list",count:n.length,items:n.slice(0,mc).map(o=>vc(o,s)??"")}}if(typeof n=="object"){const s=n;if("value"in s&&Object.keys(s).length<=2)return Hn(s.value,e?.properties?.value??e);const o=Object.entries(s).filter(([a,u])=>!a.startsWith("__")&&u!==void 0).flatMap(([a,u])=>{const h=e?.properties?.[a]??null,d=Hn(u,h);if(d.kind==="empty")return[];const v=d.kind==="text"?$n(d.text):d.kind==="image"?gc(d.src):d.kind==="yesNo"?d.value?"✓":"✗":d.kind==="list"?`${d.count}`:"…";return[{label:h?.title?.trim()||a,text:v}]}).slice(0,4);return o.length>0?{kind:"fields",entries:o}:{kind:"empty"}}return{kind:"text",text:String(n)}}function vc(n,e){if(typeof n=="string")return $n(Es(n,e));if(!n||typeof n!="object"||Array.isArray(n))return null;const s=n,o=e?.titleBy,a=o?s[o]:void 0;if(typeof a=="string"&&a.trim())return $n(a);for(const[u,h]of Object.entries(s))if(!(u.startsWith("__")||typeof h!="string"||!h.trim())&&!Vo(h,e?.properties?.[u]??null))return $n(Es(h,null));return null}const fo=1500;function xc(n,e){const s=n.split(/(\s+)/).filter(j=>j!==""),o=e.split(/(\s+)/).filter(j=>j!=="");if(s.length>fo||o.length>fo)return{mine:[{text:n,kind:"changed"}],theirs:[{text:e,kind:"changed"}]};const a=Array.from({length:s.length+1},()=>new Array(o.length+1).fill(0));for(let j=s.length-1;j>=0;j--)for(let A=o.length-1;A>=0;A--){const $=a[j];$[A]=s[j]===o[A]?a[j+1][A+1]+1:Math.max(a[j+1][A],$[A+1])}const u=[],h=[],d=(j,A,$)=>{const z=j.at(-1);z&&(z.kind===$||$==="same"&&!A.trim())?z.text+=A:j.push({text:A,kind:$})};let v=0,m=0;for(;v<s.length&&m<o.length;)s[v]===o[m]?(d(u,s[v],"same"),d(h,o[m],"same"),v++,m++):a[v+1][m]>=a[v][m+1]?(d(u,s[v],"changed"),v++):(d(h,o[m],"changed"),m++);for(;v<s.length;v++)d(u,s[v],"changed");for(;m<o.length;m++)d(h,o[m],"changed");return{mine:u,theirs:h}}function yc(n){const e=it.c(10);let s,o;e[0]!==n?({open:s,...o}=n,e[0]=n,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const{data:a}=xo.useSession();let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=ae("max-h-[85vh] grid-rows-[auto_minmax(0,1fr)_auto] sm:max-w-lg"),e[3]=u):u=e[3];const h=a?.user??null;let d;e[4]!==o||e[5]!==h?(d=i.jsx(Cl,{className:u,"data-testid":"form-conflict-dialog",onEscapeKeyDown:jc,onOpenAutoFocus:bc,children:i.jsx(Ac,{...o,viewer:h,heading:Sc})}),e[4]=o,e[5]=h,e[6]=d):d=e[6];let v;return e[7]!==s||e[8]!==d?(v=i.jsx(Dl,{open:s,children:d}),e[7]=s,e[8]=d,e[9]=v):v=e[9],v}function Sc(n,e){return i.jsxs(Nl,{className:"text-left",children:[i.jsx(Tl,{children:n}),i.jsx(Vl,{children:e})]})}function bc(n){n.preventDefault(),n.currentTarget?.focus()}function jc(n){return n.preventDefault()}const wc={},_c=(n,e)=>i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx("h2",{className:"text-lg font-semibold",children:n}),i.jsx("p",{className:"text-sm text-muted-foreground",children:e})]});function kc(n,e,s=0,o={},a=null){const u=e[Math.min(s,e.length-1)],h=a?.you?void 0:a?.name?.split(/\s+/)[0],d={field:u?Rc(u.label):"",label:u?.label??"",name:h??""},v=(m,j,A)=>n(a?.you?A:h?j:m,d);return e.length<=1?{title:v("sectionsEditor.formConflict.titleOne","sectionsEditor.formConflict.titleOneNamed","sectionsEditor.formConflict.titleOneYou"),description:n("sectionsEditor.formConflict.descriptionOne")}:{title:v("sectionsEditor.formConflict.titleStep","sectionsEditor.formConflict.titleStepNamed","sectionsEditor.formConflict.titleStepYou"),description:s>=e.length-1?i.jsx(Ec,{t:n,fields:e,choices:o,name:h}):n("sectionsEditor.formConflict.descriptionStep")}}function Ec(n){const e=it.c(11),{t:s,fields:o,choices:a,name:u}=n;let h;if(e[0]!==a||e[1]!==o||e[2]!==u||e[3]!==s){let v;e[5]!==a||e[6]!==u||e[7]!==s?(v=(m,j)=>i.jsxs(R.Fragment,{children:[j>0&&" · ",`${m.label}: `,i.jsx("span",{className:"font-medium text-foreground",children:s((a[m.pointer]??"mine")==="mine"?"sectionsEditor.formConflict.summaryYours":u?"sectionsEditor.formConflict.summaryTheirsNamed":"sectionsEditor.formConflict.summaryTheirs",{name:u??""})})]},m.pointer),e[5]=a,e[6]=u,e[7]=s,e[8]=v):v=e[8],h=o.map(v),e[0]=a,e[1]=o,e[2]=u,e[3]=s,e[4]=h}else h=e[4];let d;return e[9]!==h?(d=i.jsx("span",{"data-testid":"form-conflict-summary",children:h}),e[9]=h,e[10]=d):d=e[10],d}function Rc(n){return/^[A-Z][a-z]/.test(n)&&!n.includes("›")?n.charAt(0).toLowerCase()+n.slice(1):n}function Ac(n){const e=it.c(68),s=Ft(),{fields:o,choices:a,changedAgain:u,fresh:h,heading:d}=n,v=u===void 0?!1:u,m=h===void 0?wc:h,j=d===void 0?_c:d,A=o.length>1,[$,z]=R.useState(0),[H,F]=R.useState(Cc);let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f={},e[0]=f):f=e[0];const[k,X]=R.useState(f),w=Math.max(0,Math.min($,o.length-1)),I=o[w],V=w===o.length-1;let y;e[1]!==w||e[2]!==o||e[3]!==m?(y=Se=>{const ue=o[w],te=o[Se];!ue||!te||Se===w||(F(se=>new Set(se).add(ue.pointer)),X(se=>({...se,[ue.pointer]:m[ue.pointer]??0,[te.pointer]:m[te.pointer]??0})),z(Se))},e[1]=w,e[2]=o,e[3]=m,e[4]=y):y=e[4];const C=y;let x;e[5]!==w||e[6]!==C?(x=Se=>{if(!Se)return;const ue=te=>{const se={ArrowLeft:-1,ArrowRight:1}[te.key];!se||te.defaultPrevented||te.altKey||te.ctrlKey||te.metaKey||te.shiftKey||Pl(te.target)||(te.preventDefault(),C(w+se))};return Se.ownerDocument.addEventListener("keydown",ue),()=>Se.ownerDocument.removeEventListener("keydown",ue)},e[5]=w,e[6]=C,e[7]=x):x=e[7];const Y=x;if(!I)return null;let M,ge,me,le,ee;if(e[8]!==H||e[9]!==w||e[10]!==a||e[11]!==o||e[12]!==m||e[13]!==C||e[14]!==j||e[15]!==Y||e[16]!==A||e[17]!==n||e[18]!==k||e[19]!==s){const{title:Se,description:ue}=kc(s,o,w,a,n.author??null);let te;e[25]!==n?(te=se=>{se.detail>1||n.onApply()},e[25]=n,e[26]=te):te=e[26],M=te,ge=A?Y:void 0,me="flex min-w-0 flex-col gap-3",e[27]!==H||e[28]!==w||e[29]!==o||e[30]!==m||e[31]!==C||e[32]!==A||e[33]!==k||e[34]!==s?(le=A&&i.jsxs("div",{className:"flex items-center justify-between gap-3",children:[i.jsx("div",{role:"group","aria-label":s("sectionsEditor.formConflict.steps"),className:"-m-1 flex flex-wrap items-center",children:o.map((se,Te)=>{const Z=Te!==w&&(m[se.pointer]??0)>(k[se.pointer]??0);return i.jsx("button",{type:"button","aria-label":Z?s("sectionsEditor.formConflict.stepChangedAgain",{label:se.label}):se.label,"aria-current":Te===w?"step":void 0,"data-answered":Te!==w&&H.has(se.pointer)?"":void 0,"data-changed-again":Z?"":void 0,onClick:()=>C(Te),className:"group cursor-pointer rounded-full p-1 outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:i.jsx("span",{className:ae("block h-2 w-2 rounded-full bg-border transition-[width,background-color,box-shadow] motion-reduce:transition-none","group-hover:bg-muted-foreground/60","group-data-[answered]:bg-foreground/45","group-aria-[current=step]:w-5 group-aria-[current=step]:bg-foreground","group-data-[changed-again]:ring-2 group-data-[changed-again]:ring-warning group-data-[changed-again]:ring-offset-1 group-data-[changed-again]:ring-offset-background")})},se.pointer)})}),i.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:s("sectionsEditor.formConflict.stepCount",{step:String(w+1),count:String(o.length)})})]}),e[27]=H,e[28]=w,e[29]=o,e[30]=m,e[31]=C,e[32]=A,e[33]=k,e[34]=s,e[35]=le):le=e[35],ee=j(Se,ue),e[8]=H,e[9]=w,e[10]=a,e[11]=o,e[12]=m,e[13]=C,e[14]=j,e[15]=Y,e[16]=A,e[17]=n,e[18]=k,e[19]=s,e[20]=M,e[21]=ge,e[22]=me,e[23]=le,e[24]=ee}else M=e[20],ge=e[21],me=e[22],le=e[23],ee=e[24];let pe;e[36]!==ge||e[37]!==me||e[38]!==le||e[39]!==ee?(pe=i.jsxs("div",{ref:ge,className:me,children:[le,ee]}),e[36]=ge,e[37]=me,e[38]=le,e[39]=ee,e[40]=pe):pe=e[40];const ce=!v&&"sr-only";let he;e[41]!==ce?(he=ae("text-sm text-muted-foreground",ce),e[41]=ce,e[42]=he):he=e[42];let ve;e[43]!==v||e[44]!==A||e[45]!==s?(ve=v?s(A?"sectionsEditor.formConflict.changedAgainSteps":"sectionsEditor.formConflict.changedAgain"):"",e[43]=v,e[44]=A,e[45]=s,e[46]=ve):ve=e[46];let b;e[47]!==he||e[48]!==ve?(b=i.jsx("p",{role:"status",className:he,children:ve}),e[47]=he,e[48]=ve,e[49]=b):b=e[49];const B=A?"vertical":"all";let xe;e[50]!==I||e[51]!==n||e[52]!==B?(xe=i.jsx(Dc,{field:I,...n,arrows:B}),e[50]=I,e[51]=n,e[52]=B,e[53]=xe):xe=e[53];let T;e[54]!==b||e[55]!==xe?(T=i.jsxs("div",{className:"-mx-2 flex min-h-0 flex-col gap-3 overflow-y-auto px-2 py-1",children:[b,xe]}),e[54]=b,e[55]=xe,e[56]=T):T=e[56];let ye;e[57]!==M||e[58]!==w||e[59]!==C||e[60]!==V||e[61]!==A||e[62]!==s?(ye=A?i.jsxs(no,{className:"flex-row flex-wrap items-center justify-between gap-2 sm:justify-between",children:[i.jsx(_t,{type:"button",variant:"outline","aria-disabled":w===0,onClick:()=>C(w-1),className:"aria-disabled:cursor-default aria-disabled:opacity-45",children:s("sectionsEditor.formConflict.back")}),i.jsx(_t,{type:"button","data-testid":"form-conflict-primary",onClick:V?M:()=>C(w+1),children:s(V?"sectionsEditor.formConflict.ok":"sectionsEditor.formConflict.next")})]}):i.jsx(no,{className:"items-center gap-2",children:i.jsx(_t,{type:"button","data-testid":"form-conflict-primary",onClick:M,children:s("sectionsEditor.formConflict.ok")})}),e[57]=M,e[58]=w,e[59]=C,e[60]=V,e[61]=A,e[62]=s,e[63]=ye):ye=e[63];let K;return e[64]!==pe||e[65]!==T||e[66]!==ye?(K=i.jsxs(i.Fragment,{children:[pe,T,ye]}),e[64]=pe,e[65]=T,e[66]=ye,e[67]=K):K=e[67],K}function Cc(){return new Set}function Nc(n){const e=Hn(n.mine,n.schema),s=Hn(n.theirs,n.schema),o=e.kind==="text"&&s.kind==="text"?xc(e.text,s.text):null;return a=>o?i.jsx(Pc,{parts:o[a]}):i.jsx(Bc,{preview:a==="mine"?e:s})}const Tc={all:{ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1},vertical:{ArrowDown:1,ArrowUp:-1}};function Vc(n,e){const s=Tc[e][n.key];if(!s)return;const o=[...n.currentTarget.querySelectorAll('[role="radio"]')],a=o.indexOf(document.activeElement);if(a<0)return;n.preventDefault();const u=o[(a+s+o.length)%o.length];u?.focus(),u?.click()}function Dc(n){const e=it.c(65),{field:s,choices:o,viewer:a,author:u,onChoose:h,arrows:d}=n,v=u===void 0?null:u,m=Ft(),[j]=Wi(),{language:A}=j;let $,z,H,F,f,k,X,w,I,V,y,C,x,Y;if(e[0]!==d||e[1]!==v||e[2]!==o||e[3]!==s||e[4]!==A||e[5]!==h||e[6]!==m||e[7]!==a?.image||e[8]!==a?.name){const me=Nc(s),le=o[s.pointer]??"mine",ee=a?.image??void 0;let pe;e[23]!==m||e[24]!==a?.name?(pe=mo(a?.name)||m("sectionsEditor.formConflict.you"),e[23]=m,e[24]=a?.name,e[25]=pe):pe=e[25];let ce;e[26]!==ee||e[27]!==pe?(ce=i.jsx(ms,{url:ee,fallback:pe,shape:"circle",size:"sm",className:"text-xs"}),e[26]=ee,e[27]=pe,e[28]=ce):ce=e[28];const he=ce;let ve;e[29]!==v||e[30]!==he?(ve=v?.you?he:v?.name?i.jsx(ms,{url:v.avatarUrl,fallback:mo(v.name),shape:"circle",size:"sm",className:"text-xs"}):i.jsx(ms,{url:"icon://user",fallback:"",muted:!0,shape:"circle",size:"sm"}),e[29]=v,e[30]=he,e[31]=ve):ve=e[31];const b=ve,B=v?new Date(v.at):null;H="radiogroup",F=s.label,f="flex flex-col gap-2",e[32]!==d?(k=K=>Vc(K,d),e[32]=d,e[33]=k):k=e[33];let xe;e[34]!==s.pointer||e[35]!==h?(xe=()=>h(s.pointer,"mine"),e[34]=s.pointer,e[35]=h,e[36]=xe):xe=e[36];let T;e[37]!==m?(T=m("sectionsEditor.formConflict.you"),e[37]=m,e[38]=T):T=e[38];let ye;e[39]!==m?(ye=m("sectionsEditor.formConflict.yourVersionNotSaved"),e[39]=m,e[40]=ye):ye=e[40],X=i.jsx(po,{side:"mine",checked:le==="mine",onChoose:xe,avatar:he,who:T,meta:ye,children:me("mine")}),$=po,w="theirs",I=le==="theirs",e[41]!==s.pointer||e[42]!==h?(V=()=>h(s.pointer,"theirs"),e[41]=s.pointer,e[42]=h,e[43]=V):V=e[43],y=b,e[44]!==v?.name||e[45]!==v?.you||e[46]!==m?(C=v?.you?m("sectionsEditor.formConflict.youElsewhere"):v?.name||m("sectionsEditor.formConflict.someoneElse"),e[44]=v?.name,e[45]=v?.you,e[46]=m,e[47]=C):C=e[47],x=B?m("sectionsEditor.formConflict.savedAt",{when:Ml(B,A)}):m("sectionsEditor.formConflict.theirVersionSaved"),Y=B?Mc(B,A):void 0,z=me("theirs"),e[0]=d,e[1]=v,e[2]=o,e[3]=s,e[4]=A,e[5]=h,e[6]=m,e[7]=a?.image,e[8]=a?.name,e[9]=$,e[10]=z,e[11]=H,e[12]=F,e[13]=f,e[14]=k,e[15]=X,e[16]=w,e[17]=I,e[18]=V,e[19]=y,e[20]=C,e[21]=x,e[22]=Y}else $=e[9],z=e[10],H=e[11],F=e[12],f=e[13],k=e[14],X=e[15],w=e[16],I=e[17],V=e[18],y=e[19],C=e[20],x=e[21],Y=e[22];let M;e[48]!==$||e[49]!==z||e[50]!==w||e[51]!==I||e[52]!==V||e[53]!==y||e[54]!==C||e[55]!==x||e[56]!==Y?(M=i.jsx($,{side:w,checked:I,onChoose:V,avatar:y,who:C,meta:x,metaTitle:Y,children:z}),e[48]=$,e[49]=z,e[50]=w,e[51]=I,e[52]=V,e[53]=y,e[54]=C,e[55]=x,e[56]=Y,e[57]=M):M=e[57];let ge;return e[58]!==H||e[59]!==F||e[60]!==f||e[61]!==k||e[62]!==X||e[63]!==M?(ge=i.jsxs("div",{role:H,"aria-label":F,className:f,onKeyDown:k,children:[X,M]}),e[58]=H,e[59]=F,e[60]=f,e[61]=k,e[62]=X,e[63]=M,e[64]=ge):ge=e[64],ge}const Mc=(n,e)=>n.toLocaleString(e,{dateStyle:"medium",timeStyle:"short"});function mo(n){return(n??"").trim().split(/\s+/).filter(Boolean).slice(0,2).map(e=>e.charAt(0).toUpperCase()).join("")}function po(n){const e=it.c(28),{side:s,checked:o,onChoose:a,avatar:u,who:h,meta:d,metaTitle:v,children:m}=n,j=R.useId(),A=`${j}-who`,$=`${j}-meta ${j}-value`,z=o?0:-1,H=o?"border-primary bg-primary/5 ring-1 ring-primary":"hover:bg-muted/50";let F;e[0]!==H?(F=ae("grid w-full cursor-pointer grid-cols-[auto_minmax(0,1fr)] items-start gap-3 rounded-xl border bg-background p-3 text-left transition-[border-color,box-shadow,background-color] outline-none","focus-visible:ring-2 focus-visible:ring-ring/50",H),e[0]=H,e[1]=F):F=e[1];const f=`${j}-who`;let k;e[2]!==f||e[3]!==h?(k=i.jsx("span",{id:f,className:"text-sm font-medium text-foreground",children:h}),e[2]=f,e[3]=h,e[4]=k):k=e[4];const X=`${j}-meta`;let w;e[5]!==d||e[6]!==v||e[7]!==X?(w=i.jsx("span",{id:X,title:v,children:d}),e[5]=d,e[6]=v,e[7]=X,e[8]=w):w=e[8];let I;e[9]!==k||e[10]!==w?(I=i.jsxs("span",{className:"flex flex-wrap items-baseline gap-x-1.5 text-xs text-muted-foreground",children:[k,w]}),e[9]=k,e[10]=w,e[11]=I):I=e[11];const V=`${j}-value`,y=`conflict-${s}`;let C;e[12]!==m||e[13]!==V||e[14]!==y?(C=i.jsx("span",{id:V,"data-testid":y,className:"min-w-0 text-sm",children:m}),e[12]=m,e[13]=V,e[14]=y,e[15]=C):C=e[15];let x;e[16]!==I||e[17]!==C?(x=i.jsxs("span",{className:"flex min-w-0 flex-col gap-1",children:[I,C]}),e[16]=I,e[17]=C,e[18]=x):x=e[18];let Y;return e[19]!==u||e[20]!==o||e[21]!==a||e[22]!==A||e[23]!==x||e[24]!==$||e[25]!==z||e[26]!==F?(Y=i.jsxs("button",{type:"button",role:"radio","aria-checked":o,"aria-labelledby":A,"aria-describedby":$,tabIndex:z,onClick:a,className:F,children:[u,x]}),e[19]=u,e[20]=o,e[21]=a,e[22]=A,e[23]=x,e[24]=$,e[25]=z,e[26]=F,e[27]=Y):Y=e[27],Y}function Pc(n){const e=it.c(4),{parts:s}=n;let o;e[0]!==s?(o=s.map(Ic),e[0]=s,e[1]=o):o=e[1];let a;return e[2]!==o?(a=i.jsx("span",{className:"whitespace-pre-wrap break-words",children:o}),e[2]=o,e[3]=a):a=e[3],a}function Ic(n,e){return n.kind==="changed"?i.jsx("mark",{className:"rounded-sm bg-warning/20 px-0.5 text-foreground",children:n.text},e):i.jsx("span",{children:n.text},e)}function Bc(n){const e=it.c(29),{preview:s}=n,o=Ft();switch(s.kind){case"empty":{let a;e[0]!==o?(a=o("sectionsEditor.formConflict.empty"),e[0]=o,e[1]=a):a=e[1];let u;return e[2]!==a?(u=i.jsx("span",{className:"italic text-muted-foreground",children:a}),e[2]=a,e[3]=u):u=e[3],u}case"text":{let a;return e[4]!==s.text?(a=i.jsx("span",{className:"whitespace-pre-wrap break-words",children:s.text}),e[4]=s.text,e[5]=a):a=e[5],a}case"image":{let a;return e[6]!==s.src?(a=i.jsx("img",{src:s.src,alt:"",className:"max-h-24 max-w-full rounded border object-contain"}),e[6]=s.src,e[7]=a):a=e[7],a}case"yesNo":{const a=s.value?"sectionsEditor.formConflict.yes":"sectionsEditor.formConflict.no";let u;e[8]!==o||e[9]!==a?(u=o(a),e[8]=o,e[9]=a,e[10]=u):u=e[10];let h;return e[11]!==u?(h=i.jsx("span",{children:u}),e[11]=u,e[12]=h):h=e[12],h}case"list":{const a=s.count===1?"sectionsEditor.formConflict.oneItem":"sectionsEditor.formConflict.items",u=String(s.count);let h;e[13]!==o||e[14]!==a||e[15]!==u?(h=o(a,{count:u}),e[13]=o,e[14]=a,e[15]=u,e[16]=h):h=e[16];let d;e[17]!==h?(d=i.jsx("span",{className:"text-muted-foreground",children:h}),e[17]=h,e[18]=d):d=e[18];let v;e[19]!==s.count||e[20]!==s.items?(v=s.items.some(Boolean)&&i.jsxs("span",{className:"flex flex-col",children:[s.items.map(Fc),s.count>s.items.length&&i.jsx("span",{children:"…"})]}),e[19]=s.count,e[20]=s.items,e[21]=v):v=e[21];let m;return e[22]!==d||e[23]!==v?(m=i.jsxs("span",{className:"flex flex-col gap-1",children:[d,v]}),e[22]=d,e[23]=v,e[24]=m):m=e[24],m}case"fields":{let a;e[25]!==s.entries?(a=s.entries.map(Kc),e[25]=s.entries,e[26]=a):a=e[26];let u;return e[27]!==a?(u=i.jsx("dl",{className:"grid grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-0.5",children:a}),e[27]=a,e[28]=u):u=e[28],u}}}function Kc(n){return i.jsxs("div",{className:"contents",children:[i.jsx("dt",{className:"text-muted-foreground",children:n.label}),i.jsx("dd",{className:"truncate",children:n.text})]},n.label)}function Fc(n,e){return i.jsx("span",{className:"truncate",children:`${e+1}. ${n||"…"}`},e)}function Oc(n,e){return n.kind==="protocol"&&n.source==="github"?e:null}function Lc(n,e){if(Object.hasOwn(n,e))return n[e]??null;const s=Yr(e),o=Object.keys(n).find(a=>Yr(a)===s);return o===void 0?null:n[o]??null}async function $c(n,e){try{const s=await fetch(`/api/${n.orgSlug}/decofile/${encodeURIComponent(n.virtualMcpId)}/${encodeURIComponent(n.branch)}`,{cache:"no-store",headers:Na("v8")});if(!s.ok)return null;const o=await s.json().catch(()=>({})),a=Lc(o.changedBy??{},e);return a&&typeof a.userId=="string"&&Number.isFinite(Date.parse(a.at))?a:null}catch{return null}}function zc(n,e,s){const o=e.find(h=>h.userId===n.userId),a=o?.user?.name?.trim(),u=o?.user?.image??void 0;return{...a?{name:a}:{},...u?{avatarUrl:u}:{},at:n.at,you:!!s&&n.userId===s}}function Hc(n){let e=2166136261,s=0;for(let o=0;o<n.length;o++){const a=n.charCodeAt(o);e=Math.imul(e^a,16777619),s=Math.imul(s,31)+a|0}return`${(e>>>0).toString(36)}${(s>>>0).toString(36)}:${n.length}`}function Wc(n,e,s){const o=it.c(19),a=!!n&&!!e&&s!==null;let u;o[0]!==e||o[1]!==n||o[2]!==s?(u=yo.conflictAuthor(n?`${n.orgSlug}/${n.virtualMcpId}/${n.branch}`:"",e??"",s??""),o[0]=e,o[1]=n,o[2]=s,o[3]=u):u=o[3];let h;o[4]!==e||o[5]!==n?(h=()=>$c(n,e),o[4]=e,o[5]=n,o[6]=h):h=o[6];let d;o[7]!==a||o[8]!==u||o[9]!==h?(d={queryKey:u,queryFn:h,enabled:a,staleTime:Number.POSITIVE_INFINITY,gcTime:6e5,retry:!1,refetchOnWindowFocus:!1},o[7]=a,o[8]=u,o[9]=h,o[10]=d):d=o[10];const{data:v}=qi(d),m=a?v??null:null,j=!!m;let A;o[11]!==j?(A={enabled:j},o[11]=j,o[12]=A):A=o[12];const{data:$}=Il(A);let z;o[13]!==$?(z=$?.data?.members??[],o[13]=$,o[14]=z):z=o[14];const H=z,{data:F}=xo.useSession();if(!m)return null;const f=F?.user?.id??null;let k;return o[15]!==m||o[16]!==H||o[17]!==f?(k=zc(m,H,f),o[15]=m,o[16]=H,o[17]=f,o[18]=k):k=o[18],k}function qc(n,e,s,o){if(!n||typeof n!="object")return{kind:"error",reason:"no-matcher-rule"};const a=e.trim();if(!a)return Gt(n,s,o)?{kind:"inline",blockKey:n.__resolveType??"",inlinedRule:xs(n,s,o)}:{kind:"noop"};const u=ys(n,s,o);if(!u)return{kind:"error",reason:"unreadable-rule"};if(u.blockKey)return{kind:"updateBlock",blockKey:u.blockKey,blockData:Kt(u.resolveType,u.data,a)};const h=Fn(a),d=On(h,s);return d?{kind:"error",reason:"invalid-block-id",message:d}:{kind:"createBlock",blockId:h,blockData:Kt(u.resolveType,u.data,a),reference:on(h)}}const ho="section-form-stale-save",Gc=3,Uc=1e3;function go(n,e){const s=e.global&&e.pageKey?[{label:"Default",sections:[{__resolveType:e.pageKey}]}]:So(e.pageKey?n[e.pageKey]?.sections:void 0,n),o=Math.max(0,Math.min(e.pageVariantIndex,s.length-1)),a=s[o]?.sections??[];return{pageVariants:s,variantIndex:o,rawSections:a,parsedSections:_n(a,n)}}const vo=new WeakMap;let Yc=0;function Jc(n){let e=vo.get(n);return e===void 0&&(e=++Yc,vo.set(n,e)),e}function tm({orgSlug:n,virtualMcpId:e,branch:s,previewReady:o=!0,previewUrl:a,currentPath:u,activePageBlockKey:h=null,activeGlobalBlockKey:d=null,externalSelection:v,onSaved:m,initialEditSeo:j=!1,onExitSeo:A,onSelectRoot:$,onViewJsonFile:z,onFocusedBlockChange:H,onVariantPreviewOverride:F}){const f=Ft(),k=Yi(),X=k?.taskId??null,w=o?{orgSlug:n,virtualMcpId:e,branch:s,threadId:X,previewUrl:a}:null,[I,V]=R.useState([]),{data:y,isLoading:C}=Ta(w,{pollWhile:I.length>0}),{data:x,isLoading:Y}=ia(w),M=Wn(),ge=k?.virtualMcpId,le=ka(ge===e?e:null)?.metadata?.siteSlug??null,ee=Rl({virtualMcpId:e,branch:s,sandboxUrl:a}),pe=Va(e,s),ce=Da(pe),he=!ce,ve=!!ee||ce,[b,B]=R.useState(null),[xe,T]=R.useState(null),[ye,K]=R.useState(null),[Se,ue]=R.useState(0),[te,se]=R.useState(void 0),[Te,Z]=R.useState(null),[_e,be]=R.useState(null),[q,O]=R.useState([]),Ke=R.useRef(null),[Qe,Xe]=R.useState(q.length);Qe!==q.length&&(Xe(q.length),requestAnimationFrame(()=>{Ke.current&&(Ke.current.scrollTop=0)}));const[Ye,Q]=R.useState(0),[ke,He]=R.useState(null),[We,Ee]=R.useState(null),[Ie,Ve]=R.useState(null),[Ze,Fe]=R.useState(!1),[re,dt]=R.useState(!1),ne=R.useRef(null),[De,yt]=R.useState(!0),[et,ft]=R.useState(!1),[Ot,kn]=R.useState(!1),[qe,an]=R.useState(j),[Cs,Ns]=R.useState(j);j&&!Cs&&(Ns(!0),an(!0),B(null),T(null),K(null),O([])),!j&&Cs&&Ns(!1);const[Do,ln]=R.useState(null),[Ts,En]=R.useState(void 0),[Vs,Lt]=R.useState([]),[Ds,Yt]=R.useState(0),[Je,at]=R.useState(0),[Mo,tt]=R.useState(null),[Jt,st]=R.useState(null),[Ms,Ps]=R.useState(null),Is=Gi(),Bs=Ma({orgSlug:n,virtualMcpId:e,branch:s},{tunnel:!1}),cn=aa({orgSlug:n,virtualMcpId:e,branch:s}),[Po,Io]=R.useState(u),[Bo,Ko]=R.useState(h),[Fo,Oo]=R.useState(d);(Po!==u||Bo!==h||Fo!==d)&&(queueMicrotask(()=>cn.flush()),Io(u),Ko(h),Oo(d),B(null),T(null),K(null),ue(0),Z(null),be(null),at(0),tt(null),st(null),O([]),Q(t=>t+1),an(!1),ln(null),En(void 0),Lt([]),Yt(t=>t+1));const G=la({orgSlug:n,virtualMcpId:e,branch:s}),un=ja((t,r)=>{G.mutate({blockKey:t,data:r},{onSuccess:()=>m?.(),onError:G.reportError})}),Rn=Oa({orgSlug:n,virtualMcpId:e,branch:s}),[Qt,Xt]=R.useState(!1),W=R.useRef(null),At=R.useRef(null),mt=R.useRef(null),pt=R.useRef(null),An=R.useRef({}),$t=R.useRef(null),dn=R.useRef(!1),fn=R.useRef(!1),Oe=R.useRef(new Map),Zt=R.useRef(!1),St=R.useRef([]),qn=R.useRef(new WeakSet);Pa(n,e,t=>{const{activePageKey:r,rawSections:l,parsedSections:c,selectedSectionIndex:p}=Le.current,S=new Set;r&&S.add(r);for(const g of[At.current?.sectionIndex,p]){const _=g==null?void 0:l[g],L=g==null?void 0:c[g],N=_&&L?.isSavedBlock?ds(_,L):null;N&&S.add(N)}if([...S].some(g=>t.has(g))){for(const g of[W,mt,pt])g.current&&clearTimeout(g.current),g.current=null;At.current=null,Oe.current.clear(),r&&t.has(r)&&(An.current={})}});const Le=R.useRef({rawSections:[],parsedSections:[],decofile:{},activePageKey:null,pageVariants:[],variantIndex:0,sectionVariantIndex:0,selectedSectionIndex:null}),[Ks,Fs]=R.useState(0),[Lo,$o]=R.useState(0),zo=Wc(Oc(pe,{orgSlug:n,virtualMcpId:e,branch:s}),I[0]?.blockKey??null,I[0]?Hc(ze(I[0].plan.theirs)):null),[Ho,Wo]=R.useState(null),Gn=Ia(n,e).epoch,[qo,Go]=R.useState(Gn);if(!o||C||Y)return i.jsx("div",{className:"h-full w-full flex items-center justify-center",children:i.jsx(Ui,{className:"size-5 text-muted-foreground"})});if(!y||!x)return i.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:f("sectionsEditor.sectionsEditor.couldNotLoadSiteData")});const Uo=Ha(y,x),ie=!!d,je=ie?null:Wa(Uo,u,h),E=ie?d:je?.key??null,Un=ie&&d?y[d]:void 0,Os=ie&&d&&Un?qa(d,Un):ie&&d?d:"",mn=!ie&&E&&y[E]?y[E]:null,Yn=qe&&y&&x&&E&&je?Kr(y,{kind:"page",pageKey:E,pageName:String(je.name??""),path:String(je.path??"")},x):null,Yo=qe?mn?.seo:void 0,Cn=Ts!==void 0?Ts:Yo,Jo=qe?ca(Cn):void 0,Ls=Yn?.seoTypeOptions??[],$s=qe&&x?ua(x):"",Jn=Do??Jo??{},Nn=qe&&Yn?Bl(Jn,Yn):null,zs=qe&&Nn&&da(Cn)?Kn(Nn,x):null,Hs=qe?fa(y,x)?.seoData:void 0,Me=ie?[{label:"Default",sections:[{__resolveType:d}]}]:So(mn?.sections,y??{}),ht=Me.length>1,we=Math.min(Se,Me.length-1),rt=Me[we],U=rt?.sections??[],Pe=_n(U,y),Qn=!ie&&Ga(mn?.sections);if(ie&&d&&Ms!==d){Ps(d);const t=U[0],r=Pe[0];if(t&&r){B(0),at(0),O([]);const l=jt(t,r,y);l&&(T(l.data),K(l.resolveType),st(null),tt(null))}}!ie&&Ms!==null&&Ps(null),Le.current={rawSections:U,parsedSections:Pe,decofile:y??{},activePageKey:E,pageVariants:Me,variantIndex:we,sectionVariantIndex:Je,selectedSectionIndex:b};const Qo=()=>({multivariate:Qn,index:we,variants:Me.map(t=>({rule:t.rule}))}),Xn=(t,r)=>{if(!F)return;if(!E||!Qn||t.length<=1){F(null);return}const l={multivariate:!0,index:r,variants:t},c=ce?ro(E,l):oo(E,l,y,x);F(c.length>0?c:null)},Zn=F&&E&&Qn&&ht&&!C&&!Y?E:null;if(Zn!==Ho&&(Wo(Zn),Zn)){const t=Me.map(l=>({rule:l.rule})),r=we;queueMicrotask(()=>Xn(t,r))}const en=(t,r,l)=>{if(!F)return;if(!E){F(null);return}const c=Qo(),p=ce?ro(E,c):oo(E,c,y,x);if(!t||r<0){F(p.length>0?p:null);return}const S={pageKey:E,page:c,sectionIndex:r,sectionLazy:Pe[r]?.isLazy??!1,mvObj:t,selectedVariantIndex:l},g=ce?Fl(S):Ol({...S,decofile:y,meta:x}),_=[...p,...g];F(_.length>0?_:null)},bt=(t,r,l,c=b??-1,p=!1)=>{const S=xt(t,r);if(!S){T(null),K(null),st(null),tt(null),p&&en(null,c,l);return}const _=vs(S,wt)[l];if(!_){T(null),K(null),st(null),tt(null),p&&en(null,c,l);return}const L=wo(_.value,y);T(L?.data??null),K(L?.resolveType??null);const{resolveType:N,formValue:D}=jn(_.rule,y,x??void 0);st(N),tt(D),p&&en(S,c,l)},pn=v?.index;if(v!==void 0&&(v?.seq??null)!==te&&(se(v?.seq??null),typeof pn=="number")){const t=U[pn],r=Pe[pn];if(t&&r)if(B(pn),at(0),O([]),Q(l=>l+1),r.isMultivariate)bt(t,r,0,pn);else{const l=jt(t,r,y);l?(T(l.data),K(l.resolveType)):(T(null),K(null)),st(null),tt(null)}}if(Gn!==qo){Go(Gn);const t=W.current!==null||Oe.current.size>0||pt.current!==null||mt.current!==null||G.isPending||cn.isPending||I.length>0,r=b!==null&&co(Ke.current,document.activeElement);if(!t&&r&&(Zt.current=!0),!t&&!r&&b!==null){const l=U[b],c=Pe[b];if(O([]),Q(p=>p+1),!l||!c)B(null),T(null),K(null);else if(c.isMultivariate)bt(l,c,Je,b);else{const p=jt(l,c,y);T(p?.data??null),K(p?.resolveType??null)}}!t&&qe&&(ln(null),En(void 0),Yt(l=>l+1))}if(Ks!==Lo){$o(Ks);const t=b!==null?U[b]:null,r=b!==null?Pe[b]:null;if(t&&r&&b!==null)if(O([]),Q(l=>l+1),r.isMultivariate)bt(t,r,Je,b);else{const l=jt(t,r,y);T(l?.data??null),K(l?.resolveType??null)}}const lt=I[0];if(lt){const{formBase:t,target:r}=lt,l=go(y,r),c=t.sectionIndex,p=l.rawSections.length===t.sectionCount?hs(l.rawSections[c],l.parsedSections[c],r.sectionVariantIndex,y):null,S=lc(lt,p,g=>ao(t,g));if(S){const _=[{...lt,...S,changedAgain:!0},...I.slice(1)];St.current=_,V(_)}}const hn={orgSlug:n,virtualMcpId:e,branch:s,threadId:X,previewUrl:ce?void 0:a??void 0,siteSlug:le},Tn=ye&&x?Kn(ye,x):null,ct=(t,r)=>{if(!E)return;W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear(),pt.current&&(clearTimeout(pt.current),pt.current=null),mt.current&&(clearTimeout(mt.current),mt.current=null);const l=Sn(y,E,t,we,Me);G.mutate({blockKey:E,data:l},{onSuccess:()=>r?.onSuccess?.()??m?.(),onError:c=>{r?.onError?.(),G.reportError(c)}})},zt=()=>{H?.(null),B(null),kn(!1),T(null),K(null),at(0),tt(null),st(null),O([]),Q(t=>t+1)},Ws=()=>co(Ke.current,document.activeElement),es=(t=f("sectionsEditor.sectionsEditor.blockChangedElsewhere"))=>{if(W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear(),At.current=null,oe.error(t,{id:ho}),Ws()){Zt.current=!0;return}Fs(r=>r+1)},qs=()=>{!Zt.current||Ws()||St.current.length>0||W.current!==null||dn.current||fn.current||Oe.current.size>0||(Zt.current=!1,Fs(t=>t+1))},Gs=()=>{Zt.current&&setTimeout(qs,0)},Us=t=>Ka(Is,Bs,t),Ys=t=>{Oe.current.size!==0&&setTimeout(()=>{if(dn.current||fn.current)return;const r=[...Oe.current.values()];Oe.current.clear();for(const l of r)l()},t)},Xo=t=>{const{activePageKey:r,variantIndex:l,sectionVariantIndex:c}=Le.current,p=$t.current;return{formBase:p?.sectionIndex===t&&p.variantIndex===c?p:null,pageKey:r,global:ie,pageVariantIndex:l,sectionVariantIndex:c,schema:Tn}},gn=t=>{St.current=t,V(t)},Zo=t=>{const r=St.current,l=r.findIndex(S=>S.formBase===t.formBase),c=l>=0?r[l]:void 0,p=c?r.with(l,{...t,choices:ks(c.plan,c.choices,t.plan),fresh:To(c.plan,t.plan,c.fresh),changedAgain:c.changedAgain||ze(c.plan.theirs)!==ze(t.plan.theirs)}):[...r,{...t,changedAgain:qn.current.has(t.formBase)}];gn(p)},Js=(t,r)=>{const l=St.current,c=l.findIndex(g=>g.formBase===t),p=l[c];if(!p)return!1;if(ze(p.plan.mine)===ze(r))return!0;const S=ws({...p.plan,mine:r});if(S.pointers.length===0){const g=l.filter(_=>_!==p);return gn(g),!1}return gn(l.with(c,{...p,plan:S,choices:ks(p.plan,p.choices,S)})),!0},ei=t=>{const r=Le.current;return r.selectedSectionIndex===t.formBase.sectionIndex&&r.activePageKey===t.target.pageKey&&r.variantIndex===t.target.pageVariantIndex&&r.sectionVariantIndex===t.target.sectionVariantIndex},ti=()=>{const t=St.current[0];if(!t)return null;const{formBase:r,target:l}=t;W.current&&At.current?.sectionIndex===r.sectionIndex&&At.current.sectionVariantIndex===l.sectionVariantIndex&&(clearTimeout(W.current),W.current=null,At.current=null),Oe.current.delete(`${l.pageKey}:${r.sectionIndex}:${l.sectionVariantIndex}`);const c=r.emitted;return c&&typeof c=="object"&&!Js(r,c)&&vn(c,r.sectionIndex,0,l),St.current[0]??null},ni=()=>{const t=St.current[0],r=ti();if(!r||!t||r.formBase!==t.formBase||r.plan.pointers.some(S=>!t.plan.pointers.includes(S)))return;const l=ic(r.plan,r.choices);gn(St.current.slice(1));const{formBase:c,target:p}=r;c.base=r.plan.theirs,c.version=void 0,c.emitted=l,qn.current.add(c),($t.current===c||ei(r))&&($t.current=c,T(l),Q(S=>S+1)),vn(l,c.sectionIndex,0,p)},si=t=>{const[r,...l]=St.current;r&&gn([{...r,choices:t},...l])},vn=(t,r,l=0,c)=>{const p=c??Xo(r),S=p.sectionVariantIndex,g=p.formBase,_=At.current;W.current&&(clearTimeout(W.current),W.current=null,_&&(_.sectionIndex!==r||_.sectionVariantIndex!==S)&&_.write());const L=`${p.pageKey}:${r}:${S}`,N=()=>{if(dn.current||fn.current){Oe.current.set(L,N);return}const D=typeof t=="function"?t():t;if(g&&Js(g,D))return;const P=Le.current.decofile,{rawSections:de,parsedSections:Re,pageVariants:nt,variantIndex:Be}=go(P,p),Ge=p.pageKey,J=de[r];if(!J)return;const fe=Re[r];if(!fe)return;const Ce=g?.base,Ue=hs(J,fe,S,P),gt=!!Ce&&!!Ue&&Ao(Ce,Ue)&&!(g&&ao(g,Ue));if(gt&&Ce&&Ue){if(Co(Ce,Ue)){es(f("sectionsEditor.sectionsEditor.sectionReplacedElsewhere"));return}const Ae=fe.isSavedBlock?"here":rc(Ce,de.map((Ne,Mt)=>hs(Ne,Re[Mt],S,P)),r,g?.sectionCount??de.length);if(Ae==="unknown"){es(f("sectionsEditor.sectionsEditor.sectionReplacedElsewhere"));return}if(typeof Ae=="number"&&g){g.sectionCount=de.length,g.sectionIndex=Ae,$t.current===g&&B(Ae),vn(D,Ae,l,p);return}}const ot=gt&&Ce&&Ue?ws({ancestor:Ce,mine:D,theirs:Ue}):null;if(ot&&ot.pointers.length>0&&g){g.sectionCount=de.length,Zo({plan:ot,formBase:g,target:p,sectionIndex:r,choices:No(ot),changedAgain:!1,blockKey:fe.isSavedBlock?ds(J,fe):Ge,fresh:{}});return}const vt=ot?ot.merged:null,Dt=vt??D,Mr=oc({merged:!!vt,tracked:g,current:$t.current,saved:D});vt&&oe.info(f("sectionsEditor.sectionsEditor.blockMergedWithOthers"),{id:ho}),Mr&&g&&(g.emitted=vt,T(vt));const cs=Mr||!vt?Dt:D;g&&(g.base=cs,g.sectionCount=de.length,nc(g,cs));const Pr={onSuccess:()=>{g&&qn.current.delete(g),m?.()},onError:Ae=>{if(g?.base===cs&&Ce&&(g.base=Ce),Ae instanceof Ba){g&&(g.version=void 0),l<Gc?(Oe.current.delete(L),fn.current=!0,setTimeout(()=>{fn.current=!1,vn(()=>{const Ne=g?.emitted;return Ne&&typeof Ne=="object"?Ne:D},r,l+1,p),Oe.current.delete(L),Ys(bn)},Uc*2**l)):es();return}G.reportError(Ae)}},Ir=Ae=>{dn.current=!0;let Ne=!1;G.mutateAsync(Ae).then(()=>Pr.onSuccess(),Mt=>{Ne=!0,Pr.onError(Mt)}).finally(()=>{dn.current=!1,Ys(Ne?bn:0),qs()})};if(fe.isSavedBlock){const Ae=ds(J,fe);if(!Ae)return;Ir({blockKey:Ae,data:Dt,...Ce?{base:{value:vt?Ue:Ce}}:{},rebaseOnConflict:!1,guard:lo({formBase:g,rebased:!!vt,versionOf:Us})});return}if(!Ge)return;const In={...P[Ge]},Wt=[...de];if(fe.isMultivariate){const Ae=xt(J,fe);if(!Ae||!Ge)return;const Ne=al(Ae,S,Dt);Wt[r]=qt(J,fe,Ne)}else if(fe.isHidden){const Ae=Rs(J.__resolveType),Ne=Ae?{...J.section}:{...J},Mt=Array.isArray(Ne.variants)?[...Ne.variants]:[];Mt[0]&&(Mt[0]={...Mt[0],value:Dt}),Ne.variants=Mt,Ae?Wt[r]={...J,section:Ne}:Wt[r]=Ne}else fe.isLazy?Wt[r]={...J,section:Dt}:Wt[r]=Dt;if(nt.length>1){const Ae=In.sections,Ne=[...Ae?.variants??[]];Ne[Be]&&(Ne[Be]={...Ne[Be],value:Wt}),In.sections={...Ae,variants:Ne}}else In.sections=Wt;Ir({blockKey:Ge,data:In,rebaseOnConflict:!1,guard:lo({formBase:null,rebased:!1,versionOf:Us})})};At.current={sectionIndex:r,sectionVariantIndex:S,write:N},W.current=setTimeout(()=>{W.current=null,N()},bn)},ri=t=>{Zt.current=!1,B(t),at(0),O([]),Q(p=>p+1);const r=U[t],l=Pe[t];if(H?.(l?.isSavedBlock?l.resolveType??null:null),!r||!l)return;if(l.isMultivariate){bt(r,l,0,t);return}const c=jt(r,l,y);if(!c){T(null),K(null),st(null),tt(null),en(null,t,0);return}T(c.data),K(c.resolveType),st(null),tt(null),en(null,t,0)},Qs=t=>{const r=t;b!==null&&($t.current=sc($t.current,{sectionIndex:b,variantIndex:Le.current.sectionVariantIndex,shown:xe,next:r,sectionCount:Le.current.rawSections.length})),T(r),b!==null&&vn(r,b)},ts=t=>{if(!E||!y||!x||!je)return;const r={kind:"page",pageKey:E,pageName:String(je.name??""),path:String(je.path??"")},l=Kr(y,r,x);l&&cn.save(E,()=>{const c=Is.getQueryData(yo.decofile(Bs))?.[E];if(!c||typeof c!="object"||c===null||Array.isArray(c))return null;const p={...c,...An.current};return An.current={},t?.raw!==void 0?{...p,seo:t.raw}:t?.inner!==void 0?Kl(r,l,p,t.inner):p})},Xs=(t,r)=>{E&&(An.current[t]=r,ts())},oi=(t,r)=>{if(!E)return;const l=Ln([...U],t,r);b!==null&&(b===t?B(r):t<b&&r>=b?B(b-1):t>b&&r<=b&&B(b+1)),ct(l)},ii=t=>{if(!E)return;const r=U.filter((l,c)=>c!==t);b===t?zt():b!==null&&b>t&&B(b-1),ct(r)},ai=t=>{if(!E)return;const r=U[t];if(!r)return;const l=[...U];l.splice(t+1,0,wa(r)),b!==null&&b>t&&B(b+1),ct(l)},li=t=>{if(!E)return;const r=U[t],l=Pe[t];if(!r||!l)return;const c=l.isHidden?nl(r):sl(r);if(!c)return;const p=[...U];p[t]=c,b===t&&zt(),ct(p)},ci=t=>{if(!E)return;const r=U[t],l=Pe[t];if(!r||!l||l.isMultivariate)return;const c=tl(r);if(!c)return;const p=[...U];p[t]=c,b===t&&zt(),ct(p)},ui=t=>{if(!E)return;const r=U[t],l=Pe[t];if(!r||!l?.isSavedBlock)return;const c=jt(r,l,y);if(!c?.data)return;const{name:p,...S}=c.data,g=[...U];l.isLazy?g[t]={...r,section:S}:g[t]=S,b===t&&zt(),ct(g)},di=t=>{if(!E)return;const r=[...U,{__resolveType:t.resolveType}],l=r.length-1;ct(r,{onError:()=>{Le.current.selectedSectionIndex===l&&zt()}}),Fe(!1),B(l),at(0),O([]),Q(g=>g+1);const c=r[l],p=_n(r,y)[l];if(!c||!p)return;if(p.isMultivariate){bt(c,p,0);return}const S=jt(c,p,y);if(!S){T(null),K(null),st(null),tt(null);return}T(S.data),K(S.resolveType),st(null),tt(null)},Zs=t=>{ne.current=t.append,Fe(!0)},fi=t=>{const r=ne.current;if(!r){di(t);return}r({__resolveType:t.resolveType}),Fe(!1),ne.current=null},er=t=>{if(b===null)return;const r=U[b],l=Pe[b];!r||!l?.isMultivariate||(at(t),O([]),Q(c=>c+1),bt(r,l,t,b,!0))},mi=t=>{if(b===null||!E)return;const r=U[b],l=Pe[b];if(!r||!l?.isMultivariate)return;const c=xt(r,l);if(!c)return;const p=Za(c,t);if(!p){oe.error(f("sectionsEditor.sectionsEditor.cannotDeleteOnlyVariant"));return}const S=[...U];S[b]=qt(r,l,p);const g=p.variants;let _=Je;t===Je?_=Math.min(t,g.length-1):t<Je&&(_=Je-1),at(_),O([]),Q(L=>L+1),bt(S[b],l,_),ct(S)},pi=t=>{if(b===null||!E)return;const r=U[b],l=Pe[b];if(!r||!l?.isMultivariate)return;const c=xt(r,l);if(!c)return;const p=el(c,t),S=[...U];S[b]=qt(r,l,p);const g=t+1;at(g),O([]),Q(_=>_+1),bt(S[b],l,g),ct(S)},hi=(t,r)=>{if(b===null||!E||t===r)return;const l=U[b],c=Pe[b];if(!l||!c?.isMultivariate)return;const p=xt(l,c);if(!p)return;const S=Qa(p,t,r),g=[...U];g[b]=qt(l,c,S);let _=Je;Je===t?_=r:t<Je&&r>=Je?_=Je-1:t>Je&&r<=Je&&(_=Je+1),at(_),bt(g[b],c,_),ct(g)},xn=t=>{const r=t??b;if(r===null||!E)return;const l=U[r],c=Pe[r];if(!l||!c)return;const p=Ua(l,c);if(!p){oe.error(f("sectionsEditor.sectionsEditor.sectionCannotHaveVariants"));return}const S=[...U];S[r]=p.section;const g=_n(S,y)[r];if(!g?.isMultivariate){oe.error(f("sectionsEditor.sectionsEditor.couldNotAddVariant"));return}B(r),at(p.newVariantIndex),O([]),Q(_=>_+1),bt(p.section,g,p.newVariantIndex,r),ct(S)},tr=()=>{if(b===null||!E)return;const t=U[b],r=Pe[b];if(!t||!r?.isMultivariate)return;const l=xt(t,r);if(!l)return;const c=Xa(t,r,l);if(!c){oe.error(f("sectionsEditor.sectionsEditor.couldNotRemoveVariants"));return}const p=[...U];p[b]=c;const S=_n(p,y)[b];if(!S)return;at(0),st(null),tt(null),O([]),Q(_=>_+1);const g=jt(c,S,y);g?(T(g.data),K(g.resolveType)):(T(null),K(null)),en(null,b,0),ct(p)},gi=async t=>{if(ke===null||!E)return;const r=On(t,y,x);if(r){oe.error(r);return}const l=U[ke],c=Pe[ke];if(!l||!c)return;const p=jt(l,c,y);if(!p){oe.error(f("sectionsEditor.sectionsEditor.sectionCannotBeSavedAsGlobal"));return}const S={...p.data,name:t};try{await G.mutateAsync({blockKey:t,data:S});const g=[...U];g[ke]={__resolveType:t},await G.mutateAsync({blockKey:E,data:Sn(y,E,g,we,Me)}),b===ke&&zt(),He(null),oe.success(f("sectionsEditor.sectionsEditor.savedGlobalBlock",{blockId:t})),m?.()}catch(g){oe.error(f("sectionsEditor.sectionsEditor.failedToSaveGlobalBlock"),{description:Pt(f,It(g))})}},nr=rt?.rule;if(ht&&b===null&&_e===null&&nr){const{resolveType:t,formValue:r}=jn(nr,y??{},x??void 0);be(t),Z(r)}const tn=x?ma(x):[],ns=x&&y?pa(x,y):[],sr=!ie&&!!(ve&&x&&y),rr=_e&&x?Kn(_e,x):null,Ct=()=>{mt.current&&(clearTimeout(mt.current),mt.current=null),pt.current&&(clearTimeout(pt.current),pt.current=null)},Ht=async(t,r)=>{if(!(il(r,t,x)>0))try{await Rn.mutateAsync({blockKey:t})}catch(l){oe.error(f("sectionsEditor.sectionsEditor.couldNotDeleteMatcherBlock"),{description:Pt(f,It(l))})}},or=t=>{mt.current&&clearTimeout(mt.current),mt.current=setTimeout(()=>{const{activePageKey:r,decofile:l,variantIndex:c}=Le.current;if(!r)return;const p={...l[r]},S={...p.sections},g=[...S.variants??[]],_=g[c],L=_?.rule;if(Gt(L,l,x)){const N=L?.__resolveType??"",D=l[N],P=typeof D?.name=="string"?D.name:N,{__resolveType:de,...Re}=t;G.mutate({blockKey:N,data:Kt(de??"",Re,P)},{onSuccess:()=>m?.(),onError:G.reportError});return}_&&(g[c]={..._,rule:t}),p.sections={...S,variants:g},G.mutate({blockKey:r,data:p},{onSuccess:()=>m?.(),onError:G.reportError})},bn)},ir=t=>{be(t);const r=t?Jr(t,x):{__resolveType:Qr};Z(t?r:{}),or(r)},ar=t=>{const r=t;Z(r);const l=_e?{__resolveType:_e,...r}:{...r};or(l)},lr=async t=>{Ct();const{activePageKey:r,decofile:l,variantIndex:c}=Le.current;if(!r)return;const p=l[r],S=p?.sections;if(!S||typeof S!="object"||Array.isArray(S))return;const g=S;if(!Array.isArray(g.variants))return;const _=[...g.variants],L=_[c];if(!L)return;const N=Bt(L.rule,l,x),D=on(t);_[c]={...L,rule:D};const P={...l,[r]:{...p,sections:{...g,variants:_}}},{resolveType:de,formValue:Re}=jn(D,P,x??void 0);be(de),Z(Re);try{await G.mutateAsync({blockKey:r,data:P[r]}),N&&N!==t&&await Ht(N,P),m?.()}catch(nt){oe.error(f("sectionsEditor.sectionsEditor.couldNotApplySavedRule"),{description:Pt(f,It(nt))})}},cr=t=>{pt.current&&clearTimeout(pt.current);const{selectedSectionIndex:r,sectionVariantIndex:l}=Le.current;r!==null&&(pt.current=setTimeout(()=>{const{rawSections:c,parsedSections:p,decofile:S,activePageKey:g,pageVariants:_,variantIndex:L}=Le.current;if(!g)return;const N=c[r],D=p[r];if(!N||!D?.isMultivariate)return;const P=xt(N,D);if(!P)return;const Re=(P.variants??[])[l]?.rule;if(Gt(Re,S,x)){const J=Re?.__resolveType??"",fe=S[J],Ce=typeof fe?.name=="string"?fe.name:J,{__resolveType:Ue,...gt}=t;G.mutate({blockKey:J,data:Kt(Ue??"",gt,Ce)},{onSuccess:()=>m?.(),onError:G.reportError});return}const nt=Xr(P,l,t),Be=[...c];Be[r]=qt(N,D,nt);const Ge=Sn(S,g,Be,L,_);G.mutate({blockKey:g,data:Ge},{onSuccess:()=>m?.(),onError:G.reportError})},bn))},vi=t=>{st(t);const r=t?Jr(t,x):{__resolveType:Qr};tt(t?r:{}),cr(r)},xi=t=>{const r=t;tt(r);const l=Jt?{__resolveType:Jt,...r}:{...r};cr(l)},yi=async t=>{Ct();const{selectedSectionIndex:r,sectionVariantIndex:l,rawSections:c,parsedSections:p,decofile:S,activePageKey:g,pageVariants:_,variantIndex:L}=Le.current;if(r===null||!g)return;const N=c[r],D=p[r];if(!N||!D?.isMultivariate)return;const P=xt(N,D);if(!P)return;const de=P.variants??[],Re=Bt(de[l]?.rule,S,x),nt=on(t),Be=Xr(P,l,nt),Ge=[...c];Ge[r]=qt(N,D,Be);const J=Sn(S,g,Ge,L,_),fe={...S,[g]:J},{resolveType:Ce,formValue:Ue}=jn(nt,fe,x??void 0);st(Ce),tt(Ue);try{await G.mutateAsync({blockKey:g,data:J}),Re&&Re!==t&&await Ht(Re,fe),m?.()}catch(gt){oe.error(f("sectionsEditor.sectionsEditor.couldNotApplySavedRule"),{description:Pt(f,It(gt))})}};if(!ie&&!je)return i.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:f("sectionsEditor.sectionsEditor.noPageFound",{currentPath:u})});if(ie&&!Un)return i.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:f("sectionsEditor.sectionsEditor.globalBlockNotFound")});const $e=b!==null?Pe[b]??null:null,ur=b!==null?U[b]:null,dr=ur&&$e?.isMultivariate?xt(ur,$e):null,Nt=dr?vs(dr,wt):[],Vn=Math.min(Je,Math.max(Nt.length-1,0)),nn=Nt[Vn]??null,Tt=$e?.isMultivariate===!0,ss=b!==null&&$e!==null,Vt=ss&&(Tt||!!(Tn&&xe)),Si=Vt&&!ie&&$e?.isSavedBlock===!0,ut=ie||Si,fr=ie?Os:$e?.label??"",bi=Jt&&x?Kn(Jt,x):null,mr=(t,r)=>r&&M?`${t} · ${r}`:t,pr=$e?$e.variantOf??$e.label:"",ji=(()=>{const t=Tt&&nn?nn.label:null;return t?M?[mr(pr,t)]:[$e.label,t]:[$e?.label??""]})(),rs=mr(je?.name??"",ht?rt?.label:null),Dn=Vt&&(!ie||q.length>0)?ie?[Os,...q]:[rs,...ji,...q]:[],hr=qe&&je?[je.name,"SEO",...Vs]:[],gr=f("sectionsEditor.pageVariantTabs.variantsLabel"),vr=et&&je?[je.name,gr]:Ot&&je&&$e?[rs,pr,gr]:[],Mn=vr.length>0?vr:hr.length>0?hr:ut?Dn.length>0?Dn:[fr]:Dn.length>0?Dn:[rs],xr=ss&&!Tt&&!$e?.isHidden&&!!E,wi=ut||!ie&&ht&&!!rt||xr,_i=ss&&!Tt&&!ie&&q.length===0&&!!$e&&jo($e)&&!!E,ki=M&&Vt&&!Ot&&Tt&&q.length===0&&!!nn,yr=M&&q.length>0?Fr(q[q.length-1]):null,Ei=q.length>1?Fr(q[q.length-2]):null,Sr=ut?fr:Vt?$e?.label??"":je?.name??"",Ri=et||Ot?f("sectionsEditor.pageVariantTabs.variantsLabel"):qe?f("sectionsEditor.panelSections.seo"):yr??Sr,br=Ot?$e?.variantOf??$e?.label??"":et||qe?je?.name??"":yr?Ei??Sr:ut?f("sectionsEditor.sectionsEditor.globalSectionSubtitle"):Vt?je?.name??"":je?.path??"",os=!et&&!Ot&&!qe&&!Vt&&!ut,Ai=!M&&!qe&&!ie&&Tt&&q.length===0,yn=()=>{if(!E)return;Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const t=y[E],r=Ya(t.sections,U);if(!r)return;const l=Ja(r);G.mutate({blockKey:E,data:{...t,sections:r}},{onSuccess:()=>{ue(l),B(null),T(null),K(null),O([]),Z(null),be(null)},onError:G.reportError})},Pn=(t,r,l)=>{if(!E)return;Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const c=y[E],p=c.sections;if(!p||typeof p!="object"||Array.isArray(p))return;const S=p;if(!Array.isArray(S.variants))return;const g=t([...S.variants]);if(!g)return;const _=ol(S,g),L={...y,[E]:{...c,sections:_}};G.mutate({blockKey:E,data:L[E]},{onSuccess:()=>{r?.();const N=typeof l=="string"?[l]:l??[];(async()=>{for(const D of N)await Ht(D,L)})()},onError:G.reportError})},is=t=>{Ee(null),ue(t),B(null),T(null),K(null),O([]);const r=Me[t]?.rule,{resolveType:l,formValue:c}=jn(r,y??{},x??void 0);be(l),Z(c),Xn(Me.map(p=>({rule:p.rule})),t)},jr=(t,r)=>{if(t===r)return;let l=we;we===t?l=r:t<we&&r>=we?l=we-1:t>we&&r<=we&&(l=we+1),ue(l);const c=Ln(Me.map(p=>({rule:p.rule})),t,r);Xn(c,l),Pn(p=>Ln(p,t,r))},wr=t=>{const r=Me[t]?.rule,l=Bt(r,y??{},x??void 0);Pn(c=>c.length<=1?null:(c.splice(t,1),c),()=>{Me.length-1===1?ue(0):t<we?ue(we-1):t===we&&ue(Math.max(0,t-1)),B(null),T(null),K(null),O([]),Z(null),be(null)},l)},Ci=()=>{const t=Me.map((r,l)=>({variant:r,index:l})).filter(({variant:r})=>!rl(r.rule)).map(({variant:r})=>Bt(r.rule,y??{},x??void 0)).filter(r=>!!r);Pn(r=>{const l=ll({variants:r}),c=r[l];return c?[{...c,rule:cl()}]:null},()=>{ue(0),B(null),T(null),K(null),O([]),Z(null),be(null),ft(!1)},t)},_r=t=>{Pn(r=>ul(r,t),()=>{ue(t+1),B(null),T(null),K(null),O([]),Z(null),be(null)})},Ni=async(t,r)=>{Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const l=Le.current.activePageKey,c=Le.current.decofile;if(!l)return;const p=c[l],S=p.sections;if(!S||typeof S!="object"||Array.isArray(S))return;const g=S;if(!Array.isArray(g.variants))return;const _=[...g.variants],L=_[t];if(!L?.rule||typeof L.rule!="object"){oe.error(f("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const N=L.rule,D=r.trim();Xt(!0);try{if(!D){if(!Gt(N,c,x)){Ee(null);return}const Ge=N.__resolveType??"";_[t]={...L,rule:xs(N,c,x)};const J={...c,[l]:{...p,sections:{...g,variants:_}}};await G.mutateAsync({blockKey:l,data:J[l]}),await Ht(Ge,J),Ee(null),m?.();return}const P=ys(N,c,x);if(!P){oe.error(f("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(P.blockKey){await G.mutateAsync({blockKey:P.blockKey,data:Kt(P.resolveType,P.data,D)}),Ee(null),m?.();return}const de=Fn(D),Re=On(de,c,x);if(Re){oe.error(Re);return}const nt=Kt(P.resolveType,P.data,D);let Be=null;try{await G.mutateAsync({blockKey:de,data:nt}),Be=de,_[t]={...L,rule:on(de)},await G.mutateAsync({blockKey:l,data:{...p,sections:{...g,variants:_}}}),Be=null}catch(Ge){throw Be&&await Rn.mutateAsync({blockKey:Be}).catch(()=>{}),Ge}Ee(null),oe.success(f("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:D})),m?.()}catch(P){oe.error(f("sectionsEditor.sectionsEditor.failedToRenameVariant"),{description:Pt(f,It(P))})}finally{Xt(!1)}},Ti=async(t,r)=>{Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const{selectedSectionIndex:l,rawSections:c,parsedSections:p,decofile:S,activePageKey:g,pageVariants:_,variantIndex:L}=Le.current;if(l===null||!g)return;const N=c[l],D=p[l];if(!N||!D?.isMultivariate)return;const P=xt(N,D);if(!P)return;const de=P.variants??[],Re=de[t];if(!Re?.rule||typeof Re.rule!="object"){oe.error(f("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const nt=Re.rule,Be=r.trim();Xt(!0);const Ge=async J=>{const fe={...P,variants:J},Ce=[...c];Ce[l]=qt(N,D,fe);const Ue=Sn(S,g,Ce,L,_);return await G.mutateAsync({blockKey:g,data:Ue}),{...S,[g]:Ue}};try{if(!Be){if(!Gt(nt,S,x)){Ve(null);return}const ot=nt.__resolveType??"",vt=[...de];vt[t]={...Re,rule:xs(nt,S,x)};const Dt=await Ge(vt);await Ht(ot,Dt),Ve(null),m?.();return}const J=ys(nt,S,x);if(!J){oe.error(f("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(J.blockKey){await G.mutateAsync({blockKey:J.blockKey,data:Kt(J.resolveType,J.data,Be)}),Ve(null),m?.();return}const fe=Fn(Be),Ce=On(fe,S,x);if(Ce){oe.error(Ce);return}const Ue=Kt(J.resolveType,J.data,Be);let gt=null;try{await G.mutateAsync({blockKey:fe,data:Ue}),gt=fe;const ot=[...de];ot[t]={...Re,rule:on(fe)},await Ge(ot),gt=null}catch(ot){throw gt&&await Rn.mutateAsync({blockKey:gt}).catch(()=>{}),ot}Ve(null),oe.success(f("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:Be})),m?.()}catch(J){oe.error(f("sectionsEditor.sectionsEditor.failedToRenameVariant"),{description:Pt(f,It(J))})}finally{Xt(!1)}},kr=async(t,r,l)=>{T(l);try{await G.mutateAsync({blockKey:t,data:l})}catch(c){throw T(p=>p===l?r:p),c}},Vi={rename:async(t,r,l)=>{Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const{activePageKey:c,decofile:p}=Le.current;if(!c)return;const S=Array.isArray(t.variants)?[...t.variants]:[],g=S[r],_=g?.rule&&typeof g.rule=="object"?g.rule:void 0,L=async D=>{const P={...t,variants:D};return await kr(c,t,P),{...p,[c]:P}},N=qc(_,l,p,x);if(N.kind!=="noop"){if(N.kind==="error"){oe.error(N.reason==="no-matcher-rule"?f("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"):N.reason==="unreadable-rule"?f("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"):N.message??f("sectionsEditor.sectionsEditor.failedToRenameVariant"));return}Xt(!0);try{if(N.kind==="inline"){const P=[...S];P[r]={...g,rule:N.inlinedRule};const de=await L(P);await Ht(N.blockKey,de),m?.();return}if(N.kind==="updateBlock"){await G.mutateAsync({blockKey:N.blockKey,data:N.blockData}),m?.();return}let D=null;try{await G.mutateAsync({blockKey:N.blockId,data:N.blockData}),D=N.blockId;const P=[...S];P[r]={...g,rule:N.reference},await L(P),D=null}catch(P){throw D&&await Rn.mutateAsync({blockKey:D}).catch(()=>{}),P}oe.success(f("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:l.trim()})),m?.()}catch(D){oe.error(f("sectionsEditor.sectionsEditor.failedToRenameVariant"),{description:Pt(f,It(D))})}finally{Xt(!1)}}},selectGlobal:async(t,r,l)=>{Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const{activePageKey:c,decofile:p}=Le.current;if(!c)return;const S=Array.isArray(t.variants)?[...t.variants]:[],g=S[r];if(!g)return;const _=Bt(g.rule,p,x);S[r]={...g,rule:on(l)};const L={...t,variants:S},N={...p,[c]:L};try{await kr(c,t,L),_&&_!==l&&await Ht(_,N),m?.()}catch(D){oe.error(f("sectionsEditor.sectionsEditor.couldNotApplySavedRule"),{description:Pt(f,It(D))})}}},Er=()=>{zt()},Rr=t=>{ln(t),ts({inner:t})},Ar=t=>{En(t),ts({raw:t})},Cr=()=>{ln(null),Lt([])},Nr=()=>Yt(t=>t+1),Tr=()=>{cn.flush(),an(!1),ln(null),En(void 0),Lt([]),Yt(t=>t+1),A?.()},Di=()=>{ft(!1),kn(!1),B(null),an(!0)},Mi=()=>{qe&&Tr(),B(null),ft(!0)},Pi=()=>kn(!0),as=t=>{if(et&&t===0){ft(!1);return}if(Ot&&t<2){kn(!1),t===0&&B(null);return}if(qe){if(t===0){Tr();return}if(t===1){Lt([]),Yt(l=>l+1);return}Lt(Vs.slice(0,t-1)),Yt(l=>l+1);return}if(ie){O(q.slice(0,t)),Q(l=>l+1);return}if(t===0){Er();return}if(t===1){O([]),Q(l=>l+1);return}const r=!M&&Tt&&nn?1:0;if(r===1&&t===2){O([]),Q(l=>l+1);return}O(q.slice(0,t-1-r))},ls=Mn.length>1?i.jsx("button",{type:"button",onClick:()=>as(_a(Mn.length,{isMultivariateSectionTop:Ai})),title:f("sectionsEditor.sectionsEditor.back"),"aria-label":f("sectionsEditor.sectionsEditor.back"),className:ae("shrink-0 inline-flex size-6 items-center justify-center rounded-[var(--studio-control-radius,var(--radius-md))] transition-colors",ut?"text-foreground/80 hover:bg-global-section/15":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:i.jsx(Ca,{className:"size-4"})}):null,Ii=ut||Vt||qe?wi&&i.jsxs("div",{className:ae("border-b px-3 py-2.5",ut&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[!ie&&ht&&rt&&i.jsxs("button",{type:"button",onClick:Er,title:f("sectionsEditor.sectionsEditor.editingInVariant",{variant:rt.label}),className:ae("shrink-0 inline-flex items-center gap-1 rounded-lg h-6 px-1.5 text-xs font-medium cursor-pointer transition-opacity hover:opacity-80",ga),children:[i.jsx(ha,{rule:fs(rt.rule,y??{},x??void 0),matchers:tn}),i.jsx("span",{className:"max-w-[160px] truncate",children:rt.label})]}),i.jsx("div",{className:"flex-1"}),ut&&i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx("span",{className:"shrink-0 cursor-help",children:i.jsx(zn,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),i.jsx(Rt,{side:"bottom",className:"max-w-[260px]",children:f("sectionsEditor.sectionsEditor.globalSectionTooltip")})]}),xr&&i.jsx(Bn,{onClick:()=>xn()})]}),ut&&i.jsx("p",{className:"mt-1.5 py-1.5 pl-1 text-sm leading-snug text-foreground",children:f("sectionsEditor.sectionsEditor.globalSectionBanner")})]}):i.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2.5",children:[i.jsx("div",{className:"flex-1 min-w-0",children:i.jsx(Or,{pageKey:E,initialName:je.name,initialPath:je.path,onFieldChange:Xs,variant:"header"})}),i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"ghost",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.editSeo"),className:"size-7 shrink-0",onClick:()=>an(!0),children:i.jsx(Gr,{size:14})})}),i.jsx(Rt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.editSeo")})]}),i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"ghost",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.viewJson"),className:"size-7 shrink-0",onClick:()=>z&&E?z():dt(!0),children:i.jsx(Ur,{size:14})})}),i.jsx(Rt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.viewJson")})]}),i.jsx(Bn,{onClick:yn})]}),Bi=i.jsxs(i.Fragment,{children:[ht&&E&&i.jsx(Lr,{listKey:E,variants:Me,activeIndex:we,decofile:y??{},meta:x,matchers:tn,onSelect:is,onReorder:jr,onRename:Ee,onDuplicate:_r,onDelete:wr,onAdd:yn}),ht&&_e!==null&&i.jsx($r,{className:"mt-3",children:i.jsx("div",{className:ae("space-y-3",Qt&&"pointer-events-none opacity-50"),children:i.jsx(us,{currentRt:_e,currentLabel:wn(rt?.rule,y??{},wt,x??void 0),currentGlobalKey:Bt(rt?.rule,y??{},x??void 0)??void 0,matchers:tn,globals:ns,onSelect:ir,onSelectGlobal:lr,schema:rr,formValue:Te,onChange:ar,formKey:`${we}:${_e??""}`,formWrapperClassName:"space-y-3",meta:x??void 0,decofile:y,onSaveReferencedBlock:un,sandbox:hn})})})]}),Vr=i.jsxs(i.Fragment,{children:[i.jsx(va,{listKey:`${E??""}:${b??""}`,variants:Nt.map((t,r)=>({index:r,label:t.label})),selectedIndex:Vn,onSelect:er,onRename:Ve,onDuplicate:pi,onDelete:mi,onRemoveAll:tr,onReorder:hi,onAdd:()=>xn()}),i.jsx($r,{children:i.jsx(us,{currentRt:Jt??"",currentLabel:wn(nn?.rule,y??{},wt,x??void 0),currentGlobalKey:Bt(nn?.rule,y??{},x??void 0)??void 0,matchers:tn,globals:ns,onSelect:vi,onSelectGlobal:yi,schema:bi,formValue:Mo,onChange:xi,formKey:`${b??"none"}:${Vn}:${Jt??""}`,formWrapperClassName:"pt-1",meta:x??void 0,decofile:y,onSaveReferencedBlock:un,sandbox:hn})})]}),Dr=i.jsx("div",{className:ae(M?"px-2":"p-2 pt-3"),children:i.jsx(Zl,{listKey:`${E??""}-${we}`,rawSections:U,sections:Pe,meta:x,decofile:y,selectedIndex:b,onSelect:ri,onReorder:oi,onDelete:ii,onDuplicate:ai,onMakeReusable:He,onToggleHidden:li,onToggleLazy:he?ci:void 0,onAddVariant:xn,onDetach:ui,onAddSection:()=>Fe(!0),canAddSection:sr})}),Ki=i.jsxs("div",{className:"min-w-0 max-w-full space-y-4 overflow-x-hidden px-3",children:[E&&je&&i.jsx(Or,{pageKey:E,initialName:je.name,initialPath:je.path,onFieldChange:Xs}),mn&&E?i.jsx(so,{rawSeo:Cn,innerSeo:Jn,defaultResolveType:$s,seoSchema:zs,activeResolveType:Nn,seoTypeOptions:Ls,formResetKey:Ds,siteDefaultSeo:Hs,onBreadcrumbChange:Lt,onPersistRaw:Ar,onInnerChange:Rr,onClearForm:Cr,onBumpFormKey:Nr,asyncRenderAvailable:he}):i.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:f("sectionsEditor.sectionsEditor.seoSchemaNotFound")})]}),Fi=i.jsx(rn,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:i.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:i.jsx("div",{className:"mx-auto max-w-2xl",children:mn&&E?i.jsx(so,{rawSeo:Cn,innerSeo:Jn,defaultResolveType:$s,seoSchema:zs,activeResolveType:Nn,seoTypeOptions:Ls,formResetKey:Ds,siteDefaultSeo:Hs,onBreadcrumbChange:Lt,onPersistRaw:Ar,onInnerChange:Rr,onClearForm:Cr,onBumpFormKey:Nr,asyncRenderAvailable:he}):i.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:f("sectionsEditor.sectionsEditor.seoSchemaNotFound")})})})},"editor-seo"),Oi=i.jsxs(rn,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[ht&&E&&i.jsx(Lr,{listKey:E,variants:Me,activeIndex:we,decofile:y??{},meta:x,matchers:tn,onSelect:is,onReorder:jr,onRename:Ee,onDuplicate:_r,onDelete:wr,onAdd:yn}),ht&&_e!==null&&i.jsxs("div",{className:ae("px-3 border-b",De?"pt-3 pb-5 space-y-3":"py-2"),children:[i.jsxs("button",{type:"button",onClick:()=>yt(t=>!t),className:"flex w-full items-center justify-between gap-2 text-left cursor-pointer rounded-[var(--studio-control-radius,var(--radius-sm))] py-0.5 hover:bg-muted/40","aria-expanded":De,children:[i.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:f("sectionsEditor.sectionsEditor.variantRule")}),De?i.jsx(Ea,{className:"size-3.5 shrink-0 text-muted-foreground"}):i.jsx(Ra,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),De&&i.jsx("div",{className:ae("space-y-3",Qt&&"pointer-events-none opacity-50"),children:i.jsx(us,{currentRt:_e,currentLabel:wn(rt?.rule,y??{},wt,x??void 0),currentGlobalKey:Bt(rt?.rule,y??{},x??void 0)??void 0,matchers:tn,globals:ns,onSelect:ir,onSelectGlobal:lr,schema:rr,formValue:Te,onChange:ar,formKey:`${we}:${_e??""}`,formWrapperClassName:"space-y-3",meta:x??void 0,decofile:y,onSaveReferencedBlock:un,sandbox:hn})})]}),Dr]},"editor-section-list");return i.jsx(xa,{children:i.jsxs("div",{className:"flex h-full min-w-0 w-full flex-col",children:[!M&&ls&&i.jsx("div",{className:"flex min-w-0 shrink-0 items-center gap-2 px-3 py-2",children:ls}),(M||Mn.length>1)&&i.jsx(ya,{crumbs:Mn,onSelect:as,onSelectRoot:()=>{cn.flush(),$?$():as(0)}}),i.jsx("div",{className:"shrink-0",children:M?i.jsxs("div",{className:ae("flex items-center gap-2 border-b px-3 py-2.5",ut&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[M&&ls,ut&&i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx("span",{className:"shrink-0 cursor-help",children:i.jsx(zn,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),i.jsx(Rt,{side:"bottom",className:"max-w-[260px]",children:f("sectionsEditor.sectionsEditor.globalSectionTooltip")})]}),i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[i.jsx("span",{className:"truncate text-sm font-semibold",children:Ri}),br&&i.jsx("span",{className:"truncate text-xs text-muted-foreground",children:br})]}),os&&ht&&rt&&i.jsx(zr,{variants:Me,activeIndex:we,onSelect:is,onManage:Mi,onRemoveAll:Ci}),ki&&i.jsx(zr,{variants:Nt,activeIndex:Vn,onSelect:er,onManage:Pi,onRemoveAll:tr}),os&&!ht&&i.jsx(Bn,{onClick:yn}),_i&&i.jsx(Bn,{onClick:()=>xn()}),i.jsx(Sa,{}),os&&i.jsxs(i.Fragment,{children:[i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"outline",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.editSeo"),className:"size-7 shrink-0",onClick:Di,children:i.jsx(Gr,{size:14})})}),i.jsx(Rt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.editSeo")})]}),!z&&i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"outline",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.viewJson"),className:"size-7 shrink-0",onClick:()=>dt(!0),children:i.jsx(Ur,{size:14})})}),i.jsx(Rt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.viewJson")})]})]})]}):Ii}),lt&&i.jsx(yc,{open:!0,fields:cc(lt.plan,lt.target.schema),choices:lt.choices,changedAgain:lt.changedAgain,author:zo,fresh:lt.fresh,onChoose:(t,r)=>si({...lt.choices,[t]:r}),onApply:ni},Jc(lt.formBase)),Ot?i.jsx(Hr,{onAdd:()=>xn(),children:Vr},"editor-section-variants"):Vt?i.jsxs(rn,{viewportRef:Ke,onBlur:Gs,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[!M&&Tt&&Nt.length>0&&q.length===0&&Vr,i.jsx(Wr,{activeSchema:Tn,formValue:xe,formResetKey:Ye,onFormChange:Qs,onBreadcrumbChange:O,breadcrumbPath:q,emptyMessage:f("sectionsEditor.sectionsEditor.noEditableFieldsForVariant"),meta:x,decofile:y,onSaveReferencedBlock:un,sandbox:hn,previewBaseUrl:ee,onRequestAddSection:Zs,onVariantMatcherOp:ie?Vi:void 0})]},"editor-section-form"):ie?i.jsx(rn,{viewportRef:Ke,onBlur:Gs,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:i.jsx(Wr,{activeSchema:Tn,formValue:xe,formResetKey:Ye,onFormChange:Qs,onBreadcrumbChange:O,breadcrumbPath:q,emptyMessage:f("sectionsEditor.sectionsEditor.noEditableFieldsForGlobalBlock"),meta:x,decofile:y,onSaveReferencedBlock:un,sandbox:hn,previewBaseUrl:ee,onRequestAddSection:Zs})},"editor-global-block"):qe?M?i.jsx(rn,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:i.jsx("div",{className:"p-3",children:Ki})},"editor-seo"):Fi:et?i.jsx(Hr,{onAdd:yn,children:Bi},"editor-variants"):M?i.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[i.jsx(rn,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:i.jsx("div",{className:"py-2",children:Dr})}),i.jsx("div",{className:"shrink-0 border-t p-2",children:i.jsx(js,{canAddSection:sr,onAddSection:()=>Fe(!0)})})]},"editor-section-list"):Oi,i.jsx(ba,{open:ke!==null,onOpenChange:t=>{t||He(null)},defaultBlockId:ke!==null?Fn(Pe[ke]?.label??""):"",isPending:G.isPending,onSubmit:gi}),ve&&i.jsx(Al,{open:Ze,onOpenChange:t=>{Fe(t),t||(ne.current=null)},meta:x,decofile:y,previewBaseUrl:ee,onSelect:fi}),re&&E&&y&&i.jsx(La,{open:re,onOpenChange:dt,pageKey:E,decofile:y}),We!==null&&i.jsx(qr,{open:!0,initialName:Gt(Me[We]?.rule,y??{},x??void 0)?wn(Me[We]?.rule,y??{},wt,x??void 0):"",autoLabel:wt(fs(Me[We]?.rule,y??{},x??void 0)),isPending:Qt,onSubmit:async t=>{await Ni(We,t)},onOpenChange:t=>{!t&&!Qt&&Ee(null)}}),Ie!==null&&i.jsx(qr,{open:!0,initialName:Gt(Nt[Ie]?.rule,y??{},x??void 0)?wn(Nt[Ie]?.rule,y??{},wt,x??void 0):"",autoLabel:wt(fs(Nt[Ie]?.rule,y??{},x??void 0)),isPending:Qt,onSubmit:async t=>{await Ti(Ie,t)},onOpenChange:t=>{!t&&!Qt&&Ve(null)}})]})})}export{tm as SectionsEditor};
|
|
4
|
+
`).trim()}const pc={" ":" ","&":"&","<":"<",">":">",""":'"',"'":"'"};function hc(n){if(typeof DOMParser<"u")return new DOMParser().parseFromString(n,"text/html").body.textContent??"";let e=n;for(let s="";s!==e;)s=e,e=e.replace(/<[^<>]*>/g,"");return e.replace(/<|>/g,"").replace(/&(nbsp|amp|lt|gt|quot|#39);/g,s=>pc[s]??s)}function $n(n){const e=n.replace(/\s+/g," ").trim();return e.length>uo?`${e.slice(0,uo-1)}…`:e}function gc(n){if(n.startsWith("data:"))return"image";const e=n.split(/[?#]/)[0]??n;return decodeURIComponent(e.split("/").pop()||n)}function Hn(n,e){if(n==null||n==="")return{kind:"empty"};if(typeof n=="string")return Vo(n,e)?{kind:"image",src:n}:{kind:"text",text:Es(n,e)};if(typeof n=="number"||typeof n=="bigint")return{kind:"text",text:String(n)};if(typeof n=="boolean")return{kind:"yesNo",value:n};if(Array.isArray(n)){const s=e?.items??null;return{kind:"list",count:n.length,items:n.slice(0,mc).map(o=>vc(o,s)??"")}}if(typeof n=="object"){const s=n;if("value"in s&&Object.keys(s).length<=2)return Hn(s.value,e?.properties?.value??e);const o=Object.entries(s).filter(([a,u])=>!a.startsWith("__")&&u!==void 0).flatMap(([a,u])=>{const h=e?.properties?.[a]??null,d=Hn(u,h);if(d.kind==="empty")return[];const v=d.kind==="text"?$n(d.text):d.kind==="image"?gc(d.src):d.kind==="yesNo"?d.value?"✓":"✗":d.kind==="list"?`${d.count}`:"…";return[{label:h?.title?.trim()||a,text:v}]}).slice(0,4);return o.length>0?{kind:"fields",entries:o}:{kind:"empty"}}return{kind:"text",text:String(n)}}function vc(n,e){if(typeof n=="string")return $n(Es(n,e));if(!n||typeof n!="object"||Array.isArray(n))return null;const s=n,o=e?.titleBy,a=o?s[o]:void 0;if(typeof a=="string"&&a.trim())return $n(a);for(const[u,h]of Object.entries(s))if(!(u.startsWith("__")||typeof h!="string"||!h.trim())&&!Vo(h,e?.properties?.[u]??null))return $n(Es(h,null));return null}const fo=1500;function xc(n,e){const s=n.split(/(\s+)/).filter(j=>j!==""),o=e.split(/(\s+)/).filter(j=>j!=="");if(s.length>fo||o.length>fo)return{mine:[{text:n,kind:"changed"}],theirs:[{text:e,kind:"changed"}]};const a=Array.from({length:s.length+1},()=>new Array(o.length+1).fill(0));for(let j=s.length-1;j>=0;j--)for(let A=o.length-1;A>=0;A--){const $=a[j];$[A]=s[j]===o[A]?a[j+1][A+1]+1:Math.max(a[j+1][A],$[A+1])}const u=[],h=[],d=(j,A,$)=>{const z=j.at(-1);z&&(z.kind===$||$==="same"&&!A.trim())?z.text+=A:j.push({text:A,kind:$})};let v=0,m=0;for(;v<s.length&&m<o.length;)s[v]===o[m]?(d(u,s[v],"same"),d(h,o[m],"same"),v++,m++):a[v+1][m]>=a[v][m+1]?(d(u,s[v],"changed"),v++):(d(h,o[m],"changed"),m++);for(;v<s.length;v++)d(u,s[v],"changed");for(;m<o.length;m++)d(h,o[m],"changed");return{mine:u,theirs:h}}function yc(n){const e=it.c(10);let s,o;e[0]!==n?({open:s,...o}=n,e[0]=n,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const{data:a}=xo.useSession();let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=ae("max-h-[85vh] grid-rows-[auto_minmax(0,1fr)_auto] sm:max-w-lg"),e[3]=u):u=e[3];const h=a?.user??null;let d;e[4]!==o||e[5]!==h?(d=i.jsx(Cl,{className:u,"data-testid":"form-conflict-dialog",onEscapeKeyDown:jc,onOpenAutoFocus:bc,children:i.jsx(Ac,{...o,viewer:h,heading:Sc})}),e[4]=o,e[5]=h,e[6]=d):d=e[6];let v;return e[7]!==s||e[8]!==d?(v=i.jsx(Dl,{open:s,children:d}),e[7]=s,e[8]=d,e[9]=v):v=e[9],v}function Sc(n,e){return i.jsxs(Nl,{className:"text-left",children:[i.jsx(Tl,{children:n}),i.jsx(Vl,{children:e})]})}function bc(n){n.preventDefault(),n.currentTarget?.focus()}function jc(n){return n.preventDefault()}const wc={},_c=(n,e)=>i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx("h2",{className:"text-lg font-semibold",children:n}),i.jsx("p",{className:"text-sm text-muted-foreground",children:e})]});function kc(n,e,s=0,o={},a=null){const u=e[Math.min(s,e.length-1)],h=a?.you?void 0:a?.name?.split(/\s+/)[0],d={field:u?Rc(u.label):"",label:u?.label??"",name:h??""},v=(m,j,A)=>n(a?.you?A:h?j:m,d);return e.length<=1?{title:v("sectionsEditor.formConflict.titleOne","sectionsEditor.formConflict.titleOneNamed","sectionsEditor.formConflict.titleOneYou"),description:n("sectionsEditor.formConflict.descriptionOne")}:{title:v("sectionsEditor.formConflict.titleStep","sectionsEditor.formConflict.titleStepNamed","sectionsEditor.formConflict.titleStepYou"),description:s>=e.length-1?i.jsx(Ec,{t:n,fields:e,choices:o,name:h}):n("sectionsEditor.formConflict.descriptionStep")}}function Ec(n){const e=it.c(11),{t:s,fields:o,choices:a,name:u}=n;let h;if(e[0]!==a||e[1]!==o||e[2]!==u||e[3]!==s){let v;e[5]!==a||e[6]!==u||e[7]!==s?(v=(m,j)=>i.jsxs(R.Fragment,{children:[j>0&&" · ",`${m.label}: `,i.jsx("span",{className:"font-medium text-foreground",children:s((a[m.pointer]??"mine")==="mine"?"sectionsEditor.formConflict.summaryYours":u?"sectionsEditor.formConflict.summaryTheirsNamed":"sectionsEditor.formConflict.summaryTheirs",{name:u??""})})]},m.pointer),e[5]=a,e[6]=u,e[7]=s,e[8]=v):v=e[8],h=o.map(v),e[0]=a,e[1]=o,e[2]=u,e[3]=s,e[4]=h}else h=e[4];let d;return e[9]!==h?(d=i.jsx("span",{"data-testid":"form-conflict-summary",children:h}),e[9]=h,e[10]=d):d=e[10],d}function Rc(n){return/^[A-Z][a-z]/.test(n)&&!n.includes("›")?n.charAt(0).toLowerCase()+n.slice(1):n}function Ac(n){const e=it.c(68),s=Ft(),{fields:o,choices:a,changedAgain:u,fresh:h,heading:d}=n,v=u===void 0?!1:u,m=h===void 0?wc:h,j=d===void 0?_c:d,A=o.length>1,[$,z]=R.useState(0),[H,F]=R.useState(Cc);let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f={},e[0]=f):f=e[0];const[k,Z]=R.useState(f),w=Math.max(0,Math.min($,o.length-1)),I=o[w],V=w===o.length-1;let y;e[1]!==w||e[2]!==o||e[3]!==m?(y=Se=>{const ue=o[w],te=o[Se];!ue||!te||Se===w||(F(se=>new Set(se).add(ue.pointer)),Z(se=>({...se,[ue.pointer]:m[ue.pointer]??0,[te.pointer]:m[te.pointer]??0})),z(Se))},e[1]=w,e[2]=o,e[3]=m,e[4]=y):y=e[4];const C=y;let x;e[5]!==w||e[6]!==C?(x=Se=>{if(!Se)return;const ue=te=>{const se={ArrowLeft:-1,ArrowRight:1}[te.key];!se||te.defaultPrevented||te.altKey||te.ctrlKey||te.metaKey||te.shiftKey||Pl(te.target)||(te.preventDefault(),C(w+se))};return Se.ownerDocument.addEventListener("keydown",ue),()=>Se.ownerDocument.removeEventListener("keydown",ue)},e[5]=w,e[6]=C,e[7]=x):x=e[7];const Y=x;if(!I)return null;let M,ge,me,le,ee;if(e[8]!==H||e[9]!==w||e[10]!==a||e[11]!==o||e[12]!==m||e[13]!==C||e[14]!==j||e[15]!==Y||e[16]!==A||e[17]!==n||e[18]!==k||e[19]!==s){const{title:Se,description:ue}=kc(s,o,w,a,n.author??null);let te;e[25]!==n?(te=se=>{se.detail>1||n.onApply()},e[25]=n,e[26]=te):te=e[26],M=te,ge=A?Y:void 0,me="flex min-w-0 flex-col gap-3",e[27]!==H||e[28]!==w||e[29]!==o||e[30]!==m||e[31]!==C||e[32]!==A||e[33]!==k||e[34]!==s?(le=A&&i.jsxs("div",{className:"flex items-center justify-between gap-3",children:[i.jsx("div",{role:"group","aria-label":s("sectionsEditor.formConflict.steps"),className:"-m-1 flex flex-wrap items-center",children:o.map((se,Te)=>{const X=Te!==w&&(m[se.pointer]??0)>(k[se.pointer]??0);return i.jsx("button",{type:"button","aria-label":X?s("sectionsEditor.formConflict.stepChangedAgain",{label:se.label}):se.label,"aria-current":Te===w?"step":void 0,"data-answered":Te!==w&&H.has(se.pointer)?"":void 0,"data-changed-again":X?"":void 0,onClick:()=>C(Te),className:"group cursor-pointer rounded-full p-1 outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:i.jsx("span",{className:ae("block h-2 w-2 rounded-full bg-border transition-[width,background-color,box-shadow] motion-reduce:transition-none","group-hover:bg-muted-foreground/60","group-data-[answered]:bg-foreground/45","group-aria-[current=step]:w-5 group-aria-[current=step]:bg-foreground","group-data-[changed-again]:ring-2 group-data-[changed-again]:ring-warning group-data-[changed-again]:ring-offset-1 group-data-[changed-again]:ring-offset-background")})},se.pointer)})}),i.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:s("sectionsEditor.formConflict.stepCount",{step:String(w+1),count:String(o.length)})})]}),e[27]=H,e[28]=w,e[29]=o,e[30]=m,e[31]=C,e[32]=A,e[33]=k,e[34]=s,e[35]=le):le=e[35],ee=j(Se,ue),e[8]=H,e[9]=w,e[10]=a,e[11]=o,e[12]=m,e[13]=C,e[14]=j,e[15]=Y,e[16]=A,e[17]=n,e[18]=k,e[19]=s,e[20]=M,e[21]=ge,e[22]=me,e[23]=le,e[24]=ee}else M=e[20],ge=e[21],me=e[22],le=e[23],ee=e[24];let pe;e[36]!==ge||e[37]!==me||e[38]!==le||e[39]!==ee?(pe=i.jsxs("div",{ref:ge,className:me,children:[le,ee]}),e[36]=ge,e[37]=me,e[38]=le,e[39]=ee,e[40]=pe):pe=e[40];const ce=!v&&"sr-only";let he;e[41]!==ce?(he=ae("text-sm text-muted-foreground",ce),e[41]=ce,e[42]=he):he=e[42];let ve;e[43]!==v||e[44]!==A||e[45]!==s?(ve=v?s(A?"sectionsEditor.formConflict.changedAgainSteps":"sectionsEditor.formConflict.changedAgain"):"",e[43]=v,e[44]=A,e[45]=s,e[46]=ve):ve=e[46];let b;e[47]!==he||e[48]!==ve?(b=i.jsx("p",{role:"status",className:he,children:ve}),e[47]=he,e[48]=ve,e[49]=b):b=e[49];const B=A?"vertical":"all";let xe;e[50]!==I||e[51]!==n||e[52]!==B?(xe=i.jsx(Dc,{field:I,...n,arrows:B}),e[50]=I,e[51]=n,e[52]=B,e[53]=xe):xe=e[53];let T;e[54]!==b||e[55]!==xe?(T=i.jsxs("div",{className:"-mx-2 flex min-h-0 flex-col gap-3 overflow-y-auto px-2 py-1",children:[b,xe]}),e[54]=b,e[55]=xe,e[56]=T):T=e[56];let ye;e[57]!==M||e[58]!==w||e[59]!==C||e[60]!==V||e[61]!==A||e[62]!==s?(ye=A?i.jsxs(no,{className:"flex-row flex-wrap items-center justify-between gap-2 sm:justify-between",children:[i.jsx(_t,{type:"button",variant:"outline","aria-disabled":w===0,onClick:()=>C(w-1),className:"aria-disabled:cursor-default aria-disabled:opacity-45",children:s("sectionsEditor.formConflict.back")}),i.jsx(_t,{type:"button","data-testid":"form-conflict-primary",onClick:V?M:()=>C(w+1),children:s(V?"sectionsEditor.formConflict.ok":"sectionsEditor.formConflict.next")})]}):i.jsx(no,{className:"items-center gap-2",children:i.jsx(_t,{type:"button","data-testid":"form-conflict-primary",onClick:M,children:s("sectionsEditor.formConflict.ok")})}),e[57]=M,e[58]=w,e[59]=C,e[60]=V,e[61]=A,e[62]=s,e[63]=ye):ye=e[63];let K;return e[64]!==pe||e[65]!==T||e[66]!==ye?(K=i.jsxs(i.Fragment,{children:[pe,T,ye]}),e[64]=pe,e[65]=T,e[66]=ye,e[67]=K):K=e[67],K}function Cc(){return new Set}function Nc(n){const e=Hn(n.mine,n.schema),s=Hn(n.theirs,n.schema),o=e.kind==="text"&&s.kind==="text"?xc(e.text,s.text):null;return a=>o?i.jsx(Pc,{parts:o[a]}):i.jsx(Bc,{preview:a==="mine"?e:s})}const Tc={all:{ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1},vertical:{ArrowDown:1,ArrowUp:-1}};function Vc(n,e){const s=Tc[e][n.key];if(!s)return;const o=[...n.currentTarget.querySelectorAll('[role="radio"]')],a=o.indexOf(document.activeElement);if(a<0)return;n.preventDefault();const u=o[(a+s+o.length)%o.length];u?.focus(),u?.click()}function Dc(n){const e=it.c(65),{field:s,choices:o,viewer:a,author:u,onChoose:h,arrows:d}=n,v=u===void 0?null:u,m=Ft(),[j]=Wi(),{language:A}=j;let $,z,H,F,f,k,Z,w,I,V,y,C,x,Y;if(e[0]!==d||e[1]!==v||e[2]!==o||e[3]!==s||e[4]!==A||e[5]!==h||e[6]!==m||e[7]!==a?.image||e[8]!==a?.name){const me=Nc(s),le=o[s.pointer]??"mine",ee=a?.image??void 0;let pe;e[23]!==m||e[24]!==a?.name?(pe=mo(a?.name)||m("sectionsEditor.formConflict.you"),e[23]=m,e[24]=a?.name,e[25]=pe):pe=e[25];let ce;e[26]!==ee||e[27]!==pe?(ce=i.jsx(ms,{url:ee,fallback:pe,shape:"circle",size:"sm",className:"text-xs"}),e[26]=ee,e[27]=pe,e[28]=ce):ce=e[28];const he=ce;let ve;e[29]!==v||e[30]!==he?(ve=v?.you?he:v?.name?i.jsx(ms,{url:v.avatarUrl,fallback:mo(v.name),shape:"circle",size:"sm",className:"text-xs"}):i.jsx(ms,{url:"icon://user",fallback:"",muted:!0,shape:"circle",size:"sm"}),e[29]=v,e[30]=he,e[31]=ve):ve=e[31];const b=ve,B=v?new Date(v.at):null;H="radiogroup",F=s.label,f="flex flex-col gap-2",e[32]!==d?(k=K=>Vc(K,d),e[32]=d,e[33]=k):k=e[33];let xe;e[34]!==s.pointer||e[35]!==h?(xe=()=>h(s.pointer,"mine"),e[34]=s.pointer,e[35]=h,e[36]=xe):xe=e[36];let T;e[37]!==m?(T=m("sectionsEditor.formConflict.you"),e[37]=m,e[38]=T):T=e[38];let ye;e[39]!==m?(ye=m("sectionsEditor.formConflict.yourVersionNotSaved"),e[39]=m,e[40]=ye):ye=e[40],Z=i.jsx(po,{side:"mine",checked:le==="mine",onChoose:xe,avatar:he,who:T,meta:ye,children:me("mine")}),$=po,w="theirs",I=le==="theirs",e[41]!==s.pointer||e[42]!==h?(V=()=>h(s.pointer,"theirs"),e[41]=s.pointer,e[42]=h,e[43]=V):V=e[43],y=b,e[44]!==v?.name||e[45]!==v?.you||e[46]!==m?(C=v?.you?m("sectionsEditor.formConflict.youElsewhere"):v?.name||m("sectionsEditor.formConflict.someoneElse"),e[44]=v?.name,e[45]=v?.you,e[46]=m,e[47]=C):C=e[47],x=B?m("sectionsEditor.formConflict.savedAt",{when:Ml(B,A)}):m("sectionsEditor.formConflict.theirVersionSaved"),Y=B?Mc(B,A):void 0,z=me("theirs"),e[0]=d,e[1]=v,e[2]=o,e[3]=s,e[4]=A,e[5]=h,e[6]=m,e[7]=a?.image,e[8]=a?.name,e[9]=$,e[10]=z,e[11]=H,e[12]=F,e[13]=f,e[14]=k,e[15]=Z,e[16]=w,e[17]=I,e[18]=V,e[19]=y,e[20]=C,e[21]=x,e[22]=Y}else $=e[9],z=e[10],H=e[11],F=e[12],f=e[13],k=e[14],Z=e[15],w=e[16],I=e[17],V=e[18],y=e[19],C=e[20],x=e[21],Y=e[22];let M;e[48]!==$||e[49]!==z||e[50]!==w||e[51]!==I||e[52]!==V||e[53]!==y||e[54]!==C||e[55]!==x||e[56]!==Y?(M=i.jsx($,{side:w,checked:I,onChoose:V,avatar:y,who:C,meta:x,metaTitle:Y,children:z}),e[48]=$,e[49]=z,e[50]=w,e[51]=I,e[52]=V,e[53]=y,e[54]=C,e[55]=x,e[56]=Y,e[57]=M):M=e[57];let ge;return e[58]!==H||e[59]!==F||e[60]!==f||e[61]!==k||e[62]!==Z||e[63]!==M?(ge=i.jsxs("div",{role:H,"aria-label":F,className:f,onKeyDown:k,children:[Z,M]}),e[58]=H,e[59]=F,e[60]=f,e[61]=k,e[62]=Z,e[63]=M,e[64]=ge):ge=e[64],ge}const Mc=(n,e)=>n.toLocaleString(e,{dateStyle:"medium",timeStyle:"short"});function mo(n){return(n??"").trim().split(/\s+/).filter(Boolean).slice(0,2).map(e=>e.charAt(0).toUpperCase()).join("")}function po(n){const e=it.c(28),{side:s,checked:o,onChoose:a,avatar:u,who:h,meta:d,metaTitle:v,children:m}=n,j=R.useId(),A=`${j}-who`,$=`${j}-meta ${j}-value`,z=o?0:-1,H=o?"border-primary bg-primary/5 ring-1 ring-primary":"hover:bg-muted/50";let F;e[0]!==H?(F=ae("grid w-full cursor-pointer grid-cols-[auto_minmax(0,1fr)] items-start gap-3 rounded-xl border bg-background p-3 text-left transition-[border-color,box-shadow,background-color] outline-none","focus-visible:ring-2 focus-visible:ring-ring/50",H),e[0]=H,e[1]=F):F=e[1];const f=`${j}-who`;let k;e[2]!==f||e[3]!==h?(k=i.jsx("span",{id:f,className:"text-sm font-medium text-foreground",children:h}),e[2]=f,e[3]=h,e[4]=k):k=e[4];const Z=`${j}-meta`;let w;e[5]!==d||e[6]!==v||e[7]!==Z?(w=i.jsx("span",{id:Z,title:v,children:d}),e[5]=d,e[6]=v,e[7]=Z,e[8]=w):w=e[8];let I;e[9]!==k||e[10]!==w?(I=i.jsxs("span",{className:"flex flex-wrap items-baseline gap-x-1.5 text-xs text-muted-foreground",children:[k,w]}),e[9]=k,e[10]=w,e[11]=I):I=e[11];const V=`${j}-value`,y=`conflict-${s}`;let C;e[12]!==m||e[13]!==V||e[14]!==y?(C=i.jsx("span",{id:V,"data-testid":y,className:"min-w-0 text-sm",children:m}),e[12]=m,e[13]=V,e[14]=y,e[15]=C):C=e[15];let x;e[16]!==I||e[17]!==C?(x=i.jsxs("span",{className:"flex min-w-0 flex-col gap-1",children:[I,C]}),e[16]=I,e[17]=C,e[18]=x):x=e[18];let Y;return e[19]!==u||e[20]!==o||e[21]!==a||e[22]!==A||e[23]!==x||e[24]!==$||e[25]!==z||e[26]!==F?(Y=i.jsxs("button",{type:"button",role:"radio","aria-checked":o,"aria-labelledby":A,"aria-describedby":$,tabIndex:z,onClick:a,className:F,children:[u,x]}),e[19]=u,e[20]=o,e[21]=a,e[22]=A,e[23]=x,e[24]=$,e[25]=z,e[26]=F,e[27]=Y):Y=e[27],Y}function Pc(n){const e=it.c(4),{parts:s}=n;let o;e[0]!==s?(o=s.map(Ic),e[0]=s,e[1]=o):o=e[1];let a;return e[2]!==o?(a=i.jsx("span",{className:"whitespace-pre-wrap break-words",children:o}),e[2]=o,e[3]=a):a=e[3],a}function Ic(n,e){return n.kind==="changed"?i.jsx("mark",{className:"rounded-sm bg-warning/20 px-0.5 text-foreground",children:n.text},e):i.jsx("span",{children:n.text},e)}function Bc(n){const e=it.c(29),{preview:s}=n,o=Ft();switch(s.kind){case"empty":{let a;e[0]!==o?(a=o("sectionsEditor.formConflict.empty"),e[0]=o,e[1]=a):a=e[1];let u;return e[2]!==a?(u=i.jsx("span",{className:"italic text-muted-foreground",children:a}),e[2]=a,e[3]=u):u=e[3],u}case"text":{let a;return e[4]!==s.text?(a=i.jsx("span",{className:"whitespace-pre-wrap break-words",children:s.text}),e[4]=s.text,e[5]=a):a=e[5],a}case"image":{let a;return e[6]!==s.src?(a=i.jsx("img",{src:s.src,alt:"",className:"max-h-24 max-w-full rounded border object-contain"}),e[6]=s.src,e[7]=a):a=e[7],a}case"yesNo":{const a=s.value?"sectionsEditor.formConflict.yes":"sectionsEditor.formConflict.no";let u;e[8]!==o||e[9]!==a?(u=o(a),e[8]=o,e[9]=a,e[10]=u):u=e[10];let h;return e[11]!==u?(h=i.jsx("span",{children:u}),e[11]=u,e[12]=h):h=e[12],h}case"list":{const a=s.count===1?"sectionsEditor.formConflict.oneItem":"sectionsEditor.formConflict.items",u=String(s.count);let h;e[13]!==o||e[14]!==a||e[15]!==u?(h=o(a,{count:u}),e[13]=o,e[14]=a,e[15]=u,e[16]=h):h=e[16];let d;e[17]!==h?(d=i.jsx("span",{className:"text-muted-foreground",children:h}),e[17]=h,e[18]=d):d=e[18];let v;e[19]!==s.count||e[20]!==s.items?(v=s.items.some(Boolean)&&i.jsxs("span",{className:"flex flex-col",children:[s.items.map(Fc),s.count>s.items.length&&i.jsx("span",{children:"…"})]}),e[19]=s.count,e[20]=s.items,e[21]=v):v=e[21];let m;return e[22]!==d||e[23]!==v?(m=i.jsxs("span",{className:"flex flex-col gap-1",children:[d,v]}),e[22]=d,e[23]=v,e[24]=m):m=e[24],m}case"fields":{let a;e[25]!==s.entries?(a=s.entries.map(Kc),e[25]=s.entries,e[26]=a):a=e[26];let u;return e[27]!==a?(u=i.jsx("dl",{className:"grid grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-0.5",children:a}),e[27]=a,e[28]=u):u=e[28],u}}}function Kc(n){return i.jsxs("div",{className:"contents",children:[i.jsx("dt",{className:"text-muted-foreground",children:n.label}),i.jsx("dd",{className:"truncate",children:n.text})]},n.label)}function Fc(n,e){return i.jsx("span",{className:"truncate",children:`${e+1}. ${n||"…"}`},e)}function Oc(n,e){return n.kind==="protocol"&&n.source==="github"?e:null}function Lc(n,e){if(Object.hasOwn(n,e))return n[e]??null;const s=Yr(e),o=Object.keys(n).find(a=>Yr(a)===s);return o===void 0?null:n[o]??null}async function $c(n,e){try{const s=await fetch(`/api/${n.orgSlug}/decofile/${encodeURIComponent(n.virtualMcpId)}/${encodeURIComponent(n.branch)}`,{cache:"no-store",headers:Na("v8")});if(!s.ok)return null;const o=await s.json().catch(()=>({})),a=Lc(o.changedBy??{},e);return a&&typeof a.userId=="string"&&Number.isFinite(Date.parse(a.at))?a:null}catch{return null}}function zc(n,e,s){const o=e.find(h=>h.userId===n.userId),a=o?.user?.name?.trim(),u=o?.user?.image??void 0;return{...a?{name:a}:{},...u?{avatarUrl:u}:{},at:n.at,you:!!s&&n.userId===s}}function Hc(n){let e=2166136261,s=0;for(let o=0;o<n.length;o++){const a=n.charCodeAt(o);e=Math.imul(e^a,16777619),s=Math.imul(s,31)+a|0}return`${(e>>>0).toString(36)}${(s>>>0).toString(36)}:${n.length}`}function Wc(n,e,s){const o=it.c(19),a=!!n&&!!e&&s!==null;let u;o[0]!==e||o[1]!==n||o[2]!==s?(u=yo.conflictAuthor(n?`${n.orgSlug}/${n.virtualMcpId}/${n.branch}`:"",e??"",s??""),o[0]=e,o[1]=n,o[2]=s,o[3]=u):u=o[3];let h;o[4]!==e||o[5]!==n?(h=()=>$c(n,e),o[4]=e,o[5]=n,o[6]=h):h=o[6];let d;o[7]!==a||o[8]!==u||o[9]!==h?(d={queryKey:u,queryFn:h,enabled:a,staleTime:Number.POSITIVE_INFINITY,gcTime:6e5,retry:!1,refetchOnWindowFocus:!1},o[7]=a,o[8]=u,o[9]=h,o[10]=d):d=o[10];const{data:v}=qi(d),m=a?v??null:null,j=!!m;let A;o[11]!==j?(A={enabled:j},o[11]=j,o[12]=A):A=o[12];const{data:$}=Il(A);let z;o[13]!==$?(z=$?.data?.members??[],o[13]=$,o[14]=z):z=o[14];const H=z,{data:F}=xo.useSession();if(!m)return null;const f=F?.user?.id??null;let k;return o[15]!==m||o[16]!==H||o[17]!==f?(k=zc(m,H,f),o[15]=m,o[16]=H,o[17]=f,o[18]=k):k=o[18],k}function qc(n,e,s,o){if(!n||typeof n!="object")return{kind:"error",reason:"no-matcher-rule"};const a=e.trim();if(!a)return Gt(n,s,o)?{kind:"inline",blockKey:n.__resolveType??"",inlinedRule:xs(n,s,o)}:{kind:"noop"};const u=ys(n,s,o);if(!u)return{kind:"error",reason:"unreadable-rule"};if(u.blockKey)return{kind:"updateBlock",blockKey:u.blockKey,blockData:Kt(u.resolveType,u.data,a)};const h=Fn(a),d=On(h,s);return d?{kind:"error",reason:"invalid-block-id",message:d}:{kind:"createBlock",blockId:h,blockData:Kt(u.resolveType,u.data,a),reference:on(h)}}const ho="section-form-stale-save",Gc=3,Uc=1e3;function go(n,e){const s=e.global&&e.pageKey?[{label:"Default",sections:[{__resolveType:e.pageKey}]}]:So(e.pageKey?n[e.pageKey]?.sections:void 0,n),o=Math.max(0,Math.min(e.pageVariantIndex,s.length-1)),a=s[o]?.sections??[];return{pageVariants:s,variantIndex:o,rawSections:a,parsedSections:_n(a,n)}}const vo=new WeakMap;let Yc=0;function Jc(n){let e=vo.get(n);return e===void 0&&(e=++Yc,vo.set(n,e)),e}function tm({orgSlug:n,virtualMcpId:e,branch:s,previewReady:o=!0,previewUrl:a,currentPath:u,activePageBlockKey:h=null,activeGlobalBlockKey:d=null,externalSelection:v,onSaved:m,initialEditSeo:j=!1,onExitSeo:A,onSelectRoot:$,onViewJsonFile:z,onFocusedBlockChange:H,onVariantPreviewOverride:F}){const f=Ft(),k=Yi(),Z=k?.taskId??null,w=o?{orgSlug:n,virtualMcpId:e,branch:s,threadId:Z,previewUrl:a}:null,[I,V]=R.useState([]),{data:y,isLoading:C}=Ta(w,{pollWhile:I.length>0}),{data:x,isLoading:Y}=ia(w),M=Wn(),ge=k?.virtualMcpId,le=ka(ge===e?e:null)?.metadata?.siteSlug??null,ee=Rl({virtualMcpId:e,branch:s,sandboxUrl:a}),pe=Va(e,s),ce=Da(pe),he=!ce,ve=!!ee||ce,[b,B]=R.useState(null),[xe,T]=R.useState(null),[ye,K]=R.useState(null),[Se,ue]=R.useState(0),[te,se]=R.useState(void 0),[Te,X]=R.useState(null),[_e,be]=R.useState(null),[q,O]=R.useState([]),Ke=R.useRef(null),[Qe,Ze]=R.useState(q.length);Qe!==q.length&&(Ze(q.length),requestAnimationFrame(()=>{Ke.current&&(Ke.current.scrollTop=0)}));const[Ye,Q]=R.useState(0),[ke,He]=R.useState(null),[We,Ee]=R.useState(null),[Ie,Ve]=R.useState(null),[Xe,Fe]=R.useState(!1),[re,dt]=R.useState(!1),ne=R.useRef(null),[De,yt]=R.useState(!0),[et,ft]=R.useState(!1),[Ot,kn]=R.useState(!1),[qe,an]=R.useState(j),[Cs,Ns]=R.useState(j);j&&!Cs&&(Ns(!0),an(!0),B(null),T(null),K(null),O([])),!j&&Cs&&Ns(!1);const[Do,ln]=R.useState(null),[Ts,En]=R.useState(void 0),[Vs,Lt]=R.useState([]),[Ds,Yt]=R.useState(0),[Je,at]=R.useState(0),[Mo,tt]=R.useState(null),[Jt,st]=R.useState(null),[Ms,Ps]=R.useState(null),Is=Gi(),Bs=Ma({orgSlug:n,virtualMcpId:e,branch:s},{tunnel:!1}),cn=aa({orgSlug:n,virtualMcpId:e,branch:s}),[Po,Io]=R.useState(u),[Bo,Ko]=R.useState(h),[Fo,Oo]=R.useState(d);(Po!==u||Bo!==h||Fo!==d)&&(queueMicrotask(()=>cn.flush()),Io(u),Ko(h),Oo(d),B(null),T(null),K(null),ue(0),X(null),be(null),at(0),tt(null),st(null),O([]),Q(t=>t+1),an(!1),ln(null),En(void 0),Lt([]),Yt(t=>t+1));const G=la({orgSlug:n,virtualMcpId:e,branch:s}),un=ja((t,r)=>{G.mutate({blockKey:t,data:r},{onSuccess:()=>m?.(),onError:G.reportError})}),Rn=Oa({orgSlug:n,virtualMcpId:e,branch:s}),[Qt,Zt]=R.useState(!1),W=R.useRef(null),At=R.useRef(null),mt=R.useRef(null),pt=R.useRef(null),An=R.useRef({}),$t=R.useRef(null),dn=R.useRef(!1),fn=R.useRef(!1),Oe=R.useRef(new Map),Xt=R.useRef(!1),St=R.useRef([]),qn=R.useRef(new WeakSet);Pa(n,e,t=>{const{activePageKey:r,rawSections:l,parsedSections:c,selectedSectionIndex:p}=Le.current,S=new Set;r&&S.add(r);for(const g of[At.current?.sectionIndex,p]){const _=g==null?void 0:l[g],L=g==null?void 0:c[g],N=_&&L?.isSavedBlock?ds(_,L):null;N&&S.add(N)}if([...S].some(g=>t.has(g))){for(const g of[W,mt,pt])g.current&&clearTimeout(g.current),g.current=null;At.current=null,Oe.current.clear(),r&&t.has(r)&&(An.current={})}});const Le=R.useRef({rawSections:[],parsedSections:[],decofile:{},activePageKey:null,pageVariants:[],variantIndex:0,sectionVariantIndex:0,selectedSectionIndex:null}),[Ks,Fs]=R.useState(0),[Lo,$o]=R.useState(0),zo=Wc(Oc(pe,{orgSlug:n,virtualMcpId:e,branch:s}),I[0]?.blockKey??null,I[0]?Hc(ze(I[0].plan.theirs)):null),[Ho,Wo]=R.useState(null),Gn=Ia(n,e).epoch,[qo,Go]=R.useState(Gn);if(!o||C||Y)return i.jsx("div",{className:"h-full w-full flex items-center justify-center",children:i.jsx(Ui,{className:"size-5 text-muted-foreground"})});if(!y||!x)return i.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:f("sectionsEditor.sectionsEditor.couldNotLoadSiteData")});const Uo=Ha(y,x),ie=!!d,je=ie?null:Wa(Uo,u,h),E=ie?d:je?.key??null,Un=ie&&d?y[d]:void 0,Os=ie&&d&&Un?qa(d,Un):ie&&d?d:"",mn=!ie&&E&&y[E]?y[E]:null,Yn=qe&&y&&x&&E&&je?Kr(y,{kind:"page",pageKey:E,pageName:String(je.name??""),path:String(je.path??"")},x):null,Yo=qe?mn?.seo:void 0,Cn=Ts!==void 0?Ts:Yo,Jo=qe?ca(Cn):void 0,Ls=Yn?.seoTypeOptions??[],$s=qe&&x?ua(x):"",Jn=Do??Jo??{},Nn=qe&&Yn?Bl(Jn,Yn):null,zs=qe&&Nn&&da(Cn)?Kn(Nn,x):null,Hs=qe?fa(y,x)?.seoData:void 0,Me=ie?[{label:"Default",sections:[{__resolveType:d}]}]:So(mn?.sections,y??{}),ht=Me.length>1,we=Math.min(Se,Me.length-1),rt=Me[we],U=rt?.sections??[],Pe=_n(U,y),Qn=!ie&&Ga(mn?.sections);if(ie&&d&&Ms!==d){Ps(d);const t=U[0],r=Pe[0];if(t&&r){B(0),at(0),O([]);const l=jt(t,r,y);l&&(T(l.data),K(l.resolveType),st(null),tt(null))}}!ie&&Ms!==null&&Ps(null),Le.current={rawSections:U,parsedSections:Pe,decofile:y??{},activePageKey:E,pageVariants:Me,variantIndex:we,sectionVariantIndex:Je,selectedSectionIndex:b};const Qo=()=>({multivariate:Qn,index:we,variants:Me.map(t=>({rule:t.rule}))}),Zn=(t,r)=>{if(!F)return;if(!E||!Qn||t.length<=1){F(null);return}const l={multivariate:!0,index:r,variants:t},c=ce?ro(E,l):oo(E,l,y,x);F(c.length>0?c:null)},Xn=F&&E&&Qn&&ht&&!C&&!Y?E:null;if(Xn!==Ho&&(Wo(Xn),Xn)){const t=Me.map(l=>({rule:l.rule})),r=we;queueMicrotask(()=>Zn(t,r))}const en=(t,r,l)=>{if(!F)return;if(!E){F(null);return}const c=Qo(),p=ce?ro(E,c):oo(E,c,y,x);if(!t||r<0){F(p.length>0?p:null);return}const S={pageKey:E,page:c,sectionIndex:r,sectionLazy:Pe[r]?.isLazy??!1,mvObj:t,selectedVariantIndex:l},g=ce?Fl(S):Ol({...S,decofile:y,meta:x}),_=[...p,...g];F(_.length>0?_:null)},bt=(t,r,l,c=b??-1,p=!1)=>{const S=xt(t,r);if(!S){T(null),K(null),st(null),tt(null),p&&en(null,c,l);return}const _=vs(S,wt)[l];if(!_){T(null),K(null),st(null),tt(null),p&&en(null,c,l);return}const L=wo(_.value,y);T(L?.data??null),K(L?.resolveType??null);const{resolveType:N,formValue:D}=jn(_.rule,y,x??void 0);st(N),tt(D),p&&en(S,c,l)},pn=v?.index;if(v!==void 0&&(v?.seq??null)!==te&&(se(v?.seq??null),typeof pn=="number")){const t=U[pn],r=Pe[pn];if(t&&r)if(B(pn),at(0),O([]),Q(l=>l+1),r.isMultivariate)bt(t,r,0,pn);else{const l=jt(t,r,y);l?(T(l.data),K(l.resolveType)):(T(null),K(null)),st(null),tt(null)}}if(Gn!==qo){Go(Gn);const t=W.current!==null||Oe.current.size>0||pt.current!==null||mt.current!==null||G.isPending||cn.isPending||I.length>0,r=b!==null&&co(Ke.current,document.activeElement);if(!t&&r&&(Xt.current=!0),!t&&!r&&b!==null){const l=U[b],c=Pe[b];if(O([]),Q(p=>p+1),!l||!c)B(null),T(null),K(null);else if(c.isMultivariate)bt(l,c,Je,b);else{const p=jt(l,c,y);T(p?.data??null),K(p?.resolveType??null)}}!t&&qe&&(ln(null),En(void 0),Yt(l=>l+1))}if(Ks!==Lo){$o(Ks);const t=b!==null?U[b]:null,r=b!==null?Pe[b]:null;if(t&&r&&b!==null)if(O([]),Q(l=>l+1),r.isMultivariate)bt(t,r,Je,b);else{const l=jt(t,r,y);T(l?.data??null),K(l?.resolveType??null)}}const lt=I[0];if(lt){const{formBase:t,target:r}=lt,l=go(y,r),c=t.sectionIndex,p=l.rawSections.length===t.sectionCount?hs(l.rawSections[c],l.parsedSections[c],r.sectionVariantIndex,y):null,S=lc(lt,p,g=>ao(t,g));if(S){const _=[{...lt,...S,changedAgain:!0},...I.slice(1)];St.current=_,V(_)}}const hn={orgSlug:n,virtualMcpId:e,branch:s,threadId:Z,previewUrl:ce?void 0:a??void 0,siteSlug:le},Tn=ye&&x?Kn(ye,x):null,ct=(t,r)=>{if(!E)return;W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear(),pt.current&&(clearTimeout(pt.current),pt.current=null),mt.current&&(clearTimeout(mt.current),mt.current=null);const l=Sn(y,E,t,we,Me);G.mutate({blockKey:E,data:l},{onSuccess:()=>r?.onSuccess?.()??m?.(),onError:c=>{r?.onError?.(),G.reportError(c)}})},zt=()=>{H?.(null),B(null),kn(!1),T(null),K(null),at(0),tt(null),st(null),O([]),Q(t=>t+1)},Ws=()=>co(Ke.current,document.activeElement),es=(t=f("sectionsEditor.sectionsEditor.blockChangedElsewhere"))=>{if(W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear(),At.current=null,oe.error(t,{id:ho}),Ws()){Xt.current=!0;return}Fs(r=>r+1)},qs=()=>{!Xt.current||Ws()||St.current.length>0||W.current!==null||dn.current||fn.current||Oe.current.size>0||(Xt.current=!1,Fs(t=>t+1))},Gs=()=>{Xt.current&&setTimeout(qs,0)},Us=t=>Ka(Is,Bs,t),Ys=t=>{Oe.current.size!==0&&setTimeout(()=>{if(dn.current||fn.current)return;const r=[...Oe.current.values()];Oe.current.clear();for(const l of r)l()},t)},Zo=t=>{const{activePageKey:r,variantIndex:l,sectionVariantIndex:c}=Le.current,p=$t.current;return{formBase:p?.sectionIndex===t&&p.variantIndex===c?p:null,pageKey:r,global:ie,pageVariantIndex:l,sectionVariantIndex:c,schema:Tn}},gn=t=>{St.current=t,V(t)},Xo=t=>{const r=St.current,l=r.findIndex(S=>S.formBase===t.formBase),c=l>=0?r[l]:void 0,p=c?r.with(l,{...t,choices:ks(c.plan,c.choices,t.plan),fresh:To(c.plan,t.plan,c.fresh),changedAgain:c.changedAgain||ze(c.plan.theirs)!==ze(t.plan.theirs)}):[...r,{...t,changedAgain:qn.current.has(t.formBase)}];gn(p)},Js=(t,r)=>{const l=St.current,c=l.findIndex(g=>g.formBase===t),p=l[c];if(!p)return!1;if(ze(p.plan.mine)===ze(r))return!0;const S=ws({...p.plan,mine:r});if(S.pointers.length===0){const g=l.filter(_=>_!==p);return gn(g),!1}return gn(l.with(c,{...p,plan:S,choices:ks(p.plan,p.choices,S)})),!0},ei=t=>{const r=Le.current;return r.selectedSectionIndex===t.formBase.sectionIndex&&r.activePageKey===t.target.pageKey&&r.variantIndex===t.target.pageVariantIndex&&r.sectionVariantIndex===t.target.sectionVariantIndex},ti=()=>{const t=St.current[0];if(!t)return null;const{formBase:r,target:l}=t;W.current&&At.current?.sectionIndex===r.sectionIndex&&At.current.sectionVariantIndex===l.sectionVariantIndex&&(clearTimeout(W.current),W.current=null,At.current=null),Oe.current.delete(`${l.pageKey}:${r.sectionIndex}:${l.sectionVariantIndex}`);const c=r.emitted;return c&&typeof c=="object"&&!Js(r,c)&&vn(c,r.sectionIndex,0,l),St.current[0]??null},ni=()=>{const t=St.current[0],r=ti();if(!r||!t||r.formBase!==t.formBase||r.plan.pointers.some(S=>!t.plan.pointers.includes(S)))return;const l=ic(r.plan,r.choices);gn(St.current.slice(1));const{formBase:c,target:p}=r;c.base=r.plan.theirs,c.version=void 0,c.emitted=l,qn.current.add(c),($t.current===c||ei(r))&&($t.current=c,T(l),Q(S=>S+1)),vn(l,c.sectionIndex,0,p)},si=t=>{const[r,...l]=St.current;r&&gn([{...r,choices:t},...l])},vn=(t,r,l=0,c)=>{const p=c??Zo(r),S=p.sectionVariantIndex,g=p.formBase,_=At.current;W.current&&(clearTimeout(W.current),W.current=null,_&&(_.sectionIndex!==r||_.sectionVariantIndex!==S)&&_.write());const L=`${p.pageKey}:${r}:${S}`,N=()=>{if(dn.current||fn.current){Oe.current.set(L,N);return}const D=typeof t=="function"?t():t;if(g&&Js(g,D))return;const P=Le.current.decofile,{rawSections:de,parsedSections:Re,pageVariants:nt,variantIndex:Be}=go(P,p),Ge=p.pageKey,J=de[r];if(!J)return;const fe=Re[r];if(!fe)return;const Ce=g?.base,Ue=hs(J,fe,S,P),gt=!!Ce&&!!Ue&&Ao(Ce,Ue)&&!(g&&ao(g,Ue));if(gt&&Ce&&Ue){if(Co(Ce,Ue)){es(f("sectionsEditor.sectionsEditor.sectionReplacedElsewhere"));return}const Ae=fe.isSavedBlock?"here":rc(Ce,de.map((Ne,Mt)=>hs(Ne,Re[Mt],S,P)),r,g?.sectionCount??de.length);if(Ae==="unknown"){es(f("sectionsEditor.sectionsEditor.sectionReplacedElsewhere"));return}if(typeof Ae=="number"&&g){g.sectionCount=de.length,g.sectionIndex=Ae,$t.current===g&&B(Ae),vn(D,Ae,l,p);return}}const ot=gt&&Ce&&Ue?ws({ancestor:Ce,mine:D,theirs:Ue}):null;if(ot&&ot.pointers.length>0&&g){g.sectionCount=de.length,Xo({plan:ot,formBase:g,target:p,sectionIndex:r,choices:No(ot),changedAgain:!1,blockKey:fe.isSavedBlock?ds(J,fe):Ge,fresh:{}});return}const vt=ot?ot.merged:null,Dt=vt??D,Mr=oc({merged:!!vt,tracked:g,current:$t.current,saved:D});vt&&oe.info(f("sectionsEditor.sectionsEditor.blockMergedWithOthers"),{id:ho}),Mr&&g&&(g.emitted=vt,T(vt));const cs=Mr||!vt?Dt:D;g&&(g.base=cs,g.sectionCount=de.length,nc(g,cs));const Pr={onSuccess:()=>{g&&qn.current.delete(g),m?.()},onError:Ae=>{if(g?.base===cs&&Ce&&(g.base=Ce),Ae instanceof Ba){g&&(g.version=void 0),l<Gc?(Oe.current.delete(L),fn.current=!0,setTimeout(()=>{fn.current=!1,vn(()=>{const Ne=g?.emitted;return Ne&&typeof Ne=="object"?Ne:D},r,l+1,p),Oe.current.delete(L),Ys(bn)},Uc*2**l)):es();return}G.reportError(Ae)}},Ir=Ae=>{dn.current=!0;let Ne=!1;G.mutateAsync(Ae).then(()=>Pr.onSuccess(),Mt=>{Ne=!0,Pr.onError(Mt)}).finally(()=>{dn.current=!1,Ys(Ne?bn:0),qs()})};if(fe.isSavedBlock){const Ae=ds(J,fe);if(!Ae)return;Ir({blockKey:Ae,data:Dt,...Ce?{base:{value:vt?Ue:Ce}}:{},rebaseOnConflict:!1,guard:lo({formBase:g,rebased:!!vt,versionOf:Us})});return}if(!Ge)return;const In={...P[Ge]},Wt=[...de];if(fe.isMultivariate){const Ae=xt(J,fe);if(!Ae||!Ge)return;const Ne=al(Ae,S,Dt);Wt[r]=qt(J,fe,Ne)}else if(fe.isHidden){const Ae=Rs(J.__resolveType),Ne=Ae?{...J.section}:{...J},Mt=Array.isArray(Ne.variants)?[...Ne.variants]:[];Mt[0]&&(Mt[0]={...Mt[0],value:Dt}),Ne.variants=Mt,Ae?Wt[r]={...J,section:Ne}:Wt[r]=Ne}else fe.isLazy?Wt[r]={...J,section:Dt}:Wt[r]=Dt;if(nt.length>1){const Ae=In.sections,Ne=[...Ae?.variants??[]];Ne[Be]&&(Ne[Be]={...Ne[Be],value:Wt}),In.sections={...Ae,variants:Ne}}else In.sections=Wt;Ir({blockKey:Ge,data:In,rebaseOnConflict:!1,guard:lo({formBase:null,rebased:!1,versionOf:Us})})};At.current={sectionIndex:r,sectionVariantIndex:S,write:N},W.current=setTimeout(()=>{W.current=null,N()},bn)},ri=t=>{Xt.current=!1,B(t),at(0),O([]),Q(p=>p+1);const r=U[t],l=Pe[t];if(H?.(l?.isSavedBlock?l.resolveType??null:null),!r||!l)return;if(l.isMultivariate){bt(r,l,0,t);return}const c=jt(r,l,y);if(!c){T(null),K(null),st(null),tt(null),en(null,t,0);return}T(c.data),K(c.resolveType),st(null),tt(null),en(null,t,0)},Qs=t=>{const r=t;b!==null&&($t.current=sc($t.current,{sectionIndex:b,variantIndex:Le.current.sectionVariantIndex,shown:xe,next:r,sectionCount:Le.current.rawSections.length})),T(r),b!==null&&vn(r,b)},ts=t=>{if(!E||!y||!x||!je)return;const r={kind:"page",pageKey:E,pageName:String(je.name??""),path:String(je.path??"")},l=Kr(y,r,x);l&&cn.save(E,()=>{const c=Is.getQueryData(yo.decofile(Bs))?.[E];if(!c||typeof c!="object"||c===null||Array.isArray(c))return null;const p={...c,...An.current};return An.current={},t?.raw!==void 0?{...p,seo:t.raw}:t?.inner!==void 0?Kl(r,l,p,t.inner):p})},Zs=(t,r)=>{E&&(An.current[t]=r,ts())},oi=(t,r)=>{if(!E)return;const l=Ln([...U],t,r);b!==null&&(b===t?B(r):t<b&&r>=b?B(b-1):t>b&&r<=b&&B(b+1)),ct(l)},ii=t=>{if(!E)return;const r=U.filter((l,c)=>c!==t);b===t?zt():b!==null&&b>t&&B(b-1),ct(r)},ai=t=>{if(!E)return;const r=U[t];if(!r)return;const l=[...U];l.splice(t+1,0,wa(r)),b!==null&&b>t&&B(b+1),ct(l)},li=t=>{if(!E)return;const r=U[t],l=Pe[t];if(!r||!l)return;const c=l.isHidden?nl(r):sl(r);if(!c)return;const p=[...U];p[t]=c,b===t&&zt(),ct(p)},ci=t=>{if(!E)return;const r=U[t],l=Pe[t];if(!r||!l||l.isMultivariate)return;const c=tl(r);if(!c)return;const p=[...U];p[t]=c,b===t&&zt(),ct(p)},ui=t=>{if(!E)return;const r=U[t],l=Pe[t];if(!r||!l?.isSavedBlock)return;const c=jt(r,l,y);if(!c?.data)return;const{name:p,...S}=c.data,g=[...U];l.isLazy?g[t]={...r,section:S}:g[t]=S,b===t&&zt(),ct(g)},di=t=>{if(!E)return;const r=[...U,{__resolveType:t.resolveType}],l=r.length-1;ct(r,{onError:()=>{Le.current.selectedSectionIndex===l&&zt()}}),Fe(!1),B(l),at(0),O([]),Q(g=>g+1);const c=r[l],p=_n(r,y)[l];if(!c||!p)return;if(p.isMultivariate){bt(c,p,0);return}const S=jt(c,p,y);if(!S){T(null),K(null),st(null),tt(null);return}T(S.data),K(S.resolveType),st(null),tt(null)},Xs=t=>{ne.current=t.append,Fe(!0)},fi=t=>{const r=ne.current;if(!r){di(t);return}r({__resolveType:t.resolveType}),Fe(!1),ne.current=null},er=t=>{if(b===null)return;const r=U[b],l=Pe[b];!r||!l?.isMultivariate||(at(t),O([]),Q(c=>c+1),bt(r,l,t,b,!0))},mi=t=>{if(b===null||!E)return;const r=U[b],l=Pe[b];if(!r||!l?.isMultivariate)return;const c=xt(r,l);if(!c)return;const p=Xa(c,t);if(!p){oe.error(f("sectionsEditor.sectionsEditor.cannotDeleteOnlyVariant"));return}const S=[...U];S[b]=qt(r,l,p);const g=p.variants;let _=Je;t===Je?_=Math.min(t,g.length-1):t<Je&&(_=Je-1),at(_),O([]),Q(L=>L+1),bt(S[b],l,_),ct(S)},pi=t=>{if(b===null||!E)return;const r=U[b],l=Pe[b];if(!r||!l?.isMultivariate)return;const c=xt(r,l);if(!c)return;const p=el(c,t),S=[...U];S[b]=qt(r,l,p);const g=t+1;at(g),O([]),Q(_=>_+1),bt(S[b],l,g),ct(S)},hi=(t,r)=>{if(b===null||!E||t===r)return;const l=U[b],c=Pe[b];if(!l||!c?.isMultivariate)return;const p=xt(l,c);if(!p)return;const S=Qa(p,t,r),g=[...U];g[b]=qt(l,c,S);let _=Je;Je===t?_=r:t<Je&&r>=Je?_=Je-1:t>Je&&r<=Je&&(_=Je+1),at(_),bt(g[b],c,_),ct(g)},xn=t=>{const r=t??b;if(r===null||!E)return;const l=U[r],c=Pe[r];if(!l||!c)return;const p=Ua(l,c);if(!p){oe.error(f("sectionsEditor.sectionsEditor.sectionCannotHaveVariants"));return}const S=[...U];S[r]=p.section;const g=_n(S,y)[r];if(!g?.isMultivariate){oe.error(f("sectionsEditor.sectionsEditor.couldNotAddVariant"));return}B(r),at(p.newVariantIndex),O([]),Q(_=>_+1),bt(p.section,g,p.newVariantIndex,r),ct(S)},tr=()=>{if(b===null||!E)return;const t=U[b],r=Pe[b];if(!t||!r?.isMultivariate)return;const l=xt(t,r);if(!l)return;const c=Za(t,r,l);if(!c){oe.error(f("sectionsEditor.sectionsEditor.couldNotRemoveVariants"));return}const p=[...U];p[b]=c;const S=_n(p,y)[b];if(!S)return;at(0),st(null),tt(null),O([]),Q(_=>_+1);const g=jt(c,S,y);g?(T(g.data),K(g.resolveType)):(T(null),K(null)),en(null,b,0),ct(p)},gi=async t=>{if(ke===null||!E)return;const r=On(t,y,x);if(r){oe.error(r);return}const l=U[ke],c=Pe[ke];if(!l||!c)return;const p=jt(l,c,y);if(!p){oe.error(f("sectionsEditor.sectionsEditor.sectionCannotBeSavedAsGlobal"));return}const S={...p.data,name:t};try{await G.mutateAsync({blockKey:t,data:S});const g=[...U];g[ke]={__resolveType:t},await G.mutateAsync({blockKey:E,data:Sn(y,E,g,we,Me)}),b===ke&&zt(),He(null),oe.success(f("sectionsEditor.sectionsEditor.savedGlobalBlock",{blockId:t})),m?.()}catch(g){oe.error(f("sectionsEditor.sectionsEditor.failedToSaveGlobalBlock"),{description:Pt(f,It(g))})}},nr=rt?.rule;if(ht&&b===null&&_e===null&&nr){const{resolveType:t,formValue:r}=jn(nr,y??{},x??void 0);be(t),X(r)}const tn=x?ma(x):[],ns=x&&y?pa(x,y):[],sr=!ie&&!!(ve&&x&&y),rr=_e&&x?Kn(_e,x):null,Ct=()=>{mt.current&&(clearTimeout(mt.current),mt.current=null),pt.current&&(clearTimeout(pt.current),pt.current=null)},Ht=async(t,r)=>{if(!(il(r,t,x)>0))try{await Rn.mutateAsync({blockKey:t})}catch(l){oe.error(f("sectionsEditor.sectionsEditor.couldNotDeleteMatcherBlock"),{description:Pt(f,It(l))})}},or=t=>{mt.current&&clearTimeout(mt.current),mt.current=setTimeout(()=>{const{activePageKey:r,decofile:l,variantIndex:c}=Le.current;if(!r)return;const p={...l[r]},S={...p.sections},g=[...S.variants??[]],_=g[c],L=_?.rule;if(Gt(L,l,x)){const N=L?.__resolveType??"",D=l[N],P=typeof D?.name=="string"?D.name:N,{__resolveType:de,...Re}=t;G.mutate({blockKey:N,data:Kt(de??"",Re,P)},{onSuccess:()=>m?.(),onError:G.reportError});return}_&&(g[c]={..._,rule:t}),p.sections={...S,variants:g},G.mutate({blockKey:r,data:p},{onSuccess:()=>m?.(),onError:G.reportError})},bn)},ir=t=>{be(t);const r=t?Jr(t,x):{__resolveType:Qr};X(t?r:{}),or(r)},ar=t=>{const r=t;X(r);const l=_e?{__resolveType:_e,...r}:{...r};or(l)},lr=async t=>{Ct();const{activePageKey:r,decofile:l,variantIndex:c}=Le.current;if(!r)return;const p=l[r],S=p?.sections;if(!S||typeof S!="object"||Array.isArray(S))return;const g=S;if(!Array.isArray(g.variants))return;const _=[...g.variants],L=_[c];if(!L)return;const N=Bt(L.rule,l,x),D=on(t);_[c]={...L,rule:D};const P={...l,[r]:{...p,sections:{...g,variants:_}}},{resolveType:de,formValue:Re}=jn(D,P,x??void 0);be(de),X(Re);try{await G.mutateAsync({blockKey:r,data:P[r]}),N&&N!==t&&await Ht(N,P),m?.()}catch(nt){oe.error(f("sectionsEditor.sectionsEditor.couldNotApplySavedRule"),{description:Pt(f,It(nt))})}},cr=t=>{pt.current&&clearTimeout(pt.current);const{selectedSectionIndex:r,sectionVariantIndex:l}=Le.current;r!==null&&(pt.current=setTimeout(()=>{const{rawSections:c,parsedSections:p,decofile:S,activePageKey:g,pageVariants:_,variantIndex:L}=Le.current;if(!g)return;const N=c[r],D=p[r];if(!N||!D?.isMultivariate)return;const P=xt(N,D);if(!P)return;const Re=(P.variants??[])[l]?.rule;if(Gt(Re,S,x)){const J=Re?.__resolveType??"",fe=S[J],Ce=typeof fe?.name=="string"?fe.name:J,{__resolveType:Ue,...gt}=t;G.mutate({blockKey:J,data:Kt(Ue??"",gt,Ce)},{onSuccess:()=>m?.(),onError:G.reportError});return}const nt=Zr(P,l,t),Be=[...c];Be[r]=qt(N,D,nt);const Ge=Sn(S,g,Be,L,_);G.mutate({blockKey:g,data:Ge},{onSuccess:()=>m?.(),onError:G.reportError})},bn))},vi=t=>{st(t);const r=t?Jr(t,x):{__resolveType:Qr};tt(t?r:{}),cr(r)},xi=t=>{const r=t;tt(r);const l=Jt?{__resolveType:Jt,...r}:{...r};cr(l)},yi=async t=>{Ct();const{selectedSectionIndex:r,sectionVariantIndex:l,rawSections:c,parsedSections:p,decofile:S,activePageKey:g,pageVariants:_,variantIndex:L}=Le.current;if(r===null||!g)return;const N=c[r],D=p[r];if(!N||!D?.isMultivariate)return;const P=xt(N,D);if(!P)return;const de=P.variants??[],Re=Bt(de[l]?.rule,S,x),nt=on(t),Be=Zr(P,l,nt),Ge=[...c];Ge[r]=qt(N,D,Be);const J=Sn(S,g,Ge,L,_),fe={...S,[g]:J},{resolveType:Ce,formValue:Ue}=jn(nt,fe,x??void 0);st(Ce),tt(Ue);try{await G.mutateAsync({blockKey:g,data:J}),Re&&Re!==t&&await Ht(Re,fe),m?.()}catch(gt){oe.error(f("sectionsEditor.sectionsEditor.couldNotApplySavedRule"),{description:Pt(f,It(gt))})}};if(!ie&&!je)return i.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:f("sectionsEditor.sectionsEditor.noPageFound",{currentPath:u})});if(ie&&!Un)return i.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:f("sectionsEditor.sectionsEditor.globalBlockNotFound")});const $e=b!==null?Pe[b]??null:null,ur=b!==null?U[b]:null,dr=ur&&$e?.isMultivariate?xt(ur,$e):null,Nt=dr?vs(dr,wt):[],Vn=Math.min(Je,Math.max(Nt.length-1,0)),nn=Nt[Vn]??null,Tt=$e?.isMultivariate===!0,ss=b!==null&&$e!==null,Vt=ss&&(Tt||!!(Tn&&xe)),Si=Vt&&!ie&&$e?.isSavedBlock===!0,ut=ie||Si,fr=ie?Os:$e?.label??"",bi=Jt&&x?Kn(Jt,x):null,mr=(t,r)=>r&&M?`${t} · ${r}`:t,pr=$e?$e.variantOf??$e.label:"",ji=(()=>{const t=Tt&&nn?nn.label:null;return t?M?[mr(pr,t)]:[$e.label,t]:[$e?.label??""]})(),rs=mr(je?.name??"",ht?rt?.label:null),Dn=Vt&&(!ie||q.length>0)?ie?[Os,...q]:[rs,...ji,...q]:[],hr=qe&&je?[je.name,"SEO",...Vs]:[],gr=f("sectionsEditor.pageVariantTabs.variantsLabel"),vr=et&&je?[je.name,gr]:Ot&&je&&$e?[rs,pr,gr]:[],Mn=vr.length>0?vr:hr.length>0?hr:ut?Dn.length>0?Dn:[fr]:Dn.length>0?Dn:[rs],xr=ss&&!Tt&&!$e?.isHidden&&!!E,wi=ut||!ie&&ht&&!!rt||xr,_i=ss&&!Tt&&!ie&&q.length===0&&!!$e&&jo($e)&&!!E,ki=M&&Vt&&!Ot&&Tt&&q.length===0&&!!nn,yr=M&&q.length>0?Fr(q[q.length-1]):null,Ei=q.length>1?Fr(q[q.length-2]):null,Sr=ut?fr:Vt?$e?.label??"":je?.name??"",Ri=et||Ot?f("sectionsEditor.pageVariantTabs.variantsLabel"):qe?f("sectionsEditor.panelSections.seo"):yr??Sr,br=Ot?$e?.variantOf??$e?.label??"":et||qe?je?.name??"":yr?Ei??Sr:ut?f("sectionsEditor.sectionsEditor.globalSectionSubtitle"):Vt?je?.name??"":je?.path??"",os=!et&&!Ot&&!qe&&!Vt&&!ut,Ai=!M&&!qe&&!ie&&Tt&&q.length===0,yn=()=>{if(!E)return;Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const t=y[E],r=Ya(t.sections,U);if(!r)return;const l=Ja(r);G.mutate({blockKey:E,data:{...t,sections:r}},{onSuccess:()=>{ue(l),B(null),T(null),K(null),O([]),X(null),be(null)},onError:G.reportError})},Pn=(t,r,l)=>{if(!E)return;Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const c=y[E],p=c.sections;if(!p||typeof p!="object"||Array.isArray(p))return;const S=p;if(!Array.isArray(S.variants))return;const g=t([...S.variants]);if(!g)return;const _=ol(S,g),L={...y,[E]:{...c,sections:_}};G.mutate({blockKey:E,data:L[E]},{onSuccess:()=>{r?.();const N=typeof l=="string"?[l]:l??[];(async()=>{for(const D of N)await Ht(D,L)})()},onError:G.reportError})},is=t=>{Ee(null),ue(t),B(null),T(null),K(null),O([]);const r=Me[t]?.rule,{resolveType:l,formValue:c}=jn(r,y??{},x??void 0);be(l),X(c),Zn(Me.map(p=>({rule:p.rule})),t)},jr=(t,r)=>{if(t===r)return;let l=we;we===t?l=r:t<we&&r>=we?l=we-1:t>we&&r<=we&&(l=we+1),ue(l);const c=Ln(Me.map(p=>({rule:p.rule})),t,r);Zn(c,l),Pn(p=>Ln(p,t,r))},wr=t=>{const r=Me[t]?.rule,l=Bt(r,y??{},x??void 0);Pn(c=>c.length<=1?null:(c.splice(t,1),c),()=>{Me.length-1===1?ue(0):t<we?ue(we-1):t===we&&ue(Math.max(0,t-1)),B(null),T(null),K(null),O([]),X(null),be(null)},l)},Ci=()=>{const t=Me.map((r,l)=>({variant:r,index:l})).filter(({variant:r})=>!rl(r.rule)).map(({variant:r})=>Bt(r.rule,y??{},x??void 0)).filter(r=>!!r);Pn(r=>{const l=ll({variants:r}),c=r[l];return c?[{...c,rule:cl()}]:null},()=>{ue(0),B(null),T(null),K(null),O([]),X(null),be(null),ft(!1)},t)},_r=t=>{Pn(r=>ul(r,t),()=>{ue(t+1),B(null),T(null),K(null),O([]),X(null),be(null)})},Ni=async(t,r)=>{Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const l=Le.current.activePageKey,c=Le.current.decofile;if(!l)return;const p=c[l],S=p.sections;if(!S||typeof S!="object"||Array.isArray(S))return;const g=S;if(!Array.isArray(g.variants))return;const _=[...g.variants],L=_[t];if(!L?.rule||typeof L.rule!="object"){oe.error(f("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const N=L.rule,D=r.trim();Zt(!0);try{if(!D){if(!Gt(N,c,x)){Ee(null);return}const Ge=N.__resolveType??"";_[t]={...L,rule:xs(N,c,x)};const J={...c,[l]:{...p,sections:{...g,variants:_}}};await G.mutateAsync({blockKey:l,data:J[l]}),await Ht(Ge,J),Ee(null),m?.();return}const P=ys(N,c,x);if(!P){oe.error(f("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(P.blockKey){await G.mutateAsync({blockKey:P.blockKey,data:Kt(P.resolveType,P.data,D)}),Ee(null),m?.();return}const de=Fn(D),Re=On(de,c,x);if(Re){oe.error(Re);return}const nt=Kt(P.resolveType,P.data,D);let Be=null;try{await G.mutateAsync({blockKey:de,data:nt}),Be=de,_[t]={...L,rule:on(de)},await G.mutateAsync({blockKey:l,data:{...p,sections:{...g,variants:_}}}),Be=null}catch(Ge){throw Be&&await Rn.mutateAsync({blockKey:Be}).catch(()=>{}),Ge}Ee(null),oe.success(f("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:D})),m?.()}catch(P){oe.error(f("sectionsEditor.sectionsEditor.failedToRenameVariant"),{description:Pt(f,It(P))})}finally{Zt(!1)}},Ti=async(t,r)=>{Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const{selectedSectionIndex:l,rawSections:c,parsedSections:p,decofile:S,activePageKey:g,pageVariants:_,variantIndex:L}=Le.current;if(l===null||!g)return;const N=c[l],D=p[l];if(!N||!D?.isMultivariate)return;const P=xt(N,D);if(!P)return;const de=P.variants??[],Re=de[t];if(!Re?.rule||typeof Re.rule!="object"){oe.error(f("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const nt=Re.rule,Be=r.trim();Zt(!0);const Ge=async J=>{const fe={...P,variants:J},Ce=[...c];Ce[l]=qt(N,D,fe);const Ue=Sn(S,g,Ce,L,_);return await G.mutateAsync({blockKey:g,data:Ue}),{...S,[g]:Ue}};try{if(!Be){if(!Gt(nt,S,x)){Ve(null);return}const ot=nt.__resolveType??"",vt=[...de];vt[t]={...Re,rule:xs(nt,S,x)};const Dt=await Ge(vt);await Ht(ot,Dt),Ve(null),m?.();return}const J=ys(nt,S,x);if(!J){oe.error(f("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(J.blockKey){await G.mutateAsync({blockKey:J.blockKey,data:Kt(J.resolveType,J.data,Be)}),Ve(null),m?.();return}const fe=Fn(Be),Ce=On(fe,S,x);if(Ce){oe.error(Ce);return}const Ue=Kt(J.resolveType,J.data,Be);let gt=null;try{await G.mutateAsync({blockKey:fe,data:Ue}),gt=fe;const ot=[...de];ot[t]={...Re,rule:on(fe)},await Ge(ot),gt=null}catch(ot){throw gt&&await Rn.mutateAsync({blockKey:gt}).catch(()=>{}),ot}Ve(null),oe.success(f("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:Be})),m?.()}catch(J){oe.error(f("sectionsEditor.sectionsEditor.failedToRenameVariant"),{description:Pt(f,It(J))})}finally{Zt(!1)}},kr=async(t,r,l)=>{T(l);try{await G.mutateAsync({blockKey:t,data:l})}catch(c){throw T(p=>p===l?r:p),c}},Vi={rename:async(t,r,l)=>{Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const{activePageKey:c,decofile:p}=Le.current;if(!c)return;const S=Array.isArray(t.variants)?[...t.variants]:[],g=S[r],_=g?.rule&&typeof g.rule=="object"?g.rule:void 0,L=async D=>{const P={...t,variants:D};return await kr(c,t,P),{...p,[c]:P}},N=qc(_,l,p,x);if(N.kind!=="noop"){if(N.kind==="error"){oe.error(N.reason==="no-matcher-rule"?f("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"):N.reason==="unreadable-rule"?f("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"):N.message??f("sectionsEditor.sectionsEditor.failedToRenameVariant"));return}Zt(!0);try{if(N.kind==="inline"){const P=[...S];P[r]={...g,rule:N.inlinedRule};const de=await L(P);await Ht(N.blockKey,de),m?.();return}if(N.kind==="updateBlock"){await G.mutateAsync({blockKey:N.blockKey,data:N.blockData}),m?.();return}let D=null;try{await G.mutateAsync({blockKey:N.blockId,data:N.blockData}),D=N.blockId;const P=[...S];P[r]={...g,rule:N.reference},await L(P),D=null}catch(P){throw D&&await Rn.mutateAsync({blockKey:D}).catch(()=>{}),P}oe.success(f("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:l.trim()})),m?.()}catch(D){oe.error(f("sectionsEditor.sectionsEditor.failedToRenameVariant"),{description:Pt(f,It(D))})}finally{Zt(!1)}}},selectGlobal:async(t,r,l)=>{Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const{activePageKey:c,decofile:p}=Le.current;if(!c)return;const S=Array.isArray(t.variants)?[...t.variants]:[],g=S[r];if(!g)return;const _=Bt(g.rule,p,x);S[r]={...g,rule:on(l)};const L={...t,variants:S},N={...p,[c]:L};try{await kr(c,t,L),_&&_!==l&&await Ht(_,N),m?.()}catch(D){oe.error(f("sectionsEditor.sectionsEditor.couldNotApplySavedRule"),{description:Pt(f,It(D))})}}},Er=()=>{zt()},Rr=t=>{ln(t),ts({inner:t})},Ar=t=>{En(t),ts({raw:t})},Cr=()=>{ln(null),Lt([])},Nr=()=>Yt(t=>t+1),Tr=()=>{cn.flush(),an(!1),ln(null),En(void 0),Lt([]),Yt(t=>t+1),A?.()},Di=()=>{ft(!1),kn(!1),B(null),an(!0)},Mi=()=>{qe&&Tr(),B(null),ft(!0)},Pi=()=>kn(!0),as=t=>{if(et&&t===0){ft(!1);return}if(Ot&&t<2){kn(!1),t===0&&B(null);return}if(qe){if(t===0){Tr();return}if(t===1){Lt([]),Yt(l=>l+1);return}Lt(Vs.slice(0,t-1)),Yt(l=>l+1);return}if(ie){O(q.slice(0,t)),Q(l=>l+1);return}if(t===0){Er();return}if(t===1){O([]),Q(l=>l+1);return}const r=!M&&Tt&&nn?1:0;if(r===1&&t===2){O([]),Q(l=>l+1);return}O(q.slice(0,t-1-r))},ls=Mn.length>1?i.jsx("button",{type:"button",onClick:()=>as(_a(Mn.length,{isMultivariateSectionTop:Ai})),title:f("sectionsEditor.sectionsEditor.back"),"aria-label":f("sectionsEditor.sectionsEditor.back"),className:ae("shrink-0 inline-flex size-6 items-center justify-center rounded-[var(--studio-control-radius,var(--radius-md))] transition-colors",ut?"text-foreground/80 hover:bg-global-section/15":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:i.jsx(Ca,{className:"size-4"})}):null,Ii=ut||Vt||qe?wi&&i.jsxs("div",{className:ae("border-b px-3 py-2.5",ut&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[!ie&&ht&&rt&&i.jsxs("button",{type:"button",onClick:Er,title:f("sectionsEditor.sectionsEditor.editingInVariant",{variant:rt.label}),className:ae("shrink-0 inline-flex items-center gap-1 rounded-lg h-6 px-1.5 text-xs font-medium cursor-pointer transition-opacity hover:opacity-80",ga),children:[i.jsx(ha,{rule:fs(rt.rule,y??{},x??void 0),matchers:tn}),i.jsx("span",{className:"max-w-[160px] truncate",children:rt.label})]}),i.jsx("div",{className:"flex-1"}),ut&&i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx("span",{className:"shrink-0 cursor-help",children:i.jsx(zn,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),i.jsx(Rt,{side:"bottom",className:"max-w-[260px]",children:f("sectionsEditor.sectionsEditor.globalSectionTooltip")})]}),xr&&i.jsx(Bn,{onClick:()=>xn()})]}),ut&&i.jsx("p",{className:"mt-1.5 py-1.5 pl-1 text-sm leading-snug text-foreground",children:f("sectionsEditor.sectionsEditor.globalSectionBanner")})]}):i.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2.5",children:[i.jsx("div",{className:"flex-1 min-w-0",children:i.jsx(Or,{pageKey:E,initialName:je.name,initialPath:je.path,onFieldChange:Zs,variant:"header"})}),i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"ghost",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.editSeo"),className:"size-7 shrink-0",onClick:()=>an(!0),children:i.jsx(Gr,{size:14})})}),i.jsx(Rt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.editSeo")})]}),i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"ghost",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.viewJson"),className:"size-7 shrink-0",onClick:()=>z&&E?z():dt(!0),children:i.jsx(Ur,{size:14})})}),i.jsx(Rt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.viewJson")})]}),i.jsx(Bn,{onClick:yn})]}),Bi=i.jsxs(i.Fragment,{children:[ht&&E&&i.jsx(Lr,{listKey:E,variants:Me,activeIndex:we,decofile:y??{},meta:x,matchers:tn,onSelect:is,onReorder:jr,onRename:Ee,onDuplicate:_r,onDelete:wr,onAdd:yn}),ht&&_e!==null&&i.jsx($r,{className:"mt-3",children:i.jsx("div",{className:ae("space-y-3",Qt&&"pointer-events-none opacity-50"),children:i.jsx(us,{currentRt:_e,currentLabel:wn(rt?.rule,y??{},wt,x??void 0),currentGlobalKey:Bt(rt?.rule,y??{},x??void 0)??void 0,matchers:tn,globals:ns,onSelect:ir,onSelectGlobal:lr,schema:rr,formValue:Te,onChange:ar,formKey:`${we}:${_e??""}`,formWrapperClassName:"space-y-3",meta:x??void 0,decofile:y,onSaveReferencedBlock:un,sandbox:hn})})})]}),Vr=i.jsxs(i.Fragment,{children:[i.jsx(va,{listKey:`${E??""}:${b??""}`,variants:Nt.map((t,r)=>({index:r,label:t.label})),selectedIndex:Vn,onSelect:er,onRename:Ve,onDuplicate:pi,onDelete:mi,onRemoveAll:tr,onReorder:hi,onAdd:()=>xn()}),i.jsx($r,{children:i.jsx(us,{currentRt:Jt??"",currentLabel:wn(nn?.rule,y??{},wt,x??void 0),currentGlobalKey:Bt(nn?.rule,y??{},x??void 0)??void 0,matchers:tn,globals:ns,onSelect:vi,onSelectGlobal:yi,schema:bi,formValue:Mo,onChange:xi,formKey:`${b??"none"}:${Vn}:${Jt??""}`,formWrapperClassName:"pt-1",meta:x??void 0,decofile:y,onSaveReferencedBlock:un,sandbox:hn})})]}),Dr=i.jsx("div",{className:ae(M?"px-2":"p-2 pt-3"),children:i.jsx(Xl,{listKey:`${E??""}-${we}`,rawSections:U,sections:Pe,meta:x,decofile:y,selectedIndex:b,onSelect:ri,onReorder:oi,onDelete:ii,onDuplicate:ai,onMakeReusable:He,onToggleHidden:li,onToggleLazy:he?ci:void 0,onAddVariant:xn,onDetach:ui,onAddSection:()=>Fe(!0),canAddSection:sr})}),Ki=i.jsxs("div",{className:"min-w-0 max-w-full space-y-4 overflow-x-hidden px-3",children:[E&&je&&i.jsx(Or,{pageKey:E,initialName:je.name,initialPath:je.path,onFieldChange:Zs}),mn&&E?i.jsx(so,{rawSeo:Cn,innerSeo:Jn,defaultResolveType:$s,seoSchema:zs,activeResolveType:Nn,seoTypeOptions:Ls,formResetKey:Ds,siteDefaultSeo:Hs,onBreadcrumbChange:Lt,onPersistRaw:Ar,onInnerChange:Rr,onClearForm:Cr,onBumpFormKey:Nr,asyncRenderAvailable:he}):i.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:f("sectionsEditor.sectionsEditor.seoSchemaNotFound")})]}),Fi=i.jsx(rn,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:i.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:i.jsx("div",{className:"mx-auto max-w-2xl",children:mn&&E?i.jsx(so,{rawSeo:Cn,innerSeo:Jn,defaultResolveType:$s,seoSchema:zs,activeResolveType:Nn,seoTypeOptions:Ls,formResetKey:Ds,siteDefaultSeo:Hs,onBreadcrumbChange:Lt,onPersistRaw:Ar,onInnerChange:Rr,onClearForm:Cr,onBumpFormKey:Nr,asyncRenderAvailable:he}):i.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:f("sectionsEditor.sectionsEditor.seoSchemaNotFound")})})})},"editor-seo"),Oi=i.jsxs(rn,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[ht&&E&&i.jsx(Lr,{listKey:E,variants:Me,activeIndex:we,decofile:y??{},meta:x,matchers:tn,onSelect:is,onReorder:jr,onRename:Ee,onDuplicate:_r,onDelete:wr,onAdd:yn}),ht&&_e!==null&&i.jsxs("div",{className:ae("px-3 border-b",De?"pt-3 pb-5 space-y-3":"py-2"),children:[i.jsxs("button",{type:"button",onClick:()=>yt(t=>!t),className:"flex w-full items-center justify-between gap-2 text-left cursor-pointer rounded-[var(--studio-control-radius,var(--radius-sm))] py-0.5 hover:bg-muted/40","aria-expanded":De,children:[i.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:f("sectionsEditor.sectionsEditor.variantRule")}),De?i.jsx(Ea,{className:"size-3.5 shrink-0 text-muted-foreground"}):i.jsx(Ra,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),De&&i.jsx("div",{className:ae("space-y-3",Qt&&"pointer-events-none opacity-50"),children:i.jsx(us,{currentRt:_e,currentLabel:wn(rt?.rule,y??{},wt,x??void 0),currentGlobalKey:Bt(rt?.rule,y??{},x??void 0)??void 0,matchers:tn,globals:ns,onSelect:ir,onSelectGlobal:lr,schema:rr,formValue:Te,onChange:ar,formKey:`${we}:${_e??""}`,formWrapperClassName:"space-y-3",meta:x??void 0,decofile:y,onSaveReferencedBlock:un,sandbox:hn})})]}),Dr]},"editor-section-list");return i.jsx(xa,{children:i.jsxs("div",{className:"flex h-full min-w-0 w-full flex-col",children:[!M&&ls&&i.jsx("div",{className:"flex min-w-0 shrink-0 items-center gap-2 px-3 py-2",children:ls}),(M||Mn.length>1)&&i.jsx(ya,{crumbs:Mn,onSelect:as,onSelectRoot:()=>{cn.flush(),$?$():as(0)}}),i.jsx("div",{className:"shrink-0",children:M?i.jsxs("div",{className:ae("flex items-center gap-2 border-b px-3 py-2.5",ut&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[M&&ls,ut&&i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx("span",{className:"shrink-0 cursor-help",children:i.jsx(zn,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),i.jsx(Rt,{side:"bottom",className:"max-w-[260px]",children:f("sectionsEditor.sectionsEditor.globalSectionTooltip")})]}),i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[i.jsx("span",{className:"truncate text-sm font-semibold",children:Ri}),br&&i.jsx("span",{className:"truncate text-xs text-muted-foreground",children:br})]}),os&&ht&&rt&&i.jsx(zr,{variants:Me,activeIndex:we,onSelect:is,onManage:Mi,onRemoveAll:Ci}),ki&&i.jsx(zr,{variants:Nt,activeIndex:Vn,onSelect:er,onManage:Pi,onRemoveAll:tr}),os&&!ht&&i.jsx(Bn,{onClick:yn}),_i&&i.jsx(Bn,{onClick:()=>xn()}),i.jsx(Sa,{}),os&&i.jsxs(i.Fragment,{children:[i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"outline",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.editSeo"),className:"size-7 shrink-0",onClick:Di,children:i.jsx(Gr,{size:14})})}),i.jsx(Rt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.editSeo")})]}),!z&&i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"outline",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.viewJson"),className:"size-7 shrink-0",onClick:()=>dt(!0),children:i.jsx(Ur,{size:14})})}),i.jsx(Rt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.viewJson")})]})]})]}):Ii}),lt&&i.jsx(yc,{open:!0,fields:cc(lt.plan,lt.target.schema),choices:lt.choices,changedAgain:lt.changedAgain,author:zo,fresh:lt.fresh,onChoose:(t,r)=>si({...lt.choices,[t]:r}),onApply:ni},Jc(lt.formBase)),Ot?i.jsx(Hr,{onAdd:()=>xn(),children:Vr},"editor-section-variants"):Vt?i.jsxs(rn,{viewportRef:Ke,onBlur:Gs,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[!M&&Tt&&Nt.length>0&&q.length===0&&Vr,i.jsx(Wr,{activeSchema:Tn,formValue:xe,formResetKey:Ye,onFormChange:Qs,onBreadcrumbChange:O,breadcrumbPath:q,emptyMessage:f("sectionsEditor.sectionsEditor.noEditableFieldsForVariant"),meta:x,decofile:y,onSaveReferencedBlock:un,sandbox:hn,previewBaseUrl:ee,onRequestAddSection:Xs,onVariantMatcherOp:ie?Vi:void 0})]},"editor-section-form"):ie?i.jsx(rn,{viewportRef:Ke,onBlur:Gs,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:i.jsx(Wr,{activeSchema:Tn,formValue:xe,formResetKey:Ye,onFormChange:Qs,onBreadcrumbChange:O,breadcrumbPath:q,emptyMessage:f("sectionsEditor.sectionsEditor.noEditableFieldsForGlobalBlock"),meta:x,decofile:y,onSaveReferencedBlock:un,sandbox:hn,previewBaseUrl:ee,onRequestAddSection:Xs})},"editor-global-block"):qe?M?i.jsx(rn,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:i.jsx("div",{className:"p-3",children:Ki})},"editor-seo"):Fi:et?i.jsx(Hr,{onAdd:yn,children:Bi},"editor-variants"):M?i.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[i.jsx(rn,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:i.jsx("div",{className:"py-2",children:Dr})}),i.jsx("div",{className:"shrink-0 border-t p-2",children:i.jsx(js,{canAddSection:sr,onAddSection:()=>Fe(!0)})})]},"editor-section-list"):Oi,i.jsx(ba,{open:ke!==null,onOpenChange:t=>{t||He(null)},defaultBlockId:ke!==null?Fn(Pe[ke]?.label??""):"",isPending:G.isPending,onSubmit:gi}),ve&&i.jsx(Al,{open:Xe,onOpenChange:t=>{Fe(t),t||(ne.current=null)},meta:x,decofile:y,previewBaseUrl:ee,onSelect:fi}),re&&E&&y&&i.jsx(La,{open:re,onOpenChange:dt,pageKey:E,decofile:y}),We!==null&&i.jsx(qr,{open:!0,initialName:Gt(Me[We]?.rule,y??{},x??void 0)?wn(Me[We]?.rule,y??{},wt,x??void 0):"",autoLabel:wt(fs(Me[We]?.rule,y??{},x??void 0)),isPending:Qt,onSubmit:async t=>{await Ni(We,t)},onOpenChange:t=>{!t&&!Qt&&Ee(null)}}),Ie!==null&&i.jsx(qr,{open:!0,initialName:Gt(Nt[Ie]?.rule,y??{},x??void 0)?wn(Nt[Ie]?.rule,y??{},wt,x??void 0):"",autoLabel:wt(fs(Nt[Ie]?.rule,y??{},x??void 0)),isPending:Qt,onSubmit:async t=>{await Ti(Ie,t)},onOpenChange:t=>{!t&&!Qt&&Ve(null)}})]})})}export{tm as SectionsEditor};
|