decocms 4.516.0 → 4.518.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 (417) hide show
  1. package/dist/client/assets/{ActiveShapeUtils-BviJ1RJ0.js → ActiveShapeUtils-DC4ySNWR.js} +1 -1
  2. package/dist/client/assets/{AlertCircle-BzjzqqRa.js → AlertCircle-DgnxHqxe.js} +1 -1
  3. package/dist/client/assets/{AreaChart-DxdfvWkl.js → AreaChart-Ccsbdjec.js} +1 -1
  4. package/dist/client/assets/{ArrowLeft-D9e74CxD.js → ArrowLeft-BJ1448l4.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-BbhuuuwV.js → ArrowUp-723TVuFG.js} +1 -1
  6. package/dist/client/assets/{BarChart-C6YMYkiP.js → BarChart-BdOKvWnK.js} +1 -1
  7. package/dist/client/assets/{Building02-C2flUGF-.js → Building02-DU823ZCw.js} +1 -1
  8. package/dist/client/assets/{CartesianChart-CPZndNAT.js → CartesianChart-3-g5kX2i.js} +1 -1
  9. package/dist/client/assets/{CategoricalChart-BjLODSSF.js → CategoricalChart-CinaMpxG.js} +1 -1
  10. package/dist/client/assets/{CheckCircle-4gdTBGy6.js → CheckCircle-C7csYE-y.js} +1 -1
  11. package/dist/client/assets/{ChevronSelectorVertical-YTUkgDHg.js → ChevronSelectorVertical-B0Z7parR.js} +1 -1
  12. package/dist/client/assets/{ChevronUp-BnA2Nw_G.js → ChevronUp-DiTVmUiH.js} +1 -1
  13. package/dist/client/assets/{Copy01-DK6eLr2i.js → Copy01-DRNuKy-h.js} +1 -1
  14. package/dist/client/assets/{CreditCard01-CMqZSaqi.js → CreditCard01-C3f2i_qY.js} +1 -1
  15. package/dist/client/assets/{DotsVertical-C4UAKneF.js → DotsVertical-eX97dPc6.js} +1 -1
  16. package/dist/client/assets/{ErrorBarContext-bVCQsHLU.js → ErrorBarContext-CCb5UZ88.js} +1 -1
  17. package/dist/client/assets/{Globe04-DEY1e_cW.js → Globe04-ByvV2bPX.js} +1 -1
  18. package/dist/client/assets/{Image01-DwBREChx.js → Image01-QuVxFosz.js} +1 -1
  19. package/dist/client/assets/{Key01-MBTcw2W0.js → Key01-C-QXsN23.js} +1 -1
  20. package/dist/client/assets/{Link01-CHLntxrX.js → Link01-CbpFxbNY.js} +1 -1
  21. package/dist/client/assets/{LinkBroken01-CTiL1Fp-.js → LinkBroken01-DDgMbBWJ.js} +1 -1
  22. package/dist/client/assets/{Minus-BCeBycMD.js → Minus-DnJ8wbLv.js} +1 -1
  23. package/dist/client/assets/{Monitor01-DtC0vfP6.js → Monitor01-DD5_JCl8.js} +1 -1
  24. package/dist/client/assets/{Play-DV5Ma4c6.js → Play-BgEaB30r.js} +1 -1
  25. package/dist/client/assets/{Plus-CxQiW556.js → Plus-BnqPSlPj.js} +1 -1
  26. package/dist/client/assets/{ReferenceLine-CyFWmCIf.js → ReferenceLine-PgVE-Dmr.js} +1 -1
  27. package/dist/client/assets/{SearchMd-CYuw_TlP.js → SearchMd-GQAKwnQD.js} +1 -1
  28. package/dist/client/assets/{Sector-7HoHBp31.js → Sector-DG1U_Qdd.js} +1 -1
  29. package/dist/client/assets/{ShoppingBag01-hqBb4euZ.js → ShoppingBag01-DVHnZchK.js} +1 -1
  30. package/dist/client/assets/{Sun-_7OyKm8q.js → Sun-Ct5gftPt.js} +1 -1
  31. package/dist/client/assets/{SwitchHorizontal01-Ik-Wu8bp.js → SwitchHorizontal01-_kdH1ete.js} +1 -1
  32. package/dist/client/assets/{Tool01-CEmvRWh7.js → Tool01-rTZNmFct.js} +1 -1
  33. package/dist/client/assets/{Trash01-7PWQCtvD.js → Trash01-TPK4gSsp.js} +1 -1
  34. package/dist/client/assets/{Upload01-d0p8GdRf.js → Upload01-D6tRQTgc.js} +1 -1
  35. package/dist/client/assets/{User01-CvsUVXiw.js → User01-1q78INo2.js} +1 -1
  36. package/dist/client/assets/{UserSquare-CRvybnC2.js → UserSquare-B_yRFcN6.js} +1 -1
  37. package/dist/client/assets/{Users01-BpDVBOEG.js → Users01-D5MhP5r0.js} +1 -1
  38. package/dist/client/assets/{XClose-CjXzVHwC.js → XClose-DOXmYMF_.js} +1 -1
  39. package/dist/client/assets/{ZoomOut-CLJKIGNa.js → ZoomOut-DLICjI1h.js} +1 -1
  40. package/dist/client/assets/{access-gate-C_XxaZ28.js → access-gate-p2OBWc28.js} +1 -1
  41. package/dist/client/assets/{add-connection-dialog-TX2J4mBu.js → add-connection-dialog-BluC5xOJ.js} +1 -1
  42. package/dist/client/assets/agent-analytics-D7PovqhV.js +1 -0
  43. package/dist/client/assets/agent-app-DEsjnzHy.js +1 -0
  44. package/dist/client/assets/{agent-assets-DzeNVWVS.js → agent-assets-CsYWD2CR.js} +1 -1
  45. package/dist/client/assets/{agent-automation-fasQYxyE.js → agent-automation-J7szToQ3.js} +1 -1
  46. package/dist/client/assets/{agent-automations-CFCWY442.js → agent-automations-tGwSufFx.js} +1 -1
  47. package/dist/client/assets/agent-calendar-Co4HNR_x.js +1 -0
  48. package/dist/client/assets/{agent-connect-sources-CUS1mQBU.js → agent-connect-sources-Bf7YpJtB.js} +1 -1
  49. package/dist/client/assets/agent-deck-Bra-oqcr.js +1 -0
  50. package/dist/client/assets/{agent-e2e-JX70_ikL.js → agent-e2e-B01kqUsN.js} +1 -1
  51. package/dist/client/assets/agent-experiments-W5vP2PHw.js +1 -0
  52. package/dist/client/assets/{agent-file-bVYB1cfC.js → agent-file-_hkGq1Y2.js} +1 -1
  53. package/dist/client/assets/{agent-hosting-DXYhe_Ly.js → agent-hosting-8jYjdLhJ.js} +1 -1
  54. package/dist/client/assets/{agent-icon-DhApO92C.js → agent-icon-g2PIrjzs.js} +1 -1
  55. package/dist/client/assets/agent-library-BTKjZMW2.js +1 -0
  56. package/dist/client/assets/agent-library-file-ClGbfS7a.js +1 -0
  57. package/dist/client/assets/{agent-monitor-DGuiH3_O.js → agent-monitor-Dtdyok8Z.js} +1 -1
  58. package/dist/client/assets/{agent-overview-DGX_nSiA.js → agent-overview-uVNzU6d3.js} +1 -1
  59. package/dist/client/assets/agent-releases-DVFEJ-Ad.js +2 -0
  60. package/dist/client/assets/agent-settings-DQDpgZ05.js +1 -0
  61. package/dist/client/assets/{agent-site-editor-CLwG7od-.js → agent-site-editor-DI9lfD7X.js} +2 -2
  62. package/dist/client/assets/agent-site-editor-code-CiWALb3j.js +2 -0
  63. package/dist/client/assets/agent-site-editor-content-BrDlLQPy.js +1 -0
  64. package/dist/client/assets/agent-site-editor-preview-Da7g0LlC.js +1 -0
  65. package/dist/client/assets/{agent-view-guard-wNwTHz77.js → agent-view-guard-Bhzmxyux.js} +1 -1
  66. package/dist/client/assets/agent-view-l1LYqbmp.js +1 -0
  67. package/dist/client/assets/{agents-list-Cikp_zRW.js → agents-list-CbFcTa4A.js} +1 -1
  68. package/dist/client/assets/{ai-providers-BSKNGjn3.js → ai-providers-Da7yjmwG.js} +1 -1
  69. package/dist/client/assets/{alert-dialog--q-PWeut.js → alert-dialog-KKnJELoX.js} +1 -1
  70. package/dist/client/assets/{alert-DK8EW5eY.js → alert-kpgdNVxk.js} +1 -1
  71. package/dist/client/assets/{analytics-sections-DMQ7rbtm.js → analytics-sections-DlComRmC.js} +1 -1
  72. package/dist/client/assets/{analytics-tab-DBS1a1Hh.js → analytics-tab-B_HbOlqF.js} +1 -1
  73. package/dist/client/assets/{api-keys-Dq1k7MiZ.js → api-keys-DNrkQCkt.js} +1 -1
  74. package/dist/client/assets/api-keys-kxUaur7Y.js +1 -0
  75. package/dist/client/assets/{app-editor-CrjU5dmy.js → app-editor-CKdeak5r.js} +1 -1
  76. package/dist/client/assets/{asset-utils-DobQJkEL.js → asset-utils-CYyNDrFK.js} +1 -1
  77. package/dist/client/assets/{auth-BCqAeFp3.js → auth-DHZfBLZ5.js} +1 -1
  78. package/dist/client/assets/{auth-catchall-BZEwAlpH.js → auth-catchall-BS8FAipd.js} +1 -1
  79. package/dist/client/assets/{auth-entry-Buz4HmC0.js → auth-entry-34SQAdx9.js} +1 -1
  80. package/dist/client/assets/{auth-split-layout-C7U-I3vQ.js → auth-split-layout-DF-Z-sUB.js} +1 -1
  81. package/dist/client/assets/{authenticate-and-persist-oauth-BAReQnW9.js → authenticate-and-persist-oauth-CbgraxNg.js} +1 -1
  82. package/dist/client/assets/{automation-list-row-DYoDbKDa.js → automation-list-row-DtCSZcdc.js} +1 -1
  83. package/dist/client/assets/{automation-runs-DS3JbQ2r.js → automation-runs-Lelpmww0.js} +1 -1
  84. package/dist/client/assets/{automations-DnYOtmr4.js → automations-CV4vMVkc.js} +1 -1
  85. package/dist/client/assets/{autosend-CC_H9WVC.js → autosend-Cwww7_9j.js} +1 -1
  86. package/dist/client/assets/{avatar-BCxNXTas.js → avatar-BRRGslVN.js} +1 -1
  87. package/dist/client/assets/{badge-Ccv2yax2.js → badge-DmeqGssZ.js} +1 -1
  88. package/dist/client/assets/{block-document-pbAqRC0D.js → block-document-DtA_3M8z.js} +1 -1
  89. package/dist/client/assets/{blocks-preview-workspace-context-CAntUw6y.js → blocks-preview-workspace-context--o78Y3yp.js} +1 -1
  90. package/dist/client/assets/{blocks-tab-states-B-gG8PUG.js → blocks-tab-states-Dps89GrH.js} +1 -1
  91. package/dist/client/assets/{blog-schema-DP6BXJ_v.js → blog-schema-CEYO8j-N.js} +1 -1
  92. package/dist/client/assets/{buckets-YwJbmX1H.js → buckets-CXMlDLcD.js} +1 -1
  93. package/dist/client/assets/{build-improve-prompt-doc-yJWFG-Qh.js → build-improve-prompt-doc-C7S9lWPM.js} +1 -1
  94. package/dist/client/assets/{calendar-CWZHYNsm.js → calendar-B6BpOXfC.js} +1 -1
  95. package/dist/client/assets/{campaigns-view-BJ3dqrez.js → campaigns-view-DtQvcOC6.js} +1 -1
  96. package/dist/client/assets/{capability-load-error-ClFcG_k7.js → capability-load-error-CDC4LjDf.js} +1 -1
  97. package/dist/client/assets/category-editor-BvoAtPRs.js +1 -0
  98. package/dist/client/assets/{chart-ecSSTZTh.js → chart-CTinHp-8.js} +1 -1
  99. package/dist/client/assets/{chat-context-BE5W0eRy.js → chat-context-DLezfYEa.js} +1 -1
  100. package/dist/client/assets/{chat-draft-Bc38hokV.js → chat-draft-BlRnwK9v.js} +1 -1
  101. package/dist/client/assets/{checkbox-BUQlb_zR.js → checkbox-BlB_jfat.js} +1 -1
  102. package/dist/client/assets/{choose-editor-CTk7V5dU.js → choose-editor-DHZGPvHu.js} +1 -1
  103. package/dist/client/assets/{cli-auth-success-PigkRVuP.js → cli-auth-success-DFaLHvgO.js} +1 -1
  104. package/dist/client/assets/{client-icons-CfYl7gN_.js → client-icons-CpqRIiQr.js} +1 -1
  105. package/dist/client/assets/cms-settings-editor-Dh-qBReE.js +1 -0
  106. package/dist/client/assets/{collapsible-CUpe_nLN.js → collapsible-DZTt-UAc.js} +1 -1
  107. package/dist/client/assets/{collection-detail-DMeJtWOq.js → collection-detail-BjUkXIkv.js} +1 -1
  108. package/dist/client/assets/{collection-display-button-BA8_qWgd.js → collection-display-button-Dmr1DpXh.js} +1 -1
  109. package/dist/client/assets/{collection-search-D3DfnNEj.js → collection-search-DcBOG84t.js} +1 -1
  110. package/dist/client/assets/{collection-table-wrapper-BpHyZuIk.js → collection-table-wrapper-CBLUEZ5z.js} +1 -1
  111. package/dist/client/assets/{collection-tabs-BeE9JyBt.js → collection-tabs-D5lfCRgo.js} +1 -1
  112. package/dist/client/assets/{column-rules-HrQ_91De.js → column-rules-B3eVnEiY.js} +1 -1
  113. package/dist/client/assets/{combobox-pGuSce6D.js → combobox-CVTULN6N.js} +1 -1
  114. package/dist/client/assets/{command-Due3aGE_.js → command-R1e1yMQ9.js} +1 -1
  115. package/dist/client/assets/{companion-mcps-section-B_r6DOQv.js → companion-mcps-section-hGQWfzwk.js} +1 -1
  116. package/dist/client/assets/{config-4MxJL_Fy.js → config-BWrcU7H3.js} +1 -1
  117. package/dist/client/assets/{connect-BmT0JQ1F.js → connect-CNN0l2XT.js} +1 -1
  118. package/dist/client/assets/{connect-layout-2QgFH1-_.js → connect-layout-DiWD8YTg.js} +1 -1
  119. package/dist/client/assets/{connect-source-dialog-_wKkm_O5.js → connect-source-dialog-xgaD8LgG.js} +1 -1
  120. package/dist/client/assets/{connection-z8RZuoJq.js → connection-WJRbuDz1.js} +1 -1
  121. package/dist/client/assets/{connection-card-CawZtrlG.js → connection-card-DnICQFn9.js} +1 -1
  122. package/dist/client/assets/{connection-detail-Dm8uTSp4.js → connection-detail-C0OJOuef.js} +1 -1
  123. package/dist/client/assets/{connection-form-helpers-_rP_t0oA.js → connection-form-helpers-CBYCAzPl.js} +1 -1
  124. package/dist/client/assets/{connections-DY1nEMCe.js → connections-DjwbhWNZ.js} +1 -1
  125. package/dist/client/assets/{content-tab-BMyhmLPO.js → content-tab-CAJ559-P.js} +3 -3
  126. package/dist/client/assets/{context-Br81mOVA.js → context-BkZJrbqd.js} +1 -1
  127. package/dist/client/assets/{context-menu-wXhD1da2.js → context-menu-B7wqDsW2.js} +1 -1
  128. package/dist/client/assets/{context-shell-CSyiGVu3.js → context-shell-DkaK_BOn.js} +3 -3
  129. package/dist/client/assets/{core.esm-C9O_xZ-F.js → core.esm-DHAYYfZu.js} +1 -1
  130. package/dist/client/assets/{create-organization-dialog-BULehCnN.js → create-organization-dialog-u0Ud2kaY.js} +1 -1
  131. package/dist/client/assets/{daily-pulse-Biczsq5_.js → daily-pulse-DRJB1hcS.js} +1 -1
  132. package/dist/client/assets/{discover-DY6Qihlm.js → discover-gZu3Sfan.js} +1 -1
  133. package/dist/client/assets/{domain-settings-D_mRu3Vm.js → domain-settings-USbT8NUs.js} +1 -1
  134. package/dist/client/assets/{drawer-BXIYbAX4.js → drawer-C9bfrQZ2.js} +1 -1
  135. package/dist/client/assets/{editor-DfNlEhGy.js → editor-4LyrkCqm.js} +1 -1
  136. package/dist/client/assets/{editor-classes-BgZFSVD_.js → editor-classes-_dczAbCq.js} +1 -1
  137. package/dist/client/assets/{empty-state-DK4d2ph4.js → empty-state-4Hlytpdt.js} +1 -1
  138. package/dist/client/assets/{empty-state-DHTpGmzV.js → empty-state-_a1QMwjl.js} +1 -1
  139. package/dist/client/assets/{experiments-tab-Bxbw5NAx.js → experiments-tab-DdHl8yk7.js} +1 -1
  140. package/dist/client/assets/{experiments-tab-choice-Du4Lvv_w.js → experiments-tab-choice-C9wWsYd4.js} +1 -1
  141. package/dist/client/assets/{extract-connection-data-9sczZwO0.js → extract-connection-data-mbA-zNaE.js} +1 -1
  142. package/dist/client/assets/{feature-gate-b0u-JPA_.js → feature-gate-iJnsMeBr.js} +1 -1
  143. package/dist/client/assets/{feature-paywall-BarXN_Ju.js → feature-paywall-DcguOiJA.js} +1 -1
  144. package/dist/client/assets/{file-explorer-DnOLSPWJ.js → file-explorer-B_iKC9bp.js} +1 -1
  145. package/dist/client/assets/{file-preview-Cak1nE11.js → file-preview-Dy07kmgf.js} +1 -1
  146. package/dist/client/assets/{file-share-button-kIwp5G-u.js → file-share-button-DOM1SplI.js} +1 -1
  147. package/dist/client/assets/{file-type-icon-6tQy_IZ-.js → file-type-icon-CP6Bm0Pm.js} +1 -1
  148. package/dist/client/assets/{folder-icon-R5rTkj7V.js → folder-icon-D_8O1LWU.js} +1 -1
  149. package/dist/client/assets/{form-DuWo7Npn.js → form-B2fhil9l.js} +1 -1
  150. package/dist/client/assets/{general-Cez86_jx.js → general-BE0anzP1.js} +1 -1
  151. package/dist/client/assets/{home-3R5Jmd9M.js → home-Bb5YZQHS.js} +1 -1
  152. package/dist/client/assets/{icon-button-DetNbpEP.js → icon-button-BQwa115u.js} +1 -1
  153. package/dist/client/assets/{index-CRcEuXTH.js → index-B4yeJC5N.js} +1 -1
  154. package/dist/client/assets/{index-DjG04H6F.js → index-BWgOKGMR.js} +1 -1
  155. package/dist/client/assets/{index-Cl9QwptG.js → index-CK40JGB6.js} +1 -1
  156. package/dist/client/assets/{index-C9OicJ74.js → index-CO7uP6ut.js} +1 -1
  157. package/dist/client/assets/{index-DHWYq2vY.js → index-CXWqnDP7.js} +1 -1
  158. package/dist/client/assets/{index-BdhYTUJI.js → index-CYHGIatu.js} +1 -1
  159. package/dist/client/assets/{index-DyvCBoQO.js → index-Ccma-e_l.js} +1 -1
  160. package/dist/client/assets/{index-DlAj9KxS.js → index-CeLGzS5y.js} +1 -1
  161. package/dist/client/assets/{index-CU2v_61i.js → index-Cs4qaYPX.js} +1 -1
  162. package/dist/client/assets/{index-D_jzSCP9.js → index-D2MFYEzD.js} +9 -9
  163. package/dist/client/assets/{index-CkQE3ies.js → index-DU8BFhZD.js} +1 -1
  164. package/dist/client/assets/{index-DppGNDNw.js → index-DXMlJvYf.js} +1 -1
  165. package/dist/client/assets/{index-BOTs238f.js → index-DiVZA6vr.js} +1 -1
  166. package/dist/client/assets/{index-B0KYQovx.js → index-R_qB4INp.js} +1 -1
  167. package/dist/client/assets/{index-Nkc_avaN.js → index-rKWXOhdZ.js} +1 -1
  168. package/dist/client/assets/{index-redirect-ZRzjZAU7.js → index-redirect-D2LQ3n9D.js} +1 -1
  169. package/dist/client/assets/{infiniteQueryObserver-nO7Ij1Gh.js → infiniteQueryObserver-CaSjeDsE.js} +1 -1
  170. package/dist/client/assets/{infra-billing-BzKPkpZz.js → infra-billing-_cCsUnUO.js} +1 -1
  171. package/dist/client/assets/{input---GPY-WG.js → input-D43D11gI.js} +1 -1
  172. package/dist/client/assets/{input-BS1vg5HJ.js → input-D9iDAvwy.js} +3 -3
  173. package/dist/client/assets/{integration-icon-BKkvrbiZ.js → integration-icon-CqbOWyvX.js} +1 -1
  174. package/dist/client/assets/{jira-icon-CNOdA3T8.js → jira-icon-Y_2uACKb.js} +1 -1
  175. package/dist/client/assets/{label-BHfVaXR7.js → label-3hTmrxoy.js} +1 -1
  176. package/dist/client/assets/{layout-CDcVgS1C.js → layout-EYuYXIPk.js} +1 -1
  177. package/dist/client/assets/{legacy-agents-deep-DPDWZmqy.js → legacy-agents-deep-Y0g29rl5.js} +1 -1
  178. package/dist/client/assets/{legacy-main-redirect-Cg_g45Jd.js → legacy-main-redirect-Pt1vRyf-.js} +1 -1
  179. package/dist/client/assets/library-DJ51ehEw.js +1 -0
  180. package/dist/client/assets/{login-wOfUg9Nh.js → login-DTF43M9h.js} +1 -1
  181. package/dist/client/assets/{markdown-Cd88osrX.js → markdown-BeKN4MPt.js} +1 -1
  182. package/dist/client/assets/{mcp-app-renderer-CFMsjvxz.js → mcp-app-renderer-DcbWj_cd.js} +1 -1
  183. package/dist/client/assets/{mcp-oauth-CReJrypj.js → mcp-oauth-BVLnM3ir.js} +1 -1
  184. package/dist/client/assets/{mcp-oauth-DQ_xwjzU.js → mcp-oauth-DQ__DCEs.js} +1 -1
  185. package/dist/client/assets/{members-EL9Mc9m1.js → members-DdYed_-G.js} +1 -1
  186. package/dist/client/assets/{memory-BawNPVGj.js → memory-CbDGJpdj.js} +1 -1
  187. package/dist/client/assets/{mini-report-page-BAVRLfhx.js → mini-report-page-I5w2A9ue.js} +1 -1
  188. package/dist/client/assets/{mock-board-CUvkl6Lq.js → mock-board-D64wFJ9x.js} +3 -3
  189. package/dist/client/assets/{monaco-editor-q0K0FpZQ.js → monaco-editor-DEU78sxw.js} +1 -1
  190. package/dist/client/assets/monitoring-Bklr39Mh.js +1 -0
  191. package/dist/client/assets/{monitoring-stats-row-BsUBQUMM.js → monitoring-stats-row-BLFmMtG4.js} +1 -1
  192. package/dist/client/assets/{multi-select-Db_ThqMQ.js → multi-select-DxNv8sxt.js} +1 -1
  193. package/dist/client/assets/{mustache-Pqeakuud.js → mustache-Cm6mC1mo.js} +2 -2
  194. package/dist/client/assets/{named-rule-uses-CocrtMGd.js → named-rule-uses-BBN_5zyZ.js} +1 -1
  195. package/dist/client/assets/{named-rule-view-DI8em1Ln.js → named-rule-view-Dgj56LCZ.js} +1 -1
  196. package/dist/client/assets/{new-project-dialog-CP7YY3zi.js → new-project-dialog-qMTAvOP0.js} +1 -1
  197. package/dist/client/assets/{oauth-callback-C87YK0QM.js → oauth-callback-DzKW1jLM.js} +1 -1
  198. package/dist/client/assets/{oauth-callback-ai-provider-BiPEsxGS.js → oauth-callback-ai-provider-BhTg9J9_.js} +1 -1
  199. package/dist/client/assets/{onboarding-BkgYJN30.js → onboarding-CcHHvf_v.js} +1 -1
  200. package/dist/client/assets/{openai-conversation-CMtl-uGo.js → openai-conversation-X6iReX5A.js} +1 -1
  201. package/dist/client/assets/{optimistic-project-sidebar-views-Dfnv2eVq.js → optimistic-project-sidebar-views-Wa4vMG32.js} +1 -1
  202. package/dist/client/assets/{order-monitor-day-B8b4_NRG.js → order-monitor-day-d8yh4cv8.js} +1 -1
  203. package/dist/client/assets/{organization-choice-D2OqEnT1.js → organization-choice-DKOeafiU.js} +1 -1
  204. package/dist/client/assets/{orgs-BT5DM-wr.js → orgs-CReR2HvS.js} +1 -1
  205. package/dist/client/assets/{page-seo-form-BZ5qz5Jc.js → page-seo-form-BTZBPUqn.js} +1 -1
  206. package/dist/client/assets/{pair-CbWxf18N.js → pair-DSps2zoM.js} +1 -1
  207. package/dist/client/assets/{parse-sections-C-MhwiHZ.js → parse-sections-Bc_lvOtq.js} +1 -1
  208. package/dist/client/assets/{plan-DZXfEuaN.js → plan-CxnMa3En.js} +1 -1
  209. package/dist/client/assets/{plan-ladder-jDYqtD5Q.js → plan-ladder-7wUcVwfI.js} +1 -1
  210. package/dist/client/assets/{popover-BVmz1c3N.js → popover-Dm_x8CV9.js} +1 -1
  211. package/dist/client/assets/{post-calendar-B_8534k5.js → post-calendar-BtFE-61n.js} +1 -1
  212. package/dist/client/assets/{post-editor-B2niN_j8.js → post-editor-QChnOq6Y.js} +2 -2
  213. package/dist/client/assets/{preview-content-3uKit-hf.js → preview-content-BUlAqj-X.js} +1 -1
  214. package/dist/client/assets/{preview-dialog-Du1qcsYi.js → preview-dialog-39V6ZO2Y.js} +1 -1
  215. package/dist/client/assets/preview-link-C762yHOt.js +1 -0
  216. package/dist/client/assets/{preview-panel-BoHCLryt.js → preview-panel-BvoYfTNF.js} +1 -1
  217. package/dist/client/assets/preview-tab-jmFSMM-R.js +551 -0
  218. package/dist/client/assets/{product-picker-dialog-DPPSOqIw.js → product-picker-dialog-iaXbdjia.js} +1 -1
  219. package/dist/client/assets/{profile-CkB0-zr4.js → profile-IgWNvITK.js} +1 -1
  220. package/dist/client/assets/{project-app-view-DXEcNYan.js → project-app-view-Bc-wof7y.js} +1 -1
  221. package/dist/client/assets/{project-apps-B5YazmD2.js → project-apps-DVzn0z1g.js} +1 -1
  222. package/dist/client/assets/{project-feed-DmjT3iA5.js → project-feed-BIwmxSQY.js} +1 -1
  223. package/dist/client/assets/{project-icon-BsqqQ1nI.js → project-icon-CJmvnLdz.js} +1 -1
  224. package/dist/client/assets/project-reports-DnaQ9nW_.js +1 -0
  225. package/dist/client/assets/project-tasks-cwxXGcyN.js +1 -0
  226. package/dist/client/assets/{projects-Cwzu5Iqo.js → projects-D8Cbhxnj.js} +1 -1
  227. package/dist/client/assets/{projects-empty-state-Br0wajyI.js → projects-empty-state-CmtOjsbv.js} +1 -1
  228. package/dist/client/assets/{prompts-DIIjyoc9.js → prompts-BFb-SeSC.js} +1 -1
  229. package/dist/client/assets/record-editor-hWJJMGCG.js +1 -0
  230. package/dist/client/assets/{redirect-editor-B4oKb1GO.js → redirect-editor-XmMaGVJV.js} +1 -1
  231. package/dist/client/assets/releases-api-AYZ93qlv.js +1 -0
  232. package/dist/client/assets/{reports-BLHz2f-u.js → reports-AyOb4hhI.js} +1 -1
  233. package/dist/client/assets/reports-BQij5juA.js +1 -0
  234. package/dist/client/assets/{reports-onboarding-8l7cEi9O.js → reports-onboarding-BDPMVaDo.js} +1 -1
  235. package/dist/client/assets/{reports-tab-0lUp3BwL.js → reports-tab-D2iADtiN.js} +2 -2
  236. package/dist/client/assets/repositories-BNDNB0vE.js +1 -0
  237. package/dist/client/assets/repositories-BiNU-Xfn.js +1 -0
  238. package/dist/client/assets/{repository-binding-Cl8gyVcv.js → repository-binding-4nTgXz1S.js} +1 -1
  239. package/dist/client/assets/{repository-import-picker-3obW4oiZ.js → repository-import-picker-De4sf2Gs.js} +1 -1
  240. package/dist/client/assets/repository-picker-HOHNvmaE.js +1 -0
  241. package/dist/client/assets/{require-capability-NNP8AGk1.js → require-capability-ChTCz2WH.js} +1 -1
  242. package/dist/client/assets/{required-auth-layout-D4sDIyJ3.js → required-auth-layout-BZllo6Io.js} +1 -1
  243. package/dist/client/assets/{reset-password-CXaP1BPU.js → reset-password-Ui3G6CJw.js} +1 -1
  244. package/dist/client/assets/{resizable-DVzR2wEK.js → resizable-DAXTAODq.js} +1 -1
  245. package/dist/client/assets/{resolve-tab-icon-BdFEwYlo.js → resolve-tab-icon-CAixh6_W.js} +1 -1
  246. package/dist/client/assets/{review-settings-CQ-ke_sY.js → review-settings-BDP4bMe5.js} +1 -1
  247. package/dist/client/assets/{roles-CSdPRDeD.js → roles-Clx4HYW_.js} +1 -1
  248. package/dist/client/assets/{route-CN2nYP-k.js → route-B9jYymiu.js} +1 -1
  249. package/dist/client/assets/route-BjK3qzB4.js +1 -0
  250. package/dist/client/assets/{route-CGCaN7RC.js → route-CaI6hSyT.js} +1 -1
  251. package/dist/client/assets/{runnable-block-editor-BCPCXDwB.js → runnable-block-editor-LQjhwiX1.js} +6 -6
  252. package/dist/client/assets/{sandbox-lifecycle-context-D9f3Vvrq.js → sandbox-lifecycle-context-CJodiAqU.js} +1 -1
  253. package/dist/client/assets/{schema-JPrgW9NA.js → schema-DrNvzI26.js} +1 -1
  254. package/dist/client/assets/{schema-DIOdOlgE.js → schema-xPkTs0YZ.js} +1 -1
  255. package/dist/client/assets/{scroll-area-BzPxgY-4.js → scroll-area-BBBDJLpH.js} +1 -1
  256. package/dist/client/assets/{search-input-CAgDD0MP.js → search-input-DSx8LWNe.js} +1 -1
  257. package/dist/client/assets/{search-toggle-DxyC7mO0.js → search-toggle-B9X5GBEJ.js} +1 -1
  258. package/dist/client/assets/{secret-ciphertext-DIyWW8ea.js → secret-ciphertext-qv17emf3.js} +1 -1
  259. package/dist/client/assets/{secret-picker-BaxV5boV.js → secret-picker-DBs-gr5P.js} +1 -1
  260. package/dist/client/assets/{secrets-DSOCKy5q.js → secrets-5nLK_pSH.js} +1 -1
  261. package/dist/client/assets/{sections-BsNG86P-.js → sections-ALAbnAYY.js} +1 -1
  262. package/dist/client/assets/{sections-editor-Ba5HL_GU.js → sections-editor-DVqxZTWF.js} +2 -2
  263. package/dist/client/assets/{select-C1PBhx94.js → select-C9_0SSgH.js} +1 -1
  264. package/dist/client/assets/{select-model-B3qCPlEj.js → select-model-BaxH4IRV.js} +1 -1
  265. package/dist/client/assets/{seo-editor-CBXv1v_K.js → seo-editor-Cd-ANp55.js} +1 -1
  266. package/dist/client/assets/{separator-DI0EmK0i.js → separator-DXuISWBW.js} +1 -1
  267. package/dist/client/assets/settings-tab-D_D1vl9t.js +1 -0
  268. package/dist/client/assets/{sheet-DaxppAym.js → sheet-BQCLSAhw.js} +1 -1
  269. package/dist/client/assets/{shell-layout-CKWLH4bq.js → shell-layout-CnXya3zZ.js} +1 -1
  270. package/dist/client/assets/site-draft-actions-BG_Fzxj9.js +12 -0
  271. package/dist/client/assets/site-draft-view-BYdCjysm.js +2 -0
  272. package/dist/client/assets/site-editor-B7kc0tIQ.js +1 -0
  273. package/dist/client/assets/{site-editor-toast-vUK6CnYX.js → site-editor-toast-BKVRfpA8.js} +1 -1
  274. package/dist/client/assets/{skills-Conq58a1.js → skills-mFhfnuy4.js} +1 -1
  275. package/dist/client/assets/{slider-B4XFe7FF.js → slider-DTKLr6aL.js} +1 -1
  276. package/dist/client/assets/{sortable.esm-Mem55hqW.js → sortable.esm-D2---7Ab.js} +1 -1
  277. package/dist/client/assets/{sso-4h0pQdIc.js → sso-DrhiuaNt.js} +1 -1
  278. package/dist/client/assets/{suggestion-DXfrHDfU.js → suggestion-B0A7rwRG.js} +1 -1
  279. package/dist/client/assets/{switch-BZ12Wlze.js → switch-CESJ2RZK.js} +1 -1
  280. package/dist/client/assets/{symbol-NtdYAab7.js → symbol-CYXY7_SE.js} +1 -1
  281. package/dist/client/assets/{synced-repos-C66vtPZX.js → synced-repos--pWS_C_z.js} +1 -1
  282. package/dist/client/assets/{tab-icon-glyph-D8h09tlE.js → tab-icon-glyph-Cjt9sANI.js} +1 -1
  283. package/dist/client/assets/{table-cd8TiUS7.js → table-BkZK8rXZ.js} +1 -1
  284. package/dist/client/assets/{tabs-PlTfpfXH.js → tabs-B6EQUSl_.js} +1 -1
  285. package/dist/client/assets/{task-assignee-avatar-CgqWAIyd.js → task-assignee-avatar-Dodx9W4w.js} +1 -1
  286. package/dist/client/assets/{task-board-DZKwU9_n.js → task-board-6nf7vbPi.js} +1 -1
  287. package/dist/client/assets/{task-route-CtG_ZySh.js → task-route-BvbHuTGP.js} +1 -1
  288. package/dist/client/assets/{task-status-DWzfRk3b.js → task-status-GUWtXwyC.js} +1 -1
  289. package/dist/client/assets/{taskboard-analytics-CdVp5AM1.js → taskboard-analytics-BXSTC1m2.js} +1 -1
  290. package/dist/client/assets/tasks-Cd3DKWnU.js +1 -0
  291. package/dist/client/assets/{tasks-DME9mnR2.js → tasks-DEvPbHif.js} +1 -1
  292. package/dist/client/assets/{textarea-CbCQygtF.js → textarea-DG3FcnmS.js} +1 -1
  293. package/dist/client/assets/{thread-analytics-D0HqEGEH.js → thread-analytics-BUqostwA.js} +1 -1
  294. package/dist/client/assets/{thread-intent-DYTU11gs.js → thread-intent-Ds79TVrW.js} +1 -1
  295. package/dist/client/assets/{thread-route-BwLT1XI-.js → thread-route-Cf5GTfDW.js} +1 -1
  296. package/dist/client/assets/{thread-route-BrF-OvAm.js → thread-route-UuA5SD5X.js} +1 -1
  297. package/dist/client/assets/{thread-sheet-body-BClkfRHz.js → thread-sheet-body-p9veuPgz.js} +1 -1
  298. package/dist/client/assets/{time-range-picker-Dc0YWA3V.js → time-range-picker-Bo0eqMw9.js} +1 -1
  299. package/dist/client/assets/{toggle-group-CG3xZyLa.js → toggle-group-C7NFln-0.js} +1 -1
  300. package/dist/client/assets/{tool-namespace-BffmviW3.js → tool-namespace-CMW8ZB5L.js} +1 -1
  301. package/dist/client/assets/{toolbar-icon-button-Dvrbx_wP.js → toolbar-icon-button-BiR5ntfC.js} +1 -1
  302. package/dist/client/assets/{tooltip-DZoMaiH-.js → tooltip-bQVm_Ope.js} +1 -1
  303. package/dist/client/assets/{tooltipContext-D6Gsaqky.js → tooltipContext-CMDZ9J9X.js} +1 -1
  304. package/dist/client/assets/{track-Cv2e7Jw0.js → track-COIlf0dl.js} +1 -1
  305. package/dist/client/assets/{types-D8wZ_EZc.js → types-DLna4BAB.js} +1 -1
  306. package/dist/client/assets/{url-slug-C8xJrS8o.js → url-slug-BWq-dgp6.js} +1 -1
  307. package/dist/client/assets/{usage-stats-B6igVHuP.js → usage-stats-CvT3PVJT.js} +1 -1
  308. package/dist/client/assets/{use-ai-providers-DgzZ7YKT.js → use-ai-providers-CzmKfSB9.js} +1 -1
  309. package/dist/client/assets/{use-apply-named-rule-BXu1w5Bp.js → use-apply-named-rule-BLEqLp1R.js} +1 -1
  310. package/dist/client/assets/{use-automations-DZTdfMuj.js → use-automations-DHA5_uZh.js} +1 -1
  311. package/dist/client/assets/{use-autosave-C5yHGYj0.js → use-autosave-BlShc4A-.js} +1 -1
  312. package/dist/client/assets/{use-chat-layout-state-fUIATILp.js → use-chat-layout-state-BV7ldzPe.js} +1 -1
  313. package/dist/client/assets/{use-clock-tick-DiijcghV.js → use-clock-tick-C61VlTs_.js} +1 -1
  314. package/dist/client/assets/{use-connect-companion-DvHSKAIT.js → use-connect-companion-DxCCqNf4.js} +1 -1
  315. package/dist/client/assets/{use-connection-BZmon5tp.js → use-connection-DTSe3r1K.js} +1 -1
  316. package/dist/client/assets/{use-content-sync-DQGv9jMR.js → use-content-sync-Dj6rb1LD.js} +1 -1
  317. package/dist/client/assets/{use-copy-Dl7HNmsM.js → use-copy-Bc8JMSws.js} +1 -1
  318. package/dist/client/assets/{use-create-virtual-mcp-Y_WqPwQW.js → use-create-virtual-mcp-Dpe8iA_9.js} +1 -1
  319. package/dist/client/assets/{use-date-fns-locale-C4tTGqdg.js → use-date-fns-locale-BGkTB4Mm.js} +1 -1
  320. package/dist/client/assets/{use-debounced-autosave-iEzw6avK.js → use-debounced-autosave-BhCHbQGN.js} +1 -1
  321. package/dist/client/assets/{use-debounced-value-DNoCsO37.js → use-debounced-value-Cm7nwcam.js} +1 -1
  322. package/dist/client/assets/{use-deco-credits-Bb3hLWha.js → use-deco-credits-BgLGkCcl.js} +1 -1
  323. package/dist/client/assets/{use-decopilot-events-Bfz-bAKi.js → use-decopilot-events-C_BQo06W.js} +1 -1
  324. package/dist/client/assets/{use-delete-connection-DHMSyjey.js → use-delete-connection-BEv8pmzy.js} +1 -1
  325. package/dist/client/assets/{use-deployment-admin-CU8I3_7G.js → use-deployment-admin-Ck9xx8zz.js} +1 -1
  326. package/dist/client/assets/use-fast-preview-draft-url-B7ECUHMP.js +1 -0
  327. package/dist/client/assets/{use-file-configs-BXF9rvXJ.js → use-file-configs-C7kUU5_U.js} +1 -1
  328. package/dist/client/assets/{use-inbox-feed-aT0WvD_J.js → use-inbox-feed-U2BOY_0m.js} +1 -1
  329. package/dist/client/assets/{use-infinite-scroll-ZRIHRcVb.js → use-infinite-scroll-CpvqXWve.js} +1 -1
  330. package/dist/client/assets/{use-join-requests-p5BU3YYl.js → use-join-requests-ldwvbhU3.js} +1 -1
  331. package/dist/client/assets/{use-main-panel-tabs-69xs0HVG.js → use-main-panel-tabs-BvDesOKd.js} +1 -1
  332. package/dist/client/assets/{use-mcp-auth-status-SoBS-b1c.js → use-mcp-auth-status-D6FLEMEz.js} +1 -1
  333. package/dist/client/assets/{use-mcp-client-DqYHf07G.js → use-mcp-client-Cby5XqT6.js} +1 -1
  334. package/dist/client/assets/{use-mcp-prompts-Cu6zSvAs.js → use-mcp-prompts-DpGHOlEI.js} +1 -1
  335. package/dist/client/assets/{use-mcp-tools-CTx7o8Po.js → use-mcp-tools-7EpnWJvB.js} +1 -1
  336. package/dist/client/assets/{use-members-7fbiQ1L2.js → use-members-oF45MDF1.js} +1 -1
  337. package/dist/client/assets/{use-mobile-Df_3y675.js → use-mobile-h4hHhZkm.js} +1 -1
  338. package/dist/client/assets/{use-move-blocks-2-4mcwFX.js → use-move-blocks-DFQHiQ1n.js} +1 -1
  339. package/dist/client/assets/{use-navigate-to-agent-DOId9IHj.js → use-navigate-to-agent-DwJfjSMG.js} +1 -1
  340. package/dist/client/assets/{use-open-billing-url-_IkiYFNL.js → use-open-billing-url-CjWCFQM1.js} +1 -1
  341. package/dist/client/assets/{use-org-auth-client-D-Dp-TzJ.js → use-org-auth-client-BFDehTsp.js} +1 -1
  342. package/dist/client/assets/{use-org-fs-CLvO6ZX7.js → use-org-fs-CyxFz8rw.js} +1 -1
  343. package/dist/client/assets/{use-org-repo-syncs-kBybWkDI.js → use-org-repo-syncs-BsUWjWH7.js} +1 -1
  344. package/dist/client/assets/{use-org-sso-DzwVU3EX.js → use-org-sso-D5M4Sxwu.js} +1 -1
  345. package/dist/client/assets/{use-organization-roles-LxJNrgl3.js → use-organization-roles-t12r77qZ.js} +1 -1
  346. package/dist/client/assets/{use-organization-settings-BXo7nhZ3.js → use-organization-settings-NOur1Lvu.js} +1 -1
  347. package/dist/client/assets/{use-panel-navigate-DGz4w4gD.js → use-panel-navigate-DxGjTjIo.js} +1 -1
  348. package/dist/client/assets/{use-project-native-view-presence-DVu_UG8f.js → use-project-native-view-presence-USh7_bNt.js} +1 -1
  349. package/dist/client/assets/{use-project-scope-B2UHdHkf.js → use-project-scope-CBw0FSEz.js} +1 -1
  350. package/dist/client/assets/{use-recent-apps-BOqc2cRg.js → use-recent-apps-B2LVD6z4.js} +1 -1
  351. package/dist/client/assets/{use-releases-Bvh7Pdaa.js → use-releases-x9nrIfuE.js} +1 -1
  352. package/dist/client/assets/{use-reports-diagnostic-Dct34RIh.js → use-reports-diagnostic-qSw4HttT.js} +1 -1
  353. package/dist/client/assets/{use-sandbox-events-DxcL_G2x.js → use-sandbox-events-D98uWMd_.js} +1 -1
  354. package/dist/client/assets/{use-secrets-Cgbmwf1E.js → use-secrets-CvBGDTuP.js} +1 -1
  355. package/dist/client/assets/{use-section-preview-base-CMHXbkVq.js → use-section-preview-base-DmjOJ885.js} +1 -1
  356. package/dist/client/assets/{use-session-runtime-7d3qKI0U.js → use-session-runtime-BrkTaSa6.js} +1 -1
  357. package/dist/client/assets/{use-sidebar-collapsed-CEbyuj9_.js → use-sidebar-collapsed-Bijbdhqq.js} +1 -1
  358. package/dist/client/assets/{use-tags-DOizZBvn.js → use-tags-BMQZw2TW.js} +1 -1
  359. package/dist/client/assets/{use-task-board-analytics-hmTm3Xr8.js → use-task-board-analytics-DdtvZ4ju.js} +1 -1
  360. package/dist/client/assets/{use-task-board-events-Sjn1d0ir.js → use-task-board-events-B5yNhg5i.js} +1 -1
  361. package/dist/client/assets/{use-task-board-item-prs-BzC_DBWs.js → use-task-board-item-prs-D9gfgNig.js} +1 -1
  362. package/dist/client/assets/{use-task-metadata-CSxCj4yy.js → use-task-metadata-DuF2rBuH.js} +1 -1
  363. package/dist/client/assets/{use-thread-analytics-DfMbrXTf.js → use-thread-analytics-B03W7aQi.js} +1 -1
  364. package/dist/client/assets/{use-thread-outputs-B3pyBOho.js → use-thread-outputs-D_k8NizM.js} +1 -1
  365. package/dist/client/assets/useInfiniteQuery-Dobhsojg.js +1 -0
  366. package/dist/client/assets/{useQueries-uLX23MNk.js → useQueries-BSehCBUp.js} +1 -1
  367. package/dist/client/assets/useSuspenseInfiniteQuery-CqyfVE9R.js +1 -0
  368. package/dist/client/assets/{users-Ib8R59dI.js → users-Cej3U7P5.js} +1 -1
  369. package/dist/client/assets/{utils-LrUUDN57.js → utils-CkwBhBMS.js} +1 -1
  370. package/dist/client/assets/{variant-calendar-DOoqqIzr.js → variant-calendar-kJB8Qi3I.js} +1 -1
  371. package/dist/client/assets/variant-draft-pointer-BeAKcq_c.js +1 -0
  372. package/dist/client/assets/variant-matcher-override-XY7K79P5.js +1 -0
  373. package/dist/client/assets/{virtual-mcp-B7o88283.js → virtual-mcp-BzmRbmfQ.js} +1 -1
  374. package/dist/client/assets/{watch-sse-pool-DIAPPzx7.js → watch-sse-pool-CmsmQLFo.js} +1 -1
  375. package/dist/client/index.html +1 -1
  376. package/dist/server/migrate.js +214 -209
  377. package/dist/server/server.js +690 -690
  378. package/package.json +1 -1
  379. package/dist/client/assets/agent-analytics-CDwx4a2N.js +0 -1
  380. package/dist/client/assets/agent-app-G-hsYMQ8.js +0 -1
  381. package/dist/client/assets/agent-calendar-DaZrWfix.js +0 -1
  382. package/dist/client/assets/agent-deck-CqPaTZAU.js +0 -1
  383. package/dist/client/assets/agent-experiments-Cvjx0r-V.js +0 -1
  384. package/dist/client/assets/agent-library-D15ABzqd.js +0 -1
  385. package/dist/client/assets/agent-library-file-B9iyqErA.js +0 -1
  386. package/dist/client/assets/agent-releases-B4Wvo_4b.js +0 -2
  387. package/dist/client/assets/agent-settings-AZLE4kyB.js +0 -1
  388. package/dist/client/assets/agent-site-editor-code-Dqh-CK3q.js +0 -2
  389. package/dist/client/assets/agent-site-editor-content-ZYGhs3a9.js +0 -1
  390. package/dist/client/assets/agent-site-editor-preview-DTKZdYCv.js +0 -1
  391. package/dist/client/assets/agent-view-D3mqLvwq.js +0 -1
  392. package/dist/client/assets/api-keys-J75u9n5h.js +0 -1
  393. package/dist/client/assets/category-editor-BdRz9cOQ.js +0 -1
  394. package/dist/client/assets/cms-settings-editor-B-g4hnK1.js +0 -1
  395. package/dist/client/assets/hosted-publish-api-CReqocob.js +0 -1
  396. package/dist/client/assets/hosted-publish-feedback-BuFauPpC.js +0 -1
  397. package/dist/client/assets/library-DJVFXK7P.js +0 -1
  398. package/dist/client/assets/monitoring-CmUEkQAu.js +0 -1
  399. package/dist/client/assets/preview-tab-DYBrEyCh.js +0 -551
  400. package/dist/client/assets/project-reports-CFxmXR8C.js +0 -1
  401. package/dist/client/assets/project-tasks-DIAs0Pxy.js +0 -1
  402. package/dist/client/assets/record-editor-C5o_Ofe0.js +0 -1
  403. package/dist/client/assets/releases-api-D9GDZds6.js +0 -1
  404. package/dist/client/assets/reports-CmJOblfH.js +0 -1
  405. package/dist/client/assets/repositories-BZY63VIV.js +0 -1
  406. package/dist/client/assets/repositories-DIzNxooQ.js +0 -1
  407. package/dist/client/assets/repository-picker-0eUSIZ5X.js +0 -1
  408. package/dist/client/assets/route-BuTkxBLT.js +0 -1
  409. package/dist/client/assets/settings-tab-D7gwu_vw.js +0 -1
  410. package/dist/client/assets/site-draft-actions-Ck0Qp0lI.js +0 -12
  411. package/dist/client/assets/site-draft-view-DwI6BUF-.js +0 -2
  412. package/dist/client/assets/site-editor-C14MF5hG.js +0 -1
  413. package/dist/client/assets/tasks-4t3a03Q3.js +0 -1
  414. package/dist/client/assets/use-fast-preview-draft-url-CBDC7qwh.js +0 -1
  415. package/dist/client/assets/useInfiniteQuery-BuR8X__X.js +0 -1
  416. package/dist/client/assets/useSuspenseInfiniteQuery-B04nA0hC.js +0 -1
  417. package/dist/client/assets/variant-draft-pointer-DNyBkOr3.js +0 -1
