decocms 4.510.1 → 4.511.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (458) hide show
  1. package/dist/client/assets/ActiveShapeUtils-mwv_2FNw.js +1 -0
  2. package/dist/client/assets/{AlertCircle-C_5mpJjv.js → AlertCircle-DtuasuLO.js} +1 -1
  3. package/dist/client/assets/AreaChart-DKO8O8iD.js +1 -0
  4. package/dist/client/assets/{ArrowLeft-DHCYX1pw.js → ArrowLeft-BFqCKFOZ.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-DKJQ_RL3.js → ArrowUp-SYUTzwu8.js} +1 -1
  6. package/dist/client/assets/BarChart-aoGTWY1e.js +1 -0
  7. package/dist/client/assets/{Building02-IqnVnQlH.js → Building02-B0INzhOK.js} +1 -1
  8. package/dist/client/assets/CartesianChart-yJJthRct.js +1 -0
  9. package/dist/client/assets/{CategoricalChart-C66LowCp.js → CategoricalChart-aEjXOekE.js} +2 -2
  10. package/dist/client/assets/{CheckCircle-BXGWQUO5.js → CheckCircle-D0ZtvGmn.js} +1 -1
  11. package/dist/client/assets/{ChevronSelectorVertical-BgwBwcIG.js → ChevronSelectorVertical-DG_Q06kO.js} +1 -1
  12. package/dist/client/assets/{ChevronUp-eUjdLjUY.js → ChevronUp-D36ghv2t.js} +1 -1
  13. package/dist/client/assets/{Copy01-PY0JiShS.js → Copy01-1-iqu-6x.js} +1 -1
  14. package/dist/client/assets/{CreditCard01-DlWrANt0.js → CreditCard01-EDo1X5AA.js} +1 -1
  15. package/dist/client/assets/{DotsVertical-DMmDiPEd.js → DotsVertical-DM6Nc0dV.js} +1 -1
  16. package/dist/client/assets/{ErrorBarContext-B-z9mpHZ.js → ErrorBarContext-zFVi_tqb.js} +1 -1
  17. package/dist/client/assets/{Globe04-lPlXx7ae.js → Globe04-tj-aFoQD.js} +1 -1
  18. package/dist/client/assets/{Image01-CtwwwWt4.js → Image01-BzaAsspf.js} +1 -1
  19. package/dist/client/assets/{Key01-BCEBdiYn.js → Key01-ClworSEq.js} +1 -1
  20. package/dist/client/assets/{Link01-D2rKPRqH.js → Link01-C_3I56NR.js} +1 -1
  21. package/dist/client/assets/{LinkBroken01-DmYIuqU_.js → LinkBroken01-C4TgOrEQ.js} +1 -1
  22. package/dist/client/assets/{Monitor01-hYg_Be5C.js → Monitor01-D2jcfkyJ.js} +1 -1
  23. package/dist/client/assets/{Play-9-eWzuhH.js → Play-DNXVmQiT.js} +1 -1
  24. package/dist/client/assets/{Plus-G2W3_cG_.js → Plus-uAWge3eB.js} +1 -1
  25. package/dist/client/assets/ReferenceLine-D5eT8BVA.js +1 -0
  26. package/dist/client/assets/{SearchMd-B4Oqfysk.js → SearchMd-CSh6S25i.js} +1 -1
  27. package/dist/client/assets/Sector-DgpevW5C.js +28 -0
  28. package/dist/client/assets/{ShoppingBag01-DLea9vlO.js → ShoppingBag01-Dl4PlAcT.js} +1 -1
  29. package/dist/client/assets/{Sun-DdjCciIh.js → Sun-CjCYzESp.js} +1 -1
  30. package/dist/client/assets/{SwitchHorizontal01-DpCg42GD.js → SwitchHorizontal01-CvgScnq-.js} +1 -1
  31. package/dist/client/assets/{Tool01-Dqha0FcH.js → Tool01-DOvXbUMN.js} +1 -1
  32. package/dist/client/assets/{Trash01-BGnkoc5x.js → Trash01-B9Qm5BDb.js} +1 -1
  33. package/dist/client/assets/{Upload01-Ccm0_Yr0.js → Upload01-BUAYoGEA.js} +1 -1
  34. package/dist/client/assets/{User01-B08N507j.js → User01-Bz9s3Cms.js} +1 -1
  35. package/dist/client/assets/{UserSquare-CGjgJJpx.js → UserSquare-snlYTCQF.js} +1 -1
  36. package/dist/client/assets/{Users01-UYY73YZx.js → Users01-CB1Iep5-.js} +1 -1
  37. package/dist/client/assets/{XClose-BuC3W9yJ.js → XClose-CJyTVouT.js} +1 -1
  38. package/dist/client/assets/{ZoomOut-CGlQyhZZ.js → ZoomOut-DtGWKkcz.js} +1 -1
  39. package/dist/client/assets/{access-gate-DI1CHEOd.js → access-gate-CzqP49uU.js} +1 -1
  40. package/dist/client/assets/{add-connection-dialog-DZOB9TFC.js → add-connection-dialog-m-NKaBEt.js} +1 -1
  41. package/dist/client/assets/agent-analytics-BZpFr_yN.js +2 -0
  42. package/dist/client/assets/agent-app-DFil4Bv_.js +1 -0
  43. package/dist/client/assets/agent-assets-BOHo4n1Q.js +1 -0
  44. package/dist/client/assets/agent-automation-CMrgL2sm.js +20 -0
  45. package/dist/client/assets/agent-automations-Nn4cw633.js +1 -0
  46. package/dist/client/assets/agent-connect-sources-DQy0LrZ3.js +1 -0
  47. package/dist/client/assets/agent-deck-Bxo_Q-ei.js +1 -0
  48. package/dist/client/assets/agent-e2e-BCqDkAAh.js +1 -0
  49. package/dist/client/assets/agent-experiments-CauXSjj6.js +1 -0
  50. package/dist/client/assets/agent-file-D8aDDj-3.js +1 -0
  51. package/dist/client/assets/agent-hosting-Becjke89.js +1 -0
  52. package/dist/client/assets/agent-icon-D3PXiOcC.js +1 -0
  53. package/dist/client/assets/agent-library-DPqg6u_A.js +1 -0
  54. package/dist/client/assets/agent-library-file-DbWlEgCo.js +1 -0
  55. package/dist/client/assets/agent-monitor-BiV7Y5fT.js +1 -0
  56. package/dist/client/assets/agent-overview-w8tJTrW2.js +1 -0
  57. package/dist/client/assets/agent-releases-DibyxNP8.js +2 -0
  58. package/dist/client/assets/agent-settings-DZXnoVvz.js +1 -0
  59. package/dist/client/assets/{agent-site-editor-UEj9ymdW.js → agent-site-editor-Ch8hsGkV.js} +2 -2
  60. package/dist/client/assets/agent-site-editor-code-w-62beeu.js +2 -0
  61. package/dist/client/assets/agent-site-editor-content-FmZpFCN6.js +1 -0
  62. package/dist/client/assets/agent-site-editor-preview-DT1UPREe.js +1 -0
  63. package/dist/client/assets/agent-view-DT0g-b8T.js +1 -0
  64. package/dist/client/assets/{agent-view-guard-CIaDjkgO.js → agent-view-guard-DJzZhTXo.js} +1 -1
  65. package/dist/client/assets/{agents-list-Ipm949Gu.js → agents-list-CsxnQobw.js} +1 -1
  66. package/dist/client/assets/{ai-providers-CM6DAS1m.js → ai-providers-y5f2wWwF.js} +2 -2
  67. package/dist/client/assets/{alert-DlzPIsBG.js → alert-C3kKk-dL.js} +1 -1
  68. package/dist/client/assets/{alert-dialog-C78VlsS8.js → alert-dialog-CLddpsE0.js} +1 -1
  69. package/dist/client/assets/analytics-sections-D2oWLI_C.js +1 -0
  70. package/dist/client/assets/api-keys-BlYX4Voq.js +1 -0
  71. package/dist/client/assets/{api-keys-2xYpKoN4.js → api-keys-EnXXS_ac.js} +1 -1
  72. package/dist/client/assets/app-editor-CF9GVqxJ.js +1 -0
  73. package/dist/client/assets/{asset-utils-BLAfQTG9.js → asset-utils-Aj0AmEaW.js} +1 -1
  74. package/dist/client/assets/{auth-BflPQKZn.js → auth-JljWUhf4.js} +1 -1
  75. package/dist/client/assets/{auth-catchall-c1A8qI2L.js → auth-catchall-v-jB5eNi.js} +1 -1
  76. package/dist/client/assets/{auth-entry-BXhSNyRn.js → auth-entry-UyyVEUrs.js} +1 -1
  77. package/dist/client/assets/{auth-split-layout-CNxJzuB1.js → auth-split-layout-CMnjpufv.js} +1 -1
  78. package/dist/client/assets/{authenticate-and-persist-oauth-BzTDtnbZ.js → authenticate-and-persist-oauth-CFjCVa7x.js} +1 -1
  79. package/dist/client/assets/automation-list-row-C0OwIBYw.js +1 -0
  80. package/dist/client/assets/{automation-runs-DDwtI2d9.js → automation-runs-CkjINuyS.js} +1 -1
  81. package/dist/client/assets/{automations-BEqZF6wm.js → automations-B-DwQyrj.js} +1 -1
  82. package/dist/client/assets/{autosend-CRyjUv4T.js → autosend-P1G4Me3g.js} +1 -1
  83. package/dist/client/assets/{avatar-CyNf-6_F.js → avatar-C9lu-Y_y.js} +1 -1
  84. package/dist/client/assets/{badge-BcuZvLCv.js → badge-B6ke8DzO.js} +1 -1
  85. package/dist/client/assets/{block-document-hVh0X0QB.js → block-document-DfmmmU6v.js} +3 -3
  86. package/dist/client/assets/{blocks-preview-workspace-context-o15kYDJQ.js → blocks-preview-workspace-context-CjhNfj7F.js} +1 -1
  87. package/dist/client/assets/{blocks-tab-states-BKwCm9lP.js → blocks-tab-states-BvyAXDNR.js} +3 -3
  88. package/dist/client/assets/{blog-schema-qHemK5B8.js → blog-schema-DpPR8Wd7.js} +1 -1
  89. package/dist/client/assets/{board-analytics-78XasW_6.js → board-analytics-DjqX1ptj.js} +1 -1
  90. package/dist/client/assets/{buckets-BsJikmLt.js → buckets-CN4IL1fI.js} +1 -1
  91. package/dist/client/assets/{build-improve-prompt-doc-Buqt8O8s.js → build-improve-prompt-doc-X_0TQrgR.js} +1 -1
  92. package/dist/client/assets/{calendar-CtrIZhAO.js → calendar-jnImf3-F.js} +1 -1
  93. package/dist/client/assets/{capability-load-error-nzOkcmq4.js → capability-load-error-BLBe8Obk.js} +1 -1
  94. package/dist/client/assets/category-editor-C00-hmeq.js +1 -0
  95. package/dist/client/assets/{chart-CMTEHEw6.js → chart-CgMhzJYr.js} +2 -2
  96. package/dist/client/assets/chat-context-C2q8Xzrd.js +39 -0
  97. package/dist/client/assets/{chat-draft-Cm_sd3zU.js → chat-draft-lSZv86cr.js} +1 -1
  98. package/dist/client/assets/{checkbox-CxruOoUP.js → checkbox-DgTWMoNQ.js} +1 -1
  99. package/dist/client/assets/{choose-editor-Du7XHIuK.js → choose-editor-BSily-0d.js} +1 -1
  100. package/dist/client/assets/{cli-auth-success-DlriM1Po.js → cli-auth-success-DHZ_qbbK.js} +1 -1
  101. package/dist/client/assets/{client-icons-HhL2TKMQ.js → client-icons-B81ULCGT.js} +1 -1
  102. package/dist/client/assets/cms-settings-editor-D6AJ5L86.js +1 -0
  103. package/dist/client/assets/{collapsible-D-dODAa4.js → collapsible-Bno2lzu1.js} +1 -1
  104. package/dist/client/assets/collection-detail-D4nkfIMH.js +1 -0
  105. package/dist/client/assets/{collection-display-button-DS_TxyYM.js → collection-display-button-DVurHTHt.js} +1 -1
  106. package/dist/client/assets/{collection-search-BDIwJ9FM.js → collection-search-B1Rwoo5a.js} +1 -1
  107. package/dist/client/assets/{collection-table-wrapper-CbaN9l-0.js → collection-table-wrapper-DNpc0ooH.js} +1 -1
  108. package/dist/client/assets/{collection-tabs-Bl4lAJm9.js → collection-tabs-D1DeyrYv.js} +1 -1
  109. package/dist/client/assets/{column-rules-JwowfVQW.js → column-rules-1RsdUJU-.js} +1 -1
  110. package/dist/client/assets/{combobox-Dllz7re1.js → combobox-SRY8n3hS.js} +1 -1
  111. package/dist/client/assets/coming-soon-page-DSuyjZsy.js +1 -0
  112. package/dist/client/assets/{command-B-QWvhA_.js → command-DaCaELsT.js} +1 -1
  113. package/dist/client/assets/{companion-mcps-section-BjaHOfLs.js → companion-mcps-section-DOC7xMTc.js} +1 -1
  114. package/dist/client/assets/{config-1pQ5B4Tw.js → config-CuF5dSqc.js} +1 -1
  115. package/dist/client/assets/{connect-LpHRv3_b.js → connect-B9u1hpyT.js} +2 -2
  116. package/dist/client/assets/{connect-layout-B-fPcn_x.js → connect-layout-CMM8ifYM.js} +1 -1
  117. package/dist/client/assets/{connection-DOHxMDNz.js → connection-BwwtdGYY.js} +1 -1
  118. package/dist/client/assets/{connection-card-DS0hrjdI.js → connection-card-DkgQDzvl.js} +1 -1
  119. package/dist/client/assets/connection-detail-D0xBtKoa.js +1 -0
  120. package/dist/client/assets/{connection-form-helpers-CqklAfZ9.js → connection-form-helpers-Dz8qeNpg.js} +1 -1
  121. package/dist/client/assets/connections-Cl_dMG-8.js +1 -0
  122. package/dist/client/assets/{content-tab-DcT9_Y3z.js → content-tab-BURbscl-.js} +3 -3
  123. package/dist/client/assets/context-DeC8Ey1v.js +1 -0
  124. package/dist/client/assets/{context-menu-DbGA5HxE.js → context-menu-Z8VU03pb.js} +1 -1
  125. package/dist/client/assets/context-shell-BAsh_PAG.js +30 -0
  126. package/dist/client/assets/{core.esm-BwCr9_Tw.js → core.esm-DMFKsXUx.js} +1 -1
  127. package/dist/client/assets/{create-organization-dialog-DLJWbaLa.js → create-organization-dialog-B8ZgAETV.js} +1 -1
  128. package/dist/client/assets/daily-pulse-9-6Bzywz.js +1 -0
  129. package/dist/client/assets/discover-dG6m04Wy.js +1 -0
  130. package/dist/client/assets/{domain-settings-CM8l2WnT.js → domain-settings-BBeXoAin.js} +1 -1
  131. package/dist/client/assets/{drawer-Cq3BAxls.js → drawer-DfQYw24p.js} +1 -1
  132. package/dist/client/assets/{editor-NuI0Xn_R.js → editor-D8dmglIK.js} +1 -1
  133. package/dist/client/assets/{editor-classes-BgXbqk9Z.js → editor-classes-AdVYLXkc.js} +1 -1
  134. package/dist/client/assets/{empty-state-ISs8x_rx.js → empty-state-BbPv5uNQ.js} +1 -1
  135. package/dist/client/assets/{empty-state-CIJntdCH.js → empty-state-Cfb0wost.js} +1 -1
  136. package/dist/client/assets/{extract-connection-data-CoB451kP.js → extract-connection-data-ZLWd2Kp9.js} +1 -1
  137. package/dist/client/assets/{feature-gate-CtaGJnoP.js → feature-gate-DAq4MBCR.js} +1 -1
  138. package/dist/client/assets/{feature-paywall-CyONcQL6.js → feature-paywall-DqoNTxTC.js} +1 -1
  139. package/dist/client/assets/file-explorer-DVjhptju.js +2 -0
  140. package/dist/client/assets/{file-preview-DvnfEKCF.js → file-preview-D1XAB3QG.js} +1 -1
  141. package/dist/client/assets/{file-share-button-BA5tUQu2.js → file-share-button-D2yC0Y8a.js} +1 -1
  142. package/dist/client/assets/{file-type-icon-BL46MEKN.js → file-type-icon-T0ZLi0KO.js} +1 -1
  143. package/dist/client/assets/flat-project-BjRG4lVt.js +1 -0
  144. package/dist/client/assets/{folder-icon-4xXHa81i.js → folder-icon-Dp1y9XKP.js} +1 -1
  145. package/dist/client/assets/{form-Bp7LaVT9.js → form-GDF7KhWe.js} +1 -1
  146. package/dist/client/assets/{format-time-CAj8AQXM.js → format-time-Cq80KKvY.js} +1 -1
  147. package/dist/client/assets/{general-Bh6E3V3Q.js → general-CJrsNBBC.js} +1 -1
  148. package/dist/client/assets/home-B_9-AMte.js +1 -0
  149. package/dist/client/assets/{hosted-publish-feedback-N9HMDmsT.js → hosted-publish-feedback-3XN_JywG.js} +1 -1
  150. package/dist/client/assets/{icon-button-C9KrLn0e.js → icon-button-Cs5D8NvB.js} +1 -1
  151. package/dist/client/assets/{index-bEJ4L1lm.js → index-B4hqDMWY.js} +1 -1
  152. package/dist/client/assets/index-BBLPdjCE.js +1 -0
  153. package/dist/client/assets/{index-DJSBq_Lh.js → index-BORmJcP3.js} +1 -1
  154. package/dist/client/assets/index-BhA3t_Il.js +1 -0
  155. package/dist/client/assets/{index-CSYc5qME.js → index-Bv2yj57U.js} +1 -1
  156. package/dist/client/assets/{index-D7iroYkh.js → index-C9vVnzPQ.js} +14 -14
  157. package/dist/client/assets/{index-BWTgolHq.js → index-CPbmduA8.js} +35 -35
  158. package/dist/client/assets/{index-BlUNN3Lk.js → index-CRDwdyGl.js} +3 -3
  159. package/dist/client/assets/{index-DINB6wYL.js → index-CVhWiD-1.js} +2 -2
  160. package/dist/client/assets/index-Cda4Byiw.js +1 -0
  161. package/dist/client/assets/{index-YyLm63l8.js → index-CmKtrUDs.js} +1 -1
  162. package/dist/client/assets/{index-DB390CpI.js → index-CnTMrZ6H.js} +1 -1
  163. package/dist/client/assets/{index-C6JtWcSk.js → index-CzlgxELX.js} +1 -1
  164. package/dist/client/assets/index-DOrMqENP.js +4 -0
  165. package/dist/client/assets/{index-COOrzuhW.js → index-Dc33YQY0.js} +1 -1
  166. package/dist/client/assets/index-JiORW7MK.css +1 -0
  167. package/dist/client/assets/{index-BikxvQw0.js → index-rIVg2V0k.js} +1 -1
  168. package/dist/client/assets/{index-redirect-DM9K3xx_.js → index-redirect-DUMxPg9t.js} +1 -1
  169. package/dist/client/assets/{infiniteQueryObserver--9_f8LYR.js → infiniteQueryObserver-Cxi7L9ot.js} +1 -1
  170. package/dist/client/assets/infra-billing-BSREAJnB.js +1 -0
  171. package/dist/client/assets/{input-C35o3KBd.js → input-3IxnpkQB.js} +1 -1
  172. package/dist/client/assets/{input-Baf6YXd-.js → input-BWWBSWMZ.js} +4 -4
  173. package/dist/client/assets/{integration-icon-D-o_SFdv.js → integration-icon-CTeTGAEP.js} +1 -1
  174. package/dist/client/assets/{jira-icon-EokGbkDG.js → jira-icon-Ceirp_Vf.js} +1 -1
  175. package/dist/client/assets/{label-CmiFUMkC.js → label-DBthaley.js} +1 -1
  176. package/dist/client/assets/{layout-BufVtMTm.js → layout-DENbqSMD.js} +1 -1
  177. package/dist/client/assets/{legacy-agents-deep-C-X9UOFa.js → legacy-agents-deep-rfUK2WZv.js} +1 -1
  178. package/dist/client/assets/{legacy-main-redirect-BrjKHG_5.js → legacy-main-redirect-C2qoLS_-.js} +1 -1
  179. package/dist/client/assets/library-Cn3L9H-I.js +1 -0
  180. package/dist/client/assets/library-tab-CeLDWfOP.js +168 -0
  181. package/dist/client/assets/{login-ClW-PnuL.js → login-C0VXN3vm.js} +1 -1
  182. package/dist/client/assets/{markdown-x3uYFoCl.js → markdown-DEYGc24v.js} +1 -1
  183. package/dist/client/assets/match-site-slug-config-D3fUJ6vX.js +1 -0
  184. package/dist/client/assets/{mcp-app-renderer-8tc47xXg.js → mcp-app-renderer-CdXSQ5um.js} +1 -1
  185. package/dist/client/assets/{mcp-oauth-Cl83I81f.js → mcp-oauth-D0HIDgk0.js} +1 -1
  186. package/dist/client/assets/{mcp-oauth-CZg9EKL6.js → mcp-oauth-k6NAw0Ub.js} +1 -1
  187. package/dist/client/assets/{members-D3ALurU_.js → members-CVqCwj5f.js} +1 -1
  188. package/dist/client/assets/memory-CcGeGWHF.js +7 -0
  189. package/dist/client/assets/{mini-report-page-DB0BuC9H.js → mini-report-page-BPAZcaBj.js} +1 -1
  190. package/dist/client/assets/{mock-board-fodWPi_O.js → mock-board-Dc1E9hGc.js} +1 -1
  191. package/dist/client/assets/{monaco-editor-BuOntMxA.js → monaco-editor-NVjLW8Z7.js} +1 -1
  192. package/dist/client/assets/monitoring-Dkd5TrLP.js +1 -0
  193. package/dist/client/assets/monitoring-stats-row-BEPDzVh5.js +1 -0
  194. package/dist/client/assets/{multi-select-CSzkliWp.js → multi-select-BuQ3twUw.js} +1 -1
  195. package/dist/client/assets/{mustache-CzzEVjeM.js → mustache-B_aj_azb.js} +1 -1
  196. package/dist/client/assets/{new-project-dialog-CYT_10rE.js → new-project-dialog-OaqxveJn.js} +1 -1
  197. package/dist/client/assets/{oauth-callback-ClKC6YJz.js → oauth-callback-D-bz41RC.js} +1 -1
  198. package/dist/client/assets/{oauth-callback-ai-provider-DwrvoIJV.js → oauth-callback-ai-provider-nReh-xnQ.js} +1 -1
  199. package/dist/client/assets/{onboarding-xsUSMMdi.js → onboarding-D-jSN464.js} +1 -1
  200. package/dist/client/assets/openai-conversation-Ci049tt5.js +3 -0
  201. package/dist/client/assets/{optimistic-project-sidebar-views-D-nD1JgV.js → optimistic-project-sidebar-views-BKAlqzxT.js} +1 -1
  202. package/dist/client/assets/order-monitor-day--ohQi3gE.js +1 -0
  203. package/dist/client/assets/{organization-choice-NxknLolX.js → organization-choice-CjUXbtGe.js} +1 -1
  204. package/dist/client/assets/{orgs-C-epyXcl.js → orgs-DtrnJAw1.js} +1 -1
  205. package/dist/client/assets/{page-seo-form-C5K0Njid.js → page-seo-form-wzQECHi2.js} +1 -1
  206. package/dist/client/assets/{pair-tIjrf8XF.js → pair-CVodhGQi.js} +1 -1
  207. package/dist/client/assets/plan-O5S-elGn.js +1 -0
  208. package/dist/client/assets/{plan-ladder-zOFbRxYr.js → plan-ladder-DVGnZEOW.js} +1 -1
  209. package/dist/client/assets/{popover-BnVaucj1.js → popover-B_8XLqyZ.js} +1 -1
  210. package/dist/client/assets/post-calendar-DJVNjJr8.js +1 -0
  211. package/dist/client/assets/{post-editor-BsLPq9ID.js → post-editor-DZDjtbXP.js} +2 -2
  212. package/dist/client/assets/{preview-content-B9gKwcXg.js → preview-content-BM3-ZBSU.js} +1 -1
  213. package/dist/client/assets/{preview-dialog-BbTrjkeP.js → preview-dialog-CC7RAo1g.js} +1 -1
  214. package/dist/client/assets/{preview-panel-CHxFwJYx.js → preview-panel-dhadN98Y.js} +1 -1
  215. package/dist/client/assets/{preview-tab-BceXq1F5.js → preview-tab-PUNcBACq.js} +3 -3
  216. package/dist/client/assets/{product-picker-dialog-CMLuqSB-.js → product-picker-dialog-Cl3cTuzV.js} +1 -1
  217. package/dist/client/assets/{profile-CFGsczgl.js → profile-Cn1YyigQ.js} +1 -1
  218. package/dist/client/assets/project-app-view-CtFhMgto.js +1 -0
  219. package/dist/client/assets/project-apps-Dlom1kkk.js +1 -0
  220. package/dist/client/assets/project-feed-D4s8id8Q.js +1 -0
  221. package/dist/client/assets/{project-icon-BjvkvrtX.js → project-icon-Dqc3FhU8.js} +1 -1
  222. package/dist/client/assets/project-reports-1QQqzweH.js +1 -0
  223. package/dist/client/assets/project-tasks-D8BzkUei.js +1 -0
  224. package/dist/client/assets/{projects-1AAh_BlA.js → projects-Cjezaj0U.js} +1 -1
  225. package/dist/client/assets/{projects-empty-state-zI3ZCNwE.js → projects-empty-state-DHm8LCZE.js} +1 -1
  226. package/dist/client/assets/{prompts-_ITR86Tr.js → prompts-DmX2JzbX.js} +1 -1
  227. package/dist/client/assets/record-editor-6Vzt1URt.js +1 -0
  228. package/dist/client/assets/redirect-editor-B2epC375.js +1 -0
  229. package/dist/client/assets/reports-BvAHEHPI.js +1 -0
  230. package/dist/client/assets/{reports-D8tSZcp6.js → reports-D-L_fSli.js} +1 -1
  231. package/dist/client/assets/{reports-onboarding-BjY7GizY.js → reports-onboarding-DlOzTlpN.js} +1 -1
  232. package/dist/client/assets/reports-tab-Bow8oNoA.js +2 -0
  233. package/dist/client/assets/repositories-ChaO6Hfw.js +1 -0
  234. package/dist/client/assets/repositories-DM5z_5_6.js +1 -0
  235. package/dist/client/assets/{repository-binding-Cqryn7FJ.js → repository-binding-CNQhpskC.js} +1 -1
  236. package/dist/client/assets/{repository-import-picker-BmFpmoLq.js → repository-import-picker-AF8p3kVM.js} +1 -1
  237. package/dist/client/assets/{repository-picker-CPWce3gZ.js → repository-picker-QcYWbpFV.js} +1 -1
  238. package/dist/client/assets/{require-capability-BCZS-RSh.js → require-capability-DbJTIKMh.js} +1 -1
  239. package/dist/client/assets/{required-auth-layout-DsBgIeQB.js → required-auth-layout-2_g05NTA.js} +1 -1
  240. package/dist/client/assets/{reset-password-LBLcdJ66.js → reset-password-BCwdw6Kl.js} +1 -1
  241. package/dist/client/assets/{resizable-BPpFVX_b.js → resizable-D69BOGKq.js} +1 -1
  242. package/dist/client/assets/{resolve-tab-icon-BTTEWfwO.js → resolve-tab-icon-CUlNWKnV.js} +1 -1
  243. package/dist/client/assets/{review-settings-DpQNPKev.js → review-settings-BzhjGZ6W.js} +1 -1
  244. package/dist/client/assets/{roles-CklezK0_.js → roles-CjTJrN7e.js} +1 -1
  245. package/dist/client/assets/route-C15564gj.js +1 -0
  246. package/dist/client/assets/route-DDy05B4y.js +1 -0
  247. package/dist/client/assets/route-DuC_v8ID.js +1 -0
  248. package/dist/client/assets/{sandbox-lifecycle-context-DDIPcJfQ.js → sandbox-lifecycle-context-DDOjP1WQ.js} +1 -1
  249. package/dist/client/assets/{schema-DeSxsAzw.js → schema-AZdD9rpA.js} +1 -1
  250. package/dist/client/assets/{schema-B-qtNfuo.js → schema-CNm9IoGA.js} +1 -1
  251. package/dist/client/assets/{scroll-area-CKZ1rYUh.js → scroll-area-BlGr7b6I.js} +1 -1
  252. package/dist/client/assets/{search-input-yB471vEF.js → search-input-lMAz-4j_.js} +1 -1
  253. package/dist/client/assets/{search-toggle-vlqdKhgZ.js → search-toggle-FwRkQKFa.js} +1 -1
  254. package/dist/client/assets/{secret-ciphertext-D1Y2ncaV.js → secret-ciphertext-D5wBCSyp.js} +1 -1
  255. package/dist/client/assets/{secret-picker-B2fQMZP8.js → secret-picker-vnDe_RQu.js} +1 -1
  256. package/dist/client/assets/{secrets-B5tFkuGb.js → secrets-D2sc0L0u.js} +1 -1
  257. package/dist/client/assets/sections-Bm_wV70i.js +1 -0
  258. package/dist/client/assets/{sections-editor-OWiH9FAm.js → sections-editor-CABxgqBX.js} +2 -2
  259. package/dist/client/assets/{select-RYdFJcIt.js → select-CCHpsfFL.js} +1 -1
  260. package/dist/client/assets/{select-model-0SwiHcuC.js → select-model-O8Jn-r2H.js} +1 -1
  261. package/dist/client/assets/seo-editor-DcXVXpxs.js +1 -0
  262. package/dist/client/assets/{separator-BKWFQID9.js → separator-D-R0zZI4.js} +1 -1
  263. package/dist/client/assets/settings-tab-CmHoz9WV.js +1 -0
  264. package/dist/client/assets/{sheet-BYbOsi06.js → sheet-BuALHxIa.js} +1 -1
  265. package/dist/client/assets/shell-layout-a9HfPI7R.js +1 -0
  266. package/dist/client/assets/site-editor-BWVPE8cd.js +1 -0
  267. package/dist/client/assets/site-editor-toast-CInlYlum.js +1 -0
  268. package/dist/client/assets/skills-DD29WHfa.js +1 -0
  269. package/dist/client/assets/{slider-uZ4mVffl.js → slider-iRtu-smf.js} +1 -1
  270. package/dist/client/assets/{sortable.esm-3O1jIFmq.js → sortable.esm-C1c5FYmc.js} +1 -1
  271. package/dist/client/assets/{sso-DrReFzDa.js → sso-CXWd_Yo7.js} +1 -1
  272. package/dist/client/assets/{suggestion-I5ZwNhl_.js → suggestion-CC49ULUS.js} +1 -1
  273. package/dist/client/assets/{switch-fgRUjREt.js → switch-rDNRmZ0M.js} +1 -1
  274. package/dist/client/assets/{symbol-B2pDe2FQ.js → symbol-DGtdH9mf.js} +1 -1
  275. package/dist/client/assets/{synced-repos-D8bNraSV.js → synced-repos-DkHqVKs0.js} +1 -1
  276. package/dist/client/assets/{tab-icon-glyph-cpTUkhxS.js → tab-icon-glyph-Crx5IHnE.js} +1 -1
  277. package/dist/client/assets/{table-B9OEL7If.js → table-BkrN1ZSe.js} +1 -1
  278. package/dist/client/assets/{tabs-D9L3rug4.js → tabs-CAwhKbjd.js} +1 -1
  279. package/dist/client/assets/{task-board-Bjq5_jz3.js → task-board-DJFi0JXc.js} +1 -1
  280. package/dist/client/assets/{task-route-DZRvl21p.js → task-route-BfUEwhus.js} +1 -1
  281. package/dist/client/assets/{task-status-qNVoG3-9.js → task-status-ClS_ybJh.js} +1 -1
  282. package/dist/client/assets/taskboard-analytics-DZRpcr3V.js +1 -0
  283. package/dist/client/assets/tasks-APnV722h.js +1 -0
  284. package/dist/client/assets/{tasks-D4Py0tW9.js → tasks-CIRs6_Pe.js} +3 -3
  285. package/dist/client/assets/{textarea-Kr4aIi3A.js → textarea-BfUMZtIE.js} +1 -1
  286. package/dist/client/assets/thread-analytics-DV8tA3hf.js +1 -0
  287. package/dist/client/assets/{thread-intent-qJ1dqLJM.js → thread-intent-BOIQ3B53.js} +2 -2
  288. package/dist/client/assets/thread-route-DrcWuOm9.js +1 -0
  289. package/dist/client/assets/{thread-route-DC0mp3BO.js → thread-route-K6yJcJk5.js} +1 -1
  290. package/dist/client/assets/{thread-sheet-body-5bC5OZfg.js → thread-sheet-body-Cp7nZJGR.js} +1 -1
  291. package/dist/client/assets/time-range-picker-CoA0ndtk.js +1 -0
  292. package/dist/client/assets/{toggle-group-DnaF1PQV.js → toggle-group-DLT9jdhU.js} +1 -1
  293. package/dist/client/assets/{tool-namespace-DegzbfIi.js → tool-namespace-Myhapgv_.js} +1 -1
  294. package/dist/client/assets/{toolbar-icon-button-CjG7UFqX.js → toolbar-icon-button-Dmy4JfBj.js} +1 -1
  295. package/dist/client/assets/{tooltip-B0tBatFZ.js → tooltip-K3ljr4Cw.js} +1 -1
  296. package/dist/client/assets/{tooltipContext-B5ONSa-l.js → tooltipContext-CKpftZJ5.js} +1 -1
  297. package/dist/client/assets/{track-LRGDEOn5.js → track-BWBpVOcQ.js} +1 -1
  298. package/dist/client/assets/{types-A-yzlqDN.js → types-CpRdG9MN.js} +1 -1
  299. package/dist/client/assets/{url-slug-B7sbsR9H.js → url-slug-BogkV_jr.js} +1 -1
  300. package/dist/client/assets/{usage-stats-8eWtc14k.js → usage-stats-BgwDcuEm.js} +1 -1
  301. package/dist/client/assets/{use-ai-providers-BMOLf5Wc.js → use-ai-providers-Dcpvu19a.js} +1 -1
  302. package/dist/client/assets/{use-automations-5u7y3Hek.js → use-automations-CW0iNjGh.js} +1 -1
  303. package/dist/client/assets/{use-autosave-CvTS6VPC.js → use-autosave-CtFSvvsc.js} +1 -1
  304. package/dist/client/assets/use-chat-layout-state-CUQiISez.js +1 -0
  305. package/dist/client/assets/{use-clock-tick-BbJsFu3S.js → use-clock-tick-D6Bkvbtv.js} +1 -1
  306. package/dist/client/assets/{use-connect-companion-Caioph4A.js → use-connect-companion-jozTDYFH.js} +1 -1
  307. package/dist/client/assets/{use-connection-bHRGa4D5.js → use-connection-Drdp4Oae.js} +1 -1
  308. package/dist/client/assets/{use-content-sync-BshptKwx.js → use-content-sync-Cf-G-HLy.js} +1 -1
  309. package/dist/client/assets/{use-copy-C9iHKqw8.js → use-copy-OcGQNTqc.js} +1 -1
  310. package/dist/client/assets/{use-create-virtual-mcp-D-Emba8T.js → use-create-virtual-mcp-DGKOxUnh.js} +1 -1
  311. package/dist/client/assets/{use-date-fns-locale-Ca8zBjMd.js → use-date-fns-locale-Jp8EFehb.js} +1 -1
  312. package/dist/client/assets/{use-debounced-autosave-DYdm3TR4.js → use-debounced-autosave-YIvfP9wT.js} +1 -1
  313. package/dist/client/assets/{use-debounced-value-jBgiXQfM.js → use-debounced-value-Gwk4Ne2C.js} +1 -1
  314. package/dist/client/assets/use-deco-credits-Dikx1lUd.js +1 -0
  315. package/dist/client/assets/{use-decopilot-events-ysmV_SCO.js → use-decopilot-events-HXgpTe5E.js} +1 -1
  316. package/dist/client/assets/{use-delete-connection-DNqpXDgu.js → use-delete-connection-1akTigeP.js} +1 -1
  317. package/dist/client/assets/{use-deployment-admin-Bd0XTutb.js → use-deployment-admin-Cdrp-Eoq.js} +1 -1
  318. package/dist/client/assets/{use-ensure-project-folder-D2yC-JzE.js → use-ensure-project-folder-CjepmXm1.js} +1 -1
  319. package/dist/client/assets/{use-fast-preview-draft-url-CkUGrT_h.js → use-fast-preview-draft-url-zUUbbH36.js} +1 -1
  320. package/dist/client/assets/{use-file-configs-BCJkIjUG.js → use-file-configs-DAsYJwg1.js} +1 -1
  321. package/dist/client/assets/{use-infinite-scroll-Dpw4RwvE.js → use-infinite-scroll-Cdv4OhOH.js} +1 -1
  322. package/dist/client/assets/{use-join-requests-DBLRrDyF.js → use-join-requests-ggWhDjmd.js} +1 -1
  323. package/dist/client/assets/use-main-panel-tabs-CuF1fqci.js +1 -0
  324. package/dist/client/assets/use-main-schema-v8-DIVJCCM7.js +1 -0
  325. package/dist/client/assets/{use-mcp-auth-status-DKUh8Z7y.js → use-mcp-auth-status-AM23Rfrd.js} +1 -1
  326. package/dist/client/assets/{use-mcp-client-BTt1-Bfm.js → use-mcp-client-rcSUj48s.js} +1 -1
  327. package/dist/client/assets/{use-mcp-prompts-D9cdv5uS.js → use-mcp-prompts-DVth4qgJ.js} +1 -1
  328. package/dist/client/assets/{use-mcp-tools-BJPex7_L.js → use-mcp-tools-C_oaQYVh.js} +1 -1
  329. package/dist/client/assets/{use-members-DBl1yLtB.js → use-members-D-3ReVz2.js} +1 -1
  330. package/dist/client/assets/{use-mobile-DI4rDMbJ.js → use-mobile-BsFKc79k.js} +1 -1
  331. package/dist/client/assets/use-navigate-to-agent-DM90tSAB.js +1 -0
  332. package/dist/client/assets/{use-open-billing-url-Cz3PKkrp.js → use-open-billing-url-DqAcEClU.js} +1 -1
  333. package/dist/client/assets/{use-org-auth-client-CuzUG7PP.js → use-org-auth-client-D8DO5P0C.js} +1 -1
  334. package/dist/client/assets/{use-org-fs-CJ1tjqaY.js → use-org-fs-Dgh9z93n.js} +1 -1
  335. package/dist/client/assets/{use-org-repo-syncs-DGL3dBDQ.js → use-org-repo-syncs-B6HLHnEN.js} +1 -1
  336. package/dist/client/assets/{use-org-sso-MEPKdW59.js → use-org-sso-B3aedyMX.js} +1 -1
  337. package/dist/client/assets/{use-organization-roles-DdhRLZ4J.js → use-organization-roles-CHvoZLEJ.js} +1 -1
  338. package/dist/client/assets/{use-organization-settings-BHJG9JUa.js → use-organization-settings-Di06ldcM.js} +1 -1
  339. package/dist/client/assets/{use-panel-navigate-D4pXDoq7.js → use-panel-navigate-BXUuA5Ec.js} +1 -1
  340. package/dist/client/assets/use-project-native-view-presence-CoRioR3P.js +1 -0
  341. package/dist/client/assets/{use-project-scope-BXg9r_gM.js → use-project-scope-CIQ_5yia.js} +1 -1
  342. package/dist/client/assets/use-recent-apps-B4IbQq7b.js +1 -0
  343. package/dist/client/assets/{use-releases-COVKfxrt.js → use-releases-BJH2Fcze.js} +1 -1
  344. package/dist/client/assets/{use-reports-diagnostic-CUzSO-Ov.js → use-reports-diagnostic-czXQfQFD.js} +1 -1
  345. package/dist/client/assets/use-secrets-34xBxBrv.js +1 -0
  346. package/dist/client/assets/{use-section-preview-base-DtWueBQ4.js → use-section-preview-base-V3QjGUxY.js} +1 -1
  347. package/dist/client/assets/use-sidebar-collapsed-C-9VPIvl.js +1 -0
  348. package/dist/client/assets/{use-tags-CLep2MYM.js → use-tags-D8zxsmHq.js} +1 -1
  349. package/dist/client/assets/use-task-board-analytics-h4vz0RZN.js +1 -0
  350. package/dist/client/assets/{use-task-board-events-NONcWdI0.js → use-task-board-events-CJaU8iB9.js} +1 -1
  351. package/dist/client/assets/{use-task-board-item-prs-BWE9V8VG.js → use-task-board-item-prs-Bbcz56Cy.js} +1 -1
  352. package/dist/client/assets/{use-task-board-items-C2mDupi6.js → use-task-board-items-Cjilb3vU.js} +1 -1
  353. package/dist/client/assets/{use-task-metadata-CZgAw_o9.js → use-task-metadata-5PYU2TV-.js} +1 -1
  354. package/dist/client/assets/{use-thread-analytics-CArPM_JS.js → use-thread-analytics-Bge2dWCG.js} +1 -1
  355. package/dist/client/assets/{use-thread-outputs-C7byoUOG.js → use-thread-outputs-dVUFY4Dm.js} +1 -1
  356. package/dist/client/assets/useInfiniteQuery-BE9sCIYq.js +1 -0
  357. package/dist/client/assets/{useQueries-BBEEmrg3.js → useQueries-9ywyN6qt.js} +1 -1
  358. package/dist/client/assets/useSuspenseInfiniteQuery-Dq-LBGK4.js +1 -0
  359. package/dist/client/assets/{users-D8QTitdA.js → users-RR5nObJH.js} +1 -1
  360. package/dist/client/assets/{utils-B1Tu2D-6.js → utils-BgIMGxAp.js} +1 -1
  361. package/dist/client/assets/variant-calendar-ClwCgPPC.js +1 -0
  362. package/dist/client/assets/{variant-draft-pointer-BuTJy5L-.js → variant-draft-pointer-miKgr3lt.js} +1 -1
  363. package/dist/client/assets/{view-mode-toggle-ChNomyKu.js → view-mode-toggle-zk0YkHDW.js} +1 -1
  364. package/dist/client/assets/{virtual-mcp-k92bg8nG.js → virtual-mcp-DQTg0L_z.js} +1 -1
  365. package/dist/client/assets/{watch-sse-pool--mvXzQUp.js → watch-sse-pool-u85EAaSx.js} +1 -1
  366. package/dist/client/index.html +2 -2
  367. package/dist/server/server.js +1 -1
  368. package/package.json +1 -1
  369. package/dist/client/assets/ActiveShapeUtils-D90uwixk.js +0 -1
  370. package/dist/client/assets/AreaChart-DQ8fSDWu.js +0 -1
  371. package/dist/client/assets/BarChart-Gg2B8Zys.js +0 -1
  372. package/dist/client/assets/Sector-B1SBgZlq.js +0 -28
  373. package/dist/client/assets/XAxis-B4VtMcW_.js +0 -1
  374. package/dist/client/assets/agent-analytics-B5TV-KZu.js +0 -2
  375. package/dist/client/assets/agent-app-BXzRctUC.js +0 -1
  376. package/dist/client/assets/agent-assets-ALBqHa_9.js +0 -1
  377. package/dist/client/assets/agent-automation-CJx7el9c.js +0 -20
  378. package/dist/client/assets/agent-automations-CBdbFfEA.js +0 -1
  379. package/dist/client/assets/agent-connect-sources-hl-1-yt3.js +0 -1
  380. package/dist/client/assets/agent-deck-B_aVburO.js +0 -1
  381. package/dist/client/assets/agent-e2e-DodSRZBG.js +0 -1
  382. package/dist/client/assets/agent-experiments-bHBZK30C.js +0 -1
  383. package/dist/client/assets/agent-file-ChawivAK.js +0 -1
  384. package/dist/client/assets/agent-hosting-_C9di64Q.js +0 -1
  385. package/dist/client/assets/agent-icon-BHy2guMB.js +0 -1
  386. package/dist/client/assets/agent-library-BIyQBYDz.js +0 -1
  387. package/dist/client/assets/agent-library-file-BeYRAO3O.js +0 -1
  388. package/dist/client/assets/agent-monitor-RRH0nOFj.js +0 -1
  389. package/dist/client/assets/agent-overview-DMAPlUkF.js +0 -1
  390. package/dist/client/assets/agent-releases-BbRXEf9D.js +0 -2
  391. package/dist/client/assets/agent-settings-DcUC0LZG.js +0 -1
  392. package/dist/client/assets/agent-site-editor-code-CaeN0nnV.js +0 -2
  393. package/dist/client/assets/agent-site-editor-content-_LB-LMtV.js +0 -1
  394. package/dist/client/assets/agent-site-editor-preview-CT1wC41M.js +0 -1
  395. package/dist/client/assets/agent-view-By-YFMZK.js +0 -1
  396. package/dist/client/assets/analytics-sections-BzODh-x_.js +0 -1
  397. package/dist/client/assets/api-keys-DiCCNJ4r.js +0 -1
  398. package/dist/client/assets/app-editor-DWOa-9BF.js +0 -1
  399. package/dist/client/assets/automation-list-row-JorhAYZ-.js +0 -1
  400. package/dist/client/assets/category-editor-BBGiih96.js +0 -1
  401. package/dist/client/assets/chat-context-Bmqpsy6W.js +0 -39
  402. package/dist/client/assets/cms-settings-editor-4TD7AqSx.js +0 -1
  403. package/dist/client/assets/collection-detail-CWNPmZ4y.js +0 -1
  404. package/dist/client/assets/connection-detail-yk8D2Ycp.js +0 -1
  405. package/dist/client/assets/connections-DZRME_wK.js +0 -1
  406. package/dist/client/assets/context-DuyQB36H.js +0 -1
  407. package/dist/client/assets/daily-pulse-C4KVb8yE.js +0 -1
  408. package/dist/client/assets/discover-CF0wv3hZ.js +0 -1
  409. package/dist/client/assets/file-explorer-CCTWbr-M.js +0 -2
  410. package/dist/client/assets/flat-project-Df6mlDsC.js +0 -1
  411. package/dist/client/assets/home-CwtQgYEu.js +0 -1
  412. package/dist/client/assets/index-B8G9G8Hy.js +0 -1
  413. package/dist/client/assets/index-CdItoagM.css +0 -1
  414. package/dist/client/assets/index-D3e5iYr8.js +0 -1
  415. package/dist/client/assets/index-VjHMgva3.js +0 -1
  416. package/dist/client/assets/infra-billing-D-dZHhrL.js +0 -1
  417. package/dist/client/assets/library-CrV5fO9b.js +0 -1
  418. package/dist/client/assets/library-tab-Dm4VUi0b.js +0 -168
  419. package/dist/client/assets/memory-Bmm18X0J.js +0 -7
  420. package/dist/client/assets/monitoring-stats-row-8jzTtKCw.js +0 -1
  421. package/dist/client/assets/openai-conversation-CUWYpCqT.js +0 -3
  422. package/dist/client/assets/order-monitor-day-CRPxfT1J.js +0 -1
  423. package/dist/client/assets/post-calendar-CklqBMe1.js +0 -1
  424. package/dist/client/assets/project-app-view-BlmwFdlj.js +0 -1
  425. package/dist/client/assets/project-feed-BZ5qEA--.js +0 -1
  426. package/dist/client/assets/project-reports-XALwLDF4.js +0 -1
  427. package/dist/client/assets/project-tasks-BfDeKIG_.js +0 -1
  428. package/dist/client/assets/record-editor-CZIkgsD6.js +0 -1
  429. package/dist/client/assets/redirect-editor-LEWMCbq4.js +0 -1
  430. package/dist/client/assets/reports-BW7Hu0gn.js +0 -1
  431. package/dist/client/assets/reports-tab-CMlaQyAw.js +0 -2
  432. package/dist/client/assets/repositories-3KkmiQg9.js +0 -1
  433. package/dist/client/assets/route-CgRduuSn.js +0 -1
  434. package/dist/client/assets/route-DUAG_rGK.js +0 -1
  435. package/dist/client/assets/route-I9sr7jYv.js +0 -1
  436. package/dist/client/assets/seo-editor-BXCK7xdF.js +0 -1
  437. package/dist/client/assets/settings-tab-lU5sKX0b.js +0 -4
  438. package/dist/client/assets/shell-layout-Dcul1J_F.js +0 -1
  439. package/dist/client/assets/site-editor-DrDmGuX8.js +0 -1
  440. package/dist/client/assets/site-editor-toast-BSfvx_3Z.js +0 -1
  441. package/dist/client/assets/skills-B4JMW-n4.js +0 -1
  442. package/dist/client/assets/taskboard-analytics-CTvMhPaL.js +0 -1
  443. package/dist/client/assets/tasks-COblaCD7.js +0 -1
  444. package/dist/client/assets/thread-analytics-D3YcXUrL.js +0 -1
  445. package/dist/client/assets/thread-route-WIP_d1e0.js +0 -1
  446. package/dist/client/assets/time-range-picker-Dw2gGPU4.js +0 -1
  447. package/dist/client/assets/use-app-takeover-DsMhIKmL.js +0 -1
  448. package/dist/client/assets/use-chat-navigation-B8uZT3IY.js +0 -1
  449. package/dist/client/assets/use-deco-credits-DOas_6vk.js +0 -1
  450. package/dist/client/assets/use-main-panel-tabs-CEvdjLCw.js +0 -1
  451. package/dist/client/assets/use-navigate-to-agent-dXBkiNwU.js +0 -1
  452. package/dist/client/assets/use-project-native-view-presence-IG7UX4r0.js +0 -1
  453. package/dist/client/assets/use-recent-apps-DEQ4fuNJ.js +0 -1
  454. package/dist/client/assets/use-secrets-BA4OirG9.js +0 -1
  455. package/dist/client/assets/use-task-board-analytics-B6tQFJXc.js +0 -1
  456. package/dist/client/assets/useInfiniteQuery-uo1MiygM.js +0 -1
  457. package/dist/client/assets/useSuspenseInfiniteQuery-qJNKvmwf.js +0 -1
  458. package/dist/client/assets/variant-calendar-DuI_DA8j.js +0 -1
