decocms 4.504.6 → 4.505.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 (388) hide show
  1. package/dist/client/assets/{ActiveShapeUtils-CW3GN5MF.js → ActiveShapeUtils-XOohwaCh.js} +1 -1
  2. package/dist/client/assets/{AlertCircle-Dyzt7ROa.js → AlertCircle-DydWhBUR.js} +1 -1
  3. package/dist/client/assets/{AreaChart-QVjqELIr.js → AreaChart-DiZ010W9.js} +1 -1
  4. package/dist/client/assets/{ArrowLeft-CSHSzn3p.js → ArrowLeft-lM5tIj9y.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-CtyeX35T.js → ArrowUp-DpRxn4K3.js} +1 -1
  6. package/dist/client/assets/{BarChart-DrdN4reU.js → BarChart-x25FVnNf.js} +1 -1
  7. package/dist/client/assets/{Building02-DHk48jC7.js → Building02-CCJS0_vK.js} +1 -1
  8. package/dist/client/assets/{CategoricalChart-nGEQlenm.js → CategoricalChart-B1Eo9CuQ.js} +1 -1
  9. package/dist/client/assets/{CheckCircle-COGqVxnk.js → CheckCircle-CwCxlegG.js} +1 -1
  10. package/dist/client/assets/{ChevronSelectorVertical-CLfFYLAx.js → ChevronSelectorVertical-DbaTjzBx.js} +1 -1
  11. package/dist/client/assets/{ChevronUp-iwpcZ6ZJ.js → ChevronUp-BFa66EpK.js} +1 -1
  12. package/dist/client/assets/{Copy01-C5MyX131.js → Copy01-taXYCEBD.js} +1 -1
  13. package/dist/client/assets/{CreditCard01-DbksZbCa.js → CreditCard01-ClQuCnzR.js} +1 -1
  14. package/dist/client/assets/{DotsVertical-t_p3uDnk.js → DotsVertical-Cmi5H2jc.js} +1 -1
  15. package/dist/client/assets/{ErrorBarContext-BPe_Kua_.js → ErrorBarContext-DLU5LS4u.js} +1 -1
  16. package/dist/client/assets/{Globe04-CEKxgW4I.js → Globe04-BuQjDmeg.js} +1 -1
  17. package/dist/client/assets/{Image01-BmWIcz9g.js → Image01-B2cuVR7o.js} +1 -1
  18. package/dist/client/assets/{Key01-flR1Rk0k.js → Key01-Cyl6HajB.js} +1 -1
  19. package/dist/client/assets/{Link01-NVZrbJ2z.js → Link01-DzC6ocz4.js} +1 -1
  20. package/dist/client/assets/{LinkBroken01-CTkWPKKA.js → LinkBroken01-C5cWFtQq.js} +1 -1
  21. package/dist/client/assets/{Monitor01-C_fHpJXT.js → Monitor01-Bb5ZlrLS.js} +1 -1
  22. package/dist/client/assets/{Play-CYHvnoi_.js → Play-D32AXFrK.js} +1 -1
  23. package/dist/client/assets/{Plus-D-0eKLeG.js → Plus-BLUUzBOk.js} +1 -1
  24. package/dist/client/assets/{SearchMd-BZnFITM5.js → SearchMd-B_qlK90t.js} +1 -1
  25. package/dist/client/assets/{Sector-DBqK3_lW.js → Sector-jO4N0BPc.js} +1 -1
  26. package/dist/client/assets/{ShoppingBag01-_i_0EGH-.js → ShoppingBag01-4IcurZUz.js} +1 -1
  27. package/dist/client/assets/{Sun-g_4y19bS.js → Sun-wFVY28gS.js} +1 -1
  28. package/dist/client/assets/{SwitchHorizontal01-I9orqnhT.js → SwitchHorizontal01-BjaFUETy.js} +1 -1
  29. package/dist/client/assets/{Tool01-CtZDIoke.js → Tool01-BlSQo18i.js} +1 -1
  30. package/dist/client/assets/{Trash01-DXu_ke97.js → Trash01-COQdVdde.js} +1 -1
  31. package/dist/client/assets/{Upload01-Cuxcfzt0.js → Upload01-NWVVb23Y.js} +1 -1
  32. package/dist/client/assets/{User01-CpQvYpgF.js → User01-1G5fScIG.js} +1 -1
  33. package/dist/client/assets/{UserSquare-C0oVj3jP.js → UserSquare-Ag2h6fjB.js} +1 -1
  34. package/dist/client/assets/{Users01-BOA9J6qJ.js → Users01-CTT2kFNN.js} +1 -1
  35. package/dist/client/assets/{XAxis-hQX8cIum.js → XAxis-Cjl6GEuy.js} +1 -1
  36. package/dist/client/assets/{XClose-DFzCGpgs.js → XClose-Bw63kXIL.js} +1 -1
  37. package/dist/client/assets/{ZoomOut-Cg2E6Hn7.js → ZoomOut-BRLVgQbx.js} +1 -1
  38. package/dist/client/assets/{access-gate-BdfGulzU.js → access-gate-B6CWdgWD.js} +1 -1
  39. package/dist/client/assets/{add-connection-dialog-wdvNwZIH.js → add-connection-dialog-M4AoaiFN.js} +1 -1
  40. package/dist/client/assets/{agent-analytics-DT97hAtN.js → agent-analytics-S9KeHs3W.js} +1 -1
  41. package/dist/client/assets/agent-app-CSDDu9J6.js +1 -0
  42. package/dist/client/assets/{agent-assets-ggCXUSLU.js → agent-assets-Cq4W4Ovn.js} +1 -1
  43. package/dist/client/assets/{agent-automation-jg9w8oDf.js → agent-automation-BezS81S9.js} +1 -1
  44. package/dist/client/assets/{agent-automations-BbqOgRf8.js → agent-automations-DWC2EzvH.js} +1 -1
  45. package/dist/client/assets/{agent-connect-sources-B-BhlRsz.js → agent-connect-sources-DrhgxJdk.js} +1 -1
  46. package/dist/client/assets/agent-deck-DK_973zT.js +1 -0
  47. package/dist/client/assets/{agent-e2e-DhwM3X4d.js → agent-e2e-DWGlECXV.js} +1 -1
  48. package/dist/client/assets/{agent-experiments-IcLKZZjx.js → agent-experiments-CzocsLnx.js} +1 -1
  49. package/dist/client/assets/{agent-file-kyFcKASQ.js → agent-file-C3Nbr_FQ.js} +1 -1
  50. package/dist/client/assets/{agent-hosting-CxMTs6IB.js → agent-hosting-DxG2dBMm.js} +1 -1
  51. package/dist/client/assets/{agent-icon-7ADgtWCH.js → agent-icon-MD5OrAoo.js} +1 -1
  52. package/dist/client/assets/agent-library-BGL9Djfe.js +1 -0
  53. package/dist/client/assets/agent-library-file-chVG21bZ.js +1 -0
  54. package/dist/client/assets/{agent-monitor-B7DjpRxz.js → agent-monitor-DEe9PjhU.js} +1 -1
  55. package/dist/client/assets/{agent-overview-DUpu1AIo.js → agent-overview-BYXCEHT6.js} +1 -1
  56. package/dist/client/assets/agent-releases-CpZb5E4A.js +2 -0
  57. package/dist/client/assets/agent-settings-uCfTAAjr.js +1 -0
  58. package/dist/client/assets/{agent-site-editor-pGrUAJRT.js → agent-site-editor-D9c58o0v.js} +2 -2
  59. package/dist/client/assets/agent-site-editor-code-DI6sk1H-.js +2 -0
  60. package/dist/client/assets/agent-site-editor-content-BsXlco2b.js +1 -0
  61. package/dist/client/assets/agent-site-editor-preview-DdsOOMnU.js +1 -0
  62. package/dist/client/assets/agent-view-Bzjmry5i.js +1 -0
  63. package/dist/client/assets/{agent-view-guard-CQuxRYsf.js → agent-view-guard-CVaMc8u1.js} +1 -1
  64. package/dist/client/assets/{agents-list-Bwjs1oK_.js → agents-list-0dpg_olu.js} +1 -1
  65. package/dist/client/assets/{ai-providers-C_UqBqak.js → ai-providers-ofcK9fW-.js} +1 -1
  66. package/dist/client/assets/{alert-BVmkZ-E2.js → alert-CCN8MTJM.js} +1 -1
  67. package/dist/client/assets/{alert-dialog-_s7hqvJ_.js → alert-dialog-Czq8smrs.js} +1 -1
  68. package/dist/client/assets/{analytics-sections-DCG-GatN.js → analytics-sections-YYA41jnN.js} +1 -1
  69. package/dist/client/assets/{api-keys-Ce-PoFp-.js → api-keys-CQOwZjqQ.js} +1 -1
  70. package/dist/client/assets/api-keys-Cbx1GxmD.js +1 -0
  71. package/dist/client/assets/app-editor-COm7gYBF.js +1 -0
  72. package/dist/client/assets/{asset-utils-gDGUDBoj.js → asset-utils-CQJ9nYXC.js} +1 -1
  73. package/dist/client/assets/{auth-B_TJXS0n.js → auth-DYpVJTi6.js} +1 -1
  74. package/dist/client/assets/{auth-catchall-Du_2OuHw.js → auth-catchall-CZNhW2_t.js} +1 -1
  75. package/dist/client/assets/{auth-entry-8OMdbE1b.js → auth-entry-GKVcsXsF.js} +1 -1
  76. package/dist/client/assets/{auth-split-layout-yfv6lu-x.js → auth-split-layout-BYbolCIM.js} +1 -1
  77. package/dist/client/assets/{authenticate-and-persist-oauth-UdSc08ls.js → authenticate-and-persist-oauth-DirDXL13.js} +1 -1
  78. package/dist/client/assets/{automation-list-row-t-1BGVUO.js → automation-list-row-DHus7_rE.js} +1 -1
  79. package/dist/client/assets/{automation-runs-DiFW9DBp.js → automation-runs-BWjt3VX5.js} +1 -1
  80. package/dist/client/assets/{automations-CZYikobS.js → automations-DxqwEE8R.js} +1 -1
  81. package/dist/client/assets/{autosend-D3NSq3DM.js → autosend-DhzpX2qh.js} +1 -1
  82. package/dist/client/assets/{avatar-D7EA7cl6.js → avatar-gla6h0ms.js} +1 -1
  83. package/dist/client/assets/{badge-C0x7-j94.js → badge-5B6T9ERD.js} +1 -1
  84. package/dist/client/assets/{block-document-CsUHPLPU.js → block-document-Bp7jeS6q.js} +1 -1
  85. package/dist/client/assets/{blocks-preview-workspace-context-Bglfht36.js → blocks-preview-workspace-context-BAifPCSm.js} +1 -1
  86. package/dist/client/assets/{blocks-tab-states-DWDFGWKG.js → blocks-tab-states-CB59zP3T.js} +3 -3
  87. package/dist/client/assets/{blog-schema-S-2nmh-l.js → blog-schema-l0butExm.js} +1 -1
  88. package/dist/client/assets/{board-analytics-DsiHTlst.js → board-analytics-D4PrP04x.js} +1 -1
  89. package/dist/client/assets/{buckets-ZVFPDJmV.js → buckets-l5SHF6cY.js} +1 -1
  90. package/dist/client/assets/{build-improve-prompt-doc-CFy-LfRO.js → build-improve-prompt-doc-o9aBywB1.js} +1 -1
  91. package/dist/client/assets/{calendar-DppMF-oc.js → calendar-DFOIWN8u.js} +1 -1
  92. package/dist/client/assets/{capability-load-error-yU5Nl2wO.js → capability-load-error-DOGNUbiB.js} +1 -1
  93. package/dist/client/assets/category-editor-DZeglRvh.js +1 -0
  94. package/dist/client/assets/{chart-CUIMWuO7.js → chart-BpMIAoAB.js} +1 -1
  95. package/dist/client/assets/{chat-context-Dn145aEn.js → chat-context-C0Wb4MFf.js} +1 -1
  96. package/dist/client/assets/{chat-draft-B11vfGsb.js → chat-draft-B8EOLWmz.js} +1 -1
  97. package/dist/client/assets/{checkbox-DEL-ITP4.js → checkbox-BrfO0AS7.js} +1 -1
  98. package/dist/client/assets/{choose-editor-DyoYtDXd.js → choose-editor-RJ3PC_zy.js} +1 -1
  99. package/dist/client/assets/{cli-auth-success-DaX0zDX3.js → cli-auth-success-D4KlT9v_.js} +1 -1
  100. package/dist/client/assets/{client-icons-cgSe2W1K.js → client-icons-Bq5jVcfK.js} +1 -1
  101. package/dist/client/assets/cms-settings-editor-ShgOJR34.js +1 -0
  102. package/dist/client/assets/{collapsible-2qINC-s6.js → collapsible-B-WgQIIJ.js} +1 -1
  103. package/dist/client/assets/{collection-detail-Ipzh1PCz.js → collection-detail-BCBHyQp1.js} +1 -1
  104. package/dist/client/assets/{collection-display-button-Dwavqzm0.js → collection-display-button-ByhrqD5X.js} +1 -1
  105. package/dist/client/assets/{collection-search-BtAaADUJ.js → collection-search-BjRRO8AD.js} +1 -1
  106. package/dist/client/assets/{collection-table-wrapper-Cw5Kjque.js → collection-table-wrapper-Dh3XwsWE.js} +1 -1
  107. package/dist/client/assets/{collection-tabs-BPMM9JU6.js → collection-tabs-Lz0rqrLq.js} +1 -1
  108. package/dist/client/assets/{column-rules-C7I4Rr8f.js → column-rules-3EmXTSnI.js} +1 -1
  109. package/dist/client/assets/{combobox-B-I_TDnB.js → combobox-BpUVYVJv.js} +1 -1
  110. package/dist/client/assets/{command-fxFZFBik.js → command-BsY8EENg.js} +1 -1
  111. package/dist/client/assets/{companion-mcps-section-L_q5tP4z.js → companion-mcps-section-d0lLoBTn.js} +1 -1
  112. package/dist/client/assets/{config-HMBw-xwR.js → config-DO-hLriH.js} +1 -1
  113. package/dist/client/assets/{connect-Rp8OEWff.js → connect-C7Ztyb8S.js} +1 -1
  114. package/dist/client/assets/{connect-layout-DoWxI4NV.js → connect-layout-ZTvMCNm-.js} +1 -1
  115. package/dist/client/assets/{connection-Bm1YN2Qv.js → connection-D2g-M5HU.js} +1 -1
  116. package/dist/client/assets/{connection-card-VZyTjeL7.js → connection-card-xYydZgZe.js} +1 -1
  117. package/dist/client/assets/{connection-detail-DG52jxSu.js → connection-detail-DvwzS0fT.js} +1 -1
  118. package/dist/client/assets/{connection-form-helpers-B8gc-NIa.js → connection-form-helpers-Cyf4ui7a.js} +1 -1
  119. package/dist/client/assets/{connections-CVtafCDp.js → connections-C4zoZavJ.js} +1 -1
  120. package/dist/client/assets/content-tab-Dnx4cpni.js +22 -0
  121. package/dist/client/assets/context-BrqfrS67.js +1 -0
  122. package/dist/client/assets/{context-menu-BhQBRl1n.js → context-menu-DnUdyxPl.js} +1 -1
  123. package/dist/client/assets/{core.esm-BWusCVk-.js → core.esm-B0kDFHOB.js} +1 -1
  124. package/dist/client/assets/{create-organization-dialog-CpW4B8uH.js → create-organization-dialog-GxmrqCD4.js} +1 -1
  125. package/dist/client/assets/{daily-pulse-ClsKmu3h.js → daily-pulse-3JNQ3bXe.js} +1 -1
  126. package/dist/client/assets/{discover-Dhk360ek.js → discover-Ds0vwdW-.js} +1 -1
  127. package/dist/client/assets/{domain-settings-B9aADrGh.js → domain-settings-woFQOQXJ.js} +1 -1
  128. package/dist/client/assets/{drawer-Pd2bkZwX.js → drawer-_oUDG6Bh.js} +1 -1
  129. package/dist/client/assets/{editor-fmwfQ_5F.js → editor-D5lw6JVB.js} +1 -1
  130. package/dist/client/assets/{editor-classes-N-pDaC7c.js → editor-classes-CYQ0nby9.js} +1 -1
  131. package/dist/client/assets/{empty-state-BKri0rqp.js → empty-state-BPyWcx0u.js} +1 -1
  132. package/dist/client/assets/{empty-state-BSt_DXl_.js → empty-state-ChicBK_6.js} +1 -1
  133. package/dist/client/assets/{extract-connection-data-47aQZG-0.js → extract-connection-data-B2cCu4Y0.js} +1 -1
  134. package/dist/client/assets/{feature-gate-BIEh1WBJ.js → feature-gate-rJK-N6UP.js} +1 -1
  135. package/dist/client/assets/{feature-paywall-BUvad-6w.js → feature-paywall-DvPrxDxF.js} +1 -1
  136. package/dist/client/assets/{file-explorer-DFktYjgR.js → file-explorer-3DkIV-h_.js} +1 -1
  137. package/dist/client/assets/{file-preview-BaOgZ1H-.js → file-preview-8ODF6efV.js} +1 -1
  138. package/dist/client/assets/{file-share-button-BbbT8rSV.js → file-share-button-ClxhzVmh.js} +1 -1
  139. package/dist/client/assets/{file-type-icon-C3Wvkdfs.js → file-type-icon-CwmbBd4_.js} +1 -1
  140. package/dist/client/assets/flat-project-QwsUFjCO.js +1 -0
  141. package/dist/client/assets/{folder-icon-BMfJIGr7.js → folder-icon-DWUMoHSG.js} +1 -1
  142. package/dist/client/assets/{form-DmfVlpti.js → form-BV3E3DRr.js} +1 -1
  143. package/dist/client/assets/{general-BuvZjhT0.js → general-CgvwKafN.js} +1 -1
  144. package/dist/client/assets/{home-DaaiJums.js → home-DjmWwzfH.js} +1 -1
  145. package/dist/client/assets/hosted-publish-feedback-DSJDDn8U.js +1 -0
  146. package/dist/client/assets/{icon-button-gjWtlNIn.js → icon-button-pY1Ev_Zs.js} +1 -1
  147. package/dist/client/assets/{index-BnmQwDAi.js → index-1FDq7FOC.js} +3 -3
  148. package/dist/client/assets/{index-CuAR9UE_.js → index-2W02K1gN.js} +1 -1
  149. package/dist/client/assets/{index-q27NKfUU.js → index-BqY7_n3x.js} +1 -1
  150. package/dist/client/assets/{index-reKUfr7F.js → index-Bz12b-pJ.js} +1 -1
  151. package/dist/client/assets/{index-Ok_Gmm6y.js → index-CJa-xPtO.js} +1 -1
  152. package/dist/client/assets/{index-D39-8oMP.js → index-CLqOti3t.js} +1 -1
  153. package/dist/client/assets/{index-Kv7T-lWA.js → index-CP_lXIID.js} +1 -1
  154. package/dist/client/assets/{index-Bu_NA65U.js → index-CTXm_AQX.js} +1 -1
  155. package/dist/client/assets/{index-CIf6SjuC.js → index-CUQs4XsQ.js} +1 -1
  156. package/dist/client/assets/{index-D8OSGl2O.js → index-C_Yl5p42.js} +1 -1
  157. package/dist/client/assets/{index-g1MruvLu.js → index-CbpHnzxX.js} +1 -1
  158. package/dist/client/assets/{index-Dtd9p8uT.js → index-ChoD9h5e.js} +1 -1
  159. package/dist/client/assets/{index-D8ycvvq3.js → index-DD3jMnD8.js} +5 -5
  160. package/dist/client/assets/{index-C1k6bl66.js → index-DUGwIFiv.js} +1 -1
  161. package/dist/client/assets/{index-B6Pl30Jv.js → index-D_ppSX5g.js} +1 -1
  162. package/dist/client/assets/{index-redirect-B4PueQ6K.js → index-redirect-EowHTWi4.js} +1 -1
  163. package/dist/client/assets/{infiniteQueryObserver-DgfIuRy-.js → infiniteQueryObserver-DN3ugQJJ.js} +1 -1
  164. package/dist/client/assets/{infra-billing-B1dsz6li.js → infra-billing-BXXqeuOz.js} +1 -1
  165. package/dist/client/assets/{input-CNWKZHOn.js → input-D-82ZEvn.js} +3 -3
  166. package/dist/client/assets/{input-DrsB_G6y.js → input-DpLyWs62.js} +1 -1
  167. package/dist/client/assets/{integration-icon-Ch0O_HoU.js → integration-icon-8xJy_m0U.js} +1 -1
  168. package/dist/client/assets/{jira-icon-D7ylX1np.js → jira-icon-BaaYOIw5.js} +1 -1
  169. package/dist/client/assets/{label-Des1dBAA.js → label-QcEtv8aS.js} +1 -1
  170. package/dist/client/assets/{layout-DkKJYazw.js → layout-HuVZKOCN.js} +1 -1
  171. package/dist/client/assets/{legacy-agents-deep-DN-1otlm.js → legacy-agents-deep-AuduWihm.js} +1 -1
  172. package/dist/client/assets/{legacy-main-redirect-CJTWKYZn.js → legacy-main-redirect-CyobeGy0.js} +1 -1
  173. package/dist/client/assets/library-WWZWUP7o.js +1 -0
  174. package/dist/client/assets/{library-tab-mqVKltv-.js → library-tab-YpZyRn2Y.js} +1 -1
  175. package/dist/client/assets/{login-DrcAeeSr.js → login-BSCo9Gp8.js} +1 -1
  176. package/dist/client/assets/{markdown-Cy5TyQD8.js → markdown-CjmuCvzH.js} +1 -1
  177. package/dist/client/assets/{mcp-app-renderer-DYh0AbHr.js → mcp-app-renderer-DOTIYm4V.js} +1 -1
  178. package/dist/client/assets/{mcp-oauth-C7679P97.js → mcp-oauth-o1bjrgf5.js} +1 -1
  179. package/dist/client/assets/{mcp-oauth-CEdQ8awJ.js → mcp-oauth-tY0goV8V.js} +1 -1
  180. package/dist/client/assets/{members-DDjc7w-O.js → members-DvOcnN-x.js} +1 -1
  181. package/dist/client/assets/{memory-CSj344HL.js → memory-5Ob5Qtqd.js} +1 -1
  182. package/dist/client/assets/{mini-report-page-DUlnJW7Q.js → mini-report-page-Dbty4F4c.js} +1 -1
  183. package/dist/client/assets/{mock-board-DPnDRGqb.js → mock-board-_yZzL2WV.js} +1 -1
  184. package/dist/client/assets/{monaco-editor-BOWGtFnb.js → monaco-editor-D6IVhQre.js} +1 -1
  185. package/dist/client/assets/{monitoring-stats-row-4uIjPelM.js → monitoring-stats-row-ChCJX11Z.js} +1 -1
  186. package/dist/client/assets/{multi-select-N6zgROA9.js → multi-select-CeE4vfPI.js} +1 -1
  187. package/dist/client/assets/{mustache-DF__kc82.js → mustache-Dayjxewp.js} +1 -1
  188. package/dist/client/assets/{new-project-dialog-D7zn8TAV.js → new-project-dialog-tcOep_vf.js} +1 -1
  189. package/dist/client/assets/{oauth-callback-DoU1w-9q.js → oauth-callback-3wV4zoOA.js} +1 -1
  190. package/dist/client/assets/{oauth-callback-ai-provider-CXx2xYDK.js → oauth-callback-ai-provider-ufn7vAbt.js} +1 -1
  191. package/dist/client/assets/{onboarding-xvYBaoIw.js → onboarding-DxS8snTM.js} +1 -1
  192. package/dist/client/assets/{openai-conversation-IQSb25ld.js → openai-conversation-DI2hkuO6.js} +1 -1
  193. package/dist/client/assets/{optimistic-project-sidebar-views-DwYPMdgG.js → optimistic-project-sidebar-views-DvcOFOaq.js} +1 -1
  194. package/dist/client/assets/{order-monitor-day-CK15UV86.js → order-monitor-day-O6iqZCvW.js} +1 -1
  195. package/dist/client/assets/{organization-choice-MLbDtnt-.js → organization-choice-CF6_mO6R.js} +1 -1
  196. package/dist/client/assets/{orgs-CIIb6obg.js → orgs-BDf8CmkB.js} +1 -1
  197. package/dist/client/assets/{page-seo-form-C47J61Bn.js → page-seo-form-DEniWcne.js} +1 -1
  198. package/dist/client/assets/{pair-B9FUGmMH.js → pair-BXzhmvOK.js} +1 -1
  199. package/dist/client/assets/{plan-ladder-i59Z6bnV.js → plan-ladder-CHzPrqgq.js} +1 -1
  200. package/dist/client/assets/{popover-B5_Kaf1b.js → popover-qHcjuSU0.js} +1 -1
  201. package/dist/client/assets/post-calendar-BASX2hKd.js +1 -0
  202. package/dist/client/assets/{post-editor-CH9Jjuyr.js → post-editor-CwrApEHG.js} +2 -2
  203. package/dist/client/assets/{preview-content-DTbY8ytS.js → preview-content-D-tC-1-n.js} +1 -1
  204. package/dist/client/assets/{preview-dialog-BmWuRDjW.js → preview-dialog-Btn-CE6_.js} +1 -1
  205. package/dist/client/assets/{preview-panel-BYEouSOL.js → preview-panel-BOdq-R-d.js} +1 -1
  206. package/dist/client/assets/{preview-tab-Dh2QFgKr.js → preview-tab-DFxZE6Oa.js} +3 -3
  207. package/dist/client/assets/{product-picker-dialog-Dbk5Wmp-.js → product-picker-dialog-Ixnrpyxe.js} +1 -1
  208. package/dist/client/assets/{profile-7rQCa4Wi.js → profile-CBlN8bRW.js} +1 -1
  209. package/dist/client/assets/{project-app-view-c4nto0xL.js → project-app-view-ChYxUD4g.js} +1 -1
  210. package/dist/client/assets/{project-feed-BU9q0zlr.js → project-feed-Coy6NkfW.js} +1 -1
  211. package/dist/client/assets/{project-icon-DDejaJkU.js → project-icon-voOUfH8Y.js} +1 -1
  212. package/dist/client/assets/project-reports-DgZCqzh8.js +1 -0
  213. package/dist/client/assets/project-tasks-Dl3gVSzh.js +1 -0
  214. package/dist/client/assets/{projects-DD3HxQ_p.js → projects-BYLX6bIC.js} +1 -1
  215. package/dist/client/assets/{projects-empty-state-DdEbQ2Es.js → projects-empty-state-sIs7ogdq.js} +1 -1
  216. package/dist/client/assets/{prompts-DiMTPjpn.js → prompts-BmqWXIjA.js} +1 -1
  217. package/dist/client/assets/record-editor-C2XTFAlG.js +1 -0
  218. package/dist/client/assets/redirect-editor-DRsu3pS0.js +1 -0
  219. package/dist/client/assets/reports-BISNFWLq.js +1 -0
  220. package/dist/client/assets/{reports-CjTyv_Ip.js → reports-CfSDqvLB.js} +1 -1
  221. package/dist/client/assets/{reports-onboarding-2A0HPLFQ.js → reports-onboarding-B1UZ9c7Y.js} +1 -1
  222. package/dist/client/assets/{reports-tab-D4aJXf2q.js → reports-tab-eIch6mZh.js} +2 -2
  223. package/dist/client/assets/{repositories-d6XMtt37.js → repositories-ClO76b2x.js} +1 -1
  224. package/dist/client/assets/{repository-binding-qFnOG9Kf.js → repository-binding-CHF_oBGX.js} +1 -1
  225. package/dist/client/assets/{repository-import-picker-XvHhr-YM.js → repository-import-picker-CbW5OIUw.js} +1 -1
  226. package/dist/client/assets/{repository-picker-CDMQ-67j.js → repository-picker-z7ZWmH9V.js} +1 -1
  227. package/dist/client/assets/{require-capability-CWRAPfGe.js → require-capability-CcHa8l-N.js} +1 -1
  228. package/dist/client/assets/{required-auth-layout-BJdpNUyb.js → required-auth-layout-Brpu-Um7.js} +1 -1
  229. package/dist/client/assets/{reset-password-DFDQ9gzR.js → reset-password-g8CcEp7c.js} +1 -1
  230. package/dist/client/assets/{resizable-CKPf2Yhz.js → resizable-Cp8Fei2Z.js} +1 -1
  231. package/dist/client/assets/{resolve-tab-icon-DP8Ea0aD.js → resolve-tab-icon-CEjO0rXG.js} +1 -1
  232. package/dist/client/assets/{review-settings-DS8U5jLO.js → review-settings-DCjfDdhW.js} +1 -1
  233. package/dist/client/assets/{roles-JBoQ-0nm.js → roles-DguOVHkn.js} +1 -1
  234. package/dist/client/assets/{route-B3AqIjWV.js → route-C3llV-4J.js} +1 -1
  235. package/dist/client/assets/route-CJWXyQ8D.js +1 -0
  236. package/dist/client/assets/{route-DixAWiUV.js → route-euoT0aVp.js} +1 -1
  237. package/dist/client/assets/{sandbox-lifecycle-context-qVQZp0bf.js → sandbox-lifecycle-context-BgEjrgCl.js} +1 -1
  238. package/dist/client/assets/{schema-pZcdx7db.js → schema-msyWsNEX.js} +1 -1
  239. package/dist/client/assets/{schema-CB0y_kWu.js → schema-w5h_hx-N.js} +1 -1
  240. package/dist/client/assets/{scroll-area-tjZ1v8uh.js → scroll-area-CQBF_dZT.js} +1 -1
  241. package/dist/client/assets/{search-input-iNzELQG5.js → search-input-hbrzDCe3.js} +1 -1
  242. package/dist/client/assets/{search-toggle-DIkKdgX4.js → search-toggle-BLr8pbVK.js} +1 -1
  243. package/dist/client/assets/{secret-ciphertext-BAOlyGdC.js → secret-ciphertext-oiVgkxxG.js} +1 -1
  244. package/dist/client/assets/{secret-picker-fRrNeBFc.js → secret-picker-BbRclMvG.js} +1 -1
  245. package/dist/client/assets/{secrets-DtzMzBkb.js → secrets-B3wvoItd.js} +1 -1
  246. package/dist/client/assets/{sections-editor-30xstIGx.js → sections-editor-DyJwFLUt.js} +2 -2
  247. package/dist/client/assets/{select-CsN8wWwy.js → select-CA6Xf89b.js} +1 -1
  248. package/dist/client/assets/{select-model-C9K6RX7a.js → select-model-B5I7vjgl.js} +1 -1
  249. package/dist/client/assets/{seo-editor-DqzBrnHi.js → seo-editor-B0ulE3lu.js} +1 -1
  250. package/dist/client/assets/{separator-Dc8FPAxr.js → separator--X5NQB5Q.js} +1 -1
  251. package/dist/client/assets/{settings-tab-D23NDFeU.js → settings-tab-DWTiloa5.js} +1 -1
  252. package/dist/client/assets/{sheet-C8W18YeS.js → sheet-DpEU8sEu.js} +1 -1
  253. package/dist/client/assets/{shell-layout-C8-H8Sys.js → shell-layout-r2grUF3c.js} +1 -1
  254. package/dist/client/assets/site-editor-Cf3Rn_G8.js +1 -0
  255. package/dist/client/assets/site-editor-toast-BQVM8xFE.js +1 -0
  256. package/dist/client/assets/{skills-DCH1Oq34.js → skills-DH_qPHrW.js} +1 -1
  257. package/dist/client/assets/{slider-BDjlsfbY.js → slider-BKaZVmho.js} +1 -1
  258. package/dist/client/assets/{sortable.esm-DR9w0kC7.js → sortable.esm-fnpMXn9v.js} +1 -1
  259. package/dist/client/assets/{sso-ChB3UIi5.js → sso-BzmmdKL0.js} +1 -1
  260. package/dist/client/assets/{suggestion-DD-4qLns.js → suggestion-vzrmAu6j.js} +1 -1
  261. package/dist/client/assets/{switch-Dw8QMOfK.js → switch-bAUD40Nw.js} +1 -1
  262. package/dist/client/assets/{symbol-tqxB57V8.js → symbol-BBSU-8KK.js} +1 -1
  263. package/dist/client/assets/{synced-repos-BS5CIvkT.js → synced-repos-D21eCwfQ.js} +1 -1
  264. package/dist/client/assets/{tab-icon-glyph-DosnEK5E.js → tab-icon-glyph-DBgCEMvo.js} +1 -1
  265. package/dist/client/assets/{table-BdBcVCQf.js → table-_LvNwq3m.js} +1 -1
  266. package/dist/client/assets/{tabs-DpA6UCpp.js → tabs-CVRt1gsT.js} +1 -1
  267. package/dist/client/assets/{task-board-Cfi5K-5Q.js → task-board-Drym1VGl.js} +1 -1
  268. package/dist/client/assets/{task-route-BkEWCnOY.js → task-route-Cy6tBirf.js} +1 -1
  269. package/dist/client/assets/{task-status-ttzVi7uo.js → task-status-Drd0l7YO.js} +1 -1
  270. package/dist/client/assets/taskboard-analytics-CPKa9L-I.js +1 -0
  271. package/dist/client/assets/{tasks-B0eo6Df4.js → tasks-Bm3aJdvZ.js} +1 -1
  272. package/dist/client/assets/tasks-rbr_VCJB.js +1 -0
  273. package/dist/client/assets/{textarea-CilvBHk6.js → textarea-C6sVZPZU.js} +1 -1
  274. package/dist/client/assets/{thread-analytics-C2ozIuOR.js → thread-analytics-BJ3jpIDz.js} +1 -1
  275. package/dist/client/assets/{thread-intent-4EhNPevS.js → thread-intent-CDcQO3Gb.js} +1 -1
  276. package/dist/client/assets/{thread-route-BD60Whh-.js → thread-route-9ORs8Bvm.js} +1 -1
  277. package/dist/client/assets/{thread-route-Cn1zYPdb.js → thread-route-DpGy1EjL.js} +1 -1
  278. package/dist/client/assets/{thread-sheet-body-xUmXvet8.js → thread-sheet-body-DK2uQns5.js} +1 -1
  279. package/dist/client/assets/{time-range-picker-Ce2u-LAU.js → time-range-picker-D68U4DuO.js} +1 -1
  280. package/dist/client/assets/{toggle-group-CehyBfy_.js → toggle-group-aS4D4pWB.js} +1 -1
  281. package/dist/client/assets/{tool-namespace-B7nVIU6I.js → tool-namespace-BLZ5kDEc.js} +1 -1
  282. package/dist/client/assets/{toolbar-icon-button-CNY-x8q8.js → toolbar-icon-button-Ba65Z_g5.js} +1 -1
  283. package/dist/client/assets/{tooltip-DTDDImYK.js → tooltip-Czt_UbWN.js} +1 -1
  284. package/dist/client/assets/{tooltipContext-BwZiIrKr.js → tooltipContext-TXJARYp3.js} +1 -1
  285. package/dist/client/assets/{track-5NpwdaIS.js → track-DnM0LaQd.js} +1 -1
  286. package/dist/client/assets/{types-BRbHCiMu.js → types-BxhF8ASs.js} +1 -1
  287. package/dist/client/assets/{url-slug-CvdbhkuL.js → url-slug-SM3_9Cya.js} +1 -1
  288. package/dist/client/assets/{usage-stats-CPLYge0E.js → usage-stats-BCJbY9qH.js} +1 -1
  289. package/dist/client/assets/{use-ai-providers-Ba6tq6Kh.js → use-ai-providers-Bx12ndn_.js} +1 -1
  290. package/dist/client/assets/{use-app-takeover-CUfPdIQ-.js → use-app-takeover-CdMQoosN.js} +1 -1
  291. package/dist/client/assets/{use-automations-7PDgmLlN.js → use-automations-DNt6hUxZ.js} +1 -1
  292. package/dist/client/assets/{use-autosave-DfbYhr8K.js → use-autosave-B0-ebzlg.js} +1 -1
  293. package/dist/client/assets/{use-chat-navigation-qWQesS8S.js → use-chat-navigation-CObcn40t.js} +1 -1
  294. package/dist/client/assets/{use-clock-tick-Df5id_iA.js → use-clock-tick-C292qv9P.js} +1 -1
  295. package/dist/client/assets/{use-connect-companion-C_3XBAd5.js → use-connect-companion-BBlyVxmJ.js} +1 -1
  296. package/dist/client/assets/{use-connection-CxkpvOSK.js → use-connection-CuPFUNAB.js} +1 -1
  297. package/dist/client/assets/use-content-sync-BVOurTxw.js +1 -0
  298. package/dist/client/assets/{use-copy-CG9UgrVq.js → use-copy-qbqELrsr.js} +1 -1
  299. package/dist/client/assets/{use-create-virtual-mcp-q0hdVqnC.js → use-create-virtual-mcp-_LSHJTRf.js} +1 -1
  300. package/dist/client/assets/{use-date-fns-locale-K9LPWyZ4.js → use-date-fns-locale-yLQ-TMcV.js} +1 -1
  301. package/dist/client/assets/{use-debounced-autosave-CnS4HqJg.js → use-debounced-autosave-DIicIxua.js} +1 -1
  302. package/dist/client/assets/{use-debounced-value-BvQkjiEp.js → use-debounced-value-qDOtci8p.js} +1 -1
  303. package/dist/client/assets/{use-deco-credits-CiBA1j3q.js → use-deco-credits-CZiBpI1Z.js} +1 -1
  304. package/dist/client/assets/{use-decopilot-events-CKkpfC9u.js → use-decopilot-events-DUuvv1Wb.js} +1 -1
  305. package/dist/client/assets/{use-delete-connection-CeRm9JkZ.js → use-delete-connection-lH4ywwII.js} +1 -1
  306. package/dist/client/assets/{use-deployment-admin-DEWW82RL.js → use-deployment-admin-D-bNxF3-.js} +1 -1
  307. package/dist/client/assets/{use-ensure-project-folder-oIa3kJmD.js → use-ensure-project-folder-9wv1x2P7.js} +1 -1
  308. package/dist/client/assets/{use-fast-preview-draft-url-C5DoEojx.js → use-fast-preview-draft-url-Cf64Rv8-.js} +1 -1
  309. package/dist/client/assets/{use-file-configs-DtML887y.js → use-file-configs-C2gZQhnt.js} +1 -1
  310. package/dist/client/assets/{use-infinite-scroll-C7WJc185.js → use-infinite-scroll-BopOdy-8.js} +1 -1
  311. package/dist/client/assets/{use-join-requests-HcTpy17R.js → use-join-requests-DpN6c_QU.js} +1 -1
  312. package/dist/client/assets/{use-main-panel-tabs-DaDhJKK0.js → use-main-panel-tabs-DNEl-cqG.js} +1 -1
  313. package/dist/client/assets/{use-mcp-auth-status-BJnGMUes.js → use-mcp-auth-status-6tcyVYNh.js} +1 -1
  314. package/dist/client/assets/{use-mcp-client-dq6ZHYKa.js → use-mcp-client-DMsSTA8g.js} +1 -1
  315. package/dist/client/assets/{use-mcp-prompts-U8IanBaN.js → use-mcp-prompts-ffN2Lmsy.js} +1 -1
  316. package/dist/client/assets/{use-mcp-tools-oQbYU8bf.js → use-mcp-tools-D3I_Pb2L.js} +1 -1
  317. package/dist/client/assets/{use-members-nS--Jb3J.js → use-members-rkoWXTCD.js} +1 -1
  318. package/dist/client/assets/{use-mobile-Dchzsgrl.js → use-mobile-DKjyaKEb.js} +1 -1
  319. package/dist/client/assets/{use-navigate-to-agent-CCmZPom4.js → use-navigate-to-agent-7KiT7YFW.js} +1 -1
  320. package/dist/client/assets/{use-open-billing-url-CmAAUi88.js → use-open-billing-url-CQyUaSGw.js} +1 -1
  321. package/dist/client/assets/{use-org-auth-client-BV-99AzQ.js → use-org-auth-client-qG9llE_H.js} +1 -1
  322. package/dist/client/assets/{use-org-fs-C6PMtaVD.js → use-org-fs-CNn8RNRH.js} +1 -1
  323. package/dist/client/assets/{use-org-repo-syncs-CF3ztKJh.js → use-org-repo-syncs-1RenD2IQ.js} +1 -1
  324. package/dist/client/assets/{use-org-sso-B0RTHGdW.js → use-org-sso-4foNymAx.js} +1 -1
  325. package/dist/client/assets/{use-organization-roles-aR5DwibA.js → use-organization-roles-DLlzvYsI.js} +1 -1
  326. package/dist/client/assets/{use-organization-settings-ClryD4Tz.js → use-organization-settings-wCfTRg-2.js} +1 -1
  327. package/dist/client/assets/{use-panel-navigate-BWVfSYSA.js → use-panel-navigate-D3SkcGQU.js} +1 -1
  328. package/dist/client/assets/{use-project-native-view-presence-BbquxO36.js → use-project-native-view-presence-U-43iX-0.js} +1 -1
  329. package/dist/client/assets/{use-project-scope-0YD7Iyyr.js → use-project-scope-0lcDsf5q.js} +1 -1
  330. package/dist/client/assets/{use-recent-apps-BrEq5yj7.js → use-recent-apps-CeogN5I3.js} +1 -1
  331. package/dist/client/assets/{use-releases-B_cwVxMv.js → use-releases-BVSY46bk.js} +1 -1
  332. package/dist/client/assets/{use-reports-diagnostic-hozbefRw.js → use-reports-diagnostic-fels6eVh.js} +1 -1
  333. package/dist/client/assets/{use-secrets-DxFdhVup.js → use-secrets-DYpJRFbR.js} +1 -1
  334. package/dist/client/assets/{use-section-preview-base-B-qW8soa.js → use-section-preview-base-aG0bF3P5.js} +1 -1
  335. package/dist/client/assets/{use-tags-Bh7-4eYV.js → use-tags-Dd8HUmnm.js} +1 -1
  336. package/dist/client/assets/{use-task-board-analytics-DEcMU_Uq.js → use-task-board-analytics-CzQbHODb.js} +1 -1
  337. package/dist/client/assets/{use-task-board-events-IdeSpBWq.js → use-task-board-events-CYiz72_p.js} +1 -1
  338. package/dist/client/assets/{use-task-board-item-prs-7lDD4r45.js → use-task-board-item-prs-jQcO6g6_.js} +1 -1
  339. package/dist/client/assets/{use-task-board-items-DLL3oK5h.js → use-task-board-items-IIN4BPM7.js} +1 -1
  340. package/dist/client/assets/{use-task-metadata-4a2jZXOn.js → use-task-metadata-jn6CC5eM.js} +1 -1
  341. package/dist/client/assets/{use-thread-analytics-C1nRJ4EI.js → use-thread-analytics-DLLZJmgg.js} +1 -1
  342. package/dist/client/assets/{use-thread-outputs-C13KsPaH.js → use-thread-outputs-CPZ7dzCd.js} +1 -1
  343. package/dist/client/assets/useInfiniteQuery-H7SIgIJk.js +1 -0
  344. package/dist/client/assets/{useQueries-DNFMK_6M.js → useQueries-BWjYSwuK.js} +1 -1
  345. package/dist/client/assets/useSuspenseInfiniteQuery-DU-0dJfJ.js +1 -0
  346. package/dist/client/assets/{users-KlA2DUFu.js → users-BurVROAI.js} +1 -1
  347. package/dist/client/assets/{utils-B6dBwzj-.js → utils-2VqdkNDi.js} +1 -1
  348. package/dist/client/assets/variant-calendar-DZ3_8ynX.js +1 -0
  349. package/dist/client/assets/{variant-draft-pointer-BmoZUVqO.js → variant-draft-pointer-DM4gBa71.js} +1 -1
  350. package/dist/client/assets/{view-mode-toggle-xYGlwauP.js → view-mode-toggle-C-WM4OcL.js} +1 -1
  351. package/dist/client/assets/{virtual-mcp-Dhi5oDvB.js → virtual-mcp-BnS4EEBx.js} +1 -1
  352. package/dist/client/assets/{watch-sse-pool-DtrLPzBE.js → watch-sse-pool-lmapFB_N.js} +1 -1
  353. package/dist/client/index.html +1 -1
  354. package/dist/server/server.js +463 -463
  355. package/package.json +1 -1
  356. package/dist/client/assets/agent-app-zAU3Co2r.js +0 -1
  357. package/dist/client/assets/agent-deck-DdU9L82R.js +0 -1
  358. package/dist/client/assets/agent-library-BR00hcFP.js +0 -1
  359. package/dist/client/assets/agent-library-file-CUexFajI.js +0 -1
  360. package/dist/client/assets/agent-releases-DYvRn0eB.js +0 -2
  361. package/dist/client/assets/agent-settings-DDyY7MbQ.js +0 -1
  362. package/dist/client/assets/agent-site-editor-code-Lw7w3f8Y.js +0 -2
  363. package/dist/client/assets/agent-site-editor-content-Dg7hjpdV.js +0 -1
  364. package/dist/client/assets/agent-site-editor-preview-BHjasf53.js +0 -1
  365. package/dist/client/assets/agent-view-EDL__-N0.js +0 -1
  366. package/dist/client/assets/api-keys-aEwnAq3H.js +0 -1
  367. package/dist/client/assets/app-editor-U-4iefn4.js +0 -1
  368. package/dist/client/assets/category-editor--faU6WfH.js +0 -1
  369. package/dist/client/assets/cms-settings-editor-Dwz8Stp_.js +0 -1
  370. package/dist/client/assets/content-tab-uMsNTE0j.js +0 -8
  371. package/dist/client/assets/context-CJfdLxip.js +0 -1
  372. package/dist/client/assets/flat-project-PEQru-sb.js +0 -1
  373. package/dist/client/assets/hosted-publish-feedback-BZI_hNNY.js +0 -1
  374. package/dist/client/assets/library-CmuzUleE.js +0 -1
  375. package/dist/client/assets/post-calendar-DV4-vSzZ.js +0 -1
  376. package/dist/client/assets/project-reports-CHzFGKyp.js +0 -1
  377. package/dist/client/assets/project-tasks-CqQT2RhG.js +0 -1
  378. package/dist/client/assets/record-editor-16UYlnOr.js +0 -1
  379. package/dist/client/assets/redirect-editor-BhRvTbDn.js +0 -1
  380. package/dist/client/assets/reports-DT0c0wfO.js +0 -1
  381. package/dist/client/assets/route-CCUEaB5L.js +0 -1
  382. package/dist/client/assets/site-editor-BARGvRbI.js +0 -1
  383. package/dist/client/assets/site-editor-toast-Gyi24WTd.js +0 -1
  384. package/dist/client/assets/taskboard-analytics-CAY7J6r5.js +0 -1
  385. package/dist/client/assets/tasks-DkLS_xbK.js +0 -1
  386. package/dist/client/assets/useInfiniteQuery-DvCuWsJ6.js +0 -1
  387. package/dist/client/assets/useSuspenseInfiniteQuery-7ax8yx2o.js +0 -1
  388. package/dist/client/assets/variant-calendar-CLyD8A12.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 qi,K as yo,m as Wi,o as Gi,h as Ui,t as oe}from"./index-D8ycvvq3.js";import{u as Yi}from"./chat-context-Dn145aEn.js";import{a5 as Ji,T as qn,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 qr,M as ba,aA as Wr,a as ja,aB as Sn,aC as wa,aD as _a,aE as bn,aF as ds}from"./blocks-tab-states-DWDFGWKG.js";import{c as ka}from"./repository-binding-qFnOG9Kf.js";import{n as Ea,t as Ra}from"./ChevronUp-iwpcZ6ZJ.js";import{a8 as bo,b as zn,an as Aa,D as Ca,a1 as Gr,L as Ur}from"./agent-icon-7ADgtWCH.js";import{S as rn}from"./scroll-area-tjZ1v8uh.js";import{c as kt,T as Et,a as Rt}from"./tooltip-DTDDImYK.js";import{al as Na,g as Yr,J as Ta,u as Va,K as Da,w as Ma,aa as Pa,x as Ia,d as Pt,f as It,a6 as Ba,aq as Ka}from"./site-editor-toast-Gyi24WTd.js";import{m as Fa,u as Oa,P as La}from"./mustache-DF__kc82.js";import{ay as $a,k as Rs,aA as jo,H as za,aB as xt,aC as vs,aD as wo,aj as Gt,a8 as xs,aE as ys,ak as Kt,a9 as on,q as Ha,t as qa,g as Wa,x as Kn,ar as Ga,ai as jn,aa as fs,ah as Bt,ag as wn,aF as Ua,P as Ya,aG as Ja,al as Jr,a1 as Qr,aH as Qa,aI as Wt,aJ as Xa,aK as Za,aL as el,aM as Xr,aN as tl,aO as nl,aP as sl,af as rl,aQ as ol,aR as il,aS as al,aT as ll,ae as cl,aU as ul}from"./secret-ciphertext-BAOlyGdC.js";import{a as dl}from"./Copy01-C5MyX131.js";import{a as Ss,e as _o}from"./UserSquare-C0oVj3jP.js";import{i as Zr}from"./Tool01-CtZDIoke.js";import{s as eo}from"./Image01-BmWIcz9g.js";import{s as fl}from"./Plus-D-0eKLeG.js";import{s as ml}from"./Trash01-DXu_ke97.js";import{i as bs}from"./ZoomOut-Cg2E6Hn7.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-BWusCVk-.js";import{u as bl,s as jl,a as Ln,S as wl,v as _l}from"./sortable.esm-DR9w0kC7.js";import{s as kl,g as El,u as Rl,A as Al}from"./use-section-preview-base-B-qW8soa.js";import{A as ms}from"./avatar-D7EA7cl6.js";import{e as Cl,d as no,b as Nl,A as Tl,a as Vl,f as Dl}from"./alert-dialog-_s7hqvJ_.js";import{b as Ml}from"./format-time-CAj8AQXM.js";import{d as Pl}from"./shell-layout-C8-H8Sys.js";import{u as Il}from"./use-members-nS--Jb3J.js";import{a as Bl,P as so,b as Kl}from"./page-seo-form-C47J61Bn.js";import{c as ro,d as oo,e as Fl,f as Ol}from"./variant-draft-pointer-BmoZUVqO.js";import"./use-panel-navigate-BWVfSYSA.js";import"./thread-route-BD60Whh-.js";import"./use-project-scope-0YD7Iyyr.js";import"./autosend-D3NSq3DM.js";import"./thread-intent-4EhNPevS.js";import"./use-mcp-client-dq6ZHYKa.js";import"./auth-B_TJXS0n.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./watch-sse-pool-DtrLPzBE.js";import"./task-board-Cfi5K-5Q.js";import"./schema-pZcdx7db.js";import"./slugify-CEUa2lfQ.js";import"./use-decopilot-events-CKkpfC9u.js";import"./use-ai-providers-Ba6tq6Kh.js";import"./use-chat-navigation-qWQesS8S.js";import"./location-BjlyegC2.js";import"./use-organization-settings-ClryD4Tz.js";import"./input-CNWKZHOn.js";import"./usage-stats-CPLYge0E.js";import"./tool-namespace-B7nVIU6I.js";import"./form-DmfVlpti.js";import"./label-Des1dBAA.js";import"./utils-CVEq3hMx.js";import"./markdown-Cy5TyQD8.js";import"./use-copy-CG9UgrVq.js";import"./use-mobile-Dchzsgrl.js";import"./XClose-DFzCGpgs.js";import"./icon-button-gjWtlNIn.js";import"./file-type-icon-C3Wvkdfs.js";import"./chat-draft-B11vfGsb.js";import"./LinkBroken01-CTkWPKKA.js";import"./ArrowUp-CtyeX35T.js";import"./ShoppingBag01-_i_0EGH-.js";import"./Upload01-Cuxcfzt0.js";import"./AlertCircle-Dyzt7ROa.js";import"./select-CsN8wWwy.js";import"./index-BdQq_4o_.js";import"./index-B6Pl30Jv.js";import"./ArrowLeft-CSHSzn3p.js";import"./tabs-DpA6UCpp.js";import"./use-deco-credits-CiBA1j3q.js";import"./toggle-group-CehyBfy_.js";import"./use-open-billing-url-CmAAUi88.js";import"./index-CuAR9UE_.js";import"./checkbox-DEL-ITP4.js";import"./ChevronSelectorVertical-CLfFYLAx.js";import"./Key01-flR1Rk0k.js";import"./SearchMd-BZnFITM5.js";import"./ai-providers-logos-DD3qZ33J.js";import"./Monitor01-C_fHpJXT.js";import"./popover-B5_Kaf1b.js";import"./drawer-Pd2bkZwX.js";import"./input-DrsB_G6y.js";import"./suggestion-DD-4qLns.js";import"./use-project-native-view-presence-BbquxO36.js";import"./use-file-configs-DtML887y.js";import"./site-slug-DebpOoQq.js";import"./use-mcp-prompts-U8IanBaN.js";import"./use-org-fs-C6PMtaVD.js";import"./useInfiniteQuery-DvCuWsJ6.js";import"./infiniteQueryObserver-DgfIuRy-.js";import"./Link01-NVZrbJ2z.js";import"./question-004-sINsf4GQ.js";import"./feature-paywall-BUvad-6w.js";import"./plan-ladder-i59Z6bnV.js";import"./add-connection-dialog-wdvNwZIH.js";import"./collection-search-BtAaADUJ.js";import"./extract-connection-data-47aQZG-0.js";import"./metadata-D72DunRR.js";import"./connection-Bm1YN2Qv.js";import"./url-slug-CvdbhkuL.js";import"./connection-card-VZyTjeL7.js";import"./connection-slug-CITJ0kGN.js";import"./integration-icon-Ch0O_HoU.js";import"./textarea-CilvBHk6.js";import"./use-connection-CxkpvOSK.js";import"./schema-CB0y_kWu.js";import"./connection-form-helpers-B8gc-NIa.js";import"./authenticate-and-persist-oauth-UdSc08ls.js";import"./mcp-oauth-CEdQ8awJ.js";import"./mcp-oauth-C7679P97.js";import"./collection-tabs-BPMM9JU6.js";import"./badge-C0x7-j94.js";import"./use-infinite-scroll-C7WJc185.js";import"./useSuspenseInfiniteQuery-7ax8yx2o.js";import"./use-task-board-events-IdeSpBWq.js";import"./utils-B6dBwzj-.js";import"./Play-CYHvnoi_.js";import"./sandbox-start-errors-BK_aDCyt.js";import"./pair-B9FUGmMH.js";import"./collapsible-2qINC-s6.js";import"./use-clock-tick-Df5id_iA.js";import"./content-blocks-o63cs2vh.js";import"./mcp-app-renderer-DYh0AbHr.js";import"./types-BRbHCiMu.js";import"./omit-sandbox-map-jj4lCB2U.js";import"./sheet-C8W18YeS.js";import"./use-navigate-to-agent-CCmZPom4.js";import"./use-thread-outputs-C13KsPaH.js";import"./switch-Dw8QMOfK.js";import"./command-fxFZFBik.js";import"./index-C1k6bl66.js";import"./monaco-editor-BOWGtFnb.js";import"./editor-fmwfQ_5F.js";import"./calendar-DppMF-oc.js";import"./SwitchHorizontal01-I9orqnhT.js";import"./editor-classes-N-pDaC7c.js";import"./view-mode-toggle-xYGlwauP.js";import"./combobox-B-I_TDnB.js";import"./DotsVertical-t_p3uDnk.js";import"./search-input-iNzELQG5.js";import"./use-debounced-value-BvQkjiEp.js";import"./asset-utils-gDGUDBoj.js";import"./sandbox-git-api-CRxdlhrN.js";import"./sandbox-url-D3mC8qhT.js";import"./empty-state-BSt_DXl_.js";import"./Building02-DHk48jC7.js";import"./CheckCircle-COGqVxnk.js";import"./CreditCard01-DbksZbCa.js";import"./Globe04-CEKxgW4I.js";import"./Sun-g_4y19bS.js";import"./User01-CpQvYpgF.js";import"./Users01-BOA9J6qJ.js";import"./index-Kv7T-lWA.js";import"./alert-BVmkZ-E2.js";import"./section-preview-url-7zfngvgW.js";import"./differenceInSeconds-C3x8sHUj.js";import"./project-icon-DDejaJkU.js";import"./new-project-dialog-D7zn8TAV.js";import"./repository-import-picker-XvHhr-YM.js";import"./repository-picker-CDMQ-67j.js";import"./required-auth-layout-BJdpNUyb.js";import"./use-org-sso-B0RTHGdW.js";import"./use-org-auth-client-BV-99AzQ.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 ql="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 Wl(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=qn(),v=s.isSavedBlock===!0,m=s.isMultivariate===!0;let j;e[0]!==a||e[1]!==o?(j=o&&a?El(o,a):void 0,e[0]=a,e[1]=o,e[2]=j):j=e[2];const A=j;let $;e[3]!==a||e[4]!==m||e[5]!==o||e[6]!==v?($=o&&a&&!v&&!m?zl(o,a):void 0,e[3]=a,e[4]=m,e[5]=o,e[6]=v,e[7]=$):$=e[7];const z=$;let H;e[8]!==u||e[9]!==a||e[10]!==o||e[11]!==s?(H=na(o,s,u,a),e[8]=u,e[9]=a,e[10]=o,e[11]=s,e[12]=H):H=e[12];const F=H;let f;e[13]!==m||e[14]!==o?.__resolveType?(f=!m&&Rs(o?.__resolveType??""),e[13]=m,e[14]=o?.__resolveType,e[15]=f):f=e[15];const k=f,X=v?zn:m?bo:_o;let w;e[16]!==m||e[17]!==v?(w=v?{color:za}:m?{color:"oklch(0.65 0.15 160)"}:void 0,e[16]=m,e[17]=v,e[18]=w):w=e[18];const I=w;let V;e[19]!==X||e[20]!==d?(V=d?i.jsxs("span",{className:"relative size-4 shrink-0",children:[i.jsx(X,{className:"absolute inset-0 size-4 text-muted-foreground transition-opacity group-hover:opacity-0 group-has-[:focus-visible]:opacity-0"}),i.jsx(ra,{"aria-hidden":!0,className:"absolute inset-0 size-4 opacity-0 transition-opacity group-hover:opacity-100 group-has-[:focus-visible]:opacity-100"})]}):i.jsx(Aa,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[19]=X,e[20]=d,e[21]=V):V=e[21];let y;e[22]!==A?(y=A&&i.jsx("img",{src:A,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded-[var(--studio-control-radius,var(--radius))] object-cover"}),e[22]=A,e[23]=y):y=e[23];let C;e[24]!==d||e[25]!==I?(C=!d&&i.jsx(Ss,{className:"h-4 w-4 shrink-0",style:I}),e[24]=d,e[25]=I,e[26]=C):C=e[26];const x=d?"shrink":"flex-1",Y=s.isHidden&&"line-through opacity-50";let M;e[27]!==Y||e[28]!==x?(M=ae("min-w-0 truncate text-sm font-medium",x,Y),e[27]=Y,e[28]=x,e[29]=M):M=e[29];const ge=z??s.label;let me;e[30]!==M||e[31]!==ge?(me=i.jsx("span",{className:M,children:ge}),e[30]=M,e[31]=ge,e[32]=me):me=e[32];let le;e[33]!==k||e[34]!==d||e[35]!==F||e[36]!==h?(le=d?i.jsxs(i.Fragment,{children:[k&&i.jsx(Hl,{icon:bs,label:h("sectionsEditor.sectionList.asyncBadge"),className:"text-muted-foreground"}),F&&i.jsx(Br,{}),i.jsx("span",{className:"min-w-0 flex-1"})]}):F&&i.jsx(Br,{className:"absolute -right-0.5 -top-0.5"}),e[33]=k,e[34]=d,e[35]=F,e[36]=h,e[37]=le):le=e[37];let ee;return e[38]!==me||e[39]!==le||e[40]!==V||e[41]!==y||e[42]!==C?(ee=i.jsxs(i.Fragment,{children:[V,y,C,me,le]}),e[38]=me,e[39]=le,e[40]=V,e[41]=y,e[42]=C,e[43]=ee):ee=e[43],ee}const Gl="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",Ul="text-[oklch(0.45_0.15_160)] hover:bg-[oklch(0.65_0.15_160/0.12)] dark:text-[oklch(0.78_0.15_160)] dark:hover:bg-[oklch(0.65_0.15_160/0.15)]";function Ro(n,e,s){if(s)return sa({selected:e});const o=n.isSavedBlock===!0,a=n.isMultivariate===!0;return ae("group relative flex select-none items-center gap-2 rounded-[var(--studio-control-radius,var(--radius-md))] px-2 py-2.5",e?"bg-accent text-accent-foreground":o?Gl:a?Ul:"text-foreground/80 hover:bg-accent hover:text-accent-foreground")}function ps(n,e){return ae("h-7 shrink-0 overflow-hidden",e?"w-7 ml-0 opacity-100 [transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]":n?"w-7 ml-0 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:opacity-100 group-has-[:focus-visible]:opacity-100":"w-0 -ml-2 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:ml-0 group-hover:w-7 group-hover:opacity-100 group-hover:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms] group-has-[:focus-visible]:ml-0 group-has-[:focus-visible]:w-7 group-has-[:focus-visible]:opacity-100 group-has-[:focus-visible]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]")}function Yl(n){const e=it.c(90),{section:s,raw:o,meta:a,decofile:u,sortableId:h,selected:d,onSelect:v,onDelete:m,onDuplicate:j,onMakeReusable:A,onToggleHidden:$,onToggleLazy:z,onAddVariant:H,onDetach:F}=n,f=Ft(),k=qn(),X=o?Rs(o.__resolveType??""):!1,w=s.isHidden===!0,I=X||w;let V;e[0]!==s?(V=jo(s),e[0]=s,e[1]=V):V=e[1];const y=V,C=!!z&&!s.isMultivariate;let x;e[2]!==h?(x={id:h,animateLayoutChanges:Xl},e[2]=h,e[3]=x):x=e[3];const{attributes:Y,listeners:M,setNodeRef:ge,transform:me,isDragging:le}=bl(x);let ee;e[4]!==me?(ee=xl.Transform.toString(me?{...me,x:0}:null),e[4]=me,e[5]=ee):ee=e[5];const pe=le?0:void 0;let ce;e[6]!==ee||e[7]!==pe?(ce={transform:ee,opacity:pe},e[6]=ee,e[7]=pe,e[8]=ce):ce=e[8];const he=ce;let ve;e[9]!==s?(ve=Xi(s),e[9]=s,e[10]=ve):ve=e[10];const b=ve,B="button",xe=0;let T;e[11]!==v?(T=re=>{(re.key==="Enter"||re.key===" ")&&(re.preventDefault(),v())},e[11]=v,e[12]=T):T=e[12];const ye=le?"cursor-grabbing":"cursor-pointer";let K;e[13]!==k||e[14]!==s||e[15]!==d||e[16]!==ye?(K=ae("touch-none transition-colors",ye,Ro(s,d,k)),e[13]=k,e[14]=s,e[15]=d,e[16]=ye,e[17]=K):K=e[17];let Se;e[18]!==u||e[19]!==a||e[20]!==o||e[21]!==s?(Se=i.jsx(Eo,{section:s,raw:o,meta:a,decofile:u}),e[18]=u,e[19]=a,e[20]=o,e[21]=s,e[22]=Se):Se=e[22];const ue=!k&&C&&i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"ghost",size:"icon","aria-label":f(X?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender"),className:ae(ps(I,X)),onClick:re=>{re.stopPropagation(),z?.()},onPointerDown:Ql,children:i.jsx(bs,{className:ae("h-3.5 w-3.5",X&&"text-warning")})})}),i.jsx(Rt,{side:"bottom",children:f(X?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")})]}),te=k?i.jsx(Zi,{label:f(w?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),active:w,onToggle:$,children:w?i.jsx(Zr,{className:"h-3.5 w-3.5"}):i.jsx(eo,{className:"h-3.5 w-3.5"})}):i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"ghost",size:"icon","aria-label":f(w?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),className:ae(ps(I,w)),onClick:re=>{re.stopPropagation(),$()},onPointerDown:Jl,children:w?i.jsx(Zr,{className:"h-3.5 w-3.5"}):i.jsx(eo,{className:"h-3.5 w-3.5"})})}),i.jsx(Rt,{side:"bottom",children:f(w?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection")})]}),se=zi,Te=ea;let Z;e[23]!==f?(Z=f("sectionsEditor.sectionList.sectionActionsMenu"),e[23]=f,e[24]=Z):Z=e[24];const _e=ae(ps(I,!1),"data-[state=open]:ml-0 data-[state=open]:w-7 data-[state=open]:opacity-100 data-[state=open]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]");let be;e[25]!==Te||e[26]!==Z||e[27]!==_e?(be=i.jsx(Te,{label:Z,classicClassName:_e}),e[25]=Te,e[26]=Z,e[27]=_e,e[28]=be):be=e[28];let W;e[29]!==k||e[30]!==C||e[31]!==X||e[32]!==z||e[33]!==f?(W=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]=W):W=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&&ql),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 qe;e[61]===Symbol.for("react.memo_cache_sentinel")?(qe=i.jsx(ml,{className:"h-4 w-4"}),e[61]=qe):qe=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:[qe,Ee]}),e[64]=He,e[65]=Ee,e[66]=Ie):Ie=e[66];let Ve;e[67]!==W||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:[W,Xe,Ye,Q,ke,Ie]}),e[67]=W,e[68]=Xe,e[69]=Ye,e[70]=Q,e[71]=ke,e[72]=Ie,e[73]=Ve):Ve=e[73];let Ze;e[74]!==se||e[75]!==be||e[76]!==Ve?(Ze=i.jsxs(se,{children:[be,Ve]}),e[74]=se,e[75]=be,e[76]=Ve,e[77]=Ze):Ze=e[77];let Fe;return e[78]!==Y||e[79]!==M||e[80]!==v||e[81]!==ge||e[82]!==he||e[83]!==K||e[84]!==Se||e[85]!==ue||e[86]!==te||e[87]!==Ze||e[88]!==T?(Fe=i.jsxs("div",{ref:ge,style:he,...Y,...M,role:B,tabIndex:xe,onClick:v,onKeyDown:T,className:K,children:[Se,ue,te,Ze]}),e[78]=Y,e[79]=M,e[80]=v,e[81]=ge,e[82]=he,e[83]=K,e[84]=Se,e[85]=ue,e[86]=te,e[87]=Ze,e[88]=T,e[89]=Fe):Fe=e[89],Fe}function Jl(n){return n.stopPropagation()}function Ql(n){return n.stopPropagation()}function Xl(){return!1}function js(n){const e=it.c(11),{canAddSection:s,onAddSection:o,className:a,size:u}=n,h=Ft();let d;e[0]!==a?(d=ae("w-full",a),e[0]=a,e[1]=d):d=e[1];const v=!s;let m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=i.jsx(fl,{size:14}),e[2]=m):m=e[2];let j;e[3]!==h?(j=h("sectionsEditor.sectionList.addSectionButton"),e[3]=h,e[4]=j):j=e[4];let A;return e[5]!==o||e[6]!==u||e[7]!==d||e[8]!==v||e[9]!==j?(A=i.jsxs(_t,{type:"button",variant:"outline",size:u,className:d,disabled:v,onClick:o,children:[m,j]}),e[5]=o,e[6]=u,e[7]=d,e[8]=v,e[9]=j,e[10]=A):A=e[10],A}function Zl(n){const e=it.c(101),{listKey:s,rawSections:o,sections:a,meta:u,decofile:h,selectedIndex:d,onSelect:v,onReorder:m,onDelete:j,onDuplicate:A,onMakeReusable:$,onToggleHidden:z,onToggleLazy:H,onAddVariant:F,onDetach:f,onAddSection:k,canAddSection:X}=n,w=X===void 0?!0:X,I=Ft(),V=qn();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=>Wl(dt,a.length)));let ce;e[2]===Symbol.for("react.memo_cache_sentinel")?(ce={activationConstraint:{distance:8}},e[2]=ce):ce=e[2];let he;e[3]===Symbol.for("react.memo_cache_sentinel")?(he={coordinateGetter:jl},e[3]=he):he=e[3];const ve=pl(to(gl,ce),to(hl,he));let b;e[4]!==C?(b=C.map(ec),e[4]=C,e[5]=b):b=e[5];const B=b;let xe;e[6]===Symbol.for("react.memo_cache_sentinel")?(xe=dt=>{M(String(dt.active.id))},e[6]=xe):xe=e[6];const T=xe;let ye;e[7]!==B||e[8]!==m?(ye=dt=>{M(null);const{active:ne,over:De}=dt;if(!De||ne.id===De.id)return;const yt=B.indexOf(String(ne.id)),et=B.indexOf(String(De.id));yt===-1||et===-1||(x(ft=>ko(Ln([...ft],yt,et))),pe.current=!0,requestAnimationFrame(()=>{pe.current=!1}),m?.(yt,et))},e[7]=B,e[8]=m,e[9]=ye):ye=e[9];const K=ye;let Se;e[10]===Symbol.for("react.memo_cache_sentinel")?(Se=()=>{M(null)},e[10]=Se):Se=e[10];const ue=Se;let te,se,Te,Z,_e,be,W,O,Ke,Qe,Xe,Ye,Q,ke,He;if(e[11]!==Y||e[12]!==w||e[13]!==V||e[14]!==h||e[15]!==C||e[16]!==B||e[17]!==K||e[18]!==u||e[19]!==k||e[20]!==F||e[21]!==j||e[22]!==f||e[23]!==A||e[24]!==$||e[25]!==v||e[26]!==z||e[27]!==H||e[28]!==o||e[29]!==a||e[30]!==d||e[31]!==ve||e[32]!==I){ke=Symbol.for("react.early_return_sentinel");e:{const dt=ne=>{pe.current||v(ne)};if(e[48]!==Y||e[49]!==w||e[50]!==V||e[51]!==C||e[52]!==k||e[53]!==o||e[54]!==a||e[55]!==I){const ne=Y?C.find(De=>De.id===Y):null;if(Z=ne!=null?a[ne.index]:null,Te=ne!=null?o[ne.index]:void 0,C.length===0){let De;e[59]!==I?(De=I("sectionsEditor.sectionList.noSections"),e[59]=I,e[60]=De):De=e[60];let yt;e[61]!==De?(yt=i.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:De}),e[61]=De,e[62]=yt):yt=e[62];const et=yt;let ft;e[63]!==w||e[64]!==V||e[65]!==et||e[66]!==k?(ft=V?et:i.jsxs("div",{className:"space-y-2",children:[et,i.jsx(js,{canAddSection:w,onAddSection:k,size:"sm"})]}),e[63]=w,e[64]=V,e[65]=et,e[66]=k,e[67]=ft):ft=e[67],ke=ft;break e}Q=ae(ne&&"cursor-grabbing"),e[48]=Y,e[49]=w,e[50]=V,e[51]=C,e[52]=k,e[53]=o,e[54]=a,e[55]=I,e[56]=Te,e[57]=Z,e[58]=Q}else Te=e[56],Z=e[57],Q=e[58];se=yl,O=ve,Ke=Sl,Qe=T,Xe=K,Ye=ue,te=wl,be=B,W=_l,He="space-y-1",_e=C.map(ne=>{const De=a[ne.index];return De?i.jsx(Yl,{sortableId:ne.id,section:De,raw:o[ne.index],meta:u,decofile:h,selected:d===ne.index,onSelect:()=>dt(ne.index),onDelete:()=>j(ne.index),onDuplicate:()=>A(ne.index),onMakeReusable:()=>$(ne.index),onToggleHidden:()=>z(ne.index),onToggleLazy:H?()=>H(ne.index):void 0,onAddVariant:()=>F(ne.index),onDetach:()=>f(ne.index)},ne.id):null})}e[11]=Y,e[12]=w,e[13]=V,e[14]=h,e[15]=C,e[16]=B,e[17]=K,e[18]=u,e[19]=k,e[20]=F,e[21]=j,e[22]=f,e[23]=A,e[24]=$,e[25]=v,e[26]=z,e[27]=H,e[28]=o,e[29]=a,e[30]=d,e[31]=ve,e[32]=I,e[33]=te,e[34]=se,e[35]=Te,e[36]=Z,e[37]=_e,e[38]=be,e[39]=W,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],W=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 qe;e[68]!==_e||e[69]!==He?(qe=i.jsx("div",{className:He,children:_e}),e[68]=_e,e[69]=He,e[70]=qe):qe=e[70];let Ee;e[71]!==te||e[72]!==be||e[73]!==W||e[74]!==qe?(Ee=i.jsx(te,{items:be,strategy:W,children:qe}),e[71]=te,e[72]=be,e[73]=W,e[74]=qe,e[75]=Ee):Ee=e[75];let Ie;e[76]!==Te||e[77]!==Z||e[78]!==V||e[79]!==h||e[80]!==u?(Ie=Z?i.jsx("div",{className:ae("cursor-grabbing shadow-lg ring-1 ring-border/60",Ro(Z,!1,V)),children:i.jsx(Eo,{section:Z,raw:Te,meta:u,decofile:h})}):null,e[76]=Te,e[77]=Z,e[78]=V,e[79]=h,e[80]=u,e[81]=Ie):Ie=e[81];let Ve;e[82]!==Ie?(Ve=Li.createPortal(i.jsx(vl,{dropAnimation:Qi,children:Ie}),document.body),e[82]=Ie,e[83]=Ve):Ve=e[83];let Ze;e[84]!==se||e[85]!==O||e[86]!==Ke||e[87]!==Qe||e[88]!==Xe||e[89]!==Ye||e[90]!==Ee||e[91]!==Ve?(Ze=i.jsxs(se,{sensors:O,collisionDetection:Ke,onDragStart:Qe,onDragEnd:Xe,onDragCancel:Ye,children:[Ee,Ve]}),e[84]=se,e[85]=O,e[86]=Ke,e[87]=Qe,e[88]=Xe,e[89]=Ye,e[90]=Ee,e[91]=Ve,e[92]=Ze):Ze=e[92];let Fe;e[93]!==w||e[94]!==V||e[95]!==k?(Fe=!V&&i.jsx(js,{canAddSection:w,onAddSection:k,size:"sm",className:"mt-2"}),e[93]=w,e[94]=V,e[95]=k,e[96]=Fe):Fe=e[96];let re;return e[97]!==Q||e[98]!==Ze||e[99]!==Fe?(re=i.jsxs("div",{className:Q,children:[Ze,Fe]}),e[97]=Q,e[98]=Ze,e[99]=Fe,e[100]=re):re=e[100],re}function ec(n){return n.id}function hs(n,e,s,o){if(!n||!e)return null;if(!e.isMultivariate)return jt(n,e,o)?.data??null;const a=xt(n,e),u=a?vs(a,wt)[s]:void 0;return u?wo(u.value,o)?.data??null:null}const tc=50;function nc(n,e){n.own.push(ze(e)),n.own.length>tc&&n.own.shift()}function ao(n,e){return n.own.includes(ze(e))}function sc(n,e){const{sectionIndex:s,variantIndex:o,shown:a,next:u,sectionCount:h}=e;return n&&n.sectionIndex===s&&n.variantIndex===o&&n.emitted===a?(n.emitted=u,n):a?{sectionIndex:s,variantIndex:o,base:a,emitted:u,sectionCount:h,own:[ze(a)]}:null}function Ao(n,e){return e!==null&&ze(n)!==ze(e)}function Co(n,e){return n.__resolveType!==e.__resolveType}function rc(n,e,s,o){if(e.length===o)return"here";const a=ze(n),u=e.flatMap((h,d)=>d!==s&&h!==null&&ze(h)===a?[d]:[]);return u.length===1?u[0]:"unknown"}function lo({formBase:n,rebased:e,versionOf:s}){let o=null;return{ifMatch:a=>{o=a,n&&(n.version===void 0||e)&&(n.version=s(a));const u=n?n.version:s(a);return u===void 0?void 0:{[a]:u}},onApplied:a=>{n&&o!==null&&Object.hasOwn(a,o)&&(n.version=a[o])},reloadOnConflict:!0}}function oc({merged:n,tracked:e,current:s,saved:o}){return!!n&&!!e&&s===e&&e.emitted===o}function co(n,e){return!!n&&!!e&&n.contains(e)}function ws(n){const e=[],s=_s("",n.ancestor,n.mine,n.theirs,e);return{...n,merged:s,pointers:e}}function _s(n,e,s,o,a){const u=(h,d)=>ze(h)===ze(d);if(u(s,o)||u(e,o))return s;if(u(e,s))return o;if(gs(s)&&gs(o)){const h=gs(e)?e:{},d={},v=[...Object.keys(s),...Object.keys(o).filter(m=>!(m in s))];for(const m of v){const j=_s(`${n}/${m.replaceAll("~","~0").replaceAll("/","~1")}`,h[m],s[m],o[m],a);j!==void 0&&(d[m]=j)}return d}return Array.isArray(e)&&Array.isArray(s)&&Array.isArray(o)&&s.length===e.length&&o.length===e.length?e.map((h,d)=>_s(`${n}/${d}`,h,s[d],o[d],a)):(a.push(n),o)}function gs(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}function ic(n,e){let s=n.merged;for(const o of n.pointers)e[o]==="mine"&&(s=uc(s,o,Ut(n.mine,o)));return s}function ac(n,e){return Object.fromEntries(n.pointers.map(s=>[s,e]))}function No(n){return ac(n,"mine")}function ks(n,e,s){const o=No(s);for(const a of s.pointers){const u=e[a];if(!u||!n.pointers.includes(a))continue;["mine","theirs"].every(d=>ze(Ut(n[d],a))===ze(Ut(s[d],a)))&&(o[a]=u)}return o}function To(n,e,s={}){const o=e.pointers.filter(a=>!n.pointers.includes(a)||ze(Ut(n.theirs,a))!==ze(Ut(e.theirs,a)));return o.length===0?s:{...s,...Object.fromEntries(o.map(a=>[a,(s[a]??0)+1]))}}function lc(n,e,s){if(!e||Co(n.plan.ancestor,e)||!Ao(n.plan.theirs,e)||s(e))return null;const o=ws({...n.plan,theirs:e});return o.pointers.length===0?null:{plan:o,choices:ks(n.plan,n.choices,o),fresh:To(n.plan,o,n.fresh)}}function cc(n,e){return n.pointers.map(s=>({pointer:s,label:oa(s,e),mine:Ut(n.mine,s),theirs:Ut(n.theirs,s),schema:dc(e??null,s)}))}function As(n){return n.split("/").slice(1).map(e=>e.replaceAll("~1","/").replaceAll("~0","~"))}function Ut(n,e){let s=n;for(const o of As(e))if(Array.isArray(s))s=s[Number(o)];else if(s&&typeof s=="object")s=s[o];else return;return s}function uc(n,e,s){const o=As(e),a=(u,h)=>{if(h===o.length)return s;const d=o[h];if(Array.isArray(u)){const j=[...u];return j[Number(d)]=a(u[Number(d)],h+1),j}const v=u&&typeof u=="object"?{...u}:{},m=a(v[d],h+1);return m===void 0?delete v[d]:v[d]=m,v};return a(n,0)}function dc(n,e){let s=n;for(const o of As(e)){if(!s)return null;s=/^\d+$/.test(o)&&!s.properties?.[o]?s.items:s.properties?.[o]}return s??null}const fc=/\.(png|jpe?g|gif|webp|avif|svg)(\?.*)?$/i,uo=60,mc=3;function Vo(n,e){return e?.format==="image-uri"?!0:n.startsWith("data:image/")||/^(https?:)?\/\//.test(n)&&fc.test(n)}function Es(n,e){if(!(e?.format==="rich-text"||e?.format==="rich-text-inline"||e?.format==="html"||/<\/?[a-z][^>]*>/i.test(n)))return n;const o=n.replace(/<br\s*\/?>/gi,`
1
+ import{c as it,b as Ft,r as R,l as ae,j as i,b4 as Li,B as _t,U as sn,aw as $i,X as zi,V as Hi,a as xo,F as Wi,K as yo,m as qi,o as Gi,h as Ui,t as oe}from"./index-DD3jMnD8.js";import{u as Yi}from"./chat-context-C0Wb4MFf.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-CB59zP3T.js";import{c as ka}from"./repository-binding-CHF_oBGX.js";import{n as Ea,t as Ra}from"./ChevronUp-BFa66EpK.js";import{a8 as bo,b as zn,an as Aa,D as Ca,a1 as Gr,L as Ur}from"./agent-icon-MD5OrAoo.js";import{S as rn}from"./scroll-area-CQBF_dZT.js";import{c as kt,T as Et,a as Rt}from"./tooltip-Czt_UbWN.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-BQVM8xFE.js";import{m as Fa,u as Oa,P as La}from"./mustache-Dayjxewp.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-oiVgkxxG.js";import{a as dl}from"./Copy01-taXYCEBD.js";import{a as Ss,e as _o}from"./UserSquare-Ag2h6fjB.js";import{i as Zr}from"./Tool01-BlSQo18i.js";import{s as eo}from"./Image01-B2cuVR7o.js";import{s as fl}from"./Plus-BLUUzBOk.js";import{s as ml}from"./Trash01-COQdVdde.js";import{i as bs}from"./ZoomOut-BRLVgQbx.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-B0kDFHOB.js";import{u as bl,s as jl,a as Ln,S as wl,v as _l}from"./sortable.esm-fnpMXn9v.js";import{s as kl,g as El,u as Rl,A as Al}from"./use-section-preview-base-aG0bF3P5.js";import{A as ms}from"./avatar-gla6h0ms.js";import{e as Cl,d as no,b as Nl,A as Tl,a as Vl,f as Dl}from"./alert-dialog-Czq8smrs.js";import{b as Ml}from"./format-time-CAj8AQXM.js";import{d as Pl}from"./shell-layout-r2grUF3c.js";import{u as Il}from"./use-members-rkoWXTCD.js";import{a as Bl,P as so,b as Kl}from"./page-seo-form-DEniWcne.js";import{c as ro,d as oo,e as Fl,f as Ol}from"./variant-draft-pointer-DM4gBa71.js";import"./use-panel-navigate-D3SkcGQU.js";import"./thread-route-9ORs8Bvm.js";import"./use-project-scope-0lcDsf5q.js";import"./autosend-DhzpX2qh.js";import"./thread-intent-CDcQO3Gb.js";import"./use-mcp-client-DMsSTA8g.js";import"./auth-DYpVJTi6.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./watch-sse-pool-lmapFB_N.js";import"./task-board-Drym1VGl.js";import"./schema-msyWsNEX.js";import"./slugify-CEUa2lfQ.js";import"./use-decopilot-events-DUuvv1Wb.js";import"./use-ai-providers-Bx12ndn_.js";import"./use-chat-navigation-CObcn40t.js";import"./location-BjlyegC2.js";import"./use-organization-settings-wCfTRg-2.js";import"./input-D-82ZEvn.js";import"./usage-stats-BCJbY9qH.js";import"./tool-namespace-BLZ5kDEc.js";import"./form-BV3E3DRr.js";import"./label-QcEtv8aS.js";import"./utils-CVEq3hMx.js";import"./markdown-CjmuCvzH.js";import"./use-copy-qbqELrsr.js";import"./use-mobile-DKjyaKEb.js";import"./XClose-Bw63kXIL.js";import"./icon-button-pY1Ev_Zs.js";import"./file-type-icon-CwmbBd4_.js";import"./chat-draft-B8EOLWmz.js";import"./LinkBroken01-C5cWFtQq.js";import"./ArrowUp-DpRxn4K3.js";import"./ShoppingBag01-4IcurZUz.js";import"./Upload01-NWVVb23Y.js";import"./AlertCircle-DydWhBUR.js";import"./select-CA6Xf89b.js";import"./index-BdQq_4o_.js";import"./index-D_ppSX5g.js";import"./ArrowLeft-lM5tIj9y.js";import"./tabs-CVRt1gsT.js";import"./use-deco-credits-CZiBpI1Z.js";import"./toggle-group-aS4D4pWB.js";import"./use-open-billing-url-CQyUaSGw.js";import"./index-2W02K1gN.js";import"./checkbox-BrfO0AS7.js";import"./ChevronSelectorVertical-DbaTjzBx.js";import"./Key01-Cyl6HajB.js";import"./SearchMd-B_qlK90t.js";import"./ai-providers-logos-DD3qZ33J.js";import"./Monitor01-Bb5ZlrLS.js";import"./popover-qHcjuSU0.js";import"./drawer-_oUDG6Bh.js";import"./input-DpLyWs62.js";import"./suggestion-vzrmAu6j.js";import"./use-project-native-view-presence-U-43iX-0.js";import"./use-file-configs-C2gZQhnt.js";import"./site-slug-DebpOoQq.js";import"./use-mcp-prompts-ffN2Lmsy.js";import"./use-org-fs-CNn8RNRH.js";import"./useInfiniteQuery-H7SIgIJk.js";import"./infiniteQueryObserver-DN3ugQJJ.js";import"./Link01-DzC6ocz4.js";import"./question-004-sINsf4GQ.js";import"./feature-paywall-DvPrxDxF.js";import"./plan-ladder-CHzPrqgq.js";import"./add-connection-dialog-M4AoaiFN.js";import"./collection-search-BjRRO8AD.js";import"./extract-connection-data-B2cCu4Y0.js";import"./metadata-D72DunRR.js";import"./connection-D2g-M5HU.js";import"./url-slug-SM3_9Cya.js";import"./connection-card-xYydZgZe.js";import"./connection-slug-CITJ0kGN.js";import"./integration-icon-8xJy_m0U.js";import"./textarea-C6sVZPZU.js";import"./use-connection-CuPFUNAB.js";import"./schema-w5h_hx-N.js";import"./connection-form-helpers-Cyf4ui7a.js";import"./authenticate-and-persist-oauth-DirDXL13.js";import"./mcp-oauth-tY0goV8V.js";import"./mcp-oauth-o1bjrgf5.js";import"./collection-tabs-Lz0rqrLq.js";import"./badge-5B6T9ERD.js";import"./use-infinite-scroll-BopOdy-8.js";import"./useSuspenseInfiniteQuery-DU-0dJfJ.js";import"./use-task-board-events-CYiz72_p.js";import"./utils-2VqdkNDi.js";import"./Play-D32AXFrK.js";import"./sandbox-start-errors-BK_aDCyt.js";import"./pair-BXzhmvOK.js";import"./collapsible-B-WgQIIJ.js";import"./use-clock-tick-C292qv9P.js";import"./content-blocks-o63cs2vh.js";import"./mcp-app-renderer-DOTIYm4V.js";import"./types-BxhF8ASs.js";import"./omit-sandbox-map-jj4lCB2U.js";import"./sheet-DpEU8sEu.js";import"./use-navigate-to-agent-7KiT7YFW.js";import"./use-thread-outputs-CPZ7dzCd.js";import"./switch-bAUD40Nw.js";import"./command-BsY8EENg.js";import"./index-DUGwIFiv.js";import"./monaco-editor-D6IVhQre.js";import"./editor-D5lw6JVB.js";import"./calendar-DFOIWN8u.js";import"./SwitchHorizontal01-BjaFUETy.js";import"./editor-classes-CYQ0nby9.js";import"./view-mode-toggle-C-WM4OcL.js";import"./combobox-BpUVYVJv.js";import"./DotsVertical-Cmi5H2jc.js";import"./search-input-hbrzDCe3.js";import"./use-debounced-value-qDOtci8p.js";import"./asset-utils-CQJ9nYXC.js";import"./sandbox-git-api-CRxdlhrN.js";import"./sandbox-url-D3mC8qhT.js";import"./empty-state-ChicBK_6.js";import"./Building02-CCJS0_vK.js";import"./CheckCircle-CwCxlegG.js";import"./CreditCard01-ClQuCnzR.js";import"./Globe04-BuQjDmeg.js";import"./Sun-wFVY28gS.js";import"./User01-1G5fScIG.js";import"./Users01-CTT2kFNN.js";import"./index-CP_lXIID.js";import"./alert-CCN8MTJM.js";import"./section-preview-url-7zfngvgW.js";import"./differenceInSeconds-C3x8sHUj.js";import"./project-icon-voOUfH8Y.js";import"./new-project-dialog-tcOep_vf.js";import"./repository-import-picker-CbW5OIUw.js";import"./repository-picker-z7ZWmH9V.js";import"./required-auth-layout-Brpu-Um7.js";import"./use-org-sso-4foNymAx.js";import"./use-org-auth-client-qG9llE_H.js";const Ll={escape:Ji};function $l(n,e){for(const s of kl(n,e)){const o=typeof s.title=="string"?s.title:void 0;if(o?.includes("{{"))return o}}function zl(n,e){if(!e)return;const s=$a(n);if(s)try{const o=$l(s.resolveType,e);return o&&Fa.render(o,s.data,{},Ll).trim()||void 0}catch{return}}function Hl(n){const e=it.c(13),{icon:s,label:o,className:a}=n;let u;e[0]!==a?(u=ae("size-3.5",a),e[0]=a,e[1]=u):u=e[1];let h;e[2]!==s||e[3]!==u?(h=i.jsx(s,{className:u}),e[2]=s,e[3]=u,e[4]=h):h=e[4];let d;e[5]!==o||e[6]!==h?(d=i.jsx(Et,{asChild:!0,children:i.jsx("span",{role:"img","aria-label":o,className:"shrink-0 cursor-help",children:h})}),e[5]=o,e[6]=h,e[7]=d):d=e[7];let v;e[8]!==o?(v=i.jsx(Rt,{className:"max-w-56",children:o}),e[8]=o,e[9]=v):v=e[9];let m;return e[10]!==d||e[11]!==v?(m=i.jsxs(kt,{children:[d,v]}),e[10]=d,e[11]=v,e[12]=m):m=e[12],m}const Wl="text-global-section-fg focus:bg-global-section/12 focus:text-global-section-fg dark:text-global-section-fg-dark dark:focus:bg-global-section/15 dark:focus:text-global-section-fg-dark [&_svg]:!text-global-section";function io(n){return Array.from({length:n},(e,s)=>({id:crypto.randomUUID(),index:s}))}function ko(n){return n.map((e,s)=>({...e,index:s}))}function ql(n,e){if(e===n.length)return n;if(e<n.length)return ko(n.slice(0,e));const s=Array.from({length:e-n.length},(o,a)=>({id:crypto.randomUUID(),index:n.length+a}));return[...n,...s]}function Eo(n){const e=it.c(44),{section:s,raw:o,meta:a,decofile:u}=n,h=Ft(),d=Wn(),v=s.isSavedBlock===!0,m=s.isMultivariate===!0;let j;e[0]!==a||e[1]!==o?(j=o&&a?El(o,a):void 0,e[0]=a,e[1]=o,e[2]=j):j=e[2];const A=j;let $;e[3]!==a||e[4]!==m||e[5]!==o||e[6]!==v?($=o&&a&&!v&&!m?zl(o,a):void 0,e[3]=a,e[4]=m,e[5]=o,e[6]=v,e[7]=$):$=e[7];const z=$;let H;e[8]!==u||e[9]!==a||e[10]!==o||e[11]!==s?(H=na(o,s,u,a),e[8]=u,e[9]=a,e[10]=o,e[11]=s,e[12]=H):H=e[12];const F=H;let f;e[13]!==m||e[14]!==o?.__resolveType?(f=!m&&Rs(o?.__resolveType??""),e[13]=m,e[14]=o?.__resolveType,e[15]=f):f=e[15];const k=f,X=v?zn:m?bo:_o;let w;e[16]!==m||e[17]!==v?(w=v?{color:za}:m?{color:"oklch(0.65 0.15 160)"}:void 0,e[16]=m,e[17]=v,e[18]=w):w=e[18];const I=w;let V;e[19]!==X||e[20]!==d?(V=d?i.jsxs("span",{className:"relative size-4 shrink-0",children:[i.jsx(X,{className:"absolute inset-0 size-4 text-muted-foreground transition-opacity group-hover:opacity-0 group-has-[:focus-visible]:opacity-0"}),i.jsx(ra,{"aria-hidden":!0,className:"absolute inset-0 size-4 opacity-0 transition-opacity group-hover:opacity-100 group-has-[:focus-visible]:opacity-100"})]}):i.jsx(Aa,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[19]=X,e[20]=d,e[21]=V):V=e[21];let y;e[22]!==A?(y=A&&i.jsx("img",{src:A,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded-[var(--studio-control-radius,var(--radius))] object-cover"}),e[22]=A,e[23]=y):y=e[23];let C;e[24]!==d||e[25]!==I?(C=!d&&i.jsx(Ss,{className:"h-4 w-4 shrink-0",style:I}),e[24]=d,e[25]=I,e[26]=C):C=e[26];const x=d?"shrink":"flex-1",Y=s.isHidden&&"line-through opacity-50";let M;e[27]!==Y||e[28]!==x?(M=ae("min-w-0 truncate text-sm font-medium",x,Y),e[27]=Y,e[28]=x,e[29]=M):M=e[29];const ge=z??s.label;let me;e[30]!==M||e[31]!==ge?(me=i.jsx("span",{className:M,children:ge}),e[30]=M,e[31]=ge,e[32]=me):me=e[32];let le;e[33]!==k||e[34]!==d||e[35]!==F||e[36]!==h?(le=d?i.jsxs(i.Fragment,{children:[k&&i.jsx(Hl,{icon:bs,label:h("sectionsEditor.sectionList.asyncBadge"),className:"text-muted-foreground"}),F&&i.jsx(Br,{}),i.jsx("span",{className:"min-w-0 flex-1"})]}):F&&i.jsx(Br,{className:"absolute -right-0.5 -top-0.5"}),e[33]=k,e[34]=d,e[35]=F,e[36]=h,e[37]=le):le=e[37];let ee;return e[38]!==me||e[39]!==le||e[40]!==V||e[41]!==y||e[42]!==C?(ee=i.jsxs(i.Fragment,{children:[V,y,C,me,le]}),e[38]=me,e[39]=le,e[40]=V,e[41]=y,e[42]=C,e[43]=ee):ee=e[43],ee}const Gl="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",Ul="text-[oklch(0.45_0.15_160)] hover:bg-[oklch(0.65_0.15_160/0.12)] dark:text-[oklch(0.78_0.15_160)] dark:hover:bg-[oklch(0.65_0.15_160/0.15)]";function Ro(n,e,s){if(s)return sa({selected:e});const o=n.isSavedBlock===!0,a=n.isMultivariate===!0;return ae("group relative flex select-none items-center gap-2 rounded-[var(--studio-control-radius,var(--radius-md))] px-2 py-2.5",e?"bg-accent text-accent-foreground":o?Gl:a?Ul:"text-foreground/80 hover:bg-accent hover:text-accent-foreground")}function ps(n,e){return ae("h-7 shrink-0 overflow-hidden",e?"w-7 ml-0 opacity-100 [transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]":n?"w-7 ml-0 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:opacity-100 group-has-[:focus-visible]:opacity-100":"w-0 -ml-2 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:ml-0 group-hover:w-7 group-hover:opacity-100 group-hover:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms] group-has-[:focus-visible]:ml-0 group-has-[:focus-visible]:w-7 group-has-[:focus-visible]:opacity-100 group-has-[:focus-visible]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]")}function Yl(n){const e=it.c(90),{section:s,raw:o,meta:a,decofile:u,sortableId:h,selected:d,onSelect:v,onDelete:m,onDuplicate:j,onMakeReusable:A,onToggleHidden:$,onToggleLazy:z,onAddVariant:H,onDetach:F}=n,f=Ft(),k=Wn(),X=o?Rs(o.__resolveType??""):!1,w=s.isHidden===!0,I=X||w;let V;e[0]!==s?(V=jo(s),e[0]=s,e[1]=V):V=e[1];const y=V,C=!!z&&!s.isMultivariate;let x;e[2]!==h?(x={id:h,animateLayoutChanges:Xl},e[2]=h,e[3]=x):x=e[3];const{attributes:Y,listeners:M,setNodeRef:ge,transform:me,isDragging:le}=bl(x);let ee;e[4]!==me?(ee=xl.Transform.toString(me?{...me,x:0}:null),e[4]=me,e[5]=ee):ee=e[5];const pe=le?0:void 0;let ce;e[6]!==ee||e[7]!==pe?(ce={transform:ee,opacity:pe},e[6]=ee,e[7]=pe,e[8]=ce):ce=e[8];const he=ce;let ve;e[9]!==s?(ve=Xi(s),e[9]=s,e[10]=ve):ve=e[10];const b=ve,B="button",xe=0;let T;e[11]!==v?(T=re=>{(re.key==="Enter"||re.key===" ")&&(re.preventDefault(),v())},e[11]=v,e[12]=T):T=e[12];const ye=le?"cursor-grabbing":"cursor-pointer";let K;e[13]!==k||e[14]!==s||e[15]!==d||e[16]!==ye?(K=ae("touch-none transition-colors",ye,Ro(s,d,k)),e[13]=k,e[14]=s,e[15]=d,e[16]=ye,e[17]=K):K=e[17];let Se;e[18]!==u||e[19]!==a||e[20]!==o||e[21]!==s?(Se=i.jsx(Eo,{section:s,raw:o,meta:a,decofile:u}),e[18]=u,e[19]=a,e[20]=o,e[21]=s,e[22]=Se):Se=e[22];const ue=!k&&C&&i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"ghost",size:"icon","aria-label":f(X?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender"),className:ae(ps(I,X)),onClick:re=>{re.stopPropagation(),z?.()},onPointerDown:Ql,children:i.jsx(bs,{className:ae("h-3.5 w-3.5",X&&"text-warning")})})}),i.jsx(Rt,{side:"bottom",children:f(X?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")})]}),te=k?i.jsx(Zi,{label:f(w?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),active:w,onToggle:$,children:w?i.jsx(Zr,{className:"h-3.5 w-3.5"}):i.jsx(eo,{className:"h-3.5 w-3.5"})}):i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"ghost",size:"icon","aria-label":f(w?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),className:ae(ps(I,w)),onClick:re=>{re.stopPropagation(),$()},onPointerDown:Jl,children:w?i.jsx(Zr,{className:"h-3.5 w-3.5"}):i.jsx(eo,{className:"h-3.5 w-3.5"})})}),i.jsx(Rt,{side:"bottom",children:f(w?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection")})]}),se=zi,Te=ea;let Z;e[23]!==f?(Z=f("sectionsEditor.sectionList.sectionActionsMenu"),e[23]=f,e[24]=Z):Z=e[24];const _e=ae(ps(I,!1),"data-[state=open]:ml-0 data-[state=open]:w-7 data-[state=open]:opacity-100 data-[state=open]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]");let be;e[25]!==Te||e[26]!==Z||e[27]!==_e?(be=i.jsx(Te,{label:Z,classicClassName:_e}),e[25]=Te,e[26]=Z,e[27]=_e,e[28]=be):be=e[28];let q;e[29]!==k||e[30]!==C||e[31]!==X||e[32]!==z||e[33]!==f?(q=k&&C&&i.jsxs(i.Fragment,{children:[i.jsxs(sn,{onClick:re=>{re.stopPropagation(),z?.()},children:[i.jsx(bs,{className:"h-4 w-4"}),f(X?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")]}),i.jsx($i,{})]}),e[29]=k,e[30]=C,e[31]=X,e[32]=z,e[33]=f,e[34]=q):q=e[34];let O;e[35]!==j?(O=re=>{re.stopPropagation(),j()},e[35]=j,e[36]=O):O=e[36];let Ke;e[37]===Symbol.for("react.memo_cache_sentinel")?(Ke=i.jsx(dl,{className:"h-4 w-4"}),e[37]=Ke):Ke=e[37];let Qe;e[38]!==f?(Qe=f("sectionsEditor.sectionList.duplicateMenuItem"),e[38]=f,e[39]=Qe):Qe=e[39];let Xe;e[40]!==O||e[41]!==Qe?(Xe=i.jsxs(sn,{onClick:O,children:[Ke,Qe]}),e[40]=O,e[41]=Qe,e[42]=Xe):Xe=e[42];let Ye;e[43]!==k||e[44]!==y||e[45]!==H||e[46]!==f?(Ye=y&&i.jsxs(sn,{className:ae(!k&&ta),onClick:re=>{re.stopPropagation(),H()},children:[i.jsx(bo,{className:"h-4 w-4"}),f("sectionsEditor.sectionList.addVariantMenuItem")]}),e[43]=k,e[44]=y,e[45]=H,e[46]=f,e[47]=Ye):Ye=e[47];let Q;e[48]!==k||e[49]!==b||e[50]!==A||e[51]!==f?(Q=b&&i.jsxs(sn,{className:ae(!k&&Wl),onClick:re=>{re.stopPropagation(),A()},children:[k?i.jsx(zn,{className:"h-4 w-4"}):i.jsx(Ss,{className:"h-4 w-4"}),f("sectionsEditor.sectionList.makeReusableMenuItem")]}),e[48]=k,e[49]=b,e[50]=A,e[51]=f,e[52]=Q):Q=e[52];let ke;e[53]!==k||e[54]!==F||e[55]!==s.isMultivariate||e[56]!==s.isSavedBlock||e[57]!==f?(ke=s.isSavedBlock===!0&&!s.isMultivariate&&i.jsxs(sn,{onClick:re=>{re.stopPropagation(),F()},children:[k?i.jsx(_o,{className:"h-4 w-4"}):i.jsx(Ss,{className:"h-4 w-4"}),f("sectionsEditor.sectionList.detachMenuItem")]}),e[53]=k,e[54]=F,e[55]=s.isMultivariate,e[56]=s.isSavedBlock,e[57]=f,e[58]=ke):ke=e[58];let He;e[59]!==m?(He=re=>{re.stopPropagation(),m()},e[59]=m,e[60]=He):He=e[60];let We;e[61]===Symbol.for("react.memo_cache_sentinel")?(We=i.jsx(ml,{className:"h-4 w-4"}),e[61]=We):We=e[61];let Ee;e[62]!==f?(Ee=f("sectionsEditor.sectionList.deleteMenuItem"),e[62]=f,e[63]=Ee):Ee=e[63];let Ie;e[64]!==He||e[65]!==Ee?(Ie=i.jsxs(sn,{variant:"destructive",onClick:He,children:[We,Ee]}),e[64]=He,e[65]=Ee,e[66]=Ie):Ie=e[66];let Ve;e[67]!==q||e[68]!==Xe||e[69]!==Ye||e[70]!==Q||e[71]!==ke||e[72]!==Ie?(Ve=i.jsxs(Hi,{align:"end",className:"w-44",children:[q,Xe,Ye,Q,ke,Ie]}),e[67]=q,e[68]=Xe,e[69]=Ye,e[70]=Q,e[71]=ke,e[72]=Ie,e[73]=Ve):Ve=e[73];let Ze;e[74]!==se||e[75]!==be||e[76]!==Ve?(Ze=i.jsxs(se,{children:[be,Ve]}),e[74]=se,e[75]=be,e[76]=Ve,e[77]=Ze):Ze=e[77];let Fe;return e[78]!==Y||e[79]!==M||e[80]!==v||e[81]!==ge||e[82]!==he||e[83]!==K||e[84]!==Se||e[85]!==ue||e[86]!==te||e[87]!==Ze||e[88]!==T?(Fe=i.jsxs("div",{ref:ge,style:he,...Y,...M,role:B,tabIndex:xe,onClick:v,onKeyDown:T,className:K,children:[Se,ue,te,Ze]}),e[78]=Y,e[79]=M,e[80]=v,e[81]=ge,e[82]=he,e[83]=K,e[84]=Se,e[85]=ue,e[86]=te,e[87]=Ze,e[88]=T,e[89]=Fe):Fe=e[89],Fe}function Jl(n){return n.stopPropagation()}function Ql(n){return n.stopPropagation()}function Xl(){return!1}function js(n){const e=it.c(11),{canAddSection:s,onAddSection:o,className:a,size:u}=n,h=Ft();let d;e[0]!==a?(d=ae("w-full",a),e[0]=a,e[1]=d):d=e[1];const v=!s;let m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=i.jsx(fl,{size:14}),e[2]=m):m=e[2];let j;e[3]!==h?(j=h("sectionsEditor.sectionList.addSectionButton"),e[3]=h,e[4]=j):j=e[4];let A;return e[5]!==o||e[6]!==u||e[7]!==d||e[8]!==v||e[9]!==j?(A=i.jsxs(_t,{type:"button",variant:"outline",size:u,className:d,disabled:v,onClick:o,children:[m,j]}),e[5]=o,e[6]=u,e[7]=d,e[8]=v,e[9]=j,e[10]=A):A=e[10],A}function Zl(n){const e=it.c(101),{listKey:s,rawSections:o,sections:a,meta:u,decofile:h,selectedIndex:d,onSelect:v,onReorder:m,onDelete:j,onDuplicate:A,onMakeReusable:$,onToggleHidden:z,onToggleLazy:H,onAddVariant:F,onDetach:f,onAddSection:k,canAddSection:X}=n,w=X===void 0?!0:X,I=Ft(),V=Wn();let y;e[0]!==a.length?(y=()=>io(a.length),e[0]=a.length,e[1]=y):y=e[1];const[C,x]=R.useState(y),[Y,M]=R.useState(null),[ge,me]=R.useState(s),[le,ee]=R.useState(a.length),pe=R.useRef(!1);ge!==s?(me(s),ee(a.length),x(io(a.length))):le!==a.length&&(ee(a.length),x(dt=>ql(dt,a.length)));let ce;e[2]===Symbol.for("react.memo_cache_sentinel")?(ce={activationConstraint:{distance:8}},e[2]=ce):ce=e[2];let he;e[3]===Symbol.for("react.memo_cache_sentinel")?(he={coordinateGetter:jl},e[3]=he):he=e[3];const ve=pl(to(gl,ce),to(hl,he));let b;e[4]!==C?(b=C.map(ec),e[4]=C,e[5]=b):b=e[5];const B=b;let xe;e[6]===Symbol.for("react.memo_cache_sentinel")?(xe=dt=>{M(String(dt.active.id))},e[6]=xe):xe=e[6];const T=xe;let ye;e[7]!==B||e[8]!==m?(ye=dt=>{M(null);const{active:ne,over:De}=dt;if(!De||ne.id===De.id)return;const yt=B.indexOf(String(ne.id)),et=B.indexOf(String(De.id));yt===-1||et===-1||(x(ft=>ko(Ln([...ft],yt,et))),pe.current=!0,requestAnimationFrame(()=>{pe.current=!1}),m?.(yt,et))},e[7]=B,e[8]=m,e[9]=ye):ye=e[9];const K=ye;let Se;e[10]===Symbol.for("react.memo_cache_sentinel")?(Se=()=>{M(null)},e[10]=Se):Se=e[10];const ue=Se;let te,se,Te,Z,_e,be,q,O,Ke,Qe,Xe,Ye,Q,ke,He;if(e[11]!==Y||e[12]!==w||e[13]!==V||e[14]!==h||e[15]!==C||e[16]!==B||e[17]!==K||e[18]!==u||e[19]!==k||e[20]!==F||e[21]!==j||e[22]!==f||e[23]!==A||e[24]!==$||e[25]!==v||e[26]!==z||e[27]!==H||e[28]!==o||e[29]!==a||e[30]!==d||e[31]!==ve||e[32]!==I){ke=Symbol.for("react.early_return_sentinel");e:{const dt=ne=>{pe.current||v(ne)};if(e[48]!==Y||e[49]!==w||e[50]!==V||e[51]!==C||e[52]!==k||e[53]!==o||e[54]!==a||e[55]!==I){const ne=Y?C.find(De=>De.id===Y):null;if(Z=ne!=null?a[ne.index]:null,Te=ne!=null?o[ne.index]:void 0,C.length===0){let De;e[59]!==I?(De=I("sectionsEditor.sectionList.noSections"),e[59]=I,e[60]=De):De=e[60];let yt;e[61]!==De?(yt=i.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:De}),e[61]=De,e[62]=yt):yt=e[62];const et=yt;let ft;e[63]!==w||e[64]!==V||e[65]!==et||e[66]!==k?(ft=V?et:i.jsxs("div",{className:"space-y-2",children:[et,i.jsx(js,{canAddSection:w,onAddSection:k,size:"sm"})]}),e[63]=w,e[64]=V,e[65]=et,e[66]=k,e[67]=ft):ft=e[67],ke=ft;break e}Q=ae(ne&&"cursor-grabbing"),e[48]=Y,e[49]=w,e[50]=V,e[51]=C,e[52]=k,e[53]=o,e[54]=a,e[55]=I,e[56]=Te,e[57]=Z,e[58]=Q}else Te=e[56],Z=e[57],Q=e[58];se=yl,O=ve,Ke=Sl,Qe=T,Xe=K,Ye=ue,te=wl,be=B,q=_l,He="space-y-1",_e=C.map(ne=>{const De=a[ne.index];return De?i.jsx(Yl,{sortableId:ne.id,section:De,raw:o[ne.index],meta:u,decofile:h,selected:d===ne.index,onSelect:()=>dt(ne.index),onDelete:()=>j(ne.index),onDuplicate:()=>A(ne.index),onMakeReusable:()=>$(ne.index),onToggleHidden:()=>z(ne.index),onToggleLazy:H?()=>H(ne.index):void 0,onAddVariant:()=>F(ne.index),onDetach:()=>f(ne.index)},ne.id):null})}e[11]=Y,e[12]=w,e[13]=V,e[14]=h,e[15]=C,e[16]=B,e[17]=K,e[18]=u,e[19]=k,e[20]=F,e[21]=j,e[22]=f,e[23]=A,e[24]=$,e[25]=v,e[26]=z,e[27]=H,e[28]=o,e[29]=a,e[30]=d,e[31]=ve,e[32]=I,e[33]=te,e[34]=se,e[35]=Te,e[36]=Z,e[37]=_e,e[38]=be,e[39]=q,e[40]=O,e[41]=Ke,e[42]=Qe,e[43]=Xe,e[44]=Ye,e[45]=Q,e[46]=ke,e[47]=He}else te=e[33],se=e[34],Te=e[35],Z=e[36],_e=e[37],be=e[38],q=e[39],O=e[40],Ke=e[41],Qe=e[42],Xe=e[43],Ye=e[44],Q=e[45],ke=e[46],He=e[47];if(ke!==Symbol.for("react.early_return_sentinel"))return ke;let We;e[68]!==_e||e[69]!==He?(We=i.jsx("div",{className:He,children:_e}),e[68]=_e,e[69]=He,e[70]=We):We=e[70];let Ee;e[71]!==te||e[72]!==be||e[73]!==q||e[74]!==We?(Ee=i.jsx(te,{items:be,strategy:q,children:We}),e[71]=te,e[72]=be,e[73]=q,e[74]=We,e[75]=Ee):Ee=e[75];let Ie;e[76]!==Te||e[77]!==Z||e[78]!==V||e[79]!==h||e[80]!==u?(Ie=Z?i.jsx("div",{className:ae("cursor-grabbing shadow-lg ring-1 ring-border/60",Ro(Z,!1,V)),children:i.jsx(Eo,{section:Z,raw:Te,meta:u,decofile:h})}):null,e[76]=Te,e[77]=Z,e[78]=V,e[79]=h,e[80]=u,e[81]=Ie):Ie=e[81];let Ve;e[82]!==Ie?(Ve=Li.createPortal(i.jsx(vl,{dropAnimation:Qi,children:Ie}),document.body),e[82]=Ie,e[83]=Ve):Ve=e[83];let Ze;e[84]!==se||e[85]!==O||e[86]!==Ke||e[87]!==Qe||e[88]!==Xe||e[89]!==Ye||e[90]!==Ee||e[91]!==Ve?(Ze=i.jsxs(se,{sensors:O,collisionDetection:Ke,onDragStart:Qe,onDragEnd:Xe,onDragCancel:Ye,children:[Ee,Ve]}),e[84]=se,e[85]=O,e[86]=Ke,e[87]=Qe,e[88]=Xe,e[89]=Ye,e[90]=Ee,e[91]=Ve,e[92]=Ze):Ze=e[92];let Fe;e[93]!==w||e[94]!==V||e[95]!==k?(Fe=!V&&i.jsx(js,{canAddSection:w,onAddSection:k,size:"sm",className:"mt-2"}),e[93]=w,e[94]=V,e[95]=k,e[96]=Fe):Fe=e[96];let re;return e[97]!==Q||e[98]!==Ze||e[99]!==Fe?(re=i.jsxs("div",{className:Q,children:[Ze,Fe]}),e[97]=Q,e[98]=Ze,e[99]=Fe,e[100]=re):re=e[100],re}function ec(n){return n.id}function hs(n,e,s,o){if(!n||!e)return null;if(!e.isMultivariate)return jt(n,e,o)?.data??null;const a=xt(n,e),u=a?vs(a,wt)[s]:void 0;return u?wo(u.value,o)?.data??null:null}const tc=50;function nc(n,e){n.own.push(ze(e)),n.own.length>tc&&n.own.shift()}function ao(n,e){return n.own.includes(ze(e))}function sc(n,e){const{sectionIndex:s,variantIndex:o,shown:a,next:u,sectionCount:h}=e;return n&&n.sectionIndex===s&&n.variantIndex===o&&n.emitted===a?(n.emitted=u,n):a?{sectionIndex:s,variantIndex:o,base:a,emitted:u,sectionCount:h,own:[ze(a)]}:null}function Ao(n,e){return e!==null&&ze(n)!==ze(e)}function Co(n,e){return n.__resolveType!==e.__resolveType}function rc(n,e,s,o){if(e.length===o)return"here";const a=ze(n),u=e.flatMap((h,d)=>d!==s&&h!==null&&ze(h)===a?[d]:[]);return u.length===1?u[0]:"unknown"}function lo({formBase:n,rebased:e,versionOf:s}){let o=null;return{ifMatch:a=>{o=a,n&&(n.version===void 0||e)&&(n.version=s(a));const u=n?n.version:s(a);return u===void 0?void 0:{[a]:u}},onApplied:a=>{n&&o!==null&&Object.hasOwn(a,o)&&(n.version=a[o])},reloadOnConflict:!0}}function oc({merged:n,tracked:e,current:s,saved:o}){return!!n&&!!e&&s===e&&e.emitted===o}function co(n,e){return!!n&&!!e&&n.contains(e)}function ws(n){const e=[],s=_s("",n.ancestor,n.mine,n.theirs,e);return{...n,merged:s,pointers:e}}function _s(n,e,s,o,a){const u=(h,d)=>ze(h)===ze(d);if(u(s,o)||u(e,o))return s;if(u(e,s))return o;if(gs(s)&&gs(o)){const h=gs(e)?e:{},d={},v=[...Object.keys(s),...Object.keys(o).filter(m=>!(m in s))];for(const m of v){const j=_s(`${n}/${m.replaceAll("~","~0").replaceAll("/","~1")}`,h[m],s[m],o[m],a);j!==void 0&&(d[m]=j)}return d}return Array.isArray(e)&&Array.isArray(s)&&Array.isArray(o)&&s.length===e.length&&o.length===e.length?e.map((h,d)=>_s(`${n}/${d}`,h,s[d],o[d],a)):(a.push(n),o)}function gs(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}function ic(n,e){let s=n.merged;for(const o of n.pointers)e[o]==="mine"&&(s=uc(s,o,Ut(n.mine,o)));return s}function ac(n,e){return Object.fromEntries(n.pointers.map(s=>[s,e]))}function No(n){return ac(n,"mine")}function ks(n,e,s){const o=No(s);for(const a of s.pointers){const u=e[a];if(!u||!n.pointers.includes(a))continue;["mine","theirs"].every(d=>ze(Ut(n[d],a))===ze(Ut(s[d],a)))&&(o[a]=u)}return o}function To(n,e,s={}){const o=e.pointers.filter(a=>!n.pointers.includes(a)||ze(Ut(n.theirs,a))!==ze(Ut(e.theirs,a)));return o.length===0?s:{...s,...Object.fromEntries(o.map(a=>[a,(s[a]??0)+1]))}}function lc(n,e,s){if(!e||Co(n.plan.ancestor,e)||!Ao(n.plan.theirs,e)||s(e))return null;const o=ws({...n.plan,theirs:e});return o.pointers.length===0?null:{plan:o,choices:ks(n.plan,n.choices,o),fresh:To(n.plan,o,n.fresh)}}function cc(n,e){return n.pointers.map(s=>({pointer:s,label:oa(s,e),mine:Ut(n.mine,s),theirs:Ut(n.theirs,s),schema:dc(e??null,s)}))}function As(n){return n.split("/").slice(1).map(e=>e.replaceAll("~1","/").replaceAll("~0","~"))}function Ut(n,e){let s=n;for(const o of As(e))if(Array.isArray(s))s=s[Number(o)];else if(s&&typeof s=="object")s=s[o];else return;return s}function uc(n,e,s){const o=As(e),a=(u,h)=>{if(h===o.length)return s;const d=o[h];if(Array.isArray(u)){const j=[...u];return j[Number(d)]=a(u[Number(d)],h+1),j}const v=u&&typeof u=="object"?{...u}:{},m=a(v[d],h+1);return m===void 0?delete v[d]:v[d]=m,v};return a(n,0)}function dc(n,e){let s=n;for(const o of As(e)){if(!s)return null;s=/^\d+$/.test(o)&&!s.properties?.[o]?s.items:s.properties?.[o]}return s??null}const fc=/\.(png|jpe?g|gif|webp|avif|svg)(\?.*)?$/i,uo=60,mc=3;function Vo(n,e){return e?.format==="image-uri"?!0:n.startsWith("data:image/")||/^(https?:)?\/\//.test(n)&&fc.test(n)}function Es(n,e){if(!(e?.format==="rich-text"||e?.format==="rich-text-inline"||e?.format==="html"||/<\/?[a-z][^>]*>/i.test(n)))return n;const o=n.replace(/<br\s*\/?>/gi,`
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,X]=R.useState(f),w=Math.max(0,Math.min($,o.length-1)),I=o[w],V=w===o.length-1;let y;e[1]!==w||e[2]!==o||e[3]!==m?(y=Se=>{const ue=o[w],te=o[Se];!ue||!te||Se===w||(F(se=>new Set(se).add(ue.pointer)),X(se=>({...se,[ue.pointer]:m[ue.pointer]??0,[te.pointer]:m[te.pointer]??0})),z(Se))},e[1]=w,e[2]=o,e[3]=m,e[4]=y):y=e[4];const C=y;let x;e[5]!==w||e[6]!==C?(x=Se=>{if(!Se)return;const ue=te=>{const se={ArrowLeft:-1,ArrowRight:1}[te.key];!se||te.defaultPrevented||te.altKey||te.ctrlKey||te.metaKey||te.shiftKey||Pl(te.target)||(te.preventDefault(),C(w+se))};return Se.ownerDocument.addEventListener("keydown",ue),()=>Se.ownerDocument.removeEventListener("keydown",ue)},e[5]=w,e[6]=C,e[7]=x):x=e[7];const Y=x;if(!I)return null;let M,ge,me,le,ee;if(e[8]!==H||e[9]!==w||e[10]!==a||e[11]!==o||e[12]!==m||e[13]!==C||e[14]!==j||e[15]!==Y||e[16]!==A||e[17]!==n||e[18]!==k||e[19]!==s){const{title:Se,description:ue}=kc(s,o,w,a,n.author??null);let te;e[25]!==n?(te=se=>{se.detail>1||n.onApply()},e[25]=n,e[26]=te):te=e[26],M=te,ge=A?Y:void 0,me="flex min-w-0 flex-col gap-3",e[27]!==H||e[28]!==w||e[29]!==o||e[30]!==m||e[31]!==C||e[32]!==A||e[33]!==k||e[34]!==s?(le=A&&i.jsxs("div",{className:"flex items-center justify-between gap-3",children:[i.jsx("div",{role:"group","aria-label":s("sectionsEditor.formConflict.steps"),className:"-m-1 flex flex-wrap items-center",children:o.map((se,Te)=>{const Z=Te!==w&&(m[se.pointer]??0)>(k[se.pointer]??0);return i.jsx("button",{type:"button","aria-label":Z?s("sectionsEditor.formConflict.stepChangedAgain",{label:se.label}):se.label,"aria-current":Te===w?"step":void 0,"data-answered":Te!==w&&H.has(se.pointer)?"":void 0,"data-changed-again":Z?"":void 0,onClick:()=>C(Te),className:"group cursor-pointer rounded-full p-1 outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:i.jsx("span",{className:ae("block h-2 w-2 rounded-full bg-border transition-[width,background-color,box-shadow] motion-reduce:transition-none","group-hover:bg-muted-foreground/60","group-data-[answered]:bg-foreground/45","group-aria-[current=step]:w-5 group-aria-[current=step]:bg-foreground","group-data-[changed-again]:ring-2 group-data-[changed-again]:ring-warning group-data-[changed-again]:ring-offset-1 group-data-[changed-again]:ring-offset-background")})},se.pointer)})}),i.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:s("sectionsEditor.formConflict.stepCount",{step:String(w+1),count:String(o.length)})})]}),e[27]=H,e[28]=w,e[29]=o,e[30]=m,e[31]=C,e[32]=A,e[33]=k,e[34]=s,e[35]=le):le=e[35],ee=j(Se,ue),e[8]=H,e[9]=w,e[10]=a,e[11]=o,e[12]=m,e[13]=C,e[14]=j,e[15]=Y,e[16]=A,e[17]=n,e[18]=k,e[19]=s,e[20]=M,e[21]=ge,e[22]=me,e[23]=le,e[24]=ee}else M=e[20],ge=e[21],me=e[22],le=e[23],ee=e[24];let pe;e[36]!==ge||e[37]!==me||e[38]!==le||e[39]!==ee?(pe=i.jsxs("div",{ref:ge,className:me,children:[le,ee]}),e[36]=ge,e[37]=me,e[38]=le,e[39]=ee,e[40]=pe):pe=e[40];const ce=!v&&"sr-only";let he;e[41]!==ce?(he=ae("text-sm text-muted-foreground",ce),e[41]=ce,e[42]=he):he=e[42];let ve;e[43]!==v||e[44]!==A||e[45]!==s?(ve=v?s(A?"sectionsEditor.formConflict.changedAgainSteps":"sectionsEditor.formConflict.changedAgain"):"",e[43]=v,e[44]=A,e[45]=s,e[46]=ve):ve=e[46];let b;e[47]!==he||e[48]!==ve?(b=i.jsx("p",{role:"status",className:he,children:ve}),e[47]=he,e[48]=ve,e[49]=b):b=e[49];const B=A?"vertical":"all";let xe;e[50]!==I||e[51]!==n||e[52]!==B?(xe=i.jsx(Dc,{field:I,...n,arrows:B}),e[50]=I,e[51]=n,e[52]=B,e[53]=xe):xe=e[53];let T;e[54]!==b||e[55]!==xe?(T=i.jsxs("div",{className:"-mx-2 flex min-h-0 flex-col gap-3 overflow-y-auto px-2 py-1",children:[b,xe]}),e[54]=b,e[55]=xe,e[56]=T):T=e[56];let ye;e[57]!==M||e[58]!==w||e[59]!==C||e[60]!==V||e[61]!==A||e[62]!==s?(ye=A?i.jsxs(no,{className:"flex-row flex-wrap items-center justify-between gap-2 sm:justify-between",children:[i.jsx(_t,{type:"button",variant:"outline","aria-disabled":w===0,onClick:()=>C(w-1),className:"aria-disabled:cursor-default aria-disabled:opacity-45",children:s("sectionsEditor.formConflict.back")}),i.jsx(_t,{type:"button","data-testid":"form-conflict-primary",onClick:V?M:()=>C(w+1),children:s(V?"sectionsEditor.formConflict.ok":"sectionsEditor.formConflict.next")})]}):i.jsx(no,{className:"items-center gap-2",children:i.jsx(_t,{type:"button","data-testid":"form-conflict-primary",onClick:M,children:s("sectionsEditor.formConflict.ok")})}),e[57]=M,e[58]=w,e[59]=C,e[60]=V,e[61]=A,e[62]=s,e[63]=ye):ye=e[63];let K;return e[64]!==pe||e[65]!==T||e[66]!==ye?(K=i.jsxs(i.Fragment,{children:[pe,T,ye]}),e[64]=pe,e[65]=T,e[66]=ye,e[67]=K):K=e[67],K}function Cc(){return new Set}function Nc(n){const e=Hn(n.mine,n.schema),s=Hn(n.theirs,n.schema),o=e.kind==="text"&&s.kind==="text"?xc(e.text,s.text):null;return a=>o?i.jsx(Pc,{parts:o[a]}):i.jsx(Bc,{preview:a==="mine"?e:s})}const Tc={all:{ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1},vertical:{ArrowDown:1,ArrowUp:-1}};function Vc(n,e){const s=Tc[e][n.key];if(!s)return;const o=[...n.currentTarget.querySelectorAll('[role="radio"]')],a=o.indexOf(document.activeElement);if(a<0)return;n.preventDefault();const u=o[(a+s+o.length)%o.length];u?.focus(),u?.click()}function Dc(n){const e=it.c(65),{field:s,choices:o,viewer:a,author:u,onChoose:h,arrows:d}=n,v=u===void 0?null:u,m=Ft(),[j]=qi(),{language:A}=j;let $,z,H,F,f,k,X,w,I,V,y,C,x,Y;if(e[0]!==d||e[1]!==v||e[2]!==o||e[3]!==s||e[4]!==A||e[5]!==h||e[6]!==m||e[7]!==a?.image||e[8]!==a?.name){const me=Nc(s),le=o[s.pointer]??"mine",ee=a?.image??void 0;let pe;e[23]!==m||e[24]!==a?.name?(pe=mo(a?.name)||m("sectionsEditor.formConflict.you"),e[23]=m,e[24]=a?.name,e[25]=pe):pe=e[25];let ce;e[26]!==ee||e[27]!==pe?(ce=i.jsx(ms,{url:ee,fallback:pe,shape:"circle",size:"sm",className:"text-xs"}),e[26]=ee,e[27]=pe,e[28]=ce):ce=e[28];const he=ce;let ve;e[29]!==v||e[30]!==he?(ve=v?.you?he:v?.name?i.jsx(ms,{url:v.avatarUrl,fallback:mo(v.name),shape:"circle",size:"sm",className:"text-xs"}):i.jsx(ms,{url:"icon://user",fallback:"",muted:!0,shape:"circle",size:"sm"}),e[29]=v,e[30]=he,e[31]=ve):ve=e[31];const b=ve,B=v?new Date(v.at):null;H="radiogroup",F=s.label,f="flex flex-col gap-2",e[32]!==d?(k=K=>Vc(K,d),e[32]=d,e[33]=k):k=e[33];let xe;e[34]!==s.pointer||e[35]!==h?(xe=()=>h(s.pointer,"mine"),e[34]=s.pointer,e[35]=h,e[36]=xe):xe=e[36];let T;e[37]!==m?(T=m("sectionsEditor.formConflict.you"),e[37]=m,e[38]=T):T=e[38];let ye;e[39]!==m?(ye=m("sectionsEditor.formConflict.yourVersionNotSaved"),e[39]=m,e[40]=ye):ye=e[40],X=i.jsx(po,{side:"mine",checked:le==="mine",onChoose:xe,avatar:he,who:T,meta:ye,children:me("mine")}),$=po,w="theirs",I=le==="theirs",e[41]!==s.pointer||e[42]!==h?(V=()=>h(s.pointer,"theirs"),e[41]=s.pointer,e[42]=h,e[43]=V):V=e[43],y=b,e[44]!==v?.name||e[45]!==v?.you||e[46]!==m?(C=v?.you?m("sectionsEditor.formConflict.youElsewhere"):v?.name||m("sectionsEditor.formConflict.someoneElse"),e[44]=v?.name,e[45]=v?.you,e[46]=m,e[47]=C):C=e[47],x=B?m("sectionsEditor.formConflict.savedAt",{when:Ml(B,A)}):m("sectionsEditor.formConflict.theirVersionSaved"),Y=B?Mc(B,A):void 0,z=me("theirs"),e[0]=d,e[1]=v,e[2]=o,e[3]=s,e[4]=A,e[5]=h,e[6]=m,e[7]=a?.image,e[8]=a?.name,e[9]=$,e[10]=z,e[11]=H,e[12]=F,e[13]=f,e[14]=k,e[15]=X,e[16]=w,e[17]=I,e[18]=V,e[19]=y,e[20]=C,e[21]=x,e[22]=Y}else $=e[9],z=e[10],H=e[11],F=e[12],f=e[13],k=e[14],X=e[15],w=e[16],I=e[17],V=e[18],y=e[19],C=e[20],x=e[21],Y=e[22];let M;e[48]!==$||e[49]!==z||e[50]!==w||e[51]!==I||e[52]!==V||e[53]!==y||e[54]!==C||e[55]!==x||e[56]!==Y?(M=i.jsx($,{side:w,checked:I,onChoose:V,avatar:y,who:C,meta:x,metaTitle:Y,children:z}),e[48]=$,e[49]=z,e[50]=w,e[51]=I,e[52]=V,e[53]=y,e[54]=C,e[55]=x,e[56]=Y,e[57]=M):M=e[57];let ge;return e[58]!==H||e[59]!==F||e[60]!==f||e[61]!==k||e[62]!==X||e[63]!==M?(ge=i.jsxs("div",{role:H,"aria-label":F,className:f,onKeyDown:k,children:[X,M]}),e[58]=H,e[59]=F,e[60]=f,e[61]=k,e[62]=X,e[63]=M,e[64]=ge):ge=e[64],ge}const Mc=(n,e)=>n.toLocaleString(e,{dateStyle:"medium",timeStyle:"short"});function mo(n){return(n??"").trim().split(/\s+/).filter(Boolean).slice(0,2).map(e=>e.charAt(0).toUpperCase()).join("")}function po(n){const e=it.c(28),{side:s,checked:o,onChoose:a,avatar:u,who:h,meta:d,metaTitle:v,children:m}=n,j=R.useId(),A=`${j}-who`,$=`${j}-meta ${j}-value`,z=o?0:-1,H=o?"border-primary bg-primary/5 ring-1 ring-primary":"hover:bg-muted/50";let F;e[0]!==H?(F=ae("grid w-full cursor-pointer grid-cols-[auto_minmax(0,1fr)] items-start gap-3 rounded-xl border bg-background p-3 text-left transition-[border-color,box-shadow,background-color] outline-none","focus-visible:ring-2 focus-visible:ring-ring/50",H),e[0]=H,e[1]=F):F=e[1];const f=`${j}-who`;let k;e[2]!==f||e[3]!==h?(k=i.jsx("span",{id:f,className:"text-sm font-medium text-foreground",children:h}),e[2]=f,e[3]=h,e[4]=k):k=e[4];const X=`${j}-meta`;let w;e[5]!==d||e[6]!==v||e[7]!==X?(w=i.jsx("span",{id:X,title:v,children:d}),e[5]=d,e[6]=v,e[7]=X,e[8]=w):w=e[8];let I;e[9]!==k||e[10]!==w?(I=i.jsxs("span",{className:"flex flex-wrap items-baseline gap-x-1.5 text-xs text-muted-foreground",children:[k,w]}),e[9]=k,e[10]=w,e[11]=I):I=e[11];const V=`${j}-value`,y=`conflict-${s}`;let C;e[12]!==m||e[13]!==V||e[14]!==y?(C=i.jsx("span",{id:V,"data-testid":y,className:"min-w-0 text-sm",children:m}),e[12]=m,e[13]=V,e[14]=y,e[15]=C):C=e[15];let x;e[16]!==I||e[17]!==C?(x=i.jsxs("span",{className:"flex min-w-0 flex-col gap-1",children:[I,C]}),e[16]=I,e[17]=C,e[18]=x):x=e[18];let Y;return e[19]!==u||e[20]!==o||e[21]!==a||e[22]!==A||e[23]!==x||e[24]!==$||e[25]!==z||e[26]!==F?(Y=i.jsxs("button",{type:"button",role:"radio","aria-checked":o,"aria-labelledby":A,"aria-describedby":$,tabIndex:z,onClick:a,className:F,children:[u,x]}),e[19]=u,e[20]=o,e[21]=a,e[22]=A,e[23]=x,e[24]=$,e[25]=z,e[26]=F,e[27]=Y):Y=e[27],Y}function Pc(n){const e=it.c(4),{parts:s}=n;let o;e[0]!==s?(o=s.map(Ic),e[0]=s,e[1]=o):o=e[1];let a;return e[2]!==o?(a=i.jsx("span",{className:"whitespace-pre-wrap break-words",children:o}),e[2]=o,e[3]=a):a=e[3],a}function Ic(n,e){return n.kind==="changed"?i.jsx("mark",{className:"rounded-sm bg-warning/20 px-0.5 text-foreground",children:n.text},e):i.jsx("span",{children:n.text},e)}function Bc(n){const e=it.c(29),{preview:s}=n,o=Ft();switch(s.kind){case"empty":{let a;e[0]!==o?(a=o("sectionsEditor.formConflict.empty"),e[0]=o,e[1]=a):a=e[1];let u;return e[2]!==a?(u=i.jsx("span",{className:"italic text-muted-foreground",children:a}),e[2]=a,e[3]=u):u=e[3],u}case"text":{let a;return e[4]!==s.text?(a=i.jsx("span",{className:"whitespace-pre-wrap break-words",children:s.text}),e[4]=s.text,e[5]=a):a=e[5],a}case"image":{let a;return e[6]!==s.src?(a=i.jsx("img",{src:s.src,alt:"",className:"max-h-24 max-w-full rounded border object-contain"}),e[6]=s.src,e[7]=a):a=e[7],a}case"yesNo":{const a=s.value?"sectionsEditor.formConflict.yes":"sectionsEditor.formConflict.no";let u;e[8]!==o||e[9]!==a?(u=o(a),e[8]=o,e[9]=a,e[10]=u):u=e[10];let h;return e[11]!==u?(h=i.jsx("span",{children:u}),e[11]=u,e[12]=h):h=e[12],h}case"list":{const a=s.count===1?"sectionsEditor.formConflict.oneItem":"sectionsEditor.formConflict.items",u=String(s.count);let h;e[13]!==o||e[14]!==a||e[15]!==u?(h=o(a,{count:u}),e[13]=o,e[14]=a,e[15]=u,e[16]=h):h=e[16];let d;e[17]!==h?(d=i.jsx("span",{className:"text-muted-foreground",children:h}),e[17]=h,e[18]=d):d=e[18];let v;e[19]!==s.count||e[20]!==s.items?(v=s.items.some(Boolean)&&i.jsxs("span",{className:"flex flex-col",children:[s.items.map(Fc),s.count>s.items.length&&i.jsx("span",{children:"…"})]}),e[19]=s.count,e[20]=s.items,e[21]=v):v=e[21];let m;return e[22]!==d||e[23]!==v?(m=i.jsxs("span",{className:"flex flex-col gap-1",children:[d,v]}),e[22]=d,e[23]=v,e[24]=m):m=e[24],m}case"fields":{let a;e[25]!==s.entries?(a=s.entries.map(Kc),e[25]=s.entries,e[26]=a):a=e[26];let u;return e[27]!==a?(u=i.jsx("dl",{className:"grid grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-0.5",children:a}),e[27]=a,e[28]=u):u=e[28],u}}}function Kc(n){return i.jsxs("div",{className:"contents",children:[i.jsx("dt",{className:"text-muted-foreground",children:n.label}),i.jsx("dd",{className:"truncate",children:n.text})]},n.label)}function Fc(n,e){return i.jsx("span",{className:"truncate",children:`${e+1}. ${n||"…"}`},e)}function Oc(n,e){return n.kind==="protocol"&&n.source==="github"?e:null}function Lc(n,e){if(Object.hasOwn(n,e))return n[e]??null;const s=Yr(e),o=Object.keys(n).find(a=>Yr(a)===s);return o===void 0?null:n[o]??null}async function $c(n,e){try{const s=await fetch(`/api/${n.orgSlug}/decofile/${encodeURIComponent(n.virtualMcpId)}/${encodeURIComponent(n.branch)}`,{cache:"no-store",headers:Na("v8")});if(!s.ok)return null;const o=await s.json().catch(()=>({})),a=Lc(o.changedBy??{},e);return a&&typeof a.userId=="string"&&Number.isFinite(Date.parse(a.at))?a:null}catch{return null}}function zc(n,e,s){const o=e.find(h=>h.userId===n.userId),a=o?.user?.name?.trim(),u=o?.user?.image??void 0;return{...a?{name:a}:{},...u?{avatarUrl:u}:{},at:n.at,you:!!s&&n.userId===s}}function Hc(n){let e=2166136261,s=0;for(let o=0;o<n.length;o++){const a=n.charCodeAt(o);e=Math.imul(e^a,16777619),s=Math.imul(s,31)+a|0}return`${(e>>>0).toString(36)}${(s>>>0).toString(36)}:${n.length}`}function qc(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}=Wi(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 Wc(n,e,s,o){if(!n||typeof n!="object")return{kind:"error",reason:"no-matcher-rule"};const a=e.trim();if(!a)return Gt(n,s,o)?{kind:"inline",blockKey:n.__resolveType??"",inlinedRule:xs(n,s,o)}:{kind:"noop"};const u=ys(n,s,o);if(!u)return{kind:"error",reason:"unreadable-rule"};if(u.blockKey)return{kind:"updateBlock",blockKey:u.blockKey,blockData:Kt(u.resolveType,u.data,a)};const h=Fn(a),d=On(h,s);return d?{kind:"error",reason:"invalid-block-id",message:d}:{kind:"createBlock",blockId:h,blockData:Kt(u.resolveType,u.data,a),reference:on(h)}}const ho="section-form-stale-save",Gc=3,Uc=1e3;function go(n,e){const s=e.global&&e.pageKey?[{label:"Default",sections:[{__resolveType:e.pageKey}]}]:So(e.pageKey?n[e.pageKey]?.sections:void 0,n),o=Math.max(0,Math.min(e.pageVariantIndex,s.length-1)),a=s[o]?.sections??[];return{pageVariants:s,variantIndex:o,rawSections:a,parsedSections:_n(a,n)}}const vo=new WeakMap;let Yc=0;function Jc(n){let e=vo.get(n);return e===void 0&&(e=++Yc,vo.set(n,e)),e}function tm({orgSlug:n,virtualMcpId:e,branch:s,previewReady:o=!0,previewUrl:a,currentPath:u,activePageBlockKey:h=null,activeGlobalBlockKey:d=null,externalSelection:v,onSaved:m,initialEditSeo:j=!1,onExitSeo:A,onSelectRoot:$,onViewJsonFile:z,onFocusedBlockChange:H,onVariantPreviewOverride:F}){const f=Ft(),k=Yi(),X=k?.taskId??null,w=o?{orgSlug:n,virtualMcpId:e,branch:s,threadId:X,previewUrl:a}:null,[I,V]=R.useState([]),{data:y,isLoading:C}=Ta(w,{pollWhile:I.length>0}),{data:x,isLoading:Y}=ia(w),M=qn(),ge=k?.virtualMcpId,le=ka(ge===e?e:null)?.metadata?.siteSlug??null,ee=Rl({virtualMcpId:e,branch:s,sandboxUrl:a}),pe=Va(e,s),ce=Da(pe),he=!ce,ve=!!ee||ce,[b,B]=R.useState(null),[xe,T]=R.useState(null),[ye,K]=R.useState(null),[Se,ue]=R.useState(0),[te,se]=R.useState(void 0),[Te,Z]=R.useState(null),[_e,be]=R.useState(null),[W,O]=R.useState([]),Ke=R.useRef(null),[Qe,Xe]=R.useState(W.length);Qe!==W.length&&(Xe(W.length),requestAnimationFrame(()=>{Ke.current&&(Ke.current.scrollTop=0)}));const[Ye,Q]=R.useState(0),[ke,He]=R.useState(null),[qe,Ee]=R.useState(null),[Ie,Ve]=R.useState(null),[Ze,Fe]=R.useState(!1),[re,dt]=R.useState(!1),ne=R.useRef(null),[De,yt]=R.useState(!0),[et,ft]=R.useState(!1),[Ot,kn]=R.useState(!1),[We,an]=R.useState(j),[Cs,Ns]=R.useState(j);j&&!Cs&&(Ns(!0),an(!0),B(null),T(null),K(null),O([])),!j&&Cs&&Ns(!1);const[Do,ln]=R.useState(null),[Ts,En]=R.useState(void 0),[Vs,Lt]=R.useState([]),[Ds,Yt]=R.useState(0),[Je,at]=R.useState(0),[Mo,tt]=R.useState(null),[Jt,st]=R.useState(null),[Ms,Ps]=R.useState(null),Is=Gi(),Bs=Ma({orgSlug:n,virtualMcpId:e,branch:s},{tunnel:!1}),cn=aa({orgSlug:n,virtualMcpId:e,branch:s}),[Po,Io]=R.useState(u),[Bo,Ko]=R.useState(h),[Fo,Oo]=R.useState(d);(Po!==u||Bo!==h||Fo!==d)&&(queueMicrotask(()=>cn.flush()),Io(u),Ko(h),Oo(d),B(null),T(null),K(null),ue(0),Z(null),be(null),at(0),tt(null),st(null),O([]),Q(t=>t+1),an(!1),ln(null),En(void 0),Lt([]),Yt(t=>t+1));const G=la({orgSlug:n,virtualMcpId:e,branch:s}),un=ja((t,r)=>{G.mutate({blockKey:t,data:r},{onSuccess:()=>m?.(),onError:G.reportError})}),Rn=Oa({orgSlug:n,virtualMcpId:e,branch:s}),[Qt,Xt]=R.useState(!1),q=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([]),Wn=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[q,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=qc(Oc(pe,{orgSlug:n,virtualMcpId:e,branch:s}),I[0]?.blockKey??null,I[0]?Hc(ze(I[0].plan.theirs)):null),[Ho,qo]=R.useState(null),Gn=Ia(n,e).epoch,[Wo,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:qa(Uo,u,h),E=ie?d:je?.key??null,Un=ie&&d?y[d]:void 0,Os=ie&&d&&Un?Wa(d,Un):ie&&d?d:"",mn=!ie&&E&&y[E]?y[E]:null,Yn=We&&y&&x&&E&&je?Kr(y,{kind:"page",pageKey:E,pageName:String(je.name??""),path:String(je.path??"")},x):null,Yo=We?mn?.seo:void 0,Cn=Ts!==void 0?Ts:Yo,Jo=We?ca(Cn):void 0,Ls=Yn?.seoTypeOptions??[],$s=We&&x?ua(x):"",Jn=Do??Jo??{},Nn=We&&Yn?Bl(Jn,Yn):null,zs=We&&Nn&&da(Cn)?Kn(Nn,x):null,Hs=We?fa(y,x)?.seoData:void 0,Me=ie?[{label:"Default",sections:[{__resolveType:d}]}]:So(mn?.sections,y??{}),ht=Me.length>1,we=Math.min(Se,Me.length-1),rt=Me[we],U=rt?.sections??[],Pe=_n(U,y),Qn=!ie&&Ga(mn?.sections);if(ie&&d&&Ms!==d){Ps(d);const t=U[0],r=Pe[0];if(t&&r){B(0),at(0),O([]);const l=jt(t,r,y);l&&(T(l.data),K(l.resolveType),st(null),tt(null))}}!ie&&Ms!==null&&Ps(null),Le.current={rawSections:U,parsedSections:Pe,decofile:y??{},activePageKey:E,pageVariants:Me,variantIndex:we,sectionVariantIndex:Je,selectedSectionIndex:b};const Qo=()=>({multivariate:Qn,index:we,variants:Me.map(t=>({rule:t.rule}))}),Xn=(t,r)=>{if(!F)return;if(!E||!Qn||t.length<=1){F(null);return}const l={multivariate:!0,index:r,variants:t},c=ce?ro(E,l):oo(E,l,y,x);F(c.length>0?c:null)},Zn=F&&E&&Qn&&ht&&!C&&!Y?E:null;if(Zn!==Ho&&(qo(Zn),Zn)){const t=Me.map(l=>({rule:l.rule})),r=we;queueMicrotask(()=>Xn(t,r))}const en=(t,r,l)=>{if(!F)return;if(!E){F(null);return}const c=Qo(),p=ce?ro(E,c):oo(E,c,y,x);if(!t||r<0){F(p.length>0?p:null);return}const S={pageKey:E,page:c,sectionIndex:r,sectionLazy:Pe[r]?.isLazy??!1,mvObj:t,selectedVariantIndex:l},g=ce?Fl(S):Ol({...S,decofile:y,meta:x}),_=[...p,...g];F(_.length>0?_:null)},bt=(t,r,l,c=b??-1,p=!1)=>{const S=xt(t,r);if(!S){T(null),K(null),st(null),tt(null),p&&en(null,c,l);return}const _=vs(S,wt)[l];if(!_){T(null),K(null),st(null),tt(null),p&&en(null,c,l);return}const L=wo(_.value,y);T(L?.data??null),K(L?.resolveType??null);const{resolveType:N,formValue:D}=jn(_.rule,y,x??void 0);st(N),tt(D),p&&en(S,c,l)},pn=v?.index;if(v!==void 0&&(v?.seq??null)!==te&&(se(v?.seq??null),typeof pn=="number")){const t=U[pn],r=Pe[pn];if(t&&r)if(B(pn),at(0),O([]),Q(l=>l+1),r.isMultivariate)bt(t,r,0,pn);else{const l=jt(t,r,y);l?(T(l.data),K(l.resolveType)):(T(null),K(null)),st(null),tt(null)}}if(Gn!==Wo){Go(Gn);const t=q.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&&We&&(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;q.current&&(clearTimeout(q.current),q.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)},qs=()=>co(Ke.current,document.activeElement),es=(t=f("sectionsEditor.sectionsEditor.blockChangedElsewhere"))=>{if(q.current&&(clearTimeout(q.current),q.current=null),Oe.current.clear(),At.current=null,oe.error(t,{id:ho}),qs()){Zt.current=!0;return}Fs(r=>r+1)},Ws=()=>{!Zt.current||qs()||St.current.length>0||q.current!==null||dn.current||fn.current||Oe.current.size>0||(Zt.current=!1,Fs(t=>t+1))},Gs=()=>{Zt.current&&setTimeout(Ws,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:Wn.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;q.current&&At.current?.sectionIndex===r.sectionIndex&&At.current.sectionVariantIndex===l.sectionVariantIndex&&(clearTimeout(q.current),q.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,Wn.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;q.current&&(clearTimeout(q.current),q.current=null,_&&(_.sectionIndex!==r||_.sectionVariantIndex!==S)&&_.write());const L=`${p.pageKey}:${r}:${S}`,N=()=>{if(dn.current||fn.current){Oe.current.set(L,N);return}const D=typeof t=="function"?t():t;if(g&&Js(g,D))return;const P=Le.current.decofile,{rawSections:de,parsedSections:Re,pageVariants:nt,variantIndex:Be}=go(P,p),Ge=p.pageKey,J=de[r];if(!J)return;const fe=Re[r];if(!fe)return;const Ce=g?.base,Ue=hs(J,fe,S,P),gt=!!Ce&&!!Ue&&Ao(Ce,Ue)&&!(g&&ao(g,Ue));if(gt&&Ce&&Ue){if(Co(Ce,Ue)){es(f("sectionsEditor.sectionsEditor.sectionReplacedElsewhere"));return}const Ae=fe.isSavedBlock?"here":rc(Ce,de.map((Ne,Mt)=>hs(Ne,Re[Mt],S,P)),r,g?.sectionCount??de.length);if(Ae==="unknown"){es(f("sectionsEditor.sectionsEditor.sectionReplacedElsewhere"));return}if(typeof Ae=="number"&&g){g.sectionCount=de.length,g.sectionIndex=Ae,$t.current===g&&B(Ae),vn(D,Ae,l,p);return}}const ot=gt&&Ce&&Ue?ws({ancestor:Ce,mine:D,theirs:Ue}):null;if(ot&&ot.pointers.length>0&&g){g.sectionCount=de.length,Zo({plan:ot,formBase:g,target:p,sectionIndex:r,choices:No(ot),changedAgain:!1,blockKey:fe.isSavedBlock?ds(J,fe):Ge,fresh:{}});return}const vt=ot?ot.merged:null,Dt=vt??D,Mr=oc({merged:!!vt,tracked:g,current:$t.current,saved:D});vt&&oe.info(f("sectionsEditor.sectionsEditor.blockMergedWithOthers"),{id:ho}),Mr&&g&&(g.emitted=vt,T(vt));const cs=Mr||!vt?Dt:D;g&&(g.base=cs,g.sectionCount=de.length,nc(g,cs));const Pr={onSuccess:()=>{g&&Wn.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),Ws()})};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]},qt=[...de];if(fe.isMultivariate){const Ae=xt(J,fe);if(!Ae||!Ge)return;const Ne=al(Ae,S,Dt);qt[r]=Wt(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?qt[r]={...J,section:Ne}:qt[r]=Ne}else fe.isLazy?qt[r]={...J,section:Dt}:qt[r]=Dt;if(nt.length>1){const Ae=In.sections,Ne=[...Ae?.variants??[]];Ne[Be]&&(Ne[Be]={...Ne[Be],value:qt}),In.sections={...Ae,variants:Ne}}else In.sections=qt;Ir({blockKey:Ge,data:In,rebaseOnConflict:!1,guard:lo({formBase:null,rebased:!1,versionOf:Us})})};At.current={sectionIndex:r,sectionVariantIndex:S,write:N},q.current=setTimeout(()=>{q.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]=Wt(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]=Wt(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]=Wt(l,c,S);let _=Je;Je===t?_=r:t<Je&&r>=Je?_=Je-1:t>Je&&r<=Je&&(_=Je+1),at(_),bt(g[b],c,_),ct(g)},xn=t=>{const r=t??b;if(r===null||!E)return;const l=U[r],c=Pe[r];if(!l||!c)return;const p=Ua(l,c);if(!p){oe.error(f("sectionsEditor.sectionsEditor.sectionCannotHaveVariants"));return}const S=[...U];S[r]=p.section;const g=_n(S,y)[r];if(!g?.isMultivariate){oe.error(f("sectionsEditor.sectionsEditor.couldNotAddVariant"));return}B(r),at(p.newVariantIndex),O([]),Q(_=>_+1),bt(p.section,g,p.newVariantIndex,r),ct(S)},tr=()=>{if(b===null||!E)return;const t=U[b],r=Pe[b];if(!t||!r?.isMultivariate)return;const l=xt(t,r);if(!l)return;const c=Xa(t,r,l);if(!c){oe.error(f("sectionsEditor.sectionsEditor.couldNotRemoveVariants"));return}const p=[...U];p[b]=c;const S=_n(p,y)[b];if(!S)return;at(0),st(null),tt(null),O([]),Q(_=>_+1);const g=jt(c,S,y);g?(T(g.data),K(g.resolveType)):(T(null),K(null)),en(null,b,0),ct(p)},gi=async t=>{if(ke===null||!E)return;const r=On(t,y,x);if(r){oe.error(r);return}const l=U[ke],c=Pe[ke];if(!l||!c)return;const p=jt(l,c,y);if(!p){oe.error(f("sectionsEditor.sectionsEditor.sectionCannotBeSavedAsGlobal"));return}const S={...p.data,name:t};try{await G.mutateAsync({blockKey:t,data:S});const g=[...U];g[ke]={__resolveType:t},await G.mutateAsync({blockKey:E,data:Sn(y,E,g,we,Me)}),b===ke&&zt(),He(null),oe.success(f("sectionsEditor.sectionsEditor.savedGlobalBlock",{blockId:t})),m?.()}catch(g){oe.error(f("sectionsEditor.sectionsEditor.failedToSaveGlobalBlock"),{description:Pt(f,It(g))})}},nr=rt?.rule;if(ht&&b===null&&_e===null&&nr){const{resolveType:t,formValue:r}=jn(nr,y??{},x??void 0);be(t),Z(r)}const tn=x?ma(x):[],ns=x&&y?pa(x,y):[],sr=!ie&&!!(ve&&x&&y),rr=_e&&x?Kn(_e,x):null,Ct=()=>{mt.current&&(clearTimeout(mt.current),mt.current=null),pt.current&&(clearTimeout(pt.current),pt.current=null)},Ht=async(t,r)=>{if(!(il(r,t,x)>0))try{await Rn.mutateAsync({blockKey:t})}catch(l){oe.error(f("sectionsEditor.sectionsEditor.couldNotDeleteMatcherBlock"),{description:Pt(f,It(l))})}},or=t=>{mt.current&&clearTimeout(mt.current),mt.current=setTimeout(()=>{const{activePageKey:r,decofile:l,variantIndex:c}=Le.current;if(!r)return;const p={...l[r]},S={...p.sections},g=[...S.variants??[]],_=g[c],L=_?.rule;if(Gt(L,l,x)){const N=L?.__resolveType??"",D=l[N],P=typeof D?.name=="string"?D.name:N,{__resolveType:de,...Re}=t;G.mutate({blockKey:N,data:Kt(de??"",Re,P)},{onSuccess:()=>m?.(),onError:G.reportError});return}_&&(g[c]={..._,rule:t}),p.sections={...S,variants:g},G.mutate({blockKey:r,data:p},{onSuccess:()=>m?.(),onError:G.reportError})},bn)},ir=t=>{be(t);const r=t?Jr(t,x):{__resolveType:Qr};Z(t?r:{}),or(r)},ar=t=>{const r=t;Z(r);const l=_e?{__resolveType:_e,...r}:{...r};or(l)},lr=async t=>{Ct();const{activePageKey:r,decofile:l,variantIndex:c}=Le.current;if(!r)return;const p=l[r],S=p?.sections;if(!S||typeof S!="object"||Array.isArray(S))return;const g=S;if(!Array.isArray(g.variants))return;const _=[...g.variants],L=_[c];if(!L)return;const N=Bt(L.rule,l,x),D=on(t);_[c]={...L,rule:D};const P={...l,[r]:{...p,sections:{...g,variants:_}}},{resolveType:de,formValue:Re}=jn(D,P,x??void 0);be(de),Z(Re);try{await G.mutateAsync({blockKey:r,data:P[r]}),N&&N!==t&&await Ht(N,P),m?.()}catch(nt){oe.error(f("sectionsEditor.sectionsEditor.couldNotApplySavedRule"),{description:Pt(f,It(nt))})}},cr=t=>{pt.current&&clearTimeout(pt.current);const{selectedSectionIndex:r,sectionVariantIndex:l}=Le.current;r!==null&&(pt.current=setTimeout(()=>{const{rawSections:c,parsedSections:p,decofile:S,activePageKey:g,pageVariants:_,variantIndex:L}=Le.current;if(!g)return;const N=c[r],D=p[r];if(!N||!D?.isMultivariate)return;const P=xt(N,D);if(!P)return;const Re=(P.variants??[])[l]?.rule;if(Gt(Re,S,x)){const J=Re?.__resolveType??"",fe=S[J],Ce=typeof fe?.name=="string"?fe.name:J,{__resolveType:Ue,...gt}=t;G.mutate({blockKey:J,data:Kt(Ue??"",gt,Ce)},{onSuccess:()=>m?.(),onError:G.reportError});return}const nt=Xr(P,l,t),Be=[...c];Be[r]=Wt(N,D,nt);const Ge=Sn(S,g,Be,L,_);G.mutate({blockKey:g,data:Ge},{onSuccess:()=>m?.(),onError:G.reportError})},bn))},vi=t=>{st(t);const r=t?Jr(t,x):{__resolveType:Qr};tt(t?r:{}),cr(r)},xi=t=>{const r=t;tt(r);const l=Jt?{__resolveType:Jt,...r}:{...r};cr(l)},yi=async t=>{Ct();const{selectedSectionIndex:r,sectionVariantIndex:l,rawSections:c,parsedSections:p,decofile:S,activePageKey:g,pageVariants:_,variantIndex:L}=Le.current;if(r===null||!g)return;const N=c[r],D=p[r];if(!N||!D?.isMultivariate)return;const P=xt(N,D);if(!P)return;const de=P.variants??[],Re=Bt(de[l]?.rule,S,x),nt=on(t),Be=Xr(P,l,nt),Ge=[...c];Ge[r]=Wt(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||W.length>0)?ie?[Os,...W]:[rs,...ji,...W]:[],hr=We&&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&&W.length===0&&!!$e&&jo($e)&&!!E,ki=M&&Vt&&!Ot&&Tt&&W.length===0&&!!nn,yr=M&&W.length>0?Fr(W[W.length-1]):null,Ei=W.length>1?Fr(W[W.length-2]):null,Sr=ut?fr:Vt?$e?.label??"":je?.name??"",Ri=et||Ot?f("sectionsEditor.pageVariantTabs.variantsLabel"):We?f("sectionsEditor.panelSections.seo"):yr??Sr,br=Ot?$e?.variantOf??$e?.label??"":et||We?je?.name??"":yr?Ei??Sr:ut?f("sectionsEditor.sectionsEditor.globalSectionSubtitle"):Vt?je?.name??"":je?.path??"",os=!et&&!Ot&&!We&&!Vt&&!ut,Ai=!M&&!We&&!ie&&Tt&&W.length===0,yn=()=>{if(!E)return;Ct(),q.current&&(clearTimeout(q.current),q.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(),q.current&&(clearTimeout(q.current),q.current=null),Oe.current.clear();const c=y[E],p=c.sections;if(!p||typeof p!="object"||Array.isArray(p))return;const S=p;if(!Array.isArray(S.variants))return;const g=t([...S.variants]);if(!g)return;const _=ol(S,g),L={...y,[E]:{...c,sections:_}};G.mutate({blockKey:E,data:L[E]},{onSuccess:()=>{r?.();const N=typeof l=="string"?[l]:l??[];(async()=>{for(const D of N)await Ht(D,L)})()},onError:G.reportError})},is=t=>{Ee(null),ue(t),B(null),T(null),K(null),O([]);const r=Me[t]?.rule,{resolveType:l,formValue:c}=jn(r,y??{},x??void 0);be(l),Z(c),Xn(Me.map(p=>({rule:p.rule})),t)},jr=(t,r)=>{if(t===r)return;let l=we;we===t?l=r:t<we&&r>=we?l=we-1:t>we&&r<=we&&(l=we+1),ue(l);const c=Ln(Me.map(p=>({rule:p.rule})),t,r);Xn(c,l),Pn(p=>Ln(p,t,r))},wr=t=>{const r=Me[t]?.rule,l=Bt(r,y??{},x??void 0);Pn(c=>c.length<=1?null:(c.splice(t,1),c),()=>{Me.length-1===1?ue(0):t<we?ue(we-1):t===we&&ue(Math.max(0,t-1)),B(null),T(null),K(null),O([]),Z(null),be(null)},l)},Ci=()=>{const t=Me.map((r,l)=>({variant:r,index:l})).filter(({variant:r})=>!rl(r.rule)).map(({variant:r})=>Bt(r.rule,y??{},x??void 0)).filter(r=>!!r);Pn(r=>{const l=ll({variants:r}),c=r[l];return c?[{...c,rule:cl()}]:null},()=>{ue(0),B(null),T(null),K(null),O([]),Z(null),be(null),ft(!1)},t)},_r=t=>{Pn(r=>ul(r,t),()=>{ue(t+1),B(null),T(null),K(null),O([]),Z(null),be(null)})},Ni=async(t,r)=>{Ct(),q.current&&(clearTimeout(q.current),q.current=null),Oe.current.clear();const l=Le.current.activePageKey,c=Le.current.decofile;if(!l)return;const p=c[l],S=p.sections;if(!S||typeof S!="object"||Array.isArray(S))return;const g=S;if(!Array.isArray(g.variants))return;const _=[...g.variants],L=_[t];if(!L?.rule||typeof L.rule!="object"){oe.error(f("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const N=L.rule,D=r.trim();Xt(!0);try{if(!D){if(!Gt(N,c,x)){Ee(null);return}const Ge=N.__resolveType??"";_[t]={...L,rule:xs(N,c,x)};const J={...c,[l]:{...p,sections:{...g,variants:_}}};await G.mutateAsync({blockKey:l,data:J[l]}),await Ht(Ge,J),Ee(null),m?.();return}const P=ys(N,c,x);if(!P){oe.error(f("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(P.blockKey){await G.mutateAsync({blockKey:P.blockKey,data:Kt(P.resolveType,P.data,D)}),Ee(null),m?.();return}const de=Fn(D),Re=On(de,c,x);if(Re){oe.error(Re);return}const nt=Kt(P.resolveType,P.data,D);let Be=null;try{await G.mutateAsync({blockKey:de,data:nt}),Be=de,_[t]={...L,rule:on(de)},await G.mutateAsync({blockKey:l,data:{...p,sections:{...g,variants:_}}}),Be=null}catch(Ge){throw Be&&await Rn.mutateAsync({blockKey:Be}).catch(()=>{}),Ge}Ee(null),oe.success(f("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:D})),m?.()}catch(P){oe.error(f("sectionsEditor.sectionsEditor.failedToRenameVariant"),{description:Pt(f,It(P))})}finally{Xt(!1)}},Ti=async(t,r)=>{Ct(),q.current&&(clearTimeout(q.current),q.current=null),Oe.current.clear();const{selectedSectionIndex:l,rawSections:c,parsedSections:p,decofile:S,activePageKey:g,pageVariants:_,variantIndex:L}=Le.current;if(l===null||!g)return;const N=c[l],D=p[l];if(!N||!D?.isMultivariate)return;const P=xt(N,D);if(!P)return;const de=P.variants??[],Re=de[t];if(!Re?.rule||typeof Re.rule!="object"){oe.error(f("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const nt=Re.rule,Be=r.trim();Xt(!0);const Ge=async J=>{const fe={...P,variants:J},Ce=[...c];Ce[l]=Wt(N,D,fe);const Ue=Sn(S,g,Ce,L,_);return await G.mutateAsync({blockKey:g,data:Ue}),{...S,[g]:Ue}};try{if(!Be){if(!Gt(nt,S,x)){Ve(null);return}const ot=nt.__resolveType??"",vt=[...de];vt[t]={...Re,rule:xs(nt,S,x)};const Dt=await Ge(vt);await Ht(ot,Dt),Ve(null),m?.();return}const J=ys(nt,S,x);if(!J){oe.error(f("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(J.blockKey){await G.mutateAsync({blockKey:J.blockKey,data:Kt(J.resolveType,J.data,Be)}),Ve(null),m?.();return}const fe=Fn(Be),Ce=On(fe,S,x);if(Ce){oe.error(Ce);return}const Ue=Kt(J.resolveType,J.data,Be);let gt=null;try{await G.mutateAsync({blockKey:fe,data:Ue}),gt=fe;const ot=[...de];ot[t]={...Re,rule:on(fe)},await Ge(ot),gt=null}catch(ot){throw gt&&await Rn.mutateAsync({blockKey:gt}).catch(()=>{}),ot}Ve(null),oe.success(f("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:Be})),m?.()}catch(J){oe.error(f("sectionsEditor.sectionsEditor.failedToRenameVariant"),{description:Pt(f,It(J))})}finally{Xt(!1)}},kr=async(t,r,l)=>{T(l);try{await G.mutateAsync({blockKey:t,data:l})}catch(c){throw T(p=>p===l?r:p),c}},Vi={rename:async(t,r,l)=>{Ct(),q.current&&(clearTimeout(q.current),q.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=Wc(_,l,p,x);if(N.kind!=="noop"){if(N.kind==="error"){oe.error(N.reason==="no-matcher-rule"?f("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"):N.reason==="unreadable-rule"?f("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"):N.message??f("sectionsEditor.sectionsEditor.failedToRenameVariant"));return}Xt(!0);try{if(N.kind==="inline"){const P=[...S];P[r]={...g,rule:N.inlinedRule};const de=await L(P);await Ht(N.blockKey,de),m?.();return}if(N.kind==="updateBlock"){await G.mutateAsync({blockKey:N.blockKey,data:N.blockData}),m?.();return}let D=null;try{await G.mutateAsync({blockKey:N.blockId,data:N.blockData}),D=N.blockId;const P=[...S];P[r]={...g,rule:N.reference},await L(P),D=null}catch(P){throw D&&await Rn.mutateAsync({blockKey:D}).catch(()=>{}),P}oe.success(f("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:l.trim()})),m?.()}catch(D){oe.error(f("sectionsEditor.sectionsEditor.failedToRenameVariant"),{description:Pt(f,It(D))})}finally{Xt(!1)}}},selectGlobal:async(t,r,l)=>{Ct(),q.current&&(clearTimeout(q.current),q.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=()=>{We&&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(We){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(W.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(W.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||We?wi&&i.jsxs("div",{className:ae("border-b px-3 py-2.5",ut&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[!ie&&ht&&rt&&i.jsxs("button",{type:"button",onClick:Er,title:f("sectionsEditor.sectionsEditor.editingInVariant",{variant:rt.label}),className:ae("shrink-0 inline-flex items-center gap-1 rounded-lg h-6 px-1.5 text-xs font-medium cursor-pointer transition-opacity hover:opacity-80",ga),children:[i.jsx(ha,{rule:fs(rt.rule,y??{},x??void 0),matchers:tn}),i.jsx("span",{className:"max-w-[160px] truncate",children:rt.label})]}),i.jsx("div",{className:"flex-1"}),ut&&i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx("span",{className:"shrink-0 cursor-help",children:i.jsx(zn,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),i.jsx(Rt,{side:"bottom",className:"max-w-[260px]",children:f("sectionsEditor.sectionsEditor.globalSectionTooltip")})]}),xr&&i.jsx(Bn,{onClick:()=>xn()})]}),ut&&i.jsx("p",{className:"mt-1.5 py-1.5 pl-1 text-sm leading-snug text-foreground",children:f("sectionsEditor.sectionsEditor.globalSectionBanner")})]}):i.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2.5",children:[i.jsx("div",{className:"flex-1 min-w-0",children:i.jsx(Or,{pageKey:E,initialName:je.name,initialPath:je.path,onFieldChange:Xs,variant:"header"})}),i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"ghost",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.editSeo"),className:"size-7 shrink-0",onClick:()=>an(!0),children:i.jsx(Gr,{size:14})})}),i.jsx(Rt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.editSeo")})]}),i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"ghost",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.viewJson"),className:"size-7 shrink-0",onClick:()=>z&&E?z():dt(!0),children:i.jsx(Ur,{size:14})})}),i.jsx(Rt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.viewJson")})]}),i.jsx(Bn,{onClick:yn})]}),Bi=i.jsxs(i.Fragment,{children:[ht&&E&&i.jsx(Lr,{listKey:E,variants:Me,activeIndex:we,decofile:y??{},meta:x,matchers:tn,onSelect:is,onReorder:jr,onRename:Ee,onDuplicate:_r,onDelete:wr,onAdd:yn}),ht&&_e!==null&&i.jsx($r,{className:"mt-3",children:i.jsx("div",{className:ae("space-y-3",Qt&&"pointer-events-none opacity-50"),children:i.jsx(us,{currentRt:_e,currentLabel:wn(rt?.rule,y??{},wt,x??void 0),currentGlobalKey:Bt(rt?.rule,y??{},x??void 0)??void 0,matchers:tn,globals:ns,onSelect:ir,onSelectGlobal:lr,schema:rr,formValue:Te,onChange:ar,formKey:`${we}:${_e??""}`,formWrapperClassName:"space-y-3",meta:x??void 0,decofile:y,onSaveReferencedBlock:un,sandbox:hn})})})]}),Vr=i.jsxs(i.Fragment,{children:[i.jsx(va,{listKey:`${E??""}:${b??""}`,variants:Nt.map((t,r)=>({index:r,label:t.label})),selectedIndex:Vn,onSelect:er,onRename:Ve,onDuplicate:pi,onDelete:mi,onRemoveAll:tr,onReorder:hi,onAdd:()=>xn()}),i.jsx($r,{children:i.jsx(us,{currentRt:Jt??"",currentLabel:wn(nn?.rule,y??{},wt,x??void 0),currentGlobalKey:Bt(nn?.rule,y??{},x??void 0)??void 0,matchers:tn,globals:ns,onSelect:vi,onSelectGlobal:yi,schema:bi,formValue:Mo,onChange:xi,formKey:`${b??"none"}:${Vn}:${Jt??""}`,formWrapperClassName:"pt-1",meta:x??void 0,decofile:y,onSaveReferencedBlock:un,sandbox:hn})})]}),Dr=i.jsx("div",{className:ae(M?"px-2":"p-2 pt-3"),children:i.jsx(Zl,{listKey:`${E??""}-${we}`,rawSections:U,sections:Pe,meta:x,decofile:y,selectedIndex:b,onSelect:ri,onReorder:oi,onDelete:ii,onDuplicate:ai,onMakeReusable:He,onToggleHidden:li,onToggleLazy:he?ci:void 0,onAddVariant:xn,onDetach:ui,onAddSection:()=>Fe(!0),canAddSection:sr})}),Ki=i.jsxs("div",{className:"min-w-0 max-w-full space-y-4 overflow-x-hidden px-3",children:[E&&je&&i.jsx(Or,{pageKey:E,initialName:je.name,initialPath:je.path,onFieldChange:Xs}),mn&&E?i.jsx(so,{rawSeo:Cn,innerSeo:Jn,defaultResolveType:$s,seoSchema:zs,activeResolveType:Nn,seoTypeOptions:Ls,formResetKey:Ds,siteDefaultSeo:Hs,onBreadcrumbChange:Lt,onPersistRaw:Ar,onInnerChange:Rr,onClearForm:Cr,onBumpFormKey:Nr,asyncRenderAvailable:he}):i.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:f("sectionsEditor.sectionsEditor.seoSchemaNotFound")})]}),Fi=i.jsx(rn,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:i.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:i.jsx("div",{className:"mx-auto max-w-2xl",children:mn&&E?i.jsx(so,{rawSeo:Cn,innerSeo:Jn,defaultResolveType:$s,seoSchema:zs,activeResolveType:Nn,seoTypeOptions:Ls,formResetKey:Ds,siteDefaultSeo:Hs,onBreadcrumbChange:Lt,onPersistRaw:Ar,onInnerChange:Rr,onClearForm:Cr,onBumpFormKey:Nr,asyncRenderAvailable:he}):i.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:f("sectionsEditor.sectionsEditor.seoSchemaNotFound")})})})},"editor-seo"),Oi=i.jsxs(rn,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[ht&&E&&i.jsx(Lr,{listKey:E,variants:Me,activeIndex:we,decofile:y??{},meta:x,matchers:tn,onSelect:is,onReorder:jr,onRename:Ee,onDuplicate:_r,onDelete:wr,onAdd:yn}),ht&&_e!==null&&i.jsxs("div",{className:ae("px-3 border-b",De?"pt-3 pb-5 space-y-3":"py-2"),children:[i.jsxs("button",{type:"button",onClick:()=>yt(t=>!t),className:"flex w-full items-center justify-between gap-2 text-left cursor-pointer rounded-[var(--studio-control-radius,var(--radius-sm))] py-0.5 hover:bg-muted/40","aria-expanded":De,children:[i.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:f("sectionsEditor.sectionsEditor.variantRule")}),De?i.jsx(Ea,{className:"size-3.5 shrink-0 text-muted-foreground"}):i.jsx(Ra,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),De&&i.jsx("div",{className:ae("space-y-3",Qt&&"pointer-events-none opacity-50"),children:i.jsx(us,{currentRt:_e,currentLabel:wn(rt?.rule,y??{},wt,x??void 0),currentGlobalKey:Bt(rt?.rule,y??{},x??void 0)??void 0,matchers:tn,globals:ns,onSelect:ir,onSelectGlobal:lr,schema:rr,formValue:Te,onChange:ar,formKey:`${we}:${_e??""}`,formWrapperClassName:"space-y-3",meta:x??void 0,decofile:y,onSaveReferencedBlock:un,sandbox:hn})})]}),Dr]},"editor-section-list");return i.jsx(xa,{children:i.jsxs("div",{className:"flex h-full min-w-0 w-full flex-col",children:[!M&&ls&&i.jsx("div",{className:"flex min-w-0 shrink-0 items-center gap-2 px-3 py-2",children:ls}),(M||Mn.length>1)&&i.jsx(ya,{crumbs:Mn,onSelect:as,onSelectRoot:()=>{cn.flush(),$?$():as(0)}}),i.jsx("div",{className:"shrink-0",children:M?i.jsxs("div",{className:ae("flex items-center gap-2 border-b px-3 py-2.5",ut&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[M&&ls,ut&&i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx("span",{className:"shrink-0 cursor-help",children:i.jsx(zn,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),i.jsx(Rt,{side:"bottom",className:"max-w-[260px]",children:f("sectionsEditor.sectionsEditor.globalSectionTooltip")})]}),i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[i.jsx("span",{className:"truncate text-sm font-semibold",children:Ri}),br&&i.jsx("span",{className:"truncate text-xs text-muted-foreground",children:br})]}),os&&ht&&rt&&i.jsx(zr,{variants:Me,activeIndex:we,onSelect:is,onManage:Mi,onRemoveAll:Ci}),ki&&i.jsx(zr,{variants:Nt,activeIndex:Vn,onSelect:er,onManage:Pi,onRemoveAll:tr}),os&&!ht&&i.jsx(Bn,{onClick:yn}),_i&&i.jsx(Bn,{onClick:()=>xn()}),i.jsx(Sa,{}),os&&i.jsxs(i.Fragment,{children:[i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"outline",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.editSeo"),className:"size-7 shrink-0",onClick:Di,children:i.jsx(Gr,{size:14})})}),i.jsx(Rt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.editSeo")})]}),!z&&i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"outline",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.viewJson"),className:"size-7 shrink-0",onClick:()=>dt(!0),children:i.jsx(Ur,{size:14})})}),i.jsx(Rt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.viewJson")})]})]})]}):Ii}),lt&&i.jsx(yc,{open:!0,fields:cc(lt.plan,lt.target.schema),choices:lt.choices,changedAgain:lt.changedAgain,author:zo,fresh:lt.fresh,onChoose:(t,r)=>si({...lt.choices,[t]:r}),onApply:ni},Jc(lt.formBase)),Ot?i.jsx(Hr,{onAdd:()=>xn(),children:Vr},"editor-section-variants"):Vt?i.jsxs(rn,{viewportRef:Ke,onBlur:Gs,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[!M&&Tt&&Nt.length>0&&W.length===0&&Vr,i.jsx(qr,{activeSchema:Tn,formValue:xe,formResetKey:Ye,onFormChange:Qs,onBreadcrumbChange:O,breadcrumbPath:W,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(qr,{activeSchema:Tn,formValue:xe,formResetKey:Ye,onFormChange:Qs,onBreadcrumbChange:O,breadcrumbPath:W,emptyMessage:f("sectionsEditor.sectionsEditor.noEditableFieldsForGlobalBlock"),meta:x,decofile:y,onSaveReferencedBlock:un,sandbox:hn,previewBaseUrl:ee,onRequestAddSection:Zs})},"editor-global-block"):We?M?i.jsx(rn,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:i.jsx("div",{className:"p-3",children:Ki})},"editor-seo"):Fi:et?i.jsx(Hr,{onAdd:yn,children:Bi},"editor-variants"):M?i.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[i.jsx(rn,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:i.jsx("div",{className:"py-2",children:Dr})}),i.jsx("div",{className:"shrink-0 border-t p-2",children:i.jsx(js,{canAddSection:sr,onAddSection:()=>Fe(!0)})})]},"editor-section-list"):Oi,i.jsx(ba,{open:ke!==null,onOpenChange:t=>{t||He(null)},defaultBlockId:ke!==null?Fn(Pe[ke]?.label??""):"",isPending:G.isPending,onSubmit:gi}),ve&&i.jsx(Al,{open:Ze,onOpenChange:t=>{Fe(t),t||(ne.current=null)},meta:x,decofile:y,previewBaseUrl:ee,onSelect:fi}),re&&E&&y&&i.jsx(La,{open:re,onOpenChange:dt,pageKey:E,decofile:y}),qe!==null&&i.jsx(Wr,{open:!0,initialName:Gt(Me[qe]?.rule,y??{},x??void 0)?wn(Me[qe]?.rule,y??{},wt,x??void 0):"",autoLabel:wt(fs(Me[qe]?.rule,y??{},x??void 0)),isPending:Qt,onSubmit:async t=>{await Ni(qe,t)},onOpenChange:t=>{!t&&!Qt&&Ee(null)}}),Ie!==null&&i.jsx(Wr,{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(Dl,{open:s,children:d}),e[7]=s,e[8]=d,e[9]=v):v=e[9],v}function Sc(n,e){return i.jsxs(Nl,{className:"text-left",children:[i.jsx(Tl,{children:n}),i.jsx(Vl,{children:e})]})}function bc(n){n.preventDefault(),n.currentTarget?.focus()}function jc(n){return n.preventDefault()}const wc={},_c=(n,e)=>i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx("h2",{className:"text-lg font-semibold",children:n}),i.jsx("p",{className:"text-sm text-muted-foreground",children:e})]});function kc(n,e,s=0,o={},a=null){const u=e[Math.min(s,e.length-1)],h=a?.you?void 0:a?.name?.split(/\s+/)[0],d={field:u?Rc(u.label):"",label:u?.label??"",name:h??""},v=(m,j,A)=>n(a?.you?A:h?j:m,d);return e.length<=1?{title:v("sectionsEditor.formConflict.titleOne","sectionsEditor.formConflict.titleOneNamed","sectionsEditor.formConflict.titleOneYou"),description:n("sectionsEditor.formConflict.descriptionOne")}:{title:v("sectionsEditor.formConflict.titleStep","sectionsEditor.formConflict.titleStepNamed","sectionsEditor.formConflict.titleStepYou"),description:s>=e.length-1?i.jsx(Ec,{t:n,fields:e,choices:o,name:h}):n("sectionsEditor.formConflict.descriptionStep")}}function Ec(n){const e=it.c(11),{t:s,fields:o,choices:a,name:u}=n;let h;if(e[0]!==a||e[1]!==o||e[2]!==u||e[3]!==s){let v;e[5]!==a||e[6]!==u||e[7]!==s?(v=(m,j)=>i.jsxs(R.Fragment,{children:[j>0&&" · ",`${m.label}: `,i.jsx("span",{className:"font-medium text-foreground",children:s((a[m.pointer]??"mine")==="mine"?"sectionsEditor.formConflict.summaryYours":u?"sectionsEditor.formConflict.summaryTheirsNamed":"sectionsEditor.formConflict.summaryTheirs",{name:u??""})})]},m.pointer),e[5]=a,e[6]=u,e[7]=s,e[8]=v):v=e[8],h=o.map(v),e[0]=a,e[1]=o,e[2]=u,e[3]=s,e[4]=h}else h=e[4];let d;return e[9]!==h?(d=i.jsx("span",{"data-testid":"form-conflict-summary",children:h}),e[9]=h,e[10]=d):d=e[10],d}function Rc(n){return/^[A-Z][a-z]/.test(n)&&!n.includes("›")?n.charAt(0).toLowerCase()+n.slice(1):n}function Ac(n){const e=it.c(68),s=Ft(),{fields:o,choices:a,changedAgain:u,fresh:h,heading:d}=n,v=u===void 0?!1:u,m=h===void 0?wc:h,j=d===void 0?_c:d,A=o.length>1,[$,z]=R.useState(0),[H,F]=R.useState(Cc);let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f={},e[0]=f):f=e[0];const[k,X]=R.useState(f),w=Math.max(0,Math.min($,o.length-1)),I=o[w],V=w===o.length-1;let y;e[1]!==w||e[2]!==o||e[3]!==m?(y=Se=>{const ue=o[w],te=o[Se];!ue||!te||Se===w||(F(se=>new Set(se).add(ue.pointer)),X(se=>({...se,[ue.pointer]:m[ue.pointer]??0,[te.pointer]:m[te.pointer]??0})),z(Se))},e[1]=w,e[2]=o,e[3]=m,e[4]=y):y=e[4];const C=y;let x;e[5]!==w||e[6]!==C?(x=Se=>{if(!Se)return;const ue=te=>{const se={ArrowLeft:-1,ArrowRight:1}[te.key];!se||te.defaultPrevented||te.altKey||te.ctrlKey||te.metaKey||te.shiftKey||Pl(te.target)||(te.preventDefault(),C(w+se))};return Se.ownerDocument.addEventListener("keydown",ue),()=>Se.ownerDocument.removeEventListener("keydown",ue)},e[5]=w,e[6]=C,e[7]=x):x=e[7];const Y=x;if(!I)return null;let M,ge,me,le,ee;if(e[8]!==H||e[9]!==w||e[10]!==a||e[11]!==o||e[12]!==m||e[13]!==C||e[14]!==j||e[15]!==Y||e[16]!==A||e[17]!==n||e[18]!==k||e[19]!==s){const{title:Se,description:ue}=kc(s,o,w,a,n.author??null);let te;e[25]!==n?(te=se=>{se.detail>1||n.onApply()},e[25]=n,e[26]=te):te=e[26],M=te,ge=A?Y:void 0,me="flex min-w-0 flex-col gap-3",e[27]!==H||e[28]!==w||e[29]!==o||e[30]!==m||e[31]!==C||e[32]!==A||e[33]!==k||e[34]!==s?(le=A&&i.jsxs("div",{className:"flex items-center justify-between gap-3",children:[i.jsx("div",{role:"group","aria-label":s("sectionsEditor.formConflict.steps"),className:"-m-1 flex flex-wrap items-center",children:o.map((se,Te)=>{const Z=Te!==w&&(m[se.pointer]??0)>(k[se.pointer]??0);return i.jsx("button",{type:"button","aria-label":Z?s("sectionsEditor.formConflict.stepChangedAgain",{label:se.label}):se.label,"aria-current":Te===w?"step":void 0,"data-answered":Te!==w&&H.has(se.pointer)?"":void 0,"data-changed-again":Z?"":void 0,onClick:()=>C(Te),className:"group cursor-pointer rounded-full p-1 outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:i.jsx("span",{className:ae("block h-2 w-2 rounded-full bg-border transition-[width,background-color,box-shadow] motion-reduce:transition-none","group-hover:bg-muted-foreground/60","group-data-[answered]:bg-foreground/45","group-aria-[current=step]:w-5 group-aria-[current=step]:bg-foreground","group-data-[changed-again]:ring-2 group-data-[changed-again]:ring-warning group-data-[changed-again]:ring-offset-1 group-data-[changed-again]:ring-offset-background")})},se.pointer)})}),i.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:s("sectionsEditor.formConflict.stepCount",{step:String(w+1),count:String(o.length)})})]}),e[27]=H,e[28]=w,e[29]=o,e[30]=m,e[31]=C,e[32]=A,e[33]=k,e[34]=s,e[35]=le):le=e[35],ee=j(Se,ue),e[8]=H,e[9]=w,e[10]=a,e[11]=o,e[12]=m,e[13]=C,e[14]=j,e[15]=Y,e[16]=A,e[17]=n,e[18]=k,e[19]=s,e[20]=M,e[21]=ge,e[22]=me,e[23]=le,e[24]=ee}else M=e[20],ge=e[21],me=e[22],le=e[23],ee=e[24];let pe;e[36]!==ge||e[37]!==me||e[38]!==le||e[39]!==ee?(pe=i.jsxs("div",{ref:ge,className:me,children:[le,ee]}),e[36]=ge,e[37]=me,e[38]=le,e[39]=ee,e[40]=pe):pe=e[40];const ce=!v&&"sr-only";let he;e[41]!==ce?(he=ae("text-sm text-muted-foreground",ce),e[41]=ce,e[42]=he):he=e[42];let ve;e[43]!==v||e[44]!==A||e[45]!==s?(ve=v?s(A?"sectionsEditor.formConflict.changedAgainSteps":"sectionsEditor.formConflict.changedAgain"):"",e[43]=v,e[44]=A,e[45]=s,e[46]=ve):ve=e[46];let b;e[47]!==he||e[48]!==ve?(b=i.jsx("p",{role:"status",className:he,children:ve}),e[47]=he,e[48]=ve,e[49]=b):b=e[49];const B=A?"vertical":"all";let xe;e[50]!==I||e[51]!==n||e[52]!==B?(xe=i.jsx(Dc,{field:I,...n,arrows:B}),e[50]=I,e[51]=n,e[52]=B,e[53]=xe):xe=e[53];let T;e[54]!==b||e[55]!==xe?(T=i.jsxs("div",{className:"-mx-2 flex min-h-0 flex-col gap-3 overflow-y-auto px-2 py-1",children:[b,xe]}),e[54]=b,e[55]=xe,e[56]=T):T=e[56];let ye;e[57]!==M||e[58]!==w||e[59]!==C||e[60]!==V||e[61]!==A||e[62]!==s?(ye=A?i.jsxs(no,{className:"flex-row flex-wrap items-center justify-between gap-2 sm:justify-between",children:[i.jsx(_t,{type:"button",variant:"outline","aria-disabled":w===0,onClick:()=>C(w-1),className:"aria-disabled:cursor-default aria-disabled:opacity-45",children:s("sectionsEditor.formConflict.back")}),i.jsx(_t,{type:"button","data-testid":"form-conflict-primary",onClick:V?M:()=>C(w+1),children:s(V?"sectionsEditor.formConflict.ok":"sectionsEditor.formConflict.next")})]}):i.jsx(no,{className:"items-center gap-2",children:i.jsx(_t,{type:"button","data-testid":"form-conflict-primary",onClick:M,children:s("sectionsEditor.formConflict.ok")})}),e[57]=M,e[58]=w,e[59]=C,e[60]=V,e[61]=A,e[62]=s,e[63]=ye):ye=e[63];let K;return e[64]!==pe||e[65]!==T||e[66]!==ye?(K=i.jsxs(i.Fragment,{children:[pe,T,ye]}),e[64]=pe,e[65]=T,e[66]=ye,e[67]=K):K=e[67],K}function Cc(){return new Set}function Nc(n){const e=Hn(n.mine,n.schema),s=Hn(n.theirs,n.schema),o=e.kind==="text"&&s.kind==="text"?xc(e.text,s.text):null;return a=>o?i.jsx(Pc,{parts:o[a]}):i.jsx(Bc,{preview:a==="mine"?e:s})}const Tc={all:{ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1},vertical:{ArrowDown:1,ArrowUp:-1}};function Vc(n,e){const s=Tc[e][n.key];if(!s)return;const o=[...n.currentTarget.querySelectorAll('[role="radio"]')],a=o.indexOf(document.activeElement);if(a<0)return;n.preventDefault();const u=o[(a+s+o.length)%o.length];u?.focus(),u?.click()}function Dc(n){const e=it.c(65),{field:s,choices:o,viewer:a,author:u,onChoose:h,arrows:d}=n,v=u===void 0?null:u,m=Ft(),[j]=Wi(),{language:A}=j;let $,z,H,F,f,k,X,w,I,V,y,C,x,Y;if(e[0]!==d||e[1]!==v||e[2]!==o||e[3]!==s||e[4]!==A||e[5]!==h||e[6]!==m||e[7]!==a?.image||e[8]!==a?.name){const me=Nc(s),le=o[s.pointer]??"mine",ee=a?.image??void 0;let pe;e[23]!==m||e[24]!==a?.name?(pe=mo(a?.name)||m("sectionsEditor.formConflict.you"),e[23]=m,e[24]=a?.name,e[25]=pe):pe=e[25];let ce;e[26]!==ee||e[27]!==pe?(ce=i.jsx(ms,{url:ee,fallback:pe,shape:"circle",size:"sm",className:"text-xs"}),e[26]=ee,e[27]=pe,e[28]=ce):ce=e[28];const he=ce;let ve;e[29]!==v||e[30]!==he?(ve=v?.you?he:v?.name?i.jsx(ms,{url:v.avatarUrl,fallback:mo(v.name),shape:"circle",size:"sm",className:"text-xs"}):i.jsx(ms,{url:"icon://user",fallback:"",muted:!0,shape:"circle",size:"sm"}),e[29]=v,e[30]=he,e[31]=ve):ve=e[31];const b=ve,B=v?new Date(v.at):null;H="radiogroup",F=s.label,f="flex flex-col gap-2",e[32]!==d?(k=K=>Vc(K,d),e[32]=d,e[33]=k):k=e[33];let xe;e[34]!==s.pointer||e[35]!==h?(xe=()=>h(s.pointer,"mine"),e[34]=s.pointer,e[35]=h,e[36]=xe):xe=e[36];let T;e[37]!==m?(T=m("sectionsEditor.formConflict.you"),e[37]=m,e[38]=T):T=e[38];let ye;e[39]!==m?(ye=m("sectionsEditor.formConflict.yourVersionNotSaved"),e[39]=m,e[40]=ye):ye=e[40],X=i.jsx(po,{side:"mine",checked:le==="mine",onChoose:xe,avatar:he,who:T,meta:ye,children:me("mine")}),$=po,w="theirs",I=le==="theirs",e[41]!==s.pointer||e[42]!==h?(V=()=>h(s.pointer,"theirs"),e[41]=s.pointer,e[42]=h,e[43]=V):V=e[43],y=b,e[44]!==v?.name||e[45]!==v?.you||e[46]!==m?(C=v?.you?m("sectionsEditor.formConflict.youElsewhere"):v?.name||m("sectionsEditor.formConflict.someoneElse"),e[44]=v?.name,e[45]=v?.you,e[46]=m,e[47]=C):C=e[47],x=B?m("sectionsEditor.formConflict.savedAt",{when:Ml(B,A)}):m("sectionsEditor.formConflict.theirVersionSaved"),Y=B?Mc(B,A):void 0,z=me("theirs"),e[0]=d,e[1]=v,e[2]=o,e[3]=s,e[4]=A,e[5]=h,e[6]=m,e[7]=a?.image,e[8]=a?.name,e[9]=$,e[10]=z,e[11]=H,e[12]=F,e[13]=f,e[14]=k,e[15]=X,e[16]=w,e[17]=I,e[18]=V,e[19]=y,e[20]=C,e[21]=x,e[22]=Y}else $=e[9],z=e[10],H=e[11],F=e[12],f=e[13],k=e[14],X=e[15],w=e[16],I=e[17],V=e[18],y=e[19],C=e[20],x=e[21],Y=e[22];let M;e[48]!==$||e[49]!==z||e[50]!==w||e[51]!==I||e[52]!==V||e[53]!==y||e[54]!==C||e[55]!==x||e[56]!==Y?(M=i.jsx($,{side:w,checked:I,onChoose:V,avatar:y,who:C,meta:x,metaTitle:Y,children:z}),e[48]=$,e[49]=z,e[50]=w,e[51]=I,e[52]=V,e[53]=y,e[54]=C,e[55]=x,e[56]=Y,e[57]=M):M=e[57];let ge;return e[58]!==H||e[59]!==F||e[60]!==f||e[61]!==k||e[62]!==X||e[63]!==M?(ge=i.jsxs("div",{role:H,"aria-label":F,className:f,onKeyDown:k,children:[X,M]}),e[58]=H,e[59]=F,e[60]=f,e[61]=k,e[62]=X,e[63]=M,e[64]=ge):ge=e[64],ge}const Mc=(n,e)=>n.toLocaleString(e,{dateStyle:"medium",timeStyle:"short"});function mo(n){return(n??"").trim().split(/\s+/).filter(Boolean).slice(0,2).map(e=>e.charAt(0).toUpperCase()).join("")}function po(n){const e=it.c(28),{side:s,checked:o,onChoose:a,avatar:u,who:h,meta:d,metaTitle:v,children:m}=n,j=R.useId(),A=`${j}-who`,$=`${j}-meta ${j}-value`,z=o?0:-1,H=o?"border-primary bg-primary/5 ring-1 ring-primary":"hover:bg-muted/50";let F;e[0]!==H?(F=ae("grid w-full cursor-pointer grid-cols-[auto_minmax(0,1fr)] items-start gap-3 rounded-xl border bg-background p-3 text-left transition-[border-color,box-shadow,background-color] outline-none","focus-visible:ring-2 focus-visible:ring-ring/50",H),e[0]=H,e[1]=F):F=e[1];const f=`${j}-who`;let k;e[2]!==f||e[3]!==h?(k=i.jsx("span",{id:f,className:"text-sm font-medium text-foreground",children:h}),e[2]=f,e[3]=h,e[4]=k):k=e[4];const X=`${j}-meta`;let w;e[5]!==d||e[6]!==v||e[7]!==X?(w=i.jsx("span",{id:X,title:v,children:d}),e[5]=d,e[6]=v,e[7]=X,e[8]=w):w=e[8];let I;e[9]!==k||e[10]!==w?(I=i.jsxs("span",{className:"flex flex-wrap items-baseline gap-x-1.5 text-xs text-muted-foreground",children:[k,w]}),e[9]=k,e[10]=w,e[11]=I):I=e[11];const V=`${j}-value`,y=`conflict-${s}`;let C;e[12]!==m||e[13]!==V||e[14]!==y?(C=i.jsx("span",{id:V,"data-testid":y,className:"min-w-0 text-sm",children:m}),e[12]=m,e[13]=V,e[14]=y,e[15]=C):C=e[15];let x;e[16]!==I||e[17]!==C?(x=i.jsxs("span",{className:"flex min-w-0 flex-col gap-1",children:[I,C]}),e[16]=I,e[17]=C,e[18]=x):x=e[18];let Y;return e[19]!==u||e[20]!==o||e[21]!==a||e[22]!==A||e[23]!==x||e[24]!==$||e[25]!==z||e[26]!==F?(Y=i.jsxs("button",{type:"button",role:"radio","aria-checked":o,"aria-labelledby":A,"aria-describedby":$,tabIndex:z,onClick:a,className:F,children:[u,x]}),e[19]=u,e[20]=o,e[21]=a,e[22]=A,e[23]=x,e[24]=$,e[25]=z,e[26]=F,e[27]=Y):Y=e[27],Y}function Pc(n){const e=it.c(4),{parts:s}=n;let o;e[0]!==s?(o=s.map(Ic),e[0]=s,e[1]=o):o=e[1];let a;return e[2]!==o?(a=i.jsx("span",{className:"whitespace-pre-wrap break-words",children:o}),e[2]=o,e[3]=a):a=e[3],a}function Ic(n,e){return n.kind==="changed"?i.jsx("mark",{className:"rounded-sm bg-warning/20 px-0.5 text-foreground",children:n.text},e):i.jsx("span",{children:n.text},e)}function Bc(n){const e=it.c(29),{preview:s}=n,o=Ft();switch(s.kind){case"empty":{let a;e[0]!==o?(a=o("sectionsEditor.formConflict.empty"),e[0]=o,e[1]=a):a=e[1];let u;return e[2]!==a?(u=i.jsx("span",{className:"italic text-muted-foreground",children:a}),e[2]=a,e[3]=u):u=e[3],u}case"text":{let a;return e[4]!==s.text?(a=i.jsx("span",{className:"whitespace-pre-wrap break-words",children:s.text}),e[4]=s.text,e[5]=a):a=e[5],a}case"image":{let a;return e[6]!==s.src?(a=i.jsx("img",{src:s.src,alt:"",className:"max-h-24 max-w-full rounded border object-contain"}),e[6]=s.src,e[7]=a):a=e[7],a}case"yesNo":{const a=s.value?"sectionsEditor.formConflict.yes":"sectionsEditor.formConflict.no";let u;e[8]!==o||e[9]!==a?(u=o(a),e[8]=o,e[9]=a,e[10]=u):u=e[10];let h;return e[11]!==u?(h=i.jsx("span",{children:u}),e[11]=u,e[12]=h):h=e[12],h}case"list":{const a=s.count===1?"sectionsEditor.formConflict.oneItem":"sectionsEditor.formConflict.items",u=String(s.count);let h;e[13]!==o||e[14]!==a||e[15]!==u?(h=o(a,{count:u}),e[13]=o,e[14]=a,e[15]=u,e[16]=h):h=e[16];let d;e[17]!==h?(d=i.jsx("span",{className:"text-muted-foreground",children:h}),e[17]=h,e[18]=d):d=e[18];let v;e[19]!==s.count||e[20]!==s.items?(v=s.items.some(Boolean)&&i.jsxs("span",{className:"flex flex-col",children:[s.items.map(Fc),s.count>s.items.length&&i.jsx("span",{children:"…"})]}),e[19]=s.count,e[20]=s.items,e[21]=v):v=e[21];let m;return e[22]!==d||e[23]!==v?(m=i.jsxs("span",{className:"flex flex-col gap-1",children:[d,v]}),e[22]=d,e[23]=v,e[24]=m):m=e[24],m}case"fields":{let a;e[25]!==s.entries?(a=s.entries.map(Kc),e[25]=s.entries,e[26]=a):a=e[26];let u;return e[27]!==a?(u=i.jsx("dl",{className:"grid grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-0.5",children:a}),e[27]=a,e[28]=u):u=e[28],u}}}function Kc(n){return i.jsxs("div",{className:"contents",children:[i.jsx("dt",{className:"text-muted-foreground",children:n.label}),i.jsx("dd",{className:"truncate",children:n.text})]},n.label)}function Fc(n,e){return i.jsx("span",{className:"truncate",children:`${e+1}. ${n||"…"}`},e)}function Oc(n,e){return n.kind==="protocol"&&n.source==="github"?e:null}function Lc(n,e){if(Object.hasOwn(n,e))return n[e]??null;const s=Yr(e),o=Object.keys(n).find(a=>Yr(a)===s);return o===void 0?null:n[o]??null}async function $c(n,e){try{const s=await fetch(`/api/${n.orgSlug}/decofile/${encodeURIComponent(n.virtualMcpId)}/${encodeURIComponent(n.branch)}`,{cache:"no-store",headers:Na("v8")});if(!s.ok)return null;const o=await s.json().catch(()=>({})),a=Lc(o.changedBy??{},e);return a&&typeof a.userId=="string"&&Number.isFinite(Date.parse(a.at))?a:null}catch{return null}}function zc(n,e,s){const o=e.find(h=>h.userId===n.userId),a=o?.user?.name?.trim(),u=o?.user?.image??void 0;return{...a?{name:a}:{},...u?{avatarUrl:u}:{},at:n.at,you:!!s&&n.userId===s}}function Hc(n){let e=2166136261,s=0;for(let o=0;o<n.length;o++){const a=n.charCodeAt(o);e=Math.imul(e^a,16777619),s=Math.imul(s,31)+a|0}return`${(e>>>0).toString(36)}${(s>>>0).toString(36)}:${n.length}`}function Wc(n,e,s){const o=it.c(19),a=!!n&&!!e&&s!==null;let u;o[0]!==e||o[1]!==n||o[2]!==s?(u=yo.conflictAuthor(n?`${n.orgSlug}/${n.virtualMcpId}/${n.branch}`:"",e??"",s??""),o[0]=e,o[1]=n,o[2]=s,o[3]=u):u=o[3];let h;o[4]!==e||o[5]!==n?(h=()=>$c(n,e),o[4]=e,o[5]=n,o[6]=h):h=o[6];let d;o[7]!==a||o[8]!==u||o[9]!==h?(d={queryKey:u,queryFn:h,enabled:a,staleTime:Number.POSITIVE_INFINITY,gcTime:6e5,retry:!1,refetchOnWindowFocus:!1},o[7]=a,o[8]=u,o[9]=h,o[10]=d):d=o[10];const{data:v}=qi(d),m=a?v??null:null,j=!!m;let A;o[11]!==j?(A={enabled:j},o[11]=j,o[12]=A):A=o[12];const{data:$}=Il(A);let z;o[13]!==$?(z=$?.data?.members??[],o[13]=$,o[14]=z):z=o[14];const H=z,{data:F}=xo.useSession();if(!m)return null;const f=F?.user?.id??null;let k;return o[15]!==m||o[16]!==H||o[17]!==f?(k=zc(m,H,f),o[15]=m,o[16]=H,o[17]=f,o[18]=k):k=o[18],k}function qc(n,e,s,o){if(!n||typeof n!="object")return{kind:"error",reason:"no-matcher-rule"};const a=e.trim();if(!a)return Gt(n,s,o)?{kind:"inline",blockKey:n.__resolveType??"",inlinedRule:xs(n,s,o)}:{kind:"noop"};const u=ys(n,s,o);if(!u)return{kind:"error",reason:"unreadable-rule"};if(u.blockKey)return{kind:"updateBlock",blockKey:u.blockKey,blockData:Kt(u.resolveType,u.data,a)};const h=Fn(a),d=On(h,s);return d?{kind:"error",reason:"invalid-block-id",message:d}:{kind:"createBlock",blockId:h,blockData:Kt(u.resolveType,u.data,a),reference:on(h)}}const ho="section-form-stale-save",Gc=3,Uc=1e3;function go(n,e){const s=e.global&&e.pageKey?[{label:"Default",sections:[{__resolveType:e.pageKey}]}]:So(e.pageKey?n[e.pageKey]?.sections:void 0,n),o=Math.max(0,Math.min(e.pageVariantIndex,s.length-1)),a=s[o]?.sections??[];return{pageVariants:s,variantIndex:o,rawSections:a,parsedSections:_n(a,n)}}const vo=new WeakMap;let Yc=0;function Jc(n){let e=vo.get(n);return e===void 0&&(e=++Yc,vo.set(n,e)),e}function tm({orgSlug:n,virtualMcpId:e,branch:s,previewReady:o=!0,previewUrl:a,currentPath:u,activePageBlockKey:h=null,activeGlobalBlockKey:d=null,externalSelection:v,onSaved:m,initialEditSeo:j=!1,onExitSeo:A,onSelectRoot:$,onViewJsonFile:z,onFocusedBlockChange:H,onVariantPreviewOverride:F}){const f=Ft(),k=Yi(),X=k?.taskId??null,w=o?{orgSlug:n,virtualMcpId:e,branch:s,threadId:X,previewUrl:a}:null,[I,V]=R.useState([]),{data:y,isLoading:C}=Ta(w,{pollWhile:I.length>0}),{data:x,isLoading:Y}=ia(w),M=Wn(),ge=k?.virtualMcpId,le=ka(ge===e?e:null)?.metadata?.siteSlug??null,ee=Rl({virtualMcpId:e,branch:s,sandboxUrl:a}),pe=Va(e,s),ce=Da(pe),he=!ce,ve=!!ee||ce,[b,B]=R.useState(null),[xe,T]=R.useState(null),[ye,K]=R.useState(null),[Se,ue]=R.useState(0),[te,se]=R.useState(void 0),[Te,Z]=R.useState(null),[_e,be]=R.useState(null),[q,O]=R.useState([]),Ke=R.useRef(null),[Qe,Xe]=R.useState(q.length);Qe!==q.length&&(Xe(q.length),requestAnimationFrame(()=>{Ke.current&&(Ke.current.scrollTop=0)}));const[Ye,Q]=R.useState(0),[ke,He]=R.useState(null),[We,Ee]=R.useState(null),[Ie,Ve]=R.useState(null),[Ze,Fe]=R.useState(!1),[re,dt]=R.useState(!1),ne=R.useRef(null),[De,yt]=R.useState(!0),[et,ft]=R.useState(!1),[Ot,kn]=R.useState(!1),[qe,an]=R.useState(j),[Cs,Ns]=R.useState(j);j&&!Cs&&(Ns(!0),an(!0),B(null),T(null),K(null),O([])),!j&&Cs&&Ns(!1);const[Do,ln]=R.useState(null),[Ts,En]=R.useState(void 0),[Vs,Lt]=R.useState([]),[Ds,Yt]=R.useState(0),[Je,at]=R.useState(0),[Mo,tt]=R.useState(null),[Jt,st]=R.useState(null),[Ms,Ps]=R.useState(null),Is=Gi(),Bs=Ma({orgSlug:n,virtualMcpId:e,branch:s},{tunnel:!1}),cn=aa({orgSlug:n,virtualMcpId:e,branch:s}),[Po,Io]=R.useState(u),[Bo,Ko]=R.useState(h),[Fo,Oo]=R.useState(d);(Po!==u||Bo!==h||Fo!==d)&&(queueMicrotask(()=>cn.flush()),Io(u),Ko(h),Oo(d),B(null),T(null),K(null),ue(0),Z(null),be(null),at(0),tt(null),st(null),O([]),Q(t=>t+1),an(!1),ln(null),En(void 0),Lt([]),Yt(t=>t+1));const G=la({orgSlug:n,virtualMcpId:e,branch:s}),un=ja((t,r)=>{G.mutate({blockKey:t,data:r},{onSuccess:()=>m?.(),onError:G.reportError})}),Rn=Oa({orgSlug:n,virtualMcpId:e,branch:s}),[Qt,Xt]=R.useState(!1),W=R.useRef(null),At=R.useRef(null),mt=R.useRef(null),pt=R.useRef(null),An=R.useRef({}),$t=R.useRef(null),dn=R.useRef(!1),fn=R.useRef(!1),Oe=R.useRef(new Map),Zt=R.useRef(!1),St=R.useRef([]),qn=R.useRef(new WeakSet);Pa(n,e,t=>{const{activePageKey:r,rawSections:l,parsedSections:c,selectedSectionIndex:p}=Le.current,S=new Set;r&&S.add(r);for(const g of[At.current?.sectionIndex,p]){const _=g==null?void 0:l[g],L=g==null?void 0:c[g],N=_&&L?.isSavedBlock?ds(_,L):null;N&&S.add(N)}if([...S].some(g=>t.has(g))){for(const g of[W,mt,pt])g.current&&clearTimeout(g.current),g.current=null;At.current=null,Oe.current.clear(),r&&t.has(r)&&(An.current={})}});const Le=R.useRef({rawSections:[],parsedSections:[],decofile:{},activePageKey:null,pageVariants:[],variantIndex:0,sectionVariantIndex:0,selectedSectionIndex:null}),[Ks,Fs]=R.useState(0),[Lo,$o]=R.useState(0),zo=Wc(Oc(pe,{orgSlug:n,virtualMcpId:e,branch:s}),I[0]?.blockKey??null,I[0]?Hc(ze(I[0].plan.theirs)):null),[Ho,Wo]=R.useState(null),Gn=Ia(n,e).epoch,[qo,Go]=R.useState(Gn);if(!o||C||Y)return i.jsx("div",{className:"h-full w-full flex items-center justify-center",children:i.jsx(Ui,{className:"size-5 text-muted-foreground"})});if(!y||!x)return i.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:f("sectionsEditor.sectionsEditor.couldNotLoadSiteData")});const Uo=Ha(y,x),ie=!!d,je=ie?null:Wa(Uo,u,h),E=ie?d:je?.key??null,Un=ie&&d?y[d]:void 0,Os=ie&&d&&Un?qa(d,Un):ie&&d?d:"",mn=!ie&&E&&y[E]?y[E]:null,Yn=qe&&y&&x&&E&&je?Kr(y,{kind:"page",pageKey:E,pageName:String(je.name??""),path:String(je.path??"")},x):null,Yo=qe?mn?.seo:void 0,Cn=Ts!==void 0?Ts:Yo,Jo=qe?ca(Cn):void 0,Ls=Yn?.seoTypeOptions??[],$s=qe&&x?ua(x):"",Jn=Do??Jo??{},Nn=qe&&Yn?Bl(Jn,Yn):null,zs=qe&&Nn&&da(Cn)?Kn(Nn,x):null,Hs=qe?fa(y,x)?.seoData:void 0,Me=ie?[{label:"Default",sections:[{__resolveType:d}]}]:So(mn?.sections,y??{}),ht=Me.length>1,we=Math.min(Se,Me.length-1),rt=Me[we],U=rt?.sections??[],Pe=_n(U,y),Qn=!ie&&Ga(mn?.sections);if(ie&&d&&Ms!==d){Ps(d);const t=U[0],r=Pe[0];if(t&&r){B(0),at(0),O([]);const l=jt(t,r,y);l&&(T(l.data),K(l.resolveType),st(null),tt(null))}}!ie&&Ms!==null&&Ps(null),Le.current={rawSections:U,parsedSections:Pe,decofile:y??{},activePageKey:E,pageVariants:Me,variantIndex:we,sectionVariantIndex:Je,selectedSectionIndex:b};const Qo=()=>({multivariate:Qn,index:we,variants:Me.map(t=>({rule:t.rule}))}),Xn=(t,r)=>{if(!F)return;if(!E||!Qn||t.length<=1){F(null);return}const l={multivariate:!0,index:r,variants:t},c=ce?ro(E,l):oo(E,l,y,x);F(c.length>0?c:null)},Zn=F&&E&&Qn&&ht&&!C&&!Y?E:null;if(Zn!==Ho&&(Wo(Zn),Zn)){const t=Me.map(l=>({rule:l.rule})),r=we;queueMicrotask(()=>Xn(t,r))}const en=(t,r,l)=>{if(!F)return;if(!E){F(null);return}const c=Qo(),p=ce?ro(E,c):oo(E,c,y,x);if(!t||r<0){F(p.length>0?p:null);return}const S={pageKey:E,page:c,sectionIndex:r,sectionLazy:Pe[r]?.isLazy??!1,mvObj:t,selectedVariantIndex:l},g=ce?Fl(S):Ol({...S,decofile:y,meta:x}),_=[...p,...g];F(_.length>0?_:null)},bt=(t,r,l,c=b??-1,p=!1)=>{const S=xt(t,r);if(!S){T(null),K(null),st(null),tt(null),p&&en(null,c,l);return}const _=vs(S,wt)[l];if(!_){T(null),K(null),st(null),tt(null),p&&en(null,c,l);return}const L=wo(_.value,y);T(L?.data??null),K(L?.resolveType??null);const{resolveType:N,formValue:D}=jn(_.rule,y,x??void 0);st(N),tt(D),p&&en(S,c,l)},pn=v?.index;if(v!==void 0&&(v?.seq??null)!==te&&(se(v?.seq??null),typeof pn=="number")){const t=U[pn],r=Pe[pn];if(t&&r)if(B(pn),at(0),O([]),Q(l=>l+1),r.isMultivariate)bt(t,r,0,pn);else{const l=jt(t,r,y);l?(T(l.data),K(l.resolveType)):(T(null),K(null)),st(null),tt(null)}}if(Gn!==qo){Go(Gn);const t=W.current!==null||Oe.current.size>0||pt.current!==null||mt.current!==null||G.isPending||cn.isPending||I.length>0,r=b!==null&&co(Ke.current,document.activeElement);if(!t&&r&&(Zt.current=!0),!t&&!r&&b!==null){const l=U[b],c=Pe[b];if(O([]),Q(p=>p+1),!l||!c)B(null),T(null),K(null);else if(c.isMultivariate)bt(l,c,Je,b);else{const p=jt(l,c,y);T(p?.data??null),K(p?.resolveType??null)}}!t&&qe&&(ln(null),En(void 0),Yt(l=>l+1))}if(Ks!==Lo){$o(Ks);const t=b!==null?U[b]:null,r=b!==null?Pe[b]:null;if(t&&r&&b!==null)if(O([]),Q(l=>l+1),r.isMultivariate)bt(t,r,Je,b);else{const l=jt(t,r,y);T(l?.data??null),K(l?.resolveType??null)}}const lt=I[0];if(lt){const{formBase:t,target:r}=lt,l=go(y,r),c=t.sectionIndex,p=l.rawSections.length===t.sectionCount?hs(l.rawSections[c],l.parsedSections[c],r.sectionVariantIndex,y):null,S=lc(lt,p,g=>ao(t,g));if(S){const _=[{...lt,...S,changedAgain:!0},...I.slice(1)];St.current=_,V(_)}}const hn={orgSlug:n,virtualMcpId:e,branch:s,threadId:X,previewUrl:ce?void 0:a??void 0,siteSlug:le},Tn=ye&&x?Kn(ye,x):null,ct=(t,r)=>{if(!E)return;W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear(),pt.current&&(clearTimeout(pt.current),pt.current=null),mt.current&&(clearTimeout(mt.current),mt.current=null);const l=Sn(y,E,t,we,Me);G.mutate({blockKey:E,data:l},{onSuccess:()=>r?.onSuccess?.()??m?.(),onError:c=>{r?.onError?.(),G.reportError(c)}})},zt=()=>{H?.(null),B(null),kn(!1),T(null),K(null),at(0),tt(null),st(null),O([]),Q(t=>t+1)},Ws=()=>co(Ke.current,document.activeElement),es=(t=f("sectionsEditor.sectionsEditor.blockChangedElsewhere"))=>{if(W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear(),At.current=null,oe.error(t,{id:ho}),Ws()){Zt.current=!0;return}Fs(r=>r+1)},qs=()=>{!Zt.current||Ws()||St.current.length>0||W.current!==null||dn.current||fn.current||Oe.current.size>0||(Zt.current=!1,Fs(t=>t+1))},Gs=()=>{Zt.current&&setTimeout(qs,0)},Us=t=>Ka(Is,Bs,t),Ys=t=>{Oe.current.size!==0&&setTimeout(()=>{if(dn.current||fn.current)return;const r=[...Oe.current.values()];Oe.current.clear();for(const l of r)l()},t)},Xo=t=>{const{activePageKey:r,variantIndex:l,sectionVariantIndex:c}=Le.current,p=$t.current;return{formBase:p?.sectionIndex===t&&p.variantIndex===c?p:null,pageKey:r,global:ie,pageVariantIndex:l,sectionVariantIndex:c,schema:Tn}},gn=t=>{St.current=t,V(t)},Zo=t=>{const r=St.current,l=r.findIndex(S=>S.formBase===t.formBase),c=l>=0?r[l]:void 0,p=c?r.with(l,{...t,choices:ks(c.plan,c.choices,t.plan),fresh:To(c.plan,t.plan,c.fresh),changedAgain:c.changedAgain||ze(c.plan.theirs)!==ze(t.plan.theirs)}):[...r,{...t,changedAgain:qn.current.has(t.formBase)}];gn(p)},Js=(t,r)=>{const l=St.current,c=l.findIndex(g=>g.formBase===t),p=l[c];if(!p)return!1;if(ze(p.plan.mine)===ze(r))return!0;const S=ws({...p.plan,mine:r});if(S.pointers.length===0){const g=l.filter(_=>_!==p);return gn(g),!1}return gn(l.with(c,{...p,plan:S,choices:ks(p.plan,p.choices,S)})),!0},ei=t=>{const r=Le.current;return r.selectedSectionIndex===t.formBase.sectionIndex&&r.activePageKey===t.target.pageKey&&r.variantIndex===t.target.pageVariantIndex&&r.sectionVariantIndex===t.target.sectionVariantIndex},ti=()=>{const t=St.current[0];if(!t)return null;const{formBase:r,target:l}=t;W.current&&At.current?.sectionIndex===r.sectionIndex&&At.current.sectionVariantIndex===l.sectionVariantIndex&&(clearTimeout(W.current),W.current=null,At.current=null),Oe.current.delete(`${l.pageKey}:${r.sectionIndex}:${l.sectionVariantIndex}`);const c=r.emitted;return c&&typeof c=="object"&&!Js(r,c)&&vn(c,r.sectionIndex,0,l),St.current[0]??null},ni=()=>{const t=St.current[0],r=ti();if(!r||!t||r.formBase!==t.formBase||r.plan.pointers.some(S=>!t.plan.pointers.includes(S)))return;const l=ic(r.plan,r.choices);gn(St.current.slice(1));const{formBase:c,target:p}=r;c.base=r.plan.theirs,c.version=void 0,c.emitted=l,qn.current.add(c),($t.current===c||ei(r))&&($t.current=c,T(l),Q(S=>S+1)),vn(l,c.sectionIndex,0,p)},si=t=>{const[r,...l]=St.current;r&&gn([{...r,choices:t},...l])},vn=(t,r,l=0,c)=>{const p=c??Xo(r),S=p.sectionVariantIndex,g=p.formBase,_=At.current;W.current&&(clearTimeout(W.current),W.current=null,_&&(_.sectionIndex!==r||_.sectionVariantIndex!==S)&&_.write());const L=`${p.pageKey}:${r}:${S}`,N=()=>{if(dn.current||fn.current){Oe.current.set(L,N);return}const D=typeof t=="function"?t():t;if(g&&Js(g,D))return;const P=Le.current.decofile,{rawSections:de,parsedSections:Re,pageVariants:nt,variantIndex:Be}=go(P,p),Ge=p.pageKey,J=de[r];if(!J)return;const fe=Re[r];if(!fe)return;const Ce=g?.base,Ue=hs(J,fe,S,P),gt=!!Ce&&!!Ue&&Ao(Ce,Ue)&&!(g&&ao(g,Ue));if(gt&&Ce&&Ue){if(Co(Ce,Ue)){es(f("sectionsEditor.sectionsEditor.sectionReplacedElsewhere"));return}const Ae=fe.isSavedBlock?"here":rc(Ce,de.map((Ne,Mt)=>hs(Ne,Re[Mt],S,P)),r,g?.sectionCount??de.length);if(Ae==="unknown"){es(f("sectionsEditor.sectionsEditor.sectionReplacedElsewhere"));return}if(typeof Ae=="number"&&g){g.sectionCount=de.length,g.sectionIndex=Ae,$t.current===g&&B(Ae),vn(D,Ae,l,p);return}}const ot=gt&&Ce&&Ue?ws({ancestor:Ce,mine:D,theirs:Ue}):null;if(ot&&ot.pointers.length>0&&g){g.sectionCount=de.length,Zo({plan:ot,formBase:g,target:p,sectionIndex:r,choices:No(ot),changedAgain:!1,blockKey:fe.isSavedBlock?ds(J,fe):Ge,fresh:{}});return}const vt=ot?ot.merged:null,Dt=vt??D,Mr=oc({merged:!!vt,tracked:g,current:$t.current,saved:D});vt&&oe.info(f("sectionsEditor.sectionsEditor.blockMergedWithOthers"),{id:ho}),Mr&&g&&(g.emitted=vt,T(vt));const cs=Mr||!vt?Dt:D;g&&(g.base=cs,g.sectionCount=de.length,nc(g,cs));const Pr={onSuccess:()=>{g&&qn.current.delete(g),m?.()},onError:Ae=>{if(g?.base===cs&&Ce&&(g.base=Ce),Ae instanceof Ba){g&&(g.version=void 0),l<Gc?(Oe.current.delete(L),fn.current=!0,setTimeout(()=>{fn.current=!1,vn(()=>{const Ne=g?.emitted;return Ne&&typeof Ne=="object"?Ne:D},r,l+1,p),Oe.current.delete(L),Ys(bn)},Uc*2**l)):es();return}G.reportError(Ae)}},Ir=Ae=>{dn.current=!0;let Ne=!1;G.mutateAsync(Ae).then(()=>Pr.onSuccess(),Mt=>{Ne=!0,Pr.onError(Mt)}).finally(()=>{dn.current=!1,Ys(Ne?bn:0),qs()})};if(fe.isSavedBlock){const Ae=ds(J,fe);if(!Ae)return;Ir({blockKey:Ae,data:Dt,...Ce?{base:{value:vt?Ue:Ce}}:{},rebaseOnConflict:!1,guard:lo({formBase:g,rebased:!!vt,versionOf:Us})});return}if(!Ge)return;const In={...P[Ge]},Wt=[...de];if(fe.isMultivariate){const Ae=xt(J,fe);if(!Ae||!Ge)return;const Ne=al(Ae,S,Dt);Wt[r]=qt(J,fe,Ne)}else if(fe.isHidden){const Ae=Rs(J.__resolveType),Ne=Ae?{...J.section}:{...J},Mt=Array.isArray(Ne.variants)?[...Ne.variants]:[];Mt[0]&&(Mt[0]={...Mt[0],value:Dt}),Ne.variants=Mt,Ae?Wt[r]={...J,section:Ne}:Wt[r]=Ne}else fe.isLazy?Wt[r]={...J,section:Dt}:Wt[r]=Dt;if(nt.length>1){const Ae=In.sections,Ne=[...Ae?.variants??[]];Ne[Be]&&(Ne[Be]={...Ne[Be],value:Wt}),In.sections={...Ae,variants:Ne}}else In.sections=Wt;Ir({blockKey:Ge,data:In,rebaseOnConflict:!1,guard:lo({formBase:null,rebased:!1,versionOf:Us})})};At.current={sectionIndex:r,sectionVariantIndex:S,write:N},W.current=setTimeout(()=>{W.current=null,N()},bn)},ri=t=>{Zt.current=!1,B(t),at(0),O([]),Q(p=>p+1);const r=U[t],l=Pe[t];if(H?.(l?.isSavedBlock?l.resolveType??null:null),!r||!l)return;if(l.isMultivariate){bt(r,l,0,t);return}const c=jt(r,l,y);if(!c){T(null),K(null),st(null),tt(null),en(null,t,0);return}T(c.data),K(c.resolveType),st(null),tt(null),en(null,t,0)},Qs=t=>{const r=t;b!==null&&($t.current=sc($t.current,{sectionIndex:b,variantIndex:Le.current.sectionVariantIndex,shown:xe,next:r,sectionCount:Le.current.rawSections.length})),T(r),b!==null&&vn(r,b)},ts=t=>{if(!E||!y||!x||!je)return;const r={kind:"page",pageKey:E,pageName:String(je.name??""),path:String(je.path??"")},l=Kr(y,r,x);l&&cn.save(E,()=>{const c=Is.getQueryData(yo.decofile(Bs))?.[E];if(!c||typeof c!="object"||c===null||Array.isArray(c))return null;const p={...c,...An.current};return An.current={},t?.raw!==void 0?{...p,seo:t.raw}:t?.inner!==void 0?Kl(r,l,p,t.inner):p})},Xs=(t,r)=>{E&&(An.current[t]=r,ts())},oi=(t,r)=>{if(!E)return;const l=Ln([...U],t,r);b!==null&&(b===t?B(r):t<b&&r>=b?B(b-1):t>b&&r<=b&&B(b+1)),ct(l)},ii=t=>{if(!E)return;const r=U.filter((l,c)=>c!==t);b===t?zt():b!==null&&b>t&&B(b-1),ct(r)},ai=t=>{if(!E)return;const r=U[t];if(!r)return;const l=[...U];l.splice(t+1,0,wa(r)),b!==null&&b>t&&B(b+1),ct(l)},li=t=>{if(!E)return;const r=U[t],l=Pe[t];if(!r||!l)return;const c=l.isHidden?nl(r):sl(r);if(!c)return;const p=[...U];p[t]=c,b===t&&zt(),ct(p)},ci=t=>{if(!E)return;const r=U[t],l=Pe[t];if(!r||!l||l.isMultivariate)return;const c=tl(r);if(!c)return;const p=[...U];p[t]=c,b===t&&zt(),ct(p)},ui=t=>{if(!E)return;const r=U[t],l=Pe[t];if(!r||!l?.isSavedBlock)return;const c=jt(r,l,y);if(!c?.data)return;const{name:p,...S}=c.data,g=[...U];l.isLazy?g[t]={...r,section:S}:g[t]=S,b===t&&zt(),ct(g)},di=t=>{if(!E)return;const r=[...U,{__resolveType:t.resolveType}],l=r.length-1;ct(r,{onError:()=>{Le.current.selectedSectionIndex===l&&zt()}}),Fe(!1),B(l),at(0),O([]),Q(g=>g+1);const c=r[l],p=_n(r,y)[l];if(!c||!p)return;if(p.isMultivariate){bt(c,p,0);return}const S=jt(c,p,y);if(!S){T(null),K(null),st(null),tt(null);return}T(S.data),K(S.resolveType),st(null),tt(null)},Zs=t=>{ne.current=t.append,Fe(!0)},fi=t=>{const r=ne.current;if(!r){di(t);return}r({__resolveType:t.resolveType}),Fe(!1),ne.current=null},er=t=>{if(b===null)return;const r=U[b],l=Pe[b];!r||!l?.isMultivariate||(at(t),O([]),Q(c=>c+1),bt(r,l,t,b,!0))},mi=t=>{if(b===null||!E)return;const r=U[b],l=Pe[b];if(!r||!l?.isMultivariate)return;const c=xt(r,l);if(!c)return;const p=Za(c,t);if(!p){oe.error(f("sectionsEditor.sectionsEditor.cannotDeleteOnlyVariant"));return}const S=[...U];S[b]=qt(r,l,p);const g=p.variants;let _=Je;t===Je?_=Math.min(t,g.length-1):t<Je&&(_=Je-1),at(_),O([]),Q(L=>L+1),bt(S[b],l,_),ct(S)},pi=t=>{if(b===null||!E)return;const r=U[b],l=Pe[b];if(!r||!l?.isMultivariate)return;const c=xt(r,l);if(!c)return;const p=el(c,t),S=[...U];S[b]=qt(r,l,p);const g=t+1;at(g),O([]),Q(_=>_+1),bt(S[b],l,g),ct(S)},hi=(t,r)=>{if(b===null||!E||t===r)return;const l=U[b],c=Pe[b];if(!l||!c?.isMultivariate)return;const p=xt(l,c);if(!p)return;const S=Qa(p,t,r),g=[...U];g[b]=qt(l,c,S);let _=Je;Je===t?_=r:t<Je&&r>=Je?_=Je-1:t>Je&&r<=Je&&(_=Je+1),at(_),bt(g[b],c,_),ct(g)},xn=t=>{const r=t??b;if(r===null||!E)return;const l=U[r],c=Pe[r];if(!l||!c)return;const p=Ua(l,c);if(!p){oe.error(f("sectionsEditor.sectionsEditor.sectionCannotHaveVariants"));return}const S=[...U];S[r]=p.section;const g=_n(S,y)[r];if(!g?.isMultivariate){oe.error(f("sectionsEditor.sectionsEditor.couldNotAddVariant"));return}B(r),at(p.newVariantIndex),O([]),Q(_=>_+1),bt(p.section,g,p.newVariantIndex,r),ct(S)},tr=()=>{if(b===null||!E)return;const t=U[b],r=Pe[b];if(!t||!r?.isMultivariate)return;const l=xt(t,r);if(!l)return;const c=Xa(t,r,l);if(!c){oe.error(f("sectionsEditor.sectionsEditor.couldNotRemoveVariants"));return}const p=[...U];p[b]=c;const S=_n(p,y)[b];if(!S)return;at(0),st(null),tt(null),O([]),Q(_=>_+1);const g=jt(c,S,y);g?(T(g.data),K(g.resolveType)):(T(null),K(null)),en(null,b,0),ct(p)},gi=async t=>{if(ke===null||!E)return;const r=On(t,y,x);if(r){oe.error(r);return}const l=U[ke],c=Pe[ke];if(!l||!c)return;const p=jt(l,c,y);if(!p){oe.error(f("sectionsEditor.sectionsEditor.sectionCannotBeSavedAsGlobal"));return}const S={...p.data,name:t};try{await G.mutateAsync({blockKey:t,data:S});const g=[...U];g[ke]={__resolveType:t},await G.mutateAsync({blockKey:E,data:Sn(y,E,g,we,Me)}),b===ke&&zt(),He(null),oe.success(f("sectionsEditor.sectionsEditor.savedGlobalBlock",{blockId:t})),m?.()}catch(g){oe.error(f("sectionsEditor.sectionsEditor.failedToSaveGlobalBlock"),{description:Pt(f,It(g))})}},nr=rt?.rule;if(ht&&b===null&&_e===null&&nr){const{resolveType:t,formValue:r}=jn(nr,y??{},x??void 0);be(t),Z(r)}const tn=x?ma(x):[],ns=x&&y?pa(x,y):[],sr=!ie&&!!(ve&&x&&y),rr=_e&&x?Kn(_e,x):null,Ct=()=>{mt.current&&(clearTimeout(mt.current),mt.current=null),pt.current&&(clearTimeout(pt.current),pt.current=null)},Ht=async(t,r)=>{if(!(il(r,t,x)>0))try{await Rn.mutateAsync({blockKey:t})}catch(l){oe.error(f("sectionsEditor.sectionsEditor.couldNotDeleteMatcherBlock"),{description:Pt(f,It(l))})}},or=t=>{mt.current&&clearTimeout(mt.current),mt.current=setTimeout(()=>{const{activePageKey:r,decofile:l,variantIndex:c}=Le.current;if(!r)return;const p={...l[r]},S={...p.sections},g=[...S.variants??[]],_=g[c],L=_?.rule;if(Gt(L,l,x)){const N=L?.__resolveType??"",D=l[N],P=typeof D?.name=="string"?D.name:N,{__resolveType:de,...Re}=t;G.mutate({blockKey:N,data:Kt(de??"",Re,P)},{onSuccess:()=>m?.(),onError:G.reportError});return}_&&(g[c]={..._,rule:t}),p.sections={...S,variants:g},G.mutate({blockKey:r,data:p},{onSuccess:()=>m?.(),onError:G.reportError})},bn)},ir=t=>{be(t);const r=t?Jr(t,x):{__resolveType:Qr};Z(t?r:{}),or(r)},ar=t=>{const r=t;Z(r);const l=_e?{__resolveType:_e,...r}:{...r};or(l)},lr=async t=>{Ct();const{activePageKey:r,decofile:l,variantIndex:c}=Le.current;if(!r)return;const p=l[r],S=p?.sections;if(!S||typeof S!="object"||Array.isArray(S))return;const g=S;if(!Array.isArray(g.variants))return;const _=[...g.variants],L=_[c];if(!L)return;const N=Bt(L.rule,l,x),D=on(t);_[c]={...L,rule:D};const P={...l,[r]:{...p,sections:{...g,variants:_}}},{resolveType:de,formValue:Re}=jn(D,P,x??void 0);be(de),Z(Re);try{await G.mutateAsync({blockKey:r,data:P[r]}),N&&N!==t&&await Ht(N,P),m?.()}catch(nt){oe.error(f("sectionsEditor.sectionsEditor.couldNotApplySavedRule"),{description:Pt(f,It(nt))})}},cr=t=>{pt.current&&clearTimeout(pt.current);const{selectedSectionIndex:r,sectionVariantIndex:l}=Le.current;r!==null&&(pt.current=setTimeout(()=>{const{rawSections:c,parsedSections:p,decofile:S,activePageKey:g,pageVariants:_,variantIndex:L}=Le.current;if(!g)return;const N=c[r],D=p[r];if(!N||!D?.isMultivariate)return;const P=xt(N,D);if(!P)return;const Re=(P.variants??[])[l]?.rule;if(Gt(Re,S,x)){const J=Re?.__resolveType??"",fe=S[J],Ce=typeof fe?.name=="string"?fe.name:J,{__resolveType:Ue,...gt}=t;G.mutate({blockKey:J,data:Kt(Ue??"",gt,Ce)},{onSuccess:()=>m?.(),onError:G.reportError});return}const nt=Xr(P,l,t),Be=[...c];Be[r]=qt(N,D,nt);const Ge=Sn(S,g,Be,L,_);G.mutate({blockKey:g,data:Ge},{onSuccess:()=>m?.(),onError:G.reportError})},bn))},vi=t=>{st(t);const r=t?Jr(t,x):{__resolveType:Qr};tt(t?r:{}),cr(r)},xi=t=>{const r=t;tt(r);const l=Jt?{__resolveType:Jt,...r}:{...r};cr(l)},yi=async t=>{Ct();const{selectedSectionIndex:r,sectionVariantIndex:l,rawSections:c,parsedSections:p,decofile:S,activePageKey:g,pageVariants:_,variantIndex:L}=Le.current;if(r===null||!g)return;const N=c[r],D=p[r];if(!N||!D?.isMultivariate)return;const P=xt(N,D);if(!P)return;const de=P.variants??[],Re=Bt(de[l]?.rule,S,x),nt=on(t),Be=Xr(P,l,nt),Ge=[...c];Ge[r]=qt(N,D,Be);const J=Sn(S,g,Ge,L,_),fe={...S,[g]:J},{resolveType:Ce,formValue:Ue}=jn(nt,fe,x??void 0);st(Ce),tt(Ue);try{await G.mutateAsync({blockKey:g,data:J}),Re&&Re!==t&&await Ht(Re,fe),m?.()}catch(gt){oe.error(f("sectionsEditor.sectionsEditor.couldNotApplySavedRule"),{description:Pt(f,It(gt))})}};if(!ie&&!je)return i.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:f("sectionsEditor.sectionsEditor.noPageFound",{currentPath:u})});if(ie&&!Un)return i.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:f("sectionsEditor.sectionsEditor.globalBlockNotFound")});const $e=b!==null?Pe[b]??null:null,ur=b!==null?U[b]:null,dr=ur&&$e?.isMultivariate?xt(ur,$e):null,Nt=dr?vs(dr,wt):[],Vn=Math.min(Je,Math.max(Nt.length-1,0)),nn=Nt[Vn]??null,Tt=$e?.isMultivariate===!0,ss=b!==null&&$e!==null,Vt=ss&&(Tt||!!(Tn&&xe)),Si=Vt&&!ie&&$e?.isSavedBlock===!0,ut=ie||Si,fr=ie?Os:$e?.label??"",bi=Jt&&x?Kn(Jt,x):null,mr=(t,r)=>r&&M?`${t} · ${r}`:t,pr=$e?$e.variantOf??$e.label:"",ji=(()=>{const t=Tt&&nn?nn.label:null;return t?M?[mr(pr,t)]:[$e.label,t]:[$e?.label??""]})(),rs=mr(je?.name??"",ht?rt?.label:null),Dn=Vt&&(!ie||q.length>0)?ie?[Os,...q]:[rs,...ji,...q]:[],hr=qe&&je?[je.name,"SEO",...Vs]:[],gr=f("sectionsEditor.pageVariantTabs.variantsLabel"),vr=et&&je?[je.name,gr]:Ot&&je&&$e?[rs,pr,gr]:[],Mn=vr.length>0?vr:hr.length>0?hr:ut?Dn.length>0?Dn:[fr]:Dn.length>0?Dn:[rs],xr=ss&&!Tt&&!$e?.isHidden&&!!E,wi=ut||!ie&&ht&&!!rt||xr,_i=ss&&!Tt&&!ie&&q.length===0&&!!$e&&jo($e)&&!!E,ki=M&&Vt&&!Ot&&Tt&&q.length===0&&!!nn,yr=M&&q.length>0?Fr(q[q.length-1]):null,Ei=q.length>1?Fr(q[q.length-2]):null,Sr=ut?fr:Vt?$e?.label??"":je?.name??"",Ri=et||Ot?f("sectionsEditor.pageVariantTabs.variantsLabel"):qe?f("sectionsEditor.panelSections.seo"):yr??Sr,br=Ot?$e?.variantOf??$e?.label??"":et||qe?je?.name??"":yr?Ei??Sr:ut?f("sectionsEditor.sectionsEditor.globalSectionSubtitle"):Vt?je?.name??"":je?.path??"",os=!et&&!Ot&&!qe&&!Vt&&!ut,Ai=!M&&!qe&&!ie&&Tt&&q.length===0,yn=()=>{if(!E)return;Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const t=y[E],r=Ya(t.sections,U);if(!r)return;const l=Ja(r);G.mutate({blockKey:E,data:{...t,sections:r}},{onSuccess:()=>{ue(l),B(null),T(null),K(null),O([]),Z(null),be(null)},onError:G.reportError})},Pn=(t,r,l)=>{if(!E)return;Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const c=y[E],p=c.sections;if(!p||typeof p!="object"||Array.isArray(p))return;const S=p;if(!Array.isArray(S.variants))return;const g=t([...S.variants]);if(!g)return;const _=ol(S,g),L={...y,[E]:{...c,sections:_}};G.mutate({blockKey:E,data:L[E]},{onSuccess:()=>{r?.();const N=typeof l=="string"?[l]:l??[];(async()=>{for(const D of N)await Ht(D,L)})()},onError:G.reportError})},is=t=>{Ee(null),ue(t),B(null),T(null),K(null),O([]);const r=Me[t]?.rule,{resolveType:l,formValue:c}=jn(r,y??{},x??void 0);be(l),Z(c),Xn(Me.map(p=>({rule:p.rule})),t)},jr=(t,r)=>{if(t===r)return;let l=we;we===t?l=r:t<we&&r>=we?l=we-1:t>we&&r<=we&&(l=we+1),ue(l);const c=Ln(Me.map(p=>({rule:p.rule})),t,r);Xn(c,l),Pn(p=>Ln(p,t,r))},wr=t=>{const r=Me[t]?.rule,l=Bt(r,y??{},x??void 0);Pn(c=>c.length<=1?null:(c.splice(t,1),c),()=>{Me.length-1===1?ue(0):t<we?ue(we-1):t===we&&ue(Math.max(0,t-1)),B(null),T(null),K(null),O([]),Z(null),be(null)},l)},Ci=()=>{const t=Me.map((r,l)=>({variant:r,index:l})).filter(({variant:r})=>!rl(r.rule)).map(({variant:r})=>Bt(r.rule,y??{},x??void 0)).filter(r=>!!r);Pn(r=>{const l=ll({variants:r}),c=r[l];return c?[{...c,rule:cl()}]:null},()=>{ue(0),B(null),T(null),K(null),O([]),Z(null),be(null),ft(!1)},t)},_r=t=>{Pn(r=>ul(r,t),()=>{ue(t+1),B(null),T(null),K(null),O([]),Z(null),be(null)})},Ni=async(t,r)=>{Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const l=Le.current.activePageKey,c=Le.current.decofile;if(!l)return;const p=c[l],S=p.sections;if(!S||typeof S!="object"||Array.isArray(S))return;const g=S;if(!Array.isArray(g.variants))return;const _=[...g.variants],L=_[t];if(!L?.rule||typeof L.rule!="object"){oe.error(f("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const N=L.rule,D=r.trim();Xt(!0);try{if(!D){if(!Gt(N,c,x)){Ee(null);return}const Ge=N.__resolveType??"";_[t]={...L,rule:xs(N,c,x)};const J={...c,[l]:{...p,sections:{...g,variants:_}}};await G.mutateAsync({blockKey:l,data:J[l]}),await Ht(Ge,J),Ee(null),m?.();return}const P=ys(N,c,x);if(!P){oe.error(f("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(P.blockKey){await G.mutateAsync({blockKey:P.blockKey,data:Kt(P.resolveType,P.data,D)}),Ee(null),m?.();return}const de=Fn(D),Re=On(de,c,x);if(Re){oe.error(Re);return}const nt=Kt(P.resolveType,P.data,D);let Be=null;try{await G.mutateAsync({blockKey:de,data:nt}),Be=de,_[t]={...L,rule:on(de)},await G.mutateAsync({blockKey:l,data:{...p,sections:{...g,variants:_}}}),Be=null}catch(Ge){throw Be&&await Rn.mutateAsync({blockKey:Be}).catch(()=>{}),Ge}Ee(null),oe.success(f("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:D})),m?.()}catch(P){oe.error(f("sectionsEditor.sectionsEditor.failedToRenameVariant"),{description:Pt(f,It(P))})}finally{Xt(!1)}},Ti=async(t,r)=>{Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const{selectedSectionIndex:l,rawSections:c,parsedSections:p,decofile:S,activePageKey:g,pageVariants:_,variantIndex:L}=Le.current;if(l===null||!g)return;const N=c[l],D=p[l];if(!N||!D?.isMultivariate)return;const P=xt(N,D);if(!P)return;const de=P.variants??[],Re=de[t];if(!Re?.rule||typeof Re.rule!="object"){oe.error(f("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const nt=Re.rule,Be=r.trim();Xt(!0);const Ge=async J=>{const fe={...P,variants:J},Ce=[...c];Ce[l]=qt(N,D,fe);const Ue=Sn(S,g,Ce,L,_);return await G.mutateAsync({blockKey:g,data:Ue}),{...S,[g]:Ue}};try{if(!Be){if(!Gt(nt,S,x)){Ve(null);return}const ot=nt.__resolveType??"",vt=[...de];vt[t]={...Re,rule:xs(nt,S,x)};const Dt=await Ge(vt);await Ht(ot,Dt),Ve(null),m?.();return}const J=ys(nt,S,x);if(!J){oe.error(f("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(J.blockKey){await G.mutateAsync({blockKey:J.blockKey,data:Kt(J.resolveType,J.data,Be)}),Ve(null),m?.();return}const fe=Fn(Be),Ce=On(fe,S,x);if(Ce){oe.error(Ce);return}const Ue=Kt(J.resolveType,J.data,Be);let gt=null;try{await G.mutateAsync({blockKey:fe,data:Ue}),gt=fe;const ot=[...de];ot[t]={...Re,rule:on(fe)},await Ge(ot),gt=null}catch(ot){throw gt&&await Rn.mutateAsync({blockKey:gt}).catch(()=>{}),ot}Ve(null),oe.success(f("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:Be})),m?.()}catch(J){oe.error(f("sectionsEditor.sectionsEditor.failedToRenameVariant"),{description:Pt(f,It(J))})}finally{Xt(!1)}},kr=async(t,r,l)=>{T(l);try{await G.mutateAsync({blockKey:t,data:l})}catch(c){throw T(p=>p===l?r:p),c}},Vi={rename:async(t,r,l)=>{Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const{activePageKey:c,decofile:p}=Le.current;if(!c)return;const S=Array.isArray(t.variants)?[...t.variants]:[],g=S[r],_=g?.rule&&typeof g.rule=="object"?g.rule:void 0,L=async D=>{const P={...t,variants:D};return await kr(c,t,P),{...p,[c]:P}},N=qc(_,l,p,x);if(N.kind!=="noop"){if(N.kind==="error"){oe.error(N.reason==="no-matcher-rule"?f("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"):N.reason==="unreadable-rule"?f("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"):N.message??f("sectionsEditor.sectionsEditor.failedToRenameVariant"));return}Xt(!0);try{if(N.kind==="inline"){const P=[...S];P[r]={...g,rule:N.inlinedRule};const de=await L(P);await Ht(N.blockKey,de),m?.();return}if(N.kind==="updateBlock"){await G.mutateAsync({blockKey:N.blockKey,data:N.blockData}),m?.();return}let D=null;try{await G.mutateAsync({blockKey:N.blockId,data:N.blockData}),D=N.blockId;const P=[...S];P[r]={...g,rule:N.reference},await L(P),D=null}catch(P){throw D&&await Rn.mutateAsync({blockKey:D}).catch(()=>{}),P}oe.success(f("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:l.trim()})),m?.()}catch(D){oe.error(f("sectionsEditor.sectionsEditor.failedToRenameVariant"),{description:Pt(f,It(D))})}finally{Xt(!1)}}},selectGlobal:async(t,r,l)=>{Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const{activePageKey:c,decofile:p}=Le.current;if(!c)return;const S=Array.isArray(t.variants)?[...t.variants]:[],g=S[r];if(!g)return;const _=Bt(g.rule,p,x);S[r]={...g,rule:on(l)};const L={...t,variants:S},N={...p,[c]:L};try{await kr(c,t,L),_&&_!==l&&await Ht(_,N),m?.()}catch(D){oe.error(f("sectionsEditor.sectionsEditor.couldNotApplySavedRule"),{description:Pt(f,It(D))})}}},Er=()=>{zt()},Rr=t=>{ln(t),ts({inner:t})},Ar=t=>{En(t),ts({raw:t})},Cr=()=>{ln(null),Lt([])},Nr=()=>Yt(t=>t+1),Tr=()=>{cn.flush(),an(!1),ln(null),En(void 0),Lt([]),Yt(t=>t+1),A?.()},Di=()=>{ft(!1),kn(!1),B(null),an(!0)},Mi=()=>{qe&&Tr(),B(null),ft(!0)},Pi=()=>kn(!0),as=t=>{if(et&&t===0){ft(!1);return}if(Ot&&t<2){kn(!1),t===0&&B(null);return}if(qe){if(t===0){Tr();return}if(t===1){Lt([]),Yt(l=>l+1);return}Lt(Vs.slice(0,t-1)),Yt(l=>l+1);return}if(ie){O(q.slice(0,t)),Q(l=>l+1);return}if(t===0){Er();return}if(t===1){O([]),Q(l=>l+1);return}const r=!M&&Tt&&nn?1:0;if(r===1&&t===2){O([]),Q(l=>l+1);return}O(q.slice(0,t-1-r))},ls=Mn.length>1?i.jsx("button",{type:"button",onClick:()=>as(_a(Mn.length,{isMultivariateSectionTop:Ai})),title:f("sectionsEditor.sectionsEditor.back"),"aria-label":f("sectionsEditor.sectionsEditor.back"),className:ae("shrink-0 inline-flex size-6 items-center justify-center rounded-[var(--studio-control-radius,var(--radius-md))] transition-colors",ut?"text-foreground/80 hover:bg-global-section/15":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:i.jsx(Ca,{className:"size-4"})}):null,Ii=ut||Vt||qe?wi&&i.jsxs("div",{className:ae("border-b px-3 py-2.5",ut&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[!ie&&ht&&rt&&i.jsxs("button",{type:"button",onClick:Er,title:f("sectionsEditor.sectionsEditor.editingInVariant",{variant:rt.label}),className:ae("shrink-0 inline-flex items-center gap-1 rounded-lg h-6 px-1.5 text-xs font-medium cursor-pointer transition-opacity hover:opacity-80",ga),children:[i.jsx(ha,{rule:fs(rt.rule,y??{},x??void 0),matchers:tn}),i.jsx("span",{className:"max-w-[160px] truncate",children:rt.label})]}),i.jsx("div",{className:"flex-1"}),ut&&i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx("span",{className:"shrink-0 cursor-help",children:i.jsx(zn,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),i.jsx(Rt,{side:"bottom",className:"max-w-[260px]",children:f("sectionsEditor.sectionsEditor.globalSectionTooltip")})]}),xr&&i.jsx(Bn,{onClick:()=>xn()})]}),ut&&i.jsx("p",{className:"mt-1.5 py-1.5 pl-1 text-sm leading-snug text-foreground",children:f("sectionsEditor.sectionsEditor.globalSectionBanner")})]}):i.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2.5",children:[i.jsx("div",{className:"flex-1 min-w-0",children:i.jsx(Or,{pageKey:E,initialName:je.name,initialPath:je.path,onFieldChange:Xs,variant:"header"})}),i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"ghost",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.editSeo"),className:"size-7 shrink-0",onClick:()=>an(!0),children:i.jsx(Gr,{size:14})})}),i.jsx(Rt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.editSeo")})]}),i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"ghost",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.viewJson"),className:"size-7 shrink-0",onClick:()=>z&&E?z():dt(!0),children:i.jsx(Ur,{size:14})})}),i.jsx(Rt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.viewJson")})]}),i.jsx(Bn,{onClick:yn})]}),Bi=i.jsxs(i.Fragment,{children:[ht&&E&&i.jsx(Lr,{listKey:E,variants:Me,activeIndex:we,decofile:y??{},meta:x,matchers:tn,onSelect:is,onReorder:jr,onRename:Ee,onDuplicate:_r,onDelete:wr,onAdd:yn}),ht&&_e!==null&&i.jsx($r,{className:"mt-3",children:i.jsx("div",{className:ae("space-y-3",Qt&&"pointer-events-none opacity-50"),children:i.jsx(us,{currentRt:_e,currentLabel:wn(rt?.rule,y??{},wt,x??void 0),currentGlobalKey:Bt(rt?.rule,y??{},x??void 0)??void 0,matchers:tn,globals:ns,onSelect:ir,onSelectGlobal:lr,schema:rr,formValue:Te,onChange:ar,formKey:`${we}:${_e??""}`,formWrapperClassName:"space-y-3",meta:x??void 0,decofile:y,onSaveReferencedBlock:un,sandbox:hn})})})]}),Vr=i.jsxs(i.Fragment,{children:[i.jsx(va,{listKey:`${E??""}:${b??""}`,variants:Nt.map((t,r)=>({index:r,label:t.label})),selectedIndex:Vn,onSelect:er,onRename:Ve,onDuplicate:pi,onDelete:mi,onRemoveAll:tr,onReorder:hi,onAdd:()=>xn()}),i.jsx($r,{children:i.jsx(us,{currentRt:Jt??"",currentLabel:wn(nn?.rule,y??{},wt,x??void 0),currentGlobalKey:Bt(nn?.rule,y??{},x??void 0)??void 0,matchers:tn,globals:ns,onSelect:vi,onSelectGlobal:yi,schema:bi,formValue:Mo,onChange:xi,formKey:`${b??"none"}:${Vn}:${Jt??""}`,formWrapperClassName:"pt-1",meta:x??void 0,decofile:y,onSaveReferencedBlock:un,sandbox:hn})})]}),Dr=i.jsx("div",{className:ae(M?"px-2":"p-2 pt-3"),children:i.jsx(Zl,{listKey:`${E??""}-${we}`,rawSections:U,sections:Pe,meta:x,decofile:y,selectedIndex:b,onSelect:ri,onReorder:oi,onDelete:ii,onDuplicate:ai,onMakeReusable:He,onToggleHidden:li,onToggleLazy:he?ci:void 0,onAddVariant:xn,onDetach:ui,onAddSection:()=>Fe(!0),canAddSection:sr})}),Ki=i.jsxs("div",{className:"min-w-0 max-w-full space-y-4 overflow-x-hidden px-3",children:[E&&je&&i.jsx(Or,{pageKey:E,initialName:je.name,initialPath:je.path,onFieldChange:Xs}),mn&&E?i.jsx(so,{rawSeo:Cn,innerSeo:Jn,defaultResolveType:$s,seoSchema:zs,activeResolveType:Nn,seoTypeOptions:Ls,formResetKey:Ds,siteDefaultSeo:Hs,onBreadcrumbChange:Lt,onPersistRaw:Ar,onInnerChange:Rr,onClearForm:Cr,onBumpFormKey:Nr,asyncRenderAvailable:he}):i.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:f("sectionsEditor.sectionsEditor.seoSchemaNotFound")})]}),Fi=i.jsx(rn,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:i.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:i.jsx("div",{className:"mx-auto max-w-2xl",children:mn&&E?i.jsx(so,{rawSeo:Cn,innerSeo:Jn,defaultResolveType:$s,seoSchema:zs,activeResolveType:Nn,seoTypeOptions:Ls,formResetKey:Ds,siteDefaultSeo:Hs,onBreadcrumbChange:Lt,onPersistRaw:Ar,onInnerChange:Rr,onClearForm:Cr,onBumpFormKey:Nr,asyncRenderAvailable:he}):i.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:f("sectionsEditor.sectionsEditor.seoSchemaNotFound")})})})},"editor-seo"),Oi=i.jsxs(rn,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[ht&&E&&i.jsx(Lr,{listKey:E,variants:Me,activeIndex:we,decofile:y??{},meta:x,matchers:tn,onSelect:is,onReorder:jr,onRename:Ee,onDuplicate:_r,onDelete:wr,onAdd:yn}),ht&&_e!==null&&i.jsxs("div",{className:ae("px-3 border-b",De?"pt-3 pb-5 space-y-3":"py-2"),children:[i.jsxs("button",{type:"button",onClick:()=>yt(t=>!t),className:"flex w-full items-center justify-between gap-2 text-left cursor-pointer rounded-[var(--studio-control-radius,var(--radius-sm))] py-0.5 hover:bg-muted/40","aria-expanded":De,children:[i.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:f("sectionsEditor.sectionsEditor.variantRule")}),De?i.jsx(Ea,{className:"size-3.5 shrink-0 text-muted-foreground"}):i.jsx(Ra,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),De&&i.jsx("div",{className:ae("space-y-3",Qt&&"pointer-events-none opacity-50"),children:i.jsx(us,{currentRt:_e,currentLabel:wn(rt?.rule,y??{},wt,x??void 0),currentGlobalKey:Bt(rt?.rule,y??{},x??void 0)??void 0,matchers:tn,globals:ns,onSelect:ir,onSelectGlobal:lr,schema:rr,formValue:Te,onChange:ar,formKey:`${we}:${_e??""}`,formWrapperClassName:"space-y-3",meta:x??void 0,decofile:y,onSaveReferencedBlock:un,sandbox:hn})})]}),Dr]},"editor-section-list");return i.jsx(xa,{children:i.jsxs("div",{className:"flex h-full min-w-0 w-full flex-col",children:[!M&&ls&&i.jsx("div",{className:"flex min-w-0 shrink-0 items-center gap-2 px-3 py-2",children:ls}),(M||Mn.length>1)&&i.jsx(ya,{crumbs:Mn,onSelect:as,onSelectRoot:()=>{cn.flush(),$?$():as(0)}}),i.jsx("div",{className:"shrink-0",children:M?i.jsxs("div",{className:ae("flex items-center gap-2 border-b px-3 py-2.5",ut&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[M&&ls,ut&&i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx("span",{className:"shrink-0 cursor-help",children:i.jsx(zn,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),i.jsx(Rt,{side:"bottom",className:"max-w-[260px]",children:f("sectionsEditor.sectionsEditor.globalSectionTooltip")})]}),i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[i.jsx("span",{className:"truncate text-sm font-semibold",children:Ri}),br&&i.jsx("span",{className:"truncate text-xs text-muted-foreground",children:br})]}),os&&ht&&rt&&i.jsx(zr,{variants:Me,activeIndex:we,onSelect:is,onManage:Mi,onRemoveAll:Ci}),ki&&i.jsx(zr,{variants:Nt,activeIndex:Vn,onSelect:er,onManage:Pi,onRemoveAll:tr}),os&&!ht&&i.jsx(Bn,{onClick:yn}),_i&&i.jsx(Bn,{onClick:()=>xn()}),i.jsx(Sa,{}),os&&i.jsxs(i.Fragment,{children:[i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"outline",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.editSeo"),className:"size-7 shrink-0",onClick:Di,children:i.jsx(Gr,{size:14})})}),i.jsx(Rt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.editSeo")})]}),!z&&i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"outline",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.viewJson"),className:"size-7 shrink-0",onClick:()=>dt(!0),children:i.jsx(Ur,{size:14})})}),i.jsx(Rt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.viewJson")})]})]})]}):Ii}),lt&&i.jsx(yc,{open:!0,fields:cc(lt.plan,lt.target.schema),choices:lt.choices,changedAgain:lt.changedAgain,author:zo,fresh:lt.fresh,onChoose:(t,r)=>si({...lt.choices,[t]:r}),onApply:ni},Jc(lt.formBase)),Ot?i.jsx(Hr,{onAdd:()=>xn(),children:Vr},"editor-section-variants"):Vt?i.jsxs(rn,{viewportRef:Ke,onBlur:Gs,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[!M&&Tt&&Nt.length>0&&q.length===0&&Vr,i.jsx(Wr,{activeSchema:Tn,formValue:xe,formResetKey:Ye,onFormChange:Qs,onBreadcrumbChange:O,breadcrumbPath:q,emptyMessage:f("sectionsEditor.sectionsEditor.noEditableFieldsForVariant"),meta:x,decofile:y,onSaveReferencedBlock:un,sandbox:hn,previewBaseUrl:ee,onRequestAddSection:Zs,onVariantMatcherOp:ie?Vi:void 0})]},"editor-section-form"):ie?i.jsx(rn,{viewportRef:Ke,onBlur:Gs,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:i.jsx(Wr,{activeSchema:Tn,formValue:xe,formResetKey:Ye,onFormChange:Qs,onBreadcrumbChange:O,breadcrumbPath:q,emptyMessage:f("sectionsEditor.sectionsEditor.noEditableFieldsForGlobalBlock"),meta:x,decofile:y,onSaveReferencedBlock:un,sandbox:hn,previewBaseUrl:ee,onRequestAddSection:Zs})},"editor-global-block"):qe?M?i.jsx(rn,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:i.jsx("div",{className:"p-3",children:Ki})},"editor-seo"):Fi:et?i.jsx(Hr,{onAdd:yn,children:Bi},"editor-variants"):M?i.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[i.jsx(rn,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:i.jsx("div",{className:"py-2",children:Dr})}),i.jsx("div",{className:"shrink-0 border-t p-2",children:i.jsx(js,{canAddSection:sr,onAddSection:()=>Fe(!0)})})]},"editor-section-list"):Oi,i.jsx(ba,{open:ke!==null,onOpenChange:t=>{t||He(null)},defaultBlockId:ke!==null?Fn(Pe[ke]?.label??""):"",isPending:G.isPending,onSubmit:gi}),ve&&i.jsx(Al,{open:Ze,onOpenChange:t=>{Fe(t),t||(ne.current=null)},meta:x,decofile:y,previewBaseUrl:ee,onSelect:fi}),re&&E&&y&&i.jsx(La,{open:re,onOpenChange:dt,pageKey:E,decofile:y}),We!==null&&i.jsx(qr,{open:!0,initialName:Gt(Me[We]?.rule,y??{},x??void 0)?wn(Me[We]?.rule,y??{},wt,x??void 0):"",autoLabel:wt(fs(Me[We]?.rule,y??{},x??void 0)),isPending:Qt,onSubmit:async t=>{await Ni(We,t)},onOpenChange:t=>{!t&&!Qt&&Ee(null)}}),Ie!==null&&i.jsx(qr,{open:!0,initialName:Gt(Nt[Ie]?.rule,y??{},x??void 0)?wn(Nt[Ie]?.rule,y??{},wt,x??void 0):"",autoLabel:wt(fs(Nt[Ie]?.rule,y??{},x??void 0)),isPending:Qt,onSubmit:async t=>{await Ti(Ie,t)},onOpenChange:t=>{!t&&!Qt&&Ve(null)}})]})})}export{tm as SectionsEditor};