@@ -1,4 +1,4 @@
1
- import{c as ct,b as Lt,r as R,l as me,j as o,b2 as li,B as Et,U as ln,ag as ci,X as ui,V as di,a as Io,F as fi,K as Ko,m as mi,o as pi,h as hi,t as ae}from"./index-D_jzSCP9.js";import{u as gi}from"./chat-context-BE5W0eRy.js";import{$ as vi,H as Zn,a0 as yi,a1 as xi,a2 as bi,a3 as Si,a4 as _i,a5 as wi,a6 as Xr,a7 as ji,a8 as ki,y as kt,a9 as Le,aa as Ei,z as Gn,w as Un,d as Ri,u as Ai,ab as Zr,i as Ci,ac as Ni,k as Ti,h as Vi,ad as Fo,ae as Pi,af as Mi,t as eo,ag as Di,ah as Ii,ai as Wn,aj as to,ak as no,al as so,am as vs,an as Ki,C as Fi,ao as Bi,x as Oi,ap as ro,aq as Li,ar as oo,as as ao,at as io,M as $i,au as lo,a as zi,av as cn,aw as Hi,ax as Wi,ay as jn,az as ys}from"./runnable-block-editor-BCPCXDwB.js";import{c as qi}from"./repository-binding-Cl8gyVcv.js";import{n as Gi,t as Ui}from"./ChevronUp-BnA2Nw_G.js";import{aa as Bo,b as Qn,ap as Yi,H as Ji,a4 as co,a0 as uo}from"./agent-icon-DhApO92C.js";import{S as un}from"./scroll-area-BzPxgY-4.js";import{c as At,T as Ct,a as Nt}from"./tooltip-DZoMaiH-.js";import{am as Qi,a2 as fo,l as Xi,u as Zi,m as el,C as tl,Q as nl,A as sl,a0 as Kt,a1 as Ft,ar as mo,J as rl,at as ol}from"./site-editor-toast-vUK6CnYX.js";import{f as al,u as il,G as ll,t as xs,H as po,s as cl,m as ul,I as dl}from"./blocks-tab-states-B-gG8PUG.js";import{m as fl,u as ml,P as pl}from"./mustache-Pqeakuud.js";import{b0 as hl,b as Is,b2 as Oo,G as gl,b3 as ot,b4 as Es,b5 as Lo,al as Qt,a7 as Rs,b6 as As,am as Ot,a8 as dn,e as vl,j as yl,A as xl,q as qn,p as En,ax as bl,aj as Jt,aa as bs,ai as St,ah as kn,b7 as Sl,H as _l,an as ho,ao as go,ak as wl,b8 as jl,b9 as Bt,ba as kl,bb as El,bc as Rl,ag as vo,bd as Ss,be as Al,bf as Cl,bg as Nl,ae as Tl,aN as Vl,aP as Pl,aI as Ml,bh as Dl,bi as Il,bj as Kl,a9 as yo,bk as Fl,ad as Bl,bl as Ol}from"./parse-sections-C-MhwiHZ.js";import{a as Ll}from"./Copy01-DK6eLr2i.js";import{a as Cs,e as $o}from"./UserSquare-CRvybnC2.js";import{i as xo}from"./Tool01-CEmvRWh7.js";import{s as bo}from"./Image01-DwBREChx.js";import{s as $l}from"./Plus-CxQiW556.js";import{s as zl}from"./Trash01-7PWQCtvD.js";import{i as Ns}from"./ZoomOut-CLJKIGNa.js";import{u as Hl,a as So,K as Wl,P as ql,b as Gl,C as Ul,D as Yl,c as Jl}from"./core.esm-C9O_xZ-F.js";import{u as Ql,s as Xl,a as Yn,S as Zl,v as ec}from"./sortable.esm-Mem55hqW.js";import{s as tc,g as nc,u as sc,A as rc}from"./use-section-preview-base-CMHXbkVq.js";import{i as oc}from"./thread-intent-DYTU11gs.js";import{A as _s}from"./avatar-BCxNXTas.js";import{e as ac,d as _o,b as ic,A as lc,a as cc,f as uc}from"./alert-dialog--q-PWeut.js";import{b as dc}from"./format-time-Cq80KKvY.js";import{e as fc}from"./shell-layout-CKWLH4bq.js";import{u as mc}from"./use-members-7fbiQ1L2.js";import{a as pc,P as wo,w as hc,b as gc}from"./page-seo-form-BZ5qz5Jc.js";import{u as vc}from"./use-apply-named-rule-BXu1w5Bp.js";import{c as jo,d as ko,e as yc,f as xc,g as bc}from"./variant-draft-pointer-DNyBkOr3.js";import"./use-panel-navigate-DGz4w4gD.js";import"./thread-route-BrF-OvAm.js";import"./use-project-scope-B2UHdHkf.js";import"./autosend-CC_H9WVC.js";import"./use-mcp-client-DqYHf07G.js";import"./auth-BCqAeFp3.js";import"./use-decopilot-events-Bfz-bAKi.js";import"./watch-sse-pool-DIAPPzx7.js";import"./task-board-DZKwU9_n.js";import"./schema-JPrgW9NA.js";import"./backoff-CrEUbyZT.js";import"./use-ai-providers-DgzZ7YKT.js";import"./location-V0VwTJTt.js";import"./use-organization-settings-BXo7nhZ3.js";import"./utils-LrUUDN57.js";import"./Play-DV5Ma4c6.js";import"./sandbox-start-errors-BK_aDCyt.js";import"./pair-CbWxf18N.js";import"./LinkBroken01-CTiL1Fp-.js";import"./collapsible-CUpe_nLN.js";import"./use-copy-Dl7HNmsM.js";import"./usage-stats-B6igVHuP.js";import"./tool-namespace-BffmviW3.js";import"./form-DuWo7Npn.js";import"./label-BHfVaXR7.js";import"./utils-CVEq3hMx.js";import"./markdown-Cd88osrX.js";import"./use-mobile-Df_3y675.js";import"./use-clock-tick-DiijcghV.js";import"./content-blocks-o63cs2vh.js";import"./mcp-app-renderer-CFMsjvxz.js";import"./types-D8wZ_EZc.js";import"./omit-sandbox-map-jj4lCB2U.js";import"./AlertCircle-BzjzqqRa.js";import"./XClose-CjXzVHwC.js";import"./ShoppingBag01-hqBb4euZ.js";import"./SearchMd-CYuw_TlP.js";import"./sheet-DaxppAym.js";import"./integration-icon-BKkvrbiZ.js";import"./use-connection-BZmon5tp.js";import"./use-navigate-to-agent-DOId9IHj.js";import"./Link01-CHLntxrX.js";import"./use-mcp-prompts-Cu6zSvAs.js";import"./Monitor01-DtC0vfP6.js";import"./use-thread-outputs-B3pyBOho.js";import"./file-type-icon-6tQy_IZ-.js";import"./secret-ciphertext-DIyWW8ea.js";import"./alert-DK8EW5eY.js";import"./switch-BZ12Wlze.js";import"./textarea-CbCQygtF.js";import"./ChevronSelectorVertical-YTUkgDHg.js";import"./command-Due3aGE_.js";import"./index-B0KYQovx.js";import"./popover-BVmz1c3N.js";import"./monaco-editor-q0K0FpZQ.js";import"./editor-DfNlEhGy.js";import"./delay-CnY5UFtP.js";import"./calendar-CWZHYNsm.js";import"./SwitchHorizontal01-Ik-Wu8bp.js";import"./Minus-BCeBycMD.js";import"./select-C1PBhx94.js";import"./index-BdQq_4o_.js";import"./index-DHWYq2vY.js";import"./editor-classes-BgZFSVD_.js";import"./toggle-group-CG3xZyLa.js";import"./active-indicator-CCMhAsc_.js";import"./combobox-pGuSce6D.js";import"./Upload01-d0p8GdRf.js";import"./DotsVertical-C4UAKneF.js";import"./search-input-CAgDD0MP.js";import"./tabs-PlTfpfXH.js";import"./use-debounced-value-DNoCsO37.js";import"./use-file-configs-BXF9rvXJ.js";import"./asset-utils-DobQJkEL.js";import"./useInfiniteQuery-BuR8X__X.js";import"./infiniteQueryObserver-nO7Ij1Gh.js";import"./match-site-slug-config-D3fUJ6vX.js";import"./use-session-runtime-7d3qKI0U.js";import"./sandbox-git-api-CH_-QFpD.js";import"./sandbox-url-D3mC8qhT.js";import"./ArrowUp-BbhuuuwV.js";import"./ArrowLeft-D9e74CxD.js";import"./Building02-C2flUGF-.js";import"./CheckCircle-4gdTBGy6.js";import"./CreditCard01-CMqZSaqi.js";import"./Globe04-DEY1e_cW.js";import"./Key01-MBTcw2W0.js";import"./Sun-_7OyKm8q.js";import"./User01-CvsUVXiw.js";import"./Users01-BpDVBOEG.js";import"./experiments-tab-choice-Du4Lvv_w.js";import"./use-sandbox-events-DxcL_G2x.js";import"./slider-B4XFe7FF.js";import"./index-DjG04H6F.js";import"./tooltipContext-D6Gsaqky.js";import"./CategoricalChart-BjLODSSF.js";import"./index-DlAj9KxS.js";import"./ActiveShapeUtils-BviJ1RJ0.js";import"./Sector-7HoHBp31.js";import"./symbol-NtdYAab7.js";import"./empty-state-DHTpGmzV.js";import"./section-preview-url-7zfngvgW.js";import"./slugify-CEUa2lfQ.js";import"./differenceInSeconds-C3x8sHUj.js";import"./project-icon-BsqqQ1nI.js";import"./new-project-dialog-CP7YY3zi.js";import"./repository-import-picker-3obW4oiZ.js";import"./repository-picker-0eUSIZ5X.js";import"./collection-search-D3DfnNEj.js";import"./required-auth-layout-D4sDIyJ3.js";import"./use-org-sso-DzwVU3EX.js";import"./use-org-auth-client-D-Dp-TzJ.js";import"./use-move-blocks-2-4mcwFX.js";const Sc={escape:vi};function _c(n,e){for(const r of tc(n,e)){const a=typeof r.title=="string"?r.title:void 0;if(a?.includes("{{"))return a}}function wc(n,e){if(!e)return;const r=hl(n,oc(e));if(r)try{const a=_c(r.resolveType,e);return a&&fl.render(a,r.data,{},Sc).trim()||void 0}catch{return}}function jc(n){const e=ct.c(13),{icon:r,label:a,className:l}=n;let u;e[0]!==l?(u=me("size-3.5",l),e[0]=l,e[1]=u):u=e[1];let y;e[2]!==r||e[3]!==u?(y=o.jsx(r,{className:u}),e[2]=r,e[3]=u,e[4]=y):y=e[4];let m;e[5]!==a||e[6]!==y?(m=o.jsx(Ct,{asChild:!0,children:o.jsx("span",{role:"img","aria-label":a,className:"shrink-0 cursor-help",children:y})}),e[5]=a,e[6]=y,e[7]=m):m=e[7];let b;e[8]!==a?(b=o.jsx(Nt,{className:"max-w-56",children:a}),e[8]=a,e[9]=b):b=e[9];let h;return e[10]!==m||e[11]!==b?(h=o.jsxs(At,{children:[m,b]}),e[10]=m,e[11]=b,e[12]=h):h=e[12],h}const kc="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 Eo(n){return Array.from({length:n},(e,r)=>({id:crypto.randomUUID(),index:r}))}function zo(n){return n.map((e,r)=>({...e,index:r}))}function Ec(n,e){if(e===n.length)return n;if(e<n.length)return zo(n.slice(0,e));const r=Array.from({length:e-n.length},(a,l)=>({id:crypto.randomUUID(),index:n.length+l}));return[...n,...r]}function Ho(n){const e=ct.c(44),{section:r,raw:a,meta:l,decofile:u}=n,y=Lt(),m=Zn(),b=r.isSavedBlock===!0,h=r.isMultivariate===!0;let k;e[0]!==l||e[1]!==a?(k=a&&l?nc(a,l):void 0,e[0]=l,e[1]=a,e[2]=k):k=e[2];const N=k;let L;e[3]!==l||e[4]!==h||e[5]!==a||e[6]!==b?(L=a&&l&&!b&&!h?wc(a,l):void 0,e[3]=l,e[4]=h,e[5]=a,e[6]=b,e[7]=L):L=e[7];const z=L;let H;e[8]!==u||e[9]!==l||e[10]!==a||e[11]!==r?(H=wi(a,r,u,l),e[8]=u,e[9]=l,e[10]=a,e[11]=r,e[12]=H):H=e[12];const B=H;let w;e[13]!==h||e[14]!==a?.__resolveType?(w=!h&&Is(a?.__resolveType??""),e[13]=h,e[14]=a?.__resolveType,e[15]=w):w=e[15];const p=w,te=b?Qn:h?Bo:$o;let E;e[16]!==h||e[17]!==b?(E=b?{color:gl}:h?{color:"oklch(0.65 0.15 160)"}:void 0,e[16]=h,e[17]=b,e[18]=E):E=e[18];const W=E;let V;e[19]!==te||e[20]!==m?(V=m?o.jsxs("span",{className:"relative size-4 shrink-0",children:[o.jsx(te,{className:"absolute inset-0 size-4 text-muted-foreground transition-opacity group-hover:opacity-0 group-has-[:focus-visible]:opacity-0"}),o.jsx(ki,{"aria-hidden":!0,className:"absolute inset-0 size-4 opacity-0 transition-opacity group-hover:opacity-100 group-has-[:focus-visible]:opacity-100"})]}):o.jsx(Yi,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[19]=te,e[20]=m,e[21]=V):V=e[21];let J;e[22]!==N?(J=N&&o.jsx("img",{src:N,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded-[var(--studio-control-radius,var(--radius))] object-cover"}),e[22]=N,e[23]=J):J=e[23];let g;e[24]!==m||e[25]!==W?(g=!m&&o.jsx(Cs,{className:"h-4 w-4 shrink-0",style:W}),e[24]=m,e[25]=W,e[26]=g):g=e[26];const Q=m?"shrink":"flex-1",x=r.isHidden&&"line-through opacity-50";let Z;e[27]!==x||e[28]!==Q?(Z=me("min-w-0 truncate text-sm font-medium",Q,x),e[27]=x,e[28]=Q,e[29]=Z):Z=e[29];const q=z??r.label;let pe;e[30]!==Z||e[31]!==q?(pe=o.jsx("span",{className:Z,children:q}),e[30]=Z,e[31]=q,e[32]=pe):pe=e[32];let ye;e[33]!==p||e[34]!==m||e[35]!==B||e[36]!==y?(ye=m?o.jsxs(o.Fragment,{children:[p&&o.jsx(jc,{icon:Ns,label:y("sectionsEditor.sectionList.asyncBadge"),className:"text-muted-foreground"}),B&&o.jsx(Xr,{}),o.jsx("span",{className:"min-w-0 flex-1"})]}):B&&o.jsx(Xr,{className:"absolute -right-0.5 -top-0.5"}),e[33]=p,e[34]=m,e[35]=B,e[36]=y,e[37]=ye):ye=e[37];let ue;return e[38]!==pe||e[39]!==ye||e[40]!==V||e[41]!==J||e[42]!==g?(ue=o.jsxs(o.Fragment,{children:[V,J,g,pe,ye]}),e[38]=pe,e[39]=ye,e[40]=V,e[41]=J,e[42]=g,e[43]=ue):ue=e[43],ue}const Rc="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",Ac="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 Wo(n,e,r){if(r)return ji({selected:e});const a=n.isSavedBlock===!0,l=n.isMultivariate===!0;return me("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":a?Rc:l?Ac:"text-foreground/80 hover:bg-accent hover:text-accent-foreground")}function ws(n,e){return me("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 Cc(n){const e=ct.c(90),{section:r,raw:a,meta:l,decofile:u,sortableId:y,selected:m,onSelect:b,onDelete:h,onDuplicate:k,onMakeReusable:N,onToggleHidden:L,onToggleLazy:z,onAddVariant:H,onDetach:B}=n,w=Lt(),p=Zn(),te=a?Is(a.__resolveType??""):!1,E=r.isHidden===!0,W=te||E;let V;e[0]!==r?(V=Oo(r),e[0]=r,e[1]=V):V=e[1];const J=V,g=!!z&&!r.isMultivariate;let Q;e[2]!==y?(Q={id:y,animateLayoutChanges:Vc},e[2]=y,e[3]=Q):Q=e[3];const{attributes:x,listeners:Z,setNodeRef:q,transform:pe,isDragging:ye}=Ql(Q);let ue;e[4]!==pe?(ue=Ul.Transform.toString(pe?{...pe,x:0}:null),e[4]=pe,e[5]=ue):ue=e[5];const fe=ye?0:void 0;let Re;e[6]!==ue||e[7]!==fe?(Re={transform:ue,opacity:fe},e[6]=ue,e[7]=fe,e[8]=Re):Re=e[8];const j=Re;let re;e[9]!==r?(re=xi(r),e[9]=r,e[10]=re):re=e[10];const Ae=re,Ce="button",S=0;let I;e[11]!==b?(I=K=>{(K.key==="Enter"||K.key===" ")&&(K.preventDefault(),b())},e[11]=b,e[12]=I):I=e[12];const he=ye?"cursor-grabbing":"cursor-pointer";let M;e[13]!==p||e[14]!==r||e[15]!==m||e[16]!==he?(M=me("touch-none transition-colors",he,Wo(r,m,p)),e[13]=p,e[14]=r,e[15]=m,e[16]=he,e[17]=M):M=e[17];let xe;e[18]!==u||e[19]!==l||e[20]!==a||e[21]!==r?(xe=o.jsx(Ho,{section:r,raw:a,meta:l,decofile:u}),e[18]=u,e[19]=l,e[20]=a,e[21]=r,e[22]=xe):xe=e[22];const O=!p&&g&&o.jsxs(At,{children:[o.jsx(Ct,{asChild:!0,children:o.jsx(Et,{type:"button",variant:"ghost",size:"icon","aria-label":w(te?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender"),className:me(ws(W,te)),onClick:K=>{K.stopPropagation(),z?.()},onPointerDown:Tc,children:o.jsx(Ns,{className:me("h-3.5 w-3.5",te&&"text-warning")})})}),o.jsx(Nt,{side:"bottom",children:w(te?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")})]}),oe=p?o.jsx(bi,{label:w(E?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),active:E,onToggle:L,children:E?o.jsx(xo,{className:"h-3.5 w-3.5"}):o.jsx(bo,{className:"h-3.5 w-3.5"})}):o.jsxs(At,{children:[o.jsx(Ct,{asChild:!0,children:o.jsx(Et,{type:"button",variant:"ghost",size:"icon","aria-label":w(E?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),className:me(ws(W,E)),onClick:K=>{K.stopPropagation(),L()},onPointerDown:Nc,children:E?o.jsx(xo,{className:"h-3.5 w-3.5"}):o.jsx(bo,{className:"h-3.5 w-3.5"})})}),o.jsx(Nt,{side:"bottom",children:w(E?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection")})]}),G=ui,Ie=Si;let ke;e[23]!==w?(ke=w("sectionsEditor.sectionList.sectionActionsMenu"),e[23]=w,e[24]=ke):ke=e[24];const ut=me(ws(W,!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 Ze;e[25]!==Ie||e[26]!==ke||e[27]!==ut?(Ze=o.jsx(Ie,{label:ke,classicClassName:ut}),e[25]=Ie,e[26]=ke,e[27]=ut,e[28]=Ze):Ze=e[28];let $e;e[29]!==p||e[30]!==g||e[31]!==te||e[32]!==z||e[33]!==w?($e=p&&g&&o.jsxs(o.Fragment,{children:[o.jsxs(ln,{onClick:K=>{K.stopPropagation(),z?.()},children:[o.jsx(Ns,{className:"h-4 w-4"}),w(te?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")]}),o.jsx(ci,{})]}),e[29]=p,e[30]=g,e[31]=te,e[32]=z,e[33]=w,e[34]=$e):$e=e[34];let qe;e[35]!==k?(qe=K=>{K.stopPropagation(),k()},e[35]=k,e[36]=qe):qe=e[36];let at;e[37]===Symbol.for("react.memo_cache_sentinel")?(at=o.jsx(Ll,{className:"h-4 w-4"}),e[37]=at):at=e[37];let Ge;e[38]!==w?(Ge=w("sectionsEditor.sectionList.duplicateMenuItem"),e[38]=w,e[39]=Ge):Ge=e[39];let Ue;e[40]!==qe||e[41]!==Ge?(Ue=o.jsxs(ln,{onClick:qe,children:[at,Ge]}),e[40]=qe,e[41]=Ge,e[42]=Ue):Ue=e[42];let Ye;e[43]!==p||e[44]!==J||e[45]!==H||e[46]!==w?(Ye=J&&o.jsxs(ln,{className:me(!p&&_i),onClick:K=>{K.stopPropagation(),H()},children:[o.jsx(Bo,{className:"h-4 w-4"}),w("sectionsEditor.sectionList.addVariantMenuItem")]}),e[43]=p,e[44]=J,e[45]=H,e[46]=w,e[47]=Ye):Ye=e[47];let de;e[48]!==p||e[49]!==Ae||e[50]!==N||e[51]!==w?(de=Ae&&o.jsxs(ln,{className:me(!p&&kc),onClick:K=>{K.stopPropagation(),N()},children:[p?o.jsx(Qn,{className:"h-4 w-4"}):o.jsx(Cs,{className:"h-4 w-4"}),w("sectionsEditor.sectionList.makeReusableMenuItem")]}),e[48]=p,e[49]=Ae,e[50]=N,e[51]=w,e[52]=de):de=e[52];let ge;e[53]!==p||e[54]!==B||e[55]!==r.isMultivariate||e[56]!==r.isSavedBlock||e[57]!==w?(ge=r.isSavedBlock===!0&&!r.isMultivariate&&o.jsxs(ln,{onClick:K=>{K.stopPropagation(),B()},children:[p?o.jsx($o,{className:"h-4 w-4"}):o.jsx(Cs,{className:"h-4 w-4"}),w("sectionsEditor.sectionList.detachMenuItem")]}),e[53]=p,e[54]=B,e[55]=r.isMultivariate,e[56]=r.isSavedBlock,e[57]=w,e[58]=ge):ge=e[58];let be;e[59]!==h?(be=K=>{K.stopPropagation(),h()},e[59]=h,e[60]=be):be=e[60];let ee;e[61]===Symbol.for("react.memo_cache_sentinel")?(ee=o.jsx(zl,{className:"h-4 w-4"}),e[61]=ee):ee=e[61];let F;e[62]!==w?(F=w("sectionsEditor.sectionList.deleteMenuItem"),e[62]=w,e[63]=F):F=e[63];let De;e[64]!==be||e[65]!==F?(De=o.jsxs(ln,{variant:"destructive",onClick:be,children:[ee,F]}),e[64]=be,e[65]=F,e[66]=De):De=e[66];let et;e[67]!==$e||e[68]!==Ue||e[69]!==Ye||e[70]!==de||e[71]!==ge||e[72]!==De?(et=o.jsxs(di,{align:"end",className:"w-44",children:[$e,Ue,Ye,de,ge,De]}),e[67]=$e,e[68]=Ue,e[69]=Ye,e[70]=de,e[71]=ge,e[72]=De,e[73]=et):et=e[73];let tt;e[74]!==G||e[75]!==Ze||e[76]!==et?(tt=o.jsxs(G,{children:[Ze,et]}),e[74]=G,e[75]=Ze,e[76]=et,e[77]=tt):tt=e[77];let st;return e[78]!==x||e[79]!==Z||e[80]!==b||e[81]!==q||e[82]!==j||e[83]!==M||e[84]!==xe||e[85]!==O||e[86]!==oe||e[87]!==tt||e[88]!==I?(st=o.jsxs("div",{ref:q,style:j,...x,...Z,role:Ce,tabIndex:S,onClick:b,onKeyDown:I,className:M,children:[xe,O,oe,tt]}),e[78]=x,e[79]=Z,e[80]=b,e[81]=q,e[82]=j,e[83]=M,e[84]=xe,e[85]=O,e[86]=oe,e[87]=tt,e[88]=I,e[89]=st):st=e[89],st}function Nc(n){return n.stopPropagation()}function Tc(n){return n.stopPropagation()}function Vc(){return!1}function Ts(n){const e=ct.c(11),{canAddSection:r,onAddSection:a,className:l,size:u}=n,y=Lt();let m;e[0]!==l?(m=me("w-full",l),e[0]=l,e[1]=m):m=e[1];const b=!r;let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx($l,{size:14}),e[2]=h):h=e[2];let k;e[3]!==y?(k=y("sectionsEditor.sectionList.addSectionButton"),e[3]=y,e[4]=k):k=e[4];let N;return e[5]!==a||e[6]!==u||e[7]!==m||e[8]!==b||e[9]!==k?(N=o.jsxs(Et,{type:"button",variant:"outline",size:u,className:m,disabled:b,onClick:a,children:[h,k]}),e[5]=a,e[6]=u,e[7]=m,e[8]=b,e[9]=k,e[10]=N):N=e[10],N}function Pc(n){const e=ct.c(101),{listKey:r,rawSections:a,sections:l,meta:u,decofile:y,selectedIndex:m,onSelect:b,onReorder:h,onDelete:k,onDuplicate:N,onMakeReusable:L,onToggleHidden:z,onToggleLazy:H,onAddVariant:B,onDetach:w,onAddSection:p,canAddSection:te}=n,E=te===void 0?!0:te,W=Lt(),V=Zn();let J;e[0]!==l.length?(J=()=>Eo(l.length),e[0]=l.length,e[1]=J):J=e[1];const[g,Q]=R.useState(J),[x,Z]=R.useState(null),[q,pe]=R.useState(r),[ye,ue]=R.useState(l.length),fe=R.useRef(!1);q!==r?(pe(r),ue(l.length),Q(Eo(l.length))):ye!==l.length&&(ue(l.length),Q(Je=>Ec(Je,l.length)));let Re;e[2]===Symbol.for("react.memo_cache_sentinel")?(Re={activationConstraint:{distance:8}},e[2]=Re):Re=e[2];let j;e[3]===Symbol.for("react.memo_cache_sentinel")?(j={coordinateGetter:Xl},e[3]=j):j=e[3];const re=Hl(So(ql,Re),So(Wl,j));let Ae;e[4]!==g?(Ae=g.map(Mc),e[4]=g,e[5]=Ae):Ae=e[5];const Ce=Ae;let S;e[6]===Symbol.for("react.memo_cache_sentinel")?(S=Je=>{Z(String(Je.active.id))},e[6]=S):S=e[6];const I=S;let he;e[7]!==Ce||e[8]!==h?(he=Je=>{Z(null);const{active:ie,over:Ne}=Je;if(!Ne||ie.id===Ne.id)return;const ze=Ce.indexOf(String(ie.id)),rt=Ce.indexOf(String(Ne.id));ze===-1||rt===-1||(Q(it=>zo(Yn([...it],ze,rt))),fe.current=!0,requestAnimationFrame(()=>{fe.current=!1}),h?.(ze,rt))},e[7]=Ce,e[8]=h,e[9]=he):he=e[9];const M=he;let xe;e[10]===Symbol.for("react.memo_cache_sentinel")?(xe=()=>{Z(null)},e[10]=xe):xe=e[10];const O=xe;let oe,G,Ie,ke,ut,Ze,$e,qe,at,Ge,Ue,Ye,de,ge,be;if(e[11]!==x||e[12]!==E||e[13]!==V||e[14]!==y||e[15]!==g||e[16]!==Ce||e[17]!==M||e[18]!==u||e[19]!==p||e[20]!==B||e[21]!==k||e[22]!==w||e[23]!==N||e[24]!==L||e[25]!==b||e[26]!==z||e[27]!==H||e[28]!==a||e[29]!==l||e[30]!==m||e[31]!==re||e[32]!==W){ge=Symbol.for("react.early_return_sentinel");e:{const Je=ie=>{fe.current||b(ie)};if(e[48]!==x||e[49]!==E||e[50]!==V||e[51]!==g||e[52]!==p||e[53]!==a||e[54]!==l||e[55]!==W){const ie=x?g.find(Ne=>Ne.id===x):null;if(ke=ie!=null?l[ie.index]:null,Ie=ie!=null?a[ie.index]:void 0,g.length===0){let Ne;e[59]!==W?(Ne=W("sectionsEditor.sectionList.noSections"),e[59]=W,e[60]=Ne):Ne=e[60];let ze;e[61]!==Ne?(ze=o.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:Ne}),e[61]=Ne,e[62]=ze):ze=e[62];const rt=ze;let it;e[63]!==E||e[64]!==V||e[65]!==rt||e[66]!==p?(it=V?rt:o.jsxs("div",{className:"space-y-2",children:[rt,o.jsx(Ts,{canAddSection:E,onAddSection:p,size:"sm"})]}),e[63]=E,e[64]=V,e[65]=rt,e[66]=p,e[67]=it):it=e[67],ge=it;break e}de=me(ie&&"cursor-grabbing"),e[48]=x,e[49]=E,e[50]=V,e[51]=g,e[52]=p,e[53]=a,e[54]=l,e[55]=W,e[56]=Ie,e[57]=ke,e[58]=de}else Ie=e[56],ke=e[57],de=e[58];G=Yl,qe=re,at=Jl,Ge=I,Ue=M,Ye=O,oe=Zl,Ze=Ce,$e=ec,be="space-y-1",ut=g.map(ie=>{const Ne=l[ie.index];return Ne?o.jsx(Cc,{sortableId:ie.id,section:Ne,raw:a[ie.index],meta:u,decofile:y,selected:m===ie.index,onSelect:()=>Je(ie.index),onDelete:()=>k(ie.index),onDuplicate:()=>N(ie.index),onMakeReusable:()=>L(ie.index),onToggleHidden:()=>z(ie.index),onToggleLazy:H?()=>H(ie.index):void 0,onAddVariant:()=>B(ie.index),onDetach:()=>w(ie.index)},ie.id):null})}e[11]=x,e[12]=E,e[13]=V,e[14]=y,e[15]=g,e[16]=Ce,e[17]=M,e[18]=u,e[19]=p,e[20]=B,e[21]=k,e[22]=w,e[23]=N,e[24]=L,e[25]=b,e[26]=z,e[27]=H,e[28]=a,e[29]=l,e[30]=m,e[31]=re,e[32]=W,e[33]=oe,e[34]=G,e[35]=Ie,e[36]=ke,e[37]=ut,e[38]=Ze,e[39]=$e,e[40]=qe,e[41]=at,e[42]=Ge,e[43]=Ue,e[44]=Ye,e[45]=de,e[46]=ge,e[47]=be}else oe=e[33],G=e[34],Ie=e[35],ke=e[36],ut=e[37],Ze=e[38],$e=e[39],qe=e[40],at=e[41],Ge=e[42],Ue=e[43],Ye=e[44],de=e[45],ge=e[46],be=e[47];if(ge!==Symbol.for("react.early_return_sentinel"))return ge;let ee;e[68]!==ut||e[69]!==be?(ee=o.jsx("div",{className:be,children:ut}),e[68]=ut,e[69]=be,e[70]=ee):ee=e[70];let F;e[71]!==oe||e[72]!==Ze||e[73]!==$e||e[74]!==ee?(F=o.jsx(oe,{items:Ze,strategy:$e,children:ee}),e[71]=oe,e[72]=Ze,e[73]=$e,e[74]=ee,e[75]=F):F=e[75];let De;e[76]!==Ie||e[77]!==ke||e[78]!==V||e[79]!==y||e[80]!==u?(De=ke?o.jsx("div",{className:me("cursor-grabbing shadow-lift",Wo(ke,!1,V)),children:o.jsx(Ho,{section:ke,raw:Ie,meta:u,decofile:y})}):null,e[76]=Ie,e[77]=ke,e[78]=V,e[79]=y,e[80]=u,e[81]=De):De=e[81];let et;e[82]!==De?(et=li.createPortal(o.jsx(Gl,{dropAnimation:yi,children:De}),document.body),e[82]=De,e[83]=et):et=e[83];let tt;e[84]!==G||e[85]!==qe||e[86]!==at||e[87]!==Ge||e[88]!==Ue||e[89]!==Ye||e[90]!==F||e[91]!==et?(tt=o.jsxs(G,{sensors:qe,collisionDetection:at,onDragStart:Ge,onDragEnd:Ue,onDragCancel:Ye,children:[F,et]}),e[84]=G,e[85]=qe,e[86]=at,e[87]=Ge,e[88]=Ue,e[89]=Ye,e[90]=F,e[91]=et,e[92]=tt):tt=e[92];let st;e[93]!==E||e[94]!==V||e[95]!==p?(st=!V&&o.jsx(Ts,{canAddSection:E,onAddSection:p,size:"sm",className:"mt-2"}),e[93]=E,e[94]=V,e[95]=p,e[96]=st):st=e[96];let K;return e[97]!==de||e[98]!==tt||e[99]!==st?(K=o.jsxs("div",{className:de,children:[tt,st]}),e[97]=de,e[98]=tt,e[99]=st,e[100]=K):K=e[100],K}function Mc(n){return n.id}function js(n,e,r,a,l){if(!n||!e)return null;if(!e.isMultivariate)return kt(n,e,a,l)?.data??null;const u=ot(n,e),y=u?Es(u,al)[r]:void 0;return y?Lo(y.value,a)?.data??null:null}const Dc=50;function Ic(n,e){n.own.push(Le(e)),n.own.length>Dc&&n.own.shift()}function Ro(n,e){return n.own.includes(Le(e))}function Kc(n,e){const{sectionIndex:r,variantIndex:a,shown:l,next:u,sectionCount:y}=e;return n&&n.sectionIndex===r&&n.variantIndex===a&&n.emitted===l?(n.emitted=u,n):l?{sectionIndex:r,variantIndex:a,base:l,emitted:u,sectionCount:y,own:[Le(l)]}:null}function qo(n,e){return e!==null&&Le(n)!==Le(e)}function Go(n,e){return n.__resolveType!==e.__resolveType}function Fc(n,e,r,a){if(e.length===a)return"here";const l=Le(n),u=e.flatMap((y,m)=>m!==r&&y!==null&&Le(y)===l?[m]:[]);return u.length===1?u[0]:"unknown"}function Ao({formBase:n,rebased:e,versionOf:r}){let a=null;return{ifMatch:l=>{a=l,n&&(n.version===void 0||e)&&(n.version=r(l));const u=n?n.version:r(l);return u===void 0?void 0:{[l]:u}},onApplied:l=>{n&&a!==null&&Object.hasOwn(l,a)&&(n.version=l[a])},reloadOnConflict:!0}}function Bc({merged:n,tracked:e,current:r,saved:a}){return!!n&&!!e&&r===e&&e.emitted===a}function Co(n,e){return!!n&&!!e&&n.contains(e)}function Vs(n){const e=[],r=Ps("",n.ancestor,n.mine,n.theirs,e);return{...n,merged:r,pointers:e}}function Ps(n,e,r,a,l){const u=(y,m)=>Le(y)===Le(m);if(u(r,a)||u(e,a))return r;if(u(e,r))return a;if(ks(r)&&ks(a)){const y=ks(e)?e:{},m={},b=[...Object.keys(r),...Object.keys(a).filter(h=>!(h in r))];for(const h of b){const k=Ps(`${n}/${h.replaceAll("~","~0").replaceAll("/","~1")}`,y[h],r[h],a[h],l);k!==void 0&&(m[h]=k)}return m}return Array.isArray(e)&&Array.isArray(r)&&Array.isArray(a)&&r.length===e.length&&a.length===e.length?e.map((y,m)=>Ps(`${n}/${m}`,y,r[m],a[m],l)):(l.push(n),a)}function ks(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}function Oc(n,e){let r=n.merged;for(const a of n.pointers)e[a]==="mine"&&(r=Hc(r,a,Xt(n.mine,a)));return r}function Lc(n,e){return Object.fromEntries(n.pointers.map(r=>[r,e]))}function Uo(n){return Lc(n,"mine")}function Ms(n,e,r){const a=Uo(r);for(const l of r.pointers){const u=e[l];if(!u||!n.pointers.includes(l))continue;["mine","theirs"].every(m=>Le(Xt(n[m],l))===Le(Xt(r[m],l)))&&(a[l]=u)}return a}function Yo(n,e,r={}){const a=e.pointers.filter(l=>!n.pointers.includes(l)||Le(Xt(n.theirs,l))!==Le(Xt(e.theirs,l)));return a.length===0?r:{...r,...Object.fromEntries(a.map(l=>[l,(r[l]??0)+1]))}}function $c(n,e,r){if(!e||Go(n.plan.ancestor,e)||!qo(n.plan.theirs,e)||r(e))return null;const a=Vs({...n.plan,theirs:e});return a.pointers.length===0?null:{plan:a,choices:Ms(n.plan,n.choices,a),fresh:Yo(n.plan,a,n.fresh)}}function zc(n,e){return n.pointers.map(r=>({pointer:r,label:Ei(r,e),mine:Xt(n.mine,r),theirs:Xt(n.theirs,r),schema:Wc(e??null,r)}))}function Ks(n){return n.split("/").slice(1).map(e=>e.replaceAll("~1","/").replaceAll("~0","~"))}function Xt(n,e){let r=n;for(const a of Ks(e))if(Array.isArray(r))r=r[Number(a)];else if(r&&typeof r=="object")r=r[a];else return;return r}function Hc(n,e,r){const a=Ks(e),l=(u,y)=>{if(y===a.length)return r;const m=a[y];if(Array.isArray(u)){const k=[...u];return k[Number(m)]=l(u[Number(m)],y+1),k}const b=u&&typeof u=="object"?{...u}:{},h=l(b[m],y+1);return h===void 0?delete b[m]:b[m]=h,b};return l(n,0)}function Wc(n,e){let r=n;for(const a of Ks(e)){if(!r)return null;r=/^\d+$/.test(a)&&!r.properties?.[a]?r.items:r.properties?.[a]}return r??null}const qc=/\.(png|jpe?g|gif|webp|avif|svg)(\?.*)?$/i,No=60,Gc=3;function Jo(n,e){return e?.format==="image-uri"?!0:n.startsWith("data:image/")||/^(https?:)?\/\//.test(n)&&qc.test(n)}function Ds(n,e){if(!(e?.format==="rich-text"||e?.format==="rich-text-inline"||e?.format==="html"||/<\/?[a-z][^>]*>/i.test(n)))return n;const a=n.replace(/<br\s*\/?>/gi,`
1
+ import{c as ct,b as Lt,r as R,l as me,j as o,b2 as li,B as Et,U as ln,ag as ci,X as ui,V as di,a as Ko,F as fi,K as Io,m as mi,o as pi,h as hi,t as ae}from"./index-D2MFYEzD.js";import{u as gi}from"./chat-context-DLezfYEa.js";import{$ as vi,H as Zn,a0 as yi,a1 as xi,a2 as bi,a3 as Si,a4 as _i,a5 as wi,a6 as Xr,a7 as ji,a8 as ki,y as kt,a9 as Le,aa as Ei,z as Gn,w as Un,d as Ri,u as Ai,ab as Zr,i as Ci,ac as Ni,k as Ti,h as Vi,ad as Fo,ae as Pi,af as Mi,t as eo,ag as Di,ah as Ki,ai as Wn,aj as to,ak as no,al as so,am as vs,an as Ii,C as Fi,ao as Bi,x as Oi,ap as ro,aq as Li,ar as oo,as as ao,at as io,M as $i,au as lo,a as zi,av as cn,aw as Hi,ax as Wi,ay as jn,az as ys}from"./runnable-block-editor-LQjhwiX1.js";import{c as qi}from"./repository-binding-4nTgXz1S.js";import{n as Gi,t as Ui}from"./ChevronUp-DiTVmUiH.js";import{aa as Bo,b as Qn,ap as Yi,H as Ji,a4 as co,a0 as uo}from"./agent-icon-g2PIrjzs.js";import{S as un}from"./scroll-area-BBBDJLpH.js";import{c as At,T as Ct,a as Nt}from"./tooltip-bQVm_Ope.js";import{an as Qi,a3 as fo,l as Xi,u as Zi,m as el,D as tl,R as nl,B as sl,a1 as It,a2 as Ft,as as mo,K as rl,au as ol}from"./site-editor-toast-BKVRfpA8.js";import{f as al,u as il,G as ll,t as xs,H as po,s as cl,m as ul,I as dl}from"./blocks-tab-states-Dps89GrH.js";import{m as fl,u as ml,P as pl}from"./mustache-Cm6mC1mo.js";import{b0 as hl,b as Ks,b2 as Oo,G as gl,b3 as ot,b4 as Es,b5 as Lo,al as Qt,a7 as Rs,b6 as As,am as Ot,a8 as dn,e as vl,j as yl,A as xl,q as qn,p as En,ax as bl,aj as Jt,aa as bs,ai as St,ah as kn,b7 as Sl,H as _l,an as ho,ao as go,ak as wl,b8 as jl,b9 as Bt,ba as kl,bb as El,bc as Rl,ag as vo,bd as Ss,be as Al,bf as Cl,bg as Nl,ae as Tl,aN as Vl,aP as Pl,aI as Ml,bh as Dl,bi as Kl,bj as Il,a9 as yo,bk as Fl,ad as Bl,bl as Ol}from"./parse-sections-Bc_lvOtq.js";import{a as Ll}from"./Copy01-DRNuKy-h.js";import{a as Cs,e as $o}from"./UserSquare-B_yRFcN6.js";import{i as xo}from"./Tool01-rTZNmFct.js";import{s as bo}from"./Image01-QuVxFosz.js";import{s as $l}from"./Plus-BnqPSlPj.js";import{s as zl}from"./Trash01-TPK4gSsp.js";import{i as Ns}from"./ZoomOut-DLICjI1h.js";import{u as Hl,a as So,K as Wl,P as ql,b as Gl,C as Ul,D as Yl,c as Jl}from"./core.esm-DHAYYfZu.js";import{u as Ql,s as Xl,a as Yn,S as Zl,v as ec}from"./sortable.esm-D2---7Ab.js";import{s as tc,g as nc,u as sc,A as rc}from"./use-section-preview-base-DmjOJ885.js";import{i as oc}from"./thread-intent-Ds79TVrW.js";import{A as _s}from"./avatar-BRRGslVN.js";import{e as ac,d as _o,b as ic,A as lc,a as cc,f as uc}from"./alert-dialog-KKnJELoX.js";import{b as dc}from"./format-time-Cq80KKvY.js";import{e as fc}from"./shell-layout-CnXya3zZ.js";import{u as mc}from"./use-members-oF45MDF1.js";import{a as pc,P as wo,w as hc,b as gc}from"./page-seo-form-BTZBPUqn.js";import{u as vc}from"./use-apply-named-rule-BLEqLp1R.js";import{b as jo,a as yc}from"./variant-matcher-override-XY7K79P5.js";import{c as ko,d as xc,e as bc}from"./variant-draft-pointer-BeAKcq_c.js";import"./use-panel-navigate-DxGjTjIo.js";import"./thread-route-UuA5SD5X.js";import"./use-project-scope-CBw0FSEz.js";import"./autosend-Cwww7_9j.js";import"./use-mcp-client-Cby5XqT6.js";import"./auth-DHZfBLZ5.js";import"./use-decopilot-events-C_BQo06W.js";import"./watch-sse-pool-CmsmQLFo.js";import"./task-board-6nf7vbPi.js";import"./schema-DrNvzI26.js";import"./backoff-CrEUbyZT.js";import"./use-ai-providers-CzmKfSB9.js";import"./location-V0VwTJTt.js";import"./use-organization-settings-NOur1Lvu.js";import"./utils-CkwBhBMS.js";import"./Play-BgEaB30r.js";import"./sandbox-start-errors-BK_aDCyt.js";import"./pair-DSps2zoM.js";import"./LinkBroken01-DDgMbBWJ.js";import"./collapsible-DZTt-UAc.js";import"./use-copy-Bc8JMSws.js";import"./usage-stats-CvT3PVJT.js";import"./tool-namespace-CMW8ZB5L.js";import"./form-B2fhil9l.js";import"./label-3hTmrxoy.js";import"./utils-CVEq3hMx.js";import"./markdown-BeKN4MPt.js";import"./use-mobile-h4hHhZkm.js";import"./use-clock-tick-C61VlTs_.js";import"./content-blocks-o63cs2vh.js";import"./mcp-app-renderer-DcbWj_cd.js";import"./types-DLna4BAB.js";import"./omit-sandbox-map-jj4lCB2U.js";import"./AlertCircle-DgnxHqxe.js";import"./XClose-DOXmYMF_.js";import"./ShoppingBag01-DVHnZchK.js";import"./SearchMd-GQAKwnQD.js";import"./sheet-BQCLSAhw.js";import"./integration-icon-CqbOWyvX.js";import"./use-connection-DTSe3r1K.js";import"./use-navigate-to-agent-DwJfjSMG.js";import"./Link01-CbpFxbNY.js";import"./use-mcp-prompts-DpGHOlEI.js";import"./Monitor01-DD5_JCl8.js";import"./use-thread-outputs-D_k8NizM.js";import"./file-type-icon-CP6Bm0Pm.js";import"./secret-ciphertext-qv17emf3.js";import"./alert-kpgdNVxk.js";import"./switch-CESJ2RZK.js";import"./textarea-DG3FcnmS.js";import"./ChevronSelectorVertical-B0Z7parR.js";import"./command-R1e1yMQ9.js";import"./index-R_qB4INp.js";import"./popover-Dm_x8CV9.js";import"./monaco-editor-DEU78sxw.js";import"./editor-4LyrkCqm.js";import"./delay-CnY5UFtP.js";import"./calendar-B6BpOXfC.js";import"./SwitchHorizontal01-_kdH1ete.js";import"./Minus-DnJ8wbLv.js";import"./select-C9_0SSgH.js";import"./index-BdQq_4o_.js";import"./index-CXWqnDP7.js";import"./editor-classes-_dczAbCq.js";import"./toggle-group-C7NFln-0.js";import"./active-indicator-CCMhAsc_.js";import"./combobox-CVTULN6N.js";import"./Upload01-D6tRQTgc.js";import"./DotsVertical-eX97dPc6.js";import"./search-input-DSx8LWNe.js";import"./tabs-B6EQUSl_.js";import"./use-debounced-value-Cm7nwcam.js";import"./use-file-configs-C7kUU5_U.js";import"./asset-utils-CYyNDrFK.js";import"./useInfiniteQuery-Dobhsojg.js";import"./infiniteQueryObserver-CaSjeDsE.js";import"./match-site-slug-config-D3fUJ6vX.js";import"./use-session-runtime-BrkTaSa6.js";import"./sandbox-git-api-CH_-QFpD.js";import"./sandbox-url-D3mC8qhT.js";import"./ArrowUp-723TVuFG.js";import"./ArrowLeft-BJ1448l4.js";import"./Building02-DU823ZCw.js";import"./CheckCircle-C7csYE-y.js";import"./CreditCard01-C3f2i_qY.js";import"./Globe04-ByvV2bPX.js";import"./Key01-C-QXsN23.js";import"./Sun-Ct5gftPt.js";import"./User01-1q78INo2.js";import"./Users01-D5MhP5r0.js";import"./experiments-tab-choice-C9wWsYd4.js";import"./use-sandbox-events-D98uWMd_.js";import"./slider-DTKLr6aL.js";import"./index-BWgOKGMR.js";import"./tooltipContext-CMDZ9J9X.js";import"./CategoricalChart-CinaMpxG.js";import"./index-CeLGzS5y.js";import"./ActiveShapeUtils-DC4ySNWR.js";import"./Sector-DG1U_Qdd.js";import"./symbol-CYXY7_SE.js";import"./empty-state-_a1QMwjl.js";import"./section-preview-url-7zfngvgW.js";import"./slugify-CEUa2lfQ.js";import"./differenceInSeconds-C3x8sHUj.js";import"./project-icon-CJmvnLdz.js";import"./new-project-dialog-qMTAvOP0.js";import"./repository-import-picker-De4sf2Gs.js";import"./repository-picker-HOHNvmaE.js";import"./collection-search-DcBOG84t.js";import"./required-auth-layout-BZllo6Io.js";import"./use-org-sso-D5M4Sxwu.js";import"./use-org-auth-client-BFDehTsp.js";import"./use-move-blocks-DFQHiQ1n.js";const Sc={escape:vi};function _c(n,e){for(const r of tc(n,e)){const a=typeof r.title=="string"?r.title:void 0;if(a?.includes("{{"))return a}}function wc(n,e){if(!e)return;const r=hl(n,oc(e));if(r)try{const a=_c(r.resolveType,e);return a&&fl.render(a,r.data,{},Sc).trim()||void 0}catch{return}}function jc(n){const e=ct.c(13),{icon:r,label:a,className:l}=n;let u;e[0]!==l?(u=me("size-3.5",l),e[0]=l,e[1]=u):u=e[1];let y;e[2]!==r||e[3]!==u?(y=o.jsx(r,{className:u}),e[2]=r,e[3]=u,e[4]=y):y=e[4];let m;e[5]!==a||e[6]!==y?(m=o.jsx(Ct,{asChild:!0,children:o.jsx("span",{role:"img","aria-label":a,className:"shrink-0 cursor-help",children:y})}),e[5]=a,e[6]=y,e[7]=m):m=e[7];let b;e[8]!==a?(b=o.jsx(Nt,{className:"max-w-56",children:a}),e[8]=a,e[9]=b):b=e[9];let h;return e[10]!==m||e[11]!==b?(h=o.jsxs(At,{children:[m,b]}),e[10]=m,e[11]=b,e[12]=h):h=e[12],h}const kc="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 Eo(n){return Array.from({length:n},(e,r)=>({id:crypto.randomUUID(),index:r}))}function zo(n){return n.map((e,r)=>({...e,index:r}))}function Ec(n,e){if(e===n.length)return n;if(e<n.length)return zo(n.slice(0,e));const r=Array.from({length:e-n.length},(a,l)=>({id:crypto.randomUUID(),index:n.length+l}));return[...n,...r]}function Ho(n){const e=ct.c(44),{section:r,raw:a,meta:l,decofile:u}=n,y=Lt(),m=Zn(),b=r.isSavedBlock===!0,h=r.isMultivariate===!0;let k;e[0]!==l||e[1]!==a?(k=a&&l?nc(a,l):void 0,e[0]=l,e[1]=a,e[2]=k):k=e[2];const N=k;let L;e[3]!==l||e[4]!==h||e[5]!==a||e[6]!==b?(L=a&&l&&!b&&!h?wc(a,l):void 0,e[3]=l,e[4]=h,e[5]=a,e[6]=b,e[7]=L):L=e[7];const z=L;let H;e[8]!==u||e[9]!==l||e[10]!==a||e[11]!==r?(H=wi(a,r,u,l),e[8]=u,e[9]=l,e[10]=a,e[11]=r,e[12]=H):H=e[12];const B=H;let w;e[13]!==h||e[14]!==a?.__resolveType?(w=!h&&Ks(a?.__resolveType??""),e[13]=h,e[14]=a?.__resolveType,e[15]=w):w=e[15];const p=w,te=b?Qn:h?Bo:$o;let E;e[16]!==h||e[17]!==b?(E=b?{color:gl}:h?{color:"oklch(0.65 0.15 160)"}:void 0,e[16]=h,e[17]=b,e[18]=E):E=e[18];const W=E;let V;e[19]!==te||e[20]!==m?(V=m?o.jsxs("span",{className:"relative size-4 shrink-0",children:[o.jsx(te,{className:"absolute inset-0 size-4 text-muted-foreground transition-opacity group-hover:opacity-0 group-has-[:focus-visible]:opacity-0"}),o.jsx(ki,{"aria-hidden":!0,className:"absolute inset-0 size-4 opacity-0 transition-opacity group-hover:opacity-100 group-has-[:focus-visible]:opacity-100"})]}):o.jsx(Yi,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[19]=te,e[20]=m,e[21]=V):V=e[21];let J;e[22]!==N?(J=N&&o.jsx("img",{src:N,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded-[var(--studio-control-radius,var(--radius))] object-cover"}),e[22]=N,e[23]=J):J=e[23];let g;e[24]!==m||e[25]!==W?(g=!m&&o.jsx(Cs,{className:"h-4 w-4 shrink-0",style:W}),e[24]=m,e[25]=W,e[26]=g):g=e[26];const Q=m?"shrink":"flex-1",x=r.isHidden&&"line-through opacity-50";let Z;e[27]!==x||e[28]!==Q?(Z=me("min-w-0 truncate text-sm font-medium",Q,x),e[27]=x,e[28]=Q,e[29]=Z):Z=e[29];const q=z??r.label;let pe;e[30]!==Z||e[31]!==q?(pe=o.jsx("span",{className:Z,children:q}),e[30]=Z,e[31]=q,e[32]=pe):pe=e[32];let ye;e[33]!==p||e[34]!==m||e[35]!==B||e[36]!==y?(ye=m?o.jsxs(o.Fragment,{children:[p&&o.jsx(jc,{icon:Ns,label:y("sectionsEditor.sectionList.asyncBadge"),className:"text-muted-foreground"}),B&&o.jsx(Xr,{}),o.jsx("span",{className:"min-w-0 flex-1"})]}):B&&o.jsx(Xr,{className:"absolute -right-0.5 -top-0.5"}),e[33]=p,e[34]=m,e[35]=B,e[36]=y,e[37]=ye):ye=e[37];let ue;return e[38]!==pe||e[39]!==ye||e[40]!==V||e[41]!==J||e[42]!==g?(ue=o.jsxs(o.Fragment,{children:[V,J,g,pe,ye]}),e[38]=pe,e[39]=ye,e[40]=V,e[41]=J,e[42]=g,e[43]=ue):ue=e[43],ue}const Rc="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",Ac="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 Wo(n,e,r){if(r)return ji({selected:e});const a=n.isSavedBlock===!0,l=n.isMultivariate===!0;return me("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":a?Rc:l?Ac:"text-foreground/80 hover:bg-accent hover:text-accent-foreground")}function ws(n,e){return me("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 Cc(n){const e=ct.c(90),{section:r,raw:a,meta:l,decofile:u,sortableId:y,selected:m,onSelect:b,onDelete:h,onDuplicate:k,onMakeReusable:N,onToggleHidden:L,onToggleLazy:z,onAddVariant:H,onDetach:B}=n,w=Lt(),p=Zn(),te=a?Ks(a.__resolveType??""):!1,E=r.isHidden===!0,W=te||E;let V;e[0]!==r?(V=Oo(r),e[0]=r,e[1]=V):V=e[1];const J=V,g=!!z&&!r.isMultivariate;let Q;e[2]!==y?(Q={id:y,animateLayoutChanges:Vc},e[2]=y,e[3]=Q):Q=e[3];const{attributes:x,listeners:Z,setNodeRef:q,transform:pe,isDragging:ye}=Ql(Q);let ue;e[4]!==pe?(ue=Ul.Transform.toString(pe?{...pe,x:0}:null),e[4]=pe,e[5]=ue):ue=e[5];const fe=ye?0:void 0;let Re;e[6]!==ue||e[7]!==fe?(Re={transform:ue,opacity:fe},e[6]=ue,e[7]=fe,e[8]=Re):Re=e[8];const j=Re;let re;e[9]!==r?(re=xi(r),e[9]=r,e[10]=re):re=e[10];const Ae=re,Ce="button",S=0;let K;e[11]!==b?(K=I=>{(I.key==="Enter"||I.key===" ")&&(I.preventDefault(),b())},e[11]=b,e[12]=K):K=e[12];const he=ye?"cursor-grabbing":"cursor-pointer";let M;e[13]!==p||e[14]!==r||e[15]!==m||e[16]!==he?(M=me("touch-none transition-colors",he,Wo(r,m,p)),e[13]=p,e[14]=r,e[15]=m,e[16]=he,e[17]=M):M=e[17];let xe;e[18]!==u||e[19]!==l||e[20]!==a||e[21]!==r?(xe=o.jsx(Ho,{section:r,raw:a,meta:l,decofile:u}),e[18]=u,e[19]=l,e[20]=a,e[21]=r,e[22]=xe):xe=e[22];const O=!p&&g&&o.jsxs(At,{children:[o.jsx(Ct,{asChild:!0,children:o.jsx(Et,{type:"button",variant:"ghost",size:"icon","aria-label":w(te?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender"),className:me(ws(W,te)),onClick:I=>{I.stopPropagation(),z?.()},onPointerDown:Tc,children:o.jsx(Ns,{className:me("h-3.5 w-3.5",te&&"text-warning")})})}),o.jsx(Nt,{side:"bottom",children:w(te?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")})]}),oe=p?o.jsx(bi,{label:w(E?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),active:E,onToggle:L,children:E?o.jsx(xo,{className:"h-3.5 w-3.5"}):o.jsx(bo,{className:"h-3.5 w-3.5"})}):o.jsxs(At,{children:[o.jsx(Ct,{asChild:!0,children:o.jsx(Et,{type:"button",variant:"ghost",size:"icon","aria-label":w(E?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),className:me(ws(W,E)),onClick:I=>{I.stopPropagation(),L()},onPointerDown:Nc,children:E?o.jsx(xo,{className:"h-3.5 w-3.5"}):o.jsx(bo,{className:"h-3.5 w-3.5"})})}),o.jsx(Nt,{side:"bottom",children:w(E?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection")})]}),G=ui,Ke=Si;let ke;e[23]!==w?(ke=w("sectionsEditor.sectionList.sectionActionsMenu"),e[23]=w,e[24]=ke):ke=e[24];const ut=me(ws(W,!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 Ze;e[25]!==Ke||e[26]!==ke||e[27]!==ut?(Ze=o.jsx(Ke,{label:ke,classicClassName:ut}),e[25]=Ke,e[26]=ke,e[27]=ut,e[28]=Ze):Ze=e[28];let $e;e[29]!==p||e[30]!==g||e[31]!==te||e[32]!==z||e[33]!==w?($e=p&&g&&o.jsxs(o.Fragment,{children:[o.jsxs(ln,{onClick:I=>{I.stopPropagation(),z?.()},children:[o.jsx(Ns,{className:"h-4 w-4"}),w(te?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")]}),o.jsx(ci,{})]}),e[29]=p,e[30]=g,e[31]=te,e[32]=z,e[33]=w,e[34]=$e):$e=e[34];let qe;e[35]!==k?(qe=I=>{I.stopPropagation(),k()},e[35]=k,e[36]=qe):qe=e[36];let at;e[37]===Symbol.for("react.memo_cache_sentinel")?(at=o.jsx(Ll,{className:"h-4 w-4"}),e[37]=at):at=e[37];let Ge;e[38]!==w?(Ge=w("sectionsEditor.sectionList.duplicateMenuItem"),e[38]=w,e[39]=Ge):Ge=e[39];let Ue;e[40]!==qe||e[41]!==Ge?(Ue=o.jsxs(ln,{onClick:qe,children:[at,Ge]}),e[40]=qe,e[41]=Ge,e[42]=Ue):Ue=e[42];let Ye;e[43]!==p||e[44]!==J||e[45]!==H||e[46]!==w?(Ye=J&&o.jsxs(ln,{className:me(!p&&_i),onClick:I=>{I.stopPropagation(),H()},children:[o.jsx(Bo,{className:"h-4 w-4"}),w("sectionsEditor.sectionList.addVariantMenuItem")]}),e[43]=p,e[44]=J,e[45]=H,e[46]=w,e[47]=Ye):Ye=e[47];let de;e[48]!==p||e[49]!==Ae||e[50]!==N||e[51]!==w?(de=Ae&&o.jsxs(ln,{className:me(!p&&kc),onClick:I=>{I.stopPropagation(),N()},children:[p?o.jsx(Qn,{className:"h-4 w-4"}):o.jsx(Cs,{className:"h-4 w-4"}),w("sectionsEditor.sectionList.makeReusableMenuItem")]}),e[48]=p,e[49]=Ae,e[50]=N,e[51]=w,e[52]=de):de=e[52];let ge;e[53]!==p||e[54]!==B||e[55]!==r.isMultivariate||e[56]!==r.isSavedBlock||e[57]!==w?(ge=r.isSavedBlock===!0&&!r.isMultivariate&&o.jsxs(ln,{onClick:I=>{I.stopPropagation(),B()},children:[p?o.jsx($o,{className:"h-4 w-4"}):o.jsx(Cs,{className:"h-4 w-4"}),w("sectionsEditor.sectionList.detachMenuItem")]}),e[53]=p,e[54]=B,e[55]=r.isMultivariate,e[56]=r.isSavedBlock,e[57]=w,e[58]=ge):ge=e[58];let be;e[59]!==h?(be=I=>{I.stopPropagation(),h()},e[59]=h,e[60]=be):be=e[60];let ee;e[61]===Symbol.for("react.memo_cache_sentinel")?(ee=o.jsx(zl,{className:"h-4 w-4"}),e[61]=ee):ee=e[61];let F;e[62]!==w?(F=w("sectionsEditor.sectionList.deleteMenuItem"),e[62]=w,e[63]=F):F=e[63];let De;e[64]!==be||e[65]!==F?(De=o.jsxs(ln,{variant:"destructive",onClick:be,children:[ee,F]}),e[64]=be,e[65]=F,e[66]=De):De=e[66];let et;e[67]!==$e||e[68]!==Ue||e[69]!==Ye||e[70]!==de||e[71]!==ge||e[72]!==De?(et=o.jsxs(di,{align:"end",className:"w-44",children:[$e,Ue,Ye,de,ge,De]}),e[67]=$e,e[68]=Ue,e[69]=Ye,e[70]=de,e[71]=ge,e[72]=De,e[73]=et):et=e[73];let tt;e[74]!==G||e[75]!==Ze||e[76]!==et?(tt=o.jsxs(G,{children:[Ze,et]}),e[74]=G,e[75]=Ze,e[76]=et,e[77]=tt):tt=e[77];let st;return e[78]!==x||e[79]!==Z||e[80]!==b||e[81]!==q||e[82]!==j||e[83]!==M||e[84]!==xe||e[85]!==O||e[86]!==oe||e[87]!==tt||e[88]!==K?(st=o.jsxs("div",{ref:q,style:j,...x,...Z,role:Ce,tabIndex:S,onClick:b,onKeyDown:K,className:M,children:[xe,O,oe,tt]}),e[78]=x,e[79]=Z,e[80]=b,e[81]=q,e[82]=j,e[83]=M,e[84]=xe,e[85]=O,e[86]=oe,e[87]=tt,e[88]=K,e[89]=st):st=e[89],st}function Nc(n){return n.stopPropagation()}function Tc(n){return n.stopPropagation()}function Vc(){return!1}function Ts(n){const e=ct.c(11),{canAddSection:r,onAddSection:a,className:l,size:u}=n,y=Lt();let m;e[0]!==l?(m=me("w-full",l),e[0]=l,e[1]=m):m=e[1];const b=!r;let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx($l,{size:14}),e[2]=h):h=e[2];let k;e[3]!==y?(k=y("sectionsEditor.sectionList.addSectionButton"),e[3]=y,e[4]=k):k=e[4];let N;return e[5]!==a||e[6]!==u||e[7]!==m||e[8]!==b||e[9]!==k?(N=o.jsxs(Et,{type:"button",variant:"outline",size:u,className:m,disabled:b,onClick:a,children:[h,k]}),e[5]=a,e[6]=u,e[7]=m,e[8]=b,e[9]=k,e[10]=N):N=e[10],N}function Pc(n){const e=ct.c(101),{listKey:r,rawSections:a,sections:l,meta:u,decofile:y,selectedIndex:m,onSelect:b,onReorder:h,onDelete:k,onDuplicate:N,onMakeReusable:L,onToggleHidden:z,onToggleLazy:H,onAddVariant:B,onDetach:w,onAddSection:p,canAddSection:te}=n,E=te===void 0?!0:te,W=Lt(),V=Zn();let J;e[0]!==l.length?(J=()=>Eo(l.length),e[0]=l.length,e[1]=J):J=e[1];const[g,Q]=R.useState(J),[x,Z]=R.useState(null),[q,pe]=R.useState(r),[ye,ue]=R.useState(l.length),fe=R.useRef(!1);q!==r?(pe(r),ue(l.length),Q(Eo(l.length))):ye!==l.length&&(ue(l.length),Q(Je=>Ec(Je,l.length)));let Re;e[2]===Symbol.for("react.memo_cache_sentinel")?(Re={activationConstraint:{distance:8}},e[2]=Re):Re=e[2];let j;e[3]===Symbol.for("react.memo_cache_sentinel")?(j={coordinateGetter:Xl},e[3]=j):j=e[3];const re=Hl(So(ql,Re),So(Wl,j));let Ae;e[4]!==g?(Ae=g.map(Mc),e[4]=g,e[5]=Ae):Ae=e[5];const Ce=Ae;let S;e[6]===Symbol.for("react.memo_cache_sentinel")?(S=Je=>{Z(String(Je.active.id))},e[6]=S):S=e[6];const K=S;let he;e[7]!==Ce||e[8]!==h?(he=Je=>{Z(null);const{active:ie,over:Ne}=Je;if(!Ne||ie.id===Ne.id)return;const ze=Ce.indexOf(String(ie.id)),rt=Ce.indexOf(String(Ne.id));ze===-1||rt===-1||(Q(it=>zo(Yn([...it],ze,rt))),fe.current=!0,requestAnimationFrame(()=>{fe.current=!1}),h?.(ze,rt))},e[7]=Ce,e[8]=h,e[9]=he):he=e[9];const M=he;let xe;e[10]===Symbol.for("react.memo_cache_sentinel")?(xe=()=>{Z(null)},e[10]=xe):xe=e[10];const O=xe;let oe,G,Ke,ke,ut,Ze,$e,qe,at,Ge,Ue,Ye,de,ge,be;if(e[11]!==x||e[12]!==E||e[13]!==V||e[14]!==y||e[15]!==g||e[16]!==Ce||e[17]!==M||e[18]!==u||e[19]!==p||e[20]!==B||e[21]!==k||e[22]!==w||e[23]!==N||e[24]!==L||e[25]!==b||e[26]!==z||e[27]!==H||e[28]!==a||e[29]!==l||e[30]!==m||e[31]!==re||e[32]!==W){ge=Symbol.for("react.early_return_sentinel");e:{const Je=ie=>{fe.current||b(ie)};if(e[48]!==x||e[49]!==E||e[50]!==V||e[51]!==g||e[52]!==p||e[53]!==a||e[54]!==l||e[55]!==W){const ie=x?g.find(Ne=>Ne.id===x):null;if(ke=ie!=null?l[ie.index]:null,Ke=ie!=null?a[ie.index]:void 0,g.length===0){let Ne;e[59]!==W?(Ne=W("sectionsEditor.sectionList.noSections"),e[59]=W,e[60]=Ne):Ne=e[60];let ze;e[61]!==Ne?(ze=o.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:Ne}),e[61]=Ne,e[62]=ze):ze=e[62];const rt=ze;let it;e[63]!==E||e[64]!==V||e[65]!==rt||e[66]!==p?(it=V?rt:o.jsxs("div",{className:"space-y-2",children:[rt,o.jsx(Ts,{canAddSection:E,onAddSection:p,size:"sm"})]}),e[63]=E,e[64]=V,e[65]=rt,e[66]=p,e[67]=it):it=e[67],ge=it;break e}de=me(ie&&"cursor-grabbing"),e[48]=x,e[49]=E,e[50]=V,e[51]=g,e[52]=p,e[53]=a,e[54]=l,e[55]=W,e[56]=Ke,e[57]=ke,e[58]=de}else Ke=e[56],ke=e[57],de=e[58];G=Yl,qe=re,at=Jl,Ge=K,Ue=M,Ye=O,oe=Zl,Ze=Ce,$e=ec,be="space-y-1",ut=g.map(ie=>{const Ne=l[ie.index];return Ne?o.jsx(Cc,{sortableId:ie.id,section:Ne,raw:a[ie.index],meta:u,decofile:y,selected:m===ie.index,onSelect:()=>Je(ie.index),onDelete:()=>k(ie.index),onDuplicate:()=>N(ie.index),onMakeReusable:()=>L(ie.index),onToggleHidden:()=>z(ie.index),onToggleLazy:H?()=>H(ie.index):void 0,onAddVariant:()=>B(ie.index),onDetach:()=>w(ie.index)},ie.id):null})}e[11]=x,e[12]=E,e[13]=V,e[14]=y,e[15]=g,e[16]=Ce,e[17]=M,e[18]=u,e[19]=p,e[20]=B,e[21]=k,e[22]=w,e[23]=N,e[24]=L,e[25]=b,e[26]=z,e[27]=H,e[28]=a,e[29]=l,e[30]=m,e[31]=re,e[32]=W,e[33]=oe,e[34]=G,e[35]=Ke,e[36]=ke,e[37]=ut,e[38]=Ze,e[39]=$e,e[40]=qe,e[41]=at,e[42]=Ge,e[43]=Ue,e[44]=Ye,e[45]=de,e[46]=ge,e[47]=be}else oe=e[33],G=e[34],Ke=e[35],ke=e[36],ut=e[37],Ze=e[38],$e=e[39],qe=e[40],at=e[41],Ge=e[42],Ue=e[43],Ye=e[44],de=e[45],ge=e[46],be=e[47];if(ge!==Symbol.for("react.early_return_sentinel"))return ge;let ee;e[68]!==ut||e[69]!==be?(ee=o.jsx("div",{className:be,children:ut}),e[68]=ut,e[69]=be,e[70]=ee):ee=e[70];let F;e[71]!==oe||e[72]!==Ze||e[73]!==$e||e[74]!==ee?(F=o.jsx(oe,{items:Ze,strategy:$e,children:ee}),e[71]=oe,e[72]=Ze,e[73]=$e,e[74]=ee,e[75]=F):F=e[75];let De;e[76]!==Ke||e[77]!==ke||e[78]!==V||e[79]!==y||e[80]!==u?(De=ke?o.jsx("div",{className:me("cursor-grabbing shadow-lift",Wo(ke,!1,V)),children:o.jsx(Ho,{section:ke,raw:Ke,meta:u,decofile:y})}):null,e[76]=Ke,e[77]=ke,e[78]=V,e[79]=y,e[80]=u,e[81]=De):De=e[81];let et;e[82]!==De?(et=li.createPortal(o.jsx(Gl,{dropAnimation:yi,children:De}),document.body),e[82]=De,e[83]=et):et=e[83];let tt;e[84]!==G||e[85]!==qe||e[86]!==at||e[87]!==Ge||e[88]!==Ue||e[89]!==Ye||e[90]!==F||e[91]!==et?(tt=o.jsxs(G,{sensors:qe,collisionDetection:at,onDragStart:Ge,onDragEnd:Ue,onDragCancel:Ye,children:[F,et]}),e[84]=G,e[85]=qe,e[86]=at,e[87]=Ge,e[88]=Ue,e[89]=Ye,e[90]=F,e[91]=et,e[92]=tt):tt=e[92];let st;e[93]!==E||e[94]!==V||e[95]!==p?(st=!V&&o.jsx(Ts,{canAddSection:E,onAddSection:p,size:"sm",className:"mt-2"}),e[93]=E,e[94]=V,e[95]=p,e[96]=st):st=e[96];let I;return e[97]!==de||e[98]!==tt||e[99]!==st?(I=o.jsxs("div",{className:de,children:[tt,st]}),e[97]=de,e[98]=tt,e[99]=st,e[100]=I):I=e[100],I}function Mc(n){return n.id}function js(n,e,r,a,l){if(!n||!e)return null;if(!e.isMultivariate)return kt(n,e,a,l)?.data??null;const u=ot(n,e),y=u?Es(u,al)[r]:void 0;return y?Lo(y.value,a)?.data??null:null}const Dc=50;function Kc(n,e){n.own.push(Le(e)),n.own.length>Dc&&n.own.shift()}function Ro(n,e){return n.own.includes(Le(e))}function Ic(n,e){const{sectionIndex:r,variantIndex:a,shown:l,next:u,sectionCount:y}=e;return n&&n.sectionIndex===r&&n.variantIndex===a&&n.emitted===l?(n.emitted=u,n):l?{sectionIndex:r,variantIndex:a,base:l,emitted:u,sectionCount:y,own:[Le(l)]}:null}function qo(n,e){return e!==null&&Le(n)!==Le(e)}function Go(n,e){return n.__resolveType!==e.__resolveType}function Fc(n,e,r,a){if(e.length===a)return"here";const l=Le(n),u=e.flatMap((y,m)=>m!==r&&y!==null&&Le(y)===l?[m]:[]);return u.length===1?u[0]:"unknown"}function Ao({formBase:n,rebased:e,versionOf:r}){let a=null;return{ifMatch:l=>{a=l,n&&(n.version===void 0||e)&&(n.version=r(l));const u=n?n.version:r(l);return u===void 0?void 0:{[l]:u}},onApplied:l=>{n&&a!==null&&Object.hasOwn(l,a)&&(n.version=l[a])},reloadOnConflict:!0}}function Bc({merged:n,tracked:e,current:r,saved:a}){return!!n&&!!e&&r===e&&e.emitted===a}function Co(n,e){return!!n&&!!e&&n.contains(e)}function Vs(n){const e=[],r=Ps("",n.ancestor,n.mine,n.theirs,e);return{...n,merged:r,pointers:e}}function Ps(n,e,r,a,l){const u=(y,m)=>Le(y)===Le(m);if(u(r,a)||u(e,a))return r;if(u(e,r))return a;if(ks(r)&&ks(a)){const y=ks(e)?e:{},m={},b=[...Object.keys(r),...Object.keys(a).filter(h=>!(h in r))];for(const h of b){const k=Ps(`${n}/${h.replaceAll("~","~0").replaceAll("/","~1")}`,y[h],r[h],a[h],l);k!==void 0&&(m[h]=k)}return m}return Array.isArray(e)&&Array.isArray(r)&&Array.isArray(a)&&r.length===e.length&&a.length===e.length?e.map((y,m)=>Ps(`${n}/${m}`,y,r[m],a[m],l)):(l.push(n),a)}function ks(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}function Oc(n,e){let r=n.merged;for(const a of n.pointers)e[a]==="mine"&&(r=Hc(r,a,Xt(n.mine,a)));return r}function Lc(n,e){return Object.fromEntries(n.pointers.map(r=>[r,e]))}function Uo(n){return Lc(n,"mine")}function Ms(n,e,r){const a=Uo(r);for(const l of r.pointers){const u=e[l];if(!u||!n.pointers.includes(l))continue;["mine","theirs"].every(m=>Le(Xt(n[m],l))===Le(Xt(r[m],l)))&&(a[l]=u)}return a}function Yo(n,e,r={}){const a=e.pointers.filter(l=>!n.pointers.includes(l)||Le(Xt(n.theirs,l))!==Le(Xt(e.theirs,l)));return a.length===0?r:{...r,...Object.fromEntries(a.map(l=>[l,(r[l]??0)+1]))}}function $c(n,e,r){if(!e||Go(n.plan.ancestor,e)||!qo(n.plan.theirs,e)||r(e))return null;const a=Vs({...n.plan,theirs:e});return a.pointers.length===0?null:{plan:a,choices:Ms(n.plan,n.choices,a),fresh:Yo(n.plan,a,n.fresh)}}function zc(n,e){return n.pointers.map(r=>({pointer:r,label:Ei(r,e),mine:Xt(n.mine,r),theirs:Xt(n.theirs,r),schema:Wc(e??null,r)}))}function Is(n){return n.split("/").slice(1).map(e=>e.replaceAll("~1","/").replaceAll("~0","~"))}function Xt(n,e){let r=n;for(const a of Is(e))if(Array.isArray(r))r=r[Number(a)];else if(r&&typeof r=="object")r=r[a];else return;return r}function Hc(n,e,r){const a=Is(e),l=(u,y)=>{if(y===a.length)return r;const m=a[y];if(Array.isArray(u)){const k=[...u];return k[Number(m)]=l(u[Number(m)],y+1),k}const b=u&&typeof u=="object"?{...u}:{},h=l(b[m],y+1);return h===void 0?delete b[m]:b[m]=h,b};return l(n,0)}function Wc(n,e){let r=n;for(const a of Is(e)){if(!r)return null;r=/^\d+$/.test(a)&&!r.properties?.[a]?r.items:r.properties?.[a]}return r??null}const qc=/\.(png|jpe?g|gif|webp|avif|svg)(\?.*)?$/i,No=60,Gc=3;function Jo(n,e){return e?.format==="image-uri"?!0:n.startsWith("data:image/")||/^(https?:)?\/\//.test(n)&&qc.test(n)}function Ds(n,e){if(!(e?.format==="rich-text"||e?.format==="rich-text-inline"||e?.format==="html"||/<\/?[a-z][^>]*>/i.test(n)))return n;const a=n.replace(/<br\s*\/?>/gi,`
2
2
  `).replace(/<\/(p|div|li|h[1-6])>/gi,`
3
3
  `);return Yc(a).replace(/\u00a0/g," ").replace(/\n{2,}/g,`
4
- `).trim()}const Uc={"&nbsp;":" ","&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"};function Yc(n){if(typeof DOMParser<"u")return new DOMParser().parseFromString(n,"text/html").body.textContent??"";let e=n;for(let r="";r!==e;)r=e,e=e.replace(/<[^<>]*>/g,"");return e.replace(/<|>/g,"").replace(/&(nbsp|amp|lt|gt|quot|#39);/g,r=>Uc[r]??r)}function Jn(n){const e=n.replace(/\s+/g," ").trim();return e.length>No?`${e.slice(0,No-1)}…`:e}function Jc(n){if(n.startsWith("data:"))return"image";const e=n.split(/[?#]/)[0]??n;return decodeURIComponent(e.split("/").pop()||n)}function Xn(n,e){if(n==null||n==="")return{kind:"empty"};if(typeof n=="string")return Jo(n,e)?{kind:"image",src:n}:{kind:"text",text:Ds(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 r=e?.items??null;return{kind:"list",count:n.length,items:n.slice(0,Gc).map(a=>Qc(a,r)??"")}}if(typeof n=="object"){const r=n;if("value"in r&&Object.keys(r).length<=2)return Xn(r.value,e?.properties?.value??e);const a=Object.entries(r).filter(([l,u])=>!l.startsWith("__")&&u!==void 0).flatMap(([l,u])=>{const y=e?.properties?.[l]??null,m=Xn(u,y);if(m.kind==="empty")return[];const b=m.kind==="text"?Jn(m.text):m.kind==="image"?Jc(m.src):m.kind==="yesNo"?m.value?"✓":"✗":m.kind==="list"?`${m.count}`:"…";return[{label:y?.title?.trim()||l,text:b}]}).slice(0,4);return a.length>0?{kind:"fields",entries:a}:{kind:"empty"}}return{kind:"text",text:String(n)}}function Qc(n,e){if(typeof n=="string")return Jn(Ds(n,e));if(!n||typeof n!="object"||Array.isArray(n))return null;const r=n,a=e?.titleBy,l=a?r[a]:void 0;if(typeof l=="string"&&l.trim())return Jn(l);for(const[u,y]of Object.entries(r))if(!(u.startsWith("__")||typeof y!="string"||!y.trim())&&!Jo(y,e?.properties?.[u]??null))return Jn(Ds(y,null));return null}const To=1500;function Xc(n,e){const r=n.split(/(\s+)/).filter(k=>k!==""),a=e.split(/(\s+)/).filter(k=>k!=="");if(r.length>To||a.length>To)return{mine:[{text:n,kind:"changed"}],theirs:[{text:e,kind:"changed"}]};const l=Array.from({length:r.length+1},()=>new Array(a.length+1).fill(0));for(let k=r.length-1;k>=0;k--)for(let N=a.length-1;N>=0;N--){const L=l[k];L[N]=r[k]===a[N]?l[k+1][N+1]+1:Math.max(l[k+1][N],L[N+1])}const u=[],y=[],m=(k,N,L)=>{const z=k.at(-1);z&&(z.kind===L||L==="same"&&!N.trim())?z.text+=N:k.push({text:N,kind:L})};let b=0,h=0;for(;b<r.length&&h<a.length;)r[b]===a[h]?(m(u,r[b],"same"),m(y,a[h],"same"),b++,h++):l[b+1][h]>=l[b][h+1]?(m(u,r[b],"changed"),b++):(m(y,a[h],"changed"),h++);for(;b<r.length;b++)m(u,r[b],"changed");for(;h<a.length;h++)m(y,a[h],"changed");return{mine:u,theirs:y}}function Zc(n){const e=ct.c(10);let r,a;e[0]!==n?({open:r,...a}=n,e[0]=n,e[1]=r,e[2]=a):(r=e[1],a=e[2]);const{data:l}=Io.useSession();let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=me("max-h-[85vh] grid-rows-[auto_minmax(0,1fr)_auto] sm:max-w-lg"),e[3]=u):u=e[3];const y=l?.user??null;let m;e[4]!==a||e[5]!==y?(m=o.jsx(ac,{className:u,"data-testid":"form-conflict-dialog",onEscapeKeyDown:tu,children:o.jsx(iu,{...a,viewer:y,heading:eu})}),e[4]=a,e[5]=y,e[6]=m):m=e[6];let b;return e[7]!==r||e[8]!==m?(b=o.jsx(uc,{open:r,children:m}),e[7]=r,e[8]=m,e[9]=b):b=e[9],b}function eu(n,e){return o.jsxs(ic,{className:"text-left",children:[o.jsx(lc,{children:n}),o.jsx(cc,{children:e})]})}function tu(n){return n.preventDefault()}const nu={},su=(n,e)=>o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx("h2",{className:"text-lg font-semibold",children:n}),o.jsx("p",{className:"text-sm text-muted-foreground",children:e})]});function ru(n,e,r=0,a={},l=null){const u=e[Math.min(r,e.length-1)],y=l?.you?void 0:l?.name?.split(/\s+/)[0],m={field:u?au(u.label):"",label:u?.label??"",name:y??""},b=(h,k,N)=>n(l?.you?N:y?k:h,m);return e.length<=1?{title:b("sectionsEditor.formConflict.titleOne","sectionsEditor.formConflict.titleOneNamed","sectionsEditor.formConflict.titleOneYou"),description:n("sectionsEditor.formConflict.descriptionOne")}:{title:b("sectionsEditor.formConflict.titleStep","sectionsEditor.formConflict.titleStepNamed","sectionsEditor.formConflict.titleStepYou"),description:r>=e.length-1?o.jsx(ou,{t:n,fields:e,choices:a,name:y}):n("sectionsEditor.formConflict.descriptionStep")}}function ou(n){const e=ct.c(11),{t:r,fields:a,choices:l,name:u}=n;let y;if(e[0]!==l||e[1]!==a||e[2]!==u||e[3]!==r){let b;e[5]!==l||e[6]!==u||e[7]!==r?(b=(h,k)=>o.jsxs(R.Fragment,{children:[k>0&&" · ",`${h.label}: `,o.jsx("span",{className:"font-medium text-foreground",children:r((l[h.pointer]??"mine")==="mine"?"sectionsEditor.formConflict.summaryYours":u?"sectionsEditor.formConflict.summaryTheirsNamed":"sectionsEditor.formConflict.summaryTheirs",{name:u??""})})]},h.pointer),e[5]=l,e[6]=u,e[7]=r,e[8]=b):b=e[8],y=a.map(b),e[0]=l,e[1]=a,e[2]=u,e[3]=r,e[4]=y}else y=e[4];let m;return e[9]!==y?(m=o.jsx("span",{"data-testid":"form-conflict-summary",children:y}),e[9]=y,e[10]=m):m=e[10],m}function au(n){return/^[A-Z][a-z]/.test(n)&&!n.includes("›")?n.charAt(0).toLowerCase()+n.slice(1):n}function iu(n){const e=ct.c(68),r=Lt(),{fields:a,choices:l,changedAgain:u,fresh:y,heading:m}=n,b=u===void 0?!1:u,h=y===void 0?nu:y,k=m===void 0?su:m,N=a.length>1,[L,z]=R.useState(0),[H,B]=R.useState(lu);let w;e[0]===Symbol.for("react.memo_cache_sentinel")?(w={},e[0]=w):w=e[0];const[p,te]=R.useState(w),E=Math.max(0,Math.min(L,a.length-1)),W=a[E],V=E===a.length-1;let J;e[1]!==E||e[2]!==a||e[3]!==h?(J=xe=>{const O=a[E],oe=a[xe];!O||!oe||xe===E||(B(G=>new Set(G).add(O.pointer)),te(G=>({...G,[O.pointer]:h[O.pointer]??0,[oe.pointer]:h[oe.pointer]??0})),z(xe))},e[1]=E,e[2]=a,e[3]=h,e[4]=J):J=e[4];const g=J;let Q;e[5]!==E||e[6]!==g?(Q=xe=>{if(!xe)return;const O=oe=>{const G={ArrowLeft:-1,ArrowRight:1}[oe.key];!G||oe.defaultPrevented||oe.altKey||oe.ctrlKey||oe.metaKey||oe.shiftKey||fc(oe.target)||(oe.preventDefault(),g(E+G))};return xe.ownerDocument.addEventListener("keydown",O),()=>xe.ownerDocument.removeEventListener("keydown",O)},e[5]=E,e[6]=g,e[7]=Q):Q=e[7];const x=Q;if(!W)return null;let Z,q,pe,ye,ue;if(e[8]!==H||e[9]!==E||e[10]!==l||e[11]!==a||e[12]!==h||e[13]!==g||e[14]!==k||e[15]!==x||e[16]!==N||e[17]!==n||e[18]!==p||e[19]!==r){const{title:xe,description:O}=ru(r,a,E,l,n.author??null);let oe;e[25]!==n?(oe=G=>{G.detail>1||n.onApply()},e[25]=n,e[26]=oe):oe=e[26],Z=oe,q=N?x:void 0,pe="flex min-w-0 flex-col gap-3",e[27]!==H||e[28]!==E||e[29]!==a||e[30]!==h||e[31]!==g||e[32]!==N||e[33]!==p||e[34]!==r?(ye=N&&o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx("div",{role:"group","aria-label":r("sectionsEditor.formConflict.steps"),className:"-m-1 flex flex-wrap items-center",children:a.map((G,Ie)=>{const ke=Ie!==E&&(h[G.pointer]??0)>(p[G.pointer]??0);return o.jsx("button",{type:"button","aria-label":ke?r("sectionsEditor.formConflict.stepChangedAgain",{label:G.label}):G.label,"aria-current":Ie===E?"step":void 0,"data-answered":Ie!==E&&H.has(G.pointer)?"":void 0,"data-changed-again":ke?"":void 0,onClick:()=>g(Ie),className:"group cursor-pointer rounded-full p-1 focus-ring",children:o.jsx("span",{className:me("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")})},G.pointer)})}),o.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:r("sectionsEditor.formConflict.stepCount",{step:String(E+1),count:String(a.length)})})]}),e[27]=H,e[28]=E,e[29]=a,e[30]=h,e[31]=g,e[32]=N,e[33]=p,e[34]=r,e[35]=ye):ye=e[35],ue=k(xe,O),e[8]=H,e[9]=E,e[10]=l,e[11]=a,e[12]=h,e[13]=g,e[14]=k,e[15]=x,e[16]=N,e[17]=n,e[18]=p,e[19]=r,e[20]=Z,e[21]=q,e[22]=pe,e[23]=ye,e[24]=ue}else Z=e[20],q=e[21],pe=e[22],ye=e[23],ue=e[24];let fe;e[36]!==q||e[37]!==pe||e[38]!==ye||e[39]!==ue?(fe=o.jsxs("div",{ref:q,className:pe,children:[ye,ue]}),e[36]=q,e[37]=pe,e[38]=ye,e[39]=ue,e[40]=fe):fe=e[40];const Re=!b&&"sr-only";let j;e[41]!==Re?(j=me("text-sm text-muted-foreground",Re),e[41]=Re,e[42]=j):j=e[42];let re;e[43]!==b||e[44]!==N||e[45]!==r?(re=b?r(N?"sectionsEditor.formConflict.changedAgainSteps":"sectionsEditor.formConflict.changedAgain"):"",e[43]=b,e[44]=N,e[45]=r,e[46]=re):re=e[46];let Ae;e[47]!==j||e[48]!==re?(Ae=o.jsx("p",{role:"status",className:j,children:re}),e[47]=j,e[48]=re,e[49]=Ae):Ae=e[49];const Ce=N?"vertical":"all";let S;e[50]!==W||e[51]!==n||e[52]!==Ce?(S=o.jsx(fu,{field:W,...n,arrows:Ce}),e[50]=W,e[51]=n,e[52]=Ce,e[53]=S):S=e[53];let I;e[54]!==Ae||e[55]!==S?(I=o.jsxs("div",{className:"-mx-2 flex min-h-0 flex-col gap-3 overflow-y-auto px-2 py-1",children:[Ae,S]}),e[54]=Ae,e[55]=S,e[56]=I):I=e[56];let he;e[57]!==Z||e[58]!==E||e[59]!==g||e[60]!==V||e[61]!==N||e[62]!==r?(he=N?o.jsxs(_o,{className:"flex-row flex-wrap items-center justify-between gap-2 sm:justify-between",children:[o.jsx(Et,{type:"button",variant:"outline","aria-disabled":E===0,onClick:()=>g(E-1),className:"aria-disabled:cursor-default aria-disabled:opacity-45",children:r("sectionsEditor.formConflict.back")}),o.jsx(Et,{type:"button","data-testid":"form-conflict-primary",onClick:V?Z:()=>g(E+1),children:r(V?"sectionsEditor.formConflict.ok":"sectionsEditor.formConflict.next")})]}):o.jsx(_o,{className:"items-center gap-2",children:o.jsx(Et,{type:"button","data-testid":"form-conflict-primary",onClick:Z,children:r("sectionsEditor.formConflict.ok")})}),e[57]=Z,e[58]=E,e[59]=g,e[60]=V,e[61]=N,e[62]=r,e[63]=he):he=e[63];let M;return e[64]!==fe||e[65]!==I||e[66]!==he?(M=o.jsxs(o.Fragment,{children:[fe,I,he]}),e[64]=fe,e[65]=I,e[66]=he,e[67]=M):M=e[67],M}function lu(){return new Set}function cu(n){const e=Xn(n.mine,n.schema),r=Xn(n.theirs,n.schema),a=e.kind==="text"&&r.kind==="text"?Xc(e.text,r.text):null;return l=>a?o.jsx(pu,{parts:a[l]}):o.jsx(gu,{preview:l==="mine"?e:r})}const uu={all:{ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1},vertical:{ArrowDown:1,ArrowUp:-1}};function du(n,e){const r=uu[e][n.key];if(!r)return;const a=[...n.currentTarget.querySelectorAll('[role="radio"]')],l=a.indexOf(document.activeElement);if(l<0)return;n.preventDefault();const u=a[(l+r+a.length)%a.length];u?.focus(),u?.click()}function fu(n){const e=ct.c(65),{field:r,choices:a,viewer:l,author:u,onChoose:y,arrows:m}=n,b=u===void 0?null:u,h=Lt(),[k]=fi(),{language:N}=k;let L,z,H,B,w,p,te,E,W,V,J,g,Q,x;if(e[0]!==m||e[1]!==b||e[2]!==a||e[3]!==r||e[4]!==N||e[5]!==y||e[6]!==h||e[7]!==l?.image||e[8]!==l?.name){const pe=cu(r),ye=a[r.pointer]??"mine",ue=l?.image??void 0;let fe;e[23]!==h||e[24]!==l?.name?(fe=l?.name?.trim()||h("sectionsEditor.formConflict.you"),e[23]=h,e[24]=l?.name,e[25]=fe):fe=e[25];let Re;e[26]!==ue||e[27]!==fe?(Re=o.jsx(_s,{url:ue,fallback:fe,shape:"circle",size:"sm",className:"text-xs"}),e[26]=ue,e[27]=fe,e[28]=Re):Re=e[28];const j=Re;let re;e[29]!==b||e[30]!==j?(re=b?.you?j:b?.name?o.jsx(_s,{url:b.avatarUrl,fallback:b.name,shape:"circle",size:"sm",className:"text-xs"}):o.jsx(_s,{url:"icon://user",fallback:"",muted:!0,shape:"circle",size:"sm"}),e[29]=b,e[30]=j,e[31]=re):re=e[31];const Ae=re,Ce=b?new Date(b.at):null;H="radiogroup",B=r.label,w="flex flex-col gap-2",e[32]!==m?(p=M=>du(M,m),e[32]=m,e[33]=p):p=e[33];let S;e[34]!==r.pointer||e[35]!==y?(S=()=>y(r.pointer,"mine"),e[34]=r.pointer,e[35]=y,e[36]=S):S=e[36];let I;e[37]!==h?(I=h("sectionsEditor.formConflict.you"),e[37]=h,e[38]=I):I=e[38];let he;e[39]!==h?(he=h("sectionsEditor.formConflict.yourVersionNotSaved"),e[39]=h,e[40]=he):he=e[40],te=o.jsx(Vo,{side:"mine",checked:ye==="mine",onChoose:S,avatar:j,who:I,meta:he,children:pe("mine")}),L=Vo,E="theirs",W=ye==="theirs",e[41]!==r.pointer||e[42]!==y?(V=()=>y(r.pointer,"theirs"),e[41]=r.pointer,e[42]=y,e[43]=V):V=e[43],J=Ae,e[44]!==b?.name||e[45]!==b?.you||e[46]!==h?(g=b?.you?h("sectionsEditor.formConflict.youElsewhere"):b?.name||h("sectionsEditor.formConflict.someoneElse"),e[44]=b?.name,e[45]=b?.you,e[46]=h,e[47]=g):g=e[47],Q=Ce?h("sectionsEditor.formConflict.savedAt",{when:dc(Ce,N)}):h("sectionsEditor.formConflict.theirVersionSaved"),x=Ce?mu(Ce,N):void 0,z=pe("theirs"),e[0]=m,e[1]=b,e[2]=a,e[3]=r,e[4]=N,e[5]=y,e[6]=h,e[7]=l?.image,e[8]=l?.name,e[9]=L,e[10]=z,e[11]=H,e[12]=B,e[13]=w,e[14]=p,e[15]=te,e[16]=E,e[17]=W,e[18]=V,e[19]=J,e[20]=g,e[21]=Q,e[22]=x}else L=e[9],z=e[10],H=e[11],B=e[12],w=e[13],p=e[14],te=e[15],E=e[16],W=e[17],V=e[18],J=e[19],g=e[20],Q=e[21],x=e[22];let Z;e[48]!==L||e[49]!==z||e[50]!==E||e[51]!==W||e[52]!==V||e[53]!==J||e[54]!==g||e[55]!==Q||e[56]!==x?(Z=o.jsx(L,{side:E,checked:W,onChoose:V,avatar:J,who:g,meta:Q,metaTitle:x,children:z}),e[48]=L,e[49]=z,e[50]=E,e[51]=W,e[52]=V,e[53]=J,e[54]=g,e[55]=Q,e[56]=x,e[57]=Z):Z=e[57];let q;return e[58]!==H||e[59]!==B||e[60]!==w||e[61]!==p||e[62]!==te||e[63]!==Z?(q=o.jsxs("div",{role:H,"aria-label":B,className:w,onKeyDown:p,children:[te,Z]}),e[58]=H,e[59]=B,e[60]=w,e[61]=p,e[62]=te,e[63]=Z,e[64]=q):q=e[64],q}const mu=(n,e)=>n.toLocaleString(e,{dateStyle:"medium",timeStyle:"short"});function Vo(n){const e=ct.c(28),{side:r,checked:a,onChoose:l,avatar:u,who:y,meta:m,metaTitle:b,children:h}=n,k=R.useId(),N=`${k}-who`,L=`${k}-meta ${k}-value`,z=a?0:-1,H=a?"border-primary bg-primary/5 ring-1 ring-primary":"hover:bg-accent";let B;e[0]!==H?(B=me("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] focus-ring",H),e[0]=H,e[1]=B):B=e[1];const w=`${k}-who`;let p;e[2]!==w||e[3]!==y?(p=o.jsx("span",{id:w,className:"text-sm font-medium text-foreground",children:y}),e[2]=w,e[3]=y,e[4]=p):p=e[4];const te=`${k}-meta`;let E;e[5]!==m||e[6]!==b||e[7]!==te?(E=o.jsx("span",{id:te,title:b,children:m}),e[5]=m,e[6]=b,e[7]=te,e[8]=E):E=e[8];let W;e[9]!==p||e[10]!==E?(W=o.jsxs("span",{className:"flex flex-wrap items-baseline gap-x-1.5 text-xs text-muted-foreground",children:[p,E]}),e[9]=p,e[10]=E,e[11]=W):W=e[11];const V=`${k}-value`,J=`conflict-${r}`;let g;e[12]!==h||e[13]!==V||e[14]!==J?(g=o.jsx("span",{id:V,"data-testid":J,className:"min-w-0 text-sm",children:h}),e[12]=h,e[13]=V,e[14]=J,e[15]=g):g=e[15];let Q;e[16]!==W||e[17]!==g?(Q=o.jsxs("span",{className:"flex min-w-0 flex-col gap-1",children:[W,g]}),e[16]=W,e[17]=g,e[18]=Q):Q=e[18];let x;return e[19]!==u||e[20]!==a||e[21]!==l||e[22]!==N||e[23]!==Q||e[24]!==L||e[25]!==z||e[26]!==B?(x=o.jsxs("button",{type:"button",role:"radio","aria-checked":a,"aria-labelledby":N,"aria-describedby":L,tabIndex:z,onClick:l,className:B,children:[u,Q]}),e[19]=u,e[20]=a,e[21]=l,e[22]=N,e[23]=Q,e[24]=L,e[25]=z,e[26]=B,e[27]=x):x=e[27],x}function pu(n){const e=ct.c(4),{parts:r}=n;let a;e[0]!==r?(a=r.map(hu),e[0]=r,e[1]=a):a=e[1];let l;return e[2]!==a?(l=o.jsx("span",{className:"whitespace-pre-wrap break-words",children:a}),e[2]=a,e[3]=l):l=e[3],l}function hu(n,e){return n.kind==="changed"?o.jsx("mark",{className:"rounded-sm bg-warning/20 px-0.5 text-foreground",children:n.text},e):o.jsx("span",{children:n.text},e)}function gu(n){const e=ct.c(29),{preview:r}=n,a=Lt();switch(r.kind){case"empty":{let l;e[0]!==a?(l=a("sectionsEditor.formConflict.empty"),e[0]=a,e[1]=l):l=e[1];let u;return e[2]!==l?(u=o.jsx("span",{className:"italic text-muted-foreground",children:l}),e[2]=l,e[3]=u):u=e[3],u}case"text":{let l;return e[4]!==r.text?(l=o.jsx("span",{className:"whitespace-pre-wrap break-words",children:r.text}),e[4]=r.text,e[5]=l):l=e[5],l}case"image":{let l;return e[6]!==r.src?(l=o.jsx("img",{src:r.src,alt:"",className:"max-h-24 max-w-full rounded border object-contain"}),e[6]=r.src,e[7]=l):l=e[7],l}case"yesNo":{const l=r.value?"sectionsEditor.formConflict.yes":"sectionsEditor.formConflict.no";let u;e[8]!==a||e[9]!==l?(u=a(l),e[8]=a,e[9]=l,e[10]=u):u=e[10];let y;return e[11]!==u?(y=o.jsx("span",{children:u}),e[11]=u,e[12]=y):y=e[12],y}case"list":{const l=r.count===1?"sectionsEditor.formConflict.oneItem":"sectionsEditor.formConflict.items",u=String(r.count);let y;e[13]!==a||e[14]!==l||e[15]!==u?(y=a(l,{count:u}),e[13]=a,e[14]=l,e[15]=u,e[16]=y):y=e[16];let m;e[17]!==y?(m=o.jsx("span",{className:"text-muted-foreground",children:y}),e[17]=y,e[18]=m):m=e[18];let b;e[19]!==r.count||e[20]!==r.items?(b=r.items.some(Boolean)&&o.jsxs("span",{className:"flex flex-col",children:[r.items.map(yu),r.count>r.items.length&&o.jsx("span",{children:"…"})]}),e[19]=r.count,e[20]=r.items,e[21]=b):b=e[21];let h;return e[22]!==m||e[23]!==b?(h=o.jsxs("span",{className:"flex flex-col gap-1",children:[m,b]}),e[22]=m,e[23]=b,e[24]=h):h=e[24],h}case"fields":{let l;e[25]!==r.entries?(l=r.entries.map(vu),e[25]=r.entries,e[26]=l):l=e[26];let u;return e[27]!==l?(u=o.jsx("dl",{className:"grid grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-0.5",children:l}),e[27]=l,e[28]=u):u=e[28],u}}}function vu(n){return o.jsxs("div",{className:"contents",children:[o.jsx("dt",{className:"text-muted-foreground",children:n.label}),o.jsx("dd",{className:"truncate",children:n.text})]},n.label)}function yu(n,e){return o.jsx("span",{className:"truncate",children:`${e+1}. ${n||"…"}`},e)}function xu(n,e){return n.kind==="protocol"&&n.source==="github"?e:null}function bu(n,e){if(Object.hasOwn(n,e))return n[e]??null;const r=fo(e),a=Object.keys(n).find(l=>fo(l)===r);return a===void 0?null:n[a]??null}async function Su(n,e){try{const r=await fetch(`/api/${n.orgSlug}/decofile/${encodeURIComponent(n.virtualMcpId)}/${encodeURIComponent(n.branch)}`,{cache:"no-store",headers:Qi("v8")});if(!r.ok)return null;const a=await r.json().catch(()=>({})),l=bu(a.changedBy??{},e);return l&&typeof l.userId=="string"&&Number.isFinite(Date.parse(l.at))?l:null}catch{return null}}function _u(n,e,r){const a=e.find(y=>y.userId===n.userId),l=a?.user?.name?.trim(),u=a?.user?.image??void 0;return{...l?{name:l}:{},...u?{avatarUrl:u}:{},at:n.at,you:!!r&&n.userId===r}}function wu(n){let e=2166136261,r=0;for(let a=0;a<n.length;a++){const l=n.charCodeAt(a);e=Math.imul(e^l,16777619),r=Math.imul(r,31)+l|0}return`${(e>>>0).toString(36)}${(r>>>0).toString(36)}:${n.length}`}function ju(n,e,r){const a=ct.c(19),l=!!n&&!!e&&r!==null;let u;a[0]!==e||a[1]!==n||a[2]!==r?(u=Ko.conflictAuthor(n?`${n.orgSlug}/${n.virtualMcpId}/${n.branch}`:"",e??"",r??""),a[0]=e,a[1]=n,a[2]=r,a[3]=u):u=a[3];let y;a[4]!==e||a[5]!==n?(y=()=>Su(n,e),a[4]=e,a[5]=n,a[6]=y):y=a[6];let m;a[7]!==l||a[8]!==u||a[9]!==y?(m={queryKey:u,queryFn:y,enabled:l,staleTime:Number.POSITIVE_INFINITY,gcTime:6e5,retry:!1,refetchOnWindowFocus:!1},a[7]=l,a[8]=u,a[9]=y,a[10]=m):m=a[10];const{data:b}=mi(m),h=l?b??null:null,k=!!h;let N;a[11]!==k?(N={enabled:k},a[11]=k,a[12]=N):N=a[12];const{data:L}=mc(N);let z;a[13]!==L?(z=L?.data?.members??[],a[13]=L,a[14]=z):z=a[14];const H=z,{data:B}=Io.useSession();if(!h)return null;const w=B?.user?.id??null;let p;return a[15]!==h||a[16]!==H||a[17]!==w?(p=_u(h,H,w),a[15]=h,a[16]=H,a[17]=w,a[18]=p):p=a[18],p}function ku(n,e,r,a){if(!n||typeof n!="object")return{kind:"error",reason:"no-matcher-rule"};const l=e.trim();if(!l)return Qt(n,r,a)?{kind:"inline",blockKey:n.__resolveType??"",inlinedRule:Rs(n,r,a)}:{kind:"noop"};const u=As(n,r,a);if(!u)return{kind:"error",reason:"unreadable-rule"};if(u.blockKey)return{kind:"updateBlock",blockKey:u.blockKey,blockData:Ot(u.resolveType,u.data,l)};const y=Gn(l),m=Un(y,r);return m?{kind:"error",reason:"invalid-block-id",message:m}:{kind:"createBlock",blockId:y,blockData:Ot(u.resolveType,u.data,l),reference:dn(y)}}const Po="section-form-stale-save",Eu=3,Ru=1e3;function Mo(n,e,r){const a=e.global&&e.pageKey?[{label:"Default",sections:[{__resolveType:e.pageKey}]}]:Fo(e.pageKey?n[e.pageKey]?.sections:void 0,n,r),l=Math.max(0,Math.min(e.pageVariantIndex,a.length-1)),u=a[l]?.sections??[];return{pageVariants:a,variantIndex:l,rawSections:u,parsedSections:En(u,n,r)}}const Do=new WeakMap;let Au=0;function Cu(n){let e=Do.get(n);return e===void 0&&(e=++Au,Do.set(n,e)),e}function gm({orgSlug:n,virtualMcpId:e,branch:r,previewReady:a=!0,previewUrl:l,currentPath:u,activePageBlockKey:y=null,activeGlobalBlockKey:m=null,externalSelection:b,onSaved:h,initialEditSeo:k=!1,onExitSeo:N,onSelectRoot:L,onViewJsonFile:z,onFocusedBlockChange:H,onVariantPreviewOverride:B,focusVariant:w}){const p=Lt(),te=gi(),E=te?.taskId??null,W=a?{orgSlug:n,virtualMcpId:e,branch:r,threadId:E,previewUrl:l}:null,[V,J]=R.useState([]),{data:g,isLoading:Q}=Xi(W,{pollWhile:V.length>0}),{data:x,isLoading:Z}=il(W),q=Zn(),pe=te?.virtualMcpId,ue=qi(pe===e?e:null)?.metadata?.siteSlug??null,fe=sc({virtualMcpId:e,branch:r,sandboxUrl:l}),Re=Zi(e,r),j=el(Re),re=ul(j),Ae=!j,Ce=!!fe||j,[S,I]=R.useState(null),[he,M]=R.useState(null),[xe,O]=R.useState(null),[oe,G]=R.useState(0),[Ie,ke]=R.useState(void 0),[ut,Ze]=R.useState(null),[$e,qe]=R.useState(null);w&&w.seq!==ut&&(Ze(w.seq),qe(w));const[at,Ge]=R.useState(null),Ue={index:at,remember:Ge},[Ye,de]=R.useState(null),[ge,be]=R.useState(null),[ee,F]=R.useState([]),De=R.useRef(null),[et,tt]=R.useState(ee.length);et!==ee.length&&(tt(ee.length),requestAnimationFrame(()=>{De.current&&(De.current.scrollTop=0)}));const[st,K]=R.useState(0),[Je,ie]=R.useState(null),[Ne,ze]=R.useState(null),[rt,it]=R.useState(null),[Qo,Zt]=R.useState(!1),[Fs,es]=R.useState(!1),Rn=R.useRef(null),[An,Xo]=R.useState(!0),[en,Cn]=R.useState(!1),[$t,Nn]=R.useState(!1),[He,fn]=R.useState(k),[Bs,Os]=R.useState(k);k&&!Bs&&(Os(!0),fn(!0),I(null),M(null),O(null),F([])),!k&&Bs&&Os(!1);const[Zo,mn]=R.useState(null),[Ls,Tn]=R.useState(void 0),[$s,zt]=R.useState([]),[zs,tn]=R.useState(0),[Qe,dt]=R.useState(0),[ea,Xe]=R.useState(null),[nn,nt]=R.useState(null),[Hs,Ws]=R.useState(null),qs=pi(),Gs=tl({orgSlug:n,virtualMcpId:e,branch:r},{tunnel:!1}),pn=Ri({orgSlug:n,virtualMcpId:e,branch:r}),[ta,na]=R.useState(u),[sa,ra]=R.useState(y),[oa,aa]=R.useState(m);(ta!==u||sa!==y||oa!==m)&&(queueMicrotask(()=>pn.flush()),na(u),ra(y),aa(m),I(null),M(null),O(null),G(0),de(null),be(null),dt(0),Xe(null),nt(null),F([]),K(t=>t+1),fn(!1),mn(null),Tn(void 0),zt([]),tn(t=>t+1));const X=Ai({orgSlug:n,virtualMcpId:e,branch:r}),hn=zi((t,s)=>{X.mutate({blockKey:t,data:s},{onSuccess:()=>h?.(),onError:X.reportError})}),Vn=ml({orgSlug:n,virtualMcpId:e,branch:r}),Us=vc({orgSlug:n,virtualMcpId:e,branch:r}),[sn,rn]=R.useState(!1),$=R.useRef(null),Tt=R.useRef(null),ht=R.useRef(null),gt=R.useRef(null),Pn=R.useRef({}),Ht=R.useRef(null),gn=R.useRef(!1),vn=R.useRef(!1),Ke=R.useRef(new Map),on=R.useRef(!1),_t=R.useRef([]),ts=R.useRef(new WeakSet);nl(n,e,t=>{const{activePageKey:s,rawSections:i,parsedSections:c,selectedSectionIndex:d}=Se.current,v=new Set;s&&v.add(s);for(const f of[Tt.current?.sectionIndex,d]){const _=f==null?void 0:i[f],D=f==null?void 0:c[f],A=_&&D?.isSavedBlock?ys(_,D):null;A&&v.add(A)}if([...v].some(f=>t.has(f))){for(const f of[$,ht,gt])f.current&&clearTimeout(f.current),f.current=null;Tt.current=null,Ke.current.clear(),s&&t.has(s)&&(Pn.current={})}});const Se=R.useRef({rawSections:[],parsedSections:[],decofile:{},activePageKey:null,pageVariants:[],variantIndex:0,sectionVariantIndex:0,selectedSectionIndex:null}),[Ys,Js]=R.useState(0),[ia,la]=R.useState(0),ca=ju(xu(Re,{orgSlug:n,virtualMcpId:e,branch:r}),V[0]?.blockKey??null,V[0]?wu(Le(V[0].plan.theirs)):null),[ua,da]=R.useState(null),ns=sl(n,e).epoch,[fa,ma]=R.useState(ns);if(!a||Q||Z)return o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(hi,{className:"size-5 text-muted-foreground"})});if(!g||!x)return o.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:p("sectionsEditor.sectionsEditor.couldNotLoadSiteData")});const pa=vl(g,x),ne=!!m,_e=ne?null:yl(pa,u,y),C=ne?m:_e?.key??null,Mn=ne&&m?g[m]:void 0,Qs=ne&&m&&Mn?xl(m,Mn):ne&&m?m:"",Wt=!ne&&C&&g[C]?g[C]:null,ss=He&&g&&x&&C&&_e?Zr(g,{kind:"page",pageKey:C,pageName:String(_e.name??""),path:String(_e.path??"")},x):null,ha=He?Wt?.seo:void 0,Dn=Ls!==void 0?Ls:ha,ga=He?Ci(Dn):void 0,Xs=ss?.seoTypeOptions??[],Zs=He&&x?Ni(x):"",rs=Zo??ga??{},In=He&&ss?pc(rs,ss):null,er=He&&In&&Ti(Dn)?qn(In,x):null,tr=He?Vi(g,x)?.seoData:void 0,Te=ne?[{label:"Default",sections:[{__resolveType:m}]}]:Fo(Wt?.sections,g??{},j),vt=Te.length>1,ve=Math.min(oe,Te.length-1),Fe=Te[ve],U=Fe?.sections??[],Ve=En(U,g,j),Kn=!ne&&bl(Wt?.sections,j);if(ne&&m&&Hs!==m){Ws(m);const t=U[0],s=Ve[0];if(t&&s){I(0),dt(0),F([]);const i=kt(t,s,g,j);i&&(M(i.data),O(i.resolveType),nt(null),Xe(null))}}!ne&&Hs!==null&&Ws(null),Se.current={rawSections:U,parsedSections:Ve,decofile:g??{},activePageKey:C,pageVariants:Te,variantIndex:ve,sectionVariantIndex:Qe,selectedSectionIndex:S};const va=()=>({multivariate:Kn,index:ve,variants:Te.map(t=>({rule:t.rule})),lazyValues:j&&Kn&&Ml(Wt?.sections?.variants?.[ve]?.value)}),os=(t,s)=>{if(!B)return;if(!C||!Kn||t.length<=1){B(null);return}const i={multivariate:!0,index:s,variants:t},c=j?jo(C,i):ko(C,i,g,x);B(c.length>0?c:null)},as=B&&C&&Kn&&vt&&!Q&&!Z?C:null;if(as!==ua&&(da(as),as)){const t=Te.map(i=>({rule:i.rule})),s=ve;queueMicrotask(()=>os(t,s))}const qt=(t,s,i)=>{if(!B)return;if(!C){B(null);return}const c=va(),d=j?jo(C,c):ko(C,c,g,x);if(!t||s<0){B(d.length>0?d:null);return}const v={pageKey:C,page:c,sectionIndex:s,sectionLazy:Ve[s]?.isLazy??!1,mvObj:t,selectedVariantIndex:i},f=j?yc(v):xc({...v,decofile:g,meta:x}),_=j?bc(d,f):[...d,...f];B(_.length>0?_:null)},wt=(t,s,i,c=S??-1,d=!1)=>{const v=ot(t,s);if(!v){M(null),O(null),nt(null),Xe(null),d&&qt(null,c,i);return}const _=Es(v,re)[i];if(!_){M(null),O(null),nt(null),Xe(null),d&&qt(null,c,i);return}const D=Lo(_.value,g);M(D?.data??null),O(D?.resolveType??null);const{resolveType:A,formValue:T}=Jt(_.rule,g,x??void 0);nt(A),Xe(T),d&&qt(v,c,i)},yn=t=>{ze(null),G(t),I(null),M(null),O(null),F([]);const s=Te[t]?.rule,{resolveType:i,formValue:c}=Jt(s,g??{},x??void 0);be(i),de(c),os(Te.map(d=>({rule:d.rule})),t)},nr=(t,s)=>{const i=U[t],c=Ve[t];if(!i||!c)return!1;const d=c.isMultivariate?ot(i,c)?.variants?.length??0:0,v=s<d?s:0;if(I(t),dt(v),F([]),K(f=>f+1),c.isMultivariate)wt(i,c,v,t);else{const f=kt(i,c,g,j);f?(M(f.data),O(f.resolveType)):(M(null),O(null)),nt(null),Xe(null)}return!0},sr=b?.index;if(b!==void 0&&(b?.seq??null)!==Ie&&(ke(b?.seq??null),typeof sr=="number"&&nr(sr,0)),$e&&(ne?Mn:Wt)){const t=$e.pageVariant,s=!ne&&t!==void 0&&t<Te.length;if(s&&t!==ve)yn(t);else{qe(null);const{section:i,variant:c}=$e;if(ne)c!==void 0&&(Ge(c),F([]),K(d=>d+1));else if(i!==void 0&&nr(i,c??0)){const d=U[i],v=Ve[i],f=v.isMultivariate?ot(d,v):null;f&&c!==void 0&&queueMicrotask(()=>qt(f,i,c))}else s&&yn(t)}}if(ns!==fa){ma(ns);const t=$.current!==null||Ke.current.size>0||gt.current!==null||ht.current!==null||X.isPending||pn.isPending||V.length>0,s=S!==null&&Co(De.current,document.activeElement);if(!t&&s&&(on.current=!0),!t&&!s&&S!==null){const i=U[S],c=Ve[S];if(F([]),K(d=>d+1),!i||!c)I(null),M(null),O(null);else if(c.isMultivariate)wt(i,c,Qe,S);else{const d=kt(i,c,g,j);M(d?.data??null),O(d?.resolveType??null)}}!t&&He&&(mn(null),Tn(void 0),tn(i=>i+1))}if(Ys!==ia){la(Ys);const t=S!==null?U[S]:null,s=S!==null?Ve[S]:null;if(t&&s&&S!==null)if(F([]),K(i=>i+1),s.isMultivariate)wt(t,s,Qe,S);else{const i=kt(t,s,g,j);M(i?.data??null),O(i?.resolveType??null)}}const ft=V[0];if(ft){const{formBase:t,target:s}=ft,i=Mo(g,s,j),c=t.sectionIndex,d=i.rawSections.length===t.sectionCount?js(i.rawSections[c],i.parsedSections[c],s.sectionVariantIndex,g,j):null,v=$c(ft,d,f=>Ro(t,f));if(v){const _=[{...ft,...v,changedAgain:!0},...V.slice(1)];_t.current=_,J(_)}}const xn={orgSlug:n,virtualMcpId:e,branch:r,threadId:E,previewUrl:j?void 0:l??void 0,siteSlug:ue},Fn=xe&&x?qn(xe,x):null,mt=(t,s)=>{if(!C)return;$.current&&(clearTimeout($.current),$.current=null),Ke.current.clear(),gt.current&&(clearTimeout(gt.current),gt.current=null),ht.current&&(clearTimeout(ht.current),ht.current=null);const i=cn(g,C,t,ve,Te);X.mutate({blockKey:C,data:i},{onSuccess:()=>s?.onSuccess?.()??h?.(),onError:c=>{s?.onError?.(),X.reportError(c)}})},Gt=()=>{H?.(null),I(null),Nn(!1),M(null),O(null),dt(0),Xe(null),nt(null),F([]),K(t=>t+1)},rr=()=>Co(De.current,document.activeElement),is=(t=p("sectionsEditor.sectionsEditor.blockChangedElsewhere"))=>{if($.current&&(clearTimeout($.current),$.current=null),Ke.current.clear(),Tt.current=null,ae.error(t,{id:Po}),rr()){on.current=!0;return}Js(s=>s+1)},or=()=>{!on.current||rr()||_t.current.length>0||$.current!==null||gn.current||vn.current||Ke.current.size>0||(on.current=!1,Js(t=>t+1))},ar=()=>{on.current&&setTimeout(or,0)},ir=t=>ol(qs,Gs,t),lr=t=>{Ke.current.size!==0&&setTimeout(()=>{if(gn.current||vn.current)return;const s=[...Ke.current.values()];Ke.current.clear();for(const i of s)i()},t)},ya=t=>{const{activePageKey:s,variantIndex:i,sectionVariantIndex:c}=Se.current,d=Ht.current;return{formBase:d?.sectionIndex===t&&d.variantIndex===c?d:null,pageKey:s,global:ne,pageVariantIndex:i,sectionVariantIndex:c,schema:Fn}},bn=t=>{_t.current=t,J(t)},xa=t=>{const s=_t.current,i=s.findIndex(v=>v.formBase===t.formBase),c=i>=0?s[i]:void 0,d=c?s.with(i,{...t,choices:Ms(c.plan,c.choices,t.plan),fresh:Yo(c.plan,t.plan,c.fresh),changedAgain:c.changedAgain||Le(c.plan.theirs)!==Le(t.plan.theirs)}):[...s,{...t,changedAgain:ts.current.has(t.formBase)}];bn(d)},cr=(t,s)=>{const i=_t.current,c=i.findIndex(f=>f.formBase===t),d=i[c];if(!d)return!1;if(Le(d.plan.mine)===Le(s))return!0;const v=Vs({...d.plan,mine:s});if(v.pointers.length===0){const f=i.filter(_=>_!==d);return bn(f),!1}return bn(i.with(c,{...d,plan:v,choices:Ms(d.plan,d.choices,v)})),!0},ba=t=>{const s=Se.current;return s.selectedSectionIndex===t.formBase.sectionIndex&&s.activePageKey===t.target.pageKey&&s.variantIndex===t.target.pageVariantIndex&&s.sectionVariantIndex===t.target.sectionVariantIndex},Sa=()=>{const t=_t.current[0];if(!t)return null;const{formBase:s,target:i}=t;$.current&&Tt.current?.sectionIndex===s.sectionIndex&&Tt.current.sectionVariantIndex===i.sectionVariantIndex&&(clearTimeout($.current),$.current=null,Tt.current=null),Ke.current.delete(`${i.pageKey}:${s.sectionIndex}:${i.sectionVariantIndex}`);const c=s.emitted;return c&&typeof c=="object"&&!cr(s,c)&&Sn(c,s.sectionIndex,0,i),_t.current[0]??null},_a=()=>{const t=_t.current[0],s=Sa();if(!s||!t||s.formBase!==t.formBase||s.plan.pointers.some(v=>!t.plan.pointers.includes(v)))return;const i=Oc(s.plan,s.choices);bn(_t.current.slice(1));const{formBase:c,target:d}=s;c.base=s.plan.theirs,c.version=void 0,c.emitted=i,ts.current.add(c),(Ht.current===c||ba(s))&&(Ht.current=c,M(i),K(v=>v+1)),Sn(i,c.sectionIndex,0,d)},wa=t=>{const[s,...i]=_t.current;s&&bn([{...s,choices:t},...i])},Sn=(t,s,i=0,c)=>{const d=c??ya(s),v=d.sectionVariantIndex,f=d.formBase,_=Tt.current;$.current&&(clearTimeout($.current),$.current=null,_&&(_.sectionIndex!==s||_.sectionVariantIndex!==v)&&_.write());const D=`${d.pageKey}:${s}:${v}`,A=()=>{if(gn.current||vn.current){Ke.current.set(D,A);return}const T=typeof t=="function"?t():t;if(f&&cr(f,T))return;const P=Se.current.decofile,{rawSections:se,parsedSections:le,pageVariants:Be,variantIndex:we}=Mo(P,d,j),Pe=d.pageKey,Y=se[s];if(!Y)return;const ce=le[s];if(!ce)return;const Me=f?.base,We=js(Y,ce,v,P,j),xt=!!Me&&!!We&&qo(Me,We)&&!(f&&Ro(f,We));if(xt&&Me&&We){if(Go(Me,We)){is(p("sectionsEditor.sectionsEditor.sectionReplacedElsewhere"));return}const je=ce.isSavedBlock?"here":Fc(Me,se.map((Ee,It)=>js(Ee,le[It],v,P,j)),s,f?.sectionCount??se.length);if(je==="unknown"){is(p("sectionsEditor.sectionsEditor.sectionReplacedElsewhere"));return}if(typeof je=="number"&&f){f.sectionCount=se.length,f.sectionIndex=je,Ht.current===f&&I(je),Sn(T,je,i,d);return}}const lt=xt&&Me&&We?Vs({ancestor:Me,mine:T,theirs:We}):null;if(lt&&lt.pointers.length>0&&f){f.sectionCount=se.length,xa({plan:lt,formBase:f,target:d,sectionIndex:s,choices:Uo(lt),changedAgain:!1,blockKey:ce.isSavedBlock?ys(Y,ce):Pe,fresh:{}});return}const bt=lt?lt.merged:null,Dt=bt??T,Yr=Bc({merged:!!bt,tracked:f,current:Ht.current,saved:T});bt&&ae.info(p("sectionsEditor.sectionsEditor.blockMergedWithOthers"),{id:Po}),Yr&&f&&(f.emitted=bt,M(bt));const gs=Yr||!bt?Dt:T;f&&(f.base=gs,f.sectionCount=se.length,Ic(f,gs));const Jr={onSuccess:()=>{f&&ts.current.delete(f),h?.()},onError:je=>{if(f?.base===gs&&Me&&(f.base=Me),je instanceof rl){f&&(f.version=void 0),i<Eu?(Ke.current.delete(D),vn.current=!0,setTimeout(()=>{vn.current=!1,Sn(()=>{const Ee=f?.emitted;return Ee&&typeof Ee=="object"?Ee:T},s,i+1,d),Ke.current.delete(D),lr(jn)},Ru*2**i)):is();return}X.reportError(je)}},Qr=je=>{gn.current=!0;let Ee=!1;X.mutateAsync(je).then(()=>Jr.onSuccess(),It=>{Ee=!0,Jr.onError(It)}).finally(()=>{gn.current=!1,lr(Ee?jn:0),or()})};if(ce.isSavedBlock){const je=ys(Y,ce);if(!je)return;Qr({blockKey:je,data:Dt,...Me?{base:{value:bt?We:Me}}:{},rebaseOnConflict:!1,guard:Ao({formBase:f,rebased:!!bt,versionOf:ir})});return}if(!Pe)return;const Hn={...P[Pe]},Yt=[...se];if(ce.isMultivariate){const je=ot(Y,ce);if(!je||!Pe)return;const Ee=Kl(je,v,Dt);Yt[s]=Bt(Y,ce,Ee)}else if(ce.isHidden){const je=Is(Y.__resolveType),Ee=je?{...Y.section}:{...Y},It=Array.isArray(Ee.variants)?[...Ee.variants]:[];It[0]&&(It[0]=yo(Ee.__resolveType,It[0],Dt)),Ee.variants=It,je?Yt[s]={...Y,section:Ee}:Yt[s]=Ee}else ce.isLazy?Yt[s]={...Y,section:Dt}:Yt[s]=Dt;if(Be.length>1){const je=Hn.sections,Ee=[...je?.variants??[]];Ee[we]&&(Ee[we]=yo(je?.__resolveType,Ee[we],Yt)),Hn.sections={...je,variants:Ee}}else Hn.sections=Yt;Qr({blockKey:Pe,data:Hn,rebaseOnConflict:!1,guard:Ao({formBase:null,rebased:!1,versionOf:ir})})};Tt.current={sectionIndex:s,sectionVariantIndex:v,write:A},$.current=setTimeout(()=>{$.current=null,A()},jn)},ja=t=>{on.current=!1,I(t),dt(0),F([]),K(d=>d+1);const s=U[t],i=Ve[t];if(H?.(i?.isSavedBlock?i.resolveType??null:null),!s||!i)return;if(i.isMultivariate){wt(s,i,0,t);return}const c=kt(s,i,g,j);if(!c){M(null),O(null),nt(null),Xe(null),qt(null,t,0);return}M(c.data),O(c.resolveType),nt(null),Xe(null),qt(null,t,0)},ur=t=>{const s=t;S!==null&&(Ht.current=Kc(Ht.current,{sectionIndex:S,variantIndex:Se.current.sectionVariantIndex,shown:he,next:s,sectionCount:Se.current.rawSections.length})),M(s),S!==null&&Sn(s,S)},ls=t=>{if(!C||!g||!x||!_e)return;const s={kind:"page",pageKey:C,pageName:String(_e.name??""),path:String(_e.path??"")},i=Zr(g,s,x);i&&pn.save(C,()=>{const c=qs.getQueryData(Ko.decofile(Gs))?.[C];if(!c||typeof c!="object"||c===null||Array.isArray(c))return null;const d={...c,...Pn.current};return Pn.current={},t?.raw!==void 0?hc(d,t.raw,x):t?.inner!==void 0?gc(s,i,d,t.inner):d})},dr=(t,s)=>{C&&(Pn.current[t]=s,ls())},ka=(t,s)=>{if(!C)return;const i=Yn([...U],t,s);S!==null&&(S===t?I(s):t<S&&s>=S?I(S-1):t>S&&s<=S&&I(S+1)),mt(i)},Ea=t=>{if(!C)return;const s=U.filter((i,c)=>c!==t);S===t?Gt():S!==null&&S>t&&I(S-1),mt(s)},Ra=t=>{if(!C)return;const s=U[t];if(!s)return;const i=[...U];i.splice(t+1,0,Hi(s)),S!==null&&S>t&&I(S+1),mt(i)},Aa=t=>{if(!C)return;const s=U[t],i=Ve[t];if(!s||!i)return;const c=i.isHidden?Cl(s,j):Nl(s,x);if(!c)return;const d=[...U];d[t]=c,S===t&&Gt(),mt(d)},Ca=t=>{if(!C)return;const s=U[t],i=Ve[t];if(!s||!i||i.isMultivariate)return;const c=Al(s);if(!c)return;const d=[...U];d[t]=c,S===t&&Gt(),mt(d)},Na=t=>{if(!C)return;const s=U[t],i=Ve[t];if(!s||!i?.isSavedBlock)return;const c=kt(s,i,g,j);if(!c?.data)return;const{name:d,...v}=c.data,f=[...U];i.isLazy?f[t]={...s,section:v}:f[t]=v,S===t&&Gt(),mt(f)},Ta=t=>{if(!C)return;const s=[...U,{__resolveType:t.resolveType}],i=s.length-1;mt(s,{onError:()=>{Se.current.selectedSectionIndex===i&&Gt()}}),Zt(!1),I(i),dt(0),F([]),K(f=>f+1);const c=s[i],d=En(s,g,j)[i];if(!c||!d)return;if(d.isMultivariate){wt(c,d,0);return}const v=kt(c,d,g,j);if(!v){M(null),O(null),nt(null),Xe(null);return}M(v.data),O(v.resolveType),nt(null),Xe(null)},fr=t=>{Rn.current=t.append,Zt(!0)},Va=t=>{const s=Rn.current;if(!s){Ta(t);return}s({__resolveType:t.resolveType}),Zt(!1),Rn.current=null},mr=t=>{if(S===null)return;const s=U[S],i=Ve[S];!s||!i?.isMultivariate||(dt(t),F([]),K(c=>c+1),wt(s,i,t,S,!0))},Pa=t=>{if(S===null||!C)return;const s=U[S],i=Ve[S];if(!s||!i?.isMultivariate)return;const c=ot(s,i);if(!c)return;const d=El(c,t);if(!d){ae.error(p("sectionsEditor.sectionsEditor.cannotDeleteOnlyVariant"));return}const v=[...U];v[S]=Bt(s,i,d);const f=d.variants;let _=Qe;t===Qe?_=Math.min(t,f.length-1):t<Qe&&(_=Qe-1),dt(_),F([]),K(D=>D+1),wt(v[S],i,_),mt(v)},Ma=t=>{if(S===null||!C)return;const s=U[S],i=Ve[S];if(!s||!i?.isMultivariate)return;const c=ot(s,i);if(!c)return;const d=Rl(c,t,j),v=[...U];v[S]=Bt(s,i,d);const f=vo(c.variants??[],t,j);dt(f),F([]),K(_=>_+1),wt(v[S],i,f,S,j),mt(v)},Da=(t,s)=>{if(S===null||!C||t===s)return;const i=U[S],c=Ve[S];if(!i||!c?.isMultivariate)return;const d=ot(i,c);if(!d)return;const v=jl(d,t,s),f=[...U];f[S]=Bt(i,c,v);let _=Qe;Qe===t?_=s:t<Qe&&s>=Qe?_=Qe-1:t>Qe&&s<=Qe&&(_=Qe+1),dt(_),wt(f[S],c,_,S,j),mt(f)},_n=t=>{const s=t??S;if(s===null||!C)return;const i=U[s],c=Ve[s];if(!i||!c)return;const d=Sl(i,c,void 0,x,j);if(!d){ae.error(p("sectionsEditor.sectionsEditor.sectionCannotHaveVariants"));return}const v=[...U];v[s]=d.section;const f=En(v,g,j)[s];if(!f?.isMultivariate){ae.error(p("sectionsEditor.sectionsEditor.couldNotAddVariant"));return}I(s),dt(d.newVariantIndex),F([]),K(_=>_+1),wt(d.section,f,d.newVariantIndex,s,j),mt(v)},pr=()=>{if(S===null||!C)return;const t=U[S],s=Ve[S];if(!t||!s?.isMultivariate)return;const i=ot(t,s);if(!i)return;const c=kl(t,s,i);if(!c){ae.error(p("sectionsEditor.sectionsEditor.couldNotRemoveVariants"));return}const d=[...U];d[S]=c;const v=En(d,g,j)[S];if(!v)return;dt(0),nt(null),Xe(null),F([]),K(_=>_+1);const f=kt(c,v,g,j);f?(M(f.data),O(f.resolveType)):(M(null),O(null)),qt(null,S,0),mt(d)},Ia=async t=>{if(Je===null||!C)return;const s=Un(t,g,x);if(s){ae.error(s);return}const i=U[Je],c=Ve[Je];if(!i||!c)return;const d=kt(i,c,g,j);if(!d){ae.error(p("sectionsEditor.sectionsEditor.sectionCannotBeSavedAsGlobal"));return}const v={...d.data,name:t};try{await X.mutateAsync({blockKey:t,data:v});const f=[...U];f[Je]={__resolveType:t},await X.mutateAsync({blockKey:C,data:cn(g,C,f,ve,Te)}),S===Je&&Gt(),ie(null),ae.success(p("sectionsEditor.sectionsEditor.savedGlobalBlock",{blockId:t})),h?.()}catch(f){ae.error(p("sectionsEditor.sectionsEditor.failedToSaveGlobalBlock"),{description:Kt(p,Ft(f))})}},hr=Fe?.rule;if(vt&&S===null&&ge===null&&hr){const{resolveType:t,formValue:s}=Jt(hr,g??{},x??void 0);be(t),de(s)}const an=x?Pi(x):[],cs=x&&g?Mi(x,g):[],Ut=j&&x&&g?ll(x,g):[],us=(t,s)=>{if(Ut.length===0)return;const i=wl(t);return{kinds:Ut,selected:i,campaignPrefill:cl(t),onPick:s}},gr=!ne&&!!(Ce&&x&&g),vr=ge&&x?qn(ge,x):null,yt=()=>{ht.current&&(clearTimeout(ht.current),ht.current=null),gt.current&&(clearTimeout(gt.current),gt.current=null)},jt=async(t,s)=>{if(!(Il(s,t,x)>0))try{await Vn.mutateAsync({blockKey:t})}catch(i){ae.error(p("sectionsEditor.sectionsEditor.couldNotDeleteMatcherBlock"),{description:Kt(p,Ft(i))})}},yr=t=>{ht.current&&clearTimeout(ht.current),ht.current=setTimeout(()=>{const{activePageKey:s,decofile:i,variantIndex:c}=Se.current;if(!s)return;const d={...i[s]},v={...d.sections},f=[...v.variants??[]],_=f[c],D=_?.rule;if(Qt(D,i,x)){const A=D?.__resolveType??"",T=i[A],P=typeof T?.name=="string"?T.name:A,{__resolveType:se,...le}=t;X.mutate({blockKey:A,data:Ot(se??"",le,P)},{onSuccess:()=>h?.(),onError:X.reportError});return}_&&(f[c]={..._,rule:t}),d.sections={...v,variants:f},X.mutate({blockKey:s,data:d},{onSuccess:()=>h?.(),onError:X.reportError})},jn)},xr=t=>{be(t);const s=t?ho(t,x):{__resolveType:go(x)};de(t?s:{}),yr(s)},br=t=>{const s=t;de(s);const i=ge?{__resolveType:ge,...s}:{...s};yr(i)},Bn=async(t,s,i)=>{const c=dl(s,t);if(!c.ok)return c.reason==="conflict"&&ae.info(t.kind==="experiments"?p("sectionsEditor.namedRulePicker.conflictTests"):p("sectionsEditor.namedRulePicker.conflictCampaigns"),mo),null;const d={};if(i){const v=i(c.rule);if(!v)return null;d[v.blockKey]=v.data}return c.blockWrite&&(d[c.blockWrite.blockKey]=c.blockWrite.block),Object.keys(d).length>0&&!(await Us.apply({writes:d})).ok?null:(c.blockWrite&&ae.success(t.kind==="experiments"?p("sectionsEditor.namedRulePicker.createdTest",{name:t.name.trim()}):p("sectionsEditor.namedRulePicker.createdCampaign",{name:t.name.trim()}),{...mo,description:p("sectionsEditor.namedRulePicker.createdHint")}),{rule:c.rule,projected:{...s,...d}})},Sr=Ut.length>0?{kinds:Ut,prepare:async t=>(await Bn(t,Se.current.decofile,void 0))?.rule??null,ensureBlock:async t=>{const s=Vl(Se.current.decofile,t);return s.kind==="saved"?!0:s.kind==="conflict"?!1:(await Us.apply({writes:{[Pl(t).blockKey]:s.block}})).ok}}:null,_r=async t=>{yt();const{activePageKey:s,decofile:i,variantIndex:c}=Se.current;if(!s)return;let d=null;const v=await Bn(t,i,D=>{const A=i[s],T=A?.sections;if(!T||typeof T!="object"||Array.isArray(T))return null;const P=T;if(!Array.isArray(P.variants))return null;const se=[...P.variants],le=se[c];return le?(d=St(le.rule,i,x),se[c]={...le,rule:D},{blockKey:s,data:{...A,sections:{...P,variants:se}}}):null});if(!v)return;const{resolveType:f,formValue:_}=Jt(v.rule,v.projected,x??void 0);be(f),de(_),d&&await jt(d,v.projected),h?.()},wr=async t=>{yt();const{activePageKey:s,decofile:i,variantIndex:c}=Se.current;if(!s)return;const d=i[s],v=d?.sections;if(!v||typeof v!="object"||Array.isArray(v))return;const f=v;if(!Array.isArray(f.variants))return;const _=[...f.variants],D=_[c];if(!D)return;const A=St(D.rule,i,x),T=dn(t);_[c]={...D,rule:T};const P={...i,[s]:{...d,sections:{...f,variants:_}}},{resolveType:se,formValue:le}=Jt(T,P,x??void 0);be(se),de(le);try{await X.mutateAsync({blockKey:s,data:P[s]}),A&&A!==t&&await jt(A,P),h?.()}catch(Be){ae.error(p("sectionsEditor.sectionsEditor.couldNotApplySavedRule"),{description:Kt(p,Ft(Be))})}},jr=t=>{gt.current&&clearTimeout(gt.current);const{selectedSectionIndex:s,sectionVariantIndex:i}=Se.current;s!==null&&(gt.current=setTimeout(()=>{const{rawSections:c,parsedSections:d,decofile:v,activePageKey:f,pageVariants:_,variantIndex:D}=Se.current;if(!f)return;const A=c[s],T=d[s];if(!A||!T?.isMultivariate)return;const P=ot(A,T);if(!P)return;const le=(P.variants??[])[i]?.rule;if(Qt(le,v,x)){const Y=le?.__resolveType??"",ce=v[Y],Me=typeof ce?.name=="string"?ce.name:Y,{__resolveType:We,...xt}=t;X.mutate({blockKey:Y,data:Ot(We??"",xt,Me)},{onSuccess:()=>h?.(),onError:X.reportError});return}const Be=Ss(P,i,t),we=[...c];we[s]=Bt(A,T,Be);const Pe=cn(v,f,we,D,_);X.mutate({blockKey:f,data:Pe},{onSuccess:()=>h?.(),onError:X.reportError})},jn))},Ka=t=>{nt(t);const s=t?ho(t,x):{__resolveType:go(x)};Xe(t?s:{}),jr(s)},Fa=t=>{const s=t;Xe(s);const i=nn?{__resolveType:nn,...s}:{...s};jr(i)},Ba=async t=>{yt();const{selectedSectionIndex:s,sectionVariantIndex:i,rawSections:c,parsedSections:d,decofile:v,activePageKey:f,pageVariants:_,variantIndex:D}=Se.current;if(s===null||!f)return;let A=null;const T=await Bn(t,v,le=>{const Be=c[s],we=d[s];if(!Be||!we?.isMultivariate)return null;const Pe=ot(Be,we);if(!Pe)return null;const Y=Pe.variants??[];A=St(Y[i]?.rule,v,x);const ce=[...c];return ce[s]=Bt(Be,we,Ss(Pe,i,le)),{blockKey:f,data:cn(v,f,ce,D,_)}});if(!T)return;const{resolveType:P,formValue:se}=Jt(T.rule,T.projected,x??void 0);nt(P),Xe(se),A&&await jt(A,T.projected),h?.()},Oa=async t=>{yt();const{selectedSectionIndex:s,sectionVariantIndex:i,rawSections:c,parsedSections:d,decofile:v,activePageKey:f,pageVariants:_,variantIndex:D}=Se.current;if(s===null||!f)return;const A=c[s],T=d[s];if(!A||!T?.isMultivariate)return;const P=ot(A,T);if(!P)return;const se=P.variants??[],le=St(se[i]?.rule,v,x),Be=dn(t),we=Ss(P,i,Be),Pe=[...c];Pe[s]=Bt(A,T,we);const Y=cn(v,f,Pe,D,_),ce={...v,[f]:Y},{resolveType:Me,formValue:We}=Jt(Be,ce,x??void 0);nt(Me),Xe(We);try{await X.mutateAsync({blockKey:f,data:Y}),le&&le!==t&&await jt(le,ce),h?.()}catch(xt){ae.error(p("sectionsEditor.sectionsEditor.couldNotApplySavedRule"),{description:Kt(p,Ft(xt))})}};if(!ne&&!_e)return o.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:p("sectionsEditor.sectionsEditor.noPageFound",{currentPath:u})});if(ne&&!Mn)return o.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:p("sectionsEditor.sectionsEditor.globalBlockNotFound")});const Oe=S!==null?Ve[S]??null:null,kr=S!==null?U[S]:null,Er=kr&&Oe?.isMultivariate?ot(kr,Oe):null,Vt=Er?Es(Er,re):[],On=Math.min(Qe,Math.max(Vt.length-1,0)),Rt=Vt[On]??null,Pt=Oe?.isMultivariate===!0,ds=S!==null&&Oe!==null,Mt=ds&&(Pt||!!(Fn&&he)),La=Mt&&!ne&&Oe?.isSavedBlock===!0,pt=ne||La,Rr=ne?Qs:Oe?.label??"",$a=nn&&x?qn(nn,x):null,Ar=(t,s)=>s&&q?`${t} · ${s}`:t,Cr=Oe?Oe.variantOf??Oe.label:"",za=(()=>{const t=Pt&&Rt?Rt.label:null;return t?q?[Ar(Cr,t)]:[Oe.label,t]:[Oe?.label??""]})(),fs=Ar(_e?.name??"",vt?Fe?.label:null),Ln=Mt&&(!ne||ee.length>0)?ne?[Qs,...ee]:[fs,...za,...ee]:[],Nr=He&&_e?[_e.name,"SEO",...$s]:[],Tr=p("sectionsEditor.pageVariantTabs.variantsLabel"),Vr=en&&_e?[_e.name,Tr]:$t&&_e&&Oe?[fs,Cr,Tr]:[],$n=Vr.length>0?Vr:Nr.length>0?Nr:pt?Ln.length>0?Ln:[Rr]:Ln.length>0?Ln:[fs],Pr=ds&&!Pt&&!Oe?.isHidden&&!!C,Ha=pt||!ne&&vt&&!!Fe||Pr,Wa=ds&&!Pt&&!ne&&ee.length===0&&!!Oe&&Oo(Oe)&&!!C,qa=q&&Mt&&!$t&&Pt&&ee.length===0&&!!Rt,Mr=q&&ee.length>0?eo(ee[ee.length-1]):null,Ga=ee.length>1?eo(ee[ee.length-2]):null,Dr=pt?Rr:Mt?Oe?.label??"":_e?.name??"",Ua=en||$t?p("sectionsEditor.pageVariantTabs.variantsLabel"):He?p("sectionsEditor.panelSections.seo"):Mr??Dr,Ir=$t?Oe?.variantOf??Oe?.label??"":en||He?_e?.name??"":Mr?Ga??Dr:pt?p("sectionsEditor.sectionsEditor.globalSectionSubtitle"):Mt?_e?.name??"":_e?.path??"",ms=!en&&!$t&&!He&&!Mt&&!pt,Ya=!q&&!He&&!ne&&Pt&&ee.length===0,wn=()=>{if(!C)return;yt(),$.current&&(clearTimeout($.current),$.current=null),Ke.current.clear();const t=g[C],s=_l(t.sections,U,x,j);if(!s)return;const{sections:i,newVariantIndex:c}=s;X.mutate({blockKey:C,data:{...t,sections:i}},{onSuccess:()=>{G(c),I(null),M(null),O(null),F([]),de(null),be(null)},onError:X.reportError})},zn=(t,s,i)=>{if(!C)return;yt(),$.current&&(clearTimeout($.current),$.current=null),Ke.current.clear();const c=g[C],d=c.sections;if(!d||typeof d!="object"||Array.isArray(d))return;const v=d;if(!Array.isArray(v.variants))return;const f=t([...v.variants]);if(!f)return;const _=Dl(v,f),D={...g,[C]:{...c,sections:_}};X.mutate({blockKey:C,data:D[C]},{onSuccess:()=>{s?.();const A=typeof i=="string"?[i]:i??[];(async()=>{for(const T of A)await jt(T,D)})()},onError:X.reportError})},Kr=(t,s)=>{if(t===s)return;let i=ve;ve===t?i=s:t<ve&&s>=ve?i=ve-1:t>ve&&s<=ve&&(i=ve+1),G(i);const c=Yn(Te.map(d=>({rule:d.rule})),t,s);os(c,i),zn(d=>Yn(d,t,s))},Fr=t=>{const s=Te[t]?.rule,i=St(s,g??{},x??void 0);zn(c=>c.length<=1?null:(c.splice(t,1),c),()=>{Te.length-1===1?G(0):t<ve?G(ve-1):t===ve&&G(Math.max(0,t-1)),I(null),M(null),O(null),F([]),de(null),be(null)},i)},Ja=()=>{const t=Te.map((s,i)=>({variant:s,index:i})).filter(({variant:s})=>!Tl(s.rule)).map(({variant:s})=>St(s.rule,g??{},x??void 0)).filter(s=>!!s);zn(s=>{const i=Fl({variants:s}),c=s[i];return c?[{...c,rule:Bl(x)}]:null},()=>{G(0),I(null),M(null),O(null),F([]),de(null),be(null),Cn(!1)},t)},Br=t=>{let s=t+1;zn(i=>(s=vo(i,t,j),Ol(i,t,j)),()=>{G(s),I(null),M(null),O(null),F([]),de(null),be(null)})},Qa=async(t,s)=>{yt(),$.current&&(clearTimeout($.current),$.current=null),Ke.current.clear();const i=Se.current.activePageKey,c=Se.current.decofile;if(!i)return;const d=c[i],v=d.sections;if(!v||typeof v!="object"||Array.isArray(v))return;const f=v;if(!Array.isArray(f.variants))return;const _=[...f.variants],D=_[t];if(!D?.rule||typeof D.rule!="object"){ae.error(p("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const A=D.rule,T=s.trim();rn(!0);try{if(!T){if(!Qt(A,c,x)){ze(null);return}const Pe=A.__resolveType??"";_[t]={...D,rule:Rs(A,c,x)};const Y={...c,[i]:{...d,sections:{...f,variants:_}}};await X.mutateAsync({blockKey:i,data:Y[i]}),await jt(Pe,Y),ze(null),h?.();return}const P=As(A,c,x);if(!P){ae.error(p("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(P.blockKey){await X.mutateAsync({blockKey:P.blockKey,data:Ot(P.resolveType,P.data,T)}),ze(null),h?.();return}const se=Gn(T),le=Un(se,c,x);if(le){ae.error(le);return}const Be=Ot(P.resolveType,P.data,T);let we=null;try{await X.mutateAsync({blockKey:se,data:Be}),we=se,_[t]={...D,rule:dn(se)},await X.mutateAsync({blockKey:i,data:{...d,sections:{...f,variants:_}}}),we=null}catch(Pe){throw we&&await Vn.mutateAsync({blockKey:we}).catch(()=>{}),Pe}ze(null),ae.success(p("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:T})),h?.()}catch(P){ae.error(p("sectionsEditor.sectionsEditor.failedToRenameVariant"),{description:Kt(p,Ft(P))})}finally{rn(!1)}},Xa=async(t,s)=>{yt(),$.current&&(clearTimeout($.current),$.current=null),Ke.current.clear();const{selectedSectionIndex:i,rawSections:c,parsedSections:d,decofile:v,activePageKey:f,pageVariants:_,variantIndex:D}=Se.current;if(i===null||!f)return;const A=c[i],T=d[i];if(!A||!T?.isMultivariate)return;const P=ot(A,T);if(!P)return;const se=P.variants??[],le=se[t];if(!le?.rule||typeof le.rule!="object"){ae.error(p("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const Be=le.rule,we=s.trim();rn(!0);const Pe=async Y=>{const ce={...P,variants:Y},Me=[...c];Me[i]=Bt(A,T,ce);const We=cn(v,f,Me,D,_);return await X.mutateAsync({blockKey:f,data:We}),{...v,[f]:We}};try{if(!we){if(!Qt(Be,v,x)){it(null);return}const lt=Be.__resolveType??"",bt=[...se];bt[t]={...le,rule:Rs(Be,v,x)};const Dt=await Pe(bt);await jt(lt,Dt),it(null),h?.();return}const Y=As(Be,v,x);if(!Y){ae.error(p("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(Y.blockKey){await X.mutateAsync({blockKey:Y.blockKey,data:Ot(Y.resolveType,Y.data,we)}),it(null),h?.();return}const ce=Gn(we),Me=Un(ce,v,x);if(Me){ae.error(Me);return}const We=Ot(Y.resolveType,Y.data,we);let xt=null;try{await X.mutateAsync({blockKey:ce,data:We}),xt=ce;const lt=[...se];lt[t]={...le,rule:dn(ce)},await Pe(lt),xt=null}catch(lt){throw xt&&await Vn.mutateAsync({blockKey:xt}).catch(()=>{}),lt}it(null),ae.success(p("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:we})),h?.()}catch(Y){ae.error(p("sectionsEditor.sectionsEditor.failedToRenameVariant"),{description:Kt(p,Ft(Y))})}finally{rn(!1)}},Or=async(t,s,i)=>{M(i);try{await X.mutateAsync({blockKey:t,data:i})}catch(c){throw M(d=>d===i?s:d),c}},Za={rename:async(t,s,i)=>{yt(),$.current&&(clearTimeout($.current),$.current=null),Ke.current.clear();const{activePageKey:c,decofile:d}=Se.current;if(!c)return;const v=Array.isArray(t.variants)?[...t.variants]:[],f=v[s],_=f?.rule&&typeof f.rule=="object"?f.rule:void 0,D=async T=>{const P={...t,variants:T};return await Or(c,t,P),{...d,[c]:P}},A=ku(_,i,d,x);if(A.kind!=="noop"){if(A.kind==="error"){ae.error(A.reason==="no-matcher-rule"?p("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"):A.reason==="unreadable-rule"?p("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"):A.message??p("sectionsEditor.sectionsEditor.failedToRenameVariant"));return}rn(!0);try{if(A.kind==="inline"){const P=[...v];P[s]={...f,rule:A.inlinedRule};const se=await D(P);await jt(A.blockKey,se),h?.();return}if(A.kind==="updateBlock"){await X.mutateAsync({blockKey:A.blockKey,data:A.blockData}),h?.();return}let T=null;try{await X.mutateAsync({blockKey:A.blockId,data:A.blockData}),T=A.blockId;const P=[...v];P[s]={...f,rule:A.reference},await D(P),T=null}catch(P){throw T&&await Vn.mutateAsync({blockKey:T}).catch(()=>{}),P}ae.success(p("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:i.trim()})),h?.()}catch(T){ae.error(p("sectionsEditor.sectionsEditor.failedToRenameVariant"),{description:Kt(p,Ft(T))})}finally{rn(!1)}}},selectGlobal:async(t,s,i)=>{yt(),$.current&&(clearTimeout($.current),$.current=null),Ke.current.clear();const{activePageKey:c,decofile:d}=Se.current;if(!c)return;const v=Array.isArray(t.variants)?[...t.variants]:[],f=v[s];if(!f)return;const _=St(f.rule,d,x);v[s]={...f,rule:dn(i)};const D={...t,variants:v},A={...d,[c]:D};try{await Or(c,t,D),_&&_!==i&&await jt(_,A),h?.()}catch(T){ae.error(p("sectionsEditor.sectionsEditor.couldNotApplySavedRule"),{description:Kt(p,Ft(T))})}},selectNamedRule:async(t,s,i)=>{yt(),$.current&&(clearTimeout($.current),$.current=null),Ke.current.clear();const{activePageKey:c,decofile:d}=Se.current;if(!c)return;let v=null,f=null;const _=await Bn(i,d,D=>{const A=Array.isArray(t.variants)?[...t.variants]:[],T=A[s];return T?(v=St(T.rule,d,x),A[s]={...T,rule:D},f={...t,variants:A},{blockKey:c,data:f}):null});!_||!f||(M(f),v&&await jt(v,_.projected),h?.())}},Lr=()=>{Gt()},$r=t=>{mn(t),ls({inner:t})},zr=t=>{Tn(t),ls({raw:t})},Hr=()=>{mn(null),zt([])},Wr=()=>tn(t=>t+1),qr=()=>{pn.flush(),fn(!1),mn(null),Tn(void 0),zt([]),tn(t=>t+1),N?.()},ei=()=>{Cn(!1),Nn(!1),I(null),fn(!0)},ti=()=>{He&&qr(),I(null),Cn(!0)},ni=()=>Nn(!0),ps=t=>{if(en&&t===0){Cn(!1);return}if($t&&t<2){Nn(!1),t===0&&I(null);return}if(He){if(t===0){qr();return}if(t===1){zt([]),tn(i=>i+1);return}zt($s.slice(0,t-1)),tn(i=>i+1);return}if(ne){F(ee.slice(0,t)),K(i=>i+1);return}if(t===0){Lr();return}if(t===1){F([]),K(i=>i+1);return}const s=!q&&Pt&&Rt?1:0;if(s===1&&t===2){F([]),K(i=>i+1);return}F(ee.slice(0,t-1-s))},hs=$n.length>1?o.jsx("button",{type:"button",onClick:()=>ps(Wi($n.length,{isMultivariateSectionTop:Ya})),title:p("sectionsEditor.sectionsEditor.back"),"aria-label":p("sectionsEditor.sectionsEditor.back"),className:me("shrink-0 inline-flex size-6 items-center justify-center rounded-[var(--studio-control-radius,var(--radius-md))] transition-colors",pt?"text-foreground/80 hover:bg-global-section/15":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:o.jsx(Ji,{className:"size-4"})}):null,si=pt||Mt||He?Ha&&o.jsxs("div",{className:me("border-b px-3 py-2.5",pt&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[!ne&&vt&&Fe&&o.jsxs("button",{type:"button",onClick:Lr,title:p("sectionsEditor.sectionsEditor.editingInVariant",{variant:Fe.label}),className:me("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",Ii),children:[o.jsx(Di,{rule:bs(Fe.rule,g??{},x??void 0),matchers:an}),o.jsx("span",{className:"max-w-[160px] truncate",children:Fe.label})]}),o.jsx("div",{className:"flex-1"}),pt&&o.jsxs(At,{children:[o.jsx(Ct,{asChild:!0,children:o.jsx("span",{className:"shrink-0 cursor-help",children:o.jsx(Qn,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),o.jsx(Nt,{side:"bottom",className:"max-w-[260px]",children:p("sectionsEditor.sectionsEditor.globalSectionTooltip")})]}),Pr&&o.jsx(Wn,{onClick:()=>_n()})]}),pt&&o.jsx("p",{className:"mt-1.5 py-1.5 pl-1 text-sm leading-snug text-foreground",children:p("sectionsEditor.sectionsEditor.globalSectionBanner")})]}):o.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2.5",children:[o.jsx("div",{className:"flex-1 min-w-0",children:o.jsx(to,{pageKey:C,initialName:_e.name,initialPath:_e.path,onFieldChange:dr,variant:"header"})}),o.jsxs(At,{children:[o.jsx(Ct,{asChild:!0,children:o.jsx(Et,{type:"button",variant:"ghost",size:"icon-sm","aria-label":p("sectionsEditor.sectionsEditor.editSeo"),className:"shrink-0",onClick:()=>fn(!0),children:o.jsx(co,{size:14})})}),o.jsx(Nt,{side:"bottom",children:p("sectionsEditor.sectionsEditor.editSeo")})]}),o.jsxs(At,{children:[o.jsx(Ct,{asChild:!0,children:o.jsx(Et,{type:"button",variant:"ghost",size:"icon-sm","aria-label":p("sectionsEditor.sectionsEditor.viewJson"),className:"shrink-0",onClick:()=>z&&C?z():es(!0),children:o.jsx(uo,{size:14})})}),o.jsx(Nt,{side:"bottom",children:p("sectionsEditor.sectionsEditor.viewJson")})]}),o.jsx(Wn,{onClick:wn})]}),ri=o.jsxs(o.Fragment,{children:[vt&&C&&o.jsx(no,{listKey:C,variants:Te,activeIndex:ve,decofile:g??{},meta:x,matchers:an,onSelect:yn,onReorder:Kr,onRename:ze,onDuplicate:Br,onDelete:Fr,onAdd:wn}),vt&&ge!==null&&o.jsx(so,{className:"mt-3",children:o.jsx("div",{className:me("space-y-3",sn&&"pointer-events-none opacity-50"),children:o.jsx(vs,{currentRt:ge,currentLabel:kn(Fe?.rule,g??{},re,x??void 0),currentGlobalKey:St(Fe?.rule,g??{},x??void 0)??void 0,matchers:an,globals:cs,onSelect:xr,onSelectGlobal:wr,named:us(Fe?.rule,_r),namedRow:xs(Fe?.rule,Ut),rule:Fe?.rule,schema:vr,formValue:Ye,onChange:br,formKey:`${ve}:${ge??""}`,formWrapperClassName:"space-y-3",meta:x??void 0,decofile:g,onSaveReferencedBlock:hn,sandbox:xn})})})]}),Gr=o.jsxs(o.Fragment,{children:[o.jsx(Ki,{listKey:`${C??""}:${S??""}`,variants:Vt.map((t,s)=>({index:s,label:t.label})),selectedIndex:On,onSelect:mr,onRename:it,onDuplicate:Ma,onDelete:Pa,onRemoveAll:pr,onReorder:Da,onAdd:()=>_n()}),o.jsx(so,{children:o.jsx(vs,{currentRt:nn??"",currentLabel:kn(Rt?.rule,g??{},re,x??void 0),currentGlobalKey:St(Rt?.rule,g??{},x??void 0)??void 0,matchers:an,globals:cs,onSelect:Ka,onSelectGlobal:Oa,named:us(Rt?.rule,Ba),namedRow:xs(Rt?.rule,Ut),rule:Rt?.rule,schema:$a,formValue:ea,onChange:Fa,formKey:`${S??"none"}:${On}:${nn??""}`,formWrapperClassName:"pt-1",meta:x??void 0,decofile:g,onSaveReferencedBlock:hn,sandbox:xn})})]}),Ur=o.jsx("div",{className:me(q?"px-2":"p-2 pt-3"),children:o.jsx(Pc,{listKey:`${C??""}-${ve}`,rawSections:U,sections:Ve,meta:x,decofile:g,selectedIndex:S,onSelect:ja,onReorder:ka,onDelete:Ea,onDuplicate:Ra,onMakeReusable:ie,onToggleHidden:Aa,onToggleLazy:Ae?Ca:void 0,onAddVariant:_n,onDetach:Na,onAddSection:()=>Zt(!0),canAddSection:gr})}),oi=o.jsxs("div",{className:"min-w-0 max-w-full space-y-4 overflow-x-hidden px-3",children:[C&&_e&&o.jsx(to,{pageKey:C,initialName:_e.name,initialPath:_e.path,onFieldChange:dr}),Wt&&C?o.jsx(wo,{rawSeo:Dn,innerSeo:rs,defaultResolveType:Zs,seoTypesLoading:j&&!x,seoSchema:er,activeResolveType:In,seoTypeOptions:Xs,formResetKey:zs,siteDefaultSeo:tr,onBreadcrumbChange:zt,onPersistRaw:zr,onInnerChange:$r,onClearForm:Hr,onBumpFormKey:Wr,asyncRenderAvailable:Ae}):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:p("sectionsEditor.sectionsEditor.seoSchemaNotFound")})]}),ai=o.jsx(un,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:o.jsx("div",{className:"mx-auto max-w-2xl",children:Wt&&C?o.jsx(wo,{rawSeo:Dn,innerSeo:rs,defaultResolveType:Zs,seoTypesLoading:j&&!x,seoSchema:er,activeResolveType:In,seoTypeOptions:Xs,formResetKey:zs,siteDefaultSeo:tr,onBreadcrumbChange:zt,onPersistRaw:zr,onInnerChange:$r,onClearForm:Hr,onBumpFormKey:Wr,asyncRenderAvailable:Ae}):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:p("sectionsEditor.sectionsEditor.seoSchemaNotFound")})})})},"editor-seo"),ii=o.jsxs(un,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[vt&&C&&o.jsx(no,{listKey:C,variants:Te,activeIndex:ve,decofile:g??{},meta:x,matchers:an,onSelect:yn,onReorder:Kr,onRename:ze,onDuplicate:Br,onDelete:Fr,onAdd:wn}),vt&&ge!==null&&o.jsxs("div",{className:me("px-3 border-b",An?"pt-3 pb-5 space-y-3":"py-2"),children:[o.jsxs("button",{type:"button",onClick:()=>Xo(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-accent","aria-expanded":An,children:[o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:p("sectionsEditor.sectionsEditor.variantRule")}),An?o.jsx(Gi,{className:"size-3.5 shrink-0 text-muted-foreground"}):o.jsx(Ui,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),An&&o.jsx("div",{className:me("space-y-3",sn&&"pointer-events-none opacity-50"),children:o.jsx(vs,{currentRt:ge,currentLabel:kn(Fe?.rule,g??{},re,x??void 0),currentGlobalKey:St(Fe?.rule,g??{},x??void 0)??void 0,matchers:an,globals:cs,onSelect:xr,onSelectGlobal:wr,named:us(Fe?.rule,_r),namedRow:xs(Fe?.rule,Ut),rule:Fe?.rule,schema:vr,formValue:Ye,onChange:br,formKey:`${ve}:${ge??""}`,formWrapperClassName:"space-y-3",meta:x??void 0,decofile:g,onSaveReferencedBlock:hn,sandbox:xn})})]}),Ur]},"editor-section-list");return o.jsx(Fi,{value:j,children:o.jsx(Bi,{children:o.jsxs("div",{className:"flex h-full min-w-0 w-full flex-col",children:[!q&&hs&&o.jsx("div",{className:"flex min-w-0 shrink-0 items-center gap-2 px-3 py-2",children:hs}),(q||$n.length>1)&&o.jsx(Oi,{crumbs:$n,onSelect:ps,onSelectRoot:()=>{pn.flush(),L?L():ps(0)}}),o.jsx("div",{className:"shrink-0",children:q?o.jsxs("div",{className:me("flex items-center gap-2 border-b px-3 py-2.5",pt&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[q&&hs,pt&&o.jsxs(At,{children:[o.jsx(Ct,{asChild:!0,children:o.jsx("span",{className:"shrink-0 cursor-help",children:o.jsx(Qn,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),o.jsx(Nt,{side:"bottom",className:"max-w-[260px]",children:p("sectionsEditor.sectionsEditor.globalSectionTooltip")})]}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[o.jsx("span",{className:"truncate text-sm font-semibold",children:Ua}),Ir&&o.jsx("span",{className:"truncate text-xs text-muted-foreground",children:Ir})]}),ms&&vt&&Fe&&o.jsx(ro,{variants:Te,activeIndex:ve,onSelect:yn,onManage:ti,onRemoveAll:Ja}),qa&&o.jsx(ro,{variants:Vt,activeIndex:On,onSelect:mr,onManage:ni,onRemoveAll:pr}),ms&&!vt&&o.jsx(Wn,{onClick:wn}),Wa&&o.jsx(Wn,{onClick:()=>_n()}),o.jsx(Li,{}),ms&&o.jsxs(o.Fragment,{children:[o.jsxs(At,{children:[o.jsx(Ct,{asChild:!0,children:o.jsx(Et,{type:"button",variant:"outline",size:"icon-sm","aria-label":p("sectionsEditor.sectionsEditor.editSeo"),className:"shrink-0",onClick:ei,children:o.jsx(co,{size:14})})}),o.jsx(Nt,{side:"bottom",children:p("sectionsEditor.sectionsEditor.editSeo")})]}),!z&&o.jsxs(At,{children:[o.jsx(Ct,{asChild:!0,children:o.jsx(Et,{type:"button",variant:"outline",size:"icon-sm","aria-label":p("sectionsEditor.sectionsEditor.viewJson"),className:"shrink-0",onClick:()=>es(!0),children:o.jsx(uo,{size:14})})}),o.jsx(Nt,{side:"bottom",children:p("sectionsEditor.sectionsEditor.viewJson")})]})]})]}):si}),ft&&o.jsx(Zc,{open:!0,fields:zc(ft.plan,ft.target.schema),choices:ft.choices,changedAgain:ft.changedAgain,author:ca,fresh:ft.fresh,onChoose:(t,s)=>wa({...ft.choices,[t]:s}),onApply:_a},Cu(ft.formBase)),$t?o.jsx(oo,{onAdd:()=>_n(),children:Gr},"editor-section-variants"):Mt?o.jsxs(un,{viewportRef:De,onBlur:ar,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[!q&&Pt&&Vt.length>0&&ee.length===0&&Gr,o.jsx(po,{value:Sr,children:o.jsx(ao,{value:ne&&j?Ue:null,children:o.jsx(io,{activeSchema:Fn,formValue:he,formResetKey:st,onFormChange:ur,onBreadcrumbChange:F,breadcrumbPath:ee,emptyMessage:p("sectionsEditor.sectionsEditor.noEditableFieldsForVariant"),meta:x,decofile:g,onSaveReferencedBlock:hn,sandbox:xn,previewBaseUrl:fe,onRequestAddSection:fr,onVariantMatcherOp:ne?Za:void 0})})})]},"editor-section-form"):ne?o.jsx(un,{viewportRef:De,onBlur:ar,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx(po,{value:Sr,children:o.jsx(ao,{value:ne&&j?Ue:null,children:o.jsx(io,{activeSchema:Fn,formValue:he,formResetKey:st,onFormChange:ur,onBreadcrumbChange:F,breadcrumbPath:ee,emptyMessage:p("sectionsEditor.sectionsEditor.noEditableFieldsForGlobalBlock"),meta:x,decofile:g,onSaveReferencedBlock:hn,sandbox:xn,previewBaseUrl:fe,onRequestAddSection:fr})})})},"editor-global-block"):He?q?o.jsx(un,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"p-3",children:oi})},"editor-seo"):ai:en?o.jsx(oo,{onAdd:wn,children:ri},"editor-variants"):q?o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[o.jsx(un,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"py-2",children:Ur})}),o.jsx("div",{className:"shrink-0 border-t p-2",children:o.jsx(Ts,{canAddSection:gr,onAddSection:()=>Zt(!0)})})]},"editor-section-list"):ii,o.jsx($i,{open:Je!==null,onOpenChange:t=>{t||ie(null)},defaultBlockId:Je!==null?Gn(Ve[Je]?.label??""):"",isPending:X.isPending,onSubmit:Ia}),Ce&&o.jsx(rc,{open:Qo,onOpenChange:t=>{Zt(t),t||(Rn.current=null)},meta:x,decofile:g,previewBaseUrl:fe,onSelect:Va}),Fs&&C&&g&&o.jsx(pl,{open:Fs,onOpenChange:es,pageKey:C,decofile:g}),Ne!==null&&o.jsx(lo,{open:!0,initialName:Qt(Te[Ne]?.rule,g??{},x??void 0)?kn(Te[Ne]?.rule,g??{},re,x??void 0):"",autoLabel:re(bs(Te[Ne]?.rule,g??{},x??void 0)),isPending:sn,onSubmit:async t=>{await Qa(Ne,t)},onOpenChange:t=>{!t&&!sn&&ze(null)}}),rt!==null&&o.jsx(lo,{open:!0,initialName:Qt(Vt[rt]?.rule,g??{},x??void 0)?kn(Vt[rt]?.rule,g??{},re,x??void 0):"",autoLabel:re(bs(Vt[rt]?.rule,g??{},x??void 0)),isPending:sn,onSubmit:async t=>{await Xa(rt,t)},onOpenChange:t=>{!t&&!sn&&it(null)}})]})})})}export{gm as SectionsEditor};
4
+ `).trim()}const Uc={"&nbsp;":" ","&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"};function Yc(n){if(typeof DOMParser<"u")return new DOMParser().parseFromString(n,"text/html").body.textContent??"";let e=n;for(let r="";r!==e;)r=e,e=e.replace(/<[^<>]*>/g,"");return e.replace(/<|>/g,"").replace(/&(nbsp|amp|lt|gt|quot|#39);/g,r=>Uc[r]??r)}function Jn(n){const e=n.replace(/\s+/g," ").trim();return e.length>No?`${e.slice(0,No-1)}…`:e}function Jc(n){if(n.startsWith("data:"))return"image";const e=n.split(/[?#]/)[0]??n;return decodeURIComponent(e.split("/").pop()||n)}function Xn(n,e){if(n==null||n==="")return{kind:"empty"};if(typeof n=="string")return Jo(n,e)?{kind:"image",src:n}:{kind:"text",text:Ds(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 r=e?.items??null;return{kind:"list",count:n.length,items:n.slice(0,Gc).map(a=>Qc(a,r)??"")}}if(typeof n=="object"){const r=n;if("value"in r&&Object.keys(r).length<=2)return Xn(r.value,e?.properties?.value??e);const a=Object.entries(r).filter(([l,u])=>!l.startsWith("__")&&u!==void 0).flatMap(([l,u])=>{const y=e?.properties?.[l]??null,m=Xn(u,y);if(m.kind==="empty")return[];const b=m.kind==="text"?Jn(m.text):m.kind==="image"?Jc(m.src):m.kind==="yesNo"?m.value?"✓":"✗":m.kind==="list"?`${m.count}`:"…";return[{label:y?.title?.trim()||l,text:b}]}).slice(0,4);return a.length>0?{kind:"fields",entries:a}:{kind:"empty"}}return{kind:"text",text:String(n)}}function Qc(n,e){if(typeof n=="string")return Jn(Ds(n,e));if(!n||typeof n!="object"||Array.isArray(n))return null;const r=n,a=e?.titleBy,l=a?r[a]:void 0;if(typeof l=="string"&&l.trim())return Jn(l);for(const[u,y]of Object.entries(r))if(!(u.startsWith("__")||typeof y!="string"||!y.trim())&&!Jo(y,e?.properties?.[u]??null))return Jn(Ds(y,null));return null}const To=1500;function Xc(n,e){const r=n.split(/(\s+)/).filter(k=>k!==""),a=e.split(/(\s+)/).filter(k=>k!=="");if(r.length>To||a.length>To)return{mine:[{text:n,kind:"changed"}],theirs:[{text:e,kind:"changed"}]};const l=Array.from({length:r.length+1},()=>new Array(a.length+1).fill(0));for(let k=r.length-1;k>=0;k--)for(let N=a.length-1;N>=0;N--){const L=l[k];L[N]=r[k]===a[N]?l[k+1][N+1]+1:Math.max(l[k+1][N],L[N+1])}const u=[],y=[],m=(k,N,L)=>{const z=k.at(-1);z&&(z.kind===L||L==="same"&&!N.trim())?z.text+=N:k.push({text:N,kind:L})};let b=0,h=0;for(;b<r.length&&h<a.length;)r[b]===a[h]?(m(u,r[b],"same"),m(y,a[h],"same"),b++,h++):l[b+1][h]>=l[b][h+1]?(m(u,r[b],"changed"),b++):(m(y,a[h],"changed"),h++);for(;b<r.length;b++)m(u,r[b],"changed");for(;h<a.length;h++)m(y,a[h],"changed");return{mine:u,theirs:y}}function Zc(n){const e=ct.c(10);let r,a;e[0]!==n?({open:r,...a}=n,e[0]=n,e[1]=r,e[2]=a):(r=e[1],a=e[2]);const{data:l}=Ko.useSession();let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=me("max-h-[85vh] grid-rows-[auto_minmax(0,1fr)_auto] sm:max-w-lg"),e[3]=u):u=e[3];const y=l?.user??null;let m;e[4]!==a||e[5]!==y?(m=o.jsx(ac,{className:u,"data-testid":"form-conflict-dialog",onEscapeKeyDown:tu,children:o.jsx(iu,{...a,viewer:y,heading:eu})}),e[4]=a,e[5]=y,e[6]=m):m=e[6];let b;return e[7]!==r||e[8]!==m?(b=o.jsx(uc,{open:r,children:m}),e[7]=r,e[8]=m,e[9]=b):b=e[9],b}function eu(n,e){return o.jsxs(ic,{className:"text-left",children:[o.jsx(lc,{children:n}),o.jsx(cc,{children:e})]})}function tu(n){return n.preventDefault()}const nu={},su=(n,e)=>o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx("h2",{className:"text-lg font-semibold",children:n}),o.jsx("p",{className:"text-sm text-muted-foreground",children:e})]});function ru(n,e,r=0,a={},l=null){const u=e[Math.min(r,e.length-1)],y=l?.you?void 0:l?.name?.split(/\s+/)[0],m={field:u?au(u.label):"",label:u?.label??"",name:y??""},b=(h,k,N)=>n(l?.you?N:y?k:h,m);return e.length<=1?{title:b("sectionsEditor.formConflict.titleOne","sectionsEditor.formConflict.titleOneNamed","sectionsEditor.formConflict.titleOneYou"),description:n("sectionsEditor.formConflict.descriptionOne")}:{title:b("sectionsEditor.formConflict.titleStep","sectionsEditor.formConflict.titleStepNamed","sectionsEditor.formConflict.titleStepYou"),description:r>=e.length-1?o.jsx(ou,{t:n,fields:e,choices:a,name:y}):n("sectionsEditor.formConflict.descriptionStep")}}function ou(n){const e=ct.c(11),{t:r,fields:a,choices:l,name:u}=n;let y;if(e[0]!==l||e[1]!==a||e[2]!==u||e[3]!==r){let b;e[5]!==l||e[6]!==u||e[7]!==r?(b=(h,k)=>o.jsxs(R.Fragment,{children:[k>0&&" · ",`${h.label}: `,o.jsx("span",{className:"font-medium text-foreground",children:r((l[h.pointer]??"mine")==="mine"?"sectionsEditor.formConflict.summaryYours":u?"sectionsEditor.formConflict.summaryTheirsNamed":"sectionsEditor.formConflict.summaryTheirs",{name:u??""})})]},h.pointer),e[5]=l,e[6]=u,e[7]=r,e[8]=b):b=e[8],y=a.map(b),e[0]=l,e[1]=a,e[2]=u,e[3]=r,e[4]=y}else y=e[4];let m;return e[9]!==y?(m=o.jsx("span",{"data-testid":"form-conflict-summary",children:y}),e[9]=y,e[10]=m):m=e[10],m}function au(n){return/^[A-Z][a-z]/.test(n)&&!n.includes("›")?n.charAt(0).toLowerCase()+n.slice(1):n}function iu(n){const e=ct.c(68),r=Lt(),{fields:a,choices:l,changedAgain:u,fresh:y,heading:m}=n,b=u===void 0?!1:u,h=y===void 0?nu:y,k=m===void 0?su:m,N=a.length>1,[L,z]=R.useState(0),[H,B]=R.useState(lu);let w;e[0]===Symbol.for("react.memo_cache_sentinel")?(w={},e[0]=w):w=e[0];const[p,te]=R.useState(w),E=Math.max(0,Math.min(L,a.length-1)),W=a[E],V=E===a.length-1;let J;e[1]!==E||e[2]!==a||e[3]!==h?(J=xe=>{const O=a[E],oe=a[xe];!O||!oe||xe===E||(B(G=>new Set(G).add(O.pointer)),te(G=>({...G,[O.pointer]:h[O.pointer]??0,[oe.pointer]:h[oe.pointer]??0})),z(xe))},e[1]=E,e[2]=a,e[3]=h,e[4]=J):J=e[4];const g=J;let Q;e[5]!==E||e[6]!==g?(Q=xe=>{if(!xe)return;const O=oe=>{const G={ArrowLeft:-1,ArrowRight:1}[oe.key];!G||oe.defaultPrevented||oe.altKey||oe.ctrlKey||oe.metaKey||oe.shiftKey||fc(oe.target)||(oe.preventDefault(),g(E+G))};return xe.ownerDocument.addEventListener("keydown",O),()=>xe.ownerDocument.removeEventListener("keydown",O)},e[5]=E,e[6]=g,e[7]=Q):Q=e[7];const x=Q;if(!W)return null;let Z,q,pe,ye,ue;if(e[8]!==H||e[9]!==E||e[10]!==l||e[11]!==a||e[12]!==h||e[13]!==g||e[14]!==k||e[15]!==x||e[16]!==N||e[17]!==n||e[18]!==p||e[19]!==r){const{title:xe,description:O}=ru(r,a,E,l,n.author??null);let oe;e[25]!==n?(oe=G=>{G.detail>1||n.onApply()},e[25]=n,e[26]=oe):oe=e[26],Z=oe,q=N?x:void 0,pe="flex min-w-0 flex-col gap-3",e[27]!==H||e[28]!==E||e[29]!==a||e[30]!==h||e[31]!==g||e[32]!==N||e[33]!==p||e[34]!==r?(ye=N&&o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx("div",{role:"group","aria-label":r("sectionsEditor.formConflict.steps"),className:"-m-1 flex flex-wrap items-center",children:a.map((G,Ke)=>{const ke=Ke!==E&&(h[G.pointer]??0)>(p[G.pointer]??0);return o.jsx("button",{type:"button","aria-label":ke?r("sectionsEditor.formConflict.stepChangedAgain",{label:G.label}):G.label,"aria-current":Ke===E?"step":void 0,"data-answered":Ke!==E&&H.has(G.pointer)?"":void 0,"data-changed-again":ke?"":void 0,onClick:()=>g(Ke),className:"group cursor-pointer rounded-full p-1 focus-ring",children:o.jsx("span",{className:me("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")})},G.pointer)})}),o.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:r("sectionsEditor.formConflict.stepCount",{step:String(E+1),count:String(a.length)})})]}),e[27]=H,e[28]=E,e[29]=a,e[30]=h,e[31]=g,e[32]=N,e[33]=p,e[34]=r,e[35]=ye):ye=e[35],ue=k(xe,O),e[8]=H,e[9]=E,e[10]=l,e[11]=a,e[12]=h,e[13]=g,e[14]=k,e[15]=x,e[16]=N,e[17]=n,e[18]=p,e[19]=r,e[20]=Z,e[21]=q,e[22]=pe,e[23]=ye,e[24]=ue}else Z=e[20],q=e[21],pe=e[22],ye=e[23],ue=e[24];let fe;e[36]!==q||e[37]!==pe||e[38]!==ye||e[39]!==ue?(fe=o.jsxs("div",{ref:q,className:pe,children:[ye,ue]}),e[36]=q,e[37]=pe,e[38]=ye,e[39]=ue,e[40]=fe):fe=e[40];const Re=!b&&"sr-only";let j;e[41]!==Re?(j=me("text-sm text-muted-foreground",Re),e[41]=Re,e[42]=j):j=e[42];let re;e[43]!==b||e[44]!==N||e[45]!==r?(re=b?r(N?"sectionsEditor.formConflict.changedAgainSteps":"sectionsEditor.formConflict.changedAgain"):"",e[43]=b,e[44]=N,e[45]=r,e[46]=re):re=e[46];let Ae;e[47]!==j||e[48]!==re?(Ae=o.jsx("p",{role:"status",className:j,children:re}),e[47]=j,e[48]=re,e[49]=Ae):Ae=e[49];const Ce=N?"vertical":"all";let S;e[50]!==W||e[51]!==n||e[52]!==Ce?(S=o.jsx(fu,{field:W,...n,arrows:Ce}),e[50]=W,e[51]=n,e[52]=Ce,e[53]=S):S=e[53];let K;e[54]!==Ae||e[55]!==S?(K=o.jsxs("div",{className:"-mx-2 flex min-h-0 flex-col gap-3 overflow-y-auto px-2 py-1",children:[Ae,S]}),e[54]=Ae,e[55]=S,e[56]=K):K=e[56];let he;e[57]!==Z||e[58]!==E||e[59]!==g||e[60]!==V||e[61]!==N||e[62]!==r?(he=N?o.jsxs(_o,{className:"flex-row flex-wrap items-center justify-between gap-2 sm:justify-between",children:[o.jsx(Et,{type:"button",variant:"outline","aria-disabled":E===0,onClick:()=>g(E-1),className:"aria-disabled:cursor-default aria-disabled:opacity-45",children:r("sectionsEditor.formConflict.back")}),o.jsx(Et,{type:"button","data-testid":"form-conflict-primary",onClick:V?Z:()=>g(E+1),children:r(V?"sectionsEditor.formConflict.ok":"sectionsEditor.formConflict.next")})]}):o.jsx(_o,{className:"items-center gap-2",children:o.jsx(Et,{type:"button","data-testid":"form-conflict-primary",onClick:Z,children:r("sectionsEditor.formConflict.ok")})}),e[57]=Z,e[58]=E,e[59]=g,e[60]=V,e[61]=N,e[62]=r,e[63]=he):he=e[63];let M;return e[64]!==fe||e[65]!==K||e[66]!==he?(M=o.jsxs(o.Fragment,{children:[fe,K,he]}),e[64]=fe,e[65]=K,e[66]=he,e[67]=M):M=e[67],M}function lu(){return new Set}function cu(n){const e=Xn(n.mine,n.schema),r=Xn(n.theirs,n.schema),a=e.kind==="text"&&r.kind==="text"?Xc(e.text,r.text):null;return l=>a?o.jsx(pu,{parts:a[l]}):o.jsx(gu,{preview:l==="mine"?e:r})}const uu={all:{ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1},vertical:{ArrowDown:1,ArrowUp:-1}};function du(n,e){const r=uu[e][n.key];if(!r)return;const a=[...n.currentTarget.querySelectorAll('[role="radio"]')],l=a.indexOf(document.activeElement);if(l<0)return;n.preventDefault();const u=a[(l+r+a.length)%a.length];u?.focus(),u?.click()}function fu(n){const e=ct.c(65),{field:r,choices:a,viewer:l,author:u,onChoose:y,arrows:m}=n,b=u===void 0?null:u,h=Lt(),[k]=fi(),{language:N}=k;let L,z,H,B,w,p,te,E,W,V,J,g,Q,x;if(e[0]!==m||e[1]!==b||e[2]!==a||e[3]!==r||e[4]!==N||e[5]!==y||e[6]!==h||e[7]!==l?.image||e[8]!==l?.name){const pe=cu(r),ye=a[r.pointer]??"mine",ue=l?.image??void 0;let fe;e[23]!==h||e[24]!==l?.name?(fe=l?.name?.trim()||h("sectionsEditor.formConflict.you"),e[23]=h,e[24]=l?.name,e[25]=fe):fe=e[25];let Re;e[26]!==ue||e[27]!==fe?(Re=o.jsx(_s,{url:ue,fallback:fe,shape:"circle",size:"sm",className:"text-xs"}),e[26]=ue,e[27]=fe,e[28]=Re):Re=e[28];const j=Re;let re;e[29]!==b||e[30]!==j?(re=b?.you?j:b?.name?o.jsx(_s,{url:b.avatarUrl,fallback:b.name,shape:"circle",size:"sm",className:"text-xs"}):o.jsx(_s,{url:"icon://user",fallback:"",muted:!0,shape:"circle",size:"sm"}),e[29]=b,e[30]=j,e[31]=re):re=e[31];const Ae=re,Ce=b?new Date(b.at):null;H="radiogroup",B=r.label,w="flex flex-col gap-2",e[32]!==m?(p=M=>du(M,m),e[32]=m,e[33]=p):p=e[33];let S;e[34]!==r.pointer||e[35]!==y?(S=()=>y(r.pointer,"mine"),e[34]=r.pointer,e[35]=y,e[36]=S):S=e[36];let K;e[37]!==h?(K=h("sectionsEditor.formConflict.you"),e[37]=h,e[38]=K):K=e[38];let he;e[39]!==h?(he=h("sectionsEditor.formConflict.yourVersionNotSaved"),e[39]=h,e[40]=he):he=e[40],te=o.jsx(Vo,{side:"mine",checked:ye==="mine",onChoose:S,avatar:j,who:K,meta:he,children:pe("mine")}),L=Vo,E="theirs",W=ye==="theirs",e[41]!==r.pointer||e[42]!==y?(V=()=>y(r.pointer,"theirs"),e[41]=r.pointer,e[42]=y,e[43]=V):V=e[43],J=Ae,e[44]!==b?.name||e[45]!==b?.you||e[46]!==h?(g=b?.you?h("sectionsEditor.formConflict.youElsewhere"):b?.name||h("sectionsEditor.formConflict.someoneElse"),e[44]=b?.name,e[45]=b?.you,e[46]=h,e[47]=g):g=e[47],Q=Ce?h("sectionsEditor.formConflict.savedAt",{when:dc(Ce,N)}):h("sectionsEditor.formConflict.theirVersionSaved"),x=Ce?mu(Ce,N):void 0,z=pe("theirs"),e[0]=m,e[1]=b,e[2]=a,e[3]=r,e[4]=N,e[5]=y,e[6]=h,e[7]=l?.image,e[8]=l?.name,e[9]=L,e[10]=z,e[11]=H,e[12]=B,e[13]=w,e[14]=p,e[15]=te,e[16]=E,e[17]=W,e[18]=V,e[19]=J,e[20]=g,e[21]=Q,e[22]=x}else L=e[9],z=e[10],H=e[11],B=e[12],w=e[13],p=e[14],te=e[15],E=e[16],W=e[17],V=e[18],J=e[19],g=e[20],Q=e[21],x=e[22];let Z;e[48]!==L||e[49]!==z||e[50]!==E||e[51]!==W||e[52]!==V||e[53]!==J||e[54]!==g||e[55]!==Q||e[56]!==x?(Z=o.jsx(L,{side:E,checked:W,onChoose:V,avatar:J,who:g,meta:Q,metaTitle:x,children:z}),e[48]=L,e[49]=z,e[50]=E,e[51]=W,e[52]=V,e[53]=J,e[54]=g,e[55]=Q,e[56]=x,e[57]=Z):Z=e[57];let q;return e[58]!==H||e[59]!==B||e[60]!==w||e[61]!==p||e[62]!==te||e[63]!==Z?(q=o.jsxs("div",{role:H,"aria-label":B,className:w,onKeyDown:p,children:[te,Z]}),e[58]=H,e[59]=B,e[60]=w,e[61]=p,e[62]=te,e[63]=Z,e[64]=q):q=e[64],q}const mu=(n,e)=>n.toLocaleString(e,{dateStyle:"medium",timeStyle:"short"});function Vo(n){const e=ct.c(28),{side:r,checked:a,onChoose:l,avatar:u,who:y,meta:m,metaTitle:b,children:h}=n,k=R.useId(),N=`${k}-who`,L=`${k}-meta ${k}-value`,z=a?0:-1,H=a?"border-primary bg-primary/5 ring-1 ring-primary":"hover:bg-accent";let B;e[0]!==H?(B=me("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] focus-ring",H),e[0]=H,e[1]=B):B=e[1];const w=`${k}-who`;let p;e[2]!==w||e[3]!==y?(p=o.jsx("span",{id:w,className:"text-sm font-medium text-foreground",children:y}),e[2]=w,e[3]=y,e[4]=p):p=e[4];const te=`${k}-meta`;let E;e[5]!==m||e[6]!==b||e[7]!==te?(E=o.jsx("span",{id:te,title:b,children:m}),e[5]=m,e[6]=b,e[7]=te,e[8]=E):E=e[8];let W;e[9]!==p||e[10]!==E?(W=o.jsxs("span",{className:"flex flex-wrap items-baseline gap-x-1.5 text-xs text-muted-foreground",children:[p,E]}),e[9]=p,e[10]=E,e[11]=W):W=e[11];const V=`${k}-value`,J=`conflict-${r}`;let g;e[12]!==h||e[13]!==V||e[14]!==J?(g=o.jsx("span",{id:V,"data-testid":J,className:"min-w-0 text-sm",children:h}),e[12]=h,e[13]=V,e[14]=J,e[15]=g):g=e[15];let Q;e[16]!==W||e[17]!==g?(Q=o.jsxs("span",{className:"flex min-w-0 flex-col gap-1",children:[W,g]}),e[16]=W,e[17]=g,e[18]=Q):Q=e[18];let x;return e[19]!==u||e[20]!==a||e[21]!==l||e[22]!==N||e[23]!==Q||e[24]!==L||e[25]!==z||e[26]!==B?(x=o.jsxs("button",{type:"button",role:"radio","aria-checked":a,"aria-labelledby":N,"aria-describedby":L,tabIndex:z,onClick:l,className:B,children:[u,Q]}),e[19]=u,e[20]=a,e[21]=l,e[22]=N,e[23]=Q,e[24]=L,e[25]=z,e[26]=B,e[27]=x):x=e[27],x}function pu(n){const e=ct.c(4),{parts:r}=n;let a;e[0]!==r?(a=r.map(hu),e[0]=r,e[1]=a):a=e[1];let l;return e[2]!==a?(l=o.jsx("span",{className:"whitespace-pre-wrap break-words",children:a}),e[2]=a,e[3]=l):l=e[3],l}function hu(n,e){return n.kind==="changed"?o.jsx("mark",{className:"rounded-sm bg-warning/20 px-0.5 text-foreground",children:n.text},e):o.jsx("span",{children:n.text},e)}function gu(n){const e=ct.c(29),{preview:r}=n,a=Lt();switch(r.kind){case"empty":{let l;e[0]!==a?(l=a("sectionsEditor.formConflict.empty"),e[0]=a,e[1]=l):l=e[1];let u;return e[2]!==l?(u=o.jsx("span",{className:"italic text-muted-foreground",children:l}),e[2]=l,e[3]=u):u=e[3],u}case"text":{let l;return e[4]!==r.text?(l=o.jsx("span",{className:"whitespace-pre-wrap break-words",children:r.text}),e[4]=r.text,e[5]=l):l=e[5],l}case"image":{let l;return e[6]!==r.src?(l=o.jsx("img",{src:r.src,alt:"",className:"max-h-24 max-w-full rounded border object-contain"}),e[6]=r.src,e[7]=l):l=e[7],l}case"yesNo":{const l=r.value?"sectionsEditor.formConflict.yes":"sectionsEditor.formConflict.no";let u;e[8]!==a||e[9]!==l?(u=a(l),e[8]=a,e[9]=l,e[10]=u):u=e[10];let y;return e[11]!==u?(y=o.jsx("span",{children:u}),e[11]=u,e[12]=y):y=e[12],y}case"list":{const l=r.count===1?"sectionsEditor.formConflict.oneItem":"sectionsEditor.formConflict.items",u=String(r.count);let y;e[13]!==a||e[14]!==l||e[15]!==u?(y=a(l,{count:u}),e[13]=a,e[14]=l,e[15]=u,e[16]=y):y=e[16];let m;e[17]!==y?(m=o.jsx("span",{className:"text-muted-foreground",children:y}),e[17]=y,e[18]=m):m=e[18];let b;e[19]!==r.count||e[20]!==r.items?(b=r.items.some(Boolean)&&o.jsxs("span",{className:"flex flex-col",children:[r.items.map(yu),r.count>r.items.length&&o.jsx("span",{children:"…"})]}),e[19]=r.count,e[20]=r.items,e[21]=b):b=e[21];let h;return e[22]!==m||e[23]!==b?(h=o.jsxs("span",{className:"flex flex-col gap-1",children:[m,b]}),e[22]=m,e[23]=b,e[24]=h):h=e[24],h}case"fields":{let l;e[25]!==r.entries?(l=r.entries.map(vu),e[25]=r.entries,e[26]=l):l=e[26];let u;return e[27]!==l?(u=o.jsx("dl",{className:"grid grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-0.5",children:l}),e[27]=l,e[28]=u):u=e[28],u}}}function vu(n){return o.jsxs("div",{className:"contents",children:[o.jsx("dt",{className:"text-muted-foreground",children:n.label}),o.jsx("dd",{className:"truncate",children:n.text})]},n.label)}function yu(n,e){return o.jsx("span",{className:"truncate",children:`${e+1}. ${n||"…"}`},e)}function xu(n,e){return n.kind==="protocol"&&n.source==="github"?e:null}function bu(n,e){if(Object.hasOwn(n,e))return n[e]??null;const r=fo(e),a=Object.keys(n).find(l=>fo(l)===r);return a===void 0?null:n[a]??null}async function Su(n,e){try{const r=await fetch(`/api/${n.orgSlug}/decofile/${encodeURIComponent(n.virtualMcpId)}/${encodeURIComponent(n.branch)}`,{cache:"no-store",headers:Qi("v8")});if(!r.ok)return null;const a=await r.json().catch(()=>({})),l=bu(a.changedBy??{},e);return l&&typeof l.userId=="string"&&Number.isFinite(Date.parse(l.at))?l:null}catch{return null}}function _u(n,e,r){const a=e.find(y=>y.userId===n.userId),l=a?.user?.name?.trim(),u=a?.user?.image??void 0;return{...l?{name:l}:{},...u?{avatarUrl:u}:{},at:n.at,you:!!r&&n.userId===r}}function wu(n){let e=2166136261,r=0;for(let a=0;a<n.length;a++){const l=n.charCodeAt(a);e=Math.imul(e^l,16777619),r=Math.imul(r,31)+l|0}return`${(e>>>0).toString(36)}${(r>>>0).toString(36)}:${n.length}`}function ju(n,e,r){const a=ct.c(19),l=!!n&&!!e&&r!==null;let u;a[0]!==e||a[1]!==n||a[2]!==r?(u=Io.conflictAuthor(n?`${n.orgSlug}/${n.virtualMcpId}/${n.branch}`:"",e??"",r??""),a[0]=e,a[1]=n,a[2]=r,a[3]=u):u=a[3];let y;a[4]!==e||a[5]!==n?(y=()=>Su(n,e),a[4]=e,a[5]=n,a[6]=y):y=a[6];let m;a[7]!==l||a[8]!==u||a[9]!==y?(m={queryKey:u,queryFn:y,enabled:l,staleTime:Number.POSITIVE_INFINITY,gcTime:6e5,retry:!1,refetchOnWindowFocus:!1},a[7]=l,a[8]=u,a[9]=y,a[10]=m):m=a[10];const{data:b}=mi(m),h=l?b??null:null,k=!!h;let N;a[11]!==k?(N={enabled:k},a[11]=k,a[12]=N):N=a[12];const{data:L}=mc(N);let z;a[13]!==L?(z=L?.data?.members??[],a[13]=L,a[14]=z):z=a[14];const H=z,{data:B}=Ko.useSession();if(!h)return null;const w=B?.user?.id??null;let p;return a[15]!==h||a[16]!==H||a[17]!==w?(p=_u(h,H,w),a[15]=h,a[16]=H,a[17]=w,a[18]=p):p=a[18],p}function ku(n,e,r,a){if(!n||typeof n!="object")return{kind:"error",reason:"no-matcher-rule"};const l=e.trim();if(!l)return Qt(n,r,a)?{kind:"inline",blockKey:n.__resolveType??"",inlinedRule:Rs(n,r,a)}:{kind:"noop"};const u=As(n,r,a);if(!u)return{kind:"error",reason:"unreadable-rule"};if(u.blockKey)return{kind:"updateBlock",blockKey:u.blockKey,blockData:Ot(u.resolveType,u.data,l)};const y=Gn(l),m=Un(y,r);return m?{kind:"error",reason:"invalid-block-id",message:m}:{kind:"createBlock",blockId:y,blockData:Ot(u.resolveType,u.data,l),reference:dn(y)}}const Po="section-form-stale-save",Eu=3,Ru=1e3;function Mo(n,e,r){const a=e.global&&e.pageKey?[{label:"Default",sections:[{__resolveType:e.pageKey}]}]:Fo(e.pageKey?n[e.pageKey]?.sections:void 0,n,r),l=Math.max(0,Math.min(e.pageVariantIndex,a.length-1)),u=a[l]?.sections??[];return{pageVariants:a,variantIndex:l,rawSections:u,parsedSections:En(u,n,r)}}const Do=new WeakMap;let Au=0;function Cu(n){let e=Do.get(n);return e===void 0&&(e=++Au,Do.set(n,e)),e}function vm({orgSlug:n,virtualMcpId:e,branch:r,previewReady:a=!0,previewUrl:l,currentPath:u,activePageBlockKey:y=null,activeGlobalBlockKey:m=null,externalSelection:b,onSaved:h,initialEditSeo:k=!1,onExitSeo:N,onSelectRoot:L,onViewJsonFile:z,onFocusedBlockChange:H,onVariantPreviewOverride:B,focusVariant:w}){const p=Lt(),te=gi(),E=te?.taskId??null,W=a?{orgSlug:n,virtualMcpId:e,branch:r,threadId:E,previewUrl:l}:null,[V,J]=R.useState([]),{data:g,isLoading:Q}=Xi(W,{pollWhile:V.length>0}),{data:x,isLoading:Z}=il(W),q=Zn(),pe=te?.virtualMcpId,ue=qi(pe===e?e:null)?.metadata?.siteSlug??null,fe=sc({virtualMcpId:e,branch:r,sandboxUrl:l}),Re=Zi(e,r),j=el(Re),re=ul(j),Ae=!j,Ce=!!fe||j,[S,K]=R.useState(null),[he,M]=R.useState(null),[xe,O]=R.useState(null),[oe,G]=R.useState(0),[Ke,ke]=R.useState(void 0),[ut,Ze]=R.useState(null),[$e,qe]=R.useState(null);w&&w.seq!==ut&&(Ze(w.seq),qe(w));const[at,Ge]=R.useState(null),Ue={index:at,remember:Ge},[Ye,de]=R.useState(null),[ge,be]=R.useState(null),[ee,F]=R.useState([]),De=R.useRef(null),[et,tt]=R.useState(ee.length);et!==ee.length&&(tt(ee.length),requestAnimationFrame(()=>{De.current&&(De.current.scrollTop=0)}));const[st,I]=R.useState(0),[Je,ie]=R.useState(null),[Ne,ze]=R.useState(null),[rt,it]=R.useState(null),[Qo,Zt]=R.useState(!1),[Fs,es]=R.useState(!1),Rn=R.useRef(null),[An,Xo]=R.useState(!0),[en,Cn]=R.useState(!1),[$t,Nn]=R.useState(!1),[He,fn]=R.useState(k),[Bs,Os]=R.useState(k);k&&!Bs&&(Os(!0),fn(!0),K(null),M(null),O(null),F([])),!k&&Bs&&Os(!1);const[Zo,mn]=R.useState(null),[Ls,Tn]=R.useState(void 0),[$s,zt]=R.useState([]),[zs,tn]=R.useState(0),[Qe,dt]=R.useState(0),[ea,Xe]=R.useState(null),[nn,nt]=R.useState(null),[Hs,Ws]=R.useState(null),qs=pi(),Gs=tl({orgSlug:n,virtualMcpId:e,branch:r},{tunnel:!1}),pn=Ri({orgSlug:n,virtualMcpId:e,branch:r}),[ta,na]=R.useState(u),[sa,ra]=R.useState(y),[oa,aa]=R.useState(m);(ta!==u||sa!==y||oa!==m)&&(queueMicrotask(()=>pn.flush()),na(u),ra(y),aa(m),K(null),M(null),O(null),G(0),de(null),be(null),dt(0),Xe(null),nt(null),F([]),I(t=>t+1),fn(!1),mn(null),Tn(void 0),zt([]),tn(t=>t+1));const X=Ai({orgSlug:n,virtualMcpId:e,branch:r}),hn=zi((t,s)=>{X.mutate({blockKey:t,data:s},{onSuccess:()=>h?.(),onError:X.reportError})}),Vn=ml({orgSlug:n,virtualMcpId:e,branch:r}),Us=vc({orgSlug:n,virtualMcpId:e,branch:r}),[sn,rn]=R.useState(!1),$=R.useRef(null),Tt=R.useRef(null),ht=R.useRef(null),gt=R.useRef(null),Pn=R.useRef({}),Ht=R.useRef(null),gn=R.useRef(!1),vn=R.useRef(!1),Ie=R.useRef(new Map),on=R.useRef(!1),_t=R.useRef([]),ts=R.useRef(new WeakSet);nl(n,e,t=>{const{activePageKey:s,rawSections:i,parsedSections:c,selectedSectionIndex:d}=Se.current,v=new Set;s&&v.add(s);for(const f of[Tt.current?.sectionIndex,d]){const _=f==null?void 0:i[f],D=f==null?void 0:c[f],A=_&&D?.isSavedBlock?ys(_,D):null;A&&v.add(A)}if([...v].some(f=>t.has(f))){for(const f of[$,ht,gt])f.current&&clearTimeout(f.current),f.current=null;Tt.current=null,Ie.current.clear(),s&&t.has(s)&&(Pn.current={})}});const Se=R.useRef({rawSections:[],parsedSections:[],decofile:{},activePageKey:null,pageVariants:[],variantIndex:0,sectionVariantIndex:0,selectedSectionIndex:null}),[Ys,Js]=R.useState(0),[ia,la]=R.useState(0),ca=ju(xu(Re,{orgSlug:n,virtualMcpId:e,branch:r}),V[0]?.blockKey??null,V[0]?wu(Le(V[0].plan.theirs)):null),[ua,da]=R.useState(null),ns=sl(n,e).epoch,[fa,ma]=R.useState(ns);if(!a||Q||Z)return o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(hi,{className:"size-5 text-muted-foreground"})});if(!g||!x)return o.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:p("sectionsEditor.sectionsEditor.couldNotLoadSiteData")});const pa=vl(g,x),ne=!!m,_e=ne?null:yl(pa,u,y),C=ne?m:_e?.key??null,Mn=ne&&m?g[m]:void 0,Qs=ne&&m&&Mn?xl(m,Mn):ne&&m?m:"",Wt=!ne&&C&&g[C]?g[C]:null,ss=He&&g&&x&&C&&_e?Zr(g,{kind:"page",pageKey:C,pageName:String(_e.name??""),path:String(_e.path??"")},x):null,ha=He?Wt?.seo:void 0,Dn=Ls!==void 0?Ls:ha,ga=He?Ci(Dn):void 0,Xs=ss?.seoTypeOptions??[],Zs=He&&x?Ni(x):"",rs=Zo??ga??{},Kn=He&&ss?pc(rs,ss):null,er=He&&Kn&&Ti(Dn)?qn(Kn,x):null,tr=He?Vi(g,x)?.seoData:void 0,Te=ne?[{label:"Default",sections:[{__resolveType:m}]}]:Fo(Wt?.sections,g??{},j),vt=Te.length>1,ve=Math.min(oe,Te.length-1),Fe=Te[ve],U=Fe?.sections??[],Ve=En(U,g,j),In=!ne&&bl(Wt?.sections,j);if(ne&&m&&Hs!==m){Ws(m);const t=U[0],s=Ve[0];if(t&&s){K(0),dt(0),F([]);const i=kt(t,s,g,j);i&&(M(i.data),O(i.resolveType),nt(null),Xe(null))}}!ne&&Hs!==null&&Ws(null),Se.current={rawSections:U,parsedSections:Ve,decofile:g??{},activePageKey:C,pageVariants:Te,variantIndex:ve,sectionVariantIndex:Qe,selectedSectionIndex:S};const va=()=>({multivariate:In,index:ve,variants:Te.map(t=>({rule:t.rule})),lazyValues:j&&In&&Ml(Wt?.sections?.variants?.[ve]?.value)}),os=(t,s)=>{if(!B)return;if(!C||!In||t.length<=1){B(null);return}const i={multivariate:!0,index:s,variants:t},c=j?ko(C,i):jo(C,i,g,x);B(c.length>0?c:null)},as=B&&C&&In&&vt&&!Q&&!Z?C:null;if(as!==ua&&(da(as),as)){const t=Te.map(i=>({rule:i.rule})),s=ve;queueMicrotask(()=>os(t,s))}const qt=(t,s,i)=>{if(!B)return;if(!C){B(null);return}const c=va(),d=j?ko(C,c):jo(C,c,g,x);if(!t||s<0){B(d.length>0?d:null);return}const v={pageKey:C,page:c,sectionIndex:s,sectionLazy:Ve[s]?.isLazy??!1,mvObj:t,selectedVariantIndex:i},f=j?xc(v):yc({...v,decofile:g,meta:x}),_=j?bc(d,f):[...d,...f];B(_.length>0?_:null)},wt=(t,s,i,c=S??-1,d=!1)=>{const v=ot(t,s);if(!v){M(null),O(null),nt(null),Xe(null),d&&qt(null,c,i);return}const _=Es(v,re)[i];if(!_){M(null),O(null),nt(null),Xe(null),d&&qt(null,c,i);return}const D=Lo(_.value,g);M(D?.data??null),O(D?.resolveType??null);const{resolveType:A,formValue:T}=Jt(_.rule,g,x??void 0);nt(A),Xe(T),d&&qt(v,c,i)},yn=t=>{ze(null),G(t),K(null),M(null),O(null),F([]);const s=Te[t]?.rule,{resolveType:i,formValue:c}=Jt(s,g??{},x??void 0);be(i),de(c),os(Te.map(d=>({rule:d.rule})),t)},nr=(t,s)=>{const i=U[t],c=Ve[t];if(!i||!c)return!1;const d=c.isMultivariate?ot(i,c)?.variants?.length??0:0,v=s<d?s:0;if(K(t),dt(v),F([]),I(f=>f+1),c.isMultivariate)wt(i,c,v,t);else{const f=kt(i,c,g,j);f?(M(f.data),O(f.resolveType)):(M(null),O(null)),nt(null),Xe(null)}return!0},sr=b?.index;if(b!==void 0&&(b?.seq??null)!==Ke&&(ke(b?.seq??null),typeof sr=="number"&&nr(sr,0)),$e&&(ne?Mn:Wt)){const t=$e.pageVariant,s=!ne&&t!==void 0&&t<Te.length;if(s&&t!==ve)yn(t);else{qe(null);const{section:i,variant:c}=$e;if(ne)c!==void 0&&(Ge(c),F([]),I(d=>d+1));else if(i!==void 0&&nr(i,c??0)){const d=U[i],v=Ve[i],f=v.isMultivariate?ot(d,v):null;f&&c!==void 0&&queueMicrotask(()=>qt(f,i,c))}else s&&yn(t)}}if(ns!==fa){ma(ns);const t=$.current!==null||Ie.current.size>0||gt.current!==null||ht.current!==null||X.isPending||pn.isPending||V.length>0,s=S!==null&&Co(De.current,document.activeElement);if(!t&&s&&(on.current=!0),!t&&!s&&S!==null){const i=U[S],c=Ve[S];if(F([]),I(d=>d+1),!i||!c)K(null),M(null),O(null);else if(c.isMultivariate)wt(i,c,Qe,S);else{const d=kt(i,c,g,j);M(d?.data??null),O(d?.resolveType??null)}}!t&&He&&(mn(null),Tn(void 0),tn(i=>i+1))}if(Ys!==ia){la(Ys);const t=S!==null?U[S]:null,s=S!==null?Ve[S]:null;if(t&&s&&S!==null)if(F([]),I(i=>i+1),s.isMultivariate)wt(t,s,Qe,S);else{const i=kt(t,s,g,j);M(i?.data??null),O(i?.resolveType??null)}}const ft=V[0];if(ft){const{formBase:t,target:s}=ft,i=Mo(g,s,j),c=t.sectionIndex,d=i.rawSections.length===t.sectionCount?js(i.rawSections[c],i.parsedSections[c],s.sectionVariantIndex,g,j):null,v=$c(ft,d,f=>Ro(t,f));if(v){const _=[{...ft,...v,changedAgain:!0},...V.slice(1)];_t.current=_,J(_)}}const xn={orgSlug:n,virtualMcpId:e,branch:r,threadId:E,previewUrl:j?void 0:l??void 0,siteSlug:ue},Fn=xe&&x?qn(xe,x):null,mt=(t,s)=>{if(!C)return;$.current&&(clearTimeout($.current),$.current=null),Ie.current.clear(),gt.current&&(clearTimeout(gt.current),gt.current=null),ht.current&&(clearTimeout(ht.current),ht.current=null);const i=cn(g,C,t,ve,Te);X.mutate({blockKey:C,data:i},{onSuccess:()=>s?.onSuccess?.()??h?.(),onError:c=>{s?.onError?.(),X.reportError(c)}})},Gt=()=>{H?.(null),K(null),Nn(!1),M(null),O(null),dt(0),Xe(null),nt(null),F([]),I(t=>t+1)},rr=()=>Co(De.current,document.activeElement),is=(t=p("sectionsEditor.sectionsEditor.blockChangedElsewhere"))=>{if($.current&&(clearTimeout($.current),$.current=null),Ie.current.clear(),Tt.current=null,ae.error(t,{id:Po}),rr()){on.current=!0;return}Js(s=>s+1)},or=()=>{!on.current||rr()||_t.current.length>0||$.current!==null||gn.current||vn.current||Ie.current.size>0||(on.current=!1,Js(t=>t+1))},ar=()=>{on.current&&setTimeout(or,0)},ir=t=>ol(qs,Gs,t),lr=t=>{Ie.current.size!==0&&setTimeout(()=>{if(gn.current||vn.current)return;const s=[...Ie.current.values()];Ie.current.clear();for(const i of s)i()},t)},ya=t=>{const{activePageKey:s,variantIndex:i,sectionVariantIndex:c}=Se.current,d=Ht.current;return{formBase:d?.sectionIndex===t&&d.variantIndex===c?d:null,pageKey:s,global:ne,pageVariantIndex:i,sectionVariantIndex:c,schema:Fn}},bn=t=>{_t.current=t,J(t)},xa=t=>{const s=_t.current,i=s.findIndex(v=>v.formBase===t.formBase),c=i>=0?s[i]:void 0,d=c?s.with(i,{...t,choices:Ms(c.plan,c.choices,t.plan),fresh:Yo(c.plan,t.plan,c.fresh),changedAgain:c.changedAgain||Le(c.plan.theirs)!==Le(t.plan.theirs)}):[...s,{...t,changedAgain:ts.current.has(t.formBase)}];bn(d)},cr=(t,s)=>{const i=_t.current,c=i.findIndex(f=>f.formBase===t),d=i[c];if(!d)return!1;if(Le(d.plan.mine)===Le(s))return!0;const v=Vs({...d.plan,mine:s});if(v.pointers.length===0){const f=i.filter(_=>_!==d);return bn(f),!1}return bn(i.with(c,{...d,plan:v,choices:Ms(d.plan,d.choices,v)})),!0},ba=t=>{const s=Se.current;return s.selectedSectionIndex===t.formBase.sectionIndex&&s.activePageKey===t.target.pageKey&&s.variantIndex===t.target.pageVariantIndex&&s.sectionVariantIndex===t.target.sectionVariantIndex},Sa=()=>{const t=_t.current[0];if(!t)return null;const{formBase:s,target:i}=t;$.current&&Tt.current?.sectionIndex===s.sectionIndex&&Tt.current.sectionVariantIndex===i.sectionVariantIndex&&(clearTimeout($.current),$.current=null,Tt.current=null),Ie.current.delete(`${i.pageKey}:${s.sectionIndex}:${i.sectionVariantIndex}`);const c=s.emitted;return c&&typeof c=="object"&&!cr(s,c)&&Sn(c,s.sectionIndex,0,i),_t.current[0]??null},_a=()=>{const t=_t.current[0],s=Sa();if(!s||!t||s.formBase!==t.formBase||s.plan.pointers.some(v=>!t.plan.pointers.includes(v)))return;const i=Oc(s.plan,s.choices);bn(_t.current.slice(1));const{formBase:c,target:d}=s;c.base=s.plan.theirs,c.version=void 0,c.emitted=i,ts.current.add(c),(Ht.current===c||ba(s))&&(Ht.current=c,M(i),I(v=>v+1)),Sn(i,c.sectionIndex,0,d)},wa=t=>{const[s,...i]=_t.current;s&&bn([{...s,choices:t},...i])},Sn=(t,s,i=0,c)=>{const d=c??ya(s),v=d.sectionVariantIndex,f=d.formBase,_=Tt.current;$.current&&(clearTimeout($.current),$.current=null,_&&(_.sectionIndex!==s||_.sectionVariantIndex!==v)&&_.write());const D=`${d.pageKey}:${s}:${v}`,A=()=>{if(gn.current||vn.current){Ie.current.set(D,A);return}const T=typeof t=="function"?t():t;if(f&&cr(f,T))return;const P=Se.current.decofile,{rawSections:se,parsedSections:le,pageVariants:Be,variantIndex:we}=Mo(P,d,j),Pe=d.pageKey,Y=se[s];if(!Y)return;const ce=le[s];if(!ce)return;const Me=f?.base,We=js(Y,ce,v,P,j),xt=!!Me&&!!We&&qo(Me,We)&&!(f&&Ro(f,We));if(xt&&Me&&We){if(Go(Me,We)){is(p("sectionsEditor.sectionsEditor.sectionReplacedElsewhere"));return}const je=ce.isSavedBlock?"here":Fc(Me,se.map((Ee,Kt)=>js(Ee,le[Kt],v,P,j)),s,f?.sectionCount??se.length);if(je==="unknown"){is(p("sectionsEditor.sectionsEditor.sectionReplacedElsewhere"));return}if(typeof je=="number"&&f){f.sectionCount=se.length,f.sectionIndex=je,Ht.current===f&&K(je),Sn(T,je,i,d);return}}const lt=xt&&Me&&We?Vs({ancestor:Me,mine:T,theirs:We}):null;if(lt&&lt.pointers.length>0&&f){f.sectionCount=se.length,xa({plan:lt,formBase:f,target:d,sectionIndex:s,choices:Uo(lt),changedAgain:!1,blockKey:ce.isSavedBlock?ys(Y,ce):Pe,fresh:{}});return}const bt=lt?lt.merged:null,Dt=bt??T,Yr=Bc({merged:!!bt,tracked:f,current:Ht.current,saved:T});bt&&ae.info(p("sectionsEditor.sectionsEditor.blockMergedWithOthers"),{id:Po}),Yr&&f&&(f.emitted=bt,M(bt));const gs=Yr||!bt?Dt:T;f&&(f.base=gs,f.sectionCount=se.length,Kc(f,gs));const Jr={onSuccess:()=>{f&&ts.current.delete(f),h?.()},onError:je=>{if(f?.base===gs&&Me&&(f.base=Me),je instanceof rl){f&&(f.version=void 0),i<Eu?(Ie.current.delete(D),vn.current=!0,setTimeout(()=>{vn.current=!1,Sn(()=>{const Ee=f?.emitted;return Ee&&typeof Ee=="object"?Ee:T},s,i+1,d),Ie.current.delete(D),lr(jn)},Ru*2**i)):is();return}X.reportError(je)}},Qr=je=>{gn.current=!0;let Ee=!1;X.mutateAsync(je).then(()=>Jr.onSuccess(),Kt=>{Ee=!0,Jr.onError(Kt)}).finally(()=>{gn.current=!1,lr(Ee?jn:0),or()})};if(ce.isSavedBlock){const je=ys(Y,ce);if(!je)return;Qr({blockKey:je,data:Dt,...Me?{base:{value:bt?We:Me}}:{},rebaseOnConflict:!1,guard:Ao({formBase:f,rebased:!!bt,versionOf:ir})});return}if(!Pe)return;const Hn={...P[Pe]},Yt=[...se];if(ce.isMultivariate){const je=ot(Y,ce);if(!je||!Pe)return;const Ee=Il(je,v,Dt);Yt[s]=Bt(Y,ce,Ee)}else if(ce.isHidden){const je=Ks(Y.__resolveType),Ee=je?{...Y.section}:{...Y},Kt=Array.isArray(Ee.variants)?[...Ee.variants]:[];Kt[0]&&(Kt[0]=yo(Ee.__resolveType,Kt[0],Dt)),Ee.variants=Kt,je?Yt[s]={...Y,section:Ee}:Yt[s]=Ee}else ce.isLazy?Yt[s]={...Y,section:Dt}:Yt[s]=Dt;if(Be.length>1){const je=Hn.sections,Ee=[...je?.variants??[]];Ee[we]&&(Ee[we]=yo(je?.__resolveType,Ee[we],Yt)),Hn.sections={...je,variants:Ee}}else Hn.sections=Yt;Qr({blockKey:Pe,data:Hn,rebaseOnConflict:!1,guard:Ao({formBase:null,rebased:!1,versionOf:ir})})};Tt.current={sectionIndex:s,sectionVariantIndex:v,write:A},$.current=setTimeout(()=>{$.current=null,A()},jn)},ja=t=>{on.current=!1,K(t),dt(0),F([]),I(d=>d+1);const s=U[t],i=Ve[t];if(H?.(i?.isSavedBlock?i.resolveType??null:null),!s||!i)return;if(i.isMultivariate){wt(s,i,0,t);return}const c=kt(s,i,g,j);if(!c){M(null),O(null),nt(null),Xe(null),qt(null,t,0);return}M(c.data),O(c.resolveType),nt(null),Xe(null),qt(null,t,0)},ur=t=>{const s=t;S!==null&&(Ht.current=Ic(Ht.current,{sectionIndex:S,variantIndex:Se.current.sectionVariantIndex,shown:he,next:s,sectionCount:Se.current.rawSections.length})),M(s),S!==null&&Sn(s,S)},ls=t=>{if(!C||!g||!x||!_e)return;const s={kind:"page",pageKey:C,pageName:String(_e.name??""),path:String(_e.path??"")},i=Zr(g,s,x);i&&pn.save(C,()=>{const c=qs.getQueryData(Io.decofile(Gs))?.[C];if(!c||typeof c!="object"||c===null||Array.isArray(c))return null;const d={...c,...Pn.current};return Pn.current={},t?.raw!==void 0?hc(d,t.raw,x):t?.inner!==void 0?gc(s,i,d,t.inner):d})},dr=(t,s)=>{C&&(Pn.current[t]=s,ls())},ka=(t,s)=>{if(!C)return;const i=Yn([...U],t,s);S!==null&&(S===t?K(s):t<S&&s>=S?K(S-1):t>S&&s<=S&&K(S+1)),mt(i)},Ea=t=>{if(!C)return;const s=U.filter((i,c)=>c!==t);S===t?Gt():S!==null&&S>t&&K(S-1),mt(s)},Ra=t=>{if(!C)return;const s=U[t];if(!s)return;const i=[...U];i.splice(t+1,0,Hi(s)),S!==null&&S>t&&K(S+1),mt(i)},Aa=t=>{if(!C)return;const s=U[t],i=Ve[t];if(!s||!i)return;const c=i.isHidden?Cl(s,j):Nl(s,x);if(!c)return;const d=[...U];d[t]=c,S===t&&Gt(),mt(d)},Ca=t=>{if(!C)return;const s=U[t],i=Ve[t];if(!s||!i||i.isMultivariate)return;const c=Al(s);if(!c)return;const d=[...U];d[t]=c,S===t&&Gt(),mt(d)},Na=t=>{if(!C)return;const s=U[t],i=Ve[t];if(!s||!i?.isSavedBlock)return;const c=kt(s,i,g,j);if(!c?.data)return;const{name:d,...v}=c.data,f=[...U];i.isLazy?f[t]={...s,section:v}:f[t]=v,S===t&&Gt(),mt(f)},Ta=t=>{if(!C)return;const s=[...U,{__resolveType:t.resolveType}],i=s.length-1;mt(s,{onError:()=>{Se.current.selectedSectionIndex===i&&Gt()}}),Zt(!1),K(i),dt(0),F([]),I(f=>f+1);const c=s[i],d=En(s,g,j)[i];if(!c||!d)return;if(d.isMultivariate){wt(c,d,0);return}const v=kt(c,d,g,j);if(!v){M(null),O(null),nt(null),Xe(null);return}M(v.data),O(v.resolveType),nt(null),Xe(null)},fr=t=>{Rn.current=t.append,Zt(!0)},Va=t=>{const s=Rn.current;if(!s){Ta(t);return}s({__resolveType:t.resolveType}),Zt(!1),Rn.current=null},mr=t=>{if(S===null)return;const s=U[S],i=Ve[S];!s||!i?.isMultivariate||(dt(t),F([]),I(c=>c+1),wt(s,i,t,S,!0))},Pa=t=>{if(S===null||!C)return;const s=U[S],i=Ve[S];if(!s||!i?.isMultivariate)return;const c=ot(s,i);if(!c)return;const d=El(c,t);if(!d){ae.error(p("sectionsEditor.sectionsEditor.cannotDeleteOnlyVariant"));return}const v=[...U];v[S]=Bt(s,i,d);const f=d.variants;let _=Qe;t===Qe?_=Math.min(t,f.length-1):t<Qe&&(_=Qe-1),dt(_),F([]),I(D=>D+1),wt(v[S],i,_),mt(v)},Ma=t=>{if(S===null||!C)return;const s=U[S],i=Ve[S];if(!s||!i?.isMultivariate)return;const c=ot(s,i);if(!c)return;const d=Rl(c,t,j),v=[...U];v[S]=Bt(s,i,d);const f=vo(c.variants??[],t,j);dt(f),F([]),I(_=>_+1),wt(v[S],i,f,S,j),mt(v)},Da=(t,s)=>{if(S===null||!C||t===s)return;const i=U[S],c=Ve[S];if(!i||!c?.isMultivariate)return;const d=ot(i,c);if(!d)return;const v=jl(d,t,s),f=[...U];f[S]=Bt(i,c,v);let _=Qe;Qe===t?_=s:t<Qe&&s>=Qe?_=Qe-1:t>Qe&&s<=Qe&&(_=Qe+1),dt(_),wt(f[S],c,_,S,j),mt(f)},_n=t=>{const s=t??S;if(s===null||!C)return;const i=U[s],c=Ve[s];if(!i||!c)return;const d=Sl(i,c,void 0,x,j);if(!d){ae.error(p("sectionsEditor.sectionsEditor.sectionCannotHaveVariants"));return}const v=[...U];v[s]=d.section;const f=En(v,g,j)[s];if(!f?.isMultivariate){ae.error(p("sectionsEditor.sectionsEditor.couldNotAddVariant"));return}K(s),dt(d.newVariantIndex),F([]),I(_=>_+1),wt(d.section,f,d.newVariantIndex,s,j),mt(v)},pr=()=>{if(S===null||!C)return;const t=U[S],s=Ve[S];if(!t||!s?.isMultivariate)return;const i=ot(t,s);if(!i)return;const c=kl(t,s,i);if(!c){ae.error(p("sectionsEditor.sectionsEditor.couldNotRemoveVariants"));return}const d=[...U];d[S]=c;const v=En(d,g,j)[S];if(!v)return;dt(0),nt(null),Xe(null),F([]),I(_=>_+1);const f=kt(c,v,g,j);f?(M(f.data),O(f.resolveType)):(M(null),O(null)),qt(null,S,0),mt(d)},Ka=async t=>{if(Je===null||!C)return;const s=Un(t,g,x);if(s){ae.error(s);return}const i=U[Je],c=Ve[Je];if(!i||!c)return;const d=kt(i,c,g,j);if(!d){ae.error(p("sectionsEditor.sectionsEditor.sectionCannotBeSavedAsGlobal"));return}const v={...d.data,name:t};try{await X.mutateAsync({blockKey:t,data:v});const f=[...U];f[Je]={__resolveType:t},await X.mutateAsync({blockKey:C,data:cn(g,C,f,ve,Te)}),S===Je&&Gt(),ie(null),ae.success(p("sectionsEditor.sectionsEditor.savedGlobalBlock",{blockId:t})),h?.()}catch(f){ae.error(p("sectionsEditor.sectionsEditor.failedToSaveGlobalBlock"),{description:It(p,Ft(f))})}},hr=Fe?.rule;if(vt&&S===null&&ge===null&&hr){const{resolveType:t,formValue:s}=Jt(hr,g??{},x??void 0);be(t),de(s)}const an=x?Pi(x):[],cs=x&&g?Mi(x,g):[],Ut=j&&x&&g?ll(x,g):[],us=(t,s)=>{if(Ut.length===0)return;const i=wl(t);return{kinds:Ut,selected:i,campaignPrefill:cl(t),onPick:s}},gr=!ne&&!!(Ce&&x&&g),vr=ge&&x?qn(ge,x):null,yt=()=>{ht.current&&(clearTimeout(ht.current),ht.current=null),gt.current&&(clearTimeout(gt.current),gt.current=null)},jt=async(t,s)=>{if(!(Kl(s,t,x)>0))try{await Vn.mutateAsync({blockKey:t})}catch(i){ae.error(p("sectionsEditor.sectionsEditor.couldNotDeleteMatcherBlock"),{description:It(p,Ft(i))})}},yr=t=>{ht.current&&clearTimeout(ht.current),ht.current=setTimeout(()=>{const{activePageKey:s,decofile:i,variantIndex:c}=Se.current;if(!s)return;const d={...i[s]},v={...d.sections},f=[...v.variants??[]],_=f[c],D=_?.rule;if(Qt(D,i,x)){const A=D?.__resolveType??"",T=i[A],P=typeof T?.name=="string"?T.name:A,{__resolveType:se,...le}=t;X.mutate({blockKey:A,data:Ot(se??"",le,P)},{onSuccess:()=>h?.(),onError:X.reportError});return}_&&(f[c]={..._,rule:t}),d.sections={...v,variants:f},X.mutate({blockKey:s,data:d},{onSuccess:()=>h?.(),onError:X.reportError})},jn)},xr=t=>{be(t);const s=t?ho(t,x):{__resolveType:go(x)};de(t?s:{}),yr(s)},br=t=>{const s=t;de(s);const i=ge?{__resolveType:ge,...s}:{...s};yr(i)},Bn=async(t,s,i)=>{const c=dl(s,t);if(!c.ok)return c.reason==="conflict"&&ae.info(t.kind==="experiments"?p("sectionsEditor.namedRulePicker.conflictTests"):p("sectionsEditor.namedRulePicker.conflictCampaigns"),mo),null;const d={};if(i){const v=i(c.rule);if(!v)return null;d[v.blockKey]=v.data}return c.blockWrite&&(d[c.blockWrite.blockKey]=c.blockWrite.block),Object.keys(d).length>0&&!(await Us.apply({writes:d})).ok?null:(c.blockWrite&&ae.success(t.kind==="experiments"?p("sectionsEditor.namedRulePicker.createdTest",{name:t.name.trim()}):p("sectionsEditor.namedRulePicker.createdCampaign",{name:t.name.trim()}),{...mo,description:p("sectionsEditor.namedRulePicker.createdHint")}),{rule:c.rule,projected:{...s,...d}})},Sr=Ut.length>0?{kinds:Ut,prepare:async t=>(await Bn(t,Se.current.decofile,void 0))?.rule??null,ensureBlock:async t=>{const s=Vl(Se.current.decofile,t);return s.kind==="saved"?!0:s.kind==="conflict"?!1:(await Us.apply({writes:{[Pl(t).blockKey]:s.block}})).ok}}:null,_r=async t=>{yt();const{activePageKey:s,decofile:i,variantIndex:c}=Se.current;if(!s)return;let d=null;const v=await Bn(t,i,D=>{const A=i[s],T=A?.sections;if(!T||typeof T!="object"||Array.isArray(T))return null;const P=T;if(!Array.isArray(P.variants))return null;const se=[...P.variants],le=se[c];return le?(d=St(le.rule,i,x),se[c]={...le,rule:D},{blockKey:s,data:{...A,sections:{...P,variants:se}}}):null});if(!v)return;const{resolveType:f,formValue:_}=Jt(v.rule,v.projected,x??void 0);be(f),de(_),d&&await jt(d,v.projected),h?.()},wr=async t=>{yt();const{activePageKey:s,decofile:i,variantIndex:c}=Se.current;if(!s)return;const d=i[s],v=d?.sections;if(!v||typeof v!="object"||Array.isArray(v))return;const f=v;if(!Array.isArray(f.variants))return;const _=[...f.variants],D=_[c];if(!D)return;const A=St(D.rule,i,x),T=dn(t);_[c]={...D,rule:T};const P={...i,[s]:{...d,sections:{...f,variants:_}}},{resolveType:se,formValue:le}=Jt(T,P,x??void 0);be(se),de(le);try{await X.mutateAsync({blockKey:s,data:P[s]}),A&&A!==t&&await jt(A,P),h?.()}catch(Be){ae.error(p("sectionsEditor.sectionsEditor.couldNotApplySavedRule"),{description:It(p,Ft(Be))})}},jr=t=>{gt.current&&clearTimeout(gt.current);const{selectedSectionIndex:s,sectionVariantIndex:i}=Se.current;s!==null&&(gt.current=setTimeout(()=>{const{rawSections:c,parsedSections:d,decofile:v,activePageKey:f,pageVariants:_,variantIndex:D}=Se.current;if(!f)return;const A=c[s],T=d[s];if(!A||!T?.isMultivariate)return;const P=ot(A,T);if(!P)return;const le=(P.variants??[])[i]?.rule;if(Qt(le,v,x)){const Y=le?.__resolveType??"",ce=v[Y],Me=typeof ce?.name=="string"?ce.name:Y,{__resolveType:We,...xt}=t;X.mutate({blockKey:Y,data:Ot(We??"",xt,Me)},{onSuccess:()=>h?.(),onError:X.reportError});return}const Be=Ss(P,i,t),we=[...c];we[s]=Bt(A,T,Be);const Pe=cn(v,f,we,D,_);X.mutate({blockKey:f,data:Pe},{onSuccess:()=>h?.(),onError:X.reportError})},jn))},Ia=t=>{nt(t);const s=t?ho(t,x):{__resolveType:go(x)};Xe(t?s:{}),jr(s)},Fa=t=>{const s=t;Xe(s);const i=nn?{__resolveType:nn,...s}:{...s};jr(i)},Ba=async t=>{yt();const{selectedSectionIndex:s,sectionVariantIndex:i,rawSections:c,parsedSections:d,decofile:v,activePageKey:f,pageVariants:_,variantIndex:D}=Se.current;if(s===null||!f)return;let A=null;const T=await Bn(t,v,le=>{const Be=c[s],we=d[s];if(!Be||!we?.isMultivariate)return null;const Pe=ot(Be,we);if(!Pe)return null;const Y=Pe.variants??[];A=St(Y[i]?.rule,v,x);const ce=[...c];return ce[s]=Bt(Be,we,Ss(Pe,i,le)),{blockKey:f,data:cn(v,f,ce,D,_)}});if(!T)return;const{resolveType:P,formValue:se}=Jt(T.rule,T.projected,x??void 0);nt(P),Xe(se),A&&await jt(A,T.projected),h?.()},Oa=async t=>{yt();const{selectedSectionIndex:s,sectionVariantIndex:i,rawSections:c,parsedSections:d,decofile:v,activePageKey:f,pageVariants:_,variantIndex:D}=Se.current;if(s===null||!f)return;const A=c[s],T=d[s];if(!A||!T?.isMultivariate)return;const P=ot(A,T);if(!P)return;const se=P.variants??[],le=St(se[i]?.rule,v,x),Be=dn(t),we=Ss(P,i,Be),Pe=[...c];Pe[s]=Bt(A,T,we);const Y=cn(v,f,Pe,D,_),ce={...v,[f]:Y},{resolveType:Me,formValue:We}=Jt(Be,ce,x??void 0);nt(Me),Xe(We);try{await X.mutateAsync({blockKey:f,data:Y}),le&&le!==t&&await jt(le,ce),h?.()}catch(xt){ae.error(p("sectionsEditor.sectionsEditor.couldNotApplySavedRule"),{description:It(p,Ft(xt))})}};if(!ne&&!_e)return o.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:p("sectionsEditor.sectionsEditor.noPageFound",{currentPath:u})});if(ne&&!Mn)return o.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:p("sectionsEditor.sectionsEditor.globalBlockNotFound")});const Oe=S!==null?Ve[S]??null:null,kr=S!==null?U[S]:null,Er=kr&&Oe?.isMultivariate?ot(kr,Oe):null,Vt=Er?Es(Er,re):[],On=Math.min(Qe,Math.max(Vt.length-1,0)),Rt=Vt[On]??null,Pt=Oe?.isMultivariate===!0,ds=S!==null&&Oe!==null,Mt=ds&&(Pt||!!(Fn&&he)),La=Mt&&!ne&&Oe?.isSavedBlock===!0,pt=ne||La,Rr=ne?Qs:Oe?.label??"",$a=nn&&x?qn(nn,x):null,Ar=(t,s)=>s&&q?`${t} · ${s}`:t,Cr=Oe?Oe.variantOf??Oe.label:"",za=(()=>{const t=Pt&&Rt?Rt.label:null;return t?q?[Ar(Cr,t)]:[Oe.label,t]:[Oe?.label??""]})(),fs=Ar(_e?.name??"",vt?Fe?.label:null),Ln=Mt&&(!ne||ee.length>0)?ne?[Qs,...ee]:[fs,...za,...ee]:[],Nr=He&&_e?[_e.name,"SEO",...$s]:[],Tr=p("sectionsEditor.pageVariantTabs.variantsLabel"),Vr=en&&_e?[_e.name,Tr]:$t&&_e&&Oe?[fs,Cr,Tr]:[],$n=Vr.length>0?Vr:Nr.length>0?Nr:pt?Ln.length>0?Ln:[Rr]:Ln.length>0?Ln:[fs],Pr=ds&&!Pt&&!Oe?.isHidden&&!!C,Ha=pt||!ne&&vt&&!!Fe||Pr,Wa=ds&&!Pt&&!ne&&ee.length===0&&!!Oe&&Oo(Oe)&&!!C,qa=q&&Mt&&!$t&&Pt&&ee.length===0&&!!Rt,Mr=q&&ee.length>0?eo(ee[ee.length-1]):null,Ga=ee.length>1?eo(ee[ee.length-2]):null,Dr=pt?Rr:Mt?Oe?.label??"":_e?.name??"",Ua=en||$t?p("sectionsEditor.pageVariantTabs.variantsLabel"):He?p("sectionsEditor.panelSections.seo"):Mr??Dr,Kr=$t?Oe?.variantOf??Oe?.label??"":en||He?_e?.name??"":Mr?Ga??Dr:pt?p("sectionsEditor.sectionsEditor.globalSectionSubtitle"):Mt?_e?.name??"":_e?.path??"",ms=!en&&!$t&&!He&&!Mt&&!pt,Ya=!q&&!He&&!ne&&Pt&&ee.length===0,wn=()=>{if(!C)return;yt(),$.current&&(clearTimeout($.current),$.current=null),Ie.current.clear();const t=g[C],s=_l(t.sections,U,x,j);if(!s)return;const{sections:i,newVariantIndex:c}=s;X.mutate({blockKey:C,data:{...t,sections:i}},{onSuccess:()=>{G(c),K(null),M(null),O(null),F([]),de(null),be(null)},onError:X.reportError})},zn=(t,s,i)=>{if(!C)return;yt(),$.current&&(clearTimeout($.current),$.current=null),Ie.current.clear();const c=g[C],d=c.sections;if(!d||typeof d!="object"||Array.isArray(d))return;const v=d;if(!Array.isArray(v.variants))return;const f=t([...v.variants]);if(!f)return;const _=Dl(v,f),D={...g,[C]:{...c,sections:_}};X.mutate({blockKey:C,data:D[C]},{onSuccess:()=>{s?.();const A=typeof i=="string"?[i]:i??[];(async()=>{for(const T of A)await jt(T,D)})()},onError:X.reportError})},Ir=(t,s)=>{if(t===s)return;let i=ve;ve===t?i=s:t<ve&&s>=ve?i=ve-1:t>ve&&s<=ve&&(i=ve+1),G(i);const c=Yn(Te.map(d=>({rule:d.rule})),t,s);os(c,i),zn(d=>Yn(d,t,s))},Fr=t=>{const s=Te[t]?.rule,i=St(s,g??{},x??void 0);zn(c=>c.length<=1?null:(c.splice(t,1),c),()=>{Te.length-1===1?G(0):t<ve?G(ve-1):t===ve&&G(Math.max(0,t-1)),K(null),M(null),O(null),F([]),de(null),be(null)},i)},Ja=()=>{const t=Te.map((s,i)=>({variant:s,index:i})).filter(({variant:s})=>!Tl(s.rule)).map(({variant:s})=>St(s.rule,g??{},x??void 0)).filter(s=>!!s);zn(s=>{const i=Fl({variants:s}),c=s[i];return c?[{...c,rule:Bl(x)}]:null},()=>{G(0),K(null),M(null),O(null),F([]),de(null),be(null),Cn(!1)},t)},Br=t=>{let s=t+1;zn(i=>(s=vo(i,t,j),Ol(i,t,j)),()=>{G(s),K(null),M(null),O(null),F([]),de(null),be(null)})},Qa=async(t,s)=>{yt(),$.current&&(clearTimeout($.current),$.current=null),Ie.current.clear();const i=Se.current.activePageKey,c=Se.current.decofile;if(!i)return;const d=c[i],v=d.sections;if(!v||typeof v!="object"||Array.isArray(v))return;const f=v;if(!Array.isArray(f.variants))return;const _=[...f.variants],D=_[t];if(!D?.rule||typeof D.rule!="object"){ae.error(p("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const A=D.rule,T=s.trim();rn(!0);try{if(!T){if(!Qt(A,c,x)){ze(null);return}const Pe=A.__resolveType??"";_[t]={...D,rule:Rs(A,c,x)};const Y={...c,[i]:{...d,sections:{...f,variants:_}}};await X.mutateAsync({blockKey:i,data:Y[i]}),await jt(Pe,Y),ze(null),h?.();return}const P=As(A,c,x);if(!P){ae.error(p("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(P.blockKey){await X.mutateAsync({blockKey:P.blockKey,data:Ot(P.resolveType,P.data,T)}),ze(null),h?.();return}const se=Gn(T),le=Un(se,c,x);if(le){ae.error(le);return}const Be=Ot(P.resolveType,P.data,T);let we=null;try{await X.mutateAsync({blockKey:se,data:Be}),we=se,_[t]={...D,rule:dn(se)},await X.mutateAsync({blockKey:i,data:{...d,sections:{...f,variants:_}}}),we=null}catch(Pe){throw we&&await Vn.mutateAsync({blockKey:we}).catch(()=>{}),Pe}ze(null),ae.success(p("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:T})),h?.()}catch(P){ae.error(p("sectionsEditor.sectionsEditor.failedToRenameVariant"),{description:It(p,Ft(P))})}finally{rn(!1)}},Xa=async(t,s)=>{yt(),$.current&&(clearTimeout($.current),$.current=null),Ie.current.clear();const{selectedSectionIndex:i,rawSections:c,parsedSections:d,decofile:v,activePageKey:f,pageVariants:_,variantIndex:D}=Se.current;if(i===null||!f)return;const A=c[i],T=d[i];if(!A||!T?.isMultivariate)return;const P=ot(A,T);if(!P)return;const se=P.variants??[],le=se[t];if(!le?.rule||typeof le.rule!="object"){ae.error(p("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const Be=le.rule,we=s.trim();rn(!0);const Pe=async Y=>{const ce={...P,variants:Y},Me=[...c];Me[i]=Bt(A,T,ce);const We=cn(v,f,Me,D,_);return await X.mutateAsync({blockKey:f,data:We}),{...v,[f]:We}};try{if(!we){if(!Qt(Be,v,x)){it(null);return}const lt=Be.__resolveType??"",bt=[...se];bt[t]={...le,rule:Rs(Be,v,x)};const Dt=await Pe(bt);await jt(lt,Dt),it(null),h?.();return}const Y=As(Be,v,x);if(!Y){ae.error(p("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(Y.blockKey){await X.mutateAsync({blockKey:Y.blockKey,data:Ot(Y.resolveType,Y.data,we)}),it(null),h?.();return}const ce=Gn(we),Me=Un(ce,v,x);if(Me){ae.error(Me);return}const We=Ot(Y.resolveType,Y.data,we);let xt=null;try{await X.mutateAsync({blockKey:ce,data:We}),xt=ce;const lt=[...se];lt[t]={...le,rule:dn(ce)},await Pe(lt),xt=null}catch(lt){throw xt&&await Vn.mutateAsync({blockKey:xt}).catch(()=>{}),lt}it(null),ae.success(p("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:we})),h?.()}catch(Y){ae.error(p("sectionsEditor.sectionsEditor.failedToRenameVariant"),{description:It(p,Ft(Y))})}finally{rn(!1)}},Or=async(t,s,i)=>{M(i);try{await X.mutateAsync({blockKey:t,data:i})}catch(c){throw M(d=>d===i?s:d),c}},Za={rename:async(t,s,i)=>{yt(),$.current&&(clearTimeout($.current),$.current=null),Ie.current.clear();const{activePageKey:c,decofile:d}=Se.current;if(!c)return;const v=Array.isArray(t.variants)?[...t.variants]:[],f=v[s],_=f?.rule&&typeof f.rule=="object"?f.rule:void 0,D=async T=>{const P={...t,variants:T};return await Or(c,t,P),{...d,[c]:P}},A=ku(_,i,d,x);if(A.kind!=="noop"){if(A.kind==="error"){ae.error(A.reason==="no-matcher-rule"?p("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"):A.reason==="unreadable-rule"?p("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"):A.message??p("sectionsEditor.sectionsEditor.failedToRenameVariant"));return}rn(!0);try{if(A.kind==="inline"){const P=[...v];P[s]={...f,rule:A.inlinedRule};const se=await D(P);await jt(A.blockKey,se),h?.();return}if(A.kind==="updateBlock"){await X.mutateAsync({blockKey:A.blockKey,data:A.blockData}),h?.();return}let T=null;try{await X.mutateAsync({blockKey:A.blockId,data:A.blockData}),T=A.blockId;const P=[...v];P[s]={...f,rule:A.reference},await D(P),T=null}catch(P){throw T&&await Vn.mutateAsync({blockKey:T}).catch(()=>{}),P}ae.success(p("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:i.trim()})),h?.()}catch(T){ae.error(p("sectionsEditor.sectionsEditor.failedToRenameVariant"),{description:It(p,Ft(T))})}finally{rn(!1)}}},selectGlobal:async(t,s,i)=>{yt(),$.current&&(clearTimeout($.current),$.current=null),Ie.current.clear();const{activePageKey:c,decofile:d}=Se.current;if(!c)return;const v=Array.isArray(t.variants)?[...t.variants]:[],f=v[s];if(!f)return;const _=St(f.rule,d,x);v[s]={...f,rule:dn(i)};const D={...t,variants:v},A={...d,[c]:D};try{await Or(c,t,D),_&&_!==i&&await jt(_,A),h?.()}catch(T){ae.error(p("sectionsEditor.sectionsEditor.couldNotApplySavedRule"),{description:It(p,Ft(T))})}},selectNamedRule:async(t,s,i)=>{yt(),$.current&&(clearTimeout($.current),$.current=null),Ie.current.clear();const{activePageKey:c,decofile:d}=Se.current;if(!c)return;let v=null,f=null;const _=await Bn(i,d,D=>{const A=Array.isArray(t.variants)?[...t.variants]:[],T=A[s];return T?(v=St(T.rule,d,x),A[s]={...T,rule:D},f={...t,variants:A},{blockKey:c,data:f}):null});!_||!f||(M(f),v&&await jt(v,_.projected),h?.())}},Lr=()=>{Gt()},$r=t=>{mn(t),ls({inner:t})},zr=t=>{Tn(t),ls({raw:t})},Hr=()=>{mn(null),zt([])},Wr=()=>tn(t=>t+1),qr=()=>{pn.flush(),fn(!1),mn(null),Tn(void 0),zt([]),tn(t=>t+1),N?.()},ei=()=>{Cn(!1),Nn(!1),K(null),fn(!0)},ti=()=>{He&&qr(),K(null),Cn(!0)},ni=()=>Nn(!0),ps=t=>{if(en&&t===0){Cn(!1);return}if($t&&t<2){Nn(!1),t===0&&K(null);return}if(He){if(t===0){qr();return}if(t===1){zt([]),tn(i=>i+1);return}zt($s.slice(0,t-1)),tn(i=>i+1);return}if(ne){F(ee.slice(0,t)),I(i=>i+1);return}if(t===0){Lr();return}if(t===1){F([]),I(i=>i+1);return}const s=!q&&Pt&&Rt?1:0;if(s===1&&t===2){F([]),I(i=>i+1);return}F(ee.slice(0,t-1-s))},hs=$n.length>1?o.jsx("button",{type:"button",onClick:()=>ps(Wi($n.length,{isMultivariateSectionTop:Ya})),title:p("sectionsEditor.sectionsEditor.back"),"aria-label":p("sectionsEditor.sectionsEditor.back"),className:me("shrink-0 inline-flex size-6 items-center justify-center rounded-[var(--studio-control-radius,var(--radius-md))] transition-colors",pt?"text-foreground/80 hover:bg-global-section/15":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:o.jsx(Ji,{className:"size-4"})}):null,si=pt||Mt||He?Ha&&o.jsxs("div",{className:me("border-b px-3 py-2.5",pt&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[!ne&&vt&&Fe&&o.jsxs("button",{type:"button",onClick:Lr,title:p("sectionsEditor.sectionsEditor.editingInVariant",{variant:Fe.label}),className:me("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",Ki),children:[o.jsx(Di,{rule:bs(Fe.rule,g??{},x??void 0),matchers:an}),o.jsx("span",{className:"max-w-[160px] truncate",children:Fe.label})]}),o.jsx("div",{className:"flex-1"}),pt&&o.jsxs(At,{children:[o.jsx(Ct,{asChild:!0,children:o.jsx("span",{className:"shrink-0 cursor-help",children:o.jsx(Qn,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),o.jsx(Nt,{side:"bottom",className:"max-w-[260px]",children:p("sectionsEditor.sectionsEditor.globalSectionTooltip")})]}),Pr&&o.jsx(Wn,{onClick:()=>_n()})]}),pt&&o.jsx("p",{className:"mt-1.5 py-1.5 pl-1 text-sm leading-snug text-foreground",children:p("sectionsEditor.sectionsEditor.globalSectionBanner")})]}):o.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2.5",children:[o.jsx("div",{className:"flex-1 min-w-0",children:o.jsx(to,{pageKey:C,initialName:_e.name,initialPath:_e.path,onFieldChange:dr,variant:"header"})}),o.jsxs(At,{children:[o.jsx(Ct,{asChild:!0,children:o.jsx(Et,{type:"button",variant:"ghost",size:"icon-sm","aria-label":p("sectionsEditor.sectionsEditor.editSeo"),className:"shrink-0",onClick:()=>fn(!0),children:o.jsx(co,{size:14})})}),o.jsx(Nt,{side:"bottom",children:p("sectionsEditor.sectionsEditor.editSeo")})]}),o.jsxs(At,{children:[o.jsx(Ct,{asChild:!0,children:o.jsx(Et,{type:"button",variant:"ghost",size:"icon-sm","aria-label":p("sectionsEditor.sectionsEditor.viewJson"),className:"shrink-0",onClick:()=>z&&C?z():es(!0),children:o.jsx(uo,{size:14})})}),o.jsx(Nt,{side:"bottom",children:p("sectionsEditor.sectionsEditor.viewJson")})]}),o.jsx(Wn,{onClick:wn})]}),ri=o.jsxs(o.Fragment,{children:[vt&&C&&o.jsx(no,{listKey:C,variants:Te,activeIndex:ve,decofile:g??{},meta:x,matchers:an,onSelect:yn,onReorder:Ir,onRename:ze,onDuplicate:Br,onDelete:Fr,onAdd:wn}),vt&&ge!==null&&o.jsx(so,{className:"mt-3",children:o.jsx("div",{className:me("space-y-3",sn&&"pointer-events-none opacity-50"),children:o.jsx(vs,{currentRt:ge,currentLabel:kn(Fe?.rule,g??{},re,x??void 0),currentGlobalKey:St(Fe?.rule,g??{},x??void 0)??void 0,matchers:an,globals:cs,onSelect:xr,onSelectGlobal:wr,named:us(Fe?.rule,_r),namedRow:xs(Fe?.rule,Ut),rule:Fe?.rule,schema:vr,formValue:Ye,onChange:br,formKey:`${ve}:${ge??""}`,formWrapperClassName:"space-y-3",meta:x??void 0,decofile:g,onSaveReferencedBlock:hn,sandbox:xn})})})]}),Gr=o.jsxs(o.Fragment,{children:[o.jsx(Ii,{listKey:`${C??""}:${S??""}`,variants:Vt.map((t,s)=>({index:s,label:t.label})),selectedIndex:On,onSelect:mr,onRename:it,onDuplicate:Ma,onDelete:Pa,onRemoveAll:pr,onReorder:Da,onAdd:()=>_n()}),o.jsx(so,{children:o.jsx(vs,{currentRt:nn??"",currentLabel:kn(Rt?.rule,g??{},re,x??void 0),currentGlobalKey:St(Rt?.rule,g??{},x??void 0)??void 0,matchers:an,globals:cs,onSelect:Ia,onSelectGlobal:Oa,named:us(Rt?.rule,Ba),namedRow:xs(Rt?.rule,Ut),rule:Rt?.rule,schema:$a,formValue:ea,onChange:Fa,formKey:`${S??"none"}:${On}:${nn??""}`,formWrapperClassName:"pt-1",meta:x??void 0,decofile:g,onSaveReferencedBlock:hn,sandbox:xn})})]}),Ur=o.jsx("div",{className:me(q?"px-2":"p-2 pt-3"),children:o.jsx(Pc,{listKey:`${C??""}-${ve}`,rawSections:U,sections:Ve,meta:x,decofile:g,selectedIndex:S,onSelect:ja,onReorder:ka,onDelete:Ea,onDuplicate:Ra,onMakeReusable:ie,onToggleHidden:Aa,onToggleLazy:Ae?Ca:void 0,onAddVariant:_n,onDetach:Na,onAddSection:()=>Zt(!0),canAddSection:gr})}),oi=o.jsxs("div",{className:"min-w-0 max-w-full space-y-4 overflow-x-hidden px-3",children:[C&&_e&&o.jsx(to,{pageKey:C,initialName:_e.name,initialPath:_e.path,onFieldChange:dr}),Wt&&C?o.jsx(wo,{rawSeo:Dn,innerSeo:rs,defaultResolveType:Zs,seoTypesLoading:j&&!x,seoSchema:er,activeResolveType:Kn,seoTypeOptions:Xs,formResetKey:zs,siteDefaultSeo:tr,onBreadcrumbChange:zt,onPersistRaw:zr,onInnerChange:$r,onClearForm:Hr,onBumpFormKey:Wr,asyncRenderAvailable:Ae}):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:p("sectionsEditor.sectionsEditor.seoSchemaNotFound")})]}),ai=o.jsx(un,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:o.jsx("div",{className:"mx-auto max-w-2xl",children:Wt&&C?o.jsx(wo,{rawSeo:Dn,innerSeo:rs,defaultResolveType:Zs,seoTypesLoading:j&&!x,seoSchema:er,activeResolveType:Kn,seoTypeOptions:Xs,formResetKey:zs,siteDefaultSeo:tr,onBreadcrumbChange:zt,onPersistRaw:zr,onInnerChange:$r,onClearForm:Hr,onBumpFormKey:Wr,asyncRenderAvailable:Ae}):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:p("sectionsEditor.sectionsEditor.seoSchemaNotFound")})})})},"editor-seo"),ii=o.jsxs(un,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[vt&&C&&o.jsx(no,{listKey:C,variants:Te,activeIndex:ve,decofile:g??{},meta:x,matchers:an,onSelect:yn,onReorder:Ir,onRename:ze,onDuplicate:Br,onDelete:Fr,onAdd:wn}),vt&&ge!==null&&o.jsxs("div",{className:me("px-3 border-b",An?"pt-3 pb-5 space-y-3":"py-2"),children:[o.jsxs("button",{type:"button",onClick:()=>Xo(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-accent","aria-expanded":An,children:[o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:p("sectionsEditor.sectionsEditor.variantRule")}),An?o.jsx(Gi,{className:"size-3.5 shrink-0 text-muted-foreground"}):o.jsx(Ui,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),An&&o.jsx("div",{className:me("space-y-3",sn&&"pointer-events-none opacity-50"),children:o.jsx(vs,{currentRt:ge,currentLabel:kn(Fe?.rule,g??{},re,x??void 0),currentGlobalKey:St(Fe?.rule,g??{},x??void 0)??void 0,matchers:an,globals:cs,onSelect:xr,onSelectGlobal:wr,named:us(Fe?.rule,_r),namedRow:xs(Fe?.rule,Ut),rule:Fe?.rule,schema:vr,formValue:Ye,onChange:br,formKey:`${ve}:${ge??""}`,formWrapperClassName:"space-y-3",meta:x??void 0,decofile:g,onSaveReferencedBlock:hn,sandbox:xn})})]}),Ur]},"editor-section-list");return o.jsx(Fi,{value:j,children:o.jsx(Bi,{children:o.jsxs("div",{className:"flex h-full min-w-0 w-full flex-col",children:[!q&&hs&&o.jsx("div",{className:"flex min-w-0 shrink-0 items-center gap-2 px-3 py-2",children:hs}),(q||$n.length>1)&&o.jsx(Oi,{crumbs:$n,onSelect:ps,onSelectRoot:()=>{pn.flush(),L?L():ps(0)}}),o.jsx("div",{className:"shrink-0",children:q?o.jsxs("div",{className:me("flex items-center gap-2 border-b px-3 py-2.5",pt&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[q&&hs,pt&&o.jsxs(At,{children:[o.jsx(Ct,{asChild:!0,children:o.jsx("span",{className:"shrink-0 cursor-help",children:o.jsx(Qn,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),o.jsx(Nt,{side:"bottom",className:"max-w-[260px]",children:p("sectionsEditor.sectionsEditor.globalSectionTooltip")})]}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[o.jsx("span",{className:"truncate text-sm font-semibold",children:Ua}),Kr&&o.jsx("span",{className:"truncate text-xs text-muted-foreground",children:Kr})]}),ms&&vt&&Fe&&o.jsx(ro,{variants:Te,activeIndex:ve,onSelect:yn,onManage:ti,onRemoveAll:Ja}),qa&&o.jsx(ro,{variants:Vt,activeIndex:On,onSelect:mr,onManage:ni,onRemoveAll:pr}),ms&&!vt&&o.jsx(Wn,{onClick:wn}),Wa&&o.jsx(Wn,{onClick:()=>_n()}),o.jsx(Li,{}),ms&&o.jsxs(o.Fragment,{children:[o.jsxs(At,{children:[o.jsx(Ct,{asChild:!0,children:o.jsx(Et,{type:"button",variant:"outline",size:"icon-sm","aria-label":p("sectionsEditor.sectionsEditor.editSeo"),className:"shrink-0",onClick:ei,children:o.jsx(co,{size:14})})}),o.jsx(Nt,{side:"bottom",children:p("sectionsEditor.sectionsEditor.editSeo")})]}),!z&&o.jsxs(At,{children:[o.jsx(Ct,{asChild:!0,children:o.jsx(Et,{type:"button",variant:"outline",size:"icon-sm","aria-label":p("sectionsEditor.sectionsEditor.viewJson"),className:"shrink-0",onClick:()=>es(!0),children:o.jsx(uo,{size:14})})}),o.jsx(Nt,{side:"bottom",children:p("sectionsEditor.sectionsEditor.viewJson")})]})]})]}):si}),ft&&o.jsx(Zc,{open:!0,fields:zc(ft.plan,ft.target.schema),choices:ft.choices,changedAgain:ft.changedAgain,author:ca,fresh:ft.fresh,onChoose:(t,s)=>wa({...ft.choices,[t]:s}),onApply:_a},Cu(ft.formBase)),$t?o.jsx(oo,{onAdd:()=>_n(),children:Gr},"editor-section-variants"):Mt?o.jsxs(un,{viewportRef:De,onBlur:ar,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[!q&&Pt&&Vt.length>0&&ee.length===0&&Gr,o.jsx(po,{value:Sr,children:o.jsx(ao,{value:ne&&j?Ue:null,children:o.jsx(io,{activeSchema:Fn,formValue:he,formResetKey:st,onFormChange:ur,onBreadcrumbChange:F,breadcrumbPath:ee,emptyMessage:p("sectionsEditor.sectionsEditor.noEditableFieldsForVariant"),meta:x,decofile:g,onSaveReferencedBlock:hn,sandbox:xn,previewBaseUrl:fe,onRequestAddSection:fr,onVariantMatcherOp:ne?Za:void 0})})})]},"editor-section-form"):ne?o.jsx(un,{viewportRef:De,onBlur:ar,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx(po,{value:Sr,children:o.jsx(ao,{value:ne&&j?Ue:null,children:o.jsx(io,{activeSchema:Fn,formValue:he,formResetKey:st,onFormChange:ur,onBreadcrumbChange:F,breadcrumbPath:ee,emptyMessage:p("sectionsEditor.sectionsEditor.noEditableFieldsForGlobalBlock"),meta:x,decofile:g,onSaveReferencedBlock:hn,sandbox:xn,previewBaseUrl:fe,onRequestAddSection:fr})})})},"editor-global-block"):He?q?o.jsx(un,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"p-3",children:oi})},"editor-seo"):ai:en?o.jsx(oo,{onAdd:wn,children:ri},"editor-variants"):q?o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[o.jsx(un,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"py-2",children:Ur})}),o.jsx("div",{className:"shrink-0 border-t p-2",children:o.jsx(Ts,{canAddSection:gr,onAddSection:()=>Zt(!0)})})]},"editor-section-list"):ii,o.jsx($i,{open:Je!==null,onOpenChange:t=>{t||ie(null)},defaultBlockId:Je!==null?Gn(Ve[Je]?.label??""):"",isPending:X.isPending,onSubmit:Ka}),Ce&&o.jsx(rc,{open:Qo,onOpenChange:t=>{Zt(t),t||(Rn.current=null)},meta:x,decofile:g,previewBaseUrl:fe,onSelect:Va}),Fs&&C&&g&&o.jsx(pl,{open:Fs,onOpenChange:es,pageKey:C,decofile:g}),Ne!==null&&o.jsx(lo,{open:!0,initialName:Qt(Te[Ne]?.rule,g??{},x??void 0)?kn(Te[Ne]?.rule,g??{},re,x??void 0):"",autoLabel:re(bs(Te[Ne]?.rule,g??{},x??void 0)),isPending:sn,onSubmit:async t=>{await Qa(Ne,t)},onOpenChange:t=>{!t&&!sn&&ze(null)}}),rt!==null&&o.jsx(lo,{open:!0,initialName:Qt(Vt[rt]?.rule,g??{},x??void 0)?kn(Vt[rt]?.rule,g??{},re,x??void 0):"",autoLabel:re(bs(Vt[rt]?.rule,g??{},x??void 0)),isPending:sn,onSubmit:async t=>{await Xa(rt,t)},onOpenChange:t=>{!t&&!sn&&it(null)}})]})})})}export{vm as SectionsEditor};