decocms 4.500.4 → 4.500.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{ActiveShapeUtils-r8jaNALG.js → ActiveShapeUtils-BHdUySfQ.js} +1 -1
- package/dist/client/assets/{AlertCircle-BgwifFMG.js → AlertCircle-BBiRNTdE.js} +1 -1
- package/dist/client/assets/{AreaChart-DB6yNBzt.js → AreaChart-DzGyoHJY.js} +1 -1
- package/dist/client/assets/{ArrowLeft-BP0atRPX.js → ArrowLeft-DwPfX3sc.js} +1 -1
- package/dist/client/assets/{ArrowUp-AxzDl8Z3.js → ArrowUp-XUO4rGpO.js} +1 -1
- package/dist/client/assets/{BarChart-CwA-ga4F.js → BarChart-DAturvGe.js} +1 -1
- package/dist/client/assets/{Building02-DDW-F58b.js → Building02-CFG818HY.js} +1 -1
- package/dist/client/assets/{CategoricalChart-DVQp8mi8.js → CategoricalChart-DIdWIqvV.js} +1 -1
- package/dist/client/assets/{CheckCircle-pe1RxSse.js → CheckCircle-BZiV5rFy.js} +1 -1
- package/dist/client/assets/{ChevronSelectorVertical-B9RLS3HF.js → ChevronSelectorVertical-Dc4zDElk.js} +1 -1
- package/dist/client/assets/{ChevronUp-QaPEzxVx.js → ChevronUp-ZSzJudc4.js} +1 -1
- package/dist/client/assets/{Copy01-YTn6AAPK.js → Copy01-CT9uxfj6.js} +1 -1
- package/dist/client/assets/{CreditCard01-DPxzkwQY.js → CreditCard01-DCwoKma6.js} +1 -1
- package/dist/client/assets/{DotsVertical-D1KewbnO.js → DotsVertical-CcRpaMtq.js} +1 -1
- package/dist/client/assets/{ErrorBarContext-DFDHSMqE.js → ErrorBarContext-9Kz0FTp2.js} +1 -1
- package/dist/client/assets/{Globe04-Cq4nB1G2.js → Globe04-D88PtZSB.js} +1 -1
- package/dist/client/assets/{Image01-Bpynux_N.js → Image01-DUunwh52.js} +1 -1
- package/dist/client/assets/{Key01-ByMBFx-i.js → Key01-Dy9XOW24.js} +1 -1
- package/dist/client/assets/{Link01-Zi8wbjzB.js → Link01-BDbdWLwx.js} +1 -1
- package/dist/client/assets/{LinkBroken01-tO8JEBqa.js → LinkBroken01-BFW8MxYc.js} +1 -1
- package/dist/client/assets/{Monitor01-wrmGnmsX.js → Monitor01-Cm6_ReiN.js} +1 -1
- package/dist/client/assets/{Play-W6HcQ7l_.js → Play-DFfgxv2q.js} +1 -1
- package/dist/client/assets/{Plus-BKb3EUuT.js → Plus-clvoB9-y.js} +1 -1
- package/dist/client/assets/{SearchMd-BXSC0WTH.js → SearchMd-Bg-9XsfQ.js} +1 -1
- package/dist/client/assets/{Sector-DqutoVk-.js → Sector-Byc95Y0H.js} +1 -1
- package/dist/client/assets/{ShoppingBag01-D0kKEJuH.js → ShoppingBag01-C_AR4ZKW.js} +1 -1
- package/dist/client/assets/{Sun-CfiICDcE.js → Sun-Dzm8FpU3.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-CAC-8ZOB.js → SwitchHorizontal01-D8mpLNM6.js} +1 -1
- package/dist/client/assets/{Tool01-C9pjFqwV.js → Tool01-D8RNlK5k.js} +1 -1
- package/dist/client/assets/{Trash01-BO35Cov_.js → Trash01-ByfCfoe2.js} +1 -1
- package/dist/client/assets/{Upload01-DJFAu4Mm.js → Upload01-BOzWcBO4.js} +1 -1
- package/dist/client/assets/{User01-B7hPiYB7.js → User01-VVR3ncLA.js} +1 -1
- package/dist/client/assets/{UserSquare-CLXjlx3Y.js → UserSquare-BG_D4lBt.js} +1 -1
- package/dist/client/assets/{Users01-DxG-qkCG.js → Users01-BT5Jdc2I.js} +1 -1
- package/dist/client/assets/{XAxis-BlThxQ5X.js → XAxis-BL1uz4Hu.js} +1 -1
- package/dist/client/assets/{XClose-CMdSy1nN.js → XClose-Ck0EFhGe.js} +1 -1
- package/dist/client/assets/{ZoomOut-DLs2h_6j.js → ZoomOut-DJOChAz1.js} +1 -1
- package/dist/client/assets/{access-gate-3MCIFFcK.js → access-gate-DTjgjsQi.js} +1 -1
- package/dist/client/assets/add-connection-dialog-DhxH1mO6.js +1 -0
- package/dist/client/assets/agent-analytics-CRCDBvT9.js +2 -0
- package/dist/client/assets/agent-app-DuWlTve8.js +1 -0
- package/dist/client/assets/agent-assets-BupbbWua.js +1 -0
- package/dist/client/assets/{agent-automation-D7MtRcpp.js → agent-automation-BrF1bbQv.js} +1 -1
- package/dist/client/assets/{agent-automations-C6QL27by.js → agent-automations-Bf5oYp8h.js} +1 -1
- package/dist/client/assets/{agent-connect-sources-3TeEngKZ.js → agent-connect-sources-CyYVygog.js} +1 -1
- package/dist/client/assets/agent-deck-DBdSSaIH.js +1 -0
- package/dist/client/assets/agent-e2e-Dc15KMWY.js +1 -0
- package/dist/client/assets/agent-experiments-Dn4D2o0f.js +1 -0
- package/dist/client/assets/agent-file-HtB1MCoL.js +1 -0
- package/dist/client/assets/agent-hosting-B16K2Ojh.js +1 -0
- package/dist/client/assets/{agent-icon-DjnOmCBc.js → agent-icon-CSrsRkkV.js} +1 -1
- package/dist/client/assets/agent-library-Dfzx9j-W.js +1 -0
- package/dist/client/assets/agent-library-file-B0MZUu0i.js +1 -0
- package/dist/client/assets/agent-monitor-BVZ6dj6l.js +1 -0
- package/dist/client/assets/{agent-overview-1r1Kovqy.js → agent-overview-Fv2Tlbaf.js} +1 -1
- package/dist/client/assets/agent-settings-E9aYbTuV.js +1 -0
- package/dist/client/assets/{agent-site-editor-AFFGIJna.js → agent-site-editor-CXtKOY2R.js} +2 -2
- package/dist/client/assets/agent-site-editor-code-C7kSpllc.js +2 -0
- package/dist/client/assets/{agent-site-editor-content-8UmzG7GR.js → agent-site-editor-content-C7FjEODf.js} +3 -3
- package/dist/client/assets/{agent-site-editor-preview-CKZy7Tmh.js → agent-site-editor-preview-BfKLwBCP.js} +3 -3
- package/dist/client/assets/agent-view-BqtBvPf5.js +1 -0
- package/dist/client/assets/{agent-view-guard-BlKWFB7P.js → agent-view-guard-CbFaNTaO.js} +1 -1
- package/dist/client/assets/{agents-list-CNENncPv.js → agents-list-rRAvXkxo.js} +1 -1
- package/dist/client/assets/{ai-providers-DurLhw5y.js → ai-providers-DxQSPA6H.js} +1 -1
- package/dist/client/assets/{alert-BavK6rpL.js → alert-BB7UNECi.js} +1 -1
- package/dist/client/assets/{alert-dialog-DLvf9XpO.js → alert-dialog-Bq1vUmcb.js} +1 -1
- package/dist/client/assets/{analytics-sections-BILOZ8xI.js → analytics-sections-D4hmenz2.js} +1 -1
- package/dist/client/assets/api-keys-C9apOrj-.js +1 -0
- package/dist/client/assets/{api-keys-DxfnV1wH.js → api-keys-CwCZzaXX.js} +1 -1
- package/dist/client/assets/app-editor-BNTMP2XY.js +1 -0
- package/dist/client/assets/{asset-utils-RL-ZiBha.js → asset-utils-D2JqsHLw.js} +1 -1
- package/dist/client/assets/{auth-C11WExuf.js → auth-Cf8kTvK7.js} +1 -1
- package/dist/client/assets/{auth-catchall-DtdWlB5Z.js → auth-catchall-CMb2pPKe.js} +1 -1
- package/dist/client/assets/{auth-entry-DzUfVYJ4.js → auth-entry-DJDQHUOg.js} +1 -1
- package/dist/client/assets/{auth-split-layout-DdRT7pwN.js → auth-split-layout-DL8EKWzu.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-DyuZVm6i.js → authenticate-and-persist-oauth-CNIjDkAv.js} +1 -1
- package/dist/client/assets/{automation-list-row-DQWI_wwj.js → automation-list-row-CmUakn9s.js} +1 -1
- package/dist/client/assets/{automation-runs-BMd-xJ2A.js → automation-runs-CBloXkSc.js} +1 -1
- package/dist/client/assets/{automations-DEn-h47r.js → automations-Bc2qeNY9.js} +1 -1
- package/dist/client/assets/{autosend-BxzE8tXY.js → autosend-Dbvfg9pv.js} +1 -1
- package/dist/client/assets/{avatar-BQ1clUOI.js → avatar-CVhMMaTf.js} +1 -1
- package/dist/client/assets/{badge-NHL6jQ7U.js → badge-GBNejOns.js} +1 -1
- package/dist/client/assets/{block-document-Cn1hz4p_.js → block-document-L5yAxhd6.js} +1 -1
- package/dist/client/assets/{blocks-preview-workspace-context-C7BK9yT5.js → blocks-preview-workspace-context-BeUFeWIT.js} +1 -1
- package/dist/client/assets/{blog-schema-rNr5GnCl.js → blog-schema-BIMlJLWj.js} +1 -1
- package/dist/client/assets/{board-analytics-IRwojiVB.js → board-analytics-CBArh6Zy.js} +1 -1
- package/dist/client/assets/{buckets-CbnqPAbV.js → buckets-DMjEyGOV.js} +1 -1
- package/dist/client/assets/{build-improve-prompt-doc-DIcVxtkz.js → build-improve-prompt-doc-DMgFOt46.js} +1 -1
- package/dist/client/assets/{calendar-wJdw6sZE.js → calendar-D4OoX9Wr.js} +1 -1
- package/dist/client/assets/{capability-load-error-BegMkJwl.js → capability-load-error-C0o_DJDN.js} +1 -1
- package/dist/client/assets/category-editor-Bc1AHLqb.js +1 -0
- package/dist/client/assets/{chart-yyGN_0NT.js → chart-DcIK_AOG.js} +1 -1
- package/dist/client/assets/{chat-context-Bdbu4aFj.js → chat-context-NYUfgJBl.js} +1 -1
- package/dist/client/assets/{chat-draft-CKhySLl4.js → chat-draft-BIT8lUsr.js} +1 -1
- package/dist/client/assets/{checkbox-B6gj5-qt.js → checkbox-1mSDcatb.js} +1 -1
- package/dist/client/assets/{choose-editor-pJnZ58-b.js → choose-editor-DSkLDSjl.js} +1 -1
- package/dist/client/assets/{claim-phase-copy-CNoIfrVp.js → claim-phase-copy-Clje3zqq.js} +1 -1
- package/dist/client/assets/{cli-auth-success-C2CP1C9i.js → cli-auth-success-DK3FztVN.js} +1 -1
- package/dist/client/assets/{client-icons-BG3NCFov.js → client-icons-C0HcvKpc.js} +1 -1
- package/dist/client/assets/{collapsible-8Gh0baiT.js → collapsible-CeMlXkLt.js} +1 -1
- package/dist/client/assets/collection-detail-CBbaNdto.js +1 -0
- package/dist/client/assets/{collection-display-button-Guyqw9do.js → collection-display-button-Cp21-jdI.js} +1 -1
- package/dist/client/assets/{collection-search-ji1JjZMn.js → collection-search-JcNHcOFg.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-CSxKmndL.js → collection-table-wrapper-DoyJbjYf.js} +1 -1
- package/dist/client/assets/{collection-tabs-C39YFQ2E.js → collection-tabs-CSZlwXCA.js} +1 -1
- package/dist/client/assets/{column-rules-vK8DsKaQ.js → column-rules-CDXH6Bu0.js} +1 -1
- package/dist/client/assets/{combobox-sJwovF14.js → combobox-B0RpAw2t.js} +1 -1
- package/dist/client/assets/{command-CloMVJTp.js → command-CJiwms5W.js} +1 -1
- package/dist/client/assets/{companion-mcps-section-DkcpjKJu.js → companion-mcps-section--NmxcAor.js} +1 -1
- package/dist/client/assets/{config-BGvl3kPw.js → config-C1YCQZ8E.js} +1 -1
- package/dist/client/assets/{connect-BXtTpX6G.js → connect-6HWvGxM0.js} +1 -1
- package/dist/client/assets/{connect-layout-3qTDxx-Z.js → connect-layout-m9uvi79-.js} +1 -1
- package/dist/client/assets/{connection-card-VZBAZ1By.js → connection-card-CWkexnWw.js} +1 -1
- package/dist/client/assets/connection-detail-CkRea4yr.js +1 -0
- package/dist/client/assets/connection-form-helpers-W4yLfkzt.js +1 -0
- package/dist/client/assets/{connection-BKamaNd5.js → connection-pgjV95kc.js} +1 -1
- package/dist/client/assets/connections-BRM4t7Yz.js +1 -0
- package/dist/client/assets/context-BJ70LQt3.js +1 -0
- package/dist/client/assets/{context-menu-BL7ReY3s.js → context-menu-oPFsFXlL.js} +1 -1
- package/dist/client/assets/{core.esm-CAijLSig.js → core.esm-BaMzqjA4.js} +1 -1
- package/dist/client/assets/{create-organization-dialog-CzdjGKlM.js → create-organization-dialog-TMOD9u6U.js} +1 -1
- package/dist/client/assets/{daily-pulse-Do7Bv4JX.js → daily-pulse-BO10zQ_I.js} +1 -1
- package/dist/client/assets/{device-hint-CWzU-IYs.js → device-hint-DAX5UNJH.js} +1 -1
- package/dist/client/assets/{discover-BnV5JtgA.js → discover-CTV9dsNW.js} +1 -1
- package/dist/client/assets/{domain-settings-Dp99mfI4.js → domain-settings-CYeaKhkK.js} +1 -1
- package/dist/client/assets/{drawer-CBMcEEQM.js → drawer-DWjMBwyf.js} +1 -1
- package/dist/client/assets/{editor-B4h2oI8R.js → editor-D6w2Bb1A.js} +1 -1
- package/dist/client/assets/{empty-state-YI3BPcNO.js → empty-state-BjrW4gr3.js} +1 -1
- package/dist/client/assets/{empty-state-BZTHulBK.js → empty-state-DfOpTmwf.js} +1 -1
- package/dist/client/assets/{extract-connection-data-U1HCpmI2.js → extract-connection-data-BWH-Gguq.js} +1 -1
- package/dist/client/assets/{feature-gate-Bz1_kJfU.js → feature-gate-CAHn_bYX.js} +1 -1
- package/dist/client/assets/{feature-paywall-Hzw839qS.js → feature-paywall-D3P0r-v1.js} +1 -1
- package/dist/client/assets/{file-explorer-D-yZsL4s.js → file-explorer-D8gxxm_3.js} +1 -1
- package/dist/client/assets/{file-preview-BPquMk7t.js → file-preview-Dfh2A-J9.js} +1 -1
- package/dist/client/assets/{file-share-button-CZio6GIv.js → file-share-button-BDicbalV.js} +1 -1
- package/dist/client/assets/{file-type-icon-BQzv7Wym.js → file-type-icon-hf5iGs8U.js} +1 -1
- package/dist/client/assets/flat-project-BZC_AY-t.js +1 -0
- package/dist/client/assets/{folder-icon-hFIrLwS2.js → folder-icon-BNfJeIOf.js} +1 -1
- package/dist/client/assets/{form-BRZ5DZiG.js → form-Bn1uWhLp.js} +1 -1
- package/dist/client/assets/{general-D4j81pur.js → general-CMoIUwrd.js} +1 -1
- package/dist/client/assets/home-C5N5Yasj.js +1 -0
- package/dist/client/assets/{icon-button-7qsU_2OV.js → icon-button-D9OpoKyB.js} +1 -1
- package/dist/client/assets/{index-CsiOLq0m.js → index-2uENFhiF.js} +3 -3
- package/dist/client/assets/{index-p5cxA0SC.js → index-4oHb6320.js} +1 -1
- package/dist/client/assets/{index-6SpfJF4P.js → index-BW9tBS1_.js} +1 -1
- package/dist/client/assets/index-BYDys87w.js +26 -0
- package/dist/client/assets/{index-Csp02eVI.js → index-C0M3jIYV.js} +1 -1
- package/dist/client/assets/{index-C3moojPl.js → index-CRbDzsEl.js} +2 -2
- package/dist/client/assets/{index-rN0rlunX.js → index-Cei-7zh-.js} +1 -1
- package/dist/client/assets/{index-qV0aMVfj.js → index-CijieWPb.js} +1 -1
- package/dist/client/assets/{index-BFQV-2t6.js → index-D8JxMS8j.js} +1 -1
- package/dist/client/assets/{index-lfns9uh8.js → index-DBXjCQdJ.js} +1 -1
- package/dist/client/assets/{index-DjXrdMkW.js → index-DPPcuuZa.js} +1 -1
- package/dist/client/assets/{index-DOFxzI-C.js → index-aGwRFVIr.js} +1 -1
- package/dist/client/assets/{index-BXITXB61.js → index-m-B-HtFl.js} +1 -1
- package/dist/client/assets/{index-redirect-4gzc5Gy_.js → index-redirect-oFouPYya.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-DMRptffd.js → infiniteQueryObserver-Dhuk-wHX.js} +1 -1
- package/dist/client/assets/{infra-billing-BK2k2AIQ.js → infra-billing-D-XVEkhR.js} +1 -1
- package/dist/client/assets/{input-Dy0JrrC0.js → input-C8SbKhCo.js} +1 -1
- package/dist/client/assets/{input-C8o95ZIl.js → input-XQLahzDk.js} +3 -3
- package/dist/client/assets/{integration-icon-CmzyrNbk.js → integration-icon-BELz_pOH.js} +1 -1
- package/dist/client/assets/{jira-icon-CaqntM3w.js → jira-icon-DtfD9SYH.js} +1 -1
- package/dist/client/assets/{label-C-C9Ou_x.js → label-BUw2LYOJ.js} +1 -1
- package/dist/client/assets/{layout-SMB9U0zE.js → layout-d6dVT2i7.js} +1 -1
- package/dist/client/assets/{legacy-agents-deep-DH5S5sM5.js → legacy-agents-deep-pzQxt8GU.js} +1 -1
- package/dist/client/assets/{legacy-main-redirect-CgxK0F6X.js → legacy-main-redirect-Dxx-LsCk.js} +1 -1
- package/dist/client/assets/library-C1bBtD2v.js +1 -0
- package/dist/client/assets/{library-tab-BDN7_SPX.js → library-tab-CSQBidcn.js} +1 -1
- package/dist/client/assets/{login-KvBjhXxT.js → login-C9F3Ei8y.js} +1 -1
- package/dist/client/assets/{markdown-BUXU5oD6.js → markdown-CW257Zz5.js} +1 -1
- package/dist/client/assets/{mcp-app-renderer-DyZ3_ABn.js → mcp-app-renderer-1q9SfIz-.js} +1 -1
- package/dist/client/assets/{mcp-oauth-L9MT2tEQ.js → mcp-oauth-DJzQquAH.js} +1 -1
- package/dist/client/assets/{mcp-oauth-BkcOWs3t.js → mcp-oauth-DcDGTHX8.js} +1 -1
- package/dist/client/assets/{members-DDmeZze3.js → members-Cq2hjNgQ.js} +1 -1
- package/dist/client/assets/{memory-Bz_z-OHW.js → memory-lQR7baEY.js} +1 -1
- package/dist/client/assets/{mini-report-page-Du9prRn4.js → mini-report-page-BW6etI3e.js} +1 -1
- package/dist/client/assets/{mock-board-wu3yr1Uh.js → mock-board-v0ispli3.js} +1 -1
- package/dist/client/assets/{monaco-editor-Cpw9JqW2.js → monaco-editor-BuUSistE.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-CR8Pz4AG.js → monitoring-stats-row-oudHSLAL.js} +1 -1
- package/dist/client/assets/{multi-select-d0qSjN1D.js → multi-select-C-uRGkhX.js} +1 -1
- package/dist/client/assets/{mustache-BlQTgv16.js → mustache-BISt82Zb.js} +1 -1
- package/dist/client/assets/{new-project-dialog-BLbuP-We.js → new-project-dialog-CU6GK7Hi.js} +1 -1
- package/dist/client/assets/{oauth-callback-CEt2mysn.js → oauth-callback-Bl3J_Goo.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-CrSicNp6.js → oauth-callback-ai-provider-C2G5PQSS.js} +1 -1
- package/dist/client/assets/{onboarding-ChZQ4_Cn.js → onboarding-CCQgINAK.js} +1 -1
- package/dist/client/assets/openai-conversation-Dd1mqt5t.js +3 -0
- package/dist/client/assets/{optimistic-project-sidebar-views-DBs2dIsI.js → optimistic-project-sidebar-views-6bEngMBF.js} +1 -1
- package/dist/client/assets/{organization-choice-W78BZNeA.js → organization-choice-BsLbocoH.js} +1 -1
- package/dist/client/assets/{orgs-DueEMR7Z.js → orgs-BviopEAn.js} +1 -1
- package/dist/client/assets/{page-seo-form-CY1JVNQO.js → page-seo-form-BI_Up050.js} +1 -1
- package/dist/client/assets/{pair-BL76LvR6.js → pair-gT7Vn8Gp.js} +1 -1
- package/dist/client/assets/{plan-ladder-CBREr6Ld.js → plan-ladder-eppTKAOz.js} +1 -1
- package/dist/client/assets/{popover-P9zPzqJX.js → popover-UZd_hI6l.js} +1 -1
- package/dist/client/assets/post-calendar-Cjve8Rxv.js +1 -0
- package/dist/client/assets/{post-editor-C5HYxFbJ.js → post-editor-CZ0y9t6g.js} +2 -2
- package/dist/client/assets/{preview-content-ChI0T8Cs.js → preview-content-DDkyBqjA.js} +1 -1
- package/dist/client/assets/{preview-dialog-CFiVBx33.js → preview-dialog-ClQDORRP.js} +1 -1
- package/dist/client/assets/{preview-panel-BMAYjh5J.js → preview-panel-D6Cx93Va.js} +1 -1
- package/dist/client/assets/{product-picker-dialog-DZ5LfyYE.js → product-picker-dialog-BzADIVCT.js} +1 -1
- package/dist/client/assets/{profile-DB49xk9A.js → profile-3pRJt6iK.js} +1 -1
- package/dist/client/assets/{project-app-view-Dv1i76zf.js → project-app-view-DOlvQRFJ.js} +1 -1
- package/dist/client/assets/{project-feed-CvGIQNLX.js → project-feed-DwG8xB7e.js} +1 -1
- package/dist/client/assets/{project-icon-Ds5KkwAm.js → project-icon-CgRPdhMz.js} +1 -1
- package/dist/client/assets/project-reports-D_goeZQT.js +1 -0
- package/dist/client/assets/project-tasks-DzgzriDY.js +1 -0
- package/dist/client/assets/{projects-8sHbBlFT.js → projects-DAlf21yV.js} +1 -1
- package/dist/client/assets/{projects-empty-state-IOAu-wpI.js → projects-empty-state-NpSKf9NQ.js} +1 -1
- package/dist/client/assets/{prompts-Ce0XP9qb.js → prompts-BqXStpOV.js} +1 -1
- package/dist/client/assets/record-editor-CwaNJSND.js +1 -0
- package/dist/client/assets/redirect-editor-CfZclWU6.js +1 -0
- package/dist/client/assets/reports-FtFAx270.js +1 -0
- package/dist/client/assets/{reports-onboarding-p3K1uYqw.js → reports-onboarding-DNardEjj.js} +1 -1
- package/dist/client/assets/{reports-tab-BXua1NQM.js → reports-tab-B7A5GfAR.js} +2 -2
- package/dist/client/assets/{reports-CE5LHXXr.js → reports-zibGg05d.js} +1 -1
- package/dist/client/assets/{repositories-ToQv_rZB.js → repositories-DCzfX5wT.js} +1 -1
- package/dist/client/assets/{repository-binding-CPA8-dMz.js → repository-binding-GEAUbB-O.js} +1 -1
- package/dist/client/assets/{repository-import-picker-DG4AirBH.js → repository-import-picker-CGZicTtt.js} +1 -1
- package/dist/client/assets/{repository-picker-BfnPBGTa.js → repository-picker-ipWiqqIY.js} +1 -1
- package/dist/client/assets/{require-capability-B_m0hTh2.js → require-capability-DCY-qqzS.js} +1 -1
- package/dist/client/assets/{required-auth-layout-DqtVx04D.js → required-auth-layout-B0JL0M-z.js} +1 -1
- package/dist/client/assets/{reset-password-Badkqm_7.js → reset-password-C0OP0JfY.js} +1 -1
- package/dist/client/assets/{resizable-BTJacEf8.js → resizable-CNroF4sn.js} +1 -1
- package/dist/client/assets/{resolve-tab-icon-rGkJ7QGs.js → resolve-tab-icon-Dxlq4MHo.js} +1 -1
- package/dist/client/assets/{review-settings-DFCkjKmA.js → review-settings-DUuUJ0iP.js} +1 -1
- package/dist/client/assets/{rich-text-link-control-CGRceWX2.js → rich-text-link-control-Cyib9lpp.js} +1 -1
- package/dist/client/assets/{roles-BirPgyBv.js → roles-B3QPIjlh.js} +1 -1
- package/dist/client/assets/route--gK_s8W2.js +1 -0
- package/dist/client/assets/{route-BelNzFge.js → route-Dh4tgoWv.js} +1 -1
- package/dist/client/assets/route-K7GDvkOp.js +1 -0
- package/dist/client/assets/{runnable-block-editor-BfWUQRiS.js → runnable-block-editor-cJtvApNo.js} +1 -1
- package/dist/client/assets/{sandbox-lifecycle-context-BUwLKKqW.js → sandbox-lifecycle-context-DtkY5KHH.js} +1 -1
- package/dist/client/assets/{schema-DyDDwNs8.js → schema-DCzFPjhQ.js} +1 -1
- package/dist/client/assets/schema-DxY623qB.js +1 -0
- package/dist/client/assets/{scroll-area-BJew8KVi.js → scroll-area-BOuDQrjF.js} +1 -1
- package/dist/client/assets/{search-input-iE4YnSAW.js → search-input-DXojQXHS.js} +1 -1
- package/dist/client/assets/{search-toggle-BcxWLlTq.js → search-toggle-BHQUIlgP.js} +1 -1
- package/dist/client/assets/{secret-picker-DPGoj7h_.js → secret-picker-DghVxrjs.js} +1 -1
- package/dist/client/assets/{secrets-B8z_kU7L.js → secrets-Bw5YDwtb.js} +1 -1
- package/dist/client/assets/{sections-editor-CrDBRhDJ.js → sections-editor-zfrx_XIM.js} +2 -2
- package/dist/client/assets/{select-model-DktuB9we.js → select-model-B19lAAyT.js} +1 -1
- package/dist/client/assets/{select-DStdJ5GE.js → select-nSDsr0Zi.js} +1 -1
- package/dist/client/assets/seo-editor-Do7Fekf0.js +1 -0
- package/dist/client/assets/{separator-DjT0GNN3.js → separator-D9Lu8Cm9.js} +1 -1
- package/dist/client/assets/{settings-tab-Bp_kIMZk.js → settings-tab-TpMIkIJy.js} +1 -1
- package/dist/client/assets/{sheet-DrnvYUkv.js → sheet-Bg01hTvG.js} +1 -1
- package/dist/client/assets/{shell-layout-es79-GX2.js → shell-layout-BO31z5MQ.js} +1 -1
- package/dist/client/assets/{skills-tgcVsI6y.js → skills-Bf1PjaTY.js} +1 -1
- package/dist/client/assets/{slider-DDCTVa3c.js → slider-D1s4eRGk.js} +1 -1
- package/dist/client/assets/{sortable.esm-DMnnxTnV.js → sortable.esm-DcO5R1X-.js} +1 -1
- package/dist/client/assets/{sso-CjxHBVq1.js → sso-C7L4UDB8.js} +1 -1
- package/dist/client/assets/{suggestion-lK-gfS31.js → suggestion-D6_m0iRs.js} +1 -1
- package/dist/client/assets/{switch-Kct2nT2R.js → switch-C2mEXqfo.js} +1 -1
- package/dist/client/assets/{symbol-ConDXyHb.js → symbol-Cb89sKGf.js} +1 -1
- package/dist/client/assets/{synced-repos-BldmP6l5.js → synced-repos-uukt7jKa.js} +1 -1
- package/dist/client/assets/{tab-icon-glyph-TqQzdqzw.js → tab-icon-glyph-Cmkw2CVR.js} +1 -1
- package/dist/client/assets/{table-D3NAm7Bc.js → table-CtPELWNl.js} +1 -1
- package/dist/client/assets/{tabs-BmpbjUEc.js → tabs-D0ZapmHf.js} +1 -1
- package/dist/client/assets/{task-board-B3rwHKUr.js → task-board-Cq7KN9Yp.js} +1 -1
- package/dist/client/assets/{task-route-BuUiu92l.js → task-route-Cj_KfcXd.js} +1 -1
- package/dist/client/assets/{task-status-D3rjOgq8.js → task-status-Dl4YXdIS.js} +1 -1
- package/dist/client/assets/taskboard-analytics-DynaE5kc.js +1 -0
- package/dist/client/assets/tasks-YwCQME0_.js +1 -0
- package/dist/client/assets/{tasks-ChYbt0G7.js → tasks-ZUmpusO0.js} +1 -1
- package/dist/client/assets/{textarea-BWzL69YC.js → textarea-DKdq_MAz.js} +1 -1
- package/dist/client/assets/{thread-analytics-tujDJaK3.js → thread-analytics-Dmg-wMap.js} +1 -1
- package/dist/client/assets/{thread-button-BzqfKMW2.js → thread-button-D0vpHKhc.js} +1 -1
- package/dist/client/assets/{thread-intent-CJ-s3I0o.js → thread-intent-DTPz1weL.js} +1 -1
- package/dist/client/assets/{thread-route-GHLN4JK9.js → thread-route-COCJBhr6.js} +1 -1
- package/dist/client/assets/{thread-route-CV6SbsTq.js → thread-route-gGOzpjkp.js} +1 -1
- package/dist/client/assets/{thread-sheet-body-D5eS4AiQ.js → thread-sheet-body-BuMvTCp6.js} +1 -1
- package/dist/client/assets/{time-range-picker-D2lucQp_.js → time-range-picker-MFuLyt2k.js} +1 -1
- package/dist/client/assets/{toggle-group-OQufBZdd.js → toggle-group-CZ2TAUmo.js} +1 -1
- package/dist/client/assets/{tool-namespace-BNEevFqW.js → tool-namespace-BsBj6Gec.js} +1 -1
- package/dist/client/assets/{toolbar-icon-button-CXgkBoho.js → toolbar-icon-button-BbfFE6qt.js} +1 -1
- package/dist/client/assets/{tooltip-B7gx1fFf.js → tooltip-3DBbiHrv.js} +1 -1
- package/dist/client/assets/{tooltipContext-C3VsicNY.js → tooltipContext-Bv4e3_jQ.js} +1 -1
- package/dist/client/assets/{track-BmECy8By.js → track-2QxiEKmh.js} +1 -1
- package/dist/client/assets/{types-D-iizAZX.js → types-DJQTaYxP.js} +1 -1
- package/dist/client/assets/{url-slug-yE9p_CBQ.js → url-slug-CVpOSHeG.js} +1 -1
- package/dist/client/assets/{usage-stats-CmZMkNV4.js → usage-stats-x-NR7rQ4.js} +1 -1
- package/dist/client/assets/{use-ai-providers-BuM6ovEv.js → use-ai-providers-scSugiQF.js} +1 -1
- package/dist/client/assets/{use-automations-LJ6ovb1E.js → use-automations-DxHm0Snl.js} +1 -1
- package/dist/client/assets/{use-autosave-CF8yQfdB.js → use-autosave-6XZ1t5rl.js} +1 -1
- package/dist/client/assets/{use-chat-layout-state-DSr0gtOa.js → use-chat-layout-state-n4Q3uYHD.js} +1 -1
- package/dist/client/assets/{use-chat-navigation-CtLOIOM3.js → use-chat-navigation-CpL4JFZX.js} +1 -1
- package/dist/client/assets/{use-clock-tick-CjMIMPxr.js → use-clock-tick-X8apRSs5.js} +1 -1
- package/dist/client/assets/{use-connect-companion-CwbSClFC.js → use-connect-companion-DejR02Br.js} +1 -1
- package/dist/client/assets/{use-connection-CYbCdCg-.js → use-connection--fjYRP_g.js} +1 -1
- package/dist/client/assets/{use-copy-DQJK1-Md.js → use-copy-DWNF2ghn.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-BUTNkXFZ.js → use-create-virtual-mcp-CSStLbyC.js} +1 -1
- package/dist/client/assets/{use-date-fns-locale-Co69xfV4.js → use-date-fns-locale-uYFiDToW.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-x27V8Nl7.js → use-debounced-autosave-NE-5LrTu.js} +1 -1
- package/dist/client/assets/{use-debounced-value-gqRwYLiP.js → use-debounced-value-Db_6wQub.js} +1 -1
- package/dist/client/assets/{use-deco-credits-BXoQO4ZL.js → use-deco-credits-DiTvJIB8.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-DTg4q8xq.js → use-decopilot-events-D14uF_Cy.js} +1 -1
- package/dist/client/assets/{use-delete-connection-AGx8DbMG.js → use-delete-connection-CJW-ymsx.js} +1 -1
- package/dist/client/assets/{use-deployment-admin-0LqCMWJq.js → use-deployment-admin-RiMk6_Ng.js} +1 -1
- package/dist/client/assets/{use-ensure-project-folder-BJtbErXB.js → use-ensure-project-folder-CJRjmHmY.js} +1 -1
- package/dist/client/assets/{use-fast-preview-draft-url-Cf70Sary.js → use-fast-preview-draft-url-CSEoIdMd.js} +1 -1
- package/dist/client/assets/{use-file-configs-yKzFEaLv.js → use-file-configs-BJG54sLn.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-bleQjS0V.js → use-infinite-scroll-BPxCDDTo.js} +1 -1
- package/dist/client/assets/{use-join-requests-hLy1Es2J.js → use-join-requests-CPoLxTNh.js} +1 -1
- package/dist/client/assets/{use-main-panel-tabs-CnECwxGP.js → use-main-panel-tabs-Cal5VUTK.js} +1 -1
- package/dist/client/assets/{use-mcp-auth-status-96a5nrqO.js → use-mcp-auth-status-CqBzsTJX.js} +1 -1
- package/dist/client/assets/{use-mcp-client-CaTe2ylT.js → use-mcp-client-BWo29jbN.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-CatolySn.js → use-mcp-prompts-BmY4-dHy.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-DSK4UhCW.js → use-mcp-tools-D9a3atY2.js} +1 -1
- package/dist/client/assets/{use-members-DpzUOwzJ.js → use-members-BsPA0Ct2.js} +1 -1
- package/dist/client/assets/{use-mobile-CW5odOpu.js → use-mobile-BcwC7VU3.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-d5laMYnC.js → use-navigate-to-agent-f1RDTOQU.js} +1 -1
- package/dist/client/assets/use-new-blocks-editor-Enk3EEXi.js +1 -0
- package/dist/client/assets/{use-open-billing-url-Cp2-WoXr.js → use-open-billing-url-B1MJm7M5.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-BK9SNEwg.js → use-org-auth-client-sBWqKZAZ.js} +1 -1
- package/dist/client/assets/{use-org-fs-CGkxTNmD.js → use-org-fs-BruBSf1P.js} +1 -1
- package/dist/client/assets/{use-org-repo-syncs-DD7U_Wvq.js → use-org-repo-syncs-CzMHVaws.js} +1 -1
- package/dist/client/assets/{use-org-sso-BFc5mu2c.js → use-org-sso-DQNJJVcp.js} +1 -1
- package/dist/client/assets/{use-organization-roles-_ra6WqmV.js → use-organization-roles-BLHGg1C0.js} +1 -1
- package/dist/client/assets/{use-organization-settings-DYBuXxZf.js → use-organization-settings-C2COOtae.js} +1 -1
- package/dist/client/assets/{use-panel-navigate-BSNsfU5E.js → use-panel-navigate-sjPSBICL.js} +1 -1
- package/dist/client/assets/{use-project-scope-B0llZYB3.js → use-project-scope-B_oLVbNv.js} +1 -1
- package/dist/client/assets/{use-releases-CtMKqMnj.js → use-releases-BDZh8PFH.js} +1 -1
- package/dist/client/assets/{use-reports-diagnostic-BUInMZkH.js → use-reports-diagnostic-bJK07n1G.js} +1 -1
- package/dist/client/assets/{use-sandbox-events-BWuyZLCb.js → use-sandbox-events-BxpyP1-g.js} +1 -1
- package/dist/client/assets/{use-secrets-DZiT1hfy.js → use-secrets-Dut38iEG.js} +1 -1
- package/dist/client/assets/{use-section-preview-base-C_HnXvmD.js → use-section-preview-base-7N5lxhPB.js} +1 -1
- package/dist/client/assets/{use-tags-D9KDSClM.js → use-tags-CjD7AOOq.js} +1 -1
- package/dist/client/assets/{use-task-board-analytics-BeVdM1sk.js → use-task-board-analytics-C-GLsHqS.js} +1 -1
- package/dist/client/assets/{use-task-board-events-BGOp2VgA.js → use-task-board-events-B4nYkYUb.js} +1 -1
- package/dist/client/assets/{use-task-board-item-prs-CoAaBXmY.js → use-task-board-item-prs-CdlxN-Va.js} +1 -1
- package/dist/client/assets/{use-task-board-items-5GcCOG2k.js → use-task-board-items-Bx0LqpaH.js} +1 -1
- package/dist/client/assets/{use-task-metadata-BtjkeyMc.js → use-task-metadata-BULXjcEM.js} +1 -1
- package/dist/client/assets/{use-thread-analytics-hmgxoK5f.js → use-thread-analytics-BtDukIrk.js} +1 -1
- package/dist/client/assets/{use-thread-outputs-PMUX8yZJ.js → use-thread-outputs-CaENK2ep.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-BBVki4Du.js +1 -0
- package/dist/client/assets/{useQueries-CYxeWZY5.js → useQueries-Ij5noImS.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-DP1_6mso.js +1 -0
- package/dist/client/assets/{users-D-me7s_R.js → users-Dd13UOxE.js} +1 -1
- package/dist/client/assets/{utils-B68PenDU.js → utils-CoFqD39i.js} +1 -1
- package/dist/client/assets/variant-calendar-DLgW_8Bs.js +1 -0
- package/dist/client/assets/{variant-matcher-override-cnXBxn5m.js → variant-matcher-override-BLuZbjc2.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-t5oMnsLw.js → view-mode-toggle-DGF1qVNP.js} +1 -1
- package/dist/client/assets/{virtual-mcp-EknFjHGW.js → virtual-mcp-eMBT1Rwh.js} +1 -1
- package/dist/client/assets/{watch-sse-pool-BBIuBzhf.js → watch-sse-pool-Bb7_5bsI.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/server.js +235 -235
- package/package.json +1 -1
- package/dist/client/assets/add-connection-dialog-DNMm7BIu.js +0 -1
- package/dist/client/assets/agent-analytics-CrniEuaQ.js +0 -2
- package/dist/client/assets/agent-app-BQhyv8DF.js +0 -1
- package/dist/client/assets/agent-assets-IKAQ5dPz.js +0 -1
- package/dist/client/assets/agent-deck-f6820vT8.js +0 -1
- package/dist/client/assets/agent-e2e-BPlZoWAG.js +0 -1
- package/dist/client/assets/agent-experiments-DUjuqx9x.js +0 -1
- package/dist/client/assets/agent-file-Cx3yLMJg.js +0 -1
- package/dist/client/assets/agent-hosting-D42N4TPy.js +0 -1
- package/dist/client/assets/agent-library-BIn7dUjB.js +0 -1
- package/dist/client/assets/agent-library-file-CeiO8mwA.js +0 -1
- package/dist/client/assets/agent-monitor-mP9taLUf.js +0 -1
- package/dist/client/assets/agent-settings-klWG-4n_.js +0 -1
- package/dist/client/assets/agent-site-editor-code-C4ytTmHW.js +0 -2
- package/dist/client/assets/agent-view-Hz67HaQW.js +0 -1
- package/dist/client/assets/api-keys-Bar4CNhW.js +0 -1
- package/dist/client/assets/app-editor-BpQwl80B.js +0 -1
- package/dist/client/assets/category-editor-D92K-w8g.js +0 -1
- package/dist/client/assets/collection-detail-DgpOivN_.js +0 -1
- package/dist/client/assets/connection-detail-DmNwjYLW.js +0 -1
- package/dist/client/assets/connection-form-helpers-T_Ai4T1w.js +0 -1
- package/dist/client/assets/connections-CRhKf5Aw.js +0 -1
- package/dist/client/assets/context-DDqIS5x2.js +0 -1
- package/dist/client/assets/flat-project-xIeYzzyp.js +0 -1
- package/dist/client/assets/home-BlQ7XxUT.js +0 -1
- package/dist/client/assets/index-b34wBOnq.js +0 -26
- package/dist/client/assets/library-DxhILUSJ.js +0 -1
- package/dist/client/assets/openai-conversation-Qck38y07.js +0 -3
- package/dist/client/assets/post-calendar-JcrcT1nM.js +0 -1
- package/dist/client/assets/project-reports-Bt1ILOwc.js +0 -1
- package/dist/client/assets/project-tasks-CMbWkOn0.js +0 -1
- package/dist/client/assets/record-editor-C6Bydih8.js +0 -1
- package/dist/client/assets/redirect-editor-BH-M-WaR.js +0 -1
- package/dist/client/assets/reports-CKooFM0m.js +0 -1
- package/dist/client/assets/route-AynshQR9.js +0 -1
- package/dist/client/assets/route-Dx6968P1.js +0 -1
- package/dist/client/assets/seo-editor-Do_o2mpU.js +0 -1
- package/dist/client/assets/taskboard-analytics-DQb8UlLT.js +0 -1
- package/dist/client/assets/tasks-B-ZKkcGw.js +0 -1
- package/dist/client/assets/use-new-blocks-editor-Cz0Ycsmz.js +0 -1
- package/dist/client/assets/useInfiniteQuery-Cogq3tDA.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-BbeYvXgw.js +0 -1
- package/dist/client/assets/variant-calendar-DRmc-Qwc.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as ft,b as Dt,r as w,l as le,j as o,b1 as _i,B as xt,U as Qt,au as ki,X as Ei,V as Ri,a as Ai,o as Ni,h as Ci,t as z,K as Ti}from"./index-C3moojPl.js";import{u as Vi}from"./chat-context-Bdbu4aFj.js";import{u as In}from"./use-new-blocks-editor-Cz0Ycsmz.js";import{J as Mi,K as Di,N as Pi,O as Ki,Q as Ii,T as Bi,U as Fi,V as Li,W as Oi,X as kr,Y as $i,Z as zi,G as jt,_ as vt,$ as ze,a0 as Hi,H as Tn,E as Vn,e as Wi,f as Gi,j as qi,u as Ui,a1 as Er,o as Yi,a2 as Ji,q as Qi,n as Xi,a3 as to,p as vn,a4 as Zi,a5 as ea,C as Rr,a6 as ta,a7 as na,a8 as Nn,a9 as Ar,aa as Nr,ab as Cr,ac as ss,ad as sa,ae as ra,F as oa,af as Tr,ag as ia,ah as Vr,ai as Mr,M as aa,aj as Dr,d as la,ak as mn,al as ca,am as ua,an as pn,ao as da}from"./runnable-block-editor-BfWUQRiS.js";import{c as fa}from"./repository-binding-CPA8-dMz.js";import{n as ma,t as pa}from"./ChevronUp-QaPEzxVx.js";import{a6 as no,d as Pn,ak as ha,C as ga,$ as Pr,K as Kr}from"./agent-icon-DjnOmCBc.js";import{S as Xt}from"./scroll-area-BJew8KVi.js";import{b as wt,T as _t,a as kt}from"./tooltip-B7gx1fFf.js";import{m as va,u as xa,P as ya}from"./mustache-BlQTgv16.js";import{au as so,c as xs,av as ro,G as ba,aw as pt,ax as ls,ay as oo,ak as Ot,a8 as cs,az as us,al as Mt,a9 as Zt,j as Sa,l as ja,g as wa,r as Cn,ao as _a,aj as hn,aa as rs,ai as Vt,ah as gn,aA as ka,K as Ea,aB as Ra,am as Ir,a2 as Br,aC as Aa,aD as Lt,aE as Na,aF as Ca,aG as Ta,aH as Fr,aI as Va,aJ as Ma,aK as Da,ag as Pa,aL as Ka,aM as Ia,aN as Ba,X as Fa,aO as La,af as Oa,aP as $a}from"./claim-phase-copy-CNoIfrVp.js";import{a as za}from"./Copy01-YTn6AAPK.js";import{a as ds,e as io}from"./UserSquare-CLXjlx3Y.js";import{i as Lr}from"./Tool01-C9pjFqwV.js";import{s as Or}from"./Image01-Bpynux_N.js";import{s as Ha}from"./Plus-BKb3EUuT.js";import{s as Wa}from"./Trash01-BO35Cov_.js";import{i as fs}from"./ZoomOut-DLs2h_6j.js";import{u as Ga,a as $r,K as qa,P as Ua,b as Ya,C as Ja,D as Qa,c as Xa}from"./core.esm-CAijLSig.js";import{u as Za,s as el,a as Mn,S as tl,v as nl}from"./sortable.esm-DMnnxTnV.js";import{A as zr}from"./avatar-BQ1clUOI.js";import{e as sl,d as Hr,b as rl,A as ol,a as il,f as al}from"./alert-dialog-DLvf9XpO.js";import{d as ll}from"./shell-layout-es79-GX2.js";import{a as cl,P as Wr,b as ul}from"./page-seo-form-CY1JVNQO.js";import{u as dl,A as fl}from"./use-section-preview-base-C_HnXvmD.js";import{b as Gr,a as ml}from"./variant-matcher-override-cnXBxn5m.js";import"./use-panel-navigate-BSNsfU5E.js";import"./thread-route-CV6SbsTq.js";import"./use-project-scope-B0llZYB3.js";import"./autosend-BxzE8tXY.js";import"./thread-intent-CJ-s3I0o.js";import"./use-mcp-client-CaTe2ylT.js";import"./auth-C11WExuf.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./watch-sse-pool-BBIuBzhf.js";import"./task-board-B3rwHKUr.js";import"./schema-DyDDwNs8.js";import"./slugify-CEUa2lfQ.js";import"./use-decopilot-events-DTg4q8xq.js";import"./use-ai-providers-BuM6ovEv.js";import"./use-chat-navigation-CtLOIOM3.js";import"./location-BjlyegC2.js";import"./use-organization-settings-DYBuXxZf.js";import"./input-C8o95ZIl.js";import"./usage-stats-CmZMkNV4.js";import"./tool-namespace-BNEevFqW.js";import"./form-BRZ5DZiG.js";import"./label-C-C9Ou_x.js";import"./utils-CVEq3hMx.js";import"./markdown-BUXU5oD6.js";import"./use-copy-DQJK1-Md.js";import"./use-mobile-CW5odOpu.js";import"./format-time-CjIPQhCN.js";import"./differenceInSeconds-C3x8sHUj.js";import"./XClose-CMdSy1nN.js";import"./icon-button-7qsU_2OV.js";import"./file-type-icon-BQzv7Wym.js";import"./chat-draft-CKhySLl4.js";import"./LinkBroken01-tO8JEBqa.js";import"./ArrowUp-AxzDl8Z3.js";import"./ShoppingBag01-D0kKEJuH.js";import"./Upload01-DJFAu4Mm.js";import"./AlertCircle-BgwifFMG.js";import"./select-DStdJ5GE.js";import"./index-BdQq_4o_.js";import"./index-DjXrdMkW.js";import"./ArrowLeft-BP0atRPX.js";import"./tabs-BmpbjUEc.js";import"./use-deco-credits-BXoQO4ZL.js";import"./toggle-group-OQufBZdd.js";import"./use-open-billing-url-Cp2-WoXr.js";import"./index-BXITXB61.js";import"./checkbox-B6gj5-qt.js";import"./ChevronSelectorVertical-B9RLS3HF.js";import"./Key01-ByMBFx-i.js";import"./SearchMd-BXSC0WTH.js";import"./ai-providers-logos-DD3qZ33J.js";import"./Monitor01-wrmGnmsX.js";import"./popover-P9zPzqJX.js";import"./drawer-CBMcEEQM.js";import"./input-Dy0JrrC0.js";import"./suggestion-lK-gfS31.js";import"./use-chat-layout-state-DSr0gtOa.js";import"./use-file-configs-yKzFEaLv.js";import"./site-slug-DebpOoQq.js";import"./use-mcp-prompts-CatolySn.js";import"./use-org-fs-CGkxTNmD.js";import"./useInfiniteQuery-Cogq3tDA.js";import"./infiniteQueryObserver-DMRptffd.js";import"./Link01-Zi8wbjzB.js";import"./question-004-sINsf4GQ.js";import"./use-members-DpzUOwzJ.js";import"./use-org-auth-client-BK9SNEwg.js";import"./feature-paywall-Hzw839qS.js";import"./plan-ladder-CBREr6Ld.js";import"./add-connection-dialog-DNMm7BIu.js";import"./collection-search-ji1JjZMn.js";import"./extract-connection-data-U1HCpmI2.js";import"./metadata-D72DunRR.js";import"./connection-BKamaNd5.js";import"./url-slug-yE9p_CBQ.js";import"./connection-card-VZBAZ1By.js";import"./connection-slug-CITJ0kGN.js";import"./integration-icon-CmzyrNbk.js";import"./textarea-BWzL69YC.js";import"./use-connection-CYbCdCg-.js";import"./connection-form-helpers-T_Ai4T1w.js";import"./authenticate-and-persist-oauth-DyuZVm6i.js";import"./mcp-oauth-L9MT2tEQ.js";import"./mcp-oauth-BkcOWs3t.js";import"./collection-tabs-C39YFQ2E.js";import"./badge-NHL6jQ7U.js";import"./use-infinite-scroll-bleQjS0V.js";import"./useSuspenseInfiniteQuery-BbeYvXgw.js";import"./use-task-board-events-BGOp2VgA.js";import"./Play-W6HcQ7l_.js";import"./sandbox-start-errors-BK_aDCyt.js";import"./pair-BL76LvR6.js";import"./collapsible-8Gh0baiT.js";import"./use-clock-tick-CjMIMPxr.js";import"./content-blocks-o63cs2vh.js";import"./mcp-app-renderer-DyZ3_ABn.js";import"./types-D-iizAZX.js";import"./omit-sandbox-map-jj4lCB2U.js";import"./sheet-DrnvYUkv.js";import"./use-navigate-to-agent-d5laMYnC.js";import"./use-thread-outputs-PMUX8yZJ.js";import"./command-CloMVJTp.js";import"./index-p5cxA0SC.js";import"./utils-B68PenDU.js";import"./monaco-editor-Cpw9JqW2.js";import"./editor-B4h2oI8R.js";import"./calendar-wJdw6sZE.js";import"./SwitchHorizontal01-CAC-8ZOB.js";import"./rich-text-link-control-CGRceWX2.js";import"./switch-Kct2nT2R.js";import"./view-mode-toggle-t5oMnsLw.js";import"./combobox-sJwovF14.js";import"./sandbox-url-D3mC8qhT.js";import"./DotsVertical-D1KewbnO.js";import"./search-input-iE4YnSAW.js";import"./use-debounced-value-gqRwYLiP.js";import"./asset-utils-RL-ZiBha.js";import"./sandbox-git-api-C7JbVL7R.js";import"./Building02-DDW-F58b.js";import"./CheckCircle-pe1RxSse.js";import"./CreditCard01-DPxzkwQY.js";import"./Globe04-Cq4nB1G2.js";import"./Sun-CfiICDcE.js";import"./User01-B7hPiYB7.js";import"./Users01-DxG-qkCG.js";import"./project-icon-Ds5KkwAm.js";import"./new-project-dialog-BLbuP-We.js";import"./repository-import-picker-DG4AirBH.js";import"./repository-picker-BfnPBGTa.js";import"./required-auth-layout-DqtVx04D.js";import"./use-org-sso-BFc5mu2c.js";import"./section-preview-url-7zfngvgW.js";function pl(n){return n.schema?.definitions??n.schema?.$defs??{}}function ao(n,e){const s=pl(e),i=s[btoa(n)];if(!i)return[];const l=[i];if(Array.isArray(i.allOf)){const d=i.allOf.find(h=>typeof h.$ref=="string")?.$ref;if(typeof d=="string"){const h=s[d.replace("#/definitions/","")];h&&l.push(h)}}return l}function hl(n,e){for(const s of ao(n,e)){const i=typeof s.image=="string"?s.image:void 0;if(i?.includes("{{{"))return i}}function gl(n,e){if(!e)return;const s=so(n);if(!s)return;const i=hl(s.resolveType,e);if(!i)return;const l=Mi(i,s.data);if(l)return Di(l)}const vl={escape:Pi};function xl(n,e){for(const s of ao(n,e)){const i=typeof s.title=="string"?s.title:void 0;if(i?.includes("{{"))return i}}function yl(n,e){if(!e)return;const s=so(n);if(s)try{const i=xl(s.resolveType,e);return i&&va.render(i,s.data,{},vl).trim()||void 0}catch{return}}function bl(n){const e=ft.c(13),{icon:s,label:i,className:l}=n;let d;e[0]!==l?(d=le("size-3.5",l),e[0]=l,e[1]=d):d=e[1];let h;e[2]!==s||e[3]!==d?(h=o.jsx(s,{className:d}),e[2]=s,e[3]=d,e[4]=h):h=e[4];let u;e[5]!==i||e[6]!==h?(u=o.jsx(_t,{asChild:!0,children:o.jsx("span",{role:"img","aria-label":i,className:"shrink-0 cursor-help",children:h})}),e[5]=i,e[6]=h,e[7]=u):u=e[7];let b;e[8]!==i?(b=o.jsx(kt,{className:"max-w-56",children:i}),e[8]=i,e[9]=b):b=e[9];let g;return e[10]!==u||e[11]!==b?(g=o.jsxs(wt,{children:[u,b]}),e[10]=u,e[11]=b,e[12]=g):g=e[12],g}const Sl="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 qr(n){return Array.from({length:n},(e,s)=>({id:crypto.randomUUID(),index:s}))}function lo(n){return n.map((e,s)=>({...e,index:s}))}function jl(n,e){if(e===n.length)return n;if(e<n.length)return lo(n.slice(0,e));const s=Array.from({length:e-n.length},(i,l)=>({id:crypto.randomUUID(),index:n.length+l}));return[...n,...s]}function co(n){const e=ft.c(44),{section:s,raw:i,meta:l,decofile:d}=n,h=Dt(),u=In(),b=s.isSavedBlock===!0,g=s.isMultivariate===!0;let k;e[0]!==l||e[1]!==i?(k=i&&l?gl(i,l):void 0,e[0]=l,e[1]=i,e[2]=k):k=e[2];const E=k;let U;e[3]!==l||e[4]!==g||e[5]!==i||e[6]!==b?(U=i&&l&&!b&&!g?yl(i,l):void 0,e[3]=l,e[4]=g,e[5]=i,e[6]=b,e[7]=U):U=e[7];const X=U;let F;e[8]!==d||e[9]!==l||e[10]!==i||e[11]!==s?(F=Oi(i,s,d,l),e[8]=d,e[9]=l,e[10]=i,e[11]=s,e[12]=F):F=e[12];const L=F;let f;e[13]!==g||e[14]!==i?.__resolveType?(f=!g&&xs(i?.__resolveType??""),e[13]=g,e[14]=i?.__resolveType,e[15]=f):f=e[15];const A=f,Y=b?Pn:g?no:io;let j;e[16]!==g||e[17]!==b?(j=b?{color:ba}:g?{color:"oklch(0.65 0.15 160)"}:void 0,e[16]=g,e[17]=b,e[18]=j):j=e[18];const H=j;let V;e[19]!==Y||e[20]!==u?(V=u?o.jsxs("span",{className:"relative size-4 shrink-0",children:[o.jsx(Y,{className:"absolute inset-0 size-4 text-muted-foreground transition-opacity group-hover:opacity-0 group-has-[:focus-visible]:opacity-0"}),o.jsx(zi,{"aria-hidden":!0,className:"absolute inset-0 size-4 opacity-0 transition-opacity group-hover:opacity-100 group-has-[:focus-visible]:opacity-100"})]}):o.jsx(ha,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[19]=Y,e[20]=u,e[21]=V):V=e[21];let v;e[22]!==E?(v=E&&o.jsx("img",{src:E,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded-[var(--studio-control-radius,var(--radius))] object-cover"}),e[22]=E,e[23]=v):v=e[23];let C;e[24]!==u||e[25]!==H?(C=!u&&o.jsx(ds,{className:"h-4 w-4 shrink-0",style:H}),e[24]=u,e[25]=H,e[26]=C):C=e[26];const x=u?"shrink":"flex-1",re=s.isHidden&&"line-through opacity-50";let P;e[27]!==re||e[28]!==x?(P=le("min-w-0 truncate text-sm font-medium",x,re),e[27]=re,e[28]=x,e[29]=P):P=e[29];const oe=X??s.label;let de;e[30]!==P||e[31]!==oe?(de=o.jsx("span",{className:P,children:oe}),e[30]=P,e[31]=oe,e[32]=de):de=e[32];let Z;e[33]!==A||e[34]!==u||e[35]!==L||e[36]!==h?(Z=u?o.jsxs(o.Fragment,{children:[A&&o.jsx(bl,{icon:fs,label:h("sectionsEditor.sectionList.asyncBadge"),className:"text-muted-foreground"}),L&&o.jsx(kr,{}),o.jsx("span",{className:"min-w-0 flex-1"})]}):L&&o.jsx(kr,{className:"absolute -right-0.5 -top-0.5"}),e[33]=A,e[34]=u,e[35]=L,e[36]=h,e[37]=Z):Z=e[37];let te;return e[38]!==de||e[39]!==Z||e[40]!==V||e[41]!==v||e[42]!==C?(te=o.jsxs(o.Fragment,{children:[V,v,C,de,Z]}),e[38]=de,e[39]=Z,e[40]=V,e[41]=v,e[42]=C,e[43]=te):te=e[43],te}const wl="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",_l="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 uo(n,e,s){if(s)return $i({selected:e});const i=n.isSavedBlock===!0,l=n.isMultivariate===!0;return le("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":i?wl:l?_l:"text-foreground/80 hover:bg-accent hover:text-accent-foreground")}function os(n,e){return le("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 kl(n){const e=ft.c(90),{section:s,raw:i,meta:l,decofile:d,sortableId:h,selected:u,onSelect:b,onDelete:g,onDuplicate:k,onMakeReusable:E,onToggleHidden:U,onToggleLazy:X,onAddVariant:F,onDetach:L}=n,f=Dt(),A=In(),Y=i?xs(i.__resolveType??""):!1,j=s.isHidden===!0,H=Y||j;let V;e[0]!==s?(V=ro(s),e[0]=s,e[1]=V):V=e[1];const v=V;let C;e[2]!==h?(C={id:h,animateLayoutChanges:Al},e[2]=h,e[3]=C):C=e[3];const{attributes:x,listeners:re,setNodeRef:P,transform:oe,isDragging:de}=Za(C);let Z;e[4]!==oe?(Z=Ja.Transform.toString(oe?{...oe,x:0}:null),e[4]=oe,e[5]=Z):Z=e[5];const te=de?0:void 0;let S;e[6]!==Z||e[7]!==te?(S={transform:Z,opacity:te},e[6]=Z,e[7]=te,e[8]=S):S=e[8];const W=S;let je;e[9]!==s?(je=Ii(s),e[9]=s,e[10]=je):je=e[10];const K=je,He="button",G=0;let Ee;e[11]!==b?(Ee=ee=>{(ee.key==="Enter"||ee.key===" ")&&(ee.preventDefault(),b())},e[11]=b,e[12]=Ee):Ee=e[12];const xe=de?"cursor-grabbing":"cursor-pointer";let Re;e[13]!==A||e[14]!==s||e[15]!==u||e[16]!==xe?(Re=le("touch-none transition-colors",xe,uo(s,u,A)),e[13]=A,e[14]=s,e[15]=u,e[16]=xe,e[17]=Re):Re=e[17];let Be;e[18]!==d||e[19]!==l||e[20]!==i||e[21]!==s?(Be=o.jsx(co,{section:s,raw:i,meta:l,decofile:d}),e[18]=d,e[19]=l,e[20]=i,e[21]=s,e[22]=Be):Be=e[22];const we=!A&&!s.isMultivariate&&o.jsxs(wt,{children:[o.jsx(_t,{asChild:!0,children:o.jsx(xt,{type:"button",variant:"ghost",size:"icon","aria-label":f(Y?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender"),className:le(os(H,Y)),onClick:ee=>{ee.stopPropagation(),X()},onPointerDown:Rl,children:o.jsx(fs,{className:le("h-3.5 w-3.5",Y&&"text-warning")})})}),o.jsx(kt,{side:"bottom",children:f(Y?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")})]}),ie=A?o.jsx(Bi,{label:f(j?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),active:j,onToggle:U,children:j?o.jsx(Lr,{className:"h-3.5 w-3.5"}):o.jsx(Or,{className:"h-3.5 w-3.5"})}):o.jsxs(wt,{children:[o.jsx(_t,{asChild:!0,children:o.jsx(xt,{type:"button",variant:"ghost",size:"icon","aria-label":f(j?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),className:le(os(H,j)),onClick:ee=>{ee.stopPropagation(),U()},onPointerDown:El,children:j?o.jsx(Lr,{className:"h-3.5 w-3.5"}):o.jsx(Or,{className:"h-3.5 w-3.5"})})}),o.jsx(kt,{side:"bottom",children:f(j?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection")})]}),B=Ei,O=Fi;let I;e[23]!==f?(I=f("sectionsEditor.sectionList.sectionActionsMenu"),e[23]=f,e[24]=I):I=e[24];const D=le(os(H,!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 Ce;e[25]!==O||e[26]!==I||e[27]!==D?(Ce=o.jsx(O,{label:I,classicClassName:D}),e[25]=O,e[26]=I,e[27]=D,e[28]=Ce):Ce=e[28];let Ye;e[29]!==A||e[30]!==Y||e[31]!==X||e[32]!==s.isMultivariate||e[33]!==f?(Ye=A&&!s.isMultivariate&&o.jsxs(o.Fragment,{children:[o.jsxs(Qt,{onClick:ee=>{ee.stopPropagation(),X()},children:[o.jsx(fs,{className:"h-4 w-4"}),f(Y?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")]}),o.jsx(ki,{})]}),e[29]=A,e[30]=Y,e[31]=X,e[32]=s.isMultivariate,e[33]=f,e[34]=Ye):Ye=e[34];let Je;e[35]!==k?(Je=ee=>{ee.stopPropagation(),k()},e[35]=k,e[36]=Je):Je=e[36];let tt;e[37]===Symbol.for("react.memo_cache_sentinel")?(tt=o.jsx(za,{className:"h-4 w-4"}),e[37]=tt):tt=e[37];let ne;e[38]!==f?(ne=f("sectionsEditor.sectionList.duplicateMenuItem"),e[38]=f,e[39]=ne):ne=e[39];let ye;e[40]!==Je||e[41]!==ne?(ye=o.jsxs(Qt,{onClick:Je,children:[tt,ne]}),e[40]=Je,e[41]=ne,e[42]=ye):ye=e[42];let Fe;e[43]!==A||e[44]!==v||e[45]!==F||e[46]!==f?(Fe=v&&o.jsxs(Qt,{className:le(!A&&Li),onClick:ee=>{ee.stopPropagation(),F()},children:[o.jsx(no,{className:"h-4 w-4"}),f("sectionsEditor.sectionList.addVariantMenuItem")]}),e[43]=A,e[44]=v,e[45]=F,e[46]=f,e[47]=Fe):Fe=e[47];let Te;e[48]!==A||e[49]!==K||e[50]!==E||e[51]!==f?(Te=K&&o.jsxs(Qt,{className:le(!A&&Sl),onClick:ee=>{ee.stopPropagation(),E()},children:[A?o.jsx(Pn,{className:"h-4 w-4"}):o.jsx(ds,{className:"h-4 w-4"}),f("sectionsEditor.sectionList.makeReusableMenuItem")]}),e[48]=A,e[49]=K,e[50]=E,e[51]=f,e[52]=Te):Te=e[52];let fe;e[53]!==A||e[54]!==L||e[55]!==s.isMultivariate||e[56]!==s.isSavedBlock||e[57]!==f?(fe=s.isSavedBlock===!0&&!s.isMultivariate&&o.jsxs(Qt,{onClick:ee=>{ee.stopPropagation(),L()},children:[A?o.jsx(io,{className:"h-4 w-4"}):o.jsx(ds,{className:"h-4 w-4"}),f("sectionsEditor.sectionList.detachMenuItem")]}),e[53]=A,e[54]=L,e[55]=s.isMultivariate,e[56]=s.isSavedBlock,e[57]=f,e[58]=fe):fe=e[58];let Ve;e[59]!==g?(Ve=ee=>{ee.stopPropagation(),g()},e[59]=g,e[60]=Ve):Ve=e[60];let Pe;e[61]===Symbol.for("react.memo_cache_sentinel")?(Pe=o.jsx(Wa,{className:"h-4 w-4"}),e[61]=Pe):Pe=e[61];let Qe;e[62]!==f?(Qe=f("sectionsEditor.sectionList.deleteMenuItem"),e[62]=f,e[63]=Qe):Qe=e[63];let Ae;e[64]!==Ve||e[65]!==Qe?(Ae=o.jsxs(Qt,{variant:"destructive",onClick:Ve,children:[Pe,Qe]}),e[64]=Ve,e[65]=Qe,e[66]=Ae):Ae=e[66];let We;e[67]!==Ye||e[68]!==ye||e[69]!==Fe||e[70]!==Te||e[71]!==fe||e[72]!==Ae?(We=o.jsxs(Ri,{align:"end",className:"w-44",children:[Ye,ye,Fe,Te,fe,Ae]}),e[67]=Ye,e[68]=ye,e[69]=Fe,e[70]=Te,e[71]=fe,e[72]=Ae,e[73]=We):We=e[73];let Le;e[74]!==B||e[75]!==Ce||e[76]!==We?(Le=o.jsxs(B,{children:[Ce,We]}),e[74]=B,e[75]=Ce,e[76]=We,e[77]=Le):Le=e[77];let Ge;return e[78]!==x||e[79]!==re||e[80]!==b||e[81]!==P||e[82]!==W||e[83]!==Re||e[84]!==Be||e[85]!==we||e[86]!==ie||e[87]!==Le||e[88]!==Ee?(Ge=o.jsxs("div",{ref:P,style:W,...x,...re,role:He,tabIndex:G,onClick:b,onKeyDown:Ee,className:Re,children:[Be,we,ie,Le]}),e[78]=x,e[79]=re,e[80]=b,e[81]=P,e[82]=W,e[83]=Re,e[84]=Be,e[85]=we,e[86]=ie,e[87]=Le,e[88]=Ee,e[89]=Ge):Ge=e[89],Ge}function El(n){return n.stopPropagation()}function Rl(n){return n.stopPropagation()}function Al(){return!1}function ms(n){const e=ft.c(11),{canAddSection:s,onAddSection:i,className:l,size:d}=n,h=Dt();let u;e[0]!==l?(u=le("w-full",l),e[0]=l,e[1]=u):u=e[1];const b=!s;let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx(Ha,{size:14}),e[2]=g):g=e[2];let k;e[3]!==h?(k=h("sectionsEditor.sectionList.addSectionButton"),e[3]=h,e[4]=k):k=e[4];let E;return e[5]!==i||e[6]!==d||e[7]!==u||e[8]!==b||e[9]!==k?(E=o.jsxs(xt,{type:"button",variant:"outline",size:d,className:u,disabled:b,onClick:i,children:[g,k]}),e[5]=i,e[6]=d,e[7]=u,e[8]=b,e[9]=k,e[10]=E):E=e[10],E}function Nl(n){const e=ft.c(101),{listKey:s,rawSections:i,sections:l,meta:d,decofile:h,selectedIndex:u,onSelect:b,onReorder:g,onDelete:k,onDuplicate:E,onMakeReusable:U,onToggleHidden:X,onToggleLazy:F,onAddVariant:L,onDetach:f,onAddSection:A,canAddSection:Y}=n,j=Y===void 0?!0:Y,H=Dt(),V=In();let v;e[0]!==l.length?(v=()=>qr(l.length),e[0]=l.length,e[1]=v):v=e[1];const[C,x]=w.useState(v),[re,P]=w.useState(null),[oe,de]=w.useState(s),[Z,te]=w.useState(l.length),S=w.useRef(!1);oe!==s?(de(s),te(l.length),x(qr(l.length))):Z!==l.length&&(te(l.length),x(nt=>jl(nt,l.length)));let W;e[2]===Symbol.for("react.memo_cache_sentinel")?(W={activationConstraint:{distance:8}},e[2]=W):W=e[2];let je;e[3]===Symbol.for("react.memo_cache_sentinel")?(je={coordinateGetter:el},e[3]=je):je=e[3];const K=Ga($r(Ua,W),$r(qa,je));let He;e[4]!==C?(He=C.map(Cl),e[4]=C,e[5]=He):He=e[5];const G=He;let Ee;e[6]===Symbol.for("react.memo_cache_sentinel")?(Ee=nt=>{P(String(nt.active.id))},e[6]=Ee):Ee=e[6];const xe=Ee;let Re;e[7]!==G||e[8]!==g?(Re=nt=>{P(null);const{active:se,over:pe}=nt;if(!pe||se.id===pe.id)return;const rt=G.indexOf(String(se.id)),ce=G.indexOf(String(pe.id));rt===-1||ce===-1||(x(it=>lo(Mn([...it],rt,ce))),S.current=!0,requestAnimationFrame(()=>{S.current=!1}),g?.(rt,ce))},e[7]=G,e[8]=g,e[9]=Re):Re=e[9];const Be=Re;let we;e[10]===Symbol.for("react.memo_cache_sentinel")?(we=()=>{P(null)},e[10]=we):we=e[10];const ie=we;let B,O,I,D,Ce,Ye,Je,tt,ne,ye,Fe,Te,fe,Ve,Pe;if(e[11]!==re||e[12]!==j||e[13]!==V||e[14]!==h||e[15]!==C||e[16]!==G||e[17]!==Be||e[18]!==d||e[19]!==A||e[20]!==L||e[21]!==k||e[22]!==f||e[23]!==E||e[24]!==U||e[25]!==b||e[26]!==X||e[27]!==F||e[28]!==i||e[29]!==l||e[30]!==u||e[31]!==K||e[32]!==H){Ve=Symbol.for("react.early_return_sentinel");e:{const nt=se=>{S.current||b(se)};if(e[48]!==re||e[49]!==j||e[50]!==V||e[51]!==C||e[52]!==A||e[53]!==i||e[54]!==l||e[55]!==H){const se=re?C.find(pe=>pe.id===re):null;if(D=se!=null?l[se.index]:null,I=se!=null?i[se.index]:void 0,C.length===0){let pe;e[59]!==H?(pe=H("sectionsEditor.sectionList.noSections"),e[59]=H,e[60]=pe):pe=e[60];let rt;e[61]!==pe?(rt=o.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:pe}),e[61]=pe,e[62]=rt):rt=e[62];const ce=rt;let it;e[63]!==j||e[64]!==V||e[65]!==ce||e[66]!==A?(it=V?ce:o.jsxs("div",{className:"space-y-2",children:[ce,o.jsx(ms,{canAddSection:j,onAddSection:A,size:"sm"})]}),e[63]=j,e[64]=V,e[65]=ce,e[66]=A,e[67]=it):it=e[67],Ve=it;break e}fe=le(se&&"cursor-grabbing"),e[48]=re,e[49]=j,e[50]=V,e[51]=C,e[52]=A,e[53]=i,e[54]=l,e[55]=H,e[56]=I,e[57]=D,e[58]=fe}else I=e[56],D=e[57],fe=e[58];O=Qa,tt=K,ne=Xa,ye=xe,Fe=Be,Te=ie,B=tl,Ye=G,Je=nl,Pe="space-y-1",Ce=C.map(se=>{const pe=l[se.index];return pe?o.jsx(kl,{sortableId:se.id,section:pe,raw:i[se.index],meta:d,decofile:h,selected:u===se.index,onSelect:()=>nt(se.index),onDelete:()=>k(se.index),onDuplicate:()=>E(se.index),onMakeReusable:()=>U(se.index),onToggleHidden:()=>X(se.index),onToggleLazy:()=>F(se.index),onAddVariant:()=>L(se.index),onDetach:()=>f(se.index)},se.id):null})}e[11]=re,e[12]=j,e[13]=V,e[14]=h,e[15]=C,e[16]=G,e[17]=Be,e[18]=d,e[19]=A,e[20]=L,e[21]=k,e[22]=f,e[23]=E,e[24]=U,e[25]=b,e[26]=X,e[27]=F,e[28]=i,e[29]=l,e[30]=u,e[31]=K,e[32]=H,e[33]=B,e[34]=O,e[35]=I,e[36]=D,e[37]=Ce,e[38]=Ye,e[39]=Je,e[40]=tt,e[41]=ne,e[42]=ye,e[43]=Fe,e[44]=Te,e[45]=fe,e[46]=Ve,e[47]=Pe}else B=e[33],O=e[34],I=e[35],D=e[36],Ce=e[37],Ye=e[38],Je=e[39],tt=e[40],ne=e[41],ye=e[42],Fe=e[43],Te=e[44],fe=e[45],Ve=e[46],Pe=e[47];if(Ve!==Symbol.for("react.early_return_sentinel"))return Ve;let Qe;e[68]!==Ce||e[69]!==Pe?(Qe=o.jsx("div",{className:Pe,children:Ce}),e[68]=Ce,e[69]=Pe,e[70]=Qe):Qe=e[70];let Ae;e[71]!==B||e[72]!==Ye||e[73]!==Je||e[74]!==Qe?(Ae=o.jsx(B,{items:Ye,strategy:Je,children:Qe}),e[71]=B,e[72]=Ye,e[73]=Je,e[74]=Qe,e[75]=Ae):Ae=e[75];let We;e[76]!==I||e[77]!==D||e[78]!==V||e[79]!==h||e[80]!==d?(We=D?o.jsx("div",{className:le("cursor-grabbing shadow-lg ring-1 ring-border/60",uo(D,!1,V)),children:o.jsx(co,{section:D,raw:I,meta:d,decofile:h})}):null,e[76]=I,e[77]=D,e[78]=V,e[79]=h,e[80]=d,e[81]=We):We=e[81];let Le;e[82]!==We?(Le=_i.createPortal(o.jsx(Ya,{dropAnimation:Ki,children:We}),document.body),e[82]=We,e[83]=Le):Le=e[83];let Ge;e[84]!==O||e[85]!==tt||e[86]!==ne||e[87]!==ye||e[88]!==Fe||e[89]!==Te||e[90]!==Ae||e[91]!==Le?(Ge=o.jsxs(O,{sensors:tt,collisionDetection:ne,onDragStart:ye,onDragEnd:Fe,onDragCancel:Te,children:[Ae,Le]}),e[84]=O,e[85]=tt,e[86]=ne,e[87]=ye,e[88]=Fe,e[89]=Te,e[90]=Ae,e[91]=Le,e[92]=Ge):Ge=e[92];let ee;e[93]!==j||e[94]!==V||e[95]!==A?(ee=!V&&o.jsx(ms,{canAddSection:j,onAddSection:A,size:"sm",className:"mt-2"}),e[93]=j,e[94]=V,e[95]=A,e[96]=ee):ee=e[96];let zt;return e[97]!==fe||e[98]!==Ge||e[99]!==ee?(zt=o.jsxs("div",{className:fe,children:[Ge,ee]}),e[97]=fe,e[98]=Ge,e[99]=ee,e[100]=zt):zt=e[100],zt}function Cl(n){return n.id}function is(n,e,s,i){if(!n||!e)return null;if(!e.isMultivariate)return jt(n,e,i)?.data??null;const l=pt(n,e),d=l?ls(l,vt)[s]:void 0;return d?oo(d.value,i)?.data??null:null}const Tl=50;function Vl(n,e){n.own.push(ze(e)),n.own.length>Tl&&n.own.shift()}function Ur(n,e){return n.own.includes(ze(e))}function Ml(n,e){const{sectionIndex:s,variantIndex:i,shown:l,next:d,sectionCount:h}=e;return n&&n.sectionIndex===s&&n.variantIndex===i&&n.emitted===l?(n.emitted=d,n):l?{sectionIndex:s,variantIndex:i,base:l,emitted:d,sectionCount:h,own:[ze(l)]}:null}function fo(n,e){return e!==null&&ze(n)!==ze(e)}function mo(n,e){return n.__resolveType!==e.__resolveType}function Dl(n,e,s,i){if(e.length===i)return"here";const l=ze(n),d=e.flatMap((h,u)=>u!==s&&h!==null&&ze(h)===l?[u]:[]);return d.length===1?d[0]:"unknown"}function Pl({merged:n,tracked:e,current:s,saved:i}){return!!n&&!!e&&s===e&&e.emitted===i}function Kl(n,e){return!!n&&!!e&&n.contains(e)}function ps(n){const e=[],s=hs("",n.ancestor,n.mine,n.theirs,e);return{...n,merged:s,pointers:e}}function hs(n,e,s,i,l){const d=(h,u)=>ze(h)===ze(u);if(d(s,i)||d(e,i))return s;if(d(e,s))return i;if(as(s)&&as(i)){const h=as(e)?e:{},u={},b=[...Object.keys(s),...Object.keys(i).filter(g=>!(g in s))];for(const g of b){const k=hs(`${n}/${g.replaceAll("~","~0").replaceAll("/","~1")}`,h[g],s[g],i[g],l);k!==void 0&&(u[g]=k)}return u}return Array.isArray(e)&&Array.isArray(s)&&Array.isArray(i)&&s.length===e.length&&i.length===e.length?e.map((h,u)=>hs(`${n}/${u}`,h,s[u],i[u],l)):(l.push(n),i)}function as(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}function Il(n,e){let s=n.merged;for(const i of n.pointers)e[i]==="mine"&&(s=Ol(s,i,$t(n.mine,i)));return s}function Bl(n,e){return Object.fromEntries(n.pointers.map(s=>[s,e]))}function po(n){return Bl(n,"mine")}function gs(n,e,s){const i=po(s);for(const l of s.pointers){const d=e[l];if(!d||!n.pointers.includes(l))continue;["mine","theirs"].every(u=>ze($t(n[u],l))===ze($t(s[u],l)))&&(i[l]=d)}return i}function ho(n,e,s={}){const i=e.pointers.filter(l=>!n.pointers.includes(l)||ze($t(n.theirs,l))!==ze($t(e.theirs,l)));return i.length===0?s:{...s,...Object.fromEntries(i.map(l=>[l,(s[l]??0)+1]))}}function Fl(n,e,s){if(!e||mo(n.plan.ancestor,e)||!fo(n.plan.theirs,e)||s(e))return null;const i=ps({...n.plan,theirs:e});return i.pointers.length===0?null:{plan:i,choices:gs(n.plan,n.choices,i),fresh:ho(n.plan,i,n.fresh)}}function Ll(n,e){return n.pointers.map(s=>({pointer:s,label:Hi(s,e),mine:$t(n.mine,s),theirs:$t(n.theirs,s),schema:$l(e??null,s)}))}function ys(n){return n.split("/").slice(1).map(e=>e.replaceAll("~1","/").replaceAll("~0","~"))}function $t(n,e){let s=n;for(const i of ys(e))if(Array.isArray(s))s=s[Number(i)];else if(s&&typeof s=="object")s=s[i];else return;return s}function Ol(n,e,s){const i=ys(e),l=(d,h)=>{if(h===i.length)return s;const u=i[h];if(Array.isArray(d)){const k=[...d];return k[Number(u)]=l(d[Number(u)],h+1),k}const b=d&&typeof d=="object"?{...d}:{},g=l(b[u],h+1);return g===void 0?delete b[u]:b[u]=g,b};return l(n,0)}function $l(n,e){let s=n;for(const i of ys(e)){if(!s)return null;s=/^\d+$/.test(i)&&!s.properties?.[i]?s.items:s.properties?.[i]}return s??null}const zl=/\.(png|jpe?g|gif|webp|avif|svg)(\?.*)?$/i,Yr=60,Hl=3;function go(n,e){return e?.format==="image-uri"?!0:n.startsWith("data:image/")||/^(https?:)?\/\//.test(n)&&zl.test(n)}function vs(n,e){if(!(e?.format==="rich-text"||e?.format==="rich-text-inline"||e?.format==="html"||/<\/?[a-z][^>]*>/i.test(n)))return n;const i=n.replace(/<br\s*\/?>/gi,`
|
|
1
|
+
import{c as ft,b as Dt,r as w,l as le,j as o,b1 as _i,B as xt,U as Qt,au as ki,X as Ei,V as Ri,a as Ai,o as Ni,h as Ci,t as z,K as Ti}from"./index-CRbDzsEl.js";import{u as Vi}from"./chat-context-NYUfgJBl.js";import{u as In}from"./use-new-blocks-editor-Enk3EEXi.js";import{J as Mi,K as Di,N as Pi,O as Ki,Q as Ii,T as Bi,U as Fi,V as Li,W as Oi,X as kr,Y as $i,Z as zi,G as jt,_ as vt,$ as ze,a0 as Hi,H as Tn,E as Vn,e as Wi,f as Gi,j as qi,u as Ui,a1 as Er,o as Yi,a2 as Ji,q as Qi,n as Xi,a3 as to,p as vn,a4 as Zi,a5 as ea,C as Rr,a6 as ta,a7 as na,a8 as Nn,a9 as Ar,aa as Nr,ab as Cr,ac as ss,ad as sa,ae as ra,F as oa,af as Tr,ag as ia,ah as Vr,ai as Mr,M as aa,aj as Dr,d as la,ak as mn,al as ca,am as ua,an as pn,ao as da}from"./runnable-block-editor-cJtvApNo.js";import{c as fa}from"./repository-binding-GEAUbB-O.js";import{n as ma,t as pa}from"./ChevronUp-ZSzJudc4.js";import{a6 as no,d as Pn,ak as ha,C as ga,$ as Pr,K as Kr}from"./agent-icon-CSrsRkkV.js";import{S as Xt}from"./scroll-area-BOuDQrjF.js";import{b as wt,T as _t,a as kt}from"./tooltip-3DBbiHrv.js";import{m as va,u as xa,P as ya}from"./mustache-BISt82Zb.js";import{au as so,c as xs,av as ro,G as ba,aw as pt,ax as ls,ay as oo,ak as Ot,a8 as cs,az as us,al as Mt,a9 as Zt,j as Sa,l as ja,g as wa,r as Cn,ao as _a,aj as hn,aa as rs,ai as Vt,ah as gn,aA as ka,K as Ea,aB as Ra,am as Ir,a2 as Br,aC as Aa,aD as Lt,aE as Na,aF as Ca,aG as Ta,aH as Fr,aI as Va,aJ as Ma,aK as Da,ag as Pa,aL as Ka,aM as Ia,aN as Ba,X as Fa,aO as La,af as Oa,aP as $a}from"./claim-phase-copy-Clje3zqq.js";import{a as za}from"./Copy01-CT9uxfj6.js";import{a as ds,e as io}from"./UserSquare-BG_D4lBt.js";import{i as Lr}from"./Tool01-D8RNlK5k.js";import{s as Or}from"./Image01-DUunwh52.js";import{s as Ha}from"./Plus-clvoB9-y.js";import{s as Wa}from"./Trash01-ByfCfoe2.js";import{i as fs}from"./ZoomOut-DJOChAz1.js";import{u as Ga,a as $r,K as qa,P as Ua,b as Ya,C as Ja,D as Qa,c as Xa}from"./core.esm-BaMzqjA4.js";import{u as Za,s as el,a as Mn,S as tl,v as nl}from"./sortable.esm-DcO5R1X-.js";import{A as zr}from"./avatar-CVhMMaTf.js";import{e as sl,d as Hr,b as rl,A as ol,a as il,f as al}from"./alert-dialog-Bq1vUmcb.js";import{d as ll}from"./shell-layout-BO31z5MQ.js";import{a as cl,P as Wr,b as ul}from"./page-seo-form-BI_Up050.js";import{u as dl,A as fl}from"./use-section-preview-base-7N5lxhPB.js";import{b as Gr,a as ml}from"./variant-matcher-override-BLuZbjc2.js";import"./use-panel-navigate-sjPSBICL.js";import"./thread-route-gGOzpjkp.js";import"./use-project-scope-B_oLVbNv.js";import"./autosend-Dbvfg9pv.js";import"./thread-intent-DTPz1weL.js";import"./use-mcp-client-BWo29jbN.js";import"./auth-Cf8kTvK7.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./watch-sse-pool-Bb7_5bsI.js";import"./task-board-Cq7KN9Yp.js";import"./schema-DCzFPjhQ.js";import"./slugify-CEUa2lfQ.js";import"./use-decopilot-events-D14uF_Cy.js";import"./use-ai-providers-scSugiQF.js";import"./use-chat-navigation-CpL4JFZX.js";import"./location-BjlyegC2.js";import"./use-organization-settings-C2COOtae.js";import"./input-XQLahzDk.js";import"./usage-stats-x-NR7rQ4.js";import"./tool-namespace-BsBj6Gec.js";import"./form-Bn1uWhLp.js";import"./label-BUw2LYOJ.js";import"./utils-CVEq3hMx.js";import"./markdown-CW257Zz5.js";import"./use-copy-DWNF2ghn.js";import"./use-mobile-BcwC7VU3.js";import"./format-time-CjIPQhCN.js";import"./differenceInSeconds-C3x8sHUj.js";import"./XClose-Ck0EFhGe.js";import"./icon-button-D9OpoKyB.js";import"./file-type-icon-hf5iGs8U.js";import"./chat-draft-BIT8lUsr.js";import"./LinkBroken01-BFW8MxYc.js";import"./ArrowUp-XUO4rGpO.js";import"./ShoppingBag01-C_AR4ZKW.js";import"./Upload01-BOzWcBO4.js";import"./AlertCircle-BBiRNTdE.js";import"./select-nSDsr0Zi.js";import"./index-BdQq_4o_.js";import"./index-DPPcuuZa.js";import"./ArrowLeft-DwPfX3sc.js";import"./tabs-D0ZapmHf.js";import"./use-deco-credits-DiTvJIB8.js";import"./toggle-group-CZ2TAUmo.js";import"./use-open-billing-url-B1MJm7M5.js";import"./index-m-B-HtFl.js";import"./checkbox-1mSDcatb.js";import"./ChevronSelectorVertical-Dc4zDElk.js";import"./Key01-Dy9XOW24.js";import"./SearchMd-Bg-9XsfQ.js";import"./ai-providers-logos-DD3qZ33J.js";import"./Monitor01-Cm6_ReiN.js";import"./popover-UZd_hI6l.js";import"./drawer-DWjMBwyf.js";import"./input-C8SbKhCo.js";import"./suggestion-D6_m0iRs.js";import"./use-chat-layout-state-n4Q3uYHD.js";import"./use-file-configs-BJG54sLn.js";import"./site-slug-DebpOoQq.js";import"./use-mcp-prompts-BmY4-dHy.js";import"./use-org-fs-BruBSf1P.js";import"./useInfiniteQuery-BBVki4Du.js";import"./infiniteQueryObserver-Dhuk-wHX.js";import"./Link01-BDbdWLwx.js";import"./question-004-sINsf4GQ.js";import"./use-members-BsPA0Ct2.js";import"./use-org-auth-client-sBWqKZAZ.js";import"./feature-paywall-D3P0r-v1.js";import"./plan-ladder-eppTKAOz.js";import"./add-connection-dialog-DhxH1mO6.js";import"./collection-search-JcNHcOFg.js";import"./extract-connection-data-BWH-Gguq.js";import"./metadata-D72DunRR.js";import"./connection-pgjV95kc.js";import"./url-slug-CVpOSHeG.js";import"./connection-card-CWkexnWw.js";import"./connection-slug-CITJ0kGN.js";import"./integration-icon-BELz_pOH.js";import"./textarea-DKdq_MAz.js";import"./use-connection--fjYRP_g.js";import"./schema-DxY623qB.js";import"./connection-form-helpers-W4yLfkzt.js";import"./authenticate-and-persist-oauth-CNIjDkAv.js";import"./mcp-oauth-DJzQquAH.js";import"./mcp-oauth-DcDGTHX8.js";import"./collection-tabs-CSZlwXCA.js";import"./badge-GBNejOns.js";import"./use-infinite-scroll-BPxCDDTo.js";import"./useSuspenseInfiniteQuery-DP1_6mso.js";import"./use-task-board-events-B4nYkYUb.js";import"./Play-DFfgxv2q.js";import"./sandbox-start-errors-BK_aDCyt.js";import"./pair-gT7Vn8Gp.js";import"./collapsible-CeMlXkLt.js";import"./use-clock-tick-X8apRSs5.js";import"./content-blocks-o63cs2vh.js";import"./mcp-app-renderer-1q9SfIz-.js";import"./types-DJQTaYxP.js";import"./omit-sandbox-map-jj4lCB2U.js";import"./sheet-Bg01hTvG.js";import"./use-navigate-to-agent-f1RDTOQU.js";import"./use-thread-outputs-CaENK2ep.js";import"./command-CJiwms5W.js";import"./index-4oHb6320.js";import"./utils-CoFqD39i.js";import"./monaco-editor-BuUSistE.js";import"./editor-D6w2Bb1A.js";import"./calendar-D4OoX9Wr.js";import"./SwitchHorizontal01-D8mpLNM6.js";import"./rich-text-link-control-Cyib9lpp.js";import"./switch-C2mEXqfo.js";import"./view-mode-toggle-DGF1qVNP.js";import"./combobox-B0RpAw2t.js";import"./sandbox-url-D3mC8qhT.js";import"./DotsVertical-CcRpaMtq.js";import"./search-input-DXojQXHS.js";import"./use-debounced-value-Db_6wQub.js";import"./asset-utils-D2JqsHLw.js";import"./sandbox-git-api-C7JbVL7R.js";import"./Building02-CFG818HY.js";import"./CheckCircle-BZiV5rFy.js";import"./CreditCard01-DCwoKma6.js";import"./Globe04-D88PtZSB.js";import"./Sun-Dzm8FpU3.js";import"./User01-VVR3ncLA.js";import"./Users01-BT5Jdc2I.js";import"./project-icon-CgRPdhMz.js";import"./new-project-dialog-CU6GK7Hi.js";import"./repository-import-picker-CGZicTtt.js";import"./repository-picker-ipWiqqIY.js";import"./required-auth-layout-B0JL0M-z.js";import"./use-org-sso-DQNJJVcp.js";import"./section-preview-url-7zfngvgW.js";function pl(n){return n.schema?.definitions??n.schema?.$defs??{}}function ao(n,e){const s=pl(e),i=s[btoa(n)];if(!i)return[];const l=[i];if(Array.isArray(i.allOf)){const d=i.allOf.find(h=>typeof h.$ref=="string")?.$ref;if(typeof d=="string"){const h=s[d.replace("#/definitions/","")];h&&l.push(h)}}return l}function hl(n,e){for(const s of ao(n,e)){const i=typeof s.image=="string"?s.image:void 0;if(i?.includes("{{{"))return i}}function gl(n,e){if(!e)return;const s=so(n);if(!s)return;const i=hl(s.resolveType,e);if(!i)return;const l=Mi(i,s.data);if(l)return Di(l)}const vl={escape:Pi};function xl(n,e){for(const s of ao(n,e)){const i=typeof s.title=="string"?s.title:void 0;if(i?.includes("{{"))return i}}function yl(n,e){if(!e)return;const s=so(n);if(s)try{const i=xl(s.resolveType,e);return i&&va.render(i,s.data,{},vl).trim()||void 0}catch{return}}function bl(n){const e=ft.c(13),{icon:s,label:i,className:l}=n;let d;e[0]!==l?(d=le("size-3.5",l),e[0]=l,e[1]=d):d=e[1];let h;e[2]!==s||e[3]!==d?(h=o.jsx(s,{className:d}),e[2]=s,e[3]=d,e[4]=h):h=e[4];let u;e[5]!==i||e[6]!==h?(u=o.jsx(_t,{asChild:!0,children:o.jsx("span",{role:"img","aria-label":i,className:"shrink-0 cursor-help",children:h})}),e[5]=i,e[6]=h,e[7]=u):u=e[7];let b;e[8]!==i?(b=o.jsx(kt,{className:"max-w-56",children:i}),e[8]=i,e[9]=b):b=e[9];let g;return e[10]!==u||e[11]!==b?(g=o.jsxs(wt,{children:[u,b]}),e[10]=u,e[11]=b,e[12]=g):g=e[12],g}const Sl="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 qr(n){return Array.from({length:n},(e,s)=>({id:crypto.randomUUID(),index:s}))}function lo(n){return n.map((e,s)=>({...e,index:s}))}function jl(n,e){if(e===n.length)return n;if(e<n.length)return lo(n.slice(0,e));const s=Array.from({length:e-n.length},(i,l)=>({id:crypto.randomUUID(),index:n.length+l}));return[...n,...s]}function co(n){const e=ft.c(44),{section:s,raw:i,meta:l,decofile:d}=n,h=Dt(),u=In(),b=s.isSavedBlock===!0,g=s.isMultivariate===!0;let k;e[0]!==l||e[1]!==i?(k=i&&l?gl(i,l):void 0,e[0]=l,e[1]=i,e[2]=k):k=e[2];const E=k;let U;e[3]!==l||e[4]!==g||e[5]!==i||e[6]!==b?(U=i&&l&&!b&&!g?yl(i,l):void 0,e[3]=l,e[4]=g,e[5]=i,e[6]=b,e[7]=U):U=e[7];const X=U;let F;e[8]!==d||e[9]!==l||e[10]!==i||e[11]!==s?(F=Oi(i,s,d,l),e[8]=d,e[9]=l,e[10]=i,e[11]=s,e[12]=F):F=e[12];const L=F;let f;e[13]!==g||e[14]!==i?.__resolveType?(f=!g&&xs(i?.__resolveType??""),e[13]=g,e[14]=i?.__resolveType,e[15]=f):f=e[15];const A=f,Y=b?Pn:g?no:io;let j;e[16]!==g||e[17]!==b?(j=b?{color:ba}:g?{color:"oklch(0.65 0.15 160)"}:void 0,e[16]=g,e[17]=b,e[18]=j):j=e[18];const H=j;let V;e[19]!==Y||e[20]!==u?(V=u?o.jsxs("span",{className:"relative size-4 shrink-0",children:[o.jsx(Y,{className:"absolute inset-0 size-4 text-muted-foreground transition-opacity group-hover:opacity-0 group-has-[:focus-visible]:opacity-0"}),o.jsx(zi,{"aria-hidden":!0,className:"absolute inset-0 size-4 opacity-0 transition-opacity group-hover:opacity-100 group-has-[:focus-visible]:opacity-100"})]}):o.jsx(ha,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[19]=Y,e[20]=u,e[21]=V):V=e[21];let v;e[22]!==E?(v=E&&o.jsx("img",{src:E,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded-[var(--studio-control-radius,var(--radius))] object-cover"}),e[22]=E,e[23]=v):v=e[23];let C;e[24]!==u||e[25]!==H?(C=!u&&o.jsx(ds,{className:"h-4 w-4 shrink-0",style:H}),e[24]=u,e[25]=H,e[26]=C):C=e[26];const x=u?"shrink":"flex-1",re=s.isHidden&&"line-through opacity-50";let P;e[27]!==re||e[28]!==x?(P=le("min-w-0 truncate text-sm font-medium",x,re),e[27]=re,e[28]=x,e[29]=P):P=e[29];const oe=X??s.label;let de;e[30]!==P||e[31]!==oe?(de=o.jsx("span",{className:P,children:oe}),e[30]=P,e[31]=oe,e[32]=de):de=e[32];let Z;e[33]!==A||e[34]!==u||e[35]!==L||e[36]!==h?(Z=u?o.jsxs(o.Fragment,{children:[A&&o.jsx(bl,{icon:fs,label:h("sectionsEditor.sectionList.asyncBadge"),className:"text-muted-foreground"}),L&&o.jsx(kr,{}),o.jsx("span",{className:"min-w-0 flex-1"})]}):L&&o.jsx(kr,{className:"absolute -right-0.5 -top-0.5"}),e[33]=A,e[34]=u,e[35]=L,e[36]=h,e[37]=Z):Z=e[37];let te;return e[38]!==de||e[39]!==Z||e[40]!==V||e[41]!==v||e[42]!==C?(te=o.jsxs(o.Fragment,{children:[V,v,C,de,Z]}),e[38]=de,e[39]=Z,e[40]=V,e[41]=v,e[42]=C,e[43]=te):te=e[43],te}const wl="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",_l="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 uo(n,e,s){if(s)return $i({selected:e});const i=n.isSavedBlock===!0,l=n.isMultivariate===!0;return le("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":i?wl:l?_l:"text-foreground/80 hover:bg-accent hover:text-accent-foreground")}function os(n,e){return le("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 kl(n){const e=ft.c(90),{section:s,raw:i,meta:l,decofile:d,sortableId:h,selected:u,onSelect:b,onDelete:g,onDuplicate:k,onMakeReusable:E,onToggleHidden:U,onToggleLazy:X,onAddVariant:F,onDetach:L}=n,f=Dt(),A=In(),Y=i?xs(i.__resolveType??""):!1,j=s.isHidden===!0,H=Y||j;let V;e[0]!==s?(V=ro(s),e[0]=s,e[1]=V):V=e[1];const v=V;let C;e[2]!==h?(C={id:h,animateLayoutChanges:Al},e[2]=h,e[3]=C):C=e[3];const{attributes:x,listeners:re,setNodeRef:P,transform:oe,isDragging:de}=Za(C);let Z;e[4]!==oe?(Z=Ja.Transform.toString(oe?{...oe,x:0}:null),e[4]=oe,e[5]=Z):Z=e[5];const te=de?0:void 0;let S;e[6]!==Z||e[7]!==te?(S={transform:Z,opacity:te},e[6]=Z,e[7]=te,e[8]=S):S=e[8];const W=S;let je;e[9]!==s?(je=Ii(s),e[9]=s,e[10]=je):je=e[10];const K=je,He="button",G=0;let Ee;e[11]!==b?(Ee=ee=>{(ee.key==="Enter"||ee.key===" ")&&(ee.preventDefault(),b())},e[11]=b,e[12]=Ee):Ee=e[12];const xe=de?"cursor-grabbing":"cursor-pointer";let Re;e[13]!==A||e[14]!==s||e[15]!==u||e[16]!==xe?(Re=le("touch-none transition-colors",xe,uo(s,u,A)),e[13]=A,e[14]=s,e[15]=u,e[16]=xe,e[17]=Re):Re=e[17];let Be;e[18]!==d||e[19]!==l||e[20]!==i||e[21]!==s?(Be=o.jsx(co,{section:s,raw:i,meta:l,decofile:d}),e[18]=d,e[19]=l,e[20]=i,e[21]=s,e[22]=Be):Be=e[22];const we=!A&&!s.isMultivariate&&o.jsxs(wt,{children:[o.jsx(_t,{asChild:!0,children:o.jsx(xt,{type:"button",variant:"ghost",size:"icon","aria-label":f(Y?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender"),className:le(os(H,Y)),onClick:ee=>{ee.stopPropagation(),X()},onPointerDown:Rl,children:o.jsx(fs,{className:le("h-3.5 w-3.5",Y&&"text-warning")})})}),o.jsx(kt,{side:"bottom",children:f(Y?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")})]}),ie=A?o.jsx(Bi,{label:f(j?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),active:j,onToggle:U,children:j?o.jsx(Lr,{className:"h-3.5 w-3.5"}):o.jsx(Or,{className:"h-3.5 w-3.5"})}):o.jsxs(wt,{children:[o.jsx(_t,{asChild:!0,children:o.jsx(xt,{type:"button",variant:"ghost",size:"icon","aria-label":f(j?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),className:le(os(H,j)),onClick:ee=>{ee.stopPropagation(),U()},onPointerDown:El,children:j?o.jsx(Lr,{className:"h-3.5 w-3.5"}):o.jsx(Or,{className:"h-3.5 w-3.5"})})}),o.jsx(kt,{side:"bottom",children:f(j?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection")})]}),B=Ei,O=Fi;let I;e[23]!==f?(I=f("sectionsEditor.sectionList.sectionActionsMenu"),e[23]=f,e[24]=I):I=e[24];const D=le(os(H,!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 Ce;e[25]!==O||e[26]!==I||e[27]!==D?(Ce=o.jsx(O,{label:I,classicClassName:D}),e[25]=O,e[26]=I,e[27]=D,e[28]=Ce):Ce=e[28];let Ye;e[29]!==A||e[30]!==Y||e[31]!==X||e[32]!==s.isMultivariate||e[33]!==f?(Ye=A&&!s.isMultivariate&&o.jsxs(o.Fragment,{children:[o.jsxs(Qt,{onClick:ee=>{ee.stopPropagation(),X()},children:[o.jsx(fs,{className:"h-4 w-4"}),f(Y?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")]}),o.jsx(ki,{})]}),e[29]=A,e[30]=Y,e[31]=X,e[32]=s.isMultivariate,e[33]=f,e[34]=Ye):Ye=e[34];let Je;e[35]!==k?(Je=ee=>{ee.stopPropagation(),k()},e[35]=k,e[36]=Je):Je=e[36];let tt;e[37]===Symbol.for("react.memo_cache_sentinel")?(tt=o.jsx(za,{className:"h-4 w-4"}),e[37]=tt):tt=e[37];let ne;e[38]!==f?(ne=f("sectionsEditor.sectionList.duplicateMenuItem"),e[38]=f,e[39]=ne):ne=e[39];let ye;e[40]!==Je||e[41]!==ne?(ye=o.jsxs(Qt,{onClick:Je,children:[tt,ne]}),e[40]=Je,e[41]=ne,e[42]=ye):ye=e[42];let Fe;e[43]!==A||e[44]!==v||e[45]!==F||e[46]!==f?(Fe=v&&o.jsxs(Qt,{className:le(!A&&Li),onClick:ee=>{ee.stopPropagation(),F()},children:[o.jsx(no,{className:"h-4 w-4"}),f("sectionsEditor.sectionList.addVariantMenuItem")]}),e[43]=A,e[44]=v,e[45]=F,e[46]=f,e[47]=Fe):Fe=e[47];let Te;e[48]!==A||e[49]!==K||e[50]!==E||e[51]!==f?(Te=K&&o.jsxs(Qt,{className:le(!A&&Sl),onClick:ee=>{ee.stopPropagation(),E()},children:[A?o.jsx(Pn,{className:"h-4 w-4"}):o.jsx(ds,{className:"h-4 w-4"}),f("sectionsEditor.sectionList.makeReusableMenuItem")]}),e[48]=A,e[49]=K,e[50]=E,e[51]=f,e[52]=Te):Te=e[52];let fe;e[53]!==A||e[54]!==L||e[55]!==s.isMultivariate||e[56]!==s.isSavedBlock||e[57]!==f?(fe=s.isSavedBlock===!0&&!s.isMultivariate&&o.jsxs(Qt,{onClick:ee=>{ee.stopPropagation(),L()},children:[A?o.jsx(io,{className:"h-4 w-4"}):o.jsx(ds,{className:"h-4 w-4"}),f("sectionsEditor.sectionList.detachMenuItem")]}),e[53]=A,e[54]=L,e[55]=s.isMultivariate,e[56]=s.isSavedBlock,e[57]=f,e[58]=fe):fe=e[58];let Ve;e[59]!==g?(Ve=ee=>{ee.stopPropagation(),g()},e[59]=g,e[60]=Ve):Ve=e[60];let Pe;e[61]===Symbol.for("react.memo_cache_sentinel")?(Pe=o.jsx(Wa,{className:"h-4 w-4"}),e[61]=Pe):Pe=e[61];let Qe;e[62]!==f?(Qe=f("sectionsEditor.sectionList.deleteMenuItem"),e[62]=f,e[63]=Qe):Qe=e[63];let Ae;e[64]!==Ve||e[65]!==Qe?(Ae=o.jsxs(Qt,{variant:"destructive",onClick:Ve,children:[Pe,Qe]}),e[64]=Ve,e[65]=Qe,e[66]=Ae):Ae=e[66];let We;e[67]!==Ye||e[68]!==ye||e[69]!==Fe||e[70]!==Te||e[71]!==fe||e[72]!==Ae?(We=o.jsxs(Ri,{align:"end",className:"w-44",children:[Ye,ye,Fe,Te,fe,Ae]}),e[67]=Ye,e[68]=ye,e[69]=Fe,e[70]=Te,e[71]=fe,e[72]=Ae,e[73]=We):We=e[73];let Le;e[74]!==B||e[75]!==Ce||e[76]!==We?(Le=o.jsxs(B,{children:[Ce,We]}),e[74]=B,e[75]=Ce,e[76]=We,e[77]=Le):Le=e[77];let Ge;return e[78]!==x||e[79]!==re||e[80]!==b||e[81]!==P||e[82]!==W||e[83]!==Re||e[84]!==Be||e[85]!==we||e[86]!==ie||e[87]!==Le||e[88]!==Ee?(Ge=o.jsxs("div",{ref:P,style:W,...x,...re,role:He,tabIndex:G,onClick:b,onKeyDown:Ee,className:Re,children:[Be,we,ie,Le]}),e[78]=x,e[79]=re,e[80]=b,e[81]=P,e[82]=W,e[83]=Re,e[84]=Be,e[85]=we,e[86]=ie,e[87]=Le,e[88]=Ee,e[89]=Ge):Ge=e[89],Ge}function El(n){return n.stopPropagation()}function Rl(n){return n.stopPropagation()}function Al(){return!1}function ms(n){const e=ft.c(11),{canAddSection:s,onAddSection:i,className:l,size:d}=n,h=Dt();let u;e[0]!==l?(u=le("w-full",l),e[0]=l,e[1]=u):u=e[1];const b=!s;let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx(Ha,{size:14}),e[2]=g):g=e[2];let k;e[3]!==h?(k=h("sectionsEditor.sectionList.addSectionButton"),e[3]=h,e[4]=k):k=e[4];let E;return e[5]!==i||e[6]!==d||e[7]!==u||e[8]!==b||e[9]!==k?(E=o.jsxs(xt,{type:"button",variant:"outline",size:d,className:u,disabled:b,onClick:i,children:[g,k]}),e[5]=i,e[6]=d,e[7]=u,e[8]=b,e[9]=k,e[10]=E):E=e[10],E}function Nl(n){const e=ft.c(101),{listKey:s,rawSections:i,sections:l,meta:d,decofile:h,selectedIndex:u,onSelect:b,onReorder:g,onDelete:k,onDuplicate:E,onMakeReusable:U,onToggleHidden:X,onToggleLazy:F,onAddVariant:L,onDetach:f,onAddSection:A,canAddSection:Y}=n,j=Y===void 0?!0:Y,H=Dt(),V=In();let v;e[0]!==l.length?(v=()=>qr(l.length),e[0]=l.length,e[1]=v):v=e[1];const[C,x]=w.useState(v),[re,P]=w.useState(null),[oe,de]=w.useState(s),[Z,te]=w.useState(l.length),S=w.useRef(!1);oe!==s?(de(s),te(l.length),x(qr(l.length))):Z!==l.length&&(te(l.length),x(nt=>jl(nt,l.length)));let W;e[2]===Symbol.for("react.memo_cache_sentinel")?(W={activationConstraint:{distance:8}},e[2]=W):W=e[2];let je;e[3]===Symbol.for("react.memo_cache_sentinel")?(je={coordinateGetter:el},e[3]=je):je=e[3];const K=Ga($r(Ua,W),$r(qa,je));let He;e[4]!==C?(He=C.map(Cl),e[4]=C,e[5]=He):He=e[5];const G=He;let Ee;e[6]===Symbol.for("react.memo_cache_sentinel")?(Ee=nt=>{P(String(nt.active.id))},e[6]=Ee):Ee=e[6];const xe=Ee;let Re;e[7]!==G||e[8]!==g?(Re=nt=>{P(null);const{active:se,over:pe}=nt;if(!pe||se.id===pe.id)return;const rt=G.indexOf(String(se.id)),ce=G.indexOf(String(pe.id));rt===-1||ce===-1||(x(it=>lo(Mn([...it],rt,ce))),S.current=!0,requestAnimationFrame(()=>{S.current=!1}),g?.(rt,ce))},e[7]=G,e[8]=g,e[9]=Re):Re=e[9];const Be=Re;let we;e[10]===Symbol.for("react.memo_cache_sentinel")?(we=()=>{P(null)},e[10]=we):we=e[10];const ie=we;let B,O,I,D,Ce,Ye,Je,tt,ne,ye,Fe,Te,fe,Ve,Pe;if(e[11]!==re||e[12]!==j||e[13]!==V||e[14]!==h||e[15]!==C||e[16]!==G||e[17]!==Be||e[18]!==d||e[19]!==A||e[20]!==L||e[21]!==k||e[22]!==f||e[23]!==E||e[24]!==U||e[25]!==b||e[26]!==X||e[27]!==F||e[28]!==i||e[29]!==l||e[30]!==u||e[31]!==K||e[32]!==H){Ve=Symbol.for("react.early_return_sentinel");e:{const nt=se=>{S.current||b(se)};if(e[48]!==re||e[49]!==j||e[50]!==V||e[51]!==C||e[52]!==A||e[53]!==i||e[54]!==l||e[55]!==H){const se=re?C.find(pe=>pe.id===re):null;if(D=se!=null?l[se.index]:null,I=se!=null?i[se.index]:void 0,C.length===0){let pe;e[59]!==H?(pe=H("sectionsEditor.sectionList.noSections"),e[59]=H,e[60]=pe):pe=e[60];let rt;e[61]!==pe?(rt=o.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:pe}),e[61]=pe,e[62]=rt):rt=e[62];const ce=rt;let it;e[63]!==j||e[64]!==V||e[65]!==ce||e[66]!==A?(it=V?ce:o.jsxs("div",{className:"space-y-2",children:[ce,o.jsx(ms,{canAddSection:j,onAddSection:A,size:"sm"})]}),e[63]=j,e[64]=V,e[65]=ce,e[66]=A,e[67]=it):it=e[67],Ve=it;break e}fe=le(se&&"cursor-grabbing"),e[48]=re,e[49]=j,e[50]=V,e[51]=C,e[52]=A,e[53]=i,e[54]=l,e[55]=H,e[56]=I,e[57]=D,e[58]=fe}else I=e[56],D=e[57],fe=e[58];O=Qa,tt=K,ne=Xa,ye=xe,Fe=Be,Te=ie,B=tl,Ye=G,Je=nl,Pe="space-y-1",Ce=C.map(se=>{const pe=l[se.index];return pe?o.jsx(kl,{sortableId:se.id,section:pe,raw:i[se.index],meta:d,decofile:h,selected:u===se.index,onSelect:()=>nt(se.index),onDelete:()=>k(se.index),onDuplicate:()=>E(se.index),onMakeReusable:()=>U(se.index),onToggleHidden:()=>X(se.index),onToggleLazy:()=>F(se.index),onAddVariant:()=>L(se.index),onDetach:()=>f(se.index)},se.id):null})}e[11]=re,e[12]=j,e[13]=V,e[14]=h,e[15]=C,e[16]=G,e[17]=Be,e[18]=d,e[19]=A,e[20]=L,e[21]=k,e[22]=f,e[23]=E,e[24]=U,e[25]=b,e[26]=X,e[27]=F,e[28]=i,e[29]=l,e[30]=u,e[31]=K,e[32]=H,e[33]=B,e[34]=O,e[35]=I,e[36]=D,e[37]=Ce,e[38]=Ye,e[39]=Je,e[40]=tt,e[41]=ne,e[42]=ye,e[43]=Fe,e[44]=Te,e[45]=fe,e[46]=Ve,e[47]=Pe}else B=e[33],O=e[34],I=e[35],D=e[36],Ce=e[37],Ye=e[38],Je=e[39],tt=e[40],ne=e[41],ye=e[42],Fe=e[43],Te=e[44],fe=e[45],Ve=e[46],Pe=e[47];if(Ve!==Symbol.for("react.early_return_sentinel"))return Ve;let Qe;e[68]!==Ce||e[69]!==Pe?(Qe=o.jsx("div",{className:Pe,children:Ce}),e[68]=Ce,e[69]=Pe,e[70]=Qe):Qe=e[70];let Ae;e[71]!==B||e[72]!==Ye||e[73]!==Je||e[74]!==Qe?(Ae=o.jsx(B,{items:Ye,strategy:Je,children:Qe}),e[71]=B,e[72]=Ye,e[73]=Je,e[74]=Qe,e[75]=Ae):Ae=e[75];let We;e[76]!==I||e[77]!==D||e[78]!==V||e[79]!==h||e[80]!==d?(We=D?o.jsx("div",{className:le("cursor-grabbing shadow-lg ring-1 ring-border/60",uo(D,!1,V)),children:o.jsx(co,{section:D,raw:I,meta:d,decofile:h})}):null,e[76]=I,e[77]=D,e[78]=V,e[79]=h,e[80]=d,e[81]=We):We=e[81];let Le;e[82]!==We?(Le=_i.createPortal(o.jsx(Ya,{dropAnimation:Ki,children:We}),document.body),e[82]=We,e[83]=Le):Le=e[83];let Ge;e[84]!==O||e[85]!==tt||e[86]!==ne||e[87]!==ye||e[88]!==Fe||e[89]!==Te||e[90]!==Ae||e[91]!==Le?(Ge=o.jsxs(O,{sensors:tt,collisionDetection:ne,onDragStart:ye,onDragEnd:Fe,onDragCancel:Te,children:[Ae,Le]}),e[84]=O,e[85]=tt,e[86]=ne,e[87]=ye,e[88]=Fe,e[89]=Te,e[90]=Ae,e[91]=Le,e[92]=Ge):Ge=e[92];let ee;e[93]!==j||e[94]!==V||e[95]!==A?(ee=!V&&o.jsx(ms,{canAddSection:j,onAddSection:A,size:"sm",className:"mt-2"}),e[93]=j,e[94]=V,e[95]=A,e[96]=ee):ee=e[96];let zt;return e[97]!==fe||e[98]!==Ge||e[99]!==ee?(zt=o.jsxs("div",{className:fe,children:[Ge,ee]}),e[97]=fe,e[98]=Ge,e[99]=ee,e[100]=zt):zt=e[100],zt}function Cl(n){return n.id}function is(n,e,s,i){if(!n||!e)return null;if(!e.isMultivariate)return jt(n,e,i)?.data??null;const l=pt(n,e),d=l?ls(l,vt)[s]:void 0;return d?oo(d.value,i)?.data??null:null}const Tl=50;function Vl(n,e){n.own.push(ze(e)),n.own.length>Tl&&n.own.shift()}function Ur(n,e){return n.own.includes(ze(e))}function Ml(n,e){const{sectionIndex:s,variantIndex:i,shown:l,next:d,sectionCount:h}=e;return n&&n.sectionIndex===s&&n.variantIndex===i&&n.emitted===l?(n.emitted=d,n):l?{sectionIndex:s,variantIndex:i,base:l,emitted:d,sectionCount:h,own:[ze(l)]}:null}function fo(n,e){return e!==null&&ze(n)!==ze(e)}function mo(n,e){return n.__resolveType!==e.__resolveType}function Dl(n,e,s,i){if(e.length===i)return"here";const l=ze(n),d=e.flatMap((h,u)=>u!==s&&h!==null&&ze(h)===l?[u]:[]);return d.length===1?d[0]:"unknown"}function Pl({merged:n,tracked:e,current:s,saved:i}){return!!n&&!!e&&s===e&&e.emitted===i}function Kl(n,e){return!!n&&!!e&&n.contains(e)}function ps(n){const e=[],s=hs("",n.ancestor,n.mine,n.theirs,e);return{...n,merged:s,pointers:e}}function hs(n,e,s,i,l){const d=(h,u)=>ze(h)===ze(u);if(d(s,i)||d(e,i))return s;if(d(e,s))return i;if(as(s)&&as(i)){const h=as(e)?e:{},u={},b=[...Object.keys(s),...Object.keys(i).filter(g=>!(g in s))];for(const g of b){const k=hs(`${n}/${g.replaceAll("~","~0").replaceAll("/","~1")}`,h[g],s[g],i[g],l);k!==void 0&&(u[g]=k)}return u}return Array.isArray(e)&&Array.isArray(s)&&Array.isArray(i)&&s.length===e.length&&i.length===e.length?e.map((h,u)=>hs(`${n}/${u}`,h,s[u],i[u],l)):(l.push(n),i)}function as(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}function Il(n,e){let s=n.merged;for(const i of n.pointers)e[i]==="mine"&&(s=Ol(s,i,$t(n.mine,i)));return s}function Bl(n,e){return Object.fromEntries(n.pointers.map(s=>[s,e]))}function po(n){return Bl(n,"mine")}function gs(n,e,s){const i=po(s);for(const l of s.pointers){const d=e[l];if(!d||!n.pointers.includes(l))continue;["mine","theirs"].every(u=>ze($t(n[u],l))===ze($t(s[u],l)))&&(i[l]=d)}return i}function ho(n,e,s={}){const i=e.pointers.filter(l=>!n.pointers.includes(l)||ze($t(n.theirs,l))!==ze($t(e.theirs,l)));return i.length===0?s:{...s,...Object.fromEntries(i.map(l=>[l,(s[l]??0)+1]))}}function Fl(n,e,s){if(!e||mo(n.plan.ancestor,e)||!fo(n.plan.theirs,e)||s(e))return null;const i=ps({...n.plan,theirs:e});return i.pointers.length===0?null:{plan:i,choices:gs(n.plan,n.choices,i),fresh:ho(n.plan,i,n.fresh)}}function Ll(n,e){return n.pointers.map(s=>({pointer:s,label:Hi(s,e),mine:$t(n.mine,s),theirs:$t(n.theirs,s),schema:$l(e??null,s)}))}function ys(n){return n.split("/").slice(1).map(e=>e.replaceAll("~1","/").replaceAll("~0","~"))}function $t(n,e){let s=n;for(const i of ys(e))if(Array.isArray(s))s=s[Number(i)];else if(s&&typeof s=="object")s=s[i];else return;return s}function Ol(n,e,s){const i=ys(e),l=(d,h)=>{if(h===i.length)return s;const u=i[h];if(Array.isArray(d)){const k=[...d];return k[Number(u)]=l(d[Number(u)],h+1),k}const b=d&&typeof d=="object"?{...d}:{},g=l(b[u],h+1);return g===void 0?delete b[u]:b[u]=g,b};return l(n,0)}function $l(n,e){let s=n;for(const i of ys(e)){if(!s)return null;s=/^\d+$/.test(i)&&!s.properties?.[i]?s.items:s.properties?.[i]}return s??null}const zl=/\.(png|jpe?g|gif|webp|avif|svg)(\?.*)?$/i,Yr=60,Hl=3;function go(n,e){return e?.format==="image-uri"?!0:n.startsWith("data:image/")||/^(https?:)?\/\//.test(n)&&zl.test(n)}function vs(n,e){if(!(e?.format==="rich-text"||e?.format==="rich-text-inline"||e?.format==="html"||/<\/?[a-z][^>]*>/i.test(n)))return n;const i=n.replace(/<br\s*\/?>/gi,`
|
|
2
2
|
`).replace(/<\/(p|div|li|h[1-6])>/gi,`
|
|
3
3
|
`);return Gl(i).replace(/\u00a0/g," ").replace(/\n{2,}/g,`
|
|
4
|
-
`).trim()}const Wl={" ":" ","&":"&","<":"<",">":">",""":'"',"'":"'"};function Gl(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=>Wl[s]??s)}function Dn(n){const e=n.replace(/\s+/g," ").trim();return e.length>Yr?`${e.slice(0,Yr-1)}…`:e}function ql(n){if(n.startsWith("data:"))return"image";const e=n.split(/[?#]/)[0]??n;return decodeURIComponent(e.split("/").pop()||n)}function Kn(n,e){if(n==null||n==="")return{kind:"empty"};if(typeof n=="string")return go(n,e)?{kind:"image",src:n}:{kind:"text",text:vs(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,Hl).map(i=>Ul(i,s)??"")}}if(typeof n=="object"){const s=n;if("value"in s&&Object.keys(s).length<=2)return Kn(s.value,e?.properties?.value??e);const i=Object.entries(s).filter(([l,d])=>!l.startsWith("__")&&d!==void 0).flatMap(([l,d])=>{const h=e?.properties?.[l]??null,u=Kn(d,h);if(u.kind==="empty")return[];const b=u.kind==="text"?Dn(u.text):u.kind==="image"?ql(u.src):u.kind==="yesNo"?u.value?"✓":"✗":u.kind==="list"?`${u.count}`:"…";return[{label:h?.title?.trim()||l,text:b}]}).slice(0,4);return i.length>0?{kind:"fields",entries:i}:{kind:"empty"}}return{kind:"text",text:String(n)}}function Ul(n,e){if(typeof n=="string")return Dn(vs(n,e));if(!n||typeof n!="object"||Array.isArray(n))return null;const s=n,i=e?.titleBy,l=i?s[i]:void 0;if(typeof l=="string"&&l.trim())return Dn(l);for(const[d,h]of Object.entries(s))if(!(d.startsWith("__")||typeof h!="string"||!h.trim())&&!go(h,e?.properties?.[d]??null))return Dn(vs(h,null));return null}const Jr=1500;function Yl(n,e){const s=n.split(/(\s+)/).filter(k=>k!==""),i=e.split(/(\s+)/).filter(k=>k!=="");if(s.length>Jr||i.length>Jr)return{mine:[{text:n,kind:"changed"}],theirs:[{text:e,kind:"changed"}]};const l=Array.from({length:s.length+1},()=>new Array(i.length+1).fill(0));for(let k=s.length-1;k>=0;k--)for(let E=i.length-1;E>=0;E--){const U=l[k];U[E]=s[k]===i[E]?l[k+1][E+1]+1:Math.max(l[k+1][E],U[E+1])}const d=[],h=[],u=(k,E,U)=>{const X=k.at(-1);X&&(X.kind===U||U==="same"&&!E.trim())?X.text+=E:k.push({text:E,kind:U})};let b=0,g=0;for(;b<s.length&&g<i.length;)s[b]===i[g]?(u(d,s[b],"same"),u(h,i[g],"same"),b++,g++):l[b+1][g]>=l[b][g+1]?(u(d,s[b],"changed"),b++):(u(h,i[g],"changed"),g++);for(;b<s.length;b++)u(d,s[b],"changed");for(;g<i.length;g++)u(h,i[g],"changed");return{mine:d,theirs:h}}function Jl(n){const e=ft.c(10);let s,i;e[0]!==n?({open:s,...i}=n,e[0]=n,e[1]=s,e[2]=i):(s=e[1],i=e[2]);const{data:l}=Ai.useSession();let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=le("max-h-[85vh] grid-rows-[auto_minmax(0,1fr)_auto] sm:max-w-lg"),e[3]=d):d=e[3];const h=l?.user??null;let u;e[4]!==i||e[5]!==h?(u=o.jsx(sl,{className:d,"data-testid":"form-conflict-dialog",onEscapeKeyDown:Zl,onOpenAutoFocus:Xl,children:o.jsx(oc,{...i,viewer:h,heading:Ql})}),e[4]=i,e[5]=h,e[6]=u):u=e[6];let b;return e[7]!==s||e[8]!==u?(b=o.jsx(al,{open:s,children:u}),e[7]=s,e[8]=u,e[9]=b):b=e[9],b}function Ql(n,e){return o.jsxs(rl,{className:"text-left",children:[o.jsx(ol,{children:n}),o.jsx(il,{children:e})]})}function Xl(n){n.preventDefault(),n.currentTarget?.focus()}function Zl(n){return n.preventDefault()}const ec={},tc=(n,e)=>o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx("h2",{className:"text-lg font-semibold",children:n}),o.jsx("p",{className:"text-sm text-muted-foreground",children:e})]});function nc(n,e,s=0,i={}){const l=e[Math.min(s,e.length-1)],d={field:l?rc(l.label):"",label:l?.label??""};return e.length<=1?{title:n("sectionsEditor.formConflict.titleOne",d),description:n("sectionsEditor.formConflict.descriptionOne")}:{title:n("sectionsEditor.formConflict.titleStep",d),description:s>=e.length-1?o.jsx(sc,{t:n,fields:e,choices:i}):n("sectionsEditor.formConflict.descriptionStep")}}function sc(n){const e=ft.c(9),{t:s,fields:i,choices:l}=n;let d;if(e[0]!==l||e[1]!==i||e[2]!==s){let u;e[4]!==l||e[5]!==s?(u=(b,g)=>o.jsxs(w.Fragment,{children:[g>0&&" · ",`${b.label}: `,o.jsx("span",{className:"font-medium text-foreground",children:s((l[b.pointer]??"mine")==="mine"?"sectionsEditor.formConflict.summaryYours":"sectionsEditor.formConflict.summaryTheirs")})]},b.pointer),e[4]=l,e[5]=s,e[6]=u):u=e[6],d=i.map(u),e[0]=l,e[1]=i,e[2]=s,e[3]=d}else d=e[3];let h;return e[7]!==d?(h=o.jsx("span",{"data-testid":"form-conflict-summary",children:d}),e[7]=d,e[8]=h):h=e[8],h}function rc(n){return/^[A-Z][a-z]/.test(n)&&!n.includes("›")?n.charAt(0).toLowerCase()+n.slice(1):n}function oc(n){const e=ft.c(68),s=Dt(),{fields:i,choices:l,changedAgain:d,fresh:h,heading:u}=n,b=d===void 0?!1:d,g=h===void 0?ec:h,k=u===void 0?tc:u,E=i.length>1,[U,X]=w.useState(0),[F,L]=w.useState(ic);let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f={},e[0]=f):f=e[0];const[A,Y]=w.useState(f),j=Math.max(0,Math.min(U,i.length-1)),H=i[j],V=j===i.length-1;let v;e[1]!==j||e[2]!==i||e[3]!==g?(v=we=>{const ie=i[j],B=i[we];!ie||!B||we===j||(L(O=>new Set(O).add(ie.pointer)),Y(O=>({...O,[ie.pointer]:g[ie.pointer]??0,[B.pointer]:g[B.pointer]??0})),X(we))},e[1]=j,e[2]=i,e[3]=g,e[4]=v):v=e[4];const C=v;let x;e[5]!==j||e[6]!==C?(x=we=>{if(!we)return;const ie=B=>{const O={ArrowLeft:-1,ArrowRight:1}[B.key];!O||B.defaultPrevented||B.altKey||B.ctrlKey||B.metaKey||B.shiftKey||ll(B.target)||(B.preventDefault(),C(j+O))};return we.ownerDocument.addEventListener("keydown",ie),()=>we.ownerDocument.removeEventListener("keydown",ie)},e[5]=j,e[6]=C,e[7]=x):x=e[7];const re=x;if(!H)return null;let P,oe,de,Z,te;if(e[8]!==F||e[9]!==j||e[10]!==l||e[11]!==i||e[12]!==g||e[13]!==C||e[14]!==k||e[15]!==re||e[16]!==E||e[17]!==n||e[18]!==A||e[19]!==s){const{title:we,description:ie}=nc(s,i,j,l);let B;e[25]!==n?(B=O=>{O.detail>1||n.onApply()},e[25]=n,e[26]=B):B=e[26],P=B,oe=E?re:void 0,de="flex min-w-0 flex-col gap-3",e[27]!==F||e[28]!==j||e[29]!==i||e[30]!==g||e[31]!==C||e[32]!==E||e[33]!==A||e[34]!==s?(Z=E&&o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx("div",{role:"group","aria-label":s("sectionsEditor.formConflict.steps"),className:"-m-1 flex flex-wrap items-center",children:i.map((O,I)=>{const D=I!==j&&(g[O.pointer]??0)>(A[O.pointer]??0);return o.jsx("button",{type:"button","aria-label":D?s("sectionsEditor.formConflict.stepChangedAgain",{label:O.label}):O.label,"aria-current":I===j?"step":void 0,"data-answered":I!==j&&F.has(O.pointer)?"":void 0,"data-changed-again":D?"":void 0,onClick:()=>C(I),className:"group cursor-pointer rounded-full p-1 outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:o.jsx("span",{className:le("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")})},O.pointer)})}),o.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:s("sectionsEditor.formConflict.stepCount",{step:String(j+1),count:String(i.length)})})]}),e[27]=F,e[28]=j,e[29]=i,e[30]=g,e[31]=C,e[32]=E,e[33]=A,e[34]=s,e[35]=Z):Z=e[35],te=k(we,ie),e[8]=F,e[9]=j,e[10]=l,e[11]=i,e[12]=g,e[13]=C,e[14]=k,e[15]=re,e[16]=E,e[17]=n,e[18]=A,e[19]=s,e[20]=P,e[21]=oe,e[22]=de,e[23]=Z,e[24]=te}else P=e[20],oe=e[21],de=e[22],Z=e[23],te=e[24];let S;e[36]!==oe||e[37]!==de||e[38]!==Z||e[39]!==te?(S=o.jsxs("div",{ref:oe,className:de,children:[Z,te]}),e[36]=oe,e[37]=de,e[38]=Z,e[39]=te,e[40]=S):S=e[40];const W=!b&&"sr-only";let je;e[41]!==W?(je=le("text-sm text-muted-foreground",W),e[41]=W,e[42]=je):je=e[42];let K;e[43]!==b||e[44]!==E||e[45]!==s?(K=b?s(E?"sectionsEditor.formConflict.changedAgainSteps":"sectionsEditor.formConflict.changedAgain"):"",e[43]=b,e[44]=E,e[45]=s,e[46]=K):K=e[46];let He;e[47]!==je||e[48]!==K?(He=o.jsx("p",{role:"status",className:je,children:K}),e[47]=je,e[48]=K,e[49]=He):He=e[49];const G=E?"vertical":"all";let Ee;e[50]!==H||e[51]!==n||e[52]!==G?(Ee=o.jsx(uc,{field:H,...n,arrows:G}),e[50]=H,e[51]=n,e[52]=G,e[53]=Ee):Ee=e[53];let xe;e[54]!==He||e[55]!==Ee?(xe=o.jsxs("div",{className:"-mx-2 flex min-h-0 flex-col gap-3 overflow-y-auto px-2 py-1",children:[He,Ee]}),e[54]=He,e[55]=Ee,e[56]=xe):xe=e[56];let Re;e[57]!==P||e[58]!==j||e[59]!==C||e[60]!==V||e[61]!==E||e[62]!==s?(Re=E?o.jsxs(Hr,{className:"flex-row flex-wrap items-center justify-between gap-2 sm:justify-between",children:[o.jsx(xt,{type:"button",variant:"outline","aria-disabled":j===0,onClick:()=>C(j-1),className:"aria-disabled:cursor-default aria-disabled:opacity-45",children:s("sectionsEditor.formConflict.back")}),o.jsx(xt,{type:"button","data-testid":"form-conflict-primary",onClick:V?P:()=>C(j+1),children:s(V?"sectionsEditor.formConflict.ok":"sectionsEditor.formConflict.next")})]}):o.jsx(Hr,{className:"items-center gap-2",children:o.jsx(xt,{type:"button","data-testid":"form-conflict-primary",onClick:P,children:s("sectionsEditor.formConflict.ok")})}),e[57]=P,e[58]=j,e[59]=C,e[60]=V,e[61]=E,e[62]=s,e[63]=Re):Re=e[63];let Be;return e[64]!==S||e[65]!==xe||e[66]!==Re?(Be=o.jsxs(o.Fragment,{children:[S,xe,Re]}),e[64]=S,e[65]=xe,e[66]=Re,e[67]=Be):Be=e[67],Be}function ic(){return new Set}function ac(n){const e=Kn(n.mine,n.schema),s=Kn(n.theirs,n.schema),i=e.kind==="text"&&s.kind==="text"?Yl(e.text,s.text):null;return l=>i?o.jsx(fc,{parts:i[l]}):o.jsx(pc,{preview:l==="mine"?e:s})}const lc={all:{ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1},vertical:{ArrowDown:1,ArrowUp:-1}};function cc(n,e){const s=lc[e][n.key];if(!s)return;const i=[...n.currentTarget.querySelectorAll('[role="radio"]')],l=i.indexOf(document.activeElement);if(l<0)return;n.preventDefault();const d=i[(l+s+i.length)%i.length];d?.focus(),d?.click()}function uc(n){const e=ft.c(59),{field:s,choices:i,viewer:l,onChoose:d,arrows:h}=n,u=Dt();let b,g,k,E,U,X,F,L,f,A,Y,j,H;if(e[0]!==h||e[1]!==i||e[2]!==s||e[3]!==d||e[4]!==u||e[5]!==l?.image||e[6]!==l?.name){const C=ac(s),x=i[s.pointer]??"mine";j="radiogroup",H=s.label,k="flex flex-col gap-2",e[20]!==h?(E=S=>cc(S,h),e[20]=h,e[21]=E):E=e[21];let re;e[22]!==s.pointer||e[23]!==d?(re=()=>d(s.pointer,"mine"),e[22]=s.pointer,e[23]=d,e[24]=re):re=e[24];const P=l?.image??void 0;let oe;e[25]!==u||e[26]!==l?.name?(oe=dc(l?.name)||u("sectionsEditor.formConflict.you"),e[25]=u,e[26]=l?.name,e[27]=oe):oe=e[27];let de;e[28]!==P||e[29]!==oe?(de=o.jsx(zr,{url:P,fallback:oe,shape:"circle",size:"sm",className:"text-xs"}),e[28]=P,e[29]=oe,e[30]=de):de=e[30];let Z;e[31]!==u?(Z=u("sectionsEditor.formConflict.you"),e[31]=u,e[32]=Z):Z=e[32];let te;e[33]!==u?(te=u("sectionsEditor.formConflict.yourVersionNotSaved"),e[33]=u,e[34]=te):te=e[34],U=o.jsx(Qr,{side:"mine",checked:x==="mine",onChoose:re,avatar:de,who:Z,meta:te,children:C("mine")}),b=Qr,g="theirs",X=x==="theirs",e[35]!==s.pointer||e[36]!==d?(F=()=>d(s.pointer,"theirs"),e[35]=s.pointer,e[36]=d,e[37]=F):F=e[37],e[38]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(zr,{url:"icon://user",fallback:"",muted:!0,shape:"circle",size:"sm"}),e[38]=L):L=e[38],e[39]!==u?(f=u("sectionsEditor.formConflict.someoneElse"),e[39]=u,e[40]=f):f=e[40],e[41]!==u?(A=u("sectionsEditor.formConflict.theirVersionSaved"),e[41]=u,e[42]=A):A=e[42],Y=C("theirs"),e[0]=h,e[1]=i,e[2]=s,e[3]=d,e[4]=u,e[5]=l?.image,e[6]=l?.name,e[7]=b,e[8]=g,e[9]=k,e[10]=E,e[11]=U,e[12]=X,e[13]=F,e[14]=L,e[15]=f,e[16]=A,e[17]=Y,e[18]=j,e[19]=H}else b=e[7],g=e[8],k=e[9],E=e[10],U=e[11],X=e[12],F=e[13],L=e[14],f=e[15],A=e[16],Y=e[17],j=e[18],H=e[19];let V;e[43]!==b||e[44]!==g||e[45]!==X||e[46]!==F||e[47]!==L||e[48]!==f||e[49]!==A||e[50]!==Y?(V=o.jsx(b,{side:g,checked:X,onChoose:F,avatar:L,who:f,meta:A,children:Y}),e[43]=b,e[44]=g,e[45]=X,e[46]=F,e[47]=L,e[48]=f,e[49]=A,e[50]=Y,e[51]=V):V=e[51];let v;return e[52]!==k||e[53]!==E||e[54]!==U||e[55]!==V||e[56]!==j||e[57]!==H?(v=o.jsxs("div",{role:j,"aria-label":H,className:k,onKeyDown:E,children:[U,V]}),e[52]=k,e[53]=E,e[54]=U,e[55]=V,e[56]=j,e[57]=H,e[58]=v):v=e[58],v}function dc(n){return(n??"").trim().split(/\s+/).filter(Boolean).slice(0,2).map(e=>e.charAt(0).toUpperCase()).join("")}function Qr(n){const e=ft.c(27),{side:s,checked:i,onChoose:l,avatar:d,who:h,meta:u,children:b}=n,g=w.useId(),k=`${g}-who`,E=`${g}-meta ${g}-value`,U=i?0:-1,X=i?"border-primary bg-primary/5 ring-1 ring-primary":"hover:bg-muted/50";let F;e[0]!==X?(F=le("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",X),e[0]=X,e[1]=F):F=e[1];const L=`${g}-who`;let f;e[2]!==L||e[3]!==h?(f=o.jsx("span",{id:L,className:"text-sm font-medium text-foreground",children:h}),e[2]=L,e[3]=h,e[4]=f):f=e[4];const A=`${g}-meta`;let Y;e[5]!==u||e[6]!==A?(Y=o.jsx("span",{id:A,children:u}),e[5]=u,e[6]=A,e[7]=Y):Y=e[7];let j;e[8]!==f||e[9]!==Y?(j=o.jsxs("span",{className:"flex flex-wrap items-baseline gap-x-1.5 text-xs text-muted-foreground",children:[f,Y]}),e[8]=f,e[9]=Y,e[10]=j):j=e[10];const H=`${g}-value`,V=`conflict-${s}`;let v;e[11]!==b||e[12]!==H||e[13]!==V?(v=o.jsx("span",{id:H,"data-testid":V,className:"min-w-0 text-sm",children:b}),e[11]=b,e[12]=H,e[13]=V,e[14]=v):v=e[14];let C;e[15]!==j||e[16]!==v?(C=o.jsxs("span",{className:"flex min-w-0 flex-col gap-1",children:[j,v]}),e[15]=j,e[16]=v,e[17]=C):C=e[17];let x;return e[18]!==d||e[19]!==i||e[20]!==l||e[21]!==k||e[22]!==C||e[23]!==E||e[24]!==U||e[25]!==F?(x=o.jsxs("button",{type:"button",role:"radio","aria-checked":i,"aria-labelledby":k,"aria-describedby":E,tabIndex:U,onClick:l,className:F,children:[d,C]}),e[18]=d,e[19]=i,e[20]=l,e[21]=k,e[22]=C,e[23]=E,e[24]=U,e[25]=F,e[26]=x):x=e[26],x}function fc(n){const e=ft.c(4),{parts:s}=n;let i;e[0]!==s?(i=s.map(mc),e[0]=s,e[1]=i):i=e[1];let l;return e[2]!==i?(l=o.jsx("span",{className:"whitespace-pre-wrap break-words",children:i}),e[2]=i,e[3]=l):l=e[3],l}function mc(n,e){return n.kind==="changed"?o.jsx("mark",{className:"rounded-sm bg-warning/20 px-0.5 text-foreground",children:n.text},e):o.jsx("span",{children:n.text},e)}function pc(n){const e=ft.c(29),{preview:s}=n,i=Dt();switch(s.kind){case"empty":{let l;e[0]!==i?(l=i("sectionsEditor.formConflict.empty"),e[0]=i,e[1]=l):l=e[1];let d;return e[2]!==l?(d=o.jsx("span",{className:"italic text-muted-foreground",children:l}),e[2]=l,e[3]=d):d=e[3],d}case"text":{let l;return e[4]!==s.text?(l=o.jsx("span",{className:"whitespace-pre-wrap break-words",children:s.text}),e[4]=s.text,e[5]=l):l=e[5],l}case"image":{let l;return e[6]!==s.src?(l=o.jsx("img",{src:s.src,alt:"",className:"max-h-24 max-w-full rounded border object-contain"}),e[6]=s.src,e[7]=l):l=e[7],l}case"yesNo":{const l=s.value?"sectionsEditor.formConflict.yes":"sectionsEditor.formConflict.no";let d;e[8]!==i||e[9]!==l?(d=i(l),e[8]=i,e[9]=l,e[10]=d):d=e[10];let h;return e[11]!==d?(h=o.jsx("span",{children:d}),e[11]=d,e[12]=h):h=e[12],h}case"list":{const l=s.count===1?"sectionsEditor.formConflict.oneItem":"sectionsEditor.formConflict.items",d=String(s.count);let h;e[13]!==i||e[14]!==l||e[15]!==d?(h=i(l,{count:d}),e[13]=i,e[14]=l,e[15]=d,e[16]=h):h=e[16];let u;e[17]!==h?(u=o.jsx("span",{className:"text-muted-foreground",children:h}),e[17]=h,e[18]=u):u=e[18];let b;e[19]!==s.count||e[20]!==s.items?(b=s.items.some(Boolean)&&o.jsxs("span",{className:"flex flex-col",children:[s.items.map(gc),s.count>s.items.length&&o.jsx("span",{children:"…"})]}),e[19]=s.count,e[20]=s.items,e[21]=b):b=e[21];let g;return e[22]!==u||e[23]!==b?(g=o.jsxs("span",{className:"flex flex-col gap-1",children:[u,b]}),e[22]=u,e[23]=b,e[24]=g):g=e[24],g}case"fields":{let l;e[25]!==s.entries?(l=s.entries.map(hc),e[25]=s.entries,e[26]=l):l=e[26];let d;return e[27]!==l?(d=o.jsx("dl",{className:"grid grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-0.5",children:l}),e[27]=l,e[28]=d):d=e[28],d}}}function hc(n){return o.jsxs("div",{className:"contents",children:[o.jsx("dt",{className:"text-muted-foreground",children:n.label}),o.jsx("dd",{className:"truncate",children:n.text})]},n.label)}function gc(n,e){return o.jsx("span",{className:"truncate",children:`${e+1}. ${n||"…"}`},e)}function vc(n,e,s,i){if(!n||typeof n!="object")return{kind:"error",reason:"no-matcher-rule"};const l=e.trim();if(!l)return Ot(n,s,i)?{kind:"inline",blockKey:n.__resolveType??"",inlinedRule:cs(n,s,i)}:{kind:"noop"};const d=us(n,s,i);if(!d)return{kind:"error",reason:"unreadable-rule"};if(d.blockKey)return{kind:"updateBlock",blockKey:d.blockKey,blockData:Mt(d.resolveType,d.data,l)};const h=Tn(l),u=Vn(h,s);return u?{kind:"error",reason:"invalid-block-id",message:u}:{kind:"createBlock",blockId:h,blockData:Mt(d.resolveType,d.data,l),reference:Zt(h)}}const Xr="section-form-stale-save",xc=3,yc=1e3;function Zr(n,e){const s=e.global&&e.pageKey?[{label:"Default",sections:[{__resolveType:e.pageKey}]}]:to(e.pageKey?n[e.pageKey]?.sections:void 0,n),i=Math.max(0,Math.min(e.pageVariantIndex,s.length-1)),l=s[i]?.sections??[];return{pageVariants:s,variantIndex:i,rawSections:l,parsedSections:vn(l,n)}}const eo=new WeakMap;let bc=0;function Sc(n){let e=eo.get(n);return e===void 0&&(e=++bc,eo.set(n,e)),e}function jf({orgSlug:n,virtualMcpId:e,branch:s,previewReady:i=!0,previewUrl:l,currentPath:d,activePageBlockKey:h=null,activeGlobalBlockKey:u=null,externalSelection:b,onSaved:g,initialEditSeo:k=!1,onExitSeo:E,onSelectRoot:U,onViewJsonFile:X,onFocusedBlockChange:F,onVariantPreviewOverride:L}){const f=Dt(),A=Vi(),Y=A?.taskId??null,j=i?{orgSlug:n,virtualMcpId:e,branch:s,threadId:Y,previewUrl:l}:null,[H,V]=w.useState([]),{data:v,isLoading:C}=Wi(j,{pollWhile:H.length>0}),{data:x,isLoading:re}=Gi(j),P=In(),oe=A?.virtualMcpId,Z=fa(oe===e?e:null)?.metadata?.siteSlug??null,te=dl({virtualMcpId:e,sandboxUrl:l}),[S,W]=w.useState(null),[je,K]=w.useState(null),[He,G]=w.useState(null),[Ee,xe]=w.useState(0),[Re,Be]=w.useState(void 0),[we,ie]=w.useState(null),[B,O]=w.useState(null),[I,D]=w.useState([]),Ce=w.useRef(null),[Ye,Je]=w.useState(I.length);Ye!==I.length&&(Je(I.length),requestAnimationFrame(()=>{Ce.current&&(Ce.current.scrollTop=0)}));const[tt,ne]=w.useState(0),[ye,Fe]=w.useState(null),[Te,fe]=w.useState(null),[Ve,Pe]=w.useState(null),[Qe,Ae]=w.useState(!1),[We,Le]=w.useState(!1),Ge=w.useRef(null),[ee,zt]=w.useState(!0),[nt,se]=w.useState(!1),[pe,rt]=w.useState(!1),[ce,it]=w.useState(k),[bs,Ss]=w.useState(k);k&&!bs&&(Ss(!0),it(!0),W(null),K(null),G(null),D([])),!k&&bs&&Ss(!1);const[vo,xn]=w.useState(null),[js,Bn]=w.useState(void 0),[ws,Pt]=w.useState([]),[_s,en]=w.useState(0),[Xe,at]=w.useState(0),[xo,Ze]=w.useState(null),[Ht,st]=w.useState(null),[ks,Es]=w.useState(null),yo=Ni(),bo=`${n}/${e}/${s}`,yn=qi({orgSlug:n,virtualMcpId:e,branch:s}),[So,jo]=w.useState(d),[wo,_o]=w.useState(h),[ko,Eo]=w.useState(u);(So!==d||wo!==h||ko!==u)&&(queueMicrotask(()=>yn.flush()),jo(d),_o(h),Eo(u),W(null),K(null),G(null),xe(0),ie(null),O(null),at(0),Ze(null),st(null),D([]),ne(t=>t+1),it(!1),xn(null),Bn(void 0),Pt([]),en(t=>t+1));const me=Ui({orgSlug:n,virtualMcpId:e,branch:s}),tn=la((t,r)=>{me.mutate({blockKey:t,data:r},{onSuccess:()=>g?.(),onError:a=>z.error(f("sectionsEditor.sectionsEditor.saveFailed",{error:a.message}))})}),bn=xa({orgSlug:n,virtualMcpId:e,branch:s}),[Wt,Gt]=w.useState(!1),J=w.useRef(null),qt=w.useRef(null),yt=w.useRef(null),bt=w.useRef(null),Fn=w.useRef({}),Kt=w.useRef(null),nn=w.useRef(!1),sn=w.useRef(!1),qe=w.useRef(new Map),rn=w.useRef(!1),ht=w.useRef([]),Ln=w.useRef(new WeakSet),Oe=w.useRef({rawSections:[],parsedSections:[],decofile:{},activePageKey:null,pageVariants:[],variantIndex:0,sectionVariantIndex:0,selectedSectionIndex:null}),[Rs,As]=w.useState(0),[Ro,Ao]=w.useState(0),[No,Co]=w.useState(null);if(!i||C||re)return o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(Ci,{className:"size-5 text-muted-foreground"})});if(!v||!x)return o.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:f("sectionsEditor.sectionsEditor.couldNotLoadSiteData")});const To=Sa(v),ae=!!u,he=ae?null:ja(To,d,h),_=ae?u:he?.key??null,On=ae&&u?v[u]:void 0,Ns=ae&&u&&On?wa(u,On):ae&&u?u:"",on=!ae&&_&&v[_]?v[_]:null,$n=ce&&v&&x&&_&&he?Er(v,{kind:"page",pageKey:_,pageName:String(he.name??""),path:String(he.path??"")},x):null,Vo=ce?on?.seo:void 0,Sn=js!==void 0?js:Vo,Mo=ce?Yi(Sn):void 0,Cs=$n?.seoTypeOptions??[],Ts=ce&&x?Ji(x):"",zn=vo??Mo??{},jn=ce&&$n?cl(zn,$n):null,Vs=ce&&jn&&Qi(Sn)?Cn(jn,x):null,Ms=ce?Xi(v,x)?.seoData:void 0,Ne=ae?[{label:"Default",sections:[{__resolveType:u}]}]:to(on?.sections,v??{}),mt=Ne.length>1,ge=Math.min(Ee,Ne.length-1),ot=Ne[ge],Q=ot?.sections??[],Me=vn(Q,v),Hn=!ae&&_a(on?.sections);if(ae&&u&&ks!==u){Es(u);const t=Q[0],r=Me[0];if(t&&r){W(0),at(0),D([]);const a=jt(t,r,v);a&&(K(a.data),G(a.resolveType),st(null),Ze(null))}}!ae&&ks!==null&&Es(null),Oe.current={rawSections:Q,parsedSections:Me,decofile:v??{},activePageKey:_,pageVariants:Ne,variantIndex:ge,sectionVariantIndex:Xe,selectedSectionIndex:S};const Do=()=>({multivariate:Hn,index:ge,variants:Ne.map(t=>({rule:t.rule}))}),Wn=(t,r)=>{if(!L)return;if(!_||!Hn||t.length<=1){L(null);return}const a=Gr(_,{multivariate:!0,index:r,variants:t},v,x);L(a.length>0?a:null)},Gn=L&&_&&Hn&&mt&&!C&&!re?_:null;if(Gn!==No&&(Co(Gn),Gn)){const t=Ne.map(a=>({rule:a.rule})),r=ge;queueMicrotask(()=>Wn(t,r))}const Ut=(t,r,a)=>{if(!L)return;if(!_){L(null);return}const c=Do(),m=Gr(_,c,v,x);if(!t||r<0){L(m.length>0?m:null);return}const y=ml({pageKey:_,page:c,sectionIndex:r,sectionLazy:Me[r]?.isLazy??!1,mvObj:t,selectedVariantIndex:a,decofile:v,meta:x}),p=[...m,...y];L(p.length>0?p:null)},St=(t,r,a,c=S??-1,m=!1)=>{const y=pt(t,r);if(!y){K(null),G(null),st(null),Ze(null),m&&Ut(null,c,a);return}const R=ls(y,vt)[a];if(!R){K(null),G(null),st(null),Ze(null),m&&Ut(null,c,a);return}const $=oo(R.value,v);K($?.data??null),G($?.resolveType??null);const{resolveType:N,formValue:T}=hn(R.rule,v,x??void 0);st(N),Ze(T),m&&Ut(y,c,a)},an=b?.index;if(b!==void 0&&(b?.seq??null)!==Re&&(Be(b?.seq??null),typeof an=="number")){const t=Q[an],r=Me[an];if(t&&r)if(W(an),at(0),D([]),ne(a=>a+1),r.isMultivariate)St(t,r,0,an);else{const a=jt(t,r,v);a?(K(a.data),G(a.resolveType)):(K(null),G(null)),st(null),Ze(null)}}if(Rs!==Ro){Ao(Rs);const t=S!==null?Q[S]:null,r=S!==null?Me[S]:null;if(t&&r&&S!==null)if(D([]),ne(a=>a+1),r.isMultivariate)St(t,r,Xe,S);else{const a=jt(t,r,v??{});K(a?.data??null),G(a?.resolveType??null)}}const lt=H[0];if(lt){const{formBase:t,target:r}=lt,a=Zr(v,r),c=t.sectionIndex,m=a.rawSections.length===t.sectionCount?is(a.rawSections[c],a.parsedSections[c],r.sectionVariantIndex,v):null,y=Fl(lt,m,p=>Ur(t,p));if(y){const R=[{...lt,...y,changedAgain:!0},...H.slice(1)];ht.current=R,V(R)}}const ln={orgSlug:n,virtualMcpId:e,branch:s,threadId:Y,previewUrl:l??void 0,siteSlug:Z},wn=He&&x?Cn(He,x):null,ct=(t,r)=>{if(!_)return;J.current&&(clearTimeout(J.current),J.current=null),qe.current.clear(),bt.current&&(clearTimeout(bt.current),bt.current=null),yt.current&&(clearTimeout(yt.current),yt.current=null);const a=mn(v,_,t,ge,Ne);me.mutate({blockKey:_,data:a},{onSuccess:()=>r?.onSuccess?.()??g?.(),onError:c=>{r?.onError?.(),z.error(f("sectionsEditor.sectionsEditor.saveFailed",{error:c.message}))}})},It=()=>{F?.(null),W(null),rt(!1),K(null),G(null),at(0),Ze(null),st(null),D([]),ne(t=>t+1)},Ds=()=>Kl(Ce.current,document.activeElement),qn=(t=f("sectionsEditor.sectionsEditor.blockChangedElsewhere"))=>{if(J.current&&(clearTimeout(J.current),J.current=null),qe.current.clear(),qt.current=null,z.error(t,{id:Xr}),Ds()){rn.current=!0;return}As(r=>r+1)},Ps=()=>{!rn.current||Ds()||ht.current.length>0||J.current!==null||nn.current||sn.current||qe.current.size>0||(rn.current=!1,As(t=>t+1))},Ks=()=>{rn.current&&setTimeout(Ps,0)},Is=t=>{qe.current.size!==0&&setTimeout(()=>{if(nn.current||sn.current)return;const r=[...qe.current.values()];qe.current.clear();for(const a of r)a()},t)},Po=t=>{const{activePageKey:r,variantIndex:a,sectionVariantIndex:c}=Oe.current,m=Kt.current;return{formBase:m?.sectionIndex===t&&m.variantIndex===c?m:null,pageKey:r,global:ae,pageVariantIndex:a,sectionVariantIndex:c,schema:wn}},cn=t=>{ht.current=t,V(t)},Ko=t=>{const r=ht.current,a=r.findIndex(y=>y.formBase===t.formBase),c=a>=0?r[a]:void 0,m=c?r.with(a,{...t,choices:gs(c.plan,c.choices,t.plan),fresh:ho(c.plan,t.plan,c.fresh),changedAgain:c.changedAgain||ze(c.plan.theirs)!==ze(t.plan.theirs)}):[...r,{...t,changedAgain:Ln.current.has(t.formBase)}];cn(m)},Bs=(t,r)=>{const a=ht.current,c=a.findIndex(p=>p.formBase===t),m=a[c];if(!m)return!1;if(ze(m.plan.mine)===ze(r))return!0;const y=ps({...m.plan,mine:r});if(y.pointers.length===0){const p=a.filter(R=>R!==m);return cn(p),!1}return cn(a.with(c,{...m,plan:y,choices:gs(m.plan,m.choices,y)})),!0},Io=t=>{const r=Oe.current;return r.selectedSectionIndex===t.formBase.sectionIndex&&r.activePageKey===t.target.pageKey&&r.variantIndex===t.target.pageVariantIndex&&r.sectionVariantIndex===t.target.sectionVariantIndex},Bo=()=>{const t=ht.current[0];if(!t)return null;const{formBase:r,target:a}=t;J.current&&qt.current?.sectionIndex===r.sectionIndex&&qt.current.sectionVariantIndex===a.sectionVariantIndex&&(clearTimeout(J.current),J.current=null,qt.current=null),qe.current.delete(`${a.pageKey}:${r.sectionIndex}:${a.sectionVariantIndex}`);const c=r.emitted;return c&&typeof c=="object"&&!Bs(r,c)&&un(c,r.sectionIndex,0,a),ht.current[0]??null},Fo=()=>{const t=ht.current[0],r=Bo();if(!r||!t||r.formBase!==t.formBase||r.plan.pointers.some(y=>!t.plan.pointers.includes(y)))return;const a=Il(r.plan,r.choices);cn(ht.current.slice(1));const{formBase:c,target:m}=r;c.base=r.plan.theirs,c.emitted=a,Ln.current.add(c),(Kt.current===c||Io(r))&&(Kt.current=c,K(a),ne(y=>y+1)),un(a,c.sectionIndex,0,m)},Lo=t=>{const[r,...a]=ht.current;r&&cn([{...r,choices:t},...a])},un=(t,r,a=0,c)=>{const m=c??Po(r),y=m.sectionVariantIndex,p=m.formBase,R=qt.current;J.current&&(clearTimeout(J.current),J.current=null,R&&(R.sectionIndex!==r||R.sectionVariantIndex!==y)&&R.write());const $=`${m.pageKey}:${r}:${y}`,N=()=>{if(nn.current||sn.current){qe.current.set($,N);return}const T=typeof t=="function"?t():t;if(p&&Bs(p,T))return;const M=Oe.current.decofile,{rawSections:ue,parsedSections:be,pageVariants:Ie,variantIndex:De}=Zr(M,m),Ue=m.pageKey,q=ue[r];if(!q)return;const ve=be[r];if(!ve)return;const _e=p?.base,$e=is(q,ve,y,M),dt=!!_e&&!!$e&&fo(_e,$e)&&!(p&&Ur(p,$e));if(dt&&_e&&$e){if(mo(_e,$e)){qn(f("sectionsEditor.sectionsEditor.sectionReplacedElsewhere"));return}const Se=ve.isSavedBlock?"here":Dl(_e,ue.map((ke,Tt)=>is(ke,be[Tt],y,M)),r,p?.sectionCount??ue.length);if(Se==="unknown"){qn(f("sectionsEditor.sectionsEditor.sectionReplacedElsewhere"));return}if(typeof Se=="number"&&p){p.sectionCount=ue.length,p.sectionIndex=Se,Kt.current===p&&W(Se),un(T,Se,a,m);return}}const et=dt&&_e&&$e?ps({ancestor:_e,mine:T,theirs:$e}):null;if(et&&et.pointers.length>0&&p){p.sectionCount=ue.length,Ko({plan:et,formBase:p,target:m,sectionIndex:r,choices:po(et),changedAgain:!1,fresh:{}});return}const gt=et?et.merged:null,Ct=gt??T,jr=Pl({merged:!!gt,tracked:p,current:Kt.current,saved:T});gt&&z.info(f("sectionsEditor.sectionsEditor.blockMergedWithOthers"),{id:Xr}),jr&&p&&(p.emitted=gt,K(gt));const ns=jr||!gt?Ct:T;p&&(p.base=ns,p.sectionCount=ue.length,Vl(p,ns));const wr={onSuccess:()=>{p&&Ln.current.delete(p),g?.()},onError:Se=>{if(p?.base===ns&&_e&&(p.base=_e),Se instanceof Fa){a<xc?(qe.current.delete($),sn.current=!0,setTimeout(()=>{sn.current=!1,un(()=>{const ke=p?.emitted;return ke&&typeof ke=="object"?ke:T},r,a+1,m),qe.current.delete($),Is(pn)},yc*2**a)):qn();return}z.error(f("sectionsEditor.sectionsEditor.saveFailed",{error:Se.message}))}},_r=Se=>{nn.current=!0;let ke=!1;me.mutateAsync(Se).then(()=>wr.onSuccess(),Tt=>{ke=!0,wr.onError(Tt)}).finally(()=>{nn.current=!1,Is(ke?pn:0),Ps()})};if(ve.isSavedBlock){const Se=da(q,ve);if(!Se)return;_r({blockKey:Se,data:Ct,..._e?{base:{value:gt?$e:_e}}:{},rebaseOnConflict:!1});return}if(!Ue)return;const An={...M[Ue]},Ft=[...ue];if(ve.isMultivariate){const Se=pt(q,ve);if(!Se||!Ue)return;const ke=Ba(Se,y,Ct);Ft[r]=Lt(q,ve,ke)}else if(ve.isHidden){const Se=xs(q.__resolveType),ke=Se?{...q.section}:{...q},Tt=Array.isArray(ke.variants)?[...ke.variants]:[];Tt[0]&&(Tt[0]={...Tt[0],value:Ct}),ke.variants=Tt,Se?Ft[r]={...q,section:ke}:Ft[r]=ke}else ve.isLazy?Ft[r]={...q,section:Ct}:Ft[r]=Ct;if(Ie.length>1){const Se=An.sections,ke=[...Se?.variants??[]];ke[De]&&(ke[De]={...ke[De],value:Ft}),An.sections={...Se,variants:ke}}else An.sections=Ft;_r({blockKey:Ue,data:An,rebaseOnConflict:!1})};qt.current={sectionIndex:r,sectionVariantIndex:y,write:N},J.current=setTimeout(()=>{J.current=null,N()},pn)},Oo=t=>{rn.current=!1,W(t),at(0),D([]),ne(m=>m+1);const r=Q[t],a=Me[t];if(F?.(a?.isSavedBlock?a.resolveType??null:null),!r||!a)return;if(a.isMultivariate){St(r,a,0,t);return}const c=jt(r,a,v);if(!c){K(null),G(null),st(null),Ze(null),Ut(null,t,0);return}K(c.data),G(c.resolveType),st(null),Ze(null),Ut(null,t,0)},Fs=t=>{const r=t;S!==null&&(Kt.current=Ml(Kt.current,{sectionIndex:S,variantIndex:Oe.current.sectionVariantIndex,shown:je,next:r,sectionCount:Oe.current.rawSections.length})),K(r),S!==null&&un(r,S)},Un=t=>{if(!_||!v||!x||!he)return;const r={kind:"page",pageKey:_,pageName:String(he.name??""),path:String(he.path??"")},a=Er(v,r,x);a&&yn.save(_,()=>{const c=yo.getQueryData(Ti.decofile(bo))?.[_];if(!c||typeof c!="object"||c===null||Array.isArray(c))return null;const m={...c,...Fn.current};return Fn.current={},t?.raw!==void 0?{...m,seo:t.raw}:t?.inner!==void 0?ul(r,a,m,t.inner):m})},Ls=(t,r)=>{_&&(Fn.current[t]=r,Un())},$o=(t,r)=>{if(!_)return;const a=Mn([...Q],t,r);S!==null&&(S===t?W(r):t<S&&r>=S?W(S-1):t>S&&r<=S&&W(S+1)),ct(a)},zo=t=>{if(!_)return;const r=Q.filter((a,c)=>c!==t);S===t?It():S!==null&&S>t&&W(S-1),ct(r)},Ho=t=>{if(!_)return;const r=Q[t];if(!r)return;const a=[...Q];a.splice(t+1,0,ca(r)),S!==null&&S>t&&W(S+1),ct(a)},Wo=t=>{if(!_)return;const r=Q[t],a=Me[t];if(!r||!a)return;const c=a.isHidden?Ma(r):Da(r);if(!c)return;const m=[...Q];m[t]=c,S===t&&It(),ct(m)},Go=t=>{if(!_)return;const r=Q[t],a=Me[t];if(!r||!a||a.isMultivariate)return;const c=Va(r);if(!c)return;const m=[...Q];m[t]=c,S===t&&It(),ct(m)},qo=t=>{if(!_)return;const r=Q[t],a=Me[t];if(!r||!a?.isSavedBlock)return;const c=jt(r,a,v);if(!c?.data)return;const{name:m,...y}=c.data,p=[...Q];a.isLazy?p[t]={...r,section:y}:p[t]=y,S===t&&It(),ct(p)},Uo=t=>{if(!_)return;const r=[...Q,{__resolveType:t.resolveType}],a=r.length-1;ct(r,{onError:()=>{Oe.current.selectedSectionIndex===a&&It()}}),Ae(!1),W(a),at(0),D([]),ne(p=>p+1);const c=r[a],m=vn(r,v)[a];if(!c||!m)return;if(m.isMultivariate){St(c,m,0);return}const y=jt(c,m,v);if(!y){K(null),G(null),st(null),Ze(null);return}K(y.data),G(y.resolveType),st(null),Ze(null)},Os=t=>{Ge.current=t.append,Ae(!0)},Yo=t=>{const r=Ge.current;if(!r){Uo(t);return}r({__resolveType:t.resolveType}),Ae(!1),Ge.current=null},$s=t=>{if(S===null)return;const r=Q[S],a=Me[S];!r||!a?.isMultivariate||(at(t),D([]),ne(c=>c+1),St(r,a,t,S,!0))},Jo=t=>{if(S===null||!_)return;const r=Q[S],a=Me[S];if(!r||!a?.isMultivariate)return;const c=pt(r,a);if(!c)return;const m=Ca(c,t);if(!m){z.error(f("sectionsEditor.sectionsEditor.cannotDeleteOnlyVariant"));return}const y=[...Q];y[S]=Lt(r,a,m);const p=m.variants;let R=Xe;t===Xe?R=Math.min(t,p.length-1):t<Xe&&(R=Xe-1),at(R),D([]),ne($=>$+1),St(y[S],a,R),ct(y)},Qo=t=>{if(S===null||!_)return;const r=Q[S],a=Me[S];if(!r||!a?.isMultivariate)return;const c=pt(r,a);if(!c)return;const m=Ta(c,t),y=[...Q];y[S]=Lt(r,a,m);const p=t+1;at(p),D([]),ne(R=>R+1),St(y[S],a,p),ct(y)},Xo=(t,r)=>{if(S===null||!_||t===r)return;const a=Q[S],c=Me[S];if(!a||!c?.isMultivariate)return;const m=pt(a,c);if(!m)return;const y=Aa(m,t,r),p=[...Q];p[S]=Lt(a,c,y);let R=Xe;Xe===t?R=r:t<Xe&&r>=Xe?R=Xe-1:t>Xe&&r<=Xe&&(R=Xe+1),at(R),St(p[S],c,R),ct(p)},dn=t=>{const r=t??S;if(r===null||!_)return;const a=Q[r],c=Me[r];if(!a||!c)return;const m=ka(a,c);if(!m){z.error(f("sectionsEditor.sectionsEditor.sectionCannotHaveVariants"));return}const y=[...Q];y[r]=m.section;const p=vn(y,v)[r];if(!p?.isMultivariate){z.error(f("sectionsEditor.sectionsEditor.couldNotAddVariant"));return}W(r),at(m.newVariantIndex),D([]),ne(R=>R+1),St(m.section,p,m.newVariantIndex,r),ct(y)},zs=()=>{if(S===null||!_)return;const t=Q[S],r=Me[S];if(!t||!r?.isMultivariate)return;const a=pt(t,r);if(!a)return;const c=Na(t,r,a);if(!c){z.error(f("sectionsEditor.sectionsEditor.couldNotRemoveVariants"));return}const m=[...Q];m[S]=c;const y=vn(m,v)[S];if(!y)return;at(0),st(null),Ze(null),D([]),ne(R=>R+1);const p=jt(c,y,v);p?(K(p.data),G(p.resolveType)):(K(null),G(null)),Ut(null,S,0),ct(m)},Zo=async t=>{if(ye===null||!_)return;const r=Vn(t,v);if(r){z.error(r);return}const a=Q[ye],c=Me[ye];if(!a||!c)return;const m=jt(a,c,v);if(!m){z.error(f("sectionsEditor.sectionsEditor.sectionCannotBeSavedAsGlobal"));return}const y={...m.data,name:t};try{await me.mutateAsync({blockKey:t,data:y});const p=[...Q];p[ye]={__resolveType:t},await me.mutateAsync({blockKey:_,data:mn(v,_,p,ge,Ne)}),S===ye&&It(),Fe(null),z.success(f("sectionsEditor.sectionsEditor.savedGlobalBlock",{blockId:t})),g?.()}catch(p){z.error(p instanceof Error?p.message:f("sectionsEditor.sectionsEditor.failedToSaveGlobalBlock"))}},Hs=ot?.rule;if(mt&&S===null&&B===null&&Hs){const{resolveType:t,formValue:r}=hn(Hs,v??{},x??void 0);O(t),ie(r)}const Yt=x?Zi(x):[],Yn=x&&v?ea(x,v):[],Ws=!ae&&!!(te&&x&&v),Gs=B&&x?Cn(B,x):null,Et=()=>{yt.current&&(clearTimeout(yt.current),yt.current=null),bt.current&&(clearTimeout(bt.current),bt.current=null)},Bt=async(t,r)=>{if(!(Ia(r,t,x)>0))try{await bn.mutateAsync({blockKey:t})}catch(a){z.error(a instanceof Error?a.message:f("sectionsEditor.sectionsEditor.couldNotDeleteMatcherBlock"))}},qs=t=>{yt.current&&clearTimeout(yt.current),yt.current=setTimeout(()=>{const{activePageKey:r,decofile:a,variantIndex:c}=Oe.current;if(!r)return;const m={...a[r]},y={...m.sections},p=[...y.variants??[]],R=p[c],$=R?.rule;if(Ot($,a,x)){const N=$?.__resolveType??"",T=a[N],M=typeof T?.name=="string"?T.name:N,{__resolveType:ue,...be}=t;me.mutate({blockKey:N,data:Mt(ue??"",be,M)},{onSuccess:()=>g?.(),onError:Ie=>z.error(f("sectionsEditor.sectionsEditor.saveFailed",{error:Ie.message}))});return}R&&(p[c]={...R,rule:t}),m.sections={...y,variants:p},me.mutate({blockKey:r,data:m},{onSuccess:()=>g?.(),onError:N=>z.error(f("sectionsEditor.sectionsEditor.saveFailed",{error:N.message}))})},pn)},Us=t=>{O(t);const r=t?Ir(t,x):{__resolveType:Br};ie(t?r:{}),qs(r)},Ys=t=>{const r=t;ie(r);const a=B?{__resolveType:B,...r}:{...r};qs(a)},Js=async t=>{Et();const{activePageKey:r,decofile:a,variantIndex:c}=Oe.current;if(!r)return;const m=a[r],y=m?.sections;if(!y||typeof y!="object"||Array.isArray(y))return;const p=y;if(!Array.isArray(p.variants))return;const R=[...p.variants],$=R[c];if(!$)return;const N=Vt($.rule,a,x),T=Zt(t);R[c]={...$,rule:T};const M={...a,[r]:{...m,sections:{...p,variants:R}}},{resolveType:ue,formValue:be}=hn(T,M,x??void 0);O(ue),ie(be);try{await me.mutateAsync({blockKey:r,data:M[r]}),N&&N!==t&&await Bt(N,M),g?.()}catch(Ie){z.error(Ie instanceof Error?Ie.message:f("sectionsEditor.sectionsEditor.couldNotApplySavedRule"))}},Qs=t=>{bt.current&&clearTimeout(bt.current);const{selectedSectionIndex:r,sectionVariantIndex:a}=Oe.current;r!==null&&(bt.current=setTimeout(()=>{const{rawSections:c,parsedSections:m,decofile:y,activePageKey:p,pageVariants:R,variantIndex:$}=Oe.current;if(!p)return;const N=c[r],T=m[r];if(!N||!T?.isMultivariate)return;const M=pt(N,T);if(!M)return;const be=(M.variants??[])[a]?.rule;if(Ot(be,y,x)){const q=be?.__resolveType??"",ve=y[q],_e=typeof ve?.name=="string"?ve.name:q,{__resolveType:$e,...dt}=t;me.mutate({blockKey:q,data:Mt($e??"",dt,_e)},{onSuccess:()=>g?.(),onError:et=>z.error(f("sectionsEditor.sectionsEditor.saveFailed",{error:et.message}))});return}const Ie=Fr(M,a,t),De=[...c];De[r]=Lt(N,T,Ie);const Ue=mn(y,p,De,$,R);me.mutate({blockKey:p,data:Ue},{onSuccess:()=>g?.(),onError:q=>z.error(f("sectionsEditor.sectionsEditor.saveFailed",{error:q.message}))})},pn))},ei=t=>{st(t);const r=t?Ir(t,x):{__resolveType:Br};Ze(t?r:{}),Qs(r)},ti=t=>{const r=t;Ze(r);const a=Ht?{__resolveType:Ht,...r}:{...r};Qs(a)},ni=async t=>{Et();const{selectedSectionIndex:r,sectionVariantIndex:a,rawSections:c,parsedSections:m,decofile:y,activePageKey:p,pageVariants:R,variantIndex:$}=Oe.current;if(r===null||!p)return;const N=c[r],T=m[r];if(!N||!T?.isMultivariate)return;const M=pt(N,T);if(!M)return;const ue=M.variants??[],be=Vt(ue[a]?.rule,y,x),Ie=Zt(t),De=Fr(M,a,Ie),Ue=[...c];Ue[r]=Lt(N,T,De);const q=mn(y,p,Ue,$,R),ve={...y,[p]:q},{resolveType:_e,formValue:$e}=hn(Ie,ve,x??void 0);st(_e),Ze($e);try{await me.mutateAsync({blockKey:p,data:q}),be&&be!==t&&await Bt(be,ve),g?.()}catch(dt){z.error(dt instanceof Error?dt.message:f("sectionsEditor.sectionsEditor.couldNotApplySavedRule"))}};if(!ae&&!he)return o.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:f("sectionsEditor.sectionsEditor.noPageFound",{currentPath:d})});if(ae&&!On)return o.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:f("sectionsEditor.sectionsEditor.globalBlockNotFound")});const Ke=S!==null?Me[S]??null:null,Xs=S!==null?Q[S]:null,Zs=Xs&&Ke?.isMultivariate?pt(Xs,Ke):null,Rt=Zs?ls(Zs,vt):[],_n=Math.min(Xe,Math.max(Rt.length-1,0)),Jt=Rt[_n]??null,At=Ke?.isMultivariate===!0,Jn=S!==null&&Ke!==null,Nt=Jn&&(At||!!(wn&&je)),si=Nt&&!ae&&Ke?.isSavedBlock===!0,ut=ae||si,er=ae?Ns:Ke?.label??"",ri=Ht&&x?Cn(Ht,x):null,tr=(t,r)=>r&&P?`${t} · ${r}`:t,nr=Ke?Ke.variantOf??Ke.label:"",oi=(()=>{const t=At&&Jt?Jt.label:null;return t?P?[tr(nr,t)]:[Ke.label,t]:[Ke?.label??""]})(),Qn=tr(he?.name??"",mt?ot?.label:null),kn=Nt&&(!ae||I.length>0)?ae?[Ns,...I]:[Qn,...oi,...I]:[],sr=ce&&he?[he.name,"SEO",...ws]:[],rr=f("sectionsEditor.pageVariantTabs.variantsLabel"),or=nt&&he?[he.name,rr]:pe&&he&&Ke?[Qn,nr,rr]:[],En=or.length>0?or:sr.length>0?sr:ut?kn.length>0?kn:[er]:kn.length>0?kn:[Qn],ir=Jn&&!At&&!Ke?.isHidden&&!!_,ii=ut||!ae&&mt&&!!ot||ir,ai=Jn&&!At&&!ae&&I.length===0&&!!Ke&&ro(Ke)&&!!_,li=P&&Nt&&!pe&&At&&I.length===0&&!!Jt,ar=P&&I.length>0?Rr(I[I.length-1]):null,ci=I.length>1?Rr(I[I.length-2]):null,lr=ut?er:Nt?Ke?.label??"":he?.name??"",ui=nt||pe?f("sectionsEditor.pageVariantTabs.variantsLabel"):ce?f("sectionsEditor.panelSections.seo"):ar??lr,cr=pe?Ke?.variantOf??Ke?.label??"":nt||ce?he?.name??"":ar?ci??lr:ut?f("sectionsEditor.sectionsEditor.globalSectionSubtitle"):Nt?he?.name??"":he?.path??"",Xn=!nt&&!pe&&!ce&&!Nt&&!ut,di=!P&&!ce&&!ae&&At&&I.length===0,fn=()=>{if(!_)return;Et(),J.current&&(clearTimeout(J.current),J.current=null),qe.current.clear();const t=v[_],r=Ea(t.sections,Q);if(!r)return;const a=Ra(r);me.mutate({blockKey:_,data:{...t,sections:r}},{onSuccess:()=>{xe(a),W(null),K(null),G(null),D([]),ie(null),O(null)},onError:c=>z.error(f("sectionsEditor.sectionsEditor.saveFailed",{error:c.message}))})},Rn=(t,r,a)=>{if(!_)return;Et(),J.current&&(clearTimeout(J.current),J.current=null),qe.current.clear();const c=v[_],m=c.sections;if(!m||typeof m!="object"||Array.isArray(m))return;const y=m;if(!Array.isArray(y.variants))return;const p=t([...y.variants]);if(!p)return;const R=Ka(y,p),$={...v,[_]:{...c,sections:R}};me.mutate({blockKey:_,data:$[_]},{onSuccess:()=>{r?.();const N=typeof a=="string"?[a]:a??[];(async()=>{for(const T of N)await Bt(T,$)})()},onError:N=>z.error(f("sectionsEditor.sectionsEditor.saveFailed",{error:N.message}))})},Zn=t=>{fe(null),xe(t),W(null),K(null),G(null),D([]);const r=Ne[t]?.rule,{resolveType:a,formValue:c}=hn(r,v??{},x??void 0);O(a),ie(c),Wn(Ne.map(m=>({rule:m.rule})),t)},ur=(t,r)=>{if(t===r)return;let a=ge;ge===t?a=r:t<ge&&r>=ge?a=ge-1:t>ge&&r<=ge&&(a=ge+1),xe(a);const c=Mn(Ne.map(m=>({rule:m.rule})),t,r);Wn(c,a),Rn(m=>Mn(m,t,r))},dr=t=>{const r=Ne[t]?.rule,a=Vt(r,v??{},x??void 0);Rn(c=>c.length<=1?null:(c.splice(t,1),c),()=>{Ne.length-1===1?xe(0):t<ge?xe(ge-1):t===ge&&xe(Math.max(0,t-1)),W(null),K(null),G(null),D([]),ie(null),O(null)},a)},fi=()=>{const t=Ne.map((r,a)=>({variant:r,index:a})).filter(({variant:r})=>!Pa(r.rule)).map(({variant:r})=>Vt(r.rule,v??{},x??void 0)).filter(r=>!!r);Rn(r=>{const a=La({variants:r}),c=r[a];return c?[{...c,rule:Oa()}]:null},()=>{xe(0),W(null),K(null),G(null),D([]),ie(null),O(null),se(!1)},t)},fr=t=>{Rn(r=>$a(r,t),()=>{xe(t+1),W(null),K(null),G(null),D([]),ie(null),O(null)})},mi=async(t,r)=>{Et(),J.current&&(clearTimeout(J.current),J.current=null),qe.current.clear();const a=Oe.current.activePageKey,c=Oe.current.decofile;if(!a)return;const m=c[a],y=m.sections;if(!y||typeof y!="object"||Array.isArray(y))return;const p=y;if(!Array.isArray(p.variants))return;const R=[...p.variants],$=R[t];if(!$?.rule||typeof $.rule!="object"){z.error(f("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const N=$.rule,T=r.trim();Gt(!0);try{if(!T){if(!Ot(N,c,x)){fe(null);return}const Ue=N.__resolveType??"";R[t]={...$,rule:cs(N,c,x)};const q={...c,[a]:{...m,sections:{...p,variants:R}}};await me.mutateAsync({blockKey:a,data:q[a]}),await Bt(Ue,q),fe(null),g?.();return}const M=us(N,c,x);if(!M){z.error(f("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(M.blockKey){await me.mutateAsync({blockKey:M.blockKey,data:Mt(M.resolveType,M.data,T)}),fe(null),g?.();return}const ue=Tn(T),be=Vn(ue,c);if(be){z.error(be);return}const Ie=Mt(M.resolveType,M.data,T);let De=null;try{await me.mutateAsync({blockKey:ue,data:Ie}),De=ue,R[t]={...$,rule:Zt(ue)},await me.mutateAsync({blockKey:a,data:{...m,sections:{...p,variants:R}}}),De=null}catch(Ue){throw De&&await bn.mutateAsync({blockKey:De}).catch(()=>{}),Ue}fe(null),z.success(f("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:T})),g?.()}catch(M){z.error(M instanceof Error?M.message:f("sectionsEditor.sectionsEditor.failedToRenameVariant"))}finally{Gt(!1)}},pi=async(t,r)=>{Et(),J.current&&(clearTimeout(J.current),J.current=null),qe.current.clear();const{selectedSectionIndex:a,rawSections:c,parsedSections:m,decofile:y,activePageKey:p,pageVariants:R,variantIndex:$}=Oe.current;if(a===null||!p)return;const N=c[a],T=m[a];if(!N||!T?.isMultivariate)return;const M=pt(N,T);if(!M)return;const ue=M.variants??[],be=ue[t];if(!be?.rule||typeof be.rule!="object"){z.error(f("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const Ie=be.rule,De=r.trim();Gt(!0);const Ue=async q=>{const ve={...M,variants:q},_e=[...c];_e[a]=Lt(N,T,ve);const $e=mn(y,p,_e,$,R);return await me.mutateAsync({blockKey:p,data:$e}),{...y,[p]:$e}};try{if(!De){if(!Ot(Ie,y,x)){Pe(null);return}const et=Ie.__resolveType??"",gt=[...ue];gt[t]={...be,rule:cs(Ie,y,x)};const Ct=await Ue(gt);await Bt(et,Ct),Pe(null),g?.();return}const q=us(Ie,y,x);if(!q){z.error(f("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(q.blockKey){await me.mutateAsync({blockKey:q.blockKey,data:Mt(q.resolveType,q.data,De)}),Pe(null),g?.();return}const ve=Tn(De),_e=Vn(ve,y);if(_e){z.error(_e);return}const $e=Mt(q.resolveType,q.data,De);let dt=null;try{await me.mutateAsync({blockKey:ve,data:$e}),dt=ve;const et=[...ue];et[t]={...be,rule:Zt(ve)},await Ue(et),dt=null}catch(et){throw dt&&await bn.mutateAsync({blockKey:dt}).catch(()=>{}),et}Pe(null),z.success(f("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:De})),g?.()}catch(q){z.error(q instanceof Error?q.message:f("sectionsEditor.sectionsEditor.failedToRenameVariant"))}finally{Gt(!1)}},mr=async(t,r,a)=>{K(a);try{await me.mutateAsync({blockKey:t,data:a})}catch(c){throw K(m=>m===a?r:m),c}},hi={rename:async(t,r,a)=>{Et(),J.current&&(clearTimeout(J.current),J.current=null),qe.current.clear();const{activePageKey:c,decofile:m}=Oe.current;if(!c)return;const y=Array.isArray(t.variants)?[...t.variants]:[],p=y[r],R=p?.rule&&typeof p.rule=="object"?p.rule:void 0,$=async T=>{const M={...t,variants:T};return await mr(c,t,M),{...m,[c]:M}},N=vc(R,a,m,x);if(N.kind!=="noop"){if(N.kind==="error"){z.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}Gt(!0);try{if(N.kind==="inline"){const M=[...y];M[r]={...p,rule:N.inlinedRule};const ue=await $(M);await Bt(N.blockKey,ue),g?.();return}if(N.kind==="updateBlock"){await me.mutateAsync({blockKey:N.blockKey,data:N.blockData}),g?.();return}let T=null;try{await me.mutateAsync({blockKey:N.blockId,data:N.blockData}),T=N.blockId;const M=[...y];M[r]={...p,rule:N.reference},await $(M),T=null}catch(M){throw T&&await bn.mutateAsync({blockKey:T}).catch(()=>{}),M}z.success(f("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:a.trim()})),g?.()}catch(T){z.error(T instanceof Error?T.message:f("sectionsEditor.sectionsEditor.failedToRenameVariant"))}finally{Gt(!1)}}},selectGlobal:async(t,r,a)=>{Et(),J.current&&(clearTimeout(J.current),J.current=null),qe.current.clear();const{activePageKey:c,decofile:m}=Oe.current;if(!c)return;const y=Array.isArray(t.variants)?[...t.variants]:[],p=y[r];if(!p)return;const R=Vt(p.rule,m,x);y[r]={...p,rule:Zt(a)};const $={...t,variants:y},N={...m,[c]:$};try{await mr(c,t,$),R&&R!==a&&await Bt(R,N),g?.()}catch(T){z.error(T instanceof Error?T.message:f("sectionsEditor.sectionsEditor.couldNotApplySavedRule"))}}},pr=()=>{It()},hr=t=>{xn(t),Un({inner:t})},gr=t=>{Bn(t),Un({raw:t})},vr=()=>{xn(null),Pt([])},xr=()=>en(t=>t+1),yr=()=>{yn.flush(),it(!1),xn(null),Bn(void 0),Pt([]),en(t=>t+1),E?.()},gi=()=>{se(!1),rt(!1),W(null),it(!0)},vi=()=>{ce&&yr(),W(null),se(!0)},xi=()=>rt(!0),es=t=>{if(nt&&t===0){se(!1);return}if(pe&&t<2){rt(!1),t===0&&W(null);return}if(ce){if(t===0){yr();return}if(t===1){Pt([]),en(a=>a+1);return}Pt(ws.slice(0,t-1)),en(a=>a+1);return}if(ae){D(I.slice(0,t)),ne(a=>a+1);return}if(t===0){pr();return}if(t===1){D([]),ne(a=>a+1);return}const r=!P&&At&&Jt?1:0;if(r===1&&t===2){D([]),ne(a=>a+1);return}D(I.slice(0,t-1-r))},ts=En.length>1?o.jsx("button",{type:"button",onClick:()=>es(ua(En.length,{isMultivariateSectionTop:di})),title:f("sectionsEditor.sectionsEditor.back"),"aria-label":f("sectionsEditor.sectionsEditor.back"),className:le("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:o.jsx(ga,{className:"size-4"})}):null,yi=ut||Nt||ce?ii&&o.jsxs("div",{className:le("border-b px-3 py-2.5",ut&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[!ae&&mt&&ot&&o.jsxs("button",{type:"button",onClick:pr,title:f("sectionsEditor.sectionsEditor.editingInVariant",{variant:ot.label}),className:le("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",na),children:[o.jsx(ta,{rule:rs(ot.rule,v??{},x??void 0),matchers:Yt}),o.jsx("span",{className:"max-w-[160px] truncate",children:ot.label})]}),o.jsx("div",{className:"flex-1"}),ut&&o.jsxs(wt,{children:[o.jsx(_t,{asChild:!0,children:o.jsx("span",{className:"shrink-0 cursor-help",children:o.jsx(Pn,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),o.jsx(kt,{side:"bottom",className:"max-w-[260px]",children:f("sectionsEditor.sectionsEditor.globalSectionTooltip")})]}),ir&&o.jsx(Nn,{onClick:()=>dn()})]}),ut&&o.jsx("p",{className:"mt-1.5 py-1.5 pl-1 text-sm leading-snug text-foreground",children:f("sectionsEditor.sectionsEditor.globalSectionBanner")})]}):o.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2.5",children:[o.jsx("div",{className:"flex-1 min-w-0",children:o.jsx(Ar,{pageKey:_,initialName:he.name,initialPath:he.path,onFieldChange:Ls,variant:"header"})}),o.jsxs(wt,{children:[o.jsx(_t,{asChild:!0,children:o.jsx(xt,{type:"button",variant:"ghost",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.editSeo"),className:"size-7 shrink-0",onClick:()=>it(!0),children:o.jsx(Pr,{size:14})})}),o.jsx(kt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.editSeo")})]}),o.jsxs(wt,{children:[o.jsx(_t,{asChild:!0,children:o.jsx(xt,{type:"button",variant:"ghost",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.viewJson"),className:"size-7 shrink-0",onClick:()=>X&&_?X():Le(!0),children:o.jsx(Kr,{size:14})})}),o.jsx(kt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.viewJson")})]}),o.jsx(Nn,{onClick:fn})]}),bi=o.jsxs(o.Fragment,{children:[mt&&_&&o.jsx(Nr,{listKey:_,variants:Ne,activeIndex:ge,decofile:v??{},meta:x,matchers:Yt,onSelect:Zn,onReorder:ur,onRename:fe,onDuplicate:fr,onDelete:dr,onAdd:fn}),mt&&B!==null&&o.jsx(Cr,{className:"mt-3",children:o.jsx("div",{className:le("space-y-3",Wt&&"pointer-events-none opacity-50"),children:o.jsx(ss,{currentRt:B,currentLabel:gn(ot?.rule,v??{},vt,x??void 0),currentGlobalKey:Vt(ot?.rule,v??{},x??void 0)??void 0,matchers:Yt,globals:Yn,onSelect:Us,onSelectGlobal:Js,schema:Gs,formValue:we,onChange:Ys,formKey:`${ge}:${B??""}`,formWrapperClassName:"space-y-3",meta:x??void 0,decofile:v,onSaveReferencedBlock:tn,sandbox:ln})})})]}),br=o.jsxs(o.Fragment,{children:[o.jsx(sa,{listKey:`${_??""}:${S??""}`,variants:Rt.map((t,r)=>({index:r,label:t.label})),selectedIndex:_n,onSelect:$s,onRename:Pe,onDuplicate:Qo,onDelete:Jo,onRemoveAll:zs,onReorder:Xo,onAdd:()=>dn()}),o.jsx(Cr,{children:o.jsx(ss,{currentRt:Ht??"",currentLabel:gn(Jt?.rule,v??{},vt,x??void 0),currentGlobalKey:Vt(Jt?.rule,v??{},x??void 0)??void 0,matchers:Yt,globals:Yn,onSelect:ei,onSelectGlobal:ni,schema:ri,formValue:xo,onChange:ti,formKey:`${S??"none"}:${_n}:${Ht??""}`,formWrapperClassName:"pt-1",meta:x??void 0,decofile:v,onSaveReferencedBlock:tn,sandbox:ln})})]}),Sr=o.jsx("div",{className:le(P?"px-2":"p-2 pt-3"),children:o.jsx(Nl,{listKey:`${_??""}-${ge}`,rawSections:Q,sections:Me,meta:x,decofile:v,selectedIndex:S,onSelect:Oo,onReorder:$o,onDelete:zo,onDuplicate:Ho,onMakeReusable:Fe,onToggleHidden:Wo,onToggleLazy:Go,onAddVariant:dn,onDetach:qo,onAddSection:()=>Ae(!0),canAddSection:Ws})}),Si=o.jsxs("div",{className:"min-w-0 max-w-full space-y-4 overflow-x-hidden px-3",children:[_&&he&&o.jsx(Ar,{pageKey:_,initialName:he.name,initialPath:he.path,onFieldChange:Ls}),on&&_?o.jsx(Wr,{rawSeo:Sn,innerSeo:zn,defaultResolveType:Ts,seoSchema:Vs,activeResolveType:jn,seoTypeOptions:Cs,formResetKey:_s,siteDefaultSeo:Ms,onBreadcrumbChange:Pt,onPersistRaw:gr,onInnerChange:hr,onClearForm:vr,onBumpFormKey:xr}):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:f("sectionsEditor.sectionsEditor.seoSchemaNotFound")})]}),ji=o.jsx(Xt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:o.jsx("div",{className:"mx-auto max-w-2xl",children:on&&_?o.jsx(Wr,{rawSeo:Sn,innerSeo:zn,defaultResolveType:Ts,seoSchema:Vs,activeResolveType:jn,seoTypeOptions:Cs,formResetKey:_s,siteDefaultSeo:Ms,onBreadcrumbChange:Pt,onPersistRaw:gr,onInnerChange:hr,onClearForm:vr,onBumpFormKey:xr}):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:f("sectionsEditor.sectionsEditor.seoSchemaNotFound")})})})},"editor-seo"),wi=o.jsxs(Xt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[mt&&_&&o.jsx(Nr,{listKey:_,variants:Ne,activeIndex:ge,decofile:v??{},meta:x,matchers:Yt,onSelect:Zn,onReorder:ur,onRename:fe,onDuplicate:fr,onDelete:dr,onAdd:fn}),mt&&B!==null&&o.jsxs("div",{className:le("px-3 border-b",ee?"pt-3 pb-5 space-y-3":"py-2"),children:[o.jsxs("button",{type:"button",onClick:()=>zt(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":ee,children:[o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:f("sectionsEditor.sectionsEditor.variantRule")}),ee?o.jsx(ma,{className:"size-3.5 shrink-0 text-muted-foreground"}):o.jsx(pa,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),ee&&o.jsx("div",{className:le("space-y-3",Wt&&"pointer-events-none opacity-50"),children:o.jsx(ss,{currentRt:B,currentLabel:gn(ot?.rule,v??{},vt,x??void 0),currentGlobalKey:Vt(ot?.rule,v??{},x??void 0)??void 0,matchers:Yt,globals:Yn,onSelect:Us,onSelectGlobal:Js,schema:Gs,formValue:we,onChange:Ys,formKey:`${ge}:${B??""}`,formWrapperClassName:"space-y-3",meta:x??void 0,decofile:v,onSaveReferencedBlock:tn,sandbox:ln})})]}),Sr]},"editor-section-list");return o.jsx(ra,{children:o.jsxs("div",{className:"flex h-full min-w-0 w-full flex-col",children:[!P&&ts&&o.jsx("div",{className:"flex min-w-0 shrink-0 items-center gap-2 px-3 py-2",children:ts}),(P||En.length>1)&&o.jsx(oa,{crumbs:En,onSelect:es,onSelectRoot:()=>{yn.flush(),U?U():es(0)}}),o.jsx("div",{className:"shrink-0",children:P?o.jsxs("div",{className:le("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:[P&&ts,ut&&o.jsxs(wt,{children:[o.jsx(_t,{asChild:!0,children:o.jsx("span",{className:"shrink-0 cursor-help",children:o.jsx(Pn,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),o.jsx(kt,{side:"bottom",className:"max-w-[260px]",children:f("sectionsEditor.sectionsEditor.globalSectionTooltip")})]}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[o.jsx("span",{className:"truncate text-sm font-semibold",children:ui}),cr&&o.jsx("span",{className:"truncate text-xs text-muted-foreground",children:cr})]}),Xn&&mt&&ot&&o.jsx(Tr,{variants:Ne,activeIndex:ge,onSelect:Zn,onManage:vi,onRemoveAll:fi}),li&&o.jsx(Tr,{variants:Rt,activeIndex:_n,onSelect:$s,onManage:xi,onRemoveAll:zs}),Xn&&!mt&&o.jsx(Nn,{onClick:fn}),ai&&o.jsx(Nn,{onClick:()=>dn()}),o.jsx(ia,{}),Xn&&o.jsxs(o.Fragment,{children:[o.jsxs(wt,{children:[o.jsx(_t,{asChild:!0,children:o.jsx(xt,{type:"button",variant:"outline",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.editSeo"),className:"size-7 shrink-0",onClick:gi,children:o.jsx(Pr,{size:14})})}),o.jsx(kt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.editSeo")})]}),!X&&o.jsxs(wt,{children:[o.jsx(_t,{asChild:!0,children:o.jsx(xt,{type:"button",variant:"outline",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.viewJson"),className:"size-7 shrink-0",onClick:()=>Le(!0),children:o.jsx(Kr,{size:14})})}),o.jsx(kt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.viewJson")})]})]})]}):yi}),lt&&o.jsx(Jl,{open:!0,fields:Ll(lt.plan,lt.target.schema),choices:lt.choices,changedAgain:lt.changedAgain,fresh:lt.fresh,onChoose:(t,r)=>Lo({...lt.choices,[t]:r}),onApply:Fo},Sc(lt.formBase)),pe?o.jsx(Vr,{onAdd:()=>dn(),children:br},"editor-section-variants"):Nt?o.jsxs(Xt,{viewportRef:Ce,onBlur:Ks,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[!P&&At&&Rt.length>0&&I.length===0&&br,o.jsx(Mr,{activeSchema:wn,formValue:je,formResetKey:tt,onFormChange:Fs,onBreadcrumbChange:D,breadcrumbPath:I,emptyMessage:f("sectionsEditor.sectionsEditor.noEditableFieldsForVariant"),meta:x,decofile:v,onSaveReferencedBlock:tn,sandbox:ln,previewBaseUrl:te,onRequestAddSection:Os,onVariantMatcherOp:ae?hi:void 0})]},"editor-section-form"):ae?o.jsx(Xt,{viewportRef:Ce,onBlur:Ks,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx(Mr,{activeSchema:wn,formValue:je,formResetKey:tt,onFormChange:Fs,onBreadcrumbChange:D,breadcrumbPath:I,emptyMessage:f("sectionsEditor.sectionsEditor.noEditableFieldsForGlobalBlock"),meta:x,decofile:v,onSaveReferencedBlock:tn,sandbox:ln,previewBaseUrl:te,onRequestAddSection:Os})},"editor-global-block"):ce?P?o.jsx(Xt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"p-3",children:Si})},"editor-seo"):ji:nt?o.jsx(Vr,{onAdd:fn,children:bi},"editor-variants"):P?o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[o.jsx(Xt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"py-2",children:Sr})}),o.jsx("div",{className:"shrink-0 border-t p-2",children:o.jsx(ms,{canAddSection:Ws,onAddSection:()=>Ae(!0)})})]},"editor-section-list"):wi,o.jsx(aa,{open:ye!==null,onOpenChange:t=>{t||Fe(null)},defaultBlockId:ye!==null?Tn(Me[ye]?.label??""):"",isPending:me.isPending,onSubmit:Zo}),te&&o.jsx(fl,{open:Qe,onOpenChange:t=>{Ae(t),t||(Ge.current=null)},meta:x,decofile:v,previewBaseUrl:te,onSelect:Yo}),We&&_&&v&&o.jsx(ya,{open:We,onOpenChange:Le,pageKey:_,decofile:v}),Te!==null&&o.jsx(Dr,{open:!0,initialName:Ot(Ne[Te]?.rule,v??{},x??void 0)?gn(Ne[Te]?.rule,v??{},vt,x??void 0):"",autoLabel:vt(rs(Ne[Te]?.rule,v??{},x??void 0)),isPending:Wt,onSubmit:async t=>{await mi(Te,t)},onOpenChange:t=>{!t&&!Wt&&fe(null)}}),Ve!==null&&o.jsx(Dr,{open:!0,initialName:Ot(Rt[Ve]?.rule,v??{},x??void 0)?gn(Rt[Ve]?.rule,v??{},vt,x??void 0):"",autoLabel:vt(rs(Rt[Ve]?.rule,v??{},x??void 0)),isPending:Wt,onSubmit:async t=>{await pi(Ve,t)},onOpenChange:t=>{!t&&!Wt&&Pe(null)}})]})})}export{jf as SectionsEditor};
|
|
4
|
+
`).trim()}const Wl={" ":" ","&":"&","<":"<",">":">",""":'"',"'":"'"};function Gl(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=>Wl[s]??s)}function Dn(n){const e=n.replace(/\s+/g," ").trim();return e.length>Yr?`${e.slice(0,Yr-1)}…`:e}function ql(n){if(n.startsWith("data:"))return"image";const e=n.split(/[?#]/)[0]??n;return decodeURIComponent(e.split("/").pop()||n)}function Kn(n,e){if(n==null||n==="")return{kind:"empty"};if(typeof n=="string")return go(n,e)?{kind:"image",src:n}:{kind:"text",text:vs(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,Hl).map(i=>Ul(i,s)??"")}}if(typeof n=="object"){const s=n;if("value"in s&&Object.keys(s).length<=2)return Kn(s.value,e?.properties?.value??e);const i=Object.entries(s).filter(([l,d])=>!l.startsWith("__")&&d!==void 0).flatMap(([l,d])=>{const h=e?.properties?.[l]??null,u=Kn(d,h);if(u.kind==="empty")return[];const b=u.kind==="text"?Dn(u.text):u.kind==="image"?ql(u.src):u.kind==="yesNo"?u.value?"✓":"✗":u.kind==="list"?`${u.count}`:"…";return[{label:h?.title?.trim()||l,text:b}]}).slice(0,4);return i.length>0?{kind:"fields",entries:i}:{kind:"empty"}}return{kind:"text",text:String(n)}}function Ul(n,e){if(typeof n=="string")return Dn(vs(n,e));if(!n||typeof n!="object"||Array.isArray(n))return null;const s=n,i=e?.titleBy,l=i?s[i]:void 0;if(typeof l=="string"&&l.trim())return Dn(l);for(const[d,h]of Object.entries(s))if(!(d.startsWith("__")||typeof h!="string"||!h.trim())&&!go(h,e?.properties?.[d]??null))return Dn(vs(h,null));return null}const Jr=1500;function Yl(n,e){const s=n.split(/(\s+)/).filter(k=>k!==""),i=e.split(/(\s+)/).filter(k=>k!=="");if(s.length>Jr||i.length>Jr)return{mine:[{text:n,kind:"changed"}],theirs:[{text:e,kind:"changed"}]};const l=Array.from({length:s.length+1},()=>new Array(i.length+1).fill(0));for(let k=s.length-1;k>=0;k--)for(let E=i.length-1;E>=0;E--){const U=l[k];U[E]=s[k]===i[E]?l[k+1][E+1]+1:Math.max(l[k+1][E],U[E+1])}const d=[],h=[],u=(k,E,U)=>{const X=k.at(-1);X&&(X.kind===U||U==="same"&&!E.trim())?X.text+=E:k.push({text:E,kind:U})};let b=0,g=0;for(;b<s.length&&g<i.length;)s[b]===i[g]?(u(d,s[b],"same"),u(h,i[g],"same"),b++,g++):l[b+1][g]>=l[b][g+1]?(u(d,s[b],"changed"),b++):(u(h,i[g],"changed"),g++);for(;b<s.length;b++)u(d,s[b],"changed");for(;g<i.length;g++)u(h,i[g],"changed");return{mine:d,theirs:h}}function Jl(n){const e=ft.c(10);let s,i;e[0]!==n?({open:s,...i}=n,e[0]=n,e[1]=s,e[2]=i):(s=e[1],i=e[2]);const{data:l}=Ai.useSession();let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=le("max-h-[85vh] grid-rows-[auto_minmax(0,1fr)_auto] sm:max-w-lg"),e[3]=d):d=e[3];const h=l?.user??null;let u;e[4]!==i||e[5]!==h?(u=o.jsx(sl,{className:d,"data-testid":"form-conflict-dialog",onEscapeKeyDown:Zl,onOpenAutoFocus:Xl,children:o.jsx(oc,{...i,viewer:h,heading:Ql})}),e[4]=i,e[5]=h,e[6]=u):u=e[6];let b;return e[7]!==s||e[8]!==u?(b=o.jsx(al,{open:s,children:u}),e[7]=s,e[8]=u,e[9]=b):b=e[9],b}function Ql(n,e){return o.jsxs(rl,{className:"text-left",children:[o.jsx(ol,{children:n}),o.jsx(il,{children:e})]})}function Xl(n){n.preventDefault(),n.currentTarget?.focus()}function Zl(n){return n.preventDefault()}const ec={},tc=(n,e)=>o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx("h2",{className:"text-lg font-semibold",children:n}),o.jsx("p",{className:"text-sm text-muted-foreground",children:e})]});function nc(n,e,s=0,i={}){const l=e[Math.min(s,e.length-1)],d={field:l?rc(l.label):"",label:l?.label??""};return e.length<=1?{title:n("sectionsEditor.formConflict.titleOne",d),description:n("sectionsEditor.formConflict.descriptionOne")}:{title:n("sectionsEditor.formConflict.titleStep",d),description:s>=e.length-1?o.jsx(sc,{t:n,fields:e,choices:i}):n("sectionsEditor.formConflict.descriptionStep")}}function sc(n){const e=ft.c(9),{t:s,fields:i,choices:l}=n;let d;if(e[0]!==l||e[1]!==i||e[2]!==s){let u;e[4]!==l||e[5]!==s?(u=(b,g)=>o.jsxs(w.Fragment,{children:[g>0&&" · ",`${b.label}: `,o.jsx("span",{className:"font-medium text-foreground",children:s((l[b.pointer]??"mine")==="mine"?"sectionsEditor.formConflict.summaryYours":"sectionsEditor.formConflict.summaryTheirs")})]},b.pointer),e[4]=l,e[5]=s,e[6]=u):u=e[6],d=i.map(u),e[0]=l,e[1]=i,e[2]=s,e[3]=d}else d=e[3];let h;return e[7]!==d?(h=o.jsx("span",{"data-testid":"form-conflict-summary",children:d}),e[7]=d,e[8]=h):h=e[8],h}function rc(n){return/^[A-Z][a-z]/.test(n)&&!n.includes("›")?n.charAt(0).toLowerCase()+n.slice(1):n}function oc(n){const e=ft.c(68),s=Dt(),{fields:i,choices:l,changedAgain:d,fresh:h,heading:u}=n,b=d===void 0?!1:d,g=h===void 0?ec:h,k=u===void 0?tc:u,E=i.length>1,[U,X]=w.useState(0),[F,L]=w.useState(ic);let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f={},e[0]=f):f=e[0];const[A,Y]=w.useState(f),j=Math.max(0,Math.min(U,i.length-1)),H=i[j],V=j===i.length-1;let v;e[1]!==j||e[2]!==i||e[3]!==g?(v=we=>{const ie=i[j],B=i[we];!ie||!B||we===j||(L(O=>new Set(O).add(ie.pointer)),Y(O=>({...O,[ie.pointer]:g[ie.pointer]??0,[B.pointer]:g[B.pointer]??0})),X(we))},e[1]=j,e[2]=i,e[3]=g,e[4]=v):v=e[4];const C=v;let x;e[5]!==j||e[6]!==C?(x=we=>{if(!we)return;const ie=B=>{const O={ArrowLeft:-1,ArrowRight:1}[B.key];!O||B.defaultPrevented||B.altKey||B.ctrlKey||B.metaKey||B.shiftKey||ll(B.target)||(B.preventDefault(),C(j+O))};return we.ownerDocument.addEventListener("keydown",ie),()=>we.ownerDocument.removeEventListener("keydown",ie)},e[5]=j,e[6]=C,e[7]=x):x=e[7];const re=x;if(!H)return null;let P,oe,de,Z,te;if(e[8]!==F||e[9]!==j||e[10]!==l||e[11]!==i||e[12]!==g||e[13]!==C||e[14]!==k||e[15]!==re||e[16]!==E||e[17]!==n||e[18]!==A||e[19]!==s){const{title:we,description:ie}=nc(s,i,j,l);let B;e[25]!==n?(B=O=>{O.detail>1||n.onApply()},e[25]=n,e[26]=B):B=e[26],P=B,oe=E?re:void 0,de="flex min-w-0 flex-col gap-3",e[27]!==F||e[28]!==j||e[29]!==i||e[30]!==g||e[31]!==C||e[32]!==E||e[33]!==A||e[34]!==s?(Z=E&&o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx("div",{role:"group","aria-label":s("sectionsEditor.formConflict.steps"),className:"-m-1 flex flex-wrap items-center",children:i.map((O,I)=>{const D=I!==j&&(g[O.pointer]??0)>(A[O.pointer]??0);return o.jsx("button",{type:"button","aria-label":D?s("sectionsEditor.formConflict.stepChangedAgain",{label:O.label}):O.label,"aria-current":I===j?"step":void 0,"data-answered":I!==j&&F.has(O.pointer)?"":void 0,"data-changed-again":D?"":void 0,onClick:()=>C(I),className:"group cursor-pointer rounded-full p-1 outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:o.jsx("span",{className:le("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")})},O.pointer)})}),o.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:s("sectionsEditor.formConflict.stepCount",{step:String(j+1),count:String(i.length)})})]}),e[27]=F,e[28]=j,e[29]=i,e[30]=g,e[31]=C,e[32]=E,e[33]=A,e[34]=s,e[35]=Z):Z=e[35],te=k(we,ie),e[8]=F,e[9]=j,e[10]=l,e[11]=i,e[12]=g,e[13]=C,e[14]=k,e[15]=re,e[16]=E,e[17]=n,e[18]=A,e[19]=s,e[20]=P,e[21]=oe,e[22]=de,e[23]=Z,e[24]=te}else P=e[20],oe=e[21],de=e[22],Z=e[23],te=e[24];let S;e[36]!==oe||e[37]!==de||e[38]!==Z||e[39]!==te?(S=o.jsxs("div",{ref:oe,className:de,children:[Z,te]}),e[36]=oe,e[37]=de,e[38]=Z,e[39]=te,e[40]=S):S=e[40];const W=!b&&"sr-only";let je;e[41]!==W?(je=le("text-sm text-muted-foreground",W),e[41]=W,e[42]=je):je=e[42];let K;e[43]!==b||e[44]!==E||e[45]!==s?(K=b?s(E?"sectionsEditor.formConflict.changedAgainSteps":"sectionsEditor.formConflict.changedAgain"):"",e[43]=b,e[44]=E,e[45]=s,e[46]=K):K=e[46];let He;e[47]!==je||e[48]!==K?(He=o.jsx("p",{role:"status",className:je,children:K}),e[47]=je,e[48]=K,e[49]=He):He=e[49];const G=E?"vertical":"all";let Ee;e[50]!==H||e[51]!==n||e[52]!==G?(Ee=o.jsx(uc,{field:H,...n,arrows:G}),e[50]=H,e[51]=n,e[52]=G,e[53]=Ee):Ee=e[53];let xe;e[54]!==He||e[55]!==Ee?(xe=o.jsxs("div",{className:"-mx-2 flex min-h-0 flex-col gap-3 overflow-y-auto px-2 py-1",children:[He,Ee]}),e[54]=He,e[55]=Ee,e[56]=xe):xe=e[56];let Re;e[57]!==P||e[58]!==j||e[59]!==C||e[60]!==V||e[61]!==E||e[62]!==s?(Re=E?o.jsxs(Hr,{className:"flex-row flex-wrap items-center justify-between gap-2 sm:justify-between",children:[o.jsx(xt,{type:"button",variant:"outline","aria-disabled":j===0,onClick:()=>C(j-1),className:"aria-disabled:cursor-default aria-disabled:opacity-45",children:s("sectionsEditor.formConflict.back")}),o.jsx(xt,{type:"button","data-testid":"form-conflict-primary",onClick:V?P:()=>C(j+1),children:s(V?"sectionsEditor.formConflict.ok":"sectionsEditor.formConflict.next")})]}):o.jsx(Hr,{className:"items-center gap-2",children:o.jsx(xt,{type:"button","data-testid":"form-conflict-primary",onClick:P,children:s("sectionsEditor.formConflict.ok")})}),e[57]=P,e[58]=j,e[59]=C,e[60]=V,e[61]=E,e[62]=s,e[63]=Re):Re=e[63];let Be;return e[64]!==S||e[65]!==xe||e[66]!==Re?(Be=o.jsxs(o.Fragment,{children:[S,xe,Re]}),e[64]=S,e[65]=xe,e[66]=Re,e[67]=Be):Be=e[67],Be}function ic(){return new Set}function ac(n){const e=Kn(n.mine,n.schema),s=Kn(n.theirs,n.schema),i=e.kind==="text"&&s.kind==="text"?Yl(e.text,s.text):null;return l=>i?o.jsx(fc,{parts:i[l]}):o.jsx(pc,{preview:l==="mine"?e:s})}const lc={all:{ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1},vertical:{ArrowDown:1,ArrowUp:-1}};function cc(n,e){const s=lc[e][n.key];if(!s)return;const i=[...n.currentTarget.querySelectorAll('[role="radio"]')],l=i.indexOf(document.activeElement);if(l<0)return;n.preventDefault();const d=i[(l+s+i.length)%i.length];d?.focus(),d?.click()}function uc(n){const e=ft.c(59),{field:s,choices:i,viewer:l,onChoose:d,arrows:h}=n,u=Dt();let b,g,k,E,U,X,F,L,f,A,Y,j,H;if(e[0]!==h||e[1]!==i||e[2]!==s||e[3]!==d||e[4]!==u||e[5]!==l?.image||e[6]!==l?.name){const C=ac(s),x=i[s.pointer]??"mine";j="radiogroup",H=s.label,k="flex flex-col gap-2",e[20]!==h?(E=S=>cc(S,h),e[20]=h,e[21]=E):E=e[21];let re;e[22]!==s.pointer||e[23]!==d?(re=()=>d(s.pointer,"mine"),e[22]=s.pointer,e[23]=d,e[24]=re):re=e[24];const P=l?.image??void 0;let oe;e[25]!==u||e[26]!==l?.name?(oe=dc(l?.name)||u("sectionsEditor.formConflict.you"),e[25]=u,e[26]=l?.name,e[27]=oe):oe=e[27];let de;e[28]!==P||e[29]!==oe?(de=o.jsx(zr,{url:P,fallback:oe,shape:"circle",size:"sm",className:"text-xs"}),e[28]=P,e[29]=oe,e[30]=de):de=e[30];let Z;e[31]!==u?(Z=u("sectionsEditor.formConflict.you"),e[31]=u,e[32]=Z):Z=e[32];let te;e[33]!==u?(te=u("sectionsEditor.formConflict.yourVersionNotSaved"),e[33]=u,e[34]=te):te=e[34],U=o.jsx(Qr,{side:"mine",checked:x==="mine",onChoose:re,avatar:de,who:Z,meta:te,children:C("mine")}),b=Qr,g="theirs",X=x==="theirs",e[35]!==s.pointer||e[36]!==d?(F=()=>d(s.pointer,"theirs"),e[35]=s.pointer,e[36]=d,e[37]=F):F=e[37],e[38]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(zr,{url:"icon://user",fallback:"",muted:!0,shape:"circle",size:"sm"}),e[38]=L):L=e[38],e[39]!==u?(f=u("sectionsEditor.formConflict.someoneElse"),e[39]=u,e[40]=f):f=e[40],e[41]!==u?(A=u("sectionsEditor.formConflict.theirVersionSaved"),e[41]=u,e[42]=A):A=e[42],Y=C("theirs"),e[0]=h,e[1]=i,e[2]=s,e[3]=d,e[4]=u,e[5]=l?.image,e[6]=l?.name,e[7]=b,e[8]=g,e[9]=k,e[10]=E,e[11]=U,e[12]=X,e[13]=F,e[14]=L,e[15]=f,e[16]=A,e[17]=Y,e[18]=j,e[19]=H}else b=e[7],g=e[8],k=e[9],E=e[10],U=e[11],X=e[12],F=e[13],L=e[14],f=e[15],A=e[16],Y=e[17],j=e[18],H=e[19];let V;e[43]!==b||e[44]!==g||e[45]!==X||e[46]!==F||e[47]!==L||e[48]!==f||e[49]!==A||e[50]!==Y?(V=o.jsx(b,{side:g,checked:X,onChoose:F,avatar:L,who:f,meta:A,children:Y}),e[43]=b,e[44]=g,e[45]=X,e[46]=F,e[47]=L,e[48]=f,e[49]=A,e[50]=Y,e[51]=V):V=e[51];let v;return e[52]!==k||e[53]!==E||e[54]!==U||e[55]!==V||e[56]!==j||e[57]!==H?(v=o.jsxs("div",{role:j,"aria-label":H,className:k,onKeyDown:E,children:[U,V]}),e[52]=k,e[53]=E,e[54]=U,e[55]=V,e[56]=j,e[57]=H,e[58]=v):v=e[58],v}function dc(n){return(n??"").trim().split(/\s+/).filter(Boolean).slice(0,2).map(e=>e.charAt(0).toUpperCase()).join("")}function Qr(n){const e=ft.c(27),{side:s,checked:i,onChoose:l,avatar:d,who:h,meta:u,children:b}=n,g=w.useId(),k=`${g}-who`,E=`${g}-meta ${g}-value`,U=i?0:-1,X=i?"border-primary bg-primary/5 ring-1 ring-primary":"hover:bg-muted/50";let F;e[0]!==X?(F=le("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",X),e[0]=X,e[1]=F):F=e[1];const L=`${g}-who`;let f;e[2]!==L||e[3]!==h?(f=o.jsx("span",{id:L,className:"text-sm font-medium text-foreground",children:h}),e[2]=L,e[3]=h,e[4]=f):f=e[4];const A=`${g}-meta`;let Y;e[5]!==u||e[6]!==A?(Y=o.jsx("span",{id:A,children:u}),e[5]=u,e[6]=A,e[7]=Y):Y=e[7];let j;e[8]!==f||e[9]!==Y?(j=o.jsxs("span",{className:"flex flex-wrap items-baseline gap-x-1.5 text-xs text-muted-foreground",children:[f,Y]}),e[8]=f,e[9]=Y,e[10]=j):j=e[10];const H=`${g}-value`,V=`conflict-${s}`;let v;e[11]!==b||e[12]!==H||e[13]!==V?(v=o.jsx("span",{id:H,"data-testid":V,className:"min-w-0 text-sm",children:b}),e[11]=b,e[12]=H,e[13]=V,e[14]=v):v=e[14];let C;e[15]!==j||e[16]!==v?(C=o.jsxs("span",{className:"flex min-w-0 flex-col gap-1",children:[j,v]}),e[15]=j,e[16]=v,e[17]=C):C=e[17];let x;return e[18]!==d||e[19]!==i||e[20]!==l||e[21]!==k||e[22]!==C||e[23]!==E||e[24]!==U||e[25]!==F?(x=o.jsxs("button",{type:"button",role:"radio","aria-checked":i,"aria-labelledby":k,"aria-describedby":E,tabIndex:U,onClick:l,className:F,children:[d,C]}),e[18]=d,e[19]=i,e[20]=l,e[21]=k,e[22]=C,e[23]=E,e[24]=U,e[25]=F,e[26]=x):x=e[26],x}function fc(n){const e=ft.c(4),{parts:s}=n;let i;e[0]!==s?(i=s.map(mc),e[0]=s,e[1]=i):i=e[1];let l;return e[2]!==i?(l=o.jsx("span",{className:"whitespace-pre-wrap break-words",children:i}),e[2]=i,e[3]=l):l=e[3],l}function mc(n,e){return n.kind==="changed"?o.jsx("mark",{className:"rounded-sm bg-warning/20 px-0.5 text-foreground",children:n.text},e):o.jsx("span",{children:n.text},e)}function pc(n){const e=ft.c(29),{preview:s}=n,i=Dt();switch(s.kind){case"empty":{let l;e[0]!==i?(l=i("sectionsEditor.formConflict.empty"),e[0]=i,e[1]=l):l=e[1];let d;return e[2]!==l?(d=o.jsx("span",{className:"italic text-muted-foreground",children:l}),e[2]=l,e[3]=d):d=e[3],d}case"text":{let l;return e[4]!==s.text?(l=o.jsx("span",{className:"whitespace-pre-wrap break-words",children:s.text}),e[4]=s.text,e[5]=l):l=e[5],l}case"image":{let l;return e[6]!==s.src?(l=o.jsx("img",{src:s.src,alt:"",className:"max-h-24 max-w-full rounded border object-contain"}),e[6]=s.src,e[7]=l):l=e[7],l}case"yesNo":{const l=s.value?"sectionsEditor.formConflict.yes":"sectionsEditor.formConflict.no";let d;e[8]!==i||e[9]!==l?(d=i(l),e[8]=i,e[9]=l,e[10]=d):d=e[10];let h;return e[11]!==d?(h=o.jsx("span",{children:d}),e[11]=d,e[12]=h):h=e[12],h}case"list":{const l=s.count===1?"sectionsEditor.formConflict.oneItem":"sectionsEditor.formConflict.items",d=String(s.count);let h;e[13]!==i||e[14]!==l||e[15]!==d?(h=i(l,{count:d}),e[13]=i,e[14]=l,e[15]=d,e[16]=h):h=e[16];let u;e[17]!==h?(u=o.jsx("span",{className:"text-muted-foreground",children:h}),e[17]=h,e[18]=u):u=e[18];let b;e[19]!==s.count||e[20]!==s.items?(b=s.items.some(Boolean)&&o.jsxs("span",{className:"flex flex-col",children:[s.items.map(gc),s.count>s.items.length&&o.jsx("span",{children:"…"})]}),e[19]=s.count,e[20]=s.items,e[21]=b):b=e[21];let g;return e[22]!==u||e[23]!==b?(g=o.jsxs("span",{className:"flex flex-col gap-1",children:[u,b]}),e[22]=u,e[23]=b,e[24]=g):g=e[24],g}case"fields":{let l;e[25]!==s.entries?(l=s.entries.map(hc),e[25]=s.entries,e[26]=l):l=e[26];let d;return e[27]!==l?(d=o.jsx("dl",{className:"grid grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-0.5",children:l}),e[27]=l,e[28]=d):d=e[28],d}}}function hc(n){return o.jsxs("div",{className:"contents",children:[o.jsx("dt",{className:"text-muted-foreground",children:n.label}),o.jsx("dd",{className:"truncate",children:n.text})]},n.label)}function gc(n,e){return o.jsx("span",{className:"truncate",children:`${e+1}. ${n||"…"}`},e)}function vc(n,e,s,i){if(!n||typeof n!="object")return{kind:"error",reason:"no-matcher-rule"};const l=e.trim();if(!l)return Ot(n,s,i)?{kind:"inline",blockKey:n.__resolveType??"",inlinedRule:cs(n,s,i)}:{kind:"noop"};const d=us(n,s,i);if(!d)return{kind:"error",reason:"unreadable-rule"};if(d.blockKey)return{kind:"updateBlock",blockKey:d.blockKey,blockData:Mt(d.resolveType,d.data,l)};const h=Tn(l),u=Vn(h,s);return u?{kind:"error",reason:"invalid-block-id",message:u}:{kind:"createBlock",blockId:h,blockData:Mt(d.resolveType,d.data,l),reference:Zt(h)}}const Xr="section-form-stale-save",xc=3,yc=1e3;function Zr(n,e){const s=e.global&&e.pageKey?[{label:"Default",sections:[{__resolveType:e.pageKey}]}]:to(e.pageKey?n[e.pageKey]?.sections:void 0,n),i=Math.max(0,Math.min(e.pageVariantIndex,s.length-1)),l=s[i]?.sections??[];return{pageVariants:s,variantIndex:i,rawSections:l,parsedSections:vn(l,n)}}const eo=new WeakMap;let bc=0;function Sc(n){let e=eo.get(n);return e===void 0&&(e=++bc,eo.set(n,e)),e}function wf({orgSlug:n,virtualMcpId:e,branch:s,previewReady:i=!0,previewUrl:l,currentPath:d,activePageBlockKey:h=null,activeGlobalBlockKey:u=null,externalSelection:b,onSaved:g,initialEditSeo:k=!1,onExitSeo:E,onSelectRoot:U,onViewJsonFile:X,onFocusedBlockChange:F,onVariantPreviewOverride:L}){const f=Dt(),A=Vi(),Y=A?.taskId??null,j=i?{orgSlug:n,virtualMcpId:e,branch:s,threadId:Y,previewUrl:l}:null,[H,V]=w.useState([]),{data:v,isLoading:C}=Wi(j,{pollWhile:H.length>0}),{data:x,isLoading:re}=Gi(j),P=In(),oe=A?.virtualMcpId,Z=fa(oe===e?e:null)?.metadata?.siteSlug??null,te=dl({virtualMcpId:e,sandboxUrl:l}),[S,W]=w.useState(null),[je,K]=w.useState(null),[He,G]=w.useState(null),[Ee,xe]=w.useState(0),[Re,Be]=w.useState(void 0),[we,ie]=w.useState(null),[B,O]=w.useState(null),[I,D]=w.useState([]),Ce=w.useRef(null),[Ye,Je]=w.useState(I.length);Ye!==I.length&&(Je(I.length),requestAnimationFrame(()=>{Ce.current&&(Ce.current.scrollTop=0)}));const[tt,ne]=w.useState(0),[ye,Fe]=w.useState(null),[Te,fe]=w.useState(null),[Ve,Pe]=w.useState(null),[Qe,Ae]=w.useState(!1),[We,Le]=w.useState(!1),Ge=w.useRef(null),[ee,zt]=w.useState(!0),[nt,se]=w.useState(!1),[pe,rt]=w.useState(!1),[ce,it]=w.useState(k),[bs,Ss]=w.useState(k);k&&!bs&&(Ss(!0),it(!0),W(null),K(null),G(null),D([])),!k&&bs&&Ss(!1);const[vo,xn]=w.useState(null),[js,Bn]=w.useState(void 0),[ws,Pt]=w.useState([]),[_s,en]=w.useState(0),[Xe,at]=w.useState(0),[xo,Ze]=w.useState(null),[Ht,st]=w.useState(null),[ks,Es]=w.useState(null),yo=Ni(),bo=`${n}/${e}/${s}`,yn=qi({orgSlug:n,virtualMcpId:e,branch:s}),[So,jo]=w.useState(d),[wo,_o]=w.useState(h),[ko,Eo]=w.useState(u);(So!==d||wo!==h||ko!==u)&&(queueMicrotask(()=>yn.flush()),jo(d),_o(h),Eo(u),W(null),K(null),G(null),xe(0),ie(null),O(null),at(0),Ze(null),st(null),D([]),ne(t=>t+1),it(!1),xn(null),Bn(void 0),Pt([]),en(t=>t+1));const me=Ui({orgSlug:n,virtualMcpId:e,branch:s}),tn=la((t,r)=>{me.mutate({blockKey:t,data:r},{onSuccess:()=>g?.(),onError:a=>z.error(f("sectionsEditor.sectionsEditor.saveFailed",{error:a.message}))})}),bn=xa({orgSlug:n,virtualMcpId:e,branch:s}),[Wt,Gt]=w.useState(!1),J=w.useRef(null),qt=w.useRef(null),yt=w.useRef(null),bt=w.useRef(null),Fn=w.useRef({}),Kt=w.useRef(null),nn=w.useRef(!1),sn=w.useRef(!1),qe=w.useRef(new Map),rn=w.useRef(!1),ht=w.useRef([]),Ln=w.useRef(new WeakSet),Oe=w.useRef({rawSections:[],parsedSections:[],decofile:{},activePageKey:null,pageVariants:[],variantIndex:0,sectionVariantIndex:0,selectedSectionIndex:null}),[Rs,As]=w.useState(0),[Ro,Ao]=w.useState(0),[No,Co]=w.useState(null);if(!i||C||re)return o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(Ci,{className:"size-5 text-muted-foreground"})});if(!v||!x)return o.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:f("sectionsEditor.sectionsEditor.couldNotLoadSiteData")});const To=Sa(v),ae=!!u,he=ae?null:ja(To,d,h),_=ae?u:he?.key??null,On=ae&&u?v[u]:void 0,Ns=ae&&u&&On?wa(u,On):ae&&u?u:"",on=!ae&&_&&v[_]?v[_]:null,$n=ce&&v&&x&&_&&he?Er(v,{kind:"page",pageKey:_,pageName:String(he.name??""),path:String(he.path??"")},x):null,Vo=ce?on?.seo:void 0,Sn=js!==void 0?js:Vo,Mo=ce?Yi(Sn):void 0,Cs=$n?.seoTypeOptions??[],Ts=ce&&x?Ji(x):"",zn=vo??Mo??{},jn=ce&&$n?cl(zn,$n):null,Vs=ce&&jn&&Qi(Sn)?Cn(jn,x):null,Ms=ce?Xi(v,x)?.seoData:void 0,Ne=ae?[{label:"Default",sections:[{__resolveType:u}]}]:to(on?.sections,v??{}),mt=Ne.length>1,ge=Math.min(Ee,Ne.length-1),ot=Ne[ge],Q=ot?.sections??[],Me=vn(Q,v),Hn=!ae&&_a(on?.sections);if(ae&&u&&ks!==u){Es(u);const t=Q[0],r=Me[0];if(t&&r){W(0),at(0),D([]);const a=jt(t,r,v);a&&(K(a.data),G(a.resolveType),st(null),Ze(null))}}!ae&&ks!==null&&Es(null),Oe.current={rawSections:Q,parsedSections:Me,decofile:v??{},activePageKey:_,pageVariants:Ne,variantIndex:ge,sectionVariantIndex:Xe,selectedSectionIndex:S};const Do=()=>({multivariate:Hn,index:ge,variants:Ne.map(t=>({rule:t.rule}))}),Wn=(t,r)=>{if(!L)return;if(!_||!Hn||t.length<=1){L(null);return}const a=Gr(_,{multivariate:!0,index:r,variants:t},v,x);L(a.length>0?a:null)},Gn=L&&_&&Hn&&mt&&!C&&!re?_:null;if(Gn!==No&&(Co(Gn),Gn)){const t=Ne.map(a=>({rule:a.rule})),r=ge;queueMicrotask(()=>Wn(t,r))}const Ut=(t,r,a)=>{if(!L)return;if(!_){L(null);return}const c=Do(),m=Gr(_,c,v,x);if(!t||r<0){L(m.length>0?m:null);return}const y=ml({pageKey:_,page:c,sectionIndex:r,sectionLazy:Me[r]?.isLazy??!1,mvObj:t,selectedVariantIndex:a,decofile:v,meta:x}),p=[...m,...y];L(p.length>0?p:null)},St=(t,r,a,c=S??-1,m=!1)=>{const y=pt(t,r);if(!y){K(null),G(null),st(null),Ze(null),m&&Ut(null,c,a);return}const R=ls(y,vt)[a];if(!R){K(null),G(null),st(null),Ze(null),m&&Ut(null,c,a);return}const $=oo(R.value,v);K($?.data??null),G($?.resolveType??null);const{resolveType:N,formValue:T}=hn(R.rule,v,x??void 0);st(N),Ze(T),m&&Ut(y,c,a)},an=b?.index;if(b!==void 0&&(b?.seq??null)!==Re&&(Be(b?.seq??null),typeof an=="number")){const t=Q[an],r=Me[an];if(t&&r)if(W(an),at(0),D([]),ne(a=>a+1),r.isMultivariate)St(t,r,0,an);else{const a=jt(t,r,v);a?(K(a.data),G(a.resolveType)):(K(null),G(null)),st(null),Ze(null)}}if(Rs!==Ro){Ao(Rs);const t=S!==null?Q[S]:null,r=S!==null?Me[S]:null;if(t&&r&&S!==null)if(D([]),ne(a=>a+1),r.isMultivariate)St(t,r,Xe,S);else{const a=jt(t,r,v??{});K(a?.data??null),G(a?.resolveType??null)}}const lt=H[0];if(lt){const{formBase:t,target:r}=lt,a=Zr(v,r),c=t.sectionIndex,m=a.rawSections.length===t.sectionCount?is(a.rawSections[c],a.parsedSections[c],r.sectionVariantIndex,v):null,y=Fl(lt,m,p=>Ur(t,p));if(y){const R=[{...lt,...y,changedAgain:!0},...H.slice(1)];ht.current=R,V(R)}}const ln={orgSlug:n,virtualMcpId:e,branch:s,threadId:Y,previewUrl:l??void 0,siteSlug:Z},wn=He&&x?Cn(He,x):null,ct=(t,r)=>{if(!_)return;J.current&&(clearTimeout(J.current),J.current=null),qe.current.clear(),bt.current&&(clearTimeout(bt.current),bt.current=null),yt.current&&(clearTimeout(yt.current),yt.current=null);const a=mn(v,_,t,ge,Ne);me.mutate({blockKey:_,data:a},{onSuccess:()=>r?.onSuccess?.()??g?.(),onError:c=>{r?.onError?.(),z.error(f("sectionsEditor.sectionsEditor.saveFailed",{error:c.message}))}})},It=()=>{F?.(null),W(null),rt(!1),K(null),G(null),at(0),Ze(null),st(null),D([]),ne(t=>t+1)},Ds=()=>Kl(Ce.current,document.activeElement),qn=(t=f("sectionsEditor.sectionsEditor.blockChangedElsewhere"))=>{if(J.current&&(clearTimeout(J.current),J.current=null),qe.current.clear(),qt.current=null,z.error(t,{id:Xr}),Ds()){rn.current=!0;return}As(r=>r+1)},Ps=()=>{!rn.current||Ds()||ht.current.length>0||J.current!==null||nn.current||sn.current||qe.current.size>0||(rn.current=!1,As(t=>t+1))},Ks=()=>{rn.current&&setTimeout(Ps,0)},Is=t=>{qe.current.size!==0&&setTimeout(()=>{if(nn.current||sn.current)return;const r=[...qe.current.values()];qe.current.clear();for(const a of r)a()},t)},Po=t=>{const{activePageKey:r,variantIndex:a,sectionVariantIndex:c}=Oe.current,m=Kt.current;return{formBase:m?.sectionIndex===t&&m.variantIndex===c?m:null,pageKey:r,global:ae,pageVariantIndex:a,sectionVariantIndex:c,schema:wn}},cn=t=>{ht.current=t,V(t)},Ko=t=>{const r=ht.current,a=r.findIndex(y=>y.formBase===t.formBase),c=a>=0?r[a]:void 0,m=c?r.with(a,{...t,choices:gs(c.plan,c.choices,t.plan),fresh:ho(c.plan,t.plan,c.fresh),changedAgain:c.changedAgain||ze(c.plan.theirs)!==ze(t.plan.theirs)}):[...r,{...t,changedAgain:Ln.current.has(t.formBase)}];cn(m)},Bs=(t,r)=>{const a=ht.current,c=a.findIndex(p=>p.formBase===t),m=a[c];if(!m)return!1;if(ze(m.plan.mine)===ze(r))return!0;const y=ps({...m.plan,mine:r});if(y.pointers.length===0){const p=a.filter(R=>R!==m);return cn(p),!1}return cn(a.with(c,{...m,plan:y,choices:gs(m.plan,m.choices,y)})),!0},Io=t=>{const r=Oe.current;return r.selectedSectionIndex===t.formBase.sectionIndex&&r.activePageKey===t.target.pageKey&&r.variantIndex===t.target.pageVariantIndex&&r.sectionVariantIndex===t.target.sectionVariantIndex},Bo=()=>{const t=ht.current[0];if(!t)return null;const{formBase:r,target:a}=t;J.current&&qt.current?.sectionIndex===r.sectionIndex&&qt.current.sectionVariantIndex===a.sectionVariantIndex&&(clearTimeout(J.current),J.current=null,qt.current=null),qe.current.delete(`${a.pageKey}:${r.sectionIndex}:${a.sectionVariantIndex}`);const c=r.emitted;return c&&typeof c=="object"&&!Bs(r,c)&&un(c,r.sectionIndex,0,a),ht.current[0]??null},Fo=()=>{const t=ht.current[0],r=Bo();if(!r||!t||r.formBase!==t.formBase||r.plan.pointers.some(y=>!t.plan.pointers.includes(y)))return;const a=Il(r.plan,r.choices);cn(ht.current.slice(1));const{formBase:c,target:m}=r;c.base=r.plan.theirs,c.emitted=a,Ln.current.add(c),(Kt.current===c||Io(r))&&(Kt.current=c,K(a),ne(y=>y+1)),un(a,c.sectionIndex,0,m)},Lo=t=>{const[r,...a]=ht.current;r&&cn([{...r,choices:t},...a])},un=(t,r,a=0,c)=>{const m=c??Po(r),y=m.sectionVariantIndex,p=m.formBase,R=qt.current;J.current&&(clearTimeout(J.current),J.current=null,R&&(R.sectionIndex!==r||R.sectionVariantIndex!==y)&&R.write());const $=`${m.pageKey}:${r}:${y}`,N=()=>{if(nn.current||sn.current){qe.current.set($,N);return}const T=typeof t=="function"?t():t;if(p&&Bs(p,T))return;const M=Oe.current.decofile,{rawSections:ue,parsedSections:be,pageVariants:Ie,variantIndex:De}=Zr(M,m),Ue=m.pageKey,q=ue[r];if(!q)return;const ve=be[r];if(!ve)return;const _e=p?.base,$e=is(q,ve,y,M),dt=!!_e&&!!$e&&fo(_e,$e)&&!(p&&Ur(p,$e));if(dt&&_e&&$e){if(mo(_e,$e)){qn(f("sectionsEditor.sectionsEditor.sectionReplacedElsewhere"));return}const Se=ve.isSavedBlock?"here":Dl(_e,ue.map((ke,Tt)=>is(ke,be[Tt],y,M)),r,p?.sectionCount??ue.length);if(Se==="unknown"){qn(f("sectionsEditor.sectionsEditor.sectionReplacedElsewhere"));return}if(typeof Se=="number"&&p){p.sectionCount=ue.length,p.sectionIndex=Se,Kt.current===p&&W(Se),un(T,Se,a,m);return}}const et=dt&&_e&&$e?ps({ancestor:_e,mine:T,theirs:$e}):null;if(et&&et.pointers.length>0&&p){p.sectionCount=ue.length,Ko({plan:et,formBase:p,target:m,sectionIndex:r,choices:po(et),changedAgain:!1,fresh:{}});return}const gt=et?et.merged:null,Ct=gt??T,jr=Pl({merged:!!gt,tracked:p,current:Kt.current,saved:T});gt&&z.info(f("sectionsEditor.sectionsEditor.blockMergedWithOthers"),{id:Xr}),jr&&p&&(p.emitted=gt,K(gt));const ns=jr||!gt?Ct:T;p&&(p.base=ns,p.sectionCount=ue.length,Vl(p,ns));const wr={onSuccess:()=>{p&&Ln.current.delete(p),g?.()},onError:Se=>{if(p?.base===ns&&_e&&(p.base=_e),Se instanceof Fa){a<xc?(qe.current.delete($),sn.current=!0,setTimeout(()=>{sn.current=!1,un(()=>{const ke=p?.emitted;return ke&&typeof ke=="object"?ke:T},r,a+1,m),qe.current.delete($),Is(pn)},yc*2**a)):qn();return}z.error(f("sectionsEditor.sectionsEditor.saveFailed",{error:Se.message}))}},_r=Se=>{nn.current=!0;let ke=!1;me.mutateAsync(Se).then(()=>wr.onSuccess(),Tt=>{ke=!0,wr.onError(Tt)}).finally(()=>{nn.current=!1,Is(ke?pn:0),Ps()})};if(ve.isSavedBlock){const Se=da(q,ve);if(!Se)return;_r({blockKey:Se,data:Ct,..._e?{base:{value:gt?$e:_e}}:{},rebaseOnConflict:!1});return}if(!Ue)return;const An={...M[Ue]},Ft=[...ue];if(ve.isMultivariate){const Se=pt(q,ve);if(!Se||!Ue)return;const ke=Ba(Se,y,Ct);Ft[r]=Lt(q,ve,ke)}else if(ve.isHidden){const Se=xs(q.__resolveType),ke=Se?{...q.section}:{...q},Tt=Array.isArray(ke.variants)?[...ke.variants]:[];Tt[0]&&(Tt[0]={...Tt[0],value:Ct}),ke.variants=Tt,Se?Ft[r]={...q,section:ke}:Ft[r]=ke}else ve.isLazy?Ft[r]={...q,section:Ct}:Ft[r]=Ct;if(Ie.length>1){const Se=An.sections,ke=[...Se?.variants??[]];ke[De]&&(ke[De]={...ke[De],value:Ft}),An.sections={...Se,variants:ke}}else An.sections=Ft;_r({blockKey:Ue,data:An,rebaseOnConflict:!1})};qt.current={sectionIndex:r,sectionVariantIndex:y,write:N},J.current=setTimeout(()=>{J.current=null,N()},pn)},Oo=t=>{rn.current=!1,W(t),at(0),D([]),ne(m=>m+1);const r=Q[t],a=Me[t];if(F?.(a?.isSavedBlock?a.resolveType??null:null),!r||!a)return;if(a.isMultivariate){St(r,a,0,t);return}const c=jt(r,a,v);if(!c){K(null),G(null),st(null),Ze(null),Ut(null,t,0);return}K(c.data),G(c.resolveType),st(null),Ze(null),Ut(null,t,0)},Fs=t=>{const r=t;S!==null&&(Kt.current=Ml(Kt.current,{sectionIndex:S,variantIndex:Oe.current.sectionVariantIndex,shown:je,next:r,sectionCount:Oe.current.rawSections.length})),K(r),S!==null&&un(r,S)},Un=t=>{if(!_||!v||!x||!he)return;const r={kind:"page",pageKey:_,pageName:String(he.name??""),path:String(he.path??"")},a=Er(v,r,x);a&&yn.save(_,()=>{const c=yo.getQueryData(Ti.decofile(bo))?.[_];if(!c||typeof c!="object"||c===null||Array.isArray(c))return null;const m={...c,...Fn.current};return Fn.current={},t?.raw!==void 0?{...m,seo:t.raw}:t?.inner!==void 0?ul(r,a,m,t.inner):m})},Ls=(t,r)=>{_&&(Fn.current[t]=r,Un())},$o=(t,r)=>{if(!_)return;const a=Mn([...Q],t,r);S!==null&&(S===t?W(r):t<S&&r>=S?W(S-1):t>S&&r<=S&&W(S+1)),ct(a)},zo=t=>{if(!_)return;const r=Q.filter((a,c)=>c!==t);S===t?It():S!==null&&S>t&&W(S-1),ct(r)},Ho=t=>{if(!_)return;const r=Q[t];if(!r)return;const a=[...Q];a.splice(t+1,0,ca(r)),S!==null&&S>t&&W(S+1),ct(a)},Wo=t=>{if(!_)return;const r=Q[t],a=Me[t];if(!r||!a)return;const c=a.isHidden?Ma(r):Da(r);if(!c)return;const m=[...Q];m[t]=c,S===t&&It(),ct(m)},Go=t=>{if(!_)return;const r=Q[t],a=Me[t];if(!r||!a||a.isMultivariate)return;const c=Va(r);if(!c)return;const m=[...Q];m[t]=c,S===t&&It(),ct(m)},qo=t=>{if(!_)return;const r=Q[t],a=Me[t];if(!r||!a?.isSavedBlock)return;const c=jt(r,a,v);if(!c?.data)return;const{name:m,...y}=c.data,p=[...Q];a.isLazy?p[t]={...r,section:y}:p[t]=y,S===t&&It(),ct(p)},Uo=t=>{if(!_)return;const r=[...Q,{__resolveType:t.resolveType}],a=r.length-1;ct(r,{onError:()=>{Oe.current.selectedSectionIndex===a&&It()}}),Ae(!1),W(a),at(0),D([]),ne(p=>p+1);const c=r[a],m=vn(r,v)[a];if(!c||!m)return;if(m.isMultivariate){St(c,m,0);return}const y=jt(c,m,v);if(!y){K(null),G(null),st(null),Ze(null);return}K(y.data),G(y.resolveType),st(null),Ze(null)},Os=t=>{Ge.current=t.append,Ae(!0)},Yo=t=>{const r=Ge.current;if(!r){Uo(t);return}r({__resolveType:t.resolveType}),Ae(!1),Ge.current=null},$s=t=>{if(S===null)return;const r=Q[S],a=Me[S];!r||!a?.isMultivariate||(at(t),D([]),ne(c=>c+1),St(r,a,t,S,!0))},Jo=t=>{if(S===null||!_)return;const r=Q[S],a=Me[S];if(!r||!a?.isMultivariate)return;const c=pt(r,a);if(!c)return;const m=Ca(c,t);if(!m){z.error(f("sectionsEditor.sectionsEditor.cannotDeleteOnlyVariant"));return}const y=[...Q];y[S]=Lt(r,a,m);const p=m.variants;let R=Xe;t===Xe?R=Math.min(t,p.length-1):t<Xe&&(R=Xe-1),at(R),D([]),ne($=>$+1),St(y[S],a,R),ct(y)},Qo=t=>{if(S===null||!_)return;const r=Q[S],a=Me[S];if(!r||!a?.isMultivariate)return;const c=pt(r,a);if(!c)return;const m=Ta(c,t),y=[...Q];y[S]=Lt(r,a,m);const p=t+1;at(p),D([]),ne(R=>R+1),St(y[S],a,p),ct(y)},Xo=(t,r)=>{if(S===null||!_||t===r)return;const a=Q[S],c=Me[S];if(!a||!c?.isMultivariate)return;const m=pt(a,c);if(!m)return;const y=Aa(m,t,r),p=[...Q];p[S]=Lt(a,c,y);let R=Xe;Xe===t?R=r:t<Xe&&r>=Xe?R=Xe-1:t>Xe&&r<=Xe&&(R=Xe+1),at(R),St(p[S],c,R),ct(p)},dn=t=>{const r=t??S;if(r===null||!_)return;const a=Q[r],c=Me[r];if(!a||!c)return;const m=ka(a,c);if(!m){z.error(f("sectionsEditor.sectionsEditor.sectionCannotHaveVariants"));return}const y=[...Q];y[r]=m.section;const p=vn(y,v)[r];if(!p?.isMultivariate){z.error(f("sectionsEditor.sectionsEditor.couldNotAddVariant"));return}W(r),at(m.newVariantIndex),D([]),ne(R=>R+1),St(m.section,p,m.newVariantIndex,r),ct(y)},zs=()=>{if(S===null||!_)return;const t=Q[S],r=Me[S];if(!t||!r?.isMultivariate)return;const a=pt(t,r);if(!a)return;const c=Na(t,r,a);if(!c){z.error(f("sectionsEditor.sectionsEditor.couldNotRemoveVariants"));return}const m=[...Q];m[S]=c;const y=vn(m,v)[S];if(!y)return;at(0),st(null),Ze(null),D([]),ne(R=>R+1);const p=jt(c,y,v);p?(K(p.data),G(p.resolveType)):(K(null),G(null)),Ut(null,S,0),ct(m)},Zo=async t=>{if(ye===null||!_)return;const r=Vn(t,v);if(r){z.error(r);return}const a=Q[ye],c=Me[ye];if(!a||!c)return;const m=jt(a,c,v);if(!m){z.error(f("sectionsEditor.sectionsEditor.sectionCannotBeSavedAsGlobal"));return}const y={...m.data,name:t};try{await me.mutateAsync({blockKey:t,data:y});const p=[...Q];p[ye]={__resolveType:t},await me.mutateAsync({blockKey:_,data:mn(v,_,p,ge,Ne)}),S===ye&&It(),Fe(null),z.success(f("sectionsEditor.sectionsEditor.savedGlobalBlock",{blockId:t})),g?.()}catch(p){z.error(p instanceof Error?p.message:f("sectionsEditor.sectionsEditor.failedToSaveGlobalBlock"))}},Hs=ot?.rule;if(mt&&S===null&&B===null&&Hs){const{resolveType:t,formValue:r}=hn(Hs,v??{},x??void 0);O(t),ie(r)}const Yt=x?Zi(x):[],Yn=x&&v?ea(x,v):[],Ws=!ae&&!!(te&&x&&v),Gs=B&&x?Cn(B,x):null,Et=()=>{yt.current&&(clearTimeout(yt.current),yt.current=null),bt.current&&(clearTimeout(bt.current),bt.current=null)},Bt=async(t,r)=>{if(!(Ia(r,t,x)>0))try{await bn.mutateAsync({blockKey:t})}catch(a){z.error(a instanceof Error?a.message:f("sectionsEditor.sectionsEditor.couldNotDeleteMatcherBlock"))}},qs=t=>{yt.current&&clearTimeout(yt.current),yt.current=setTimeout(()=>{const{activePageKey:r,decofile:a,variantIndex:c}=Oe.current;if(!r)return;const m={...a[r]},y={...m.sections},p=[...y.variants??[]],R=p[c],$=R?.rule;if(Ot($,a,x)){const N=$?.__resolveType??"",T=a[N],M=typeof T?.name=="string"?T.name:N,{__resolveType:ue,...be}=t;me.mutate({blockKey:N,data:Mt(ue??"",be,M)},{onSuccess:()=>g?.(),onError:Ie=>z.error(f("sectionsEditor.sectionsEditor.saveFailed",{error:Ie.message}))});return}R&&(p[c]={...R,rule:t}),m.sections={...y,variants:p},me.mutate({blockKey:r,data:m},{onSuccess:()=>g?.(),onError:N=>z.error(f("sectionsEditor.sectionsEditor.saveFailed",{error:N.message}))})},pn)},Us=t=>{O(t);const r=t?Ir(t,x):{__resolveType:Br};ie(t?r:{}),qs(r)},Ys=t=>{const r=t;ie(r);const a=B?{__resolveType:B,...r}:{...r};qs(a)},Js=async t=>{Et();const{activePageKey:r,decofile:a,variantIndex:c}=Oe.current;if(!r)return;const m=a[r],y=m?.sections;if(!y||typeof y!="object"||Array.isArray(y))return;const p=y;if(!Array.isArray(p.variants))return;const R=[...p.variants],$=R[c];if(!$)return;const N=Vt($.rule,a,x),T=Zt(t);R[c]={...$,rule:T};const M={...a,[r]:{...m,sections:{...p,variants:R}}},{resolveType:ue,formValue:be}=hn(T,M,x??void 0);O(ue),ie(be);try{await me.mutateAsync({blockKey:r,data:M[r]}),N&&N!==t&&await Bt(N,M),g?.()}catch(Ie){z.error(Ie instanceof Error?Ie.message:f("sectionsEditor.sectionsEditor.couldNotApplySavedRule"))}},Qs=t=>{bt.current&&clearTimeout(bt.current);const{selectedSectionIndex:r,sectionVariantIndex:a}=Oe.current;r!==null&&(bt.current=setTimeout(()=>{const{rawSections:c,parsedSections:m,decofile:y,activePageKey:p,pageVariants:R,variantIndex:$}=Oe.current;if(!p)return;const N=c[r],T=m[r];if(!N||!T?.isMultivariate)return;const M=pt(N,T);if(!M)return;const be=(M.variants??[])[a]?.rule;if(Ot(be,y,x)){const q=be?.__resolveType??"",ve=y[q],_e=typeof ve?.name=="string"?ve.name:q,{__resolveType:$e,...dt}=t;me.mutate({blockKey:q,data:Mt($e??"",dt,_e)},{onSuccess:()=>g?.(),onError:et=>z.error(f("sectionsEditor.sectionsEditor.saveFailed",{error:et.message}))});return}const Ie=Fr(M,a,t),De=[...c];De[r]=Lt(N,T,Ie);const Ue=mn(y,p,De,$,R);me.mutate({blockKey:p,data:Ue},{onSuccess:()=>g?.(),onError:q=>z.error(f("sectionsEditor.sectionsEditor.saveFailed",{error:q.message}))})},pn))},ei=t=>{st(t);const r=t?Ir(t,x):{__resolveType:Br};Ze(t?r:{}),Qs(r)},ti=t=>{const r=t;Ze(r);const a=Ht?{__resolveType:Ht,...r}:{...r};Qs(a)},ni=async t=>{Et();const{selectedSectionIndex:r,sectionVariantIndex:a,rawSections:c,parsedSections:m,decofile:y,activePageKey:p,pageVariants:R,variantIndex:$}=Oe.current;if(r===null||!p)return;const N=c[r],T=m[r];if(!N||!T?.isMultivariate)return;const M=pt(N,T);if(!M)return;const ue=M.variants??[],be=Vt(ue[a]?.rule,y,x),Ie=Zt(t),De=Fr(M,a,Ie),Ue=[...c];Ue[r]=Lt(N,T,De);const q=mn(y,p,Ue,$,R),ve={...y,[p]:q},{resolveType:_e,formValue:$e}=hn(Ie,ve,x??void 0);st(_e),Ze($e);try{await me.mutateAsync({blockKey:p,data:q}),be&&be!==t&&await Bt(be,ve),g?.()}catch(dt){z.error(dt instanceof Error?dt.message:f("sectionsEditor.sectionsEditor.couldNotApplySavedRule"))}};if(!ae&&!he)return o.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:f("sectionsEditor.sectionsEditor.noPageFound",{currentPath:d})});if(ae&&!On)return o.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:f("sectionsEditor.sectionsEditor.globalBlockNotFound")});const Ke=S!==null?Me[S]??null:null,Xs=S!==null?Q[S]:null,Zs=Xs&&Ke?.isMultivariate?pt(Xs,Ke):null,Rt=Zs?ls(Zs,vt):[],_n=Math.min(Xe,Math.max(Rt.length-1,0)),Jt=Rt[_n]??null,At=Ke?.isMultivariate===!0,Jn=S!==null&&Ke!==null,Nt=Jn&&(At||!!(wn&&je)),si=Nt&&!ae&&Ke?.isSavedBlock===!0,ut=ae||si,er=ae?Ns:Ke?.label??"",ri=Ht&&x?Cn(Ht,x):null,tr=(t,r)=>r&&P?`${t} · ${r}`:t,nr=Ke?Ke.variantOf??Ke.label:"",oi=(()=>{const t=At&&Jt?Jt.label:null;return t?P?[tr(nr,t)]:[Ke.label,t]:[Ke?.label??""]})(),Qn=tr(he?.name??"",mt?ot?.label:null),kn=Nt&&(!ae||I.length>0)?ae?[Ns,...I]:[Qn,...oi,...I]:[],sr=ce&&he?[he.name,"SEO",...ws]:[],rr=f("sectionsEditor.pageVariantTabs.variantsLabel"),or=nt&&he?[he.name,rr]:pe&&he&&Ke?[Qn,nr,rr]:[],En=or.length>0?or:sr.length>0?sr:ut?kn.length>0?kn:[er]:kn.length>0?kn:[Qn],ir=Jn&&!At&&!Ke?.isHidden&&!!_,ii=ut||!ae&&mt&&!!ot||ir,ai=Jn&&!At&&!ae&&I.length===0&&!!Ke&&ro(Ke)&&!!_,li=P&&Nt&&!pe&&At&&I.length===0&&!!Jt,ar=P&&I.length>0?Rr(I[I.length-1]):null,ci=I.length>1?Rr(I[I.length-2]):null,lr=ut?er:Nt?Ke?.label??"":he?.name??"",ui=nt||pe?f("sectionsEditor.pageVariantTabs.variantsLabel"):ce?f("sectionsEditor.panelSections.seo"):ar??lr,cr=pe?Ke?.variantOf??Ke?.label??"":nt||ce?he?.name??"":ar?ci??lr:ut?f("sectionsEditor.sectionsEditor.globalSectionSubtitle"):Nt?he?.name??"":he?.path??"",Xn=!nt&&!pe&&!ce&&!Nt&&!ut,di=!P&&!ce&&!ae&&At&&I.length===0,fn=()=>{if(!_)return;Et(),J.current&&(clearTimeout(J.current),J.current=null),qe.current.clear();const t=v[_],r=Ea(t.sections,Q);if(!r)return;const a=Ra(r);me.mutate({blockKey:_,data:{...t,sections:r}},{onSuccess:()=>{xe(a),W(null),K(null),G(null),D([]),ie(null),O(null)},onError:c=>z.error(f("sectionsEditor.sectionsEditor.saveFailed",{error:c.message}))})},Rn=(t,r,a)=>{if(!_)return;Et(),J.current&&(clearTimeout(J.current),J.current=null),qe.current.clear();const c=v[_],m=c.sections;if(!m||typeof m!="object"||Array.isArray(m))return;const y=m;if(!Array.isArray(y.variants))return;const p=t([...y.variants]);if(!p)return;const R=Ka(y,p),$={...v,[_]:{...c,sections:R}};me.mutate({blockKey:_,data:$[_]},{onSuccess:()=>{r?.();const N=typeof a=="string"?[a]:a??[];(async()=>{for(const T of N)await Bt(T,$)})()},onError:N=>z.error(f("sectionsEditor.sectionsEditor.saveFailed",{error:N.message}))})},Zn=t=>{fe(null),xe(t),W(null),K(null),G(null),D([]);const r=Ne[t]?.rule,{resolveType:a,formValue:c}=hn(r,v??{},x??void 0);O(a),ie(c),Wn(Ne.map(m=>({rule:m.rule})),t)},ur=(t,r)=>{if(t===r)return;let a=ge;ge===t?a=r:t<ge&&r>=ge?a=ge-1:t>ge&&r<=ge&&(a=ge+1),xe(a);const c=Mn(Ne.map(m=>({rule:m.rule})),t,r);Wn(c,a),Rn(m=>Mn(m,t,r))},dr=t=>{const r=Ne[t]?.rule,a=Vt(r,v??{},x??void 0);Rn(c=>c.length<=1?null:(c.splice(t,1),c),()=>{Ne.length-1===1?xe(0):t<ge?xe(ge-1):t===ge&&xe(Math.max(0,t-1)),W(null),K(null),G(null),D([]),ie(null),O(null)},a)},fi=()=>{const t=Ne.map((r,a)=>({variant:r,index:a})).filter(({variant:r})=>!Pa(r.rule)).map(({variant:r})=>Vt(r.rule,v??{},x??void 0)).filter(r=>!!r);Rn(r=>{const a=La({variants:r}),c=r[a];return c?[{...c,rule:Oa()}]:null},()=>{xe(0),W(null),K(null),G(null),D([]),ie(null),O(null),se(!1)},t)},fr=t=>{Rn(r=>$a(r,t),()=>{xe(t+1),W(null),K(null),G(null),D([]),ie(null),O(null)})},mi=async(t,r)=>{Et(),J.current&&(clearTimeout(J.current),J.current=null),qe.current.clear();const a=Oe.current.activePageKey,c=Oe.current.decofile;if(!a)return;const m=c[a],y=m.sections;if(!y||typeof y!="object"||Array.isArray(y))return;const p=y;if(!Array.isArray(p.variants))return;const R=[...p.variants],$=R[t];if(!$?.rule||typeof $.rule!="object"){z.error(f("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const N=$.rule,T=r.trim();Gt(!0);try{if(!T){if(!Ot(N,c,x)){fe(null);return}const Ue=N.__resolveType??"";R[t]={...$,rule:cs(N,c,x)};const q={...c,[a]:{...m,sections:{...p,variants:R}}};await me.mutateAsync({blockKey:a,data:q[a]}),await Bt(Ue,q),fe(null),g?.();return}const M=us(N,c,x);if(!M){z.error(f("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(M.blockKey){await me.mutateAsync({blockKey:M.blockKey,data:Mt(M.resolveType,M.data,T)}),fe(null),g?.();return}const ue=Tn(T),be=Vn(ue,c);if(be){z.error(be);return}const Ie=Mt(M.resolveType,M.data,T);let De=null;try{await me.mutateAsync({blockKey:ue,data:Ie}),De=ue,R[t]={...$,rule:Zt(ue)},await me.mutateAsync({blockKey:a,data:{...m,sections:{...p,variants:R}}}),De=null}catch(Ue){throw De&&await bn.mutateAsync({blockKey:De}).catch(()=>{}),Ue}fe(null),z.success(f("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:T})),g?.()}catch(M){z.error(M instanceof Error?M.message:f("sectionsEditor.sectionsEditor.failedToRenameVariant"))}finally{Gt(!1)}},pi=async(t,r)=>{Et(),J.current&&(clearTimeout(J.current),J.current=null),qe.current.clear();const{selectedSectionIndex:a,rawSections:c,parsedSections:m,decofile:y,activePageKey:p,pageVariants:R,variantIndex:$}=Oe.current;if(a===null||!p)return;const N=c[a],T=m[a];if(!N||!T?.isMultivariate)return;const M=pt(N,T);if(!M)return;const ue=M.variants??[],be=ue[t];if(!be?.rule||typeof be.rule!="object"){z.error(f("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const Ie=be.rule,De=r.trim();Gt(!0);const Ue=async q=>{const ve={...M,variants:q},_e=[...c];_e[a]=Lt(N,T,ve);const $e=mn(y,p,_e,$,R);return await me.mutateAsync({blockKey:p,data:$e}),{...y,[p]:$e}};try{if(!De){if(!Ot(Ie,y,x)){Pe(null);return}const et=Ie.__resolveType??"",gt=[...ue];gt[t]={...be,rule:cs(Ie,y,x)};const Ct=await Ue(gt);await Bt(et,Ct),Pe(null),g?.();return}const q=us(Ie,y,x);if(!q){z.error(f("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(q.blockKey){await me.mutateAsync({blockKey:q.blockKey,data:Mt(q.resolveType,q.data,De)}),Pe(null),g?.();return}const ve=Tn(De),_e=Vn(ve,y);if(_e){z.error(_e);return}const $e=Mt(q.resolveType,q.data,De);let dt=null;try{await me.mutateAsync({blockKey:ve,data:$e}),dt=ve;const et=[...ue];et[t]={...be,rule:Zt(ve)},await Ue(et),dt=null}catch(et){throw dt&&await bn.mutateAsync({blockKey:dt}).catch(()=>{}),et}Pe(null),z.success(f("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:De})),g?.()}catch(q){z.error(q instanceof Error?q.message:f("sectionsEditor.sectionsEditor.failedToRenameVariant"))}finally{Gt(!1)}},mr=async(t,r,a)=>{K(a);try{await me.mutateAsync({blockKey:t,data:a})}catch(c){throw K(m=>m===a?r:m),c}},hi={rename:async(t,r,a)=>{Et(),J.current&&(clearTimeout(J.current),J.current=null),qe.current.clear();const{activePageKey:c,decofile:m}=Oe.current;if(!c)return;const y=Array.isArray(t.variants)?[...t.variants]:[],p=y[r],R=p?.rule&&typeof p.rule=="object"?p.rule:void 0,$=async T=>{const M={...t,variants:T};return await mr(c,t,M),{...m,[c]:M}},N=vc(R,a,m,x);if(N.kind!=="noop"){if(N.kind==="error"){z.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}Gt(!0);try{if(N.kind==="inline"){const M=[...y];M[r]={...p,rule:N.inlinedRule};const ue=await $(M);await Bt(N.blockKey,ue),g?.();return}if(N.kind==="updateBlock"){await me.mutateAsync({blockKey:N.blockKey,data:N.blockData}),g?.();return}let T=null;try{await me.mutateAsync({blockKey:N.blockId,data:N.blockData}),T=N.blockId;const M=[...y];M[r]={...p,rule:N.reference},await $(M),T=null}catch(M){throw T&&await bn.mutateAsync({blockKey:T}).catch(()=>{}),M}z.success(f("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:a.trim()})),g?.()}catch(T){z.error(T instanceof Error?T.message:f("sectionsEditor.sectionsEditor.failedToRenameVariant"))}finally{Gt(!1)}}},selectGlobal:async(t,r,a)=>{Et(),J.current&&(clearTimeout(J.current),J.current=null),qe.current.clear();const{activePageKey:c,decofile:m}=Oe.current;if(!c)return;const y=Array.isArray(t.variants)?[...t.variants]:[],p=y[r];if(!p)return;const R=Vt(p.rule,m,x);y[r]={...p,rule:Zt(a)};const $={...t,variants:y},N={...m,[c]:$};try{await mr(c,t,$),R&&R!==a&&await Bt(R,N),g?.()}catch(T){z.error(T instanceof Error?T.message:f("sectionsEditor.sectionsEditor.couldNotApplySavedRule"))}}},pr=()=>{It()},hr=t=>{xn(t),Un({inner:t})},gr=t=>{Bn(t),Un({raw:t})},vr=()=>{xn(null),Pt([])},xr=()=>en(t=>t+1),yr=()=>{yn.flush(),it(!1),xn(null),Bn(void 0),Pt([]),en(t=>t+1),E?.()},gi=()=>{se(!1),rt(!1),W(null),it(!0)},vi=()=>{ce&&yr(),W(null),se(!0)},xi=()=>rt(!0),es=t=>{if(nt&&t===0){se(!1);return}if(pe&&t<2){rt(!1),t===0&&W(null);return}if(ce){if(t===0){yr();return}if(t===1){Pt([]),en(a=>a+1);return}Pt(ws.slice(0,t-1)),en(a=>a+1);return}if(ae){D(I.slice(0,t)),ne(a=>a+1);return}if(t===0){pr();return}if(t===1){D([]),ne(a=>a+1);return}const r=!P&&At&&Jt?1:0;if(r===1&&t===2){D([]),ne(a=>a+1);return}D(I.slice(0,t-1-r))},ts=En.length>1?o.jsx("button",{type:"button",onClick:()=>es(ua(En.length,{isMultivariateSectionTop:di})),title:f("sectionsEditor.sectionsEditor.back"),"aria-label":f("sectionsEditor.sectionsEditor.back"),className:le("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:o.jsx(ga,{className:"size-4"})}):null,yi=ut||Nt||ce?ii&&o.jsxs("div",{className:le("border-b px-3 py-2.5",ut&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[!ae&&mt&&ot&&o.jsxs("button",{type:"button",onClick:pr,title:f("sectionsEditor.sectionsEditor.editingInVariant",{variant:ot.label}),className:le("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",na),children:[o.jsx(ta,{rule:rs(ot.rule,v??{},x??void 0),matchers:Yt}),o.jsx("span",{className:"max-w-[160px] truncate",children:ot.label})]}),o.jsx("div",{className:"flex-1"}),ut&&o.jsxs(wt,{children:[o.jsx(_t,{asChild:!0,children:o.jsx("span",{className:"shrink-0 cursor-help",children:o.jsx(Pn,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),o.jsx(kt,{side:"bottom",className:"max-w-[260px]",children:f("sectionsEditor.sectionsEditor.globalSectionTooltip")})]}),ir&&o.jsx(Nn,{onClick:()=>dn()})]}),ut&&o.jsx("p",{className:"mt-1.5 py-1.5 pl-1 text-sm leading-snug text-foreground",children:f("sectionsEditor.sectionsEditor.globalSectionBanner")})]}):o.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2.5",children:[o.jsx("div",{className:"flex-1 min-w-0",children:o.jsx(Ar,{pageKey:_,initialName:he.name,initialPath:he.path,onFieldChange:Ls,variant:"header"})}),o.jsxs(wt,{children:[o.jsx(_t,{asChild:!0,children:o.jsx(xt,{type:"button",variant:"ghost",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.editSeo"),className:"size-7 shrink-0",onClick:()=>it(!0),children:o.jsx(Pr,{size:14})})}),o.jsx(kt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.editSeo")})]}),o.jsxs(wt,{children:[o.jsx(_t,{asChild:!0,children:o.jsx(xt,{type:"button",variant:"ghost",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.viewJson"),className:"size-7 shrink-0",onClick:()=>X&&_?X():Le(!0),children:o.jsx(Kr,{size:14})})}),o.jsx(kt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.viewJson")})]}),o.jsx(Nn,{onClick:fn})]}),bi=o.jsxs(o.Fragment,{children:[mt&&_&&o.jsx(Nr,{listKey:_,variants:Ne,activeIndex:ge,decofile:v??{},meta:x,matchers:Yt,onSelect:Zn,onReorder:ur,onRename:fe,onDuplicate:fr,onDelete:dr,onAdd:fn}),mt&&B!==null&&o.jsx(Cr,{className:"mt-3",children:o.jsx("div",{className:le("space-y-3",Wt&&"pointer-events-none opacity-50"),children:o.jsx(ss,{currentRt:B,currentLabel:gn(ot?.rule,v??{},vt,x??void 0),currentGlobalKey:Vt(ot?.rule,v??{},x??void 0)??void 0,matchers:Yt,globals:Yn,onSelect:Us,onSelectGlobal:Js,schema:Gs,formValue:we,onChange:Ys,formKey:`${ge}:${B??""}`,formWrapperClassName:"space-y-3",meta:x??void 0,decofile:v,onSaveReferencedBlock:tn,sandbox:ln})})})]}),br=o.jsxs(o.Fragment,{children:[o.jsx(sa,{listKey:`${_??""}:${S??""}`,variants:Rt.map((t,r)=>({index:r,label:t.label})),selectedIndex:_n,onSelect:$s,onRename:Pe,onDuplicate:Qo,onDelete:Jo,onRemoveAll:zs,onReorder:Xo,onAdd:()=>dn()}),o.jsx(Cr,{children:o.jsx(ss,{currentRt:Ht??"",currentLabel:gn(Jt?.rule,v??{},vt,x??void 0),currentGlobalKey:Vt(Jt?.rule,v??{},x??void 0)??void 0,matchers:Yt,globals:Yn,onSelect:ei,onSelectGlobal:ni,schema:ri,formValue:xo,onChange:ti,formKey:`${S??"none"}:${_n}:${Ht??""}`,formWrapperClassName:"pt-1",meta:x??void 0,decofile:v,onSaveReferencedBlock:tn,sandbox:ln})})]}),Sr=o.jsx("div",{className:le(P?"px-2":"p-2 pt-3"),children:o.jsx(Nl,{listKey:`${_??""}-${ge}`,rawSections:Q,sections:Me,meta:x,decofile:v,selectedIndex:S,onSelect:Oo,onReorder:$o,onDelete:zo,onDuplicate:Ho,onMakeReusable:Fe,onToggleHidden:Wo,onToggleLazy:Go,onAddVariant:dn,onDetach:qo,onAddSection:()=>Ae(!0),canAddSection:Ws})}),Si=o.jsxs("div",{className:"min-w-0 max-w-full space-y-4 overflow-x-hidden px-3",children:[_&&he&&o.jsx(Ar,{pageKey:_,initialName:he.name,initialPath:he.path,onFieldChange:Ls}),on&&_?o.jsx(Wr,{rawSeo:Sn,innerSeo:zn,defaultResolveType:Ts,seoSchema:Vs,activeResolveType:jn,seoTypeOptions:Cs,formResetKey:_s,siteDefaultSeo:Ms,onBreadcrumbChange:Pt,onPersistRaw:gr,onInnerChange:hr,onClearForm:vr,onBumpFormKey:xr}):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:f("sectionsEditor.sectionsEditor.seoSchemaNotFound")})]}),ji=o.jsx(Xt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:o.jsx("div",{className:"mx-auto max-w-2xl",children:on&&_?o.jsx(Wr,{rawSeo:Sn,innerSeo:zn,defaultResolveType:Ts,seoSchema:Vs,activeResolveType:jn,seoTypeOptions:Cs,formResetKey:_s,siteDefaultSeo:Ms,onBreadcrumbChange:Pt,onPersistRaw:gr,onInnerChange:hr,onClearForm:vr,onBumpFormKey:xr}):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:f("sectionsEditor.sectionsEditor.seoSchemaNotFound")})})})},"editor-seo"),wi=o.jsxs(Xt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[mt&&_&&o.jsx(Nr,{listKey:_,variants:Ne,activeIndex:ge,decofile:v??{},meta:x,matchers:Yt,onSelect:Zn,onReorder:ur,onRename:fe,onDuplicate:fr,onDelete:dr,onAdd:fn}),mt&&B!==null&&o.jsxs("div",{className:le("px-3 border-b",ee?"pt-3 pb-5 space-y-3":"py-2"),children:[o.jsxs("button",{type:"button",onClick:()=>zt(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":ee,children:[o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:f("sectionsEditor.sectionsEditor.variantRule")}),ee?o.jsx(ma,{className:"size-3.5 shrink-0 text-muted-foreground"}):o.jsx(pa,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),ee&&o.jsx("div",{className:le("space-y-3",Wt&&"pointer-events-none opacity-50"),children:o.jsx(ss,{currentRt:B,currentLabel:gn(ot?.rule,v??{},vt,x??void 0),currentGlobalKey:Vt(ot?.rule,v??{},x??void 0)??void 0,matchers:Yt,globals:Yn,onSelect:Us,onSelectGlobal:Js,schema:Gs,formValue:we,onChange:Ys,formKey:`${ge}:${B??""}`,formWrapperClassName:"space-y-3",meta:x??void 0,decofile:v,onSaveReferencedBlock:tn,sandbox:ln})})]}),Sr]},"editor-section-list");return o.jsx(ra,{children:o.jsxs("div",{className:"flex h-full min-w-0 w-full flex-col",children:[!P&&ts&&o.jsx("div",{className:"flex min-w-0 shrink-0 items-center gap-2 px-3 py-2",children:ts}),(P||En.length>1)&&o.jsx(oa,{crumbs:En,onSelect:es,onSelectRoot:()=>{yn.flush(),U?U():es(0)}}),o.jsx("div",{className:"shrink-0",children:P?o.jsxs("div",{className:le("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:[P&&ts,ut&&o.jsxs(wt,{children:[o.jsx(_t,{asChild:!0,children:o.jsx("span",{className:"shrink-0 cursor-help",children:o.jsx(Pn,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),o.jsx(kt,{side:"bottom",className:"max-w-[260px]",children:f("sectionsEditor.sectionsEditor.globalSectionTooltip")})]}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[o.jsx("span",{className:"truncate text-sm font-semibold",children:ui}),cr&&o.jsx("span",{className:"truncate text-xs text-muted-foreground",children:cr})]}),Xn&&mt&&ot&&o.jsx(Tr,{variants:Ne,activeIndex:ge,onSelect:Zn,onManage:vi,onRemoveAll:fi}),li&&o.jsx(Tr,{variants:Rt,activeIndex:_n,onSelect:$s,onManage:xi,onRemoveAll:zs}),Xn&&!mt&&o.jsx(Nn,{onClick:fn}),ai&&o.jsx(Nn,{onClick:()=>dn()}),o.jsx(ia,{}),Xn&&o.jsxs(o.Fragment,{children:[o.jsxs(wt,{children:[o.jsx(_t,{asChild:!0,children:o.jsx(xt,{type:"button",variant:"outline",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.editSeo"),className:"size-7 shrink-0",onClick:gi,children:o.jsx(Pr,{size:14})})}),o.jsx(kt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.editSeo")})]}),!X&&o.jsxs(wt,{children:[o.jsx(_t,{asChild:!0,children:o.jsx(xt,{type:"button",variant:"outline",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.viewJson"),className:"size-7 shrink-0",onClick:()=>Le(!0),children:o.jsx(Kr,{size:14})})}),o.jsx(kt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.viewJson")})]})]})]}):yi}),lt&&o.jsx(Jl,{open:!0,fields:Ll(lt.plan,lt.target.schema),choices:lt.choices,changedAgain:lt.changedAgain,fresh:lt.fresh,onChoose:(t,r)=>Lo({...lt.choices,[t]:r}),onApply:Fo},Sc(lt.formBase)),pe?o.jsx(Vr,{onAdd:()=>dn(),children:br},"editor-section-variants"):Nt?o.jsxs(Xt,{viewportRef:Ce,onBlur:Ks,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[!P&&At&&Rt.length>0&&I.length===0&&br,o.jsx(Mr,{activeSchema:wn,formValue:je,formResetKey:tt,onFormChange:Fs,onBreadcrumbChange:D,breadcrumbPath:I,emptyMessage:f("sectionsEditor.sectionsEditor.noEditableFieldsForVariant"),meta:x,decofile:v,onSaveReferencedBlock:tn,sandbox:ln,previewBaseUrl:te,onRequestAddSection:Os,onVariantMatcherOp:ae?hi:void 0})]},"editor-section-form"):ae?o.jsx(Xt,{viewportRef:Ce,onBlur:Ks,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx(Mr,{activeSchema:wn,formValue:je,formResetKey:tt,onFormChange:Fs,onBreadcrumbChange:D,breadcrumbPath:I,emptyMessage:f("sectionsEditor.sectionsEditor.noEditableFieldsForGlobalBlock"),meta:x,decofile:v,onSaveReferencedBlock:tn,sandbox:ln,previewBaseUrl:te,onRequestAddSection:Os})},"editor-global-block"):ce?P?o.jsx(Xt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"p-3",children:Si})},"editor-seo"):ji:nt?o.jsx(Vr,{onAdd:fn,children:bi},"editor-variants"):P?o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[o.jsx(Xt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"py-2",children:Sr})}),o.jsx("div",{className:"shrink-0 border-t p-2",children:o.jsx(ms,{canAddSection:Ws,onAddSection:()=>Ae(!0)})})]},"editor-section-list"):wi,o.jsx(aa,{open:ye!==null,onOpenChange:t=>{t||Fe(null)},defaultBlockId:ye!==null?Tn(Me[ye]?.label??""):"",isPending:me.isPending,onSubmit:Zo}),te&&o.jsx(fl,{open:Qe,onOpenChange:t=>{Ae(t),t||(Ge.current=null)},meta:x,decofile:v,previewBaseUrl:te,onSelect:Yo}),We&&_&&v&&o.jsx(ya,{open:We,onOpenChange:Le,pageKey:_,decofile:v}),Te!==null&&o.jsx(Dr,{open:!0,initialName:Ot(Ne[Te]?.rule,v??{},x??void 0)?gn(Ne[Te]?.rule,v??{},vt,x??void 0):"",autoLabel:vt(rs(Ne[Te]?.rule,v??{},x??void 0)),isPending:Wt,onSubmit:async t=>{await mi(Te,t)},onOpenChange:t=>{!t&&!Wt&&fe(null)}}),Ve!==null&&o.jsx(Dr,{open:!0,initialName:Ot(Rt[Ve]?.rule,v??{},x??void 0)?gn(Rt[Ve]?.rule,v??{},vt,x??void 0):"",autoLabel:vt(rs(Rt[Ve]?.rule,v??{},x??void 0)),isPending:Wt,onSubmit:async t=>{await pi(Ve,t)},onOpenChange:t=>{!t&&!Wt&&Pe(null)}})]})})}export{wf as SectionsEditor};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as $,b as A,r as R,l as G,j as s,B as H,p as J,v as K,q as Q,D as U}from"./index-
|
|
1
|
+
import{c as $,b as A,r as R,l as G,j as s,B as H,p as J,v as K,q as Q,D as U}from"./index-CRbDzsEl.js";import{c as V,b as W,a as X,D as Y}from"./drawer-DWjMBwyf.js";import{u as Z}from"./use-mobile-BcwC7VU3.js";import{c as ee}from"./chat-context-NYUfgJBl.js";import{S as q,a as se,M as le,c as te}from"./index-m-B-HtFl.js";function fe(L){const e=$.c(48),{variant:o,className:t,placeholder:n,model:l,isLoading:I,credentialId:P,onCredentialChange:k,onModelChange:b,filterModels:E}=L,z=o===void 0?"borderless":o,w=n===void 0?"Select model":n,r=A(),[a,S]=R.useState(!1),i=b!==void 0,F=Z(),O=z==="borderless"?"ghost":"outline",_=z==="borderless"&&"md:border-none";let d;e[0]!==t||e[1]!==_?(d=G("text-sm hover:bg-accent py-0.5 px-1 gap-1 shadow-none cursor-pointer border-0 group focus-visible:ring-0 focus-visible:ring-offset-0 min-w-0 shrink justify-start overflow-hidden",_,t),e[0]=t,e[1]=_,e[2]=d):d=e[2];let c;e[3]!==I||e[4]!==l||e[5]!==w||e[6]!==i?(c=i?s.jsx(q,{model:l??null,placeholder:w,isLoading:I}):s.jsx(ne,{placeholder:w}),e[3]=I,e[4]=l,e[5]=w,e[6]=i,e[7]=c):c=e[7];let D;e[8]!==O||e[9]!==d||e[10]!==c?(D=s.jsx(H,{variant:O,size:"sm",className:d,children:c}),e[8]=O,e[9]=d,e[10]=c,e[11]=D):D=e[11];const f=D;let y;e[12]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(se,{}),e[12]=y):y=e[12];let N;e[13]!==P||e[14]!==E||e[15]!==l||e[16]!==k||e[17]!==b||e[18]!==i?(N=s.jsx(R.Suspense,{fallback:y,children:i?s.jsx(le,{onClose:()=>S(!1),credentialId:P??null,onCredentialChange:k??oe,selectedModel:l??null,onModelChange:b,filterModels:E}):s.jsx(te,{onClose:()=>S(!1)})}),e[13]=P,e[14]=E,e[15]=l,e[16]=k,e[17]=b,e[18]=i,e[19]=N):N=e[19];const m=N;if(F){let g;e[20]!==f?(g=s.jsx(V,{asChild:!0,children:f}),e[20]=f,e[21]=g):g=e[21];let j;e[22]!==r?(j=r("chat.selectModel.selectModel"),e[22]=r,e[23]=j):j=e[23];let M;e[24]!==j?(M=s.jsx(W,{className:"sr-only",children:j}),e[24]=j,e[25]=M):M=e[25];let v;e[26]!==m?(v=s.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:m}),e[26]=m,e[27]=v):v=e[27];let C;e[28]!==M||e[29]!==v?(C=s.jsxs(X,{className:"p-0 flex flex-col max-h-[95vh]",children:[M,v]}),e[28]=M,e[29]=v,e[30]=C):C=e[30];let T;return e[31]!==a||e[32]!==g||e[33]!==C?(T=s.jsxs(Y,{open:a,onOpenChange:S,children:[g,C]}),e[31]=a,e[32]=g,e[33]=C,e[34]=T):T=e[34],T}let h;e[35]!==f?(h=s.jsx(J,{asChild:!0,children:f}),e[35]=f,e[36]=h):h=e[36];let x;e[37]!==r?(x=r("chat.selectModel.selectModel"),e[37]=r,e[38]=x):x=e[38];let p;e[39]!==x?(p=s.jsx(K,{className:"sr-only",children:x}),e[39]=x,e[40]=p):p=e[40];let u;e[41]!==m||e[42]!==p?(u=s.jsxs(Q,{className:"p-0 gap-0 sm:max-w-fit overflow-hidden h-[100dvh] sm:h-auto max-h-[100dvh] sm:max-h-[85vh] w-full max-w-full sm:max-w-fit rounded-none sm:rounded-xl border-0 sm:border",closeButtonClassName:"top-3.5 right-3.5 z-20",children:[p,m]}),e[41]=m,e[42]=p,e[43]=u):u=e[43];let B;return e[44]!==a||e[45]!==h||e[46]!==u?(B=s.jsxs(U,{open:a,onOpenChange:S,children:[h,u]}),e[44]=a,e[45]=h,e[46]=u,e[47]=B):B=e[47],B}function oe(){}function ne(L){const e=$.c(4),{placeholder:o}=L,{selectedModel:t,isModelsLoading:n}=ee();let l;return e[0]!==n||e[1]!==t||e[2]!==o?(l=s.jsx(q,{model:t,placeholder:o,isLoading:n}),e[0]=n,e[1]=t,e[2]=o,e[3]=l):l=e[3],l}export{fe as M};
|