@@ -1,4 +1,4 @@
1
- import{c as it,b as Ft,r as R,l as ae,j as i,b4 as Li,B as _t,U as sn,aw as $i,X as zi,V as Hi,a as xo,F as Wi,K as yo,m as qi,o as Gi,h as Ui,t as oe}from"./index-BWTgolHq.js";import{u as Yi}from"./chat-context-Bmqpsy6W.js";import{a5 as Ji,T as Wn,a6 as Qi,a7 as Zi,a8 as Xi,a9 as ea,aa as ta,ab as na,ac as Br,ad as sa,ae as ra,G as jt,af as wt,ag as ze,ah as oa,H as Fn,E as On,b as ia,j as aa,u as la,ai as Kr,q as ca,aj as ua,s as da,o as fa,ak as So,p as _n,al as ma,am as pa,A as Fr,an as ha,ao as ga,ap as Bn,aq as Or,ar as Lr,as as $r,at as us,au as va,av as xa,F as ya,aw as zr,ax as Sa,ay as Hr,az as Wr,M as ba,aA as qr,a as ja,aB as Sn,aC as wa,aD as _a,aE as bn,aF as ds}from"./blocks-tab-states-BKwCm9lP.js";import{c as ka}from"./repository-binding-Cqryn7FJ.js";import{n as Ea,t as Ra}from"./ChevronUp-eUjdLjUY.js";import{a8 as bo,b as zn,an as Aa,D as Ca,a1 as Gr,Z as Ur}from"./agent-icon-BHy2guMB.js";import{S as rn}from"./scroll-area-CKZ1rYUh.js";import{c as kt,T as Et,a as Rt}from"./tooltip-B0tBatFZ.js";import{am as Na,g as Yr,J as Ta,u as Va,K as Da,w as Ma,ab as Pa,x as Ia,d as Pt,f as It,a7 as Ba,ar as Ka}from"./site-editor-toast-BSfvx_3Z.js";import{m as Fa,u as Oa,P as La}from"./mustache-CzzEVjeM.js";import{az as $a,k as Rs,aB as jo,H as za,aC as xt,aD as vs,aE as wo,aj as Gt,a8 as xs,aF as ys,ak as Kt,a9 as on,q as Ha,t as Wa,g as qa,x as Kn,ar as Ga,ai as jn,aa as fs,ah as Bt,ag as wn,aG as Ua,P as Ya,aH as Ja,al as Jr,a1 as Qr,aI as Qa,aJ as qt,aK as Za,aL as Xa,aM as el,aN as Zr,aO as tl,aP as nl,aQ as sl,af as rl,aR as ol,aS as il,aT as al,aU as ll,ae as cl,aV as ul}from"./secret-ciphertext-D1Y2ncaV.js";import{a as dl}from"./Copy01-PY0JiShS.js";import{a as Ss,e as _o}from"./UserSquare-CGjgJJpx.js";import{i as Xr}from"./Tool01-Dqha0FcH.js";import{s as eo}from"./Image01-CtwwwWt4.js";import{s as fl}from"./Plus-G2W3_cG_.js";import{s as ml}from"./Trash01-BGnkoc5x.js";import{i as bs}from"./ZoomOut-CGlQyhZZ.js";import{u as pl,a as to,K as hl,P as gl,b as vl,C as xl,D as yl,c as Sl}from"./core.esm-BwCr9_Tw.js";import{u as bl,s as jl,a as Ln,S as wl,v as _l}from"./sortable.esm-3O1jIFmq.js";import{s as kl,g as El,u as Rl,A as Al}from"./use-section-preview-base-DtWueBQ4.js";import{A as ms}from"./avatar-CyNf-6_F.js";import{e as Cl,d as no,b as Nl,A as Tl,a as Vl,f as Dl}from"./alert-dialog-C78VlsS8.js";import{b as Ml}from"./format-time-CAj8AQXM.js";import{d as Pl}from"./shell-layout-Dcul1J_F.js";import{u as Il}from"./use-members-DBl1yLtB.js";import{a as Bl,P as so,b as Kl}from"./page-seo-form-C5K0Njid.js";import{c as ro,d as oo,e as Fl,f as Ol}from"./variant-draft-pointer-BuTJy5L-.js";import"./use-panel-navigate-D4pXDoq7.js";import"./thread-route-DC0mp3BO.js";import"./use-project-scope-BXg9r_gM.js";import"./autosend-CRyjUv4T.js";import"./thread-intent-qJ1dqLJM.js";import"./use-mcp-client-BTt1-Bfm.js";import"./auth-BflPQKZn.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./watch-sse-pool--mvXzQUp.js";import"./task-board-Bjq5_jz3.js";import"./schema-B-qtNfuo.js";import"./slugify-CEUa2lfQ.js";import"./use-decopilot-events-ysmV_SCO.js";import"./use-ai-providers-BMOLf5Wc.js";import"./use-chat-navigation-B8uZT3IY.js";import"./location-BjlyegC2.js";import"./use-organization-settings-BHJG9JUa.js";import"./input-Baf6YXd-.js";import"./usage-stats-8eWtc14k.js";import"./tool-namespace-DegzbfIi.js";import"./form-Bp7LaVT9.js";import"./label-CmiFUMkC.js";import"./utils-CVEq3hMx.js";import"./markdown-x3uYFoCl.js";import"./use-copy-C9iHKqw8.js";import"./use-mobile-DI4rDMbJ.js";import"./XClose-BuC3W9yJ.js";import"./icon-button-C9KrLn0e.js";import"./file-type-icon-BL46MEKN.js";import"./chat-draft-Cm_sd3zU.js";import"./LinkBroken01-DmYIuqU_.js";import"./ArrowUp-DKJQ_RL3.js";import"./ShoppingBag01-DLea9vlO.js";import"./Upload01-Ccm0_Yr0.js";import"./AlertCircle-C_5mpJjv.js";import"./select-RYdFJcIt.js";import"./index-BdQq_4o_.js";import"./index-DJSBq_Lh.js";import"./ArrowLeft-DHCYX1pw.js";import"./tabs-D9L3rug4.js";import"./use-deco-credits-DOas_6vk.js";import"./toggle-group-DnaF1PQV.js";import"./use-open-billing-url-Cz3PKkrp.js";import"./index-bEJ4L1lm.js";import"./checkbox-CxruOoUP.js";import"./ChevronSelectorVertical-BgwBwcIG.js";import"./Key01-BCEBdiYn.js";import"./SearchMd-B4Oqfysk.js";import"./ai-providers-logos-DD3qZ33J.js";import"./Monitor01-hYg_Be5C.js";import"./popover-BnVaucj1.js";import"./drawer-Cq3BAxls.js";import"./input-C35o3KBd.js";import"./suggestion-I5ZwNhl_.js";import"./use-mcp-prompts-D9cdv5uS.js";import"./use-org-fs-CJ1tjqaY.js";import"./useInfiniteQuery-uo1MiygM.js";import"./infiniteQueryObserver--9_f8LYR.js";import"./Link01-D2rKPRqH.js";import"./question-004-sINsf4GQ.js";import"./feature-paywall-CyONcQL6.js";import"./plan-ladder-zOFbRxYr.js";import"./add-connection-dialog-DZOB9TFC.js";import"./collection-search-BDIwJ9FM.js";import"./extract-connection-data-CoB451kP.js";import"./metadata-D72DunRR.js";import"./connection-DOHxMDNz.js";import"./url-slug-B7sbsR9H.js";import"./connection-card-DS0hrjdI.js";import"./connection-slug-CITJ0kGN.js";import"./integration-icon-D-o_SFdv.js";import"./textarea-Kr4aIi3A.js";import"./use-connection-bHRGa4D5.js";import"./schema-DeSxsAzw.js";import"./connection-form-helpers-CqklAfZ9.js";import"./authenticate-and-persist-oauth-BzTDtnbZ.js";import"./mcp-oauth-CZg9EKL6.js";import"./mcp-oauth-Cl83I81f.js";import"./collection-tabs-Bl4lAJm9.js";import"./badge-BcuZvLCv.js";import"./use-infinite-scroll-Dpw4RwvE.js";import"./useSuspenseInfiniteQuery-qJNKvmwf.js";import"./use-task-board-events-NONcWdI0.js";import"./use-project-native-view-presence-IG7UX4r0.js";import"./use-file-configs-BCJkIjUG.js";import"./site-slug-DebpOoQq.js";import"./utils-B1Tu2D-6.js";import"./Play-9-eWzuhH.js";import"./sandbox-start-errors-BK_aDCyt.js";import"./pair-tIjrf8XF.js";import"./collapsible-D-dODAa4.js";import"./use-clock-tick-BbJsFu3S.js";import"./content-blocks-o63cs2vh.js";import"./mcp-app-renderer-8tc47xXg.js";import"./types-A-yzlqDN.js";import"./omit-sandbox-map-jj4lCB2U.js";import"./sheet-BYbOsi06.js";import"./use-navigate-to-agent-dXBkiNwU.js";import"./use-thread-outputs-C7byoUOG.js";import"./switch-fgRUjREt.js";import"./command-B-QWvhA_.js";import"./index-YyLm63l8.js";import"./monaco-editor-BuOntMxA.js";import"./editor-NuI0Xn_R.js";import"./calendar-CtrIZhAO.js";import"./SwitchHorizontal01-DpCg42GD.js";import"./editor-classes-BgXbqk9Z.js";import"./view-mode-toggle-ChNomyKu.js";import"./combobox-Dllz7re1.js";import"./DotsVertical-DMmDiPEd.js";import"./search-input-yB471vEF.js";import"./use-debounced-value-jBgiXQfM.js";import"./asset-utils-BLAfQTG9.js";import"./sandbox-git-api-CRxdlhrN.js";import"./sandbox-url-D3mC8qhT.js";import"./empty-state-CIJntdCH.js";import"./Building02-IqnVnQlH.js";import"./CheckCircle-BXGWQUO5.js";import"./CreditCard01-DlWrANt0.js";import"./Globe04-lPlXx7ae.js";import"./Sun-DdjCciIh.js";import"./User01-B08N507j.js";import"./Users01-UYY73YZx.js";import"./index-COOrzuhW.js";import"./alert-DlzPIsBG.js";import"./section-preview-url-7zfngvgW.js";import"./differenceInSeconds-C3x8sHUj.js";import"./project-icon-BjvkvrtX.js";import"./new-project-dialog-CYT_10rE.js";import"./repository-import-picker-BmFpmoLq.js";import"./repository-picker-CPWce3gZ.js";import"./required-auth-layout-DsBgIeQB.js";import"./use-org-sso-MEPKdW59.js";import"./use-org-auth-client-CuzUG7PP.js";const Ll={escape:Ji};function $l(n,e){for(const s of kl(n,e)){const o=typeof s.title=="string"?s.title:void 0;if(o?.includes("{{"))return o}}function zl(n,e){if(!e)return;const s=$a(n);if(s)try{const o=$l(s.resolveType,e);return o&&Fa.render(o,s.data,{},Ll).trim()||void 0}catch{return}}function Hl(n){const e=it.c(13),{icon:s,label:o,className:a}=n;let u;e[0]!==a?(u=ae("size-3.5",a),e[0]=a,e[1]=u):u=e[1];let h;e[2]!==s||e[3]!==u?(h=i.jsx(s,{className:u}),e[2]=s,e[3]=u,e[4]=h):h=e[4];let d;e[5]!==o||e[6]!==h?(d=i.jsx(Et,{asChild:!0,children:i.jsx("span",{role:"img","aria-label":o,className:"shrink-0 cursor-help",children:h})}),e[5]=o,e[6]=h,e[7]=d):d=e[7];let v;e[8]!==o?(v=i.jsx(Rt,{className:"max-w-56",children:o}),e[8]=o,e[9]=v):v=e[9];let m;return e[10]!==d||e[11]!==v?(m=i.jsxs(kt,{children:[d,v]}),e[10]=d,e[11]=v,e[12]=m):m=e[12],m}const Wl="text-global-section-fg focus:bg-global-section/12 focus:text-global-section-fg dark:text-global-section-fg-dark dark:focus:bg-global-section/15 dark:focus:text-global-section-fg-dark [&_svg]:!text-global-section";function io(n){return Array.from({length:n},(e,s)=>({id:crypto.randomUUID(),index:s}))}function ko(n){return n.map((e,s)=>({...e,index:s}))}function ql(n,e){if(e===n.length)return n;if(e<n.length)return ko(n.slice(0,e));const s=Array.from({length:e-n.length},(o,a)=>({id:crypto.randomUUID(),index:n.length+a}));return[...n,...s]}function Eo(n){const e=it.c(44),{section:s,raw:o,meta:a,decofile:u}=n,h=Ft(),d=Wn(),v=s.isSavedBlock===!0,m=s.isMultivariate===!0;let j;e[0]!==a||e[1]!==o?(j=o&&a?El(o,a):void 0,e[0]=a,e[1]=o,e[2]=j):j=e[2];const A=j;let $;e[3]!==a||e[4]!==m||e[5]!==o||e[6]!==v?($=o&&a&&!v&&!m?zl(o,a):void 0,e[3]=a,e[4]=m,e[5]=o,e[6]=v,e[7]=$):$=e[7];const z=$;let H;e[8]!==u||e[9]!==a||e[10]!==o||e[11]!==s?(H=na(o,s,u,a),e[8]=u,e[9]=a,e[10]=o,e[11]=s,e[12]=H):H=e[12];const F=H;let f;e[13]!==m||e[14]!==o?.__resolveType?(f=!m&&Rs(o?.__resolveType??""),e[13]=m,e[14]=o?.__resolveType,e[15]=f):f=e[15];const k=f,Z=v?zn:m?bo:_o;let w;e[16]!==m||e[17]!==v?(w=v?{color:za}:m?{color:"oklch(0.65 0.15 160)"}:void 0,e[16]=m,e[17]=v,e[18]=w):w=e[18];const I=w;let V;e[19]!==Z||e[20]!==d?(V=d?i.jsxs("span",{className:"relative size-4 shrink-0",children:[i.jsx(Z,{className:"absolute inset-0 size-4 text-muted-foreground transition-opacity group-hover:opacity-0 group-has-[:focus-visible]:opacity-0"}),i.jsx(ra,{"aria-hidden":!0,className:"absolute inset-0 size-4 opacity-0 transition-opacity group-hover:opacity-100 group-has-[:focus-visible]:opacity-100"})]}):i.jsx(Aa,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[19]=Z,e[20]=d,e[21]=V):V=e[21];let y;e[22]!==A?(y=A&&i.jsx("img",{src:A,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded-[var(--studio-control-radius,var(--radius))] object-cover"}),e[22]=A,e[23]=y):y=e[23];let C;e[24]!==d||e[25]!==I?(C=!d&&i.jsx(Ss,{className:"h-4 w-4 shrink-0",style:I}),e[24]=d,e[25]=I,e[26]=C):C=e[26];const x=d?"shrink":"flex-1",Y=s.isHidden&&"line-through opacity-50";let M;e[27]!==Y||e[28]!==x?(M=ae("min-w-0 truncate text-sm font-medium",x,Y),e[27]=Y,e[28]=x,e[29]=M):M=e[29];const ge=z??s.label;let me;e[30]!==M||e[31]!==ge?(me=i.jsx("span",{className:M,children:ge}),e[30]=M,e[31]=ge,e[32]=me):me=e[32];let le;e[33]!==k||e[34]!==d||e[35]!==F||e[36]!==h?(le=d?i.jsxs(i.Fragment,{children:[k&&i.jsx(Hl,{icon:bs,label:h("sectionsEditor.sectionList.asyncBadge"),className:"text-muted-foreground"}),F&&i.jsx(Br,{}),i.jsx("span",{className:"min-w-0 flex-1"})]}):F&&i.jsx(Br,{className:"absolute -right-0.5 -top-0.5"}),e[33]=k,e[34]=d,e[35]=F,e[36]=h,e[37]=le):le=e[37];let ee;return e[38]!==me||e[39]!==le||e[40]!==V||e[41]!==y||e[42]!==C?(ee=i.jsxs(i.Fragment,{children:[V,y,C,me,le]}),e[38]=me,e[39]=le,e[40]=V,e[41]=y,e[42]=C,e[43]=ee):ee=e[43],ee}const Gl="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",Ul="text-[oklch(0.45_0.15_160)] hover:bg-[oklch(0.65_0.15_160/0.12)] dark:text-[oklch(0.78_0.15_160)] dark:hover:bg-[oklch(0.65_0.15_160/0.15)]";function Ro(n,e,s){if(s)return sa({selected:e});const o=n.isSavedBlock===!0,a=n.isMultivariate===!0;return ae("group relative flex select-none items-center gap-2 rounded-[var(--studio-control-radius,var(--radius-md))] px-2 py-2.5",e?"bg-accent text-accent-foreground":o?Gl:a?Ul:"text-foreground/80 hover:bg-accent hover:text-accent-foreground")}function ps(n,e){return ae("h-7 shrink-0 overflow-hidden",e?"w-7 ml-0 opacity-100 [transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]":n?"w-7 ml-0 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:opacity-100 group-has-[:focus-visible]:opacity-100":"w-0 -ml-2 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:ml-0 group-hover:w-7 group-hover:opacity-100 group-hover:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms] group-has-[:focus-visible]:ml-0 group-has-[:focus-visible]:w-7 group-has-[:focus-visible]:opacity-100 group-has-[:focus-visible]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]")}function Yl(n){const e=it.c(90),{section:s,raw:o,meta:a,decofile:u,sortableId:h,selected:d,onSelect:v,onDelete:m,onDuplicate:j,onMakeReusable:A,onToggleHidden:$,onToggleLazy:z,onAddVariant:H,onDetach:F}=n,f=Ft(),k=Wn(),Z=o?Rs(o.__resolveType??""):!1,w=s.isHidden===!0,I=Z||w;let V;e[0]!==s?(V=jo(s),e[0]=s,e[1]=V):V=e[1];const y=V,C=!!z&&!s.isMultivariate;let x;e[2]!==h?(x={id:h,animateLayoutChanges:Zl},e[2]=h,e[3]=x):x=e[3];const{attributes:Y,listeners:M,setNodeRef:ge,transform:me,isDragging:le}=bl(x);let ee;e[4]!==me?(ee=xl.Transform.toString(me?{...me,x:0}:null),e[4]=me,e[5]=ee):ee=e[5];const pe=le?0:void 0;let ce;e[6]!==ee||e[7]!==pe?(ce={transform:ee,opacity:pe},e[6]=ee,e[7]=pe,e[8]=ce):ce=e[8];const he=ce;let ve;e[9]!==s?(ve=Zi(s),e[9]=s,e[10]=ve):ve=e[10];const b=ve,B="button",xe=0;let T;e[11]!==v?(T=re=>{(re.key==="Enter"||re.key===" ")&&(re.preventDefault(),v())},e[11]=v,e[12]=T):T=e[12];const ye=le?"cursor-grabbing":"cursor-pointer";let K;e[13]!==k||e[14]!==s||e[15]!==d||e[16]!==ye?(K=ae("touch-none transition-colors",ye,Ro(s,d,k)),e[13]=k,e[14]=s,e[15]=d,e[16]=ye,e[17]=K):K=e[17];let Se;e[18]!==u||e[19]!==a||e[20]!==o||e[21]!==s?(Se=i.jsx(Eo,{section:s,raw:o,meta:a,decofile:u}),e[18]=u,e[19]=a,e[20]=o,e[21]=s,e[22]=Se):Se=e[22];const ue=!k&&C&&i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"ghost",size:"icon","aria-label":f(Z?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender"),className:ae(ps(I,Z)),onClick:re=>{re.stopPropagation(),z?.()},onPointerDown:Ql,children:i.jsx(bs,{className:ae("h-3.5 w-3.5",Z&&"text-warning")})})}),i.jsx(Rt,{side:"bottom",children:f(Z?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")})]}),te=k?i.jsx(Xi,{label:f(w?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),active:w,onToggle:$,children:w?i.jsx(Xr,{className:"h-3.5 w-3.5"}):i.jsx(eo,{className:"h-3.5 w-3.5"})}):i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"ghost",size:"icon","aria-label":f(w?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),className:ae(ps(I,w)),onClick:re=>{re.stopPropagation(),$()},onPointerDown:Jl,children:w?i.jsx(Xr,{className:"h-3.5 w-3.5"}):i.jsx(eo,{className:"h-3.5 w-3.5"})})}),i.jsx(Rt,{side:"bottom",children:f(w?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection")})]}),se=zi,Te=ea;let X;e[23]!==f?(X=f("sectionsEditor.sectionList.sectionActionsMenu"),e[23]=f,e[24]=X):X=e[24];const _e=ae(ps(I,!1),"data-[state=open]:ml-0 data-[state=open]:w-7 data-[state=open]:opacity-100 data-[state=open]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]");let be;e[25]!==Te||e[26]!==X||e[27]!==_e?(be=i.jsx(Te,{label:X,classicClassName:_e}),e[25]=Te,e[26]=X,e[27]=_e,e[28]=be):be=e[28];let q;e[29]!==k||e[30]!==C||e[31]!==Z||e[32]!==z||e[33]!==f?(q=k&&C&&i.jsxs(i.Fragment,{children:[i.jsxs(sn,{onClick:re=>{re.stopPropagation(),z?.()},children:[i.jsx(bs,{className:"h-4 w-4"}),f(Z?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")]}),i.jsx($i,{})]}),e[29]=k,e[30]=C,e[31]=Z,e[32]=z,e[33]=f,e[34]=q):q=e[34];let O;e[35]!==j?(O=re=>{re.stopPropagation(),j()},e[35]=j,e[36]=O):O=e[36];let Ke;e[37]===Symbol.for("react.memo_cache_sentinel")?(Ke=i.jsx(dl,{className:"h-4 w-4"}),e[37]=Ke):Ke=e[37];let Qe;e[38]!==f?(Qe=f("sectionsEditor.sectionList.duplicateMenuItem"),e[38]=f,e[39]=Qe):Qe=e[39];let Ze;e[40]!==O||e[41]!==Qe?(Ze=i.jsxs(sn,{onClick:O,children:[Ke,Qe]}),e[40]=O,e[41]=Qe,e[42]=Ze):Ze=e[42];let Ye;e[43]!==k||e[44]!==y||e[45]!==H||e[46]!==f?(Ye=y&&i.jsxs(sn,{className:ae(!k&&ta),onClick:re=>{re.stopPropagation(),H()},children:[i.jsx(bo,{className:"h-4 w-4"}),f("sectionsEditor.sectionList.addVariantMenuItem")]}),e[43]=k,e[44]=y,e[45]=H,e[46]=f,e[47]=Ye):Ye=e[47];let Q;e[48]!==k||e[49]!==b||e[50]!==A||e[51]!==f?(Q=b&&i.jsxs(sn,{className:ae(!k&&Wl),onClick:re=>{re.stopPropagation(),A()},children:[k?i.jsx(zn,{className:"h-4 w-4"}):i.jsx(Ss,{className:"h-4 w-4"}),f("sectionsEditor.sectionList.makeReusableMenuItem")]}),e[48]=k,e[49]=b,e[50]=A,e[51]=f,e[52]=Q):Q=e[52];let ke;e[53]!==k||e[54]!==F||e[55]!==s.isMultivariate||e[56]!==s.isSavedBlock||e[57]!==f?(ke=s.isSavedBlock===!0&&!s.isMultivariate&&i.jsxs(sn,{onClick:re=>{re.stopPropagation(),F()},children:[k?i.jsx(_o,{className:"h-4 w-4"}):i.jsx(Ss,{className:"h-4 w-4"}),f("sectionsEditor.sectionList.detachMenuItem")]}),e[53]=k,e[54]=F,e[55]=s.isMultivariate,e[56]=s.isSavedBlock,e[57]=f,e[58]=ke):ke=e[58];let He;e[59]!==m?(He=re=>{re.stopPropagation(),m()},e[59]=m,e[60]=He):He=e[60];let We;e[61]===Symbol.for("react.memo_cache_sentinel")?(We=i.jsx(ml,{className:"h-4 w-4"}),e[61]=We):We=e[61];let Ee;e[62]!==f?(Ee=f("sectionsEditor.sectionList.deleteMenuItem"),e[62]=f,e[63]=Ee):Ee=e[63];let Ie;e[64]!==He||e[65]!==Ee?(Ie=i.jsxs(sn,{variant:"destructive",onClick:He,children:[We,Ee]}),e[64]=He,e[65]=Ee,e[66]=Ie):Ie=e[66];let Ve;e[67]!==q||e[68]!==Ze||e[69]!==Ye||e[70]!==Q||e[71]!==ke||e[72]!==Ie?(Ve=i.jsxs(Hi,{align:"end",className:"w-44",children:[q,Ze,Ye,Q,ke,Ie]}),e[67]=q,e[68]=Ze,e[69]=Ye,e[70]=Q,e[71]=ke,e[72]=Ie,e[73]=Ve):Ve=e[73];let Xe;e[74]!==se||e[75]!==be||e[76]!==Ve?(Xe=i.jsxs(se,{children:[be,Ve]}),e[74]=se,e[75]=be,e[76]=Ve,e[77]=Xe):Xe=e[77];let Fe;return e[78]!==Y||e[79]!==M||e[80]!==v||e[81]!==ge||e[82]!==he||e[83]!==K||e[84]!==Se||e[85]!==ue||e[86]!==te||e[87]!==Xe||e[88]!==T?(Fe=i.jsxs("div",{ref:ge,style:he,...Y,...M,role:B,tabIndex:xe,onClick:v,onKeyDown:T,className:K,children:[Se,ue,te,Xe]}),e[78]=Y,e[79]=M,e[80]=v,e[81]=ge,e[82]=he,e[83]=K,e[84]=Se,e[85]=ue,e[86]=te,e[87]=Xe,e[88]=T,e[89]=Fe):Fe=e[89],Fe}function Jl(n){return n.stopPropagation()}function Ql(n){return n.stopPropagation()}function Zl(){return!1}function js(n){const e=it.c(11),{canAddSection:s,onAddSection:o,className:a,size:u}=n,h=Ft();let d;e[0]!==a?(d=ae("w-full",a),e[0]=a,e[1]=d):d=e[1];const v=!s;let m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=i.jsx(fl,{size:14}),e[2]=m):m=e[2];let j;e[3]!==h?(j=h("sectionsEditor.sectionList.addSectionButton"),e[3]=h,e[4]=j):j=e[4];let A;return e[5]!==o||e[6]!==u||e[7]!==d||e[8]!==v||e[9]!==j?(A=i.jsxs(_t,{type:"button",variant:"outline",size:u,className:d,disabled:v,onClick:o,children:[m,j]}),e[5]=o,e[6]=u,e[7]=d,e[8]=v,e[9]=j,e[10]=A):A=e[10],A}function Xl(n){const e=it.c(101),{listKey:s,rawSections:o,sections:a,meta:u,decofile:h,selectedIndex:d,onSelect:v,onReorder:m,onDelete:j,onDuplicate:A,onMakeReusable:$,onToggleHidden:z,onToggleLazy:H,onAddVariant:F,onDetach:f,onAddSection:k,canAddSection:Z}=n,w=Z===void 0?!0:Z,I=Ft(),V=Wn();let y;e[0]!==a.length?(y=()=>io(a.length),e[0]=a.length,e[1]=y):y=e[1];const[C,x]=R.useState(y),[Y,M]=R.useState(null),[ge,me]=R.useState(s),[le,ee]=R.useState(a.length),pe=R.useRef(!1);ge!==s?(me(s),ee(a.length),x(io(a.length))):le!==a.length&&(ee(a.length),x(dt=>ql(dt,a.length)));let ce;e[2]===Symbol.for("react.memo_cache_sentinel")?(ce={activationConstraint:{distance:8}},e[2]=ce):ce=e[2];let he;e[3]===Symbol.for("react.memo_cache_sentinel")?(he={coordinateGetter:jl},e[3]=he):he=e[3];const ve=pl(to(gl,ce),to(hl,he));let b;e[4]!==C?(b=C.map(ec),e[4]=C,e[5]=b):b=e[5];const B=b;let xe;e[6]===Symbol.for("react.memo_cache_sentinel")?(xe=dt=>{M(String(dt.active.id))},e[6]=xe):xe=e[6];const T=xe;let ye;e[7]!==B||e[8]!==m?(ye=dt=>{M(null);const{active:ne,over:De}=dt;if(!De||ne.id===De.id)return;const yt=B.indexOf(String(ne.id)),et=B.indexOf(String(De.id));yt===-1||et===-1||(x(ft=>ko(Ln([...ft],yt,et))),pe.current=!0,requestAnimationFrame(()=>{pe.current=!1}),m?.(yt,et))},e[7]=B,e[8]=m,e[9]=ye):ye=e[9];const K=ye;let Se;e[10]===Symbol.for("react.memo_cache_sentinel")?(Se=()=>{M(null)},e[10]=Se):Se=e[10];const ue=Se;let te,se,Te,X,_e,be,q,O,Ke,Qe,Ze,Ye,Q,ke,He;if(e[11]!==Y||e[12]!==w||e[13]!==V||e[14]!==h||e[15]!==C||e[16]!==B||e[17]!==K||e[18]!==u||e[19]!==k||e[20]!==F||e[21]!==j||e[22]!==f||e[23]!==A||e[24]!==$||e[25]!==v||e[26]!==z||e[27]!==H||e[28]!==o||e[29]!==a||e[30]!==d||e[31]!==ve||e[32]!==I){ke=Symbol.for("react.early_return_sentinel");e:{const dt=ne=>{pe.current||v(ne)};if(e[48]!==Y||e[49]!==w||e[50]!==V||e[51]!==C||e[52]!==k||e[53]!==o||e[54]!==a||e[55]!==I){const ne=Y?C.find(De=>De.id===Y):null;if(X=ne!=null?a[ne.index]:null,Te=ne!=null?o[ne.index]:void 0,C.length===0){let De;e[59]!==I?(De=I("sectionsEditor.sectionList.noSections"),e[59]=I,e[60]=De):De=e[60];let yt;e[61]!==De?(yt=i.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:De}),e[61]=De,e[62]=yt):yt=e[62];const et=yt;let ft;e[63]!==w||e[64]!==V||e[65]!==et||e[66]!==k?(ft=V?et:i.jsxs("div",{className:"space-y-2",children:[et,i.jsx(js,{canAddSection:w,onAddSection:k,size:"sm"})]}),e[63]=w,e[64]=V,e[65]=et,e[66]=k,e[67]=ft):ft=e[67],ke=ft;break e}Q=ae(ne&&"cursor-grabbing"),e[48]=Y,e[49]=w,e[50]=V,e[51]=C,e[52]=k,e[53]=o,e[54]=a,e[55]=I,e[56]=Te,e[57]=X,e[58]=Q}else Te=e[56],X=e[57],Q=e[58];se=yl,O=ve,Ke=Sl,Qe=T,Ze=K,Ye=ue,te=wl,be=B,q=_l,He="space-y-1",_e=C.map(ne=>{const De=a[ne.index];return De?i.jsx(Yl,{sortableId:ne.id,section:De,raw:o[ne.index],meta:u,decofile:h,selected:d===ne.index,onSelect:()=>dt(ne.index),onDelete:()=>j(ne.index),onDuplicate:()=>A(ne.index),onMakeReusable:()=>$(ne.index),onToggleHidden:()=>z(ne.index),onToggleLazy:H?()=>H(ne.index):void 0,onAddVariant:()=>F(ne.index),onDetach:()=>f(ne.index)},ne.id):null})}e[11]=Y,e[12]=w,e[13]=V,e[14]=h,e[15]=C,e[16]=B,e[17]=K,e[18]=u,e[19]=k,e[20]=F,e[21]=j,e[22]=f,e[23]=A,e[24]=$,e[25]=v,e[26]=z,e[27]=H,e[28]=o,e[29]=a,e[30]=d,e[31]=ve,e[32]=I,e[33]=te,e[34]=se,e[35]=Te,e[36]=X,e[37]=_e,e[38]=be,e[39]=q,e[40]=O,e[41]=Ke,e[42]=Qe,e[43]=Ze,e[44]=Ye,e[45]=Q,e[46]=ke,e[47]=He}else te=e[33],se=e[34],Te=e[35],X=e[36],_e=e[37],be=e[38],q=e[39],O=e[40],Ke=e[41],Qe=e[42],Ze=e[43],Ye=e[44],Q=e[45],ke=e[46],He=e[47];if(ke!==Symbol.for("react.early_return_sentinel"))return ke;let We;e[68]!==_e||e[69]!==He?(We=i.jsx("div",{className:He,children:_e}),e[68]=_e,e[69]=He,e[70]=We):We=e[70];let Ee;e[71]!==te||e[72]!==be||e[73]!==q||e[74]!==We?(Ee=i.jsx(te,{items:be,strategy:q,children:We}),e[71]=te,e[72]=be,e[73]=q,e[74]=We,e[75]=Ee):Ee=e[75];let Ie;e[76]!==Te||e[77]!==X||e[78]!==V||e[79]!==h||e[80]!==u?(Ie=X?i.jsx("div",{className:ae("cursor-grabbing shadow-lg ring-1 ring-border/60",Ro(X,!1,V)),children:i.jsx(Eo,{section:X,raw:Te,meta:u,decofile:h})}):null,e[76]=Te,e[77]=X,e[78]=V,e[79]=h,e[80]=u,e[81]=Ie):Ie=e[81];let Ve;e[82]!==Ie?(Ve=Li.createPortal(i.jsx(vl,{dropAnimation:Qi,children:Ie}),document.body),e[82]=Ie,e[83]=Ve):Ve=e[83];let Xe;e[84]!==se||e[85]!==O||e[86]!==Ke||e[87]!==Qe||e[88]!==Ze||e[89]!==Ye||e[90]!==Ee||e[91]!==Ve?(Xe=i.jsxs(se,{sensors:O,collisionDetection:Ke,onDragStart:Qe,onDragEnd:Ze,onDragCancel:Ye,children:[Ee,Ve]}),e[84]=se,e[85]=O,e[86]=Ke,e[87]=Qe,e[88]=Ze,e[89]=Ye,e[90]=Ee,e[91]=Ve,e[92]=Xe):Xe=e[92];let Fe;e[93]!==w||e[94]!==V||e[95]!==k?(Fe=!V&&i.jsx(js,{canAddSection:w,onAddSection:k,size:"sm",className:"mt-2"}),e[93]=w,e[94]=V,e[95]=k,e[96]=Fe):Fe=e[96];let re;return e[97]!==Q||e[98]!==Xe||e[99]!==Fe?(re=i.jsxs("div",{className:Q,children:[Xe,Fe]}),e[97]=Q,e[98]=Xe,e[99]=Fe,e[100]=re):re=e[100],re}function ec(n){return n.id}function hs(n,e,s,o){if(!n||!e)return null;if(!e.isMultivariate)return jt(n,e,o)?.data??null;const a=xt(n,e),u=a?vs(a,wt)[s]:void 0;return u?wo(u.value,o)?.data??null:null}const tc=50;function nc(n,e){n.own.push(ze(e)),n.own.length>tc&&n.own.shift()}function ao(n,e){return n.own.includes(ze(e))}function sc(n,e){const{sectionIndex:s,variantIndex:o,shown:a,next:u,sectionCount:h}=e;return n&&n.sectionIndex===s&&n.variantIndex===o&&n.emitted===a?(n.emitted=u,n):a?{sectionIndex:s,variantIndex:o,base:a,emitted:u,sectionCount:h,own:[ze(a)]}:null}function Ao(n,e){return e!==null&&ze(n)!==ze(e)}function Co(n,e){return n.__resolveType!==e.__resolveType}function rc(n,e,s,o){if(e.length===o)return"here";const a=ze(n),u=e.flatMap((h,d)=>d!==s&&h!==null&&ze(h)===a?[d]:[]);return u.length===1?u[0]:"unknown"}function lo({formBase:n,rebased:e,versionOf:s}){let o=null;return{ifMatch:a=>{o=a,n&&(n.version===void 0||e)&&(n.version=s(a));const u=n?n.version:s(a);return u===void 0?void 0:{[a]:u}},onApplied:a=>{n&&o!==null&&Object.hasOwn(a,o)&&(n.version=a[o])},reloadOnConflict:!0}}function oc({merged:n,tracked:e,current:s,saved:o}){return!!n&&!!e&&s===e&&e.emitted===o}function co(n,e){return!!n&&!!e&&n.contains(e)}function ws(n){const e=[],s=_s("",n.ancestor,n.mine,n.theirs,e);return{...n,merged:s,pointers:e}}function _s(n,e,s,o,a){const u=(h,d)=>ze(h)===ze(d);if(u(s,o)||u(e,o))return s;if(u(e,s))return o;if(gs(s)&&gs(o)){const h=gs(e)?e:{},d={},v=[...Object.keys(s),...Object.keys(o).filter(m=>!(m in s))];for(const m of v){const j=_s(`${n}/${m.replaceAll("~","~0").replaceAll("/","~1")}`,h[m],s[m],o[m],a);j!==void 0&&(d[m]=j)}return d}return Array.isArray(e)&&Array.isArray(s)&&Array.isArray(o)&&s.length===e.length&&o.length===e.length?e.map((h,d)=>_s(`${n}/${d}`,h,s[d],o[d],a)):(a.push(n),o)}function gs(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}function ic(n,e){let s=n.merged;for(const o of n.pointers)e[o]==="mine"&&(s=uc(s,o,Ut(n.mine,o)));return s}function ac(n,e){return Object.fromEntries(n.pointers.map(s=>[s,e]))}function No(n){return ac(n,"mine")}function ks(n,e,s){const o=No(s);for(const a of s.pointers){const u=e[a];if(!u||!n.pointers.includes(a))continue;["mine","theirs"].every(d=>ze(Ut(n[d],a))===ze(Ut(s[d],a)))&&(o[a]=u)}return o}function To(n,e,s={}){const o=e.pointers.filter(a=>!n.pointers.includes(a)||ze(Ut(n.theirs,a))!==ze(Ut(e.theirs,a)));return o.length===0?s:{...s,...Object.fromEntries(o.map(a=>[a,(s[a]??0)+1]))}}function lc(n,e,s){if(!e||Co(n.plan.ancestor,e)||!Ao(n.plan.theirs,e)||s(e))return null;const o=ws({...n.plan,theirs:e});return o.pointers.length===0?null:{plan:o,choices:ks(n.plan,n.choices,o),fresh:To(n.plan,o,n.fresh)}}function cc(n,e){return n.pointers.map(s=>({pointer:s,label:oa(s,e),mine:Ut(n.mine,s),theirs:Ut(n.theirs,s),schema:dc(e??null,s)}))}function As(n){return n.split("/").slice(1).map(e=>e.replaceAll("~1","/").replaceAll("~0","~"))}function Ut(n,e){let s=n;for(const o of As(e))if(Array.isArray(s))s=s[Number(o)];else if(s&&typeof s=="object")s=s[o];else return;return s}function uc(n,e,s){const o=As(e),a=(u,h)=>{if(h===o.length)return s;const d=o[h];if(Array.isArray(u)){const j=[...u];return j[Number(d)]=a(u[Number(d)],h+1),j}const v=u&&typeof u=="object"?{...u}:{},m=a(v[d],h+1);return m===void 0?delete v[d]:v[d]=m,v};return a(n,0)}function dc(n,e){let s=n;for(const o of As(e)){if(!s)return null;s=/^\d+$/.test(o)&&!s.properties?.[o]?s.items:s.properties?.[o]}return s??null}const fc=/\.(png|jpe?g|gif|webp|avif|svg)(\?.*)?$/i,uo=60,mc=3;function Vo(n,e){return e?.format==="image-uri"?!0:n.startsWith("data:image/")||/^(https?:)?\/\//.test(n)&&fc.test(n)}function Es(n,e){if(!(e?.format==="rich-text"||e?.format==="rich-text-inline"||e?.format==="html"||/<\/?[a-z][^>]*>/i.test(n)))return n;const o=n.replace(/<br\s*\/?>/gi,`
1
+ import{c as it,b as Ft,r as R,l as ae,j as i,b4 as Li,B as _t,U as sn,ag as $i,X as zi,V as Hi,a as xo,F as Wi,K as yo,m as qi,o as Gi,h as Ui,t as oe}from"./index-CPbmduA8.js";import{u as Yi}from"./chat-context-C2q8Xzrd.js";import{a5 as Ji,T as Wn,a6 as Qi,a7 as Xi,a8 as Zi,a9 as ea,aa as ta,ab as na,ac as Br,ad as sa,ae as ra,G as jt,af as wt,ag as ze,ah as oa,H as Fn,E as On,b as ia,j as aa,u as la,ai as Kr,q as ca,aj as ua,s as da,o as fa,ak as So,p as _n,al as ma,am as pa,A as Fr,an as ha,ao as ga,ap as Bn,aq as Or,ar as Lr,as as $r,at as us,au as va,av as xa,F as ya,aw as zr,ax as Sa,ay as Hr,az as Wr,M as ba,aA as qr,a as ja,aB as Sn,aC as wa,aD as _a,aE as bn,aF as ds}from"./blocks-tab-states-BvyAXDNR.js";import{c as ka}from"./repository-binding-CNQhpskC.js";import{n as Ea,t as Ra}from"./ChevronUp-D36ghv2t.js";import{ac as bo,b as zn,ar as Aa,G as Ca,a5 as Gr,a1 as Ur}from"./agent-icon-D3PXiOcC.js";import{S as rn}from"./scroll-area-BlGr7b6I.js";import{c as kt,T as Et,a as Rt}from"./tooltip-K3ljr4Cw.js";import{am as Na,g as Yr,J as Ta,u as Va,K as Ma,w as Da,ab as Pa,x as Ia,d as Pt,f as It,a7 as Ba,ar as Ka}from"./site-editor-toast-CInlYlum.js";import{m as Fa,u as Oa,P as La}from"./mustache-B_aj_azb.js";import{az as $a,k as Rs,aB as jo,H as za,aC as xt,aD as vs,aE as wo,aj as Gt,a8 as xs,aF as ys,ak as Kt,a9 as on,q as Ha,t as Wa,g as qa,x as Kn,ar as Ga,ai as jn,aa as fs,ah as Bt,ag as wn,aG as Ua,P as Ya,aH as Ja,al as Jr,a1 as Qr,aI as Qa,aJ as qt,aK as Xa,aL as Za,aM as el,aN as Xr,aO as tl,aP as nl,aQ as sl,af as rl,aR as ol,aS as il,aT as al,aU as ll,ae as cl,aV as ul}from"./secret-ciphertext-D5wBCSyp.js";import{a as dl}from"./Copy01-1-iqu-6x.js";import{a as Ss,f as _o}from"./UserSquare-snlYTCQF.js";import{i as Zr}from"./Tool01-DOvXbUMN.js";import{s as eo}from"./Image01-BzaAsspf.js";import{s as fl}from"./Plus-uAWge3eB.js";import{s as ml}from"./Trash01-B9Qm5BDb.js";import{i as bs}from"./ZoomOut-DtGWKkcz.js";import{u as pl,a as to,K as hl,P as gl,b as vl,C as xl,D as yl,c as Sl}from"./core.esm-DMFKsXUx.js";import{u as bl,s as jl,a as Ln,S as wl,v as _l}from"./sortable.esm-C1c5FYmc.js";import{s as kl,g as El,u as Rl,A as Al}from"./use-section-preview-base-V3QjGUxY.js";import{A as ms}from"./avatar-C9lu-Y_y.js";import{e as Cl,d as no,b as Nl,A as Tl,a as Vl,f as Ml}from"./alert-dialog-CLddpsE0.js";import{b as Dl}from"./format-time-Cq80KKvY.js";import{d as Pl}from"./shell-layout-a9HfPI7R.js";import{u as Il}from"./use-members-D-3ReVz2.js";import{a as Bl,P as so,b as Kl}from"./page-seo-form-wzQECHi2.js";import{c as ro,d as oo,e as Fl,f as Ol}from"./variant-draft-pointer-miKgr3lt.js";import"./use-panel-navigate-BXUuA5Ec.js";import"./thread-route-K6yJcJk5.js";import"./use-project-scope-CIQ_5yia.js";import"./autosend-P1G4Me3g.js";import"./thread-intent-BOIQ3B53.js";import"./use-mcp-client-rcSUj48s.js";import"./auth-JljWUhf4.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./watch-sse-pool-u85EAaSx.js";import"./task-board-DJFi0JXc.js";import"./schema-CNm9IoGA.js";import"./slugify-CEUa2lfQ.js";import"./use-decopilot-events-HXgpTe5E.js";import"./use-ai-providers-Dcpvu19a.js";import"./location-BjlyegC2.js";import"./use-organization-settings-Di06ldcM.js";import"./input-BWWBSWMZ.js";import"./usage-stats-BgwDcuEm.js";import"./tool-namespace-Myhapgv_.js";import"./form-GDF7KhWe.js";import"./label-DBthaley.js";import"./utils-CVEq3hMx.js";import"./markdown-DEYGc24v.js";import"./use-copy-OcGQNTqc.js";import"./use-mobile-BsFKc79k.js";import"./XClose-CJyTVouT.js";import"./icon-button-Cs5D8NvB.js";import"./file-type-icon-T0ZLi0KO.js";import"./chat-draft-lSZv86cr.js";import"./LinkBroken01-C4TgOrEQ.js";import"./ArrowUp-SYUTzwu8.js";import"./ShoppingBag01-Dl4PlAcT.js";import"./Upload01-BUAYoGEA.js";import"./AlertCircle-DtuasuLO.js";import"./select-CCHpsfFL.js";import"./index-BdQq_4o_.js";import"./index-BORmJcP3.js";import"./ArrowLeft-BFqCKFOZ.js";import"./tabs-CAwhKbjd.js";import"./use-deco-credits-Dikx1lUd.js";import"./toggle-group-DLT9jdhU.js";import"./use-open-billing-url-DqAcEClU.js";import"./index-B4hqDMWY.js";import"./checkbox-DgTWMoNQ.js";import"./ChevronSelectorVertical-DG_Q06kO.js";import"./Key01-ClworSEq.js";import"./SearchMd-CSh6S25i.js";import"./ai-providers-logos-DD3qZ33J.js";import"./Monitor01-D2jcfkyJ.js";import"./popover-B_8XLqyZ.js";import"./drawer-DfQYw24p.js";import"./input-3IxnpkQB.js";import"./suggestion-CC49ULUS.js";import"./use-mcp-prompts-DVth4qgJ.js";import"./use-org-fs-Dgh9z93n.js";import"./useInfiniteQuery-BE9sCIYq.js";import"./infiniteQueryObserver-Cxi7L9ot.js";import"./Link01-C_3I56NR.js";import"./question-004-sINsf4GQ.js";import"./feature-paywall-DqoNTxTC.js";import"./plan-ladder-DVGnZEOW.js";import"./add-connection-dialog-m-NKaBEt.js";import"./collection-search-B1Rwoo5a.js";import"./extract-connection-data-ZLWd2Kp9.js";import"./metadata-D72DunRR.js";import"./connection-BwwtdGYY.js";import"./url-slug-BogkV_jr.js";import"./connection-card-DkgQDzvl.js";import"./connection-slug-CITJ0kGN.js";import"./integration-icon-CTeTGAEP.js";import"./textarea-BfUMZtIE.js";import"./use-connection-Drdp4Oae.js";import"./schema-AZdD9rpA.js";import"./connection-form-helpers-Dz8qeNpg.js";import"./authenticate-and-persist-oauth-CFjCVa7x.js";import"./mcp-oauth-k6NAw0Ub.js";import"./mcp-oauth-D0HIDgk0.js";import"./collection-tabs-D1DeyrYv.js";import"./badge-B6ke8DzO.js";import"./use-infinite-scroll-Cdv4OhOH.js";import"./useSuspenseInfiniteQuery-Dq-LBGK4.js";import"./use-task-board-events-CJaU8iB9.js";import"./use-chat-layout-state-CUQiISez.js";import"./utils-BgIMGxAp.js";import"./Play-DNXVmQiT.js";import"./sandbox-start-errors-BK_aDCyt.js";import"./pair-CVodhGQi.js";import"./collapsible-Bno2lzu1.js";import"./use-clock-tick-D6Bkvbtv.js";import"./content-blocks-o63cs2vh.js";import"./mcp-app-renderer-CdXSQ5um.js";import"./types-CpRdG9MN.js";import"./omit-sandbox-map-jj4lCB2U.js";import"./sheet-BuALHxIa.js";import"./use-navigate-to-agent-DM90tSAB.js";import"./use-thread-outputs-dVUFY4Dm.js";import"./switch-rDNRmZ0M.js";import"./command-DaCaELsT.js";import"./index-CmKtrUDs.js";import"./monaco-editor-NVjLW8Z7.js";import"./editor-D8dmglIK.js";import"./calendar-jnImf3-F.js";import"./SwitchHorizontal01-CvgScnq-.js";import"./editor-classes-AdVYLXkc.js";import"./view-mode-toggle-zk0YkHDW.js";import"./combobox-SRY8n3hS.js";import"./DotsVertical-DM6Nc0dV.js";import"./search-input-lMAz-4j_.js";import"./use-debounced-value-Gwk4Ne2C.js";import"./use-file-configs-DAsYJwg1.js";import"./asset-utils-Aj0AmEaW.js";import"./match-site-slug-config-D3fUJ6vX.js";import"./sandbox-git-api-CRxdlhrN.js";import"./sandbox-url-D3mC8qhT.js";import"./empty-state-Cfb0wost.js";import"./Building02-B0INzhOK.js";import"./CheckCircle-D0ZtvGmn.js";import"./CreditCard01-EDo1X5AA.js";import"./Globe04-tj-aFoQD.js";import"./Sun-CjCYzESp.js";import"./User01-Bz9s3Cms.js";import"./Users01-CB1Iep5-.js";import"./use-main-schema-v8-DIVJCCM7.js";import"./index-Dc33YQY0.js";import"./alert-C3kKk-dL.js";import"./section-preview-url-7zfngvgW.js";import"./differenceInSeconds-C3x8sHUj.js";import"./project-icon-Dqc3FhU8.js";import"./new-project-dialog-OaqxveJn.js";import"./repository-import-picker-AF8p3kVM.js";import"./repository-picker-QcYWbpFV.js";import"./required-auth-layout-2_g05NTA.js";import"./use-org-sso-B3aedyMX.js";import"./use-org-auth-client-D8DO5P0C.js";const Ll={escape:Ji};function $l(n,e){for(const s of kl(n,e)){const o=typeof s.title=="string"?s.title:void 0;if(o?.includes("{{"))return o}}function zl(n,e){if(!e)return;const s=$a(n);if(s)try{const o=$l(s.resolveType,e);return o&&Fa.render(o,s.data,{},Ll).trim()||void 0}catch{return}}function Hl(n){const e=it.c(13),{icon:s,label:o,className:a}=n;let u;e[0]!==a?(u=ae("size-3.5",a),e[0]=a,e[1]=u):u=e[1];let h;e[2]!==s||e[3]!==u?(h=i.jsx(s,{className:u}),e[2]=s,e[3]=u,e[4]=h):h=e[4];let d;e[5]!==o||e[6]!==h?(d=i.jsx(Et,{asChild:!0,children:i.jsx("span",{role:"img","aria-label":o,className:"shrink-0 cursor-help",children:h})}),e[5]=o,e[6]=h,e[7]=d):d=e[7];let v;e[8]!==o?(v=i.jsx(Rt,{className:"max-w-56",children:o}),e[8]=o,e[9]=v):v=e[9];let m;return e[10]!==d||e[11]!==v?(m=i.jsxs(kt,{children:[d,v]}),e[10]=d,e[11]=v,e[12]=m):m=e[12],m}const Wl="text-global-section-fg focus:bg-global-section/12 focus:text-global-section-fg dark:text-global-section-fg-dark dark:focus:bg-global-section/15 dark:focus:text-global-section-fg-dark [&_svg]:!text-global-section";function io(n){return Array.from({length:n},(e,s)=>({id:crypto.randomUUID(),index:s}))}function ko(n){return n.map((e,s)=>({...e,index:s}))}function ql(n,e){if(e===n.length)return n;if(e<n.length)return ko(n.slice(0,e));const s=Array.from({length:e-n.length},(o,a)=>({id:crypto.randomUUID(),index:n.length+a}));return[...n,...s]}function Eo(n){const e=it.c(44),{section:s,raw:o,meta:a,decofile:u}=n,h=Ft(),d=Wn(),v=s.isSavedBlock===!0,m=s.isMultivariate===!0;let j;e[0]!==a||e[1]!==o?(j=o&&a?El(o,a):void 0,e[0]=a,e[1]=o,e[2]=j):j=e[2];const A=j;let $;e[3]!==a||e[4]!==m||e[5]!==o||e[6]!==v?($=o&&a&&!v&&!m?zl(o,a):void 0,e[3]=a,e[4]=m,e[5]=o,e[6]=v,e[7]=$):$=e[7];const z=$;let H;e[8]!==u||e[9]!==a||e[10]!==o||e[11]!==s?(H=na(o,s,u,a),e[8]=u,e[9]=a,e[10]=o,e[11]=s,e[12]=H):H=e[12];const F=H;let f;e[13]!==m||e[14]!==o?.__resolveType?(f=!m&&Rs(o?.__resolveType??""),e[13]=m,e[14]=o?.__resolveType,e[15]=f):f=e[15];const k=f,X=v?zn:m?bo:_o;let w;e[16]!==m||e[17]!==v?(w=v?{color:za}:m?{color:"oklch(0.65 0.15 160)"}:void 0,e[16]=m,e[17]=v,e[18]=w):w=e[18];const I=w;let V;e[19]!==X||e[20]!==d?(V=d?i.jsxs("span",{className:"relative size-4 shrink-0",children:[i.jsx(X,{className:"absolute inset-0 size-4 text-muted-foreground transition-opacity group-hover:opacity-0 group-has-[:focus-visible]:opacity-0"}),i.jsx(ra,{"aria-hidden":!0,className:"absolute inset-0 size-4 opacity-0 transition-opacity group-hover:opacity-100 group-has-[:focus-visible]:opacity-100"})]}):i.jsx(Aa,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[19]=X,e[20]=d,e[21]=V):V=e[21];let y;e[22]!==A?(y=A&&i.jsx("img",{src:A,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded-[var(--studio-control-radius,var(--radius))] object-cover"}),e[22]=A,e[23]=y):y=e[23];let C;e[24]!==d||e[25]!==I?(C=!d&&i.jsx(Ss,{className:"h-4 w-4 shrink-0",style:I}),e[24]=d,e[25]=I,e[26]=C):C=e[26];const x=d?"shrink":"flex-1",Y=s.isHidden&&"line-through opacity-50";let D;e[27]!==Y||e[28]!==x?(D=ae("min-w-0 truncate text-sm font-medium",x,Y),e[27]=Y,e[28]=x,e[29]=D):D=e[29];const ge=z??s.label;let me;e[30]!==D||e[31]!==ge?(me=i.jsx("span",{className:D,children:ge}),e[30]=D,e[31]=ge,e[32]=me):me=e[32];let le;e[33]!==k||e[34]!==d||e[35]!==F||e[36]!==h?(le=d?i.jsxs(i.Fragment,{children:[k&&i.jsx(Hl,{icon:bs,label:h("sectionsEditor.sectionList.asyncBadge"),className:"text-muted-foreground"}),F&&i.jsx(Br,{}),i.jsx("span",{className:"min-w-0 flex-1"})]}):F&&i.jsx(Br,{className:"absolute -right-0.5 -top-0.5"}),e[33]=k,e[34]=d,e[35]=F,e[36]=h,e[37]=le):le=e[37];let ee;return e[38]!==me||e[39]!==le||e[40]!==V||e[41]!==y||e[42]!==C?(ee=i.jsxs(i.Fragment,{children:[V,y,C,me,le]}),e[38]=me,e[39]=le,e[40]=V,e[41]=y,e[42]=C,e[43]=ee):ee=e[43],ee}const Gl="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",Ul="text-[oklch(0.45_0.15_160)] hover:bg-[oklch(0.65_0.15_160/0.12)] dark:text-[oklch(0.78_0.15_160)] dark:hover:bg-[oklch(0.65_0.15_160/0.15)]";function Ro(n,e,s){if(s)return sa({selected:e});const o=n.isSavedBlock===!0,a=n.isMultivariate===!0;return ae("group relative flex select-none items-center gap-2 rounded-[var(--studio-control-radius,var(--radius-md))] px-2 py-2.5",e?"bg-accent text-accent-foreground":o?Gl:a?Ul:"text-foreground/80 hover:bg-accent hover:text-accent-foreground")}function ps(n,e){return ae("h-7 shrink-0 overflow-hidden",e?"w-7 ml-0 opacity-100 [transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]":n?"w-7 ml-0 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:opacity-100 group-has-[:focus-visible]:opacity-100":"w-0 -ml-2 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:ml-0 group-hover:w-7 group-hover:opacity-100 group-hover:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms] group-has-[:focus-visible]:ml-0 group-has-[:focus-visible]:w-7 group-has-[:focus-visible]:opacity-100 group-has-[:focus-visible]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]")}function Yl(n){const e=it.c(90),{section:s,raw:o,meta:a,decofile:u,sortableId:h,selected:d,onSelect:v,onDelete:m,onDuplicate:j,onMakeReusable:A,onToggleHidden:$,onToggleLazy:z,onAddVariant:H,onDetach:F}=n,f=Ft(),k=Wn(),X=o?Rs(o.__resolveType??""):!1,w=s.isHidden===!0,I=X||w;let V;e[0]!==s?(V=jo(s),e[0]=s,e[1]=V):V=e[1];const y=V,C=!!z&&!s.isMultivariate;let x;e[2]!==h?(x={id:h,animateLayoutChanges:Xl},e[2]=h,e[3]=x):x=e[3];const{attributes:Y,listeners:D,setNodeRef:ge,transform:me,isDragging:le}=bl(x);let ee;e[4]!==me?(ee=xl.Transform.toString(me?{...me,x:0}:null),e[4]=me,e[5]=ee):ee=e[5];const pe=le?0:void 0;let ce;e[6]!==ee||e[7]!==pe?(ce={transform:ee,opacity:pe},e[6]=ee,e[7]=pe,e[8]=ce):ce=e[8];const he=ce;let ve;e[9]!==s?(ve=Xi(s),e[9]=s,e[10]=ve):ve=e[10];const b=ve,B="button",xe=0;let T;e[11]!==v?(T=re=>{(re.key==="Enter"||re.key===" ")&&(re.preventDefault(),v())},e[11]=v,e[12]=T):T=e[12];const ye=le?"cursor-grabbing":"cursor-pointer";let K;e[13]!==k||e[14]!==s||e[15]!==d||e[16]!==ye?(K=ae("touch-none transition-colors",ye,Ro(s,d,k)),e[13]=k,e[14]=s,e[15]=d,e[16]=ye,e[17]=K):K=e[17];let Se;e[18]!==u||e[19]!==a||e[20]!==o||e[21]!==s?(Se=i.jsx(Eo,{section:s,raw:o,meta:a,decofile:u}),e[18]=u,e[19]=a,e[20]=o,e[21]=s,e[22]=Se):Se=e[22];const ue=!k&&C&&i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"ghost",size:"icon","aria-label":f(X?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender"),className:ae(ps(I,X)),onClick:re=>{re.stopPropagation(),z?.()},onPointerDown:Ql,children:i.jsx(bs,{className:ae("h-3.5 w-3.5",X&&"text-warning")})})}),i.jsx(Rt,{side:"bottom",children:f(X?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")})]}),te=k?i.jsx(Zi,{label:f(w?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),active:w,onToggle:$,children:w?i.jsx(Zr,{className:"h-3.5 w-3.5"}):i.jsx(eo,{className:"h-3.5 w-3.5"})}):i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"ghost",size:"icon","aria-label":f(w?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),className:ae(ps(I,w)),onClick:re=>{re.stopPropagation(),$()},onPointerDown:Jl,children:w?i.jsx(Zr,{className:"h-3.5 w-3.5"}):i.jsx(eo,{className:"h-3.5 w-3.5"})})}),i.jsx(Rt,{side:"bottom",children:f(w?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection")})]}),se=zi,Te=ea;let Z;e[23]!==f?(Z=f("sectionsEditor.sectionList.sectionActionsMenu"),e[23]=f,e[24]=Z):Z=e[24];const _e=ae(ps(I,!1),"data-[state=open]:ml-0 data-[state=open]:w-7 data-[state=open]:opacity-100 data-[state=open]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]");let be;e[25]!==Te||e[26]!==Z||e[27]!==_e?(be=i.jsx(Te,{label:Z,classicClassName:_e}),e[25]=Te,e[26]=Z,e[27]=_e,e[28]=be):be=e[28];let q;e[29]!==k||e[30]!==C||e[31]!==X||e[32]!==z||e[33]!==f?(q=k&&C&&i.jsxs(i.Fragment,{children:[i.jsxs(sn,{onClick:re=>{re.stopPropagation(),z?.()},children:[i.jsx(bs,{className:"h-4 w-4"}),f(X?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")]}),i.jsx($i,{})]}),e[29]=k,e[30]=C,e[31]=X,e[32]=z,e[33]=f,e[34]=q):q=e[34];let O;e[35]!==j?(O=re=>{re.stopPropagation(),j()},e[35]=j,e[36]=O):O=e[36];let Ke;e[37]===Symbol.for("react.memo_cache_sentinel")?(Ke=i.jsx(dl,{className:"h-4 w-4"}),e[37]=Ke):Ke=e[37];let Qe;e[38]!==f?(Qe=f("sectionsEditor.sectionList.duplicateMenuItem"),e[38]=f,e[39]=Qe):Qe=e[39];let Xe;e[40]!==O||e[41]!==Qe?(Xe=i.jsxs(sn,{onClick:O,children:[Ke,Qe]}),e[40]=O,e[41]=Qe,e[42]=Xe):Xe=e[42];let Ye;e[43]!==k||e[44]!==y||e[45]!==H||e[46]!==f?(Ye=y&&i.jsxs(sn,{className:ae(!k&&ta),onClick:re=>{re.stopPropagation(),H()},children:[i.jsx(bo,{className:"h-4 w-4"}),f("sectionsEditor.sectionList.addVariantMenuItem")]}),e[43]=k,e[44]=y,e[45]=H,e[46]=f,e[47]=Ye):Ye=e[47];let Q;e[48]!==k||e[49]!==b||e[50]!==A||e[51]!==f?(Q=b&&i.jsxs(sn,{className:ae(!k&&Wl),onClick:re=>{re.stopPropagation(),A()},children:[k?i.jsx(zn,{className:"h-4 w-4"}):i.jsx(Ss,{className:"h-4 w-4"}),f("sectionsEditor.sectionList.makeReusableMenuItem")]}),e[48]=k,e[49]=b,e[50]=A,e[51]=f,e[52]=Q):Q=e[52];let ke;e[53]!==k||e[54]!==F||e[55]!==s.isMultivariate||e[56]!==s.isSavedBlock||e[57]!==f?(ke=s.isSavedBlock===!0&&!s.isMultivariate&&i.jsxs(sn,{onClick:re=>{re.stopPropagation(),F()},children:[k?i.jsx(_o,{className:"h-4 w-4"}):i.jsx(Ss,{className:"h-4 w-4"}),f("sectionsEditor.sectionList.detachMenuItem")]}),e[53]=k,e[54]=F,e[55]=s.isMultivariate,e[56]=s.isSavedBlock,e[57]=f,e[58]=ke):ke=e[58];let He;e[59]!==m?(He=re=>{re.stopPropagation(),m()},e[59]=m,e[60]=He):He=e[60];let We;e[61]===Symbol.for("react.memo_cache_sentinel")?(We=i.jsx(ml,{className:"h-4 w-4"}),e[61]=We):We=e[61];let Ee;e[62]!==f?(Ee=f("sectionsEditor.sectionList.deleteMenuItem"),e[62]=f,e[63]=Ee):Ee=e[63];let Ie;e[64]!==He||e[65]!==Ee?(Ie=i.jsxs(sn,{variant:"destructive",onClick:He,children:[We,Ee]}),e[64]=He,e[65]=Ee,e[66]=Ie):Ie=e[66];let Ve;e[67]!==q||e[68]!==Xe||e[69]!==Ye||e[70]!==Q||e[71]!==ke||e[72]!==Ie?(Ve=i.jsxs(Hi,{align:"end",className:"w-44",children:[q,Xe,Ye,Q,ke,Ie]}),e[67]=q,e[68]=Xe,e[69]=Ye,e[70]=Q,e[71]=ke,e[72]=Ie,e[73]=Ve):Ve=e[73];let Ze;e[74]!==se||e[75]!==be||e[76]!==Ve?(Ze=i.jsxs(se,{children:[be,Ve]}),e[74]=se,e[75]=be,e[76]=Ve,e[77]=Ze):Ze=e[77];let Fe;return e[78]!==Y||e[79]!==D||e[80]!==v||e[81]!==ge||e[82]!==he||e[83]!==K||e[84]!==Se||e[85]!==ue||e[86]!==te||e[87]!==Ze||e[88]!==T?(Fe=i.jsxs("div",{ref:ge,style:he,...Y,...D,role:B,tabIndex:xe,onClick:v,onKeyDown:T,className:K,children:[Se,ue,te,Ze]}),e[78]=Y,e[79]=D,e[80]=v,e[81]=ge,e[82]=he,e[83]=K,e[84]=Se,e[85]=ue,e[86]=te,e[87]=Ze,e[88]=T,e[89]=Fe):Fe=e[89],Fe}function Jl(n){return n.stopPropagation()}function Ql(n){return n.stopPropagation()}function Xl(){return!1}function js(n){const e=it.c(11),{canAddSection:s,onAddSection:o,className:a,size:u}=n,h=Ft();let d;e[0]!==a?(d=ae("w-full",a),e[0]=a,e[1]=d):d=e[1];const v=!s;let m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=i.jsx(fl,{size:14}),e[2]=m):m=e[2];let j;e[3]!==h?(j=h("sectionsEditor.sectionList.addSectionButton"),e[3]=h,e[4]=j):j=e[4];let A;return e[5]!==o||e[6]!==u||e[7]!==d||e[8]!==v||e[9]!==j?(A=i.jsxs(_t,{type:"button",variant:"outline",size:u,className:d,disabled:v,onClick:o,children:[m,j]}),e[5]=o,e[6]=u,e[7]=d,e[8]=v,e[9]=j,e[10]=A):A=e[10],A}function Zl(n){const e=it.c(101),{listKey:s,rawSections:o,sections:a,meta:u,decofile:h,selectedIndex:d,onSelect:v,onReorder:m,onDelete:j,onDuplicate:A,onMakeReusable:$,onToggleHidden:z,onToggleLazy:H,onAddVariant:F,onDetach:f,onAddSection:k,canAddSection:X}=n,w=X===void 0?!0:X,I=Ft(),V=Wn();let y;e[0]!==a.length?(y=()=>io(a.length),e[0]=a.length,e[1]=y):y=e[1];const[C,x]=R.useState(y),[Y,D]=R.useState(null),[ge,me]=R.useState(s),[le,ee]=R.useState(a.length),pe=R.useRef(!1);ge!==s?(me(s),ee(a.length),x(io(a.length))):le!==a.length&&(ee(a.length),x(dt=>ql(dt,a.length)));let ce;e[2]===Symbol.for("react.memo_cache_sentinel")?(ce={activationConstraint:{distance:8}},e[2]=ce):ce=e[2];let he;e[3]===Symbol.for("react.memo_cache_sentinel")?(he={coordinateGetter:jl},e[3]=he):he=e[3];const ve=pl(to(gl,ce),to(hl,he));let b;e[4]!==C?(b=C.map(ec),e[4]=C,e[5]=b):b=e[5];const B=b;let xe;e[6]===Symbol.for("react.memo_cache_sentinel")?(xe=dt=>{D(String(dt.active.id))},e[6]=xe):xe=e[6];const T=xe;let ye;e[7]!==B||e[8]!==m?(ye=dt=>{D(null);const{active:ne,over:Me}=dt;if(!Me||ne.id===Me.id)return;const yt=B.indexOf(String(ne.id)),et=B.indexOf(String(Me.id));yt===-1||et===-1||(x(ft=>ko(Ln([...ft],yt,et))),pe.current=!0,requestAnimationFrame(()=>{pe.current=!1}),m?.(yt,et))},e[7]=B,e[8]=m,e[9]=ye):ye=e[9];const K=ye;let Se;e[10]===Symbol.for("react.memo_cache_sentinel")?(Se=()=>{D(null)},e[10]=Se):Se=e[10];const ue=Se;let te,se,Te,Z,_e,be,q,O,Ke,Qe,Xe,Ye,Q,ke,He;if(e[11]!==Y||e[12]!==w||e[13]!==V||e[14]!==h||e[15]!==C||e[16]!==B||e[17]!==K||e[18]!==u||e[19]!==k||e[20]!==F||e[21]!==j||e[22]!==f||e[23]!==A||e[24]!==$||e[25]!==v||e[26]!==z||e[27]!==H||e[28]!==o||e[29]!==a||e[30]!==d||e[31]!==ve||e[32]!==I){ke=Symbol.for("react.early_return_sentinel");e:{const dt=ne=>{pe.current||v(ne)};if(e[48]!==Y||e[49]!==w||e[50]!==V||e[51]!==C||e[52]!==k||e[53]!==o||e[54]!==a||e[55]!==I){const ne=Y?C.find(Me=>Me.id===Y):null;if(Z=ne!=null?a[ne.index]:null,Te=ne!=null?o[ne.index]:void 0,C.length===0){let Me;e[59]!==I?(Me=I("sectionsEditor.sectionList.noSections"),e[59]=I,e[60]=Me):Me=e[60];let yt;e[61]!==Me?(yt=i.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:Me}),e[61]=Me,e[62]=yt):yt=e[62];const et=yt;let ft;e[63]!==w||e[64]!==V||e[65]!==et||e[66]!==k?(ft=V?et:i.jsxs("div",{className:"space-y-2",children:[et,i.jsx(js,{canAddSection:w,onAddSection:k,size:"sm"})]}),e[63]=w,e[64]=V,e[65]=et,e[66]=k,e[67]=ft):ft=e[67],ke=ft;break e}Q=ae(ne&&"cursor-grabbing"),e[48]=Y,e[49]=w,e[50]=V,e[51]=C,e[52]=k,e[53]=o,e[54]=a,e[55]=I,e[56]=Te,e[57]=Z,e[58]=Q}else Te=e[56],Z=e[57],Q=e[58];se=yl,O=ve,Ke=Sl,Qe=T,Xe=K,Ye=ue,te=wl,be=B,q=_l,He="space-y-1",_e=C.map(ne=>{const Me=a[ne.index];return Me?i.jsx(Yl,{sortableId:ne.id,section:Me,raw:o[ne.index],meta:u,decofile:h,selected:d===ne.index,onSelect:()=>dt(ne.index),onDelete:()=>j(ne.index),onDuplicate:()=>A(ne.index),onMakeReusable:()=>$(ne.index),onToggleHidden:()=>z(ne.index),onToggleLazy:H?()=>H(ne.index):void 0,onAddVariant:()=>F(ne.index),onDetach:()=>f(ne.index)},ne.id):null})}e[11]=Y,e[12]=w,e[13]=V,e[14]=h,e[15]=C,e[16]=B,e[17]=K,e[18]=u,e[19]=k,e[20]=F,e[21]=j,e[22]=f,e[23]=A,e[24]=$,e[25]=v,e[26]=z,e[27]=H,e[28]=o,e[29]=a,e[30]=d,e[31]=ve,e[32]=I,e[33]=te,e[34]=se,e[35]=Te,e[36]=Z,e[37]=_e,e[38]=be,e[39]=q,e[40]=O,e[41]=Ke,e[42]=Qe,e[43]=Xe,e[44]=Ye,e[45]=Q,e[46]=ke,e[47]=He}else te=e[33],se=e[34],Te=e[35],Z=e[36],_e=e[37],be=e[38],q=e[39],O=e[40],Ke=e[41],Qe=e[42],Xe=e[43],Ye=e[44],Q=e[45],ke=e[46],He=e[47];if(ke!==Symbol.for("react.early_return_sentinel"))return ke;let We;e[68]!==_e||e[69]!==He?(We=i.jsx("div",{className:He,children:_e}),e[68]=_e,e[69]=He,e[70]=We):We=e[70];let Ee;e[71]!==te||e[72]!==be||e[73]!==q||e[74]!==We?(Ee=i.jsx(te,{items:be,strategy:q,children:We}),e[71]=te,e[72]=be,e[73]=q,e[74]=We,e[75]=Ee):Ee=e[75];let Ie;e[76]!==Te||e[77]!==Z||e[78]!==V||e[79]!==h||e[80]!==u?(Ie=Z?i.jsx("div",{className:ae("cursor-grabbing shadow-lg ring-1 ring-border/60",Ro(Z,!1,V)),children:i.jsx(Eo,{section:Z,raw:Te,meta:u,decofile:h})}):null,e[76]=Te,e[77]=Z,e[78]=V,e[79]=h,e[80]=u,e[81]=Ie):Ie=e[81];let Ve;e[82]!==Ie?(Ve=Li.createPortal(i.jsx(vl,{dropAnimation:Qi,children:Ie}),document.body),e[82]=Ie,e[83]=Ve):Ve=e[83];let Ze;e[84]!==se||e[85]!==O||e[86]!==Ke||e[87]!==Qe||e[88]!==Xe||e[89]!==Ye||e[90]!==Ee||e[91]!==Ve?(Ze=i.jsxs(se,{sensors:O,collisionDetection:Ke,onDragStart:Qe,onDragEnd:Xe,onDragCancel:Ye,children:[Ee,Ve]}),e[84]=se,e[85]=O,e[86]=Ke,e[87]=Qe,e[88]=Xe,e[89]=Ye,e[90]=Ee,e[91]=Ve,e[92]=Ze):Ze=e[92];let Fe;e[93]!==w||e[94]!==V||e[95]!==k?(Fe=!V&&i.jsx(js,{canAddSection:w,onAddSection:k,size:"sm",className:"mt-2"}),e[93]=w,e[94]=V,e[95]=k,e[96]=Fe):Fe=e[96];let re;return e[97]!==Q||e[98]!==Ze||e[99]!==Fe?(re=i.jsxs("div",{className:Q,children:[Ze,Fe]}),e[97]=Q,e[98]=Ze,e[99]=Fe,e[100]=re):re=e[100],re}function ec(n){return n.id}function hs(n,e,s,o){if(!n||!e)return null;if(!e.isMultivariate)return jt(n,e,o)?.data??null;const a=xt(n,e),u=a?vs(a,wt)[s]:void 0;return u?wo(u.value,o)?.data??null:null}const tc=50;function nc(n,e){n.own.push(ze(e)),n.own.length>tc&&n.own.shift()}function ao(n,e){return n.own.includes(ze(e))}function sc(n,e){const{sectionIndex:s,variantIndex:o,shown:a,next:u,sectionCount:h}=e;return n&&n.sectionIndex===s&&n.variantIndex===o&&n.emitted===a?(n.emitted=u,n):a?{sectionIndex:s,variantIndex:o,base:a,emitted:u,sectionCount:h,own:[ze(a)]}:null}function Ao(n,e){return e!==null&&ze(n)!==ze(e)}function Co(n,e){return n.__resolveType!==e.__resolveType}function rc(n,e,s,o){if(e.length===o)return"here";const a=ze(n),u=e.flatMap((h,d)=>d!==s&&h!==null&&ze(h)===a?[d]:[]);return u.length===1?u[0]:"unknown"}function lo({formBase:n,rebased:e,versionOf:s}){let o=null;return{ifMatch:a=>{o=a,n&&(n.version===void 0||e)&&(n.version=s(a));const u=n?n.version:s(a);return u===void 0?void 0:{[a]:u}},onApplied:a=>{n&&o!==null&&Object.hasOwn(a,o)&&(n.version=a[o])},reloadOnConflict:!0}}function oc({merged:n,tracked:e,current:s,saved:o}){return!!n&&!!e&&s===e&&e.emitted===o}function co(n,e){return!!n&&!!e&&n.contains(e)}function ws(n){const e=[],s=_s("",n.ancestor,n.mine,n.theirs,e);return{...n,merged:s,pointers:e}}function _s(n,e,s,o,a){const u=(h,d)=>ze(h)===ze(d);if(u(s,o)||u(e,o))return s;if(u(e,s))return o;if(gs(s)&&gs(o)){const h=gs(e)?e:{},d={},v=[...Object.keys(s),...Object.keys(o).filter(m=>!(m in s))];for(const m of v){const j=_s(`${n}/${m.replaceAll("~","~0").replaceAll("/","~1")}`,h[m],s[m],o[m],a);j!==void 0&&(d[m]=j)}return d}return Array.isArray(e)&&Array.isArray(s)&&Array.isArray(o)&&s.length===e.length&&o.length===e.length?e.map((h,d)=>_s(`${n}/${d}`,h,s[d],o[d],a)):(a.push(n),o)}function gs(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}function ic(n,e){let s=n.merged;for(const o of n.pointers)e[o]==="mine"&&(s=uc(s,o,Ut(n.mine,o)));return s}function ac(n,e){return Object.fromEntries(n.pointers.map(s=>[s,e]))}function No(n){return ac(n,"mine")}function ks(n,e,s){const o=No(s);for(const a of s.pointers){const u=e[a];if(!u||!n.pointers.includes(a))continue;["mine","theirs"].every(d=>ze(Ut(n[d],a))===ze(Ut(s[d],a)))&&(o[a]=u)}return o}function To(n,e,s={}){const o=e.pointers.filter(a=>!n.pointers.includes(a)||ze(Ut(n.theirs,a))!==ze(Ut(e.theirs,a)));return o.length===0?s:{...s,...Object.fromEntries(o.map(a=>[a,(s[a]??0)+1]))}}function lc(n,e,s){if(!e||Co(n.plan.ancestor,e)||!Ao(n.plan.theirs,e)||s(e))return null;const o=ws({...n.plan,theirs:e});return o.pointers.length===0?null:{plan:o,choices:ks(n.plan,n.choices,o),fresh:To(n.plan,o,n.fresh)}}function cc(n,e){return n.pointers.map(s=>({pointer:s,label:oa(s,e),mine:Ut(n.mine,s),theirs:Ut(n.theirs,s),schema:dc(e??null,s)}))}function As(n){return n.split("/").slice(1).map(e=>e.replaceAll("~1","/").replaceAll("~0","~"))}function Ut(n,e){let s=n;for(const o of As(e))if(Array.isArray(s))s=s[Number(o)];else if(s&&typeof s=="object")s=s[o];else return;return s}function uc(n,e,s){const o=As(e),a=(u,h)=>{if(h===o.length)return s;const d=o[h];if(Array.isArray(u)){const j=[...u];return j[Number(d)]=a(u[Number(d)],h+1),j}const v=u&&typeof u=="object"?{...u}:{},m=a(v[d],h+1);return m===void 0?delete v[d]:v[d]=m,v};return a(n,0)}function dc(n,e){let s=n;for(const o of As(e)){if(!s)return null;s=/^\d+$/.test(o)&&!s.properties?.[o]?s.items:s.properties?.[o]}return s??null}const fc=/\.(png|jpe?g|gif|webp|avif|svg)(\?.*)?$/i,uo=60,mc=3;function Vo(n,e){return e?.format==="image-uri"?!0:n.startsWith("data:image/")||/^(https?:)?\/\//.test(n)&&fc.test(n)}function Es(n,e){if(!(e?.format==="rich-text"||e?.format==="rich-text-inline"||e?.format==="html"||/<\/?[a-z][^>]*>/i.test(n)))return n;const o=n.replace(/<br\s*\/?>/gi,`
2
2
  `).replace(/<\/(p|div|li|h[1-6])>/gi,`
3
3
  `);return hc(o).replace(/\u00a0/g," ").replace(/\n{2,}/g,`
4
- `).trim()}const pc={"&nbsp;":" ","&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"};function hc(n){if(typeof DOMParser<"u")return new DOMParser().parseFromString(n,"text/html").body.textContent??"";let e=n;for(let s="";s!==e;)s=e,e=e.replace(/<[^<>]*>/g,"");return e.replace(/<|>/g,"").replace(/&(nbsp|amp|lt|gt|quot|#39);/g,s=>pc[s]??s)}function $n(n){const e=n.replace(/\s+/g," ").trim();return e.length>uo?`${e.slice(0,uo-1)}…`:e}function gc(n){if(n.startsWith("data:"))return"image";const e=n.split(/[?#]/)[0]??n;return decodeURIComponent(e.split("/").pop()||n)}function Hn(n,e){if(n==null||n==="")return{kind:"empty"};if(typeof n=="string")return Vo(n,e)?{kind:"image",src:n}:{kind:"text",text:Es(n,e)};if(typeof n=="number"||typeof n=="bigint")return{kind:"text",text:String(n)};if(typeof n=="boolean")return{kind:"yesNo",value:n};if(Array.isArray(n)){const s=e?.items??null;return{kind:"list",count:n.length,items:n.slice(0,mc).map(o=>vc(o,s)??"")}}if(typeof n=="object"){const s=n;if("value"in s&&Object.keys(s).length<=2)return Hn(s.value,e?.properties?.value??e);const o=Object.entries(s).filter(([a,u])=>!a.startsWith("__")&&u!==void 0).flatMap(([a,u])=>{const h=e?.properties?.[a]??null,d=Hn(u,h);if(d.kind==="empty")return[];const v=d.kind==="text"?$n(d.text):d.kind==="image"?gc(d.src):d.kind==="yesNo"?d.value?"✓":"✗":d.kind==="list"?`${d.count}`:"…";return[{label:h?.title?.trim()||a,text:v}]}).slice(0,4);return o.length>0?{kind:"fields",entries:o}:{kind:"empty"}}return{kind:"text",text:String(n)}}function vc(n,e){if(typeof n=="string")return $n(Es(n,e));if(!n||typeof n!="object"||Array.isArray(n))return null;const s=n,o=e?.titleBy,a=o?s[o]:void 0;if(typeof a=="string"&&a.trim())return $n(a);for(const[u,h]of Object.entries(s))if(!(u.startsWith("__")||typeof h!="string"||!h.trim())&&!Vo(h,e?.properties?.[u]??null))return $n(Es(h,null));return null}const fo=1500;function xc(n,e){const s=n.split(/(\s+)/).filter(j=>j!==""),o=e.split(/(\s+)/).filter(j=>j!=="");if(s.length>fo||o.length>fo)return{mine:[{text:n,kind:"changed"}],theirs:[{text:e,kind:"changed"}]};const a=Array.from({length:s.length+1},()=>new Array(o.length+1).fill(0));for(let j=s.length-1;j>=0;j--)for(let A=o.length-1;A>=0;A--){const $=a[j];$[A]=s[j]===o[A]?a[j+1][A+1]+1:Math.max(a[j+1][A],$[A+1])}const u=[],h=[],d=(j,A,$)=>{const z=j.at(-1);z&&(z.kind===$||$==="same"&&!A.trim())?z.text+=A:j.push({text:A,kind:$})};let v=0,m=0;for(;v<s.length&&m<o.length;)s[v]===o[m]?(d(u,s[v],"same"),d(h,o[m],"same"),v++,m++):a[v+1][m]>=a[v][m+1]?(d(u,s[v],"changed"),v++):(d(h,o[m],"changed"),m++);for(;v<s.length;v++)d(u,s[v],"changed");for(;m<o.length;m++)d(h,o[m],"changed");return{mine:u,theirs:h}}function yc(n){const e=it.c(10);let s,o;e[0]!==n?({open:s,...o}=n,e[0]=n,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const{data:a}=xo.useSession();let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=ae("max-h-[85vh] grid-rows-[auto_minmax(0,1fr)_auto] sm:max-w-lg"),e[3]=u):u=e[3];const h=a?.user??null;let d;e[4]!==o||e[5]!==h?(d=i.jsx(Cl,{className:u,"data-testid":"form-conflict-dialog",onEscapeKeyDown:jc,onOpenAutoFocus:bc,children:i.jsx(Ac,{...o,viewer:h,heading:Sc})}),e[4]=o,e[5]=h,e[6]=d):d=e[6];let v;return e[7]!==s||e[8]!==d?(v=i.jsx(Dl,{open:s,children:d}),e[7]=s,e[8]=d,e[9]=v):v=e[9],v}function Sc(n,e){return i.jsxs(Nl,{className:"text-left",children:[i.jsx(Tl,{children:n}),i.jsx(Vl,{children:e})]})}function bc(n){n.preventDefault(),n.currentTarget?.focus()}function jc(n){return n.preventDefault()}const wc={},_c=(n,e)=>i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx("h2",{className:"text-lg font-semibold",children:n}),i.jsx("p",{className:"text-sm text-muted-foreground",children:e})]});function kc(n,e,s=0,o={},a=null){const u=e[Math.min(s,e.length-1)],h=a?.you?void 0:a?.name?.split(/\s+/)[0],d={field:u?Rc(u.label):"",label:u?.label??"",name:h??""},v=(m,j,A)=>n(a?.you?A:h?j:m,d);return e.length<=1?{title:v("sectionsEditor.formConflict.titleOne","sectionsEditor.formConflict.titleOneNamed","sectionsEditor.formConflict.titleOneYou"),description:n("sectionsEditor.formConflict.descriptionOne")}:{title:v("sectionsEditor.formConflict.titleStep","sectionsEditor.formConflict.titleStepNamed","sectionsEditor.formConflict.titleStepYou"),description:s>=e.length-1?i.jsx(Ec,{t:n,fields:e,choices:o,name:h}):n("sectionsEditor.formConflict.descriptionStep")}}function Ec(n){const e=it.c(11),{t:s,fields:o,choices:a,name:u}=n;let h;if(e[0]!==a||e[1]!==o||e[2]!==u||e[3]!==s){let v;e[5]!==a||e[6]!==u||e[7]!==s?(v=(m,j)=>i.jsxs(R.Fragment,{children:[j>0&&" · ",`${m.label}: `,i.jsx("span",{className:"font-medium text-foreground",children:s((a[m.pointer]??"mine")==="mine"?"sectionsEditor.formConflict.summaryYours":u?"sectionsEditor.formConflict.summaryTheirsNamed":"sectionsEditor.formConflict.summaryTheirs",{name:u??""})})]},m.pointer),e[5]=a,e[6]=u,e[7]=s,e[8]=v):v=e[8],h=o.map(v),e[0]=a,e[1]=o,e[2]=u,e[3]=s,e[4]=h}else h=e[4];let d;return e[9]!==h?(d=i.jsx("span",{"data-testid":"form-conflict-summary",children:h}),e[9]=h,e[10]=d):d=e[10],d}function Rc(n){return/^[A-Z][a-z]/.test(n)&&!n.includes("›")?n.charAt(0).toLowerCase()+n.slice(1):n}function Ac(n){const e=it.c(68),s=Ft(),{fields:o,choices:a,changedAgain:u,fresh:h,heading:d}=n,v=u===void 0?!1:u,m=h===void 0?wc:h,j=d===void 0?_c:d,A=o.length>1,[$,z]=R.useState(0),[H,F]=R.useState(Cc);let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f={},e[0]=f):f=e[0];const[k,Z]=R.useState(f),w=Math.max(0,Math.min($,o.length-1)),I=o[w],V=w===o.length-1;let y;e[1]!==w||e[2]!==o||e[3]!==m?(y=Se=>{const ue=o[w],te=o[Se];!ue||!te||Se===w||(F(se=>new Set(se).add(ue.pointer)),Z(se=>({...se,[ue.pointer]:m[ue.pointer]??0,[te.pointer]:m[te.pointer]??0})),z(Se))},e[1]=w,e[2]=o,e[3]=m,e[4]=y):y=e[4];const C=y;let x;e[5]!==w||e[6]!==C?(x=Se=>{if(!Se)return;const ue=te=>{const se={ArrowLeft:-1,ArrowRight:1}[te.key];!se||te.defaultPrevented||te.altKey||te.ctrlKey||te.metaKey||te.shiftKey||Pl(te.target)||(te.preventDefault(),C(w+se))};return Se.ownerDocument.addEventListener("keydown",ue),()=>Se.ownerDocument.removeEventListener("keydown",ue)},e[5]=w,e[6]=C,e[7]=x):x=e[7];const Y=x;if(!I)return null;let M,ge,me,le,ee;if(e[8]!==H||e[9]!==w||e[10]!==a||e[11]!==o||e[12]!==m||e[13]!==C||e[14]!==j||e[15]!==Y||e[16]!==A||e[17]!==n||e[18]!==k||e[19]!==s){const{title:Se,description:ue}=kc(s,o,w,a,n.author??null);let te;e[25]!==n?(te=se=>{se.detail>1||n.onApply()},e[25]=n,e[26]=te):te=e[26],M=te,ge=A?Y:void 0,me="flex min-w-0 flex-col gap-3",e[27]!==H||e[28]!==w||e[29]!==o||e[30]!==m||e[31]!==C||e[32]!==A||e[33]!==k||e[34]!==s?(le=A&&i.jsxs("div",{className:"flex items-center justify-between gap-3",children:[i.jsx("div",{role:"group","aria-label":s("sectionsEditor.formConflict.steps"),className:"-m-1 flex flex-wrap items-center",children:o.map((se,Te)=>{const X=Te!==w&&(m[se.pointer]??0)>(k[se.pointer]??0);return i.jsx("button",{type:"button","aria-label":X?s("sectionsEditor.formConflict.stepChangedAgain",{label:se.label}):se.label,"aria-current":Te===w?"step":void 0,"data-answered":Te!==w&&H.has(se.pointer)?"":void 0,"data-changed-again":X?"":void 0,onClick:()=>C(Te),className:"group cursor-pointer rounded-full p-1 outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:i.jsx("span",{className:ae("block h-2 w-2 rounded-full bg-border transition-[width,background-color,box-shadow] motion-reduce:transition-none","group-hover:bg-muted-foreground/60","group-data-[answered]:bg-foreground/45","group-aria-[current=step]:w-5 group-aria-[current=step]:bg-foreground","group-data-[changed-again]:ring-2 group-data-[changed-again]:ring-warning group-data-[changed-again]:ring-offset-1 group-data-[changed-again]:ring-offset-background")})},se.pointer)})}),i.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:s("sectionsEditor.formConflict.stepCount",{step:String(w+1),count:String(o.length)})})]}),e[27]=H,e[28]=w,e[29]=o,e[30]=m,e[31]=C,e[32]=A,e[33]=k,e[34]=s,e[35]=le):le=e[35],ee=j(Se,ue),e[8]=H,e[9]=w,e[10]=a,e[11]=o,e[12]=m,e[13]=C,e[14]=j,e[15]=Y,e[16]=A,e[17]=n,e[18]=k,e[19]=s,e[20]=M,e[21]=ge,e[22]=me,e[23]=le,e[24]=ee}else M=e[20],ge=e[21],me=e[22],le=e[23],ee=e[24];let pe;e[36]!==ge||e[37]!==me||e[38]!==le||e[39]!==ee?(pe=i.jsxs("div",{ref:ge,className:me,children:[le,ee]}),e[36]=ge,e[37]=me,e[38]=le,e[39]=ee,e[40]=pe):pe=e[40];const ce=!v&&"sr-only";let he;e[41]!==ce?(he=ae("text-sm text-muted-foreground",ce),e[41]=ce,e[42]=he):he=e[42];let ve;e[43]!==v||e[44]!==A||e[45]!==s?(ve=v?s(A?"sectionsEditor.formConflict.changedAgainSteps":"sectionsEditor.formConflict.changedAgain"):"",e[43]=v,e[44]=A,e[45]=s,e[46]=ve):ve=e[46];let b;e[47]!==he||e[48]!==ve?(b=i.jsx("p",{role:"status",className:he,children:ve}),e[47]=he,e[48]=ve,e[49]=b):b=e[49];const B=A?"vertical":"all";let xe;e[50]!==I||e[51]!==n||e[52]!==B?(xe=i.jsx(Dc,{field:I,...n,arrows:B}),e[50]=I,e[51]=n,e[52]=B,e[53]=xe):xe=e[53];let T;e[54]!==b||e[55]!==xe?(T=i.jsxs("div",{className:"-mx-2 flex min-h-0 flex-col gap-3 overflow-y-auto px-2 py-1",children:[b,xe]}),e[54]=b,e[55]=xe,e[56]=T):T=e[56];let ye;e[57]!==M||e[58]!==w||e[59]!==C||e[60]!==V||e[61]!==A||e[62]!==s?(ye=A?i.jsxs(no,{className:"flex-row flex-wrap items-center justify-between gap-2 sm:justify-between",children:[i.jsx(_t,{type:"button",variant:"outline","aria-disabled":w===0,onClick:()=>C(w-1),className:"aria-disabled:cursor-default aria-disabled:opacity-45",children:s("sectionsEditor.formConflict.back")}),i.jsx(_t,{type:"button","data-testid":"form-conflict-primary",onClick:V?M:()=>C(w+1),children:s(V?"sectionsEditor.formConflict.ok":"sectionsEditor.formConflict.next")})]}):i.jsx(no,{className:"items-center gap-2",children:i.jsx(_t,{type:"button","data-testid":"form-conflict-primary",onClick:M,children:s("sectionsEditor.formConflict.ok")})}),e[57]=M,e[58]=w,e[59]=C,e[60]=V,e[61]=A,e[62]=s,e[63]=ye):ye=e[63];let K;return e[64]!==pe||e[65]!==T||e[66]!==ye?(K=i.jsxs(i.Fragment,{children:[pe,T,ye]}),e[64]=pe,e[65]=T,e[66]=ye,e[67]=K):K=e[67],K}function Cc(){return new Set}function Nc(n){const e=Hn(n.mine,n.schema),s=Hn(n.theirs,n.schema),o=e.kind==="text"&&s.kind==="text"?xc(e.text,s.text):null;return a=>o?i.jsx(Pc,{parts:o[a]}):i.jsx(Bc,{preview:a==="mine"?e:s})}const Tc={all:{ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1},vertical:{ArrowDown:1,ArrowUp:-1}};function Vc(n,e){const s=Tc[e][n.key];if(!s)return;const o=[...n.currentTarget.querySelectorAll('[role="radio"]')],a=o.indexOf(document.activeElement);if(a<0)return;n.preventDefault();const u=o[(a+s+o.length)%o.length];u?.focus(),u?.click()}function Dc(n){const e=it.c(65),{field:s,choices:o,viewer:a,author:u,onChoose:h,arrows:d}=n,v=u===void 0?null:u,m=Ft(),[j]=Wi(),{language:A}=j;let $,z,H,F,f,k,Z,w,I,V,y,C,x,Y;if(e[0]!==d||e[1]!==v||e[2]!==o||e[3]!==s||e[4]!==A||e[5]!==h||e[6]!==m||e[7]!==a?.image||e[8]!==a?.name){const me=Nc(s),le=o[s.pointer]??"mine",ee=a?.image??void 0;let pe;e[23]!==m||e[24]!==a?.name?(pe=mo(a?.name)||m("sectionsEditor.formConflict.you"),e[23]=m,e[24]=a?.name,e[25]=pe):pe=e[25];let ce;e[26]!==ee||e[27]!==pe?(ce=i.jsx(ms,{url:ee,fallback:pe,shape:"circle",size:"sm",className:"text-xs"}),e[26]=ee,e[27]=pe,e[28]=ce):ce=e[28];const he=ce;let ve;e[29]!==v||e[30]!==he?(ve=v?.you?he:v?.name?i.jsx(ms,{url:v.avatarUrl,fallback:mo(v.name),shape:"circle",size:"sm",className:"text-xs"}):i.jsx(ms,{url:"icon://user",fallback:"",muted:!0,shape:"circle",size:"sm"}),e[29]=v,e[30]=he,e[31]=ve):ve=e[31];const b=ve,B=v?new Date(v.at):null;H="radiogroup",F=s.label,f="flex flex-col gap-2",e[32]!==d?(k=K=>Vc(K,d),e[32]=d,e[33]=k):k=e[33];let xe;e[34]!==s.pointer||e[35]!==h?(xe=()=>h(s.pointer,"mine"),e[34]=s.pointer,e[35]=h,e[36]=xe):xe=e[36];let T;e[37]!==m?(T=m("sectionsEditor.formConflict.you"),e[37]=m,e[38]=T):T=e[38];let ye;e[39]!==m?(ye=m("sectionsEditor.formConflict.yourVersionNotSaved"),e[39]=m,e[40]=ye):ye=e[40],Z=i.jsx(po,{side:"mine",checked:le==="mine",onChoose:xe,avatar:he,who:T,meta:ye,children:me("mine")}),$=po,w="theirs",I=le==="theirs",e[41]!==s.pointer||e[42]!==h?(V=()=>h(s.pointer,"theirs"),e[41]=s.pointer,e[42]=h,e[43]=V):V=e[43],y=b,e[44]!==v?.name||e[45]!==v?.you||e[46]!==m?(C=v?.you?m("sectionsEditor.formConflict.youElsewhere"):v?.name||m("sectionsEditor.formConflict.someoneElse"),e[44]=v?.name,e[45]=v?.you,e[46]=m,e[47]=C):C=e[47],x=B?m("sectionsEditor.formConflict.savedAt",{when:Ml(B,A)}):m("sectionsEditor.formConflict.theirVersionSaved"),Y=B?Mc(B,A):void 0,z=me("theirs"),e[0]=d,e[1]=v,e[2]=o,e[3]=s,e[4]=A,e[5]=h,e[6]=m,e[7]=a?.image,e[8]=a?.name,e[9]=$,e[10]=z,e[11]=H,e[12]=F,e[13]=f,e[14]=k,e[15]=Z,e[16]=w,e[17]=I,e[18]=V,e[19]=y,e[20]=C,e[21]=x,e[22]=Y}else $=e[9],z=e[10],H=e[11],F=e[12],f=e[13],k=e[14],Z=e[15],w=e[16],I=e[17],V=e[18],y=e[19],C=e[20],x=e[21],Y=e[22];let M;e[48]!==$||e[49]!==z||e[50]!==w||e[51]!==I||e[52]!==V||e[53]!==y||e[54]!==C||e[55]!==x||e[56]!==Y?(M=i.jsx($,{side:w,checked:I,onChoose:V,avatar:y,who:C,meta:x,metaTitle:Y,children:z}),e[48]=$,e[49]=z,e[50]=w,e[51]=I,e[52]=V,e[53]=y,e[54]=C,e[55]=x,e[56]=Y,e[57]=M):M=e[57];let ge;return e[58]!==H||e[59]!==F||e[60]!==f||e[61]!==k||e[62]!==Z||e[63]!==M?(ge=i.jsxs("div",{role:H,"aria-label":F,className:f,onKeyDown:k,children:[Z,M]}),e[58]=H,e[59]=F,e[60]=f,e[61]=k,e[62]=Z,e[63]=M,e[64]=ge):ge=e[64],ge}const Mc=(n,e)=>n.toLocaleString(e,{dateStyle:"medium",timeStyle:"short"});function mo(n){return(n??"").trim().split(/\s+/).filter(Boolean).slice(0,2).map(e=>e.charAt(0).toUpperCase()).join("")}function po(n){const e=it.c(28),{side:s,checked:o,onChoose:a,avatar:u,who:h,meta:d,metaTitle:v,children:m}=n,j=R.useId(),A=`${j}-who`,$=`${j}-meta ${j}-value`,z=o?0:-1,H=o?"border-primary bg-primary/5 ring-1 ring-primary":"hover:bg-muted/50";let F;e[0]!==H?(F=ae("grid w-full cursor-pointer grid-cols-[auto_minmax(0,1fr)] items-start gap-3 rounded-xl border bg-background p-3 text-left transition-[border-color,box-shadow,background-color] outline-none","focus-visible:ring-2 focus-visible:ring-ring/50",H),e[0]=H,e[1]=F):F=e[1];const f=`${j}-who`;let k;e[2]!==f||e[3]!==h?(k=i.jsx("span",{id:f,className:"text-sm font-medium text-foreground",children:h}),e[2]=f,e[3]=h,e[4]=k):k=e[4];const Z=`${j}-meta`;let w;e[5]!==d||e[6]!==v||e[7]!==Z?(w=i.jsx("span",{id:Z,title:v,children:d}),e[5]=d,e[6]=v,e[7]=Z,e[8]=w):w=e[8];let I;e[9]!==k||e[10]!==w?(I=i.jsxs("span",{className:"flex flex-wrap items-baseline gap-x-1.5 text-xs text-muted-foreground",children:[k,w]}),e[9]=k,e[10]=w,e[11]=I):I=e[11];const V=`${j}-value`,y=`conflict-${s}`;let C;e[12]!==m||e[13]!==V||e[14]!==y?(C=i.jsx("span",{id:V,"data-testid":y,className:"min-w-0 text-sm",children:m}),e[12]=m,e[13]=V,e[14]=y,e[15]=C):C=e[15];let x;e[16]!==I||e[17]!==C?(x=i.jsxs("span",{className:"flex min-w-0 flex-col gap-1",children:[I,C]}),e[16]=I,e[17]=C,e[18]=x):x=e[18];let Y;return e[19]!==u||e[20]!==o||e[21]!==a||e[22]!==A||e[23]!==x||e[24]!==$||e[25]!==z||e[26]!==F?(Y=i.jsxs("button",{type:"button",role:"radio","aria-checked":o,"aria-labelledby":A,"aria-describedby":$,tabIndex:z,onClick:a,className:F,children:[u,x]}),e[19]=u,e[20]=o,e[21]=a,e[22]=A,e[23]=x,e[24]=$,e[25]=z,e[26]=F,e[27]=Y):Y=e[27],Y}function Pc(n){const e=it.c(4),{parts:s}=n;let o;e[0]!==s?(o=s.map(Ic),e[0]=s,e[1]=o):o=e[1];let a;return e[2]!==o?(a=i.jsx("span",{className:"whitespace-pre-wrap break-words",children:o}),e[2]=o,e[3]=a):a=e[3],a}function Ic(n,e){return n.kind==="changed"?i.jsx("mark",{className:"rounded-sm bg-warning/20 px-0.5 text-foreground",children:n.text},e):i.jsx("span",{children:n.text},e)}function Bc(n){const e=it.c(29),{preview:s}=n,o=Ft();switch(s.kind){case"empty":{let a;e[0]!==o?(a=o("sectionsEditor.formConflict.empty"),e[0]=o,e[1]=a):a=e[1];let u;return e[2]!==a?(u=i.jsx("span",{className:"italic text-muted-foreground",children:a}),e[2]=a,e[3]=u):u=e[3],u}case"text":{let a;return e[4]!==s.text?(a=i.jsx("span",{className:"whitespace-pre-wrap break-words",children:s.text}),e[4]=s.text,e[5]=a):a=e[5],a}case"image":{let a;return e[6]!==s.src?(a=i.jsx("img",{src:s.src,alt:"",className:"max-h-24 max-w-full rounded border object-contain"}),e[6]=s.src,e[7]=a):a=e[7],a}case"yesNo":{const a=s.value?"sectionsEditor.formConflict.yes":"sectionsEditor.formConflict.no";let u;e[8]!==o||e[9]!==a?(u=o(a),e[8]=o,e[9]=a,e[10]=u):u=e[10];let h;return e[11]!==u?(h=i.jsx("span",{children:u}),e[11]=u,e[12]=h):h=e[12],h}case"list":{const a=s.count===1?"sectionsEditor.formConflict.oneItem":"sectionsEditor.formConflict.items",u=String(s.count);let h;e[13]!==o||e[14]!==a||e[15]!==u?(h=o(a,{count:u}),e[13]=o,e[14]=a,e[15]=u,e[16]=h):h=e[16];let d;e[17]!==h?(d=i.jsx("span",{className:"text-muted-foreground",children:h}),e[17]=h,e[18]=d):d=e[18];let v;e[19]!==s.count||e[20]!==s.items?(v=s.items.some(Boolean)&&i.jsxs("span",{className:"flex flex-col",children:[s.items.map(Fc),s.count>s.items.length&&i.jsx("span",{children:"…"})]}),e[19]=s.count,e[20]=s.items,e[21]=v):v=e[21];let m;return e[22]!==d||e[23]!==v?(m=i.jsxs("span",{className:"flex flex-col gap-1",children:[d,v]}),e[22]=d,e[23]=v,e[24]=m):m=e[24],m}case"fields":{let a;e[25]!==s.entries?(a=s.entries.map(Kc),e[25]=s.entries,e[26]=a):a=e[26];let u;return e[27]!==a?(u=i.jsx("dl",{className:"grid grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-0.5",children:a}),e[27]=a,e[28]=u):u=e[28],u}}}function Kc(n){return i.jsxs("div",{className:"contents",children:[i.jsx("dt",{className:"text-muted-foreground",children:n.label}),i.jsx("dd",{className:"truncate",children:n.text})]},n.label)}function Fc(n,e){return i.jsx("span",{className:"truncate",children:`${e+1}. ${n||"…"}`},e)}function Oc(n,e){return n.kind==="protocol"&&n.source==="github"?e:null}function Lc(n,e){if(Object.hasOwn(n,e))return n[e]??null;const s=Yr(e),o=Object.keys(n).find(a=>Yr(a)===s);return o===void 0?null:n[o]??null}async function $c(n,e){try{const s=await fetch(`/api/${n.orgSlug}/decofile/${encodeURIComponent(n.virtualMcpId)}/${encodeURIComponent(n.branch)}`,{cache:"no-store",headers:Na("v8")});if(!s.ok)return null;const o=await s.json().catch(()=>({})),a=Lc(o.changedBy??{},e);return a&&typeof a.userId=="string"&&Number.isFinite(Date.parse(a.at))?a:null}catch{return null}}function zc(n,e,s){const o=e.find(h=>h.userId===n.userId),a=o?.user?.name?.trim(),u=o?.user?.image??void 0;return{...a?{name:a}:{},...u?{avatarUrl:u}:{},at:n.at,you:!!s&&n.userId===s}}function Hc(n){let e=2166136261,s=0;for(let o=0;o<n.length;o++){const a=n.charCodeAt(o);e=Math.imul(e^a,16777619),s=Math.imul(s,31)+a|0}return`${(e>>>0).toString(36)}${(s>>>0).toString(36)}:${n.length}`}function Wc(n,e,s){const o=it.c(19),a=!!n&&!!e&&s!==null;let u;o[0]!==e||o[1]!==n||o[2]!==s?(u=yo.conflictAuthor(n?`${n.orgSlug}/${n.virtualMcpId}/${n.branch}`:"",e??"",s??""),o[0]=e,o[1]=n,o[2]=s,o[3]=u):u=o[3];let h;o[4]!==e||o[5]!==n?(h=()=>$c(n,e),o[4]=e,o[5]=n,o[6]=h):h=o[6];let d;o[7]!==a||o[8]!==u||o[9]!==h?(d={queryKey:u,queryFn:h,enabled:a,staleTime:Number.POSITIVE_INFINITY,gcTime:6e5,retry:!1,refetchOnWindowFocus:!1},o[7]=a,o[8]=u,o[9]=h,o[10]=d):d=o[10];const{data:v}=qi(d),m=a?v??null:null,j=!!m;let A;o[11]!==j?(A={enabled:j},o[11]=j,o[12]=A):A=o[12];const{data:$}=Il(A);let z;o[13]!==$?(z=$?.data?.members??[],o[13]=$,o[14]=z):z=o[14];const H=z,{data:F}=xo.useSession();if(!m)return null;const f=F?.user?.id??null;let k;return o[15]!==m||o[16]!==H||o[17]!==f?(k=zc(m,H,f),o[15]=m,o[16]=H,o[17]=f,o[18]=k):k=o[18],k}function qc(n,e,s,o){if(!n||typeof n!="object")return{kind:"error",reason:"no-matcher-rule"};const a=e.trim();if(!a)return Gt(n,s,o)?{kind:"inline",blockKey:n.__resolveType??"",inlinedRule:xs(n,s,o)}:{kind:"noop"};const u=ys(n,s,o);if(!u)return{kind:"error",reason:"unreadable-rule"};if(u.blockKey)return{kind:"updateBlock",blockKey:u.blockKey,blockData:Kt(u.resolveType,u.data,a)};const h=Fn(a),d=On(h,s);return d?{kind:"error",reason:"invalid-block-id",message:d}:{kind:"createBlock",blockId:h,blockData:Kt(u.resolveType,u.data,a),reference:on(h)}}const ho="section-form-stale-save",Gc=3,Uc=1e3;function go(n,e){const s=e.global&&e.pageKey?[{label:"Default",sections:[{__resolveType:e.pageKey}]}]:So(e.pageKey?n[e.pageKey]?.sections:void 0,n),o=Math.max(0,Math.min(e.pageVariantIndex,s.length-1)),a=s[o]?.sections??[];return{pageVariants:s,variantIndex:o,rawSections:a,parsedSections:_n(a,n)}}const vo=new WeakMap;let Yc=0;function Jc(n){let e=vo.get(n);return e===void 0&&(e=++Yc,vo.set(n,e)),e}function tm({orgSlug:n,virtualMcpId:e,branch:s,previewReady:o=!0,previewUrl:a,currentPath:u,activePageBlockKey:h=null,activeGlobalBlockKey:d=null,externalSelection:v,onSaved:m,initialEditSeo:j=!1,onExitSeo:A,onSelectRoot:$,onViewJsonFile:z,onFocusedBlockChange:H,onVariantPreviewOverride:F}){const f=Ft(),k=Yi(),Z=k?.taskId??null,w=o?{orgSlug:n,virtualMcpId:e,branch:s,threadId:Z,previewUrl:a}:null,[I,V]=R.useState([]),{data:y,isLoading:C}=Ta(w,{pollWhile:I.length>0}),{data:x,isLoading:Y}=ia(w),M=Wn(),ge=k?.virtualMcpId,le=ka(ge===e?e:null)?.metadata?.siteSlug??null,ee=Rl({virtualMcpId:e,branch:s,sandboxUrl:a}),pe=Va(e,s),ce=Da(pe),he=!ce,ve=!!ee||ce,[b,B]=R.useState(null),[xe,T]=R.useState(null),[ye,K]=R.useState(null),[Se,ue]=R.useState(0),[te,se]=R.useState(void 0),[Te,X]=R.useState(null),[_e,be]=R.useState(null),[q,O]=R.useState([]),Ke=R.useRef(null),[Qe,Ze]=R.useState(q.length);Qe!==q.length&&(Ze(q.length),requestAnimationFrame(()=>{Ke.current&&(Ke.current.scrollTop=0)}));const[Ye,Q]=R.useState(0),[ke,He]=R.useState(null),[We,Ee]=R.useState(null),[Ie,Ve]=R.useState(null),[Xe,Fe]=R.useState(!1),[re,dt]=R.useState(!1),ne=R.useRef(null),[De,yt]=R.useState(!0),[et,ft]=R.useState(!1),[Ot,kn]=R.useState(!1),[qe,an]=R.useState(j),[Cs,Ns]=R.useState(j);j&&!Cs&&(Ns(!0),an(!0),B(null),T(null),K(null),O([])),!j&&Cs&&Ns(!1);const[Do,ln]=R.useState(null),[Ts,En]=R.useState(void 0),[Vs,Lt]=R.useState([]),[Ds,Yt]=R.useState(0),[Je,at]=R.useState(0),[Mo,tt]=R.useState(null),[Jt,st]=R.useState(null),[Ms,Ps]=R.useState(null),Is=Gi(),Bs=Ma({orgSlug:n,virtualMcpId:e,branch:s},{tunnel:!1}),cn=aa({orgSlug:n,virtualMcpId:e,branch:s}),[Po,Io]=R.useState(u),[Bo,Ko]=R.useState(h),[Fo,Oo]=R.useState(d);(Po!==u||Bo!==h||Fo!==d)&&(queueMicrotask(()=>cn.flush()),Io(u),Ko(h),Oo(d),B(null),T(null),K(null),ue(0),X(null),be(null),at(0),tt(null),st(null),O([]),Q(t=>t+1),an(!1),ln(null),En(void 0),Lt([]),Yt(t=>t+1));const G=la({orgSlug:n,virtualMcpId:e,branch:s}),un=ja((t,r)=>{G.mutate({blockKey:t,data:r},{onSuccess:()=>m?.(),onError:G.reportError})}),Rn=Oa({orgSlug:n,virtualMcpId:e,branch:s}),[Qt,Zt]=R.useState(!1),W=R.useRef(null),At=R.useRef(null),mt=R.useRef(null),pt=R.useRef(null),An=R.useRef({}),$t=R.useRef(null),dn=R.useRef(!1),fn=R.useRef(!1),Oe=R.useRef(new Map),Xt=R.useRef(!1),St=R.useRef([]),qn=R.useRef(new WeakSet);Pa(n,e,t=>{const{activePageKey:r,rawSections:l,parsedSections:c,selectedSectionIndex:p}=Le.current,S=new Set;r&&S.add(r);for(const g of[At.current?.sectionIndex,p]){const _=g==null?void 0:l[g],L=g==null?void 0:c[g],N=_&&L?.isSavedBlock?ds(_,L):null;N&&S.add(N)}if([...S].some(g=>t.has(g))){for(const g of[W,mt,pt])g.current&&clearTimeout(g.current),g.current=null;At.current=null,Oe.current.clear(),r&&t.has(r)&&(An.current={})}});const Le=R.useRef({rawSections:[],parsedSections:[],decofile:{},activePageKey:null,pageVariants:[],variantIndex:0,sectionVariantIndex:0,selectedSectionIndex:null}),[Ks,Fs]=R.useState(0),[Lo,$o]=R.useState(0),zo=Wc(Oc(pe,{orgSlug:n,virtualMcpId:e,branch:s}),I[0]?.blockKey??null,I[0]?Hc(ze(I[0].plan.theirs)):null),[Ho,Wo]=R.useState(null),Gn=Ia(n,e).epoch,[qo,Go]=R.useState(Gn);if(!o||C||Y)return i.jsx("div",{className:"h-full w-full flex items-center justify-center",children:i.jsx(Ui,{className:"size-5 text-muted-foreground"})});if(!y||!x)return i.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:f("sectionsEditor.sectionsEditor.couldNotLoadSiteData")});const Uo=Ha(y,x),ie=!!d,je=ie?null:Wa(Uo,u,h),E=ie?d:je?.key??null,Un=ie&&d?y[d]:void 0,Os=ie&&d&&Un?qa(d,Un):ie&&d?d:"",mn=!ie&&E&&y[E]?y[E]:null,Yn=qe&&y&&x&&E&&je?Kr(y,{kind:"page",pageKey:E,pageName:String(je.name??""),path:String(je.path??"")},x):null,Yo=qe?mn?.seo:void 0,Cn=Ts!==void 0?Ts:Yo,Jo=qe?ca(Cn):void 0,Ls=Yn?.seoTypeOptions??[],$s=qe&&x?ua(x):"",Jn=Do??Jo??{},Nn=qe&&Yn?Bl(Jn,Yn):null,zs=qe&&Nn&&da(Cn)?Kn(Nn,x):null,Hs=qe?fa(y,x)?.seoData:void 0,Me=ie?[{label:"Default",sections:[{__resolveType:d}]}]:So(mn?.sections,y??{}),ht=Me.length>1,we=Math.min(Se,Me.length-1),rt=Me[we],U=rt?.sections??[],Pe=_n(U,y),Qn=!ie&&Ga(mn?.sections);if(ie&&d&&Ms!==d){Ps(d);const t=U[0],r=Pe[0];if(t&&r){B(0),at(0),O([]);const l=jt(t,r,y);l&&(T(l.data),K(l.resolveType),st(null),tt(null))}}!ie&&Ms!==null&&Ps(null),Le.current={rawSections:U,parsedSections:Pe,decofile:y??{},activePageKey:E,pageVariants:Me,variantIndex:we,sectionVariantIndex:Je,selectedSectionIndex:b};const Qo=()=>({multivariate:Qn,index:we,variants:Me.map(t=>({rule:t.rule}))}),Zn=(t,r)=>{if(!F)return;if(!E||!Qn||t.length<=1){F(null);return}const l={multivariate:!0,index:r,variants:t},c=ce?ro(E,l):oo(E,l,y,x);F(c.length>0?c:null)},Xn=F&&E&&Qn&&ht&&!C&&!Y?E:null;if(Xn!==Ho&&(Wo(Xn),Xn)){const t=Me.map(l=>({rule:l.rule})),r=we;queueMicrotask(()=>Zn(t,r))}const en=(t,r,l)=>{if(!F)return;if(!E){F(null);return}const c=Qo(),p=ce?ro(E,c):oo(E,c,y,x);if(!t||r<0){F(p.length>0?p:null);return}const S={pageKey:E,page:c,sectionIndex:r,sectionLazy:Pe[r]?.isLazy??!1,mvObj:t,selectedVariantIndex:l},g=ce?Fl(S):Ol({...S,decofile:y,meta:x}),_=[...p,...g];F(_.length>0?_:null)},bt=(t,r,l,c=b??-1,p=!1)=>{const S=xt(t,r);if(!S){T(null),K(null),st(null),tt(null),p&&en(null,c,l);return}const _=vs(S,wt)[l];if(!_){T(null),K(null),st(null),tt(null),p&&en(null,c,l);return}const L=wo(_.value,y);T(L?.data??null),K(L?.resolveType??null);const{resolveType:N,formValue:D}=jn(_.rule,y,x??void 0);st(N),tt(D),p&&en(S,c,l)},pn=v?.index;if(v!==void 0&&(v?.seq??null)!==te&&(se(v?.seq??null),typeof pn=="number")){const t=U[pn],r=Pe[pn];if(t&&r)if(B(pn),at(0),O([]),Q(l=>l+1),r.isMultivariate)bt(t,r,0,pn);else{const l=jt(t,r,y);l?(T(l.data),K(l.resolveType)):(T(null),K(null)),st(null),tt(null)}}if(Gn!==qo){Go(Gn);const t=W.current!==null||Oe.current.size>0||pt.current!==null||mt.current!==null||G.isPending||cn.isPending||I.length>0,r=b!==null&&co(Ke.current,document.activeElement);if(!t&&r&&(Xt.current=!0),!t&&!r&&b!==null){const l=U[b],c=Pe[b];if(O([]),Q(p=>p+1),!l||!c)B(null),T(null),K(null);else if(c.isMultivariate)bt(l,c,Je,b);else{const p=jt(l,c,y);T(p?.data??null),K(p?.resolveType??null)}}!t&&qe&&(ln(null),En(void 0),Yt(l=>l+1))}if(Ks!==Lo){$o(Ks);const t=b!==null?U[b]:null,r=b!==null?Pe[b]:null;if(t&&r&&b!==null)if(O([]),Q(l=>l+1),r.isMultivariate)bt(t,r,Je,b);else{const l=jt(t,r,y);T(l?.data??null),K(l?.resolveType??null)}}const lt=I[0];if(lt){const{formBase:t,target:r}=lt,l=go(y,r),c=t.sectionIndex,p=l.rawSections.length===t.sectionCount?hs(l.rawSections[c],l.parsedSections[c],r.sectionVariantIndex,y):null,S=lc(lt,p,g=>ao(t,g));if(S){const _=[{...lt,...S,changedAgain:!0},...I.slice(1)];St.current=_,V(_)}}const hn={orgSlug:n,virtualMcpId:e,branch:s,threadId:Z,previewUrl:ce?void 0:a??void 0,siteSlug:le},Tn=ye&&x?Kn(ye,x):null,ct=(t,r)=>{if(!E)return;W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear(),pt.current&&(clearTimeout(pt.current),pt.current=null),mt.current&&(clearTimeout(mt.current),mt.current=null);const l=Sn(y,E,t,we,Me);G.mutate({blockKey:E,data:l},{onSuccess:()=>r?.onSuccess?.()??m?.(),onError:c=>{r?.onError?.(),G.reportError(c)}})},zt=()=>{H?.(null),B(null),kn(!1),T(null),K(null),at(0),tt(null),st(null),O([]),Q(t=>t+1)},Ws=()=>co(Ke.current,document.activeElement),es=(t=f("sectionsEditor.sectionsEditor.blockChangedElsewhere"))=>{if(W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear(),At.current=null,oe.error(t,{id:ho}),Ws()){Xt.current=!0;return}Fs(r=>r+1)},qs=()=>{!Xt.current||Ws()||St.current.length>0||W.current!==null||dn.current||fn.current||Oe.current.size>0||(Xt.current=!1,Fs(t=>t+1))},Gs=()=>{Xt.current&&setTimeout(qs,0)},Us=t=>Ka(Is,Bs,t),Ys=t=>{Oe.current.size!==0&&setTimeout(()=>{if(dn.current||fn.current)return;const r=[...Oe.current.values()];Oe.current.clear();for(const l of r)l()},t)},Zo=t=>{const{activePageKey:r,variantIndex:l,sectionVariantIndex:c}=Le.current,p=$t.current;return{formBase:p?.sectionIndex===t&&p.variantIndex===c?p:null,pageKey:r,global:ie,pageVariantIndex:l,sectionVariantIndex:c,schema:Tn}},gn=t=>{St.current=t,V(t)},Xo=t=>{const r=St.current,l=r.findIndex(S=>S.formBase===t.formBase),c=l>=0?r[l]:void 0,p=c?r.with(l,{...t,choices:ks(c.plan,c.choices,t.plan),fresh:To(c.plan,t.plan,c.fresh),changedAgain:c.changedAgain||ze(c.plan.theirs)!==ze(t.plan.theirs)}):[...r,{...t,changedAgain:qn.current.has(t.formBase)}];gn(p)},Js=(t,r)=>{const l=St.current,c=l.findIndex(g=>g.formBase===t),p=l[c];if(!p)return!1;if(ze(p.plan.mine)===ze(r))return!0;const S=ws({...p.plan,mine:r});if(S.pointers.length===0){const g=l.filter(_=>_!==p);return gn(g),!1}return gn(l.with(c,{...p,plan:S,choices:ks(p.plan,p.choices,S)})),!0},ei=t=>{const r=Le.current;return r.selectedSectionIndex===t.formBase.sectionIndex&&r.activePageKey===t.target.pageKey&&r.variantIndex===t.target.pageVariantIndex&&r.sectionVariantIndex===t.target.sectionVariantIndex},ti=()=>{const t=St.current[0];if(!t)return null;const{formBase:r,target:l}=t;W.current&&At.current?.sectionIndex===r.sectionIndex&&At.current.sectionVariantIndex===l.sectionVariantIndex&&(clearTimeout(W.current),W.current=null,At.current=null),Oe.current.delete(`${l.pageKey}:${r.sectionIndex}:${l.sectionVariantIndex}`);const c=r.emitted;return c&&typeof c=="object"&&!Js(r,c)&&vn(c,r.sectionIndex,0,l),St.current[0]??null},ni=()=>{const t=St.current[0],r=ti();if(!r||!t||r.formBase!==t.formBase||r.plan.pointers.some(S=>!t.plan.pointers.includes(S)))return;const l=ic(r.plan,r.choices);gn(St.current.slice(1));const{formBase:c,target:p}=r;c.base=r.plan.theirs,c.version=void 0,c.emitted=l,qn.current.add(c),($t.current===c||ei(r))&&($t.current=c,T(l),Q(S=>S+1)),vn(l,c.sectionIndex,0,p)},si=t=>{const[r,...l]=St.current;r&&gn([{...r,choices:t},...l])},vn=(t,r,l=0,c)=>{const p=c??Zo(r),S=p.sectionVariantIndex,g=p.formBase,_=At.current;W.current&&(clearTimeout(W.current),W.current=null,_&&(_.sectionIndex!==r||_.sectionVariantIndex!==S)&&_.write());const L=`${p.pageKey}:${r}:${S}`,N=()=>{if(dn.current||fn.current){Oe.current.set(L,N);return}const D=typeof t=="function"?t():t;if(g&&Js(g,D))return;const P=Le.current.decofile,{rawSections:de,parsedSections:Re,pageVariants:nt,variantIndex:Be}=go(P,p),Ge=p.pageKey,J=de[r];if(!J)return;const fe=Re[r];if(!fe)return;const Ce=g?.base,Ue=hs(J,fe,S,P),gt=!!Ce&&!!Ue&&Ao(Ce,Ue)&&!(g&&ao(g,Ue));if(gt&&Ce&&Ue){if(Co(Ce,Ue)){es(f("sectionsEditor.sectionsEditor.sectionReplacedElsewhere"));return}const Ae=fe.isSavedBlock?"here":rc(Ce,de.map((Ne,Mt)=>hs(Ne,Re[Mt],S,P)),r,g?.sectionCount??de.length);if(Ae==="unknown"){es(f("sectionsEditor.sectionsEditor.sectionReplacedElsewhere"));return}if(typeof Ae=="number"&&g){g.sectionCount=de.length,g.sectionIndex=Ae,$t.current===g&&B(Ae),vn(D,Ae,l,p);return}}const ot=gt&&Ce&&Ue?ws({ancestor:Ce,mine:D,theirs:Ue}):null;if(ot&&ot.pointers.length>0&&g){g.sectionCount=de.length,Xo({plan:ot,formBase:g,target:p,sectionIndex:r,choices:No(ot),changedAgain:!1,blockKey:fe.isSavedBlock?ds(J,fe):Ge,fresh:{}});return}const vt=ot?ot.merged:null,Dt=vt??D,Mr=oc({merged:!!vt,tracked:g,current:$t.current,saved:D});vt&&oe.info(f("sectionsEditor.sectionsEditor.blockMergedWithOthers"),{id:ho}),Mr&&g&&(g.emitted=vt,T(vt));const cs=Mr||!vt?Dt:D;g&&(g.base=cs,g.sectionCount=de.length,nc(g,cs));const Pr={onSuccess:()=>{g&&qn.current.delete(g),m?.()},onError:Ae=>{if(g?.base===cs&&Ce&&(g.base=Ce),Ae instanceof Ba){g&&(g.version=void 0),l<Gc?(Oe.current.delete(L),fn.current=!0,setTimeout(()=>{fn.current=!1,vn(()=>{const Ne=g?.emitted;return Ne&&typeof Ne=="object"?Ne:D},r,l+1,p),Oe.current.delete(L),Ys(bn)},Uc*2**l)):es();return}G.reportError(Ae)}},Ir=Ae=>{dn.current=!0;let Ne=!1;G.mutateAsync(Ae).then(()=>Pr.onSuccess(),Mt=>{Ne=!0,Pr.onError(Mt)}).finally(()=>{dn.current=!1,Ys(Ne?bn:0),qs()})};if(fe.isSavedBlock){const Ae=ds(J,fe);if(!Ae)return;Ir({blockKey:Ae,data:Dt,...Ce?{base:{value:vt?Ue:Ce}}:{},rebaseOnConflict:!1,guard:lo({formBase:g,rebased:!!vt,versionOf:Us})});return}if(!Ge)return;const In={...P[Ge]},Wt=[...de];if(fe.isMultivariate){const Ae=xt(J,fe);if(!Ae||!Ge)return;const Ne=al(Ae,S,Dt);Wt[r]=qt(J,fe,Ne)}else if(fe.isHidden){const Ae=Rs(J.__resolveType),Ne=Ae?{...J.section}:{...J},Mt=Array.isArray(Ne.variants)?[...Ne.variants]:[];Mt[0]&&(Mt[0]={...Mt[0],value:Dt}),Ne.variants=Mt,Ae?Wt[r]={...J,section:Ne}:Wt[r]=Ne}else fe.isLazy?Wt[r]={...J,section:Dt}:Wt[r]=Dt;if(nt.length>1){const Ae=In.sections,Ne=[...Ae?.variants??[]];Ne[Be]&&(Ne[Be]={...Ne[Be],value:Wt}),In.sections={...Ae,variants:Ne}}else In.sections=Wt;Ir({blockKey:Ge,data:In,rebaseOnConflict:!1,guard:lo({formBase:null,rebased:!1,versionOf:Us})})};At.current={sectionIndex:r,sectionVariantIndex:S,write:N},W.current=setTimeout(()=>{W.current=null,N()},bn)},ri=t=>{Xt.current=!1,B(t),at(0),O([]),Q(p=>p+1);const r=U[t],l=Pe[t];if(H?.(l?.isSavedBlock?l.resolveType??null:null),!r||!l)return;if(l.isMultivariate){bt(r,l,0,t);return}const c=jt(r,l,y);if(!c){T(null),K(null),st(null),tt(null),en(null,t,0);return}T(c.data),K(c.resolveType),st(null),tt(null),en(null,t,0)},Qs=t=>{const r=t;b!==null&&($t.current=sc($t.current,{sectionIndex:b,variantIndex:Le.current.sectionVariantIndex,shown:xe,next:r,sectionCount:Le.current.rawSections.length})),T(r),b!==null&&vn(r,b)},ts=t=>{if(!E||!y||!x||!je)return;const r={kind:"page",pageKey:E,pageName:String(je.name??""),path:String(je.path??"")},l=Kr(y,r,x);l&&cn.save(E,()=>{const c=Is.getQueryData(yo.decofile(Bs))?.[E];if(!c||typeof c!="object"||c===null||Array.isArray(c))return null;const p={...c,...An.current};return An.current={},t?.raw!==void 0?{...p,seo:t.raw}:t?.inner!==void 0?Kl(r,l,p,t.inner):p})},Zs=(t,r)=>{E&&(An.current[t]=r,ts())},oi=(t,r)=>{if(!E)return;const l=Ln([...U],t,r);b!==null&&(b===t?B(r):t<b&&r>=b?B(b-1):t>b&&r<=b&&B(b+1)),ct(l)},ii=t=>{if(!E)return;const r=U.filter((l,c)=>c!==t);b===t?zt():b!==null&&b>t&&B(b-1),ct(r)},ai=t=>{if(!E)return;const r=U[t];if(!r)return;const l=[...U];l.splice(t+1,0,wa(r)),b!==null&&b>t&&B(b+1),ct(l)},li=t=>{if(!E)return;const r=U[t],l=Pe[t];if(!r||!l)return;const c=l.isHidden?nl(r):sl(r);if(!c)return;const p=[...U];p[t]=c,b===t&&zt(),ct(p)},ci=t=>{if(!E)return;const r=U[t],l=Pe[t];if(!r||!l||l.isMultivariate)return;const c=tl(r);if(!c)return;const p=[...U];p[t]=c,b===t&&zt(),ct(p)},ui=t=>{if(!E)return;const r=U[t],l=Pe[t];if(!r||!l?.isSavedBlock)return;const c=jt(r,l,y);if(!c?.data)return;const{name:p,...S}=c.data,g=[...U];l.isLazy?g[t]={...r,section:S}:g[t]=S,b===t&&zt(),ct(g)},di=t=>{if(!E)return;const r=[...U,{__resolveType:t.resolveType}],l=r.length-1;ct(r,{onError:()=>{Le.current.selectedSectionIndex===l&&zt()}}),Fe(!1),B(l),at(0),O([]),Q(g=>g+1);const c=r[l],p=_n(r,y)[l];if(!c||!p)return;if(p.isMultivariate){bt(c,p,0);return}const S=jt(c,p,y);if(!S){T(null),K(null),st(null),tt(null);return}T(S.data),K(S.resolveType),st(null),tt(null)},Xs=t=>{ne.current=t.append,Fe(!0)},fi=t=>{const r=ne.current;if(!r){di(t);return}r({__resolveType:t.resolveType}),Fe(!1),ne.current=null},er=t=>{if(b===null)return;const r=U[b],l=Pe[b];!r||!l?.isMultivariate||(at(t),O([]),Q(c=>c+1),bt(r,l,t,b,!0))},mi=t=>{if(b===null||!E)return;const r=U[b],l=Pe[b];if(!r||!l?.isMultivariate)return;const c=xt(r,l);if(!c)return;const p=Xa(c,t);if(!p){oe.error(f("sectionsEditor.sectionsEditor.cannotDeleteOnlyVariant"));return}const S=[...U];S[b]=qt(r,l,p);const g=p.variants;let _=Je;t===Je?_=Math.min(t,g.length-1):t<Je&&(_=Je-1),at(_),O([]),Q(L=>L+1),bt(S[b],l,_),ct(S)},pi=t=>{if(b===null||!E)return;const r=U[b],l=Pe[b];if(!r||!l?.isMultivariate)return;const c=xt(r,l);if(!c)return;const p=el(c,t),S=[...U];S[b]=qt(r,l,p);const g=t+1;at(g),O([]),Q(_=>_+1),bt(S[b],l,g),ct(S)},hi=(t,r)=>{if(b===null||!E||t===r)return;const l=U[b],c=Pe[b];if(!l||!c?.isMultivariate)return;const p=xt(l,c);if(!p)return;const S=Qa(p,t,r),g=[...U];g[b]=qt(l,c,S);let _=Je;Je===t?_=r:t<Je&&r>=Je?_=Je-1:t>Je&&r<=Je&&(_=Je+1),at(_),bt(g[b],c,_),ct(g)},xn=t=>{const r=t??b;if(r===null||!E)return;const l=U[r],c=Pe[r];if(!l||!c)return;const p=Ua(l,c);if(!p){oe.error(f("sectionsEditor.sectionsEditor.sectionCannotHaveVariants"));return}const S=[...U];S[r]=p.section;const g=_n(S,y)[r];if(!g?.isMultivariate){oe.error(f("sectionsEditor.sectionsEditor.couldNotAddVariant"));return}B(r),at(p.newVariantIndex),O([]),Q(_=>_+1),bt(p.section,g,p.newVariantIndex,r),ct(S)},tr=()=>{if(b===null||!E)return;const t=U[b],r=Pe[b];if(!t||!r?.isMultivariate)return;const l=xt(t,r);if(!l)return;const c=Za(t,r,l);if(!c){oe.error(f("sectionsEditor.sectionsEditor.couldNotRemoveVariants"));return}const p=[...U];p[b]=c;const S=_n(p,y)[b];if(!S)return;at(0),st(null),tt(null),O([]),Q(_=>_+1);const g=jt(c,S,y);g?(T(g.data),K(g.resolveType)):(T(null),K(null)),en(null,b,0),ct(p)},gi=async t=>{if(ke===null||!E)return;const r=On(t,y,x);if(r){oe.error(r);return}const l=U[ke],c=Pe[ke];if(!l||!c)return;const p=jt(l,c,y);if(!p){oe.error(f("sectionsEditor.sectionsEditor.sectionCannotBeSavedAsGlobal"));return}const S={...p.data,name:t};try{await G.mutateAsync({blockKey:t,data:S});const g=[...U];g[ke]={__resolveType:t},await G.mutateAsync({blockKey:E,data:Sn(y,E,g,we,Me)}),b===ke&&zt(),He(null),oe.success(f("sectionsEditor.sectionsEditor.savedGlobalBlock",{blockId:t})),m?.()}catch(g){oe.error(f("sectionsEditor.sectionsEditor.failedToSaveGlobalBlock"),{description:Pt(f,It(g))})}},nr=rt?.rule;if(ht&&b===null&&_e===null&&nr){const{resolveType:t,formValue:r}=jn(nr,y??{},x??void 0);be(t),X(r)}const tn=x?ma(x):[],ns=x&&y?pa(x,y):[],sr=!ie&&!!(ve&&x&&y),rr=_e&&x?Kn(_e,x):null,Ct=()=>{mt.current&&(clearTimeout(mt.current),mt.current=null),pt.current&&(clearTimeout(pt.current),pt.current=null)},Ht=async(t,r)=>{if(!(il(r,t,x)>0))try{await Rn.mutateAsync({blockKey:t})}catch(l){oe.error(f("sectionsEditor.sectionsEditor.couldNotDeleteMatcherBlock"),{description:Pt(f,It(l))})}},or=t=>{mt.current&&clearTimeout(mt.current),mt.current=setTimeout(()=>{const{activePageKey:r,decofile:l,variantIndex:c}=Le.current;if(!r)return;const p={...l[r]},S={...p.sections},g=[...S.variants??[]],_=g[c],L=_?.rule;if(Gt(L,l,x)){const N=L?.__resolveType??"",D=l[N],P=typeof D?.name=="string"?D.name:N,{__resolveType:de,...Re}=t;G.mutate({blockKey:N,data:Kt(de??"",Re,P)},{onSuccess:()=>m?.(),onError:G.reportError});return}_&&(g[c]={..._,rule:t}),p.sections={...S,variants:g},G.mutate({blockKey:r,data:p},{onSuccess:()=>m?.(),onError:G.reportError})},bn)},ir=t=>{be(t);const r=t?Jr(t,x):{__resolveType:Qr};X(t?r:{}),or(r)},ar=t=>{const r=t;X(r);const l=_e?{__resolveType:_e,...r}:{...r};or(l)},lr=async t=>{Ct();const{activePageKey:r,decofile:l,variantIndex:c}=Le.current;if(!r)return;const p=l[r],S=p?.sections;if(!S||typeof S!="object"||Array.isArray(S))return;const g=S;if(!Array.isArray(g.variants))return;const _=[...g.variants],L=_[c];if(!L)return;const N=Bt(L.rule,l,x),D=on(t);_[c]={...L,rule:D};const P={...l,[r]:{...p,sections:{...g,variants:_}}},{resolveType:de,formValue:Re}=jn(D,P,x??void 0);be(de),X(Re);try{await G.mutateAsync({blockKey:r,data:P[r]}),N&&N!==t&&await Ht(N,P),m?.()}catch(nt){oe.error(f("sectionsEditor.sectionsEditor.couldNotApplySavedRule"),{description:Pt(f,It(nt))})}},cr=t=>{pt.current&&clearTimeout(pt.current);const{selectedSectionIndex:r,sectionVariantIndex:l}=Le.current;r!==null&&(pt.current=setTimeout(()=>{const{rawSections:c,parsedSections:p,decofile:S,activePageKey:g,pageVariants:_,variantIndex:L}=Le.current;if(!g)return;const N=c[r],D=p[r];if(!N||!D?.isMultivariate)return;const P=xt(N,D);if(!P)return;const Re=(P.variants??[])[l]?.rule;if(Gt(Re,S,x)){const J=Re?.__resolveType??"",fe=S[J],Ce=typeof fe?.name=="string"?fe.name:J,{__resolveType:Ue,...gt}=t;G.mutate({blockKey:J,data:Kt(Ue??"",gt,Ce)},{onSuccess:()=>m?.(),onError:G.reportError});return}const nt=Zr(P,l,t),Be=[...c];Be[r]=qt(N,D,nt);const Ge=Sn(S,g,Be,L,_);G.mutate({blockKey:g,data:Ge},{onSuccess:()=>m?.(),onError:G.reportError})},bn))},vi=t=>{st(t);const r=t?Jr(t,x):{__resolveType:Qr};tt(t?r:{}),cr(r)},xi=t=>{const r=t;tt(r);const l=Jt?{__resolveType:Jt,...r}:{...r};cr(l)},yi=async t=>{Ct();const{selectedSectionIndex:r,sectionVariantIndex:l,rawSections:c,parsedSections:p,decofile:S,activePageKey:g,pageVariants:_,variantIndex:L}=Le.current;if(r===null||!g)return;const N=c[r],D=p[r];if(!N||!D?.isMultivariate)return;const P=xt(N,D);if(!P)return;const de=P.variants??[],Re=Bt(de[l]?.rule,S,x),nt=on(t),Be=Zr(P,l,nt),Ge=[...c];Ge[r]=qt(N,D,Be);const J=Sn(S,g,Ge,L,_),fe={...S,[g]:J},{resolveType:Ce,formValue:Ue}=jn(nt,fe,x??void 0);st(Ce),tt(Ue);try{await G.mutateAsync({blockKey:g,data:J}),Re&&Re!==t&&await Ht(Re,fe),m?.()}catch(gt){oe.error(f("sectionsEditor.sectionsEditor.couldNotApplySavedRule"),{description:Pt(f,It(gt))})}};if(!ie&&!je)return i.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:f("sectionsEditor.sectionsEditor.noPageFound",{currentPath:u})});if(ie&&!Un)return i.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:f("sectionsEditor.sectionsEditor.globalBlockNotFound")});const $e=b!==null?Pe[b]??null:null,ur=b!==null?U[b]:null,dr=ur&&$e?.isMultivariate?xt(ur,$e):null,Nt=dr?vs(dr,wt):[],Vn=Math.min(Je,Math.max(Nt.length-1,0)),nn=Nt[Vn]??null,Tt=$e?.isMultivariate===!0,ss=b!==null&&$e!==null,Vt=ss&&(Tt||!!(Tn&&xe)),Si=Vt&&!ie&&$e?.isSavedBlock===!0,ut=ie||Si,fr=ie?Os:$e?.label??"",bi=Jt&&x?Kn(Jt,x):null,mr=(t,r)=>r&&M?`${t} · ${r}`:t,pr=$e?$e.variantOf??$e.label:"",ji=(()=>{const t=Tt&&nn?nn.label:null;return t?M?[mr(pr,t)]:[$e.label,t]:[$e?.label??""]})(),rs=mr(je?.name??"",ht?rt?.label:null),Dn=Vt&&(!ie||q.length>0)?ie?[Os,...q]:[rs,...ji,...q]:[],hr=qe&&je?[je.name,"SEO",...Vs]:[],gr=f("sectionsEditor.pageVariantTabs.variantsLabel"),vr=et&&je?[je.name,gr]:Ot&&je&&$e?[rs,pr,gr]:[],Mn=vr.length>0?vr:hr.length>0?hr:ut?Dn.length>0?Dn:[fr]:Dn.length>0?Dn:[rs],xr=ss&&!Tt&&!$e?.isHidden&&!!E,wi=ut||!ie&&ht&&!!rt||xr,_i=ss&&!Tt&&!ie&&q.length===0&&!!$e&&jo($e)&&!!E,ki=M&&Vt&&!Ot&&Tt&&q.length===0&&!!nn,yr=M&&q.length>0?Fr(q[q.length-1]):null,Ei=q.length>1?Fr(q[q.length-2]):null,Sr=ut?fr:Vt?$e?.label??"":je?.name??"",Ri=et||Ot?f("sectionsEditor.pageVariantTabs.variantsLabel"):qe?f("sectionsEditor.panelSections.seo"):yr??Sr,br=Ot?$e?.variantOf??$e?.label??"":et||qe?je?.name??"":yr?Ei??Sr:ut?f("sectionsEditor.sectionsEditor.globalSectionSubtitle"):Vt?je?.name??"":je?.path??"",os=!et&&!Ot&&!qe&&!Vt&&!ut,Ai=!M&&!qe&&!ie&&Tt&&q.length===0,yn=()=>{if(!E)return;Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const t=y[E],r=Ya(t.sections,U);if(!r)return;const l=Ja(r);G.mutate({blockKey:E,data:{...t,sections:r}},{onSuccess:()=>{ue(l),B(null),T(null),K(null),O([]),X(null),be(null)},onError:G.reportError})},Pn=(t,r,l)=>{if(!E)return;Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const c=y[E],p=c.sections;if(!p||typeof p!="object"||Array.isArray(p))return;const S=p;if(!Array.isArray(S.variants))return;const g=t([...S.variants]);if(!g)return;const _=ol(S,g),L={...y,[E]:{...c,sections:_}};G.mutate({blockKey:E,data:L[E]},{onSuccess:()=>{r?.();const N=typeof l=="string"?[l]:l??[];(async()=>{for(const D of N)await Ht(D,L)})()},onError:G.reportError})},is=t=>{Ee(null),ue(t),B(null),T(null),K(null),O([]);const r=Me[t]?.rule,{resolveType:l,formValue:c}=jn(r,y??{},x??void 0);be(l),X(c),Zn(Me.map(p=>({rule:p.rule})),t)},jr=(t,r)=>{if(t===r)return;let l=we;we===t?l=r:t<we&&r>=we?l=we-1:t>we&&r<=we&&(l=we+1),ue(l);const c=Ln(Me.map(p=>({rule:p.rule})),t,r);Zn(c,l),Pn(p=>Ln(p,t,r))},wr=t=>{const r=Me[t]?.rule,l=Bt(r,y??{},x??void 0);Pn(c=>c.length<=1?null:(c.splice(t,1),c),()=>{Me.length-1===1?ue(0):t<we?ue(we-1):t===we&&ue(Math.max(0,t-1)),B(null),T(null),K(null),O([]),X(null),be(null)},l)},Ci=()=>{const t=Me.map((r,l)=>({variant:r,index:l})).filter(({variant:r})=>!rl(r.rule)).map(({variant:r})=>Bt(r.rule,y??{},x??void 0)).filter(r=>!!r);Pn(r=>{const l=ll({variants:r}),c=r[l];return c?[{...c,rule:cl()}]:null},()=>{ue(0),B(null),T(null),K(null),O([]),X(null),be(null),ft(!1)},t)},_r=t=>{Pn(r=>ul(r,t),()=>{ue(t+1),B(null),T(null),K(null),O([]),X(null),be(null)})},Ni=async(t,r)=>{Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const l=Le.current.activePageKey,c=Le.current.decofile;if(!l)return;const p=c[l],S=p.sections;if(!S||typeof S!="object"||Array.isArray(S))return;const g=S;if(!Array.isArray(g.variants))return;const _=[...g.variants],L=_[t];if(!L?.rule||typeof L.rule!="object"){oe.error(f("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const N=L.rule,D=r.trim();Zt(!0);try{if(!D){if(!Gt(N,c,x)){Ee(null);return}const Ge=N.__resolveType??"";_[t]={...L,rule:xs(N,c,x)};const J={...c,[l]:{...p,sections:{...g,variants:_}}};await G.mutateAsync({blockKey:l,data:J[l]}),await Ht(Ge,J),Ee(null),m?.();return}const P=ys(N,c,x);if(!P){oe.error(f("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(P.blockKey){await G.mutateAsync({blockKey:P.blockKey,data:Kt(P.resolveType,P.data,D)}),Ee(null),m?.();return}const de=Fn(D),Re=On(de,c,x);if(Re){oe.error(Re);return}const nt=Kt(P.resolveType,P.data,D);let Be=null;try{await G.mutateAsync({blockKey:de,data:nt}),Be=de,_[t]={...L,rule:on(de)},await G.mutateAsync({blockKey:l,data:{...p,sections:{...g,variants:_}}}),Be=null}catch(Ge){throw Be&&await Rn.mutateAsync({blockKey:Be}).catch(()=>{}),Ge}Ee(null),oe.success(f("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:D})),m?.()}catch(P){oe.error(f("sectionsEditor.sectionsEditor.failedToRenameVariant"),{description:Pt(f,It(P))})}finally{Zt(!1)}},Ti=async(t,r)=>{Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const{selectedSectionIndex:l,rawSections:c,parsedSections:p,decofile:S,activePageKey:g,pageVariants:_,variantIndex:L}=Le.current;if(l===null||!g)return;const N=c[l],D=p[l];if(!N||!D?.isMultivariate)return;const P=xt(N,D);if(!P)return;const de=P.variants??[],Re=de[t];if(!Re?.rule||typeof Re.rule!="object"){oe.error(f("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const nt=Re.rule,Be=r.trim();Zt(!0);const Ge=async J=>{const fe={...P,variants:J},Ce=[...c];Ce[l]=qt(N,D,fe);const Ue=Sn(S,g,Ce,L,_);return await G.mutateAsync({blockKey:g,data:Ue}),{...S,[g]:Ue}};try{if(!Be){if(!Gt(nt,S,x)){Ve(null);return}const ot=nt.__resolveType??"",vt=[...de];vt[t]={...Re,rule:xs(nt,S,x)};const Dt=await Ge(vt);await Ht(ot,Dt),Ve(null),m?.();return}const J=ys(nt,S,x);if(!J){oe.error(f("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(J.blockKey){await G.mutateAsync({blockKey:J.blockKey,data:Kt(J.resolveType,J.data,Be)}),Ve(null),m?.();return}const fe=Fn(Be),Ce=On(fe,S,x);if(Ce){oe.error(Ce);return}const Ue=Kt(J.resolveType,J.data,Be);let gt=null;try{await G.mutateAsync({blockKey:fe,data:Ue}),gt=fe;const ot=[...de];ot[t]={...Re,rule:on(fe)},await Ge(ot),gt=null}catch(ot){throw gt&&await Rn.mutateAsync({blockKey:gt}).catch(()=>{}),ot}Ve(null),oe.success(f("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:Be})),m?.()}catch(J){oe.error(f("sectionsEditor.sectionsEditor.failedToRenameVariant"),{description:Pt(f,It(J))})}finally{Zt(!1)}},kr=async(t,r,l)=>{T(l);try{await G.mutateAsync({blockKey:t,data:l})}catch(c){throw T(p=>p===l?r:p),c}},Vi={rename:async(t,r,l)=>{Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const{activePageKey:c,decofile:p}=Le.current;if(!c)return;const S=Array.isArray(t.variants)?[...t.variants]:[],g=S[r],_=g?.rule&&typeof g.rule=="object"?g.rule:void 0,L=async D=>{const P={...t,variants:D};return await kr(c,t,P),{...p,[c]:P}},N=qc(_,l,p,x);if(N.kind!=="noop"){if(N.kind==="error"){oe.error(N.reason==="no-matcher-rule"?f("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"):N.reason==="unreadable-rule"?f("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"):N.message??f("sectionsEditor.sectionsEditor.failedToRenameVariant"));return}Zt(!0);try{if(N.kind==="inline"){const P=[...S];P[r]={...g,rule:N.inlinedRule};const de=await L(P);await Ht(N.blockKey,de),m?.();return}if(N.kind==="updateBlock"){await G.mutateAsync({blockKey:N.blockKey,data:N.blockData}),m?.();return}let D=null;try{await G.mutateAsync({blockKey:N.blockId,data:N.blockData}),D=N.blockId;const P=[...S];P[r]={...g,rule:N.reference},await L(P),D=null}catch(P){throw D&&await Rn.mutateAsync({blockKey:D}).catch(()=>{}),P}oe.success(f("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:l.trim()})),m?.()}catch(D){oe.error(f("sectionsEditor.sectionsEditor.failedToRenameVariant"),{description:Pt(f,It(D))})}finally{Zt(!1)}}},selectGlobal:async(t,r,l)=>{Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const{activePageKey:c,decofile:p}=Le.current;if(!c)return;const S=Array.isArray(t.variants)?[...t.variants]:[],g=S[r];if(!g)return;const _=Bt(g.rule,p,x);S[r]={...g,rule:on(l)};const L={...t,variants:S},N={...p,[c]:L};try{await kr(c,t,L),_&&_!==l&&await Ht(_,N),m?.()}catch(D){oe.error(f("sectionsEditor.sectionsEditor.couldNotApplySavedRule"),{description:Pt(f,It(D))})}}},Er=()=>{zt()},Rr=t=>{ln(t),ts({inner:t})},Ar=t=>{En(t),ts({raw:t})},Cr=()=>{ln(null),Lt([])},Nr=()=>Yt(t=>t+1),Tr=()=>{cn.flush(),an(!1),ln(null),En(void 0),Lt([]),Yt(t=>t+1),A?.()},Di=()=>{ft(!1),kn(!1),B(null),an(!0)},Mi=()=>{qe&&Tr(),B(null),ft(!0)},Pi=()=>kn(!0),as=t=>{if(et&&t===0){ft(!1);return}if(Ot&&t<2){kn(!1),t===0&&B(null);return}if(qe){if(t===0){Tr();return}if(t===1){Lt([]),Yt(l=>l+1);return}Lt(Vs.slice(0,t-1)),Yt(l=>l+1);return}if(ie){O(q.slice(0,t)),Q(l=>l+1);return}if(t===0){Er();return}if(t===1){O([]),Q(l=>l+1);return}const r=!M&&Tt&&nn?1:0;if(r===1&&t===2){O([]),Q(l=>l+1);return}O(q.slice(0,t-1-r))},ls=Mn.length>1?i.jsx("button",{type:"button",onClick:()=>as(_a(Mn.length,{isMultivariateSectionTop:Ai})),title:f("sectionsEditor.sectionsEditor.back"),"aria-label":f("sectionsEditor.sectionsEditor.back"),className:ae("shrink-0 inline-flex size-6 items-center justify-center rounded-[var(--studio-control-radius,var(--radius-md))] transition-colors",ut?"text-foreground/80 hover:bg-global-section/15":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:i.jsx(Ca,{className:"size-4"})}):null,Ii=ut||Vt||qe?wi&&i.jsxs("div",{className:ae("border-b px-3 py-2.5",ut&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[!ie&&ht&&rt&&i.jsxs("button",{type:"button",onClick:Er,title:f("sectionsEditor.sectionsEditor.editingInVariant",{variant:rt.label}),className:ae("shrink-0 inline-flex items-center gap-1 rounded-lg h-6 px-1.5 text-xs font-medium cursor-pointer transition-opacity hover:opacity-80",ga),children:[i.jsx(ha,{rule:fs(rt.rule,y??{},x??void 0),matchers:tn}),i.jsx("span",{className:"max-w-[160px] truncate",children:rt.label})]}),i.jsx("div",{className:"flex-1"}),ut&&i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx("span",{className:"shrink-0 cursor-help",children:i.jsx(zn,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),i.jsx(Rt,{side:"bottom",className:"max-w-[260px]",children:f("sectionsEditor.sectionsEditor.globalSectionTooltip")})]}),xr&&i.jsx(Bn,{onClick:()=>xn()})]}),ut&&i.jsx("p",{className:"mt-1.5 py-1.5 pl-1 text-sm leading-snug text-foreground",children:f("sectionsEditor.sectionsEditor.globalSectionBanner")})]}):i.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2.5",children:[i.jsx("div",{className:"flex-1 min-w-0",children:i.jsx(Or,{pageKey:E,initialName:je.name,initialPath:je.path,onFieldChange:Zs,variant:"header"})}),i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"ghost",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.editSeo"),className:"size-7 shrink-0",onClick:()=>an(!0),children:i.jsx(Gr,{size:14})})}),i.jsx(Rt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.editSeo")})]}),i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"ghost",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.viewJson"),className:"size-7 shrink-0",onClick:()=>z&&E?z():dt(!0),children:i.jsx(Ur,{size:14})})}),i.jsx(Rt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.viewJson")})]}),i.jsx(Bn,{onClick:yn})]}),Bi=i.jsxs(i.Fragment,{children:[ht&&E&&i.jsx(Lr,{listKey:E,variants:Me,activeIndex:we,decofile:y??{},meta:x,matchers:tn,onSelect:is,onReorder:jr,onRename:Ee,onDuplicate:_r,onDelete:wr,onAdd:yn}),ht&&_e!==null&&i.jsx($r,{className:"mt-3",children:i.jsx("div",{className:ae("space-y-3",Qt&&"pointer-events-none opacity-50"),children:i.jsx(us,{currentRt:_e,currentLabel:wn(rt?.rule,y??{},wt,x??void 0),currentGlobalKey:Bt(rt?.rule,y??{},x??void 0)??void 0,matchers:tn,globals:ns,onSelect:ir,onSelectGlobal:lr,schema:rr,formValue:Te,onChange:ar,formKey:`${we}:${_e??""}`,formWrapperClassName:"space-y-3",meta:x??void 0,decofile:y,onSaveReferencedBlock:un,sandbox:hn})})})]}),Vr=i.jsxs(i.Fragment,{children:[i.jsx(va,{listKey:`${E??""}:${b??""}`,variants:Nt.map((t,r)=>({index:r,label:t.label})),selectedIndex:Vn,onSelect:er,onRename:Ve,onDuplicate:pi,onDelete:mi,onRemoveAll:tr,onReorder:hi,onAdd:()=>xn()}),i.jsx($r,{children:i.jsx(us,{currentRt:Jt??"",currentLabel:wn(nn?.rule,y??{},wt,x??void 0),currentGlobalKey:Bt(nn?.rule,y??{},x??void 0)??void 0,matchers:tn,globals:ns,onSelect:vi,onSelectGlobal:yi,schema:bi,formValue:Mo,onChange:xi,formKey:`${b??"none"}:${Vn}:${Jt??""}`,formWrapperClassName:"pt-1",meta:x??void 0,decofile:y,onSaveReferencedBlock:un,sandbox:hn})})]}),Dr=i.jsx("div",{className:ae(M?"px-2":"p-2 pt-3"),children:i.jsx(Xl,{listKey:`${E??""}-${we}`,rawSections:U,sections:Pe,meta:x,decofile:y,selectedIndex:b,onSelect:ri,onReorder:oi,onDelete:ii,onDuplicate:ai,onMakeReusable:He,onToggleHidden:li,onToggleLazy:he?ci:void 0,onAddVariant:xn,onDetach:ui,onAddSection:()=>Fe(!0),canAddSection:sr})}),Ki=i.jsxs("div",{className:"min-w-0 max-w-full space-y-4 overflow-x-hidden px-3",children:[E&&je&&i.jsx(Or,{pageKey:E,initialName:je.name,initialPath:je.path,onFieldChange:Zs}),mn&&E?i.jsx(so,{rawSeo:Cn,innerSeo:Jn,defaultResolveType:$s,seoSchema:zs,activeResolveType:Nn,seoTypeOptions:Ls,formResetKey:Ds,siteDefaultSeo:Hs,onBreadcrumbChange:Lt,onPersistRaw:Ar,onInnerChange:Rr,onClearForm:Cr,onBumpFormKey:Nr,asyncRenderAvailable:he}):i.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:f("sectionsEditor.sectionsEditor.seoSchemaNotFound")})]}),Fi=i.jsx(rn,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:i.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:i.jsx("div",{className:"mx-auto max-w-2xl",children:mn&&E?i.jsx(so,{rawSeo:Cn,innerSeo:Jn,defaultResolveType:$s,seoSchema:zs,activeResolveType:Nn,seoTypeOptions:Ls,formResetKey:Ds,siteDefaultSeo:Hs,onBreadcrumbChange:Lt,onPersistRaw:Ar,onInnerChange:Rr,onClearForm:Cr,onBumpFormKey:Nr,asyncRenderAvailable:he}):i.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:f("sectionsEditor.sectionsEditor.seoSchemaNotFound")})})})},"editor-seo"),Oi=i.jsxs(rn,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[ht&&E&&i.jsx(Lr,{listKey:E,variants:Me,activeIndex:we,decofile:y??{},meta:x,matchers:tn,onSelect:is,onReorder:jr,onRename:Ee,onDuplicate:_r,onDelete:wr,onAdd:yn}),ht&&_e!==null&&i.jsxs("div",{className:ae("px-3 border-b",De?"pt-3 pb-5 space-y-3":"py-2"),children:[i.jsxs("button",{type:"button",onClick:()=>yt(t=>!t),className:"flex w-full items-center justify-between gap-2 text-left cursor-pointer rounded-[var(--studio-control-radius,var(--radius-sm))] py-0.5 hover:bg-muted/40","aria-expanded":De,children:[i.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:f("sectionsEditor.sectionsEditor.variantRule")}),De?i.jsx(Ea,{className:"size-3.5 shrink-0 text-muted-foreground"}):i.jsx(Ra,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),De&&i.jsx("div",{className:ae("space-y-3",Qt&&"pointer-events-none opacity-50"),children:i.jsx(us,{currentRt:_e,currentLabel:wn(rt?.rule,y??{},wt,x??void 0),currentGlobalKey:Bt(rt?.rule,y??{},x??void 0)??void 0,matchers:tn,globals:ns,onSelect:ir,onSelectGlobal:lr,schema:rr,formValue:Te,onChange:ar,formKey:`${we}:${_e??""}`,formWrapperClassName:"space-y-3",meta:x??void 0,decofile:y,onSaveReferencedBlock:un,sandbox:hn})})]}),Dr]},"editor-section-list");return i.jsx(xa,{children:i.jsxs("div",{className:"flex h-full min-w-0 w-full flex-col",children:[!M&&ls&&i.jsx("div",{className:"flex min-w-0 shrink-0 items-center gap-2 px-3 py-2",children:ls}),(M||Mn.length>1)&&i.jsx(ya,{crumbs:Mn,onSelect:as,onSelectRoot:()=>{cn.flush(),$?$():as(0)}}),i.jsx("div",{className:"shrink-0",children:M?i.jsxs("div",{className:ae("flex items-center gap-2 border-b px-3 py-2.5",ut&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[M&&ls,ut&&i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx("span",{className:"shrink-0 cursor-help",children:i.jsx(zn,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),i.jsx(Rt,{side:"bottom",className:"max-w-[260px]",children:f("sectionsEditor.sectionsEditor.globalSectionTooltip")})]}),i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[i.jsx("span",{className:"truncate text-sm font-semibold",children:Ri}),br&&i.jsx("span",{className:"truncate text-xs text-muted-foreground",children:br})]}),os&&ht&&rt&&i.jsx(zr,{variants:Me,activeIndex:we,onSelect:is,onManage:Mi,onRemoveAll:Ci}),ki&&i.jsx(zr,{variants:Nt,activeIndex:Vn,onSelect:er,onManage:Pi,onRemoveAll:tr}),os&&!ht&&i.jsx(Bn,{onClick:yn}),_i&&i.jsx(Bn,{onClick:()=>xn()}),i.jsx(Sa,{}),os&&i.jsxs(i.Fragment,{children:[i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"outline",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.editSeo"),className:"size-7 shrink-0",onClick:Di,children:i.jsx(Gr,{size:14})})}),i.jsx(Rt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.editSeo")})]}),!z&&i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"outline",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.viewJson"),className:"size-7 shrink-0",onClick:()=>dt(!0),children:i.jsx(Ur,{size:14})})}),i.jsx(Rt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.viewJson")})]})]})]}):Ii}),lt&&i.jsx(yc,{open:!0,fields:cc(lt.plan,lt.target.schema),choices:lt.choices,changedAgain:lt.changedAgain,author:zo,fresh:lt.fresh,onChoose:(t,r)=>si({...lt.choices,[t]:r}),onApply:ni},Jc(lt.formBase)),Ot?i.jsx(Hr,{onAdd:()=>xn(),children:Vr},"editor-section-variants"):Vt?i.jsxs(rn,{viewportRef:Ke,onBlur:Gs,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[!M&&Tt&&Nt.length>0&&q.length===0&&Vr,i.jsx(Wr,{activeSchema:Tn,formValue:xe,formResetKey:Ye,onFormChange:Qs,onBreadcrumbChange:O,breadcrumbPath:q,emptyMessage:f("sectionsEditor.sectionsEditor.noEditableFieldsForVariant"),meta:x,decofile:y,onSaveReferencedBlock:un,sandbox:hn,previewBaseUrl:ee,onRequestAddSection:Xs,onVariantMatcherOp:ie?Vi:void 0})]},"editor-section-form"):ie?i.jsx(rn,{viewportRef:Ke,onBlur:Gs,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:i.jsx(Wr,{activeSchema:Tn,formValue:xe,formResetKey:Ye,onFormChange:Qs,onBreadcrumbChange:O,breadcrumbPath:q,emptyMessage:f("sectionsEditor.sectionsEditor.noEditableFieldsForGlobalBlock"),meta:x,decofile:y,onSaveReferencedBlock:un,sandbox:hn,previewBaseUrl:ee,onRequestAddSection:Xs})},"editor-global-block"):qe?M?i.jsx(rn,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:i.jsx("div",{className:"p-3",children:Ki})},"editor-seo"):Fi:et?i.jsx(Hr,{onAdd:yn,children:Bi},"editor-variants"):M?i.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[i.jsx(rn,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:i.jsx("div",{className:"py-2",children:Dr})}),i.jsx("div",{className:"shrink-0 border-t p-2",children:i.jsx(js,{canAddSection:sr,onAddSection:()=>Fe(!0)})})]},"editor-section-list"):Oi,i.jsx(ba,{open:ke!==null,onOpenChange:t=>{t||He(null)},defaultBlockId:ke!==null?Fn(Pe[ke]?.label??""):"",isPending:G.isPending,onSubmit:gi}),ve&&i.jsx(Al,{open:Xe,onOpenChange:t=>{Fe(t),t||(ne.current=null)},meta:x,decofile:y,previewBaseUrl:ee,onSelect:fi}),re&&E&&y&&i.jsx(La,{open:re,onOpenChange:dt,pageKey:E,decofile:y}),We!==null&&i.jsx(qr,{open:!0,initialName:Gt(Me[We]?.rule,y??{},x??void 0)?wn(Me[We]?.rule,y??{},wt,x??void 0):"",autoLabel:wt(fs(Me[We]?.rule,y??{},x??void 0)),isPending:Qt,onSubmit:async t=>{await Ni(We,t)},onOpenChange:t=>{!t&&!Qt&&Ee(null)}}),Ie!==null&&i.jsx(qr,{open:!0,initialName:Gt(Nt[Ie]?.rule,y??{},x??void 0)?wn(Nt[Ie]?.rule,y??{},wt,x??void 0):"",autoLabel:wt(fs(Nt[Ie]?.rule,y??{},x??void 0)),isPending:Qt,onSubmit:async t=>{await Ti(Ie,t)},onOpenChange:t=>{!t&&!Qt&&Ve(null)}})]})})}export{tm as SectionsEditor};
4
+ `).trim()}const pc={"&nbsp;":" ","&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"};function hc(n){if(typeof DOMParser<"u")return new DOMParser().parseFromString(n,"text/html").body.textContent??"";let e=n;for(let s="";s!==e;)s=e,e=e.replace(/<[^<>]*>/g,"");return e.replace(/<|>/g,"").replace(/&(nbsp|amp|lt|gt|quot|#39);/g,s=>pc[s]??s)}function $n(n){const e=n.replace(/\s+/g," ").trim();return e.length>uo?`${e.slice(0,uo-1)}…`:e}function gc(n){if(n.startsWith("data:"))return"image";const e=n.split(/[?#]/)[0]??n;return decodeURIComponent(e.split("/").pop()||n)}function Hn(n,e){if(n==null||n==="")return{kind:"empty"};if(typeof n=="string")return Vo(n,e)?{kind:"image",src:n}:{kind:"text",text:Es(n,e)};if(typeof n=="number"||typeof n=="bigint")return{kind:"text",text:String(n)};if(typeof n=="boolean")return{kind:"yesNo",value:n};if(Array.isArray(n)){const s=e?.items??null;return{kind:"list",count:n.length,items:n.slice(0,mc).map(o=>vc(o,s)??"")}}if(typeof n=="object"){const s=n;if("value"in s&&Object.keys(s).length<=2)return Hn(s.value,e?.properties?.value??e);const o=Object.entries(s).filter(([a,u])=>!a.startsWith("__")&&u!==void 0).flatMap(([a,u])=>{const h=e?.properties?.[a]??null,d=Hn(u,h);if(d.kind==="empty")return[];const v=d.kind==="text"?$n(d.text):d.kind==="image"?gc(d.src):d.kind==="yesNo"?d.value?"✓":"✗":d.kind==="list"?`${d.count}`:"…";return[{label:h?.title?.trim()||a,text:v}]}).slice(0,4);return o.length>0?{kind:"fields",entries:o}:{kind:"empty"}}return{kind:"text",text:String(n)}}function vc(n,e){if(typeof n=="string")return $n(Es(n,e));if(!n||typeof n!="object"||Array.isArray(n))return null;const s=n,o=e?.titleBy,a=o?s[o]:void 0;if(typeof a=="string"&&a.trim())return $n(a);for(const[u,h]of Object.entries(s))if(!(u.startsWith("__")||typeof h!="string"||!h.trim())&&!Vo(h,e?.properties?.[u]??null))return $n(Es(h,null));return null}const fo=1500;function xc(n,e){const s=n.split(/(\s+)/).filter(j=>j!==""),o=e.split(/(\s+)/).filter(j=>j!=="");if(s.length>fo||o.length>fo)return{mine:[{text:n,kind:"changed"}],theirs:[{text:e,kind:"changed"}]};const a=Array.from({length:s.length+1},()=>new Array(o.length+1).fill(0));for(let j=s.length-1;j>=0;j--)for(let A=o.length-1;A>=0;A--){const $=a[j];$[A]=s[j]===o[A]?a[j+1][A+1]+1:Math.max(a[j+1][A],$[A+1])}const u=[],h=[],d=(j,A,$)=>{const z=j.at(-1);z&&(z.kind===$||$==="same"&&!A.trim())?z.text+=A:j.push({text:A,kind:$})};let v=0,m=0;for(;v<s.length&&m<o.length;)s[v]===o[m]?(d(u,s[v],"same"),d(h,o[m],"same"),v++,m++):a[v+1][m]>=a[v][m+1]?(d(u,s[v],"changed"),v++):(d(h,o[m],"changed"),m++);for(;v<s.length;v++)d(u,s[v],"changed");for(;m<o.length;m++)d(h,o[m],"changed");return{mine:u,theirs:h}}function yc(n){const e=it.c(10);let s,o;e[0]!==n?({open:s,...o}=n,e[0]=n,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const{data:a}=xo.useSession();let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=ae("max-h-[85vh] grid-rows-[auto_minmax(0,1fr)_auto] sm:max-w-lg"),e[3]=u):u=e[3];const h=a?.user??null;let d;e[4]!==o||e[5]!==h?(d=i.jsx(Cl,{className:u,"data-testid":"form-conflict-dialog",onEscapeKeyDown:jc,onOpenAutoFocus:bc,children:i.jsx(Ac,{...o,viewer:h,heading:Sc})}),e[4]=o,e[5]=h,e[6]=d):d=e[6];let v;return e[7]!==s||e[8]!==d?(v=i.jsx(Ml,{open:s,children:d}),e[7]=s,e[8]=d,e[9]=v):v=e[9],v}function Sc(n,e){return i.jsxs(Nl,{className:"text-left",children:[i.jsx(Tl,{children:n}),i.jsx(Vl,{children:e})]})}function bc(n){n.preventDefault(),n.currentTarget?.focus()}function jc(n){return n.preventDefault()}const wc={},_c=(n,e)=>i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx("h2",{className:"text-lg font-semibold",children:n}),i.jsx("p",{className:"text-sm text-muted-foreground",children:e})]});function kc(n,e,s=0,o={},a=null){const u=e[Math.min(s,e.length-1)],h=a?.you?void 0:a?.name?.split(/\s+/)[0],d={field:u?Rc(u.label):"",label:u?.label??"",name:h??""},v=(m,j,A)=>n(a?.you?A:h?j:m,d);return e.length<=1?{title:v("sectionsEditor.formConflict.titleOne","sectionsEditor.formConflict.titleOneNamed","sectionsEditor.formConflict.titleOneYou"),description:n("sectionsEditor.formConflict.descriptionOne")}:{title:v("sectionsEditor.formConflict.titleStep","sectionsEditor.formConflict.titleStepNamed","sectionsEditor.formConflict.titleStepYou"),description:s>=e.length-1?i.jsx(Ec,{t:n,fields:e,choices:o,name:h}):n("sectionsEditor.formConflict.descriptionStep")}}function Ec(n){const e=it.c(11),{t:s,fields:o,choices:a,name:u}=n;let h;if(e[0]!==a||e[1]!==o||e[2]!==u||e[3]!==s){let v;e[5]!==a||e[6]!==u||e[7]!==s?(v=(m,j)=>i.jsxs(R.Fragment,{children:[j>0&&" · ",`${m.label}: `,i.jsx("span",{className:"font-medium text-foreground",children:s((a[m.pointer]??"mine")==="mine"?"sectionsEditor.formConflict.summaryYours":u?"sectionsEditor.formConflict.summaryTheirsNamed":"sectionsEditor.formConflict.summaryTheirs",{name:u??""})})]},m.pointer),e[5]=a,e[6]=u,e[7]=s,e[8]=v):v=e[8],h=o.map(v),e[0]=a,e[1]=o,e[2]=u,e[3]=s,e[4]=h}else h=e[4];let d;return e[9]!==h?(d=i.jsx("span",{"data-testid":"form-conflict-summary",children:h}),e[9]=h,e[10]=d):d=e[10],d}function Rc(n){return/^[A-Z][a-z]/.test(n)&&!n.includes("›")?n.charAt(0).toLowerCase()+n.slice(1):n}function Ac(n){const e=it.c(68),s=Ft(),{fields:o,choices:a,changedAgain:u,fresh:h,heading:d}=n,v=u===void 0?!1:u,m=h===void 0?wc:h,j=d===void 0?_c:d,A=o.length>1,[$,z]=R.useState(0),[H,F]=R.useState(Cc);let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f={},e[0]=f):f=e[0];const[k,X]=R.useState(f),w=Math.max(0,Math.min($,o.length-1)),I=o[w],V=w===o.length-1;let y;e[1]!==w||e[2]!==o||e[3]!==m?(y=Se=>{const ue=o[w],te=o[Se];!ue||!te||Se===w||(F(se=>new Set(se).add(ue.pointer)),X(se=>({...se,[ue.pointer]:m[ue.pointer]??0,[te.pointer]:m[te.pointer]??0})),z(Se))},e[1]=w,e[2]=o,e[3]=m,e[4]=y):y=e[4];const C=y;let x;e[5]!==w||e[6]!==C?(x=Se=>{if(!Se)return;const ue=te=>{const se={ArrowLeft:-1,ArrowRight:1}[te.key];!se||te.defaultPrevented||te.altKey||te.ctrlKey||te.metaKey||te.shiftKey||Pl(te.target)||(te.preventDefault(),C(w+se))};return Se.ownerDocument.addEventListener("keydown",ue),()=>Se.ownerDocument.removeEventListener("keydown",ue)},e[5]=w,e[6]=C,e[7]=x):x=e[7];const Y=x;if(!I)return null;let D,ge,me,le,ee;if(e[8]!==H||e[9]!==w||e[10]!==a||e[11]!==o||e[12]!==m||e[13]!==C||e[14]!==j||e[15]!==Y||e[16]!==A||e[17]!==n||e[18]!==k||e[19]!==s){const{title:Se,description:ue}=kc(s,o,w,a,n.author??null);let te;e[25]!==n?(te=se=>{se.detail>1||n.onApply()},e[25]=n,e[26]=te):te=e[26],D=te,ge=A?Y:void 0,me="flex min-w-0 flex-col gap-3",e[27]!==H||e[28]!==w||e[29]!==o||e[30]!==m||e[31]!==C||e[32]!==A||e[33]!==k||e[34]!==s?(le=A&&i.jsxs("div",{className:"flex items-center justify-between gap-3",children:[i.jsx("div",{role:"group","aria-label":s("sectionsEditor.formConflict.steps"),className:"-m-1 flex flex-wrap items-center",children:o.map((se,Te)=>{const Z=Te!==w&&(m[se.pointer]??0)>(k[se.pointer]??0);return i.jsx("button",{type:"button","aria-label":Z?s("sectionsEditor.formConflict.stepChangedAgain",{label:se.label}):se.label,"aria-current":Te===w?"step":void 0,"data-answered":Te!==w&&H.has(se.pointer)?"":void 0,"data-changed-again":Z?"":void 0,onClick:()=>C(Te),className:"group cursor-pointer rounded-full p-1 outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:i.jsx("span",{className:ae("block h-2 w-2 rounded-full bg-border transition-[width,background-color,box-shadow] motion-reduce:transition-none","group-hover:bg-muted-foreground/60","group-data-[answered]:bg-foreground/45","group-aria-[current=step]:w-5 group-aria-[current=step]:bg-foreground","group-data-[changed-again]:ring-2 group-data-[changed-again]:ring-warning group-data-[changed-again]:ring-offset-1 group-data-[changed-again]:ring-offset-background")})},se.pointer)})}),i.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:s("sectionsEditor.formConflict.stepCount",{step:String(w+1),count:String(o.length)})})]}),e[27]=H,e[28]=w,e[29]=o,e[30]=m,e[31]=C,e[32]=A,e[33]=k,e[34]=s,e[35]=le):le=e[35],ee=j(Se,ue),e[8]=H,e[9]=w,e[10]=a,e[11]=o,e[12]=m,e[13]=C,e[14]=j,e[15]=Y,e[16]=A,e[17]=n,e[18]=k,e[19]=s,e[20]=D,e[21]=ge,e[22]=me,e[23]=le,e[24]=ee}else D=e[20],ge=e[21],me=e[22],le=e[23],ee=e[24];let pe;e[36]!==ge||e[37]!==me||e[38]!==le||e[39]!==ee?(pe=i.jsxs("div",{ref:ge,className:me,children:[le,ee]}),e[36]=ge,e[37]=me,e[38]=le,e[39]=ee,e[40]=pe):pe=e[40];const ce=!v&&"sr-only";let he;e[41]!==ce?(he=ae("text-sm text-muted-foreground",ce),e[41]=ce,e[42]=he):he=e[42];let ve;e[43]!==v||e[44]!==A||e[45]!==s?(ve=v?s(A?"sectionsEditor.formConflict.changedAgainSteps":"sectionsEditor.formConflict.changedAgain"):"",e[43]=v,e[44]=A,e[45]=s,e[46]=ve):ve=e[46];let b;e[47]!==he||e[48]!==ve?(b=i.jsx("p",{role:"status",className:he,children:ve}),e[47]=he,e[48]=ve,e[49]=b):b=e[49];const B=A?"vertical":"all";let xe;e[50]!==I||e[51]!==n||e[52]!==B?(xe=i.jsx(Mc,{field:I,...n,arrows:B}),e[50]=I,e[51]=n,e[52]=B,e[53]=xe):xe=e[53];let T;e[54]!==b||e[55]!==xe?(T=i.jsxs("div",{className:"-mx-2 flex min-h-0 flex-col gap-3 overflow-y-auto px-2 py-1",children:[b,xe]}),e[54]=b,e[55]=xe,e[56]=T):T=e[56];let ye;e[57]!==D||e[58]!==w||e[59]!==C||e[60]!==V||e[61]!==A||e[62]!==s?(ye=A?i.jsxs(no,{className:"flex-row flex-wrap items-center justify-between gap-2 sm:justify-between",children:[i.jsx(_t,{type:"button",variant:"outline","aria-disabled":w===0,onClick:()=>C(w-1),className:"aria-disabled:cursor-default aria-disabled:opacity-45",children:s("sectionsEditor.formConflict.back")}),i.jsx(_t,{type:"button","data-testid":"form-conflict-primary",onClick:V?D:()=>C(w+1),children:s(V?"sectionsEditor.formConflict.ok":"sectionsEditor.formConflict.next")})]}):i.jsx(no,{className:"items-center gap-2",children:i.jsx(_t,{type:"button","data-testid":"form-conflict-primary",onClick:D,children:s("sectionsEditor.formConflict.ok")})}),e[57]=D,e[58]=w,e[59]=C,e[60]=V,e[61]=A,e[62]=s,e[63]=ye):ye=e[63];let K;return e[64]!==pe||e[65]!==T||e[66]!==ye?(K=i.jsxs(i.Fragment,{children:[pe,T,ye]}),e[64]=pe,e[65]=T,e[66]=ye,e[67]=K):K=e[67],K}function Cc(){return new Set}function Nc(n){const e=Hn(n.mine,n.schema),s=Hn(n.theirs,n.schema),o=e.kind==="text"&&s.kind==="text"?xc(e.text,s.text):null;return a=>o?i.jsx(Pc,{parts:o[a]}):i.jsx(Bc,{preview:a==="mine"?e:s})}const Tc={all:{ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1},vertical:{ArrowDown:1,ArrowUp:-1}};function Vc(n,e){const s=Tc[e][n.key];if(!s)return;const o=[...n.currentTarget.querySelectorAll('[role="radio"]')],a=o.indexOf(document.activeElement);if(a<0)return;n.preventDefault();const u=o[(a+s+o.length)%o.length];u?.focus(),u?.click()}function Mc(n){const e=it.c(65),{field:s,choices:o,viewer:a,author:u,onChoose:h,arrows:d}=n,v=u===void 0?null:u,m=Ft(),[j]=Wi(),{language:A}=j;let $,z,H,F,f,k,X,w,I,V,y,C,x,Y;if(e[0]!==d||e[1]!==v||e[2]!==o||e[3]!==s||e[4]!==A||e[5]!==h||e[6]!==m||e[7]!==a?.image||e[8]!==a?.name){const me=Nc(s),le=o[s.pointer]??"mine",ee=a?.image??void 0;let pe;e[23]!==m||e[24]!==a?.name?(pe=mo(a?.name)||m("sectionsEditor.formConflict.you"),e[23]=m,e[24]=a?.name,e[25]=pe):pe=e[25];let ce;e[26]!==ee||e[27]!==pe?(ce=i.jsx(ms,{url:ee,fallback:pe,shape:"circle",size:"sm",className:"text-xs"}),e[26]=ee,e[27]=pe,e[28]=ce):ce=e[28];const he=ce;let ve;e[29]!==v||e[30]!==he?(ve=v?.you?he:v?.name?i.jsx(ms,{url:v.avatarUrl,fallback:mo(v.name),shape:"circle",size:"sm",className:"text-xs"}):i.jsx(ms,{url:"icon://user",fallback:"",muted:!0,shape:"circle",size:"sm"}),e[29]=v,e[30]=he,e[31]=ve):ve=e[31];const b=ve,B=v?new Date(v.at):null;H="radiogroup",F=s.label,f="flex flex-col gap-2",e[32]!==d?(k=K=>Vc(K,d),e[32]=d,e[33]=k):k=e[33];let xe;e[34]!==s.pointer||e[35]!==h?(xe=()=>h(s.pointer,"mine"),e[34]=s.pointer,e[35]=h,e[36]=xe):xe=e[36];let T;e[37]!==m?(T=m("sectionsEditor.formConflict.you"),e[37]=m,e[38]=T):T=e[38];let ye;e[39]!==m?(ye=m("sectionsEditor.formConflict.yourVersionNotSaved"),e[39]=m,e[40]=ye):ye=e[40],X=i.jsx(po,{side:"mine",checked:le==="mine",onChoose:xe,avatar:he,who:T,meta:ye,children:me("mine")}),$=po,w="theirs",I=le==="theirs",e[41]!==s.pointer||e[42]!==h?(V=()=>h(s.pointer,"theirs"),e[41]=s.pointer,e[42]=h,e[43]=V):V=e[43],y=b,e[44]!==v?.name||e[45]!==v?.you||e[46]!==m?(C=v?.you?m("sectionsEditor.formConflict.youElsewhere"):v?.name||m("sectionsEditor.formConflict.someoneElse"),e[44]=v?.name,e[45]=v?.you,e[46]=m,e[47]=C):C=e[47],x=B?m("sectionsEditor.formConflict.savedAt",{when:Dl(B,A)}):m("sectionsEditor.formConflict.theirVersionSaved"),Y=B?Dc(B,A):void 0,z=me("theirs"),e[0]=d,e[1]=v,e[2]=o,e[3]=s,e[4]=A,e[5]=h,e[6]=m,e[7]=a?.image,e[8]=a?.name,e[9]=$,e[10]=z,e[11]=H,e[12]=F,e[13]=f,e[14]=k,e[15]=X,e[16]=w,e[17]=I,e[18]=V,e[19]=y,e[20]=C,e[21]=x,e[22]=Y}else $=e[9],z=e[10],H=e[11],F=e[12],f=e[13],k=e[14],X=e[15],w=e[16],I=e[17],V=e[18],y=e[19],C=e[20],x=e[21],Y=e[22];let D;e[48]!==$||e[49]!==z||e[50]!==w||e[51]!==I||e[52]!==V||e[53]!==y||e[54]!==C||e[55]!==x||e[56]!==Y?(D=i.jsx($,{side:w,checked:I,onChoose:V,avatar:y,who:C,meta:x,metaTitle:Y,children:z}),e[48]=$,e[49]=z,e[50]=w,e[51]=I,e[52]=V,e[53]=y,e[54]=C,e[55]=x,e[56]=Y,e[57]=D):D=e[57];let ge;return e[58]!==H||e[59]!==F||e[60]!==f||e[61]!==k||e[62]!==X||e[63]!==D?(ge=i.jsxs("div",{role:H,"aria-label":F,className:f,onKeyDown:k,children:[X,D]}),e[58]=H,e[59]=F,e[60]=f,e[61]=k,e[62]=X,e[63]=D,e[64]=ge):ge=e[64],ge}const Dc=(n,e)=>n.toLocaleString(e,{dateStyle:"medium",timeStyle:"short"});function mo(n){return(n??"").trim().split(/\s+/).filter(Boolean).slice(0,2).map(e=>e.charAt(0).toUpperCase()).join("")}function po(n){const e=it.c(28),{side:s,checked:o,onChoose:a,avatar:u,who:h,meta:d,metaTitle:v,children:m}=n,j=R.useId(),A=`${j}-who`,$=`${j}-meta ${j}-value`,z=o?0:-1,H=o?"border-primary bg-primary/5 ring-1 ring-primary":"hover:bg-muted/50";let F;e[0]!==H?(F=ae("grid w-full cursor-pointer grid-cols-[auto_minmax(0,1fr)] items-start gap-3 rounded-xl border bg-background p-3 text-left transition-[border-color,box-shadow,background-color] outline-none","focus-visible:ring-2 focus-visible:ring-ring/50",H),e[0]=H,e[1]=F):F=e[1];const f=`${j}-who`;let k;e[2]!==f||e[3]!==h?(k=i.jsx("span",{id:f,className:"text-sm font-medium text-foreground",children:h}),e[2]=f,e[3]=h,e[4]=k):k=e[4];const X=`${j}-meta`;let w;e[5]!==d||e[6]!==v||e[7]!==X?(w=i.jsx("span",{id:X,title:v,children:d}),e[5]=d,e[6]=v,e[7]=X,e[8]=w):w=e[8];let I;e[9]!==k||e[10]!==w?(I=i.jsxs("span",{className:"flex flex-wrap items-baseline gap-x-1.5 text-xs text-muted-foreground",children:[k,w]}),e[9]=k,e[10]=w,e[11]=I):I=e[11];const V=`${j}-value`,y=`conflict-${s}`;let C;e[12]!==m||e[13]!==V||e[14]!==y?(C=i.jsx("span",{id:V,"data-testid":y,className:"min-w-0 text-sm",children:m}),e[12]=m,e[13]=V,e[14]=y,e[15]=C):C=e[15];let x;e[16]!==I||e[17]!==C?(x=i.jsxs("span",{className:"flex min-w-0 flex-col gap-1",children:[I,C]}),e[16]=I,e[17]=C,e[18]=x):x=e[18];let Y;return e[19]!==u||e[20]!==o||e[21]!==a||e[22]!==A||e[23]!==x||e[24]!==$||e[25]!==z||e[26]!==F?(Y=i.jsxs("button",{type:"button",role:"radio","aria-checked":o,"aria-labelledby":A,"aria-describedby":$,tabIndex:z,onClick:a,className:F,children:[u,x]}),e[19]=u,e[20]=o,e[21]=a,e[22]=A,e[23]=x,e[24]=$,e[25]=z,e[26]=F,e[27]=Y):Y=e[27],Y}function Pc(n){const e=it.c(4),{parts:s}=n;let o;e[0]!==s?(o=s.map(Ic),e[0]=s,e[1]=o):o=e[1];let a;return e[2]!==o?(a=i.jsx("span",{className:"whitespace-pre-wrap break-words",children:o}),e[2]=o,e[3]=a):a=e[3],a}function Ic(n,e){return n.kind==="changed"?i.jsx("mark",{className:"rounded-sm bg-warning/20 px-0.5 text-foreground",children:n.text},e):i.jsx("span",{children:n.text},e)}function Bc(n){const e=it.c(29),{preview:s}=n,o=Ft();switch(s.kind){case"empty":{let a;e[0]!==o?(a=o("sectionsEditor.formConflict.empty"),e[0]=o,e[1]=a):a=e[1];let u;return e[2]!==a?(u=i.jsx("span",{className:"italic text-muted-foreground",children:a}),e[2]=a,e[3]=u):u=e[3],u}case"text":{let a;return e[4]!==s.text?(a=i.jsx("span",{className:"whitespace-pre-wrap break-words",children:s.text}),e[4]=s.text,e[5]=a):a=e[5],a}case"image":{let a;return e[6]!==s.src?(a=i.jsx("img",{src:s.src,alt:"",className:"max-h-24 max-w-full rounded border object-contain"}),e[6]=s.src,e[7]=a):a=e[7],a}case"yesNo":{const a=s.value?"sectionsEditor.formConflict.yes":"sectionsEditor.formConflict.no";let u;e[8]!==o||e[9]!==a?(u=o(a),e[8]=o,e[9]=a,e[10]=u):u=e[10];let h;return e[11]!==u?(h=i.jsx("span",{children:u}),e[11]=u,e[12]=h):h=e[12],h}case"list":{const a=s.count===1?"sectionsEditor.formConflict.oneItem":"sectionsEditor.formConflict.items",u=String(s.count);let h;e[13]!==o||e[14]!==a||e[15]!==u?(h=o(a,{count:u}),e[13]=o,e[14]=a,e[15]=u,e[16]=h):h=e[16];let d;e[17]!==h?(d=i.jsx("span",{className:"text-muted-foreground",children:h}),e[17]=h,e[18]=d):d=e[18];let v;e[19]!==s.count||e[20]!==s.items?(v=s.items.some(Boolean)&&i.jsxs("span",{className:"flex flex-col",children:[s.items.map(Fc),s.count>s.items.length&&i.jsx("span",{children:"…"})]}),e[19]=s.count,e[20]=s.items,e[21]=v):v=e[21];let m;return e[22]!==d||e[23]!==v?(m=i.jsxs("span",{className:"flex flex-col gap-1",children:[d,v]}),e[22]=d,e[23]=v,e[24]=m):m=e[24],m}case"fields":{let a;e[25]!==s.entries?(a=s.entries.map(Kc),e[25]=s.entries,e[26]=a):a=e[26];let u;return e[27]!==a?(u=i.jsx("dl",{className:"grid grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-0.5",children:a}),e[27]=a,e[28]=u):u=e[28],u}}}function Kc(n){return i.jsxs("div",{className:"contents",children:[i.jsx("dt",{className:"text-muted-foreground",children:n.label}),i.jsx("dd",{className:"truncate",children:n.text})]},n.label)}function Fc(n,e){return i.jsx("span",{className:"truncate",children:`${e+1}. ${n||"…"}`},e)}function Oc(n,e){return n.kind==="protocol"&&n.source==="github"?e:null}function Lc(n,e){if(Object.hasOwn(n,e))return n[e]??null;const s=Yr(e),o=Object.keys(n).find(a=>Yr(a)===s);return o===void 0?null:n[o]??null}async function $c(n,e){try{const s=await fetch(`/api/${n.orgSlug}/decofile/${encodeURIComponent(n.virtualMcpId)}/${encodeURIComponent(n.branch)}`,{cache:"no-store",headers:Na("v8")});if(!s.ok)return null;const o=await s.json().catch(()=>({})),a=Lc(o.changedBy??{},e);return a&&typeof a.userId=="string"&&Number.isFinite(Date.parse(a.at))?a:null}catch{return null}}function zc(n,e,s){const o=e.find(h=>h.userId===n.userId),a=o?.user?.name?.trim(),u=o?.user?.image??void 0;return{...a?{name:a}:{},...u?{avatarUrl:u}:{},at:n.at,you:!!s&&n.userId===s}}function Hc(n){let e=2166136261,s=0;for(let o=0;o<n.length;o++){const a=n.charCodeAt(o);e=Math.imul(e^a,16777619),s=Math.imul(s,31)+a|0}return`${(e>>>0).toString(36)}${(s>>>0).toString(36)}:${n.length}`}function Wc(n,e,s){const o=it.c(19),a=!!n&&!!e&&s!==null;let u;o[0]!==e||o[1]!==n||o[2]!==s?(u=yo.conflictAuthor(n?`${n.orgSlug}/${n.virtualMcpId}/${n.branch}`:"",e??"",s??""),o[0]=e,o[1]=n,o[2]=s,o[3]=u):u=o[3];let h;o[4]!==e||o[5]!==n?(h=()=>$c(n,e),o[4]=e,o[5]=n,o[6]=h):h=o[6];let d;o[7]!==a||o[8]!==u||o[9]!==h?(d={queryKey:u,queryFn:h,enabled:a,staleTime:Number.POSITIVE_INFINITY,gcTime:6e5,retry:!1,refetchOnWindowFocus:!1},o[7]=a,o[8]=u,o[9]=h,o[10]=d):d=o[10];const{data:v}=qi(d),m=a?v??null:null,j=!!m;let A;o[11]!==j?(A={enabled:j},o[11]=j,o[12]=A):A=o[12];const{data:$}=Il(A);let z;o[13]!==$?(z=$?.data?.members??[],o[13]=$,o[14]=z):z=o[14];const H=z,{data:F}=xo.useSession();if(!m)return null;const f=F?.user?.id??null;let k;return o[15]!==m||o[16]!==H||o[17]!==f?(k=zc(m,H,f),o[15]=m,o[16]=H,o[17]=f,o[18]=k):k=o[18],k}function qc(n,e,s,o){if(!n||typeof n!="object")return{kind:"error",reason:"no-matcher-rule"};const a=e.trim();if(!a)return Gt(n,s,o)?{kind:"inline",blockKey:n.__resolveType??"",inlinedRule:xs(n,s,o)}:{kind:"noop"};const u=ys(n,s,o);if(!u)return{kind:"error",reason:"unreadable-rule"};if(u.blockKey)return{kind:"updateBlock",blockKey:u.blockKey,blockData:Kt(u.resolveType,u.data,a)};const h=Fn(a),d=On(h,s);return d?{kind:"error",reason:"invalid-block-id",message:d}:{kind:"createBlock",blockId:h,blockData:Kt(u.resolveType,u.data,a),reference:on(h)}}const ho="section-form-stale-save",Gc=3,Uc=1e3;function go(n,e){const s=e.global&&e.pageKey?[{label:"Default",sections:[{__resolveType:e.pageKey}]}]:So(e.pageKey?n[e.pageKey]?.sections:void 0,n),o=Math.max(0,Math.min(e.pageVariantIndex,s.length-1)),a=s[o]?.sections??[];return{pageVariants:s,variantIndex:o,rawSections:a,parsedSections:_n(a,n)}}const vo=new WeakMap;let Yc=0;function Jc(n){let e=vo.get(n);return e===void 0&&(e=++Yc,vo.set(n,e)),e}function tm({orgSlug:n,virtualMcpId:e,branch:s,previewReady:o=!0,previewUrl:a,currentPath:u,activePageBlockKey:h=null,activeGlobalBlockKey:d=null,externalSelection:v,onSaved:m,initialEditSeo:j=!1,onExitSeo:A,onSelectRoot:$,onViewJsonFile:z,onFocusedBlockChange:H,onVariantPreviewOverride:F}){const f=Ft(),k=Yi(),X=k?.taskId??null,w=o?{orgSlug:n,virtualMcpId:e,branch:s,threadId:X,previewUrl:a}:null,[I,V]=R.useState([]),{data:y,isLoading:C}=Ta(w,{pollWhile:I.length>0}),{data:x,isLoading:Y}=ia(w),D=Wn(),ge=k?.virtualMcpId,le=ka(ge===e?e:null)?.metadata?.siteSlug??null,ee=Rl({virtualMcpId:e,branch:s,sandboxUrl:a}),pe=Va(e,s),ce=Ma(pe),he=!ce,ve=!!ee||ce,[b,B]=R.useState(null),[xe,T]=R.useState(null),[ye,K]=R.useState(null),[Se,ue]=R.useState(0),[te,se]=R.useState(void 0),[Te,Z]=R.useState(null),[_e,be]=R.useState(null),[q,O]=R.useState([]),Ke=R.useRef(null),[Qe,Xe]=R.useState(q.length);Qe!==q.length&&(Xe(q.length),requestAnimationFrame(()=>{Ke.current&&(Ke.current.scrollTop=0)}));const[Ye,Q]=R.useState(0),[ke,He]=R.useState(null),[We,Ee]=R.useState(null),[Ie,Ve]=R.useState(null),[Ze,Fe]=R.useState(!1),[re,dt]=R.useState(!1),ne=R.useRef(null),[Me,yt]=R.useState(!0),[et,ft]=R.useState(!1),[Ot,kn]=R.useState(!1),[qe,an]=R.useState(j),[Cs,Ns]=R.useState(j);j&&!Cs&&(Ns(!0),an(!0),B(null),T(null),K(null),O([])),!j&&Cs&&Ns(!1);const[Mo,ln]=R.useState(null),[Ts,En]=R.useState(void 0),[Vs,Lt]=R.useState([]),[Ms,Yt]=R.useState(0),[Je,at]=R.useState(0),[Do,tt]=R.useState(null),[Jt,st]=R.useState(null),[Ds,Ps]=R.useState(null),Is=Gi(),Bs=Da({orgSlug:n,virtualMcpId:e,branch:s},{tunnel:!1}),cn=aa({orgSlug:n,virtualMcpId:e,branch:s}),[Po,Io]=R.useState(u),[Bo,Ko]=R.useState(h),[Fo,Oo]=R.useState(d);(Po!==u||Bo!==h||Fo!==d)&&(queueMicrotask(()=>cn.flush()),Io(u),Ko(h),Oo(d),B(null),T(null),K(null),ue(0),Z(null),be(null),at(0),tt(null),st(null),O([]),Q(t=>t+1),an(!1),ln(null),En(void 0),Lt([]),Yt(t=>t+1));const G=la({orgSlug:n,virtualMcpId:e,branch:s}),un=ja((t,r)=>{G.mutate({blockKey:t,data:r},{onSuccess:()=>m?.(),onError:G.reportError})}),Rn=Oa({orgSlug:n,virtualMcpId:e,branch:s}),[Qt,Xt]=R.useState(!1),W=R.useRef(null),At=R.useRef(null),mt=R.useRef(null),pt=R.useRef(null),An=R.useRef({}),$t=R.useRef(null),dn=R.useRef(!1),fn=R.useRef(!1),Oe=R.useRef(new Map),Zt=R.useRef(!1),St=R.useRef([]),qn=R.useRef(new WeakSet);Pa(n,e,t=>{const{activePageKey:r,rawSections:l,parsedSections:c,selectedSectionIndex:p}=Le.current,S=new Set;r&&S.add(r);for(const g of[At.current?.sectionIndex,p]){const _=g==null?void 0:l[g],L=g==null?void 0:c[g],N=_&&L?.isSavedBlock?ds(_,L):null;N&&S.add(N)}if([...S].some(g=>t.has(g))){for(const g of[W,mt,pt])g.current&&clearTimeout(g.current),g.current=null;At.current=null,Oe.current.clear(),r&&t.has(r)&&(An.current={})}});const Le=R.useRef({rawSections:[],parsedSections:[],decofile:{},activePageKey:null,pageVariants:[],variantIndex:0,sectionVariantIndex:0,selectedSectionIndex:null}),[Ks,Fs]=R.useState(0),[Lo,$o]=R.useState(0),zo=Wc(Oc(pe,{orgSlug:n,virtualMcpId:e,branch:s}),I[0]?.blockKey??null,I[0]?Hc(ze(I[0].plan.theirs)):null),[Ho,Wo]=R.useState(null),Gn=Ia(n,e).epoch,[qo,Go]=R.useState(Gn);if(!o||C||Y)return i.jsx("div",{className:"h-full w-full flex items-center justify-center",children:i.jsx(Ui,{className:"size-5 text-muted-foreground"})});if(!y||!x)return i.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:f("sectionsEditor.sectionsEditor.couldNotLoadSiteData")});const Uo=Ha(y,x),ie=!!d,je=ie?null:Wa(Uo,u,h),E=ie?d:je?.key??null,Un=ie&&d?y[d]:void 0,Os=ie&&d&&Un?qa(d,Un):ie&&d?d:"",mn=!ie&&E&&y[E]?y[E]:null,Yn=qe&&y&&x&&E&&je?Kr(y,{kind:"page",pageKey:E,pageName:String(je.name??""),path:String(je.path??"")},x):null,Yo=qe?mn?.seo:void 0,Cn=Ts!==void 0?Ts:Yo,Jo=qe?ca(Cn):void 0,Ls=Yn?.seoTypeOptions??[],$s=qe&&x?ua(x):"",Jn=Mo??Jo??{},Nn=qe&&Yn?Bl(Jn,Yn):null,zs=qe&&Nn&&da(Cn)?Kn(Nn,x):null,Hs=qe?fa(y,x)?.seoData:void 0,De=ie?[{label:"Default",sections:[{__resolveType:d}]}]:So(mn?.sections,y??{}),ht=De.length>1,we=Math.min(Se,De.length-1),rt=De[we],U=rt?.sections??[],Pe=_n(U,y),Qn=!ie&&Ga(mn?.sections);if(ie&&d&&Ds!==d){Ps(d);const t=U[0],r=Pe[0];if(t&&r){B(0),at(0),O([]);const l=jt(t,r,y);l&&(T(l.data),K(l.resolveType),st(null),tt(null))}}!ie&&Ds!==null&&Ps(null),Le.current={rawSections:U,parsedSections:Pe,decofile:y??{},activePageKey:E,pageVariants:De,variantIndex:we,sectionVariantIndex:Je,selectedSectionIndex:b};const Qo=()=>({multivariate:Qn,index:we,variants:De.map(t=>({rule:t.rule}))}),Xn=(t,r)=>{if(!F)return;if(!E||!Qn||t.length<=1){F(null);return}const l={multivariate:!0,index:r,variants:t},c=ce?ro(E,l):oo(E,l,y,x);F(c.length>0?c:null)},Zn=F&&E&&Qn&&ht&&!C&&!Y?E:null;if(Zn!==Ho&&(Wo(Zn),Zn)){const t=De.map(l=>({rule:l.rule})),r=we;queueMicrotask(()=>Xn(t,r))}const en=(t,r,l)=>{if(!F)return;if(!E){F(null);return}const c=Qo(),p=ce?ro(E,c):oo(E,c,y,x);if(!t||r<0){F(p.length>0?p:null);return}const S={pageKey:E,page:c,sectionIndex:r,sectionLazy:Pe[r]?.isLazy??!1,mvObj:t,selectedVariantIndex:l},g=ce?Fl(S):Ol({...S,decofile:y,meta:x}),_=[...p,...g];F(_.length>0?_:null)},bt=(t,r,l,c=b??-1,p=!1)=>{const S=xt(t,r);if(!S){T(null),K(null),st(null),tt(null),p&&en(null,c,l);return}const _=vs(S,wt)[l];if(!_){T(null),K(null),st(null),tt(null),p&&en(null,c,l);return}const L=wo(_.value,y);T(L?.data??null),K(L?.resolveType??null);const{resolveType:N,formValue:M}=jn(_.rule,y,x??void 0);st(N),tt(M),p&&en(S,c,l)},pn=v?.index;if(v!==void 0&&(v?.seq??null)!==te&&(se(v?.seq??null),typeof pn=="number")){const t=U[pn],r=Pe[pn];if(t&&r)if(B(pn),at(0),O([]),Q(l=>l+1),r.isMultivariate)bt(t,r,0,pn);else{const l=jt(t,r,y);l?(T(l.data),K(l.resolveType)):(T(null),K(null)),st(null),tt(null)}}if(Gn!==qo){Go(Gn);const t=W.current!==null||Oe.current.size>0||pt.current!==null||mt.current!==null||G.isPending||cn.isPending||I.length>0,r=b!==null&&co(Ke.current,document.activeElement);if(!t&&r&&(Zt.current=!0),!t&&!r&&b!==null){const l=U[b],c=Pe[b];if(O([]),Q(p=>p+1),!l||!c)B(null),T(null),K(null);else if(c.isMultivariate)bt(l,c,Je,b);else{const p=jt(l,c,y);T(p?.data??null),K(p?.resolveType??null)}}!t&&qe&&(ln(null),En(void 0),Yt(l=>l+1))}if(Ks!==Lo){$o(Ks);const t=b!==null?U[b]:null,r=b!==null?Pe[b]:null;if(t&&r&&b!==null)if(O([]),Q(l=>l+1),r.isMultivariate)bt(t,r,Je,b);else{const l=jt(t,r,y);T(l?.data??null),K(l?.resolveType??null)}}const lt=I[0];if(lt){const{formBase:t,target:r}=lt,l=go(y,r),c=t.sectionIndex,p=l.rawSections.length===t.sectionCount?hs(l.rawSections[c],l.parsedSections[c],r.sectionVariantIndex,y):null,S=lc(lt,p,g=>ao(t,g));if(S){const _=[{...lt,...S,changedAgain:!0},...I.slice(1)];St.current=_,V(_)}}const hn={orgSlug:n,virtualMcpId:e,branch:s,threadId:X,previewUrl:ce?void 0:a??void 0,siteSlug:le},Tn=ye&&x?Kn(ye,x):null,ct=(t,r)=>{if(!E)return;W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear(),pt.current&&(clearTimeout(pt.current),pt.current=null),mt.current&&(clearTimeout(mt.current),mt.current=null);const l=Sn(y,E,t,we,De);G.mutate({blockKey:E,data:l},{onSuccess:()=>r?.onSuccess?.()??m?.(),onError:c=>{r?.onError?.(),G.reportError(c)}})},zt=()=>{H?.(null),B(null),kn(!1),T(null),K(null),at(0),tt(null),st(null),O([]),Q(t=>t+1)},Ws=()=>co(Ke.current,document.activeElement),es=(t=f("sectionsEditor.sectionsEditor.blockChangedElsewhere"))=>{if(W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear(),At.current=null,oe.error(t,{id:ho}),Ws()){Zt.current=!0;return}Fs(r=>r+1)},qs=()=>{!Zt.current||Ws()||St.current.length>0||W.current!==null||dn.current||fn.current||Oe.current.size>0||(Zt.current=!1,Fs(t=>t+1))},Gs=()=>{Zt.current&&setTimeout(qs,0)},Us=t=>Ka(Is,Bs,t),Ys=t=>{Oe.current.size!==0&&setTimeout(()=>{if(dn.current||fn.current)return;const r=[...Oe.current.values()];Oe.current.clear();for(const l of r)l()},t)},Xo=t=>{const{activePageKey:r,variantIndex:l,sectionVariantIndex:c}=Le.current,p=$t.current;return{formBase:p?.sectionIndex===t&&p.variantIndex===c?p:null,pageKey:r,global:ie,pageVariantIndex:l,sectionVariantIndex:c,schema:Tn}},gn=t=>{St.current=t,V(t)},Zo=t=>{const r=St.current,l=r.findIndex(S=>S.formBase===t.formBase),c=l>=0?r[l]:void 0,p=c?r.with(l,{...t,choices:ks(c.plan,c.choices,t.plan),fresh:To(c.plan,t.plan,c.fresh),changedAgain:c.changedAgain||ze(c.plan.theirs)!==ze(t.plan.theirs)}):[...r,{...t,changedAgain:qn.current.has(t.formBase)}];gn(p)},Js=(t,r)=>{const l=St.current,c=l.findIndex(g=>g.formBase===t),p=l[c];if(!p)return!1;if(ze(p.plan.mine)===ze(r))return!0;const S=ws({...p.plan,mine:r});if(S.pointers.length===0){const g=l.filter(_=>_!==p);return gn(g),!1}return gn(l.with(c,{...p,plan:S,choices:ks(p.plan,p.choices,S)})),!0},ei=t=>{const r=Le.current;return r.selectedSectionIndex===t.formBase.sectionIndex&&r.activePageKey===t.target.pageKey&&r.variantIndex===t.target.pageVariantIndex&&r.sectionVariantIndex===t.target.sectionVariantIndex},ti=()=>{const t=St.current[0];if(!t)return null;const{formBase:r,target:l}=t;W.current&&At.current?.sectionIndex===r.sectionIndex&&At.current.sectionVariantIndex===l.sectionVariantIndex&&(clearTimeout(W.current),W.current=null,At.current=null),Oe.current.delete(`${l.pageKey}:${r.sectionIndex}:${l.sectionVariantIndex}`);const c=r.emitted;return c&&typeof c=="object"&&!Js(r,c)&&vn(c,r.sectionIndex,0,l),St.current[0]??null},ni=()=>{const t=St.current[0],r=ti();if(!r||!t||r.formBase!==t.formBase||r.plan.pointers.some(S=>!t.plan.pointers.includes(S)))return;const l=ic(r.plan,r.choices);gn(St.current.slice(1));const{formBase:c,target:p}=r;c.base=r.plan.theirs,c.version=void 0,c.emitted=l,qn.current.add(c),($t.current===c||ei(r))&&($t.current=c,T(l),Q(S=>S+1)),vn(l,c.sectionIndex,0,p)},si=t=>{const[r,...l]=St.current;r&&gn([{...r,choices:t},...l])},vn=(t,r,l=0,c)=>{const p=c??Xo(r),S=p.sectionVariantIndex,g=p.formBase,_=At.current;W.current&&(clearTimeout(W.current),W.current=null,_&&(_.sectionIndex!==r||_.sectionVariantIndex!==S)&&_.write());const L=`${p.pageKey}:${r}:${S}`,N=()=>{if(dn.current||fn.current){Oe.current.set(L,N);return}const M=typeof t=="function"?t():t;if(g&&Js(g,M))return;const P=Le.current.decofile,{rawSections:de,parsedSections:Re,pageVariants:nt,variantIndex:Be}=go(P,p),Ge=p.pageKey,J=de[r];if(!J)return;const fe=Re[r];if(!fe)return;const Ce=g?.base,Ue=hs(J,fe,S,P),gt=!!Ce&&!!Ue&&Ao(Ce,Ue)&&!(g&&ao(g,Ue));if(gt&&Ce&&Ue){if(Co(Ce,Ue)){es(f("sectionsEditor.sectionsEditor.sectionReplacedElsewhere"));return}const Ae=fe.isSavedBlock?"here":rc(Ce,de.map((Ne,Dt)=>hs(Ne,Re[Dt],S,P)),r,g?.sectionCount??de.length);if(Ae==="unknown"){es(f("sectionsEditor.sectionsEditor.sectionReplacedElsewhere"));return}if(typeof Ae=="number"&&g){g.sectionCount=de.length,g.sectionIndex=Ae,$t.current===g&&B(Ae),vn(M,Ae,l,p);return}}const ot=gt&&Ce&&Ue?ws({ancestor:Ce,mine:M,theirs:Ue}):null;if(ot&&ot.pointers.length>0&&g){g.sectionCount=de.length,Zo({plan:ot,formBase:g,target:p,sectionIndex:r,choices:No(ot),changedAgain:!1,blockKey:fe.isSavedBlock?ds(J,fe):Ge,fresh:{}});return}const vt=ot?ot.merged:null,Mt=vt??M,Dr=oc({merged:!!vt,tracked:g,current:$t.current,saved:M});vt&&oe.info(f("sectionsEditor.sectionsEditor.blockMergedWithOthers"),{id:ho}),Dr&&g&&(g.emitted=vt,T(vt));const cs=Dr||!vt?Mt:M;g&&(g.base=cs,g.sectionCount=de.length,nc(g,cs));const Pr={onSuccess:()=>{g&&qn.current.delete(g),m?.()},onError:Ae=>{if(g?.base===cs&&Ce&&(g.base=Ce),Ae instanceof Ba){g&&(g.version=void 0),l<Gc?(Oe.current.delete(L),fn.current=!0,setTimeout(()=>{fn.current=!1,vn(()=>{const Ne=g?.emitted;return Ne&&typeof Ne=="object"?Ne:M},r,l+1,p),Oe.current.delete(L),Ys(bn)},Uc*2**l)):es();return}G.reportError(Ae)}},Ir=Ae=>{dn.current=!0;let Ne=!1;G.mutateAsync(Ae).then(()=>Pr.onSuccess(),Dt=>{Ne=!0,Pr.onError(Dt)}).finally(()=>{dn.current=!1,Ys(Ne?bn:0),qs()})};if(fe.isSavedBlock){const Ae=ds(J,fe);if(!Ae)return;Ir({blockKey:Ae,data:Mt,...Ce?{base:{value:vt?Ue:Ce}}:{},rebaseOnConflict:!1,guard:lo({formBase:g,rebased:!!vt,versionOf:Us})});return}if(!Ge)return;const In={...P[Ge]},Wt=[...de];if(fe.isMultivariate){const Ae=xt(J,fe);if(!Ae||!Ge)return;const Ne=al(Ae,S,Mt);Wt[r]=qt(J,fe,Ne)}else if(fe.isHidden){const Ae=Rs(J.__resolveType),Ne=Ae?{...J.section}:{...J},Dt=Array.isArray(Ne.variants)?[...Ne.variants]:[];Dt[0]&&(Dt[0]={...Dt[0],value:Mt}),Ne.variants=Dt,Ae?Wt[r]={...J,section:Ne}:Wt[r]=Ne}else fe.isLazy?Wt[r]={...J,section:Mt}:Wt[r]=Mt;if(nt.length>1){const Ae=In.sections,Ne=[...Ae?.variants??[]];Ne[Be]&&(Ne[Be]={...Ne[Be],value:Wt}),In.sections={...Ae,variants:Ne}}else In.sections=Wt;Ir({blockKey:Ge,data:In,rebaseOnConflict:!1,guard:lo({formBase:null,rebased:!1,versionOf:Us})})};At.current={sectionIndex:r,sectionVariantIndex:S,write:N},W.current=setTimeout(()=>{W.current=null,N()},bn)},ri=t=>{Zt.current=!1,B(t),at(0),O([]),Q(p=>p+1);const r=U[t],l=Pe[t];if(H?.(l?.isSavedBlock?l.resolveType??null:null),!r||!l)return;if(l.isMultivariate){bt(r,l,0,t);return}const c=jt(r,l,y);if(!c){T(null),K(null),st(null),tt(null),en(null,t,0);return}T(c.data),K(c.resolveType),st(null),tt(null),en(null,t,0)},Qs=t=>{const r=t;b!==null&&($t.current=sc($t.current,{sectionIndex:b,variantIndex:Le.current.sectionVariantIndex,shown:xe,next:r,sectionCount:Le.current.rawSections.length})),T(r),b!==null&&vn(r,b)},ts=t=>{if(!E||!y||!x||!je)return;const r={kind:"page",pageKey:E,pageName:String(je.name??""),path:String(je.path??"")},l=Kr(y,r,x);l&&cn.save(E,()=>{const c=Is.getQueryData(yo.decofile(Bs))?.[E];if(!c||typeof c!="object"||c===null||Array.isArray(c))return null;const p={...c,...An.current};return An.current={},t?.raw!==void 0?{...p,seo:t.raw}:t?.inner!==void 0?Kl(r,l,p,t.inner):p})},Xs=(t,r)=>{E&&(An.current[t]=r,ts())},oi=(t,r)=>{if(!E)return;const l=Ln([...U],t,r);b!==null&&(b===t?B(r):t<b&&r>=b?B(b-1):t>b&&r<=b&&B(b+1)),ct(l)},ii=t=>{if(!E)return;const r=U.filter((l,c)=>c!==t);b===t?zt():b!==null&&b>t&&B(b-1),ct(r)},ai=t=>{if(!E)return;const r=U[t];if(!r)return;const l=[...U];l.splice(t+1,0,wa(r)),b!==null&&b>t&&B(b+1),ct(l)},li=t=>{if(!E)return;const r=U[t],l=Pe[t];if(!r||!l)return;const c=l.isHidden?nl(r):sl(r);if(!c)return;const p=[...U];p[t]=c,b===t&&zt(),ct(p)},ci=t=>{if(!E)return;const r=U[t],l=Pe[t];if(!r||!l||l.isMultivariate)return;const c=tl(r);if(!c)return;const p=[...U];p[t]=c,b===t&&zt(),ct(p)},ui=t=>{if(!E)return;const r=U[t],l=Pe[t];if(!r||!l?.isSavedBlock)return;const c=jt(r,l,y);if(!c?.data)return;const{name:p,...S}=c.data,g=[...U];l.isLazy?g[t]={...r,section:S}:g[t]=S,b===t&&zt(),ct(g)},di=t=>{if(!E)return;const r=[...U,{__resolveType:t.resolveType}],l=r.length-1;ct(r,{onError:()=>{Le.current.selectedSectionIndex===l&&zt()}}),Fe(!1),B(l),at(0),O([]),Q(g=>g+1);const c=r[l],p=_n(r,y)[l];if(!c||!p)return;if(p.isMultivariate){bt(c,p,0);return}const S=jt(c,p,y);if(!S){T(null),K(null),st(null),tt(null);return}T(S.data),K(S.resolveType),st(null),tt(null)},Zs=t=>{ne.current=t.append,Fe(!0)},fi=t=>{const r=ne.current;if(!r){di(t);return}r({__resolveType:t.resolveType}),Fe(!1),ne.current=null},er=t=>{if(b===null)return;const r=U[b],l=Pe[b];!r||!l?.isMultivariate||(at(t),O([]),Q(c=>c+1),bt(r,l,t,b,!0))},mi=t=>{if(b===null||!E)return;const r=U[b],l=Pe[b];if(!r||!l?.isMultivariate)return;const c=xt(r,l);if(!c)return;const p=Za(c,t);if(!p){oe.error(f("sectionsEditor.sectionsEditor.cannotDeleteOnlyVariant"));return}const S=[...U];S[b]=qt(r,l,p);const g=p.variants;let _=Je;t===Je?_=Math.min(t,g.length-1):t<Je&&(_=Je-1),at(_),O([]),Q(L=>L+1),bt(S[b],l,_),ct(S)},pi=t=>{if(b===null||!E)return;const r=U[b],l=Pe[b];if(!r||!l?.isMultivariate)return;const c=xt(r,l);if(!c)return;const p=el(c,t),S=[...U];S[b]=qt(r,l,p);const g=t+1;at(g),O([]),Q(_=>_+1),bt(S[b],l,g),ct(S)},hi=(t,r)=>{if(b===null||!E||t===r)return;const l=U[b],c=Pe[b];if(!l||!c?.isMultivariate)return;const p=xt(l,c);if(!p)return;const S=Qa(p,t,r),g=[...U];g[b]=qt(l,c,S);let _=Je;Je===t?_=r:t<Je&&r>=Je?_=Je-1:t>Je&&r<=Je&&(_=Je+1),at(_),bt(g[b],c,_),ct(g)},xn=t=>{const r=t??b;if(r===null||!E)return;const l=U[r],c=Pe[r];if(!l||!c)return;const p=Ua(l,c);if(!p){oe.error(f("sectionsEditor.sectionsEditor.sectionCannotHaveVariants"));return}const S=[...U];S[r]=p.section;const g=_n(S,y)[r];if(!g?.isMultivariate){oe.error(f("sectionsEditor.sectionsEditor.couldNotAddVariant"));return}B(r),at(p.newVariantIndex),O([]),Q(_=>_+1),bt(p.section,g,p.newVariantIndex,r),ct(S)},tr=()=>{if(b===null||!E)return;const t=U[b],r=Pe[b];if(!t||!r?.isMultivariate)return;const l=xt(t,r);if(!l)return;const c=Xa(t,r,l);if(!c){oe.error(f("sectionsEditor.sectionsEditor.couldNotRemoveVariants"));return}const p=[...U];p[b]=c;const S=_n(p,y)[b];if(!S)return;at(0),st(null),tt(null),O([]),Q(_=>_+1);const g=jt(c,S,y);g?(T(g.data),K(g.resolveType)):(T(null),K(null)),en(null,b,0),ct(p)},gi=async t=>{if(ke===null||!E)return;const r=On(t,y,x);if(r){oe.error(r);return}const l=U[ke],c=Pe[ke];if(!l||!c)return;const p=jt(l,c,y);if(!p){oe.error(f("sectionsEditor.sectionsEditor.sectionCannotBeSavedAsGlobal"));return}const S={...p.data,name:t};try{await G.mutateAsync({blockKey:t,data:S});const g=[...U];g[ke]={__resolveType:t},await G.mutateAsync({blockKey:E,data:Sn(y,E,g,we,De)}),b===ke&&zt(),He(null),oe.success(f("sectionsEditor.sectionsEditor.savedGlobalBlock",{blockId:t})),m?.()}catch(g){oe.error(f("sectionsEditor.sectionsEditor.failedToSaveGlobalBlock"),{description:Pt(f,It(g))})}},nr=rt?.rule;if(ht&&b===null&&_e===null&&nr){const{resolveType:t,formValue:r}=jn(nr,y??{},x??void 0);be(t),Z(r)}const tn=x?ma(x):[],ns=x&&y?pa(x,y):[],sr=!ie&&!!(ve&&x&&y),rr=_e&&x?Kn(_e,x):null,Ct=()=>{mt.current&&(clearTimeout(mt.current),mt.current=null),pt.current&&(clearTimeout(pt.current),pt.current=null)},Ht=async(t,r)=>{if(!(il(r,t,x)>0))try{await Rn.mutateAsync({blockKey:t})}catch(l){oe.error(f("sectionsEditor.sectionsEditor.couldNotDeleteMatcherBlock"),{description:Pt(f,It(l))})}},or=t=>{mt.current&&clearTimeout(mt.current),mt.current=setTimeout(()=>{const{activePageKey:r,decofile:l,variantIndex:c}=Le.current;if(!r)return;const p={...l[r]},S={...p.sections},g=[...S.variants??[]],_=g[c],L=_?.rule;if(Gt(L,l,x)){const N=L?.__resolveType??"",M=l[N],P=typeof M?.name=="string"?M.name:N,{__resolveType:de,...Re}=t;G.mutate({blockKey:N,data:Kt(de??"",Re,P)},{onSuccess:()=>m?.(),onError:G.reportError});return}_&&(g[c]={..._,rule:t}),p.sections={...S,variants:g},G.mutate({blockKey:r,data:p},{onSuccess:()=>m?.(),onError:G.reportError})},bn)},ir=t=>{be(t);const r=t?Jr(t,x):{__resolveType:Qr};Z(t?r:{}),or(r)},ar=t=>{const r=t;Z(r);const l=_e?{__resolveType:_e,...r}:{...r};or(l)},lr=async t=>{Ct();const{activePageKey:r,decofile:l,variantIndex:c}=Le.current;if(!r)return;const p=l[r],S=p?.sections;if(!S||typeof S!="object"||Array.isArray(S))return;const g=S;if(!Array.isArray(g.variants))return;const _=[...g.variants],L=_[c];if(!L)return;const N=Bt(L.rule,l,x),M=on(t);_[c]={...L,rule:M};const P={...l,[r]:{...p,sections:{...g,variants:_}}},{resolveType:de,formValue:Re}=jn(M,P,x??void 0);be(de),Z(Re);try{await G.mutateAsync({blockKey:r,data:P[r]}),N&&N!==t&&await Ht(N,P),m?.()}catch(nt){oe.error(f("sectionsEditor.sectionsEditor.couldNotApplySavedRule"),{description:Pt(f,It(nt))})}},cr=t=>{pt.current&&clearTimeout(pt.current);const{selectedSectionIndex:r,sectionVariantIndex:l}=Le.current;r!==null&&(pt.current=setTimeout(()=>{const{rawSections:c,parsedSections:p,decofile:S,activePageKey:g,pageVariants:_,variantIndex:L}=Le.current;if(!g)return;const N=c[r],M=p[r];if(!N||!M?.isMultivariate)return;const P=xt(N,M);if(!P)return;const Re=(P.variants??[])[l]?.rule;if(Gt(Re,S,x)){const J=Re?.__resolveType??"",fe=S[J],Ce=typeof fe?.name=="string"?fe.name:J,{__resolveType:Ue,...gt}=t;G.mutate({blockKey:J,data:Kt(Ue??"",gt,Ce)},{onSuccess:()=>m?.(),onError:G.reportError});return}const nt=Xr(P,l,t),Be=[...c];Be[r]=qt(N,M,nt);const Ge=Sn(S,g,Be,L,_);G.mutate({blockKey:g,data:Ge},{onSuccess:()=>m?.(),onError:G.reportError})},bn))},vi=t=>{st(t);const r=t?Jr(t,x):{__resolveType:Qr};tt(t?r:{}),cr(r)},xi=t=>{const r=t;tt(r);const l=Jt?{__resolveType:Jt,...r}:{...r};cr(l)},yi=async t=>{Ct();const{selectedSectionIndex:r,sectionVariantIndex:l,rawSections:c,parsedSections:p,decofile:S,activePageKey:g,pageVariants:_,variantIndex:L}=Le.current;if(r===null||!g)return;const N=c[r],M=p[r];if(!N||!M?.isMultivariate)return;const P=xt(N,M);if(!P)return;const de=P.variants??[],Re=Bt(de[l]?.rule,S,x),nt=on(t),Be=Xr(P,l,nt),Ge=[...c];Ge[r]=qt(N,M,Be);const J=Sn(S,g,Ge,L,_),fe={...S,[g]:J},{resolveType:Ce,formValue:Ue}=jn(nt,fe,x??void 0);st(Ce),tt(Ue);try{await G.mutateAsync({blockKey:g,data:J}),Re&&Re!==t&&await Ht(Re,fe),m?.()}catch(gt){oe.error(f("sectionsEditor.sectionsEditor.couldNotApplySavedRule"),{description:Pt(f,It(gt))})}};if(!ie&&!je)return i.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:f("sectionsEditor.sectionsEditor.noPageFound",{currentPath:u})});if(ie&&!Un)return i.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:f("sectionsEditor.sectionsEditor.globalBlockNotFound")});const $e=b!==null?Pe[b]??null:null,ur=b!==null?U[b]:null,dr=ur&&$e?.isMultivariate?xt(ur,$e):null,Nt=dr?vs(dr,wt):[],Vn=Math.min(Je,Math.max(Nt.length-1,0)),nn=Nt[Vn]??null,Tt=$e?.isMultivariate===!0,ss=b!==null&&$e!==null,Vt=ss&&(Tt||!!(Tn&&xe)),Si=Vt&&!ie&&$e?.isSavedBlock===!0,ut=ie||Si,fr=ie?Os:$e?.label??"",bi=Jt&&x?Kn(Jt,x):null,mr=(t,r)=>r&&D?`${t} · ${r}`:t,pr=$e?$e.variantOf??$e.label:"",ji=(()=>{const t=Tt&&nn?nn.label:null;return t?D?[mr(pr,t)]:[$e.label,t]:[$e?.label??""]})(),rs=mr(je?.name??"",ht?rt?.label:null),Mn=Vt&&(!ie||q.length>0)?ie?[Os,...q]:[rs,...ji,...q]:[],hr=qe&&je?[je.name,"SEO",...Vs]:[],gr=f("sectionsEditor.pageVariantTabs.variantsLabel"),vr=et&&je?[je.name,gr]:Ot&&je&&$e?[rs,pr,gr]:[],Dn=vr.length>0?vr:hr.length>0?hr:ut?Mn.length>0?Mn:[fr]:Mn.length>0?Mn:[rs],xr=ss&&!Tt&&!$e?.isHidden&&!!E,wi=ut||!ie&&ht&&!!rt||xr,_i=ss&&!Tt&&!ie&&q.length===0&&!!$e&&jo($e)&&!!E,ki=D&&Vt&&!Ot&&Tt&&q.length===0&&!!nn,yr=D&&q.length>0?Fr(q[q.length-1]):null,Ei=q.length>1?Fr(q[q.length-2]):null,Sr=ut?fr:Vt?$e?.label??"":je?.name??"",Ri=et||Ot?f("sectionsEditor.pageVariantTabs.variantsLabel"):qe?f("sectionsEditor.panelSections.seo"):yr??Sr,br=Ot?$e?.variantOf??$e?.label??"":et||qe?je?.name??"":yr?Ei??Sr:ut?f("sectionsEditor.sectionsEditor.globalSectionSubtitle"):Vt?je?.name??"":je?.path??"",os=!et&&!Ot&&!qe&&!Vt&&!ut,Ai=!D&&!qe&&!ie&&Tt&&q.length===0,yn=()=>{if(!E)return;Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const t=y[E],r=Ya(t.sections,U);if(!r)return;const l=Ja(r);G.mutate({blockKey:E,data:{...t,sections:r}},{onSuccess:()=>{ue(l),B(null),T(null),K(null),O([]),Z(null),be(null)},onError:G.reportError})},Pn=(t,r,l)=>{if(!E)return;Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const c=y[E],p=c.sections;if(!p||typeof p!="object"||Array.isArray(p))return;const S=p;if(!Array.isArray(S.variants))return;const g=t([...S.variants]);if(!g)return;const _=ol(S,g),L={...y,[E]:{...c,sections:_}};G.mutate({blockKey:E,data:L[E]},{onSuccess:()=>{r?.();const N=typeof l=="string"?[l]:l??[];(async()=>{for(const M of N)await Ht(M,L)})()},onError:G.reportError})},is=t=>{Ee(null),ue(t),B(null),T(null),K(null),O([]);const r=De[t]?.rule,{resolveType:l,formValue:c}=jn(r,y??{},x??void 0);be(l),Z(c),Xn(De.map(p=>({rule:p.rule})),t)},jr=(t,r)=>{if(t===r)return;let l=we;we===t?l=r:t<we&&r>=we?l=we-1:t>we&&r<=we&&(l=we+1),ue(l);const c=Ln(De.map(p=>({rule:p.rule})),t,r);Xn(c,l),Pn(p=>Ln(p,t,r))},wr=t=>{const r=De[t]?.rule,l=Bt(r,y??{},x??void 0);Pn(c=>c.length<=1?null:(c.splice(t,1),c),()=>{De.length-1===1?ue(0):t<we?ue(we-1):t===we&&ue(Math.max(0,t-1)),B(null),T(null),K(null),O([]),Z(null),be(null)},l)},Ci=()=>{const t=De.map((r,l)=>({variant:r,index:l})).filter(({variant:r})=>!rl(r.rule)).map(({variant:r})=>Bt(r.rule,y??{},x??void 0)).filter(r=>!!r);Pn(r=>{const l=ll({variants:r}),c=r[l];return c?[{...c,rule:cl()}]:null},()=>{ue(0),B(null),T(null),K(null),O([]),Z(null),be(null),ft(!1)},t)},_r=t=>{Pn(r=>ul(r,t),()=>{ue(t+1),B(null),T(null),K(null),O([]),Z(null),be(null)})},Ni=async(t,r)=>{Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const l=Le.current.activePageKey,c=Le.current.decofile;if(!l)return;const p=c[l],S=p.sections;if(!S||typeof S!="object"||Array.isArray(S))return;const g=S;if(!Array.isArray(g.variants))return;const _=[...g.variants],L=_[t];if(!L?.rule||typeof L.rule!="object"){oe.error(f("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const N=L.rule,M=r.trim();Xt(!0);try{if(!M){if(!Gt(N,c,x)){Ee(null);return}const Ge=N.__resolveType??"";_[t]={...L,rule:xs(N,c,x)};const J={...c,[l]:{...p,sections:{...g,variants:_}}};await G.mutateAsync({blockKey:l,data:J[l]}),await Ht(Ge,J),Ee(null),m?.();return}const P=ys(N,c,x);if(!P){oe.error(f("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(P.blockKey){await G.mutateAsync({blockKey:P.blockKey,data:Kt(P.resolveType,P.data,M)}),Ee(null),m?.();return}const de=Fn(M),Re=On(de,c,x);if(Re){oe.error(Re);return}const nt=Kt(P.resolveType,P.data,M);let Be=null;try{await G.mutateAsync({blockKey:de,data:nt}),Be=de,_[t]={...L,rule:on(de)},await G.mutateAsync({blockKey:l,data:{...p,sections:{...g,variants:_}}}),Be=null}catch(Ge){throw Be&&await Rn.mutateAsync({blockKey:Be}).catch(()=>{}),Ge}Ee(null),oe.success(f("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:M})),m?.()}catch(P){oe.error(f("sectionsEditor.sectionsEditor.failedToRenameVariant"),{description:Pt(f,It(P))})}finally{Xt(!1)}},Ti=async(t,r)=>{Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const{selectedSectionIndex:l,rawSections:c,parsedSections:p,decofile:S,activePageKey:g,pageVariants:_,variantIndex:L}=Le.current;if(l===null||!g)return;const N=c[l],M=p[l];if(!N||!M?.isMultivariate)return;const P=xt(N,M);if(!P)return;const de=P.variants??[],Re=de[t];if(!Re?.rule||typeof Re.rule!="object"){oe.error(f("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const nt=Re.rule,Be=r.trim();Xt(!0);const Ge=async J=>{const fe={...P,variants:J},Ce=[...c];Ce[l]=qt(N,M,fe);const Ue=Sn(S,g,Ce,L,_);return await G.mutateAsync({blockKey:g,data:Ue}),{...S,[g]:Ue}};try{if(!Be){if(!Gt(nt,S,x)){Ve(null);return}const ot=nt.__resolveType??"",vt=[...de];vt[t]={...Re,rule:xs(nt,S,x)};const Mt=await Ge(vt);await Ht(ot,Mt),Ve(null),m?.();return}const J=ys(nt,S,x);if(!J){oe.error(f("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(J.blockKey){await G.mutateAsync({blockKey:J.blockKey,data:Kt(J.resolveType,J.data,Be)}),Ve(null),m?.();return}const fe=Fn(Be),Ce=On(fe,S,x);if(Ce){oe.error(Ce);return}const Ue=Kt(J.resolveType,J.data,Be);let gt=null;try{await G.mutateAsync({blockKey:fe,data:Ue}),gt=fe;const ot=[...de];ot[t]={...Re,rule:on(fe)},await Ge(ot),gt=null}catch(ot){throw gt&&await Rn.mutateAsync({blockKey:gt}).catch(()=>{}),ot}Ve(null),oe.success(f("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:Be})),m?.()}catch(J){oe.error(f("sectionsEditor.sectionsEditor.failedToRenameVariant"),{description:Pt(f,It(J))})}finally{Xt(!1)}},kr=async(t,r,l)=>{T(l);try{await G.mutateAsync({blockKey:t,data:l})}catch(c){throw T(p=>p===l?r:p),c}},Vi={rename:async(t,r,l)=>{Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const{activePageKey:c,decofile:p}=Le.current;if(!c)return;const S=Array.isArray(t.variants)?[...t.variants]:[],g=S[r],_=g?.rule&&typeof g.rule=="object"?g.rule:void 0,L=async M=>{const P={...t,variants:M};return await kr(c,t,P),{...p,[c]:P}},N=qc(_,l,p,x);if(N.kind!=="noop"){if(N.kind==="error"){oe.error(N.reason==="no-matcher-rule"?f("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"):N.reason==="unreadable-rule"?f("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"):N.message??f("sectionsEditor.sectionsEditor.failedToRenameVariant"));return}Xt(!0);try{if(N.kind==="inline"){const P=[...S];P[r]={...g,rule:N.inlinedRule};const de=await L(P);await Ht(N.blockKey,de),m?.();return}if(N.kind==="updateBlock"){await G.mutateAsync({blockKey:N.blockKey,data:N.blockData}),m?.();return}let M=null;try{await G.mutateAsync({blockKey:N.blockId,data:N.blockData}),M=N.blockId;const P=[...S];P[r]={...g,rule:N.reference},await L(P),M=null}catch(P){throw M&&await Rn.mutateAsync({blockKey:M}).catch(()=>{}),P}oe.success(f("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:l.trim()})),m?.()}catch(M){oe.error(f("sectionsEditor.sectionsEditor.failedToRenameVariant"),{description:Pt(f,It(M))})}finally{Xt(!1)}}},selectGlobal:async(t,r,l)=>{Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const{activePageKey:c,decofile:p}=Le.current;if(!c)return;const S=Array.isArray(t.variants)?[...t.variants]:[],g=S[r];if(!g)return;const _=Bt(g.rule,p,x);S[r]={...g,rule:on(l)};const L={...t,variants:S},N={...p,[c]:L};try{await kr(c,t,L),_&&_!==l&&await Ht(_,N),m?.()}catch(M){oe.error(f("sectionsEditor.sectionsEditor.couldNotApplySavedRule"),{description:Pt(f,It(M))})}}},Er=()=>{zt()},Rr=t=>{ln(t),ts({inner:t})},Ar=t=>{En(t),ts({raw:t})},Cr=()=>{ln(null),Lt([])},Nr=()=>Yt(t=>t+1),Tr=()=>{cn.flush(),an(!1),ln(null),En(void 0),Lt([]),Yt(t=>t+1),A?.()},Mi=()=>{ft(!1),kn(!1),B(null),an(!0)},Di=()=>{qe&&Tr(),B(null),ft(!0)},Pi=()=>kn(!0),as=t=>{if(et&&t===0){ft(!1);return}if(Ot&&t<2){kn(!1),t===0&&B(null);return}if(qe){if(t===0){Tr();return}if(t===1){Lt([]),Yt(l=>l+1);return}Lt(Vs.slice(0,t-1)),Yt(l=>l+1);return}if(ie){O(q.slice(0,t)),Q(l=>l+1);return}if(t===0){Er();return}if(t===1){O([]),Q(l=>l+1);return}const r=!D&&Tt&&nn?1:0;if(r===1&&t===2){O([]),Q(l=>l+1);return}O(q.slice(0,t-1-r))},ls=Dn.length>1?i.jsx("button",{type:"button",onClick:()=>as(_a(Dn.length,{isMultivariateSectionTop:Ai})),title:f("sectionsEditor.sectionsEditor.back"),"aria-label":f("sectionsEditor.sectionsEditor.back"),className:ae("shrink-0 inline-flex size-6 items-center justify-center rounded-[var(--studio-control-radius,var(--radius-md))] transition-colors",ut?"text-foreground/80 hover:bg-global-section/15":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:i.jsx(Ca,{className:"size-4"})}):null,Ii=ut||Vt||qe?wi&&i.jsxs("div",{className:ae("border-b px-3 py-2.5",ut&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[!ie&&ht&&rt&&i.jsxs("button",{type:"button",onClick:Er,title:f("sectionsEditor.sectionsEditor.editingInVariant",{variant:rt.label}),className:ae("shrink-0 inline-flex items-center gap-1 rounded-lg h-6 px-1.5 text-xs font-medium cursor-pointer transition-opacity hover:opacity-80",ga),children:[i.jsx(ha,{rule:fs(rt.rule,y??{},x??void 0),matchers:tn}),i.jsx("span",{className:"max-w-[160px] truncate",children:rt.label})]}),i.jsx("div",{className:"flex-1"}),ut&&i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx("span",{className:"shrink-0 cursor-help",children:i.jsx(zn,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),i.jsx(Rt,{side:"bottom",className:"max-w-[260px]",children:f("sectionsEditor.sectionsEditor.globalSectionTooltip")})]}),xr&&i.jsx(Bn,{onClick:()=>xn()})]}),ut&&i.jsx("p",{className:"mt-1.5 py-1.5 pl-1 text-sm leading-snug text-foreground",children:f("sectionsEditor.sectionsEditor.globalSectionBanner")})]}):i.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2.5",children:[i.jsx("div",{className:"flex-1 min-w-0",children:i.jsx(Or,{pageKey:E,initialName:je.name,initialPath:je.path,onFieldChange:Xs,variant:"header"})}),i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"ghost",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.editSeo"),className:"size-7 shrink-0",onClick:()=>an(!0),children:i.jsx(Gr,{size:14})})}),i.jsx(Rt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.editSeo")})]}),i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"ghost",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.viewJson"),className:"size-7 shrink-0",onClick:()=>z&&E?z():dt(!0),children:i.jsx(Ur,{size:14})})}),i.jsx(Rt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.viewJson")})]}),i.jsx(Bn,{onClick:yn})]}),Bi=i.jsxs(i.Fragment,{children:[ht&&E&&i.jsx(Lr,{listKey:E,variants:De,activeIndex:we,decofile:y??{},meta:x,matchers:tn,onSelect:is,onReorder:jr,onRename:Ee,onDuplicate:_r,onDelete:wr,onAdd:yn}),ht&&_e!==null&&i.jsx($r,{className:"mt-3",children:i.jsx("div",{className:ae("space-y-3",Qt&&"pointer-events-none opacity-50"),children:i.jsx(us,{currentRt:_e,currentLabel:wn(rt?.rule,y??{},wt,x??void 0),currentGlobalKey:Bt(rt?.rule,y??{},x??void 0)??void 0,matchers:tn,globals:ns,onSelect:ir,onSelectGlobal:lr,schema:rr,formValue:Te,onChange:ar,formKey:`${we}:${_e??""}`,formWrapperClassName:"space-y-3",meta:x??void 0,decofile:y,onSaveReferencedBlock:un,sandbox:hn})})})]}),Vr=i.jsxs(i.Fragment,{children:[i.jsx(va,{listKey:`${E??""}:${b??""}`,variants:Nt.map((t,r)=>({index:r,label:t.label})),selectedIndex:Vn,onSelect:er,onRename:Ve,onDuplicate:pi,onDelete:mi,onRemoveAll:tr,onReorder:hi,onAdd:()=>xn()}),i.jsx($r,{children:i.jsx(us,{currentRt:Jt??"",currentLabel:wn(nn?.rule,y??{},wt,x??void 0),currentGlobalKey:Bt(nn?.rule,y??{},x??void 0)??void 0,matchers:tn,globals:ns,onSelect:vi,onSelectGlobal:yi,schema:bi,formValue:Do,onChange:xi,formKey:`${b??"none"}:${Vn}:${Jt??""}`,formWrapperClassName:"pt-1",meta:x??void 0,decofile:y,onSaveReferencedBlock:un,sandbox:hn})})]}),Mr=i.jsx("div",{className:ae(D?"px-2":"p-2 pt-3"),children:i.jsx(Zl,{listKey:`${E??""}-${we}`,rawSections:U,sections:Pe,meta:x,decofile:y,selectedIndex:b,onSelect:ri,onReorder:oi,onDelete:ii,onDuplicate:ai,onMakeReusable:He,onToggleHidden:li,onToggleLazy:he?ci:void 0,onAddVariant:xn,onDetach:ui,onAddSection:()=>Fe(!0),canAddSection:sr})}),Ki=i.jsxs("div",{className:"min-w-0 max-w-full space-y-4 overflow-x-hidden px-3",children:[E&&je&&i.jsx(Or,{pageKey:E,initialName:je.name,initialPath:je.path,onFieldChange:Xs}),mn&&E?i.jsx(so,{rawSeo:Cn,innerSeo:Jn,defaultResolveType:$s,seoSchema:zs,activeResolveType:Nn,seoTypeOptions:Ls,formResetKey:Ms,siteDefaultSeo:Hs,onBreadcrumbChange:Lt,onPersistRaw:Ar,onInnerChange:Rr,onClearForm:Cr,onBumpFormKey:Nr,asyncRenderAvailable:he}):i.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:f("sectionsEditor.sectionsEditor.seoSchemaNotFound")})]}),Fi=i.jsx(rn,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:i.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:i.jsx("div",{className:"mx-auto max-w-2xl",children:mn&&E?i.jsx(so,{rawSeo:Cn,innerSeo:Jn,defaultResolveType:$s,seoSchema:zs,activeResolveType:Nn,seoTypeOptions:Ls,formResetKey:Ms,siteDefaultSeo:Hs,onBreadcrumbChange:Lt,onPersistRaw:Ar,onInnerChange:Rr,onClearForm:Cr,onBumpFormKey:Nr,asyncRenderAvailable:he}):i.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:f("sectionsEditor.sectionsEditor.seoSchemaNotFound")})})})},"editor-seo"),Oi=i.jsxs(rn,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[ht&&E&&i.jsx(Lr,{listKey:E,variants:De,activeIndex:we,decofile:y??{},meta:x,matchers:tn,onSelect:is,onReorder:jr,onRename:Ee,onDuplicate:_r,onDelete:wr,onAdd:yn}),ht&&_e!==null&&i.jsxs("div",{className:ae("px-3 border-b",Me?"pt-3 pb-5 space-y-3":"py-2"),children:[i.jsxs("button",{type:"button",onClick:()=>yt(t=>!t),className:"flex w-full items-center justify-between gap-2 text-left cursor-pointer rounded-[var(--studio-control-radius,var(--radius-sm))] py-0.5 hover:bg-muted/40","aria-expanded":Me,children:[i.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:f("sectionsEditor.sectionsEditor.variantRule")}),Me?i.jsx(Ea,{className:"size-3.5 shrink-0 text-muted-foreground"}):i.jsx(Ra,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),Me&&i.jsx("div",{className:ae("space-y-3",Qt&&"pointer-events-none opacity-50"),children:i.jsx(us,{currentRt:_e,currentLabel:wn(rt?.rule,y??{},wt,x??void 0),currentGlobalKey:Bt(rt?.rule,y??{},x??void 0)??void 0,matchers:tn,globals:ns,onSelect:ir,onSelectGlobal:lr,schema:rr,formValue:Te,onChange:ar,formKey:`${we}:${_e??""}`,formWrapperClassName:"space-y-3",meta:x??void 0,decofile:y,onSaveReferencedBlock:un,sandbox:hn})})]}),Mr]},"editor-section-list");return i.jsx(xa,{children:i.jsxs("div",{className:"flex h-full min-w-0 w-full flex-col",children:[!D&&ls&&i.jsx("div",{className:"flex min-w-0 shrink-0 items-center gap-2 px-3 py-2",children:ls}),(D||Dn.length>1)&&i.jsx(ya,{crumbs:Dn,onSelect:as,onSelectRoot:()=>{cn.flush(),$?$():as(0)}}),i.jsx("div",{className:"shrink-0",children:D?i.jsxs("div",{className:ae("flex items-center gap-2 border-b px-3 py-2.5",ut&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[D&&ls,ut&&i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx("span",{className:"shrink-0 cursor-help",children:i.jsx(zn,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),i.jsx(Rt,{side:"bottom",className:"max-w-[260px]",children:f("sectionsEditor.sectionsEditor.globalSectionTooltip")})]}),i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[i.jsx("span",{className:"truncate text-sm font-semibold",children:Ri}),br&&i.jsx("span",{className:"truncate text-xs text-muted-foreground",children:br})]}),os&&ht&&rt&&i.jsx(zr,{variants:De,activeIndex:we,onSelect:is,onManage:Di,onRemoveAll:Ci}),ki&&i.jsx(zr,{variants:Nt,activeIndex:Vn,onSelect:er,onManage:Pi,onRemoveAll:tr}),os&&!ht&&i.jsx(Bn,{onClick:yn}),_i&&i.jsx(Bn,{onClick:()=>xn()}),i.jsx(Sa,{}),os&&i.jsxs(i.Fragment,{children:[i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"outline",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.editSeo"),className:"size-7 shrink-0",onClick:Mi,children:i.jsx(Gr,{size:14})})}),i.jsx(Rt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.editSeo")})]}),!z&&i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"outline",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.viewJson"),className:"size-7 shrink-0",onClick:()=>dt(!0),children:i.jsx(Ur,{size:14})})}),i.jsx(Rt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.viewJson")})]})]})]}):Ii}),lt&&i.jsx(yc,{open:!0,fields:cc(lt.plan,lt.target.schema),choices:lt.choices,changedAgain:lt.changedAgain,author:zo,fresh:lt.fresh,onChoose:(t,r)=>si({...lt.choices,[t]:r}),onApply:ni},Jc(lt.formBase)),Ot?i.jsx(Hr,{onAdd:()=>xn(),children:Vr},"editor-section-variants"):Vt?i.jsxs(rn,{viewportRef:Ke,onBlur:Gs,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[!D&&Tt&&Nt.length>0&&q.length===0&&Vr,i.jsx(Wr,{activeSchema:Tn,formValue:xe,formResetKey:Ye,onFormChange:Qs,onBreadcrumbChange:O,breadcrumbPath:q,emptyMessage:f("sectionsEditor.sectionsEditor.noEditableFieldsForVariant"),meta:x,decofile:y,onSaveReferencedBlock:un,sandbox:hn,previewBaseUrl:ee,onRequestAddSection:Zs,onVariantMatcherOp:ie?Vi:void 0})]},"editor-section-form"):ie?i.jsx(rn,{viewportRef:Ke,onBlur:Gs,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:i.jsx(Wr,{activeSchema:Tn,formValue:xe,formResetKey:Ye,onFormChange:Qs,onBreadcrumbChange:O,breadcrumbPath:q,emptyMessage:f("sectionsEditor.sectionsEditor.noEditableFieldsForGlobalBlock"),meta:x,decofile:y,onSaveReferencedBlock:un,sandbox:hn,previewBaseUrl:ee,onRequestAddSection:Zs})},"editor-global-block"):qe?D?i.jsx(rn,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:i.jsx("div",{className:"p-3",children:Ki})},"editor-seo"):Fi:et?i.jsx(Hr,{onAdd:yn,children:Bi},"editor-variants"):D?i.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[i.jsx(rn,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:i.jsx("div",{className:"py-2",children:Mr})}),i.jsx("div",{className:"shrink-0 border-t p-2",children:i.jsx(js,{canAddSection:sr,onAddSection:()=>Fe(!0)})})]},"editor-section-list"):Oi,i.jsx(ba,{open:ke!==null,onOpenChange:t=>{t||He(null)},defaultBlockId:ke!==null?Fn(Pe[ke]?.label??""):"",isPending:G.isPending,onSubmit:gi}),ve&&i.jsx(Al,{open:Ze,onOpenChange:t=>{Fe(t),t||(ne.current=null)},meta:x,decofile:y,previewBaseUrl:ee,onSelect:fi}),re&&E&&y&&i.jsx(La,{open:re,onOpenChange:dt,pageKey:E,decofile:y}),We!==null&&i.jsx(qr,{open:!0,initialName:Gt(De[We]?.rule,y??{},x??void 0)?wn(De[We]?.rule,y??{},wt,x??void 0):"",autoLabel:wt(fs(De[We]?.rule,y??{},x??void 0)),isPending:Qt,onSubmit:async t=>{await Ni(We,t)},onOpenChange:t=>{!t&&!Qt&&Ee(null)}}),Ie!==null&&i.jsx(qr,{open:!0,initialName:Gt(Nt[Ie]?.rule,y??{},x??void 0)?wn(Nt[Ie]?.rule,y??{},wt,x??void 0):"",autoLabel:wt(fs(Nt[Ie]?.rule,y??{},x??void 0)),isPending:Qt,onSubmit:async t=>{await Ti(Ie,t)},onOpenChange:t=>{!t&&!Qt&&Ve(null)}})]})})}export{tm as SectionsEditor};